Skip to content

Multi-window: runtime window creation, and the singleton assumptions in the way #67

Description

@glennmichael123

Direction issue rather than a near-term ask. Today a craft app is exactly one window:

  • No create/open action in bridge_window.zig:55-111; window.craft.window is implicitly "the" window, no handle anywhere.
  • api.zig:199/254 can create windows from zig, but nothing routes that to JS or the CLI.
  • Every bridge is a process-global singleton (macos.zig:4074 setupBridgeHandlers), and outbound JS resolves one global webview — every reply and event in the process is evaluated into a single page regardless of origin.
  • The single NSWindowDelegate instance is process-global and re-attached to each new window (macos_window_events.zig:59-63).
  • window.open() is separately dead (window.open() and target=_blank are silently dropped — route them to the system browser #64).

The eventual want (stacksjs/harness: "pop this session out into its own window") needs: craft.window.create({url,...}) → handle, window-handle addressing on the window namespace, per-webview reply routing, and per-window event scoping. Sequencing: request-id correlation (#66) is a hard prerequisite — "which call asked" must be solved before "which window asked" — and #63's app delegate is where multi-window lifecycle naturally lives. Filing now so the singleton pattern stops spreading into new bridges in the meantime.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions