Skip to content

feat(app): replace dispatch event with typed event bus#2065

Open
JeanMeijer wants to merge 1 commit into
devfrom
feat/add-event-bus
Open

feat(app): replace dispatch event with typed event bus#2065
JeanMeijer wants to merge 1 commit into
devfrom
feat/add-event-bus

Conversation

@JeanMeijer

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces scattered window.dispatchEvent / addEventListener calls with a typed internal event bus so app-wide events are centralized and type-safe.
  • Consolidates Den session/settings, new provider, model picker, prompt focus, side panel, and server settings events into one shared events API.
  • Removes the old Den/provider event helper modules now that those events live in the shared bus.
  • Updates session, settings, cloud auth, provider sync, model picker, composer, and shell routes to use the new bus without changing user-facing behavior.

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview, Comment Jun 2, 2026 7:29pm
openwork-den Ready Ready Preview, Comment Jun 2, 2026 7:29pm
openwork-den-worker-proxy Ready Ready Preview, Comment Jun 2, 2026 7:29pm
openwork-landing Ready Ready Preview, Comment, Open in v0 Jun 2, 2026 7:29pm

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 34 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/app/src/lib/event-bus.ts">

<violation number="1" location="apps/app/src/lib/event-bus.ts:28">
P2: `emit` makes payload optional for all events, so required event details are no longer enforced by TypeScript.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic


emit<TType extends keyof TEvents & string>(
type: TType,
detail?: TEvents[TType],

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: emit makes payload optional for all events, so required event details are no longer enforced by TypeScript.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/app/src/lib/event-bus.ts, line 28:

<comment>`emit` makes payload optional for all events, so required event details are no longer enforced by TypeScript.</comment>

<file context>
@@ -0,0 +1,81 @@
+
+    emit<TType extends keyof TEvents & string>(
+      type: TType,
+      detail?: TEvents[TType],
+      options?: Omit<CustomEventInit<TEvents[TType]>, "detail">,
+    ) {
</file context>

@benjaminshafii

Copy link
Copy Markdown
Member

Daytona E2E validation for PR #2065: FAIL

Tested ref/commit: feat/add-event-bus at f679652 (feat(app): replace dispatch event with typed event bus)

Proof:

  • Daytona sandbox: openwork-test-20260602-141200 (retained; not deleted)
  • Electron CDP: https://9825-4dqyfnlyj4bklofg.daytonaproxy01.net
  • Artifacts: https://8090-bmyb4d2arammsw3o.daytonaproxy01.net
  • Recording: https://8090-bmyb4d2arammsw3o.daytonaproxy01.net/recordings/pr-2065-e2e.mp4
  • Screenshot: https://8090-bmyb4d2arammsw3o.daytonaproxy01.net/screenshots/daytona-screenshot-20260602-212312.png

Assertions/results:

  • CDP Electron assertion: PASS. navigator.userAgent contained Electron/35.7.5.
  • Welcome/local workspace smoke: PASS. Created /workspace/hello in the sandbox, selected it through the native Authorize folder picker, and reached #/workspace/ws_b0a42e5bae15/session.
  • Ready/running UI state: PASS. Workspace route showed Ready for new tasks.
  • Settings/event-heavy navigation: PARTIAL. Opened Settings, AI Providers, and returned Back to app without a visible app crash.
  • opencode sidecar process: FAIL. ps aux | rg opencode | rg -v rg found no running sidecar process.
  • Provider/model surface: FAIL. Opening Connect provider showed Failed to load providers {"code":"opencode_unconfigured","message":"OpenCode base URL is missing for this workspace"} and a renderer unhandledrejection was captured with the same message.

Additional log evidence:

  • Server log showed /workspace/ws_b0a42e5bae15/opencode/session returning 400.
  • Server log showed GET /workspace/ws_b0a42e5bae15/opencode/provider 400 and GET /workspace/ws_b0a42e5bae15/opencode/event 400.
  • Server log also showed an unhandled error: TypeError: Failed to parse URL from /session?limit=200.

Caveats:

  • The native folder picker required X11 automation via xdotool because it is not accessible through DOM/CDP.
  • The sandbox is still available for follow-up inspection.

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.

2 participants