@fuzdev/fuz_app 0.161.0 → 0.163.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 (151) hide show
  1. package/dist/auth/CLAUDE.md +47 -36
  2. package/dist/auth/account_action_specs.d.ts +614 -150
  3. package/dist/auth/account_action_specs.d.ts.map +1 -1
  4. package/dist/auth/account_action_specs.js +56 -52
  5. package/dist/auth/account_route_schema.d.ts +401 -94
  6. package/dist/auth/account_route_schema.d.ts.map +1 -1
  7. package/dist/auth/account_route_schema.js +54 -39
  8. package/dist/auth/account_routes.js +1 -1
  9. package/dist/auth/account_schema.d.ts +531 -118
  10. package/dist/auth/account_schema.d.ts.map +1 -1
  11. package/dist/auth/account_schema.js +76 -58
  12. package/dist/auth/admin_action_specs.d.ts +1753 -240
  13. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  14. package/dist/auth/admin_action_specs.js +28 -26
  15. package/dist/auth/admin_actions.d.ts +4 -4
  16. package/dist/auth/admin_actions.d.ts.map +1 -1
  17. package/dist/auth/admin_actions.js +3 -3
  18. package/dist/auth/all_cell_actions.d.ts +3 -3
  19. package/dist/auth/all_cell_actions.d.ts.map +1 -1
  20. package/dist/auth/all_cell_actions.js +1 -1
  21. package/dist/auth/api_token.d.ts +4 -4
  22. package/dist/auth/api_token.d.ts.map +1 -1
  23. package/dist/auth/api_token.js +3 -3
  24. package/dist/auth/audit_emitter.d.ts +8 -3
  25. package/dist/auth/audit_emitter.d.ts.map +1 -1
  26. package/dist/auth/audit_emitter.js +32 -9
  27. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  28. package/dist/auth/audit_log_queries.js +4 -3
  29. package/dist/auth/audit_log_schema.d.ts +798 -291
  30. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  31. package/dist/auth/audit_log_schema.js +192 -201
  32. package/dist/auth/bootstrap_route_schema.d.ts +173 -50
  33. package/dist/auth/bootstrap_route_schema.d.ts.map +1 -1
  34. package/dist/auth/bootstrap_route_schema.js +35 -16
  35. package/dist/auth/cell_grant_action_specs.d.ts +1 -1
  36. package/dist/auth/cell_grant_action_specs.js +1 -1
  37. package/dist/auth/cell_grant_actions.d.ts +4 -4
  38. package/dist/auth/cell_grant_actions.d.ts.map +1 -1
  39. package/dist/auth/cell_grant_actions.js +1 -1
  40. package/dist/auth/credential_type_schema.d.ts +16 -29
  41. package/dist/auth/credential_type_schema.d.ts.map +1 -1
  42. package/dist/auth/credential_type_schema.js +14 -18
  43. package/dist/auth/grant_path_schema.d.ts +15 -29
  44. package/dist/auth/grant_path_schema.d.ts.map +1 -1
  45. package/dist/auth/grant_path_schema.js +13 -17
  46. package/dist/auth/invite_schema.d.ts +98 -26
  47. package/dist/auth/invite_schema.d.ts.map +1 -1
  48. package/dist/auth/invite_schema.js +21 -14
  49. package/dist/auth/migrations.d.ts.map +1 -1
  50. package/dist/auth/migrations.js +28 -1
  51. package/dist/auth/name_schema.d.ts +7 -6
  52. package/dist/auth/name_schema.d.ts.map +1 -1
  53. package/dist/auth/name_schema.js +8 -9
  54. package/dist/auth/password.d.ts +15 -7
  55. package/dist/auth/password.d.ts.map +1 -1
  56. package/dist/auth/password.js +16 -9
  57. package/dist/auth/role_grant_offer_action_specs.d.ts +72 -72
  58. package/dist/auth/role_grant_offer_action_specs.js +2 -2
  59. package/dist/auth/role_grant_offer_actions.d.ts +4 -4
  60. package/dist/auth/role_grant_offer_actions.d.ts.map +1 -1
  61. package/dist/auth/role_grant_offer_actions.js +3 -3
  62. package/dist/auth/role_grant_offer_notifications.d.ts +60 -60
  63. package/dist/auth/role_grant_offer_notifications.js +2 -2
  64. package/dist/auth/role_grant_offer_schema.d.ts +8 -8
  65. package/dist/auth/role_grant_offer_schema.d.ts.map +1 -1
  66. package/dist/auth/role_grant_offer_schema.js +10 -10
  67. package/dist/auth/role_schema.d.ts +47 -55
  68. package/dist/auth/role_schema.d.ts.map +1 -1
  69. package/dist/auth/role_schema.js +29 -35
  70. package/dist/auth/scope_kind_schema.d.ts +22 -26
  71. package/dist/auth/scope_kind_schema.d.ts.map +1 -1
  72. package/dist/auth/scope_kind_schema.js +19 -19
  73. package/dist/auth/self_service_role_action_specs.js +1 -1
  74. package/dist/auth/self_service_role_actions.d.ts +6 -6
  75. package/dist/auth/self_service_role_actions.d.ts.map +1 -1
  76. package/dist/auth/self_service_role_actions.js +7 -6
  77. package/dist/auth/signup_route_schema.d.ts +71 -21
  78. package/dist/auth/signup_route_schema.d.ts.map +1 -1
  79. package/dist/auth/signup_route_schema.js +18 -16
  80. package/dist/auth/standard_rpc_actions.d.ts +1 -1
  81. package/dist/auth/standard_rpc_actions.js +1 -1
  82. package/dist/auth/token_lifetime.d.ts +33 -9
  83. package/dist/auth/token_lifetime.d.ts.map +1 -1
  84. package/dist/auth/token_lifetime.js +8 -7
  85. package/dist/auth/token_scope.d.ts +99 -25
  86. package/dist/auth/token_scope.d.ts.map +1 -1
  87. package/dist/auth/token_scope.js +57 -35
  88. package/dist/dev/setup.d.ts +14 -7
  89. package/dist/dev/setup.d.ts.map +1 -1
  90. package/dist/dev/setup.js +11 -6
  91. package/dist/primitive_schemas.d.ts +2 -22
  92. package/dist/primitive_schemas.d.ts.map +1 -1
  93. package/dist/primitive_schemas.js +2 -24
  94. package/dist/primitive_schemas_fuz.d.ts +56 -2
  95. package/dist/primitive_schemas_fuz.d.ts.map +1 -1
  96. package/dist/primitive_schemas_fuz.js +54 -4
  97. package/dist/testing/CLAUDE.md +29 -8
  98. package/dist/testing/admin_integration.d.ts +3 -3
  99. package/dist/testing/admin_integration.d.ts.map +1 -1
  100. package/dist/testing/admin_integration.js +1 -1
  101. package/dist/testing/app_server.d.ts +3 -1
  102. package/dist/testing/app_server.d.ts.map +1 -1
  103. package/dist/testing/app_server.js +6 -2
  104. package/dist/testing/audit_drift_guard.d.ts.map +1 -1
  105. package/dist/testing/audit_drift_guard.js +12 -13
  106. package/dist/testing/cross_backend/default_spine_surface.d.ts +2 -2
  107. package/dist/testing/cross_backend/default_spine_surface.d.ts.map +1 -1
  108. package/dist/testing/cross_backend/default_spine_surface.js +2 -2
  109. package/dist/testing/cross_backend/identity_parity.d.ts.map +1 -1
  110. package/dist/testing/cross_backend/identity_parity.js +43 -8
  111. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts +3 -3
  112. package/dist/testing/cross_backend/rust_spine_consumer_surface.d.ts.map +1 -1
  113. package/dist/testing/cross_backend/session_cap.d.ts.map +1 -1
  114. package/dist/testing/cross_backend/session_cap.js +4 -3
  115. package/dist/testing/cross_backend/setup.d.ts +1 -1
  116. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  117. package/dist/testing/cross_backend/setup.js +45 -42
  118. package/dist/testing/cross_backend/spine_suites.d.ts +3 -3
  119. package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
  120. package/dist/testing/cross_backend/standard.d.ts +4 -4
  121. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  122. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  123. package/dist/testing/cross_backend/token_lifetime.js +34 -1
  124. package/dist/testing/db_entities.d.ts +3 -1
  125. package/dist/testing/db_entities.d.ts.map +1 -1
  126. package/dist/testing/db_entities.js +4 -2
  127. package/dist/testing/integration.d.ts.map +1 -1
  128. package/dist/testing/integration.js +4 -3
  129. package/dist/testing/token_scope_fixtures.d.ts +24 -0
  130. package/dist/testing/token_scope_fixtures.d.ts.map +1 -0
  131. package/dist/testing/token_scope_fixtures.js +49 -0
  132. package/dist/testing/transports/bootstrap.d.ts +1 -1
  133. package/dist/testing/transports/bootstrap.d.ts.map +1 -1
  134. package/dist/testing/transports/bootstrap.js +13 -12
  135. package/dist/ui/BootstrapForm.svelte +4 -2
  136. package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
  137. package/dist/ui/SignupForm.svelte +4 -2
  138. package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
  139. package/dist/zod.d.ts +2 -1
  140. package/dist/zod.d.ts.map +1 -1
  141. package/dist/zod.js +6 -2
  142. package/package.json +1 -1
  143. package/dist/auth/audit_log_schema_fuz.d.ts +0 -39
  144. package/dist/auth/audit_log_schema_fuz.d.ts.map +0 -1
  145. package/dist/auth/audit_log_schema_fuz.js +0 -37
  146. package/dist/auth/role_schema_fuz.d.ts +0 -30
  147. package/dist/auth/role_schema_fuz.d.ts.map +0 -1
  148. package/dist/auth/role_schema_fuz.js +0 -30
  149. package/dist/auth/scope_kind_schema_fuz.d.ts +0 -31
  150. package/dist/auth/scope_kind_schema_fuz.d.ts.map +0 -1
  151. package/dist/auth/scope_kind_schema_fuz.js +0 -31
@@ -33,9 +33,9 @@ over the pool so rows persist when request transactions roll back. See root
33
33
 
34
34
  - `auth/keyring.ts` — `Keyring`, `create_keyring` (validates — the one way to build a `Keyring`), `validate_keyring`.
35
35
  - `auth/session_cookie.ts` — `SessionOptions<T>`, `parse_session`, `process_session_cookie` (`'none' | 'clear'` — no refresh action; the 30-day lifetime is an absolute cap signed once at mint), `create_session_config`, `fuz_session_config`, `SESSION_AGE_MAX`.
36
- - `auth/password.ts` — `Password`, `PasswordProvided`, `PasswordHashDeps`, `PASSWORD_LENGTH_MIN` (12, OWASP), `PASSWORD_LENGTH_MAX` (300).
36
+ - `auth/password.ts` — `Password`, `PasswordProvided` (`@fuzdev/fuz_schema` schemas), `PasswordHashDeps`, `PASSWORD_LENGTH_MIN` (12, OWASP), `PASSWORD_LENGTH_MAX` (300).
37
37
  - `auth/password_argon2.ts` — `hash_password`, `verify_password`, `verify_dummy`, `argon2_password_deps`.
38
- - `auth/api_token.ts` — `API_TOKEN_PREFIX` (`secret_fuz_token_`), `hash_api_token`, `generate_api_token`, and the shape precheck `is_api_token_shaped` (`API_TOKEN_REGEX`: the prefix plus exactly `API_TOKEN_BODY_LENGTH` = 43 base64url chars).
38
+ - `auth/api_token.ts` — `API_TOKEN_PREFIX` (`secret_fuz_token_`), `ApiTokenId` (the public id, `pipe(string, regex(API_TOKEN_ID_REGEX))`, a `@fuzdev/fuz_schema` schema), `hash_api_token`, `generate_api_token`, and the shape precheck `is_api_token_shaped` (`API_TOKEN_REGEX`: the prefix plus exactly `API_TOKEN_BODY_LENGTH` = 43 base64url chars).
39
39
  - `auth/daemon_token.ts` — `DaemonToken`, `DAEMON_TOKEN_HEADER` (`X-Daemon-Token`), `generate_daemon_token`, `validate_daemon_token`, `DaemonTokenState`.
40
40
  - `auth/bootstrap_account.ts` — `bootstrap_account` (one-shot, `bootstrap_lock`-protected) + `read_bootstrap_token`, the read both it and `check_bootstrap_status` use: the secure read less one trailing LF, a token under `BOOTSTRAP_TOKEN_MIN_BYTES` (32) refused as unreadable with an error log.
41
41
 
@@ -54,25 +54,22 @@ Cross-cutting notes that don't live on any single symbol:
54
54
 
55
55
  ### Schemas, types, DDL
56
56
 
57
- Convention — `*_schema.ts` holds a domain's schemas, Zod or `@fuzdev/fuz_schema`; a `*_schema_fuz.ts` holds the fuz_schema twins of Zod schemas that stay; `*_ddl.ts` holds DDL strings.
58
-
59
- - `auth/account_schema.ts` — `Account`, `Actor`, `RoleGrant`, `AuthSession`, `ApiToken` + client-safe JSON shapes. Grant predicates over wire fields: `is_role_grant_active` (not revoked, not expired) and `has_global_role(role_grants, role, now?)` (an active grant of the role with `scope_id === null` — the bare-list form of `has_scoped_role(ctx, role, null)`, used client-side by `AuthState`).
60
- - `auth/name_schema.ts` — the name grammar the auth vocabularies share: `NAME_REGEX` (runs of lowercase letters joined by single underscores), `NAME_LENGTH_MAX` (64), `is_valid_name`, `create_name_schema(label)` (the Zod schema, `bounded_string` then the regex) and the message builders `format_name_length_message` / `format_name_pattern_message`, so each domain keeps its own label in its messages. `RoleName`, `ScopeKindName`, `GrantPathName`, `CredentialTypeName` and a token's `surface:` name (`is_route_scope_capability`) hold it; `AuditEventTypeName` takes its cap over its own grammar. Twin of the Rust `fuz_auth::is_valid_name` / `NAME_LENGTH_MAX`.
61
- - `auth/role_schema.ts` — `RoleName` (`create_name_schema('Role')`: lowercase letters and underscores, no leading, trailing or consecutive underscores, at most `NAME_LENGTH_MAX` = 64 characters — the grammar every `role` input and every registered role holds, twin of the Rust `is_valid_name`), its messages (`ROLE_NAME_LENGTH_MESSAGE`, `ROLE_NAME_PATTERN_MESSAGE`), `RoleSpec`, `ROLE_KEEPER`, `ROLE_ADMIN`, `is_builtin_role`, `create_role_schema`, `builtin_role_specs_by_name`, `role_has_grant_path`, `list_roles_with_grant_path`.
62
- - `auth/role_schema_fuz.ts` — the `@fuzdev/fuz_schema` twin of `RoleName` under the same name (`@nodocs` while the Zod one stays), `pipe(bounded_string({max: NAME_LENGTH_MAX, max_message}), message(regex(NAME_REGEX), ROLE_NAME_PATTERN_MESSAGE))` over the same constants: the same verdict, output and JSON Schema as the Zod one, and its messages; a string both too long and off the grammar gets the length issue alone, where Zod adds the grammar issue. Pinned by `role_schema_fuz.test.ts`. `self_service_role_set`'s input declares it; every other `role` input is the Zod one.
63
- - `auth/scope_kind_schema.ts` — `ScopeKindName`, the constants its messages come from (`SCOPE_KIND_NAME_LENGTH_MESSAGE`, `SCOPE_KIND_NAME_PATTERN_MESSAGE`), `create_scope_kind_schema` (open registry, no builtins). `ScopeKindName` (`create_name_schema('Scope-kind')`, grammar and cap) checks a registered name and the `scope_kind` on `role_grant_offer_create` / `role_grant_assign`, which is copied into the row and its audit metadata; off the grammar is the partial unique indexes' `'GLOBAL'` token.
64
- - `auth/credential_type_schema.ts` — `CredentialTypeName` (`create_name_schema('Credential-type')`), `CREDENTIAL_TYPE_SESSION` / `_API_TOKEN` / `_DAEMON_TOKEN`, `create_credential_type_schema`.
65
- - `auth/grant_path_schema.ts` — `GrantPathName` (`create_name_schema('Grant-path')`), `GRANT_PATH_ADMIN` / `_SELF_SERVICE` / `_SYSTEM` / `_BOOTSTRAP`, `create_grant_path_schema`.
66
- - `auth/token_lifetime.ts` — the temporal axis of a minted token: `TokenLifetimeInput` (required union on `account_token_create` — `{kind:'eternal'}` or `{kind:'ttl', days}`), `token_lifetime_to_expires_at`, `TOKEN_TTL_DAYS_MAX`. No default — `expires_at IS NULL` always means "deliberately eternal".
67
- - `auth/token_scope.ts` — per-credential authority narrowing stored on `api_token.scope`: `TokenScope` / `TokenScopeInput` + constructors, `parse_stored_token_scope` (fail-closed), `token_scope_admits_method` / `_non_rpc`, and the `<section>:<id>` capability vocabulary (`token_scope_method_capability` for the dispatcher's `rpc:<method>`, `is_route_scope_capability` for the `surface:<name>` a `RouteAuth.required_scope` may declare, `token_scope_denied_body`, `TOKEN_SURFACES`). Not an open registry — see ../../../docs/security.md §Token scoping for why the identifier half is deliberately unregistered.
57
+ Convention — `*_schema.ts` holds a domain's schemas, Zod or `@fuzdev/fuz_schema`; `*_ddl.ts` holds DDL strings.
58
+
59
+ - `auth/account_schema.ts` — `Account`, `Actor`, `RoleGrant`, `AuthSession`, `ApiToken` + client-safe JSON shapes, `@fuzdev/fuz_schema` schemas: `SessionId` (`brand(Blake3Hash, 'SessionId')`, minted by `hash_session_token`), `SessionAccountJson` and `AdminAccountJson` (their `username` `UsernameCanonical`, so a username in another case fails), `AuthSessionJson`, `RoleGrantSummaryJson` and `PendingOfferSummaryJson` (`role` a `RoleName`, `scope_kind` a `ScopeKindName` or `null`), `ActorSummaryJson`, `AdminAccountEntryJson`, `ClientApiTokenJson` (`id` an `ApiTokenId`); every timestamp a `Timestamp`. Grant predicates over wire fields: `is_role_grant_active` (not revoked, not expired) and `has_global_role(role_grants, role, now?)` (an active grant of the role with `scope_id === null` — the bare-list form of `has_scoped_role(ctx, role, null)`, used client-side by `AuthState`).
60
+ - `auth/name_schema.ts` — the name grammar the auth vocabularies share: `NAME_REGEX` (runs of lowercase letters joined by single underscores), `NAME_LENGTH_MAX` (64), `is_valid_name`, `create_name_schema(label)` (the `@fuzdev/fuz_schema` schema, `pipe(bounded_string, message(regex))`: a string too long and off the grammar gets the one length issue, a value that is no string fuz_schema's message; its JSON Schema `maxLength` and `pattern`) and the message builders `format_name_length_message` / `format_name_pattern_message`, so each domain keeps its own label in its messages. `RoleName`, `ScopeKindName`, `GrantPathName`, `CredentialTypeName` and a token's `surface:` name (`is_route_scope_capability`) hold it; `AuditEventTypeName` takes its cap over its own grammar. Twin of the Rust `fuz_auth::is_valid_name` / `NAME_LENGTH_MAX`.
61
+ - `auth/role_schema.ts` — `RoleName` (`create_name_schema('Role')`: lowercase letters and underscores, no leading, trailing or consecutive underscores, at most `NAME_LENGTH_MAX` = 64 characters — the grammar every `role` input and every registered role holds, twin of the Rust `is_valid_name`), its messages (`ROLE_NAME_LENGTH_MESSAGE`, `ROLE_NAME_PATTERN_MESSAGE`), `RoleSpec`, `ROLE_KEEPER`, `ROLE_ADMIN`, `BUILTIN_ROLES` and its type `BuiltinRole`, `is_builtin_role`, `create_role_registry` (returns `{role_specs}`), `builtin_role_specs`, `role_has_grant_path`, `list_roles_with_grant_path`. Pinned against a Zod copy by `role_schema.name.test.ts`.
62
+ - `auth/scope_kind_schema.ts` — `ScopeKindName`, the constants its messages come from (`SCOPE_KIND_NAME_LENGTH_MESSAGE`, `SCOPE_KIND_NAME_PATTERN_MESSAGE`), `create_scope_kind_registry` (open registry, no builtins; returns `{scope_kinds}`). `ScopeKindName` (`create_name_schema('Scope-kind')`, grammar and cap) checks a registered name and the `scope_kind` on `role_grant_offer_create` / `role_grant_assign`, which is copied into the row and its audit metadata; off the grammar is the partial unique indexes' `'GLOBAL'` token. Pinned against a Zod copy by `scope_kind_schema.name.test.ts`.
63
+ - `auth/credential_type_schema.ts` — `CredentialTypeName` (`create_name_schema('Credential-type')`), `CREDENTIAL_TYPE_SESSION` / `_API_TOKEN` / `_DAEMON_TOKEN`, `BUILTIN_CREDENTIAL_TYPES` and its type `BuiltinCredentialType`, `create_credential_type_registry` (returns `{credential_types}`).
64
+ - `auth/grant_path_schema.ts` — `GrantPathName` (`create_name_schema('Grant-path')`), `GRANT_PATH_ADMIN` / `_SELF_SERVICE` / `_SYSTEM` / `_BOOTSTRAP`, `BUILTIN_GRANT_PATHS` and its type `BuiltinGrantPath`, `create_grant_path_registry` (returns `{grant_paths}`).
65
+ - `auth/token_lifetime.ts` — the temporal axis of a minted token: `TokenLifetimeInput` (required `variant` on `account_token_create` — `{kind:'eternal'}` or `{kind:'ttl', days}`, a `@fuzdev/fuz_schema` schema), `token_lifetime_to_expires_at`, `TOKEN_TTL_DAYS_MAX`. No default — `expires_at IS NULL` always means "deliberately eternal".
66
+ - `auth/token_scope.ts` — per-credential authority narrowing stored on `api_token.scope`: `TokenScope` / `TokenScopeInput` (`@fuzdev/fuz_schema` `variant`s of strict `object` arms) + constructors, `parse_stored_token_scope` (fail-closed; the `MAX_TOKEN_SCOPE_BYTES` cap counts UTF-8 bytes of the compact document at mint and at read, as the Rust spine does), `token_scope_admits_method` / `_non_rpc`, and the `<section>:<id>` capability vocabulary (`token_scope_method_capability` for the dispatcher's `rpc:<method>`, `is_route_scope_capability` for the `surface:<name>` a `RouteAuth.required_scope` may declare, `token_scope_denied_body`, `TOKEN_SURFACES`). Not an open registry — see ../../../docs/security.md §Token scoping for why the identifier half is deliberately unregistered.
68
67
  - `auth/auth_ddl.ts` — `CREATE TABLE` / index / seed strings for the core identity tables.
69
- - `auth/audit_log_schema.ts` — `AUDIT_EVENT_TYPES` (the builtin event types), `AuditEventType` / `AuditEventTypeName` (`AUDIT_EVENT_TYPE_NAME_REGEX` under `NAME_LENGTH_MAX`), `audit_metadata_schemas`, `AuditLogEvent`, `AuditLogInput`, `AuditLogConfig`, `create_audit_log_config`.
70
- - `auth/audit_log_schema_fuz.ts` — the `@fuzdev/fuz_schema` twins of `AuditEventTypeName` and `AuditOutcome` under the same names (`@nodocs` while the Zod ones stay), over `audit_log_schema.ts`'s grammar and messages (`AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE`, `AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE`): the same verdict, output and JSON Schema as the Zod ones, and their messages, but for the one length issue of a name too long and off the grammar. Pinned by `audit_log_schema_fuz.test.ts`. `audit_log_list`'s input declares them.
68
+ - `auth/audit_log_schema.ts` — `@fuzdev/fuz_schema` throughout: `AUDIT_EVENT_TYPES` (the builtin event types) and the type `AuditEventType` (`(typeof AUDIT_EVENT_TYPES)[number]`), `AuditEventTypeName` (`pipe(bounded_string, message(regex))`, `AUDIT_EVENT_TYPE_NAME_REGEX` under `NAME_LENGTH_MAX`, with `AUDIT_EVENT_TYPE_NAME_LENGTH_MESSAGE` / `AUDIT_EVENT_TYPE_NAME_PATTERN_MESSAGE`; a name too long and off the grammar gets the one length issue), `AuditOutcome` (`one_of(['success', 'failure'])`), `audit_metadata_schemas`, `AuditLogEvent`, `AuditLogInput`, `AuditLogConfig` (`metadata_schemas` of either library), `create_audit_log_config` (refuses an `extra_events` key off `AuditEventTypeName` with its first issue's message), and the wire rows `AuditLogEventJson` (`seq` `pipe(number, safe_integer)`, `created_at` a `Timestamp`), `AuditLogEventWithUsernamesJson`, `RoleGrantHistoryEventJson` and `AdminSessionJson`. `audit_log_list`'s input declares `AuditEventTypeName` and `AuditOutcome`. Pinned against Zod copies by `audit_log_schema.names.test.ts`.
71
69
  - `auth/audit_log_ddl.ts` — `audit_log` table DDL with `seq BIGSERIAL` for cursor-based gap fill (BIGSERIAL converges with the Rust spine; `create_db` registers a `pg.types` int8 parser so `seq` still reads as a JS number).
72
- - `auth/invite_schema.ts` — `Invite`, `CreateInviteInput`.
70
+ - `auth/invite_schema.ts` — `Invite`, `CreateInviteInput`, and the `@fuzdev/fuz_schema` rows `InviteJson` (`username` a `UsernameCanonical` or `null`, timestamps `Timestamp`s) and `InviteWithUsernamesJson`, whose resolved names are plain strings.
73
71
  - `auth/app_settings_schema.ts` — `AppSettings` (single-row via `CHECK (id = 1)`) and its `@fuzdev/fuz_schema` schemas `AppSettingsJson` and `AppSettingsWithUsernameJson`.
74
- - `auth/scope_kind_schema_fuz.ts` — the `@fuzdev/fuz_schema` twin of `ScopeKindName` under the same name (`@nodocs` while the Zod one stays), built as the `RoleName` twin is, over `scope_kind_schema.ts`'s constants: the same verdict, output and JSON Schema as the Zod one, and its messages, but for the one length issue of a string too long and off the grammar. Pinned by `scope_kind_schema_fuz.test.ts`. The role_grant_offer schemas declare it.
75
- - `auth/role_grant_offer_schema.ts` — `RoleGrantOffer`, `RoleGrantOfferJson` (a `@fuzdev/fuz_schema` `object`: `role` the fuz_schema `RoleName`, `scope_kind` the fuz_schema `ScopeKindName` or `null`, so an offer row holding a name off either grammar fails it), `to_role_grant_offer_json`.
72
+ - `auth/role_grant_offer_schema.ts` — `RoleGrantOffer`, `RoleGrantOfferJson` (a `@fuzdev/fuz_schema` `object`: `role` a `RoleName`, `scope_kind` a `ScopeKindName` or `null`, so an offer row holding a name off either grammar fails it), `to_role_grant_offer_json`.
76
73
  - `auth/role_grant_offer_ddl.ts` — `role_grant_offer` table + indexes + `ROLE_GRANT_OFFER_SCOPE_SENTINEL_UUID` / `_GLOBAL_TOKEN` + `ROLE_GRANT_OFFER_COLUMNS` and the shared `ROLE_GRANT_OFFER_WITH_GRANTOR_SELECT` CTE tail (homed here per the placement rule in `db/sql_columns.ts`).
77
74
  - `auth/role_grant_sql.ts` — the liveness predicates every grant and offer read shares: `role_grant_active_sql(alias)` (not revoked, not expired) and `offer_pending_predicate(alias)` (every `OFFER_TERMINAL_COLUMNS` entry null), twins of the Rust spine's. The frozen partial-index DDL keeps its literal text.
78
75
  - `auth/role_grant_offer_notifications.ts` — the WS notification specs for the consentful-grant lifecycle, their `@fuzdev/fuz_schema` params, builders, `role_grant_offer_notification_actions`, `role_grant_offer_notification_specs`, and `create_validated_notification_sender`.
@@ -217,7 +214,15 @@ attack surface — and a backend-spawning consumer assembling its surface import
217
214
  the shapes without dragging `hono/cookie` / `hono/streaming` (and the optional
218
215
  `hono` peer) onto a Rust-only cross-process suite. Shared route-limit constants
219
216
  (`DEFAULT_MAX_SESSIONS` / `_TOKENS`) live in `account_route_schema.ts` for the
220
- same reason (the RPC `account_actions` reads `DEFAULT_MAX_TOKENS`).
217
+ same reason (the RPC `account_actions` reads `DEFAULT_MAX_TOKENS`). The
218
+ account, signup and bootstrap shapes' schemas, error bodies included, are
219
+ `@fuzdev/fuz_schema` schemas: `/login` takes `UsernameProvided` and
220
+ `PasswordProvided`; the output `username` of `/logout`, `/signup` and
221
+ `/bootstrap` is a `UsernameCanonical`; `/password`'s revoke counts are
222
+ non-negative integers; `/bootstrap`'s `token` is 1 to
223
+ `BOOTSTRAP_TOKEN_LENGTH_MAX` (4096, the token file's cap) UTF-16 code units,
224
+ a longer one a `400 invalid_request_body` before the window check, with no
225
+ audit row — twin of the Rust `BOOTSTRAP_TOKEN_LENGTH_MAX`.
221
226
 
222
227
  **`POST /login` timing floor.** Login 401s are floored to
223
228
  `DEFAULT_LOGIN_FAIL_FLOOR_MS` (250ms) + uniform jitter (±25ms) via
@@ -495,7 +500,7 @@ index-backed, matching the Rust twin (which aliases nothing, so its bare
495
500
  Four open string registries — `RoleName`, `ScopeKindName`,
496
501
  `CredentialTypeName`, `GrantPathName` — share the same factory shape:
497
502
  construction-time guards (name regex, duplicate detection, builtin-collision
498
- rejection), `ReadonlyMap` output, pass into `create_role_schema` for
503
+ rejection), `ReadonlyMap` output, pass into `create_role_registry` for
499
504
  cross-axis validation. The four share one name grammar, runs of lowercase
500
505
  letters joined by single underscores, at most `NAME_LENGTH_MAX` characters
501
506
  (`auth/name_schema.ts`), which a token's `surface:` name holds too.
@@ -503,9 +508,9 @@ letters joined by single underscores, at most `NAME_LENGTH_MAX` characters
503
508
  Dependency flow:
504
509
 
505
510
  ```
506
- create_credential_type_schema()
507
- create_scope_kind_schema() → create_role_schema({roles, options}) → role_specs
508
- create_grant_path_schema()
511
+ create_credential_type_registry()
512
+ create_scope_kind_registry() → create_role_registry({roles, options}) → role_specs
513
+ create_grant_path_registry()
509
514
  ```
510
515
 
511
516
  `role_specs` drives downstream defaults:
@@ -542,8 +547,13 @@ TSDoc. The pattern that spans emit sites:
542
547
  ### Audit event extensibility
543
548
 
544
549
  Consumers extend the closed `AUDIT_EVENT_TYPES` enum via
545
- `create_audit_log_config({extra_events})` — Zod schema or `null` per type;
546
- collisions with builtins or name-format failures throw at construction. The
550
+ `create_audit_log_config({extra_events})` — a metadata schema, Zod or
551
+ `@fuzdev/fuz_schema`, or `null` per type; collisions with builtins,
552
+ name-format failures and a value of neither library throw at construction.
553
+ `query_audit_log` validates through `parse_any`, and a dropped row's log line
554
+ masks the `sensitivity: 'secret'` fields of either library's object schema.
555
+ The builtin `audit_metadata_schemas` are fuz_schema `loose_object`s
556
+ (`nullable` where the event may carry none, `literal(null)` for `logout`). The
547
557
  DB column is `TEXT NOT NULL` (no enum), so consumer types round-trip through
548
558
  list queries, the `audit_log_list` RPC, and SSE identically to builtins.
549
559
 
@@ -724,7 +734,7 @@ on invite delete. `invite_create` empty input is rejected at the schema via
724
734
 
725
735
  Closure state:
726
736
 
727
- - `grantable_roles` derived once from `options.roles?.role_specs ?? builtin_role_specs_by_name`
737
+ - `grantable_roles` derived once from `options.roles?.role_specs ?? builtin_role_specs`
728
738
  via `list_roles_with_grant_path(_, GRANT_PATH_ADMIN)`.
729
739
  - `app_settings_get`/`_update` handlers are always wired and read/write the DB
730
740
  directly (`query_app_settings_load`/`query_app_settings_update`);
@@ -763,7 +773,7 @@ event additionally records `credential_type` in metadata (defense in depth).
763
773
 
764
774
  The specs' inputs and outputs are `@fuzdev/fuz_schema` schemas
765
775
  (`auth/role_grant_offer_action_specs.ts`), every object refusing unknown keys,
766
- `role` the fuz_schema `RoleName`, `scope_kind` the fuz_schema `ScopeKindName`.
776
+ `role` a `RoleName`, `scope_kind` a `ScopeKindName`.
767
777
  The create and assign inputs end in a `check` of `is_grant_scope_paired`
768
778
  (`GRANT_SCOPE_PAIRED_MESSAGE`), run only on an input whose fields all passed;
769
779
  the list and history inputs read an omitted input as a fresh `{}`
@@ -909,7 +919,7 @@ the payload — `revoked_by` is deliberately not in the `role_grant_revoked`
909
919
  payload (the revokee doesn't need to learn the admin's identity). When
910
920
  `notification_sender` is absent, WS fan-out is silently skipped.
911
921
 
912
- Options: `roles?: RoleSchemaResult` (drives admin-grant-path lookup),
922
+ Options: `roles?: RoleRegistry` (drives admin-grant-path lookup),
913
923
  `default_ttl_ms?` (defaults to `ROLE_GRANT_OFFER_DEFAULT_TTL_MS` = 30 days),
914
924
  `authorize?: RoleGrantOfferCreateAuthorize`.
915
925
 
@@ -917,12 +927,12 @@ Options: `roles?: RoleSchemaResult` (drives admin-grant-path lookup),
917
927
 
918
928
  `create_account_actions(deps, options?)` in `auth/account_actions.ts`.
919
929
 
920
- - `account_verify_action_spec` — read; input `z.void()`; output `SessionAccountJson`.
921
- - `account_session_list_action_spec` — read; input `z.void()`; output `{sessions}`, each with `is_current` (the session the request authenticated with; `false` on every row for a bearer or daemon-token caller).
930
+ - `account_verify_action_spec` — read; input fuz_schema's `void`; output `SessionAccountJson`.
931
+ - `account_session_list_action_spec` — read; input fuz_schema's `void`; output `{sessions}`, each with `is_current` (the session the request authenticated with; `false` on every row for a bearer or daemon-token caller).
922
932
  - `account_session_revoke_action_spec` — mutation; input `{session_id}`; output `{ok, revoked}`.
923
- - `account_session_revoke_all_action_spec` — mutation; input `z.void()`; output `{ok, count}`.
924
- - `account_token_create_action_spec` — mutation; input `{name?, scope, lifetime}` (both `scope` and `lifetime` required — default-deny at mint on both axes; `name` at most `API_TOKEN_NAME_LENGTH_MAX` = 255 characters, since it is copied into the audit row); output `{ok, token, id, name, expires_at}`. `scope` / `lifetime` declare `invalid_reason` `ERROR_TOKEN_SCOPE_INVALID` / `ERROR_TOKEN_LIFETIME_INVALID`, so every refusal of either carries it — the handler's over-cap scope refusal included.
925
- - `account_token_list_action_spec` — read; input `z.void()`; output `{tokens}`.
933
+ - `account_session_revoke_all_action_spec` — mutation; input fuz_schema's `void`; output `{ok, count}`, `count` a non-negative integer.
934
+ - `account_token_create_action_spec` — mutation; input `{name?, scope, lifetime}` (both `scope` and `lifetime` required — default-deny at mint on both axes; `name` at most `API_TOKEN_NAME_LENGTH_MAX` = 255 characters, since it is copied into the audit row); output `{ok, token, id, name, expires_at}`, `expires_at` a `Timestamp` or `null`. `scope` / `lifetime` declare `invalid_reason` `ERROR_TOKEN_SCOPE_INVALID` / `ERROR_TOKEN_LIFETIME_INVALID`, so every refusal of either carries it — the handler's over-cap scope refusal included.
935
+ - `account_token_list_action_spec` — read; input fuz_schema's `void`; output `{tokens}`, each a `ClientApiTokenJson`.
926
936
  - `account_token_revoke_action_spec` — mutation; input `{token_id}`; output `{ok, revoked}`.
927
937
 
928
938
  `account_verify` is intentionally on both surfaces: the REST `GET /verify`
@@ -932,8 +942,9 @@ narrowed token that names it: the REST probe is the `surface:account_verify`
932
942
  rule-3 surface, refused to every narrowed token, and `GET /status` answers one
933
943
  as the anonymous caller.
934
944
 
935
- `session_id` validates as `Blake3Hash`; `token_id` as `ApiTokenId`
936
- (`tok_[A-Za-z0-9_-]{12}`).
945
+ `session_id` validates as `SessionId`, the fuz_schema `Blake3Hash` branded;
946
+ `token_id` as `ApiTokenId` (`tok_[A-Za-z0-9_-]{12}`). Every input and output
947
+ is a `@fuzdev/fuz_schema` schema.
937
948
 
938
949
  Audit events via `deps.audit.emit` with `ip: ctx.client_ip`:
939
950
  `session_revoke`, `session_revoke_all`, `token_create`, `token_revoke`. Every
@@ -985,7 +996,7 @@ account actions hits `method_not_found` on first admin-suite run.
985
996
  `self_service_role_set({role, enabled})` toggles a global role_grant on the
986
997
  caller. Idempotent in both directions (`changed: false` when the post-call
987
998
  state already matched). Its input and output are `@fuzdev/fuz_schema`
988
- `object`s, refusing unknown keys, `role` the fuz_schema `RoleName` twin.
999
+ `object`s, refusing unknown keys, `role` a `RoleName`.
989
1000
 
990
1001
  Audit metadata carries `self_service: true` so admin reviewers can
991
1002
  distinguish self-toggled role_grants. Eligibility derives from