@bluelibs/runner-dev 5.3.0 → 6.0.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 +25 -3
- package/README.md +153 -18
- package/dist/cli/generators/scaffold/templates/package.json.d.ts +2 -2
- package/dist/cli/generators/scaffold/templates/package.json.js +2 -2
- package/dist/cli/generators/scaffold.js +1 -135
- package/dist/cli/generators/scaffold.js.map +1 -1
- package/dist/cli/generators/templates.js +2 -1
- package/dist/cli/generators/templates.js.map +1 -1
- package/dist/generated/resolvers-types.d.ts +376 -144
- package/dist/index.d.ts +39 -43
- package/dist/resources/cli.config.resource.d.ts +1 -1
- package/dist/resources/cli.config.resource.js +2 -2
- package/dist/resources/cli.config.resource.js.map +1 -1
- package/dist/resources/coverage.resource.d.ts +2 -2
- package/dist/resources/coverage.resource.js +3 -3
- package/dist/resources/coverage.resource.js.map +1 -1
- package/dist/resources/dev.resource.d.ts +1 -1
- package/dist/resources/dev.resource.js +2 -2
- package/dist/resources/dev.resource.js.map +1 -1
- package/dist/resources/docs.generator.resource.d.ts +4 -4
- package/dist/resources/docs.generator.resource.js +2 -2
- package/dist/resources/docs.generator.resource.js.map +1 -1
- package/dist/resources/graphql-accumulator.resource.d.ts +2 -2
- package/dist/resources/graphql-accumulator.resource.js +6 -3
- package/dist/resources/graphql-accumulator.resource.js.map +1 -1
- package/dist/resources/graphql.cli.resource.d.ts +1 -1
- package/dist/resources/graphql.cli.resource.js +2 -2
- package/dist/resources/graphql.cli.resource.js.map +1 -1
- package/dist/resources/graphql.query.cli.task.d.ts +14 -16
- package/dist/resources/graphql.query.cli.task.js +3 -3
- package/dist/resources/graphql.query.cli.task.js.map +1 -1
- package/dist/resources/graphql.query.task.d.ts +18 -20
- package/dist/resources/graphql.query.task.js +4 -4
- package/dist/resources/graphql.query.task.js.map +1 -1
- package/dist/resources/http.tag.d.ts +1 -1
- package/dist/resources/http.tag.js +2 -2
- package/dist/resources/http.tag.js.map +1 -1
- package/dist/resources/introspector.cli.resource.d.ts +2 -2
- package/dist/resources/introspector.cli.resource.js +14 -6
- package/dist/resources/introspector.cli.resource.js.map +1 -1
- package/dist/resources/introspector.resource.d.ts +3 -3
- package/dist/resources/introspector.resource.js +4 -5
- package/dist/resources/introspector.resource.js.map +1 -1
- package/dist/resources/live.resource.d.ts +4 -6
- package/dist/resources/live.resource.js +38 -25
- package/dist/resources/live.resource.js.map +1 -1
- package/dist/resources/models/Introspector.d.ts +28 -14
- package/dist/resources/models/Introspector.js +334 -161
- package/dist/resources/models/Introspector.js.map +1 -1
- package/dist/resources/models/durable.runtime.js +36 -10
- package/dist/resources/models/durable.runtime.js.map +1 -1
- package/dist/resources/models/durable.tools.d.ts +1 -1
- package/dist/resources/models/durable.tools.js +6 -3
- package/dist/resources/models/durable.tools.js.map +1 -1
- package/dist/resources/models/initializeFromStore.js +54 -21
- package/dist/resources/models/initializeFromStore.js.map +1 -1
- package/dist/resources/models/initializeFromStore.utils.d.ts +7 -6
- package/dist/resources/models/initializeFromStore.utils.js +302 -25
- package/dist/resources/models/initializeFromStore.utils.js.map +1 -1
- package/dist/resources/models/introspector.tools.js +18 -6
- package/dist/resources/models/introspector.tools.js.map +1 -1
- package/dist/resources/routeHandlers/getDocsData.d.ts +4 -0
- package/dist/resources/routeHandlers/getDocsData.js +28 -0
- package/dist/resources/routeHandlers/getDocsData.js.map +1 -1
- package/dist/resources/routeHandlers/registerHttpRoutes.hook.d.ts +26 -25
- package/dist/resources/routeHandlers/registerHttpRoutes.hook.js +10 -9
- package/dist/resources/routeHandlers/registerHttpRoutes.hook.js.map +1 -1
- package/dist/resources/server.resource.d.ts +20 -22
- package/dist/resources/server.resource.js +6 -6
- package/dist/resources/server.resource.js.map +1 -1
- package/dist/resources/swap.cli.resource.d.ts +4 -4
- package/dist/resources/swap.cli.resource.js +2 -2
- package/dist/resources/swap.cli.resource.js.map +1 -1
- package/dist/resources/swap.resource.d.ts +7 -7
- package/dist/resources/swap.resource.js +188 -38
- package/dist/resources/swap.resource.js.map +1 -1
- package/dist/resources/swap.tools.d.ts +3 -2
- package/dist/resources/swap.tools.js +27 -27
- package/dist/resources/swap.tools.js.map +1 -1
- package/dist/resources/telemetry.resource.d.ts +1 -1
- package/dist/resources/telemetry.resource.js +46 -43
- package/dist/resources/telemetry.resource.js.map +1 -1
- package/dist/runner-compat.d.ts +85 -0
- package/dist/runner-compat.js +178 -0
- package/dist/runner-compat.js.map +1 -0
- package/dist/runner-node-compat.d.ts +2 -0
- package/dist/runner-node-compat.js +28 -0
- package/dist/runner-node-compat.js.map +1 -0
- package/dist/schema/index.js +4 -8
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/model.d.ts +80 -23
- package/dist/schema/model.js.map +1 -1
- package/dist/schema/query.js +2 -1
- package/dist/schema/query.js.map +1 -1
- package/dist/schema/types/AllType.js +6 -3
- package/dist/schema/types/AllType.js.map +1 -1
- package/dist/schema/types/BaseElementCommon.js +2 -2
- package/dist/schema/types/ErrorType.js +1 -1
- package/dist/schema/types/ErrorType.js.map +1 -1
- package/dist/schema/types/EventType.js +19 -2
- package/dist/schema/types/EventType.js.map +1 -1
- package/dist/schema/types/LaneSummaryTypes.d.ts +3 -0
- package/dist/schema/types/LaneSummaryTypes.js +19 -0
- package/dist/schema/types/LaneSummaryTypes.js.map +1 -0
- package/dist/schema/types/LiveType.js +67 -0
- package/dist/schema/types/LiveType.js.map +1 -1
- package/dist/schema/types/ResourceType.js +100 -19
- package/dist/schema/types/ResourceType.js.map +1 -1
- package/dist/schema/types/RunOptionsType.js +41 -5
- package/dist/schema/types/RunOptionsType.js.map +1 -1
- package/dist/schema/types/TagType.js +35 -4
- package/dist/schema/types/TagType.js.map +1 -1
- package/dist/schema/types/TaskType.js +5 -0
- package/dist/schema/types/TaskType.js.map +1 -1
- package/dist/schema/types/index.d.ts +2 -2
- package/dist/schema/types/index.js +6 -7
- package/dist/schema/types/index.js.map +1 -1
- package/dist/schema/types/middleware/common.d.ts +3 -2
- package/dist/schema/types/middleware/common.js +19 -13
- package/dist/schema/types/middleware/common.js.map +1 -1
- package/dist/ui/.vite/manifest.json +2 -2
- package/dist/ui/assets/docs-Btkv97Ls.js +302 -0
- package/dist/ui/assets/docs-Btkv97Ls.js.map +1 -0
- package/dist/ui/assets/docs-CipvKUxZ.css +1 -0
- package/dist/utils/lane-resources.d.ts +55 -0
- package/dist/utils/lane-resources.js +143 -0
- package/dist/utils/lane-resources.js.map +1 -0
- package/dist/utils/zod.js +36 -3
- package/dist/utils/zod.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/readmes/runner-AI.md +740 -0
- package/readmes/runner-durable-workflows.md +2247 -0
- package/readmes/runner-full-guide.md +5869 -0
- package/readmes/runner-remote-lanes.md +909 -0
- package/dist/ui/assets/docs-BhRuaJ5l.css +0 -1
- package/dist/ui/assets/docs-H4oDZj7p.js +0 -302
- package/dist/ui/assets/docs-H4oDZj7p.js.map +0 -1
package/AI.md
CHANGED
|
@@ -13,8 +13,25 @@ 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 `
|
|
16
|
+
- **Visibility Awareness**: Every element exposes `isPrivate` (based on Runner `isolate()` boundaries), and resources expose `isolation`.
|
|
17
|
+
- **Subtree Governance Awareness**: Resources expose normalized `subtree` policy summaries (middleware and validator counts per branch).
|
|
18
|
+
- **Lifecycle Awareness**: Resources expose `cooldown` support and run options expose `lifecycleMode`, `disposeBudgetMs`, `disposeDrainBudgetMs`.
|
|
19
|
+
- **Lane Awareness**: Events expose optional `eventLane` summaries (`globals.tags.eventLane`) and both tasks and events expose optional `rpcLane` summaries (`globals.tags.rpcLane`).
|
|
20
|
+
- **Isolation Wildcard Explorer**: Wildcard isolation rules can be clicked to inspect all matching resources in a searchable modal list.
|
|
21
|
+
- **Tag Handlers**: Tag views separate direct tag usages from handler elements that depend on the tag id.
|
|
17
22
|
- **Task Interceptor Introspection**: Tasks expose `interceptorCount` and `hasInterceptors` for runtime `task.intercept(...)` registrations.
|
|
23
|
+
- **Schema Export Compatibility**: Schema fields prefer `toJSONSchema()` exporters (including matcher-normalized schemas), with `zod` conversion as compatibility fallback.
|
|
24
|
+
|
|
25
|
+
## Runner 6.0 Migration Notes
|
|
26
|
+
|
|
27
|
+
| Before | After (hard switch) |
|
|
28
|
+
| --------------------- | --------------------------------------------------------- |
|
|
29
|
+
| `Resource.exports` | `Resource.isolation { deny, only, exports, exportsMode }` |
|
|
30
|
+
| `Middleware.global` | `Middleware.autoApply { enabled, scope, hasPredicate }` |
|
|
31
|
+
| `Tag.middlewares` | `Tag.taskMiddlewares` + `Tag.resourceMiddlewares` |
|
|
32
|
+
| N/A | `Tag.errors`, `Tag.targets` |
|
|
33
|
+
| `RunOptions.initMode` | `RunOptions.lifecycleMode` (+ disposal budgets) |
|
|
34
|
+
| `Resource.tunnelInfo` | Removed (hard switch to Event Lane + RPC Lane surfaces) |
|
|
18
35
|
|
|
19
36
|
## Available GraphQL Queries
|
|
20
37
|
|
|
@@ -44,7 +61,7 @@ query SystemOverview {
|
|
|
44
61
|
shutdownHooks
|
|
45
62
|
dryRun
|
|
46
63
|
lazy
|
|
47
|
-
|
|
64
|
+
lifecycleMode
|
|
48
65
|
runtimeEventCycleDetection
|
|
49
66
|
hasOnUnhandledError
|
|
50
67
|
rootId
|
|
@@ -71,7 +88,12 @@ query Architecture {
|
|
|
71
88
|
resources {
|
|
72
89
|
id
|
|
73
90
|
isPrivate
|
|
74
|
-
|
|
91
|
+
isolation {
|
|
92
|
+
deny
|
|
93
|
+
only
|
|
94
|
+
exports
|
|
95
|
+
exportsMode
|
|
96
|
+
}
|
|
75
97
|
meta {
|
|
76
98
|
title
|
|
77
99
|
description
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Runner Dev Tools provide introspection, live telemetry, and a GraphQL API to exp
|
|
|
11
11
|
|
|
12
12
|
The way it works, is that this is a resource that opens a graphql server which opens your application to introspection.
|
|
13
13
|
|
|
14
|
-
If
|
|
14
|
+
If your runner primitives expose `toJSONSchema()` (for example matcher-based normalized schemas), runner-dev uses that as first-class schema export. `zod` schemas are also supported and converted to JSON Schema.
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
@@ -40,23 +40,42 @@ 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 `
|
|
43
|
+
- Overview tables now include `Visibility` (`Public`/`Private`) derived from Runner resource `isolate()` boundaries.
|
|
44
44
|
- Introspector: programmatic API to inspect tasks, hooks, resources, events, middleware, and diagnostics (including file paths, contents)
|
|
45
45
|
- Task introspection includes runtime `interceptorCount` / `hasInterceptors` (registered via `taskDependency.intercept(...)` in resource init).
|
|
46
|
-
- Resource introspection includes `
|
|
46
|
+
- Resource introspection includes `isolation` (`deny`, `only`, `exports`, `exportsMode`) from `.isolate(...)`.
|
|
47
|
+
- Resource introspection includes `subtree` governance summaries (middleware attachment counts and validator counts per branch).
|
|
48
|
+
- Resource introspection indicates whether a resource exposes a `cooldown()` hook for shutdown lifecycle.
|
|
49
|
+
- Isolation wildcard rules are clickable in the docs UI and open a modal showing matched resources with inline filtering when lists are large.
|
|
50
|
+
- Event introspection includes `transactional`, `parallel`, optional `eventLane { laneId, orderingKey, metadata }`, and optional `rpcLane { laneId }`.
|
|
51
|
+
- Task introspection includes optional `rpcLane { laneId }`.
|
|
52
|
+
- Tag pages distinguish between directly tagged elements and tag handlers (elements that depend on the tag id).
|
|
47
53
|
- Live: in-memory logs and event emissions
|
|
48
54
|
- Live File Previews and Saving.
|
|
49
55
|
- GraphQL server: deep graph navigation over your app’s topology and live data
|
|
50
56
|
- CLI with scaffolding, query-ing capabilities on a live endpoint or via dry-run mode.
|
|
51
57
|
- MCP server: allow your AI to do introspection for you.
|
|
52
58
|
|
|
59
|
+
## Runner 6.0 Migration Notes
|
|
60
|
+
|
|
61
|
+
| Before | After (hard switch) |
|
|
62
|
+
| --------------------- | -------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `Resource.exports` | `Resource.isolation { deny, only, exports, exportsMode }` |
|
|
64
|
+
| `Middleware.global` | `Middleware.autoApply { enabled, scope, hasPredicate }` |
|
|
65
|
+
| `Tag.middlewares` | `Tag.taskMiddlewares` + `Tag.resourceMiddlewares` |
|
|
66
|
+
| N/A | `Tag.errors`, `Tag.targets` |
|
|
67
|
+
| `RunOptions.initMode` | `RunOptions.lifecycleMode` + `dispose.{ totalBudgetMs, drainingBudgetMs, cooldownWindowMs }` |
|
|
68
|
+
| N/A | `Resource.subtree`, `Resource.cooldown` |
|
|
69
|
+
| N/A | `Event.transactional`, `Event.parallel`, `Event.eventLane`, `Event.rpcLane`, `Task.rpcLane` |
|
|
70
|
+
| `Resource.tunnelInfo` | Removed (hard switch to lane surfaces) |
|
|
71
|
+
|
|
53
72
|
## Table of Contents
|
|
54
73
|
|
|
55
74
|
- [Quickstart Guide](#quickstart)
|
|
56
75
|
- [Model Context Protocol (MCP) Server](#cli-usage-mcp-server)
|
|
57
76
|
- [CLI Tooling & Scaffolding](#cli-usage-direct)
|
|
58
77
|
- [Live Telemetry & Correlation](#live-telemetry)
|
|
59
|
-
- [Hot-Swapping Debugging System](
|
|
78
|
+
- [Hot-Swapping Debugging System](#hot-swapping-debugging-system)
|
|
60
79
|
- [GraphQL API Examples](#example-queries)
|
|
61
80
|
- [API Reference](API_REFERENCE.md)
|
|
62
81
|
- [Contributing & Local Dev](CONTRIBUTING.md)
|
|
@@ -86,7 +105,7 @@ export const app = resource({
|
|
|
86
105
|
|
|
87
106
|
Once your application is running with the `dev` resource, you can access the visual DevTools UI:
|
|
88
107
|
|
|
89
|
-
|
|
108
|
+
Open [http://localhost:1337](http://localhost:1337) in your browser.
|
|
90
109
|
|
|
91
110
|
Inside the UI, you can:
|
|
92
111
|
|
|
@@ -687,7 +706,7 @@ export const logSomething = task({
|
|
|
687
706
|
|
|
688
707
|
For full details on development, testing, and codegen, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
689
708
|
|
|
690
|
-
##
|
|
709
|
+
## Hot-Swapping Debugging System
|
|
691
710
|
|
|
692
711
|
**Revolutionary live debugging feature that allows AI assistants and developers to dynamically replace task run functions in live applications.**
|
|
693
712
|
|
|
@@ -809,7 +828,7 @@ mutation {
|
|
|
809
828
|
await deps.emitLog({
|
|
810
829
|
timestamp: new Date(),
|
|
811
830
|
level: "info",
|
|
812
|
-
message: "
|
|
831
|
+
message: "DEBUG: Creating user started",
|
|
813
832
|
data: { input }
|
|
814
833
|
});
|
|
815
834
|
}
|
|
@@ -834,7 +853,7 @@ mutation {
|
|
|
834
853
|
await deps.emitLog({
|
|
835
854
|
timestamp: new Date(),
|
|
836
855
|
level: "info",
|
|
837
|
-
message: "
|
|
856
|
+
message: "DEBUG: User created successfully",
|
|
838
857
|
data: { result }
|
|
839
858
|
});
|
|
840
859
|
}
|
|
@@ -915,7 +934,7 @@ Swapped functions can emit logs that are captured by the live telemetry system:
|
|
|
915
934
|
# After swapping with debug logging, query the logs
|
|
916
935
|
query RecentDebugLogs {
|
|
917
936
|
live {
|
|
918
|
-
logs(last: 50, filter: { messageIncludes: "
|
|
937
|
+
logs(last: 50, filter: { messageIncludes: "DEBUG" }) {
|
|
919
938
|
timestampMs
|
|
920
939
|
level
|
|
921
940
|
message
|
|
@@ -1139,7 +1158,7 @@ The system automatically handles complex JavaScript types:
|
|
|
1139
1158
|
|
|
1140
1159
|
For advanced debugging, the system provides an `eval` mutation to execute arbitrary JavaScript/TypeScript code on the server.
|
|
1141
1160
|
|
|
1142
|
-
|
|
1161
|
+
**Security Warning**: This feature is powerful and executes code with the same privileges as the application. It is intended for development environments only and is disabled by default in production. To enable it, set the environment variable `RUNNER_DEV_EVAL=1`.
|
|
1143
1162
|
|
|
1144
1163
|
#### `eval` Mutation
|
|
1145
1164
|
|
|
@@ -1182,13 +1201,129 @@ mutation {
|
|
|
1182
1201
|
|
|
1183
1202
|
### Architecture
|
|
1184
1203
|
|
|
1185
|
-
The hot-swapping system
|
|
1204
|
+
The hot-swapping system is organized into five high-level capabilities:
|
|
1205
|
+
|
|
1206
|
+
- **Execution Control**: swaps task `run` implementations at runtime and supports rollback.
|
|
1207
|
+
- **Validation Pipeline**: parses and compiles submitted code before activation.
|
|
1208
|
+
- **API Surface**: exposes swap and restore operations through GraphQL mutations.
|
|
1209
|
+
- **Observability**: integrates with live telemetry so swapped behavior can be inspected immediately.
|
|
1210
|
+
- **Safety Controls**: isolates failures to the attempted swap and preserves previous task behavior when validation fails.
|
|
1211
|
+
|
|
1212
|
+
The implementation remains fully type-safe and is covered by both unit and GraphQL integration tests.
|
|
1213
|
+
|
|
1214
|
+
---
|
|
1215
|
+
|
|
1216
|
+
## System Architecture
|
|
1217
|
+
|
|
1218
|
+
### Overview
|
|
1219
|
+
|
|
1220
|
+
Runner-Dev is built as a modular system of resources that integrate with the @bluelibs/runner framework to provide comprehensive development tools. The architecture follows a resource-based composition pattern where each component is a self-contained resource that can be registered and configured independently.
|
|
1221
|
+
|
|
1222
|
+
### Core Components
|
|
1223
|
+
|
|
1224
|
+
```mermaid
|
|
1225
|
+
graph TB
|
|
1226
|
+
subgraph "Core Framework (@bluelibs/runner)"
|
|
1227
|
+
App[Application Root]
|
|
1228
|
+
Resource[Resources]
|
|
1229
|
+
Task[Tasks]
|
|
1230
|
+
Event[Events]
|
|
1231
|
+
Middleware[Middleware]
|
|
1232
|
+
Hook[Hooks]
|
|
1233
|
+
Tag[Tags]
|
|
1234
|
+
end
|
|
1235
|
+
|
|
1236
|
+
subgraph "DevTools Layer (@bluelibs/runner-dev)"
|
|
1237
|
+
Dev[dev Resource]
|
|
1238
|
+
Introspector[Introspector]
|
|
1239
|
+
Live[Live Telemetry]
|
|
1240
|
+
Swap[Swap Manager]
|
|
1241
|
+
GraphQL[GraphQL Server]
|
|
1242
|
+
MCP[MCP Server]
|
|
1243
|
+
end
|
|
1244
|
+
|
|
1245
|
+
subgraph "Interfaces"
|
|
1246
|
+
UI[React UI]
|
|
1247
|
+
CLI[CLI Tools]
|
|
1248
|
+
AI[AI Assistants]
|
|
1249
|
+
end
|
|
1250
|
+
|
|
1251
|
+
App --> Dev
|
|
1252
|
+
Dev --> Introspector
|
|
1253
|
+
Dev --> Live
|
|
1254
|
+
Dev --> Swap
|
|
1255
|
+
Dev --> GraphQL
|
|
1256
|
+
GraphQL --> MCP
|
|
1257
|
+
|
|
1258
|
+
Introspector --> Resource
|
|
1259
|
+
Introspector --> Task
|
|
1260
|
+
Introspector --> Event
|
|
1261
|
+
Introspector --> Middleware
|
|
1262
|
+
Introspector --> Hook
|
|
1263
|
+
Introspector --> Tag
|
|
1264
|
+
|
|
1265
|
+
GraphQL --> UI
|
|
1266
|
+
GraphQL --> CLI
|
|
1267
|
+
MCP --> AI
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
### Component Responsibilities (High-Level)
|
|
1271
|
+
|
|
1272
|
+
| Layer | Responsibility |
|
|
1273
|
+
| --------------------------- | -------------------------------------------------------------------------------- |
|
|
1274
|
+
| **Composition Layer** | Registers and wires DevTools capabilities into the Runner application lifecycle. |
|
|
1275
|
+
| **Introspection Layer** | Builds a runtime model of tasks, resources, events, middleware, hooks, and tags. |
|
|
1276
|
+
| **Observability Layer** | Captures logs, emissions, errors, runs, and health metrics for analysis. |
|
|
1277
|
+
| **Execution Control Layer** | Supports remote task invocation and controlled hot-swapping workflows. |
|
|
1278
|
+
| **Access Layer** | Exposes a GraphQL API and transports for UI, CLI, and MCP clients. |
|
|
1279
|
+
|
|
1280
|
+
### Data Flow
|
|
1281
|
+
|
|
1282
|
+
```mermaid
|
|
1283
|
+
sequenceDiagram
|
|
1284
|
+
participant App as Runner App
|
|
1285
|
+
participant Dev as dev Resource
|
|
1286
|
+
participant Intro as Introspector
|
|
1287
|
+
participant GQL as GraphQL Server
|
|
1288
|
+
participant UI as React UI
|
|
1289
|
+
|
|
1290
|
+
App->>Dev: register dev.with({port: 1337})
|
|
1291
|
+
Dev->>Intro: walk application graph
|
|
1292
|
+
Intro-->>Dev: serialized topology
|
|
1293
|
+
Dev->>GQL: start server on port 1337
|
|
1294
|
+
|
|
1295
|
+
UI->>GQL: query { tasks { id dependsOn } }
|
|
1296
|
+
GQL-->>UI: introspected data
|
|
1297
|
+
|
|
1298
|
+
UI->>GQL: mutation invokeTask(...)
|
|
1299
|
+
GQL->>App: execute task
|
|
1300
|
+
App-->>GQL: result
|
|
1301
|
+
GQL-->>UI: response
|
|
1302
|
+
```
|
|
1303
|
+
|
|
1304
|
+
### Key Architectural Patterns
|
|
1305
|
+
|
|
1306
|
+
1. **Resource-Based Composition**: Everything in Runner is a resource that can be registered and composed. The dev tools themselves are resources.
|
|
1307
|
+
|
|
1308
|
+
2. **Introspection System**: The Introspector walks the application graph at runtime, extracting metadata about:
|
|
1309
|
+
|
|
1310
|
+
- Tasks (dependencies, emissions, interceptors)
|
|
1311
|
+
- Resources (isolation rules, subtree governance, cooldown hooks)
|
|
1312
|
+
- Events (listeners, transactional/parallel modes, lanes)
|
|
1313
|
+
- Middleware (auto-apply scopes, tags)
|
|
1314
|
+
- Tags (cross-cutting concerns with handlers)
|
|
1315
|
+
|
|
1316
|
+
3. **Live Telemetry**: In-memory store for recent activity with SSE streaming via `/live/stream`
|
|
1317
|
+
|
|
1318
|
+
4. **Hot-Swapping**: Modify task implementations without restart via `swapTask` mutation
|
|
1319
|
+
|
|
1320
|
+
5. **GraphQL API**: Full schema at `src/schema/` with queries for architecture and mutations for invocation/swapping
|
|
1321
|
+
|
|
1322
|
+
6. **MCP Integration**: AI assistants can connect via Model Context Protocol to introspect and interact with running apps
|
|
1186
1323
|
|
|
1187
|
-
|
|
1188
|
-
- **GraphQL Types** (`src/schema/types/SwapType.ts`): Type definitions for GraphQL API
|
|
1189
|
-
- **GraphQL Mutations** (`src/schema/mutation.ts`): Remote swap operations
|
|
1190
|
-
- **TypeScript Compiler**: Automatic code compilation and validation
|
|
1191
|
-
- **State Management**: Tracking of swapped functions and original code
|
|
1192
|
-
- **Error Handling**: Comprehensive validation and recovery mechanisms
|
|
1324
|
+
### Entry Points
|
|
1193
1325
|
|
|
1194
|
-
|
|
1326
|
+
- **Main export**: `src/index.ts` - exports `dev` resource and types
|
|
1327
|
+
- **CLI entry**: `src/cli.ts` - command-line interface
|
|
1328
|
+
- **MCP entry**: `src/mcp.ts` - Model Context Protocol server
|
|
1329
|
+
- **UI entry**: `src/ui/index.html` - React documentation UI
|
|
@@ -12,10 +12,10 @@ export declare function packageJson(projectName: string): {
|
|
|
12
12
|
readonly "schema:sdl": "runner-dev schema sdl";
|
|
13
13
|
};
|
|
14
14
|
readonly dependencies: {
|
|
15
|
-
readonly "@bluelibs/runner": "^
|
|
15
|
+
readonly "@bluelibs/runner": "^6.0.0";
|
|
16
16
|
};
|
|
17
17
|
readonly devDependencies: {
|
|
18
|
-
readonly "@bluelibs/runner-dev": "^
|
|
18
|
+
readonly "@bluelibs/runner-dev": "^6.0.0";
|
|
19
19
|
readonly typescript: "^5.6.3";
|
|
20
20
|
readonly tsx: "^4.19.2";
|
|
21
21
|
readonly jest: "^29.7.0";
|
|
@@ -16,10 +16,10 @@ function packageJson(projectName) {
|
|
|
16
16
|
"schema:sdl": "runner-dev schema sdl",
|
|
17
17
|
},
|
|
18
18
|
dependencies: {
|
|
19
|
-
"@bluelibs/runner": "^
|
|
19
|
+
"@bluelibs/runner": "^6.0.0",
|
|
20
20
|
},
|
|
21
21
|
devDependencies: {
|
|
22
|
-
"@bluelibs/runner-dev": "^
|
|
22
|
+
"@bluelibs/runner-dev": "^6.0.0",
|
|
23
23
|
typescript: "^5.6.3",
|
|
24
24
|
tsx: "^4.19.2",
|
|
25
25
|
jest: "^29.7.0",
|
|
@@ -32,141 +32,7 @@ const initUtils_1 = require("./initUtils");
|
|
|
32
32
|
const templates = __importStar(require("./scaffold/templates"));
|
|
33
33
|
async function scaffold(opts) {
|
|
34
34
|
const { targetDir, projectName } = opts;
|
|
35
|
-
//
|
|
36
|
-
const _pkg = {
|
|
37
|
-
name: projectName,
|
|
38
|
-
version: "0.1.0",
|
|
39
|
-
private: true,
|
|
40
|
-
type: "module",
|
|
41
|
-
scripts: {
|
|
42
|
-
dev: "tsx watch src/main.ts",
|
|
43
|
-
start: "node --enable-source-maps dist/main.js",
|
|
44
|
-
build: "tsc -p tsconfig.json",
|
|
45
|
-
test: "jest",
|
|
46
|
-
"test:watch": "jest --watch",
|
|
47
|
-
"schema:sdl": "runner-dev schema sdl",
|
|
48
|
-
},
|
|
49
|
-
dependencies: {
|
|
50
|
-
"@bluelibs/runner": "^5.2.0",
|
|
51
|
-
},
|
|
52
|
-
devDependencies: {
|
|
53
|
-
"@bluelibs/runner-dev": "^5.0.0",
|
|
54
|
-
typescript: "^5.6.3",
|
|
55
|
-
tsx: "^4.19.2",
|
|
56
|
-
jest: "^29.7.0",
|
|
57
|
-
"ts-jest": "^29.1.1",
|
|
58
|
-
"@types/jest": "^29.5.12",
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
const _tsconfig = {
|
|
62
|
-
compilerOptions: {
|
|
63
|
-
target: "ESNext",
|
|
64
|
-
module: "Node16",
|
|
65
|
-
moduleResolution: "node16",
|
|
66
|
-
strict: true,
|
|
67
|
-
esModuleInterop: true,
|
|
68
|
-
forceConsistentCasingInFileNames: true,
|
|
69
|
-
declaration: true,
|
|
70
|
-
outDir: "dist",
|
|
71
|
-
rootDir: "src",
|
|
72
|
-
skipLibCheck: true,
|
|
73
|
-
resolveJsonModule: true,
|
|
74
|
-
lib: ["ESNext"],
|
|
75
|
-
},
|
|
76
|
-
include: ["src"],
|
|
77
|
-
};
|
|
78
|
-
const _jestConfig = `/** @type {import('jest').Config} */
|
|
79
|
-
module.exports = {
|
|
80
|
-
preset: 'ts-jest/presets/default-esm',
|
|
81
|
-
testEnvironment: 'node',
|
|
82
|
-
roots: ['<rootDir>/src'],
|
|
83
|
-
moduleFileExtensions: ['ts', 'tsx', 'js'],
|
|
84
|
-
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
85
|
-
transform: {
|
|
86
|
-
'^.+\\.(ts|tsx)$': [
|
|
87
|
-
'ts-jest',
|
|
88
|
-
{
|
|
89
|
-
useESM: true,
|
|
90
|
-
tsconfig: 'tsconfig.jest.json',
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
};
|
|
95
|
-
`;
|
|
96
|
-
const _tsconfigJest = {
|
|
97
|
-
extends: "./tsconfig.json",
|
|
98
|
-
compilerOptions: {
|
|
99
|
-
module: "CommonJS",
|
|
100
|
-
moduleResolution: "node",
|
|
101
|
-
target: "ES2019",
|
|
102
|
-
esModuleInterop: true,
|
|
103
|
-
isolatedModules: false,
|
|
104
|
-
},
|
|
105
|
-
include: ["src/**/*.ts", "src/**/*.tsx"],
|
|
106
|
-
};
|
|
107
|
-
const _mainTs = `
|
|
108
|
-
import { run, resource } from '@bluelibs/runner';
|
|
109
|
-
import { dev } from '@bluelibs/runner-dev';
|
|
110
|
-
|
|
111
|
-
// Minimal Runner app using runner-dev's dev resource
|
|
112
|
-
const app = resource({
|
|
113
|
-
id: 'app.${projectName}',
|
|
114
|
-
register: [
|
|
115
|
-
dev.with({ port: 1337 }),
|
|
116
|
-
],
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
run(app)
|
|
120
|
-
.then(() => {
|
|
121
|
-
// eslint-disable-next-line no-console
|
|
122
|
-
console.log('Runner app started on http://localhost:1337');
|
|
123
|
-
})
|
|
124
|
-
.catch((err) => {
|
|
125
|
-
// eslint-disable-next-line no-console
|
|
126
|
-
console.error(err);
|
|
127
|
-
process.exit(1);
|
|
128
|
-
});
|
|
129
|
-
`;
|
|
130
|
-
const _exampleTest = `describe('smoke', () => {
|
|
131
|
-
it('works', () => {
|
|
132
|
-
expect(1 + 1).toBe(2);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
`;
|
|
136
|
-
const _readme = `# ${projectName}
|
|
137
|
-
|
|
138
|
-
Generated by \`runner-dev new\`.
|
|
139
|
-
|
|
140
|
-
## Quick start
|
|
141
|
-
|
|
142
|
-
1. Install dependencies:
|
|
143
|
-
- npm install
|
|
144
|
-
2. Start the dev server:
|
|
145
|
-
- npm run dev
|
|
146
|
-
|
|
147
|
-
The server starts on http://localhost:1337
|
|
148
|
-
|
|
149
|
-
- GraphQL endpoint: http://localhost:1337/graphql (how to query your guts and live telemetry)
|
|
150
|
-
- Voyager UI: http://localhost:1337/voyager (how the guts of your app look like)
|
|
151
|
-
- Project docs: http://localhost:1337/docs (beautiful docs with live telemetry and easy task and event dispatching)
|
|
152
|
-
|
|
153
|
-
## Scripts
|
|
154
|
-
|
|
155
|
-
- dev: Run with tsx watch (TypeScript ESM)
|
|
156
|
-
- build: Type-check and emit to dist
|
|
157
|
-
- start: Run built app
|
|
158
|
-
- test: Run Jest
|
|
159
|
-
|
|
160
|
-
## Useful CLI commands
|
|
161
|
-
|
|
162
|
-
These commands are available from \`@bluelibs/runner-dev\`:
|
|
163
|
-
|
|
164
|
-
- Query your API:
|
|
165
|
-
- ENDPOINT=http://localhost:1337/graphql npx runner-dev query 'query { tasks { id } }' --format pretty
|
|
166
|
-
- Print the GraphQL schema SDL:
|
|
167
|
-
- npx runner-dev schema sdl --endpoint http://localhost:1337/graphql
|
|
168
|
-
|
|
169
|
-
`;
|
|
35
|
+
// Generation is fully delegated to templates.*
|
|
170
36
|
// Use template renderers
|
|
171
37
|
await (0, initUtils_1.writeJson)(path_1.default.join(targetDir, "package.json"), templates.packageJson(projectName));
|
|
172
38
|
await (0, initUtils_1.writeJson)(path_1.default.join(targetDir, "tsconfig.json"), templates.tsconfig());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../../src/cli/generators/scaffold.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,
|
|
1
|
+
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../../../src/cli/generators/scaffold.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,4BAkCC;AA3CD,gDAAwB;AACxB,2CAA8E;AAC9E,gEAAkD;AAO3C,KAAK,UAAU,QAAQ,CAAC,IAAqB;IAClD,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAExC,+CAA+C;IAE/C,yBAAyB;IACzB,MAAM,IAAA,qBAAS,EACb,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,EACpC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CACnC,CAAC;IACF,MAAM,IAAA,qBAAS,EAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,EAAE,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7E,MAAM,IAAA,qBAAS,EACb,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EACvC,SAAS,CAAC,UAAU,EAAE,CACvB,CAAC;IACF,MAAM,IAAA,qBAAS,EACb,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAC1C,SAAS,CAAC,YAAY,EAAE,CACzB,CAAC;IAEF,MAAM,IAAA,qBAAS,EAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7C,MAAM,IAAA,qBAAS,EACb,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,EACtC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAC9B,CAAC;IACF,MAAM,IAAA,qBAAS,EACb,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,cAAc,CAAC,EAC3C,SAAS,CAAC,QAAQ,EAAE,CACrB,CAAC;IACF,MAAM,IAAA,qBAAS,EACb,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,EACjC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAC9B,CAAC;IACF,MAAM,IAAA,0BAAc,EAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -150,7 +150,8 @@ export const ${camel} = taskMiddleware<${pascal}Config, ${pascal}Input, ${pascal
|
|
|
150
150
|
title: '${pascal} Task Middleware',
|
|
151
151
|
description: 'TODO: Add description for ${pascal} task middleware',
|
|
152
152
|
},
|
|
153
|
-
//
|
|
153
|
+
// Auto-apply globally via resource.subtree({ tasks: { middleware: [${camel}] } })
|
|
154
|
+
// or intercept executions with globals.resources.taskRunner.intercept(...).
|
|
154
155
|
run: async ({ task, next }, deps, config) => {
|
|
155
156
|
// pre-process task.input
|
|
156
157
|
const result = await next(task.input as ${pascal}Input);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/cli/generators/templates.ts"],"names":[],"mappings":";;AAOA,4CAgCC;AAED,oCAgCC;AAED,sCAsBC;AAED,oCA0BC;AAED,kCA6BC;AAED,
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/cli/generators/templates.ts"],"names":[],"mappings":";;AAOA,4CAgCC;AAED,oCAgCC;AAED,sCAsBC;AAED,oCA0BC;AAED,kCA6BC;AAED,wDAqCC;AAED,gEA0BC;AAxND,SAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,EAAE,EACF,KAAK,EACL,MAAM,GACS;IACf,OAAO,GAAG,MAAM;;;mBAGC,MAAM;;;;mBAIN,MAAM;;;;eAIV,KAAK;SACX,EAAE;;cAEG,MAAM;8CAC0B,MAAM;;;;yBAI3B,MAAM,0BAA0B,MAAM;;mBAE5C,MAAM;;;;CAIxB,CAAC;AACF,CAAC;AAED,SAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,EAAE,EACF,KAAK,EACL,MAAM,GACS;IACf,OAAO,GAAG,MAAM;;;mBAGC,MAAM;;;;mBAIN,MAAM;;;;eAIV,KAAK;SACX,EAAE;;cAEG,MAAM;8CAC0B,MAAM;;;;wBAI5B,MAAM,yBAAyB,MAAM;mBAC1C,MAAM;;;;;CAKxB,CAAC;AACF,CAAC;AAED,SAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,EAAE,EACF,KAAK,EACL,MAAM,GACS;IACf,OAAO,GAAG,MAAM;;;mBAGC,MAAM;;;;eAIV,KAAK,YAAY,MAAM;SAC7B,EAAE;;cAEG,MAAM;8CAC0B,MAAM;;;;CAInD,CAAC;AACF,CAAC;AAED,SAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,EAAE,EACF,KAAK,EACL,MAAM,GACS;IACf,OAAO,GAAG,MAAM;;;mBAGC,MAAM;;;;eAIV,KAAK;SACX,EAAE;;cAEG,MAAM;8CAC0B,MAAM;;;;;;;;CAQnD,CAAC;AACF,CAAC;AAED,SAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,EAAE,EACF,KAAK,EACL,MAAM,GACS;IACf,OAAO,GAAG,MAAM;;;mBAGC,MAAM;;;;mBAIN,MAAM;;;;mBAIN,MAAM;;;;eAIV,KAAK,UAAU,MAAM,WAAW,MAAM,kBAAkB,MAAM;SACpE,EAAE;;cAEG,MAAM;8CAC0B,MAAM;;;CAGnD,CAAC;AACF,CAAC;AAED,SAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,EAAE,EACF,KAAK,EACL,MAAM,GACS;IACf,OAAO,GAAG,MAAM;;;mBAGC,MAAM;;;;mBAIN,MAAM;;;;mBAIN,MAAM;;;;eAIV,KAAK,qBAAqB,MAAM,WAAW,MAAM,UAAU,MAAM;SACvE,EAAE;;cAEG,MAAM;8CAC0B,MAAM;;wEAEoB,KAAK;;;;8CAI/B,MAAM;;uBAE7B,MAAM;;;CAG5B,CAAC;AACF,CAAC;AAED,SAAgB,0BAA0B,CAAC,EACzC,MAAM,EACN,EAAE,EACF,KAAK,EACL,MAAM,GACS;IACf,OAAO,GAAG,MAAM;;;mBAGC,MAAM;;;;eAIV,KAAK,yBAAyB,MAAM;SAC1C,EAAE;;cAEG,MAAM;8CAC0B,MAAM;;;;;;;;CAQnD,CAAC;AACF,CAAC"}
|