@jskit-ai/agent-docs 0.1.343 → 0.1.345

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 (42) hide show
  1. package/guide/agent/app-extras/realtime.md +31 -6
  2. package/guide/agent/app-setup/authentication.md +34 -2
  3. package/guide/agent/app-setup/initial-scaffolding.md +14 -3
  4. package/guide/agent/app-setup/more-than-one-server.md +4 -5
  5. package/guide/agent/app-setup/multi-homing.md +109 -17
  6. package/guide/agent/framework/data-access.md +3 -4
  7. package/guide/agent/framework/security-pass.md +5 -3
  8. package/package.json +1 -1
  9. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  10. package/patterns/minimal-foundation/example/package.json +3 -3
  11. package/patterns/shell-foundation/example/package.json +4 -4
  12. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  13. package/reference/autogen/PATTERN_INDEX.md +38 -38
  14. package/reference/autogen/packages/auth-provider-local-core.md +3 -3
  15. package/reference/autogen/packages/auth-provider-local-db-core.md +4 -0
  16. package/reference/autogen/packages/auth-web.md +13 -1
  17. package/reference/autogen/packages/kernel.md +7 -1
  18. package/reference/autogen/packages/realtime.md +1 -0
  19. package/reference/autogen/packages/workspaces-core.md +24 -8
  20. package/reference/autogen/packages/workspaces-web.md +25 -0
  21. package/skills/jskit/references/data-access.md +3 -4
  22. package/skills/jskit/references/multi-homing.md +109 -17
  23. package/skills/jskit/references/pattern-index.md +38 -38
  24. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +3 -3
  25. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +4 -4
  26. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  27. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  28. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  29. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  30. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
  31. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  32. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  33. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  34. package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +2 -0
  35. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  36. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  37. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  38. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  39. package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +26 -6
  40. package/skills/jskit/references/patterns/workspaces/workspace-surfaces/PATTERN.md +16 -5
  41. package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/composables/useWorkspaceNotFoundState.js +3 -2
  42. package/skills/jskit/references/security-pass.md +5 -3
@@ -181,18 +181,43 @@ missed events. There is no event journal, replay, or exactly-once guarantee.
181
181
  Keep one completion publisher beside the mutation owner; lifecycle progress
182
182
  events may still describe distinct intermediate states.
183
183
 
184
+ ## WebSocket only
185
+
186
+ Realtime connects over WebSocket only. `createSocketIoClient` and
187
+ `createSocketIoServer` (`@jskit-ai/realtime/client/runtime` and
188
+ `@jskit-ai/realtime/server/runtime`, which the providers use) set Socket.IO's
189
+ `transports` to `["websocket"]` whatever options they are given, as they fix
190
+ its `path` to `/socket.io`. Socket.IO's own default opens each connection with
191
+ HTTP long-polling, which names the connection's Engine.IO session id in the
192
+ address of every later request (`/socket.io/?EIO=4&transport=polling&sid=...`)
193
+ and of its upgrade to WebSocket. Request logs, the application's and any
194
+ proxy's, keep those addresses, and whoever reads one could poll that
195
+ connection's events while it lives; scanners report it as a session id in the
196
+ URL (OWASP ZAP rule 3, a failure in Google's CASA assessment). A WebSocket
197
+ carries the session id inside the connection, so no address names one.
198
+
199
+ The server refuses any other transport with a 400 answer,
200
+ `{"code":0,"message":"Transport unknown"}`. Socket.IO answers on the HTTP
201
+ server outside Fastify's hooks, so realtime gives its answers, such a refusal
202
+ and the 101 that opens a WebSocket, `X-Content-Type-Options: nosniff` and
203
+ `Cache-Control: no-store, no-cache, must-revalidate`, as API answers get.
204
+
205
+ Whatever runs in front of the application, a proxy, load balancer or edge,
206
+ must pass WebSocket upgrades on `/socket.io`; the realtime package's Vite
207
+ development proxy does (`ws: true`). Where a network blocks WebSockets,
208
+ realtime stays disconnected and Socket.IO keeps retrying with its backoff, by
209
+ default at most five seconds apart; pages and API calls work as before,
210
+ without live updates.
211
+
184
212
  ## Single process and Redis
185
213
 
186
214
  The in-process adapter is correct for one server process: an event reaches
187
215
  only the browsers connected to the process that published it. Set
188
216
  `REALTIME_REDIS_URL` only when multiple processes need a shared backplane, to
189
217
  the same Redis on every one; each then delivers every event to its own
190
- browsers. Socket.IO opens each connection with HTTP long-polling, whose
191
- requests must all reach the process that opened it: keep each browser on one
192
- process at the load balancer, or connect by WebSocket only with
193
- `realtimeClient: { options: { transports: ["websocket"] } }` in the app's
194
- public config. Credentials stay outside Git and never enter public client
195
- config. [Run on more than one server](/guide/app-setup/more-than-one-server)
218
+ browsers. Each browser's connection is one WebSocket, so the load balancer
219
+ needs no sticky sessions for it. Credentials stay outside Git and never enter
220
+ public client config. [Run on more than one server](/guide/app-setup/more-than-one-server)
196
221
  covers the rest of what several copies need.
197
222
 
198
223
  ## Shutdown
@@ -140,8 +140,14 @@ that email must wait 30 seconds before its next attempt; each further failure
140
140
  doubles the wait, up to an hour (NIST SP 800-63B's example). While it waits,
141
141
  sign-in is refused, even with the right password, with status 429, the code
142
142
  `auth.local.login.locked` (`params.count` minutes, `params.retryAfterSeconds`)
143
- and `Retry-After`. Emails without an account are counted the same way, so the
144
- wait says nothing about which accounts exist. A successful sign-in forgets the
143
+ and `Retry-After`: "Password sign-in for this email address is paused for 2
144
+ minutes after too many failed attempts. Try again after that." Emails without an
145
+ account are counted the same way, and the refusal names the email address,
146
+ never an account, so the wait says nothing about which accounts exist.
147
+ `DefaultLoginView` then shows the wait and, beside it, the other ways forward
148
+ the app offers: **Reset your password** where password recovery is set up,
149
+ **Create an account** where registration is open to this visitor, and its
150
+ provider buttons where providers are configured. A successful sign-in forgets the
145
151
  failures, and so does a day without one. Waits are temporary and password
146
152
  recovery is never blocked: completing a password reset ends the wait, so an
147
153
  attacker who keeps an account waiting cannot keep its owner out. The failures
@@ -878,6 +884,15 @@ Security behavior:
878
884
  email claim is refused.
879
885
  - `returnTo` must be on the application's own origin; anything else returns to
880
886
  `/`.
887
+ - A sign-in started from an invitation (`invitationToken` on
888
+ `GET /api/oauth/:provider/start`, which `DefaultLoginView` sends when its
889
+ address has one) keeps the token with its attempt. At the end the invitation
890
+ context resolver (workspace invitations, for example) resolves it for the
891
+ signed-in account, and profile synchronization receives the result, as a
892
+ registration's invitation is received, so provisioning knows the account came
893
+ from an invitation. An invitation the resolver refuses (used, expired,
894
+ withdrawn, or for another address where that matters) never fails the
895
+ sign-in, which continues as one with no invitation.
881
896
 
882
897
  A sign-in matches the provider subject first. Otherwise a verified email that
883
898
  matches an existing user signs that user in and links the provider identity,
@@ -941,6 +956,23 @@ shell found signed in at boot is shown no form: the page checks the session
941
956
  again and sends it on, and shows the form only if the session has ended. A
942
957
  confirmation link or a provider's callback still shows its own state.
943
958
 
959
+ A sign-in link may name the address to sign in with (`/auth/login?email=...`,
960
+ as an invitation's link names the invited one). That address fills the form
961
+ even where the browser remembers another account, which is not offered on that
962
+ visit and stays remembered for the next.
963
+
964
+ A provider sign-in returns to the one fixed `/auth/login` address, with
965
+ neither the page asked for nor the invitation. `DefaultLoginView` therefore
966
+ keeps `{ provider, returnTo, invitationToken }` in the starting tab's session
967
+ storage when it starts one, and reads it back on the callback. After a Cancel
968
+ at the provider or a failed sign-in, the page still returns to that page and
969
+ keeps the invitation, so starting again goes where the first attempt meant to
970
+ go. Where the browser refuses storage, sign-in works as before, without that
971
+ way back. Completing the callback (`POST /api/oauth/complete` and the session
972
+ read after it) is limited to 20 seconds. Past that, the page stops it, says
973
+ "Signing in with the provider took too long, so it was stopped. Try again.",
974
+ and offers **Try again with** the same provider, to the same page.
975
+
944
976
  Never restyle the views' own classes (`.login-screen`, `.auth-card`) or wrap
945
977
  them in a frame of the app's; the brand slot is the one way in.
946
978
 
@@ -131,6 +131,7 @@ these headers itself keeps its own value.
131
131
  | `Strict-Transport-Security` | staging, production | `max-age=31536000` |
132
132
  | `Content-Security-Policy: frame-ancestors` | staging, production | `'self'` |
133
133
  | `Content-Security-Policy-Report-Only` | staging, production | the content policy below |
134
+ | `Cache-Control` | API answers (under `/api`), always | `no-store, no-cache, must-revalidate` |
134
135
 
135
136
  Staging and production are `APP_ENV=staging` and `APP_ENV=production` (see
136
137
  [Environments](/guide/framework/environments)), which the host sets beside
@@ -139,6 +140,15 @@ npm start`. Development and test send only nosniff and the Referrer-Policy, so
139
140
  an editor's preview, such as Vibe64's, can frame the application and inject its
140
141
  bridge script.
141
142
 
143
+ API answers carry the signed-in person's data, such as the session and its CSRF
144
+ token, so no browser or proxy keeps them: each answer under `/api`, a failure
145
+ or a 404 included, gets `Cache-Control: no-store, no-cache, must-revalidate`
146
+ unless its route set its own Cache-Control, as a public logo that may be kept
147
+ for a day does. Socket.IO answers on the HTTP server outside Fastify's hooks;
148
+ `@jskit-ai/realtime` gives its answers, such as its refusal of a long-polling
149
+ request (it takes WebSocket only) and the 101 that opens a WebSocket,
150
+ `X-Content-Type-Options: nosniff` and the same Cache-Control.
151
+
142
152
  The content policy allows JSKIT's client: the application's own scripts and
143
153
  WebAssembly, inline styles (Vuetify and the loading shell use them), images
144
154
  from the application, `data:`, `blob:` and any HTTPS source, fonts and media
@@ -168,9 +178,10 @@ export const config = {
168
178
  };
169
179
  ```
170
180
 
171
- `noSniff: false`, `referrerPolicy: false`, `strictTransportSecurity: false` and
172
- `frameAncestors: false` leave that header out; `referrerPolicy` and
173
- `strictTransportSecurity` also take their own header value. A directive's
181
+ `noSniff: false`, `referrerPolicy: false`, `strictTransportSecurity: false`,
182
+ `frameAncestors: false` and `apiCacheControl: false` leave that header out;
183
+ `referrerPolicy`, `strictTransportSecurity` and `apiCacheControl` also take their
184
+ own header value. A directive's
174
185
  sources replace JSKIT's for that directive; framing is set only through
175
186
  `frameAncestors`. An invalid value stops the server from starting. A server
176
187
  composed without `createInstalledRuntime` calls
@@ -44,11 +44,10 @@ REALTIME_REDIS_URL=redis://redis.internal:6379
44
44
  REDIS_NAMESPACE=shop
45
45
  ```
46
46
 
47
- Socket.IO starts each connection with HTTP long-polling, whose requests must
48
- all reach the copy that opened it. Keep each browser on one copy at the load
49
- balancer (sticky sessions), or connect by WebSocket only with
50
- `realtimeClient: { options: { transports: ["websocket"] } }` in the app's
51
- public config.
47
+ Each browser's realtime connection is one WebSocket (realtime takes no
48
+ long-polling; see [WebSocket only](/guide/app-extras/realtime#websocket-only)),
49
+ so the load balancer needs no sticky sessions for it, only to pass WebSocket
50
+ upgrades on `/socket.io`.
52
51
 
53
52
  An assistant conversation's live progress reaches only the browsers connected
54
53
  to the copy running its turn, with or without Redis; a browser on another copy
@@ -43,6 +43,14 @@ In `workspaces` mode the product chooses one of two styles:
43
43
  - **Personal workspace plus shared workspaces** (`autoProvision: true`): every
44
44
  user, including people who signed up through an invitation, owns one personal
45
45
  workspace and can also join or create others.
46
+ - **A workspace for those who came on their own** (`autoProvision:
47
+ "unless-member"`): a sign-in gives the person a personal workspace only when
48
+ they are an active member of no workspace and the sign-in carries no
49
+ invitation. An account made from an invitation (registering through one, or a
50
+ provider sign-in started from one) gets none, and joins the inviting
51
+ workspace instead. A member of any workspace gets none either. An invitation
52
+ that cannot be used (expired, used, withdrawn) counts as none, so its person
53
+ still gets a workspace.
46
54
 
47
55
  ```js
48
56
  // config/public.js
@@ -105,8 +113,8 @@ The package migrations create and own these tables:
105
113
  | Table | Columns that applications use |
106
114
  | --- | --- |
107
115
  | `workspaces` | `id`, `slug` (unique), `name`, `owner_user_id`, `is_personal`, `avatar_url`, `deleted_at` |
108
- | `workspace_memberships` | `workspace_id`, `user_id`, `role_sid`, `status`; one row per workspace and user |
109
- | `workspace_settings` | One row per workspace keyed by `workspace_id`: the eight palette colours and `invites_enabled` |
116
+ | `workspace_memberships` | `workspace_id`, `user_id`, `role_sid`, `status`, `accepted_invite_id` (the invitation the member last joined through, null when none; set null when that invitation is deleted); one row per workspace and user |
117
+ | `workspace_settings` | One row per workspace keyed by `workspace_id`: the eight palette colours, `invites_enabled` and `invites_require_same_email` |
110
118
  | `workspace_invites` | `workspace_id`, `email`, `role_sid`, `status`, `token_hash`, `invited_by_user_id`, `expires_at`, `accepted_at`, `revoked_at` |
111
119
 
112
120
  Application records that belong to a workspace use a non-null `workspace_id`
@@ -167,11 +175,14 @@ router.register(
167
175
 
168
176
  Before the handler runs, the auth plugin resolves the slug for the signed-in
169
177
  user and sets `request.workspace`, `request.membership` (including `roleSid`
170
- and `status`) and `request.permissions`. An unknown slug returns 404 and a
171
- non-member receives 403, unless the route's `surface` uses an access policy with
172
- `requireWorkspaceMembership: false`. A route with `permission` returns 403 when
173
- the membership lacks it. Scope queries with `request.workspace.id`; never take a
174
- workspace id from request input.
178
+ and `status`) and `request.permissions`. An unknown slug and a workspace the
179
+ caller is not an active member of both return 404
180
+ `workspaces.workspace.notFound` ("Workspace not found."), so someone outside a
181
+ workspace can't tell it exists, unless the route's `surface` uses an access
182
+ policy with `requireWorkspaceMembership: false`. The bootstrap answers both the
183
+ same way: `requestedWorkspace` is `{ slug, status: "not_found" }`. A route with
184
+ `permission` returns 403 when the membership lacks it. Scope queries with
185
+ `request.workspace.id`; never take a workspace id from request input.
175
186
 
176
187
  ### Workspace services from another feature
177
188
 
@@ -196,7 +207,7 @@ method takes the call's `options` last and joins the transaction of the
196
207
  | Capability | Methods |
197
208
  | --- | --- |
198
209
  | `workspaces` | `findById(id, options)`, `findBySlug(slug, options)` (a deleted workspace is not found, though its slug stays taken), `listSlugsIn`, `findPersonalByOwnerUserId`, `listForUserId(userId, options)`, `insert`, `updateById`, `lock(workspaceId, options)`, `transferOwnership({ workspaceId, toUserId, previousOwnerRoleSid }, options)` |
199
- | `workspaces.memberships` | `findByWorkspaceIdAndUserId`, `ensureOwnerMembership`, `upsertMembership(workspaceId, userId, patch, options)`, `addMember({ workspaceId, userId, roleSid }, options)`, `activeMemberIds(workspaceId, options)`, `listActiveByWorkspaceId`, `findActiveByWorkspaceIdAndUserId`, `listActiveWorkspaceIdsByUserId`, `listActiveWorkspaceIdsByUserIds`, `listActiveWorkspaceIdsByUserIdsAmong(userIds, workspaceIds, options)`, `joinSource({ alias, filters }, options)` |
210
+ | `workspaces.memberships` | `findByWorkspaceIdAndUserId`, `ensureOwnerMembership`, `upsertMembership(workspaceId, userId, patch, options)`, `addMember({ workspaceId, userId, roleSid }, options)`, `activeMemberIds(workspaceId, options)`, `listActiveByWorkspaceId`, `findActiveByWorkspaceIdAndUserId`, `listActiveWorkspaceIdsByUserId`, `listActiveWorkspaceIdsByUserIds`, `listActiveWorkspaceIdsByUserIdsAmong(userIds, workspaceIds, options)`, `hasActiveMembership(userId, options)` (whether the user is an active member of any workspace, reading at most one membership), `joinSource({ alias, filters }, options)` |
200
211
 
201
212
  `addMember` makes the user an active member with the role (`member` when none
202
213
  is given), adding the membership or reactivating it. `activeMemberIds` answers
@@ -216,6 +227,12 @@ not interleave for one workspace takes turns; it runs only inside a
216
227
  transaction, given its `txOptions`, and answers `{ id }`, or `null` when there
217
228
  is no such workspace.
218
229
 
230
+ Each member summary (`listActiveByWorkspaceId`, `findActiveByWorkspaceIdAndUserId`, `listMembers`,
231
+ `listMembersPage`, `getMember` and the members list route) answers `invitedEmail`: the address of the invitation
232
+ the member last joined through when it is not their account's email, else `""`. The membership keeps a reference
233
+ to that invitation, not a copy of its address, and each acceptance replaces it, so a later invitation accepted with
234
+ the account's own address clears it.
235
+
219
236
  To check one person's membership, for example a notification recipient, call
220
237
  `workspaces.services.members.getMember(workspace, userId, options)`. It answers
221
238
  that member's `listMembers` entry, or `null` for a removed or unknown member,
@@ -257,6 +274,70 @@ application that keeps its own copy of workspace facts updates that copy from
257
274
  the answer. The method checks no permission: the application decides who may
258
275
  transfer a workspace before calling it.
259
276
 
277
+ ### Deleting a workspace
278
+
279
+ `workspaces.services.directory.deleteWorkspace(workspaceId, options)` deletes a
280
+ workspace in the caller's transaction when `options` carries one, otherwise in
281
+ a transaction of its own. The database's cascades take its memberships, settings
282
+ and invitations with it, and an application table whose `workspace_id` has no
283
+ cascade refuses the delete, which rolls the caller's transaction back. It
284
+ answers `true`, or `false` when there was no such workspace. Like
285
+ `transferOwnership` it publishes no event, calls no participant and checks no
286
+ permission: the application decides who may delete a workspace, and which
287
+ workspaces it may delete, before calling it. An acceptance participant may call
288
+ it, for example to remove the joining person's own untouched personal
289
+ workspace, inside the acceptance's transaction.
290
+
291
+ ### Who may accept an invitation
292
+
293
+ By default only the account whose email is the invited address may accept an
294
+ invitation (403 `workspaces.invite.emailMismatchUser` for any other).
295
+ `config.workspaceInvitations.anyAccount: true` lets any signed-in account holding
296
+ the link accept it, after saying so:
297
+
298
+ ```js
299
+ // config/server.js
300
+ config.workspaceInvitations = { enabled: true, anyAccount: true };
301
+ // Optional: whether new workspaces still require the invited address (default false).
302
+ config.workspaceSettings = { defaults: { invitesEnabled: true, invitesRequireSameEmail: false } };
303
+ ```
304
+
305
+ - The invited address, in any letter case, accepts as before.
306
+ - Another address in a workspace whose `invitesRequireSameEmail` setting is on
307
+ is refused with 403 `workspaces.invite.emailMismatchUser`.
308
+ - Another address in any other workspace must confirm: the redeem request's
309
+ `acceptAs` attribute names the signed-in account's email. Without it, or with
310
+ another value, redeeming answers 409 `workspaces.invite.differentEmailUnconfirmed`
311
+ (`params.email`, the account's address, and `params.maskedEmail`, the invited
312
+ one) and changes nothing.
313
+ - Refusing stays the invited address's alone, and an invitation is still used
314
+ once.
315
+
316
+ `GET /api/workspace/invitations/resolve` answers `requiresSameEmail`, true unless
317
+ another address may join. The invitation page (`/invite/:token`) shows another
318
+ address "This invitation was sent to i*****@example.com. You're signed in as
319
+ other@example.com." with **Join as other@example.com** and **Use a different
320
+ account** (sign out, then sign in, back to the invitation). Where only the invited
321
+ address may accept, it shows only **Use a different account**. Each workspace's
322
+ `invitesRequireSameEmail` is a workspace setting
323
+ (`PATCH /api/w/:workspaceSlug/settings`, permission `workspace.settings.update`).
324
+ Reads answer the effective value, which is always true while `anyAccount` is
325
+ off, and `invitesAnyAccountAvailable` says whether the application turned
326
+ `anyAccount` on.
327
+
328
+ The account signing in from such a link is not refused either: the invitation
329
+ context resolver gives a registration or a provider sign-in the invitation
330
+ whatever the account's address, unless its workspace requires the invited one.
331
+
332
+ After an acceptance by another address commits, the inviter is told: the
333
+ invitation mailer's optional `sendInviteAcceptedByOtherAddress(notice, options)`
334
+ receives `{ inviteId, invite: { id, email, roleSid }, inviter: { id, email,
335
+ displayName }, member: { id, email, displayName }, workspace: { id, slug, name },
336
+ locale, message }`, where `message` is the rendered `{ subject, text, html }`
337
+ (`jskit.workspaces.inviteAcceptedEmail.*`, in the inviter's saved locale). A mailer
338
+ without the method sends nothing. A failure is logged and never undoes the
339
+ acceptance. The environment's delivery rules apply as they do to invitations.
340
+
260
341
  ### Invitation email
261
342
 
262
343
  To send invitation email, provide the optional `workspaces.invite-mailer`
@@ -441,7 +522,7 @@ authorization and role checks. Do not pass arbitrary HTTP input as options.
441
522
  | `workspaces.services.members.prepareInvite(workspace, actor, payload, txOptions)` | Runs only inside a transaction, given its `txOptions`. Validates the invitation role, replaces pending invitations for that workspace/email, and returns `{ createdInviteId, inviteTokenPreview }`. Never sends. |
442
523
  | `workspaces.services.members.sendInvite(workspace, actor, prepared, options)` | Refuses to run inside a transaction: it delivers after the preparation's transaction commits. Reloads the committed pending invitation and workspace display data, validates expiry and token correspondence, and sends that invitation without replacement. |
443
524
  | `workspaces.services.members.createInvite(workspace, actor, payload, options)` | Owns preparation and commit, then calls `sendInvite`, and answers with `sendInvite`'s result as JSON:API data (`returnJsonApiData`, read it from `.value`), as the invite action sends it. Refuses to run inside a transaction. |
444
- | `workspaces.invite-acceptance-participant` (optional capability) | One application function receiving `({ invite, user }, options)` inside the acceptance transaction. Without it, acceptance activates the membership only. |
525
+ | `workspaces.invite-acceptance-participant` (optional capability) | One application function receiving `({ invite, user, workspace }, options)` inside the acceptance transaction: the invitation and the signed-in user as read, and the workspace's `{ id, slug, name, ownerUserId }`. Without it, acceptance activates the membership only. |
445
526
  | `workspaces.workspace-created-participant` (optional capability) | One application function receiving `({ workspace, owner }, options)` inside a new workspace's creation transaction. Without it, creation writes the workspace, its owner's membership and its settings only. |
446
527
 
447
528
  `sendInvite` accepts `{ createdInviteId, inviteTokenPreview }` from preparation or
@@ -536,7 +617,7 @@ exactly once. Revocation after sending starts cannot recall a message.
536
617
  Register one callback during feature setup to call the required application
537
618
  services. Non-functions throw `TypeError`; duplicate registration throws, and
538
619
  registration closes when acceptance/refusal first begins. The callback's invite,
539
- user and options are shallow frozen. JSKIT owns the transaction and passes the
620
+ user, workspace and options are shallow frozen. JSKIT owns the transaction and passes the
540
621
  callback the `txOptions` that carry it and the request's `context`.
541
622
 
542
623
  Acceptance checks authentication, recipient email, pending state and expiry under
@@ -559,10 +640,15 @@ participant. Acceptance and refusal refuse to run inside the caller's
559
640
  transaction; revocation can join one or open its own.
560
641
 
561
642
  Acceptance/refusal return 401 for unauthenticated access, 403 for a recipient
562
- email mismatch and 404 for a missing or handled invitation. A matching recipient's
563
- expired invitation is revoked and committed before returning 409 with
643
+ email mismatch, 409 `workspaces.invite.differentEmailUnconfirmed` for another
644
+ address that has not confirmed (see [Who may accept an invitation](#who-may-accept-an-invitation))
645
+ and 404 for a missing or handled invitation. An expired invitation is marked
646
+ `expired` and committed before returning 409 `workspaces.invite.expired` with
564
647
  `transactionOutcome: "committed"`, without activating membership or calling the
565
- participant. A failed revocation commit retains its transaction error. Delivery
648
+ participant. From then on it reads `expired` when resolved, and every later
649
+ accept or refuse answers the same 409. So does an invitation that a newer one to
650
+ the same address replaced. `revoked` means only that the workspace withdrew it.
651
+ A failed commit of the expiry retains its transaction error. Delivery
566
652
  returns 404 for missing, foreign or handled invitations, 409 for expiry and 400
567
653
  for a token mismatch.
568
654
 
@@ -632,13 +718,19 @@ the application's identity, training, permission, privacy and browser tests.
632
718
  ## Browser composition
633
719
 
634
720
  Use `workspaces/workspace-surfaces` for workspace selection, invitation landing,
635
- member administration, settings, not-found states, and semantic shell
721
+ member administration, settings, the unavailable state, and semantic shell
636
722
  placements.
637
723
 
638
724
  The route slug, selected workspace, query keys, and server scope stay aligned.
639
- Invalid workspace URLs show a deliberate not-found/forbidden state instead of
640
- silently selecting another workspace. The browser waits for the server's answer
641
- about an unknown slug before deciding, so the surface can show that state.
725
+ A workspace URL the server answers `not_found` (a slug no workspace has, or a
726
+ workspace the person is not in) opens the application's Not found page, the
727
+ `notFoundComponent` given to `createShellRouter`, at that same address, with
728
+ none of the workspace's layout or screens and none of their requests: the
729
+ shell's first bootstrap names the workspace the tab opened on, and the shell
730
+ guard opens the Not found page before any of its pages. A move to a workspace
731
+ the person is not listed in, from a link inside the application, opens its page
732
+ while the bootstrap for it is on its way, then the Not found page once the
733
+ server answers.
642
734
  The bootstrap answer, which carries the workspace and the person's permissions
643
735
  in it, belongs to the workspace, not to a page: it still applies when the
644
736
  person has moved to another page of the same workspace before it arrives, and a
@@ -1554,10 +1554,9 @@ const SettlementFeature = defineFeature({
1554
1554
  `memberContext` resolves the member as their request on a `workspace_user`
1555
1555
  route does, by the same reads: the workspace, their active membership (the
1556
1556
  owner's ensured), their role's permissions and the settings. It refuses as
1557
- that request does: a missing or deleted workspace is 404
1558
- `workspaces.workspace.notFound`, and a user who is no active member of it
1559
- (removed, inactive, never one, or no user) 403
1560
- `workspaces.workspace.accessDenied`. The context signs the member in, unlike
1557
+ that request does: a missing or deleted workspace, and a user who is no
1558
+ active member of it (removed, inactive, never one, or no user), are 404
1559
+ `workspaces.workspace.notFound`. The context signs the member in, unlike
1561
1560
  `{ actorId }`: `resolveActorId` answers them, an action checks their
1562
1561
  permissions, a row policy is told `caller.kind` "user", request row limits
1563
1562
  apply and other owners' hidden fields stay hidden. Its scope is the workspace
@@ -25,8 +25,9 @@ a JSKIT app. The rules it applies are already in [Typed features](/guide/framewo
25
25
  public route public on purpose.
26
26
  - A workspace route registers under `/api/w/:workspaceSlug/...` with
27
27
  `contextPolicy: "required"`: the server resolves the workspace and the
28
- caller's membership from the slug and the session, and answers 404 or 403
29
- before the handler runs
28
+ caller's membership from the slug and the session, and answers 404 before
29
+ the handler runs, alike for a slug no workspace has and a workspace the
30
+ caller is not in, so the answer never says a workspace exists
30
31
  ([Workspace-scoped features and routes](/guide/app-setup/multi-homing#workspace-scoped-features-and-routes)).
31
32
  - A surface's access policy guards pages in the browser only; the server reads
32
33
  just `requireWorkspaceMembership: false` from it. A page hidden by
@@ -129,7 +130,8 @@ a JSKIT app. The rules it applies are already in [Typed features](/guide/framewo
129
130
  every write ([Tests](/guide/framework/data-access#tests)).
130
131
  - Send each attack and expect its refusal: no session (401
131
132
  `auth.session.required`), a member without the route's permission (403), a
132
- slug of a workspace the caller is not in (403), another workspace's record id
133
+ slug of a workspace the caller is not in (404, the same answer as a slug no
134
+ workspace has), another workspace's record id
133
135
  and `workspaceId` in the body (refused, or answered in the caller's own
134
136
  workspace), a write without `csrf-token`, and one request past each
135
137
  `rateLimit` (429). A body that does not validate, sent without a session,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/agent-docs",
3
- "version": "0.1.343",
3
+ "version": "0.1.345",
4
4
  "description": "Distributed JSKIT agent references, prompts, guides, and generated reference maps.",
5
5
  "type": "module",
6
6
  "files": [
@@ -5,7 +5,7 @@
5
5
  "private": true,
6
6
  "type": "module",
7
7
  "dependencies": {
8
- "@jskit-ai/kernel": "0.2.29",
8
+ "@jskit-ai/kernel": "0.2.31",
9
9
  "json-rest-schema": "^1.0.20"
10
10
  },
11
11
  "exports": {
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@local/main": "0.1.0",
36
36
  "@fastify/static": "^10.1.3",
37
- "@jskit-ai/kernel": "0.2.29",
37
+ "@jskit-ai/kernel": "0.2.31",
38
38
  "@jskit-ai/material-web": "0.1.9",
39
39
  "@tanstack/vue-query": "^5.101.0",
40
40
  "fastify": "^5.12.7",
@@ -44,13 +44,13 @@
44
44
  "vue": "^3.5.44",
45
45
  "vue-router": "^5.3.1",
46
46
  "vuetify": "^4.3.0",
47
- "@jskit-ai/http-runtime": "0.2.29",
47
+ "@jskit-ai/http-runtime": "0.2.31",
48
48
  "@fastify/fast-json-stringify-compiler": "^5.1.0",
49
49
  "@vue/devtools-api": "^8.2.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@jskit-ai/config-eslint": "0.1.252",
53
- "@jskit-ai/jskit-catalog": "0.2.95",
53
+ "@jskit-ai/jskit-catalog": "0.2.97",
54
54
  "@playwright/test": "1.61.1",
55
55
  "@vitejs/plugin-vue": "^6.0.7",
56
56
  "eslint": "^10.8.0",
@@ -34,7 +34,7 @@
34
34
  "dependencies": {
35
35
  "@local/main": "0.1.0",
36
36
  "@fastify/static": "^10.1.3",
37
- "@jskit-ai/kernel": "0.2.29",
37
+ "@jskit-ai/kernel": "0.2.31",
38
38
  "@jskit-ai/material-web": "0.1.9",
39
39
  "@tanstack/vue-query": "^5.101.0",
40
40
  "fastify": "^5.12.7",
@@ -44,14 +44,14 @@
44
44
  "vue": "^3.5.44",
45
45
  "vue-router": "^5.3.1",
46
46
  "vuetify": "^4.3.0",
47
- "@jskit-ai/http-runtime": "0.2.29",
48
- "@jskit-ai/shell-web": "0.2.45",
47
+ "@jskit-ai/http-runtime": "0.2.31",
48
+ "@jskit-ai/shell-web": "0.2.47",
49
49
  "@fastify/fast-json-stringify-compiler": "^5.1.0",
50
50
  "@vue/devtools-api": "^8.2.1"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@jskit-ai/config-eslint": "0.1.252",
54
- "@jskit-ai/jskit-catalog": "0.2.95",
54
+ "@jskit-ai/jskit-catalog": "0.2.97",
55
55
  "@playwright/test": "1.61.1",
56
56
  "@vitejs/plugin-vue": "^6.0.7",
57
57
  "eslint": "^10.8.0",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "description": "App-local runtime composition and lightweight glue.",
11
11
  "dependencies": {
12
- "@jskit-ai/kernel": "0.2.29"
12
+ "@jskit-ai/kernel": "0.2.31"
13
13
  },
14
14
  "jskit": {
15
15
  "kind": "runtime",