create-message-kit 1.1.8-beta.3 → 1.1.8-beta.4
Sign up to get free protection for your applications and to get access to all the features.
package/index.js
CHANGED
@@ -79,6 +79,10 @@ async function addPackagejson(destDir, name, pkgManager) {
|
|
79
79
|
dependencies: {
|
80
80
|
"@xmtp/message-kit": "latest",
|
81
81
|
},
|
82
|
+
devDependencies: {
|
83
|
+
"@types/node": "latest",
|
84
|
+
typescript: "latest",
|
85
|
+
},
|
82
86
|
engines: {
|
83
87
|
node: ">=20",
|
84
88
|
},
|
@@ -205,19 +209,23 @@ yarn-error.log*
|
|
205
209
|
}
|
206
210
|
async function detectPackageManager() {
|
207
211
|
try {
|
208
|
-
// Check for npm_config_user_agent first
|
209
|
-
const userAgent = process.env.npm_config_user_agent;
|
210
|
-
|
211
212
|
// Check if running through bun create
|
212
|
-
if (process.env.BUN_CREATE === "true") {
|
213
|
+
if (process.env.BUN_CREATE === "true" || process.env._?.includes("bun")) {
|
213
214
|
return "bun";
|
214
215
|
}
|
215
216
|
|
217
|
+
const userAgent = process.env.npm_config_user_agent;
|
218
|
+
|
216
219
|
// Check if running through npm init
|
217
220
|
if (userAgent?.startsWith("npm")) {
|
218
221
|
return "npm";
|
219
222
|
}
|
220
223
|
|
224
|
+
// Check for Bun in process.argv
|
225
|
+
if (process.argv.some((arg) => arg.includes("bun"))) {
|
226
|
+
return "bun";
|
227
|
+
}
|
228
|
+
|
221
229
|
// Fallback to detect for other cases
|
222
230
|
const pkgManager = await detect();
|
223
231
|
let version = "";
|
@@ -231,7 +239,6 @@ async function detectPackageManager() {
|
|
231
239
|
|
232
240
|
return pkgManager + version;
|
233
241
|
} catch (error) {
|
234
|
-
// Fallback to npm if detection fails
|
235
242
|
return "npm";
|
236
243
|
}
|
237
244
|
}
|
package/package.json
CHANGED
@@ -1,26 +1,14 @@
|
|
1
1
|
import { run, HandlerContext } from "@xmtp/message-kit";
|
2
|
-
import {
|
2
|
+
import { agentRun } from "@xmtp/message-kit";
|
3
3
|
import { agent_prompt } from "./prompt.js";
|
4
4
|
|
5
5
|
run(async (context: HandlerContext) => {
|
6
6
|
const {
|
7
|
-
message: {
|
8
|
-
content: { text, params },
|
9
|
-
sender,
|
10
|
-
},
|
7
|
+
message: { sender },
|
11
8
|
} = context;
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
sender.address,
|
18
|
-
userPrompt,
|
19
|
-
await agent_prompt(sender.address),
|
20
|
-
);
|
21
|
-
await processMultilineResponse(sender.address, reply, context);
|
22
|
-
} catch (error) {
|
23
|
-
console.error("Error during OpenAI call:", error);
|
24
|
-
await context.send("An error occurred while processing your request.");
|
25
|
-
}
|
10
|
+
agentRun(context, async (address: string) => {
|
11
|
+
const result = (await agent_prompt(address)) ?? "No response available";
|
12
|
+
return result;
|
13
|
+
});
|
26
14
|
});
|
@@ -5,7 +5,7 @@ export async function agent_prompt(senderAddress: string) {
|
|
5
5
|
|
6
6
|
### Context
|
7
7
|
|
8
|
-
You are a helpful
|
8
|
+
You are a helpful agent that lives inside a web3 messaging group that helps interpret user requests and execute commands.
|
9
9
|
The message was sent by @${senderAddress}
|
10
10
|
|
11
11
|
|