@senpi-ai/runtime 3.0.133 → 3.0.136
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 +8 -0
- package/dist/actions/action-events.d.ts +21 -7
- package/dist/actions/action-events.d.ts.map +1 -1
- package/dist/actions/action-events.js +54 -26
- package/dist/actions/action-events.js.map +1 -1
- package/dist/actions/action-runtime-module.d.ts.map +1 -1
- package/dist/actions/action-runtime-module.js +38 -7
- package/dist/actions/action-runtime-module.js.map +1 -1
- package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
- package/dist/actions/close-position/close-position.action.js +122 -15
- package/dist/actions/close-position/close-position.action.js.map +1 -1
- package/dist/actions/decision-engine.d.ts.map +1 -1
- package/dist/actions/decision-engine.js +15 -2
- package/dist/actions/decision-engine.js.map +1 -1
- package/dist/actions/event-derivation.d.ts +71 -2
- package/dist/actions/event-derivation.d.ts.map +1 -1
- package/dist/actions/event-derivation.js +251 -8
- package/dist/actions/event-derivation.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts +12 -2
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +141 -41
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts +2 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.js +62 -17
- package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
- package/dist/actions/skipped-signal-results.d.ts +25 -0
- package/dist/actions/skipped-signal-results.d.ts.map +1 -0
- package/dist/actions/skipped-signal-results.js +71 -0
- package/dist/actions/skipped-signal-results.js.map +1 -0
- package/dist/actions/store/types.d.ts +9 -2
- package/dist/actions/store/types.d.ts.map +1 -1
- package/dist/actions/store/types.js.map +1 -1
- package/dist/actions/types.d.ts +13 -0
- package/dist/actions/types.d.ts.map +1 -1
- package/dist/actions/types.js +13 -0
- package/dist/actions/types.js.map +1 -1
- package/dist/cli/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +16 -0
- 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 +88 -0
- package/dist/cli/senpi-commands.js.map +1 -1
- package/dist/constants/dsl/index.d.ts +6 -0
- package/dist/constants/dsl/index.d.ts.map +1 -1
- package/dist/constants/dsl/index.js +6 -0
- package/dist/constants/dsl/index.js.map +1 -1
- package/dist/dsl/engine-client/event-mapping.d.ts.map +1 -1
- package/dist/dsl/engine-client/event-mapping.js +14 -0
- package/dist/dsl/engine-client/event-mapping.js.map +1 -1
- package/dist/dsl/events/build-closed-event.d.ts +16 -1
- package/dist/dsl/events/build-closed-event.d.ts.map +1 -1
- package/dist/dsl/events/build-closed-event.js +6 -0
- package/dist/dsl/events/build-closed-event.js.map +1 -1
- package/dist/dsl/events/handlers.d.ts +7 -0
- package/dist/dsl/events/handlers.d.ts.map +1 -1
- package/dist/dsl/events/handlers.js +37 -7
- package/dist/dsl/events/handlers.js.map +1 -1
- package/dist/dsl/monitor/create-monitor.d.ts +6 -2
- package/dist/dsl/monitor/create-monitor.d.ts.map +1 -1
- package/dist/dsl/monitor/create-monitor.js +82 -9
- package/dist/dsl/monitor/create-monitor.js.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.d.ts +45 -2
- package/dist/dsl/monitor/dsl-failure-events.d.ts.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.js +52 -3
- package/dist/dsl/monitor/dsl-failure-events.js.map +1 -1
- package/dist/dsl/monitor/process-one-position.d.ts +1 -0
- package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
- package/dist/dsl/monitor/process-one-position.js +159 -36
- package/dist/dsl/monitor/process-one-position.js.map +1 -1
- package/dist/dsl/plugin/index.d.ts +8 -2
- package/dist/dsl/plugin/index.d.ts.map +1 -1
- package/dist/dsl/plugin/index.js +8 -6
- package/dist/dsl/plugin/index.js.map +1 -1
- package/dist/health/types.d.ts +13 -0
- package/dist/health/types.d.ts.map +1 -1
- package/dist/health/types.js +12 -0
- package/dist/health/types.js.map +1 -1
- package/dist/index.d.ts +27 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +310 -41
- package/dist/index.js.map +1 -1
- package/dist/runtime/action-registry.d.ts.map +1 -1
- package/dist/runtime/action-registry.js +4 -3
- package/dist/runtime/action-registry.js.map +1 -1
- package/dist/runtime/auto-update/coordinator.d.ts +24 -1
- package/dist/runtime/auto-update/coordinator.d.ts.map +1 -1
- package/dist/runtime/auto-update/coordinator.js +123 -13
- package/dist/runtime/auto-update/coordinator.js.map +1 -1
- package/dist/runtime/auto-update/resolve-package-name.d.ts +15 -0
- package/dist/runtime/auto-update/resolve-package-name.d.ts.map +1 -1
- package/dist/runtime/auto-update/resolve-package-name.js +35 -0
- package/dist/runtime/auto-update/resolve-package-name.js.map +1 -1
- package/dist/runtime/auto-update/run-update-command.d.ts.map +1 -1
- package/dist/runtime/auto-update/run-update-command.js +17 -14
- package/dist/runtime/auto-update/run-update-command.js.map +1 -1
- package/dist/runtime/auto-update/types.d.ts +24 -0
- package/dist/runtime/auto-update/types.d.ts.map +1 -1
- package/dist/runtime/auto-update/types.js.map +1 -1
- package/dist/runtime/domain-events.d.ts.map +1 -1
- package/dist/runtime/domain-events.js +7 -0
- package/dist/runtime/domain-events.js.map +1 -1
- package/dist/runtime/lifecycle-events.d.ts +15 -3
- package/dist/runtime/lifecycle-events.d.ts.map +1 -1
- package/dist/runtime/lifecycle-events.js +17 -3
- package/dist/runtime/lifecycle-events.js.map +1 -1
- package/dist/runtime/lifecycle-reaper.d.ts +4 -6
- package/dist/runtime/lifecycle-reaper.d.ts.map +1 -1
- package/dist/runtime/lifecycle-reaper.js +4 -6
- package/dist/runtime/lifecycle-reaper.js.map +1 -1
- package/dist/runtime/reconcile-run.d.ts +13 -3
- package/dist/runtime/reconcile-run.d.ts.map +1 -1
- package/dist/runtime/reconcile-run.js +4 -3
- package/dist/runtime/reconcile-run.js.map +1 -1
- package/dist/runtime/reconcile-state.d.ts +8 -0
- package/dist/runtime/reconcile-state.d.ts.map +1 -1
- package/dist/runtime/reconcile-state.js +4 -1
- package/dist/runtime/reconcile-state.js.map +1 -1
- package/dist/runtime/run.d.ts +1 -0
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/runtime-schema.js +3 -3
- package/dist/runtime/runtime-schema.js.map +1 -1
- package/dist/runtime/runtime.d.ts +1 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +28 -4
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.d.ts +13 -0
- package/dist/runtime/supervisor/long-running-supervisor.d.ts.map +1 -1
- package/dist/runtime/supervisor/long-running-supervisor.js +1 -0
- package/dist/runtime/supervisor/long-running-supervisor.js.map +1 -1
- package/dist/runtime/validate-dsl-position-tracking.d.ts.map +1 -1
- package/dist/runtime/validate-dsl-position-tracking.js +2 -1
- package/dist/runtime/validate-dsl-position-tracking.js.map +1 -1
- package/dist/runtime-api/handlers/ingest-signals.d.ts.map +1 -1
- package/dist/runtime-api/handlers/ingest-signals.js +1 -0
- package/dist/runtime-api/handlers/ingest-signals.js.map +1 -1
- package/dist/runtime-api/handlers/types.d.ts +5 -0
- package/dist/runtime-api/handlers/types.d.ts.map +1 -1
- package/dist/runtime-api/intake/ingest-request.d.ts +17 -0
- package/dist/runtime-api/intake/ingest-request.d.ts.map +1 -0
- package/dist/runtime-api/intake/ingest-request.js +34 -0
- package/dist/runtime-api/intake/ingest-request.js.map +1 -0
- package/dist/runtime-api/intake/intake-events.d.ts +1 -1
- package/dist/runtime-api/intake/intake-events.d.ts.map +1 -1
- package/dist/runtime-api/intake/intake-events.js +9 -3
- package/dist/runtime-api/intake/intake-events.js.map +1 -1
- package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
- package/dist/runtime-api/intake/intake-mount.js +4 -19
- package/dist/runtime-api/intake/intake-mount.js.map +1 -1
- package/dist/runtime-api/intake/process-error-post.d.ts +6 -1
- package/dist/runtime-api/intake/process-error-post.d.ts.map +1 -1
- package/dist/runtime-api/intake/process-error-post.js +5 -1
- package/dist/runtime-api/intake/process-error-post.js.map +1 -1
- package/dist/runtime-api/intake/process-signal-post.d.ts +7 -1
- package/dist/runtime-api/intake/process-signal-post.d.ts.map +1 -1
- package/dist/runtime-api/intake/process-signal-post.js +5 -0
- package/dist/runtime-api/intake/process-signal-post.js.map +1 -1
- package/dist/runtime-api/intake/scaffold-error-router.js.map +1 -1
- package/dist/runtime-api/intake/scaffold-tick-router.d.ts +39 -0
- package/dist/runtime-api/intake/scaffold-tick-router.d.ts.map +1 -0
- package/dist/runtime-api/intake/scaffold-tick-router.js +122 -0
- package/dist/runtime-api/intake/scaffold-tick-router.js.map +1 -0
- package/dist/runtime-api/intake/scanner-launcher.d.ts.map +1 -1
- package/dist/runtime-api/intake/scanner-launcher.js +15 -0
- package/dist/runtime-api/intake/scanner-launcher.js.map +1 -1
- package/dist/runtime-api/intake/types.d.ts +55 -0
- package/dist/runtime-api/intake/types.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.d.ts +2 -0
- package/dist/runtime-api/routes/signals.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.js +5 -1
- package/dist/runtime-api/routes/signals.js.map +1 -1
- package/dist/runtime-api/routes/signals.schema.d.ts +43 -0
- package/dist/runtime-api/routes/signals.schema.d.ts.map +1 -1
- package/dist/runtime-api/routes/signals.schema.js +43 -0
- package/dist/runtime-api/routes/signals.schema.js.map +1 -1
- package/dist/runtime-api/server.d.ts +7 -1
- package/dist/runtime-api/server.d.ts.map +1 -1
- package/dist/runtime-api/server.js +1 -0
- package/dist/runtime-api/server.js.map +1 -1
- package/dist/scanners/engine/engine.d.ts +22 -1
- package/dist/scanners/engine/engine.d.ts.map +1 -1
- package/dist/scanners/engine/engine.js +78 -11
- package/dist/scanners/engine/engine.js.map +1 -1
- package/dist/scanners/engine/lifecycle.d.ts +7 -1
- package/dist/scanners/engine/lifecycle.d.ts.map +1 -1
- package/dist/scanners/events.d.ts +4 -0
- package/dist/scanners/events.d.ts.map +1 -1
- package/dist/scanners/events.js +2 -0
- package/dist/scanners/events.js.map +1 -1
- package/dist/scanners/external/scaffold/delivery.py +194 -25
- package/dist/scanners/external/scaffold/scaffold.py +172 -31
- package/dist/scanners/external/scaffold/senpi_mcp.py +150 -8
- package/dist/scanners/external/scaffold/tick_facts.py +130 -0
- package/dist/scanners/external/scaffold/ulid.py +58 -0
- package/dist/scanners/external-scanner-receiver.d.ts +17 -0
- package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
- package/dist/scanners/external-scanner-receiver.js +8 -0
- package/dist/scanners/external-scanner-receiver.js.map +1 -1
- package/dist/scanners/runtime-module.d.ts +1 -0
- package/dist/scanners/runtime-module.d.ts.map +1 -1
- package/dist/scanners/runtime-module.js +66 -9
- package/dist/scanners/runtime-module.js.map +1 -1
- package/dist/telemetry/attributes.d.ts +20 -0
- package/dist/telemetry/attributes.d.ts.map +1 -1
- package/dist/telemetry/attributes.js +24 -0
- package/dist/telemetry/attributes.js.map +1 -1
- package/dist/telemetry/dsl-positions.d.ts +111 -0
- package/dist/telemetry/dsl-positions.d.ts.map +1 -0
- package/dist/telemetry/dsl-positions.js +118 -0
- package/dist/telemetry/dsl-positions.js.map +1 -0
- package/dist/telemetry/event-builders.d.ts +81 -6
- package/dist/telemetry/event-builders.d.ts.map +1 -1
- package/dist/telemetry/event-builders.js +141 -17
- package/dist/telemetry/event-builders.js.map +1 -1
- package/dist/telemetry/event-store.d.ts +6 -0
- package/dist/telemetry/event-store.d.ts.map +1 -1
- package/dist/telemetry/event-store.js +12 -8
- package/dist/telemetry/event-store.js.map +1 -1
- package/dist/telemetry/live-telemetry.d.ts +257 -0
- package/dist/telemetry/live-telemetry.d.ts.map +1 -0
- package/dist/telemetry/live-telemetry.js +959 -0
- package/dist/telemetry/live-telemetry.js.map +1 -0
- package/dist/telemetry/metrics.d.ts +14 -2
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +19 -4
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry/scanner-stats.d.ts +143 -0
- package/dist/telemetry/scanner-stats.d.ts.map +1 -0
- package/dist/telemetry/scanner-stats.js +426 -0
- package/dist/telemetry/scanner-stats.js.map +1 -0
- package/dist/telemetry/scanner-tick-feed.d.ts +87 -0
- package/dist/telemetry/scanner-tick-feed.d.ts.map +1 -0
- package/dist/telemetry/scanner-tick-feed.js +48 -0
- package/dist/telemetry/scanner-tick-feed.js.map +1 -0
- package/dist/telemetry/spans/redact-pii.d.ts.map +1 -1
- package/dist/telemetry/spans/redact-pii.js +18 -2
- package/dist/telemetry/spans/redact-pii.js.map +1 -1
- package/dist/telemetry/strategy-topology.d.ts +99 -0
- package/dist/telemetry/strategy-topology.d.ts.map +1 -0
- package/dist/telemetry/strategy-topology.js +93 -0
- package/dist/telemetry/strategy-topology.js.map +1 -0
- package/dist/telemetry/telemetry-publisher.d.ts +83 -0
- package/dist/telemetry/telemetry-publisher.d.ts.map +1 -0
- package/dist/telemetry/telemetry-publisher.js +256 -0
- package/dist/telemetry/telemetry-publisher.js.map +1 -0
- package/dist/telemetry/tick-frame.d.ts +212 -0
- package/dist/telemetry/tick-frame.d.ts.map +1 -0
- package/dist/telemetry/tick-frame.js +421 -0
- package/dist/telemetry/tick-frame.js.map +1 -0
- package/dist/telemetry/timeline-buffer.d.ts +95 -0
- package/dist/telemetry/timeline-buffer.d.ts.map +1 -0
- package/dist/telemetry/timeline-buffer.js +237 -0
- package/dist/telemetry/timeline-buffer.js.map +1 -0
- package/dist/telemetry/tracing.d.ts +9 -0
- package/dist/telemetry/tracing.d.ts.map +1 -1
- package/dist/telemetry/tracing.js +36 -0
- package/dist/telemetry/tracing.js.map +1 -1
- package/dist/types/dsl/index.d.ts +48 -0
- package/dist/types/dsl/index.d.ts.map +1 -1
- package/dist/types/scanner.d.ts +15 -0
- package/dist/types/scanner.d.ts.map +1 -1
- package/dist/utils/event-catalog.d.ts +202 -0
- package/dist/utils/event-catalog.d.ts.map +1 -1
- package/dist/utils/event-catalog.js +26 -0
- package/dist/utils/event-catalog.js.map +1 -1
- package/dist/utils/logger.d.ts +4 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/telemetry-required-log.d.ts +60 -0
- package/dist/utils/telemetry-required-log.d.ts.map +1 -0
- package/dist/utils/telemetry-required-log.js +105 -0
- package/dist/utils/telemetry-required-log.js.map +1 -0
- package/dist/utils/ulid.d.ts +9 -0
- package/dist/utils/ulid.d.ts.map +1 -0
- package/dist/utils/ulid.js +43 -0
- package/dist/utils/ulid.js.map +1 -0
- package/dist/validate/recipe-checks.d.ts.map +1 -1
- package/dist/validate/recipe-checks.js +2 -2
- package/dist/validate/recipe-checks.js.map +1 -1
- package/openclaw.plugin.json +4 -4
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ACTION_TYPE } from '../types.js';
|
|
1
2
|
import { HOOK_EVENT } from '../../types/hooks.js';
|
|
2
3
|
import { createLogger } from '../../utils/logger.js';
|
|
3
4
|
import { positionRegistryKey } from '../../runtime/position-id-registry.js';
|
|
5
|
+
import { emitActionResultEvents, buildActionEventContext, scanIdPayloadFields } from '../action-events.js';
|
|
4
6
|
const logger = createLogger('[actions][position-tracker]');
|
|
5
7
|
// ─── Pure helpers ────────────────────────────────────────────────────────────
|
|
6
8
|
/** Normalize dex: "main" → undefined (DSL convention). */
|
|
@@ -113,46 +115,79 @@ const deltaMappers = {
|
|
|
113
115
|
};
|
|
114
116
|
// ─── Position Tracker Action ────────────────────────────────────────────────
|
|
115
117
|
export class PositionTrackerAction {
|
|
118
|
+
config;
|
|
116
119
|
context;
|
|
117
120
|
name;
|
|
118
|
-
actionType =
|
|
121
|
+
actionType = ACTION_TYPE.positionTracker;
|
|
119
122
|
constructor(config, context) {
|
|
123
|
+
this.config = config;
|
|
120
124
|
this.context = context;
|
|
121
125
|
this.name = config.name;
|
|
122
126
|
}
|
|
127
|
+
eventCtx() {
|
|
128
|
+
return buildActionEventContext({
|
|
129
|
+
hookSystem: this.context.hookSystem,
|
|
130
|
+
actionName: this.name,
|
|
131
|
+
actionType: this.actionType,
|
|
132
|
+
decisionMode: this.config.decision_mode,
|
|
133
|
+
decisionModel: this.config.decision_model,
|
|
134
|
+
minConfidence: this.config.min_confidence,
|
|
135
|
+
positionIdRegistry: this.context.positionIdRegistry,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
123
138
|
async handle(event) {
|
|
124
139
|
if (event.type !== HOOK_EVENT.ON_SIGNAL_DETECTED) {
|
|
125
140
|
return this.skip('invalid_event_type', 'Ignored: wrong event type');
|
|
126
141
|
}
|
|
127
|
-
const
|
|
142
|
+
const scanResult = event.data?.scanResult;
|
|
143
|
+
const signals = scanResult?.signals ?? [];
|
|
128
144
|
if (signals.length === 0) {
|
|
129
145
|
return this.skip('no_signals', 'No signals to process');
|
|
130
146
|
}
|
|
131
147
|
let firedCount = 0;
|
|
132
148
|
let skippedCount = 0;
|
|
133
149
|
let failedCount = 0;
|
|
134
|
-
|
|
135
|
-
|
|
150
|
+
// One entry per evaluated signal; `signal.outcome` is derived one-per-entry, so every
|
|
151
|
+
// outcome point below records its own row.
|
|
152
|
+
const results = [];
|
|
153
|
+
for (const [signalIndex, signal] of signals.entries()) {
|
|
154
|
+
// Per-signal work window — every result entry below carries startedAt/endedAt.
|
|
155
|
+
const signalStartedAt = Date.now();
|
|
156
|
+
// Telemetry join: every row this signal produces carries its index into the scan's signal
|
|
157
|
+
// array, so the event mapper pairs the row with THIS signal's `meta`. Without it, two signals
|
|
158
|
+
// on the same asset in one pass — one asset on two books is exactly that, since positions are
|
|
159
|
+
// keyed by asset+dex — would both be read as the first one.
|
|
160
|
+
const indexRow = { __signalIndex: signalIndex };
|
|
161
|
+
const asset = signal.asset;
|
|
162
|
+
const signalType = signal.signalType;
|
|
163
|
+
const meta = signal.meta;
|
|
164
|
+
// The scanner carries the book on `meta.dex`; the Signal itself has no dex field. Kept raw
|
|
165
|
+
// (the registry key normalizes it) so the outcome resolves the same position.id the hook did.
|
|
166
|
+
const dexRow = typeof meta?.dex === 'string' && meta.dex.trim() !== '' ? { dex: meta.dex.trim() } : {};
|
|
167
|
+
const scoreRow = typeof signal.score === 'number' && Number.isFinite(signal.score) ? { score: signal.score } : {};
|
|
168
|
+
const mapper = deltaMappers[signalType];
|
|
136
169
|
if (!mapper) {
|
|
137
|
-
logger.info('skipping unsupported delta type', { signalType
|
|
170
|
+
logger.info('skipping unsupported delta type', { signalType, asset });
|
|
171
|
+
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...indexRow, success: true, reason: 'unsupported_delta_type', startedAt: signalStartedAt, endedAt: Date.now() });
|
|
138
172
|
skippedCount++;
|
|
139
173
|
continue;
|
|
140
174
|
}
|
|
141
|
-
const meta = signal.meta;
|
|
142
175
|
if (!meta) {
|
|
143
|
-
logger.warn('signal missing meta', { signalType
|
|
176
|
+
logger.warn('signal missing meta', { signalType, asset });
|
|
177
|
+
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...indexRow, success: true, reason: 'missing_meta', startedAt: signalStartedAt, endedAt: Date.now() });
|
|
144
178
|
skippedCount++;
|
|
145
179
|
continue;
|
|
146
180
|
}
|
|
147
181
|
const mapped = mapper(meta, event.address);
|
|
148
182
|
if (!mapped) {
|
|
149
|
-
logger.warn('signal missing required snapshot', { signalType
|
|
183
|
+
logger.warn('signal missing required snapshot', { signalType, asset });
|
|
184
|
+
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...indexRow, success: true, reason: 'missing_snapshot', startedAt: signalStartedAt, endedAt: Date.now() });
|
|
150
185
|
skippedCount++;
|
|
151
186
|
continue;
|
|
152
187
|
}
|
|
153
188
|
try {
|
|
154
|
-
logger.info(`firing ${mapped.type}`, { asset
|
|
155
|
-
const positionFields = this.resolvePositionId(
|
|
189
|
+
logger.info(`firing ${mapped.type}`, { asset });
|
|
190
|
+
const positionFields = this.resolvePositionId(signalType, mapped, event.address);
|
|
156
191
|
await this.context.hookSystem.fire({
|
|
157
192
|
type: mapped.type,
|
|
158
193
|
runtimeName: event.runtimeName,
|
|
@@ -160,24 +195,38 @@ export class PositionTrackerAction {
|
|
|
160
195
|
data: {
|
|
161
196
|
...mapped.data,
|
|
162
197
|
...positionFields,
|
|
198
|
+
// The ids of the tracker poll that OBSERVED this delta — not of the run that placed
|
|
199
|
+
// the order, which is a different run up to a poll interval earlier.
|
|
200
|
+
...scanIdPayloadFields(event),
|
|
163
201
|
},
|
|
164
202
|
timestamp: new Date().toISOString(),
|
|
165
203
|
});
|
|
204
|
+
// Carry the id the hook fired with. A CLOSED delta clears the registry entry inside
|
|
205
|
+
// `resolvePositionId`, so a post-loop lookup would resolve nothing and the closing
|
|
206
|
+
// outcome — the one that ends the position's story — would lose its join key.
|
|
207
|
+
const rowPositionId = typeof positionFields.__positionId === 'string' ? { __positionId: positionFields.__positionId } : {};
|
|
208
|
+
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...rowPositionId, ...indexRow, success: true, reason: 'fired', startedAt: signalStartedAt, endedAt: Date.now() });
|
|
166
209
|
firedCount++;
|
|
167
210
|
}
|
|
168
211
|
catch (err) {
|
|
212
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
213
|
+
results.push({ asset, signalType, ...dexRow, ...scoreRow, ...indexRow, success: false, reason: 'exception', error: message, startedAt: signalStartedAt, endedAt: Date.now() });
|
|
169
214
|
failedCount++;
|
|
170
|
-
logger.error('failed to fire hook event', err, { signalType
|
|
215
|
+
logger.error('failed to fire hook event', err, { signalType, asset });
|
|
171
216
|
}
|
|
172
217
|
}
|
|
173
218
|
const success = failedCount === 0;
|
|
174
|
-
|
|
219
|
+
const result = {
|
|
175
220
|
success,
|
|
176
221
|
action_type: this.actionType,
|
|
177
222
|
summary: `Tracked: ${firedCount} fired, ${skippedCount} skipped, ${failedCount} failed`,
|
|
178
|
-
data: { firedCount, skippedCount, failedCount },
|
|
223
|
+
data: { firedCount, skippedCount, failedCount, results },
|
|
179
224
|
...(failedCount > 0 ? { error: `${failedCount} hook event(s) failed to fire` } : {}),
|
|
180
225
|
};
|
|
226
|
+
// No decision engine runs here, so the result carries no `_decisionMeta` and no
|
|
227
|
+
// `decision.made` is derived — only the per-signal outcomes.
|
|
228
|
+
emitActionResultEvents(this.eventCtx(), event, event.address, result, { scanResult });
|
|
229
|
+
return result;
|
|
181
230
|
}
|
|
182
231
|
/**
|
|
183
232
|
* Mint/reuse/clear the cross-flow position.id and return the fields to stamp on the
|
|
@@ -223,10 +272,6 @@ export class PositionTrackerAction {
|
|
|
223
272
|
: {}),
|
|
224
273
|
};
|
|
225
274
|
}
|
|
226
|
-
extractSignals(event) {
|
|
227
|
-
const scanResult = event.data?.scanResult;
|
|
228
|
-
return scanResult?.signals ?? [];
|
|
229
|
-
}
|
|
230
275
|
skip(reason, summary) {
|
|
231
276
|
return { success: true, action_type: this.actionType, summary, skipped: true, skipReason: reason };
|
|
232
277
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position-tracker.action.js","sourceRoot":"","sources":["../../../src/actions/position-tracker/position-tracker.action.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"position-tracker.action.js","sourceRoot":"","sources":["../../../src/actions/position-tracker/position-tracker.action.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAc,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,mBAAmB,EAA2B,MAAM,qBAAqB,CAAC;AAEpI,MAA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CAAC,UAAU,CAAC,kBAAkB,CAAC;IAC/C,aAAa,EAAE;QACb,UAAU,CAAC,kBAAkB;QAC7B,UAAU,CAAC,kBAAkB;QAC7B,UAAU,CAAC,mBAAmB;QAC9B,UAAU,CAAC,qBAAqB;QAChC,UAAU,CAAC,qBAAqB;KACjC;CACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-signal `results[]` rows synthesized for a batch-level early exit — the exits that return
|
|
3
|
+
* before the per-signal loop and would otherwise leave the scan's signals with no recorded outcome.
|
|
4
|
+
* Entry shape matches the loop's own rows so the derived per-signal telemetry is identical in
|
|
5
|
+
* structure: normalized `dex`, `direction`/`score` only when usable, and a zero-width work window
|
|
6
|
+
* (both stamps present — a half window is dropped downstream, and a missing one is
|
|
7
|
+
* indistinguishable from an unstamped legacy row).
|
|
8
|
+
*
|
|
9
|
+
* Each row carries `__signalIndex`, its position in the INPUT list, so the event mapper pairs the
|
|
10
|
+
* row with THIS signal's `meta` rather than with the first signal sharing its asset. It is read
|
|
11
|
+
* inside the loop, not zipped on by the caller: a dropped signal shifts every later output
|
|
12
|
+
* position. The input list is the scan's own signal array, which is what the mapper indexes into;
|
|
13
|
+
* close-position's static-params fallback list has no scan array behind it, so its index matches
|
|
14
|
+
* nothing and the mapper degrades to its asset join, as it does for any unmatched index.
|
|
15
|
+
*
|
|
16
|
+
* A signal with no usable asset is dropped: an outcome that names no asset is not attributable.
|
|
17
|
+
* A drop is a hole in the "no signal goes unrecorded" contract, so it is logged (once per call,
|
|
18
|
+
* with the count) rather than passing silently. Counts are unaffected — the row is still absent.
|
|
19
|
+
* Total by construction — it runs on the trading path and must never throw on a malformed entry.
|
|
20
|
+
*/
|
|
21
|
+
export declare function skippedSignalResults(signals: readonly unknown[] | undefined, reason: string, nowMs: number, overrides?: {
|
|
22
|
+
success?: boolean;
|
|
23
|
+
error?: string;
|
|
24
|
+
}): Array<Record<string, unknown>>;
|
|
25
|
+
//# sourceMappingURL=skipped-signal-results.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skipped-signal-results.d.ts","sourceRoot":"","sources":["../../src/actions/skipped-signal-results.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,EACvC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAChD,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA8ChC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createLogger } from '../utils/logger.js';
|
|
2
|
+
const logger = createLogger('[actions][skipped-signal-results]');
|
|
3
|
+
/**
|
|
4
|
+
* Per-signal `results[]` rows synthesized for a batch-level early exit — the exits that return
|
|
5
|
+
* before the per-signal loop and would otherwise leave the scan's signals with no recorded outcome.
|
|
6
|
+
* Entry shape matches the loop's own rows so the derived per-signal telemetry is identical in
|
|
7
|
+
* structure: normalized `dex`, `direction`/`score` only when usable, and a zero-width work window
|
|
8
|
+
* (both stamps present — a half window is dropped downstream, and a missing one is
|
|
9
|
+
* indistinguishable from an unstamped legacy row).
|
|
10
|
+
*
|
|
11
|
+
* Each row carries `__signalIndex`, its position in the INPUT list, so the event mapper pairs the
|
|
12
|
+
* row with THIS signal's `meta` rather than with the first signal sharing its asset. It is read
|
|
13
|
+
* inside the loop, not zipped on by the caller: a dropped signal shifts every later output
|
|
14
|
+
* position. The input list is the scan's own signal array, which is what the mapper indexes into;
|
|
15
|
+
* close-position's static-params fallback list has no scan array behind it, so its index matches
|
|
16
|
+
* nothing and the mapper degrades to its asset join, as it does for any unmatched index.
|
|
17
|
+
*
|
|
18
|
+
* A signal with no usable asset is dropped: an outcome that names no asset is not attributable.
|
|
19
|
+
* A drop is a hole in the "no signal goes unrecorded" contract, so it is logged (once per call,
|
|
20
|
+
* with the count) rather than passing silently. Counts are unaffected — the row is still absent.
|
|
21
|
+
* Total by construction — it runs on the trading path and must never throw on a malformed entry.
|
|
22
|
+
*/
|
|
23
|
+
export function skippedSignalResults(signals, reason, nowMs, overrides) {
|
|
24
|
+
if (!Array.isArray(signals))
|
|
25
|
+
return [];
|
|
26
|
+
const rows = [];
|
|
27
|
+
let dropped = 0;
|
|
28
|
+
for (const [index, raw] of signals.entries()) {
|
|
29
|
+
if (raw === null || typeof raw !== 'object') {
|
|
30
|
+
dropped++;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const signal = raw;
|
|
34
|
+
const rawAsset = signal.asset;
|
|
35
|
+
// Kept verbatim (not trimmed) so it still joins the scanner signal it came from.
|
|
36
|
+
const asset = typeof rawAsset === 'string' ? rawAsset : typeof rawAsset === 'number' ? String(rawAsset) : '';
|
|
37
|
+
if (asset.trim() === '') {
|
|
38
|
+
dropped++;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const direction = signal.direction;
|
|
42
|
+
const score = signal.score;
|
|
43
|
+
// A decision-payload signal carries the book top-level (the strategy hoists it there); a raw
|
|
44
|
+
// scanner signal carries it only on `meta`, since `Signal` has no `dex` field. Both call
|
|
45
|
+
// shapes reach this helper, so both are read — top-level first, matching the per-signal loop.
|
|
46
|
+
const meta = signal.meta;
|
|
47
|
+
const metaDex = meta !== null && typeof meta === 'object' ? meta.dex : undefined;
|
|
48
|
+
const dex = typeof signal.dex === 'string' && signal.dex.trim() !== '' ? signal.dex : metaDex;
|
|
49
|
+
rows.push({
|
|
50
|
+
asset,
|
|
51
|
+
...(direction === 'LONG' || direction === 'SHORT' ? { direction } : {}),
|
|
52
|
+
dex: typeof dex === 'string' && dex.trim() !== '' ? dex.trim() : 'main',
|
|
53
|
+
...(typeof score === 'number' && Number.isFinite(score) ? { score } : {}),
|
|
54
|
+
success: overrides?.success ?? true,
|
|
55
|
+
reason,
|
|
56
|
+
...(overrides?.error !== undefined ? { error: overrides.error } : {}),
|
|
57
|
+
startedAt: nowMs,
|
|
58
|
+
endedAt: nowMs,
|
|
59
|
+
__signalIndex: index,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (dropped > 0) {
|
|
63
|
+
logger.warn('signals dropped from the skip rows: no usable asset to attribute the outcome to', undefined, {
|
|
64
|
+
reason,
|
|
65
|
+
dropped,
|
|
66
|
+
recorded: rows.length,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return rows;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=skipped-signal-results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skipped-signal-results.js","sourceRoot":"","sources":["../../src/actions/skipped-signal-results.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,MAAM,GAAG,YAAY,CAAC,mCAAmC,CAAC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAuC,EACvC,MAAc,EACd,KAAa,EACb,SAAiD;IAEjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC;IACvC,MAAM,IAAI,GAAmC,EAAE,CAAC;IAChD,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7C,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5C,OAAO,EAAE,CAAC;YACV,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,GAA8B,CAAC;QAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;QAC9B,iFAAi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C,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzE,OAAO,EAAE,SAAS,EAAE,OAAO,IAAI,IAAI;YACnC,MAAM;YACN,GAAG,CAAC,SAAS,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,KAAK;SACrB,CAAC,CAAC;IACL,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC,iFAAiF,EAAE,SAAS,EAAE;YACxG,MAAM;YACN,OAAO;YACP,QAAQ,EAAE,IAAI,CAAC,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
+
import type { RiskGateStatus } from "../../health/types.js";
|
|
6
7
|
import type { ActionType, DecisionMode } from "../types.js";
|
|
7
8
|
/** Gateway between {@link ActionResult.data} and persisted audit records. */
|
|
8
9
|
export interface DecisionMeta {
|
|
@@ -40,12 +41,18 @@ export interface ActionExecutionRecord {
|
|
|
40
41
|
} | null;
|
|
41
42
|
/** Interpolated decision prompt (LLM/rule path); null when not applicable or not supplied. */
|
|
42
43
|
decisionPrompt: string | null;
|
|
44
|
+
/**
|
|
45
|
+
* The persisted subset of the runtime's gate evaluations. `gateId`/`gateName` stay plain strings:
|
|
46
|
+
* this record is parsed back out of an untrusted payload, so it must be able to hold an id the
|
|
47
|
+
* current {@link RiskGateId} enum does not know. The verdicts are the runtime's own enum — those
|
|
48
|
+
* are the values readers branch on, and a re-spelling would drift.
|
|
49
|
+
*/
|
|
43
50
|
riskSnapshot: {
|
|
44
|
-
gate:
|
|
51
|
+
gate: Exclude<RiskGateStatus, "N_A">;
|
|
45
52
|
gates: Array<{
|
|
46
53
|
gateId: string;
|
|
47
54
|
gateName: string;
|
|
48
|
-
status:
|
|
55
|
+
status: RiskGateStatus;
|
|
49
56
|
reason?: string;
|
|
50
57
|
metrics?: Record<string, unknown>;
|
|
51
58
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/actions/store/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,2FAA2F;AAC3F,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE;QACR,IAAI,EAAE,YAAY,CAAC;QACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC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AM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,0BAA0B,CAAC;CAC5C;AAED,qEAAqE;AACrE,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,IAAI,eAAe,CAqBtD;AAED,6DAA6D;AAC7D,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,YAAY,GACzB,iBAAiB,CAiBnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/actions/store/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/actions/store/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqIH,0DAA0D;AAC1D,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,gBAAgB,EAAE,IAAI;QACtB,iBAAiB,EAAE,IAAI;QACvB,aAAa,EAAE,IAAI;QACnB,cAAc,EAAE,IAAI;QACpB,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,IAAI;QACjB,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,CAAC;QACZ,qBAAqB,EAAE,CAAC;QACxB,mBAAmB,EAAE,IAAI;QACzB,sBAAsB,EAAE,IAAI;QAC5B,qBAAqB,EAAE,CAAC;QACxB,uBAAuB,EAAE,CAAC;QAC1B,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAE,EAAE;KACvB,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,UAAkB,EAClB,UAAsB,EACtB,OAAe,EACf,YAA0B;IAE1B,OAAO;QACL,UAAU;QACV,UAAU;QACV,OAAO;QACP,YAAY;QACZ,aAAa,EAAE,IAAI;QACnB,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,CAAC;QACZ,qBAAqB,EAAE,CAAC;QACxB,qBAAqB,EAAE,CAAC;QACxB,uBAAuB,EAAE,CAAC;QAC1B,eAAe,EAAE,CAAC;QAClB,SAAS,EAAE,CAAC;KACb,CAAC;AACJ,CAAC"}
|
package/dist/actions/types.d.ts
CHANGED
|
@@ -58,6 +58,19 @@ export type ActionType = 'OPEN_POSITION' | 'CLOSE_POSITION' | string;
|
|
|
58
58
|
*/
|
|
59
59
|
export declare const DECISION_MODES: readonly ["llm", "rule", "none"];
|
|
60
60
|
export type DecisionMode = (typeof DECISION_MODES)[number];
|
|
61
|
+
/**
|
|
62
|
+
* The built-in action types, in the exact spelling every action stamps onto its own `actionType`
|
|
63
|
+
* and hence onto `ActionResult.action_type`. This object is the single source of truth: the action
|
|
64
|
+
* classes, the registry (`action-registry.ts`), the validators (`runtime-schema.ts`,
|
|
65
|
+
* `recipe-checks.ts`, `validate-dsl-position-tracking.ts`) and the telemetry readers
|
|
66
|
+
* (`event-builders.ts`, `action-runtime-module.ts`) all read it, so the emitter and the readers can
|
|
67
|
+
* never drift. `ActionType` stays open (`| string`) for plugin actions, which are not listed here.
|
|
68
|
+
*/
|
|
69
|
+
export declare const ACTION_TYPE: {
|
|
70
|
+
readonly openPosition: "OPEN_POSITION";
|
|
71
|
+
readonly closePosition: "CLOSE_POSITION";
|
|
72
|
+
readonly positionTracker: "POSITION_TRACKER";
|
|
73
|
+
};
|
|
61
74
|
export interface ActionConfig {
|
|
62
75
|
name: string;
|
|
63
76
|
action_type: ActionType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":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;CACjD;AAKD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,KAAK,MAAM,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC"}
|
package/dist/actions/types.js
CHANGED
|
@@ -8,4 +8,17 @@ export { ScanStatus } from '../types/scanner.js';
|
|
|
8
8
|
* registry can never drift.
|
|
9
9
|
*/
|
|
10
10
|
export const DECISION_MODES = ['llm', 'rule', 'none'];
|
|
11
|
+
/**
|
|
12
|
+
* The built-in action types, in the exact spelling every action stamps onto its own `actionType`
|
|
13
|
+
* and hence onto `ActionResult.action_type`. This object is the single source of truth: the action
|
|
14
|
+
* classes, the registry (`action-registry.ts`), the validators (`runtime-schema.ts`,
|
|
15
|
+
* `recipe-checks.ts`, `validate-dsl-position-tracking.ts`) and the telemetry readers
|
|
16
|
+
* (`event-builders.ts`, `action-runtime-module.ts`) all read it, so the emitter and the readers can
|
|
17
|
+
* never drift. `ActionType` stays open (`| string`) for plugin actions, which are not listed here.
|
|
18
|
+
*/
|
|
19
|
+
export const ACTION_TYPE = {
|
|
20
|
+
openPosition: 'OPEN_POSITION',
|
|
21
|
+
closePosition: 'CLOSE_POSITION',
|
|
22
|
+
positionTracker: 'POSITION_TRACKER',
|
|
23
|
+
};
|
|
11
24
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/actions/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAgB/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAgEjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/actions/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAgB/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAgEjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAI/D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,YAAY,EAAE,eAAe;IAC7B,aAAa,EAAE,gBAAgB;IAC/B,eAAe,EAAE,kBAAkB;CAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide-commands.d.ts","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"guide-commands.d.ts","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAydH,eAAO,MAAM,eAAe,QAgWpB,CAAC;AAIT,kFAAkF;AAClF,UAAU,gBAAgB;IACxB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC9D,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC;CACxF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,MAAM,GACd,IAAI,CA2CN"}
|
|
@@ -168,6 +168,9 @@ external_scanner (v2 supervised)
|
|
|
168
168
|
marginPct / leverage ride at the TOP LEVEL of the signal dict — the runtime
|
|
169
169
|
reads them directly. Omit them to size/lever from the recipe config.
|
|
170
170
|
|
|
171
|
+
data{} lands verbatim in telemetry (the signal.outcome event's
|
|
172
|
+
senpi.signal.meta attribute) — never put secrets, keys or tokens in it.
|
|
173
|
+
|
|
171
174
|
Prompt/context access stays namespaced:
|
|
172
175
|
{{signal_<scanner_name>}}
|
|
173
176
|
`.trim();
|
|
@@ -655,6 +658,19 @@ senpi status — Lightweight runtime health digest
|
|
|
655
658
|
-r, --runtime <id> Filter by runtime ID
|
|
656
659
|
--json Raw JSON output
|
|
657
660
|
|
|
661
|
+
senpi auto-update — Plugin auto-update (the runtime package's own version check)
|
|
662
|
+
auto-update check-now Run the version check now instead of waiting for the
|
|
663
|
+
poll timer. Answers "ran", "already-running", or
|
|
664
|
+
"failed" when the check itself could not complete
|
|
665
|
+
(exit 1), plus the updater snapshot. Refused
|
|
666
|
+
(exit 1, UNAVAILABLE) when auto-update is off in
|
|
667
|
+
config or the coordinator is not running. A forced
|
|
668
|
+
check also runs the
|
|
669
|
+
skills-manager tick, and on the path that installs an
|
|
670
|
+
update it requests a gateway restart — so the call may
|
|
671
|
+
return nothing at all
|
|
672
|
+
--json Raw JSON output
|
|
673
|
+
|
|
658
674
|
senpi dsl — Inspect DSL exit engine
|
|
659
675
|
dsl positions Active DSL-tracked positions
|
|
660
676
|
-r, --runtime <id> Filter by runtime ID
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide-commands.js","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,aAAa,GACjB,0EAA0E,CAAC;AAE7E,+EAA+E;AAE/E,MAAM,aAAa,GAAG,CA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gB,CAAC;IACtE,MAAM,CACJ,EAAE,EACE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GACzD,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GACzE,gBAAgB,CAAC;CACrB"}
|
|
@@ -948,6 +948,87 @@ export function registerSenpiCli(program) {
|
|
|
948
948
|
}
|
|
949
949
|
console.log(renderExplain(asset, entries));
|
|
950
950
|
});
|
|
951
|
+
// ── Auto-update subcommand ───────────────────────────────────────────────────
|
|
952
|
+
const autoUpdate = senpi.command("auto-update");
|
|
953
|
+
autoUpdate.description("Plugin auto-update (force a version check now)");
|
|
954
|
+
autoUpdate
|
|
955
|
+
.command("check-now")
|
|
956
|
+
.description("Force an immediate plugin version check instead of waiting for the poll timer")
|
|
957
|
+
.option("--json", "Print raw JSON from the gateway")
|
|
958
|
+
.action(async (opts) => {
|
|
959
|
+
// Same shape as the `skills` group: capture the gateway's JSON envelope,
|
|
960
|
+
// render formatted by default, raw with `--json`.
|
|
961
|
+
// The method awaits the whole tick: a version fetch (20s budget), an
|
|
962
|
+
// install (120s, see run-update-command.ts), the post-tick hook and a
|
|
963
|
+
// config write. The gateway client's 10s default would report a transport
|
|
964
|
+
// error while the install is still running, so ask for the real budget.
|
|
965
|
+
const result = spawnSync(process.argv[0], [
|
|
966
|
+
process.argv[1],
|
|
967
|
+
"gateway",
|
|
968
|
+
"call",
|
|
969
|
+
"senpi.autoUpdate.checkNow",
|
|
970
|
+
"--json",
|
|
971
|
+
"--timeout",
|
|
972
|
+
"180000",
|
|
973
|
+
"--params",
|
|
974
|
+
"{}",
|
|
975
|
+
], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
976
|
+
if (result.status !== 0) {
|
|
977
|
+
process.exitCode = result.status ?? 1;
|
|
978
|
+
console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
let data;
|
|
982
|
+
try {
|
|
983
|
+
data = JSON.parse(result.stdout ?? "{}");
|
|
984
|
+
}
|
|
985
|
+
catch {
|
|
986
|
+
// Same fallback as the `skills` verbs — a gateway that answers with
|
|
987
|
+
// something other than JSON is passed through verbatim.
|
|
988
|
+
process.stdout.write(result.stdout ?? "");
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
// A refused check (`UNAVAILABLE` — auto-update off, or the coordinator not
|
|
992
|
+
// running) arrives as `ok: false`. The envelope is read before the `--json`
|
|
993
|
+
// branch so the exit code does not depend on the output format: a wrapper
|
|
994
|
+
// that branches on it would otherwise record a refused check as completed.
|
|
995
|
+
if (data.ok === false) {
|
|
996
|
+
process.exitCode = 1;
|
|
997
|
+
if (opts.json) {
|
|
998
|
+
writeJson(data);
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
const err = (data.error ?? {});
|
|
1002
|
+
const code = typeof err.code === "string" ? err.code : "UNKNOWN";
|
|
1003
|
+
const message = typeof err.message === "string" ? err.message : "Unknown error";
|
|
1004
|
+
console.error(`${AUTO_UPDATE_CHECK_LABEL}: FAILED (${code}: ${message})`);
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
// Success envelope is `{ outcome, reason, updater }` (see
|
|
1008
|
+
// `senpi.autoUpdate.checkNow` in index.ts). `updater` is the coordinator
|
|
1009
|
+
// snapshot; on `already-running` it is the previous completed cycle's.
|
|
1010
|
+
const payload = (data.payload ?? data);
|
|
1011
|
+
const outcome = typeof payload?.outcome === "string" ? payload.outcome : "unknown";
|
|
1012
|
+
const reason = typeof payload?.reason === "string" ? payload.reason : "";
|
|
1013
|
+
// Set before the output format is chosen, so `--json` and the rendered
|
|
1014
|
+
// form give a caller the same exit code.
|
|
1015
|
+
if (outcome === "failed") {
|
|
1016
|
+
process.exitCode = 1;
|
|
1017
|
+
}
|
|
1018
|
+
if (opts.json) {
|
|
1019
|
+
writeJson(data);
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
console.log(`${AUTO_UPDATE_CHECK_LABEL}: ${outcome}${reason ? ` — ${reason}` : ""}`);
|
|
1023
|
+
const updater = payload?.updater;
|
|
1024
|
+
if (updater) {
|
|
1025
|
+
console.log(`installed ${updater.currentVersion ?? "—"} latest ${updater.latestVersion ?? "—"} health ${updater.health ?? "unknown"}`);
|
|
1026
|
+
// The line the box follows decides which version `latest` even means.
|
|
1027
|
+
console.log(`line: ${updater.updateSpec ?? "—"}`);
|
|
1028
|
+
console.log(`last action: ${updater.lastAction ?? "—"}`);
|
|
1029
|
+
console.log(`next check: ${updater.nextCheckAt ?? "—"}`);
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
951
1032
|
// ── Skills subcommand ────────────────────────────────────────────────────────
|
|
952
1033
|
const skills = senpi.command("skills");
|
|
953
1034
|
skills.description("Manage Senpi skills (status, update)");
|
|
@@ -1283,6 +1364,13 @@ function registerDeployCommands(senpi) {
|
|
|
1283
1364
|
* coded refusal with it too, even though only the deploy verbs publish the full map.
|
|
1284
1365
|
*/
|
|
1285
1366
|
const DEPLOY_REFUSED_EXIT = 2;
|
|
1367
|
+
/**
|
|
1368
|
+
* Row label for `senpi auto-update check-now`, on the success and the failure line alike.
|
|
1369
|
+
*
|
|
1370
|
+
* The `skills` verbs label their rows with the skill name; a forced plugin check has no such
|
|
1371
|
+
* per-item name, so one fixed label stands in for it and keeps both lines greppable.
|
|
1372
|
+
*/
|
|
1373
|
+
const AUTO_UPDATE_CHECK_LABEL = "auto-update check";
|
|
1286
1374
|
/** Appended to a deploy verb's unreadable-gateway message: the one surface that can still answer. */
|
|
1287
1375
|
const DEPLOY_STATE_UNKNOWN_HINT = " This says nothing about the deploy itself — if the gateway is up, ask `senpi deploy status` " +
|
|
1288
1376
|
"for the job's real state, and check the gateway log if that keeps failing.";
|