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