Fix/provider reasoning intensity xhigh - #84
Closed
deepagent-ai wants to merge 32 commits into
Closed
Conversation
**问题**
1. Anthropic fable5 等模型走 @ai-sdk/openai-compatible 网关时仍只有 high(不含 xhigh),
因为该路径只看 GPT5_FAMILY_RE,不处理 Claude 模型。
2. OpenAI gpt-5.x 在 @ai-sdk/openai-compatible 路径多出 "none" 档位,
该档位是 Responses API 专属,compatible 端点不支持(会返回 400)。
3. azure test 因前序测试遗留 AgentGateway.configure({ enabled: true }) 导致
renderPlanStatus → planStoreRoot 抛出"configureRoot not called"。
**修复**
- @ai-sdk/openai-compatible case:
- 新增 Claude 模型分支:api.id 含 "claude" 时,使用 anthropicAdaptiveEfforts
返回的档位集(含 xhigh)以 reasoningEffort 格式暴露给网关转发。
- GPT-5 分支:过滤掉 "none" 和 "minimal"(Responses API 专属档位)。
- azure test:在 LLMRequestPrep.prepare 前加 AgentGateway.configure({ enabled: false })。
**测试**
- 更新 gpt-5.6-sol 测试:期望 ["low","medium","high","xhigh"](不含 none)。
- 新增 claude-fable-5 via openai-compatible 测试:期望 ["low","medium","high","xhigh","max"]。
- 262/262 通过,turbo typecheck 15/15 全绿。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
**问题** 两个子agent在生产环境中同时踩中两个 bug: 1. researcher子agent("盘点DTK/gfx936可用算子")无法退出循环推理 — 循环死锁 2. 另一个子agent("研究P5-2目标算子")异常中断无进一步反应 **根因分析** 两个 bug 均发生在 runLoop() 的 StructuredOutput 路径上,该路径仅在 subagent + json_schema format 组合下激活(主agent不触发): Bug 1 — 无限循环死锁: - researcher/reviewer 子agent 自动挂载 ResearchResult/ReviewResult schema (DEFAULT_OUTPUT_SCHEMA_BY_AGENT),设 toolChoice: "required" - 模型在扩展思考(xhigh reasoning)阶段猜测错误字段名 ("summary/key_findings" 而非真实的 "module/mechanism/keyFiles") - AI SDK 在调用 execute() 前做 schema 校验 → 校验失败 → onSuccess 从不触发 → structured 永远是 undefined - 退出条件 (structured !== undefined) 永远为 false - finish === "tool-calls"(模型确实调了工具),StructuredOutputError 分支 (finished && !handle.message.error) 也永远为 false - 结果:while(true) 死循环。retryCount 字段存在但从未被消费。 Bug 2 — 异常中断: - 当模型直接以文本结束(不调工具)时走 StructuredOutputError 路径, result.info.structured 为 undefined,task.ts 回退到 findLast(text), 返回空/无意义结果 → 父agent收到空结果后停止响应。 **修复(P0+P1)** P1 — schema 字段注入系统提示(防止模型猜错字段): - 将 STRUCTURED_OUTPUT_SYSTEM_PROMPT 常量改为 buildStructuredOutputSystemPrompt(schema) 函数 - 将 schema 的顶层字段名(如 module, mechanism, keyFiles, interfaces, risks, openQuestions)注入系统提示,确保模型在扩展思考阶段就能看到 正确字段名,不依赖工具定义 P0 — retryCount 截断循环(消费之前一直忽略的 retryCount 字段): - 在 runLoop() 中新增 structuredFailedAttempts 计数器 - 当 format.type === "json_schema" 且 finish === "tool-calls" 且 structured === undefined 时,说明 StructuredOutput 调用失败(schema 校验拒绝),递增计数器 - 达到 retryCount(默认2)后: - 设置 StructuredOutputError(含已尝试次数和字段列表) - 记录 warn 日志 - 返回 "break" 终止循环 - 在截断前注入 synthetic 纠错提示,给模型一次看到正确字段名后重试的机会 **测试** - 新增 buildStructuredOutputSystemPrompt 测试(4例):字段注入/无属性/空schema/不泄露description - 新增 extractSchemaTopLevelFields 测试(3例):正常/无属性/null - 全套 structured-output.test.ts 37/37 通过 - session/agent/tool 全套 1052/1064 通过(1 fail 为预存在网络连接失败,与本次无关) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
由子agent代码审核发现,commit 221d8611 存在3个真实缺陷:
**Bug B1(严重)— 计数器误触发**
structuredFailedAttempts 对任何 finish=tool-calls 的步骤无差别计数,
包括 bash/read/write 等与 StructuredOutput 无关的工具调用。
默认 retryCount=2 时,任何需要2步以上研究工具的子agent都会
在 StructuredOutput 被调用前就命中上限报错退出。
修复:重新读取当前轮次的 assistant message parts,仅在
parts 中确实存在 tool === "StructuredOutput" 的调用时才计数。
**Bug B2(中等)— 纠错文本注入到 assistant 消息**
correction text 通过 sessions.updatePart({ messageID: handle.message.id })
注入到当前助手消息。toModelMessagesEffect 对 assistant text parts
没有 synthetic 过滤,该文本会以模型自己说过的话出现在下一轮
模型上下文中——模型对自身输出的服从性远低于用户消息,纠错效果失效。
修复:改用 injectTailReminder(sessionID, ...) 生成 user 侧 synthetic
消息,与所有其他提示注入路径一致。
**Bug B3(中等)— StructuredOutputError 在 task.ts 被静默丢弃**
retry cap 触发后 handle.message.error 被设为 StructuredOutputError,
但 task.ts runTaskInner 只检查 result.info.structured,从不检查
result.info.error,错误被静默丢弃,父 agent 收到空字符串并无失败指示。
修复:在 structured 检查后追加 error 检查:若 msgError 是
StructuredOutputError,通过 Effect.fail 向上传播错误,让 task
工具的错误路径正确处理并通知父 agent。
测试:structured-output 37/37 + orchestration-schema 15/15,typecheck 通过
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…le task_status+task_read
docs/4.0.4_r1.md §4 Phase 1 完整实施。
**U1 — StructuredOutputError 加入 child session ID**
task.ts L3 路径:StructuredOutput 失败时错误文本从
"StructuredOutput failed (N attempt(s)): ..."
改为
"StructuredOutput failed (N attempt(s)): ... Partial research is preserved
in subagent session ses_xxx. Call task_read({ task_id: "ses_xxx" }) before
retrying or duplicating the task."
父 Agent 不再只看到失败消息,而是直接得到恢复指针。
**§4.3 — 子Agent interrupted 状态合同**
AttemptBundle 接口 + 两个 markFinished 实现同步扩展:
- 新状态:"interrupted"(人类主动打断、保留成果)
- 新 reason 字段:"human" | "parent_interrupted" | "timeout" | "takeover" | "runtime_error"
- 旧 finished:true + state 的 compat 读取路径不变
**§4.3/4.6 — cancelled → interrupted + recovery pointer**
两处 "Task cancelled" 改为 interrupted 语义:
1. driveForeground block2 路径(outcome.kind === "cancelled")
- markFinished("interrupted", "human")
- teardownWorktree(false)(保留 worktree,不强制删除)
- 错误文本:"Task interrupted by the user. Partial work is preserved in ses_xxx.
Call task_read({ task_id: "ses_xxx" }) before retrying."
2. 非-block2 前台路径(result?.status === "cancelled")
- 同上,使用 nextSession.id
**§4.4 — Durable task_status**
task_status.ts 全部重写:
- 权威层:Session.children(parentID) — DB 持久记录,进程重启后仍可用
- 叠加层:BackgroundJob.list() — 当前进程实时运行状态(advisory only)
- 输出包含 child session ID、durable state、耗时
- "interrupted" 状态附带 task_read recovery hint
- 历史数据兼容:没有 subagent metadata 的子会话标为 "unknown",不伪装 running
**§4.5 — 新增 task_read 工具**
packages/deepagent-code/src/tool/task_read.ts:
- 参数:task_id、limit(默认20,最大100)、before(分页 cursor)
- 安全边界:仅允许读取 child.parentID === ctx.sessionID 的直接子会话
- 不读取进程内 BackgroundJob,直接读 Session.messages(durable)
- 输出格式:`<task_transcript id="..." state="...">` XML 标签,含 tool result / interruption 标记
- 截断时附加 task_id 和下一页 cursor
- 不暴露 reasoning 内容(synthetic + ignored parts 过滤)
**registry.ts**
task_read 以 task 权限同级(无额外 flag,默认可用)注册到 builtin 工具列表。
测试:task.test.ts + task-concurrency.test.ts 31/31 通过,typecheck 全绿
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
根因:应用重启后路由从 "/" (Home) 开始,无自动导航逻辑。 TabsProvider 的 persisted store 已保存历史 tab 状态,但没有 代码在启动时消费它来恢复导航。 修复:在 RouterRoot 加入 createEffect,当 tabs.ready() 且 location.pathname === "/" 时,直接 navigate 到 tabs.store[0] (最近使用的会话),复现之前"sidecar 启动完成立即显示对话框"的体验。 行为: - 有历史 tab:重启直接恢复到最近会话 - 无历史 tab(全新安装):保持 Home 页面不变 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
实施 docs/4.0.4_r1.md §3(Phase 2): 1. **API 层(oversight.api.ts)**: - OversightTraceNode 新增 sessionID 字段支持反向选择 - recordHumanTakeover 接收可选 sessionID 参数 2. **Oversight Dashboard(oversight-dashboard.tsx)**: - 新增 OversightDashboardProps:selectedSessionID + onSessionSelect - takeover 自动携带选中的 session ID - rollback 输入预填选中的 session ID(可覆盖) - trace 节点支持反向选择(点击跳转到对应子Agent) 3. **子Agent面板(side-panel-subagents.tsx)**: - 新增 selectedSessionID 状态(auto-select: running → interrupted → 最近) - 点击行选择监督对象,[打开]按钮导航到完整会话 - capability-gated:v4MultiAgentRuntime ON 时嵌入 OversightDashboard - 新增 interrupted 状态识别 4. **右侧面板(session-side-panel.tsx)**: - 移除独立的 oversight panel entry、import、Match case - 移除 oversight capability 检查和 approvals resource - badge 合并:subagents = running + interrupted 总数 - 移除未使用的 useSDK、fetchCapabilities、createResource 5. **持久化迁移(layout.tsx)**: - rightPanelMode 读取时自动映射 "oversight" → "subagents" - SessionView 类型保留 "oversight" 仅用于向后兼容 **技术要点**: - 单一监督入口,选中态驱动 takeover/rollback/trace 目标 - capability 关闭时只隐藏 workspace 级功能,保留基础列表 - rail badge 覆盖所有需要注意的状态(§3.5) - 旧 oversight 持久化状态无缝迁移,用户无感知 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- terminal.tsx: 新增 TerminalHostID 类型、BottomTerminalProvider/SideTerminalProvider
组件和 useTerminalHosts() API;TerminalProvider 内部创建两套独立
createWorkspaceTerminalSession(bottom/side),共享同一 PTY 服务运行时。
useTerminal() 现从 TerminalHostContext 读取,必须在 Provider 内部使用。
- terminal-panel.tsx: 外层包裹 <BottomTerminalProvider>;删除移到右侧栏按钮;
terminalVisible 只检查底栏 bottom.opened()+activeView。
- side-panel-terminal.tsx: 外层包裹 <SideTerminalProvider>;删除 SidePanelDockHeader
中移到底栏按钮;useTerminalLifecycle 绑定 side host;terminalReady 不再依赖
dock.location("terminal")。
- session-side-panel.tsx: terminal 从 DOCK_PANEL_MODES 移出,改为 side-native。
railItems 不再以 dock.location 过滤 terminal(始终显示)。openPanel("terminal")
负责懒创建第一个 side PTY(hosts.side.all().length === 0 时 new()),然后
open("terminal");不再调用 panel.toggle()。
- session-header.tsx: useTerminalHosts 替换 useTerminal;terminalOpen/toggleTerminal
只操作 bottom host;删除 panel.location("terminal")==="side" 分支逻辑。
- use-session-commands.tsx: openTerminal → hosts.bottom.new();terminal.split/
closePane/focus 系列命令绑定 terminalHosts.bottom;删除 terminal move-to-side/
move-to-bottom 视图命令;保留 panel.terminal.show 快捷操作。
- session.tsx: useTerminalHosts 替换 useTerminal;keydown 路由分别读
hosts.bottom.active() / hosts.side.active()。
- layout.tsx: dock.location("terminal") 强制返回 "bottom"(忽略已存储的 "side"
配置避免不可达);move()/setLocation() 对 terminal 为 no-op。
迁移:已有 terminal tree 归入 bottom host;side host 初始为空。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
问题1 — 列出文件失败: Phase 4(listener-ready即发送credentials)与 eeb79a70(立即恢复上次 tab)叠加产生竞态:app启动后立即导航到上次项目并触发文件列表请求, 而此时sidecar可能仍在初始化中,导致"列出文件失败"toast。 问题2 — 用户需求: 将启动导航从"恢复上次tab"改为"打开左栏排序第一个项目" (即按 time.updated 降序排列的最近更新项目)。 修复: 1. RouterRoot 引入 useServerSync(),把 createEffect 的触发条件 从 tabs.ready() 改为 sync.ready(sync成功表示server已响应请求) 2. 导航目标从 tabs.store[0](上次tab)改为 sync.data.project 排序后第一个项目的 /:dir/session 路径 3. 无项目时保持在 Home 页面不导航(不崩溃) 两个修复原子化:等待 sync.ready 既确保server就绪(修复文件列表), 又天然获得了项目数据(支持导航到第一个项目)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
根因:layout.tsx:2586 的 <Show when={!autoselecting.loading}> 把整个
SessionRoute 屏蔽在一个空白 div 后面,直到 AsyncStorage IPC 完成
(ready.promise) + layout context 初始化完成 (layout.ready.promise) +
autoselect 逻辑执行完毕,右侧主内容区才会出现。
这是"D 图标消失后左侧栏可见,但右侧栏长时间空白"的直接原因。
修复:移除该 Show 门控,让 props.children (SessionRoute) 立即渲染。
autoselecting resource 依然在后台执行自动导航逻辑,但不再阻塞渲染。
SessionRoute 的 loading state 在数据到达前正常显示(而非完全空白)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1. 左侧栏默认展开 (layout.tsx) 将 sidebar.opened 默认值从 false 改为 true。 右侧栏和底栏保持默认关闭不变。 存量用户使用各自的持久化状态,不受影响。 2. 导航直达最近会话 (app.tsx) RouterRoot 在 sync.ready 后,从 tabs.store 中查找 第一个项目的上次 tab;找到则导航到 /:dir/session/:id (直接打开对话),找不到则退化为 /:dir/session(会话列表)。 解决了之前只导航到项目页还需再点一次才能看到对话的问题。 3. Session 组件预加载 (app.tsx) tabs.ready() 后立即调用 Session.preload(),在 bootstrap API 请求期间并行触发动态 import,消除路由激活时的模块 加载延迟(~50-150ms)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
根因分析: Phase 4 (c87008a9) 把 Deferred.succeed(serverReady) 提前到 health.wait 之前执行,初衷是加快首屏显示。但这打破了 ConnectionGate 注释中明确的语义 约定——"Desktop sidecars enter the provider only after their main-process health check"。 提前交付 credentials 引发竞态: 1. Renderer 在 listener-ready 时立即收到 sidecar credentials 2. 若用户本地曾保存过 Server Edition HTTP URL,effectiveDefaultServer() 会在 sidecar 加入 servers() 之前先渲染 HTTP 类型的连接 3. ConnectionGate 对该 HTTP 连接做健康检查 → 超时/失败 4. 显示"Local Server 断联"状态,UI 卡在该状态不恢复 server.log 显示 sidecar 本身完全正常(只有 SQLite 实验性警告), renderer.log 的 DND 警告是预存在的 dnd-kit 行为,两者均非根因。 修复:恢复"先健康检查再交付 credentials"的原始顺序,同时把超时从 30 秒降至 15 秒(正常启动 health check 仅需 ~100-300 ms,15 秒 足够覆盖任何合理的慢启动,失败时等待时间减半)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Effect 4.0.0-beta.74 无 orElse,应用直接崩溃报 'TypeError: Effect.orElse is not a function'。 改用 Effect.ignore(在 tapError 记录错误后丢弃 failure)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
还原以下4个 commit: - 5ac995f9 侧栏默认展开+直达最近会话+Session预加载 - 21945044 移除 autoselecting 渲染门控 - 1a7d7ffd sync.ready 后导航到第一个项目 - eeb79a70 启动时自动恢复上次 tab 原因:以上改动导致 Session 视图在 TerminalProvider (Phase 3) 完全初始化之前就挂载,引发 SolidJS 静默错误 + JavaScript 事件循环阻塞,表现为:server 状态点永远不变绿、左侧栏点击 无任何反应。 Phase 3 的 TerminalProvider 双 host 初始化需要在 SessionProviders 完全就绪后才安全,autoselecting render gate 是保护这个时序的 关键屏障,不能在 Phase 3 兼容性验证前移除。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
根因:layout.tsx 的 <Show when={!autoselecting.loading}> 把整个
SessionRoute 卡在一个空白 div 后面,直到 AsyncStorage IPC +
layout.ready.promise + navigateToProject HTTP 调用全部完成(~15s)。
之前一次尝试(21945044)去掉此门控后冻结的原因:
RouterRoot 导航到 /:dir/session/:id1,autoselecting 也导航到
/:dir/session/:id2,两者 session ID 不同,导致 SessionProviders
快速 unmount/remount,在 Phase 3 TerminalProvider 初始化期间
引发状态损坏。
本次修复:
1. 去掉 autoselecting 渲染门控(右侧栏立即可见)
2. RouterRoot 只导航到 /:dir/session(不带具体 session ID),
将具体 session 的选择完全交给 autoselecting 处理。
3. 两个导航不再冲突:RouterRoot 做到 project 级别,
autoselecting 做到 session 级别,路径不同,无 remount。
结果:用户看到侧栏后,右侧栏同步出现(无门控阻塞),
autoselecting 在后台选好具体 session。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
opencode 的关键优势:用本地持久化 tab store(tabs.ready()) 驱动首帧导航,不等任何 HTTP 调用。我们之前用 sync.ready (bootstrapGlobal 4个 API 请求全部完成)才触发导航,这正是 左侧栏延迟的根本来源。 修复:RouterRoot 改为 tabs.ready() 即触发——tabs 数据从磁盘 IPC 读取,极快(与 sidecar 无关)。导航目标只到 /:dir/session (不带具体 session ID),由 autoselecting 在后台完成 session 选择, 避免与其冲突。 效果:D 消失后,左侧栏和右侧栏应同步出现(右侧栏由 e8dc87b1 的 autoselecting 门控移除保障),不再需要等待服务端 bootstrap。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
左侧栏 sidebar.opened 改为 true(对齐用户要求)。 底栏 terminal.opened、右侧栏 rightPanelMode 已经是 false/undefined, 保持不变,后台加载。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PRAGMA wal_checkpoint(PASSIVE) 每次启动都同步执行,直接阻塞数据库 层初始化,对大型 WAL 文件可额外增加 1-3 秒延迟,而且 wal_checkpoint 的结果完全被丢弃——它只是空转地阻塞了 Server.listen() 的完成。 SQLite 内置 auto-checkpoint 机制(wal_autocheckpoint 默认 1000 页), 会在后台自动完成 WAL 合并,无需手动在启动时执行。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
将 `await import("virtual:deepagent-code-server")` 从 start()
函数内部提出,改为进程启动时立即触发(模块顶层)。
原理:main 进程在发 {type:"start"} 消息前需要完成
loadShellEnv + createMainWindow(~1-2s),这段时间 sidecar 进程
是空闲的。现在把这段时间用来解析 + JIT 编译 server bundle,
让 import 与 main 进程的准备工作并行执行,而不是串行等待。
效果:start() 收到命令时 import 通常已经完成,await 几乎
是立即返回,节省 1-2s 启动时间。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reconcile V4-owned groups against runtime flags and remove registered groups when the runtime scope releases, preventing stale offline deliveries after a feature is disabled. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Recognize durable interrupted subagent metadata in the session UI and pass task read cursors through to message storage so older history remains reachable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Persist the selected tab separately from ordering and wait for its available server before restoring its directory. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- 项目切换:TerminalProvider.onCleanup 不再调用 clear() 删除服务端 PTY,改为将 PTY 快照(ID、pane 树、焦点)存入模块级缓存;返回 该项目时从缓存恢复,xterm 组件自动重连已有 PTY。 只有用户显式关闭终端 tab 时才调用 pty.remove。 - 对话切换:commitPanel 现在同步更新 store.terminal.opened 项目级 标志,使 bottomPanel memo 的回退逻辑(store.terminal?.opened) 在切到未保存状态的新对话时仍保持面板可见。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lation idempotency Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nds, remote transport, headless entry hardening (#81) ### Issue for this PR Closes # ### Type of change - [ ] Bug fix - [x] New feature - [ ] Refactor / code improvement - [ ] Documentation ### What does this PR do? This PR prepares the new CLI (`packages/cli`, `dacode`) and the headless server to act as a client/data-plane for DeepAgent Server Edition (design: server-v1 §11/§13/§20). The CLI now connects to a gateway with JWT auth and routes workspace traffic through the `/w/:workspaceId` transparent proxy instead of a local daemon. **CLI changes:** - `dacode login [gateway] [--email --password]` / `logout` – authenticate via `POST /control/v1/auth/login`, store state in `~/.deepagent/code/state/server-mode.json` (0600, atomic temp+rename). Flags optional; fallback to interactive prompts. Refresh token read from response body, with `Set-Cookie` as fallback. - `dacode workspace list` / `dacode workspace use <id>` – list gateway workspaces and pin a selection; remote base URL becomes `{gateway}/w/{workspaceId}`. - The `Connection` service switches to remote transport when server-mode is active; otherwise uses the existing local daemon (unchanged behavior). - Remote transport is a fetch wrapper that injects `Authorization: Bearer` and, on 401, performs a single-flight token refresh with one retry. Since the TUI already accepts a custom `fetch`, all TUI/SDK traffic (including SSE) gets auth + reconnect without any changes to `packages/tui`. - `DEEPAGENT_GATEWAY_URL` pins the gateway (server-v1 §20.3 auto-switch); a mismatch with stored login produces a clear error suggesting `dacode login <url>`. **Server changes (`packages/deepagent-code`):** - Add explicit `"./server"` subpath export so `import { listen, openapi } from "deepagent-code/server"` resolves as documented for the workspace-agent. - `/global/capabilities` gains an optional `commit` field from `DEEPAGENT_CODE_COMMIT` (injected by CI for version-checking, §13.3). Omitted in local builds; optional in schema for backward compatibility. - `DEEPAGENT_SERVER_MODE=true` makes `Auth.set`/`Auth.remove` fail with a clear error – in gateway-managed containers, provider keys come via env and must not persist to volume (§20.4). Reads (including `DEEPAGENT_CODE_AUTH_CONTENT`) are unaffected. > **Note:** The gateway itself (`deepagent-code-server` repo) is not implemented yet; the refresh-cookie contract may need a follow-up once the real gateway exists. ### How did you verify your code works? - `bun typecheck` passes for `packages/cli`, `packages/core`, `packages/deepagent-code`. - End-to-end against a mock gateway (`Bun.serve` implementing auth endpoints, workspace listing, and proxy paths): covered login via args/env, state file permissions, workspace list/use with expired token refresh, remote transport URL and auth injection, logout, and gateway mismatch errors. - Server tests: started the legacy server via the new subpath export, confirmed `/global/capabilities` returns the injected commit and `openapi()` works; `Auth.set`/`Auth.remove` are blocked under `DEEPAGENT_SERVER_MODE=true`; without it `auth.json` is written with mode 600. - Existing related suites pass: `test/auth/auth.test.ts`, `test/server/httpapi-global.test.ts`, `test/server/httpapi-public-openapi.test.ts`. (`test/server/httpapi-listen.test.ts` has PTY failures that reproduce identically on the base commit in this environment.) ### Screenshots / recordings _No UI changes._ ### Checklist - [x] I have tested my changes locally - [x] I have not included unrelated changes in this PR --------- Co-authored-by: deepagent-ai <jamessmithm539@gmail.com>
restore() 恢复的 PTY 标记 restored:true,Terminal 组件在 xterm 初始化完成后立即 markReady(),隐藏'连接中'遮罩;WebSocket 仍在后台 建立,连接前键入的内容缓冲在 inputBuffer,socket 就绪后一次性 flush。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #
Type of change
What does this PR do?
Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.