@comfyorg/comfyui-desktop-bridge-types 0.8.0 → 0.9.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.
package/README.md CHANGED
@@ -39,6 +39,27 @@ async function openModelAccessPage(url: string): Promise<void> {
39
39
  every top-level member required, so Desktop's preload cannot claim the contract
40
40
  while omitting part of it.
41
41
 
42
+ ## Comfy pages hosted in Desktop's Apps view
43
+
44
+ A Comfy page that Desktop shows in its Apps view gets `window.comfyDesktopAuth`
45
+ instead: Desktop's account session, and nothing else of the bridge above.
46
+
47
+ ```ts
48
+ import type { ComfyDesktopHostedAuthBridge } from '@comfyorg/comfyui-desktop-bridge-types'
49
+
50
+ declare global {
51
+ interface Window {
52
+ comfyDesktopAuth?: ComfyDesktopHostedAuthBridge
53
+ }
54
+ }
55
+ ```
56
+
57
+ The page reads the session with `getState()`, follows it with `onChanged()`,
58
+ asks for the workspace credential with `getWorkspaceToken(workspaceId)` each
59
+ time it calls Comfy Cloud, and starts a sign-in with `requestSignIn()`. It
60
+ cannot sign Desktop out or switch workspace. The object is absent in a
61
+ browser, so a page keeps its own sign-in as the fallback.
62
+
42
63
  ## Provenance
43
64
 
44
65
  Generated from `src/types/comfyDesktopBridge.ts` in
@@ -174,6 +174,19 @@ export interface ComfyDesktop2AuthBridge {
174
174
  amountCents?: number
175
175
  ): Promise<ComfyDesktop2BillingHandoff>
176
176
  }
177
+ /**
178
+ * Desktop's own Comfy account session, as a Comfy page hosted in Desktop's
179
+ * Apps view sees it. Desktop exposes it to that page as
180
+ * `window.comfyDesktopAuth`. The page can read the session, hold the
181
+ * workspace and partner-node credentials, and start a sign-in; it cannot sign
182
+ * Desktop out or switch workspace.
183
+ */
184
+ export type ComfyDesktopHostedAuthBridge = Required<
185
+ Pick<
186
+ ComfyDesktop2AuthBridge,
187
+ 'getState' | 'getWorkspaceToken' | 'getPartnerNodeToken' | 'requestSignIn' | 'onChanged'
188
+ >
189
+ >
177
190
  export interface ComfyDesktop2TerminalBridge {
178
191
  subscribe(installationId?: string): Promise<TerminalRestore>
179
192
  unsubscribe(installationId?: string): Promise<void>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfyorg/comfyui-desktop-bridge-types",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "TypeScript definitions for the Comfy Desktop hosted frontend bridge",
5
5
  "type": "module",
6
6
  "main": "./index.js",