@jskit-ai/agent-docs 0.1.25 → 0.1.27

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 (29) hide show
  1. package/guide/agent/app-extras/assistant.md +7 -18
  2. package/guide/agent/app-extras/mobile-capacitor.md +374 -0
  3. package/guide/agent/app-extras/realtime.md +2 -1
  4. package/guide/agent/app-setup/a-more-interesting-shell.md +54 -47
  5. package/guide/agent/app-setup/authentication.md +10 -9
  6. package/guide/agent/app-setup/console.md +3 -3
  7. package/guide/agent/app-setup/multi-homing.md +22 -19
  8. package/guide/agent/app-setup/quickstart.md +11 -14
  9. package/guide/agent/app-setup/users.md +3 -3
  10. package/guide/agent/app-setup/working-with-the-jskit-cli.md +5 -4
  11. package/guide/agent/generators/ui-generators.md +29 -23
  12. package/guide/agent/index.md +3 -2
  13. package/package.json +1 -1
  14. package/patterns/page-scaffolding.md +3 -2
  15. package/patterns/placements.md +7 -1
  16. package/reference/autogen/KERNEL_MAP.md +16 -0
  17. package/reference/autogen/README.md +3 -0
  18. package/reference/autogen/packages/assistant.md +1 -0
  19. package/reference/autogen/packages/auth-web.md +20 -1
  20. package/reference/autogen/packages/crud-ui-generator.md +1 -0
  21. package/reference/autogen/packages/google-rewarded-core.md +222 -0
  22. package/reference/autogen/packages/google-rewarded-web.md +71 -0
  23. package/reference/autogen/packages/kernel.md +58 -6
  24. package/reference/autogen/packages/mobile-capacitor.md +76 -0
  25. package/reference/autogen/packages/shell-web.md +13 -0
  26. package/reference/autogen/packages/ui-generator.md +11 -0
  27. package/reference/autogen/packages/users-web.md +0 -1
  28. package/reference/autogen/packages/workspaces-web.md +0 -1
  29. package/reference/autogen/tooling/jskit-cli.md +98 -9
@@ -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
 
@@ -0,0 +1,374 @@
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
+
40
+ ## What you need on your machine
41
+
42
+ ::: tip Required Host Tools
43
+ Before this workflow is healthy, the machine needs all of the following:
44
+
45
+ - `adb` on `PATH`
46
+ - Android SDK installed, with the required platform and build-tools
47
+ - a full JDK, not just a runtime
48
+ - `java` on `PATH`
49
+ - `javac` on `PATH`
50
+ - `ANDROID_HOME` or `ANDROID_SDK_ROOT` set, or `android/local.properties` with `sdk.dir=...`
51
+ - `JAVA_HOME` pointing at a full JDK if `java` / `javac` are not already resolved correctly from `PATH`
52
+
53
+ The end state should be:
54
+
55
+ - `adb devices -l` works
56
+ - `java -version` works
57
+ - `javac -version` works
58
+ - `npx jskit mobile android doctor` passes
59
+ :::
60
+
61
+ If you installed Android Studio, its bundled JDK is often the easiest working
62
+ Java home:
63
+
64
+ ```bash
65
+ export JAVA_HOME="$HOME/android-studio/jbr"
66
+ export PATH="$JAVA_HOME/bin:$PATH"
67
+ ```
68
+
69
+ ## Put the app on your phone
70
+
71
+ Start the backend first:
72
+
73
+ ```bash
74
+ PORT=3000 npm run server
75
+ ```
76
+
77
+ Then use the all-in-one command:
78
+
79
+ ```bash
80
+ npx jskit mobile android dev
81
+ ```
82
+
83
+ This is the one-stop shop for local Android phone testing.
84
+
85
+ It runs these commands in this exact order:
86
+
87
+ ```bash
88
+ npx jskit mobile android sync
89
+ npx jskit mobile android tunnel
90
+ npx jskit mobile android run
91
+ ```
92
+
93
+ 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.
94
+
95
+ If more than one Android device is attached:
96
+
97
+ ```bash
98
+ npx jskit mobile android devices
99
+ npx jskit mobile android dev --target <device-id>
100
+ ```
101
+
102
+ That is the shortest path.
103
+
104
+ ## Manual commands
105
+
106
+ If you want to run the steps yourself instead of using `mobile android dev`,
107
+ these are the commands that matter.
108
+
109
+ ### List devices
110
+
111
+ ```bash
112
+ npx jskit mobile android devices
113
+ ```
114
+
115
+ Prints the Android devices currently visible to `adb`.
116
+
117
+ ### Sync the Android shell
118
+
119
+ ```bash
120
+ npx jskit mobile android sync
121
+ ```
122
+
123
+ This:
124
+
125
+ - refreshes the managed mobile files from `config.mobile`
126
+ - builds the JSKIT web app into `dist/`
127
+ - runs `cap sync android`
128
+
129
+ ### Create the local tunnel
130
+
131
+ ```bash
132
+ npx jskit mobile android tunnel
133
+ ```
134
+
135
+ If you want a specific device:
136
+
137
+ ```bash
138
+ npx jskit mobile android tunnel --target <device-id>
139
+ ```
140
+
141
+ This command creates the `adb reverse` tunnel that lets the phone reach your
142
+ laptop's local backend.
143
+
144
+ ### Install and run the app
145
+
146
+ ```bash
147
+ npx jskit mobile android run
148
+ ```
149
+
150
+ Or:
151
+
152
+ ```bash
153
+ npx jskit mobile android run --target <device-id>
154
+ ```
155
+
156
+ This launches the Android shell through Capacitor.
157
+
158
+ ### Restart cleanly
159
+
160
+ ```bash
161
+ npx jskit mobile android restart
162
+ ```
163
+
164
+ Or:
165
+
166
+ ```bash
167
+ npx jskit mobile android restart --target <device-id>
168
+ ```
169
+
170
+ This:
171
+
172
+ - clears app data
173
+ - force-stops the Android app
174
+ - cold-starts `MainActivity`
175
+
176
+ Use it when you want a clean signed-out state.
177
+
178
+ ## The command set
179
+
180
+ These are the mobile commands the package adds:
181
+
182
+ - `jskit mobile android devices`
183
+ - list visible Android devices
184
+ - `jskit mobile android doctor`
185
+ - validate config, shell files, SDK, and host readiness
186
+ - `jskit mobile android dev`
187
+ - run the standard local-phone development flow
188
+ - `jskit mobile android sync`
189
+ - rebuild and sync the Android shell
190
+ - `jskit mobile android tunnel`
191
+ - create and verify the `adb reverse` tunnel
192
+ - `jskit mobile android run`
193
+ - launch the Android shell
194
+ - `jskit mobile android restart`
195
+ - clear app data and cold-start the app
196
+ - `jskit mobile android build`
197
+ - build the Android release bundle
198
+
199
+ ## The default local-dev setup
200
+
201
+ When `jskit add package @jskit-ai/mobile-capacitor` seeds `config.mobile` for the first time, it
202
+ creates a working local-dev default.
203
+
204
+ The important part is:
205
+
206
+ ```js
207
+ config.mobile = {
208
+ enabled: true,
209
+ strategy: "capacitor",
210
+ assetMode: "bundled",
211
+ apiBaseUrl: "http://127.0.0.1:3000",
212
+ auth: {
213
+ callbackPath: "/auth/login",
214
+ customScheme: "your-app-slug"
215
+ }
216
+ };
217
+ ```
218
+
219
+ That default is good for local phone development against your laptop.
220
+
221
+ It also means:
222
+
223
+ - the backend must be running on your laptop
224
+ - the app needs an `adb reverse` tunnel
225
+
226
+ If `apiBaseUrl` later points to a real remote `https://...` backend, the tunnel
227
+ is no longer required.
228
+
229
+ ## A good day-to-day loop
230
+
231
+ Once the package is installed, the normal loop is:
232
+
233
+ ```bash
234
+ PORT=3000 npm run server
235
+ npx jskit mobile android dev
236
+ ```
237
+
238
+ If you want to rerun steps manually, a predictable sequence is:
239
+
240
+ ```bash
241
+ npx jskit mobile android sync
242
+ npx jskit mobile android tunnel
243
+ npx jskit mobile android run
244
+ ```
245
+
246
+ And if you need a clean state afterward:
247
+
248
+ ```bash
249
+ npx jskit mobile android restart
250
+ ```
251
+
252
+ ## Behind the scenes
253
+
254
+ ### `config.mobile` is the source of truth
255
+
256
+ The Android shell is not configured by hand in scattered native files. JSKIT
257
+ renders the shell from `config.mobile`.
258
+
259
+ That config drives:
260
+
261
+ - Capacitor app id and app name
262
+ - Android package name
263
+ - app version values
264
+ - API base URL
265
+ - auth callback path
266
+ - custom URL scheme
267
+
268
+ ### The shell is still a JSKIT web app
269
+
270
+ The UI still comes from the JSKIT web client.
271
+
272
+ Stage 1 mobile does not turn JSKIT into a native UI framework. It packages the
273
+ web app into a Capacitor Android shell.
274
+
275
+ That is why `jskit mobile android sync` still builds the web app first.
276
+
277
+ ### Managed files
278
+
279
+ The package manages:
280
+
281
+ - `capacitor.config.json`
282
+ - `.jskit/mobile-capacitor.md`
283
+ - the Android shell under `android/`
284
+ - managed Android identity files such as:
285
+ - `android/app/build.gradle`
286
+ - `android/variables.gradle`
287
+ - `android/app/src/main/res/values/strings.xml`
288
+ - `MainActivity.java` or `MainActivity.kt`
289
+ - the managed deep-link block in `AndroidManifest.xml`
290
+
291
+ `jskit mobile android sync` is expected to refresh those files from
292
+ `config.mobile`.
293
+
294
+ ### Why the tunnel exists
295
+
296
+ Inside the Android shell, the phone's `127.0.0.1` is the phone itself, not your
297
+ laptop.
298
+
299
+ So when local development uses:
300
+
301
+ ```text
302
+ http://127.0.0.1:3000
303
+ ```
304
+
305
+ the phone still needs a bridge back to your laptop.
306
+
307
+ That bridge is:
308
+
309
+ ```bash
310
+ adb reverse tcp:3000 tcp:3000
311
+ ```
312
+
313
+ `jskit mobile android tunnel` wraps that and shows `adb reverse --list`
314
+ afterward so you can see the active mapping.
315
+
316
+ ### What happens to URLs
317
+
318
+ Inside the Capacitor shell there are two relevant URL worlds:
319
+
320
+ - shell/webview origin:
321
+ - `https://localhost/...`
322
+ - backend/API origin:
323
+ - usually `config.mobile.apiBaseUrl`
324
+
325
+ JSKIT keeps app code using normal relative server paths such as:
326
+
327
+ - `/api/session`
328
+ - `/api/bootstrap`
329
+ - `/socket.io/...`
330
+
331
+ The mobile runtime adapts those requests to the configured backend origin.
332
+
333
+ That is why app code does not need a separate "mobile API client" pattern for
334
+ the standard JSKIT server routes.
335
+
336
+ ### Why local HTTP works on Android
337
+
338
+ For the local-dev case, the backend URL is often plain `http`.
339
+
340
+ The mobile shell therefore needs:
341
+
342
+ - Capacitor native HTTP enabled
343
+ - Android cleartext traffic allowed for the generated shell
344
+
345
+ Without those, Android or the WebView will block local backend traffic even if
346
+ the tunnel itself is correct.
347
+
348
+ ### Auth and deep links
349
+
350
+ The mobile shell does not invent a separate auth route system.
351
+
352
+ The normal contract stays:
353
+
354
+ - OAuth start opens in the external browser/custom tab
355
+ - callback returns through the app's custom scheme
356
+ - callback path is still the normal JSKIT path:
357
+ - `/auth/login`
358
+
359
+ Deep links and auth completion are normalized back into the normal JSKIT router.
360
+
361
+ ### What `doctor` is actually checking
362
+
363
+ `jskit mobile android doctor` is the preflight command for this whole lane.
364
+
365
+ It checks:
366
+
367
+ - `config.mobile`
368
+ - managed shell file freshness
369
+ - Android shell presence
370
+ - deep-link wiring
371
+ - Android SDK basics
372
+ - host readiness for the shell path
373
+
374
+ If mobile work looks strange, run doctor first.
@@ -166,7 +166,8 @@ The package appends this placement:
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"