@bluelibs/runner-dev 6.2.0 → 6.4.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.
Files changed (162) hide show
  1. package/README.md +131 -12
  2. package/dist/cli/generators/initUtils.js +1 -1
  3. package/dist/cli/generators/initUtils.js.map +1 -1
  4. package/dist/cli/generators/scaffold/templates/README.md.js +17 -4
  5. package/dist/cli/generators/scaffold/templates/README.md.js.map +1 -1
  6. package/dist/cli/generators/scaffold/templates/index.d.ts +2 -1
  7. package/dist/cli/generators/scaffold/templates/index.js +5 -3
  8. package/dist/cli/generators/scaffold/templates/index.js.map +1 -1
  9. package/dist/cli/generators/scaffold/templates/package.json.d.ts +7 -2
  10. package/dist/cli/generators/scaffold/templates/package.json.js +7 -2
  11. package/dist/cli/generators/scaffold/templates/package.json.js.map +1 -1
  12. package/dist/cli/generators/scaffold/templates/src/app.test.ts.d.ts +1 -0
  13. package/dist/cli/generators/scaffold/templates/src/app.test.ts.js +29 -0
  14. package/dist/cli/generators/scaffold/templates/src/app.test.ts.js.map +1 -0
  15. package/dist/cli/generators/scaffold/templates/src/app.ts.d.ts +1 -0
  16. package/dist/cli/generators/scaffold/templates/src/app.ts.js +15 -0
  17. package/dist/cli/generators/scaffold/templates/src/app.ts.js.map +1 -0
  18. package/dist/cli/generators/scaffold/templates/src/main.ts.js +3 -10
  19. package/dist/cli/generators/scaffold/templates/src/main.ts.js.map +1 -1
  20. package/dist/cli/generators/scaffold/templates/tsconfig.json.d.ts +4 -2
  21. package/dist/cli/generators/scaffold/templates/tsconfig.json.js +4 -2
  22. package/dist/cli/generators/scaffold/templates/tsconfig.json.js.map +1 -1
  23. package/dist/cli/generators/scaffold.js +2 -1
  24. package/dist/cli/generators/scaffold.js.map +1 -1
  25. package/dist/cli.js +0 -0
  26. package/dist/docs/packageDocs.d.ts +16 -0
  27. package/dist/docs/packageDocs.js +107 -0
  28. package/dist/docs/packageDocs.js.map +1 -0
  29. package/dist/exportDocs.d.ts +10 -0
  30. package/dist/exportDocs.js +98 -0
  31. package/dist/exportDocs.js.map +1 -0
  32. package/dist/generated/resolvers-types.d.ts +126 -178
  33. package/dist/index.d.ts +4 -1
  34. package/dist/index.js +3 -1
  35. package/dist/index.js.map +1 -1
  36. package/dist/mcp/env.d.ts +5 -0
  37. package/dist/mcp/env.js +30 -1
  38. package/dist/mcp/env.js.map +1 -1
  39. package/dist/mcp/help.d.ts +8 -1
  40. package/dist/mcp/help.js +30 -4
  41. package/dist/mcp/help.js.map +1 -1
  42. package/dist/mcp/http.js +10 -0
  43. package/dist/mcp/http.js.map +1 -1
  44. package/dist/mcp/projectOverview.js +13 -4
  45. package/dist/mcp/projectOverview.js.map +1 -1
  46. package/dist/mcp/snapshot.d.ts +22 -0
  47. package/dist/mcp/snapshot.js +344 -0
  48. package/dist/mcp/snapshot.js.map +1 -0
  49. package/dist/mcp/tools/graphql.mutation.js +4 -1
  50. package/dist/mcp/tools/graphql.mutation.js.map +1 -1
  51. package/dist/mcp/tools/graphql.ping.js +1 -1
  52. package/dist/mcp/tools/graphql.ping.js.map +1 -1
  53. package/dist/mcp/tools/graphql.query.js +1 -1
  54. package/dist/mcp/tools/graphql.query.js.map +1 -1
  55. package/dist/mcp/tools/help.read.js +7 -5
  56. package/dist/mcp/tools/help.read.js.map +1 -1
  57. package/dist/mcp/tools/help.runner.js +3 -1
  58. package/dist/mcp/tools/help.runner.js.map +1 -1
  59. package/dist/mcp/tools/help.runnerDev.js +4 -4
  60. package/dist/mcp/tools/help.runnerDev.js.map +1 -1
  61. package/dist/mcp.js +4 -9
  62. package/dist/mcp.js.map +1 -1
  63. package/dist/resources/docsPayload.d.ts +33 -0
  64. package/dist/resources/docsPayload.js +174 -0
  65. package/dist/resources/docsPayload.js.map +1 -0
  66. package/dist/resources/docsUiAssets.d.ts +27 -0
  67. package/dist/resources/docsUiAssets.js +150 -0
  68. package/dist/resources/docsUiAssets.js.map +1 -0
  69. package/dist/resources/graphql-accumulator.resource.d.ts +1 -0
  70. package/dist/resources/graphql-accumulator.resource.js +30 -26
  71. package/dist/resources/graphql-accumulator.resource.js.map +1 -1
  72. package/dist/resources/live.resource.d.ts +0 -2
  73. package/dist/resources/live.resource.js +1 -5
  74. package/dist/resources/live.resource.js.map +1 -1
  75. package/dist/resources/models/Introspector.d.ts +17 -0
  76. package/dist/resources/models/Introspector.js +61 -28
  77. package/dist/resources/models/Introspector.js.map +1 -1
  78. package/dist/resources/models/durable.runtime.d.ts +1 -5
  79. package/dist/resources/models/durable.runtime.js +0 -33
  80. package/dist/resources/models/durable.runtime.js.map +1 -1
  81. package/dist/resources/models/durable.tools.d.ts +10 -0
  82. package/dist/resources/models/durable.tools.js +21 -0
  83. package/dist/resources/models/durable.tools.js.map +1 -1
  84. package/dist/resources/models/initializeFromStore.js +5 -5
  85. package/dist/resources/models/initializeFromStore.js.map +1 -1
  86. package/dist/resources/models/initializeFromStore.utils.d.ts +2 -2
  87. package/dist/resources/models/initializeFromStore.utils.js +399 -68
  88. package/dist/resources/models/initializeFromStore.utils.js.map +1 -1
  89. package/dist/resources/models/introspector.tools.js +88 -4
  90. package/dist/resources/models/introspector.tools.js.map +1 -1
  91. package/dist/resources/routeHandlers/createDocsServeHandler.js +13 -37
  92. package/dist/resources/routeHandlers/createDocsServeHandler.js.map +1 -1
  93. package/dist/resources/routeHandlers/getDocsData.d.ts +1 -6
  94. package/dist/resources/routeHandlers/getDocsData.js +10 -168
  95. package/dist/resources/routeHandlers/getDocsData.js.map +1 -1
  96. package/dist/resources/server.resource.js +0 -1
  97. package/dist/resources/server.resource.js.map +1 -1
  98. package/dist/resources/ui.static.js +4 -9
  99. package/dist/resources/ui.static.js.map +1 -1
  100. package/dist/schema/model.d.ts +21 -13
  101. package/dist/schema/model.js +14 -0
  102. package/dist/schema/model.js.map +1 -1
  103. package/dist/schema/query.js +3 -3
  104. package/dist/schema/query.js.map +1 -1
  105. package/dist/schema/types/AllType.js +2 -21
  106. package/dist/schema/types/AllType.js.map +1 -1
  107. package/dist/schema/types/DurableFlowTypes.d.ts +2 -0
  108. package/dist/schema/types/DurableFlowTypes.js +51 -1
  109. package/dist/schema/types/DurableFlowTypes.js.map +1 -1
  110. package/dist/schema/types/ErrorType.js +1 -3
  111. package/dist/schema/types/ErrorType.js.map +1 -1
  112. package/dist/schema/types/EventType.js +6 -19
  113. package/dist/schema/types/EventType.js.map +1 -1
  114. package/dist/schema/types/HookType.js +4 -16
  115. package/dist/schema/types/HookType.js.map +1 -1
  116. package/dist/schema/types/ResourceType.js +60 -23
  117. package/dist/schema/types/ResourceType.js.map +1 -1
  118. package/dist/schema/types/TaskLikeCommon.js +2 -2
  119. package/dist/schema/types/TaskLikeCommon.js.map +1 -1
  120. package/dist/schema/types/TaskType.js +12 -31
  121. package/dist/schema/types/TaskType.js.map +1 -1
  122. package/dist/schema/types/index.d.ts +0 -1
  123. package/dist/schema/types/index.js +1 -10
  124. package/dist/schema/types/index.js.map +1 -1
  125. package/dist/schema/types/middleware/UsageTypes.d.ts +1 -0
  126. package/dist/schema/types/middleware/UsageTypes.js +16 -5
  127. package/dist/schema/types/middleware/UsageTypes.js.map +1 -1
  128. package/dist/schema/types/middleware/common.js +2 -2
  129. package/dist/schema/types/middleware/common.js.map +1 -1
  130. package/dist/ui/.vite/manifest.json +2 -2
  131. package/dist/ui/assets/docs-DaF8dCiE.css +1 -0
  132. package/dist/ui/assets/docs-DgcoUGlF.js +261 -0
  133. package/dist/ui/assets/docs-DgcoUGlF.js.map +1 -0
  134. package/dist/ui/docs/favicon.ico +0 -0
  135. package/dist/utils/lane-resources.d.ts +69 -0
  136. package/dist/utils/lane-resources.js +145 -0
  137. package/dist/utils/lane-resources.js.map +1 -1
  138. package/dist/utils/runner-namespace.d.ts +1 -0
  139. package/dist/utils/runner-namespace.js +9 -0
  140. package/dist/utils/runner-namespace.js.map +1 -0
  141. package/dist/utils/schemaFormat.d.ts +6 -0
  142. package/dist/utils/schemaFormat.js +244 -0
  143. package/dist/utils/schemaFormat.js.map +1 -0
  144. package/dist/utils/system-namespace.d.ts +1 -0
  145. package/dist/utils/system-namespace.js +9 -0
  146. package/dist/utils/system-namespace.js.map +1 -0
  147. package/dist/version.d.ts +1 -1
  148. package/dist/version.js +1 -1
  149. package/package.json +20 -4
  150. package/readmes/API_REFERENCE.md +352 -0
  151. package/readmes/COMPACT_GUIDE.md +254 -0
  152. package/skills/core/SKILL.md +27 -0
  153. package/skills/core/references/readmes/API_REFERENCE.md +352 -0
  154. package/skills/core/references/readmes/COMPACT_GUIDE.md +254 -0
  155. package/AI.md +0 -630
  156. package/dist/ui/assets/docs-CWJO6emS.css +0 -1
  157. package/dist/ui/assets/docs-Zej7hPlV.js +0 -302
  158. package/dist/ui/assets/docs-Zej7hPlV.js.map +0 -1
  159. package/readmes/runner-AI.md +0 -917
  160. package/readmes/runner-durable-workflows.md +0 -2247
  161. package/readmes/runner-full-guide.md +0 -6010
  162. package/readmes/runner-remote-lanes.md +0 -910
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluelibs/runner-dev",
3
- "version": "6.2.0",
3
+ "version": "6.4.0",
4
4
  "description": "BlueLibs Runner DevTools",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -11,6 +11,8 @@
11
11
  "build": "tsc -p config/ts/tsconfig.json && npm run build:ui",
12
12
  "watch": "tsc -p config/ts/tsconfig.json -w",
13
13
  "clean": "rm -rf dist",
14
+ "skills:pack:materialize": "node ./scripts/pack-npm-skills.mjs materialize",
15
+ "skills:pack:restore": "node ./scripts/pack-npm-skills.mjs restore",
14
16
  "cli": "ts-node --project config/ts/tsconfig.json src/cli.ts",
15
17
  "cli:local": "ts-node --project config/ts/tsconfig.json src/cli.ts",
16
18
  "start": "node dist/main.js",
@@ -21,6 +23,7 @@
21
23
  "build:ui:watch": "cd src/ui && vite build --watch --clearScreen=false",
22
24
  "play:server": "tsx watch --tsconfig config/ts/tsconfig.json src/__tests__/dummy/dummyServer.ts",
23
25
  "test": "jest --config config/jest/jest.config.js --verbose --runInBand",
26
+ "test:qa": "node ./scripts/run-jest-summary.mjs",
24
27
  "test:dev": "jest --config config/jest/jest.config.js --verbose --watch",
25
28
  "coverage": "jest --config config/jest/jest.config.js --verbose --coverage",
26
29
  "test:clean": "jest --config config/jest/jest.config.js --clearCache",
@@ -31,16 +34,19 @@
31
34
  "typedoc": "typedoc --options config/typedoc/typedoc.json",
32
35
  "lint": "eslint src --config config/eslint/eslint.config.mjs",
33
36
  "lint:fix": "eslint src --config config/eslint/eslint.config.mjs --fix",
34
- "qa": "npm run lint:fix && npm run typecheck && npm run build && npm run test && npm run typedoc",
37
+ "qa": "npm run lint:fix && npm run typecheck && npm run build && npm run test:qa && npm run typedoc",
35
38
  "coverage:ai": "jest --config config/jest/jest.config.js --coverage --coverageReporters=text-summary",
36
39
  "codegen": "graphql-codegen --config config/codegen.ts",
37
40
  "prebuild": "ts-node --project config/ts/tsconfig.json scripts/sync-version.ts && npm run codegen",
38
41
  "play": "concurrently -k -n UI,SRV -c blue,green \"npm:build:ui:watch\" \"npm:play:server\"",
39
42
  "play:cli": "npm run play:server",
43
+ "play:export": "ts-node --project config/ts/tsconfig.json src/__tests__/dummy/exportPlayCatalog.ts",
40
44
  "demo:ping": "ENDPOINT=http://localhost:31337/graphql node dist/cli.js ping",
41
45
  "demo:query": "ENDPOINT=http://localhost:31337/graphql node dist/cli.js query 'query { tasks { id } }' --format pretty",
42
46
  "demo:overview": "ENDPOINT=http://localhost:31337/graphql node dist/cli.js overview --details 5",
43
- "sync:docs": "ts-node --project config/ts/tsconfig.json scripts/sync-docs.ts"
47
+ "postinstall": "npm-skills extract --skip-production --override",
48
+ "prepack": "npm run build && npm run skills:pack:materialize",
49
+ "postpack": "npm run skills:pack:restore"
44
50
  },
45
51
  "bin": {
46
52
  "runner-dev": "dist/cli.js"
@@ -106,7 +112,6 @@
106
112
  "@adobe/jsonschema2md": "^8.0.5",
107
113
  "@apollo/server": "^5.0.0",
108
114
  "@as-integrations/express5": "^1.1.2",
109
- "@bluelibs/runner": "^6.2.0",
110
115
  "@bluelibs/smart": "^2.2.1",
111
116
  "@modelcontextprotocol/sdk": "^1.17.2",
112
117
  "@types/prismjs": "^1.26.5",
@@ -114,6 +119,7 @@
114
119
  "express": "^5.0.0",
115
120
  "graphql": "^16.11.0",
116
121
  "lru-cache": "^11.1.0",
122
+ "npm-skills": "^0.4.0",
117
123
  "prismjs": "^1.30.0",
118
124
  "react": "18.3.1",
119
125
  "react-dom": "18.3.1",
@@ -128,6 +134,13 @@
128
134
  "react-dom": "18.3.1"
129
135
  }
130
136
  },
137
+ "npmSkills": {
138
+ "consume": {
139
+ "only": [
140
+ "@bluelibs/runner"
141
+ ]
142
+ }
143
+ },
131
144
  "prettier": {
132
145
  "trailingComma": "es5",
133
146
  "tabWidth": 2,
@@ -143,5 +156,8 @@
143
156
  }
144
157
  }
145
158
  ]
159
+ },
160
+ "peerDependencies": {
161
+ "@bluelibs/runner": "^6.4.0"
146
162
  }
147
163
  }
@@ -0,0 +1,352 @@
1
+ # GraphQL API Reference
2
+
3
+ This document tracks the current `@bluelibs/runner-dev` GraphQL surface.
4
+ It has been refreshed for the current SDL and focuses on the entry points people actually reach for first: root queries, mutations, live telemetry, and the higher-signal topology types.
5
+
6
+ If you need the complete schema SDL instead of the guided summary below, print it directly from the current build:
7
+
8
+ ```bash
9
+ # Against a running app
10
+ runner-dev schema sdl --endpoint http://localhost:1337/graphql
11
+
12
+ # Or in dry-run mode from a local entry file
13
+ runner-dev schema sdl --entry-file src/main.ts
14
+ ```
15
+
16
+ ## Highlights
17
+
18
+ - Introspection spans tasks, hooks, resources, events, tags, errors, async contexts, middleware, run options, and interceptor ownership.
19
+ - Resource docs now include `isolation`, `subtree`, cooldown/ready/health flags, and resolved registrations.
20
+ - Task docs include durable workflow metadata, RPC lane summary, and runtime interceptor ownership.
21
+ - Live telemetry includes logs, event emissions, errors, runs, process stats, and per-resource health reports.
22
+ - Mutations cover task swapping, unswapping, task/event invocation, file editing, and guarded eval.
23
+
24
+ ## Query Root
25
+
26
+ The current `Query` type exposes:
27
+
28
+ - `root: Resource`
29
+ - `runOptions: RunOptions!`
30
+ - `interceptorOwners: InterceptorOwnersSnapshot!`
31
+ - `all(idIncludes: ID): [BaseElement!]!`
32
+ - `tags: [Tag!]!`
33
+ - `tag(id: ID!): Tag`
34
+ - `task(id: ID!): Task`
35
+ - `tasks(idIncludes: ID): [Task!]!`
36
+ - `hook(id: ID!): Hook`
37
+ - `hooks(idIncludes: ID): [Hook!]!`
38
+ - `resource(id: ID!): Resource`
39
+ - `resources(idIncludes: ID): [Resource!]!`
40
+ - `event(id: ID!): Event`
41
+ - `events(filter: EventFilterInput): [Event!]!`
42
+ - `middleware(id: ID!): Middleware`
43
+ - `middlewares(idIncludes: ID): [Middleware!]!`
44
+ - `taskMiddlewares(idIncludes: ID): [TaskMiddleware!]!`
45
+ - `resourceMiddlewares(idIncludes: ID): [ResourceMiddleware!]!`
46
+ - `error(id: ID!): Error`
47
+ - `errors(idIncludes: ID): [Error!]!`
48
+ - `asyncContext(id: ID!): AsyncContext`
49
+ - `asyncContexts(idIncludes: ID): [AsyncContext!]!`
50
+ - `live: Live!`
51
+ - `diagnostics: [Diagnostic!]!`
52
+ - `swappedTasks: [SwappedTask!]!`
53
+
54
+ ### Common Query Filters
55
+
56
+ - `EventFilterInput`
57
+ - `hasNoHooks: Boolean`
58
+ - `hideSystem: Boolean`
59
+ - `idIncludes: String`
60
+ - `RunFilterInput`
61
+ - `nodeKinds`, `nodeIds`, `ok`, `parentIds`, `rootIds`, `correlationIds`
62
+ - `LogFilterInput`
63
+ - `levels`, `messageIncludes`, `correlationIds`
64
+ - `EmissionFilterInput`
65
+ - `eventIds`, `emitterIds`, `correlationIds`
66
+ - `ErrorFilterInput`
67
+ - `sourceKinds`, `sourceIds`, `messageIncludes`, `correlationIds`
68
+
69
+ ## Mutation Root
70
+
71
+ The current `Mutation` type exposes:
72
+
73
+ - `swapTask(taskId: ID!, runCode: String!): SwapResult!`
74
+ - `unswapTask(taskId: ID!): SwapResult!`
75
+ - `unswapAllTasks: [SwapResult!]!`
76
+ - `invokeTask(taskId: ID!, inputJson: String, pure: Boolean = false, evalInput: Boolean = false): InvokeResult!`
77
+ - `invokeEvent(eventId: ID!, inputJson: String, evalInput: Boolean = false): InvokeEventResult!`
78
+ - `editFile(path: String!, content: String!): EditFileResult!`
79
+ - `eval(code: String!): EvalResult!`
80
+
81
+ ### Mutation Notes
82
+
83
+ - `swapTask` replaces a task's `run()` implementation at runtime.
84
+ - `invokeTask` supports `pure: true` to bypass middleware.
85
+ - `editFile` accepts structured paths such as `workspace:src/index.ts`.
86
+ - `eval` is guarded and disabled in production unless `RUNNER_DEV_EVAL=1`.
87
+
88
+ ## Core Types
89
+
90
+ ### BaseElement
91
+
92
+ Shared across tasks, hooks, resources, middleware, events, tags, errors, and async contexts:
93
+
94
+ - `id`
95
+ - `meta`
96
+ - `filePath`
97
+ - `fileContents(startLine, endLine)`
98
+ - `markdownDescription`
99
+ - `isPrivate`
100
+ - `visibilityReason`
101
+ - `tags`
102
+ - `tagsDetailed`
103
+
104
+ Many concrete element types also expose:
105
+
106
+ - `coverage`
107
+ - `coverageContents`
108
+ - `registeredBy`
109
+ - resolved variants such as `registeredByResolved`
110
+
111
+ ### Task
112
+
113
+ Key fields:
114
+
115
+ - `dependsOn`, `dependsOnResolved`
116
+ - `middleware`, `middlewareResolved`, `middlewareResolvedDetailed`
117
+ - `emits`, `emitsResolved`
118
+ - `inputSchema`, `inputSchemaReadable`
119
+ - `rpcLane`
120
+ - `interceptorCount`, `hasInterceptors`, `interceptorOwnerIds`
121
+ - `runs(afterTimestamp, last, filter)`
122
+ - `isDurable`, `durableResource`, `durableWorkflowKey`
123
+ - `overriddenBy`, `registeredBy`
124
+
125
+ The middleware usage objects now include subtree provenance details:
126
+
127
+ - `TaskMiddlewareUsage.id`
128
+ - `TaskMiddlewareUsage.config`
129
+ - `TaskMiddlewareUsage.origin`
130
+ - `TaskMiddlewareUsage.subtreeOwnerId`
131
+ - `TaskMiddlewareUsage.node`
132
+
133
+ ### Hook
134
+
135
+ Key fields:
136
+
137
+ - `events`
138
+ - `event` (deprecated singular form)
139
+ - `hookOrder`
140
+ - `dependsOn`, `depenendsOnResolved`
141
+ - `middleware`, `middlewareResolvedDetailed`
142
+ - `runs(...)`
143
+
144
+ ### Resource
145
+
146
+ Key fields:
147
+
148
+ - `dependsOn`, `dependsOnResolved`
149
+ - `config`, `configSchema`, `configSchemaReadable`
150
+ - `context`
151
+ - `middleware`, `middlewareResolvedDetailed`
152
+ - `overrides`, `overridesResolved`
153
+ - `registers`, `registersResolved`
154
+ - `usedBy`
155
+ - `emits`
156
+ - `registeredBy`, `registeredByResolved`
157
+ - `hasCooldown`, `hasReady`, `hasHealthCheck`
158
+ - `isolation`
159
+ - `subtree`
160
+
161
+ Important nested resource types:
162
+
163
+ - `ResourceIsolation`
164
+ - `deny`
165
+ - `only`
166
+ - `whitelist`
167
+ - `exports`
168
+ - `exportsMode`
169
+ - `ResourceSubtreePolicy`
170
+ - `tasks`
171
+ - `middleware`
172
+ - `resources`
173
+ - `hooks`
174
+ - `taskMiddleware`
175
+ - `resourceMiddleware`
176
+ - `events`
177
+ - `tags`
178
+
179
+ Subtree policy now covers identity-aware summaries too:
180
+
181
+ - `ResourceSubtreeTaskBranch.identity`
182
+ - `ResourceSubtreeMiddlewareScope.identityScope`
183
+
184
+ ### Middleware
185
+
186
+ The generic `Middleware` type exposes the combined view used by the introspector:
187
+
188
+ - `autoApply`
189
+ - `emits`
190
+ - `configSchema`, `configSchemaReadable`
191
+ - `usedByTasks`, `usedByTasksResolved`, `usedByTasksDetailed`
192
+ - `usedByResources`, `usedByResourcesResolved`, `usedByResourcesDetailed`
193
+
194
+ Specialized views:
195
+
196
+ - `TaskMiddleware.usedBy`
197
+ - `TaskMiddleware.usedByDetailed`
198
+ - `ResourceMiddleware.usedBy`
199
+ - `ResourceMiddleware.usedByDetailed`
200
+
201
+ ### Event
202
+
203
+ Key fields:
204
+
205
+ - `payloadSchema`, `payloadSchemaReadable`
206
+ - `transactional`
207
+ - `parallel`
208
+ - `eventLane`
209
+ - `rpcLane`
210
+ - `emittedBy`, `emittedByResolved`
211
+ - `listenedToBy`, `listenedToByResolved`
212
+ - `registeredBy`, `registeredByResolved`
213
+
214
+ ### Tag
215
+
216
+ Tags now fan out across the full model:
217
+
218
+ - `configSchema`
219
+ - `config`
220
+ - `targets`
221
+ - `tasks`
222
+ - `hooks`
223
+ - `resources`
224
+ - `taskMiddlewares`
225
+ - `resourceMiddlewares`
226
+ - `events`
227
+ - `errors`
228
+ - `all`
229
+
230
+ ### Error
231
+
232
+ Key fields:
233
+
234
+ - `dataSchema`
235
+ - `thrownBy`
236
+
237
+ ### AsyncContext
238
+
239
+ Key fields:
240
+
241
+ - `serialize`
242
+ - `parse`
243
+ - `usedBy`
244
+ - `requiredBy`
245
+ - `providedBy`
246
+
247
+ ### RunOptions
248
+
249
+ Runner-dev now exposes effective startup/runtime settings through `runOptions`:
250
+
251
+ - `mode`
252
+ - `debug`, `debugMode`
253
+ - `logsEnabled`, `logsPrintThreshold`, `logsPrintStrategy`, `logsBuffer`
254
+ - `errorBoundary`
255
+ - `shutdownHooks`
256
+ - `dryRun`
257
+ - `lazy`
258
+ - `lifecycleMode`
259
+ - `dispose`
260
+ - `executionContext`
261
+ - `hasOnUnhandledError`
262
+ - `rootId`
263
+
264
+ Nested types:
265
+
266
+ - `RunDisposeOptions`
267
+ - `totalBudgetMs`
268
+ - `drainingBudgetMs`
269
+ - `cooldownWindowMs`
270
+ - `RunExecutionContextOptions`
271
+ - `enabled`
272
+ - `cycleDetection`
273
+
274
+ ### InterceptorOwnersSnapshot
275
+
276
+ Useful when debugging `taskDependency.intercept(...)` and middleware interceptors:
277
+
278
+ - `tasksById`
279
+ - `middleware.globalTaskInterceptorOwnerIds`
280
+ - `middleware.globalResourceInterceptorOwnerIds`
281
+ - `middleware.perTaskMiddlewareInterceptorOwnerIds`
282
+ - `middleware.perResourceMiddlewareInterceptorOwnerIds`
283
+
284
+ ## Live Telemetry
285
+
286
+ `live: Live!` exposes:
287
+
288
+ - `memory: MemoryStats!`
289
+ - `cpu: CpuStats!`
290
+ - `eventLoop(reset: Boolean): EventLoopStats!`
291
+ - `gc(windowMs: Float): GcStats!`
292
+ - `logs(afterTimestamp, last, filter): [LogEntry!]!`
293
+ - `emissions(afterTimestamp, last, filter): [EmissionEntry!]!`
294
+ - `errors(afterTimestamp, last, filter): [ErrorEntry!]!`
295
+ - `runs(afterTimestamp, last, filter): [RunRecord!]!`
296
+ - `healthReport: ResourceHealthReport`
297
+
298
+ Supporting types include:
299
+
300
+ - `LogEntry`
301
+ - `EmissionEntry`
302
+ - `ErrorEntry`
303
+ - `RunRecord`
304
+ - `ResourceHealthReport`
305
+ - `ResourceHealthTotals`
306
+ - `ResourceHealthEntry`
307
+
308
+ ## Diagnostics And Swap Types
309
+
310
+ - `Diagnostic`
311
+ - `severity`
312
+ - `code`
313
+ - `message`
314
+ - `nodeId`
315
+ - `nodeKind`
316
+ - `SwapResult`
317
+ - `SwappedTask`
318
+ - `InvokeResult`
319
+ - `InvokeEventResult`
320
+ - `EvalResult`
321
+ - `EditFileResult`
322
+
323
+ ## Enums Worth Knowing
324
+
325
+ - `LogLevelEnum`
326
+ - `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `log`
327
+ - `SourceKindEnum`
328
+ - `TASK`, `HOOK`, `RESOURCE`, `MIDDLEWARE`, `INTERNAL`
329
+ - `NodeKindEnum`
330
+ - `TASK`, `HOOK`
331
+ - `MiddlewareApplyScope`
332
+ - `WHERE_VISIBLE`, `SUBTREE`
333
+ - `IsolationExportsMode`
334
+ - `UNSET`, `NONE`, `LIST`
335
+ - `TagTarget`
336
+ - `TASKS`, `RESOURCES`, `EVENTS`, `HOOKS`, `TASK_MIDDLEWARES`, `RESOURCE_MIDDLEWARES`, `ERRORS`
337
+ - `ResourceHealthStatus`
338
+ - `healthy`, `degraded`, `unhealthy`
339
+
340
+ ## SDL Regeneration
341
+
342
+ When this file drifts, regenerate your view from the actual schema rather than hand-guessing:
343
+
344
+ ```bash
345
+ runner-dev schema sdl --endpoint http://localhost:1337/graphql
346
+ ```
347
+
348
+ Or from the repo without a running server:
349
+
350
+ ```bash
351
+ runner-dev schema sdl --entry-file src/main.ts
352
+ ```
@@ -0,0 +1,254 @@
1
+ # Runner-Dev Compact Guide
2
+
3
+ Runner-Dev is the developer-facing toolkit for inspecting, querying, and debugging Runner apps through a docs UI, GraphQL endpoint, MCP server, live telemetry, and controlled hot-swapping. Use it when the task is about what a Runner app looks like at runtime, what the docs/AI layer sees, or how runner-dev exposes that information.
4
+
5
+ It also supports a static export path through `exportDocs(app, { output?, overwrite? })` when you want the visual catalog without keeping a live server around.
6
+
7
+ ## Use This When
8
+
9
+ - The task touches `/docs/data`, docs UI, chat context, agent-facing documentation, or the topology graph / blast-radius / mindmap views.
10
+ - You need GraphQL or MCP access to runtime topology, telemetry, schema, or diagnostics.
11
+ - You are debugging telemetry, live events, durable metadata, hook targets, or lane surfaces.
12
+ - You are changing runner-dev CLI, MCP tools, docs payload shaping, or introspection behavior.
13
+
14
+ ## Fastest Path To Success
15
+
16
+ 1. Decide whether the target app is already running.
17
+ 2. If it is running, prefer MCP or GraphQL before reading lots of source.
18
+ 3. If it is package work, locate the subsystem first:
19
+ - docs payloads and docs UI
20
+ - introspector/store serialization
21
+ - MCP tools
22
+ - live telemetry
23
+ - swap/hot-reload
24
+ 4. Patch the smallest surface that explains the behavior.
25
+ 5. Run the narrowest relevant test first, then widen only if needed.
26
+
27
+ ## Quick Setup
28
+
29
+ Register runner-dev in the Runner root:
30
+
31
+ ```ts
32
+ import { r } from "@bluelibs/runner";
33
+ import { dev } from "@bluelibs/runner-dev";
34
+
35
+ export const app = r
36
+ .resource("app")
37
+ .register([
38
+ dev.with({
39
+ port: 1337,
40
+ maxEntries: 1000,
41
+ }),
42
+ ])
43
+ .build();
44
+ ```
45
+
46
+ Expected endpoints after the app starts:
47
+
48
+ - UI: `http://localhost:1337`
49
+ - GraphQL: `http://localhost:1337/graphql`
50
+ - Live stream: `http://localhost:1337/live/stream`
51
+ - Docs payload: `http://localhost:1337/docs/data`
52
+
53
+ Static export option:
54
+
55
+ ```ts
56
+ // scripts/export-docs.ts
57
+ import { exportDocs } from "@bluelibs/runner-dev";
58
+ import { app } from "../src/app";
59
+
60
+ await exportDocs(app);
61
+ // Optional custom destination:
62
+ await exportDocs(app, {
63
+ output: "./artifacts/runner-dev-catalog",
64
+ overwrite: true,
65
+ });
66
+ ```
67
+
68
+ Add a package script:
69
+
70
+ ```json
71
+ {
72
+ "scripts": {
73
+ "docs:export": "tsx scripts/export-docs.ts"
74
+ }
75
+ }
76
+ ```
77
+
78
+ Then run:
79
+
80
+ ```bash
81
+ npm run docs:export
82
+ ```
83
+
84
+ Notes:
85
+
86
+ - default output is `./runner-dev-catalog`
87
+ - `exportDocs()` uses Runner dry-run under the hood: it effectively does `run(app, { dryRun: true })` and snapshots the composed in-memory store
88
+ - `exportDocs(app)` writes a standalone `index.html` plus `snapshot.json`
89
+ - custom non-empty directories require `overwrite: true`
90
+ - the exported `index.html` is standalone and can be opened directly over `file://`
91
+ - `snapshot.json` is still written as an auxiliary artifact for inspection, debugging, and snapshot-backed MCP
92
+ - this works well in CI too: upload the export folder as a build artifact and inspect it after the pipeline finishes
93
+ - in this repository, `npm run play:export` is the same pattern wired to the reference commerce app used by `npm run play`
94
+
95
+ ## MCP Quickstart
96
+
97
+ Use MCP against either a live Dev GraphQL endpoint or an exported `snapshot.json`.
98
+
99
+ Minimal client config:
100
+
101
+ ```json
102
+ {
103
+ "mcpServers": {
104
+ "runner-dev": {
105
+ "command": "npx",
106
+ "args": ["@bluelibs/runner-dev", "mcp"],
107
+ "env": {
108
+ "ENDPOINT": "http://localhost:1337/graphql",
109
+ "ALLOW_MUTATIONS": "false"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ Authenticated variant:
117
+
118
+ ```json
119
+ {
120
+ "mcpServers": {
121
+ "runner-dev": {
122
+ "command": "npx",
123
+ "args": ["@bluelibs/runner-dev", "mcp"],
124
+ "env": {
125
+ "ENDPOINT": "http://localhost:1337/graphql",
126
+ "HEADERS": "{\"Authorization\":\"Bearer <token>\"}",
127
+ "ALLOW_MUTATIONS": "false"
128
+ }
129
+ }
130
+ }
131
+ }
132
+ ```
133
+
134
+ Direct launch:
135
+
136
+ ```bash
137
+ ENDPOINT=http://localhost:1337/graphql npx -y @bluelibs/runner-dev mcp
138
+ SNAPSHOT_FILE=./runner-dev-catalog/snapshot.json npx -y @bluelibs/runner-dev mcp
139
+ ```
140
+
141
+ First checks, in order:
142
+
143
+ 1. `graphql.ping`
144
+ 2. `project.overview`
145
+ 3. `graphql.query`
146
+
147
+ Shell equivalents:
148
+
149
+ ```bash
150
+ ENDPOINT=http://localhost:1337/graphql npx @bluelibs/runner-dev ping
151
+ ENDPOINT=http://localhost:1337/graphql npx @bluelibs/runner-dev overview --details 5
152
+ ENDPOINT=http://localhost:1337/graphql npx @bluelibs/runner-dev query 'query { tasks { id } resources { id } }' --format pretty
153
+ ```
154
+
155
+ Notes:
156
+
157
+ - Keep `ALLOW_MUTATIONS=false` unless you intentionally need write access.
158
+ - Set `HEADERS` if the GraphQL endpoint requires auth.
159
+ - `SNAPSHOT_FILE` enables read-only MCP over an exported catalog without starting the app.
160
+ - If `graphql.ping` fails, check that the app is running, the port is correct, and `HEADERS` is valid JSON.
161
+
162
+ ## First Things To Inspect
163
+
164
+ If the app is running:
165
+
166
+ - Start from `/docs/data` when the question is about what the docs UI or AI sees.
167
+ - Use `project.overview` for a fast topology summary.
168
+ - Use GraphQL for focused reads, not giant dumps.
169
+ - Use live telemetry only with narrow limits such as `last: 10`.
170
+
171
+ Minimal topology query:
172
+
173
+ ```graphql
174
+ query FirstLook {
175
+ tasks {
176
+ id
177
+ }
178
+ resources {
179
+ id
180
+ }
181
+ hooks {
182
+ id
183
+ }
184
+ diagnostics {
185
+ severity
186
+ code
187
+ message
188
+ }
189
+ }
190
+ ```
191
+
192
+ Minimal live query:
193
+
194
+ ```graphql
195
+ query LiveFirstLook {
196
+ live {
197
+ logs(last: 10) {
198
+ level
199
+ message
200
+ correlationId
201
+ }
202
+ errors(last: 10) {
203
+ sourceKind
204
+ message
205
+ correlationId
206
+ }
207
+ }
208
+ }
209
+ ```
210
+
211
+ ## High-Value Source Files
212
+
213
+ When working inside `@bluelibs/runner-dev`, start here:
214
+
215
+ - `src/resources/routeHandlers/getDocsData.ts` for docs payloads and bundled context
216
+ - `src/resources/models/Introspector.ts` and related store initialization for topology
217
+ - `src/mcp/tools/*` for MCP help/query behavior
218
+ - `src/resources/live.resource.ts` and telemetry resources for live data
219
+ - `src/ui/src/components/Documentation/*` for docs/chat UI behavior
220
+ - `src/ui/src/components/Documentation/components/TopologyPanel.tsx` and `src/ui/src/components/Documentation/utils/topologyGraph.ts` for topology graph projections and rendering
221
+ - `src/resources/swap.resource.ts` and `src/resources/swap.tools.ts` for hot-swapping surfaces
222
+
223
+ ## Core Surfaces
224
+
225
+ - Docs UI: the browser surface for architecture, live data, and AI assistance
226
+ - Topology graph: a focused lens for blast-radius analysis and resource mindmaps
227
+ - `/docs/data`: the JSON payload feeding docs UI and in-app AI context
228
+ - GraphQL: the main runtime introspection surface
229
+ - MCP: the fastest AI-native access path when the app is already running
230
+ - Live telemetry: logs, emissions, errors, runs, and correlation-driven inspection
231
+ - Swap tooling: controlled runtime task replacement and restoration
232
+
233
+ ## Current Compatibility Notes
234
+
235
+ Assume current Runner reality, not old examples:
236
+
237
+ - Identity moved from `asyncContexts.tenant` to `asyncContexts.identity`; related middleware uses `identityScope`.
238
+ - Hook targets may come from selectors such as `subtreeOf(...)` or predicates, not only raw `hook.on`.
239
+ - Event Lane routing comes from `r.eventLane(...).applyTo([...])`, not old lane-tag assumptions.
240
+ - Runner supports `run(app, { signal })`, `run(app, { identity })`, and `runtime.dispose({ force: true })`.
241
+
242
+ ## AI Working Strategy
243
+
244
+ - Use the Runner skill for framework design or core Runner contracts.
245
+ - Use runner-dev context for tooling behavior, docs payloads, MCP, GraphQL, telemetry, and UI integration.
246
+ - Prefer focused tests first: `npm run test -- docs.data`, `npm run test -- mcp`, `npm run test -- live`, or another narrow suite near the touched surface.
247
+ - Use `pure: true` when validating swapped task behavior safely.
248
+ - Avoid huge live queries, broad schema dumps, or mutation access unless the task truly needs them.
249
+
250
+ ## Go Deeper
251
+
252
+ - Read `README.md` for installation, CLI, and broader examples.
253
+ - Read the Runner skill for framework-level architecture and contracts.
254
+ - Read source near the touched surface before broadening to unrelated subsystems.