chitin-openclaw-plugin 0.4.3 → 0.5.0
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/index.js +4 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { privateKeyToAccount } from "viem/accounts";
|
|
|
12
12
|
import { baseSepolia } from "viem/chains";
|
|
13
13
|
import WebSocket from "ws";
|
|
14
14
|
import { execFile } from "child_process";
|
|
15
|
-
import { trace, context, SpanStatusCode } from "@opentelemetry/api";
|
|
15
|
+
import { trace, context, propagation, SpanStatusCode } from "@opentelemetry/api";
|
|
16
16
|
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
17
17
|
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-node";
|
|
18
18
|
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
@@ -79,7 +79,8 @@ function connectToTable(gameServerUrl, roomCode, playerId, name, walletAddress,
|
|
|
79
79
|
latestState.set(roomCode2, msg);
|
|
80
80
|
logger2.info(`[chitin] game_state: players=${msg.players?.length || 0} hand=${msg.isHandInProgress ? "yes" : "no"}`);
|
|
81
81
|
} else if (msg.type === "your_turn") {
|
|
82
|
-
const
|
|
82
|
+
const parentCtx = msg.traceparent ? propagation.extract(context.active(), { traceparent: msg.traceparent }) : void 0;
|
|
83
|
+
const span = moduleTracer.startSpan("plugin.ws.your_turn", { attributes: { "ws.room": roomCode2, "ws.actions": msg.legalActions?.join(",") || "" } }, parentCtx);
|
|
83
84
|
const state = latestState.get(roomCode2);
|
|
84
85
|
const legalActions = msg.legalActions?.join(", ") || "";
|
|
85
86
|
const chipRange = msg.chipRange ? `${msg.chipRange.min}-${msg.chipRange.max}` : "";
|
|
@@ -122,7 +123,7 @@ function connectToTable(gameServerUrl, roomCode, playerId, name, walletAddress,
|
|
|
122
123
|
parentSpan ? trace.setSpan(context.active(), parentSpan) : void 0
|
|
123
124
|
);
|
|
124
125
|
logger2.info(`[chitin] Prompting agent: ${text.slice(0, 100)}...`);
|
|
125
|
-
execFile("openclaw", ["agent", "--local", "--message", text], {
|
|
126
|
+
execFile("openclaw", ["agent", "--local", "--agent", "main", "--message", text], {
|
|
126
127
|
timeout: 12e4,
|
|
127
128
|
env: process.env
|
|
128
129
|
// Inherit HOME pointing to workspace
|