@senpi-ai/runtime 1.1.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/actions/action-runtime-module.d.ts.map +1 -1
- package/dist/actions/action-runtime-module.js +1 -1
- 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 +61 -14
- 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 +3 -0
- package/dist/actions/decision-engine.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +161 -26
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts +6 -0
- package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.js +48 -0
- package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
- package/dist/actions/tracking-helpers.d.ts +16 -1
- package/dist/actions/tracking-helpers.d.ts.map +1 -1
- package/dist/actions/tracking-helpers.js +55 -9
- package/dist/actions/tracking-helpers.js.map +1 -1
- package/dist/actions/types.d.ts +10 -2
- package/dist/actions/types.d.ts.map +1 -1
- package/dist/actions/types.js +8 -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 +84 -82
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/cli/senpi-commands.d.ts.map +1 -1
- package/dist/cli/senpi-commands.js +16 -110
- package/dist/cli/senpi-commands.js.map +1 -1
- package/dist/constants/dsl/index.d.ts +2 -0
- package/dist/constants/dsl/index.d.ts.map +1 -1
- package/dist/constants/dsl/index.js +2 -0
- package/dist/constants/dsl/index.js.map +1 -1
- package/dist/dsl/config/parse-tiers.d.ts.map +1 -1
- package/dist/dsl/config/parse-tiers.js +6 -2
- package/dist/dsl/config/parse-tiers.js.map +1 -1
- package/dist/dsl/engine-client/config-mapping.d.ts +3 -1
- package/dist/dsl/engine-client/config-mapping.d.ts.map +1 -1
- package/dist/dsl/engine-client/config-mapping.js +3 -1
- package/dist/dsl/engine-client/config-mapping.js.map +1 -1
- package/dist/dsl/engine-client/event-mapping.d.ts +2 -0
- package/dist/dsl/engine-client/event-mapping.d.ts.map +1 -1
- package/dist/dsl/engine-client/event-mapping.js +3 -0
- package/dist/dsl/engine-client/event-mapping.js.map +1 -1
- package/dist/dsl/events/build-closed-event.d.ts.map +1 -1
- package/dist/dsl/events/build-closed-event.js +1 -0
- package/dist/dsl/events/build-closed-event.js.map +1 -1
- package/dist/dsl/events/guards.d.ts.map +1 -1
- package/dist/dsl/events/guards.js +10 -0
- package/dist/dsl/events/guards.js.map +1 -1
- package/dist/dsl/events/handlers.d.ts +18 -2
- package/dist/dsl/events/handlers.d.ts.map +1 -1
- package/dist/dsl/events/handlers.js +304 -208
- package/dist/dsl/events/handlers.js.map +1 -1
- package/dist/dsl/events/initial-state.d.ts.map +1 -1
- package/dist/dsl/events/initial-state.js +3 -1
- package/dist/dsl/events/initial-state.js.map +1 -1
- package/dist/dsl/monitor/create-monitor.d.ts +15 -0
- package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
- package/dist/dsl/monitor/create-monitor.js +76 -9
- package/dist/dsl/monitor/create-monitor.js.map +1 -1
- package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
- package/dist/dsl/monitor/process-one-position.js +268 -82
- package/dist/dsl/monitor/process-one-position.js.map +1 -1
- package/dist/dsl/plugin/index.d.ts +16 -1
- package/dist/dsl/plugin/index.d.ts.map +1 -1
- package/dist/dsl/plugin/index.js +35 -4
- package/dist/dsl/plugin/index.js.map +1 -1
- package/dist/dsl/plugin/options.d.ts +18 -0
- package/dist/dsl/plugin/options.d.ts.map +1 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +272 -32
- package/dist/index.js.map +1 -1
- package/dist/recording/emitter.d.ts +27 -0
- package/dist/recording/emitter.d.ts.map +1 -0
- package/dist/recording/emitter.js +2 -0
- package/dist/recording/emitter.js.map +1 -0
- package/dist/recording/identity.d.ts +34 -0
- package/dist/recording/identity.d.ts.map +1 -0
- package/dist/recording/identity.js +2 -0
- package/dist/recording/identity.js.map +1 -0
- package/dist/recording/index.d.ts +11 -0
- package/dist/recording/index.d.ts.map +1 -0
- package/dist/recording/index.js +2 -0
- package/dist/recording/index.js.map +1 -0
- package/dist/recording/noop-emitter.d.ts +23 -0
- package/dist/recording/noop-emitter.d.ts.map +1 -0
- package/dist/recording/noop-emitter.js +22 -0
- package/dist/recording/noop-emitter.js.map +1 -0
- package/dist/recording/otel/attributes.d.ts +35 -0
- package/dist/recording/otel/attributes.d.ts.map +1 -0
- package/dist/recording/otel/attributes.js +131 -0
- package/dist/recording/otel/attributes.js.map +1 -0
- package/dist/recording/otel/constants.d.ts +123 -0
- package/dist/recording/otel/constants.d.ts.map +1 -0
- package/dist/recording/otel/constants.js +172 -0
- package/dist/recording/otel/constants.js.map +1 -0
- package/dist/recording/otel/ids.d.ts +25 -0
- package/dist/recording/otel/ids.d.ts.map +1 -0
- package/dist/recording/otel/ids.js +37 -0
- package/dist/recording/otel/ids.js.map +1 -0
- package/dist/recording/otel/index.d.ts +13 -0
- package/dist/recording/otel/index.d.ts.map +1 -0
- package/dist/recording/otel/index.js +9 -0
- package/dist/recording/otel/index.js.map +1 -0
- package/dist/recording/otel/mappers.d.ts +100 -0
- package/dist/recording/otel/mappers.d.ts.map +1 -0
- package/dist/recording/otel/mappers.js +683 -0
- package/dist/recording/otel/mappers.js.map +1 -0
- package/dist/recording/otel/otel-emitter.d.ts +43 -0
- package/dist/recording/otel/otel-emitter.d.ts.map +1 -0
- package/dist/recording/otel/otel-emitter.js +99 -0
- package/dist/recording/otel/otel-emitter.js.map +1 -0
- package/dist/recording/otel/redaction.d.ts +47 -0
- package/dist/recording/otel/redaction.d.ts.map +1 -0
- package/dist/recording/otel/redaction.js +88 -0
- package/dist/recording/otel/redaction.js.map +1 -0
- package/dist/recording/records.d.ts +565 -0
- package/dist/recording/records.d.ts.map +1 -0
- package/dist/recording/records.js +14 -0
- package/dist/recording/records.js.map +1 -0
- package/dist/recording/transport/batcher.d.ts +59 -0
- package/dist/recording/transport/batcher.d.ts.map +1 -0
- package/dist/recording/transport/batcher.js +234 -0
- package/dist/recording/transport/batcher.js.map +1 -0
- package/dist/recording/transport/client.d.ts +41 -0
- package/dist/recording/transport/client.d.ts.map +1 -0
- package/dist/recording/transport/client.js +69 -0
- package/dist/recording/transport/client.js.map +1 -0
- package/dist/recording/transport/config.d.ts +53 -0
- package/dist/recording/transport/config.d.ts.map +1 -0
- package/dist/recording/transport/config.js +41 -0
- package/dist/recording/transport/config.js.map +1 -0
- package/dist/recording/transport/index.d.ts +16 -0
- package/dist/recording/transport/index.d.ts.map +1 -0
- package/dist/recording/transport/index.js +12 -0
- package/dist/recording/transport/index.js.map +1 -0
- package/dist/recording/transport/rows.d.ts +88 -0
- package/dist/recording/transport/rows.d.ts.map +1 -0
- package/dist/recording/transport/rows.js +15 -0
- package/dist/recording/transport/rows.js.map +1 -0
- package/dist/recording/wiring/emitter-factory.d.ts +39 -0
- package/dist/recording/wiring/emitter-factory.d.ts.map +1 -0
- package/dist/recording/wiring/emitter-factory.js +62 -0
- package/dist/recording/wiring/emitter-factory.js.map +1 -0
- package/dist/recording/wiring/identity.d.ts +27 -0
- package/dist/recording/wiring/identity.d.ts.map +1 -0
- package/dist/recording/wiring/identity.js +51 -0
- package/dist/recording/wiring/identity.js.map +1 -0
- package/dist/recording/wiring/index.d.ts +12 -0
- package/dist/recording/wiring/index.d.ts.map +1 -0
- package/dist/recording/wiring/index.js +9 -0
- package/dist/recording/wiring/index.js.map +1 -0
- package/dist/recording/wiring/record-builders.d.ts +107 -0
- package/dist/recording/wiring/record-builders.d.ts.map +1 -0
- package/dist/recording/wiring/record-builders.js +706 -0
- package/dist/recording/wiring/record-builders.js.map +1 -0
- package/dist/recording/wiring/subscriber.d.ts +28 -0
- package/dist/recording/wiring/subscriber.d.ts.map +1 -0
- package/dist/recording/wiring/subscriber.js +173 -0
- package/dist/recording/wiring/subscriber.js.map +1 -0
- package/dist/recording/wiring/values.d.ts +19 -0
- package/dist/recording/wiring/values.d.ts.map +1 -0
- package/dist/recording/wiring/values.js +49 -0
- package/dist/recording/wiring/values.js.map +1 -0
- package/dist/runtime/auto-update/command-runner.d.ts.map +1 -1
- package/dist/runtime/auto-update/command-runner.js +5 -1
- package/dist/runtime/auto-update/command-runner.js.map +1 -1
- package/dist/runtime/auto-update/resolve-package-name.d.ts +10 -0
- package/dist/runtime/auto-update/resolve-package-name.d.ts.map +1 -0
- package/dist/runtime/auto-update/resolve-package-name.js +35 -0
- package/dist/runtime/auto-update/resolve-package-name.js.map +1 -0
- package/dist/runtime/auto-update/run-update-command.d.ts +2 -0
- package/dist/runtime/auto-update/run-update-command.d.ts.map +1 -0
- package/dist/runtime/auto-update/run-update-command.js +37 -0
- package/dist/runtime/auto-update/run-update-command.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/create-scanner-module.d.ts +4 -3
- package/dist/runtime/create-scanner-module.d.ts.map +1 -1
- package/dist/runtime/create-scanner-module.js +14 -5
- package/dist/runtime/create-scanner-module.js.map +1 -1
- package/dist/runtime/create-scanner-providers-for-run.d.ts.map +1 -1
- package/dist/runtime/create-scanner-providers-for-run.js +12 -1
- package/dist/runtime/create-scanner-providers-for-run.js.map +1 -1
- package/dist/runtime/load-runtime-config.d.ts +9 -0
- package/dist/runtime/load-runtime-config.d.ts.map +1 -1
- package/dist/runtime/load-runtime-config.js +41 -8
- package/dist/runtime/load-runtime-config.js.map +1 -1
- package/dist/runtime/map-strategies-registration.js +7 -8
- package/dist/runtime/map-strategies-registration.js.map +1 -1
- package/dist/runtime/map-strategies.d.ts.map +1 -1
- package/dist/runtime/map-strategies.js +12 -3
- package/dist/runtime/map-strategies.js.map +1 -1
- package/dist/runtime/recipe-version.d.ts +1 -1
- package/dist/runtime/recipe-version.d.ts.map +1 -1
- package/dist/runtime/recipe-version.js +1 -1
- package/dist/runtime/recipe-version.js.map +1 -1
- package/dist/runtime/reconcile-decide.d.ts +73 -0
- package/dist/runtime/reconcile-decide.d.ts.map +1 -0
- package/dist/runtime/reconcile-decide.js +186 -0
- package/dist/runtime/reconcile-decide.js.map +1 -0
- package/dist/runtime/reconcile-run.d.ts +62 -0
- package/dist/runtime/reconcile-run.d.ts.map +1 -0
- package/dist/runtime/reconcile-run.js +173 -0
- package/dist/runtime/reconcile-run.js.map +1 -0
- package/dist/runtime/reconcile-state.d.ts +44 -0
- package/dist/runtime/reconcile-state.d.ts.map +1 -1
- package/dist/runtime/reconcile-state.js +80 -44
- package/dist/runtime/reconcile-state.js.map +1 -1
- package/dist/runtime/risk-guard.d.ts +10 -0
- package/dist/runtime/risk-guard.d.ts.map +1 -1
- package/dist/runtime/risk-guard.js +23 -24
- package/dist/runtime/risk-guard.js.map +1 -1
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +3 -2
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/runtime-schema.d.ts +4056 -793
- package/dist/runtime/runtime-schema.d.ts.map +1 -1
- package/dist/runtime/runtime-schema.js +183 -46
- package/dist/runtime/runtime-schema.js.map +1 -1
- package/dist/runtime/runtime-version.d.ts +3 -6
- package/dist/runtime/runtime-version.d.ts.map +1 -1
- package/dist/runtime/runtime-version.js +3 -6
- package/dist/runtime/runtime-version.js.map +1 -1
- package/dist/runtime/runtime.d.ts +47 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +517 -134
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/scanner-registry.d.ts +1 -1
- package/dist/runtime/scanner-registry.d.ts.map +1 -1
- package/dist/runtime/scanner-registry.js +3 -12
- package/dist/runtime/scanner-registry.js.map +1 -1
- package/dist/runtime/strategy-lifecycle.d.ts +45 -0
- package/dist/runtime/strategy-lifecycle.d.ts.map +1 -0
- package/dist/runtime/strategy-lifecycle.js +117 -0
- package/dist/runtime/strategy-lifecycle.js.map +1 -0
- package/dist/runtime/strategy-registry.d.ts +6 -0
- package/dist/runtime/strategy-registry.d.ts.map +1 -1
- package/dist/runtime/strategy-registry.js +1 -0
- package/dist/runtime/strategy-registry.js.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.d.ts +222 -0
- package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -0
- package/dist/runtime/supervisor/long-running-supervisor.js +625 -0
- package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -0
- package/dist/runtime/supervisor/orphan-sweep.d.ts +36 -0
- package/dist/runtime/supervisor/orphan-sweep.d.ts.map +1 -0
- package/dist/runtime/supervisor/orphan-sweep.js +255 -0
- package/dist/runtime/supervisor/orphan-sweep.js.map +1 -0
- package/dist/runtime/supervisor/supervisor-utils.d.ts +37 -0
- package/dist/runtime/supervisor/supervisor-utils.d.ts.map +1 -0
- package/dist/runtime/supervisor/supervisor-utils.js +175 -0
- package/dist/runtime/supervisor/supervisor-utils.js.map +1 -0
- package/dist/runtime-api/handlers/ingest-signals.d.ts +3 -3
- package/dist/runtime-api/handlers/ingest-signals.js +3 -3
- package/dist/runtime-api/intake/acceptance-record.d.ts +103 -0
- package/dist/runtime-api/intake/acceptance-record.d.ts.map +1 -0
- package/dist/runtime-api/intake/acceptance-record.js +192 -0
- package/dist/runtime-api/intake/acceptance-record.js.map +1 -0
- package/dist/runtime-api/intake/intake-context.d.ts +31 -0
- package/dist/runtime-api/intake/intake-context.d.ts.map +1 -0
- package/dist/runtime-api/intake/intake-context.js +21 -0
- package/dist/runtime-api/intake/intake-context.js.map +1 -0
- package/dist/runtime-api/intake/intake-mount.d.ts +118 -0
- package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -0
- package/dist/runtime-api/intake/intake-mount.js +193 -0
- package/dist/runtime-api/intake/intake-mount.js.map +1 -0
- package/dist/runtime-api/intake/liveness-store.d.ts +32 -0
- package/dist/runtime-api/intake/liveness-store.d.ts.map +1 -0
- package/dist/runtime-api/intake/liveness-store.js +31 -0
- package/dist/runtime-api/intake/liveness-store.js.map +1 -0
- package/dist/runtime-api/intake/process-error-post.d.ts +15 -0
- package/dist/runtime-api/intake/process-error-post.d.ts.map +1 -0
- package/dist/runtime-api/intake/process-error-post.js +19 -0
- package/dist/runtime-api/intake/process-error-post.js.map +1 -0
- package/dist/runtime-api/intake/process-signal-post.d.ts +73 -0
- package/dist/runtime-api/intake/process-signal-post.d.ts.map +1 -0
- package/dist/runtime-api/intake/process-signal-post.js +188 -0
- package/dist/runtime-api/intake/process-signal-post.js.map +1 -0
- package/dist/runtime-api/intake/scanner-launcher.d.ts +133 -0
- package/dist/runtime-api/intake/scanner-launcher.d.ts.map +1 -0
- package/dist/runtime-api/intake/scanner-launcher.js +204 -0
- package/dist/runtime-api/intake/scanner-launcher.js.map +1 -0
- package/dist/runtime-api/intake/scanner-registry.d.ts +36 -0
- package/dist/runtime-api/intake/scanner-registry.d.ts.map +1 -0
- package/dist/runtime-api/intake/scanner-registry.js +29 -0
- package/dist/runtime-api/intake/scanner-registry.js.map +1 -0
- package/dist/runtime-api/intake/types.d.ts +61 -0
- package/dist/runtime-api/intake/types.d.ts.map +1 -0
- package/dist/runtime-api/intake/types.js +8 -0
- package/dist/runtime-api/intake/types.js.map +1 -0
- package/dist/runtime-api/routes/signals.d.ts +20 -40
- package/dist/runtime-api/routes/signals.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.js +119 -75
- package/dist/runtime-api/routes/signals.js.map +1 -1
- package/dist/runtime-api/routes/signals.schema.d.ts +24 -86
- package/dist/runtime-api/routes/signals.schema.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.schema.js +35 -50
- package/dist/runtime-api/routes/signals.schema.js.map +1 -1
- package/dist/runtime-api/server.d.ts +15 -6
- package/dist/runtime-api/server.d.ts.map +1 -1
- package/dist/runtime-api/server.js +12 -12
- package/dist/runtime-api/server.js.map +1 -1
- package/dist/scanners/events.d.ts +6 -0
- package/dist/scanners/events.d.ts.map +1 -1
- package/dist/scanners/events.js.map +1 -1
- package/dist/scanners/external/scaffold/__init__.py +16 -0
- package/dist/scanners/external/scaffold/__main__.py +155 -0
- package/dist/scanners/external/scaffold/ctx.py +78 -0
- package/dist/scanners/external/scaffold/delivery.py +263 -0
- package/dist/scanners/external/scaffold/entrypoint_loader.py +151 -0
- package/dist/scanners/external/scaffold/http_post.py +70 -0
- package/dist/scanners/external/scaffold/journal.py +247 -0
- package/dist/scanners/external/scaffold/loop_primitives.py +65 -0
- package/dist/scanners/external/scaffold/requirements.txt +11 -0
- package/dist/scanners/external/scaffold/scaffold.py +361 -0
- package/dist/scanners/external/scaffold/scaffold_state.py +114 -0
- package/dist/scanners/external/scaffold/senpi_mcp.py +250 -0
- package/dist/scanners/external/scaffold/signal_envelope.py +220 -0
- package/dist/scanners/external/scaffold/state_manager.py +175 -0
- package/dist/scanners/external-scanner-receiver.d.ts +17 -1
- package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
- package/dist/scanners/external-scanner-receiver.js +16 -3
- package/dist/scanners/external-scanner-receiver.js.map +1 -1
- package/dist/scanners/implementations/external-scanner.d.ts.map +1 -1
- package/dist/scanners/implementations/external-scanner.js +7 -1
- package/dist/scanners/implementations/external-scanner.js.map +1 -1
- package/dist/scanners/implementations/momentum.d.ts.map +1 -1
- package/dist/scanners/implementations/momentum.js +16 -0
- package/dist/scanners/implementations/momentum.js.map +1 -1
- package/dist/scanners/runtime-module.d.ts.map +1 -1
- package/dist/scanners/runtime-module.js +9 -1
- package/dist/scanners/runtime-module.js.map +1 -1
- package/dist/scripts/run-dsl-standalone-live.d.ts +1 -1
- package/dist/scripts/run-dsl-standalone-live.js +5 -3
- package/dist/scripts/run-dsl-standalone-live.js.map +1 -1
- package/dist/senpi/client.d.ts +56 -4
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +123 -24
- package/dist/senpi/client.js.map +1 -1
- package/dist/senpi/index.d.ts +2 -1
- package/dist/senpi/index.d.ts.map +1 -1
- package/dist/senpi/index.js +1 -1
- package/dist/senpi/index.js.map +1 -1
- package/dist/senpi/types.d.ts +1 -2
- package/dist/senpi/types.d.ts.map +1 -1
- package/dist/state/state-manager.d.ts +17 -0
- package/dist/state/state-manager.d.ts.map +1 -1
- package/dist/state/state-manager.js +55 -4
- package/dist/state/state-manager.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 +62 -9
- package/dist/strategy/strategy-state.js.map +1 -1
- package/dist/tracking/build-rehydrate-items.d.ts +15 -0
- package/dist/tracking/build-rehydrate-items.d.ts.map +1 -0
- package/dist/tracking/build-rehydrate-items.js +19 -0
- package/dist/tracking/build-rehydrate-items.js.map +1 -0
- package/dist/tracking/constants.d.ts.map +1 -1
- package/dist/tracking/constants.js +2 -0
- package/dist/tracking/constants.js.map +1 -1
- package/dist/tracking/index.d.ts +3 -0
- package/dist/tracking/index.d.ts.map +1 -1
- package/dist/tracking/index.js +2 -0
- package/dist/tracking/index.js.map +1 -1
- package/dist/tracking/position-id-registry.d.ts +69 -0
- package/dist/tracking/position-id-registry.d.ts.map +1 -0
- package/dist/tracking/position-id-registry.js +139 -0
- package/dist/tracking/position-id-registry.js.map +1 -0
- package/dist/tracking/spans/fan-out-span-transport.d.ts +22 -0
- package/dist/tracking/spans/fan-out-span-transport.d.ts.map +1 -0
- package/dist/tracking/spans/fan-out-span-transport.js +49 -0
- package/dist/tracking/spans/fan-out-span-transport.js.map +1 -0
- package/dist/tracking/spans/otel/fit-row-budget.d.ts +22 -0
- package/dist/tracking/spans/otel/fit-row-budget.d.ts.map +1 -0
- package/dist/tracking/spans/otel/fit-row-budget.js +91 -0
- package/dist/tracking/spans/otel/fit-row-budget.js.map +1 -0
- package/dist/tracking/spans/otel/map-span-to-trace-row.d.ts +16 -0
- package/dist/tracking/spans/otel/map-span-to-trace-row.d.ts.map +1 -0
- package/dist/tracking/spans/otel/map-span-to-trace-row.js +227 -0
- package/dist/tracking/spans/otel/map-span-to-trace-row.js.map +1 -0
- package/dist/tracking/spans/otel/recording-span-transport.d.ts +43 -0
- package/dist/tracking/spans/otel/recording-span-transport.d.ts.map +1 -0
- package/dist/tracking/spans/otel/recording-span-transport.js +67 -0
- package/dist/tracking/spans/otel/recording-span-transport.js.map +1 -0
- package/dist/tracking/spans/otel/span-ids.d.ts +22 -0
- package/dist/tracking/spans/otel/span-ids.d.ts.map +1 -0
- package/dist/tracking/spans/otel/span-ids.js +32 -0
- package/dist/tracking/spans/otel/span-ids.js.map +1 -0
- package/dist/tracking/spans/plugin-span-tracker.d.ts +6 -0
- package/dist/tracking/spans/plugin-span-tracker.d.ts.map +1 -1
- package/dist/tracking/spans/plugin-span-tracker.js +82 -9
- package/dist/tracking/spans/plugin-span-tracker.js.map +1 -1
- package/dist/tracking/spans/redact-pii.d.ts +3 -1
- package/dist/tracking/spans/redact-pii.d.ts.map +1 -1
- package/dist/tracking/spans/redact-pii.js +5 -1
- package/dist/tracking/spans/redact-pii.js.map +1 -1
- package/dist/tracking/spans/span-transport.d.ts +6 -0
- package/dist/tracking/spans/span-transport.d.ts.map +1 -1
- package/dist/tracking/spans/span-transport.js +1 -1
- package/dist/tracking/spans/span-transport.js.map +1 -1
- package/dist/types/dsl/index.d.ts +24 -1
- package/dist/types/dsl/index.d.ts.map +1 -1
- package/dist/types/hooks.d.ts +1 -0
- package/dist/types/hooks.d.ts.map +1 -1
- package/dist/types/hooks.js +1 -0
- package/dist/types/hooks.js.map +1 -1
- package/dist/types/runtime.d.ts +6 -0
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/scanner.d.ts +7 -0
- package/dist/types/scanner.d.ts.map +1 -1
- package/dist/types/strategy.d.ts +3 -1
- package/dist/types/strategy.d.ts.map +1 -1
- package/dist/utils/keyed-mutex.d.ts +37 -0
- package/dist/utils/keyed-mutex.d.ts.map +1 -0
- package/dist/utils/keyed-mutex.js +77 -0
- package/dist/utils/keyed-mutex.js.map +1 -0
- package/dist/utils/safe-spawn.d.ts +6 -0
- package/dist/utils/safe-spawn.d.ts.map +1 -0
- package/dist/utils/safe-spawn.js +62 -0
- package/dist/utils/safe-spawn.js.map +1 -0
- package/examples/strategies/README.md +17 -12
- package/examples/strategies/iguana/README.md +135 -0
- package/examples/strategies/iguana/recipe.yaml +137 -0
- package/examples/strategies/iguana/scanners/scan.py +243 -0
- package/examples/strategies/iguana/scanners/scoring.py +152 -0
- package/examples/strategies/raptor/README.md +156 -0
- package/examples/strategies/raptor/recipe.yaml +154 -0
- package/examples/strategies/raptor/scanners/scan.py +349 -0
- package/examples/strategies/raptor/scanners/scoring.py +452 -0
- package/examples/strategies/spider/README.md +89 -0
- package/examples/strategies/spider/scalp/recipe.yaml +129 -0
- package/examples/strategies/spider/scalp/scanners/scan.py +219 -0
- package/examples/strategies/spider/scalp/scanners/scoring.py +179 -0
- package/examples/strategies/spider/swing/recipe.yaml +137 -0
- package/examples/strategies/spider/swing/scanners/scan.py +334 -0
- package/examples/strategies/spider/swing/scanners/scoring.py +184 -0
- package/examples/strategies/turbine/README.md +166 -0
- package/examples/strategies/turbine/recipe-runners.yaml +123 -0
- package/examples/strategies/turbine/recipe-volume.yaml +129 -0
- package/examples/strategies/turbine/scanners/scan.py +283 -0
- package/examples/strategies/turbine/scanners/scoring.py +190 -0
- package/openclaw.plugin.json +12 -1
- package/package.json +3 -3
- package/dist/runtime-api/handlers/group-by-scanner.d.ts +0 -43
- package/dist/runtime-api/handlers/group-by-scanner.d.ts.map +0 -1
- package/dist/runtime-api/handlers/group-by-scanner.js +0 -43
- package/dist/runtime-api/handlers/group-by-scanner.js.map +0 -1
- package/dist/scanners/external/liquidation-watchdog/README.md +0 -107
- package/dist/scanners/external/liquidation-watchdog/liquidation-watchdog.yaml +0 -48
- package/dist/scanners/external/liquidation-watchdog/producer.mjs +0 -336
- package/dist/scanners/external/momentum/README.md +0 -148
- package/dist/scanners/external/momentum/momentum.yaml +0 -116
- package/dist/scanners/external/momentum/producer.mjs +0 -251
- package/dist/scanners/external/shared/ingest.mjs +0 -112
- package/examples/README.md +0 -89
- package/examples/scanners-consumer-quickstart.mjs +0 -134
- package/examples/scanners-emerging-movers-v4.mjs +0 -287
- package/examples/scanners-liquidation-watchdog.mjs +0 -341
- package/examples/scanners-live-mcp.mjs +0 -208
- package/examples/scanners-multi-strategy.mjs +0 -165
- package/examples/scanners-position-tracker-e2e.mjs +0 -225
- package/examples/scanners-scheduled-events.mjs +0 -96
- package/examples/scanners-senpi-provider-client.mjs +0 -182
- package/examples/scanners-single-strategy.mjs +0 -198
- package/examples/strategies/dsl-showcase.yaml +0 -68
- package/examples/strategies/dsl.yaml +0 -51
- package/examples/strategies/fox-minimal-loosened.yaml +0 -240
- package/examples/strategies/fox-minimal.yaml +0 -242
- package/examples/strategies/minimal.yaml +0 -46
- package/examples/strategies/momentum/how-it-works.md +0 -48
- package/examples/strategies/momentum/momentum-guarded.yaml +0 -161
- package/examples/strategies/risk-showcase.yaml +0 -93
- package/examples/strategies/viper.yaml +0 -67
- package/examples/strategies/wolf.yaml +0 -72
- package/examples/yamls/sample-with-dsl-and-emerging-movers.yaml +0 -123
|
@@ -10,9 +10,59 @@ import { shouldSyncExchangeSl } from "./exchange-sync.js";
|
|
|
10
10
|
import { mapTiersToEngineConfig, mapEnginePositionToStateFields, parseSlOrderId } from "../engine-client/config-mapping.js";
|
|
11
11
|
import { mapBackendEventToBusEvent } from "../engine-client/event-mapping.js";
|
|
12
12
|
import { buildDslClosedEventFromState } from "../events/build-closed-event.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
import { parseCloseFillDetail } from "../../senpi/client.js";
|
|
14
|
+
/**
|
|
15
|
+
* Re-read the key under its per-key lock; if it is still active, archive it and return true.
|
|
16
|
+
* If a competing locked writer already archived/inactivated it, skip and return false (WARN).
|
|
17
|
+
*
|
|
18
|
+
* The re-read and the archive run inside ONE withKeyLock so the decision and the write are
|
|
19
|
+
* atomic against the other writers (bus close handler, reconcile) that mutate the same key
|
|
20
|
+
* under the same lock. The caller emits bus events only when this returns true, keeping the
|
|
21
|
+
* emit OUTSIDE the lock (the close handlers take the same key lock — emitting inside would
|
|
22
|
+
* nest a non-reentrant lock).
|
|
23
|
+
*/
|
|
24
|
+
async function archiveIfStillActive(stateManager, key, address, asset, dex, buildClosedState, ctx) {
|
|
25
|
+
return stateManager.withKeyLock(key, async () => {
|
|
26
|
+
const current = await stateManager.getOrLoad(key);
|
|
27
|
+
if (!current?.active) {
|
|
28
|
+
logger.warn(ctx.skipMessage, { tickId: ctx.tickId, address, asset, key });
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
await stateManager.archiveAndDeleteDslState(address, asset, dex, buildClosedState(current));
|
|
32
|
+
return true;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Re-read the key under its per-key lock; if it is still active, persist the next state and
|
|
37
|
+
* return true. If a competing locked writer already archived/inactivated it, skip and return
|
|
38
|
+
* false (WARN) so the monitor cannot resurrect a closed position by writing active:true onto a
|
|
39
|
+
* deleted key. `buildNext` receives the fresh in-lock state so read-modify-writes (counter bumps,
|
|
40
|
+
* field stamps) merge onto current values; callers persisting a fully-computed replacement (e.g.
|
|
41
|
+
* the dslTick result) may ignore it and return their own state.
|
|
42
|
+
*/
|
|
43
|
+
async function setIfStillActive(stateManager, key, address, asset, buildNext, ctx) {
|
|
44
|
+
return stateManager.withKeyLock(key, async () => {
|
|
45
|
+
const current = await stateManager.getOrLoad(key);
|
|
46
|
+
if (!current?.active) {
|
|
47
|
+
logger.warn(ctx.skipMessage, { tickId: ctx.tickId, address, asset, key });
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
await stateManager.set(key, buildNext(current));
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Telemetry stamps for a flat POSITION_CLOSED emit: the cross-flow position.id plus the
|
|
56
|
+
* closing-order fill detail when a close response (or SL order id) is available. Data-only —
|
|
57
|
+
* no consumer branches on these; the venue `orderId` is the fills-ledger join key for
|
|
58
|
+
* post-hoc lifecycle correlation.
|
|
59
|
+
*/
|
|
60
|
+
function closedEmitStamps(state, fill = {}) {
|
|
61
|
+
return {
|
|
62
|
+
__positionId: state.positionId ?? state.correlationId,
|
|
63
|
+
__correlationId: state.correlationId,
|
|
64
|
+
...fill,
|
|
65
|
+
};
|
|
16
66
|
}
|
|
17
67
|
export async function processOnePosition(ctx, key, state, price) {
|
|
18
68
|
const { tickId, ts, now: isoNow, stateManager, strategyStates, bus, isSlPlacementInProgress = () => false } = ctx;
|
|
@@ -56,18 +106,18 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
56
106
|
slOrderId: state.slOrderId,
|
|
57
107
|
address: state.address,
|
|
58
108
|
});
|
|
59
|
-
if (!(await isDslKeyStillActive(stateManager, key))) {
|
|
60
|
-
logger.info("[dsl] skip SL-hit archive: state already cleared (concurrent close)", { tickId, key });
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
109
|
const closedState = { ...state, active: false, closedAt: ts, closeReason: CLOSE_REASON.EXCHANGE_SL_HIT };
|
|
64
|
-
await stateManager
|
|
110
|
+
const archived = await archiveIfStillActive(stateManager, key, state.address, state.asset, effectiveDex(state), () => closedState, { tickId, skipMessage: "[dsl] skip SL-hit archive: state already cleared (concurrent close)" });
|
|
111
|
+
if (!archived)
|
|
112
|
+
return;
|
|
65
113
|
bus.emit(EVENTS.POSITION_CLOSED, {
|
|
66
114
|
address: state.address,
|
|
67
115
|
asset: state.asset,
|
|
68
116
|
wallet: state.wallet,
|
|
69
117
|
reason: CLOSE_REASON.EXCHANGE_SL_HIT,
|
|
70
118
|
closeReason: CLOSE_REASON.EXCHANGE_SL_HIT,
|
|
119
|
+
// The closing order IS the exchange SL order — its id joins the closing fill.
|
|
120
|
+
...closedEmitStamps(state, state.slOrderId != null ? { orderId: String(state.slOrderId) } : {}),
|
|
71
121
|
timestamp: ts,
|
|
72
122
|
});
|
|
73
123
|
bus.emit(DSL_EVENTS.CLOSED, buildDslClosedEventFromState(closedState, {
|
|
@@ -95,8 +145,10 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
95
145
|
reason: closeReasonToUse,
|
|
96
146
|
attempt: next.consecutiveCloseFailures,
|
|
97
147
|
});
|
|
148
|
+
const closeStartedAt = Date.now();
|
|
149
|
+
let closeAttemptEmitted = false;
|
|
98
150
|
try {
|
|
99
|
-
await withRetry(() => strategy.closePosition(state.asset, closeReasonToUse, state.dex || undefined, {
|
|
151
|
+
const closeResult = await withRetry(() => strategy.closePosition(state.asset, closeReasonToUse, state.dex || undefined, {
|
|
100
152
|
orderType: ctx.closeOrderType,
|
|
101
153
|
feeOptimizedLimitOptions: ctx.feeOptimizedLimitOptions,
|
|
102
154
|
}), {
|
|
@@ -105,23 +157,38 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
105
157
|
label: "closePosition (pendingClose)",
|
|
106
158
|
onRetry: (attempt, remaining, err) => logger.warn("[dsl] closePosition retry", { asset: state.asset, attempt, remaining, err }),
|
|
107
159
|
});
|
|
160
|
+
// Telemetry-only fire-and-forget: the venue-call window for the dsl.close_attempt span.
|
|
161
|
+
bus.emit("tracking.dsl_close_attempt", {
|
|
162
|
+
tickId,
|
|
163
|
+
key,
|
|
164
|
+
asset: state.asset,
|
|
165
|
+
dex,
|
|
166
|
+
positionId: state.positionId ?? state.correlationId,
|
|
167
|
+
startedAt: closeStartedAt,
|
|
168
|
+
endedAt: Date.now(),
|
|
169
|
+
outcome: "ok",
|
|
170
|
+
closeReason: closeReasonToUse,
|
|
171
|
+
attempt: next.consecutiveCloseFailures,
|
|
172
|
+
timestamp: isoNow(),
|
|
173
|
+
});
|
|
174
|
+
closeAttemptEmitted = true;
|
|
175
|
+
const closeFill = parseCloseFillDetail(closeResult);
|
|
108
176
|
logger.info("[dsl] closePosition succeeded, archiving (pendingClose)", {
|
|
109
177
|
tickId,
|
|
110
178
|
asset: state.asset,
|
|
111
179
|
reason: closeReasonToUse,
|
|
112
180
|
});
|
|
113
|
-
if (!(await isDslKeyStillActive(stateManager, key))) {
|
|
114
|
-
logger.info("[dsl] skip pendingClose archive: state already cleared (concurrent close)", { tickId, key });
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
181
|
const closedState = { ...next, active: false, closedAt: ts, closeReason: closeReasonToUse };
|
|
118
|
-
await stateManager
|
|
182
|
+
const archived = await archiveIfStillActive(stateManager, key, state.address, state.asset, effectiveDex(state), () => closedState, { tickId, skipMessage: "[dsl] skip pendingClose archive: state already cleared (concurrent close)" });
|
|
183
|
+
if (!archived)
|
|
184
|
+
return;
|
|
119
185
|
bus.emit(EVENTS.POSITION_CLOSED, {
|
|
120
186
|
address: state.address,
|
|
121
187
|
asset: state.asset,
|
|
122
188
|
wallet: state.wallet,
|
|
123
189
|
reason: closeReasonToUse,
|
|
124
190
|
closeReason: closeReasonToUse,
|
|
191
|
+
...closedEmitStamps(state, closeFill),
|
|
125
192
|
timestamp: ts,
|
|
126
193
|
});
|
|
127
194
|
bus.emit(DSL_EVENTS.CLOSED, buildDslClosedEventFromState(closedState, {
|
|
@@ -132,22 +199,40 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
132
199
|
}
|
|
133
200
|
catch (e) {
|
|
134
201
|
logger.warn("closePosition retry failed", { asset: state.asset, err: e });
|
|
202
|
+
// Telemetry-only fire-and-forget: the failed venue-call window (dsl.close_attempt, error).
|
|
203
|
+
// Guarded: when the ok emit already fired, the venue call itself succeeded — a later
|
|
204
|
+
// state-write throw must not be misattributed to the venue.
|
|
205
|
+
if (!closeAttemptEmitted) {
|
|
206
|
+
bus.emit("tracking.dsl_close_attempt", {
|
|
207
|
+
tickId,
|
|
208
|
+
key,
|
|
209
|
+
asset: state.asset,
|
|
210
|
+
dex,
|
|
211
|
+
positionId: state.positionId ?? state.correlationId,
|
|
212
|
+
startedAt: closeStartedAt,
|
|
213
|
+
endedAt: Date.now(),
|
|
214
|
+
outcome: "error",
|
|
215
|
+
closeReason: closeReasonToUse,
|
|
216
|
+
attempt: next.consecutiveCloseFailures,
|
|
217
|
+
error: String(e),
|
|
218
|
+
timestamp: isoNow(),
|
|
219
|
+
});
|
|
220
|
+
}
|
|
135
221
|
next.lastError = String(e);
|
|
136
222
|
next.lastErrorAt = ts;
|
|
137
|
-
|
|
138
|
-
if (
|
|
139
|
-
if (!(await isDslKeyStillActive(stateManager, key))) {
|
|
140
|
-
logger.info("[dsl] skip close-fail archive: state already cleared (concurrent close)", { tickId, key });
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
223
|
+
const crossedThreshold = (next.consecutiveCloseFailures ?? 0) >= MAX_CONSECUTIVE_CLOSE_FAILURES;
|
|
224
|
+
if (crossedThreshold) {
|
|
143
225
|
const failedCloseState = { ...next, active: false, closedAt: isoNow(), closeReason: CLOSE_REASON.CLOSE_POSITION_FAILED };
|
|
144
|
-
await stateManager
|
|
226
|
+
const archived = await archiveIfStillActive(stateManager, key, state.address, state.asset, effectiveDex(state), () => failedCloseState, { tickId, skipMessage: "[dsl] skip close-fail archive: state already cleared (concurrent close)" });
|
|
227
|
+
if (!archived)
|
|
228
|
+
return;
|
|
145
229
|
bus.emit(EVENTS.POSITION_CLOSED, {
|
|
146
230
|
address: state.address,
|
|
147
231
|
asset: state.asset,
|
|
148
232
|
wallet: state.wallet,
|
|
149
233
|
reason: "error",
|
|
150
234
|
closeReason: CLOSE_REASON.CLOSE_POSITION_FAILED,
|
|
235
|
+
...closedEmitStamps(state),
|
|
151
236
|
timestamp: isoNow(),
|
|
152
237
|
});
|
|
153
238
|
bus.emit(DSL_EVENTS.CLOSED, buildDslClosedEventFromState(failedCloseState, {
|
|
@@ -157,11 +242,13 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
157
242
|
}));
|
|
158
243
|
}
|
|
159
244
|
else {
|
|
245
|
+
await setIfStillActive(stateManager, key, state.address, state.asset, (current) => ({ ...current, lastError: String(e), lastErrorAt: ts, consecutiveCloseFailures: next.consecutiveCloseFailures }), { tickId, skipMessage: "[dsl] skip pendingClose error write: state already cleared (concurrent close)" });
|
|
160
246
|
bus.emit(DSL_EVENTS.CLOSE_PENDING, {
|
|
161
247
|
address: state.address,
|
|
162
248
|
asset: state.asset,
|
|
163
249
|
attempt: next.consecutiveCloseFailures,
|
|
164
250
|
triggerReason: state.triggerReason,
|
|
251
|
+
__positionId: state.positionId ?? state.correlationId,
|
|
165
252
|
__correlationId: state.correlationId,
|
|
166
253
|
timestamp: isoNow(),
|
|
167
254
|
});
|
|
@@ -172,7 +259,11 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
172
259
|
if (price == null) {
|
|
173
260
|
const next = { ...state, consecutiveFetchFailures: (state.consecutiveFetchFailures ?? 0) + 1 };
|
|
174
261
|
next.tickCount = (state.tickCount ?? 0) + 1;
|
|
175
|
-
await stateManager
|
|
262
|
+
await setIfStillActive(stateManager, key, state.address, state.asset, (current) => ({
|
|
263
|
+
...current,
|
|
264
|
+
consecutiveFetchFailures: (current.consecutiveFetchFailures ?? 0) + 1,
|
|
265
|
+
tickCount: (current.tickCount ?? 0) + 1,
|
|
266
|
+
}), { tickId, skipMessage: "[dsl] skip no-price counter write: state already cleared (concurrent close)" });
|
|
176
267
|
if (next.consecutiveFetchFailures >= DSL_PRICE_FETCH_FAILURE_WARN_THRESHOLD) {
|
|
177
268
|
logger.warn("[dsl] sustained price fetch failures for position", {
|
|
178
269
|
tickId,
|
|
@@ -199,7 +290,12 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
199
290
|
if (next.handoffStatus === "pending" && !strategy) {
|
|
200
291
|
next.handoffStatus = null;
|
|
201
292
|
}
|
|
202
|
-
await stateManager.
|
|
293
|
+
if (!(await setIfStillActive(stateManager, key, state.address, state.asset, () => next, {
|
|
294
|
+
tickId,
|
|
295
|
+
skipMessage: "[dsl] skip dslTick result write: state already cleared (concurrent close)",
|
|
296
|
+
}))) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
203
299
|
logger.info("[dsl] monitor dslTick result", {
|
|
204
300
|
tickId,
|
|
205
301
|
key,
|
|
@@ -224,8 +320,7 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
224
320
|
key,
|
|
225
321
|
asset: state.asset,
|
|
226
322
|
});
|
|
227
|
-
|
|
228
|
-
await stateManager.set(key, cleared);
|
|
323
|
+
await setIfStillActive(stateManager, key, state.address, state.asset, (current) => ({ ...current, closeReason: null }), { tickId, skipMessage: "[dsl] skip spurious-breach clear: state already cleared (concurrent close)" });
|
|
229
324
|
return;
|
|
230
325
|
}
|
|
231
326
|
logger.info("[dsl] dsl close: sending closePosition to exchange", {
|
|
@@ -257,8 +352,11 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
257
352
|
});
|
|
258
353
|
}
|
|
259
354
|
}
|
|
355
|
+
let closeFill = {};
|
|
356
|
+
const closeStartedAt = Date.now();
|
|
357
|
+
let closeAttemptEmitted = false;
|
|
260
358
|
try {
|
|
261
|
-
await withRetry(() => strategy.closePosition(state.asset, closeReasonToUse, state.dex || undefined, {
|
|
359
|
+
const closeResult = await withRetry(() => strategy.closePosition(state.asset, closeReasonToUse, state.dex || undefined, {
|
|
262
360
|
orderType: ctx.closeOrderType,
|
|
263
361
|
feeOptimizedLimitOptions: ctx.feeOptimizedLimitOptions,
|
|
264
362
|
}), {
|
|
@@ -267,6 +365,23 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
267
365
|
label: "closePosition (dsl breach/timeout)",
|
|
268
366
|
onRetry: (attempt, remaining, err) => logger.warn("[dsl] closePosition retry", { asset: state.asset, attempt, remaining, err }),
|
|
269
367
|
});
|
|
368
|
+
// Telemetry-only fire-and-forget: the venue-call window for the dsl.close_attempt span.
|
|
369
|
+
// Emitted before any post-venue work (fill parsing) so its outcome reflects the venue call alone.
|
|
370
|
+
bus.emit("tracking.dsl_close_attempt", {
|
|
371
|
+
tickId,
|
|
372
|
+
key,
|
|
373
|
+
asset: state.asset,
|
|
374
|
+
dex,
|
|
375
|
+
positionId: state.positionId ?? state.correlationId,
|
|
376
|
+
startedAt: closeStartedAt,
|
|
377
|
+
endedAt: Date.now(),
|
|
378
|
+
outcome: "ok",
|
|
379
|
+
closeReason: closeReasonToUse,
|
|
380
|
+
attempt: (next.consecutiveCloseFailures ?? 0) + 1,
|
|
381
|
+
timestamp: isoNow(),
|
|
382
|
+
});
|
|
383
|
+
closeAttemptEmitted = true;
|
|
384
|
+
closeFill = parseCloseFillDetail(closeResult);
|
|
270
385
|
}
|
|
271
386
|
catch (e) {
|
|
272
387
|
logger.warn("closePosition failed", { asset: state.asset, err: e });
|
|
@@ -278,20 +393,37 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
278
393
|
lastError: String(e),
|
|
279
394
|
lastErrorAt: ts,
|
|
280
395
|
};
|
|
281
|
-
|
|
396
|
+
// Telemetry-only fire-and-forget: the failed venue-call window (dsl.close_attempt, error).
|
|
397
|
+
// Guarded: when the ok emit already fired, the venue call itself succeeded — a later
|
|
398
|
+
// post-venue throw must not be misattributed to the venue.
|
|
399
|
+
if (!closeAttemptEmitted) {
|
|
400
|
+
bus.emit("tracking.dsl_close_attempt", {
|
|
401
|
+
tickId,
|
|
402
|
+
key,
|
|
403
|
+
asset: state.asset,
|
|
404
|
+
dex,
|
|
405
|
+
positionId: state.positionId ?? state.correlationId,
|
|
406
|
+
startedAt: closeStartedAt,
|
|
407
|
+
endedAt: Date.now(),
|
|
408
|
+
outcome: "error",
|
|
409
|
+
closeReason: closeReasonToUse,
|
|
410
|
+
attempt: pending.consecutiveCloseFailures,
|
|
411
|
+
error: String(e),
|
|
412
|
+
timestamp: isoNow(),
|
|
413
|
+
});
|
|
414
|
+
}
|
|
282
415
|
if ((pending.consecutiveCloseFailures ?? 0) >= MAX_CONSECUTIVE_CLOSE_FAILURES) {
|
|
283
|
-
if (!(await isDslKeyStillActive(stateManager, key))) {
|
|
284
|
-
logger.info("[dsl] skip breach close-fail archive: state already cleared (concurrent close)", { tickId, key });
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
416
|
const failedCloseState = { ...pending, active: false, closedAt: isoNow(), closeReason: CLOSE_REASON.CLOSE_POSITION_FAILED };
|
|
288
|
-
await stateManager
|
|
417
|
+
const archived = await archiveIfStillActive(stateManager, key, state.address, state.asset, effectiveDex(state), () => failedCloseState, { tickId, skipMessage: "[dsl] skip breach close-fail archive: state already cleared (concurrent close)" });
|
|
418
|
+
if (!archived)
|
|
419
|
+
return;
|
|
289
420
|
bus.emit(EVENTS.POSITION_CLOSED, {
|
|
290
421
|
address: state.address,
|
|
291
422
|
asset: state.asset,
|
|
292
423
|
wallet: state.wallet,
|
|
293
424
|
reason: "error",
|
|
294
425
|
closeReason: CLOSE_REASON.CLOSE_POSITION_FAILED,
|
|
426
|
+
...closedEmitStamps(state),
|
|
295
427
|
timestamp: isoNow(),
|
|
296
428
|
});
|
|
297
429
|
bus.emit(DSL_EVENTS.CLOSED, buildDslClosedEventFromState(failedCloseState, {
|
|
@@ -301,11 +433,13 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
301
433
|
}));
|
|
302
434
|
}
|
|
303
435
|
else {
|
|
436
|
+
await setIfStillActive(stateManager, key, state.address, state.asset, () => pending, { tickId, skipMessage: "[dsl] skip breach close-pending write: state already cleared (concurrent close)" });
|
|
304
437
|
bus.emit(DSL_EVENTS.CLOSE_PENDING, {
|
|
305
438
|
address: state.address,
|
|
306
439
|
asset: state.asset,
|
|
307
440
|
attempt: pending.consecutiveCloseFailures,
|
|
308
441
|
triggerReason: state.triggerReason,
|
|
442
|
+
__positionId: state.positionId ?? state.correlationId,
|
|
309
443
|
__correlationId: state.correlationId,
|
|
310
444
|
timestamp: isoNow(),
|
|
311
445
|
});
|
|
@@ -317,18 +451,17 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
317
451
|
asset: state.asset,
|
|
318
452
|
reason: closeReasonToUse,
|
|
319
453
|
});
|
|
320
|
-
if (!(await isDslKeyStillActive(stateManager, key))) {
|
|
321
|
-
logger.info("[dsl] skip dsl-breach archive: state already cleared (concurrent close)", { tickId, key });
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
454
|
const closedState = { ...next, active: false, closedAt: ts, closeReason: closeReasonToUse };
|
|
325
|
-
await stateManager
|
|
455
|
+
const archived = await archiveIfStillActive(stateManager, key, state.address, state.asset, effectiveDex(state), () => closedState, { tickId, skipMessage: "[dsl] skip dsl-breach archive: state already cleared (concurrent close)" });
|
|
456
|
+
if (!archived)
|
|
457
|
+
return;
|
|
326
458
|
bus.emit(EVENTS.POSITION_CLOSED, {
|
|
327
459
|
address: state.address,
|
|
328
460
|
asset: state.asset,
|
|
329
461
|
wallet: state.wallet,
|
|
330
462
|
reason: closeReasonToUse,
|
|
331
463
|
closeReason: closeReasonToUse,
|
|
464
|
+
...closedEmitStamps(state, closeFill),
|
|
332
465
|
timestamp: ts,
|
|
333
466
|
});
|
|
334
467
|
bus.emit(DSL_EVENTS.CLOSED, buildDslClosedEventFromState(closedState, {
|
|
@@ -354,6 +487,7 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
354
487
|
triggerPct: tier.triggerPct,
|
|
355
488
|
newFloorPrice: dslEffectiveFloor,
|
|
356
489
|
triggerReason: next.triggerReason,
|
|
490
|
+
__positionId: next.positionId ?? next.correlationId,
|
|
357
491
|
__correlationId: next.correlationId,
|
|
358
492
|
timestamp: ts,
|
|
359
493
|
direction: next.direction,
|
|
@@ -365,10 +499,7 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
365
499
|
lastPrice: next.lastPrice,
|
|
366
500
|
lockedProfitPct: next.lockedProfitPct,
|
|
367
501
|
});
|
|
368
|
-
|
|
369
|
-
if (afterTier?.active) {
|
|
370
|
-
await stateManager.set(key, { ...afterTier, lastTierNotificationAt: ts });
|
|
371
|
-
}
|
|
502
|
+
await setIfStillActive(stateManager, key, state.address, state.asset, (current) => ({ ...current, lastTierNotificationAt: ts }), { tickId, skipMessage: "[dsl] skip tier-notification stamp: state already cleared (concurrent close)" });
|
|
372
503
|
}
|
|
373
504
|
else {
|
|
374
505
|
logger.error("[dsl] TIER_ADVANCED skipped: tier missing at index (tiers must come from YAML/config)", {
|
|
@@ -387,6 +518,7 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
387
518
|
phase: result.newPhase ?? 2,
|
|
388
519
|
tierIndex: result.newTierIndex ?? 0,
|
|
389
520
|
triggerReason: next.triggerReason,
|
|
521
|
+
__positionId: next.positionId ?? next.correlationId,
|
|
390
522
|
__correlationId: next.correlationId,
|
|
391
523
|
timestamp: ts,
|
|
392
524
|
});
|
|
@@ -406,7 +538,7 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
406
538
|
asset: state.asset,
|
|
407
539
|
});
|
|
408
540
|
next.handoffStatus = "pending";
|
|
409
|
-
await stateManager.
|
|
541
|
+
await setIfStillActive(stateManager, key, state.address, state.asset, () => next, { tickId, skipMessage: "[dsl] skip catch-up handoff-pending write: state already cleared (concurrent close)" });
|
|
410
542
|
}
|
|
411
543
|
if (next.handoffStatus === "pending" && strategy) {
|
|
412
544
|
await attemptHandoffRegistration(ctx, key, next, state, strategy);
|
|
@@ -453,6 +585,8 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
453
585
|
phaseChanged: result.phaseChanged,
|
|
454
586
|
prevSlOrderId: next.slOrderId,
|
|
455
587
|
});
|
|
588
|
+
const slSyncStartedAt = Date.now();
|
|
589
|
+
let slUpdateEmitted = false;
|
|
456
590
|
try {
|
|
457
591
|
const res = await withRetry(() => strategy.editPosition({
|
|
458
592
|
coin: state.asset,
|
|
@@ -464,21 +598,44 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
464
598
|
label: "editPosition (SL sync)",
|
|
465
599
|
onRetry: (attempt, remaining, err) => logger.warn("[dsl] editPosition retry", { asset: state.asset, attempt, remaining, err }),
|
|
466
600
|
});
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
601
|
+
const slSyncEndedAt = Date.now();
|
|
602
|
+
// Telemetry-only fire-and-forget: the venue-call window for the dsl.sl_update span. Emitted
|
|
603
|
+
// immediately after the venue call resolves — before any state read/write — so it fires even
|
|
604
|
+
// when a concurrent close returns early below, and reports the venue's own answer
|
|
605
|
+
// (`res.slOrderId`), the honest venue-call fact.
|
|
606
|
+
bus.emit("tracking.dsl_sl_update", {
|
|
607
|
+
tickId,
|
|
608
|
+
key,
|
|
609
|
+
asset: state.asset,
|
|
610
|
+
dex,
|
|
611
|
+
positionId: state.positionId ?? state.correlationId,
|
|
612
|
+
startedAt: slSyncStartedAt,
|
|
613
|
+
endedAt: slSyncEndedAt,
|
|
614
|
+
outcome: "ok",
|
|
615
|
+
newSLPrice: exchangeTriggerPx,
|
|
616
|
+
slOrderId: res.slOrderId,
|
|
617
|
+
syncReason,
|
|
618
|
+
timestamp: isoNow(),
|
|
619
|
+
});
|
|
620
|
+
slUpdateEmitted = true;
|
|
621
|
+
let syncedForEmit = null;
|
|
622
|
+
await setIfStillActive(stateManager, key, state.address, state.asset, (current) => {
|
|
623
|
+
const synced = {
|
|
624
|
+
...current,
|
|
625
|
+
slOrderId: res.slOrderId ?? current.slOrderId,
|
|
626
|
+
lastSyncedFloorPrice: exchangeTriggerPx,
|
|
627
|
+
slOrderIdUpdatedAt: ts,
|
|
628
|
+
lastSlSyncError: null,
|
|
629
|
+
slSyncFailureCount: 0,
|
|
630
|
+
lastError: null,
|
|
631
|
+
lastErrorAt: null,
|
|
632
|
+
};
|
|
633
|
+
syncedForEmit = synced;
|
|
634
|
+
return synced;
|
|
635
|
+
}, { tickId, skipMessage: "[dsl] skip SL sync write: state no longer active (concurrent close)" });
|
|
636
|
+
if (!syncedForEmit)
|
|
470
637
|
return;
|
|
471
|
-
|
|
472
|
-
const synced = {
|
|
473
|
-
...freshAfterSl,
|
|
474
|
-
slOrderId: res.slOrderId ?? freshAfterSl.slOrderId,
|
|
475
|
-
lastSyncedFloorPrice: exchangeTriggerPx,
|
|
476
|
-
slOrderIdUpdatedAt: ts,
|
|
477
|
-
lastSlSyncError: null,
|
|
478
|
-
slSyncFailureCount: 0,
|
|
479
|
-
lastError: null,
|
|
480
|
-
lastErrorAt: null,
|
|
481
|
-
};
|
|
638
|
+
const synced = syncedForEmit;
|
|
482
639
|
logger.info("[dsl] exchange SL created/updated", {
|
|
483
640
|
tickId,
|
|
484
641
|
asset: state.asset,
|
|
@@ -487,37 +644,56 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
487
644
|
dslEffectiveFloor,
|
|
488
645
|
resSlOrderId: res.slOrderId,
|
|
489
646
|
});
|
|
490
|
-
await stateManager.set(key, synced);
|
|
491
647
|
bus.emit(DSL_EVENTS.SL_UPDATED, {
|
|
492
648
|
address: state.address,
|
|
493
649
|
asset: state.asset,
|
|
494
650
|
newSLPrice: exchangeTriggerPx,
|
|
495
651
|
slOrderId: synced.slOrderId ?? 0,
|
|
496
652
|
triggerReason: synced.triggerReason,
|
|
653
|
+
__positionId: synced.positionId ?? synced.correlationId,
|
|
497
654
|
__correlationId: synced.correlationId,
|
|
498
655
|
timestamp: ts,
|
|
499
656
|
});
|
|
500
657
|
}
|
|
501
658
|
catch (e) {
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
659
|
+
// Telemetry-only fire-and-forget: the failed venue-call window (dsl.sl_update, error).
|
|
660
|
+
// Guarded: when the ok emit already fired, the venue call itself succeeded — a later
|
|
661
|
+
// state-write throw must not be misattributed to the venue.
|
|
662
|
+
if (!slUpdateEmitted) {
|
|
663
|
+
bus.emit("tracking.dsl_sl_update", {
|
|
664
|
+
tickId,
|
|
665
|
+
key,
|
|
666
|
+
asset: state.asset,
|
|
667
|
+
dex,
|
|
668
|
+
positionId: state.positionId ?? state.correlationId,
|
|
669
|
+
startedAt: slSyncStartedAt,
|
|
670
|
+
endedAt: Date.now(),
|
|
671
|
+
outcome: "error",
|
|
672
|
+
newSLPrice: exchangeTriggerPx,
|
|
673
|
+
syncReason,
|
|
674
|
+
error: String(e),
|
|
675
|
+
timestamp: isoNow(),
|
|
676
|
+
});
|
|
506
677
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
678
|
+
let syncFailureCount = null;
|
|
679
|
+
await setIfStillActive(stateManager, key, state.address, state.asset, (current) => {
|
|
680
|
+
syncFailureCount = (current.slSyncFailureCount ?? 0) + 1;
|
|
681
|
+
return {
|
|
682
|
+
...current,
|
|
683
|
+
lastSlSyncError: String(e),
|
|
684
|
+
lastError: String(e),
|
|
685
|
+
lastErrorAt: ts,
|
|
686
|
+
slSyncFailureCount: syncFailureCount,
|
|
687
|
+
};
|
|
688
|
+
}, { tickId, skipMessage: "[dsl] skip SL sync-failure write: state no longer active (concurrent close)" });
|
|
689
|
+
if (syncFailureCount == null)
|
|
690
|
+
return;
|
|
515
691
|
logger.warn("[dsl] editPosition (SL update) failed", {
|
|
516
692
|
tickId,
|
|
517
693
|
asset: state.asset,
|
|
518
694
|
exchangeTriggerPx,
|
|
519
695
|
dslEffectiveFloor,
|
|
520
|
-
slSyncFailureCount:
|
|
696
|
+
slSyncFailureCount: syncFailureCount,
|
|
521
697
|
err: e,
|
|
522
698
|
});
|
|
523
699
|
}
|
|
@@ -551,13 +727,14 @@ export async function processOnePosition(ctx, key, state, price) {
|
|
|
551
727
|
currentTierIndex: hbState.currentTierIndex,
|
|
552
728
|
elapsedMinutes: hbState.elapsedMinutes,
|
|
553
729
|
triggerReason: hbState.triggerReason,
|
|
730
|
+
__positionId: hbState.positionId ?? hbState.correlationId,
|
|
554
731
|
__correlationId: hbState.correlationId,
|
|
555
732
|
margin: hbState.leverage > 0
|
|
556
733
|
? (hbState.size * hbState.entryPrice) / hbState.leverage
|
|
557
734
|
: 0,
|
|
558
735
|
timestamp: ts,
|
|
559
736
|
});
|
|
560
|
-
await stateManager
|
|
737
|
+
await setIfStillActive(stateManager, key, hbState.address, hbState.asset, (current) => ({ ...current, lastHeartbeatAt: ts }), { tickId, skipMessage: "[dsl] skip heartbeat stamp: state already cleared (concurrent close)" });
|
|
561
738
|
}
|
|
562
739
|
}
|
|
563
740
|
}
|
|
@@ -574,10 +751,10 @@ const BACKEND_TERMINAL_STATUSES = new Set([
|
|
|
574
751
|
"DELETED",
|
|
575
752
|
]);
|
|
576
753
|
/**
|
|
577
|
-
* A Phase
|
|
578
|
-
* exchange stop-loss
|
|
579
|
-
*
|
|
580
|
-
*
|
|
754
|
+
* A Phase-2 handoff is only "ok" once the backend confirms it has placed a live
|
|
755
|
+
* exchange stop-loss (a numeric activeSLOrderId). Without one, the runtime must
|
|
756
|
+
* keep the handoff "pending" and manage the SL itself rather than trust a backend
|
|
757
|
+
* that has accepted the position but not yet armed a stop (MA-3).
|
|
581
758
|
*/
|
|
582
759
|
function backendHasLiveSl(pos) {
|
|
583
760
|
return parseSlOrderId(pos.activeSLOrderId) != null;
|
|
@@ -612,7 +789,7 @@ async function attemptHandoffRegistration(ctx, key, next, _original, strategy) {
|
|
|
612
789
|
backendDslPositionId: adopted.id,
|
|
613
790
|
lastBackendDslTick: ts,
|
|
614
791
|
};
|
|
615
|
-
await stateManager.
|
|
792
|
+
await setIfStillActive(stateManager, key, next.address, next.asset, () => updated, { tickId, skipMessage: "[dsl] skip handoff adopt write: state already cleared (concurrent close)" });
|
|
616
793
|
Object.assign(next, updated);
|
|
617
794
|
return;
|
|
618
795
|
}
|
|
@@ -647,7 +824,7 @@ async function attemptHandoffRegistration(ctx, key, next, _original, strategy) {
|
|
|
647
824
|
rawResult: JSON.stringify(result).slice(0, 1000),
|
|
648
825
|
});
|
|
649
826
|
const aborted = { ...next, handoffStatus: "aborted" };
|
|
650
|
-
await stateManager.
|
|
827
|
+
await setIfStillActive(stateManager, key, next.address, next.asset, () => aborted, { tickId, skipMessage: "[dsl] skip handoff abort write: state already cleared (concurrent close)" });
|
|
651
828
|
Object.assign(next, aborted);
|
|
652
829
|
return;
|
|
653
830
|
}
|
|
@@ -667,7 +844,7 @@ async function attemptHandoffRegistration(ctx, key, next, _original, strategy) {
|
|
|
667
844
|
backendDslPositionId: result.position.id,
|
|
668
845
|
lastBackendDslTick: ts,
|
|
669
846
|
};
|
|
670
|
-
await stateManager.
|
|
847
|
+
await setIfStillActive(stateManager, key, next.address, next.asset, () => updated, { tickId, skipMessage: "[dsl] skip handoff register write: state already cleared (concurrent close)" });
|
|
671
848
|
Object.assign(next, updated);
|
|
672
849
|
logger.info("[dsl] handoff registered with backend", {
|
|
673
850
|
tickId,
|
|
@@ -724,7 +901,7 @@ async function handleHandoffOk(ctx, key, next, original, strategy) {
|
|
|
724
901
|
backendDslPositionId: null,
|
|
725
902
|
lastBackendDslTick: null,
|
|
726
903
|
};
|
|
727
|
-
await stateManager.
|
|
904
|
+
await setIfStillActive(stateManager, key, original.address, original.asset, () => rolledBack, { tickId, skipMessage: "[dsl] skip handoff rollback write: state already cleared (concurrent close)" });
|
|
728
905
|
return;
|
|
729
906
|
}
|
|
730
907
|
else {
|
|
@@ -741,13 +918,17 @@ async function handleHandoffOk(ctx, key, next, original, strategy) {
|
|
|
741
918
|
closedAt: ts,
|
|
742
919
|
closeReason,
|
|
743
920
|
};
|
|
744
|
-
await stateManager
|
|
921
|
+
const archived = await archiveIfStillActive(stateManager, key, original.address, original.asset, effectiveDex(original), () => closedState, { tickId, skipMessage: "[dsl] skip backend-terminal archive: state already cleared (concurrent close)" });
|
|
922
|
+
if (!archived)
|
|
923
|
+
return;
|
|
745
924
|
bus.emit(EVENTS.POSITION_CLOSED, {
|
|
746
925
|
address: original.address,
|
|
747
926
|
asset: original.asset,
|
|
748
927
|
wallet: original.wallet,
|
|
749
928
|
reason: closeReason,
|
|
750
929
|
closeReason,
|
|
930
|
+
// Backend-driven close: the closing order id is not locally verifiable — stamp ids only.
|
|
931
|
+
...closedEmitStamps(updated),
|
|
751
932
|
timestamp: ts,
|
|
752
933
|
});
|
|
753
934
|
bus.emit(DSL_EVENTS.CLOSED, buildDslClosedEventFromState(closedState, {
|
|
@@ -790,6 +971,7 @@ async function handleHandoffOk(ctx, key, next, original, strategy) {
|
|
|
790
971
|
tiers: original.tiers,
|
|
791
972
|
triggerReason: updated.triggerReason,
|
|
792
973
|
correlationId: updated.correlationId,
|
|
974
|
+
positionId: updated.positionId ?? updated.correlationId,
|
|
793
975
|
tierEnrichment: {
|
|
794
976
|
direction: updated.direction,
|
|
795
977
|
entryPrice: updated.entryPrice,
|
|
@@ -868,13 +1050,17 @@ async function handleHandoffOk(ctx, key, next, original, strategy) {
|
|
|
868
1050
|
closedAt: ts,
|
|
869
1051
|
closeReason,
|
|
870
1052
|
};
|
|
871
|
-
await stateManager
|
|
1053
|
+
const archived = await archiveIfStillActive(stateManager, key, original.address, original.asset, effectiveDex(original), () => closedState, { tickId, skipMessage: "[dsl] skip backend-CLOSED archive: state already cleared (concurrent close)" });
|
|
1054
|
+
if (!archived)
|
|
1055
|
+
return;
|
|
872
1056
|
bus.emit(EVENTS.POSITION_CLOSED, {
|
|
873
1057
|
address: original.address,
|
|
874
1058
|
asset: original.asset,
|
|
875
1059
|
wallet: original.wallet,
|
|
876
1060
|
reason: closeReason,
|
|
877
1061
|
closeReason,
|
|
1062
|
+
// Backend-driven close: the closing order id is not locally verifiable — stamp ids only.
|
|
1063
|
+
...closedEmitStamps(updated),
|
|
878
1064
|
timestamp: ts,
|
|
879
1065
|
});
|
|
880
1066
|
return;
|
|
@@ -888,6 +1074,6 @@ async function handleHandoffOk(ctx, key, next, original, strategy) {
|
|
|
888
1074
|
err: e,
|
|
889
1075
|
});
|
|
890
1076
|
}
|
|
891
|
-
await stateManager.
|
|
1077
|
+
await setIfStillActive(stateManager, key, original.address, original.asset, () => updated, { tickId, skipMessage: "[dsl] skip handoff poll final write: state already cleared (concurrent close)" });
|
|
892
1078
|
}
|
|
893
1079
|
//# sourceMappingURL=process-one-position.js.map
|