@senpi/runtime 3.0.135 → 3.0.139

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 (293) hide show
  1. package/dist/actions/action-events.d.ts +7 -21
  2. package/dist/actions/action-events.d.ts.map +1 -1
  3. package/dist/actions/action-events.js +26 -54
  4. package/dist/actions/action-events.js.map +1 -1
  5. package/dist/actions/action-runtime-module.d.ts.map +1 -1
  6. package/dist/actions/action-runtime-module.js +7 -38
  7. package/dist/actions/action-runtime-module.js.map +1 -1
  8. package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
  9. package/dist/actions/close-position/close-position.action.js +15 -122
  10. package/dist/actions/close-position/close-position.action.js.map +1 -1
  11. package/dist/actions/decision-engine.d.ts.map +1 -1
  12. package/dist/actions/decision-engine.js +2 -15
  13. package/dist/actions/decision-engine.js.map +1 -1
  14. package/dist/actions/event-derivation.d.ts +2 -71
  15. package/dist/actions/event-derivation.d.ts.map +1 -1
  16. package/dist/actions/event-derivation.js +8 -251
  17. package/dist/actions/event-derivation.js.map +1 -1
  18. package/dist/actions/open-position/open-position.action.d.ts +2 -12
  19. package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
  20. package/dist/actions/open-position/open-position.action.js +41 -141
  21. package/dist/actions/open-position/open-position.action.js.map +1 -1
  22. package/dist/actions/position-tracker/position-tracker.action.d.ts +1 -2
  23. package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
  24. package/dist/actions/position-tracker/position-tracker.action.js +17 -62
  25. package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
  26. package/dist/actions/store/types.d.ts +2 -9
  27. package/dist/actions/store/types.d.ts.map +1 -1
  28. package/dist/actions/store/types.js.map +1 -1
  29. package/dist/actions/types.d.ts +0 -13
  30. package/dist/actions/types.d.ts.map +1 -1
  31. package/dist/actions/types.js +0 -13
  32. package/dist/actions/types.js.map +1 -1
  33. package/dist/cli/guide-commands.d.ts.map +1 -1
  34. package/dist/cli/guide-commands.js +7 -4
  35. package/dist/cli/guide-commands.js.map +1 -1
  36. package/dist/constants/dsl/index.d.ts +0 -6
  37. package/dist/constants/dsl/index.d.ts.map +1 -1
  38. package/dist/constants/dsl/index.js +0 -6
  39. package/dist/constants/dsl/index.js.map +1 -1
  40. package/dist/constants/telemetry.d.ts +15 -0
  41. package/dist/constants/telemetry.d.ts.map +1 -0
  42. package/dist/constants/telemetry.js +28 -0
  43. package/dist/constants/telemetry.js.map +1 -0
  44. package/dist/dsl/engine-client/event-mapping.d.ts.map +1 -1
  45. package/dist/dsl/engine-client/event-mapping.js +0 -14
  46. package/dist/dsl/engine-client/event-mapping.js.map +1 -1
  47. package/dist/dsl/events/build-closed-event.d.ts +1 -16
  48. package/dist/dsl/events/build-closed-event.d.ts.map +1 -1
  49. package/dist/dsl/events/build-closed-event.js +0 -6
  50. package/dist/dsl/events/build-closed-event.js.map +1 -1
  51. package/dist/dsl/events/handlers.d.ts +0 -7
  52. package/dist/dsl/events/handlers.d.ts.map +1 -1
  53. package/dist/dsl/events/handlers.js +7 -37
  54. package/dist/dsl/events/handlers.js.map +1 -1
  55. package/dist/dsl/monitor/create-monitor.d.ts +2 -6
  56. package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
  57. package/dist/dsl/monitor/create-monitor.js +9 -82
  58. package/dist/dsl/monitor/create-monitor.js.map +1 -1
  59. package/dist/dsl/monitor/dsl-failure-events.d.ts +2 -45
  60. package/dist/dsl/monitor/dsl-failure-events.d.ts.map +1 -1
  61. package/dist/dsl/monitor/dsl-failure-events.js +3 -52
  62. package/dist/dsl/monitor/dsl-failure-events.js.map +1 -1
  63. package/dist/dsl/monitor/process-one-position.d.ts +0 -1
  64. package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
  65. package/dist/dsl/monitor/process-one-position.js +36 -159
  66. package/dist/dsl/monitor/process-one-position.js.map +1 -1
  67. package/dist/dsl/plugin/index.d.ts +2 -8
  68. package/dist/dsl/plugin/index.d.ts.map +1 -1
  69. package/dist/dsl/plugin/index.js +8 -20
  70. package/dist/dsl/plugin/index.js.map +1 -1
  71. package/dist/health/types.d.ts +0 -13
  72. package/dist/health/types.d.ts.map +1 -1
  73. package/dist/health/types.js +0 -12
  74. package/dist/health/types.js.map +1 -1
  75. package/dist/index.d.ts +8 -27
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +105 -272
  78. package/dist/index.js.map +1 -1
  79. package/dist/runtime/action-registry.d.ts.map +1 -1
  80. package/dist/runtime/action-registry.js +3 -4
  81. package/dist/runtime/action-registry.js.map +1 -1
  82. package/dist/runtime/domain-events.d.ts.map +1 -1
  83. package/dist/runtime/domain-events.js +0 -7
  84. package/dist/runtime/domain-events.js.map +1 -1
  85. package/dist/runtime/events-telemetry.d.ts +96 -0
  86. package/dist/runtime/events-telemetry.d.ts.map +1 -0
  87. package/dist/runtime/events-telemetry.js +232 -0
  88. package/dist/runtime/events-telemetry.js.map +1 -0
  89. package/dist/runtime/lifecycle-events.d.ts +3 -15
  90. package/dist/runtime/lifecycle-events.d.ts.map +1 -1
  91. package/dist/runtime/lifecycle-events.js +3 -17
  92. package/dist/runtime/lifecycle-events.js.map +1 -1
  93. package/dist/runtime/lifecycle-reaper.d.ts +6 -4
  94. package/dist/runtime/lifecycle-reaper.d.ts.map +1 -1
  95. package/dist/runtime/lifecycle-reaper.js +6 -4
  96. package/dist/runtime/lifecycle-reaper.js.map +1 -1
  97. package/dist/runtime/reconcile-run.d.ts +3 -13
  98. package/dist/runtime/reconcile-run.d.ts.map +1 -1
  99. package/dist/runtime/reconcile-run.js +3 -4
  100. package/dist/runtime/reconcile-run.js.map +1 -1
  101. package/dist/runtime/reconcile-state.d.ts +0 -8
  102. package/dist/runtime/reconcile-state.d.ts.map +1 -1
  103. package/dist/runtime/reconcile-state.js +1 -4
  104. package/dist/runtime/reconcile-state.js.map +1 -1
  105. package/dist/runtime/risk-guard.d.ts +20 -1
  106. package/dist/runtime/risk-guard.d.ts.map +1 -1
  107. package/dist/runtime/risk-guard.js +47 -6
  108. package/dist/runtime/risk-guard.js.map +1 -1
  109. package/dist/runtime/run.d.ts +7 -1
  110. package/dist/runtime/run.d.ts.map +1 -1
  111. package/dist/runtime/run.js +7 -0
  112. package/dist/runtime/run.js.map +1 -1
  113. package/dist/runtime/runtime-schema.js +3 -3
  114. package/dist/runtime/runtime-schema.js.map +1 -1
  115. package/dist/runtime/runtime.d.ts +22 -2
  116. package/dist/runtime/runtime.d.ts.map +1 -1
  117. package/dist/runtime/runtime.js +74 -39
  118. package/dist/runtime/runtime.js.map +1 -1
  119. package/dist/runtime/strategies-store.d.ts +26 -0
  120. package/dist/runtime/strategies-store.d.ts.map +1 -0
  121. package/dist/runtime/strategies-store.js +47 -0
  122. package/dist/runtime/strategies-store.js.map +1 -0
  123. package/dist/runtime/strategies-telemetry.d.ts +91 -0
  124. package/dist/runtime/strategies-telemetry.d.ts.map +1 -0
  125. package/dist/runtime/strategies-telemetry.js +128 -0
  126. package/dist/runtime/strategies-telemetry.js.map +1 -0
  127. package/dist/runtime/strategy-lifecycle.d.ts +108 -2
  128. package/dist/runtime/strategy-lifecycle.d.ts.map +1 -1
  129. package/dist/runtime/strategy-lifecycle.js +325 -4
  130. package/dist/runtime/strategy-lifecycle.js.map +1 -1
  131. package/dist/runtime/supervisor/long-running-supervisor.d.ts +0 -13
  132. package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -1
  133. package/dist/runtime/supervisor/long-running-supervisor.js +0 -1
  134. package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -1
  135. package/dist/runtime/validate-dsl-position-tracking.d.ts.map +1 -1
  136. package/dist/runtime/validate-dsl-position-tracking.js +1 -2
  137. package/dist/runtime/validate-dsl-position-tracking.js.map +1 -1
  138. package/dist/runtime-api/handlers/ingest-signals.d.ts.map +1 -1
  139. package/dist/runtime-api/handlers/ingest-signals.js +0 -1
  140. package/dist/runtime-api/handlers/ingest-signals.js.map +1 -1
  141. package/dist/runtime-api/handlers/types.d.ts +0 -5
  142. package/dist/runtime-api/handlers/types.d.ts.map +1 -1
  143. package/dist/runtime-api/intake/intake-events.d.ts +1 -1
  144. package/dist/runtime-api/intake/intake-events.d.ts.map +1 -1
  145. package/dist/runtime-api/intake/intake-events.js +3 -9
  146. package/dist/runtime-api/intake/intake-events.js.map +1 -1
  147. package/dist/runtime-api/intake/intake-mount.d.ts +2 -0
  148. package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
  149. package/dist/runtime-api/intake/intake-mount.js +25 -7
  150. package/dist/runtime-api/intake/intake-mount.js.map +1 -1
  151. package/dist/runtime-api/intake/process-error-post.d.ts +1 -6
  152. package/dist/runtime-api/intake/process-error-post.d.ts.map +1 -1
  153. package/dist/runtime-api/intake/process-error-post.js +1 -5
  154. package/dist/runtime-api/intake/process-error-post.js.map +1 -1
  155. package/dist/runtime-api/intake/process-signal-post.d.ts +1 -7
  156. package/dist/runtime-api/intake/process-signal-post.d.ts.map +1 -1
  157. package/dist/runtime-api/intake/process-signal-post.js +0 -5
  158. package/dist/runtime-api/intake/process-signal-post.js.map +1 -1
  159. package/dist/runtime-api/intake/scaffold-error-router.js.map +1 -1
  160. package/dist/runtime-api/intake/scanner-launcher.d.ts.map +1 -1
  161. package/dist/runtime-api/intake/scanner-launcher.js +0 -15
  162. package/dist/runtime-api/intake/scanner-launcher.js.map +1 -1
  163. package/dist/runtime-api/intake/types.d.ts +0 -55
  164. package/dist/runtime-api/intake/types.d.ts.map +1 -1
  165. package/dist/runtime-api/routes/signals.d.ts +0 -2
  166. package/dist/runtime-api/routes/signals.d.ts.map +1 -1
  167. package/dist/runtime-api/routes/signals.js +11 -5
  168. package/dist/runtime-api/routes/signals.js.map +1 -1
  169. package/dist/runtime-api/routes/signals.schema.d.ts +0 -43
  170. package/dist/runtime-api/routes/signals.schema.d.ts.map +1 -1
  171. package/dist/runtime-api/routes/signals.schema.js +0 -43
  172. package/dist/runtime-api/routes/signals.schema.js.map +1 -1
  173. package/dist/runtime-api/server.d.ts +1 -7
  174. package/dist/runtime-api/server.d.ts.map +1 -1
  175. package/dist/runtime-api/server.js +0 -1
  176. package/dist/runtime-api/server.js.map +1 -1
  177. package/dist/scanners/engine/engine.d.ts +1 -22
  178. package/dist/scanners/engine/engine.d.ts.map +1 -1
  179. package/dist/scanners/engine/engine.js +11 -78
  180. package/dist/scanners/engine/engine.js.map +1 -1
  181. package/dist/scanners/engine/lifecycle.d.ts +1 -7
  182. package/dist/scanners/engine/lifecycle.d.ts.map +1 -1
  183. package/dist/scanners/events.d.ts +0 -4
  184. package/dist/scanners/events.d.ts.map +1 -1
  185. package/dist/scanners/events.js +0 -2
  186. package/dist/scanners/events.js.map +1 -1
  187. package/dist/scanners/external/scaffold/delivery.py +25 -194
  188. package/dist/scanners/external/scaffold/scaffold.py +31 -172
  189. package/dist/scanners/external/scaffold/senpi_mcp.py +8 -150
  190. package/dist/scanners/external-scanner-receiver.d.ts +0 -17
  191. package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
  192. package/dist/scanners/external-scanner-receiver.js +0 -8
  193. package/dist/scanners/external-scanner-receiver.js.map +1 -1
  194. package/dist/scanners/runtime-module.d.ts +0 -1
  195. package/dist/scanners/runtime-module.d.ts.map +1 -1
  196. package/dist/scanners/runtime-module.js +9 -66
  197. package/dist/scanners/runtime-module.js.map +1 -1
  198. package/dist/state/state-manager.d.ts +2 -0
  199. package/dist/state/state-manager.d.ts.map +1 -1
  200. package/dist/state/state-manager.js +8 -0
  201. package/dist/state/state-manager.js.map +1 -1
  202. package/dist/telemetry/attributes.d.ts +0 -20
  203. package/dist/telemetry/attributes.d.ts.map +1 -1
  204. package/dist/telemetry/attributes.js +0 -24
  205. package/dist/telemetry/attributes.js.map +1 -1
  206. package/dist/telemetry/event-builders.d.ts +6 -81
  207. package/dist/telemetry/event-builders.d.ts.map +1 -1
  208. package/dist/telemetry/event-builders.js +17 -141
  209. package/dist/telemetry/event-builders.js.map +1 -1
  210. package/dist/telemetry/event-store.d.ts.map +1 -1
  211. package/dist/telemetry/event-store.js +2 -6
  212. package/dist/telemetry/event-store.js.map +1 -1
  213. package/dist/telemetry/metrics.d.ts +2 -14
  214. package/dist/telemetry/metrics.d.ts.map +1 -1
  215. package/dist/telemetry/metrics.js +4 -19
  216. package/dist/telemetry/metrics.js.map +1 -1
  217. package/dist/telemetry/spans/redact-pii.d.ts.map +1 -1
  218. package/dist/telemetry/spans/redact-pii.js +11 -16
  219. package/dist/telemetry/spans/redact-pii.js.map +1 -1
  220. package/dist/telemetry/tracing.d.ts +0 -9
  221. package/dist/telemetry/tracing.d.ts.map +1 -1
  222. package/dist/telemetry/tracing.js +0 -36
  223. package/dist/telemetry/tracing.js.map +1 -1
  224. package/dist/types/dsl/index.d.ts +0 -48
  225. package/dist/types/dsl/index.d.ts.map +1 -1
  226. package/dist/types/scanner.d.ts +0 -15
  227. package/dist/types/scanner.d.ts.map +1 -1
  228. package/dist/utils/event-catalog.d.ts +0 -202
  229. package/dist/utils/event-catalog.d.ts.map +1 -1
  230. package/dist/utils/event-catalog.js +0 -26
  231. package/dist/utils/event-catalog.js.map +1 -1
  232. package/dist/utils/logger.d.ts +1 -4
  233. package/dist/utils/logger.d.ts.map +1 -1
  234. package/dist/utils/logger.js.map +1 -1
  235. package/dist/validate/recipe-checks.d.ts.map +1 -1
  236. package/dist/validate/recipe-checks.js +2 -2
  237. package/dist/validate/recipe-checks.js.map +1 -1
  238. package/openclaw.plugin.json +1 -1
  239. package/package.json +1 -1
  240. package/dist/actions/skipped-signal-results.d.ts +0 -25
  241. package/dist/actions/skipped-signal-results.d.ts.map +0 -1
  242. package/dist/actions/skipped-signal-results.js +0 -71
  243. package/dist/actions/skipped-signal-results.js.map +0 -1
  244. package/dist/runtime-api/intake/ingest-request.d.ts +0 -17
  245. package/dist/runtime-api/intake/ingest-request.d.ts.map +0 -1
  246. package/dist/runtime-api/intake/ingest-request.js +0 -34
  247. package/dist/runtime-api/intake/ingest-request.js.map +0 -1
  248. package/dist/runtime-api/intake/scaffold-tick-router.d.ts +0 -39
  249. package/dist/runtime-api/intake/scaffold-tick-router.d.ts.map +0 -1
  250. package/dist/runtime-api/intake/scaffold-tick-router.js +0 -122
  251. package/dist/runtime-api/intake/scaffold-tick-router.js.map +0 -1
  252. package/dist/scanners/external/scaffold/tick_facts.py +0 -130
  253. package/dist/scanners/external/scaffold/ulid.py +0 -58
  254. package/dist/telemetry/dsl-positions.d.ts +0 -111
  255. package/dist/telemetry/dsl-positions.d.ts.map +0 -1
  256. package/dist/telemetry/dsl-positions.js +0 -118
  257. package/dist/telemetry/dsl-positions.js.map +0 -1
  258. package/dist/telemetry/live-telemetry.d.ts +0 -257
  259. package/dist/telemetry/live-telemetry.d.ts.map +0 -1
  260. package/dist/telemetry/live-telemetry.js +0 -959
  261. package/dist/telemetry/live-telemetry.js.map +0 -1
  262. package/dist/telemetry/scanner-stats.d.ts +0 -143
  263. package/dist/telemetry/scanner-stats.d.ts.map +0 -1
  264. package/dist/telemetry/scanner-stats.js +0 -426
  265. package/dist/telemetry/scanner-stats.js.map +0 -1
  266. package/dist/telemetry/scanner-tick-feed.d.ts +0 -87
  267. package/dist/telemetry/scanner-tick-feed.d.ts.map +0 -1
  268. package/dist/telemetry/scanner-tick-feed.js +0 -48
  269. package/dist/telemetry/scanner-tick-feed.js.map +0 -1
  270. package/dist/telemetry/strategy-topology.d.ts +0 -99
  271. package/dist/telemetry/strategy-topology.d.ts.map +0 -1
  272. package/dist/telemetry/strategy-topology.js +0 -93
  273. package/dist/telemetry/strategy-topology.js.map +0 -1
  274. package/dist/telemetry/telemetry-publisher.d.ts +0 -83
  275. package/dist/telemetry/telemetry-publisher.d.ts.map +0 -1
  276. package/dist/telemetry/telemetry-publisher.js +0 -256
  277. package/dist/telemetry/telemetry-publisher.js.map +0 -1
  278. package/dist/telemetry/tick-frame.d.ts +0 -212
  279. package/dist/telemetry/tick-frame.d.ts.map +0 -1
  280. package/dist/telemetry/tick-frame.js +0 -421
  281. package/dist/telemetry/tick-frame.js.map +0 -1
  282. package/dist/telemetry/timeline-buffer.d.ts +0 -95
  283. package/dist/telemetry/timeline-buffer.d.ts.map +0 -1
  284. package/dist/telemetry/timeline-buffer.js +0 -237
  285. package/dist/telemetry/timeline-buffer.js.map +0 -1
  286. package/dist/utils/telemetry-required-log.d.ts +0 -60
  287. package/dist/utils/telemetry-required-log.d.ts.map +0 -1
  288. package/dist/utils/telemetry-required-log.js +0 -105
  289. package/dist/utils/telemetry-required-log.js.map +0 -1
  290. package/dist/utils/ulid.d.ts +0 -9
  291. package/dist/utils/ulid.d.ts.map +0 -1
  292. package/dist/utils/ulid.js +0 -43
  293. package/dist/utils/ulid.js.map +0 -1
@@ -1,87 +0,0 @@
1
- /**
2
- * The seam between a finished scanner run and the live-telemetry publisher.
3
- *
4
- * The scanner runtime module is built per strategy, deep inside a runtime, and the publisher is one
5
- * object created once per plugin process. Neither holds a handle to the other, so the connection is a
6
- * process-global sink — the same shape the timeline buffer and the domain-event sinks already use.
7
- *
8
- * What travels over it is a LEVEL, not a record: the most recent state of a scanner, published so a
9
- * dashboard can show that a quiet box is alive. It is deliberately not routed through
10
- * `logger.event` — see {@link ../utils/telemetry-required-log.js} — because every event also reaches
11
- * `appendDomainEvent`, whose on-disk ring and bounded publisher buffer hold real decision records that
12
- * a per-tick fact would evict. Nothing here writes to either.
13
- *
14
- * Two properties this module exists to guarantee:
15
- * - With no sink registered the call is one comparison and a return. A box whose telemetry never
16
- * started pays nothing per scan, and nothing is built at the call site either: the run object the
17
- * terminal callback already holds is passed straight through.
18
- * - A sink that throws is swallowed. This runs inside the scanner's terminal callback, and a failure
19
- * in telemetry cannot be allowed to break a scan.
20
- */
21
- import type { TickCall, TickCommitOutcome } from "./tick-frame.js";
22
- /**
23
- * What a producer outside this process reports about its own tick, on top of what the run itself
24
- * says. An internal scanner supplies none of it; a supervised external scanner supplies what its
25
- * scaffold measured, carried in over the intake POST that scanner already makes every tick.
26
- *
27
- * Every field is optional and ABSENT means UNKNOWN. None may be defaulted to zero anywhere on the
28
- * way to the wire: "made no MCP calls" and "did not say" are different facts about a scanner.
29
- */
30
- export interface ScannerTickExtras {
31
- /** MCP failures the author's own `except` caught and did not re-raise. */
32
- mcpFailures?: number;
33
- /** Every MCP call the tick made, succeeded or failed, as the boundary timed it. */
34
- mcpCalls?: readonly TickCall[];
35
- /** Total time inside MCP this tick. */
36
- mcpMs?: number;
37
- /** Consecutive ticks, this one included, that produced no signal. */
38
- quietTicks?: number;
39
- /** Actual gap since the previous tick minus the configured interval. */
40
- lagMs?: number;
41
- /** Signals from earlier ticks still awaiting delivery in the producer's journal. */
42
- journalPending?: number;
43
- /** How the tick's state commit ended. `committed` is the normal case and is not published. */
44
- commit?: TickCommitOutcome;
45
- /** The last COMMITTED state row — stale by one tick whenever the current tick failed. */
46
- state?: Readonly<Record<string, unknown>>;
47
- /** Fields in that row before sanitising, so the drop stays countable. */
48
- stateFieldCount?: number;
49
- /** Fields in that row whose value moved since the previously reported row. */
50
- stateChangedCount?: number;
51
- }
52
- /**
53
- * The subset of a finished run a tick carries. Structural on purpose, so the engine's own `ScanResult`
54
- * satisfies it without conversion and this module needs no import from the scanner subsystem.
55
- */
56
- export interface ScannerRunFacts {
57
- address: string;
58
- scannerId: string;
59
- /** Run status as the terminal callback reports it — the same value the required log calls `outcome`. */
60
- status: string;
61
- /** The run's own signals. Absent for a producer that reports a count and holds no array. */
62
- signals?: readonly unknown[];
63
- /** Signals produced, when the producer counts them rather than handing them over. */
64
- signalCount?: number;
65
- /** Candidates evaluated. Absent on a run that never evaluated any; never zero as a stand-in. */
66
- scannedCount?: number;
67
- /** What the producer measured about the tick itself. Absent for an in-process scanner. */
68
- tick?: ScannerTickExtras;
69
- }
70
- /**
71
- * `startedAt` is the run's own start and is absent for a run that never began, in which case no
72
- * duration may be claimed for it. `finishedAt` is the module clock at the terminal callback.
73
- */
74
- export type ScannerTickSink = (run: ScannerRunFacts, startedAt: number | undefined, finishedAt: number) => void;
75
- /**
76
- * Whether anything is listening.
77
- *
78
- * For a caller that has to BUILD the run before it can hand it over — the intake routes, which
79
- * translate a producer's wire facts — so an unwatched box allocates nothing per tick instead of
80
- * building an object for a sink that is null.
81
- */
82
- export declare function hasScannerTickSink(): boolean;
83
- /** Arm or release the process sink. The publisher arms it on start and releases it on stop. */
84
- export declare function setScannerTickSink(next: ScannerTickSink | null): void;
85
- /** Hand one finished run to the publisher, if one is listening. Never throws. */
86
- export declare function recordScannerTick(run: ScannerRunFacts, startedAt: number | undefined, finishedAt: number): void;
87
- //# sourceMappingURL=scanner-tick-feed.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scanner-tick-feed.d.ts","sourceRoot":"","sources":["../../src/telemetry/scanner-tick-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEnE;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC/B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,yFAAyF;IACzF,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,wGAAwG;IACxG,MAAM,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,OAAO,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0FAA0F;IAC1F,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,GAAG,EAAE,eAAe,EACpB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,KACf,IAAI,CAAC;AAIV;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI,CAErE;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,MAAM,GACjB,IAAI,CAQN"}
@@ -1,48 +0,0 @@
1
- /**
2
- * The seam between a finished scanner run and the live-telemetry publisher.
3
- *
4
- * The scanner runtime module is built per strategy, deep inside a runtime, and the publisher is one
5
- * object created once per plugin process. Neither holds a handle to the other, so the connection is a
6
- * process-global sink — the same shape the timeline buffer and the domain-event sinks already use.
7
- *
8
- * What travels over it is a LEVEL, not a record: the most recent state of a scanner, published so a
9
- * dashboard can show that a quiet box is alive. It is deliberately not routed through
10
- * `logger.event` — see {@link ../utils/telemetry-required-log.js} — because every event also reaches
11
- * `appendDomainEvent`, whose on-disk ring and bounded publisher buffer hold real decision records that
12
- * a per-tick fact would evict. Nothing here writes to either.
13
- *
14
- * Two properties this module exists to guarantee:
15
- * - With no sink registered the call is one comparison and a return. A box whose telemetry never
16
- * started pays nothing per scan, and nothing is built at the call site either: the run object the
17
- * terminal callback already holds is passed straight through.
18
- * - A sink that throws is swallowed. This runs inside the scanner's terminal callback, and a failure
19
- * in telemetry cannot be allowed to break a scan.
20
- */
21
- let sink = null;
22
- /**
23
- * Whether anything is listening.
24
- *
25
- * For a caller that has to BUILD the run before it can hand it over — the intake routes, which
26
- * translate a producer's wire facts — so an unwatched box allocates nothing per tick instead of
27
- * building an object for a sink that is null.
28
- */
29
- export function hasScannerTickSink() {
30
- return sink !== null;
31
- }
32
- /** Arm or release the process sink. The publisher arms it on start and releases it on stop. */
33
- export function setScannerTickSink(next) {
34
- sink = next;
35
- }
36
- /** Hand one finished run to the publisher, if one is listening. Never throws. */
37
- export function recordScannerTick(run, startedAt, finishedAt) {
38
- const current = sink;
39
- if (current === null)
40
- return;
41
- try {
42
- current(run, startedAt, finishedAt);
43
- }
44
- catch {
45
- // A telemetry-side failure must never disturb the scan that produced the tick.
46
- }
47
- }
48
- //# sourceMappingURL=scanner-tick-feed.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scanner-tick-feed.js","sourceRoot":"","sources":["../../src/telemetry/scanner-tick-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAgEH,IAAI,IAAI,GAA2B,IAAI,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,IAAI,KAAK,IAAI,CAAC;AACvB,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,kBAAkB,CAAC,IAA4B;IAC7D,IAAI,GAAG,IAAI,CAAC;AACd,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,iBAAiB,CAC/B,GAAoB,EACpB,SAA6B,EAC7B,UAAkB;IAElB,MAAM,OAAO,GAAG,IAAI,CAAC;IACrB,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO;IAC7B,IAAI,CAAC;QACH,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,+EAA+E;IACjF,CAAC;AACH,CAAC"}
@@ -1,99 +0,0 @@
1
- /**
2
- * Builder for the `plugin.senpi.strategies` payload — the topology view of the live telemetry
3
- * stream: which strategies exist, whether each is up, how healthy it is, and which scanners it
4
- * declares.
5
- *
6
- * Pure. Every fact arrives as an input, nothing is read from the registry or a runtime handle here,
7
- * so the shape on the wire is testable without booting a runtime.
8
- *
9
- * Two properties this module exists to hold:
10
- * - `status` distinguishes a runtime that is down from one that is up but has no live entry
11
- * scanners. The second reads as healthy unless it is named, and it is not.
12
- * - The raw scanner `config` never reaches the wire. It is an unbounded passthrough record and it
13
- * has been through `resolveEnvInObject`, so it may hold resolved secrets. Only the declared,
14
- * typed fields below are copied, each by name.
15
- */
16
- import type { ComponentHealth } from "../health/types.js";
17
- import type { RuntimeScanner } from "../runtime/runtime-schema.js";
18
- /** Payload schema version. Bump when a field changes meaning, not when one is added. */
19
- export declare const STRATEGY_TOPOLOGY_VERSION = 1;
20
- /**
21
- * `stopped` — no runtime handle.
22
- * `running_no_entry_scanners` — up, but its declared external scanners never wired, so it produces
23
- * no entry signals.
24
- * `running` — up and wired.
25
- */
26
- export type StrategyStatus = "running" | "stopped" | "running_no_entry_scanners";
27
- /** Membership test satisfied by both a `Map` and a `Set` — the two shapes the plugin holds. */
28
- export interface IdMembership {
29
- has(id: string): boolean;
30
- }
31
- /** Engine registration facts for one scanner. Absent when the runtime has no live handle. */
32
- export interface TopologyScannerRegistration {
33
- enabled: boolean;
34
- scheduleMode: "interval" | "external";
35
- intervalSeconds: number | null;
36
- configVersion: number | null;
37
- }
38
- export interface TopologyScannerSource {
39
- /**
40
- * The parsed YAML scanner entry. Only `name`, `type`, `interval_seconds` and
41
- * `signal_data_schema` are ever read from it — `config`, `advanced`, `inputs` and any
42
- * passthrough key stay off the wire.
43
- */
44
- entry: RuntimeScanner;
45
- registration?: TopologyScannerRegistration;
46
- }
47
- export interface TopologyStrategySource {
48
- runtimeId: string;
49
- /** The config wallet as written. Normalized to the wire form by the builder — see below. */
50
- address: string;
51
- name: string;
52
- scanners: TopologyScannerSource[];
53
- }
54
- /** The slice of `RuntimeHealthStatus` the topology reads. `startedAt` is ISO, as health emits it. */
55
- export interface RuntimeHealthLike {
56
- health: ComponentHealth;
57
- startedAt?: string;
58
- }
59
- export interface BuildStrategyTopologyInput {
60
- /** The buffer's epoch ULID. A change means the plugin restarted. */
61
- epoch: string;
62
- strategies: TopologyStrategySource[];
63
- /** Runtimes holding a live handle. Everything else is stopped. */
64
- runningRuntimeIds: IdMembership;
65
- /** Runtimes that are up but whose entry scanners never wired. */
66
- unwiredRuntimeIds: IdMembership;
67
- /** Per-runtime health lookup, keyed on `runtimeId` the way `senpi.getHealthStatus` keys. */
68
- readHealth?: (runtimeId: string) => RuntimeHealthLike | undefined;
69
- /** Injectable clock for deterministic tests. */
70
- now?: () => number;
71
- }
72
- export interface StrategyTopologyScanner {
73
- /** The engine id — the YAML `name:` field. Unique within a runtime, not across runtimes. */
74
- scannerId: string;
75
- scheduleMode: "interval" | "external";
76
- enabled: boolean;
77
- intervalSeconds: number | null;
78
- configVersion: number | null;
79
- signalDataSchema: Record<string, unknown> | null;
80
- }
81
- export interface StrategyTopologyEntry {
82
- runtimeId: string;
83
- address: string;
84
- name: string;
85
- status: StrategyStatus;
86
- health: ComponentHealth;
87
- /** Epoch ms, converted from health's ISO stamp; null when health is unavailable. */
88
- startedAt: number | null;
89
- scanners: StrategyTopologyScanner[];
90
- }
91
- export interface StrategyTopologyPayload {
92
- v: number;
93
- epoch: string;
94
- generatedAt: number;
95
- strategies: StrategyTopologyEntry[];
96
- }
97
- /** Builds one `plugin.senpi.strategies` payload from an already-gathered set of facts. */
98
- export declare function buildStrategyTopology(input: BuildStrategyTopologyInput): StrategyTopologyPayload;
99
- //# sourceMappingURL=strategy-topology.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-topology.d.ts","sourceRoot":"","sources":["../../src/telemetry/strategy-topology.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInE,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,2BAA2B,CAAC;AAEjF,+FAA+F;AAC/F,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,6FAA6F;AAC7F,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,UAAU,GAAG,UAAU,CAAC;IACtC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB,YAAY,CAAC,EAAE,2BAA2B,CAAC;CAC5C;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,4FAA4F;IAC5F,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,qBAAqB,EAAE,CAAC;CACnC;AAED,qGAAqG;AACrG,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,sBAAsB,EAAE,CAAC;IACrC,kEAAkE;IAClE,iBAAiB,EAAE,YAAY,CAAC;IAChC,iEAAiE;IACjE,iBAAiB,EAAE,YAAY,CAAC;IAChC,4FAA4F;IAC5F,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,iBAAiB,GAAG,SAAS,CAAC;IAClE,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,4FAA4F;IAC5F,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,UAAU,GAAG,UAAU,CAAC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;IACxB,oFAAoF;IACpF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,uBAAuB,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACtC,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,qBAAqB,EAAE,CAAC;CACrC;AAwDD,0FAA0F;AAC1F,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,0BAA0B,GAChC,uBAAuB,CAwBzB"}
@@ -1,93 +0,0 @@
1
- /**
2
- * Builder for the `plugin.senpi.strategies` payload — the topology view of the live telemetry
3
- * stream: which strategies exist, whether each is up, how healthy it is, and which scanners it
4
- * declares.
5
- *
6
- * Pure. Every fact arrives as an input, nothing is read from the registry or a runtime handle here,
7
- * so the shape on the wire is testable without booting a runtime.
8
- *
9
- * Two properties this module exists to hold:
10
- * - `status` distinguishes a runtime that is down from one that is up but has no live entry
11
- * scanners. The second reads as healthy unless it is named, and it is not.
12
- * - The raw scanner `config` never reaches the wire. It is an unbounded passthrough record and it
13
- * has been through `resolveEnvInObject`, so it may hold resolved secrets. Only the declared,
14
- * typed fields below are copied, each by name.
15
- */
16
- import { createLogger } from "../utils/logger.js";
17
- import { normalizeStrategyAddress } from "./event-store.js";
18
- const logger = createLogger("[senpi-core][strategy-topology]");
19
- /** Payload schema version. Bump when a field changes meaning, not when one is added. */
20
- export const STRATEGY_TOPOLOGY_VERSION = 1;
21
- /**
22
- * Mirrors the three-way distinction `senpi.listRuntimes` draws: no handle is stopped, a handle in
23
- * the unwired set is running blind, anything else is running. The wire carries the machine token —
24
- * the operator-facing string is the frontend's to choose.
25
- */
26
- function resolveStatus(runtimeId, running, unwired) {
27
- if (!running.has(runtimeId))
28
- return "stopped";
29
- return unwired.has(runtimeId) ? "running_no_entry_scanners" : "running";
30
- }
31
- /** Health is advisory here: a lookup that fails must degrade the row, never the payload. */
32
- function resolveHealth(runtimeId, readHealth) {
33
- let status;
34
- try {
35
- status = readHealth?.(runtimeId);
36
- }
37
- catch (err) {
38
- logger.warn("strategy topology could not read runtime health; reporting unknown", err, {
39
- runtimeId,
40
- });
41
- return { health: "unknown", startedAt: null };
42
- }
43
- if (!status)
44
- return { health: "unknown", startedAt: null };
45
- const parsed = status.startedAt === undefined ? NaN : Date.parse(status.startedAt);
46
- return {
47
- health: status.health,
48
- startedAt: Number.isFinite(parsed) ? parsed : null,
49
- };
50
- }
51
- /**
52
- * Copies the declared scanner fields one by one. Never spread `entry` and never copy `config` —
53
- * see the module note.
54
- */
55
- function buildScanner(source) {
56
- const { entry, registration } = source;
57
- const declaredSchema = entry.signal_data_schema;
58
- return {
59
- scannerId: entry.name,
60
- scheduleMode: registration?.scheduleMode ?? (entry.type === "external_scanner" ? "external" : "interval"),
61
- enabled: registration?.enabled ?? true,
62
- intervalSeconds: registration?.intervalSeconds ?? entry.interval_seconds ?? null,
63
- configVersion: registration?.configVersion ?? null,
64
- signalDataSchema: declaredSchema ?? null,
65
- };
66
- }
67
- /** Builds one `plugin.senpi.strategies` payload from an already-gathered set of facts. */
68
- export function buildStrategyTopology(input) {
69
- const now = input.now ?? Date.now;
70
- const strategies = input.strategies.map((source) => {
71
- const { health, startedAt } = resolveHealth(source.runtimeId, input.readHealth);
72
- return {
73
- runtimeId: source.runtimeId,
74
- // `(address, scannerId)` is the join key across all four payloads, and the other three
75
- // normalize their own address input. A checksummed EIP-55 wallet reaching the wire raw would
76
- // spell this strategy differently from its own scanner rows and timeline rows, and nothing
77
- // downstream rejects that — the join just returns nothing.
78
- address: normalizeStrategyAddress(source.address),
79
- name: source.name,
80
- status: resolveStatus(source.runtimeId, input.runningRuntimeIds, input.unwiredRuntimeIds),
81
- health,
82
- startedAt,
83
- scanners: source.scanners.map(buildScanner),
84
- };
85
- });
86
- return {
87
- v: STRATEGY_TOPOLOGY_VERSION,
88
- epoch: input.epoch,
89
- generatedAt: now(),
90
- strategies,
91
- };
92
- }
93
- //# sourceMappingURL=strategy-topology.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strategy-topology.js","sourceRoot":"","sources":["../../src/telemetry/strategy-topology.ts"],"names":[],"mappings":"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"}
@@ -1,83 +0,0 @@
1
- /**
2
- * The producer tap for the live telemetry stream: a second {@link EventSink} that copies selected
3
- * `logger.event` records into the in-memory {@link TimelineBuffer} while the on-disk ring keeps
4
- * receiving every one of them. It sits on the serial trading path, so it resolves the scanner id,
5
- * picks a fixed set of fields, appends, and returns — no I/O, no await, no counting, no serialization.
6
- *
7
- * Two lists govern the stream, and this module owns only the first:
8
- * - ADMISSION ({@link ADMITTED_EVENT_NAMES}) — what enters the buffer. Every name the timeline
9
- * displays PLUS every name a counter is derived from, because a counting source that never enters
10
- * the buffer makes the stats read zero with nothing logged anywhere.
11
- * - PUBLICATION — what leaves on the timeline event. Applied at flush time, not here. Admission is
12
- * deliberately the wider of the two: filtering for display at append time is unrecoverable.
13
- */
14
- import { type EventName } from "../utils/event-catalog.js";
15
- import { type EventSink } from "./event-store.js";
16
- import { type TimelineBuffer } from "./timeline-buffer.js";
17
- /**
18
- * The names that may enter the buffer. Volume control for a bounded ring, so it is an allow-list of
19
- * the strategy's own narrative: what its scanners did, what each signal became, what was traded, how
20
- * the exit engine defended an open position, and why the strategy's status changed. It excludes the
21
- * box-operations and agent-plane families — `auto_update.*`, `tool.*`, `tool_approval.*`, the
22
- * installer and the state/mcp faults — which describe the box the strategy runs on, not the
23
- * strategy.
24
- *
25
- * The whole `dsl.*` family is admitted, the four records of the engine acting on money included: a
26
- * stop that moved, a close it is waiting on, the attempt that performs the close, and a position it
27
- * can no longer price. None of them is poll-frequency. A `dsl.sl_updated` follows a venue write that
28
- * `shouldSyncExchangeSl` allowed — a stop that is missing, a sync retrying, a phase or tier change,
29
- * or a floor that moved further than `slSyncMinDeltaForPrice` — and a position the backend owns
30
- * emits none at all. `dsl.price_fetch_stale` is latched on the position state and re-armed only when
31
- * a price returns, so a stall costs one record rather than one per failed poll, and the close pair
32
- * fires once in a position's life. Against a ring holding `DEFAULT_MAX_RECORDS_PER_ADDRESS` records
33
- * per address over a window measured in minutes, that volume evicts nothing — and a reader watching
34
- * a trade has to be able to see the stop move.
35
- *
36
- * `dsl.tick_aborted` and `dsl.tick_recovered` are the widest of the family and the cheapest: a tick
37
- * that aborts at the clearinghouse gate evaluates NO position on the box, and the per-position
38
- * counters that `dsl.price_fetch_stale` is derived from sit past that gate, so without this pair the
39
- * largest blind spot in the engine reaches the ring as nothing at all. Both are latched on the
40
- * monitor and re-armed only by a completed tick, so an outage of any length costs exactly two
41
- * records — a floor under the pair's volume that no poll frequency can lift.
42
- *
43
- * `dsl.close_attempt` has no `logger.event` behind it: it is a span the monitor opens around the
44
- * venue call, so admitting the name reserves it rather than adding records.
45
- *
46
- * Typed as `EventName`, so renaming a catalog entry out from under this list is a compile error
47
- * rather than a silently empty counter.
48
- */
49
- export declare const ADMITTED_EVENT_NAMES: ReadonlySet<EventName>;
50
- /**
51
- * What the tap cost, in nanoseconds, since the last read. Two plain numbers and a maximum — no span,
52
- * no histogram, no allocation: a span per event is exactly the blocking cost the buffer exists to
53
- * avoid, and this sits on the same serial trading path the records describe.
54
- */
55
- export interface TapCounters {
56
- /** Tap invocations, admitted or not: the admission check is cost the trading path already paid. */
57
- calls: number;
58
- nsTotal: number;
59
- /** The longest single call. An average hides the one append that had to evict. */
60
- nsMax: number;
61
- }
62
- /**
63
- * Take the window and zero it. The reader owns the window: a counter that is never reset reports a
64
- * lifetime total forever, which sizes nothing. Process-wide, like the buffer the tap feeds.
65
- */
66
- export declare function readAndResetTapCounters(): TapCounters;
67
- export interface TelemetryPublisherOptions {
68
- /** Buffer to feed. Defaults to the process buffer — one per process, shared by every address. */
69
- buffer?: TimelineBuffer;
70
- }
71
- /**
72
- * A sink that copies admitted records into the timeline buffer under `address`. One instance per
73
- * registered address; every instance writes into the same process buffer, which is what makes the
74
- * publisher process-wide and address-partitioned rather than per-runtime.
75
- */
76
- export declare function createTelemetryPublisherSink(address: string, options?: TelemetryPublisherOptions): EventSink;
77
- /**
78
- * One sink that feeds several. `registerEventSink` keys a single sink per address, so this is how
79
- * the publisher rides alongside the on-disk ring instead of replacing it. Each branch already
80
- * swallows its own failures; the loop keeps one branch's throw from starving the rest regardless.
81
- */
82
- export declare function createFanOutEventSink(sinks: readonly EventSink[]): EventSink;
83
- //# sourceMappingURL=telemetry-publisher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"telemetry-publisher.d.ts","sourceRoot":"","sources":["../../src/telemetry/telemetry-publisher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEvF,OAAO,EAA4B,KAAK,SAAS,EAAoB,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAS9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,SAAS,CA4DtD,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,mGAAmG;IACnG,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;CACf;AAMD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,WAAW,CAMrD;AASD,MAAM,WAAW,yBAAyB;IACxC,iGAAiG;IACjG,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAqCD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,yBAA8B,GACtC,SAAS,CAkDX;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAuB5E"}