@senpi/runtime 3.0.6-dev.runtime-phase-2.20260630134145 → 3.0.6-dev.runtime-phase-2.20260630134327

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 (140) hide show
  1. package/dist/actions/close-position/close-position.action.d.ts +1 -1
  2. package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
  3. package/dist/actions/close-position/close-position.action.js +109 -78
  4. package/dist/actions/close-position/close-position.action.js.map +1 -1
  5. package/dist/actions/decision-engine.d.ts.map +1 -1
  6. package/dist/actions/decision-engine.js +40 -28
  7. package/dist/actions/decision-engine.js.map +1 -1
  8. package/dist/actions/event-derivation.d.ts +60 -0
  9. package/dist/actions/event-derivation.d.ts.map +1 -0
  10. package/dist/actions/event-derivation.js +179 -0
  11. package/dist/actions/event-derivation.js.map +1 -0
  12. package/dist/actions/llm-decision/anthropic-llm-decision.d.ts.map +1 -1
  13. package/dist/actions/llm-decision/anthropic-llm-decision.js +1 -2
  14. package/dist/actions/llm-decision/anthropic-llm-decision.js.map +1 -1
  15. package/dist/actions/llm-decision/openclaw-llm-decision.d.ts.map +1 -1
  16. package/dist/actions/llm-decision/openclaw-llm-decision.js +1 -2
  17. package/dist/actions/llm-decision/openclaw-llm-decision.js.map +1 -1
  18. package/dist/actions/open-position/open-position.action.d.ts +1 -1
  19. package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
  20. package/dist/actions/open-position/open-position.action.js +283 -217
  21. package/dist/actions/open-position/open-position.action.js.map +1 -1
  22. package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
  23. package/dist/actions/position-tracker/position-tracker.action.js +2 -4
  24. package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
  25. package/dist/actions/tracking-helpers.d.ts +41 -3
  26. package/dist/actions/tracking-helpers.d.ts.map +1 -1
  27. package/dist/actions/tracking-helpers.js +100 -11
  28. package/dist/actions/tracking-helpers.js.map +1 -1
  29. package/dist/dsl/monitor/create-monitor.d.ts +3 -0
  30. package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
  31. package/dist/dsl/monitor/create-monitor.js +76 -28
  32. package/dist/dsl/monitor/create-monitor.js.map +1 -1
  33. package/dist/dsl/monitor/process-one-position.d.ts +2 -1
  34. package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
  35. package/dist/dsl/monitor/process-one-position.js +84 -38
  36. package/dist/dsl/monitor/process-one-position.js.map +1 -1
  37. package/dist/dsl/plugin/index.d.ts +10 -0
  38. package/dist/dsl/plugin/index.d.ts.map +1 -1
  39. package/dist/dsl/plugin/index.js +42 -4
  40. package/dist/dsl/plugin/index.js.map +1 -1
  41. package/dist/dsl/plugin/options.d.ts +3 -0
  42. package/dist/dsl/plugin/options.d.ts.map +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +5 -2
  45. package/dist/index.js.map +1 -1
  46. package/dist/recording/otel/attributes.d.ts +2 -0
  47. package/dist/recording/otel/attributes.d.ts.map +1 -1
  48. package/dist/recording/otel/attributes.js +1 -1
  49. package/dist/recording/otel/attributes.js.map +1 -1
  50. package/dist/recording/otel/mappers.d.ts.map +1 -1
  51. package/dist/recording/otel/mappers.js +1 -0
  52. package/dist/recording/otel/mappers.js.map +1 -1
  53. package/dist/recording/records.d.ts +7 -1
  54. package/dist/recording/records.d.ts.map +1 -1
  55. package/dist/recording/wiring/record-builders.d.ts.map +1 -1
  56. package/dist/recording/wiring/record-builders.js +5 -2
  57. package/dist/recording/wiring/record-builders.js.map +1 -1
  58. package/dist/runtime/auto-update/coordinator.js +2 -2
  59. package/dist/runtime/auto-update/coordinator.js.map +1 -1
  60. package/dist/runtime/create-actions.d.ts.map +1 -1
  61. package/dist/runtime/create-actions.js +40 -15
  62. package/dist/runtime/create-actions.js.map +1 -1
  63. package/dist/runtime/create-scanner-module.d.ts +2 -1
  64. package/dist/runtime/create-scanner-module.d.ts.map +1 -1
  65. package/dist/runtime/create-scanner-module.js +2 -1
  66. package/dist/runtime/create-scanner-module.js.map +1 -1
  67. package/dist/runtime/domain-events.d.ts +43 -0
  68. package/dist/runtime/domain-events.d.ts.map +1 -0
  69. package/dist/runtime/domain-events.js +181 -0
  70. package/dist/runtime/domain-events.js.map +1 -0
  71. package/dist/runtime/lifecycle-events.d.ts +43 -0
  72. package/dist/runtime/lifecycle-events.d.ts.map +1 -0
  73. package/dist/runtime/lifecycle-events.js +139 -0
  74. package/dist/runtime/lifecycle-events.js.map +1 -0
  75. package/dist/runtime/notifications.js +2 -2
  76. package/dist/runtime/notifications.js.map +1 -1
  77. package/dist/runtime/runtime-schema.d.ts +120 -120
  78. package/dist/runtime/runtime.d.ts +11 -0
  79. package/dist/runtime/runtime.d.ts.map +1 -1
  80. package/dist/runtime/runtime.js +159 -88
  81. package/dist/runtime/runtime.js.map +1 -1
  82. package/dist/runtime/strategy-lifecycle.d.ts.map +1 -1
  83. package/dist/runtime/strategy-lifecycle.js +13 -1
  84. package/dist/runtime/strategy-lifecycle.js.map +1 -1
  85. package/dist/runtime-api/routes/signals.d.ts +1 -1
  86. package/dist/runtime-api/routes/signals.d.ts.map +1 -1
  87. package/dist/runtime-api/routes/signals.js +2 -8
  88. package/dist/runtime-api/routes/signals.js.map +1 -1
  89. package/dist/scanners/engine/data-providers.d.ts +3 -0
  90. package/dist/scanners/engine/data-providers.d.ts.map +1 -1
  91. package/dist/scanners/engine/data-providers.js.map +1 -1
  92. package/dist/scanners/engine/engine.d.ts +18 -0
  93. package/dist/scanners/engine/engine.d.ts.map +1 -1
  94. package/dist/scanners/engine/engine.js +93 -2
  95. package/dist/scanners/engine/engine.js.map +1 -1
  96. package/dist/scanners/engine/input-resolver.d.ts.map +1 -1
  97. package/dist/scanners/engine/input-resolver.js +9 -7
  98. package/dist/scanners/engine/input-resolver.js.map +1 -1
  99. package/dist/scanners/runtime-module.d.ts +3 -0
  100. package/dist/scanners/runtime-module.d.ts.map +1 -1
  101. package/dist/scanners/runtime-module.js +1 -0
  102. package/dist/scanners/runtime-module.js.map +1 -1
  103. package/dist/senpi/client.d.ts.map +1 -1
  104. package/dist/senpi/client.js +7 -5
  105. package/dist/senpi/client.js.map +1 -1
  106. package/dist/skills-manager/coordinator.js +3 -3
  107. package/dist/skills-manager/coordinator.js.map +1 -1
  108. package/dist/telemetry/otel-sdk.d.ts +8 -2
  109. package/dist/telemetry/otel-sdk.d.ts.map +1 -1
  110. package/dist/telemetry/otel-sdk.js +17 -4
  111. package/dist/telemetry/otel-sdk.js.map +1 -1
  112. package/dist/telemetry/trace-identity.d.ts +32 -0
  113. package/dist/telemetry/trace-identity.d.ts.map +1 -0
  114. package/dist/telemetry/trace-identity.js +59 -0
  115. package/dist/telemetry/trace-identity.js.map +1 -0
  116. package/dist/telemetry/tracing.d.ts +32 -0
  117. package/dist/telemetry/tracing.d.ts.map +1 -0
  118. package/dist/telemetry/tracing.js +70 -0
  119. package/dist/telemetry/tracing.js.map +1 -0
  120. package/dist/tracking/context.d.ts +6 -0
  121. package/dist/tracking/context.d.ts.map +1 -1
  122. package/dist/tracking/context.js.map +1 -1
  123. package/dist/tracking/spans/plugin-span-tracker.d.ts.map +1 -1
  124. package/dist/tracking/spans/plugin-span-tracker.js +12 -12
  125. package/dist/tracking/spans/plugin-span-tracker.js.map +1 -1
  126. package/dist/tracking/spans/redact-pii.d.ts +3 -3
  127. package/dist/tracking/spans/redact-pii.d.ts.map +1 -1
  128. package/dist/tracking/spans/redact-pii.js +6 -7
  129. package/dist/tracking/spans/redact-pii.js.map +1 -1
  130. package/dist/types/scanner.d.ts +2 -0
  131. package/dist/types/scanner.d.ts.map +1 -1
  132. package/dist/utils/event-catalog.d.ts +269 -0
  133. package/dist/utils/event-catalog.d.ts.map +1 -0
  134. package/dist/utils/event-catalog.js +91 -0
  135. package/dist/utils/event-catalog.js.map +1 -0
  136. package/dist/utils/logger.d.ts +58 -5
  137. package/dist/utils/logger.d.ts.map +1 -1
  138. package/dist/utils/logger.js +359 -27
  139. package/dist/utils/logger.js.map +1 -1
  140. package/package.json +5 -1
@@ -1 +1 @@
1
- {"version":3,"file":"create-scanner-module.js","sourceRoot":"","sources":["../../src/runtime/create-scanner-module.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAAqB,EACrB,QAAgB,EAChB,SAAgC,EAChC,MAAsB;IAEtB,MAAM,QAAQ,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;QACvC,yEAAyE;QACzE,+EAA+E;QAC/E,8EAA8E;QAC9E,8EAA8E;QAC9E,MAAM,UAAU,GAAG,EAAE,CAAC,IAAI,KAAK,kBAAkB,CAAC;QAClD,MAAM,cAAc,GAAG,UAAU;YAC/B,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,kBAAkB,IAAI,EAAE,EAAE;YACzC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC;QACd,QAAQ,CAAC,IAAI,CACX,eAAe,CAAC,aAAa,CAC3B,EAAE,CAAC,IAAI,EACP,EAAE,CAAC,IAAI,EACP,cAAc,EACd,EAAE,CAAC,UAAU,EACb,UAAU;YACR,CAAC,CAAC;gBACE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;gBAC1C,SAAS,EAAE,EAAE,CAAC,SAAS;gBACvB,gBAAgB,EAAE,EAA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EAAE,CAAC,IAAI,KAAK,kBAAkB,CAAC;QAClD,MAAM,cAAc,GAAG,UAAU;YAC/B,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,kBAAkB,IAAI,EAAE,EAAE;YACzC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC;QACd,QAAQ,CAAC,IAAI,CACX,eAAe,CAAC,aAAa,CAC3B,EAAE,CAAC,IAAI,EACP,EAAE,CAAC,IAAI,EACP,cAAc,EACd,EAAE,CAAC,UAAU,EACb,UAAU;YACR,CAAC,CAAC;gBACE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;gBAC1C,SAAS,EAAE,EAAE,CAAC,SAAS;gBACvB,gBAAgB,EAAE,EAAE,CAAC,kBAAkB;aACxC;YACH,CAAC,CAAC,SAAS,CACd,CACF,CAAC;IACJ,CAAC;IACD,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACxD,MAAM,WAAW,GAAG,uBAAuB,CACzC,MAAM,EACN,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,EACrD,MAAM,CACP,CAAC;IACF,OAAO,0BAA0B,CAAC;QAChC,QAAQ;QACR,QAAQ;QACR,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;QAC5D,WAAW;QACX,SAAS;QACT,MAAM;QACN,QAAQ;KACT,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The event-log half of the real domain events on the bus: `position.*` lifecycle and `dsl.*`
3
+ * transitions. Unlike the action-origin events (order/decision/outcome), these are first-class facts
4
+ * already broadcast on the `SenpiEventBus` — so one thin subscriber maps each to a `logger.event`,
5
+ * reusing the pure recording builders ({@link buildPositionLifecycle} / {@link buildDslTransition})
6
+ * for the field projection rather than re-parsing the payloads.
7
+ *
8
+ * Why a subscriber, not at-site: the bus is a synchronous `EventEmitter`, so a handler runs in the
9
+ * emitter's async context — it inherits the active span (trace_id/span_id auto-stamp) and the
10
+ * `trackingContext` identity exactly as an at-site emit would. Position events fire inside the signal
11
+ * flow; `dsl.*` transitions fire inside the monitor tick, which the DSL plugin wraps in a
12
+ * `trackingContext` so these carry identity too.
13
+ *
14
+ * All fields here are safe scalars — these events carry no free-text, so none use the `redact` slot.
15
+ */
16
+ import type { SenpiEventBus } from "../types/event-bus.js";
17
+ import type { DslTransitionKind, PositionLifecycleEvent } from "../recording/records.js";
18
+ import { type EmittableEvent } from "../actions/event-derivation.js";
19
+ /**
20
+ * Map a `position.*` lifecycle record to its event. An `opened` whose `reconciliation_source` is
21
+ * `externally_detected` is surfaced as `position.reconciled` — a gap-pass position the runtime did
22
+ * not open — so the two are distinguishable downstream; everything else maps one-to-one. All `info`.
23
+ */
24
+ declare function buildPositionLifecycleEvent(event: PositionLifecycleEvent, payload: unknown, nowMs: number): EmittableEvent | null;
25
+ /** Map a `dsl.*` transition record to its event. All `info` — failure rides `dsl.closed`'s reason. */
26
+ declare function buildDslTransitionEvent(transition: DslTransitionKind, payload: unknown, nowMs: number): EmittableEvent | null;
27
+ export interface DomainEventSubscriber {
28
+ /** Unsubscribe every handler. Idempotent. */
29
+ dispose(): void;
30
+ }
31
+ /**
32
+ * Subscribe the event log to the `position.*` / `dsl.*` domain events on the bus. Each handler builds
33
+ * its event through {@link emitEvent}'s guard, so a throwing builder or a telemetry failure can never
34
+ * propagate back through `bus.emit` into the trading path. Mirrors the recording subscriber's wiring;
35
+ * attach only when telemetry is enabled (per-event assembly on the serial path is dead work otherwise).
36
+ */
37
+ export declare function createDomainEventSubscriber(bus: SenpiEventBus): DomainEventSubscriber;
38
+ export declare const __test: {
39
+ buildPositionLifecycleEvent: typeof buildPositionLifecycleEvent;
40
+ buildDslTransitionEvent: typeof buildDslTransitionEvent;
41
+ };
42
+ export {};
43
+ //# sourceMappingURL=domain-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-events.d.ts","sourceRoot":"","sources":["../../src/runtime/domain-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,OAAO,KAAK,EACV,iBAAiB,EAEjB,sBAAsB,EAEvB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAkDhF;;;;GAIG;AACH,iBAAS,2BAA2B,CAClC,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,IAAI,CA+BvB;AAwBD,sGAAsG;AACtG,iBAAS,uBAAuB,CAC9B,UAAU,EAAE,iBAAiB,EAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,IAAI,CA0BvB;AAED,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,aAAa,GAAG,qBAAqB,CA6BrF;AAGD,eAAO,MAAM,MAAM;;;CAA2D,CAAC"}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * The event-log half of the real domain events on the bus: `position.*` lifecycle and `dsl.*`
3
+ * transitions. Unlike the action-origin events (order/decision/outcome), these are first-class facts
4
+ * already broadcast on the `SenpiEventBus` — so one thin subscriber maps each to a `logger.event`,
5
+ * reusing the pure recording builders ({@link buildPositionLifecycle} / {@link buildDslTransition})
6
+ * for the field projection rather than re-parsing the payloads.
7
+ *
8
+ * Why a subscriber, not at-site: the bus is a synchronous `EventEmitter`, so a handler runs in the
9
+ * emitter's async context — it inherits the active span (trace_id/span_id auto-stamp) and the
10
+ * `trackingContext` identity exactly as an at-site emit would. Position events fire inside the signal
11
+ * flow; `dsl.*` transitions fire inside the monitor tick, which the DSL plugin wraps in a
12
+ * `trackingContext` so these carry identity too.
13
+ *
14
+ * All fields here are safe scalars — these events carry no free-text, so none use the `redact` slot.
15
+ */
16
+ import { buildDslTransition, buildPositionLifecycle, } from "../recording/wiring/record-builders.js";
17
+ import { EVENT_NAME, eventAttrs, fmtThousands } from "../utils/event-catalog.js";
18
+ import { createLogger } from "../utils/logger.js";
19
+ import { emitEvent } from "../actions/event-derivation.js";
20
+ const eventLog = createLogger("[senpi-core][domain-events]");
21
+ /** `on_position_*` bus event → the lifecycle discriminator the record builder expects. */
22
+ const POSITION_EVENTS = {
23
+ on_position_opened: "opened",
24
+ on_position_closed: "closed",
25
+ on_position_flipped: "flipped",
26
+ on_position_increased: "increased",
27
+ on_position_decreased: "decreased",
28
+ };
29
+ /** `dsl.*` bus event → the transition discriminator. `dsl.close_attempt` stays a 9b trace unit. */
30
+ const DSL_EVENTS = {
31
+ "dsl.created": "created",
32
+ "dsl.tier_advanced": "tier_advanced",
33
+ "dsl.phase_changed": "phase_changed",
34
+ "dsl.sl_updated": "sl_updated",
35
+ "dsl.close_pending": "close_pending",
36
+ "dsl.closed": "closed",
37
+ "dsl.deleted": "deleted",
38
+ };
39
+ const DIRECTION_TAG = (dir) => (dir ? ` ${dir}` : "");
40
+ const SIZE_AT = (price) => (price !== undefined ? ` @ ${fmtThousands(price)}` : "");
41
+ /** The queryable scalar surface shared by every `position.*` event (fields absent on a variant drop out). */
42
+ function positionAttributes(rec) {
43
+ return eventAttrs({
44
+ "senpi.position.id": rec.positionId,
45
+ "senpi.asset": rec.asset,
46
+ "senpi.dex": rec.dex,
47
+ "senpi.position.direction": rec.direction ?? undefined,
48
+ "senpi.position.entry_price": rec.entryPrice,
49
+ "senpi.position.size": rec.size,
50
+ "senpi.position.leverage": rec.leverage,
51
+ "senpi.position.margin": rec.margin,
52
+ "senpi.position.unrealized_pnl": rec.unrealizedPnl,
53
+ "senpi.position.roe": rec.roe,
54
+ "senpi.position.close_reason": rec.closeReason,
55
+ "senpi.position.closed_price": rec.closedPrice,
56
+ "senpi.position.closed_size": rec.closedSize,
57
+ "senpi.position.size_delta": rec.sizeDelta,
58
+ "senpi.position.previous_size": rec.previousSize,
59
+ "senpi.position.new_asset": rec.newAsset,
60
+ "senpi.position.reconciliation_source": rec.reconciliationSource,
61
+ });
62
+ }
63
+ /**
64
+ * Map a `position.*` lifecycle record to its event. An `opened` whose `reconciliation_source` is
65
+ * `externally_detected` is surfaced as `position.reconciled` — a gap-pass position the runtime did
66
+ * not open — so the two are distinguishable downstream; everything else maps one-to-one. All `info`.
67
+ */
68
+ function buildPositionLifecycleEvent(event, payload, nowMs) {
69
+ const rec = buildPositionLifecycle(event, payload, nowMs);
70
+ if (rec === null)
71
+ return null;
72
+ const attributes = positionAttributes(rec);
73
+ const head = `${rec.asset}${DIRECTION_TAG(rec.direction)}`;
74
+ const base = { level: "info", attributes };
75
+ switch (rec.event) {
76
+ case "opened": {
77
+ const sized = rec.size !== undefined ? ` ${rec.size}` : "";
78
+ if (rec.reconciliationSource === "externally_detected") {
79
+ return { name: EVENT_NAME.positionReconciled, body: `Reconciled ${head}${sized} — externally detected`, ...base };
80
+ }
81
+ return { name: EVENT_NAME.positionOpened, body: `Opened ${head}${sized}${SIZE_AT(rec.entryPrice)}`, ...base };
82
+ }
83
+ case "closed":
84
+ return {
85
+ name: EVENT_NAME.positionClosed,
86
+ body: `Closed ${head}${SIZE_AT(rec.closedPrice)}${rec.closeReason ? ` (${rec.closeReason})` : ""}`,
87
+ ...base,
88
+ };
89
+ case "increased":
90
+ return { name: EVENT_NAME.positionIncreased, body: `Increased ${head}${rec.sizeDelta !== undefined ? ` by ${rec.sizeDelta}` : ""}`, ...base };
91
+ case "decreased":
92
+ return { name: EVENT_NAME.positionDecreased, body: `Decreased ${head}${rec.sizeDelta !== undefined ? ` by ${rec.sizeDelta}` : ""}`, ...base };
93
+ case "flipped":
94
+ return { name: EVENT_NAME.positionFlipped, body: `Flipped ${head}${rec.newAsset ? ` → ${rec.newAsset}` : ""}`, ...base };
95
+ default:
96
+ // `open_order_submitted` is not an event-log event (not subscribed); ignore defensively.
97
+ return null;
98
+ }
99
+ }
100
+ /** The queryable scalar surface shared by every `dsl.*` transition (fields absent on a variant drop out). */
101
+ function dslAttributes(rec) {
102
+ return eventAttrs({
103
+ "senpi.position.id": rec.positionId,
104
+ "senpi.asset": rec.asset,
105
+ "senpi.dex": rec.dex,
106
+ "senpi.position.direction": rec.direction ?? undefined,
107
+ "senpi.dsl.preset": rec.preset,
108
+ "senpi.dsl.phase": rec.phase,
109
+ "senpi.dsl.tier_index": rec.tierIndex ?? undefined,
110
+ "senpi.dsl.floor_price": rec.floorPrice,
111
+ "senpi.dsl.new_floor_price": rec.newFloorPrice,
112
+ "senpi.dsl.new_sl_price": rec.newSLPrice,
113
+ "senpi.dsl.sl_order_id": rec.slOrderId,
114
+ "senpi.dsl.current_roe": rec.currentROE,
115
+ "senpi.dsl.peak_roe": rec.peakROE,
116
+ "senpi.dsl.locked_profit_pct": rec.lockedProfitPct,
117
+ "senpi.dsl.close_reason": rec.closeReason,
118
+ "senpi.dsl.attempt": rec.attempt,
119
+ });
120
+ }
121
+ /** Map a `dsl.*` transition record to its event. All `info` — failure rides `dsl.closed`'s reason. */
122
+ function buildDslTransitionEvent(transition, payload, nowMs) {
123
+ const rec = buildDslTransition(transition, payload, nowMs);
124
+ if (rec === null)
125
+ return null;
126
+ const attributes = dslAttributes(rec);
127
+ const head = rec.asset;
128
+ const base = { level: "info", attributes };
129
+ switch (rec.transition) {
130
+ case "created":
131
+ return { name: EVENT_NAME.dslCreated, body: `DSL armed ${head}${rec.preset ? ` (${rec.preset})` : ""}`, ...base };
132
+ case "tier_advanced":
133
+ return { name: EVENT_NAME.dslTierAdvanced, body: `DSL tier → ${rec.tierIndex ?? "?"} on ${head}`, ...base };
134
+ case "phase_changed":
135
+ return { name: EVENT_NAME.dslPhaseChanged, body: `DSL phase → ${rec.phase ?? "?"} on ${head}`, ...base };
136
+ case "sl_updated":
137
+ return { name: EVENT_NAME.dslSlUpdated, body: `DSL stop → ${rec.newSLPrice !== undefined ? fmtThousands(rec.newSLPrice) : "?"} on ${head}`, ...base };
138
+ case "close_pending":
139
+ return { name: EVENT_NAME.dslClosePending, body: `DSL close pending ${head}${rec.attempt !== undefined ? ` (attempt ${rec.attempt})` : ""}`, ...base };
140
+ case "closed":
141
+ return { name: EVENT_NAME.dslClosed, body: `DSL closed ${head}${rec.closeReason ? ` (${rec.closeReason})` : ""}`, ...base };
142
+ case "deleted":
143
+ return { name: EVENT_NAME.dslDeleted, body: `DSL deleted ${head}`, ...base };
144
+ default:
145
+ // `settings_updated` has no catalog event (not subscribed); ignore defensively.
146
+ return null;
147
+ }
148
+ }
149
+ /**
150
+ * Subscribe the event log to the `position.*` / `dsl.*` domain events on the bus. Each handler builds
151
+ * its event through {@link emitEvent}'s guard, so a throwing builder or a telemetry failure can never
152
+ * propagate back through `bus.emit` into the trading path. Mirrors the recording subscriber's wiring;
153
+ * attach only when telemetry is enabled (per-event assembly on the serial path is dead work otherwise).
154
+ */
155
+ export function createDomainEventSubscriber(bus) {
156
+ const handlers = [];
157
+ function subscribe(event, handler) {
158
+ bus.on(event, handler);
159
+ handlers.push({ event, handler });
160
+ }
161
+ for (const [event, lifecycleEvent] of Object.entries(POSITION_EVENTS)) {
162
+ subscribe(event, (payload) => emitEvent(eventLog, () => buildPositionLifecycleEvent(lifecycleEvent, payload, Date.now())));
163
+ }
164
+ for (const [event, transition] of Object.entries(DSL_EVENTS)) {
165
+ subscribe(event, (payload) => emitEvent(eventLog, () => buildDslTransitionEvent(transition, payload, Date.now())));
166
+ }
167
+ let disposed = false;
168
+ return {
169
+ dispose() {
170
+ if (disposed)
171
+ return;
172
+ disposed = true;
173
+ for (const { event, handler } of handlers)
174
+ bus.off(event, handler);
175
+ handlers.length = 0;
176
+ },
177
+ };
178
+ }
179
+ // Exported for unit tests — the pure record→event projection, independent of the bus wiring.
180
+ export const __test = { buildPositionLifecycleEvent, buildDslTransitionEvent };
181
+ //# sourceMappingURL=domain-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-events.js","sourceRoot":"","sources":["../../src/runtime/domain-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAOhD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAiB,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAuB,MAAM,gCAAgC,CAAC;AAEhF,MAAM,QAAQ,GAAG,YAAY,CAAC,6BAA6B,CAAC,CAAC;AAE7D,0FAA0F;AAC1F,MAAM,eAAe,GAA2C;IAC9D,kBAAkB,EAAE,QAAQ;IAC5B,kBAAkB,EAAE,QAAQ;IAC5B,mBAAmB,EAAE,SAAS;IAC9B,qBAAqB,EAAE,WAAW;IAClC,qBAAqB,EAAE,WAAW;CACnC,CAAC;AAEF,mGAAmG;AACnG,MAAM,UAAU,GAAsC;IACpD,aAAa,EAAE,SAAS;IACxB,mBAAmB,EAAE,eAAe;IACpC,mBAAmB,EAAE,eAAe;IACpC,gBAAgB,EAAE,YAAY;IAC9B,mBAAmB,EAAE,eAAe;IACpC,YAAY,EAAE,QAAQ;IACtB,aAAa,EAAE,SAAS;CACzB,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,GAA8B,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACzF,MAAM,OAAO,GAAG,CAAC,KAAyB,EAAU,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAA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AAC,KAAK,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7D,SAAS,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAC3B,SAAS,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,uBAAuB,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CACpF,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO;QACL,OAAO;YACL,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,GAAG,IAAI,CAAC;YAChB,KAAK,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,QAAQ;gBAAE,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACnE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,6FAA6F;AAC7F,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Pure builders for the scanner-summary and runtime-lifecycle event-log events. Each returns a fully
3
+ * built {@link EmittableEvent} (or `null` when the source yields nothing), so the runtime emits with a
4
+ * single `logger.event` call. Bodies are deterministic narratives; every attribute is a safe scalar.
5
+ *
6
+ * The scanner-summary funnel selection is reused from the recording builder ({@link buildScannerSummary})
7
+ * — no reimplementation of the drop classification.
8
+ */
9
+ import { EVENT_NAME } from "../utils/event-catalog.js";
10
+ import type { EmittableEvent } from "../actions/event-derivation.js";
11
+ /**
12
+ * `scanner.summary` from the same `tracking.scanner_run` payload the scanner-complete handler emits.
13
+ * `null` when the scan considered no candidates (matches the recording builder's anti-spam grain).
14
+ * Dropped candidates are market data → safe count attributes (`dropped_count` + by-reason), never
15
+ * `redact`.
16
+ */
17
+ export declare function buildScannerSummaryEvent(payload: unknown, nowMs: number): EmittableEvent<typeof EVENT_NAME.scannerSummary> | null;
18
+ export interface RuntimeStartedInput {
19
+ /** Strategy wallet — stamped so out-of-flow lifecycle events route to the per-strategy event store. */
20
+ readonly address?: string;
21
+ readonly recipeName?: string;
22
+ readonly recipeVersion?: string | number;
23
+ readonly runtimeVersion?: string;
24
+ readonly scannerCount: number;
25
+ readonly actionCount: number;
26
+ readonly hasDsl: boolean;
27
+ /** Raw, pre-env-resolution config — the form the `senpi.config.hash` is computed over. */
28
+ readonly unresolvedConfig?: Record<string, unknown>;
29
+ }
30
+ /**
31
+ * `runtime.started` — carries the UNRESOLVED config hash (the form the recording identity hashes), so
32
+ * the printed hash matches `senpi.config.hash` on the rows. Emitted at every `Runtime.start()`.
33
+ */
34
+ export declare function buildRuntimeStartedEvent(input: RuntimeStartedInput): EmittableEvent<typeof EVENT_NAME.runtimeStarted>;
35
+ /** `runtime.stopped` — clean shutdown, with uptime. */
36
+ export declare function buildRuntimeStoppedEvent(runtimeVersion: string | undefined, uptimeMs: number, address?: string): EmittableEvent<typeof EVENT_NAME.runtimeStopped>;
37
+ /** `runtime.paused` — a risk gate tripped a running→paused transition. WARN. */
38
+ export declare function buildRuntimePausedEvent(gateId: string | undefined, gateName: string | undefined, reason: string | undefined, address?: string): EmittableEvent<typeof EVENT_NAME.runtimePaused>;
39
+ /** `runtime.resumed` — a previously-tripped risk gate cleared, re-arming a paused→running transition. */
40
+ export declare function buildRuntimeResumedEvent(gateId: string | undefined, gateName: string | undefined, address?: string): EmittableEvent<typeof EVENT_NAME.runtimeResumed>;
41
+ /** `runtime.error` — an uncaught signal-processing error. ERROR; the message rides `redact`. */
42
+ export declare function buildRuntimeErrorEvent(phase: string, scannerId: string | undefined, message: string): EmittableEvent<typeof EVENT_NAME.runtimeError>;
43
+ //# sourceMappingURL=lifecycle-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-events.d.ts","sourceRoot":"","sources":["../../src/runtime/lifecycle-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SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,aAAa,CAAC,CAY/L;AAED,yGAAyG;AACzG,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,cAAc,CAAC,CAYrK;AAED,gGAAgG;AAChG,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,YAAY,CAAC,CAWpJ"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Pure builders for the scanner-summary and runtime-lifecycle event-log events. Each returns a fully
3
+ * built {@link EmittableEvent} (or `null` when the source yields nothing), so the runtime emits with a
4
+ * single `logger.event` call. Bodies are deterministic narratives; every attribute is a safe scalar.
5
+ *
6
+ * The scanner-summary funnel selection is reused from the recording builder ({@link buildScannerSummary})
7
+ * — no reimplementation of the drop classification.
8
+ */
9
+ import { buildScannerSummary } from "../recording/wiring/record-builders.js";
10
+ import { computeConfigHash } from "../recording/wiring/identity.js";
11
+ import { EVENT_NAME, eventAttrs } from "../utils/event-catalog.js";
12
+ /** Distinct dropped-reason attribute keys kept on a scanner.summary; the rest fold into `…dropped.other`. */
13
+ const MAX_DROP_REASON_KEYS = 12;
14
+ /**
15
+ * `scanner.summary` from the same `tracking.scanner_run` payload the scanner-complete handler emits.
16
+ * `null` when the scan considered no candidates (matches the recording builder's anti-spam grain).
17
+ * Dropped candidates are market data → safe count attributes (`dropped_count` + by-reason), never
18
+ * `redact`.
19
+ */
20
+ export function buildScannerSummaryEvent(payload, nowMs) {
21
+ const rec = buildScannerSummary(payload, nowMs);
22
+ if (rec === null)
23
+ return null;
24
+ // The record always populates these counts (its optional typing notwithstanding); fall back so the
25
+ // counts — required attributes — are always defined, and reuse the same values in the body.
26
+ const passed = rec.passedCount ?? 0;
27
+ const dropped = rec.droppedCount ?? 0;
28
+ const total = rec.scannedCount ?? passed + dropped;
29
+ const attributes = eventAttrs({
30
+ "senpi.scanner.id": rec.scannerId,
31
+ "senpi.scanner.scanned_count": total,
32
+ "senpi.scanner.passed_count": passed,
33
+ "senpi.scanner.dropped_count": dropped,
34
+ });
35
+ // By-reason drop counts → queryable attributes. A scanner's reason vocabulary is normally a small
36
+ // fixed set, but it is an open producer-controlled string, so the distinct keys are capped: a
37
+ // scanner that ever templates a value into its reason can't explode attribute-key cardinality on
38
+ // the collector. Past the cap the remainder folds into one overflow bucket.
39
+ if (rec.droppedByReason) {
40
+ const byReason = Object.entries(rec.droppedByReason).sort((a, b) => b[1] - a[1]);
41
+ let overflow = 0;
42
+ byReason.forEach(([reason, count], i) => {
43
+ if (i < MAX_DROP_REASON_KEYS)
44
+ attributes[`senpi.scanner.dropped.${reason}`] = count;
45
+ else
46
+ overflow += count;
47
+ });
48
+ if (overflow > 0)
49
+ attributes["senpi.scanner.dropped.other"] = overflow;
50
+ }
51
+ return {
52
+ name: EVENT_NAME.scannerSummary,
53
+ level: "info",
54
+ body: `${rec.scannerId}: ${passed}/${total} passed (${dropped} dropped)`,
55
+ attributes,
56
+ };
57
+ }
58
+ /**
59
+ * `runtime.started` — carries the UNRESOLVED config hash (the form the recording identity hashes), so
60
+ * the printed hash matches `senpi.config.hash` on the rows. Emitted at every `Runtime.start()`.
61
+ */
62
+ export function buildRuntimeStartedEvent(input) {
63
+ const hash = computeConfigHash(input.unresolvedConfig);
64
+ const version = input.recipeVersion !== undefined ? String(input.recipeVersion) : undefined;
65
+ const attributes = eventAttrs({
66
+ "senpi.strategy.address": input.address,
67
+ "senpi.recipe.name": input.recipeName,
68
+ "senpi.recipe.version": version,
69
+ "senpi.config.hash": hash,
70
+ "senpi.runtime.version": input.runtimeVersion,
71
+ "senpi.runtime.scanner_count": input.scannerCount,
72
+ "senpi.runtime.action_count": input.actionCount,
73
+ "senpi.runtime.has_dsl": input.hasDsl,
74
+ });
75
+ const name = input.recipeName ?? "runtime";
76
+ const versionTag = version ? ` v${version}` : "";
77
+ const hashTag = hash ? `, config ${hash.slice(0, 7)}…` : "";
78
+ return {
79
+ name: EVENT_NAME.runtimeStarted,
80
+ level: "info",
81
+ body: `Runtime started: ${name}${versionTag}, ${input.scannerCount} scanners${hashTag}`,
82
+ attributes,
83
+ };
84
+ }
85
+ /** `runtime.stopped` — clean shutdown, with uptime. */
86
+ export function buildRuntimeStoppedEvent(runtimeVersion, uptimeMs, address) {
87
+ return {
88
+ name: EVENT_NAME.runtimeStopped,
89
+ level: "info",
90
+ body: `Runtime stopped after ${Math.round(uptimeMs / 1000)}s`,
91
+ attributes: eventAttrs({
92
+ "senpi.strategy.address": address,
93
+ "senpi.runtime.version": runtimeVersion,
94
+ "senpi.runtime.uptime_ms": uptimeMs,
95
+ }),
96
+ };
97
+ }
98
+ /** `runtime.paused` — a risk gate tripped a running→paused transition. WARN. */
99
+ export function buildRuntimePausedEvent(gateId, gateName, reason, address) {
100
+ const label = gateName ?? gateId ?? "gate";
101
+ return {
102
+ name: EVENT_NAME.runtimePaused,
103
+ level: "warn",
104
+ body: `Runtime paused: ${label}${reason ? ` — ${reason}` : ""}`,
105
+ attributes: eventAttrs({
106
+ "senpi.strategy.address": address,
107
+ "senpi.gate.id": gateId,
108
+ "senpi.gate.name": gateName,
109
+ }),
110
+ };
111
+ }
112
+ /** `runtime.resumed` — a previously-tripped risk gate cleared, re-arming a paused→running transition. */
113
+ export function buildRuntimeResumedEvent(gateId, gateName, address) {
114
+ const label = gateName ?? gateId ?? "gate";
115
+ return {
116
+ name: EVENT_NAME.runtimeResumed,
117
+ level: "info",
118
+ body: `Runtime resumed: ${label}`,
119
+ attributes: eventAttrs({
120
+ "senpi.strategy.address": address,
121
+ "senpi.gate.id": gateId,
122
+ "senpi.gate.name": gateName,
123
+ }),
124
+ };
125
+ }
126
+ /** `runtime.error` — an uncaught signal-processing error. ERROR; the message rides `redact`. */
127
+ export function buildRuntimeErrorEvent(phase, scannerId, message) {
128
+ return {
129
+ name: EVENT_NAME.runtimeError,
130
+ level: "error",
131
+ body: `Runtime error in ${phase}`,
132
+ attributes: eventAttrs({
133
+ "senpi.runtime.phase": phase,
134
+ "senpi.scanner.id": scannerId,
135
+ }),
136
+ redact: { error: message },
137
+ };
138
+ }
139
+ //# sourceMappingURL=lifecycle-events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle-events.js","sourceRoot":"","sources":["../../src/runtime/lifecycle-events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAiB,MAAM,2BAA2B,CAAC;AAGlF,6GAA6G;AAC7G,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAgB,EAAE,KAAa;IACtE,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAChD,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAE9B,mGAAmG;IACnG,4FAA4F;IAC5F,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,IAAI,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,IAAI,MAAM,GAAG,OAAO,CAAC;IAEnD,MAAM,UAAU,GAAG,UAAU,CAA6C;QACxE,kBAAkB,EAAE,GAAG,CAAC,SAAS;QACjC,6BAA6B,EAAE,KAAK;QACpC,4BAA4B,EAAE,MAAM;QACpC,6BAA6B,EAAE,OAAO;KACvC,CAAC,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AG,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC;IAC3C,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,aAAa;QAC9B,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,mBAAmB,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/D,UAAU,EAAE,UAAU,CAA4C;YAChE,wBAAwB,EAAE,OAAO;YACjC,eAAe,EAAE,MAAM;YACvB,iBAAiB,EAAE,QAAQ;SAC5B,CAAC;KACH,CAAC;AACJ,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,wBAAwB,CAAC,MAA0B,EAAE,QAA4B,EAAE,OAAgB;IACjH,MAAM,KAAK,GAAG,QAAQ,IAAI,MAAM,IAAI,MAAM,CAAC;IAC3C,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,cAAc;QAC/B,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,oBAAoB,KAAK,EAAE;QACjC,UAAU,EAAE,UAAU,CAA6C;YACjE,wBAAwB,EAAE,OAAO;YACjC,eAAe,EAAE,MAAM;YACvB,iBAAiB,EAAE,QAAQ;SAC5B,CAAC;KACH,CAAC;AACJ,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,sBAAsB,CAAC,KAAa,EAAE,SAA6B,EAAE,OAAe;IAClG,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,YAAY;QAC7B,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,oBAAoB,KAAK,EAAE;QACjC,UAAU,EAAE,UAAU,CAA2C;YAC/D,qBAAqB,EAAE,KAAK;YAC5B,kBAAkB,EAAE,SAAS;SAC9B,CAAC;QACF,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE;KAC3B,CAAC;AACJ,CAAC"}
@@ -49,7 +49,7 @@ export function createNotificationService(options) {
49
49
  return;
50
50
  }
51
51
  catch (err) {
52
- logger.warn(`MCP transport failed: ${err instanceof Error ? err.message : String(err)}. Falling back to Gateway HTTP.`);
52
+ logger.warn("MCP transport failed; falling back to Gateway HTTP", err);
53
53
  }
54
54
  }
55
55
  // 2. HTTP Gateway Tool Invocation (Matches your LLM Engine)
@@ -82,7 +82,7 @@ export function createNotificationService(options) {
82
82
  return;
83
83
  }
84
84
  catch (err) {
85
- logger.warn(`Gateway tool invocation failed: ${err instanceof Error ? err.message : String(err)}`);
85
+ logger.warn("Gateway tool invocation failed", err);
86
86
  }
87
87
  return;
88
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/runtime/notifications.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAA6B,MAAM,sBAAsB,CAAC;AAExF,MAAM,MAAM,GAAG,YAAY,CAAC,6BAA6B,CAAC,CAAC;AAU3D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,+BAA+B,CAC7C,UAAkB,EAClB,GAA0B;IAE1B,OAAO,qBAAqB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC;AAC5D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAoC;IAC5E,MAAM,MAAM,GAAG,OAAO,OAAO,EAAE,gBAAgB,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3G,MAAM,YAAY,GAAG,OAAO,EAAE,YAAY,CAAC;IAC3C,MAAM,UAAU,GAAG,OAAO,EAAE,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,wBAAwB,CAAC;IACxG,MAAM,YAAY,GAAG,OAAO,EAAE,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IAElF,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,6BAA6B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