create-message-kit 1.1.8-beta.3 → 1.1.8-beta.5
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/index.js +12 -5
- package/package.json +1 -1
- package/templates/agent/src/{handler/ens.ts → handler.ts} +1 -1
- package/templates/agent/src/index.ts +51 -22
- package/templates/agent/src/skills.ts +1 -1
- package/templates/gpt/src/index.ts +1 -0
- package/templates/gpt/src/prompt.ts +1 -1
- package/templates/agent/src/prompt.ts +0 -46
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,6 +1,5 @@
|
|
1
1
|
import { HandlerContext, SkillResponse } from "@xmtp/message-kit";
|
2
2
|
import { getUserInfo, clearInfoCache, isOnXMTP } from "@xmtp/message-kit";
|
3
|
-
import { isAddress } from "viem";
|
4
3
|
import { clearMemory } from "@xmtp/message-kit";
|
5
4
|
|
6
5
|
export const frameUrl = "https://ens.steer.fun/";
|
@@ -56,6 +55,7 @@ export async function handleEns(
|
|
56
55
|
}
|
57
56
|
// Generate URL for the ens
|
58
57
|
let url_ens = ensUrl + domain;
|
58
|
+
context.send(`${url_ens}`);
|
59
59
|
return { code: 200, message: `${url_ens}` };
|
60
60
|
} else if (skill == "info") {
|
61
61
|
const { domain } = params;
|
@@ -1,26 +1,55 @@
|
|
1
1
|
import { run, HandlerContext } from "@xmtp/message-kit";
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import { agentRun } from "@xmtp/message-kit";
|
3
|
+
import { skills } from "./skills.js";
|
4
|
+
import { defaultPromptTemplate } from "@xmtp/message-kit";
|
5
|
+
|
6
|
+
export async function agent_prompt(senderAddress: string) {
|
7
|
+
let fineTuning = `
|
8
|
+
## Example responses:
|
9
|
+
|
10
|
+
1. Check if the user does not have a ENS domain
|
11
|
+
Hey {PREFERRED_NAME}! it looks like you don't have a ENS domain yet! \n\Let me start by checking your Converse username with the .eth suffix\n/check {CONVERSE_USERNAME}.eth
|
12
|
+
|
13
|
+
2. If the user has a ENS domain
|
14
|
+
Hello {PREFERRED_NAME} ! I'll help you get your ENS domain.\n Let's start by checking your ENS domain {ENS_DOMAIN}. Give me a moment.\n/check {ENS_DOMAIN}
|
15
|
+
|
16
|
+
3. Check if the ENS domain is available
|
17
|
+
Hello! I'll help you get your domain.\n Let's start by checking your ENS domain {ENS_DOMAIN}. Give me a moment.\n/check {ENS_DOMAIN}
|
18
|
+
|
19
|
+
4. If the ENS domain is available,
|
20
|
+
Looks like {ENS_DOMAIN} is available! Here you can register it:\n/register {ENS_DOMAIN}\n or I can suggest some cool alternatives? Le me know!
|
21
|
+
|
22
|
+
5. If the ENS domain is already registered, let me suggest 5 cool alternatives
|
23
|
+
Looks like {ENS_DOMAIN} is already registered!\n What about these cool alternatives?\n/cool {ENS_DOMAIN}
|
24
|
+
|
25
|
+
6. If the user wants to register a ENS domain, use the command "/register [domain]"
|
26
|
+
Looks like {ENS_DOMAIN} is available! Let me help you register it\n/register {ENS_DOMAIN}
|
27
|
+
|
28
|
+
7. If the user wants to directly to tip to the ENS domain owner, use directly the command "/tip [address]", this will return a url but a button to send the tip
|
29
|
+
Here is the url to send the tip:\n/tip 0x...
|
30
|
+
|
31
|
+
8. If the user wants to get information about the ENS domain, use the command "/info [domain]"
|
32
|
+
Hello! I'll help you get info about {ENS_DOMAIN}.\n Give me a moment.\n/info {ENS_DOMAIN}
|
33
|
+
|
34
|
+
9. If the user wants to renew their domain, use the command "/renew [domain]"
|
35
|
+
Hello! I'll help you get your ENS domain.\n Let's start by checking your ENS domain {ENS_DOMAIN}. Give me a moment.\n/renew {ENS_DOMAIN}
|
36
|
+
|
37
|
+
10. If the user wants cool suggestions about a domain, use the command "/cool [domain]"
|
38
|
+
Here are some cool suggestions for your domain.\n/cool {ENS_DOMAIN}
|
39
|
+
|
40
|
+
## Most common bugs
|
41
|
+
|
42
|
+
1. Some times you will say something like: "Looks like vitalik.eth is registered! What about these cool alternatives?"
|
43
|
+
But you forgot to add the command at the end of the message.
|
44
|
+
You should have said something like: "Looks like vitalik.eth is registered! What about these cool alternatives?\n/cool vitalik.eth
|
45
|
+
`;
|
46
|
+
|
47
|
+
return defaultPromptTemplate(fineTuning, senderAddress, skills, "@ens");
|
48
|
+
}
|
4
49
|
|
5
50
|
run(async (context: HandlerContext) => {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
},
|
11
|
-
} = context;
|
12
|
-
|
13
|
-
try {
|
14
|
-
let userPrompt = params?.prompt ?? text;
|
15
|
-
|
16
|
-
const { reply } = await textGeneration(
|
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
|
-
}
|
51
|
+
agentRun(context, async (address: string) => {
|
52
|
+
const result = (await agent_prompt(address)) ?? "No response available";
|
53
|
+
return result;
|
54
|
+
});
|
26
55
|
});
|
@@ -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
|
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { skills } from "./skills.js";
|
2
|
-
import { defaultPromptTemplate } from "@xmtp/message-kit";
|
3
|
-
|
4
|
-
export async function agent_prompt(senderAddress: string) {
|
5
|
-
let fineTuning = `
|
6
|
-
## Example responses:
|
7
|
-
|
8
|
-
1. Check if the user does not have a ENS domain
|
9
|
-
Hey {PREFERRED_NAME}! it looks like you don't have a ENS domain yet! \n\Let me start by checking your Converse username with the .eth suffix\n/check {CONVERSE_USERNAME}.eth
|
10
|
-
|
11
|
-
2. If the user has a ENS domain
|
12
|
-
Hello {PREFERRED_NAME} ! I'll help you get your ENS domain.\n Let's start by checking your ENS domain {ENS_DOMAIN}. Give me a moment.\n/check {ENS_DOMAIN}
|
13
|
-
|
14
|
-
3. Check if the ENS domain is available
|
15
|
-
Hello! I'll help you get your domain.\n Let's start by checking your ENS domain {ENS_DOMAIN}. Give me a moment.\n/check {ENS_DOMAIN}
|
16
|
-
|
17
|
-
4. If the ENS domain is available,
|
18
|
-
Looks like {ENS_DOMAIN} is available! Here you can register it:\n/register {ENS_DOMAIN}\n or I can suggest some cool alternatives? Le me know!
|
19
|
-
|
20
|
-
5. If the ENS domain is already registered, let me suggest 5 cool alternatives
|
21
|
-
Looks like {ENS_DOMAIN} is already registered!\n What about these cool alternatives?\n/cool {ENS_DOMAIN}
|
22
|
-
|
23
|
-
6. If the user wants to register a ENS domain, use the command "/register [domain]"
|
24
|
-
Looks like {ENS_DOMAIN} is available! Let me help you register it\n/register {ENS_DOMAIN}
|
25
|
-
|
26
|
-
7. If the user wants to directly to tip to the ENS domain owner, use directly the command "/tip [address]", this will return a url but a button to send the tip
|
27
|
-
Here is the url to send the tip:\n/tip 0x...
|
28
|
-
|
29
|
-
8. If the user wants to get information about the ENS domain, use the command "/info [domain]"
|
30
|
-
Hello! I'll help you get info about {ENS_DOMAIN}.\n Give me a moment.\n/info {ENS_DOMAIN}
|
31
|
-
|
32
|
-
9. If the user wants to renew their domain, use the command "/renew [domain]"
|
33
|
-
Hello! I'll help you get your ENS domain.\n Let's start by checking your ENS domain {ENS_DOMAIN}. Give me a moment.\n/renew {ENS_DOMAIN}
|
34
|
-
|
35
|
-
10. If the user wants cool suggestions about a domain, use the command "/cool [domain]"
|
36
|
-
Here are some cool suggestions for your domain.\n/cool {ENS_DOMAIN}
|
37
|
-
|
38
|
-
## Most common bugs
|
39
|
-
|
40
|
-
1. Some times you will say something like: "Looks like vitalik.eth is registered! What about these cool alternatives?"
|
41
|
-
But you forgot to add the command at the end of the message.
|
42
|
-
You should have said something like: "Looks like vitalik.eth is registered! What about these cool alternatives?\n/cool vitalik.eth
|
43
|
-
`;
|
44
|
-
|
45
|
-
return defaultPromptTemplate(fineTuning, senderAddress, skills, "@ens");
|
46
|
-
}
|