codeg icon indicating copy to clipboard operation
codeg copied to clipboard

Track the Codeg host plugin system

Open kogekiplay opened this issue 1 week ago • 2 comments

Goal

Build a host plugin platform for Codeg with the breadth of extension interfaces in Paseo and DeepSeek Harness. Plugins are installed on the workspace host and declare contributions in a versioned manifest. The first stages cover installation, catalogs and declarative workspace contributions; the remaining stages open the client and host APIs to plugin authors.

Current status: All 45 implementation stages (#1219–#1282) are implemented, rebased onto main (d137140b7, 0 conflicts), unit/integration tested, and Ready for Review (zero remaining draft PRs). The upstream capability audit is linked below. Checkboxes remain open until the PR stack is merged sequentially onto main and end-to-end verified across desktop, standalone Web, phone-width Web, and remote desktop.

Review and merge order

  • [ ] #1219 adds the host manifest, catalog, persistence, lifecycle, and desktop/server APIs.
  • [ ] #1220 adds plugin settings and the shared client transport. Depends on #1219. Stage diff
  • [ ] #1221 adds the workspace extension points and the Turn Activity walkthrough. Depends on #1220. Stage diff
  • [ ] #1222 adds installation from npm, GitHub, and host directories. Depends on #1221. Stage diff
  • [ ] #1225 adds updates from the saved plugin source, compatibility for older source records, concurrency protection, and update feedback. Depends on #1222. Stage diff
  • [ ] #1227 adds the host-permission trust warning before source installation. Depends on #1225. Stage diff
  • [ ] #1229 adds bounded HTTPS plugin indexes, version browsing, source disclosure, indexed installation, and browser-profile index source persistence. Depends on #1227. Stage diff
  • [ ] #1239 adds an installation review of the resolved manifest and source, checks indexed identity and version, and confirms the reviewed snapshot. Depends on #1229. Stage diff
  • [ ] #1240 adds the reviewed host JavaScript module, method calls and a dynamic workspace panel. Depends on #1239. Stage diff
  • [ ] #1241 adds custom client UI in workspace and plugin settings panels and a scoped client-to-host bridge. Depends on #1240. Stage diff
  • [ ] #1242 adds host-persisted plugin settings, JSON Schema validation, and migrations on enablement. Depends on #1241. Stage diff
  • [ ] #1244 adds workspace open and close hooks, a path transformation and client event subscriptions. Depends on #1242. Stage diff
  • [ ] #1245 adds live ACP session, turn and permission observers for plugins. Depends on #1244. Stage diff
  • [ ] #1247 adds plugin surfaces to the session header and composer with conversation-scoped events. Depends on #1245. Stage diff
  • [ ] #1248 adds optional JSON Schema contracts for plugin RPC input and output. Depends on #1247. Stage diff
  • [ ] #1249 adds worktree creation and archive observers for workspace actions, automation runs, work tasks, and CLI worktree runs. Depends on #1248. Stage diff
  • [ ] #1250 adds scoped composer draft insertion for conversations and canvas cards. Depends on #1249. Stage diff
  • [ ] #1252 adds an awaited workspace creation transformation and after hooks for registration and archive. Depends on #1249. Stage diff
  • [ ] #1253 adds plugin detail and activation surfaces, browser bridge types, and the expanded Workspace Inspector example. Depends on #1250 and #1252. Rust and docs, bridge types, client surfaces, example.
  • [ ] #1254 localizes plugin names, contribution titles and static workspace panel text. Depends on #1253. Stage diff.
  • [ ] #1255 adds an awaited worktree destination transformation for workspace creation, automation runs, work tasks, and CLI runs. Depends on #1252. Stage diff.
  • [ ] #1256 publishes first-registration events for closed workspaces and worktrees created by background CLI and delegated runs. Depends on #1255. Stage diff.
  • [ ] #1257 publishes agent close and archive events and adds server lifecycle declarations for plugin authors. Depends on #1256. Stage diff.
  • [ ] #1259 adds declarative light and dark plugin palettes, per-host selection in Appearance, and the Juniper example. Depends on #1254. Stage diff.
  • [ ] #1260 adds an awaited ACP launch hook for bounded, namespaced environment contributions. Depends on #1257. Stage diff.
  • [ ] #1261 adds a validated initial agent-title transformation and a creation observer for durable conversation rows. Depends on #1260. Stage diff.
  • [ ] #1262 adds full-page plugin screens and sidebar header and footer entries with host-scoped withdrawal. Depends on #1259. Stage diff.
  • [ ] #1263 adds scoped tool completion observers and bounded text previews for live ACP tool calls. Depends on #1261. Stage diff.
  • [ ] #1265 adds batched workspace row badges backed by declared plugin methods, with a runnable worktree example. Depends on #1262. Stage diff.
  • [ ] #1266 adds schema-validated model tools for ACP sessions through Codeg MCP, with launch-scoped offers and a runnable greeting example. Depends on #1263. Stage diff.
  • [ ] #1267 adds workspace- and session-scoped plugin slash commands in the composer, with localized completion and stale-response guards. Depends on #1262. Stage diff.
  • [ ] #1269 adds opt-in custom sidebar views, per-host selection and a Focus Notes example verified in desktop and phone-width Chromium. Depends on #1262. Stage diff.
  • [ ] #1270 adds opt-in read-only file views in the workspace editor and the JSON Outline example. Depends on #1269. Stage diff.
  • [ ] #1271 adds opt-in writable file editors (writable: true), window.codeg.file.writeText(text) through Codeg's editor buffer and save flow, and the JSON Editor example. Depends on #1270. Stage diff.
  • [ ] #1272 adds workspace header actions (openWorkspacePanel, openScreen, callMethod) with desktop inline/overflow layout, narrow-screen menu collapse, and the Workspace Header Actions example. Depends on #1262. Stage diff.
  • [ ] #1273 adds global, workspace, and session scoped plugin commands with keyword search in the command palette and quick actions, plus the Command Palette example. Depends on #1262. Stage diff.
  • [ ] #1274 adds composer attachment sources with debounced search pickers, bounded text snapshot pills, session isolation, and the Issue Attachments example. Depends on #1262. Stage diff.
  • [ ] #1275 adds awaited session.prompt.before transformations and fail-closed session.permission.before policy hooks with the Session Guard example. Depends on #1263. Stage diff.
  • [ ] #1276 adds host-persisted, session-scoped plugin timeline items (timelineRenderers, host_plugins_timeline_list, host-plugins://timeline, sandboxed timelineItem renderers) and the Timeline Review example. Depends on #1262. Stage diff.
  • [ ] #1277 adds validated plugin usage and quota sources (contributes.usageSources), host_plugins_usage_query (Tauri + Axum), on-demand Settings usage cards, and the Usage Demo example. Depends on #1262. Stage diff.
  • [ ] #1278 registers reviewed ACP providers from host plugins (contributes.acpProviders) with layered built-in/DB precedence, scoped custom:@plugin-<sha256> runtime isolation, isolated npm/binary/uvx caches, live refresh via app://acp-agents-updated, and the ACP Provider example. Depends on #1263. Stage diff.
  • [ ] #1279 adds plugin form items (contributes.newWorkspaceItems) with combobox, select, toggle, and action controls for New Workspace and New Worktree dialogs, bounded patch validation, and the New Workspace Issues example. Depends on #1262. Stage diff.
  • [ ] #1280 adds composer pills (contributes.composerPills, incl. single-level menus and draft insertion), docked input activities (contributes.inputActivities), session context actions (contributes.sessionActions), and the Composer Pills example. Depends on #1262. Stage diff.
  • [ ] #1281 adds timeline transformers and custom tool output rendering (contributes.timelineTransformers, host_plugins_timeline_transform, keep/omit/replace with schema-validated sandboxed cards across live streaming and completed activity timelines, and the Tool Output Card example). Depends on #1276. Stage diff.
  • [ ] #1282 adds plugin services (services.provides / services.requires), transactional dependency lifetimes, bounded synchronous cross-plugin ctx.services.call, schema-validated ctx.events.emit (host-plugins://plugin-event), frontend Settings/surface integration, and the paired Service Provider / Service Consumer examples. Depends on #1262. Stage diff.

The branches target main in the upstream repository. Review the linked stage diffs while GitHub shows cumulative changes. After each predecessor lands, update the next branch onto main and check its CI. Each stage links this issue without closing it. Keep the issue open until the full acceptance list is implemented, documented, merged and verified.

Acceptance

  • Import, enable, disable, and remove a manifest from Settings. Keep the local and remote host catalogs independent.
  • Use a quick action to open the contributed panel. Withdraw the command and panel when the plugin is disabled.
  • Read turn activity within the active workspace and discard its records when its plugin is disabled.
  • Resolve GitHub refs and npm package versions. Install from a host directory and preserve the selected source in the catalog.
  • Update a source-installed plugin from its saved directory, GitHub reference, or npm selector. Preserve enablement and reject ID changes, downgrades, invalid manifests, and stale concurrent writes.
  • Show the localized trust notice and the actual declared plugin identity, version, and resolved source before a user confirms installation.
  • Browse trusted HTTPS indexes, inspect exact sources and versions, persist trusted index URLs per browser profile, and install entries through the normal source and manifest validation path.
  • Check that confirmation installs the reviewed snapshot and rejects an index entry whose ID or version differs from the manifest.
  • Verify desktop, server, and Web CI. Preserve the macOS, remote workspace, and phone-sized browser smoke tests from the original implementation.

The workspace extension stage has exactly the same file tree as the original combined draft #1213. That PR retains the Web, macOS, and remote workspace smoke-test evidence.

Reference coverage

  • Installation, runtime and configuration. #1219–#1222, #1225, #1227, #1229, and #1239 cover npm, GitHub, and host directory sources, reviewed snapshots, updates, trust disclosure, and HTTPS indexes. #1240, #1242, #1248, and #1254 add scoped QuickJS server modules, JSON Schema-validated RPC, versioned persisted settings with migrations, and localized labels. See Paseo publishing and sources and DeepSeek Harness configuration.
  • Client contributions. #1241 and #1247 cover workspace, settings, session header and composer surfaces. #1250 adds draft insertion, #1253 adds detail and activation slots, and #1254 adds translated host labels. #1259 adds declarative appearance themes. #1262 adds full-page workbench screens and sidebar header/footer navigation. #1265 adds workspace row badges. #1267 adds workspace draft and saved-session slash commands. #1269 adds opt-in custom sidebar views. #1270 and #1271 add read-only and opt-in writable file panels (window.codeg.file.writeText). #1272 adds workspace header actions, #1273 adds global/workspace/session scoped commands, #1274 adds composer attachment sources, #1276 and #1281 add scoped plugin timeline items, timeline transformers, and custom tool output rendering, #1279 adds New Workspace / New Worktree form items (contributes.newWorkspaceItems), and #1280 adds composer pills, docked input activities, and session context actions. See Paseo client contributions.
  • Lifecycle. #1244, #1245, #1249, #1252, #1255, #1256 and #1257 cover workspace open/close/creation/archive hooks, background registration, live ACP observers, worktree observation and destination selection, and agent close/archive events. #1260 adds a launch-scoped environment transformation, #1261 adds initial-title transformation and durable creation observers, and #1275 adds awaited session.prompt.before transformations and fail-closed session.permission.before policy hooks. (Unbounded post-checkout scripts and arbitrary agent config mutation remain intentionally outside Codeg's sandboxed QuickJS security model; see the upstream capability audit.) See Paseo lifecycle hooks and DeepSeek Harness event modes.
  • Tools, services and providers. #1248 supplies the typed RPC boundary, #1263 adds live ACP tool completion observers, and #1266 adds schema-validated plugin model tools through Codeg MCP. #1277 adds validated usage sources (contributes.usageSources) with isolated on-demand quota/balance/status queries in Settings. #1278 adds reviewed ACP provider contributions (contributes.acpProviders) with layered built-in/DB precedence, scoped runtime isolation, and live refresh. #1281 adds timeline transformers and custom tool output rendering (contributes.timelineTransformers). #1282 adds plugin services (services.provides/requires), transactional dependency lifetimes, bounded cross-plugin ctx.services.call, and typed host-client events (host-plugins://plugin-event). See Harness tools, services, adapters and Paseo providers.

Extension platform acceptance

  • [ ] Execute versioned host entry points from reviewed install snapshots. Expose typed plugin RPC and subscriptions to the connected client. Verify startup, disable, reload, update, unload and failure isolation. (Implemented & Ready for Review: #1239, #1240, #1241, #1244, #1248; awaiting merge)
  • [ ] Give plugins typed, persisted settings with defaults, validation and migration. Offer settings pages, plugin detail and activation slots, localized contributions and theme registration. (Implemented & Ready for Review: #1242, #1253, #1254, #1259; awaiting merge)
  • [ ] Support plugin-defined client components in workspace and agent panels, dedicated screens, sidebar views and items, workspace row badges, header actions, file viewers/editors, and the new workspace form. (Implemented & Ready for Review: #1241, #1247, #1262, #1265, #1269, #1270, #1271, #1272, #1279; awaiting merge)
  • [ ] Support global, workspace and session commands, slash commands, composer actions and pills, input activities, attachment sources, and session context actions. Verify registration and removal across active workspace and session changes. (Implemented & Ready for Review: #1250, #1267, #1273, #1274, #1280; awaiting merge)
  • [ ] Support transforming, rendering and appending timeline items, including tool output. Keep custom entries and errors scoped to the owning host and session. (Implemented & Ready for Review: #1276, #1281; awaiting merge)
  • [ ] Open lifecycle events for workspace and worktree creation and archive, agent creation and launch, open/close/archive, turn start/finish and permission state. Verify awaited transformations, observer delivery, error behavior and cleanup. (Implemented & Ready for Review: #1244, #1245, #1249, #1252, #1255, #1256, #1257, #1260, #1261, #1275; awaiting merge)
  • [ ] Expose model-callable tools, tool result events, providers including ACP adapters, and usage sources. Define service and event contracts for plugins across the host and client boundary. (Implemented & Ready for Review: #1263, #1266, #1277, #1278, #1282; awaiting merge)
  • [ ] Publish the plugin author reference, types and runnable examples. Verify the install-to-use workflows using Tauri desktop, standalone Web, phone-sized Web, and remote desktop against the correct connected host. Link the upstream capability audit, completed PRs (#1219–#1282), and post-merge end-to-end verification here before closing.

kogekiplay avatar Nov 20 '26 07:11 kogekiplay

Upstream Capability Audit (Paseo & DeepSeek Harness)

All 12 implementation stages (#1271–#1282) completing the host plugin platform capability matrix have been implemented, unit/integration tested, and opened as stacked Draft PRs against main.

Capability Mapping

Extension Surface Paseo (27c126d35) / DeepSeek Harness (22ddee3792) Codeg PR Stack
Manifest, install & distribution paseo-plugin.json, client/server entrypoints, reviewed registry; Harness bundle/profile #1219, #1222, #1225, #1227, #1229, #1239
Settings, i18n, typed RPC Schema + host settings, Zod RPC; Harness Schemastery config #1220, #1240, #1242, #1248, #1254
Client surfaces, files & themes Screens, sidebar views/items, workspace/agent/file panels, header actions, themes #1241, #1247, #1253, #1259, #1262, #1265, #1269, #1270, #1271, #1272
Commands & slash commands Global / workspace / agent Command Center + slash commands #1267, #1273
Composer & New Workspace form Attachment sources, New Workspace items, composer pills, input activities, session actions #1250, #1274, #1279, #1280
Timeline items & tool output Daemon append, streaming/complete transformers & custom renderers #1276, #1281
Lifecycle hooks Workspace / worktree / agent / turn / permission observers & awaited transformations #1244, #1245, #1249, #1252, #1255, #1256, #1257, #1260, #1261, #1275
Model tools & tool results Agent tools / MCP; Harness ctx.tools & tool completion events #1263, #1266
ACP Providers Paseo ACP providers; Harness adapters #1278
Usage & quota sources Multi-account quota windows, balances, details & error states #1277
Services & typed events Harness Cordis service dependency lifetimes & typed cross-boundary events #1282

Audit Findings Resolved Before Merge

  • Event type disambiguation (#1282 d46ea5a25): Renamed browser bridge lifecycle event to PluginClientLifecycleEvent in docs/host-plugin-client.d.ts (eliminating TS2308 collision with docs/host-plugin-lifecycle.d.ts) and narrowed lifecycle event examples with "data" in event.
  • Usage report key uniqueness (#1277 339ac52c9): Rejected duplicate account.key across a response and duplicate window.id/balance.id within an account (post control-character sanitization) in usage.rs, preventing frontend React key collisions.

Intentional Architecture Boundaries

  • Codeg runs plugin server modules inside per-call QuickJS sandboxes (bounded CPU/memory/payload, no ambient FS/network/host credentials) and client UI inside opaque-origin sandboxed iframes, rather than unsandboxed Node/React Native or in-process DI.
  • Consequently, Codeg models providers via reviewed ACP launchers (npx/uvx/binary) with scoped custom:@plugin-<sha256> runtime isolation, tools via Codeg's MCP companion, and cross-plugin services/events via bounded synchronous QuickJS calls (depth <= 2) and post-commit schema-validated event broadcasts.

Merge & E2E Checklist Before Closing #1218

  • Reconcile overlapping runtime.rs / docs/host-plugin-client.d.ts edits cleanly as stacked PRs merge (#1275, #1276, #1281, #1282 share the conditional 4th handler context argument and client bridge declarations).
  • Run end-to-end verification across Tauri desktop, standalone Web, phone-width Web (390px), and remote desktop against a real connected host once the stack lands on main.

kogekiplay avatar Nov 21 '26 17:11 kogekiplay

同步记录与 #1296(MCP 插件化接入)对接的后续扩展点设计:contributes.mcpConnectors(作为 #1218 合并后的首批端到端插件范例之一,底层宿主引擎已在独立 PR 栈 #1321 → #1326 → #1334 就绪,其中 #1326 与 #1334 均已 8/8 CI 全绿)。

与 #1218 现有能力的衔接

  • 安全边界完全一致:QuickJS 沙箱与 client iframe 不新增网络/文件/子进程/凭证权限;连接器仅以声明式 Schema(camelCase + deny_unknown_fields + BCP-47 Translations)写在 manifest.contributes.mcpConnectors,与 #1278 acpProviders 审阅范式一致。
  • 两阶段审阅:host_plugins_preview_install(InstallPreview)展示完整远程端点/本地命令/认证声明,安装本身零配置写入;用户显式激活时由宿主经 McpOAuthBridge(#1334)+ mcp_engine::apply(preflight → 原子写锁)完成跨智能体(含 #1278 插件 ACP)部署与 mcp_probe 验证。
  • UI 与渲染联动:可绑定同插件的 activationPanel(仅接收脱敏只读状态投影,通过宿主对话框发起操作)以及 #1281 timelineRenderers / timelineTransformers 渲染 mcp__<serverKey>__* 工具卡片(如 GitHub Issue/PR 卡片、Notion 文档卡片)。
  • 卸载默认语义:卸载插件时默认保留已配置的 MCP 为独立用户条目(仅解除归属),另提供默认不勾选的显式移除与撤销 OAuth 选项。

完整字段定义、约束表与 GitHub/Notion 范例清单已同步记录在 #1296,待 #1218 合入主干后即可按 3 个独立小 PR(Schema 审阅 → 宿主 Planner/归属 → 前端 Connectors UI 与范例)增量落地。

kogekiplay avatar Nov 28 '26 05:11 kogekiplay