Commit Graph

49 Commits

Author SHA1 Message Date
Codex 8f0a2cd213 fix: align v0.2 explicit agent session dispatch
Fixes HWLAB #782.
2026-06-03 22:50:58 +08:00
Codex eb5bada0d1 fix(v0.2): device-pod output.text evidence read-only selectors for #773
Tracks pikasTech/HWLAB#773. PR #765 fixed selector confusion but did
not touch cloud-api evidence propagation. This change closes the
real root cause and adds the read-only evidence selectors that #760
follow-up called for.

cloud-api (internal/cloud/access-control.ts):
- DEVICE_JOB_INTENTS adds workspace.evidence and debug.evidence.
- DEVICE_JOB_READ_ONLY_SUB_ACTIONS = { status, output, wait, cancel,
  evidence } and DEVICE_JOB_ACTIONABLE_INTENTS = { workspace.build,
  debug.download } make the mutating-intent / sub-action matrix
  explicit.
- _deviceJobRequiresReason(intent, args, reason) returns false when
  the caller already provided reason OR when the actionable mutating
  intent is paired with a read-only sub-action. debug.reset and other
  non-actionable mutating intents still always require reason.
- executorOutputPayload now also surfaces output.summary,
  nestedOutput.summary, evidence.text, evidence.logTail and
  evidence.summary as body.output.text, so a dispatcher that
  includes the host logTail / buildSummary in its result becomes
  visible to the Code Agent without a separate bootsharp dance.

device-pod executor (cmd/hwlab-device-pod/main.ts):
- gatewayDispatchText also walks result.evidence.{text,logTail,
  summary}, dispatch.message (only when dispatchStatus=completed),
  dispatch.summary, result.summary and dispatch.buildSummary before
  falling back to JSON.stringify.
- deviceHostArgs maps workspace.evidence / debug.evidence to the
  host device-host-cli evidence subcommands.

device-host-cli (skills/device-pod-cli/assets/device-host-cli.mjs):
- new readJobEvidence(kindPrefix, requestedId, { tail, full,
  target }) reads the most recent (or specified) keil-build /
  keil-download job log file and returns it as keil-build.evidence /
  keil-download.evidence. tail defaults to 200, --full for entire
  log. Missing job returns ok=false but does not throw.
- workspace build evidence and debug-probe download evidence now
  wired in main() and help text.

device-pod-cli (tools/src/device-pod-cli-lib.ts):
- selectorCheatSheet adds the evidence row and clarifies that
  build/download status/output/wait/cancel/evidence are read-only
  and do NOT need --reason. build/download start still require
  --reason. usage examples now include the two evidence selectors.
- failed-fast selectors are unchanged; existing 26 tests still pass.

SKILL.md (skills/device-pod-cli/SKILL.md):
- Selector Cheat Sheet adds workspace.evidence and
  debug.evidence rows.
- #773 follow-up note: --reason is now required only for
  mutating sub-actions, not for the read-only ones.

cloud-api tests (internal/cloud/access-control.test.ts):
- workspace.evidence and debug.evidence must be in DEVICE_JOB_INTENTS.
- _deviceJobRequiresReason signature and the read-only / actionable
  branch table.
- executorOutputPayload must look at evidence and summary fields
  in addition to text. 3 new tests; pre-existing 4 workbench
  failures are unrelated to this change and reproduce on the
  unchanged v0.2 base.

Verification (host-side, G14 /root/hwlab-v02, source=0cf9a8c6):
- bun test tools/device-pod-cli.test.ts → 26/26 pass.
- bun test internal/cloud/access-control.test.ts → 23 pass,
  4 pre-existing workbench failures (unchanged on v0.2 base).
- bun test cmd/hwlab-device-pod/main.test.ts → 7/7 pass.
- node --check skills/device-pod-cli/assets/device-host-cli.mjs
  → syntax OK.

Hot probe: live v0.2 cloud-api at 74.48.78.17:19667 confirmed
job_devicepod_804c5db4... (workspace.build) returned
text="", bytes=0, output={} before this change. After the
executor text-extraction update and the new evidence selector,
a follow-up workspace.build start + build evidence will surface
the host logTail / buildSummary in body.output.text without
requiring bootsharp + host file fallback.

Tracked-by: pikasTech/HWLAB#773
2026-06-03 21:57:39 +08:00
Lyon 0cf9a8c607 Merge pull request #765 from pikasTech/fix/v02-device-pod-cli-selector-friction-20260603
fix(device-pod-cli): add selector cheat sheet and fail-fast hints for #760
2026-06-03 19:54:36 +08:00
Codex 58b06fcd17 fix(web): enforce React TypeScript single path 2026-06-03 17:47:27 +08:00
Codex Device-Pod Agent 5c35f8349e fix(device-pod-cli): add selector cheat sheet and fail-fast hints
Address the friction in #760 where Code Agent picked <pod>:workspace:/ keil
download/flash and <pod>:debug-probe flash for firmware flashing, all of
which are not SOP. Add to SKILL.md:

- Selector Cheat Sheet: explicit per-surface allowed operations table
- Common selector mistakes table: wrong selector -> error you would hit
  -> correct selector
- Pitfalls Observed in Real Runs: --reason required for build/download
  even on read-only sub-actions, cloud-api job output is empty for
  build/download, workspace rg --pattern shell-pipe collision

In tools/src/device-pod-cli-lib.ts:
- workspace.keil now fail-fasts on any action that is not add-source or
  remove-source, with code unsupported_workspace_keil_action and a
  selector hint pointing to debug-probe download start
- debug-probe flash now has a dedicated error code path with the same
  selector hint instead of the generic unsupported_debug_operation
- catch-all debug-probe error message now includes the allowed list
- help() payload exposes a selectorCheatSheet array so hwpod --help
  callers see the SOP table without reading the SKILL.md file

Tests in tools/device-pod-cli.test.ts: 6 new cases lock in the new
error codes, the selector cheat sheet, and that add-source still
dispatches correctly. 26/26 pass.
2026-06-03 16:59:27 +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 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
Codex 2f435fc736 fix: 改进手动 session CLI 摩擦 2026-06-03 11:06:43 +08:00
Codex 94b9df822c feat: 手动化 Code Agent session 管理 2026-06-03 10:40:50 +08:00
Codex da25cb4c02 feat: align session sidebar and cli management 2026-06-03 09:47:52 +08:00
Codex 05c5c046bc fix: keep hwlab cli workspace output current 2026-06-03 01:28:30 +08:00
Codex 6cd4cb292d fix: restore hwlab cli workspace after completion 2026-06-03 01:14:08 +08:00
Codex ba5c8fdf35 fix: persist hwlab cli workspace updates 2026-06-03 01:04:18 +08:00
Codex 0445981f62 fix: prefer current conversation thread in hwlab cli 2026-06-03 00:43:55 +08:00
Codex 9f287fa0d9 fix: allow code agent workspace concurrency 2026-06-02 21:54:28 +08:00
Codex bf7a8bfd49 fix: align hwpod lease guidance 2026-06-02 21:30:33 +08:00
Codex 7f97b41404 fix: route hwpod through cloud-api 2026-06-02 18:48:56 +08:00
Codex bacfa24289 fix: replace device pod lease with api key 2026-06-02 18:11:32 +08:00
Codex f05446ec00 fix: restore cli workspace thread id visibility 2026-06-02 16:43:42 +08:00
Codex 10af8aaf76 fix: restore devicepod cli auth and output evidence 2026-06-02 14:53:41 +08:00
Codex 66282ba80f fix: unlock cloud web composer steer 2026-06-02 12:25:16 +08:00
Codex 2477190ae2 fix: unify device-pod runner entry 2026-06-02 10:40:03 +08:00
Codex 3497a8993b feat: support agentrun steer and idle continuation 2026-06-02 10:29:46 +08:00
Codex f52eadfbe7 feat: route minimax m3 through agentrun 2026-06-02 08:50:27 +08:00
Codex c1cd3df37e fix: select runtime endpoint by execution surface 2026-06-02 08:11:03 +08:00
Codex 8ed2b6944f fix: reuse hwlab cli sessions by runtime scope 2026-06-02 08:04:25 +08:00
Codex 399af47ee8 fix: assemble device pod runtime endpoint 2026-06-02 07:44:24 +08:00
Codex af6f6c9f17 fix: align hwlab cli agent send with web short submit 2026-06-02 03:37:58 +08:00
Lyon 5dc263e10a fix: align AgentRun trace rendering (#665)
Co-authored-by: Codex <codex@local>
2026-06-01 23:58:06 +08:00
Codex dcff1b4b2d fix(cli): recommend direct bun client commands 2026-06-01 22:37:24 +08:00
Codex 80cf8c7f19 fix(cli): make group help side-effect free 2026-06-01 22:34:16 +08:00
Codex 378595d403 fix(cli): show selected session user in auth summary 2026-06-01 22:13:06 +08:00
Codex 095c042077 feat(cli): render agent trace with web rows 2026-06-01 21:44:39 +08:00
Codex b7285b30b1 feat(workbench): share account workspace across web and cli 2026-06-01 21:31:26 +08:00
Codex a686c37247 feat(cli): replay agent continuation from trace 2026-06-01 20:50:59 +08:00
Codex 63f08e6e75 fix: align web cli agentrun continuation 2026-06-01 20:01:58 +08:00
Codex 9a14ed06ae fix: harden v0.2 code agent transport 2026-05-31 22:54:50 +08:00
Codex 153aabf534 fix: compact device pod job output for code agent 2026-05-31 20:14:01 +08:00
Codex 72535cb32c fix: 收敛 device-pod DS 验收 CLI 摩擦 2026-05-31 20:03:43 +08:00
Codex ca714bfa27 fix: 优化 device-pod CLI 短入口 2026-05-31 19:16:17 +08:00
Codex 028308e4bd feat: 接入 D601 F103 v2 device-pod 2026-05-31 18:39:30 +08:00
Codex 2234c232e4 fix: expose hwlab cli request diagnostics 2026-05-31 16:12:40 +08:00
Codex 945c2ba3d0 fix: persist user code agent sessions 2026-05-31 16:00:05 +08:00
Codex 5bf4bf0f47 feat: sync g14 harness and device-pod cli 2026-05-31 05:07:16 +08:00
Codex 0cf79ecc9d feat: expose hwlab client pod routes 2026-05-30 14:05:28 +08:00
Codex 395216122a fix: make hwlab cli a short web client 2026-05-30 12:31:07 +08:00
Codex 4e7d837123 feat: seed device pods during v02 setup 2026-05-29 14:17:44 +08:00
Codex f740fc9dbc feat: migrate device pod cli to rest authority 2026-05-29 11:30:17 +08:00