@senpi/runtime 3.0.118 → 3.0.122
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 +7 -21
- package/dist/actions/action-events.d.ts.map +1 -1
- package/dist/actions/action-events.js +26 -54
- 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 +7 -38
- 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 +15 -122
- 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 +2 -15
- package/dist/actions/decision-engine.js.map +1 -1
- package/dist/actions/event-derivation.d.ts +2 -71
- package/dist/actions/event-derivation.d.ts.map +1 -1
- package/dist/actions/event-derivation.js +8 -251
- package/dist/actions/event-derivation.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts +2 -17
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +56 -162
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts +1 -2
- package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.js +17 -62
- package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
- package/dist/actions/store/types.d.ts +2 -9
- 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 +0 -13
- package/dist/actions/types.d.ts.map +1 -1
- package/dist/actions/types.js +0 -13
- package/dist/actions/types.js.map +1 -1
- package/dist/cli/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +16 -11
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/constants/dsl/index.d.ts +17 -6
- package/dist/constants/dsl/index.d.ts.map +1 -1
- package/dist/constants/dsl/index.js +17 -6
- package/dist/constants/dsl/index.js.map +1 -1
- package/dist/dsl/engine/floors.d.ts +25 -1
- package/dist/dsl/engine/floors.d.ts.map +1 -1
- package/dist/dsl/engine/floors.js +38 -6
- package/dist/dsl/engine/floors.js.map +1 -1
- package/dist/dsl/engine/index.d.ts +1 -1
- package/dist/dsl/engine/index.d.ts.map +1 -1
- package/dist/dsl/engine/index.js +1 -1
- package/dist/dsl/engine/index.js.map +1 -1
- package/dist/dsl/engine/round.d.ts +22 -2
- package/dist/dsl/engine/round.d.ts.map +1 -1
- package/dist/dsl/engine/round.js +78 -5
- package/dist/dsl/engine/round.js.map +1 -1
- package/dist/dsl/engine/tick.d.ts.map +1 -1
- package/dist/dsl/engine/tick.js +31 -16
- package/dist/dsl/engine/tick.js.map +1 -1
- package/dist/dsl/engine-client/event-mapping.d.ts.map +1 -1
- package/dist/dsl/engine-client/event-mapping.js +0 -14
- package/dist/dsl/engine-client/event-mapping.js.map +1 -1
- package/dist/dsl/events/build-closed-event.d.ts +1 -16
- package/dist/dsl/events/build-closed-event.d.ts.map +1 -1
- package/dist/dsl/events/build-closed-event.js +0 -6
- package/dist/dsl/events/build-closed-event.js.map +1 -1
- package/dist/dsl/events/handlers.d.ts +0 -7
- package/dist/dsl/events/handlers.d.ts.map +1 -1
- package/dist/dsl/events/handlers.js +7 -37
- package/dist/dsl/events/handlers.js.map +1 -1
- package/dist/dsl/events/initial-state.d.ts +1 -1
- package/dist/dsl/events/initial-state.d.ts.map +1 -1
- package/dist/dsl/events/initial-state.js +4 -7
- package/dist/dsl/events/initial-state.js.map +1 -1
- package/dist/dsl/monitor/create-monitor.d.ts +2 -6
- package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
- package/dist/dsl/monitor/create-monitor.js +9 -15
- package/dist/dsl/monitor/create-monitor.js.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.d.ts +0 -2
- package/dist/dsl/monitor/dsl-failure-events.d.ts.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.js +1 -2
- package/dist/dsl/monitor/dsl-failure-events.js.map +1 -1
- package/dist/dsl/monitor/exchange-sync.d.ts +8 -3
- package/dist/dsl/monitor/exchange-sync.d.ts.map +1 -1
- package/dist/dsl/monitor/exchange-sync.js +16 -4
- package/dist/dsl/monitor/exchange-sync.js.map +1 -1
- package/dist/dsl/monitor/process-one-position.d.ts +0 -1
- package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
- package/dist/dsl/monitor/process-one-position.js +113 -62
- package/dist/dsl/monitor/process-one-position.js.map +1 -1
- package/dist/dsl/plugin/index.d.ts +10 -12
- package/dist/dsl/plugin/index.d.ts.map +1 -1
- package/dist/dsl/plugin/index.js +14 -12
- package/dist/dsl/plugin/index.js.map +1 -1
- package/dist/health/types.d.ts +0 -13
- package/dist/health/types.d.ts.map +1 -1
- package/dist/health/types.js +0 -12
- package/dist/health/types.js.map +1 -1
- package/dist/index.d.ts +4 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +206 -257
- package/dist/index.js.map +1 -1
- package/dist/runtime/action-registry.d.ts.map +1 -1
- package/dist/runtime/action-registry.js +3 -4
- package/dist/runtime/action-registry.js.map +1 -1
- package/dist/runtime/boot-skip.d.ts +73 -0
- package/dist/runtime/boot-skip.d.ts.map +1 -0
- package/dist/runtime/boot-skip.js +113 -0
- package/dist/runtime/boot-skip.js.map +1 -0
- package/dist/runtime/create-runtime-context.d.ts +2 -0
- package/dist/runtime/create-runtime-context.d.ts.map +1 -1
- package/dist/runtime/create-runtime-context.js +1 -0
- package/dist/runtime/create-runtime-context.js.map +1 -1
- package/dist/runtime/domain-events.d.ts.map +1 -1
- package/dist/runtime/domain-events.js +0 -7
- package/dist/runtime/domain-events.js.map +1 -1
- package/dist/runtime/lifecycle-events.d.ts +43 -10
- package/dist/runtime/lifecycle-events.d.ts.map +1 -1
- package/dist/runtime/lifecycle-events.js +83 -12
- package/dist/runtime/lifecycle-events.js.map +1 -1
- package/dist/runtime/lifecycle-reaper.d.ts +202 -0
- package/dist/runtime/lifecycle-reaper.d.ts.map +1 -0
- package/dist/runtime/lifecycle-reaper.js +390 -0
- package/dist/runtime/lifecycle-reaper.js.map +1 -0
- package/dist/runtime/reconcile-run.d.ts +3 -13
- package/dist/runtime/reconcile-run.d.ts.map +1 -1
- package/dist/runtime/reconcile-run.js +3 -4
- package/dist/runtime/reconcile-run.js.map +1 -1
- package/dist/runtime/reconcile-state.d.ts +0 -8
- package/dist/runtime/reconcile-state.d.ts.map +1 -1
- package/dist/runtime/reconcile-state.js +1 -4
- package/dist/runtime/reconcile-state.js.map +1 -1
- package/dist/runtime/run.d.ts +5 -1
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +1 -0
- 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 +2 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +4 -27
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.d.ts +0 -13
- package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.js +0 -1
- package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -1
- package/dist/runtime/update-apply-deps.d.ts +23 -2
- package/dist/runtime/update-apply-deps.d.ts.map +1 -1
- package/dist/runtime/update-apply-deps.js +11 -5
- package/dist/runtime/update-apply-deps.js.map +1 -1
- package/dist/runtime/validate-dsl-position-tracking.d.ts.map +1 -1
- package/dist/runtime/validate-dsl-position-tracking.js +1 -2
- 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 +0 -1
- package/dist/runtime-api/handlers/ingest-signals.js.map +1 -1
- package/dist/runtime-api/handlers/types.d.ts +0 -5
- package/dist/runtime-api/handlers/types.d.ts.map +1 -1
- 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 +3 -9
- 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 +19 -4
- package/dist/runtime-api/intake/intake-mount.js.map +1 -1
- package/dist/runtime-api/intake/process-error-post.d.ts +1 -6
- package/dist/runtime-api/intake/process-error-post.d.ts.map +1 -1
- package/dist/runtime-api/intake/process-error-post.js +1 -5
- package/dist/runtime-api/intake/process-error-post.js.map +1 -1
- package/dist/runtime-api/intake/process-signal-post.d.ts +1 -7
- package/dist/runtime-api/intake/process-signal-post.d.ts.map +1 -1
- package/dist/runtime-api/intake/process-signal-post.js +0 -5
- package/dist/runtime-api/intake/process-signal-post.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 +0 -15
- package/dist/runtime-api/intake/scanner-launcher.js.map +1 -1
- package/dist/runtime-api/intake/types.d.ts +0 -55
- package/dist/runtime-api/intake/types.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.d.ts +0 -2
- package/dist/runtime-api/routes/signals.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.js +1 -5
- package/dist/runtime-api/routes/signals.js.map +1 -1
- package/dist/runtime-api/routes/signals.schema.d.ts +0 -43
- package/dist/runtime-api/routes/signals.schema.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.schema.js +0 -43
- package/dist/runtime-api/routes/signals.schema.js.map +1 -1
- package/dist/runtime-api/server.d.ts +1 -7
- package/dist/runtime-api/server.d.ts.map +1 -1
- package/dist/runtime-api/server.js +0 -1
- package/dist/runtime-api/server.js.map +1 -1
- package/dist/scanners/engine/engine.d.ts +1 -22
- package/dist/scanners/engine/engine.d.ts.map +1 -1
- package/dist/scanners/engine/engine.js +11 -78
- package/dist/scanners/engine/engine.js.map +1 -1
- package/dist/scanners/engine/lifecycle.d.ts +1 -7
- package/dist/scanners/engine/lifecycle.d.ts.map +1 -1
- package/dist/scanners/events.d.ts +0 -4
- package/dist/scanners/events.d.ts.map +1 -1
- package/dist/scanners/events.js +0 -2
- package/dist/scanners/events.js.map +1 -1
- package/dist/scanners/external/scaffold/delivery.py +25 -194
- package/dist/scanners/external/scaffold/scaffold.py +31 -172
- package/dist/scanners/external/scaffold/senpi_mcp.py +8 -150
- package/dist/scanners/external-scanner-receiver.d.ts +0 -17
- package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
- package/dist/scanners/external-scanner-receiver.js +0 -8
- package/dist/scanners/external-scanner-receiver.js.map +1 -1
- package/dist/scanners/runtime-module.d.ts +0 -1
- package/dist/scanners/runtime-module.d.ts.map +1 -1
- package/dist/scanners/runtime-module.js +9 -66
- package/dist/scanners/runtime-module.js.map +1 -1
- package/dist/skills-manager/manifest.d.ts.map +1 -1
- package/dist/skills-manager/manifest.js +1 -0
- package/dist/skills-manager/manifest.js.map +1 -1
- package/dist/skills-manager/skills-manifest.json +1 -0
- package/dist/telemetry/attributes.d.ts +0 -20
- package/dist/telemetry/attributes.d.ts.map +1 -1
- package/dist/telemetry/attributes.js +0 -24
- package/dist/telemetry/attributes.js.map +1 -1
- package/dist/telemetry/event-builders.d.ts +6 -81
- package/dist/telemetry/event-builders.d.ts.map +1 -1
- package/dist/telemetry/event-builders.js +17 -141
- package/dist/telemetry/event-builders.js.map +1 -1
- package/dist/telemetry/event-store.d.ts +0 -6
- package/dist/telemetry/event-store.d.ts.map +1 -1
- package/dist/telemetry/event-store.js +8 -12
- package/dist/telemetry/event-store.js.map +1 -1
- package/dist/telemetry/metrics.d.ts +2 -14
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +4 -19
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry/spans/redact-pii.d.ts.map +1 -1
- package/dist/telemetry/spans/redact-pii.js +2 -18
- package/dist/telemetry/spans/redact-pii.js.map +1 -1
- package/dist/telemetry/tracing.d.ts +0 -9
- package/dist/telemetry/tracing.d.ts.map +1 -1
- package/dist/telemetry/tracing.js +0 -36
- package/dist/telemetry/tracing.js.map +1 -1
- package/dist/types/dsl/index.d.ts +1 -12
- package/dist/types/dsl/index.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +8 -0
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/scanner.d.ts +0 -15
- package/dist/types/scanner.d.ts.map +1 -1
- package/dist/utils/event-catalog.d.ts +91 -166
- package/dist/utils/event-catalog.d.ts.map +1 -1
- package/dist/utils/event-catalog.js +13 -18
- package/dist/utils/event-catalog.js.map +1 -1
- package/dist/utils/keyed-mutex.d.ts +3 -2
- package/dist/utils/keyed-mutex.d.ts.map +1 -1
- package/dist/utils/keyed-mutex.js +3 -2
- package/dist/utils/keyed-mutex.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -4
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- 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
- package/dist/actions/skipped-signal-results.d.ts +0 -25
- package/dist/actions/skipped-signal-results.d.ts.map +0 -1
- package/dist/actions/skipped-signal-results.js +0 -71
- package/dist/actions/skipped-signal-results.js.map +0 -1
- package/dist/runtime-api/intake/ingest-request.d.ts +0 -17
- package/dist/runtime-api/intake/ingest-request.d.ts.map +0 -1
- package/dist/runtime-api/intake/ingest-request.js +0 -34
- package/dist/runtime-api/intake/ingest-request.js.map +0 -1
- package/dist/runtime-api/intake/scaffold-tick-router.d.ts +0 -39
- package/dist/runtime-api/intake/scaffold-tick-router.d.ts.map +0 -1
- package/dist/runtime-api/intake/scaffold-tick-router.js +0 -122
- package/dist/runtime-api/intake/scaffold-tick-router.js.map +0 -1
- package/dist/scanners/external/scaffold/tick_facts.py +0 -130
- package/dist/scanners/external/scaffold/ulid.py +0 -58
- package/dist/telemetry/live-telemetry.d.ts +0 -238
- package/dist/telemetry/live-telemetry.d.ts.map +0 -1
- package/dist/telemetry/live-telemetry.js +0 -853
- package/dist/telemetry/live-telemetry.js.map +0 -1
- package/dist/telemetry/scanner-stats.d.ts +0 -143
- package/dist/telemetry/scanner-stats.d.ts.map +0 -1
- package/dist/telemetry/scanner-stats.js +0 -426
- package/dist/telemetry/scanner-stats.js.map +0 -1
- package/dist/telemetry/scanner-tick-feed.d.ts +0 -87
- package/dist/telemetry/scanner-tick-feed.d.ts.map +0 -1
- package/dist/telemetry/scanner-tick-feed.js +0 -48
- package/dist/telemetry/scanner-tick-feed.js.map +0 -1
- package/dist/telemetry/strategy-topology.d.ts +0 -99
- package/dist/telemetry/strategy-topology.d.ts.map +0 -1
- package/dist/telemetry/strategy-topology.js +0 -93
- package/dist/telemetry/strategy-topology.js.map +0 -1
- package/dist/telemetry/telemetry-publisher.d.ts +0 -63
- package/dist/telemetry/telemetry-publisher.d.ts.map +0 -1
- package/dist/telemetry/telemetry-publisher.js +0 -229
- package/dist/telemetry/telemetry-publisher.js.map +0 -1
- package/dist/telemetry/tick-frame.d.ts +0 -212
- package/dist/telemetry/tick-frame.d.ts.map +0 -1
- package/dist/telemetry/tick-frame.js +0 -421
- package/dist/telemetry/tick-frame.js.map +0 -1
- package/dist/telemetry/timeline-buffer.d.ts +0 -95
- package/dist/telemetry/timeline-buffer.d.ts.map +0 -1
- package/dist/telemetry/timeline-buffer.js +0 -237
- package/dist/telemetry/timeline-buffer.js.map +0 -1
- package/dist/utils/telemetry-required-log.d.ts +0 -60
- package/dist/utils/telemetry-required-log.d.ts.map +0 -1
- package/dist/utils/telemetry-required-log.js +0 -105
- package/dist/utils/telemetry-required-log.js.map +0 -1
- package/dist/utils/ulid.d.ts +0 -9
- package/dist/utils/ulid.d.ts.map +0 -1
- package/dist/utils/ulid.js +0 -43
- package/dist/utils/ulid.js.map +0 -1
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ACTION_TYPE } from '../types.js';
|
|
2
1
|
import { HOOK_EVENT } from '../../types/hooks.js';
|
|
3
2
|
import { createLogger } from '../../utils/logger.js';
|
|
4
3
|
import { positionRegistryKey } from '../../runtime/position-id-registry.js';
|
|
5
|
-
import { emitActionResultEvents, buildActionEventContext, scanIdPayloadFields } from '../action-events.js';
|
|
6
4
|
const logger = createLogger('[actions][position-tracker]');
|
|
7
5
|
// ─── Pure helpers ────────────────────────────────────────────────────────────
|
|
8
6
|
/** Normalize dex: "main" → undefined (DSL convention). */
|
|
@@ -115,79 +113,46 @@ const deltaMappers = {
|
|
|
115
113
|
};
|
|
116
114
|
// ─── Position Tracker Action ────────────────────────────────────────────────
|
|
117
115
|
export class PositionTrackerAction {
|
|
118
|
-
config;
|
|
119
116
|
context;
|
|
120
117
|
name;
|
|
121
|
-
actionType =
|
|
118
|
+
actionType = 'POSITION_TRACKER';
|
|
122
119
|
constructor(config, context) {
|
|
123
|
-
this.config = config;
|
|
124
120
|
this.context = context;
|
|
125
121
|
this.name = config.name;
|
|
126
122
|
}
|
|
127
|
-
eventCtx() {
|
|
128
|
-
return buildActionEventContext({
|
|
129
|
-
hookSystem: this.context.hookSystem,
|
|
130
|
-
actionName: this.name,
|
|
131
|
-
actionType: this.actionType,
|
|
132
|
-
decisionMode: this.config.decision_mode,
|
|
133
|
-
decisionModel: this.config.decision_model,
|
|
134
|
-
minConfidence: this.config.min_confidence,
|
|
135
|
-
positionIdRegistry: this.context.positionIdRegistry,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
123
|
async handle(event) {
|
|
139
124
|
if (event.type !== HOOK_EVENT.ON_SIGNAL_DETECTED) {
|
|
140
125
|
return this.skip('invalid_event_type', 'Ignored: wrong event type');
|
|
141
126
|
}
|
|
142
|
-
const
|
|
143
|
-
const signals = scanResult?.signals ?? [];
|
|
127
|
+
const signals = this.extractSignals(event);
|
|
144
128
|
if (signals.length === 0) {
|
|
145
129
|
return this.skip('no_signals', 'No signals to process');
|
|
146
130
|
}
|
|
147
131
|
let firedCount = 0;
|
|
148
132
|
let skippedCount = 0;
|
|
149
133
|
let failedCount = 0;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const results = [];
|
|
153
|
-
for (const [signalIndex, signal] of signals.entries()) {
|
|
154
|
-
// Per-signal work window — every result entry below carries startedAt/endedAt.
|
|
155
|
-
const signalStartedAt = Date.now();
|
|
156
|
-
// Telemetry join: every row this signal produces carries its index into the scan's signal
|
|
157
|
-
// array, so the event mapper pairs the row with THIS signal's `meta`. Without it, two signals
|
|
158
|
-
// on the same asset in one pass — one asset on two books is exactly that, since positions are
|
|
159
|
-
// keyed by asset+dex — would both be read as the first one.
|
|
160
|
-
const indexRow = { __signalIndex: signalIndex };
|
|
161
|
-
const asset = signal.asset;
|
|
162
|
-
const signalType = signal.signalType;
|
|
163
|
-
const meta = signal.meta;
|
|
164
|
-
// The scanner carries the book on `meta.dex`; the Signal itself has no dex field. Kept raw
|
|
165
|
-
// (the registry key normalizes it) so the outcome resolves the same position.id the hook did.
|
|
166
|
-
const dexRow = typeof meta?.dex === 'string' && meta.dex.trim() !== '' ? { dex: meta.dex.trim() } : {};
|
|
167
|
-
const scoreRow = typeof signal.score === 'number' && Number.isFinite(signal.score) ? { score: signal.score } : {};
|
|
168
|
-
const mapper = deltaMappers[signalType];
|
|
134
|
+
for (const signal of signals) {
|
|
135
|
+
const mapper = deltaMappers[signal.signalType];
|
|
169
136
|
if (!mapper) {
|
|
170
|
-
logger.info('skipping unsupported delta type', { signalType, asset });
|
|
171
|
-
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...indexRow, success: true, reason: 'unsupported_delta_type', startedAt: signalStartedAt, endedAt: Date.now() });
|
|
137
|
+
logger.info('skipping unsupported delta type', { signalType: signal.signalType, asset: signal.asset });
|
|
172
138
|
skippedCount++;
|
|
173
139
|
continue;
|
|
174
140
|
}
|
|
141
|
+
const meta = signal.meta;
|
|
175
142
|
if (!meta) {
|
|
176
|
-
logger.warn('signal missing meta', { signalType, asset });
|
|
177
|
-
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...indexRow, success: true, reason: 'missing_meta', startedAt: signalStartedAt, endedAt: Date.now() });
|
|
143
|
+
logger.warn('signal missing meta', { signalType: signal.signalType, asset: signal.asset });
|
|
178
144
|
skippedCount++;
|
|
179
145
|
continue;
|
|
180
146
|
}
|
|
181
147
|
const mapped = mapper(meta, event.address);
|
|
182
148
|
if (!mapped) {
|
|
183
|
-
logger.warn('signal missing required snapshot', { signalType, asset });
|
|
184
|
-
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...indexRow, success: true, reason: 'missing_snapshot', startedAt: signalStartedAt, endedAt: Date.now() });
|
|
149
|
+
logger.warn('signal missing required snapshot', { signalType: signal.signalType, asset: signal.asset });
|
|
185
150
|
skippedCount++;
|
|
186
151
|
continue;
|
|
187
152
|
}
|
|
188
153
|
try {
|
|
189
|
-
logger.info(`firing ${mapped.type}`, { asset });
|
|
190
|
-
const positionFields = this.resolvePositionId(signalType, mapped, event.address);
|
|
154
|
+
logger.info(`firing ${mapped.type}`, { asset: signal.asset });
|
|
155
|
+
const positionFields = this.resolvePositionId(signal.signalType, mapped, event.address);
|
|
191
156
|
await this.context.hookSystem.fire({
|
|
192
157
|
type: mapped.type,
|
|
193
158
|
runtimeName: event.runtimeName,
|
|
@@ -195,38 +160,24 @@ export class PositionTrackerAction {
|
|
|
195
160
|
data: {
|
|
196
161
|
...mapped.data,
|
|
197
162
|
...positionFields,
|
|
198
|
-
// The ids of the tracker poll that OBSERVED this delta — not of the run that placed
|
|
199
|
-
// the order, which is a different run up to a poll interval earlier.
|
|
200
|
-
...scanIdPayloadFields(event),
|
|
201
163
|
},
|
|
202
164
|
timestamp: new Date().toISOString(),
|
|
203
165
|
});
|
|
204
|
-
// Carry the id the hook fired with. A CLOSED delta clears the registry entry inside
|
|
205
|
-
// `resolvePositionId`, so a post-loop lookup would resolve nothing and the closing
|
|
206
|
-
// outcome — the one that ends the position's story — would lose its join key.
|
|
207
|
-
const rowPositionId = typeof positionFields.__positionId === 'string' ? { __positionId: positionFields.__positionId } : {};
|
|
208
|
-
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...rowPositionId, ...indexRow, success: true, reason: 'fired', startedAt: signalStartedAt, endedAt: Date.now() });
|
|
209
166
|
firedCount++;
|
|
210
167
|
}
|
|
211
168
|
catch (err) {
|
|
212
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
213
|
-
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...indexRow, success: false, reason: 'exception', error: message, startedAt: signalStartedAt, endedAt: Date.now() });
|
|
214
169
|
failedCount++;
|
|
215
|
-
logger.error('failed to fire hook event', err, { signalType, asset });
|
|
170
|
+
logger.error('failed to fire hook event', err, { signalType: signal.signalType, asset: signal.asset });
|
|
216
171
|
}
|
|
217
172
|
}
|
|
218
173
|
const success = failedCount === 0;
|
|
219
|
-
|
|
174
|
+
return {
|
|
220
175
|
success,
|
|
221
176
|
action_type: this.actionType,
|
|
222
177
|
summary: `Tracked: ${firedCount} fired, ${skippedCount} skipped, ${failedCount} failed`,
|
|
223
|
-
data: { firedCount, skippedCount, failedCount
|
|
178
|
+
data: { firedCount, skippedCount, failedCount },
|
|
224
179
|
...(failedCount > 0 ? { error: `${failedCount} hook event(s) failed to fire` } : {}),
|
|
225
180
|
};
|
|
226
|
-
// No decision engine runs here, so the result carries no `_decisionMeta` and no
|
|
227
|
-
// `decision.made` is derived — only the per-signal outcomes.
|
|
228
|
-
emitActionResultEvents(this.eventCtx(), event, event.address, result, { scanResult });
|
|
229
|
-
return result;
|
|
230
181
|
}
|
|
231
182
|
/**
|
|
232
183
|
* Mint/reuse/clear the cross-flow position.id and return the fields to stamp on the
|
|
@@ -272,6 +223,10 @@ export class PositionTrackerAction {
|
|
|
272
223
|
: {}),
|
|
273
224
|
};
|
|
274
225
|
}
|
|
226
|
+
extractSignals(event) {
|
|
227
|
+
const scanResult = event.data?.scanResult;
|
|
228
|
+
return scanResult?.signals ?? [];
|
|
229
|
+
}
|
|
275
230
|
skip(reason, summary) {
|
|
276
231
|
return { success: true, action_type: this.actionType, summary, skipped: true, skipReason: reason };
|
|
277
232
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position-tracker.action.js","sourceRoot":"","sources":["../../../src/actions/position-tracker/position-tracker.action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"position-tracker.action.js","sourceRoot":"","sources":["../../../src/actions/position-tracker/position-tracker.action.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAc,MAAM,uCAAuC,CAAC;AAExF,MAAM,MAAM,GAAG,YAAY,CAAC,6BAA6B,CAAC,CAAC;AAU3D,gFAAgF;AAEhF,0DAA0D;AAC1D,SAAS,YAAY,CAAC,GAAuB;IAC3C,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC;IAC7C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,iEAAiE;AACjE,SAAS,UAAU,CAAC,QAAyC;IAC3D,OAAO,MAAM,CAAC,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC;AAED,8DAA8D;AAC9D,SAAS,QAAQ,CAAC,GAAuB;IACvC,MAAM,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,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CAAC,MAAM,sBAAsB,GAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,CACvE,IAAI,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kEAAkE;IAC/E,cAAc,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC;IAC/C,aAAa,EAAE;QACb,UAAU,CAAC,kBAAkB;QAC7B,UAAU,CAAC,kBAAkB;QAC7B,UAAU,CAAC,mBAAmB;QAC9B,UAAU,CAAC,qBAAqB;QAChC,UAAU,CAAC,qBAAqB;KACjC;CACF,CAAC"}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type { RiskGateStatus } from "../../health/types.js";
|
|
7
6
|
import type { ActionType, DecisionMode } from "../types.js";
|
|
8
7
|
/** Gateway between {@link ActionResult.data} and persisted audit records. */
|
|
9
8
|
export interface DecisionMeta {
|
|
@@ -41,18 +40,12 @@ export interface ActionExecutionRecord {
|
|
|
41
40
|
} | null;
|
|
42
41
|
/** Interpolated decision prompt (LLM/rule path); null when not applicable or not supplied. */
|
|
43
42
|
decisionPrompt: string | null;
|
|
44
|
-
/**
|
|
45
|
-
* The persisted subset of the runtime's gate evaluations. `gateId`/`gateName` stay plain strings:
|
|
46
|
-
* this record is parsed back out of an untrusted payload, so it must be able to hold an id the
|
|
47
|
-
* current {@link RiskGateId} enum does not know. The verdicts are the runtime's own enum — those
|
|
48
|
-
* are the values readers branch on, and a re-spelling would drift.
|
|
49
|
-
*/
|
|
50
43
|
riskSnapshot: {
|
|
51
|
-
gate:
|
|
44
|
+
gate: "OPEN" | "COOLDOWN" | "CLOSED";
|
|
52
45
|
gates: Array<{
|
|
53
46
|
gateId: string;
|
|
54
47
|
gateName: string;
|
|
55
|
-
status:
|
|
48
|
+
status: "OPEN" | "COOLDOWN" | "CLOSED" | "N_A";
|
|
56
49
|
reason?: string;
|
|
57
50
|
metrics?: Record<string, unknown>;
|
|
58
51
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/actions/store/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/actions/store/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,2FAA2F;AAC3F,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE;QACR,IAAI,EAAE,YAAY,CAAC;QACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,OAAO,EAA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,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,0BAA0B,CAAC;CAC5C;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,IAAI,eAAe,CAqBtD;AAED,6DAA6D;AAC7D,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,YAAY,GACzB,iBAAiB,CAiBnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/actions/store/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/actions/store/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA8HH,0DAA0D;AAC1D,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,gBAAgB,EAAE,IAAI;QACtB,iBAAiB,EAAE,IAAI;QACvB,aAAa,EAAE,IAAI;QACnB,cAAc,EAAE,IAAI;QACpB,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,IAAI;QACjB,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,CAAC;QACZ,qBAAqB,EAAE,CAAC;QACxB,mBAAmB,EAAE,IAAI;QACzB,sBAAsB,EAAE,IAAI;QAC5B,qBAAqB,EAAE,CAAC;QACxB,uBAAuB,EAAE,CAAC;QAC1B,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAE,EAAE;KACvB,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,UAAkB,EAClB,UAAsB,EACtB,OAAe,EACf,YAA0B;IAE1B,OAAO;QACL,UAAU;QACV,UAAU;QACV,OAAO;QACP,YAAY;QACZ,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,CAAC;QACZ,qBAAqB,EAAE,CAAC;QACxB,qBAAqB,EAAE,CAAC;QACxB,uBAAuB,EAAE,CAAC;QAC1B,eAAe,EAAE,CAAC;QAClB,SAAS,EAAE,CAAC;KACb,CAAC;AACJ,CAAC"}
|
package/dist/actions/types.d.ts
CHANGED
|
@@ -58,19 +58,6 @@ export type ActionType = 'OPEN_POSITION' | 'CLOSE_POSITION' | string;
|
|
|
58
58
|
*/
|
|
59
59
|
export declare const DECISION_MODES: readonly ["llm", "rule", "none"];
|
|
60
60
|
export type DecisionMode = (typeof DECISION_MODES)[number];
|
|
61
|
-
/**
|
|
62
|
-
* The built-in action types, in the exact spelling every action stamps onto its own `actionType`
|
|
63
|
-
* and hence onto `ActionResult.action_type`. This object is the single source of truth: the action
|
|
64
|
-
* classes, the registry (`action-registry.ts`), the validators (`runtime-schema.ts`,
|
|
65
|
-
* `recipe-checks.ts`, `validate-dsl-position-tracking.ts`) and the telemetry readers
|
|
66
|
-
* (`event-builders.ts`, `action-runtime-module.ts`) all read it, so the emitter and the readers can
|
|
67
|
-
* never drift. `ActionType` stays open (`| string`) for plugin actions, which are not listed here.
|
|
68
|
-
*/
|
|
69
|
-
export declare const ACTION_TYPE: {
|
|
70
|
-
readonly openPosition: "OPEN_POSITION";
|
|
71
|
-
readonly closePosition: "CLOSE_POSITION";
|
|
72
|
-
readonly positionTracker: "POSITION_TRACKER";
|
|
73
|
-
};
|
|
74
61
|
export interface ActionConfig {
|
|
75
62
|
name: string;
|
|
76
63
|
action_type: ActionType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/act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AO,EAAE,cAAc,KAAK,MAAM,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC"}
|
package/dist/actions/types.js
CHANGED
|
@@ -8,17 +8,4 @@ export { ScanStatus } from '../types/scanner.js';
|
|
|
8
8
|
* registry can never drift.
|
|
9
9
|
*/
|
|
10
10
|
export const DECISION_MODES = ['llm', 'rule', 'none'];
|
|
11
|
-
/**
|
|
12
|
-
* The built-in action types, in the exact spelling every action stamps onto its own `actionType`
|
|
13
|
-
* and hence onto `ActionResult.action_type`. This object is the single source of truth: the action
|
|
14
|
-
* classes, the registry (`action-registry.ts`), the validators (`runtime-schema.ts`,
|
|
15
|
-
* `recipe-checks.ts`, `validate-dsl-position-tracking.ts`) and the telemetry readers
|
|
16
|
-
* (`event-builders.ts`, `action-runtime-module.ts`) all read it, so the emitter and the readers can
|
|
17
|
-
* never drift. `ActionType` stays open (`| string`) for plugin actions, which are not listed here.
|
|
18
|
-
*/
|
|
19
|
-
export const ACTION_TYPE = {
|
|
20
|
-
openPosition: 'OPEN_POSITION',
|
|
21
|
-
closePosition: 'CLOSE_POSITION',
|
|
22
|
-
positionTracker: 'POSITION_TRACKER',
|
|
23
|
-
};
|
|
24
11
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/actions/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAgB/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAgEjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/actions/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAgB/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAgEjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide-commands.d.ts","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAsdH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"guide-commands.d.ts","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAsdH,eAAO,MAAM,eAAe,QA8VpB,CAAC;AAIT,kFAAkF;AAClF,UAAU,gBAAgB;IACxB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC9D,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC;CACxF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,MAAM,GACd,IAAI,CA2CN"}
|
|
@@ -168,9 +168,6 @@ external_scanner (v2 supervised)
|
|
|
168
168
|
marginPct / leverage ride at the TOP LEVEL of the signal dict — the runtime
|
|
169
169
|
reads them directly. Omit them to size/lever from the recipe config.
|
|
170
170
|
|
|
171
|
-
data{} lands verbatim in telemetry (the signal.outcome event's
|
|
172
|
-
senpi.signal.meta attribute) — never put secrets, keys or tokens in it.
|
|
173
|
-
|
|
174
171
|
Prompt/context access stays namespaced:
|
|
175
172
|
{{signal_<scanner_name>}}
|
|
176
173
|
`.trim();
|
|
@@ -225,12 +222,12 @@ const DSL_TEXT = `
|
|
|
225
222
|
DSL exit engine — two-phase trailing stop-loss (DSL v2)
|
|
226
223
|
─────────────────────────────────────────────────────────────────────────────
|
|
227
224
|
|
|
228
|
-
The DSL monitors open positions on a configurable interval (idling at
|
|
225
|
+
The DSL monitors open positions on a configurable interval (idling at 180s when
|
|
229
226
|
the strategy is flat; an externally-opened position can take that long to be
|
|
230
227
|
adopted) and closes them
|
|
231
228
|
when price breaches the computed floor or when preset time cuts fire.
|
|
232
|
-
Phase 1: max_loss absolute floor + phase1 retrace from high-water
|
|
233
|
-
breach counting applies
|
|
229
|
+
Phase 1: max_loss absolute floor + phase1 retrace from high-water. Consecutive
|
|
230
|
+
breach counting applies in BOTH phases. Phase 2: tier floors from lock_hw_pct
|
|
234
231
|
(% of current high-water ROE); phase 2 begins when price crosses the first
|
|
235
232
|
tier (no phase2_trigger_tier). Optional hard_timeout, weak_peak_cut, and
|
|
236
233
|
dead_weight_cut live on the preset (not nested under phase1). When any of these
|
|
@@ -263,14 +260,17 @@ Phase 1 — Fixed floor + high-water trailing
|
|
|
263
260
|
# enabled: false # optional; default true — false = skip Phase 1 logic; tiers can still advance
|
|
264
261
|
max_loss_pct: 3.0 # e.g. 3% max loss at 1×
|
|
265
262
|
retrace_threshold: 10 # ROE % retrace from HWM in phase 1 (required when enabled)
|
|
266
|
-
consecutive_breaches_required: 3 # ticks below floor before exit
|
|
263
|
+
consecutive_breaches_required: 3 # ticks below floor before exit, both phases (required when enabled)
|
|
267
264
|
# Exchange SL in Phase 1: max_loss absolute floor only; tighter engine floors use closePosition.
|
|
268
265
|
|
|
269
266
|
──────────────────────────────────────────────────────────────────────────────
|
|
270
267
|
Phase 2 — Tier floors (no per-tier breaches or retrace YAML)
|
|
271
|
-
Floor = tier floor from lock_hw_pct once the tier is active.
|
|
272
|
-
effective floor
|
|
273
|
-
|
|
268
|
+
Floor = tier floor from lock_hw_pct once the tier is active. Exchange SL tracks
|
|
269
|
+
the full effective floor (editPosition on tier/phase and moves), and that stop is
|
|
270
|
+
normally what exits. When price breaches the floor for consecutive_breaches_required
|
|
271
|
+
consecutive ticks AND no exchange stop is resting at or beyond the floor (it was
|
|
272
|
+
never placed, or the venue rejected it), the runtime closes with dsl_breach itself —
|
|
273
|
+
including for backend-owned positions, since dsl-engine cannot close a position.
|
|
274
274
|
|
|
275
275
|
phase2:
|
|
276
276
|
# enabled: false # optional; default true — false = never enter phase 2
|
|
@@ -381,7 +381,7 @@ actions[]
|
|
|
381
381
|
exit
|
|
382
382
|
engine string No dsl
|
|
383
383
|
interval_seconds number No Default 30; integer 5–3600 (Zod + DSL parse).
|
|
384
|
-
Cadence while holding a position; idles at
|
|
384
|
+
Cadence while holding a position; idles at 180s when flat
|
|
385
385
|
dsl_preset object No Single exit profile (required to start DslPlugin)
|
|
386
386
|
sm_flip any No Non-DSL exit hook data (allowed; ignored by DSL parse)
|
|
387
387
|
|
|
@@ -561,6 +561,11 @@ senpi runtime — Manage runtimes
|
|
|
561
561
|
runtime list List installed runtimes (id, wallet, source, status).
|
|
562
562
|
status is running / stopped / "running — NO ENTRY
|
|
563
563
|
SCANNERS" (a live runtime whose scanners never wired)
|
|
564
|
+
--json rows also carry lifecycle: what the strategy last
|
|
565
|
+
read as (open / closing / closed / absent / unchecked /
|
|
566
|
+
unknown). closed = the strategy is gone: never restart or
|
|
567
|
+
re-create that runtime. absent = check the wallet with
|
|
568
|
+
strategy_list first; it is never removed automatically
|
|
564
569
|
--json Raw JSON output — the ONLY way to read each runtime's
|
|
565
570
|
rendered descriptor (name, group, version, description,
|
|
566
571
|
hasExit, dslPreset, dsl ladder); the table prints none of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide-commands.js","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,aAAa,GACjB,0EAA0E,CAAC;AAE7E,+EAA+E;AAE/E,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC;qBACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CAyB3B,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,aAAa,GAAG
|
|
1
|
+
{"version":3,"file":"guide-commands.js","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,aAAa,GACjB,0EAA0E,CAAC;AAE7E,+EAA+E;AAE/E,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC;qBACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CAyB3B,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIrB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CpB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FhB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAsB;SAC3C,WAAW,CAAC,iCAAiC,CAAC;SAC9C,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAAK,CAAsB;SACvC,WAAW,CAAC,6DAA6D,CAAC;SAC1E,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,UAAU,CAAsB;SAC5C,WAAW,CAAC,uCAAuC,CAAC;SACpD,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAsB;SAC1C,WAAW,CAAC,kCAAkC,CAAC;SAC/C,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,SAAS,CAAsB;SAC3C,WAAW,CAAC,kCAAkC,CAAC;SAC/C,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,OAAO,KAAK,aAAa,IAAI,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -61,17 +61,29 @@ export declare const MIN_INTERVAL_SECONDS = 5;
|
|
|
61
61
|
export declare const MAX_INTERVAL_SECONDS = 3600;
|
|
62
62
|
export declare const DEFAULT_INTERVAL_MS = 30000;
|
|
63
63
|
/**
|
|
64
|
-
* Monitor cadence when a strategy has nothing to manage — no open position
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
64
|
+
* Monitor cadence when a strategy has nothing to manage — no open position and no tracked
|
|
65
|
+
* DSL state. Nothing a faster tick could act on, so the monitor idles here instead of at
|
|
66
|
+
* `interval_seconds`. Never applied as a speed-up: a recipe configured slower than this
|
|
67
|
+
* keeps its own cadence.
|
|
68
|
+
*
|
|
69
|
+
* Resting orders are deliberately NOT part of that test — see `hasWorkToManage` for why,
|
|
70
|
+
* and for the ungated-scanner path that covers a resting entry filling while flat.
|
|
71
|
+
*
|
|
72
|
+
* The value is chosen from the DEPLOYED cadence distribution, not picked round. Attributing
|
|
73
|
+
* `dsl.tick` spans to their process over 24 h (2026-09-21/22): 54.6% of monitor ticks come
|
|
74
|
+
* from strategies configured at `exit.interval_seconds: 60`, 32.4% at 30 s, the rest mostly
|
|
75
|
+
* faster. A 60 s floor is therefore a NO-OP on over half the fleet — `max(60_000, 60_000)` —
|
|
76
|
+
* and saves ~7.4% of MCP tool calls. 180 s clears the modal cohort and saves ~21.5%; past it
|
|
77
|
+
* the curve saturates (300 s buys only 2.8 points more for another 2 minutes of exposure).
|
|
78
|
+
* Re-derive this from telemetry before changing it — the right value tracks what operators
|
|
79
|
+
* actually deploy, and the modal cadence will drift.
|
|
68
80
|
*
|
|
69
81
|
* The cost of the back-off is orphan-adoption latency: a position opened outside the
|
|
70
82
|
* runtime's knowledge waits up to this long for reconcile to notice it. Positions the
|
|
71
83
|
* runtime opens itself are unaffected — they land as a DSL state, which makes the strategy
|
|
72
84
|
* active again on the next cadence check.
|
|
73
85
|
*/
|
|
74
|
-
export declare const FLAT_INTERVAL_MS =
|
|
86
|
+
export declare const FLAT_INTERVAL_MS = 180000;
|
|
75
87
|
export declare const MAX_CONSECUTIVE_CLOSE_FAILURES = 3;
|
|
76
88
|
/** Log a warning when price is missing for this many consecutive monitor ticks. */
|
|
77
89
|
export declare const DSL_PRICE_FETCH_FAILURE_WARN_THRESHOLD = 5;
|
|
@@ -95,5 +107,4 @@ export declare const DSL_EXTERNAL_RETRY_DELAY_MS = 500;
|
|
|
95
107
|
*/
|
|
96
108
|
export declare const DSL_HANDOFF_SL_STATUS_TIMEOUT_MS = 10000;
|
|
97
109
|
export declare const MCP_TOOL_PREFIX = "senpi.";
|
|
98
|
-
export declare const PRICE_DECIMALS = 4;
|
|
99
110
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/dsl/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,eAAO,MAAM,uBAAuB,EAAG,UAAmB,CAAC;AAE3D,6GAA6G;AAC7G,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;IASrB,4FAA4F;;CAEpF,CAAC;AAEX,iDAAiD;AACjD,eAAO,MAAM,2BAA2B,QAAiB,CAAC;AAC1D,0FAA0F;AAC1F,eAAO,MAAM,yBAAyB,QAAqB,CAAC;AAC5D,mFAAmF;AACnF,eAAO,MAAM,8BAA8B,QAAqB,CAAC;AAEjE,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAC9C,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,yBAAyB,YAAY,CAAC;AAEnD,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD,8EAA8E;AAC9E,eAAO,MAAM,YAAY;;;;;;;;;;;;;IAavB,6FAA6F;;CAErF,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAC3E,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,OAAO,CAAC;AACzC,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAC1C
|
|
1
|
+
{"version":3,"file":"index.d.ts","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C,QAAS,CAAC;AACvD,eAAO,MAAM,eAAe,WAAW,CAAC"}
|
|
@@ -61,17 +61,29 @@ export const MIN_INTERVAL_SECONDS = 5;
|
|
|
61
61
|
export const MAX_INTERVAL_SECONDS = 3600;
|
|
62
62
|
export const DEFAULT_INTERVAL_MS = 30_000;
|
|
63
63
|
/**
|
|
64
|
-
* Monitor cadence when a strategy has nothing to manage — no open position
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
64
|
+
* Monitor cadence when a strategy has nothing to manage — no open position and no tracked
|
|
65
|
+
* DSL state. Nothing a faster tick could act on, so the monitor idles here instead of at
|
|
66
|
+
* `interval_seconds`. Never applied as a speed-up: a recipe configured slower than this
|
|
67
|
+
* keeps its own cadence.
|
|
68
|
+
*
|
|
69
|
+
* Resting orders are deliberately NOT part of that test — see `hasWorkToManage` for why,
|
|
70
|
+
* and for the ungated-scanner path that covers a resting entry filling while flat.
|
|
71
|
+
*
|
|
72
|
+
* The value is chosen from the DEPLOYED cadence distribution, not picked round. Attributing
|
|
73
|
+
* `dsl.tick` spans to their process over 24 h (2026-09-21/22): 54.6% of monitor ticks come
|
|
74
|
+
* from strategies configured at `exit.interval_seconds: 60`, 32.4% at 30 s, the rest mostly
|
|
75
|
+
* faster. A 60 s floor is therefore a NO-OP on over half the fleet — `max(60_000, 60_000)` —
|
|
76
|
+
* and saves ~7.4% of MCP tool calls. 180 s clears the modal cohort and saves ~21.5%; past it
|
|
77
|
+
* the curve saturates (300 s buys only 2.8 points more for another 2 minutes of exposure).
|
|
78
|
+
* Re-derive this from telemetry before changing it — the right value tracks what operators
|
|
79
|
+
* actually deploy, and the modal cadence will drift.
|
|
68
80
|
*
|
|
69
81
|
* The cost of the back-off is orphan-adoption latency: a position opened outside the
|
|
70
82
|
* runtime's knowledge waits up to this long for reconcile to notice it. Positions the
|
|
71
83
|
* runtime opens itself are unaffected — they land as a DSL state, which makes the strategy
|
|
72
84
|
* active again on the next cadence check.
|
|
73
85
|
*/
|
|
74
|
-
export const FLAT_INTERVAL_MS =
|
|
86
|
+
export const FLAT_INTERVAL_MS = 180_000;
|
|
75
87
|
export const MAX_CONSECUTIVE_CLOSE_FAILURES = 3;
|
|
76
88
|
/** Log a warning when price is missing for this many consecutive monitor ticks. */
|
|
77
89
|
export const DSL_PRICE_FETCH_FAILURE_WARN_THRESHOLD = 5;
|
|
@@ -95,5 +107,4 @@ export const DSL_EXTERNAL_RETRY_DELAY_MS = 500;
|
|
|
95
107
|
*/
|
|
96
108
|
export const DSL_HANDOFF_SL_STATUS_TIMEOUT_MS = 10_000;
|
|
97
109
|
export const MCP_TOOL_PREFIX = "senpi.";
|
|
98
|
-
export const PRICE_DECIMALS = 4;
|
|
99
110
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/dsl/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAmB,CAAC;AAE3D,6GAA6G;AAC7G,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,eAAe,EAAE,UAAU,CAAC,kBAAkB;IAC9C,eAAe,EAAE,UAAU,CAAC,kBAAkB;IAC9C,gBAAgB,EAAE,UAAU,CAAC,mBAAmB;IAChD,kBAAkB,EAAE,UAAU,CAAC,qBAAqB;IACpD,kBAAkB,EAAE,UAAU,CAAC,qBAAqB;CAC5C,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,OAAO,EAAE,aAAa;IACtB,aAAa,EAAE,mBAAmB;IAClC,aAAa,EAAE,mBAAmB;IAClC,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,YAAY;IACpB,aAAa,EAAE,mBAAmB;IAClC,gBAAgB,EAAE,sBAAsB;IACxC,OAAO,EAAE,aAAa;IACtB,4FAA4F;IAC5F,SAAS,EAA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iBAAiB,CAAC;AAEtD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,eAAe,EAAE,iBAAiB;IAClC,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,qBAAqB,EAAE,uBAAuB;IAC9C,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,WAAW,EAAE,aAAa;IAC1B,6FAA6F;IAC7F,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AAGX,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,iEAAiE;AACjE,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC;AAChD,mFAAmF;AACnF,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC;AACxD,kFAAkF;AAClF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAC/C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC;AACvD,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC"}
|
|
@@ -22,7 +22,31 @@ export declare function phase1TrailingFloor(state: DslState): number;
|
|
|
22
22
|
export declare function phase1BaseFloor(state: DslState): number;
|
|
23
23
|
export declare function effectiveFloor(state: DslState): number;
|
|
24
24
|
export declare function isBreach(state: DslState, price: number): boolean;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Does the runtime's LAST KNOWN exchange stop sit at or beyond the floor, so that the venue —
|
|
27
|
+
* not the runtime — is the thing that should exit this position?
|
|
28
|
+
*
|
|
29
|
+
* This reads two locally cached fields and never asks the venue itself. What keeps them honest
|
|
30
|
+
* is the monitor's top-of-tick order-status check, which runs before this and clears both when
|
|
31
|
+
* the venue reports the stop gone (cancelled or rejected). The residual is a status neither the
|
|
32
|
+
* live set nor the gone set recognises: that fails open and leaves the cache as it was, so this
|
|
33
|
+
* still answers "we believe a stop is resting there" rather than "one is".
|
|
34
|
+
*
|
|
35
|
+
* **Phase 2 only, and that gate is load-bearing.** In phase 1 the exchange stop is only the
|
|
36
|
+
* `max_loss_pct` absolute floor (`exchangeStopLossTriggerPx`), which equals `floorPrice` for as
|
|
37
|
+
* long as the trailing floor has not risen above it — so without the gate this would answer
|
|
38
|
+
* "resting" on an ordinary phase-1 position and silently disable the breach close, which is the
|
|
39
|
+
* exit path that works today.
|
|
40
|
+
*
|
|
41
|
+
* `handoffStatus === "ok"` is deliberately not a second, independent answer: both sites that
|
|
42
|
+
* flip a position to `"ok"` mirror the backend's `activeSLOrderId` into `slOrderId` and its
|
|
43
|
+
* `tierFloorPrice` into `lastSyncedFloorPrice` as they do so, and `handleHandoffOk` re-mirrors
|
|
44
|
+
* on every subsequent poll — so this one predicate already covers backend-owned positions, and
|
|
45
|
+
* it must, because `dsl-engine` cannot close a position at all. The mirror on the registration
|
|
46
|
+
* tick is load-bearing: this predicate runs before `handleHandoffOk` in the tick.
|
|
47
|
+
*/
|
|
48
|
+
export declare function hasRestingStopAtFloor(state: DslState): boolean;
|
|
49
|
+
/** Consecutive breaches before exit, in either phase (tier-level overrides removed in v2). */
|
|
26
50
|
export declare function resolveBreachesRequired(state: DslState): number;
|
|
27
51
|
/** Tier floor as ROE %; 0 when no tier. */
|
|
28
52
|
export declare function computeLockedProfitPct(state: DslState): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floors.d.ts","sourceRoot":"","sources":["../../../src/dsl/engine/floors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAMzD,4BAA4B;AAC5B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"floors.d.ts","sourceRoot":"","sources":["../../../src/dsl/engine/floors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAMzD,4BAA4B;AAC5B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED,gGAAgG;AAChG,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAc3E;AAED,8FAA8F;AAC9F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAO3D;AAED,2HAA2H;AAC3H,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAOvD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAgBtD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGhE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CA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