blink 0.1.110 → 0.1.112

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.
@@ -1,5 +1,5 @@
1
1
  import { Context, UIOptions, UIOptionsSchema } from "../index.browser-CS2PXHA_.cjs";
2
- import "../index.node-ztcay7c1.cjs";
2
+ import "../index.node-HdKpjD23.cjs";
3
3
  import { BuildLog, BuildResult } from "../index-DZ_cKJPr.cjs";
4
4
  import { CapabilitiesResponse, Client } from "../index-BDhvk5TM.cjs";
5
5
  import { UIMessage } from "ai";
@@ -26,6 +26,58 @@ declare function useAgent(options: UseAgentOptions): {
26
26
  } | undefined;
27
27
  };
28
28
  //#endregion
29
+ //#region src/react/use-auth.d.ts
30
+ interface UseAuthOptions {
31
+ /**
32
+ * Whether to automatically check auth status on mount.
33
+ * @default true
34
+ */
35
+ readonly autoCheck?: boolean;
36
+ /**
37
+ * Callback when authentication status changes.
38
+ */
39
+ readonly onAuthChange?: (user: UserInfo | undefined) => void;
40
+ /**
41
+ * Callback when login URL is generated (for custom UI flows).
42
+ */
43
+ readonly onLoginUrl?: (url: string, id: string) => void;
44
+ /**
45
+ * Optional test path for auth token file (for testing only).
46
+ * When set, uses this path instead of the default XDG config path.
47
+ */
48
+ readonly testAuthPath?: string;
49
+ }
50
+ interface UserInfo {
51
+ readonly email: string;
52
+ }
53
+ interface UseAuth {
54
+ /** Current user info if authenticated, undefined if not */
55
+ readonly user: UserInfo | undefined;
56
+ /** Current auth token (if any) */
57
+ readonly token: string | undefined;
58
+ /** Error message if any */
59
+ readonly error: string | undefined;
60
+ /**
61
+ * Start the login flow. This will:
62
+ * 1. Generate a login URL via the API
63
+ * 2. Call onLoginUrl callback (if provided)
64
+ * 3. Wait for authentication to complete
65
+ * 4. Save the token and fetch user info
66
+ *
67
+ * @returns The authenticated user info
68
+ */
69
+ readonly login: () => Promise<UserInfo>;
70
+ /**
71
+ * Logout the current user by clearing the token.
72
+ */
73
+ readonly logout: () => void;
74
+ }
75
+ /**
76
+ * Hook for managing Blink authentication state.
77
+ * This is UI-agnostic and can be used in both TUI and Desktop apps.
78
+ */
79
+ declare function useAuth(options?: UseAuthOptions): UseAuth;
80
+ //#endregion
29
81
  //#region src/react/use-bundler.d.ts
30
82
  type BundlerStatus = "building" | "success" | "error";
31
83
  interface BundlerContext {
@@ -260,6 +312,8 @@ interface UseDevModeOptions {
260
312
  }) => void;
261
313
  readonly onError?: (error: string) => void;
262
314
  readonly onModeChange?: (mode: DevMode) => void;
315
+ readonly onAuthChange?: (user: UserInfo | undefined) => void;
316
+ readonly onLoginUrl?: (url: string, id: string) => void;
263
317
  }
264
318
  interface BuildStatus {
265
319
  readonly status: BundlerStatus;
@@ -302,6 +356,7 @@ interface UseDevMode {
302
356
  readonly options: AgentOptions;
303
357
  readonly approval: ApprovalRequest | undefined;
304
358
  readonly tokenUsage: TokenUsage | undefined;
359
+ readonly auth: UseAuth;
305
360
  readonly server: LocalServer;
306
361
  readonly showWaitingPlaceholder: boolean;
307
362
  }
@@ -329,6 +384,7 @@ declare function useDotenv(directory: string, name?: string): Record<string, str
329
384
  interface UseEditAgentOptions {
330
385
  readonly directory: string;
331
386
  readonly apiServerUrl?: string;
387
+ readonly token?: string;
332
388
  }
333
389
  declare function useEditAgent(options: UseEditAgentOptions): {
334
390
  client: Client | undefined;
@@ -361,4 +417,4 @@ declare function useOptions({
361
417
  error: Error | undefined;
362
418
  };
363
419
  //#endregion
364
- export { useAgent, useBundler, useChat, useDevMode, useDevhook, useDotenv, useEditAgent, useOptions };
420
+ export { useAgent, useAuth, useBundler, useChat, useDevMode, useDevhook, useDotenv, useEditAgent, useOptions };
@@ -1,5 +1,5 @@
1
1
  import { Context, UIOptions, UIOptionsSchema } from "../index.browser-BsqAq16G.js";
2
- import "../index.node-GlFXJEaB.js";
2
+ import "../index.node-C_bJ2rBz.js";
3
3
  import { BuildLog, BuildResult } from "../index-BNMqN1Am.js";
4
4
  import { CapabilitiesResponse, Client } from "../index-DHCYXwb2.js";
5
5
  import { UIMessage } from "ai";
@@ -26,6 +26,58 @@ declare function useAgent(options: UseAgentOptions): {
26
26
  } | undefined;
27
27
  };
28
28
  //#endregion
29
+ //#region src/react/use-auth.d.ts
30
+ interface UseAuthOptions {
31
+ /**
32
+ * Whether to automatically check auth status on mount.
33
+ * @default true
34
+ */
35
+ readonly autoCheck?: boolean;
36
+ /**
37
+ * Callback when authentication status changes.
38
+ */
39
+ readonly onAuthChange?: (user: UserInfo | undefined) => void;
40
+ /**
41
+ * Callback when login URL is generated (for custom UI flows).
42
+ */
43
+ readonly onLoginUrl?: (url: string, id: string) => void;
44
+ /**
45
+ * Optional test path for auth token file (for testing only).
46
+ * When set, uses this path instead of the default XDG config path.
47
+ */
48
+ readonly testAuthPath?: string;
49
+ }
50
+ interface UserInfo {
51
+ readonly email: string;
52
+ }
53
+ interface UseAuth {
54
+ /** Current user info if authenticated, undefined if not */
55
+ readonly user: UserInfo | undefined;
56
+ /** Current auth token (if any) */
57
+ readonly token: string | undefined;
58
+ /** Error message if any */
59
+ readonly error: string | undefined;
60
+ /**
61
+ * Start the login flow. This will:
62
+ * 1. Generate a login URL via the API
63
+ * 2. Call onLoginUrl callback (if provided)
64
+ * 3. Wait for authentication to complete
65
+ * 4. Save the token and fetch user info
66
+ *
67
+ * @returns The authenticated user info
68
+ */
69
+ readonly login: () => Promise<UserInfo>;
70
+ /**
71
+ * Logout the current user by clearing the token.
72
+ */
73
+ readonly logout: () => void;
74
+ }
75
+ /**
76
+ * Hook for managing Blink authentication state.
77
+ * This is UI-agnostic and can be used in both TUI and Desktop apps.
78
+ */
79
+ declare function useAuth(options?: UseAuthOptions): UseAuth;
80
+ //#endregion
29
81
  //#region src/react/use-bundler.d.ts
30
82
  type BundlerStatus = "building" | "success" | "error";
31
83
  interface BundlerContext {
@@ -260,6 +312,8 @@ interface UseDevModeOptions {
260
312
  }) => void;
261
313
  readonly onError?: (error: string) => void;
262
314
  readonly onModeChange?: (mode: DevMode) => void;
315
+ readonly onAuthChange?: (user: UserInfo | undefined) => void;
316
+ readonly onLoginUrl?: (url: string, id: string) => void;
263
317
  }
264
318
  interface BuildStatus {
265
319
  readonly status: BundlerStatus;
@@ -302,6 +356,7 @@ interface UseDevMode {
302
356
  readonly options: AgentOptions;
303
357
  readonly approval: ApprovalRequest | undefined;
304
358
  readonly tokenUsage: TokenUsage | undefined;
359
+ readonly auth: UseAuth;
305
360
  readonly server: LocalServer;
306
361
  readonly showWaitingPlaceholder: boolean;
307
362
  }
@@ -329,6 +384,7 @@ declare function useDotenv(directory: string, name?: string): Record<string, str
329
384
  interface UseEditAgentOptions {
330
385
  readonly directory: string;
331
386
  readonly apiServerUrl?: string;
387
+ readonly token?: string;
332
388
  }
333
389
  declare function useEditAgent(options: UseEditAgentOptions): {
334
390
  client: Client | undefined;
@@ -361,4 +417,4 @@ declare function useOptions({
361
417
  error: Error | undefined;
362
418
  };
363
419
  //#endregion
364
- export { useAgent, useBundler, useChat, useDevMode, useDevhook, useDotenv, useEditAgent, useOptions };
420
+ export { useAgent, useAuth, useBundler, useChat, useDevMode, useDevhook, useDotenv, useEditAgent, useOptions };