Prepare the reusable Kasmos monitor bundle and host contract for a... - #182
Conversation
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
| const [project, setProject] = useState(initialProject); | ||
| const [task, setTask] = useState(initialTask); |
There was a problem hiding this comment.
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 👍 / 👎.
summary
kasmos-panelLinux feature can mount it as a permanent Codex Desktop sidebar pane without forking the dashboard or moving lifecycle authority out of kasmos.KasmosMonitorHostinterface insideweb/admin/src/widget/and reduce today'swindow.openaicoupling to one of two shipped adapters (the other reads a host-injectedwindow.kasmosMonitorHost). Extend the contract with the four things a persistent pane needs and an ephemeral widget does not: asidebardisplay 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 viakas monitor bundle(files + integrity manifest + declared capabilities), promote the read-only snapshot bridge to a stablePOST /v1/monitor/snapshot, and land a tested reference host adapter + disabled-by-default feature template underintegrations/codex-desktop-linux/that the fork task consumes.web/admin, second widget entry viavite.widget.config.ts), vitest/jsdom, Go 1.24+ (internal/appwidget,webassetsgo:embedinweb/widget_assets.go, cobracmd/monitor.go,cmd/serve.go),internal/livestatusschema v2,mark3labs/mcp-go(pinned — do not bump), Docusaurus (web/docs).tasks
kasmos-panelfeature templatereviewer 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(-)