Merge remote-tracking branch 'origin/master' into fix/forge-ptc-binding
# Conflicts: # apps/web/tests/forge-panel.e2e.ts
This commit is contained in:
commit
30e56b50bb
175 files changed
+6558
-583
No files matched your search
+10
-10
@@ -18,17 +18,17 @@
|
||||
en: 821989170ad76994
|
||||
zh: 0ed142bea166fc3a
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/layering-principles/ui-adapters-own-react-integration:
|
||||
en: 4d032e048364fb97
|
||||
zh: 82a435531efdaa78
|
||||
en: 4caab5487c8545f8
|
||||
zh: 77fa93f76b6fb65f
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/layering-principles/slot-scopes-and-standard-props-are-separate:
|
||||
en: b6f585ca87e1fc6f
|
||||
zh: 53fd58c3e93cf17c
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/package-ownership:
|
||||
en: 2fc4b50a651b1847
|
||||
zh: 7dceeecb9c58e838
|
||||
en: 89f75f7cc2fe0e6c
|
||||
zh: e50974fad3baf69c
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/overall-data-flow:
|
||||
en: e7c11e82db080dd4
|
||||
zh: 5a8a501a128366d6
|
||||
en: 002d9f406580684b
|
||||
zh: a86742c6c943ac85
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/session-controller-client:
|
||||
en: b88f651b1bfb8b5e
|
||||
zh: b88f651b1bfb8b5e
|
||||
@@ -48,8 +48,8 @@
|
||||
en: 860315b96703371d
|
||||
zh: 860315b96703371d
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/ui-session/service-responsibilities:
|
||||
en: d075ba28fd37bff2
|
||||
zh: e2d430d1f3e89b15
|
||||
en: 40e598676f2d7f46
|
||||
zh: acc8e028978a5419
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/ui-session/standard-source-registration:
|
||||
en: e4be6d4b1d79b342
|
||||
zh: 7cb0e8c0f6358b50
|
||||
@@ -60,8 +60,8 @@
|
||||
en: 5d9bdb1f784f97f2
|
||||
zh: a4b3de7a21b84fce
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/ui-session/pending-interactions:
|
||||
en: 85e358a03ffac4ba
|
||||
zh: 54b1d5ed6197f2c2
|
||||
en: 54b65fef1667278f
|
||||
zh: cf46a8ad738a0a55
|
||||
/agent-note-client-session-conversation-and-ui-ownership-layers/workspace-controller-and-ui-workspace:
|
||||
en: 45e5f41550e62a3d
|
||||
zh: d4e6d8f5b397bb51
|
||||
|
||||
+7
-6
@@ -57,7 +57,7 @@ Each standard hook belongs to the `ui-*` package closest to its data semantics.
|
||||
| `useSessions` | `client/ui-session` | Session Controller global list |
|
||||
| `useSession` | `client/ui-session` | Bound Session snapshot |
|
||||
| `useProjection` | `client/ui-session` | Bound Session keyed projection |
|
||||
| `useSessionStatus` | `client/ui-session` | Running, effective pending request, and unread completion |
|
||||
| `useSessionStatus` | `client/ui-session-status` | Running, effective pending request, and unread completion |
|
||||
| `useSessionRetainInfo` | `client/ui-session` | Read-only Controller reference-source counts |
|
||||
| `useWorkspaces` | `client/ui-workspace` | Workspace Controller list |
|
||||
| `useConversation` | `client/ui-conversation` | Conversation binding snapshot |
|
||||
@@ -80,7 +80,8 @@ Adding a target does not add a branch to the renderer or Session Controller. The
|
||||
| --- | --- | --- |
|
||||
| `api/session-controller/client` | Session objects, catalog, references, source counts, commands, projections, event windows, and Agent Contexts | Navigation, completion reminders, Conversation targets, React, Slots, Workspace |
|
||||
| `api/workspace-controller/client` | Workspace objects, ordering, archive state, commands, and snapshots | React, Session navigation policy, directory UI |
|
||||
| `client/ui-session` | Explicit Session scope, standard sources, `SessionProvider`, and unified UI status | Session transport, reference ownership, Conversation assembly, Approval/Question results |
|
||||
| `client/ui-session` | Explicit Session scope, standard sources, `SessionProvider`, and effective pending interactions | Session transport, reference ownership, Conversation assembly, Approval/Question results, unified UI status |
|
||||
| `client/ui-session-status` | Unified UI status: running state, effective pending request, and completion reminders | Pending-interaction registration, Session transport, React |
|
||||
| `client/ui-workspace` | Workspace hook, browser UI, main-area reference, and cross-Controller navigation policy | Workspace transport, copies of Session data |
|
||||
| `client/ui-conversation` | Conversation core, registries, bindings, shell, input, composer, queue, and View navigation | Session transport, Chat/Trajectory snapshots |
|
||||
| `client/ui-chat` | Chat target, Node definitions, renderers, selection, details, and locale | Session lifecycle, generic View navigation, Trajectory, historical-image cache |
|
||||
@@ -120,7 +121,7 @@ Session data reaches the UI through this path:
|
||||
|
||||
Workspace data enters the Workspace Controller from `ctx.remote.workspace`, then `ui-workspace` exposes it as `useWorkspaces`. `ui-workspace` reads explicit targets for cross-domain navigation and owns the main-area reference without making it a default business Context.
|
||||
|
||||
Approval and Question arrive from the Host waterfall through `ctx.remote.$on` at their respective UI owners. Each owner publishes a Pending object; `ui-session.sessionStatus` supplies the same effective object to Workspace indicators and Conversation composer selection.
|
||||
Approval and Question arrive from the Host waterfall through `ctx.remote.$on` at their respective UI owners. Each owner publishes a Pending object through `ui-session`; `ctx.uiSession.sessionStatus` from `ui-session-status` supplies the same effective object to Workspace indicators and Conversation composer selection.
|
||||
|
||||
## Session Controller Client
|
||||
|
||||
@@ -178,9 +179,9 @@ This cleanup does not require the Session Controller to know the roster of upper
|
||||
- supplies `SessionProvider` rendering semantics;
|
||||
- supplies built-in Session snapshot, projection, and sessionId sources;
|
||||
- accepts Session-scoped source contributions from other domain packages;
|
||||
- aggregates domain-owned pending interactions with running and completion-reminder facts in `sessionStatus`.
|
||||
- selects each Session's effective domain-owned pending interaction and publishes it read-only as `pendingInteractions`.
|
||||
|
||||
It does not own Session transport, event folding, Conversation targets, or concrete business results.
|
||||
It does not own Session transport, event folding, Conversation targets, or concrete business results. `client/ui-session-status` combines the effective pending interactions with running and completion-reminder facts in the `uiSession.sessionStatus` service, read as `ctx.uiSession.sessionStatus`.
|
||||
|
||||
### Standard source registration
|
||||
|
||||
@@ -221,7 +222,7 @@ Concurrent objects with the same key are rejected; replacement requests use a ne
|
||||
|
||||
`ui-session` selects each Session's effective object using domain precedence. Higher precedence wins; at equal precedence, the later valid object in traversal order wins.
|
||||
|
||||
The pending aggregate is private to `ui-session`; its effective request appears unchanged as `sessionStatus.getSnapshot().get(id)?.pendingInteraction`. `useSessionStatus` is the public UI read face.
|
||||
The pending aggregate is private to `ui-session`; `pendingInteractions` exposes each Session's effective request read-only, and the same object appears as `ctx.uiSession.sessionStatus.getSnapshot().get(id)?.pendingInteraction`. `useSessionStatus` is the public UI read face.
|
||||
|
||||
Session navigation state and composer takeover read the same effective object. They do not maintain separate status maps or takeover rosters.
|
||||
|
||||
|
||||
+7
-6
@@ -57,7 +57,7 @@ UI 层可以同时读取多个 Controller 做一次导航决定,但不得把
|
||||
| `useSessions` | `client/ui-session` | Session Controller 全局列表 |
|
||||
| `useSession` | `client/ui-session` | 已绑定会话快照 |
|
||||
| `useProjection` | `client/ui-session` | 已绑定会话的键控投影 |
|
||||
| `useSessionStatus` | `client/ui-session` | 运行状态、有效待处理请求和未读完成提醒 |
|
||||
| `useSessionStatus` | `client/ui-session-status` | 运行状态、有效待处理请求和未读完成提醒 |
|
||||
| `useSessionRetainInfo` | `client/ui-session` | 控制器的只读引用来源计数 |
|
||||
| `useWorkspaces` | `client/ui-workspace` | Workspace Controller 列表 |
|
||||
| `useConversation` | `client/ui-conversation` | Conversation binding snapshot |
|
||||
@@ -80,7 +80,8 @@ UI 层可以同时读取多个 Controller 做一次导航决定,但不得把
|
||||
| --- | --- | --- |
|
||||
| `api/session-controller/client` | 会话对象、目录、引用、来源计数、命令、投影、事件窗口与 Agent Context | 导航、完成提醒、Conversation target、React、Slot、Workspace |
|
||||
| `api/workspace-controller/client` | Workspace 对象、顺序、归档、命令和 snapshot | React、Session 导航策略、目录 UI |
|
||||
| `client/ui-session` | 显式会话作用域、标准数据源、`SessionProvider` 与统一 UI 状态 | 会话传输、引用所有权、Conversation 组装、Approval/Question 结果 |
|
||||
| `client/ui-session` | 显式会话作用域、标准数据源、`SessionProvider` 与有效待处理交互 | 会话传输、引用所有权、Conversation 组装、Approval/Question 结果、统一 UI 状态 |
|
||||
| `client/ui-session-status` | 统一 UI 状态:运行状态、有效待处理请求与完成提醒 | 待处理交互登记、会话传输、React |
|
||||
| `client/ui-workspace` | Workspace 钩子、浏览器 UI、主区域引用与跨控制器导航策略 | Workspace 传输、会话数据副本 |
|
||||
| `client/ui-conversation` | Conversation core、registry、binding、shell、input、composer、queue 和 View 导航 | Session transport、Chat/Trajectory snapshot |
|
||||
| `client/ui-chat` | Chat target、Node definitions、renderer、selection、details 和 locale | Session 生命周期、通用 View 导航、Trajectory、历史图片 cache |
|
||||
@@ -120,7 +121,7 @@ Session 数据按以下路径进入 UI:
|
||||
|
||||
Workspace 数据由 `ctx.remote.workspace` 进入 Workspace 控制器,再由 `ui-workspace` 通过 `useWorkspaces` 提供。`ui-workspace` 为跨领域导航读取显式目标并持有主区域引用,不把它变为默认业务 Context。
|
||||
|
||||
Approval 与 Question 通过 `ctx.remote.$on` 从 Host waterfall 到达各自的 UI owner。各 owner 发布 Pending 对象;`ui-session.sessionStatus` 向 Workspace 标识和 Conversation composer 选择提供同一个有效对象。
|
||||
Approval 与 Question 通过 `ctx.remote.$on` 从 Host waterfall 到达各自的 UI owner。各 owner 通过 `ui-session` 发布 Pending 对象;`ui-session-status` 提供的 `ctx.uiSession.sessionStatus` 向 Workspace 标识和 Conversation composer 选择提供同一个有效对象。
|
||||
|
||||
## Session Controller Client
|
||||
|
||||
@@ -178,9 +179,9 @@ Session Controller 对外提供三个互不替代的读取面:
|
||||
- 提供 `SessionProvider` 的呈现语义;
|
||||
- 内建 session snapshot、projection 和 sessionId source;
|
||||
- 接收其他领域 package 的 Session-scoped source contribution;
|
||||
- 在 `sessionStatus` 中组合领域持有的待处理交互、运行事实和完成提醒。
|
||||
- 为每个会话选出领域持有的有效待处理交互,并以只读的 `pendingInteractions` 发布。
|
||||
|
||||
它不拥有 Session transport、event folding、Conversation target 或具体业务结果。
|
||||
它不拥有 Session transport、event folding、Conversation target 或具体业务结果。`client/ui-session-status` 在 `uiSession.sessionStatus` 服务中把有效待处理交互与运行事实、完成提醒组合起来,以 `ctx.uiSession.sessionStatus` 读取。
|
||||
|
||||
### 标准 source 注册
|
||||
|
||||
@@ -221,7 +222,7 @@ Contribution roster 变化会重建已 materialize 的 binding 并发布新的 s
|
||||
|
||||
`ui-session` 使用各 domain 的 precedence 选出每个 Session 当前生效的对象。较高 precedence 胜出,相同 precedence 下后遍历到的有效对象胜出。
|
||||
|
||||
待处理聚合是 `ui-session` 的私有实现;其有效请求原样出现在 `sessionStatus.getSnapshot().get(id)?.pendingInteraction` 中。`useSessionStatus` 是公开 UI 读取接口。
|
||||
待处理聚合是 `ui-session` 的私有实现;`pendingInteractions` 以只读方式提供每个会话的有效请求,同一个对象原样出现在 `ctx.uiSession.sessionStatus.getSnapshot().get(id)?.pendingInteraction` 中。`useSessionStatus` 是公开 UI 读取接口。
|
||||
|
||||
Session 导航状态和 composer takeover 必须读取同一个 effective object,不得分别维护 status map 或 takeover roster。
|
||||
|
||||
|
||||
+4
-4
@@ -12,8 +12,8 @@
|
||||
en: a15c7c13f167e5ac
|
||||
zh: 63bcc2ef60c2f344
|
||||
/agent-note-client-session-references-reference-sources-and-ui-status/decision/scope-and-ownership:
|
||||
en: 3f04f9c2b7b0fc2b
|
||||
zh: ebfcbac3de8463a3
|
||||
en: 9ff7f15985d06986
|
||||
zh: fe27ef687594c124
|
||||
/agent-note-client-session-references-reference-sources-and-ui-status/decision/addresses-bindings-and-references:
|
||||
en: 3743abc8bca00348
|
||||
zh: d79e6a9311f0a2fe
|
||||
@@ -24,8 +24,8 @@
|
||||
en: e2de83d10542f93b
|
||||
zh: 3855b38fc8c48ea3
|
||||
/agent-note-client-session-references-reference-sources-and-ui-status/decision/unified-ui-session-status:
|
||||
en: 2d75aef5cf5f1fc8
|
||||
zh: 87a7051f24f9871a
|
||||
en: 07ea04b9ca50dd8f
|
||||
zh: e025fcea4c9f0fb9
|
||||
/agent-note-client-session-references-reference-sources-and-ui-status/decision/explicit-providers-and-consumer-lifetimes:
|
||||
en: 04802baa0147fec1
|
||||
zh: b86037bf2e4bc936
|
||||
|
||||
@@ -21,7 +21,8 @@ Client Session objects, Agent-scoped Client Contexts, references, consumer-sourc
|
||||
| Owner | Responsibility |
|
||||
| --- | --- |
|
||||
| Client Session Controller | Catalog, live generations, references, source counts, bindings, history windows, and existing Session control state |
|
||||
| `ui-session` | Explicit Session Provider integration and the unified UI status source |
|
||||
| `ui-session` | Explicit Session Provider integration and the effective pending-interaction source |
|
||||
| `ui-session-status` | The unified UI status source |
|
||||
| View or operation | Its own reference, target, source identifier, and release point |
|
||||
| Workspace UI | Main-area target and reference, navigation, persisted target, and creation flow |
|
||||
| UI composition boundary | Supplies an owner-provided reference to one explicit `SessionProvider` |
|
||||
@@ -89,7 +90,7 @@ Window-level consumers may inspect source markers. Session business operations s
|
||||
|
||||
### Unified UI Session status
|
||||
|
||||
`ui-session` owns a React-free `sessionStatus` source and exposes it through the standard `useSessionStatus` hook. The snapshot is indexed by Session identity and supplies one UI status record per known Session. It combines these independent facts rather than reducing them to one mutually exclusive phase:
|
||||
`ui-session-status` owns the React-free `uiSession.sessionStatus` service, read as `ctx.uiSession.sessionStatus`, and exposes it through the standard `useSessionStatus` hook. The snapshot is indexed by Session identity and supplies one UI status record per known Session. It combines these independent facts rather than reducing them to one mutually exclusive phase:
|
||||
|
||||
| Field | Value | Meaning and owner |
|
||||
| --- | --- | --- |
|
||||
@@ -99,7 +100,7 @@ Window-level consumers may inspect source markers. Session business operations s
|
||||
|
||||
Source counts remain authoritative in `SessionListState.byId[id].retainedBy`; UI status reads them for acknowledgement policy without owning another reference registry. Titles, Workspace associations, history, queues, and projection data remain with their existing owners.
|
||||
|
||||
Pending domains retain `SessionPendingInteractionMap`, request identities, precedence, publication disposers, and teardown delegation. The unified status includes the same effective request object; it does not copy requests or create a second pending registry. Workspace status indicators and Conversation composer selection read `useSessionStatus` instead of separate `useSessionPendingInteraction` and `useCompletedSessionIds` hooks.
|
||||
Pending domains retain `SessionPendingInteractionMap`, request identities, precedence, publication disposers, and teardown delegation in `ui-session`, which publishes each Session's effective request read-only as `ctx.uiSession.pendingInteractions`. The unified status includes the same effective request object; it does not copy requests or create a second pending registry. Workspace status indicators and Conversation composer selection read `useSessionStatus` instead of separate `useSessionPendingInteraction` and `useCompletedSessionIds` hooks.
|
||||
|
||||
Completion tracking subscribes to the existing `api-session/status` events so a running-to-idle transition is not lost in batched catalog snapshots. Host-list rows (`ids`) establish initial and reconnect running baselines; synthetic catalog and retained rows preserve independently observed status. A pending empty catalog is not evidence that Sessions disappeared. The update rules are:
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ Client Session 对象、Agent 作用域的 Client Context、引用、使用方
|
||||
| 所有者 | 职责 |
|
||||
| --- | --- |
|
||||
| Client Session Controller | 目录、活跃代、引用、来源计数、binding、历史窗口与既有 Session 控制状态 |
|
||||
| `ui-session` | 显式 Session Provider 集成与统一 UI 状态来源 |
|
||||
| `ui-session` | 显式 Session Provider 集成与有效待处理交互来源 |
|
||||
| `ui-session-status` | 统一 UI 状态来源 |
|
||||
| 视图或操作 | 自己的引用、目标、来源标识与释放时机 |
|
||||
| Workspace UI | 主区域目标与引用、导航、持久目标及创建流程 |
|
||||
| UI 组合边界 | 将所有者提供的引用交给一个明确的 `SessionProvider` |
|
||||
@@ -89,7 +90,7 @@ Controller 将来源计数与每个活跃代的引用共同管理。每个来源
|
||||
|
||||
### 统一的 UI Session 状态
|
||||
|
||||
`ui-session` 拥有不依赖 React 的 `sessionStatus` 来源,通过标准 `useSessionStatus` 钩子公开。快照按 Session 身份索引,为每个已知 Session 提供一条 UI 状态记录。它组合下列独立事实,不将它们压缩成互斥的单一阶段:
|
||||
`ui-session-status` 拥有不依赖 React 的 `uiSession.sessionStatus` 服务,以 `ctx.uiSession.sessionStatus` 读取,并通过标准 `useSessionStatus` 钩子公开。快照按 Session 身份索引,为每个已知 Session 提供一条 UI 状态记录。它组合下列独立事实,不将它们压缩成互斥的单一阶段:
|
||||
|
||||
| 字段 | 取值 | 含义与所有者 |
|
||||
| --- | --- | --- |
|
||||
@@ -99,7 +100,7 @@ Controller 将来源计数与每个活跃代的引用共同管理。每个来源
|
||||
|
||||
来源计数以 `SessionListState.byId[id].retainedBy` 为准;UI 状态读取它以执行确认策略,不维护另一套引用注册表。标题、Workspace 关联、历史、队列和投影数据保留在各自的既有所有者中。
|
||||
|
||||
待处理领域保留 `SessionPendingInteractionMap`、请求身份、优先级、发布清理函数与卸载委托。统一状态包含同一个有效请求对象,不复制请求,也不创建第二套待处理注册表。Workspace 状态指示器与 Conversation composer 选择读取 `useSessionStatus`,不再分别读取 `useSessionPendingInteraction` 和 `useCompletedSessionIds` 钩子。
|
||||
待处理领域在 `ui-session` 中保留 `SessionPendingInteractionMap`、请求身份、优先级、发布清理函数与卸载委托,`ui-session` 以只读的 `ctx.uiSession.pendingInteractions` 发布每个 Session 的有效请求。统一状态包含同一个有效请求对象,不复制请求,也不创建第二套待处理注册表。Workspace 状态指示器与 Conversation composer 选择读取 `useSessionStatus`,不再分别读取 `useSessionPendingInteraction` 和 `useCompletedSessionIds` 钩子。
|
||||
|
||||
完成跟踪订阅已有 `api-session/status` 事件,避免 running 到 idle 的变化在合批目录快照中丢失。Host 列表行(`ids`)建立初始与重连的 running 基线;目录合成行与 retained 行保留独立观察到的状态。pending 状态下的空目录不能证明 Session 已消失。更新规则如下:
|
||||
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
- img "变更请求状态:需要处理"
|
||||
- text: "Add the pull request panel #7"
|
||||
- button "查看的提交:全部提交": 全部提交
|
||||
- button "提交评审"
|
||||
- button "在浏览器中打开"
|
||||
- radiogroup "分层透镜":
|
||||
- radio "全部 6" [checked]
|
||||
- radio "接口 1"
|
||||
- radio "实现 2"
|
||||
- radio "测试 3"
|
||||
- button "全部 6 个文件"
|
||||
- switch "隐藏测试文件"
|
||||
- button "筛选透镜": 透镜
|
||||
- button "笔记 2" [pressed]
|
||||
- progressbar "已审阅的文件": 已审阅 0 / 6
|
||||
- text: +8 −2
|
||||
- button "刷新变更"
|
||||
- button "全部折叠"
|
||||
- button "左右对比" [pressed]
|
||||
- button "自动换行" [pressed]
|
||||
- button "将文件树移到右侧" [expanded]
|
||||
- region "全部 6 个文件":
|
||||
- button "收起 panel.md" [expanded]
|
||||
- text: docs/panel.md 新文件 +2 −0
|
||||
- checkbox "将 panel.md 标记为已审阅"
|
||||
- button "panel.md 的更多操作"
|
||||
- strong: 笔记
|
||||
- text: 已看过此文件
|
||||
- button "移除"
|
||||
- button "选择第 R1 行": "1"
|
||||
- text: "+ # Panel"
|
||||
- button "选择第 R2 行": "2"
|
||||
- text: + Shows the change requests of a Session.
|
||||
- button "收起 schema.json" [expanded]
|
||||
- text: docs/schema.json 新文件 +1 −0
|
||||
- checkbox "将 schema.json 标记为已审阅"
|
||||
- button "schema.json 的更多操作"
|
||||
- button "选择第 R1 行": "1"
|
||||
- text: "+ { \"type\": \"object\" }"
|
||||
- button "收起 zh.json" [expanded]
|
||||
- text: locale/zh.json 新文件 +1 −0
|
||||
- checkbox "将 zh.json 标记为已审阅"
|
||||
- button "zh.json 的更多操作"
|
||||
- button "选择第 R1 行": "1"
|
||||
- text: "+ { \"title\": \"面板\" }"
|
||||
- button "收起 panel.spec.ts" [expanded]
|
||||
- text: src/panel.spec.ts 新文件 +1 −0
|
||||
- checkbox "将 panel.spec.ts 标记为已审阅"
|
||||
- button "panel.spec.ts 的更多操作"
|
||||
- button "选择第 R1 行": "1"
|
||||
- text: "+ it('shows the panel', () => {})"
|
||||
- button "收起 panel.ts" [expanded]
|
||||
- text: src/panel.ts +2 −2
|
||||
- checkbox "将 panel.ts 标记为已审阅"
|
||||
- button "panel.ts 的更多操作"
|
||||
- button "选择第 L1 行": "1"
|
||||
- text: export const n1 = 1
|
||||
- button "选择第 R1 行": "1"
|
||||
- text: export const n1 = 1
|
||||
- button "选择第 L2 行": "2"
|
||||
- text: export const n2 = 2
|
||||
- button "选择第 R2 行": "2"
|
||||
- text: export const n2 = 'two'
|
||||
- strong: 笔记
|
||||
- text: Check the quoted value
|
||||
- button "移除"
|
||||
- button "选择第 L3 行": "3"
|
||||
- text: export const n3 = 3
|
||||
- button "选择第 R3 行": "3"
|
||||
- text: export const n3 = 3
|
||||
- button "选择第 L4 行": "4"
|
||||
- text: export const n4 = 4
|
||||
- button "选择第 R4 行": "4"
|
||||
- text: export const n4 = 4
|
||||
- button "选择第 L5 行": "5"
|
||||
- text: export const n5 = 5
|
||||
- button "选择第 R5 行": "5"
|
||||
- text: export const n5 = 5
|
||||
- button "6 行未变更"
|
||||
- button "选择第 L12 行": "12"
|
||||
- text: export const n12 = 12
|
||||
- button "选择第 R12 行": "12"
|
||||
- text: export const n12 = 12
|
||||
- button "选择第 L13 行": "13"
|
||||
- text: export const n13 = 13
|
||||
- button "选择第 R13 行": "13"
|
||||
- text: export const n13 = 13
|
||||
- button "选择第 L14 行": "14"
|
||||
- text: export const n14 = 14
|
||||
- button "选择第 R14 行": "14"
|
||||
- text: export const n14 = 14
|
||||
- button "选择第 L15 行": "15"
|
||||
- text: export const n15 = 15
|
||||
- button "选择第 R15 行": "15"
|
||||
- text: export const n15 = 'fifteen'
|
||||
- button "选择第 L16 行": "16"
|
||||
- text: export const n16 = 16
|
||||
- button "选择第 R16 行": "16"
|
||||
- text: export const n16 = 16
|
||||
- button "选择第 L17 行": "17"
|
||||
- text: export const n17 = 17
|
||||
- button "选择第 R17 行": "17"
|
||||
- text: export const n17 = 17
|
||||
- button "选择第 L18 行": "18"
|
||||
- text: export const n18 = 18
|
||||
- button "选择第 R18 行": "18"
|
||||
- text: export const n18 = 18
|
||||
- button "其余未变更的行"
|
||||
- button "收起 package.json" [expanded]
|
||||
- text: package.json 新文件 +1 −0
|
||||
- checkbox "将 package.json 标记为已审阅"
|
||||
- button "package.json 的更多操作"
|
||||
- button "选择第 R1 行": "1"
|
||||
- text: "+ { \"name\": \"demo\" }"
|
||||
- separator "调整文件树宽度"
|
||||
- navigation "全部 6 个文件":
|
||||
- textbox "筛选文件…"
|
||||
- button "docs" [expanded]
|
||||
- button "docs/panel.md": panel.md +2 −0
|
||||
- button "docs/schema.json": schema.json +1 −0
|
||||
- button "locale" [expanded]
|
||||
- button "locale/zh.json": zh.json +1 −0
|
||||
- button "src" [expanded]
|
||||
- button "src/panel.spec.ts": panel.spec.ts +1 −0
|
||||
- button "src/panel.ts": panel.ts +2 −2
|
||||
- button "package.json": package.json +1 −0
|
||||
@@ -0,0 +1,81 @@
|
||||
- img "变更请求状态:需要处理"
|
||||
- text: "Add the pull request panel #7"
|
||||
- button "查看的提交:全部提交": 全部提交
|
||||
- button "提交评审"
|
||||
- button "在浏览器中打开"
|
||||
- radiogroup "分层透镜":
|
||||
- radio "全部 1" [checked]
|
||||
- radio "接口 0"
|
||||
- radio "实现 1"
|
||||
- radio "测试 0"
|
||||
- button "全部 1 个文件"
|
||||
- switch "隐藏测试文件"
|
||||
- button "筛选透镜:导出": 导出 1
|
||||
- button "笔记 0" [pressed]
|
||||
- progressbar "已审阅的文件": 已审阅 0 / 1
|
||||
- text: +2 −2
|
||||
- button "刷新变更"
|
||||
- button "全部折叠"
|
||||
- button "左右对比" [pressed]
|
||||
- button "自动换行" [pressed]
|
||||
- button "将文件树移到右侧" [expanded]
|
||||
- region "全部 1 个文件":
|
||||
- button "收起 panel.ts" [expanded]
|
||||
- text: src/panel.ts +2 −2
|
||||
- checkbox "将 panel.ts 标记为已审阅"
|
||||
- button "panel.ts 的更多操作"
|
||||
- button "选择第 L1 行": "1"
|
||||
- text: export const n1 = 1
|
||||
- button "选择第 R1 行": "1"
|
||||
- text: export const n1 = 1
|
||||
- button "选择第 L2 行": "2"
|
||||
- text: export const n2 = 2
|
||||
- button "选择第 R2 行": "2"
|
||||
- text: export const n2 = 'two'
|
||||
- button "选择第 L3 行": "3"
|
||||
- text: export const n3 = 3
|
||||
- button "选择第 R3 行": "3"
|
||||
- text: export const n3 = 3
|
||||
- button "选择第 L4 行": "4"
|
||||
- text: export const n4 = 4
|
||||
- button "选择第 R4 行": "4"
|
||||
- text: export const n4 = 4
|
||||
- button "选择第 L5 行": "5"
|
||||
- text: export const n5 = 5
|
||||
- button "选择第 R5 行": "5"
|
||||
- text: export const n5 = 5
|
||||
- button "6 行未变更"
|
||||
- button "选择第 L12 行": "12"
|
||||
- text: export const n12 = 12
|
||||
- button "选择第 R12 行": "12"
|
||||
- text: export const n12 = 12
|
||||
- button "选择第 L13 行": "13"
|
||||
- text: export const n13 = 13
|
||||
- button "选择第 R13 行": "13"
|
||||
- text: export const n13 = 13
|
||||
- button "选择第 L14 行": "14"
|
||||
- text: export const n14 = 14
|
||||
- button "选择第 R14 行": "14"
|
||||
- text: export const n14 = 14
|
||||
- button "选择第 L15 行": "15"
|
||||
- text: export const n15 = 15
|
||||
- button "选择第 R15 行": "15"
|
||||
- text: export const n15 = 'fifteen'
|
||||
- button "选择第 L16 行": "16"
|
||||
- text: export const n16 = 16
|
||||
- button "选择第 R16 行": "16"
|
||||
- text: export const n16 = 16
|
||||
- button "选择第 L17 行": "17"
|
||||
- text: export const n17 = 17
|
||||
- button "选择第 R17 行": "17"
|
||||
- text: export const n17 = 17
|
||||
- button "选择第 L18 行": "18"
|
||||
- text: export const n18 = 18
|
||||
- button "选择第 R18 行": "18"
|
||||
- text: export const n18 = 18
|
||||
- button "其余未变更的行"
|
||||
- separator "调整文件树宽度"
|
||||
- navigation "全部 1 个文件":
|
||||
- textbox "筛选文件…"
|
||||
- button "src" [expanded]
|
||||
- button "src/panel.ts": panel.ts +2 −2
|
||||
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* Client half of the forge extension fixture: the title of the Host lens, and notes pinned through every forge slot —
|
||||
* a comment form action pins a line note, a file menu row pins a file note, each note shows as a line annotation, a
|
||||
* toolbar toggle hides them, and a card button opens the change request's changes view with the lens chosen.
|
||||
*/
|
||||
window.__ModuleLoader__.load({
|
||||
id: '@fixture/forge-extension',
|
||||
factory(require) {
|
||||
const React = require('react')
|
||||
const { Button, MenuItemButton, Tooltip } = require('@deepseek-ai/dsh-client-ui-primitives')
|
||||
const h = React.createElement
|
||||
const NS = 'fixtureForge'
|
||||
return {
|
||||
inject: ['slots', 'locale', 'forgeChanges'],
|
||||
apply(ctx) {
|
||||
ctx.effect(() => ctx.locale.register(NS, {
|
||||
zh: {
|
||||
lens: '导出', pin: '钉为笔记', pinFile: '钉上文件笔记', fileNote: '已看过此文件', notes: '笔记 {count}', toggle: '显示或隐藏笔记',
|
||||
note: '笔记', remove: '移除', open: '打开导出视图',
|
||||
},
|
||||
en: {
|
||||
lens: 'Exports', pin: 'Pin as note', pinFile: 'Pin a file note', fileNote: 'Looked at this file', notes: 'Notes {count}',
|
||||
toggle: 'Show or hide notes', note: 'Note', remove: 'Remove', open: 'Open the exports view',
|
||||
},
|
||||
}))
|
||||
const t = ctx.locale.bind(NS)
|
||||
ctx.effect(() => ctx.forgeChanges.describeLens({ id: 'fixture/exports', title: () => t('lens') }))
|
||||
|
||||
// Notes of each changes view by address; the observable a view reads publishes nothing while its notes hide.
|
||||
const views = new Map()
|
||||
let sequence = 0
|
||||
const viewOf = (target) => {
|
||||
const address = ctx.forgeChanges.address(target)
|
||||
let view = views.get(address)
|
||||
if (view === undefined) {
|
||||
const listeners = new Set()
|
||||
const state = { notes: [], shown: true, snapshot: new Map() }
|
||||
const publish = () => {
|
||||
const byPath = new Map()
|
||||
if (state.shown) {
|
||||
for (const note of state.notes) byPath.set(note.path, [...(byPath.get(note.path) ?? []), note.annotation])
|
||||
}
|
||||
state.snapshot = byPath
|
||||
for (const listener of [...listeners]) listener()
|
||||
}
|
||||
view = {
|
||||
state,
|
||||
observable: {
|
||||
getSnapshot: () => state.snapshot,
|
||||
subscribe: (listener) => { listeners.add(listener); return () => { listeners.delete(listener) } },
|
||||
},
|
||||
add(path, place, text) {
|
||||
sequence += 1
|
||||
state.notes = [...state.notes, { path, text, annotation: { key: `note-${sequence}`, place, version: 1 } }]
|
||||
publish()
|
||||
},
|
||||
remove(key) {
|
||||
state.notes = state.notes.filter(note => note.annotation.key !== key)
|
||||
publish()
|
||||
},
|
||||
toggle() {
|
||||
state.shown = !state.shown
|
||||
publish()
|
||||
},
|
||||
textOf: key => state.notes.find(note => note.annotation.key === key)?.text ?? '',
|
||||
listeners,
|
||||
}
|
||||
views.set(address, view)
|
||||
}
|
||||
return view
|
||||
}
|
||||
ctx.effect(() => ctx.forgeChanges.registerAnnotations({ id: 'fixture-notes', observe: target => viewOf(target).observable }))
|
||||
|
||||
function useNotes(target) {
|
||||
const view = viewOf(target)
|
||||
React.useSyncExternalStore(view.observable.subscribe, view.observable.getSnapshot)
|
||||
return view
|
||||
}
|
||||
function NotesToggle({ target, form, close }) {
|
||||
const view = useNotes(target)
|
||||
const label = t('notes', { count: view.state.notes.length })
|
||||
if (form === 'menu') return h(MenuItemButton, { onSelect: () => { view.toggle(); close() } }, label)
|
||||
return h(Tooltip, { label: t('toggle'), side: 'bottom' },
|
||||
h('button', { type: 'button', 'data-fixture-notes-toggle': '', 'aria-pressed': view.state.shown, onClick: () => { view.toggle() },
|
||||
style: { height: 28, padding: '0 8px', border: 0, borderRadius: 8, background: 'transparent', color: 'inherit', font: 'inherit', cursor: 'pointer' } }, label))
|
||||
}
|
||||
function PinNote({ target, selection, empty, busy, send }) {
|
||||
return h(Button, { size: 'sm', variant: 'outline', disabled: empty || busy, 'data-fixture-pin': '',
|
||||
onClick: () => { send(async (body) => { viewOf(target).add(selection.path, { side: selection.side, startLine: selection.startLine, endLine: selection.endLine }, body); return undefined }) } },
|
||||
t('pin'))
|
||||
}
|
||||
function NoteBody({ target, annotation }) {
|
||||
const view = useNotes(target)
|
||||
return h('div', { style: { display: 'flex', alignItems: 'center', gap: 8, padding: '8px 12px' }, 'data-fixture-note': annotation.key },
|
||||
h('strong', { style: { fontWeight: 500 } }, t('note')),
|
||||
h('span', { style: { flex: 1, minWidth: 0 } }, view.textOf(annotation.key)),
|
||||
h(Button, { size: 'sm', variant: 'outline', onClick: () => { view.remove(annotation.key) } }, t('remove')))
|
||||
}
|
||||
function PinFileNote({ target, file, dismiss }) {
|
||||
return h(MenuItemButton, { onSelect: () => { viewOf(target).add(file.path, 'file', t('fileNote')); dismiss() } }, t('pinFile'))
|
||||
}
|
||||
function OpenExports({ url, ref, sessionId }) {
|
||||
if (ref === null) return null
|
||||
return h(Tooltip, { label: t('open'), side: 'top' },
|
||||
h('button', { type: 'button', 'aria-label': t('open'), 'data-fixture-open-exports': '',
|
||||
onClick: () => { ctx.forgeChanges.open({ sessionId, source: { kind: 'change', url } }, { lens: 'fixture/exports' }) },
|
||||
style: { width: 24, height: 24, border: 0, borderRadius: 6, background: 'transparent', color: 'inherit', cursor: 'pointer' } }, '⎇'))
|
||||
}
|
||||
ctx.slots.inject('forge.changes.toolbar', () => ctx.slots.register({ name: 'forge.changes.toolbar', id: 'fixture-notes', locale: NS }, NotesToggle))
|
||||
ctx.slots.inject('forge.diff.comment.actions', () => ctx.slots.register({ name: 'forge.diff.comment.actions', id: 'fixture-notes', locale: NS }, PinNote))
|
||||
ctx.slots.inject('forge.diff.line.annotation', () => ctx.slots.register({ name: 'forge.diff.line.annotation', key: 'fixture-notes', locale: NS }, NoteBody))
|
||||
ctx.slots.inject('forge.changes.file.menu', () => ctx.slots.register({ name: 'forge.changes.file.menu', id: 'fixture-notes', locale: NS }, PinFileNote))
|
||||
ctx.slots.inject('forge.change-request.card.actions', () => ctx.slots.register({ name: 'forge.change-request.card.actions', id: 'fixture-notes', locale: NS }, OpenExports))
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
- insert:
|
||||
- id: fixture-forge-extension
|
||||
name: '@fixture/forge-extension'
|
||||
@@ -0,0 +1,27 @@
|
||||
/** Host half of the forge extension fixture: a filter lens that keeps the files whose new side has `export` lines, about those lines. */
|
||||
export const name = '@fixture/forge-extension'
|
||||
export const inject = ['forgePanel']
|
||||
|
||||
/** @param {import('@deepseek-ai/cordis').Context} ctx */
|
||||
export function apply(ctx) {
|
||||
ctx.forgePanel.registerLens({
|
||||
id: 'fixture/exports',
|
||||
version: '1',
|
||||
async classify(input, signal) {
|
||||
const files = {}
|
||||
let done = 0
|
||||
for (const file of input.files) {
|
||||
const text = await input.text('new', file.path, signal)
|
||||
done += 1
|
||||
input.progress(done, input.files.length)
|
||||
if (text === null) continue
|
||||
const ranges = []
|
||||
text.split('\n').forEach((line, index) => {
|
||||
if (/^export\b/.test(line)) ranges.push({ start: index + 1, end: index + 1 })
|
||||
})
|
||||
if (ranges.length > 0) files[file.path] = { ranges: { old: [], new: ranges } }
|
||||
}
|
||||
return { files }
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@fixture/forge-extension",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./client": "./client.js"
|
||||
},
|
||||
"dsh": {
|
||||
"bundle": {
|
||||
"patch": "./cordis.patch.yml"
|
||||
},
|
||||
"client": {
|
||||
"platform": "web",
|
||||
"inject": [
|
||||
"@deepseek-ai/dsh-experimental-client-ui-forge"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ declare global {
|
||||
}
|
||||
|
||||
const BUNDLE = fileURLToPath(new URL('../../../packages/experimental/forge-bundle', import.meta.url))
|
||||
/** A plugin that uses the forge extension API: a Host lens, line annotations, and every forge slot. */
|
||||
const EXTENSION = fileURLToPath(new URL('./fixtures/plugins/fixture-forge-extension', import.meta.url))
|
||||
const FIXTURE = fileURLToPath(new URL('../../../snapshots/web/lifecycle-chrome/session.v4.jsonl', import.meta.url))
|
||||
const EXPECTED = fileURLToPath(new URL('./expected/forge-panel', import.meta.url))
|
||||
const MODE = webSnapshotMode()
|
||||
@@ -471,11 +473,19 @@ interface PanelLaunch {
|
||||
* Launch the bundle against a GitHub checkout of `main` and `release` and open the New Session screen of that workspace.
|
||||
* @param failureShot - name of the screenshot saved when the test fails.
|
||||
* @param scenario - normal conversation, a restoration follow-up, or a numbered PR lookup through `bash` or a PTC program.
|
||||
* @param options - desktop transport, checkout branch, browser input, sandbox runner availability, and diff output limit.
|
||||
* @param options - desktop transport, checkout branch, browser input, sandbox runner availability, diff output limit, and
|
||||
* whether the extension fixture plugin loads.
|
||||
* @returns the scaffold, page, and checkout.
|
||||
*/
|
||||
async function launchPanel(failureShot: string, scenario: 'normal' | 'follow-up' | 'reference' | 'ptc-reference' = 'normal',
|
||||
options: { desktop?: 'darwin' | 'win32'; branch?: string; hasTouch?: boolean; missingSandbox?: boolean; maxDiffBytes?: number } = {}): Promise<PanelLaunch> {
|
||||
options: {
|
||||
desktop?: 'darwin' | 'win32'
|
||||
branch?: string
|
||||
hasTouch?: boolean
|
||||
missingSandbox?: boolean
|
||||
maxDiffBytes?: number
|
||||
extension?: boolean
|
||||
} = {}): Promise<PanelLaunch> {
|
||||
const { desktop } = options
|
||||
const resources: { scaffold?: WebScaffold; browser?: Browser } = {}
|
||||
const root = await mkdtemp(join(tmpdir(), 'dsh-forge-panel-'))
|
||||
@@ -517,7 +527,7 @@ async function launchPanel(failureShot: string, scenario: 'normal' | 'follow-up'
|
||||
] }))
|
||||
}
|
||||
const scaffold = await launchWebScaffold({
|
||||
profile: { packages: [{ dir: BUNDLE, enabled: true }] },
|
||||
profile: { packages: [{ dir: BUNDLE, enabled: true }, ...options.extension === true ? [{ dir: EXTENSION, enabled: true }] : []] },
|
||||
extraOverlayPath: overlay,
|
||||
replayFixture: FIXTURE,
|
||||
...scenario !== 'normal' ? { replayOverride: override } : {},
|
||||
@@ -1946,6 +1956,65 @@ async function shownPaths(view: ReturnType<Page['locator']>): Promise<(string |
|
||||
return await view.locator('[data-forge-diff-file]').evaluateAll(sections => sections.map(section => section.getAttribute('data-forge-diff-file')))
|
||||
}
|
||||
|
||||
it.skipIf(MODE === 'record')('lets a plugin filter the changes by its lens, annotate lines and files, and act from the toolbar, comment form, and card', async () => {
|
||||
const { scaffold, page, root, tripwire } = await launchPanel('web-e2e-forge-extension', 'normal', { extension: true })
|
||||
await writeReviewFixture(root)
|
||||
// The plugin's lens keeps the export lines; past line 9 the head's src/panel.ts has none, so its second hunk folds.
|
||||
const contents = JSON.parse(await readFile(join(root, 'contents.json'), 'utf8')) as Record<string, string>
|
||||
contents[`src/panel.ts@${HEAD7}`] = `${Array.from({ length: 20 }, (_, index) => index < 9 ? panelLine(index + 1, 'new')
|
||||
: panelLine(index + 1, 'new').replace(/^export /, '')).join('\n')}\n`
|
||||
await writeFile(join(root, 'contents.json'), JSON.stringify(contents))
|
||||
const { settled } = await sendPrompt(page, scaffold)
|
||||
const session = scaffold.ctx.sessions.get(await settled)
|
||||
if (session === undefined) throw new Error('Session must stay loaded')
|
||||
scaffold.ctx.forgeSession.track(session, PULL)
|
||||
await page.locator('[data-forge-header]').click()
|
||||
|
||||
// The card button the plugin adds opens the changes view with its lens chosen.
|
||||
await page.locator(`[data-forge-change="${PULL}"]`).getByRole('button', { name: '打开导出视图', exact: true }).click()
|
||||
await page.getByRole('button', { name: '全屏', exact: true }).click()
|
||||
const view = page.locator('[data-forge-changes="change"]')
|
||||
const lens = view.locator('[data-forge-filter-lens]')
|
||||
await expect.poll(() => lens.getAttribute('data-forge-filter-lens'), { timeout: 20_000 }).toBe('fixture/exports')
|
||||
await expect.poll(() => shownPaths(view), { timeout: 20_000 }).toEqual(['src/panel.ts'])
|
||||
await expect.poll(() => lens.textContent()).toBe('导出1')
|
||||
const panel = view.locator('[data-forge-diff-file="src/panel.ts"]')
|
||||
const fold = panel.locator('[data-forge-lens-fold]')
|
||||
await expect.poll(() => fold.textContent()).toBe('另有 1 处与「导出」无关的改动已折叠展开')
|
||||
await fold.click()
|
||||
await expect.poll(() => fold.count()).toBe(0)
|
||||
await panel.locator('[data-review-code][data-new-line="15"]').waitFor()
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'extension-lens.expected.md'),
|
||||
await captureStableAria(page, '[data-forge-changes="change"]', scaffold.workspaceCwd), MODE)
|
||||
|
||||
await lens.click()
|
||||
await page.getByRole('menuitem', { name: '不使用透镜', exact: true }).click()
|
||||
await expect.poll(() => shownPaths(view)).toHaveLength(6)
|
||||
|
||||
// The comment form's plugin button pins the comment as a line note; the toolbar toggle hides and shows the notes.
|
||||
await panel.getByRole('button', { name: '选择第 R2 行', exact: true }).click()
|
||||
await panel.getByRole('button', { name: '添加评论', exact: true }).click()
|
||||
await panel.getByRole('textbox', { name: '留下评论…', exact: true }).fill('Check the quoted value')
|
||||
await panel.getByRole('button', { name: '钉为笔记', exact: true }).click()
|
||||
const note = panel.locator('[data-forge-annotation^="fixture-notes/"]')
|
||||
await expect.poll(() => note.textContent()).toBe('笔记Check the quoted value移除')
|
||||
const toggle = view.locator('[data-fixture-notes-toggle]')
|
||||
await expect.poll(() => toggle.textContent()).toBe('笔记 1')
|
||||
await toggle.click()
|
||||
await expect.poll(() => note.count()).toBe(0)
|
||||
await toggle.click()
|
||||
await expect.poll(() => note.count()).toBe(1)
|
||||
|
||||
// The file menu's plugin row pins a note on the whole file.
|
||||
const docs = view.locator('[data-forge-diff-file="docs/panel.md"]')
|
||||
await docs.getByRole('button', { name: 'panel.md 的更多操作', exact: true }).click()
|
||||
await page.getByRole('menuitem', { name: '钉上文件笔记', exact: true }).click()
|
||||
await expect.poll(() => docs.locator('[data-forge-annotation^="fixture-notes/"]').textContent()).toBe('笔记已看过此文件移除')
|
||||
await compareOrRefreshGolden(join(EXPECTED, 'extension-annotations.expected.md'),
|
||||
await captureStableAria(page, '[data-forge-changes="change"]', scaffold.workspaceCwd), MODE)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
|
||||
it.skipIf(MODE === 'record')('reviews a change request by layer, hides test files, marks files viewed, and views chosen commits', async () => {
|
||||
const { scaffold, page, root, tripwire } = await launchPanel('web-e2e-forge-review-layers')
|
||||
await writeReviewFixture(root)
|
||||
|
||||
+11
-2
@@ -1101,7 +1101,7 @@ export interface CotTranslationPreferences {
|
||||
## `@deepseek-ai/dsh-experimental-client-ui-forge`
|
||||
|
||||
- `inject`: `forge` · `forgeSession` · `sessionProjections` · `workingDirectory` · `fs` · `subprocess` · `sandbox` · `sandboxPolicy` · `agents`
|
||||
- `source`: [`packages/experimental/client-ui-forge/src/types.ts:381`](../packages/experimental/client-ui-forge/src/types.ts)
|
||||
- `source`: [`packages/experimental/client-ui-forge/src/types.ts:483`](../packages/experimental/client-ui-forge/src/types.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** Host settings of the forge panel Remote. */
|
||||
@@ -1148,6 +1148,14 @@ export interface Config {
|
||||
* request's update time does not change when a thread is resolved.
|
||||
*/
|
||||
reviewRefreshMs?: number
|
||||
/** Deadline in milliseconds for one lens `classify` call. */
|
||||
lensTimeoutMs?: number
|
||||
/** Most UTF-8 bytes of file text one lens `classify` call may read. */
|
||||
maxLensReadBytes?: number
|
||||
/** Most UTF-8 bytes, as JSON, of lens results kept in memory for later requests with the same files, lens, and lens version. */
|
||||
maxCachedLensBytes?: number
|
||||
/** Most line annotations a changes view shows in one file, across every annotation source. */
|
||||
maxAnnotationsPerFile?: number
|
||||
}
|
||||
```
|
||||
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-experimental-client-ui-forge -->
|
||||
@@ -1213,7 +1221,7 @@ export type SourceSigning = 'ad-hoc' | {
|
||||
|
||||
## `@deepseek-ai/dsh-experimental-forge`
|
||||
|
||||
- `source`: [`packages/experimental/forge/src/types.ts:588`](../packages/experimental/forge/src/types.ts)
|
||||
- `source`: [`packages/experimental/forge/src/types.ts:603`](../packages/experimental/forge/src/types.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** Poll cadence and fetch deadline for watched change requests. */
|
||||
@@ -5121,6 +5129,7 @@ These load from a `cordis.yml` entry with no `config:` block; they declare no co
|
||||
| `@deepseek-ai/dsh-client-ui-schedule` | — | [`packages/client/ui-schedule/src/index.ts`](../packages/client/ui-schedule/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-secret-mask` | — | [`packages/client/ui-secret-mask/src/index.ts`](../packages/client/ui-secret-mask/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-session` | — | [`packages/client/ui-session/src/index.ts`](../packages/client/ui-session/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-session-status` | — | [`packages/client/ui-session-status/src/index.ts`](../packages/client/ui-session-status/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-settings` | — | [`packages/client/ui-settings/src/index.ts`](../packages/client/ui-settings/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-settings-agent-loop` | — | [`packages/client/ui-settings-agent-loop/src/index.ts`](../packages/client/ui-settings-agent-loop/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-settings-general` | — | [`packages/client/ui-settings-general/src/index.ts`](../packages/client/ui-settings-general/src/index.ts) |
|
||||
|
||||
@@ -1103,7 +1103,7 @@ export interface CotTranslationPreferences {
|
||||
## `@deepseek-ai/dsh-experimental-client-ui-forge`
|
||||
|
||||
- `inject`: `forge` · `forgeSession` · `sessionProjections` · `workingDirectory` · `fs` · `subprocess` · `sandbox` · `sandboxPolicy` · `agents`
|
||||
- `source`: [`packages/experimental/client-ui-forge/src/types.ts:381`](../packages/experimental/client-ui-forge/src/types.ts)
|
||||
- `source`: [`packages/experimental/client-ui-forge/src/types.ts:483`](../packages/experimental/client-ui-forge/src/types.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** Host settings of the forge panel Remote. */
|
||||
@@ -1150,6 +1150,14 @@ export interface Config {
|
||||
* request's update time does not change when a thread is resolved.
|
||||
*/
|
||||
reviewRefreshMs?: number
|
||||
/** Deadline in milliseconds for one lens `classify` call. */
|
||||
lensTimeoutMs?: number
|
||||
/** Most UTF-8 bytes of file text one lens `classify` call may read. */
|
||||
maxLensReadBytes?: number
|
||||
/** Most UTF-8 bytes, as JSON, of lens results kept in memory for later requests with the same files, lens, and lens version. */
|
||||
maxCachedLensBytes?: number
|
||||
/** Most line annotations a changes view shows in one file, across every annotation source. */
|
||||
maxAnnotationsPerFile?: number
|
||||
}
|
||||
```
|
||||
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-experimental-client-ui-forge -->
|
||||
@@ -1215,7 +1223,7 @@ export type SourceSigning = 'ad-hoc' | {
|
||||
|
||||
## `@deepseek-ai/dsh-experimental-forge`
|
||||
|
||||
- `source`: [`packages/experimental/forge/src/types.ts:588`](../packages/experimental/forge/src/types.ts)
|
||||
- `source`: [`packages/experimental/forge/src/types.ts:603`](../packages/experimental/forge/src/types.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/** Poll cadence and fetch deadline for watched change requests. */
|
||||
@@ -5123,6 +5131,7 @@ export interface Config {
|
||||
| `@deepseek-ai/dsh-client-ui-schedule` | — | [`packages/client/ui-schedule/src/index.ts`](../packages/client/ui-schedule/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-secret-mask` | — | [`packages/client/ui-secret-mask/src/index.ts`](../packages/client/ui-secret-mask/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-session` | — | [`packages/client/ui-session/src/index.ts`](../packages/client/ui-session/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-session-status` | — | [`packages/client/ui-session-status/src/index.ts`](../packages/client/ui-session-status/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-settings` | — | [`packages/client/ui-settings/src/index.ts`](../packages/client/ui-settings/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-settings-agent-loop` | — | [`packages/client/ui-settings-agent-loop/src/index.ts`](../packages/client/ui-settings-agent-loop/src/index.ts) |
|
||||
| `@deepseek-ai/dsh-client-ui-settings-general` | — | [`packages/client/ui-settings-general/src/index.ts`](../packages/client/ui-settings-general/src/index.ts) |
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
/cookbook-extension-plugin-shapes/an-external-protocol-driver:
|
||||
en: fc5e0d074214eaaf
|
||||
zh: aac2bf67d6e7b30a
|
||||
/cookbook-extension-plugin-shapes/a-forge-review-extension:
|
||||
en: 63267f9317969d16
|
||||
zh: 9a0ce54da348509a
|
||||
/cookbook-extension-plugin-shapes/runnable-wirings:
|
||||
en: f0a28d07c0bb4d1b
|
||||
zh: 840962f512cb4031
|
||||
|
||||
@@ -91,6 +91,49 @@ export function apply(ctx: Context) {
|
||||
}
|
||||
```
|
||||
|
||||
## A forge review extension
|
||||
|
||||
Change request review opens to plugins through the [forge extension API](../subsystems/forge.md#extension-api). A Host plugin registers a filter lens, which keeps some of the files a changes view shows and names the lines it is about:
|
||||
|
||||
```ts
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import { brandString } from '@deepseek-ai/dsh-brand'
|
||||
import type { ForgeLensId } from '@deepseek-ai/dsh-experimental-client-ui-forge'
|
||||
|
||||
export const name = 'exports-lens'
|
||||
export const inject = ['forgePanel']
|
||||
|
||||
export function apply(ctx: Context) {
|
||||
// An effect of this plugin's fiber: unloading the plugin withdraws the lens and aborts its runs.
|
||||
ctx.forgePanel.registerLens({
|
||||
id: brandString<ForgeLensId>('example/exports'),
|
||||
version: '1',
|
||||
async classify(input, signal) {
|
||||
const files: Record<string, { ranges: { old: []; new: { start: number; end: number }[] } }> = {}
|
||||
for (const file of input.files) {
|
||||
const lines = (await input.text('new', file.path, signal))?.split('\n') ?? []
|
||||
const ranges = lines.flatMap((line, at) => line.startsWith('export') ? [{ start: at + 1, end: at + 1 }] : [])
|
||||
if (ranges.length > 0) files[file.path] = { ranges: { old: [], new: ranges } }
|
||||
}
|
||||
return { files }
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
A Client plugin names that lens and adds line annotations; `notesOf` returns one stable observable per view, and `NoteBody` is a module-scope component that draws one annotation inside the frame the view draws. The forge tests' [fixture plugin](../../apps/web/tests/fixtures/plugins/fixture-forge-extension/client.js) also uses the toolbar, file menu, comment form, and card slots.
|
||||
|
||||
```ts ignore-check
|
||||
export const inject = ['forgeChanges', 'slots']
|
||||
|
||||
export function apply(ctx: Context) {
|
||||
ctx.effect(() => ctx.forgeChanges.describeLens({ id: brandString<ForgeLensId>('example/exports'), title: () => 'Exports' }))
|
||||
ctx.effect(() => ctx.forgeChanges.registerAnnotations({ id: 'example-notes', observe: target => notesOf(target) }))
|
||||
ctx.slots.inject('forge.diff.line.annotation', () => ctx.slots.register(
|
||||
{ name: 'forge.diff.line.annotation', key: 'example-notes' }, NoteBody))
|
||||
}
|
||||
```
|
||||
|
||||
## Runnable wirings
|
||||
|
||||
Shipped applications contribute profile layers through `packages/bundle/*/cordis.patch.yml`, and the product `dsh` launcher owns Web, ACP, SDK, and one-shot headless execution through named profiles. Optional user-facing overlays live under `apps/cli/config/examples/`; profile integration tests live under `apps/cli/tests/profiles/`, while package-specific Loader compositions stay with their package tests.
|
||||
|
||||
@@ -93,6 +93,49 @@ export function apply(ctx: Context) {
|
||||
}
|
||||
```
|
||||
|
||||
## Forge 评审扩展
|
||||
|
||||
变更请求评审经由 [forge 扩展 API](../subsystems/forge.zh.md#extension-api) 向插件开放。Host 插件注册一个筛选透镜,它保留变更视图所显示文件中的一部分,并给出它关心的行:
|
||||
|
||||
```ts
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
import { brandString } from '@deepseek-ai/dsh-brand'
|
||||
import type { ForgeLensId } from '@deepseek-ai/dsh-experimental-client-ui-forge'
|
||||
|
||||
export const name = 'exports-lens'
|
||||
export const inject = ['forgePanel']
|
||||
|
||||
export function apply(ctx: Context) {
|
||||
// An effect of this plugin's fiber: unloading the plugin withdraws the lens and aborts its runs.
|
||||
ctx.forgePanel.registerLens({
|
||||
id: brandString<ForgeLensId>('example/exports'),
|
||||
version: '1',
|
||||
async classify(input, signal) {
|
||||
const files: Record<string, { ranges: { old: []; new: { start: number; end: number }[] } }> = {}
|
||||
for (const file of input.files) {
|
||||
const lines = (await input.text('new', file.path, signal))?.split('\n') ?? []
|
||||
const ranges = lines.flatMap((line, at) => line.startsWith('export') ? [{ start: at + 1, end: at + 1 }] : [])
|
||||
if (ranges.length > 0) files[file.path] = { ranges: { old: [], new: ranges } }
|
||||
}
|
||||
return { files }
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
Client 插件给这个透镜起名并添加行注解;`notesOf` 为每个视图返回一个稳定的可观察对象,`NoteBody` 是模块级组件,在视图所画的外框中绘制一条注解。forge 测试的[夹具插件](../../apps/web/tests/fixtures/plugins/fixture-forge-extension/client.js)还用到了工具栏、文件菜单、评论框和卡片的 slot。
|
||||
|
||||
```ts ignore-check
|
||||
export const inject = ['forgeChanges', 'slots']
|
||||
|
||||
export function apply(ctx: Context) {
|
||||
ctx.effect(() => ctx.forgeChanges.describeLens({ id: brandString<ForgeLensId>('example/exports'), title: () => 'Exports' }))
|
||||
ctx.effect(() => ctx.forgeChanges.registerAnnotations({ id: 'example-notes', observe: target => notesOf(target) }))
|
||||
ctx.slots.inject('forge.diff.line.annotation', () => ctx.slots.register(
|
||||
{ name: 'forge.diff.line.annotation', key: 'example-notes' }, NoteBody))
|
||||
}
|
||||
```
|
||||
|
||||
## 可运行的组装示例
|
||||
|
||||
交付应用通过 `packages/bundle/*/cordis.patch.yml` 提供 profile 层,产品 `dsh` 启动器通过具名 profile 负责 Web、ACP、SDK 与一次性 headless 执行。可选的用户 overlay 位于 `apps/cli/config/examples/`;profile 集成测试位于 `apps/cli/tests/profiles/`,包专属 Loader 组合则留在对应包的测试目录中。
|
||||
|
||||
@@ -47,7 +47,8 @@ Application listeners are outside this package matrix. Desktop Host subscribes t
|
||||
| `deepseek-account/signed-out` | `emit` | [`packages/credentials/deepseek-account/src/index.ts:29`](../packages/credentials/deepseek-account/src/index.ts) | [`deepseek-account`](../packages/credentials/deepseek-account) (`emit`) | [`deepseek-account`](../packages/credentials/deepseek-account) |
|
||||
| `domain/changed` | `emit` | [`packages/storage/storage-domain/src/events.ts:46`](../packages/storage/storage-domain/src/events.ts) | [`storage-domain`](../packages/storage/storage-domain) (`emit`) | `workspace-controller` |
|
||||
| `feedback/committed` | `parallel` | [`packages/feedback/message-feedback/src/index.ts:58`](../packages/feedback/message-feedback/src/index.ts) | [`message-feedback`](../packages/feedback/message-feedback) (`parallel`) | [`session-telemetry-otel`](../packages/session/session-telemetry-otel) |
|
||||
| `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:29`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `forge-session` |
|
||||
| `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:30`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `forge-session` |
|
||||
| `forge/review-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:39`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge` |
|
||||
| `fs/delete-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:83`](../packages/fs/fs/src/index.ts) | [`tool-fs`](../packages/fs/tool-fs) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) |
|
||||
| `fs/edit-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:75`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) |
|
||||
| `fs/observed` | `emit` | [`packages/fs/fs/src/index.ts:93`](../packages/fs/fs/src/index.ts) | `liveshare` (`emit`), [`tool-fs`](../packages/fs/tool-fs) (`emit`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`emit`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`skill-filesystem`](../packages/skill/skill-filesystem), `workspace-files` |
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
| `deepseek-account/signed-out` | `emit` | [`packages/credentials/deepseek-account/src/index.ts:29`](../packages/credentials/deepseek-account/src/index.ts) | [`deepseek-account`](../packages/credentials/deepseek-account) (`emit`) | [`deepseek-account`](../packages/credentials/deepseek-account) |
|
||||
| `domain/changed` | `emit` | [`packages/storage/storage-domain/src/events.ts:46`](../packages/storage/storage-domain/src/events.ts) | [`storage-domain`](../packages/storage/storage-domain) (`emit`) | `workspace-controller` |
|
||||
| `feedback/committed` | `parallel` | [`packages/feedback/message-feedback/src/index.ts:58`](../packages/feedback/message-feedback/src/index.ts) | [`message-feedback`](../packages/feedback/message-feedback) (`parallel`) | [`session-telemetry-otel`](../packages/session/session-telemetry-otel) |
|
||||
| `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:29`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `forge-session` |
|
||||
| `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:30`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `forge-session` |
|
||||
| `forge/review-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:39`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge` |
|
||||
| `fs/delete-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:83`](../packages/fs/fs/src/index.ts) | [`tool-fs`](../packages/fs/tool-fs) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) |
|
||||
| `fs/edit-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:75`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) |
|
||||
| `fs/observed` | `emit` | [`packages/fs/fs/src/index.ts:93`](../packages/fs/fs/src/index.ts) | `liveshare` (`emit`), [`tool-fs`](../packages/fs/tool-fs) (`emit`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`emit`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`skill-filesystem`](../packages/skill/skill-filesystem), `workspace-files` |
|
||||
|
||||
@@ -193,6 +193,7 @@ flowchart TD
|
||||
pkg_client_ui_schedule["client-ui-schedule"]
|
||||
pkg_client_ui_secret_mask["client-ui-secret-mask"]
|
||||
pkg_client_ui_session["client-ui-session"]
|
||||
pkg_client_ui_session_status["client-ui-session-status"]
|
||||
pkg_client_ui_settings["client-ui-settings"]
|
||||
pkg_client_ui_settings_account["client-ui-settings-account"]
|
||||
pkg_client_ui_settings_agent_loop["client-ui-settings-agent-loop"]
|
||||
@@ -1521,6 +1522,7 @@ flowchart TD
|
||||
pkg_client_test_runtime --> pkg_client_ui_conversation
|
||||
pkg_client_test_runtime --> pkg_client_ui_renderer
|
||||
pkg_client_test_runtime --> pkg_client_ui_session
|
||||
pkg_client_test_runtime --> pkg_client_ui_session_status
|
||||
pkg_client_test_runtime --> pkg_client_ui_settings
|
||||
pkg_client_test_runtime --> pkg_client_ui_slots
|
||||
pkg_client_test_runtime --> pkg_client_web
|
||||
@@ -1634,6 +1636,7 @@ flowchart TD
|
||||
| [`client-ui-schedule`](../packages/client/ui-schedule) | `client` | — |
|
||||
| [`client-ui-secret-mask`](../packages/client/ui-secret-mask) | `client` | — |
|
||||
| [`client-ui-session`](../packages/client/ui-session) | `client` | — |
|
||||
| [`client-ui-session-status`](../packages/client/ui-session-status) | `client` | — |
|
||||
| [`client-ui-settings`](../packages/client/ui-settings) | `client` | — |
|
||||
| [`client-ui-settings-account`](../packages/client/ui-settings-account) | `client` | — |
|
||||
| [`client-ui-settings-agent-loop`](../packages/client/ui-settings-agent-loop) | `client` | — |
|
||||
@@ -1928,7 +1931,7 @@ flowchart TD
|
||||
| [`schedule`](../packages/schedule/schedule) | `schedule` | [`agent`](../packages/core/agent), [`api-session-controller`](../packages/api/session-controller), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`storage-domain`](../packages/storage/storage-domain), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`util-time`](../packages/util/time), [`workspace`](../packages/workspace/workspace) |
|
||||
| [`sdk-client`](../packages/sdk/client) | `sdk` | [`llm`](../packages/llm/llm), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session) |
|
||||
| [`tool-agent-team`](../packages/team/tool-agent-team) | `team` | [`agent`](../packages/core/agent), [`agent-team`](../packages/team/agent-team), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
|
||||
| [`client-test-runtime`](../packages/test-support/client-runtime) | `test-support` | [`api-gateway`](../packages/api/gateway), [`api-session-controller`](../packages/api/session-controller), [`api-workspace-controller`](../packages/api/workspace-controller), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-hmr`](../packages/client/hmr), [`client-modules`](../packages/client/modules), [`client-store`](../packages/client/store), [`client-ui-chat`](../packages/client/ui-chat), [`client-ui-context-menu`](../packages/client/ui-context-menu), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-renderer`](../packages/client/ui-renderer), [`client-ui-session`](../packages/client/ui-session), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slots`](../packages/client/ui-slots), [`client-web`](../packages/client/web), [`remote-mock`](../packages/test-support/remote-mock), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
|
||||
| [`client-test-runtime`](../packages/test-support/client-runtime) | `test-support` | [`api-gateway`](../packages/api/gateway), [`api-session-controller`](../packages/api/session-controller), [`api-workspace-controller`](../packages/api/workspace-controller), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-hmr`](../packages/client/hmr), [`client-modules`](../packages/client/modules), [`client-store`](../packages/client/store), [`client-ui-chat`](../packages/client/ui-chat), [`client-ui-context-menu`](../packages/client/ui-context-menu), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-renderer`](../packages/client/ui-renderer), [`client-ui-session`](../packages/client/ui-session), [`client-ui-session-status`](../packages/client/ui-session-status), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slots`](../packages/client/ui-slots), [`client-web`](../packages/client/web), [`remote-mock`](../packages/test-support/remote-mock), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
|
||||
| [`subagent-dsh-sdk`](../packages/subagent/subagent-dsh-sdk) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`sdk-client`](../packages/sdk/client), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subprocess`](../packages/subprocess/subprocess) |
|
||||
| [`tool-schedule`](../packages/schedule/tool-schedule) | `schedule` | [`llm`](../packages/llm/llm), [`schedule`](../packages/schedule/schedule), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
|
||||
| [`sdk-jsonrpc-server`](../packages/sdk/server) | `sdk` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`commands`](../packages/interaction/commands), [`goal`](../packages/goal/goal), [`llm`](../packages/llm/llm), [`llm-deepseek-api-key`](../packages/llm/llm-deepseek-api-key), [`schedule`](../packages/schedule/schedule), [`scope`](../packages/core/scope), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`user-approval`](../packages/interaction/user-approval), [`user-questions`](../packages/interaction/user-questions), [`working-directory`](../packages/session/working-directory) |
|
||||
|
||||
@@ -195,6 +195,7 @@ flowchart TD
|
||||
pkg_client_ui_schedule["client-ui-schedule"]
|
||||
pkg_client_ui_secret_mask["client-ui-secret-mask"]
|
||||
pkg_client_ui_session["client-ui-session"]
|
||||
pkg_client_ui_session_status["client-ui-session-status"]
|
||||
pkg_client_ui_settings["client-ui-settings"]
|
||||
pkg_client_ui_settings_account["client-ui-settings-account"]
|
||||
pkg_client_ui_settings_agent_loop["client-ui-settings-agent-loop"]
|
||||
@@ -1523,6 +1524,7 @@ flowchart TD
|
||||
pkg_client_test_runtime --> pkg_client_ui_conversation
|
||||
pkg_client_test_runtime --> pkg_client_ui_renderer
|
||||
pkg_client_test_runtime --> pkg_client_ui_session
|
||||
pkg_client_test_runtime --> pkg_client_ui_session_status
|
||||
pkg_client_test_runtime --> pkg_client_ui_settings
|
||||
pkg_client_test_runtime --> pkg_client_ui_slots
|
||||
pkg_client_test_runtime --> pkg_client_web
|
||||
@@ -1636,6 +1638,7 @@ flowchart TD
|
||||
| [`client-ui-schedule`](../packages/client/ui-schedule) | `client` | — |
|
||||
| [`client-ui-secret-mask`](../packages/client/ui-secret-mask) | `client` | — |
|
||||
| [`client-ui-session`](../packages/client/ui-session) | `client` | — |
|
||||
| [`client-ui-session-status`](../packages/client/ui-session-status) | `client` | — |
|
||||
| [`client-ui-settings`](../packages/client/ui-settings) | `client` | — |
|
||||
| [`client-ui-settings-account`](../packages/client/ui-settings-account) | `client` | — |
|
||||
| [`client-ui-settings-agent-loop`](../packages/client/ui-settings-agent-loop) | `client` | — |
|
||||
@@ -1930,7 +1933,7 @@ flowchart TD
|
||||
| [`schedule`](../packages/schedule/schedule) | `schedule` | [`agent`](../packages/core/agent), [`api-session-controller`](../packages/api/session-controller), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`session-projection`](../packages/session/session-projection), [`storage-domain`](../packages/storage/storage-domain), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`typert-protocol`](../packages/typert/protocol), [`util-time`](../packages/util/time), [`workspace`](../packages/workspace/workspace) |
|
||||
| [`sdk-client`](../packages/sdk/client) | `sdk` | [`llm`](../packages/llm/llm), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session) |
|
||||
| [`tool-agent-team`](../packages/team/tool-agent-team) | `team` | [`agent`](../packages/core/agent), [`agent-team`](../packages/team/agent-team), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
|
||||
| [`client-test-runtime`](../packages/test-support/client-runtime) | `test-support` | [`api-gateway`](../packages/api/gateway), [`api-session-controller`](../packages/api/session-controller), [`api-workspace-controller`](../packages/api/workspace-controller), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-hmr`](../packages/client/hmr), [`client-modules`](../packages/client/modules), [`client-store`](../packages/client/store), [`client-ui-chat`](../packages/client/ui-chat), [`client-ui-context-menu`](../packages/client/ui-context-menu), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-renderer`](../packages/client/ui-renderer), [`client-ui-session`](../packages/client/ui-session), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slots`](../packages/client/ui-slots), [`client-web`](../packages/client/web), [`remote-mock`](../packages/test-support/remote-mock), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
|
||||
| [`client-test-runtime`](../packages/test-support/client-runtime) | `test-support` | [`api-gateway`](../packages/api/gateway), [`api-session-controller`](../packages/api/session-controller), [`api-workspace-controller`](../packages/api/workspace-controller), [`attachment`](../packages/attachment/attachment), [`client-connection`](../packages/client/connection), [`client-hmr`](../packages/client/hmr), [`client-modules`](../packages/client/modules), [`client-store`](../packages/client/store), [`client-ui-chat`](../packages/client/ui-chat), [`client-ui-context-menu`](../packages/client/ui-context-menu), [`client-ui-conversation`](../packages/client/ui-conversation), [`client-ui-renderer`](../packages/client/ui-renderer), [`client-ui-session`](../packages/client/ui-session), [`client-ui-session-status`](../packages/client/ui-session-status), [`client-ui-settings`](../packages/client/ui-settings), [`client-ui-slots`](../packages/client/ui-slots), [`client-web`](../packages/client/web), [`remote-mock`](../packages/test-support/remote-mock), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`typert-protocol`](../packages/typert/protocol) |
|
||||
| [`subagent-dsh-sdk`](../packages/subagent/subagent-dsh-sdk) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`sdk-client`](../packages/sdk/client), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subprocess`](../packages/subprocess/subprocess) |
|
||||
| [`tool-schedule`](../packages/schedule/tool-schedule) | `schedule` | [`llm`](../packages/llm/llm), [`schedule`](../packages/schedule/schedule), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
|
||||
| [`sdk-jsonrpc-server`](../packages/sdk/server) | `sdk` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`commands`](../packages/interaction/commands), [`goal`](../packages/goal/goal), [`llm`](../packages/llm/llm), [`llm-deepseek-api-key`](../packages/llm/llm-deepseek-api-key), [`schedule`](../packages/schedule/schedule), [`scope`](../packages/core/scope), [`sdk-protocol`](../packages/sdk/protocol), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`user-approval`](../packages/interaction/user-approval), [`user-questions`](../packages/interaction/user-questions), [`working-directory`](../packages/session/working-directory) |
|
||||
|
||||
@@ -24,5 +24,8 @@
|
||||
en: 13dfd36f2166bba0
|
||||
zh: a369434f52f04d57
|
||||
/forges/panel:
|
||||
en: 0e0348e9a38215ed
|
||||
zh: affcc0231e15d682
|
||||
en: 7dcefe2825490257
|
||||
zh: 38cec4d1ae3b0d6e
|
||||
/forges/extension-api:
|
||||
en: f35345e482e84f4f
|
||||
zh: 2ecb7d9498decb31
|
||||
+197
-3
@@ -101,6 +101,12 @@ interface ForgeProvider {
|
||||
* with `a/` and `b/` path prefixes. Both are full object names; `head` descends from `base`.
|
||||
*/
|
||||
compare?(ref: ChangeRequestRef, base: string, head: string, signal: AbortSignal): Promise<string | ForgeFailure>
|
||||
/**
|
||||
* Find the merge base of commits `base` and `head` in the change request's repository, as a full object name: the
|
||||
* commit whose files the old side of a change request's diff shows. Omission declares that the provider cannot name
|
||||
* it, so readers of the old side get `unsupported`.
|
||||
*/
|
||||
mergeBase?(ref: ChangeRequestRef, base: string, head: string, signal: AbortSignal): Promise<string | ForgeFailure>
|
||||
/**
|
||||
* Read the signed-in user's viewed marks on the change request's files at head commit `headSha`. The marks are
|
||||
* returned only when the read names `headSha` as the head; once the head is another commit, the read resolves to a
|
||||
@@ -928,6 +934,11 @@ interface ForgePanelWorktree {
|
||||
interface ForgePanelChangeRequest extends SessionChangeRequest {
|
||||
/** Latest snapshot a poll returned, kept while later polls fail, or null before the first successful poll. */
|
||||
readonly snapshot: ChangeRequestSnapshot | null
|
||||
/**
|
||||
* Number of review changes `forge/review-changed` announced for the change request since the panel host started; it
|
||||
* grows when any plugin's write is accepted, so a reader shows threads and viewed marks read after it.
|
||||
*/
|
||||
readonly reviewRevision: number
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1187,6 +1198,120 @@ interface ForgeLocalChanges {
|
||||
}
|
||||
```
|
||||
|
||||
<a id="extension-api"></a>
|
||||
|
||||
## Extension API
|
||||
|
||||
Other plugins extend change request review through the services above and five more extension points; each registration returns its disposer and ends with the plugin that made it. The surface is experimental and pre-stable like the rest of this capability. Adding an optional field, method, slot, event, error code, or defaulted Config key is compatible; removing or renaming a type, method, slot, owner prop, event, Config key, or the `dsh-resource://forge-changes/` address, or narrowing what one means, needs an [upgrade guide](../../.agents/skills/dsh-create-upgrade-guide/SKILL.md). None of these extension points sends anything to a model: a plugin that shows forge data, lens results, or annotations to a model does so through its own tool results or `agent.inject()`, which the Session log records.
|
||||
|
||||
| Extension point | Service Definition | Service Provider | Consumer |
|
||||
|---|---|---|---|
|
||||
| Review data | `ctx.forge` and the `forge/review-changed` event | The forge providers | The panel host and other Host plugins |
|
||||
| Filter lenses | `ctx.forgePanel.registerLens` | Host plugins | The changes view through `changesLens` |
|
||||
| Changes view face | `ctx.forgeChanges` | The forge panel's Client plugin | Client plugins that open views, name lenses, and add annotations |
|
||||
| Slots | `forge.changes.toolbar`, `forge.changes.file.menu`, `forge.diff.line.annotation`, `forge.diff.comment.actions`, `forge.change-request.card.actions` | Client plugins | The changes view and the change request card |
|
||||
| Session data | The `forgeChangeRequests` and `forgeWorktree` projections | forge-session and the forge panel | Client plugins through `useProjection`, Host plugins through `ctx.forgeSession.changeRequests` or `ctx.sessionProjections.snapshot` |
|
||||
|
||||
`ctx.forge` announces `forge/review-changed` after a review write, a submitted review, or a viewed mark the host accepted, whichever plugin made it; an outcome that is unknown, refused, stale, or unsupported is not announced. The panel host then drops the threads it keeps for the change request and raises `reviewRevision` on its entries, so an open changes view reads the threads and the viewed marks again without a refresh.
|
||||
|
||||
```ts type-equiv
|
||||
/**
|
||||
* One review change the host accepted, which `forge/review-changed` announces: a write to the threads or the pending
|
||||
* review, a submitted review, or a viewed mark. Each names the head commit the change was made against.
|
||||
*/
|
||||
type ForgeReviewChange =
|
||||
| { readonly kind: 'write'; readonly write: ForgeReviewWrite['kind']; readonly headSha: string }
|
||||
| { readonly kind: 'submit'; readonly headSha: string }
|
||||
| { readonly kind: 'viewed'; readonly path: string; readonly viewed: boolean; readonly headSha: string }
|
||||
```
|
||||
|
||||
A Host plugin registers a filter lens with `ctx.forgePanel.registerLens(lens)`, and a Client plugin names it with `ctx.forgeChanges.describeLens({ id, title })`; a lens without a description shows its identity. A lens filters the shown files and does not place them in layers: the changes view shows the files that both the chosen layer and the chosen lens keep, the test switch still hides test files, and a lens cannot move a file to another layer. Hunks that meet none of a kept file's `ranges` fold into one row the reader can expand. The view asks for the chosen lens only, through the streaming Remote `changesLens`, which reads the same files as the view, refuses other files with `forgePanel/lens-stale`, and runs `classify` within `lensTimeoutMs` and `maxLensReadBytes`; results are kept up to `maxCachedLensBytes`. `text` reads a local old side at the fork point, HEAD, the index, or the parent of the first chosen commit, and a change request's old side at the chosen commits' parent or at the merge base its provider names through the optional `mergeBase`.
|
||||
|
||||
```ts type-equiv
|
||||
/** A filter over the files of a changes view, which a plugin registers with `ctx.forgePanel.registerLens()`. */
|
||||
interface ForgeLens {
|
||||
/** Identity the plugin chooses; one registration holds an id at a time. */
|
||||
readonly id: ForgeLensId
|
||||
/** Changes whenever `classify` may answer differently for the same input, which drops results kept under another version. */
|
||||
readonly version: string
|
||||
/**
|
||||
* Decide which files the lens keeps and which lines it is about. The signal aborts when the reader stops waiting, the
|
||||
* registration ends, or `lensTimeoutMs` passes; a rejection fails the request without a partial result.
|
||||
*/
|
||||
classify(input: ForgeLensInput, signal: AbortSignal): Promise<ForgeLensResult>
|
||||
}
|
||||
```
|
||||
|
||||
```ts type-equiv
|
||||
/** What one `classify` call receives. */
|
||||
interface ForgeLensInput {
|
||||
/** What the view shows. */
|
||||
readonly source: ForgeLensSource
|
||||
/** Every file of the diff in display order, with the layer the panel gave it. */
|
||||
readonly files: readonly ForgeLensFile[]
|
||||
/**
|
||||
* Read one side of a file of `files`, by its `path`: the old side reads `previousPath` for a renamed file. Resolves to
|
||||
* null when the side does not exist, as the old side of an added file, or holds binary content. Rejects for a path not
|
||||
* in `files`, once the reads of one call exceed the panel's `maxLensReadBytes`, for an old side the provider cannot
|
||||
* locate, and when the read fails.
|
||||
*/
|
||||
text(side: 'old' | 'new', path: string, signal: AbortSignal): Promise<string | null>
|
||||
/** Report how many of `total` units the lens finished; the changes view shows it while the lens runs. */
|
||||
progress(done: number, total: number): void
|
||||
}
|
||||
```
|
||||
|
||||
```ts type-equiv
|
||||
/** The files a lens keeps, by path; a file the result does not name is filtered out. */
|
||||
interface ForgeLensResult {
|
||||
readonly files: Readonly<Record<string, ForgeLensKeep>>
|
||||
}
|
||||
```
|
||||
|
||||
```ts type-equiv
|
||||
/** What a lens keeps of one file. */
|
||||
interface ForgeLensKeep {
|
||||
/**
|
||||
* Lines the lens is about on each side; hunks that touch none of them fold into one row the reader can expand.
|
||||
* Omitted: every hunk of the file shows.
|
||||
*/
|
||||
readonly ranges?: { readonly old: readonly ForgeLineRange[]; readonly new: readonly ForgeLineRange[] }
|
||||
}
|
||||
```
|
||||
|
||||
`ctx.forgeChanges` also mints and reads changes addresses, names the tab `kinds`, and opens a view with `open(target, { path, lens })` in the Session the sidebar shows. `registerAnnotations(source)` adds line annotations: the source observes each view's annotations by path, and its `forge.diff.line.annotation` entry, keyed by the source's identity, draws each one inside a frame the view draws. Annotations stack on the row of their last line after the comment form, the browser drafts, and the host threads, in the column of their side; whole-file annotations come first, and those written on another `digest` follow the file in their own section. A file shows at most `maxAnnotationsPerFile`, and a file that draws its lines draws no annotation before its section comes within reach of the scrollport. The owner props of every slot live in [`src/client/slots.ts`](../../packages/experimental/client-ui-forge/src/client/slots.ts).
|
||||
|
||||
```ts type-equiv
|
||||
/** Where one line annotation sits in a file of a changes view. */
|
||||
interface ForgeLineAnnotation {
|
||||
/** Identity within its source, stable across updates; it keys the drawn entry. */
|
||||
readonly key: string
|
||||
/** Inclusive 1-based lines on the old (`L`) or new (`R`) side, or `file` for the whole file. */
|
||||
readonly place: { readonly side: 'L' | 'R'; readonly startLine: number; readonly endLine: number } | 'file'
|
||||
/** Digest of the file change it was written on; a file whose `digest` differs shows it in its outdated section. */
|
||||
readonly digest?: string
|
||||
/** Changes whenever the entry should draw again; equal keys and versions keep the drawn entry's props. */
|
||||
readonly version: string | number
|
||||
}
|
||||
```
|
||||
|
||||
```ts type-equiv
|
||||
/** A Client plugin's line annotations, drawn through its `forge.diff.line.annotation` entry. */
|
||||
interface ForgeAnnotationSource {
|
||||
/** Unique source identity, also the key of its `forge.diff.line.annotation` entry. */
|
||||
readonly id: string
|
||||
/** Position among sources in one stack, lower first; equal positions keep registration order. Default 0. */
|
||||
readonly order?: number
|
||||
/**
|
||||
* Observe the annotations of one view, by path. The changes view calls it once per view and source registration;
|
||||
* the source republishes through the same observable whenever the annotations change.
|
||||
* @param target - the view's Session and source.
|
||||
* @returns annotations by repository-relative path.
|
||||
*/
|
||||
observe(target: ChangesTarget): HostObservable<ReadonlyMap<string, readonly ForgeLineAnnotation[]>>
|
||||
}
|
||||
```
|
||||
|
||||
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
||||
|
||||
<a id="cordis-surface"></a>
|
||||
@@ -1355,7 +1480,7 @@ async readReview(ref: ChangeRequestRef, headSha: string, signal: AbortSignal): P
|
||||
/**
|
||||
* Write to the review threads or the pending review of a change request while its head is still `write.headSha`, then
|
||||
* poll the change request at once when it is watched, unless the provider cannot write reviews. A `stale` result polls
|
||||
* it as a stale read does.
|
||||
* it as a stale read does; a write the host took is announced with `forge/review-changed`.
|
||||
* @param ref - change request served by a registered provider.
|
||||
* @param write - the write and the head commit the user saw.
|
||||
* @param signal - cancellation of the write.
|
||||
@@ -1379,7 +1504,8 @@ async viewedFiles(ref: ChangeRequestRef, headSha: string, signal: AbortSignal):
|
||||
|
||||
/**
|
||||
* Set or clear the signed-in user's viewed mark on one file of a change request while its head is still
|
||||
* `request.headSha`. A `stale` failure polls a watched change request again as {@link ForgeService.diff} does.
|
||||
* `request.headSha`. A `stale` failure polls a watched change request again as {@link ForgeService.diff} does; a saved
|
||||
* mark is announced with `forge/review-changed`.
|
||||
* @param ref - change request served by a registered provider.
|
||||
* @param request - the file, its mark, and the head commit the user saw.
|
||||
* @param signal - cancellation of the request.
|
||||
@@ -1410,7 +1536,21 @@ async commits(ref: ChangeRequestRef, signal: AbortSignal): Promise<ForgeCommitLi
|
||||
async compare(ref: ChangeRequestRef, base: string, head: string, signal: AbortSignal): Promise<string | ForgeFailure>
|
||||
|
||||
/**
|
||||
* Publish one comment or a completed review, then refresh the watched status.
|
||||
* Find the merge base of two commits of a change request's repository: the commit whose files the old side of the
|
||||
* change request's diff shows when `base` is the snapshot's `baseSha` and `head` its `headSha`.
|
||||
* @param ref - change request served by a registered provider.
|
||||
* @param base - full object name of the base commit.
|
||||
* @param head - full object name of the head commit.
|
||||
* @param signal - cancellation of the read.
|
||||
* @returns the merge base's full object name, or why the host did not provide it; `unsupported` when the provider
|
||||
* cannot name merge bases.
|
||||
* @throws when no provider serves the change request's forge, or with `signal.reason` when it aborts.
|
||||
*/
|
||||
async mergeBase(ref: ChangeRequestRef, base: string, head: string, signal: AbortSignal): Promise<string | ForgeFailure>
|
||||
|
||||
/**
|
||||
* Publish one comment or a completed review, then refresh the watched status; a publication the host took is announced
|
||||
* with `forge/review-changed`.
|
||||
* @param ref - change request served by a registered provider.
|
||||
* @param request - explicitly selected commit, comments, and review decision.
|
||||
* @param signal - request cancellation.
|
||||
@@ -1658,6 +1798,40 @@ Serves the forge panel. Following a Session inspects the checkout of its current
|
||||
*/
|
||||
@Remote async changeRequestText(session: Session, url: string, commit: string, path: string, signal: AbortSignal): Promise<string>
|
||||
|
||||
/**
|
||||
* Register a filter lens as an effect on the calling fiber. The changes views list it while it is registered; ending
|
||||
* the registration aborts its running classifications and waits for them.
|
||||
* @param lens - the lens.
|
||||
* @returns the disposer that unregisters the lens and waits for its classifications to stop.
|
||||
* @throws when another registration holds `lens.id`.
|
||||
*/
|
||||
registerLens(lens: ForgeLens): () => Promise<void>
|
||||
|
||||
/**
|
||||
* Stream the facts every changes view reads about the panel's extensions: the current facts first, then the facts
|
||||
* after each lens registration or withdrawal. The stream ends when `signal` aborts or the Remote stops.
|
||||
* @param signal - ends the stream.
|
||||
* @returns the registered lenses and the annotation limit, in publication order.
|
||||
*/
|
||||
@Remote({ mode: 'stream' }) async *extensions(signal: AbortSignal): AsyncIterable<ForgeExtensionState>
|
||||
|
||||
/**
|
||||
* Classify the files a changes view of a Session shows with one registered lens: progress frames while the lens
|
||||
* runs, then the files it keeps. Results for the same files, lens, and lens version are reused from memory until
|
||||
* `maxCachedLensBytes` evicts them. Local changes are read with the Session's permissions; a change request's files
|
||||
* are those `changeRequestDiff` reads.
|
||||
* @param session - Session whose checkout or binding the view shows.
|
||||
* @param request - the view's source, the version of the files it shows, and the lens.
|
||||
* @param signal - ends the classification.
|
||||
* @returns progress frames, then one result frame.
|
||||
* @throws `forgePanel/lens-missing` while no lens holds the identity or once its registration ends;
|
||||
* `forgePanel/lens-stale` before a change request's status was read, when the files differ from `request.version`, and
|
||||
* when local files changed while the lens ran;
|
||||
* `forgePanel/lens-failed` when the lens fails, runs past `lensTimeoutMs`, reads past `maxLensReadBytes`, or answers
|
||||
* over `maxCachedLensBytes`; the errors of `localDiff` and `changeRequestDiff` for the files.
|
||||
*/
|
||||
@Remote({ mode: 'stream' }) async *changesLens(session: Session, request: ForgeLensRequest, signal: AbortSignal): AsyncIterable<ForgeLensFrame>
|
||||
|
||||
/**
|
||||
* Read the signed-in user's viewed marks on the files of a change request of a Session, which the host keeps for the
|
||||
* whole change request.
|
||||
@@ -1971,5 +2145,25 @@ Announces a provider registration or withdrawal after the registry changes. List
|
||||
'forge/providers-changed'(forge: string): void | Promise<void>
|
||||
```
|
||||
|
||||
Source: [`packages/experimental/forge/src/index.ts`](../../packages/experimental/forge/src/index.ts)
|
||||
|
||||
<a id="forgereview-changed--parallel"></a>
|
||||
|
||||
#### `forge/review-changed` — parallel
|
||||
|
||||
Announces a review change the host accepted through this service: a thread or pending-review write, a submitted review, or a viewed mark. Changes whose outcome is unknown, refused, stale, or unsupported are not announced. Listener failures are logged without preventing other listeners from running.
|
||||
|
||||
```ts cordis-catalog
|
||||
/**
|
||||
* Announces a review change the host accepted through this service: a thread or pending-review write, a submitted
|
||||
* review, or a viewed mark. Changes whose outcome is unknown, refused, stale, or unsupported are not announced.
|
||||
* Listener failures are logged without preventing other listeners from running.
|
||||
* @param ref - change request the change went to.
|
||||
* @param change - what changed and the head commit it was made against.
|
||||
* @mode parallel
|
||||
*/
|
||||
'forge/review-changed'(ref: ChangeRequestRef, change: ForgeReviewChange): void | Promise<void>
|
||||
```
|
||||
|
||||
Source: [`packages/experimental/forge/src/index.ts`](../../packages/experimental/forge/src/index.ts)
|
||||
<!-- END GENERATED cordis-surface -->
|
||||
+197
-3
@@ -101,6 +101,12 @@ interface ForgeProvider {
|
||||
* with `a/` and `b/` path prefixes. Both are full object names; `head` descends from `base`.
|
||||
*/
|
||||
compare?(ref: ChangeRequestRef, base: string, head: string, signal: AbortSignal): Promise<string | ForgeFailure>
|
||||
/**
|
||||
* Find the merge base of commits `base` and `head` in the change request's repository, as a full object name: the
|
||||
* commit whose files the old side of a change request's diff shows. Omission declares that the provider cannot name
|
||||
* it, so readers of the old side get `unsupported`.
|
||||
*/
|
||||
mergeBase?(ref: ChangeRequestRef, base: string, head: string, signal: AbortSignal): Promise<string | ForgeFailure>
|
||||
/**
|
||||
* Read the signed-in user's viewed marks on the change request's files at head commit `headSha`. The marks are
|
||||
* returned only when the read names `headSha` as the head; once the head is another commit, the read resolves to a
|
||||
@@ -930,6 +936,11 @@ interface ForgePanelWorktree {
|
||||
interface ForgePanelChangeRequest extends SessionChangeRequest {
|
||||
/** Latest snapshot a poll returned, kept while later polls fail, or null before the first successful poll. */
|
||||
readonly snapshot: ChangeRequestSnapshot | null
|
||||
/**
|
||||
* Number of review changes `forge/review-changed` announced for the change request since the panel host started; it
|
||||
* grows when any plugin's write is accepted, so a reader shows threads and viewed marks read after it.
|
||||
*/
|
||||
readonly reviewRevision: number
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1189,6 +1200,120 @@ interface ForgeLocalChanges {
|
||||
}
|
||||
```
|
||||
|
||||
<a id="extension-api"></a>
|
||||
|
||||
## 扩展 API
|
||||
|
||||
其他插件通过上面的服务和另外五个扩展点扩展变更请求评审;每次注册都返回 disposer,并随做出注册的插件一起结束。与这一能力的其余部分一样,这些接口处于实验阶段,尚未稳定。新增可选字段、方法、slot、事件、错误码或带默认值的 Config 键是兼容的;删除或改名类型、方法、slot、owner props、事件、Config 键或 `dsh-resource://forge-changes/` 地址,或收窄其含义,需要写[升级指南](../../.agents/skills/dsh-create-upgrade-guide/SKILL.md)。这些扩展点都不向模型发送任何内容:插件要让模型看到 forge 数据、透镜结果或注解,须经由它自己的工具结果或 `agent.inject()`,Session log 会记录它们。
|
||||
|
||||
| 扩展点 | Service Definition | Service Provider | Consumer |
|
||||
|---|---|---|---|
|
||||
| 评审数据 | `ctx.forge` 与 `forge/review-changed` 事件 | 各 forge 提供方 | 面板 Host 与其他 Host 插件 |
|
||||
| 筛选透镜 | `ctx.forgePanel.registerLens` | Host 插件 | 经 `changesLens` 使用它的变更视图 |
|
||||
| 变更视图接口 | `ctx.forgeChanges` | forge 面板的 Client 插件 | 打开视图、给透镜起名、添加注解的 Client 插件 |
|
||||
| Slot | `forge.changes.toolbar`、`forge.changes.file.menu`、`forge.diff.line.annotation`、`forge.diff.comment.actions`、`forge.change-request.card.actions` | Client 插件 | 变更视图与变更请求卡片 |
|
||||
| Session 数据 | `forgeChangeRequests` 与 `forgeWorktree` 投影 | forge-session 与 forge 面板 | Client 插件经 `useProjection` 读取,Host 插件经 `ctx.forgeSession.changeRequests` 或 `ctx.sessionProjections.snapshot` 读取 |
|
||||
|
||||
托管平台接受一次评审写入、一次评审提交或一个已审阅标记后,`ctx.forge` 发出 `forge/review-changed`,无论是哪个插件做的;结果未知、被拒绝、已过时或不支持时不发出。面板 Host 随后丢弃为该变更请求保留的讨论,并让对应条目的 `reviewRevision` 加一,因此已打开的变更视图无需刷新就会重新读取讨论和已审阅标记。
|
||||
|
||||
```ts type-equiv
|
||||
/**
|
||||
* One review change the host accepted, which `forge/review-changed` announces: a write to the threads or the pending
|
||||
* review, a submitted review, or a viewed mark. Each names the head commit the change was made against.
|
||||
*/
|
||||
type ForgeReviewChange =
|
||||
| { readonly kind: 'write'; readonly write: ForgeReviewWrite['kind']; readonly headSha: string }
|
||||
| { readonly kind: 'submit'; readonly headSha: string }
|
||||
| { readonly kind: 'viewed'; readonly path: string; readonly viewed: boolean; readonly headSha: string }
|
||||
```
|
||||
|
||||
Host 插件用 `ctx.forgePanel.registerLens(lens)` 注册筛选透镜,Client 插件用 `ctx.forgeChanges.describeLens({ id, title })` 给它起名;没有名字的透镜显示其身份。透镜筛选显示的文件,不给文件分层:变更视图显示所选分层与所选透镜都保留的文件,测试文件开关仍然隐藏测试文件,透镜也不能把文件移到另一层。被保留文件中与 `ranges` 都不相交的 hunk 折叠成一行,读者可以展开。视图只请求所选的透镜,经流式 Remote `changesLens` 进行:它读取与视图相同的文件,文件不同时以 `forgePanel/lens-stale` 拒绝,并在 `lensTimeoutMs` 与 `maxLensReadBytes` 之内运行 `classify`;结果最多保留 `maxCachedLensBytes`。`text` 在分叉点、HEAD、暂存区或第一个所选提交的父提交上读取本地变更的旧侧,在所选提交的父提交上,或在提供方经可选的 `mergeBase` 给出的合并基准上读取变更请求的旧侧。
|
||||
|
||||
```ts type-equiv
|
||||
/** A filter over the files of a changes view, which a plugin registers with `ctx.forgePanel.registerLens()`. */
|
||||
interface ForgeLens {
|
||||
/** Identity the plugin chooses; one registration holds an id at a time. */
|
||||
readonly id: ForgeLensId
|
||||
/** Changes whenever `classify` may answer differently for the same input, which drops results kept under another version. */
|
||||
readonly version: string
|
||||
/**
|
||||
* Decide which files the lens keeps and which lines it is about. The signal aborts when the reader stops waiting, the
|
||||
* registration ends, or `lensTimeoutMs` passes; a rejection fails the request without a partial result.
|
||||
*/
|
||||
classify(input: ForgeLensInput, signal: AbortSignal): Promise<ForgeLensResult>
|
||||
}
|
||||
```
|
||||
|
||||
```ts type-equiv
|
||||
/** What one `classify` call receives. */
|
||||
interface ForgeLensInput {
|
||||
/** What the view shows. */
|
||||
readonly source: ForgeLensSource
|
||||
/** Every file of the diff in display order, with the layer the panel gave it. */
|
||||
readonly files: readonly ForgeLensFile[]
|
||||
/**
|
||||
* Read one side of a file of `files`, by its `path`: the old side reads `previousPath` for a renamed file. Resolves to
|
||||
* null when the side does not exist, as the old side of an added file, or holds binary content. Rejects for a path not
|
||||
* in `files`, once the reads of one call exceed the panel's `maxLensReadBytes`, for an old side the provider cannot
|
||||
* locate, and when the read fails.
|
||||
*/
|
||||
text(side: 'old' | 'new', path: string, signal: AbortSignal): Promise<string | null>
|
||||
/** Report how many of `total` units the lens finished; the changes view shows it while the lens runs. */
|
||||
progress(done: number, total: number): void
|
||||
}
|
||||
```
|
||||
|
||||
```ts type-equiv
|
||||
/** The files a lens keeps, by path; a file the result does not name is filtered out. */
|
||||
interface ForgeLensResult {
|
||||
readonly files: Readonly<Record<string, ForgeLensKeep>>
|
||||
}
|
||||
```
|
||||
|
||||
```ts type-equiv
|
||||
/** What a lens keeps of one file. */
|
||||
interface ForgeLensKeep {
|
||||
/**
|
||||
* Lines the lens is about on each side; hunks that touch none of them fold into one row the reader can expand.
|
||||
* Omitted: every hunk of the file shows.
|
||||
*/
|
||||
readonly ranges?: { readonly old: readonly ForgeLineRange[]; readonly new: readonly ForgeLineRange[] }
|
||||
}
|
||||
```
|
||||
|
||||
`ctx.forgeChanges` 还可以生成和解析变更视图地址,给出标签的 `kinds`,并用 `open(target, { path, lens })` 在侧栏所显示的 Session 中打开视图。`registerAnnotations(source)` 添加行注解:数据源按路径观察每个视图的注解,它在 `forge.diff.line.annotation` 中按数据源身份登记的条目,负责绘制视图所画外框里的内容。注解放在其最后一行之后,位于评论框、浏览器草稿和托管平台讨论之后,落在所在一侧的那一栏;整个文件的注解排在最前,写在另一个 `digest` 上的注解在文件之后单独成段。每个文件最多显示 `maxAnnotationsPerFile` 条;逐行绘制的文件在文件段进入可视区附近之前不绘制注解。所有 slot 的 owner props 见 [`src/client/slots.ts`](../../packages/experimental/client-ui-forge/src/client/slots.ts)。
|
||||
|
||||
```ts type-equiv
|
||||
/** Where one line annotation sits in a file of a changes view. */
|
||||
interface ForgeLineAnnotation {
|
||||
/** Identity within its source, stable across updates; it keys the drawn entry. */
|
||||
readonly key: string
|
||||
/** Inclusive 1-based lines on the old (`L`) or new (`R`) side, or `file` for the whole file. */
|
||||
readonly place: { readonly side: 'L' | 'R'; readonly startLine: number; readonly endLine: number } | 'file'
|
||||
/** Digest of the file change it was written on; a file whose `digest` differs shows it in its outdated section. */
|
||||
readonly digest?: string
|
||||
/** Changes whenever the entry should draw again; equal keys and versions keep the drawn entry's props. */
|
||||
readonly version: string | number
|
||||
}
|
||||
```
|
||||
|
||||
```ts type-equiv
|
||||
/** A Client plugin's line annotations, drawn through its `forge.diff.line.annotation` entry. */
|
||||
interface ForgeAnnotationSource {
|
||||
/** Unique source identity, also the key of its `forge.diff.line.annotation` entry. */
|
||||
readonly id: string
|
||||
/** Position among sources in one stack, lower first; equal positions keep registration order. Default 0. */
|
||||
readonly order?: number
|
||||
/**
|
||||
* Observe the annotations of one view, by path. The changes view calls it once per view and source registration;
|
||||
* the source republishes through the same observable whenever the annotations change.
|
||||
* @param target - the view's Session and source.
|
||||
* @returns annotations by repository-relative path.
|
||||
*/
|
||||
observe(target: ChangesTarget): HostObservable<ReadonlyMap<string, readonly ForgeLineAnnotation[]>>
|
||||
}
|
||||
```
|
||||
|
||||
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
||||
|
||||
<a id="cordis-surface"></a>
|
||||
@@ -1357,7 +1482,7 @@ async readReview(ref: ChangeRequestRef, headSha: string, signal: AbortSignal): P
|
||||
/**
|
||||
* Write to the review threads or the pending review of a change request while its head is still `write.headSha`, then
|
||||
* poll the change request at once when it is watched, unless the provider cannot write reviews. A `stale` result polls
|
||||
* it as a stale read does.
|
||||
* it as a stale read does; a write the host took is announced with `forge/review-changed`.
|
||||
* @param ref - change request served by a registered provider.
|
||||
* @param write - the write and the head commit the user saw.
|
||||
* @param signal - cancellation of the write.
|
||||
@@ -1381,7 +1506,8 @@ async viewedFiles(ref: ChangeRequestRef, headSha: string, signal: AbortSignal):
|
||||
|
||||
/**
|
||||
* Set or clear the signed-in user's viewed mark on one file of a change request while its head is still
|
||||
* `request.headSha`. A `stale` failure polls a watched change request again as {@link ForgeService.diff} does.
|
||||
* `request.headSha`. A `stale` failure polls a watched change request again as {@link ForgeService.diff} does; a saved
|
||||
* mark is announced with `forge/review-changed`.
|
||||
* @param ref - change request served by a registered provider.
|
||||
* @param request - the file, its mark, and the head commit the user saw.
|
||||
* @param signal - cancellation of the request.
|
||||
@@ -1412,7 +1538,21 @@ async commits(ref: ChangeRequestRef, signal: AbortSignal): Promise<ForgeCommitLi
|
||||
async compare(ref: ChangeRequestRef, base: string, head: string, signal: AbortSignal): Promise<string | ForgeFailure>
|
||||
|
||||
/**
|
||||
* Publish one comment or a completed review, then refresh the watched status.
|
||||
* Find the merge base of two commits of a change request's repository: the commit whose files the old side of the
|
||||
* change request's diff shows when `base` is the snapshot's `baseSha` and `head` its `headSha`.
|
||||
* @param ref - change request served by a registered provider.
|
||||
* @param base - full object name of the base commit.
|
||||
* @param head - full object name of the head commit.
|
||||
* @param signal - cancellation of the read.
|
||||
* @returns the merge base's full object name, or why the host did not provide it; `unsupported` when the provider
|
||||
* cannot name merge bases.
|
||||
* @throws when no provider serves the change request's forge, or with `signal.reason` when it aborts.
|
||||
*/
|
||||
async mergeBase(ref: ChangeRequestRef, base: string, head: string, signal: AbortSignal): Promise<string | ForgeFailure>
|
||||
|
||||
/**
|
||||
* Publish one comment or a completed review, then refresh the watched status; a publication the host took is announced
|
||||
* with `forge/review-changed`.
|
||||
* @param ref - change request served by a registered provider.
|
||||
* @param request - explicitly selected commit, comments, and review decision.
|
||||
* @param signal - request cancellation.
|
||||
@@ -1660,6 +1800,40 @@ Serves the forge panel. Following a Session inspects the checkout of its current
|
||||
*/
|
||||
@Remote async changeRequestText(session: Session, url: string, commit: string, path: string, signal: AbortSignal): Promise<string>
|
||||
|
||||
/**
|
||||
* Register a filter lens as an effect on the calling fiber. The changes views list it while it is registered; ending
|
||||
* the registration aborts its running classifications and waits for them.
|
||||
* @param lens - the lens.
|
||||
* @returns the disposer that unregisters the lens and waits for its classifications to stop.
|
||||
* @throws when another registration holds `lens.id`.
|
||||
*/
|
||||
registerLens(lens: ForgeLens): () => Promise<void>
|
||||
|
||||
/**
|
||||
* Stream the facts every changes view reads about the panel's extensions: the current facts first, then the facts
|
||||
* after each lens registration or withdrawal. The stream ends when `signal` aborts or the Remote stops.
|
||||
* @param signal - ends the stream.
|
||||
* @returns the registered lenses and the annotation limit, in publication order.
|
||||
*/
|
||||
@Remote({ mode: 'stream' }) async *extensions(signal: AbortSignal): AsyncIterable<ForgeExtensionState>
|
||||
|
||||
/**
|
||||
* Classify the files a changes view of a Session shows with one registered lens: progress frames while the lens
|
||||
* runs, then the files it keeps. Results for the same files, lens, and lens version are reused from memory until
|
||||
* `maxCachedLensBytes` evicts them. Local changes are read with the Session's permissions; a change request's files
|
||||
* are those `changeRequestDiff` reads.
|
||||
* @param session - Session whose checkout or binding the view shows.
|
||||
* @param request - the view's source, the version of the files it shows, and the lens.
|
||||
* @param signal - ends the classification.
|
||||
* @returns progress frames, then one result frame.
|
||||
* @throws `forgePanel/lens-missing` while no lens holds the identity or once its registration ends;
|
||||
* `forgePanel/lens-stale` before a change request's status was read, when the files differ from `request.version`, and
|
||||
* when local files changed while the lens ran;
|
||||
* `forgePanel/lens-failed` when the lens fails, runs past `lensTimeoutMs`, reads past `maxLensReadBytes`, or answers
|
||||
* over `maxCachedLensBytes`; the errors of `localDiff` and `changeRequestDiff` for the files.
|
||||
*/
|
||||
@Remote({ mode: 'stream' }) async *changesLens(session: Session, request: ForgeLensRequest, signal: AbortSignal): AsyncIterable<ForgeLensFrame>
|
||||
|
||||
/**
|
||||
* Read the signed-in user's viewed marks on the files of a change request of a Session, which the host keeps for the
|
||||
* whole change request.
|
||||
@@ -1973,5 +2147,25 @@ Announces a provider registration or withdrawal after the registry changes. List
|
||||
'forge/providers-changed'(forge: string): void | Promise<void>
|
||||
```
|
||||
|
||||
Source: [`packages/experimental/forge/src/index.ts`](../../packages/experimental/forge/src/index.ts)
|
||||
|
||||
<a id="forgereview-changed--parallel"></a>
|
||||
|
||||
#### `forge/review-changed` — parallel
|
||||
|
||||
Announces a review change the host accepted through this service: a thread or pending-review write, a submitted review, or a viewed mark. Changes whose outcome is unknown, refused, stale, or unsupported are not announced. Listener failures are logged without preventing other listeners from running.
|
||||
|
||||
```ts cordis-catalog
|
||||
/**
|
||||
* Announces a review change the host accepted through this service: a thread or pending-review write, a submitted
|
||||
* review, or a viewed mark. Changes whose outcome is unknown, refused, stale, or unsupported are not announced.
|
||||
* Listener failures are logged without preventing other listeners from running.
|
||||
* @param ref - change request the change went to.
|
||||
* @param change - what changed and the head commit it was made against.
|
||||
* @mode parallel
|
||||
*/
|
||||
'forge/review-changed'(ref: ChangeRequestRef, change: ForgeReviewChange): void | Promise<void>
|
||||
```
|
||||
|
||||
Source: [`packages/experimental/forge/src/index.ts`](../../packages/experimental/forge/src/index.ts)
|
||||
<!-- END GENERATED cordis-surface -->
|
||||
@@ -18,8 +18,8 @@
|
||||
en: 278b2eee160be413
|
||||
zh: d6e0fd1e9f4a4b27
|
||||
/web-client-slots/framework-provided-hooks:
|
||||
en: c9f8d836214623ae
|
||||
zh: 76dec55006396535
|
||||
en: e1090f50013a2483
|
||||
zh: fd8db6ff6d4d0936
|
||||
/web-client-slots/developer-provided-injection:
|
||||
en: 3481dfa6cd3097da
|
||||
zh: acbd6f06a7da1752
|
||||
|
||||
@@ -106,7 +106,8 @@ The shipped adapters add these standard props. They are available according to t
|
||||
|
||||
| Availability | Props | Owner |
|
||||
|---|---|---|
|
||||
| every scope | `useSessions`, `useSessionStatus`, `useSessionRetainInfo`, `useSessionAccess` | `ui-session` |
|
||||
| every scope | `useSessions`, `useSessionRetainInfo`, `useSessionAccess` | `ui-session` |
|
||||
| every scope | `useSessionStatus` | `ui-session-status` |
|
||||
| every scope | `useWorkspaces`, `useWorkspaceAccess` | `ui-workspace` |
|
||||
| every scope | `useRemoteAccess` (the `global` resource) | `api-remote-access` |
|
||||
| every scope | `usePanelInfo` | `ui-layout` |
|
||||
|
||||
@@ -108,7 +108,8 @@ hoc entry 是以必填 `id` 和可选 `key` 寻址的一层。不带 `key` 的
|
||||
|
||||
| 可用范围 | Props | Owner |
|
||||
|---|---|---|
|
||||
| 所有 scope | `useSessions`、`useSessionStatus`、`useSessionRetainInfo`、`useSessionAccess` | `ui-session` |
|
||||
| 所有 scope | `useSessions`、`useSessionRetainInfo`、`useSessionAccess` | `ui-session` |
|
||||
| 所有 scope | `useSessionStatus` | `ui-session-status` |
|
||||
| 所有 scope | `useWorkspaces`、`useWorkspaceAccess` | `ui-workspace` |
|
||||
| 所有 scope | `useRemoteAccess`(`global` 资源) | `api-remote-access` |
|
||||
| 所有作用域 | `usePanelInfo` | `ui-layout` |
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
en: c063711f8247c240
|
||||
zh: 5e54758bbaf1670c
|
||||
/web-client-architecture/conversation-and-presentation:
|
||||
en: 9a22492f0d4359c6
|
||||
zh: 55d449e383e88f62
|
||||
en: f37ba948a8838fb0
|
||||
zh: df19542d87860221
|
||||
/web-client-architecture/data-paths:
|
||||
en: a254278432416473
|
||||
zh: 567c2d3c6a20b304
|
||||
|
||||
@@ -57,7 +57,7 @@ This pairing is not a second source of business truth. Host controllers decide d
|
||||
|
||||
Web and desktop share the [Coding Tools preference](../../packages/client/ui-settings/README.md#use-this-package). It controls diagnostic Views, [available preset choices](../../packages/client/ui-agent-preset/README.md), changed-file cards, and the builtin HTML preview policy without changing Session records.
|
||||
|
||||
`ui-session` installs the Session scope adapter and publishes `useSessions`, `useSessionStatus`, `useSessionRetainInfo`, `useSessionAccess`, `useSession`, `sessionId`, `useProjection`, and the Session-scope `useAccess` over the [remote-access](../../packages/api/remote-access/README.md) Client service. `SessionProvider` inherits an outer binding or binds an explicit `SessionReference`, so concurrent subtrees can target different Sessions. Domain adapters add further standard sources without putting React hooks on the model objects.
|
||||
`ui-session` installs the Session scope adapter and publishes `useSessions`, `useSessionRetainInfo`, `useSessionAccess`, `useSession`, `sessionId`, `useProjection`, and the Session-scope `useAccess` over the [remote-access](../../packages/api/remote-access/README.md) Client service. `SessionProvider` inherits an outer binding or binds an explicit `SessionReference`, so concurrent subtrees can target different Sessions. [`ui-session-status`](../../packages/client/ui-session-status/README.md) publishes `useSessionStatus` from the `ctx.uiSession.sessionStatus` table of running state, the effective pending interaction, and completion reminders. Domain adapters add further standard sources without putting React hooks on the model objects.
|
||||
|
||||
`ui-conversation` binds once to each `SessionBinding.eventSource`. Its event registry correlates durable Session events and Client-only `assistant/live-chunk` updates into stable business Contexts, and its view registry materializes target snapshots. Chat Assistant, Trajectory Assistant, and Turn Tail interpret both live chunks and the compact streams embedded in durable settlements, so reconnect and paged history reproduce the same Assistant state without durable token rows. `ui-chat` and `ui-trajectory` register separate Definitions and builders: they may interpret the same event family, but they do not import or share each other's final display model. The shell selects a registered view and passes its snapshot through standard hooks and Slots. [Conversation](conversation.md) defines Context identity, replay, Location data, target builders, and keyed renderers.
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ Connection 拥有请求 URL 解析、request correlation、`/api` carrier、trus
|
||||
|
||||
Web 和桌面端共享[代码工作工具偏好](../../packages/client/ui-settings/README.zh.md#use-this-package)。它控制诊断 View、[可用的预设选项](../../packages/client/ui-agent-preset/README.zh.md)、改动文件卡片和内置 HTML 预览策略,不改变 Session 记录。
|
||||
|
||||
`ui-session` 安装 Session scope adapter,并在 [remote-access](../../packages/api/remote-access/README.zh.md) Client 服务之上提供 `useSessions`、`useSessionStatus`、`useSessionRetainInfo`、`useSessionAccess`、`useSession`、`sessionId`、`useProjection` 和会话作用域的 `useAccess`。`SessionProvider` 可以继承外围 binding,也可以绑定显式 `SessionReference`,因此并存子树可以指向不同 Session。领域 adapter 可以继续添加标准 source,但不会把 React hook 放进 model object。
|
||||
`ui-session` 安装 Session scope adapter,并在 [remote-access](../../packages/api/remote-access/README.zh.md) Client 服务之上提供 `useSessions`、`useSessionRetainInfo`、`useSessionAccess`、`useSession`、`sessionId`、`useProjection` 和会话作用域的 `useAccess`。`SessionProvider` 可以继承外围 binding,也可以绑定显式 `SessionReference`,因此并存子树可以指向不同 Session。[`ui-session-status`](../../packages/client/ui-session-status/README.zh.md) 从 `ctx.uiSession.sessionStatus` 状态表提供 `useSessionStatus`,该表汇总运行状态、生效的待交互请求和完成提醒。领域 adapter 可以继续添加标准 source,但不会把 React hook 放进 model object。
|
||||
|
||||
`ui-conversation` 对每个 `SessionBinding.eventSource` 只绑定一次。它的 event registry 把持久 Session event 与 Client-only `assistant/live-chunk` update 关联成稳定的业务 Context,view registry 则 materialize target snapshot。Chat Assistant、Trajectory Assistant 与 Turn Tail 同时解释 live chunk 和持久 settlement 中嵌入的紧凑 stream,因此重连与分页历史无需持久 token 行即可复现相同 Assistant 状态。`ui-chat` 与 `ui-trajectory` 分别注册自己的 Definition 和 builder:它们可以解释同一 event family,但不会导入或共享彼此的最终 display model。Shell 选择一个已注册 view,再通过标准 hook 与 Slot 交付其 snapshot。[Conversation](conversation.zh.md)定义 Context identity、replay、Location data、target builder 与 keyed renderer。
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading
|
||||
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
||||
# After editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.2/session-status-package/guide.md
|
||||
/:
|
||||
en: 34a382f0eacc70b6
|
||||
zh: 251d8ba446d1b358
|
||||
/session-status-moves-to-deepseek-ai-dsh-client-ui-session-status:
|
||||
en: 97c85d1b9ace1ddf
|
||||
zh: 0c4d30289336b324
|
||||
/session-status-moves-to-deepseek-ai-dsh-client-ui-session-status/change:
|
||||
en: 62ea699966c0e9d5
|
||||
zh: 31afc236690b0cd5
|
||||
/session-status-moves-to-deepseek-ai-dsh-client-ui-session-status/migration:
|
||||
en: 529f2def0221d26d
|
||||
zh: 6009726243e1c8a6
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "SessionStatus, SessionStatusSnapshot, UseSessionStatus, and the useSessionStatus hook move from @deepseek-ai/dsh-client-ui-session/client to @deepseek-ai/dsh-client-ui-session-status/client, and ctx.uiSession.sessionStatus becomes the separate uiSession.sessionStatus service that readers inject."
|
||||
---
|
||||
|
||||
# Session status moves to `@deepseek-ai/dsh-client-ui-session-status`
|
||||
|
||||
English | [中文](guide.zh.md)
|
||||
|
||||
## Change
|
||||
|
||||
`@deepseek-ai/dsh-client-ui-session/client` no longer exports `SessionStatus`, `SessionStatusSnapshot`, or `UseSessionStatus`, and ui-session no longer declares or provides the `useSessionStatus` root hook. Both now belong to the Client plugin [`@deepseek-ai/dsh-client-ui-session-status`](../../../../packages/client/ui-session-status/README.md), which the Web bundle loads beside ui-session. The `SessionStatus` fields `running`, `pendingInteraction`, and `completionUnread` and their meaning are unchanged. A Client composition that loads ui-session without ui-session-status has no status table and no `useSessionStatus` hook.
|
||||
|
||||
`ctx.uiSession.sessionStatus` is now the separate `uiSession.sessionStatus` service. Reading it through `ctx.uiSession.sessionStatus.getSnapshot()` and `subscribe()` keeps its form, but a plugin that reads it without injecting `'uiSession.sessionStatus'` fails with `cannot get property "uiSession.sessionStatus" without inject`. A plugin whose components call `useSessionStatus` without that injection stays active when the status table unloads, and its components then fail with `useSessionStatus is not a function`. `ctx.uiSession` now has the type `UiSessionService`, which extends the unchanged `UiSession` class with members such as `sessionStatus`; a value annotated as `UiSession` does not show `sessionStatus`.
|
||||
|
||||
Pending interactions stay in ui-session: `ctx.uiSession.registerPendingInteraction(precedence)`, `SessionPendingInteractionBase`, `SessionPendingInteractionMap`, `SessionPendingInteraction`, and `PendingInteractionPublisher` keep their names, behavior, and `@deepseek-ai/dsh-client-ui-session/client` export. Declarations that extend `SessionPendingInteractionMap` keep targeting that module. ui-session additionally exposes the read-only `ctx.uiSession.pendingInteractions` source.
|
||||
|
||||
This affects Client plugins and tests that import the three status types, render components that read `useSessionStatus`, or read `ctx.uiSession.sessionStatus`.
|
||||
|
||||
## Migration
|
||||
|
||||
1. Import `SessionStatus`, `SessionStatusSnapshot`, and `UseSessionStatus` from `@deepseek-ai/dsh-client-ui-session-status/client`. A package that only imports these types, for example in tests, declares `@deepseek-ai/dsh-client-ui-session-status` in `devDependencies` and its TypeScript project references.
|
||||
2. A package whose source components call `useSessionStatus` additionally lists the package in `dsh.client.inject`, adds `import type {} from '@deepseek-ai/dsh-client-ui-session-status/client'` when it imports none of the types, and adds `'uiSession.sessionStatus'` to the Cordis `inject` of the plugin that registers those components, so the plugin unloads and reloads with the status table.
|
||||
3. In each plugin that reads `ctx.uiSession.sessionStatus` in JavaScript, add `'uiSession.sessionStatus'` to `inject`. A plugin that only needs the effective pending request may read and subscribe to `ctx.uiSession.pendingInteractions` instead.
|
||||
4. Where code passes `ctx.uiSession` through a parameter or field annotated as `UiSession` and then reads `sessionStatus`, annotate it as `UiSessionService` from `@deepseek-ai/dsh-client-ui-session/client`.
|
||||
5. Leave `registerPendingInteraction` calls and `declare module '@deepseek-ai/dsh-client-ui-session/client'` augmentations of `SessionPendingInteractionMap` unchanged.
|
||||
6. A custom Client composition that loads `@deepseek-ai/dsh-client-ui-session` also loads `@deepseek-ai/dsh-client-ui-session-status`, so `useSessionStatus` remains available.
|
||||
7. Confirm that the plugin type-checks and that a Session row still shows its running or waiting indicator.
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "SessionStatus、SessionStatusSnapshot、UseSessionStatus 和 useSessionStatus hook 从 @deepseek-ai/dsh-client-ui-session/client 移到 @deepseek-ai/dsh-client-ui-session-status/client,ctx.uiSession.sessionStatus 改为读取方需要注入的独立 uiSession.sessionStatus 服务。"
|
||||
---
|
||||
|
||||
# 会话状态移到 `@deepseek-ai/dsh-client-ui-session-status`
|
||||
|
||||
[English](guide.md) | 中文
|
||||
|
||||
## 变更
|
||||
|
||||
`@deepseek-ai/dsh-client-ui-session/client` 不再导出 `SessionStatus`、`SessionStatusSnapshot` 或 `UseSessionStatus`,ui-session 也不再声明或提供根 hook `useSessionStatus`。它们现在属于 Client 插件 [`@deepseek-ai/dsh-client-ui-session-status`](../../../../packages/client/ui-session-status/README.zh.md),Web bundle 会与 ui-session 一起加载它。`SessionStatus` 的字段 `running`、`pendingInteraction`、`completionUnread` 及其含义不变。只加载 ui-session、不加载 ui-session-status 的 Client 组合没有状态表,也没有 `useSessionStatus` hook。
|
||||
|
||||
`ctx.uiSession.sessionStatus` 现在是独立的 `uiSession.sessionStatus` 服务。通过 `ctx.uiSession.sessionStatus.getSnapshot()` 和 `subscribe()` 读取的写法不变,但未注入 `'uiSession.sessionStatus'` 就读取它的插件会报错 `cannot get property "uiSession.sessionStatus" without inject`。组件调用 `useSessionStatus`、却未注入该服务的插件,在状态表卸载后仍保持激活,其组件随后报错 `useSessionStatus is not a function`。`ctx.uiSession` 的类型改为 `UiSessionService`,它在不变的 `UiSession` class 之上加入 `sessionStatus` 等成员;标注为 `UiSession` 的值看不到 `sessionStatus`。
|
||||
|
||||
待交互仍归 ui-session:`ctx.uiSession.registerPendingInteraction(precedence)`、`SessionPendingInteractionBase`、`SessionPendingInteractionMap`、`SessionPendingInteraction` 和 `PendingInteractionPublisher` 的名称、行为以及从 `@deepseek-ai/dsh-client-ui-session/client` 的导出都不变。扩展 `SessionPendingInteractionMap` 的声明继续指向该模块。ui-session 另外提供只读的 `ctx.uiSession.pendingInteractions` 数据源。
|
||||
|
||||
受影响的是导入这三个状态类型、渲染读取 `useSessionStatus` 的组件,或读取 `ctx.uiSession.sessionStatus` 的 Client 插件和测试。
|
||||
|
||||
## 迁移
|
||||
|
||||
1. 从 `@deepseek-ai/dsh-client-ui-session-status/client` 导入 `SessionStatus`、`SessionStatusSnapshot` 和 `UseSessionStatus`。只导入这些类型(例如只在测试中导入)的包,在 `devDependencies` 和 TypeScript 项目引用中声明 `@deepseek-ai/dsh-client-ui-session-status`。
|
||||
2. 源码组件调用 `useSessionStatus` 的包,另外在 `dsh.client.inject` 中列出该包;不导入任何上述类型时加入 `import type {} from '@deepseek-ai/dsh-client-ui-session-status/client'`;并在注册这些组件的插件的 Cordis `inject` 中加入 `'uiSession.sessionStatus'`,使该插件随状态表一起卸载和重新加载。
|
||||
3. 在每个在 JS 中读取 `ctx.uiSession.sessionStatus` 的插件中,把 `'uiSession.sessionStatus'` 加到 `inject`。只需要生效待交互请求的插件,可以改为读取并订阅 `ctx.uiSession.pendingInteractions`。
|
||||
4. 代码把 `ctx.uiSession` 传给标注为 `UiSession` 的参数或字段、之后又读取 `sessionStatus` 时,把标注改为 `@deepseek-ai/dsh-client-ui-session/client` 的 `UiSessionService`。
|
||||
5. `registerPendingInteraction` 调用和对 `SessionPendingInteractionMap` 的 `declare module '@deepseek-ai/dsh-client-ui-session/client'` 扩展保持不变。
|
||||
6. 加载 `@deepseek-ai/dsh-client-ui-session` 的自定义 Client 组合同时加载 `@deepseek-ai/dsh-client-ui-session-status`,使 `useSessionStatus` 继续可用。
|
||||
7. 确认插件通过类型检查,并且会话行仍显示运行或等待标记。
|
||||
@@ -276,6 +276,10 @@
|
||||
- id: ui-session
|
||||
name: '@deepseek-ai/dsh-client-ui-session'
|
||||
|
||||
# Session status table behind ctx.uiSession.sessionStatus and useSessionStatus.
|
||||
- id: ui-session-status
|
||||
name: '@deepseek-ai/dsh-client-ui-session-status'
|
||||
|
||||
# Unified resource model: protocol providers behind the useResource hook.
|
||||
- id: resources
|
||||
name: '@deepseek-ai/dsh-client-resources'
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-schedule": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-secret-mask": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session-status": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-settings": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-settings-account": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-settings-agent-loop": "workspace:*",
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
en: 1eb35b015a6c423f
|
||||
zh: a8a3dceee2c9e943
|
||||
/client-web-gui-browser-half/packages:
|
||||
en: 2165938f26300774
|
||||
zh: 5f739534a8509545
|
||||
en: 292a25cf1a426b56
|
||||
zh: ca765789a28289f8
|
||||
/client-web-gui-browser-half/related-documentation:
|
||||
en: d1d506e68fab7333
|
||||
zh: 1a90fe6f3f8f24a9
|
||||
|
||||
@@ -39,6 +39,7 @@ The kernel packages boot and serve the page; the UI feature packages present it.
|
||||
| [`ui-renderer/`](ui-renderer/README.md) | Binds slot data to React and mounts the assembled application | `ctx.uiRenderer` |
|
||||
| [`ui-slots/`](ui-slots/README.md) | Defines typed extension Slots and reusable Component Factories | — |
|
||||
| [`ui-session/`](ui-session/README.md) | Adapts Session Controller state into standard Slot sources and hooks | — |
|
||||
| [`ui-session-status/`](ui-session-status/README.md) | Combines running state, the effective pending interaction, and completion reminders into the Session status table behind `useSessionStatus` | `ctx.uiSession.sessionStatus` |
|
||||
| [`ui-theme/`](ui-theme/README.md) | Applies the selected color theme | — |
|
||||
| [`ui-primitives/`](ui-primitives/README.md) | Provides shared React controls, icons, and content renderers | — |
|
||||
| [`ui-attachment/`](ui-attachment/README.md) | Registers composer and message-image attachment presentation | — |
|
||||
|
||||
@@ -39,6 +39,7 @@ kind: "package-group"
|
||||
| [`ui-renderer/`](ui-renderer/README.zh.md) | 将 slot 数据绑定到 React,并挂载组装完成的应用 | `ctx.uiRenderer` |
|
||||
| [`ui-slots/`](ui-slots/README.zh.md) | 定义类型化扩展 Slots 与可复用 Component Factory | — |
|
||||
| [`ui-session/`](ui-session/README.zh.md) | 把会话控制器状态适配为标准 Slot source 与钩子 | — |
|
||||
| [`ui-session-status/`](ui-session-status/README.zh.md) | 把运行状态、生效的待交互请求和完成提醒汇总为会话状态表,并通过 `useSessionStatus` 提供 | `ctx.uiSession.sessionStatus` |
|
||||
| [`ui-theme/`](ui-theme/README.zh.md) | 应用所选颜色主题 | — |
|
||||
| [`ui-primitives/`](ui-primitives/README.zh.md) | 提供共享 React 控件、图标与内容渲染器 | — |
|
||||
| [`ui-attachment/`](ui-attachment/README.zh.md) | 注册输入框与消息图片的附件呈现 | — |
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-primitives": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session-status": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-settings": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-sidebar-browser": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-sidebar-documentpreview": "workspace:*",
|
||||
|
||||
@@ -28,7 +28,7 @@ import type {
|
||||
} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
||||
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
||||
import { SessionSeq, type SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { KeyedSnapshotSelectorHook, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import { allowAllAccess, bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import { createSnapshotStore, type ObservableSnapshot } from '@deepseek-ai/dsh-client-store'
|
||||
|
||||
@@ -4,7 +4,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||
import type { SessionListState } from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { GlobalStandardProps } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
||||
import { allowAllAccess, bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-layout",
|
||||
"@deepseek-ai/dsh-client-ui-renderer",
|
||||
"@deepseek-ai/dsh-client-ui-session",
|
||||
"@deepseek-ai/dsh-client-ui-session-status",
|
||||
"@deepseek-ai/dsh-client-ui-settings",
|
||||
"@deepseek-ai/dsh-client-ui-workspace",
|
||||
"@deepseek-ai/dsh-client-ui-context-menu"
|
||||
@@ -67,6 +68,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-primitives": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session-status": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-settings": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-workspace": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
|
||||
|
||||
@@ -12,6 +12,7 @@ import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type {} from '@deepseek-ai/dsh-client-locale/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
|
||||
import type { ShortcutCommandId, ShortcutFixedCommand } from '@deepseek-ai/dsh-client-shortcuts/client'
|
||||
import { UiConversation } from './conversation/assembly.ts'
|
||||
@@ -58,9 +59,12 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
||||
}
|
||||
}
|
||||
|
||||
/** Services required by the Conversation plugin. */
|
||||
/**
|
||||
* Services required by the Conversation plugin. `uiSession.sessionStatus` provides the `useSessionStatus` hook the
|
||||
* Conversation shell renders with, so the plugin unloads and reloads with it.
|
||||
*/
|
||||
export const inject = [
|
||||
'slots', 'sessions', 'fileUpload', 'uiSession', 'uiWorkspace', 'locale', 'configForms',
|
||||
'slots', 'sessions', 'fileUpload', 'uiSession', 'uiSession.sessionStatus', 'uiWorkspace', 'locale', 'configForms',
|
||||
]
|
||||
|
||||
/** Conversation runtime configuration. */
|
||||
|
||||
@@ -11,7 +11,7 @@ import { StopSequence } from './stop-sequence.ts'
|
||||
* @param shortcuts - window keyboard arbitration and validated sequence interval.
|
||||
* @param sessions - live Session identities and lifecycle sources.
|
||||
* @param openTurn - stable current-turn source for a live Session binding.
|
||||
* @param uiSession - current pending-interaction status.
|
||||
* @param uiSession - effective pending interaction of each Session.
|
||||
* @param cancel - scoped stop operation that preserves Queue and reports failures.
|
||||
* @returns disposer releasing the input subscription, pending watches and expiry timer.
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ export function installStopShortcut(
|
||||
const session = binding.session.getSnapshot()
|
||||
if (!session.running || session.removed
|
||||
|| (session.subagent !== null && session.subagent.address.mode !== 'continuable')
|
||||
|| uiSession.sessionStatus.getSnapshot().get(sessionId)?.pendingInteraction !== undefined) return undefined
|
||||
|| uiSession.pendingInteractions.getSnapshot().get(sessionId) !== undefined) return undefined
|
||||
return turnSource.getSnapshot()
|
||||
}
|
||||
const turn = currentTurn()
|
||||
@@ -58,7 +58,7 @@ export function installStopShortcut(
|
||||
const changed = (): void => {
|
||||
if (sessions.binding(sessionId) !== binding || currentTurn() !== turn) reset()
|
||||
}
|
||||
const disposers = [turnSource.subscribe(changed), binding.session.subscribe(changed), uiSession.sessionStatus.subscribe(changed)]
|
||||
const disposers = [turnSource.subscribe(changed), binding.session.subscribe(changed), uiSession.pendingInteractions.subscribe(changed)]
|
||||
unwatch = () => { for (const dispose of disposers) dispose() }
|
||||
})
|
||||
return () => { off(); reset() }
|
||||
|
||||
@@ -6,7 +6,7 @@ import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||
import { allowAllAccess, bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import type { SessionListState } from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
||||
import { EnterBehaviorRow } from '../src/client/settings/EnterBehaviorRow.tsx'
|
||||
import type { EnterBehaviorRowProps } from '../src/client/settings/EnterBehaviorRow.tsx'
|
||||
|
||||
@@ -16,7 +16,7 @@ import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
||||
import {
|
||||
allowAllAccess, bindSnapshotSelector, conversationSnapshot, sessionSnapshot,
|
||||
} from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { SubmitAttachment, SubmitOutcome } from '../src/client/contract/input.ts'
|
||||
import { makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
|
||||
@@ -29,7 +29,7 @@ import type {
|
||||
import {
|
||||
allowAllAccess, bindSnapshotSelector, conversationSnapshot, makeTranslate, sessionSnapshot, SlotTestRuntime,
|
||||
} from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts'
|
||||
import type { DraftAttachmentId } from '../src/client/contract/input.ts'
|
||||
|
||||
@@ -20,7 +20,7 @@ import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
||||
import {
|
||||
allowAllAccess, bindSnapshotSelector, conversationSnapshot, makeTranslate,
|
||||
} from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts'
|
||||
import type { InputState } from '../src/client/contract/input.ts'
|
||||
import { zh } from '../src/client/locales.ts'
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
allowAllAccess, bindSnapshotSelector, makeTranslate, RemoteError, sessionSnapshot as sessionFixture,
|
||||
} from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { WorkspaceId } from '@deepseek-ai/dsh-workspace/types'
|
||||
import { en as commonEn } from '@deepseek-ai/dsh-client-locale/src/locales/en.ts'
|
||||
import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts'
|
||||
|
||||
@@ -137,6 +137,17 @@ describe('fixed stop routing', () => {
|
||||
expect(b.cancel).toHaveBeenCalledOnce()
|
||||
})
|
||||
|
||||
it("keeps this Session's double-Escape sequence when another Session gains a pending interaction", async () => {
|
||||
const b = await bench()
|
||||
const publish = b.runtime.ctx.uiSession.registerPendingInteraction<SessionPendingInteractionBase>(() => 0)
|
||||
b.press()
|
||||
const remove = publish({ kind: 'approval', key: 'request-other', sessionId: 's2' as SessionId }, async () => {})
|
||||
b.press()
|
||||
await Promise.resolve()
|
||||
expect(b.cancel).toHaveBeenCalledOnce()
|
||||
remove()
|
||||
})
|
||||
|
||||
it('excludes terminal, iframe, approval and inert descendants even inside Conversation', async () => {
|
||||
const b = await bench()
|
||||
for (const [tag, attribute] of [['div', 'class'], ['iframe', ''], ['div', 'data-approval-key'], ['div', 'inert']]) {
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
{
|
||||
"path": "../../api/session-controller/tsconfig.client.json"
|
||||
},
|
||||
{
|
||||
"path": "../ui-session-status"
|
||||
},
|
||||
{
|
||||
"path": "../../api/workspace-controller/tsconfig.client.json"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
||||
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
||||
# After editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write packages/client/ui-session-status/README.md
|
||||
/:
|
||||
en: 11efe93e9b428342
|
||||
zh: 56d90a359ee86ad5
|
||||
/deepseek-ai-dsh-client-ui-session-status:
|
||||
en: d572f680cca905e6
|
||||
zh: 7c397a1fb746b47f
|
||||
/deepseek-ai-dsh-client-ui-session-status/summary:
|
||||
en: a3e8fe090a557c9b
|
||||
zh: 782500fb80b92712
|
||||
/deepseek-ai-dsh-client-ui-session-status/table-of-contents:
|
||||
en: 3e7914c761a1310c
|
||||
zh: 82c46d3a4d5e6a55
|
||||
/deepseek-ai-dsh-client-ui-session-status/status-table:
|
||||
en: 4c1c64a9e5aa133d
|
||||
zh: 9248ed3f64a4ebc9
|
||||
/deepseek-ai-dsh-client-ui-session-status/model-experience:
|
||||
en: 687076082426c060
|
||||
zh: 5888fcd520d0e53e
|
||||
/deepseek-ai-dsh-client-ui-session-status/model-experience/kv-cache-effect:
|
||||
en: 99bd3bc7d244944a
|
||||
zh: 0021893ed90b2686
|
||||
/deepseek-ai-dsh-client-ui-session-status/known-limitations-and-deferred-work:
|
||||
en: 52d467a078cc3486
|
||||
zh: c373685b879ad6de
|
||||
/deepseek-ai-dsh-client-ui-session-status/known-limitations-and-deferred-work/dev-note:
|
||||
en: e67f633dc6fe7773
|
||||
zh: e88aeb617ffb74ea
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
description: "Client Session status table and useSessionStatus hook: running state, the effective pending interaction, and completion reminders by Session."
|
||||
kind: "package-reference"
|
||||
---
|
||||
# @deepseek-ai/dsh-client-ui-session-status
|
||||
|
||||
English | [中文](README.zh.md)
|
||||
|
||||
## Summary
|
||||
|
||||
Use this package to read each Session's running state, highest-precedence pending interaction, and completion reminder from one Client status table. Components read the table through the `useSessionStatus` root hook; Client plugins read it as `ctx.uiSession.sessionStatus`. The package has no configuration fields, Host behavior, or persistent storage.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Status table](#status-table)
|
||||
- [Model Experience](#model-experience)
|
||||
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
||||
- [Dev Note](#dev-note)
|
||||
|
||||
-----
|
||||
|
||||
<a id="status-table"></a>
|
||||
## Status table
|
||||
|
||||
The Web bundle loads this plugin after [`dsh-client-ui-session`](../ui-session/README.md) and requires it at startup; a composition that loads ui-session without this package has no status table and no `useSessionStatus` hook. A plugin that reads `ctx.uiSession.sessionStatus` adds `'uiSession.sessionStatus'` to its `inject` list; without it, Cordis rejects the property read. A plugin whose components call `useSessionStatus` injects it as well, so the plugin unloads and reloads with the hook. The member is declared on ui-session's `UiSessionService`, the type of `ctx.uiSession`; a value annotated as the `UiSession` class does not show it.
|
||||
|
||||
| Member | Use |
|
||||
|---|---|
|
||||
| `getSnapshot()` | Status by Session identity; the snapshot keeps its reference until a status fact changes |
|
||||
| `subscribe(listener)` | Observe published changes; a throwing listener is reported without stopping later listeners |
|
||||
|
||||
Each `SessionStatus` has three independent fields:
|
||||
|
||||
| Field | Source |
|
||||
|---|---|
|
||||
| `running` | Host Session list baselines and `api-session/status` events; absent until either establishes it. Subagent catalog rows and retained subagent fallback rows do not establish it. |
|
||||
| `pendingInteraction` | The same object `ctx.uiSession.pendingInteractions` publishes for that Session. Domain plugins keep registering requests through `ctx.uiSession.registerPendingInteraction(precedence)`. |
|
||||
| `completionUnread` | A stop this Client observed while the main view did not retain the Session, including an idle event that arrives before the first list baseline. The reminder clears when the main view retains the Session, the Session runs again, or a ready list no longer contains it. |
|
||||
|
||||
<a id="model-experience"></a>
|
||||
## Model Experience
|
||||
|
||||
None, as the status table adds no tools, prompts, or Session events.
|
||||
|
||||
#### KV Cache effect
|
||||
|
||||
None; the status table does not assemble model requests.
|
||||
|
||||
## Known Limitations and Deferred Work
|
||||
|
||||
<a id="known-limitations-and-deferred-work"></a>
|
||||
|
||||
- **Completion reminders belong to one Client** — another browser tab or a page reload starts without the reminders this Client recorded.
|
||||
|
||||
<a id="dev-note"></a>
|
||||
### Dev Note
|
||||
|
||||
<details>
|
||||
<summary>Working context for maintainers — click to expand</summary>
|
||||
|
||||
None.
|
||||
|
||||
</details>
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
description: "Client 会话状态表与 useSessionStatus hook:按会话提供运行状态、生效的待交互请求和完成提醒。"
|
||||
kind: "package-reference"
|
||||
---
|
||||
# @deepseek-ai/dsh-client-ui-session-status
|
||||
|
||||
[English](README.md) | 中文
|
||||
|
||||
## 概述
|
||||
|
||||
使用本包可从同一张 Client 状态表读取每个 Session 的运行状态、优先级最高的待交互请求和完成提醒。组件通过根 hook `useSessionStatus` 读取该表;Client 插件以 `ctx.uiSession.sessionStatus` 读取。本包没有配置字段、Host 行为或持久化存储。
|
||||
|
||||
## 目录
|
||||
|
||||
- [状态表](#status-table)
|
||||
- [模型体验](#model-experience)
|
||||
- [已知限制与暂缓事项](#known-limitations-and-deferred-work)
|
||||
- [开发备注](#dev-note)
|
||||
|
||||
-----
|
||||
|
||||
<a id="status-table"></a>
|
||||
## 状态表
|
||||
|
||||
Web bundle 在 [`dsh-client-ui-session`](../ui-session/README.zh.md) 之后加载本插件,并把它列为启动必需入口;只加载 ui-session、不加载本包的组合没有状态表,也没有 `useSessionStatus` hook。读取 `ctx.uiSession.sessionStatus` 的插件需要在 `inject` 列表中加入 `'uiSession.sessionStatus'`;否则 Cordis 会拒绝该属性读取。组件调用 `useSessionStatus` 的插件也注入它,使插件随该 hook 一起卸载和重新加载。该成员声明在 ui-session 的 `UiSessionService`(`ctx.uiSession` 的类型)上;标注为 `UiSession` class 的值看不到它。
|
||||
|
||||
| 成员 | 用途 |
|
||||
|---|---|
|
||||
| `getSnapshot()` | 按 Session 身份索引的状态;状态事实变化前快照保持同一引用 |
|
||||
| `subscribe(listener)` | 观察已发布的变化;抛错的 listener 会被报告,不会阻止后续 listener |
|
||||
|
||||
每个 `SessionStatus` 有三个相互独立的字段:
|
||||
|
||||
| 字段 | 来源 |
|
||||
|---|---|
|
||||
| `running` | Host 会话列表基线和 `api-session/status` 事件;两者都未建立之前为缺省。Subagent 目录行和已保留子会话的 fallback 行不会建立它。 |
|
||||
| `pendingInteraction` | `ctx.uiSession.pendingInteractions` 为该 Session 发布的同一个对象。领域插件仍通过 `ctx.uiSession.registerPendingInteraction(precedence)` 登记请求。 |
|
||||
| `completionUnread` | 本 Client 在主视图未保留该 Session 时观察到的一次停止,包括首个列表基线之前到达的空闲事件。主视图保留该 Session、该 Session 再次运行,或就绪列表不再包含它时,提醒清除。 |
|
||||
|
||||
<a id="model-experience"></a>
|
||||
## 模型体验
|
||||
|
||||
无,因为状态表不添加工具、提示词或 Session 事件。
|
||||
|
||||
#### KV Cache 影响
|
||||
|
||||
无;状态表不会组装模型请求。
|
||||
|
||||
## 已知限制与暂缓事项
|
||||
|
||||
<a id="known-limitations-and-deferred-work"></a>
|
||||
|
||||
- **完成提醒只属于一个 Client**——另一个浏览器标签页或刷新后的页面不会带上本 Client 记录的提醒。
|
||||
|
||||
<a id="dev-note"></a>
|
||||
### 开发备注
|
||||
|
||||
<details>
|
||||
<summary>维护者工作上下文——点击展开</summary>
|
||||
|
||||
无。
|
||||
|
||||
</details>
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Sitzungsstatus"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Session status"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Estado de la sesión"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Statut de la session"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "セッションの状態"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Estado da sessão"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "Статус сеанса"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"meta": {
|
||||
"title": "会话状态"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "@deepseek-ai/dsh-client-ui-session-status",
|
||||
"description": "Client Session status table: running state, the effective pending interaction, and completion reminders",
|
||||
"version": "0.2.2-rc.2",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
||||
"directory": "packages/client/ui-session-status"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/types/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./lib/types/index.d.ts",
|
||||
"default": "./lib/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/types/client/index.d.ts",
|
||||
"default": "./lib/client.js"
|
||||
},
|
||||
"./src/*": "./src/*",
|
||||
"./package.json": "./package.json",
|
||||
"./locale/*.json": "./locale/*.json"
|
||||
},
|
||||
"dsh": {
|
||||
"client": {
|
||||
"inject": [
|
||||
"@deepseek-ai/dsh-api-remotes",
|
||||
"@deepseek-ai/dsh-api-session-controller",
|
||||
"@deepseek-ai/dsh-client-ui-renderer",
|
||||
"@deepseek-ai/dsh-client-ui-session"
|
||||
],
|
||||
"platform": "web"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"bundle": "tsdown",
|
||||
"watch": "tsdown --watch"
|
||||
},
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/dsh-api-remotes": "workspace:*",
|
||||
"@deepseek-ai/dsh-api-session-controller": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-store": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-test-runtime": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
|
||||
"@deepseek-ai/dsh-remote-mock": "workspace:*",
|
||||
"@deepseek-ai/dsh-session": "workspace:*"
|
||||
},
|
||||
"files": [
|
||||
"locale/*.json",
|
||||
"lib/index.js",
|
||||
"lib/client.js",
|
||||
"lib/types/**/*.d.ts",
|
||||
"lib/types/**/*.d.ts.map",
|
||||
"lib/**/*.js.map",
|
||||
"src"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/** Client Session status plugin: the `uiSession.sessionStatus` service and the `useSessionStatus` root hook. */
|
||||
import type { Context } from '@deepseek-ai/cordis'
|
||||
// Type-only: declares the `sessions` Controller service.
|
||||
import type {} from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
// Type-only service merge for ctx.slots.
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
||||
import { UiSessionStatus } from './status.ts'
|
||||
|
||||
export type { SessionStatus, SessionStatusSnapshot, UiSessionStatus, UseSessionStatus } from './status.ts'
|
||||
|
||||
/** Required Controller, Remote, renderer, and Session UI services. */
|
||||
export const inject = ['remote', 'sessions', 'slots', 'uiSession']
|
||||
|
||||
/**
|
||||
* Install `ctx.uiSession.sessionStatus` and publish it through the `useSessionStatus` root hook.
|
||||
* @param ctx - Client root context.
|
||||
*/
|
||||
export function apply(ctx: Context): void {
|
||||
const status = new UiSessionStatus(ctx, ctx.sessions, ctx.uiSession.pendingInteractions)
|
||||
ctx.slots.provideRoot({ hooks: { sessionStatus: status } })
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/** Client Session status table: running state, the effective pending interaction, and completion reminders. */
|
||||
import { Service, type Context } from '@deepseek-ai/cordis'
|
||||
import type { ISessions, SessionSummary } from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import type {} from '@deepseek-ai/dsh-api-remotes/client'
|
||||
import { notifySubscribers } from '@deepseek-ai/dsh-client-store'
|
||||
import type { HostObservable, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
import type { SessionPendingInteraction } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
// Retains ui-session's Context and Slot prop declarations for every consumer of this face.
|
||||
export type {} from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
|
||||
/** Independent UI status facts for one Session identity. */
|
||||
export interface SessionStatus {
|
||||
/** Latest known running state; absent until a baseline or event establishes it. */
|
||||
readonly running: boolean | undefined
|
||||
/** Highest-precedence domain request currently awaiting user interaction. */
|
||||
readonly pendingInteraction: SessionPendingInteraction | undefined
|
||||
/** Whether an observed stop outside the main view still needs acknowledgement. */
|
||||
readonly completionUnread: boolean
|
||||
}
|
||||
|
||||
/** Current UI status indexed by Session identity. */
|
||||
export type SessionStatusSnapshot = ReadonlyMap<SessionId, SessionStatus>
|
||||
/** Selector hook over the unified Session UI status snapshot. */
|
||||
export type UseSessionStatus = SnapshotSelectorHook<SessionStatusSnapshot>
|
||||
|
||||
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
||||
interface GlobalStandardProps {
|
||||
useSessionStatus: UseSessionStatus
|
||||
}
|
||||
}
|
||||
|
||||
declare module '@deepseek-ai/dsh-client-ui-session/client' {
|
||||
interface UiSessionService {
|
||||
/** Session status table; a plugin that reads it injects `uiSession.sessionStatus`. */
|
||||
readonly sessionStatus: UiSessionStatus
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Session status table provided as the `uiSession.sessionStatus` service and read as `ctx.uiSession.sessionStatus`.
|
||||
* Completion reminders live only in this Client; the [status table reference](../../README.md#status-table) states
|
||||
* when each field is set and cleared.
|
||||
*/
|
||||
export class UiSessionStatus extends Service implements HostObservable<SessionStatusSnapshot> {
|
||||
private readonly running = new Map<SessionId, boolean>()
|
||||
private readonly completionUnread = new Set<SessionId>()
|
||||
private statusSnapshot: SessionStatusSnapshot = new Map()
|
||||
private readonly statusListeners = new Set<() => void>()
|
||||
|
||||
/**
|
||||
* @param ctx - Client root context.
|
||||
* @param sessions - Controller-owned Session catalog.
|
||||
* @param pendingInteractions - effective pending request by Session, published by ui-session.
|
||||
*/
|
||||
constructor(
|
||||
ctx: Context,
|
||||
private readonly sessions: Pick<ISessions, 'list'>,
|
||||
private readonly pendingInteractions: HostObservable<ReadonlyMap<SessionId, SessionPendingInteraction>>,
|
||||
) {
|
||||
super(ctx, 'uiSession.sessionStatus')
|
||||
ctx.effect(() => {
|
||||
const disposeStatus = sessions.list.subscribe(() => { this.reconcileStatus() })
|
||||
const disposeRemoteStatus = ctx.remote.$on('api-session/status', (sessionId, running) => {
|
||||
this.observeRunning(sessionId, running)
|
||||
})
|
||||
const disposePending = pendingInteractions.subscribe(() => { this.publishStatus() })
|
||||
this.reconcileStatus()
|
||||
return () => {
|
||||
disposeStatus()
|
||||
disposeRemoteStatus()
|
||||
disposePending()
|
||||
}
|
||||
}, 'session-status: Session status table')
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the current status table; the reference changes only when a status fact changes.
|
||||
* @returns status by Session identity.
|
||||
*/
|
||||
readonly getSnapshot: () => SessionStatusSnapshot = () => this.statusSnapshot
|
||||
|
||||
/**
|
||||
* Observe status table changes; a throwing listener is reported without stopping later listeners.
|
||||
* @param listener - called after each published change.
|
||||
* @returns unsubscribe.
|
||||
*/
|
||||
readonly subscribe: (listener: () => void) => () => void = (listener) => {
|
||||
this.statusListeners.add(listener)
|
||||
return () => { this.statusListeners.delete(listener) }
|
||||
}
|
||||
|
||||
private observeRunning(sessionId: SessionId, running: boolean): void {
|
||||
const previous = this.running.get(sessionId)
|
||||
const beforeBaseline = this.sessions.list.getSnapshot().phase === 'pending'
|
||||
this.running.set(sessionId, running)
|
||||
if (running) this.completionUnread.delete(sessionId)
|
||||
else if ((previous === true || (previous === undefined && beforeBaseline))
|
||||
&& !this.isMain(sessionId)) this.completionUnread.add(sessionId)
|
||||
this.publishStatus()
|
||||
}
|
||||
|
||||
private reconcileStatus(): void {
|
||||
const list = this.sessions.list.getSnapshot()
|
||||
const present = new Set(Object.keys(list.byId) as SessionId[])
|
||||
// Subagent catalog rows and retained subagent fallback rows do not establish Host running state.
|
||||
for (const id of list.ids) {
|
||||
const row = list.byId[id] as SessionSummary
|
||||
const previous = this.running.get(id)
|
||||
if (previous === undefined) this.running.set(id, row.running)
|
||||
else if (previous !== row.running) this.observeRunning(id, row.running)
|
||||
}
|
||||
for (const id of present) {
|
||||
if (this.isMain(id)) this.completionUnread.delete(id)
|
||||
}
|
||||
if (list.phase === 'ready') {
|
||||
for (const id of this.running.keys()) {
|
||||
if (present.has(id)) continue
|
||||
this.running.delete(id)
|
||||
this.completionUnread.delete(id)
|
||||
}
|
||||
}
|
||||
this.publishStatus()
|
||||
}
|
||||
|
||||
private isMain(sessionId: SessionId): boolean {
|
||||
return (this.sessions.list.getSnapshot().byId[sessionId]?.retainedBy.mainView ?? 0) > 0
|
||||
}
|
||||
|
||||
private publishStatus(): void {
|
||||
const pending = this.pendingInteractions.getSnapshot()
|
||||
const ids = new Set<SessionId>([
|
||||
...(Object.keys(this.sessions.list.getSnapshot().byId) as SessionId[]),
|
||||
...this.running.keys(),
|
||||
...pending.keys(),
|
||||
...this.completionUnread,
|
||||
])
|
||||
const next = new Map<SessionId, SessionStatus>()
|
||||
for (const id of ids) {
|
||||
next.set(id, {
|
||||
running: this.running.get(id),
|
||||
pendingInteraction: pending.get(id),
|
||||
completionUnread: this.completionUnread.has(id),
|
||||
})
|
||||
}
|
||||
if (sameSessionStatus(this.statusSnapshot, next)) return
|
||||
this.statusSnapshot = next
|
||||
notifySubscribers(this.statusListeners, '[session-status] Session status')
|
||||
}
|
||||
}
|
||||
|
||||
function sameSessionStatus(left: SessionStatusSnapshot, right: SessionStatusSnapshot): boolean {
|
||||
if (left.size !== right.size) return false
|
||||
for (const [id, status] of left) {
|
||||
const candidate = right.get(id)
|
||||
if (candidate === undefined
|
||||
|| candidate.running !== status.running
|
||||
|| candidate.pendingInteraction !== status.pendingInteraction
|
||||
|| candidate.completionUnread !== status.completionUnread) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/** Host loader entry for the browser-only Session status plugin. */
|
||||
|
||||
/** Provides no Host-side behavior. */
|
||||
export function apply(): void {}
|
||||
@@ -0,0 +1,42 @@
|
||||
// @vitest-environment jsdom
|
||||
/** Plugins that render `useSessionStatus` follow the status table's plugin lifecycle in the real Loader and renderer. */
|
||||
import { act } from '@testing-library/react'
|
||||
import { expect, onTestFinished, vi } from 'vitest'
|
||||
import { createClientTest, webApp } from '@deepseek-ai/dsh-client-test-runtime/src/assembly/index.ts'
|
||||
|
||||
const STATUS = '@deepseek-ai/dsh-client-ui-session-status'
|
||||
const WORKSPACE = '@deepseek-ai/dsh-client-ui-workspace'
|
||||
const CONVERSATION = '@deepseek-ai/dsh-client-ui-conversation'
|
||||
|
||||
const it = createClientTest({ roster: webApp.closure([WORKSPACE, CONVERSATION]) }, { mount: true })
|
||||
|
||||
it('unloads hook consumers with the status table and renders them again after it reloads', async ({ start }) => {
|
||||
const errors = vi.spyOn(console, 'error')
|
||||
onTestFinished(() => { errors.mockRestore() })
|
||||
const client = await start()
|
||||
const entry = (name: string) => [...client.ctx.loader.entries()].find(candidate => candidate.options.name === name)
|
||||
// Each consumer provides its own service only while its plugin is active.
|
||||
const consumers = () => [client.ctx.get('uiWorkspace') !== undefined, client.ctx.get('uiConversation') !== undefined]
|
||||
const slotText = (name: string) => client.container!.querySelector(`[data-slot="${name}"]`)?.textContent ?? ''
|
||||
const status = entry(STATUS)
|
||||
if (status === undefined) throw new Error(`${STATUS} is not in the roster`)
|
||||
|
||||
expect(consumers()).toEqual([true, true])
|
||||
expect(slotText('sidebar.workspaces')).toContain('Workspaces')
|
||||
expect(slotText('main.conversation')).toContain('Choose a workspace to start')
|
||||
|
||||
await act(async () => { await status.update({ disabled: true }) })
|
||||
await client.flush()
|
||||
|
||||
expect(consumers()).toEqual([false, false])
|
||||
expect(slotText('sidebar.workspaces')).not.toContain('Workspaces')
|
||||
expect(slotText('main.conversation')).not.toContain('Choose a workspace to start')
|
||||
|
||||
await act(async () => { await status.update({ disabled: false }) })
|
||||
await client.flush()
|
||||
|
||||
expect(consumers()).toEqual([true, true])
|
||||
expect(slotText('sidebar.workspaces')).toContain('Workspaces')
|
||||
expect(slotText('main.conversation')).toContain('Choose a workspace to start')
|
||||
expect(errors).not.toHaveBeenCalled()
|
||||
}, 60_000)
|
||||
+22
-9
@@ -1,11 +1,13 @@
|
||||
/** Running-state ownership across the real Controller catalog and UI status source. */
|
||||
/** Session status across the real Controller catalog, ui-session pending interactions, and the status service. */
|
||||
import { expect, vi } from 'vitest'
|
||||
import { ok } from '@deepseek-ai/dsh-remote-mock'
|
||||
import { createClientTest, webApp } from '@deepseek-ai/dsh-client-test-runtime/src/assembly/index.ts'
|
||||
import { SESSION_FORMAT_VERSION, type SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { SessionFollowFrame } from '@deepseek-ai/dsh-api-session-controller/types'
|
||||
import type { SessionPendingInteractionBase } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type {} from '../src/client/index.ts'
|
||||
|
||||
const it = createClientTest({ roster: webApp.closure(['@deepseek-ai/dsh-client-ui-session']) })
|
||||
const it = createClientTest({ roster: webApp.closure(['@deepseek-ai/dsh-client-ui-session-status']) })
|
||||
const parentId = 'status-parent' as SessionId
|
||||
const childId = 'status-child' as SessionId
|
||||
|
||||
@@ -29,37 +31,48 @@ it('preserves unlisted child status through metadata updates and main view ackno
|
||||
})
|
||||
const client = await start()
|
||||
const sessions = client.ctx.sessions
|
||||
const ui = client.ctx.uiSession
|
||||
const status = client.ctx.uiSession.sessionStatus
|
||||
await sessions.refresh()
|
||||
await sessions.refreshProjections(parentId)
|
||||
await client.flush()
|
||||
expect(sessions.list.getSnapshot().ids).toEqual([parentId])
|
||||
expect(sessions.binding(childId)).toBeUndefined()
|
||||
expect(ui.sessionStatus.getSnapshot().get(childId)).toMatchObject({ running: undefined, completionUnread: false })
|
||||
expect(status.getSnapshot().get(childId)).toMatchObject({ running: undefined, completionUnread: false })
|
||||
|
||||
mock.streams.push('$events', { type: 'emit', event: 'api-session/status', args: [childId, true] })
|
||||
await mock.streams.drained('$events')
|
||||
await client.flush()
|
||||
expect(ui.sessionStatus.getSnapshot().get(childId)).toMatchObject({ running: true, completionUnread: false })
|
||||
expect(status.getSnapshot().get(childId)).toMatchObject({ running: true, completionUnread: false })
|
||||
|
||||
mock.streams.push('$events', { type: 'emit', event: 'api-session/activity', args: [parentId, 2] })
|
||||
await mock.streams.drained('$events')
|
||||
await client.flush()
|
||||
expect(sessions.list.getSnapshot().byId[parentId]?.updatedAt).toBe(2)
|
||||
expect(ui.sessionStatus.getSnapshot().get(childId)).toMatchObject({ running: true, completionUnread: false })
|
||||
expect(status.getSnapshot().get(childId)).toMatchObject({ running: true, completionUnread: false })
|
||||
|
||||
mock.streams.push('$events', { type: 'emit', event: 'api-session/status', args: [childId, false] })
|
||||
await mock.streams.drained('$events')
|
||||
await client.flush()
|
||||
expect(ui.sessionStatus.getSnapshot().get(childId)).toMatchObject({ running: false, completionUnread: true })
|
||||
expect(status.getSnapshot().get(childId)).toMatchObject({ running: false, completionUnread: true })
|
||||
|
||||
using reference = sessions.retain(childId, { source: 'mainView' })
|
||||
await reference.ready
|
||||
expect(sessions.list.getSnapshot().ids).not.toContain(childId)
|
||||
await vi.waitFor(() => {
|
||||
expect(ui.sessionStatus.getSnapshot().get(childId)).toMatchObject({ running: false, completionUnread: false })
|
||||
expect(status.getSnapshot().get(childId)).toMatchObject({ running: false, completionUnread: false })
|
||||
})
|
||||
reference.release()
|
||||
await client.flush()
|
||||
expect(ui.sessionStatus.getSnapshot().get(childId)?.completionUnread).toBe(false)
|
||||
expect(status.getSnapshot().get(childId)?.completionUnread).toBe(false)
|
||||
})
|
||||
|
||||
it('reports the effective ui-session pending interaction as the same request object', async ({ start }) => {
|
||||
const client = await start()
|
||||
const status = client.ctx.uiSession.sessionStatus
|
||||
const publish = client.ctx.uiSession.registerPendingInteraction<SessionPendingInteractionBase>(() => 0)
|
||||
const request = { key: 'approval:1', kind: 'approval', sessionId: parentId }
|
||||
const remove = publish(request, async () => {})
|
||||
expect(status.getSnapshot().get(parentId)?.pendingInteraction).toBe(request)
|
||||
remove()
|
||||
expect(status.getSnapshot().get(parentId)?.pendingInteraction).toBeUndefined()
|
||||
})
|
||||
@@ -0,0 +1,239 @@
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import type { ISessions, SessionListState } from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
||||
import type { SessionPendingInteraction } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { apply } from '../src/client/index.ts'
|
||||
import { UiSessionStatus } from '../src/client/status.ts'
|
||||
import { apply as nodeApply } from '../src/index.ts'
|
||||
|
||||
const sessionId = (value: string): SessionId => value as SessionId
|
||||
const pendingQuestion = (id: SessionId) => ({ key: 'question:1', kind: 'question', sessionId: id }) as SessionPendingInteraction
|
||||
const roots: Context[] = []
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(roots.splice(0).map(ctx => ctx.fiber.dispose()))
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
function bench() {
|
||||
const ctx = new Context()
|
||||
roots.push(ctx)
|
||||
let statusListener: ((id: SessionId, running: boolean) => void) | undefined
|
||||
ctx.provide('remote', {
|
||||
$on: (_event: string, listener: (id: SessionId, running: boolean) => void) => {
|
||||
statusListener = listener
|
||||
return () => { if (statusListener === listener) statusListener = undefined }
|
||||
},
|
||||
} as never)
|
||||
const list = createSnapshotStore<SessionListState>({ ids: [], byId: {}, phase: 'ready', projectionsBySession: {} })
|
||||
const sessions: Pick<ISessions, 'list'> = { list }
|
||||
const pending = createSnapshotStore<ReadonlyMap<SessionId, SessionPendingInteraction>>(new Map())
|
||||
const status = () => new UiSessionStatus(ctx, sessions, pending)
|
||||
const row = (id: SessionId) => {
|
||||
list.update((draft) => {
|
||||
if (!draft.ids.includes(id)) draft.ids.push(id)
|
||||
draft.byId[id] = { id, displayTitle: id, running: false, retainedBy: {}, blank: false, updatedAt: 1 }
|
||||
})
|
||||
}
|
||||
const setMainView = (id: SessionId, count: number) => {
|
||||
list.update((draft) => {
|
||||
draft.byId[id] = { ...draft.byId[id]!, retainedBy: count === 0 ? {} : { mainView: count } }
|
||||
})
|
||||
}
|
||||
const emitStatus = (id: SessionId, running: boolean) => {
|
||||
if (statusListener === undefined) throw new Error('api-session/status is not subscribed')
|
||||
statusListener(id, running)
|
||||
}
|
||||
return { ctx, list, pending, status, row, setMainView, emitStatus, subscribed: () => statusListener !== undefined }
|
||||
}
|
||||
|
||||
describe('Session running status and completion reminders', () => {
|
||||
it('keeps synthetic-row status unknown until an event or Host baseline establishes it', () => {
|
||||
const b = bench()
|
||||
const id = sessionId('catalog-only')
|
||||
b.list.update((draft) => {
|
||||
draft.byId[id] = { id, displayTitle: id, running: false, retainedBy: {}, blank: false, updatedAt: 0 }
|
||||
})
|
||||
const service = b.status()
|
||||
expect(service.getSnapshot().get(id)?.running).toBeUndefined()
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
|
||||
b.emitStatus(id, true)
|
||||
b.list.update((draft) => { draft.byId[id]!.displayTitle = 'Renamed child' })
|
||||
expect(service.getSnapshot().get(id)?.running).toBe(true)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
|
||||
b.list.update((draft) => { draft.ids.push(id) })
|
||||
expect(service.getSnapshot().get(id)?.running).toBe(false)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(true)
|
||||
})
|
||||
|
||||
it('records non-main completions and lets main-view activity acknowledge them', () => {
|
||||
const b = bench()
|
||||
const id = sessionId('s1')
|
||||
b.row(id)
|
||||
const service = b.status()
|
||||
const changed = vi.fn()
|
||||
const off = service.subscribe(changed)
|
||||
|
||||
expect(service.getSnapshot().get(id)).toEqual({
|
||||
running: false,
|
||||
pendingInteraction: undefined,
|
||||
completionUnread: false,
|
||||
})
|
||||
b.list.update((draft) => { draft.byId[id]!.running = true })
|
||||
expect(service.getSnapshot().get(id)?.running).toBe(true)
|
||||
b.list.update((draft) => { draft.byId[id]!.running = false })
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(true)
|
||||
b.setMainView(id, 1)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
b.setMainView(id, 0)
|
||||
|
||||
b.emitStatus(id, true)
|
||||
b.emitStatus(id, false)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(true)
|
||||
|
||||
b.setMainView(id, 1)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
b.emitStatus(id, true)
|
||||
b.emitStatus(id, false)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
|
||||
b.setMainView(id, 0)
|
||||
b.emitStatus(id, false)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
b.emitStatus(id, true)
|
||||
b.emitStatus(id, false)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(true)
|
||||
b.emitStatus(id, true)
|
||||
expect(service.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
expect(changed).toHaveBeenCalled()
|
||||
off()
|
||||
})
|
||||
|
||||
it('records an idle event before the initial catalog baseline and retires absent status later', () => {
|
||||
const b = bench()
|
||||
const id = sessionId('early')
|
||||
b.list.update((draft) => { draft.phase = 'pending' })
|
||||
const service = b.status()
|
||||
|
||||
b.emitStatus(id, false)
|
||||
expect(service.getSnapshot().get(id)).toEqual({
|
||||
running: false,
|
||||
pendingInteraction: undefined,
|
||||
completionUnread: true,
|
||||
})
|
||||
b.list.update((draft) => { draft.phase = 'ready' })
|
||||
expect(service.getSnapshot().has(id)).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps the snapshot reference until a status fact changes', () => {
|
||||
const b = bench()
|
||||
const id = sessionId('s1')
|
||||
b.row(id)
|
||||
const service = b.status()
|
||||
const changed = vi.fn()
|
||||
service.subscribe(changed)
|
||||
const before = service.getSnapshot()
|
||||
|
||||
b.emitStatus(id, false)
|
||||
b.list.update((draft) => { draft.byId[id]!.displayTitle = 'Renamed' })
|
||||
expect(service.getSnapshot()).toBe(before)
|
||||
expect(changed).not.toHaveBeenCalled()
|
||||
b.emitStatus(id, true)
|
||||
expect(service.getSnapshot()).not.toBe(before)
|
||||
expect(changed).toHaveBeenCalledOnce()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Session status pending interactions', () => {
|
||||
it('carries the exact effective request object and adds Sessions known only by their request', () => {
|
||||
const b = bench()
|
||||
const listed = sessionId('listed')
|
||||
const unlisted = sessionId('unlisted')
|
||||
b.row(listed)
|
||||
const service = b.status()
|
||||
const changed = vi.fn()
|
||||
service.subscribe(changed)
|
||||
const approval = { key: 'approval:1', kind: 'approval', sessionId: listed } as SessionPendingInteraction
|
||||
const question = { key: 'question:1', kind: 'question', sessionId: unlisted } as SessionPendingInteraction
|
||||
|
||||
b.pending.set(new Map([[listed, approval], [unlisted, question]]))
|
||||
expect(service.getSnapshot().get(listed)).toEqual({ running: false, pendingInteraction: approval, completionUnread: false })
|
||||
expect(service.getSnapshot().get(listed)?.pendingInteraction).toBe(approval)
|
||||
expect(service.getSnapshot().get(unlisted)).toEqual({
|
||||
running: undefined, pendingInteraction: question, completionUnread: false,
|
||||
})
|
||||
expect(changed).toHaveBeenCalledOnce()
|
||||
|
||||
b.pending.set(new Map([[listed, approval], [unlisted, question]]))
|
||||
expect(changed).toHaveBeenCalledOnce()
|
||||
b.pending.set(new Map())
|
||||
expect(service.getSnapshot().get(listed)?.pendingInteraction).toBeUndefined()
|
||||
expect(service.getSnapshot().has(unlisted)).toBe(false)
|
||||
expect(changed).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it('contains a failing status subscriber and continues dispatch', () => {
|
||||
const b = bench()
|
||||
const service = b.status()
|
||||
const failure = new Error('status subscriber failed')
|
||||
const report = vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
service.subscribe(() => { throw failure })
|
||||
const after = vi.fn()
|
||||
service.subscribe(after)
|
||||
|
||||
b.pending.set(new Map([[sessionId('s1'), pendingQuestion(sessionId('s1'))]]))
|
||||
|
||||
expect(after).toHaveBeenCalledOnce()
|
||||
expect(report).toHaveBeenCalledWith('[session-status] Session status subscriber failed:', failure)
|
||||
})
|
||||
|
||||
it('stops following its sources when its plugin unloads', async () => {
|
||||
const b = bench()
|
||||
let service: UiSessionStatus | undefined
|
||||
const fiber = b.ctx.plugin({
|
||||
apply(scope: Context) {
|
||||
service = new UiSessionStatus(scope, { list: b.list }, b.pending)
|
||||
},
|
||||
})
|
||||
await fiber.await()
|
||||
if (service === undefined) throw new Error('UiSessionStatus did not start')
|
||||
expect(b.subscribed()).toBe(true)
|
||||
const before = service.getSnapshot()
|
||||
|
||||
await fiber.dispose()
|
||||
|
||||
expect(b.subscribed()).toBe(false)
|
||||
b.row(sessionId('later'))
|
||||
b.pending.set(new Map([[sessionId('later'), pendingQuestion(sessionId('later'))]]))
|
||||
expect(service.getSnapshot()).toBe(before)
|
||||
})
|
||||
})
|
||||
|
||||
describe('session-status apply', () => {
|
||||
it('provides the status service under ctx.uiSession and publishes it as the root useSessionStatus source', () => {
|
||||
const b = bench()
|
||||
const provideRoot = vi.fn()
|
||||
b.ctx.provide('sessions', { list: b.list } as never)
|
||||
b.ctx.provide('slots', { provideRoot } as never)
|
||||
b.ctx.provide('uiSession', { pendingInteractions: b.pending } as never)
|
||||
|
||||
apply(b.ctx)
|
||||
|
||||
expect(provideRoot).toHaveBeenCalledOnce()
|
||||
const root = provideRoot.mock.calls[0]![0] as { hooks: { sessionStatus: UiSessionStatus } }
|
||||
expect(Object.keys(root)).toEqual(['hooks'])
|
||||
expect(Object.keys(root.hooks)).toEqual(['sessionStatus'])
|
||||
expect(root.hooks.sessionStatus).toBeInstanceOf(UiSessionStatus)
|
||||
const provided: unknown = b.ctx.get('uiSession.sessionStatus')
|
||||
if (!(provided instanceof UiSessionStatus)) throw new Error('uiSession.sessionStatus is not provided')
|
||||
expect(provided.getSnapshot()).toBe(root.hooks.sessionStatus.getSnapshot())
|
||||
})
|
||||
|
||||
it('keeps the Host loader half inert', () => {
|
||||
expect(() => { nodeApply() }).not.toThrow()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.base.client.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "lib/types"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../vendor/cordis"
|
||||
},
|
||||
{
|
||||
"path": "../../api/remotes/tsconfig.client.json"
|
||||
},
|
||||
{
|
||||
"path": "../../api/session-controller/tsconfig.client.json"
|
||||
},
|
||||
{
|
||||
"path": "../../core/session"
|
||||
},
|
||||
{
|
||||
"path": "../store"
|
||||
},
|
||||
{
|
||||
"path": "../ui-renderer"
|
||||
},
|
||||
{
|
||||
"path": "../ui-session"
|
||||
},
|
||||
{
|
||||
"path": "../ui-slots"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { clientBundle } from '../tsdown.client.ts'
|
||||
|
||||
export default clientBundle(import.meta.dirname, ['lib/types/index.js'])
|
||||
@@ -9,14 +9,17 @@
|
||||
en: 22464c74746de6c2
|
||||
zh: 171a244a493a277e
|
||||
/deepseek-ai-dsh-client-ui-session/summary:
|
||||
en: 75428e0474a073a4
|
||||
zh: 18f1db4b4c5302e5
|
||||
en: 164c245872687c87
|
||||
zh: 80ad1ecfbc78c3f5
|
||||
/deepseek-ai-dsh-client-ui-session/table-of-contents:
|
||||
en: 12e1ffc25a2d6695
|
||||
zh: 321156dea1356e55
|
||||
en: 2abfd2105ed73a78
|
||||
zh: 042ec2f41ac7d1b6
|
||||
/deepseek-ai-dsh-client-ui-session/access-hooks:
|
||||
en: 7bf4bca5607248fa
|
||||
zh: 665d5c4e9cd29f68
|
||||
en: 9b32047bba740867
|
||||
zh: 3b08b927c99a162c
|
||||
/deepseek-ai-dsh-client-ui-session/sub-services:
|
||||
en: 7d3c27551c090dd6
|
||||
zh: 9de5063e62818570
|
||||
/deepseek-ai-dsh-client-ui-session/model-experience:
|
||||
en: cb2d4451e8bf8520
|
||||
zh: 6d3adbb930d90c59
|
||||
|
||||
@@ -8,13 +8,14 @@ English | [中文](README.zh.md)
|
||||
|
||||
## Summary
|
||||
|
||||
Use this package to expose Session catalog, retain information, and unified UI status through standard Slot hooks. It materializes per-`SessionBinding` hooks and props, while `SessionProvider` can inherit an outer binding or bind an explicit `SessionReference`. It owns process-local pending-interaction and completion-reminder policy without owning Controller transport, history, or references.
|
||||
Use this package to expose the Session catalog and retain information through standard Slot hooks. It materializes per-`SessionBinding` hooks and props, while `SessionProvider` can inherit an outer binding or bind an explicit `SessionReference`. It owns process-local pending-interaction policy without owning Controller transport, history, or references.
|
||||
|
||||
Running status comes from Host list baselines or status events. Subagent catalog rows and retained subagent fallback rows do not establish running status; main view references still acknowledge completions.
|
||||
Domain plugins publish requests awaiting the user through `ctx.uiSession.registerPendingInteraction(precedence)`, and `ctx.uiSession.pendingInteractions` exposes each Session's highest-precedence request read-only. The Session status table and `useSessionStatus` belong to [`dsh-client-ui-session-status`](../ui-session-status/README.md).
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Access Hooks](#access-hooks)
|
||||
- [Sub-services](#sub-services)
|
||||
- [Model Experience](#model-experience)
|
||||
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
||||
- [Dev Note](#dev-note)
|
||||
@@ -26,6 +27,11 @@ Running status comes from Host list baselines or status events. Subagent catalog
|
||||
|
||||
The package injects the Client `remoteAccess` service and publishes Session access Hooks over its `source()`: the root `useSessionAccess(sessionId, action)` answers on one Session resource, and the Session-scope `useAccess(action)` answers on the bound Session's resource; the `global` resource's answer is a different Hook, `useRemoteAccess(action)`, so neither shadows the other. `ctx.uiSession.whenAccess(sessionId, action, callback)` is the JS counterpart of `useSessionAccess`: it keeps the callback's effects installed while the current Peer may call `action` on that Session, with the semantics of `ctx.remoteAccess.whenAccess`. The SessionMaybe-scope `useAccess(action)` returns `undefined` while no Session is bound, which callers treat as not allowed; a decision on the `global` resource reads `useRemoteAccess` instead. Snapshot semantics belong to [`dsh-api-remote-access`](../../api/remote-access/README.md#client-face).
|
||||
|
||||
<a id="sub-services"></a>
|
||||
## Sub-services
|
||||
|
||||
`ctx.uiSession` has the type `UiSessionService`. A package that provides a sub-service `x` as the Cordis service `uiSession.x`, read as `ctx.uiSession.x`, merges the member `x` into that interface; [`dsh-client-ui-session-status`](../ui-session-status/README.md) provides `ctx.uiSession.sessionStatus` this way.
|
||||
|
||||
<a id="model-experience"></a>
|
||||
## Model Experience
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@ kind: "package-reference"
|
||||
|
||||
## 概述
|
||||
|
||||
使用本包可通过标准 Slot 钩子公开 Session catalog、retain 信息与统一 UI 状态。它按 `SessionBinding` 物化钩子和 prop,而 `SessionProvider` 可以继承外围 binding 或绑定显式 `SessionReference`。它拥有进程本地的 pending-interaction 与完成提醒策略,但不拥有 Controller transport、历史或 reference。
|
||||
使用本包可通过标准 Slot 钩子公开 Session catalog 与 retain 信息。它按 `SessionBinding` 物化钩子和 prop,而 `SessionProvider` 可以继承外围 binding 或绑定显式 `SessionReference`。它拥有进程本地的 pending-interaction 策略,但不拥有 Controller transport、历史或 reference。
|
||||
|
||||
运行状态来自 Host 列表基线或状态事件。Subagent 目录行和已保留子会话的 fallback 行不会建立运行状态;主视图引用仍会确认完成提醒。
|
||||
领域插件通过 `ctx.uiSession.registerPendingInteraction(precedence)` 发布等待用户处理的请求,`ctx.uiSession.pendingInteractions` 以只读方式提供每个 Session 优先级最高的请求。会话状态表与 `useSessionStatus` 归 [`dsh-client-ui-session-status`](../ui-session-status/README.zh.md) 所有。
|
||||
|
||||
## 目录
|
||||
|
||||
- [访问 Hook](#access-hooks)
|
||||
- [子服务](#sub-services)
|
||||
- [模型体验](#model-experience)
|
||||
- [已知限制与暂缓事项](#known-limitations-and-deferred-work)
|
||||
- [开发备注](#dev-note)
|
||||
@@ -26,6 +27,11 @@ kind: "package-reference"
|
||||
|
||||
本包注入 Client `remoteAccess` 服务,并在其 `source()` 之上发布会话访问 Hook:根作用域的 `useSessionAccess(sessionId, action)` 回答某一个 Session 资源上的访问,Session 作用域的 `useAccess(action)` 回答所绑定 Session 资源上的访问;`global` 资源上的答案是另一个 Hook `useRemoteAccess(action)`,两者互不遮蔽。`ctx.uiSession.whenAccess(sessionId, action, callback)` 是 `useSessionAccess` 在 JS 侧的对应:当前 Peer 能在该 Session 上调用 `action` 期间保持回调的效果,语义同 `ctx.remoteAccess.whenAccess`。SessionMaybe 作用域的 `useAccess(action)` 在未绑定 Session 时返回 `undefined`,调用方将其视为不允许;需要 `global` 资源上的判断时读 `useRemoteAccess`。快照语义归 [`dsh-api-remote-access`](../../api/remote-access/README.zh.md#client-face)。
|
||||
|
||||
<a id="sub-services"></a>
|
||||
## 子服务
|
||||
|
||||
`ctx.uiSession` 的类型是 `UiSessionService`。以 Cordis 服务 `uiSession.x` 提供子服务 `x`、并以 `ctx.uiSession.x` 读取的包,把成员 `x` 声明合并进该接口;[`dsh-client-ui-session-status`](../ui-session-status/README.zh.md) 就以这种方式提供 `ctx.uiSession.sessionStatus`。
|
||||
|
||||
<a id="model-experience"></a>
|
||||
## 模型体验
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
"client": {
|
||||
"inject": [
|
||||
"@deepseek-ai/dsh-api-remote-access",
|
||||
"@deepseek-ai/dsh-api-remotes",
|
||||
"@deepseek-ai/dsh-api-session-controller",
|
||||
"@deepseek-ai/dsh-client-ui-renderer"
|
||||
],
|
||||
@@ -48,13 +47,11 @@
|
||||
"devDependencies": {
|
||||
"@deepseek-ai/cordis": "workspace:~",
|
||||
"@deepseek-ai/dsh-api-remote-access": "workspace:*",
|
||||
"@deepseek-ai/dsh-api-remotes": "workspace:*",
|
||||
"@deepseek-ai/dsh-api-session-controller": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-store": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-test-runtime": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
|
||||
"@deepseek-ai/dsh-remote-mock": "workspace:*",
|
||||
"@deepseek-ai/dsh-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-util-values": "workspace:*",
|
||||
"react": "^18.2.0"
|
||||
|
||||
@@ -7,11 +7,9 @@ import type {
|
||||
SessionReference,
|
||||
SessionRetainInfo,
|
||||
SessionSnapshot,
|
||||
SessionSummary,
|
||||
UseProjection,
|
||||
} from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type {} from '@deepseek-ai/dsh-api-remotes/client'
|
||||
import type { AccessEffect, RemoteEndpoint } from '@deepseek-ai/dsh-api-remote-access/client'
|
||||
import { notifySubscribers } from '@deepseek-ai/dsh-client-store'
|
||||
import { WeakMapWithValues } from '@deepseek-ai/dsh-util-values'
|
||||
@@ -56,21 +54,6 @@ export type SessionPendingInteraction =
|
||||
? SessionPendingInteractionBase
|
||||
: SessionPendingInteractionMap[keyof SessionPendingInteractionMap]
|
||||
|
||||
/** Independent UI status facts for one Session identity. */
|
||||
export interface SessionStatus {
|
||||
/** Latest known running state; absent until a baseline or event establishes it. */
|
||||
readonly running: boolean | undefined
|
||||
/** Highest-precedence domain request currently awaiting user interaction. */
|
||||
readonly pendingInteraction: SessionPendingInteraction | undefined
|
||||
/** Whether an observed stop outside the main view still needs acknowledgement. */
|
||||
readonly completionUnread: boolean
|
||||
}
|
||||
|
||||
/** Current UI status indexed by Session identity. */
|
||||
export type SessionStatusSnapshot = ReadonlyMap<SessionId, SessionStatus>
|
||||
/** Selector hook over the unified Session UI status snapshot. */
|
||||
export type UseSessionStatus = SnapshotSelectorHook<SessionStatusSnapshot>
|
||||
|
||||
/** Selector hook for explicit or surrounding-Provider Session reference counts. */
|
||||
export interface UseSessionRetainInfo {
|
||||
/**
|
||||
@@ -157,7 +140,6 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
||||
interface GlobalStandardProps {
|
||||
/** Session list and current selection. */
|
||||
useSessions: UseSessions
|
||||
useSessionStatus: UseSessionStatus
|
||||
useSessionRetainInfo: UseSessionRetainInfo
|
||||
/** Whether the current Peer may call `action` on one Session resource. */
|
||||
useSessionAccess: (sessionId: SessionId, action: RemoteEndpoint) => boolean
|
||||
@@ -195,10 +177,17 @@ declare module '@deepseek-ai/dsh-api-session-controller/client' {
|
||||
declare module '@deepseek-ai/cordis' {
|
||||
interface Context {
|
||||
/** Session Controller adapter and session-scoped source registry. */
|
||||
uiSession: UiSession
|
||||
uiSession: UiSessionService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of `ctx.uiSession`: the {@link UiSession} service plus the sub-services other Client packages provide beneath
|
||||
* it. A package declares its sub-service `x`, provided as the Cordis service `uiSession.x` and read as
|
||||
* `ctx.uiSession.x`, by merging a member into this interface; Typert analysis rejects members merged into the class.
|
||||
*/
|
||||
export interface UiSessionService extends UiSession {}
|
||||
|
||||
type SessionSourceRoster = readonly string[] | undefined
|
||||
type StandardMemberKind = 'hook' | 'keyed hook' | 'prop'
|
||||
|
||||
@@ -288,19 +277,19 @@ export class UiSession extends Service {
|
||||
private readonly current: BindingSource
|
||||
private readonly pendingDomains: RuntimePendingDomain[] = []
|
||||
private pendingSnapshot: ReadonlyMap<SessionId, SessionPendingInteractionBase> = new Map()
|
||||
private readonly running = new Map<SessionId, boolean>()
|
||||
private readonly completionUnread = new Set<SessionId>()
|
||||
private statusSnapshot: SessionStatusSnapshot = new Map()
|
||||
private readonly statusListeners = new Set<() => void>()
|
||||
private readonly pendingListeners = new Set<() => void>()
|
||||
private mainRetainId: SessionId | undefined
|
||||
private disposeMainRetain = (): void => {}
|
||||
private active = true
|
||||
/** Root source combining running, pending-interaction, and completion-reminder facts. */
|
||||
readonly sessionStatus: HostObservable<SessionStatusSnapshot> = {
|
||||
getSnapshot: () => this.statusSnapshot,
|
||||
/**
|
||||
* Read-only view of every Session's highest-precedence pending interaction. The snapshot keeps its
|
||||
* reference until an effective request changes; a throwing listener is reported without stopping later listeners.
|
||||
*/
|
||||
readonly pendingInteractions: HostObservable<ReadonlyMap<SessionId, SessionPendingInteraction>> = {
|
||||
getSnapshot: () => this.pendingSnapshot,
|
||||
subscribe: (listener) => {
|
||||
this.statusListeners.add(listener)
|
||||
return () => { this.statusListeners.delete(listener) }
|
||||
this.pendingListeners.add(listener)
|
||||
return () => { this.pendingListeners.delete(listener) }
|
||||
},
|
||||
}
|
||||
/** Renderer-facing adapter for `session` and `session-maybe` scopes. */
|
||||
@@ -325,17 +314,10 @@ export class UiSession extends Service {
|
||||
|
||||
ctx.effect(() => {
|
||||
const disposeList = sessions.list.subscribe(() => { this.publishMain() })
|
||||
const disposeStatus = sessions.list.subscribe(() => { this.reconcileStatus() })
|
||||
const disposeRemoteStatus = ctx.remote.$on('api-session/status', (sessionId, running) => {
|
||||
this.observeRunning(sessionId, running)
|
||||
})
|
||||
this.publishMain()
|
||||
this.reconcileStatus()
|
||||
return () => {
|
||||
this.active = false
|
||||
disposeList()
|
||||
disposeStatus()
|
||||
disposeRemoteStatus()
|
||||
this.disposeMainRetain()
|
||||
const records = [...this.bindings.values]
|
||||
this.bindings.clear()
|
||||
@@ -502,64 +484,7 @@ export class UiSession extends Service {
|
||||
)
|
||||
if (samePendingInteractions(this.pendingSnapshot, projected)) return
|
||||
this.pendingSnapshot = projected
|
||||
this.publishStatus()
|
||||
}
|
||||
|
||||
private observeRunning(sessionId: SessionId, running: boolean): void {
|
||||
const previous = this.running.get(sessionId)
|
||||
const beforeBaseline = this.sessions.list.getSnapshot().phase === 'pending'
|
||||
this.running.set(sessionId, running)
|
||||
if (running) this.completionUnread.delete(sessionId)
|
||||
else if ((previous === true || (previous === undefined && beforeBaseline))
|
||||
&& !this.isMain(sessionId)) this.completionUnread.add(sessionId)
|
||||
this.publishStatus()
|
||||
}
|
||||
|
||||
private reconcileStatus(): void {
|
||||
const list = this.sessions.list.getSnapshot()
|
||||
const present = new Set(Object.keys(list.byId) as SessionId[])
|
||||
// Subagent catalog rows and retained subagent fallback rows do not establish Host running state.
|
||||
for (const id of list.ids) {
|
||||
const row = list.byId[id] as SessionSummary
|
||||
const previous = this.running.get(id)
|
||||
if (previous === undefined) this.running.set(id, row.running)
|
||||
else if (previous !== row.running) this.observeRunning(id, row.running)
|
||||
}
|
||||
for (const id of present) {
|
||||
if (this.isMain(id)) this.completionUnread.delete(id)
|
||||
}
|
||||
if (list.phase === 'ready') {
|
||||
for (const id of this.running.keys()) {
|
||||
if (present.has(id)) continue
|
||||
this.running.delete(id)
|
||||
this.completionUnread.delete(id)
|
||||
}
|
||||
}
|
||||
this.publishStatus()
|
||||
}
|
||||
|
||||
private isMain(sessionId: SessionId): boolean {
|
||||
return (this.sessions.list.getSnapshot().byId[sessionId]?.retainedBy.mainView ?? 0) > 0
|
||||
}
|
||||
|
||||
private publishStatus(): void {
|
||||
const ids = new Set<SessionId>([
|
||||
...(Object.keys(this.sessions.list.getSnapshot().byId) as SessionId[]),
|
||||
...this.running.keys(),
|
||||
...this.pendingSnapshot.keys(),
|
||||
...this.completionUnread,
|
||||
])
|
||||
const next = new Map<SessionId, SessionStatus>()
|
||||
for (const id of ids) {
|
||||
next.set(id, {
|
||||
running: this.running.get(id),
|
||||
pendingInteraction: this.pendingSnapshot.get(id),
|
||||
completionUnread: this.completionUnread.has(id),
|
||||
})
|
||||
}
|
||||
if (sameSessionStatus(this.statusSnapshot, next)) return
|
||||
this.statusSnapshot = next
|
||||
notifySubscribers(this.statusListeners, '[ui-session] Session status')
|
||||
notifySubscribers(this.pendingListeners, '[ui-session] pending interactions')
|
||||
}
|
||||
|
||||
private createMaterializedBinding(owner: SessionBinding): MaterializedBinding {
|
||||
@@ -685,8 +610,8 @@ function claimStandardProp(kind: StandardMemberKind, name: string, finalProps: S
|
||||
finalProps.add(propName)
|
||||
}
|
||||
|
||||
/** Required Controller, renderer, Remote, and access services. */
|
||||
export const inject = ['sessions', 'slots', 'remote', 'remoteAccess']
|
||||
/** Required Controller, renderer, and access services. */
|
||||
export const inject = ['sessions', 'slots', 'remoteAccess']
|
||||
|
||||
/**
|
||||
* Install the Session root source and scoped adapter.
|
||||
@@ -697,7 +622,6 @@ export function apply(ctx: Context): void {
|
||||
ctx.slots.provideRoot({
|
||||
hooks: {
|
||||
sessions: ctx.sessions.list,
|
||||
sessionStatus: service.sessionStatus,
|
||||
},
|
||||
keyedHooks: {
|
||||
sessionRetainInfo: key => ctx.sessions.retainInfo(key as SessionId),
|
||||
@@ -715,18 +639,6 @@ export function apply(ctx: Context): void {
|
||||
})
|
||||
}
|
||||
|
||||
function sameSessionStatus(left: SessionStatusSnapshot, right: SessionStatusSnapshot): boolean {
|
||||
if (left.size !== right.size) return false
|
||||
for (const [id, status] of left) {
|
||||
const candidate = right.get(id)
|
||||
if (candidate === undefined
|
||||
|| candidate.running !== status.running
|
||||
|| candidate.pendingInteraction !== status.pendingInteraction
|
||||
|| candidate.completionUnread !== status.completionUnread) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function samePendingInteractions(
|
||||
left: ReadonlyMap<SessionId, SessionPendingInteractionBase>,
|
||||
right: ReadonlyMap<SessionId, SessionPendingInteractionBase>,
|
||||
|
||||
@@ -31,7 +31,6 @@ interface SessionsBench {
|
||||
reference(binding: SessionBinding): SessionReference
|
||||
setMainView(id: SessionId, count: number): void
|
||||
setRetainInfo(id: SessionId, count: number): void
|
||||
emitStatus(id: SessionId, running: boolean): void
|
||||
release(id: SessionId): Promise<void>
|
||||
}
|
||||
|
||||
@@ -41,15 +40,6 @@ const roots: Context[] = []
|
||||
|
||||
function createSessionsBench(ctx: Context): SessionsBench {
|
||||
roots.push(ctx)
|
||||
let statusListener: ((id: SessionId, running: boolean) => void) | undefined
|
||||
ctx.provide('remote', {
|
||||
$on: (_event: string, listener: (id: SessionId, running: boolean) => void) => {
|
||||
statusListener = listener
|
||||
return () => {
|
||||
if (statusListener === listener) statusListener = undefined
|
||||
}
|
||||
},
|
||||
} as never)
|
||||
const list = createSnapshotStore<SessionListState>({
|
||||
ids: [],
|
||||
byId: {},
|
||||
@@ -171,10 +161,6 @@ function createSessionsBench(ctx: Context): SessionsBench {
|
||||
retainedBy: count === 0 ? {} : { mainView: count },
|
||||
})
|
||||
},
|
||||
emitStatus(id, running) {
|
||||
if (statusListener === undefined) throw new Error('api-session/status is not subscribed')
|
||||
statusListener(id, running)
|
||||
},
|
||||
async release(id) {
|
||||
bindings.delete(id)
|
||||
const scopeCtx = scopes.get(id)
|
||||
@@ -521,90 +507,6 @@ describe('UiSession bindings', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('UiSession status', () => {
|
||||
it('keeps synthetic-row status unknown until an event or Host baseline establishes it', () => {
|
||||
const ctx = new Context()
|
||||
const bench = createSessionsBench(ctx)
|
||||
const id = sessionId('catalog-only')
|
||||
bench.list.update((draft) => {
|
||||
draft.byId[id] = { id, displayTitle: id, running: false, retainedBy: {}, blank: false, updatedAt: 0 }
|
||||
})
|
||||
const service = createUiSession(ctx, bench)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.running).toBeUndefined()
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
|
||||
bench.emitStatus(id, true)
|
||||
bench.list.update((draft) => { draft.byId[id]!.displayTitle = 'Renamed child' })
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.running).toBe(true)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
|
||||
bench.list.update((draft) => { draft.ids.push(id) })
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.running).toBe(false)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(true)
|
||||
})
|
||||
|
||||
it('records non-main completions and lets main-view activity acknowledge them', () => {
|
||||
const ctx = new Context()
|
||||
const bench = createSessionsBench(ctx)
|
||||
const id = sessionId('s1')
|
||||
bench.binding(id)
|
||||
const service = createUiSession(ctx, bench)
|
||||
const changed = vi.fn()
|
||||
const off = service.sessionStatus.subscribe(changed)
|
||||
|
||||
expect(service.sessionStatus.getSnapshot().get(id)).toEqual({
|
||||
running: false,
|
||||
pendingInteraction: undefined,
|
||||
completionUnread: false,
|
||||
})
|
||||
bench.list.update((draft) => { draft.byId[id]!.running = true })
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.running).toBe(true)
|
||||
bench.list.update((draft) => { draft.byId[id]!.running = false })
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(true)
|
||||
bench.setMainView(id, 1)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
bench.setMainView(id, 0)
|
||||
|
||||
bench.emitStatus(id, true)
|
||||
bench.emitStatus(id, false)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(true)
|
||||
|
||||
bench.setMainView(id, 1)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
bench.emitStatus(id, true)
|
||||
bench.emitStatus(id, false)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
|
||||
bench.setMainView(id, 0)
|
||||
bench.emitStatus(id, false)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
bench.emitStatus(id, true)
|
||||
bench.emitStatus(id, false)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(true)
|
||||
bench.emitStatus(id, true)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.completionUnread).toBe(false)
|
||||
expect(changed).toHaveBeenCalled()
|
||||
off()
|
||||
})
|
||||
|
||||
it('records an idle event before the initial catalog baseline and retires absent status later', () => {
|
||||
const ctx = new Context()
|
||||
const bench = createSessionsBench(ctx)
|
||||
const id = sessionId('early')
|
||||
bench.list.update((draft) => { draft.phase = 'pending' })
|
||||
const service = createUiSession(ctx, bench)
|
||||
|
||||
bench.emitStatus(id, false)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)).toEqual({
|
||||
running: false,
|
||||
pendingInteraction: undefined,
|
||||
completionUnread: true,
|
||||
})
|
||||
bench.list.update((draft) => { draft.phase = 'ready' })
|
||||
expect(service.sessionStatus.getSnapshot().has(id)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('UiSession pending interactions', () => {
|
||||
it('publishes the highest-precedence exact object and removes each source independently', async () => {
|
||||
const ctx = new Context()
|
||||
@@ -612,7 +514,7 @@ describe('UiSession pending interactions', () => {
|
||||
const service = createUiSession(ctx, bench)
|
||||
const id = sessionId('s1')
|
||||
const listener = vi.fn()
|
||||
const off = service.sessionStatus.subscribe(listener)
|
||||
const off = service.pendingInteractions.subscribe(listener)
|
||||
const registerApproval = service.registerPendingInteraction<SessionPendingInteractionBase>(
|
||||
() => 0,
|
||||
)
|
||||
@@ -631,26 +533,31 @@ describe('UiSession pending interactions', () => {
|
||||
const background = { key: 'background:1', kind: 'background', sessionId: id }
|
||||
const delegate = (): Promise<void> => Promise.resolve()
|
||||
const removeApproval = registerApproval(approval, delegate)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.pendingInteraction).toBe(approval)
|
||||
expect(service.pendingInteractions.getSnapshot().get(id)).toBe(approval)
|
||||
const removeDuplicate = registerApproval(duplicate, delegate)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.pendingInteraction).toBe(duplicate)
|
||||
expect(service.pendingInteractions.getSnapshot().get(id)).toBe(duplicate)
|
||||
const removeQuestion = registerQuestion(question, delegate)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.pendingInteraction).toBe(question)
|
||||
expect(service.pendingInteractions.getSnapshot().get(id)).toBe(question)
|
||||
const removePlan = registerQuestion(plan, delegate)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.pendingInteraction).toBe(plan)
|
||||
expect(service.pendingInteractions.getSnapshot().get(id)).toBe(plan)
|
||||
listener.mockClear()
|
||||
const effective = service.pendingInteractions.getSnapshot()
|
||||
const removeBackground = registerBackground(background, delegate)
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.pendingInteraction).toBe(plan)
|
||||
expect(service.pendingInteractions.getSnapshot()).toBe(effective)
|
||||
|
||||
removeBackground()
|
||||
removeQuestion()
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.pendingInteraction).toBe(plan)
|
||||
expect(service.pendingInteractions.getSnapshot()).toBe(effective)
|
||||
expect(listener).not.toHaveBeenCalled()
|
||||
removePlan()
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.pendingInteraction).toBe(duplicate)
|
||||
expect(service.pendingInteractions.getSnapshot().get(id)).toBe(duplicate)
|
||||
expect(listener).toHaveBeenCalledOnce()
|
||||
removeDuplicate()
|
||||
expect(service.sessionStatus.getSnapshot().get(id)?.pendingInteraction).toBe(approval)
|
||||
expect(service.pendingInteractions.getSnapshot().get(id)).toBe(approval)
|
||||
removeApproval()
|
||||
removeApproval()
|
||||
expect(service.sessionStatus.getSnapshot().has(id)).toBe(false)
|
||||
expect(service.pendingInteractions.getSnapshot().has(id)).toBe(false)
|
||||
expect(listener).toHaveBeenCalledTimes(3)
|
||||
off()
|
||||
await ctx.fiber.dispose()
|
||||
})
|
||||
@@ -670,15 +577,15 @@ describe('UiSession pending interactions', () => {
|
||||
|
||||
const failure = new Error('pending subscriber failed')
|
||||
const report = vi.spyOn(console, 'error').mockImplementation(() => {})
|
||||
service.sessionStatus.subscribe(() => { throw failure })
|
||||
service.pendingInteractions.subscribe(() => { throw failure })
|
||||
const after = vi.fn()
|
||||
service.sessionStatus.subscribe(after)
|
||||
service.pendingInteractions.subscribe(after)
|
||||
|
||||
remove()
|
||||
|
||||
expect(after).toHaveBeenCalledOnce()
|
||||
expect(report).toHaveBeenCalledWith(
|
||||
'[ui-session] Session status subscriber failed:',
|
||||
'[ui-session] pending interactions subscriber failed:',
|
||||
failure,
|
||||
)
|
||||
})
|
||||
@@ -698,7 +605,7 @@ describe('UiSession pending interactions', () => {
|
||||
let disposed = false
|
||||
const disposal = ctx.fiber.dispose().then(() => { disposed = true })
|
||||
await vi.waitFor(() => { expect(delegate).toHaveBeenCalledOnce() })
|
||||
expect(service.sessionStatus.getSnapshot()).toEqual(new Map())
|
||||
expect(service.pendingInteractions.getSnapshot()).toEqual(new Map())
|
||||
expect(disposed).toBe(false)
|
||||
remove()
|
||||
remove()
|
||||
@@ -745,7 +652,6 @@ describe('ui-session apply', () => {
|
||||
expect(slots.provideRoot).toHaveBeenCalledWith({
|
||||
hooks: {
|
||||
sessions: bench.sessions.list,
|
||||
sessionStatus: ctx.uiSession.sessionStatus,
|
||||
},
|
||||
keyedHooks: { sessionRetainInfo: retainInfoMatcher, sessionAccess: sessionAccessMatcher },
|
||||
})
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
{
|
||||
"path": "../../../vendor/cordis"
|
||||
},
|
||||
{
|
||||
"path": "../../api/remotes/tsconfig.client.json"
|
||||
},
|
||||
{
|
||||
"path": "../../api/remote-access/tsconfig.client.json"
|
||||
},
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-primitives",
|
||||
"@deepseek-ai/dsh-client-ui-sidebar-right",
|
||||
"@deepseek-ai/dsh-client-ui-input-trigger",
|
||||
"@deepseek-ai/dsh-client-ui-session-status",
|
||||
"@deepseek-ai/dsh-client-ui-workspace"
|
||||
],
|
||||
"platform": "web"
|
||||
@@ -70,6 +71,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-sidebar-right": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session-status": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-workspace": "workspace:*",
|
||||
"@deepseek-ai/dsh-agent-team": "workspace:*"
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ import type {} from '@deepseek-ai/dsh-client-locale/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-chat/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
|
||||
import { en, ja, es, fr, de, ru, pt, NS, zh, type SubagentKey } from './locales.ts'
|
||||
@@ -31,8 +32,11 @@ export type {
|
||||
SubagentReadOnlyComposerProps, SubagentReadOnlyMatch,
|
||||
} from './SubagentReadOnlyComposer.tsx'
|
||||
|
||||
/** Required services for subagent presentation and navigation. */
|
||||
export const inject = ['sessions', 'uiWorkspace', 'slots', 'locale', 'sidebarRight']
|
||||
/**
|
||||
* Required services for subagent presentation and navigation. `uiSession.sessionStatus` provides the
|
||||
* `useSessionStatus` hook the lineage header renders with, so the plugin unloads and reloads with it.
|
||||
*/
|
||||
export const inject = ['sessions', 'uiWorkspace', 'slots', 'locale', 'sidebarRight', 'uiSession.sessionStatus']
|
||||
|
||||
/** Claim the composer when the child mode does not allow follow-ups. */
|
||||
function selectReadOnlySubagent(owner: ComposerChainProps): SubagentReadOnlyMatch | null {
|
||||
|
||||
@@ -88,6 +88,7 @@ async function fullBench(sessions: SessionSummary[]) {
|
||||
},
|
||||
} as never)
|
||||
ctx.provide('remote', { $on: () => () => {} } as never)
|
||||
ctx.provide('uiSession.sessionStatus', createSnapshotStore(new Map()) as never)
|
||||
ctx.provide('configForms', { developerTools: { enabled: createSnapshotStore(true) }, get: () => stubConfigForm().scope } as never)
|
||||
await provideSlotFaces(ctx)
|
||||
await ctx.plugin({ inject: localeInject, apply: applyLocale }).await()
|
||||
@@ -107,7 +108,7 @@ const FAMILY: SessionSummary[] = [
|
||||
|
||||
describe('apply', () => {
|
||||
it('declares the services it binds', () => {
|
||||
expect(inject).toEqual(['sessions', 'uiWorkspace', 'slots', 'locale', 'sidebarRight'])
|
||||
expect(inject).toEqual(['sessions', 'uiWorkspace', 'slots', 'locale', 'sidebarRight', 'uiSession.sessionStatus'])
|
||||
})
|
||||
|
||||
it('keeps the root catalog extension available when optional Sidebar services arrive', async () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
import type { SubagentAddress, SubagentCatalogEntry } from '@deepseek-ai/dsh-subagent/client'
|
||||
import type { TeamProjection, TeamTaskId, TeamTaskView } from '@deepseek-ai/dsh-agent-team/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import {
|
||||
SubagentCatalogAction, SubagentHeaderLineage,
|
||||
type SubagentCatalogActionProps, type SubagentHeaderLineageProps,
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
{
|
||||
"path": "../../api/session-controller/tsconfig.client.json"
|
||||
},
|
||||
{
|
||||
"path": "../ui-session-status"
|
||||
},
|
||||
{
|
||||
"path": "../../../vendor/cordis"
|
||||
},
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
"@deepseek-ai/dsh-api-session-controller": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session-status": "workspace:*",
|
||||
"@deepseek-ai/dsh-llm": "workspace:*",
|
||||
"@deepseek-ai/dsh-attachment": "workspace:*",
|
||||
"@tanstack/react-virtual": "3.14.10",
|
||||
|
||||
@@ -33,7 +33,7 @@ import type {
|
||||
} from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import type { WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import {
|
||||
ConversationSession, ConversationSessionHeader,
|
||||
type ConversationSessionHeaderProps, type ConversationSessionProps,
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-conversation",
|
||||
"@deepseek-ai/dsh-client-ui-renderer",
|
||||
"@deepseek-ai/dsh-client-ui-session",
|
||||
"@deepseek-ai/dsh-client-ui-session-status",
|
||||
"@deepseek-ai/dsh-client-ui-workspace"
|
||||
],
|
||||
"platform": "web"
|
||||
@@ -68,6 +69,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session-status": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-workspace": "workspace:*",
|
||||
"@deepseek-ai/dsh-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-tool-workflow": "workspace:*",
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots
|
||||
import type { SessionListState, SessionTarget } from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import { shallowEqual } from '@deepseek-ai/dsh-client-store'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { WorkflowRunKey } from './locales.ts'
|
||||
import type {
|
||||
WorkflowRunMemberData, WorkflowRunPhaseData, WorkflowRunStatus,
|
||||
|
||||
@@ -7,6 +7,7 @@ import type {} from '@deepseek-ai/dsh-client-ui-chat/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
|
||||
import { WorkflowRunPanel, type WorkflowRunInjected } from './WorkflowRunPanel.tsx'
|
||||
import { en, ja, es, fr, de, ru, pt, NS, type WorkflowRunKey, zh } from './locales.ts'
|
||||
@@ -19,8 +20,11 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
||||
}
|
||||
}
|
||||
|
||||
/** Required services for Definition, keyed renderer, navigation, and copy. */
|
||||
export const inject = ['uiConversation', 'uiWorkspace', 'slots', 'sessions', 'locale']
|
||||
/**
|
||||
* Required services for Definition, keyed renderer, navigation, and copy. `uiSession.sessionStatus` provides the
|
||||
* `useSessionStatus` hook the run panel renders with, so the plugin unloads and reloads with it.
|
||||
*/
|
||||
export const inject = ['uiConversation', 'uiWorkspace', 'slots', 'sessions', 'locale', 'uiSession.sessionStatus']
|
||||
|
||||
/** Register the workflow Definition, dictionary, and keyed Chat renderer. */
|
||||
export function apply(ctx: ClientContext): void {
|
||||
|
||||
@@ -940,6 +940,7 @@ describe('plugin lifecycle', () => {
|
||||
ctx.provide('sessions', sessions)
|
||||
const openSession = vi.fn(async () => {})
|
||||
ctx.provide('uiWorkspace', { openSession } as never)
|
||||
ctx.provide('uiSession.sessionStatus', createSnapshotStore(new Map()) as never)
|
||||
const conversationEvents = new UiConversation(ctx, ctx.sessions).events
|
||||
ctx.slots.register({
|
||||
name: 'root',
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
{
|
||||
"path": "../../api/session-controller/tsconfig.client.json"
|
||||
},
|
||||
{
|
||||
"path": "../ui-session-status"
|
||||
},
|
||||
{
|
||||
"path": "../store"
|
||||
},
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-layout",
|
||||
"@deepseek-ai/dsh-client-ui-renderer",
|
||||
"@deepseek-ai/dsh-client-ui-session",
|
||||
"@deepseek-ai/dsh-client-ui-session-status",
|
||||
"@deepseek-ai/dsh-client-ui-sidebar",
|
||||
"@deepseek-ai/dsh-client-ui-context-menu"
|
||||
],
|
||||
@@ -71,6 +72,7 @@
|
||||
"@deepseek-ai/dsh-client-ui-primitives": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-renderer": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-session-status": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-sidebar": "workspace:*",
|
||||
"@deepseek-ai/dsh-client-ui-slots": "workspace:*",
|
||||
"@deepseek-ai/dsh-jobs": "workspace:*",
|
||||
|
||||
@@ -39,6 +39,8 @@ import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-layout/client'
|
||||
// Type-only: pulls the Session root standard-hook merge.
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
// Type-only: pulls the useSessionStatus root standard-hook merge.
|
||||
import type {} from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import {
|
||||
type ArchiveSessionInjected, type ForkSessionInjected, menuOpenStateFactory, type PinSessionInjected,
|
||||
type SessionArchiveConfirmInjected, type SessionArchiveConfirmRequest,
|
||||
@@ -130,9 +132,12 @@ const NS = 'workspace'
|
||||
* (loading/prefetch metadata, never apply sequencing) and neither owner
|
||||
* provides a waitable service. apply therefore depends on each slot
|
||||
* declaration through `slots.inject()` instead of assuming order.
|
||||
* `uiSession.sessionStatus` provides the `useSessionStatus` hook the browser rows render with, so the plugin unloads
|
||||
* and reloads with it.
|
||||
*/
|
||||
export const inject = ['contextMenus',
|
||||
'slots', 'sessions', 'workspaces', 'locale', 'remote', 'remote.directoryPicker', 'layout', 'shortcuts', 'remoteAccess',
|
||||
'uiSession.sessionStatus',
|
||||
]
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import type { WorkspaceId, WorkspaceView } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
||||
import type {
|
||||
SessionStatusSnapshot,
|
||||
} from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
} from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import { assertNever } from '@deepseek-ai/dsh-util-values'
|
||||
import { workspaceTitleOf } from '@deepseek-ai/dsh-util-workspace-path'
|
||||
|
||||
@@ -70,6 +70,7 @@ async function bench(access: 'fake' | 'static' = 'fake') {
|
||||
onTestFinished(() => { menuRegistry.dispose() })
|
||||
ctx.provide('contextMenus', { register: menuRegistry.register.bind(menuRegistry), resolve: menuRegistry.resolve.bind(menuRegistry), active: createSnapshotStore(null), open: vi.fn(), close: vi.fn() } as never)
|
||||
ctx.provide('uiConversation', {})
|
||||
ctx.provide('uiSession.sessionStatus', createSnapshotStore(new Map()) as never)
|
||||
await ctx.plugin(SlotRegistry).await()
|
||||
const accessSource = vi.fn((_kind: string, _id: string, _action: string): HostObservable<boolean> => ALLOWED)
|
||||
const stopGuard = vi.fn()
|
||||
@@ -242,6 +243,7 @@ describe('ui-workspace apply', () => {
|
||||
it('declares the services it drives', () => {
|
||||
expect(inject).toEqual(['contextMenus',
|
||||
'slots', 'sessions', 'workspaces', 'locale', 'remote', 'remote.directoryPicker', 'layout', 'shortcuts', 'remoteAccess',
|
||||
'uiSession.sessionStatus',
|
||||
])
|
||||
})
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { afterEach, describe, expect, it, onTestFinished, vi } from 'vitest'
|
||||
import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import type { SessionListState, SessionSummary } from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import type { WorkspaceId, WorkspaceSnapshot } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
||||
import type { GlobalStandardProps, PropsLocale, PropsRenderSlots, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
||||
|
||||
@@ -3,9 +3,8 @@ import type {
|
||||
SessionListState, SessionProjectionMap, SessionSummary,
|
||||
} from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
import type { WorkspaceId, WorkspaceView } from '@deepseek-ai/dsh-api-workspace-controller/client'
|
||||
import type {
|
||||
SessionPendingInteraction, SessionStatus, SessionStatusSnapshot,
|
||||
} from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatus, SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { SessionPendingInteraction } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { JsonValue } from '@deepseek-ai/dsh-util-values'
|
||||
import type { SessionProjectionSnapshot } from '@deepseek-ai/dsh-api-session-controller/client'
|
||||
|
||||
@@ -10,9 +10,8 @@ import type { SessionListState, SessionSummary } from '@deepseek-ai/dsh-api-sess
|
||||
import type {
|
||||
WorkspaceId, WorkspaceSnapshot, WorkspaceView,
|
||||
} from '@deepseek-ai/dsh-api-workspace-controller/client'
|
||||
import type {
|
||||
SessionPendingInteraction, SessionStatus, SessionStatusSnapshot,
|
||||
} from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatus, SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { SessionPendingInteraction } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
||||
import type { MainPanelId } from '@deepseek-ai/dsh-client-ui-layout/client'
|
||||
import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts'
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
import type {} from '@deepseek-ai/dsh-client-locale/client'
|
||||
import { allowAllAccess, bindSnapshotSelector, makeTranslate } from '@deepseek-ai/dsh-client-test-runtime'
|
||||
import { zh as commonZh } from '@deepseek-ai/dsh-client-locale/src/locales/zh.ts'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session/client'
|
||||
import type { SessionStatusSnapshot } from '@deepseek-ai/dsh-client-ui-session-status/client'
|
||||
import type { DirectoryFlowOwnerProps, WorkspacePickerProps } from '../src/client/contract/slots.ts'
|
||||
import { WorkspacePicker } from '../src/client/WorkspacePicker.tsx'
|
||||
import { zh } from '../src/client/locales.ts'
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
{
|
||||
"path": "../../api/session-controller/tsconfig.client.json"
|
||||
},
|
||||
{
|
||||
"path": "../ui-session-status"
|
||||
},
|
||||
{
|
||||
"path": "../../preset/agent-preset-registry"
|
||||
},
|
||||
|
||||
Loaded 100 of 175 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user