@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
@@ -7,11 +7,11 @@
7
7
  "db:migrate:status": "knex --knexfile ./knexfile.js migrate:list"
8
8
  },
9
9
  "dependencies": {
10
- "@jskit-ai/connectors-core": "0.2.46",
11
- "@jskit-ai/connector-google-calendar": "0.2.46",
12
- "@jskit-ai/database-runtime": "0.1.279",
13
- "@jskit-ai/database-runtime-mysql": "0.1.277",
14
- "@jskit-ai/kernel": "0.2.29",
10
+ "@jskit-ai/connectors-core": "0.2.48",
11
+ "@jskit-ai/connector-google-calendar": "0.2.48",
12
+ "@jskit-ai/database-runtime": "0.1.281",
13
+ "@jskit-ai/database-runtime-mysql": "0.1.279",
14
+ "@jskit-ai/kernel": "0.2.31",
15
15
  "knex": "^3.1.0"
16
16
  }
17
17
  }
@@ -9,9 +9,9 @@
9
9
  "./shared": "./src/shared/index.js"
10
10
  },
11
11
  "dependencies": {
12
- "@jskit-ai/crud-core": "0.2.47",
13
- "@jskit-ai/resource-core": "0.1.220",
14
- "@jskit-ai/resource-crud-core": "0.1.222"
12
+ "@jskit-ai/crud-core": "0.2.49",
13
+ "@jskit-ai/resource-core": "0.1.222",
14
+ "@jskit-ai/resource-crud-core": "0.1.224"
15
15
  },
16
16
  "jskit": {
17
17
  "kind": "runtime",
@@ -9,7 +9,7 @@
9
9
  "test": "jskit test --databases"
10
10
  },
11
11
  "dependencies": {
12
- "@jskit-ai/database-runtime": "0.1.279",
13
- "@jskit-ai/database-runtime-mysql": "0.1.277"
12
+ "@jskit-ai/database-runtime": "0.1.281",
13
+ "@jskit-ai/database-runtime-mysql": "0.1.279"
14
14
  }
15
15
  }
@@ -9,7 +9,7 @@
9
9
  "test": "jskit test --databases"
10
10
  },
11
11
  "dependencies": {
12
- "@jskit-ai/database-runtime": "0.1.279",
13
- "@jskit-ai/database-runtime-postgres": "0.1.276"
12
+ "@jskit-ai/database-runtime": "0.1.281",
13
+ "@jskit-ai/database-runtime-postgres": "0.1.278"
14
14
  }
15
15
  }
@@ -34,6 +34,8 @@ staging or production needs a Redis backplane.
34
34
  - Event payloads do not become an undocumented second API.
35
35
  - Socket.IO owns `/socket.io`; other WebSocket routes keep their own upgrade
36
36
  and access-check lifecycle without Socket.IO's one-second cleanup timeout.
37
+ - Realtime connects over WebSocket only, so no address carries its session id;
38
+ whatever runs in front of the app passes WebSocket upgrades on `/socket.io`.
37
39
 
38
40
  ## Framework APIs
39
41
 
@@ -2,7 +2,7 @@
2
2
  "private": true,
3
3
  "type": "module",
4
4
  "dependencies": {
5
- "@jskit-ai/realtime": "0.2.48",
6
- "@jskit-ai/shell-web": "0.2.45"
5
+ "@jskit-ai/realtime": "0.2.50",
6
+ "@jskit-ai/shell-web": "0.2.47"
7
7
  }
8
8
  }
@@ -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": {
@@ -10,9 +10,9 @@
10
10
  "./shared": "./src/shared/index.js"
11
11
  },
12
12
  "dependencies": {
13
- "@jskit-ai/crud-core": "0.2.47",
14
- "@jskit-ai/resource-crud-core": "0.1.222",
15
- "@jskit-ai/users-core": "0.2.57"
13
+ "@jskit-ai/crud-core": "0.2.49",
14
+ "@jskit-ai/resource-crud-core": "0.1.224",
15
+ "@jskit-ai/users-core": "0.2.59"
16
16
  },
17
17
  "jskit": {
18
18
  "kind": "runtime",
@@ -10,14 +10,14 @@
10
10
  "./shared": "./src/shared/index.js"
11
11
  },
12
12
  "dependencies": {
13
- "@jskit-ai/crud-core": "0.2.47",
14
- "@jskit-ai/resource-crud-core": "0.1.222",
15
- "@jskit-ai/users-core": "0.2.57",
16
- "@jskit-ai/workspaces-core": "0.2.57"
13
+ "@jskit-ai/crud-core": "0.2.49",
14
+ "@jskit-ai/resource-crud-core": "0.1.224",
15
+ "@jskit-ai/users-core": "0.2.59",
16
+ "@jskit-ai/workspaces-core": "0.2.59"
17
17
  },
18
18
  "peerDependencies": {
19
- "@jskit-ai/kernel": "0.2.29",
20
- "@jskit-ai/resource-runtime": "0.2.43"
19
+ "@jskit-ai/kernel": "0.2.31",
20
+ "@jskit-ai/resource-runtime": "0.2.45"
21
21
  },
22
22
  "jskit": {
23
23
  "kind": "runtime",
@@ -24,11 +24,21 @@ Choose workspace creation policy, roles, invitation policy, expiry, email copy,
24
24
  member permissions, personal-workspace behavior, and surface access rules.
25
25
 
26
26
  In `workspaces` mode, `tenancyPolicy.workspace.autoProvision: true` gives every
27
- user a personal workspace in addition to shared ones; the optional
27
+ user a personal workspace in addition to shared ones, and `"unless-member"` only
28
+ to someone in no workspace who signs in without an invitation; the optional
28
29
  `workspaces.personal-workspace-name` capability, a function of the user, names it. `workspaceSettings.defaults` sets
29
- `invitesEnabled` and the colours (`lightPrimaryColor`, `darkPrimaryColor` and
30
+ `invitesEnabled`, `invitesRequireSameEmail` and the colours (`lightPrimaryColor`, `darkPrimaryColor` and
30
31
  the other palette fields) that new workspaces start with.
31
32
 
33
+ Decide who may accept an invitation: by default only the invited address.
34
+ `workspaceInvitations.anyAccount: true` lets any signed-in account holding the
35
+ link join after confirming (`acceptAs`, else 409
36
+ `workspaces.invite.differentEmailUnconfirmed`), except in a workspace whose
37
+ `invitesRequireSameEmail` setting is on (403 `workspaces.invite.emailMismatchUser`).
38
+ Members then show `invitedEmail`, the address they were invited at, and the
39
+ mailer's optional `sendInviteAcceptedByOtherAddress` tells the inviter after
40
+ commit.
41
+
32
42
  ## Framework APIs
33
43
 
34
44
  Use workspace routes, resources, scope helpers, tenancy profiles, and settings
@@ -84,7 +94,7 @@ catalogue entries. Updating labels requires no database migration.
84
94
  Provide one function as the optional `workspaces.invite-acceptance-participant`
85
95
  capability, from a small application feature that requires only what its writes
86
96
  need (it cannot require `workspaces.core`, which receives it). The built-in
87
- `workspace.invite.redeem` action invokes `fn({ invite, user }, txOptions)`
97
+ `workspace.invite.redeem` action invokes `fn({ invite, user, workspace }, txOptions)`
88
98
  after validating the recipient, state and expiry and activating membership in the
89
99
  uncommitted transaction. Pass `txOptions` to every application owner's calls and
90
100
  propagate failures. JSKIT marks accepted and commits after the function succeeds. Keep
@@ -124,7 +134,8 @@ transactional creation; put related acceptance writes in the participant. Revoca
124
134
  a managed transaction. Raw Knex/savepoint transactions cannot own resource
125
135
  writes. Invitation mutations lock workspace then invitation rows, revalidate
126
136
  current state and reject changes to accepted/revoked invitations. Expiry rejection
127
- for the matching recipient commits revocation before returning 409. Preserve transaction
137
+ commits the invitation as `expired` before returning 409, and it stays `expired`
138
+ (`revoked` is only a workspace's withdrawal). Preserve transaction
128
139
  outcomes and causes; a completion-hook error after commit cannot undo writes.
129
140
 
130
141
  See the human guide's **Workspace tenancy → Transactional invitation
@@ -169,7 +180,14 @@ setup({ env }) {
169
180
 
170
181
  Without a renderer, workspaces-core uses its built-in email; without a mailer,
171
182
  invitations are created and their delivery reports `mailer_unconfigured`. The
172
- feature must not require `workspaces.core`, which receives both.
183
+ feature must not require `workspaces.core`, which receives both. A mailer may
184
+ also have `sendInviteAcceptedByOtherAddress(notice, options)`, which tells the
185
+ inviter, after the acceptance commits, that another address accepted their
186
+ invitation; a failure is logged and never undoes the acceptance.
187
+
188
+ `services.directory.deleteWorkspace(workspaceId, options)` deletes a workspace in
189
+ the caller's transaction (cascading its memberships, settings and invitations),
190
+ answers `false` for a missing one, publishes no event and checks no permission.
173
191
 
174
192
  ## Variation points
175
193
 
@@ -179,7 +197,9 @@ ids, and product-specific workspace settings.
179
197
  ## Verification
180
198
 
181
199
  Test create/list/select, member and non-member access, each role boundary,
182
- invitation expiry/redemption, cross-workspace isolation, and email output.
200
+ invitation expiry/redemption, acceptance by another address where `anyAccount`
201
+ is on (confirmed, unconfirmed and in a workspace requiring the invited address),
202
+ cross-workspace isolation, and email output.
183
203
 
184
204
  ## Avoid
185
205
 
@@ -22,7 +22,12 @@ surface tree when only one workspace widget is needed.
22
22
 
23
23
  Choose public invitation routes, application/admin surface ids, workspace
24
24
  selector behavior, member-management permissions, settings sections, and the
25
- empty or not-found experience.
25
+ empty or unavailable experience. A workspace URL the server answers not found
26
+ (a slug no workspace has, or a workspace the person is not in: the server
27
+ answers both alike) opens the application's Not found page, the
28
+ `notFoundComponent` given to `createShellRouter`, at that address; give it a
29
+ way home. The unavailable state covers what is left: a signed-out session or a
30
+ bootstrap that failed.
26
31
 
27
32
  Choose where signed-in people land. The default surface does not require a
28
33
  workspace, so `/`, invitation links and the **Your workspaces** page work
@@ -39,6 +44,8 @@ Use the workspace client provider, components, and composables exported by
39
44
  ## Invariants
40
45
 
41
46
  - Route workspace slug, selected workspace, and server scope stay synchronized.
47
+ - A workspace the person can't see shows the Not found page, never the
48
+ workspace's layout, screens or requests.
42
49
  - Route and surface pages do not add a page header or standalone heading by
43
50
  default.
44
51
  - Invitation acceptance is public only where the server contract permits it.
@@ -51,7 +58,7 @@ Use the workspace client provider, components, and composables exported by
51
58
 
52
59
  `example/` contains workspace app/admin roots, starter pages, invitation route,
53
60
  the **Your workspaces** page at `src/pages/home/workspaces/index.vue`, member
54
- and settings routes, not-found state, app-owned invitation widgets, and the
61
+ and settings routes, the unavailable state, app-owned invitation widgets, and the
55
62
  components that an application's client provider registers.
56
63
 
57
64
  `example/src/surfaces/<surface>/` and `example/src/pages/admin/` are each
@@ -73,13 +80,17 @@ guide's **Workspace tenancy → Surfaces and where `/` lands**.
73
80
  ## Variation points
74
81
 
75
82
  Change surfaces, routes, section owners, labels, icons, placement order,
76
- workspace-not-found copy, member operations, and invitation presentation.
83
+ the Not found page's and the unavailable state's copy, member operations, and
84
+ invitation presentation.
77
85
 
78
86
  ## Verification
79
87
 
80
88
  Exercise direct workspace URLs, selection and switching, invitations, members,
81
- settings, not-found state, browser back/forward, forbidden access, and all
82
- responsive navigation variants.
89
+ settings, browser back/forward and all responsive navigation variants. Open a
90
+ workspace URL that doesn't exist and one of a workspace the person is not in,
91
+ at the root and on a sub-page: each shows the Not found page at that address,
92
+ with no workspace navigation and no request for the workspace's data, and its
93
+ way home works.
83
94
 
84
95
  ## Avoid
85
96
 
@@ -3,9 +3,10 @@ import { useRoute } from "vue-router";
3
3
  import { normalizeLowerText, normalizeObject } from "@jskit-ai/kernel/shared/support/normalize";
4
4
  import { useWebPlacementContext } from "@jskit-ai/shell-web/client/placement";
5
5
 
6
+ // A workspace the server answers not_found (or forbidden, from an older server) never reaches the surface's pages: the
7
+ // shell opens the application's Not found page at its address instead. What is left is a signed-out session or a
8
+ // bootstrap that failed.
6
9
  const STATUS_MESSAGES = {
7
- not_found: "The requested workspace was not found.",
8
- forbidden: "You do not have access to this workspace.",
9
10
  unauthenticated: "You need to sign in to access this workspace.",
10
11
  error: "Workspace data could not be loaded right now."
11
12
  };
@@ -20,8 +20,9 @@ a JSKIT app. The rules it applies are already in [Typed features](typed-features
20
20
  public route public on purpose.
21
21
  - A workspace route registers under `/api/w/:workspaceSlug/...` with
22
22
  `contextPolicy: "required"`: the server resolves the workspace and the
23
- caller's membership from the slug and the session, and answers 404 or 403
24
- before the handler runs
23
+ caller's membership from the slug and the session, and answers 404 before
24
+ the handler runs, alike for a slug no workspace has and a workspace the
25
+ caller is not in, so the answer never says a workspace exists
25
26
  ([Workspace-scoped features and routes](multi-homing.md#workspace-scoped-features-and-routes)).
26
27
  - A surface's access policy guards pages in the browser only; the server reads
27
28
  just `requireWorkspaceMembership: false` from it. A page hidden by
@@ -124,7 +125,8 @@ a JSKIT app. The rules it applies are already in [Typed features](typed-features
124
125
  every write ([Tests](data-access.md#tests)).
125
126
  - Send each attack and expect its refusal: no session (401
126
127
  `auth.session.required`), a member without the route's permission (403), a
127
- slug of a workspace the caller is not in (403), another workspace's record id
128
+ slug of a workspace the caller is not in (404, the same answer as a slug no
129
+ workspace has), another workspace's record id
128
130
  and `workspaceId` in the body (refused, or answered in the caller's own
129
131
  workspace), a write without `csrf-token`, and one request past each
130
132
  `rateLimit` (429). A body that does not validate, sent without a session,