Commit Graph

249 Commits

Author SHA1 Message Date
Codex Agent ac2d3001fa fix: depollute v02 web performance telemetry 2026-06-05 13:03:09 +08:00
Lyon 41f537f46a Merge pull request #907 from pikasTech/feat/issue903-performance-panel
v0.2 增加 WebUI 性能监控可视化面板
2026-06-05 12:04:33 +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
Codex Agent f5be1c0361 feat: add v02 web performance dashboard 2026-06-05 12:00:23 +08:00
Codex Agent c8a8aa505e feat: add hwpod harness node-ops loop 2026-06-05 11:52:47 +08:00
Codex Agent ab7d79c69a feat: expose v02 webui performance metrics 2026-06-05 11:14:27 +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
Codex Agent 1162c0e5bd fix(v02): report AgentRun result contract 2026-06-05 02:26:51 +08:00
Codex Agent aeefb7660b fix(v02): report AgentRun code agent health 2026-06-05 02:06:09 +08:00
Codex Agent fd1b8c0e5a fix(v02): remove legacy code agent control plane 2026-06-05 01:35:35 +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 df69e48115 fix(v02): persist chat owner messages (#875)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-05 00:21:47 +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 eca9dbaa9c fix: persist expired code agent trace summaries (#851)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 20:40:36 +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 0370135a35 feat(k8s+tests): keycloak bootstrap Job + AgentRun actor trace tests
- new deploy/k8s/keycloak/keycloak-bootstrap-job.yaml: one-shot Job that waits for Keycloak, authenticates as admin, creates hwlab realm + hwlab-cloud-web OIDC client via REST API
- secret hwlab-cloud-web-client holds the OIDC client_secret used by cloud-api
- kustomization.yaml picks up the new Job and Secret
- access-control.test.ts: cloud api AgentRun trace records real actor.userId from OIDC-upserted user (issue 788 spec)
- access-control.test.ts: cloud api /v1/users/me returns actor with authMethod=api-key for HWLAB_API_KEY Bearer token
- 31 pass / 4 pre-existing fail
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 6a8e9b3d79 feat(agentrun): inject owner HWLAB_API_KEY into runner transient env
- submitAgentRunChatTurn resolves owner user API key via accessController.store.findActiveDefaultApiKeyForUser
- buildAgentRunRunnerJobInput accepts ownerApiKey; when present, removes HWLAB_DEVICE_POD_API_KEY and adds HWLAB_API_KEY as sensitive
- buildAgentRunTransientEnv no longer emits HWLAB_DEVICE_POD_API_KEY
- codex-stdio child env now reads HWLAB_API_KEY (not HWLAB_DEVICE_POD_API_KEY)
- server-code-agent-http codeAgentAuthEnv looks up user default API key; URL env vars still set unconditionally
- tests: code-agent-session-registry Codex child env carries only device-pod API key now checks HWLAB_API_KEY
- tests: server-agent-chat delegates v0.2 turns removes HWLAB_DEVICE_POD_API_KEY assertion
- 58 pass / 4 pre-existing fail
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
Codex Agent 3a55a4b99e fix(cloud): expose persistent thread resume metadata 2026-06-04 13:05:03 +08:00
Lyon f7e4c372ce fix(cloud): restore running session active trace (#811)
Co-authored-by: Codex Agent <codex@hwlab.local>
2026-06-04 12:18:08 +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 32b29bc1dc fix: reensure AgentRun runner for reused sessions 2026-06-03 23:21:05 +08:00
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
Codex 6341015d3b feat(v0.2): Code Agent 默认 sessionStorage=persistent + eviction reset UX
PR D for #770:HWLAB Cloud Web Workbench 透传 session state 真正持久化

- code-agent-agentrun-adapter.ts:
  * 新 ensureAgentRunSessionPersistent:默认 sessionStorage=persistent,
    调 POST /api/v1/sessions 同步建 session + PVC
  * submitAgentRunChatTurn 改两步尝试:ensureSession 或 runner-jobs POST
    收到 session-store-evicted 时用新 sessionId(<base>-reset-<trace8>)
    + threadId=null 重试,trace 追加 agentrun:session-reset 事件
  * 新 shouldResetSessionAfterEviction / newSessionIdAfterEviction 辅助函数
- code-agent-response-contract.mjs: session-store-evicted 归
  session-blocked category
- code-agent-chat.ts: 新 userMessage
  「Code Agent session 存储已失效(PVC 被回收或 TTL 到期),
   HWLAB 已为你开新 sessionId,可继续发送下一条消息。」
- spec-v02-hwlab-cloud-web.md: 新增 'Session state 持久化与 eviction reset'
  章节,含禁止路径与实现情况表

env 控制:HWLAB_CODE_AGENT_AGENTRUN_SESSION_STORAGE=ephemeral
可退回 metadata-only 模式(PR 前默认行为)。
2026-06-03 21:47:14 +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 90c5dad065 feat: show prompt assembly in skills panel 2026-06-03 08:03:04 +08:00
Codex e2d4989468 fix: expose AgentRun skill assembly in v02 web 2026-06-03 07:02:09 +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 93b53e7d56 fix: expose AgentRun prompt assembly trace details 2026-06-02 21:11:27 +08:00
Codex 58df53bce5 feat: assemble AgentRun prompts and skills 2026-06-02 20:56:36 +08:00
Codex 39562d9c02 fix: clear stale continuation after thread resume failure 2026-06-02 20:12:01 +08:00
Codex 60a15186e5 fix: assemble unidesk ssh for web agentrun turns 2026-06-02 19:02:58 +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