@senpi/runtime 3.0.108 → 3.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/action-events.d.ts +21 -7
- package/dist/actions/action-events.d.ts.map +1 -1
- package/dist/actions/action-events.js +54 -26
- package/dist/actions/action-events.js.map +1 -1
- package/dist/actions/action-runtime-module.d.ts.map +1 -1
- package/dist/actions/action-runtime-module.js +38 -7
- package/dist/actions/action-runtime-module.js.map +1 -1
- package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
- package/dist/actions/close-position/close-position.action.js +122 -15
- package/dist/actions/close-position/close-position.action.js.map +1 -1
- package/dist/actions/decision-engine.d.ts.map +1 -1
- package/dist/actions/decision-engine.js +15 -2
- package/dist/actions/decision-engine.js.map +1 -1
- package/dist/actions/event-derivation.d.ts +71 -2
- package/dist/actions/event-derivation.d.ts.map +1 -1
- package/dist/actions/event-derivation.js +251 -8
- package/dist/actions/event-derivation.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts +28 -2
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +220 -52
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts +2 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.js +62 -17
- package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
- package/dist/actions/skipped-signal-results.d.ts +25 -0
- package/dist/actions/skipped-signal-results.d.ts.map +1 -0
- package/dist/actions/skipped-signal-results.js +71 -0
- package/dist/actions/skipped-signal-results.js.map +1 -0
- package/dist/actions/store/types.d.ts +9 -2
- package/dist/actions/store/types.d.ts.map +1 -1
- package/dist/actions/store/types.js.map +1 -1
- package/dist/actions/types.d.ts +13 -0
- package/dist/actions/types.d.ts.map +1 -1
- package/dist/actions/types.js +13 -0
- package/dist/actions/types.js.map +1 -1
- package/dist/cli/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +3 -0
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/constants/dsl/index.d.ts +15 -0
- package/dist/constants/dsl/index.d.ts.map +1 -1
- package/dist/constants/dsl/index.js +15 -0
- package/dist/constants/dsl/index.js.map +1 -1
- package/dist/dsl/engine-client/event-mapping.d.ts.map +1 -1
- package/dist/dsl/engine-client/event-mapping.js +14 -0
- package/dist/dsl/engine-client/event-mapping.js.map +1 -1
- package/dist/dsl/events/build-closed-event.d.ts +16 -1
- package/dist/dsl/events/build-closed-event.d.ts.map +1 -1
- package/dist/dsl/events/build-closed-event.js +6 -0
- package/dist/dsl/events/build-closed-event.js.map +1 -1
- package/dist/dsl/events/handlers.d.ts +7 -0
- package/dist/dsl/events/handlers.d.ts.map +1 -1
- package/dist/dsl/events/handlers.js +37 -7
- package/dist/dsl/events/handlers.js.map +1 -1
- package/dist/dsl/monitor/create-monitor.d.ts +6 -2
- package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
- package/dist/dsl/monitor/create-monitor.js +15 -9
- package/dist/dsl/monitor/create-monitor.js.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.d.ts +2 -0
- package/dist/dsl/monitor/dsl-failure-events.d.ts.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.js +2 -1
- package/dist/dsl/monitor/dsl-failure-events.js.map +1 -1
- package/dist/dsl/monitor/process-one-position.d.ts +1 -0
- package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
- package/dist/dsl/monitor/process-one-position.js +72 -29
- package/dist/dsl/monitor/process-one-position.js.map +1 -1
- package/dist/dsl/plugin/index.d.ts +8 -2
- package/dist/dsl/plugin/index.d.ts.map +1 -1
- package/dist/dsl/plugin/index.js +8 -6
- package/dist/dsl/plugin/index.js.map +1 -1
- package/dist/health/types.d.ts +13 -0
- package/dist/health/types.d.ts.map +1 -1
- package/dist/health/types.js +12 -0
- package/dist/health/types.js.map +1 -1
- package/dist/index.d.ts +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +230 -39
- package/dist/index.js.map +1 -1
- package/dist/runtime/action-registry.d.ts.map +1 -1
- package/dist/runtime/action-registry.js +4 -3
- package/dist/runtime/action-registry.js.map +1 -1
- package/dist/runtime/domain-events.d.ts.map +1 -1
- package/dist/runtime/domain-events.js +7 -0
- package/dist/runtime/domain-events.js.map +1 -1
- package/dist/runtime/lifecycle-events.d.ts +9 -1
- package/dist/runtime/lifecycle-events.d.ts.map +1 -1
- package/dist/runtime/lifecycle-events.js +11 -2
- package/dist/runtime/lifecycle-events.js.map +1 -1
- package/dist/runtime/reconcile-run.d.ts +13 -3
- package/dist/runtime/reconcile-run.d.ts.map +1 -1
- package/dist/runtime/reconcile-run.js +4 -3
- package/dist/runtime/reconcile-run.js.map +1 -1
- package/dist/runtime/reconcile-state.d.ts +8 -0
- package/dist/runtime/reconcile-state.d.ts.map +1 -1
- package/dist/runtime/reconcile-state.js +4 -1
- package/dist/runtime/reconcile-state.js.map +1 -1
- package/dist/runtime/run.d.ts +1 -0
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/runtime-schema.js +3 -3
- package/dist/runtime/runtime-schema.js.map +1 -1
- package/dist/runtime/runtime.d.ts +1 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +27 -3
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.d.ts +13 -0
- package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.js +1 -0
- package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -1
- package/dist/runtime/validate-dsl-position-tracking.d.ts.map +1 -1
- package/dist/runtime/validate-dsl-position-tracking.js +2 -1
- package/dist/runtime/validate-dsl-position-tracking.js.map +1 -1
- package/dist/runtime-api/handlers/ingest-signals.d.ts.map +1 -1
- package/dist/runtime-api/handlers/ingest-signals.js +1 -0
- package/dist/runtime-api/handlers/ingest-signals.js.map +1 -1
- package/dist/runtime-api/handlers/types.d.ts +5 -0
- package/dist/runtime-api/handlers/types.d.ts.map +1 -1
- package/dist/runtime-api/intake/ingest-request.d.ts +17 -0
- package/dist/runtime-api/intake/ingest-request.d.ts.map +1 -0
- package/dist/runtime-api/intake/ingest-request.js +34 -0
- package/dist/runtime-api/intake/ingest-request.js.map +1 -0
- package/dist/runtime-api/intake/intake-events.d.ts +1 -1
- package/dist/runtime-api/intake/intake-events.d.ts.map +1 -1
- package/dist/runtime-api/intake/intake-events.js +9 -3
- package/dist/runtime-api/intake/intake-events.js.map +1 -1
- package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
- package/dist/runtime-api/intake/intake-mount.js +4 -19
- package/dist/runtime-api/intake/intake-mount.js.map +1 -1
- package/dist/runtime-api/intake/scaffold-error-router.js.map +1 -1
- package/dist/runtime-api/intake/scanner-launcher.d.ts.map +1 -1
- package/dist/runtime-api/intake/scanner-launcher.js +15 -0
- package/dist/runtime-api/intake/scanner-launcher.js.map +1 -1
- package/dist/runtime-api/intake/types.d.ts +6 -0
- package/dist/runtime-api/intake/types.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.js +2 -1
- package/dist/runtime-api/routes/signals.js.map +1 -1
- package/dist/runtime-api/routes/signals.schema.d.ts +1 -0
- package/dist/runtime-api/routes/signals.schema.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.schema.js +6 -0
- package/dist/runtime-api/routes/signals.schema.js.map +1 -1
- package/dist/scanners/engine/engine.d.ts +22 -1
- package/dist/scanners/engine/engine.d.ts.map +1 -1
- package/dist/scanners/engine/engine.js +78 -11
- package/dist/scanners/engine/engine.js.map +1 -1
- package/dist/scanners/engine/lifecycle.d.ts +7 -1
- package/dist/scanners/engine/lifecycle.d.ts.map +1 -1
- package/dist/scanners/events.d.ts +4 -0
- package/dist/scanners/events.d.ts.map +1 -1
- package/dist/scanners/events.js +2 -0
- package/dist/scanners/events.js.map +1 -1
- package/dist/scanners/external/scaffold/delivery.py +136 -14
- package/dist/scanners/external/scaffold/scaffold.py +61 -8
- package/dist/scanners/external/scaffold/ulid.py +58 -0
- package/dist/scanners/external-scanner-receiver.d.ts +17 -0
- package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
- package/dist/scanners/external-scanner-receiver.js +8 -0
- package/dist/scanners/external-scanner-receiver.js.map +1 -1
- package/dist/scanners/runtime-module.d.ts +1 -0
- package/dist/scanners/runtime-module.d.ts.map +1 -1
- package/dist/scanners/runtime-module.js +59 -9
- package/dist/scanners/runtime-module.js.map +1 -1
- package/dist/scripts/run-dsl-standalone-mock.js +6 -2
- package/dist/scripts/run-dsl-standalone-mock.js.map +1 -1
- package/dist/senpi/client.d.ts +16 -3
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +44 -13
- package/dist/senpi/client.js.map +1 -1
- package/dist/strategy/strategy-state.d.ts +9 -1
- package/dist/strategy/strategy-state.d.ts.map +1 -1
- package/dist/strategy/strategy-state.js +7 -2
- package/dist/strategy/strategy-state.js.map +1 -1
- package/dist/telemetry/attributes.d.ts +20 -0
- package/dist/telemetry/attributes.d.ts.map +1 -1
- package/dist/telemetry/attributes.js +24 -0
- package/dist/telemetry/attributes.js.map +1 -1
- package/dist/telemetry/event-builders.d.ts +81 -6
- package/dist/telemetry/event-builders.d.ts.map +1 -1
- package/dist/telemetry/event-builders.js +141 -17
- package/dist/telemetry/event-builders.js.map +1 -1
- package/dist/telemetry/event-store.d.ts +6 -0
- package/dist/telemetry/event-store.d.ts.map +1 -1
- package/dist/telemetry/event-store.js +12 -8
- package/dist/telemetry/event-store.js.map +1 -1
- package/dist/telemetry/live-telemetry.d.ts +192 -0
- package/dist/telemetry/live-telemetry.d.ts.map +1 -0
- package/dist/telemetry/live-telemetry.js +676 -0
- package/dist/telemetry/live-telemetry.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +14 -2
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +19 -4
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry/scanner-stats.d.ts +143 -0
- package/dist/telemetry/scanner-stats.d.ts.map +1 -0
- package/dist/telemetry/scanner-stats.js +426 -0
- package/dist/telemetry/scanner-stats.js.map +1 -0
- package/dist/telemetry/spans/redact-pii.d.ts.map +1 -1
- package/dist/telemetry/spans/redact-pii.js +18 -2
- package/dist/telemetry/spans/redact-pii.js.map +1 -1
- package/dist/telemetry/strategy-topology.d.ts +99 -0
- package/dist/telemetry/strategy-topology.d.ts.map +1 -0
- package/dist/telemetry/strategy-topology.js +93 -0
- package/dist/telemetry/strategy-topology.js.map +1 -0
- package/dist/telemetry/telemetry-publisher.d.ts +63 -0
- package/dist/telemetry/telemetry-publisher.d.ts.map +1 -0
- package/dist/telemetry/telemetry-publisher.js +229 -0
- package/dist/telemetry/telemetry-publisher.js.map +1 -0
- package/dist/telemetry/timeline-buffer.d.ts +95 -0
- package/dist/telemetry/timeline-buffer.d.ts.map +1 -0
- package/dist/telemetry/timeline-buffer.js +237 -0
- package/dist/telemetry/timeline-buffer.js.map +1 -0
- package/dist/telemetry/tracing.d.ts +9 -0
- package/dist/telemetry/tracing.d.ts.map +1 -1
- package/dist/telemetry/tracing.js +36 -0
- package/dist/telemetry/tracing.js.map +1 -1
- package/dist/types/dsl/index.d.ts +11 -0
- package/dist/types/dsl/index.d.ts.map +1 -1
- package/dist/types/scanner.d.ts +15 -0
- package/dist/types/scanner.d.ts.map +1 -1
- package/dist/types/strategy.d.ts +5 -1
- package/dist/types/strategy.d.ts.map +1 -1
- package/dist/utils/event-catalog.d.ts +166 -0
- package/dist/utils/event-catalog.d.ts.map +1 -1
- package/dist/utils/event-catalog.js +18 -0
- package/dist/utils/event-catalog.js.map +1 -1
- package/dist/utils/logger.d.ts +4 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/telemetry-required-log.d.ts +27 -0
- package/dist/utils/telemetry-required-log.d.ts.map +1 -0
- package/dist/utils/telemetry-required-log.js +68 -0
- package/dist/utils/telemetry-required-log.js.map +1 -0
- package/dist/utils/ulid.d.ts +9 -0
- package/dist/utils/ulid.d.ts.map +1 -0
- package/dist/utils/ulid.js +43 -0
- package/dist/utils/ulid.js.map +1 -0
- package/dist/validate/recipe-checks.d.ts.map +1 -1
- package/dist/validate/recipe-checks.js +2 -2
- package/dist/validate/recipe-checks.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
|
@@ -7,10 +7,22 @@
|
|
|
7
7
|
* we reuse the pure builders ({@link buildSignalEvaluated} → {@link buildDecisionMade} /
|
|
8
8
|
* {@link buildSignalOutcomes}), which are pure and already battle-tested, then project their records
|
|
9
9
|
* onto the event contract. Body lines are deterministic narratives; reasoning (decision.made) and any
|
|
10
|
-
* error text reach `redact`; the raw scanner `meta` bag
|
|
10
|
+
* error text reach `redact`; the raw scanner `meta` bag rides one JSON string attribute, never
|
|
11
|
+
* interpreted — it is operator-authored content and must not carry secrets. Whether it is scrubbed
|
|
12
|
+
* depends on where it lands: the on-disk event ring and the OTLP exporter carry it as the scanner
|
|
13
|
+
* wrote it, while the live telemetry websocket redacts every string attribute on the way out and
|
|
14
|
+
* drops this one whole, unmarked, while no redactor is registered.
|
|
15
|
+
*
|
|
16
|
+
* The only side effects are the serializers' rate-limited WARNs when a risk-gate or meta bag
|
|
17
|
+
* cannot be emitted whole — silent loss on a trust surface is worse than a log line. The returned
|
|
18
|
+
* events are unaffected by them; the loss itself is on the wire as `senpi.risk.gates_truncated` /
|
|
19
|
+
* `senpi.signal.meta_truncated`.
|
|
11
20
|
*/
|
|
12
21
|
import { buildDecisionMade, buildSignalEvaluated, buildSignalOutcomes, } from "../telemetry/event-builders.js";
|
|
22
|
+
import { jsonUnderCap } from "../telemetry/attributes.js";
|
|
13
23
|
import { EVENT_NAME, JOIN_ATTR, eventAttrs, fmtThousands } from "../utils/event-catalog.js";
|
|
24
|
+
import { createLogger } from "../utils/logger.js";
|
|
25
|
+
const derivationLog = createLogger("[senpi-core][event-derivation]");
|
|
14
26
|
/**
|
|
15
27
|
* Build then emit a single {@link EmittableEvent} through a logger, with build + emit guarded as one
|
|
16
28
|
* unit so neither a throwing builder nor a telemetry failure can disturb the host (trading/scan/
|
|
@@ -73,7 +85,7 @@ function decisionBody(d) {
|
|
|
73
85
|
return line;
|
|
74
86
|
}
|
|
75
87
|
/** decision.made attributes: the decision's safe scalars; reasoning goes to `redact`, not here. */
|
|
76
|
-
function decisionAttributes(d) {
|
|
88
|
+
function decisionAttributes(d, ids) {
|
|
77
89
|
return eventAttrs({
|
|
78
90
|
"senpi.decision.mode": d.mode,
|
|
79
91
|
"senpi.decision.by_llm": d.byLlm,
|
|
@@ -85,6 +97,8 @@ function decisionAttributes(d) {
|
|
|
85
97
|
"senpi.decision.model": d.model,
|
|
86
98
|
"senpi.decision.tokens_used": d.tokensUsed ?? undefined,
|
|
87
99
|
"senpi.decision.duration_ms": d.durationMs,
|
|
100
|
+
"senpi.tick.id": ids.tickId,
|
|
101
|
+
"senpi.signal.correlation_id": ids.correlationId,
|
|
88
102
|
});
|
|
89
103
|
}
|
|
90
104
|
const DISPOSITION_NARRATIVE = {
|
|
@@ -115,18 +129,236 @@ function outcomeBody(o, ev) {
|
|
|
115
129
|
}
|
|
116
130
|
return `${head}${score} → ${verb}${detail}`;
|
|
117
131
|
}
|
|
118
|
-
/**
|
|
119
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Which optional per-gate fields survive one serialization attempt. Tried in order; the first
|
|
134
|
+
* projection that fits {@link MAX_ATTR_VALUE_CHARS} wins.
|
|
135
|
+
*/
|
|
136
|
+
const GATE_TIERS = [
|
|
137
|
+
{ metrics: true, reason: true },
|
|
138
|
+
{ metrics: false, reason: true },
|
|
139
|
+
{ metrics: false, reason: false },
|
|
140
|
+
];
|
|
141
|
+
/**
|
|
142
|
+
* The healthy sentinel of the runtime's failure enum, bound to the enum's own type so removing or
|
|
143
|
+
* renaming the member is a compile error here instead of a silent "every gate failed" downstream.
|
|
144
|
+
*/
|
|
145
|
+
const NO_FAILURE = "none";
|
|
146
|
+
/**
|
|
147
|
+
* Each warn below fires once per process — none is a routine path, and if one does trip it trips on
|
|
148
|
+
* every outcome of every pass. The three are tracked separately because they are different faults
|
|
149
|
+
* with different fixes, and one must never burn another's flag: a bag that lost fields to the size
|
|
150
|
+
* budget is a cardinality problem, a bag `JSON.stringify` refused is a producer bug, and a bag
|
|
151
|
+
* dropped whole means the attribute is not on the wire at all.
|
|
152
|
+
*/
|
|
153
|
+
let warnedGateShed = false;
|
|
154
|
+
let warnedGateUnserializable = false;
|
|
155
|
+
let warnedGateDropped = false;
|
|
156
|
+
/** Reachable from both exits of the tier ladder — a bag JSON refused may still end up dropped. */
|
|
157
|
+
function warnGateUnserializable(log, gateCount) {
|
|
158
|
+
if (warnedGateUnserializable)
|
|
159
|
+
return;
|
|
160
|
+
warnedGateUnserializable = true;
|
|
161
|
+
log.warn("Risk gate bag unserializable; shed metrics", { gateCount });
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Metrics with every non-finite number removed. `JSON.stringify` renders `NaN`/`Infinity` as `null`,
|
|
165
|
+
* which is indistinguishable from a metric the guard legitimately reported as null — so the key is
|
|
166
|
+
* dropped instead, and the catalog states the contract: a metric number is finite or absent.
|
|
167
|
+
* Shallow, matching the guard's flat scalar bags; the original object is returned untouched when it
|
|
168
|
+
* is already clean, so the common path allocates nothing.
|
|
169
|
+
*/
|
|
170
|
+
function finiteMetrics(metrics) {
|
|
171
|
+
const isNonFinite = (v) => typeof v === "number" && !Number.isFinite(v);
|
|
172
|
+
const entries = Object.entries(metrics);
|
|
173
|
+
if (!entries.some(([, v]) => isNonFinite(v)))
|
|
174
|
+
return metrics;
|
|
175
|
+
return Object.fromEntries(entries.filter(([, v]) => !isNonFinite(v)));
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* One gate's wire projection. `gateName` is omitted — it is a static function of `gateId`, so
|
|
179
|
+
* putting it on every row buys nothing. The three reliability fields ride only when they say
|
|
180
|
+
* something: a healthy gate is `evaluationOk: true`, `fallbackApplied: false`, `failureKind: "none"`,
|
|
181
|
+
* and repeating that on every gate of every pass is noise. Their presence marks the fail-closed
|
|
182
|
+
* gate, which is the one a reader must not mistake for a real breach.
|
|
183
|
+
*/
|
|
184
|
+
function projectGate(g, tier) {
|
|
185
|
+
return {
|
|
186
|
+
gateId: g.gateId,
|
|
187
|
+
status: g.status,
|
|
188
|
+
...(tier.reason && g.reason !== undefined ? { reason: g.reason } : {}),
|
|
189
|
+
...(g.evaluationOk === false ? { evaluationOk: false } : {}),
|
|
190
|
+
...(g.fallbackApplied === true ? { fallbackApplied: true } : {}),
|
|
191
|
+
...(g.failureKind !== undefined && g.failureKind !== NO_FAILURE ? { failureKind: g.failureKind } : {}),
|
|
192
|
+
...(tier.metrics && g.metrics !== undefined ? { metrics: finiteMetrics(g.metrics) } : {}),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The gate bag as a JSON array string, with a flag saying whether anything was lost getting there.
|
|
197
|
+
*
|
|
198
|
+
* The logger caps every string attribute at {@link MAX_ATTR_VALUE_CHARS}, and a cap applied to JSON
|
|
199
|
+
* yields unparseable garbage — so the budget is spent here instead: shed `metrics`, then `reason`,
|
|
200
|
+
* and give up rather than emit a fragment. What comes out is always valid JSON or nothing.
|
|
201
|
+
*
|
|
202
|
+
* An empty `gates` array serializes to `"[]"` on purpose: "the gates ran and none are configured"
|
|
203
|
+
* is a fact the drill-down needs, distinct from the absent attribute's "there is no snapshot".
|
|
204
|
+
*
|
|
205
|
+
* A `metrics` bag that `JSON.stringify` refuses (a BigInt, a throwing `toJSON`) fails only its own
|
|
206
|
+
* tier — the metrics-less tiers below it still produce a bag. That fall is a producer bug, not a
|
|
207
|
+
* size problem, so it warns on its own flag: letting it fire the budget warning would both misname
|
|
208
|
+
* the fault and burn the one-shot flag a genuine overflow later needs.
|
|
209
|
+
*
|
|
210
|
+
* `log` is injectable so the once-per-process warnings can be observed in a test; production call
|
|
211
|
+
* sites take the default.
|
|
212
|
+
*/
|
|
213
|
+
export function serializeRiskGates(gates, log = derivationLog) {
|
|
214
|
+
// The two ways a tier can fail, tracked apart so the warning names the real fault.
|
|
215
|
+
let stringifyFailed = false;
|
|
216
|
+
let overBudget = false;
|
|
217
|
+
for (const tier of GATE_TIERS) {
|
|
218
|
+
let projected;
|
|
219
|
+
try {
|
|
220
|
+
projected = gates.map((g) => projectGate(g, tier));
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
// A gate whose own projection throws is the same fault as one stringify refuses.
|
|
224
|
+
stringifyFailed = true;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
// The shared whole-or-nothing serializer owns the cap: no `json` with `truncated` means it
|
|
228
|
+
// serialized and was too big, no `json` without it means stringify refused the value.
|
|
229
|
+
const { json, truncated: overCap } = jsonUnderCap(projected);
|
|
230
|
+
if (json === undefined) {
|
|
231
|
+
if (overCap)
|
|
232
|
+
overBudget = true;
|
|
233
|
+
else
|
|
234
|
+
stringifyFailed = true;
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (stringifyFailed)
|
|
238
|
+
warnGateUnserializable(log, gates.length);
|
|
239
|
+
if (overBudget && !warnedGateShed) {
|
|
240
|
+
warnedGateShed = true;
|
|
241
|
+
log.warn("Risk gate bag exceeded the attribute budget; shed fields to fit", {
|
|
242
|
+
gateCount: gates.length,
|
|
243
|
+
keptReason: tier.reason,
|
|
244
|
+
keptMetrics: tier.metrics,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
return { json, truncated: stringifyFailed || overBudget };
|
|
248
|
+
}
|
|
249
|
+
if (stringifyFailed)
|
|
250
|
+
warnGateUnserializable(log, gates.length);
|
|
251
|
+
if (!warnedGateDropped) {
|
|
252
|
+
warnedGateDropped = true;
|
|
253
|
+
log.warn("Risk gate bag exceeded the attribute budget even bare; dropped", {
|
|
254
|
+
gateCount: gates.length,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
return { truncated: true };
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* `"<scannerId>:<fault>"` keys already warned about. Rate-limits the per-signal drop warn to one line
|
|
261
|
+
* per scanner per fault: a scanner that produces the same bag every tick must not repeat it, and a
|
|
262
|
+
* broken scanner must not be masked by an unrelated one that broke first. Both faults are keyed
|
|
263
|
+
* separately, so one firing never silences the other.
|
|
264
|
+
*/
|
|
265
|
+
const warnedMetaDrops = new Set();
|
|
266
|
+
/**
|
|
267
|
+
* Report a dropped bag ONCE per (scanner, fault), without letting the report become a second, worse
|
|
268
|
+
* fault. The bag is scanner-controlled all the way down, so even counting its keys can throw (a proxy
|
|
269
|
+
* with a hostile `ownKeys` trap) — an uncountable bag is reported with no `keyCount` rather than with
|
|
270
|
+
* an escaping throw, and the emit itself is guarded so a failing logger cannot escape either. A throw
|
|
271
|
+
* here would leave `serializeSignalMeta` through the mapper and cost the caller its ENTIRE event
|
|
272
|
+
* array, so one hostile bag would blank the pass it rode in on: the diagnostic must never cost more
|
|
273
|
+
* than the bag.
|
|
274
|
+
*/
|
|
275
|
+
function warnMetaDropped(log, fault, message, meta, source, extra) {
|
|
276
|
+
const key = `${source.scannerId ?? ""}:${fault}`;
|
|
277
|
+
if (warnedMetaDrops.has(key))
|
|
278
|
+
return;
|
|
279
|
+
warnedMetaDrops.add(key);
|
|
280
|
+
let keyCount;
|
|
281
|
+
try {
|
|
282
|
+
keyCount = Object.keys(meta).length;
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
keyCount = undefined;
|
|
286
|
+
}
|
|
287
|
+
try {
|
|
288
|
+
log.warn(message, {
|
|
289
|
+
...(source.scannerId !== undefined ? { scannerId: source.scannerId } : {}),
|
|
290
|
+
...(source.asset !== undefined ? { asset: source.asset } : {}),
|
|
291
|
+
...(keyCount !== undefined ? { keyCount } : {}),
|
|
292
|
+
...extra,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
// The drop stands; there is nowhere left to report it to.
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The scanner's `meta` bag as ONE JSON string attribute, plus whether a bag arrived and was lost.
|
|
301
|
+
*
|
|
302
|
+
* The bag is scanner-defined and NOT interpreted here: no key is lifted, dropped, or reordered — the
|
|
303
|
+
* JSON is emitted whole or not at all. A bag over the per-value attribute cap is therefore dropped
|
|
304
|
+
* rather than truncated (a cut JSON string is unparseable) and rather than thinned (choosing which
|
|
305
|
+
* scanner keys survive would be interpretation). An empty bag legitimately serializes to `"{}"`, but
|
|
306
|
+
* that value only says a bag arrived: ingest normalizes a missing bag to `{}`, so a scanner that sent
|
|
307
|
+
* an empty one and a scanner that sent none both land here as `{}` and cannot be told apart. A drop
|
|
308
|
+
* is NOT silent on the wire either: `dropped` raises `senpi.signal.meta_truncated`, so an absent
|
|
309
|
+
* attribute WITH the marker (bag lost) is distinguishable from an absent attribute without one (no
|
|
310
|
+
* bag at all).
|
|
311
|
+
*
|
|
312
|
+
* The warn payload carries the bag's origin and its key count — the bag's own content is scanner
|
|
313
|
+
* free-text and never safe as an attribute. `log` is injectable so the warns are observable.
|
|
314
|
+
*/
|
|
315
|
+
export function serializeSignalMeta(meta, source = {}, log = derivationLog) {
|
|
316
|
+
const { json, truncated, chars } = jsonUnderCap(meta);
|
|
317
|
+
if (truncated) {
|
|
318
|
+
warnMetaDropped(log, "oversize", "scanner signal meta dropped: JSON is over the per-attribute size cap", meta, source, {
|
|
319
|
+
...(chars !== undefined ? { jsonChars: chars } : {}),
|
|
320
|
+
});
|
|
321
|
+
return { dropped: true };
|
|
322
|
+
}
|
|
323
|
+
// The attribute is contracted as a JSON OBJECT that a consumer renders as a key-value map, but a
|
|
324
|
+
// bag carrying its own `toJSON` can render as any JSON value. A scalar or an array is the same
|
|
325
|
+
// fault as one that does not render at all — the bag did not come out a bag — so it takes the same
|
|
326
|
+
// path. This tests the shape of the whole value, never the meaning of a key inside it.
|
|
327
|
+
if (json === undefined || !json.startsWith("{")) {
|
|
328
|
+
warnMetaDropped(log, "unserializable", "scanner signal meta dropped: the bag does not serialize to a JSON object", meta, source);
|
|
329
|
+
return { dropped: true };
|
|
330
|
+
}
|
|
331
|
+
return { json, dropped: false };
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* signal.outcome attributes: the queryable scalar surface, plus the scanner's `meta` bag as one
|
|
335
|
+
* uninterpreted JSON string (see {@link serializeSignalMeta}).
|
|
336
|
+
*
|
|
337
|
+
* `gates` is the pass's already-serialized bag, threaded in rather than re-derived: it is identical
|
|
338
|
+
* for every outcome of the pass, and stringifying it once per signal would pay the whole cost N
|
|
339
|
+
* times in the producer's synchronous emit path.
|
|
340
|
+
*/
|
|
341
|
+
function outcomeAttributes(o, ids, gates) {
|
|
342
|
+
const bag = o.rawSignal?.meta;
|
|
343
|
+
const meta = bag !== undefined
|
|
344
|
+
? serializeSignalMeta(bag, { scannerId: o.scannerId, asset: o.asset })
|
|
345
|
+
: undefined;
|
|
120
346
|
return eventAttrs({
|
|
121
347
|
[JOIN_ATTR.positionId]: o.positionId,
|
|
122
348
|
[JOIN_ATTR.orderId]: o.orderId,
|
|
123
349
|
"senpi.scanner.id": o.scannerId,
|
|
350
|
+
// Which action produced the outcome — an open accept and a close accept are both `accepted`.
|
|
351
|
+
"senpi.action.type": o.actionType,
|
|
124
352
|
"senpi.signal.type": o.signalType,
|
|
125
353
|
"senpi.signal.asset": o.asset,
|
|
126
354
|
"senpi.signal.direction": o.direction ?? undefined,
|
|
127
355
|
// Always a number off the record builder (`num(...) ?? 0`); the fallback mirrors that and keeps
|
|
128
356
|
// score a required, always-queryable scalar.
|
|
129
357
|
"senpi.signal.score": o.score ?? 0,
|
|
358
|
+
"senpi.signal.meta": meta?.json,
|
|
359
|
+
// Marker, not a value: absent attribute + absent marker = no bag ever arrived; absent attribute
|
|
360
|
+
// + marker = a bag arrived and was lost. Only ever `true` (never emitted as `false`).
|
|
361
|
+
"senpi.signal.meta_truncated": meta?.dropped === true ? true : undefined,
|
|
130
362
|
"senpi.outcome.result": o.result,
|
|
131
363
|
"senpi.outcome.reason_code": o.reasonCode,
|
|
132
364
|
"senpi.outcome.margin_amount": o.marginAmount,
|
|
@@ -135,6 +367,12 @@ function outcomeAttributes(o) {
|
|
|
135
367
|
"senpi.outcome.leverage": o.leverage,
|
|
136
368
|
"senpi.outcome.notional_value": o.notionalValue,
|
|
137
369
|
"senpi.outcome.size": o.size,
|
|
370
|
+
"senpi.tick.id": ids.tickId,
|
|
371
|
+
"senpi.signal.correlation_id": ids.correlationId,
|
|
372
|
+
"senpi.risk.gates": gates?.json,
|
|
373
|
+
// Emitted only when true, like the per-gate reliability flags: absence is the healthy case, and
|
|
374
|
+
// stamping `false` on every outcome of every pass would be noise.
|
|
375
|
+
"senpi.risk.gates_truncated": gates?.truncated === true ? true : undefined,
|
|
138
376
|
});
|
|
139
377
|
}
|
|
140
378
|
/**
|
|
@@ -148,20 +386,25 @@ export function deriveActionResultEvents(input) {
|
|
|
148
386
|
if (pass === null)
|
|
149
387
|
return [];
|
|
150
388
|
const events = [];
|
|
389
|
+
const ids = { tickId: pass.tickId, correlationId: pass.correlationId };
|
|
151
390
|
const decision = buildDecisionMade(pass);
|
|
152
391
|
if (decision !== null) {
|
|
153
392
|
events.push({
|
|
154
393
|
name: EVENT_NAME.decisionMade,
|
|
155
394
|
level: "info",
|
|
156
395
|
body: decisionBody(decision),
|
|
157
|
-
attributes: decisionAttributes(decision),
|
|
396
|
+
attributes: decisionAttributes(decision, ids),
|
|
158
397
|
...(decision.reasoning ? { redact: { reasoning: decision.reasoning } } : {}),
|
|
159
398
|
});
|
|
160
399
|
}
|
|
400
|
+
// Serialized ONCE per pass. Every outcome carries the same pass-level bag (buildSignalOutcomes
|
|
401
|
+
// copies the one array onto each), so this is the same string N times — and this runs inside the
|
|
402
|
+
// producer's synchronous emit path, where an N-signal batch must not pay N stringifies.
|
|
403
|
+
const gates = pass.riskGates !== undefined ? serializeRiskGates(pass.riskGates) : undefined;
|
|
161
404
|
// buildSignalOutcomes and pass.evaluations are both one-per-evaluation, same order — zipped so the
|
|
162
405
|
// narrative can template the fill (entryPrice) and the error text rides `redact` from the same
|
|
163
|
-
// evaluation. The record carries the queryable scalar surface
|
|
164
|
-
// carries the free-text error and the entry fill the body templates.
|
|
406
|
+
// evaluation. The record carries the queryable scalar surface plus the raw `meta` bag (on its
|
|
407
|
+
// `rawSignal`); the evaluation carries the free-text error and the entry fill the body templates.
|
|
165
408
|
const outcomes = buildSignalOutcomes(pass);
|
|
166
409
|
outcomes.forEach((outcome, i) => {
|
|
167
410
|
const ev = pass.evaluations[i];
|
|
@@ -171,7 +414,7 @@ export function deriveActionResultEvents(input) {
|
|
|
171
414
|
// ERROR when the outcome failed (the level arg escalates above the INFO floor).
|
|
172
415
|
level: isError ? "error" : "info",
|
|
173
416
|
body: outcomeBody(outcome, ev),
|
|
174
|
-
attributes: outcomeAttributes(outcome),
|
|
417
|
+
attributes: outcomeAttributes(outcome, ids, gates),
|
|
175
418
|
...(isError && ev.outcome.error ? { redact: { error: ev.outcome.error } } : {}),
|
|
176
419
|
});
|
|
177
420
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-derivation.js","sourceRoot":"","sources":["../../src/actions/event-derivation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,GAEpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAiC,MAAM,2BAA2B,CAAC;AA4B3H;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc,EAAE,KAAkC;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AI,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { Action, ActionConfig, ActionFactory, ActionManifest, ActionResult, HookEvent } from '../types.js';
|
|
2
2
|
import { RuntimeContext } from 'src/types/runtime.js';
|
|
3
|
+
/**
|
|
4
|
+
* Wall-clock bound on the clearing-house reads this action makes.
|
|
5
|
+
*
|
|
6
|
+
* These reads run inside the runtime's `reconcile` key-lock, which the DSL monitor's own
|
|
7
|
+
* reconcile waits on. The client's retry ladder bounds attempt COUNT, not time — three 45s
|
|
8
|
+
* attempts plus backoff is ~2.5 min of held lock, and it holds exactly when the MCP is
|
|
9
|
+
* degraded, which is when the exit engine can least afford to wait. 20s sits under the DSL
|
|
10
|
+
* tick's 30s default (a recipe on a faster tick loses at most one tick) while leaving a
|
|
11
|
+
* healthy read, which lands in 1–5s, several attempts of headroom.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CLEARINGHOUSE_READ_TIMEOUT_MS = 20000;
|
|
3
14
|
export declare class OpenPositionAction implements Action {
|
|
4
15
|
private config;
|
|
5
16
|
private context;
|
|
@@ -22,6 +33,19 @@ export declare class OpenPositionAction implements Action {
|
|
|
22
33
|
handle(event: HookEvent): Promise<ActionResult>;
|
|
23
34
|
/** The pending-opens ledger this action counts against — the context's when it has one. */
|
|
24
35
|
private pendingOpens;
|
|
36
|
+
/**
|
|
37
|
+
* One clearinghouse read, fail-closed on both an unreadable response and a throw. A throw is
|
|
38
|
+
* the same situation as an unreadable response — an unknown book — so it resolves undefined
|
|
39
|
+
* and reaches the skip below rather than escaping the action with no per-signal outcome
|
|
40
|
+
* recorded. Shared by the gate at the top of `handle` and the stale-view refetch in the
|
|
41
|
+
* signal loop.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* The bounded book read, failing closed. A read that throws — including one the deadline
|
|
45
|
+
* aborts — leaves the exchange view unknown, which the callers treat as a skip rather than
|
|
46
|
+
* trading against numbers nobody read.
|
|
47
|
+
*/
|
|
48
|
+
private readClearinghouseView;
|
|
25
49
|
/**
|
|
26
50
|
* Edge-triggered full-book log: once on the transition into full, then at most once per
|
|
27
51
|
* {@link NO_SLOTS_LOG_INTERVAL_MS} with the count it suppressed in between.
|
|
@@ -38,8 +62,10 @@ export declare class OpenPositionAction implements Action {
|
|
|
38
62
|
* rather than risk a duplicate or an over-margined open.
|
|
39
63
|
*
|
|
40
64
|
* Shared by both read sites (the gate at the top of `handle`, and the stale-view refetch in
|
|
41
|
-
* the signal loop).
|
|
42
|
-
*
|
|
65
|
+
* the signal loop). The rows come from the caller because the two sites attribute to
|
|
66
|
+
* different inputs: the scan's own signals before a decision exists, the decision's
|
|
67
|
+
* candidates after. `riskSnapshot` is undefined at the early site, where no gate snapshot
|
|
68
|
+
* has been taken yet.
|
|
43
69
|
*/
|
|
44
70
|
private skipClearinghouseUnknown;
|
|
45
71
|
private normalizeSignals;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-position.action.d.ts","sourceRoot":"","sources":["../../../src/actions/open-position/open-position.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EAEZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,SAAS,EAEV,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"open-position.action.d.ts","sourceRoot":"","sources":["../../../src/actions/open-position/open-position.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EAEZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,SAAS,EAEV,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA4BtD;;;;;;;;;GASG;AACH,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAyDpD,qBAAa,kBAAmB,YAAW,MAAM;IAwB7C,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IAxBjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,kBAA4B;IAE/C,OAAO,CAAC,cAAc,CAAiB;IAEvC;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkD;IAElF;;;;OAIG;IACH,OAAO,CAAC,UAAU,CAIhB;gBAGQ,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,cAAc;IASjC,OAAO,CAAC,QAAQ;IAYV,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;IA6TrD,2FAA2F;IAC3F,OAAO,CAAC,YAAY;IAIpB;;;;;;OAMG;IACH;;;;OAIG;YACW,qBAAqB;IAYnC;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW;IA4BnB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,wBAAwB;IAkChC,OAAO,CAAC,gBAAgB;YAaV,aAAa;CAmiB5B;AAID,eAAO,MAAM,mBAAmB,EAAE,aACO,CAAC;AAE1C,eAAO,MAAM,oBAAoB,EAAE,cAMlC,CAAC"}
|