Skip to content

feat(workbench): add calli workbench shell on demo data - #8783

Open
maxliux5 wants to merge 2 commits into
loopx-project:mainfrom
maxliux5:codex/calli-workbench-shell
Open

maxliux5 wants to merge 2 commits into
loopx-project:mainfrom
maxliux5:codex/calli-workbench-shell

Conversation

@maxliux5

@maxliux5 maxliux5 commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds the workbench UI to apps/presentation/calli-workbench/: three panes with
the machine switcher on top, sessions grouped by what needs attention on the
left, the session view in the middle, a "host + machine + model" launch bar at
the bottom, and a "Needs you" view. Data comes from a built-in synthetic
workspace (src/demo/), so reviewers can run the page with no backend.

Ported from Calli packages/web, relicensed under the Apache License, Version 2.0 with contributor consent (see NOTICE). It is
trimmed to the workbench. Every write is refused in this PR: the demo API
answers reads from synthetic data and rejects anything that would change state.
C replaces the demo source with LoopX projections.

Stack: A scaffold → B shell (this PR) → C projections. Related design notes:
#8778 (open; not a prerequisite).

Change boundary

  • Every file is under apps/presentation/calli-workbench/. No change to
    loopx/, packages/, other apps, root configuration, CI or scripts.
  • No network access at runtime: the demo API never calls fetch.
  • No proxy: vite.config.ts is A's file unchanged. The read-only proxy
    arrives with the projections PR, together with its first caller.
  • No browser storage beyond display preferences (language, theme, sidebar
    width and visibility, collapsed groups, selected machine). Client caches of
    threads and quota and composer drafts are not ported.

What was ported, and what was left out:

Kept Left out (no LoopX counterpart, or out of scope)
Shell and routing, sidebar and activity grouping, machine switcher, session view and timeline, launch bar and pickers, "Needs you" view, status panel, appearance, zh/en i18n, styles, demo workspace Team and coordination model, handover state machine, chat-app integration, storage migration, task and schedule pages, voice, writing mode, pet, usage and cost boards, skills and MCP management, agent login and account management, server settings pages, terminal, remote desktop, file browser, observability, the Calli extension system and its vendored packages, the ja locale and marketing-site copy

Code is unchanged from the Calli source except where it had to be cut loose
from the removed modules. Compared file by file with Calli packages/web @
87adcde, 58 of the shipped source, test and asset files are byte-identical;
review can focus on these:

Kind Files
Changed (23) index.html, public/manifest.webmanifest, src/App.tsx, src/api.ts, src/main.tsx, src/hosts.ts, src/sidebar.ts, src/desk.ts, src/timeline.ts, src/i18n/index.ts, src/demo/DemoApi.ts, src/demo/data.ts, src/components/{Composer,ComposerMenu,DeskPage,Hosts,Pickers,Sidebar,ThreadActions,ThreadView}.tsx, test/{demo,i18n,stream}.test.ts
New (4) src/attention.ts and src/thread-feed.ts (types and the thread feed, moved out of the removed extension system); src/daemon-shared/{icons,todo-priority}.ts (helpers the UI imported from the Calli daemon package, copied unchanged)

src/styles.css (12,423 lines) is byte-identical and still carries rules for
the removed features; see D-2.

Deviations

Id Deviation Impact and follow-up
D-1 React 18 / Vite 5 / TypeScript 5, not the dashboard's React 19 / Vite 8 / TypeScript 6 Separate directory and lockfile; nothing is shared with the dashboard and nothing enters the LoopX startup path. A stack upgrade follows as its own PR under the same tests.
D-2 The Calli stylesheet is kept as-is instead of being migrated to the tokens in docs/development/design.md Visual only; no state or authority impact. Token migration (color, type, radius first, then components) follows as a separate PR; this stack does not claim design-system conformance.
D-3 Large diff in B, mostly moved code B's review can focus on the files listed there as changed from the source; the rest is a verbatim move, checkable with diff -r against Calli packages/web @ 87adcde. A and C are small.
D-4 License: resolved — Apache-2.0 + NOTICE package.json declares Apache-2.0; NOTICE carries the attribution and the relicensing statement.

D-1 to D-3 apply to this PR; D-4 is resolved.

How to try it (no backend needed)

cd apps/presentation/calli-workbench
npm ci
npm run build        # tsc --noEmit && vite build
npm run dev          # http://127.0.0.1:5174

Open http://127.0.0.1:5174/. With no LoopX or other service running, the page
opens on the built-in demo workspace (src/demo/): sessions on the left grouped
by what needs attention, a session in the middle, the machine switcher on top
and the launch bar at the bottom. Pick a session to read its timeline; open
"Needs you" from the sidebar to see the triage view. Sending, starting a session
or editing an item shows the read-only message instead of changing anything.
npm run preview serves the production build the same way.

License

Apache-2.0. Ported from Calli packages/web, relicensed under the Apache License, Version 2.0 with contributor consent (see NOTICE). NOTICE reads: "Portions derived from Calli
(https://github.com/maxliux5/calli). Copyright Calli contributors. Relicensed
under the Apache License, Version 2.0 with contributor consent."

Validation

$ cd apps/presentation/calli-workbench
$ npm ci && npm run build
> tsc --noEmit && vite build
✓ 1895 modules transformed.
✓ built in 28.64s
$ npm test
# tests 206
# pass 206
# fail 0
  • Size: 89 files, +38,912 / −525 lines over A; the lockfile (+4,119) and
    styles.css (+12,423) account for about 16,000 of them.
  • Bundle: diagrams load mermaid lazily; its chunks (largest: the ELK layout,
    1.5 MB, 464 kB gzip) are fetched only when a message contains a diagram. The
    main chunk is 766 kB (249 kB gzip).
  • Removed modules are absent: grep -rlE "teams|coordination|handover|lark|storage-migration" src --include=*.ts --include=*.tsx
    matches only translation strings.
  • npm ls lists no @calli/*, @xterm/* or @novnc/* package; there is no
    vendor/ directory.
  • In a browser, every main navigation entry opens without console errors;
    write controls show the read-only message.
  • Pre-commit scan of the staged diff: no local paths, hostnames, credentials or
    e-mail addresses. The demo workspace is synthetic.

Visual evidence

Captured at 5b2b76b7b (built-in demo workspace, no service running); the
tested revision 9c53d15f9 differs from it only in vite.config.ts (proxy
removed) and the README, no UI change: the shell this PR contributes — three panes, navigation, theme,
locale and the narrow layout. The triage panel, the Goal grouping and the
"read-only" composer label arrive in the follow-up PR.

Desktop, light, zh Narrow, dark, en
Desktop, light, zh Narrow, dark, en

Rollback

Revert this PR. The directory returns to the empty scaffold from A; nothing
outside apps/presentation/calli-workbench/ is affected.


Stacked on the scaffold PR (#8782). This PR targets main and its branch contains the scaffold commit; review the incremental change with
compare between the two branches.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

评审提交 5b2b76b7b35dd1423bc4ab2ef2c6ee08eda703b8,GitHub 目标基线 74ca883d5bd3e4bc64671bac54210eac9e97ed05。本地合并模拟与主干行为对照为 48dbebbd14c5535b9631f4c7a1152d86aa64c5b2。

[P2] Workbench 的同源代理能写入 Chat。 Vite 转发整个 /api/chat,并把 Workbench 的同源 Origin 改成 Chat 来源;开发服务与构建预览都返回 200,随后 GET 与隔离 Chat 文件都读回了刚写入的 Goal 排序。相同来源直接到 Chat 端口会被拒绝。 这一片只用合成数据,删去 dev 与 preview 的真实后端代理,待读取实际需要时再接入。 问题位置

动机 / Motivation

开发者打开独立 Workbench,用合成会话核对线程、时间线与等待交互,作为接入真实投影前的可浏览阶段。 主干只有既有 Dashboard 等入口。上一片建立构建入口,这一片让开发者能在独立页面打开有内容的合成工作台。 构建和演示浏览成立。页面没有向真实服务请求投影;同一 Vite 入口仍转发可写请求。 这里只验收可独立使用的合成演示。真实投影接入属于下一片,启动执行和正式分发都不在验收内。

改动思路 / Approach

App 实例化 DemoApi;线程、助手和时间线从内存样例取得。只有演示的未读旗标在内存变化,页面刷新回到样例状态。 演示状态只由 DemoApi 持有,真实偏好仍由 Chat HTTP 管理;移植的视图和现有独立包没有引入新持久化。复用 Dashboard 的写代理对合成演示没有必要。 保留合成工作台与独立构建,等首个读调用真正需要代理时再加入;以合成加载和失败预览复验。

独立验证

干净安装与构建通过,206 项测试通过。开发和预览可读取合成 status 与初始 Chat 偏好;桌面与窄屏都可打开等待批准的演示线程,页面没有发出投影请求。

具体改动 / Changes

对 GitHub 基线是 92 文件、约 40k 新行;相对脚手架 89 文件,约 38.9k 增、529 删,主要是已有 UI、样式、资产和 UI 测试。 以 docs/development/frontend-delivery.md 和不可变版本 48dbebbd14c5535b9631f4c7a1152d86aa64c5b2 为准。设计 PR #8778 说明产品方向。当前验收依据是主干已接纳的前端交付规范,分别查看原型边界、实际读取、不可用及重试、来源的写入权限。 规范

  • Task-first delivery · implemented。干净安装与构建通过,206 项测试通过。开发和预览可读取合成 status 与初始 Chat 偏好;桌面与窄屏都可打开等待批准的演示线程,页面没有发出投影请求。
  • By default all mutation endpoints are denied · not_met。Vite 转发整个 /api/chat,并把 Workbench 的同源 Origin 改成 Chat 来源;开发服务与构建预览都返回 200,随后 GET 与隔离 Chat 文件都读回了刚写入的 Goal 排序。相同来源直接到 Chat 端口会被拒绝。

关键代码讲解

  • chatProxy.configure。把已匹配 Workbench 来源的请求改成 Chat 来源。 仅检查 Host 和 Origin,方法原样转发。 Vite 转发整个 /api/chat,并把 Workbench 的同源 Origin 改成 Chat 来源;开发服务与构建预览都返回 200,随后 GET 与隔离 Chat 文件都读回了刚写入的 Goal 排序。相同来源直接到 Chat 端口会被拒绝。 精确代码
  • preview。服务生产构建产物。 没有独立停用或收窄代理。 两个入口都能写入隔离 Chat 偏好。 精确代码
  • DemoApi.send。为 Workbench 提供完整的合成工作区读取。 只改变演示里的未读旗标。 返回消息和审批卡,无状态服务请求。 精确代码

对主干的风险 / Risks

PASS · 全量 92 个路径仅在独立 Workbench 目录。补丁空白、2 个提交的签署及当前主干本地合并模拟通过。

FAIL · 启动本机 Workbench dev 或 preview 后,从 Workbench 自身来源向 Chat 偏好接口发出 POST。 Vite 转发整个 /api/chat,并把 Workbench 的同源 Origin 改成 Chat 来源;开发服务与构建预览都返回 200,随后 GET 与隔离 Chat 文件都读回了刚写入的 Goal 排序。相同来源直接到 Chat 端口会被拒绝。 先拆掉当前不被界面使用的代理,保留已经能运行的合成工作台。

UNVERIFIED · 浏览器使用准确提交的本地包和合成状态;写入复现实测 LoopX Chat 处理器和隔离文件。正式安装、远端服务及托管 CI 未验证。

语义与 CI 对齐

合成页面不启用真实写入;只读边界使用明确的 HTTP 方法和路径名单,未加入一律拒绝。 用独立空 Chat 运行目录,分别启动 dev 与 preview;向 /api/chat/sidebar-goal-order 送同源 POST 后重新 GET。修复后应为 405 或 403,旧排序与运行目录均不变;保留对允许读取的正例。 托管 CI 未读取。

我的整体评价 / Verdict

请求修改。合成工作台是可验收的一步,先去掉当前没有消费者的真实代理,再从真实读取这一片复验。 独立读视图不改变 Agent 的运行、调度、结算与长期任务推进;这次没有测量生产效果。

桌面首屏显示项目与线程,打开等待批准的演示线程后可读到现有动作和审批卡;窄屏把侧栏收进返回入口,保留时间线和审批卡。 本轮窄屏只看了等待审批线程,未覆盖窄屏默认的导航、全部详情或真实连接;未批准或执行任何演示动作。

English verdict: REQUEST_CHANGES at 5b2b76b. The demo renders, but both Vite entry points can mutate the local Chat service. Remove the proxy until an allowlisted read path needs it.

proxy: {
'/status.json': statusProxy,
'/ssh-hosts': chatProxy,
'/api/chat': chatProxy,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Workbench 的同源代理能写入 Chat。 Vite 转发整个 /api/chat,并把 Workbench 的同源 Origin 改成 Chat 来源;开发服务与构建预览都返回 200,随后 GET 与隔离 Chat 文件都读回了刚写入的 Goal 排序。相同来源直接到 Chat 端口会被拒绝。 这一片只用合成数据,删去 dev 与 preview 的真实后端代理,待读取实际需要时再接入。

@maxliux5

Copy link
Copy Markdown
Collaborator Author

Thanks — confirmed and fixed in ffb2bc049.

The dev/preview proxy forwarded every method on /api/chat to a writable service, so a same-origin POST could change chat preferences or Goal order.

Fix:

  • Explicit path allowlist and only GET/HEAD; vite dev and vite preview share the same rule.
  • Other methods on an allow-listed path return 405; paths outside the allowlist return 404.
  • Encoded traversal (.., encoded separators, double encoding, malformed escapes) is refused.
  • Unit tests cover the method/path matrix.

Evidence, identical on the dev port and the preview port:

POST   /api/chat/preferences                 -> 405 read-only workbench proxy
PUT    /api/chat/sessions/x                  -> 405 read-only workbench proxy
DELETE /status.json                          -> 405 read-only workbench proxy
GET    /api/chat/preferences                 -> 404 read-only workbench proxy
GET    /api/chat/sessions/%2e%2e/preferences -> 404 read-only workbench proxy
GET    /api/chat/capabilities                -> 200
GET    /status.json                          -> 200

All three branches in the stack were rebuilt so the same vite.config.ts and proxy-guard.ts ship in A/B/C.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

评审提交 ffb2bc0,GitHub 当前列示的目标分支提交 eaff94c。

[P2] 对实际进入代理的每条请求落实只读清单。 两种模式都挡住了前次的普通写请求,但仍将匹配代理挂载前缀、且不在清单内的合成请求转发到了隔离上游。守卫与 Vite 对哪些请求会进入代理的判断不同,因而「后端只收到已列明读取」没有兑现。测试只记录上游是否收到请求。 把路由匹配和方法检查放到同一个转发边界:仅将逐条列明的 GET/HEAD 交给上游,会话详情只匹配单个 ID,其余代理候选一律本地拒绝。这个阶段还没有真实数据调用,也可以先移除代理,等连接器的契约一并落地。 位置。

[P2] 把待批准样例标清楚并停用不可执行的批准按钮。 示例线程在侧栏显示「等待批准」,线程内显示「需要你的批准」和可点击的「允许这一次」。点击后仍是待批准;桌面和 390 像素窄屏的读回都只显示「连接后再发送,输入框里的内容会留着」。当前页面始终使用 DemoApi,也没有连接入口;这个提示没说明审批未执行或这个状态只是演示。 在页面上持续标明只读演示,把不可执行的批准/拒绝以禁用或样例状态显示,并在原处准确说明原因。保留样例线程供浏览即可,无需引入真实连接与写权限。 位置。

动机 / Motivation

主干没有这个 Workbench 入口。前次评审复现:页面自己只发读取请求时,旧代理仍会转发普通的非读取请求。 试用 Workbench、查看线程或审批样例的维护者,以及在开发模式启动页面的贡献者。 把 Workbench 单独构建和启动;Vite dev 和 preview 都只转发允许清单中的 GET/HEAD。演示数据完全来自本地样例,通过演示页面验证线程、侧栏和桌面布局。 通过真实的 dev 与 preview 入口提交无效或不在清单内的路径,观察上游是否收到请求。 正常读取仍通过,原普通写全部被拦;两种模式仍有未列明请求进入上游。 已构建的演示还能显示并打开混合状态线程,但审批仍是上述不可执行路径。 本地精确源码的 Vite dev、已构建的 Vite preview;上游以独立回环测试服务替换,未触及运行中的 LoopX、真实账户或数据;未验证安装包与远端 CI。

改动思路 / Approach

启动 Workbench 的人显式运行 dev 或 preview,不进入 Dashboard 已有入口;当前启动就注册代理。 复用 Dashboard 已有的 readback 服务与 Chat 路由契约;将精确匹配交给实际转发边界,避免在两个地方声明不等价的前缀。 独立 Workbench 空壳或纯演示,真实读取连接器另行交付。

依据前端交付规则及设计规则,规范版本 eaff94c。#8778 仍是讨论中的设计提案。下列简称用于对应独立入口、只读范围和使用者反馈:

  • PACKAGE-ISOLATION:独立页面构建与启动应保留原有入口和后端所有权。 已复核。
  • PROXY-EXACT-SCOPE:按现有所有权提供有边界的读取入口,实际转发须匹配本 PR 声明的只读清单。 未通过。
  • DEMO-ACTION-TRUTH:页面标明演示/权限边界;对操作给出准确、可恢复的结果。 未通过。

具体改动 / Changes

新目录、独立包/锁、引导页、Vite 读入口和构建配置。 同一 PR 相对主干还带入演示数据、线程布局、前端辅助模块、素材、测试和 NOTICE;未接真实数据层。独立审阅新增路由、DemoApi 接线与审批结果。上游 CSS 保持原样,既有非交付样式是否清理可用后续实测决定。

  • defineConfig / readOnlyProxyGuard:在独立包中注册 guard、状态和 Chat 代理。空包/演示启动即建立到本地服务的转发;不改变现有 Dashboard 配置。
  • proxyRejection:按方法和路径判断是否把请求交给 Vite。普通写由 pass-through 变为拒绝;两个匹配器的候选集合仍不同。
  • configureServer / configurePreviewServer:dev 与 preview 复用同一中间件。两种入口都发生相同的未列明转发,用同样的 HTTP 请求复现。
  • App / DemoApi:将所有可用数据固定在示例接口。没有实际读取服务或切换到真实连接的路径。
  • handleError:把 DemoError 转为页面反馈。样例审批拒绝会提示连接后发送,未说明审批结果。
  • decide:把审批按键连到所选 API。DemoApi 拒绝此操作;样例仍待批准。

此前复审和作者修后说明。使用同一套合成请求重放上次评审的 Vite 配置和当前配置。用上一次评审的精确 Vite 配置重放同一组合成请求:正常 GET/HEAD 有上游读取,前次三类普通写也到达隔离上游。主干没有此入口。 当前结果:正常读取仍通过,原普通写全部被拦;两种模式仍有未列明请求进入上游。 已构建的演示还能显示并打开混合状态线程,但审批仍是上述不可执行路径。

对主干的风险 / Risks

  • PASS — 独立 TypeScript 检查、Vite 构建及差异格式检查。两种模式都保留正常 GET/HEAD,三类前次普通写请求现被本地以 405 拒绝,隔离上游未见这些请求。
  • FAIL — 在真实的 dev 与 production preview HTTP 入口,用隔离上游覆盖允许的 GET/HEAD、未列明的相近路径和非读取方法;失败必须被本地拒绝且上游收到零请求。 两种模式都挡住了前次的普通写请求,但仍将匹配代理挂载前缀、且不在清单内的合成请求转发到了隔离上游。守卫与 Vite 对哪些请求会进入代理的判断不同,因而「后端只收到已列明读取」没有兑现。测试只记录上游是否收到请求。
  • PASS — 本地测试 211 项通过。
  • FAIL — 在已构建的预览打开待批准示例。确认可见演示状态,无法实际批准/拒绝;操作提示说明当前边界,不能指向该版本没有的连接入口。覆盖桌面及窄屏。 示例线程在侧栏显示「等待批准」,线程内显示「需要你的批准」和可点击的「允许这一次」。点击后仍是待批准;桌面和 390 像素窄屏的读回都只显示「连接后再发送,输入框里的内容会留着」。当前页面始终使用 DemoApi,也没有连接入口;这个提示没说明审批未执行或这个状态只是演示。
  • UNVERIFIED — 本地精确源码的 Vite dev、已构建的 Vite preview;上游以独立回环测试服务替换,未触及运行中的 LoopX、真实账户或数据;未验证安装包与远端 CI。

我的整体评价 / Verdict

REQUEST_CHANGES。把路由匹配和方法检查放到同一个转发边界:仅将逐条列明的 GET/HEAD 交给上游,会话详情只匹配单个 ID,其余代理候选一律本地拒绝。这个阶段还没有真实数据调用,也可以先移除代理,等连接器的契约一并落地。 在页面上持续标明只读演示,把不可执行的批准/拒绝以禁用或样例状态显示,并在原处准确说明原因。保留样例线程供浏览即可,无需引入真实连接与写权限。 桌面和窄屏的实际截图里,默认视图和展开后的审批卡都缺少演示标识;审批后,待处理卡与「连接后再发送」提示一起出现。 仅覆盖已构建预览的演示数据和两个浏览器宽度;未验证装包、移动原生宿主或后续真实连接器。

English verdict: REQUEST_CHANGES at ffb2bc0. Ordinary write requests from the previous review are now rejected. Both Vite modes still forward requests outside the declared read-only scope. The demo also renders a pending approval as actionable and suggests an unavailable connection after the action is refused.

const unsafeMethod = !SAFE_METHODS.has((method ?? 'GET').toUpperCase());
// A path that climbs or hides a separator is refused when it sits under a proxied prefix.
if (path === null) return proxied(new URL(raw, 'http://local').pathname) ? (unsafeMethod ? 405 : 404) : null;
if (!proxied(path)) return null;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 对实际进入代理的每条请求落实只读清单。 两种模式都挡住了前次的普通写请求,但仍将匹配代理挂载前缀、且不在清单内的合成请求转发到了隔离上游。守卫与 Vite 对哪些请求会进入代理的判断不同,因而「后端只收到已列明读取」没有兑现。测试只记录上游是否收到请求。 把路由匹配和方法检查放到同一个转发边界:仅将逐条列明的 GET/HEAD 交给上游,会话详情只匹配单个 ID,其余代理候选一律本地拒绝。这个阶段还没有真实数据调用,也可以先移除代理,等连接器的契约一并落地。

const handleError = (e: unknown) => {
// Doing something the read-only workbench cannot do is refused, not reported as a failure.
if (e instanceof DemoError) {
if (e.write) setToast({ message: t('app.connectToSend') });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 把待批准样例标清楚并停用不可执行的批准按钮。 示例线程在侧栏显示「等待批准」,线程内显示「需要你的批准」和可点击的「允许这一次」。点击后仍是待批准;桌面和 390 像素窄屏的读回都只显示「连接后再发送,输入框里的内容会留着」。当前页面始终使用 DemoApi,也没有连接入口;这个提示没说明审批未执行或这个状态只是演示。 在页面上持续标明只读演示,把不可执行的批准/拒绝以禁用或样例状态显示,并在原处准确说明原因。保留样例线程供浏览即可,无需引入真实连接与写权限。

maxliux5 and others added 2 commits November 15, 2026 04:09
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: maxliux5 <lualiudd@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: maxliux5 <lualiudd@gmail.com>
@maxliux5
maxliux5 force-pushed the codex/calli-workbench-shell branch from ffb2bc0 to 9c53d15 Compare November 15, 2026 04:12
@maxliux5

Copy link
Copy Markdown
Collaborator Author

Agreed — the guard middleware and the Vite proxy made separate routing decisions, so a path outside the guard's list could still be forwarded. Fixed by collapsing them into one boundary (f3a2788bb):

  • A and B no longer configure any proxy. Neither layer makes a network call; the proxy now lands in C together with its first caller, as suggested.
  • C replaces server.proxy entirely with a single middleware (readonly-forward.ts) that enumerates the allowed routes and forwards them itself with node:http. Matching and forwarding are the same code. Unlisted paths get a local 404; an enumerated route with a method other than GET/HEAD gets a local 405. Session details match a single plain segment; ., .., encoded separators and multi-segment ids fail the match. Only Accept/Accept-Language are forwarded; Origin is dropped. A down upstream answers 502.
  • Tests run against two loopback fake upstreams that count requests and assert they receive zero requests for every rejected case (writes, unlisted paths, encoded traversal, multi-segment ids). Seven allowed routes each hit exactly their own upstream once.

Fake-upstream test results (npm test):

ok - each enumerated route is forwarded to its own upstream exactly once
ok - the query string travels, the fragment does not, HEAD is forwarded as HEAD
ok - a write to an enumerated route is a local 405 and the upstream sees nothing
ok - anything not enumerated is a local 404 and the upstream sees nothing
ok - paths outside the service namespace are left to the page server
ok - an upstream that is down gives 502, not a hang or a crash

Curl evidence, identical on the dev port and the preview port:

POST /api/chat/preferences -> 404    POST /api/chat/sessions -> 405
PUT  /api/chat/sessions/x  -> 405    DELETE /status.json     -> 405
GET  /api/chat/preferences -> 404    GET /api/chat/sessions/a/b -> 404
GET  /api/chat/sessions/%2e%2e/preferences -> 404
GET  capabilities | endpoints | goals/contexts | sessions | /status.json | /ssh-hosts -> 200

All three branches are rebuilt on the latest main so the same layering ships across A/B/C.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

评审提交 9c53d15f91c2a763d9ed7ad953c1a46fc812e4a8。主干 08cc6ef5b9a15a5a74d3e56ba4114cb09b2033ee 与候选的 Git 合并基点是 1965965992fffa1a1cca1a18cb297860155bc133,合并树模拟成功。候选包含尚未进入该主干的 #8782 脚手架。

动机 / Motivation

试用 Workbench 的用户要浏览线程、模型和机器,并从界面知道当前演示可以执行哪些操作。 脚手架只验证独立启动。先前的完整壳通过同源代理接触后端,同时把样例审批表现为可执行操作。 此提交提供独立的只读演示,用户能浏览合成线程、启动栏和助手页,真实投影留给后续接入。

打开商品列表的待批准样例,点击「允许这一次」,然后核对面板、提示、请求与当前状态。 此前的代理问题已修复。桌面和窄屏仍显示可点击的审批动作,点击后待批准状态完全保留,提示却要求连接后发送。 覆盖 npm 构建、本地预览、真实浏览器与合成内容。安装版本、真实 LoopX 连接和远端 CI 未复验。

改动思路 / Approach

DemoApi 和现有审批面板已经是两条明确的责任边界。在演示入口暴露当前能力,用同一个能力事实切换执行动作与展示态。 构建通过,线程与时间线可浏览,助手页展示合成任务。开发服务和构建预览均使用静态路由,无后端代理。从预览载入与点击审批均未发起 /api 请求。 覆盖 npm 构建、本地预览、真实浏览器与合成内容。安装版本、真实 LoopX 连接和远端 CI 未复验。 相关问题或原任务

具体改动 / Changes

实际 92 文件、+40,267。样式 12,423 行、锁文件 4,893 行、测试 2,759 行。主要执行入口集中在 App、DemoApi、线程时间线与审批面板,保留的旧样式可在后续 token 迁移收敛。 独立入口使用合成 source,开发/预览无代理。应用保留线程选择、时间线、机器/模型启动栏与助手。已读标记只修改演示内存。

关键代码讲解

  • 开发和预览均在本机启动,无后端 proxy。 Vite configuration
  • 运行中的入口统一注入 DemoApi。 App
  • 合成读取获得副本,不支持的写入返回 DemoError。 DemoApi.send
  • 将演示写入拒绝统一映射到发送连接提示。 handleError
  • 把「允许这一次」等选项显示为能点击的按钮。 ApprovalSheet

依据 docs/development/frontend-delivery.md 在 08cc6ef5b9a15a5a74d3e56ba4114cb09b2033ee 的约束核对。

  • 可发现并可浏览的演示。可进入页面、选线程、浏览时间线及助手页,清楚标明合成边界。 构建预览的正常导航和两种首屏已检查,合成审批标识见下一项。
  • 操作边界与失败反馈。用户能知道当前操作可否执行并收到对应反馈。 界面继续显示「需要你的批准」,短暂提示「连接后再发送,输入框里的内容会留着」。当前入口固定使用 DemoApi,也没有可操作的连接入口,用户无法从这条反馈判断批准未发生。
  • 真实后端隔离。保持演示边界,真实权限由拥有后端授权的后续接入提供。 构建通过,线程与时间线可浏览,助手页展示合成任务。开发服务和构建预览均使用静态路由,无后端代理。从预览载入与点击审批均未发起 /api 请求。

对主干的风险 / Risks

[P2] 标明只读演示并停用样例审批按钮。 在 1200 像素桌面和 390 像素窄屏打开「修复商品列表滚动跳动」,点击真实可交互的「允许这一次」。 界面继续显示「需要你的批准」,短暂提示「连接后再发送,输入框里的内容会留着」。当前入口固定使用 DemoApi,也没有可操作的连接入口,用户无法从这条反馈判断批准未发生。 把当前界面标明为只读演示。用禁用或静态控件呈现样例审批,在审批卡内说明操作不可执行。保留线程浏览。 代码位置

npm ci、类型检查和构建通过,npm test 206 项通过。开发和预览均无旧代理,合成 POST 返回本地 404。两种屏宽的浏览器审批实测复现误导反馈。 上一轮的审批讨论可直接继续。 原讨论

依赖沿用 #8782 的 Vite 5.4.21。其优化依赖的 sourcemap 路径问题已有上游通告,当前预览链路监听回环地址。请在上游脚手架更新依赖后同步堆叠分支。 Vite 安全通告

语义与 CI 对齐

审批样例的动作应由演示能力事实控制。真实预览已经证明拒绝和显示状态之间存在差异,单元测试通过无法覆盖该用户路径。

我的整体评价 / Verdict

REQUEST_CHANGES。 保留已验证通过的隔离预览,修正审批演示。桌面和 390 像素窄屏都应能理解当前状态与动作边界。 两种宽度都保留足够阅读空间,展开样例审批后,按钮与提示让只读演示看起来需要实际批准。 仅检查构建预览的内置合成场景。未验证真实后端、安装态或其他设备组合。

English verdict: REQUEST_CHANGES at 9c53d15. The proxy is gone. The browser still offers live-looking approval controls in the read-only demo and returns a misleading send/connect message on both viewport widths.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants