@jskit-ai/agent-docs 0.1.353 → 0.1.355

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 (66) hide show
  1. package/guide/agent/app-extras/assistant.md +70 -0
  2. package/guide/agent/app-setup/authentication.md +157 -2
  3. package/guide/agent/app-setup/database-layer.md +49 -15
  4. package/guide/agent/app-setup/service-keys.md +103 -0
  5. package/guide/agent/app-setup/upgrading-jskit.md +17 -5
  6. package/guide/agent/framework/data-access.md +13 -0
  7. package/guide/agent/framework/material-3.md +3 -4
  8. package/guide/agent/framework/speed-pass.md +7 -1
  9. package/guide/agent/framework/typed-features.md +56 -25
  10. package/guide/agent/index.md +2 -0
  11. package/package.json +1 -1
  12. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  13. package/patterns/minimal-foundation/example/package.json +6 -6
  14. package/patterns/shell-foundation/example/package.json +7 -7
  15. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  16. package/patterns/shell-foundation/example/src/components/menus/TabLinkItem.vue +5 -0
  17. package/reference/autogen/PATTERN_INDEX.md +49 -38
  18. package/reference/autogen/packages/agent-runtime.md +1 -1
  19. package/reference/autogen/packages/assistant-core.md +44 -8
  20. package/reference/autogen/packages/assistant-runtime.md +25 -0
  21. package/reference/autogen/packages/assistant-voice-sherpa.md +2 -1
  22. package/reference/autogen/packages/auth-core.md +4 -0
  23. package/reference/autogen/packages/auth-provider-local-core.md +13 -0
  24. package/reference/autogen/packages/auth-web.md +60 -16
  25. package/reference/autogen/packages/crud-core.md +3 -1
  26. package/reference/autogen/packages/database-runtime.md +1 -0
  27. package/reference/autogen/packages/http-web.md +1 -0
  28. package/reference/autogen/packages/kernel.md +1 -1
  29. package/reference/autogen/packages/material-web.md +2 -0
  30. package/reference/autogen/packages/realtime.md +2 -1
  31. package/reference/autogen/packages/resource-runtime.md +9 -0
  32. package/reference/autogen/packages/shell-web.md +35 -0
  33. package/reference/autogen/tooling/jskit-catalog.md +21 -8
  34. package/reference/autogen/tooling/testUtils.md +1 -0
  35. package/skills/jskit/references/data-access.md +13 -0
  36. package/skills/jskit/references/database-layer.md +49 -15
  37. package/skills/jskit/references/heuristics/placements.md +1 -0
  38. package/skills/jskit/references/heuristics/row-policies.md +1 -1
  39. package/skills/jskit/references/heuristics/ui-testing.md +3 -3
  40. package/skills/jskit/references/material-3.md +3 -4
  41. package/skills/jskit/references/pattern-index.md +49 -38
  42. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +6 -6
  43. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +7 -7
  44. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  45. package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/TabLinkItem.vue +5 -0
  46. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  47. package/skills/jskit/references/patterns/auth/auth-surface/PATTERN.md +3 -0
  48. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  49. package/skills/jskit/references/patterns/auth/own-design-sign-in/PATTERN.md +141 -0
  50. package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/components/ConfirmItsYouDialog.vue +182 -0
  51. package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/theme/tokens.css +35 -0
  52. package/skills/jskit/references/patterns/auth/own-design-sign-in/example/src/views/auth/LoginView.vue +473 -0
  53. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  54. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
  55. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  56. package/skills/jskit/references/patterns/crud/crud-screen-set/example/books/BookListPage.vue +1 -1
  57. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  58. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  59. package/skills/jskit/references/patterns/realtime/realtime-application/PATTERN.md +5 -1
  60. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  61. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  62. package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/TabLinkItem.vue +5 -0
  63. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  64. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  65. package/skills/jskit/references/speed-pass.md +7 -1
  66. package/skills/jskit/references/typed-features.md +56 -25
@@ -85,19 +85,25 @@ the kernel's own (`runtime.actions`, `runtime.events`, `runtime.http`,
85
85
  `runtime.bootstrap`) and those the package provides itself.** Late
86
86
  capabilities are required; optional ones are not. A requirement no feature has stays only when
87
87
  the package needs it at install time, such as the database its migrations
88
- need.
88
+ need, and `installRequires` marks it so; it stays in `requires` too.
89
89
 
90
90
  Why: start-up resolves every package's requirements from the manifests, and
91
- refuses a manifest that disagrees with the package's features. Plain
92
- `jskit check` loads each application package's features (the server providers
93
- `jskit.runtime.server.providers` declares) and reports the drift before that
94
- (`manifest/capabilities`), each capability to add or remove; it lists the
95
- requirements no feature has for review.
91
+ refuses a manifest that disagrees with the package's features, including an
92
+ `installRequires` mark on a capability a feature requires or `requires` does
93
+ not list. It logs, at every start, each requirement no feature has that
94
+ `installRequires` does not mark. Plain `jskit check` loads each application
95
+ package's features (the server providers `jskit.runtime.server.providers`
96
+ declares) and reports the drift before that (`manifest/capabilities`), each
97
+ capability to add or remove; it lists the unmarked requirements no feature has
98
+ for review.
96
99
 
97
100
  ```jsonc
98
101
  // good: BooksFeature provides app.books and requires crud.contracts and runtime.actions
99
102
  "capabilities": { "provides": ["app.books"], "requires": ["crud.contracts"] }
100
103
 
104
+ // good: the migrations need the database, which no feature requires
105
+ "capabilities": { "provides": ["app.books"], "requires": ["crud.contracts", "runtime.database"], "installRequires": ["runtime.database"] }
106
+
101
107
  // bad: app.books missing from provides, crud.contracts from requires
102
108
  "capabilities": { "provides": ["app.book"], "requires": [] }
103
109
  ```
@@ -1051,13 +1057,17 @@ one-line test.
1051
1057
 
1052
1058
  **A test suite runs its files in parallel, as many at a time as the machine's
1053
1059
  test budget allows: never one file at a time, and never more than the machine
1054
- can take. Node's test runner runs through `jskit test`; Playwright's `workers`
1055
- and Vitest's `maxWorkers` come from `testConcurrency()`.**
1060
+ can take. Node's test runner runs through `jskit test`; Vitest's `maxWorkers`
1061
+ comes from `testConcurrency()`, and Playwright's `workers` from
1062
+ `browserTestWorkers()`, half of it, as each worker drives a browser and often
1063
+ its own app server.**
1056
1064
 
1057
1065
  - The budget is `V64_TEST_CONCURRENCY` when it is a positive whole number (a
1058
1066
  test runner that hands out slots exports it for each run), otherwise half of
1059
- the machine's CPUs, rounded down and at least 1: a 2-vCPU VPS runs one file
1060
- at a time, an 8-thread machine four.
1067
+ the CPUs the process may use, rounded down and at least 1: a 2-vCPU VPS runs
1068
+ one file at a time, an 8-thread machine four, and a container or slice whose
1069
+ cgroup `cpu.max` quota gives it 3 CPUs of a 16-thread machine one
1070
+ (`availableCpus()`).
1061
1071
  - `jskit test` (from `@jskit-ai/jskit-catalog`) passes its arguments to
1062
1072
  `node --test` and sets `--test-concurrency` to the budget.
1063
1073
  `testConcurrency()` from `@jskit-ai/jskit-catalog/test-budget` returns the
@@ -1067,25 +1077,33 @@ and Vitest's `maxWorkers` come from `testConcurrency()`.**
1067
1077
  default pattern and fails on a `tests/` file it would leave out, such as
1068
1078
  `<name>.integration.js` or `<name>.spec.js`.
1069
1079
  - No script passes a fixed concurrency or worker count. `jskit check` fails a
1070
- package script that runs `node --test` directly or passes one, and a
1071
- Playwright or Vitest config those scripts use whose workers do not come from
1072
- `testConcurrency()` ([test-run rules](#test-run-rules)).
1080
+ package script that runs `node --test` directly or passes one, a Vitest
1081
+ config those scripts use whose `maxWorkers` does not come from
1082
+ `testConcurrency()`, and a Playwright config whose `workers` do not come from
1083
+ `browserTestWorkers()` of `@jskit-ai/jskit-catalog/browser-tests` or
1084
+ `browserTestConfig()`: one worker for each budget thread started twice the
1085
+ browsers and servers the runner gave ([test-run rules](#test-run-rules)).
1073
1086
  - Each file isolates what it shares: a port the system picks (`listen(0)`), a
1074
1087
  directory from `mkdtemp`, its own database or schema with a name no other
1075
1088
  file uses, its own Vite `cacheDir` for each dev server it starts (Vite
1076
1089
  replaces a shared dependency cache under servers still reading it), and no
1077
1090
  writes into the source tree. Files that collide are isolated, never
1078
1091
  serialised. A database test file gets its own copy of `TEST_DB_NAME` from
1079
- `jskit test --databases`
1092
+ `jskit test --databases`, and a scratch database beside it from
1093
+ `createPackageTestKnex()`; a run whose databases let fewer files run at
1094
+ once than the budget says why and fails
1080
1095
  ([integration test databases](https://mobily-enterprises.github.io/jskit-ai/guide/app-setup/database-layer#integration-test-databases)).
1081
1096
  - An application's `playwright.config.mjs` is
1082
1097
  `defineConfig(browserTestConfig({ testDir: "./tests/e2e" }))` from
1083
1098
  `@jskit-ai/jskit-catalog/browser-tests`. It builds the production frontend
1084
- once (reused while its sources are unchanged) and gives each worker its own
1085
- server, port and, through its `prepare` module, its own seeded database; a
1099
+ once (reused while the files it read are unchanged, so an edit to server
1100
+ code alone does not rebuild it) and gives each worker its own server, port
1101
+ and, through its `prepare` module, its own seeded database; a
1086
1102
  spec file's tests run in order in one worker. With `PLAYWRIGHT_BASE_URL`, the
1087
- tests use that managed target as its host serves it. Every run is bounded by
1088
- a `globalTimeout` (20 minutes, or the suite's own measured bound) and ends
1103
+ tests use that managed target as its host serves it. A local run takes free
1104
+ ports of its own, so two runs on one machine never meet. Every run is bounded
1105
+ by a `globalTimeout` (80 worker-minutes, never under 20 minutes: 20 on 4
1106
+ workers, 80 on one; or the suite's own measured bound) and ends
1089
1107
  with its 10 slowest tests. Each action and navigation is bounded too
1090
1108
  (`actionTimeout` 15 s, `navigationTimeout` 30 s): a stale locator should
1091
1109
  fail in seconds, not minutes, so a test waiting on something that never
@@ -1108,7 +1126,9 @@ and Vitest's `maxWorkers` come from `testConcurrency()`.**
1108
1126
  file's own bound in `test-time-bounds.json`, with the measurement in the
1109
1127
  commit that raises it; a file that got slow is fixed instead. A file still
1110
1128
  running at twice its bound, or sooner at ten times the time it last finished
1111
- in (at least two minutes), is stopped and fails the run by name, so the other
1129
+ all its tests in (at least two minutes; a run filtered by
1130
+ `--test-name-pattern`, `--test-skip-pattern` or `--test-only` records no
1131
+ time), is stopped and fails the run by name, so the other
1112
1132
  files still finish and report: look for what it leaves open (a server, child
1113
1133
  process, timer or socket) or a test without a timeout. A file with its own
1114
1134
  bound is stopped at twice that bound.
@@ -1267,10 +1287,15 @@ Why: a comment that narrates history is wrong the day after it is written.
1267
1287
  ### Running the checks
1268
1288
 
1269
1289
  `npm run lint` runs ESLint with `@jskit-ai/config-eslint`, and `npm run
1270
- verify` runs `jskit check` (the package graph, navigation, [data
1271
- access](data-access.md#exceptions), [test
1272
- runs](#test-run-rules) and [package manifests](#package-manifest)), lint, the
1273
- tests and the build. The foundations'
1290
+ verify` is the whole suite, each section once: `jskit check` (the package
1291
+ graph, navigation, [data access](data-access.md#exceptions),
1292
+ [test runs](#test-run-rules) and [package manifests](#package-manifest)),
1293
+ lint, the Node tests (`npm test`), the client tests (`npm run test:client`)
1294
+ and the browser suite (`npm run test:e2e`), which builds the production
1295
+ frontend it serves, so no separate build runs. Each section takes its
1296
+ concurrency from the machine's test budget and ends with its slowest files.
1297
+ A host's Verification declares the same sections, each as its own entry. The
1298
+ foundations'
1274
1299
  `eslint.config.mjs` already holds a new
1275
1300
  application's code to every check:
1276
1301
 
@@ -1312,7 +1337,13 @@ export default [
1312
1337
  `**/src/server/**`, so an existing application sees them before it lists a
1313
1338
  package; it lists each package as it converts it. It makes the
1314
1339
  [data-access rules](data-access.md#hard-rules) errors in all
1315
- code but a package's `src/client`, tests, migrations and seeds.
1340
+ code but a package's `src/client`, tests, migrations and seeds. In every
1341
+ file it refuses a name read before its `const`, `let`, `class` or `import`
1342
+ in the same scope (`no-use-before-define`): such a read throws a
1343
+ `ReferenceError` when it runs, as a local that shadows a helper called a
1344
+ line earlier does. Imports go at the top of the file. A hoisted function
1345
+ called above its declaration, or a function that runs later and reads a
1346
+ name declared below it, is fine.
1316
1347
  - `clientFeaturesConfig(globs)` holds client code to the same rules; see
1317
1348
  [client features](client-features.md#running-the-checks).
1318
1349
 
@@ -1356,7 +1387,7 @@ that must run alone says so on its own first line instead.
1356
1387
  | --- | --- | --- |
1357
1388
  | `test/node-test` | a script that runs `node --test` directly instead of `jskit test` | [Test files run in parallel](#test-files-run-in-parallel) |
1358
1389
  | `test/fixed-concurrency` | `--test-concurrency` in a script, or a script that pins `V64_TEST_CONCURRENCY` or `PLAYWRIGHT_WORKERS` | [Test files run in parallel](#test-files-run-in-parallel) |
1359
- | `test/playwright-workers` | `--workers` or `-j` passed to `playwright test`, its config without `workers: testConcurrency()` or `browserTestConfig()`, or with `workers` set over `browserTestConfig()`'s | [Test files run in parallel](#test-files-run-in-parallel) |
1390
+ | `test/playwright-workers` | `--workers` or `-j` passed to `playwright test`, its config without `workers: browserTestWorkers()` or `browserTestConfig()`, or with `workers` set over `browserTestConfig()`'s | [Test files run in parallel](#test-files-run-in-parallel) |
1360
1391
  | `test/playwright-dev-server` | a Playwright webServer command that runs the development server (`npm run develop`, `npm run dev`, `bin/develop.js`, `vite`, `vite dev`) | [Test files run in parallel](#test-files-run-in-parallel) |
1361
1392
  | `test/playwright-isolation` | a Playwright webServer every worker shares, without `browserTestConfig()` | [Test files run in parallel](#test-files-run-in-parallel) |
1362
1393
  | `test/playwright-global-timeout` | a Playwright config without a `globalTimeout` (or `browserTestConfig()`), or with `globalTimeout: 0` | [Test files run in parallel](#test-files-run-in-parallel) |