Compare commits

..

1 Commits

Author SHA1 Message Date
ONLY-yours 6f1380b07c feat(creds): add secure credential input mode via human intervention
Allow users to save credentials securely without exposing values in AI
context. When AI calls saveCreds with `fields` but no `values`, a secure
form renders via the intervention system for direct user input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-30 17:04:40 +08:00
1750 changed files with 17405 additions and 136486 deletions
+298
View File
@@ -0,0 +1,298 @@
---
name: bot
description: 'Bot platform architecture (Discord, Slack, Telegram, Feishu/Lark, QQ, WeChat). Use when working on inbound webhooks, Chat SDK message routing, agent execution from chat platforms, queue-mode callbacks, gateway lifecycle (websocket/polling), bot provider CRUD/credentials, or platform-specific clients/adapters/schemas. Triggers on bot, channel, webhook, mention, Chat SDK, agent bot provider, gateway, bot-callback, qstash bot.'
---
# Bot System
> **Last updated: 2026-04-08.** Implementation evolves quickly — this doc is a map, not the source of truth. Always read the key files below to verify behavior, especially per-platform quirks. Update this doc when the architecture changes.
LobeChat agents can answer inside external chat platforms. Inbound messages flow through the Chat SDK (`chat` npm package), get routed to the right agent by `(platform, applicationId)`, executed via `AiAgentService`, and replied back through a per-platform `PlatformClient`. There are **two execution modes** (in-memory vs queue/QStash) and **three connection modes** (`webhook`, `websocket`, `polling`).
## Supported Platforms
| Platform | id | Default mode | Markdown | Edit | Notes |
| -------- | ---------- | ------------------------------- | ----------------- | ------ | -------------------------------------------------------------------------------------- |
| Discord | `discord` | `websocket` | yes | yes | Persistent gateway via Chat SDK adapter; reaction-thread quirks; native slash commands |
| Slack | `slack` | `websocket` (Socket Mode) | yes (mrkdwn) | yes | Multi-mode — user can pick `webhook` per provider |
| Telegram | `telegram` | `webhook` | yes (HTML) | yes | `setMyCommands` menu via `registerBotCommands` |
| Feishu | `feishu` | `websocket` (Lark SDK WSClient) | **no** (stripped) | yes | Multi-mode; shared client with Lark |
| Lark | `lark` | `websocket` | **no** | yes | Same client/schema as Feishu, different domain |
| QQ | `qq` | `websocket` | **no** | **no** | All replies are final-only |
| WeChat | `wechat` | `polling` (iLink long-poll) | **no** | **no** | 10-minute gateway window |
`supportsMarkdown=false` ⇒ outbound markdown is stripped to plain text via `stripMarkdown` and the AI is told not to use markdown. `supportsMessageEdit=false` ⇒ no progress edits — only the final reply is sent.
**Multi-mode connection** — Slack/Feishu/Lark/QQ ship as websocket but support `webhook` per-provider via `settings.connectionMode`. The runtime always merges schema defaults into stored settings before resolving the mode (`resolveBotProviderConfig` / `resolveConnectionMode` in `platforms/utils.ts`), so the schema's `field.default` is the source of truth — set it correctly when adding a new multi-mode platform.
## Inbound Flow (one webhook → reply)
```
Platform server
│ POST /api/agent/webhooks/[platform]/[appId]
route.ts ── catch-all `[[...appId]]` route
BotMessageRouter (singleton)
│ • lazy-loads bot per `platform:applicationId`
│ • merges schema defaults + provider.settings (mergeWithDefaults)
│ • builds Chat SDK Chat<any> with createIoRedisState (if Redis available)
│ • registerHandlers: onNewMention / onSubscribedMessage / onNewMessage(/.dm)
│ • registerCommands: /new (reset topic), /stop (interrupt)
chatBot.webhooks[platform](req) ← Chat SDK parses → fires events
AgentBridgeService.handleMention / handleSubscribedMessage
│ • activeThreads guard (no duplicate runs per thread)
│ • adds 👀 reaction (eyes), startTyping
│ • merges debounced/queued skipped messages (mergeSkippedMessages)
│ • extractFiles (buffer → fetchData → url)
│ • formatPrompt (sanitize mention + speaker tag + referenced_message)
├── In-memory mode ──► AiAgentService.execAgent({ stepCallbacks })
│ → onAfterStep edits progress message live
│ → onComplete edits final reply, splits via splitMessage(charLimit)
└── Queue mode (isQueueAgentRuntimeEnabled) ──► execAgent({ stepWebhook, completionWebhook, webhookDelivery: 'qstash' })
→ returns immediately, callbacks land at /api/agent/webhooks/bot-callback
```
The router caches loaded bots in memory. Cache is **invalidated** by `BotMessageRouter.invalidateBot(platform, appId)` whenever the TRPC `update`/`delete` mutations run, so new credentials/settings take effect on the next webhook.
## Execution Modes
### In-memory (default)
`AgentBridgeService.executeWithInMemoryCallbacks` wraps `execAgent` with `stepCallbacks`. Lives in one process — Promise-based wait, 30-min timeout, edits the same `progressMessage` after every step. Topic title is summarized inline via `SystemAgentService`.
### Queue (`isQueueAgentRuntimeEnabled`)
`AgentBridgeService.executeWithWebhooks`:
1. Posts the `renderStart` placeholder, captures `progressMessageId`.
2. Calls `execAgent` with `stepWebhook` and `completionWebhook` pointing at `${INTERNAL_APP_URL ?? APP_URL}/api/agent/webhooks/bot-callback`, plus `webhookDelivery: 'qstash'`.
3. Returns immediately; the bridge `finally` block keeps the active-thread marker held until the `completion` callback fires.
`/api/agent/webhooks/bot-callback/route.ts` verifies the QStash signature and hands off to `BotCallbackService.handleCallback`:
- `type: 'step'``handleStep` re-renders `renderStepProgress`, edits `progressMessageId` (skipped if `displayToolCalls=false` or platform `supportsMessageEdit=false`).
- `type: 'completion'``handleCompletion` writes the final reply (or error/interrupted message), removes the 👀 reaction, clears active-thread tracker, fires async `summarizeTopicTitle`.
`BotCallbackService.createMessenger` reloads provider + credentials from DB and rebuilds a `PlatformClient` per call (no in-memory state).
## Commands
Defined in `BotMessageRouter.buildCommands` and registered via two paths:
- **Native slash commands** (Slack/Discord): `bot.onSlashCommand('/<name>', ...)`
- **Text-based fallback** (Telegram/Feishu/QQ/Lark/WeChat): `bot.onNewMessage(/^\/(new|stop)(\s|$|@)/, ...)` plus a per-mention `tryDispatch` so commands work even before subscribe.
Built-in commands:
- `/new` — clears `topicId` in thread state, next message starts a fresh topic.
- `/stop` — interrupts the active execution (calls `AiAgentService.interruptTask` if `operationId` is known; otherwise queues a deferred stop via `requestStop`/`pendingStopThreads`, also aborts the startup phase via `startupControllers`).
To add a command, append to `buildCommands` — it auto-registers everywhere; on Telegram it also surfaces in the `/` menu via `client.registerBotCommands``setMyCommands`.
## Active-thread State (statics on `AgentBridgeService`)
- `activeThreads: Set<threadId>` — prevents duplicate runs per thread (must guard before stale-topic check, otherwise concurrent messages can drop).
- `activeOperations: Map<threadId, operationId>` — needed by `/stop` once `execAgent` returns.
- `startupControllers: Map<threadId, AbortController>` — cancels pre-`operationId` work (topic/tool prep).
- `pendingStopThreads: Set<threadId>``/stop` arrived before `operationId` existed; consumed once available.
In **queue mode**, the bridge `finally` skips cleanup so the marker persists until `BotCallbackService.handleCompletion` calls `clearActiveThread`.
## Topic Lifecycle in Threads
- `handleMention` always treats the message as the start of a new conversation.
- `handleSubscribedMessage` reads `topicId` from `thread.state`. If the topic is stale (`> 4 hours` since `updatedAt`), state is cleared and it retries as a fresh mention.
- If `execAgent` fails with a Postgres FK violation on `topic_id` (cached topic was deleted), the bridge clears state and retries as a mention.
- `subscribe()` is gated by `client.shouldSubscribe(threadId)` — Discord top-level channels return `false` so we don't follow up there.
## Attachments
`AgentBridgeService.extractFiles` resolves attachments in priority order:
1. `att.buffer` — already downloaded by the adapter (WeChat/Feishu inbound).
2. `att.fetchData()` — adapter-provided lazy download with auth (Telegram, Slack, Feishu history). **Required** when URLs are token-protected — naive `fetch(url)` later in `ingestAttachment.ts` has no credentials.
3. `att.url` — public CDN fallback (Discord, public QQ).
`inferMimeType` / `inferName` patch Telegram-style `photo` payloads (no `mimeType`/`name` from Bot API → defaults to `image/jpeg`) so vision models actually see them. Quoted-message attachments are also pulled from `raw.referenced_message.attachments` (Discord).
## Concurrency
`settings.concurrency` is `'queue'` or `'debounce'`:
- `debounce` → Chat SDK debounces inbound messages by `debounceMs`; `mergeSkippedMessages` joins skipped texts/attachments into the current message before handing to the agent.
- `queue` → Chat SDK serializes per-thread; the bridge's own `activeThreads` set is still required because in queue mode the SDK lock releases before the agent finishes.
## Gateway (persistent platforms)
Webhook platforms run fine in serverless functions. Persistent platforms (`websocket`, `polling`) need a long-running listener — that's the **gateway**.
**`GatewayService.startClient(platform, appId, userId)`** (`src/server/services/gateway/index.ts`):
- On Vercel + persistent mode → `BotConnectQueue.push` (Redis hash) and mark runtime status `queued`. The cron picks it up.
- On Vercel + webhook mode → start the client inline (one HTTP call).
- Off-Vercel → `GatewayManager` singleton holds long-lived clients in process.
**`GET /api/agent/gateway/route.ts`** (cron, `Bearer ${CRON_SECRET}`):
- Iterates registered platforms and starts every enabled persistent provider with `durationMs = 10min`, then in `after(...)` polls `BotConnectQueue` every 30s for new connect requests, until the window expires.
- `getEffectiveConnectionMode(platform, settings)` is the only place that resolves per-provider mode — respect it everywhere.
**`POST /api/agent/gateway/start/route.ts`** is the non-Vercel `ensureRunning` entry point (`Bearer ${KEY_VAULTS_SECRET}`).
**Runtime status** is stored in Redis at `bot:runtime-status:platform:appId` with TTL ≈ `durationMs + 60s`. States: `starting | connected | disconnected | failed | queued`. Updated by each `PlatformClient.start/stop` and by the gateway service.
## Platform Definitions
Each platform exposes a `PlatformDefinition` registered in `platforms/index.ts`:
```ts
{
id: 'discord',
name: 'Discord',
connectionMode: 'websocket', // recommended default
schema: FieldSchema[], // applicationId + credentials + settings
clientFactory: new DiscordClientFactory(),
supportsMarkdown?: boolean, // default true
supportsMessageEdit?: boolean, // default true
documentation?: { portalUrl, setupGuideUrl },
}
```
`schema` drives both server validation (`mergeWithDefaults`, `extractDefaults`) **and** the auto-generated UI form. Top-level keys `applicationId` / `credentials` / `settings` map to DB columns. Common settings fields live in `platforms/const.ts` (`displayToolCallsField`, `makeServerIdField(platform?)`, `makeUserIdField(platform?)`). The `serverId` / `userId` factories take a platform identifier so the field's hint can render platform-specific "how to find this ID" guidance (Discord Developer Mode, Telegram @userinfobot, etc.); pass no argument to fall back to generic copy.
Each platform implements `PlatformClient` (see `platforms/types.ts`):
- Lifecycle: `start(opts?)`, `stop()`
- Inbound: `createAdapter()` → Chat SDK adapter map
- Outbound: `getMessenger(platformThreadId)``{ createMessage, editMessage, removeReaction, triggerTyping, updateThreadName? }`
- Formatting: `formatMarkdown?`, `formatReply?` (usage-stats footer when `showUsageStats`)
- Helpers: `extractChatId`, `parseMessageId`, `sanitizeUserInput`, `shouldSubscribe`, `resolveReactionThreadId`
- Optional patches: `applyChatPatches(chatBot)` (Discord uses this for `forwardedInteractions` + `threadRecovery`)
- Optional menu: `registerBotCommands(commands)` (Telegram `setMyCommands`)
`ClientFactory.validateCredentials` is called from the TRPC `testConnection` mutation — implement it to hit the platform API and return useful per-field errors.
## Database
**Schema** (`packages/database/src/schemas/agentBotProvider.ts`):
```ts
agent_bot_providers (
id uuid pk,
agent_id text fk agents.id (cascade),
user_id text fk users.id (cascade),
platform varchar(50), // 'discord' | 'slack' | …
application_id varchar(255),
credentials text, // KeyVaults-encrypted JSON
settings jsonb default '{}',
enabled boolean default true,
timestamps
)
unique (platform, application_id)
```
**Model** (`packages/database/src/models/agentBotProvider.ts`):
- User-scoped: `create / update / delete / query / findById / findByAgentId / findEnabledByApplicationId`. Credentials are encrypted/decrypted via the injected `KeyVaultsGateKeeper`.
- Static (system-wide): `findByPlatformAndAppId`, `findEnabledByPlatform` — used by webhook routing & gateway sync, since they don't have a user context yet.
**TRPC router** (`src/server/routers/lambda/agentBotProvider.ts`):
| Procedure | Notes | |
| -------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------ |
| `listPlatforms` | Returns `SerializedPlatformDefinition[]` (no `clientFactory`) | |
| `create` / `update` / `delete` | Calls `BotMessageRouter.invalidateBot` + `GatewayService.stopClient` so changes take effect | |
| `list` / `getByAgentId` / `getRuntimeStatus` | Decorate rows with Redis runtime status | |
| `connectBot` | Returns \`{ status: 'started' | 'queued' }\` |
| `testConnection` | Calls `clientFactory.validateCredentials` | |
| `wechatGetQrCode` / `wechatPollQrStatus` | iLink onboarding flow | |
Client service: `src/services/agentBotProvider.ts`. Store actions: `src/store/agent/slices/bot/action.ts`. UI: `src/routes/(main)/agent/channel/{list,detail}` — settings form is auto-generated from each platform's `schema`.
## Reply Templates
`src/server/services/bot/replyTemplate.ts` exports `renderStart`, `renderStepProgress`, `renderFinalReply`, `renderError`, `renderStopped`, `splitMessage`. Step progress carries elapsed time, last LLM content, last tools, totals; final reply uses `client.formatMarkdown` then `client.formatReply` (which optionally appends `formatUsageStats`). `splitMessage(text, charLimit)` chunks at paragraph → line → hard cut.
`src/server/services/bot/ackPhrases/` provides randomized ack phrases.
## Key Files
```plaintext
Webhook routes:
src/app/(backend)/api/agent/webhooks/[platform]/[[...appId]]/route.ts — inbound catch-all
src/app/(backend)/api/agent/webhooks/bot-callback/route.ts — qstash bot callback
src/app/(backend)/api/agent/gateway/route.ts — cron gateway (10min window)
src/app/(backend)/api/agent/gateway/start/route.ts — non-Vercel ensureRunning
Bot service:
src/server/services/bot/index.ts — barrel
src/server/services/bot/BotMessageRouter.ts — lazy bot loading + handler registration + commands
src/server/services/bot/AgentBridgeService.ts — Chat SDK ↔ AiAgentService bridge, both exec modes
src/server/services/bot/BotCallbackService.ts — qstash callback handler
src/server/services/bot/formatPrompt.ts — speaker tag + referenced_message + sanitize
src/server/services/bot/replyTemplate.ts — render*/splitMessage
src/server/services/bot/ackPhrases/ — randomized acks
src/server/services/bot/__tests__/ — unit tests for the above
Platform abstraction:
src/server/services/bot/platforms/index.ts — registry singleton + exports
src/server/services/bot/platforms/types.ts — PlatformClient/Definition/FieldSchema/ClientFactory
src/server/services/bot/platforms/registry.ts — PlatformRegistry class
src/server/services/bot/platforms/utils.ts — mergeWithDefaults, getEffectiveConnectionMode, formatUsageStats, runtimeKey
src/server/services/bot/platforms/const.ts — shared FieldSchema fragments (displayToolCalls, serverId, userId)
src/server/services/bot/platforms/stripMarkdown.ts — used by no-markdown platforms
Per-platform (each ships definition.ts, schema.ts, client.ts, const.ts, protocol-spec.md):
src/server/services/bot/platforms/discord/ — websocket gateway + chat patches
src/server/services/bot/platforms/slack/ — multi-mode (Socket Mode / webhook), markdownToMrkdwn
src/server/services/bot/platforms/telegram/ — webhook, markdownToHTML, registerBotCommands
src/server/services/bot/platforms/feishu/ — feishu + lark share client/schema (definitions/{feishu,lark,shared}.ts)
src/server/services/bot/platforms/qq/ — websocket, no markdown, no edit
src/server/services/bot/platforms/wechat/ — long-poll, no markdown, no edit
Gateway:
src/server/services/gateway/index.ts — GatewayService (Vercel-aware startClient/stopClient)
src/server/services/gateway/GatewayManager.ts — long-running client registry (non-Vercel)
src/server/services/gateway/botConnectQueue.ts — Redis hash queue with TTL
src/server/services/gateway/runtimeStatus.ts — Redis bot:runtime-status keys
Database:
packages/database/src/schemas/agentBotProvider.ts — agent_bot_providers table
packages/database/src/models/agentBotProvider.ts — encrypted CRUD + system-wide finders
TRPC + client:
src/server/routers/lambda/agentBotProvider.ts — TRPC router
src/services/agentBotProvider.ts — client wrapper
src/store/agent/slices/bot/action.ts — Zustand actions
UI:
src/routes/(main)/agent/channel/list.tsx — channel list
src/routes/(main)/agent/channel/detail/ — auto-generated form (Header/Body/Footer)
src/routes/(main)/agent/channel/const.ts — platform icons
Types & runtime status:
src/types/botRuntimeStatus.ts — BOT_RUNTIME_STATUSES enum + snapshot type
```
## Adding a New Platform
1. Create `src/server/services/bot/platforms/<id>/`:
- `definition.ts``PlatformDefinition` registered in `platforms/index.ts`
- `schema.ts``FieldSchema[]` (`applicationId` + `credentials` + `settings`); reuse fragments from `../const.ts`
- `client.ts``class XClientFactory extends ClientFactory` returning a `PlatformClient` (lifecycle + adapter + messenger + helpers)
- `const.ts``DEFAULT_X_CONNECTION_MODE`, history limits, etc.
- `protocol-spec.md` — protocol notes (every existing platform has one)
2. Pick the right `connectionMode` — webhook is much simpler if the platform supports it.
3. If the platform can't render markdown, set `supportsMarkdown: false` and implement `formatMarkdown` via `stripMarkdown`.
4. If it can't edit messages, set `supportsMessageEdit: false``BotCallbackService` will skip step edits and only send the final reply.
5. Implement `validateCredentials` so the UI's "Test connection" button gives useful errors.
6. Add the platform icon in `src/routes/(main)/agent/channel/const.ts` and register the platform in `src/server/services/bot/platforms/index.ts`.
7. Add i18n keys under `channel.*` in `src/locales/default/setting.ts` (or wherever the channel namespace lives) — the schema's `label`/`description`/`placeholder`/`enumLabels` are i18n keys.
-130
View File
@@ -1,130 +0,0 @@
---
name: builtin-tool
description: Build a new builtin tool package under `packages/builtin-tool-<name>/`. Use when adding a new agent-callable toolset, designing its API surface (manifest / ApiName / Params / State), implementing the Executor + ExecutionRuntime, building the Inspector / Render / Placeholder / Streaming / Intervention / Portal UI, or wiring a tool into the central registries (`packages/builtin-tools/src/{index,identifiers,inspectors,renders,placeholders,streamings,interventions,portals}.ts` and `src/store/tool/slices/builtin/executors/index.ts`). Triggers on "new builtin tool", "add a tool", "tool inspector", "tool render", "tool placeholder", "tool streaming", "tool intervention", "BuiltinToolManifest", "BaseExecutor", "ExecutionRuntime".
---
# Builtin Tool Authoring Guide
A builtin tool is a package the agent runtime can call. It ships **five faces**:
| Face | Lives in | Audience |
| -------------------- | -------------------------------------------------------------------------------------- | ------------------------------------- |
| **Manifest + types** | `src/{manifest,types,systemRole}.ts` | The LLM (tool spec + system prompt) |
| **ExecutionRuntime** | `src/ExecutionRuntime/` | Server / desktop / any runtime caller |
| **Executor** | `src/client/executor/` | Frontend (wraps stores/services) |
| **Client UI** | `src/client/{Inspector,Render,…}/` | Chat UI |
| **Registry wiring** | `packages/builtin-tools/src/*.ts` + `src/store/tool/slices/builtin/executors/index.ts` | Framework |
---
## Read These First
| Question | Doc |
| ------------------------------------------------------------------------------------ | ---------------------------------- |
| Where do files live? What does each face do? Wiring? | [architecture.md](architecture.md) |
| How do I name the tool, design APIs, write the manifest, executor, ExecutionRuntime? | [tool-design.md](tool-design.md) |
| How do I build Inspector / Render / Placeholder / Streaming / Intervention / Portal? | [ui.md](ui.md) |
---
## When to Use This Skill
- Creating a new `packages/builtin-tool-<name>/` package
- Adding a new API method to an existing builtin tool
- Building or restyling any of the 6 client surfaces for a tool
- Wiring a tool into the central registries
- Debugging "tool not found / API not found / render not showing / placeholder stuck" errors
---
## Top-Level Design Principles
1. **`lobe-<domain>` identifier is permanent.** It's stored in message history. Renames need `@deprecated` aliases (see `packages/builtin-tools/src/inspectors.ts:88-89`). Get it right the first time.
2. **ApiName is an `as const` object**, not a TS enum. It doubles as the runtime list `BaseExecutor` iterates over.
3. **Three result fields, three audiences:**
- `content: string` → the LLM reads it
- `state: Record<…>` → the UI's `pluginState`; **result-domain only**, never echo all params back
- `error: { type, message, body? }` → both LLM and UI; `type` is a stable code
4. **Split execution from frontend wiring.**
- `src/ExecutionRuntime/` — pure runtime, no React, no Zustand, accepts services via constructor. **The default place for new logic.**
- `src/client/executor/``BaseExecutor` subclass that calls `ExecutionRuntime` (or stores/services directly when frontend-only).
5. **UI defaults to "do nothing".** Inspector is required (the header strip). Render/Placeholder/Streaming/Intervention/Portal are added **only when there's something specific to show** — empty registries are fine.
6. **Style with `createStaticStyles + cssVar.*`** (zero-runtime). Fall back to `createStyles + token` only when you genuinely need runtime values. Use `@lobehub/ui` components, not raw antd.
7. **i18n keys live in `src/locales/default/plugin.ts`.** Inspector titles must come from `t('builtins.<identifier>.apiName.<api>')` so something renders while args stream.
---
## Package Layout (preferred, post-2026 convention)
```
packages/builtin-tool-<name>/
├── package.json
└── src/
├── index.ts # exports manifest + types + systemRole + Identifier (no React, no stores)
├── manifest.ts # BuiltinToolManifest with JSON Schema for every API
├── types.ts # ApiName const + Params/State interfaces per API
├── systemRole.ts # System prompt teaching the model when/how to use the APIs
├── ExecutionRuntime/ # ✅ Default home for runtime logic (server- or anywhere-callable)
│ └── index.ts
└── client/
├── index.ts # Re-exports for the registries
├── executor/ # ✅ Frontend executor — extends BaseExecutor, often delegates to ExecutionRuntime
│ └── index.ts
├── Inspector/ # required — header chip per API
├── Render/ # optional — rich result card
├── Placeholder/ # optional — skeleton during streaming/execution
├── Streaming/ # optional — live output renderer (e.g. RunCommand, WriteFile)
├── Intervention/ # optional — approval / edit-before-run UI
├── Portal/ # optional — full-screen detail view
└── components/ # shared subcomponents used by the surfaces above
```
**Older packages** (`builtin-tool-task`, `builtin-tool-calculator`, etc.) still have `src/executor/` as a sibling of `src/client/`. That's grandfathered; **don't relocate without a deliberate refactor**. New packages and new APIs added to existing packages should follow the layout above.
`package.json` exports map:
```json
"exports": {
".": "./src/index.ts",
"./client": "./src/client/index.ts",
"./executor": "./src/client/executor/index.ts",
"./executionRuntime": "./src/ExecutionRuntime/index.ts"
}
```
---
## Authoring Checklist
Before opening the PR:
- [ ] Identifier follows `lobe-<domain>` and is **stable** (lives in message history).
- [ ] Every `<Name>ApiName` value has: a manifest `api[]` entry, an executor method, an Inspector, an i18n `apiName.*` key.
- [ ] `Params` interfaces match the JSON Schema; `State` interfaces match what the executor returns and what the UI surfaces read.
- [ ] System prompt disambiguates confusable APIs and points to batch variants.
- [ ] Runtime logic lives in `ExecutionRuntime/`; the `client/executor/` only wires stores/services and delegates.
- [ ] Executor returns `{ success, content, state, error? }` via a single `toResult()` funnel — `content` always non-empty (default to `error.message`).
- [ ] Inspector handles `isArgumentsStreaming`, `isLoading`, `partialArgs`, missing `pluginState`.
- [ ] Render returns `null` until it has data; only created for APIs with rich results.
- [ ] Placeholder added if the API has a perceivable execution lag (search, list, crawl).
- [ ] Streaming added for APIs that emit incremental output (run command, write file, code execution).
- [ ] Intervention added if `humanIntervention` is set in the manifest.
- [ ] All registry files updated (see [architecture.md → Registry wiring](architecture.md#registry-wiring)).
- [ ] i18n keys in `src/locales/default/plugin.ts` plus dev seeds in `en-US`/`zh-CN`.
- [ ] `bunx vitest run --silent='passed-only' 'packages/builtin-tool-<name>'` passes.
- [ ] `bun run type-check` passes.
---
## Reference Tools
Pick the closest neighbor and copy:
| If your tool is… | Read first |
| ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| Pure-compute, no UI state | `packages/builtin-tool-calculator/``ExecutionRuntime` reuses executor (mathjs/nerdamer work everywhere) |
| CRUD over a domain entity | `packages/builtin-tool-task/` — full Inspector + Render set, batch variants |
| Heavy UI (Inspector/Render/Placeholder/Portal) | `packages/builtin-tool-web-browsing/` — search-style result UI, Portal for detail view |
| Desktop / filesystem with all surfaces (incl. Streaming + Intervention) | `packages/builtin-tool-local-system/``ExecutionRuntime` injects an `ILocalSystemService`, executor calls it |
| Server-side pure (no client executor) | `packages/builtin-tool-web-browsing/` — only `ExecutionRuntime` is exported; the chat client doesn't run it |
| Needs human approval before running | `packages/builtin-tool-local-system/src/client/Intervention/` — per-API approval components |
-315
View File
@@ -1,315 +0,0 @@
# Builtin Tool Architecture
## The Five Faces
A builtin tool ships five distinct faces, each compiled into a different bundle:
```
┌─────────────────────────────────────────────────────────────────┐
│ ./ │
│ Manifest + Types + systemRole │
│ ─ Pure data, no React, no Node-only deps. │
│ ─ Imported by: server (LLM tool spec), client (registries), │
│ anyone who needs to know "what tools exist". │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ ./executionRuntime │
│ src/ExecutionRuntime/index.ts │
│ ─ Pure runtime logic. Accepts services via constructor — │
│ never imports concrete services or stores directly. │
│ ─ Imported by: server (BuiltinServerRuntimeOutput), tests, │
│ and the client executor as a delegate. │
│ ─ Returns: BuiltinServerRuntimeOutput { content, state, … } │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ ./executor │
│ src/client/executor/index.ts │
│ ─ BaseExecutor subclass. Wires Zustand stores and frontend │
│ services into ExecutionRuntime, then funnels through │
│ toResult() into BuiltinToolResult { content, state, error, │
│ success }. │
│ ─ Imported by: src/store/tool/slices/builtin/executors/ │
│ index.ts (registered as a singleton). │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ ./client │
│ src/client/{Inspector,Render,Placeholder,Streaming, │
│ Intervention,Portal,components}/ │
│ ─ React 'use client' surfaces. Read args + pluginState. │
│ ─ Imported by: packages/builtin-tools/src/{inspectors, │
│ renders,placeholders,streamings,interventions,portals}.ts. │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ Registry wiring │
│ packages/builtin-tools/src/*.ts │
│ src/store/tool/slices/builtin/executors/index.ts │
│ ─ Aggregator maps: identifier → { apiName → component }. │
└─────────────────────────────────────────────────────────────────┘
```
The split exists so:
- Server bundles import only `./` and `./executionRuntime` and never touch React.
- Frontend bundles import `./client` and never touch Node-only services.
- The runtime is testable without React or Electron present.
---
## Why ExecutionRuntime is the Default Home for Logic
**Old pattern (grandfathered):** business logic in `src/executor/` directly. Examples: `builtin-tool-task`, older tools. Works, but the executor mixes runtime logic with frontend service plumbing — hard to reuse on the server.
**New pattern (preferred):** business logic in `src/ExecutionRuntime/`, frontend wiring in `src/client/executor/`. Examples: `builtin-tool-local-system`, `builtin-tool-web-browsing`, `builtin-tool-calculator`.
```
ExecutionRuntime
├─ accepts services via constructor (or `static create(opts)`)
├─ returns BuiltinServerRuntimeOutput (content + state + success)
└─ no React, no Zustand, no `@/services/...` direct imports
client/executor
├─ extends BaseExecutor<typeof <Name>ApiName>
├─ holds a `runtime = new <Name>ExecutionRuntime(realService)` instance
├─ each ApiName method:
│ 1. resolve scope / pull defaults from BuiltinToolContext
│ 2. call runtime.<method>(args)
│ 3. funnel through toResult() → BuiltinToolResult
└─ exported singleton: export const <name>Executor = new <Name>Executor()
```
### Service injection
`ExecutionRuntime` should declare a TypeScript interface for the services it needs and accept the implementation via constructor. Server callers wire in real implementations; tests wire in mocks. Example from `local-system`:
```ts
export interface ILocalSystemService {
readLocalFile: (params: any) => Promise<any>;
writeFile: (params: any) => Promise<any>;
/* … */
}
export class LocalSystemExecutionRuntime extends ComputerRuntime {
constructor(private service: ILocalSystemService) {
super();
}
/* methods delegate to this.service.* */
}
```
The `client/executor` instantiates it once with the real service:
```ts
import { localFileService } from '@/services/electron/localFileService';
import { LocalSystemExecutionRuntime } from '../../ExecutionRuntime';
class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
private runtime = new LocalSystemExecutionRuntime(localFileService);
/* … */
}
```
### When ExecutionRuntime is the only thing you ship
Some tools are server-only — there's no frontend executor. `builtin-tool-web-browsing` is the canonical example: only `./` and `./executionRuntime` are exported, no `./executor`, and the runtime is constructed by the server-side `ToolExecutionService`. Skip `client/executor/` entirely for those.
### When the executor reuses the runtime as-is
Pure-compute tools (`builtin-tool-calculator`) often have an executor whose ApiName methods call `executor.calculate(args)` and an `ExecutionRuntime` whose methods call `calculatorExecutor.calculate(args)` — same logic, two thin wrappers. That's fine; the duplication buys you the bundle split.
---
## The Result Contract
### `BuiltinServerRuntimeOutput` (what ExecutionRuntime returns)
```ts
{
content: string; // the LLM-facing text — never undefined; default to error message
state?: any; // result-domain object the UI reads as pluginState
success: boolean; // mandatory
error?: any; // raw error; the executor will repackage
}
```
### `BuiltinToolResult` (what the executor returns to the runtime)
```ts
{
success: boolean;
content?: string;
state?: any;
error?: { type: string; message: string; body?: any };
metadata?: Record<string, any>; // rare; e.g. { agentCouncil: true }
stop?: boolean; // rare; halt the orchestration step
}
```
### The `toResult` funnel (mandatory)
Every executor method returns through a single `toResult()` to enforce two invariants:
1. **`content` is never undefined.** A missing content collapses downstream into `''`, leaving the Debug pane blank while `pluginState` was already saved. See the `globLocalFiles` regression in `local-system/src/client/executor/index.ts:60-84`.
2. **`state` survives failures.** Renderers can keep showing partial output even when `success: false`.
```ts
private toResult(output: BuiltinServerRuntimeOutput): BuiltinToolResult {
const errorMessage = typeof output.error?.message === 'string' ? output.error.message : undefined;
const safeContent = output.content || errorMessage || 'Tool execution failed';
if (!output.success) {
return {
success: false,
content: safeContent,
state: output.state,
error: output.error
? { type: 'PluginServerError', message: errorMessage ?? safeContent, body: output.error }
: undefined,
};
}
return { success: true, content: safeContent, state: output.state };
}
```
---
## `BaseExecutor` — How Method Dispatch Works
`BaseExecutor.invoke(apiName, params, ctx)` does:
```ts
if (!this.hasApi(apiName)) return { error: { type: 'ApiNotFound', }, success: false };
return (this as any)[apiName](params, ctx); // method name MUST equal apiName value
```
So:
- **Method names must equal `<Name>ApiName` values, exactly.** A typo silently routes to "ApiNotFound".
- **Methods must be class fields, not class methods**, because `this` is lost when registry calls `executor.invoke(apiName, params, ctx)`. Always declare as `methodName = async (…) => { … }`.
- **Always destructure `apiEnum` and `identifier` as `readonly` instance fields**, not getters — `BaseExecutor.hasApi/getApiNames` reads them synchronously.
---
## `BuiltinToolContext` — What the Executor Receives
The runtime hands every executor method an optional `BuiltinToolContext` as the second argument:
| Field | Use |
| ----------------------------- | -------------------------------------------------------------- |
| `agentId` | Default agent for "current agent" semantics (e.g. `listTasks`) |
| `groupId` | Group chat scope |
| `topicId` | Current topic — needed when creating messages/operations |
| `taskId` | Current task identifier — fallback for "implicit" param |
| `documentId` | Current page/document scope |
| `messageId` | The tool message being created (for state attachments) |
| `sourceMessageId` | The user message that triggered this tool turn |
| `operationId` | Operation lineage (use for cancellation, tracing) |
| `scope` | `'task' \| 'agent' \| …` — toggles default behaviors |
| `signal: AbortSignal` | Honor for long-running ops |
| `stepContext` | Cross-message runtime state (GTD todos, etc.) |
| `registerAfterCompletion(cb)` | Defer side-effects past message-update race |
| `groupOrchestration` | Group orchestration callbacks |
**Use rule:** read with `?.`, fall back to explicit params, **never silently override** an explicit param with a context value.
---
## i18n Integration
Source of truth: `src/locales/default/plugin.ts`. Keys follow `builtins.<identifier>.<topic>.<…>`:
| Key | Use |
| ------------------------------------- | ------------------------------------------------------------ |
| `builtins.<identifier>.title` | Display title (overrides `manifest.meta.title` when present) |
| `builtins.<identifier>.apiName.<api>` | Inspector header label (one per ApiName) |
| `builtins.<identifier>.inspector.<…>` | Extra Inspector strings ("no results", chips, counters) |
| `builtins.<identifier>.<feature>.<…>` | Render / Intervention strings, free-form per tool |
For dev preview, also seed `locales/zh-CN/plugin.json` and `locales/en-US/plugin.json`. Run `pnpm i18n` before opening a PR — it's slow, so do it once at the end. (See the **i18n** skill for the full workflow.)
---
## Registry Wiring
Five core files plus optional ones. Miss any and you'll see "tool not found", a missing chip, a blank result card, a stuck spinner, or an approval dialog that never appears.
| File | Add what |
| -------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| **Required** | |
| `packages/builtin-tools/src/index.ts` | Import `<Name>Manifest`; push entry to `builtinTools`. Set `hidden`/`discoverable` flags. |
| `packages/builtin-tools/src/identifiers.ts` | Add `<Name>Manifest.identifier` to `builtinToolIdentifiers`. |
| `packages/builtin-tools/src/inspectors.ts` | Import `<Name>Inspectors, <Name>Manifest`; add to `BuiltinToolInspectors`. |
| `src/store/tool/slices/builtin/executors/index.ts` | Import `<name>Executor`; add to `registerExecutors([…])`. |
| **Conditional — add only if the surface exists** | |
| `packages/builtin-tools/src/renders.ts` | Add to `BuiltinToolsRenders` if any API has a Render. |
| `packages/builtin-tools/src/placeholders.ts` | Add to `BuiltinToolPlaceholders` if any API has a Placeholder. |
| `packages/builtin-tools/src/streamings.ts` | Add to `BuiltinToolStreamings` if any API has a Streaming renderer. |
| `packages/builtin-tools/src/interventions.ts` | Add to `BuiltinToolInterventions` if any API has an Intervention component. |
| `packages/builtin-tools/src/portals.ts` | Add to `BuiltinToolsPortals` if the tool has a Portal. |
| `packages/builtin-tools/src/displayControls.ts` | Add if Render must show/hide based on result content (rare; see ClaudeCode/Codex). |
### Optional flags in `packages/builtin-tools/src/index.ts`
```ts
{
identifier: TaskManifest.identifier,
manifest: TaskManifest,
type: 'builtin',
hidden: true, // hide from chat-input Tools popover
discoverable: false, // exclude from agent builder / skill discovery
}
```
Lists in the same file you may need to touch:
- `defaultToolIds` — added to the agent's tool list by default
- `alwaysOnToolIds` — forced on regardless of user selection (use sparingly)
- `runtimeManagedToolIds` — enable state controlled by runtime, not user UI; **must mirror the rules map** in `src/server/modules/Mecha/AgentToolsEngine/index.ts` and `src/helpers/toolEngineering/index.ts`
---
## File-Map at a Glance
```
packages/builtin-tool-<name>/
├── package.json # exports: ., ./client, ./executor, ./executionRuntime
└── src/
├── index.ts # export Manifest, Identifier, types, systemPrompt
├── manifest.ts # BuiltinToolManifest + Identifier const
├── types.ts # ApiName + Params/State per API
├── systemRole.ts # System prompt (multiple variants OK: systemRole.desktop.ts)
├── ExecutionRuntime/
│ └── index.ts # <Name>ExecutionRuntime — pure runtime, service injection
└── client/
├── index.ts # exports for the registries
├── executor/
│ └── index.ts # <Name>Executor extends BaseExecutor; export <name>Executor
├── Inspector/
│ ├── index.ts # <Name>Inspectors record
│ └── <ApiName>/index.tsx # one folder per API (or .tsx file when trivial)
├── Render/
│ ├── index.ts # <Name>Renders record
│ └── <ApiName>/ # rich renders → folder with subcomponents
├── Placeholder/
│ ├── index.ts
│ └── <ApiName>.tsx # usually a single skeleton file
├── Streaming/
│ ├── index.ts
│ └── <ApiName>/ # live-output renderer
├── Intervention/
│ ├── index.ts
│ └── <ApiName>/ # approval / edit-before-run UI
├── Portal/
│ ├── index.tsx # routing component (switch on apiName)
│ └── <ApiName>/ # full-screen detail view
└── components/ # FileItem, EngineAvatar, etc. — shared subcomponents
```
Skip every `client/<surface>/` directory you don't need — empty registries are fine.
-478
View File
@@ -1,478 +0,0 @@
# Tool Design (Naming, Manifest, Executor, Runtime)
This doc covers everything that **isn't UI**: the tool's identifier, API surface, manifest, types, system prompt, ExecutionRuntime, and the executor that wires it into the frontend.
For UI surfaces (Inspector / Render / Placeholder / Streaming / Intervention / Portal), see [ui.md](ui.md).
For where files live and how registries work, see [architecture.md](architecture.md).
---
## 1. Naming
| Thing | Convention | Example |
| ----------------------- | -------------------------------------------------------------- | ------------------------------------------------------------ |
| Package directory | `packages/builtin-tool-<kebab>/` | `builtin-tool-task` |
| npm name | `@lobechat/builtin-tool-<kebab>` | `@lobechat/builtin-tool-task` |
| Tool `identifier` | `lobe-<kebab-domain>`**persisted in message history** | `lobe-task`, `lobe-calculator`, `lobe-knowledge-base` |
| Identifier const | `<Name>Identifier` exported from `manifest.ts` (or `types.ts`) | `export const TaskIdentifier = 'lobe-task'` |
| API name const | `<Name>ApiName``as const` object, **camelCase verbs** | `createTask`, `listTasks`, `runTask` |
| Executor class | `<Name>Executor extends BaseExecutor<typeof <Name>ApiName>` | `TaskExecutor` |
| Executor singleton | `<name>Executor` (camelCase) | `export const taskExecutor = new TaskExecutor()` |
| ExecutionRuntime class | `<Name>ExecutionRuntime` | `LocalSystemExecutionRuntime`, `WebBrowsingExecutionRuntime` |
| Inspector / Render etc. | `<ApiName>Inspector` / `<ApiName>Render` | `CreateTaskInspector`, `SearchInspector` |
### Identifier rules
- **`lobe-` prefix is mandatory** — many switches in the codebase key off it.
- Pick a **domain noun**, not a verb (`lobe-task`, not `lobe-task-manager`).
- The identifier is **persisted in message history** — renaming after release means the `@deprecated` alias trick (register the legacy identifier as a second key in `inspectors.ts` / `renders.ts` pointing at the new module). Get it right the first time.
### ApiName rules
- Verb + noun, camelCase: `createTask`, `viewTask`, `runTasks`.
- **Plural variant for batch** (`createTasks`, `runTasks`) — describe in the manifest description that it's preferred over multiple single calls. The system prompt should also push the batch form.
- Reserve **clear separation between mutating verbs** (`updateTaskStatus`, `editTask`) and **execution verbs** (`runTask`). The system prompt must warn the model when these are confusable — see `task` for the canonical "do NOT use updateTaskStatus(running) to start a task" warning.
- Read-only verbs: `list*`, `view*`, `get*`, `search*`. Mutating: `create*`, `edit*`, `update*`, `delete*`. Triggers/effects: `run*`, `execute*`, `submit*`.
---
## 2. `types.ts` — ApiName + Params/State
Define `<Name>ApiName` as `as const` so it doubles as a runtime enum (used by `BaseExecutor`) and a literal type. Then declare `Params` and `State` per API.
```ts
export const TaskIdentifier = 'lobe-task';
export const TaskApiName = {
createTask: 'createTask',
createTasks: 'createTasks',
listTasks: 'listTasks',
/* …one entry per API, group logically (CRUD then run-style) */
} as const;
export type TaskApiNameType = (typeof TaskApiName)[keyof typeof TaskApiName];
// One block per API
export interface CreateTaskParams {
name: string;
instruction: string; /* … */
}
export interface CreateTaskState {
identifier?: string;
success: boolean;
}
export interface CreateTasksParams {
tasks: CreateTaskParams[];
}
export interface CreateTasksItemResult {
error?: string;
identifier?: string;
name: string;
success: boolean;
}
export interface CreateTasksState {
failed: number;
results: CreateTasksItemResult[];
succeeded: number;
}
```
**The result-domain rule for `State`** (memory: "pluginState is result-domain, not call-domain"):
- Include only fields the UI **renders after the call returns** — ids the LLM didn't have when calling, counts, summary numbers, server-assigned status.
- **Don't echo all params.** The Inspector/Render gets `args` for free.
- Keep batch results as `{ succeeded, failed, results }` so the Render can show a one-line summary plus a detail list.
---
## 3. `manifest.ts` — JSON Schema for the LLM
```ts
import type { BuiltinToolManifest } from '@lobechat/types';
import { systemPrompt } from './systemRole';
import { TaskApiName, TaskIdentifier } from './types';
export const TaskManifest: BuiltinToolManifest = {
identifier: TaskIdentifier,
type: 'builtin',
systemRole: systemPrompt,
meta: {
avatar: '📋',
title: 'Task Tools',
description: 'Create, list, edit, delete tasks with dependencies',
readme: 'Optional long description shown in tool detail pages',
},
api: [
{
name: TaskApiName.createTask,
description:
'Create a new task. Optionally attach as a subtask via parentIdentifier. ' +
'Prefer createTasks when planning a batch.',
parameters: {
type: 'object',
required: ['name', 'instruction'],
properties: {
name: { type: 'string', description: 'Short, descriptive name.' },
instruction: {
type: 'string',
description: 'Detailed instruction for what the task should accomplish.',
},
parentIdentifier: {
type: 'string',
description:
'Identifier of the parent task (e.g. "TASK-1"). If provided, the new task becomes a subtask.',
},
priority: {
type: 'number',
description: 'Priority level: 0=none, 1=urgent, 2=high, 3=normal, 4=low. Default is 0.',
},
},
},
},
/* …one entry per ApiName */
],
};
```
### Manifest writing checklist
- **Every API in `<Name>ApiName` has exactly one entry in `api[]`.** Easy to drift after a refactor.
- **`description` on each API is the model's only docs.** Make it long enough for the LLM to pick the right tool. Mention edge cases ("If you provide any filter, omitted filters are not applied implicitly"), defaults, and the relationship to sibling APIs ("To START a task, use runTask — updateTaskStatus only flips a flag").
- **`parameters` is JSON Schema** (`LobeChatPluginApi`). Use `enum`, `required`, `items`, `oneOf`, `additionalProperties: false` etc. — these survive into the LLM's tool spec.
- **Use `additionalProperties: false`** on parameter objects so the model can't sneak unknown fields past validation.
- **Number parameters with semantic values** (`priority: 0=none, 1=urgent, …`) should describe the mapping in the description. Don't rely on `enum` alone for numbers — the model often fills the wrong one.
- **`enum` arrays for known string sets** (statuses, categories, engines). Spread from a constants module (`enum: [...TASK_STATUSES]`) so the manifest stays in sync.
### Optional manifest fields
```ts
{
/* Where this tool can run.
'client' → Agent Gateway dispatches to the desktop client (filesystem, Electron only)
'server' → ToolExecutionService runs it on the server
omitted → server only */
executors: ['client', 'server'],
/* Default human intervention policy for all APIs that don't specify one.
Pair with an Intervention component (see ui.md). */
humanIntervention: 'never' | 'always' | { /* extended config */ },
}
```
Per-API `humanIntervention` and `renderDisplayControl` go inside each `api[]` entry.
---
## 4. `systemRole.ts` — Operator Instructions for the Model
This is appended to the agent system prompt whenever the tool is enabled. Treat it as a **how-to-use guide for the LLM**, not marketing copy.
```ts
export const systemPrompt = `You have access to Task management tools. Use them to:
- **createTask**: Create a new task. Use parentIdentifier to make it a subtask.
- **createTasks**: Prefer this over multiple createTask calls when planning a batch
(e.g. all subtasks under one parent, or all chapters of an outline).
- **runTask**: Actually START a task — kicks off the agent in a new (or continued)
topic. Do NOT use updateTaskStatus(running) to start a task; that only flips a
flag without executing. The task must have an assigneeAgentId.
- **updateTaskStatus**: Change a task's status (completed/cancelled/paused/failed).
If you mark a task as failed, include an error message explaining why.
- ...
When planning work:
1. Create tasks for each major piece (use parentIdentifier to organize as subtasks).
2. Use editTask with addDependencies to control execution order.
3. Use updateTaskStatus to mark the current task completed when done.`;
```
### Patterns that work well
- **Bulleted list, bold the API name, one line per API.** The model picks tools by skimming.
- **Disambiguate confusable APIs explicitly** (`runTask` vs `updateTaskStatus`).
- **Push toward batched APIs** ("Prefer this when…").
- **End with a numbered workflow** if the tool has a typical sequence.
- **For tools with multiple environments** (e.g. desktop vs cloud), keep variants in `systemRole.ts` and `systemRole.desktop.ts` and pick at the manifest level. See `builtin-tool-local-system`.
### Dynamic system prompts
If the prompt depends on runtime state (current date, available models), export a function and call it in the manifest:
```ts
// systemRole.ts
export const systemPrompt = (today: string) => `Today is ${today}. You have web search tools…`;
// manifest.ts
import dayjs from 'dayjs';
systemRole: systemPrompt(dayjs(new Date()).format('YYYY-MM-DD')),
```
---
## 5. `ExecutionRuntime/index.ts` — Pure Runtime
This is **the default home for new tool logic** going forward. The runtime is a class that:
- Has no React, no Zustand, no `@/services/...` direct imports.
- Receives services as **constructor injection** (or as method args).
- Returns `BuiltinServerRuntimeOutput` from each method.
- Is unit-testable by passing in mocks.
### Pattern A: Inject a service interface
Use when the runtime calls out to IPC, network, or DB.
```ts
// ExecutionRuntime/index.ts
import type { BuiltinServerRuntimeOutput } from '@lobechat/types';
export interface IWebBrowsingService {
search: (q: SearchQuery) => Promise<UniformSearchResponse>;
crawlPages: (urls: string[]) => Promise<CrawlResults>;
}
export interface WebBrowsingRuntimeOptions {
searchService: IWebBrowsingService;
documentService?: WebBrowsingDocumentService;
agentId?: string;
topicId?: string;
}
export class WebBrowsingExecutionRuntime {
constructor(private opts: WebBrowsingRuntimeOptions) {}
async search(
args: SearchQuery,
options?: { signal?: AbortSignal },
): Promise<BuiltinServerRuntimeOutput> {
try {
const data = await this.opts.searchService.search(args, options);
if (data.errorDetail) {
return {
success: false,
content: data.errorDetail,
error: { message: data.errorDetail },
state: data,
};
}
return {
success: true,
content: searchResultsPrompt(data.results.slice(0, 10)),
state: data,
};
} catch (e) {
return { success: false, content: (e as Error).message, error: e };
}
}
}
```
### Pattern B: Reuse the executor
Use when the same logic runs in browser and Node (e.g. mathjs, nerdamer). The runtime is a thin wrapper that imports the executor and re-types the state per API. See `builtin-tool-calculator/src/ExecutionRuntime/index.ts` for the canonical example.
### Pattern C: Extend a shared base
When you're implementing a domain that already has a base runtime (file ops via `ComputerRuntime`), extend and only override `callService` + result normalization. See `builtin-tool-local-system/src/ExecutionRuntime/index.ts`.
### Runtime contract
Every method returns:
```ts
{
content: string; // LLM-facing — never undefined; default to error message
state?: any; // result-domain — what the UI's pluginState becomes
success: boolean; // mandatory
error?: any; // raw error object; the executor will repackage
}
```
Use `@lobechat/prompts` formatters (`searchResultsPrompt`, `crawlResultsPrompt`, `formatTaskCreated`, etc.) to produce structured `content`. They emit XML/markdown that's already tuned for token efficiency.
---
## 6. `client/executor/index.ts` — Frontend Wiring
The executor's job is to **resolve frontend defaults** (current agent, current task, scope) and **call the runtime**. It then funnels through `toResult()` into the `BuiltinToolResult` shape.
```ts
import { BaseExecutor, type BuiltinToolContext, type BuiltinToolResult } from '@lobechat/types';
import debug from 'debug';
import { taskService } from '@/services/task';
import { getTaskStoreState } from '@/store/task';
import { TaskIdentifier } from '../../manifest';
import { TaskApiName, type CreateTaskParams } from '../../types';
const log = debug('lobe-task:executor');
class TaskExecutor extends BaseExecutor<typeof TaskApiName> {
readonly identifier = TaskIdentifier;
protected readonly apiEnum = TaskApiName;
// ⚠ class FIELD, not a method — preserves `this` when invoked via registry
createTask = async (
params: CreateTaskParams,
ctx?: BuiltinToolContext,
): Promise<BuiltinToolResult> => {
try {
log('createTask params=%o', params);
const task = await getTaskStoreState().createTask({
name: params.name,
instruction: params.instruction,
// Default assignee from context — never silently override an explicit value
assigneeAgentId:
params.assigneeAgentId ?? (ctx?.scope === 'task' ? undefined : ctx?.agentId),
parentTaskId: params.parentIdentifier?.trim() || undefined,
priority: params.priority,
});
if (!task) return this.errorResult('Failed to create task', 'CreateFailed');
return {
success: true,
content: formatTaskCreated({ identifier: task.identifier, name: task.name /* … */ }),
state: { identifier: task.identifier, success: true },
};
} catch (error) {
return this.errorResult(error, 'CreateTaskFailed');
}
};
private errorResult(err: unknown, type: string): BuiltinToolResult {
const message = err instanceof Error ? err.message : String(err) || 'Unknown error';
return { success: false, content: `Failed: ${message}`, error: { type, message } };
}
}
export const taskExecutor = new TaskExecutor();
```
### Hard rules
1. **Methods are class fields** (`name = async (…) => {…}`), not class methods. The registry calls `(executor as any)[apiName](params, ctx)`; arrow-function fields keep `this` bound.
2. **`identifier` and `apiEnum` are `readonly` instance fields**, not getters — `BaseExecutor.hasApi/getApiNames` reads them synchronously at registration time.
3. **Default missing params from `ctx`**, but never silently override explicit values. Use `params.foo ?? ctx?.foo`, not `ctx?.foo ?? params.foo`.
4. **One funnel for all returns.** Either always return through `toResult(runtime.x())` (when delegating) or through `errorResult(…)` for the catch arm. Never inline `{ success: false, content: '' }``content: ''` collapses the Debug pane to blank.
5. **`debug('lobe-<name>:executor')`.** Match the namespace to the identifier minus `lobe-` when convenient.
6. **Singleton export.** `export const <name>Executor = new <Name>Executor()` — the registry imports the instance, not the class.
### When the executor delegates to ExecutionRuntime
```ts
class LocalSystemExecutor extends BaseExecutor<typeof LocalSystemApiEnum> {
readonly identifier = LocalSystemIdentifier;
protected readonly apiEnum = LocalSystemApiEnum;
private runtime = new LocalSystemExecutionRuntime(localFileService);
readLocalFile = async (params: LocalReadFileParams): Promise<BuiltinToolResult> => {
try {
const result = await this.runtime.readFile({
path: params.path,
startLine: params.loc?.[0],
endLine: params.loc?.[1],
});
return this.toResult(result);
} catch (error) {
return this.errorResult(error);
}
};
private toResult(out: BuiltinServerRuntimeOutput): BuiltinToolResult {
const errMsg = typeof out.error?.message === 'string' ? out.error.message : undefined;
const safe = out.content || errMsg || 'Tool execution failed';
if (!out.success) {
return {
success: false,
content: safe,
state: out.state, // ← preserve partial state on failure
error: out.error
? { type: 'PluginServerError', message: errMsg ?? safe, body: out.error }
: undefined,
};
}
return { success: true, content: safe, state: out.state };
}
}
```
The `toResult` funnel is **mandatory**: it enforces never-undefined `content` and partial-state preservation. Both invariants caught real production bugs (`globLocalFiles` Response empty, `editLocalFile` partial state lost).
---
## 7. `index.ts` — Package Entry Point
Keep it pure data + the manifest. **No React, no stores, no Node-only imports.**
```ts
export { TaskIdentifier, TaskManifest } from './manifest';
export { systemPrompt } from './systemRole';
export {
TaskApiName,
type TaskApiNameType,
type CreateTaskParams,
type CreateTaskState,
/* …all Params/State types */
} from './types';
// Optional helpers used by both the runtime and the UI
export { TASK_STATUSES, UNFINISHED_TASK_STATUSES } from './constants';
```
This entry is what `packages/builtin-tools/src/index.ts` and `identifiers.ts` import — it must be importable from server bundles.
---
## 8. `package.json`
```json
{
"dependencies": {
"@lobechat/prompts": "workspace:*"
},
"devDependencies": {
"@lobechat/types": "workspace:*"
},
"exports": {
".": "./src/index.ts",
"./client": "./src/client/index.ts",
"./executor": "./src/client/executor/index.ts",
"./executionRuntime": "./src/ExecutionRuntime/index.ts"
},
"main": "./src/index.ts",
"name": "@lobechat/builtin-tool-<name>",
"peerDependencies": {
"@lobehub/ui": "^5",
"antd": "^6",
"antd-style": "*",
"lucide-react": "*",
"react": "*",
"react-i18next": "*"
},
"private": true,
"version": "1.0.0"
}
```
**Why peer not direct deps for client libs:** the `./` and `./executionRuntime` entry points must be importable from server code. Listing React etc. as peer deps prevents bundlers from following them when only the runtime is consumed.
**Skip `./executor`** if the package has no frontend executor (server-only tools like `builtin-tool-web-browsing`).
---
## 9. Common Pitfalls
| Symptom | Likely cause |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| "ApiNotFound" at runtime | Method name in executor doesn't match `ApiName` value (typo, wrong case) |
| Method works once, then "this is undefined" | Method declared as `async fn() {}` instead of `fn = async () => {}``this` lost when registry invokes |
| Debug "Response" pane blank but `pluginState` populated | Returning `content: ''` or letting `output.content` be undefined — use the `toResult` funnel |
| Partial result vanishes on failure | `toResult` discarded `state` when `success: false`; preserve it |
| Tool shows up but doesn't run on desktop | `executors` in manifest doesn't include `'client'` (or vice versa for server-only) |
| Same tool registered twice / legacy identifier ghost | Identifier collision; check `@deprecated` aliases in `inspectors.ts`/`renders.ts` |
| Manifest test fails after adding API | Forgot to add the corresponding i18n `apiName.<api>` key |
| TypeScript error on `BaseExecutor<typeof X>` | `X` declared with `enum` instead of `as const` object — must be the const-object form |
-721
View File
@@ -1,721 +0,0 @@
# Tool UI Surfaces
A builtin tool can ship up to **six client-side surfaces**, each with a different role in the chat UI. Only `Inspector` is required; the other five are added on demand and registered in their own central files.
| Surface | Required? | When the chat shows it | Registered in |
| ------------ | --------- | --------------------------------------------------------------------- | --------------------------------------------- |
| Inspector | ✅ Always | Header strip of every tool call (one-line chip) | `packages/builtin-tools/src/inspectors.ts` |
| Render | Optional | Rich result card below the header, after the call returns | `packages/builtin-tools/src/renders.ts` |
| Placeholder | Optional | Skeleton between "args streaming complete" and "result arrives" | `packages/builtin-tools/src/placeholders.ts` |
| Streaming | Optional | Live output during execution (e.g. command stdout) | `packages/builtin-tools/src/streamings.ts` |
| Intervention | Optional | Approval / edit-before-run dialog (when `humanIntervention` triggers) | `packages/builtin-tools/src/interventions.ts` |
| Portal | Optional | Full-screen detail view (right-side or modal) | `packages/builtin-tools/src/portals.ts` |
The two reference tools to read end-to-end:
- **`builtin-tool-web-browsing/src/client/`** — Inspector + Render + Placeholder + Portal (no Intervention/Streaming).
- **`builtin-tool-local-system/src/client/`** — all six surfaces, including `components/` for shared building blocks.
---
## 0. Shared Style Rules
These apply across every surface.
### 0.1 Use `'use client'` at the top of every component file
Tool surfaces are leaves in the chat tree and must not block server rendering.
### 0.2 Prefer `createStaticStyles + cssVar.*`
Zero-runtime CSS-in-JS — the styles compile once and read CSS variables at runtime.
```tsx
import { createStaticStyles, cssVar } from 'antd-style';
const styles = createStaticStyles(({ css, cssVar }) => ({
chip: css`
padding-block: 2px;
padding-inline: 8px;
border-radius: 999px;
color: ${cssVar.colorText};
background: ${cssVar.colorFillTertiary};
`,
}));
```
Fall back to `createStyles + token` only when you need runtime token computation (rare). Inline `style={{ color: cssVar.colorTextSecondary }}` is fine for one-off dynamic values.
### 0.3 Use `@lobehub/ui`, not raw `antd`
`Block`, `Text`, `Flexbox`, `Highlighter`, `Alert`, `Tooltip`, `Skeleton` all come from `@lobehub/ui`. Modals come from `@lobehub/ui/base-ui` (`createModal`, `useModalContext`, `confirmModal`) — see the **modal** skill.
Memory note: `@lobehub/ui`'s `<Text type='secondary'>` is a lighter shade than `colorTextSecondary`. If you need that exact token color, write `<Text style={{ color: cssVar.colorTextSecondary }}>`.
### 0.4 Always `memo` and set `displayName`
```tsx
export const SearchInspector = memo<BuiltinInspectorProps<SearchQuery, UniformSearchResponse>>(
({ args /* … */ }) => {
/* … */
},
);
SearchInspector.displayName = 'SearchInspector';
export default SearchInspector;
```
### 0.5 Always type with `BuiltinXProps<Args, State>` generics
Don't widen to `any`. The Args generic is the JSON Schema params, the State generic is the executor's `state` field. The two should match `<Name>Params` and `<Name>State` from `types.ts`.
### 0.6 Pull strings from `t('plugin')`
```tsx
const { t } = useTranslation('plugin');
t('builtins.<identifier>.apiName.<api>');
```
Every Inspector should default to `t('builtins.<identifier>.apiName.<api>')` so it shows something while args stream in.
### 0.7 Read store state from `@/store/chat`, not props
Tool surfaces sometimes need cross-cutting state (loading, streaming buffer). Read it inside the component via Zustand selectors, not from props — props only carry args/state/messageId.
---
## 1. Inspector — Header Chip (required)
**Lifecycle:** Inspector renders for **every phase** of a tool call: while args are streaming in, while the executor is running, and after results come back. It's the only surface that's always visible.
**Goal:** keep it to a single line. Show what's happening with as much context as is currently available.
### Props (`BuiltinInspectorProps<Args, State>`)
```ts
interface BuiltinInspectorProps<Arguments = any, State = any> {
apiName: string;
args: Arguments; // final args (only after the assistant stops streaming)
identifier: string;
isArgumentsStreaming?: boolean; // args still arriving
isLoading?: boolean; // args complete, executor running
partialArgs?: Arguments; // partial JSON during streaming
pluginState?: State; // executor's `state` after success
result?: { content: string | null; error?: any };
}
```
### State machine
| Phase | What's available | What to show |
| ----------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
| Args streaming, no useful field yet | `isArgumentsStreaming === true`, `partialArgs.X` undefined | Just the API title with `shinyTextStyles.shinyText` |
| Args streaming, key field arrived | `partialArgs.X` populated | Title + key field chip, still pulse-animated |
| Args complete, executor running | `args` populated, `isLoading === true` | Same as above, still pulse-animated |
| Result arrived | `pluginState` populated, `isLoading === false` | Title + chips + result summary (count, identifier, status) |
### Canonical example — Search
`packages/builtin-tool-web-browsing/src/client/Inspector/Search/index.tsx`:
```tsx
'use client';
import type { BuiltinInspectorProps, SearchQuery, UniformSearchResponse } from '@lobechat/types';
import { Text } from '@lobehub/ui';
import { cssVar, cx } from 'antd-style';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
export const SearchInspector = memo<BuiltinInspectorProps<SearchQuery, UniformSearchResponse>>(
({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
const { t } = useTranslation('plugin');
const query = args?.query || partialArgs?.query || '';
const resultCount = pluginState?.results?.length ?? 0;
const hasResults = resultCount > 0;
if (isArgumentsStreaming && !query) {
return (
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
<span>{t('builtins.lobe-web-browsing.apiName.search')}</span>
</div>
);
}
return (
<div
className={cx(
inspectorTextStyles.root,
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
)}
>
<span>{t('builtins.lobe-web-browsing.apiName.search')}:&nbsp;</span>
{query && <span className={highlightTextStyles.primary}>{query}</span>}
{!isLoading &&
!isArgumentsStreaming &&
pluginState?.results &&
(hasResults ? (
<span style={{ marginInlineStart: 4 }}>({resultCount})</span>
) : (
<Text as="span" color={cssVar.colorTextDescription} fontSize={12}>
({t('builtins.lobe-web-browsing.inspector.noResults')})
</Text>
))}
</div>
);
},
);
SearchInspector.displayName = 'SearchInspector';
export default SearchInspector;
```
### Inspector rules
- Wrap the whole row with `inspectorTextStyles.root` (provides correct flex / line-height baseline).
- Pulse with `shinyTextStyles.shinyText` whenever `isArgumentsStreaming || isLoading`.
- Show the i18n title first so the row is non-empty during the earliest streaming phase.
- Read both `args?.X` and `partialArgs?.X` together — `args` is final, `partialArgs` is in-stream.
- Use chips/tags for distinct facets (identifier, name, parent, status, count). Each chip should clip with `text-overflow: ellipsis` and have a `max-width` so long values don't blow out the chat bubble.
- Append `pluginState`-derived suffixes only **after** loading finishes — count or "(no results)" should not appear while still searching.
### Inspector registry — `client/Inspector/index.ts`
```ts
import type { BuiltinInspector } from '@lobechat/types';
import { TaskApiName } from '../../types';
import { CreateTaskInspector } from './CreateTask';
import { ListTasksInspector } from './ListTasks';
/* … */
export const TaskInspectors: Record<string, BuiltinInspector> = {
[TaskApiName.createTask]: CreateTaskInspector as BuiltinInspector,
[TaskApiName.listTasks]: ListTasksInspector as BuiltinInspector,
/* one entry per ApiName */
};
export { CreateTaskInspector } from './CreateTask';
export { ListTasksInspector } from './ListTasks';
/* re-export each */
```
---
## 2. Render — Rich Result Card (optional)
**Lifecycle:** rendered **once the result arrives** (after Placeholder/Streaming hand off). Sits below the Inspector header.
**Skip if** the API is read-only or the result is just text — the framework already shows the executor's `content` string. Add a Render only when there's a structured artifact worth seeing: a card, a chart, a diff, a list of files.
### Props (`BuiltinRenderProps<Args, State, Content>`)
```ts
interface BuiltinRenderProps<Arguments = any, State = any, Content = any> {
apiName?: string;
args: Arguments; // final params from the LLM
content: Content; // executor's content string (or parsed)
identifier?: string;
messageId: string; // for store lookups
pluginError?: any; // from BuiltinToolResult.error
pluginState?: State; // executor's state
toolCallId?: string;
}
```
### Two patterns
**Pattern A — Single-file Render** (web-browsing CrawlSinglePage):
```tsx
// client/Render/CrawlSinglePage.tsx
import type { BuiltinRenderProps, CrawlPluginState, CrawlSinglePageQuery } from '@lobechat/types';
import { memo } from 'react';
import PageContent from './PageContent';
const CrawlSinglePage = memo<BuiltinRenderProps<CrawlSinglePageQuery, CrawlPluginState>>(
({ messageId, pluginState, args }) => (
<PageContent messageId={messageId} results={pluginState?.results} urls={[args?.url]} />
),
);
export default CrawlSinglePage;
```
**Pattern B — Folder with subcomponents** (web-browsing Search):
```
client/Render/Search/
├── index.tsx # composes the subcomponents, handles error states
├── ConfigForm.tsx # appears when pluginError.type === 'PluginSettingsInvalid'
├── SearchQuery.tsx # editable query header
└── SearchResult.tsx # result list
```
Use Pattern B when the Render has internal state (editing mode, expanded items), error variants, or is large enough to benefit from splitting.
### Error handling in Render
Renders are the canonical place to surface `pluginError` because the chat doesn't auto-render typed errors:
```tsx
if (pluginError) {
if (pluginError?.type === 'PluginSettingsInvalid') {
return <ConfigForm id={messageId} provider={pluginError.body?.provider} />;
}
return (
<Alert
title={pluginError?.message}
type="error"
extra={<Highlighter language="json">{JSON.stringify(pluginError.body, null, 2)}</Highlighter>}
/>
);
}
```
### Render rules
- **Return `null`** if there's nothing useful to draw yet (avoids empty cards during stream).
- Use `pluginState` for server-truth (ids, counts, server-assigned status) and `args` for what the LLM asked. **Combine — neither alone is enough.**
- For lists, summarize with a header line and show top N items with a "+N more" tail rather than rendering everything.
- For modals from a Render, use `@lobehub/ui/base-ui` (`createModal`, `useModalContext`, `confirmModal`) — see the **modal** skill.
### Render registry — `client/Render/index.ts`
```ts
import type { BuiltinRender } from '@lobechat/types';
import { TaskApiName } from '../../types';
import CreateTaskRender from './CreateTask';
import RunTasksRender from './RunTasks';
export const TaskRenders: Record<string, BuiltinRender> = {
[TaskApiName.createTask]: CreateTaskRender as BuiltinRender,
[TaskApiName.runTasks]: RunTasksRender as BuiltinRender,
/* only the APIs with rich result UI — others fall back to text content */
};
export { default as CreateTaskRender } from './CreateTask';
export { default as RunTasksRender } from './RunTasks';
```
### Render display control (rare)
If the Render should hide for certain results (e.g. ClaudeCode's TodoWrite hides when the agent is mid-stream), add a `RenderDisplayControl` to `packages/builtin-tools/src/displayControls.ts`. See `ClaudeCodeRenderDisplayControls` for the pattern.
---
## 3. Placeholder — Skeleton Between Args and Result (optional)
**Lifecycle:** rendered when the args have finished streaming but the executor hasn't returned yet. Disappears when `pluginState` arrives. Bridges the moment of perceived lag.
**Add for** APIs with noticeable execution time: web search, network crawl, file list, large grep. **Skip for** instant ops (status flips, calculator).
### Props (`BuiltinPlaceholderProps<Args>`)
```ts
interface BuiltinPlaceholderProps<T extends Record<string, any> = any> {
apiName: string;
args?: T;
identifier: string;
}
```
No `pluginState` — Placeholder lives entirely in the "executing" gap.
### Canonical example — Search Placeholder
`packages/builtin-tool-web-browsing/src/client/Placeholder/Search.tsx`:
```tsx
import type { BuiltinPlaceholderProps, SearchQuery } from '@lobechat/types';
import { Flexbox, Icon, Skeleton } from '@lobehub/ui';
import { createStaticStyles, cx } from 'antd-style';
import { SearchIcon } from 'lucide-react';
import { memo } from 'react';
import { useIsMobile } from '@/hooks/useIsMobile';
import { shinyTextStyles } from '@/styles';
const styles = createStaticStyles(({ css, cssVar }) => ({
query: cx(
css`
padding: 4px 8px;
border-radius: 8px;
font-size: 12px;
color: ${cssVar.colorTextSecondary};
&:hover {
background: ${cssVar.colorFillTertiary};
}
`,
shinyTextStyles.shinyText,
),
}));
export const Search = memo<BuiltinPlaceholderProps<SearchQuery>>(({ args }) => {
const { query } = args || {};
const isMobile = useIsMobile();
return (
<Flexbox gap={8}>
<Flexbox horizontal={!isMobile} gap={isMobile ? 8 : 40}>
<Flexbox horizontal align="center" className={styles.query} gap={8}>
<Icon icon={SearchIcon} />
{query ? query : <Skeleton.Block active style={{ height: 20, width: 40 }} />}
</Flexbox>
<Skeleton.Block active style={{ height: 20, width: 40 }} />
</Flexbox>
<Flexbox horizontal gap={12}>
{[1, 2, 3, 4, 5].map((id) => (
<Skeleton.Button active key={id} style={{ borderRadius: 8, height: 80, width: 160 }} />
))}
</Flexbox>
</Flexbox>
);
});
```
### Placeholder rules
- **Mirror the eventual Render's layout.** When the result arrives the Placeholder unmounts and the Render mounts; if they share dimensions, the chat doesn't jump.
- Use `Skeleton.Block` / `Skeleton.Button` from `@lobehub/ui` for placeholder shapes.
- Embed any args you have (e.g. the query text) — context helps the user know what's loading.
- Pulse with `shinyTextStyles.shinyText` if the Placeholder includes literal text.
### Placeholder registry — `client/Placeholder/index.ts`
```ts
import { WebBrowsingApiName } from '../../types';
import CrawlMultiPages from './CrawlMultiPages';
import CrawlSinglePage from './CrawlSinglePage';
import { Search } from './Search';
export const WebBrowsingPlaceholders = {
[WebBrowsingApiName.crawlMultiPages]: CrawlMultiPages,
[WebBrowsingApiName.crawlSinglePage]: CrawlSinglePage,
[WebBrowsingApiName.search]: Search,
};
export { CrawlMultiPages, CrawlSinglePage, Search };
```
---
## 4. Streaming — Live Output During Execution (optional)
**Lifecycle:** rendered **while the executor is still running** for APIs that emit incremental output. The component is responsible for fetching the in-flight stream from the chat store and rendering it.
**Add for** long-running ops with continuous output: shell command execution (stdout/stderr), file write progress, code interpreter cells.
### Props (`BuiltinStreamingProps<Args>`)
```ts
interface BuiltinStreamingProps<Arguments = any> {
apiName: string;
args: Arguments;
identifier: string;
messageId: string; // use to fetch the streaming buffer from store
toolCallId: string;
}
```
Note there's **no `state` or `result` prop** — the Streaming component is for the in-flight phase. It pulls the live buffer from the store itself (typically via `chatToolSelectors.streamingContent(messageId)` or similar).
### Canonical example — RunCommandStreaming
`packages/builtin-tool-local-system/src/client/Streaming/RunCommand/index.tsx`:
```tsx
'use client';
import type { BuiltinStreamingProps } from '@lobechat/types';
import { Highlighter } from '@lobehub/ui';
import { memo } from 'react';
interface RunCommandParams {
command?: string;
description?: string;
timeout?: number;
}
export const RunCommandStreaming = memo<BuiltinStreamingProps<RunCommandParams>>(({ args }) => {
const { command } = args || {};
if (!command) return null;
return (
<Highlighter
animated
wrap
language="sh"
showLanguage={false}
style={{ padding: '4px 8px' }}
variant="outlined"
>
{command}
</Highlighter>
);
});
RunCommandStreaming.displayName = 'RunCommandStreaming';
```
For real-time output beyond just the command (stderr/stdout streaming), pull from the chat store:
```tsx
const buffer = useChatStore((state) =>
chatToolSelectors.streamingBuffer(messageId, toolCallId)(state),
);
```
### Streaming rules
- Render `null` until you have something to display (avoids flash).
- For terminal-style output, use `Highlighter` with `animated` to show typing-like effect.
- The Streaming component must **unmount cleanly** when execution ends — typically the framework swaps it out for the Render automatically.
### Streaming registry — `client/Streaming/index.ts`
```ts
import { LocalSystemApiName } from '../..';
import { RunCommandStreaming } from './RunCommand';
import { WriteFileStreaming } from './WriteFile';
export const LocalSystemStreamings = {
[LocalSystemApiName.runCommand]: RunCommandStreaming,
[LocalSystemApiName.writeLocalFile]: WriteFileStreaming,
};
```
---
## 5. Intervention — Approval / Edit-Before-Run (optional)
**Lifecycle:** rendered **before the executor runs** for APIs whose manifest sets `humanIntervention`. The user sees a preview of the args, can edit them, then approves or skips/cancels.
**Add for** destructive or sensitive ops: shell commands, file writes, file moves, payments, message broadcasts.
### Props (`BuiltinInterventionProps<Args>`)
```ts
interface BuiltinInterventionProps<Arguments = any> {
apiName?: string;
args: Arguments;
identifier?: string;
interactionMode?: 'approval' | 'custom';
messageId: string;
/** Called when the user edits the args; the approve action awaits this. */
onArgsChange?: (args: Arguments) => void | Promise<void>;
/** Called on approve / skip / cancel. */
onInteractionAction?: (
action:
| { type: 'submit'; payload: Record<string, unknown> }
| { type: 'skip'; payload?: Record<string, unknown>; reason?: string }
| { type: 'cancel'; payload?: Record<string, unknown> },
) => Promise<void>;
/** Register a callback to flush pending saves before approval. Returns cleanup. */
registerBeforeApprove?: (id: string, callback: () => void | Promise<void>) => () => void;
}
```
### Canonical example — RunCommand Intervention
`packages/builtin-tool-local-system/src/client/Intervention/RunCommand/index.tsx`:
```tsx
import type { RunCommandParams } from '@lobechat/electron-client-ipc';
import type { BuiltinInterventionProps } from '@lobechat/types';
import { Flexbox, Highlighter, Text } from '@lobehub/ui';
import { memo } from 'react';
const RunCommand = memo<BuiltinInterventionProps<RunCommandParams>>(({ args }) => {
const { description, command, timeout } = args;
return (
<Flexbox gap={8}>
<Flexbox horizontal justify="space-between">
{description && <Text>{description}</Text>}
{timeout && (
<Text style={{ fontSize: 12 }} type="secondary">
timeout: {formatTimeout(timeout)}
</Text>
)}
</Flexbox>
{command && (
<Highlighter wrap language="sh" showLanguage={false} variant="outlined">
{command}
</Highlighter>
)}
</Flexbox>
);
});
export default RunCommand;
```
### Intervention rules
- **Show a preview, not a form by default.** Editing UI is opt-in via `onArgsChange` and is usually inline (click to edit a code block, etc.).
- For args with debounced edit state (text fields), use `registerBeforeApprove(id, flushFn)` so the approve action waits for the debounce to flush. Always return the cleanup function.
- Call `onInteractionAction({ type: 'submit', payload })` when the user approves; `'skip'` if they skip with a reason; `'cancel'` if they cancel the whole turn.
- Add a corresponding `interventionAudit.ts` in the package root if the tool needs scope/path validation before approval (see `local-system/src/interventionAudit.ts`).
### Intervention registry — `client/Intervention/index.ts`
```ts
import { LocalSystemApiName } from '../..';
import EditLocalFile from './EditLocalFile';
import RunCommand from './RunCommand';
import WriteFile from './WriteFile';
/* … */
export const LocalSystemInterventions = {
[LocalSystemApiName.editLocalFile]: EditLocalFile,
[LocalSystemApiName.runCommand]: RunCommand,
[LocalSystemApiName.writeLocalFile]: WriteFile,
/* one entry per API that needs approval */
};
```
---
## 6. Portal — Full-Screen Detail View (optional)
**Lifecycle:** rendered when the user opens the tool message in a side panel or full-screen modal. One Portal per **tool**, not per API — the Portal switches on `apiName` internally.
**Add for** tools whose results deserve a deep-dive view: search results with editable filters, page content with reader mode, code interpreter sessions.
### Props (`BuiltinPortalProps<Args, State>`)
```ts
interface BuiltinPortalProps<Arguments = Record<string, any>, State = any> {
apiName?: string;
arguments: Arguments;
identifier: string;
messageId: string;
state: State;
}
```
### Canonical example — Web-Browsing Portal
`packages/builtin-tool-web-browsing/src/client/Portal/index.tsx`:
```tsx
import type { BuiltinPortalProps, CrawlPluginState, SearchQuery } from '@lobechat/types';
import { memo } from 'react';
import { WebBrowsingApiName } from '../../types';
import PageContent from './PageContent';
import PageContents from './PageContents';
import Search from './Search';
const Portal = memo<BuiltinPortalProps>(({ arguments: args, messageId, state, apiName }) => {
switch (apiName) {
case WebBrowsingApiName.search:
return <Search messageId={messageId} query={args as SearchQuery} response={state} />;
case WebBrowsingApiName.crawlSinglePage: {
const result = (state as CrawlPluginState).results.find((r) => r.originalUrl === args.url);
return <PageContent messageId={messageId} result={result} />;
}
case WebBrowsingApiName.crawlMultiPages:
return (
<PageContents
messageId={messageId}
results={(state as CrawlPluginState).results}
urls={args.urls}
/>
);
}
return null;
});
export default Portal;
```
### Portal rules
- One Portal per tool — the file is the routing layer, subcomponents implement each API's view.
- Portals can read the chat store directly to detect "still streaming" and render a Skeleton internally (see `Search/index.tsx:20-46`).
- Layout assumes more space than the Render — use `Flexbox` with `height={'100%'}` and structure for a side panel viewport.
### Portal registry — `packages/builtin-tools/src/portals.ts`
```ts
import { WebBrowsingManifest, WebBrowsingPortal } from '@lobechat/builtin-tool-web-browsing/client';
import { type BuiltinPortal } from '@lobechat/types';
export const BuiltinToolsPortals: Record<string, BuiltinPortal> = {
[WebBrowsingManifest.identifier]: WebBrowsingPortal as BuiltinPortal,
};
```
---
## 7. `client/components/` — Shared Subcomponents
Cross-cutting building blocks used by multiple surfaces live here, not duplicated in each surface folder.
Examples from `web-browsing/src/client/components/`:
- `CategoryAvatar.tsx` — search category icon
- `EngineAvatar.tsx` — search engine logo (used in Inspector chip + Render list + Portal header)
- `SearchBar.tsx` — editable query bar (used in Render and Portal)
Examples from `local-system/src/client/components/`:
- `FileItem.tsx` — single file row (used in ListFiles Render, SearchFiles Render, MoveLocalFiles Render)
- `FilePathDisplay.tsx` — path with truncation (used everywhere)
### Rules
- Live under `client/components/`, exported via `client/components/index.ts`.
- Re-export from `client/index.ts` only if other packages need them; otherwise keep internal.
- Keep them dumb — props in, JSX out, no store reads. The store reads belong in the surface that composes them.
---
## 8. `client/index.ts` — Package Public API
Re-exports everything the registries need plus useful types/manifest:
```ts
// Inspector — required
export { TaskInspectors } from './Inspector';
// Render — only if any API has one
export { TaskRenders, CreateTaskRender, RunTasksRender } from './Render';
// Placeholder / Streaming / Intervention — only if used
export { LocalSystemListFilesPlaceholder, LocalSystemSearchFilesPlaceholder } from './Placeholder';
export { LocalSystemStreamings } from './Streaming';
export { LocalSystemInterventions } from './Intervention';
// Portal — single export per tool
export { default as WebBrowsingPortal } from './Portal';
// Reusable components if other packages need them
export { CategoryAvatar, EngineAvatar, SearchBar } from './components';
// Re-export manifest, identifier, types for convenience
export { TaskManifest, TaskIdentifier } from '../manifest';
export * from '../types';
```
---
## 9. Diagnostic Quick-Lookup
| Symptom | Surface to check | | |
| ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | --- | ------------------------- |
| No header at all on the tool call | Inspector missing from `client/Inspector/index.ts` registry | | |
| Header shows the API name but no chips | Inspector missing \`args?.X | | partialArgs?.X\` fallback |
| Header doesn't pulse during loading | Missing `shinyTextStyles.shinyText` on `isArgumentsStreaming \|\| isLoading` | | |
| Empty result card under header | Render returned `<div />` instead of `null` when no data | | |
| Layout jump when result arrives | Placeholder dimensions don't match Render dimensions | | |
| Approval dialog never appears | Manifest missing `humanIntervention`, or Intervention not in registry | | |
| Approval click doesn't wait for inline edit | Missing `registerBeforeApprove(id, flushFn)` | | |
| Portal opens but blank | Switch in `Portal/index.tsx` doesn't cover the apiName | | |
| Strings show as `builtins.lobe-foo.apiName.bar` | Missing i18n key in `src/locales/default/plugin.ts` (or not seeded in dev locale files) | | |
| Wrong color shade on `<Text type="secondary">` | `type='secondary'` is lighter than `colorTextSecondary` — pass via `style={{ color: cssVar.colorTextSecondary }}` | | |
@@ -11,167 +11,86 @@
# Environment variables:
# CDP_PORT — Chrome DevTools Protocol port (default: 9222)
# ELECTRON_LOG — Log file path (default: /tmp/electron-dev.log)
# ELECTRON_WAIT_S — Max seconds to wait for CDP to become reachable (default: 90)
# RENDERER_WAIT_S — Max seconds to wait for SPA after CDP is up (default: 60)
# FORCE_KILL_USER — When set to 1, silently kill the user's `bun run dev`
# Electron without confirmation (default: always confirm-by-action)
# ELECTRON_WAIT_S — Max seconds to wait for Electron process (default: 60)
# RENDERER_WAIT_S — Max seconds to wait for renderer/SPA (default: 60)
#
set -euo pipefail
CDP_PORT="${CDP_PORT:-9222}"
ELECTRON_LOG="${ELECTRON_LOG:-/tmp/electron-dev.log}"
ELECTRON_WAIT_S="${ELECTRON_WAIT_S:-90}"
ELECTRON_WAIT_S="${ELECTRON_WAIT_S:-60}"
RENDERER_WAIT_S="${RENDERER_WAIT_S:-60}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
PIDFILE="/tmp/electron-dev-cdp-${CDP_PORT}.pid"
# Project-scoped electron path prefix used for pgrep matching. Any Electron
# binary from this project (main + helpers, with or without --remote-debugging-port)
# starts with this string in its argv[0], so a single substring match catches all.
PROJECT_ELECTRON_PATH="${PROJECT_ROOT}/apps/desktop/node_modules/.pnpm/electron@"
# ── Helpers ──────────────────────────────────────────────────────────
# Print pid + every descendant pid (DFS via pgrep -P).
expand_descendants() {
local pid="$1"
echo "$pid"
local children
children=$(pgrep -P "$pid" 2>/dev/null || true)
for c in $children; do
expand_descendants "$c"
done
# Get the Electron binary path used by this project
electron_bin_pattern() {
echo "${PROJECT_ROOT}/apps/desktop/node_modules/.pnpm/electron@*/node_modules/electron/dist/Electron.app"
}
# Find seed PIDs related to this project's Electron dev session.
# Matches REGARDLESS of whether --remote-debugging-port was passed, so it also
# catches a plain `bun run dev` session the user started outside this script.
find_project_pids() {
# Find all PIDs related to the project's Electron dev session
find_electron_pids() {
local pids=""
# 1. Any process whose command line mentions this project's electron path
# (covers the main Electron binary AND every Helper subprocess)
local electron_pids
electron_pids=$(pgrep -f "$PROJECT_ELECTRON_PATH" 2>/dev/null || true)
pids="$pids $electron_pids"
# 1. Main Electron process (launched with --remote-debugging-port)
local main_pids
main_pids=$(pgrep -f "Electron\.app.*--remote-debugging-port=${CDP_PORT}" 2>/dev/null || true)
[ -n "$main_pids" ] && pids="$pids $main_pids"
# 2. electron-vite dev server (narrow match to avoid catching unrelated Vite invocations)
# 2. Electron Helper processes (gpu, renderer, utility) spawned from the project's electron binary
local helper_pids
helper_pids=$(pgrep -f "${PROJECT_ROOT}/apps/desktop/node_modules/.*Electron Helper" 2>/dev/null || true)
[ -n "$helper_pids" ] && pids="$pids $helper_pids"
# 3. electron-vite dev server
local vite_pids
vite_pids=$(pgrep -f "electron-vite[/.].*\\bdev\\b" 2>/dev/null || true)
pids="$pids $vite_pids"
vite_pids=$(pgrep -f "electron-vite.*dev" 2>/dev/null || true)
[ -n "$vite_pids" ] && pids="$pids $vite_pids"
# 3. The launcher subshell from a previous `start` (saved to pidfile)
# 4. PID from pidfile (fallback)
if [ -f "$PIDFILE" ]; then
local saved_pid
saved_pid=$(cat "$PIDFILE" 2>/dev/null || true)
if [ -n "$saved_pid" ] && kill -0 "$saved_pid" 2>/dev/null; then
saved_pid=$(cat "$PIDFILE")
if kill -0 "$saved_pid" 2>/dev/null; then
pids="$pids $saved_pid"
fi
fi
# 4. Whatever is currently bound to the CDP port — catches strays whose
# binary path doesn't match (e.g. orphaned from a crashed restart)
local port_pid
port_pid=$(lsof -ti tcp:"$CDP_PORT" -sTCP:LISTEN 2>/dev/null || true)
pids="$pids $port_pid"
echo "$pids" | tr ' ' '\n' | sort -u | grep -v '^$' | tr '\n' ' '
# Deduplicate
echo "$pids" | tr ' ' '\n' | sort -u | grep -v '^$' | tr '\n' ' ' || true
}
# Wait for the CDP HTTP endpoint to respond, with a deadline + early bail-out
# if the launcher process died (no point waiting if Electron crashed).
wait_for_cdp() {
local deadline=$(( $(date +%s) + ELECTRON_WAIT_S ))
echo "[electron-dev] Waiting for CDP on port ${CDP_PORT} (up to ${ELECTRON_WAIT_S}s)..."
while [ "$(date +%s)" -lt "$deadline" ]; do
if curl -sf --max-time 2 "http://localhost:${CDP_PORT}/json/version" >/dev/null 2>&1; then
echo "[electron-dev] CDP is reachable."
return 0
fi
# If our launcher subshell died, abort early so we don't hang the full timeout
if [ -f "$PIDFILE" ]; then
local saved_pid
saved_pid=$(cat "$PIDFILE" 2>/dev/null || true)
if [ -n "$saved_pid" ] && ! kill -0 "$saved_pid" 2>/dev/null; then
echo "[electron-dev] Launcher PID $saved_pid is gone before CDP came up."
echo "[electron-dev] Last 30 lines of $ELECTRON_LOG:"
tail -30 "$ELECTRON_LOG" 2>/dev/null || true
return 1
fi
fi
sleep 2
done
echo "[electron-dev] ERROR: CDP did not respond within ${ELECTRON_WAIT_S}s"
echo "[electron-dev] Last 30 lines of $ELECTRON_LOG:"
tail -30 "$ELECTRON_LOG" 2>/dev/null || true
return 1
}
# After CDP is up, wait until the SPA renders interactive elements.
wait_for_renderer() {
local deadline=$(( $(date +%s) + RENDERER_WAIT_S ))
echo "[electron-dev] Waiting for SPA to load (up to ${RENDERER_WAIT_S}s)..."
while [ "$(date +%s)" -lt "$deadline" ]; do
local snap
snap=$(agent-browser --cdp "$CDP_PORT" snapshot -i 2>&1 || true)
if echo "$snap" | grep -qE '\b(link|button)\b'; then
echo "[electron-dev] Renderer ready."
return 0
fi
sleep 2
done
echo "[electron-dev] WARNING: Renderer not interactive within ${RENDERER_WAIT_S}s — proceeding anyway."
return 0
}
# ── Commands ─────────────────────────────────────────────────────────
do_stop() {
echo "[electron-dev] Stopping Electron dev environment..."
local seed_pids
seed_pids=$(find_project_pids)
local pids
pids=$(find_electron_pids)
# Expand to include all descendants — catches helpers spawned by the main
# process AFTER our pgrep snapshot, and the launcher's child node/electron-vite
# process tree.
local all_pids=""
for pid in $seed_pids; do
all_pids="$all_pids $(expand_descendants "$pid")"
done
all_pids=$(echo "$all_pids" | tr ' ' '\n' | sort -u | grep -v '^$' | tr '\n' ' ')
if [ -z "$all_pids" ]; then
echo "[electron-dev] No project Electron/vite processes found."
if [ -z "$pids" ]; then
echo "[electron-dev] No Electron processes found."
else
local count
count=$(echo "$all_pids" | tr ' ' '\n' | grep -c .)
echo "[electron-dev] Sending SIGTERM to $count process(es): $all_pids"
for pid in $all_pids; do
echo "[electron-dev] Killing PIDs: $pids"
for pid in $pids; do
kill "$pid" 2>/dev/null || true
done
# Wait up to 5s for graceful exit
# Wait up to 5s for graceful exit, then force-kill survivors
local waited=0
while [ $waited -lt 5 ]; do
local any_alive=0
for pid in $all_pids; do
if kill -0 "$pid" 2>/dev/null; then any_alive=1; break; fi
local alive=""
for pid in $pids; do
kill -0 "$pid" 2>/dev/null && alive="$alive $pid"
done
[ "$any_alive" = "0" ] && break
[ -z "$alive" ] && break
sleep 1
waited=$((waited + 1))
done
# SIGKILL anyone still alive
for pid in $all_pids; do
# Force-kill any remaining
for pid in $pids; do
if kill -0 "$pid" 2>/dev/null; then
echo "[electron-dev] Force-killing PID $pid"
kill -9 "$pid" 2>/dev/null || true
@@ -179,27 +98,7 @@ do_stop() {
done
fi
# Belt-and-suspenders: anything still bound to the CDP port goes away
local port_pid
port_pid=$(lsof -ti tcp:"$CDP_PORT" -sTCP:LISTEN 2>/dev/null || true)
if [ -n "$port_pid" ]; then
echo "[electron-dev] Port $CDP_PORT still bound by PID $port_pid; force-killing"
# shellcheck disable=SC2086
kill -9 $port_pid 2>/dev/null || true
fi
# Also re-sweep the project's electron processes — sometimes the OS spawns
# new helpers during shutdown that didn't exist when we first enumerated.
local stragglers
stragglers=$(pgrep -f "$PROJECT_ELECTRON_PATH" 2>/dev/null || true)
if [ -n "$stragglers" ]; then
echo "[electron-dev] Cleaning up stragglers: $stragglers"
for pid in $stragglers; do
kill -9 "$pid" 2>/dev/null || true
done
fi
# Close any agent-browser sessions connected to this port
# Also close any agent-browser sessions connected to this port
agent-browser --cdp "$CDP_PORT" close --all 2>/dev/null || true
rm -f "$PIDFILE"
@@ -208,84 +107,113 @@ do_stop() {
do_status() {
local pids
pids=$(find_project_pids)
pids=$(find_electron_pids)
if [ -z "$pids" ]; then
echo "[electron-dev] No project Electron processes found."
echo "[electron-dev] Electron is NOT running."
return 1
fi
echo "[electron-dev] Project processes: $pids"
echo "[electron-dev] Electron is running (PIDs: $pids)"
if curl -sf --max-time 2 "http://localhost:${CDP_PORT}/json/version" >/dev/null 2>&1; then
# Check CDP connectivity
if agent-browser --cdp "$CDP_PORT" get url >/dev/null 2>&1; then
local url
url=$(agent-browser --cdp "$CDP_PORT" get url 2>&1 | tail -1 || echo "?")
url=$(agent-browser --cdp "$CDP_PORT" get url 2>&1 | tail -1)
echo "[electron-dev] CDP port ${CDP_PORT} is reachable. URL: $url"
return 0
else
echo "[electron-dev] CDP port ${CDP_PORT} is NOT reachable (no --remote-debugging-port, or still loading)."
echo "[electron-dev] CDP port ${CDP_PORT} is NOT reachable (Electron may still be loading)."
return 2
fi
}
wait_for_electron() {
echo "[electron-dev] Waiting for Electron process (up to ${ELECTRON_WAIT_S}s)..."
local elapsed=0
local interval=3
while [ $elapsed -lt "$ELECTRON_WAIT_S" ]; do
if strings "$ELECTRON_LOG" 2>/dev/null | grep -q "starting electron"; then
echo "[electron-dev] Electron process started."
return 0
fi
sleep "$interval"
elapsed=$((elapsed + interval))
echo "[electron-dev] Still waiting... (${elapsed}/${ELECTRON_WAIT_S}s)"
done
echo "[electron-dev] ERROR: Electron did not start within ${ELECTRON_WAIT_S}s"
echo "[electron-dev] Last 20 lines of log:"
tail -20 "$ELECTRON_LOG" 2>/dev/null || true
return 1
}
wait_for_renderer() {
echo "[electron-dev] Waiting for renderer/SPA to load (up to ${RENDERER_WAIT_S}s)..."
# Initial delay — renderer needs time to bootstrap
sleep 10
local elapsed=10
local interval=5
while [ $elapsed -lt "$RENDERER_WAIT_S" ]; do
if agent-browser --cdp "$CDP_PORT" wait 2000 >/dev/null 2>&1; then
# Check if interactive elements are present (SPA loaded)
local snap
snap=$(agent-browser --cdp "$CDP_PORT" snapshot -i 2>&1 || true)
if echo "$snap" | grep -qE 'link |button '; then
echo "[electron-dev] Renderer ready (interactive elements found)."
return 0
fi
fi
sleep "$interval"
elapsed=$((elapsed + interval))
echo "[electron-dev] SPA still loading... (${elapsed}/${RENDERER_WAIT_S}s)"
done
echo "[electron-dev] WARNING: Timed out waiting for renderer, proceeding anyway."
return 0
}
do_start() {
# Already up and CDP is reachable → nothing to do
if curl -sf --max-time 2 "http://localhost:${CDP_PORT}/json/version" >/dev/null 2>&1; then
echo "[electron-dev] CDP already reachable on port $CDP_PORT. Skipping start."
echo "[electron-dev] Use 'restart' to force a fresh session."
# If already running and healthy, skip
local status_ok=0
do_status >/dev/null 2>&1 || status_ok=$?
if [ "$status_ok" -eq 0 ]; then
echo "[electron-dev] Electron is already running and CDP is reachable. Skipping start."
echo "[electron-dev] Use 'restart' to force a fresh session, or 'stop' to tear down."
return 0
fi
# Detect the user's existing dev session (or stale processes) BEFORE killing
local existing
existing=$(find_project_pids)
if [ -n "$existing" ]; then
echo "[electron-dev] Existing project Electron/vite processes detected:"
echo "$existing" | tr ' ' '\n' | sed 's/^/[electron-dev] PID /'
echo "[electron-dev] Tearing them down so we can start a CDP-enabled session..."
fi
# Clean up any stale processes
do_stop
# Wait for port + user-data-dir locks to release. Without this, the new
# Electron may fail with "user data directory in use" or fail to bind CDP.
local waited=0
while [ $waited -lt 10 ]; do
if ! lsof -i tcp:"$CDP_PORT" >/dev/null 2>&1 \
&& ! pgrep -f "$PROJECT_ELECTRON_PATH" >/dev/null 2>&1; then
break
fi
[ $waited -eq 0 ] && echo "[electron-dev] Waiting for port + Electron locks to release..."
sleep 1
waited=$((waited + 1))
done
# Start fresh
echo "[electron-dev] Starting Electron dev server..."
echo "[electron-dev] Project: $PROJECT_ROOT"
echo "[electron-dev] Project: $PROJECT_ROOT"
echo "[electron-dev] CDP port: $CDP_PORT"
echo "[electron-dev] Log: $ELECTRON_LOG"
echo "[electron-dev] Log: $ELECTRON_LOG"
: > "$ELECTRON_LOG" # Truncate log
# Launch in a new session (setsid) so the whole process tree shares a PGID
# we can later signal in one shot. `setsid bash -c '... exec ...' &` keeps
# the bash shell as the session leader; its PID is what we save.
setsid bash -c "
cd '$PROJECT_ROOT/apps/desktop'
exec npx electron-vite dev -- --remote-debugging-port=$CDP_PORT
" >> "$ELECTRON_LOG" 2>&1 < /dev/null &
local launcher_pid=$!
echo "$launcher_pid" > "$PIDFILE"
echo "[electron-dev] Launcher PID (session leader): $launcher_pid"
(
cd "$PROJECT_ROOT/apps/desktop" && \
ELECTRON_ENABLE_LOGGING=1 npx electron-vite dev -- --remote-debugging-port="$CDP_PORT" \
>> "$ELECTRON_LOG" 2>&1
) &
local bg_pid=$!
echo "$bg_pid" > "$PIDFILE"
echo "[electron-dev] Background PID: $bg_pid"
if ! wait_for_cdp; then
echo "[electron-dev] Failed to bring up CDP. Cleaning up..."
# Wait for Electron process to start
if ! wait_for_electron; then
echo "[electron-dev] Failed to start. Cleaning up..."
do_stop
return 1
fi
# Wait for renderer to be interactive
if ! wait_for_renderer; then
echo "[electron-dev] Renderer not interactive — you may need to wait more."
echo "[electron-dev] Renderer not ready, but Electron is running. You may need to wait more."
fi
echo "[electron-dev] Ready! Use: agent-browser --cdp $CDP_PORT snapshot -i"
@@ -293,7 +221,7 @@ do_start() {
do_restart() {
do_stop
sleep 1
sleep 2
do_start
}
@@ -307,12 +235,10 @@ case "${1:-help}" in
*)
echo "Usage: $0 {start|stop|status|restart}"
echo ""
echo " start — Start Electron dev with CDP. Detects + tears down any"
echo " existing project Electron (e.g. \`bun run dev\`) first."
echo " stop — Kill all project Electron/vite processes (main + helpers"
echo " + descendants), with SIGTERM → 5s wait → SIGKILL fallback."
echo " status — Check if Electron is running and CDP is reachable."
echo " restart — Stop then start."
echo " start — Start Electron dev with CDP (idempotent, skips if already running)"
echo " stop — Kill all Electron dev processes (main + helpers + vite)"
echo " status — Check if Electron is running and CDP is reachable"
echo " restart — Stop then start"
exit 1
;;
esac
@@ -1,44 +0,0 @@
---
name: 'source-command-dedupe'
description: 'Find duplicate GitHub issues'
---
# source-command-dedupe
Use this skill when the user asks to run the migrated source command `dedupe`.
## Command Template
Find up to 3 likely duplicate issues for a given GitHub issue.
To do this, follow these steps precisely:
1. Use an agent to check if the Github issue (a) is closed, (b) does not need to be deduped (eg. because it is broad product feedback without a specific solution, or positive feedback), or (c) already has a duplicates comment that you made earlier. If so, do not proceed.
2. Use an agent to view a Github issue, and ask the agent to return a summary of the issue
3. Then, launch 5 parallel agents to search Github for duplicates of this issue, using diverse keywords and search approaches, using the summary from #1
4. Next, feed the results from #1 and #2 into another agent, so that it can filter out false positives, that are likely not actually duplicates of the original issue. If there are no duplicates remaining, do not proceed.
5. Finally, comment back on the issue with a list of up to three duplicate issues (or zero, if there are no likely duplicates)
Notes (be sure to tell this to your agents, too):
- Use `gh` to interact with Github, rather than web fetch
- Do not use other tools, beyond `gh` (eg. don't use other MCP servers, file edit, etc.)
- Make a todo list first
- For your comment, follow the following format precisely (assuming for this example that you found 3 suspected duplicates):
---
Found 3 possible duplicate issues:
1. <link to issue>
2. <link to issue>
3. <link to issue>
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
> 🤖 Generated with Codex
---
+259 -19
View File
@@ -5,8 +5,6 @@ description: "Version release workflow. Use when the user mentions 'release', 'h
# Version Release Workflow
This skill is a router. The detailed steps live in `reference/`.
## Scope Boundary (Important)
This skill is only for:
@@ -30,12 +28,68 @@ The primary development branch is **canary**. All day-to-day development happens
Only two release types are used in practice (major releases are extremely rare and can be ignored):
| Type | Use Case | Frequency | Source Branch | PR Title Format | Version | Reference |
| ----- | ---------------------------------------------- | --------------------- | -------------- | ------------------------------------ | ------------- | -------------------------------------- |
| Minor | Feature iteration release | \~Every 4 weeks | canary | `🚀 release: v{x.y.0}` | Manually set | `reference/minor-release.md` |
| Patch | Weekly release / hotfix / model / DB migration | \~Weekly or as needed | canary or main | Custom (e.g. `🚀 release: 20260222`) | Auto patch +1 | `reference/patch-release-scenarios.md` |
| Type | Use Case | Frequency | Source Branch | PR Title Format | Version |
| ----- | ---------------------------------------------- | --------------------- | -------------- | ------------------------------------ | ------------- |
| Minor | Feature iteration release | \~Every 4 weeks | canary | `🚀 release: v{x.y.0}` | Manually set |
| Patch | Weekly release / hotfix / model / DB migration | \~Weekly or as needed | canary or main | Custom (e.g. `🚀 release: 20260222`) | Auto patch +1 |
For writing the release-note body (any release type), see `reference/release-notes-style.md`.
## Minor Release Workflow
Used to publish a new minor version (e.g. `v2.2.0`), roughly every 4 weeks.
### Steps
1. **Create a release branch from canary**
```bash
git checkout canary
git pull origin canary
git checkout -b release/v{version}
git push -u origin release/v{version}
```
2. **Determine the version number** — Read the current version from `package.json` and compute the next minor version (e.g. 2.1.x -> 2.2.0)
3. **Create a PR to main**
```bash
gh pr create \
--title "🚀 release: v{version}" \
--base main \
--head release/v{version} \
--body "## 📦 Release v{version} ..."
```
> \[!IMPORTANT]
> The PR title must strictly match the `🚀 release: v{x.y.z}` format. CI uses a regex on this title to determine the exact version number.
4. **Automatic trigger after merge**: `auto-tag-release` detects the title format and uses the version number from the title to complete the release.
### Scripts
```bash
bun run release:branch # Interactive
bun run release:branch --minor # Directly specify minor
```
## Patch Release Workflow
Version number is automatically bumped by patch +1. There are 4 common scenarios:
| Scenario | Source Branch | Branch Naming | Description |
| ------------------- | ------------- | ----------------------------- | ------------------------------------------------ |
| Weekly Release | canary | `release/weekly-{YYYYMMDD}` | Weekly release train, canary -> main |
| Bug Hotfix | main | `hotfix/v{version}-{hash}` | Emergency bug fix |
| New Model Launch | canary | Community PR merged directly | New model launch, triggered by PR title prefix |
| DB Schema Migration | main | `release/db-migration-{name}` | Database migration, requires dedicated changelog |
All scenarios auto-bump patch +1. Patch PR titles do not need a version number. See `reference/patch-release-scenarios.md` for detailed steps per scenario.
### Scripts
```bash
bun run hotfix:branch # Hotfix scenario
```
## Auto-Release Trigger Rules (`auto-tag-release.yml`)
@@ -73,7 +127,7 @@ PRs that don't match any conditions above (e.g. `docs`, `chore`, `ci`, `test`) w
When the user requests a release:
### Precheck (applies to all release types)
### Precheck
Before creating the release branch, verify the source branch:
@@ -81,18 +135,204 @@ Before creating the release branch, verify the source branch:
- **All other release/hotfix branches**: must branch from `main`; run `git merge-base --is-ancestor main <branch> && echo OK`
- If the branch is based on the wrong source, recreate from the correct base
### Routing
### Minor Release
Pick the right reference and follow it end-to-end:
1. Read `package.json` to get the current version and compute the next minor version
2. Create a `release/v{version}` branch from canary
3. Push and create PR — **title must be `🚀 release: v{version}`**
4. Inform the user that merge will auto-trigger release
- **Minor release** → `reference/minor-release.md`
- **Patch release** (weekly / hotfix / model launch / DB migration) → `reference/patch-release-scenarios.md`
- **Writing the PR body / release notes** (any release type) → `reference/release-notes-style.md`
### Patch Release
### Hard Rules (apply to every release type)
Choose workflow by scenario (see `reference/patch-release-scenarios.md`):
- **Do NOT** manually modify `package.json` version — CI handles it.
- **Do NOT** manually create tags — CI handles them.
- Minor PR title format is strict (`🚀 release: v{x.y.z}`).
- Patch PRs do not need an explicit version number.
- Keep release facts accurate; do not invent metrics or availability statements. Release-note inputs (compare base, PR refs, contributor list) **must be derived from `git`** per `reference/release-notes-style.md` § Computing Inputs — never from memory or descriptions.
- **Weekly Release**: create `release/weekly-{YYYYMMDD}` from canary; use `git log main..canary` for release note inputs; title like `🚀 release: 20260222`
- **Bug Hotfix**: create `hotfix/` from main; use gitmoji prefix title (e.g. `🐛 fix: ...`)
- **New Model Launch**: community PRs trigger automatically via title prefix (`feat` / `style`)
- **DB Migration**: create `release/db-migration-{name}` from main; cherry-pick migration commits; include dedicated migration notes
### Hard Rules
- **Do NOT** manually modify `package.json` version
- **Do NOT** manually create tags
- Minor PR title format is strict
- Patch PRs do not need explicit version number
- Keep release facts accurate; do not invent metrics or availability statements
## GitHub Release Changelog Standard (Long-Form Style)
Use this section for writing **GitHub Release notes** (or release PR body when the PR body is intended to become release notes).\
Do not use this as `docs/changelog` page guidance.
### Positioning
This release-note style is:
1. **Data-backed at the top** (date, range, key metrics)
2. **Narrative first, then structured detail**
3. **Deep but scannable** (clear sectioning + compact bullets)
4. **Contributor-forward** (credits are part of the release story)
### Required Inputs Before Writing
Collect these inputs first:
1. Compare range (`<prev_tag>...<current_tag>`)
2. Release metrics (commits, merged PRs, resolved issues, contributors, optional files/insertions/deletions)
3. High-impact changes by domain (core loop, platform/gateway, UX, tooling, security, reliability)
4. Contributor list (with standout contributions if known)
5. Known risks / migrations / rollout notes (if any)
If metrics cannot be reliably computed, omit unknown numbers instead of guessing.
### Canonical Structure
Follow this section order unless the user asks otherwise:
1. `# 🚀 LobeHub v<x.y.z> (<YYYYMMDD>)`
2. Metadata lines:
- `Release Date`
- `Since <Previous Version>` metrics
3. One quoted release thesis (single paragraph, 1-2 lines)
4. `## ✨ Highlights` (6-12 bullets for major releases; 3-8 for weekly)
5. Domain blocks with optional `###` subsections:
- `## 🏗️ Core Agent & Architecture` (or equivalent product core)
- `## 📱 Platforms / Integrations`
- `## 🖥️ CLI & User Experience`
- `## 🔧 Tooling`
- `## 🔒 Security & Reliability`
- `## 📚 Documentation` (optional if meaningful)
6. `## 👥 Contributors`
7. `**Full Changelog**: <prev>...<current>`
Use `---` separators between major blocks for long releases.
### Writing Rules (Hard)
1. **No fabricated metrics**: all numbers must be traceable.
2. **No vague headline bullets**: each bullet must include capability + impact.
3. **No internal-only framing**: phrase from user/operator perspective.
4. **Security must be explicit** when security-sensitive fixes are present.
5. **PR/issue linkage**: use `(#1234)` when IDs are available.
6. **Terminology consistency**: same feature/provider name across sections.
7. **Do not bury migration or breaking changes**: elevate to dedicated section or callout.
### Style Rules (Long-Form)
1. Start with an "everyday use" framing, not implementation internals.
2. Mix narrative sentence + evidence bullets.
3. Keep bullets compact but informative:
- Good: `**Fast Mode (`/fast`)** — Priority routing for OpenAI and Anthropic, reducing latency on supported models. (#6875, #6960)`
4. Use bold only for capability names, not for whole sentences.
5. Keep heading depth <= 3 levels.
### Release Size Heuristics
- **Minor / major milestone release**
- Include full structure with multiple domain blocks.
- `Highlights` usually 8-12 bullets.
- **Weekly patch release**
- Keep full skeleton but reduce subsection count.
- `Highlights` usually 4-8 bullets.
- **DB migration release**
- Keep concise.
- Must include `Migration overview`, operator impact, and rollback/backup note.
### Contributor Ordering
Render contributors as a **single flat list** (no separate "Community" / "Core Team" subsections). Order: **community contributors first, team members after**. Within each group, sort by PR count desc. Bots (`@lobehubbot`, `renovate[bot]`) go on a separate "maintenance" line.
**LobeHub team roster** — anyone in this list is a team member; anyone not in this list is a community contributor:
- @arvinxx
- @Innei
- @tjx666 (commit author name: YuTengjing)
- @LiJian
- @Neko
- @Rdmclin2
- @AmAzing129
- @sudongyuer
- @rivertwilight
- @CanisMinor
> **Resolving handles** — git author names (e.g. `YuTengjing`) are not always the GitHub handle. Verify via `gh pr view <PR> --json author` or `gh api search/users -f q='<email>'` before listing.
If a new contributor appears who is not on this list, treat them as community by default and ask the user whether to add them to the roster.
### GitHub Release Changelog Template
```md
# 🚀 LobeHub v<x.y.z> (<YYYYMMDD>)
**Release Date:** <Month DD, YYYY>
**Since <Previous Version>:** <N merged PRs> · <N resolved issues> · <N contributors>
> <One release thesis sentence: what this release unlocks in practice.>
---
## ✨ Highlights
- **<Capability A>** — <What changed and why it matters>. (#1234)
- **<Capability B>** — <What changed and why it matters>. (#2345)
- **<Capability C>** — <What changed and why it matters>. (#3456)
---
## 🏗️ Core Product & Architecture
### <Subdomain>
- <Concrete change + impact>. (#...)
- <Concrete change + impact>. (#...)
---
## 📱 Platforms / Integrations
- <Platform update + impact>. (#...)
- <Compatibility/reliability fix + impact>. (#...)
---
## 🖥️ CLI & User Experience
- <User-facing workflow improvement>. (#...)
- <Quality-of-life fix>. (#...)
---
## 🔧 Tooling
- <Tool/runtime improvement>. (#...)
---
## 🔒 Security & Reliability
- **Security:** <hardening or vulnerability fix>. (#...)
- **Reliability:** <stability/performance behavior improvement>. (#...)
---
## 👥 Contributors
Huge thanks to **<N contributors>** who shipped **<N merged PRs>** this cycle.
@<community-handle> · @<community-handle> · @<team-handle> · @<team-handle>
Plus @lobehubbot and renovate[bot] for maintenance.
---
**Full Changelog**: <previous_tag>...<current_tag>
```
### Quick Checklist
- [ ] Uses top metadata and a clear release thesis
- [ ] Includes `Highlights` plus domain-grouped sections
- [ ] Every major bullet states both change and user/operator impact
- [ ] Security and reliability updates are explicitly surfaced (when present)
- [ ] Contributor credits and compare range are included
- [ ] All numbers and claims are verifiable
@@ -1,4 +1,4 @@
# 🚀 LobeHub Release (20260416)
# 🚀 LobeHub v2.1.50 (20260416)
**Release Date:** April 20, 2026\
**Migration Scope:** Agent benchmark data model bootstrap (5 new tables, 2 new indexes)
@@ -7,6 +7,14 @@
---
## ✨ Highlights
- **Benchmark Lifecycle Schema** — Added a relational model that tracks benchmark setup, runs, per-topic execution, and record outputs end-to-end.
- **Queryability Upgrade** — Added indexes for run status and benchmark-topic joins, improving operational queries in dashboard and debugging workflows.
- **Safer Operator Rollout** — Migration is startup-driven and backward-compatible with existing non-benchmark chat workflows.
---
## 🗄️ Migration Overview
Added tables:
@@ -1,4 +1,4 @@
# 🚀 LobeHub Release (20260427)
# 🚀 LobeHub v2.1.54 (20260427)
**Hotfix Scope:** Agent topic-switching regression — stale chat state on agent change
@@ -1,7 +1,7 @@
# 🚀 LobeHub Release (20260420)
# 🚀 LobeHub v2.1.50 (20260420)
**Release Date:** April 20, 2026\
**Since previous release:** 96 commits · 58 merged PRs · 31 resolved issues · 17 contributors
**Since v2026.04.13:** 96 commits · 58 merged PRs · 31 resolved issues · 17 contributors
> This weekly release focuses on reducing friction in everyday agent work: faster model routing, smoother gateway behavior, stronger task continuity, and clearer operator diagnostics when something goes wrong.
@@ -77,4 +77,4 @@
---
**Full Changelog**: <previous-tag>...<current-tag>
**Full Changelog**: v2026.04.13...v2026.04.20
@@ -1,47 +0,0 @@
# Minor Release Workflow
Used to publish a new minor version (e.g. `v2.2.0`), roughly every 4 weeks. The PR title carries the exact version number; CI parses it to drive the rest of the release.
## Steps
1. **Create a release branch from canary**
```bash
git checkout canary
git pull origin canary
git checkout -b release/v{version}
git push -u origin release/v{version}
```
2. **Determine the version number** — Read the current version from `package.json` and compute the next minor version (e.g. `2.1.x` → `2.2.0`).
3. **Create a PR to main**
```bash
gh pr create \
--title "🚀 release: v{version}" \
--base main \
--head release/v{version} \
--body-file release_body.md
```
> \[!IMPORTANT]
> The PR title must strictly match the `🚀 release: v{x.y.z}` format. CI uses a regex on this title to determine the exact version number.
4. **Write the PR body as release notes** — Follow `release-notes-style.md`. Compare base is the latest semver tag on main (`git describe --tags --abbrev=0 origin/main`).
5. **Automatic trigger after merge** — `auto-tag-release` detects the title format, uses the version number from the title, bumps `package.json`, tags `v{x.y.z}`, creates the GitHub Release, and dispatches `sync-main-to-canary`.
## Scripts
```bash
bun run release:branch # Interactive
bun run release:branch --minor # Directly specify minor
```
## Hard Rules (specific to Minor)
- PR title format is **strict**: `🚀 release: v{x.y.z}`. Any deviation falls through to patch detection.
- Do **NOT** manually modify `package.json` version — CI will bump it.
- Do **NOT** manually create the tag — CI will tag.
- Highlights bullet count is usually 812 (see `release-notes-style.md` size heuristics).
@@ -21,16 +21,12 @@ git push -u origin release/weekly-{YYYYMMDD}
2. **Scan changes and write changelog**
Compute the previous tag from main first — never reuse the last weekly's tag, since hotfixes published in between will be missed:
```bash
git fetch origin main canary --tags
PREV_TAG=$(git describe --tags --abbrev=0 origin/main --match 'v*.*.*' --exclude '*-canary*' --exclude '*-nightly*')
git log "$PREV_TAG..origin/release/weekly-{YYYYMMDD}" --oneline --no-merges
git diff "$PREV_TAG...origin/release/weekly-{YYYYMMDD}" --stat
git log main..canary --oneline
git diff main...canary --stat
```
Then follow `./release-notes-style.md` § **Computing Inputs (Hard Rules)** to derive PR refs, metrics, and contributors. Every `(#XXXX)` in the body must come from actual commit subjects in this range — never inferred from descriptions.
Write a user-facing changelog following the format in `patch-release-changelog-example.md`.
3. **Create PR to main** with the changelog as the PR body
@@ -1,316 +0,0 @@
# GitHub Release Changelog Standard (Long-Form Style)
Use this guide for **GitHub Release notes** — the body of a release PR that becomes the GitHub Release after merge. Do **not** use it for `docs/changelog/*.mdx` website pages (load `../../docs-changelog/SKILL.md` instead).
## Positioning
This release-note style is:
1. **Data-backed at the top** (date, range, key metrics)
2. **Narrative first, then structured detail**
3. **Deep but scannable** (clear sectioning + compact bullets)
4. **Contributor-forward** (credits are part of the release story)
## Required Inputs Before Writing
Collect these inputs first:
1. Compare range (`<prev_tag>...<current_tag>`)
2. Release metrics (commits, merged PRs, resolved issues, contributors, optional files/insertions/deletions)
3. High-impact changes by domain (core loop, platform/gateway, UX, tooling, security, reliability)
4. Contributor list (with standout contributions if known)
5. Known risks / migrations / rollout notes (if any)
If metrics cannot be reliably computed, omit unknown numbers instead of guessing.
## Computing Inputs (Hard Rules — Verify, Never Guess)
> Hallucinated PR numbers and wrong "Since v..." bases are the #1 failure mode of this skill. Every number and every `(#XXXX)` must come from `git`, never from memory or inference.
### 1. Compare base = latest semver tag on `main`
Do **not** eyeball the tag list or pick the "last weekly" PR. Compute it:
```bash
git fetch origin main canary --tags
PREV_TAG=$(git describe --tags --abbrev=0 origin/main --match 'v*.*.*' --exclude '*-canary*' --exclude '*-nightly*')
echo "$PREV_TAG"
```
Sanity check that the tag is reachable from the release branch:
```bash
git merge-base --is-ancestor "$PREV_TAG" origin/release/weekly-{YYYYMMDD} && echo OK
```
If the check fails, stop and ask the user — the release branch is based on the wrong source.
> **Why not "the last weekly release PR"?** Hotfixes (`v2.1.54`, `v2.1.55`, …) merge directly into main between weeklies. They get back-merged via `sync-main-to-canary`, so the latest semver tag on main _is_ the correct previous release for both weekly and minor flows. Picking the previous weekly's tag will silently undercount and put a stale version in "Since v…".
### 2. PR refs must come from commit subjects — never from descriptions
Compute the canonical set:
```bash
git log "$PREV_TAG..origin/release/weekly-{YYYYMMDD}" \
--pretty=format:'%s' --no-merges \
| grep -oE '\(#[0-9]+\)$' \
| sort -u > /tmp/release_prs.txt
```
Hard rules:
- Every `(#XXXX)` you write in the body **must** appear in `/tmp/release_prs.txt`. No exceptions.
- Never infer a PR number from a feature description. If you remember "the KB BM25 PR was around #14501", that memory is wrong about half the time. Look up the commit hash by feature keyword and read its actual subject.
- If your terminal truncates long subjects (any wrapper that compresses output, e.g. `rtk`), bypass it. With `rtk` use `rtk proxy git log …`. Verify with `wc -l /tmp/release_prs.txt` — the count must match `git log $PREV_TAG..HEAD --no-merges --pretty=format:'%h' | wc -l` minus the few commits without a PR ref. A mismatch of >5% means subjects are being silently truncated.
### 3. Metrics must come from git counts
```bash
PR_COUNT=$(wc -l < /tmp/release_prs.txt | tr -d ' ')
COMMIT_COUNT=$(git log "$PREV_TAG..origin/release/weekly-{YYYYMMDD}" --no-merges --pretty=format:'%h' | wc -l | tr -d ' ')
CONTRIBUTOR_COUNT=$(git log "$PREV_TAG..origin/release/weekly-{YYYYMMDD}" --no-merges --pretty=format:'%an' \
| sort -u \
| grep -viE '^(lobehubbot|LobeHub Bot|renovate\[bot\])$' \
| wc -l | tr -d ' ')
```
If a number cannot be confidently derived, omit it — never guess.
### 4. Author-to-handle resolution
Git `%an` is the commit author display name, not the GitHub handle. For each author you mention, confirm the handle:
```bash
gh pr view "$PR_NUMBER" --repo lobehub/lobe-chat --json author --jq '.author.login'
```
Use the result for `@handle`. Then classify each author per the `LobeHub team roster` below; community first, team after.
### 5. Pre-publish verification (mandatory)
Before `gh pr create` / `gh pr edit --body-file`, diff body PR refs against the canonical set:
```bash
grep -oE '#[0-9]+' release_body.md | sort -u > /tmp/body_prs.txt
sed 's/[()]//g' /tmp/release_prs.txt > /tmp/release_prs_clean.txt
echo "=== In body but NOT in actual range (must be EMPTY) ==="
comm -23 /tmp/body_prs.txt /tmp/release_prs_clean.txt
```
Empty diff = OK. Any output = the body cites a PR that wasn't merged in this range. Stop and fix before publishing.
Also verify the metrics line in the body matches the computed values (`PR_COUNT`, `CONTRIBUTOR_COUNT`) and that `**Full Changelog**` uses `$PREV_TAG`, not some older tag.
## Canonical Structure (Long-Form: Minor / Weekly)
Follow this section order for **Minor** and **Weekly** releases unless the user asks otherwise. For **Hotfix** and **DB Migration**, see § Variants for Shorter Releases below — the canonical structure does not apply.
1. `# 🚀 LobeHub Release (<YYYYMMDD>)`
2. Metadata lines:
- `Release Date`
- `Since <Previous Version>` metrics
3. One quoted release thesis (single paragraph, 1-2 lines)
4. `## ✨ Highlights` (6-12 bullets for major releases; 3-8 for weekly)
5. Domain blocks with optional `###` subsections:
- `## 🏗️ Core Agent & Architecture` (or equivalent product core)
- `## 📱 Platforms / Integrations`
- `## 🖥️ CLI & User Experience`
- `## 🔧 Tooling`
- `## 🔒 Security & Reliability`
- `## 📚 Documentation` (optional if meaningful)
6. `## 👥 Contributors`
7. `**Full Changelog**: <prev>...<current>`
Use `---` separators between major blocks for long releases.
## Variants for Shorter Releases
The Canonical Structure above is for **long-form** (Minor / Weekly). Two short-form variants override it.
### Hotfix Variant
A hotfix targets one regression and ships fast. The body is short and operator-focused — no Highlights, no domain blocks, no Contributors line.
Required sections, in order:
1. `# 🚀 LobeHub Release (<YYYYMMDD>)`
2. `**Hotfix Scope:**` — one line summarizing the regression scope (e.g. `Agent topic-switching regression — stale chat state on agent change`). Replaces the long-form `Release Date` / `Since vX.Y.Z` metrics.
3. One quoted thesis (single paragraph, 1-2 lines) describing what is now restored.
4. `## 🐛 What's Fixed` — 1-3 bullets, each `**<symptom>** — <fix in one sentence>. (#PR)`. No root-cause prose; that lives in the commit message.
5. `## ⚙️ Upgrade` — short notes for self-hosted (pull image / restart, schema or env changes) and cloud (usually "applied automatically").
6. `## 👥 Owner` — single `@handle` for the PR author, resolved via `gh pr view "$PR" --json author --jq '.author.login'`. Never hardcoded.
Hard rules specific to hotfix:
- **No Highlights / domain blocks / Contributors / Full Changelog** — these add noise to a one-shot fix.
- **No metric line** — `Since vX.Y.Z` doesn't apply; the body cites the single PR (or 1-3 PRs) directly.
- **Owner ≠ Contributors** — one author, listed under § Owner. Not a flat handle list.
- See `changelog-example/hotfix.md` for the canonical template.
### DB Migration Variant
Database schema changes that need to be released independently. Operator impact is the headline.
Required sections, in order:
1. `# 🚀 LobeHub Release (<YYYYMMDD>)` + scope line
2. **Migration overview** — what tables / columns are added, modified, or removed
3. **Operator impact** — backwards-compatible? required actions for self-hosted?
4. **Rollback / backup note** — how to recover
5. `## 👥 Owner` — single PR author, resolved via `gh pr view`
See `changelog-example/db-migration.md` for the canonical template.
## Writing Rules (Hard)
1. **No fabricated metrics**: all numbers must be traceable.
2. **No vague headline bullets**: each bullet must include capability + impact.
3. **No internal-only framing**: phrase from user/operator perspective.
4. **Security must be explicit** when security-sensitive fixes are present.
5. **PR/issue linkage**: use `(#1234)` when IDs are available.
6. **Terminology consistency**: same feature/provider name across sections.
7. **Do not bury migration or breaking changes**: elevate to dedicated section or callout.
## Style Rules (Long-Form)
1. Start with an "everyday use" framing, not implementation internals.
2. Mix narrative sentence + evidence bullets.
3. Keep bullets compact but informative:
- Good: `**Fast Mode (`/fast`)** — Priority routing for OpenAI and Anthropic, reducing latency on supported models. (#6875, #6960)`
4. Use bold only for capability names, not for whole sentences.
5. Keep heading depth ≤ 3 levels.
## Release Size Heuristics
- **Minor / major milestone release**
- Long-form structure with multiple domain blocks.
- `Highlights` usually 8-12 bullets.
- **Weekly patch release**
- Long-form skeleton with reduced subsection count.
- `Highlights` usually 4-8 bullets.
- **Hotfix release**
- Short-form (see § Variants → Hotfix). No Highlights, no domain blocks, no Contributors.
- 1-3 fix bullets. Body should fit on one screen.
- **DB migration release**
- Short-form (see § Variants → DB Migration).
- Must include `Migration overview`, operator impact, and rollback/backup note.
## Contributor Ordering
Render contributors as a **single flat list** (no separate "Community" / "Core Team" subsections). Order: **community contributors first, team members after**. Within each group, sort by PR count desc. Bots (`@lobehubbot`, `renovate[bot]`) go on a separate "maintenance" line.
**LobeHub team roster** — anyone in this list is a team member; anyone not in this list is a community contributor:
- @arvinxx
- @Innei
- @tjx666 (commit author name: YuTengjing)
- @LiJian
- @Neko
- @Rdmclin2
- @AmAzing129
- @sudongyuer (commit author name: Tsuki)
- @rivertwilight (commit author name: René Wang)
- @CanisMinor
- @cy948 (commit author name: Rylan Cai)
> **Resolving handles** — git author names (e.g. `YuTengjing`) are not always the GitHub handle. Verify via `gh pr view "$PR" --json author` or `gh api search/users -f q='<email>'` before listing.
If a new contributor appears who is not on this list, treat them as community by default and ask the user whether to add them to the roster.
## Template
```md
# 🚀 LobeHub Release (<YYYYMMDD>)
**Release Date:** <Month DD, YYYY>
**Since <Previous Version>:** <N merged PRs> · <N resolved issues> · <N contributors>
> <One release thesis sentence: what this release unlocks in practice.>
---
## ✨ Highlights
- **<Capability A>** — <What changed and why it matters>. (#1234)
- **<Capability B>** — <What changed and why it matters>. (#2345)
- **<Capability C>** — <What changed and why it matters>. (#3456)
---
## 🏗️ Core Product & Architecture
### <Subdomain>
- <Concrete change + impact>. (#...)
- <Concrete change + impact>. (#...)
---
## 📱 Platforms / Integrations
- <Platform update + impact>. (#...)
- <Compatibility/reliability fix + impact>. (#...)
---
## 🖥️ CLI & User Experience
- <User-facing workflow improvement>. (#...)
- <Quality-of-life fix>. (#...)
---
## 🔧 Tooling
- <Tool/runtime improvement>. (#...)
---
## 🔒 Security & Reliability
- **Security:** <hardening or vulnerability fix>. (#...)
- **Reliability:** <stability/performance behavior improvement>. (#...)
---
## 👥 Contributors
Huge thanks to **<N contributors>** who shipped **<N merged PRs>** this cycle.
@<community-handle> · @<community-handle> · @<team-handle> · @<team-handle>
Plus @lobehubbot and renovate[bot] for maintenance.
---
**Full Changelog**: <previous_tag>...<current_tag>
```
## Quick Checklist
### Long-Form (Minor / Weekly)
- [ ] `PREV_TAG` is `git describe --tags --abbrev=0 origin/main` (latest semver), not the last weekly's tag
- [ ] Every `(#XXXX)` in the body appears in `/tmp/release_prs.txt` (verified via `comm -23`)
- [ ] `Since v…` line uses `$PREV_TAG`; PR / contributor counts match `wc -l` on the computed sets
- [ ] `**Full Changelog**` uses `$PREV_TAG...release/weekly-<YYYYMMDD>` (or `…v{x.y.z}` for minor)
- [ ] Author handles resolved via `gh pr view --json author`, not assumed from `%an`
- [ ] Uses top metadata and a clear release thesis
- [ ] Includes `Highlights` plus domain-grouped sections
- [ ] Every major bullet states both change and user/operator impact
- [ ] Security and reliability updates are explicitly surfaced (when present)
- [ ] Contributor credits and compare range are included
- [ ] All numbers and claims are verifiable
### Hotfix
- [ ] `**Hotfix Scope:**` line replaces metrics line
- [ ] Single quoted thesis describes what is restored (operator-facing, not internal)
- [ ] `## 🐛 What's Fixed` has 1-3 bullets, each `**<symptom>** — <fix>. (#PR)` with PR ref verified to exist and be merged
- [ ] `## ⚙️ Upgrade` notes self-hosted action and cloud auto-apply
- [ ] `## 👥 Owner` is a single `@handle` resolved via `gh pr view "$PR" --json author`
- [ ] No Highlights / domain blocks / Contributors / Full Changelog included
-55
View File
@@ -174,64 +174,9 @@ export const chatGroupAction: StateCreator<
- `ChatGroupStoreWithRefresh` for member refresh
- `ChatGroupStoreWithInternal` for curd `internal_dispatchChatGroup`
### Slices That Don't Currently Need `set`
When a slice doesn't write local state at the moment — e.g. it reads context
from `#get()` and forwards calls to another store, or just runs hooks — drop
the `#set` field. Otherwise ESLint's `no-unused-vars` flags the unused private
field.
Mark the constructor's `set` param as `_set` and `void _set` it to keep the
`(set, get, api)` shape aligned with `StateCreator`. This is **a snapshot of
the current need, not a permanent contract** — if a later change needs `set`,
restore the `#set` field and use it; do not invent a workaround to keep the
"unused" form.
```ts
type Setter = StoreSetter<ConversationStore>;
export const toolSlice = (set: Setter, get: () => ConversationStore, _api?: unknown) =>
new ToolActionImpl(set, get, _api);
export class ToolActionImpl {
readonly #get: () => ConversationStore;
// Mark unused params with `_` prefix and `void _x` so the constructor still
// matches StateCreator's `(set, get, api)` shape without triggering unused
// diagnostics.
constructor(_set: Setter, get: () => ConversationStore, _api?: unknown) {
void _set;
void _api;
this.#get = get;
}
approveToolCall = async (id: string) => {
const { context, hooks } = this.#get();
await useChatStore.getState().approveToolCalling(id, '', context);
hooks.onToolCallComplete?.(id, undefined);
};
}
export type ToolAction = Pick<ToolActionImpl, keyof ToolActionImpl>;
```
Rules of thumb:
- If a slice doesn't currently call `set`, drop `#set` (use `_set` + `void _set`
in the constructor). When a later edit needs `set`, restore `#set` and use it.
- Don't add `setNamespace` for slices that don't write state. Add it when the
slice starts writing state.
- Never leave `#set` declared but unused "for future use" — lint will fail and
re-adding it later costs nothing.
### Do / Don't
- **Do**: keep constructor signature aligned with `StateCreator` params `(set, get, api)`.
- **Do**: use `#private` to avoid `set/get` being exposed.
- **Do**: use `flattenActions` instead of spreading class instances.
- **Do**: drop `#set` (and use `_set` + `void _set` in the constructor) for
delegate-only slices that never write state — keeps lint green without
breaking the `(set, get, api)` shape.
- **Don't**: keep both old slice objects and class actions active at the same time.
- **Don't**: keep an unused `#set` field "for future use" — it fails ESLint and
re-adding it later costs nothing.
+11 -20
View File
@@ -56,6 +56,7 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# add your custom model name, multi model separate by comma. for example gpt-3.5-1106,gpt-4-1106
# OPENAI_MODEL_LIST=gpt-3.5-turbo
# ## Azure OpenAI ###
# you can learn azure OpenAI Service on https://learn.microsoft.com/en-us/azure/ai-services/openai/overview
@@ -70,6 +71,7 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# Azure's API version, follows the YYYY-MM-DD format
# AZURE_API_VERSION=2024-10-21
# ## Anthropic Service ####
# ANTHROPIC_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -77,16 +79,19 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# use a proxy to connect to the Anthropic API
# ANTHROPIC_PROXY_URL=https://api.anthropic.com
# ## Google AI ####
# GOOGLE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# ## AWS Bedrock ###
# AWS_REGION=us-east-1
# AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxx
# AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# ## Ollama AI ####
# You can use ollama to get and run LLM locally, learn more about it via https://github.com/ollama/ollama
@@ -96,11 +101,13 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# OLLAMA_MODEL_LIST=your_ollama_model_names
# ## OpenRouter Service ###
# OPENROUTER_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# OPENROUTER_MODEL_LIST=model1,model2,model3
# ## Mistral AI ###
# MISTRAL_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -161,6 +168,7 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# SILICONCLOUD_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# ## TencentCloud AI ####
# TENCENT_CLOUD_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -173,6 +181,7 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# INFINIAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# ## 302.AI ###
# AI302_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -213,6 +222,7 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# VERCELAIGATEWAY_API_KEY=your_vercel_ai_gateway_api_key
# #######################################
# ########### Market Service ############
# #######################################
@@ -273,6 +283,7 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# but some service providers may require configuration
# S3_REGION=us-west-1
# #######################################
# ########### Auth Service ##############
# #######################################
@@ -413,23 +424,3 @@ OPENAI_API_KEY=sk-xxxxxxxxx
# MESSAGE_GATEWAY_ENABLED=1
# MESSAGE_GATEWAY_URL=https://message-gateway.lobehub.com
# MESSAGE_GATEWAY_SERVICE_TOKEN=your_service_token_here
# #######################################
# ########### Messenger Bot #############
# #######################################
# LobeHub-operated bots that users link their account to once and then chat
# with any of their agents from. Credentials (Telegram / Slack / Discord) are
# now managed in dc-center → Agent → System Bots and stored in the
# `system_bot_providers` table. See docs/development/messenger/managed-by-dc-center.md.
#
# Webhook URLs are registered against APP_URL:
# Telegram: <APP_URL>/api/agent/messenger/webhooks/telegram
# Slack: <APP_URL>/api/agent/messenger/webhooks/slack
# Discord: <APP_URL>/api/agent/messenger/webhooks/discord
#
# For local dev with bot platforms, point APP_URL at your tunnel
# (ngrok / cloudflared) so platforms can reach your machine.
# Verify-im link token TTL in seconds (default 1800 = 30 min)
# LOBE_LINK_TOKEN_TTL_SECONDS=1800
+1 -1
View File
@@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
name: Test Packages
env:
PACKAGES: '@lobechat/file-loaders @lobechat/prompts @lobechat/model-runtime @lobechat/web-crawler @lobechat/electron-server-ipc @lobechat/utils @lobechat/python-interpreter @lobechat/context-engine @lobechat/agent-runtime @lobechat/conversation-flow @lobechat/ssrf-safe-fetch @lobechat/memory-user-memory @lobechat/types @lobechat/builtin-tool-lobe-agent model-bank'
PACKAGES: '@lobechat/file-loaders @lobechat/prompts @lobechat/model-runtime @lobechat/web-crawler @lobechat/electron-server-ipc @lobechat/utils @lobechat/python-interpreter @lobechat/context-engine @lobechat/agent-runtime @lobechat/conversation-flow @lobechat/ssrf-safe-fetch @lobechat/memory-user-memory model-bank'
steps:
- uses: actions/checkout@v6
-3
View File
@@ -148,6 +148,3 @@ apps/desktop/resources/cli-package.json
.superpowers/
docs/superpowers/
.heerogeneous-tracing
# Kagura agent runtime
.kagura/
-25
View File
@@ -2,31 +2,6 @@
# Changelog
### [Version 2.1.56](https://github.com/lobehub/lobe-chat/compare/v2.1.55...v2.1.56)
<sup>Released on **2026-05-01**</sup>
#### 👷 Build System
- **database**: add `metadata` and `trigger` to `briefs` table.
<br/>
<details>
<summary><kbd>Improvements and Fixes</kbd></summary>
#### Build System
- **database**: add `metadata` and `trigger` to `briefs` table, closes [#14354](https://github.com/lobehub/lobe-chat/issues/14354) ([86a23b5](https://github.com/lobehub/lobe-chat/commit/86a23b5))
</details>
<div align="right">
[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
</div>
### [Version 2.1.55](https://github.com/lobehub/lobe-chat/compare/v2.1.54...v2.1.55)
<sup>Released on **2026-04-29**</sup>
+1 -1
View File
@@ -89,7 +89,7 @@ RUN set -e && \
pnpm i && \
mkdir -p /deps && \
cd /deps && \
echo '{"name":"deps","private":true}' > package.json && \
pnpm init && \
pnpm add pg drizzle-orm
COPY . .
+1 -4
View File
@@ -1,6 +1,6 @@
.\" Code generated by `npm run man:generate`; DO NOT EDIT.
.\" Manual command details come from the Commander command tree.
.TH LH 1 "" "@lobehub/cli 0.0.14" "User Commands"
.TH LH 1 "" "@lobehub/cli 0.0.8" "User Commands"
.SH NAME
lh \- LobeHub CLI \- manage and connect to LobeHub services
.SH SYNOPSIS
@@ -77,9 +77,6 @@ Generate content (text, image, video, speech) Alias: gen.
.B file
Manage files
.TP
.B hetero
Run heterogeneous agent CLIs (Claude Code / Codex) and stream their output
.TP
.B skill
Manage agent skills
.TP
+1 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@lobehub/cli",
"version": "0.0.14",
"version": "0.0.8",
"type": "module",
"bin": {
"lh": "./dist/index.js",
@@ -30,7 +30,6 @@
"devDependencies": {
"@lobechat/agent-gateway-client": "workspace:*",
"@lobechat/device-gateway-client": "workspace:*",
"@lobechat/heterogeneous-agents": "workspace:*",
"@lobechat/local-file-shell": "workspace:*",
"@trpc/client": "^11.8.1",
"@types/node": "^22.13.5",
-4
View File
@@ -1,10 +1,6 @@
packages:
- '../../packages/agent-gateway-client'
- '../../packages/device-gateway-client'
- '../../packages/heterogeneous-agents'
- '../../packages/local-file-shell'
- '../../packages/types'
- '../../packages/model-bank'
- '../../packages/business/const'
- '../../packages/file-loaders'
- '.'
-344
View File
@@ -1,344 +0,0 @@
import { PassThrough } from 'node:stream';
import { Command } from 'commander';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { registerHeteroCommand } from './hetero';
const { mockSpawnAgent } = vi.hoisted(() => ({
mockSpawnAgent: vi.fn(),
}));
vi.mock('@lobechat/heterogeneous-agents/spawn', () => ({
spawnAgent: mockSpawnAgent,
}));
vi.mock('../utils/logger', () => ({
log: { debug: vi.fn(), error: vi.fn(), info: vi.fn(), warn: vi.fn() },
setVerbose: vi.fn(),
}));
/**
* Build a Promise resolving to a fake `SpawnAgentHandle`. `spawnAgent` itself
* is async, so test mocks return the handle wrapped — same iterable contract,
* just behind one microtask. The async iterable yields `events` synchronously
* and ends, so the command's `for await (const event of ...)` loop terminates
* without hanging the test.
*/
const createFakeHandle = ({
events = [] as any[],
exitCode = 0,
signal = null as NodeJS.Signals | null,
stderrChunks = [] as string[],
}: {
events?: any[];
exitCode?: number | null;
signal?: NodeJS.Signals | null;
stderrChunks?: string[];
} = {}) => {
const stderr = new PassThrough();
setImmediate(() => {
for (const c of stderrChunks) stderr.write(c);
stderr.end();
});
const eventsIter: AsyncIterable<any> = {
[Symbol.asyncIterator]() {
let i = 0;
return {
async next() {
if (i < events.length) return { done: false, value: events[i++] };
return { done: true, value: undefined };
},
};
},
};
return Promise.resolve({
events: eventsIter,
exit: Promise.resolve({ code: exitCode, signal }),
kill: vi.fn(),
pid: 12_345,
stderr,
});
};
describe('hetero exec command', () => {
let exitSpy: ReturnType<typeof vi.spyOn>;
let stdoutSpy: ReturnType<typeof vi.spyOn>;
beforeEach(() => {
// Stub `process.exit` so the test runner doesn't tear down — but THROW a
// sentinel rather than return, mirroring `process.exit`'s `never` return
// type in production. Without throwing, the command's code after an
// `exit(2)` keeps running and crashes on `handle.stderr` (no spawn mock).
exitSpy = vi.spyOn(process, 'exit').mockImplementation(((code?: number) => {
throw new Error(`__exit__${code}`);
}) as any);
stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
mockSpawnAgent.mockReset();
});
afterEach(() => {
exitSpy.mockRestore();
stdoutSpy.mockRestore();
vi.restoreAllMocks();
});
/** Build a fresh program with the hetero command registered. */
const buildProgram = () => {
const program = new Command();
program.exitOverride();
registerHeteroCommand(program);
return program;
};
/**
* Run the parsed command. Swallows our `__exit__<code>` sentinel so tests
* can inspect `exitSpy.mock.calls` afterwards instead of having to wrap
* every `parseAsync` in `expect(...).rejects`. Real production exits stay
* `process.exit` so this only affects the test path.
*/
const runCmd = async (argv: string[]) => {
try {
await buildProgram().parseAsync(argv, { from: 'user' });
} catch (err) {
if (err instanceof Error && err.message.startsWith('__exit__')) return;
throw err;
}
};
it('rejects unsupported agent types via process.exit(2)', async () => {
await runCmd(['hetero', 'exec', '--type', 'kimi-cli', '--prompt', 'hi']);
expect(exitSpy).toHaveBeenCalledWith(2);
expect(mockSpawnAgent).not.toHaveBeenCalled();
});
it('rejects empty prompts via process.exit(2)', async () => {
await runCmd(['hetero', 'exec', '--type', 'claude-code', '--prompt', ' ']);
expect(exitSpy).toHaveBeenCalledWith(2);
expect(mockSpawnAgent).not.toHaveBeenCalled();
});
it('passes --type / --prompt / --resume / --cwd / --command through to spawnAgent', async () => {
mockSpawnAgent.mockReturnValue(createFakeHandle());
await runCmd([
'hetero',
'exec',
'--type',
'codex',
'--prompt',
'do thing',
'--resume',
'thread_abc',
'--cwd',
'/tmp/work',
'--command',
'/usr/local/bin/codex',
]);
expect(mockSpawnAgent).toHaveBeenCalledTimes(1);
const call = mockSpawnAgent.mock.calls[0][0];
expect(call).toMatchObject({
agentType: 'codex',
command: '/usr/local/bin/codex',
cwd: '/tmp/work',
prompt: 'do thing',
resumeSessionId: 'thread_abc',
});
// operationId auto-generated when omitted (uuid v4 shape)
expect(call.operationId).toMatch(/^[0-9a-f-]{36}$/i);
});
it('uses the provided --operation-id verbatim', async () => {
mockSpawnAgent.mockReturnValue(createFakeHandle());
await runCmd([
'hetero',
'exec',
'--type',
'claude-code',
'--prompt',
'hi',
'--operation-id',
'op-server-allocated',
]);
const call = mockSpawnAgent.mock.calls[0][0];
expect(call.operationId).toBe('op-server-allocated');
});
it('streams events to stdout as JSONL, one line per event', async () => {
const events = [
{ data: { foo: 1 }, operationId: 'op-1', stepIndex: 0, timestamp: 1, type: 'stream_start' },
{
data: { chunkType: 'text', content: 'hi' },
operationId: 'op-1',
stepIndex: 0,
timestamp: 2,
type: 'stream_chunk',
},
];
mockSpawnAgent.mockReturnValue(createFakeHandle({ events }));
await runCmd([
'hetero',
'exec',
'--type',
'claude-code',
'--prompt',
'hi',
'--operation-id',
'op-1',
]);
// Each event is one JSON line with a trailing \n.
const lines = stdoutSpy.mock.calls.map((c) => c[0]).filter((s) => typeof s === 'string');
expect(lines).toHaveLength(2);
for (const line of lines as string[]) {
expect(line.endsWith('\n')).toBe(true);
const parsed = JSON.parse(line);
expect(parsed.operationId).toBe('op-1');
}
});
it('passes the child exit code straight through', async () => {
mockSpawnAgent.mockReturnValue(createFakeHandle({ exitCode: 7 }));
await runCmd(['hetero', 'exec', '--type', 'claude-code', '--prompt', 'hi']);
expect(exitSpy).toHaveBeenCalledWith(7);
});
it('maps SIGINT (code === null) to POSIX exit code 130', async () => {
mockSpawnAgent.mockReturnValue(createFakeHandle({ exitCode: null, signal: 'SIGINT' }));
await runCmd(['hetero', 'exec', '--type', 'claude-code', '--prompt', 'hi']);
expect(exitSpy).toHaveBeenCalledWith(130);
});
it('combines --prompt + --image into mixed content blocks', async () => {
mockSpawnAgent.mockReturnValue(createFakeHandle());
await runCmd([
'hetero',
'exec',
'--type',
'claude-code',
'--prompt',
'describe',
'--image',
'./fixture-a.png',
'--image',
'https://cdn.example/fixture-b.png',
]);
const call = mockSpawnAgent.mock.calls[0][0];
expect(Array.isArray(call.prompt)).toBe(true);
expect(call.prompt).toEqual([
{ text: 'describe', type: 'text' },
// Path is resolved against process.cwd() — match by suffix to be CI-portable.
{
source: expect.objectContaining({ type: 'path' }),
type: 'image',
},
{
source: { type: 'url', url: 'https://cdn.example/fixture-b.png' },
type: 'image',
},
]);
expect(call.prompt[1].source.path).toMatch(/fixture-a\.png$/);
});
it('parses a data: URL --image into a base64 source', async () => {
mockSpawnAgent.mockReturnValue(createFakeHandle());
const dataUrl = `data:image/png;base64,${Buffer.from([0x89, 0x50, 0x4e, 0x47]).toString('base64')}`;
await runCmd([
'hetero',
'exec',
'--type',
'claude-code',
'--prompt',
'see',
'--image',
dataUrl,
]);
const call = mockSpawnAgent.mock.calls[0][0];
expect(call.prompt[1]).toEqual({
source: {
data: Buffer.from([0x89, 0x50, 0x4e, 0x47]).toString('base64'),
mediaType: 'image/png',
type: 'base64',
},
type: 'image',
});
});
it('reads multimodal content from --input-json <file>', async () => {
const { mkdtemp, writeFile, rm } = await import('node:fs/promises');
const { tmpdir } = await import('node:os');
const path = await import('node:path');
const dir = await mkdtemp(`${tmpdir()}/hetero-input-json-`);
const file = path.join(dir, 'input.json');
await writeFile(
file,
JSON.stringify([
{ text: 'analyze', type: 'text' },
{ source: { type: 'url', url: 'https://x/y.png' }, type: 'image' },
]),
);
mockSpawnAgent.mockReturnValue(createFakeHandle());
try {
await runCmd(['hetero', 'exec', '--type', 'claude-code', '--input-json', file]);
} finally {
await rm(dir, { force: true, recursive: true });
}
const call = mockSpawnAgent.mock.calls[0][0];
expect(call.prompt).toEqual([
{ text: 'analyze', type: 'text' },
{ source: { type: 'url', url: 'https://x/y.png' }, type: 'image' },
]);
});
it('reports spawnAgent rejections (e.g. missing --image path) as a clean error + exit(1)', async () => {
// spawnAgent is now async and can reject during image normalization —
// missing local --image paths, fetch failures, etc. The CLI must catch
// these and exit with a friendly message instead of crashing on an
// unhandled rejection.
mockSpawnAgent.mockReturnValue(
Promise.reject(new Error('ENOENT: no such file or directory, open /missing.png')),
);
await runCmd([
'hetero',
'exec',
'--type',
'claude-code',
'--prompt',
'see',
'--image',
'/missing.png',
]);
expect(exitSpy).toHaveBeenCalledWith(1);
});
it('rejects --prompt + --input-json (mutually exclusive)', async () => {
await runCmd([
'hetero',
'exec',
'--type',
'claude-code',
'--prompt',
'hi',
'--input-json',
'/tmp/bogus.json',
]);
expect(exitSpy).toHaveBeenCalledWith(2);
expect(mockSpawnAgent).not.toHaveBeenCalled();
});
});
-380
View File
@@ -1,380 +0,0 @@
import { randomUUID } from 'node:crypto';
import { readFile } from 'node:fs/promises';
import path from 'node:path';
import type {
AgentContentBlock,
AgentImageSource,
AgentPromptInput,
} from '@lobechat/heterogeneous-agents/spawn';
import { spawnAgent } from '@lobechat/heterogeneous-agents/spawn';
import type { Command } from 'commander';
import { getTrpcClient } from '../api/client';
import { BatchIngester, NoopIngestSink } from '../utils/BatchIngester';
import { log } from '../utils/logger';
import { TrpcIngestSink } from '../utils/TrpcIngestSink';
const SUPPORTED_AGENT_TYPES = new Set(['claude-code', 'codex']);
interface ExecOptions {
command?: string;
cwd?: string;
image?: string[];
inputJson?: string;
operationId?: string;
prompt?: string;
/**
* Output rendering mode.
* jsonl — emit each `AgentStreamEvent` as a JSONL line on stdout (default
* when no --topic is set, or when explicitly requested).
* none — suppress JSONL stdout; only server-ingest mode is active.
* Default when --topic is set and running non-interactively.
*/
render?: 'jsonl' | 'none';
resume?: string;
/**
* Server topic id. When set, enables server-ingest mode: events are
* batch-POSTed to `aiAgent.heteroIngest` in addition to (or instead of)
* being written to stdout. Requires `--operation-id` to be a valid
* server-allocated operation id.
*/
topic?: string;
type: string;
}
const collectImage = (value: string, previous: string[] = []): string[] => [...previous, value];
const readStdin = async (): Promise<string> => {
const chunks: Buffer[] = [];
for await (const chunk of process.stdin) {
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : (chunk as Buffer));
}
return Buffer.concat(chunks).toString('utf8');
};
/**
* Resolve a raw `--input-json` argument: `'-'` (or empty) reads stdin, anything
* else is treated as a filesystem path.
*/
const readInputJson = async (location: string): Promise<string> => {
if (location === '-' || location === '') return readStdin();
return readFile(location, 'utf8');
};
const looksLikeJsonInput = (value: string): boolean => {
const trimmed = value.trimStart();
return trimmed.startsWith('{') || trimmed.startsWith('[');
};
/**
* Convert an `--image <value>` argument into an image source. Recognized
* shapes: `https?://...` URL, `data:` URL, otherwise a filesystem path
* resolved relative to the CLI's cwd.
*/
const parseImageArg = (value: string): AgentImageSource => {
if (/^https?:\/\//i.test(value)) return { type: 'url', url: value };
if (value.startsWith('data:')) {
const match = value.match(/^data:([^;,]+);base64,(.+)$/);
if (!match) {
throw new Error(`Invalid data URL for --image: ${value.slice(0, 40)}`);
}
return { data: match[2]!, mediaType: match[1]!, type: 'base64' };
}
return { path: path.resolve(process.cwd(), value), type: 'path' };
};
/**
* Best-effort coercion of a JSON-decoded value into an `AgentPromptInput`.
* Accepts:
* - `'plain text'` → single text block
* - `[{ type: 'text', text }, { type: 'image', source }]` → content blocks
* - `{ content: [...] }` (Anthropic message shape) → unwraps `content`
* - `{ type: 'text', ... } | { type: 'image', ... }` → single block
*/
const coerceJsonPrompt = (parsed: unknown): AgentPromptInput => {
if (typeof parsed === 'string') return parsed;
if (Array.isArray(parsed)) return parsed as AgentContentBlock[];
if (parsed && typeof parsed === 'object') {
const obj = parsed as Record<string, unknown>;
if (Array.isArray(obj.content)) return obj.content as AgentContentBlock[];
if (obj.type === 'text' || obj.type === 'image') return [obj as AgentContentBlock];
}
throw new Error(
'Invalid --input-json shape: expected a string, array of content blocks, ' +
'or `{ content: [...] }` envelope.',
);
};
interface ResolvedPrompt {
/** Human-readable description for the empty-input check. */
describe: () => string;
prompt: AgentPromptInput;
}
const buildPromptFromText = (text: string, images: string[]): ResolvedPrompt => {
if (images.length === 0) {
return { describe: () => text.trim(), prompt: text };
}
const blocks: AgentContentBlock[] = [];
if (text.length > 0) blocks.push({ text, type: 'text' });
for (const image of images) {
blocks.push({ source: parseImageArg(image), type: 'image' });
}
return {
describe: () =>
blocks
.map((b) => (b.type === 'text' ? b.text.trim() : '[image]'))
.filter(Boolean)
.join(' ')
.trim(),
prompt: blocks,
};
};
/**
* Decide which input mode the user requested and produce a unified prompt.
*
* Mode resolution (mutually exclusive):
* 1. `--input-json` → read JSON file or stdin, parse to content blocks
* 2. `--prompt` (with optional `--image` flags) → text + images
* 3. (default) read stdin: auto-detect JSON vs plain text by first char
*/
const resolvePrompt = async (options: ExecOptions): Promise<ResolvedPrompt> => {
const images = options.image ?? [];
if (options.inputJson !== undefined) {
if (options.prompt !== undefined) {
throw new Error('--prompt and --input-json are mutually exclusive.');
}
if (images.length > 0) {
throw new Error('--image cannot be combined with --input-json (put images in the JSON).');
}
const raw = await readInputJson(options.inputJson);
return { describe: () => raw.trim(), prompt: coerceJsonPrompt(JSON.parse(raw)) };
}
if (options.prompt !== undefined && options.prompt !== '-') {
return buildPromptFromText(options.prompt, images);
}
// No --prompt or --prompt -: read stdin and auto-detect.
const raw = await readStdin();
if (looksLikeJsonInput(raw)) {
return { describe: () => raw.trim(), prompt: coerceJsonPrompt(JSON.parse(raw)) };
}
return buildPromptFromText(raw, images);
};
const exec = async (options: ExecOptions): Promise<void> => {
if (!SUPPORTED_AGENT_TYPES.has(options.type)) {
log.error(
`Unsupported --type "${options.type}". Supported: ${[...SUPPORTED_AGENT_TYPES].join(', ')}`,
);
process.exit(2);
}
let resolved: ResolvedPrompt;
try {
resolved = await resolvePrompt(options);
} catch (err) {
log.error(err instanceof Error ? err.message : String(err));
process.exit(2);
}
if (!resolved.describe()) {
log.error(
'Empty prompt. Pass --prompt <text>, --image <path>, --input-json <file|->, or pipe content via stdin.',
);
process.exit(2);
}
// Server-ingest mode is active when --topic is provided.
// --operation-id must be a server-allocated id in this mode (the server
// generates it before spawning the process and passes it via CLI args).
const serverIngest = !!options.topic;
if (serverIngest && !options.operationId) {
log.error('--operation-id is required when --topic is set (server-ingest mode).');
process.exit(2);
}
const operationId = options.operationId || randomUUID();
// Determine JSONL output mode.
// Explicit --render flag always wins. Otherwise: emit JSONL in standalone
// mode; suppress in server-ingest mode (sink handles the data path).
const emitJsonl = options.render === 'jsonl' || (options.render === undefined && !serverIngest);
// Build the ingest sink — no-op for standalone mode, real tRPC sink for
// server-ingest mode. The tRPC client reads LOBEHUB_JWT (operation-scoped
// JWT injected by the server) for authentication.
const agentType = options.type as 'claude-code' | 'codex';
let sink: InstanceType<typeof TrpcIngestSink> | InstanceType<typeof NoopIngestSink>;
if (serverIngest) {
const client = await getTrpcClient();
sink = new TrpcIngestSink(client, agentType, operationId, options.topic!);
} else {
sink = new NoopIngestSink();
}
const ingester = new BatchIngester(sink);
// `spawnAgent` is async and can reject DURING image normalization — fetch
// failures, missing local --image paths, decode errors. Surface those as a
// clean error + exit code instead of an unhandled promise rejection / stack
// trace, mirroring the validation try/catch above.
let handle: Awaited<ReturnType<typeof spawnAgent>>;
try {
handle = await spawnAgent({
agentType: options.type,
command: options.command,
cwd: options.cwd || process.cwd(),
operationId,
prompt: resolved.prompt,
resumeSessionId: options.resume,
});
} catch (err) {
log.error('Failed to start agent:', err instanceof Error ? err.message : String(err));
process.exit(1);
}
// Forward the child's stderr to ours so users see CLI errors / warnings
// (auth prompts, missing-binary errors, etc.) in the terminal.
handle.stderr.pipe(process.stderr);
// Ctrl-C → SIGINT to the child's process group so the spawned CLI gets a
// chance to clean up. Repeated Ctrl-C escalates to SIGKILL via the
// standard "double-tap" pattern most CLIs implement themselves.
// In server-ingest mode, drain the ingester and call heteroFinish before
// exiting so the server knows the operation was cancelled.
let interrupted = false;
const onSigint = async () => {
if (interrupted) {
handle.kill('SIGKILL');
return;
}
interrupted = true;
handle.kill('SIGINT');
if (serverIngest) {
try {
await ingester.drain();
await sink.finish({ result: 'cancelled' });
} catch {
// best-effort; process is exiting anyway
}
}
};
process.on('SIGINT', onSigint);
process.on('SIGTERM', async () => {
handle.kill('SIGTERM');
if (serverIngest) {
try {
await ingester.drain();
await sink.finish({ result: 'cancelled' });
} catch {
// best-effort
}
}
});
// Stream events. Each event is optionally written as JSONL and always
// pushed into the ingester (which batches and sends to the server).
let ingestError = false;
try {
for await (const event of handle.events) {
if (emitJsonl) {
process.stdout.write(`${JSON.stringify(event)}\n`);
}
ingester.push(event);
}
} catch (err) {
log.error('Stream error from agent process:', err instanceof Error ? err.message : String(err));
if (serverIngest) {
try {
await ingester.drain();
await sink.finish({
result: 'error',
error: { message: String(err), type: 'stream_error' },
});
} catch {
// best-effort
}
}
process.exit(1);
} finally {
process.off('SIGINT', onSigint);
}
// Pass the child's exit code through. In server-ingest mode, drain the
// ingester and call heteroFinish before exiting.
const { code, signal } = await handle.exit;
if (serverIngest) {
try {
await ingester.drain();
} catch (err) {
log.error(
'Failed to flush events to server:',
err instanceof Error ? err.message : String(err),
);
ingestError = true;
}
const exitedClean = !ingestError && (code === 0 || signal === 'SIGTERM');
try {
await sink.finish({
result: exitedClean ? 'success' : 'error',
sessionId: handle.sessionId,
});
} catch (err) {
log.error('Failed to send heteroFinish:', err instanceof Error ? err.message : String(err));
}
}
if (code !== null) process.exit(ingestError ? 1 : code);
if (signal === 'SIGINT') process.exit(130);
if (signal === 'SIGTERM') process.exit(143);
if (signal === 'SIGKILL') process.exit(137);
process.exit(1);
};
export function registerHeteroCommand(program: Command) {
const hetero = program
.command('hetero')
.description('Run heterogeneous agent CLIs (Claude Code / Codex) and stream their output');
hetero
.command('exec')
.description(
'Spawn a heterogeneous agent CLI and stream its events as JSONL on stdout. Standalone mode (no server ingest).',
)
.requiredOption('-t, --type <type>', `Agent type: ${[...SUPPORTED_AGENT_TYPES].join(' | ')}`)
.option('-p, --prompt [text]', 'Prompt text. Pass `-` (or omit the value) to read from stdin.')
.option(
'-i, --image <path|url>',
'Attach an image (repeatable). Accepts a local path, http(s) URL, or data: URL.',
collectImage,
)
.option(
'--input-json <path>',
'Read full multimodal prompt as JSON content blocks from a file. Use `-` for stdin.',
)
.option('-r, --resume <sessionId>', 'Resume an existing agent session by its native id')
.option('-d, --cwd <path>', 'Working directory for the spawned agent (default: process.cwd())')
.option(
'-c, --command <bin>',
'Override the agent CLI binary name (default: `claude` or `codex`)',
)
.option(
'--operation-id <id>',
'Operation id stamped onto every emitted event. Required in server-ingest mode (--topic). Generated as a UUID if omitted (standalone).',
)
.option(
'--topic <topicId>',
'Server topic id. Enables server-ingest mode: events are batch-POSTed to aiAgent.heteroIngest. Requires --operation-id.',
)
.option(
'--render <mode>',
'Output mode: jsonl (emit events as JSONL on stdout) | none (suppress stdout). Defaults to jsonl in standalone, none in server-ingest mode.',
)
.action(exec);
}
-17
View File
@@ -83,23 +83,6 @@ describe('model command', () => {
expect(consoleSpy).toHaveBeenCalledWith(JSON.stringify(models, null, 2));
});
it('should filter hidden runtime-only models from JSON output', async () => {
const visibleModels = [{ displayName: 'DeepSeek V4 Pro', id: 'deepseek-v4-pro' }];
mockTrpcClient.aiModel.getAiProviderModelList.query.mockResolvedValue([
...visibleModels,
{
displayName: 'LobeHub Onboarding',
id: 'lobehub-onboarding-v1',
visible: false,
},
]);
const program = createProgram();
await program.parseAsync(['node', 'test', 'model', 'list', 'lobehub', '--json']);
expect(consoleSpy).toHaveBeenCalledWith(JSON.stringify(visibleModels, null, 2));
});
});
describe('view', () => {
+1 -5
View File
@@ -5,8 +5,6 @@ import { getTrpcClient } from '../api/client';
import { confirm, outputJson, printTable, truncate } from '../utils/format';
import { log } from '../utils/logger';
const isVisibleModel = (model: { visible?: boolean }) => model.visible !== false;
export function registerModelCommand(program: Command) {
const model = program.command('model').description('Manage AI models');
@@ -35,9 +33,7 @@ export function registerModelCommand(program: Command) {
if (options.type) input.type = options.type;
const result = await client.aiModel.getAiProviderModelList.query(input as any);
let items = (Array.isArray(result) ? result : ((result as any).items ?? [])).filter(
isVisibleModel,
);
let items = Array.isArray(result) ? result : ((result as any).items ?? []);
if (options.type) {
items = items.filter((m: any) => m.type === options.type);
-2
View File
@@ -14,7 +14,6 @@ import { registerDocCommand } from './commands/doc';
import { registerEvalCommand } from './commands/eval';
import { registerFileCommand } from './commands/file';
import { registerGenerateCommand } from './commands/generate';
import { registerHeteroCommand } from './commands/hetero';
import { registerKbCommand } from './commands/kb';
import { registerLoginCommand } from './commands/login';
import { registerLogoutCommand } from './commands/logout';
@@ -63,7 +62,6 @@ export function createProgram() {
registerCronCommand(program);
registerGenerateCommand(program);
registerFileCommand(program);
registerHeteroCommand(program);
registerSkillCommand(program);
registerSessionGroupCommand(program);
registerTaskCommand(program);
+14 -25
View File
@@ -27,22 +27,22 @@ describe('executeToolCall', () => {
fs.rmSync(tmpDir, { force: true, recursive: true });
});
it('should dispatch readFile', async () => {
it('should dispatch readLocalFile', async () => {
const filePath = path.join(tmpDir, 'test.txt');
await writeFile(filePath, 'hello world');
const result = await executeToolCall('readFile', JSON.stringify({ path: filePath }));
const result = await executeToolCall('readLocalFile', JSON.stringify({ path: filePath }));
expect(result.success).toBe(true);
const parsed = JSON.parse(result.content);
expect(parsed.content).toContain('hello world');
});
it('should dispatch writeFile', async () => {
it('should dispatch writeLocalFile', async () => {
const filePath = path.join(tmpDir, 'new.txt');
const result = await executeToolCall(
'writeFile',
'writeLocalFile',
JSON.stringify({ content: 'written', path: filePath }),
);
@@ -50,17 +50,6 @@ describe('executeToolCall', () => {
expect(fs.readFileSync(filePath, 'utf8')).toBe('written');
});
it('should dispatch legacy alias readLocalFile', async () => {
const filePath = path.join(tmpDir, 'legacy.txt');
await writeFile(filePath, 'legacy hello');
const result = await executeToolCall('readLocalFile', JSON.stringify({ path: filePath }));
expect(result.success).toBe(true);
const parsed = JSON.parse(result.content);
expect(parsed.content).toContain('legacy hello');
});
it('should dispatch runCommand', async () => {
const result = await executeToolCall(
'runCommand',
@@ -72,21 +61,21 @@ describe('executeToolCall', () => {
expect(parsed.stdout).toContain('dispatched');
});
it('should dispatch listFiles', async () => {
it('should dispatch listLocalFiles', async () => {
await writeFile(path.join(tmpDir, 'a.txt'), 'a');
const result = await executeToolCall('listFiles', JSON.stringify({ path: tmpDir }));
const result = await executeToolCall('listLocalFiles', JSON.stringify({ path: tmpDir }));
expect(result.success).toBe(true);
const parsed = JSON.parse(result.content);
expect(parsed.totalCount).toBeGreaterThan(0);
});
it('should dispatch globFiles', async () => {
it('should dispatch globLocalFiles', async () => {
await writeFile(path.join(tmpDir, 'test.ts'), 'code');
const result = await executeToolCall(
'globFiles',
'globLocalFiles',
JSON.stringify({ cwd: tmpDir, pattern: '*.ts' }),
);
@@ -95,12 +84,12 @@ describe('executeToolCall', () => {
expect(parsed.files).toContain('test.ts');
});
it('should dispatch editFile', async () => {
it('should dispatch editLocalFile', async () => {
const filePath = path.join(tmpDir, 'edit.txt');
await writeFile(filePath, 'old content');
const result = await executeToolCall(
'editFile',
'editLocalFile',
JSON.stringify({
file_path: filePath,
new_string: 'new content',
@@ -127,7 +116,7 @@ describe('executeToolCall', () => {
const filePath = path.join(tmpDir, 'str.txt');
await writeFile(filePath, 'content');
const result = await executeToolCall('readFile', JSON.stringify({ path: filePath }));
const result = await executeToolCall('readLocalFile', JSON.stringify({ path: filePath }));
expect(result.success).toBe(true);
// Result should be valid JSON
@@ -135,7 +124,7 @@ describe('executeToolCall', () => {
});
it('should return error for invalid JSON arguments', async () => {
const result = await executeToolCall('readFile', 'not-json');
const result = await executeToolCall('readLocalFile', 'not-json');
expect(result.success).toBe(false);
expect(result.error).toBeDefined();
@@ -152,11 +141,11 @@ describe('executeToolCall', () => {
expect(result.success).toBe(true);
});
it('should dispatch searchFiles', async () => {
it('should dispatch searchLocalFiles', async () => {
await writeFile(path.join(tmpDir, 'search_target.txt'), 'found');
const result = await executeToolCall(
'searchFiles',
'searchLocalFiles',
JSON.stringify({ directory: tmpDir, keywords: 'search_target' }),
);
+3 -11
View File
@@ -11,22 +11,14 @@ import {
import { getCommandOutput, killCommand, runCommand } from './shell';
const methodMap: Record<string, (args: any) => Promise<unknown>> = {
editFile: editLocalFile,
editLocalFile,
getCommandOutput,
globFiles: globLocalFiles,
globLocalFiles,
grepContent,
killCommand,
listFiles: listLocalFiles,
readFile: readLocalFile,
runCommand,
searchFiles: searchLocalFiles,
writeFile: writeLocalFile,
// Legacy aliases — older Gateway versions may still send the long form
editLocalFile,
globLocalFiles,
listLocalFiles,
readLocalFile,
runCommand,
searchLocalFiles,
writeLocalFile,
};
-99
View File
@@ -1,99 +0,0 @@
import type { AgentStreamEvent } from '@lobechat/heterogeneous-agents/spawn';
export interface IngestSink {
finish: (params: {
error?: { message: string; type: string };
result: 'cancelled' | 'error' | 'success';
sessionId?: string;
}) => Promise<void>;
ingest: (events: AgentStreamEvent[]) => Promise<void>;
}
export class NoopIngestSink implements IngestSink {
async finish(_params: Parameters<IngestSink['finish']>[0]): Promise<void> {}
async ingest(_events: AgentStreamEvent[]): Promise<void> {}
}
const MAX_BATCH = 50;
const FLUSH_INTERVAL_MS = 250;
const MAX_RETRIES = 5;
const sleep = (ms: number) => new Promise<void>((r) => setTimeout(r, ms));
/**
* Buffers `AgentStreamEvent`s and flushes them in batches to an `IngestSink`.
*
* Flush triggers:
* - Buffer reaches MAX_BATCH (50) → immediate flush
* - FLUSH_INTERVAL_MS (250ms) timer fires → flush whatever is buffered
*
* Each batch is retried up to MAX_RETRIES (5) times with exponential back-off
* starting at 500ms, doubling up to 8s. After the final retry the error is
* stored and re-thrown by `drain()`, allowing the caller to call
* `sink.finish({ result: 'error' })` and exit(1).
*
* Call order: push() repeatedly → drain() once (before finish()).
*/
export class BatchIngester {
private buffer: AgentStreamEvent[] = [];
private fatalError: Error | null = null;
private inflightFlush: Promise<void> = Promise.resolve();
private timer: ReturnType<typeof setTimeout> | null = null;
constructor(private readonly sink: IngestSink) {}
push(event: AgentStreamEvent): void {
if (this.fatalError) return;
this.buffer.push(event);
if (this.buffer.length >= MAX_BATCH) {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
this.triggerFlush();
} else if (!this.timer) {
this.timer = setTimeout(() => {
this.timer = null;
this.triggerFlush();
}, FLUSH_INTERVAL_MS);
}
}
/** Flush remaining buffer and wait for all in-flight sends to settle. */
async drain(): Promise<void> {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
this.triggerFlush();
await this.inflightFlush;
if (this.fatalError) throw this.fatalError;
}
private async sendWithRetry(batch: AgentStreamEvent[]): Promise<void> {
let delay = 500;
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
try {
await this.sink.ingest(batch);
return;
} catch (err) {
if (attempt === MAX_RETRIES) {
this.fatalError = err instanceof Error ? err : new Error(String(err));
throw this.fatalError;
}
await sleep(delay);
delay = Math.min(delay * 2, 8_000);
}
}
}
private triggerFlush(): void {
if (this.fatalError || this.buffer.length === 0) return;
const batch = this.buffer.splice(0);
this.inflightFlush = this.inflightFlush
.then(() => this.sendWithRetry(batch))
.catch(() => {
// fatalError is already set; drain() re-throws it
});
}
}
-38
View File
@@ -1,38 +0,0 @@
import type { AgentStreamEvent } from '@lobechat/heterogeneous-agents/spawn';
import type { TrpcClient } from '../api/client';
import type { IngestSink } from './BatchIngester';
/**
* `IngestSink` implementation that forwards batches to the server via tRPC
* (`aiAgent.heteroIngest` / `aiAgent.heteroFinish`).
*
* The CLI authenticates using the `LOBEHUB_JWT` env var (operation-scoped JWT
* injected by the server before spawning the sandbox / desktop process).
*/
export class TrpcIngestSink implements IngestSink {
constructor(
private readonly client: TrpcClient,
private readonly agentType: 'claude-code' | 'codex',
private readonly operationId: string,
private readonly topicId: string,
) {}
async finish(params: Parameters<IngestSink['finish']>[0]): Promise<void> {
await this.client.aiAgent.heteroFinish.mutate({
agentType: this.agentType,
operationId: this.operationId,
topicId: this.topicId,
...params,
});
}
async ingest(events: AgentStreamEvent[]): Promise<void> {
await this.client.aiAgent.heteroIngest.mutate({
agentType: this.agentType,
events: events as any,
operationId: this.operationId,
topicId: this.topicId,
});
}
}
-1
View File
@@ -58,7 +58,6 @@
"@lobechat/electron-client-ipc": "workspace:*",
"@lobechat/electron-server-ipc": "workspace:*",
"@lobechat/file-loaders": "workspace:*",
"@lobechat/heterogeneous-agents": "workspace:*",
"@lobechat/local-file-shell": "workspace:*",
"@lobehub/i18n-cli": "^1.25.1",
"@modelcontextprotocol/sdk": "^1.24.3",
-1
View File
@@ -1,7 +1,6 @@
packages:
- '../cli'
- '../../packages/agent-gateway-client'
- '../../packages/heterogeneous-agents'
- '../../packages/const'
- '../../packages/electron-server-ipc'
- '../../packages/electron-client-ipc'
-1
View File
@@ -26,7 +26,6 @@ export const defaultProxySettings: NetworkProxySettings = {
* Storage default values
*/
export const STORE_DEFAULTS: ElectronMainStore = {
appTrayVisible: true,
dataSyncConfig: { storageMode: 'cloud' },
encryptedTokens: {},
gatewayDeviceDescription: '',
@@ -1,9 +1,7 @@
import type { AgentRunRequestMessage } from '@lobechat/device-gateway-client';
import type { GatewayConnectionStatus } from '@lobechat/electron-client-ipc';
import GatewayConnectionService from '@/services/gatewayConnectionSrv';
import HeterogeneousAgentCtr from './HeterogeneousAgentCtr';
import { ControllerModule, IpcMethod } from './index';
import LocalFileCtr from './LocalFileCtr';
import RemoteServerConfigCtr from './RemoteServerConfigCtr';
@@ -35,10 +33,6 @@ export default class GatewayConnectionCtr extends ControllerModule {
return this.app.getController(ShellCommandCtr);
}
private get heterogeneousAgentCtr() {
return this.app.getController(HeterogeneousAgentCtr);
}
// ─── Lifecycle ───
afterAppReady() {
@@ -53,9 +47,6 @@ export default class GatewayConnectionCtr extends ControllerModule {
// Wire up tool call handler
srv.setToolCallHandler((apiName, args) => this.executeToolCall(apiName, args));
// Wire up agent run handler
srv.setAgentRunHandler((request) => this.executeAgentRun(request));
// Auto-connect if already logged in
this.tryAutoConnect();
}
@@ -117,81 +108,23 @@ export default class GatewayConnectionCtr extends ControllerModule {
await this.service.connect();
}
// ─── Agent Run Routing ───
private async executeAgentRun(
request: AgentRunRequestMessage,
): Promise<{ reason?: string; status: 'accepted' | 'rejected' }> {
try {
const ctr = this.heterogeneousAgentCtr;
// Create a session for the hetero agent.
const { sessionId } = await ctr.startSession({
agentType: request.agentType,
args: [],
command: request.agentType === 'codex' ? 'codex' : 'claude',
cwd: request.cwd,
// Inject LOBEHUB_JWT so the CLI authenticates against heteroIngest.
env: { LOBEHUB_JWT: request.jwt },
resumeSessionId: request.resumeSessionId,
});
// Fire-and-forget: sendPrompt runs the CLI until completion.
ctr
.sendPrompt({
operationId: request.operationId,
prompt: request.prompt,
sessionId,
})
.catch((err: Error) => {
// Errors are surfaced via heteroFinish on the server side.
// Log locally for desktop debugging only.
console.error('[GatewayConnectionCtr] agent run failed:', err.message);
});
return { status: 'accepted' };
} catch (err) {
const reason = err instanceof Error ? err.message : String(err);
return { reason, status: 'rejected' };
}
}
// ─── Tool Call Routing ───
private async executeToolCall(apiName: string, args: any): Promise<unknown> {
const editFile = () => this.localFileCtr.handleEditFile(args);
const globFiles = () => this.localFileCtr.handleGlobFiles(args);
const listFiles = () => this.localFileCtr.listLocalFiles(args);
const moveFiles = () => this.localFileCtr.handleMoveFiles(args);
const readFile = () => this.localFileCtr.readFile(args);
const searchFiles = () => this.localFileCtr.handleLocalFilesSearch(args);
const writeFile = () => this.localFileCtr.handleWriteFile(args);
const methodMap: Record<string, () => Promise<unknown>> = {
editFile,
globFiles,
editLocalFile: () => this.localFileCtr.handleEditFile(args),
globLocalFiles: () => this.localFileCtr.handleGlobFiles(args),
grepContent: () => this.localFileCtr.handleGrepContent(args),
listFiles,
moveFiles,
readFile,
searchFiles,
writeFile,
listLocalFiles: () => this.localFileCtr.listLocalFiles(args),
moveLocalFiles: () => this.localFileCtr.handleMoveFiles(args),
readLocalFile: () => this.localFileCtr.readFile(args),
renameLocalFile: () => this.localFileCtr.handleRenameFile(args),
searchLocalFiles: () => this.localFileCtr.handleLocalFilesSearch(args),
writeLocalFile: () => this.localFileCtr.handleWriteFile(args),
getCommandOutput: () => this.shellCommandCtr.handleGetCommandOutput(args),
killCommand: () => this.shellCommandCtr.handleKillCommand(args),
runCommand: () => this.shellCommandCtr.handleRunCommand(args),
// Legacy aliases — keep these so older Gateway versions sending the long
// names continue to route correctly. `renameLocalFile` is also kept even
// though the new surface drops rename (it's now handled by `moveFiles`).
editLocalFile: editFile,
globLocalFiles: globFiles,
listLocalFiles: listFiles,
moveLocalFiles: moveFiles,
readLocalFile: readFile,
renameLocalFile: () => this.localFileCtr.handleRenameFile(args),
searchLocalFiles: searchFiles,
writeLocalFile: writeFile,
};
const handler = methodMap[apiName];
+97 -621
View File
@@ -1,12 +1,10 @@
import { execFile, spawn } from 'node:child_process';
import { readFile, stat } from 'node:fs/promises';
import { execFile } from 'node:child_process';
import { readFile } from 'node:fs/promises';
import path from 'node:path';
import { promisify } from 'node:util';
import type {
GetGitBranchDiffPayload,
GitAheadBehind,
GitBranchDiffPatches,
GitBranchInfo,
GitBranchListItem,
GitCheckoutResult,
@@ -14,7 +12,6 @@ import type {
GitLinkedPullRequestResult,
GitPullResult,
GitPushResult,
GitRemoteBranchListItem,
GitWorkingTreeFiles,
GitWorkingTreePatch,
GitWorkingTreePatches,
@@ -28,412 +25,6 @@ import { ControllerModule, IpcMethod } from './index';
const logger = createLogger('controllers:GitCtr');
interface DirtyEntry {
filePath: string;
status: GitFileDiffStatus;
}
interface DiffBlock {
isBinary: boolean;
patch: string;
/** Destination path (or source path for deleted files). */
path: string;
}
/**
* Split the output of `git diff HEAD --` into one block per file. Each block
* starts at a `^diff --git ` line and runs to just before the next one (or
* EOF). Path comes from the `+++ b/<path>` line, falling back to `--- a/<path>`
* when the destination is `/dev/null` (deletion). Quoted paths (spaces /
* non-ASCII when `core.quotepath` is on) are minimally de-escaped.
*/
const splitBulkDiff = (diffText: string): DiffBlock[] => {
if (!diffText) return [];
const blocks: DiffBlock[] = [];
const headerRe = /^diff --git /gm;
const starts: number[] = [];
let m: RegExpExecArray | null;
while ((m = headerRe.exec(diffText)) !== null) starts.push(m.index);
for (let i = 0; i < starts.length; i++) {
const start = starts[i];
const end = i + 1 < starts.length ? starts[i + 1] : diffText.length;
const block = diffText.slice(start, end);
const filePath = extractPathFromDiffBlock(block);
if (!filePath) continue;
blocks.push({
isBinary: /^Binary files .* differ$/m.test(block),
path: filePath,
patch: block,
});
}
return blocks;
};
/**
* Pull the file path out of a per-file diff block. Looks at the `+++ b/<path>`
* line first (covers add/modify); falls back to `--- a/<path>` for deletes
* where `+++` is `/dev/null`; final fallback is the `diff --git a/x b/y`
* header line.
*/
const extractPathFromDiffBlock = (block: string): string | null => {
let plusPath: string | null = null;
let minusPath: string | null = null;
for (const line of block.split('\n')) {
if (line.startsWith('+++ ')) {
plusPath = parseDiffPathLine(line.slice(4), 'b/');
} else if (line.startsWith('--- ')) {
minusPath = parseDiffPathLine(line.slice(4), 'a/');
}
// The file headers always come before the first hunk / binary marker;
// bail once we hit either to avoid scanning huge diff bodies.
if (line.startsWith('@@') || line.startsWith('Binary files ')) break;
}
if (plusPath) return plusPath;
if (minusPath) return minusPath;
// Last-resort: parse the `diff --git a/x b/y` header itself.
const header = block.split('\n', 1)[0];
const match = /^diff --git a\/.+? b\/(.+)$/.exec(header);
return match ? match[1] : null;
};
/**
* Strip the `a/` or `b/` prefix off a `+++` / `---` line, drop the optional
* trailing tab+timestamp, and de-quote git's C-style escaping. Returns null
* for `/dev/null` (which means the other side of the diff is the real path).
*/
const parseDiffPathLine = (raw: string, prefix: 'a/' | 'b/'): string | null => {
const tabIdx = raw.indexOf('\t');
let p = tabIdx >= 0 ? raw.slice(0, tabIdx) : raw;
if (p === '/dev/null') return null;
// Quoted form: "b/path with spaces"
if (p.startsWith('"') && p.endsWith('"')) {
p = dequoteGitPath(p.slice(1, -1));
}
return p.startsWith(prefix) ? p.slice(prefix.length) : p;
};
export const dequoteGitPath = (s: string): string =>
s.replaceAll(/\\(["\\trn]|[0-7]{3})/g, (_, esc: string) => {
if (esc === '"') return '"';
if (esc === '\\') return '\\';
if (esc === 't') return '\t';
if (esc === 'r') return '\r';
if (esc === 'n') return '\n';
return String.fromCodePoint(Number.parseInt(esc, 8));
});
/**
* Inverse of {@link dequoteGitPath} — returns either `<prefix><path>` (when
* no escaping is needed) or git's C-style quoted form `"<prefix><escaped>"`
* (when the path contains TAB / LF / CR / quote / backslash / control bytes).
* The prefix lives *inside* the quotes so the output matches what real `git
* diff` would emit, e.g. `"a/file\twith tab.txt"` rather than `a/"file\twith
* tab.txt"`. Plain spaces are not quoted (git tolerates them; the trailing
* ` b/<path>` marker on the diff header is enough to delimit the source).
*/
// eslint-disable-next-line no-control-regex
const NEEDS_QUOTING = /["\\\x00-\x1F\x7F]/;
export const quoteGitPath = (prefix: 'a/' | 'b/', filePath: string): string => {
const combined = prefix + filePath;
if (!NEEDS_QUOTING.test(combined)) return combined;
let out = '"';
for (const ch of combined) {
if (ch === '\\') out += '\\\\';
else if (ch === '"') out += '\\"';
else if (ch === '\t') out += '\\t';
else if (ch === '\n') out += '\\n';
else if (ch === '\r') out += '\\r';
else {
const code = ch.codePointAt(0)!;
if (code < 0x20 || code === 0x7f) {
out += '\\' + code.toString(8).padStart(3, '0');
} else {
out += ch;
}
}
}
return out + '"';
};
/**
* Status from a single diff block's preamble: `new file mode` → added,
* `deleted file mode` → deleted, otherwise modified. Used by branch-diff mode
* where there's no `git status` to consult — the diff itself is the source.
*/
const detectDiffBlockStatus = (block: string): GitFileDiffStatus => {
// Only scan up to the first hunk / binary marker so huge bodies aren't walked.
for (const line of block.split('\n')) {
if (line.startsWith('new file mode ')) return 'added';
if (line.startsWith('deleted file mode ')) return 'deleted';
if (line.startsWith('@@') || line.startsWith('Binary files ')) break;
}
return 'modified';
};
/** Walk a patch counting `+`/`-` lines while skipping `+++`/`---` headers. */
const countAddDel = (patch: string): { additions: number; deletions: number } => {
let additions = 0;
let deletions = 0;
for (const line of patch.split('\n')) {
if (line.startsWith('+++') || line.startsWith('---')) continue;
if (line.startsWith('+')) additions++;
else if (line.startsWith('-')) deletions++;
}
return { additions, deletions };
};
const emptyPatch = (entry: DirtyEntry): GitWorkingTreePatch => ({
additions: 0,
deletions: 0,
filePath: entry.filePath,
isBinary: false,
patch: '',
status: entry.status,
truncated: false,
});
const buildTrackedPatch = (
entry: DirtyEntry,
block: DiffBlock,
maxBytes: number,
): GitWorkingTreePatch => {
if (block.isBinary) {
return { ...emptyPatch(entry), isBinary: true };
}
if (block.patch.length > maxBytes) {
return { ...emptyPatch(entry), truncated: true };
}
const { additions, deletions } = countAddDel(block.patch);
return {
additions,
deletions,
filePath: entry.filePath,
isBinary: false,
patch: block.patch,
status: entry.status,
truncated: false,
};
};
/**
* Build a synthetic add-only patch for an untracked file by reading it from
* disk — replaces the per-file `git diff --no-index /dev/null <file>` fork.
* Binary detection uses a NUL-byte sniff over the first 8 KB (matches what
* git itself does internally).
*/
const readUntrackedAsPatch = async (
cwd: string,
entry: DirtyEntry,
maxBytes: number,
): Promise<GitWorkingTreePatch> => {
const absolute = path.resolve(cwd, entry.filePath);
let size: number;
try {
const s = await stat(absolute);
if (!s.isFile()) return emptyPatch(entry);
size = s.size;
} catch (error: any) {
logger.debug('[readUntrackedAsPatch] stat failed', {
filePath: entry.filePath,
message: error?.message,
});
return emptyPatch(entry);
}
// Pre-quote so the path is C-style escaped wherever it lands in the synthetic
// patch — raw `entry.filePath` interpolation would emit malformed `diff --git`
// / `+++` lines for filenames containing TAB / LF / quote / backslash.
const aPath = quoteGitPath('a/', entry.filePath);
const bPath = quoteGitPath('b/', entry.filePath);
if (size === 0) {
return {
...emptyPatch(entry),
patch:
[
`diff --git ${aPath} ${bPath}`,
'new file mode 100644',
'--- /dev/null',
`+++ ${bPath}`,
].join('\n') + '\n',
};
}
// Cap the synthesized patch by *file* size, not patch size — a 200 KB file
// produces a ~200 KB patch (one `+` per line). Close enough.
if (size > maxBytes) {
return { ...emptyPatch(entry), truncated: true };
}
let buf: Buffer;
try {
buf = await readFile(absolute);
} catch (error: any) {
logger.debug('[readUntrackedAsPatch] read failed', {
filePath: entry.filePath,
message: error?.message,
});
return emptyPatch(entry);
}
const sniffEnd = Math.min(buf.length, 8192);
for (let i = 0; i < sniffEnd; i++) {
if (buf[i] === 0) return { ...emptyPatch(entry), isBinary: true };
}
const text = buf.toString('utf8');
// text.split('\n') leaves a trailing '' when the file ends with '\n';
// exclude it so the hunk header line count matches git's own output.
const rawLines = text.split('\n');
const trailingEmpty = rawLines.length > 0 && rawLines.at(-1) === '';
const lineCount = trailingEmpty ? rawLines.length - 1 : rawLines.length;
if (lineCount === 0) {
return { ...emptyPatch(entry), patch: '' };
}
const body = rawLines
.slice(0, lineCount)
.map((line) => '+' + line)
.join('\n');
// Mirror `git diff --no-index`'s "no newline at end of file" footer when the
// source had no trailing newline — keeps PatchDiff's hunk parser happy.
const noNewlineFooter = trailingEmpty ? '' : '\n\\ No newline at end of file';
const patch =
[
`diff --git ${aPath} ${bPath}`,
'new file mode 100644',
'--- /dev/null',
`+++ ${bPath}`,
`@@ -0,0 +1,${lineCount} @@`,
body,
].join('\n') +
noNewlineFooter +
'\n';
return {
additions: lineCount,
deletions: 0,
filePath: entry.filePath,
isBinary: false,
patch,
status: entry.status,
truncated: false,
};
};
/**
* Stream a git invocation's stdout via `spawn` instead of `execFile`'s
* fixed-size buffer. Replaces the bulk-diff caller's old 64 MB `maxBuffer`
* cap — pipe-buffer-sized chunks accumulate in memory until the process
* exits, with no hard ceiling. SIGTERM on timeout. Resolves with the full
* stdout string; rejects with an Error carrying `stderr` and `partialStdout`
* fields so callers can salvage partial output (or fall back) on failure.
*/
const runGitCaptureStream = (cwd: string, args: string[], timeoutMs: number): Promise<string> =>
new Promise((resolve, reject) => {
const child = spawn('git', args, { cwd });
const stdoutChunks: Buffer[] = [];
let stderrBuf = '';
let timedOut = false;
const timer = setTimeout(() => {
timedOut = true;
child.kill('SIGTERM');
}, timeoutMs);
child.stdout.on('data', (chunk: Buffer) => stdoutChunks.push(chunk));
child.stderr.on('data', (chunk: Buffer) => {
stderrBuf += chunk.toString('utf8');
});
child.on('error', (err) => {
clearTimeout(timer);
reject(Object.assign(err, { stderr: stderrBuf }));
});
child.on('close', (code) => {
clearTimeout(timer);
const stdout = Buffer.concat(stdoutChunks).toString('utf8');
if (timedOut) {
const err: any = new Error('git command timed out');
err.stderr = stderrBuf;
err.partialStdout = stdout;
return reject(err);
}
// `git diff HEAD` (without --exit-code) exits 0 even when there are
// diffs; non-zero is therefore a real error.
if (code !== 0) {
const err: any = new Error(`git exited with code ${code}`);
err.code = code;
err.stderr = stderrBuf;
err.partialStdout = stdout;
return reject(err);
}
resolve(stdout);
});
});
/**
* Last-resort per-file diff for tracked entries the bulk diff didn't cover —
* either because the bulk command failed entirely or because git emitted no
* patch for a path the status step listed (rare race with concurrent writes).
* Mirrors the original per-file behavior so individual files keep their
* patches even when the bulk fast-path is unavailable.
*/
const fetchTrackedPatchPerFile = async (
cwd: string,
entry: DirtyEntry,
maxBytes: number,
): Promise<GitWorkingTreePatch> => {
const execFileAsync = promisify(execFile);
let text: string;
try {
const { stdout } = await execFileAsync(
'git',
['-c', 'core.quotepath=off', 'diff', '--no-color', 'HEAD', '--', entry.filePath],
{
cwd,
encoding: 'utf8',
maxBuffer: maxBytes * 4,
timeout: 10_000,
},
);
text = stdout as string;
} catch (error: any) {
logger.debug('[fetchTrackedPatchPerFile] diff failed', {
filePath: entry.filePath,
stderr: error?.stderr?.toString?.() ?? error?.stderr,
});
return emptyPatch(entry);
}
if (text.length > maxBytes) return { ...emptyPatch(entry), truncated: true };
if (/^Binary files .* differ$/m.test(text)) return { ...emptyPatch(entry), isBinary: true };
if (!text) return emptyPatch(entry);
const { additions, deletions } = countAddDel(text);
return {
additions,
deletions,
filePath: entry.filePath,
isBinary: false,
patch: text,
status: entry.status,
truncated: false,
};
};
/**
* Bounded `Promise.all` — runs at most `limit` async tasks at a time. Used
* for the per-file fallback so we cap fork pressure at a small constant
* instead of replaying the original 200-parallel `git diff` storm.
*/
const mapWithConcurrency = async <T, R>(
items: T[],
limit: number,
fn: (item: T) => Promise<R>,
): Promise<R[]> => {
const results: R[] = Array.from({ length: items.length });
let cursor = 0;
const workerCount = Math.min(limit, items.length);
await Promise.all(
Array.from({ length: workerCount }, async () => {
while (true) {
const idx = cursor++;
if (idx >= items.length) return;
results[idx] = await fn(items[idx]);
}
}),
);
return results;
};
export default class GitController extends ControllerModule {
static override readonly groupName = 'git';
@@ -574,54 +165,6 @@ export default class GitController extends ControllerModule {
}
}
/**
* List remote branches under `refs/remotes/origin/*`, ordered by most
* recent commit. The `HEAD` symref is filtered out and the resolved
* default branch is flagged via `isDefault` so the UI can render it
* with a marker. Used by the Review panel's branch-compare picker.
*/
@IpcMethod()
async listGitRemoteBranches(dirPath: string): Promise<GitRemoteBranchListItem[]> {
const execFileAsync = promisify(execFile);
let defaultRef: string | undefined;
try {
const { stdout } = await execFileAsync(
'git',
['symbolic-ref', '--short', 'refs/remotes/origin/HEAD'],
{ cwd: dirPath, timeout: 5000 },
);
defaultRef = stdout.trim() || undefined;
} catch {
defaultRef = undefined;
}
try {
const { stdout } = await execFileAsync(
'git',
[
'for-each-ref',
'--sort=-committerdate',
'--format=%(refname:short)',
'refs/remotes/origin',
],
{ cwd: dirPath, timeout: 5000 },
);
return stdout
.replaceAll('\r', '')
.split('\n')
.map((line) => line.trim())
.filter((name) => name.length > 0 && name !== 'origin/HEAD' && !name.endsWith('/HEAD'))
.map((name) => ({ isDefault: name === defaultRef, name }));
} catch (error: any) {
logger.warn('[listGitRemoteBranches] git command failed', {
code: error?.code,
cwd: dirPath,
message: error?.message,
stderr: error?.stderr?.toString?.() ?? error?.stderr,
});
return [];
}
}
/**
* Bucket dirty files into added / modified / deleted via `git status --porcelain -z`.
* Each file is counted once: untracked (`??`) and staged-add (`A`) → added,
@@ -723,18 +266,14 @@ export default class GitController extends ControllerModule {
/**
* Pull every dirty file's unified diff in one shot — one IPC call returns
* the patches the renderer needs to render `<PatchDiff />` per file.
* the patches the renderer needs to render `<PatchDiff />` per file. We do
* the per-file `git diff` invocations in parallel inside this method so
* the renderer doesn't have to fan out N IPC round trips.
*
* Tracked changes (modified / deleted / staged-A) all come from a *single*
* `git diff HEAD --` invocation that we split per-file in JS — fork-bombing
* the main process with N parallel `git diff` subprocesses was costing us
* ~510ms × N in fork overhead plus `.git/index` lock contention, and the
* libuv worker pool stayed busy while other IPC handlers queued. One
* subprocess instead of N keeps the freeze invisible.
*
* Untracked files are read directly with `fs.readFile` and a synthetic
* `--- /dev/null / +++ b/<path>` patch is built in Node — no `git diff`
* subprocess at all.
* Tracked changes (modified / deleted / staged-A) come from
* `git diff HEAD -- <file>`; pure untracked files come from
* `git diff --no-index /dev/null <file>` (which exits with code 1 when
* there are differences — that's success, not failure).
*
* Per-file patches are capped at 256 KB; oversized or binary entries get an
* empty `patch` string and a flag the renderer can use for a placeholder.
@@ -752,7 +291,7 @@ export default class GitController extends ControllerModule {
// Step 1 — classify every dirty path. Mirrors getGitWorkingTreeFiles but
// also distinguishes untracked (`??`) from staged-add (`A`) so we can pick
// the right path (git diff vs raw read) per entry.
// the right diff command per entry.
const entries: Entry[] = [];
try {
const { stdout } = await execFileAsync('git', ['status', '--porcelain', '-z'], {
@@ -791,163 +330,100 @@ export default class GitController extends ControllerModule {
return { patches: [] };
}
// Step 2a — single bulk `git diff HEAD` for every tracked dirty path,
// then split per-file in JS. We pass paths explicitly (not all) so a
// huge unrelated working tree doesn't pull extra patches into the
// stream. Output is streamed via spawn so there's no maxBuffer ceiling
// — even a multi-hundred-MB combined diff lands intact, and any partial
// output recovered from a failed run still feeds the per-file fallback.
const trackedEntries = entries.filter((e) => !e.isUntracked);
const trackedByPath = new Map(trackedEntries.map((e) => [e.filePath, e]));
const trackedPatches = new Map<string, GitWorkingTreePatch>();
if (trackedEntries.length > 0) {
let bulkDiff = '';
try {
bulkDiff = await runGitCaptureStream(
dirPath,
[
'-c',
'core.quotepath=off',
'diff',
'--no-color',
'HEAD',
'--',
...trackedEntries.map((e) => e.filePath),
],
30_000,
);
} catch (error: any) {
logger.warn('[getGitWorkingTreePatches] bulk diff failed; per-file fallback', {
cwd: dirPath,
stderr: error?.stderr?.toString?.() ?? error?.stderr,
});
// Salvage any patches that did stream through before the failure —
// the per-file fallback below only retries the stragglers.
if (typeof error?.partialStdout === 'string') bulkDiff = error.partialStdout;
// Walk the patch line-by-line counting `+`/`-` payload lines while
// skipping the `+++ b/...` / `--- a/...` headers (they look like
// additions/deletions but aren't). Cheap enough to do inline per file —
// each patch is capped at MAX_PATCH_BYTES.
const countAddDel = (patch: string): { additions: number; deletions: number } => {
let additions = 0;
let deletions = 0;
for (const line of patch.split('\n')) {
if (line.startsWith('+++') || line.startsWith('---')) continue;
if (line.startsWith('+')) additions++;
else if (line.startsWith('-')) deletions++;
}
for (const block of splitBulkDiff(bulkDiff)) {
const entry = trackedByPath.get(block.path);
if (!entry) continue;
trackedPatches.set(entry.filePath, buildTrackedPatch(entry, block, MAX_PATCH_BYTES));
}
// Anything the bulk diff didn't cover (bulk crashed, race-with-write,
// or git emitted no patch for a path status flagged dirty) gets a
// per-file retry. Concurrency-capped to avoid the original fork storm.
const stragglers = trackedEntries.filter((e) => !trackedPatches.has(e.filePath));
if (stragglers.length > 0) {
const recovered = await mapWithConcurrency(stragglers, 8, (entry) =>
fetchTrackedPatchPerFile(dirPath, entry, MAX_PATCH_BYTES),
);
for (const patch of recovered) trackedPatches.set(patch.filePath, patch);
}
}
return { additions, deletions };
};
// Step 2bread untracked files directly in Node. fs.readFile is bounded
// by libuv's thread pool (4 by default) so unbounded Promise.all is fine.
const untrackedEntries = entries.filter((e) => e.isUntracked);
const untrackedPatches = await Promise.all(
untrackedEntries.map((entry) => readUntrackedAsPatch(dirPath, entry, MAX_PATCH_BYTES)),
// Step 2 — per-file diff in parallel. `--no-index` exits 1 when there's a
// diff (which is the expected outcome for untracked files), so we have to
// pull stdout off the rejected error rather than letting it throw.
const patches = await Promise.all(
entries.map(async ({ filePath, isUntracked, status }): Promise<GitWorkingTreePatch> => {
const args = isUntracked
? ['diff', '--no-color', '--no-index', '/dev/null', filePath]
: ['diff', '--no-color', 'HEAD', '--', filePath];
let text: string;
try {
const { stdout } = await execFileAsync('git', args, {
cwd: dirPath,
encoding: 'utf8',
maxBuffer: MAX_PATCH_BYTES * 4,
timeout: 10_000,
});
text = stdout as string;
} catch (error: any) {
if (error?.stdout == null) {
logger.debug('[getGitWorkingTreePatches] diff failed', {
filePath,
status,
stderr: error?.stderr?.toString?.() ?? error?.stderr,
});
return {
additions: 0,
deletions: 0,
filePath,
isBinary: false,
patch: '',
status,
truncated: false,
};
}
text = error.stdout.toString();
}
if (text.length > MAX_PATCH_BYTES) {
return {
additions: 0,
deletions: 0,
filePath,
isBinary: false,
patch: '',
status,
truncated: true,
};
}
if (/^Binary files .* differ$/m.test(text)) {
return {
additions: 0,
deletions: 0,
filePath,
isBinary: true,
patch: '',
status,
truncated: false,
};
}
const { additions, deletions } = countAddDel(text);
return {
additions,
deletions,
filePath,
isBinary: false,
patch: text,
status,
truncated: false,
};
}),
);
// Step 3 — combine + sort to match the working-tree popover order.
const order: Record<GitFileDiffStatus, number> = { added: 0, modified: 1, deleted: 2 };
const allPatches: GitWorkingTreePatch[] = [...trackedPatches.values(), ...untrackedPatches];
allPatches.sort((a, b) => order[a.status] - order[b.status]);
return { patches: allPatches };
}
/**
* Diff every changed file between the current HEAD and the remote default
* branch (resolved via `refs/remotes/origin/HEAD` — typically `origin/main`
* or `origin/canary`). Uses `<base>...HEAD` so the result is "what this
* branch added since it forked", ignoring upstream-only commits.
*
* Best-effort `git fetch` first so the comparison reflects the latest
* remote state; fetch failures (offline / no creds / no `origin`) are
* swallowed and we fall back to whatever cached refs exist. Returns
* `baseRef: undefined` + empty patches when no remote default is set —
* the renderer surfaces a "noBaseRef" hint in that case.
*
* Patch parsing reuses the same bulk-split + size-cap path as the working
* tree variant; status comes from each diff block's preamble (no `git
* status` cross-reference needed since every block is from history).
*/
@IpcMethod()
async getGitBranchDiff(payload: GetGitBranchDiffPayload): Promise<GitBranchDiffPatches> {
const { path: dirPath, baseRef: baseRefOverride } = payload;
const MAX_PATCH_BYTES = 256 * 1024;
const execFileAsync = promisify(execFile);
// Step 1 — best-effort fetch so origin/<default> reflects remote HEAD.
try {
await execFileAsync('git', ['fetch', '--no-tags', '--quiet', 'origin'], {
cwd: dirPath,
timeout: 10_000,
});
} catch {
// swallow — fall through to cached refs
}
// Step 2 — pick the comparison base. When the caller passes an explicit
// override (e.g. user picked a non-default branch in the UI) we trust it;
// otherwise we resolve `refs/remotes/origin/HEAD`. The default may be
// missing on repos cloned with --no-checkout or after a remote rename —
// surface a "noBaseRef" empty state in that case so the user can run
// `git remote set-head origin --auto` themselves.
let baseRef: string | undefined = baseRefOverride;
if (!baseRef) {
try {
const { stdout } = await execFileAsync(
'git',
['symbolic-ref', '--short', 'refs/remotes/origin/HEAD'],
{ cwd: dirPath, timeout: 5000 },
);
baseRef = stdout.trim() || undefined;
} catch {
baseRef = undefined;
}
}
// headRef populated even when baseRef is missing so the UI can still
// surface "fix/foo ← ?" instead of going completely blank.
const headRef = (await this.getGitBranch(dirPath)).branch;
if (!baseRef) {
return { headRef, patches: [] };
}
// Step 3 — single bulk diff against the merge base. Three-dot semantics
// (`base...HEAD`) ignore commits added to base after the branch forked,
// matching what users expect from "compare branch" UI on GitHub. Stream
// capture mirrors the working-tree path so multi-MB diffs land intact.
let bulkDiff = '';
try {
bulkDiff = await runGitCaptureStream(
dirPath,
['-c', 'core.quotepath=off', 'diff', '--no-color', `${baseRef}...HEAD`],
30_000,
);
} catch (error: any) {
logger.warn('[getGitBranchDiff] diff failed', {
baseRef,
cwd: dirPath,
stderr: error?.stderr?.toString?.() ?? error?.stderr,
});
if (typeof error?.partialStdout === 'string') bulkDiff = error.partialStdout;
}
// Step 4 — split + classify per-file from the diff preamble alone.
const patches: GitWorkingTreePatch[] = [];
for (const block of splitBulkDiff(bulkDiff)) {
const status = detectDiffBlockStatus(block.patch);
patches.push(buildTrackedPatch({ filePath: block.path, status }, block, MAX_PATCH_BYTES));
}
// Re-bucket so the UI sees added → modified → deleted (matches the
// working-tree popover order).
const order: Record<GitFileDiffStatus, number> = { added: 0, modified: 1, deleted: 2 };
patches.sort((a, b) => order[a.status] - order[b.status]);
return { baseRef, headRef, patches };
return { patches };
}
/**
@@ -1,10 +1,9 @@
import type { ChildProcess } from 'node:child_process';
import { spawn } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { access, appendFile, mkdir, writeFile } from 'node:fs/promises';
import { createHash, randomUUID } from 'node:crypto';
import { access, appendFile, mkdir, readFile, writeFile } from 'node:fs/promises';
import path from 'node:path';
import type { Readable, Writable } from 'node:stream';
import { finished as streamFinished } from 'node:stream/promises';
import type { HeterogeneousAgentSessionError } from '@lobechat/electron-client-ipc';
import {
@@ -14,17 +13,14 @@ import {
CODEX_CLI_INSTALL_DOCS_URL,
HeterogeneousAgentSessionErrorCode,
} from '@lobechat/electron-client-ipc';
import type { AgentContentBlock } from '@lobechat/heterogeneous-agents/spawn';
import {
AgentStreamPipeline,
buildAgentInput,
materializeImageToPath,
normalizeImage,
} from '@lobechat/heterogeneous-agents/spawn';
import { app as electronApp, BrowserWindow } from 'electron';
import { getHeterogeneousAgentDriver } from '@/modules/heterogeneousAgent';
import type { HeterogeneousAgentImageAttachment } from '@/modules/heterogeneousAgent/types';
import { CodexFileChangeTracker } from '@/modules/heterogeneousAgent/codexFileChangeTracker';
import type {
HeterogeneousAgentImageAttachment,
HeterogeneousAgentParsedOutput,
} from '@/modules/heterogeneousAgent/types';
import { buildProxyEnv } from '@/modules/networkProxy/envBuilder';
import { detectHeterogeneousCliCommand } from '@/modules/toolDetectors';
import { createLogger } from '@/utils/logger';
@@ -56,6 +52,16 @@ const CODEX_RESUME_CWD_MISMATCH_PATTERNS = [
/** Directory under appStoragePath for caching downloaded files */
const FILE_CACHE_DIR = 'heteroAgent/files';
const CLI_TRACE_DIR = '.heerogeneous-tracing';
const IMAGE_EXTENSIONS_BY_MIME = {
'image/gif': '.gif',
'image/jpg': '.jpg',
'image/jpeg': '.jpg',
'image/pjpeg': '.jpg',
'image/png': '.png',
'image/webp': '.webp',
'image/x-png': '.png',
} as const satisfies Record<string, string>;
const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
const CODEX_STDERR_STATUS_LINE = 'Reading prompt from stdin...';
const CODEX_WARN_LOG_PATTERN = /^\d{4}-\d{2}-\d{2}T\S+\s+WARN\s+/;
const CODEX_LOG_PATTERN = /^\d{4}-\d{2}-\d{2}T\S+\s+(?:DEBUG|ERROR|INFO|TRACE|WARN)\s+/;
@@ -85,12 +91,6 @@ interface StartSessionResult {
interface SendPromptParams {
/** Image attachments to include in the prompt (downloaded from url, cached by id) */
imageList?: HeterogeneousAgentImageAttachment[];
/**
* Renderer-side operation id stamped onto every emitted `AgentStreamEvent`.
* Required: producer-side conversion is the V3 contract — by the time events
* reach the renderer they must already carry the operation they belong to.
*/
operationId: string;
prompt: string;
sessionId: string;
}
@@ -148,7 +148,7 @@ interface CliTraceSession {
* prompt transport, resume semantics, and raw stream shape without turning
* this controller into a giant `switch`.
*
* Lifecycle: startSession → sendPrompt → (heteroAgentEvent broadcasts) → stopSession
* Lifecycle: startSession → sendPrompt → (heteroAgentRawLine broadcasts) → stopSession
*/
export default class HeterogeneousAgentCtr extends ControllerModule {
static override readonly groupName = 'heterogeneousAgent';
@@ -574,56 +574,125 @@ export default class HeterogeneousAgentCtr extends ControllerModule {
}
/**
* Convert a desktop image attachment list into shared content blocks. Each
* attachment's id is preserved as the cache key so repeated prompts hit the
* same on-disk entries.
* Derive a filesystem-safe cache key for attachments.
*
* Never use the raw image id as a path segment — upstream callers can persist
* arbitrary ids and path.join would treat traversal sequences as real
* directories. A stable hash preserves cache hits without trusting the id as a
* filename.
*/
private toImageContentBlocks(
imageList: HeterogeneousAgentImageAttachment[],
): AgentContentBlock[] {
return imageList.map((image) => ({
source: { id: image.id, type: 'url', url: image.url },
type: 'image',
}));
private getImageCacheKey(imageId: string): string {
return createHash('sha256').update(imageId).digest('hex');
}
/**
* Build a Claude Code stream-json user message with text + base64 images.
* Delegates to the shared `buildAgentInput`; the desktop wrapper exists only
* to preserve the helper signature consumed by existing drivers.
* Download an image by URL, with local disk cache keyed by id.
*/
private async buildStreamJsonInput(
prompt: string,
imageList: HeterogeneousAgentImageAttachment[] = [],
): Promise<string> {
const blocks: AgentContentBlock[] = [];
if (prompt && prompt.length > 0) blocks.push({ text: prompt, type: 'text' });
blocks.push(...this.toImageContentBlocks(imageList));
private async resolveImage(
image: HeterogeneousAgentImageAttachment,
): Promise<{ buffer: Buffer; mimeType: string }> {
const cacheDir = this.fileCacheDir;
const cacheKey = this.getImageCacheKey(image.id);
const metaPath = path.join(cacheDir, `${cacheKey}.meta`);
const dataPath = path.join(cacheDir, cacheKey);
const plan = await buildAgentInput('claude-code', blocks, { cacheDir: this.fileCacheDir });
return plan.stdin;
// Check cache first
try {
const metaRaw = await readFile(metaPath, 'utf8');
const meta = JSON.parse(metaRaw);
const buffer = await readFile(dataPath);
logger.debug('Image cache hit:', image.id);
return { buffer, mimeType: meta.mimeType || 'image/png' };
} catch {
// Cache miss — download
}
logger.info('Downloading image:', image.id);
const res = await fetch(image.url);
if (!res.ok)
throw new Error(`Failed to download image ${image.id}: ${res.status} ${res.statusText}`);
const arrayBuffer = await res.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
const mimeType = res.headers.get('content-type') || 'image/png';
// Write to cache
await mkdir(cacheDir, { recursive: true });
await writeFile(dataPath, buffer);
await writeFile(metaPath, JSON.stringify({ id: image.id, mimeType }));
logger.debug('Image cached:', image.id, `${buffer.length} bytes`);
return { buffer, mimeType };
}
private normalizeMimeType(mimeType: string): string {
return mimeType.split(';')[0]?.trim().toLowerCase() || '';
}
private guessImageExtensionByBuffer(buffer: Buffer): string | undefined {
if (buffer.subarray(0, PNG_SIGNATURE.length).equals(PNG_SIGNATURE)) return '.png';
if (buffer[0] === 0xff && buffer[1] === 0xd8 && buffer[2] === 0xff) return '.jpg';
const gifSignature = buffer.subarray(0, 6).toString('ascii');
if (gifSignature === 'GIF87a' || gifSignature === 'GIF89a') return '.gif';
if (
buffer.subarray(0, 4).toString('ascii') === 'RIFF' &&
buffer.subarray(8, 12).toString('ascii') === 'WEBP'
) {
return '.webp';
}
}
private guessImageExtension(
mimeType: string,
image: HeterogeneousAgentImageAttachment,
buffer: Buffer,
): string | undefined {
const knownByMime = IMAGE_EXTENSIONS_BY_MIME[this.normalizeMimeType(mimeType)];
if (knownByMime) return knownByMime;
try {
const pathname = new URL(image.url).pathname;
const ext = path.extname(pathname).toLowerCase();
if (ext) return ext === '.jpeg' ? '.jpg' : ext;
} catch {
// Fall through to byte sniffing below.
}
return this.guessImageExtensionByBuffer(buffer);
}
/**
* Materialize image attachments into stable filesystem paths for path-mode
* agents (Codex `--image <file>`). Fails the prompt if any image cannot be
* fetched / decoded — partially-attached prompts confuse the agent more
* than they help.
* Materialize an image attachment into a stable local file path so CLIs like
* Codex can consume it through `--image <file>`.
*/
private async resolveCliImagePath(image: HeterogeneousAgentImageAttachment): Promise<string> {
const { buffer, mimeType } = await this.resolveImage(image);
const cacheKey = this.getImageCacheKey(image.id);
const ext = this.guessImageExtension(mimeType, image, buffer);
if (!ext) {
throw new Error(`Unsupported image type for ${image.id}`);
}
const filePath = path.join(this.fileCacheDir, `${cacheKey}${ext}`);
try {
await access(filePath);
} catch {
await mkdir(this.fileCacheDir, { recursive: true });
await writeFile(filePath, buffer);
}
return filePath;
}
private async resolveCliImagePaths(
imageList: HeterogeneousAgentImageAttachment[] = [],
): Promise<string[]> {
if (imageList.length === 0) return [];
const cacheDir = this.fileCacheDir;
const results = await Promise.allSettled(
imageList.map(async (image) => {
const normalized = await normalizeImage(
{ id: image.id, type: 'url', url: image.url },
{ cacheDir },
);
return materializeImageToPath(normalized, cacheDir);
}),
imageList.map((image) => this.resolveCliImagePath(image)),
);
const imagePaths: string[] = [];
@@ -649,6 +718,38 @@ export default class HeterogeneousAgentCtr extends ControllerModule {
return imagePaths;
}
/**
* Build a stream-json user message with text + optional image content blocks.
*/
private async buildStreamJsonInput(
prompt: string,
imageList: HeterogeneousAgentImageAttachment[] = [],
): Promise<string> {
const content: any[] = [];
if (prompt && prompt.length > 0) content.push({ text: prompt, type: 'text' });
for (const image of imageList) {
try {
const { buffer, mimeType } = await this.resolveImage(image);
content.push({
source: {
data: buffer.toString('base64'),
media_type: mimeType,
type: 'base64',
},
type: 'image',
});
} catch (err) {
logger.error(`Failed to resolve image ${image.id}:`, err);
}
}
return `${JSON.stringify({
message: { content, role: 'user' },
type: 'user',
})}\n`;
}
// ─── IPC methods ───
/**
@@ -679,9 +780,8 @@ export default class HeterogeneousAgentCtr extends ControllerModule {
/**
* Send a prompt to an agent session.
*
* Spawns the CLI process with preset flags. Pipes each stdout chunk through
* the shared `AgentStreamPipeline` (JSONL → adapter → toStreamEvent) and
* broadcasts the resulting `AgentStreamEvent`s on `heteroAgentEvent`.
* Spawns the CLI process with preset flags. Broadcasts each stdout line
* as an `heteroAgentRawLine` event — Renderer side parses and adapts.
*/
@IpcMethod()
async sendPrompt(params: SendPromptParams): Promise<void> {
@@ -753,49 +853,42 @@ export default class HeterogeneousAgentCtr extends ControllerModule {
}
session.process = proc;
// Producer-side conversion (V3 contract): JSONL framing + adapter +
// toStreamEvent all run inside the shared pipeline, so renderer + future
// server `heteroIngest` see the same `AgentStreamEvent` wire shape with
// no per-consumer adapter. The pipeline auto-wires the Codex
// file-change line-stat tracker when `agentType === 'codex'`, so this
// controller stays agent-agnostic.
const pipeline = new AgentStreamPipeline({
agentType: session.agentType,
operationId: params.operationId,
});
const streamProcessor = driver.createStreamProcessor();
const codexFileChangeTracker =
session.agentType === 'codex' ? new CodexFileChangeTracker() : undefined;
let stdoutBroadcastQueue: Promise<void> = Promise.resolve();
const broadcastPipelineBatch = (produce: () => ReturnType<AgentStreamPipeline['push']>) => {
const broadcastParsedOutputs = (parsedOutputs: HeterogeneousAgentParsedOutput[]) => {
stdoutBroadcastQueue = stdoutBroadcastQueue
.then(async () => {
const events = await produce();
// Adapter-extracted CC/Codex session id powers `--resume` on the
// next prompt; surface it through the existing `getSessionInfo`
// IPC by mirroring the freshest value onto the session record.
if (pipeline.sessionId && pipeline.sessionId !== session.agentSessionId) {
session.agentSessionId = pipeline.sessionId;
}
for (const event of events) {
this.broadcast('heteroAgentEvent', {
event,
for (const parsedOutput of parsedOutputs) {
if (parsedOutput.agentSessionId) {
session.agentSessionId = parsedOutput.agentSessionId;
}
const line = codexFileChangeTracker
? await codexFileChangeTracker.track(parsedOutput.payload)
: parsedOutput.payload;
this.broadcast('heteroAgentRawLine', {
line,
sessionId: session.sessionId,
});
}
})
.catch((error) => {
logger.error('Failed to broadcast agent stream batch:', error);
logger.error('Failed to broadcast parsed agent output:', error);
});
};
// Stream stdout events through the producer pipeline.
// Stream stdout events as raw provider payloads to Renderer.
const stdout = proc.stdout as Readable;
stdout.on('data', (chunk: Buffer) => {
void this.appendCliTraceFile(traceSession, 'stdout.jsonl', chunk);
broadcastPipelineBatch(() => pipeline.push(chunk));
broadcastParsedOutputs(streamProcessor.push(chunk));
});
stdout.on('end', () => {
broadcastPipelineBatch(() => pipeline.flush());
broadcastParsedOutputs(streamProcessor.flush());
});
// Capture stderr
@@ -822,59 +915,44 @@ export default class HeterogeneousAgentCtr extends ControllerModule {
});
proc.on('exit', (code, signal) => {
// Node may emit `'exit'` BEFORE stdio finishes draining (documented:
// child_process docs note "stdio streams might still be open" at exit
// time). Wait for stdout to fully end/close so the `stdout.on('end')`
// handler has scheduled `pipeline.flush()` onto `stdoutBroadcastQueue`,
// THEN wait for the queue itself to settle. Without this two-step
// gate, trailing flushed events (final synthesized tool_end /
// tool_result) would race against — and lose to — the
// `heteroAgentSessionComplete` broadcast, leaving renderer-side
// persistence to finalize on incomplete state.
const stdoutDrained = streamFinished(stdout, { writable: false }).catch(() => {
/* end / close / error are all "done"; we still want to settle. */
});
void stdoutDrained
.then(() => stdoutBroadcastQueue)
.finally(async () => {
void this.writeCliTraceJson(traceSession, 'exit.json', {
code,
finishedAt: new Date().toISOString(),
signal,
});
await this.flushCliTrace(traceSession);
logger.info('Agent process exited:', { code, sessionId: session.sessionId, signal });
session.process = undefined;
// If *we* killed it (cancel / stop / before-quit), treat the non-zero
// exit as a clean shutdown — surfacing it as an error would make a
// user-initiated cancel look like an agent failure, and an Electron
// shutdown affecting OTHER running CC sessions would pollute their
// topics with a misleading "Agent exited with code 143" message.
if (session.cancelledByUs) {
this.broadcast('heteroAgentSessionComplete', { sessionId: session.sessionId });
resolve();
return;
}
if (code === 0) {
this.broadcast('heteroAgentSessionComplete', { sessionId: session.sessionId });
resolve();
} else {
const stderrOutput = stderrChunks.join('').trim();
const errorMsg = this.getExitErrorMessage(code, session, stderrOutput);
const sessionError = this.getSessionErrorPayload(errorMsg, session);
this.broadcast('heteroAgentSessionError', {
error: sessionError,
sessionId: session.sessionId,
});
reject(
new Error(typeof sessionError === 'string' ? sessionError : sessionError.message),
);
}
void stdoutBroadcastQueue.finally(async () => {
void this.writeCliTraceJson(traceSession, 'exit.json', {
code,
finishedAt: new Date().toISOString(),
signal,
});
await this.flushCliTrace(traceSession);
logger.info('Agent process exited:', { code, sessionId: session.sessionId, signal });
session.process = undefined;
// If *we* killed it (cancel / stop / before-quit), treat the non-zero
// exit as a clean shutdown — surfacing it as an error would make a
// user-initiated cancel look like an agent failure, and an Electron
// shutdown affecting OTHER running CC sessions would pollute their
// topics with a misleading "Agent exited with code 143" message.
if (session.cancelledByUs) {
this.broadcast('heteroAgentSessionComplete', { sessionId: session.sessionId });
resolve();
return;
}
if (code === 0) {
this.broadcast('heteroAgentSessionComplete', { sessionId: session.sessionId });
resolve();
} else {
const stderrOutput = stderrChunks.join('').trim();
const errorMsg = this.getExitErrorMessage(code, session, stderrOutput);
const sessionError = this.getSessionErrorPayload(errorMsg, session);
this.broadcast('heteroAgentSessionError', {
error: sessionError,
sessionId: session.sessionId,
});
reject(
new Error(typeof sessionError === 'string' ? sessionError : sessionError.message),
);
}
});
});
});
}
@@ -38,7 +38,6 @@ import {
} from '@lobechat/electron-client-ipc';
import {
editLocalFile,
expandTilde,
listLocalFiles,
moveLocalFiles,
readLocalFile,
@@ -575,7 +574,7 @@ export default class LocalFileCtr extends ControllerModule {
*/
@IpcMethod()
async handleLocalFilesSearch(params: LocalSearchFilesParams): Promise<FileResult[]> {
const effectiveDirectory = expandTilde(params.directory ?? params.scope);
const effectiveDirectory = params.directory ?? params.scope;
logger.debug('Received file search request:', {
directory: params.directory,
@@ -19,26 +19,6 @@ export default class TrayMenuCtr extends ControllerModule {
mainWindow.toggleVisible();
}
/**
* Get whether the application tray is visible.
*/
@IpcMethod()
getAppTrayVisible(): boolean {
return this.app.storeManager.get('appTrayVisible', true);
}
/**
* Persist and apply application tray visibility.
*/
@IpcMethod()
setAppTrayVisible(visible: boolean) {
logger.debug(`Set app tray visibility: ${visible}`);
this.app.storeManager.set('appTrayVisible', visible);
this.app.trayManager.setAppTrayVisible(visible);
return { success: true };
}
/**
* Show tray balloon notification
* @param options Balloon options
@@ -433,23 +433,18 @@ describe('GatewayConnectionCtr', () => {
}
it.each([
['readFile', 'readFile', mockLocalFileCtr],
['listFiles', 'listLocalFiles', mockLocalFileCtr],
['moveFiles', 'handleMoveFiles', mockLocalFileCtr],
['searchFiles', 'handleLocalFilesSearch', mockLocalFileCtr],
['writeFile', 'handleWriteFile', mockLocalFileCtr],
['editFile', 'handleEditFile', mockLocalFileCtr],
['globFiles', 'handleGlobFiles', mockLocalFileCtr],
['readLocalFile', 'readFile', mockLocalFileCtr],
['listLocalFiles', 'listLocalFiles', mockLocalFileCtr],
['moveLocalFiles', 'handleMoveFiles', mockLocalFileCtr],
['renameLocalFile', 'handleRenameFile', mockLocalFileCtr],
['searchLocalFiles', 'handleLocalFilesSearch', mockLocalFileCtr],
['writeLocalFile', 'handleWriteFile', mockLocalFileCtr],
['editLocalFile', 'handleEditFile', mockLocalFileCtr],
['globLocalFiles', 'handleGlobFiles', mockLocalFileCtr],
['grepContent', 'handleGrepContent', mockLocalFileCtr],
['runCommand', 'handleRunCommand', mockShellCommandCtr],
['getCommandOutput', 'handleGetCommandOutput', mockShellCommandCtr],
['killCommand', 'handleKillCommand', mockShellCommandCtr],
// Legacy aliases — older Gateway versions may still send the long form.
// `renameLocalFile` is kept even though the new surface drops rename.
['readLocalFile', 'readFile', mockLocalFileCtr],
['listLocalFiles', 'listLocalFiles', mockLocalFileCtr],
['writeLocalFile', 'handleWriteFile', mockLocalFileCtr],
['renameLocalFile', 'handleRenameFile', mockLocalFileCtr],
] as const)('should route %s to %s', async (apiName, methodName, controller) => {
const client = await connectAndOpen();
const args = { test: 'arg' };
@@ -475,7 +470,7 @@ describe('GatewayConnectionCtr', () => {
});
const client = await connectAndOpen();
client.simulateToolCallRequest('readFile', { path: '/a.txt' }, 'req-42');
client.simulateToolCallRequest('readLocalFile', { path: '/a.txt' }, 'req-42');
await vi.advanceTimersByTimeAsync(0);
expect(client.sendToolCallResponse).toHaveBeenCalledWith({
@@ -502,7 +497,7 @@ describe('GatewayConnectionCtr', () => {
vi.mocked(mockLocalFileCtr.readFile).mockRejectedValueOnce(new Error('File not found'));
const client = await connectAndOpen();
client.simulateToolCallRequest('readFile', { path: '/missing' }, 'req-err');
client.simulateToolCallRequest('readLocalFile', { path: '/missing' }, 'req-err');
await vi.advanceTimersByTimeAsync(0);
expect(client.sendToolCallResponse).toHaveBeenCalledWith({
@@ -1,81 +0,0 @@
import { describe, expect, it, vi } from 'vitest';
import { dequoteGitPath, quoteGitPath } from '../GitCtr';
vi.mock('@/utils/logger', () => ({
createLogger: () => ({
debug: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
error: vi.fn(),
}),
}));
describe('quoteGitPath', () => {
it('leaves plain ASCII paths unquoted (including spaces)', () => {
expect(quoteGitPath('a/', 'src/foo.ts')).toBe('a/src/foo.ts');
expect(quoteGitPath('b/', 'src/foo bar.ts')).toBe('b/src/foo bar.ts');
expect(quoteGitPath('a/', 'with-dash_and.underscore')).toBe('a/with-dash_and.underscore');
});
it('C-style escapes TAB / LF / CR / quote / backslash', () => {
expect(quoteGitPath('b/', 'with\ttab.txt')).toBe('"b/with\\ttab.txt"');
expect(quoteGitPath('b/', 'with\nlf.txt')).toBe('"b/with\\nlf.txt"');
expect(quoteGitPath('b/', 'with\rcr.txt')).toBe('"b/with\\rcr.txt"');
expect(quoteGitPath('b/', 'with"quote.txt')).toBe('"b/with\\"quote.txt"');
expect(quoteGitPath('b/', 'with\\backslash.txt')).toBe('"b/with\\\\backslash.txt"');
});
it('octal-escapes other control bytes (NUL, 0x1F, DEL)', () => {
expect(quoteGitPath('a/', 'nul\x00here')).toBe('"a/nul\\000here"');
expect(quoteGitPath('a/', 'unit\x1Fsep')).toBe('"a/unit\\037sep"');
expect(quoteGitPath('a/', 'del\x7Fchar')).toBe('"a/del\\177char"');
});
it('puts the prefix inside the quotes', () => {
// Real git output for `git diff` of a tab-containing file:
// diff --git "a/with\there" "b/with\there"
expect(quoteGitPath('a/', 'with\there')).toBe('"a/with\\there"');
expect(quoteGitPath('b/', 'with\there')).toBe('"b/with\\there"');
});
it('round-trips through dequoteGitPath for problem characters', () => {
const cases = [
'with\ttab.txt',
'with\nlf.txt',
'with\rcr.txt',
'with"quote.txt',
'with\\backslash.txt',
'nul\x00inside',
'mix\t"of\\everything\n',
];
for (const original of cases) {
const quoted = quoteGitPath('b/', original);
// Strip the surrounding quotes + b/ prefix, then de-escape.
expect(quoted.startsWith('"b/')).toBe(true);
expect(quoted.endsWith('"')).toBe(true);
const stripped = quoted.slice(1, -1).slice('b/'.length);
expect(dequoteGitPath(stripped)).toBe(original);
}
});
});
describe('dequoteGitPath', () => {
it('decodes named C-style escapes', () => {
expect(dequoteGitPath('with\\ttab')).toBe('with\ttab');
expect(dequoteGitPath('with\\nlf')).toBe('with\nlf');
expect(dequoteGitPath('with\\rcr')).toBe('with\rcr');
expect(dequoteGitPath('with\\"quote')).toBe('with"quote');
expect(dequoteGitPath('with\\\\bs')).toBe('with\\bs');
});
it('decodes 3-digit octal escapes', () => {
expect(dequoteGitPath('nul\\000here')).toBe('nul\x00here');
expect(dequoteGitPath('unit\\037sep')).toBe('unit\x1Fsep');
expect(dequoteGitPath('del\\177char')).toBe('del\x7Fchar');
});
it('leaves unescaped chars alone', () => {
expect(dequoteGitPath('plain ascii here')).toBe('plain ascii here');
});
});
@@ -11,12 +11,8 @@ import HeterogeneousAgentCtr from '../HeterogeneousAgentCtr';
const FAKE_DESKTOP_PATH = '/Users/fake/Desktop';
const { mockGetAllWindows } = vi.hoisted(() => ({
mockGetAllWindows: vi.fn<() => any[]>(() => []),
}));
vi.mock('electron', () => ({
BrowserWindow: { getAllWindows: () => mockGetAllWindows() },
BrowserWindow: { getAllWindows: () => [] },
app: {
getPath: vi.fn((name: string) => (name === 'desktop' ? FAKE_DESKTOP_PATH : `/fake/${name}`)),
isPackaged: false,
@@ -118,24 +114,13 @@ describe('HeterogeneousAgentCtr', () => {
await rm(appStoragePath, { force: true, recursive: true });
});
describe('image cache (delegates to shared `normalizeImage`)', () => {
// Image fetch + cache moved to `@lobechat/heterogeneous-agents/spawn`'s
// `normalizeImage`. The desktop controller passes its own cacheDir so the
// path-traversal invariant — id segments like `../../foo` MUST be hashed,
// never used as path segments — is enforced by the shared helper. Verify
// that invariant against the same cacheDir the controller would use.
const fixtureCacheDir = (storage: string) => path.join(storage, 'heteroAgent/files');
const importNormalize = async () => {
const { mkdir } = await import('node:fs/promises');
const mod = await import('@lobechat/heterogeneous-agents/spawn');
return { mkdir, normalizeImage: mod.normalizeImage };
};
describe('resolveImage', () => {
it('stores traversal-looking ids inside the cache root via a stable hash key', async () => {
const { mkdir, normalizeImage } = await importNormalize();
const cacheDir = fixtureCacheDir(appStoragePath);
await mkdir(cacheDir, { recursive: true });
const ctr = new HeterogeneousAgentCtr({
appStoragePath,
storeManager: { get: vi.fn() },
} as any);
const cacheDir = path.join(appStoragePath, 'heteroAgent/files');
const escapedTargetName = `${path.basename(appStoragePath)}-outside-storage`;
const escapePath = path.join(cacheDir, `../../../${escapedTargetName}`);
@@ -145,14 +130,10 @@ describe('HeterogeneousAgentCtr', () => {
// best-effort cleanup
}
await normalizeImage(
{
id: `../../../${escapedTargetName}`,
type: 'url',
url: 'data:text/plain;base64,T1VUU0lERQ==',
},
{ cacheDir, fetcher: (async () => new Response('OUTSIDE', { status: 200 })) as any },
);
await (ctr as any).resolveImage({
id: `../../../${escapedTargetName}`,
url: 'data:text/plain;base64,T1VUU0lERQ==',
});
const cacheEntries = await readdir(cacheDir);
@@ -168,10 +149,11 @@ describe('HeterogeneousAgentCtr', () => {
});
it('does not trust pre-seeded out-of-root traversal cache files as cache hits', async () => {
const { mkdir, normalizeImage } = await importNormalize();
const cacheDir = fixtureCacheDir(appStoragePath);
await mkdir(cacheDir, { recursive: true });
const ctr = new HeterogeneousAgentCtr({
appStoragePath,
storeManager: { get: vi.fn() },
} as any);
const cacheDir = path.join(appStoragePath, 'heteroAgent/files');
const traversalId = '../../preexisting-secret';
const outOfRootDataPath = path.join(cacheDir, traversalId);
const outOfRootMetaPath = path.join(cacheDir, `${traversalId}.meta`);
@@ -182,20 +164,13 @@ describe('HeterogeneousAgentCtr', () => {
JSON.stringify({ id: traversalId, mimeType: 'text/plain' }),
);
const result = await normalizeImage(
{ id: traversalId, type: 'url', url: 'data:text/plain;base64,SUdOT1JFRA==' },
{
cacheDir,
fetcher: (async () =>
new Response('IGNORED', {
headers: { 'content-type': 'text/plain' },
status: 200,
})) as any,
},
);
const result = await (ctr as any).resolveImage({
id: traversalId,
url: 'data:text/plain;base64,SUdOT1JFRA==',
});
expect(Buffer.from(result.buffer).toString('utf8')).toBe('IGNORED');
expect(result.mediaType).toBe('text/plain');
expect(result.mimeType).toBe('text/plain');
await expect(readFile(outOfRootDataPath, 'utf8')).resolves.toBe('SECRET');
});
});
@@ -224,7 +199,7 @@ describe('HeterogeneousAgentCtr', () => {
command: 'claude',
...sessionOverrides,
});
await ctr.sendPrompt({ operationId: 'op-test', prompt, sessionId, ...sendPromptOverrides });
await ctr.sendPrompt({ prompt, sessionId, ...sendPromptOverrides });
const { args: cliArgs, command, options } = spawnCalls[0];
return { cliArgs, command, ctr, options, sessionId, writes };
@@ -339,7 +314,7 @@ describe('HeterogeneousAgentCtr', () => {
command: 'codex',
...sessionOverrides,
});
await ctr.sendPrompt({ operationId: 'op-test', prompt, sessionId, ...sendPromptOverrides });
await ctr.sendPrompt({ prompt, sessionId, ...sendPromptOverrides });
const { args: cliArgs, command, options } = spawnCalls[0];
return { cliArgs, command, ctr, options, sessionId, writes };
@@ -357,9 +332,9 @@ describe('HeterogeneousAgentCtr', () => {
command: 'codex',
});
await expect(
ctr.sendPrompt({ operationId: 'op-test', prompt: 'hello', sessionId }),
).rejects.toThrow('Codex CLI was not found');
await expect(ctr.sendPrompt({ prompt: 'hello', sessionId })).rejects.toThrow(
'Codex CLI was not found',
);
expect(detect).toHaveBeenCalledWith('codex', true);
expect(spawnCalls).toHaveLength(0);
@@ -377,9 +352,9 @@ describe('HeterogeneousAgentCtr', () => {
command: 'claude',
});
await expect(
ctr.sendPrompt({ operationId: 'op-test', prompt: 'hello', sessionId }),
).rejects.toThrow('Claude Code CLI was not found');
await expect(ctr.sendPrompt({ prompt: 'hello', sessionId })).rejects.toThrow(
'Claude Code CLI was not found',
);
expect(detect).toHaveBeenCalledWith('claude', true);
expect(spawnCalls).toHaveLength(0);
@@ -415,9 +390,9 @@ describe('HeterogeneousAgentCtr', () => {
command: 'claude-alt',
});
await expect(
ctr.sendPrompt({ operationId: 'op-test', prompt: 'hello', sessionId }),
).rejects.toThrow('Claude Code CLI was not found');
await expect(ctr.sendPrompt({ prompt: 'hello', sessionId })).rejects.toThrow(
'Claude Code CLI was not found',
);
expect(detect).not.toHaveBeenCalled();
expect(spawnCalls).toHaveLength(0);
@@ -518,7 +493,6 @@ describe('HeterogeneousAgentCtr', () => {
await expect(
ctr.sendPrompt({
imageList,
operationId: 'op-test',
prompt: 'inspect the screenshots',
sessionId,
}),
@@ -552,9 +526,9 @@ describe('HeterogeneousAgentCtr', () => {
command: 'codex',
});
await expect(
ctr.sendPrompt({ operationId: 'op-test', prompt: 'hello', sessionId }),
).rejects.toThrow('Agent exited with code 1');
await expect(ctr.sendPrompt({ prompt: 'hello', sessionId })).rejects.toThrow(
'Agent exited with code 1',
);
});
it('uses codex exec resume syntax when continuing an existing thread', async () => {
@@ -698,108 +672,4 @@ describe('HeterogeneousAgentCtr', () => {
});
});
});
/**
* Node may emit `proc.on('exit')` BEFORE stdout fully drains (documented in
* child_process docs as "stdio streams might still be open"). The phase 0
* refactor moved adapter ownership to main, so renderer no longer flushes
* its own adapter on session-complete — meaning trailing events from
* `pipeline.flush()` (e.g. Codex's synthesized `tool_end` for unfinished
* tool calls) would race against — and lose to — the
* `heteroAgentSessionComplete` broadcast without an explicit gate.
*
* The fix in `proc.on('exit')` is to await stdout `'end'/'close'` (so the
* `stdout.on('end')` handler can schedule `pipeline.flush()` onto the
* broadcast queue), then drain the queue, then broadcast complete.
*/
describe('exit-before-end ordering (LOBE-8516 phase 0 race)', () => {
let broadcasts: Array<{ channel: string; data: any }>;
beforeEach(() => {
spawnCalls.length = 0;
execFileMock.mockReset();
broadcasts = [];
mockGetAllWindows.mockImplementation(() => [
{
isDestroyed: () => false,
webContents: {
send: (channel: string, data: any) => broadcasts.push({ channel, data }),
},
},
]);
});
afterEach(() => {
mockGetAllWindows.mockReset();
mockGetAllWindows.mockReturnValue([]);
});
it('delivers pipeline.flush() events BEFORE heteroAgentSessionComplete even when proc exit precedes stdout end', async () => {
// Codex `item.started` for a tool — adapter buffers it as a pending
// tool call. On flush, adapter synthesizes a trailing `tool_end`. This
// is exactly the kind of event the race would lose against complete.
const itemStarted = `${JSON.stringify({
item: {
aggregated_output: '',
command: 'echo hi',
id: 'cmd-1',
status: 'in_progress',
type: 'command_execution',
},
type: 'item.started',
})}\n`;
const threadStarted = `${JSON.stringify({ thread_id: 't1', type: 'thread.started' })}\n`;
const proc = new EventEmitter() as any;
const stdout = new PassThrough();
const stderr = new PassThrough();
proc.stdout = stdout;
proc.stderr = stderr;
proc.stdin = {
end: vi.fn(),
write: vi.fn((_chunk: any, cb?: () => void) => {
cb?.();
return true;
}),
};
proc.kill = vi.fn();
proc.killed = false;
proc.__start = () => {
setImmediate(() => {
stdout.write(threadStarted);
stdout.write(itemStarted);
stderr.end();
// ⚠️ Reproduce the documented Node race: emit exit BEFORE stdout
// ends. Without the streamFinished gate in the controller, the
// broadcast queue settles immediately (no flush queued yet) and
// complete fires before the trailing tool_end ever broadcasts.
proc.emit('exit', 0);
setImmediate(() => stdout.end());
});
};
nextFakeProc = proc;
const ctr = new HeterogeneousAgentCtr({
appStoragePath,
storeManager: { get: vi.fn() },
} as any);
const { sessionId } = await ctr.startSession({ agentType: 'codex', command: 'codex' });
await ctr.sendPrompt({ operationId: 'op-test', prompt: 'hello', sessionId });
const events = broadcasts.filter((b) => b.channel === 'heteroAgentEvent');
const completeIdx = broadcasts.findIndex((b) => b.channel === 'heteroAgentSessionComplete');
const lastEventIdx = broadcasts.findLastIndex((b) => b.channel === 'heteroAgentEvent');
expect(completeIdx).toBeGreaterThan(-1);
expect(events.length).toBeGreaterThan(0);
// Every stream event must land before complete — no trailing events
// sneak in after the renderer has been told the session is done.
expect(lastEventIdx).toBeLessThan(completeIdx);
// Specifically: the synthesized tool_end for the pending command
// execution (emitted only by adapter.flush()) is in the broadcast.
const toolEnds = events.filter((b) => (b.data as any)?.event?.type === 'tool_end');
expect(toolEnds.length).toBeGreaterThan(0);
});
});
});
@@ -40,21 +40,13 @@ const mockDisplayBalloon = vi.fn();
const mockUpdateIcon = vi.fn();
const mockUpdateTooltip = vi.fn();
const mockGetMainTray = vi.fn();
const mockSetAppTrayVisible = vi.fn();
const mockStoreGet = vi.fn(() => true);
const mockStoreSet = vi.fn();
const mockApp = {
browserManager: {
getMainWindow: mockGetMainWindow,
},
storeManager: {
get: mockStoreGet,
set: mockStoreSet,
},
trayManager: {
getMainTray: mockGetMainTray,
setAppTrayVisible: mockSetAppTrayVisible,
},
} as unknown as App;
@@ -66,31 +58,9 @@ describe('TrayMenuCtr', () => {
ipcMainHandleMock.mockClear();
// Reset mockedTray for each test
mockGetMainTray.mockReset();
mockStoreGet.mockReturnValue(true);
trayMenuCtr = new TrayMenuCtr(mockApp);
});
describe('getAppTrayVisible', () => {
it('should return stored app tray visibility', () => {
mockStoreGet.mockReturnValue(false);
const result = trayMenuCtr.getAppTrayVisible();
expect(mockStoreGet).toHaveBeenCalledWith('appTrayVisible', true);
expect(result).toBe(false);
});
});
describe('setAppTrayVisible', () => {
it('should persist and apply app tray visibility', () => {
const result = trayMenuCtr.setAppTrayVisible(false);
expect(mockStoreSet).toHaveBeenCalledWith('appTrayVisible', false);
expect(mockSetAppTrayVisible).toHaveBeenCalledWith(false);
expect(result).toEqual({ success: true });
});
});
// Restore platform settings after all tests complete
afterAll(() => {
// Restore the original platform
@@ -39,12 +39,6 @@ export class TrayManager {
initializeTrays() {
logger.debug('Initialize application tray');
if (!this.app.storeManager.get('appTrayVisible', true)) {
logger.debug('Application tray is disabled by user settings');
this.destroyAll();
return;
}
// Initialize main tray
const mainTray = this.initializeMainTray();
@@ -64,19 +58,6 @@ export class TrayManager {
return this.retrieveByIdentifier('main');
}
/**
* Toggle the application tray at runtime.
*/
setAppTrayVisible(visible: boolean) {
logger.debug(`Set application tray visible: ${visible}`);
if (visible) {
this.initializeTrays();
} else {
this.destroyAll();
}
}
/**
* Initialize main tray. On macOS we ship a template image (black + alpha)
* so the system recolors it automatically for light / dark menu bars.
@@ -55,9 +55,6 @@ describe('TrayManager', () => {
menuManager: {
buildTrayMenu: vi.fn(() => ({ _mockMenu: true }) as any),
},
storeManager: {
get: vi.fn(() => true),
},
} as unknown as App;
// Mock Tray constructor
@@ -96,15 +93,6 @@ describe('TrayManager', () => {
expect(mockApp.menuManager.buildTrayMenu).toHaveBeenCalled();
expect(mockTray.setMenu).toHaveBeenCalledWith({ _mockMenu: true });
});
it('should skip tray initialization when app tray is disabled', () => {
vi.mocked(mockApp.storeManager.get).mockReturnValue(false);
trayManager.initializeTrays();
expect(Tray).not.toHaveBeenCalled();
expect(trayManager.trays.size).toBe(0);
});
});
describe('initializeMainTray', () => {
@@ -285,24 +273,6 @@ describe('TrayManager', () => {
});
});
describe('setAppTrayVisible', () => {
it('should initialize trays when visible is true', () => {
trayManager.setAppTrayVisible(true);
expect(Tray).toHaveBeenCalled();
expect(trayManager.trays.has('main')).toBe(true);
});
it('should destroy all trays when visible is false', () => {
trayManager.initializeTrays();
trayManager.setAppTrayVisible(false);
expect(mockTray.destroy).toHaveBeenCalled();
expect(trayManager.trays.size).toBe(0);
});
});
describe('retrieveOrInitialize (private method)', () => {
it('should create new tray when it does not exist', () => {
const options = {
@@ -75,7 +75,6 @@ const menu = {
'tray.open': 'Open {{appName}}',
'tray.quickChat': 'Quick Chat',
'tray.quit': 'Quit',
'tray.settings': 'Settings',
'tray.show': 'Show {{appName}}',
'view.forceReload': 'Force Reload',
'view.reload': 'Reload',
@@ -63,9 +63,7 @@ const createMockApp = () => {
'dev.devPanel': 'Dev Panel',
'tray.openMiniToolbar': 'Quick Composer',
'tray.open': `Open ${params?.appName || 'App'}`,
'tray.quickChat': 'Quick Chat',
'tray.quit': 'Quit',
'tray.settings': 'Settings',
};
return translations[key] || key;
});
@@ -199,7 +197,6 @@ describe('LinuxMenu', () => {
const template = (Menu.buildFromTemplate as any).mock.calls[0][0];
expect(template.length).toBeGreaterThan(0);
expect(template.some((item: any) => item.label?.includes('Open'))).toBe(true);
expect(template.some((item: any) => item.label === 'Settings')).toBe(true);
expect(template.some((item: any) => item.label === 'Quit')).toBe(true);
});
});
+1 -1
View File
@@ -466,7 +466,7 @@ export class LinuxMenu extends BaseMenuPlatform implements IMenuPlatform {
{ type: 'separator' },
{
click: () => this.app.browserManager.retrieveByIdentifier('settings').show(),
label: t('tray.settings'),
label: t('file.preferences'),
},
{ type: 'separator' },
{ label: t('tray.quit'), role: 'quit' },
@@ -31,19 +31,6 @@ vi.mock('electron', () => ({
},
}));
vi.mock('electron-is', () => ({
macOS: vi.fn(() => true),
}));
vi.mock('@/utils/logger', () => ({
createLogger: () => ({
debug: vi.fn(),
error: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
}),
}));
// Mock isDev
vi.mock('@/const/env', () => ({
isDev: false,
@@ -190,7 +177,6 @@ describe('MacOSMenu', () => {
const template = (Menu.buildFromTemplate as any).mock.calls[0][0];
expect(template.length).toBeGreaterThan(0);
expect(template.some((item: any) => item.label?.includes('Show'))).toBe(true);
expect(template.some((item: any) => item.label === 'Settings')).toBe(true);
expect(template.some((item: any) => item.label === 'Quit')).toBe(true);
});
+1 -1
View File
@@ -694,7 +694,7 @@ export class MacOSMenu extends BaseMenuPlatform implements IMenuPlatform {
mainWindow.show();
mainWindow.broadcast('navigate', { path: '/settings' });
},
label: t('tray.settings'),
label: t('file.preferences'),
},
{ type: 'separator' },
{ label: t('tray.quit'), role: 'quit' },
@@ -58,9 +58,7 @@ const createMockApp = () => {
'dev.devPanel': 'Dev Panel',
'tray.openMiniToolbar': 'Quick Composer',
'tray.open': `Open ${params?.appName || 'App'}`,
'tray.quickChat': 'Quick Chat',
'tray.quit': 'Quit',
'tray.settings': 'Settings',
};
return translations[key] || key;
});
@@ -181,7 +179,6 @@ describe('WindowsMenu', () => {
const template = (Menu.buildFromTemplate as any).mock.calls[0][0];
expect(template.length).toBeGreaterThan(0);
expect(template.some((item: any) => item.label?.includes('Open'))).toBe(true);
expect(template.some((item: any) => item.label === 'Settings')).toBe(true);
expect(template.some((item: any) => item.label === 'Quit')).toBe(true);
});
});
+1 -1
View File
@@ -473,7 +473,7 @@ export class WindowsMenu extends BaseMenuPlatform implements IMenuPlatform {
{ type: 'separator' },
{
click: () => this.app.browserManager.retrieveByIdentifier('settings').show(),
label: t('tray.settings'),
label: t('file.preferences'),
},
{ type: 'separator' },
{ label: t('tray.quit'), role: 'quit' },
@@ -1,48 +0,0 @@
import { describe, expect, it, vi } from 'vitest';
import { buildFilenameKeywordExpression } from '../impl/macOS';
vi.mock('@/utils/logger', () => ({
createLogger: () => ({
debug: vi.fn(),
error: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
}),
}));
describe('buildFilenameKeywordExpression', () => {
it('produces a single substring term for one keyword', () => {
expect(buildFilenameKeywordExpression('package.json')).toBe(
'kMDItemFSName == "*package.json*"cd',
);
});
it('splits whitespace-separated keywords into AND-ed substring terms', () => {
// Critical fix: a free-form keyword string from the LLM (e.g. "LobeHub
// Financial Statement") used to require that exact phrase to appear in the
// filename. Real files reorder words and use _/-/. as separators, so the
// literal phrase almost never matched. AND-ing per-token substrings keeps
// each token literal but removes the order constraint.
expect(buildFilenameKeywordExpression('LobeHub Financial Statement')).toBe(
'(kMDItemFSName == "*LobeHub*"cd && kMDItemFSName == "*Financial*"cd && kMDItemFSName == "*Statement*"cd)',
);
});
it('collapses repeated whitespace and trims surrounding spaces', () => {
expect(buildFilenameKeywordExpression(' foo \t\n bar ')).toBe(
'(kMDItemFSName == "*foo*"cd && kMDItemFSName == "*bar*"cd)',
);
});
it('escapes embedded double quotes in each token', () => {
expect(buildFilenameKeywordExpression('foo "bar" baz')).toBe(
'(kMDItemFSName == "*foo*"cd && kMDItemFSName == "*\\"bar\\"*"cd && kMDItemFSName == "*baz*"cd)',
);
});
it('returns an empty string when keywords are blank', () => {
expect(buildFilenameKeywordExpression('')).toBe('');
expect(buildFilenameKeywordExpression(' \t ')).toBe('');
});
});
@@ -1,69 +0,0 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { LinuxSearchServiceImpl } from '../impl/linux';
vi.mock('node:os', () => ({
homedir: vi.fn().mockReturnValue('/Users/test-home'),
platform: vi.fn().mockReturnValue('linux'),
}));
vi.mock('@/utils/logger', () => ({
createLogger: () => ({
debug: vi.fn(),
error: vi.fn(),
info: vi.fn(),
warn: vi.fn(),
}),
}));
const fgMock = vi.fn();
vi.mock('fast-glob', () => ({
default: (...args: unknown[]) => fgMock(...args),
}));
const execaMock = vi.fn();
vi.mock('execa', () => ({
execa: (...args: unknown[]) => execaMock(...args),
}));
vi.mock('node:fs/promises', () => ({
stat: vi.fn().mockResolvedValue({
atime: new Date(),
birthtime: new Date(),
isDirectory: () => false,
mtime: new Date(),
size: 0,
}),
}));
describe('UnixFileSearch glob fallback root', () => {
beforeEach(() => {
fgMock.mockReset();
execaMock.mockReset();
// Force the Unix tool selection to fall through to fast-glob so we
// don't have to mock fd/find availability checks.
execaMock.mockRejectedValue(new Error('command not found'));
fgMock.mockResolvedValue([]);
});
it('runs glob inside the user home directory when no scope is provided', async () => {
// Regression: previously fell back to process.cwd(), which inside a
// packaged Electron app is the bundle path — making `**/*foo*` searches
// effectively look at nothing user-visible.
const impl = new LinuxSearchServiceImpl();
await impl.glob({ pattern: '**/*report*' });
expect(fgMock).toHaveBeenCalledTimes(1);
const [pattern, options] = fgMock.mock.calls[0] as [string, { cwd: string }];
expect(pattern).toBe('**/*report*');
expect(options.cwd).toBe('/Users/test-home');
});
it('honors an explicit scope over the home-directory fallback', async () => {
const impl = new LinuxSearchServiceImpl();
await impl.glob({ pattern: '**/*.ts', scope: '/Users/test-home/Downloads' });
const [, options] = fgMock.mock.calls[0] as [string, { cwd: string }];
expect(options.cwd).toBe('/Users/test-home/Downloads');
});
});
@@ -13,29 +13,6 @@ import { UnixFileSearch } from './unix';
const logger = createLogger('module:FileSearch:macOS');
/**
* Build the kMDItemFSName expression for a free-form keyword string.
*
* Splits on whitespace and ANDs each token as a case/diacritic-insensitive
* substring match, so "Foo Bar" matches both `Bar_Foo.pdf` and `Foo Bar.pdf`
* — instead of requiring the literal phrase "Foo Bar" to appear.
*
* Returns an empty string when the keywords contain no usable token.
*/
export const buildFilenameKeywordExpression = (keywords: string): string => {
const tokens = keywords
.trim()
.split(/\s+/)
.filter(Boolean)
.map((token) => token.replaceAll('"', '\\"'));
if (tokens.length === 0) return '';
const term = (token: string) => `kMDItemFSName == "*${token}*"cd`;
if (tokens.length === 1) return term(tokens[0]);
return `(${tokens.map(term).join(' && ')})`;
};
/**
* Fallback tool type for macOS file search
* Priority: mdfind > fd > find > fast-glob
@@ -118,16 +95,7 @@ export class MacOSSearchServiceImpl extends UnixFileSearch {
* Search using Spotlight (mdfind)
*/
private async searchWithSpotlight(options: SearchOptions): Promise<FileResult[]> {
const { cmd, args, commandString, hasQuery } = this.buildSearchCommand(options);
// Spotlight (mdfind) requires a query expression; running it with only flags
// (e.g. -onlyin) makes mdfind print its usage to stdout and we'd treat each
// line as a fake file. Short-circuit to an empty result instead.
if (!hasQuery) {
logger.warn('Skipping mdfind: no keywords/contentContains/fileTypes/date filter provided');
return [];
}
const { cmd, args, commandString } = this.buildSearchCommand(options);
logger.debug(`Executing command: ${commandString}`);
try {
@@ -208,7 +176,6 @@ export class MacOSSearchServiceImpl extends UnixFileSearch {
args: string[];
cmd: string;
commandString: string;
hasQuery: boolean;
} {
const cmd = 'mdfind';
const args: string[] = [];
@@ -237,7 +204,7 @@ export class MacOSSearchServiceImpl extends UnixFileSearch {
if (options.keywords) {
if (!options.keywords.includes('kMDItem')) {
queryExpression = buildFilenameKeywordExpression(options.keywords);
queryExpression = `kMDItemFSName == "*${options.keywords.replaceAll('"', '\\"')}*"cd`;
} else {
queryExpression = options.keywords;
}
@@ -304,15 +271,13 @@ export class MacOSSearchServiceImpl extends UnixFileSearch {
}
}
const hasQuery = Boolean(queryExpression);
if (hasQuery) {
if (queryExpression) {
args.push(queryExpression);
}
const commandString = `${cmd} ${args.map((arg) => (arg.includes(' ') || arg.includes('*') ? `"${arg}"` : arg)).join(' ')}`;
return { args, cmd, commandString, hasQuery };
return { args, cmd, commandString };
}
/**
@@ -323,7 +288,7 @@ export class MacOSSearchServiceImpl extends UnixFileSearch {
options: SearchOptions,
engine?: string,
): Promise<FileResult[]> {
const resultPromises = filePaths.map(async (filePath): Promise<FileResult | null> => {
const resultPromises = filePaths.map(async (filePath) => {
try {
const stats = await stat(filePath);
@@ -348,15 +313,23 @@ export class MacOSSearchServiceImpl extends UnixFileSearch {
return result;
} catch (error) {
// Drop the row instead of fabricating a 0-byte placeholder. mdfind
// occasionally returns non-path lines (e.g. usage text when the query
// is malformed) which would otherwise render as phantom files.
logger.warn(`Dropping unstattable search hit ${filePath}: ${(error as Error).message}`);
return null;
logger.warn(`Error processing file stats for ${filePath}: ${(error as Error).message}`);
return {
contentType: 'unknown',
createdTime: new Date(),
engine,
isDirectory: false,
lastAccessTime: new Date(),
modifiedTime: new Date(),
name: path.basename(filePath),
path: filePath,
size: 0,
type: path.extname(filePath).toLowerCase().replace('.', ''),
};
}
});
let results = (await Promise.all(resultPromises)).filter((r): r is FileResult => r !== null);
let results = await Promise.all(resultPromises);
if (options.sortBy) {
results = this.sortResults(results, options.sortBy, options.sortDirection);
@@ -337,7 +337,7 @@ export abstract class UnixFileSearch extends BaseFileSearch {
* @returns Glob results
*/
protected async globWithFd(params: GlobFilesParams): Promise<GlobFilesResult> {
const searchPath = params.scope || os.homedir() || process.cwd();
const searchPath = params.scope || process.cwd();
const logPrefix = `[glob:fd: ${params.pattern}]`;
logger.debug(`${logPrefix} Starting fd glob`, { searchPath });
@@ -393,7 +393,7 @@ export abstract class UnixFileSearch extends BaseFileSearch {
* @returns Glob results
*/
protected async globWithFind(params: GlobFilesParams): Promise<GlobFilesResult> {
const searchPath = params.scope || os.homedir() || process.cwd();
const searchPath = params.scope || process.cwd();
const logPrefix = `[glob:find: ${params.pattern}]`;
logger.debug(`${logPrefix} Starting find glob`, { searchPath });
@@ -455,7 +455,7 @@ export abstract class UnixFileSearch extends BaseFileSearch {
* @returns Glob results
*/
protected async globWithFastGlob(params: GlobFilesParams): Promise<GlobFilesResult> {
const searchPath = params.scope || os.homedir() || process.cwd();
const searchPath = params.scope || process.cwd();
const logPrefix = `[glob:fast-glob: ${params.pattern}]`;
logger.debug(`${logPrefix} Starting fast-glob`, { searchPath });
@@ -335,7 +335,7 @@ export class WindowsSearchServiceImpl extends BaseFileSearch {
* @returns Glob results
*/
private async globWithFd(params: GlobFilesParams): Promise<GlobFilesResult> {
const searchPath = params.scope || os.homedir() || process.cwd();
const searchPath = params.scope || process.cwd();
const logPrefix = `[glob:fd: ${params.pattern}]`;
logger.debug(`${logPrefix} Starting fd glob`, { searchPath });
@@ -390,7 +390,7 @@ export class WindowsSearchServiceImpl extends BaseFileSearch {
* @returns Glob results
*/
private async globWithFastGlob(params: GlobFilesParams): Promise<GlobFilesResult> {
const searchPath = params.scope || os.homedir() || process.cwd();
const searchPath = params.scope || process.cwd();
const logPrefix = `[glob:fast-glob: ${params.pattern}]`;
logger.debug(`${logPrefix} Starting fast-glob`, { searchPath });
@@ -23,10 +23,6 @@ interface CodexFileChangePayload {
type?: string;
}
type CodexFileChangePayloadWithId = CodexFileChangePayload & {
item: CodexFileChangeItem & { id: string };
};
interface CodexFileChangeLineStats {
linesAdded: number;
linesDeleted: number;
@@ -40,7 +36,7 @@ interface CodexTrackedFileChangeItem extends CodexFileChangeItem, CodexFileChang
const isCodexFileChangePayload = (
payload: CodexFileChangePayload,
): payload is CodexFileChangePayloadWithId =>
): payload is Required<CodexFileChangePayload> =>
payload?.item?.type === 'file_change' && !!payload.item.id;
const readTextFileSnapshot = async (filePath: string): Promise<CodexFileChangeSnapshot> => {
@@ -1,3 +1,4 @@
import { JsonlStreamProcessor } from '../jsonlProcessor';
import type { HeterogeneousAgentBuildPlanParams, HeterogeneousAgentDriver } from '../types';
const CLAUDE_CODE_BASE_ARGS = [
@@ -31,4 +32,10 @@ export const claudeCodeDriver: HeterogeneousAgentDriver = {
stdinPayload,
};
},
createStreamProcessor() {
return new JsonlStreamProcessor({
extractSessionId: (payload) =>
payload?.type === 'system' && payload?.subtype === 'init' ? payload?.session_id : undefined,
});
},
};
@@ -1,3 +1,4 @@
import { JsonlStreamProcessor } from '../jsonlProcessor';
import type { HeterogeneousAgentBuildPlanParams, HeterogeneousAgentDriver } from '../types';
const CODEX_REQUIRED_ARGS = ['--json', '--skip-git-repo-check'] as const;
@@ -40,4 +41,10 @@ export const codexDriver: HeterogeneousAgentDriver = {
stdinPayload: prompt,
};
},
createStreamProcessor() {
return new JsonlStreamProcessor({
extractSessionId: (payload) =>
payload?.type === 'thread.started' ? payload?.thread_id : undefined,
});
},
};
@@ -0,0 +1,61 @@
import type { HeterogeneousAgentParsedOutput, HeterogeneousAgentStreamProcessor } from './types';
export interface JsonlProcessorOptions {
extractSessionId?: (payload: any) => string | undefined;
}
/**
* Parses stdout as JSONL / NDJSON while tolerating non-JSON noise lines.
* Different CLIs still end up sharing this framing logic even when the
* payload schema differs.
*/
export class JsonlStreamProcessor implements HeterogeneousAgentStreamProcessor {
private buffer = '';
constructor(private readonly options: JsonlProcessorOptions = {}) {}
push(chunk: Buffer | string): HeterogeneousAgentParsedOutput[] {
this.buffer += chunk instanceof Buffer ? chunk.toString('utf8') : chunk;
return this.drainCompleteLines();
}
flush(): HeterogeneousAgentParsedOutput[] {
const trailing = this.buffer.trim();
this.buffer = '';
if (!trailing) return [];
try {
return [this.toParsedOutput(JSON.parse(trailing))];
} catch {
return [];
}
}
private drainCompleteLines(): HeterogeneousAgentParsedOutput[] {
const lines = this.buffer.split('\n');
this.buffer = lines.pop() || '';
const parsed: HeterogeneousAgentParsedOutput[] = [];
for (const line of lines) {
const trimmed = line.trim();
if (!trimmed) continue;
try {
parsed.push(this.toParsedOutput(JSON.parse(trimmed)));
} catch {
// Ignore non-JSON stdout noise.
}
}
return parsed;
}
private toParsedOutput(payload: any): HeterogeneousAgentParsedOutput {
return {
agentSessionId: this.options.extractSessionId?.(payload),
payload,
};
}
}
@@ -24,13 +24,19 @@ export interface HeterogeneousAgentBuildPlanParams {
resumeSessionId?: string;
}
/**
* Per-agent CLI flag composition + stdin shape. Stream framing is no longer the
* driver's concern — `AgentStreamPipeline` (`@lobechat/heterogeneous-agents/spawn`)
* runs JSONL parsing + adapter conversion uniformly for every agent type.
*/
export interface HeterogeneousAgentParsedOutput {
agentSessionId?: string;
payload: any;
}
export interface HeterogeneousAgentStreamProcessor {
flush: () => HeterogeneousAgentParsedOutput[];
push: (chunk: Buffer | string) => HeterogeneousAgentParsedOutput[];
}
export interface HeterogeneousAgentDriver {
buildSpawnPlan: (
params: HeterogeneousAgentBuildPlanParams,
) => Promise<HeterogeneousAgentBuildPlan>;
createStreamProcessor: () => HeterogeneousAgentStreamProcessor;
}
@@ -2,7 +2,6 @@ import { randomUUID } from 'node:crypto';
import os from 'node:os';
import type {
AgentRunRequestMessage,
SystemInfoRequestMessage,
ToolCallRequestMessage,
} from '@lobechat/device-gateway-client';
@@ -22,10 +21,6 @@ interface ToolCallHandler {
(apiName: string, args: any): Promise<unknown>;
}
interface AgentRunHandler {
(request: AgentRunRequestMessage): Promise<{ reason?: string; status: 'accepted' | 'rejected' }>;
}
/**
* GatewayConnectionService
*
@@ -40,7 +35,6 @@ export default class GatewayConnectionService extends ServiceModule {
private tokenProvider: (() => Promise<string | null>) | null = null;
private tokenRefresher: (() => Promise<{ error?: string; success: boolean }>) | null = null;
private toolCallHandler: ToolCallHandler | null = null;
private agentRunHandler: AgentRunHandler | null = null;
// ─── Configuration ───
@@ -65,10 +59,6 @@ export default class GatewayConnectionService extends ServiceModule {
this.toolCallHandler = handler;
}
setAgentRunHandler(handler: AgentRunHandler) {
this.agentRunHandler = handler;
}
// ─── Device ID ───
loadOrCreateDeviceId() {
@@ -188,10 +178,6 @@ export default class GatewayConnectionService extends ServiceModule {
this.handleSystemInfoRequest(client, request);
});
client.on('agent_run_request', (request) => {
this.handleAgentRunRequest(client, request);
});
client.on('auth_expired', () => {
logger.warn('Received auth_expired, will reconnect with refreshed token');
this.handleAuthExpired();
@@ -253,30 +239,6 @@ export default class GatewayConnectionService extends ServiceModule {
});
}
// ─── Agent Run ───
private handleAgentRunRequest = async (
client: GatewayClient,
request: AgentRunRequestMessage,
) => {
logger.info(
`Received agent_run_request: operationId=${request.operationId} type=${request.agentType}`,
);
if (!this.agentRunHandler) {
logger.warn('No agent run handler configured, rejecting request');
client.sendAgentRunAck({
operationId: request.operationId,
reason: 'no handler',
status: 'rejected',
});
return;
}
const result = await this.agentRunHandler(request);
client.sendAgentRunAck({ operationId: request.operationId, ...result });
};
// ─── Tool Call Routing ───
private handleToolCallRequest = async (
-1
View File
@@ -5,7 +5,6 @@ import type {
} from '@lobechat/electron-client-ipc';
export interface ElectronMainStore {
appTrayVisible: boolean;
dataSyncConfig: DataSyncConfig;
encryptedTokens: {
accessToken?: string;
+2 -56
View File
@@ -1,23 +1,8 @@
import { describe, expect, it, vi } from 'vitest';
import { describe, expect, it } from 'vitest';
import { resolveOverlayModelSelectionPayload, shouldShowOverlayModelSelector } from './ChatPanel';
import { resolvePanelPlacement } from './panelPlacement';
vi.mock('./chatPanel.css.ts', () => new Proxy({}, { get: (_, key) => String(key) }));
vi.mock('./cn', () => ({
cn: (...classes: Array<string | false | null | undefined>) => classes.filter(Boolean).join(' '),
}));
vi.mock('./Avatar', () => ({
default: () => null,
}));
vi.mock('@lobehub/icons', () => ({
ModelIcon: () => null,
}));
describe('ChatPanel', () => {
describe('resolvePanelPlacement', () => {
it('keeps the last selection placement while a reselection is in progress', () => {
expect(
resolvePanelPlacement({
@@ -45,43 +30,4 @@ describe('ChatPanel', () => {
width: 420,
});
});
it('hides the model selector and omits model payload for heterogeneous agents', () => {
const heterogeneousAgent = {
heterogeneousType: 'codex',
id: 'agent-codex',
title: 'Codex Agent',
};
expect(shouldShowOverlayModelSelector(heterogeneousAgent)).toBe(false);
expect(
resolveOverlayModelSelectionPayload({
agent: heterogeneousAgent,
model: { id: 'gpt-4.1', provider: 'openai' },
modelId: 'gpt-4.1',
}),
).toEqual({
modelId: undefined,
provider: undefined,
});
});
it('keeps the model selector and payload for regular agents', () => {
const regularAgent = {
id: 'agent-regular',
title: 'Regular Agent',
};
expect(shouldShowOverlayModelSelector(regularAgent)).toBe(true);
expect(
resolveOverlayModelSelectionPayload({
agent: regularAgent,
model: { id: 'gpt-4.1', provider: 'openai' },
modelId: 'gpt-4.1',
}),
).toEqual({
modelId: 'gpt-4.1',
provider: 'openai',
});
});
});
+34 -71
View File
@@ -57,25 +57,6 @@ export interface ChatPanelProps {
viewportWidth: number;
}
export const shouldShowOverlayModelSelector = (agent?: ScreenCaptureAgentOption) =>
!agent?.heterogeneousType;
export const resolveOverlayModelSelectionPayload = ({
agent,
model,
modelId,
}: {
agent?: ScreenCaptureAgentOption;
model?: ScreenCaptureModelOption;
modelId?: string;
}) => {
if (!shouldShowOverlayModelSelector(agent)) {
return { modelId: undefined, provider: undefined };
}
return { modelId, provider: model?.provider };
};
const formatBytes = (rect: Rect): string =>
`${Math.round(rect.width)} × ${Math.round(rect.height)} · ${OVERLAY_COPY.selectionFormatLabel}`;
@@ -159,7 +140,6 @@ const ChatPanel = memo<ChatPanelProps>(
() => models?.find((item) => item.id === modelId),
[models, modelId],
);
const showModelSelector = shouldShowOverlayModelSelector(currentAgent);
useEffect(() => {
if (!initialAgentId) return;
@@ -296,29 +276,14 @@ const ChatPanel = memo<ChatPanelProps>(
const submit = useCallback(() => {
if (selections.length === 0 || !prompt.trim() || !allUploadsReady) return;
const modelSelection = resolveOverlayModelSelectionPayload({
agent: currentAgent,
model: currentModel,
modelId,
});
onSubmit({
agentId,
captureIds: selections.map((item) => item.captureId),
modelId: modelSelection.modelId,
modelId,
prompt: prompt.trim(),
provider: modelSelection.provider,
provider: currentModel?.provider,
});
}, [
selections,
prompt,
agentId,
currentAgent,
modelId,
currentModel,
onSubmit,
allUploadsReady,
]);
}, [selections, prompt, agentId, modelId, currentModel, onSubmit, allUploadsReady]);
const handleKeyDown = useCallback(
(e: ReactKeyboardEvent<HTMLTextAreaElement>) => {
@@ -499,40 +464,38 @@ const ChatPanel = memo<ChatPanelProps>(
</select>
</label>
{showModelSelector && (
<label
aria-label={OVERLAY_COPY.modelSelectLabel}
className={cn(styles.selectChip, !hasModels && styles.selectChipDisabled)}
>
{currentModel ? (
<span className={styles.modelIconBox}>
<ModelIcon model={currentModel.id} size={16} />
</span>
) : (
<span className={styles.modelIconBoxFallback} />
)}
<span className={styles.chipLabel}>
{currentModel?.displayName ??
currentModel?.id ??
OVERLAY_COPY.modelSelectPlaceholder}
<label
aria-label={OVERLAY_COPY.modelSelectLabel}
className={cn(styles.selectChip, !hasModels && styles.selectChipDisabled)}
>
{currentModel ? (
<span className={styles.modelIconBox}>
<ModelIcon model={currentModel.id} size={16} />
</span>
<ChevronDownIcon className={styles.chevron} size={12} strokeWidth={2} />
<select
aria-label={OVERLAY_COPY.modelSelectLabel}
className={styles.nativeSelect}
disabled={!hasModels}
value={modelId ?? ''}
onChange={handleModelChange}
>
{!hasModels && <option value="">{OVERLAY_COPY.modelSelectPlaceholder}</option>}
{models?.map((item) => (
<option key={item.id} value={item.id}>
{item.displayName ?? item.id}
</option>
))}
</select>
</label>
)}
) : (
<span className={styles.modelIconBoxFallback} />
)}
<span className={styles.chipLabel}>
{currentModel?.displayName ??
currentModel?.id ??
OVERLAY_COPY.modelSelectPlaceholder}
</span>
<ChevronDownIcon className={styles.chevron} size={12} strokeWidth={2} />
<select
aria-label={OVERLAY_COPY.modelSelectLabel}
className={styles.nativeSelect}
disabled={!hasModels}
value={modelId ?? ''}
onChange={handleModelChange}
>
{!hasModels && <option value="">{OVERLAY_COPY.modelSelectPlaceholder}</option>}
{models?.map((item) => (
<option key={item.id} value={item.id}>
{item.displayName ?? item.id}
</option>
))}
</select>
</label>
</div>
<div className={styles.actionBarRight}>
+2 -2
View File
@@ -484,8 +484,8 @@ export const connectorHidden = style({
});
const fadeIn = keyframes({
from: { opacity: 0, transform: 'translateY(8px)' },
to: { opacity: 1, transform: 'translateY(0)' },
from: { opacity: 0, transform: 'translate(-50%, 8px)' },
to: { opacity: 1, transform: 'translate(-50%, 0)' },
});
const spin = keyframes({
@@ -1,10 +1,7 @@
export const BRANDING_LOGO_URL = '';
export const BRANDING_NAME = 'LobeHub';
export const DEFAULT_EMBEDDING_PROVIDER = 'openai';
export const DEFAULT_MINI_MODEL = 'gpt-5.4-mini';
export const DEFAULT_MINI_PROVIDER = 'openai';
export const DEFAULT_MODEL = 'deepseek-v4-pro';
export const DEFAULT_ONBOARDING_MODEL = 'gemini-3-flash-preview';
export const DEFAULT_ONBOARDING_PROVIDER = 'google';
export const DEFAULT_PROVIDER = 'deepseek';
export const DEFAULT_PROVIDER = 'openai';
export const ORG_NAME = 'LobeHub';
+5 -66
View File
@@ -2,7 +2,7 @@ import { DurableObject } from 'cloudflare:workers';
import { Hono } from 'hono';
import { resolveSocketAuth, verifyApiKeyToken, verifyDesktopToken } from './auth';
import type { AgentRunRequestMessage, DeviceAttachment, Env } from './types';
import type { DeviceAttachment, Env } from './types';
const AUTH_TIMEOUT = 10_000; // 10s to authenticate after connect
const HEARTBEAT_TIMEOUT = 90_000; // 90s without heartbeat → close
@@ -31,9 +31,6 @@ export class DeviceGatewayDO extends DurableObject<Env> {
.post('/api/device/system-info', async (c) => {
return this.handleSystemInfo(c.req.raw);
})
.post('/api/device/agent/run', async (c) => {
return this.handleAgentRun(c.req.raw);
})
.all('/api/device/devices', async () => {
const sockets = this.getAuthenticatedSockets();
const devices = sockets.map((ws) => ws.deserializeAttachment() as DeviceAttachment);
@@ -105,16 +102,12 @@ export class DeviceGatewayDO extends DurableObject<Env> {
if (!att.authenticated) return;
// ─── Business messages (authenticated only) ───
if (
data.type === 'tool_call_response' ||
data.type === 'system_info_response' ||
data.type === 'agent_run_ack'
) {
const pending = this.pendingRequests.get(data.requestId ?? data.operationId);
if (data.type === 'tool_call_response' || data.type === 'system_info_response') {
const pending = this.pendingRequests.get(data.requestId);
if (pending) {
clearTimeout(pending.timer);
pending.resolve(data.type === 'agent_run_ack' ? data : data.result);
this.pendingRequests.delete(data.requestId ?? data.operationId);
pending.resolve(data.result);
this.pendingRequests.delete(data.requestId);
}
}
@@ -285,60 +278,6 @@ export class DeviceGatewayDO extends DurableObject<Env> {
}
}
// ─── Agent Run RPC ───
private async handleAgentRun(request: Request): Promise<Response> {
const sockets = this.getAuthenticatedSockets();
if (sockets.length === 0) {
return Response.json({ error: 'DEVICE_OFFLINE', success: false }, { status: 503 });
}
const body = (await request.json()) as {
agentType: 'claude-code' | 'codex';
cwd?: string;
deviceId?: string;
jwt: string;
operationId: string;
prompt: string;
resumeSessionId?: string;
timeout?: number;
topicId: string;
};
const { deviceId, timeout = 10_000, ...runParams } = body;
const targetWs = deviceId
? sockets.find((ws) => {
const att = ws.deserializeAttachment() as DeviceAttachment;
return att.deviceId === deviceId;
})
: sockets[0];
if (!targetWs) {
return Response.json({ error: 'DEVICE_NOT_FOUND', success: false }, { status: 503 });
}
try {
const ack = await new Promise<{ status: string }>((resolve, reject) => {
const timer = setTimeout(() => {
this.pendingRequests.delete(runParams.operationId);
reject(new Error('TIMEOUT'));
}, timeout);
this.pendingRequests.set(runParams.operationId, { resolve, timer });
const msg: AgentRunRequestMessage = { type: 'agent_run_request', ...runParams };
targetWs.send(JSON.stringify(msg));
});
if (ack.status === 'rejected') {
return Response.json({ error: 'DEVICE_REJECTED', success: false }, { status: 422 });
}
return Response.json({ success: true });
} catch (err) {
return Response.json({ error: (err as Error).message, success: false }, { status: 504 });
}
}
// ─── Tool Call RPC ───
private async handleToolCall(request: Request): Promise<Response> {
-30
View File
@@ -92,42 +92,12 @@ export interface SystemInfoRequestMessage {
type: 'system_info_request';
}
/**
* CF Desktop: request the desktop to spawn `lh hetero exec` for a
* heterogeneous agent run. The JWT is operation-scoped (4h TTL) and only
* grants `heteroIngest` / `heteroFinish` for this operationId.
*/
export interface AgentRunRequestMessage {
agentType: 'claude-code' | 'codex';
/** Working directory to pass to `lh hetero exec --cwd`. */
cwd?: string;
/** Operation-scoped JWT signed by the server — inject as LOBEHUB_JWT env. */
jwt: string;
operationId: string;
/** Plain-text prompt to pass via `lh hetero exec --prompt`. */
prompt: string;
/** Native CLI session id for `lh hetero exec --resume`. */
resumeSessionId?: string;
topicId: string;
type: 'agent_run_request';
}
/** Desktop → CF: acknowledgement for an `agent_run_request`. */
export interface AgentRunAckMessage {
operationId: string;
reason?: string;
status: 'accepted' | 'rejected';
type: 'agent_run_ack';
}
export type ClientMessage =
| AgentRunAckMessage
| AuthMessage
| HeartbeatMessage
| SystemInfoResponseMessage
| ToolCallResponseMessage;
export type ServerMessage =
| AgentRunRequestMessage
| AuthExpiredMessage
| AuthFailedMessage
| AuthSuccessMessage
-5
View File
@@ -1,9 +1,4 @@
[
{
"children": {},
"date": "2026-05-01",
"version": "2.1.56"
},
{
"children": {},
"date": "2026-04-29",
+1 -2
View File
@@ -469,6 +469,5 @@
"https://github.com/user-attachments/assets/facdc83c-e789-4649-8060-7f7a10a1b1dd": "/blog/assets05b20e40c03ced0ec8707fed2e8e0f25.webp",
"https://github.com/user-attachments/assets/fcdfb9c5-819a-488f-b28d-0857fe861219": "/blog/assets8477415ecec1f37e38ab38ff1217d0a7.webp",
"https://github.com/user-attachments/assets/fd60ab55-ead2-4930-ad00-fdf77662f5a0": "/blog/assets276a4e8748e9bd300b30dcd9d0e24980.webp",
"https://file.rene.wang/clipboard-1777343750668-9b3dcb0dfff86.png": "/blog/assetsfa267a02f20bc5ba6f1273bcf27b7c9f.webp",
"https://file.rene.wang/Changelog-Seedance.png": "/blog/assetsb2bf4ddf0a45ff887a993c18cb7ab983.webp"
"https://file.rene.wang/clipboard-1777343750668-9b3dcb0dfff86.png": "/blog/assetsfa267a02f20bc5ba6f1273bcf27b7c9f.webp"
}
@@ -1,34 +0,0 @@
---
title: 'Delegate Claude Code and Codex'
description: >-
Delegate Claude Code and Codex from inside LobeHub, with a redesigned home, a Review tab for bulk git diffs, visual understanding, and a wave of new models.
tags:
- Coding agent
- Claude Code
- Home
- Review
- Models
---
# Delegate Claude Code and Codex
## Features
- New: Delegate Claude Code and Codex in LobeHub
- Agent-specific topic grouping: switch the topic list to group by agent, with a friendlier empty state
- Review tab: a new tab that aggregates bulk git diffs across a tree, \~9× faster on large repos
- Local file mention snapshots: drag a file into chat and a snapshot is captured for the model to reason over
- Visual understanding tool: a new built-in tool for image analysis and visual reasoning
- Line bot support: connect a Line channel as an agent endpoint
- New models: `grok-4.3`, DeepSeek Anthropic runtime, plus `gpt-image-2` and Grok 4.20 in the model library
## Improvements and fixes
- DeepSeek now shows pricing in the model card and respects model defaults.
- Document modal shows a skeleton while the title loads and surfaces the document update time in space.
- Agent documents can be exposed as a virtual file system with fs-compatible output.
- Sessions are revoked after a password reset, and tRPC pagination now enforces a max limit.
- Skill OAuth no longer breaks the desktop app by skipping `redirectUri` on Electron.
- CAPTCHA retries during sign-in are handled cleanly instead of failing the flow.
@@ -1,31 +0,0 @@
---
title: 在 LobeHub 中调度 Claude Code 与 Codex
description: 在 LobeHub 中直接调度 Claude Code 与 Codex,全新首页、批量 git diff 的 Review 标签页、视觉理解工具,以及一批新模型。
tags:
- 编程 Agent
- Claude Code
- 首页
- Review
- 模型
---
# 在 LobeHub 中调度 Claude Code 与 Codex
## 新功能
- 新增:在 LobeHub 中调度 Claude Code 与 Codex
- 按 Agent 分组话题:可将话题列表切换为按 Agent 分组,并带有更友好的空状态
- Review 标签页:新增 Review 标签页,可聚合树级别的批量 git diff,大型仓库下速度提升约 9 倍
- 本地文件提及快照:将文件拖入聊天即可生成快照供模型理解
- 视觉理解工具:内置的图像分析与视觉推理工具
- Line Bot 接入:可将 Line 频道作为 Agent 接入端
- 新模型:`grok-4.3`、DeepSeek Anthropic 运行时,以及模型库新增的 `gpt-image-2` 和 Grok 4.20
## 体验优化与修复
- DeepSeek 模型卡片展示价格并尊重模型默认配置。
- 文档弹窗在标题加载时显示骨架,并在 Space 中展示文档更新时间。
- Agent 文档可作为虚拟文件系统暴露,输出兼容 fs 接口。
- 重置密码后会立即吊销已有会话,tRPC 分页接口新增最大条数限制。
- 在桌面端跳过 Skill OAuth 的 `redirectUri`,避免应用进入异常状态。
- 登录流程中的 CAPTCHA 重试可正常处理,不再直接失败。
-9
View File
@@ -2,15 +2,6 @@
"$schema": "https://github.com/lobehub/lobe-chat/blob/main/docs/changelog/schema.json",
"cloud": [],
"community": [
{
"image": "/blog/assetsb2bf4ddf0a45ff887a993c18cb7ab983.webp",
"id": "2026-05-04-task-scheduler",
"date": "2026-05-04",
"versionRange": [
"2.1.54",
"2.1.56"
]
},
{
"image": "/blog/assetsfa267a02f20bc5ba6f1273bcf27b7c9f.webp",
"id": "2026-04-27-heterogeneous-agent",
+2 -2
View File
@@ -72,7 +72,7 @@ sequenceDiagram
After the user sends a message, `sendMessage()`
(`src/store/chat/slices/aiChat/actions/conversationLifecycle.ts`)
creates the user message and assistant message placeholder,
then calls `executeClientAgent()`.
then calls `internal_execAgentRuntime()`.
### 2. Agent Runtime Drives the Loop
@@ -325,7 +325,7 @@ depends on the scenario:
- **Client-side loop** (browser): Regular 1:1 chat,
continue generation, group orchestration decisions.
The loop runs in the browser, entry point is
`executeClientAgent()`
`internal_execAgentRuntime()`
(`src/store/chat/slices/aiChat/actions/streamingExecutor.ts`)
- **Server-side loop** (queue/local):
Group chat supervisor agent, sub-agent tasks,
+2 -2
View File
@@ -68,7 +68,7 @@ sequenceDiagram
用户发送消息后,`sendMessage()`
`src/store/chat/slices/aiChat/actions/conversationLifecycle.ts`
创建用户消息和助手消息占位,然后调用 `executeClientAgent()`。
创建用户消息和助手消息占位,然后调用 `internal_execAgentRuntime()`。
### 2. Agent Runtime 驱动循环
@@ -293,7 +293,7 @@ Agent Runtime 循环的执行位置取决于场景:
- **客户端循环**(浏览器):常规 1:1 对话、继续生成、
群组编排决策。循环在浏览器中运行,
入口为 `executeClientAgent()`
入口为 `internal_execAgentRuntime()`
`src/store/chat/slices/aiChat/actions/streamingExecutor.ts`
- **服务端循环**(队列 / 本地):群聊 supervisor agent、
子 agent 任务、API/Cron 触发。循环在服务端运行,
+1 -62
View File
@@ -868,48 +868,6 @@ table messages_files {
}
}
table messenger_account_links {
id uuid [pk, not null, default: `gen_random_uuid()`]
user_id text [not null]
platform varchar(50) [not null]
tenant_id varchar(255) [not null, default: '']
platform_user_id varchar(255) [not null]
platform_username text
active_agent_id text
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(platform, tenant_id, platform_user_id) [name: 'messenger_account_links_platform_tenant_user_unique', unique]
(user_id, platform, tenant_id) [name: 'messenger_account_links_user_platform_tenant_unique', unique]
active_agent_id [name: 'messenger_account_links_active_agent_idx']
}
}
table messenger_installations {
id uuid [pk, not null, default: `gen_random_uuid()`]
platform varchar(50) [not null]
tenant_id varchar(255) [not null]
application_id varchar(255) [not null]
account_id varchar(255)
credentials text [not null]
metadata jsonb [not null, default: `{}`]
token_expires_at "timestamp with time zone"
installed_by_user_id text
installed_by_platform_user_id varchar(255)
revoked_at "timestamp with time zone"
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
(platform, application_id, tenant_id) [name: 'messenger_installations_platform_app_tenant_unique', unique]
(platform, tenant_id) [name: 'messenger_installations_platform_tenant_idx']
token_expires_at [name: 'messenger_installations_token_expires_at_idx']
}
}
table nextauth_accounts {
access_token text
expires_at integer
@@ -1437,23 +1395,6 @@ table sessions {
}
}
table system_bot_providers {
id uuid [pk, not null, default: `gen_random_uuid()`]
platform varchar(50) [not null]
enabled boolean [not null, default: true]
credentials text [not null]
application_id varchar(255)
settings jsonb [not null, default: `{}`]
connection_mode varchar(20)
accessed_at "timestamp with time zone" [not null, default: `now()`]
created_at "timestamp with time zone" [not null, default: `now()`]
updated_at "timestamp with time zone" [not null, default: `now()`]
indexes {
platform [name: 'system_bot_providers_platform_unique', unique]
}
}
table briefs {
id text [pk, not null]
user_id text [not null]
@@ -1471,8 +1412,6 @@ table briefs {
resolved_comment text
read_at "timestamp with time zone"
resolved_at "timestamp with time zone"
trigger varchar(255)
metadata jsonb
created_at "timestamp with time zone" [not null, default: `now()`]
indexes {
@@ -1483,7 +1422,6 @@ table briefs {
type [name: 'briefs_type_idx']
priority [name: 'briefs_priority_idx']
(user_id, resolved_at) [name: 'briefs_unresolved_idx']
trigger [name: 'briefs_trigger_idx']
}
}
@@ -2005,6 +1943,7 @@ table user_memory_persona_documents {
}
}
ref: agent_skills.user_id - users.id
ref: agent_skills.zip_file_hash - global_files.hash_id
@@ -196,31 +196,6 @@ SSRF_ALLOW_IP_ADDRESS_LIST=192.168.1.100,10.0.0.50
- Default: -
- Example: `https://cdn.example.com`
## Visual Understanding
### `VISUAL_UNDERSTANDING_PROVIDER`
- Type: Optional
- Description: Provider ID of the fallback visual understanding model. Configure this together with `VISUAL_UNDERSTANDING_MODEL` to let models without native image or video understanding inspect uploaded visual media through the built-in visual understanding tool.
- Default: -
- Example: `openai`, `google`, or `ollama`
### `VISUAL_UNDERSTANDING_MODEL`
- Type: Optional
- Description: Model ID used by the fallback visual understanding tool. This model should support the visual media types you want to analyze. The feature is enabled only when both `VISUAL_UNDERSTANDING_PROVIDER` and `VISUAL_UNDERSTANDING_MODEL` are configured.
- Default: -
- Example: `gpt-4o`, `gemini-2.5-flash`, or your local visual model ID
Configuration example:
```bash
VISUAL_UNDERSTANDING_PROVIDER=google
VISUAL_UNDERSTANDING_MODEL=gemini-2.5-flash
```
When this feature is enabled, users can upload images or videos while using a model that does not have native visual capabilities, as long as the active model supports tool use. File upload still requires the normal file storage configuration for your deployment.
## AI Image
### `AI_IMAGE_DEFAULT_IMAGE_NUM`
@@ -191,31 +191,6 @@ SSRF_ALLOW_IP_ADDRESS_LIST=192.168.1.100,10.0.0.50
- 默认值:-
- 示例:`https://cdn.example.com`
## 视觉理解
### `VISUAL_UNDERSTANDING_PROVIDER`
- 类型:可选
- 描述:兜底视觉理解模型的服务商 ID。与 `VISUAL_UNDERSTANDING_MODEL` 一起配置后,不具备原生图片或视频理解能力的模型可以通过内置视觉理解工具分析上传的视觉媒体。
- 默认值:-
- 示例:`openai`、`google` 或 `ollama`
### `VISUAL_UNDERSTANDING_MODEL`
- 类型:可选
- 描述:内置视觉理解工具使用的模型 ID。该模型应支持你希望分析的视觉媒体类型。仅当 `VISUAL_UNDERSTANDING_PROVIDER` 与 `VISUAL_UNDERSTANDING_MODEL` 同时配置时,此功能才会启用。
- 默认值:-
- 示例:`gpt-4o`、`gemini-2.5-flash` 或你的本地视觉模型 ID
配置示例:
```bash
VISUAL_UNDERSTANDING_PROVIDER=google
VISUAL_UNDERSTANDING_MODEL=gemini-2.5-flash
```
启用后,当当前模型没有原生视觉能力但支持工具调用时,用户仍可上传图片或视频,并由兜底视觉理解模型进行分析。文件上传本身仍需要部署中正常配置文件存储能力。
## AI 图像
### `AI_IMAGE_DEFAULT_IMAGE_NUM`
-2
View File
@@ -119,8 +119,6 @@ See [AI Provider Configuration](/docs/self-hosting/environment-variables/model-p
- **Cloudflare R2** — No egress fees
- **RustFS / MinIO** — Self-hosted S3 alternative (included in Docker Compose)
**Visual understanding fallback** — Optional, but recommended if users will upload images or videos while chatting with models that do not have native visual capabilities. Configure `VISUAL_UNDERSTANDING_PROVIDER` and `VISUAL_UNDERSTANDING_MODEL` with a visual-capable model from one of your enabled AI providers. See [Basic environment variables](/docs/self-hosting/environment-variables/basic#visual-understanding) for details.
**Authentication provider** — For SSO and team features (Google OAuth, GitHub OAuth, Microsoft Azure AD, Auth0, Keycloak). See [Authentication Setup](/docs/self-hosting/auth) for configuration.
## Security Considerations
-2
View File
@@ -123,8 +123,6 @@ LobeHub 由以下几个关键组件组成:
- **Cloudflare R2** — 无出口流量费用
- **RustFS / MinIO** — 自托管 S3 替代方案(Docker Compose 已内置)
**视觉理解兜底模型** — 可选,但如果用户会在没有原生视觉能力的模型中上传图片或视频,建议配置。你可以使用已启用 AI 提供商中的视觉模型配置 `VISUAL_UNDERSTANDING_PROVIDER` 和 `VISUAL_UNDERSTANDING_MODEL`。详见 [基础环境变量](/zh/docs/self-hosting/environment-variables/basic#视觉理解)。
**认证提供商** — 支持 SSO 和团队功能(Google OAuth、GitHub OAuth、Microsoft Azure AD、Auth0、Keycloak)。配置详见 [认证设置](/docs/self-hosting/auth)。
## 安全注意事项
-1
View File
@@ -169,7 +169,6 @@
"channel.userIdHint": "معرف المستخدم الخاص بك على هذه المنصة. يمكن للذكاء الاصطناعي استخدامه لإرسال رسائل مباشرة إليك.",
"channel.userIdHint.discord": "فعّل وضع المطوّر (الإعدادات → متقدم)، ثم انقر بزر الفأرة الأيمن على صورتك الشخصية → انسخ معرّف المستخدم.",
"channel.userIdHint.feishu": "افتح تطبيقك على منصة Feishu / Lark Open Platform → الأذونات، ثم ابحث عن المعرّف المفتوح الخاص بك.",
"channel.userIdHint.line": "افتح وحدة تحكم مطوري LINE → قناتك → علامة تبويب الإعدادات الأساسية، ونسخ \"معرّف المستخدم الخاص بك\" (يبدأ بحرف U، 33 حرفًا).",
"channel.userIdHint.qq": "رقم QQ الخاص بك، يظهر في صفحة ملفك الشخصي.",
"channel.userIdHint.slack": "افتح ملفك الشخصي في Slack → ⋮ المزيد → انسخ معرّف العضو (يبدأ بـ U).",
"channel.userIdHint.telegram": "أرسل أي رسالة إلى @userinfobot على تيليغرام — سيرد عليك بمعرّف المستخدم الرقمي الخاص بك.",
-4
View File
@@ -33,10 +33,6 @@
"authModal.signIn": "تسجيل الدخول مرة أخرى",
"authModal.signingIn": "جارٍ تسجيل الدخول...",
"authModal.title": "انتهت الجلسة",
"betterAuth.captcha.continue": "استمر",
"betterAuth.captcha.description": "أكمل التحقق الأمني أدناه. سنواصل عملية التسجيل أو تسجيل الدخول تلقائيًا.",
"betterAuth.captcha.pendingDescription": "لم يكتمل التحقق. يرجى محاولة التحدي مرة أخرى.",
"betterAuth.captcha.title": "مطلوب التحقق الأمني",
"betterAuth.errors.confirmPasswordRequired": "يرجى تأكيد كلمة المرور",
"betterAuth.errors.emailExists": "هذا البريد الإلكتروني مسجل بالفعل. يرجى تسجيل الدخول بدلاً من ذلك",
"betterAuth.errors.emailInvalid": "يرجى إدخال بريد إلكتروني أو اسم مستخدم صالح",
-1
View File
@@ -27,7 +27,6 @@
"codes.RATE_LIMIT_EXCEEDED": "عدد كبير جداً من الطلبات، يرجى المحاولة لاحقاً",
"codes.SESSION_EXPIRED": "انتهت صلاحية الجلسة، يرجى تسجيل الدخول مرة أخرى",
"codes.SOCIAL_ACCOUNT_ALREADY_LINKED": "هذا الحساب الاجتماعي مرتبط بالفعل بمستخدم آخر",
"codes.TEMPORARY_EMAIL_NOT_ALLOWED": "عناوين البريد الإلكتروني المؤقتة غير مدعومة. يرجى استخدام عنوان بريد إلكتروني عادي. قد تؤدي المحاولات المتكررة إلى حظر هذه الشبكة.",
"codes.UNEXPECTED_ERROR": "حدث خطأ غير متوقع، يرجى المحاولة مرة أخرى",
"codes.UNKNOWN": "حدث خطأ غير معروف، يرجى المحاولة مرة أخرى أو التواصل مع الدعم",
"codes.USER_ALREADY_EXISTS": "المستخدم موجود بالفعل",
+14 -71
View File
@@ -24,11 +24,6 @@
"agentProfile.knowledgeBases_other": "{{count}} قواعد معرفة",
"agentProfile.skills_one": "{{count}} مهارة",
"agentProfile.skills_other": "{{count}} مهارات",
"agentSignal.receipts.memory.detail": "تم حفظ هذا للردود المستقبلية",
"agentSignal.receipts.memory.title": "تم حفظ الذاكرة",
"agentSignal.receipts.recentActivity": "النشاط الأخير",
"agentSignal.receipts.skill.detail": "تم تحسين كيفية تعامل هذا المساعد مع الطلبات المشابهة",
"agentSignal.receipts.skill.title": "تم تحديث المهارة",
"agents": "الوكلاء",
"artifact.generating": "يتم التوليد",
"artifact.inThread": "لا يمكن العرض في الموضوع الفرعي، يرجى التبديل إلى منطقة المحادثة الرئيسية للفتح",
@@ -322,6 +317,7 @@
"pageSelection.reference": "النص المحدد",
"pin": "تثبيت",
"pinOff": "إلغاء التثبيت",
"prompts.summaryExpert": "بصفتك خبيرًا في التلخيص، يرجى تلخيص المحتوى التالي بناءً على التعليمات أعلاه:",
"rag.referenceChunks": "مصدر المرجع",
"rag.userQuery.actions.delete": "حذف إعادة صياغة الاستعلام",
"rag.userQuery.actions.regenerate": "إعادة توليد الاستعلام",
@@ -494,7 +490,6 @@
"taskDetail.comment.edit": "تعديل",
"taskDetail.comment.save": "حفظ",
"taskDetail.commentPlaceholder": "اترك تعليقًا...",
"taskDetail.commentSubmitAndRun": "إرسال وتشغيل الآن",
"taskDetail.deleteConfirm.content": "لا يمكن التراجع عن هذا الإجراء.",
"taskDetail.deleteConfirm.ok": "حذف",
"taskDetail.deleteConfirm.title": "هل تريد حذف هذه المهمة؟",
@@ -519,23 +514,6 @@
"taskDetail.properties": "الخصائص",
"taskDetail.reassignDisabled": "لا يمكن إعادة إسناد الوكيل أثناء تشغيل المهمة",
"taskDetail.rerunTask": "إعادة تشغيل المهمة",
"taskDetail.runAll": "تشغيل الكل",
"taskDetail.runAll.cancel": "إلغاء",
"taskDetail.runAll.confirm": "تشغيل {{count}} مهمة فرعية",
"taskDetail.runAll.cycleWarning": "تم اكتشاف اعتماد دائري. المهام المتورطة أو المحظورة بسبب الدورة لن يتم تشغيلها: {{members}}",
"taskDetail.runAll.description": "سيتم تشغيل المهام الفرعية طبقة بطبقة. كل طبقة تنتظر انتهاء الطبقة السابقة. المهام التي ليس لها تبعيات تعمل في الطبقة الأولى.",
"taskDetail.runAll.empty": "لا يوجد شيء للتشغيل — كل مهمة فرعية مكتملة بالفعل، قيد التنفيذ، أو عالقة في دورة.",
"taskDetail.runAll.kickedOff": "تم بدء {{count}} مهمة فرعية؛ ستتبع الطبقات اللاحقة.",
"taskDetail.runAll.layer": "الطبقة {{index}}",
"taskDetail.runAll.layerHint.first": "تبدأ فورًا",
"taskDetail.runAll.layerHint.next": "تنتظر انتهاء الطبقة {{prev}}",
"taskDetail.runAll.loading": "جارٍ تحميل خطة المهام الفرعية...",
"taskDetail.runAll.partialFailure": "تم بدء {{ok}} من {{total}} مهمة فرعية؛ فشلت {{failed}}.",
"taskDetail.runAll.skipped.alreadyDone": "{{count}} مهمة مكتملة أو ملغاة بالفعل — تم تخطيها",
"taskDetail.runAll.skipped.blockedExternally": "{{count}} مهمة تنتظر عائقًا خارج هذه المجموعة — ستعمل تلقائيًا عند إزالة العائق",
"taskDetail.runAll.skipped.ineligible": "{{count}} مهمة قيد التشغيل أو مجدولة — تم تخطيها",
"taskDetail.runAll.title": "تشغيل المهام الفرعية بترتيب التبعيات",
"taskDetail.runNow": "تشغيل الآن",
"taskDetail.runTask": "تشغيل المهمة",
"taskDetail.saveModelConfig": "حفظ",
"taskDetail.status.backlog": "قائمة الانتظار",
@@ -621,7 +599,6 @@
"taskSchedule.scheduleType.weekly": "أسبوعي",
"taskSchedule.scheduler": "الجدولة",
"taskSchedule.schedulerTab": "الجدولة",
"taskSchedule.startScheduling": "ابدأ الجدولة",
"taskSchedule.summary.daily": "يوميًا عند {{time}}",
"taskSchedule.summary.disabled": "الأتمتة متوقفة",
"taskSchedule.summary.everyNHours": "كل {{count}} ساعات{{minute}}",
@@ -673,32 +650,37 @@
"tokenTag.used": "المستخدم",
"tool.intervention.approvalMode": "وضع الموافقة",
"tool.intervention.approve": "موافقة",
"tool.intervention.approveAndRemember": "موافقة وتذكر",
"tool.intervention.approveOnce": "الموافقة هذه المرة فقط",
"tool.intervention.mode.allowList": "قائمة السماح",
"tool.intervention.mode.allowListDesc": "تنفيذ الأدوات المعتمدة فقط تلقائيًا",
"tool.intervention.mode.autoRun": "موافقة تلقائية",
"tool.intervention.mode.autoRunDesc": "الموافقة تلقائيًا على جميع تنفيذات الأدوات",
"tool.intervention.mode.manual": "يدوي",
"tool.intervention.mode.manualDesc": "يتطلب الموافقة اليدوية لكل استدعاء",
"tool.intervention.onboarding.agentIdentity.editHint": "يمكنك تعديل الاسم أو الصورة الرمزية مباشرة أدناه.",
"tool.intervention.onboarding.agentIdentity.namePlaceholder": "اسم الوكيل",
"tool.intervention.onboarding.agentIdentity.applyHint": "ستظهر الهوية الجديدة بعد الموافقة.",
"tool.intervention.onboarding.agentIdentity.description": "الموافقة على هذا التغيير ستحدّث الوكيل المعروض في البريد الوارد وفي محادثة الإعداد هذه.",
"tool.intervention.onboarding.agentIdentity.emoji": "صورة الوكيل",
"tool.intervention.onboarding.agentIdentity.eyebrow": "موافقة الإعداد",
"tool.intervention.onboarding.agentIdentity.name": "اسم الوكيل",
"tool.intervention.onboarding.agentIdentity.targetInbox": "وكيل البريد الوارد",
"tool.intervention.onboarding.agentIdentity.targetOnboarding": "وكيل الإعداد الحالي",
"tool.intervention.onboarding.agentIdentity.targets": "ينطبق على",
"tool.intervention.onboarding.agentIdentity.title": "تأكيد تحديث هوية الوكيل",
"tool.intervention.onboarding.agentIdentity.titleAvatarOnly": "سأقوم بتحديث صورتي الرمزية",
"tool.intervention.onboarding.agentIdentity.titleNameOnly": "سأقوم بتحديث اسمي",
"tool.intervention.onboarding.userProfile.applyHint": "سيتم حفظ هذه التفاصيل في ملفك الشخصي بعد الموافقة.",
"tool.intervention.onboarding.userProfile.description": "الموافقة على هذا التغيير ستحدث ملف تعريف الانضمام الخاص بك حتى يتمكن الوكيل من تخصيص الردود المستقبلية.",
"tool.intervention.onboarding.userProfile.eyebrow": "الموافقة على الانضمام",
"tool.intervention.onboarding.userProfile.fullName": "الاسم الكامل",
"tool.intervention.onboarding.userProfile.responseLanguage": "لغة الرد",
"tool.intervention.onboarding.userProfile.title": "تأكيد تحديث ملفك الشخصي",
"tool.intervention.optionApprove": "الموافقة",
"tool.intervention.pending": "قيد الانتظار",
"tool.intervention.reject": "رفض",
"tool.intervention.rejectAndContinue": "رفض وإعادة المحاولة",
"tool.intervention.rejectOnly": "رفض",
"tool.intervention.rejectReasonPlaceholder": "سيساعد السبب الوكيل على فهم حدودك وتحسين التصرفات المستقبلية",
"tool.intervention.rejectTitle": "رفض استدعاء المهارة",
"tool.intervention.rejectedWithReason": "تم رفض استدعاء المهارة: {{reason}}",
"tool.intervention.rememberSimilar": "لا تسأل مرة أخرى عن إجراءات مشابهة",
"tool.intervention.scrollToIntervention": "عرض",
"tool.intervention.submit": "إرسال",
"tool.intervention.toolAbort": "لقد ألغيت استدعاء المهارة",
"tool.intervention.toolRejected": "تم رفض استدعاء المهارة",
"tool.intervention.viewParameters": "عرض المعلمات ({{count}})",
@@ -780,6 +762,7 @@
"workflow.toolDisplayName.finishOnboarding": "إنهاء الإعداد التعريفي",
"workflow.toolDisplayName.getCommandOutput": "قراءة مخرجات الأمر",
"workflow.toolDisplayName.getDocument": "قراءة مستند",
"workflow.toolDisplayName.getOnboardingState": "تم التحقق من حالة الإعداد الأولي",
"workflow.toolDisplayName.getPageContent": "قراءة محتوى الصفحة",
"workflow.toolDisplayName.getTopicContext": "قراءة سياق الموضوع",
"workflow.toolDisplayName.globLocalFiles": "الملفات التي تم البحث فيها",
@@ -803,23 +786,19 @@
"workflow.toolDisplayName.replaceDocumentContent": "تم استبدال محتوى المستند",
"workflow.toolDisplayName.replaceText": "تم استبدال النص",
"workflow.toolDisplayName.runCommand": "تم تنفيذ أمر",
"workflow.toolDisplayName.saveUserQuestion": "تم تسجيل المعلومات",
"workflow.toolDisplayName.search": "تم البحث في الويب",
"workflow.toolDisplayName.searchAgent": "الوكلاء الذين تم البحث عنهم",
"workflow.toolDisplayName.searchKnowledgeBase": "تم البحث في قاعدة المعرفة",
"workflow.toolDisplayName.searchLocalFiles": "الملفات التي تم البحث عنها",
"workflow.toolDisplayName.searchSkill": "المهارات التي تم البحث عنها",
"workflow.toolDisplayName.searchUserMemory": "تم البحث في الذاكرة",
"workflow.toolDisplayName.showAgentMarketplace": "فريق الوكلاء المجمع",
"workflow.toolDisplayName.solve": "حلّ المعادلة",
"workflow.toolDisplayName.submitAgentPick": "الوكلاء المختارون",
"workflow.toolDisplayName.updateAgent": "تم تحديث وكيل",
"workflow.toolDisplayName.updateDocument": "تم تحديث مستند",
"workflow.toolDisplayName.updateIdentityMemory": "تم تحديث الذاكرة",
"workflow.toolDisplayName.updateLoadRule": "تم تحديث قاعدة التحميل",
"workflow.toolDisplayName.updatePlan": "الخطة المحدَّثة",
"workflow.toolDisplayName.updateTodos": "تم تحديث المهام",
"workflow.toolDisplayName.writeDocument": "تم كتابة مستند",
"workflow.toolDisplayName.writeLocalFile": "تمت كتابة ملف",
"workflow.working": "جارٍ العمل...",
"workingPanel.agentDocuments": "Agent Documents",
@@ -851,44 +830,8 @@
"workingPanel.resources.renameEmpty": "Title cannot be empty",
"workingPanel.resources.renameError": "Failed to rename document",
"workingPanel.resources.renameSuccess": "Document renamed",
"workingPanel.resources.tree.createError": "فشل في الإنشاء",
"workingPanel.resources.tree.moveError": "فشل في النقل",
"workingPanel.resources.tree.newDocument": "مستند جديد",
"workingPanel.resources.tree.newFolder": "مجلد جديد",
"workingPanel.resources.tree.parentMissing": "المجلد الرئيسي غير متوفر",
"workingPanel.resources.tree.rename": "إعادة تسمية",
"workingPanel.resources.tree.untitledDocument": "مستند بدون عنوان",
"workingPanel.resources.tree.untitledFolder": "مجلد بدون عنوان",
"workingPanel.resources.updatedAt": "تم التحديث في {{time}}",
"workingPanel.resources.viewMode.list": "عرض القائمة",
"workingPanel.resources.viewMode.tree": "عرض الشجرة",
"workingPanel.review.baseRef.default": "افتراضي",
"workingPanel.review.baseRef.loading": "جارٍ تحميل الفروع...",
"workingPanel.review.baseRef.reset": "إعادة التعيين إلى الفرع الافتراضي",
"workingPanel.review.baseRef.unresolved": "اختر فرعًا أساسيًا",
"workingPanel.review.binary": "ملف ثنائي — لا يمكن عرض الفرق",
"workingPanel.review.collapseAll": "طي الكل",
"workingPanel.review.copied": "تم نسخ المسار",
"workingPanel.review.copyPath": "نسخ مسار الملف",
"workingPanel.review.empty": "لا توجد تغييرات في شجرة العمل",
"workingPanel.review.empty.branch": "لا توجد تغييرات مقابل {{baseRef}}",
"workingPanel.review.empty.noBaseRef": "تعذر تحديد الفرع الافتراضي البعيد. قم بتشغيل `git remote set-head origin --auto` في الطرفية.",
"workingPanel.review.error": "تعذر تحميل الفرق لهذا الملف",
"workingPanel.review.expandAll": "توسيع الكل",
"workingPanel.review.mode.branch": "فرع",
"workingPanel.review.mode.unstaged": "غير مُرتب",
"workingPanel.review.more": "خيارات إضافية",
"workingPanel.review.refresh": "تحديث",
"workingPanel.review.textDiff.disable": "تعطيل مقارنة النصوص المضمنة",
"workingPanel.review.textDiff.enable": "تمكين مقارنة النصوص المضمنة",
"workingPanel.review.title": "مراجعة",
"workingPanel.review.tooLarge": "الملف كبير جدًا لعرض الفرق داخليًا",
"workingPanel.review.unstaged": "غير مُعدّل",
"workingPanel.review.viewMode.split": "التبديل إلى العرض المنقسم",
"workingPanel.review.viewMode.unified": "التبديل إلى العرض الموحد",
"workingPanel.review.wordWrap.disable": "تعطيل التفاف النص",
"workingPanel.review.wordWrap.enable": "تمكين التفاف النص",
"workingPanel.space": "مسافة",
"workingPanel.title": "Working Panel",
"you": "أنت",
"zenMode": "وضع التركيز"
-4
View File
@@ -448,10 +448,6 @@
"telemetry.title": "ساعدنا في تحسين {{appName}}",
"temp": "مؤقت",
"terms": "شروط الخدمة",
"time.formatOtherYear": "MMM D، YYYY",
"time.formatThisYear": "MMM D",
"time.today": "اليوم",
"time.yesterday": "أمس",
"unknownError": "خطأ غير معروف",
"update": "تحديث",
"updateAgent": "تحديث معلومات الوكيل",
-1
View File
@@ -141,7 +141,6 @@
"ModelSwitchPanel.detail.pricing.unit.textInput_cacheWrite": "مدخل (كتابة في التخزين)",
"ModelSwitchPanel.detail.pricing.unit.textOutput": "مخرج",
"ModelSwitchPanel.detail.pricing.unit.videoGeneration": "إنشاء الفيديو",
"ModelSwitchPanel.detail.pricing.unit.videoInput": "مدخل الفيديو",
"ModelSwitchPanel.detail.releasedAt": "تم الإصدار في {{date}}",
"ModelSwitchPanel.emptyModel": "لا يوجد نموذج مفعل. يرجى الذهاب إلى الإعدادات لتفعيله.",
"ModelSwitchPanel.emptyProvider": "لا يوجد مزود مفعل. يرجى الذهاب إلى الإعدادات لتفعيل أحدهم.",
-1
View File
@@ -114,7 +114,6 @@
"response.ProviderBizError": "حدث خطأ أثناء طلب خدمة {{provider}}، يرجى التحقق أو إعادة المحاولة.",
"response.ProviderContentModeration": "فشل التحقق من سياسة المحتوى. عدّل طلبك وحاول مرة أخرى.",
"response.ProviderContentModerationWarning": "تم رصد انتهاكات متكررة لسياسة الاستخدام. قد يؤدي أي سوء استخدام إضافي إلى تقييد حسابك.",
"response.ProviderImageContentModerationWarning": "تم اكتشاف رفضات متكررة لسلامة الصور. قد تؤدي الطلبات المشابهة إلى إيقاف مؤقت لتوليد الصور.",
"response.QuotaLimitReached": "عذرًا، تم الوصول إلى الحد الأقصى لاستخدام الرموز أو عدد الطلبات لهذا المفتاح. يرجى زيادة الحصة أو المحاولة لاحقًا.",
"response.QuotaLimitReachedCloud": "خدمة النموذج تحت ضغط كبير حاليًا. يرجى المحاولة مرة أخرى لاحقًا.",
"response.ServerAgentRuntimeError": "عذرًا، خدمة الوكيل غير متوفرة حاليًا. يرجى المحاولة لاحقًا أو التواصل معنا عبر البريد الإلكتروني.",
+1 -3
View File
@@ -5,8 +5,7 @@
"agentSelection.search": "لم يتم العثور على وكلاء مطابقين",
"brief.action.acknowledge": "إقرار",
"brief.action.approve": "الموافقة",
"brief.action.confirm": "تأكيد",
"brief.action.confirmDone": "تأكيد",
"brief.action.confirmDone": "تأكيد الإنهاء",
"brief.action.feedback": "ملاحظات",
"brief.action.retry": "إعادة المحاولة",
"brief.addFeedback": "مشاركة الملاحظات",
@@ -23,7 +22,6 @@
"brief.resolved": "تم وضع علامة كمُعالَج",
"brief.title": "الموجز اليومي",
"brief.viewAllTasks": "عرض جميع المهام",
"brief.viewRun": "عرض التشغيل",
"project.create": "مشروع جديد",
"project.deleteConfirm": "سيتم حذف هذا المشروع ولن يمكن استعادته. أكد للمتابعة.",
"starter.createAgent": "إنشاء وكيل",
-2
View File
@@ -9,7 +9,5 @@
"features.groupChat.title": "دردشة جماعية (متعددة الوكلاء)",
"features.inputMarkdown.desc": "عرض Markdown في منطقة الإدخال في الوقت الفعلي (نص عريض، كتل الشيفرة، جداول، إلخ).",
"features.inputMarkdown.title": "عرض Markdown في الإدخال",
"features.messenger.desc": "تحدث إلى وكلائك عبر تطبيق تيليجرام (وتطبيقات المراسلة الأخرى) من خلال روبوت LobeHub المشترك. يضيف علامة تبويب المراسلة في الإعدادات لربط حسابك واختيار الوكيل الذي يتلقى الرسائل.",
"features.messenger.title": "المراسلة",
"title": "المختبرات"
}
-106
View File
@@ -1,106 +0,0 @@
{
"messenger.activeAgent": "الوكيل النشط",
"messenger.activeAgentPlaceholder": "اختر وكيلًا",
"messenger.detail.addServer": "إضافة خادم",
"messenger.detail.addWorkspace": "إضافة مساحة عمل",
"messenger.detail.connections.connected": "متصل",
"messenger.detail.connections.empty": "افتح البوت وأرسل /start لربط حسابك.",
"messenger.detail.connections.linkHint": "تم تثبيت مساحة العمل. افتح Slack وأرسل رسالة خاصة إلى البوت لإكمال ربط حسابك الشخصي.",
"messenger.detail.connections.pending": "قيد الانتظار",
"messenger.detail.connections.serverLabel": "الخادم",
"messenger.detail.connections.title": "الاتصالات",
"messenger.detail.connections.userLabel": "المستخدم",
"messenger.detail.connections.workspaceLabel": "مساحة العمل",
"messenger.detail.disconnect": "قطع الاتصال",
"messenger.discord.connectModal.description": "أضف بوت LobeHub إلى خادم Discord الذي تديره.",
"messenger.discord.connectModal.inviteButton": "أضف إلى خادم Discord",
"messenger.discord.connectModal.notConfigured": "Discord غير متاح حاليًا. يرجى المحاولة مرة أخرى لاحقًا.",
"messenger.discord.connectModal.title": "أضف البوت إلى خادمك",
"messenger.discord.connections.disconnectConfirm": "إزالة هذا الخادم من قائمة التدقيق الخاصة بك؟ سيبقى البوت في الخادم حتى يقوم مسؤول الخادم بطرده.",
"messenger.discord.connections.disconnectFailed": "فشل في إزالة الخادم.",
"messenger.discord.connections.disconnectSuccess": "تمت إزالة الخادم.",
"messenger.discord.connections.disconnectTitle": "إزالة الخادم",
"messenger.discord.userPending.cta": "افتح في Discord",
"messenger.discord.userPending.hint": "افتح البوت في Discord وأرسل أي رسالة لإكمال ربط حسابك.",
"messenger.discord.userPending.name": "لم يتم الربط بعد",
"messenger.error.agentNotFound": "لم يتم العثور على الوكيل.",
"messenger.error.disconnectNotAllowed": "يمكنك فقط قطع الاتصال بالتثبيتات التي بدأت بها.",
"messenger.error.installationNotFound": "لم يتم العثور على التثبيت.",
"messenger.error.linkRequired": "افتح البوت وأرسل /start قبل تغيير هذا الاتصال.",
"messenger.error.pickDefaultAgent": "اختر وكيلًا افتراضيًا قبل التأكيد.",
"messenger.error.platformNotConfigured": "منصة المراسلة هذه غير متاحة حاليًا. يرجى المحاولة مرة أخرى لاحقًا.",
"messenger.linkCta": "ربط",
"messenger.linkModal.continueIn": "أكمل الإعداد في {{platform}}",
"messenger.linkModal.instructions": "افتح البوت، أرسل /start، ثم اضغط على \"ربط الحساب\" لربط حسابك في LobeHub.",
"messenger.linkModal.notConfigured": "هذا الاتصال غير متاح حاليًا. يرجى المحاولة مرة أخرى لاحقًا.",
"messenger.linkModal.openCta": "افتح في {{platform}}",
"messenger.linkModal.scanHint": "أو امسح باستخدام هاتفك لفتح {{platform}}.",
"messenger.linkModal.title": "ربط المراسلة",
"messenger.list.discord.description": "تحدث مع وكلاء LobeHub الخاصين بك من أي خادم Discord عبر الرسائل الخاصة مع بوت LobeHub.",
"messenger.list.slack.description": "تحدث مع وكلاء LobeHub الخاصين بك من أي مساحة عمل Slack عبر الرسائل الخاصة أو @LobeHub.",
"messenger.list.telegram.description": "تحدث مع وكلاء LobeHub الخاصين بك في Telegram واختر من يجيب من أي مكان.",
"messenger.noPlatformsConfigured": "لا توجد منصات متاحة بعد. تحقق مرة أخرى قريبًا.",
"messenger.setActiveFailed": "فشل في التعيين كوكيل نشط.",
"messenger.setActiveSuccess": "تم تحديث الوكيل النشط.",
"messenger.slack.connectModal.continueButton": "أكمل في Slack",
"messenger.slack.connectModal.description": "سيتم توجيهك إلى Slack لتفويض تثبيت مساحة عمل LobeHub.",
"messenger.slack.connectModal.notConfigured": "Slack غير متاح حاليًا. يرجى المحاولة مرة أخرى لاحقًا.",
"messenger.slack.connectModal.title": "أكمل الإعداد في Slack",
"messenger.slack.connections.disconnectConfirm": "افصل بوت LobeHub عن مساحة العمل هذه في Slack؟ سيتم إيقاف روابط المستخدم الحالية حتى تعيد التثبيت.",
"messenger.slack.connections.disconnectFailed": "فشل في قطع الاتصال.",
"messenger.slack.connections.disconnectSuccess": "تم فصل مساحة العمل.",
"messenger.slack.connections.disconnectTitle": "قطع الاتصال بمساحة العمل",
"messenger.slack.installBlocked.dismiss": "فهمت",
"messenger.slack.installBlocked.suggestion": "أرسل رسالة خاصة إلى @LobeHub في Slack لربط حسابك الشخصي — لا تحتاج إلى التثبيت مرة أخرى. أو اطلب من المثبت الأصلي فصل مساحة العمل هذه أولاً إذا كنت تريد تولي الملكية.",
"messenger.slack.installBlocked.title": "مساحة العمل متصلة بالفعل",
"messenger.slack.installBlocked.withName": "\"{{workspace}}\" متصلة بالفعل بـ LobeHub بواسطة مستخدم آخر.",
"messenger.slack.installBlocked.withoutName": "مساحة العمل هذه في Slack متصلة بالفعل بـ LobeHub بواسطة مستخدم آخر.",
"messenger.slack.installResult.failed": "فشل تثبيت Slack ({{reason}}). يرجى المحاولة مرة أخرى أو الاتصال بالدعم.",
"messenger.slack.installResult.reasons.accessDenied": "تم إلغاء التفويض",
"messenger.slack.installResult.reasons.exchangeFailed": "فشل تفويض Slack",
"messenger.slack.installResult.reasons.generic": "حدث خطأ غير معروف",
"messenger.slack.installResult.reasons.invalidState": "انتهت صلاحية جلسة التثبيت",
"messenger.slack.installResult.reasons.missingAppId": "أعاد Slack معلومات تطبيق غير مكتملة",
"messenger.slack.installResult.reasons.missingCodeOrState": "أعاد Slack معلمات تثبيت غير مكتملة",
"messenger.slack.installResult.reasons.missingTenant": "لم يُرجع Slack معرف مساحة العمل",
"messenger.slack.installResult.reasons.missingToken": "لم يُرجع Slack رمز البوت",
"messenger.slack.installResult.reasons.persistFailed": "تعذر حفظ اتصال مساحة العمل",
"messenger.slack.installResult.success": "تم توصيل مساحة عمل Slack.",
"messenger.subtitle": "قم بربط حسابك مع البوت الرسمي لـ LobeHub مرة واحدة. اختر الوكيل الذي يستقبل الرسائل، وقم بالتبديل في أي وقت من هنا أو من البوت.",
"messenger.title": "المراسلة",
"messenger.unlinkConfirm": "هل تريد فصل حسابك في {{platform}} عن LobeHub؟ ستتوقف الرسائل الواردة حتى ترسل /start مرة أخرى.",
"messenger.unlinkCta": "قطع الاتصال",
"messenger.unlinkFailed": "فشل في قطع الاتصال.",
"messenger.unlinkSuccess": "تم قطع الاتصال.",
"messenger.unlinkTitle": "قطع الاتصال بالحساب",
"verify.confirm.conflict.description": "حساب {{platform}} هذا مرتبط بالفعل بحساب LobeHub {{email}}. قم بتسجيل الدخول إلى هذا الحساب لإدارة الرابط، أو قم بفصله هناك قبل المحاولة مرة أخرى.",
"verify.confirm.conflict.switchAccount": "تسجيل الدخول بحساب آخر",
"verify.confirm.conflict.title": "هذا الحساب مرتبط بالفعل",
"verify.confirm.cta": "تأكيد الربط",
"verify.confirm.defaultAgent": "الوكيل الافتراضي",
"verify.confirm.defaultAgentHint": "سيتم توجيه رسائلك هنا أولاً. يمكنك التبديل في أي وقت عبر /agents في البوت أو من الإعدادات → المراسلة.",
"verify.confirm.defaultAgentPlaceholder": "اختر وكيلًا",
"verify.confirm.fields.lobeHubAccount": "حساب LobeHub",
"verify.confirm.fields.platformAccount": "حساب {{platform}}",
"verify.confirm.fields.workspace": "مساحة العمل",
"verify.confirm.noAgents": "ليس لديك أي وكلاء بعد. قم بإنشاء واحد في LobeHub، ثم عد لإكمال الربط.",
"verify.confirm.relink.description": "تم ربط حساب LobeHub هذا بالفعل بحساب Telegram {{account}}. لربط حساب Telegram مختلف، قم بفصل الحساب الحالي أولاً في الإعدادات → المراسلة.",
"verify.confirm.relink.manage": "افتح إعدادات المراسلة",
"verify.confirm.relink.title": "تم ربط حساب Telegram آخر بالفعل",
"verify.confirm.title": "تأكيد الربط",
"verify.confirm.workspace": "مساحة العمل: {{workspace}}",
"verify.error.alreadyLinkedToOther": "هذا الحساب مرتبط بالفعل بحساب LobeHub مختلف. قم بتسجيل الدخول إلى هذا الحساب أولاً.",
"verify.error.expired": "انتهت صلاحية هذا الرابط. يرجى العودة إلى البوت وإرسال /start مرة أخرى.",
"verify.error.generic": "حدث خطأ ما. يرجى المحاولة مرة أخرى.",
"verify.error.missingToken": "رابط غير صالح. افتح هذه الصفحة من البوت.",
"verify.error.title": "تعذر تأكيد الرابط",
"verify.error.unlinkBeforeRelink": "تم ربط حساب LobeHub هذا بالفعل بحساب Telegram آخر. قم بفصله في الإعدادات → المراسلة قبل ربط حساب جديد.",
"verify.labRequired.description": "المراسلة حاليًا ميزة تجريبية. قم بتمكينها في الإعدادات → متقدم → الميزات التجريبية وأعد تحميل هذه الصفحة.",
"verify.labRequired.openSettings": "افتح إعدادات الميزات التجريبية",
"verify.labRequired.title": "قم بتمكين المراسلة للمتابعة",
"verify.signInCta": "تسجيل الدخول للمتابعة",
"verify.signInRequired": "يرجى تسجيل الدخول إلى LobeHub لتأكيد الرابط.",
"verify.success.description": "تم الآن ربط حسابك بـ {{platform}}. افتح {{platform}} وأرسل رسالتك الأولى.",
"verify.success.openBot": "افتح في {{platform}}",
"verify.success.title": "تم الربط بنجاح!"
}
+86 -44
View File
@@ -84,6 +84,7 @@
"Kimi-K2.5.description": "Kimi K2.5 هو أقوى نموذج من سلسلة Kimi، ويقدم أداءً متقدماً مفتوح المصدر في مهام الوكلاء والبرمجة وفهم الرؤية. يدعم الإدخال متعدد الوسائط ووضعَي التفكير وغير التفكير.",
"Kolors.description": "Kolors هو نموذج تحويل نص إلى صورة طوره فريق Kolors في Kuaishou. مدرب على مليارات المعاملات، يتميز بجودة بصرية عالية، فهم دلالي قوي للغة الصينية، وقدرات متميزة في عرض النصوص.",
"Kwai-Kolors/Kolors.description": "Kolors هو نموذج تحويل نص إلى صورة واسع النطاق من فريق Kolors في Kuaishou. مدرب على مليارات أزواج النصوص والصور، يتفوق في الجودة البصرية، الدقة الدلالية المعقدة، وعرض النصوص الصينية/الإنجليزية، مع فهم وتوليد قويين للمحتوى الصيني.",
"Kwaipilot/KAT-Dev.description": "KAT-Dev (32B) هو نموذج مفتوح المصدر لمهام هندسة البرمجيات. يحقق معدل حل 62.4% على SWE-Bench Verified، ويحتل المرتبة الخامسة بين النماذج المفتوحة. تم تحسينه عبر التدريب الوسيط، SFT، وRL لإكمال الشيفرة، إصلاح الأخطاء، ومراجعة الشيفرة.",
"Llama-3.2-11B-Vision-Instruct.description": "استدلال بصري قوي على الصور عالية الدقة، مناسب لتطبيقات الفهم البصري.",
"Llama-3.2-90B-Vision-Instruct\t.description": "استدلال بصري متقدم لتطبيقات الفهم البصري المعتمدة على الوكلاء.",
"LongCat-2.0-Preview.description": "الميزات الأساسية لـ LongCat-2.0-Preview هي كما يلي: مصمم لسيناريوهات تطوير الوكلاء، مع دعم أصلي لاستخدام الأدوات، التفكير متعدد الخطوات، ومهام السياق الطويل؛ يتفوق في توليد الأكواد، سير العمل الآلي، وتنفيذ التعليمات المعقدة؛ متكامل بعمق مع أدوات الإنتاجية مثل Claude Code، OpenClaw، OpenCode، وKilo Code.",
@@ -106,7 +107,6 @@
"MiniMax-Hailuo-2.3.description": "نموذج جديد لإنشاء الفيديو مع تحسينات شاملة في حركة الجسم، والواقعية الفيزيائية، واتباع التعليمات.",
"MiniMax-M1.description": "نموذج استدلال داخلي جديد بسلسلة تفكير تصل إلى 80K ومدخلات حتى 1M، يقدم أداءً مماثلاً لأفضل النماذج العالمية.",
"MiniMax-M2-Stable.description": "مصمم لتدفقات العمل البرمجية والوكلاء بكفاءة عالية، مع قدرة تزامن أعلى للاستخدام التجاري.",
"MiniMax-M2.1-Lightning.description": "قدرات برمجة متعددة اللغات قوية مع استنتاج أسرع وأكثر كفاءة.",
"MiniMax-M2.1-highspeed.description": "قدرات برمجة متعددة اللغات قوية، تجربة برمجة مطورة بشكل شامل. أسرع وأكثر كفاءة.",
"MiniMax-M2.1.description": "MiniMax-M2.1 هو نموذج مفتوح المصدر رائد من MiniMax، يركز على حل المهام الواقعية المعقدة. يتميز بقدرات برمجة متعددة اللغات والقدرة على أداء المهام المعقدة كوكلاء ذكي.",
"MiniMax-M2.5-highspeed.description": "MiniMax M2.5 Highspeed: نفس أداء M2.5 مع استدلال أسرع.",
@@ -116,7 +116,6 @@
"MiniMax-M2.description": "MiniMax M2: نموذج الجيل السابق.",
"MiniMax-Text-01.description": "MiniMax-01 يقدم انتباهًا خطيًا واسع النطاق يتجاوز Transformers التقليدية، مع 456 مليار معامل و45.9 مليار مفعّلة في كل تمرير. يحقق أداءً من الدرجة الأولى ويدعم حتى 4 ملايين رمز سياقي (32× GPT-4o، 20× Claude-3.5-Sonnet).",
"MiniMaxAI/MiniMax-M1-80k.description": "MiniMax-M1 هو نموذج استدلال كبير مفتوح الأوزان مع 456 مليار معلمة إجمالية وحوالي 45.9 مليار نشطة لكل رمز. يدعم سياق 1 مليون بشكل طبيعي ويستخدم Flash Attention لتقليل FLOPs بنسبة 75% على توليد 100 ألف رمز مقارنة بـ DeepSeek R1. مع بنية MoE بالإضافة إلى CISPO وتدريب RL الهجين، يحقق أداءً رائدًا في الاستدلال طويل المدخلات ومهام الهندسة البرمجية الواقعية.",
"MiniMaxAI/MiniMax-M2.5.description": "MiniMax-M2.5 هو أحدث نموذج لغة كبير تم تطويره بواسطة MiniMax، تم تدريبه من خلال التعلم المعزز واسع النطاق عبر مئات الآلاف من البيئات المعقدة الواقعية. يتميز بهيكل MoE مع 229 مليار معلمة، ويحقق أداءً رائدًا في الصناعة في مهام مثل البرمجة، استدعاء أدوات الوكلاء، البحث، وسيناريوهات المكتب.",
"MiniMaxAI/MiniMax-M2.description": "MiniMax-M2 يعيد تعريف كفاءة الوكلاء. إنه نموذج MoE مضغوط وسريع وفعال من حيث التكلفة مع 230 مليار معلمة إجمالية و10 مليارات معلمة نشطة، مصمم لمهام البرمجة والوكلاء من الدرجة الأولى مع الحفاظ على ذكاء عام قوي. مع 10 مليارات معلمة نشطة فقط، ينافس النماذج الأكبر بكثير، مما يجعله مثاليًا للتطبيقات عالية الكفاءة.",
"Moonshot-Kimi-K2-Instruct.description": "يحتوي على 1 تريليون معامل إجماليًا و32 مليار مفعّلة. من بين النماذج غير المفكرة، يتصدر في المعرفة المتقدمة، الرياضيات، والبرمجة، وأقوى في مهام الوكلاء العامة. محسن لأعباء عمل الوكلاء، يمكنه اتخاذ إجراءات وليس فقط الإجابة على الأسئلة. الأفضل للمحادثات العامة الارتجالية وتجارب الوكلاء كنموذج يعمل بردود فعل دون تفكير طويل.",
"NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO.description": "Nous Hermes 2 - Mixtral 8x7B-DPO (46.7B) هو نموذج تعليمات عالي الدقة للحسابات المعقدة.",
@@ -133,6 +132,7 @@
"Pro/MiniMaxAI/MiniMax-M2.5.description": "MiniMax-M2.5 هو أحدث نموذج لغة كبير تم تطويره بواسطة MiniMax، تم تدريبه من خلال التعلم المعزز واسع النطاق عبر مئات الآلاف من البيئات الواقعية المعقدة. يتميز ببنية MoE مع 229 مليار معلمة، ويحقق أداءً رائدًا في الصناعة في مهام مثل البرمجة، استدعاء أدوات الوكلاء، البحث، وسيناريوهات المكتب.",
"Pro/Qwen/Qwen2.5-7B-Instruct.description": "Qwen2.5-7B-Instruct هو جزء من أحدث سلسلة نماذج لغوية كبيرة من Alibaba Cloud. يقدم هذا النموذج ذو 7 مليارات معلمة تحسينات ملحوظة في البرمجة والرياضيات، ويدعم أكثر من 29 لغة، ويعزز اتباع التعليمات، وفهم البيانات المنظمة، وإنتاج المخرجات المنظمة (خصوصًا JSON).",
"Pro/THUDM/GLM-4.1V-9B-Thinking.description": "GLM-4.1V-9B-Thinking هو نموذج رؤية-لغة مفتوح المصدر من Zhipu AI ومختبر KEG في جامعة تسينغهوا، مصمم للإدراك متعدد الوسائط المعقد. مبني على GLM-4-9B-0414، ويضيف استدلال سلسلة الأفكار والتعلم المعزز (RL) لتحسين الاستدلال عبر الوسائط والاستقرار بشكل كبير.",
"Pro/deepseek-ai/DeepSeek-R1-Distill-Qwen-7B.description": "DeepSeek-R1-Distill-Qwen-7B مستخلص من Qwen2.5-Math-7B ومُحسن على 800 ألف عينة مختارة من DeepSeek-R1. يقدم أداءً قويًا، بنسبة 92.8% على MATH-500، و55.5% على AIME 2024، وتصنيف 1189 على CodeForces لنموذج 7B.",
"Pro/deepseek-ai/DeepSeek-R1.description": "DeepSeek-R1 هو نموذج استدلال مدفوع بالتعلم المعزز يقلل التكرار ويحسن قابلية القراءة. يستخدم بيانات بداية باردة قبل التعلم المعزز لتعزيز الاستدلال، ويضاهي OpenAI-o1 في مهام الرياضيات، البرمجة، والاستدلال، ويحقق نتائج أفضل من خلال تدريب دقيق.",
"Pro/deepseek-ai/DeepSeek-V3.1-Terminus.description": "DeepSeek-V3.1-Terminus هو إصدار محدث من نموذج V3.1، مصمم كنموذج وكيل هجين. يعالج المشكلات التي أبلغ عنها المستخدمون، ويحسن الاستقرار، وتناسق اللغة، ويقلل من الخلط بين الصينية/الإنجليزية والرموز غير الطبيعية. يدمج أوضاع التفكير وغير التفكير مع قوالب محادثة للتبديل المرن. كما يعزز أداء وكلاء الشيفرة والبحث لاستخدام أدوات أكثر موثوقية ومهام متعددة الخطوات.",
"Pro/deepseek-ai/DeepSeek-V3.2.description": "DeepSeek-V3.2 هو نموذج يجمع بين الكفاءة الحسابية العالية وأداء التفكير والوكيل الممتاز. يعتمد نهجه على ثلاثة اختراقات تكنولوجية رئيسية: DeepSeek Sparse Attention (DSA)، وهي آلية انتباه فعالة تقلل بشكل كبير من التعقيد الحسابي مع الحفاظ على أداء النموذج، ومُحسنة خصيصًا للسيناريوهات ذات السياق الطويل؛ إطار عمل للتعلم المعزز القابل للتوسع يمكن من خلاله أن ينافس أداء النموذج GPT-5، مع نسخته عالية الحوسبة التي تضاهي Gemini-3.0-Pro في قدرات التفكير؛ وخط أنابيب واسع النطاق لتوليف مهام الوكيل يهدف إلى دمج قدرات التفكير في سيناريوهات استخدام الأدوات، مما يحسن اتباع التعليمات والتعميم في البيئات التفاعلية المعقدة. حقق النموذج أداءً متميزًا في الأولمبياد الدولي للرياضيات (IMO) وأولمبياد المعلوماتية الدولي (IOI) لعام 2025.",
@@ -140,18 +140,18 @@
"Pro/moonshotai/Kimi-K2-Instruct-0905.description": "Kimi K2-Instruct-0905 هو أحدث وأقوى إصدار من Kimi K2. إنه نموذج MoE من الدرجة الأولى يحتوي على إجمالي 1 تريليون و32 مليار معلمة نشطة. من أبرز ميزاته الذكاء البرمجي القوي مع تحسينات كبيرة في المعايير ومهام الوكلاء الواقعية، بالإضافة إلى تحسينات في جمالية واجهة الشيفرة وسهولة الاستخدام.",
"Pro/moonshotai/Kimi-K2-Thinking.description": "Kimi K2 Thinking Turbo هو إصدار Turbo محسّن لسرعة الاستدلال والإنتاجية مع الحفاظ على قدرات التفكير متعدد الخطوات واستخدام الأدوات في K2 Thinking. إنه نموذج MoE يحتوي على حوالي 1 تريليون معلمة إجمالية، ويدعم سياقًا أصليًا بطول 256 ألف رمز، واستدعاء أدوات واسع النطاق ومستقر لسيناريوهات الإنتاج التي تتطلب زمن استجابة وتزامنًا صارمين.",
"Pro/moonshotai/Kimi-K2.5.description": "Kimi K2.5 هو نموذج وكيل متعدد الوسائط مفتوح المصدر، مبني على Kimi-K2-Base، ومدرب على حوالي 1.5 تريليون رمز من النصوص والرؤية. يستخدم بنية MoE بعدد إجمالي 1 تريليون مع 32 مليار معلمات نشطة، ويدعم نافذة سياق تصل إلى 256 ألف، مما يدمج الفهم البصري واللغوي بسلاسة.",
"Pro/moonshotai/Kimi-K2.6.description": "Kimi K2.6 هو نموذج وكيل متعدد الوسائط مفتوح المصدر من Moonshot AI، يحقق أداءً رائدًا مفتوح المصدر على العديد من المعايير الرئيسية بما في ذلك HLE (مع الأدوات)، SWE-Bench Pro، وBrowseComp. يعتمد النموذج على هيكل MoE مع إجمالي 1T معلمات و32B معلمات نشطة، يدعم نافذة سياق 256K رمز، ويجمع بين قدرات متعددة الوسائط الأصلية.",
"Pro/zai-org/GLM-5.1.description": "GLM-5.1 هو نموذج الجيل التالي الرائد المصمم لهندسة الوكلاء، ويستخدم بنية خبراء مختلطة (MoE) بـ 754 مليار معلمة. يعزز قدرات البرمجة بشكل كبير، محققاً نتائج متقدمة على SWE-Bench Pro، ويتفوق بوضوح على سابقه في مقاييس مثل NL2Repo وTerminal-Bench 2.0. مصمم لمهام الوكلاء طويلة الأمد، ويتعامل مع الأسئلة الغامضة بشكل أدق، ويحلل المهام المعقدة، وينفذ التجارب، ويفحص النتائج، ويواصل التحسين عبر مئات الدورات وآلاف استدعاءات الأدوات.",
"Pro/zai-org/glm-4.7.description": "GLM-4.7 هو النموذج الرائد الجديد من Zhipu مع 355 مليار معلمة إجمالية و32 مليار معلمة نشطة، تم ترقيته بالكامل في الحوار العام، المنطق، وقدرات الوكلاء. يعزز GLM-4.7 التفكير المتداخل ويقدم التفكير المحفوظ والتفكير على مستوى الدور.",
"Pro/zai-org/glm-5.1.description": "GLM-5.1 هو نموذج وكيل رائد من الجيل التالي من Zhipu للهندسة الذكية. يستخدم هيكل Mixture-of-Experts مع 754 مليار معلمة، مع استدعاء أدوات أصلية، إكمال بادئة، دعم FIM، ونافذة سياق 200K لتدفقات العمل طويلة الأمد.",
"Pro/zai-org/glm-5.description": "GLM-5 هو نموذج اللغة الكبير من الجيل التالي من Zhipu، يركز على هندسة الأنظمة المعقدة ومهام الوكيل طويلة المدة. تم توسيع معلمات النموذج إلى 744 مليار (40 مليار نشطة) وتدمج DeepSeek Sparse Attention.",
"QwQ-32B-Preview.description": "Qwen QwQ هو نموذج بحث تجريبي يركز على تحسين الاستدلال.",
"Qwen/QVQ-72B-Preview.description": "QVQ-72B-Preview هو نموذج بحثي من Qwen يركز على الاستدلال البصري، مع قوة في فهم المشاهد المعقدة ومسائل الرياضيات البصرية.",
"Qwen/QwQ-32B-Preview.description": "Qwen QwQ هو نموذج بحث تجريبي يركز على تحسين استدلال الذكاء الاصطناعي.",
"Qwen/QwQ-32B.description": "QwQ هو نموذج استدلال ضمن عائلة Qwen. مقارنة بالنماذج التقليدية الموجهة للتعليمات، يضيف QwQ قدرات تفكير واستدلال تعزز الأداء بشكل كبير في المهام الصعبة. QwQ-32B هو نموذج استدلال متوسط الحجم ينافس نماذج استدلال رائدة مثل DeepSeek-R1 وo1-mini. يستخدم RoPE، SwiGLU، RMSNorm، وانحياز QKV في الانتباه، مع 64 طبقة و40 رأس انتباه (8 KV في GQA).",
"Qwen/Qwen-Image-Edit-2509.description": "Qwen-Image-Edit-2509 هو أحدث إصدار لتحرير الصور من فريق Qwen. مبني على نموذج Qwen-Image بحجم 20 مليار معلمة، ويمتد من قدرات عرض النصوص القوية إلى تحرير الصور بدقة. يستخدم بنية تحكم مزدوجة، حيث تُرسل المدخلات إلى Qwen2.5-VL للتحكم الدلالي وإلى مشفر VAE للتحكم في المظهر، مما يتيح تحريرًا على مستوى الدلالة والمظهر. يدعم التعديلات المحلية (إضافة/إزالة/تعديل) والتعديلات الدلالية المتقدمة مثل إنشاء الملكية الفكرية ونقل الأسلوب مع الحفاظ على المعنى. يحقق نتائج رائدة في العديد من المعايير.",
"Qwen/Qwen-Image.description": "Qwen-Image هو نموذج أساسي لتوليد الصور يحتوي على 20 مليار معلمة من فريق Qwen. يحقق تقدمًا كبيرًا في عرض النصوص المعقدة وتحرير الصور بدقة، خاصة للنصوص الصينية/الإنجليزية عالية الدقة. يدعم تخطيطات متعددة الأسطر والفقرة مع الحفاظ على تناسق الطباعة. بالإضافة إلى عرض النصوص، يدعم مجموعة واسعة من الأساليب من الواقعية إلى الأنمي، والتحرير المتقدم مثل نقل الأسلوب، إضافة/إزالة الكائنات، تحسين التفاصيل، تحرير النصوص، والتحكم في الوضعية، ويهدف إلى أن يكون نموذجًا أساسيًا شاملاً للإبداع البصري.",
"Qwen/Qwen2-72B-Instruct.description": "يقدم Qwen 2 Instruct (72B) استجابة دقيقة للتعليمات، مما يجعله مناسبًا لأعباء العمل المؤسسية.",
"Qwen/Qwen2-7B-Instruct.description": "Qwen2-7B-Instruct هو نموذج بحجم 7B مضبوط على التعليمات ضمن سلسلة Qwen2، يستخدم تقنيات Transformer وSwiGLU وQKV bias والانتباه المجمع. يتميز بقدرته على معالجة مدخلات كبيرة وأداء قوي في مجالات الفهم، التوليد، التعدد اللغوي، البرمجة، الرياضيات، والاستدلال، متفوقًا على معظم النماذج المفتوحة وسابقه Qwen1.5-7B-Chat في عدة تقييمات.",
"Qwen/Qwen2-VL-72B-Instruct.description": "Qwen2-VL هو أحدث نموذج من سلسلة Qwen-VL، يحقق نتائج رائدة في اختبارات الرؤية مثل MathVista وDocVQA وRealWorldQA وMTVQA. يمكنه فهم مقاطع فيديو تتجاوز 20 دقيقة لأغراض الأسئلة والأجوبة، الحوار، وإنشاء المحتوى. كما يدعم الاستدلال المعقد واتخاذ القرار، ويتكامل مع الأجهزة/الروبوتات لتنفيذ إجراءات تعتمد على الرؤية. بالإضافة إلى الإنجليزية والصينية، يمكنه قراءة نصوص بلغات متعددة تشمل معظم اللغات الأوروبية، اليابانية، الكورية، العربية، والفيتنامية.",
"Qwen/Qwen2.5-14B-Instruct.description": "Qwen2.5-14B-Instruct هو جزء من أحدث سلسلة نماذج LLM من Alibaba Cloud. يوفر هذا النموذج بحجم 14B تحسينات ملحوظة في البرمجة والرياضيات، ويدعم أكثر من 29 لغة، ويعزز اتباع التعليمات وفهم البيانات المنظمة وإنتاج مخرجات منظمة (خصوصًا بصيغة JSON).",
"Qwen/Qwen2.5-32B-Instruct.description": "Qwen2.5-32B-Instruct هو جزء من أحدث سلسلة نماذج LLM من Alibaba Cloud. يوفر هذا النموذج بحجم 32B تحسينات ملحوظة في البرمجة والرياضيات، ويدعم أكثر من 29 لغة، ويعزز اتباع التعليمات وفهم البيانات المنظمة وإنتاج مخرجات منظمة (خصوصًا بصيغة JSON).",
"Qwen/Qwen2.5-72B-Instruct-128K.description": "Qwen2.5-72B-Instruct هو جزء من أحدث سلسلة نماذج LLM من Alibaba Cloud. يوفر هذا النموذج بحجم 72B تحسينات في البرمجة والرياضيات، ويدعم مدخلات تصل إلى 128K ومخرجات تتجاوز 8K، ويشمل دعمًا لأكثر من 29 لغة، مع تحسينات في اتباع التعليمات وإنتاج مخرجات منظمة (خصوصًا بصيغة JSON).",
@@ -160,17 +160,23 @@
"Qwen/Qwen2.5-7B-Instruct-Turbo.description": "Qwen2.5 هو عائلة جديدة من نماذج LLM مصممة خصيصًا لمهام تعتمد على التعليمات.",
"Qwen/Qwen2.5-7B-Instruct.description": "Qwen2.5-7B-Instruct هو جزء من أحدث سلسلة نماذج LLM من Alibaba Cloud. يوفر هذا النموذج بحجم 7B تحسينات ملحوظة في البرمجة والرياضيات، ويدعم أكثر من 29 لغة، ويعزز اتباع التعليمات وفهم البيانات المنظمة وإنتاج مخرجات منظمة (خصوصًا بصيغة JSON).",
"Qwen/Qwen2.5-Coder-32B-Instruct.description": "Qwen2.5 Coder 32B Instruct هو أحدث نموذج LLM من Alibaba Cloud يركز على البرمجة. مبني على Qwen2.5 ومدرب على 5.5 تريليون رمز، يعزز بشكل كبير توليد الشيفرة، الاستدلال، وتصحيح الأخطاء، مع الحفاظ على قدرات قوية في الرياضيات والمهام العامة، مما يجعله أساسًا قويًا لوكلاء البرمجة.",
"Qwen/Qwen2.5-VL-32B-Instruct.description": "Qwen2.5-VL-32B-Instruct هو نموذج متعدد الوسائط من فريق Qwen. يتعرف على الكائنات الشائعة ويحلل النصوص، الرسوم البيانية، الأيقونات، الرسومات، والتصاميم. كوكل بصري، يمكنه الاستدلال والتحكم الديناميكي في الأدوات، بما في ذلك استخدام الحاسوب والهاتف. يحدد الكائنات بدقة وينتج مخرجات منظمة للفواتير والجداول. مقارنة بـ Qwen2-VL، يوفر تحسينات إضافية في الرياضيات وحل المشكلات، مع استجابات مفضلة أكثر من قبل البشر.",
"Qwen/Qwen2.5-VL-72B-Instruct.description": "Qwen2.5-VL هو نموذج رؤية-لغة في سلسلة Qwen2.5 مع ترقيات رئيسية: فهم بصري أقوى للكائنات، النصوص، الرسوم البيانية، والتصاميم؛ الاستدلال كوكل بصري باستخدام أدوات ديناميكية؛ فهم مقاطع فيديو تتجاوز الساعة والتقاط الأحداث الرئيسية؛ تحديد دقيق للكائنات باستخدام مربعات أو نقاط؛ ومخرجات منظمة للبيانات الممسوحة مثل الفواتير والجداول.",
"Qwen/Qwen3-14B.description": "Qwen3 هو الجيل التالي من نموذج Tongyi Qwen، يحقق تقدمًا كبيرًا في الاستدلال، القدرات العامة، قدرات الوكلاء، والأداء متعدد اللغات، ويدعم التبديل بين أوضاع التفكير.",
"Qwen/Qwen3-235B-A22B-Instruct-2507.description": "Qwen3-235B-A22B-Instruct-2507 هو النموذج الرائد من نوع MoE في سلسلة Qwen3، يحتوي على 235 مليار معلمة إجمالية و22 مليار نشطة. هو إصدار غير مفكر محدث يركز على تحسين اتباع التعليمات، الاستدلال المنطقي، فهم النصوص، الرياضيات، العلوم، البرمجة، واستخدام الأدوات. كما يوسع المعرفة متعددة اللغات ويعزز التوافق مع تفضيلات المستخدم في المهام المفتوحة الذاتية.",
"Qwen/Qwen3-235B-A22B-Thinking-2507.description": "Qwen3-235B-A22B-Thinking-2507 هو نموذج Qwen3 مخصص للاستدلال المعقد. يستخدم بنية MoE مع 235 مليار معلمة إجمالية وحوالي 22 مليار نشطة لكل رمز لتعزيز الكفاءة. كنموذج تفكير مخصص، يظهر تقدمًا كبيرًا في المنطق، الرياضيات، العلوم، البرمجة، والمعايير الأكاديمية، محققًا أداءً رائدًا في التفكير المفتوح. كما يحسن اتباع التعليمات، استخدام الأدوات، وتوليد النصوص، ويدعم سياقًا يصل إلى 256K للاستدلال العميق والوثائق الطويلة.",
"Qwen/Qwen3-235B-A22B.description": "Qwen3 235B A22B هو نموذج Qwen3 واسع النطاق يقدم قدرات ذكاء اصطناعي من الدرجة الأولى.",
"Qwen/Qwen3-30B-A3B-Instruct-2507.description": "Qwen3-30B-A3B-Instruct-2507 هو الإصدار المحدث غير المفكر من Qwen3-30B-A3B. إنه نموذج MoE مع إجمالي 30.5 مليار و3.3 مليار معلمات نشطة. يحسن بشكل كبير اتباع التعليمات، التفكير المنطقي، فهم النصوص، الرياضيات، العلوم، البرمجة، واستخدام الأدوات، ويوسع المعرفة متعددة اللغات طويلة الذيل، ويتماشى بشكل أفضل مع تفضيلات المستخدم في المهام المفتوحة الذاتية. يدعم سياق 256K. هذا النموذج غير مفكر فقط ولن يخرج علامات `נקוד`.",
"Qwen/Qwen3-30B-A3B-Instruct-2507.description": "Qwen3-30B-A3B-Instruct-2507 هو الإصدار غير المفكر المحدث من Qwen3-30B-A3B. هو نموذج MoE يحتوي على 30.5 مليار معلمة إجمالية و3.3 مليار نشطة. يعزز بشكل كبير اتباع التعليمات، الاستدلال المنطقي، فهم النصوص، الرياضيات، العلوم، البرمجة، واستخدام الأدوات، ويوسع المعرفة متعددة اللغات، ويتماشى بشكل أفضل مع تفضيلات المستخدم في المهام المفتوحة الذاتية. يدعم سياقًا يصل إلى 256K. هذا النموذج غير مفكر فقط ولن ينتج علامات `<think></think>`.",
"Qwen/Qwen3-30B-A3B-Thinking-2507.description": "Qwen3-30B-A3B-Thinking-2507 هو أحدث نموذج تفكير في سلسلة Qwen3. هو نموذج MoE يحتوي على 30.5 مليار معلمة إجمالية و3.3 مليار نشطة، يركز على المهام المعقدة. يظهر تقدمًا كبيرًا في المنطق، الرياضيات، العلوم، البرمجة، والمعايير الأكاديمية، ويحسن اتباع التعليمات، استخدام الأدوات، توليد النصوص، والتوافق مع التفضيلات. يدعم سياقًا يصل إلى 256K ويمكن توسيعه إلى مليون رمز. هذا الإصدار مصمم لوضع التفكير مع استدلال تفصيلي خطوة بخطوة وقدرات وكيل قوية.",
"Qwen/Qwen3-32B.description": "Qwen3 هو الجيل التالي من نموذج Tongyi Qwen، يحقق تقدمًا كبيرًا في الاستدلال، القدرات العامة، قدرات الوكلاء، والأداء متعدد اللغات، ويدعم التبديل بين أوضاع التفكير.",
"Qwen/Qwen3-8B.description": "Qwen3 هو الجيل التالي من نموذج Tongyi Qwen، يحقق تقدمًا كبيرًا في الاستدلال، القدرات العامة، قدرات الوكلاء، والأداء متعدد اللغات، ويدعم التبديل بين أوضاع التفكير.",
"Qwen/Qwen3-Coder-30B-A3B-Instruct.description": "Qwen3-Coder-30B-A3B-Instruct هو نموذج برمجة من سلسلة Qwen3. مصمم لتحقيق أداء وكفاءة عالية مع تعزيز قدرات البرمجة. يظهر تفوقًا في البرمجة الوكيلة، تشغيل المتصفح التلقائي، واستخدام الأدوات بين النماذج المفتوحة. يدعم سياقًا يصل إلى 256K ويمكن توسيعه إلى مليون رمز لفهم على مستوى قواعد الشيفرة. يدعم البرمجة الوكيلة على منصات مثل Qwen Code وCLINE باستخدام تنسيق مخصص لاستدعاء الوظائف.",
"Qwen/Qwen3-Coder-480B-A35B-Instruct.description": "Qwen3-Coder-480B-A35B-Instruct هو أقوى نموذج برمجة من Alibaba حتى الآن. يعتمد على بنية MoE ويحتوي على 480 مليار معلمة إجمالية و35 مليار معلمة نشطة، مما يوازن بين الكفاءة والأداء. يدعم سياقًا يصل إلى 256 ألف رمز بشكل أصلي، ويمكن توسيعه إلى مليون رمز باستخدام YaRN، مما يتيح التعامل مع قواعد بيانات برمجية ضخمة. صُمم لسير عمل برمجي قائم على الوكلاء، ويمكنه التفاعل مع الأدوات والبيئات لحل مهام برمجية معقدة. يحقق نتائج رائدة بين النماذج المفتوحة في اختبارات البرمجة والوكلاء، ويقارن بأداء نماذج مثل Claude Sonnet 4.",
"Qwen/Qwen3-Omni-30B-A3B-Captioner.description": "Qwen3-Omni-30B-A3B-Captioner هو نموذج رؤية-لغة من سلسلة Qwen3 مصمم لتوليد أوصاف صور عالية الجودة، دقيقة ومفصلة. يستخدم بنية MoE تحتوي على 30 مليار معلمة لفهم الصور بعمق وتوليد أوصاف سلسة، ويتفوق في التقاط التفاصيل، وفهم المشاهد، والتعرف على الكائنات، والاستدلال العلاقي.",
"Qwen/Qwen3-Omni-30B-A3B-Instruct.description": "Qwen3-Omni-30B-A3B-Instruct هو نموذج MoE من سلسلة Qwen3 يحتوي على 30 مليار معلمة إجمالية و3 مليارات نشطة، ويقدم أداءً قويًا بتكلفة تنفيذ منخفضة. تم تدريبه على بيانات متعددة اللغات وعالية الجودة من مصادر متنوعة، ويدعم إدخالًا متعدد الوسائط (نص، صور، صوت، فيديو) وفهمًا وتوليدًا عبر الوسائط.",
"Qwen/Qwen3-Omni-30B-A3B-Thinking.description": "Qwen3-Omni-30B-A3B-Thinking هو المكون الأساسي \"المفكر\" في Qwen3-Omni. يعالج مدخلات متعددة الوسائط (نص، صوت، صور، فيديو) ويؤدي استدلالًا معقدًا بتسلسل تفكير، موحدًا المدخلات في تمثيل مشترك لفهم عميق عبر الوسائط. إنه نموذج MoE يحتوي على 30 مليار معلمة إجمالية و3 مليارات نشطة، ويوازن بين قوة الاستدلال وكفاءة الحوسبة.",
"Qwen/Qwen3-VL-235B-A22B-Instruct.description": "Qwen3-VL-235B-A22B-Instruct هو نموذج Qwen3-VL كبير موجه للتعليمات، مبني على بنية MoE، ويقدم فهمًا وتوليدًا متعدد الوسائط ممتازًا. يدعم سياقًا يصل إلى 256 ألف رمز بشكل أصلي، ومناسب لخدمات الإنتاج متعددة الوسائط ذات التوافر العالي.",
"Qwen/Qwen3-VL-235B-A22B-Thinking.description": "Qwen3-VL-235B-A22B-Thinking هو الإصدار الرائد للتفكير من Qwen3-VL، مُحسَّن للاستدلال متعدد الوسائط المعقد، والاستدلال في السياقات الطويلة، وتفاعل الوكلاء في سيناريوهات المؤسسات.",
"Qwen/Qwen3-VL-30B-A3B-Instruct.description": "Qwen3-VL-30B-A3B-Instruct هو نموذج Qwen3-VL موجه للتعليمات يتمتع بفهم وتوليد قوي بين الرؤية واللغة. يدعم سياقًا يصل إلى 256 ألف رمز بشكل أصلي للدردشة متعددة الوسائط وتوليد النصوص بناءً على الصور.",
"Qwen/Qwen3-VL-30B-A3B-Thinking.description": "Qwen3-VL-30B-A3B-Thinking هو الإصدار المعزز بالاستدلال من Qwen3-VL، مُحسَّن للاستدلال متعدد الوسائط، وتحويل الصور إلى شيفرة، وفهم بصري معقد. يدعم سياقًا يصل إلى 256 ألف رمز مع قدرة أقوى على تسلسل التفكير.",
"Qwen/Qwen3-VL-32B-Instruct.description": "Qwen3-VL-32B-Instruct هو نموذج رؤية-لغة من فريق Qwen يحقق نتائج رائدة في اختبارات VL متعددة. يدعم صورًا بدقة ميغابيكسل ويوفر فهمًا بصريًا قويًا، والتعرف البصري متعدد اللغات، وتحديد دقيق للعناصر البصرية، وحوارًا بصريًا. يتعامل مع مهام متعددة الوسائط معقدة ويدعم استدعاء الأدوات وإكمال المقدمات.",
@@ -183,7 +189,6 @@
"Qwen/Qwen3.5-397B-A17B.description": "Qwen3.5-397B-A17B هو أحدث نموذج رؤية-لغة في سلسلة Qwen3.5، يستخدم بنية Mixture-of-Experts (MoE) مع إجمالي 397 مليار معلمة و17 مليار معلمة مفعلة. يدعم طول سياق 256K مع إمكانية التمديد إلى حوالي مليون رمز، يدعم 201 لغة، ويوفر فهمًا موحدًا للرؤية-اللغة، واستدعاء الأدوات، وقدرات الاستنتاج.",
"Qwen/Qwen3.5-4B.description": "Qwen3.5-4B هو نموذج لغة كبير متعدد الوسائط من فريق Qwen مع 4 مليارات معلمة، وهو النموذج الأكثر خفة في سلسلة Qwen3.5. يعتمد على بنية هجينة فعالة تجمع بين شبكات Gated Delta وGated Attention، ويدعم طول سياق 256K مع إمكانية التمديد إلى حوالي مليون رمز.",
"Qwen/Qwen3.5-9B.description": "Qwen3.5-9B هو نموذج لغة كبير متعدد الوسائط من فريق Qwen مع 9 مليارات معلمة. كنموذج خفيف الوزن في سلسلة Qwen3.5، يعتمد على بنية هجينة فعالة تجمع بين شبكات Gated Delta وGated Attention، ويدعم طول سياق 256K مع إمكانية التمديد إلى حوالي مليون رمز.",
"Qwen/Qwen3.6-27B.description": "Qwen3.6-27B هو أول نموذج متوسط الحجم مفتوح المصدر في سلسلة Qwen3.6، مع تحسينات رئيسية لتوليد الأكواد، تدفقات عمل الوكلاء، وسيناريوهات التطوير الواقعية. مقارنة بـ Qwen3.5-27B، يظهر هذا النموذج تحسينات كبيرة في تطوير الواجهة الأمامية، التفكير على مستوى المستودعات، استدعاء الأدوات، وحل المشكلات المعقدة، مع تحسينات جديدة لقدرات التفكير التاريخي.",
"Qwen/Qwen3.6-35B-A3B.description": "يعد Qwen3.6-35B-A3B نموذجاً لغوياً كبيراً من فريق Qwen ضمن سلسلة Qwen3.6، ويعتمد في بنيته على هندسة الخبراء المتعددين (MoE) مع 35 مليار مُعامل إجمالي و3 مليارات مُعامل نشط. يوازن هذا النموذج بين كفاءة الاستدلال والأداء المتميز، ويدعم وضعي التفكير وغير التفكير، مما يسمح بالتنقل المرن بين الاستجابة السريعة والاستدلال العميق.",
"Qwen2-72B-Instruct.description": "Qwen2 هو أحدث إصدار من سلسلة Qwen، يدعم نافذة سياق تصل إلى 128 ألف رمز. مقارنة بأفضل النماذج المفتوحة الحالية، يتفوق Qwen2-72B بشكل كبير في فهم اللغة الطبيعية، والمعرفة، والبرمجة، والرياضيات، والقدرات متعددة اللغات.",
"Qwen2-7B-Instruct.description": "Qwen2 هو أحدث إصدار من سلسلة Qwen، ويتفوق على أفضل النماذج المفتوحة من نفس الحجم وحتى الأكبر منها. يُظهر Qwen2 7B تفوقًا ملحوظًا في عدة اختبارات، خاصة في البرمجة وفهم اللغة الصينية.",
@@ -291,11 +296,13 @@
"anthropic/claude-opus-4.description": "Opus 4 هو النموذج الرائد من Anthropic المصمم للمهام المعقدة وتطبيقات المؤسسات.",
"anthropic/claude-sonnet-4.5.description": "Claude Sonnet 4.5 هو أحدث نموذج استدلال هجين من Anthropic مُحسَّن للاستدلال المعقد والترميز.",
"anthropic/claude-sonnet-4.description": "Claude Sonnet 4 هو نموذج استدلال هجين من Anthropic يجمع بين التفكير وغير التفكير.",
"ascend-tribe/pangu-pro-moe.description": "Pangu-Pro-MoE 72B-A16B هو نموذج LLM متفرق يحتوي على 72 مليار معلمة إجمالية و16 مليار نشطة، يعتمد على بنية MoGE. يقوم بتجميع الخبراء أثناء الاختيار ويقيد الرموز لتنشيط عدد متساوٍ من الخبراء لكل مجموعة، مما يوازن الحمل ويحسن كفاءة النشر على Ascend.",
"aya.description": "Aya 23 هو نموذج متعدد اللغات من Cohere يدعم 23 لغة لمجموعة متنوعة من الاستخدامات.",
"aya:35b.description": "Aya 23 هو نموذج متعدد اللغات من Cohere يدعم 23 لغة لمجموعة متنوعة من الاستخدامات.",
"azure-DeepSeek-R1-0528.description": "تم نشره بواسطة Microsoft؛ تم ترقية DeepSeek R1 إلى DeepSeek-R1-0528. يتضمن التحديث تحسينات في الحوسبة وخوارزميات ما بعد التدريب، مما يعزز عمق الاستدلال والاستنتاج بشكل كبير. يتميز بأداء قوي في الرياضيات، والترميز، والمعايير المنطقية العامة، ويقترب من نماذج رائدة مثل O3 وGemini 2.5 Pro.",
"baichuan-m2-32b.description": "Baichuan M2 32B هو نموذج MoE من Baichuan Intelligence يتمتع بقدرات استدلال قوية.",
"baichuan/baichuan2-13b-chat.description": "Baichuan-13B هو نموذج LLM مفتوح المصدر وقابل للاستخدام التجاري يحتوي على 13 مليار معلمة من Baichuan، يحقق نتائج رائدة في فئته على معايير اللغة الصينية والإنجليزية الموثوقة.",
"baidu/ERNIE-4.5-300B-A47B.description": "ERNIE-4.5-300B-A47B هو نموذج MoE من Baidu يحتوي على 300 مليار معلمة إجمالية و47 مليار نشطة لكل رمز، يوازن بين الأداء القوي وكفاءة الحوسبة. كنموذج أساسي في سلسلة ERNIE 4.5، يتميز بالفهم والتوليد والاستدلال والبرمجة. يستخدم طريقة تدريب مسبق متعددة الوسائط غير متجانسة مع تدريب مشترك على النصوص والرؤية لتعزيز القدرات، خاصة في اتباع التعليمات والمعرفة العامة.",
"baidu/ernie-5.0-thinking-preview.description": "ERNIE 5.0 Thinking Preview هو نموذج ERNIE متعدد الوسائط من الجيل التالي من Baidu، يتميز بفهم متعدد الوسائط قوي، واتباع التعليمات، والإبداع، والأسئلة والأجوبة الواقعية، واستدعاء الأدوات.",
"big-pickle.description": "Big Pickle من OpenCode — نموذج مجاني بوزن مفتوح مع قدرات قوية في البرمجة.",
"black-forest-labs/flux-1.1-pro.description": "FLUX 1.1 Pro هو إصدار أسرع ومحسّن من FLUX Pro يتميز بجودة صور ممتازة والتزام دقيق بالتعليمات.",
@@ -308,7 +315,6 @@
"c4ai-aya-vision-8b.description": "Aya Vision هو نموذج متعدد الوسائط متقدم يقدم أداءً قويًا في اختبارات اللغة والنصوص والرؤية. يركز إصدار 8B على تقليل التأخير مع الحفاظ على أداء قوي.",
"charglm-3.description": "CharGLM-3 مصمم للمحادثات التمثيلية والدعم العاطفي، ويدعم ذاكرة طويلة متعددة الأدوار وحوارات مخصصة.",
"charglm-4.description": "CharGLM-4 مصمم للمحادثات التمثيلية والدعم العاطفي، ويدعم ذاكرة طويلة متعددة الأدوار وحوارات مخصصة.",
"chat-latest.description": "أحدث نموذج فوري مستخدم في ChatGPT.",
"chatgpt-4o-latest.description": "ChatGPT-4o هو نموذج ديناميكي يتم تحديثه في الوقت الفعلي. يجمع بين فهم اللغة القوي وتوليدها للاستخدامات واسعة النطاق مثل دعم العملاء والتعليم والمساعدة التقنية.",
"claude-2.0.description": "Claude 2 يقدم تحسينات رئيسية للمؤسسات، بما في ذلك سياق 200 ألف رمز، تقليل الهلوسة، دعم التعليمات النظامية، وميزة جديدة: استدعاء الأدوات.",
"claude-2.1.description": "Claude 2 يقدم تحسينات رئيسية للمؤسسات، بما في ذلك سياق 200 ألف رمز، تقليل الهلوسة، دعم التعليمات النظامية، وميزة جديدة: استدعاء الأدوات.",
@@ -320,13 +326,13 @@
"claude-3-haiku-20240307.description": "Claude 3 Haiku هو أسرع وأصغر نموذج من Anthropic، مصمم لتقديم استجابات شبه فورية بأداء سريع ودقيق.",
"claude-3-opus-20240229.description": "Claude 3 Opus هو أقوى نموذج من Anthropic للمهام المعقدة، يتميز بالأداء العالي، الذكاء، الطلاقة، والفهم.",
"claude-3-sonnet-20240229.description": "Claude 3 Sonnet يوازن بين الذكاء والسرعة لتلبية احتياجات المؤسسات، ويوفر فائدة عالية بتكلفة أقل ونشر موثوق على نطاق واسع.",
"claude-haiku-4-5-20251001.description": "Claude Haiku 4.5 هو أسرع وأذكى نموذج هايكو من Anthropic، يتميز بسرعة البرق وتفكير ممتد.",
"claude-haiku-4-5-20251001.description": "Claude Haiku 4.5 هو النموذج الأسرع والأذكى من Anthropic، مع سرعة فائقة وقدرات تفكير ممتدة.",
"claude-haiku-4-5.description": "Claude Haiku 4.5 من Anthropic — نموذج Haiku من الجيل التالي مع تحسينات في التفكير والرؤية.",
"claude-haiku-4.5.description": "Claude Haiku 4.5 هو نموذج Haiku الأسرع والأذكى من Anthropic، يتميز بسرعة البرق وقدرات استدلال موسعة.",
"claude-opus-4-1-20250805-thinking.description": "Claude Opus 4.1 Thinking هو إصدار متقدم يمكنه عرض عملية تفكيره.",
"claude-opus-4-1-20250805.description": "Claude Opus 4.1 هو أحدث وأقوى نموذج من Anthropic للمهام المعقدة للغاية، يتميز بالأداء والذكاء والطلاقة والفهم.",
"claude-opus-4-1-20250805.description": "Claude Opus 4.1 هو أحدث نموذج من Anthropic وأكثرها قدرة على المهام المعقدة، يتفوق في الأداء، الذكاء، الطلاقة، والفهم.",
"claude-opus-4-1.description": "Claude Opus 4.1 من Anthropic — نموذج تفكير متميز مع قدرات تحليل عميقة.",
"claude-opus-4-20250514.description": "Claude Opus 4 هو أقوى نموذج من Anthropic للمهام المعقدة للغاية، يتميز بالأداء والذكاء والطلاقة والفهم.",
"claude-opus-4-20250514.description": "Claude Opus 4 هو النموذج الأكثر قوة من Anthropic للمهام المعقدة للغاية، يتفوق في الأداء، الذكاء، الطلاقة، والفهم.",
"claude-opus-4-5-20251101.description": "Claude Opus 4.5 هو النموذج الرائد من Anthropic، يجمع بين الذكاء الاستثنائي والأداء القابل للتوسع، مثالي للمهام المعقدة التي تتطلب استجابات عالية الجودة وتفكير متقدم.",
"claude-opus-4-5.description": "Claude Opus 4.5 من Anthropic — نموذج رئيسي مع تفكير وبرمجة من الدرجة الأولى.",
"claude-opus-4-6.description": "Claude Opus 4.6 من Anthropic — نافذة سياق 1M نموذج رئيسي مع تفكير متقدم.",
@@ -335,7 +341,7 @@
"claude-opus-4.6-fast.description": "Claude Opus 4.6 هو النموذج الأكثر ذكاءً من Anthropic لبناء الوكلاء والبرمجة.",
"claude-opus-4.6.description": "Claude Opus 4.6 هو النموذج الأكثر ذكاءً من Anthropic لبناء الوكلاء والبرمجة.",
"claude-sonnet-4-20250514-thinking.description": "Claude Sonnet 4 Thinking يمكنه تقديم استجابات شبه فورية أو تفكير متسلسل مرئي.",
"claude-sonnet-4-20250514.description": "Claude Sonnet 4 هو النموذج الأكثر ذكاءً من Anthropic حتى الآن، يقدم استجابات شبه فورية أو تفكير خطوة بخطوة ممتد مع تحكم دقيق لمستخدمي API.",
"claude-sonnet-4-20250514.description": "Claude Sonnet 4 يمكنه إنتاج استجابات شبه فورية أو تفكير ممتد خطوة بخطوة مع عملية مرئية.",
"claude-sonnet-4-5-20250929.description": "Claude Sonnet 4.5 هو النموذج الأكثر ذكاءً من Anthropic حتى الآن.",
"claude-sonnet-4-5.description": "Claude Sonnet 4.5 من Anthropic — نموذج Sonnet محسّن مع أداء برمجي معزز.",
"claude-sonnet-4-6.description": "Claude Sonnet 4.6 من Anthropic — أحدث نموذج Sonnet مع برمجة واستخدام أدوات متفوقة.",
@@ -399,20 +405,24 @@
"deepseek-ai/DeepSeek-R1-Distill-Llama-70B.description": "تستخدم نماذج DeepSeek-R1 المستخلصة التعلم المعزز وبيانات البداية الباردة لتحسين التفكير وتحديد معايير جديدة للنماذج المفتوحة متعددة المهام.",
"deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B.description": "تستخدم نماذج DeepSeek-R1 المستخلصة التعلم المعزز وبيانات البداية الباردة لتحسين التفكير وتحديد معايير جديدة للنماذج المفتوحة متعددة المهام.",
"deepseek-ai/DeepSeek-R1-Distill-Qwen-14B.description": "تستخدم نماذج DeepSeek-R1 المستخلصة التعلم المعزز وبيانات البداية الباردة لتحسين التفكير وتحديد معايير جديدة للنماذج المفتوحة متعددة المهام.",
"deepseek-ai/DeepSeek-R1-Distill-Qwen-32B.description": "تم استخلاص DeepSeek-R1-Distill-Qwen-32B من Qwen2.5-32B وتم تحسينه باستخدام 800 ألف عينة مختارة من DeepSeek-R1. يتميز في الرياضيات، والبرمجة، والتفكير، ويحقق نتائج قوية في AIME 2024، وMATH-500 (بدقة 94.3٪)، وGPQA Diamond.",
"deepseek-ai/DeepSeek-R1-Distill-Qwen-7B.description": "DeepSeek-R1-Distill-Qwen-7B مستخلص من Qwen2.5-Math-7B ومُحسن على 800 ألف عينة مختارة من DeepSeek-R1. يقدم أداءً قويًا، بنسبة 92.8% على MATH-500، و55.5% على AIME 2024، وتصنيف 1189 على CodeForces لنموذج 7B.",
"deepseek-ai/DeepSeek-R1.description": "يعزز DeepSeek-R1 قدرات التفكير باستخدام التعلم المعزز وبيانات البداية الباردة، ويحدد معايير جديدة للنماذج المفتوحة متعددة المهام متفوقًا على OpenAI-o1-mini.",
"deepseek-ai/DeepSeek-V2.5.description": "يعمل DeepSeek-V2.5 على ترقية DeepSeek-V2-Chat وDeepSeek-Coder-V2-Instruct، ويمزج بين القدرات العامة والبرمجية. يحسن الكتابة واتباع التعليمات لمواءمة التفضيلات بشكل أفضل، ويظهر تحسنًا ملحوظًا في AlpacaEval 2.0 وArenaHard وAlignBench وMT-Bench.",
"deepseek-ai/DeepSeek-V3.1-Terminus.description": "DeepSeek-V3.1-Terminus هو إصدار محدث من V3.1 كنموذج وكيل هجين. يعالج المشكلات التي أبلغ عنها المستخدمون ويحسن الاستقرار واتساق اللغة ويقلل من الخلط بين الصينية/الإنجليزية والرموز غير الطبيعية. يدمج أوضاع التفكير وغير التفكير مع قوالب المحادثة للتبديل المرن. كما يعزز أداء وكلاء الكود والبحث لاستخدام الأدوات بشكل أكثر موثوقية وتنفيذ المهام متعددة الخطوات.",
"deepseek-ai/DeepSeek-V3.1.description": "يستخدم DeepSeek V3.1 بنية تفكير هجينة ويدعم أوضاع التفكير وغير التفكير.",
"deepseek-ai/DeepSeek-V3.2-Exp.description": "DeepSeek V3.2 Exp يستخدم بنية تفكير هجينة ويدعم أوضاع التفكير وغير التفكير.",
"deepseek-ai/DeepSeek-V3.2.description": "DeepSeek-V3.2 هو نموذج يجمع بين الكفاءة الحسابية العالية وأداء التفكير والوكيل الممتاز. يعتمد نهجه على ثلاثة اختراقات تكنولوجية رئيسية: DeepSeek Sparse Attention (DSA)، وهي آلية انتباه فعالة تقلل بشكل كبير من التعقيد الحسابي مع الحفاظ على أداء النموذج، ومُحسنة خصيصًا للسيناريوهات ذات السياق الطويل؛ إطار عمل للتعلم المعزز القابل للتوسع يمكن من خلاله أن ينافس أداء النموذج GPT-5، مع نسخته عالية الحوسبة التي تضاهي Gemini-3.0-Pro في قدرات التفكير؛ وخط أنابيب واسع النطاق لتوليف مهام الوكيل يهدف إلى دمج قدرات التفكير في سيناريوهات استخدام الأدوات، مما يحسن اتباع التعليمات والتعميم في البيئات التفاعلية المعقدة. حقق النموذج أداءً متميزًا في الأولمبياد الدولي للرياضيات (IMO) وأولمبياد المعلوماتية الدولي (IOI) لعام 2025.",
"deepseek-ai/DeepSeek-V3.description": "DeepSeek-V3 هو نموذج MoE يحتوي على 671 مليار معلمة، يستخدم MLA وDeepSeekMoE مع توازن تحميل خالٍ من الفقدان لتدريب واستدلال فعال. تم تدريبه مسبقًا على 14.8 تريليون رمز عالي الجودة مع SFT وRL، ويتفوق على النماذج المفتوحة الأخرى ويقترب من النماذج المغلقة الرائدة.",
"deepseek-ai/DeepSeek-V4-Flash.description": "DeepSeek-V4-Flash هو إصدار معاينة لنموذج اللغة MoE في سلسلة DeepSeek-V4. حجم المعلمات الإجمالي هو 284 مليار، حجم المعلمات النشطة هو 13 مليار، ويدعم سياق طويل للغاية يصل إلى 1 مليون رمز. يستخدم النموذج هيكل انتباه هجين يجمع بين CSA وHCA، ويقدم mHC وMuon Optimizer لتحسين كفاءة التفكير طويل السياق، استقرار التدريب، والأداء العام.",
"deepseek-ai/deepseek-llm-67b-chat.description": "DeepSeek LLM Chat (67B) هو نموذج مبتكر يوفر فهمًا عميقًا للغة وتفاعلًا ذكيًا.",
"deepseek-ai/deepseek-v3.1-terminus.description": "DeepSeek V3.1 هو نموذج تفكير من الجيل التالي يتمتع بقدرات أقوى في التفكير المعقد وسلسلة التفكير لمهام التحليل العميق.",
"deepseek-ai/deepseek-v3.1.description": "DeepSeek V3.1 هو نموذج تفكير من الجيل التالي يتمتع بقدرات أقوى في التفكير المعقد وسلسلة التفكير لمهام التحليل العميق.",
"deepseek-ai/deepseek-v3.2.description": "DeepSeek V3.2 هو نموذج استدلال من الجيل التالي يتميز بقدرات استدلال معقدة وسلسلة التفكير.",
"deepseek-chat.description": "اسم مستعار متوافق لوضع عدم التفكير في DeepSeek V4 Flash. مقرر إيقافه — استخدم DeepSeek V4 Flash بدلاً منه.",
"deepseek-chat.description": "نموذج مفتوح المصدر جديد يجمع بين القدرات العامة والبرمجية. يحافظ على الحوار العام لنموذج الدردشة وقوة البرمجة لنموذج البرمجة، مع تحسين التوافق مع التفضيلات. DeepSeek-V2.5 يحسن أيضًا الكتابة واتباع التعليمات.",
"deepseek-coder-33B-instruct.description": "DeepSeek Coder 33B هو نموذج لغة برمجية تم تدريبه على 2 تريليون رمز (87٪ كود، 13٪ نص صيني/إنجليزي). يقدم نافذة سياق 16K ومهام الإكمال في المنتصف، ويوفر إكمال كود على مستوى المشاريع وملء مقاطع الكود.",
"deepseek-coder-v2.description": "DeepSeek Coder V2 هو نموذج كود MoE مفتوح المصدر يتميز بأداء قوي في مهام البرمجة، ويضاهي GPT-4 Turbo.",
"deepseek-coder-v2:236b.description": "DeepSeek Coder V2 هو نموذج كود MoE مفتوح المصدر يتميز بأداء قوي في مهام البرمجة، ويضاهي GPT-4 Turbo.",
"deepseek-ocr.description": "DeepSeek-OCR هو نموذج رؤية-لغة من DeepSeek AI يركز على OCR و\"الضغط البصري السياقي\". يستكشف ضغط المعلومات السياقية من الصور، ويعالج المستندات بكفاءة، ويحولها إلى تنسيقات نصية منظمة مثل Markdown. يتعرف بدقة على النصوص في الصور، مما يجعله مثاليًا لتحويل المستندات إلى صيغة رقمية، واستخراج النصوص، والمعالجة المنظمة.",
"deepseek-r1-0528.description": "نموذج كامل بسعة 685 مليار تم إصداره في 28 مايو 2025. يستخدم DeepSeek-R1 التعلم المعزز واسع النطاق بعد التدريب، مما يعزز التفكير بشكل كبير باستخدام بيانات معنونة قليلة، ويؤدي أداءً قويًا في الرياضيات، والبرمجة، والتفكير باللغة الطبيعية.",
"deepseek-r1-250528.description": "DeepSeek R1 250528 هو النموذج الكامل للتفكير من DeepSeek-R1 للمهام الرياضية والمنطقية الصعبة.",
"deepseek-r1-70b-fast-online.description": "إصدار سريع من DeepSeek R1 70B مع بحث ويب في الوقت الحقيقي، يوفر استجابات أسرع مع الحفاظ على الأداء.",
@@ -431,7 +441,7 @@
"deepseek-r1-fast-online.description": "الإصدار الكامل السريع من DeepSeek R1 مع بحث ويب في الوقت الحقيقي، يجمع بين قدرات بحجم 671B واستجابة أسرع.",
"deepseek-r1-online.description": "الإصدار الكامل من DeepSeek R1 مع 671 مليار معلمة وبحث ويب في الوقت الحقيقي، يوفر فهمًا وتوليدًا أقوى.",
"deepseek-r1.description": "يستخدم DeepSeek-R1 بيانات البداية الباردة قبل التعلم المعزز ويؤدي أداءً مماثلًا لـ OpenAI-o1 في الرياضيات، والبرمجة، والتفكير.",
"deepseek-reasoner.description": "اسم مستعار متوافق لوضع التفكير في DeepSeek V4 Flash. مقرر إيقافه — استخدم DeepSeek V4 Flash بدلاً منه.",
"deepseek-reasoner.description": "اسم مستعار متوافق لوضع التفكير السريع DeepSeek V4. مقرر إيقافه — استخدم deepseek-v4-flash بدلاً منه.",
"deepseek-v2.description": "DeepSeek V2 هو نموذج MoE فعال لمعالجة منخفضة التكلفة.",
"deepseek-v2:236b.description": "DeepSeek V2 236B هو نموذج DeepSeek الموجه للبرمجة مع قدرات قوية في توليد الكود.",
"deepseek-v3-0324.description": "DeepSeek-V3-0324 هو نموذج MoE يحتوي على 671 مليار معلمة يتميز بقوة في البرمجة، والقدرات التقنية، وفهم السياق، والتعامل مع النصوص الطويلة.",
@@ -450,16 +460,19 @@
"deepseek-vl2-small.description": "DeepSeek VL2 Small هو إصدار متعدد الوسائط خفيف الوزن للاستخدام في البيئات ذات الموارد المحدودة أو التزامن العالي.",
"deepseek-vl2.description": "DeepSeek VL2 هو نموذج متعدد الوسائط لفهم النصوص والصور والإجابة البصرية الدقيقة.",
"deepseek/deepseek-chat-v3-0324.description": "DeepSeek V3 هو نموذج MoE يحتوي على 685 مليار معلمة، وهو أحدث إصدار من سلسلة دردشة DeepSeek الرائدة.\n\nيعتمد على [DeepSeek V3](/deepseek/deepseek-chat-v3) ويؤدي أداءً قويًا عبر المهام.",
"deepseek/deepseek-chat-v3-0324:free.description": "DeepSeek V3 هو نموذج MoE يحتوي على 685 مليار معلمة، وهو أحدث إصدار من سلسلة دردشة DeepSeek الرائدة.\n\nيعتمد على [DeepSeek V3](/deepseek/deepseek-chat-v3) ويؤدي أداءً قويًا عبر المهام.",
"deepseek/deepseek-chat-v3.1.description": "DeepSeek-V3.1 هو نموذج استدلال هجين طويل السياق من DeepSeek، يدعم أوضاع التفكير وغير التفكير ودمج الأدوات.",
"deepseek/deepseek-chat.description": "DeepSeek-V3 هو نموذج استدلال هجين عالي الأداء من DeepSeek للمهام المعقدة ودمج الأدوات.",
"deepseek/deepseek-math-v2.description": "DeepSeek Math V2 هو نموذج حقق تقدمًا كبيرًا في قدرات الاستدلال الرياضي. تكمن ابتكاره الأساسي في آلية التدريب \"التحقق الذاتي\"، وقد حصل على مستويات ميدالية ذهبية في العديد من المسابقات الرياضية العالمية.",
"deepseek/deepseek-r1-0528.description": "DeepSeek R1 0528 هو إصدار محدث يركز على الإتاحة المفتوحة والاستدلال الأعمق.",
"deepseek/deepseek-r1-0528:free.description": "يحسن DeepSeek-R1 الاستدلال بشكل كبير باستخدام بيانات معنونة قليلة، ويخرج سلسلة من الأفكار قبل الإجابة النهائية لتحسين الدقة.",
"deepseek/deepseek-r1-distill-llama-70b.description": "DeepSeek R1 Distill Llama 70B هو نموذج LLM مكرر يعتمد على Llama 3.3 70B، تم تحسينه باستخدام مخرجات DeepSeek R1 لتحقيق أداء تنافسي مع النماذج الرائدة.",
"deepseek/deepseek-r1-distill-llama-8b.description": "DeepSeek R1 Distill Llama 8B هو نموذج LLM مكرر يعتمد على Llama-3.1-8B-Instruct، تم تدريبه باستخدام مخرجات DeepSeek R1.",
"deepseek/deepseek-r1-distill-qwen-14b.description": "DeepSeek R1 Distill Qwen 14B هو نموذج LLM مكرر يعتمد على Qwen 2.5 14B، تم تدريبه باستخدام مخرجات DeepSeek R1. يتفوق على OpenAI o1-mini في العديد من المعايير، ويحقق نتائج رائدة بين النماذج الكثيفة.",
"deepseek/deepseek-r1-distill-qwen-32b.description": "DeepSeek R1 Distill Qwen 32B هو نموذج LLM مكرر يعتمد على Qwen 2.5 32B، تم تدريبه باستخدام مخرجات DeepSeek R1. يتفوق على OpenAI o1-mini في العديد من المعايير، ويحقق نتائج رائدة بين النماذج الكثيفة.",
"deepseek/deepseek-r1.description": "تم تحديث DeepSeek R1 إلى DeepSeek-R1-0528. مع موارد حوسبة أكبر وتحسينات خوارزمية بعد التدريب، يعزز بشكل كبير عمق وقدرة الاستدلال. يؤدي أداءً قويًا في اختبارات الرياضيات، البرمجة، والمنطق العام، ويقترب من نماذج رائدة مثل o3 وGemini 2.5 Pro.",
"deepseek/deepseek-r1/community.description": "DeepSeek R1 هو أحدث نموذج مفتوح المصدر من فريق DeepSeek، يتميز بأداء استدلال قوي، خاصة في الرياضيات، البرمجة، ومهام التفكير، ويقارن بـ OpenAI o1.",
"deepseek/deepseek-r1:free.description": "يحسن DeepSeek-R1 الاستدلال بشكل كبير باستخدام بيانات معنونة قليلة، ويخرج سلسلة من الأفكار قبل الإجابة النهائية لتحسين الدقة.",
"deepseek/deepseek-reasoner.description": "DeepSeek-V3 Thinking (reasoner) هو نموذج استدلال تجريبي من DeepSeek، مناسب للمهام المعقدة.",
"deepseek/deepseek-v3.description": "نموذج لغوي عام سريع مع استدلال محسّن.",
"deepseek/deepseek-v3/community.description": "يُقدّم DeepSeek-V3 تقدمًا كبيرًا في سرعة الاستدلال مقارنة بالإصدارات السابقة. يحتل المرتبة الأولى بين النماذج مفتوحة المصدر ويضاهي أكثر النماذج المغلقة تقدمًا. يعتمد DeepSeek-V3 على آلية الانتباه الكامن متعدد الرؤوس (MLA) وبنية DeepSeekMoE، وكلاهما تم التحقق منه بالكامل في DeepSeek-V2. كما يُدخل استراتيجية مساعدة غير فقدية لتحقيق توازن في التحميل، وهدف تدريب على التنبؤ بعدة رموز لتعزيز الأداء.",
@@ -472,11 +485,18 @@
"doubao-1.5-lite-32k.description": "Doubao-1.5-lite هو نموذج خفيف الوزن جديد يتميز بسرعة استجابة فائقة، ويقدم جودة عالية وأداء منخفض الكمون من الدرجة الأولى.",
"doubao-1.5-pro-256k.description": "Doubao-1.5-pro-256k هو ترقية شاملة لـ Doubao-1.5-Pro، حيث يحسن الأداء العام بنسبة 10٪. يدعم نافذة سياق بحجم 256k وما يصل إلى 12k من الرموز الناتجة، مما يوفر أداءً أعلى، وسياقًا أوسع، وقيمة قوية لحالات الاستخدام المتنوعة.",
"doubao-1.5-pro-32k.description": "Doubao-1.5-pro هو نموذج رائد من الجيل الجديد يتميز بترقيات شاملة، ويتفوق في المعرفة والبرمجة والاستدلال.",
"doubao-1.5-thinking-pro-m.description": "Doubao-1.5 هو نموذج جديد للاستدلال العميق (الإصدار m يدعم الاستدلال العميق متعدد الوسائط بشكل أصلي) ويتفوق في الرياضيات والبرمجة والاستدلال العلمي والمهام العامة مثل الكتابة الإبداعية. يحقق نتائج من الدرجة الأولى أو يقترب منها في معايير مثل AIME 2024 وCodeforces وGPQA. يدعم نافذة سياق بحجم 128k وما يصل إلى 16k من الرموز الناتجة.",
"doubao-1.5-thinking-pro.description": "Doubao-1.5 هو نموذج جديد للاستدلال العميق يتفوق في الرياضيات والبرمجة والاستدلال العلمي والمهام العامة مثل الكتابة الإبداعية. يحقق نتائج من الدرجة الأولى أو يقترب منها في معايير مثل AIME 2024 وCodeforces وGPQA. يدعم نافذة سياق بحجم 128k وما يصل إلى 16k من الرموز الناتجة.",
"doubao-1.5-thinking-vision-pro.description": "نموذج جديد للاستدلال البصري العميق يتمتع بفهم واستدلال متعدد الوسائط أقوى، ويحقق نتائج رائدة في 37 من أصل 59 معيارًا عامًا.",
"doubao-1.5-ui-tars.description": "Doubao-1.5-UI-TARS هو نموذج وكيل يركز على واجهات المستخدم الرسومية (GUI) ويتفاعل بسلاسة مع الواجهات من خلال الإدراك البشري، والاستدلال، والعمل.",
"doubao-1.5-vision-lite.description": "Doubao-1.5-vision-lite هو نموذج متعدد الوسائط مطور يدعم الصور بأي دقة ونسب أبعاد متطرفة، مما يعزز الاستدلال البصري، والتعرف على المستندات، وفهم التفاصيل، واتباع التعليمات. يدعم نافذة سياق بحجم 128k وما يصل إلى 16k من الرموز الناتجة.",
"doubao-1.5-vision-pro-32k.description": "Doubao-1.5-vision-pro هو نموذج متعدد الوسائط مطور يدعم الصور بأي دقة ونسب أبعاد متطرفة، مما يعزز الاستدلال البصري، والتعرف على المستندات، وفهم التفاصيل، واتباع التعليمات.",
"doubao-1.5-vision-pro.description": "Doubao-1.5-vision-pro هو نموذج متعدد الوسائط مطور يدعم الصور بأي دقة ونسب أبعاد متطرفة، مما يعزز الاستدلال البصري، والتعرف على المستندات، وفهم التفاصيل، واتباع التعليمات.",
"doubao-lite-32k.description": "استجابة فائقة السرعة مع قيمة أفضل، توفر خيارات أكثر مرونة عبر السيناريوهات. يدعم الاستدلال والتخصيص الدقيق مع نافذة سياق بحجم 32k.",
"doubao-pro-32k.description": "أفضل نموذج رائد للأداء في المهام المعقدة، مع نتائج قوية في الأسئلة المرجعية، والتلخيص، والإبداع، وتصنيف النصوص، والمحاكاة. يدعم الاستدلال والتخصيص الدقيق مع نافذة سياق بحجم 32k.",
"doubao-seed-1.6-flash.description": "Doubao-Seed-1.6-flash هو نموذج استدلال عميق متعدد الوسائط فائق السرعة بزمن معالجة منخفض يصل إلى 10 مللي ثانية. يدعم النصوص والرؤية، ويتفوق على النموذج الخفيف السابق في فهم النصوص، ويضاهي النماذج الاحترافية المنافسة في الرؤية. يدعم نافذة سياق بحجم 256k وما يصل إلى 16k من الرموز الناتجة.",
"doubao-seed-1.6-lite.description": "Doubao-Seed-1.6-lite هو نموذج استدلال عميق متعدد الوسائط جديد مع جهد استدلال قابل للتعديل (أدنى، منخفض، متوسط، عالٍ)، يوفر قيمة أفضل وخيارًا قويًا للمهام الشائعة، مع نافذة سياق تصل إلى 256k.",
"doubao-seed-1.6-thinking.description": "يعزز Doubao-Seed-1.6-thinking قدرات الاستدلال بشكل كبير، ويحسن القدرات الأساسية في البرمجة والرياضيات والمنطق مقارنة بـ Doubao-1.5-thinking-pro، مع إضافة فهم بصري. يدعم نافذة سياق بحجم 256k وما يصل إلى 16k من الرموز الناتجة.",
"doubao-seed-1.6-vision.description": "Doubao-Seed-1.6-vision هو نموذج استدلال بصري عميق يوفر فهمًا واستدلالًا متعدد الوسائط أقوى للتعليم، ومراجعة الصور، والتفتيش/الأمن، والبحث الذكي. يدعم نافذة سياق بحجم 256k وما يصل إلى 64k من الرموز الناتجة.",
"doubao-seed-1.6.description": "Doubao-Seed-1.6 هو نموذج استدلال عميق متعدد الوسائط جديد يدعم أوضاع التفكير التلقائي، والتفكير، وعدم التفكير. في وضع عدم التفكير، يتفوق بشكل كبير على Doubao-1.5-pro/250115. يدعم نافذة سياق بحجم 256k وما يصل إلى 16k من الرموز الناتجة.",
"doubao-seed-1.8.description": "Doubao-Seed-1.8 يتمتع بفهم متعدد الوسائط أقوى وقدرات وكيل متقدمة، ويدعم إدخال النصوص/الصور/الفيديو وتخزين السياق المؤقت، ويقدم أداءً ممتازًا في المهام المعقدة.",
@@ -492,25 +512,31 @@
"doubao-seedance-1-5-pro-251215.description": "Seedance 1.5 Pro من ByteDance يدعم تحويل النص إلى فيديو، الصورة إلى فيديو (الإطار الأول، الإطار الأول + الأخير)، وتوليد الصوت المتزامن مع المرئيات.",
"doubao-seedance-2-0-260128.description": "Seedance 2.0 من ByteDance هو النموذج الأقوى لإنشاء الفيديو، يدعم إنشاء الفيديو متعدد الوسائط، وتحرير الفيديو، وتمديد الفيديو، وتحويل النص إلى فيديو، وتحويل الصور إلى فيديو مع صوت متزامن.",
"doubao-seedance-2-0-fast-260128.description": "Seedance 2.0 Fast من ByteDance يقدم نفس القدرات مثل Seedance 2.0 مع سرعات إنشاء أسرع وسعر أكثر تنافسية.",
"doubao-seededit-3-0-i2i-250628.description": "نموذج الصور Doubao من ByteDance Seed يدعم إدخال النصوص والصور مع توليد صور عالية الجودة وقابلة للتحكم بدرجة كبيرة. يدعم تحرير الصور الموجه بالنص، مع أحجام إخراج تتراوح بين 512 و1536 على الجانب الطويل.",
"doubao-seedream-3-0-t2i-250415.description": "Seedream 3.0 هو نموذج توليد صور من ByteDance Seed، يدعم إدخال النصوص والصور مع توليد صور عالية الجودة وقابلة للتحكم بدرجة كبيرة. يُولّد الصور من التعليمات النصية.",
"doubao-seedream-4-0-250828.description": "Seedream 4.0 هو نموذج توليد صور من ByteDance Seed، يدعم إدخال النصوص والصور مع توليد صور عالية الجودة وقابلة للتحكم بدرجة كبيرة. يُولّد الصور من التعليمات النصية.",
"doubao-seedream-4-5-251128.description": "Seedream 4.5 هو أحدث نموذج متعدد الوسائط من ByteDance، يدمج قدرات تحويل النص إلى صورة، والصورة إلى صورة، وتوليد الصور بالجملة، مع دمج الفهم العام وقدرات الاستدلال. مقارنة بالإصدار السابق 4.0، يقدم جودة توليد محسّنة بشكل كبير، مع تحسين تناسق التحرير ودمج الصور المتعددة. يوفر تحكمًا أكثر دقة في التفاصيل البصرية، مما يجعل النصوص الصغيرة والوجوه الصغيرة أكثر طبيعية، ويحقق تخطيطًا وألوانًا أكثر انسجامًا، مما يعزز الجماليات العامة.",
"doubao-seedream-5-0-260128.description": "Doubao-Seedream-5.0-lite هو أحدث نموذج لتوليد الصور من ByteDance. لأول مرة، يدمج قدرات الاسترجاع عبر الإنترنت، مما يسمح له بتضمين معلومات الويب في الوقت الفعلي وتعزيز حداثة الصور المولدة. كما تم ترقية ذكاء النموذج، مما يمكنه من تفسير التعليمات المعقدة والمحتوى البصري بدقة. بالإضافة إلى ذلك، يقدم تغطية محسّنة للمعرفة العالمية، وتناسقًا مرجعيًا، وجودة توليد في السيناريوهات المهنية، مما يلبي بشكل أفضل احتياجات الإبداع البصري على مستوى المؤسسات.",
"dreamina-seedance-2-0-260128.description": "Seedance 2.0 من ByteDance هو أقوى نموذج لإنشاء الفيديو، يدعم إنشاء الفيديو متعدد الوسائط، تحرير الفيديو، تمديد الفيديو، تحويل النص إلى فيديو، وتحويل الصورة إلى فيديو مع صوت متزامن.",
"dreamina-seedance-2-0-fast-260128.description": "Seedance 2.0 Fast من ByteDance يقدم نفس القدرات مثل Seedance 2.0 مع سرعات إنشاء أسرع وسعر أكثر تنافسية.",
"emohaa.description": "Emohaa هو نموذج للصحة النفسية يتمتع بقدرات استشارية احترافية لمساعدة المستخدمين على فهم المشكلات العاطفية.",
"ernie-4.5-0.3b.description": "ERNIE 4.5 0.3B هو نموذج مفتوح المصدر وخفيف الوزن، مصمم للنشر المحلي والمخصص.",
"ernie-4.5-21b-a3b-thinking.description": "ERNIE-4.5-21B-A3B-Thinking هو نموذج نصي MoE (مزيج من الخبراء) مدرب بعديًا مع إجمالي 21 مليار معلمة و3 مليارات معلمة نشطة، يقدم جودة وعمق استدلال محسّنة بشكل كبير.",
"ernie-4.5-21b-a3b.description": "ERNIE 4.5 21B A3B هو نموذج مفتوح المصدر ذو عدد كبير من المعلمات، يتميز بفهم وتوليد أقوى.",
"ernie-4.5-300b-a47b.description": "ERNIE 4.5 300B A47B هو نموذج MoE فائق الحجم من Baidu ERNIE يتمتع بقدرات استدلال ممتازة.",
"ernie-4.5-8k-preview.description": "ERNIE 4.5 8K Preview هو نموذج معاينة بسياق 8K لتقييم أداء ERNIE 4.5.",
"ernie-4.5-turbo-128k-preview.description": "معاينة ERNIE 4.5 Turbo 128K بقدرات على مستوى الإصدار، مناسبة للتكامل والاختبار التجريبي.",
"ernie-4.5-turbo-128k.description": "ERNIE 4.5 Turbo 128K هو نموذج عام عالي الأداء يدعم تعزيز البحث واستدعاء الأدوات لسيناريوهات الأسئلة والأجوبة، والبرمجة، والوكلاء.",
"ernie-4.5-turbo-20260402.description": "ERNIE 4.5 Turbo 20260402 هو نموذج عام عالي الأداء مع تعزيز البحث واستدعاء الأدوات لسيناريوهات الأسئلة والأجوبة، البرمجة، ووكلاء الذكاء الاصطناعي.",
"ernie-4.5-turbo-32k.description": "ERNIE 4.5 Turbo 32K هو إصدار متوسط الطول من السياق مخصص للأسئلة والأجوبة، واسترجاع قواعد المعرفة، والحوار متعدد الأدوار.",
"ernie-4.5-turbo-latest.description": "أحدث إصدار من ERNIE 4.5 Turbo بأداء محسن شامل، مثالي كنموذج إنتاج رئيسي.",
"ernie-4.5-turbo-vl-32k-preview.description": "معاينة ERNIE 4.5 Turbo VL 32K هو نموذج متعدد الوسائط بسياق طويل لتقييم قدرات الرؤية.",
"ernie-4.5-turbo-vl-32k.description": "ERNIE 4.5 Turbo VL 32K هو إصدار متعدد الوسائط متوسط الطول لفهم المستندات الطويلة والصور معًا.",
"ernie-4.5-turbo-vl-latest.description": "أحدث إصدار من ERNIE 4.5 Turbo VL متعدد الوسائط مع تحسينات في فهم الصور والنصوص والاستدلال.",
"ernie-4.5-turbo-vl-preview.description": "معاينة ERNIE 4.5 Turbo VL هو نموذج متعدد الوسائط لفهم وتوليد الصور والنصوص، مناسب لأسئلة وأجوبة بصرية وفهم المحتوى.",
"ernie-4.5-turbo-vl.description": "ERNIE 4.5 Turbo VL هو نموذج متعدد الوسائط ناضج لفهم الصور والنصوص في بيئات الإنتاج.",
"ernie-4.5-vl-28b-a3b.description": "ERNIE 4.5 VL 28B A3B هو نموذج مفتوح المصدر متعدد الوسائط لفهم الصور والنصوص والاستدلال.",
"ernie-5.0-thinking-latest.description": "Wenxin 5.0 Thinking هو نموذج رائد متعدد الوسائط أصلي يدعم النصوص، الصور، الصوت، والفيديو بشكل موحد. يوفر ترقيات شاملة للقدرات في الأسئلة المعقدة، الإبداع، وسيناريوهات الوكلاء.",
"ernie-5.0-thinking-preview.description": "معاينة Wenxin 5.0 Thinking هو نموذج رائد متعدد الوسائط أصلي يدعم النصوص، الصور، الصوت، والفيديو بشكل موحد. يوفر ترقيات شاملة للقدرات في الأسئلة المعقدة، الإبداع، وسيناريوهات الوكلاء.",
"ernie-5.0.description": "ERNIE 5.0، النموذج الجديد في سلسلة ERNIE، هو نموذج كبير متعدد الوسائط أصلي. يعتمد نهج نمذجة متعدد الوسائط موحد، حيث يقوم بنمذجة النصوص، الصور، الصوت، والفيديو بشكل مشترك لتقديم قدرات متعددة الوسائط شاملة. تم تحسين قدراته الأساسية بشكل كبير، محققًا أداءً قويًا في تقييمات المعايير. يتفوق بشكل خاص في الفهم متعدد الوسائط، اتباع التعليمات، الكتابة الإبداعية، الدقة الواقعية، تخطيط الوكلاء، واستخدام الأدوات.",
"ernie-char-8k.description": "ERNIE Character 8K هو نموذج حواري بشخصية مخصصة لبناء شخصيات IP والدردشة طويلة الأمد.",
"ernie-char-fiction-8k-preview.description": "معاينة ERNIE Character Fiction 8K هو نموذج لإنشاء الشخصيات والحبكات القصصية، مخصص لتقييم الميزات والاختبار.",
"ernie-char-fiction-8k.description": "ERNIE Character Fiction 8K هو نموذج شخصيات للروايات وإنشاء الحبكات، مناسب لتوليد القصص الطويلة.",
"ernie-image-turbo.description": "ERNIE-Image هو نموذج نص إلى صورة بـ 8 مليارات معلمة تم تطويره بواسطة Baidu. يحتل المرتبة الأولى في العديد من المعايير، محققًا المركز الأول في SuperCLUE في الصين ويتصدر المسار مفتوح المصدر.",
@@ -522,8 +548,7 @@
"ernie-x1-turbo-32k.description": "ERNIE X1 Turbo 32K هو نموذج تفكير سريع بسياق 32K للاستدلال المعقد والدردشة متعددة الأدوار.",
"ernie-x1.1-preview.description": "معاينة ERNIE X1.1 هو نموذج تفكير مخصص للتقييم والاختبار.",
"ernie-x1.1.description": "ERNIE X1.1 هو نموذج تفكير تجريبي للتقييم والاختبار.",
"fal-ai/bytedance/seedream/v4.5.description": "Seedream 4.5، تم تطويره بواسطة فريق ByteDance Seed، يدعم تحرير الصور المتعددة والتكوين. يتميز بتناسق الموضوع المحسن، اتباع التعليمات بدقة، فهم المنطق المكاني، التعبير الجمالي، تصميم الملصقات والشعارات مع إنشاء نصوص وصور عالية الدقة.",
"fal-ai/bytedance/seedream/v4.description": "Seedream 4.0، تم تطويره بواسطة ByteDance Seed، يدعم إدخال النصوص والصور لإنشاء صور عالية الجودة وقابلة للتحكم بناءً على التعليمات.",
"fal-ai/bytedance/seedream/v4.description": "Seedream 4.0 هو نموذج توليد الصور من ByteDance Seed، يدعم إدخال النصوص والصور مع توليد صور عالية الجودة وقابلة للتحكم بشكل كبير. يولد الصور من النصوص التوضيحية.",
"fal-ai/flux-kontext/dev.description": "نموذج FLUX.1 يركز على تحرير الصور، ويدعم إدخال النصوص والصور.",
"fal-ai/flux-pro/kontext.description": "FLUX.1 Kontext [pro] يقبل النصوص وصور مرجعية كمدخلات، مما يتيح تعديلات محلية مستهدفة وتحولات معقدة في المشهد العام.",
"fal-ai/flux/krea.description": "Flux Krea [dev] هو نموذج لتوليد الصور يتميز بميول جمالية نحو صور أكثر واقعية وطبيعية.",
@@ -531,8 +556,8 @@
"fal-ai/hunyuan-image/v3.description": "نموذج قوي لتوليد الصور متعدد الوسائط أصلي.",
"fal-ai/imagen4/preview.description": "نموذج عالي الجودة لتوليد الصور من Google.",
"fal-ai/nano-banana.description": "Nano Banana هو أحدث وأسرع وأكثر نماذج Google كفاءةً لتوليد وتحرير الصور من خلال المحادثة.",
"fal-ai/qwen-image-edit.description": "نموذج تحرير الصور الاحترافي من فريق Qwen، يدعم التعديلات الدلالية والمظهرية، تحرير النصوص الدقيقة باللغتين الصينية والإنجليزية، نقل الأنماط، التدوير، والمزيد.",
"fal-ai/qwen-image.description": "نموذج قوي لإنشاء الصور من فريق Qwen يتميز بتقديم نصوص صينية قوية وأنماط بصرية متنوعة.",
"fal-ai/qwen-image-edit.description": "نموذج تحرير الصور الاحترافي من فريق Qwen يدعم التعديلات الدلالية والمظهرية، يعدل النصوص الصينية والإنجليزية بدقة، ويمكّن التعديلات عالية الجودة مثل نقل الأسلوب ودوران الكائنات.",
"fal-ai/qwen-image.description": "نموذج توليد الصور القوي من فريق Qwen مع عرض نصوص صينية مثير للإعجاب وأنماط بصرية متنوعة.",
"flux-1-schnell.description": "نموذج تحويل النص إلى صورة يحتوي على 12 مليار معلمة من Black Forest Labs يستخدم تقنيات تقطير الانتشار العدائي الكامن لتوليد صور عالية الجودة في 1-4 خطوات. ينافس البدائل المغلقة ومتاح بموجب ترخيص Apache-2.0 للاستخدام الشخصي والبحثي والتجاري.",
"flux-dev.description": "نموذج مفتوح المصدر مخصص لتوليد الصور لأغراض البحث والابتكار غير التجاري، مع تحسينات فعالة.",
"flux-kontext-max.description": "توليد وتحرير صور سياقية متقدمة، تجمع بين النصوص والصور لتحقيق نتائج دقيقة ومتسقة.",
@@ -547,6 +572,7 @@
"gemini-1.5-flash-001.description": "Gemini 1.5 Flash 001 هو نموذج متعدد الوسائط فعال لتوسيع التطبيقات على نطاق واسع.",
"gemini-1.5-flash-002.description": "Gemini 1.5 Flash 002 هو نموذج متعدد الوسائط فعال مصمم للنشر الواسع.",
"gemini-1.5-flash-8b-exp-0924.description": "Gemini 1.5 Flash 8B 0924 هو أحدث نموذج تجريبي يحقق مكاسب ملحوظة في استخدامات النصوص والمتعددة الوسائط.",
"gemini-1.5-flash-8b-latest.description": "Gemini 1.5 Flash 8B هو نموذج متعدد الوسائط فعال مصمم للنشر الواسع.",
"gemini-1.5-flash-8b.description": "Gemini 1.5 Flash 8B هو نموذج متعدد الوسائط فعال لتوسيع التطبيقات على نطاق واسع.",
"gemini-1.5-flash-exp-0827.description": "Gemini 1.5 Flash 0827 يقدم معالجة متعددة الوسائط محسّنة للمهام المعقدة.",
"gemini-1.5-flash-latest.description": "Gemini 1.5 Flash هو أحدث نموذج ذكاء اصطناعي متعدد الوسائط من Google يتميز بمعالجة سريعة ويدعم إدخال النصوص والصور والفيديو لتوسيع المهام بكفاءة.",
@@ -562,6 +588,7 @@
"gemini-2.5-flash-image.description": "Nano Banana هو أحدث وأسرع وأكثر نماذج Google متعددة الوسائط كفاءة، يتيح توليد الصور وتحريرها عبر المحادثة.",
"gemini-2.5-flash-image:image.description": "Nano Banana هو أحدث وأسرع وأكثر نماذج Google متعددة الوسائط كفاءة، يتيح توليد الصور وتحريرها عبر المحادثة.",
"gemini-2.5-flash-lite-preview-06-17.description": "Gemini 2.5 Flash-Lite Preview هو أصغر نموذج من Google وأفضلها من حيث القيمة، مصمم للاستخدام واسع النطاق.",
"gemini-2.5-flash-lite-preview-09-2025.description": "إصدار معاينة (25 سبتمبر 2025) من Gemini 2.5 Flash-Lite",
"gemini-2.5-flash-lite.description": "Gemini 2.5 Flash-Lite هو أصغر نموذج من Google وأفضلها من حيث القيمة، مصمم للاستخدام واسع النطاق.",
"gemini-2.5-flash-preview-04-17.description": "Gemini 2.5 Flash Preview هو أفضل نموذج من Google من حيث القيمة مع قدرات كاملة.",
"gemini-2.5-flash.description": "Gemini 2.5 Flash هو أفضل نموذج من Google من حيث القيمة مع قدرات كاملة.",
@@ -571,16 +598,16 @@
"gemini-3-flash-preview.description": "Gemini 3 Flash هو أذكى نموذج تم تصميمه للسرعة، يجمع بين الذكاء المتقدم وأساس بحث ممتاز.",
"gemini-3-flash.description": "Gemini 3 Flash من Google — نموذج فائق السرعة مع دعم الإدخال متعدد الوسائط.",
"gemini-3-pro-image-preview.description": "Gemini 3 Pro Image (Nano Banana Pro) هو نموذج توليد الصور من Google ويدعم المحادثة متعددة الوسائط.",
"gemini-3-pro-image-preview:image.description": "Gemini 3 Pro Image (Nano Banana Pro) هو نموذج إنشاء الصور من Google ويدعم أيضًا الدردشة متعددة الوسائط.",
"gemini-3-pro-image-preview:image.description": "Gemini 3 Pro Image (Nano Banana Pro) هو نموذج توليد الصور من Google ويدعم أيضًا الدردشة متعددة الوسائط.",
"gemini-3-pro-preview.description": "Gemini 3 Pro هو أقوى نموذج من Google للوكيل الذكي والبرمجة الإبداعية، يقدم تفاعلاً أعمق وصورًا أغنى مع استدلال متقدم.",
"gemini-3.1-flash-image-preview.description": "Gemini 3.1 Flash Image (Nano Banana 2) يقدم جودة صور احترافية بسرعة فائقة مع دعم الدردشة متعددة الوسائط.",
"gemini-3.1-flash-image-preview:image.description": "Gemini 3.1 Flash Image (Nano Banana 2) يقدم جودة صور بمستوى احترافي بسرعة Flash مع دعم الدردشة متعددة الوسائط.",
"gemini-3.1-flash-image-preview:image.description": "Gemini 3.1 Flash Image (Nano Banana 2) هو أسرع نموذج توليد الصور الأصلي من Google مع دعم التفكير، توليد الصور التفاعلية وتحريرها.",
"gemini-3.1-flash-lite-preview.description": "Gemini 3.1 Flash-Lite Preview هو النموذج الأكثر كفاءة من حيث التكلفة من Google، مُحسّن للمهام الوكيلة ذات الحجم الكبير، الترجمة، ومعالجة البيانات.",
"gemini-3.1-pro-preview.description": "Gemini 3.1 Pro Preview يحسن من Gemini 3 Pro مع قدرات استدلال محسّنة ويضيف دعم مستوى التفكير المتوسط.",
"gemini-3.1-pro.description": "Gemini 3.1 Pro من Google — نموذج متعدد الوسائط متميز مع نافذة سياق 1M.",
"gemini-flash-latest.description": "يشير إلى gemini-3-flash-preview",
"gemini-flash-lite-latest.description": "يشير إلى gemini-2.5-flash-lite-preview-09-2025",
"gemini-pro-latest.description": "يشير إلى gemini-3.1-pro-preview",
"gemini-flash-latest.description": "أحدث إصدار من Gemini Flash",
"gemini-flash-lite-latest.description": "أحدث إصدار من Gemini Flash-Lite",
"gemini-pro-latest.description": "أحدث إصدار من Gemini Pro",
"gemma-7b-it.description": "Gemma 7B فعال من حيث التكلفة للمهام الصغيرة والمتوسطة.",
"gemma2-9b-it.description": "Gemma 2 9B مُحسّن للمهام المحددة وتكامل الأدوات.",
"gemma2.description": "Gemma 2 هو نموذج فعال من Google يغطي حالات الاستخدام من التطبيقات الصغيرة إلى معالجة البيانات المعقدة.",
@@ -641,6 +668,8 @@
"google/gemini-2.0-flash.description": "Gemini 2.0 Flash هو نموذج استدلال عالي الأداء من Google للمهام متعددة الوسائط الممتدة.",
"google/gemini-2.5-flash-image.description": "Gemini 2.5 Flash Image (Nano Banana) هو نموذج توليد الصور من Google مع دعم المحادثة متعددة الوسائط.",
"google/gemini-2.5-flash-lite.description": "Gemini 2.5 Flash Lite هو إصدار خفيف من Gemini 2.5 محسّن لزمن الاستجابة والتكلفة، مناسب لسيناريوهات الإنتاجية العالية.",
"google/gemini-2.5-flash-preview.description": "Gemini 2.5 Flash هو النموذج الرائد الأكثر تقدمًا من Google، مصمم لمهام الاستدلال المتقدم، البرمجة، الرياضيات، والعلوم. يتضمن ميزة \"التفكير\" المدمجة لتقديم استجابات أكثر دقة ومعالجة سياق أدق.\n\nملاحظة: يحتوي هذا النموذج على نسختين — مع التفكير وبدونه. تختلف أسعار الإخراج بشكل كبير حسب ما إذا كان التفكير مفعلاً. إذا اخترت النسخة القياسية (بدون اللاحقة \":thinking\")، سيتجنب النموذج توليد رموز التفكير.\n\nلاستخدام التفكير واستلام رموز التفكير، يجب اختيار النسخة \":thinking\"، والتي تتطلب تكلفة أعلى.\n\nيمكن أيضًا ضبط Gemini 2.5 Flash عبر معلمة \"الحد الأقصى لرموز الاستدلال\" كما هو موضح في الوثائق (https://openrouter.ai/docs/use-cases/reasoning-tokens#max-tokens-for-reasoning).",
"google/gemini-2.5-flash-preview:thinking.description": "Gemini 2.5 Flash هو النموذج الرائد الأكثر تقدمًا من Google، مصمم لمهام الاستدلال المتقدم، البرمجة، الرياضيات، والعلوم. يتضمن ميزة \"التفكير\" المدمجة لتقديم استجابات أكثر دقة ومعالجة سياق أدق.\n\nملاحظة: يحتوي هذا النموذج على نسختين — مع التفكير وبدونه. تختلف أسعار الإخراج بشكل كبير حسب ما إذا كان التفكير مفعلاً. إذا اخترت النسخة القياسية (بدون اللاحقة \":thinking\"), سيتجنب النموذج توليد رموز التفكير.\n\nلاستخدام التفكير واستلام رموز التفكير، يجب اختيار النسخة \":thinking\"، والتي تتطلب تكلفة أعلى.\n\nيمكن أيضًا ضبط Gemini 2.5 Flash عبر معلمة \"الحد الأقصى لرموز الاستدلال\" كما هو موضح في الوثائق (https://openrouter.ai/docs/use-cases/reasoning-tokens#max-tokens-for-reasoning).",
"google/gemini-2.5-flash.description": "Gemini 2.5 Flash هو عائلة Google التي تمتد من زمن استجابة منخفض إلى أداء عالٍ في التفكير.",
"google/gemini-2.5-pro-preview.description": "Gemini 2.5 Pro Preview هو النموذج الأكثر تقدمًا من Google للاستدلال في المشكلات المعقدة في البرمجة، الرياضيات، والعلوم، وتحليل مجموعات البيانات الكبيرة، قواعد الشيفرة، والمستندات ذات السياق الطويل.",
"google/gemini-2.5-pro.description": "Gemini 2.5 Pro هو النموذج الرائد من Google للاستدلال مع دعم السياق الطويل للمهام المعقدة.",
@@ -648,10 +677,13 @@
"google/gemini-3-pro-preview.description": "Gemini 3 Pro هو نموذج الاستدلال متعدد الوسائط من الجيل التالي في عائلة Gemini، يفهم النصوص، الصوت، الصور، والفيديو، ويتعامل مع المهام المعقدة وقواعد الشيفرة الكبيرة.",
"google/gemini-3.1-flash-image-preview.description": "Gemini 3.1 Flash Image Preview، المعروف أيضًا باسم \"Nano Banana 2\"، هو أحدث نموذج من Google لإنشاء الصور وتحريرها، يقدم جودة بصرية بمستوى احترافي بسرعة Flash. يجمع بين فهم السياق المتقدم والاستدلال السريع والفعال من حيث التكلفة، مما يجعل إنشاء الصور المعقدة والتعديلات التكرارية أكثر سهولة بشكل كبير.",
"google/gemini-embedding-001.description": "نموذج تضمين متقدم يتميز بأداء قوي في مهام اللغة الإنجليزية، ومتعددة اللغات، والبرمجة.",
"google/gemini-flash-1.5.description": "يوفر Gemini 1.5 Flash معالجة متعددة الوسائط محسّنة لمجموعة من المهام المعقدة.",
"google/gemini-pro-1.5.description": "يجمع Gemini 1.5 Pro بين أحدث التحسينات لمعالجة أكثر كفاءة للبيانات متعددة الوسائط.",
"google/gemma-2-27b-it.description": "Gemma 2 27B هو نموذج لغوي عام الأداء يتميز بقوة في العديد من السيناريوهات.",
"google/gemma-2-27b.description": "Gemma 2 هي عائلة نماذج فعالة من Google تناسب التطبيقات الصغيرة ومعالجة البيانات المعقدة.",
"google/gemma-2-2b-it.description": "نموذج لغوي صغير متقدم مصمم لتطبيقات الحافة.",
"google/gemma-2-9b-it.description": "Gemma 2 9B، من تطوير Google، يقدم اتباع تعليمات فعال وقدرات عامة قوية.",
"google/gemma-2-9b-it:free.description": "Gemma 2 هي عائلة نماذج نصية مفتوحة المصدر وخفيفة الوزن من Google.",
"google/gemma-2-9b.description": "Gemma 2 هي عائلة نماذج فعالة من Google تناسب التطبيقات الصغيرة ومعالجة البيانات المعقدة.",
"google/gemma-2b-it.description": "Gemma Instruct (2B) يوفر معالجة أساسية للتعليمات للتطبيقات الخفيفة.",
"google/gemma-3-12b-it.description": "Gemma 3 12B هو نموذج لغوي مفتوح المصدر من Google يحدد معيارًا جديدًا للكفاءة والأداء.",
@@ -664,13 +696,13 @@
"gpt-3.5-turbo.description": "GPT 3.5 Turbo لتوليد النصوص وفهمها؛ يشير حاليًا إلى gpt-3.5-turbo-0125.",
"gpt-35-turbo-16k.description": "GPT-3.5 Turbo 16k هو نموذج توليد نصوص عالي السعة للمهام المعقدة.",
"gpt-35-turbo.description": "GPT-3.5 Turbo هو النموذج الفعال من OpenAI للدردشة وتوليد النصوص، ويدعم استدعاء الوظائف المتوازية.",
"gpt-4-0125-preview.description": "أحدث نموذج GPT-4 Turbo يتضمن الرؤية. يمكن استخدام طلبات الرؤية في وضع JSON واستدعاء الوظائف. GPT-4 Turbo هو إصدار محسن يوازن بين الدقة والكفاءة للمهام متعددة الوسائط والتفاعلات في الوقت الفعلي.",
"gpt-4-0125-preview.description": "أحدث إصدار من GPT-4 Turbo يدعم الرؤية. الطلبات البصرية تدعم وضع JSON واستدعاء الوظائف. إنه نموذج متعدد الوسائط فعال من حيث التكلفة يوازن بين الدقة والكفاءة للتطبيقات في الوقت الحقيقي.",
"gpt-4-0613.description": "يوفر GPT-4 نافذة سياق أكبر للتعامل مع مدخلات أطول، مما يجعله مناسبًا لتجميع المعلومات الواسعة وتحليل البيانات.",
"gpt-4-1106-preview.description": "أحدث نموذج GPT-4 Turbo يتضمن الرؤية. يمكن استخدام طلبات الرؤية في وضع JSON واستدعاء الوظائف. GPT-4 Turbo هو إصدار محسن يوازن بين الدقة والكفاءة للمهام متعددة الوسائط والتفاعلات في الوقت الفعلي.",
"gpt-4-1106-preview.description": "أحدث إصدار من GPT-4 Turbo يدعم الرؤية. الطلبات البصرية تدعم وضع JSON واستدعاء الوظائف. إنه نموذج متعدد الوسائط فعال من حيث التكلفة يوازن بين الدقة والكفاءة للتطبيقات في الوقت الحقيقي.",
"gpt-4-32k-0613.description": "يوفر GPT-4 نافذة سياق أكبر للتعامل مع مدخلات أطول في السيناريوهات التي تتطلب دمج معلومات واسع وتحليل بيانات.",
"gpt-4-32k.description": "يوفر GPT-4 نافذة سياق أكبر للتعامل مع مدخلات أطول في السيناريوهات التي تتطلب دمج معلومات واسع وتحليل بيانات.",
"gpt-4-turbo-2024-04-09.description": "أحدث إصدار من GPT-4 Turbo يدعم الرؤية. الطلبات البصرية تدعم وضع JSON واستدعاء الوظائف. إنه نموذج متعدد الوسائط فعال من حيث التكلفة يوازن بين الدقة والكفاءة للتطبيقات في الوقت الحقيقي.",
"gpt-4-turbo-preview.description": "أحدث نموذج GPT-4 Turbo يتضمن الرؤية. يمكن استخدام طلبات الرؤية في وضع JSON واستدعاء الوظائف. GPT-4 Turbo هو إصدار محسن يوازن بين الدقة والكفاءة للمهام متعددة الوسائط والتفاعلات في الوقت الفعلي.",
"gpt-4-turbo-preview.description": "أحدث إصدار من GPT-4 Turbo يدعم الرؤية. الطلبات البصرية تدعم وضع JSON واستدعاء الوظائف. إنه نموذج متعدد الوسائط فعال من حيث التكلفة يوازن بين الدقة والكفاءة للتطبيقات في الوقت الحقيقي.",
"gpt-4-turbo.description": "أحدث إصدار من GPT-4 Turbo يدعم الرؤية. الطلبات البصرية تدعم وضع JSON واستدعاء الوظائف. إنه نموذج متعدد الوسائط فعال من حيث التكلفة يوازن بين الدقة والكفاءة للتطبيقات في الوقت الحقيقي.",
"gpt-4-vision-preview.description": "معاينة GPT-4 Vision، مصمم لمهام تحليل ومعالجة الصور.",
"gpt-4.1-mini.description": "GPT-4.1 mini يوازن بين الذكاء والسرعة والتكلفة، مما يجعله جذابًا للعديد من الاستخدامات.",
@@ -717,7 +749,7 @@
"gpt-5.4-pro.description": "GPT-5.4 Pro من OpenAI — النموذج الأكثر قدرة مع أقصى سياق وتفكير.",
"gpt-5.4.description": "GPT-5.4 من OpenAI — نموذج الجيل التالي مع نافذة سياق 1M+ وإدخال متعدد الوسائط.",
"gpt-5.5-pro.description": "GPT-5.5 Pro يستخدم المزيد من الحوسبة للتفكير بشكل أعمق وتقديم إجابات أفضل باستمرار.",
"gpt-5.5.description": "GPT-5.5 هو نموذجنا الأحدث للمهام المهنية الأكثر تعقيدًا.",
"gpt-5.5.description": "GPT-5.5 هو النموذج الرائد للعمل المهني الأكثر تعقيدًا، البرمجة، والمهام الوكيلية.",
"gpt-5.description": "GPT-5 من OpenAI — النموذج الرئيسي مع التفكير المتقدم والإدخال متعدد الوسائط.",
"gpt-audio.description": "GPT Audio هو نموذج دردشة عام يدعم الإدخال والإخراج الصوتي، مدعوم في واجهة Chat Completions API.",
"gpt-image-1-mini.description": "إصدار منخفض التكلفة من GPT Image 1 يدعم إدخال نصوص وصور وإخراج صور.",
@@ -740,11 +772,8 @@
"grok-4-fast-reasoning.description": "يسعدنا إطلاق Grok 4 Fast، أحدث تقدم في نماذج الاستدلال منخفضة التكلفة.",
"grok-4.20-0309-non-reasoning.description": "نموذج غير تفكير للاستخدامات البسيطة.",
"grok-4.20-0309-reasoning.description": "نموذج ذكي وسريع للغاية يفكر قبل الرد.",
"grok-4.20-beta-0309-non-reasoning.description": "نسخة غير تفكيرية للاستخدامات البسيطة.",
"grok-4.20-beta-0309-reasoning.description": "نموذج ذكي وسريع للغاية يفكر قبل الرد.",
"grok-4.20-multi-agent-0309.description": "فريق من 4 أو 16 وكيلًا، يتفوق في حالات الاستخدام البحثية، لا يدعم حاليًا الأدوات على جانب العميل. يدعم فقط أدوات xAI على جانب الخادم (مثل X Search، أدوات البحث على الويب) وأدوات MCP البعيدة.",
"grok-4.3.description": كثر نموذج لغة كبير يسعى للحقيقة في العالم.",
"grok-4.description": "أحدث وأقوى نموذج رئيسي لدينا، يتميز في معالجة اللغة الطبيعية، الرياضيات، والتفكير—مثالي لجميع الاستخدامات.",
"grok-4.description": حدث نموذج رئيسي من Grok مع أداء لا مثيل له في اللغة، الرياضيات، والتفكير — نموذج شامل حقيقي. يشير حاليًا إلى grok-4-0709؛ بسبب الموارد المحدودة، هو مؤقتًا أعلى بنسبة 10% من التسعير الرسمي ومن المتوقع أن يعود إلى السعر الرسمي لاحقًا.",
"grok-code-fast-1.description": "يسعدنا إطلاق grok-code-fast-1، نموذج استدلال سريع وفعال من حيث التكلفة يتفوق في البرمجة التلقائية.",
"grok-imagine-image-pro.description": "إنشاء صور من مطالبات نصية، تحرير الصور الموجودة باستخدام اللغة الطبيعية، أو تحسين الصور بشكل تكراري من خلال محادثات متعددة الأدوار.",
"grok-imagine-image.description": "إنشاء صور من مطالبات نصية، تحرير الصور الموجودة باستخدام اللغة الطبيعية، أو تحسين الصور بشكل تكراري من خلال محادثات متعددة الأدوار.",
@@ -791,6 +820,7 @@
"intern-s1-mini.description": "نموذج كبير متعدد الوسائط خفيف الوزن يتميز بقدرات استدلال علمية قوية.",
"intern-s1-pro.description": "لقد أطلقنا نموذج الاستدلال متعدد الوسائط الأكثر تقدمًا مفتوح المصدر، حاليًا النموذج الكبير متعدد الوسائط مفتوح المصدر الأفضل أداءً من حيث الأداء العام.",
"intern-s1.description": "نموذج الاستدلال متعدد الوسائط مفتوح المصدر لا يظهر فقط قدرات عامة قوية ولكنه يحقق أداءً متقدمًا عبر مجموعة واسعة من المهام العلمية.",
"internlm/internlm2_5-7b-chat.description": "InternLM2.5-7B-Chat هو نموذج محادثة مفتوح المصدر مبني على بنية InternLM2. يركز نموذج 7B على توليد الحوارات ويدعم اللغتين الصينية والإنجليزية، ويستخدم تدريبًا حديثًا لتقديم محادثات ذكية وسلسة. مناسب لسيناريوهات متعددة مثل دعم العملاء والمساعدين الشخصيين.",
"internvl2.5-38b-mpo.description": "InternVL2.5 38B MPO هو نموذج مدرب مسبقًا متعدد الوسائط للاستدلال المعقد بين الصور والنصوص.",
"internvl3-14b.description": "InternVL3 14B هو نموذج متعدد الوسائط متوسط الحجم يوازن بين الأداء والتكلفة.",
"internvl3-1b.description": "InternVL3 1B هو نموذج متعدد الوسائط خفيف الوزن مناسب للنشر في بيئات محدودة الموارد.",
@@ -805,10 +835,11 @@
"kimi-k2-0905-preview.description": "kimi-k2-0905-preview يوفر نافذة سياق 256k، برمجة وكيلة أقوى، جودة أفضل لرموز الواجهة الأمامية، وفهم سياقي محسن.",
"kimi-k2-instruct.description": "Kimi K2 Instruct هو النموذج الرسمي للاستدلال من Kimi مع سياق طويل للبرمجة، الأسئلة والأجوبة، والمزيد.",
"kimi-k2-thinking-turbo.description": "إصدار K2 عالي السرعة للتفكير الطويل مع نافذة سياق 256k، استدلال عميق قوي، وإخراج 60–100 رمز/ثانية.",
"kimi-k2-thinking.description": "kimi-k2-thinking هو نموذج تفكير من Moonshot AI يتمتع بقدرات عامة على التفكير والوكالة. يتفوق في التفكير العميق ويمكنه حل المشكلات الصعبة باستخدام أدوات متعددة الخطوات.",
"kimi-k2-thinking.description": "Kimi-K2 هو نموذج أساسي ببنية MoE أطلقته Moonshot AI بقدرات فائقة في البرمجة والوكلاء. يحتوي على إجمالي 1T من المعلمات و32B من المعلمات النشطة. في اختبارات الأداء المعيارية في الفئات الرئيسية مثل التفكير العام، والبرمجة، والرياضيات، والوكلاء، يتفوق أداء نموذج K2 على النماذج المفتوحة المصدر الرئيسية الأخرى.",
"kimi-k2-turbo-preview.description": "kimi-k2 هو نموذج MoE أساسي يتمتع بقدرات قوية في البرمجة والوكالة (1 تريليون معلمة إجمالية، 32 مليار نشطة)، ويتفوق على النماذج المفتوحة السائدة في اختبارات الاستدلال، البرمجة، الرياضيات، والوكالة.",
"kimi-k2.5.description": "Kimi K2.5 هو النموذج الأكثر تنوعًا من Kimi حتى الآن، يتميز ببنية متعددة الوسائط تدعم المدخلات البصرية والنصية، أوضاع \"التفكير\" و\"غير التفكير\"، ومهام المحادثة والوكلاء.",
"kimi-k2.6.description": "Kimi-K2.6 هو نموذج لغة كبير تم إطلاقه بواسطة Moonshot AI، يتميز بقدرات ممتازة في البرمجة واستدعاء الأدوات. يتم دعم نشر الخدمة فقط في الصين القارية.",
"kimi-k2.6.description": "Kimi K2.6 هو أحدث نموذج وأكثرها قدرة من Kimi، يقدم برمجة طويلة الأفق أقوى، اتباع التعليمات، والتصحيح الذاتي مع دعم النصوص، الصور، والفيديو بالإضافة إلى المهام الوكيلة والدردشة.",
"kimi-k2.description": "Kimi-K2 هو نموذج MoE أساسي من Moonshot AI يتمتع بقدرات قوية في البرمجة والوكالة، بإجمالي 1 تريليون معلمة و32 مليار نشطة. يتفوق على النماذج المفتوحة السائدة في اختبارات الاستدلال العام، البرمجة، الرياضيات، ومهام الوكالة.",
"kimi-k2:1t.description": "Kimi K2 هو نموذج LLM كبير من نوع MoE من Moonshot AI بإجمالي 1 تريليون معلمة و32 مليار نشطة لكل تمرير أمامي. مُحسّن لقدرات الوكالة بما في ذلك استخدام الأدوات المتقدمة، الاستدلال، وتوليد الشيفرة.",
"kling/kling-v3-image-generation.description": "يدعم ما يصل إلى 10 صور مرجعية، مما يتيح لك تثبيت الموضوعات والعناصر ونغمات الألوان لضمان نمط متسق. يجمع بين نقل النمط، الإشارة إلى الصور الشخصية/الشخصيات، دمج الصور المتعددة، والتلوين المحلي للتحكم المرن. يقدم تفاصيل واقعية للصور الشخصية، مع مرئيات عامة دقيقة وغنية بالطبقات، تتميز بألوان وأجواء سينمائية.",
"kling/kling-v3-omni-image-generation.description": "افتح مرئيات سرد القصص السينمائية مع توليد الصور الجديدة وإخراج مباشر بدقة 2K/4K. يحلل بعمق العناصر السمعية والبصرية في التعليمات لتنفيذ الإبداع بدقة. يدعم إدخالات مرجعية متعددة مرنة وترقيات جودة شاملة، مثالي للقصص المصورة، فن المفاهيم السردية، وتصميم المشاهد.",
@@ -873,6 +904,7 @@
"meta-llama/llama-3-8b-instruct.description": "Llama 3 8B Instruct مُحسّن للحوار عالي الجودة، ويتفوق على العديد من النماذج المغلقة.",
"meta-llama/llama-3.1-70b-instruct.description": "أحدث سلسلة Llama 3.1 من Meta، النسخة المُعدّة للتعليمات بسعة 70 مليار معامل، مُحسّنة للحوار عالي الجودة. تُظهر أداءً قوياً في التقييمات الصناعية مقارنة بالنماذج المغلقة الرائدة. (متاحة فقط للجهات المعتمدة تجارياً.)",
"meta-llama/llama-3.1-8b-instruct.description": "أحدث سلسلة Llama 3.1 من Meta، النسخة المُعدّة للتعليمات بسعة 8 مليارات معامل، سريعة وفعالة بشكل خاص. تُظهر أداءً قوياً في التقييمات الصناعية، متفوقة على العديد من النماذج المغلقة الرائدة. (متاحة فقط للجهات المعتمدة تجارياً.)",
"meta-llama/llama-3.1-8b-instruct:free.description": "LLaMA 3.1 يدعم لغات متعددة ويُعد من النماذج الرائدة في التوليد.",
"meta-llama/llama-3.2-11b-vision-instruct.description": "تم تصميم LLaMA 3.2 لمهام تجمع بين الرؤية والنص. يتفوق في توصيف الصور والأسئلة البصرية، ويجسر بين توليد اللغة والاستدلال البصري.",
"meta-llama/llama-3.2-3b-instruct.description": "meta-llama/llama-3.2-3b-instruct",
"meta-llama/llama-3.3-70b-instruct.description": "Llama 3.3 هو النموذج مفتوح المصدر الأكثر تقدماً من Llama متعدد اللغات، يقدم أداءً قريباً من 405B بتكلفة منخفضة جداً. يعتمد على Transformer وتم تحسينه باستخدام SFT وRLHF لتحقيق الفائدة والسلامة. النسخة المُعدّة للتعليمات مُحسّنة للدردشة متعددة اللغات وتتفوّق على العديد من النماذج المفتوحة والمغلقة في معايير الصناعة. تاريخ قطع المعرفة: ديسمبر 2023.",
@@ -890,6 +922,7 @@
"meta/Meta-Llama-3.1-405B-Instruct.description": "نموذج لاما 3.1 المضبوط على التعليمات، مُحسّن للدردشة متعددة اللغات، ويؤدي أداءً قويًا في معايير الصناعة بين النماذج المفتوحة والمغلقة.",
"meta/Meta-Llama-3.1-70B-Instruct.description": "نموذج لاما 3.1 المضبوط على التعليمات، مُحسّن للدردشة متعددة اللغات، ويؤدي أداءً قويًا في معايير الصناعة بين النماذج المفتوحة والمغلقة.",
"meta/Meta-Llama-3.1-8B-Instruct.description": "نموذج لاما 3.1 المضبوط على التعليمات، مُحسّن للدردشة متعددة اللغات، ويؤدي أداءً قويًا في معايير الصناعة بين النماذج المفتوحة والمغلقة.",
"meta/llama-3.1-405b-instruct.description": "نموذج لغوي متقدم يدعم توليد البيانات الاصطناعية، وتقطير المعرفة، والاستدلال لمهام الدردشة والبرمجة والمجالات المتخصصة.",
"meta/llama-3.1-70b-instruct.description": "مصمم للحوار المعقد مع فهم ممتاز للسياق، واستدلال، وتوليد نصوص.",
"meta/llama-3.1-70b.description": "نسخة محدثة من لاما 3 70B Instruct من ميتا، تدعم سياقًا يصل إلى 128 ألف رمز، وتدعم لغات متعددة، مع تحسينات في الاستدلال.",
"meta/llama-3.1-8b-instruct.description": "نموذج متطور يتمتع بفهم لغوي قوي، واستدلال، وتوليد نصوص.",
@@ -929,6 +962,7 @@
"minimax-m2.description": "MiniMax M2 هو نموذج لغوي كبير وفعّال صُمم خصيصًا للبرمجة وسير عمل الوكلاء.",
"minimax/minimax-m2.1.description": "MiniMax-M2.1 هو نموذج لغوي كبير وخفيف الوزن ومتطور، مُحسّن للبرمجة وسير عمل الوكلاء وتطوير التطبيقات الحديثة، ويقدم مخرجات أنظف وأكثر إيجازًا واستجابة أسرع.",
"minimax/minimax-m2.description": "MiniMax-M2 هو نموذج عالي القيمة يتميز في مهام البرمجة والوكلاء في العديد من سيناريوهات الهندسة.",
"minimaxai/minimax-m2.5.description": "MiniMax-M2.5 هو أحدث نموذج لغة كبير من MiniMax، يتميز ببنية Mixture-of-Experts (MoE) مع إجمالي 229 مليار معلمة. يحقق أداءً رائدًا في الصناعة في البرمجة، استدعاء أدوات الوكيل، مهام البحث، وسيناريوهات المكتب.",
"ministral-3:14b.description": "Ministral 3 14B هو أكبر نموذج في سلسلة Ministral 3، يقدم أداءً متقدمًا مماثلًا لنظيره الأكبر Mistral Small 3.2 24B. مُحسن للنشر المحلي، يقدم أداءً عاليًا على مختلف الأجهزة بما في ذلك الإعدادات المحلية.",
"ministral-3:3b.description": "Ministral 3 3B هو أصغر وأكفأ نموذج في سلسلة Ministral 3، يقدم قدرات قوية في اللغة والرؤية في حزمة مدمجة. مصمم للنشر على الحافة، يقدم أداءً عاليًا على مختلف الأجهزة بما في ذلك الإعدادات المحلية.",
"ministral-3:8b.description": "Ministral 3 8B هو نموذج قوي وفعال في سلسلة Ministral 3، يقدم قدرات نصية ورؤية من الدرجة الأولى. مُصمم للنشر على الحافة، يقدم أداءً عاليًا على مختلف الأجهزة بما في ذلك الإعدادات المحلية.",
@@ -944,7 +978,6 @@
"mistral-large-latest.description": "Mistral Large هو النموذج الرئيسي، يتفوق في المهام متعددة اللغات، التفكير المعقد، وتوليد الكود للتطبيقات المتقدمة.",
"mistral-large.description": "Mixtral Large هو النموذج الرئيسي من Mistral، يجمع بين توليد الكود، والرياضيات، والاستدلال مع نافذة سياق 128K.",
"mistral-medium-2508.description": "Mistral Medium 3.1 يقدم أداءً متقدمًا بتكلفة أقل بـ 8 مرات ويُبسط نشر المؤسسات.",
"mistral-medium-3.5.description": "Mistral Medium 3.5 هو نموذج متعدد الوسائط من الدرجة الأولى تم تحسينه لحالات الاستخدام الوكالية والبرمجية، تم إصداره كأوزان مفتوحة بموجب ترخيص MIT المعدل.",
"mistral-nemo-instruct.description": "Mistral-Nemo-Instruct-2407 هو الإصدار الموجه بالتعليمات من Mistral-Nemo-Base-2407.",
"mistral-nemo.description": "Mistral Nemo هو نموذج فعال يحتوي على 12 مليار معامل من Mistral AI وNVIDIA.",
"mistral-small-2506.description": "Mistral Small هو خيار اقتصادي وسريع وموثوق للترجمة، التلخيص، وتحليل المشاعر.",
@@ -987,6 +1020,7 @@
"moonshotai/Kimi-K2-Thinking.description": "Kimi K2 Thinking هو أحدث وأقوى نموذج تفكير مفتوح المصدر. يوسع بشكل كبير عمق التفكير متعدد الخطوات ويحافظ على استخدام الأدوات المستقر عبر 200-300 استدعاء متتالي، محققًا أرقامًا قياسية جديدة في Humanity's Last Exam (HLE)، BrowseComp، ومعايير أخرى. يتفوق في البرمجة، الرياضيات، المنطق، وسيناريوهات الوكيل. يعتمد على بنية MoE مع ~1 تريليون معلمة إجمالية، ويدعم نافذة سياق 256K واستدعاء الأدوات.",
"moonshotai/kimi-k2-0711.description": "Kimi K2 0711 هو إصدار موجه من سلسلة Kimi، مناسب للبرمجة عالية الجودة واستخدام الأدوات.",
"moonshotai/kimi-k2-0905.description": "Kimi K2 0905 هو تحديث يعزز أداء السياق والتفكير مع تحسينات في البرمجة.",
"moonshotai/kimi-k2-instruct-0905.description": "نموذج kimi-k2-0905-preview يدعم نافذة سياق بحجم 256K، مع برمجة وكيلة أقوى، وشيفرة أمامية أكثر صقلًا وعملية، وفهم أفضل للسياق.",
"moonshotai/kimi-k2-thinking-turbo.description": "Kimi K2 Thinking Turbo هو إصدار عالي السرعة من Kimi K2 Thinking، يقلل بشكل كبير من زمن الاستجابة مع الحفاظ على عمق التفكير.",
"moonshotai/kimi-k2-thinking.description": "Kimi K2 Thinking هو نموذج التفكير من Moonshot، مُحسّن لمهام التفكير العميق، مع قدرات عامة كوكلاء.",
"moonshotai/kimi-k2.5.description": "Kimi K2.5 هو النموذج الأكثر ذكاءً من Kimi حتى الآن، يتميز بهندسة متعددة الوسائط أصلية.",
@@ -1045,7 +1079,7 @@
"openai/gpt-5.description": "GPT-5 هو نموذج عالي الأداء من OpenAI لمجموعة واسعة من المهام الإنتاجية والبحثية.",
"openai/gpt-oss-120b.description": "نموذج لغة كبير عام القدرات يتمتع بتفكير قوي وقابل للتحكم.",
"openai/gpt-oss-20b.description": "نموذج لغة صغير الحجم بوزن مفتوح، محسّن لزمن استجابة منخفض وبيئات محدودة الموارد، بما في ذلك النشر المحلي وعلى الأطراف.",
"openai/o1-mini.description": "o1-mini هو نموذج تفكير سريع وفعال من حيث التكلفة مصمم لحالات استخدام البرمجة، الرياضيات، والعلوم. لديه سياق 128K وقطع معرفة في أكتوبر 2023.",
"openai/o1-mini.description": "o1-mini هو نموذج تفكير سريع وفعال من حيث التكلفة مصمم للبرمجة والرياضيات والعلوم. يدعم سياق 128K وتاريخ معرفة حتى أكتوبر 2023.",
"openai/o1-preview.description": "o1 هو نموذج التفكير الجديد من OpenAI للمهام المعقدة التي تتطلب معرفة واسعة. يدعم سياق 128K وتاريخ معرفة حتى أكتوبر 2023.",
"openai/o1.description": "OpenAI o1 هو نموذج تفكير رائد مصمم لحل المشكلات المعقدة التي تتطلب تفكيرًا عميقًا، ويقدم تفكيرًا قويًا ودقة أعلى في المهام متعددة الخطوات.",
"openai/o3-mini-high.description": "o3-mini (تفكير عالي) يقدم ذكاءً أعلى بنفس تكلفة وزمن استجابة o1-mini.",
@@ -1089,6 +1123,7 @@
"qianfan-check-vl.description": "Qianfan Check VL هو نموذج مراجعة محتوى متعدد الوسائط لمهام التوافق والتعرف على الصور والنصوص.",
"qianfan-composition.description": "Qianfan Composition هو نموذج إنشاء متعدد الوسائط لفهم وتوليد الصور والنصوص المختلطة.",
"qianfan-engcard-vl.description": "Qianfan EngCard VL هو نموذج تعرف متعدد الوسائط يركز على السيناريوهات الإنجليزية.",
"qianfan-llama-vl-8b.description": "Qianfan Llama VL 8B هو نموذج متعدد الوسائط مبني على Llama لفهم عام للصور والنصوص.",
"qianfan-multipicocr.description": "Qianfan MultiPicOCR هو نموذج OCR متعدد الصور لاكتشاف النصوص والتعرف عليها عبر الصور.",
"qianfan-qi-vl.description": "Qianfan QI VL هو نموذج سؤال وجواب متعدد الوسائط للاسترجاع الدقيق والإجابة في سيناريوهات الصور والنصوص المعقدة.",
"qianfan-singlepicocr.description": "Qianfan SinglePicOCR هو نموذج OCR لصورة واحدة بدقة عالية في التعرف على الأحرف.",
@@ -1127,6 +1162,7 @@
"qwen-vl-plus.description": "نموذج Qwen المحسن للغة والرؤية على نطاق واسع مع تحسينات كبيرة في التفاصيل والتعرف على النصوص، يدعم دقة تتجاوز الميجابيكسل ونسب أبعاد عشوائية.",
"qwen-vl-v1.description": "نموذج مدرب مسبقًا مستند إلى Qwen-7B مع وحدة رؤية مضافة ودقة إدخال صور 448.",
"qwen/qwen-2-7b-instruct.description": "Qwen2 هي سلسلة نماذج اللغة الكبيرة الجديدة من Qwen. Qwen2 7B هو نموذج قائم على المحولات يتميز بفهم لغوي قوي، وقدرات متعددة اللغات، والبرمجة، والرياضيات، والاستدلال.",
"qwen/qwen-2-7b-instruct:free.description": "Qwen2 هي عائلة جديدة من نماذج اللغة الكبيرة تتميز بفهم وتوليد أقوى.",
"qwen/qwen-2-vl-72b-instruct.description": "Qwen2-VL هو أحدث إصدار من Qwen-VL، يحقق أداءً رائدًا في معايير الرؤية مثل MathVista وDocVQA وRealWorldQA وMTVQA. يمكنه فهم أكثر من 20 دقيقة من الفيديو للإجابة على الأسئلة، الحوار، وإنشاء المحتوى بجودة عالية. كما يتعامل مع الاستدلال المعقد واتخاذ القرار، ويتكامل مع الأجهزة المحمولة والروبوتات للتصرف بناءً على السياق البصري والتعليمات النصية. بالإضافة إلى الإنجليزية والصينية، يقرأ النصوص في الصور بلغات متعددة، منها معظم اللغات الأوروبية، اليابانية، الكورية، العربية، والفيتنامية.",
"qwen/qwen-2.5-72b-instruct.description": "Qwen2.5-72B-Instruct هو أحد أحدث إصدارات نماذج اللغة الكبيرة من Alibaba Cloud. يقدم هذا النموذج تحسينات ملحوظة في البرمجة والرياضيات، ويدعم أكثر من 29 لغة (بما في ذلك الصينية والإنجليزية)، ويعزز بشكل كبير اتباع التعليمات، وفهم البيانات المنظمة، والإخراج المنظم (خاصة JSON).",
"qwen/qwen2.5-32b-instruct.description": "Qwen2.5-32B-Instruct هو أحد أحدث إصدارات نماذج اللغة الكبيرة من Alibaba Cloud. يقدم هذا النموذج تحسينات ملحوظة في البرمجة والرياضيات، ويدعم أكثر من 29 لغة (بما في ذلك الصينية والإنجليزية)، ويعزز بشكل كبير اتباع التعليمات، وفهم البيانات المنظمة، والإخراج المنظم (خاصة JSON).",
@@ -1134,11 +1170,16 @@
"qwen/qwen2.5-coder-32b-instruct.description": "نموذج متقدم لتوليد الشيفرة، الاستدلال، والإصلاح عبر لغات البرمجة الشائعة.",
"qwen/qwen2.5-coder-7b-instruct.description": "نموذج برمجة متوسط الحجم قوي مع سياق 32K، يتميز بالبرمجة متعددة اللغات.",
"qwen/qwen3-14b.description": "Qwen3-14B هو إصدار 14B مخصص للاستدلال العام وسيناريوهات الدردشة.",
"qwen/qwen3-14b:free.description": "Qwen3-14B هو نموذج سببي كثيف يحتوي على 14.8 مليار معلمة، مصمم للاستدلال المعقد والدردشة الفعالة. يتنقل بين وضع التفكير للرياضيات، البرمجة، والمنطق، ووضع غير التفكير للدردشة العامة. تم تحسينه لاتباع التعليمات، استخدام أدوات الوكلاء، والكتابة الإبداعية بأكثر من 100 لغة ولهجة. يدعم سياق 32K أصليًا ويتوسع إلى 131K باستخدام YaRN.",
"qwen/qwen3-235b-a22b-2507.description": "Qwen3-235B-A22B-Instruct-2507 هو إصدار Instruct من سلسلة Qwen3، يوازن بين استخدام التعليمات متعددة اللغات وسيناريوهات السياق الطويل.",
"qwen/qwen3-235b-a22b-thinking-2507.description": "Qwen3-235B-A22B-Thinking-2507 هو إصدار التفكير من Qwen3، معزز للمهام المعقدة في الرياضيات والاستدلال.",
"qwen/qwen3-235b-a22b.description": "Qwen3-235B-A22B هو نموذج MoE يحتوي على 235 مليار معامل من Qwen، مع 22 مليار نشطة في كل تمرير. يتنقل بين وضع التفكير للمهام المعقدة في الرياضيات والبرمجة، ووضع غير التفكير للدردشة الفعالة. يتميز باستدلال قوي، ودعم متعدد اللغات (أكثر من 100 لغة ولهجة)، واتباع تعليمات متقدم، واستخدام أدوات الوكلاء. يدعم سياقًا أصليًا حتى 32K ويتوسع إلى 131K باستخدام YaRN.",
"qwen/qwen3-235b-a22b:free.description": "Qwen3-235B-A22B هو نموذج MoE يحتوي على 235 مليار معامل من Qwen، مع 22 مليار نشطة في كل تمرير. يتنقل بين وضع التفكير للمهام المعقدة في الرياضيات والبرمجة، ووضع غير التفكير للدردشة الفعالة. يتميز باستدلال قوي، ودعم متعدد اللغات (أكثر من 100 لغة ولهجة)، واتباع تعليمات متقدم، واستخدام أدوات الوكلاء. يدعم سياقًا أصليًا حتى 32K ويتوسع إلى 131K باستخدام YaRN.",
"qwen/qwen3-30b-a3b.description": "Qwen3 هو الجيل الأحدث من نماذج Qwen LLM، يتميز ببنى كثيفة وMoE، ويتفوق في الاستدلال، دعم اللغات المتعددة، ومهام الوكلاء المتقدمة. يتميز بقدرته الفريدة على التبديل بين نمط التفكير للاستدلال المعقد ونمط غير التفكير للدردشة الفعالة، مما يضمن أداءً عالي الجودة ومتعدد الاستخدامات.\n\nيتفوق Qwen3 بشكل كبير على النماذج السابقة مثل QwQ وQwen2.5، ويقدم أداءً ممتازًا في الرياضيات، البرمجة، الاستدلال المنطقي، الكتابة الإبداعية، والدردشة التفاعلية. يحتوي إصدار Qwen3-30B-A3B على 30.5 مليار معلمة (3.3 مليار نشطة)، 48 طبقة، 128 خبيرًا (8 نشطين لكل مهمة)، ويدعم سياقًا يصل إلى 131 ألف باستخدام YaRN، مما يضع معيارًا جديدًا للنماذج المفتوحة.",
"qwen/qwen3-30b-a3b:free.description": "Qwen3 هو الجيل الأحدث من نماذج Qwen LLM، يتميز ببنى كثيفة وMoE، ويتفوق في الاستدلال، دعم اللغات المتعددة، ومهام الوكلاء المتقدمة. يتميز بقدرته الفريدة على التبديل بين نمط التفكير للاستدلال المعقد ونمط غير التفكير للدردشة الفعالة، مما يضمن أداءً عالي الجودة ومتعدد الاستخدامات.\n\nيتفوق Qwen3 بشكل كبير على النماذج السابقة مثل QwQ وQwen2.5، ويقدم أداءً ممتازًا في الرياضيات، البرمجة، الاستدلال المنطقي، الكتابة الإبداعية، والدردشة التفاعلية. يحتوي إصدار Qwen3-30B-A3B على 30.5 مليار معلمة (3.3 مليار نشطة)، 48 طبقة، 128 خبيرًا (8 نشطين لكل مهمة)، ويدعم سياقًا يصل إلى 131 ألف باستخدام YaRN، مما يضع معيارًا جديدًا للنماذج المفتوحة.",
"qwen/qwen3-32b.description": "Qwen3-32B هو نموذج LLM كثيف يحتوي على 32.8 مليار معلمة، مُحسَّن للاستدلال المعقد والدردشة الفعالة. يمكنه التبديل بين نمط التفكير للرياضيات والبرمجة والمنطق، ونمط غير التفكير للدردشة العامة السريعة. يتميز بأداء قوي في اتباع التعليمات، استخدام أدوات الوكلاء، والكتابة الإبداعية بأكثر من 100 لغة ولهجة. يدعم سياقًا أصليًا حتى 32 ألف ويتوسع إلى 131 ألف باستخدام YaRN.",
"qwen/qwen3-32b:free.description": "Qwen3-32B هو نموذج LLM كثيف يحتوي على 32.8 مليار معلمة، مُحسَّن للاستدلال المعقد والدردشة الفعالة. يمكنه التبديل بين نمط التفكير للرياضيات والبرمجة والمنطق، ونمط غير التفكير للدردشة العامة السريعة. يتميز بأداء قوي في اتباع التعليمات، استخدام أدوات الوكلاء، والكتابة الإبداعية بأكثر من 100 لغة ولهجة. يدعم سياقًا أصليًا حتى 32 ألف ويتوسع إلى 131 ألف باستخدام YaRN.",
"qwen/qwen3-8b:free.description": "Qwen3-8B هو نموذج LLM كثيف يحتوي على 8.2 مليار معلمة، مصمم للمهام التي تتطلب استدلالًا عاليًا ودردشة فعالة. يمكنه التبديل بين نمط التفكير للرياضيات والبرمجة والمنطق، ونمط غير التفكير للدردشة العامة. تم تحسينه لاتباع التعليمات، تكامل الوكلاء، والكتابة الإبداعية بأكثر من 100 لغة ولهجة. يدعم سياقًا أصليًا حتى 32 ألف ويتوسع إلى 131 ألف باستخدام YaRN.",
"qwen/qwen3-coder-plus.description": "Qwen3-Coder-Plus هو نموذج ترميز من سلسلة Qwen، مُحسَّن لاستخدام الأدوات المعقدة وجلسات العمل الطويلة.",
"qwen/qwen3-coder.description": "Qwen3-Coder هو نموذج من عائلة Qwen3 لتوليد الشيفرات، يتميز بفهم وتوليد الشيفرات في المستندات الطويلة.",
"qwen/qwen3-max-preview.description": "Qwen3 Max (نسخة تجريبية) هو إصدار Max المتقدم في الاستدلال ودمج الأدوات.",
@@ -1154,7 +1195,7 @@
"qwen2.5-14b-instruct.description": "Qwen2.5 نموذج مفتوح المصدر بسعة 14 مليار معلمة.",
"qwen2.5-32b-instruct.description": "Qwen2.5 نموذج مفتوح المصدر بسعة 32 مليار معلمة.",
"qwen2.5-72b-instruct.description": "Qwen2.5 نموذج مفتوح المصدر بسعة 72 مليار معلمة.",
"qwen2.5-7b-instruct.description": "Qwen2.5 نموذج مفتوح المصدر بحجم 7B.",
"qwen2.5-7b-instruct.description": "Qwen2.5 7B Instruct هو نموذج مفتوح المصدر ناضج للدردشة وتوليد المحتوى في سيناريوهات متعددة.",
"qwen2.5-coder-1.5b-instruct.description": "نموذج Qwen للبرمجة مفتوح المصدر.",
"qwen2.5-coder-14b-instruct.description": "نموذج Qwen للبرمجة مفتوح المصدر.",
"qwen2.5-coder-32b-instruct.description": "نموذج Qwen للبرمجة مفتوح المصدر.",
@@ -1167,7 +1208,7 @@
"qwen2.5-omni-7b.description": "نماذج Qwen-Omni تدعم المدخلات متعددة الوسائط (فيديو، صوت، صور، نص) وتنتج مخرجات صوتية ونصية.",
"qwen2.5-vl-32b-instruct.description": "Qwen2.5 VL 32B Instruct هو نموذج متعدد الوسائط مفتوح المصدر مناسب للنشر الخاص والاستخدام في سيناريوهات متعددة.",
"qwen2.5-vl-72b-instruct.description": "تحسين في اتباع التعليمات، والرياضيات، وحل المشكلات، والبرمجة، مع قدرة أقوى على التعرف على الكائنات. يدعم تحديد العناصر البصرية بدقة عبر التنسيقات، وفهم الفيديو الطويل (حتى 10 دقائق) مع توقيت الأحداث على مستوى الثانية، وترتيبها الزمني وفهم السرعة، ووكلاء يمكنهم التحكم في أنظمة التشغيل أو الهواتف المحمولة من خلال التحليل والتحديد. يتميز باستخراج المعلومات الأساسية بدقة وإخراج JSON. هذا هو الإصدار الأقوى بسعة 72B.",
"qwen2.5-vl-7b-instruct.description": "تحسين اتباع التعليمات، الرياضيات، حل المشكلات، والبرمجة، مع قدرة أقوى على التعرف على الكائنات العامة. يدعم تحديد المواقع الدقيقة للعناصر البصرية عبر التنسيقات، فهم الفيديو الطويل (حتى 10 دقائق) مع توقيت الأحداث على مستوى الثانية، ترتيب زمني وفهم السرعة، ووكلاء يمكنهم التحكم في نظام التشغيل أو الهاتف المحمول عبر التحليل والتحديد. استخراج معلومات رئيسية قوي وإخراج JSON. هذا هو الإصدار الأقوى في السلسلة بحجم 72B.",
"qwen2.5-vl-7b-instruct.description": "Qwen2.5 VL 7B Instruct هو نموذج متعدد الوسائط خفيف الوزن يوازن بين تكلفة النشر وقدرة التعرف.",
"qwen2.5-vl-instruct.description": "Qwen2.5-VL هو أحدث نموذج رؤية-لغة في عائلة Qwen.",
"qwen2.5.description": "Qwen2.5 هو الجيل الجديد من النماذج اللغوية الكبيرة من Alibaba، يتميز بأداء قوي في استخدامات متنوعة.",
"qwen2.5:0.5b.description": "Qwen2.5 هو الجيل الجديد من النماذج اللغوية الكبيرة من Alibaba، يتميز بأداء قوي في استخدامات متنوعة.",
@@ -1221,7 +1262,7 @@
"qwen3.5-plus-2026-04-20.description": "Qwen 3.5 هو نموذج رؤية-لغة Plus أصلي. مقارنة بلقطة فبراير 15، يقدم هذا الإصدار تحسينات كبيرة في قدرات البرمجة الوكيلة وسرعة الاستدلال بشكل ملحوظ. تظل معرفته، تفكيره، وقدراته على السياق الطويل على مستوى عالٍ، مما يلبي متطلبات المهام الوكيلة المعقدة. يناسب البرمجة الوكيلة، سير العمل الإنتاجي، والسيناريوهات ذات الإنتاجية العالية. يتوافق هذا الإصدار مع لقطة أبريل 20، 2026.",
"qwen3.5-plus.description": "Qwen3.5 Plus يدعم إدخال النصوص، الصور، والفيديو. أداؤه في المهام النصية البحتة يعادل Qwen3 Max، مع أداء أفضل وتكلفة أقل. قدراته متعددة الوسائط محسنة بشكل كبير مقارنة بسلسلة Qwen3 VL.",
"qwen3.5:397b.description": "Qwen3.5 هو نموذج أساسي موحد للرؤية واللغة مع بنية هجينة (Mixture-of-Experts + انتباه خطي)، يقدم قدرات قوية في التفكير متعدد الوسائط، البرمجة، والسياقات الطويلة مع نافذة سياق 256K.",
"qwen3.6-27b.description": "Qwen3.6 27B هو نموذج كثيف مفتوح المصدر يتميز بأداء قوي في التفكير، البرمجة، والقدرات العامة. يدعم وضع التفكير افتراضيًا، مما يوفر أداءً متوازنًا وكفاءة.",
"qwen3.6-27b.description": "سلسلة Qwen 3.6 27B هي نموذج رؤية-لغة كثيف أصلي. مقارنة بالإصدار 3.5-27B، يقدم تحسينات كبيرة في قدرات البرمجة الوكيلة، مع تحسينات إضافية في الأداء STEM وقدرة التفكير. على الجانب البصري، يظهر مكاسب ملحوظة في الذكاء المكاني، تحديد المواقع، والكشف، بينما يتحسن أيضًا بشكل ثابت في فهم الفيديو، OCR الوثائق، وقدرات الوكيل البصري.",
"qwen3.6-35b-a3b.description": "يعتمد نموذج Qwen3.6 35B-A3B للرؤية واللغة على بنية هجينة تدمج آلية الانتباه الخطي مع تصميم الخبراء المتعددين (MoE) المتناثر، مما يحقق كفاءة أعلى في الاستدلال. مقارنةً بنموذج 3.5-35B-A3B، يقدم هذا الإصدار تحسينات كبيرة في قدرات البرمجة الوكيلية، والاستدلال الرياضي، واستدلال الأكواد، والذكاء المكاني، إضافة إلى تحديد المواقع واكتشاف الأهداف.",
"qwen3.6-flash.description": "يقدم نموذج Qwen3.6 Flash للرؤية واللغة أداءً محسّناً بشكل ملحوظ مقارنةً بإصدار 3.5-Flash. يركز النموذج على تعزيز قدرات البرمجة الوكيلية (متفوقاً بشكل كبير على سابقه في العديد من معايير تقييم الوكلاء البرمجيين)، إضافة إلى تحسين قدرات الاستدلال الرياضي واستدلال الأكواد. وعلى جانب الرؤية، يقدم النموذج تحسينات واضحة في الذكاء المكاني، مع تقدم قوي في تحديد المواقع واكتشاف الأهداف.",
"qwen3.6-max-preview.description": "أكبر نموذج مغلق المصدر ضمن سلسلة Qwen3.6. يقدم معرفة أعمق بالعالم، وقدرة أعلى على اتباع التعليمات، وأداءً أقوى في البرمجة الوكيلية للمهام المعقدة. وهو نصي فقط، ويدعم وضع التفكير بشكل افتراضي، إضافة إلى التخزين المؤقت الصريح واستدعاء الدوال.",
@@ -1233,8 +1274,6 @@
"qwq.description": "QwQ هو نموذج استدلال من عائلة Qwen. مقارنة بالنماذج المضبوطة على التعليمات، يقدم قدرات تفكير واستدلال تعزز الأداء بشكل كبير، خاصة في المشكلات الصعبة. QwQ-32B هو نموذج متوسط الحجم ينافس أفضل نماذج الاستدلال مثل DeepSeek-R1 و o1-mini.",
"qwq_32b.description": "نموذج استدلال متوسط الحجم من عائلة Qwen. مقارنة بالنماذج المضبوطة على التعليمات، تعزز قدرات التفكير والاستدلال في QwQ الأداء بشكل كبير، خاصة في المشكلات الصعبة.",
"r1-1776.description": "R1-1776 هو إصدار ما بعد التدريب من DeepSeek R1 مصمم لتقديم معلومات واقعية غير خاضعة للرقابة أو التحيز.",
"seedance-1-5-pro-251215.description": "Seedance 1.5 Pro من ByteDance يدعم تحويل النص إلى فيديو، تحويل الصورة إلى فيديو (الإطار الأول، الإطار الأول+الأخير)، وإنشاء الصوت المتزامن مع المرئيات.",
"seedream-5-0-260128.description": "ByteDance-Seedream-5.0-lite من BytePlus يتميز بإنشاء مدعوم باسترجاع الويب للحصول على معلومات في الوقت الحقيقي، تفسير محسّن للتعليمات المعقدة، وتحسين تناسق المرجع لإنشاء مرئيات احترافية.",
"solar-mini-ja.description": "Solar Mini (Ja) يوسع Solar Mini مع تركيز على اللغة اليابانية مع الحفاظ على الأداء القوي والكفاءة في الإنجليزية والكورية.",
"solar-mini.description": "Solar Mini هو نموذج لغة مدمج يتفوق على GPT-3.5، يتميز بقدرات متعددة اللغات قوية تدعم الإنجليزية والكورية، ويقدم حلاً فعالاً بصمة صغيرة.",
"solar-pro.description": "Solar Pro هو نموذج لغة عالي الذكاء من Upstage، يركز على اتباع التعليمات باستخدام وحدة معالجة رسومات واحدة، مع درجات IFEval تتجاوز 80. حالياً يدعم اللغة الإنجليزية؛ وكان من المقرر إصدار النسخة الكاملة في نوفمبر 2024 مع دعم لغات موسع وسياق أطول.",
@@ -1269,7 +1308,6 @@
"step-3.5-flash-2603.description": "مبني على Step 3.5 Flash ومحسن لسيناريوهات الوكلاء عالية التردد، يحسن كفاءة الرموز وسرعة الاستدلال مع الحفاظ على قدرات التفكير واستدعاء الأدوات على مستوى النموذج الرئيسي. يدعم أيضًا التبديل إلى وضع التفكير المنخفض لتقليل استهلاك الموارد. بالإضافة إلى ذلك، تم إجراء تحسينات مستهدفة لتعزيز التوافق مع مهام البرمجة وإطارات العمل الوكيلة.",
"step-3.5-flash.description": "نموذج التفكير اللغوي الرائد من Stepfun. يتميز بقدرات تفكير من الدرجة الأولى وقدرات تنفيذ سريعة وموثوقة. قادر على تحليل وتخطيط المهام المعقدة، واستدعاء الأدوات بسرعة وموثوقية لأداء المهام، والتعامل مع مختلف المهام المعقدة مثل التفكير المنطقي، الرياضيات، هندسة البرمجيات، والبحث المتعمق.",
"step-3.description": "يتمتع هذا النموذج بإدراك بصري قوي واستدلال معقد، ويتعامل بدقة مع فهم المعرفة عبر المجالات، وتحليل الرياضيات والرؤية، ومجموعة واسعة من مهام التحليل البصري اليومية.",
"step-image-edit-2.description": "نموذج تحرير خفيف الوزن من أحدث إصدار لـ Stepfun يدعم تحويل النص إلى صورة وتحرير الصور ضمن نموذج واحد. على الرغم من احتوائه على أقل من 6 مليارات معلمة، فإنه يحقق أداءً رائدًا على مستوى حجمه، ينافس النماذج مفتوحة المصدر في نطاق 12B–20B عبر المستويات. تستغرق كل مهمة تحرير فقط 1–2 ثانية، مما يعيد تعريف تجربة تحرير الصور التفاعلي في الوقت الفعلي.",
"step-r1-v-mini.description": "نموذج استدلال يتمتع بفهم قوي للصور، يمكنه معالجة الصور والنصوص، ثم توليد نص بعد استدلال عميق. يتفوق في الاستدلال البصري ويقدم أداءً رائدًا في الرياضيات والبرمجة والاستدلال النصي، مع نافذة سياق تصل إلى 100 ألف.",
"stepfun-ai/step3.description": "Step3 هو نموذج استدلال متعدد الوسائط متقدم من StepFun، يعتمد على بنية MoE مع 321 مليار معلمة إجمالية و38 مليار معلمة نشطة. تصميمه الشامل يقلل من تكلفة فك التشفير مع تقديم استدلال رؤية-لغة من الدرجة الأولى. مع تصميم MFA وAFD، يظل فعالًا على كل من المسرعات الرائدة والمنخفضة. يستخدم التدريب المسبق أكثر من 20 تريليون رمز نصي و4 تريليون رمز نصي-صوري عبر العديد من اللغات. يحقق أداءً رائدًا للنماذج المفتوحة في الرياضيات، البرمجة، ومعايير متعددة الوسائط.",
"taichu4_vl_2b_nothinking.description": "الإصدار بدون التفكير من نموذج Taichu4.0-VL 2B يتميز باستخدام ذاكرة أقل، تصميم خفيف الوزن، سرعة استجابة سريعة، وقدرات فهم متعددة الوسائط قوية.",
@@ -1285,7 +1323,11 @@
"text-embedding-3-large.description": "أقوى نموذج تضمين للمهام باللغة الإنجليزية وغير الإنجليزية.",
"text-embedding-3-small.description": "نموذج تضمين من الجيل التالي فعال من حيث التكلفة ومناسب للاسترجاع وسيناريوهات RAG.",
"thudm/glm-4-32b.description": "GLM-4-32B-0414 هو نموذج ثنائي اللغة (صيني/إنجليزي) بسعة 32B وأوزان مفتوحة، مُحسَّن لتوليد الشيفرات، واستدعاء الوظائف، ومهام الوكلاء. تم تدريبه مسبقًا على 15 تريليون رمز عالي الجودة ومليء بالاستدلال، وتم تحسينه بموازنة تفضيلات البشر، وأخذ العينات بالرفض، والتعلم المعزز. يتفوق في الاستدلال المعقد، وتوليد المخرجات المنظمة، ويصل إلى مستوى أداء GPT-4o وDeepSeek-V3-0324 في العديد من المعايير.",
"thudm/glm-4-32b:free.description": "GLM-4-32B-0414 هو نموذج ثنائي اللغة (صيني/إنجليزي) بسعة 32B وأوزان مفتوحة، مُحسَّن لتوليد الشيفرات، واستدعاء الوظائف، ومهام الوكلاء. تم تدريبه مسبقًا على 15 تريليون رمز عالي الجودة ومليء بالاستدلال، وتم تحسينه بموازنة تفضيلات البشر، وأخذ العينات بالرفض، والتعلم المعزز. يتفوق في الاستدلال المعقد، وتوليد المخرجات المنظمة، ويصل إلى مستوى أداء GPT-4o وDeepSeek-V3-0324 في العديد من المعايير.",
"thudm/glm-4-9b-chat.description": "الإصدار مفتوح المصدر من نموذج GLM-4 الأحدث من Zhipu AI.",
"thudm/glm-z1-32b.description": "GLM-Z1-32B-0414 هو إصدار استدلال محسَّن من GLM-4-32B، مصمم لحل المشكلات المعقدة في الرياضيات والمنطق والبرمجة. يستخدم تعلمًا معززًا موسعًا (تفضيلات زوجية خاصة بالمهمة وعامة) لتحسين المهام متعددة الخطوات. مقارنة بـ GLM-4-32B، يقدم Z1 تحسينات كبيرة في الاستدلال المنظم والقدرات في المجالات الرسمية. يدعم فرض خطوات التفكير من خلال هندسة التعليمات، وتحسين التماسك في المخرجات الطويلة، ومُحسَّن لسير عمل الوكلاء مع سياق طويل (عبر YaRN)، واستدعاء أدوات JSON، وأخذ عينات دقيقة لاستدلال مستقر. مثالي للحالات التي تتطلب اشتقاقات متعددة الخطوات أو رسمية دقيقة.",
"thudm/glm-z1-rumination-32b.description": "GLM Z1 Rumination 32B هو نموذج تفكير عميق بسعة 32 مليار في سلسلة GLM-4-Z1، مُحسّن للمهام المعقدة المفتوحة التي تتطلب تفكيرًا طويل الأمد. مبني على glm-4-32b-0414، ويضيف مراحل تعزيز التعلم (RL) إضافية ومحاذاة متعددة المراحل، مما يقدّم قدرة \"التأمل\" التي تحاكي المعالجة المعرفية الممتدة. يشمل ذلك التفكير التكراري، والتحليل متعدد الخطوات، وسير العمل المدعوم بالأدوات مثل البحث، والاسترجاع، والتوليف المدرك للاستشهادات.\n\nيتفوّق في كتابة الأبحاث، والتحليل المقارن، والأسئلة المعقدة. يدعم استدعاء الوظائف لأساسيات البحث/التنقل (`search`، `click`، `open`، `finish`) في خطوط أنابيب الوكلاء. يتم التحكم في سلوك التأمل من خلال حلقات متعددة الجولات مع تشكيل مكافآت قائم على القواعد وآليات اتخاذ القرار المؤجل، وتمت معايرته مقابل أطر البحث العميق مثل نظام المحاذاة الداخلي لـ OpenAI. هذا الإصدار يركّز على العمق بدلاً من السرعة.",
"tngtech/deepseek-r1t-chimera:free.description": "تم إنشاء DeepSeek-R1T-Chimera من خلال دمج DeepSeek-R1 و DeepSeek-V3 (0324)، حيث يجمع بين قدرات التفكير في R1 وكفاءة الرموز في V3. يعتمد على محول DeepSeek-MoE وتم تحسينه لتوليد النصوص العامة.\n\nيُدمج الأوزان المدربة مسبقًا لتحقيق توازن بين التفكير والكفاءة واتباع التعليمات. تم إصداره بموجب ترخيص MIT للاستخدام البحثي والتجاري.",
"togethercomputer/StripedHyena-Nous-7B.description": "يوفّر StripedHyena Nous (7B) كفاءة حوسبة محسّنة من خلال بنيته واستراتيجيته.",
"tts-1-hd.description": "أحدث نموذج تحويل النص إلى كلام، مُحسّن للجودة.",
"tts-1.description": "أحدث نموذج تحويل النص إلى كلام، مُحسّن للسرعة في الوقت الحقيقي.",
+18 -3
View File
@@ -29,9 +29,7 @@
"agent.layout.switchMessage": "لست في مزاج لذلك اليوم؟ يمكنك التبديل إلى <modeLink><modeText>{{mode}}</modeText></modeLink> أو <skipLink><skipText>{{skip}}</skipText></skipLink>.",
"agent.modeSwitch.agent": "تفاعلي",
"agent.modeSwitch.classic": "كلاسيكي",
"agent.modeSwitch.collapse": "طي",
"agent.modeSwitch.debug": "تصدير التصحيح",
"agent.modeSwitch.expand": "توسيع",
"agent.modeSwitch.label": "اختر وضع التسجيل",
"agent.modeSwitch.reset": "إعادة ضبط التدفق",
"agent.progress": "{{currentStep}}/{{totalSteps}}",
@@ -60,7 +58,24 @@
"agent.welcome.sentence.1": "سررت بلقائك! دعنا نتعرّف على بعض.",
"agent.welcome.sentence.2": "ما نوع الشريك الذي تريدني أن أكونه؟",
"agent.welcome.sentence.3": "أولًا، اختر لي اسمًا :)",
"agent.welcome.suggestion.avatarHint": "استخدم {{emoji}} كالصورة الرمزية.",
"agent.welcome.suggestion.items.1.name": "لومي",
"agent.welcome.suggestion.items.1.prompt": "لنسمّك لومي أولًا. دافئ، متفكّر، وقليل الخيال.",
"agent.welcome.suggestion.items.2.name": "أطلس",
"agent.welcome.suggestion.items.2.prompt": "ما رأيك في أطلس؟ ثابت، موثوق، وماهر في إنجاز المهام.",
"agent.welcome.suggestion.items.3.name": "مومو",
"agent.welcome.suggestion.items.3.prompt": "ربما مومو. خفيف الظل، لطيف، وسهل التحدّث معه.",
"agent.welcome.suggestion.items.4.name": "نوفا",
"agent.welcome.suggestion.items.4.prompt": "لنختر نوفا. حادّ، خيالي، ومليء بالأفكار الجديدة.",
"agent.welcome.suggestion.items.5.name": "ميلو",
"agent.welcome.suggestion.items.5.prompt": "ميلو يبدو جيدًا. ودود، سريع البديهة، وفعّال بهدوء.",
"agent.welcome.suggestion.items.6.name": "أستر",
"agent.welcome.suggestion.items.6.prompt": "ما رأيك في أستر؟ واضح، مباشر، وهادئ تحت الضغط.",
"agent.welcome.suggestion.items.7.name": "بيكسل",
"agent.welcome.suggestion.items.7.prompt": "تريد أن نسمّيك بيكسل؟ فضولي، مهتمّ بالمنتجات، ودقيق الملاحظة.",
"agent.welcome.suggestion.items.8.name": "إيكو",
"agent.welcome.suggestion.items.8.prompt": "ربما إيكو. صبور، منصت، ودائم الاهتمام بالتفاصيل.",
"agent.welcome.suggestion.items.9.name": "أوربيت",
"agent.welcome.suggestion.items.9.prompt": "لنجرّب أوربيت. يشعر كرفيق طويل الأمد ينمو معي.",
"agent.welcome.suggestion.switch": "جرّب مجموعة أخرى",
"agent.welcome.suggestion.title": "تحتاج نقطة بداية؟ اختر واحدًا ويمكننا تحسينه لاحقًا.",
"agent.wrapUp.action": "أعتقد أننا انتهينا",
+2 -67
View File
@@ -35,12 +35,6 @@
"builtins.lobe-agent-documents.apiName.renameDocument": "إعادة تسمية المستند",
"builtins.lobe-agent-documents.apiName.replaceDocumentContent": "استبدال محتوى المستند",
"builtins.lobe-agent-documents.apiName.updateLoadRule": "تحديث قاعدة التحميل",
"builtins.lobe-agent-documents.inspector.chars": "{{count}} أحرف",
"builtins.lobe-agent-documents.inspector.docCount": "{{count}} مستندات",
"builtins.lobe-agent-documents.inspector.opsCount": "{{count}} عمليات",
"builtins.lobe-agent-documents.inspector.opsResult": "{{success}}/{{total}} عمليات",
"builtins.lobe-agent-documents.inspector.target.agent": "في الوكيل",
"builtins.lobe-agent-documents.inspector.target.currentTopic": "في الموضوع",
"builtins.lobe-agent-documents.title": "مستندات الوكيل",
"builtins.lobe-agent-management.apiName.callAgent": "وكيل الاتصال",
"builtins.lobe-agent-management.apiName.createAgent": "إنشاء وكيل",
@@ -69,34 +63,24 @@
"builtins.lobe-agent-management.render.installPlugin.plugin": "الملحق",
"builtins.lobe-agent-management.render.installPlugin.success": "تم التثبيت بنجاح",
"builtins.lobe-agent-management.title": "مدير الوكلاء",
"builtins.lobe-agent-marketplace.apiName.showAgentMarketplace": "افتح سوق الوكلاء",
"builtins.lobe-agent-marketplace.apiName.submitAgentPick": "إرسال اختيارات الوكلاء",
"builtins.lobe-agent-marketplace.title": "سوق الوكلاء",
"builtins.lobe-claude-code.agent.instruction": "تعليمات",
"builtins.lobe-claude-code.agent.result": "النتيجة",
"builtins.lobe-claude-code.todoWrite.allDone": "جميع المهام مكتملة",
"builtins.lobe-claude-code.todoWrite.currentStep": "الخطوة الحالية",
"builtins.lobe-claude-code.todoWrite.todos": "المهام",
"builtins.lobe-cloud-sandbox.apiName.editFile": "تحرير الملف",
"builtins.lobe-cloud-sandbox.apiName.editLocalFile": "تعديل الملف",
"builtins.lobe-cloud-sandbox.apiName.executeCode": "تنفيذ الكود",
"builtins.lobe-cloud-sandbox.apiName.exportFile": "تصدير الملف",
"builtins.lobe-cloud-sandbox.apiName.getCommandOutput": "الحصول على ناتج الأمر",
"builtins.lobe-cloud-sandbox.apiName.globFiles": "بحث شامل في الملفات",
"builtins.lobe-cloud-sandbox.apiName.globLocalFiles": "بحث شامل في الملفات",
"builtins.lobe-cloud-sandbox.apiName.grepContent": "البحث في المحتوى",
"builtins.lobe-cloud-sandbox.apiName.killCommand": "إيقاف الأمر",
"builtins.lobe-cloud-sandbox.apiName.listFiles": "قائمة الملفات",
"builtins.lobe-cloud-sandbox.apiName.listLocalFiles": "عرض الملفات",
"builtins.lobe-cloud-sandbox.apiName.moveFiles": "نقل الملفات",
"builtins.lobe-cloud-sandbox.apiName.moveLocalFiles": "نقل الملفات",
"builtins.lobe-cloud-sandbox.apiName.readFile": "قراءة محتوى الملف",
"builtins.lobe-cloud-sandbox.apiName.readLocalFile": "قراءة محتوى الملف",
"builtins.lobe-cloud-sandbox.apiName.renameLocalFile": "إعادة تسمية",
"builtins.lobe-cloud-sandbox.apiName.runCommand": "تشغيل الأمر",
"builtins.lobe-cloud-sandbox.apiName.searchFiles": "البحث في الملفات",
"builtins.lobe-cloud-sandbox.apiName.searchLocalFiles": "البحث في الملفات",
"builtins.lobe-cloud-sandbox.apiName.writeFile": "كتابة الملف",
"builtins.lobe-cloud-sandbox.apiName.writeLocalFile": "كتابة الملف",
"builtins.lobe-cloud-sandbox.inspector.noResults": "لا توجد نتائج",
"builtins.lobe-cloud-sandbox.title": "بيئة سحابية",
@@ -162,24 +146,17 @@
"builtins.lobe-knowledge-base.inspector.andMoreFiles": "و{{count}} ملفًا آخر",
"builtins.lobe-knowledge-base.inspector.noResults": "لا توجد نتائج",
"builtins.lobe-knowledge-base.title": "المكتبة",
"builtins.lobe-local-system.apiName.editFile": "تحرير الملف",
"builtins.lobe-local-system.apiName.editLocalFile": "تعديل الملف",
"builtins.lobe-local-system.apiName.getCommandOutput": "الحصول على ناتج الأمر",
"builtins.lobe-local-system.apiName.globFiles": "بحث شامل في الملفات",
"builtins.lobe-local-system.apiName.globLocalFiles": "بحث شامل في الملفات",
"builtins.lobe-local-system.apiName.grepContent": "البحث في المحتوى",
"builtins.lobe-local-system.apiName.killCommand": "إيقاف الأمر",
"builtins.lobe-local-system.apiName.listFiles": "قائمة الملفات",
"builtins.lobe-local-system.apiName.listLocalFiles": "عرض الملفات",
"builtins.lobe-local-system.apiName.moveFiles": "نقل الملفات",
"builtins.lobe-local-system.apiName.moveLocalFiles": "نقل الملفات",
"builtins.lobe-local-system.apiName.readFile": "قراءة محتوى الملف",
"builtins.lobe-local-system.apiName.readLocalFile": "قراءة محتوى الملف",
"builtins.lobe-local-system.apiName.renameLocalFile": "إعادة تسمية",
"builtins.lobe-local-system.apiName.runCommand": "تشغيل الأمر",
"builtins.lobe-local-system.apiName.searchFiles": "البحث في الملفات",
"builtins.lobe-local-system.apiName.searchLocalFiles": "البحث في الملفات",
"builtins.lobe-local-system.apiName.writeFile": "كتابة الملف",
"builtins.lobe-local-system.apiName.writeLocalFile": "كتابة الملف",
"builtins.lobe-local-system.inspector.noResults": "لا توجد نتائج",
"builtins.lobe-local-system.inspector.rename.result": "<old>{{oldName}}</old> → <new>{{newName}}</new>",
@@ -256,37 +233,6 @@
"builtins.lobe-skills.apiName.runCommand": "تشغيل الأمر",
"builtins.lobe-skills.apiName.searchSkill": "البحث عن المهارات",
"builtins.lobe-skills.title": "المهارات",
"builtins.lobe-task.apiName.addTaskComment": "إضافة تعليق",
"builtins.lobe-task.apiName.createTask": "إنشاء مهمة",
"builtins.lobe-task.apiName.createTasks": "إنشاء مهام",
"builtins.lobe-task.apiName.deleteTask": "حذف مهمة",
"builtins.lobe-task.apiName.deleteTaskComment": "حذف تعليق",
"builtins.lobe-task.apiName.editTask": "تعديل مهمة",
"builtins.lobe-task.apiName.listTasks": "عرض المهام",
"builtins.lobe-task.apiName.runTask": "تشغيل مهمة",
"builtins.lobe-task.apiName.runTasks": "تشغيل مهام",
"builtins.lobe-task.apiName.updateTaskComment": "تحديث تعليق",
"builtins.lobe-task.apiName.updateTaskStatus": "تحديث الحالة",
"builtins.lobe-task.apiName.viewTask": "عرض المهمة",
"builtins.lobe-task.create.subtaskOf": "مهمة فرعية من {{parent}}",
"builtins.lobe-task.createTasks.count": "{{count}} مهام",
"builtins.lobe-task.createTasks.failedCount": "{{count}} فشل",
"builtins.lobe-task.createTasks.more": "+{{count}} المزيد",
"builtins.lobe-task.edit.assign": "تعيين",
"builtins.lobe-task.edit.blocksOn": "يعتمد على",
"builtins.lobe-task.edit.description": "تم تحديث الوصف",
"builtins.lobe-task.edit.instruction": "تم تحديث التعليمات",
"builtins.lobe-task.edit.parent": "الأصل",
"builtins.lobe-task.edit.parentClear": "المستوى الأعلى",
"builtins.lobe-task.edit.priority": "الأولوية",
"builtins.lobe-task.edit.rename": "إعادة تسمية",
"builtins.lobe-task.edit.unassign": "إلغاء التعيين",
"builtins.lobe-task.edit.unblocks": "إلغاء الاعتماد",
"builtins.lobe-task.run.continueTopic": "متابعة الموضوع",
"builtins.lobe-task.runTasks.count": "{{count}} مهام",
"builtins.lobe-task.runTasks.failedCount": "{{count}} فشل",
"builtins.lobe-task.runTasks.more": "+{{count}} المزيد",
"builtins.lobe-task.title": "أدوات المهام",
"builtins.lobe-topic-reference.apiName.getTopicContext": "الحصول على سياق الموضوع",
"builtins.lobe-topic-reference.title": "مرجع الموضوع",
"builtins.lobe-user-interaction.apiName.askUserQuestion": "طرح سؤال على المستخدم",
@@ -314,24 +260,12 @@
"builtins.lobe-web-browsing.inspector.noResults": "لا توجد نتائج",
"builtins.lobe-web-browsing.title": "بحث الويب",
"builtins.lobe-web-onboarding.apiName.finishOnboarding": "إنهاء الإعداد",
"builtins.lobe-web-onboarding.apiName.getOnboardingState": "قراءة حالة الإعداد",
"builtins.lobe-web-onboarding.apiName.readDocument": "قراءة المستند",
"builtins.lobe-web-onboarding.apiName.saveUserQuestion": "حفظ سؤال المستخدم",
"builtins.lobe-web-onboarding.apiName.updateDocument": "تحديث المستند",
"builtins.lobe-web-onboarding.apiName.writeDocument": "كتابة المستند",
"builtins.lobe-web-onboarding.docType.persona": "شخصية المستخدم",
"builtins.lobe-web-onboarding.docType.soul": "SOUL.md",
"builtins.lobe-web-onboarding.inspector.charCount_one": "{{count}} حرف",
"builtins.lobe-web-onboarding.inspector.charCount_other": "{{count}} أحرف",
"builtins.lobe-web-onboarding.inspector.hunkCount_one": "{{count}} تغيير",
"builtins.lobe-web-onboarding.inspector.hunkCount_other": "{{count}} تغييرات",
"builtins.lobe-web-onboarding.inspector.interests_one": "{{count}} اهتمام",
"builtins.lobe-web-onboarding.inspector.interests_other": "{{count}} اهتمامات",
"builtins.lobe-web-onboarding.title": "إعداد المستخدم",
"builtins.lobe-web-onboarding.updateDocument.hunkMode.delete": "حذف",
"builtins.lobe-web-onboarding.updateDocument.hunkMode.deleteLines": "حذف الأسطر",
"builtins.lobe-web-onboarding.updateDocument.hunkMode.insertAt": "إدراج عند السطر",
"builtins.lobe-web-onboarding.updateDocument.hunkMode.replace": "استبدال",
"builtins.lobe-web-onboarding.updateDocument.hunkMode.replaceLines": "استبدال الأسطر",
"confirm": "تأكيد",
"debug.arguments": "المعلمات",
"debug.error": "سجل الأخطاء",
@@ -356,6 +290,7 @@
"detailModal.tabs.settings": "الإعدادات",
"detailModal.title": "تفاصيل المهارة",
"dev.confirmDeleteDevPlugin": "سيتم حذف هذه المهارة المحلية نهائيًا. هل ترغب في المتابعة؟",
"dev.customParams.useProxy.label": "التثبيت عبر وكيل (فعّل إذا واجهت أخطاء CORS، ثم أعد المحاولة)",
"dev.deleteSuccess": "تم حذف المهارة",
"dev.manifest.identifier.desc": "معرّف فريد للمهارة",
"dev.manifest.identifier.label": "المعرّف",
-1
View File
@@ -33,7 +33,6 @@
"jina.description": "تأسست Jina AI في عام 2020، وهي شركة رائدة في مجال البحث الذكي. تشمل تقنياتها نماذج المتجهات، ومعيدو الترتيب، ونماذج لغوية صغيرة لبناء تطبيقات بحث توليدية ومتعددة الوسائط عالية الجودة.",
"kimicodingplan.description": "كود Kimi من Moonshot AI يوفر الوصول إلى نماذج Kimi بما في ذلك K2.5 لأداء مهام الترميز.",
"lmstudio.description": "LM Studio هو تطبيق سطح مكتب لتطوير وتجربة النماذج اللغوية الكبيرة على جهازك.",
"lobehub.description": "يستخدم LobeHub Cloud واجهات برمجة التطبيقات الرسمية للوصول إلى نماذج الذكاء الاصطناعي ويقيس الاستخدام باستخدام أرصدة مرتبطة برموز النماذج.",
"longcat.description": "LongCat هو سلسلة من نماذج الذكاء الاصطناعي التوليدية الكبيرة التي تم تطويرها بشكل مستقل بواسطة Meituan. تم تصميمه لتعزيز إنتاجية المؤسسة الداخلية وتمكين التطبيقات المبتكرة من خلال بنية حسابية فعالة وقدرات متعددة الوسائط قوية.",
"minimax.description": "تأسست MiniMax في عام 2021، وتبني نماذج ذكاء اصطناعي متعددة الوسائط للأغراض العامة، بما في ذلك نماذج نصية بمليارات المعلمات، ونماذج صوتية وبصرية، بالإضافة إلى تطبيقات مثل Hailuo AI.",
"minimaxcodingplan.description": "خطة الرموز MiniMax توفر الوصول إلى نماذج MiniMax بما في ذلك M2.7 لأداء مهام الترميز عبر اشتراك ثابت الرسوم.",
+3 -10
View File
@@ -454,14 +454,16 @@
"myAgents.status.published": "منشور",
"myAgents.status.unpublished": "غير منشور",
"myAgents.title": "وكلائي المنشورون",
"notification.category.generation.desc": "إشعارات استكمال الصور ومقاطع الفيديو",
"notification.category.generation.title": "الإنشاء",
"notification.category.schedule.desc": "إخفاقات وتوقّف المهام المجدولة",
"notification.category.schedule.title": "المهام المجدولة",
"notification.email.desc": "تلقي إشعارات البريد الإلكتروني عند حدوث أحداث مهمة",
"notification.email.title": "إشعارات البريد الإلكتروني",
"notification.enabled": "مفعل",
"notification.inbox.desc": "عرض الإشعارات في صندوق الوارد داخل التطبيق",
"notification.inbox.title": "إشعارات صندوق الوارد",
"notification.item.agent_cron_job_failed": "فشل المهمة المجدولة",
"notification.item.agent_cron_job_failed": "إخفاقات المهام المجدولة",
"notification.item.image_generation_completed": "اكتمل إنشاء الصورة",
"notification.item.video_generation_completed": "اكتمل إنشاء الفيديو",
"notification.title": "قنوات الإشعارات",
@@ -496,13 +498,10 @@
"settingAppearance.animationMode.disabled": "إيقاف",
"settingAppearance.animationMode.elegant": "أنيق",
"settingAppearance.animationMode.title": "رسوم استجابة التطبيق",
"settingAppearance.appTray.desc": "عرض أيقونة LobeHub في شريط النظام أو شريط القوائم في macOS. تعطيلها يزيل أيضًا الوصول إلى قائمة الشريط.",
"settingAppearance.appTray.title": "عرض شريط التطبيق",
"settingAppearance.contextMenuMode.default": "افتراضي",
"settingAppearance.contextMenuMode.desc": "تمكين قائمة النقر بزر الماوس الأيمن لبعض عناصر القائمة.",
"settingAppearance.contextMenuMode.disabled": "معطل",
"settingAppearance.contextMenuMode.title": "وضع قائمة النقر الأيمن",
"settingAppearance.desktop.title": "سطح المكتب",
"settingAppearance.neutralColor.desc": "تدرجات رمادية مخصصة مع ميول لونية مختلفة",
"settingAppearance.neutralColor.title": "اللون المحايد",
"settingAppearance.noAnimation.desc": "تعطيل جميع تأثيرات الرسوم المتحركة في التطبيق",
@@ -535,9 +534,6 @@
"settingChat.inputTemplate.desc": "سيتم ملء أحدث رسالة للمستخدم في هذا القالب",
"settingChat.inputTemplate.placeholder": "سيتم استبدال قالب المعالجة المسبقة {{text}} بمعلومات الإدخال الفعلية",
"settingChat.inputTemplate.title": "معالجة مسبقة لإدخال المستخدم",
"settingChat.selfIteration.enabled.desc": "Allow this assistant to review recent signals and improve its own skills when the lab workflow runs",
"settingChat.selfIteration.enabled.title": "Enable Self-Iteration",
"settingChat.selfIteration.title": "Advanced Labs",
"settingChat.submit": "تحديث تفضيلات الدردشة",
"settingChat.title": "إعدادات الدردشة",
"settingChatAppearance.autoScrollOnStreaming.desc": "التمرير تلقائيًا إلى الأسفل عند توليد الذكاء الاصطناعي للاستجابة",
@@ -857,7 +853,6 @@
"tab.manualFill": "التعبئة اليدوية",
"tab.manualFill.desc": "تكوين مهارة MCP مخصصة يدويًا",
"tab.memory": "الذاكرة",
"tab.messenger": "الرسائل",
"tab.notification": "الإشعارات",
"tab.profile": "حسابي",
"tab.provider": "مزود خدمة الذكاء الاصطناعي",
@@ -894,8 +889,6 @@
"tools.builtins.lobe-agent-documents.title": "المستندات",
"tools.builtins.lobe-agent-management.description": "إنشاء الوكلاء وإدارتهم وتنظيم عملهم",
"tools.builtins.lobe-agent-management.title": "إدارة الوكلاء",
"tools.builtins.lobe-agent-marketplace.description": "عرض بطاقة سوق الوكلاء المختارة للمستخدمين وتسجيل القوالب التي يختارونها.",
"tools.builtins.lobe-agent-marketplace.title": "سوق الوكلاء",
"tools.builtins.lobe-artifacts.description": "إنشاء ومعاينة مكونات واجهة المستخدم التفاعلية، وتصوير البيانات، والمخططات، والرسومات بصيغة SVG، وتطبيقات الويب بشكل مباشر. أنشئ محتوى بصريًا غنيًا يمكن للمستخدمين التفاعل معه مباشرة.",
"tools.builtins.lobe-artifacts.readme": "أنشئ معاينات حية وتفاعلية لمكونات واجهة المستخدم، وتصوير البيانات، والمخططات، والرسومات بصيغة SVG، وتطبيقات الويب. أنشئ محتوى بصريًا غنيًا يمكن للمستخدمين التفاعل معه مباشرة.",
"tools.builtins.lobe-artifacts.title": "القطع الفنية",
-2
View File
@@ -12,7 +12,6 @@
"table.columns.spend": "الاعتمادات",
"table.columns.startTime": "تاريخ الإنشاء",
"table.columns.totalTokens": "استخدام الرموز",
"table.columns.trigger.enums.agent_signal": "إشارة الوكيل",
"table.columns.trigger.enums.api": "استدعاء API",
"table.columns.trigger.enums.bot": "رسالة بوت",
"table.columns.trigger.enums.chat": "رسالة دردشة",
@@ -24,7 +23,6 @@
"table.columns.trigger.enums.semantic_search": "بحث المعرفة",
"table.columns.trigger.enums.topic": "ملخص الموضوع",
"table.columns.trigger.enums.video": "توليد الفيديو",
"table.columns.trigger.enums.visual_analysis": "التحليل البصري",
"table.columns.trigger.title": "المشغل",
"table.columns.type.enums.chat": "توليد نصوص",
"table.columns.type.enums.embedding": "تضمين",

Some files were not shown because too many files have changed in this diff Show More