Commit Graph

78 Commits

Author SHA1 Message Date
Lyon 3f8fc6b80c feat: connect cloud api code agent billing (#1139) 2026-06-13 20:19:07 +08:00
Codex Agent 6cae643161 fix: remove legacy trace fallback paths 2026-06-06 13:55:03 +08:00
Codex Agent 1830df467e fix: unify AgentRun trace result authority 2026-06-06 13:08:23 +08:00
Codex Agent c80493f240 fix: validate trace result provenance 2026-06-06 12:03:29 +08:00
Codex Agent aa06af6a91 fix: preserve latest trace during historical repair 2026-06-06 11:40:21 +08:00
Codex Agent 7c6df8d9b4 fix: index historical AgentRun traces 2026-06-06 11:21:00 +08:00
Codex Agent 4a22efb81a fix: detect whitespace-folded progress replies 2026-06-05 23:23:27 +08:00
Codex Agent fcd15b49d1 fix: trim message-only folded progress 2026-06-05 23:12:18 +08:00
Codex Agent d3ef88b58d fix: trim folded progress from agent conversations 2026-06-05 22:54:40 +08:00
Codex Agent 7637a43699 fix: preserve code agent final response text 2026-06-05 22:30:29 +08:00
Lyon 8ae0f55463 fix: repair webui refresh trace layout (#938)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 22:10:14 +08:00
Lyon 318df8597d fix: show inherited admin tool authority (#937)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 22:00:36 +08:00
Codex Agent a3ffd45e55 fix: enforce api key auth boundary 2026-06-05 21:58:16 +08:00
Lyon 2adc2f678f fix: restore bootstrap admin authority (#935)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 21:44:13 +08:00
Codex Agent 3e7131f6ab refactor: converge hwpod node-ops channel 2026-06-05 17:23:56 +08:00
Codex Agent d6769bf1d3 fix: remove v02 authorization residue 2026-06-05 14:00:13 +08:00
Lyon fc411b00f8 fix: remove legacy device pod grants authority (#906)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 12:02:51 +08:00
Lyon 48e3d24ad6 fix: converge v02 authorization on OpenFGA (#899)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 11:11:15 +08:00
Codex Agent cf722efd06 feat: add v02 OpenFGA access management 2026-06-05 09:39:49 +08:00
Lyon 6422487444 fix(v02): preserve owner conversation messages (#880)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 01:07:49 +08:00
Lyon 0c10056c22 fix(v02): rebuild terminal user messages (#878)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 00:41:06 +08:00
Lyon b6615c2abf fix(v02): preserve terminal workspace trace state (#874)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 00:00:04 +08:00
Lyon 1e085691e6 fix: repair persisted conversation snapshots (#855)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 20:59:10 +08:00
Lyon 6a79bc8f15 fix(v02): repair persisted final response fallback (#840)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 18:18:00 +08:00
Lyon be557c09bc fix(v02): repair final response status (#837)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 17:45:25 +08:00
Lyon 6c6a64b414 fix(v02): honor HTTP session cookie security (#831)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 16:59:15 +08:00
Lyon 7b2f4fa45f fix: wait for device-pod build verify output (#830)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 16:23:35 +08:00
Codex Agent baa7289ca0 fix(v02): widen device-pod job output visibility 2026-06-04 16:16:56 +08:00
Lyon 9928954ea6 feat: add device-pod build verify (#827)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 16:11:00 +08:00
Codex Agent 37f1b6af22 fix: support device-pod filename rg 2026-06-04 15:56:08 +08:00
Codex Agent e64ee92fb1 fix(v0.2): align Keycloak auth to HTTPS session API key 2026-06-04 15:01:30 +08:00
Codex 84cca71bef feat(cloud-api): v0.2 OIDC login/callback (state, nonce, user upsert) 2026-06-04 15:01:30 +08:00
Codex 49dc7cc6e1 feat(cloud-api): v0.2 24h Web session + Secure cookie
- SESSION_MAX_AGE_SECONDS 7d -> 24h
- Cookie now sets Secure + SameSite=Lax (preserves HttpOnly)
- /v1/auth/session exposes authMethod, sessionExpiresAt, sessionTtlSeconds
- setSessionCookie/clearSessionCookie use new builders
- New test covers first-admin, /auth/login and /auth/logout cookie shape + expiresAt
2026-06-04 15:01:30 +08:00
Codex 13c779ed11 feat(cloud-api): v0.2 user API key auth (api_keys table + Bearer hwl_live_)
Adds the user API key foundation called out in #788:

- New api_keys table with idx_api_keys_user and idx_api_keys_prefix
- users extended with auth_provider/keycloak_issuer/keycloak_sub/email/last_login_at
- Authorization: Bearer hwl_live_... resolves to the same AuthPrincipal
- /v1/api-keys, /v1/api-keys/default, /v1/api-keys/{id}/regenerate, DELETE /v1/api-keys/{id}
- First-admin and /auth/login bootstrap a Default API key
- Short-test mode keeps display_secret; production化 will switch to hash-only later
- Legacy HWLAB_DEVICE_POD_API_KEY and Bearer <session-token> paths preserved
- 4 new access-control.test.ts cases

Refs pikasTech/HWLAB#788
2026-06-04 15:01:30 +08:00
Lyon d5690ce2a5 fix(cloud): preserve selected conversation during terminal sync (#809)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 12:00:21 +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
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 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 0d4f5ef098 fix: preserve code agent sessions after turn failures 2026-06-03 00:28:40 +08:00
Codex 9f287fa0d9 fix: allow code agent workspace concurrency 2026-06-02 21:54:28 +08:00
Codex 39562d9c02 fix: clear stale continuation after thread resume failure 2026-06-02 20:12:01 +08:00
Codex bacfa24289 fix: replace device pod lease with api key 2026-06-02 18:11:32 +08:00
Codex 11dc7df502 fix: surface nested devicepod executor output 2026-06-02 15:03:41 +08:00
Codex da96f02333 fix: preserve AgentRun reuse mapping and trace rendering 2026-06-02 03:16:50 +08:00
Codex 66ffd2e171 fix: repair stale terminal workbench conversations 2026-06-02 02:45:00 +08:00
Codex bf2bdee5f6 fix: sync terminal workbench conversation 2026-06-02 02:25:29 +08:00
Codex 577622d0ab fix: sync terminal workbench traces 2026-06-02 01:55:19 +08:00
Lyon 24060853e7 fix: reuse AgentRun runner for HWLAB turns (#662)
Co-authored-by: Codex <codex@local>
2026-06-01 23:18:40 +08:00
Codex 99aeb99991 fix(workbench): bind postgres workspace created timestamp 2026-06-01 22:00:16 +08:00