@senpi/runtime 3.0.32 → 3.0.34
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/close-position/close-position.action.d.ts.map +1 -1
- package/dist/actions/close-position/close-position.action.js +2 -9
- package/dist/actions/close-position/close-position.action.js.map +1 -1
- package/dist/actions/decision-error-notification.d.ts +22 -1
- package/dist/actions/decision-error-notification.d.ts.map +1 -1
- package/dist/actions/decision-error-notification.js +22 -0
- package/dist/actions/decision-error-notification.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +2 -8
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/cli/guide-commands.js +3 -3
- package/dist/dsl/engine-client/event-mapping.d.ts.map +1 -1
- package/dist/dsl/engine-client/event-mapping.js +6 -0
- package/dist/dsl/engine-client/event-mapping.js.map +1 -1
- package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
- package/dist/dsl/monitor/process-one-position.js +2 -0
- package/dist/dsl/monitor/process-one-position.js.map +1 -1
- package/dist/dsl/notifications/formatter.d.ts +1 -6
- package/dist/dsl/notifications/formatter.d.ts.map +1 -1
- package/dist/dsl/notifications/formatter.js +0 -28
- package/dist/dsl/notifications/formatter.js.map +1 -1
- package/dist/dsl/notifications/index.d.ts +0 -2
- package/dist/dsl/notifications/index.d.ts.map +1 -1
- package/dist/dsl/notifications/index.js +33 -5
- package/dist/dsl/notifications/index.js.map +1 -1
- package/dist/dsl/notifications/stop-raise-ratchet.d.ts +76 -0
- package/dist/dsl/notifications/stop-raise-ratchet.d.ts.map +1 -0
- package/dist/dsl/notifications/stop-raise-ratchet.js +113 -0
- package/dist/dsl/notifications/stop-raise-ratchet.js.map +1 -0
- package/dist/dsl/plugin/index.d.ts.map +1 -1
- package/dist/dsl/plugin/index.js +0 -1
- package/dist/dsl/plugin/index.js.map +1 -1
- package/dist/dsl/plugin/options.d.ts +3 -8
- package/dist/dsl/plugin/options.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime/decision-errors.d.ts +7 -2
- package/dist/runtime/decision-errors.d.ts.map +1 -1
- package/dist/runtime/decision-errors.js +28 -4
- package/dist/runtime/decision-errors.js.map +1 -1
- package/dist/runtime/managed-wallet-guard.d.ts +47 -0
- package/dist/runtime/managed-wallet-guard.d.ts.map +1 -0
- package/dist/runtime/managed-wallet-guard.js +106 -0
- package/dist/runtime/managed-wallet-guard.js.map +1 -0
- package/dist/runtime/notifications.d.ts +0 -2
- package/dist/runtime/notifications.d.ts.map +1 -1
- package/dist/runtime/notifications.js +12 -19
- package/dist/runtime/notifications.js.map +1 -1
- package/dist/runtime/protection-nudge.d.ts +67 -0
- package/dist/runtime/protection-nudge.d.ts.map +1 -0
- package/dist/runtime/protection-nudge.js +244 -0
- package/dist/runtime/protection-nudge.js.map +1 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +5 -7
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/strategy-lifecycle.d.ts +18 -4
- package/dist/runtime/strategy-lifecycle.d.ts.map +1 -1
- package/dist/runtime/strategy-lifecycle.js +17 -33
- package/dist/runtime/strategy-lifecycle.js.map +1 -1
- package/dist/scripts/run-dsl-standalone-live.d.ts +2 -2
- package/dist/scripts/run-dsl-standalone-live.js +7 -12
- package/dist/scripts/run-dsl-standalone-live.js.map +1 -1
- package/dist/types/dsl/index.d.ts +13 -0
- package/dist/types/dsl/index.d.ts.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
|
@@ -55,10 +55,11 @@ function classifyStatus(status) {
|
|
|
55
55
|
return "retry";
|
|
56
56
|
return "drop";
|
|
57
57
|
}
|
|
58
|
-
const lastWarnedAt = new Map();
|
|
59
58
|
/** Log a WARN, but suppress repeats of the same reason within {@link WARN_REPEAT_WINDOW_MS}
|
|
60
|
-
* so a hot failure path (e.g. a sustained outage) doesn't flood the log.
|
|
61
|
-
|
|
59
|
+
* so a hot failure path (e.g. a sustained outage) doesn't flood the log. The suppression
|
|
60
|
+
* map is passed in (owned per service instance — see {@link createNotificationService}), so
|
|
61
|
+
* two services with different tokens never suppress each other's WARNs. */
|
|
62
|
+
function warnRateLimited(lastWarnedAt, key, message, attributes) {
|
|
62
63
|
const now = Date.now();
|
|
63
64
|
const last = lastWarnedAt.get(key);
|
|
64
65
|
if (last !== undefined && now - last < WARN_REPEAT_WINDOW_MS)
|
|
@@ -96,7 +97,7 @@ async function postOnce(ingestUrl, authToken, envelope, timeoutMs) {
|
|
|
96
97
|
/** POST the envelope with a single bounded retry on a transient failure (5xx / network / timeout).
|
|
97
98
|
* Never throws — every outcome resolves, so a delivery failure can never surface as a rejected
|
|
98
99
|
* promise into the caller's (often serial, trading-critical) code path. */
|
|
99
|
-
async function deliver(ingestUrl, authToken, envelope, timeoutMs) {
|
|
100
|
+
async function deliver(lastWarnedAt, ingestUrl, authToken, envelope, timeoutMs) {
|
|
100
101
|
let outcome = await postOnce(ingestUrl, authToken, envelope, timeoutMs);
|
|
101
102
|
for (let attempt = 2; outcome.kind === "retry" && attempt <= MAX_ATTEMPTS; attempt++) {
|
|
102
103
|
outcome = await postOnce(ingestUrl, authToken, envelope, timeoutMs);
|
|
@@ -106,7 +107,7 @@ async function deliver(ingestUrl, authToken, envelope, timeoutMs) {
|
|
|
106
107
|
const notificationId = envelope.notificationId;
|
|
107
108
|
const subtype = envelope.actionMetadata?.notificationSubtype;
|
|
108
109
|
const rateLimitKey = `${outcome.status ?? "network"}:${typeof subtype === "string" ? subtype : "unknown"}`;
|
|
109
|
-
warnRateLimited(rateLimitKey, `Notification delivery dropped notificationId=${String(notificationId)} status=${outcome.status ?? "n/a"}: ${outcome.reason}`, { notificationId, status: outcome.status });
|
|
110
|
+
warnRateLimited(lastWarnedAt, rateLimitKey, `Notification delivery dropped notificationId=${String(notificationId)} status=${outcome.status ?? "n/a"}: ${outcome.reason}`, { notificationId, status: outcome.status });
|
|
110
111
|
}
|
|
111
112
|
/**
|
|
112
113
|
* User-facing alert when the backend rejects orders because the strategy is
|
|
@@ -133,7 +134,6 @@ export function formatBackendPausedNotification(address) {
|
|
|
133
134
|
* the next notification retries the transport fresh.
|
|
134
135
|
*/
|
|
135
136
|
export function createNotificationService(options) {
|
|
136
|
-
const mcpTransport = options?.mcpTransport;
|
|
137
137
|
const ingestUrl = (options?.ingest_url || process.env.NOTIFICATIONS_INGEST_URL)?.trim();
|
|
138
138
|
if (!ingestUrl) {
|
|
139
139
|
throw new Error("NotificationService misconfigured: NOTIFICATIONS_INGEST_URL is not set. " +
|
|
@@ -149,6 +149,11 @@ export function createNotificationService(options) {
|
|
|
149
149
|
"the runtime authenticates to the notification-ingest endpoint with its own Senpi token.");
|
|
150
150
|
}
|
|
151
151
|
const timeoutMs = options?.ingest_timeout_ms ?? DEFAULT_TIMEOUT_MS;
|
|
152
|
+
// Per-instance WARN suppression state. Owned by this service (not a module global)
|
|
153
|
+
// so sibling services don't suppress each other's WARNs, and each service's first
|
|
154
|
+
// delivery failure always logs — a module-global map would let one service's WARN
|
|
155
|
+
// rate-limit another's, and made this hard to observe/test.
|
|
156
|
+
const lastWarnedAt = new Map();
|
|
152
157
|
// Telegram delivery is gone; a recipe still carrying telegram_chat_id from before
|
|
153
158
|
// the cutover is a silent misconfiguration footgun otherwise — the operator set it
|
|
154
159
|
// expecting delivery and gets nothing. Ignore it, but say so loudly once.
|
|
@@ -219,19 +224,7 @@ export function createNotificationService(options) {
|
|
|
219
224
|
envelope.context = p.context;
|
|
220
225
|
if (recipient !== undefined)
|
|
221
226
|
envelope.recipientUserId = recipient;
|
|
222
|
-
|
|
223
|
-
// for notifications, so this branch only ever runs under test. When present
|
|
224
|
-
// it short-circuits before any HTTP call.
|
|
225
|
-
if (mcpTransport) {
|
|
226
|
-
try {
|
|
227
|
-
await mcpTransport("notify", envelope);
|
|
228
|
-
}
|
|
229
|
-
catch (err) {
|
|
230
|
-
logger.warn("mcpTransport notify failed", undefined, { err: describeError(err) });
|
|
231
|
-
}
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
await deliver(ingestUrl, authToken, envelope, timeoutMs);
|
|
227
|
+
await deliver(lastWarnedAt, ingestUrl, authToken, envelope, timeoutMs);
|
|
235
228
|
},
|
|
236
229
|
};
|
|
237
230
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/runtime/notifications.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/runtime/notifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,GAAG,YAAY,CAAC,6BAA6B,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,OAAO,CAAC;AACtC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,mFAAmF;AACnF,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB,gFAAgF;AAChF,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAcrC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,+BAA+B,CAAC,UAAkB;IAChE,OAAO,qBAAqB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC;AACvD,CAAC;AAED,qFAAqF;AACrF,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAA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C;oBAClE,EAAE,EAAE,cAAc;oBAClB,qBAAqB,EAAE,IAAI,CAAC,SAAS;oBACrC,uBAAuB,EAAE,IAAI,CAAC,QAAQ;oBACtC,wBAAwB,EAAE,IAAI,CAAC,KAAK;oBACpC,qBAAqB,EAAE,IAAI,CAAC,KAAK;oBACjC,IAAI,EAAE,EAAE;oBACR,QAAQ,EAAE,qBAAqB;iBAChC;gBACD,0EAA0E;gBAC1E,yEAAyE;gBACzE,mEAAmE;gBACnE,cAAc,EAAE,cAAc;aAC/B,CAAC;YACF,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS;gBAAE,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;YAC1D,IAAI,SAAS,KAAK,SAAS;gBAAE,QAAQ,CAAC,eAAe,GAAG,SAAS,CAAC;YAElE,MAAM,OAAO,CAAC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QACzE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual-trade protection: a `before_tool_call` gate plus a
|
|
3
|
+
* `tool_result_persist` nudge for agent-issued position tools on non-runtime
|
|
4
|
+
* (manual) wallets — the only wallets where `create_position` succeeds, since
|
|
5
|
+
* runtime-managed wallets are vetoed upstream by the managed-wallet guard.
|
|
6
|
+
*
|
|
7
|
+
* Gate (veto-until-protected): a manual `create_position` must carry a stop
|
|
8
|
+
* loss on every order, or an explicit top-level `protection: "none"` marker
|
|
9
|
+
* showing the agent means it. `edit_position` is gated narrowly — only an
|
|
10
|
+
* explicit stop-loss cancel is blocked, because the hook cannot see current
|
|
11
|
+
* server-side state and must not demand a stop on every edit.
|
|
12
|
+
*
|
|
13
|
+
* Nudge: after a successful `create_position`, a message is appended to the
|
|
14
|
+
* tool result telling the agent what protection the order carries, to attach
|
|
15
|
+
* `ratchet_stop_add` (server-side trailing protection that takes over driving
|
|
16
|
+
* the stop) unless the user opted out, and to report active protection to the
|
|
17
|
+
* user and offer to adjust it.
|
|
18
|
+
*
|
|
19
|
+
* The `protection` marker is stripped harmlessly by the MCP server's zod schema
|
|
20
|
+
* (plain `z.object`, no `.strict()`/`.passthrough()`), so it is visible to this
|
|
21
|
+
* hook but never reaches execution.
|
|
22
|
+
*/
|
|
23
|
+
import type { Logger } from "../utils/logger.js";
|
|
24
|
+
/**
|
|
25
|
+
* Correlates the gate and the nudge across the two hook events. The
|
|
26
|
+
* `tool_result_persist` event carries tool identity (toolName/toolCallId) and
|
|
27
|
+
* the result, but NOT the call params — so the gate (which sees params) stashes
|
|
28
|
+
* the computed protection summary keyed by toolCallId and the nudge reads it
|
|
29
|
+
* back. Bounded: a `create_position` the gate allowed but whose result is never
|
|
30
|
+
* persisted (an aborted turn) would otherwise leak an entry forever.
|
|
31
|
+
*/
|
|
32
|
+
export interface ProtectionSummaryCapture {
|
|
33
|
+
record(toolCallId: string, summary: string): void;
|
|
34
|
+
take(toolCallId: string): string | undefined;
|
|
35
|
+
}
|
|
36
|
+
export declare function createProtectionSummaryCapture(maxEntries?: number): ProtectionSummaryCapture;
|
|
37
|
+
export interface ProtectionGateOptions {
|
|
38
|
+
logger: Logger;
|
|
39
|
+
capture?: ProtectionSummaryCapture;
|
|
40
|
+
}
|
|
41
|
+
export interface ProtectionNudgeOptions {
|
|
42
|
+
logger: Logger;
|
|
43
|
+
capture?: ProtectionSummaryCapture;
|
|
44
|
+
}
|
|
45
|
+
/** Veto shape understood by OpenClaw's before_tool_call dispatcher. */
|
|
46
|
+
export interface ProtectionGateBlock {
|
|
47
|
+
block: true;
|
|
48
|
+
blockReason: string;
|
|
49
|
+
}
|
|
50
|
+
/** Result shape understood by OpenClaw's tool_result_persist dispatcher. */
|
|
51
|
+
export interface ProtectionNudgeResult {
|
|
52
|
+
message: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
export type ProtectionGateHandler = (event: unknown) => Promise<ProtectionGateBlock | undefined>;
|
|
55
|
+
export type ProtectionNudgeHandler = (event: unknown) => ProtectionNudgeResult | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Build the `before_tool_call` gate. The hook fires on EVERY tool call, so the
|
|
58
|
+
* non-gated fast path is a string check only.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createProtectionGate(options: ProtectionGateOptions): ProtectionGateHandler;
|
|
61
|
+
/**
|
|
62
|
+
* Build the `tool_result_persist` nudge. Synchronous by contract — the host
|
|
63
|
+
* runs this on the transcript-append hot path and warns-and-ignores any handler
|
|
64
|
+
* that returns a Promise.
|
|
65
|
+
*/
|
|
66
|
+
export declare function createProtectionNudge(options: ProtectionNudgeOptions): ProtectionNudgeHandler;
|
|
67
|
+
//# sourceMappingURL=protection-nudge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protection-nudge.d.ts","sourceRoot":"","sources":["../../src/runtime/protection-nudge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAQjD;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAClD,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC9C;AAED,wBAAgB,8BAA8B,CAAC,UAAU,SAAM,GAAG,wBAAwB,CAiBzF;AAUD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC;AAED,uEAAuE;AACvE,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,IAAI,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,4EAA4E;AAC5E,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,MAAM,qBAAqB,GAAG,CAClC,KAAK,EAAE,OAAO,KACX,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,CACnC,KAAK,EAAE,OAAO,KACX,qBAAqB,GAAG,SAAS,CAAC;AAwGvC;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,CAoE1F;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,sBAAsB,CAwC7F"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manual-trade protection: a `before_tool_call` gate plus a
|
|
3
|
+
* `tool_result_persist` nudge for agent-issued position tools on non-runtime
|
|
4
|
+
* (manual) wallets — the only wallets where `create_position` succeeds, since
|
|
5
|
+
* runtime-managed wallets are vetoed upstream by the managed-wallet guard.
|
|
6
|
+
*
|
|
7
|
+
* Gate (veto-until-protected): a manual `create_position` must carry a stop
|
|
8
|
+
* loss on every order, or an explicit top-level `protection: "none"` marker
|
|
9
|
+
* showing the agent means it. `edit_position` is gated narrowly — only an
|
|
10
|
+
* explicit stop-loss cancel is blocked, because the hook cannot see current
|
|
11
|
+
* server-side state and must not demand a stop on every edit.
|
|
12
|
+
*
|
|
13
|
+
* Nudge: after a successful `create_position`, a message is appended to the
|
|
14
|
+
* tool result telling the agent what protection the order carries, to attach
|
|
15
|
+
* `ratchet_stop_add` (server-side trailing protection that takes over driving
|
|
16
|
+
* the stop) unless the user opted out, and to report active protection to the
|
|
17
|
+
* user and offer to adjust it.
|
|
18
|
+
*
|
|
19
|
+
* The `protection` marker is stripped harmlessly by the MCP server's zod schema
|
|
20
|
+
* (plain `z.object`, no `.strict()`/`.passthrough()`), so it is visible to this
|
|
21
|
+
* hook but never reaches execution.
|
|
22
|
+
*/
|
|
23
|
+
import { baseToolName } from "./managed-wallet-guard.js";
|
|
24
|
+
/** Base tool name whose orders must be protected (or explicitly opted out). */
|
|
25
|
+
const CREATE_POSITION = "create_position";
|
|
26
|
+
/** Base tool name gated only against an explicit stop-loss cancel. */
|
|
27
|
+
const EDIT_POSITION = "edit_position";
|
|
28
|
+
export function createProtectionSummaryCapture(maxEntries = 256) {
|
|
29
|
+
const store = new Map();
|
|
30
|
+
return {
|
|
31
|
+
record(toolCallId, summary) {
|
|
32
|
+
if (store.size >= maxEntries) {
|
|
33
|
+
// Map preserves insertion order — evicting the first key drops the oldest.
|
|
34
|
+
const oldest = store.keys().next().value;
|
|
35
|
+
if (oldest !== undefined)
|
|
36
|
+
store.delete(oldest);
|
|
37
|
+
}
|
|
38
|
+
store.set(toolCallId, summary);
|
|
39
|
+
},
|
|
40
|
+
take(toolCallId) {
|
|
41
|
+
const summary = store.get(toolCallId);
|
|
42
|
+
if (summary !== undefined)
|
|
43
|
+
store.delete(toolCallId);
|
|
44
|
+
return summary;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Default shared capture, used when a factory is called with `{ logger }` only.
|
|
50
|
+
* Lets the gate and nudge correlate without the caller threading a capture, but
|
|
51
|
+
* the plugin registration passes one explicit instance to both (and tests pass
|
|
52
|
+
* their own) so the coupling is visible rather than global.
|
|
53
|
+
*/
|
|
54
|
+
const sharedCapture = createProtectionSummaryCapture();
|
|
55
|
+
function asObject(value) {
|
|
56
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
57
|
+
? value
|
|
58
|
+
: undefined;
|
|
59
|
+
}
|
|
60
|
+
/** True when the base tool name (after the last `__`) equals `expected`. */
|
|
61
|
+
function isTool(toolName, expected) {
|
|
62
|
+
return typeof toolName === "string" && baseToolName(toolName.toLowerCase()) === expected;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* True when a stop-loss value is zero — numeric `0` or a string that parses to
|
|
66
|
+
* it (`"0"`, `"0.0"`). Zero is the cancel sentinel (see the `edit_position`
|
|
67
|
+
* gate), not real protection, so both gates read it as "no stop" via this one
|
|
68
|
+
* helper. An empty/absent value is not zero.
|
|
69
|
+
*/
|
|
70
|
+
function isZeroStop(value) {
|
|
71
|
+
if (value == null)
|
|
72
|
+
return false;
|
|
73
|
+
if (typeof value === "number")
|
|
74
|
+
return value === 0;
|
|
75
|
+
if (typeof value === "string")
|
|
76
|
+
return value.trim() !== "" && Number(value) === 0;
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* An exit object counts as a real stop loss when it carries a non-zero
|
|
81
|
+
* `percentage` or `price`. A zero value is the cancel sentinel (`isZeroStop`),
|
|
82
|
+
* not protection — so a `create_position` with `stopLoss: { percentage: 0 }` or
|
|
83
|
+
* `{ price: 0 }` is rejected, matching how the `edit_position` gate reads 0.
|
|
84
|
+
*/
|
|
85
|
+
function hasStopLoss(order) {
|
|
86
|
+
const sl = asObject(order.stopLoss);
|
|
87
|
+
if (sl == null)
|
|
88
|
+
return false;
|
|
89
|
+
const hasPct = sl.percentage != null && !isZeroStop(sl.percentage);
|
|
90
|
+
const hasPrice = sl.price != null && !isZeroStop(sl.price);
|
|
91
|
+
return hasPct || hasPrice;
|
|
92
|
+
}
|
|
93
|
+
/** One order's protection, e.g. `#1 SL 5% TP 10%` or `#2 SL @42000`. */
|
|
94
|
+
function summarizeOrder(order, index) {
|
|
95
|
+
const sl = describeExit("SL", asObject(order.stopLoss));
|
|
96
|
+
const tp = describeExit("TP", asObject(order.takeProfit));
|
|
97
|
+
return `#${index + 1} ${sl ?? "no SL"}${tp ? ` ${tp}` : ""}`;
|
|
98
|
+
}
|
|
99
|
+
function describeExit(label, exit) {
|
|
100
|
+
if (!exit)
|
|
101
|
+
return undefined;
|
|
102
|
+
if (exit.percentage != null)
|
|
103
|
+
return `${label} ${String(exit.percentage)}%`;
|
|
104
|
+
if (exit.price != null)
|
|
105
|
+
return `${label} @${String(exit.price)}`;
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
function buildCreateBlockReason() {
|
|
109
|
+
return [
|
|
110
|
+
`Blocked create_position: every manual order needs a flat stop loss (a "stopLoss" with either "percentage" or "price") — the safety floor from the first fill.`,
|
|
111
|
+
`Resubmit with a stopLoss on each order.`,
|
|
112
|
+
`After the fill, attach ratchet_stop_add — server-side trailing protection that takes over driving the stop loss as price moves in your favor.`,
|
|
113
|
+
`Take profit ("takeProfit") is optional.`,
|
|
114
|
+
`If the user explicitly wants no protection, resubmit the identical call with a top-level "protection": "none".`,
|
|
115
|
+
].join(" ");
|
|
116
|
+
}
|
|
117
|
+
function buildEditBlockReason() {
|
|
118
|
+
return [
|
|
119
|
+
`Blocked edit_position: this edit cancels the stop loss (stopLoss.percentage: 0), leaving the position unprotected.`,
|
|
120
|
+
`Keep a stop loss, or hand the stop to ratchet_stop_add for server-side trailing protection.`,
|
|
121
|
+
`If the user explicitly wants to remove all protection, resubmit the identical call with a top-level "protection": "none".`,
|
|
122
|
+
].join(" ");
|
|
123
|
+
}
|
|
124
|
+
function buildNudge(summary) {
|
|
125
|
+
return [
|
|
126
|
+
`[senpi] Manual position opened. Protection on this order: ${summary}.`,
|
|
127
|
+
`A flat stop loss is only the initial safety floor — now attach server-side trailing protection: call ratchet_stop_add for this wallet so the runtime drives the stop as price moves in your favor, unless the user has explicitly opted out of protection.`,
|
|
128
|
+
`Then tell the user exactly what protection is active on the position and offer to adjust it.`,
|
|
129
|
+
].join(" ");
|
|
130
|
+
}
|
|
131
|
+
const UNPROTECTED_SUMMARY = `explicitly unprotected (protection: "none")`;
|
|
132
|
+
/**
|
|
133
|
+
* Build the `before_tool_call` gate. The hook fires on EVERY tool call, so the
|
|
134
|
+
* non-gated fast path is a string check only.
|
|
135
|
+
*/
|
|
136
|
+
export function createProtectionGate(options) {
|
|
137
|
+
const { logger, capture = sharedCapture } = options;
|
|
138
|
+
return async (event) => {
|
|
139
|
+
const ev = (event ?? {});
|
|
140
|
+
const gatesCreate = isTool(ev.toolName, CREATE_POSITION);
|
|
141
|
+
const gatesEdit = isTool(ev.toolName, EDIT_POSITION);
|
|
142
|
+
if (!gatesCreate && !gatesEdit) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const params = asObject(ev.params);
|
|
147
|
+
// Malformed/missing params: allow — the MCP server's schema owns that error.
|
|
148
|
+
if (!params) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
const optedOut = params.protection === "none";
|
|
152
|
+
const toolCallId = typeof ev.toolCallId === "string" ? ev.toolCallId : undefined;
|
|
153
|
+
if (gatesEdit) {
|
|
154
|
+
// Narrow gate: block ONLY an explicit stop-loss cancel. The hook can't
|
|
155
|
+
// see current server-side state, so an edit touching other fields (or a
|
|
156
|
+
// take-profit-only edit) must pass.
|
|
157
|
+
const sl = asObject(params.stopLoss);
|
|
158
|
+
if (sl != null && isZeroStop(sl.percentage) && !optedOut) {
|
|
159
|
+
logger.warn("[protection-gate] blocked edit_position stop-loss cancel without protection:none", {
|
|
160
|
+
toolName: ev.toolName,
|
|
161
|
+
});
|
|
162
|
+
return { block: true, blockReason: buildEditBlockReason() };
|
|
163
|
+
}
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
// create_position: require a stop loss on every order unless opted out.
|
|
167
|
+
const orders = Array.isArray(params.orders) ? params.orders.map(asObject) : undefined;
|
|
168
|
+
// Missing/empty/malformed orders: allow — the server schema owns those.
|
|
169
|
+
if (!orders || orders.length === 0 || orders.some((o) => o === undefined)) {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
if (optedOut) {
|
|
173
|
+
if (toolCallId)
|
|
174
|
+
capture.record(toolCallId, UNPROTECTED_SUMMARY);
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
if (orders.some((o) => !hasStopLoss(o))) {
|
|
178
|
+
logger.warn("[protection-gate] blocked create_position without a stop loss on every order", {
|
|
179
|
+
toolName: ev.toolName,
|
|
180
|
+
});
|
|
181
|
+
return { block: true, blockReason: buildCreateBlockReason() };
|
|
182
|
+
}
|
|
183
|
+
// All orders protected: allow, and stash the per-order summary so the
|
|
184
|
+
// nudge (which never sees params) can report it after the fill.
|
|
185
|
+
if (toolCallId) {
|
|
186
|
+
capture.record(toolCallId, orders.map((o, i) => summarizeOrder(o, i)).join("; "));
|
|
187
|
+
}
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
// Fail open: a gate error must never block a legitimate trade. (A throw
|
|
192
|
+
// would fail closed — the host blocks on hook errors.)
|
|
193
|
+
logger.warn("[protection-gate] gate check failed; allowing tool call", err, {
|
|
194
|
+
toolName: ev.toolName,
|
|
195
|
+
});
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Build the `tool_result_persist` nudge. Synchronous by contract — the host
|
|
202
|
+
* runs this on the transcript-append hot path and warns-and-ignores any handler
|
|
203
|
+
* that returns a Promise.
|
|
204
|
+
*/
|
|
205
|
+
export function createProtectionNudge(options) {
|
|
206
|
+
const { logger, capture = sharedCapture } = options;
|
|
207
|
+
return (event) => {
|
|
208
|
+
try {
|
|
209
|
+
const ev = (event ?? {});
|
|
210
|
+
// A synthetic result is a host placeholder, not a real create_position fill.
|
|
211
|
+
if (ev.isSynthetic === true || !isTool(ev.toolName, CREATE_POSITION)) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
const message = asObject(ev.message);
|
|
215
|
+
if (!message) {
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
// Silent on failed results: no position was opened, nothing to protect.
|
|
219
|
+
if (message.isError === true) {
|
|
220
|
+
return undefined;
|
|
221
|
+
}
|
|
222
|
+
// Append a text block to the existing content; never replace it, so the
|
|
223
|
+
// real tool result reaches the model intact. If content isn't an array we
|
|
224
|
+
// can't append safely — leave the result untouched.
|
|
225
|
+
const content = message.content;
|
|
226
|
+
if (!Array.isArray(content)) {
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
const toolCallId = typeof ev.toolCallId === "string" ? ev.toolCallId : undefined;
|
|
230
|
+
const summary = (toolCallId ? capture.take(toolCallId) : undefined) ?? "see the order you just submitted";
|
|
231
|
+
return {
|
|
232
|
+
message: {
|
|
233
|
+
...message,
|
|
234
|
+
content: [...content, { type: "text", text: buildNudge(summary) }],
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
logger.warn("[protection-nudge] nudge build failed; leaving tool result unchanged", err);
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=protection-nudge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protection-nudge.js","sourceRoot":"","sources":["../../src/runtime/protection-nudge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,+EAA+E;AAC/E,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,sEAAsE;AACtE,MAAM,aAAa,GAAG,eAAe,CAAC;AAetC,MAAM,UAAU,8BAA8B,CAAC,UAAU,GAAG,GAAG;IAC7D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,OAAO;QACL,MAAM,CAAC,UAAU,EAAE,OAAO;YACxB,IAAI,KAAK,CAAC,IAAI,IAAI,UAAU,EAAE,CAAC;gBAC7B,2EAA2E;gBAC3E,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC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AY5B;;OAEG;YACW,iBAAiB;IAyI/B;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;;;OAIG;YACW,oBAAoB;IAiElC;;;OAGG;YACW,kBAAkB;IAc1B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CA4D5B"}
|
package/dist/runtime/runtime.js
CHANGED
|
@@ -434,9 +434,11 @@ export class Runtime {
|
|
|
434
434
|
const llmDecision = createLlmDecision({});
|
|
435
435
|
const contextBuilder = createContextBuilder();
|
|
436
436
|
const notifications = createNotificationService({
|
|
437
|
+
// A config-provided senpi_auth_token wins; when absent, createNotificationService
|
|
438
|
+
// resolves the token itself from apiKey/SENPI_AUTH_TOKEN/SENPI_API_KEY. Do NOT set
|
|
439
|
+
// senpi_auth_token here — spread after the config, it would clobber a config token.
|
|
440
|
+
senpi_auth_token: this.options.apiKey,
|
|
437
441
|
...this.config.notifications,
|
|
438
|
-
mcpTransport: this.options.mcpTransport,
|
|
439
|
-
senpi_auth_token: this.options.apiKey ?? process.env.SENPI_AUTH_TOKEN ?? process.env.SENPI_API_KEY,
|
|
440
442
|
});
|
|
441
443
|
const riskBlock = this.config.risk;
|
|
442
444
|
const strategyAddress = this.strategyConfig.address;
|
|
@@ -526,10 +528,7 @@ export class Runtime {
|
|
|
526
528
|
})();
|
|
527
529
|
// Build strategyStates map once — shared by DslPlugin and the reconcile loop.
|
|
528
530
|
const strategyStatesMap = createStrategyStatesMap(this.strategyConfig, senpi);
|
|
529
|
-
const notificationsConfig = this.config.notifications;
|
|
530
531
|
if (hasDsl) {
|
|
531
|
-
const dslNotificationsDisabled = notificationsConfig?.dsl_lifecycle === false;
|
|
532
|
-
const dslNotifySlUpdates = notificationsConfig?.dsl_notify_sl_updates !== false;
|
|
533
532
|
this.dslPlugin = await DslPluginClass.create({
|
|
534
533
|
config: exitConfig,
|
|
535
534
|
bus: this.bus,
|
|
@@ -537,8 +536,7 @@ export class Runtime {
|
|
|
537
536
|
stateManager: this.stateManager,
|
|
538
537
|
senpiClient: senpi,
|
|
539
538
|
strategyStates: strategyStatesMap,
|
|
540
|
-
notifications
|
|
541
|
-
notifySlUpdates: dslNotifySlUpdates,
|
|
539
|
+
notifications,
|
|
542
540
|
strategyName: notificationLabel,
|
|
543
541
|
// Monitor runs the unified periodic reconcile (adopt/resize/gone), serialized
|
|
544
542
|
// against the trade loop on the same reconcileMutex key, and can resolve the boot gate.
|