/** * Senpi core trading plugin — single plugin exposing all core features: * actions, scanners, dsl, risk, health. * Default export: OpenClaw plugin entry (register(api)). * Named export run(): programmatic/standalone entry. * * Why this file is monolithic (vs. a thin wrapper that imports ./plugin.js): * openclaw 2026.2.22's plugin loader follows relative imports from the * entry through a CJS-fallback path that rejects `import.meta` syntax. * The wrapper-style entry introduced in d919805 broke loadability for * that reason. Keeping every export in a single file (this one) avoids * the loader's relative-import path entirely. */ import type { SenpiEventBus } from "./dsl/events/index.js"; import { type ToolApprovalsMode } from "./approvals/tool-approval-gate.js"; import { type TickTelemetryConfig } from "./telemetry/tick-frame.js"; /** Initialize all core features (DSL, risk, health) on the given event bus. */ export declare function initCore(bus: SenpiEventBus): void; export { initDsl, DslPlugin, dslLogger, setDslLogLevel, parseDslPluginConfig, DslConfigValidationError, dslValidationIssue, EVENTS as DslEvents, DSL_EVENTS, } from "./dsl/index.js"; export type { DslArchivedClose, DslPluginConfig, DslPositionSummary, DslState, DslTickResult, ExitBlockConfig, DslValidationIssue, DslValidationIssueCode, } from "./dsl/index.js"; export { initRisk } from "./risk/index.js"; export { createHealthStateModule, initHealth } from "./health/index.js"; export type { ComponentHealth, ComponentHealthStatus, ComponentSystemState, DslComponentHealthStatus, DslSystemState, RuntimeHealthStatus, RuntimeLogLevel, RuntimeSystemState, ScannerComponentHealthStatus, ScannerRegistrationSystemState, ScannerSystemState, StateStatusProvider, } from "./health/index.js"; export { HOOK_EVENT } from './types/index.js'; export type { HookEventType, HookEvent, HookSystem, StrategyConfig, StateManager, GateCheckResult, RiskGuard, NotificationService, Signal, ScanResult, } from './types/index.js'; export { ScanStatus } from './types/index.js'; export type { ActionType, DecisionMode, ActionConfig, ActionContext, ActionDecision, ActionResult, Action, ActionFactory, ActionManifest, ActionScanPayload, LlmDecisionRequest, LlmDecisionResponse, LlmDecision, } from './actions/types.js'; export type { ContextBuilder } from './context/types.js'; export { DecisionEngine, LlmDecisionStrategy, NoDecisionStrategy, } from './actions/decision-engine.js'; export { OpenClawLlmDecision, AnthropicLlmDecision, createLlmDecision } from './actions/llm-decision/index.js'; /** @deprecated Use OpenClawLlmDecision instead */ export { OpenClawLlmDecision as LlmDecisionClient } from './actions/llm-decision/index.js'; export type { DecisionStrategy, DecisionRequest } from './actions/decision-engine.js'; export { OpenPositionAction, openPositionFactory, openPositionManifest, } from './actions/open-position/open-position.action.js'; export { ClosePositionAction, closePositionFactory, closePositionManifest, } from './actions/close-position/close-position.action.js'; export { SenpiClient } from './senpi/index.js'; export type { McpTransport, SenpiClientConfig, CreatePositionRequest, CreatePositionOrder, CreatePositionResult, CreatePositionOrderResult, OrderDirection, OrderType, LeverageType, TimeInForce, ExitOrderType, StopLoss, TakeProfit, ListStrategiesFilters, StrategySummary, } from './senpi/index.js'; export { createScannerRuntimeModule, createSenpiScannerProviders, emergingMoversScanner, momentumScanner, oiTrackerScanner, providerInput, prescreenerScanner, PersistencePolicy, RetentionPolicy, ScanStatus as ScannerScanStatus, SkipScan, } from './scanners/index.js'; export type { ScannerId, StrategyId, InstrumentContext, Instrument, Candle, CandleResult, ParsedCandles, OiSnapshot, SmMarket, Candidate, ReadSignalsFilter as ScannerReadSignalsFilter, ProviderLogLevel, ProviderLogger, ProviderToolClient, SenpiProviderCacheTtlMs, SenpiProviderTimeouts, SenpiProviderToolNames, SenpiScannerProviderFactoryOptions, SenpiToolClient, Scanner as RuntimeScanner, ScannerDataProviders, ScannerDefinition, ScannerHooks, ProviderInputDescriptor, InstrumentsInputDescriptor, CandlesInputDescriptor, SmDataInputDescriptor, ActivePositionsInputDescriptor, ScannerInputDescriptor, ScannerInput, ExternalScannerIngestRequest, ExternalScannerIngestResult, ExternalScannerIngestSignalItem, ScannerRegistrationSummary, ScannerRuntimeEventMap, ScannerRuntimeEventName, ScannerRuntimeModule, ScannerRuntimeModuleOptions, StrategyRegistration as ScannerStrategyRegistration, } from './scanners/index.js'; export { run } from "./runtime/run.js"; export type { RunOptions, RuntimeHandle } from "./runtime/run.js"; export { loadRuntimeConfig } from "./runtime/load-runtime-config.js"; export type { LoadRuntimeConfigOptions } from "./runtime/load-runtime-config.js"; export { Runtime } from "./runtime/runtime.js"; export type { RuntimeOptions } from "./runtime/runtime.js"; /** Plugin config shape (aligned with openclaw.plugin.json configSchema). Source of truth for strategies is the registry, not config. */ export interface SenpiRuntimePluginConfig { stateDir?: string; apiKey?: string; logLevel?: string; /** * MCP tool approval gate mode override (see src/approvals/tool-approval-gate.ts): * "trades" requires interactive approval for state-changing senpi MCP tools, * "all" gates every senpi MCP tool, "off" disables the gate. The gated tool * set and the default mode ship in the checked-in * src/approvals/tool-approvals-manifest.json. Precedence: * env SENPI_TOOL_APPROVALS > this setting > manifest default. */ toolApprovals?: ToolApprovalsMode; autoUpdate?: Record; /** * How much detail the per-tick scanner level (`plugin.senpi.tick`) carries. `"off"` publishes no * frame at all; `"summary"` / `"verbose"` apply to both sources; the object form sets each source * on its own and an omitted key takes the default, `"verbose"`. * * Plugin config and deliberately NOT an env var: `register()` re-reads plugin config on a config * reload, while changing a service variable restarts the container — and the whole point of the * dial is to turn detail up on a box that is misbehaving right now. */ tickTelemetry?: TickTelemetryConfig; /** * Per-widget-type on/off switch for the `show_widget` agent tool, keyed by * `widget_type` (see src/widgets/registry.ts). Absent or `true` enables a * widget; only an explicit `false` disables it. With every type disabled the * tool is not registered at all. */ widgets?: Record; skillsManager?: { enabled?: boolean; /** * Directory (or directories) where managed skills are installed. * Accepts a single string (legacy form) or an array of strings (the * search path introduced for multi-dir installs). Mirrors the * `oneOf: [string, array]` shape declared in `openclaw.plugin.json`'s * configSchema and the `RawSkillsManagerConfig.skillsDir` type in * `src/skills-manager/types.ts` — keeping all three in sync. */ skillsDir?: string | string[]; /** * @deprecated Ignored. The managed skill set is defined solely by the * manifest (`src/skills-manager/skills-manifest.json`), the single source * of truth. Tolerated for backward compatibility with existing configs but * no longer affects which skills are managed. Use `overrides` to retarget a * skill's source, or `enabled: false` to disable the manager. */ skills?: string[]; /** * Optional per-skill source overrides keyed by skill name, each able to * override `repo`, `branch`, and/or `path` — e.g. * `{ "senpi-strategy-ops": { "branch": "strategy-v2" } }`. A per-skill * `branch` override beats the global `SENPI_SKILLS_BRANCH` env knob; only * the per-skill `SENPI_SKILLS_BRANCH_` env var outranks it. */ overrides?: Record; }; } interface PluginLogger { info(...args: unknown[]): void; warn(...args: unknown[]): void; error(message: unknown, meta?: unknown): void; } /** * Mirrors openclaw's `OperatorScope` union (gateway/operator-scopes.ts). * Declared locally because openclaw's plugin-sdk does not re-export this type * via a stable subpath; keep in sync with openclaw if new scopes are added. * * Required for B1-deep on OpenClaw v2026.5.x — without an explicit per-method * scope, the gateway falls back to `operator.admin`, which forces every * pairing-only CLI client into a non-silent scope-upgrade prompt that no * managed agent can approve. See `registerGatewayMethod` call sites below. */ type OperatorScope = "operator.admin" | "operator.read" | "operator.write" | "operator.approvals" | "operator.pairing" | "operator.talk.secrets"; /** * What a gateway RPC handler receives. `context` is openclaw's `GatewayRequestContext`, narrowed to * the one member the plugin uses: it is the ONLY route to the websocket push layer — the plugin api * object carries no broadcast, emit, push or publish. Optional because a host that predates it, and * every test double, calls handlers without one. */ interface GatewayRequestCtx { respond: (ok: boolean, value: unknown) => void; params?: Record; context?: { broadcast?: (event: string, payload: unknown, opts?: { dropIfSlow?: boolean; }) => void; }; } interface PluginApi { id: string; name: string; pluginConfig?: Record; logger: PluginLogger; config?: Record; runtime: { state: { resolveStateDir(): string; }; config?: { loadConfig(): Promise; writeConfigFile(config: unknown): Promise; }; }; registerService(service: { id: string; start: (ctx: { stateDir: string; }) => void | Promise; stop?: (ctx: { stateDir: string; }) => void | Promise; }): void; registerCli(fn: (ctx: { program: { command: (name: string, desc?: string) => unknown; }; }) => void, opts?: { commands: string[]; }): void; registerGatewayMethod(name: string, handler: (ctx: GatewayRequestCtx) => void | Promise, opts?: { scope?: OperatorScope; }): void; registerTool(tool: (ctx: { sessionId?: string; }) => unknown, opts?: { names?: string[]; optional?: boolean; }): void; registerReload?: (registration: { restartPrefixes?: string[]; hotPrefixes?: string[]; noopPrefixes?: string[]; }) => void; on(hookName: string, handler: (...args: unknown[]) => void | Promise, opts?: { priority?: number; }): void; } /** * OpenClaw plugin entry. * Boots from internal registry (installed_runtimes.json) in stateDir; does not read runtime list from config. */ declare const senpiRuntimePlugin: { id: string; name: string; version: string; description: string; configSchema: { parse(value: unknown): Record; }; register(api: PluginApi): void; }; export default senpiRuntimePlugin; //# sourceMappingURL=index.d.ts.map