@jskit-ai/agent-docs 0.1.342 → 0.1.344

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 (40) hide show
  1. package/guide/agent/app-setup/authentication.md +3 -1
  2. package/guide/agent/app-setup/multi-homing.md +18 -9
  3. package/guide/agent/framework/data-access.md +3 -4
  4. package/guide/agent/framework/environments.md +56 -16
  5. package/guide/agent/framework/material-3.md +3 -0
  6. package/guide/agent/framework/security-pass.md +5 -3
  7. package/package.json +1 -1
  8. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  9. package/patterns/minimal-foundation/example/package.json +3 -3
  10. package/patterns/shell-foundation/example/package.json +4 -4
  11. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  12. package/reference/autogen/KERNEL_MAP.md +5 -1
  13. package/reference/autogen/PATTERN_INDEX.md +38 -38
  14. package/reference/autogen/packages/kernel.md +11 -2
  15. package/reference/autogen/packages/shell-web.md +1 -1
  16. package/reference/autogen/packages/workspaces-core.md +1 -0
  17. package/reference/autogen/packages/workspaces-web.md +12 -0
  18. package/reference/autogen/tooling/jskit-catalog.md +1 -0
  19. package/skills/jskit/references/data-access.md +3 -4
  20. package/skills/jskit/references/environments.md +56 -16
  21. package/skills/jskit/references/material-3.md +3 -0
  22. package/skills/jskit/references/multi-homing.md +18 -9
  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/example/package.json +2 -2
  35. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  36. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  37. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  38. package/skills/jskit/references/patterns/workspaces/workspace-surfaces/PATTERN.md +16 -5
  39. package/skills/jskit/references/patterns/workspaces/workspace-surfaces/example/src/composables/useWorkspaceNotFoundState.js +3 -2
  40. package/skills/jskit/references/security-pass.md +5 -3
@@ -378,7 +378,9 @@ that registered; in staging only to `STAGING_EMAIL_TO`, called with that
378
378
  address as `email` and the registered one as `originalEmail`, which its email
379
379
  should show (`markStagingEmail` from
380
380
  `@jskit-ai/kernel/server/runtime/appEnvironment` does), or not at all when
381
- `STAGING_EMAIL_TO` is unset; in development and test never. Where it is not
381
+ `STAGING_EMAIL_TO` is unset; on a staging server that real people use
382
+ (`STAGING_REACHES_REAL_PEOPLE=true`) to the address that registered, as in
383
+ production; in development and test never. Where it is not
382
384
  called, local auth logs each link for the person testing and keeps it out of
383
385
  the answer. So no code may depend on the sender having run, such as code that
384
386
  confirms a registration with the link its sender was given: in development,
@@ -167,11 +167,14 @@ router.register(
167
167
 
168
168
  Before the handler runs, the auth plugin resolves the slug for the signed-in
169
169
  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.
170
+ and `status`) and `request.permissions`. An unknown slug and a workspace the
171
+ caller is not an active member of both return 404
172
+ `workspaces.workspace.notFound` ("Workspace not found."), so someone outside a
173
+ workspace can't tell it exists, unless the route's `surface` uses an access
174
+ policy with `requireWorkspaceMembership: false`. The bootstrap answers both the
175
+ same way: `requestedWorkspace` is `{ slug, status: "not_found" }`. A route with
176
+ `permission` returns 403 when the membership lacks it. Scope queries with
177
+ `request.workspace.id`; never take a workspace id from request input.
175
178
 
176
179
  ### Workspace services from another feature
177
180
 
@@ -632,13 +635,19 @@ the application's identity, training, permission, privacy and browser tests.
632
635
  ## Browser composition
633
636
 
634
637
  Use `workspaces/workspace-surfaces` for workspace selection, invitation landing,
635
- member administration, settings, not-found states, and semantic shell
638
+ member administration, settings, the unavailable state, and semantic shell
636
639
  placements.
637
640
 
638
641
  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.
642
+ A workspace URL the server answers `not_found` (a slug no workspace has, or a
643
+ workspace the person is not in) opens the application's Not found page, the
644
+ `notFoundComponent` given to `createShellRouter`, at that same address, with
645
+ none of the workspace's layout or screens and none of their requests: the
646
+ shell's first bootstrap names the workspace the tab opened on, and the shell
647
+ guard opens the Not found page before any of its pages. A move to a workspace
648
+ the person is not listed in, from a link inside the application, opens its page
649
+ while the bootstrap for it is on its way, then the Not found page once the
650
+ server answers.
642
651
  The bootstrap answer, which carries the workspace and the person's permissions
643
652
  in it, belongs to the workspace, not to a page: it still applies when the
644
653
  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
@@ -17,7 +17,7 @@ builds, and staging and production set it to `production`.
17
17
  | --- | --- | --- | --- | --- | --- | --- |
18
18
  | `development` | a developer's machine, a session, a preview | logged | logged | sandbox only | allowed | "Development" |
19
19
  | `test` | automated test runs | logged | logged | sandbox only | allowed | "Test" |
20
- | `staging` | a copy on a server for checking the application before production | only to `STAGING_EMAIL_TO` and `STAGING_SMS_TO`; logged when unset | logged | sandbox only | refused | "Staging" |
20
+ | `staging` | a copy on a server for checking the application before production | only to `STAGING_EMAIL_TO` and `STAGING_SMS_TO`; logged when unset; sent when real people use it (`STAGING_REACHES_REAL_PEOPLE=true`) | logged | sandbox only | refused | "Staging" ("Staging · real people" when real people use it) |
21
21
  | `production` | the application serving real people | sent | sent | live | refused | none |
22
22
 
23
23
  The development shortcuts are dev sign-in (`AUTH_DEV_BYPASS_ENABLED`), cookies
@@ -33,14 +33,15 @@ for the emails it sends.
33
33
  The host sets `APP_ENV`; a request never chooses it. JSKIT's own commands set
34
34
  it where they own the run.
35
35
 
36
- | Who | `APP_ENV` | `NODE_ENV` | `STAGING_EMAIL_TO`, `STAGING_SMS_TO` |
37
- | --- | --- | --- | --- |
38
- | `npm run develop`, `npm run dev` on a developer's machine | `development`, set by the scripts | unset | unset |
39
- | A session or preview in an editor | `development` | unset | unset |
40
- | `jskit test` and the browser test servers | `test`, set by JSKIT | anything | unset |
41
- | A build-check machine that starts the packaged build to see it start and answer health | `staging` | `production` | unset, so everything is logged |
42
- | A staging server | `staging` | `production` | the testers' inbox and phone |
43
- | A production server | `production` | `production` | ignored |
36
+ | Who | `APP_ENV` | `NODE_ENV` | `STAGING_EMAIL_TO`, `STAGING_SMS_TO` | `STAGING_REACHES_REAL_PEOPLE` |
37
+ | --- | --- | --- | --- | --- |
38
+ | `npm run develop`, `npm run dev` on a developer's machine | `development`, set by the scripts | unset | unset | unset |
39
+ | A session or preview in an editor | `development` | unset | unset | unset |
40
+ | `jskit test` and the browser test servers | `test`, set by JSKIT | anything | unset | unset |
41
+ | A build-check machine that starts the packaged build to see it start and answer health | `staging` | `production` | unset, so everything is logged | unset |
42
+ | A staging server | `staging` | `production` | the testers' inbox and phone | unset |
43
+ | A staging server that real people use, while there is no production | `staging` | `production` | not used | `true`, set by the host |
44
+ | A production server | `production` | `production` | ignored | unset |
44
45
 
45
46
  A server started with `npm start` reads `APP_ENV` from its environment, or from
46
47
  `.env` (`APP_ENV=development` on a developer's machine; the foundations'
@@ -85,6 +86,12 @@ A server stops at startup, saying what to do, when:
85
86
  - A development-only setting is set in staging or production, for example
86
87
  `AUTH_LOCAL_RECOVERY_DEV_OUTPUT is for development only and APP_ENV is
87
88
  staging. Remove it from the staging environment.`
89
+ - `STAGING_REACHES_REAL_PEOPLE` is set outside staging: `STAGING_REACHES_REAL_PEOPLE
90
+ is set and APP_ENV is production. It says real people use a staging server,
91
+ so only APP_ENV=staging takes it: remove STAGING_REACHES_REAL_PEOPLE from the
92
+ production environment.` Any value but `true` is refused too:
93
+ `STAGING_REACHES_REAL_PEOPLE is "yes". Set it to true when real people use
94
+ this staging server, or leave it unset.`
88
95
 
89
96
  It then logs one line saying where it runs and what that means, such as
90
97
  `APP_ENV is staging: email goes only to qa@example.com (STAGING_EMAIL_TO), SMS
@@ -105,12 +112,39 @@ logs it, with what a tester needs, such as its link. Push notifications,
105
112
  webhooks and connector writes are always logged in staging, and live payments
106
113
  are refused there, as everywhere but production.
107
114
 
115
+ ## A staging server that real people use
116
+
117
+ Sometimes real people already use a staging server, because the application
118
+ has no production yet. Its host then sets `STAGING_REACHES_REAL_PEOPLE=true`
119
+ beside `APP_ENV=staging`, and email and SMS go to the people they are for:
120
+ `deliverMessage` sends each one to its recipient, unmarked (`originalTo` is
121
+ empty, so `markStagingEmail` leaves it as it is), and logs `Staging: the
122
+ password reset email to ada@example.com was sent to ada@example.com, since
123
+ real people use this staging (STAGING_REACHES_REAL_PEOPLE).` Everything else
124
+ stays as staging has it: `APP_ENV` is still `staging`, with its own settings
125
+ and databases; `STAGING_EMAIL_TO` and `STAGING_SMS_TO` are not used (the
126
+ startup line says so when they are set); push notifications, webhooks and
127
+ connector writes are logged; payments use the sandbox; development shortcuts
128
+ are refused. Every page names it in a second meta tag,
129
+ `jskit-staging-reaches-real-people`, and the banner reads "Staging · real
130
+ people" ("Staging that real people use: email and text messages reach the
131
+ people they are for, …").
132
+
133
+ The setting is the host's word, never the application's: only `true` means
134
+ anything, only `APP_ENV=staging` takes it, and a server refuses to start with
135
+ it in any other environment. An application decides nothing from it but who
136
+ receives its email and SMS, and reads it through
137
+ `stagingReachesRealPeople(env)` from
138
+ `@jskit-ai/kernel/shared/support/appEnvironment` when it sends some other way.
139
+
108
140
  ## What JSKIT does
109
141
 
110
142
  - Every HTML page the server sends, and every page the Vite development server
111
- sends, names its environment in a `jskit-app-environment` meta tag. The
112
- shell (`@jskit-ai/shell-web`) shows a small "Development", "Test" or
113
- "Staging" banner from it, with no application code, and none in production.
143
+ sends, names its environment in a `jskit-app-environment` meta tag (and,
144
+ on a staging server that real people use, `jskit-staging-reaches-real-people`
145
+ after it). The shell (`@jskit-ai/shell-web`) shows a small "Development",
146
+ "Test", "Staging" or "Staging · real people" banner from them, with no
147
+ application code, and none in production.
114
148
  The banner never takes a click or a tap. Screen readers read it as a note,
115
149
  with a sentence such as "Development: emails and messages are logged, not
116
150
  sent; payments use the sandbox." as its description. It has no label, so a
@@ -118,7 +152,9 @@ are refused there, as everywhere but production.
118
152
  - Local-password emails (confirmation and password reset) with an installed
119
153
  sender go out as the table says. In staging the sender gets
120
154
  `STAGING_EMAIL_TO` as `email` and the person's address as `originalEmail`,
121
- which its email should show (`markStagingEmail` does). An application that
155
+ which its email should show (`markStagingEmail` does); on a staging server
156
+ that real people use it gets the person's address and an empty
157
+ `originalEmail`, as in production. An application that
122
158
  confirms new accounts at once while its email isn't set up uses
123
159
  `auth.local.confirmation-mode`, which applies everywhere (see
124
160
  [Authentication](/guide/app-setup/authentication)).
@@ -145,7 +181,8 @@ project.
145
181
 
146
182
  Code the application writes that reaches the world follows the same rule. Send
147
183
  email and SMS through `deliverMessage`, which sends, redirects or logs each as
148
- `APP_ENV` says; log anything else outside production with `logSideEffect`.
184
+ `APP_ENV` (and, in staging, `STAGING_REACHES_REAL_PEOPLE`) says; log anything
185
+ else outside production with `logSideEffect`.
149
186
 
150
187
  ```js
151
188
  import { deliverMessage, logSideEffect, markStagingEmail } from "@jskit-ai/kernel/server/runtime/appEnvironment";
@@ -179,8 +216,11 @@ async function notifyDevice({ env, logger, push }, notification) {
179
216
 
180
217
  - Read `env` from the `runtime.env` capability, never a request.
181
218
  - A configured driver or key (`EMAIL_DRIVER=ses`, a live payment key) does not
182
- make anything real; only `APP_ENV=production` does.
219
+ make anything real; only `APP_ENV=production` does, and, for email and SMS
220
+ alone, `STAGING_REACHES_REAL_PEOPLE=true` on staging.
183
221
  - Test each environment the code treats differently. A test that proves a real
184
222
  sender against a fake transport passes `APP_ENV: "production"` (and
185
223
  `NODE_ENV: "production"` when it starts a whole server), and a staging test
186
- sets `STAGING_EMAIL_TO` and checks that only that address received it.
224
+ sets `STAGING_EMAIL_TO` and checks that only that address received it; one
225
+ for a staging server that real people use adds
226
+ `STAGING_REACHES_REAL_PEOPLE: "true"` and checks that the recipient did.
@@ -104,6 +104,9 @@ Exactly this, and nothing more:
104
104
  no parent. A literal destination is served by a page whose route matches it
105
105
  segment by segment, each `:param` standing for exactly one segment; the
106
106
  page's deeper pages (`modules/[moduleKey]/settings.vue`) are inner pages.
107
+ As the router does, a static page comes first: a link to `/jobs/new` leads
108
+ to `jobs/new.vue` when it exists, so `jobs/[jobId]/index.vue` stays an inner
109
+ page with its parent.
107
110
  3. **Every in-app link and navigation goes through JSKIT navigation:**
108
111
  `:to="paths.page('/suppliers')"` and `router.push(paths.page(...))` with
109
112
  `usePaths()`, the CRUD runtime's `resolveViewUrl()`, `resolveEditUrl()` and
@@ -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.342",
3
+ "version": "0.1.344",
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.28",
8
+ "@jskit-ai/kernel": "0.2.30",
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.28",
37
+ "@jskit-ai/kernel": "0.2.30",
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.28",
47
+ "@jskit-ai/http-runtime": "0.2.30",
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.94",
53
+ "@jskit-ai/jskit-catalog": "0.2.96",
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.28",
37
+ "@jskit-ai/kernel": "0.2.30",
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.28",
48
- "@jskit-ai/shell-web": "0.2.44",
47
+ "@jskit-ai/http-runtime": "0.2.30",
48
+ "@jskit-ai/shell-web": "0.2.46",
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.94",
54
+ "@jskit-ai/jskit-catalog": "0.2.96",
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.28"
12
+ "@jskit-ai/kernel": "0.2.30"
13
13
  },
14
14
  "jskit": {
15
15
  "kind": "runtime",
@@ -24,10 +24,14 @@ Exports
24
24
  - `APP_ENV_KEY`
25
25
  - `APP_ENVIRONMENTS`
26
26
  - `APP_ENVIRONMENT_META_NAME`
27
+ - `STAGING_REACHES_REAL_PEOPLE_KEY`
28
+ - `STAGING_REAL_PEOPLE_META_NAME`
27
29
  - `appEnvironment(env)`
28
30
  - `isStagingOrProduction(env)`
29
31
  - `pageAppEnvironment(documentObject = globalThis.document)`
30
- - `withAppEnvironmentMeta(html, environment)`
32
+ - `pageStagingReachesRealPeople(documentObject = globalThis.document)`
33
+ - `stagingReachesRealPeople(env)`
34
+ - `withAppEnvironmentMeta(html, environment, { reachesRealPeople = false } = {})`
31
35
 
32
36
  ### `support/clientBuild.js`
33
37
  Exports