@comfyorg/comfyui-desktop-bridge-types 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -105,6 +105,42 @@ export type ComfyDesktop2FirebaseAuthState =
105
105
  status: 'signed_in'
106
106
  userId: string
107
107
  }
108
+ /**
109
+ * Desktop's own Comfy account session, as the hosted local ComfyUI view sees it.
110
+ * `disabled` means Desktop does not share its session with this view (ops flag
111
+ * off, or the view is not a trusted loopback ComfyUI).
112
+ */
113
+ export type ComfyDesktop2AuthState =
114
+ | {
115
+ status: 'disabled'
116
+ }
117
+ | {
118
+ status: 'signed_out'
119
+ }
120
+ | {
121
+ status: 'signed_in'
122
+ /** Comfy user id (the access token's `sub`), not a Firebase uid. */
123
+ userId: string
124
+ email?: string
125
+ workspaceId?: string
126
+ }
127
+ export interface ComfyDesktop2AuthBridge {
128
+ getState(): Promise<ComfyDesktop2AuthState>
129
+ /** The workspace credential, only for an exact workspace Desktop's session
130
+ * is scoped to; null when signed out, disabled, or the scope is missing,
131
+ * malformed or different. The refresh token never leaves Desktop. */
132
+ getWorkspaceToken(workspaceId: string): Promise<string | null>
133
+ /** Runs Desktop's browser sign-in and resolves with the resulting state. */
134
+ requestSignIn(): Promise<ComfyDesktop2AuthState>
135
+ /** Signs Desktop out of its account (every view follows) and resolves with
136
+ * the resulting state; Desktop may keep the session if an install needs it. */
137
+ signOut(): Promise<ComfyDesktop2AuthState>
138
+ /** Re-scopes Desktop's session to `workspaceId` (browser consent the first
139
+ * time) and resolves with the resulting state; every view follows. */
140
+ switchWorkspace(workspaceId: string): Promise<ComfyDesktop2AuthState>
141
+ /** Fires when Desktop signs in, signs out or switches workspace. */
142
+ onChanged(callback: (state: ComfyDesktop2AuthState) => void): () => void
143
+ }
108
144
  export interface ComfyDesktop2TerminalBridge {
109
145
  subscribe(installationId?: string): Promise<TerminalRestore>
110
146
  unsubscribe(installationId?: string): Promise<void>
@@ -161,6 +197,8 @@ export interface ComfyDesktop2Bridge {
161
197
  Terminal?: ComfyDesktop2TerminalBridge
162
198
  Logs?: ComfyDesktop2LogsBridge
163
199
  Telemetry?: ComfyDesktop2TelemetryBridge
200
+ /** Absent on Desktop builds older than this bridge. */
201
+ Auth?: ComfyDesktop2AuthBridge
164
202
  }
165
203
  /**
166
204
  * The `-?` mapper intentionally requires every top-level bridge member.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfyorg/comfyui-desktop-bridge-types",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "TypeScript definitions for the Comfy Desktop hosted frontend bridge",
5
5
  "type": "module",
6
6
  "main": "./index.js",