@jskit-ai/agent-docs 0.1.130 → 0.1.132
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.
- package/guide/agent/app-extras/assistant.md +29 -605
- package/guide/agent/app-extras/mobile-capacitor.md +29 -362
- package/guide/agent/app-extras/realtime.md +29 -277
- package/guide/agent/app-setup/a-more-interesting-shell.md +44 -815
- package/guide/agent/app-setup/authentication.md +43 -1073
- package/guide/agent/app-setup/console.md +26 -298
- package/guide/agent/app-setup/database-layer.md +110 -790
- package/guide/agent/app-setup/initial-scaffolding.md +50 -784
- package/guide/agent/app-setup/multi-homing.md +39 -712
- package/guide/agent/app-setup/quickstart.md +43 -179
- package/guide/agent/app-setup/users.md +34 -353
- package/guide/agent/index.md +16 -23
- package/package.json +2 -2
- package/patterns/INDEX.md +7 -7
- package/patterns/child-cruds.md +3 -3
- package/patterns/client-requests.md +6 -6
- package/patterns/crud-authoring.md +94 -0
- package/patterns/crud-links.md +1 -1
- package/patterns/feature-package/PATTERN.md +108 -0
- package/patterns/feature-package/example/booking-engine/package.json +48 -0
- package/patterns/feature-package/example/booking-engine/src/server/BookingEngineProvider.js +33 -0
- package/patterns/feature-package/example/booking-engine/src/server/actions.js +26 -0
- package/patterns/feature-package/example/booking-engine/src/server/inputSchemas.js +19 -0
- package/patterns/feature-package/example/variations/AvailabilityEngineProvider.js +31 -0
- package/patterns/feature-package/example/variations/InvoiceRollupProvider.js +36 -0
- package/patterns/feature-package/example/variations/customKnexRepository.js +34 -0
- package/patterns/feature-package/example/variations/orchestratorService.js +23 -0
- package/patterns/filters.md +8 -8
- package/patterns/live-actions.md +5 -18
- package/patterns/minimal-foundation/PATTERN.md +98 -0
- package/patterns/minimal-foundation/example/.nvmrc +1 -0
- package/patterns/minimal-foundation/example/AGENTS.md +17 -0
- package/patterns/minimal-foundation/example/Procfile +2 -0
- package/patterns/minimal-foundation/example/app.json +14 -0
- package/patterns/minimal-foundation/example/bin/develop.js +71 -0
- package/patterns/minimal-foundation/example/bin/server.js +8 -0
- package/patterns/minimal-foundation/example/config/public.js +40 -0
- package/patterns/minimal-foundation/example/config/server.js +1 -0
- package/patterns/minimal-foundation/example/config/surfaceAccessPolicies.js +3 -0
- package/patterns/minimal-foundation/example/eslint.config.mjs +19 -0
- package/patterns/minimal-foundation/example/favicon.svg +7 -0
- package/patterns/minimal-foundation/example/gitignore +9 -0
- package/patterns/minimal-foundation/example/index.html +13 -0
- package/patterns/minimal-foundation/example/jsconfig.json +8 -0
- package/patterns/minimal-foundation/example/package.json +57 -0
- package/patterns/minimal-foundation/example/packages/main/package.json +42 -0
- package/patterns/minimal-foundation/example/packages/main/src/shared/index.js +10 -0
- package/patterns/minimal-foundation/example/packages/main/src/shared/schemas/index.js +22 -0
- package/patterns/minimal-foundation/example/playwright.config.mjs +31 -0
- package/patterns/minimal-foundation/example/server/lib/runtimeEnv.js +45 -0
- package/patterns/minimal-foundation/example/server/lib/surfaceRuntime.js +10 -0
- package/patterns/minimal-foundation/example/server.js +195 -0
- package/patterns/minimal-foundation/example/src/App.vue +13 -0
- package/patterns/minimal-foundation/example/src/main.js +85 -0
- package/patterns/minimal-foundation/example/src/pages/home/index.vue +48 -0
- package/patterns/minimal-foundation/example/src/pages/home.vue +13 -0
- package/patterns/minimal-foundation/example/src/views/NotFound.vue +13 -0
- package/patterns/minimal-foundation/example/tests/client/smoke.vitest.js +7 -0
- package/patterns/minimal-foundation/example/tests/e2e/base-shell.spec.ts +23 -0
- package/patterns/minimal-foundation/example/tests/server/smoke.test.js +16 -0
- package/patterns/minimal-foundation/example/vite.config.mjs +81 -0
- package/patterns/page-scaffolding.md +20 -17
- package/patterns/placements.md +17 -15
- package/patterns/row-policies.md +4 -5
- package/patterns/server-search.md +3 -3
- package/patterns/shell-foundation/PATTERN.md +104 -0
- package/patterns/shell-foundation/example/.nvmrc +1 -0
- package/patterns/shell-foundation/example/AGENTS.md +17 -0
- package/patterns/shell-foundation/example/Procfile +2 -0
- package/patterns/shell-foundation/example/app.json +14 -0
- package/patterns/shell-foundation/example/bin/develop.js +71 -0
- package/patterns/shell-foundation/example/bin/server.js +8 -0
- package/patterns/shell-foundation/example/config/public.js +40 -0
- package/patterns/shell-foundation/example/config/server.js +1 -0
- package/patterns/shell-foundation/example/config/surfaceAccessPolicies.js +3 -0
- package/patterns/shell-foundation/example/eslint.config.mjs +19 -0
- package/patterns/shell-foundation/example/favicon.svg +7 -0
- package/patterns/shell-foundation/example/gitignore +9 -0
- package/patterns/shell-foundation/example/index.html +13 -0
- package/patterns/shell-foundation/example/jsconfig.json +8 -0
- package/patterns/shell-foundation/example/package.json +59 -0
- package/patterns/shell-foundation/example/packages/main/package.json +56 -0
- package/patterns/shell-foundation/example/packages/main/src/client/index.js +9 -0
- package/patterns/shell-foundation/example/packages/main/src/client/providers/MainClientProvider.js +18 -0
- package/patterns/shell-foundation/example/packages/main/src/shared/index.js +10 -0
- package/patterns/shell-foundation/example/packages/main/src/shared/schemas/index.js +22 -0
- package/patterns/shell-foundation/example/playwright.config.mjs +31 -0
- package/patterns/shell-foundation/example/server/lib/runtimeEnv.js +45 -0
- package/patterns/shell-foundation/example/server/lib/surfaceRuntime.js +10 -0
- package/patterns/shell-foundation/example/server.js +195 -0
- package/patterns/shell-foundation/example/src/App.vue +11 -0
- package/patterns/shell-foundation/example/src/components/ShellLayout.vue +12 -0
- package/patterns/shell-foundation/example/src/components/menus/MenuLinkItem.vue +30 -0
- package/patterns/shell-foundation/example/src/components/menus/SurfaceAwareMenuLinkItem.vue +42 -0
- package/patterns/shell-foundation/example/src/components/menus/TabLinkItem.vue +42 -0
- package/patterns/shell-foundation/example/src/error.js +19 -0
- package/patterns/shell-foundation/example/src/main.js +85 -0
- package/patterns/shell-foundation/example/src/pages/home/index.vue +116 -0
- package/patterns/shell-foundation/example/src/pages/home/settings/general/index.vue +40 -0
- package/patterns/shell-foundation/example/src/pages/home/settings/index.vue +7 -0
- package/patterns/shell-foundation/example/src/pages/home/settings.vue +109 -0
- package/patterns/shell-foundation/example/src/pages/home.vue +20 -0
- package/patterns/shell-foundation/example/src/placement.js +56 -0
- package/patterns/shell-foundation/example/src/placementTopology.js +149 -0
- package/patterns/shell-foundation/example/src/views/NotFound.vue +13 -0
- package/patterns/shell-foundation/example/tests/client/smoke.vitest.js +7 -0
- package/patterns/shell-foundation/example/tests/e2e/adaptive-shell.spec.ts +10 -0
- package/patterns/shell-foundation/example/tests/e2e/base-shell.spec.ts +23 -0
- package/patterns/shell-foundation/example/tests/server/smoke.test.js +16 -0
- package/patterns/shell-foundation/example/vite.config.mjs +81 -0
- package/patterns/ui-contract.md +56 -0
- package/patterns/ui-testing.md +10 -12
- package/reference/autogen/KERNEL_MAP.md +29 -107
- package/reference/autogen/PATTERN_INDEX.md +230 -0
- package/reference/autogen/README.md +4 -8
- package/reference/autogen/packages/agent-docs.md +259 -0
- package/reference/autogen/packages/assistant-core.md +3 -3
- package/reference/autogen/packages/assistant-runtime.md +32 -17
- package/reference/autogen/packages/auth-core.md +31 -33
- package/reference/autogen/packages/auth-provider-local-core.md +4 -12
- package/reference/autogen/packages/auth-provider-local-db-core.md +4 -4
- package/reference/autogen/packages/auth-provider-supabase-core.md +14 -18
- package/reference/autogen/packages/auth-web.md +42 -22
- package/reference/autogen/packages/console-core.md +8 -25
- package/reference/autogen/packages/console-web.md +5 -5
- package/reference/autogen/packages/crud-core.md +61 -17
- package/reference/autogen/packages/database-runtime-mysql.md +12 -2
- package/reference/autogen/packages/database-runtime-postgres.md +12 -2
- package/reference/autogen/packages/database-runtime.md +26 -25
- package/reference/autogen/packages/google-rewarded-core.md +19 -104
- package/reference/autogen/packages/http-runtime.md +4 -8
- package/reference/autogen/packages/http-web.md +32 -0
- package/reference/autogen/packages/json-rest-api-core.md +4 -6
- package/reference/autogen/packages/kernel.md +109 -390
- package/reference/autogen/packages/mobile-capacitor.md +2 -13
- package/reference/autogen/packages/realtime.md +29 -26
- package/reference/autogen/packages/resource-crud-core.md +6 -0
- package/reference/autogen/packages/shell-web.md +69 -54
- package/reference/autogen/packages/storage-runtime.md +3 -3
- package/reference/autogen/packages/uploads-image-web.md +0 -1
- package/reference/autogen/packages/uploads-runtime.md +3 -3
- package/reference/autogen/packages/users-core.md +45 -90
- package/reference/autogen/packages/users-web.md +5 -7
- package/reference/autogen/packages/workspaces-core.md +53 -74
- package/reference/autogen/packages/workspaces-web.md +15 -16
- package/reference/autogen/tooling/jskit-catalog.md +34 -0
- package/reference/autogen/tooling/testUtils.md +4 -4
- package/skills/jskit/SKILL.md +36 -28
- package/skills/jskit/agents/openai.yaml +2 -2
- package/skills/jskit/references/app-operations.md +68 -53
- package/skills/jskit/references/crud-operations.md +58 -106
- package/skills/jskit/references/material-3.md +105 -0
- package/skills/jskit/references/ui-operations.md +41 -44
- package/templates/app/AGENTS.md +7 -3
- package/guide/agent/app-setup/upgrade-beta-1-to-final.md +0 -252
- package/guide/agent/app-setup/working-with-the-jskit-cli.md +0 -325
- package/guide/agent/generators/advanced-cruds.md +0 -1935
- package/guide/agent/generators/crud-generators.md +0 -948
- package/guide/agent/generators/intro.md +0 -65
- package/guide/agent/generators/row-policies.md +0 -537
- package/guide/agent/generators/ui-generators.md +0 -690
- package/patterns/crud-scaffolding.md +0 -198
- package/patterns/generated-ui-contract-tracking.md +0 -66
- package/reference/autogen/packages/assistant.md +0 -68
- package/reference/autogen/packages/crud-server-generator.md +0 -215
- package/reference/autogen/packages/crud-ui-generator.md +0 -192
- package/reference/autogen/packages/feature-server-generator.md +0 -65
- package/reference/autogen/packages/ui-generator.md +0 -127
- package/reference/autogen/tooling/create-app.md +0 -317
- package/reference/autogen/tooling/jskit-cli.md +0 -933
- package/reference/autogen/tooling/test-support.md +0 -27
|
@@ -2,295 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
# Realtime
|
|
4
4
|
|
|
5
|
-
|
|
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:
|
|
5
|
+
Install realtime only when the product needs server-to-client events or live
|
|
6
|
+
query refresh.
|
|
14
7
|
|
|
15
8
|
```bash
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The command records the exact runtime package in the app, installs its npm graph, and updates the existing scaffold, including `socket.io`, `socket.io-client`, and the optional Redis adapter pieces.
|
|
20
|
-
|
|
21
|
-
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.
|
|
22
|
-
|
|
23
|
-
## What the package adds
|
|
24
|
-
|
|
25
|
-
Installing `realtime` adds three app capabilities.
|
|
26
|
-
|
|
27
|
-
### The app gets a realtime transport
|
|
28
|
-
|
|
29
|
-
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.
|
|
30
|
-
|
|
31
|
-
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.
|
|
32
|
-
|
|
33
|
-
### The shell gets a connection indicator
|
|
34
|
-
|
|
35
|
-
The package also uses the shell scaffolding that already exists.
|
|
36
|
-
|
|
37
|
-
`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.
|
|
38
|
-
|
|
39
|
-
That dot is:
|
|
40
|
-
|
|
41
|
-
- green when the realtime socket is connected
|
|
42
|
-
- red when the socket is disconnected or still reconnecting
|
|
43
|
-
|
|
44
|
-
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.
|
|
45
|
-
|
|
46
|
-
### Vite starts proxying websocket traffic too
|
|
47
|
-
|
|
48
|
-
The app already had a browser dev server on `5173` and a backend runtime on `3000`.
|
|
49
|
-
|
|
50
|
-
`realtime` declares a websocket proxy for `/socket.io` in its published `package.json.jskit` metadata. The JSKIT Vite plugin reads that declaration from the installed npm graph and forwards websocket traffic from the frontend dev server on `5173` to the backend runtime on `3000`.
|
|
51
|
-
|
|
52
|
-
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.
|
|
53
|
-
|
|
54
|
-
### There are no realtime pages
|
|
55
|
-
|
|
56
|
-
This is worth saying clearly because it can otherwise feel surprising.
|
|
57
|
-
|
|
58
|
-
After installing `realtime`:
|
|
59
|
-
|
|
60
|
-
- there is still no `/realtime` page
|
|
61
|
-
- there is still no new surface
|
|
62
|
-
- there is still no app-owned `src/pages/...` scaffold
|
|
63
|
-
|
|
64
|
-
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.
|
|
65
|
-
|
|
66
|
-
## What to look at in the browser
|
|
67
|
-
|
|
68
|
-
Start both processes again:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
npm run dev
|
|
72
|
-
npm run server
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Then open `http://localhost:5173/home`.
|
|
76
|
-
|
|
77
|
-
The visible check is the shell status area. You should see the realtime status dot alongside the other shell controls.
|
|
78
|
-
|
|
79
|
-
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.
|
|
80
|
-
|
|
81
|
-
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.
|
|
82
|
-
|
|
83
|
-
## Using the client runtime
|
|
84
|
-
|
|
85
|
-
The connection indicator is useful, but the real reason to install `realtime` is to let client code subscribe to live events.
|
|
86
|
-
|
|
87
|
-
The smallest client-side example looks like this:
|
|
88
|
-
|
|
89
|
-
```vue
|
|
90
|
-
<script setup>
|
|
91
|
-
import { ref } from "vue";
|
|
92
|
-
import { useRealtimeEvent } from "@jskit-ai/realtime/client/composables/useRealtimeEvent";
|
|
93
|
-
|
|
94
|
-
const lastEvent = ref("Nothing received yet.");
|
|
95
|
-
|
|
96
|
-
useRealtimeEvent({
|
|
97
|
-
event: "demo.ping",
|
|
98
|
-
onEvent({ payload }) {
|
|
99
|
-
lastEvent.value = JSON.stringify(payload);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<template>
|
|
105
|
-
<p>{{ lastEvent }}</p>
|
|
106
|
-
</template>
|
|
9
|
+
npm install @jskit-ai/realtime
|
|
107
10
|
```
|
|
108
11
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
The important pieces are:
|
|
112
|
-
|
|
113
|
-
- `event`
|
|
114
|
-
- the event name to listen for
|
|
115
|
-
- if you omit it, the composable listens to `*`
|
|
116
|
-
- `onEvent`
|
|
117
|
-
- the handler that receives `{ event, payload, socket }`
|
|
118
|
-
- `matches`
|
|
119
|
-
- an optional predicate if you want to filter events before the handler runs
|
|
120
|
-
|
|
121
|
-
So the mental model is:
|
|
122
|
-
|
|
123
|
-
- `realtime` gives the app a live transport
|
|
124
|
-
- your own app code, or later packages, decide which events should travel across it
|
|
125
|
-
|
|
126
|
-
## Publishing server events
|
|
127
|
-
|
|
128
|
-
Server code should publish realtime lifecycle events through JSKIT's entity-change helpers instead of hand-rolling `domainEvents.publish()` payloads.
|
|
129
|
-
|
|
130
|
-
Keep `operation` limited to resource invalidation semantics:
|
|
131
|
-
|
|
132
|
-
- `created`
|
|
133
|
-
- `updated`
|
|
134
|
-
- `deleted`
|
|
135
|
-
|
|
136
|
-
Use `action` for the domain lifecycle transition, and `reason` only when you need to explain why that transition happened.
|
|
137
|
-
|
|
138
|
-
For direct publishers, use `createRealtimeEntityChangePublisher()` from `@jskit-ai/kernel/server/runtime/entityChangeEvents`:
|
|
139
|
-
|
|
140
|
-
```js
|
|
141
|
-
import { createRealtimeEntityChangePublisher } from "@jskit-ai/kernel/server/runtime/entityChangeEvents";
|
|
142
|
-
|
|
143
|
-
const publishProjectRuntimeChanged = createRealtimeEntityChangePublisher({
|
|
144
|
-
domainEvents,
|
|
145
|
-
source: "vibe64",
|
|
146
|
-
entity: "project",
|
|
147
|
-
event: "vibe64.project.changed",
|
|
148
|
-
serviceToken: "vibe64.terminals.service",
|
|
149
|
-
methodName: "projectRuntime"
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
await publishProjectRuntimeChanged("updated", projectSlug, {
|
|
153
|
-
action: "runtime-closed",
|
|
154
|
-
payload: {
|
|
155
|
-
message: "Project is closed.",
|
|
156
|
-
runtime: {
|
|
157
|
-
open: false
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
The helper emits a normal `entity.changed` domain event with service metadata and `meta.realtime.event`. The realtime bridge uses that service metadata to find the registered socket dispatcher, then emits the socket event with canonical fields such as `source`, `entity`, `operation`, `entityId`, `scope`, and the lifecycle `action`.
|
|
164
|
-
|
|
165
|
-
For services registered through `app.service()`, declare the same semantics in service metadata:
|
|
166
|
-
|
|
167
|
-
```js
|
|
168
|
-
app.service(
|
|
169
|
-
"vibe64.terminals.service",
|
|
170
|
-
(scope) => createTerminalsService({
|
|
171
|
-
repository: scope.make("vibe64.repository.terminals")
|
|
172
|
-
}),
|
|
173
|
-
{
|
|
174
|
-
events: {
|
|
175
|
-
projectRuntime: [
|
|
176
|
-
{
|
|
177
|
-
type: "entity.changed",
|
|
178
|
-
source: "vibe64",
|
|
179
|
-
entity: "project",
|
|
180
|
-
operation: "updated",
|
|
181
|
-
entityId: ({ args }) => args?.[0]?.projectSlug,
|
|
182
|
-
action: "runtime-closed",
|
|
183
|
-
realtime: {
|
|
184
|
-
event: "vibe64.project.changed",
|
|
185
|
-
payload: ({ result }) => ({
|
|
186
|
-
message: result?.message || "",
|
|
187
|
-
runtime: result?.runtime || null
|
|
188
|
-
})
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
);
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
`action`, `reason`, and `realtime.payload` may be functions when the value depends on the service result or arguments. Do not encode lifecycle names by widening `operation`; keep `operation` truthful for CRUD/resource contracts and put domain-specific lifecycle meaning in metadata.
|
|
198
|
-
|
|
199
|
-
## What `realtime` adds to the app
|
|
200
|
-
|
|
201
|
-
This chapter is small enough that it is worth looking directly at the app-owned files it changes.
|
|
202
|
-
|
|
203
|
-
### `.env` gains the Redis adapter setting
|
|
204
|
-
|
|
205
|
-
The install writes:
|
|
206
|
-
|
|
207
|
-
```dotenv
|
|
208
|
-
REALTIME_REDIS_URL=
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
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.
|
|
212
|
-
|
|
213
|
-
### Package metadata declares the websocket proxy
|
|
214
|
-
|
|
215
|
-
The installed `@jskit-ai/realtime` package declares:
|
|
216
|
-
|
|
217
|
-
```json
|
|
218
|
-
{
|
|
219
|
-
"jskit": {
|
|
220
|
-
"vite": {
|
|
221
|
-
"proxy": {
|
|
222
|
-
"/socket.io": {
|
|
223
|
-
"changeOrigin": true,
|
|
224
|
-
"ws": true
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
`createJskitClientBootstrapPlugin({ proxyTarget })` reads that metadata directly. The application owns only its normal Vite config and proxy target; installing or removing the npm package changes the active proxy on the next Vite start without generated project state.
|
|
233
|
-
|
|
234
|
-
### `src/placement.js` includes the shell status placement
|
|
235
|
-
|
|
236
|
-
The package appends this placement:
|
|
237
|
-
|
|
238
|
-
```js
|
|
239
|
-
addPlacement({
|
|
240
|
-
id: "realtime.connection.indicator",
|
|
241
|
-
target: "shell.status",
|
|
242
|
-
kind: "component",
|
|
243
|
-
surfaces: ["*"],
|
|
244
|
-
order: 950,
|
|
245
|
-
componentToken: "realtime.web.connection.indicator"
|
|
246
|
-
});
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
That is a good example of JSKIT's placement model working as intended.
|
|
250
|
-
|
|
251
|
-
`realtime` does not need to own your shell component. It just contributes one widget into an outlet that `shell-web` already exposed.
|
|
252
|
-
|
|
253
|
-
### `package.json` gets the runtime dependencies
|
|
254
|
-
|
|
255
|
-
The install also adds the runtime packages needed for transport:
|
|
256
|
-
|
|
257
|
-
- `@jskit-ai/realtime`
|
|
258
|
-
- `socket.io`
|
|
259
|
-
- `socket.io-client`
|
|
260
|
-
- Redis adapter dependencies for scaled deployments
|
|
261
|
-
|
|
262
|
-
That is why `npm install` is still required even though this chapter only touches a small number of app-owned files.
|
|
263
|
-
|
|
264
|
-
## Under the hood
|
|
265
|
-
|
|
266
|
-
The internal model is simple.
|
|
12
|
+
The package provides the server delivery capability and client listener
|
|
13
|
+
runtime. It adds no schema and needs no migration.
|
|
267
14
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
15
|
+
Use the `realtime/realtime-application` pattern for event delivery, optional
|
|
16
|
+
Redis configuration, client invalidation, and an explicit shell status
|
|
17
|
+
placement.
|
|
271
18
|
|
|
272
|
-
|
|
19
|
+
## Event contract
|
|
273
20
|
|
|
274
|
-
|
|
275
|
-
|
|
21
|
+
Successful actions may declare domain events. Realtime delivery occurs only
|
|
22
|
+
when an event has an explicit realtime name and audience. The event name,
|
|
23
|
+
scope, payload, and reconnect behavior are public product contracts—not a
|
|
24
|
+
generic “something changed” escape hatch.
|
|
276
25
|
|
|
277
|
-
|
|
26
|
+
Client features register listeners through `@jskit-ai/realtime`. Keep query
|
|
27
|
+
invalidation close to the resource that owns the query keys.
|
|
278
28
|
|
|
279
|
-
|
|
29
|
+
## Single process and Redis
|
|
280
30
|
|
|
281
|
-
|
|
31
|
+
The in-process adapter is correct for one server process. Set
|
|
32
|
+
`REALTIME_REDIS_URL` only when multiple processes need a shared backplane.
|
|
33
|
+
Credentials stay outside Git and never enter public client config.
|
|
282
34
|
|
|
283
|
-
|
|
35
|
+
## Visible connection state
|
|
284
36
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
37
|
+
A status indicator is optional product UI. When wanted, register it through the
|
|
38
|
+
normal component and placement APIs. Installing realtime does not append it to
|
|
39
|
+
the shell.
|
|
288
40
|
|
|
289
|
-
##
|
|
41
|
+
## Verification
|
|
290
42
|
|
|
291
|
-
|
|
43
|
+
Test in-process delivery, audience isolation, disconnect/reconnect recovery,
|
|
44
|
+
duplicate listener cleanup, and live query refresh. When Redis is selected,
|
|
45
|
+
exercise delivery between two server processes.
|
|
292
46
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
- the shell exposes a live connection indicator
|
|
296
|
-
- later modules can build live behavior on top of that transport without inventing their own websocket setup
|
|
47
|
+
Do not add realtime before event ownership is clear, invent undocumented
|
|
48
|
+
payloads, mutate placement source, or retain delivery receipts.
|