@senpi/runtime 3.0.157 → 3.0.158
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.
|
@@ -2,9 +2,15 @@ import type { DslState } from "../types/dsl/index.js";
|
|
|
2
2
|
/** Age beyond which an unconfirmed intent-mint is considered abandoned (order never filled). */
|
|
3
3
|
export declare const PENDING_OPEN_STALE_MS: number;
|
|
4
4
|
/**
|
|
5
|
-
* Build the registry key for a position
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Build the registry key for a position, scoped by wallet so the map is correct under
|
|
6
|
+
* multi-wallet deployment.
|
|
7
|
+
*
|
|
8
|
+
* Callers describe the same position in different shapes: the open path passes the order
|
|
9
|
+
* coin (`xyz:GOLD`) with the signal's dex (often absent or `main`), the position tracker
|
|
10
|
+
* passes the clearing-house coin (`xyz:GOLD`) with its dex section (`xyz`), and DSL state
|
|
11
|
+
* stores the base coin (`GOLD`) with `xyz`. {@link normalizeDslCoinDex} folds all of these
|
|
12
|
+
* into one (base coin, dex) pair so every caller builds the same key. The main book keeps
|
|
13
|
+
* the `main` bucket (empty/whitespace/`main` dex → `main`).
|
|
8
14
|
*/
|
|
9
15
|
export declare function positionRegistryKey(wallet: string, dex: string, asset: string): string;
|
|
10
16
|
export interface Entry {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position-id-registry.d.ts","sourceRoot":"","sources":["../../src/runtime/position-id-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"position-id-registry.d.ts","sourceRoot":"","sources":["../../src/runtime/position-id-registry.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,gGAAgG;AAChG,eAAO,MAAM,qBAAqB,QAAiB,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAA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js";
|
|
33
|
+
import { normalizeDslCoinDex } from "../utils/perp-coin.js";
|
|
33
34
|
const logger = createLogger("[senpi-core][position-id]");
|
|
34
35
|
/** Age beyond which an unconfirmed intent-mint is considered abandoned (order never filled). */
|
|
35
36
|
export const PENDING_OPEN_STALE_MS = 30 * 60 * 1000;
|
|
36
37
|
/**
|
|
37
|
-
* Build the registry key for a position
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Build the registry key for a position, scoped by wallet so the map is correct under
|
|
39
|
+
* multi-wallet deployment.
|
|
40
|
+
*
|
|
41
|
+
* Callers describe the same position in different shapes: the open path passes the order
|
|
42
|
+
* coin (`xyz:GOLD`) with the signal's dex (often absent or `main`), the position tracker
|
|
43
|
+
* passes the clearing-house coin (`xyz:GOLD`) with its dex section (`xyz`), and DSL state
|
|
44
|
+
* stores the base coin (`GOLD`) with `xyz`. {@link normalizeDslCoinDex} folds all of these
|
|
45
|
+
* into one (base coin, dex) pair so every caller builds the same key. The main book keeps
|
|
46
|
+
* the `main` bucket (empty/whitespace/`main` dex → `main`).
|
|
40
47
|
*/
|
|
41
48
|
export function positionRegistryKey(wallet, dex, asset) {
|
|
42
|
-
const normalizedDex =
|
|
43
|
-
return `${wallet}|${normalizedDex}:${
|
|
49
|
+
const { coin, dex: normalizedDex } = normalizeDslCoinDex(asset, dex ?? "");
|
|
50
|
+
return `${wallet}|${normalizedDex || "main"}:${coin}`;
|
|
44
51
|
}
|
|
45
52
|
export class PositionIdRegistry {
|
|
46
53
|
entries = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position-id-registry.js","sourceRoot":"","sources":["../../src/runtime/position-id-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"position-id-registry.js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C,CAAC;QAC/B,GAAG,EAAE,mBAAmB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC;QAC9D,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,aAAa,EAAE;KAC/D,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "runtime",
|
|
3
3
|
"name": "Senpi Runtime",
|
|
4
4
|
"description": "Senpi runtime plugin for OpenClaw. Orchestrates scanners, LLM-based trade decisions, and a DSL trailing stop-loss exit engine.",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.158",
|
|
6
6
|
"commandAliases": [
|
|
7
7
|
{
|
|
8
8
|
"name": "senpi"
|