Commit Graph

36 Commits

Author SHA1 Message Date
Pine 512414401c 子智能体前端 UI 接入:会话 source 透传 + 会话列表 subagent 独立分组;create_chat 端点透传 source/group/parent/root 2026-09-04 21:00:03 +08:00
Pine 3151198ebd 迁移上游子智能体功能线:ChatGroup 分组体系 + subagent_model 配置 + spawn 会话归属
- chats/models.py: SessionSource.subagent + ChatGroupKind/ChatGroup/default_chat_groups + ChatSpec 扩展 group_id/parent_session_id/root_session_id/last_finished_at + ChatsFile.groups
- chats/manager.py: group CRUD 方法(list/create/update/reorder/delete) + get_or_create_chat/create_chat 的 group 归属与校验
- chats/api.py: /chats/groups 端点(GET/POST/PUT order/PUT/DELETE)
- config.py+agents.py: AgentConfig.subagent_model 配置
- agent_management.py: _build_subagent_request_context 补 subagent_model→model_slot_override
- console.py: _chat_registration_fields 识别 spawn_subagent 请求并注册 subagent 会话
- constant.py: DEFAULT_SPAWN_FOREGROUND_TIMEOUT_SECONDS
- 前端 chat.ts: groups API 请求函数
2026-09-04 20:40:19 +08:00
Pine 9e273713a6 fix(agents): 删除降级仅限自建智能体,官方智能体受保护且 deletable=false
- 服务端删除 404(身份已不存在)时降级仅清理本地,但 pine_agents_official_ 前缀的官方智能体不降级,避免误删运营端维护的预置身份
- list 的 deletable 离线回退:官方预置智能体默认不可删(此前 fallback 为 True,前端会误显示删除按钮)
2026-09-04 17:49:00 +08:00
Pine 932fe54c16 fix(chat): 助手身份显示当前智能体名称/头像,无则回退云超服
问题:聊天区助手名称/头像沿用上游硬编码 nick='QwenPaw'、
avatar='/qwenpaw.png'。前者把当前智能体(如'小园')显示成了'QwenPaw';
后者资源未随迁移携带,dev 下实际返回 SPA index.html(头像渲染破损)。

修复:
- 前端 Chat 页:welcome.nick/avatar 改为解析当前智能体——名称取
  selectedAgent.name,头像取 selectedAgent.avatar;智能体无名称/头像时
  回退云超服品牌 BRAND.name / BRAND.assistantAvatar(/pineagents-icon.svg)。
- 支持智能体头像字段(端到端):后端 AgentProfileConfig.avatar、
  AgentSummary.avatar、agents list/create/update 透传、agent_sync
  IDENTITY_FIELDS 加 avatar(云超服身份同步);前端 AgentSummary/
  AgentProfileConfig/CreateAgentRequest 类型补 avatar。
- branding.ts 新增 assistantAvatar 品牌头像常量(替代缺失的 /qwenpaw.png)。

验证:后端重启后 /agents 返回 avatar 字段;/pineagents-icon.svg 200
image/svg+xml(原 /qwenpaw.png 实为 SPA fallback 破损);前端 tsc 0 错;
Chat/agents/constants 32 文件 322 测试全过。
2026-09-04 17:11:29 +08:00
Pine 70627c0484 fix(memory): 恢复 section 区分日记/知识库,修复合并回归
本地 workspace.py 的 /memory 端点在上游合并时丢失了 section 参数
(上游为 Literal[daily,digest]|None Query),AgentMdManager.list_memory_mds
也丢了 section 过滤与 _nested_root_to_exclude/_memory_root 助手。导致前端
Files 页'日记'(section=daily) 与'知识库'(section=digest) 两个 tab 都拿到
同一份 memory+digest 混合列表,日记里混入知识库文件,反之亦然。

修复:从上游完整恢复 section 语义——
- AgentMdManager:list_memory_mds(section) 按 section 限定 memory/ 或
  digest/ 根目录并排除嵌套目录;read/write_memory_md 增加可选 section 走
  明确的根目录;_memory_path_for_read_write 支持 section 优先路由;
  补回 _memory_root/_nested_root_to_exclude。
- workspace.py:GET/PUT /memory 与 /memory/{path} 增加
  section: Literal[daily,digest]|None = Query(None),透传给 manager。

验证:seed memory/daily-test.md + digest/wiki-test.md 后——
section=daily 仅返回 memory 文件;section=digest 仅返回 digest 文件;
无 section 返回合并列表(digest/ 前缀);section 读写落盘正确;测试文件已
清理;前端 tsc 0 错 + files-workspace 11 文件 61/61 通过;经 8093 代理
四个 tab 端到端返回真实数据。
2026-09-04 16:42:24 +08:00
Pine 44d78105a9 feat(files): 完整移植上游 Files 工作区文件操作 API(修正迁移偏差)
重新审查迁移逻辑后的修正:本地文件操作应以「上游 QwenPaw 为准」,
此前把本地后端误当云端、曾计划把前端重映射到云端 /code-files 是错误方向。

本提交:
- 新增 src/pineagents/services/workspace_files.py(上游 workspace_files 完整移植,
  唯一本地改动:跳过 macOS 自定义文件夹图标资源 Icon\r)
- workspace.py 移植 7 个上游端点:GET /tree、GET /file-metadata、
  GET/PUT /file-content(乐观并发 ETag)、GET /file-download、
  GET /html-file-uri、POST /file-upload(保留冲突策略 overwrite/skip/rename)
- agent_context.py 移植请求级项目目录解析:get_project_dir_for_request /
  get_project_dirs_for_request,按 X-Chat-Id / X-Session-Project-Dir 头解析
  会话级绑定目录;_resolve_files_root 支持 root=workspace|project|project:<path>,
  project:<path> 走目录身份成员校验(os.path.samefile),越权返回 403
- /workspace/watch 改为按 root+会话头解析监视目录(此前固定 agent coding dir)
- coding_project.py 追加上游命名别名 router /workspace/project-directory
  (与 /workspace/coding-project 同一批 handler),API 面与上游对齐,
  后续上游合并不会因命名差异 404

验证:curl 全链路通过——tree/metadata/content 读写/乐观并发 409/下载/HTML URI/
上传/workspace 根/越权 403/无效会话目录 400/未知 chat 404;后端重启干净。
2026-09-04 15:08:19 +08:00
Pine feb1192a5f fix(tools): skip macOS Icon\r resource + escape control chars in list_directory
- Skip the per-folder custom-icon resource "Icon\r" (Icon + CR) which
  macOS stores in every folder that ever had a custom icon. It does not
  start with a dot, so it slipped past the dotfile filter and showed up
  as a phantom "Icon" entry; agents trying to ls/stat it got
  'No such file or directory' and misreported healthy dirs as broken
  (observed on /Volumes/Pine/opt).
- Escape control chars (\x0d etc.) in displayed entry names so the model
  can see the real name instead of an invisible CR.
2026-09-04 14:49:57 +08:00
Pine 8ff6ab8763 feat(tools): register list_directory agent tool for coding mode
The coding-mode prompt already documents list_directory as a file-IO tool,
but no such tool was registered, so agents calling it got
ToolNotFoundError. Add a real list_directory tool to file_io.py:

- Mirrors upstream qwenpaw.services.workspace_files.list_directory semantics
  (skip dotfiles/.git/.venv/__pycache__/node_modules, dirs first).
- Relative paths resolve from the agent workspace (consistent with
  read_file/write_file/edit_file); absolute paths used as-is.
- Caps output at 200 entries (500 hard ceiling) with omission notice so
  huge directories don't flood context.
- Governance policy 'ListDirectory' (read-only, default allow); registered
  via agents/tools/__init__.py, auto-collected by tool_descriptor.
2026-09-04 14:42:42 +08:00
Pine 55f8d9f81f feat(workspace): port session project-dirs, fix 404s, add Tauri dir picker
C-port the upstream /chats/{id}/project-dirs feature so the chat-scoped
project directory binding is fully functional on the cloud backend:

- services/project_directory.py (new): lean cloud adaptation of the
  upstream module — normalize (dedupe/resolve/max 10), meta read for the
  persisted override, effective resolution (session > agent > workspace),
  nesting detection.
- chats/manager.py: set_session_project_dirs + get_session_project_dirs
  persist the override in ChatSpec.meta[runtime_context] under the lock
  (one-way migration: list supersedes legacy scalar).
- chats/api.py: GET/PUT/DELETE /{chat_id}/project-dirs + deprecated
  /{chat_id}/project-dir views, with 422 on missing dirs and response
  models matching the merged frontend (exists/nested_with/is_workspace).
- runtime/builder.py: session override feeds the per-turn coding project
  dir (weakest source; fork/ACP still win), so bound directories actually
  take effect for the chat's tools.
- Fix A: frontend projectDirectoryApi paths /workspace/project-directory*
  -> /workspace/coding-project* (cloud backend already exposes these).
- Fix B: add POST /workspace/coding-project/browse-dirs/create for the
  file-browser 'new folder' action (validated name, 409/403/500 mapping).
- Tauri system directory picker: 'Choose folder' button in the project
  directory panel calls the @tauri-apps/plugin-dialog native directory
  dialog (capability dialog:allow-open already granted), queueing the
  pick as a session binding or the agent draft; hidden outside the Tauri
  runtime; i18n across all 6 locales.

Verified: backend restart + curl (GET/PUT/DELETE project-dirs, deprecated
views, browse-dirs/create, 422/409/400 cases), dev-proxy end-to-end,
frontend tsc clean, vitest 25/25, production build 2m06s.
2026-09-04 14:30:32 +08:00
Pine 6932470658 fix(constant): 更新 DEMO_API_BASE_URL 为本地地址以便于开发调试 2026-09-04 00:06:32 +08:00
Pine 7225e37033 feat(pineagents): 添加分类参数以支持精确过滤技能市场搜索结果 2026-09-03 23:26:33 +08:00
Pine 84f34f8e21 feat(apps): 云超服市场商品封面图(cover_url)支持
- 后端 _pineagents_live_plugin 映射 cover_url(server-core 商品封面)
- MarketPluginEntry 类型新增 cover_url
- AppMarket 市场卡片三种情况渲染:
  有封面 → 16:9 封面主视觉(替代图标位)
  无封面有图标 → 图标
  都没有 → 默认 glyph 占位
  封面/图标加载失败均回退下一级占位
2026-09-03 21:37:13 +08:00
Pine 3be0c2f16c fix(apps): 修复云超服市场单段 slug 商品下载链路
- 前端 buildMarketDownloadUrl:id 拆分不到 owner/name 两段时,
  不再产生 owner/undefined,统一按 pineagents/<id> 处理
- 后端 _fetch_market_bundle_bytes:owner/name 精确匹配失败后,
  回退按 name 单段精确匹配,兼容历史未补 owner 前缀的商品
  (如 creator、公众号爆款封面生成)

配套:server-core 侧已把存量单段 slug 数据规范化为 pineagents/<slug>
2026-09-03 20:28:09 +08:00
Pine 158582bc1a fix(apps): 修复云超服市场应用安装后无法打开、无法卸载
打开问题:
- 根因:前端 loadAllPlugins() 仅在启动时加载插件 bundle,安装新应用后
  路由未注册,AppCenter 打开显示 not loaded
- usePluginLoader 新增 loadPluginById(),按需加载单个应用 bundle
- AppMarket 安装成功后立即调用 loadPluginById 注册路由
- AppCenter 打开应用时若路由缺失自动尝试加载并给出可读提示

卸载问题:
- 根因:scoped id(@kmu/incubator 含 '/')无法在 URL 中表达,
  后端 uninstall_pawapp 直接拒绝含 '/' 的 id
- 后端新增 POST /pawapps/uninstall(body 传 app_id),优先走插件
  加载器卸载,fallback 按目录删除,并做 scoped id 路径穿越防护
- 前端 pawappApi.uninstall 改用 POST body
- fallback 目录扫描支持 scoped 命名空间(@scope/name 子目录)
2026-09-03 18:13:03 +08:00
Pine e90491cf20 feat: MQTT 凭证链路+登录态后端持久化+通讯录+好友私聊完善+官方智能体同步 2026-09-03 12:40:05 +08:00
Pine cf9679185e feat: 补充 IM 系统核心文件(沟通页+客服工作台+IM路由)
1. communication.ts: IM API 模块(会话/消息/好友/客服/知识库)
2. communicationStore.ts: IM 状态管理(MQTT 连接+消息收发)
3. useStartChat.ts: 发起聊天 Hook
4. CSWorkbench.tsx: 客服工作台(运营权限)
5. im.py: 后端 IM 路由中转
2026-09-03 10:30:35 +08:00
Pine e78fabf1f6 fix(desktop): 新增 /courses /cert/types /me/certs /hall/tasks/mine 转发路由;_app.py 优先注册 /api/hall/tasks/mine 避免参数路由抢先匹配 2026-09-02 18:58:23 +08:00
Pine 6a87496a4b fix: 统一桌面端登录与 token 管理逻辑,修复模型列表 401
- PineAgents provider base_url 改为动态使用 DEMO_API_BASE_URL(远程服务器)
- list_provider_info 支持从请求头透传 console 端 JWT,优先用于 /v1/models
- forward/forward_upload 未显式传 auth_header 时自动使用本地持久化 token
- auth_token_store 添加日志,便于排查 token 保存/加载问题
- fetch_models 超时增加到 15s,添加获取结果日志
2026-09-02 18:18:55 +08:00
Pine 9103465506 fix: PineAgents provider base_url 改为动态使用 OPC 服务端地址,修复桌面端模型列表为空
- base_url 从硬编码 http://127.0.0.1:8090/v1 改为 {DEMO_API_BASE_URL}/v1
- 桌面端连接远程服务器时,模型请求不再发到本地 8090
- fetch_models 超时从 5s 增加到 15s
- 添加模型获取日志,便于排查问题
2026-09-02 18:08:29 +08:00
Pine 2aeb656db0 fix(skill): 安装时过滤文件名式名称(SKILL.md),优先取 display_name/title 中文显示名 2026-09-02 15:06:50 +08:00
Pine b2c085a701 fix(plugins): discover_plugins 支持 scoped 命名空间(@scope/name)嵌套目录
根因:discover_plugins 只扫描插件目录的直接子目录 plugin.json,
scoped 插件安装在 @scope/name/ 下,直接子目录 @scope/ 没有
plugin.json 被跳过,导致重启后所有 scoped 插件(@kmu/incubator、
@pineagents/* 等)丢失。

修复:当直接子目录名以 @ 开头且无 plugin.json 时,递归扫描其
下一级子目录。提取 _discover_one / _load_manifest_static 复用。
2026-09-02 14:16:01 +08:00
Pine 0ff03c1d64 fix(frontend_plugin): 支持含斜杠的 scoped 插件 id 的静态文件服务
市场安装的 app/插件 id 可为 @scope/name 形式(如 @kmu/incubator)。
原路由 /{plugin_id}/files/{file_path:path} 会把 @kmu/incubator 按 '/' 拆段,
导致 get_loaded_plugin('@kmu') 未命中 → bundle 404 → 前端路由未注册 →
应用中心提示该应用尚未加载,请先从侧边栏打开一次后重试。

改为 /{rest:path} 捕获整个剩余路径,按 '/files/' 标记拆分 plugin_id 与 file_path,
兼容简单 id(qwenpaw-creator)与 scoped id(@kmu/incubator);
路径穿越防护仍由 serve_plugin_ui_file 的 is_relative_to 承担。
2026-09-01 20:36:24 +08:00
Pine c98899bcd4 fix(market): 修复桌面端云超服安装链路(技能 source_url 补全完整 bundle URL;插件安装对市场相对源内部直连下载,避免 HTTP 自请求环回超时) 2026-09-01 18:20:17 +08:00
Pine 65fa9b3a11 feat(task): 载体端任务管理页面(平台级任务+本载体下架/上架,不可编辑)+pineagents 转发
- console: Carrier/Tasks.tsx 新增载体端任务管理页(列表+下架/上架 Popconfirm,无编辑入口)
- builtinRoutes/builtinMenu: core.car.tasks 路由与菜单(任务管理,order 25)
- api/modules/auth.ts: getCarrierTasks/hideCarrierTask/unhideCarrierTask + CarrierTaskItem 类型
- pineagents opc.py: /carrier/tasks、/carrier/tasks/{id}/hide|unhide 纯转发
- 清理上轮遗留 unused import(HallTasks authApi、Dashboard Progress)
2026-09-01 14:44:21 +08:00
Pine aa79f0a4d6 fix(market): 清除技能/插件/官方市场演示数据残留,全部改走 server-core 真实接口
- 删除 _DEMO_SKILLS、_PINEAGENTS_DEMO_PLUGINS、_PINEAGENTS_DEMO_OFFICIAL_PLUGINS
- Operator Dashboard/DataStats 删除硬编码统计,改真实接口聚合
- 修复下载代理 httpx 未 follow 302;端到端验证三市场返回真实商品、下载 sha256 一致
2026-09-01 11:22:34 +08:00
Pine c82d4a47a9 feat(task): 任务系统统一合并到大厅,删除独立任务/独立社区
- 删除旧任务广场 /opc/square(TaskSquare.tsx)与独立社区 /opc/community 路由;社区保留为大厅 tab(OpcCommunityView)
- HallTasks 抢单/投标改走 hallApi(/hall/tasks/grab|bid);hall.ts 新增 grab/grab-by-code/bid/doing/complete/deliver/recommend
- MyTasks 改真实聚合展示(承接/投标、交付走 /hall/tasks/deliver)
- Dashboard activeTasks 适配真实任务状态(移除无真实来源的进度圆环)
- auth.ts 删除旧 /opc/tasks API(getOpcTasks/grabOpcTask/bidOpcTask/deliverOpcTask),OpcTask 类型扩展真实字段
- pineagents 新增 hall.py 转发 /hall/* 与 /community/* 到 server-core;删除 /opc/tasks 失效代理
- 演示数据清除(上一轮):技能/插件/官方市场改真实接口、Operator Dashboard/DataStats 去硬编码
2026-09-01 11:22:28 +08:00
Pine 8faa207ccb feat(console): 桌面端多轮功能更新(认证/品牌/多语言/算力中心/大厅细节) 2026-08-31 23:43:00 +08:00
Pine 213eb1c806 feat(market): 桌面端市场适配(云超服实时源 + 定价购买/小程序码支付/状态轮询/已购校验 + 安装包下载代理) 2026-08-31 23:42:53 +08:00
Pine 1dcb4816d8 chore(brand): 默认后端指向 opc.pinesound.cn + 更新品牌标识资源
Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-30 22:32:05 +08:00
Pine a610c22f45 feat(compute): 算力中心充值(小程序码支付)与转发端点
- PineAgents 供应商按登录态注入 JWT(登出移除)
- 本地后端新增充值转发(packages/orders/pay-params/status/orders)与算力余额路由
- console 充值弹窗:套餐/自定义金额→小程序码→轮询到账;余额卡加充值入口;i18n 文案

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-30 22:32:04 +08:00
Pine a88cfebf8a feat(auth-proxy): 补齐短信/扫码登录转发端点(send-code/phone-login/wx-qr/mp-qr等11个) + status透传login_modes + forward支持params 2026-08-28 17:40:55 +08:00
Pine eee2f6547b feat(pineagents): 模型静态展示目录(描述/价格/分类/标签) + ModelInfo 扩展
- ModelInfo 追加可选 description/price/category/tags(默认为空,不破坏现有构造,经
  model_dump + response_model 自动透传前端,无需改序列化)。
- 新增 providers/pineagents_catalog.py:按模型 id 的静态展示目录(覆盖 Qwen/DeepSeek/
  GLM/Kimi/MiniMax/MiMo/ModelScope 等) + enrich_catalog() 在拉取结果上回填;未命中
  优雅降级为仅名+能力标签,不修改调用参数。
- provider_manager.list_provider_info:pineagents 拉取成功后回填目录元数据。
- 新增 tests/test_pineagents_catalog.py(命中/免费/未命中/空/大小写),6 passed。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-25 18:03:18 +08:00
Pine c033e3f824 feat(opc): 算力中心 /opc/compute 转发 server-core(修复 base/模型/令牌)
- 新增 GET /opc/compute/{base,models,prices,tokens} + POST /opc/compute/tokens + DELETE /opc/compute/tokens/{id}
- 转发到 server-core(DEMO_API_BASE_URL) 并透传 JWT; 修复 OPC 桌面端算力中心页数据与令牌创建/删除(此前 404)
2026-08-25 14:03:40 +08:00
Pine 81d52ffee9 refactor(models): 删除 PineAgents 旧的硬编码模型提供逻辑(迁至算力中心)
- PROVIDER_PINEAGENTS models=[] 不再硬编码 DEEPSEEK_MODELS; 模型源=算力中心 admin 模型(fetch_models 拉 server-core /v1/models)
- DEEPSEEK_MODELS 仅保留给 DeepSeek 云供应商(仍保留); 云端/本地自定义供应商不动
- 与 list_provider_info 的 fetch_models 并存: 桌面端 PineAgents = admin 模型
2026-08-25 13:57:24 +08:00
Pine 2759e138b0 feat(models): 桌面端 pineagents 提供商动态拉取算力中心 admin 模型
- list_provider_info 对 pineagents 调 fetch_models()(server-core /v1/models=admin 模型), 成功替换其模型列表, 失败回退静态
- 桌面端模型源迁至算力中心(admin 模型), 不再展示硬编码 DEEPSEEK 4 个
2026-08-25 13:52:34 +08:00
Pine 96659759b0 feat: 智能体后端运行时(src/pineagents)
- Agent OS:agents 决策循环、runtime 编排、providers、governance/security/sandbox
- app 服务层(认证转发到 server-core)、channels 19 路频道、memory、plugins
2026-08-23 22:41:48 +08:00