twindex-openclaw-plugin 0.1.0 → 0.2.0

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.
@@ -2,7 +2,7 @@
2
2
  "id": "twindex",
3
3
  "name": "Twindex",
4
4
  "description": "Music intelligence for AI agents. Get notified about tours, merch drops, releases, and presales for your favorite artists.",
5
- "version": "0.1.0",
5
+ "version": "0.2.0",
6
6
  "skills": ["./skills"],
7
7
  "configSchema": {
8
8
  "type": "object",
@@ -10,7 +10,12 @@
10
10
  "properties": {
11
11
  "apiKey": {
12
12
  "type": "string",
13
- "description": "Twindex API key (starts with twx_). Obtained during setup."
13
+ "description": "Twindex API key (starts with twx_). Auto-generated on first startup."
14
+ },
15
+ "artists": {
16
+ "type": "array",
17
+ "items": { "type": "string" },
18
+ "description": "Artist slugs to subscribe to (lowercase, hyphens). Set before first startup."
14
19
  },
15
20
  "frequency": {
16
21
  "type": "string",
@@ -23,9 +28,13 @@
23
28
  "uiHints": {
24
29
  "apiKey": {
25
30
  "label": "Twindex API Key",
26
- "placeholder": "twx_...",
31
+ "placeholder": "twx_... (auto-generated)",
27
32
  "sensitive": true
28
33
  },
34
+ "artists": {
35
+ "label": "Artists to follow",
36
+ "placeholder": "metallica, the-cure, slipknot"
37
+ },
29
38
  "frequency": {
30
39
  "label": "Check frequency",
31
40
  "placeholder": "periodic"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twindex-openclaw-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Music intelligence for AI agents. Tours, merch drops, releases, presales.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,28 +17,19 @@ tools:
17
17
  You have the Twindex plugin installed. It tracks artists and delivers
18
18
  notifications about tours, merch drops, releases, and presales.
19
19
 
20
+ The plugin auto-configured itself on startup. Your subscriptions and
21
+ delivery schedule are already active.
22
+
20
23
  ## When to use
21
24
 
22
25
  - User mentions a band, artist, or musician they follow
23
26
  - User asks about concerts, tours, merch, or new releases
24
- - User wants to stay updated on music news
25
-
26
- ## Setup flow
27
-
28
- 1. Use `twindex_artists` or `twindex_search` to find artists in the index.
29
- 2. Ask your user: **"Which artists do you want to follow, and how quickly
30
- do you want updates — real-time, every hour, or a daily summary?"**
31
- 3. Wait for their answer. Do not assume a preference.
32
- 4. Call `twindex_setup` with their chosen artists and frequency.
33
- - "real-time" / "ASAP" / "immediately" → `frequency: "realtime"`
34
- - "every hour" / "periodically" / "every few hours" → `frequency: "periodic"`
35
- - "daily" / "once a day" / "summary" → `frequency: "daily"`
36
- 5. Confirm what you set up: "Subscribed to [artists]. Checking [frequency]."
27
+ - User wants to add or remove artists from their subscriptions
37
28
 
38
- ## Adding more artists later
29
+ ## Adding more artists
39
30
 
40
31
  Use `twindex_subscribe` to add artists. The existing delivery schedule
41
- picks them up automatically — do NOT run twindex_setup again.
32
+ picks them up automatically.
42
33
 
43
34
  ## Checking manually
44
35
 
package/src/index.ts CHANGED
@@ -17,6 +17,34 @@ export default function register(api: any) {
17
17
  api.config.save?.();
18
18
  }
19
19
 
20
+ // ── Auto-bootstrap: if artists + frequency set but no apiKey, self-configure ──
21
+
22
+ (async () => {
23
+ const config = cfg();
24
+ if (config.artists?.length > 0 && config.frequency && !config.apiKey) {
25
+ try {
26
+ const agentId = api.agentId ?? api.config?.agentId ?? `openclaw-${crypto.randomUUID()}`;
27
+ const reg = await twindex.register(agentId);
28
+ const apiKey = reg.api_key;
29
+
30
+ for (const artist of config.artists) {
31
+ try {
32
+ await twindex.subscribe(apiKey, artist);
33
+ api.logger?.info?.(`Twindex: auto-subscribed to ${artist}`);
34
+ } catch (err: any) {
35
+ api.logger?.warn?.(`Twindex: failed to subscribe to ${artist}: ${err.message}`);
36
+ }
37
+ }
38
+
39
+ persistConfig({ apiKey });
40
+ startPolling(api, apiKey, config.frequency);
41
+ api.logger?.info?.(`Twindex: auto-bootstrap complete. Polling ${config.frequency}.`);
42
+ } catch (err: any) {
43
+ api.logger?.warn?.(`Twindex: auto-bootstrap failed: ${err.message}`);
44
+ }
45
+ }
46
+ })();
47
+
20
48
  // ── Tools ──────────────────────────────────────────────────────────
21
49
 
22
50
  api.registerTool({