@jskit-ai/agent-docs 0.1.26 → 0.1.28

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 (46) hide show
  1. package/DISTR_AGENT.md +1 -0
  2. package/guide/agent/app-extras/assistant.md +9 -20
  3. package/guide/agent/app-extras/mobile-capacitor.md +381 -0
  4. package/guide/agent/app-extras/realtime.md +13 -12
  5. package/guide/agent/app-setup/a-more-interesting-shell.md +102 -87
  6. package/guide/agent/app-setup/authentication.md +50 -31
  7. package/guide/agent/app-setup/console.md +8 -8
  8. package/guide/agent/app-setup/database-layer.md +15 -15
  9. package/guide/agent/app-setup/initial-scaffolding.md +37 -5
  10. package/guide/agent/app-setup/multi-homing.md +50 -47
  11. package/guide/agent/app-setup/quickstart.md +11 -14
  12. package/guide/agent/app-setup/users.md +24 -24
  13. package/guide/agent/app-setup/working-with-the-jskit-cli.md +18 -10
  14. package/guide/agent/generators/advanced-cruds.md +111 -68
  15. package/guide/agent/generators/crud-generators.md +5 -5
  16. package/guide/agent/generators/ui-generators.md +44 -36
  17. package/guide/agent/index.md +3 -2
  18. package/package.json +1 -1
  19. package/patterns/INDEX.md +4 -1
  20. package/patterns/client-requests.md +23 -6
  21. package/patterns/crud-repository-mapping.md +1 -1
  22. package/patterns/crud-scaffolding.md +10 -1
  23. package/patterns/filters.md +28 -10
  24. package/patterns/generated-ui-contract-tracking.md +62 -0
  25. package/patterns/page-scaffolding.md +20 -2
  26. package/patterns/placements.md +67 -1
  27. package/patterns/surfaces.md +5 -1
  28. package/patterns/ui-testing.md +3 -0
  29. package/reference/autogen/KERNEL_MAP.md +46 -1
  30. package/reference/autogen/README.md +3 -0
  31. package/reference/autogen/packages/assistant.md +2 -1
  32. package/reference/autogen/packages/auth-web.md +20 -1
  33. package/reference/autogen/packages/crud-ui-generator.md +20 -8
  34. package/reference/autogen/packages/google-rewarded-core.md +222 -0
  35. package/reference/autogen/packages/google-rewarded-web.md +71 -0
  36. package/reference/autogen/packages/kernel.md +94 -10
  37. package/reference/autogen/packages/mobile-capacitor.md +76 -0
  38. package/reference/autogen/packages/realtime.md +1 -0
  39. package/reference/autogen/packages/shell-web.md +48 -3
  40. package/reference/autogen/packages/ui-generator.md +34 -2
  41. package/reference/autogen/packages/users-core.md +2 -0
  42. package/reference/autogen/packages/users-web.md +92 -4
  43. package/reference/autogen/packages/workspaces-web.md +3 -2
  44. package/reference/autogen/tooling/jskit-cli.md +114 -9
  45. package/templates/app/AGENTS.md +1 -0
  46. package/workflow/bootstrap.md +1 -0
package/DISTR_AGENT.md CHANGED
@@ -31,6 +31,7 @@ Core rules:
31
31
  - Keep that checkpoint compact. Do not expand it into a long preamble unless the developer asks for detail.
32
32
  - When a request involves JSKIT UI, routing, surfaces, CRUDs, filters, placements, live actions, or similar implementation details, scan `patterns/INDEX.md` for matching keywords and read only the relevant pattern files.
33
33
  - Reuse existing JSKIT helpers and runtime seams before adding new local helpers.
34
+ - If `npm install` is run while the app is using local JSKIT checkout links, run `npm run devlinks` immediately afterward.
34
35
  - A freshly scaffolded JSKIT app can still be in Stage 1. If platform decisions are not settled yet, continue with the initialize workflow before adding runtime packages.
35
36
  - Do not treat a missing `config.tenancyMode` line or an untouched minimal scaffold as a final tenancy decision.
36
37
  - Do not install tenancy-sensitive packages until Stage 1 decisions are complete and the chosen tenancy is written into `config/public.js`.
@@ -389,7 +389,7 @@ In the `page` subcommand:
389
389
 
390
390
  - the target file path decides the route location
391
391
  - `--name` changes the generated menu label
392
- - `--link-placement`, `--link-component-token`, and `--link-to` are optional overrides if you want to place the route link somewhere other than the generator's normal inferred target
392
+ - `--link-placement` and `--link-to` are optional overrides if you want to place the route link somewhere other than the generator's normal inferred semantic target
393
393
 
394
394
  ## Generating the assistant settings pages
395
395
 
@@ -398,23 +398,17 @@ Now create the three settings pages:
398
398
  ```bash
399
399
  npx jskit generate assistant settings-page \
400
400
  console/settings/assistant/index.vue \
401
- --surface console \
402
- --link-placement console-settings:primary-menu \
403
- --link-component-token local.main.ui.surface-aware-menu-link-item
401
+ --surface console
404
402
 
405
403
  npx jskit generate assistant settings-page \
406
404
  console/settings/admin-assistant/index.vue \
407
405
  --surface admin \
408
- --name "Admin Assistant" \
409
- --link-placement console-settings:primary-menu \
410
- --link-component-token local.main.ui.surface-aware-menu-link-item
406
+ --name "Admin Assistant"
411
407
 
412
408
  npx jskit generate assistant settings-page \
413
409
  w/[workspaceSlug]/admin/workspace/settings/app-assistant/index.vue \
414
410
  --surface app \
415
- --name "App Assistant" \
416
- --link-placement admin-settings:primary-menu \
417
- --link-component-token local.main.ui.surface-aware-menu-link-item
411
+ --name "App Assistant"
418
412
  ```
419
413
 
420
414
  This is the part that often trips people up, so read the rule carefully:
@@ -443,19 +437,14 @@ import { AssistantSettingsClientElement } from "@jskit-ai/assistant-runtime/clie
443
437
 
444
438
  The file path decides where the settings screen is opened. `target-surface-id` decides which assistant it edits.
445
439
 
446
- The extra link options matter here too:
440
+ The inferred placement matters here too:
447
441
 
448
- - `--link-placement`
449
- - which settings menu outlet should receive the generated link
450
- - `--link-component-token`
451
- - which link component token should render that menu entry
452
442
  - `--name`
453
443
  - the label shown for the settings entry
454
444
 
455
- That is why the chapter uses:
445
+ The console settings pages live under the console settings host, so JSKIT infers `page.section-nav` with owner `console-settings`. The workspace settings page lives under the admin workspace settings host, so JSKIT infers `page.section-nav` with owner `admin-settings`.
456
446
 
457
- - `console-settings:primary-menu` for the two console-owned settings screens
458
- - `admin-settings:primary-menu` for the workspace-admin-owned settings screen
447
+ The concrete outlet and link renderer come from topology. Those settings hosts map `page.section-nav` to their concrete menus in `src/placementTopology.js`, so the commands do not need renderer flags.
459
448
 
460
449
  ## What to look at in the browser
461
450
 
@@ -466,7 +455,7 @@ npm run dev
466
455
  npm run server
467
456
  ```
468
457
 
469
- After sign-in, the app should now expose these assistant routes:
458
+ After sign-in, the app should expose these assistant routes:
470
459
 
471
460
  - `/console/assistant`
472
461
  - `/w/your-personal-slug/admin/assistant`
@@ -545,7 +534,7 @@ That is what lets one app host several assistants at once without their AI setti
545
534
 
546
535
  ### `.env` gains one AI block per assistant surface
547
536
 
548
- The app now gets env keys such as:
537
+ The app gets env keys such as:
549
538
 
550
539
  ```dotenv
551
540
  CONSOLE_ASSISTANT_AI_PROVIDER=openai
@@ -0,0 +1,381 @@
1
+ <!-- Generated by `npm run agent-docs:build` from `packages/agent-docs/site/guide/app-extras/mobile-capacitor.md`. Do not edit manually. -->
2
+
3
+ # Mobile Capacitor
4
+
5
+ This chapter explains how to put a JSKIT app on an Android phone with the
6
+ Capacitor shell.
7
+
8
+ The normal result is:
9
+
10
+ - your JSKIT web app runs inside an Android shell
11
+ - the app can talk to your backend
12
+ - deep links and auth callback routing still go through normal JSKIT routes
13
+ - you can rebuild, reinstall, tunnel, and restart with `jskit mobile ...`
14
+
15
+ ## Install it
16
+
17
+ From the app root:
18
+
19
+ ```bash
20
+ npx jskit add package @jskit-ai/mobile-capacitor
21
+ ```
22
+
23
+ That command:
24
+
25
+ - installs `@jskit-ai/mobile-capacitor`
26
+ - installs the required Capacitor packages
27
+ - seeds `config.mobile` if it is missing
28
+ - renders `capacitor.config.json`
29
+ - provisions `android/`
30
+ - refreshes the managed Android shell files from `config.mobile`
31
+
32
+ After that, run:
33
+
34
+ ```bash
35
+ npx jskit mobile android doctor
36
+ ```
37
+
38
+ If doctor passes, the app is ready for the normal mobile workflow.
39
+ The `jskit mobile android ...` commands expect the mobile runtime package to be
40
+ installed in `package.json` and recorded in `.jskit/lock.json`; they do not
41
+ install `@jskit-ai/mobile-capacitor` for you.
42
+
43
+ ## What you need on your machine
44
+
45
+ ::: tip Required Host Tools
46
+ Before this workflow is healthy, the machine needs all of the following:
47
+
48
+ - `adb` on `PATH`
49
+ - Android SDK installed, with the required platform and build-tools
50
+ - a full JDK, not just a runtime
51
+ - `java` on `PATH`
52
+ - `javac` on `PATH`
53
+ - `ANDROID_HOME` or `ANDROID_SDK_ROOT` set, or `android/local.properties` with `sdk.dir=...`
54
+ - `JAVA_HOME` pointing at a full JDK if `java` / `javac` are not already resolved correctly from `PATH`
55
+
56
+ The end state should be:
57
+
58
+ - `adb devices -l` works
59
+ - `java -version` works
60
+ - `javac -version` works
61
+ - `npx jskit mobile android doctor` passes
62
+ :::
63
+
64
+ If you installed Android Studio, its bundled JDK is often the easiest working
65
+ Java home:
66
+
67
+ ```bash
68
+ export JAVA_HOME="$HOME/android-studio/jbr"
69
+ export PATH="$JAVA_HOME/bin:$PATH"
70
+ ```
71
+
72
+ ## Put the app on your phone
73
+
74
+ Start the backend first:
75
+
76
+ ```bash
77
+ PORT=3000 npm run server
78
+ ```
79
+
80
+ Then use the all-in-one command:
81
+
82
+ ```bash
83
+ npx jskit mobile android dev
84
+ ```
85
+
86
+ This is the one-stop shop for local Android phone testing.
87
+
88
+ It runs these commands in this exact order:
89
+
90
+ ```bash
91
+ npx jskit mobile android sync
92
+ npx jskit mobile android tunnel
93
+ npx jskit mobile android run
94
+ ```
95
+
96
+ That first step is important: for bundled apps, `npx jskit mobile android sync` runs `npm run build` first and then runs `cap sync android`. So yes, `npx jskit mobile android dev` does build the app before it installs/runs the Android shell.
97
+
98
+ If more than one Android device is attached:
99
+
100
+ ```bash
101
+ npx jskit mobile android devices
102
+ npx jskit mobile android dev --target <device-id>
103
+ ```
104
+
105
+ That is the shortest path.
106
+
107
+ ## Manual commands
108
+
109
+ If you want to run the steps yourself instead of using `mobile android dev`,
110
+ these are the commands that matter.
111
+
112
+ ### List devices
113
+
114
+ ```bash
115
+ npx jskit mobile android devices
116
+ ```
117
+
118
+ Prints the Android devices currently visible to `adb`.
119
+
120
+ ### Sync the Android shell
121
+
122
+ ```bash
123
+ npx jskit mobile android sync
124
+ ```
125
+
126
+ This:
127
+
128
+ - refreshes the managed mobile files from `config.mobile`
129
+ - builds the JSKIT web app into `dist/`
130
+ - runs `cap sync android`
131
+
132
+ The refresh step requires the managed files from the package install to exist.
133
+ If `capacitor.config.json` or `.jskit/mobile-capacitor.md` is missing, install
134
+ the package again with `npx jskit add package @jskit-ai/mobile-capacitor`.
135
+
136
+ ### Create the local tunnel
137
+
138
+ ```bash
139
+ npx jskit mobile android tunnel
140
+ ```
141
+
142
+ If you want a specific device:
143
+
144
+ ```bash
145
+ npx jskit mobile android tunnel --target <device-id>
146
+ ```
147
+
148
+ This command creates the `adb reverse` tunnel that lets the phone reach your
149
+ laptop's local backend.
150
+
151
+ ### Install and run the app
152
+
153
+ ```bash
154
+ npx jskit mobile android run
155
+ ```
156
+
157
+ Or:
158
+
159
+ ```bash
160
+ npx jskit mobile android run --target <device-id>
161
+ ```
162
+
163
+ This launches the Android shell through Capacitor.
164
+
165
+ ### Restart cleanly
166
+
167
+ ```bash
168
+ npx jskit mobile android restart
169
+ ```
170
+
171
+ Or:
172
+
173
+ ```bash
174
+ npx jskit mobile android restart --target <device-id>
175
+ ```
176
+
177
+ This:
178
+
179
+ - clears app data
180
+ - force-stops the Android app
181
+ - cold-starts `MainActivity`
182
+
183
+ Use it when you want a clean signed-out state.
184
+
185
+ ## The command set
186
+
187
+ These are the CLI mobile commands used by the package workflow:
188
+
189
+ - `jskit mobile android devices`
190
+ - list visible Android devices
191
+ - `jskit mobile android doctor`
192
+ - validate config, shell files, SDK, and host readiness
193
+ - `jskit mobile android dev`
194
+ - run the standard local-phone development flow
195
+ - `jskit mobile android sync`
196
+ - rebuild and sync the Android shell
197
+ - `jskit mobile android tunnel`
198
+ - create and verify the `adb reverse` tunnel
199
+ - `jskit mobile android run`
200
+ - launch the Android shell
201
+ - `jskit mobile android restart`
202
+ - clear app data and cold-start the app
203
+ - `jskit mobile android build`
204
+ - build the Android release bundle
205
+
206
+ ## The default local-dev setup
207
+
208
+ When `jskit add package @jskit-ai/mobile-capacitor` seeds `config.mobile` for the first time, it
209
+ creates a working local-dev default.
210
+
211
+ The important part is:
212
+
213
+ ```js
214
+ config.mobile = {
215
+ enabled: true,
216
+ strategy: "capacitor",
217
+ assetMode: "bundled",
218
+ apiBaseUrl: "http://127.0.0.1:3000",
219
+ auth: {
220
+ callbackPath: "/auth/login",
221
+ customScheme: "your-app-slug"
222
+ }
223
+ };
224
+ ```
225
+
226
+ That default is good for local phone development against your laptop.
227
+
228
+ It also means:
229
+
230
+ - the backend must be running on your laptop
231
+ - the app needs an `adb reverse` tunnel
232
+
233
+ If `apiBaseUrl` later points to a real remote `https://...` backend, the tunnel
234
+ is no longer required.
235
+
236
+ ## A good day-to-day loop
237
+
238
+ Once the package is installed, the normal loop is:
239
+
240
+ ```bash
241
+ PORT=3000 npm run server
242
+ npx jskit mobile android dev
243
+ ```
244
+
245
+ If you want to rerun steps manually, a predictable sequence is:
246
+
247
+ ```bash
248
+ npx jskit mobile android sync
249
+ npx jskit mobile android tunnel
250
+ npx jskit mobile android run
251
+ ```
252
+
253
+ And if you need a clean state afterward:
254
+
255
+ ```bash
256
+ npx jskit mobile android restart
257
+ ```
258
+
259
+ ## Behind the scenes
260
+
261
+ ### `config.mobile` is the source of truth
262
+
263
+ The Android shell is not configured by hand in scattered native files. JSKIT
264
+ renders the shell from `config.mobile`.
265
+
266
+ That config drives:
267
+
268
+ - Capacitor app id and app name
269
+ - Android package name
270
+ - app version values
271
+ - API base URL
272
+ - auth callback path
273
+ - custom URL scheme
274
+
275
+ ### The shell is still a JSKIT web app
276
+
277
+ The UI still comes from the JSKIT web client.
278
+
279
+ Stage 1 mobile does not turn JSKIT into a native UI framework. It packages the
280
+ web app into a Capacitor Android shell.
281
+
282
+ That is why `jskit mobile android sync` still builds the web app first.
283
+
284
+ ### Managed files
285
+
286
+ The package manages:
287
+
288
+ - `capacitor.config.json`
289
+ - `.jskit/mobile-capacitor.md`
290
+ - the Android shell under `android/`
291
+ - managed Android identity files such as:
292
+ - `android/app/build.gradle`
293
+ - `android/variables.gradle`
294
+ - `android/app/src/main/res/values/strings.xml`
295
+ - `MainActivity.java` or `MainActivity.kt`
296
+ - the managed deep-link block in `AndroidManifest.xml`
297
+
298
+ After the package is installed, `jskit mobile android sync` refreshes those
299
+ managed files from `config.mobile`.
300
+
301
+ ### Why the tunnel exists
302
+
303
+ Inside the Android shell, the phone's `127.0.0.1` is the phone itself, not your
304
+ laptop.
305
+
306
+ So when local development uses:
307
+
308
+ ```text
309
+ http://127.0.0.1:3000
310
+ ```
311
+
312
+ the phone still needs a bridge back to your laptop.
313
+
314
+ That bridge is:
315
+
316
+ ```bash
317
+ adb reverse tcp:3000 tcp:3000
318
+ ```
319
+
320
+ `jskit mobile android tunnel` wraps that and shows `adb reverse --list`
321
+ afterward so you can see the active mapping.
322
+
323
+ ### What happens to URLs
324
+
325
+ Inside the Capacitor shell there are two relevant URL worlds:
326
+
327
+ - shell/webview origin:
328
+ - `https://localhost/...`
329
+ - backend/API origin:
330
+ - usually `config.mobile.apiBaseUrl`
331
+
332
+ JSKIT keeps app code using normal relative server paths such as:
333
+
334
+ - `/api/session`
335
+ - `/api/bootstrap`
336
+ - `/socket.io/...`
337
+
338
+ The mobile runtime adapts those requests to the configured backend origin.
339
+
340
+ That is why app code does not need a separate "mobile API client" pattern for
341
+ the standard JSKIT server routes.
342
+
343
+ ### Why local HTTP works on Android
344
+
345
+ For the local-dev case, the backend URL is often plain `http`.
346
+
347
+ The mobile shell therefore needs:
348
+
349
+ - Capacitor native HTTP enabled
350
+ - Android cleartext traffic allowed for the generated shell
351
+
352
+ Without those, Android or the WebView will block local backend traffic even if
353
+ the tunnel itself is correct.
354
+
355
+ ### Auth and deep links
356
+
357
+ The mobile shell does not invent a separate auth route system.
358
+
359
+ The normal contract stays:
360
+
361
+ - OAuth start opens in the external browser/custom tab
362
+ - callback returns through the app's custom scheme
363
+ - callback path is still the normal JSKIT path:
364
+ - `/auth/login`
365
+
366
+ Deep links and auth completion are normalized back into the normal JSKIT router.
367
+
368
+ ### What `doctor` is actually checking
369
+
370
+ `jskit mobile android doctor` is the preflight command for this whole lane.
371
+
372
+ It checks:
373
+
374
+ - `config.mobile`
375
+ - managed shell file freshness
376
+ - Android shell presence
377
+ - deep-link wiring
378
+ - Android SDK basics
379
+ - host readiness for the shell path
380
+
381
+ If mobile work looks strange, run doctor first.
@@ -21,13 +21,13 @@ The first command records the runtime package in the app and updates the existin
21
21
 
22
22
  Unlike the database, users, console, and workspace chapters, this one does **not** need `npm run db:migrate`. `realtime` does not add schema files. It is transport infrastructure, not persistence.
23
23
 
24
- ## What changes now
24
+ ## What the package adds
25
25
 
26
- Installing `realtime` changes the app in three important ways.
26
+ Installing `realtime` adds three app capabilities.
27
27
 
28
28
  ### The app gets a realtime transport
29
29
 
30
- The server now mounts a socket.io runtime on the same Fastify server that already serves your JSKIT surfaces. The browser gets a matching socket.io client runtime through the normal client boot process.
30
+ The server mounts a socket.io runtime on the same Fastify server that already serves your JSKIT surfaces. The browser gets a matching socket.io client runtime through the normal client boot process.
31
31
 
32
32
  That means later modules, or your own app code, can stop thinking only in terms of request/response HTTP flows. They can start publishing live events and listening for them in Vue.
33
33
 
@@ -35,7 +35,7 @@ That means later modules, or your own app code, can stop thinking only in terms
35
35
 
36
36
  The package also uses the shell scaffolding that already exists.
37
37
 
38
- `realtime` appends a placement entry into `src/placement.js` that targets `shell-layout:top-right`, so the shell starts showing a small status dot without you having to create a new page for it.
38
+ `realtime` appends a placement entry into `src/placement.js` that targets the semantic `shell.status` placement, so the shell shows a small status dot without you having to create a new page for it. In the default shell topology, `shell.status` renders through the concrete `shell-layout:top-right` outlet.
39
39
 
40
40
  That dot is:
41
41
 
@@ -52,7 +52,7 @@ The app already had a browser dev server on `5173` and a backend runtime on `300
52
52
 
53
53
  So one of the main values of this package is that you do **not** have to hand-edit Vite config just to make socket.io work in local development.
54
54
 
55
- ### There are still no new pages
55
+ ### There are no realtime pages
56
56
 
57
57
  This is worth saying clearly because it can otherwise feel surprising.
58
58
 
@@ -75,7 +75,7 @@ npm run server
75
75
 
76
76
  Then open `http://localhost:5173/home`.
77
77
 
78
- The important visible change is in the top-right of the shell. You should now see the realtime status dot alongside the other shell controls.
78
+ The visible check is the shell status area. You should see the realtime status dot alongside the other shell controls.
79
79
 
80
80
  If the websocket connects successfully, the dot is green. If the backend is unavailable or the socket is reconnecting, the dot is red. Hovering it shows the current status text.
81
81
 
@@ -159,14 +159,15 @@ After the install, the app has:
159
159
 
160
160
  That one entry is what lets the browser dev server proxy websocket traffic correctly during local development.
161
161
 
162
- ### `src/placement.js` grows one new shell placement
162
+ ### `src/placement.js` includes the shell status placement
163
163
 
164
164
  The package appends this placement:
165
165
 
166
166
  ```js
167
167
  addPlacement({
168
168
  id: "realtime.connection.indicator",
169
- target: "shell-layout:top-right",
169
+ target: "shell.status",
170
+ kind: "component",
170
171
  surfaces: ["*"],
171
172
  order: 950,
172
173
  componentToken: "realtime.web.connection.indicator"
@@ -215,9 +216,9 @@ That is the right level of abstraction for this package:
215
216
 
216
217
  ## Summary
217
218
 
218
- This chapter does not make the app look radically different, but it adds an important new capability.
219
+ This chapter does not make the app look radically different, but it adds an important capability.
219
220
 
220
- - the backend can now host a realtime socket server
221
- - the frontend can now keep one shared websocket connection alive
222
- - the shell now exposes a live connection indicator
221
+ - the backend hosts a realtime socket server
222
+ - the frontend keeps one shared websocket connection alive
223
+ - the shell exposes a live connection indicator
223
224
  - later modules can build live behavior on top of that transport without inventing their own websocket setup