@bluelibs/runner-dev 5.1.0 → 5.3.0
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/AI.md +58 -6
- package/README.md +65 -6
- package/dist/generated/resolvers-types.d.ts +201 -0
- package/dist/index.d.ts +4 -0
- package/dist/resources/docs.generator.resource.d.ts +1 -0
- package/dist/resources/graphql-accumulator.resource.js +1 -0
- package/dist/resources/graphql-accumulator.resource.js.map +1 -1
- package/dist/resources/graphql.query.task.d.ts +2 -0
- package/dist/resources/introspector.cli.resource.js +27 -1
- package/dist/resources/introspector.cli.resource.js.map +1 -1
- package/dist/resources/introspector.resource.d.ts +1 -0
- package/dist/resources/introspector.resource.js +3 -2
- package/dist/resources/introspector.resource.js.map +1 -1
- package/dist/resources/live.resource.d.ts +3 -0
- package/dist/resources/live.resource.js +26 -0
- package/dist/resources/live.resource.js.map +1 -1
- package/dist/resources/models/Introspector.d.ts +33 -3
- package/dist/resources/models/Introspector.js +159 -2
- package/dist/resources/models/Introspector.js.map +1 -1
- package/dist/resources/models/durable.runtime.d.ts +1 -1
- package/dist/resources/models/durable.runtime.js +27 -2
- package/dist/resources/models/durable.runtime.js.map +1 -1
- package/dist/resources/models/initializeFromStore.js +75 -1
- package/dist/resources/models/initializeFromStore.js.map +1 -1
- package/dist/resources/models/initializeFromStore.utils.d.ts +5 -1
- package/dist/resources/models/initializeFromStore.utils.js +20 -1
- package/dist/resources/models/initializeFromStore.utils.js.map +1 -1
- package/dist/resources/routeHandlers/createLiveStreamHandler.d.ts +16 -0
- package/dist/resources/routeHandlers/createLiveStreamHandler.js +127 -0
- package/dist/resources/routeHandlers/createLiveStreamHandler.js.map +1 -0
- package/dist/resources/routeHandlers/registerHttpRoutes.hook.d.ts +2 -0
- package/dist/resources/routeHandlers/requestCorrelation.d.ts +11 -0
- package/dist/resources/routeHandlers/requestCorrelation.js +29 -0
- package/dist/resources/routeHandlers/requestCorrelation.js.map +1 -0
- package/dist/resources/server.resource.d.ts +2 -0
- package/dist/resources/server.resource.js +13 -1
- package/dist/resources/server.resource.js.map +1 -1
- package/dist/resources/swap.resource.d.ts +1 -0
- package/dist/schema/index.js +4 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/model.d.ts +23 -0
- package/dist/schema/model.js.map +1 -1
- package/dist/schema/query.js +23 -0
- package/dist/schema/query.js.map +1 -1
- package/dist/schema/types/AllType.js +8 -0
- package/dist/schema/types/AllType.js.map +1 -1
- package/dist/schema/types/BaseElementCommon.js +10 -0
- package/dist/schema/types/BaseElementCommon.js.map +1 -1
- package/dist/schema/types/InterceptorOwnersType.d.ts +2 -0
- package/dist/schema/types/InterceptorOwnersType.js +63 -0
- package/dist/schema/types/InterceptorOwnersType.js.map +1 -0
- package/dist/schema/types/LiveType.js +14 -76
- package/dist/schema/types/LiveType.js.map +1 -1
- package/dist/schema/types/ResourceType.js +5 -0
- package/dist/schema/types/ResourceType.js.map +1 -1
- package/dist/schema/types/RunOptionsType.d.ts +2 -0
- package/dist/schema/types/RunOptionsType.js +71 -0
- package/dist/schema/types/RunOptionsType.js.map +1 -0
- package/dist/schema/types/TaskType.js +15 -0
- package/dist/schema/types/TaskType.js.map +1 -1
- package/dist/schema/types/index.d.ts +2 -0
- package/dist/schema/types/index.js +5 -1
- package/dist/schema/types/index.js.map +1 -1
- package/dist/ui/.vite/manifest.json +2 -2
- package/dist/ui/assets/docs-BhRuaJ5l.css +1 -0
- package/dist/ui/assets/docs-H4oDZj7p.js +302 -0
- package/dist/ui/assets/docs-H4oDZj7p.js.map +1 -0
- package/dist/utils/healthCollectors.d.ts +37 -0
- package/dist/utils/healthCollectors.js +147 -0
- package/dist/utils/healthCollectors.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -4
- package/dist/ui/assets/docs-B_-zFz4-.css +0 -1
- package/dist/ui/assets/docs-Be-GHfZi.js +0 -353
- package/dist/ui/assets/docs-Be-GHfZi.js.map +0 -1
package/AI.md
CHANGED
|
@@ -13,6 +13,8 @@ Runner-Dev is a powerful development toolkit for applications built with the **@
|
|
|
13
13
|
- **MCP Integration**: AI-native development environment
|
|
14
14
|
- **Tags (first-class)**: Discover Tag objects and reverse usage via GraphQL (`tags`, `tag(id)`).
|
|
15
15
|
- **Documentation UI Overviews**: Sortable and searchable overview tables with a `Used By` counter column for faster cross-element inspection.
|
|
16
|
+
- **Visibility Awareness**: Every element exposes `isPrivate` (based on Runner `exports()` boundaries), and resources expose `exports`.
|
|
17
|
+
- **Task Interceptor Introspection**: Tasks expose `interceptorCount` and `hasInterceptors` for runtime `task.intercept(...)` registrations.
|
|
16
18
|
|
|
17
19
|
## Available GraphQL Queries
|
|
18
20
|
|
|
@@ -23,18 +25,39 @@ Runner-Dev is a powerful development toolkit for applications built with the **@
|
|
|
23
25
|
query SystemOverview {
|
|
24
26
|
all {
|
|
25
27
|
id
|
|
28
|
+
isPrivate
|
|
26
29
|
meta {
|
|
27
30
|
title
|
|
28
31
|
description
|
|
29
32
|
}
|
|
30
33
|
filePath
|
|
31
34
|
}
|
|
35
|
+
runOptions {
|
|
36
|
+
mode
|
|
37
|
+
debug
|
|
38
|
+
debugMode
|
|
39
|
+
logsEnabled
|
|
40
|
+
logsPrintThreshold
|
|
41
|
+
logsPrintStrategy
|
|
42
|
+
logsBuffer
|
|
43
|
+
errorBoundary
|
|
44
|
+
shutdownHooks
|
|
45
|
+
dryRun
|
|
46
|
+
lazy
|
|
47
|
+
initMode
|
|
48
|
+
runtimeEventCycleDetection
|
|
49
|
+
hasOnUnhandledError
|
|
50
|
+
rootId
|
|
51
|
+
}
|
|
32
52
|
}
|
|
33
53
|
|
|
34
54
|
# Get specific element types
|
|
35
55
|
query Architecture {
|
|
36
56
|
tasks {
|
|
37
57
|
id
|
|
58
|
+
isPrivate
|
|
59
|
+
interceptorCount
|
|
60
|
+
hasInterceptors
|
|
38
61
|
meta {
|
|
39
62
|
title
|
|
40
63
|
description
|
|
@@ -47,6 +70,8 @@ query Architecture {
|
|
|
47
70
|
}
|
|
48
71
|
resources {
|
|
49
72
|
id
|
|
73
|
+
isPrivate
|
|
74
|
+
exports
|
|
50
75
|
meta {
|
|
51
76
|
title
|
|
52
77
|
description
|
|
@@ -146,6 +171,28 @@ query LiveTelemetry {
|
|
|
146
171
|
}
|
|
147
172
|
```
|
|
148
173
|
|
|
174
|
+
### SSE Live Streaming
|
|
175
|
+
|
|
176
|
+
Server-Sent Events endpoint at `GET /live/stream` for near-instant push instead of polling:
|
|
177
|
+
|
|
178
|
+
- **`telemetry`** event: `{ logs, emissions, errors, runs }` pushed ~100ms after each record (debounced)
|
|
179
|
+
- **`health`** event: `{ memory, cpu, eventLoop, gc }` every 2s
|
|
180
|
+
- Heartbeat comment every 15s to keep proxies alive
|
|
181
|
+
- `Live.onRecord(callback)` fires synchronously on each `record*` call; returns an unsubscribe function
|
|
182
|
+
- The built-in Live Panel auto-uses SSE and falls back to configurable-interval polling (500ms–10s)
|
|
183
|
+
|
|
184
|
+
### Correlation ID Trace View
|
|
185
|
+
|
|
186
|
+
The Live Panel includes a built-in **Trace View** — a unified timeline showing every log, event emission, error, and task run sharing a single `correlationId`, ordered chronologically. Click any correlationId badge (shown on logs, events, errors, and runs) to open the trace modal. This provides an in-process "distributed tracing" experience (like Jaeger).
|
|
187
|
+
|
|
188
|
+
### Unified Modal System
|
|
189
|
+
|
|
190
|
+
All UI modals (CodeModal, ExecuteModal, TraceView, RecentLogs, OverviewStatsPanel) are built on a shared `BaseModal` primitive (`src/ui/src/components/Documentation/components/modals/`). It provides:
|
|
191
|
+
|
|
192
|
+
- **Stacking**: A `ModalStackContext` tracks open modals and assigns ascending z-indexes (base 10 000 + 10 per layer). Global Escape closes the topmost modal first.
|
|
193
|
+
- **Consistent UX**: Portal to `document.body`, backdrop blur, scroll lock, focus trap, slide-up animation, ARIA `role="dialog"`.
|
|
194
|
+
- **Sizes**: `sm | md | lg | xl | fullscreen` with responsive fallback to fullscreen on small viewports.
|
|
195
|
+
|
|
149
196
|
### Diagnostics & Health
|
|
150
197
|
|
|
151
198
|
```graphql
|
|
@@ -262,9 +309,11 @@ npx @bluelibs/runner-dev new <project-name>
|
|
|
262
309
|
# Example
|
|
263
310
|
npx @bluelibs/runner-dev new my-awesome-app
|
|
264
311
|
```
|
|
312
|
+
|
|
265
313
|
This command creates a new Runner project with a complete TypeScript setup, Jest for testing, and all necessary dependencies.
|
|
266
314
|
|
|
267
315
|
Key flags for `new`:
|
|
316
|
+
|
|
268
317
|
- `--install`: Install dependencies after scaffolding.
|
|
269
318
|
- `--run-tests`: Run the generated test suite after installation.
|
|
270
319
|
- `--run`: Start the dev server after installation.
|
|
@@ -274,11 +323,13 @@ Key flags for `new`:
|
|
|
274
323
|
All commands can be prefixed with environment variables like `ENDPOINT` and `HEADERS`.
|
|
275
324
|
|
|
276
325
|
**Ping the server:**
|
|
326
|
+
|
|
277
327
|
```bash
|
|
278
328
|
ENDPOINT=http://localhost:1337/graphql npx @bluelibs/runner-dev ping
|
|
279
329
|
```
|
|
280
330
|
|
|
281
331
|
**Execute a GraphQL query (Remote Mode):**
|
|
332
|
+
|
|
282
333
|
```bash
|
|
283
334
|
# Simple query
|
|
284
335
|
ENDPOINT=http://localhost:1337/graphql npx @bluelibs/runner-dev query 'query { tasks { id } }'
|
|
@@ -306,11 +357,13 @@ npx @bluelibs/runner-dev query 'query { tasks { id } }' \
|
|
|
306
357
|
```
|
|
307
358
|
|
|
308
359
|
Selection logic:
|
|
360
|
+
|
|
309
361
|
- If `--entry-file` is provided, dry-run mode is used (no server; requires ts-node).
|
|
310
362
|
- Otherwise, the CLI uses a remote endpoint via `--endpoint` or `ENDPOINT/GRAPHQL_ENDPOINT`.
|
|
311
363
|
- If neither is provided, the command errors.
|
|
312
364
|
|
|
313
365
|
**Generate a project overview:**
|
|
366
|
+
|
|
314
367
|
```bash
|
|
315
368
|
ENDPOINT=http://localhost:1337/graphql npx @bluelibs/runner-dev overview --details 10
|
|
316
369
|
```
|
|
@@ -339,7 +392,6 @@ ENDPOINT=http://localhost:1337/graphql npx @bluelibs/runner-dev schema json
|
|
|
339
392
|
|
|
340
393
|
This direct CLI access provides a powerful way for AI assistants with shell access to script complex interactions, perform detailed introspection, and validate application state without relying on MCP tools.
|
|
341
394
|
|
|
342
|
-
|
|
343
395
|
## Common Use Cases
|
|
344
396
|
|
|
345
397
|
### 1. Understanding System Architecture
|
|
@@ -479,7 +531,10 @@ Minimal workflow setup pattern:
|
|
|
479
531
|
|
|
480
532
|
```ts
|
|
481
533
|
import { r } from "@bluelibs/runner";
|
|
482
|
-
import {
|
|
534
|
+
import {
|
|
535
|
+
durableWorkflowTag,
|
|
536
|
+
memoryDurableResource,
|
|
537
|
+
} from "@bluelibs/runner/node";
|
|
483
538
|
|
|
484
539
|
const durable = memoryDurableResource.fork("app.durable");
|
|
485
540
|
const durableRegistration = durable.with({});
|
|
@@ -496,10 +551,7 @@ const workflow = r
|
|
|
496
551
|
})
|
|
497
552
|
.build();
|
|
498
553
|
|
|
499
|
-
const app = r
|
|
500
|
-
.resource("app")
|
|
501
|
-
.register([durableRegistration, workflow])
|
|
502
|
-
.build();
|
|
554
|
+
const app = r.resource("app").register([durableRegistration, workflow]).build();
|
|
503
555
|
```
|
|
504
556
|
|
|
505
557
|
## Best Practices for AI Assistants
|
package/README.md
CHANGED
|
@@ -40,7 +40,10 @@ const app = resource({
|
|
|
40
40
|
|
|
41
41
|
- Fully-featured UI with AI assistance to explore your app, call tasks, emit events, diagnostics, logs and more.
|
|
42
42
|
- Overview tables across UI sections now include sortable and searchable columns (`ID`, `Title`, `Description`, `Used By`) with per-element usage counters.
|
|
43
|
+
- Overview tables now include `Visibility` (`Public`/`Private`) derived from Runner resource `exports()` boundaries.
|
|
43
44
|
- Introspector: programmatic API to inspect tasks, hooks, resources, events, middleware, and diagnostics (including file paths, contents)
|
|
45
|
+
- Task introspection includes runtime `interceptorCount` / `hasInterceptors` (registered via `taskDependency.intercept(...)` in resource init).
|
|
46
|
+
- Resource introspection includes `exports` (resolved list of ids exposed by `.exports([...])`).
|
|
44
47
|
- Live: in-memory logs and event emissions
|
|
45
48
|
- Live File Previews and Saving.
|
|
46
49
|
- GraphQL server: deep graph navigation over your app’s topology and live data
|
|
@@ -86,6 +89,7 @@ Once your application is running with the `dev` resource, you can access the vis
|
|
|
86
89
|
🚀 **Open [http://localhost:1337](http://localhost:1337) in your browser.**
|
|
87
90
|
|
|
88
91
|
Inside the UI, you can:
|
|
92
|
+
|
|
89
93
|
- Explore the resource graph.
|
|
90
94
|
- Manually invoke tasks with custom inputs.
|
|
91
95
|
- Inspect live logs and event emissions in real-time.
|
|
@@ -318,13 +322,13 @@ Precedence:
|
|
|
318
322
|
|
|
319
323
|
### CLI Summary
|
|
320
324
|
|
|
321
|
-
| Category
|
|
322
|
-
|
|
|
323
|
-
| **New Project** | `runner-dev new <project-name>`
|
|
325
|
+
| Category | Description |
|
|
326
|
+
| --------------- | --------------------------------------------------------- |
|
|
327
|
+
| **New Project** | `runner-dev new <project-name>` |
|
|
324
328
|
| **Scaffolding** | `runner-dev new <resource\|task\|event\|tag\|middleware>` |
|
|
325
|
-
| **Queries**
|
|
326
|
-
| **Overview**
|
|
327
|
-
| **Schema**
|
|
329
|
+
| **Queries** | `runner-dev query 'query { ... }'` |
|
|
330
|
+
| **Overview** | `runner-dev overview --details 10` |
|
|
331
|
+
| **Schema** | `runner-dev schema sdl` |
|
|
328
332
|
|
|
329
333
|
---
|
|
330
334
|
|
|
@@ -547,6 +551,41 @@ Notes:
|
|
|
547
551
|
- `cpu.usage` is a ratio; `loadAverage` is 1‑minute OS load.
|
|
548
552
|
- `eventLoop.lag` may be 0 if `monitorEventLoopDelay` is unavailable.
|
|
549
553
|
|
|
554
|
+
### SSE Live Streaming
|
|
555
|
+
|
|
556
|
+
In addition to GraphQL polling, the server exposes a **Server-Sent Events** endpoint at `GET /live/stream` for near-instant telemetry delivery:
|
|
557
|
+
|
|
558
|
+
```http
|
|
559
|
+
GET /live/stream
|
|
560
|
+
Accept: text/event-stream
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
The endpoint pushes two event types:
|
|
564
|
+
|
|
565
|
+
| Event | Cadence | Payload |
|
|
566
|
+
| ----------- | -------------------------------------------- | ----------------------------------------------------------- |
|
|
567
|
+
| `telemetry` | ~100ms after each `record*` call (debounced) | `{ logs, emissions, errors, runs }` (delta since last push) |
|
|
568
|
+
| `health` | Every 2s | `{ memory, cpu, eventLoop, gc }` |
|
|
569
|
+
|
|
570
|
+
A heartbeat comment (`: heartbeat`) is sent every 15s to keep the connection alive through proxies.
|
|
571
|
+
|
|
572
|
+
**JavaScript client example:**
|
|
573
|
+
|
|
574
|
+
```js
|
|
575
|
+
const es = new EventSource("http://localhost:1337/live/stream");
|
|
576
|
+
es.addEventListener("telemetry", (e) => {
|
|
577
|
+
const { logs, emissions, errors, runs } = JSON.parse(e.data);
|
|
578
|
+
// merge into your state
|
|
579
|
+
});
|
|
580
|
+
es.addEventListener("health", (e) => {
|
|
581
|
+
const { memory, cpu, eventLoop, gc } = JSON.parse(e.data);
|
|
582
|
+
});
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
The built-in Live Panel UI automatically uses SSE when available and falls back to configurable-interval polling (500ms–10s slider) when SSE is not supported.
|
|
586
|
+
|
|
587
|
+
**Programmatic notification hook:** The `Live` interface exposes `onRecord(callback)` which fires synchronously whenever a `record*` method is called, returning an unsubscribe function. This is the mechanism the SSE endpoint uses internally.
|
|
588
|
+
|
|
550
589
|
### Correlation and call chains
|
|
551
590
|
|
|
552
591
|
- What is correlationId? An opaque UUID (via `crypto.randomUUID()`) created for the first task in a run chain.
|
|
@@ -583,6 +622,14 @@ query TraceByCorrelation($ts: Float, $cid: String!) {
|
|
|
583
622
|
}
|
|
584
623
|
```
|
|
585
624
|
|
|
625
|
+
#### Trace View (UI)
|
|
626
|
+
|
|
627
|
+
The Live Panel includes a built-in **Trace View** — click any `correlationId` badge in the Logs, Events, Errors, or Runs sub-tabs to open a unified timeline modal showing every entry that shares that ID, ordered chronologically. Each entry is color-coded by kind (log, event, error, run) with a vertical timeline gutter, relative offset labels, and expandable details. This provides an in-process "distributed tracing" experience similar to Jaeger or Zipkin, but entirely within the Dev UI.
|
|
628
|
+
|
|
629
|
+
#### Unified Modal System
|
|
630
|
+
|
|
631
|
+
All Dev UI modals (code viewer, execute, trace view, log details, stats overlay) share a common `BaseModal` primitive that provides portal rendering, backdrop blur, focus trap, scroll lock, slide-up animation, and ARIA dialog semantics. A `ModalStackContext` manages stacking so modals can open on top of other modals — each layer gets a higher z-index and the global <kbd>Esc</kbd> key always closes the topmost one first.
|
|
632
|
+
|
|
586
633
|
## Emitting Events (Runner-native)
|
|
587
634
|
|
|
588
635
|
- Define an event:
|
|
@@ -683,6 +730,18 @@ export const app = resource({
|
|
|
683
730
|
|
|
684
731
|
#### Queries
|
|
685
732
|
|
|
733
|
+
**Get the effective run options (how the app was started):**
|
|
734
|
+
|
|
735
|
+
```graphql
|
|
736
|
+
query {
|
|
737
|
+
runOptions {
|
|
738
|
+
mode
|
|
739
|
+
debug
|
|
740
|
+
rootId
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
```
|
|
744
|
+
|
|
686
745
|
**Get currently swapped tasks:**
|
|
687
746
|
|
|
688
747
|
```graphql
|