@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,223 @@
1
+ <!-- Generated by `npm run agent-docs:build` from `docs/guide/app-extras/realtime.md`. Do not edit manually. -->
2
+
3
+ # Realtime
4
+
5
+ At the end of the previous chapter, the app already had a real shell, authenticated users, operator tooling, and workspace-aware routing. What it still did not have was a live transport for pushing updates into that shell.
6
+
7
+ This chapter installs `realtime`, which adds JSKIT's socket.io runtime, Vite websocket proxy wiring, and a small connection indicator in the shell.
8
+
9
+ This package is a good example of an "extra" rather than a new structural layer. It does not create new surfaces and it does not generate new pages. Instead, it plugs live behavior into things the guide has already scaffolded.
10
+
11
+ ## Installing `realtime`
12
+
13
+ From inside `exampleapp`, run:
14
+
15
+ ```bash
16
+ npx jskit add package realtime
17
+ npm install
18
+ ```
19
+
20
+ The first command records the runtime package in the app and updates the existing scaffold. The second command downloads the new dependencies, especially `socket.io`, `socket.io-client`, and the optional Redis adapter pieces.
21
+
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
+
24
+ ## What changes now
25
+
26
+ Installing `realtime` changes the app in three important ways.
27
+
28
+ ### The app gets a realtime transport
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.
31
+
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
+
34
+ ### The shell gets a connection indicator
35
+
36
+ The package also uses the shell scaffolding that already exists.
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.
39
+
40
+ That dot is:
41
+
42
+ - green when the realtime socket is connected
43
+ - red when the socket is disconnected or still reconnecting
44
+
45
+ So the first visible value of the package is not a whole new screen. It is a tiny live status element plugged straight into the existing shell.
46
+
47
+ ### Vite starts proxying websocket traffic too
48
+
49
+ The app already had a browser dev server on `5173` and a backend runtime on `3000`.
50
+
51
+ `realtime` extends that setup by writing a websocket proxy entry into `.jskit/vite.dev.proxy.json` for `/socket.io`. That matters because the browser should still talk to the frontend dev server on `5173`, while Vite quietly forwards websocket traffic to the backend runtime on `3000`.
52
+
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
+
55
+ ### There are still no new pages
56
+
57
+ This is worth saying clearly because it can otherwise feel surprising.
58
+
59
+ After installing `realtime`:
60
+
61
+ - there is still no `/realtime` page
62
+ - there is still no new surface
63
+ - there is still no app-owned `src/pages/...` scaffold
64
+
65
+ That is intentional. `realtime` is infrastructure. It makes the existing shell and later runtime packages live-capable instead of giving the app a new section of its own.
66
+
67
+ ## What to look at in the browser
68
+
69
+ Start both processes again:
70
+
71
+ ```bash
72
+ npm run dev
73
+ npm run server
74
+ ```
75
+
76
+ Then open `http://localhost:5173/home`.
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.
79
+
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
+
82
+ That small change is the whole point of this chapter's browser check: the package is already active even though it did not create a page of its own.
83
+
84
+ ## Using the client runtime
85
+
86
+ The connection indicator is useful, but the real reason to install `realtime` is to let client code subscribe to live events.
87
+
88
+ The smallest client-side example looks like this:
89
+
90
+ ```vue
91
+ <script setup>
92
+ import { ref } from "vue";
93
+ import { useRealtimeEvent } from "@jskit-ai/realtime/client/composables/useRealtimeEvent";
94
+
95
+ const lastEvent = ref("Nothing received yet.");
96
+
97
+ useRealtimeEvent({
98
+ event: "demo.ping",
99
+ onEvent({ payload }) {
100
+ lastEvent.value = JSON.stringify(payload);
101
+ }
102
+ });
103
+ </script>
104
+
105
+ <template>
106
+ <p>{{ lastEvent }}</p>
107
+ </template>
108
+ ```
109
+
110
+ That composable does not create any server-side events by itself. It only subscribes the component to the client socket.
111
+
112
+ The important pieces are:
113
+
114
+ - `event`
115
+ - the event name to listen for
116
+ - if you omit it, the composable listens to `*`
117
+ - `onEvent`
118
+ - the handler that receives `{ event, payload, socket }`
119
+ - `matches`
120
+ - an optional predicate if you want to filter events before the handler runs
121
+
122
+ So the mental model is:
123
+
124
+ - `realtime` gives the app a live transport
125
+ - your own app code, or later packages, decide which events should travel across it
126
+
127
+ ## What `realtime` adds to the app
128
+
129
+ This chapter is small enough that it is worth looking directly at the app-owned files it changes.
130
+
131
+ ### `.env` gains the Redis adapter setting
132
+
133
+ The install writes:
134
+
135
+ ```dotenv
136
+ REALTIME_REDIS_URL=
137
+ ```
138
+
139
+ That empty value is deliberate. It means the app can start with the in-memory adapter locally, and you can fill in a real Redis URL later if you need cross-instance fan-out.
140
+
141
+ ### `.jskit/vite.dev.proxy.json` gains a websocket proxy entry
142
+
143
+ After the install, the app has:
144
+
145
+ ```json
146
+ {
147
+ "version": 1,
148
+ "entries": [
149
+ {
150
+ "packageId": "@jskit-ai/realtime",
151
+ "id": "realtime-socket-io",
152
+ "path": "/socket.io",
153
+ "changeOrigin": true,
154
+ "ws": true
155
+ }
156
+ ]
157
+ }
158
+ ```
159
+
160
+ That one entry is what lets the browser dev server proxy websocket traffic correctly during local development.
161
+
162
+ ### `src/placement.js` grows one new shell placement
163
+
164
+ The package appends this placement:
165
+
166
+ ```js
167
+ addPlacement({
168
+ id: "realtime.connection.indicator",
169
+ target: "shell-layout:top-right",
170
+ surfaces: ["*"],
171
+ order: 950,
172
+ componentToken: "realtime.web.connection.indicator"
173
+ });
174
+ ```
175
+
176
+ That is a good example of JSKIT's placement model working as intended.
177
+
178
+ `realtime` does not need to own your shell component. It just contributes one widget into an outlet that `shell-web` already exposed.
179
+
180
+ ### `package.json` gets the runtime dependencies
181
+
182
+ The install also adds the runtime packages needed for transport:
183
+
184
+ - `@jskit-ai/realtime`
185
+ - `socket.io`
186
+ - `socket.io-client`
187
+ - Redis adapter dependencies for scaled deployments
188
+
189
+ That is why `npm install` is still required even though this chapter only touches a small number of app-owned files.
190
+
191
+ ## Under the hood
192
+
193
+ The internal model is simple.
194
+
195
+ - the server provider mounts socket.io at `/socket.io`
196
+ - the client provider creates one shared socket client for the Vue app
197
+ - the shell status dot is registered as `realtime.web.connection.indicator`
198
+
199
+ On the server side, the package also publishes container tokens such as:
200
+
201
+ - `runtime.realtime`
202
+ - `runtime.realtime.io`
203
+
204
+ And on the client side it publishes:
205
+
206
+ - `runtime.realtime.client.socket`
207
+
208
+ If `REALTIME_REDIS_URL` is empty, the server uses a normal single-process socket.io server. If the URL is set, the package enables the Redis adapter so several Node processes can share realtime events.
209
+
210
+ That is the right level of abstraction for this package:
211
+
212
+ - generic transport in the runtime
213
+ - visible status in the shell
214
+ - actual event meaning left to the app or to later packages
215
+
216
+ ## Summary
217
+
218
+ This chapter does not make the app look radically different, but it adds an important new capability.
219
+
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
223
+ - later modules can build live behavior on top of that transport without inventing their own websocket setup