@passflow/react 0.28.0 → 0.30.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +95 -5
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.es.js +145 -145
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/src/components/form/forgot-password/forgot-password.d.ts.map +1 -1
  8. package/dist/src/components/form/signin/index.d.ts.map +1 -1
  9. package/dist/src/components/form/signup/index.d.ts.map +1 -1
  10. package/dist/src/components/provider/passflow-provider.d.cts +6 -0
  11. package/dist/src/components/provider/passflow-provider.d.ts +6 -0
  12. package/dist/src/components/provider/passflow-provider.d.ts.map +1 -1
  13. package/dist/src/components/ui/anti-bot/anti-bot-check.d.cts +22 -0
  14. package/dist/src/components/ui/anti-bot/anti-bot-check.d.ts +22 -0
  15. package/dist/src/components/ui/anti-bot/anti-bot-check.d.ts.map +1 -0
  16. package/dist/src/components/ui/anti-bot/fake-vendors.d.cts +33 -0
  17. package/dist/src/components/ui/anti-bot/fake-vendors.d.ts +33 -0
  18. package/dist/src/components/ui/anti-bot/fake-vendors.d.ts.map +1 -0
  19. package/dist/src/components/ui/anti-bot/index.d.cts +3 -0
  20. package/dist/src/components/ui/anti-bot/index.d.ts +3 -0
  21. package/dist/src/components/ui/anti-bot/index.d.ts.map +1 -0
  22. package/dist/src/components/ui/anti-bot/vendors.d.cts +61 -0
  23. package/dist/src/components/ui/anti-bot/vendors.d.ts +61 -0
  24. package/dist/src/components/ui/anti-bot/vendors.d.ts.map +1 -0
  25. package/dist/src/components/ui/index.d.cts +1 -0
  26. package/dist/src/components/ui/index.d.ts +1 -0
  27. package/dist/src/components/ui/index.d.ts.map +1 -1
  28. package/dist/src/components/ui/login-screen/login-screen.d.ts.map +1 -1
  29. package/dist/src/components/ui/login-screen/types.d.cts +6 -0
  30. package/dist/src/components/ui/login-screen/types.d.ts +6 -0
  31. package/dist/src/components/ui/login-screen/types.d.ts.map +1 -1
  32. package/dist/src/hooks/index.d.cts +2 -0
  33. package/dist/src/hooks/index.d.ts +2 -0
  34. package/dist/src/hooks/index.d.ts.map +1 -1
  35. package/dist/src/hooks/use-anti-bot.d.cts +16 -0
  36. package/dist/src/hooks/use-anti-bot.d.ts +16 -0
  37. package/dist/src/hooks/use-anti-bot.d.ts.map +1 -0
  38. package/dist/src/hooks/use-auth-agent-tools.d.cts +15 -0
  39. package/dist/src/hooks/use-auth-agent-tools.d.ts +15 -0
  40. package/dist/src/hooks/use-auth-agent-tools.d.ts.map +1 -0
  41. package/dist/src/hooks/use-forgot-password.d.ts.map +1 -1
  42. package/dist/src/hooks/use-passwordless-complete.d.cts +5 -2
  43. package/dist/src/hooks/use-passwordless-complete.d.ts +5 -2
  44. package/dist/src/hooks/use-passwordless-complete.d.ts.map +1 -1
  45. package/dist/src/hooks/use-provider.d.cts +5 -3
  46. package/dist/src/hooks/use-provider.d.ts +5 -3
  47. package/dist/src/hooks/use-provider.d.ts.map +1 -1
  48. package/dist/src/hooks/use-sessions.d.cts +28 -0
  49. package/dist/src/hooks/use-sessions.d.ts +28 -0
  50. package/dist/src/hooks/use-sessions.d.ts.map +1 -0
  51. package/dist/src/hooks/use-signin.d.cts +6 -3
  52. package/dist/src/hooks/use-signin.d.ts +6 -3
  53. package/dist/src/hooks/use-signin.d.ts.map +1 -1
  54. package/dist/src/hooks/use-signup.d.cts +6 -3
  55. package/dist/src/hooks/use-signup.d.ts +6 -3
  56. package/dist/src/hooks/use-signup.d.ts.map +1 -1
  57. package/dist/src/utils/agent-tools.d.cts +96 -0
  58. package/dist/src/utils/agent-tools.d.ts +96 -0
  59. package/dist/src/utils/agent-tools.d.ts.map +1 -0
  60. package/dist/src/utils/auth-error.d.cts +11 -2
  61. package/dist/src/utils/auth-error.d.ts +11 -2
  62. package/dist/src/utils/auth-error.d.ts.map +1 -1
  63. package/dist/src/utils/index.d.cts +1 -1
  64. package/dist/src/utils/index.d.ts +1 -1
  65. package/dist/src/utils/index.d.ts.map +1 -1
  66. package/dist/src/utils/model-context.d.cts +38 -0
  67. package/dist/src/utils/model-context.d.ts +38 -0
  68. package/dist/src/utils/model-context.d.ts.map +1 -0
  69. package/dist/style.css +1 -1
  70. package/package.json +2 -2
@@ -1,8 +1,10 @@
1
- import type { Providers } from '@passflow/core';
1
+ import type { PassflowAuthOptions, Providers } from '@passflow/core';
2
2
  import type { FederatedLanding } from '../types/index.cjs';
3
3
  export type UseProviderProps = (redirectUrl?: string, createTenant?: boolean, federatedLanding?: FederatedLanding) => {
4
- federatedWithPopup: (provider: Providers, inviteToken?: string) => void;
5
- federatedWithRedirect: (provider: Providers, inviteToken?: string) => void;
4
+ /** `options` is passed to core as the request's last argument. */
5
+ federatedWithPopup: (provider: Providers, inviteToken?: string, options?: PassflowAuthOptions) => void;
6
+ /** `options` is passed to core as the request's last argument. */
7
+ federatedWithRedirect: (provider: Providers, inviteToken?: string, options?: PassflowAuthOptions) => void;
6
8
  };
7
9
  export declare const useProvider: UseProviderProps;
8
10
  //# sourceMappingURL=use-provider.d.ts.map
@@ -1,8 +1,10 @@
1
- import type { Providers } from '@passflow/core';
1
+ import type { PassflowAuthOptions, Providers } from '@passflow/core';
2
2
  import type { FederatedLanding } from '../types/index.js';
3
3
  export type UseProviderProps = (redirectUrl?: string, createTenant?: boolean, federatedLanding?: FederatedLanding) => {
4
- federatedWithPopup: (provider: Providers, inviteToken?: string) => void;
5
- federatedWithRedirect: (provider: Providers, inviteToken?: string) => void;
4
+ /** `options` is passed to core as the request's last argument. */
5
+ federatedWithPopup: (provider: Providers, inviteToken?: string, options?: PassflowAuthOptions) => void;
6
+ /** `options` is passed to core as the request's last argument. */
7
+ federatedWithRedirect: (provider: Providers, inviteToken?: string, options?: PassflowAuthOptions) => void;
6
8
  };
7
9
  export declare const useProvider: UseProviderProps;
8
10
  //# sourceMappingURL=use-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-provider.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA0BhD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,OAAO,EACtB,gBAAgB,CAAC,EAAE,gBAAgB,KAChC;IACH,kBAAkB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,qBAAqB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5E,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,gBAgCzB,CAAC"}
1
+ {"version":3,"file":"use-provider.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAgC,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA0BhD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,OAAO,EACtB,gBAAgB,CAAC,EAAE,gBAAgB,KAChC;IACH,kEAAkE;IAClE,kBAAkB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACvG,kEAAkE;IAClE,qBAAqB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,KAAK,IAAI,CAAC;CAC3G,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,gBAsCzB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { PassflowUserSession } from '@passflow/core';
2
+ export type UseSessionsProps = () => {
3
+ /** The signed-in user's sessions, one per sign-in on any device or app. `current` marks this one. */
4
+ data: PassflowUserSession[];
5
+ refetch: () => Promise<PassflowUserSession[] | null>;
6
+ /**
7
+ * Ends one session. On success the session leaves `data` without a refetch.
8
+ * Ending the current session signs out like `logout()`; after a hosted sign-in the page then
9
+ * leaves for the hosted end-session page, so code after `await revoke()` may not run.
10
+ *
11
+ * @returns true when the server ended it
12
+ */
13
+ revoke: (sessionId: string) => Promise<boolean>;
14
+ /**
15
+ * Ends every session except the current one. On success only the current session stays in `data`.
16
+ *
17
+ * @returns how many sessions the server ended, or null when the request failed
18
+ */
19
+ signOutOthers: () => Promise<number | null>;
20
+ isLoading: boolean;
21
+ isError: boolean;
22
+ errorMessage: string;
23
+ };
24
+ /**
25
+ * Hook to list the signed-in user's sessions and end them
26
+ */
27
+ export declare const useSessions: UseSessionsProps;
28
+ //# sourceMappingURL=use-sessions.d.ts.map
@@ -0,0 +1,28 @@
1
+ import type { PassflowUserSession } from '@passflow/core';
2
+ export type UseSessionsProps = () => {
3
+ /** The signed-in user's sessions, one per sign-in on any device or app. `current` marks this one. */
4
+ data: PassflowUserSession[];
5
+ refetch: () => Promise<PassflowUserSession[] | null>;
6
+ /**
7
+ * Ends one session. On success the session leaves `data` without a refetch.
8
+ * Ending the current session signs out like `logout()`; after a hosted sign-in the page then
9
+ * leaves for the hosted end-session page, so code after `await revoke()` may not run.
10
+ *
11
+ * @returns true when the server ended it
12
+ */
13
+ revoke: (sessionId: string) => Promise<boolean>;
14
+ /**
15
+ * Ends every session except the current one. On success only the current session stays in `data`.
16
+ *
17
+ * @returns how many sessions the server ended, or null when the request failed
18
+ */
19
+ signOutOthers: () => Promise<number | null>;
20
+ isLoading: boolean;
21
+ isError: boolean;
22
+ errorMessage: string;
23
+ };
24
+ /**
25
+ * Hook to list the signed-in user's sessions and end them
26
+ */
27
+ export declare const useSessions: UseSessionsProps;
28
+ //# sourceMappingURL=use-sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-sessions.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAK1D,MAAM,MAAM,gBAAgB,GAAG,MAAM;IACnC,qGAAqG;IACrG,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,OAAO,CAAC,mBAAmB,EAAE,GAAG,IAAI,CAAC,CAAC;IACrD;;;;;;OAMG;IACH,MAAM,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD;;;;OAIG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,gBA4EzB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { PassflowPasskeyAuthenticateStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignInPayload } from '@passflow/core';
1
+ import type { PassflowAuthOptions, PassflowPasskeyAuthenticateStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignInPayload } from '@passflow/core';
2
2
  import type { AuthOperation, AuthUiError } from '../types/index.cjs';
3
3
  import { type UseEmailCodeStep } from './use-email-code-step.cjs';
4
4
  /**
@@ -17,12 +17,15 @@ export type UseSignInOptions = {
17
17
  export type UseSignInProps = (options?: UseSignInOptions) => {
18
18
  /**
19
19
  * Resolves a {@link SignInOutcome} for a password or passkey sign-in, the server's answer for a passwordless one,
20
- * and `false` when the request failed, was superseded, or entered the emailed-code step.
20
+ * and `false` when the request failed, was superseded, or entered the emailed-code step. `options` is passed to
21
+ * core as the request's last argument.
21
22
  */
22
- fetch: (payload: PassflowPasskeyAuthenticateStartPayload | PassflowSignInPayload | PassflowPasswordlessSignInPayload, type: AuthOperation) => Promise<false | SignInOutcome | PassflowPasswordlessResponse>;
23
+ fetch: (payload: PassflowPasskeyAuthenticateStartPayload | PassflowSignInPayload | PassflowPasswordlessSignInPayload, type: AuthOperation, options?: PassflowAuthOptions) => Promise<false | SignInOutcome | PassflowPasswordlessResponse>;
23
24
  isLoading: boolean;
24
25
  isError: boolean;
25
26
  error: AuthUiError | null;
27
+ /** The error the latest fetch set; null after a success, a reset or a cancel. Synchronous, unlike `error`. */
28
+ readError: () => AuthUiError | null;
26
29
  reset: () => void;
27
30
  /** Abandons the passkey request in flight: the form returns with a cancelled error, and this hook ignores the request's late result. core may still finish a sign-in that completes later. */
28
31
  cancelPasskey: () => void;
@@ -1,4 +1,4 @@
1
- import type { PassflowPasskeyAuthenticateStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignInPayload } from '@passflow/core';
1
+ import type { PassflowAuthOptions, PassflowPasskeyAuthenticateStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignInPayload } from '@passflow/core';
2
2
  import type { AuthOperation, AuthUiError } from '../types/index.js';
3
3
  import { type UseEmailCodeStep } from './use-email-code-step.js';
4
4
  /**
@@ -17,12 +17,15 @@ export type UseSignInOptions = {
17
17
  export type UseSignInProps = (options?: UseSignInOptions) => {
18
18
  /**
19
19
  * Resolves a {@link SignInOutcome} for a password or passkey sign-in, the server's answer for a passwordless one,
20
- * and `false` when the request failed, was superseded, or entered the emailed-code step.
20
+ * and `false` when the request failed, was superseded, or entered the emailed-code step. `options` is passed to
21
+ * core as the request's last argument.
21
22
  */
22
- fetch: (payload: PassflowPasskeyAuthenticateStartPayload | PassflowSignInPayload | PassflowPasswordlessSignInPayload, type: AuthOperation) => Promise<false | SignInOutcome | PassflowPasswordlessResponse>;
23
+ fetch: (payload: PassflowPasskeyAuthenticateStartPayload | PassflowSignInPayload | PassflowPasswordlessSignInPayload, type: AuthOperation, options?: PassflowAuthOptions) => Promise<false | SignInOutcome | PassflowPasswordlessResponse>;
23
24
  isLoading: boolean;
24
25
  isError: boolean;
25
26
  error: AuthUiError | null;
27
+ /** The error the latest fetch set; null after a success, a reset or a cancel. Synchronous, unlike `error`. */
28
+ readError: () => AuthUiError | null;
26
29
  reset: () => void;
27
30
  /** Abandons the passkey request in flight: the form returns with a cancelled error, and this hook ignores the request's late result. core may still finish a sign-in that completes later. */
28
31
  cancelPasskey: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"use-signin.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-signin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uCAAuC,EACvC,4BAA4B,EAC5B,iCAAiC,EACjC,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAS1D,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAGhF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,qBAAqB,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,EAAE,gBAAgB,KAAK;IAC3D;;;OAGG;IACH,KAAK,EAAE,CACL,OAAO,EAAE,uCAAuC,GAAG,qBAAqB,GAAG,iCAAiC,EAC5G,IAAI,EAAE,aAAa,KAChB,OAAO,CAAC,KAAK,GAAG,aAAa,GAAG,4BAA4B,CAAC,CAAC;IACnE,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE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IAC9G,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACpC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,8LAA8L;IAC9L,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,0EAA0E;IAC1E,gBAAgB,EAAE,aAAa,GAAG,IAAI,CAAC;IACvC;;;OAGG;IACH,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAiHvB,CAAC"}
@@ -1,16 +1,19 @@
1
- import type { PassflowPasskeyRegisterStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignUpPayload } from '@passflow/core';
1
+ import type { PassflowAuthOptions, PassflowPasskeyRegisterStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignUpPayload } from '@passflow/core';
2
2
  import type { AuthOperation, AuthUiError } from '../types/index.cjs';
3
3
  import { type UseEmailCodeStep } from './use-email-code-step.cjs';
4
4
  import type { SignInOutcome } from './use-signin.cjs';
5
5
  export type UseSignUpProps = () => {
6
6
  /**
7
7
  * Resolves a {@link SignInOutcome} for a password or passkey sign-up, the server's answer for a passwordless one,
8
- * and `false` when the request failed or entered the emailed-code step.
8
+ * and `false` when the request failed or entered the emailed-code step. `options` is passed to core as the
9
+ * request's last argument.
9
10
  */
10
- fetch: (payload: PassflowPasskeyRegisterStartPayload | PassflowSignUpPayload | PassflowPasswordlessSignInPayload, type: AuthOperation) => Promise<false | SignInOutcome | PassflowPasswordlessResponse>;
11
+ fetch: (payload: PassflowPasskeyRegisterStartPayload | PassflowSignUpPayload | PassflowPasswordlessSignInPayload, type: AuthOperation, options?: PassflowAuthOptions) => Promise<false | SignInOutcome | PassflowPasswordlessResponse>;
11
12
  isLoading: boolean;
12
13
  isError: boolean;
13
14
  error: AuthUiError | null;
15
+ /** The error the latest fetch set; null after a success or a reset. Synchronous, unlike `error`. */
16
+ readError: () => AuthUiError | null;
14
17
  reset: () => void;
15
18
  /**
16
19
  * The emailed-code step. A password request the server answers with a code (or a link) enters it, and `fetch`
@@ -1,16 +1,19 @@
1
- import type { PassflowPasskeyRegisterStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignUpPayload } from '@passflow/core';
1
+ import type { PassflowAuthOptions, PassflowPasskeyRegisterStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInPayload, PassflowSignUpPayload } from '@passflow/core';
2
2
  import type { AuthOperation, AuthUiError } from '../types/index.js';
3
3
  import { type UseEmailCodeStep } from './use-email-code-step.js';
4
4
  import type { SignInOutcome } from './use-signin.js';
5
5
  export type UseSignUpProps = () => {
6
6
  /**
7
7
  * Resolves a {@link SignInOutcome} for a password or passkey sign-up, the server's answer for a passwordless one,
8
- * and `false` when the request failed or entered the emailed-code step.
8
+ * and `false` when the request failed or entered the emailed-code step. `options` is passed to core as the
9
+ * request's last argument.
9
10
  */
10
- fetch: (payload: PassflowPasskeyRegisterStartPayload | PassflowSignUpPayload | PassflowPasswordlessSignInPayload, type: AuthOperation) => Promise<false | SignInOutcome | PassflowPasswordlessResponse>;
11
+ fetch: (payload: PassflowPasskeyRegisterStartPayload | PassflowSignUpPayload | PassflowPasswordlessSignInPayload, type: AuthOperation, options?: PassflowAuthOptions) => Promise<false | SignInOutcome | PassflowPasswordlessResponse>;
11
12
  isLoading: boolean;
12
13
  isError: boolean;
13
14
  error: AuthUiError | null;
15
+ /** The error the latest fetch set; null after a success or a reset. Synchronous, unlike `error`. */
16
+ readError: () => AuthUiError | null;
14
17
  reset: () => void;
15
18
  /**
16
19
  * The emailed-code step. A password request the server answers with a code (or a link) enters it, and `fetch`
@@ -1 +1 @@
1
- {"version":3,"file":"use-signup.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-signup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mCAAmC,EACnC,4BAA4B,EAC5B,iCAAiC,EACjC,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,K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,CAAC,CAAC;IACnE,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,oGAAoG;IACpG,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACpC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;OAGG;IACH,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,cAuFvB,CAAC"}
@@ -0,0 +1,96 @@
1
+ import type { InternalStrategyChallenge, PassflowAuthOptions, PassflowPasswordlessResponse, PassflowPasswordPolicySettings, Providers } from '@passflow/core';
2
+ import type { LoginCredentialsValues } from '../components/ui/login-screen/types.cjs';
3
+ import type { SignInOutcome } from '../hooks/use-signin.cjs';
4
+ import type { AuthUiError } from '../types/index.cjs';
5
+ import type { AuthMethods } from './get-auth-methods.cjs';
6
+ import type { ModelContextTool } from './model-context.cjs';
7
+ /** The form that registers the tools: it decides between `sign_in_password` and `sign_up_password`. */
8
+ export type AuthAgentFlow = 'sign-in' | 'sign-up';
9
+ export type AgentIdentityKind = 'email' | 'username' | 'phone';
10
+ export type AgentIdentity = {
11
+ kind: AgentIdentityKind;
12
+ value: string;
13
+ };
14
+ export type AgentToolAnswer = {
15
+ text: string;
16
+ isError?: boolean;
17
+ };
18
+ /** What the form does for each tool. A tool's request carries `{ agentTool: true }`; the form adds it. */
19
+ export type AuthAgentToolActions = {
20
+ password?: (input: {
21
+ identity: AgentIdentity;
22
+ password: string;
23
+ }) => Promise<AgentToolAnswer>;
24
+ startPasswordless?: (input: {
25
+ identity: AgentIdentity;
26
+ }) => Promise<AgentToolAnswer>;
27
+ completePasswordless?: (input: {
28
+ challengeId: string;
29
+ code: string;
30
+ }) => Promise<AgentToolAnswer>;
31
+ startSocial?: (input: {
32
+ provider: Providers;
33
+ }) => Promise<AgentToolAnswer>;
34
+ };
35
+ export type AuthAgentStatus = {
36
+ signedIn: boolean;
37
+ secondFactorPending: boolean;
38
+ };
39
+ export type AuthMethodsDescription = {
40
+ flow: AuthAgentFlow;
41
+ password: AgentIdentityKind[];
42
+ passwordless: {
43
+ identity: 'email' | 'phone';
44
+ challenge: InternalStrategyChallenge;
45
+ }[];
46
+ /** True means: ask the user to click the passkey button. */
47
+ passkey: boolean;
48
+ social: string[];
49
+ };
50
+ export declare const AGENT_TOOL_TEXT: {
51
+ readonly signedIn: 'Signed in. The page is finishing the sign-in.';
52
+ readonly secondFactor: 'The sign-in needs a second factor. Ask the user to finish it on the page.';
53
+ readonly oneMoreStep: 'The sign-in needs one more step on the page. Ask the user to look at the page.';
54
+ readonly codeSent: (identifier: string, challengeId: string) => string;
55
+ readonly linkSent: (identifier: string) => string;
56
+ readonly social: (provider: string) => string;
57
+ readonly passkey: 'Ask the user to click the passkey button on the page. A passkey sign-in cannot be started by an agent.';
58
+ readonly statusSignedIn: 'Signed in.';
59
+ readonly statusSignedOut: 'Not signed in.';
60
+ readonly statusSecondFactor: 'A second factor is pending. The user must finish it on the page.';
61
+ readonly failed: 'Something went wrong. Try again.';
62
+ readonly argumentsNotObject: 'Arguments must be an object.';
63
+ readonly required: (name: string) => string;
64
+ readonly identityNotEnabled: (kind: AgentIdentityKind) => string;
65
+ readonly providerNotEnabled: (provider: string) => string;
66
+ readonly passwordRules: (needs: string) => string;
67
+ };
68
+ /** The methods the app has enabled, as `list_auth_methods` reports them. */
69
+ export declare const describeAuthMethods: (authMethods: AuthMethods, flow: AuthAgentFlow) => AuthMethodsDescription;
70
+ /** Marks the requests an agent tool causes. A human's requests carry no options. */
71
+ export declare const AGENT_TOOL_OPTIONS: PassflowAuthOptions;
72
+ /** The values the credentials screen hands over for the same identifier, so both paths build the same payload. */
73
+ export declare const credentialsFromIdentity: (identity: AgentIdentity, password?: string) => LoginCredentialsValues;
74
+ /** An email when it looks like one, a phone number when it starts with `+` and is valid, else a username. */
75
+ export declare const classifyIdentifier: (value: string) => AgentIdentity;
76
+ /** The answer to a password sign-in or sign-up, or to a completed passwordless code. */
77
+ export declare const signInAnswer: (outcome: false | SignInOutcome | PassflowPasswordlessResponse, error: AuthUiError | null) => AgentToolAnswer;
78
+ /** The answer to a passwordless start. The match code is never put in it. */
79
+ export declare const passwordlessStartAnswer: (identifier: string, start: {
80
+ challengeType?: InternalStrategyChallenge;
81
+ response: false | SignInOutcome | PassflowPasswordlessResponse;
82
+ }, error: AuthUiError | null) => AgentToolAnswer;
83
+ export declare const authStatusAnswer: (status: AuthAgentStatus) => AgentToolAnswer;
84
+ /** The same password check the sign-up screen runs. `null` when the password passes. */
85
+ export declare const passwordPolicyAnswer: (policy: PassflowPasswordPolicySettings | null, password: string) => AgentToolAnswer | null;
86
+ /**
87
+ * The WebMCP tools of a sign-in or sign-up form, for the methods the app has enabled only. `actions` is read at call
88
+ * time, so a tool always runs the form's latest handlers.
89
+ */
90
+ export declare const buildAuthAgentTools: ({ flow, authMethods, getStatus, actions, }: {
91
+ flow: AuthAgentFlow;
92
+ authMethods: AuthMethods;
93
+ getStatus: () => AuthAgentStatus;
94
+ actions: () => AuthAgentToolActions;
95
+ }) => ModelContextTool[];
96
+ //# sourceMappingURL=agent-tools.d.ts.map
@@ -0,0 +1,96 @@
1
+ import type { InternalStrategyChallenge, PassflowAuthOptions, PassflowPasswordlessResponse, PassflowPasswordPolicySettings, Providers } from '@passflow/core';
2
+ import type { LoginCredentialsValues } from '../components/ui/login-screen/types.js';
3
+ import type { SignInOutcome } from '../hooks/use-signin.js';
4
+ import type { AuthUiError } from '../types/index.js';
5
+ import type { AuthMethods } from './get-auth-methods.js';
6
+ import type { ModelContextTool } from './model-context.js';
7
+ /** The form that registers the tools: it decides between `sign_in_password` and `sign_up_password`. */
8
+ export type AuthAgentFlow = 'sign-in' | 'sign-up';
9
+ export type AgentIdentityKind = 'email' | 'username' | 'phone';
10
+ export type AgentIdentity = {
11
+ kind: AgentIdentityKind;
12
+ value: string;
13
+ };
14
+ export type AgentToolAnswer = {
15
+ text: string;
16
+ isError?: boolean;
17
+ };
18
+ /** What the form does for each tool. A tool's request carries `{ agentTool: true }`; the form adds it. */
19
+ export type AuthAgentToolActions = {
20
+ password?: (input: {
21
+ identity: AgentIdentity;
22
+ password: string;
23
+ }) => Promise<AgentToolAnswer>;
24
+ startPasswordless?: (input: {
25
+ identity: AgentIdentity;
26
+ }) => Promise<AgentToolAnswer>;
27
+ completePasswordless?: (input: {
28
+ challengeId: string;
29
+ code: string;
30
+ }) => Promise<AgentToolAnswer>;
31
+ startSocial?: (input: {
32
+ provider: Providers;
33
+ }) => Promise<AgentToolAnswer>;
34
+ };
35
+ export type AuthAgentStatus = {
36
+ signedIn: boolean;
37
+ secondFactorPending: boolean;
38
+ };
39
+ export type AuthMethodsDescription = {
40
+ flow: AuthAgentFlow;
41
+ password: AgentIdentityKind[];
42
+ passwordless: {
43
+ identity: 'email' | 'phone';
44
+ challenge: InternalStrategyChallenge;
45
+ }[];
46
+ /** True means: ask the user to click the passkey button. */
47
+ passkey: boolean;
48
+ social: string[];
49
+ };
50
+ export declare const AGENT_TOOL_TEXT: {
51
+ readonly signedIn: 'Signed in. The page is finishing the sign-in.';
52
+ readonly secondFactor: 'The sign-in needs a second factor. Ask the user to finish it on the page.';
53
+ readonly oneMoreStep: 'The sign-in needs one more step on the page. Ask the user to look at the page.';
54
+ readonly codeSent: (identifier: string, challengeId: string) => string;
55
+ readonly linkSent: (identifier: string) => string;
56
+ readonly social: (provider: string) => string;
57
+ readonly passkey: 'Ask the user to click the passkey button on the page. A passkey sign-in cannot be started by an agent.';
58
+ readonly statusSignedIn: 'Signed in.';
59
+ readonly statusSignedOut: 'Not signed in.';
60
+ readonly statusSecondFactor: 'A second factor is pending. The user must finish it on the page.';
61
+ readonly failed: 'Something went wrong. Try again.';
62
+ readonly argumentsNotObject: 'Arguments must be an object.';
63
+ readonly required: (name: string) => string;
64
+ readonly identityNotEnabled: (kind: AgentIdentityKind) => string;
65
+ readonly providerNotEnabled: (provider: string) => string;
66
+ readonly passwordRules: (needs: string) => string;
67
+ };
68
+ /** The methods the app has enabled, as `list_auth_methods` reports them. */
69
+ export declare const describeAuthMethods: (authMethods: AuthMethods, flow: AuthAgentFlow) => AuthMethodsDescription;
70
+ /** Marks the requests an agent tool causes. A human's requests carry no options. */
71
+ export declare const AGENT_TOOL_OPTIONS: PassflowAuthOptions;
72
+ /** The values the credentials screen hands over for the same identifier, so both paths build the same payload. */
73
+ export declare const credentialsFromIdentity: (identity: AgentIdentity, password?: string) => LoginCredentialsValues;
74
+ /** An email when it looks like one, a phone number when it starts with `+` and is valid, else a username. */
75
+ export declare const classifyIdentifier: (value: string) => AgentIdentity;
76
+ /** The answer to a password sign-in or sign-up, or to a completed passwordless code. */
77
+ export declare const signInAnswer: (outcome: false | SignInOutcome | PassflowPasswordlessResponse, error: AuthUiError | null) => AgentToolAnswer;
78
+ /** The answer to a passwordless start. The match code is never put in it. */
79
+ export declare const passwordlessStartAnswer: (identifier: string, start: {
80
+ challengeType?: InternalStrategyChallenge;
81
+ response: false | SignInOutcome | PassflowPasswordlessResponse;
82
+ }, error: AuthUiError | null) => AgentToolAnswer;
83
+ export declare const authStatusAnswer: (status: AuthAgentStatus) => AgentToolAnswer;
84
+ /** The same password check the sign-up screen runs. `null` when the password passes. */
85
+ export declare const passwordPolicyAnswer: (policy: PassflowPasswordPolicySettings | null, password: string) => AgentToolAnswer | null;
86
+ /**
87
+ * The WebMCP tools of a sign-in or sign-up form, for the methods the app has enabled only. `actions` is read at call
88
+ * time, so a tool always runs the form's latest handlers.
89
+ */
90
+ export declare const buildAuthAgentTools: ({ flow, authMethods, getStatus, actions, }: {
91
+ flow: AuthAgentFlow;
92
+ authMethods: AuthMethods;
93
+ getStatus: () => AuthAgentStatus;
94
+ actions: () => AuthAgentToolActions;
95
+ }) => ModelContextTool[];
96
+ //# sourceMappingURL=agent-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-tools.d.ts","sourceRoot":"","sources":["../../../src/utils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c,aAAa,wBAAkB,sBAGU,CAAC;AAE5F,6GAA6G;AAC7G,eAAO,MAAM,kBAAkB,UAAW,MAAM,KAAG,aAKlD,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,YAAY,YACd,KAAK,GAAG,aAAa,GAAG,4BAA4B,SACtD,WAAW,GAAG,IAAI,KACxB,eAMF,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,eACtB,MAAM,SACX;IAAE,aAAa,CAAC,EAAE,yBAAyB,CAAC;IAAC,QAAQ,EAAE,KAAK,GAAG,aAAa,GAAG,4BAA4B,CAAA;CAAE,SAC7G,WAAW,GAAG,IAAI,KACxB,eAOF,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,eAAe,KAAG,eAG1D,CAAC;AAmBF,wFAAwF;AACxF,eAAO,MAAM,oBAAoB,WACvB,8BAA8B,GAAG,IAAI,YACnC,MAAM,KACf,eAAe,GAAG,IASpB,CAAC;AAkFF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,+CAK7B;IACD,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,eAAe,CAAC;IACjC,OAAO,EAAE,MAAM,oBAAoB,CAAC;CACrC,KAAG,gBAAgB,EA8GnB,CAAC"}
@@ -23,7 +23,16 @@ export declare const SERVER_MESSAGE_ERROR_IDS: ReadonlySet<string>;
23
23
  * body) carries core's service-unavailable id and always gets core's fixed message.
24
24
  */
25
25
  export declare const serverMessageFor: (error: unknown) => string | null;
26
- /** A hook's display error: a refused parent's copy, the server's message for an allow-listed id, else the operation's fixed copy. */
26
+ /** Shown for every failed anti-bot check, whichever side refused it. */
27
+ export declare const antiBotErrorMessage = "We could not confirm you are human. Try again.";
28
+ /** The ids of a failed anti-bot check: the server's refusals and core's own provider and solve failures. */
29
+ export declare const ANTI_BOT_ERROR_IDS: ReadonlySet<string>;
30
+ /**
31
+ * {@link antiBotErrorMessage} when the error is a failed anti-bot check, else `null`. An unavailable check means the
32
+ * server or the vendor is down, not that the user failed it, so it gets core's service-unavailable copy.
33
+ */
34
+ export declare const antiBotErrorMessageFrom: (error: unknown) => string | null;
35
+ /** A hook's display error: the anti-bot message, a refused parent's copy, the server's message for an allow-listed id, else the operation's fixed copy. */
27
36
  export declare const authErrorFrom: (error: unknown, flow: AuthFlow, operation: AuthOperation) => AuthUiError;
28
37
  /**
29
38
  * The message for a federated redirect that came back as `?error=<id>&message=<text>`: the server's text when the id
@@ -37,7 +46,7 @@ export declare const emailCodeInvalidMessage = "This code is no longer valid. Re
37
46
  export declare const emailCodeUnavailableMessage = "We couldn't check the code. Try again.";
38
47
  export declare const emailCodeRestartMessage = "We couldn't verify the code. Go back and start again.";
39
48
  /**
40
- * Error copy for the emailed-code step (`/auth/validate`, resend): allow-listed ids (wrong, expired or spent code,
49
+ * Error copy for the emailed-code step (`/auth/validate`, resend): a failed anti-bot check has its one message; allow-listed ids (wrong, expired or spent code,
41
50
  * rate limit, ...) show the server message; Passflow being unavailable shows core's message; `error.not.found`
42
51
  * (unknown or spent challenge) asks for a new code; a raw axios failure with no response (offline, CORS, timeout)
43
52
  * asks to retry; every other server answer (401, a missing PKCE verifier, an unlisted 4xx or a 5xx) asks to start
@@ -23,7 +23,16 @@ export declare const SERVER_MESSAGE_ERROR_IDS: ReadonlySet<string>;
23
23
  * body) carries core's service-unavailable id and always gets core's fixed message.
24
24
  */
25
25
  export declare const serverMessageFor: (error: unknown) => string | null;
26
- /** A hook's display error: a refused parent's copy, the server's message for an allow-listed id, else the operation's fixed copy. */
26
+ /** Shown for every failed anti-bot check, whichever side refused it. */
27
+ export declare const antiBotErrorMessage = "We could not confirm you are human. Try again.";
28
+ /** The ids of a failed anti-bot check: the server's refusals and core's own provider and solve failures. */
29
+ export declare const ANTI_BOT_ERROR_IDS: ReadonlySet<string>;
30
+ /**
31
+ * {@link antiBotErrorMessage} when the error is a failed anti-bot check, else `null`. An unavailable check means the
32
+ * server or the vendor is down, not that the user failed it, so it gets core's service-unavailable copy.
33
+ */
34
+ export declare const antiBotErrorMessageFrom: (error: unknown) => string | null;
35
+ /** A hook's display error: the anti-bot message, a refused parent's copy, the server's message for an allow-listed id, else the operation's fixed copy. */
27
36
  export declare const authErrorFrom: (error: unknown, flow: AuthFlow, operation: AuthOperation) => AuthUiError;
28
37
  /**
29
38
  * The message for a federated redirect that came back as `?error=<id>&message=<text>`: the server's text when the id
@@ -37,7 +46,7 @@ export declare const emailCodeInvalidMessage = "This code is no longer valid. Re
37
46
  export declare const emailCodeUnavailableMessage = "We couldn't check the code. Try again.";
38
47
  export declare const emailCodeRestartMessage = "We couldn't verify the code. Go back and start again.";
39
48
  /**
40
- * Error copy for the emailed-code step (`/auth/validate`, resend): allow-listed ids (wrong, expired or spent code,
49
+ * Error copy for the emailed-code step (`/auth/validate`, resend): a failed anti-bot check has its one message; allow-listed ids (wrong, expired or spent code,
41
50
  * rate limit, ...) show the server message; Passflow being unavailable shows core's message; `error.not.found`
42
51
  * (unknown or spent challenge) asks for a new code; a raw axios failure with no response (offline, CORS, timeout)
43
52
  * asks to retry; every other server answer (401, a missing PKCE verifier, an unlisted 4xx or a 5xx) asks to start
@@ -1 +1 @@
1
- {"version":3,"file":"auth-error.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiCpE,eAAO,MAAM,wBAAwB,uFAAuF,CAAC;AAE7H,eAAO,MAAM,4BAA4B,+FACqD,CAAC;AAE/F,eAAO,MAAM,0BAA0B,oDAAoD,CAAC;AAE5F,eAAO,MAAM,+BAA+B,iGACoD,CAAC;AAEjG,4GAA4G;AAC5G,eAAO,MAAM,6BAA6B,uCAAuC,CAAC;AAElF,0FAA0F;AAC1F,eAAO,MAAM,4BAA4B,6BAA6B,CAAC;AAEvE,sGAAsG;AACtG,eAAO,MAAM,6BAA6B,2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,MAAM,qBAAqB,UAAW,OAAO,KAAG,iBAetD,CAAC"}
@@ -1,4 +1,4 @@
1
- export { type ApprovalError, approvalAlreadyDecidedMessage, approvalApprovedMessage, approvalAttemptsMessage, approvalConnectionMessage, approvalDeniedMessage, approvalErrorFrom, approvalInvalidMessage, approvalUnavailableMessage, approvalUnknownErrorMessage, authErrorFor, authErrorFrom, authRedirectErrorFrom, authRedirectErrorMessage, emailCodeErrorMessage, invitationJoinErrorFrom, invitationLinkErrorMessage, isApprovalMatchError, isPasswordSavedRateLimit, newPasswordErrorMessage, passwordChangeRequiredErrorId, passwordChangeRequiredMessage, passwordChangeRequiredReason, passwordlessCompleteErrorMessage, passwordlessLinkExpiredMessage, passwordlessSignInFailedMessage, passwordlessWaitCompletedMessage, passwordlessWaitDeniedMessage, serverErrorIdFrom, serverMessageFor, twoFactorBackToSignInLabel, twoFactorLinkAlreadyUsedMessage, twoFactorRateLimitedMessage, twoFactorSignInLabel, twoFactorWrongRecoveryCodeMessage, verificationLinkErrorMessage, verificationRequestErrorMessage, } from './auth-error.cjs';
1
+ export { ANTI_BOT_ERROR_IDS, type ApprovalError, antiBotErrorMessage, antiBotErrorMessageFrom, approvalAlreadyDecidedMessage, approvalApprovedMessage, approvalAttemptsMessage, approvalConnectionMessage, approvalDeniedMessage, approvalErrorFrom, approvalInvalidMessage, approvalUnavailableMessage, approvalUnknownErrorMessage, authErrorFor, authErrorFrom, authRedirectErrorFrom, authRedirectErrorMessage, emailCodeErrorMessage, invitationJoinErrorFrom, invitationLinkErrorMessage, isApprovalMatchError, isPasswordSavedRateLimit, newPasswordErrorMessage, passwordChangeRequiredErrorId, passwordChangeRequiredMessage, passwordChangeRequiredReason, passwordlessCompleteErrorMessage, passwordlessLinkExpiredMessage, passwordlessSignInFailedMessage, passwordlessWaitCompletedMessage, passwordlessWaitDeniedMessage, serverErrorIdFrom, serverMessageFor, twoFactorBackToSignInLabel, twoFactorLinkAlreadyUsedMessage, twoFactorRateLimitedMessage, twoFactorSignInLabel, twoFactorWrongRecoveryCodeMessage, verificationLinkErrorMessage, verificationRequestErrorMessage, } from './auth-error.cjs';
2
2
  export { classifyDeviceError, DeviceApiError, deviceErrorOfType } from './classify-device-error.cjs';
3
3
  export { classifyTwoFactorError, getUserFriendlyErrorMessage, isTerminalTwoFactorError } from './classify-two-factor-error.cjs';
4
4
  export { cn } from './cn.cjs';
@@ -1,4 +1,4 @@
1
- export { type ApprovalError, approvalAlreadyDecidedMessage, approvalApprovedMessage, approvalAttemptsMessage, approvalConnectionMessage, approvalDeniedMessage, approvalErrorFrom, approvalInvalidMessage, approvalUnavailableMessage, approvalUnknownErrorMessage, authErrorFor, authErrorFrom, authRedirectErrorFrom, authRedirectErrorMessage, emailCodeErrorMessage, invitationJoinErrorFrom, invitationLinkErrorMessage, isApprovalMatchError, isPasswordSavedRateLimit, newPasswordErrorMessage, passwordChangeRequiredErrorId, passwordChangeRequiredMessage, passwordChangeRequiredReason, passwordlessCompleteErrorMessage, passwordlessLinkExpiredMessage, passwordlessSignInFailedMessage, passwordlessWaitCompletedMessage, passwordlessWaitDeniedMessage, serverErrorIdFrom, serverMessageFor, twoFactorBackToSignInLabel, twoFactorLinkAlreadyUsedMessage, twoFactorRateLimitedMessage, twoFactorSignInLabel, twoFactorWrongRecoveryCodeMessage, verificationLinkErrorMessage, verificationRequestErrorMessage, } from './auth-error.js';
1
+ export { ANTI_BOT_ERROR_IDS, type ApprovalError, antiBotErrorMessage, antiBotErrorMessageFrom, approvalAlreadyDecidedMessage, approvalApprovedMessage, approvalAttemptsMessage, approvalConnectionMessage, approvalDeniedMessage, approvalErrorFrom, approvalInvalidMessage, approvalUnavailableMessage, approvalUnknownErrorMessage, authErrorFor, authErrorFrom, authRedirectErrorFrom, authRedirectErrorMessage, emailCodeErrorMessage, invitationJoinErrorFrom, invitationLinkErrorMessage, isApprovalMatchError, isPasswordSavedRateLimit, newPasswordErrorMessage, passwordChangeRequiredErrorId, passwordChangeRequiredMessage, passwordChangeRequiredReason, passwordlessCompleteErrorMessage, passwordlessLinkExpiredMessage, passwordlessSignInFailedMessage, passwordlessWaitCompletedMessage, passwordlessWaitDeniedMessage, serverErrorIdFrom, serverMessageFor, twoFactorBackToSignInLabel, twoFactorLinkAlreadyUsedMessage, twoFactorRateLimitedMessage, twoFactorSignInLabel, twoFactorWrongRecoveryCodeMessage, verificationLinkErrorMessage, verificationRequestErrorMessage, } from './auth-error.js';
2
2
  export { classifyDeviceError, DeviceApiError, deviceErrorOfType } from './classify-device-error.js';
3
3
  export { classifyTwoFactorError, getUserFriendlyErrorMessage, isTerminalTwoFactorError } from './classify-two-factor-error.js';
4
4
  export { cn } from './cn.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,6BAA6B,EAC7B,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,gCAAgC,EAChC,8BAA8B,EAC9B,+BAA+B,EAC/B,gCAAgC,EAChC,6BAA6B,EAC7B,iBAAiB,EACjB,gBAAgB,EAChB,0BAA0B,EAC1B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EACpB,iCAAiC,EACjC,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,6B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OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,UAAU,EACV,2BAA2B,EAC3B,0BAA0B,EAC1B,mBAAmB,EACnB,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The page's WebMCP surface: the browser API an in-browser agent uses to call tools a page registers.
3
+ * The API is still a browser draft, so its shape is typed here rather than taken from a DOM lib.
4
+ */
5
+ export type ModelContextToolResult = {
6
+ content: {
7
+ type: 'text';
8
+ text: string;
9
+ }[];
10
+ isError?: boolean;
11
+ };
12
+ export type ModelContextTool = {
13
+ name: string;
14
+ description: string;
15
+ inputSchema: {
16
+ type: 'object';
17
+ properties: Record<string, unknown>;
18
+ required?: string[];
19
+ additionalProperties?: boolean;
20
+ };
21
+ annotations: {
22
+ readOnlyHint: boolean;
23
+ };
24
+ /** The browser does not check `inputSchema`, so `args` may be anything. */
25
+ execute: (args: unknown) => Promise<ModelContextToolResult>;
26
+ };
27
+ export type ModelContext = {
28
+ /** Aborting `signal` removes the tool again. */
29
+ registerTool: (tool: ModelContextTool, options?: {
30
+ signal?: AbortSignal;
31
+ }) => Promise<undefined> | void;
32
+ };
33
+ /**
34
+ * `document.modelContext`, then `navigator.modelContext`. `undefined` when neither has a `registerTool` function, and
35
+ * outside a browser.
36
+ */
37
+ export declare const findModelContext: () => ModelContext | undefined;
38
+ //# sourceMappingURL=model-context.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The page's WebMCP surface: the browser API an in-browser agent uses to call tools a page registers.
3
+ * The API is still a browser draft, so its shape is typed here rather than taken from a DOM lib.
4
+ */
5
+ export type ModelContextToolResult = {
6
+ content: {
7
+ type: 'text';
8
+ text: string;
9
+ }[];
10
+ isError?: boolean;
11
+ };
12
+ export type ModelContextTool = {
13
+ name: string;
14
+ description: string;
15
+ inputSchema: {
16
+ type: 'object';
17
+ properties: Record<string, unknown>;
18
+ required?: string[];
19
+ additionalProperties?: boolean;
20
+ };
21
+ annotations: {
22
+ readOnlyHint: boolean;
23
+ };
24
+ /** The browser does not check `inputSchema`, so `args` may be anything. */
25
+ execute: (args: unknown) => Promise<ModelContextToolResult>;
26
+ };
27
+ export type ModelContext = {
28
+ /** Aborting `signal` removes the tool again. */
29
+ registerTool: (tool: ModelContextTool, options?: {
30
+ signal?: AbortSignal;
31
+ }) => Promise<undefined> | void;
32
+ };
33
+ /**
34
+ * `document.modelContext`, then `navigator.modelContext`. `undefined` when neither has a `registerTool` function, and
35
+ * outside a browser.
36
+ */
37
+ export declare const findModelContext: () => ModelContext | undefined;
38
+ //# sourceMappingURL=model-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-context.d.ts","sourceRoot":"","sources":["../../../src/utils/model-context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;KAChC,CAAC;IACF,WAAW,EAAE;QAAE,YAAY,EAAE,OAAO,CAAA;KAAE,CAAC;IACvC,2EAA2E;IAC3E,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,gDAAgD;IAChD,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;CACzG,CAAC;AASF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,YAAY,GAAG,SAKlD,CAAC"}