@jskit-ai/agent-docs 0.1.1

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 (73) hide show
  1. package/DISTR_AGENT.md +25 -0
  2. package/guide/agent/app-extras/assistant.md +636 -0
  3. package/guide/agent/app-extras/realtime.md +223 -0
  4. package/guide/agent/app-setup/a-more-interesting-shell.md +643 -0
  5. package/guide/agent/app-setup/authentication.md +948 -0
  6. package/guide/agent/app-setup/console.md +316 -0
  7. package/guide/agent/app-setup/database-layer.md +775 -0
  8. package/guide/agent/app-setup/initial-scaffolding.md +714 -0
  9. package/guide/agent/app-setup/multi-homing.md +655 -0
  10. package/guide/agent/app-setup/users.md +355 -0
  11. package/guide/agent/app-setup/working-with-the-jskit-cli.md +983 -0
  12. package/guide/agent/generators/advanced-cruds.md +923 -0
  13. package/guide/agent/generators/crud-generators.md +556 -0
  14. package/guide/agent/generators/intro.md +63 -0
  15. package/guide/agent/generators/ui-generators.md +648 -0
  16. package/guide/agent/index.md +39 -0
  17. package/guide/human/app-extras/assistant.md +695 -0
  18. package/guide/human/app-extras/realtime.md +270 -0
  19. package/guide/human/app-setup/a-more-interesting-shell.md +734 -0
  20. package/guide/human/app-setup/authentication.md +963 -0
  21. package/guide/human/app-setup/console.md +352 -0
  22. package/guide/human/app-setup/database-layer.md +822 -0
  23. package/guide/human/app-setup/initial-scaffolding.md +738 -0
  24. package/guide/human/app-setup/multi-homing.md +795 -0
  25. package/guide/human/app-setup/users.md +404 -0
  26. package/guide/human/app-setup/working-with-the-jskit-cli.md +997 -0
  27. package/guide/human/generators/advanced-cruds.md +923 -0
  28. package/guide/human/generators/crud-generators.md +556 -0
  29. package/guide/human/generators/intro.md +109 -0
  30. package/guide/human/generators/ui-generators.md +665 -0
  31. package/guide/human/index.md +39 -0
  32. package/package.json +28 -0
  33. package/reference/autogen/KERNEL_MAP.md +536 -0
  34. package/reference/autogen/README.md +44 -0
  35. package/reference/autogen/packages/agent-docs.md +13 -0
  36. package/reference/autogen/packages/assistant-core.md +310 -0
  37. package/reference/autogen/packages/assistant-runtime.md +219 -0
  38. package/reference/autogen/packages/assistant.md +73 -0
  39. package/reference/autogen/packages/auth-core.md +352 -0
  40. package/reference/autogen/packages/auth-provider-supabase-core.md +223 -0
  41. package/reference/autogen/packages/auth-web.md +267 -0
  42. package/reference/autogen/packages/console-core.md +116 -0
  43. package/reference/autogen/packages/console-web.md +37 -0
  44. package/reference/autogen/packages/crud-core.md +283 -0
  45. package/reference/autogen/packages/crud-server-generator.md +220 -0
  46. package/reference/autogen/packages/crud-ui-generator.md +154 -0
  47. package/reference/autogen/packages/database-runtime-mysql.md +61 -0
  48. package/reference/autogen/packages/database-runtime-postgres.md +39 -0
  49. package/reference/autogen/packages/database-runtime.md +216 -0
  50. package/reference/autogen/packages/http-runtime.md +213 -0
  51. package/reference/autogen/packages/kernel.md +1350 -0
  52. package/reference/autogen/packages/realtime.md +95 -0
  53. package/reference/autogen/packages/shell-web.md +349 -0
  54. package/reference/autogen/packages/storage-runtime.md +39 -0
  55. package/reference/autogen/packages/ui-generator.md +101 -0
  56. package/reference/autogen/packages/uploads-image-web.md +76 -0
  57. package/reference/autogen/packages/uploads-runtime.md +85 -0
  58. package/reference/autogen/packages/users-core.md +307 -0
  59. package/reference/autogen/packages/users-web.md +473 -0
  60. package/reference/autogen/packages/workspaces-core.md +415 -0
  61. package/reference/autogen/packages/workspaces-web.md +372 -0
  62. package/reference/autogen/tooling/config-eslint.md +52 -0
  63. package/reference/autogen/tooling/create-app.md +194 -0
  64. package/reference/autogen/tooling/jskit-catalog.md +27 -0
  65. package/reference/autogen/tooling/jskit-cli.md +624 -0
  66. package/reference/autogen/tooling/test-support.md +27 -0
  67. package/reference/autogen/tooling/testUtils.md +31 -0
  68. package/templates/APP_BLUEPRINT.md +57 -0
  69. package/workflow/app-state.md +33 -0
  70. package/workflow/bootstrap.md +24 -0
  71. package/workflow/feature-delivery.md +21 -0
  72. package/workflow/review.md +22 -0
  73. package/workflow/scoping.md +26 -0
@@ -0,0 +1,352 @@
1
+ <!-- Generated by `npm run agent-docs:build` from `docs/guide/app-setup/console.md`. Do not edit manually. -->
2
+
3
+ # Console
4
+
5
+ This chapter adds a separate `console` surface and looks at how JSKIT keeps that operator slice separate from the normal account/user layer.
6
+
7
+ The important architectural change is simple:
8
+
9
+ - `users-web` owns account UI
10
+ - `console-web` owns console UI
11
+ - `console-core` owns the console schema, bootstrap flag, routes, and services behind it
12
+
13
+ ## Recap from previous chapters
14
+
15
+ To get back to the same starting point as the end of the previous chapter, run:
16
+
17
+ ```bash
18
+ SUPABASE_URL=...
19
+ SUPABASE_KEY=...
20
+ DB_HOST=127.0.0.1
21
+ DB_PORT=3306
22
+ DB_NAME=exampleapp
23
+ DB_USER=exampleapp
24
+ DB_PASSWORD=secret
25
+
26
+ npx @jskit-ai/create-app exampleapp --tenancy-mode none
27
+ cd exampleapp
28
+ npm install
29
+
30
+ npx jskit add package shell-web
31
+ npx jskit add package auth-provider-supabase-core \
32
+ --auth-supabase-url "$SUPABASE_URL" \
33
+ --auth-supabase-publishable-key "$SUPABASE_KEY" \
34
+ --app-public-url "http://localhost:5173"
35
+ npx jskit add bundle auth-base
36
+ npx jskit add package database-runtime-mysql \
37
+ --db-host "$DB_HOST" \
38
+ --db-port "$DB_PORT" \
39
+ --db-name "$DB_NAME" \
40
+ --db-user "$DB_USER" \
41
+ --db-password "$DB_PASSWORD"
42
+ npx jskit add package users-web
43
+ npm install
44
+ npm run db:migrate
45
+ ```
46
+
47
+ If you are already continuing from the previous chapter, you are already in the right place and can skip that setup.
48
+
49
+ ## Installing `console-web`
50
+
51
+ From inside `exampleapp`, run:
52
+
53
+ ```bash
54
+ npx jskit add package console-web
55
+ npm install
56
+ npm run db:migrate
57
+ ```
58
+
59
+ `console-web` brings one important dependency with it:
60
+
61
+ - `console-core` owns the console schema, owner check, bootstrap flag, and API routes
62
+ - `console-web` owns the console surface scaffold, settings shell, and menu placement
63
+
64
+ So the console is a real vertical slice now. The users packages no longer know about it.
65
+
66
+ ## What the console is for
67
+
68
+ The console is not a second home page, and it is not the same as account settings.
69
+
70
+ Its role is much lower-level than that.
71
+
72
+ - `account` is for the current user's own profile and settings
73
+ - `console` is for the people who run the app as a whole
74
+
75
+ So when you think about the console, think in terms of app runtime and operations, not personal preferences.
76
+
77
+ This is the surface where you would expect to put things like:
78
+
79
+ - site-wide bans or other cross-user moderation controls
80
+ - server error logging and inspection
81
+ - operational diagnostics
82
+ - maintenance or repair scripts
83
+ - global feature switches
84
+ - whole-app settings that affect every user, not just the current one
85
+
86
+ In other words, the console is the place for configuring and inspecting the runtime of the application as a whole.
87
+
88
+ That is why the starter console page describes itself as:
89
+
90
+ - operator tools
91
+ - scripts
92
+ - diagnostics
93
+
94
+ It is also why the console surface has stricter access rules than `/account`. `/account` is for any signed-in user. `console` is for trusted operators with low-level control over the running app.
95
+
96
+ ## Running it
97
+
98
+ Start both processes:
99
+
100
+ ```bash
101
+ npm run dev
102
+ npm run server
103
+ ```
104
+
105
+ Then sign in.
106
+
107
+ Once you are authenticated, two things matter:
108
+
109
+ - the app now knows who you are as a persistent JSKIT user
110
+ - the console bootstrap logic can determine whether you are the console owner
111
+
112
+ Open:
113
+
114
+ ```text
115
+ http://localhost:5173/console
116
+ ```
117
+
118
+ In a fresh app, the console is intentionally simple.
119
+
120
+ - `/console` is the surface landing page
121
+ - `/console/settings` is the first nested shell route under it
122
+
123
+ That simplicity is useful. It shows the surface boundary clearly before later modules add real console tools.
124
+
125
+ ## Why console access is stricter than account access
126
+
127
+ This is the most important idea in the chapter.
128
+
129
+ The account surface only requires authentication. The console surface requires a specific access flag: `console_owner`.
130
+
131
+ That means the guide now has two different kinds of authenticated routes:
132
+
133
+ - normal authenticated routes such as `/account`
134
+ - privileged authenticated routes such as `/console`
135
+
136
+ This is a very useful distinction for junior developers to see early, because many real apps need both:
137
+
138
+ - somewhere for every signed-in user
139
+ - somewhere only for the app owner or operators
140
+
141
+ ## The first console owner
142
+
143
+ In a fresh app, the console owner is not configured by hand in a seed file. Instead, JSKIT assigns the first console owner lazily during authenticated bootstrap.
144
+
145
+ The rule is simple:
146
+
147
+ - when the users bootstrap contributor has already identified a signed-in user
148
+ - and the later console bootstrap contributor runs for that same request
149
+ - and the singleton console settings record has no owner yet
150
+ - **that user becomes the initial console owner**
151
+
152
+ So the first real authenticated user to pass through that path claims the console. After that, the console owner check becomes strict.
153
+
154
+ This is why the console chapter belongs after the users chapter:
155
+
156
+ - before persistent users exist, there is nobody to own the console
157
+ - once persistent users exist, JSKIT can finally attach console ownership to a real user id
158
+
159
+ ## What `console-web` adds to the app
160
+
161
+ The console surface is spread across surface config, access policy config, the placement registry, and the persistent `console_settings` table.
162
+
163
+ ### `config/public.js` defines the surface
164
+
165
+ The console surface definition is small, but very important:
166
+
167
+ ```js
168
+ config.surfaceDefinitions.console = {
169
+ id: "console",
170
+ label: "Console",
171
+ pagesRoot: "console",
172
+ enabled: true,
173
+ requiresAuth: true,
174
+ requiresWorkspace: false,
175
+ accessPolicyId: "console_owner",
176
+ origin: ""
177
+ };
178
+ ```
179
+
180
+ Two details matter most:
181
+
182
+ - `requiresAuth: true`
183
+ - `accessPolicyId: "console_owner"`
184
+
185
+ So this is not just a named route tree. It is a surface with its own access contract.
186
+
187
+ ### `config/surfaceAccessPolicies.js` defines the rule
188
+
189
+ The matching access policy is:
190
+
191
+ ```js
192
+ surfaceAccessPolicies.console_owner = {
193
+ requireAuth: true,
194
+ requireFlagsAll: ["console_owner"]
195
+ };
196
+ ```
197
+
198
+ This is the first clear example in the guide of a surface guarded by a named flag rather than only by authentication.
199
+
200
+ ### The starter console routes are app-owned
201
+
202
+ After the previous chapter, the app now has:
203
+
204
+ ```text
205
+ src/pages/console.vue
206
+ src/pages/console/index.vue
207
+ src/pages/console/settings.vue
208
+ src/pages/console/settings/index.vue
209
+ ```
210
+
211
+ This follows the same route-owner pattern the guide has already shown on `home` and `settings`.
212
+
213
+ - `src/pages/console.vue` is the console surface wrapper
214
+ - `src/pages/console/index.vue` is the console landing page
215
+ - `src/pages/console/settings.vue` is the nested settings shell
216
+ - `src/pages/console/settings/index.vue` is the initial developer-owned stub
217
+
218
+ That last file is intentionally empty, because later modules are expected to add real console settings sections into the `console-settings:primary-menu` outlet.
219
+
220
+ ### `src/placement.js` wires the first console menu entry
221
+
222
+ The starter placement block is:
223
+
224
+ ```js
225
+ addPlacement({
226
+ id: "console.web.menu.settings",
227
+ target: "shell-layout:primary-menu",
228
+ surfaces: ["console"],
229
+ order: 100,
230
+ componentToken: "local.main.ui.menu-link-item",
231
+ props: {
232
+ label: "Settings",
233
+ to: "/console/settings",
234
+ icon: "mdi-cog-outline"
235
+ },
236
+ when: ({ auth }) => Boolean(auth?.authenticated)
237
+ });
238
+ ```
239
+
240
+ This is why the console drawer immediately has a `Settings` entry.
241
+
242
+ The important design point is the same as in earlier chapters:
243
+
244
+ - the shell layout stays generic
245
+ - the placement registry decides what appears in that surface
246
+
247
+ ## Under the hood
248
+
249
+ ### `console-core` installs the `console_settings` schema
250
+
251
+ The console migration creates a singleton console settings table:
252
+
253
+ ```js
254
+ await knex.schema.createTable("console_settings", (table) => {
255
+ table.bigInteger("id").primary();
256
+ table.bigInteger("owner_user_id").unsigned().nullable().references("id").inTable("users").onDelete("SET NULL");
257
+ table.timestamp("created_at", { useTz: false }).notNullable().defaultTo(knex.fn.now());
258
+ table.timestamp("updated_at", { useTz: false }).notNullable().defaultTo(knex.fn.now());
259
+ });
260
+
261
+ await knex("console_settings").insert({
262
+ id: 1,
263
+ created_at: knex.fn.now(),
264
+ updated_at: knex.fn.now()
265
+ });
266
+ ```
267
+
268
+ That table is the anchor for console ownership.
269
+
270
+ There is only one console settings record, and it can point at exactly one `owner_user_id`.
271
+
272
+ ### The console service claims the first owner lazily
273
+
274
+ The core console service is small enough to read in one glance:
275
+
276
+ ```js
277
+ async function ensureInitialConsoleMember(userId, options = {}) {
278
+ const normalizedUserId = normalizeRecordId(userId, { fallback: null });
279
+ if (!normalizedUserId) {
280
+ throw new AppError(400, "Invalid console user.");
281
+ }
282
+
283
+ return consoleSettingsRepository.ensureOwnerUserId(normalizedUserId, options);
284
+ }
285
+
286
+ async function requireConsoleOwner(context = {}, options = {}) {
287
+ const actorUserId = normalizeRecordId(context?.actor?.id, { fallback: null });
288
+ if (!actorUserId) {
289
+ throw new AppError(401, "Authentication required.");
290
+ }
291
+
292
+ const ownerUserId = await ensureInitialConsoleMember(actorUserId, options);
293
+ if (actorUserId !== ownerUserId) {
294
+ throw new AppError(403, "Forbidden.");
295
+ }
296
+ }
297
+ ```
298
+
299
+ That explains the whole startup story.
300
+
301
+ - if no console owner exists yet, the first authenticated user can become it
302
+ - once an owner exists, everyone else fails the ownership check
303
+
304
+ So the console is seeded lazily, not through a hard-coded seed user.
305
+
306
+ ### `console-core` adds the console access flag to the bootstrap payload
307
+
308
+ After the users bootstrap contributor has already built the authenticated session payload, the later `console-core` bootstrap contributor extends it with the console flag:
309
+
310
+ ```js
311
+ surfaceAccess: {
312
+ ...surfaceAccess,
313
+ consoleowner: consoleOwner
314
+ }
315
+ ```
316
+
317
+ This detail is easy to miss, but it matters:
318
+
319
+ - `users-core` identifies the authenticated user and writes `session.userId`
320
+ - `console-core` reads that authenticated user id
321
+ - `console-core` seeds or checks the singleton console owner record
322
+ - then `console-core` writes `surfaceAccess.consoleowner` into the bootstrap payload
323
+
324
+ That is how JSKIT can reason about console access at surface level without making the users packages know anything about the console.
325
+
326
+ So the console chapter is really about a three-part contract:
327
+
328
+ - a surface definition in public config
329
+ - an ownership check on the server
330
+ - a persistent owner slot in the database
331
+
332
+ That is why the console feels like a real app feature already, even before later chapters add CRUDs and richer operator tools into it.
333
+
334
+ ## Summary
335
+
336
+ This chapter introduced the first privileged operator surface in the guide.
337
+
338
+ - `console-web` added the `console` surface and its starter UI scaffold
339
+ - `console-core` added the console schema, services, bootstrap contributor, and ownership rules
340
+ - the app gained a new surface that is stricter than `/account`
341
+
342
+ That stricter access model is the key idea to keep:
343
+
344
+ - `/account` is for any signed-in user
345
+ - `/console` is only for the console owner
346
+
347
+ So the app now has both:
348
+
349
+ - a normal authenticated user area
350
+ - a privileged operator area with its own server-side ownership check
351
+
352
+ The next chapter changes the routing model again by adding workspace-aware surfaces instead of only global ones.