Commit Graph

1216 Commits

Author SHA1 Message Date
Lyon 6ecfe015cf fix(web): ensure web deps installed before vite build in runtime (#768)
Co-authored-by: Codex <codex@local>
2026-06-03 17:28:30 +08:00
Lyon a78a4199a8 fix(web): use local node_modules/.bin/vite in dist-contract (#767)
Co-authored-by: Codex <codex@local>
2026-06-03 17:15:54 +08:00
Lyon 0d06a4c5fe fix(web): migrate Cloud Web from vanilla DOM to React + TypeScript + Vite (#756) (#764)
- Replace monolithic app.ts / app-conversation.ts / app-device-pod.ts /
  app-skills.ts / app-helpers.ts / app-session-tabs.ts / auth.ts and the
  364-line index.html with a Vite-built React + TypeScript SPA.
- New src/ module tree: main.tsx, App.tsx, components/{layout,auth,
  conversation,command-bar,device-pod,skills,settings,help},
  hooks/, services/api, services/auth, state, types, logic/ (pure
  helpers from the old tree), styles/.
- Pure-logic modules (composer-policy, code-agent-facts, code-agent-
  status, live-status, message-markdown, app-trace, app-session-tabs,
  runtime) move to src/logic/ with their tests preserved; tests still
  auto-discover.
- Build pipeline switches from Bun.build to Vite: vite.config.ts
  inlines everything into a single app.js + app-assets/ for the dist;
  scripts/dist-contract.ts now runs vite build and asserts the dist
  against a fresh build instead of comparing dist to source.
- scripts/check.ts now verifies the React entry, the mount-only
  index.html, Vite dist, the composer / session / device pod / skills
  / settings / help contracts, the React state shape, and the new
  test file locations. It also refuses to run if any legacy app-*.ts
  or auth.ts survives at the top level.
- New scripts/frontend-guard.ts enforces the 400-line migration target,
  refuses the legacy el map and document.getElementById markers,
  refuses to keep app-*.ts / auth.ts at the top level, and verifies
  the required module directory layout.
- Update scripts/src/dev-cloud-workbench-smoke-lib.mjs to read the new
  src/services/, src/logic/ paths and refresh cloudWebModuleSourceFiles.
- index.html is now a mount shell only (no login shell, no workbench
  shell, no device pod sidebar markup). React renders the full UI from
  src/main.tsx, satisfying the issue-756 migration goal of catching
  unclosed tags at the TypeScript/JSX compile step instead of relying
  on browser DOM healing.
- web:check (now: check + frontend-guard + tsc-check + bun test) is
  green: 51 pass / 0 fail, Vite build produces dist/app.js (379 kB)
  + dist/index.html + dist/app-assets/. Vite build is reproducible;
  dist freshness is verified against a fresh Vite build.
- Grandfathered pure-logic files (> 600 lines): src/logic/app-trace.ts
  (1367), src/logic/live-status.ts (1006), src/logic/code-agent-facts.ts
  (548), src/logic/code-agent-status.ts (572). Reason: each is a tested
  pure-logic classifier with a public contract consumed by both the
  CLI renderer and the Web renderer; splitting now would fork the
  public function shape across two PRs and the migration target is the
  React entry + module split, not a pure-logic refactor.

Refs #756. Closes #756 once merged + deployed to hwlab-v02.

Co-authored-by: Codex <codex@local>
2026-06-03 16:53:25 +08:00
Lyon 893f46bc03 fix(issue751): tighten DOM iterator + payloadError + WorkbenchSummary types (#763)
#751 第三轮推进到更紧的类型:
- app.ts 局部 const el 标 ElMap,让 el.gateStatusFilter / el.codeAgentTimeout
  等 HTMLSelectElement / HTMLButtonElement 子类型在本地 el 上也生效
- web-types.d.ts 加 WorkbenchRuntimePathShape / WorkbenchRuntimePathRow /
  WorkbenchCompactDetailsOptions / WorkbenchGateDiagnosticsRow,让
  codeAgentRuntimePathFromMessage / messageCompactDetails / gateDiagnostics.rows
  不再回退到 WorkbenchUnknown
- 7 个高发点 sed 批量加 <HTMLElement> 类型参数到 querySelectorAll /
  querySelector<HTMLElement>,让 list.dataset / tile.dataset 等访问合法
- event.target.closest 改 (event.target as HTMLElement).closest<HTMLElement>(...)
- ElMap.skillRefresh / skillUploadButton / commandClear 收紧 HTMLButtonElement
- agentErrorFromHttpResponse / failureMessage / classifyCodeAgentCompletion
  等返回类型精化(WorkbenchSummaryShape 加 title/status/replied/sourceKind 等)
- app-conversation.ts 内部 6 个函数(sessionSummaryTone / agentStatusLabel /
  agentStatusTone / sourceTitle / sourceFixtureTitle / textFallbackTitle / 等)
  加显式形参/返回类型
- 把 source 里的 : unknown / : unknown[] 全部改成 : WorkbenchUnknown(带索引
  签名),让 property access 在 tsc 下合法

web:check 55 pass / 0 fail;web:build 12 dist;tsc-check 仍守住 0 显式 any
硬 gate。residual 541 残错继续按 #751 后续 issue 跟踪。

Refs: pikasTech/HWLAB#751

Co-authored-by: Codex <codex@noreply.local>
2026-06-03 16:35:29 +08:00
Lyon cae2f1e71b Merge pull request #762 from pikasTech/fix/issue753-auth-race
fix(web): bind login submit before session probe
2026-06-03 16:34:08 +08:00
Codex 898206fd30 fix(web): bind login submit before session probe 2026-06-03 16:32:57 +08:00
Lyon ceea621ce9 Merge pull request #755 from pikasTech/fix/issue753-webui-broken
fix(web): restore v02 workbench layout
2026-06-03 15:58:50 +08:00
Lyon 39980bea34 fix(issue751): add WorkbenchAugmentedError + 0 any hard gate (#757)
#751 第二轮基线(#754)继续往下推:
- web-types.d.ts 新增 WorkbenchAugmentedError / WorkbenchAugmentedErrorFields
  / WorkbenchScrollOptions / WorkbenchLoadOptions / WorkbenchActionResultOptions
  / WorkbenchSummaryShape / WorkbenchComposerShape 七个精确接口;前两个
  让 custom Error 增广(agentErrorFromHttpResponse 那一串 error.traceId/code/
  layer/blocker/retryable/userMessage/missingConfig/route/toolName/timeoutMs/
  hardTimeoutMs/idleMs/lastActivityAt/waitingFor/providerStatus/category)有
  显式类型,runtime 不需要 any。WorkbenchScrollOptions 把 deferred/force/
  behavior/silent 收齐,scrollTraceToBottom 等的调用方不再绕开类型。
- ElMap.commandSend/commandClear 从 HTMLElement 收紧为 HTMLButtonElement,
  配合 lib 加 DOM.Iterable 让 NodeListOf<Element> 的 for...of 工作。
- WorkbenchState.conversationScrollPosition / traceScrollPositions /
  traceBodyScrollPositions 加上 bottomGap 字段,scrlTopForPosition 形参同步
  升级。
- app-conversation.ts:captureConversationScrollPosition 形参
  captureTraceScrollPositions / captureTraceBodyScrollPositions / restoreTraceScrollPositions
  / scrollTraceToBottom / agentErrorFromHttpResponse / agentFailurePresentation
  / classifyCodeAgentCompletion / scrollTopForPosition 加精确参数与返回类型;
  7 处 typeof payloadError === "object" ? payloadError.X 改为 as { X?: T } 强转。
- tsconfig.json:加 DOM.Iterable。

本次提交不破 web:check(54/0)与 web:build(12 dist);tsc-check 仍以
0 explicit untyped 为硬 gate,residual 残错按 #751 后续 issue 跟踪。
每类残错在 closeout comment 列出。

Refs: pikasTech/HWLAB#751

Co-authored-by: Codex <codex@noreply.local>
2026-06-03 15:57:03 +08:00
Codex 2fa23bd71d fix(web): restore v02 workbench layout 2026-06-03 15:49:52 +08:00
Lyon 10906ec726 fix(issue751): add web-types.d.ts + tsconfig + tsc-check baseline (#754)
为 issue #751 的 TypeScript 收紧建基线:
- 新增 web/hwlab-cloud-web/tsconfig.json(strict family 全部开启、noImplicitAny
  默认关、allowImportingTsExtensions 打开、types=[bun-types, node])
- 新增 web/hwlab-cloud-web/web-types.d.ts(ElMap + WorkbenchState + 跨文件
  function/lifecycle/constant 的 ambient declarations;用 WorkbenchUnknown
  接口避开 any 字面量,同时保留索引签名允许任意属性访问)
- 新增 web/hwlab-cloud-web/scripts/tsc-check.ts:web:check 的并行 type gate,
  显式 untyped 注解(项目源码 + web-types.d.ts)直接 exit 2;residual type
  错误按 issue #751 follow-up 处理
- web/hwlab-cloud-web/package.json:加 typescript@5.6.3 / @types/node@22.7.5
  / bun-types@1.1.33;check / check:tsc / check:tsc-strict 入口
- byId/query 加显式 : HTMLElement 返回类型(不再返回 HTMLElement | null)
- app-conversation.ts 中 captureConversationScrollPosition 加 : void 注解

web:check(54 tests / 0 fail)+ web:build(12 dist files)通过;tsc-check
报告 0 explicit untyped,residual type 错误(property access / strict null
等)作为 issue #751 后续轮次跟踪,不阻塞 build。

Refs: pikasTech/HWLAB#751

Co-authored-by: Codex <codex@noreply.local>
2026-06-03 15:21:03 +08:00
Lyon 9d71bf5f6b fix(web): HWLAB #748 initCommandBar orphan el.commandNewSession listener (#752)
PR #746 (#744) removed the duplicate `command-new-session` button from index.html and the `el.commandNewSession` field from the `el` literal, but left `el.commandNewSession.addEventListener("click", ...)` inside `initCommandBar()`. The resulting undefined reference crashed every Cloud Workbench init with

  app.js:5414 Uncaught TypeError: Cannot read properties of undefined (reading 'addEventListener')
      at initCommandBar (app.js:5414:24)
      at app.js:3538:1

The new session entry point is `#session-create` in the session sidebar (added in #740/#743), so this listener is no longer needed. Removal is the minimal fix; all other command-bar bindings (`commandInput`, `commandForm`, `commandClear`) are untouched.

Verified locally:
  - web:check (54 tests pass, all static contracts pass)
  - web:build (12 dist files fresh)
  - dist/app.js: 0 references to commandNewSession

Refs: pikasTech/HWLAB#748

Co-authored-by: Codex <codex@local>
2026-06-03 14:45:26 +08:00
Lyon 1a85f302c6 Merge pull request #747 from pikasTech/fix/issue-722-final-response-truncate
fix(web/cli): 不截断 Final Response 终态 trace 行 (HWLAB #722)
2026-06-03 13:54:40 +08:00
Codex 4221760a29 test(issue722): add CLI integration scripts for terminal vs streaming trace rows
- dev-issue-722-trace-integration.mjs: drives hwlab-cli agent trace --render web
  with a 4151-char final response and asserts the rendered terminal row body
  equals the full text without any 内容已截断 marker
- dev-issue-722-streaming-integration.mjs: drives the same path with a long
  non-terminal streaming message and asserts the CLI preview cap still fires
  at 1200 chars + the ... marker, while the terminal row in the same trace
  keeps the full text
- package.json: expose the two scripts as dev:issue-722:* for repeatable
  CLI verification on the v0.2 runtime

Refs: pikasTech/HWLAB#722
2026-06-03 13:43:21 +08:00
Codex d39e322bf0 fix(web/cli): do not truncate the terminal final-response body in trace rows
- HWLAB v0.2 Final Response was being truncated to 5000 characters in
  traceAssistantSummaryRow and then again to 1200 characters in the CLI
  compactTraceRenderRow, even when the response was the assistant’s
  terminal (last) message. The same Final Response is what
  /v1/agent/chat/result returns as reply.content, so the trace view
  should show the full text and stay consistent with the CLI
  assistantText path.
- Mark each rendered row with a terminal flag (true only for the
  terminal Final Response) and lift the body cap to
  Number.POSITIVE_INFINITY for terminal rows. The CLI Web-render path
  now passes the full body through when row.terminal is true and keeps
  the 1200 char preview for non-terminal streaming rows.
- Add unit tests in web/hwlab-cloud-web/app-trace.test.ts and
  tools/hwlab-cli/client.test.ts to lock the behavior in for the
  terminal/no-truncate path and the streaming/2200 cap path.

Refs: pikasTech/HWLAB#722
2026-06-03 13:26:19 +08:00
Lyon 2168ad2ad7 fix(web): HWLAB #744 WebUI v0.2 改进 (#746)
- 问题1: 修复重复 session - 按 threadId 去重 conversation
- 问题2: session sidebar 默认宽度改为150% (330px),移除上限
- 问题3: 删除重复的命令栏「新建 Session」按钮
- 问题4: session 报错(status=failed/error/canceled/timeout)后允许继续重试
- 问题5: session tabs 上方显示当前模型通道
- 问题6: 所有时间统一使用北京时间(UTC+8),移除「北京时间」字样
- 问题7: 注销按钮移入 activity-rail 设置标签

Closes #744

Co-authored-by: Codex <codex@local>
2026-06-03 13:13:23 +08:00
Lyon a72f14166e Merge pull request #743 from pikasTech/fix/issue740-webui-session-mgmt
fix(issue740): HWLAB v0.2 WEBUI session management improvements
2026-06-03 11:43:08 +08:00
Codex 6dbc72deac fix(issue740): HWLAB v0.2 WEBUI session management improvements
1. 在 panel-title-row 增加"复制 session id"按钮,把当前会话
   conversation id 复制到剪贴板,便于在 HWLAB CLI 复现;
2. 侧边栏标签改为显示最近更新时间(相对时间),排序仍然按
   lastTimestampMs 倒序,新会话靠前;
3. messageCount 与 firstUserMessagePreview 由 backend 持久化,
   不再被 slice(-50) 窗口掩盖,CLI/Web 看到的条数一致;
4. 把 left-sidebar-resize 移到 session-sidebar 右侧,
   activity-rail 固定 92px,拖拽控制 session-sidebar 宽度;
5. 侧边栏标签默认显示用户摘要(首条 user message 截断),
   长文本用省略号收尾。

新增 `hwlab-cli client session inspect <conversationId>` 子命令
与 `GET /v1/agent/conversations/{id}` 端点对齐,便于在 CLI 复现
WEB 看到的 session 详情(包含 messageCount / trace / thread)。

Backend 改动:access-control.ts 的 normalizeConversationSnapshot
和 mergeAgentSessionOwnerEvidence 现在按 max 累加 messageCount,
并保留 firstUserMessagePreview;mergeTerminalConversationMessages
返回 { messages, messageCount, firstUserMessagePreview }。
2026-06-03 11:41:02 +08:00
Lyon aa332bb5ae Merge pull request #742 from pikasTech/fix-v02-cli-session-friction
fix: 改进手动 session CLI 摩擦
2026-06-03 11:07:33 +08:00
Codex 2f435fc736 fix: 改进手动 session CLI 摩擦 2026-06-03 11:06:43 +08:00
Lyon ae1866c6ba Merge pull request #741 from pikasTech/fix-v02-manual-agent-session-716
feat: 手动化 Code Agent session 管理
2026-06-03 10:43:29 +08:00
Codex 94b9df822c feat: 手动化 Code Agent session 管理 2026-06-03 10:40:50 +08:00
Lyon 32deb72273 Merge pull request #739 from pikasTech/fix/issue738-session-sidebar
feat(v0.2): session 二级侧栏与 CLI 管理同路径
2026-06-03 10:00:41 +08:00
Codex da25cb4c02 feat: align session sidebar and cli management 2026-06-03 09:47:52 +08:00
Codex d39d184eae docs: 固化 Code Agent session 手动化规格 2026-06-03 09:29:30 +08:00
Lyon 66dd78d20c Merge pull request #737 from pikasTech/fix/issue736-session-tabs
feat: 主界面按 session 标签隔离展示
2026-06-03 08:38:08 +08:00
Codex 5b1c9eb5dd feat: add session tabs to cloud web 2026-06-03 08:37:07 +08:00
Lyon 9d13726703 Merge pull request #735 from pikasTech/fix/issue734-prompt-assembly-panel
feat: skills 面板展示引导 prompt 装配
2026-06-03 08:03:57 +08:00
Codex 90c5dad065 feat: show prompt assembly in skills panel 2026-06-03 08:03:04 +08:00
Lyon 028730047e fix: constrain minimax tool commands (#733)
Co-authored-by: Codex <codex@local>
2026-06-03 07:39:47 +08:00
Lyon a17f7702d1 Merge pull request #732 from pikasTech/fix/issue729-agentrun-prompt-planner
fix: route AgentRun prompt changes to cloud-api rollout
2026-06-03 07:26:32 +08:00
Codex 5b9d614336 fix: route agentrun prompt changes to cloud api 2026-06-03 07:25:35 +08:00
Lyon 937f475749 Merge pull request #731 from pikasTech/fix/issue729-minimax-optional-tool-probe
fix: guide minimax optional tool probes
2026-06-03 07:16:05 +08:00
Codex 6bdce2f191 fix: guide minimax optional tool probes 2026-06-03 07:14:43 +08:00
Lyon 32dad84d3b Merge pull request #730 from pikasTech/fix/issue729-skills-assembly
fix: expose AgentRun skill assembly in v02 web
2026-06-03 07:03:09 +08:00
Codex e2d4989468 fix: expose AgentRun skill assembly in v02 web 2026-06-03 07:02:09 +08:00
Lyon b57ceff959 Merge pull request #728 from pikasTech/fix/issue723-cli-output-workspace
fix: keep hwlab cli workspace output current
2026-06-03 01:29:25 +08:00
Codex 05c5c046bc fix: keep hwlab cli workspace output current 2026-06-03 01:28:30 +08:00
Lyon 9c0bff01ce Merge pull request #727 from pikasTech/fix/issue723-cli-restore-after-patch
fix: HWLAB CLI 完成后自动刷新 workspace
2026-06-03 01:15:10 +08:00
Codex 6cd4cb292d fix: restore hwlab cli workspace after completion 2026-06-03 01:14:08 +08:00
Lyon d30c3b283e Merge pull request #726 from pikasTech/fix/issue723-cli-save-workspace
fix: 持久化 HWLAB CLI workspace 更新
2026-06-03 01:05:09 +08:00
Codex ba5c8fdf35 fix: persist hwlab cli workspace updates 2026-06-03 01:04:18 +08:00
Lyon 75178c7aa1 Merge pull request #725 from pikasTech/fix/issue723-cli-continuation-thread
fix: prefer current conversation thread in HWLAB CLI
2026-06-03 00:45:23 +08:00
Codex 0445981f62 fix: prefer current conversation thread in hwlab cli 2026-06-03 00:43:55 +08:00
Lyon f557b5adf4 Merge pull request #724 from pikasTech/fix/issue723-session-resume-after-failure
fix: preserve Code Agent sessions after turn failures
2026-06-03 00:30:47 +08:00
Codex 0d4f5ef098 fix: preserve code agent sessions after turn failures 2026-06-03 00:28:40 +08:00
Lyon 4187c1b0ce Merge pull request #721 from pikasTech/fix/issue-720-trace-message-dedupe
修复 WEB trace assistant message 重复渲染
2026-06-02 22:47:09 +08:00
Codex 570c9963ec fix: collapse duplicate trace assistant rows 2026-06-02 22:46:05 +08:00
Lyon c1350bb7ac Merge pull request #719 from pikasTech/fix-v02-code-agent-concurrency-717
修复 Code Agent 默认 workspace 并发和 stale continuation 摩擦
2026-06-02 21:57:38 +08:00
Codex 9f287fa0d9 fix: allow code agent workspace concurrency 2026-06-02 21:54:28 +08:00
Lyon e469ea9afd Merge pull request #718 from pikasTech/docs-minimax-m3-validation-20260602
docs: allow minimax m3 validation when deepseek balance exhausted
2026-06-02 21:50:21 +08:00