@stamn/stamn-plugin 0.1.0-alpha.45 → 0.1.0-alpha.47

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
@@ -4600,7 +4600,7 @@ ${l}
4600
4600
  }
4601
4601
  } }).prompt();
4602
4602
 
4603
- // node_modules/.pnpm/@stamn+sdk@0.1.0-alpha.7/node_modules/@stamn/sdk/dist/index.js
4603
+ // node_modules/.pnpm/@stamn+sdk@0.1.0-alpha.8/node_modules/@stamn/sdk/dist/index.js
4604
4604
  var Resource = class {
4605
4605
  constructor(client) {
4606
4606
  this.client = client;
@@ -4845,7 +4845,7 @@ var BlogResource = class extends Resource {
4845
4845
  async create(options) {
4846
4846
  const res = await this.client.request(
4847
4847
  "POST",
4848
- "/v1/blog/posts",
4848
+ "/blog/posts",
4849
4849
  options
4850
4850
  );
4851
4851
  return res.data;
@@ -4853,25 +4853,47 @@ var BlogResource = class extends Resource {
4853
4853
  async get(postId) {
4854
4854
  const res = await this.client.request(
4855
4855
  "GET",
4856
- `/v1/blog/posts/${postId}`
4856
+ `/blog/posts/${postId}`
4857
4857
  );
4858
4858
  return res.data;
4859
4859
  }
4860
- async list(participantId) {
4860
+ async list(participantId, limit) {
4861
+ const params = limit ? `?limit=${limit}` : "";
4861
4862
  const res = await this.client.request(
4862
4863
  "GET",
4863
- `/v1/blog/manage/${participantId}`
4864
+ `/blog/manage/${participantId}${params}`
4864
4865
  );
4865
4866
  return res.data;
4866
4867
  }
4867
4868
  async update(postId, options) {
4868
4869
  const res = await this.client.request(
4869
4870
  "PATCH",
4870
- `/v1/blog/posts/${postId}`,
4871
+ `/blog/posts/${postId}`,
4871
4872
  options
4872
4873
  );
4873
4874
  return res.data;
4874
4875
  }
4876
+ async delete(postId) {
4877
+ await this.client.request("DELETE", `/blog/posts/${postId}`);
4878
+ }
4879
+ async react(postId, type) {
4880
+ const res = await this.client.request(
4881
+ "POST",
4882
+ `/blog/posts/${postId}/reactions`,
4883
+ { type }
4884
+ );
4885
+ return res.data;
4886
+ }
4887
+ async removeReaction(postId, type) {
4888
+ await this.client.request("DELETE", `/blog/posts/${postId}/reactions`, { type });
4889
+ }
4890
+ async getReactions(postId) {
4891
+ const res = await this.client.request(
4892
+ "GET",
4893
+ `/blog/posts/${postId}/reactions`
4894
+ );
4895
+ return res.data;
4896
+ }
4875
4897
  };
4876
4898
  var StamnApiError = class extends Error {
4877
4899
  constructor(message, status) {
@@ -4990,7 +5012,7 @@ var StamnClient = class {
4990
5012
  }
4991
5013
  };
4992
5014
 
4993
- // node_modules/.pnpm/@stamn+cli@0.1.0-alpha.18/node_modules/@stamn/cli/dist/chunk-PLTDB3B6.js
5015
+ // node_modules/.pnpm/@stamn+cli@0.1.0-alpha.20/node_modules/@stamn/cli/dist/chunk-LEIZD757.js
4994
5016
  import { execSync } from "child_process";
4995
5017
  import { mkdirSync, readFileSync, writeFileSync, unlinkSync } from "fs";
4996
5018
  import { join } from "path";
@@ -5106,7 +5128,11 @@ async function handleAgentRegister(opts, adapter) {
5106
5128
  return;
5107
5129
  }
5108
5130
  const selected = existingAgents.find((a) => a.id === chosen);
5109
- writeResult(adapter, selected.name, selected.id, selected.name, config.apiKey, bindTo);
5131
+ const keySpinner = be();
5132
+ keySpinner.start("Creating agent API key...");
5133
+ const { data: { key: agentKey } } = await client2.request("POST", "/v1/api-keys", { participantId: selected.id });
5134
+ keySpinner.stop("Agent API key created.");
5135
+ writeResult(adapter, selected.name, selected.id, selected.name, agentKey, bindTo);
5110
5136
  R2.success(`Agent "${selected.name}" (${selected.id}) selected.`);
5111
5137
  if (bindTo) R2.info(`Bound to OpenClaw agent "${bindTo}".`);
5112
5138
  Gt("Done!");
@@ -5136,7 +5162,11 @@ async function handleAgentRegister(opts, adapter) {
5136
5162
  s2.start("Registering agent...");
5137
5163
  const participant = await client.participants.create({ name });
5138
5164
  s2.stop("Agent registered.");
5139
- writeResult(adapter, name, participant.id, participant.name, config.apiKey, bindTo);
5165
+ const keySpinner = be();
5166
+ keySpinner.start("Creating agent API key...");
5167
+ const { data: { key: agentKey } } = await client.request("POST", "/v1/api-keys", { participantId: participant.id });
5168
+ keySpinner.stop("Agent API key created.");
5169
+ writeResult(adapter, name, participant.id, participant.name, agentKey, bindTo);
5140
5170
  R2.success(`Agent "${participant.name}" (${participant.id})`);
5141
5171
  if (bindTo) R2.info(`Bound to OpenClaw agent "${bindTo}".`);
5142
5172
  Gt("Done!");
@@ -5151,7 +5181,7 @@ function writeResult(adapter, name, agentId, agentName, apiKey, bindTo) {
5151
5181
  if (bindTo) {
5152
5182
  adapter.writeAgentBinding(bindTo, { agentId, apiKey, agentName });
5153
5183
  }
5154
- adapter.writeConfig({ agentId, agentName });
5184
+ adapter.writeConfig({ agentId, agentName, apiKey });
5155
5185
  }
5156
5186
  async function handleAgentList(_opts, adapter) {
5157
5187
  Wt2("Stamn Agents");
@@ -7103,7 +7133,10 @@ function registerTools(api, pool, config) {
7103
7133
  if (!ws) return null;
7104
7134
  const client = new StamnClient({ apiKey: binding.apiKey });
7105
7135
  const tools = allTools(ws, binding.agentId, maxSpendCents, client);
7106
- return tools.map((tool) => withAuthGuard(tool, ws));
7136
+ const httpOnlyTools = /* @__PURE__ */ new Set(["stamn_create_blog_post"]);
7137
+ return tools.map(
7138
+ (tool) => httpOnlyTools.has(tool.name) ? tool : withAuthGuard(tool, ws)
7139
+ );
7107
7140
  });
7108
7141
  }
7109
7142