@senpi/runtime 1.1.0-dev.runtime-phase-2.20260609132603 → 1.1.0-dev.runtime-phase-2.20260610125851
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 +0 -16
- package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
- package/dist/actions/close-position/close-position.action.js +38 -299
- package/dist/actions/close-position/close-position.action.js.map +1 -1
- package/dist/actions/decision-engine.d.ts +0 -2
- package/dist/actions/decision-engine.d.ts.map +1 -1
- package/dist/actions/decision-engine.js.map +1 -1
- package/dist/actions/llm-decision/factory.d.ts +0 -3
- package/dist/actions/llm-decision/factory.d.ts.map +1 -1
- package/dist/actions/llm-decision/factory.js +0 -1
- package/dist/actions/llm-decision/factory.js.map +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.d.ts +0 -13
- package/dist/actions/llm-decision/openclaw-llm-decision.d.ts.map +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.js +68 -195
- package/dist/actions/llm-decision/openclaw-llm-decision.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts +0 -12
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +123 -346
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.d.ts +0 -6
- package/dist/actions/position-tracker/position-tracker.action.d.ts.map +1 -1
- package/dist/actions/position-tracker/position-tracker.action.js +0 -48
- package/dist/actions/position-tracker/position-tracker.action.js.map +1 -1
- package/dist/runtime/create-actions.d.ts.map +1 -1
- package/dist/runtime/create-actions.js +0 -2
- package/dist/runtime/create-actions.js.map +1 -1
- package/dist/runtime/create-runtime-context.d.ts +0 -2
- package/dist/runtime/create-runtime-context.d.ts.map +1 -1
- package/dist/runtime/create-runtime-context.js +0 -1
- package/dist/runtime/create-runtime-context.js.map +1 -1
- package/dist/runtime/create-scanner-module.d.ts +1 -1
- package/dist/runtime/create-scanner-module.d.ts.map +1 -1
- package/dist/runtime/create-scanner-module.js +1 -2
- package/dist/runtime/create-scanner-module.js.map +1 -1
- package/dist/runtime/runtime-schema.d.ts +0 -24
- package/dist/runtime/runtime-schema.d.ts.map +1 -1
- package/dist/runtime/runtime-schema.js +0 -1
- package/dist/runtime/runtime-schema.js.map +1 -1
- package/dist/runtime/runtime.d.ts +0 -5
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +4 -127
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/scanners/engine/data-providers.d.ts +0 -2
- package/dist/scanners/engine/data-providers.d.ts.map +1 -1
- package/dist/scanners/engine/data-providers.js.map +1 -1
- package/dist/scanners/engine/engine.d.ts.map +1 -1
- package/dist/scanners/engine/engine.js +9 -68
- package/dist/scanners/engine/engine.js.map +1 -1
- package/dist/scanners/runtime-module.d.ts +0 -2
- package/dist/scanners/runtime-module.d.ts.map +1 -1
- package/dist/scanners/runtime-module.js +0 -1
- package/dist/scanners/runtime-module.js.map +1 -1
- package/dist/senpi/client.d.ts +2 -2
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +20 -120
- package/dist/senpi/client.js.map +1 -1
- package/dist/senpi/types.d.ts +1 -68
- package/dist/senpi/types.d.ts.map +1 -1
- package/dist/strategy/strategy-state.d.ts +1 -1
- package/dist/strategy/strategy-state.d.ts.map +1 -1
- package/dist/tracking/spans/plugin-span-tracker.d.ts.map +1 -1
- package/dist/tracking/spans/plugin-span-tracker.js +24 -4
- package/dist/tracking/spans/plugin-span-tracker.js.map +1 -1
- package/dist/tracking/spans/redact-pii.d.ts +0 -10
- package/dist/tracking/spans/redact-pii.d.ts.map +1 -1
- package/dist/tracking/spans/redact-pii.js +2 -80
- package/dist/tracking/spans/redact-pii.js.map +1 -1
- package/dist/types/runtime.d.ts +0 -3
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/types/strategy.d.ts +2 -2
- package/dist/types/strategy.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/actions/otel-helpers.d.ts +0 -65
- package/dist/actions/otel-helpers.d.ts.map +0 -1
- package/dist/actions/otel-helpers.js +0 -122
- package/dist/actions/otel-helpers.js.map +0 -1
- package/dist/otel/context.d.ts +0 -24
- package/dist/otel/context.d.ts.map +0 -1
- package/dist/otel/context.js +0 -29
- package/dist/otel/context.js.map +0 -1
- package/dist/otel/emitter.d.ts +0 -73
- package/dist/otel/emitter.d.ts.map +0 -1
- package/dist/otel/emitter.js +0 -248
- package/dist/otel/emitter.js.map +0 -1
- package/dist/otel/encode.d.ts +0 -48
- package/dist/otel/encode.d.ts.map +0 -1
- package/dist/otel/encode.js +0 -100
- package/dist/otel/encode.js.map +0 -1
- package/dist/otel/index.d.ts +0 -13
- package/dist/otel/index.d.ts.map +0 -1
- package/dist/otel/index.js +0 -10
- package/dist/otel/index.js.map +0 -1
- package/dist/otel/transport.d.ts +0 -57
- package/dist/otel/transport.d.ts.map +0 -1
- package/dist/otel/transport.js +0 -208
- package/dist/otel/transport.js.map +0 -1
- package/dist/otel/types.d.ts +0 -62
- package/dist/otel/types.d.ts.map +0 -1
- package/dist/otel/types.js +0 -2
- package/dist/otel/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw-llm-decision.d.ts","sourceRoot":"","sources":["../../../src/actions/llm-decision/openclaw-llm-decision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"openclaw-llm-decision.d.ts","sourceRoot":"","sources":["../../../src/actions/llm-decision/openclaw-llm-decision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAsBxF,MAAM,WAAW,0BAA0B;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CASjG;AAED,qBAAa,mBAAoB,YAAW,WAAW;IACrD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAS;gBAE3B,OAAO,CAAC,EAAE,0BAA0B;IAM1C,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;CAsF9E"}
|
|
@@ -9,46 +9,6 @@ const MAX_DECISION_RETRIES = 2;
|
|
|
9
9
|
/** Fixed delay between retry attempts (ms). Backoff is intentionally simple for now. */
|
|
10
10
|
const DECISION_RETRY_DELAY_MS = 1_000;
|
|
11
11
|
const logger = createLogger('[llm-decision][openclaw]');
|
|
12
|
-
/**
|
|
13
|
-
* Parse an HTTP `Retry-After` header value into milliseconds.
|
|
14
|
-
*
|
|
15
|
-
* Per RFC 7231 §7.1.3 the value is either delta-seconds (a non-negative integer)
|
|
16
|
-
* or an HTTP-date. We preserve `Retry-After: 0` as a legitimate "retry now"
|
|
17
|
-
* signal — the previous `Number(v) * 1000 || undefined` form silently lost it.
|
|
18
|
-
*
|
|
19
|
-
* Returns `null` only when the header is genuinely absent or unparseable.
|
|
20
|
-
*/
|
|
21
|
-
export function parseRetryAfter(value) {
|
|
22
|
-
if (value == null)
|
|
23
|
-
return null;
|
|
24
|
-
const asNum = Number(value);
|
|
25
|
-
if (!Number.isNaN(asNum))
|
|
26
|
-
return asNum * 1000; // delta-seconds, including 0
|
|
27
|
-
const asDate = Date.parse(value); // HTTP-date form
|
|
28
|
-
if (!Number.isNaN(asDate)) {
|
|
29
|
-
const delta = asDate - Date.now();
|
|
30
|
-
return delta > 0 ? delta : 0;
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Emit a `gen_ai.message` log with consistent attribute shape across all three
|
|
36
|
-
* roles (system / user / assistant). Extras let the assistant variant add
|
|
37
|
-
* `gen_ai.usage.total_tokens` without duplicating the base shape.
|
|
38
|
-
*/
|
|
39
|
-
function emitGenAiMessage(otel, parent, role, model, provider, body, extras) {
|
|
40
|
-
otel?.emitLog({
|
|
41
|
-
eventName: 'gen_ai.message',
|
|
42
|
-
parent,
|
|
43
|
-
attrs: {
|
|
44
|
-
'gen_ai.role': role,
|
|
45
|
-
'gen_ai.model': model,
|
|
46
|
-
'gen_ai.system': provider,
|
|
47
|
-
...(extras ?? {}),
|
|
48
|
-
},
|
|
49
|
-
body,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
12
|
/**
|
|
53
13
|
* Normalize a `decision_model` string into a `{ provider, model }` pair for the
|
|
54
14
|
* OpenClaw `llm-task` call.
|
|
@@ -90,12 +50,10 @@ export class OpenClawLlmDecision {
|
|
|
90
50
|
gatewayUrl;
|
|
91
51
|
gatewayToken;
|
|
92
52
|
defaultModel;
|
|
93
|
-
otel;
|
|
94
53
|
constructor(options) {
|
|
95
54
|
this.gatewayUrl = options?.gatewayUrl ?? 'http://127.0.0.1:18789';
|
|
96
55
|
this.gatewayToken = options?.gatewayToken;
|
|
97
56
|
this.defaultModel = options?.defaultModel;
|
|
98
|
-
this.otel = options?.otel;
|
|
99
57
|
}
|
|
100
58
|
async decide(request) {
|
|
101
59
|
const start = Date.now();
|
|
@@ -103,163 +61,78 @@ export class OpenClawLlmDecision {
|
|
|
103
61
|
if (!token) {
|
|
104
62
|
throw new Error('OpenClaw gateway token not configured (set OPENCLAW_GATEWAY_TOKEN)');
|
|
105
63
|
}
|
|
64
|
+
const args = {
|
|
65
|
+
prompt: `${SYSTEM_PROMPT}\n\n## Task\n${request.prompt}`,
|
|
66
|
+
input: request.context,
|
|
67
|
+
schema: ACTION_DECISION_SCHEMA,
|
|
68
|
+
// OpenClaw's llm-task plugin falls back to 30 s when the caller omits
|
|
69
|
+
// `timeoutMs`. Gemini's tail latency exceeds that during load (Roach
|
|
70
|
+
// Runtime 2.0 5xx incident), so we explicitly override to 90 s.
|
|
71
|
+
// Resolution chain in OpenClaw: params.timeoutMs ?? pluginCfg.timeoutMs ?? 30_000
|
|
72
|
+
// (extensions/llm-task/src/llm-task-tool.ts).
|
|
73
|
+
timeoutMs: 90_000,
|
|
74
|
+
};
|
|
106
75
|
const { provider, model } = splitProviderModel(request.model ?? this.defaultModel);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// Resolution chain in OpenClaw: params.timeoutMs ?? pluginCfg.timeoutMs ?? 30_000
|
|
134
|
-
// (extensions/llm-task/src/llm-task-tool.ts).
|
|
135
|
-
timeoutMs: 90_000,
|
|
136
|
-
};
|
|
137
|
-
if (provider)
|
|
138
|
-
args.provider = provider;
|
|
139
|
-
if (model)
|
|
140
|
-
args.model = model;
|
|
141
|
-
if (request.maxTokens != null)
|
|
142
|
-
args.maxTokens = request.maxTokens;
|
|
143
|
-
if (request.temperature != null)
|
|
144
|
-
args.temperature = request.temperature;
|
|
145
|
-
// Selective retry: only failure modes the error classifier marks retryable
|
|
146
|
-
// (transient provider errors, empty output) are retried. Config/author bugs
|
|
147
|
-
// and timeouts fail fast — a timeout already burned 90s and signal processing
|
|
148
|
-
// is strictly serial, so retrying would stall the runtime's whole queue.
|
|
149
|
-
//
|
|
150
|
-
// Returns the successful llmSpan alongside the parsed body so the post-retry
|
|
151
|
-
// assistant gen_ai.message log can parent under the *winning* attempt — the
|
|
152
|
-
// trace then answers "which retry produced the final response".
|
|
153
|
-
const { result, llmSpan: successfulLlmSpan } = await withRetry(async () => {
|
|
154
|
-
const llmSpan = this.otel?.startSpan('llm.call', {
|
|
155
|
-
parent: agentSpan,
|
|
156
|
-
attrs: {
|
|
157
|
-
'gen_ai.system': provider,
|
|
158
|
-
'gen_ai.model': model,
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
let res;
|
|
162
|
-
try {
|
|
163
|
-
res = await fetch(`${this.gatewayUrl}/tools/invoke`, {
|
|
164
|
-
method: 'POST',
|
|
165
|
-
headers: {
|
|
166
|
-
'Authorization': `Bearer ${token}`,
|
|
167
|
-
'Content-Type': 'application/json',
|
|
168
|
-
...buildSenpiTrackingHeaders(),
|
|
169
|
-
},
|
|
170
|
-
body: JSON.stringify({ tool: 'llm-task', args }),
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
catch (fetchErr) {
|
|
174
|
-
llmSpan?.recordException(fetchErr);
|
|
175
|
-
llmSpan?.setAttr('llm.success', false);
|
|
176
|
-
llmSpan?.end({ statusCode: 'Error' });
|
|
177
|
-
throw fetchErr;
|
|
178
|
-
}
|
|
179
|
-
if (!res.ok) {
|
|
180
|
-
const text = await res.text();
|
|
181
|
-
const httpError = new Error(`OpenClaw gateway error (${res.status}): ${text}`);
|
|
182
|
-
if (res.status === 429) {
|
|
183
|
-
// B5 — rate-limit signal is a span event on the failed attempt,
|
|
184
|
-
// not a separate log. HyperDX renders span events on the timeline
|
|
185
|
-
// and the {retry_after_ms, provider, model} payload stays bound
|
|
186
|
-
// to the specific attempt that hit the limit. The `llm.rate_limited`
|
|
187
|
-
// event substitutes for the generic `exception` event here.
|
|
188
|
-
const retryAfterMs = parseRetryAfter(res.headers.get('retry-after'));
|
|
189
|
-
llmSpan?.addEvent('llm.rate_limited', {
|
|
190
|
-
...(retryAfterMs !== null ? { retry_after_ms: retryAfterMs } : {}),
|
|
191
|
-
provider,
|
|
192
|
-
model,
|
|
193
|
-
});
|
|
194
|
-
llmSpan?.setAttr('exception.type', 'RateLimited');
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
// Non-429 HTTP errors get the standard `exception` span event so
|
|
198
|
-
// the errored-span contract holds uniformly (see implementation
|
|
199
|
-
// notes "On any errored span: Events contains exception").
|
|
200
|
-
llmSpan?.recordException(httpError);
|
|
201
|
-
}
|
|
202
|
-
llmSpan?.setAttrs({
|
|
203
|
-
'llm.success': false,
|
|
204
|
-
'llm.error_code': `http_${res.status}`,
|
|
205
|
-
});
|
|
206
|
-
llmSpan?.end({ statusCode: 'Error' });
|
|
207
|
-
throw httpError;
|
|
208
|
-
}
|
|
209
|
-
const parsed = await res.json();
|
|
210
|
-
if (!parsed.ok) {
|
|
211
|
-
const rejectError = new Error(`OpenClaw gateway rejected request: ${parsed.error ?? JSON.stringify(parsed)}`);
|
|
212
|
-
llmSpan?.recordException(rejectError);
|
|
213
|
-
llmSpan?.setAttrs({
|
|
214
|
-
'llm.success': false,
|
|
215
|
-
'llm.error_code': parsed.error ?? 'unknown',
|
|
216
|
-
});
|
|
217
|
-
llmSpan?.end({ statusCode: 'Error' });
|
|
218
|
-
throw rejectError;
|
|
219
|
-
}
|
|
220
|
-
llmSpan?.setAttr('llm.success', true);
|
|
221
|
-
llmSpan?.end({ statusCode: 'Ok' });
|
|
222
|
-
return { result: parsed, llmSpan };
|
|
223
|
-
}, {
|
|
224
|
-
retries: MAX_DECISION_RETRIES,
|
|
225
|
-
delayMs: DECISION_RETRY_DELAY_MS,
|
|
226
|
-
label: 'llm-task',
|
|
227
|
-
shouldRetry: isRetryableDecisionError,
|
|
228
|
-
onRetry: (attempt, retriesRemaining, error) => {
|
|
229
|
-
logger.warn('llm-task failed; retrying', {
|
|
230
|
-
attempt,
|
|
231
|
-
retriesRemaining,
|
|
232
|
-
error: error instanceof Error ? error.message : String(error),
|
|
233
|
-
});
|
|
76
|
+
if (provider)
|
|
77
|
+
args.provider = provider;
|
|
78
|
+
if (model)
|
|
79
|
+
args.model = model;
|
|
80
|
+
if (request.maxTokens != null)
|
|
81
|
+
args.maxTokens = request.maxTokens;
|
|
82
|
+
if (request.temperature != null)
|
|
83
|
+
args.temperature = request.temperature;
|
|
84
|
+
// Selective retry: only failure modes the error classifier marks retryable
|
|
85
|
+
// (transient provider errors, empty output) are retried. Config/author bugs
|
|
86
|
+
// and timeouts fail fast — a timeout already burned 90s and signal processing
|
|
87
|
+
// is strictly serial, so retrying would stall the runtime's whole queue.
|
|
88
|
+
// The thrown error after exhaustion is unchanged, so the notification layer
|
|
89
|
+
// still classifies it identically.
|
|
90
|
+
//
|
|
91
|
+
// Senpi tracking headers (correlation_id, address, recipe_name, runtime_id,
|
|
92
|
+
// runtime_version) are rebuilt on every attempt so a long-retry call still
|
|
93
|
+
// carries the current ALS context — the runtime's signal consumer pins ALS
|
|
94
|
+
// for the whole flow, so the values are stable across attempts in practice.
|
|
95
|
+
const body = await withRetry(async () => {
|
|
96
|
+
const res = await fetch(`${this.gatewayUrl}/tools/invoke`, {
|
|
97
|
+
method: 'POST',
|
|
98
|
+
headers: {
|
|
99
|
+
'Authorization': `Bearer ${token}`,
|
|
100
|
+
'Content-Type': 'application/json',
|
|
101
|
+
...buildSenpiTrackingHeaders(),
|
|
234
102
|
},
|
|
103
|
+
body: JSON.stringify({ tool: 'llm-task', args }),
|
|
235
104
|
});
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
});
|
|
240
|
-
const parsed = extractDecision(result.result);
|
|
241
|
-
if (agentSpan) {
|
|
242
|
-
// B10 — parent the assistant message under the winning llm.call attempt
|
|
243
|
-
// (falls back to agentSpan if span emission was disabled).
|
|
244
|
-
emitGenAiMessage(this.otel, successfulLlmSpan ?? agentSpan, 'assistant', model, provider, result.result, parsed.tokensUsed != null ? { 'gen_ai.usage.total_tokens': parsed.tokensUsed } : undefined);
|
|
245
|
-
agentSpan.setAttrs({
|
|
246
|
-
...(parsed.tokensUsed != null ? { 'gen_ai.usage.total_tokens': parsed.tokensUsed } : {}),
|
|
247
|
-
});
|
|
105
|
+
if (!res.ok) {
|
|
106
|
+
const text = await res.text();
|
|
107
|
+
throw new Error(`OpenClaw gateway error (${res.status}): ${text}`);
|
|
248
108
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
109
|
+
const parsed = await res.json();
|
|
110
|
+
if (!parsed.ok) {
|
|
111
|
+
throw new Error(`OpenClaw gateway rejected request: ${parsed.error ?? JSON.stringify(parsed)}`);
|
|
112
|
+
}
|
|
113
|
+
return parsed;
|
|
114
|
+
}, {
|
|
115
|
+
retries: MAX_DECISION_RETRIES,
|
|
116
|
+
delayMs: DECISION_RETRY_DELAY_MS,
|
|
117
|
+
label: 'llm-task',
|
|
118
|
+
shouldRetry: isRetryableDecisionError,
|
|
119
|
+
onRetry: (attempt, retriesRemaining, error) => {
|
|
120
|
+
logger.warn('llm-task failed; retrying', {
|
|
121
|
+
attempt,
|
|
122
|
+
retriesRemaining,
|
|
123
|
+
error: error instanceof Error ? error.message : String(error),
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
const latencyMs = Date.now() - start;
|
|
128
|
+
logger.debug('llm-task raw result', { keys: body.result && typeof body.result === 'object' ? Object.keys(body.result) : typeof body.result });
|
|
129
|
+
const parsed = extractDecision(body.result);
|
|
130
|
+
return {
|
|
131
|
+
decision: parsed.decision,
|
|
132
|
+
rawResponse: JSON.stringify(body.result),
|
|
133
|
+
tokensUsed: parsed.tokensUsed,
|
|
134
|
+
latencyMs,
|
|
135
|
+
};
|
|
263
136
|
}
|
|
264
137
|
}
|
|
265
138
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openclaw-llm-decision.js","sourceRoot":"","sources":["../../../src/actions/llm-decision/openclaw-llm-decision.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"openclaw-llm-decision.js","sourceRoot":"","sources":["../../../src/actions/llm-decision/openclaw-llm-decision.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,+FAA+F;AAC/F,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,wFAAwF;AACxF,MAAM,uBAAu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AE9I,MAAM,MAAM,GAAG,eAAe,CAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QAE/C,OAAO;YACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;YACxC,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,SAAS;SACV,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;GAOG;AACH,SAAS,yBAAyB;IAChC,MAAM,GAAG,GAAG,kBAAkB,EAAE,CAAC;IACjC,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,GAAG,CAAC,aAAa;QAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,GAAG,CAAC,aAAa,CAAC;IAC1E,IAAI,GAAG,CAAC,OAAO;QAAE,OAAO,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC;IACvD,IAAI,GAAG,CAAC,UAAU;QAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC;IACjE,IAAI,GAAG,CAAC,SAAS;QAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC;IAC9D,IAAI,GAAG,CAAC,cAAc;QAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,GAAG,CAAC,cAAc,CAAC;IAC7E,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -11,18 +11,6 @@ export declare class OpenPositionAction implements Action {
|
|
|
11
11
|
handle(event: HookEvent): Promise<ActionResult>;
|
|
12
12
|
private normalizeSignals;
|
|
13
13
|
private handleSignals;
|
|
14
|
-
/**
|
|
15
|
-
* Process one signal end-to-end: gates → leverage/margin resolution →
|
|
16
|
-
* senpi.createPosition → hook fire. Opens a per-signal `signal.evaluated`
|
|
17
|
-
* funnel span (via `withSignalSpanScope`) and stamps the per-signal `position.id`
|
|
18
|
-
* on mint. Returns an outcome the caller applies to counters + results.
|
|
19
|
-
*
|
|
20
|
-
* The exception path inside the senpi.createPosition try/catch sets a
|
|
21
|
-
* 'failed' outcome and lets `withSignalSpanScope` complete normally — the
|
|
22
|
-
* outer for-loop's catch in `handleSignals` only fires on truly unexpected
|
|
23
|
-
* throws.
|
|
24
|
-
*/
|
|
25
|
-
private processOpenSignal;
|
|
26
14
|
}
|
|
27
15
|
export declare const openPositionFactory: ActionFactory;
|
|
28
16
|
export declare const openPositionManifest: ActionManifest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-position.action.d.ts","sourceRoot":"","sources":["../../../src/actions/open-position/open-position.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,
|
|
1
|
+
{"version":3,"file":"open-position.action.d.ts","sourceRoot":"","sources":["../../../src/actions/open-position/open-position.action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EAEZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,SAAS,EAEV,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAoBtD,qBAAa,kBAAmB,YAAW,MAAM;IAO7C,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IAPjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAG,eAAe,CAAU;IAE/C,OAAO,CAAC,cAAc,CAAiB;gBAG7B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,cAAc;IASjC,OAAO,CAAC,WAAW;IAWb,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;IA4MrD,OAAO,CAAC,gBAAgB;YAaV,aAAa;CAoQ5B;AAID,eAAO,MAAM,mBAAmB,EAAE,aACO,CAAC;AAE1C,eAAO,MAAM,oBAAoB,EAAE,cAMlC,CAAC"}
|