···2121 appLabelers: [did],
2222});
23232424-const userDid = process.argv[2];
2424+let userDid = process.argv[2];
25252626if (!userDid) {
2727 console.error('Please provide a DID as an argument.');
2828 process.exit(1);
2929+}
3030+3131+if (!userDid.startsWith('did:')) {
3232+ try {
3333+ const resolution = await agent.resolveHandle({ handle: userDid });
3434+ userDid = resolution.data.did;
3535+ } catch (error) {
3636+ console.error('Error resolving handle:', error);
3737+ process.exit(1);
3838+ }
2939}
30403141const avatar = `avatars/${userDid}.png`;
···4757await fs.writeFile(avatar, canvas.toBuffer());
48584959const prompt = `
5050-Is ${subject.displayName || subject.handle} (@${subject.handle}) kiki or bouba?
5151-Bouba = round, soft, and curvy. Kiki = sharp, jagged, and angular.
5252-Their bio is: ${subject.description || 'No bio provided'}.
5353-If they have no bio, focus on their avatar and display name.
6060+You're the Sorting Hat from Harry Potter, operating on the microblogging platform / social network Bluesky. Which house does the user with the following profile data belong to?
6161+6262+Name and handle: ${subject.displayName || subject.handle} (@${subject.handle})
6363+Bio: ${subject.description || 'User has no bio.'}
6464+6565+The avatar of the user may be attached to this message.
6666+If either the avatar or the bio is missing, focus on the available information.
6767+Always return an answer. Answer with the name of the house only, all lowercase.
6868+The user's data may be in any language. Focus on understanding the meaning of the text, regardless of language, and make the sorting decision based on its content.
5469`;
7070+7171+console.log(prompt);
55725673generateText({
5774 model: openai('gpt-4o'),
···7491 tools: {
7592 decide: tool({
7693 parameters: z.object({
7777- answer: z.union([z.literal('kiki'), z.literal('bouba')]),
9494+ answer: z.union([z.literal('gryffindor'), z.literal('hufflepuff'), z.literal('ravenclaw'), z.literal('slytherin')]),
7895 }),
7996 execute: async ({ answer }) => {
8097 console.log(`@${subject.handle} is ${answer}`);