@jskit-ai/agent-docs 0.1.344 → 0.1.346

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 (37) 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 +24 -6
  4. package/guide/agent/app-setup/more-than-one-server.md +4 -5
  5. package/guide/agent/app-setup/multi-homing.md +91 -8
  6. package/package.json +1 -1
  7. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  8. package/patterns/minimal-foundation/example/package.json +3 -3
  9. package/patterns/shell-foundation/example/package.json +4 -4
  10. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  11. package/reference/autogen/PATTERN_INDEX.md +38 -38
  12. package/reference/autogen/packages/assistant-core.md +1 -1
  13. package/reference/autogen/packages/auth-provider-local-core.md +3 -3
  14. package/reference/autogen/packages/auth-provider-local-db-core.md +4 -0
  15. package/reference/autogen/packages/auth-web.md +13 -1
  16. package/reference/autogen/packages/kernel.md +7 -1
  17. package/reference/autogen/packages/realtime.md +1 -0
  18. package/reference/autogen/packages/workspaces-core.md +23 -8
  19. package/reference/autogen/packages/workspaces-web.md +13 -0
  20. package/skills/jskit/references/multi-homing.md +91 -8
  21. package/skills/jskit/references/pattern-index.md +38 -38
  22. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +3 -3
  23. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +4 -4
  24. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  25. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  26. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  27. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  28. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
  29. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  30. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  31. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  32. package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +2 -0
  33. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  34. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  35. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  36. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  37. package/skills/jskit/references/patterns/workspaces/workspace-server/PATTERN.md +26 -6
@@ -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,13 +178,21 @@ 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
- `frameAncestors`. An invalid value stops the server from starting. A server
176
- composed without `createInstalledRuntime` calls
177
- `registerSecurityHeaders(fastify, { config, env })` from
186
+ `frameAncestors`. An invalid value stops the server from starting.
187
+
188
+ A server whose installed packages' providers were collected when it was built,
189
+ such as a single-file release bundle with no `node_modules` to read, starts
190
+ `createStaticInstalledRuntime` from `@jskit-ai/kernel/server/platform` in place
191
+ of `createInstalledRuntime`, with the build's registry as
192
+ `installed: { providers, packageOrder, providerPackageOrder, globalUiPaths }`.
193
+ It is the same runtime: the same APP_ENV check, security headers, environment
194
+ page tag, startup line and health runtime. A server composed without either
195
+ calls `registerSecurityHeaders(fastify, { config, env })` from
178
196
  `@jskit-ai/kernel/server/http` before it registers any plugin.
179
197
 
180
198
  ## Verification
@@ -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`
@@ -199,7 +207,7 @@ method takes the call's `options` last and joins the transaction of the
199
207
  | Capability | Methods |
200
208
  | --- | --- |
201
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)` |
202
- | `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)` |
203
211
 
204
212
  `addMember` makes the user an active member with the role (`member` when none
205
213
  is given), adding the membership or reactivating it. `activeMemberIds` answers
@@ -219,6 +227,12 @@ not interleave for one workspace takes turns; it runs only inside a
219
227
  transaction, given its `txOptions`, and answers `{ id }`, or `null` when there
220
228
  is no such workspace.
221
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
+
222
236
  To check one person's membership, for example a notification recipient, call
223
237
  `workspaces.services.members.getMember(workspace, userId, options)`. It answers
224
238
  that member's `listMembers` entry, or `null` for a removed or unknown member,
@@ -260,6 +274,70 @@ application that keeps its own copy of workspace facts updates that copy from
260
274
  the answer. The method checks no permission: the application decides who may
261
275
  transfer a workspace before calling it.
262
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
+
263
341
  ### Invitation email
264
342
 
265
343
  To send invitation email, provide the optional `workspaces.invite-mailer`
@@ -444,7 +522,7 @@ authorization and role checks. Do not pass arbitrary HTTP input as options.
444
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. |
445
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. |
446
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. |
447
- | `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. |
448
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. |
449
527
 
450
528
  `sendInvite` accepts `{ createdInviteId, inviteTokenPreview }` from preparation or
@@ -539,7 +617,7 @@ exactly once. Revocation after sending starts cannot recall a message.
539
617
  Register one callback during feature setup to call the required application
540
618
  services. Non-functions throw `TypeError`; duplicate registration throws, and
541
619
  registration closes when acceptance/refusal first begins. The callback's invite,
542
- 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
543
621
  callback the `txOptions` that carry it and the request's `context`.
544
622
 
545
623
  Acceptance checks authentication, recipient email, pending state and expiry under
@@ -562,10 +640,15 @@ participant. Acceptance and refusal refuse to run inside the caller's
562
640
  transaction; revocation can join one or open its own.
563
641
 
564
642
  Acceptance/refusal return 401 for unauthenticated access, 403 for a recipient
565
- email mismatch and 404 for a missing or handled invitation. A matching recipient's
566
- 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
567
647
  `transactionOutcome: "committed"`, without activating membership or calling the
568
- 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
569
652
  returns 404 for missing, foreign or handled invitations, 409 for expiry and 400
570
653
  for a token mismatch.
571
654
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/agent-docs",
3
- "version": "0.1.344",
3
+ "version": "0.1.346",
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.30",
8
+ "@jskit-ai/kernel": "0.2.32",
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.30",
37
+ "@jskit-ai/kernel": "0.2.32",
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.30",
47
+ "@jskit-ai/http-runtime": "0.2.32",
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.96",
53
+ "@jskit-ai/jskit-catalog": "0.2.98",
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.30",
37
+ "@jskit-ai/kernel": "0.2.32",
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.30",
48
- "@jskit-ai/shell-web": "0.2.46",
47
+ "@jskit-ai/http-runtime": "0.2.32",
48
+ "@jskit-ai/shell-web": "0.2.48",
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.96",
54
+ "@jskit-ai/jskit-catalog": "0.2.98",
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.30"
12
+ "@jskit-ai/kernel": "0.2.32"
13
13
  },
14
14
  "jskit": {
15
15
  "kind": "runtime",