Commit Graph

15 Commits

Author SHA1 Message Date
fullex
9b9570116a refactor(db): replace libsql with better-sqlite3 + sqlite-vec (#16626) 2026-07-02 13:21:13 +08:00
LiuVaayne
efecdd5007 refactor(binary-manager): unify CLI binary acquisition behind mise-backed BinaryManager (#15184)
### What this PR does

**Before this PR**, Cherry Studio managed external CLI binaries through
five uncoordinated mechanisms — each requiring its own download script,
IPC channel, and on-disk layout:

| Mechanism | Where it lived | How it worked |
|---|---|---|
| rtk extraction | `src/main/utils/rtk.ts` + `AgentBootstrapService` |
Copies bundled binary to `~/.cherrystudio/bin/` |
| OpenClaw installer | `resources/scripts/install-openclaw.js` |
Downloads from GitHub/mirror with custom extraction |
| CodeCliService | `src/main/services/CodeCliService.ts` | `bun install
-g` to `~/.cherrystudio/install/global/` |
| ripgrep | `node_modules/@anthropic-ai/claude-agent-sdk/vendor/` |
Vendored, hardcoded path in `FileStorage` |
| (old) MiseService | `src/main/services/MiseService.ts` | Bundled mise
+ `mise use -g` |

**After this PR**, a single `BinaryManager` lifecycle service owns all
third-party CLI binary acquisition. It wraps
[mise](https://mise.jdx.dev) as the only acquisition backend (no custom
`BinaryBackend` interface — mise's polyglot grammar already covers
`npm:`, `pipx:`, `github:`, registry entries). Tools install into an
isolated environment under `~/.cherrystudio/mise/` so user-level mise
installs are never touched. `uv`, `bun`, `rg`, and mise itself ship
bundled at build time for instant first-run availability; everything
else flows through mise on demand.

<img width=\"1304\" height=\"714\" alt=\"BinaryManager settings UI\"
src=\"https://github.com/user-attachments/assets/7a4b78ab-5aa2-4e97-9ab7-134b20a4d78d\"
/>
<img width=\"1165\" height=\"748\" alt=\"Three-state managed vs bundled
vs not-installed\"
src=\"https://github.com/user-attachments/assets/a0dcfb7d-8bc3-4acd-b563-0fc04d99e252\"
/>
<img width=\"523\" height=\"328\" alt=\"Custom tool dialog\"
src=\"https://github.com/user-attachments/assets/90c3ee95-7f2a-4daf-a334-f20de6ff5ca2\"
/>

Fixes #15183. Addresses #15370.

### Why we need it and why it was done in this way

Adding a new managed CLI tool should be a one-line preset entry — not 4+
files of bespoke download/extract/IPC code. mise is a mature polyglot
tool manager that already speaks the backends Cherry needs.

**Tradeoffs made:**
- **mise bundled at build time** (~15 MB per platform) rather than
downloaded at first run — faster first-run UX, no chicken-and-egg on a
fresh install.
- **Fully isolated mise environment** (\`HOME\`/\`XDG_*\`/\`MISE_*\` all
relocated under \`feature.binaries.data\`) — Cherry never reads or
writes the user's own \`~/.config/mise/\` or \`~/.local/share/mise/\`.
- **No custom \`BinaryBackend\` interface.** mise's grammar (\`npm:\`,
\`pipx:\`, \`github:\`, registry) is already polyglot; wrapping it would
be a shallow seam that re-implements what mise owns. Removing this
abstraction makes consumers simpler (deletion test passes).
- **Auth-token policy: opt-in only.** Ambient \`GITHUB_TOKEN\` /
\`GH_TOKEN\` are not forwarded into mise's process env. Users who hit
GitHub's unauthenticated 60 req/hr API limit can set
\`CHERRY_GITHUB_TOKEN\` to raise it to 5000 req/hr without consenting to
share their general shell token.
- **China mirror auto-detection.** \`isUserInChina()\` toggles
\`NPM_CONFIG_REGISTRY=registry.npmmirror.com\` +
\`PIP_INDEX_URL=pypi.tuna.tsinghua.edu.cn\` for every npm/pipx backend
transparently.

**Alternatives considered:**
- *Keep per-tool install scripts.* Doesn't scale — each new tool is 4+
files of duplicated logic.
- *Use mise from user's \`PATH\`.* Would depend on user having mise
installed and could conflict with their config.
- *Custom \`BinaryBackend\` abstraction.* Shallow wrapper over mise's
grammar; no second backend in sight; deletion test passes.

**Scope (what's in / what's out):**
- **In:** uv, bun, ripgrep, claude-code, openclaw, gh, opencode,
gemini-cli, lark, kimi-cli, qwen-code, iflow-cli, github-copilot-cli —
anything mise can install as a single relocatable binary.
- **Out:** \`OvmsManager\` (multi-file server provisioning, hardware
detection, generated config); Tesseract OCR data (not a binary; lives
with \`OvOcrService\`).

### Breaking changes

None at the user-facing layer. v2 data is throwaway per CLAUDE.md, so
the preference-key rename (\`feature.mise.*\` → \`feature.binaries.*\`)
intentionally ships without a migrator.

### Special notes for your reviewer

**Architecture & docs**
- \`docs/references/binary-manager/README.md\` — scope criterion,
persisted/contract surface, bundled-vs-mise state contract, China mirror
behavior, \`CHERRY_GITHUB_TOKEN\` opt-in, adding a new managed binary.
- \`CLAUDE.md\` adds a \`**MUST READ**\` link next to Lifecycle / Window
Manager / Data / Paths.
- The mise-shim-wins-over-\`cherry.bin\` precedence rule is documented
in the README's "State contract" section.

**Code orientation**
- \`src/main/services/BinaryManager.ts\` — the lifecycle service. Wraps
mise via \`runMise()\`; isolated env in \`buildIsolatedEnv()\`; bundled
extraction with atomic tmp+rename; per-tool try/catch so a single
failure can't abort init; \`isManagedBinaryReady()\` verifies the
resolved file is executable (not just that mise thinks it's installed).
- \`packages/shared/data/presets/binary-tools.ts\` —
\`PREDEFINED_BINARY_TOOLS\` registry; \`tool\` field is a mise spec.
-
\`src/renderer/src/pages/settings/McpSettings/EnvironmentDependencies.tsx\`
— three-state UI (\`managed\` / \`bundled\` / \`not-installed\`) backed
by \`Binary_GetState\` + \`Binary_ProbeBundled\`.
- \`scripts/download-binaries.js\` — build-time downloader for mise / uv
/ bun / rg (HTTPS + sha256-verified, archive-aware extraction).

**Migration**
- \`OpenClawService.install()\` is now two lines delegating to
\`BinaryManager\` — \`install-openclaw.js\` is gone.
- \`CodeCliService\` no longer uses \`bun install -g\`; the
\`BUN_INSTALL\` / \`~/.cherrystudio/install/global/\` path is removed.
- \`FileStorage.getRipgrepBinaryPath()\` now resolves via
\`getBinaryPath('rg')\`; the vendored SDK rg is no longer used.
- \`extractRtkBinaries\` + the \`AgentBootstrapService\` call are
deleted. \`rtkRewrite()\` degrades gracefully when rtk is absent;
\`rtkAvailable\` caches with a 60s TTL so install-via-mise takes effect
without restart.

**Multi-round review**
Two adversarial review rounds against this branch (Bug Hunter / Security
/ Architecture / Correctness) ran during development; both rounds'
High-severity findings are addressed in commits \`70afde6af\` and
\`1d864439d\`. R3 known follow-ups (architecture duplications in
\`CodeCliService\`'s switch statements, etc.) are tracked as Medium and
intentionally deferred.

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: Write code that humans can understand and Keep it simple
- [x] Refactor: Leaves binary acquisition meaningfully cleaner than
before (five mechanisms → one)
- [x] Upgrade: v2 data is throwaway; no migrator needed and the absence
is intentional
- [x] Documentation: \`docs/references/binary-manager/README.md\` +
\`CLAUDE.md\` Architecture section
- [x] Self-review: Two multi-perspective review rounds against the
branch; all Highs addressed

### Release note

\`\`\`release-note
NONE
\`\`\`

---------

Signed-off-by: Vaayne <liu.vaayne@gmail.com>
Signed-off-by: Vaayne Liu <vaayne@macos.shared>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
2026-06-24 15:15:25 +08:00
SuYao
5706307451 refactor(ai-service): consolidate AI runtime to main process (#14911)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: fullex <106392080+0xfullex@users.noreply.github.com>
Signed-off-by: suyao <sy20010504@gmail.com>
2026-06-05 00:06:51 +08:00
LiuVaayne
4ef98318af feat: integrate rtk for reducing LLM token consumption on agent shell commands (#13615)
### What this PR does

Before this PR:
Agent Bash tool calls output raw, verbose shell command results that
consume excessive LLM tokens.

After this PR:
Bash commands are transparently rewritten via
[rtk](https://github.com/rtk-ai/rtk) to produce concise, LLM-friendly
output — reducing token consumption by 60-90% on common shell commands
(`cat`, `grep`, `find`, `ls`, etc.).

<img width="647" height="578" alt="image"
src="https://github.com/user-attachments/assets/438de126-c79d-4b69-bf3b-65a220671900"
/>



Fixes #13600

### Why we need it and why it was done in this way

rtk is a single Rust binary (MIT licensed, zero dependencies) that
rewrites shell commands into optimized versions. When a command has no
rtk equivalent, it passes through unchanged — zero risk of breaking
existing workflows.

The integration follows three layers:
1. **Build time**: `scripts/download-rtk-binaries.js` downloads
platform-specific rtk and jq binaries into `resources/binaries/`
(bundled via existing `asarUnpack: resources/**`)
2. **First run**: `extractRtkBinaries()` copies binaries from app
resources to `~/.cherrystudio/bin/` (follows existing binary
distribution pattern used by bun, uv, openclaw)
3. **Runtime**: A `PreToolUse` hook in the Claude Code service
intercepts Bash tool calls, runs `rtk rewrite "<command>"`, and
substitutes the optimized command if available

The following tradeoffs were made:
- Binaries are bundled in the app package (increases app size ~5MB)
rather than downloaded on demand — ensures rtk is always available
without network dependency
- jq is bundled alongside rtk for potential external hook script usage,
even though the TypeScript hook doesn't need it
- `rtkRewrite()` is async (non-blocking) to avoid stalling the main
process event loop

The following alternatives were considered:
- On-demand download (like bun/uv install scripts) — rejected because
rtk should "always be on" per requirements
- System PATH detection only — rejected because it requires users to
install rtk manually

### Breaking changes

None. The rtk rewrite is transparent and falls back gracefully when rtk
is unavailable or a command has no optimized version.

### Special notes for your reviewer

- The download script is non-fatal: if binary download fails during
build, the build continues without rtk
- The hook runs before the existing `preToolUseHook` (permission
handling), so commands are rewritten before permission checks
- Version guard requires rtk >= 0.23.0 (when `rtk rewrite` subcommand
was introduced)

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: Write code that humans can understand and Keep it simple
- [x] Refactor: You have left the code cleaner than you found it (Boy
Scout Rule)
- [ ] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: A user-guide update was considered and is present
(link) or not required
- [x] Self-review: I have reviewed my own code before requesting review
from others

### Release note

```release-note
Integrate rtk to automatically optimize agent shell commands for 60-90% token savings
```

---------

Signed-off-by: Vaayne <liu.vaayne@gmail.com>
2026-03-30 11:13:35 +08:00
亢奋猫
f9f122a635 fix(deps): add @napi-rs/canvas platform binaries to fix startup crash (#13759)
### What this PR does

Before this PR:
The app crashes on startup with `ReferenceError: DOMMatrix is not
defined` because `@napi-rs/canvas` platform-specific binaries were
missing from `optionalDependencies`.

<img width="620" height="587" alt="image"
src="https://github.com/user-attachments/assets/20269613-cb89-460b-8854-2140ecac289c"
/>

After this PR:
Platform-specific binaries for `@napi-rs/canvas` are properly declared
in `optionalDependencies` and handled in `before-pack.js`, fixing the
startup crash.

### Why we need it and why it was done in this way

The following tradeoffs were made:
- Only mainstream platforms are included (Linux x64/arm64 glibc/musl,
macOS x64/arm64, Windows x64/arm64)
- Excluded rarely-used platforms: linux-arm-gnueabihf (32-bit ARM),
linux-riscv64-gnu (RISC-V), android-arm64 (Android)

The following alternatives were considered:
None - this follows the existing pattern used for `@img/sharp`,
`@libsql`, and `@napi-rs/system-ocr` packages.

### Breaking changes

None.

### Special notes for your reviewer

This change follows the existing pattern in `before-pack.js` for
handling platform-specific native dependencies.

### Checklist

- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [x] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [ ] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. Check this only
when the PR introduces or changes a user-facing feature or behavior.
- [x] Self-review: I have reviewed my own code (e.g., via
[`/gh-pr-review`](/.claude/skills/gh-pr-review/SKILL.md), `gh pr diff`,
or GitHub UI) before requesting review from others

### Release note

```release-note
fix: resolve app startup crash caused by missing @napi-rs/canvas platform binaries (DOMMatrix is not defined)
```

Signed-off-by: kangfenmao <kangfenmao@qq.com>
2026-03-24 17:23:48 +08:00
SuYao
6b9daa749e feat: add plugin package installation from ZIP,directory, remote (#12426)
* feat: add plugin install

* fix: some bug

* fix: i18n

* refactor: rename 'active-directory' to 'resource'

* feat(plugin): support remote fetch plugin

* refactor: improve error display

* feat: add cache protocol

* fix(plugin): address code review issues for PR #12426

- Fix command injection vulnerability by adding -- separator before
  positional arguments in git clone and ls-remote commands
- Extract duplicate file helpers (directoryExists, fileExists, pathExists)
  to shared @main/utils/file utility
- Add depth limit (MAX_PLUGIN_ROOT_DEPTH=10) to findPluginRoots to
  prevent infinite recursion from symlink cycles
- Rename InstallFromZipResult to InstallFromSourceResult with type alias
  for backward compatibility
- Extract duplicate loadFirstPage logic in useMarketplaceBrowser hook
- Add documentation for intentionally disabled readContent and
  invalidateCache methods explaining API compatibility reasons

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(plugin): add documentation for marketplace API and telemetry

- Document MARKETPLACE_API_BASE_URL with API endpoints and usage
- Add TODO for China mainland accessibility testing
- Document reportSkillInstall telemetry behavior and data transmitted

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(plugin): fix skill installation and improve UI

- Fix skill installation using v2 resolve API endpoint
- Extract base repo URL from GitHub tree/blob URLs
- Fix skill card type label (skill -> skills key mapping)
- Split plugin settings into "Available Plugins" and "Installed Plugins" tabs
- Fix refresh button styling with aspect-square
- Add card vertical spacing with pb-4
- Add unit tests for extractBaseRepoUrl and extractResolvedSkill

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(plugin): use useTimer for search debounce

Replace manual setTimeout/clearTimeout with useTimer hook for better
timer management and automatic cleanup on component unmount.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* style(plugin): use explicit unknown type in catch blocks

Change all catch blocks from `catch (error)` to `catch (error: unknown)`
for better type safety and code clarity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(plugin): only show content section for installed plugins

- Skip content fetching for marketplace plugins since readContent
  always fails for remote plugins
- Only display the Content section when viewing installed plugins
- Change catch (error) to catch (error: unknown) for type safety

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(plugin): use Zod schemas for marketplace API responses

- Add PluginResolveResponseSchema for plugin resolution API
- Add ResolvedSkillSchema and SkillsResolveResponseSchema for v2 skills API
- Refactor extractRepositoryUrl to use Zod safeParse instead of manual type checking
- Refactor resolveSkillV2 to validate response with Zod and return typed array
- Update extractResolvedSkill to accept typed array directly
- Update tests to match new function signatures

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(plugin): simplify code and reduce duplication

- Merge runCommand and captureCommand into executeCommand in PluginService
- Combine URL regex patterns and use constant map for plugin directories
- Create generic response parser factory in MarketplaceService
- Extract buildSkillSourceKey helper in useMarketplaceBrowser
- Remove unused displayedEntries variable in PluginBrowser
- Consolidate category config into single object in useResourcePanel
- Extract ensureCacheData helper method in PluginCacheStore

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(plugin): remove dead readContent and invalidateCache methods

Remove methods that were non-functional (always throwing or no-op):
- Remove invalidateCache() no-op method from PluginService
- Remove readContent() method that always throws
- Remove corresponding IPC handlers and preload bindings
- Remove IpcChannel enum entries for both methods
- Remove content section from PluginDetailModal (relied on readContent)
- Remove agentId prop from PluginBrowser (no longer needed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(plugin): update plugin settings and UI components

- Change default page size in useMarketplaceBrowser from 100 to 40 for improved performance.
- Add titles to the installed plugins section in multiple language files for better clarity.
- Refactor AgentSettings components to improve structure and readability, including the introduction of a new PluginsSettings component.
- Update modal widths in AgentSettingsPopup and SessionSettingsPopup for better UI consistency.
- Integrate Scrollbar component in SettingsContainer for enhanced scrolling experience.

* refactor(settings): improve Scrollbar import and enhance type safety

- Change Scrollbar import to use type-only import for ScrollbarProps.
- Update handleVirtualChange function to handle null scrollOffset for better type safety.

* fix(plugin): install only selected plugin and fix uninstall lookup

Bug fixes:
- Install only the specific requested plugin from marketplace repo
  instead of installing all plugins found in the repository
- Use actual installed filename for uninstall instead of marketplace
  metadata filename (which differs due to sanitization)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(plugin): support skill upload via drag-and-drop

Extended installFromSourceDir to detect and install skills:
- Check for plugin roots first (with .claude-plugin/plugin.json)
- If none found, search for skill directories (with SKILL.md)
- Install whichever type is detected

Added new methods:
- installSkillRoots: Install multiple skill directories
- installSkillFromDirectory: Install a single skill folder

Now users can drag-and-drop skill folders or ZIPs containing
skills to install them, not just plugin packages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(browser): add beforeEach to reset mock state

Add vi.clearAllMocks() in beforeEach to prevent state leakage
between tests, which could cause flaky test failures in CI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: kangfenmao <kangfenmao@qq.com>
2026-02-04 14:26:37 +08:00
亢奋猫
bd4f4db572 fix(build): add Linux musl native dependencies for Alpine support (#12412)
* fix(build): add Linux musl native dependencies for Alpine support

Add missing native dependencies for Linux musl (Alpine Linux) platform:
- @img/sharp-linuxmusl-arm64 and @img/sharp-linuxmusl-x64
- @img/sharp-libvips-linuxmusl-arm64 and @img/sharp-libvips-linuxmusl-x64
- @libsql/linux-arm64-musl and @libsql/linux-x64-musl

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(build): add support for Linux musl architecture in before-pack script

Updated the before-pack.js script to include 'linuxmusl' in the platformToArch mapping, enhancing compatibility for Alpine Linux builds.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-21 10:06:27 +08:00
beyondkmp
153c1024f6 refactor: use pnpm install instead of manual download for prebuild packages (#12358)
* refactor: use pnpm install instead of manual download for prebuild packages

Replace manual tgz download with pnpm install for architecture-specific
prebuild binaries, simplifying the build process.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* delete utils

* update after pack

* udpate before pack

* use optional deps

* refactor: use js-yaml to modify pnpm-workspace.yaml for cross-platform builds

- Add all prebuild packages to optionalDependencies in package.json
- Use js-yaml to parse and modify pnpm-workspace.yaml
- Add target platform to supportedArchitectures.os and cpu
- Restore original config after pnpm install

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix version

* refactor: streamline package management and filtering logic in before… (#12370)

refactor: streamline package management and filtering logic in before-pack.js

- Consolidated architecture-specific package definitions into a single array for better maintainability.
- Simplified the logic for determining target platform and architecture.
- Enhanced the filtering process for excluding and including packages based on architecture and platform.
- Improved console logging for clarity during package installation.

This refactor aims to improve the readability and efficiency of the prebuild package handling process.

* refactor: update package filtering logic in before-pack.js to read from electron-builder.yml

- Modified the package filtering process to load configuration directly from electron-builder.yml, reducing potential errors from multiple overrides.
- Enhanced maintainability by centralizing the file configuration management.

This change aims to streamline the prebuild package handling and improve configuration clarity.

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: 亢奋猫 <kangfenmao@qq.com>
2026-01-08 17:07:41 +08:00
kangfenmao
0cb3bd8311 fix: add claude code sdk support for arm version windows
- Enhanced the logic to determine included Claude code vendors based on architecture and platform.
- Adjusted filters for excluding and including Claude code vendors to improve compatibility, particularly for Windows ARM64.
- Removed unnecessary variables and streamlined the filter application process.
2026-01-08 00:05:35 +08:00
George·Dong
2a31fa2ad5 refactor: switch yarn to pnpm (#12260)
* refactor: switch workflows from yarn to pnpm

Replace Yarn usage with pnpm in CI workflows to standardize package
management and leverage pnpm's store/cache behavior.

- Use pnpm/action-setup to install pnpm (v) instead of enabling corepack
  and preparing Yarn.
- Retrieve pnpm store path and update cache actions to cache the pnpm
  store and use pnpm-lock.yaml for cache keys and restores.
- Replace yarn commands with pnpm equivalents across workflows:
  install, i18n:sync/translate, format, build:* and tsx invocation.
- Avoid committing lockfile changes by resetting pnpm-lock.yaml instead
  of yarn.lock when checking for changes.
- Update install flags: use pnpm install --frozen-lockfile / --install
  semantics where appropriate.

These changes unify dependency tooling, improve caching correctness,
and ensure CI uses pnpm-specific lockfile and cache paths.

* build: switch pre-commit hook to pnpm lint-staged

Update .husky/pre-commit to run pnpm lint-staged instead of yarn.
This aligns the pre-commit hook with the project's package manager
and ensures lint-staged runs using pnpm's environment and caching.

* chore(ci): remove pinned pnpm version from GH Action steps

Remove the explicit `with: version: 9` lines from multiple GitHub Actions workflows
(auto-i18n.yml, nightly-build.yml, pr-ci.yml, update-app-upgrade-config.yml,
sync-to-gitcode.yml, release.yml). The workflows still call `pnpm/action-setup@v4`
but no longer hardcode a pnpm version.

This simplifies maintenance and allows the action to resolve an appropriate pnpm
version (or use its default) without needing updates whenever the pinned
version becomes outdated. It reduces churn when bumping pnpm across CI configs
and prevents accidental pin drift between workflow files.

* build: Update pnpm to 10.27.0 and add onlyBuiltDependencies config

* Update @cherrystudio/openai to 6.15.0 and consolidate overrides

* Add @langchain/core to overrides

* Add override for openai-compatible 1.0.27

* build: optimize pnpm config and add missing dependencies

- Comment out shamefully-hoist in .npmrc for better pnpm compatibility
- Add React-related packages to optimizeDeps in electron.vite.config.ts
- Add missing peer dependencies and packages that were previously hoisted

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* build: refine pnpm configuration and dependency management

- Simplify .npmrc to only essential electron mirror config
- Move platform-specific dependencies to devDependencies
- Pin sharp version to 0.34.3 for consistency
- Update sharp-libvips versions to 1.2.4

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* reduce app size

* format

* build: remove unnecessary disableOxcRecommendation option from react plugin configuration

* docs: Replace yarn commands with pnpm in documentation and scripts

* Revert "build: optimize pnpm config and add missing dependencies"

This reverts commit acffad31f8.

* build: import dependencies from yarn.lock

* build: Add some phantom dependencies and reorganize dependencies

* build: Keep consistent by removing types of semver

It's not in the previous package.json

* build: Add some phantom dependencies

Keep same version with yarn.lock

* build: Add form-data dependency version 4.0.4

* Add chalk dependency

* build: downgrade some dependencies

Reference: .yarn-state-copy.yml. These phantom dependencies should use top-level package of that version in node_modules

* build: Add phantom dependencies

* build: pin tiptap dependencies to exact versions

Ensure consistent dependency resolution by removing caret ranges and pinning all @tiptap packages to exact version 3.2.0

* chore: pin embedjs dependencies to exact versions

* build: pin @modelcontextprotocol/sdk to exact version 1.23.0

Remove caret from version specifier to prevent automatic upgrades and ensure consistent dependencies

* chore: update @types/node dependency to 22.17.2

Update package.json and pnpm-lock.yaml to use @types/node version 22.17.2 instead of 22.19.3 to maintain consistency across dependencies

* build: move some dependencies to dev deps and pin dependency versions to exact numbers

Remove caret (^) from version ranges to ensure consistent dependency resolution across environments

* chore: move dependencies from prod to dev and update lockfile

Move @ant-design/icons, chalk, form-data, and open from dependencies to devDependencies
Update pnpm-lock.yaml to reflect dependency changes

* build: update package dependencies

- Add new dependencies: md5, @libsql/win32-x64-msvc, @strongtz/win32-arm64-msvc, bonjour-service, emoji-picker-element-data, gray-matter, js-yaml
- Remove redundant dependencies from devDependencies

* build: add cors, katex and pako dependencies

add new dependencies to support cross-origin requests, mathematical notation rendering and data compression

* move some js deps to dev deps

* test: update snapshot tests for Spinner and InputEmbeddingDimension

* chore: exclude .zed directory from biome formatting

* Update @ai-sdk/openai-compatible patch hash

* chore: update @kangfenmao/keyv-storage to version 0.1.3 in package.json and pnpm-lock.yaml

---------

Co-authored-by: icarus <eurfelux@gmail.com>
Co-authored-by: beyondkmp <beyondkmp@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: kangfenmao <kangfenmao@qq.com>
2026-01-05 22:16:34 +08:00
Vaayne
422ba52093 ⬆️ chore: migrate from Claude Code SDK to Claude Agent SDK v0.1.1
- Replace @anthropic-ai/claude-code with @anthropic-ai/claude-agent-sdk@0.1.1
- Update all import statements across 4 files
- Migrate patch for Electron compatibility (fork vs spawn)
- Handle breaking changes: replace appendSystemPrompt with systemPrompt preset
- Add settingSources configuration for filesystem settings
- Update vendor path in build scripts
- Update package name mapping in CodeToolsService
2025-09-30 17:54:02 +08:00
Vaayne
d8c3f601df ♻️ refactor: correct include filter path for Claude code ripgrep 2025-09-29 16:18:12 +08:00
beyondkmp
b131f0c48c pack optimization 2025-09-18 15:25:16 +08:00
beyondkmp
5ce7261678 refactor: Improve linux build for system-ocr (#9775)
* refactor(ocr): streamline OCR service registration and improve image preprocessing

- Simplified the registration of the system OCR service by removing the conditional check for Linux.
- Updated SystemOcrService to directly import necessary modules, enhancing clarity.
- Refactored image preprocessing to use a static import of the 'sharp' library for better performance.

* add patch for system-ocr

* add patch

* add patch again

* add patch

* delete setting

* delete i18n

* lint error

* add isLinux

* Revert "delete i18n"

This reverts commit 173e65bbd0.

* Revert "delete setting"

This reverts commit de39c76f83.

* fix: add system check for error message

---------

Co-authored-by: icarus <eurfelux@gmail.com>
2025-09-02 12:59:14 +08:00
beyondkmp
86d8e10dcb refactor: fix asar integration (#9753)
* refactor: replace afterPack script with beforePack and remove after-pack.js file

- Updated electron-builder configuration to use beforePack instead of afterPack.
- Removed the after-pack.js script as its functionality is no longer needed.

* refactor: streamline filter logic for architecture-specific packages in before-pack script

- Consolidated platform-specific filter conditions for arm64 and x64 architectures.
- Improved readability and maintainability by using arrays to manage filters for different architectures.
- Ensured that the correct filters are applied based on the architecture during the packaging process.

* chore: remove npm build commands from CI workflows

- Eliminated unnecessary `yarn build:npm` commands from the nightly build and release workflows for Linux, macOS, and Windows.
- Streamlined the build process by focusing on platform-specific build commands.

* delete build npm

* refactor: enhance architecture-specific package management in before-pack script

- Updated the before-pack script to include additional architecture-specific packages for arm64 and x64.
- Improved the organization of package filters and streamlined the logic for handling different architectures during the packaging process.
- Ensured that the correct filters are applied based on the architecture, enhancing the build process for various platforms.

* docs: clarify comment on prebuild binaries in before-pack script

* format code

* chore: add afterPack script to electron-builder configuration

- Included afterPack script in electron-builder.yml to enhance the packaging process.
- This addition allows for post-packaging tasks to be executed, improving build automation.

* chore: update macOS entitlements to disable library validation

- Added the key `com.apple.security.cs.disable-library-validation` to the entitlements file to enhance security settings for macOS builds.

* chore: remove unused package for win32 arm64 architecture

- Deleted the `@strongtz/win32-arm64-msvc` package from `package.json` and `yarn.lock` as it is no longer needed.
- Updated the `before-pack.js` script to improve architecture-specific package management by refining filter logic and ensuring correct package downloads based on architecture.
- Enhanced the `downloadNpmPackage` function to use Node.js streams for downloading and extracting packages, improving efficiency and error handling.
2025-09-01 19:48:24 +08:00