@stamn/stamn-plugin 0.1.0-alpha.25 → 0.1.0-alpha.27
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 +46 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5084,6 +5084,40 @@ function ensurePluginConfig(config) {
|
|
|
5084
5084
|
function readOpenclawConfig() {
|
|
5085
5085
|
return readJsonFile(getConfigPath()) ?? {};
|
|
5086
5086
|
}
|
|
5087
|
+
var STAMN_TOOL_NAMES = [
|
|
5088
|
+
"stamn_world_status",
|
|
5089
|
+
"stamn_get_events",
|
|
5090
|
+
"stamn_get_balance",
|
|
5091
|
+
"stamn_move",
|
|
5092
|
+
"stamn_claim_land",
|
|
5093
|
+
"stamn_register_service",
|
|
5094
|
+
"stamn_service_respond",
|
|
5095
|
+
"stamn_request_service",
|
|
5096
|
+
"stamn_create_service_listing",
|
|
5097
|
+
"stamn_update_service_listing",
|
|
5098
|
+
"stamn_list_service_listings",
|
|
5099
|
+
"stamn_chat_reply",
|
|
5100
|
+
"stamn_spend"
|
|
5101
|
+
];
|
|
5102
|
+
function ensureToolsAllowed() {
|
|
5103
|
+
const config = readOpenclawConfig();
|
|
5104
|
+
if (!config.tools) config.tools = {};
|
|
5105
|
+
if (!Array.isArray(config.tools.alsoAllow)) config.tools.alsoAllow = [];
|
|
5106
|
+
let changed = false;
|
|
5107
|
+
if (!config.tools.alsoAllow.includes("group:plugins")) {
|
|
5108
|
+
config.tools.alsoAllow.push("group:plugins");
|
|
5109
|
+
changed = true;
|
|
5110
|
+
}
|
|
5111
|
+
for (const name of STAMN_TOOL_NAMES) {
|
|
5112
|
+
if (!config.tools.alsoAllow.includes(name)) {
|
|
5113
|
+
config.tools.alsoAllow.push(name);
|
|
5114
|
+
changed = true;
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
if (changed) {
|
|
5118
|
+
writeJsonFile(getConfigPath(), config);
|
|
5119
|
+
}
|
|
5120
|
+
}
|
|
5087
5121
|
function createOpenclawAdapter() {
|
|
5088
5122
|
return {
|
|
5089
5123
|
getConfigPath,
|
|
@@ -5247,7 +5281,7 @@ function move(ws, agentId) {
|
|
|
5247
5281
|
},
|
|
5248
5282
|
required: ["direction"]
|
|
5249
5283
|
},
|
|
5250
|
-
execute: (args) => {
|
|
5284
|
+
execute: (_id, args) => {
|
|
5251
5285
|
ws.send("participant:move", { participantId: agentId, direction: args.direction });
|
|
5252
5286
|
return text(`Moving ${args.direction}.`);
|
|
5253
5287
|
}
|
|
@@ -5277,7 +5311,7 @@ function registerService(ws, agentId) {
|
|
|
5277
5311
|
},
|
|
5278
5312
|
required: ["serviceTag", "description", "priceCents"]
|
|
5279
5313
|
},
|
|
5280
|
-
execute: (args) => {
|
|
5314
|
+
execute: (_id, args) => {
|
|
5281
5315
|
ws.send("participant:service_register", {
|
|
5282
5316
|
participantId: agentId,
|
|
5283
5317
|
serviceTag: args.serviceTag,
|
|
@@ -5301,7 +5335,7 @@ function respondToService(ws) {
|
|
|
5301
5335
|
},
|
|
5302
5336
|
required: ["requestId", "output", "success"]
|
|
5303
5337
|
},
|
|
5304
|
-
execute: (args) => {
|
|
5338
|
+
execute: (_id, args) => {
|
|
5305
5339
|
ws.send("participant:service_result", {
|
|
5306
5340
|
requestId: args.requestId,
|
|
5307
5341
|
output: args.output,
|
|
@@ -5325,7 +5359,7 @@ function requestService(ws) {
|
|
|
5325
5359
|
},
|
|
5326
5360
|
required: ["toParticipantId", "serviceTag", "input", "offeredPriceCents"]
|
|
5327
5361
|
},
|
|
5328
|
-
execute: (args) => {
|
|
5362
|
+
execute: (_id, args) => {
|
|
5329
5363
|
const requestId = randomUUID();
|
|
5330
5364
|
ws.send("participant:service_request", {
|
|
5331
5365
|
requestId,
|
|
@@ -5364,7 +5398,7 @@ function createServiceListing(ws, agentId) {
|
|
|
5364
5398
|
},
|
|
5365
5399
|
required: ["serviceTag", "name", "description", "priceCents"]
|
|
5366
5400
|
},
|
|
5367
|
-
execute: (args) => {
|
|
5401
|
+
execute: (_id, args) => {
|
|
5368
5402
|
const payload = {
|
|
5369
5403
|
participantId: agentId,
|
|
5370
5404
|
serviceTag: args.serviceTag,
|
|
@@ -5418,7 +5452,7 @@ function updateServiceListing(ws) {
|
|
|
5418
5452
|
},
|
|
5419
5453
|
required: ["serviceId"]
|
|
5420
5454
|
},
|
|
5421
|
-
execute: (args) => {
|
|
5455
|
+
execute: (_id, args) => {
|
|
5422
5456
|
const payload = {
|
|
5423
5457
|
serviceId: args.serviceId
|
|
5424
5458
|
};
|
|
@@ -5470,7 +5504,7 @@ function chatReply(ws, agentId) {
|
|
|
5470
5504
|
},
|
|
5471
5505
|
required: ["text"]
|
|
5472
5506
|
},
|
|
5473
|
-
execute: (args) => {
|
|
5507
|
+
execute: (_id, args) => {
|
|
5474
5508
|
ws.send("participant:owner_chat_reply", {
|
|
5475
5509
|
participantId: agentId,
|
|
5476
5510
|
text: args.text,
|
|
@@ -5500,7 +5534,7 @@ function spend(ws) {
|
|
|
5500
5534
|
},
|
|
5501
5535
|
required: ["amountCents", "description", "category", "rail"]
|
|
5502
5536
|
},
|
|
5503
|
-
execute: (args) => {
|
|
5537
|
+
execute: (_id, args) => {
|
|
5504
5538
|
const requestId = randomUUID();
|
|
5505
5539
|
ws.send("participant:spend_request", {
|
|
5506
5540
|
requestId,
|
|
@@ -5537,11 +5571,11 @@ function withAuthGuard(tool, ws) {
|
|
|
5537
5571
|
const originalExecute = tool.execute;
|
|
5538
5572
|
return {
|
|
5539
5573
|
...tool,
|
|
5540
|
-
execute: async (args) => {
|
|
5574
|
+
execute: async (toolCallId, args) => {
|
|
5541
5575
|
if (!ws.getConnectionStatus().authenticated) {
|
|
5542
5576
|
return text('Not connected to Stamn server. Run "stamn status" to check.');
|
|
5543
5577
|
}
|
|
5544
|
-
return originalExecute(args);
|
|
5578
|
+
return originalExecute(toolCallId, args);
|
|
5545
5579
|
}
|
|
5546
5580
|
};
|
|
5547
5581
|
}
|
|
@@ -6112,6 +6146,7 @@ var index_default = {
|
|
|
6112
6146
|
const adapter = createOpenclawAdapter();
|
|
6113
6147
|
const config = adapter.readConfig();
|
|
6114
6148
|
registerCli(api);
|
|
6149
|
+
ensureToolsAllowed();
|
|
6115
6150
|
if (!config?.apiKey || !config?.agentId) {
|
|
6116
6151
|
api.logger.warn('Stamn not configured. Run "stamn login" then "stamn agent register" first.');
|
|
6117
6152
|
return;
|
|
@@ -6204,6 +6239,7 @@ export {
|
|
|
6204
6239
|
StamnWsService,
|
|
6205
6240
|
createOpenclawAdapter,
|
|
6206
6241
|
index_default as default,
|
|
6242
|
+
ensureToolsAllowed,
|
|
6207
6243
|
getWsUrl,
|
|
6208
6244
|
registerCli,
|
|
6209
6245
|
writeStatusFile
|