@fuzdev/fuz_app 0.49.0 → 0.51.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 (97) hide show
  1. package/dist/actions/CLAUDE.md +56 -21
  2. package/dist/actions/action_codegen.d.ts +60 -34
  3. package/dist/actions/action_codegen.d.ts.map +1 -1
  4. package/dist/actions/action_codegen.js +80 -46
  5. package/dist/actions/action_registry.d.ts +1 -1
  6. package/dist/actions/action_registry.js +1 -1
  7. package/dist/actions/action_spec.d.ts +1 -1
  8. package/dist/actions/action_spec.js +1 -1
  9. package/dist/actions/action_types.d.ts +4 -4
  10. package/dist/actions/action_types.js +4 -4
  11. package/dist/actions/cancel.d.ts +13 -11
  12. package/dist/actions/cancel.d.ts.map +1 -1
  13. package/dist/actions/cancel.js +13 -11
  14. package/dist/actions/frontend_rpc_client.d.ts +9 -0
  15. package/dist/actions/frontend_rpc_client.d.ts.map +1 -1
  16. package/dist/actions/heartbeat.d.ts +11 -8
  17. package/dist/actions/heartbeat.d.ts.map +1 -1
  18. package/dist/actions/heartbeat.js +11 -8
  19. package/dist/actions/protocol.d.ts +47 -0
  20. package/dist/actions/protocol.d.ts.map +1 -0
  21. package/dist/actions/protocol.js +46 -0
  22. package/dist/actions/register_action_ws.d.ts +5 -4
  23. package/dist/actions/register_action_ws.d.ts.map +1 -1
  24. package/dist/actions/register_action_ws.js +2 -2
  25. package/dist/auth/account_action_specs.d.ts +1 -1
  26. package/dist/auth/account_action_specs.js +1 -1
  27. package/dist/auth/account_actions.d.ts +2 -2
  28. package/dist/auth/account_actions.js +2 -2
  29. package/dist/auth/account_routes.d.ts +3 -3
  30. package/dist/auth/account_routes.js +3 -3
  31. package/dist/auth/account_schema.d.ts +1 -1
  32. package/dist/auth/account_schema.js +1 -1
  33. package/dist/auth/admin_action_specs.d.ts +1 -1
  34. package/dist/auth/admin_action_specs.js +1 -1
  35. package/dist/auth/admin_actions.d.ts +2 -2
  36. package/dist/auth/admin_actions.js +2 -2
  37. package/dist/auth/api_token.d.ts +1 -1
  38. package/dist/auth/api_token.js +1 -1
  39. package/dist/auth/audit_log_routes.d.ts +1 -1
  40. package/dist/auth/audit_log_routes.js +1 -1
  41. package/dist/auth/audit_log_schema.d.ts +1 -1
  42. package/dist/auth/daemon_token.d.ts +1 -1
  43. package/dist/auth/daemon_token.js +1 -1
  44. package/dist/auth/daemon_token_middleware.d.ts +1 -1
  45. package/dist/auth/daemon_token_middleware.js +1 -1
  46. package/dist/auth/ddl.d.ts +1 -1
  47. package/dist/auth/ddl.js +1 -1
  48. package/dist/auth/password.d.ts +1 -1
  49. package/dist/auth/password.js +1 -1
  50. package/dist/auth/permit_offer_action_specs.d.ts +1 -1
  51. package/dist/auth/permit_offer_action_specs.js +1 -1
  52. package/dist/auth/permit_offer_actions.d.ts +1 -1
  53. package/dist/auth/permit_offer_actions.js +1 -1
  54. package/dist/auth/route_guards.d.ts +1 -1
  55. package/dist/auth/route_guards.js +1 -1
  56. package/dist/auth/self_service_role_action_specs.d.ts +1 -1
  57. package/dist/auth/self_service_role_action_specs.js +1 -1
  58. package/dist/auth/self_service_role_actions.d.ts +1 -1
  59. package/dist/auth/self_service_role_actions.js +1 -1
  60. package/dist/auth/session_queries.d.ts +1 -1
  61. package/dist/auth/session_queries.js +1 -1
  62. package/dist/auth/signup_routes.d.ts +1 -1
  63. package/dist/auth/signup_routes.js +1 -1
  64. package/dist/auth/standard_action_specs.d.ts +1 -1
  65. package/dist/auth/standard_action_specs.js +1 -1
  66. package/dist/cli/util.d.ts +1 -1
  67. package/dist/cli/util.js +1 -1
  68. package/dist/db/create_db.d.ts +2 -2
  69. package/dist/db/create_db.js +2 -2
  70. package/dist/db/db.d.ts +3 -3
  71. package/dist/db/db.js +3 -3
  72. package/dist/hono_context.d.ts +1 -1
  73. package/dist/hono_context.js +1 -1
  74. package/dist/http/jsonrpc_errors.d.ts +2 -2
  75. package/dist/http/jsonrpc_errors.js +2 -2
  76. package/dist/http/jsonrpc_helpers.d.ts +2 -2
  77. package/dist/http/jsonrpc_helpers.js +2 -2
  78. package/dist/http/middleware_spec.d.ts +1 -1
  79. package/dist/http/middleware_spec.js +1 -1
  80. package/dist/http/origin.d.ts +1 -1
  81. package/dist/http/origin.js +1 -1
  82. package/dist/http/schema_helpers.d.ts +1 -1
  83. package/dist/http/schema_helpers.js +1 -1
  84. package/dist/http/surface.d.ts +1 -1
  85. package/dist/http/surface.js +1 -1
  86. package/dist/runtime/deno.d.ts +1 -1
  87. package/dist/runtime/deno.js +1 -1
  88. package/dist/runtime/node.d.ts +1 -1
  89. package/dist/runtime/node.js +1 -1
  90. package/dist/testing/rpc_attack_surface.js +1 -1
  91. package/dist/testing/rpc_helpers.js +1 -1
  92. package/dist/testing/ws_round_trip.js +1 -1
  93. package/dist/ui/account_sessions_state.svelte.d.ts +2 -2
  94. package/dist/ui/account_sessions_state.svelte.js +1 -1
  95. package/dist/ui/admin_rpc_adapters.d.ts +1 -1
  96. package/dist/ui/admin_rpc_adapters.js +1 -1
  97. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Canonical bundles of fuz_app's protocol actions — `heartbeat` and
3
+ * `cancel`. Spread these into consumer registrations on both sides of the
4
+ * wire so the registries stay symmetric without per-consumer plumbing.
5
+ *
6
+ * Protocol actions are wire-protocol concerns (liveness, abort) shipped by
7
+ * fuz_app, not consumer domain logic. The split is intentional: the server
8
+ * needs `{spec, handler}` tuples to drive dispatch; the frontend
9
+ * `ActionRegistry` only stores specs. The codegen
10
+ * `include_protocol_actions: false` default (in `actions/action_codegen.ts`) is the
11
+ * third leg of this contract — protocol actions are excluded from
12
+ * generated typed surfaces because consumers spread them in at
13
+ * registration time.
14
+ *
15
+ * Adding a future protocol action (e.g. clock-skew probe, reconnect-resume
16
+ * token) means appending to these arrays in one place; no consumer
17
+ * migration required.
18
+ *
19
+ * @module
20
+ */
21
+ import { cancel_action } from './cancel.js';
22
+ import { heartbeat_action } from './heartbeat.js';
23
+ /**
24
+ * Canonical protocol `{spec, handler}` tuples for the server's
25
+ * `register_action_ws` `actions` array. Spread before consumer-owned actions
26
+ * so disconnect detection and per-request cancel work uniformly:
27
+ *
28
+ * ```ts
29
+ * register_action_ws({actions: [...protocol_actions, ...consumer_actions], ...})
30
+ * ```
31
+ */
32
+ export const protocol_actions = [heartbeat_action, cancel_action];
33
+ /**
34
+ * Canonical protocol specs for `ActionRegistry` construction on the
35
+ * frontend. Spread before consumer-owned specs so dispatcher-owned methods
36
+ * are present in the lookup map even though codegen excludes them from the
37
+ * generated `action_specs` array:
38
+ *
39
+ * ```ts
40
+ * new ActionRegistry([...protocol_action_specs, ...action_specs])
41
+ * ```
42
+ *
43
+ * Derived from `protocol_actions` so a future protocol action lands in one
44
+ * place — the two arrays cannot drift.
45
+ */
46
+ export const protocol_action_specs = protocol_actions.map((a) => a.spec);
@@ -2,7 +2,7 @@
2
2
  * WebSocket JSON-RPC dispatch — the low-level WS transport binding.
3
3
  *
4
4
  * Most consumers should mount WS endpoints via `register_ws_endpoint`
5
- * (`./register_ws_endpoint.js`), which wraps this function with the standard
5
+ * (`actions/register_ws_endpoint.ts`), which wraps this function with the standard
6
6
  * upgrade stack (origin check + auth + optional role). This module stays
7
7
  * exported as the lower-level entry point for tests that drive the
8
8
  * dispatcher directly via `create_ws_test_harness`.
@@ -97,8 +97,9 @@ export interface RegisterActionWsOptions<TCtx extends BaseHandlerContext> {
97
97
  * The actions registered on this endpoint — each carries a spec (drives
98
98
  * method lookup, per-action auth, input/output validation) and an
99
99
  * optional handler (omit for client-only specs like inbound
100
- * notifications). Include the shared `heartbeat_action` here to
101
- * complete the disconnect-detection pairing with the frontend client.
100
+ * notifications). Spread `protocol_actions` from `actions/protocol.ts`
101
+ * here to complete the disconnect-detection + per-request cancel
102
+ * pairing with the frontend client.
102
103
  */
103
104
  actions: ReadonlyArray<Action<TCtx>>;
104
105
  /**
@@ -156,7 +157,7 @@ export interface RegisterActionWsResult {
156
157
  * - Per-action auth: `public` / `authenticated` pass through (upgrade auth
157
158
  * already verified identity); `keeper` requires `daemon_token` credential
158
159
  * type *and* the keeper role; role-based `{role}` requires the named role
159
- * via `has_role`, matching the HTTP path in `action_rpc.ts`.
160
+ * via `has_role`, matching the HTTP path in `actions/action_rpc.ts`.
160
161
  * - DEV mode validates handler output against the spec's `output` schema and
161
162
  * warns on mismatches.
162
163
  *
@@ -1 +1 @@
1
- {"version":3,"file":"register_action_ws.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/actions/register_action_ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACxC,OAAO,KAAK,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAEzD,OAAO,EAAS,KAAK,MAAM,IAAI,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAC1E,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAiBjD,OAAO,EAAC,KAAK,MAAM,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAG7F,OAAO,EAAC,yBAAyB,EAAE,KAAK,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAE9F,YAAY,EAAC,MAAM,EAAE,kBAAkB,EAAE,eAAe,EAAC,CAAC;AAE1D,0EAA0E;AAC1E,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IACjC,qFAAqF;IACrF,EAAE,EAAE,SAAS,CAAC;IACd,4EAA4E;IAC5E,aAAa,EAAE,IAAI,CAAC;IACpB,oDAAoD;IACpD,QAAQ,EAAE,kBAAkB,CAAC;IAC7B;;;OAGG;IACH,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IA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BAAkB,GAAI,IAAI,SAAS,kBAAkB,EACjE,SAAS,uBAAuB,CAAC,IAAI,CAAC,KACpC,sBA8WF,CAAC"}
@@ -2,7 +2,7 @@
2
2
  * WebSocket JSON-RPC dispatch — the low-level WS transport binding.
3
3
  *
4
4
  * Most consumers should mount WS endpoints via `register_ws_endpoint`
5
- * (`./register_ws_endpoint.js`), which wraps this function with the standard
5
+ * (`actions/register_ws_endpoint.ts`), which wraps this function with the standard
6
6
  * upgrade stack (origin check + auth + optional role). This module stays
7
7
  * exported as the lower-level entry point for tests that drive the
8
8
  * dispatcher directly via `create_ws_test_harness`.
@@ -55,7 +55,7 @@ export const DEFAULT_SERVER_HEARTBEAT_TIMEOUT = 60_000;
55
55
  * - Per-action auth: `public` / `authenticated` pass through (upgrade auth
56
56
  * already verified identity); `keeper` requires `daemon_token` credential
57
57
  * type *and* the keeper role; role-based `{role}` requires the named role
58
- * via `has_role`, matching the HTTP path in `action_rpc.ts`.
58
+ * via `has_role`, matching the HTTP path in `actions/action_rpc.ts`.
59
59
  * - DEV mode validates handler output against the spec's `output` schema and
60
60
  * warns on mismatches.
61
61
  *
@@ -2,7 +2,7 @@
2
2
  * Account RPC action specs — declarative contract for self-service account
3
3
  * operations. Import this module for the specs, Input/Output schemas, and
4
4
  * the `all_account_action_specs` registry. Handlers live in
5
- * `./account_actions.js` so consumers doing typed-client codegen or surface
5
+ * `auth/account_actions.ts` so consumers doing typed-client codegen or surface
6
6
  * reporting don't transitively drag in server-only query code.
7
7
  *
8
8
  * @module
@@ -2,7 +2,7 @@
2
2
  * Account RPC action specs — declarative contract for self-service account
3
3
  * operations. Import this module for the specs, Input/Output schemas, and
4
4
  * the `all_account_action_specs` registry. Handlers live in
5
- * `./account_actions.js` so consumers doing typed-client codegen or surface
5
+ * `auth/account_actions.ts` so consumers doing typed-client codegen or surface
6
6
  * reporting don't transitively drag in server-only query code.
7
7
  *
8
8
  * @module
@@ -9,14 +9,14 @@
9
9
  * - API token management: `account_token_create`, `account_token_list`,
10
10
  * `account_token_revoke`.
11
11
  *
12
- * The action specs themselves live in `./account_action_specs.js`. Every spec
12
+ * The action specs themselves live in `auth/account_action_specs.ts`. Every spec
13
13
  * declares `auth: 'authenticated'` so the dispatcher enforces auth before the
14
14
  * handler runs. Revoke operations are account-scoped (via
15
15
  * `query_session_revoke_for_account` / `query_revoke_api_token_for_account`)
16
16
  * so passing another account's session or token id returns `revoked: false`
17
17
  * rather than revealing whether the id exists.
18
18
  *
19
- * Counterpart to `account_routes.ts`, which keeps the cookie-lifecycle flows
19
+ * Counterpart to `auth/account_routes.ts`, which keeps the cookie-lifecycle flows
20
20
  * (`login`, `logout`, `password`, `signup`, `bootstrap`) on REST.
21
21
  *
22
22
  * @module
@@ -9,14 +9,14 @@
9
9
  * - API token management: `account_token_create`, `account_token_list`,
10
10
  * `account_token_revoke`.
11
11
  *
12
- * The action specs themselves live in `./account_action_specs.js`. Every spec
12
+ * The action specs themselves live in `auth/account_action_specs.ts`. Every spec
13
13
  * declares `auth: 'authenticated'` so the dispatcher enforces auth before the
14
14
  * handler runs. Revoke operations are account-scoped (via
15
15
  * `query_session_revoke_for_account` / `query_revoke_api_token_for_account`)
16
16
  * so passing another account's session or token id returns `revoked: false`
17
17
  * rather than revealing whether the id exists.
18
18
  *
19
- * Counterpart to `account_routes.ts`, which keeps the cookie-lifecycle flows
19
+ * Counterpart to `auth/account_routes.ts`, which keeps the cookie-lifecycle flows
20
20
  * (`login`, `logout`, `password`, `signup`, `bootstrap`) on REST.
21
21
  *
22
22
  * @module
@@ -4,7 +4,7 @@
4
4
  * Returns `RouteSpec[]` — caller applies them to Hono via `apply_route_specs`.
5
5
  *
6
6
  * Four REST flows remain here; each has a concrete reason to stay REST
7
- * rather than moving to `account_actions.ts`:
7
+ * rather than moving to `auth/account_actions.ts`:
8
8
  *
9
9
  * - `POST /login` — issues a signed `Set-Cookie` and pre-handler rate-limits
10
10
  * by IP + per-canonical-account before password hashing.
@@ -15,7 +15,7 @@
15
15
  * callers should use the `account_verify` RPC action for the typed payload.
16
16
  *
17
17
  * Session listing/revocation and API token CRUD are on the RPC endpoint —
18
- * see `account_actions.ts`. Signup is in `signup_routes.ts`. Defaults are
18
+ * see `auth/account_actions.ts`. Signup is in `auth/signup_routes.ts`. Defaults are
19
19
  * closed/safe: accounts are created through bootstrap, admin action, or
20
20
  * invite.
21
21
  *
@@ -184,7 +184,7 @@ export type PasswordChangeOutput = z.infer<typeof PasswordChangeOutput>;
184
184
  *
185
185
  * The returned specs cover the three flows that stay REST after the RPC
186
186
  * migration (login, logout, password change). Self-service session/token
187
- * management and verify are on `account_actions.ts`.
187
+ * management and verify are on `auth/account_actions.ts`.
188
188
  *
189
189
  * @param deps - stateless capabilities (keyring, password, log)
190
190
  * @param options - per-factory configuration (session_options, ip_rate_limiter, login_account_rate_limiter)
@@ -4,7 +4,7 @@
4
4
  * Returns `RouteSpec[]` — caller applies them to Hono via `apply_route_specs`.
5
5
  *
6
6
  * Four REST flows remain here; each has a concrete reason to stay REST
7
- * rather than moving to `account_actions.ts`:
7
+ * rather than moving to `auth/account_actions.ts`:
8
8
  *
9
9
  * - `POST /login` — issues a signed `Set-Cookie` and pre-handler rate-limits
10
10
  * by IP + per-canonical-account before password hashing.
@@ -15,7 +15,7 @@
15
15
  * callers should use the `account_verify` RPC action for the typed payload.
16
16
  *
17
17
  * Session listing/revocation and API token CRUD are on the RPC endpoint —
18
- * see `account_actions.ts`. Signup is in `signup_routes.ts`. Defaults are
18
+ * see `auth/account_actions.ts`. Signup is in `auth/signup_routes.ts`. Defaults are
19
19
  * closed/safe: accounts are created through bootstrap, admin action, or
20
20
  * invite.
21
21
  *
@@ -167,7 +167,7 @@ export const PasswordChangeOutput = z.strictObject({
167
167
  *
168
168
  * The returned specs cover the three flows that stay REST after the RPC
169
169
  * migration (login, logout, password change). Self-service session/token
170
- * management and verify are on `account_actions.ts`.
170
+ * management and verify are on `auth/account_actions.ts`.
171
171
  *
172
172
  * @param deps - stateless capabilities (keyring, password, log)
173
173
  * @param options - per-factory configuration (session_options, ip_rate_limiter, login_account_rate_limiter)
@@ -4,7 +4,7 @@
4
4
  * Defines the runtime types for the fuz identity system:
5
5
  * `Account`, `Actor`, `Permit`, `AuthSession`, and `ApiToken`.
6
6
  *
7
- * DDL lives in `ddl.ts`; role system in `role_schema.ts`.
7
+ * DDL lives in `auth/ddl.ts`; role system in `auth/role_schema.ts`.
8
8
  * See docs/identity.md for design rationale.
9
9
  *
10
10
  * @module
@@ -4,7 +4,7 @@
4
4
  * Defines the runtime types for the fuz identity system:
5
5
  * `Account`, `Actor`, `Permit`, `AuthSession`, and `ApiToken`.
6
6
  *
7
- * DDL lives in `ddl.ts`; role system in `role_schema.ts`.
7
+ * DDL lives in `auth/ddl.ts`; role system in `auth/role_schema.ts`.
8
8
  * See docs/identity.md for design rationale.
9
9
  *
10
10
  * @module
@@ -2,7 +2,7 @@
2
2
  * Admin RPC action specs — declarative contract for admin-only operations.
3
3
  *
4
4
  * Import this module for the specs, Input/Output schemas, and the
5
- * `all_admin_action_specs` registry. Handlers live in `./admin_actions.js`.
5
+ * `all_admin_action_specs` registry. Handlers live in `auth/admin_actions.ts`.
6
6
  *
7
7
  * Authorization is declared at the spec level (`auth: {role: ROLE_ADMIN}`)
8
8
  * so the RPC dispatcher enforces admin before the handler runs and the
@@ -2,7 +2,7 @@
2
2
  * Admin RPC action specs — declarative contract for admin-only operations.
3
3
  *
4
4
  * Import this module for the specs, Input/Output schemas, and the
5
- * `all_admin_action_specs` registry. Handlers live in `./admin_actions.js`.
5
+ * `all_admin_action_specs` registry. Handlers live in `auth/admin_actions.ts`.
6
6
  *
7
7
  * Authorization is declared at the spec level (`auth: {role: ROLE_ADMIN}`)
8
8
  * so the RPC dispatcher enforces admin before the handler runs and the
@@ -11,13 +11,13 @@
11
11
  * when `AdminActionOptions.app_settings` is provided — the mutable ref is
12
12
  * owned by the server context and shared with signup middleware).
13
13
  *
14
- * The action specs themselves live in `./admin_action_specs.js`. Mutations
14
+ * The action specs themselves live in `auth/admin_action_specs.ts`. Mutations
15
15
  * emit matching audit events via `audit_log_fire_and_forget`.
16
16
  *
17
17
  * Authorization is declared at the spec level (`auth: {role: 'admin'}`) so
18
18
  * the RPC dispatcher enforces it before the handler runs and the generated
19
19
  * surface accurately reports the requirement. `permit_revoke` in
20
- * `permit_offer_actions.ts` uses the same spec-level pattern even though its
20
+ * `auth/permit_offer_actions.ts` uses the same spec-level pattern even though its
21
21
  * sibling methods are authenticated-but-not-admin — the dispatcher checks
22
22
  * auth per-spec, so mixed-auth endpoints compose cleanly. Handler-level
23
23
  * gates are reserved for input-dependent elevation (e.g.
@@ -11,13 +11,13 @@
11
11
  * when `AdminActionOptions.app_settings` is provided — the mutable ref is
12
12
  * owned by the server context and shared with signup middleware).
13
13
  *
14
- * The action specs themselves live in `./admin_action_specs.js`. Mutations
14
+ * The action specs themselves live in `auth/admin_action_specs.ts`. Mutations
15
15
  * emit matching audit events via `audit_log_fire_and_forget`.
16
16
  *
17
17
  * Authorization is declared at the spec level (`auth: {role: 'admin'}`) so
18
18
  * the RPC dispatcher enforces it before the handler runs and the generated
19
19
  * surface accurately reports the requirement. `permit_revoke` in
20
- * `permit_offer_actions.ts` uses the same spec-level pattern even though its
20
+ * `auth/permit_offer_actions.ts` uses the same spec-level pattern even though its
21
21
  * sibling methods are authenticated-but-not-admin — the dispatcher checks
22
22
  * auth per-spec, so mixed-auth endpoints compose cleanly. Handler-level
23
23
  * gates are reserved for input-dependent elevation (e.g.
@@ -4,7 +4,7 @@
4
4
  * Tokens use the format `secret_fuz_token_<base64url>` and are stored
5
5
  * as blake3 hashes. These are pure cryptographic operations with no
6
6
  * framework dependency — the bearer auth middleware that validates
7
- * tokens lives in `bearer_auth.ts`.
7
+ * tokens lives in `auth/bearer_auth.ts`.
8
8
  *
9
9
  * @module
10
10
  */
@@ -4,7 +4,7 @@
4
4
  * Tokens use the format `secret_fuz_token_<base64url>` and are stored
5
5
  * as blake3 hashes. These are pure cryptographic operations with no
6
6
  * framework dependency — the bearer auth middleware that validates
7
- * tokens lives in `bearer_auth.ts`.
7
+ * tokens lives in `auth/bearer_auth.ts`.
8
8
  *
9
9
  * @module
10
10
  */
@@ -2,7 +2,7 @@
2
2
  * Audit log SSE stream route.
3
3
  *
4
4
  * The two list-reads (`audit_log_list`, `audit_log_permit_history`) moved to
5
- * RPC in `admin_actions.ts`, and the admin session listing moved to
5
+ * RPC in `auth/admin_actions.ts`, and the admin session listing moved to
6
6
  * `admin_session_list` on the same file. What remains here is the optional
7
7
  * `GET /audit-log/stream` SSE route — streams aren't an action-kind, so they
8
8
  * stay on REST. The event payload broadcast on the stream surfaces via
@@ -2,7 +2,7 @@
2
2
  * Audit log SSE stream route.
3
3
  *
4
4
  * The two list-reads (`audit_log_list`, `audit_log_permit_history`) moved to
5
- * RPC in `admin_actions.ts`, and the admin session listing moved to
5
+ * RPC in `auth/admin_actions.ts`, and the admin session listing moved to
6
6
  * `admin_session_list` on the same file. What remains here is the optional
7
7
  * `GET /audit-log/stream` SSE route — streams aren't an action-kind, so they
8
8
  * stay on REST. The event payload broadcast on the stream surfaces via
@@ -242,7 +242,7 @@ export interface CreateAuditLogConfigOptions {
242
242
  *
243
243
  * Collisions with builtin event-type strings throw at construction.
244
244
  * Schemas are run via `safeParse` at insert time; mismatches log + count
245
- * but never throw (fail-open — see the drift counters in `audit_log_queries.ts`).
245
+ * but never throw (fail-open — see the drift counters in `auth/audit_log_queries.ts`).
246
246
  */
247
247
  extra_events?: Readonly<Record<string, z.ZodType | null>>;
248
248
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Pure auth operations with no I/O or state management.
5
5
  * The middleware, rotation, and persistence logic lives in
6
- * `daemon_token_middleware.ts`.
6
+ * `auth/daemon_token_middleware.ts`.
7
7
  *
8
8
  * @module
9
9
  */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Pure auth operations with no I/O or state management.
5
5
  * The middleware, rotation, and persistence logic lives in
6
- * `daemon_token_middleware.ts`.
6
+ * `auth/daemon_token_middleware.ts`.
7
7
  *
8
8
  * @module
9
9
  */
@@ -4,7 +4,7 @@
4
4
  * Manages the lifecycle of filesystem-resident daemon tokens: writing to disk,
5
5
  * rotation on an interval, and HTTP middleware for authentication.
6
6
  *
7
- * Pure token primitives (schema, generation, validation) live in `daemon_token.ts`.
7
+ * Pure token primitives (schema, generation, validation) live in `auth/daemon_token.ts`.
8
8
  * See docs/identity.md for design rationale.
9
9
  *
10
10
  * @module
@@ -4,7 +4,7 @@
4
4
  * Manages the lifecycle of filesystem-resident daemon tokens: writing to disk,
5
5
  * rotation on an interval, and HTTP middleware for authentication.
6
6
  *
7
- * Pure token primitives (schema, generation, validation) live in `daemon_token.ts`.
7
+ * Pure token primitives (schema, generation, validation) live in `auth/daemon_token.ts`.
8
8
  * See docs/identity.md for design rationale.
9
9
  *
10
10
  * @module
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Auth table DDL — CREATE TABLE, index, and seed statements.
3
3
  *
4
- * Consumed by `migrations.ts`. Separated from `account_schema.ts`
4
+ * Consumed by `auth/migrations.ts`. Separated from `auth/account_schema.ts`
5
5
  * to isolate DDL concerns from runtime types.
6
6
  *
7
7
  * @module
package/dist/auth/ddl.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Auth table DDL — CREATE TABLE, index, and seed statements.
3
3
  *
4
- * Consumed by `migrations.ts`. Separated from `account_schema.ts`
4
+ * Consumed by `auth/migrations.ts`. Separated from `auth/account_schema.ts`
5
5
  * to isolate DDL concerns from runtime types.
6
6
  *
7
7
  * @module
@@ -2,7 +2,7 @@
2
2
  * Password hashing type definitions.
3
3
  *
4
4
  * Defines the `PasswordHashDeps` injectable interface and `PASSWORD_LENGTH_MIN`.
5
- * Concrete Argon2id implementation lives in `password_argon2.ts`.
5
+ * Concrete Argon2id implementation lives in `auth/password_argon2.ts`.
6
6
  *
7
7
  * @module
8
8
  */
@@ -2,7 +2,7 @@
2
2
  * Password hashing type definitions.
3
3
  *
4
4
  * Defines the `PasswordHashDeps` injectable interface and `PASSWORD_LENGTH_MIN`.
5
- * Concrete Argon2id implementation lives in `password_argon2.ts`.
5
+ * Concrete Argon2id implementation lives in `auth/password_argon2.ts`.
6
6
  *
7
7
  * @module
8
8
  */
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Import this module for the specs, Input/Output schemas, `ERROR_OFFER_*`
6
6
  * reason constants, and the `all_permit_offer_action_specs` registry.
7
- * Handlers live in `./permit_offer_actions.js`.
7
+ * Handlers live in `auth/permit_offer_actions.ts`.
8
8
  *
9
9
  * Authorization enforcement: offer-lifecycle specs declare
10
10
  * `auth: 'authenticated'` and rely on `query_*` IDOR guards or in-handler
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Import this module for the specs, Input/Output schemas, `ERROR_OFFER_*`
6
6
  * reason constants, and the `all_permit_offer_action_specs` registry.
7
- * Handlers live in `./permit_offer_actions.js`.
7
+ * Handlers live in `auth/permit_offer_actions.ts`.
8
8
  *
9
9
  * Authorization enforcement: offer-lifecycle specs declare
10
10
  * `auth: 'authenticated'` and rely on `query_*` IDOR guards or in-handler
@@ -4,7 +4,7 @@
4
4
  * Seven actions: six offer-lifecycle methods (create / accept / decline /
5
5
  * retract / list / history) plus `permit_revoke` (admin-only). All mount
6
6
  * on a consumer's JSON-RPC endpoint via `create_rpc_endpoint`. The action
7
- * specs themselves live in `./permit_offer_action_specs.js`. Mutations
7
+ * specs themselves live in `auth/permit_offer_action_specs.ts`. Mutations
8
8
  * declare `side_effects: true` so the RPC dispatcher wraps the handler in
9
9
  * a DB transaction; `permit_offer_list` and `permit_offer_history` declare
10
10
  * `side_effects: false` so they are addressable via GET.
@@ -4,7 +4,7 @@
4
4
  * Seven actions: six offer-lifecycle methods (create / accept / decline /
5
5
  * retract / list / history) plus `permit_revoke` (admin-only). All mount
6
6
  * on a consumer's JSON-RPC endpoint via `create_rpc_endpoint`. The action
7
- * specs themselves live in `./permit_offer_action_specs.js`. Mutations
7
+ * specs themselves live in `auth/permit_offer_action_specs.ts`. Mutations
8
8
  * declare `side_effects: true` so the RPC dispatcher wraps the handler in
9
9
  * a DB transaction; `permit_offer_list` and `permit_offer_history` declare
10
10
  * `side_effects: false` so they are addressable via GET.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Maps `RouteAuth` discriminants to auth middleware handlers.
5
5
  * Injected into `apply_route_specs` to decouple the generic HTTP
6
- * framework (`route_spec.ts`) from auth-specific middleware.
6
+ * framework (`http/route_spec.ts`) from auth-specific middleware.
7
7
  *
8
8
  * @module
9
9
  */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Maps `RouteAuth` discriminants to auth middleware handlers.
5
5
  * Injected into `apply_route_specs` to decouple the generic HTTP
6
- * framework (`route_spec.ts`) from auth-specific middleware.
6
+ * framework (`http/route_spec.ts`) from auth-specific middleware.
7
7
  *
8
8
  * @module
9
9
  */
@@ -3,7 +3,7 @@
3
3
  * and the codegen-ready registry.
4
4
  *
5
5
  * Client-safe: no query-layer or audit-write imports. Handler factory
6
- * lives in `self_service_role_actions.ts`.
6
+ * lives in `auth/self_service_role_actions.ts`.
7
7
  *
8
8
  * @module
9
9
  */
@@ -3,7 +3,7 @@
3
3
  * and the codegen-ready registry.
4
4
  *
5
5
  * Client-safe: no query-layer or audit-write imports. Handler factory
6
- * lives in `self_service_role_actions.ts`.
6
+ * lives in `auth/self_service_role_actions.ts`.
7
7
  *
8
8
  * @module
9
9
  */
@@ -25,7 +25,7 @@
25
25
  * the existing `permit_offer_create({role})` precedent rather than
26
26
  * generating per-role methods.
27
27
  *
28
- * Specs and schemas live in `self_service_role_action_specs.ts` so
28
+ * Specs and schemas live in `auth/self_service_role_action_specs.ts` so
29
29
  * client-side codegen can import the surface without dragging in the
30
30
  * query layer.
31
31
  *
@@ -25,7 +25,7 @@
25
25
  * the existing `permit_offer_create({role})` precedent rather than
26
26
  * generating per-role methods.
27
27
  *
28
- * Specs and schemas live in `self_service_role_action_specs.ts` so
28
+ * Specs and schemas live in `auth/self_service_role_action_specs.ts` so
29
29
  * client-side codegen can import the surface without dragging in the
30
30
  * query layer.
31
31
  *
@@ -57,7 +57,7 @@ export declare const query_session_touch: (deps: QueryDeps, token_hash: string)
57
57
  * The `_unscoped` suffix is the safety signal — there is no `account_id`
58
58
  * constraint, so callers must guarantee the hash came from a trusted
59
59
  * source (the authenticated session cookie path is the only safe production
60
- * caller — see `account_routes.ts` `/logout`). For user-facing revocation
60
+ * caller — see `auth/account_routes.ts` `/logout`). For user-facing revocation
61
61
  * of a specific session by ID, use `query_session_revoke_for_account`
62
62
  * (IDOR-guarded).
63
63
  */
@@ -77,7 +77,7 @@ export const query_session_touch = async (deps, token_hash) => {
77
77
  * The `_unscoped` suffix is the safety signal — there is no `account_id`
78
78
  * constraint, so callers must guarantee the hash came from a trusted
79
79
  * source (the authenticated session cookie path is the only safe production
80
- * caller — see `account_routes.ts` `/logout`). For user-facing revocation
80
+ * caller — see `auth/account_routes.ts` `/logout`). For user-facing revocation
81
81
  * of a specific session by ID, use `query_session_revoke_for_account`
82
82
  * (IDOR-guarded).
83
83
  */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Public endpoint that creates an account. When `open_signup` is disabled
5
5
  * (default), a matching unclaimed invite is required. When enabled, anyone
6
- * can sign up without an invite. Follows the `bootstrap_routes.ts` pattern.
6
+ * can sign up without an invite. Follows the `auth/bootstrap_routes.ts` pattern.
7
7
  *
8
8
  * @module
9
9
  */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Public endpoint that creates an account. When `open_signup` is disabled
5
5
  * (default), a matching unclaimed invite is required. When enabled, anyone
6
- * can sign up without an invite. Follows the `bootstrap_routes.ts` pattern.
6
+ * can sign up without an invite. Follows the `auth/bootstrap_routes.ts` pattern.
7
7
  *
8
8
  * @module
9
9
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Aggregate spec list mirroring `create_standard_rpc_actions` on the backend.
3
3
  *
4
- * `create_standard_rpc_actions` (in `./standard_rpc_actions.js`) bundles three
4
+ * `create_standard_rpc_actions` (in `auth/standard_rpc_actions.ts`) bundles three
5
5
  * action registries into one mounted RPC surface: admin + permit_offer +
6
6
  * account. Frontends mounting that surface need the matching spec list to
7
7
  * feed `create_rpc_client` so the typed Proxy knows about every standard
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Aggregate spec list mirroring `create_standard_rpc_actions` on the backend.
3
3
  *
4
- * `create_standard_rpc_actions` (in `./standard_rpc_actions.js`) bundles three
4
+ * `create_standard_rpc_actions` (in `auth/standard_rpc_actions.ts`) bundles three
5
5
  * action registries into one mounted RPC surface: admin + permit_offer +
6
6
  * account. Frontends mounting that surface need the matching spec list to
7
7
  * feed `create_rpc_client` so the typed Proxy knows about every standard
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * CLI utilities for colors, confirmation, and command delegation.
3
3
  *
4
- * For structured CLI logging, see `create_cli_logger` in `logger.ts`.
4
+ * For structured CLI logging, see `create_cli_logger` in `cli/logger.ts`.
5
5
  *
6
6
  * @module
7
7
  */
package/dist/cli/util.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * CLI utilities for colors, confirmation, and command delegation.
3
3
  *
4
- * For structured CLI logging, see `create_cli_logger` in `logger.ts`.
4
+ * For structured CLI logging, see `create_cli_logger` in `cli/logger.ts`.
5
5
  *
6
6
  * @module
7
7
  */
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Both `pg` and `@electric-sql/pglite` are optional peer dependencies,
10
10
  * dynamically imported only when needed. For direct driver construction
11
- * without auto-detection, use `db_pg.ts` or `db_pglite.ts`.
11
+ * without auto-detection, use `db/db_pg.ts` or `db/db_pglite.ts`.
12
12
  *
13
13
  * @module
14
14
  */
@@ -29,7 +29,7 @@ export interface CreateDbResult {
29
29
  * know which driver is in use.
30
30
  *
31
31
  * For direct driver construction without URL routing, import
32
- * `create_pg_db` from `db_pg.ts` or `create_pglite_db` from `db_pglite.ts`.
32
+ * `create_pg_db` from `db/db_pg.ts` or `create_pglite_db` from `db/db_pglite.ts`.
33
33
  *
34
34
  * @param database_url - connection URL (`postgres://`, `postgresql://`, `file://`, or `memory://`)
35
35
  * @returns database instance, close callback, type, and display name