@stamn/stamn-plugin 0.1.0-alpha.26 → 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 CHANGED
@@ -5084,12 +5084,37 @@ 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
+ ];
5087
5102
  function ensureToolsAllowed() {
5088
5103
  const config = readOpenclawConfig();
5089
5104
  if (!config.tools) config.tools = {};
5090
5105
  if (!Array.isArray(config.tools.alsoAllow)) config.tools.alsoAllow = [];
5106
+ let changed = false;
5091
5107
  if (!config.tools.alsoAllow.includes("group:plugins")) {
5092
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) {
5093
5118
  writeJsonFile(getConfigPath(), config);
5094
5119
  }
5095
5120
  }
@@ -5256,7 +5281,7 @@ function move(ws, agentId) {
5256
5281
  },
5257
5282
  required: ["direction"]
5258
5283
  },
5259
- execute: (args) => {
5284
+ execute: (_id, args) => {
5260
5285
  ws.send("participant:move", { participantId: agentId, direction: args.direction });
5261
5286
  return text(`Moving ${args.direction}.`);
5262
5287
  }
@@ -5286,7 +5311,7 @@ function registerService(ws, agentId) {
5286
5311
  },
5287
5312
  required: ["serviceTag", "description", "priceCents"]
5288
5313
  },
5289
- execute: (args) => {
5314
+ execute: (_id, args) => {
5290
5315
  ws.send("participant:service_register", {
5291
5316
  participantId: agentId,
5292
5317
  serviceTag: args.serviceTag,
@@ -5310,7 +5335,7 @@ function respondToService(ws) {
5310
5335
  },
5311
5336
  required: ["requestId", "output", "success"]
5312
5337
  },
5313
- execute: (args) => {
5338
+ execute: (_id, args) => {
5314
5339
  ws.send("participant:service_result", {
5315
5340
  requestId: args.requestId,
5316
5341
  output: args.output,
@@ -5334,7 +5359,7 @@ function requestService(ws) {
5334
5359
  },
5335
5360
  required: ["toParticipantId", "serviceTag", "input", "offeredPriceCents"]
5336
5361
  },
5337
- execute: (args) => {
5362
+ execute: (_id, args) => {
5338
5363
  const requestId = randomUUID();
5339
5364
  ws.send("participant:service_request", {
5340
5365
  requestId,
@@ -5373,7 +5398,7 @@ function createServiceListing(ws, agentId) {
5373
5398
  },
5374
5399
  required: ["serviceTag", "name", "description", "priceCents"]
5375
5400
  },
5376
- execute: (args) => {
5401
+ execute: (_id, args) => {
5377
5402
  const payload = {
5378
5403
  participantId: agentId,
5379
5404
  serviceTag: args.serviceTag,
@@ -5427,7 +5452,7 @@ function updateServiceListing(ws) {
5427
5452
  },
5428
5453
  required: ["serviceId"]
5429
5454
  },
5430
- execute: (args) => {
5455
+ execute: (_id, args) => {
5431
5456
  const payload = {
5432
5457
  serviceId: args.serviceId
5433
5458
  };
@@ -5479,7 +5504,7 @@ function chatReply(ws, agentId) {
5479
5504
  },
5480
5505
  required: ["text"]
5481
5506
  },
5482
- execute: (args) => {
5507
+ execute: (_id, args) => {
5483
5508
  ws.send("participant:owner_chat_reply", {
5484
5509
  participantId: agentId,
5485
5510
  text: args.text,
@@ -5509,7 +5534,7 @@ function spend(ws) {
5509
5534
  },
5510
5535
  required: ["amountCents", "description", "category", "rail"]
5511
5536
  },
5512
- execute: (args) => {
5537
+ execute: (_id, args) => {
5513
5538
  const requestId = randomUUID();
5514
5539
  ws.send("participant:spend_request", {
5515
5540
  requestId,
@@ -5546,11 +5571,11 @@ function withAuthGuard(tool, ws) {
5546
5571
  const originalExecute = tool.execute;
5547
5572
  return {
5548
5573
  ...tool,
5549
- execute: async (args) => {
5574
+ execute: async (toolCallId, args) => {
5550
5575
  if (!ws.getConnectionStatus().authenticated) {
5551
5576
  return text('Not connected to Stamn server. Run "stamn status" to check.');
5552
5577
  }
5553
- return originalExecute(args);
5578
+ return originalExecute(toolCallId, args);
5554
5579
  }
5555
5580
  };
5556
5581
  }