@jskit-ai/agent-docs 0.1.389 → 0.1.390

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 (31) hide show
  1. package/guide/agent/app-extras/realtime.md +12 -8
  2. package/guide/agent/app-setup/initial-scaffolding.md +17 -0
  3. package/guide/agent/framework/test-pass.md +3 -2
  4. package/guide/agent/framework/typed-features.md +120 -2
  5. package/package.json +1 -1
  6. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  7. package/patterns/minimal-foundation/example/package.json +4 -4
  8. package/patterns/shell-foundation/example/package.json +5 -5
  9. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  10. package/reference/autogen/PATTERN_INDEX.md +40 -40
  11. package/reference/autogen/packages/assistant-core.md +4 -2
  12. package/reference/autogen/packages/kernel.md +5 -0
  13. package/reference/autogen/packages/realtime.md +2 -0
  14. package/reference/autogen/tooling/jskit-catalog.md +34 -1
  15. package/skills/jskit/references/pattern-index.md +40 -40
  16. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +4 -4
  17. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +5 -5
  18. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  19. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  20. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  21. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  22. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
  23. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  24. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  25. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  26. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  27. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  28. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  29. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  30. package/skills/jskit/references/test-pass.md +3 -2
  31. package/skills/jskit/references/typed-features.md +120 -2
@@ -222,14 +222,18 @@ covers the rest of what several copies need.
222
222
 
223
223
  ## Shutdown
224
224
 
225
- Realtime shutdown refuses new Socket.IO requests and closes its engine, adapter
226
- and Redis connections. Clients see their transport close, as with
227
- `Server#close()`, so Socket.IO's own reconnection reaches the next server; the
228
- server never sends a disconnect that would stop it. It never closes the HTTP
229
- server: that belongs to its owner (Fastify closes its own after feature
230
- shutdown), so another route's open WebSocket or stream does not hold realtime
231
- shutdown. Code that passes its own `httpServer` to `createSocketIoServer` closes
232
- that server itself after `closeSocketIoServer`.
225
+ When Fastify's close begins (its `preClose` hooks), Socket.IO refuses new
226
+ requests and closes every page's WebSocket, because Fastify's close waits for
227
+ every connection before any feature's shutdown runs: an open page would
228
+ otherwise hold the close until the page went away. Realtime shutdown then
229
+ closes its adapter and Redis connections. Clients see their transport close, as
230
+ with `Server#close()`, so Socket.IO's own reconnection reaches the next server;
231
+ the server never sends a disconnect that would stop it. It never closes the
232
+ HTTP server: that belongs to its owner (Fastify closes its own, then runs
233
+ feature shutdown), so another route's open WebSocket or stream does not hold
234
+ realtime shutdown, though it holds Fastify's close until its owner ends it.
235
+ Code that passes its own `httpServer` to `createSocketIoServer` closes that
236
+ server itself after `closeSocketIoServer`.
233
237
 
234
238
  ## Client updates
235
239
 
@@ -196,6 +196,23 @@ composed without either calls `registerSecurityHeaders(fastify, { config, env
196
196
  })` and `registerRedirectHosts(fastify, { env })` from
197
197
  `@jskit-ai/kernel/server/http` before it registers any plugin.
198
198
 
199
+ ## Stopping
200
+
201
+ `createInstalledRuntime` stops every feature (each provider's `shutdown()`) from
202
+ Fastify's `onClose`, which runs once the server's close has ended every
203
+ connection, so a stop waits only for the requests under way:
204
+
205
+ - Fastify closes the connections idle when the close begins, and answers a
206
+ request that arrives after it with `503` and `Connection: close`.
207
+ - Once the close begins, every answer says `Connection: close`, so a request
208
+ under way then, such as a long poll, ends its connection when it is
209
+ answered rather than after Fastify's 72 s keep-alive.
210
+ - `@jskit-ai/realtime` closes every page's WebSocket when the close begins
211
+ ([Realtime](/guide/app-extras/realtime#shutdown)).
212
+
213
+ A route's own long-lived connection (a stream or another WebSocket) still holds
214
+ the close until its owner ends it, at Fastify's `preClose`.
215
+
199
216
  ## Other names
200
217
 
201
218
  An application may answer at more than one name, such as `www.example.com`
@@ -187,8 +187,9 @@ The rules it applies are in [Typed features](/guide/framework/typed-features),
187
187
  proves it.
188
188
  - No script runs a suite, build or check twice: `npm run verify` and CI run
189
189
  each part once, a preliminary check repeats nothing the run after it covers,
190
- and a check that passed on the exact tree is never run again. Each part
191
- starting once in the whole run's output proves it.
190
+ and a check that passed on the exact tree is never run again
191
+ ([`jskit verify` keeps it](/guide/framework/typed-features#a-check-runs-once-per-tree)).
192
+ Each part starting once in the whole run's output proves it.
192
193
  - No fixed sleep: a web-first assertion (`await expect(locator).toBeVisible()`),
193
194
  `expect.poll()`, the event itself, or a fake clock (`mock.timers`,
194
195
  `vi.useFakeTimers()`, `page.clock`) for the app's own delays. A poll's
@@ -1434,6 +1434,115 @@ export default [
1434
1434
 
1435
1435
  Every finding ends with a link to the section of this page that explains it.
1436
1436
 
1437
+ ### A check runs once per tree
1438
+
1439
+ A check that passed on the exact tree is never run again, and `jskit verify`
1440
+ keeps that rule itself. `npm run verify` is `jskit verify`, and package.json
1441
+ declares what it runs:
1442
+
1443
+ ```json
1444
+ {
1445
+ "scripts": {
1446
+ "verify": "jskit verify",
1447
+ "lint": "eslint .",
1448
+ "test": "jskit test --databases",
1449
+ "test:client": "vitest run"
1450
+ },
1451
+ "jskitVerify": {
1452
+ "parts": ["lint", "test", { "script": "test:client", "env": { "APP_BUILT": "1" } }],
1453
+ "settings": ["APP_ENV", "MYAPP_*"],
1454
+ "checkouts": "tooling/verify-checkouts.mjs"
1455
+ }
1456
+ }
1457
+ ```
1458
+
1459
+ - `parts` are the npm scripts of the whole check, run in order as
1460
+ `npm run <part>`; the first that fails ends the run with its exit status. A
1461
+ part given as an object gets its `env` settings, and only it does.
1462
+ - `settings` names the settings whose values the check depends on, a trailing
1463
+ `*` taking every name it starts. A value that names a folder in a Git
1464
+ checkout counts as that checkout's tree, one that names a file as its
1465
+ contents, any other as its digest: the record never holds a value.
1466
+ - `checkouts` names a module of the app whose default export,
1467
+ `({ projectRoot, env }) => ({ "<name>": "<folder>" })`, returns the other
1468
+ checkouts the check uses (another repository its tests run, a source checkout
1469
+ it composes), by the rule the app itself finds them with.
1470
+
1471
+ A whole run that passes records exactly what it checked in
1472
+ `node_modules/.cache/jskit/verify-passes/`: the project's tree (the tree of
1473
+ `HEAD`, so a rebase or an empty commit keeps it), each named checkout's tree,
1474
+ the installed dependencies of the project and of each checkout (every file's
1475
+ path, size and modification time under `node_modules`, so an `npm ci` or a
1476
+ package laid over by hand is another input), the declared settings, Node's
1477
+ version and the parts. The next `jskit verify` with the same inputs prints the
1478
+ record and runs nothing:
1479
+
1480
+ ```text
1481
+ jskit verify: it passed on this exact tree at 2026-12-01T10:00:00.000Z on desktop (the project 36545a948a1b, tree f14b03f42888; public 6ffe6eb08fc3; Node v26.5.0): not run again. Its record is node_modules/.cache/jskit/verify-passes/<key>.json; remove it to run the check again.
1482
+ ```
1483
+
1484
+ It runs the whole check and records nothing when it can't tell its inputs: a
1485
+ checkout with uncommitted changes or untracked files, a setting naming a folder
1486
+ outside Git or one Git ignores, a named checkout that is missing, or a
1487
+ `checkouts` module that fails. It records nothing for a part that fails, a run
1488
+ that is interrupted, or a tree or input that changed while it ran. Words after
1489
+ `npm run verify --` go to the last part (`npm run verify -- tests/x.test.js`):
1490
+ such a run checks part of the suite, so it neither reads nor writes a pass. A
1491
+ fresh `npm ci` empties the records; each machine keeps its own.
1492
+
1493
+ A CI run installs everything afresh, so its record is an artifact GitHub keeps,
1494
+ named for the project's tree and the commits of the other repositories the run
1495
+ checks out. `jskit verify-pass` is the run's first step: it names the pass,
1496
+ asks GitHub whether an artifact of that name is kept, and writes `name` and
1497
+ `reuse` to the step's outputs. It runs before `npm ci`, with the version of
1498
+ `@jskit-ai/jskit-catalog` the lock pins:
1499
+
1500
+ ```yaml
1501
+ jobs:
1502
+ pass:
1503
+ runs-on: ubuntu-latest
1504
+ permissions:
1505
+ contents: read
1506
+ actions: read
1507
+ outputs:
1508
+ other: ${{ steps.pass.outputs.other }}
1509
+ name: ${{ steps.pass.outputs.name }}
1510
+ reuse: ${{ steps.pass.outputs.reuse }}
1511
+ steps:
1512
+ - uses: actions/checkout@v7
1513
+ - uses: actions/setup-node@v7
1514
+ with:
1515
+ node-version: 26
1516
+ - id: pass
1517
+ env:
1518
+ GITHUB_TOKEN: ${{ github.token }}
1519
+ run: |
1520
+ other="$(git ls-remote --exit-code https://github.com/owner/other refs/heads/main | cut -f1)"
1521
+ echo "other=$other" >> "$GITHUB_OUTPUT"
1522
+ catalog="$(node -p "require('./package-lock.json').packages['node_modules/@jskit-ai/jskit-catalog'].version")"
1523
+ npx --yes --package="@jskit-ai/jskit-catalog@$catalog" jskit verify-pass --commit "other=$other"
1524
+ verify:
1525
+ needs: pass
1526
+ if: needs.pass.outputs.reuse != 'true'
1527
+ # ...checks out owner/other at ${{ needs.pass.outputs.other }}, then npm ci and npm run verify
1528
+ record:
1529
+ needs: [pass, verify]
1530
+ if: needs.verify.result == 'success'
1531
+ runs-on: ubuntu-latest
1532
+ steps:
1533
+ - run: echo "$GITHUB_SHA" > "$RUNNER_TEMP/pass.txt"
1534
+ - uses: actions/upload-artifact@v7
1535
+ with:
1536
+ name: ${{ needs.pass.outputs.name }}
1537
+ path: ${{ runner.temp }}/pass.txt
1538
+ retention-days: 90
1539
+ ```
1540
+
1541
+ A run whose tree and commits passed then runs nothing, and its log names the
1542
+ run that passed; delete the artifact to verify them again. A failed or
1543
+ cancelled run records nothing, so the next one verifies. Without a token to
1544
+ read the artifacts, or when GitHub refuses, the run verifies.
1545
+
1437
1546
  ### Lint rules
1438
1547
 
1439
1548
  | Rule | Reports | Section |
@@ -1505,7 +1614,7 @@ JavaScript, is read.
1505
1614
 
1506
1615
  | Rule | Reports | Fix |
1507
1616
  | --- | --- | --- |
1508
- | `test/fixed-sleep` | in a test file, `page.waitForTimeout(…)`, a `new Promise` that resolves on `setTimeout(…, <ms>)`, or an awaited `setTimeout`, `sleep`, `delay`, `pause` (its own or an object's, such as `timers.setTimeout(…)`) or `wait` (its own or node's `scheduler.wait(…)`) of a number of milliseconds | wait for the condition: a web-first assertion (`await expect(locator).toBeVisible()`), `expect.poll()`, the event itself, or a fake clock (`mock.timers`, `vi.useFakeTimers()`, `page.clock`) |
1617
+ | `test/fixed-sleep` | in a test file, `page.waitForTimeout(…)`, a `new Promise` that resolves on `setTimeout(…, <ms>)`, or an awaited `setTimeout`, `sleep`, `delay`, `pause` (its own or an object's, such as `timers.setTimeout(…)`) or `wait` (its own or node's `scheduler.wait(…)`) whose delay is a number of milliseconds or computed: arithmetic (`5 * 1000`), the file's constants (`SETTLE_MS`), a variable, a call or an object's value (`timings.settle`) | wait for the condition: a web-first assertion (`await expect(locator).toBeVisible()`), `expect.poll()`, the event itself, or a fake clock (`mock.timers`, `vi.useFakeTimers()`, `page.clock`) |
1509
1618
  | `test/fixed-database-name` | a test script that sets `TEST_DB_NAME`, `BROWSER_TEST_DB_NAME` or `DB_NAME`; a test file or runner config that falls back to or assigns a name for one (`process.env.TEST_DB_NAME \|\| "shop_test"`), outside a thrown error's message; a runner config that names one (`DB_NAME: "shop_e2e"`) | drop the name: the run's test-only env file or the host names the database, `jskit test --databases` gives each test file its own copy of `TEST_DB_NAME`, and `browserTestConfig()`'s `prepare` module derives each worker's from `BROWSER_TEST_DB_NAME` |
1510
1619
  | `test/test-database-is-app-database` | a CI workflow whose `TEST_DB_NAME` or `BROWSER_TEST_DB_NAME` is its `DB_NAME`, by value or as an `env.DB_NAME` expression | give it a name of its own, such as `<DB_NAME>_test`: a test run replaces its test databases from the snapshot, and JSKIT refuses to run one on `DB_NAME` |
1511
1620
  | `test/generated-into-src` | a `dts` path under `src/` in the root `vite.config.*`, such as vue-router's `src/typed-router.d.ts` or a components declaration file | write it outside `src`, such as `dts: "types/typed-router.d.ts"`, and move the file and its `.gitignore` line: a file written into `src` while the frontend builds keeps the browser tests from reusing that build (`not kept for reuse, as src changed while it ran`) |
@@ -1513,7 +1622,16 @@ JavaScript, is read.
1513
1622
  `test/fixed-sleep` reports a wait that stands in for a condition, not every
1514
1623
  timer. It does not report:
1515
1624
 
1516
- - a 0 ms timer, which yields a turn;
1625
+ - a delay that comes to 0 (`0`, `NONE * 10` with `const NONE = 0`), which
1626
+ yields a turn, and a string, which is no delay;
1627
+ - a delay that reads a parameter of a function around the wait, such as
1628
+ `ms` in `const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms))`:
1629
+ the helper waits as long as its callers ask, and theirs are reported when
1630
+ it is named `sleep`, `delay`, `pause` or `wait` (`await pause(200)`); a
1631
+ helper named otherwise is not read;
1632
+ - an own `wait(…)` whose delay does not come to a number, such as
1633
+ `wait("accept", intervene)` or `wait(event.type)`: an own `wait` is often
1634
+ a helper that waits for an event;
1517
1635
  - a timer that is an element of `Promise.race([…])`, which bounds the wait
1518
1636
  for something else;
1519
1637
  - a poll's interval: a wait in a loop that re-reads its condition each round,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/agent-docs",
3
- "version": "0.1.389",
3
+ "version": "0.1.390",
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.38",
8
+ "@jskit-ai/kernel": "0.2.39",
9
9
  "json-rest-schema": "^1.0.20"
10
10
  },
11
11
  "exports": {
@@ -34,8 +34,8 @@
34
34
  "dependencies": {
35
35
  "@local/main": "0.1.0",
36
36
  "@fastify/static": "^10.1.3",
37
- "@jskit-ai/kernel": "0.2.38",
38
- "@jskit-ai/material-web": "0.1.19",
37
+ "@jskit-ai/kernel": "0.2.39",
38
+ "@jskit-ai/material-web": "0.1.20",
39
39
  "@tanstack/vue-query": "^5.101.0",
40
40
  "fastify": "^5.12.7",
41
41
  "pino": "^10.3.1",
@@ -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.39",
47
+ "@jskit-ai/http-runtime": "0.2.40",
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.256",
53
- "@jskit-ai/jskit-catalog": "0.2.141",
53
+ "@jskit-ai/jskit-catalog": "0.2.142",
54
54
  "@playwright/test": "1.61.1",
55
55
  "@vitejs/plugin-vue": "^6.0.7",
56
56
  "eslint": "^10.8.0",
@@ -34,8 +34,8 @@
34
34
  "dependencies": {
35
35
  "@local/main": "0.1.0",
36
36
  "@fastify/static": "^10.1.3",
37
- "@jskit-ai/kernel": "0.2.38",
38
- "@jskit-ai/material-web": "0.1.19",
37
+ "@jskit-ai/kernel": "0.2.39",
38
+ "@jskit-ai/material-web": "0.1.20",
39
39
  "@tanstack/vue-query": "^5.101.0",
40
40
  "fastify": "^5.12.7",
41
41
  "pino": "^10.3.1",
@@ -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.39",
48
- "@jskit-ai/shell-web": "0.2.69",
47
+ "@jskit-ai/http-runtime": "0.2.40",
48
+ "@jskit-ai/shell-web": "0.2.70",
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.256",
54
- "@jskit-ai/jskit-catalog": "0.2.141",
54
+ "@jskit-ai/jskit-catalog": "0.2.142",
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.38"
12
+ "@jskit-ai/kernel": "0.2.39"
13
13
  },
14
14
  "jskit": {
15
15
  "kind": "runtime",