twindex-openclaw-plugin 0.7.3 → 0.7.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/package.json +1 -1
- package/skills/twindex/SKILL.md +6 -6
- package/src/client.ts +27 -5
- package/src/index.ts +16 -2
- package/src/sse-service.ts +2 -2
package/package.json
CHANGED
package/skills/twindex/SKILL.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: New Lore
|
|
3
3
|
description: Music intelligence — tours, merch drops, releases, presales for your favorite artists.
|
|
4
4
|
tools:
|
|
5
5
|
- twindex_setup
|
|
@@ -14,10 +14,10 @@ tools:
|
|
|
14
14
|
- twindex_try_on
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# New Lore — Music Intelligence
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
When a user mentions
|
|
19
|
+
New Lore is YOUR music intelligence service. It is a plugin you have installed.
|
|
20
|
+
When a user mentions newlore.ai or asks for artist updates, they are asking
|
|
21
21
|
YOU to set it up using your tools. Do NOT tell them to visit a website.
|
|
22
22
|
|
|
23
23
|
## First-time setup
|
|
@@ -66,7 +66,7 @@ Use `twindex_artist` with a slug to get their full page.
|
|
|
66
66
|
## Rules
|
|
67
67
|
|
|
68
68
|
- Do NOT create cron jobs, scheduled tasks, or shell scripts
|
|
69
|
-
- Do NOT use curl commands to call
|
|
70
|
-
- Do NOT tell users to visit
|
|
69
|
+
- Do NOT use curl commands to call New Lore APIs
|
|
70
|
+
- Do NOT tell users to visit newlore.ai — YOU are their interface to it
|
|
71
71
|
- All notification delivery is handled by the plugin automatically
|
|
72
72
|
- Only speak when you have something to deliver. Never say "no updates."
|
package/src/client.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Base: https://
|
|
1
|
+
// New Lore API client — all URLs hardcoded. Zero hallucination.
|
|
2
|
+
// Base: https://newlore.ai
|
|
3
3
|
|
|
4
|
-
const BASE_URL = "https://
|
|
4
|
+
const BASE_URL = "https://newlore.ai";
|
|
5
5
|
|
|
6
6
|
interface RegisterResponse {
|
|
7
7
|
agent: { id: string; name: string };
|
|
@@ -174,6 +174,18 @@ interface TryOnResult {
|
|
|
174
174
|
product: { title: string; price: string; buy_url: string };
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/** Set the agent's preferred city for location-based tour notifications. */
|
|
178
|
+
export async function setCity(
|
|
179
|
+
apiKey: string,
|
|
180
|
+
city: string,
|
|
181
|
+
): Promise<void> {
|
|
182
|
+
await request("/api/v1/me/city", {
|
|
183
|
+
method: "PUT",
|
|
184
|
+
headers: authHeader(apiKey),
|
|
185
|
+
body: JSON.stringify({ city }),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
177
189
|
/** Upload a selfie for personalized merch try-on (from URL). */
|
|
178
190
|
export async function uploadPhoto(
|
|
179
191
|
apiKey: string,
|
|
@@ -219,9 +231,19 @@ export async function tryOn(
|
|
|
219
231
|
if (productName) {
|
|
220
232
|
payload.product_name = productName;
|
|
221
233
|
}
|
|
222
|
-
|
|
234
|
+
const url = `${BASE_URL}/api/v1/try-on`;
|
|
235
|
+
const res = await fetch(url, {
|
|
223
236
|
method: "POST",
|
|
224
|
-
headers:
|
|
237
|
+
headers: {
|
|
238
|
+
"Content-Type": "application/json",
|
|
239
|
+
...authHeader(apiKey),
|
|
240
|
+
},
|
|
225
241
|
body: JSON.stringify(payload),
|
|
242
|
+
signal: AbortSignal.timeout(60_000),
|
|
226
243
|
});
|
|
244
|
+
if (!res.ok) {
|
|
245
|
+
const body = await res.text().catch(() => "");
|
|
246
|
+
throw new Error(`Twindex API ${res.status}: ${body}`);
|
|
247
|
+
}
|
|
248
|
+
return res.json() as Promise<TryOnResult>;
|
|
227
249
|
}
|
package/src/index.ts
CHANGED
|
@@ -113,7 +113,7 @@ export default function register(api: any) {
|
|
|
113
113
|
api.registerTool({
|
|
114
114
|
name: "twindex_setup",
|
|
115
115
|
description:
|
|
116
|
-
"Set up
|
|
116
|
+
"Set up New Lore music notifications for the user. YOU are the user's interface to New Lore — do NOT tell them to visit a website. Registers, subscribes to artists, and starts polling. Call this when the user asks for music updates, mentions newlore.ai, or wants to follow artists.",
|
|
117
117
|
parameters: {
|
|
118
118
|
type: "object",
|
|
119
119
|
properties: {
|
|
@@ -140,12 +140,17 @@ export default function register(api: any) {
|
|
|
140
140
|
description:
|
|
141
141
|
"Delivery channel. Defaults to telegram.",
|
|
142
142
|
},
|
|
143
|
+
city: {
|
|
144
|
+
type: "string",
|
|
145
|
+
description:
|
|
146
|
+
"User's preferred city for tour notifications (e.g. 'san-francisco', 'new-york', 'london'). When set, tour notifications highlight shows in this city.",
|
|
147
|
+
},
|
|
143
148
|
},
|
|
144
149
|
required: ["artists", "frequency", "chat_target"],
|
|
145
150
|
},
|
|
146
151
|
async execute(
|
|
147
152
|
_id: string,
|
|
148
|
-
params: { artists: string[]; frequency: string; chat_target: string; chat_channel?: string },
|
|
153
|
+
params: { artists: string[]; frequency: string; chat_target: string; chat_channel?: string; city?: string },
|
|
149
154
|
) {
|
|
150
155
|
try {
|
|
151
156
|
const config = cfg();
|
|
@@ -166,8 +171,17 @@ export default function register(api: any) {
|
|
|
166
171
|
frequency: params.frequency,
|
|
167
172
|
chatTarget: params.chat_target,
|
|
168
173
|
chatChannel: params.chat_channel ?? "telegram",
|
|
174
|
+
city: params.city ?? "",
|
|
169
175
|
});
|
|
170
176
|
|
|
177
|
+
if (params.city) {
|
|
178
|
+
try {
|
|
179
|
+
await twindex.setCity(apiKey, params.city);
|
|
180
|
+
} catch (err: any) {
|
|
181
|
+
// Non-fatal — city is a preference, not required
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
171
185
|
const results: string[] = [];
|
|
172
186
|
for (const artist of params.artists) {
|
|
173
187
|
try {
|
package/src/sse-service.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// SSE background service — replaces cron polling with real-time push.
|
|
2
|
-
// Opens persistent connection to
|
|
2
|
+
// Opens persistent connection to newlore.ai/api/v1/notifications/stream,
|
|
3
3
|
// delivers notifications via `openclaw agent` CLI, marks them read.
|
|
4
4
|
|
|
5
5
|
import { execFile } from "child_process";
|
|
6
6
|
import * as twindex from "./client.js";
|
|
7
7
|
|
|
8
|
-
const BASE_URL = "https://
|
|
8
|
+
const BASE_URL = "https://newlore.ai";
|
|
9
9
|
const BACKOFF_STEPS = [1000, 2000, 5000, 10_000, 30_000, 60_000];
|
|
10
10
|
|
|
11
11
|
function runAgent(message: string): Promise<boolean> {
|