Skip to content

feat(runtime-host): add trusted capability provider service - #2625

Merged
M4n5ter merged 1 commit into
mainfrom
feat/2522-capability-provider
Aug 10, 2026
Merged

M4n5ter merged 1 commit into
mainfrom
feat/2522-capability-provider

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Aug 10, 2026

Copy link
Copy Markdown
Member
English

Summary

This adds the trusted capability-provider vertical slice for standalone Runtime Host deployments:

  • add maka runtime-host capability-provider serve to publish MCP-backed tools over an authenticated Runtime Host connection, with bounded reconnect and publication recovery;
  • issue a narrowly scoped capability-provider credential that can publish and serve capabilities without unrelated remote-owner or Host-path authority;
  • keep remote capability manifests path-free by default and explicitly declare whether an offer may receive the Host session cwd;
  • let Automations durably require one exact provider identity, report provider-unavailable waiting state, and resume without consuming the transient deferral window while the provider is offline;
  • bound and validate projected manifests before publication, pack tools within protocol offer limits, and prevent the Runtime Host credential from reaching MCP child-process environments.

Refs #2522

Verification

  • npm run format:check
  • npm run lint
  • npm run typecheck
  • npm run build
  • npm run test:dist in packages/runtime-host
  • npm run test:dist in packages/runtime
  • npm run test:dist in packages/storage
  • npm run test:dist in packages/cli
  • npm run test:dist in packages/mcp

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No
简体中文

概要

本 PR 为独立部署的 Runtime Host 增加可信 capability provider 的纵向能力闭环:

  • 增加 maka runtime-host capability-provider serve,通过经过认证的 Runtime Host 连接发布并提供 MCP 工具,同时支持有界重连与 publication 恢复;
  • 签发最小权限的 capability-provider credential,使 provider 可以发布和提供能力,但不获得无关的 remote-owner 权限或 Host 路径权限;
  • 远程 capability manifest 默认不包含路径,并由 offer 显式声明是否可以接收 Host Session cwd;
  • Automation 可以持久要求一个精确 provider 身份,在 provider 不可用时进入明确的等待状态,并在 provider 离线期间不消耗 transient deferral 时间窗口;
  • publication 前对 manifest 做有界校验,将工具打包在 protocol offer 上限内,并防止 Runtime Host credential 进入 MCP 子进程环境。

Refs #2522

验证

  • npm run format:check
  • npm run lint
  • npm run typecheck
  • npm run build
  • 在 packages/runtime-host 中运行 npm run test:dist
  • 在 packages/runtime 中运行 npm run test:dist
  • 在 packages/storage 中运行 npm run test:dist
  • 在 packages/cli 中运行 npm run test:dist
  • 在 packages/mcp 中运行 npm run test:dist

检查清单

  • 测试覆盖本次变更,并会在缺少实现时失败
  • lint、format、typecheck 与受影响测试套件均已在本地通过

本 PR 是否改变行为?

  • 是——已在上方“概要”中说明
  • 否

@M4n5ter
M4n5ter marked this pull request as ready for review August 10, 2026 04:09
@M4n5ter
M4n5ter merged commit 8b48a1f into main Aug 10, 2026
18 of 20 checks passed
@M4n5ter
M4n5ter deleted the feat/2522-capability-provider branch August 10, 2026 04:09
Joob1n added a commit to Joob1n/maka-agent that referenced this pull request Aug 14, 2026
Addresses the second review on apache#2965.

**The retired connection's detail page still invited a sign-in.**
`oauthLoginServiceFor` had no case for it, so the page fell through to the
generic notice: "若请求提示需要重新登录,请到账号连接重新授权" — an
instruction whose only destination is the retirement notice. The credential
outlives retirement, so `hasSecret` is true and this rendered for exactly the
users this PR is for. `deriveProviderAuthContract` reached the same place by
another route, reading the provider as `oauth_preview` — a login that was
taken away is not a preview of one that is coming.

Both now read a `retired` marker on the registry entry rather than inferring
retirement from an unavailable adapter, which an unwired preview provider is
indistinguishable from. `ProviderAuthState` gains `retired` and
`ProviderAuthSetupMode` gains `oauth_retired`; both are exhaustively switched,
so the compiler found every surface that had to answer for the new state.

**Tests.** The prior commits deleted 17 cases and added none, leaving every
line that enforces the retirement separately revertible with the suite green.
Added: a registry contract pinning `runtimeAdapter.kind === 'unavailable'`,
`isWiredOAuthProvider === false`, and the auth contract for every retired
provider; a storage case asserting a retired connection cannot begin an
interactive login; the coordinator's account-usage constant; and the
"commit excludes overlapping backend activations" invariant, re-landed on a
Codex fixture — what it asserts is provider-agnostic and it left with its
Claude fixture. Each was mutation-checked against the revert it is meant to
catch.

**Epoch.** Narrowing `OAUTH_LOGIN_PROVIDERS` is a decode change in the
new-Client-against-old-Host direction, which this repo bumps for (apache#2633,
apache#2625). Bumped to 20.

Also: dropped the `as OAuthLoginProvider` cast so the compiler keeps storage's
union and the protocol's in step; the catalog read now runs alongside the
snapshot fetches instead of ahead of them, and a failed read keeps the
previous answer rather than retracting the notice; `README.zh-CN.md` matches
`README.md`; `SECURITY.md` §4 no longer claims contract tests that do not
exist; and the remaining dead symbols and stale comments are gone.

Claude-Session: https://claude.ai/code/session_014ajaRxC4jydavY9nYUFj5J
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant