You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(web-extensions): expose read-only active session context and composer-dock region - #1302
Adds two minimal, general-purpose host primitives to WebExtensionApi so web host extensions (such as Git status indicators, project-aware widgets, or composer utilities) can observe the active main-view session and mount below the composer without scraping private DOM attributes or internal stores:
No visual changes: adds data-cx-region="composer-dock" mount anchor only.
Read-only active session context (api.session)
packages/shared-contracts/src/web-native-extensions.ts: defines WebExtensionActiveSession (id, title, cwd, workspaceId, isBlank, isRemote, running) and adds session: { getActive(), onChange(listener) } to WebExtensionApi.
apps/web-ui/packages/client/ui-codexhost/src/client/native-extensions/api.ts: derives cloned read-only snapshots from the existing sessions.list (retainedBy.mainView), workspaces.list, and layout.panelInfo stores:
Returns null (and emits onChange(null) / re-emits on return) when a global main panel (layout.panelInfo.activePanelId !== null, e.g. Plugins) hides the conversation view and unmounts composer-dock.
Walks parent lineage to inherit the first non-empty ancestor cwd (preserving parent worktree / projectless cwd for subagents), falling back to owning workspace.path, and detects remote sessions.
Subscribes lazily only while listeners exist, deduplicates unchanged snapshots, isolates listener errors, and detaches cleanly on unsubscribe and reclaim().
Stable composer-dock mount region
Adds "composer-dock" to WEB_EXTENSION_REGIONS and marks InputBar's dock element with data-cx-region="composer-dock".
Scopes api.dom.mount("composer-dock") to [data-cx-region="conversation"] when the app shell is present so extensions never accidentally mount into embedded sidebar composer docks.
Docs & Tests
Documents api.session and composer-dock in docs/architecture/desktop-ui-extensions.md and .agents/skills/codexhost-add-desktop-extension/SKILL.md.
Adds unit tests in apps/web-ui/packages/client/ui-codexhost/test/web-native-extensions-api.test.ts and updates packages/shared-contracts/test/host-extensions.test.ts.
This adds a read-only active-session API and a composer-dock mount region for web extensions. The reported follow-up fixes (global panel handling and cwd inheritance) are covered by tests. No concrete merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
标题描述了本次变更的主要内容:为 web 扩展新增只读的活动会话上下文(api.session)以及 composer-dock 挂载区域。标题与变更集中的 shared-contracts、ui-codexhost api.ts、InputBar.tsx 及文档一致。标题长度为 86 个字符,略长,但仍清晰具体。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awaiting-authorWaiting for the author to respond or update the PR.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two minimal, general-purpose host primitives to
WebExtensionApisowebhost extensions (such as Git status indicators, project-aware widgets, or composer utilities) can observe the active main-view session and mount below the composer without scraping private DOM attributes or internal stores:No visual changes: adds
data-cx-region="composer-dock"mount anchor only.api.session)packages/shared-contracts/src/web-native-extensions.ts: definesWebExtensionActiveSession(id,title,cwd,workspaceId,isBlank,isRemote,running) and addssession: { getActive(), onChange(listener) }toWebExtensionApi.apps/web-ui/packages/client/ui-codexhost/src/client/native-extensions/api.ts: derives cloned read-only snapshots from the existingsessions.list(retainedBy.mainView),workspaces.list, andlayout.panelInfostores:null(and emitsonChange(null)/ re-emits on return) when a global main panel (layout.panelInfo.activePanelId !== null, e.g. Plugins) hides the conversation view and unmountscomposer-dock.cwd(preserving parent worktree / projectlesscwdfor subagents), falling back to owningworkspace.path, and detects remote sessions.reclaim().composer-dockmount region"composer-dock"toWEB_EXTENSION_REGIONSand marksInputBar's dock element withdata-cx-region="composer-dock".api.dom.mount("composer-dock")to[data-cx-region="conversation"]when the app shell is present so extensions never accidentally mount into embedded sidebar composer docks.api.sessionandcomposer-dockindocs/architecture/desktop-ui-extensions.mdand.agents/skills/codexhost-add-desktop-extension/SKILL.md.apps/web-ui/packages/client/ui-codexhost/test/web-native-extensions-api.test.tsand updatespackages/shared-contracts/test/host-extensions.test.ts.Verification
npx tsc -b --pretty false— passednpm run build:web:ui— passednpx vitest run --config tests/vitest.config.js packages/shared-contracts/test/host-extensions.test.ts apps/web-ui/packages/client/ui-codexhost/test/web-native-extensions-api.test.ts apps/web-ui/packages/client/ui-codexhost/test/shell-zoom.test.ts— 3 files / 60 tests passednpx eslint packages/shared-contracts/src/web-native-extensions.ts packages/shared-contracts/test/host-extensions.test.ts— passednode tools/check-boundaries.mjs— passednpx prettier --checkon all changed files — passed