twindex-openclaw-plugin 0.7.2 → 0.7.3
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/package.json +1 -1
- package/skills/twindex/SKILL.md +1 -0
- package/src/client.ts +7 -2
- package/src/index.ts +4 -4
- package/src/poll-service.ts +3 -0
package/package.json
CHANGED
package/skills/twindex/SKILL.md
CHANGED
|
@@ -50,6 +50,7 @@ This is the killer feature. Users can see themselves wearing merch.
|
|
|
50
50
|
|
|
51
51
|
**After a merch notification:**
|
|
52
52
|
- If you showed a product and the user says "try that on" or "let me see it on me", you ALREADY KNOW the product name from the notification you just delivered. Use it directly.
|
|
53
|
+
- If the user says "try that on" after a merch notification, just call `twindex_try_on` with only the artist slug — no product name needed. The server remembers which product was shown.
|
|
53
54
|
- Do NOT browse the store or ask for clarification. Just call the tool.
|
|
54
55
|
|
|
55
56
|
If try-on returns a 404 (no photo), ask the user to send a selfie first.
|
package/src/client.ts
CHANGED
|
@@ -22,6 +22,7 @@ interface Notification {
|
|
|
22
22
|
twindex_url?: string;
|
|
23
23
|
detail_url?: string;
|
|
24
24
|
media_url?: string;
|
|
25
|
+
product_title?: string;
|
|
25
26
|
created_at: string;
|
|
26
27
|
read_at?: string | null;
|
|
27
28
|
}
|
|
@@ -212,11 +213,15 @@ export async function uploadPhotoFile(
|
|
|
212
213
|
export async function tryOn(
|
|
213
214
|
apiKey: string,
|
|
214
215
|
artist: string,
|
|
215
|
-
productName
|
|
216
|
+
productName?: string,
|
|
216
217
|
): Promise<TryOnResult> {
|
|
218
|
+
const payload: Record<string, string> = { artist };
|
|
219
|
+
if (productName) {
|
|
220
|
+
payload.product_name = productName;
|
|
221
|
+
}
|
|
217
222
|
return request("/api/v1/try-on", {
|
|
218
223
|
method: "POST",
|
|
219
224
|
headers: authHeader(apiKey),
|
|
220
|
-
body: JSON.stringify(
|
|
225
|
+
body: JSON.stringify(payload),
|
|
221
226
|
});
|
|
222
227
|
}
|
package/src/index.ts
CHANGED
|
@@ -561,14 +561,14 @@ export default function register(api: any) {
|
|
|
561
561
|
},
|
|
562
562
|
product_name: {
|
|
563
563
|
type: "string",
|
|
564
|
-
description: "
|
|
564
|
+
description: "Product name to try on. If omitted, uses the product from your most recent merch notification.",
|
|
565
565
|
},
|
|
566
566
|
},
|
|
567
|
-
required: ["artist"
|
|
567
|
+
required: ["artist"],
|
|
568
568
|
},
|
|
569
569
|
async execute(
|
|
570
570
|
_id: string,
|
|
571
|
-
params: { artist: string; product_name
|
|
571
|
+
params: { artist: string; product_name?: string },
|
|
572
572
|
) {
|
|
573
573
|
const apiKey = cfg().apiKey;
|
|
574
574
|
if (!apiKey) {
|
|
@@ -583,7 +583,7 @@ export default function register(api: any) {
|
|
|
583
583
|
const result = await twindex.tryOn(
|
|
584
584
|
apiKey,
|
|
585
585
|
params.artist,
|
|
586
|
-
params.product_name,
|
|
586
|
+
params.product_name ?? undefined,
|
|
587
587
|
);
|
|
588
588
|
return {
|
|
589
589
|
content: [
|
package/src/poll-service.ts
CHANGED
|
@@ -130,6 +130,9 @@ export function createNotificationService(api: any) {
|
|
|
130
130
|
if (notif.twindex_url) {
|
|
131
131
|
message += `\n\n${notif.twindex_url}`;
|
|
132
132
|
}
|
|
133
|
+
if (notif.product_title) {
|
|
134
|
+
message += `\n\nProduct: ${notif.product_title}`;
|
|
135
|
+
}
|
|
133
136
|
// For merch with product image (no try-on), add selfie CTA
|
|
134
137
|
if (notif.event_type === "merch_drop" && notif.media_url && !notif.media_url.includes("/media/tryon/")) {
|
|
135
138
|
message += `\n\nWant to see how it looks on you? Send me a selfie and I'll show you.`;
|