@xquik/tweetclaw 1.6.4 → 1.6.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/README.md CHANGED
@@ -38,7 +38,7 @@ Source: [official X API pricing](https://docs.x.com/x-api/getting-started/pricin
38
38
  | Read (user profile, verified followers, followers you know) | 1 | $0.00015 |
39
39
  | Read (favoriters) | 1 | $0.00015 |
40
40
  | Read (trends) | 3 | $0.00045 |
41
- | Follow check, article | 7 | $0.00105 |
41
+ | Follow check, article | 5 | $0.00075 |
42
42
  | Write (tweet, like, retweet, follow, DM, etc.) | 10 | $0.0015 |
43
43
  | Extraction (tweets, replies, quotes, mentions, posts, likes, media, search, favoriters, retweeters, community members, people search, list members, list followers) | 1/result | $0.00015/result |
44
44
  | Extraction (followers, following, verified followers) | 1/result | $0.00015/result |
@@ -50,7 +50,7 @@ Source: [official X API pricing](https://docs.x.com/x-api/getting-started/pricin
50
50
 
51
51
  Two options:
52
52
 
53
- - **Credits**: Top up credits via the API. 1 credit = $0.00015. Works with all 112 endpoints.
53
+ - **Credits**: Top up credits via the API. 1 credit = $0.00015. Works with all 113 endpoints.
54
54
  - **MPP**: 32 read-only X-API endpoints accept anonymous on-chain payments via Machine Payments Protocol. No account needed. SDK: `npm i mppx viem`.
55
55
 
56
56
  ### Free Operations
@@ -67,7 +67,7 @@ openclaw plugins install @xquik/tweetclaw
67
67
 
68
68
  ## Configure
69
69
 
70
- ### Option A: API key (full access, 112 endpoints)
70
+ ### Option A: API key (full access, 113 endpoints)
71
71
 
72
72
  Get an API key at [dashboard.xquik.com](https://dashboard.xquik.com/). Store it in an environment variable and configure TweetClaw to use it:
73
73
 
@@ -79,7 +79,7 @@ openclaw config set plugins.entries.tweetclaw.config.apiKey "$XQUIK_API_KEY"
79
79
 
80
80
  ### Option B: Credits (pay-per-use, no subscription)
81
81
 
82
- Top up credits from the Xquik dashboard or via `POST /credits/topup`. All 112 endpoints available. 1 credit = $0.00015.
82
+ Top up credits from the Xquik dashboard or via `POST /credits/topup`. All 113 endpoints available. 1 credit = $0.00015.
83
83
 
84
84
  ### Option C: MPP pay-per-use (no account needed, 32 read-only endpoints)
85
85
 
@@ -120,6 +120,8 @@ AI uses explore → filters spec by category "composition"
120
120
 
121
121
  Execute authenticated API calls. Auth is injected automatically - the LLM never sees your API key.
122
122
 
123
+ OpenClaw approval prompts are enforced before write-like `tweetclaw` tool calls. Review the generated code before approving any post, delete, follow, DM, monitor, extraction, webhook, checkout, or profile-change action.
124
+
123
125
  ```
124
126
  You: "Post a tweet saying 'Hello from TweetClaw!'"
125
127
 
@@ -159,7 +161,7 @@ You: "Monitor @elonmusk for new tweets, replies, and retweets"
159
161
 
160
162
  ## API Coverage
161
163
 
162
- 112 endpoints across 10 categories:
164
+ 113 endpoints across 10 categories:
163
165
 
164
166
  | Category | Examples | Cost |
165
167
  |----------|---------|------|
@@ -170,7 +172,7 @@ You: "Monitor @elonmusk for new tweets, replies, and retweets"
170
172
  | **Media** | Upload media via URL, download tweet media, get gallery links | 1-2 credits |
171
173
  | **Monitoring** | Create monitors, view events, manage webhooks | Free |
172
174
  | **Support** | Create tickets, reply, track status | Free |
173
- | **Twitter** | Search, lookups, timelines, articles, trends, bookmarks, notifications | 1-7 credits |
175
+ | **Twitter** | Search, lookups, timelines, articles, trends, bookmarks, notifications | 1-5 credits |
174
176
  | **X Accounts** | List, inspect, and disconnect connected accounts | Free |
175
177
  | **X Write** | Post, reply, like, retweet, follow, remove follower, DM, profile, communities | 10 credits |
176
178
 
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "id": "tweetclaw",
3
3
  "name": "TweetClaw",
4
- "version": "1.6.4",
5
- "description": "Post tweets, reply, like, retweet, follow, DM from your chat - full X/Twitter automation powered by Xquik. 112 endpoints, reads from $0.00015/call.",
4
+ "version": "1.6.5",
5
+ "description": "Post tweets, reply, like, retweet, follow, DM from your chat - full X/Twitter automation powered by Xquik. 113 endpoints, reads from $0.00015/call.",
6
6
  "primaryCredential": "apiKey",
7
7
  "alternateCredentials": ["tempoSigningKey"],
8
8
  "requires": {
@@ -12,7 +12,7 @@
12
12
  "type": "object",
13
13
  "additionalProperties": false,
14
14
  "properties": {
15
- "apiKey": { "type": "string", "minLength": 1, "description": "Xquik API key (get one at dashboard.xquik.com). Required for full access to all 112 endpoints." },
15
+ "apiKey": { "type": "string", "minLength": 1, "description": "Xquik API key (get one at dashboard.xquik.com). Required for full access to all 113 endpoints." },
16
16
  "tempoSigningKey": { "type": "string", "minLength": 1, "description": "MPP signing key for pay-per-use mode. No account needed. 32 read-only X-API endpoints." },
17
17
  "baseUrl": { "type": "string", "default": "https://xquik.com" },
18
18
  "pollingInterval": { "type": "number", "default": 60, "description": "Event polling interval in seconds" },
@@ -24,7 +24,7 @@
24
24
  ]
25
25
  },
26
26
  "uiHints": {
27
- "apiKey": { "label": "Xquik API Key", "sensitive": true, "placeholder": "xq_...", "help": "Full access to all 112 endpoints. Generate at dashboard.xquik.com." },
27
+ "apiKey": { "label": "Xquik API Key", "sensitive": true, "placeholder": "xq_...", "help": "Full access to all 113 endpoints. Generate at dashboard.xquik.com." },
28
28
  "tempoSigningKey": { "label": "MPP Signing Key", "sensitive": true, "placeholder": "0x...", "help": "Pay-per-use mode via Machine Payments Protocol. No account needed. 32 read-only X-API endpoints only." },
29
29
  "baseUrl": { "label": "API Base URL", "placeholder": "https://xquik.com", "advanced": true, "help": "Only change if using a self-hosted Xquik instance." },
30
30
  "pollingInterval": { "label": "Event Poll Interval (seconds)", "advanced": true, "help": "How often to check for new monitor events. Default: 60 seconds." },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xquik/tweetclaw",
3
- "version": "1.6.4",
4
- "description": "Post tweets, reply, like, retweet, follow, DM & more from OpenClaw - full X/Twitter automation via Xquik. 112 endpoints, reads from $0.00015/call.",
3
+ "version": "1.6.5",
4
+ "description": "Post tweets, reply, like, retweet, follow, DM & more from OpenClaw - full X/Twitter automation via Xquik. 113 endpoints, reads from $0.00015/call.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "repository": {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: tweetclaw
3
- description: "OpenClaw plugin for X/Twitter automation. Post tweets, reply, like, retweet, follow, DM, search, extract data, run giveaways, monitor accounts via Xquik. 112 endpoints, 2 tools (explore + tweetclaw), 2 commands (/xstatus, /xtrends). Post reads from $0.00015/call - about 33x cheaper than official X API post reads."
3
+ description: "OpenClaw plugin for X/Twitter automation. Post tweets, reply, like, retweet, follow, DM, search, extract data, run giveaways, monitor accounts via Xquik. 113 endpoints, 2 tools (explore + tweetclaw), 2 commands (/xstatus, /xtrends). Post reads from $0.00015/call - about 33x cheaper than official X API post reads."
4
4
  homepage: https://xquik.com
5
5
  primaryCredential: apiKey
6
6
  requires:
@@ -42,7 +42,7 @@ TweetClaw uses Xquik's credit-based pricing. 1 credit = $0.00015.
42
42
  | Read (tweet, search, timeline, bookmarks, etc.) | 1 | $0.00015 |
43
43
  | Read (user profile) | 1 | $0.00015 |
44
44
  | Read (trends) | 3 | $0.00045 |
45
- | Follow check, article | 7 | $0.00105 |
45
+ | Follow check, article | 5 | $0.00075 |
46
46
  | Write (tweet, like, retweet, follow, DM, etc.) | 10 | $0.0015 |
47
47
  | Extraction (tweets, replies, quotes, mentions, posts, likes, media, search, favoriters, retweeters, community members, people search, list members, list followers) | 1/result | $0.00015/result |
48
48
  | Extraction (followers, following, verified followers) | 1/result | $0.00015/result |
@@ -65,7 +65,7 @@ Source: [official X API pricing](https://docs.x.com/x-api/getting-started/pricin
65
65
 
66
66
  ### Pay-Per-Use (No Subscription)
67
67
 
68
- - **Credits**: Top up via `POST /api/v1/credits/topup` ($10 minimum). Works with all 112 endpoints.
68
+ - **Credits**: Top up via `POST /api/v1/credits/topup` ($10 minimum). Works with all 113 endpoints.
69
69
  - **MPP**: 32 read-only endpoints accept anonymous on-chain payments. No account needed. SDK: `npm i mppx viem`.
70
70
 
71
71
  MPP pricing: tweet lookup ($0.00015), tweet search ($0.00015/tweet), user lookup ($0.00015), user tweets ($0.00015/tweet), follower check ($0.00105), article ($0.00105), media download ($0.00015/media), trends ($0.00045), X trends ($0.00045), quotes ($0.00015/tweet), replies ($0.00015/tweet), retweeters ($0.00015/user), favoriters ($0.00015/user), thread ($0.00015/tweet), user likes ($0.00015/tweet), user media ($0.00015/tweet), community info ($0.00015), community members ($0.00015/user), community moderators ($0.00015/user), community tweets ($0.00015/tweet), community search ($0.00015/community), communities tweets ($0.00015/tweet), list followers ($0.00015/user), list members ($0.00015/user), list tweets ($0.00015/tweet), users batch ($0.00015/user), users search ($0.00015/user), user followers ($0.00015/user), followers you know ($0.00015/user), user following ($0.00015/user), user mentions ($0.00015/tweet), verified followers ($0.00015/user).
@@ -133,7 +133,7 @@ Configure the signing key in your OpenClaw plugin config:
133
133
 
134
134
  ## Tools
135
135
 
136
- TweetClaw registers 2 tools that cover the entire Xquik API (112 endpoints):
136
+ TweetClaw registers 2 tools that cover the entire Xquik API (113 endpoints):
137
137
 
138
138
  ### `explore` (free, no network)
139
139
 
@@ -318,7 +318,7 @@ Agent uses tweetclaw -> creates ticket with subject and description
318
318
  | Media | Upload media, download tweet media | 1-2 credits |
319
319
  | Monitoring | Create monitors, view events, webhooks | Free |
320
320
  | Support | Create tickets, reply, track status | Free |
321
- | Twitter | Search, lookups, timelines, articles, trends, bookmarks, notifications | 1-7 credits |
321
+ | Twitter | Search, lookups, timelines, articles, trends, bookmarks, notifications | 1-5 credits |
322
322
  | X Accounts | List, inspect, and disconnect connected accounts | Free |
323
323
  | X Write | Post, reply, like, retweet, follow, remove follower, DM, profile, communities | 10 credits |
324
324
 
@@ -388,6 +388,8 @@ Endpoints that initiate financial transactions require **explicit user confirmat
388
388
 
389
389
  ### Write Action Confirmation
390
390
 
391
+ OpenClaw approval prompts are enforced before write-like `tweetclaw` tool calls, but the agent must still show the exact endpoint and payload before asking the user to approve.
392
+
391
393
  All write endpoints modify the user's X account or Xquik resources. These are **irreversible public actions** - a posted tweet, sent DM, or profile change is immediately visible. Before calling any write endpoint, **show the user exactly what will be sent** and wait for explicit approval:
392
394
 
393
395
  - `POST /api/v1/x/tweets` - show full tweet text, media attachments, and reply target
package/src/api-spec.ts CHANGED
@@ -1014,6 +1014,17 @@ const API_SPEC: readonly EndpointInfo[] = [
1014
1014
  responseShape: '{ url: string }',
1015
1015
  summary: 'Top up credits via Stripe Checkout. $10 min.',
1016
1016
  },
1017
+ {
1018
+ category: 'credits',
1019
+ free: true,
1020
+ method: 'GET',
1021
+ parameters: [
1022
+ { description: 'Stripe Checkout session ID returned from credit top-up checkout', in: 'query', name: 'session_id', required: true, type: 'string' },
1023
+ ],
1024
+ path: '/api/v1/credits/topup/status',
1025
+ responseShape: '{ status: "paid" | "open" | "expired" | "unknown", amount_dollars?: number, credits?: number }',
1026
+ summary: 'Check credit top-up checkout status.',
1027
+ },
1017
1028
  {
1018
1029
  category: 'credits',
1019
1030
  free: true,
package/src/index.ts CHANGED
@@ -34,6 +34,28 @@ interface CommandContext {
34
34
  readonly senderId?: string;
35
35
  }
36
36
 
37
+ interface BeforeToolCallEvent {
38
+ readonly params?: unknown;
39
+ readonly toolName?: string;
40
+ }
41
+
42
+ interface ToolApprovalRequest {
43
+ readonly description: string;
44
+ readonly pluginId?: string;
45
+ readonly severity?: 'critical' | 'info' | 'warning';
46
+ readonly timeoutBehavior?: 'allow' | 'deny';
47
+ readonly timeoutMs?: number;
48
+ readonly title: string;
49
+ }
50
+
51
+ interface BeforeToolCallResult {
52
+ readonly requireApproval?: ToolApprovalRequest;
53
+ }
54
+
55
+ type BeforeToolCallHandler = (
56
+ event: BeforeToolCallEvent,
57
+ ) => BeforeToolCallResult | Promise<BeforeToolCallResult | undefined> | undefined;
58
+
37
59
  interface OpenClawApi {
38
60
  readonly logger: {
39
61
  readonly debug?: (message: string) => void;
@@ -62,6 +84,16 @@ interface OpenClawApi {
62
84
  },
63
85
  options?: { readonly name?: string; readonly optional?: boolean },
64
86
  ) => void;
87
+ readonly on?: (
88
+ name: 'before_tool_call',
89
+ handler: BeforeToolCallHandler,
90
+ options?: { readonly priority?: number },
91
+ ) => void;
92
+ readonly registerHook?: (
93
+ name: 'before_tool_call',
94
+ handler: BeforeToolCallHandler,
95
+ options?: { readonly priority?: number },
96
+ ) => void;
65
97
  }
66
98
 
67
99
  const CODE_PARAMETER = {
@@ -72,6 +104,76 @@ const CODE_PARAMETER = {
72
104
  type: 'object',
73
105
  };
74
106
 
107
+ const WRITE_METHOD_PATTERN = /\bmethod\s*:\s*['"`](?:DELETE|PATCH|POST|PUT)['"`]/iu;
108
+ const HIGH_IMPACT_PATH_PATTERNS = [
109
+ /\/api\/v1\/credits\/(?:quick-topup|topup)/u,
110
+ /\/api\/v1\/draws/u,
111
+ /\/api\/v1\/extractions/u,
112
+ /\/api\/v1\/monitors/u,
113
+ /\/api\/v1\/subscribe/u,
114
+ /\/api\/v1\/webhooks/u,
115
+ /\/api\/v1\/x\/communities/u,
116
+ /\/api\/v1\/x\/dm\//u,
117
+ /\/api\/v1\/x\/media/u,
118
+ /\/api\/v1\/x\/profile/u,
119
+ /\/api\/v1\/x\/tweets['"`]/u,
120
+ ] as const;
121
+
122
+ function toolCallCode(event: BeforeToolCallEvent): string | undefined {
123
+ if (typeof event.params !== 'object' || event.params === null) {
124
+ return undefined;
125
+ }
126
+
127
+ const { code } = event.params as { readonly code?: unknown };
128
+ return typeof code === 'string' ? code : undefined;
129
+ }
130
+
131
+ function requiresTweetclawApproval(code: string): boolean {
132
+ if (WRITE_METHOD_PATTERN.test(code)) {
133
+ return true;
134
+ }
135
+
136
+ return HIGH_IMPACT_PATH_PATTERNS.some((pattern) => pattern.test(code));
137
+ }
138
+
139
+ function registerWriteApprovalHook(api: OpenClawApi): void {
140
+ const registerHook = api.on ?? api.registerHook;
141
+ if (registerHook === undefined) {
142
+ api.logger.warn(
143
+ 'TweetClaw: OpenClaw approval hooks are unavailable. Keep explicit user approval before write actions.',
144
+ );
145
+ return;
146
+ }
147
+
148
+ registerHook.call(
149
+ api,
150
+ 'before_tool_call',
151
+ (event): BeforeToolCallResult | undefined => {
152
+ if (event.toolName !== 'tweetclaw') {
153
+ return undefined;
154
+ }
155
+
156
+ const code = toolCallCode(event);
157
+ if (code === undefined || !requiresTweetclawApproval(code)) {
158
+ return undefined;
159
+ }
160
+
161
+ return {
162
+ requireApproval: {
163
+ description:
164
+ 'TweetClaw is about to run code that can change X accounts, create jobs, or start a checkout flow. Review the tool call before allowing it.',
165
+ pluginId: 'tweetclaw',
166
+ severity: 'warning',
167
+ timeoutBehavior: 'deny',
168
+ timeoutMs: 60_000,
169
+ title: 'Approve TweetClaw Action',
170
+ },
171
+ };
172
+ },
173
+ { priority: 50 },
174
+ );
175
+ }
176
+
75
177
  export default function register(api: OpenClawApi, fetchFunction?: FetchFunction): void {
76
178
  const config: unknown = api.pluginConfig;
77
179
  if (!isPluginConfig(config)) {
@@ -98,6 +200,7 @@ export default function register(api: OpenClawApi, fetchFunction?: FetchFunction
98
200
  }
99
201
 
100
202
  const request = createProxiedRequest(baseUrl, credential, fetchFunction);
203
+ registerWriteApprovalHook(api);
101
204
 
102
205
  // --- Tools (2-tool approach, execute inside tool object) ---
103
206
  api.registerTool(