@jskit-ai/agent-docs 0.1.354 → 0.1.356

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 (44) hide show
  1. package/guide/agent/app-extras/assistant-conversation.md +7 -0
  2. package/guide/agent/app-extras/assistant.md +51 -0
  3. package/guide/agent/app-setup/authentication.md +6 -0
  4. package/guide/agent/app-setup/database-layer.md +40 -15
  5. package/guide/agent/app-setup/upgrading-jskit.md +6 -3
  6. package/guide/agent/framework/material-3.md +3 -4
  7. package/guide/agent/framework/speed-pass.md +7 -1
  8. package/guide/agent/framework/typed-features.md +46 -20
  9. package/package.json +1 -1
  10. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  11. package/patterns/minimal-foundation/example/package.json +6 -6
  12. package/patterns/shell-foundation/example/package.json +7 -7
  13. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  14. package/patterns/shell-foundation/example/src/components/menus/TabLinkItem.vue +5 -0
  15. package/reference/autogen/PATTERN_INDEX.md +39 -39
  16. package/reference/autogen/packages/agent-runtime.md +1 -1
  17. package/reference/autogen/packages/assistant-core.md +3 -2
  18. package/reference/autogen/packages/assistant-runtime.md +8 -1
  19. package/reference/autogen/packages/assistant-voice-sherpa.md +2 -1
  20. package/reference/autogen/packages/kernel.md +1 -1
  21. package/reference/autogen/packages/material-web.md +2 -0
  22. package/reference/autogen/tooling/jskit-catalog.md +8 -2
  23. package/skills/jskit/references/database-layer.md +40 -15
  24. package/skills/jskit/references/heuristics/placements.md +1 -0
  25. package/skills/jskit/references/material-3.md +3 -4
  26. package/skills/jskit/references/pattern-index.md +39 -39
  27. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +6 -6
  28. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +7 -7
  29. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  30. package/skills/jskit/references/patterns/app/shell-foundation/example/src/components/menus/TabLinkItem.vue +5 -0
  31. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  32. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  33. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  34. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
  35. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  36. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  37. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  38. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  39. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  40. package/skills/jskit/references/patterns/shell/application-shell/example/src/components/menus/TabLinkItem.vue +5 -0
  41. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  42. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  43. package/skills/jskit/references/speed-pass.md +7 -1
  44. package/skills/jskit/references/typed-features.md +46 -20
@@ -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,16 +1077,21 @@ 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
@@ -1272,10 +1287,15 @@ Why: a comment that narrates history is wrong the day after it is written.
1272
1287
  ### Running the checks
1273
1288
 
1274
1289
  `npm run lint` runs ESLint with `@jskit-ai/config-eslint`, and `npm run
1275
- verify` runs `jskit check` (the package graph, navigation, [data
1276
- access](data-access.md#exceptions), [test
1277
- runs](#test-run-rules) and [package manifests](#package-manifest)), lint, the
1278
- 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'
1279
1299
  `eslint.config.mjs` already holds a new
1280
1300
  application's code to every check:
1281
1301
 
@@ -1317,7 +1337,13 @@ export default [
1317
1337
  `**/src/server/**`, so an existing application sees them before it lists a
1318
1338
  package; it lists each package as it converts it. It makes the
1319
1339
  [data-access rules](data-access.md#hard-rules) errors in all
1320
- 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.
1321
1347
  - `clientFeaturesConfig(globs)` holds client code to the same rules; see
1322
1348
  [client features](client-features.md#running-the-checks).
1323
1349
 
@@ -1361,7 +1387,7 @@ that must run alone says so on its own first line instead.
1361
1387
  | --- | --- | --- |
1362
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) |
1363
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) |
1364
- | `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) |
1365
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) |
1366
1392
  | `test/playwright-isolation` | a Playwright webServer every worker shares, without `browserTestConfig()` | [Test files run in parallel](#test-files-run-in-parallel) |
1367
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) |