solana-traderclaw 1.0.93 → 1.0.95
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.
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
// src/http-client.ts
|
|
2
|
+
import kayba, { SpanType } from "@kayba_ai/tracing";
|
|
2
3
|
async function orchestratorRequest(opts) {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
if (!kayba.isConfigured()) {
|
|
5
|
+
return doRequest(opts);
|
|
6
|
+
}
|
|
7
|
+
const span = kayba.startSpan({
|
|
8
|
+
name: `HTTP ${opts.method} ${opts.path}`,
|
|
9
|
+
spanType: SpanType.TOOL,
|
|
10
|
+
inputs: { method: opts.method, path: opts.path }
|
|
11
|
+
});
|
|
12
|
+
try {
|
|
13
|
+
const result = await doRequest(opts);
|
|
14
|
+
span.end({ outputs: { status: "ok" }, status: "OK" });
|
|
15
|
+
return result;
|
|
16
|
+
} catch (err) {
|
|
17
|
+
span.end({
|
|
18
|
+
outputs: { error: err instanceof Error ? err.message : String(err) },
|
|
19
|
+
status: "ERROR"
|
|
20
|
+
});
|
|
21
|
+
throw err;
|
|
22
|
+
}
|
|
5
23
|
}
|
|
6
24
|
async function doRequest(opts, isRetry = false) {
|
|
7
25
|
const url = `${opts.baseUrl.replace(/\/$/, "")}${opts.path}`;
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./chunk-VR5WP5S4.js";
|
|
22
22
|
import {
|
|
23
23
|
orchestratorRequest
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-6GSGHMUH.js";
|
|
25
25
|
import {
|
|
26
26
|
IntelligenceLab
|
|
27
27
|
} from "./chunk-FBS5FGW2.js";
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
|
|
42
42
|
// index.ts
|
|
43
43
|
import { Type } from "@sinclair/typebox";
|
|
44
|
+
import kayba, { SpanType } from "@kayba_ai/tracing";
|
|
44
45
|
import * as fs from "fs";
|
|
45
46
|
import * as path from "path";
|
|
46
47
|
|
|
@@ -791,6 +792,8 @@ function parseConfig(raw) {
|
|
|
791
792
|
const xConfig = parseXConfig(obj);
|
|
792
793
|
const betaRaw = obj.beta && typeof obj.beta === "object" && !Array.isArray(obj.beta) ? obj.beta : {};
|
|
793
794
|
const beta = { xPosting: betaRaw.xPosting === true };
|
|
795
|
+
const kaybaApiKey = typeof obj.kaybaApiKey === "string" ? obj.kaybaApiKey : void 0;
|
|
796
|
+
const kaybaFolder = typeof obj.kaybaFolder === "string" ? obj.kaybaFolder : "traderclaw";
|
|
794
797
|
return {
|
|
795
798
|
orchestratorUrl,
|
|
796
799
|
walletId,
|
|
@@ -812,7 +815,9 @@ function parseConfig(raw) {
|
|
|
812
815
|
bootstrapBulletinWindowHours,
|
|
813
816
|
dailyLogRetentionDays,
|
|
814
817
|
xConfig,
|
|
815
|
-
beta
|
|
818
|
+
beta,
|
|
819
|
+
kaybaApiKey,
|
|
820
|
+
kaybaFolder
|
|
816
821
|
};
|
|
817
822
|
}
|
|
818
823
|
function buildTraderClawWelcomeMessage(apiKeyForDisplay) {
|
|
@@ -907,6 +912,18 @@ var solanaTraderPlugin = {
|
|
|
907
912
|
);
|
|
908
913
|
return;
|
|
909
914
|
}
|
|
915
|
+
const kaybaKey = config.kaybaApiKey || "";
|
|
916
|
+
if (kaybaKey) {
|
|
917
|
+
try {
|
|
918
|
+
kayba.configure({
|
|
919
|
+
apiKey: kaybaKey,
|
|
920
|
+
folder: config.kaybaFolder || "traderclaw"
|
|
921
|
+
});
|
|
922
|
+
api.logger.info("[solana-trader] Kayba tracing enabled");
|
|
923
|
+
} catch (err) {
|
|
924
|
+
api.logger.warn(`[solana-trader] Kayba tracing init failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
910
927
|
const dataDir = config.dataDir || path.join(process.cwd(), ".traderclaw-v1-data");
|
|
911
928
|
const sessionTokensPath = path.join(dataDir, "session-tokens.json");
|
|
912
929
|
const readSessionSidecar = () => {
|
|
@@ -1076,12 +1093,23 @@ var solanaTraderPlugin = {
|
|
|
1076
1093
|
});
|
|
1077
1094
|
const wrapExecute = (sourceName, fn) => async (toolCallId, params) => {
|
|
1078
1095
|
const toolName = sourceName;
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1096
|
+
const run = async () => {
|
|
1097
|
+
try {
|
|
1098
|
+
const result = await fn(toolCallId, params ?? {});
|
|
1099
|
+
return json(JSON.parse(renderToolEnvelope(normalizeToolSuccess(result, toolName))));
|
|
1100
|
+
} catch (err) {
|
|
1101
|
+
return json(JSON.parse(renderToolEnvelope(normalizeToolError(err, toolName))));
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
if (kayba.isConfigured()) {
|
|
1105
|
+
const traced = kayba.trace(run, {
|
|
1106
|
+
name: toolName,
|
|
1107
|
+
spanType: SpanType.TOOL,
|
|
1108
|
+
attributes: { "tool.params": JSON.stringify(params ?? {}) }
|
|
1109
|
+
});
|
|
1110
|
+
return traced();
|
|
1084
1111
|
}
|
|
1112
|
+
return run();
|
|
1085
1113
|
};
|
|
1086
1114
|
const workspaceRoot = resolveWorkspaceRoot(config.workspaceDir);
|
|
1087
1115
|
const stateDir = path.join(dataDir, "state");
|
package/dist/src/http-client.js
CHANGED
package/openclaw.plugin.json
CHANGED
|
@@ -94,6 +94,15 @@
|
|
|
94
94
|
"default": 30,
|
|
95
95
|
"description": "Number of days to retain daily log files before pruning"
|
|
96
96
|
},
|
|
97
|
+
"kaybaApiKey": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"description": "Kayba tracing API key. When set, every tool call is traced and sent to the Kayba dashboard."
|
|
100
|
+
},
|
|
101
|
+
"kaybaFolder": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"default": "traderclaw",
|
|
104
|
+
"description": "Folder name for organizing traces in the Kayba dashboard."
|
|
105
|
+
},
|
|
97
106
|
"beta": {
|
|
98
107
|
"type": "object",
|
|
99
108
|
"description": "Beta feature flags. Enable experimental capabilities that are not yet enabled by default.",
|
|
@@ -216,6 +225,17 @@
|
|
|
216
225
|
"label": "Daily Log Retention (days)",
|
|
217
226
|
"advanced": true
|
|
218
227
|
},
|
|
228
|
+
"kaybaApiKey": {
|
|
229
|
+
"label": "Kayba API Key",
|
|
230
|
+
"placeholder": "kb_xxx",
|
|
231
|
+
"sensitive": true,
|
|
232
|
+
"advanced": true
|
|
233
|
+
},
|
|
234
|
+
"kaybaFolder": {
|
|
235
|
+
"label": "Kayba Folder",
|
|
236
|
+
"placeholder": "traderclaw",
|
|
237
|
+
"advanced": true
|
|
238
|
+
},
|
|
219
239
|
"beta": {
|
|
220
240
|
"label": "Beta Features",
|
|
221
241
|
"description": "Enable experimental features. Set beta.xPosting: true to activate x_post_tweet and x_reply_tweet.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solana-traderclaw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.95",
|
|
4
4
|
"description": "TraderClaw V1-Upgraded — Solana trading for OpenClaw with intelligence lab, tool envelopes, prompt scrubbing, read-only X social intel, and split skill docs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"node": ">=22"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
+
"@kayba_ai/tracing": "^0.9.7",
|
|
42
43
|
"@sinclair/typebox": "0.34.48",
|
|
43
44
|
"ws": "^8.18.0"
|
|
44
45
|
},
|