Skip to content

Prepare the reusable Kasmos monitor bundle and host contract for a... - #182

Merged
brkastner merged 6 commits into
mainfrom
plan/codex-linux-sidebar-handoff
Jul 12, 2026
Merged

Prepare the reusable Kasmos monitor bundle and host contract for a...#182
brkastner merged 6 commits into
mainfrom
plan/codex-linux-sidebar-handoff

Conversation

@brkastner

Copy link
Copy Markdown
Contributor

summary

  • description: Prepare the reusable Kasmos monitor bundle and host contract for a later permanent sidebar pane in the Linux Codex Desktop fork.
  • goal: Make the existing kasmos monitor bundle host-agnostic, exportable, and contract-versioned — so a later, separately-planned kasmos-panel Linux feature can mount it as a permanent Codex Desktop sidebar pane without forking the dashboard or moving lifecycle authority out of kasmos.
  • architecture: Introduce a canonical KasmosMonitorHost interface inside web/admin/src/widget/ and reduce today's window.openai coupling to one of two shipped adapters (the other reads a host-injected window.kasmosMonitorHost). Extend the contract with the four things a persistent pane needs and an ephemeral widget does not: a sidebar display mode, host-driven pane visibility (drives polling cadence), durable state persistence delegated to the host, and an outbound badge channel for the collapsed sidebar entry. Ship the bundle out of the Go binary via kas monitor bundle (files + integrity manifest + declared capabilities), promote the read-only snapshot bridge to a stable POST /v1/monitor/snapshot, and land a tested reference host adapter + disabled-by-default feature template under integrations/codex-desktop-linux/ that the fork task consumes.
  • tech stack: React 19 + Vite 6 (web/admin, second widget entry via vite.widget.config.ts), vitest/jsdom, Go 1.24+ (internal/appwidget, webassets go:embed in web/widget_assets.go, cobra cmd/monitor.go, cmd/serve.go), internal/livestatus schema v2, mark3labs/mcp-go (pinned — do not bump), Docusaurus (web/docs).
  • review cycle: 1

tasks

  • 1. Host-adapter seam — make the monitor bundle host-agnostic
  • 2. Go contract, bundle export, and the stable snapshot endpoint
  • 3. Reference host adapter and the disabled-by-default kasmos-panel feature template
  • 4. Document the host contract and clear docs drift (hard blocker)

reviewer notes

verify_approved. acceptance criteria satisfied across the host contract, exported bundle, stable snapshot endpoint, reference sidebar handoff, and documentation. evidence: gofmt -l ., go vet ./..., go build ./..., go test ./... -count=1, web/admin npm test (176 passed), widget build, reference host node tests (3 passed), empty docs drift, and web/docs production build all passed.

changes

cmd/monitor.go
cmd/monitor_test.go
cmd/serve.go
docs/docs-drift-map.yml
integrations/codex-desktop-linux/README.md
integrations/codex-desktop-linux/doc.go
integrations/codex-desktop-linux/kasmos-panel/README.md
integrations/codex-desktop-linux/kasmos-panel/feature.json
integrations/codex-desktop-linux/kasmos-panel/host.js
integrations/codex-desktop-linux/kasmos-panel/host.test.mjs
integrations/codex-desktop-linux/kasmos-panel/patch.js
integrations/codex-desktop-linux/kasmos-panel/stage.sh
integrations/codex-desktop-linux/kasmos_panel_test.go
internal/appwidget/appwidget.go
internal/appwidget/appwidget_test.go
internal/appwidget/contract.go
internal/appwidget/export.go
internal/appwidget/export_test.go
web/admin/src/widget/Monitor.tsx
web/admin/src/widget/tests/host.test.tsx
web/admin/src/widget/tests/sourceInvariants.test.ts
web/admin/src/widget/badge.ts
web/admin/src/widget/host.ts
web/admin/src/widget/openai.ts
web/admin/src/widget/types.ts
web/admin/src/widget/widget.module.css
web/admin/widget-dist/monitor.css
web/admin/widget-dist/monitor.js
web/docs/docs/cli-reference/serve.mdx
web/docs/docs/guides/codex-monitor-widget.mdx
web/docs/docs/guides/monitor-host-contract.mdx
web/docs/sidebars.ts

commits

56d94a2 fix: address review feedback (round 1)
2c558cf feat(task-4): document monitor host contract
57af812 feat(task-3): add kasmos panel handoff template
fd9317f feat(task-1): make monitor bundle host agnostic
d4e465c feat(task-2): export monitor bundle and snapshot contract

stats

cmd/monitor.go | 22 +
cmd/monitor_test.go | 16 +
cmd/serve.go | 8 +-
docs/docs-drift-map.yml | 4 +-
integrations/codex-desktop-linux/README.md | 7 +
integrations/codex-desktop-linux/doc.go | 2 +
.../codex-desktop-linux/kasmos-panel/README.md | 14 +
.../codex-desktop-linux/kasmos-panel/feature.json | 11 +
.../codex-desktop-linux/kasmos-panel/host.js | 72 +
.../codex-desktop-linux/kasmos-panel/host.test.mjs | 69 +
.../codex-desktop-linux/kasmos-panel/patch.js | 29 +
.../codex-desktop-linux/kasmos-panel/stage.sh | 13 +
.../codex-desktop-linux/kasmos_panel_test.go | 100 +
internal/appwidget/appwidget.go | 11 +-
internal/appwidget/appwidget_test.go | 83 +-
internal/appwidget/contract.go | 15 +
internal/appwidget/export.go | 85 +
internal/appwidget/export_test.go | 65 +
web/admin/src/widget/Monitor.tsx | 32 +-
web/admin/src/widget/tests/host.test.tsx | 38 +
.../src/widget/tests/sourceInvariants.test.ts | 17 +
web/admin/src/widget/badge.ts | 15 +
web/admin/src/widget/host.ts | 59 +
web/admin/src/widget/openai.ts | 109 +-
web/admin/src/widget/types.ts | 2 +-
web/admin/src/widget/widget.module.css | 2 +
web/admin/widget-dist/monitor.css | 2 +-
web/admin/widget-dist/monitor.js | 9269 ++++++++++----------
web/docs/docs/cli-reference/serve.mdx | 2 +-
web/docs/docs/guides/codex-monitor-widget.mdx | 5 +-
web/docs/docs/guides/monitor-host-contract.mdx | 130 +
web/docs/sidebars.ts | 1 +
32 files changed, 5605 insertions(+), 4704 deletions(-)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56d94a2a23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/admin/src/widget/openai.ts Outdated
@brkastner
brkastner merged commit 43776c2 into main Jul 12, 2026
9 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44e88e4ae7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 19 to 20
const [project, setProject] = useState(initialProject);
const [task, setTask] = useState(initialTask);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply restored host state after subscription notifications

When an embedded host restores durable state asynchronously (the reference host's restoreState updates state and notifies subscribers after store.get), these useState initializers have already run, so the re-render from subscribe keeps project/task at their old or undefined values and the following saveState effect can write that stale scope back. In sidebar hosts that load persisted {project, task} after mounting, the pane ignores the saved selection and may clobber it; update local state when host.state changes before persisting.

Useful? React with 👍 / 👎.

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