@senpi-ai/runtime 1.1.3 → 3.0.3

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 (472) hide show
  1. package/README.md +10 -9
  2. package/dist/actions/action-runtime-module.d.ts.map +1 -1
  3. package/dist/actions/action-runtime-module.js +1 -1
  4. package/dist/actions/action-runtime-module.js.map +1 -1
  5. package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
  6. package/dist/actions/close-position/close-position.action.js +61 -14
  7. package/dist/actions/close-position/close-position.action.js.map +1 -1
  8. package/dist/actions/decision-engine.d.ts.map +1 -1
  9. package/dist/actions/decision-engine.js +3 -0
  10. package/dist/actions/decision-engine.js.map +1 -1
  11. package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
  12. package/dist/actions/open-position/open-position.action.js +140 -29
  13. package/dist/actions/open-position/open-position.action.js.map +1 -1
  14. package/dist/actions/position-tracker/position-tracker.action.d.ts +6 -0
  15. package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
  16. package/dist/actions/position-tracker/position-tracker.action.js +48 -0
  17. package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
  18. package/dist/actions/tracking-helpers.d.ts +16 -1
  19. package/dist/actions/tracking-helpers.d.ts.map +1 -1
  20. package/dist/actions/tracking-helpers.js +55 -9
  21. package/dist/actions/tracking-helpers.js.map +1 -1
  22. package/dist/actions/types.d.ts +10 -2
  23. package/dist/actions/types.d.ts.map +1 -1
  24. package/dist/actions/types.js +8 -0
  25. package/dist/actions/types.js.map +1 -1
  26. package/dist/cli/guide-commands.d.ts.map +1 -1
  27. package/dist/cli/guide-commands.js +84 -82
  28. package/dist/cli/guide-commands.js.map +1 -1
  29. package/dist/cli/senpi-commands.d.ts.map +1 -1
  30. package/dist/cli/senpi-commands.js +16 -110
  31. package/dist/cli/senpi-commands.js.map +1 -1
  32. package/dist/constants/dsl/index.d.ts +2 -0
  33. package/dist/constants/dsl/index.d.ts.map +1 -1
  34. package/dist/constants/dsl/index.js +2 -0
  35. package/dist/constants/dsl/index.js.map +1 -1
  36. package/dist/dsl/config/parse-tiers.d.ts.map +1 -1
  37. package/dist/dsl/config/parse-tiers.js +6 -2
  38. package/dist/dsl/config/parse-tiers.js.map +1 -1
  39. package/dist/dsl/engine-client/config-mapping.d.ts +3 -1
  40. package/dist/dsl/engine-client/config-mapping.d.ts.map +1 -1
  41. package/dist/dsl/engine-client/config-mapping.js +3 -1
  42. package/dist/dsl/engine-client/config-mapping.js.map +1 -1
  43. package/dist/dsl/engine-client/event-mapping.d.ts +2 -0
  44. package/dist/dsl/engine-client/event-mapping.d.ts.map +1 -1
  45. package/dist/dsl/engine-client/event-mapping.js +3 -0
  46. package/dist/dsl/engine-client/event-mapping.js.map +1 -1
  47. package/dist/dsl/events/build-closed-event.d.ts.map +1 -1
  48. package/dist/dsl/events/build-closed-event.js +1 -0
  49. package/dist/dsl/events/build-closed-event.js.map +1 -1
  50. package/dist/dsl/events/guards.d.ts.map +1 -1
  51. package/dist/dsl/events/guards.js +10 -0
  52. package/dist/dsl/events/guards.js.map +1 -1
  53. package/dist/dsl/events/handlers.d.ts +18 -2
  54. package/dist/dsl/events/handlers.d.ts.map +1 -1
  55. package/dist/dsl/events/handlers.js +304 -208
  56. package/dist/dsl/events/handlers.js.map +1 -1
  57. package/dist/dsl/events/initial-state.d.ts.map +1 -1
  58. package/dist/dsl/events/initial-state.js +3 -1
  59. package/dist/dsl/events/initial-state.js.map +1 -1
  60. package/dist/dsl/monitor/create-monitor.d.ts +15 -0
  61. package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
  62. package/dist/dsl/monitor/create-monitor.js +76 -9
  63. package/dist/dsl/monitor/create-monitor.js.map +1 -1
  64. package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
  65. package/dist/dsl/monitor/process-one-position.js +268 -82
  66. package/dist/dsl/monitor/process-one-position.js.map +1 -1
  67. package/dist/dsl/plugin/index.d.ts +16 -1
  68. package/dist/dsl/plugin/index.d.ts.map +1 -1
  69. package/dist/dsl/plugin/index.js +35 -4
  70. package/dist/dsl/plugin/index.js.map +1 -1
  71. package/dist/dsl/plugin/options.d.ts +18 -0
  72. package/dist/dsl/plugin/options.d.ts.map +1 -1
  73. package/dist/index.d.ts +14 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +272 -32
  76. package/dist/index.js.map +1 -1
  77. package/dist/recording/emitter.d.ts +27 -0
  78. package/dist/recording/emitter.d.ts.map +1 -0
  79. package/dist/recording/emitter.js +2 -0
  80. package/dist/recording/emitter.js.map +1 -0
  81. package/dist/recording/identity.d.ts +34 -0
  82. package/dist/recording/identity.d.ts.map +1 -0
  83. package/dist/recording/identity.js +2 -0
  84. package/dist/recording/identity.js.map +1 -0
  85. package/dist/recording/index.d.ts +11 -0
  86. package/dist/recording/index.d.ts.map +1 -0
  87. package/dist/recording/index.js +2 -0
  88. package/dist/recording/index.js.map +1 -0
  89. package/dist/recording/noop-emitter.d.ts +23 -0
  90. package/dist/recording/noop-emitter.d.ts.map +1 -0
  91. package/dist/recording/noop-emitter.js +22 -0
  92. package/dist/recording/noop-emitter.js.map +1 -0
  93. package/dist/recording/otel/attributes.d.ts +35 -0
  94. package/dist/recording/otel/attributes.d.ts.map +1 -0
  95. package/dist/recording/otel/attributes.js +131 -0
  96. package/dist/recording/otel/attributes.js.map +1 -0
  97. package/dist/recording/otel/constants.d.ts +123 -0
  98. package/dist/recording/otel/constants.d.ts.map +1 -0
  99. package/dist/recording/otel/constants.js +172 -0
  100. package/dist/recording/otel/constants.js.map +1 -0
  101. package/dist/recording/otel/ids.d.ts +25 -0
  102. package/dist/recording/otel/ids.d.ts.map +1 -0
  103. package/dist/recording/otel/ids.js +37 -0
  104. package/dist/recording/otel/ids.js.map +1 -0
  105. package/dist/recording/otel/index.d.ts +13 -0
  106. package/dist/recording/otel/index.d.ts.map +1 -0
  107. package/dist/recording/otel/index.js +9 -0
  108. package/dist/recording/otel/index.js.map +1 -0
  109. package/dist/recording/otel/mappers.d.ts +100 -0
  110. package/dist/recording/otel/mappers.d.ts.map +1 -0
  111. package/dist/recording/otel/mappers.js +683 -0
  112. package/dist/recording/otel/mappers.js.map +1 -0
  113. package/dist/recording/otel/otel-emitter.d.ts +43 -0
  114. package/dist/recording/otel/otel-emitter.d.ts.map +1 -0
  115. package/dist/recording/otel/otel-emitter.js +99 -0
  116. package/dist/recording/otel/otel-emitter.js.map +1 -0
  117. package/dist/recording/otel/redaction.d.ts +47 -0
  118. package/dist/recording/otel/redaction.d.ts.map +1 -0
  119. package/dist/recording/otel/redaction.js +88 -0
  120. package/dist/recording/otel/redaction.js.map +1 -0
  121. package/dist/recording/records.d.ts +565 -0
  122. package/dist/recording/records.d.ts.map +1 -0
  123. package/dist/recording/records.js +14 -0
  124. package/dist/recording/records.js.map +1 -0
  125. package/dist/recording/transport/batcher.d.ts +59 -0
  126. package/dist/recording/transport/batcher.d.ts.map +1 -0
  127. package/dist/recording/transport/batcher.js +234 -0
  128. package/dist/recording/transport/batcher.js.map +1 -0
  129. package/dist/recording/transport/client.d.ts +41 -0
  130. package/dist/recording/transport/client.d.ts.map +1 -0
  131. package/dist/recording/transport/client.js +69 -0
  132. package/dist/recording/transport/client.js.map +1 -0
  133. package/dist/recording/transport/config.d.ts +53 -0
  134. package/dist/recording/transport/config.d.ts.map +1 -0
  135. package/dist/recording/transport/config.js +41 -0
  136. package/dist/recording/transport/config.js.map +1 -0
  137. package/dist/recording/transport/index.d.ts +16 -0
  138. package/dist/recording/transport/index.d.ts.map +1 -0
  139. package/dist/recording/transport/index.js +12 -0
  140. package/dist/recording/transport/index.js.map +1 -0
  141. package/dist/recording/transport/rows.d.ts +88 -0
  142. package/dist/recording/transport/rows.d.ts.map +1 -0
  143. package/dist/recording/transport/rows.js +15 -0
  144. package/dist/recording/transport/rows.js.map +1 -0
  145. package/dist/recording/wiring/emitter-factory.d.ts +39 -0
  146. package/dist/recording/wiring/emitter-factory.d.ts.map +1 -0
  147. package/dist/recording/wiring/emitter-factory.js +62 -0
  148. package/dist/recording/wiring/emitter-factory.js.map +1 -0
  149. package/dist/recording/wiring/identity.d.ts +27 -0
  150. package/dist/recording/wiring/identity.d.ts.map +1 -0
  151. package/dist/recording/wiring/identity.js +51 -0
  152. package/dist/recording/wiring/identity.js.map +1 -0
  153. package/dist/recording/wiring/index.d.ts +12 -0
  154. package/dist/recording/wiring/index.d.ts.map +1 -0
  155. package/dist/recording/wiring/index.js +9 -0
  156. package/dist/recording/wiring/index.js.map +1 -0
  157. package/dist/recording/wiring/record-builders.d.ts +107 -0
  158. package/dist/recording/wiring/record-builders.d.ts.map +1 -0
  159. package/dist/recording/wiring/record-builders.js +706 -0
  160. package/dist/recording/wiring/record-builders.js.map +1 -0
  161. package/dist/recording/wiring/subscriber.d.ts +28 -0
  162. package/dist/recording/wiring/subscriber.d.ts.map +1 -0
  163. package/dist/recording/wiring/subscriber.js +173 -0
  164. package/dist/recording/wiring/subscriber.js.map +1 -0
  165. package/dist/recording/wiring/values.d.ts +19 -0
  166. package/dist/recording/wiring/values.d.ts.map +1 -0
  167. package/dist/recording/wiring/values.js +49 -0
  168. package/dist/recording/wiring/values.js.map +1 -0
  169. package/dist/runtime/auto-update/command-runner.d.ts.map +1 -1
  170. package/dist/runtime/auto-update/command-runner.js +5 -1
  171. package/dist/runtime/auto-update/command-runner.js.map +1 -1
  172. package/dist/runtime/auto-update/resolve-package-name.d.ts +10 -0
  173. package/dist/runtime/auto-update/resolve-package-name.d.ts.map +1 -0
  174. package/dist/runtime/auto-update/resolve-package-name.js +35 -0
  175. package/dist/runtime/auto-update/resolve-package-name.js.map +1 -0
  176. package/dist/runtime/auto-update/run-update-command.d.ts +2 -0
  177. package/dist/runtime/auto-update/run-update-command.d.ts.map +1 -0
  178. package/dist/runtime/auto-update/run-update-command.js +37 -0
  179. package/dist/runtime/auto-update/run-update-command.js.map +1 -0
  180. package/dist/runtime/create-runtime-context.d.ts +2 -0
  181. package/dist/runtime/create-runtime-context.d.ts.map +1 -1
  182. package/dist/runtime/create-runtime-context.js +1 -0
  183. package/dist/runtime/create-runtime-context.js.map +1 -1
  184. package/dist/runtime/create-scanner-module.d.ts +4 -3
  185. package/dist/runtime/create-scanner-module.d.ts.map +1 -1
  186. package/dist/runtime/create-scanner-module.js +14 -5
  187. package/dist/runtime/create-scanner-module.js.map +1 -1
  188. package/dist/runtime/create-scanner-providers-for-run.d.ts.map +1 -1
  189. package/dist/runtime/create-scanner-providers-for-run.js +12 -1
  190. package/dist/runtime/create-scanner-providers-for-run.js.map +1 -1
  191. package/dist/runtime/load-runtime-config.d.ts +9 -0
  192. package/dist/runtime/load-runtime-config.d.ts.map +1 -1
  193. package/dist/runtime/load-runtime-config.js +41 -8
  194. package/dist/runtime/load-runtime-config.js.map +1 -1
  195. package/dist/runtime/map-strategies-registration.js +7 -8
  196. package/dist/runtime/map-strategies-registration.js.map +1 -1
  197. package/dist/runtime/map-strategies.d.ts.map +1 -1
  198. package/dist/runtime/map-strategies.js +12 -3
  199. package/dist/runtime/map-strategies.js.map +1 -1
  200. package/dist/runtime/recipe-version.d.ts +1 -1
  201. package/dist/runtime/recipe-version.d.ts.map +1 -1
  202. package/dist/runtime/recipe-version.js +1 -1
  203. package/dist/runtime/recipe-version.js.map +1 -1
  204. package/dist/runtime/reconcile-decide.d.ts +73 -0
  205. package/dist/runtime/reconcile-decide.d.ts.map +1 -0
  206. package/dist/runtime/reconcile-decide.js +186 -0
  207. package/dist/runtime/reconcile-decide.js.map +1 -0
  208. package/dist/runtime/reconcile-run.d.ts +62 -0
  209. package/dist/runtime/reconcile-run.d.ts.map +1 -0
  210. package/dist/runtime/reconcile-run.js +173 -0
  211. package/dist/runtime/reconcile-run.js.map +1 -0
  212. package/dist/runtime/reconcile-state.d.ts +44 -0
  213. package/dist/runtime/reconcile-state.d.ts.map +1 -1
  214. package/dist/runtime/reconcile-state.js +80 -44
  215. package/dist/runtime/reconcile-state.js.map +1 -1
  216. package/dist/runtime/risk-guard.d.ts.map +1 -1
  217. package/dist/runtime/risk-guard.js +17 -12
  218. package/dist/runtime/risk-guard.js.map +1 -1
  219. package/dist/runtime/run.d.ts.map +1 -1
  220. package/dist/runtime/run.js +3 -2
  221. package/dist/runtime/run.js.map +1 -1
  222. package/dist/runtime/runtime-schema.d.ts +4056 -793
  223. package/dist/runtime/runtime-schema.d.ts.map +1 -1
  224. package/dist/runtime/runtime-schema.js +183 -46
  225. package/dist/runtime/runtime-schema.js.map +1 -1
  226. package/dist/runtime/runtime-version.d.ts +3 -6
  227. package/dist/runtime/runtime-version.d.ts.map +1 -1
  228. package/dist/runtime/runtime-version.js +3 -6
  229. package/dist/runtime/runtime-version.js.map +1 -1
  230. package/dist/runtime/runtime.d.ts +47 -0
  231. package/dist/runtime/runtime.d.ts.map +1 -1
  232. package/dist/runtime/runtime.js +516 -146
  233. package/dist/runtime/runtime.js.map +1 -1
  234. package/dist/runtime/scanner-registry.d.ts +1 -1
  235. package/dist/runtime/scanner-registry.d.ts.map +1 -1
  236. package/dist/runtime/scanner-registry.js +3 -12
  237. package/dist/runtime/scanner-registry.js.map +1 -1
  238. package/dist/runtime/strategy-registry.d.ts +6 -0
  239. package/dist/runtime/strategy-registry.d.ts.map +1 -1
  240. package/dist/runtime/strategy-registry.js +1 -0
  241. package/dist/runtime/strategy-registry.js.map +1 -1
  242. package/dist/runtime/supervisor/long-running-supervisor.d.ts +222 -0
  243. package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -0
  244. package/dist/runtime/supervisor/long-running-supervisor.js +625 -0
  245. package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -0
  246. package/dist/runtime/supervisor/orphan-sweep.d.ts +36 -0
  247. package/dist/runtime/supervisor/orphan-sweep.d.ts.map +1 -0
  248. package/dist/runtime/supervisor/orphan-sweep.js +255 -0
  249. package/dist/runtime/supervisor/orphan-sweep.js.map +1 -0
  250. package/dist/runtime/supervisor/supervisor-utils.d.ts +37 -0
  251. package/dist/runtime/supervisor/supervisor-utils.d.ts.map +1 -0
  252. package/dist/runtime/supervisor/supervisor-utils.js +175 -0
  253. package/dist/runtime/supervisor/supervisor-utils.js.map +1 -0
  254. package/dist/runtime-api/handlers/ingest-signals.d.ts +3 -3
  255. package/dist/runtime-api/handlers/ingest-signals.js +3 -3
  256. package/dist/runtime-api/intake/acceptance-record.d.ts +103 -0
  257. package/dist/runtime-api/intake/acceptance-record.d.ts.map +1 -0
  258. package/dist/runtime-api/intake/acceptance-record.js +192 -0
  259. package/dist/runtime-api/intake/acceptance-record.js.map +1 -0
  260. package/dist/runtime-api/intake/intake-context.d.ts +31 -0
  261. package/dist/runtime-api/intake/intake-context.d.ts.map +1 -0
  262. package/dist/runtime-api/intake/intake-context.js +21 -0
  263. package/dist/runtime-api/intake/intake-context.js.map +1 -0
  264. package/dist/runtime-api/intake/intake-mount.d.ts +118 -0
  265. package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -0
  266. package/dist/runtime-api/intake/intake-mount.js +193 -0
  267. package/dist/runtime-api/intake/intake-mount.js.map +1 -0
  268. package/dist/runtime-api/intake/liveness-store.d.ts +32 -0
  269. package/dist/runtime-api/intake/liveness-store.d.ts.map +1 -0
  270. package/dist/runtime-api/intake/liveness-store.js +31 -0
  271. package/dist/runtime-api/intake/liveness-store.js.map +1 -0
  272. package/dist/runtime-api/intake/process-error-post.d.ts +15 -0
  273. package/dist/runtime-api/intake/process-error-post.d.ts.map +1 -0
  274. package/dist/runtime-api/intake/process-error-post.js +19 -0
  275. package/dist/runtime-api/intake/process-error-post.js.map +1 -0
  276. package/dist/runtime-api/intake/process-signal-post.d.ts +73 -0
  277. package/dist/runtime-api/intake/process-signal-post.d.ts.map +1 -0
  278. package/dist/runtime-api/intake/process-signal-post.js +188 -0
  279. package/dist/runtime-api/intake/process-signal-post.js.map +1 -0
  280. package/dist/runtime-api/intake/scanner-launcher.d.ts +133 -0
  281. package/dist/runtime-api/intake/scanner-launcher.d.ts.map +1 -0
  282. package/dist/runtime-api/intake/scanner-launcher.js +204 -0
  283. package/dist/runtime-api/intake/scanner-launcher.js.map +1 -0
  284. package/dist/runtime-api/intake/scanner-registry.d.ts +36 -0
  285. package/dist/runtime-api/intake/scanner-registry.d.ts.map +1 -0
  286. package/dist/runtime-api/intake/scanner-registry.js +29 -0
  287. package/dist/runtime-api/intake/scanner-registry.js.map +1 -0
  288. package/dist/runtime-api/intake/types.d.ts +61 -0
  289. package/dist/runtime-api/intake/types.d.ts.map +1 -0
  290. package/dist/runtime-api/intake/types.js +8 -0
  291. package/dist/runtime-api/intake/types.js.map +1 -0
  292. package/dist/runtime-api/routes/signals.d.ts +20 -40
  293. package/dist/runtime-api/routes/signals.d.ts.map +1 -1
  294. package/dist/runtime-api/routes/signals.js +119 -75
  295. package/dist/runtime-api/routes/signals.js.map +1 -1
  296. package/dist/runtime-api/routes/signals.schema.d.ts +24 -86
  297. package/dist/runtime-api/routes/signals.schema.d.ts.map +1 -1
  298. package/dist/runtime-api/routes/signals.schema.js +35 -50
  299. package/dist/runtime-api/routes/signals.schema.js.map +1 -1
  300. package/dist/runtime-api/server.d.ts +15 -6
  301. package/dist/runtime-api/server.d.ts.map +1 -1
  302. package/dist/runtime-api/server.js +12 -12
  303. package/dist/runtime-api/server.js.map +1 -1
  304. package/dist/scanners/events.d.ts +6 -0
  305. package/dist/scanners/events.d.ts.map +1 -1
  306. package/dist/scanners/events.js.map +1 -1
  307. package/dist/scanners/external/scaffold/__init__.py +16 -0
  308. package/dist/scanners/external/scaffold/__main__.py +155 -0
  309. package/dist/scanners/external/scaffold/ctx.py +78 -0
  310. package/dist/scanners/external/scaffold/delivery.py +263 -0
  311. package/dist/scanners/external/scaffold/entrypoint_loader.py +151 -0
  312. package/dist/scanners/external/scaffold/http_post.py +70 -0
  313. package/dist/scanners/external/scaffold/journal.py +247 -0
  314. package/dist/scanners/external/scaffold/loop_primitives.py +65 -0
  315. package/dist/scanners/external/scaffold/requirements.txt +11 -0
  316. package/dist/scanners/external/scaffold/scaffold.py +361 -0
  317. package/dist/scanners/external/scaffold/scaffold_state.py +114 -0
  318. package/dist/scanners/external/scaffold/senpi_mcp.py +250 -0
  319. package/dist/scanners/external/scaffold/signal_envelope.py +220 -0
  320. package/dist/scanners/external/scaffold/state_manager.py +175 -0
  321. package/dist/scanners/external-scanner-receiver.d.ts +17 -1
  322. package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
  323. package/dist/scanners/external-scanner-receiver.js +16 -3
  324. package/dist/scanners/external-scanner-receiver.js.map +1 -1
  325. package/dist/scanners/implementations/external-scanner.d.ts.map +1 -1
  326. package/dist/scanners/implementations/external-scanner.js +7 -1
  327. package/dist/scanners/implementations/external-scanner.js.map +1 -1
  328. package/dist/scanners/implementations/momentum.d.ts.map +1 -1
  329. package/dist/scanners/implementations/momentum.js +16 -0
  330. package/dist/scanners/implementations/momentum.js.map +1 -1
  331. package/dist/scanners/runtime-module.d.ts.map +1 -1
  332. package/dist/scanners/runtime-module.js +9 -1
  333. package/dist/scanners/runtime-module.js.map +1 -1
  334. package/dist/scripts/run-dsl-standalone-live.d.ts +1 -1
  335. package/dist/scripts/run-dsl-standalone-live.js +5 -3
  336. package/dist/scripts/run-dsl-standalone-live.js.map +1 -1
  337. package/dist/senpi/client.d.ts +56 -4
  338. package/dist/senpi/client.d.ts.map +1 -1
  339. package/dist/senpi/client.js +123 -24
  340. package/dist/senpi/client.js.map +1 -1
  341. package/dist/senpi/index.d.ts +2 -1
  342. package/dist/senpi/index.d.ts.map +1 -1
  343. package/dist/senpi/index.js +1 -1
  344. package/dist/senpi/index.js.map +1 -1
  345. package/dist/senpi/types.d.ts +1 -2
  346. package/dist/senpi/types.d.ts.map +1 -1
  347. package/dist/state/state-manager.d.ts +17 -0
  348. package/dist/state/state-manager.d.ts.map +1 -1
  349. package/dist/state/state-manager.js +55 -4
  350. package/dist/state/state-manager.js.map +1 -1
  351. package/dist/strategy/strategy-state.d.ts +9 -1
  352. package/dist/strategy/strategy-state.d.ts.map +1 -1
  353. package/dist/strategy/strategy-state.js +62 -9
  354. package/dist/strategy/strategy-state.js.map +1 -1
  355. package/dist/tracking/build-rehydrate-items.d.ts +15 -0
  356. package/dist/tracking/build-rehydrate-items.d.ts.map +1 -0
  357. package/dist/tracking/build-rehydrate-items.js +19 -0
  358. package/dist/tracking/build-rehydrate-items.js.map +1 -0
  359. package/dist/tracking/constants.d.ts.map +1 -1
  360. package/dist/tracking/constants.js +2 -0
  361. package/dist/tracking/constants.js.map +1 -1
  362. package/dist/tracking/index.d.ts +3 -0
  363. package/dist/tracking/index.d.ts.map +1 -1
  364. package/dist/tracking/index.js +2 -0
  365. package/dist/tracking/index.js.map +1 -1
  366. package/dist/tracking/position-id-registry.d.ts +69 -0
  367. package/dist/tracking/position-id-registry.d.ts.map +1 -0
  368. package/dist/tracking/position-id-registry.js +139 -0
  369. package/dist/tracking/position-id-registry.js.map +1 -0
  370. package/dist/tracking/spans/fan-out-span-transport.d.ts +22 -0
  371. package/dist/tracking/spans/fan-out-span-transport.d.ts.map +1 -0
  372. package/dist/tracking/spans/fan-out-span-transport.js +49 -0
  373. package/dist/tracking/spans/fan-out-span-transport.js.map +1 -0
  374. package/dist/tracking/spans/otel/fit-row-budget.d.ts +22 -0
  375. package/dist/tracking/spans/otel/fit-row-budget.d.ts.map +1 -0
  376. package/dist/tracking/spans/otel/fit-row-budget.js +91 -0
  377. package/dist/tracking/spans/otel/fit-row-budget.js.map +1 -0
  378. package/dist/tracking/spans/otel/map-span-to-trace-row.d.ts +16 -0
  379. package/dist/tracking/spans/otel/map-span-to-trace-row.d.ts.map +1 -0
  380. package/dist/tracking/spans/otel/map-span-to-trace-row.js +227 -0
  381. package/dist/tracking/spans/otel/map-span-to-trace-row.js.map +1 -0
  382. package/dist/tracking/spans/otel/recording-span-transport.d.ts +43 -0
  383. package/dist/tracking/spans/otel/recording-span-transport.d.ts.map +1 -0
  384. package/dist/tracking/spans/otel/recording-span-transport.js +67 -0
  385. package/dist/tracking/spans/otel/recording-span-transport.js.map +1 -0
  386. package/dist/tracking/spans/otel/span-ids.d.ts +22 -0
  387. package/dist/tracking/spans/otel/span-ids.d.ts.map +1 -0
  388. package/dist/tracking/spans/otel/span-ids.js +32 -0
  389. package/dist/tracking/spans/otel/span-ids.js.map +1 -0
  390. package/dist/tracking/spans/plugin-span-tracker.d.ts +6 -0
  391. package/dist/tracking/spans/plugin-span-tracker.d.ts.map +1 -1
  392. package/dist/tracking/spans/plugin-span-tracker.js +82 -9
  393. package/dist/tracking/spans/plugin-span-tracker.js.map +1 -1
  394. package/dist/tracking/spans/redact-pii.d.ts +3 -1
  395. package/dist/tracking/spans/redact-pii.d.ts.map +1 -1
  396. package/dist/tracking/spans/redact-pii.js +5 -1
  397. package/dist/tracking/spans/redact-pii.js.map +1 -1
  398. package/dist/tracking/spans/span-transport.d.ts +6 -0
  399. package/dist/tracking/spans/span-transport.d.ts.map +1 -1
  400. package/dist/tracking/spans/span-transport.js +1 -1
  401. package/dist/tracking/spans/span-transport.js.map +1 -1
  402. package/dist/types/dsl/index.d.ts +24 -1
  403. package/dist/types/dsl/index.d.ts.map +1 -1
  404. package/dist/types/runtime.d.ts +6 -0
  405. package/dist/types/runtime.d.ts.map +1 -1
  406. package/dist/types/scanner.d.ts +7 -0
  407. package/dist/types/scanner.d.ts.map +1 -1
  408. package/dist/types/strategy.d.ts +3 -1
  409. package/dist/types/strategy.d.ts.map +1 -1
  410. package/dist/utils/keyed-mutex.d.ts +37 -0
  411. package/dist/utils/keyed-mutex.d.ts.map +1 -0
  412. package/dist/utils/keyed-mutex.js +77 -0
  413. package/dist/utils/keyed-mutex.js.map +1 -0
  414. package/dist/utils/safe-spawn.d.ts +6 -0
  415. package/dist/utils/safe-spawn.d.ts.map +1 -0
  416. package/dist/utils/safe-spawn.js +62 -0
  417. package/dist/utils/safe-spawn.js.map +1 -0
  418. package/examples/strategies/README.md +17 -12
  419. package/examples/strategies/iguana/README.md +135 -0
  420. package/examples/strategies/iguana/recipe.yaml +137 -0
  421. package/examples/strategies/iguana/scanners/scan.py +243 -0
  422. package/examples/strategies/iguana/scanners/scoring.py +152 -0
  423. package/examples/strategies/raptor/README.md +156 -0
  424. package/examples/strategies/raptor/recipe.yaml +154 -0
  425. package/examples/strategies/raptor/scanners/scan.py +349 -0
  426. package/examples/strategies/raptor/scanners/scoring.py +452 -0
  427. package/examples/strategies/spider/README.md +89 -0
  428. package/examples/strategies/spider/scalp/recipe.yaml +129 -0
  429. package/examples/strategies/spider/scalp/scanners/scan.py +219 -0
  430. package/examples/strategies/spider/scalp/scanners/scoring.py +179 -0
  431. package/examples/strategies/spider/swing/recipe.yaml +137 -0
  432. package/examples/strategies/spider/swing/scanners/scan.py +334 -0
  433. package/examples/strategies/spider/swing/scanners/scoring.py +184 -0
  434. package/examples/strategies/turbine/README.md +166 -0
  435. package/examples/strategies/turbine/recipe-runners.yaml +123 -0
  436. package/examples/strategies/turbine/recipe-volume.yaml +129 -0
  437. package/examples/strategies/turbine/scanners/scan.py +283 -0
  438. package/examples/strategies/turbine/scanners/scoring.py +190 -0
  439. package/openclaw.plugin.json +12 -1
  440. package/package.json +3 -3
  441. package/dist/runtime-api/handlers/group-by-scanner.d.ts +0 -43
  442. package/dist/runtime-api/handlers/group-by-scanner.d.ts.map +0 -1
  443. package/dist/runtime-api/handlers/group-by-scanner.js +0 -43
  444. package/dist/runtime-api/handlers/group-by-scanner.js.map +0 -1
  445. package/dist/scanners/external/liquidation-watchdog/README.md +0 -107
  446. package/dist/scanners/external/liquidation-watchdog/liquidation-watchdog.yaml +0 -48
  447. package/dist/scanners/external/liquidation-watchdog/producer.mjs +0 -336
  448. package/dist/scanners/external/momentum/README.md +0 -148
  449. package/dist/scanners/external/momentum/momentum.yaml +0 -116
  450. package/dist/scanners/external/momentum/producer.mjs +0 -251
  451. package/dist/scanners/external/shared/ingest.mjs +0 -112
  452. package/examples/README.md +0 -89
  453. package/examples/scanners-consumer-quickstart.mjs +0 -134
  454. package/examples/scanners-emerging-movers-v4.mjs +0 -287
  455. package/examples/scanners-liquidation-watchdog.mjs +0 -341
  456. package/examples/scanners-live-mcp.mjs +0 -208
  457. package/examples/scanners-multi-strategy.mjs +0 -165
  458. package/examples/scanners-position-tracker-e2e.mjs +0 -225
  459. package/examples/scanners-scheduled-events.mjs +0 -96
  460. package/examples/scanners-senpi-provider-client.mjs +0 -182
  461. package/examples/scanners-single-strategy.mjs +0 -198
  462. package/examples/strategies/dsl-showcase.yaml +0 -68
  463. package/examples/strategies/dsl.yaml +0 -51
  464. package/examples/strategies/fox-minimal-loosened.yaml +0 -240
  465. package/examples/strategies/fox-minimal.yaml +0 -242
  466. package/examples/strategies/minimal.yaml +0 -46
  467. package/examples/strategies/momentum/how-it-works.md +0 -48
  468. package/examples/strategies/momentum/momentum-guarded.yaml +0 -161
  469. package/examples/strategies/risk-showcase.yaml +0 -93
  470. package/examples/strategies/viper.yaml +0 -67
  471. package/examples/strategies/wolf.yaml +0 -72
  472. package/examples/yamls/sample-with-dsl-and-emerging-movers.yaml +0 -123
@@ -0,0 +1,565 @@
1
+ /**
2
+ * Recording contract — the record types the runtime hands to a {@link RecordingEmitter}, covering
3
+ * domain events and runtime errors.
4
+ *
5
+ * Each record is one atomic "work unit": plain, immutable, serializable data with no methods or
6
+ * builder dance; variants are modelled with a discriminator field plus optionals. The types are
7
+ * transport-agnostic — nothing here knows about spans, attributes, or any wire format.
8
+ *
9
+ * Identity (service, recipe, runtime, strategy address, boot id) is stamped by the emitter and is
10
+ * never on a record — see {@link IdentityEnvelope}. Timestamps are epoch milliseconds; ISO strings
11
+ * from the bus are converted before they reach a record, so consumers never parse dates.
12
+ */
13
+ /**
14
+ * Trade direction as the bus reports it. The alias itself is non-null; sites that admit a
15
+ * non-directional signal widen it to `TradeDirection | null` (e.g. {@link SignalSummary}).
16
+ */
17
+ export type TradeDirection = "LONG" | "SHORT";
18
+ /**
19
+ * Lightweight projection of a scanner signal as it appears on the bus, including the explainable
20
+ * `factors`/`meta` bags so the audit trail keeps the "why". Redacting sensitive `meta` is the
21
+ * adapter's job, not this contract's.
22
+ */
23
+ export interface SignalSummary {
24
+ readonly signalType: string;
25
+ readonly asset: string;
26
+ readonly direction: TradeDirection | null;
27
+ readonly score: number;
28
+ /** Signal time, epoch ms. */
29
+ readonly timestamp: number;
30
+ readonly factors?: Record<string, boolean>;
31
+ readonly meta?: Record<string, unknown>;
32
+ }
33
+ /** Coarse terminal classification of a scanner execution. */
34
+ export type ScannerRunOutcome = "complete" | "skipped" | "error";
35
+ /**
36
+ * One scanner execution attempt (the work unit). Folds the bus's `scanner:run:start` +
37
+ * terminal `scanner:run:{complete,skip,error}` events into a single atomic record so a
38
+ * duration is always derivable (`endedAt - startedAt`). Skip/error early-exit paths can
39
+ * terminate without a paired `scanner:run:start` event; in that case Task 4 fills `startedAt`
40
+ * with the run's attempt timestamp (which equals `endedAt`), so duration is 0 rather than absent.
41
+ * The skipped/disabled distinction lives on `outcome`/`statusDetail`, not on a missing start.
42
+ */
43
+ export interface ScannerRunRecord {
44
+ readonly type: "scanner_run";
45
+ readonly scannerId: string;
46
+ /** Telemetry-owned per-scan-run id; threads scan → pass into one trace. */
47
+ readonly runId?: string;
48
+ readonly outcome: ScannerRunOutcome;
49
+ /** Raw engine status: `ok`|`heartbeat`|`skipped`|`halted`|`disabled`|`error`. */
50
+ readonly statusDetail?: string;
51
+ /**
52
+ * Run start, epoch ms (from `scanner:run:start`). Required: on a no-start early-exit path Task 4
53
+ * sets it to the attempt timestamp (= `endedAt`), so a `Duration` is always derivable.
54
+ */
55
+ readonly startedAt: number;
56
+ /** Run completion, epoch ms (terminal event timestamp). */
57
+ readonly endedAt: number;
58
+ readonly scannedCount?: number;
59
+ readonly actionableCount?: number;
60
+ readonly signalCount?: number;
61
+ readonly signals?: readonly SignalSummary[];
62
+ /** Per-scanner aggregated run metrics/details (`ScanResult.summary`). */
63
+ readonly summary?: Record<string, unknown>;
64
+ /** Explanation for a non-OK status (skip/error). */
65
+ readonly reason?: string;
66
+ /** Error message when `outcome === "error"`. */
67
+ readonly error?: string;
68
+ /** Error class name (`Error.name`) when `outcome === "error"` — the error-grouping key. */
69
+ readonly errorName?: string;
70
+ }
71
+ /** How the decision was produced (`emitTrackingDecision` reports this). */
72
+ export type DecisionMode = "llm" | "script" | "agent" | "rule" | "none";
73
+ /** Decision produced by the decision layer for an evaluation pass. */
74
+ export interface SignalDecision {
75
+ readonly execute: boolean;
76
+ /** Action type, e.g. `"open_position"`. */
77
+ readonly actionType: string;
78
+ /** Concrete action instance name. */
79
+ readonly actionName?: string;
80
+ /** Distinguishes a vestigial rule "decision" from a real LLM judgment. */
81
+ readonly mode?: DecisionMode;
82
+ readonly confidence: number;
83
+ /** Bar `confidence` was compared against (`min_confidence`); makes the below_confidence boundary reconstructable. */
84
+ readonly confidenceThreshold?: number;
85
+ readonly reasoning: string;
86
+ /** LLM-path auditing (from `ActionDecision.decisionTelemetry`). */
87
+ readonly model?: string;
88
+ readonly tokensUsed?: number | null;
89
+ readonly durationMs?: number;
90
+ /** Epoch ms when the decision phase ended — the llm.decision child's end; its window is `[endedAt − durationMs, endedAt]`. */
91
+ readonly endedAt?: number;
92
+ }
93
+ /** Coarse result of acting on an evaluated signal. */
94
+ export type SignalOutcomeResult = "executed" | "rejected" | "skipped" | "below_confidence" | "error";
95
+ /**
96
+ * Outcome of acting on a **single** signal within an evaluation pass. Outcomes are per-signal: the
97
+ * action loops over the batch producing one result each and decrements margin as it goes, so a
98
+ * later signal's outcome only makes sense alongside the earlier ones.
99
+ *
100
+ * `result` is the coarse classification. `reasonCode` is an open string for the granular per-signal
101
+ * reasons (e.g. `risk_gate_COOLDOWN`, `insufficient_margin`, `below_min_notional`,
102
+ * `position_open_failed`, `no_slots`, `invalid_direction`); keeping it an open string means new
103
+ * reasons can be carried without changing this type.
104
+ */
105
+ export interface SignalOutcome {
106
+ readonly result: SignalOutcomeResult;
107
+ /**
108
+ * Cross-flow position.id when this signal relates to a live (open or just-submitted)
109
+ * position — read from the PositionIdRegistry at record time, regardless of the outcome
110
+ * classification (a rejected/skipped signal on a *held* asset still carries that
111
+ * position's id; only a signal on an asset with no position resolves to nothing).
112
+ * Optional on every record that carries it: the id is a best-effort realtime grouping
113
+ * hint; authoritative post-hoc correlation anchors on `orderId` against the venue
114
+ * fills ledger.
115
+ */
116
+ readonly positionId?: string;
117
+ readonly summary?: string;
118
+ readonly reasonCode?: string;
119
+ readonly reason?: string;
120
+ readonly error?: string;
121
+ /** Error class name (`Error.name`, e.g. `"ZodError"`) — the natural error-grouping key. */
122
+ readonly errorName?: string;
123
+ readonly leverage?: number;
124
+ readonly marginAmount?: number;
125
+ readonly notionalValue?: number;
126
+ readonly orderId?: string;
127
+ readonly entryPrice?: number;
128
+ readonly size?: number;
129
+ /** Order-fill success flag from `CreatePositionOrderResult.filled` (boolean, not a quantity). */
130
+ readonly filled?: boolean | null;
131
+ /** Maker vs taker fill (`CreatePositionOrderResult.executionAsMaker`); `null` when unfilled. */
132
+ readonly executionAsMaker?: boolean | null;
133
+ readonly requiredMarginAmount?: number;
134
+ readonly availableMarginAmount?: number;
135
+ }
136
+ /**
137
+ * One evaluated signal paired with its outcome. Pairing (rather than two index-aligned arrays)
138
+ * keeps signal and outcome structurally bound, so no filter/sort/map can silently misalign them.
139
+ */
140
+ export interface SignalEvaluation {
141
+ readonly signal: SignalSummary;
142
+ readonly outcome: SignalOutcome;
143
+ /** Per-signal work window, epoch ms — stamped by the action loop (absent on older payloads). */
144
+ readonly startedAt?: number;
145
+ readonly endedAt?: number;
146
+ }
147
+ /**
148
+ * One signal-evaluation work unit: the runtime hands a scan pass's batch to the action, which
149
+ * decides once, then acts on each signal serially. The whole pass is one record — a 3-signal batch
150
+ * is ONE record with three `evaluations`, not three records. Nesting the decision and per-signal
151
+ * outcomes keeps them bound together without a separate join key.
152
+ */
153
+ export interface SignalEvaluatedRecord {
154
+ readonly type: "signal_evaluated";
155
+ readonly scannerId?: string;
156
+ /** Telemetry-owned per-scan-run id; threads scan → pass into one trace. */
157
+ readonly runId?: string;
158
+ /** Evaluation start, epoch ms. Required (see {@link ScannerRunRecord.startedAt}) so a `Duration` is always derivable. */
159
+ readonly startedAt: number;
160
+ /** Evaluation end, epoch ms. */
161
+ readonly endedAt: number;
162
+ /**
163
+ * Pass-level decision (the single `ActionDecision` the engine/LLM produces for this pass).
164
+ * Absent when the pass was filtered before a decision was produced.
165
+ */
166
+ readonly decision?: SignalDecision;
167
+ /** One entry per signal in the evaluated batch; outcomes are per-signal. */
168
+ readonly evaluations: readonly SignalEvaluation[];
169
+ }
170
+ export type PositionLifecycleEvent = "opened" | "closed" | "flipped" | "increased" | "decreased" | "open_order_submitted";
171
+ /**
172
+ * A position lifecycle domain event observed on the bus. These are first-class events — they
173
+ * fire both as the outcome of acting on a signal *and* when the position-tracker scanner
174
+ * detects on-chain changes opened manually or by other tools — so they are recorded
175
+ * independently of {@link SignalEvaluatedRecord}.
176
+ *
177
+ * Variant-specific fields are optional; `event` discriminates which apply.
178
+ */
179
+ export interface PositionLifecycleRecord {
180
+ readonly type: "position_lifecycle";
181
+ readonly event: PositionLifecycleEvent;
182
+ readonly occurredAt: number;
183
+ /** Cross-flow position.id (`__positionId` on the bus payload). See {@link SignalOutcome.positionId}. */
184
+ readonly positionId?: string;
185
+ readonly asset: string;
186
+ /** Empty string / undefined for the main book. */
187
+ readonly dex?: string;
188
+ readonly direction?: TradeDirection | null;
189
+ readonly entryPrice?: number;
190
+ readonly size?: number;
191
+ readonly leverage?: number;
192
+ readonly leverageType?: string;
193
+ readonly margin?: number;
194
+ readonly unrealizedPnl?: number;
195
+ readonly roe?: number;
196
+ /** `null` when the venue reports no liquidation price. */
197
+ readonly liquidationPrice?: number | null;
198
+ readonly reason?: string;
199
+ readonly closeReason?: string;
200
+ readonly closedPrice?: number;
201
+ readonly closedSize?: number;
202
+ /** Maker vs taker on the close (`null` when unfilled). */
203
+ readonly executionAsMaker?: boolean | null;
204
+ readonly previousEntryPrice?: number;
205
+ readonly previousSize?: number;
206
+ readonly sizeDelta?: number;
207
+ readonly newAsset?: string;
208
+ readonly orderId?: string;
209
+ readonly orderType?: string;
210
+ readonly marginAmount?: number;
211
+ /** Order-fill success flag from `CreatePositionOrderResult.filled` (boolean, not a quantity). */
212
+ readonly filled?: boolean | null;
213
+ readonly reasoning?: string;
214
+ /**
215
+ * Externally-detected vs runtime-opened discriminator (`"runtime_opened"` |
216
+ * `"externally_detected"`), from the PositionIdRegistry's intent-vs-fresh mint observation.
217
+ * Populated on `opened` only (the registry surfaces it solely on confirm-open); absent on every
218
+ * other lifecycle event. See the Task 8a impl notes.
219
+ */
220
+ readonly reconciliationSource?: string;
221
+ }
222
+ export type DslTransitionKind = "created" | "phase_changed" | "tier_advanced" | "sl_updated" | "closed" | "close_pending" | "settings_updated" | "deleted";
223
+ /** A tier in the exit ladder, as carried on `dsl.created`. */
224
+ export interface DslTierSummary {
225
+ readonly triggerPct: number;
226
+ readonly lockHwPct: number;
227
+ }
228
+ /**
229
+ * A DSL exit-engine transition. One record per transition; `transition` discriminates which of the
230
+ * optional fields are populated. Periodic `dsl.heartbeat` is intentionally not modelled — it is a
231
+ * notification cadence, not a state transition.
232
+ */
233
+ export interface DslTransitionRecord {
234
+ readonly type: "dsl_transition";
235
+ readonly transition: DslTransitionKind;
236
+ readonly occurredAt: number;
237
+ /** Cross-flow position.id (`__positionId` on the bus payload). See {@link SignalOutcome.positionId}. */
238
+ readonly positionId?: string;
239
+ readonly asset: string;
240
+ readonly dex?: string;
241
+ /** Lifecycle event that produced the DSL row (`position_opened`|`..._increased`|`flipped`). */
242
+ readonly triggerReason?: string;
243
+ readonly preset?: string;
244
+ /** Exit ladder the position was created with (`dsl.created`). */
245
+ readonly tiers?: readonly DslTierSummary[];
246
+ readonly direction?: TradeDirection;
247
+ readonly entryPrice?: number;
248
+ readonly leverage?: number;
249
+ readonly margin?: number;
250
+ readonly size?: number;
251
+ readonly floorPrice?: number;
252
+ readonly newFloorPrice?: number;
253
+ readonly phase?: 1 | 2;
254
+ /**
255
+ * Current tier index. Normalizes the three bus spellings into one field — `tierIndex`
256
+ * (`dsl.phase_changed`), `tier` (`dsl.tier_advanced`), `currentTierIndex` (`dsl.closed`) — so
257
+ * downstream never has to know which event produced the record. `null` when no tier is active.
258
+ */
259
+ readonly tierIndex?: number | null;
260
+ readonly lockHwPct?: number;
261
+ readonly triggerPct?: number;
262
+ readonly lockedProfitPct?: number;
263
+ readonly newSLPrice?: number;
264
+ readonly slOrderId?: number;
265
+ readonly reason?: string;
266
+ readonly closeReason?: string;
267
+ /** Position open time, epoch ms (on `closed`). */
268
+ readonly createdAt?: number;
269
+ readonly currentROE?: number;
270
+ readonly highWaterRoe?: number;
271
+ /** High-water *price* the trailing floor is relative to (`DslState.highWaterPrice`). */
272
+ readonly highWaterPrice?: number;
273
+ readonly peakROE?: number;
274
+ readonly lastPrice?: number;
275
+ readonly attempt?: number;
276
+ readonly updated?: readonly string[];
277
+ /**
278
+ * Senpi/MCP-side position id (`DslState.backendDslPositionId`). Captured opportunistically for
279
+ * exchange-side correlation — but **DSL-only**: the runtime must not treat this as a position
280
+ * identity, since DSL need not be active for a position to exist. `null` when not yet assigned.
281
+ */
282
+ readonly backendDslPositionId?: string | null;
283
+ }
284
+ /**
285
+ * Which work unit of a monitor tick a {@link DslTickRecord} carries: the tick itself, one
286
+ * position's processing window, or one venue call (close attempt / SL update) within it.
287
+ */
288
+ export type DslTickUnit = "tick" | "position" | "close_attempt" | "sl_update";
289
+ /**
290
+ * One work unit of the DSL monitor tick — the runtime's third work loop alongside the scanner run
291
+ * and the signal-evaluation pass. Unlike {@link DslTransitionRecord} (the point-in-time
292
+ * state-machine record, which stays a log), these are *measured durations*: the tick batches price
293
+ * fetches and processes every active position, and each position's processing may submit a close
294
+ * or sync the exchange stop-loss — the venue-latency story.
295
+ *
296
+ * One record per bus event, no pairing: the shared `tickId` (emitted as the `tick.id` attribute on
297
+ * every span and, scoped by the emitter's bootId, used as the deterministic trace-id seed) threads
298
+ * the units into one trace, and `positionKey` seeds the per-position span id so close/SL units
299
+ * nest under their position.
300
+ * `unit` discriminates which optional fields apply. `position.id` joins the family to the
301
+ * position's lifecycle and `dsl_transition` logs across flows.
302
+ */
303
+ export interface DslTickRecord {
304
+ readonly type: "dsl_tick";
305
+ readonly unit: DslTickUnit;
306
+ /** The monitor's per-tick id — the deterministic TraceId seed (scoped by bootId) and the `tick.id` join attribute. */
307
+ readonly tickId: string;
308
+ /** Work-unit start, epoch ms — observed at the emit site, never fabricated. */
309
+ readonly startedAt: number;
310
+ /** Work-unit end, epoch ms (clamped so `endedAt >= startedAt`). */
311
+ readonly endedAt: number;
312
+ readonly strategyCount?: number;
313
+ readonly activePositionCount?: number;
314
+ readonly positionsProcessed?: number;
315
+ /** Batched price-fetch window within the tick (both or neither — a half window is fabricated extent). */
316
+ readonly pricesStartedAt?: number;
317
+ readonly pricesEndedAt?: number;
318
+ /** The DSL state key — the deterministic span-id seed component (`bootId:tickId:positionKey`). */
319
+ readonly positionKey?: string;
320
+ /** Cross-flow position.id (`DslState.positionId`, falling back to `correlationId` for legacy state). */
321
+ readonly positionId?: string;
322
+ readonly asset?: string;
323
+ readonly dex?: string;
324
+ readonly outcome?: "ok" | "error";
325
+ readonly error?: string;
326
+ readonly closeReason?: string;
327
+ /** Consecutive close-attempt number (1-based), from `consecutiveCloseFailures`. */
328
+ readonly attempt?: number;
329
+ readonly newSLPrice?: number;
330
+ /** Synced exchange SL order id (success only). */
331
+ readonly slOrderId?: number;
332
+ /** Why the sync ran (e.g. `slOrderMissing,tierChanged`), as the monitor computes it. */
333
+ readonly syncReason?: string;
334
+ }
335
+ /**
336
+ * A bucket-2 error that does not belong to a specific domain record (e.g. the bus's
337
+ * `signal_processing_error`). Errors that *do* have a home — scanner failures, action
338
+ * failures, DSL close failures — are carried on {@link ScannerRunRecord}, {@link SignalOutcome}
339
+ * and {@link DslTransitionRecord} respectively.
340
+ */
341
+ export interface RuntimeErrorRecord {
342
+ readonly type: "runtime_error";
343
+ readonly occurredAt: number;
344
+ /** Where the error originated, e.g. `"signal_processing"`. */
345
+ readonly phase: string;
346
+ readonly message: string;
347
+ /** Error class name (`Error.name`, e.g. `"ZodError"`) — the natural error-grouping key. */
348
+ readonly errorName?: string;
349
+ readonly asset?: string;
350
+ readonly scannerId?: string;
351
+ /** Telemetry-owned per-scan-run id when the error belongs to a scan family (e.g. signal processing). */
352
+ readonly runId?: string;
353
+ readonly stack?: string;
354
+ }
355
+ export type RuntimeLifecyclePhase = "started" | "stopped";
356
+ /**
357
+ * Runtime session boundary. Marks process start/stop and carries session shape; `strategyAddress`
358
+ * is omitted because it lives on the identity envelope.
359
+ */
360
+ export interface RuntimeLifecycleRecord {
361
+ readonly type: "runtime_lifecycle";
362
+ readonly phase: RuntimeLifecyclePhase;
363
+ readonly occurredAt: number;
364
+ readonly runtimeVersion?: string;
365
+ readonly hasDsl?: boolean;
366
+ readonly scannerCount?: number;
367
+ readonly actionCount?: number;
368
+ /**
369
+ * The **unresolved** runtime config at boot (raw YAML/config, `${VAR}` placeholders intact) — the
370
+ * retrospection snapshot of what this session ran. Deliberately NOT the resolved config: resolving
371
+ * `${VAR}` inlines secrets (e.g. `SENPI_API_KEY`), which `env-resolve.ts` forbids exporting. Keeping
372
+ * it unresolved needs no redaction and is the stabler artifact — it is also the input `configHash`
373
+ * is computed over, so blob and hash agree. See {@link IdentityEnvelope.configHash}.
374
+ */
375
+ readonly config?: Record<string, unknown>;
376
+ readonly uptimeMs?: number;
377
+ }
378
+ export type RuntimeStatePhase = "paused" | "resumed";
379
+ /**
380
+ * A runtime trading-state transition — the runtime pausing or resuming its *own* trading on a
381
+ * cap/halt. Sibling to {@link RuntimeLifecycleRecord} on a different axis: lifecycle records the
382
+ * process (started/stopped); this records whether trading is active or self-paused.
383
+ *
384
+ * `paused` corresponds to the bus's `on_strategy_self_paused` / `on_daily_limit_hit` /
385
+ * `on_drawdown_cap_hit`, which fire on a `running → paused` edge carrying the breached `metrics`.
386
+ * `resumed` is the symmetric `paused → running` re-arm; modelling it here lets the emit be added
387
+ * later without changing this type. `strategyAddress` is omitted — it lives on the identity envelope.
388
+ *
389
+ * This is the "why did the runtime stop trading" signal — for observability and for an agent
390
+ * reasoning about self-imposed halts (raise a cap, wait for daily reset, investigate drawdown).
391
+ */
392
+ export interface RuntimeStateRecord {
393
+ readonly type: "runtime_state";
394
+ readonly phase: RuntimeStatePhase;
395
+ readonly occurredAt: number;
396
+ /** Stable gate identifier (e.g. the cap/halt rule id). */
397
+ readonly gateId: string;
398
+ readonly gateName?: string;
399
+ /** Which hook produced the pause (`self_paused`|`daily_limit`|`drawdown_cap`). */
400
+ readonly source?: string;
401
+ /** Human-readable explanation with live numbers (the gate's `reason`). */
402
+ readonly reason?: string;
403
+ /** Breached-gate metrics bag (`pnlDelta`, `dailyLossLimitUsd`, `drawdownFromPeakPct`, …). */
404
+ readonly metrics?: Record<string, unknown> | null;
405
+ }
406
+ /**
407
+ * Coarse action intent of a {@link DecisionMadeRecord} — the `open`/`close`/`none` axis the
408
+ * read-side groups decisions by, derived from the decision's action type.
409
+ */
410
+ export type DecisionActionIntent = "open" | "close" | "none";
411
+ /**
412
+ * The judgment over one evaluation pass, as a discrete log event (`decision.made`). Derived from
413
+ * the same `tracking.action_result` path that builds {@link SignalEvaluatedRecord} — no new bus
414
+ * event. The trace view keeps the decision on the `llm.decision` span; this is its logs-only twin so
415
+ * a logs-only consumer (the self-learning agent) can read "what the strategy decided and why"
416
+ * without walking spans.
417
+ *
418
+ * `reasoning` is the Body (uncapped free-text). Market-context fields (`fundingRegime`/
419
+ * `marketRegime`/`markPrice`) are reserved keys: they are NOT on the `tracking.action_result`
420
+ * payload today, so 8a leaves them undefined (absent = NULL) — see the Task 8a implementation notes.
421
+ */
422
+ export interface DecisionMadeRecord {
423
+ readonly type: "decision_made";
424
+ readonly occurredAt: number;
425
+ readonly mode?: DecisionMode;
426
+ readonly byLlm: boolean;
427
+ readonly model?: string;
428
+ readonly tokensUsed?: number | null;
429
+ readonly confidence?: number;
430
+ readonly confidenceThreshold?: number;
431
+ readonly durationMs?: number;
432
+ readonly actionIntent: DecisionActionIntent;
433
+ readonly fundingRegime?: string;
434
+ readonly marketRegime?: string;
435
+ readonly markPrice?: number;
436
+ /** Full LLM reasoning prose — the Body content (uncapped, routed through Body redaction). */
437
+ readonly reasoning?: string;
438
+ }
439
+ /** Disposition of one considered signal: did it become an order, get rejected, get blocked, or error. */
440
+ export type SignalOutcomeDisposition = "accepted" | "rejected" | "blocked" | "error";
441
+ /**
442
+ * One signal's disposition, as a discrete log event (`signal.outcome`). One per evaluation in the
443
+ * pass, derived from the same `tracking.action_result` path that builds {@link SignalEvaluatedRecord}
444
+ * — no new bus event. The four-value `result` collapses the granular per-signal
445
+ * {@link SignalOutcomeResult}; the open `reasonCode` is kept verbatim for the fine-grained reason.
446
+ *
447
+ * `rawSignal` is the variable-shaped scanner evidence → the Body (redacted in the mapper). The
448
+ * scalars below are the queryable attribute surface.
449
+ */
450
+ export interface SignalOutcomeRecord {
451
+ readonly type: "signal_outcome";
452
+ readonly occurredAt: number;
453
+ readonly scannerId?: string;
454
+ readonly signalType?: string;
455
+ readonly asset: string;
456
+ readonly direction?: TradeDirection | null;
457
+ readonly score?: number;
458
+ /** Signal time, epoch ms. */
459
+ readonly signalTs?: number;
460
+ readonly factors?: Record<string, boolean>;
461
+ readonly result: SignalOutcomeDisposition;
462
+ /** The granular per-signal reason (open string, e.g. `risk_gate_COOLDOWN`, `below_confidence`). */
463
+ readonly reasonCode?: string;
464
+ readonly positionId?: string;
465
+ readonly marginAmount?: number;
466
+ readonly leverage?: number;
467
+ readonly notionalValue?: number;
468
+ readonly size?: number;
469
+ /** Reserved — unpopulated in 8a (not on the payload; see impl notes). */
470
+ readonly marginSource?: string;
471
+ readonly orderId?: string;
472
+ readonly errorName?: string;
473
+ /** The raw scanner signal payload (incl. its `meta`/`factors`) → the Body, redacted in the mapper. */
474
+ readonly rawSignal?: Record<string, unknown>;
475
+ }
476
+ /**
477
+ * One DSL exit attempt as a discrete log event (`dsl.close_attempt`) — exit attempts / venue
478
+ * failures / retries, span-only today. Derived from the existing `tracking.dsl_close_attempt` event
479
+ * (already consumed to build the {@link DslTickRecord} trace) — a second consumer for the log.
480
+ *
481
+ * No `errorName`: only `String(e)` is available at the producer emit site, so the error class name
482
+ * is omitted (see the Task 8a impl notes).
483
+ */
484
+ export interface DslCloseAttemptRecord {
485
+ readonly type: "dsl_close_attempt";
486
+ readonly occurredAt: number;
487
+ readonly positionId?: string;
488
+ readonly asset?: string;
489
+ readonly dex?: string;
490
+ /** The close reason (`closeReason` on the payload). */
491
+ readonly reason?: string;
492
+ readonly attempt?: number;
493
+ readonly result: "ok" | "error";
494
+ readonly error?: string;
495
+ }
496
+ /**
497
+ * One scan's funnel summary as a discrete log event (`scanner.summary`) — the anti-spam roll-up of
498
+ * what a scan considered and dropped. Derived from the SAME `tracking.scanner_run` payload that
499
+ * builds {@link ScannerRunRecord} (its `summary.funnel`), so no new bus event. One row per scan: the
500
+ * dropped candidates are ONE Body array, never one row per drop.
501
+ *
502
+ * `passedAssets` is a small linkage list (the survivors, each detailed by its own `signal.outcome`);
503
+ * `droppedCandidates` is the variable-shaped Body array — never a filter target, reachable only after
504
+ * the row is selected. The count attributes (`scannedCount`/`passedCount`/`droppedCount`/
505
+ * `droppedByReason`) carry the aggregate query surface.
506
+ */
507
+ export interface ScannerSummaryRecord {
508
+ readonly type: "scanner_summary";
509
+ readonly occurredAt: number;
510
+ readonly scannerId: string;
511
+ readonly scannedCount?: number;
512
+ readonly passedCount?: number;
513
+ readonly droppedCount?: number;
514
+ /** Reason → count of candidates dropped for it (bounded reason vocabulary → queryable attrs). */
515
+ readonly droppedByReason?: Record<string, number>;
516
+ /** The survivors' assets — a small linkage list to the per-signal `signal.outcome` events. */
517
+ readonly passedAssets?: readonly string[];
518
+ /** The variable Body array: `[{asset, score?, reason, factors?}, …]` — never a filter target. */
519
+ readonly droppedCandidates?: readonly Record<string, unknown>[];
520
+ }
521
+ /** Which execution fact an {@link OrderEventRecord} carries. */
522
+ export type OrderEventKind = "placed" | "filled" | "failed";
523
+ /**
524
+ * One order-execution event as a discrete log event (`order.{placed,filled,failed}`) — the venue
525
+ * execution granularity (placement vs fill, maker/taker, venue rejects) that the position-level
526
+ * `position_lifecycle` event can't carry. Emitted additively by the open/close actions at the
527
+ * submit/success/failure points (the new `tracking.order_*` bus events). `event` discriminates which
528
+ * optional fields apply.
529
+ *
530
+ * Overlap with `position_lifecycle.opened`/`.closed` is intentional: the lifecycle event is the
531
+ * settled position-level fact; `order.*` is the execution-level fact. Both are emitted; no dedupe.
532
+ *
533
+ * `limitPrice`/`fees`/`partial` are reserved-but-unpopulated in 8a — they are not in scope at the
534
+ * action's submission point (see the Task 8a impl notes). `error` on `failed` is the optional venue
535
+ * raw response → the Body.
536
+ */
537
+ export interface OrderEventRecord {
538
+ readonly type: "order_event";
539
+ readonly event: OrderEventKind;
540
+ readonly occurredAt: number;
541
+ /** Cross-flow position.id (`__positionId` on the bus payload). See {@link SignalOutcome.positionId}. */
542
+ readonly positionId?: string;
543
+ readonly orderId?: string;
544
+ readonly asset: string;
545
+ readonly direction?: TradeDirection | null;
546
+ readonly orderType?: string;
547
+ readonly size?: number;
548
+ /** Reserved — unpopulated in 8a (not in scope at the submission point; see impl notes). */
549
+ readonly limitPrice?: number;
550
+ readonly reduceOnly?: boolean;
551
+ readonly fillPrice?: number;
552
+ readonly fillSize?: number;
553
+ readonly executionAsMaker?: boolean | null;
554
+ /** Reserved — unpopulated in 8a (not in scope; see impl notes). */
555
+ readonly fees?: number;
556
+ /** Reserved — unpopulated in 8a (not in scope; see impl notes). */
557
+ readonly partial?: boolean;
558
+ readonly reason?: string;
559
+ readonly errorName?: string;
560
+ /** The optional venue raw response on `failed` → the Body. */
561
+ readonly error?: string;
562
+ }
563
+ /** Discriminated union of every record type. */
564
+ export type RecordingRecord = ScannerRunRecord | SignalEvaluatedRecord | PositionLifecycleRecord | DslTransitionRecord | DslTickRecord | RuntimeErrorRecord | RuntimeLifecycleRecord | RuntimeStateRecord | DecisionMadeRecord | SignalOutcomeRecord | ScannerSummaryRecord | DslCloseAttemptRecord | OrderEventRecord;
565
+ //# sourceMappingURL=records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/recording/records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAID,6DAA6D;AAC7D,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAEjE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,iFAAiF;IACjF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,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ract — the record types the runtime hands to a {@link RecordingEmitter}, covering
3
+ * domain events and runtime errors.
4
+ *
5
+ * Each record is one atomic "work unit": plain, immutable, serializable data with no methods or
6
+ * builder dance; variants are modelled with a discriminator field plus optionals. The types are
7
+ * transport-agnostic — nothing here knows about spans, attributes, or any wire format.
8
+ *
9
+ * Identity (service, recipe, runtime, strategy address, boot id) is stamped by the emitter and is
10
+ * never on a record — see {@link IdentityEnvelope}. Timestamps are epoch milliseconds; ISO strings
11
+ * from the bus are converted before they reach a record, so consumers never parse dates.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/recording/records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}