Commit Graph

6 Commits

Author SHA1 Message Date
AmAzing- fba5305562 ✨ feat(heterogeneous-agent): expand LobeHub provider support (#18785) 2026-08-29 09:54:15 +08:00
Rdmclin2 3ea7afd5d8 ✨ feat(openapi): generate openapi.yml from routes via hono-openapi (#17944)
* ✨ feat(openapi): generate openapi.yml from routes via hono-openapi

- add src/common/validator.ts: drop-in zValidator built on hono-openapi so
  every request schema registers into the spec while keeping the exact
  @hono/zod-validator 400 response shape
- describe the four validator-less routes (users/me, agent-groups list,
  file upload, batch upload incl. multipart bodies) and /health
- add scripts/generate-openapi.ts: runtime spec generation with
  route-vs-spec parity check, --check mode for CI, placeholder responses
- commit the generated openapi.yml (79 operations / 38 paths) and guard
  it with scripts/generate-openapi.test.ts
- ignore the generated file in eslint/prettier so formatters don't fight
  the generator output

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

* ✨ feat(openapi): serve API docs at /api/v1/docs via Scalar

- extract spec assembly into src/spec.ts, shared by the generator script
  and the new runtime endpoint so both always emit the same document
- GET /api/v1/openapi.json: build spec from live routes on first request,
  cached in memory
- GET /api/v1/docs: Scalar interactive reference reading that endpoint
- exempt the two docs routes from the generator parity check (real
  endpoints, deliberately not part of the described API surface)

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

* 💄 style(openapi): match docs site theme to the app's neutral monochrome style

- add src/docs-theme.ts: Scalar CSS variable overrides — black accent on
  light, white accent on true-black dark, antd system font stack
- theme: 'none' so the runtime bundle doesn't inject its default theme
  stylesheet after our customCss (which silently overrode every variable)
- reuse the app favicon

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

* 🌐 feat(openapi): localize docs UI following the app's language preference

Resolve the Scalar UI locale per request with the same priority the main
app uses (?hl query > LOBE_LOCALE cookie > Accept-Language), mapped to
Scalar's built-in translations (zh-CN, de, fr, es, ru, ar; zh-* all map
to zh-CN). English stays the default for unsupported locales.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 22:48:08 -07:00
Arvin Xu 20238b7b02 ⬆️ refactor: upgrade Zod to v4 (#16998)
* ⬆️ chore: upgrade Zod to v4

* ⬆️ chore: align drizzle-zod with Zod 4

* 🧰 chore(agent-testing): make verify runs lifecycle-safe

* ✅ test: align Zod 4 validation expectations

* ✅ test: use a valid tracing UUID
2026-07-11 15:09:20 +08:00
YuTengjing be0255b746 🔨 chore: update dependency baseline (#16465)
* 🔨 chore: update dependency baseline

* 🔨 chore(cli): update dependency baseline

* 🔨 chore(desktop): update dependency baseline

* 🔨 chore: fix dependency baseline blockers

* 🔨 chore: update TypeScript and Next baseline
2026-06-30 23:18:08 +08:00
Arvin Xu b4624e6515 🔨 chore: add Response API support (#12918)
* add response api framework

* finish response api structure

* finish response api structure

* ✨ feat: implement basic text generation for Response API (LOBE-5858)

- Add instructions extraction from system/developer input messages
- Add instructions param to ExecAgentParams, append to agent systemRole
- Implement extractPrompt, extractAssistantContent, extractUsage in ResponsesService
- Wire up execAgent + executeSync flow for non-streaming and streaming
- Add logprobs field to output_text content parts for schema compliance
- Fix truncation field to output string enum instead of object

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

* ✨ feat: implement real token-level streaming for Response API (LOBE-5859)

- Replace fake streaming (executeSync → emit events) with real streaming
- Subscribe to InMemoryStreamEventManager for live stream_chunk events
- Run executeSync in background, convert text chunks to output_text.delta SSE events
- Add missing schema fields: item_id on content_part/text events, logprobs on delta/done events
- Fix content_part.added/done to include item_id per OpenResponses spec

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

* ✨ feat: implement tool calling output extraction for Response API (LOBE-5860)

- Add extractOutputItems to convert AgentState messages to OpenResponses output items
- Extract assistant tool_calls → function_call output items
- Extract tool result messages → function_call_output output items
- Skip message items for assistant messages that have tool_calls (avoid duplicates)
- Add status field to function_call_output items per OpenResponses spec
- Update FunctionCallOutputItemSchema with optional status field
- Output array reflects execution order: function_call → function_call_output → message

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

* ✨ feat: implement multi-turn conversations via previous_response_id (LOBE-5861)

Encode topicId in response.id to enable stateless multi-turn conversation
chaining. When previous_response_id is provided, extract topicId and pass
to execAgent via appContext, which automatically loads history messages.

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

* 🐛 fix: add missing type fields for OpenResponses compliance (logprobs, item_id, input_tokens_details)

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 10:39:08 +08:00
Zephyr 81d25bf124 ✨ feat: add v1 api (#12758)
* ✨ feat(openapi): add API key hash support for secure storage

* ✨ feat(openapi): enhance message translation and knowledge base functionality

- Added MessageTranslationController and associated routes for managing message translations, including fetching, creating, updating, and deleting translations.
- Introduced KnowledgeBaseController with routes for CRUD operations on knowledge bases, including file management and access control.
- Updated existing message and translation routes to improve structure and naming consistency.
- Refactored related services and types to support new features and ensure type safety.

This update enhances the API's capabilities for handling message translations and knowledge base management, improving overall functionality and user experience.

* fix: allow OWNER scope to list agents in agents route

- Add OWNER scope to AGENT_READ permission check
- Aligns list behavior with AgentService.queryAgents ownership filter
- Allows owner-scoped users to list their own agents

* 🔧 refactor(rbac): improve import structure in rbac.ts

- Changed import statements to separate type imports from regular imports for better clarity and organization.
- This refactor enhances code readability and maintains consistency in the import structure.

* fix: 修复 chunk 服务与 async router 的循环依赖

- 将 createAsyncCaller 的静态导入改为动态导入 (await import)
- 打破 file.ts -> chunk/index.ts -> async/index.ts 的循环依赖链
- 使用 --skip-dynamic-imports 参数的 dpdm 验证循环依赖已解决

* 🐛 fix: resolve CI failures

* test: 补充 apiKey、KeyVaultsEncrypt、ChunkService 单测至 100% 覆盖率

- test(database): 补充 apiKey.ts query() 解密失败分支测试
- test(server): 补充 KeyVaultsEncrypt 非法密钥/密文格式 getUserKeyVaults 测试
- test(server): 新增 ChunkService 完整测试覆盖异步任务创建/触发/失败回写

所有新增测试通过 (46/46),目标文件覆盖率均达 100%
2026-03-10 01:00:36 +08:00