export type { HookEventType, HookEvent, HookSystem } from '../types/hooks.js'; export type { NotificationService } from '../types/notification.js'; export type { StrategyConfig, } from '../types/strategy.js'; export type { StateManager, GateCheckResult, RiskGuard, } from '../types/action.js'; export type { Signal, ScanResult } from '../types/scanner.js'; export { ScanStatus } from '../types/scanner.js'; import type { Signal, ScanResult } from '../types/scanner.js'; /** Per-strategy slot counts for action payload. */ export interface StrategySlots { total: number; used: number; available: number; } /** Action-specific enrichment wrapper around a scanner ScanResult. */ export interface ActionScanPayload { scanResult: ScanResult; /** Sorted signals (e.g. scanResult.signals) for actions to consider. */ topPicks?: Signal[]; /** Per-strategy total/used/available slots. Keys are addresses. */ strategySlots?: Record; /** True when the emitting strategy (or any, if no address filter) has available slots. */ anySlotsAvailable?: boolean; /** Sum of available slots (for emitting strategy when address set, else all). */ totalAvailableSlots?: number; /** Number of scans in history (optional). */ scansInHistory?: number; } export interface LlmDecisionRequest { prompt: string; context: Record; model?: string; maxTokens?: number; temperature?: number; } export interface LlmDecisionResponse { decision: T; rawResponse: string; tokensUsed: number; latencyMs: number; } export interface LlmDecision { decide(request: LlmDecisionRequest): Promise>; } import type { HookEvent, HookSystem } from '../types/hooks.js'; import type { NotificationService } from '../types/notification.js'; import type { StrategyConfig } from '../types/strategy.js'; import type { RuntimeContext } from '../types/runtime.js'; import type { RiskGuard, StateManager } from '../types/action.js'; import type { SenpiClient } from '../senpi/client.js'; import type { ContextBuilder } from '../context/types.js'; export type ActionType = 'OPEN_POSITION' | 'CLOSE_POSITION' | string; /** * The decision strategies wired in the decision engine and registered by the * open/close actions. This tuple is the single source of truth: the schema * (`runtime-schema.ts`) enums on it and the telemetry guard * (`action-runtime-module.ts`) imports it, so the type, the validator, and the * registry can never drift. */ export declare const DECISION_MODES: readonly ["llm", "rule", "none"]; export type DecisionMode = (typeof DECISION_MODES)[number]; /** * The built-in action types, in the exact spelling every action stamps onto its own `actionType` * and hence onto `ActionResult.action_type`. This object is the single source of truth: the action * classes, the registry (`action-registry.ts`), the validators (`runtime-schema.ts`, * `recipe-checks.ts`, `validate-dsl-position-tracking.ts`) and the telemetry readers * (`event-builders.ts`, `action-runtime-module.ts`) all read it, so the emitter and the readers can * never drift. `ActionType` stays open (`| string`) for plugin actions, which are not listed here. */ export declare const ACTION_TYPE: { readonly openPosition: "OPEN_POSITION"; readonly closePosition: "CLOSE_POSITION"; readonly positionTracker: "POSITION_TRACKER"; }; export interface ActionConfig { name: string; action_type: ActionType; decision_mode: DecisionMode; decision_model?: string; scanners?: string[]; min_confidence?: number; context?: import('../context/types.js').ContextEntry[]; decision_prompt?: string; params?: Record; } export interface ActionContext { senpi: SenpiClient; stateManager: StateManager; hookSystem: HookSystem; llmDecision: LlmDecision; contextBuilder: ContextBuilder; riskGuard: RiskGuard; notifications: NotificationService; strategy: StrategyConfig; playbook: { runtimeName: string; version: string; }; maxLeverageData: Record; /** Human strategy label (`group` when set, else `name`) for the `[label] ` notification prefix. */ notificationLabel: string; } /** * Base decision output from the decision layer. * Enforced fields are common to ALL actions. * Action-specific fields go in `payload` — each action defines its own shape. */ export interface ActionDecision { execute: boolean; actionType: ActionType; confidence: number; reasoning: string; payload: Record; /** * Populated by decision strategies for action-layer auditing (LLM path includes token usage and optional model). */ decisionTelemetry?: { durationMs: number; tokensUsed: number | null; model?: string; }; } export interface ActionResult { success: boolean; action_type: ActionType; summary: string; data?: Record; skipped?: boolean; skipReason?: string; error?: string; } /** * Core Action contract. Every action implementation must satisfy this. * * Actions are event-driven: instantiated once, receive events via handle(), * return results. They do NOT subscribe themselves to events — the orchestrator * (future) handles wiring. * * Lifecycle: create (factory) -> start() -> handle() [repeated] -> stop() */ export interface Action { readonly name: string; readonly actionType: ActionType; handle(event: HookEvent): Promise; } export type ActionFactory = (config: ActionConfig, context: RuntimeContext) => Action; export interface ActionManifest { type: string; name: string; description?: string; eventsConsumed: string[]; eventsEmitted: string[]; configSchema?: Record; } //# sourceMappingURL=types.d.ts.map