@comfyorg/comfyui-desktop-bridge-types 0.3.0 → 0.4.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,39 @@ 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
+ /** Fires when Desktop signs in, signs out or switches workspace. */
139
+ onChanged(callback: (state: ComfyDesktop2AuthState) => void): () => void
140
+ }
108
141
  export interface ComfyDesktop2TerminalBridge {
109
142
  subscribe(installationId?: string): Promise<TerminalRestore>
110
143
  unsubscribe(installationId?: string): Promise<void>
@@ -161,6 +194,8 @@ export interface ComfyDesktop2Bridge {
161
194
  Terminal?: ComfyDesktop2TerminalBridge
162
195
  Logs?: ComfyDesktop2LogsBridge
163
196
  Telemetry?: ComfyDesktop2TelemetryBridge
197
+ /** Absent on Desktop builds older than this bridge. */
198
+ Auth?: ComfyDesktop2AuthBridge
164
199
  }
165
200
  /**
166
201
  * 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.4.0",
4
4
  "description": "TypeScript definitions for the Comfy Desktop hosted frontend bridge",
5
5
  "type": "module",
6
6
  "main": "./index.js",