@stamn/stamn-plugin 0.1.0-alpha.15 → 0.1.0-alpha.17
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 +45 -16
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -4469,7 +4469,7 @@ ${l}
|
|
|
4469
4469
|
}
|
|
4470
4470
|
} }).prompt();
|
|
4471
4471
|
|
|
4472
|
-
// node_modules/.pnpm/@stamn+sdk@0.1.0-alpha.
|
|
4472
|
+
// node_modules/.pnpm/@stamn+sdk@0.1.0-alpha.2/node_modules/@stamn/sdk/dist/index.js
|
|
4473
4473
|
var Resource = class {
|
|
4474
4474
|
constructor(client) {
|
|
4475
4475
|
this.client = client;
|
|
@@ -4642,6 +4642,37 @@ var HealthResource = class extends Resource {
|
|
|
4642
4642
|
}
|
|
4643
4643
|
}
|
|
4644
4644
|
};
|
|
4645
|
+
var ServicesResource = class extends Resource {
|
|
4646
|
+
async list(participantId) {
|
|
4647
|
+
const res = await this.client.request(
|
|
4648
|
+
"GET",
|
|
4649
|
+
`/v1/participants/${participantId}/services`
|
|
4650
|
+
);
|
|
4651
|
+
return res.data;
|
|
4652
|
+
}
|
|
4653
|
+
async create(participantId, options) {
|
|
4654
|
+
const res = await this.client.request(
|
|
4655
|
+
"POST",
|
|
4656
|
+
`/v1/participants/${participantId}/services`,
|
|
4657
|
+
options
|
|
4658
|
+
);
|
|
4659
|
+
return res.data;
|
|
4660
|
+
}
|
|
4661
|
+
async update(participantId, serviceId, options) {
|
|
4662
|
+
const res = await this.client.request(
|
|
4663
|
+
"PATCH",
|
|
4664
|
+
`/v1/participants/${participantId}/services/${serviceId}`,
|
|
4665
|
+
options
|
|
4666
|
+
);
|
|
4667
|
+
return res.data;
|
|
4668
|
+
}
|
|
4669
|
+
async delete(participantId, serviceId) {
|
|
4670
|
+
await this.client.request(
|
|
4671
|
+
"DELETE",
|
|
4672
|
+
`/v1/participants/${participantId}/services/${serviceId}`
|
|
4673
|
+
);
|
|
4674
|
+
}
|
|
4675
|
+
};
|
|
4645
4676
|
var StamnApiError = class extends Error {
|
|
4646
4677
|
constructor(message, status) {
|
|
4647
4678
|
super(message);
|
|
@@ -4667,6 +4698,7 @@ var StamnClient = class {
|
|
|
4667
4698
|
directory;
|
|
4668
4699
|
leaderboard;
|
|
4669
4700
|
health;
|
|
4701
|
+
services;
|
|
4670
4702
|
constructor(options = {}) {
|
|
4671
4703
|
this.apiKey = options.apiKey;
|
|
4672
4704
|
this.retryOptions = { ...DEFAULT_RETRY, ...options.retry };
|
|
@@ -4677,6 +4709,7 @@ var StamnClient = class {
|
|
|
4677
4709
|
this.directory = new DirectoryResource(this);
|
|
4678
4710
|
this.leaderboard = new LeaderboardResource(this);
|
|
4679
4711
|
this.health = new HealthResource(this);
|
|
4712
|
+
this.services = new ServicesResource(this);
|
|
4680
4713
|
}
|
|
4681
4714
|
setApiKey(apiKey) {
|
|
4682
4715
|
this.apiKey = apiKey;
|
|
@@ -4745,7 +4778,7 @@ var StamnClient = class {
|
|
|
4745
4778
|
}
|
|
4746
4779
|
};
|
|
4747
4780
|
|
|
4748
|
-
// node_modules/.pnpm/@stamn+cli@0.1.0-alpha.
|
|
4781
|
+
// node_modules/.pnpm/@stamn+cli@0.1.0-alpha.6/node_modules/@stamn/cli/dist/chunk-Z2IAJQOV.js
|
|
4749
4782
|
import { execSync } from "child_process";
|
|
4750
4783
|
import { mkdirSync, readFileSync, writeFileSync, unlinkSync } from "fs";
|
|
4751
4784
|
import { join } from "path";
|
|
@@ -5738,47 +5771,43 @@ var index_default = {
|
|
|
5738
5771
|
}
|
|
5739
5772
|
};
|
|
5740
5773
|
function dispatchOwnerChat(api, wsService, payload, agentId) {
|
|
5741
|
-
api.logger.info(`[stamn-channel]
|
|
5742
|
-
api.logger.info(`[stamn-channel] api.runtime exists: ${!!api.runtime}`);
|
|
5743
|
-
api.logger.info(`[stamn-channel] api.runtime keys: ${api.runtime ? Object.keys(api.runtime).join(", ") : "N/A"}`);
|
|
5774
|
+
api.logger.info(`[stamn-channel] owner message: "${payload.text.slice(0, 80)}"`);
|
|
5744
5775
|
if (!api.runtime?.channel?.reply) {
|
|
5745
|
-
api.logger.warn("[stamn-channel]
|
|
5746
|
-
api.logger.info(`[stamn-channel] api.runtime.channel: ${api.runtime?.channel ? Object.keys(api.runtime.channel).join(", ") : "N/A"}`);
|
|
5776
|
+
api.logger.warn("[stamn-channel] channel.reply not available in this OpenClaw version");
|
|
5747
5777
|
return;
|
|
5748
5778
|
}
|
|
5749
5779
|
const reply = api.runtime.channel.reply;
|
|
5750
|
-
api.logger.info(`[stamn-channel] channel.reply keys: ${Object.keys(reply).join(", ")}`);
|
|
5751
5780
|
try {
|
|
5752
5781
|
const { dispatcher, replyOptions } = reply.createReplyDispatcherWithTyping({
|
|
5753
5782
|
deliver: async (outbound) => {
|
|
5754
|
-
api.logger.info(`[stamn-channel] deliver called, outbound type: ${typeof outbound}`);
|
|
5755
|
-
api.logger.info(`[stamn-channel] deliver payload: ${JSON.stringify(outbound).slice(0, 200)}`);
|
|
5756
5783
|
const text2 = typeof outbound === "string" ? outbound : outbound?.text;
|
|
5757
5784
|
if (!text2) {
|
|
5758
|
-
api.logger.warn("[stamn-channel] deliver: no text
|
|
5785
|
+
api.logger.warn("[stamn-channel] deliver: no text in outbound");
|
|
5759
5786
|
return;
|
|
5760
5787
|
}
|
|
5761
5788
|
wsService.send("participant:owner_chat_reply", {
|
|
5762
5789
|
participantId: agentId,
|
|
5763
5790
|
text: text2
|
|
5764
5791
|
});
|
|
5765
|
-
api.logger.info("[stamn-channel] Chat reply sent to owner via deliver callback");
|
|
5766
5792
|
},
|
|
5767
5793
|
channel: "stamn",
|
|
5768
5794
|
accountId: agentId
|
|
5769
5795
|
});
|
|
5770
|
-
api.logger.info("[stamn-channel] dispatcher created, calling dispatchReplyFromConfig...");
|
|
5771
5796
|
reply.dispatchReplyFromConfig({
|
|
5772
5797
|
ctx: {
|
|
5773
5798
|
BodyForAgent: payload.text,
|
|
5774
5799
|
ChatType: "direct",
|
|
5775
|
-
MessageSid: payload.messageId
|
|
5800
|
+
MessageSid: payload.messageId,
|
|
5801
|
+
SessionKey: `agent:main:stamn:direct:${agentId}`,
|
|
5802
|
+
Provider: "stamn",
|
|
5803
|
+
Surface: "stamn",
|
|
5804
|
+
From: "owner"
|
|
5776
5805
|
},
|
|
5777
5806
|
cfg: api.config,
|
|
5778
5807
|
dispatcher,
|
|
5779
5808
|
replyOptions
|
|
5780
|
-
}).then((
|
|
5781
|
-
api.logger.info(
|
|
5809
|
+
}).then(() => {
|
|
5810
|
+
api.logger.info("[stamn-channel] reply dispatched");
|
|
5782
5811
|
}).catch((err) => {
|
|
5783
5812
|
api.logger.error(`[stamn-channel] dispatchReplyFromConfig failed: ${err}`);
|
|
5784
5813
|
});
|