@senpi/runtime 3.0.6-dev.skill-manager-v2.20260629194505 → 3.0.9-dev.runtime-phase-2.20260707070820
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 +67 -0
- package/dist/actions/action-events.d.ts.map +1 -0
- package/dist/actions/action-events.js +164 -0
- package/dist/actions/action-events.js.map +1 -0
- package/dist/actions/close-position/close-position.action.d.ts +1 -1
- package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
- package/dist/actions/close-position/close-position.action.js +108 -86
- 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 +40 -28
- package/dist/actions/decision-engine.js.map +1 -1
- package/dist/actions/event-derivation.d.ts +61 -0
- package/dist/actions/event-derivation.d.ts.map +1 -0
- package/dist/actions/event-derivation.js +180 -0
- package/dist/actions/event-derivation.js.map +1 -0
- package/dist/actions/llm-decision/anthropic-llm-decision.d.ts +5 -9
- package/dist/actions/llm-decision/anthropic-llm-decision.d.ts.map +1 -1
- package/dist/actions/llm-decision/anthropic-llm-decision.js +6 -87
- package/dist/actions/llm-decision/anthropic-llm-decision.js.map +1 -1
- package/dist/actions/llm-decision/factory.d.ts +0 -6
- package/dist/actions/llm-decision/factory.d.ts.map +1 -1
- package/dist/actions/llm-decision/factory.js +0 -2
- package/dist/actions/llm-decision/factory.js.map +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.d.ts.map +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.js +26 -7
- package/dist/actions/llm-decision/openclaw-llm-decision.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts +1 -1
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +282 -224
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.js +3 -6
- package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
- package/dist/cli/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +61 -0
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/cli/senpi-commands.d.ts +14 -0
- package/dist/cli/senpi-commands.d.ts.map +1 -1
- package/dist/cli/senpi-commands.js +390 -2
- package/dist/cli/senpi-commands.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 -3
- 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 +0 -1
- package/dist/dsl/events/build-closed-event.js.map +1 -1
- package/dist/dsl/events/handlers.d.ts.map +1 -1
- package/dist/dsl/events/handlers.js +2 -4
- 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 +1 -0
- package/dist/dsl/events/initial-state.js.map +1 -1
- package/dist/dsl/monitor/create-monitor.d.ts +3 -0
- package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
- package/dist/dsl/monitor/create-monitor.js +76 -58
- package/dist/dsl/monitor/create-monitor.js.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.d.ts +42 -0
- package/dist/dsl/monitor/dsl-failure-events.d.ts.map +1 -0
- package/dist/dsl/monitor/dsl-failure-events.js +73 -0
- package/dist/dsl/monitor/dsl-failure-events.js.map +1 -0
- package/dist/dsl/monitor/process-one-position.d.ts +2 -1
- package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
- package/dist/dsl/monitor/process-one-position.js +130 -196
- package/dist/dsl/monitor/process-one-position.js.map +1 -1
- package/dist/dsl/plugin/index.d.ts +10 -0
- package/dist/dsl/plugin/index.d.ts.map +1 -1
- package/dist/dsl/plugin/index.js +48 -4
- package/dist/dsl/plugin/index.js.map +1 -1
- package/dist/dsl/plugin/options.d.ts +3 -0
- package/dist/dsl/plugin/options.d.ts.map +1 -1
- package/dist/health/types.d.ts +14 -0
- package/dist/health/types.d.ts.map +1 -1
- package/dist/health/types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +255 -77
- package/dist/index.js.map +1 -1
- package/dist/risk/risk-audit-log.d.ts +7 -0
- package/dist/risk/risk-audit-log.d.ts.map +1 -1
- package/dist/risk/risk-audit-log.js +48 -1
- package/dist/risk/risk-audit-log.js.map +1 -1
- package/dist/runtime/__tests__/helpers/runtime-gateway-harness.d.ts +2 -0
- package/dist/runtime/__tests__/helpers/runtime-gateway-harness.d.ts.map +1 -1
- package/dist/runtime/__tests__/helpers/runtime-gateway-harness.js +24 -3
- package/dist/runtime/__tests__/helpers/runtime-gateway-harness.js.map +1 -1
- package/dist/runtime/auto-update/coordinator.js +2 -2
- package/dist/runtime/auto-update/coordinator.js.map +1 -1
- package/dist/runtime/create-actions.d.ts.map +1 -1
- package/dist/runtime/create-actions.js +40 -15
- package/dist/runtime/create-actions.js.map +1 -1
- package/dist/runtime/create-runtime-context.d.ts +1 -1
- package/dist/runtime/create-runtime-context.d.ts.map +1 -1
- package/dist/runtime/create-scanner-module.d.ts +2 -1
- package/dist/runtime/create-scanner-module.d.ts.map +1 -1
- package/dist/runtime/create-scanner-module.js +2 -1
- package/dist/runtime/create-scanner-module.js.map +1 -1
- package/dist/runtime/domain-events.d.ts +43 -0
- package/dist/runtime/domain-events.d.ts.map +1 -0
- package/dist/runtime/domain-events.js +181 -0
- package/dist/runtime/domain-events.js.map +1 -0
- package/dist/runtime/lifecycle-events.d.ts +86 -0
- package/dist/runtime/lifecycle-events.d.ts.map +1 -0
- package/dist/runtime/lifecycle-events.js +200 -0
- package/dist/runtime/lifecycle-events.js.map +1 -0
- package/dist/runtime/notifications.js +2 -2
- package/dist/runtime/notifications.js.map +1 -1
- package/dist/{tracking → runtime}/position-id-registry.d.ts +14 -1
- package/dist/runtime/position-id-registry.d.ts.map +1 -0
- package/dist/{tracking → runtime}/position-id-registry.js +20 -3
- package/dist/runtime/position-id-registry.js.map +1 -0
- package/dist/runtime/run.d.ts +2 -4
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/runtime-schema.d.ts +276 -588
- package/dist/runtime/runtime-schema.d.ts.map +1 -1
- package/dist/runtime/runtime-schema.js +8 -28
- package/dist/runtime/runtime-schema.js.map +1 -1
- package/dist/runtime/runtime.d.ts +23 -9
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +276 -248
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/strategy-lifecycle.d.ts.map +1 -1
- package/dist/runtime/strategy-lifecycle.js +13 -1
- package/dist/runtime/strategy-lifecycle.js.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.d.ts +3 -0
- package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.js +27 -53
- package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -1
- package/dist/runtime-api/intake/intake-events.d.ts +44 -0
- package/dist/runtime-api/intake/intake-events.d.ts.map +1 -0
- package/dist/runtime-api/intake/intake-events.js +131 -0
- package/dist/runtime-api/intake/intake-events.js.map +1 -0
- package/dist/runtime-api/intake/scanner-launcher.d.ts +2 -0
- package/dist/runtime-api/intake/scanner-launcher.d.ts.map +1 -1
- package/dist/runtime-api/intake/scanner-launcher.js +58 -15
- package/dist/runtime-api/intake/scanner-launcher.js.map +1 -1
- package/dist/runtime-api/intake/scanner-registry.d.ts +3 -0
- package/dist/runtime-api/intake/scanner-registry.d.ts.map +1 -1
- package/dist/runtime-api/intake/scanner-registry.js +3 -0
- package/dist/runtime-api/intake/scanner-registry.js.map +1 -1
- package/dist/runtime-api/intake/supervisor-events.d.ts +61 -0
- package/dist/runtime-api/intake/supervisor-events.d.ts.map +1 -0
- package/dist/runtime-api/intake/supervisor-events.js +173 -0
- package/dist/runtime-api/intake/supervisor-events.js.map +1 -0
- package/dist/runtime-api/routes/signals.d.ts +1 -1
- package/dist/runtime-api/routes/signals.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.js +121 -35
- package/dist/runtime-api/routes/signals.js.map +1 -1
- package/dist/runtime-api/server.d.ts.map +1 -1
- package/dist/runtime-api/server.js +10 -1
- package/dist/runtime-api/server.js.map +1 -1
- package/dist/scanners/engine/data-providers.d.ts +3 -0
- package/dist/scanners/engine/data-providers.d.ts.map +1 -1
- package/dist/scanners/engine/data-providers.js.map +1 -1
- package/dist/scanners/engine/engine.d.ts +18 -0
- package/dist/scanners/engine/engine.d.ts.map +1 -1
- package/dist/scanners/engine/engine.js +96 -2
- package/dist/scanners/engine/engine.js.map +1 -1
- package/dist/scanners/engine/input-resolver.d.ts.map +1 -1
- package/dist/scanners/engine/input-resolver.js +9 -7
- package/dist/scanners/engine/input-resolver.js.map +1 -1
- package/dist/scanners/runtime-module.d.ts +3 -0
- package/dist/scanners/runtime-module.d.ts.map +1 -1
- package/dist/scanners/runtime-module.js +7 -0
- package/dist/scanners/runtime-module.js.map +1 -1
- package/dist/senpi/client.d.ts +10 -0
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +113 -46
- package/dist/senpi/client.js.map +1 -1
- package/dist/skills-manager/bootstrap.d.ts.map +1 -1
- package/dist/skills-manager/bootstrap.js +22 -33
- package/dist/skills-manager/bootstrap.js.map +1 -1
- package/dist/skills-manager/clone-groups.d.ts +20 -0
- package/dist/skills-manager/clone-groups.d.ts.map +1 -0
- package/dist/skills-manager/clone-groups.js +45 -0
- package/dist/skills-manager/clone-groups.js.map +1 -0
- package/dist/skills-manager/coordinator.d.ts.map +1 -1
- package/dist/skills-manager/coordinator.js +111 -75
- package/dist/skills-manager/coordinator.js.map +1 -1
- package/dist/skills-manager/manifest.d.ts +24 -0
- package/dist/skills-manager/manifest.d.ts.map +1 -1
- package/dist/skills-manager/manifest.js +23 -10
- package/dist/skills-manager/manifest.js.map +1 -1
- package/dist/skills-manager/skills-manifest.json +12 -7
- package/dist/skills-manager/types.d.ts +12 -0
- package/dist/skills-manager/types.d.ts.map +1 -1
- package/dist/state/state-events.d.ts +13 -0
- package/dist/state/state-events.d.ts.map +1 -0
- package/dist/state/state-events.js +22 -0
- package/dist/state/state-events.js.map +1 -0
- package/dist/state/state-manager.d.ts.map +1 -1
- package/dist/state/state-manager.js +14 -1
- package/dist/state/state-manager.js.map +1 -1
- package/dist/telemetry/attributes.d.ts +13 -0
- package/dist/telemetry/attributes.d.ts.map +1 -0
- package/dist/telemetry/attributes.js +22 -0
- package/dist/telemetry/attributes.js.map +1 -0
- package/dist/{tracking → telemetry}/context.d.ts +12 -5
- package/dist/telemetry/context.d.ts.map +1 -0
- package/dist/{tracking → telemetry}/context.js +4 -4
- package/dist/telemetry/context.js.map +1 -0
- package/dist/{recording/records.d.ts → telemetry/event-builders.d.ts} +145 -33
- package/dist/telemetry/event-builders.d.ts.map +1 -0
- package/dist/{recording/wiring/record-builders.js → telemetry/event-builders.js} +94 -40
- package/dist/telemetry/event-builders.js.map +1 -0
- package/dist/telemetry/event-store.d.ts +66 -0
- package/dist/telemetry/event-store.d.ts.map +1 -0
- package/dist/telemetry/event-store.js +202 -0
- package/dist/telemetry/event-store.js.map +1 -0
- package/dist/telemetry/identity.d.ts +72 -0
- package/dist/telemetry/identity.d.ts.map +1 -0
- package/dist/{recording/wiring → telemetry}/identity.js +6 -2
- package/dist/telemetry/identity.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +169 -0
- package/dist/telemetry/metrics.d.ts.map +1 -0
- package/dist/telemetry/metrics.js +437 -0
- package/dist/telemetry/metrics.js.map +1 -0
- package/dist/telemetry/otel-sdk.d.ts +93 -0
- package/dist/telemetry/otel-sdk.d.ts.map +1 -0
- package/dist/telemetry/otel-sdk.js +297 -0
- package/dist/telemetry/otel-sdk.js.map +1 -0
- package/dist/telemetry/spans/constants.d.ts +12 -0
- package/dist/telemetry/spans/constants.d.ts.map +1 -0
- package/dist/telemetry/spans/constants.js +12 -0
- package/dist/telemetry/spans/constants.js.map +1 -0
- package/dist/telemetry/spans/gen-ai.d.ts +74 -0
- package/dist/telemetry/spans/gen-ai.d.ts.map +1 -0
- package/dist/telemetry/spans/gen-ai.js +339 -0
- package/dist/telemetry/spans/gen-ai.js.map +1 -0
- package/dist/telemetry/spans/index.d.ts +11 -0
- package/dist/telemetry/spans/index.d.ts.map +1 -0
- package/dist/telemetry/spans/index.js +11 -0
- package/dist/telemetry/spans/index.js.map +1 -0
- package/dist/{tracking → telemetry}/spans/redact-pii.d.ts +19 -21
- package/dist/telemetry/spans/redact-pii.d.ts.map +1 -0
- package/dist/{tracking → telemetry}/spans/redact-pii.js +35 -32
- package/dist/telemetry/spans/redact-pii.js.map +1 -0
- package/dist/telemetry/spans/sanitize-payload.d.ts.map +1 -0
- package/dist/telemetry/spans/sanitize-payload.js.map +1 -0
- package/dist/telemetry/spans/span-hooks.d.ts +18 -0
- package/dist/telemetry/spans/span-hooks.d.ts.map +1 -0
- package/dist/telemetry/spans/span-hooks.js +764 -0
- package/dist/telemetry/spans/span-hooks.js.map +1 -0
- package/dist/telemetry/tool-plane.d.ts +31 -0
- package/dist/telemetry/tool-plane.d.ts.map +1 -0
- package/dist/telemetry/tool-plane.js +70 -0
- package/dist/telemetry/tool-plane.js.map +1 -0
- package/dist/telemetry/trace-identity.d.ts +32 -0
- package/dist/telemetry/trace-identity.d.ts.map +1 -0
- package/dist/telemetry/trace-identity.js +62 -0
- package/dist/telemetry/trace-identity.js.map +1 -0
- package/dist/telemetry/tracing.d.ts +33 -0
- package/dist/telemetry/tracing.d.ts.map +1 -0
- package/dist/telemetry/tracing.js +70 -0
- package/dist/telemetry/tracing.js.map +1 -0
- package/dist/types/dsl/index.d.ts +8 -9
- package/dist/types/dsl/index.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +1 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/scanner.d.ts +2 -0
- package/dist/types/scanner.d.ts.map +1 -1
- package/dist/utils/event-catalog.d.ts +506 -0
- package/dist/utils/event-catalog.d.ts.map +1 -0
- package/dist/utils/event-catalog.js +142 -0
- package/dist/utils/event-catalog.js.map +1 -0
- package/dist/utils/logger.d.ts +63 -5
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +360 -27
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/wallet-address.d.ts +3 -0
- package/dist/utils/wallet-address.d.ts.map +1 -0
- package/dist/utils/wallet-address.js +17 -0
- package/dist/utils/wallet-address.js.map +1 -0
- package/openclaw.plugin.json +20 -6
- package/package.json +10 -2
- package/dist/actions/tracking-helpers.d.ts +0 -28
- package/dist/actions/tracking-helpers.d.ts.map +0 -1
- package/dist/actions/tracking-helpers.js +0 -93
- package/dist/actions/tracking-helpers.js.map +0 -1
- package/dist/recording/emitter.d.ts +0 -27
- package/dist/recording/emitter.d.ts.map +0 -1
- package/dist/recording/emitter.js +0 -2
- package/dist/recording/emitter.js.map +0 -1
- package/dist/recording/identity.d.ts +0 -34
- package/dist/recording/identity.d.ts.map +0 -1
- package/dist/recording/identity.js +0 -2
- package/dist/recording/identity.js.map +0 -1
- package/dist/recording/index.d.ts +0 -11
- package/dist/recording/index.d.ts.map +0 -1
- package/dist/recording/index.js +0 -2
- package/dist/recording/index.js.map +0 -1
- package/dist/recording/noop-emitter.d.ts +0 -23
- package/dist/recording/noop-emitter.d.ts.map +0 -1
- package/dist/recording/noop-emitter.js +0 -22
- package/dist/recording/noop-emitter.js.map +0 -1
- package/dist/recording/otel/attributes.d.ts +0 -35
- package/dist/recording/otel/attributes.d.ts.map +0 -1
- package/dist/recording/otel/attributes.js +0 -131
- package/dist/recording/otel/attributes.js.map +0 -1
- package/dist/recording/otel/constants.d.ts +0 -123
- package/dist/recording/otel/constants.d.ts.map +0 -1
- package/dist/recording/otel/constants.js +0 -172
- package/dist/recording/otel/constants.js.map +0 -1
- package/dist/recording/otel/ids.d.ts +0 -25
- package/dist/recording/otel/ids.d.ts.map +0 -1
- package/dist/recording/otel/ids.js +0 -37
- package/dist/recording/otel/ids.js.map +0 -1
- package/dist/recording/otel/index.d.ts +0 -13
- package/dist/recording/otel/index.d.ts.map +0 -1
- package/dist/recording/otel/index.js +0 -9
- package/dist/recording/otel/index.js.map +0 -1
- package/dist/recording/otel/mappers.d.ts +0 -100
- package/dist/recording/otel/mappers.d.ts.map +0 -1
- package/dist/recording/otel/mappers.js +0 -683
- package/dist/recording/otel/mappers.js.map +0 -1
- package/dist/recording/otel/otel-emitter.d.ts +0 -43
- package/dist/recording/otel/otel-emitter.d.ts.map +0 -1
- package/dist/recording/otel/otel-emitter.js +0 -99
- package/dist/recording/otel/otel-emitter.js.map +0 -1
- package/dist/recording/otel/redaction.d.ts +0 -47
- package/dist/recording/otel/redaction.d.ts.map +0 -1
- package/dist/recording/otel/redaction.js +0 -88
- package/dist/recording/otel/redaction.js.map +0 -1
- package/dist/recording/records.d.ts.map +0 -1
- package/dist/recording/records.js +0 -14
- package/dist/recording/records.js.map +0 -1
- package/dist/recording/transport/batcher.d.ts +0 -59
- package/dist/recording/transport/batcher.d.ts.map +0 -1
- package/dist/recording/transport/batcher.js +0 -234
- package/dist/recording/transport/batcher.js.map +0 -1
- package/dist/recording/transport/client.d.ts +0 -41
- package/dist/recording/transport/client.d.ts.map +0 -1
- package/dist/recording/transport/client.js +0 -69
- package/dist/recording/transport/client.js.map +0 -1
- package/dist/recording/transport/config.d.ts +0 -53
- package/dist/recording/transport/config.d.ts.map +0 -1
- package/dist/recording/transport/config.js +0 -41
- package/dist/recording/transport/config.js.map +0 -1
- package/dist/recording/transport/index.d.ts +0 -16
- package/dist/recording/transport/index.d.ts.map +0 -1
- package/dist/recording/transport/index.js +0 -12
- package/dist/recording/transport/index.js.map +0 -1
- package/dist/recording/transport/rows.d.ts +0 -88
- package/dist/recording/transport/rows.d.ts.map +0 -1
- package/dist/recording/transport/rows.js +0 -15
- package/dist/recording/transport/rows.js.map +0 -1
- package/dist/recording/wiring/emitter-factory.d.ts +0 -39
- package/dist/recording/wiring/emitter-factory.d.ts.map +0 -1
- package/dist/recording/wiring/emitter-factory.js +0 -62
- package/dist/recording/wiring/emitter-factory.js.map +0 -1
- package/dist/recording/wiring/identity.d.ts +0 -27
- package/dist/recording/wiring/identity.d.ts.map +0 -1
- package/dist/recording/wiring/identity.js.map +0 -1
- package/dist/recording/wiring/index.d.ts +0 -12
- package/dist/recording/wiring/index.d.ts.map +0 -1
- package/dist/recording/wiring/index.js +0 -9
- package/dist/recording/wiring/index.js.map +0 -1
- package/dist/recording/wiring/record-builders.d.ts +0 -107
- package/dist/recording/wiring/record-builders.d.ts.map +0 -1
- package/dist/recording/wiring/record-builders.js.map +0 -1
- package/dist/recording/wiring/subscriber.d.ts +0 -28
- package/dist/recording/wiring/subscriber.d.ts.map +0 -1
- package/dist/recording/wiring/subscriber.js +0 -173
- package/dist/recording/wiring/subscriber.js.map +0 -1
- package/dist/recording/wiring/values.d.ts +0 -19
- package/dist/recording/wiring/values.d.ts.map +0 -1
- package/dist/recording/wiring/values.js +0 -49
- package/dist/recording/wiring/values.js.map +0 -1
- package/dist/tracking/build-rehydrate-items.d.ts +0 -15
- package/dist/tracking/build-rehydrate-items.d.ts.map +0 -1
- package/dist/tracking/build-rehydrate-items.js +0 -19
- package/dist/tracking/build-rehydrate-items.js.map +0 -1
- package/dist/tracking/constants.d.ts +0 -24
- package/dist/tracking/constants.d.ts.map +0 -1
- package/dist/tracking/constants.js +0 -52
- package/dist/tracking/constants.js.map +0 -1
- package/dist/tracking/context.d.ts.map +0 -1
- package/dist/tracking/context.js.map +0 -1
- package/dist/tracking/index.d.ts +0 -16
- package/dist/tracking/index.d.ts.map +0 -1
- package/dist/tracking/index.js +0 -11
- package/dist/tracking/index.js.map +0 -1
- package/dist/tracking/plugin-event-tracker.d.ts +0 -13
- package/dist/tracking/plugin-event-tracker.d.ts.map +0 -1
- package/dist/tracking/plugin-event-tracker.js +0 -27
- package/dist/tracking/plugin-event-tracker.js.map +0 -1
- package/dist/tracking/position-id-registry.d.ts.map +0 -1
- package/dist/tracking/position-id-registry.js.map +0 -1
- package/dist/tracking/spans/constants.d.ts +0 -19
- package/dist/tracking/spans/constants.d.ts.map +0 -1
- package/dist/tracking/spans/constants.js +0 -31
- package/dist/tracking/spans/constants.js.map +0 -1
- package/dist/tracking/spans/fan-out-span-transport.d.ts +0 -22
- package/dist/tracking/spans/fan-out-span-transport.d.ts.map +0 -1
- package/dist/tracking/spans/fan-out-span-transport.js +0 -49
- package/dist/tracking/spans/fan-out-span-transport.js.map +0 -1
- package/dist/tracking/spans/index.d.ts +0 -13
- package/dist/tracking/spans/index.d.ts.map +0 -1
- package/dist/tracking/spans/index.js +0 -16
- package/dist/tracking/spans/index.js.map +0 -1
- package/dist/tracking/spans/otel/fit-row-budget.d.ts +0 -22
- package/dist/tracking/spans/otel/fit-row-budget.d.ts.map +0 -1
- package/dist/tracking/spans/otel/fit-row-budget.js +0 -91
- package/dist/tracking/spans/otel/fit-row-budget.js.map +0 -1
- package/dist/tracking/spans/otel/map-span-to-trace-row.d.ts +0 -16
- package/dist/tracking/spans/otel/map-span-to-trace-row.d.ts.map +0 -1
- package/dist/tracking/spans/otel/map-span-to-trace-row.js +0 -227
- package/dist/tracking/spans/otel/map-span-to-trace-row.js.map +0 -1
- package/dist/tracking/spans/otel/recording-span-transport.d.ts +0 -43
- package/dist/tracking/spans/otel/recording-span-transport.d.ts.map +0 -1
- package/dist/tracking/spans/otel/recording-span-transport.js +0 -67
- package/dist/tracking/spans/otel/recording-span-transport.js.map +0 -1
- package/dist/tracking/spans/otel/span-ids.d.ts +0 -22
- package/dist/tracking/spans/otel/span-ids.d.ts.map +0 -1
- package/dist/tracking/spans/otel/span-ids.js +0 -32
- package/dist/tracking/spans/otel/span-ids.js.map +0 -1
- package/dist/tracking/spans/plugin-span-tracker.d.ts +0 -9
- package/dist/tracking/spans/plugin-span-tracker.d.ts.map +0 -1
- package/dist/tracking/spans/plugin-span-tracker.js +0 -115
- package/dist/tracking/spans/plugin-span-tracker.js.map +0 -1
- package/dist/tracking/spans/redact-pii.d.ts.map +0 -1
- package/dist/tracking/spans/redact-pii.js.map +0 -1
- package/dist/tracking/spans/sanitize-payload.d.ts.map +0 -1
- package/dist/tracking/spans/sanitize-payload.js.map +0 -1
- package/dist/tracking/spans/span-hooks.d.ts +0 -28
- package/dist/tracking/spans/span-hooks.d.ts.map +0 -1
- package/dist/tracking/spans/span-hooks.js +0 -409
- package/dist/tracking/spans/span-hooks.js.map +0 -1
- package/dist/tracking/spans/span-tracker.d.ts +0 -133
- package/dist/tracking/spans/span-tracker.d.ts.map +0 -1
- package/dist/tracking/spans/span-tracker.js +0 -721
- package/dist/tracking/spans/span-tracker.js.map +0 -1
- package/dist/tracking/spans/span-transport.d.ts +0 -71
- package/dist/tracking/spans/span-transport.d.ts.map +0 -1
- package/dist/tracking/spans/span-transport.js +0 -240
- package/dist/tracking/spans/span-transport.js.map +0 -1
- package/dist/tracking/spans/types.d.ts +0 -101
- package/dist/tracking/spans/types.d.ts.map +0 -1
- package/dist/tracking/spans/types.js +0 -6
- package/dist/tracking/spans/types.js.map +0 -1
- package/dist/tracking/tracker.d.ts +0 -30
- package/dist/tracking/tracker.d.ts.map +0 -1
- package/dist/tracking/tracker.js +0 -66
- package/dist/tracking/tracker.js.map +0 -1
- package/dist/tracking/tracking-handler.d.ts +0 -12
- package/dist/tracking/tracking-handler.d.ts.map +0 -1
- package/dist/tracking/tracking-handler.js +0 -148
- package/dist/tracking/tracking-handler.js.map +0 -1
- package/dist/tracking/transport.d.ts +0 -35
- package/dist/tracking/transport.d.ts.map +0 -1
- package/dist/tracking/transport.js +0 -133
- package/dist/tracking/transport.js.map +0 -1
- package/dist/tracking/types.d.ts +0 -21
- package/dist/tracking/types.d.ts.map +0 -1
- package/dist/tracking/types.js +0 -6
- package/dist/tracking/types.js.map +0 -1
- /package/dist/{tracking → telemetry}/spans/sanitize-payload.d.ts +0 -0
- /package/dist/{tracking → telemetry}/spans/sanitize-payload.js +0 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closed event catalog for `logger.event`: the pinned `{domain}.{event}` names, each event's
|
|
3
|
+
* canonical severity, the per-event attribute shapes, and the cross-event join keys shared with the
|
|
4
|
+
* rest of telemetry.
|
|
5
|
+
*
|
|
6
|
+
* This is the contract, not the emit order — the names are stable up front; the call sites that emit
|
|
7
|
+
* them are wired incrementally. Changing a name or a canonical severity breaks saved queries
|
|
8
|
+
* downstream, so the set is closed: `EventName` is a literal union over {@link EVENT_NAME}, and only
|
|
9
|
+
* these names may be passed to `logger.event`.
|
|
10
|
+
*/
|
|
11
|
+
import type { LogLevel } from "./logger.js";
|
|
12
|
+
/**
|
|
13
|
+
* The pinned event names. `{domain}.{event}`, lowercase snake within a segment. The frozen
|
|
14
|
+
* self-learning set, so logs share one query vocabulary downstream.
|
|
15
|
+
*/
|
|
16
|
+
export declare const EVENT_NAME: {
|
|
17
|
+
readonly scannerSummary: "scanner.summary";
|
|
18
|
+
readonly scannerSpawned: "scanner.spawned";
|
|
19
|
+
readonly scannerExited: "scanner.exited";
|
|
20
|
+
readonly scannerRestarted: "scanner.restarted";
|
|
21
|
+
readonly scannerDegraded: "scanner.degraded";
|
|
22
|
+
readonly scannerRecovered: "scanner.recovered";
|
|
23
|
+
readonly scannerSilenceKilled: "scanner.silence_killed";
|
|
24
|
+
readonly scannerOrphanSwept: "scanner.orphan_swept";
|
|
25
|
+
readonly scannerLaunchFailed: "scanner.launch_failed";
|
|
26
|
+
readonly signalAccepted: "signal.accepted";
|
|
27
|
+
readonly signalRejected: "signal.rejected";
|
|
28
|
+
readonly signalExpired: "signal.expired";
|
|
29
|
+
readonly signalSuperseded: "signal.superseded";
|
|
30
|
+
readonly scaffoldTickError: "scaffold.tick_error";
|
|
31
|
+
readonly scaffoldTickTimeout: "scaffold.tick_timeout";
|
|
32
|
+
readonly signalOutcome: "signal.outcome";
|
|
33
|
+
readonly decisionMade: "decision.made";
|
|
34
|
+
readonly orderPlaced: "order.placed";
|
|
35
|
+
readonly orderFilled: "order.filled";
|
|
36
|
+
readonly orderFailed: "order.failed";
|
|
37
|
+
readonly positionOpened: "position.opened";
|
|
38
|
+
readonly positionClosed: "position.closed";
|
|
39
|
+
readonly positionIncreased: "position.increased";
|
|
40
|
+
readonly positionDecreased: "position.decreased";
|
|
41
|
+
readonly positionFlipped: "position.flipped";
|
|
42
|
+
readonly positionReconciled: "position.reconciled";
|
|
43
|
+
readonly dslCreated: "dsl.created";
|
|
44
|
+
readonly dslTierAdvanced: "dsl.tier_advanced";
|
|
45
|
+
readonly dslPhaseChanged: "dsl.phase_changed";
|
|
46
|
+
readonly dslSlUpdated: "dsl.sl_updated";
|
|
47
|
+
readonly dslClosePending: "dsl.close_pending";
|
|
48
|
+
readonly dslClosed: "dsl.closed";
|
|
49
|
+
readonly dslDeleted: "dsl.deleted";
|
|
50
|
+
readonly dslCloseAttempt: "dsl.close_attempt";
|
|
51
|
+
readonly dslSlSyncFailed: "dsl.sl_sync_failed";
|
|
52
|
+
readonly dslPriceFetchStale: "dsl.price_fetch_stale";
|
|
53
|
+
readonly dslHandoffFailed: "dsl.handoff_failed";
|
|
54
|
+
readonly runtimeCreated: "runtime.created";
|
|
55
|
+
readonly runtimeDeleted: "runtime.deleted";
|
|
56
|
+
readonly runtimeStarted: "runtime.started";
|
|
57
|
+
readonly runtimeStopped: "runtime.stopped";
|
|
58
|
+
readonly runtimePaused: "runtime.paused";
|
|
59
|
+
readonly runtimeResumed: "runtime.resumed";
|
|
60
|
+
readonly runtimeError: "runtime.error";
|
|
61
|
+
readonly runtimeQueueBackpressure: "runtime.queue_backpressure";
|
|
62
|
+
readonly runtimeScannersUnwired: "runtime.scanners_unwired";
|
|
63
|
+
readonly statePersistFailed: "state.persist_failed";
|
|
64
|
+
readonly mcpCallFailed: "mcp.call_failed";
|
|
65
|
+
readonly toolCalled: "tool.called";
|
|
66
|
+
};
|
|
67
|
+
/** The closed set of names accepted by `logger.event`. */
|
|
68
|
+
export type EventName = (typeof EVENT_NAME)[keyof typeof EVENT_NAME];
|
|
69
|
+
/** The canonical severity for an event name (the level a healthy emit uses). */
|
|
70
|
+
export declare function canonicalSeverity(name: EventName): LogLevel;
|
|
71
|
+
/** A safe-by-construction scalar attribute value. Flattened and capped, never redacted. */
|
|
72
|
+
export type AttrValue = string | number | boolean;
|
|
73
|
+
/** The keys of `T` whose value type does NOT admit `undefined` — i.e. the required attributes. */
|
|
74
|
+
type RequiredAttrKeys<T> = {
|
|
75
|
+
[K in keyof T]-?: undefined extends T[K] ? never : K;
|
|
76
|
+
}[keyof T];
|
|
77
|
+
/**
|
|
78
|
+
* The accepted input shape for {@link eventAttrs}: a required attribute must be present with a defined
|
|
79
|
+
* value (it may not be passed `undefined`), while an optional attribute may be `value | undefined`
|
|
80
|
+
* (and is dropped when `undefined`). This is what keeps the `T` cast in `eventAttrs` honest — a
|
|
81
|
+
* required key can never be runtime-dropped, so the returned bag really is `T`.
|
|
82
|
+
*/
|
|
83
|
+
type EventAttrsInput<T> = {
|
|
84
|
+
[K in RequiredAttrKeys<T>]: T[K];
|
|
85
|
+
} & {
|
|
86
|
+
[K in Exclude<keyof T, RequiredAttrKeys<T>>]?: T[K] | undefined;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Build an event's typed attribute bag, key-checked against the target shape `T` (an
|
|
90
|
+
* {@link EventAttributes} entry / {@link AttrsFor}). A required attribute must be supplied a defined
|
|
91
|
+
* value; an optional one may be `value | undefined` and is dropped when `undefined` (`undefined` is
|
|
92
|
+
* not a valid OTel attribute value). `null`/empty-string are kept as-is — only `undefined` is dropped.
|
|
93
|
+
* A misnamed key, a missing/`undefined` required key, or a wrong-typed value is a compile error at the
|
|
94
|
+
* builder, so a site cannot hand `logger.event` an attribute bag that doesn't match its event. Returns
|
|
95
|
+
* exactly `T`.
|
|
96
|
+
*/
|
|
97
|
+
export declare function eventAttrs<T extends EventAttributes[keyof EventAttributes]>(obj: EventAttrsInput<T>): T;
|
|
98
|
+
/** Group a number with thousands separators for an event narrative body (e.g. 2400 → "2,400"). */
|
|
99
|
+
export declare function fmtThousands(n: number): string;
|
|
100
|
+
/**
|
|
101
|
+
* Per-event attribute shapes, keyed by event name. Entries are filled as the emissions are wired,
|
|
102
|
+
* one event at a time; until an event is typed here it falls to the loose default in
|
|
103
|
+
* {@link AttrsFor}, so not-yet-typed events still compile. Every key is a safe scalar (`senpi.*`
|
|
104
|
+
* convention, sharing the trace/identity namespace); `id` joins reuse {@link JOIN_ATTR}. Free-text
|
|
105
|
+
* (LLM reasoning, venue errors) never appears here — it rides the `redact` slot.
|
|
106
|
+
*/
|
|
107
|
+
export interface EventAttributes {
|
|
108
|
+
"order.placed": OrderEventAttrs;
|
|
109
|
+
"order.filled": OrderEventAttrs;
|
|
110
|
+
"order.failed": OrderEventAttrs;
|
|
111
|
+
"decision.made": DecisionMadeAttrs;
|
|
112
|
+
"signal.outcome": SignalOutcomeAttrs;
|
|
113
|
+
"scanner.summary": ScannerSummaryAttrs;
|
|
114
|
+
"scanner.spawned": ScannerLifecycleAttrs;
|
|
115
|
+
"scanner.exited": ScannerLifecycleAttrs;
|
|
116
|
+
"scanner.restarted": ScannerLifecycleAttrs;
|
|
117
|
+
"scanner.degraded": ScannerLifecycleAttrs;
|
|
118
|
+
"scanner.recovered": ScannerLifecycleAttrs;
|
|
119
|
+
"scanner.silence_killed": ScannerLifecycleAttrs;
|
|
120
|
+
"scanner.orphan_swept": ScannerLifecycleAttrs;
|
|
121
|
+
"scanner.launch_failed": ScannerLaunchFailedAttrs;
|
|
122
|
+
"signal.accepted": IntakeDispositionAttrs;
|
|
123
|
+
"signal.rejected": IntakeDispositionAttrs;
|
|
124
|
+
"signal.expired": IntakeDispositionAttrs;
|
|
125
|
+
"signal.superseded": IntakeDispositionAttrs;
|
|
126
|
+
"scaffold.tick_error": ScaffoldErrorAttrs;
|
|
127
|
+
"scaffold.tick_timeout": ScaffoldErrorAttrs;
|
|
128
|
+
"runtime.created": RuntimeCreatedAttrs;
|
|
129
|
+
"runtime.deleted": RuntimeDeletedAttrs;
|
|
130
|
+
"runtime.started": RuntimeStartedAttrs;
|
|
131
|
+
"runtime.stopped": RuntimeStoppedAttrs;
|
|
132
|
+
"runtime.paused": RuntimePausedAttrs;
|
|
133
|
+
"runtime.resumed": RuntimeResumedAttrs;
|
|
134
|
+
"runtime.error": RuntimeErrorAttrs;
|
|
135
|
+
"runtime.queue_backpressure": RuntimeQueueBackpressureAttrs;
|
|
136
|
+
"runtime.scanners_unwired": RuntimeScannersUnwiredAttrs;
|
|
137
|
+
"state.persist_failed": StatePersistFailedAttrs;
|
|
138
|
+
"position.opened": PositionLifecycleAttrs;
|
|
139
|
+
"position.closed": PositionLifecycleAttrs;
|
|
140
|
+
"position.increased": PositionLifecycleAttrs;
|
|
141
|
+
"position.decreased": PositionLifecycleAttrs;
|
|
142
|
+
"position.flipped": PositionLifecycleAttrs;
|
|
143
|
+
"position.reconciled": PositionLifecycleAttrs;
|
|
144
|
+
"dsl.created": DslTransitionAttrs;
|
|
145
|
+
"dsl.tier_advanced": DslTransitionAttrs;
|
|
146
|
+
"dsl.phase_changed": DslTransitionAttrs;
|
|
147
|
+
"dsl.sl_updated": DslTransitionAttrs;
|
|
148
|
+
"dsl.close_pending": DslTransitionAttrs;
|
|
149
|
+
"dsl.closed": DslTransitionAttrs;
|
|
150
|
+
"dsl.deleted": DslTransitionAttrs;
|
|
151
|
+
"dsl.sl_sync_failed": DslFailureAttrs;
|
|
152
|
+
"dsl.price_fetch_stale": DslFailureAttrs;
|
|
153
|
+
"dsl.handoff_failed": DslFailureAttrs;
|
|
154
|
+
"mcp.call_failed": McpCallFailedAttrs;
|
|
155
|
+
"tool.called": ToolCalledAttrs;
|
|
156
|
+
}
|
|
157
|
+
/** Shared shape for the three order events; per-event fields are optional (placed has no fill, etc.). */
|
|
158
|
+
export interface OrderEventAttrs {
|
|
159
|
+
"senpi.order.id"?: string;
|
|
160
|
+
"senpi.position.id"?: string;
|
|
161
|
+
"senpi.asset": string;
|
|
162
|
+
"senpi.order.direction"?: string;
|
|
163
|
+
"senpi.order.type"?: string;
|
|
164
|
+
"senpi.order.size"?: number;
|
|
165
|
+
"senpi.order.reduce_only"?: boolean;
|
|
166
|
+
"senpi.order.fill_price"?: number;
|
|
167
|
+
"senpi.order.fill_size"?: number;
|
|
168
|
+
"senpi.order.execution_as_maker"?: boolean;
|
|
169
|
+
/** Granular reason code on a failed order (e.g. `position_open_failed`, `exception`). */
|
|
170
|
+
"senpi.order.reason"?: string;
|
|
171
|
+
/** `Error.name` on a failed order; the venue error text rides the `redact` slot. */
|
|
172
|
+
"senpi.order.error_name"?: string;
|
|
173
|
+
}
|
|
174
|
+
export interface DecisionMadeAttrs {
|
|
175
|
+
/** How the decision was produced: `llm` | `rule` | `none` | … */
|
|
176
|
+
"senpi.decision.mode"?: string;
|
|
177
|
+
"senpi.decision.by_llm": boolean;
|
|
178
|
+
"senpi.decision.intent": string;
|
|
179
|
+
"senpi.decision.confidence": number;
|
|
180
|
+
"senpi.decision.confidence_threshold"?: number;
|
|
181
|
+
"senpi.decision.model"?: string;
|
|
182
|
+
"senpi.decision.tokens_used"?: number;
|
|
183
|
+
"senpi.decision.duration_ms"?: number;
|
|
184
|
+
}
|
|
185
|
+
export interface SignalOutcomeAttrs {
|
|
186
|
+
"senpi.position.id"?: string;
|
|
187
|
+
"senpi.order.id"?: string;
|
|
188
|
+
"senpi.scanner.id"?: string;
|
|
189
|
+
"senpi.signal.type"?: string;
|
|
190
|
+
"senpi.signal.asset": string;
|
|
191
|
+
"senpi.signal.direction"?: string;
|
|
192
|
+
"senpi.signal.score": number;
|
|
193
|
+
/** Disposition: `accepted` | `rejected` | `blocked` | `error`. */
|
|
194
|
+
"senpi.outcome.result": string;
|
|
195
|
+
/** Granular per-signal reason code (e.g. `submitted`, `no_slots`, `risk_gate_*`). */
|
|
196
|
+
"senpi.outcome.reason_code"?: string;
|
|
197
|
+
"senpi.outcome.margin_amount"?: number;
|
|
198
|
+
/** Which precedence rule sized the margin: `signal_marginPct` | `config_margin_pct` | `margin_per_slot` | `budget_over_slots`. */
|
|
199
|
+
"senpi.outcome.margin_source"?: string;
|
|
200
|
+
/** The applied percent (of withdrawable) for the two percent-based sources; absent on the fixed/budget branches. */
|
|
201
|
+
"senpi.outcome.margin_pct"?: number;
|
|
202
|
+
"senpi.outcome.leverage"?: number;
|
|
203
|
+
"senpi.outcome.notional_value"?: number;
|
|
204
|
+
"senpi.outcome.size"?: number;
|
|
205
|
+
}
|
|
206
|
+
export interface ScannerSummaryAttrs {
|
|
207
|
+
"senpi.scanner.id": string;
|
|
208
|
+
"senpi.scanner.scanned_count": number;
|
|
209
|
+
"senpi.scanner.passed_count": number;
|
|
210
|
+
"senpi.scanner.dropped_count": number;
|
|
211
|
+
/**
|
|
212
|
+
* Per-reason drop counts, keyed `senpi.scanner.dropped.{reason}` (+ a `…dropped.other` overflow
|
|
213
|
+
* bucket). The reason segment is a producer-controlled string, so these keys are dynamic and
|
|
214
|
+
* bounded by the caller's cap — typed narrowly as numeric counts under that key prefix.
|
|
215
|
+
*/
|
|
216
|
+
[dropReason: `senpi.scanner.dropped.${string}`]: number;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Shared shape for the seven `scanner.*` supervisor-lifecycle events. `senpi.scanner.id`/name and
|
|
220
|
+
* `senpi.supervisor.id` (the join key to the supervisor's own free-text logs) are always present;
|
|
221
|
+
* the rest are per-transition (pid/attempt on `spawned`, exit detail on `exited`, backoff on
|
|
222
|
+
* `restarted`, `rapid_failures` on `degraded`, `silence_ms` on `silence_killed`). `senpi.supervisor.run_id`
|
|
223
|
+
* is the per-spawn run id — distinct from the per-scan `senpi.run.id`. These fire outside any signal
|
|
224
|
+
* flow, so the wallet is stamped here explicitly rather than riding the async-context identity bag.
|
|
225
|
+
*/
|
|
226
|
+
export interface ScannerLifecycleAttrs {
|
|
227
|
+
"senpi.scanner.id": string;
|
|
228
|
+
"senpi.scanner.name": string;
|
|
229
|
+
"senpi.supervisor.id": string;
|
|
230
|
+
/** Strategy wallet; absent when the runtime has no wallet. */
|
|
231
|
+
"senpi.strategy.address"?: string;
|
|
232
|
+
"senpi.supervisor.run_id"?: string;
|
|
233
|
+
"senpi.scanner.pid"?: number;
|
|
234
|
+
"senpi.scanner.exit_code"?: number;
|
|
235
|
+
"senpi.scanner.signal"?: string;
|
|
236
|
+
"senpi.scanner.duration_ms"?: number;
|
|
237
|
+
"senpi.scanner.backoff_ms"?: number;
|
|
238
|
+
"senpi.scanner.attempt"?: number;
|
|
239
|
+
"senpi.scanner.rapid_failures"?: number;
|
|
240
|
+
"senpi.scanner.silence_ms"?: number;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* A supervised scanner that failed to wire up — initial launch (`launch_phase=wire`, before any
|
|
244
|
+
* supervisor exists) or the relaunch id re-mint (`launch_phase=remint`, where the supervisor and the
|
|
245
|
+
* old id are known). Either way the scanner produces no signals. The exception rides the event's
|
|
246
|
+
* `error` slot; the wallet is stamped explicitly (this fires outside any signal flow).
|
|
247
|
+
*/
|
|
248
|
+
export interface ScannerLaunchFailedAttrs {
|
|
249
|
+
"senpi.scanner.name": string;
|
|
250
|
+
/** `wire` (initial launch) | `remint` (relaunch id rotation). */
|
|
251
|
+
"senpi.scanner.launch_phase": string;
|
|
252
|
+
"senpi.strategy.address"?: string;
|
|
253
|
+
/** The old scanner id — present on a `remint` failure. */
|
|
254
|
+
"senpi.scanner.id"?: string;
|
|
255
|
+
/** The owning supervisor's id — present on a `remint` failure. */
|
|
256
|
+
"senpi.supervisor.id"?: string;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Shared shape for the four signal-intake disposition events — the pre-decision acceptance fact at
|
|
260
|
+
* the process boundary (distinct from the post-decision `signal.outcome`). `senpi.scanner.id` (the
|
|
261
|
+
* POSTed id, present even when it resolves to no entry) is always set; name/wallet are absent on an
|
|
262
|
+
* unknown-scanner reject. The minted `senpi.signal.correlation_id` rides `accepted`; a low-cardinality
|
|
263
|
+
* `senpi.intake.reason_code` rides a coded request-level reject. These fire at the HTTP boundary,
|
|
264
|
+
* outside any signal flow, so the wallet is stamped here rather than via async-context identity. The
|
|
265
|
+
* free-text reject reason rides the event's `redact` slot.
|
|
266
|
+
*/
|
|
267
|
+
export interface IntakeDispositionAttrs {
|
|
268
|
+
"senpi.scanner.id": string;
|
|
269
|
+
"senpi.scanner.name"?: string;
|
|
270
|
+
"senpi.strategy.address"?: string;
|
|
271
|
+
/** Per-signal asset; absent on a whole-request reject. */
|
|
272
|
+
"senpi.signal.asset"?: string;
|
|
273
|
+
/** The minted correlation id — present on `signal.accepted`. */
|
|
274
|
+
"senpi.signal.correlation_id"?: string;
|
|
275
|
+
/** Coded request-level reject reason (`unknown_scanner` | `max_items_exceeded`). */
|
|
276
|
+
"senpi.intake.reason_code"?: string;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Shared shape for the two scaffold tick-failure events from the `/errors` boundary — a scanner tick
|
|
280
|
+
* that threw or exceeded its budget (so it produced no signal). `senpi.scaffold.error_type` carries
|
|
281
|
+
* the scaffold's failure class (a Python exception name, or `state_persist_failed`) on `tick_error`;
|
|
282
|
+
* it is omitted on `tick_timeout`, where the name says it. The raw message rides `redact`.
|
|
283
|
+
*/
|
|
284
|
+
export interface ScaffoldErrorAttrs {
|
|
285
|
+
"senpi.scanner.id": string;
|
|
286
|
+
"senpi.scanner.name"?: string;
|
|
287
|
+
"senpi.strategy.address"?: string;
|
|
288
|
+
"senpi.scaffold.error_type"?: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* A runtime added to the registry via `senpi.installRuntime`. The registry-level create fact —
|
|
292
|
+
* distinct from `runtime.started`, which is the process boot transition and also fires on a transient
|
|
293
|
+
* restart. Fires at the gateway, outside any signal flow, so the wallet and runtime id are stamped
|
|
294
|
+
* explicitly.
|
|
295
|
+
*/
|
|
296
|
+
export interface RuntimeCreatedAttrs {
|
|
297
|
+
"senpi.runtime.id": string;
|
|
298
|
+
"senpi.strategy.address"?: string;
|
|
299
|
+
"senpi.recipe.name"?: string;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* A runtime removed from the registry via `senpi.deleteRuntime`. The discriminator a transient
|
|
303
|
+
* `runtime.stopped` can't provide — a delete is permanent, a stop may be a restart. Fires
|
|
304
|
+
* unconditionally on the delete path (after the registry removal), so a runtime that registered but
|
|
305
|
+
* never booted — which skips `handle.stop()` and so emits no `runtime.stopped` — is still observable.
|
|
306
|
+
* `senpi.runtime.had_live_handle` records whether a running handle was stopped as part of the delete.
|
|
307
|
+
*/
|
|
308
|
+
export interface RuntimeDeletedAttrs {
|
|
309
|
+
"senpi.runtime.id": string;
|
|
310
|
+
"senpi.strategy.address"?: string;
|
|
311
|
+
"senpi.runtime.had_live_handle": boolean;
|
|
312
|
+
}
|
|
313
|
+
export interface RuntimeStartedAttrs {
|
|
314
|
+
/** Strategy wallet. Stamped explicitly: these events fire outside the per-signal identity context, so the async-context fallback resolves no address. */
|
|
315
|
+
"senpi.strategy.address"?: string;
|
|
316
|
+
"senpi.recipe.name"?: string;
|
|
317
|
+
"senpi.recipe.version"?: string;
|
|
318
|
+
"senpi.config.hash"?: string;
|
|
319
|
+
"senpi.runtime.version"?: string;
|
|
320
|
+
"senpi.runtime.scanner_count": number;
|
|
321
|
+
"senpi.runtime.action_count": number;
|
|
322
|
+
"senpi.runtime.has_dsl": boolean;
|
|
323
|
+
"senpi.strategy.slots"?: number;
|
|
324
|
+
"senpi.strategy.trading_risk"?: string;
|
|
325
|
+
"senpi.strategy.margin_per_slot"?: number;
|
|
326
|
+
"senpi.strategy.margin_pct"?: number;
|
|
327
|
+
"senpi.strategy.default_leverage"?: number;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* A runtime came up with its external supervised-scanner stack unwired — it runs on internal scanners
|
|
331
|
+
* only, the highest-impact supervised-scanner failure mode. `senpi.scanners.launch_phase` names which
|
|
332
|
+
* gateway seam failed (`mount` / `launch` at boot, `install_wire` / `install_launch` on a live install);
|
|
333
|
+
* the boot exception rides the event's `error` slot. Fires outside any signal flow, so the runtime id
|
|
334
|
+
* and wallet are stamped explicitly.
|
|
335
|
+
*/
|
|
336
|
+
export interface RuntimeScannersUnwiredAttrs {
|
|
337
|
+
"senpi.runtime.id": string;
|
|
338
|
+
"senpi.strategy.address"?: string;
|
|
339
|
+
"senpi.scanners.launch_phase": string;
|
|
340
|
+
}
|
|
341
|
+
export interface RuntimeStoppedAttrs {
|
|
342
|
+
"senpi.strategy.address"?: string;
|
|
343
|
+
"senpi.runtime.version"?: string;
|
|
344
|
+
"senpi.runtime.uptime_ms"?: number;
|
|
345
|
+
}
|
|
346
|
+
export interface RuntimePausedAttrs {
|
|
347
|
+
"senpi.strategy.address"?: string;
|
|
348
|
+
"senpi.gate.id"?: string;
|
|
349
|
+
"senpi.gate.name"?: string;
|
|
350
|
+
}
|
|
351
|
+
export interface RuntimeResumedAttrs {
|
|
352
|
+
"senpi.strategy.address"?: string;
|
|
353
|
+
"senpi.gate.id"?: string;
|
|
354
|
+
"senpi.gate.name"?: string;
|
|
355
|
+
}
|
|
356
|
+
export interface RuntimeErrorAttrs {
|
|
357
|
+
"senpi.runtime.phase": string;
|
|
358
|
+
"senpi.scanner.id"?: string;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* The serial signal queue reached its backpressure threshold — the consumer is falling behind inflow.
|
|
362
|
+
* `senpi.queue.depth` (the depth at the trip) shares the namespace the `signal.process` span stamps;
|
|
363
|
+
* `senpi.queue.threshold` makes the event self-describing across threshold changes. The wallet is
|
|
364
|
+
* stamped explicitly — this fires at enqueue, outside the per-signal async-context identity bag.
|
|
365
|
+
*/
|
|
366
|
+
export interface RuntimeQueueBackpressureAttrs {
|
|
367
|
+
"senpi.queue.depth": number;
|
|
368
|
+
"senpi.queue.threshold": number;
|
|
369
|
+
/** The scanner whose enqueue tripped the threshold. */
|
|
370
|
+
"senpi.scanner.id"?: string;
|
|
371
|
+
"senpi.strategy.address"?: string;
|
|
372
|
+
}
|
|
373
|
+
/** A `StateManager` write that failed to persist — the state key that was lost. */
|
|
374
|
+
export interface StatePersistFailedAttrs {
|
|
375
|
+
/** The state key (e.g. `0xWallet/dsl-BTC`) whose write was lost. */
|
|
376
|
+
"senpi.state.key": string;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Shared shape for the six `position.*` lifecycle events; `event` discriminates which fields are
|
|
380
|
+
* populated (entry/size on `opened`, close detail on `closed`, the delta on `increased`/`decreased`,
|
|
381
|
+
* `new_asset` on `flipped`, `reconciliation_source` on `opened`/`reconciled`). Every value is a safe
|
|
382
|
+
* scalar — these events carry no free-text, so no `redact` slot. `senpi.asset` is always present.
|
|
383
|
+
*/
|
|
384
|
+
export interface PositionLifecycleAttrs {
|
|
385
|
+
"senpi.position.id"?: string;
|
|
386
|
+
"senpi.asset": string;
|
|
387
|
+
"senpi.dex"?: string;
|
|
388
|
+
"senpi.position.direction"?: string;
|
|
389
|
+
"senpi.position.entry_price"?: number;
|
|
390
|
+
"senpi.position.size"?: number;
|
|
391
|
+
"senpi.position.leverage"?: number;
|
|
392
|
+
"senpi.position.margin"?: number;
|
|
393
|
+
"senpi.position.unrealized_pnl"?: number;
|
|
394
|
+
"senpi.position.roe"?: number;
|
|
395
|
+
/** closed */
|
|
396
|
+
"senpi.position.close_reason"?: string;
|
|
397
|
+
"senpi.position.closed_price"?: number;
|
|
398
|
+
"senpi.position.closed_size"?: number;
|
|
399
|
+
/** increased / decreased */
|
|
400
|
+
"senpi.position.size_delta"?: number;
|
|
401
|
+
"senpi.position.previous_size"?: number;
|
|
402
|
+
/** flipped — `senpi.asset` holds the pre-flip asset, this the post-flip coin */
|
|
403
|
+
"senpi.position.new_asset"?: string;
|
|
404
|
+
/** `runtime_opened` | `externally_detected`, on `opened`/`reconciled` only. */
|
|
405
|
+
"senpi.position.reconciliation_source"?: string;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Shared shape for the seven wired `dsl.*` transitions; `transition` discriminates which fields are
|
|
409
|
+
* populated (the exit ladder + entry on `created`, floor/SL on `sl_updated`, phase/tier on
|
|
410
|
+
* `phase_changed`/`tier_advanced`, the close reason on `closed`, the retry attempt on `close_pending`).
|
|
411
|
+
* All safe scalars — no `redact`. `dsl.close_attempt` is intentionally absent: it is a per-tick
|
|
412
|
+
* telemetry unit kept on the 9b trace, not a queryable event-log fact.
|
|
413
|
+
*/
|
|
414
|
+
export interface DslTransitionAttrs {
|
|
415
|
+
"senpi.position.id"?: string;
|
|
416
|
+
"senpi.asset": string;
|
|
417
|
+
"senpi.dex"?: string;
|
|
418
|
+
"senpi.position.direction"?: string;
|
|
419
|
+
"senpi.dsl.preset"?: string;
|
|
420
|
+
"senpi.dsl.phase"?: number;
|
|
421
|
+
"senpi.dsl.tier_index"?: number;
|
|
422
|
+
"senpi.dsl.floor_price"?: number;
|
|
423
|
+
"senpi.dsl.new_floor_price"?: number;
|
|
424
|
+
"senpi.dsl.new_sl_price"?: number;
|
|
425
|
+
"senpi.dsl.sl_order_id"?: number;
|
|
426
|
+
"senpi.dsl.current_roe"?: number;
|
|
427
|
+
"senpi.dsl.peak_roe"?: number;
|
|
428
|
+
"senpi.dsl.locked_profit_pct"?: number;
|
|
429
|
+
"senpi.dsl.close_reason"?: string;
|
|
430
|
+
"senpi.dsl.attempt"?: number;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Shared shape for the three `dsl.*` exit-engine failure-state events — degradation the DSL monitor
|
|
434
|
+
* tracks but that surfaced only as a tick-span error or a `warn` log: an exchange SL push that threw
|
|
435
|
+
* (`sl_sync_failed`, with its running `sl_sync_failure_count` and the exception on the event's `error`
|
|
436
|
+
* slot), a position with no price for `fetch_failure_count` consecutive ticks (`price_fetch_stale`),
|
|
437
|
+
* and a Phase-2 backend handoff that degraded (`handoff_failed`, `handoff_failure` naming the step:
|
|
438
|
+
* `register` left it stuck pending, `rollback` reverted to local management, `poll` failed to reach
|
|
439
|
+
* the backend that owns the stop). `senpi.asset` is always present; identity (`senpi.strategy.*`)
|
|
440
|
+
* rides the per-tick async-context bag, like the sibling `dsl.*` transition events. Opaque free-text
|
|
441
|
+
* — a declined-registration backend payload — rides the `redact` slot.
|
|
442
|
+
*/
|
|
443
|
+
export interface DslFailureAttrs {
|
|
444
|
+
"senpi.position.id"?: string;
|
|
445
|
+
"senpi.asset": string;
|
|
446
|
+
"senpi.dex"?: string;
|
|
447
|
+
/** sl_sync_failed: running count of consecutive exchange SL-sync failures. */
|
|
448
|
+
"senpi.dsl.sl_sync_failure_count"?: number;
|
|
449
|
+
/** price_fetch_stale: consecutive price-fetch failures at the stale threshold. */
|
|
450
|
+
"senpi.dsl.fetch_failure_count"?: number;
|
|
451
|
+
/** handoff_failed: which step degraded — `register` | `rollback` | `poll`. */
|
|
452
|
+
"senpi.dsl.handoff_failure"?: string;
|
|
453
|
+
/** handoff_failed: the backend's id for this position, when one was assigned. */
|
|
454
|
+
"senpi.dsl.backend_position_id"?: string;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* An outbound Senpi MCP `tools/call` that threw — the narrative half of the MCP-failure plane, so an
|
|
458
|
+
* outage is greppable/alertable without spelunking the HTTP-client spans. Keys mirror the `tools/call`
|
|
459
|
+
* span (`gen_ai.tool.name` / `error.type` / `rpc.response.status_code` / `server.address`) so the event
|
|
460
|
+
* joins straight to the span carrying the stack; identity (`senpi.strategy.*`) rides the async-context
|
|
461
|
+
* bag. The raw error text (where the HTTP status / DNS detail lives) rides the `redact` slot.
|
|
462
|
+
*/
|
|
463
|
+
export interface McpCallFailedAttrs {
|
|
464
|
+
"gen_ai.tool.name": string;
|
|
465
|
+
/** Low-cardinality error class (`errorTypeOf`: `Error.name` | the string | `_OTHER`). */
|
|
466
|
+
"error.type": string;
|
|
467
|
+
/** JSON-RPC error code when the SDK supplied one; absent on a transport-level failure. */
|
|
468
|
+
"rpc.response.status_code"?: string;
|
|
469
|
+
/** The MCP server host — distinguishes a prod vs dev endpoint outage. */
|
|
470
|
+
"server.address"?: string;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* An abnormal agent tool call — the agent-blind hole, made greppable. Only abnormal outcomes are
|
|
474
|
+
* evented: `error` (a tool call that threw) and `unknown` (the drift alarm — the model requested a
|
|
475
|
+
* tool it was never offered; `gen_ai.tool.name` carries the invented name, capped). Successful calls
|
|
476
|
+
* stay on the span/metric planes — a state-changing one already emits a richer domain event
|
|
477
|
+
* (`position.opened`, `order.placed`, …), and an abnormal MCP RPC fault is the sibling
|
|
478
|
+
* `mcp.call_failed` (richer, with the JSON-RPC code). `gen_ai.tool.name` joins to the call's span;
|
|
479
|
+
* identity rides the async-context bag; the error text rides the `redact` slot. The schema keys stay
|
|
480
|
+
* origin-uniform for the metric-plane follow-on (which dimensions by `mcp`/`decision` too).
|
|
481
|
+
*/
|
|
482
|
+
export interface ToolCalledAttrs {
|
|
483
|
+
"gen_ai.tool.name": string;
|
|
484
|
+
/** Dispatch site: `agent` (gateway tool hook). `mcp` is reserved for the metric plane. */
|
|
485
|
+
"senpi.tool.origin": string;
|
|
486
|
+
/** `error` (call threw) | `unknown` (tool requested but never offered). `ok`/`denied` reserved (not evented). */
|
|
487
|
+
"senpi.tool.outcome": string;
|
|
488
|
+
/** Low-cardinality error class on an abnormal outcome (`errorTypeOf`). */
|
|
489
|
+
"error.type"?: string;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* The attribute shape for a given event: its typed entry when one exists, else a loose scalar bag so
|
|
493
|
+
* not-yet-typed events still compile.
|
|
494
|
+
*/
|
|
495
|
+
export type AttrsFor<N extends EventName> = N extends keyof EventAttributes ? EventAttributes[N] : Record<string, AttrValue>;
|
|
496
|
+
/**
|
|
497
|
+
* The cross-event join/identity keys — the `senpi.*` attributes that thread an event back to its
|
|
498
|
+
* position or order. Same namespace + casing the trace/identity stamps use, so events join cleanly to
|
|
499
|
+
* spans. Per-event keys live in {@link EventAttributes}, not here.
|
|
500
|
+
*/
|
|
501
|
+
export declare const JOIN_ATTR: {
|
|
502
|
+
readonly positionId: "senpi.position.id";
|
|
503
|
+
readonly orderId: "senpi.order.id";
|
|
504
|
+
};
|
|
505
|
+
export {};
|
|
506
|
+
//# sourceMappingURL=event-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-catalog.d.ts","sourceRoot":"","sources":["../../src/utils/event-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDb,CAAC;AAEX,0DAA0D;AAC1D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AA2CrE,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAE3D;AAED,2FAA2F;AAC3F,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD,kGAAkG;AAClG,KAAK,gBAAgB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;CAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,KAAK,eAAe,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG;KAC9D,CAAC,I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AAE,MAAM,CAAC;IAC3C,kFAAkF;IAClF,+BAA+B,CAAC,EAAE,MAAM,CAAC;IACzC,8EAA8E;IAC9E,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,iFAAiF;IACjF,+BAA+B,CAAC,EAAE,MAAM,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,yFAAyF;IACzF,YAAY,EAAE,MAAM,CAAC;IACrB,0FAA0F;IAC1F,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,yEAAyE;IACzE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0FAA0F;IAC1F,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iHAAiH;IACjH,oBAAoB,EAAE,MAAM,CAAC;IAC7B,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,SAAS,MAAM,eAAe,GACvE,eAAe,CAAC,CAAC,CAAC,GAClB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;CAGZ,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The closed event catalog for `logger.event`: the pinned `{domain}.{event}` names, each event's
|
|
3
|
+
* canonical severity, the per-event attribute shapes, and the cross-event join keys shared with the
|
|
4
|
+
* rest of telemetry.
|
|
5
|
+
*
|
|
6
|
+
* This is the contract, not the emit order — the names are stable up front; the call sites that emit
|
|
7
|
+
* them are wired incrementally. Changing a name or a canonical severity breaks saved queries
|
|
8
|
+
* downstream, so the set is closed: `EventName` is a literal union over {@link EVENT_NAME}, and only
|
|
9
|
+
* these names may be passed to `logger.event`.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The pinned event names. `{domain}.{event}`, lowercase snake within a segment. The frozen
|
|
13
|
+
* self-learning set, so logs share one query vocabulary downstream.
|
|
14
|
+
*/
|
|
15
|
+
export const EVENT_NAME = {
|
|
16
|
+
scannerSummary: "scanner.summary",
|
|
17
|
+
scannerSpawned: "scanner.spawned",
|
|
18
|
+
scannerExited: "scanner.exited",
|
|
19
|
+
scannerRestarted: "scanner.restarted",
|
|
20
|
+
scannerDegraded: "scanner.degraded",
|
|
21
|
+
scannerRecovered: "scanner.recovered",
|
|
22
|
+
scannerSilenceKilled: "scanner.silence_killed",
|
|
23
|
+
scannerOrphanSwept: "scanner.orphan_swept",
|
|
24
|
+
scannerLaunchFailed: "scanner.launch_failed",
|
|
25
|
+
signalAccepted: "signal.accepted",
|
|
26
|
+
signalRejected: "signal.rejected",
|
|
27
|
+
signalExpired: "signal.expired",
|
|
28
|
+
signalSuperseded: "signal.superseded",
|
|
29
|
+
scaffoldTickError: "scaffold.tick_error",
|
|
30
|
+
scaffoldTickTimeout: "scaffold.tick_timeout",
|
|
31
|
+
signalOutcome: "signal.outcome",
|
|
32
|
+
decisionMade: "decision.made",
|
|
33
|
+
orderPlaced: "order.placed",
|
|
34
|
+
orderFilled: "order.filled",
|
|
35
|
+
orderFailed: "order.failed",
|
|
36
|
+
positionOpened: "position.opened",
|
|
37
|
+
positionClosed: "position.closed",
|
|
38
|
+
positionIncreased: "position.increased",
|
|
39
|
+
positionDecreased: "position.decreased",
|
|
40
|
+
positionFlipped: "position.flipped",
|
|
41
|
+
positionReconciled: "position.reconciled",
|
|
42
|
+
dslCreated: "dsl.created",
|
|
43
|
+
dslTierAdvanced: "dsl.tier_advanced",
|
|
44
|
+
dslPhaseChanged: "dsl.phase_changed",
|
|
45
|
+
dslSlUpdated: "dsl.sl_updated",
|
|
46
|
+
dslClosePending: "dsl.close_pending",
|
|
47
|
+
dslClosed: "dsl.closed",
|
|
48
|
+
dslDeleted: "dsl.deleted",
|
|
49
|
+
dslCloseAttempt: "dsl.close_attempt",
|
|
50
|
+
dslSlSyncFailed: "dsl.sl_sync_failed",
|
|
51
|
+
dslPriceFetchStale: "dsl.price_fetch_stale",
|
|
52
|
+
dslHandoffFailed: "dsl.handoff_failed",
|
|
53
|
+
runtimeCreated: "runtime.created",
|
|
54
|
+
runtimeDeleted: "runtime.deleted",
|
|
55
|
+
runtimeStarted: "runtime.started",
|
|
56
|
+
runtimeStopped: "runtime.stopped",
|
|
57
|
+
runtimePaused: "runtime.paused",
|
|
58
|
+
runtimeResumed: "runtime.resumed",
|
|
59
|
+
runtimeError: "runtime.error",
|
|
60
|
+
runtimeQueueBackpressure: "runtime.queue_backpressure",
|
|
61
|
+
runtimeScannersUnwired: "runtime.scanners_unwired",
|
|
62
|
+
statePersistFailed: "state.persist_failed",
|
|
63
|
+
mcpCallFailed: "mcp.call_failed",
|
|
64
|
+
toolCalled: "tool.called",
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Each event's canonical severity — and its FLOOR. Failure-shaped events (`order.failed`,
|
|
68
|
+
* `runtime.error`) are `error`; `runtime.paused` is `warn`; the rest are `info`. A caller may
|
|
69
|
+
* ESCALATE a catalogued event above its canonical level (e.g. `signal.outcome` goes `error` on a
|
|
70
|
+
* failed outcome) but never below it: `logger.event` takes the max of the passed level and this, so a
|
|
71
|
+
* catalogued event can't be labelled under its canonical severity. Names absent here default to
|
|
72
|
+
* `info`.
|
|
73
|
+
*/
|
|
74
|
+
const CANONICAL_SEVERITY = {
|
|
75
|
+
[EVENT_NAME.orderFailed]: "error",
|
|
76
|
+
[EVENT_NAME.runtimeError]: "error",
|
|
77
|
+
[EVENT_NAME.runtimePaused]: "warn",
|
|
78
|
+
// The serial consumer falling behind inflow — signals piling up faster than they process. Handled
|
|
79
|
+
// (the FIFO still drains), so warn, not error.
|
|
80
|
+
[EVENT_NAME.runtimeQueueBackpressure]: "warn",
|
|
81
|
+
// A crash-loop guard trip and a silence-kill are the operator's alert conditions.
|
|
82
|
+
[EVENT_NAME.scannerDegraded]: "warn",
|
|
83
|
+
[EVENT_NAME.scannerSilenceKilled]: "warn",
|
|
84
|
+
// A scanner that never wires up (or fails to re-mint on relaunch) produces no signals.
|
|
85
|
+
[EVENT_NAME.scannerLaunchFailed]: "warn",
|
|
86
|
+
// A tick that errors or times out is a scanner producing nothing — an alert condition, like a
|
|
87
|
+
// crash-loop; the routine intake dispositions (accepted/rejected/expired/superseded) stay info.
|
|
88
|
+
[EVENT_NAME.scaffoldTickError]: "warn",
|
|
89
|
+
[EVENT_NAME.scaffoldTickTimeout]: "warn",
|
|
90
|
+
// Exit management silently degrading is an alert condition — a stop the venue never received, a
|
|
91
|
+
// position flying blind on price, a backend handoff that never completed. All handled (retried or
|
|
92
|
+
// recovered) so they are warn, not error.
|
|
93
|
+
[EVENT_NAME.dslSlSyncFailed]: "warn",
|
|
94
|
+
[EVENT_NAME.dslPriceFetchStale]: "warn",
|
|
95
|
+
[EVENT_NAME.dslHandoffFailed]: "warn",
|
|
96
|
+
// A runtime that came up with its external scanner stack unwired is running blind — a real
|
|
97
|
+
// degradation an operator must see. The error slot carries the boot exception.
|
|
98
|
+
[EVENT_NAME.runtimeScannersUnwired]: "error",
|
|
99
|
+
// A persisted write the runtime lost — risks silent position-state loss, so error (not the handled
|
|
100
|
+
// warn of the DSL degradations). The error slot carries the exception without fanning the notifier.
|
|
101
|
+
[EVENT_NAME.statePersistFailed]: "error",
|
|
102
|
+
// A single MCP RPC fault is usually transient/handled (caller retries or returns null); the outage
|
|
103
|
+
// is the burst/aggregate. Warn, like the DSL degradations — the stack rides the tools/call span.
|
|
104
|
+
[EVENT_NAME.mcpCallFailed]: "warn",
|
|
105
|
+
};
|
|
106
|
+
/** The canonical severity for an event name (the level a healthy emit uses). */
|
|
107
|
+
export function canonicalSeverity(name) {
|
|
108
|
+
return CANONICAL_SEVERITY[name] ?? "info";
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Build an event's typed attribute bag, key-checked against the target shape `T` (an
|
|
112
|
+
* {@link EventAttributes} entry / {@link AttrsFor}). A required attribute must be supplied a defined
|
|
113
|
+
* value; an optional one may be `value | undefined` and is dropped when `undefined` (`undefined` is
|
|
114
|
+
* not a valid OTel attribute value). `null`/empty-string are kept as-is — only `undefined` is dropped.
|
|
115
|
+
* A misnamed key, a missing/`undefined` required key, or a wrong-typed value is a compile error at the
|
|
116
|
+
* builder, so a site cannot hand `logger.event` an attribute bag that doesn't match its event. Returns
|
|
117
|
+
* exactly `T`.
|
|
118
|
+
*/
|
|
119
|
+
export function eventAttrs(obj) {
|
|
120
|
+
const out = {};
|
|
121
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
122
|
+
if (v !== undefined)
|
|
123
|
+
out[k] = v;
|
|
124
|
+
}
|
|
125
|
+
// Required keys are statically guaranteed defined and present (see EventAttrsInput); dropping the
|
|
126
|
+
// `undefined`-valued optionals leaves exactly `T`, which the loose `Record` can't prove on its own.
|
|
127
|
+
return out;
|
|
128
|
+
}
|
|
129
|
+
/** Group a number with thousands separators for an event narrative body (e.g. 2400 → "2,400"). */
|
|
130
|
+
export function fmtThousands(n) {
|
|
131
|
+
return n.toLocaleString("en-US");
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The cross-event join/identity keys — the `senpi.*` attributes that thread an event back to its
|
|
135
|
+
* position or order. Same namespace + casing the trace/identity stamps use, so events join cleanly to
|
|
136
|
+
* spans. Per-event keys live in {@link EventAttributes}, not here.
|
|
137
|
+
*/
|
|
138
|
+
export const JOIN_ATTR = {
|
|
139
|
+
positionId: "senpi.position.id",
|
|
140
|
+
orderId: "senpi.order.id",
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=event-catalog.js.map
|