Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ jobs:
name: tests (${{ matrix.python-version }}, ${{ matrix.suite }})
needs: [quality]
if: ${{ !cancelled() && needs.quality.result == 'success' && (fromJSON(needs.quality.outputs.suites || '{}').tests) }}
# Allow end-to-end suites' subprocess tails to finish on internal runners.
timeout-minutes: ${{ matrix.suite == 'e2e' && 55 || 40 }}
# Unit jobs must outlast pytest plus uv cache publication. End-to-end jobs
# also need time for subprocess tails on internal runners.
timeout-minutes: ${{ matrix.suite == 'e2e' && 55 || 50 }}
runs-on: ${{ (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && 'powercontext-ci-standard' || 'ubuntu-24.04' }}
strategy:
fail-fast: true
Expand Down
89 changes: 81 additions & 8 deletions docs/en/docs/integrations/dsh.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@ endpoint is `http://127.0.0.1:8000`, and saved `powercontext setup dsh` connecti
After installation, restart DSH if requested and run `/pc doctor` in a session. Check both Server readiness and
native MCP discovery before validating capture and recall.

The same package also exposes an independent browser entry, `./client`. After restart, DSH Web and Desktop show a
PowerContext status control above the account area. If the control is absent, the host did not load the browser
entry; existing tools and lifecycle behavior remain available, so this is not a Server failure. The control is not
a Dashboard replacement: clicking it opens connection diagnostics only. Dashboard embedding remains future work.

The npm version follows the PowerContext Release: `1.6.0rc1` maps to `1.6.0-rc.1`, with equivalent `alpha` and
`beta` suffixes. Stable releases use `latest`; prereleases use `next`. Verify the selected npm version exists
before installation. Local `.tgz` installation verifies the archive path, not npm or mirror availability.

## Install matching Server and plugin versions

Install DeepSeek Harness Web or Desktop. The automated real-host suite pins DSH `0.1.2-rc.1`;
manual macOS Desktop acceptance also covers `0.2.1-rc.5`, including native MCP writes and fresh-session recall.
Choose one PowerContext installation path and keep the Server and plugin together.
Install DeepSeek Harness Web or Desktop. The latest official release checked for this implementation is
`0.2.2-rc.1` (a prerelease published on 2026-11-04); the P1/P2 Web and Desktop bundled-runtime acceptance was run
against that exact package. The deterministic SDK runtime contract tests remain pinned to their older fixture.
Do not infer support for another DSH release from this result. Choose one PowerContext installation path and keep
the Server and plugin together.

For this guided-setup build:

Expand Down Expand Up @@ -110,11 +117,15 @@ Recall queries exclude current DSH `runtime-context` messages (including cleared
`@deepseek-ai/dsh-system-prompt` plugin snapshots, so host catalogs cannot displace the user request.

With `powercontext setup dsh --json`, `hosts.dsh.setup: "complete"` records completed installation/configuration.
Registration is reported separately at `hosts.dsh.checks.plugin.checks.registration: "present"`. The same report
includes Server diagnostics, so its top-level `ok` can be `false` and its exit code 1 even after installation
completed. Inspect the failed entries under `hosts.dsh.checks`, start or correct the selected Server, and rerun
`powercontext doctor dsh --json`. This command includes separate Server probes; registration itself does not prove
running-session connectivity. Restart DSH and use `/pc doctor` to verify the active session.
Registration is reported separately at `hosts.dsh.checks.plugin.checks.registration: "present"`. The plugin check
also reports package capability independently: `browser_client`, `client_declaration`, and `asset_export` are
`present` or `missing`, and `host_bundle` reports the Host half. A missing browser client is a headless
installation: existing tools continue to work, but the sidebar status is unavailable. Setup reports this rather
than treating it as a Server error. The same report includes Server diagnostics, so its top-level `ok` can be
`false` and its exit code 1 even after installation completed. Inspect the failed entries under
`hosts.dsh.checks`, start or correct the selected Server, and rerun `powercontext doctor dsh --json`. This command
includes separate Server probes; registration itself does not prove running-session connectivity. Restart DSH and
use `/pc doctor` to verify the active session.

## Start the Server and the host

Expand Down Expand Up @@ -146,6 +157,68 @@ the Server default/workspace binding, or set it to an existing Scope intentional
Environment overrides take precedence over plugin patch values, which take precedence over defaults. They must be
present in the process launching DSH; changing another terminal's environment does not update a running host.

## Sidebar status and diagnostics

The sidebar control appears above the account area. Its color and accessible label are always paired:

| State | Meaning |
| --- | --- |
| Gray | Not configured, disabled, or not a verified owner-local host |
| Yellow | Connecting, retrying, or an expired observation being re-verified |
| Green | Liveness, readiness, and the required PreparedContext capability were verified |
| Red | Connection, DSH authentication, or a required capability failed |

Clicking the control opens a read-only diagnostics panel in Simplified Chinese by default. The language icon
switches to English; an explicit choice persists in the current browser's local storage, with Chinese as the
fallback. The compact view shows connection state, Server address, workspace and Scope. Expand **Technical details**
for the conversation ID, deployment mode, authentication source (never the credential), readiness dependencies,
context schema and automatic-path observations.
The footer reads `package_version` from `GET /v1/server-info` through the Host and shows the current Server package
version. Unsupported metadata endpoints, failed reads or expired connection observations show **Unknown**, never
the plugin version or API contract version. The bounded metadata read does not determine readiness.
The panel reuses the same in-memory `RuntimeStatus` as `/pc`, rather than reconstructing history from logs.
It never calls a model, sends a diagnostic prompt, or polls `/pc doctor`.

The bridge is the plugin-owned authenticated route `GET /powercontext/status`. DSH's existing `requestRejection`
runs first and is never weakened. The route must also reach a verified local owner surface:

- DSH Desktop is detected from the managed `desktop` profile context provided by the Desktop Host. An Electron
executable running a Web profile is not treated as Desktop authority.
- DSH Web is accepted only for a loopback request when the owner explicitly sets `ownerLocal: true` (or
`POWERCONTEXT_DSH_OWNER_LOCAL=true`). Set this only on your own local Web host.
- A non-loopback request, an SSH-launched host, or an unconfigured Web host is rejected. The UI reports
non-loopback requests as an actionable failure, and SSH-launched or unconfigured Web hosts as gray unconfigured;
none is silently labeled local.

For an explicitly local Web host, add this to the profile or home `cordis.patch.yml`:

```yaml
- id: powercontext-dsh
config:
ownerLocal: true
```

Or set the environment variable before starting `dsh web`:

```bash
POWERCONTEXT_DSH_OWNER_LOCAL=true dsh web
```

Do not set this for a remote, shared, container, or SSH-forwarded host. The bridge does not add launch, install,
target, or Dashboard routes.

While the page is visible, the client refreshes every ten seconds. It pauses while hidden, re-verifies immediately
on return, backs off from two to thirty seconds after a failure, and marks a success older than thirty seconds as
stale instead of leaving it green. A 401/403 from DSH, an offline Server, a failed readiness dependency, or a
missing context schema produces a distinct diagnostic. The panel shows only allowlisted status fields; it never
prints the launch token, Authorization value, or a bearer header. A conversation switch changes the observed
session and invalidates responses from the previous selection. With no conversation, the panel says so and does
not create one.

Updating the plugin is an install-and-restart operation; the existing profile and connection settings are
preserved. Uninstalling it removes the browser entry, the `/powercontext/status` route, subscriptions, and
timers. A headless host or a package without the browser entry keeps the tools and lifecycle hooks.

## Diagnose the running configuration

Run `/pc doctor` inside the affected DSH session. Its report identifies configuration provenance and checks
Expand Down
4 changes: 3 additions & 1 deletion docs/en/rfcs/2528-dsh-plugin-ui-and-agent-handoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ description: A plugin-owned design for DSH connection status, existing dashboard

- Proposal Name: `dsh_plugin_ui_and_agent_handoff`
- Start Date: 2026-11-06
- Status: Draft
- Status: Partially implemented — PR 1-2 only; Dashboard embedding and handoff remain future work
- RFC PR: [oceanbase/powercontext#2528](https://github.com/oceanbase/powercontext/pull/2528)
- Tracking Issue: [oceanbase/powercontext#2514](https://github.com/oceanbase/powercontext/issues/2514)
- Related RFCs: [RFC 0048](0048_handoff_artifact.md), [RFC 1223](1223_human_agent_work_continuity.md), [RFC 1345](1345_scope_organization_and_agent_integration.md), [RFC 1783](1783-handoff-session-rollover.md), and [RFC 1629](1629_dashboard_profile_and_handoff_markdown_export.md)

# Summary

Implementation status: the browser entry, authenticated status bridge, setup capability reporting, and sidebar diagnostics in PR 1-2 are implemented. Dashboard embedding (PR 3), the Handoff workflow (PR 4-7), target launch/adapters, and pet integration are not included.

Extend the PowerContext DSH plugin with a connection-status entry, the existing dashboard embedded in DSH, and a latest-response action that hands work to another agent. Installation continues through `powercontext setup`. The plugin uses existing DSH Client extension points and a plugin-owned Host HTTP bridge. On a qualified local deployment, its Node Host code opens a destination through an allowlisted system opener and the destination's supported deep link.

The transfer uses PowerContext’s existing Handoff operations to prepare and preserve a complete Handoff, opens a new session in the intended directory, and prefills a short continuation prompt. The user sends that prompt. The destination verifies live conditions and acknowledges the exact Handoff. Opening an application is not delivery confirmation. Initial delivery includes three required destinations: Codex Desktop, Claude Desktop Code sessions, and Claude Code CLI. Only the owner’s local DSH deployment is supported.
Expand Down
60 changes: 60 additions & 0 deletions docs/zh/docs/integrations/dsh.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ status: community

上面的动图使用 Desktop 界面演示,Web 版的入口名称相同。npm 安装只负责安装插件,不会启动或配置 PowerContext Server。

同一个包还导出独立的浏览器入口 `./client`。重启后,DSH Web 和 Desktop 会在账号区域上方显示 PowerContext
状态控件。没有显示时说明宿主没有加载浏览器入口;已有工具和生命周期行为仍可用,因此这不是 Server 故障。
这个控件不是 Dashboard 替代品:点击只打开连接诊断,Dashboard 内嵌属于后续工作。

npm 版本跟随 PowerContext Release:`1.6.0rc1` 对应 `1.6.0-rc.1`,alpha、beta 同样转换。
正式版本使用 `latest` 标签,预发布版本使用 `next`;安装前先确认目标 npm 版本已经发布。
本次实现验收使用的官方最新版本是 `0.2.2-rc.1`(2026-11-04 发布的预发布版);只在对应真实 Web 和
Desktop 自带 runtime 上验证过,不能据此推断其他 DSH 版本兼容。

## 启动 PowerContext Server

Expand Down Expand Up @@ -112,10 +118,64 @@ Desktop 必须使用桌面版自带的 dsh 命令,npm/pnpm 版 dsh 无权管
Web 和 Desktop 共用已保存的 `hosts.dsh` 连接设置及 `$DSH_HOME/powercontext/credentials.json`。
`DSH_HOME` 默认是 `~/.dsh`。使用 `powercontext setup dsh --json` 时,可从 `hosts.dsh.result.plugin_path`
取得插件路径并记录插件 commit;`hosts.dsh.setup: "complete"` 只表示注册完成,不代表运行中的 Server 已就绪。
插件检查还会分别报告 `browser_client`、`client_declaration`、`asset_export` 和 `host_bundle`。缺少浏览器入口时
属于无界面安装:工具继续可用,侧栏状态不可用,不会因此误报 Server 故障。

已有界面和模型 patch 可以保留。setup 会检查合成后的 PowerContext 连接设置;冲突处理和动态配置限制见
[远程连接配置](../operate/connect-remote-server.md)。原生 include 文件必须存在,循环引用、不支持的文件类型或无法验证的动态结构会在保存前报错。

## 侧栏状态与诊断

侧栏控件位于账号区域上方,颜色始终配有无障碍标签:

| 状态 | 含义 |
| --- | --- |
| 灰色 | 未配置、已禁用,或不是已验证的本机所有者宿主 |
| 黄色 | 正在连接、重试,或过期观测正在重新核对 |
| 绿色 | 已通过 liveness、readiness 和所需 PreparedContext 能力 |
| 红色 | 连接、DSH 认证或必要能力失败 |

点击后打开只读诊断面板,默认使用简体中文。右上角语言图标可切换 English;明确选择会保存在当前浏览器的
本地存储中,无法读取偏好时回退到中文。默认视图保留连接状态、Server 地址、工作目录和 Scope;会话 ID、
部署方式、认证配置来源(不显示认证值)、就绪依赖、context schema 和自动处理观测放在可展开的“技术详情”中。
页脚通过 Host 读取 `GET /v1/server-info` 的 `package_version`,显示当前 Server 包版本。旧 Server 不支持该接口、
读取失败或连接观测过期时显示“未知”,不会替换为插件版本或 API 合约版本。版本读取有界且不影响就绪判断。
面板复用 `/pc` 使用的内存 `RuntimeStatus`,不从日志重建历史,也不调用模型、发送诊断 prompt 或轮询 `/pc doctor`。

桥接接口是插件自有、经 DSH 认证的 `GET /powercontext/status`。DSH 原有 `requestRejection` 始终先执行,不会被削弱;
此外还必须到达已验证的本机所有者界面:

- DSH Desktop 通过 Desktop Host 提供的受管 `desktop` profile 上下文识别;用同一个 Electron 可执行程序运行
Web profile 不会被当作 Desktop 权限。
- DSH Web 只有在 loopback 请求且所有者明确设置 `ownerLocal: true`(或 `POWERCONTEXT_DSH_OWNER_LOCAL=true`)时接受。
只应在自己的本机 Web 宿主上设置。
- 非 loopback、SSH 启动或未配置的 Web 宿主会被拒绝。非 loopback 显示为可处理失败;SSH 启动或未配置 Web
显示为灰色未配置;都不会被静默标为 local。

本机 Web 可在 profile 或 home 的 `cordis.patch.yml` 中加入:

```yaml
- id: powercontext-dsh
config:
ownerLocal: true
```

或在启动 `dsh web` 前设置:

```bash
POWERCONTEXT_DSH_OWNER_LOCAL=true dsh web
```

不要在远程、共享、容器或 SSH 转发的宿主上设置。桥接不增加 launch、install、target 或 Dashboard 路由。

页面可见时每十秒刷新;隐藏时暂停,恢复可见后立即重新核对;失败后从 2 秒退避到 30 秒;成功观测超过 30 秒
会标为过期而不是继续显示绿色。DSH 的 401/403、Server 离线、readiness 依赖失败或缺少 context schema 分别显示
不同诊断。面板只展示允许字段,不打印启动 token、Authorization 值或 Bearer header。切换会话会更新观测会话并
丢弃上一会话的迟到响应;没有会话时如实显示,不创建会话。

更新插件是重新安装并重启,保留已有 profile 和连接设置。卸载会移除浏览器入口、`/powercontext/status` 路由、
订阅和定时器;无界面宿主或没有浏览器入口的包继续保留工具和生命周期 hook。

## 诊断运行中的配置

在出现问题的 DSH 会话内运行 `/pc doctor`。报告显示配置来源,分别检查 liveness、readiness、运行能力、
Expand Down
4 changes: 3 additions & 1 deletion docs/zh/rfcs/2528-dsh-plugin-ui-and-agent-handoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ description: 通过插件实现 DSH 连接状态、现有 Dashboard 内嵌及向

- Proposal Name: `dsh_plugin_ui_and_agent_handoff`
- Start Date: 2026-11-06
- Status: Draft
- Status: 部分实现 — 仅 PR 1-2;Dashboard 内嵌与交接仍属后续工作
- RFC PR: [oceanbase/powercontext#2528](https://github.com/oceanbase/powercontext/pull/2528)
- Tracking Issue: [oceanbase/powercontext#2514](https://github.com/oceanbase/powercontext/issues/2514)
- Related RFCs: [RFC 0048](0048_handoff_artifact.md)、[RFC 1223](1223_human_agent_work_continuity.md)、[RFC 1345](1345_scope_organization_and_agent_integration.md)、[RFC 1783](1783-handoff-session-rollover.md) 和 [RFC 1629](1629_dashboard_profile_and_handoff_markdown_export.md)

# Summary

实现状态:PR 1-2 的浏览器入口、带认证的状态桥、setup 能力报告和侧栏诊断已实现。Dashboard 内嵌(PR 3)、Handoff 流程(PR 4-7)、目标启动/适配器及 pet 集成不在本次范围内。

扩展 PowerContext DSH 插件,提供连接状态入口、现有 Dashboard 的内嵌展示,以及从最新回复交给其他 Agent 继续工作的动作。用户仍通过 `powercontext setup` 安装。插件使用现有 DSH Client 扩展位置和自身的 Host HTTP 接口;在通过验证的本机部署中,由 Node Host 代码通过受限系统启动器和目标应用支持的链接打开目标。

交接流程调用 PowerContext 已有的 Handoff 操作准备并保存完整载体,在指定目录打开新会话,预填简短接续提示,由用户发送。目标核对实时条件并确认收到这份精确 Handoff。打开应用不等于交付已确认。首期必须完成三个目标:Codex Desktop、Claude Desktop 的 Code 会话、Claude Code CLI。仅支持本人使用的本机 DSH 部署。
Expand Down
10 changes: 9 additions & 1 deletion integrations/dsh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ powercontext setup dsh --source oceanbase/powercontext --ref master
powercontext server run
```

A local checkout works the same way. The plugin directory must contain a built `lib/index.js`:
A local checkout works the same way. The plugin directory must contain a built `lib/index.js`; the optional
sidebar client is packaged as `lib/client.js` with `dsh.client` and `./assets/*`:

```bash
powercontext setup dsh --source .
Expand All @@ -29,6 +30,13 @@ running; optional MCP initialization waits at most five seconds before continuin

Automatic recall calls `POST /v1/context/prepare` once per turn. Explicit Memory writes use `remember_memory` and do not need a model. Prompt capture can be disabled with `POWERCONTEXT_DSH_CAPTURE_PROMPTS=false`.

The browser entry adds a sidebar status control and diagnostics panel. For an explicitly owner-local Web host, set
`ownerLocal: true` in the plugin patch or `POWERCONTEXT_DSH_OWNER_LOCAL=true`; DSH Desktop is identified by the
managed `desktop` profile context, not merely by running under Electron. The bridge rejects remote, SSH-forwarded,
shared, and unconfigured Web hosts. It performs
read-only liveness/readiness/capability and Scope reads, never a model call or `/pc doctor` poll. Headless hosts
without DSH client services continue to load only `lib/index.js`.

For a Server using optional local bearer authentication, set `POWERCONTEXT_DSH_AUTHORIZATION` to the complete `Bearer ` header before starting `dsh web`.

Run the model-free call-through checks from a repository checkout:
Expand Down
Loading
Loading