@xquik/tweetclaw 1.6.12 → 1.6.14

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
@@ -6,6 +6,7 @@
6
6
  ![GitHub stars](https://img.shields.io/github/stars/Xquik-dev/tweetclaw)
7
7
  [![Glama MCP server](https://glama.ai/mcp/servers/Xquik-dev/x-twitter-scraper/badges/score.svg)](https://glama.ai/mcp/servers/Xquik-dev/x-twitter-scraper)
8
8
  [![Smithery](https://smithery.ai/badge/xquik/x-twitter-scraper)](https://smithery.ai/servers/xquik/x-twitter-scraper)
9
+ [![Apify Actor](https://apify.com/actor-badge?actor=xquik/x-tweet-scraper)](https://apify.com/xquik/x-tweet-scraper)
9
10
 
10
11
  Post tweets, reply, like, retweet, follow, DM & more - directly from your chat. Full X/Twitter automation for [OpenClaw](https://github.com/openclaw/openclaw).
11
12
 
@@ -63,6 +64,8 @@ Tweet composition, style analysis, drafts, curated radar (7 sources), and accoun
63
64
  openclaw plugins install @xquik/tweetclaw
64
65
  ```
65
66
 
67
+ TweetClaw can be installed before credentials are configured. Until you add an API key or MPP signing key, the free `explore` catalog remains available and live API calls return setup guidance instead of failing plugin installation.
68
+
66
69
  > **Note:** `@xquik/tweetclaw` is the only official npm package. Any other scope (for example `@intentsolutionsio/tweetclaw`) is an unofficial redistribution and may ship stale metadata or outdated endpoint counts.
67
70
 
68
71
  ## Configure
@@ -75,7 +78,7 @@ Get an API key at [dashboard.xquik.com](https://dashboard.xquik.com/). Store it
75
78
  openclaw config set plugins.entries.tweetclaw.config.apiKey "$XQUIK_API_KEY"
76
79
  ```
77
80
 
78
- **Security**: Always reference your key via an environment variable - never paste raw keys into shell commands or config files.
81
+ **Security**: Keep the key out of chats, docs, and shell history. Prefer the environment-variable command above so OpenClaw writes the secret to its local config without exposing it in the prompt.
79
82
 
80
83
  ### Option B: Credits (pay-per-use, no subscription)
81
84
 
@@ -90,16 +93,25 @@ npm i mppx viem
90
93
  openclaw config set plugins.entries.tweetclaw.config.tempoSigningKey "$MPP_SIGNING_KEY"
91
94
  ```
92
95
 
93
- **Security**: Always store your signing key in an environment variable - never paste raw keys into shell commands or config files.
96
+ **Security**: Keep the signing key out of chats, docs, and shell history. Prefer the environment-variable command above so OpenClaw writes the secret to its local config without exposing it in the prompt.
94
97
 
95
98
  MPP-eligible endpoints: tweet lookup ($0.00015), tweet search ($0.00015/tweet), user lookup ($0.00015), user tweets ($0.00015/tweet), follower check ($0.00105), article lookup ($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).
96
99
 
97
100
  ### Enable the optional action tool
98
101
 
99
- OpenClaw loads `explore` as the safe catalog tool. The live endpoint invoker, `tweetclaw`, is registered as an optional tool because it can perform paid reads, private reads, and write actions. If OpenClaw does not expose it after installation, add it to `tools.allow`:
102
+ OpenClaw loads `explore` as the safe catalog tool. The live endpoint invoker, `tweetclaw`, is registered as an optional tool because it can perform paid reads, private reads, and write actions.
103
+
104
+ OpenClaw's local onboarding default is often `tools.profile: "coding"`, which excludes external plugin tools from agent runs until they are explicitly allowed. If the agent can see the TweetClaw skill but cannot call the tools, add the tool names to `tools.alsoAllow` so you keep the normal coding tools and opt into TweetClaw.
105
+
106
+ ```bash
107
+ openclaw config set tools.alsoAllow '["explore", "tweetclaw"]'
108
+ ```
109
+
110
+ Verify runtime registration after install or update:
100
111
 
101
112
  ```bash
102
- openclaw config set tools.allow '["tweetclaw"]'
113
+ openclaw plugins inspect tweetclaw --runtime
114
+ openclaw skills info tweetclaw
103
115
  ```
104
116
 
105
117
  ### Optional settings
package/dist/index.d.ts CHANGED
@@ -68,9 +68,6 @@ declare function register(api: OpenClawApi, fetchFunction?: FetchFunction): void
68
68
  declare const plugin: {
69
69
  configSchema: {
70
70
  additionalProperties: boolean;
71
- anyOf: {
72
- required: string[];
73
- }[];
74
71
  properties: {
75
72
  apiKey: {
76
73
  description: string;
package/dist/index.js CHANGED
@@ -6,25 +6,19 @@ import { createProxiedRequest } from './request.js';
6
6
  import { createEventPoller } from './services/event-poller.js';
7
7
  import { normalizeMethod, requestNeedsApproval } from './tools/catalog.js';
8
8
  import { handleExplore, SEARCH_DESCRIPTION } from './tools/explore.js';
9
+ import { errorResult } from './tools/result.js';
9
10
  import { EXECUTE_DESCRIPTION, handleTweetclaw } from './tools/tweetclaw.js';
10
11
  function isPollerEvent(value) {
11
12
  return typeof value === 'object' && value !== null;
12
13
  }
13
- function isPluginConfig(value) {
14
- if (typeof value !== 'object' || value === null)
15
- return false;
16
- return 'apiKey' in value || 'tempoSigningKey' in value;
17
- }
18
14
  const DEFAULT_POLLING_INTERVAL_SECONDS = 60;
15
+ const DEFAULT_BASE_URL = 'https://xquik.com';
16
+ const MISSING_CREDENTIALS_MESSAGE = 'TweetClaw is installed but not configured. Add an Xquik API key for account-backed workflows or a Tempo signing key for MPP read-only mode in OpenClaw plugin config.';
19
17
  const CONFIG_SCHEMA = {
20
18
  additionalProperties: false,
21
- anyOf: [
22
- { required: ['apiKey'] },
23
- { required: ['tempoSigningKey'] },
24
- ],
25
19
  properties: {
26
20
  apiKey: {
27
- description: 'Xquik API key (get one at dashboard.xquik.com). Required for account-backed X automation.',
21
+ description: 'Xquik API key (get one at dashboard.xquik.com). Use for account-backed X automation.',
28
22
  minLength: 1,
29
23
  type: 'string',
30
24
  },
@@ -36,7 +30,7 @@ const CONFIG_SCHEMA = {
36
30
  type: 'number',
37
31
  },
38
32
  tempoSigningKey: {
39
- description: 'MPP signing key for pay-per-use mode. No account needed. 32 read-only X-API endpoints.',
33
+ description: 'MPP signing key for pay-per-use mode. Use for accountless access to 32 read-only X-API endpoints.',
40
34
  minLength: 1,
41
35
  type: 'string',
42
36
  },
@@ -58,7 +52,11 @@ const EXPLORE_PARAMETERS = {
58
52
  const TWEETCLAW_PARAMETERS = {
59
53
  additionalProperties: false,
60
54
  properties: {
61
- body: { description: 'JSON request body', type: ['object', 'array', 'string', 'number', 'boolean', 'null'] },
55
+ body: {
56
+ description: 'JSON request body',
57
+ items: {},
58
+ type: ['object', 'array', 'string', 'number', 'boolean', 'null'],
59
+ },
62
60
  method: { default: 'GET', description: 'HTTP method', enum: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE'], type: 'string' },
63
61
  path: { description: 'Concrete /api/v1/... endpoint path from the catalog', type: 'string' },
64
62
  query: {
@@ -76,6 +74,19 @@ function asObject(value) {
76
74
  }
77
75
  return Object.fromEntries(Object.entries(value));
78
76
  }
77
+ function asPluginConfig(value) {
78
+ const config = asObject(value);
79
+ if (config === undefined)
80
+ return {};
81
+ const { apiKey, baseUrl, pollingEnabled, pollingInterval, tempoSigningKey } = config;
82
+ return {
83
+ ...(typeof apiKey === 'string' && apiKey.length > 0 ? { apiKey } : {}),
84
+ ...(typeof baseUrl === 'string' && baseUrl.length > 0 ? { baseUrl } : {}),
85
+ ...(typeof pollingEnabled === 'boolean' ? { pollingEnabled } : {}),
86
+ ...(typeof pollingInterval === 'number' ? { pollingInterval } : {}),
87
+ ...(typeof tempoSigningKey === 'string' && tempoSigningKey.length > 0 ? { tempoSigningKey } : {}),
88
+ };
89
+ }
79
90
  function asExploreParams(params) {
80
91
  const value = asObject(params);
81
92
  if (value === undefined)
@@ -151,30 +162,32 @@ function registerWriteApprovalHook(api) {
151
162
  };
152
163
  }, { priority: 50 });
153
164
  }
154
- function register(api, fetchFunction) {
155
- const config = api.pluginConfig;
156
- if (!isPluginConfig(config)) {
157
- api.logger.warn('TweetClaw: No API key or signing key configured. See the README for setup instructions.');
158
- return;
165
+ function resolveCredentialState(config) {
166
+ const accountValue = config.apiKey;
167
+ if (accountValue !== undefined) {
168
+ return { accountValue, mode: 'api-key', signingValue: '' };
159
169
  }
160
- const { apiKey, baseUrl = 'https://xquik.com', tempoSigningKey } = config;
161
- const isMppMode = apiKey === undefined && tempoSigningKey !== undefined;
162
- const credential = apiKey ?? '';
163
- if (isMppMode) {
164
- void (async () => {
165
- try {
166
- await initMpp(tempoSigningKey);
167
- api.logger.info('TweetClaw: MPP initialized - payment account ready');
168
- }
169
- catch (error) {
170
- api.logger.error(`TweetClaw: MPP init failed - ${error instanceof Error ? error.message : String(error)}`);
171
- }
172
- })();
173
- api.logger.info('TweetClaw: MPP mode - pay-per-use (32 X-API endpoints, no subscription needed)');
170
+ const signingValue = config.tempoSigningKey;
171
+ if (signingValue !== undefined) {
172
+ return { accountValue: '', mode: 'mpp', signingValue };
174
173
  }
175
- const request = createProxiedRequest(baseUrl, credential, fetchFunction);
176
- registerWriteApprovalHook(api);
177
- // --- Tools (2-tool approach, execute inside tool object) ---
174
+ return { accountValue: '', mode: 'none', signingValue: '' };
175
+ }
176
+ function registerMppMode(api, credentialMode, signingValue) {
177
+ if (credentialMode !== 'mpp')
178
+ return;
179
+ void (async () => {
180
+ try {
181
+ await initMpp(signingValue);
182
+ api.logger.info('TweetClaw: MPP initialized - payment account ready');
183
+ }
184
+ catch (error) {
185
+ api.logger.error(`TweetClaw: MPP init failed - ${error instanceof Error ? error.message : String(error)}`);
186
+ }
187
+ })();
188
+ api.logger.info('TweetClaw: MPP mode - pay-per-use (32 X-API endpoints, no subscription needed)');
189
+ }
190
+ function registerTools(api, options) {
178
191
  api.registerTool({
179
192
  description: SEARCH_DESCRIPTION,
180
193
  execute: async (_toolCallId, params) => {
@@ -186,18 +199,25 @@ function register(api, fetchFunction) {
186
199
  }, { name: 'explore' });
187
200
  api.registerTool({
188
201
  description: EXECUTE_DESCRIPTION,
189
- execute: async (_toolCallId, params) => handleTweetclaw({
190
- apiKey: credential,
191
- baseUrl,
192
- fetchFunction,
193
- mppMode: isMppMode,
194
- params: asTweetclawParams(params),
195
- }),
202
+ execute: async (_toolCallId, params) => {
203
+ if (options.credentialMode === 'none') {
204
+ await Promise.resolve();
205
+ return errorResult(new Error(MISSING_CREDENTIALS_MESSAGE));
206
+ }
207
+ return handleTweetclaw({
208
+ baseUrl: options.baseUrl,
209
+ credential: options.credential,
210
+ fetchFunction: options.fetchFunction,
211
+ mppMode: options.credentialMode === 'mpp',
212
+ params: asTweetclawParams(params),
213
+ });
214
+ },
196
215
  name: 'tweetclaw',
197
216
  parameters: TWEETCLAW_PARAMETERS,
198
217
  }, { name: 'tweetclaw', optional: true });
199
- // --- Commands (instant, no LLM) ---
200
- if (!isMppMode) {
218
+ }
219
+ function registerCommands(api, credentialMode, request) {
220
+ if (credentialMode === 'api-key') {
201
221
  api.registerCommand({
202
222
  description: 'Show Xquik account status & usage',
203
223
  handler: async () => {
@@ -216,30 +236,47 @@ function register(api, fetchFunction) {
216
236
  },
217
237
  name: 'xtrends',
218
238
  });
219
- // --- Background event poller (requires API key, not available in MPP mode) ---
220
- const { pollingEnabled, pollingInterval } = config;
221
- if (!isMppMode && pollingEnabled !== false) {
222
- const poller = createEventPoller({
223
- intervalSeconds: pollingInterval ?? DEFAULT_POLLING_INTERVAL_SECONDS,
224
- onEvents: (events) => {
225
- for (const event of events) {
226
- const eventType = isPollerEvent(event) && typeof event['eventType'] === 'string'
227
- ? event['eventType']
228
- : 'unknown';
229
- const username = isPollerEvent(event) && typeof event['xUsername'] === 'string'
230
- ? event['xUsername']
231
- : '';
232
- api.logger.info(`[TweetClaw] ${eventType} from @${username}`);
233
- }
234
- },
235
- request,
236
- });
237
- api.registerService({
238
- id: 'tweetclaw-poller',
239
- start: () => { poller.start(); },
240
- stop: () => { poller.stop(); },
241
- });
239
+ }
240
+ function registerPoller(api, config, credentialMode, request) {
241
+ if (credentialMode !== 'api-key' || config.pollingEnabled === false)
242
+ return;
243
+ const poller = createEventPoller({
244
+ intervalSeconds: config.pollingInterval ?? DEFAULT_POLLING_INTERVAL_SECONDS,
245
+ onEvents: (events) => {
246
+ for (const event of events) {
247
+ const eventType = isPollerEvent(event) && typeof event['eventType'] === 'string'
248
+ ? event['eventType']
249
+ : 'unknown';
250
+ const username = isPollerEvent(event) && typeof event['xUsername'] === 'string'
251
+ ? event['xUsername']
252
+ : '';
253
+ api.logger.info(`[TweetClaw] ${eventType} from @${username}`);
254
+ }
255
+ },
256
+ request,
257
+ });
258
+ api.registerService({
259
+ id: 'tweetclaw-poller',
260
+ start: () => { poller.start(); },
261
+ stop: () => { poller.stop(); },
262
+ });
263
+ }
264
+ function register(api, fetchFunction) {
265
+ const config = asPluginConfig(api.pluginConfig);
266
+ const { baseUrl = DEFAULT_BASE_URL } = config;
267
+ const credential = resolveCredentialState(config);
268
+ registerMppMode(api, credential.mode, credential.signingValue);
269
+ const request = createProxiedRequest(baseUrl, credential.accountValue, fetchFunction);
270
+ registerWriteApprovalHook(api);
271
+ if (credential.mode === 'none') {
272
+ api.logger.warn('TweetClaw: No API key or signing key configured. Install succeeded; configure credentials before network calls.');
242
273
  }
274
+ const toolOptions = fetchFunction === undefined
275
+ ? { baseUrl, credential: credential.accountValue, credentialMode: credential.mode }
276
+ : { baseUrl, credential: credential.accountValue, credentialMode: credential.mode, fetchFunction };
277
+ registerTools(api, toolOptions);
278
+ registerCommands(api, credential.mode, request);
279
+ registerPoller(api, config, credential.mode, request);
243
280
  api.logger.info('TweetClaw: Plugin registered successfully');
244
281
  }
245
282
  const plugin = definePluginEntry({
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO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declare function buildFetchHeaders(credential: string, hasBody: boolean): Record<string, string>;
4
4
  declare function buildFetchUrl(baseUrl: string, path: string, query?: Readonly<Record<string, string>>): string;
5
5
  declare function isProhibitedRequest(method: string, path: string): boolean;
6
- declare function createProxiedRequest(baseUrl: string, apiKey: string, fetchFunction?: FetchFunction): RequestFunction;
6
+ declare function createProxiedRequest(baseUrl: string, credential: string, fetchFunction?: FetchFunction): RequestFunction;
7
7
  export { buildAuthHeader, buildFetchHeaders, buildFetchUrl, createProxiedRequest, isProhibitedRequest };
package/dist/request.js CHANGED
@@ -66,14 +66,14 @@ function validateRequestPath(method, path) {
66
66
  throw new Error('Agent-prohibited endpoint. Account connection and re-authentication must be done through the Xquik dashboard at dashboard.xquik.com, not through the agent.');
67
67
  }
68
68
  }
69
- function createProxiedRequest(baseUrl, apiKey, fetchFunction = fetch) {
69
+ function createProxiedRequest(baseUrl, credential, fetchFunction = fetch) {
70
70
  return async (path, options) => {
71
71
  const method = options?.method ?? 'GET';
72
72
  validateRequestPath(method, path);
73
73
  const hasBody = options?.body !== undefined;
74
74
  const response = await fetchFunction(buildFetchUrl(baseUrl, path, options?.query), {
75
75
  ...(hasBody ? { body: JSON.stringify(options.body) } : {}),
76
- headers: buildFetchHeaders(apiKey, hasBody),
76
+ headers: buildFetchHeaders(credential, hasBody),
77
77
  method,
78
78
  signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
79
79
  });
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAC3C,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,MAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,sBA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IAAI,CAAC,CAAC;QAClC,MAAM,OAAO,GAAG,OAAO,EAAE,IAAI,KAAK,SAAS,CAAC;QAC5C,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE;YACjF,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1D,OAAO,EAAE,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC;YAC/C,MAAM;YACN,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC;SAC9C,CAAC,CAAC;QACH,MAAM,IAAI,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,uBAAuB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,UAAU,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAClG,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAC"}
@@ -2,8 +2,8 @@ import { specEndpoints } from './catalog.js';
2
2
  import type { FetchFunction, ToolResult, TweetclawParams } from '../types.js';
3
3
  declare const EXECUTE_DESCRIPTION = "Invoke one Xquik API endpoint from the bundled TweetClaw catalog.\n\nUse \"explore\" first to find the endpoint, then call this tool with structured parameters:\n- path: concrete /api/v1/... path\n- method: GET, POST, PATCH, PUT, or DELETE\n- query: query parameters as an object\n- body: JSON request body\n\nAuth is injected automatically. Never pass API keys, signing keys, passwords, cookies, or TOTP secrets.\n\n## Important rules\n- Only endpoints listed in the bundled catalog can be invoked. Unknown paths are rejected.\n- The plugin only calls the configured Xquik API base URL and only /api/v1 paths.\n- Account connection, re-authentication, API-key administration, subscription checkout, credit top-up, and support-ticket actions are dashboard-only.\n- TWEET ACTIONS: SENDING a tweet (\"tweet this\", \"post this\") uses POST /api/v1/x/tweets. DRAFTING a tweet (\"help me write\", \"compose\") uses the compose flow.\n- WRITE ACTIONS: Show the exact endpoint and payload to the user before approval. All write-like calls trigger an OpenClaw approval prompt.\n- MPP MODE: When configured with a signing key and no API key, only MPP-eligible read endpoints are allowed.\n- CURRENT EVENTS: Use /api/v1/radar for curated trends.\n\n## Example: Send a tweet\n{\n \"path\": \"/api/v1/x/tweets\",\n \"method\": \"POST\",\n \"body\": { \"account\": \"@myaccount\", \"text\": \"Hello world!\" }\n}\n\n## Example: Search tweets\n{\n \"path\": \"/api/v1/x/tweets/search\",\n \"method\": \"GET\",\n \"query\": { \"q\": \"AI agents\", \"limit\": 50 }\n}";
4
4
  interface TweetclawOptions {
5
- readonly apiKey: string;
6
5
  readonly baseUrl: string;
6
+ readonly credential: string;
7
7
  readonly fetchFunction?: FetchFunction | undefined;
8
8
  readonly mppMode?: boolean | undefined;
9
9
  readonly params: Readonly<TweetclawParams>;
@@ -36,10 +36,10 @@ Auth is injected automatically. Never pass API keys, signing keys, passwords, co
36
36
  const EXECUTION_TIMEOUT_MS = 30_000;
37
37
  const MS_PER_SECOND = 1000;
38
38
  async function handleTweetclaw(options) {
39
- const { apiKey, baseUrl, fetchFunction, mppMode = false, params, timeoutMs = EXECUTION_TIMEOUT_MS, } = options;
39
+ const { baseUrl, credential, fetchFunction, mppMode = false, params, timeoutMs = EXECUTION_TIMEOUT_MS, } = options;
40
40
  try {
41
41
  const requestInfo = resolveCatalogRequest(params, { mppMode });
42
- const request = createProxiedRequest(baseUrl, apiKey, fetchFunction);
42
+ const request = createProxiedRequest(baseUrl, credential, fetchFunction);
43
43
  const result = await Promise.race([
44
44
  request(requestInfo.path, {
45
45
  ...(requestInfo.body === undefined ? {} : { body: requestInfo.body }),
@@ -1 +1 @@
1
- {"version":3,"file":"tweetclaw.js","sourceRoot":"","sources":["../../src/tools/tweetclaw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGzD,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+B1B,CAAC;AAEH,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,aAAa,GAAG,IAAI,CAAC;AAW3B,KAAK,UAAU,eAAe,CAAC,OAAmC;IAChE,MAAM,EACJ,MAAM,EACN,OAAO,EACP,aAAa,EACb,OAAO,GAAG,KAAK,EACf,MAAM,EACN,SAAS,GAAG,oBAAoB,GACjC,GAAG,OAAO,CAAC;IAEZ,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,qBAAqB,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAoB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QACtF,MAAM,MAAM,GAAY,MAAM,OAAO,CAAC,IAAI,CAAC;YACzC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE;gBACxB,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;gBACrE,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,GAAG,CAAC,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC;a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AAa,CAAC,CAAC;QAC1F,MAAM,MAAM,GAAY,MAAM,OAAO,CAAC,IAAI,CAAC;YACzC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE;gBACxB,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;gBACrE,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,GAAG,CAAC,WAAW,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC;aACzE,CAAC;YACF,IAAI,OAAO,CAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;gBACtC,UAAU,CAAC,GAAG,EAAE;oBACd,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,MAAM,CAAC,SAAS,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;gBACvF,CAAC,EAAE,SAAS,CAAC,CAAC;YAChB,CAAC,CAAC;SACH,CAAC,CAAC;QAEH,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC"}
@@ -1,26 +1,31 @@
1
1
  {
2
2
  "id": "tweetclaw",
3
3
  "name": "TweetClaw",
4
- "version": "1.6.12",
4
+ "version": "1.6.14",
5
5
  "description": "Post tweets, reply, like, retweet, follow, DM, search, and monitor X/Twitter through structured Xquik endpoints.",
6
+ "activation": {
7
+ "onStartup": false,
8
+ "onCapabilities": ["tool"]
9
+ },
6
10
  "skills": ["skills/tweetclaw"],
7
11
  "contracts": {
8
12
  "tools": ["explore", "tweetclaw"]
9
13
  },
14
+ "toolMetadata": {
15
+ "tweetclaw": {
16
+ "optional": true
17
+ }
18
+ },
10
19
  "configSchema": {
11
20
  "type": "object",
12
21
  "additionalProperties": false,
13
22
  "properties": {
14
- "apiKey": { "type": "string", "minLength": 1, "description": "Xquik API key (get one at dashboard.xquik.com). Required for account-backed X automation." },
15
- "tempoSigningKey": { "type": "string", "minLength": 1, "description": "MPP signing key for pay-per-use mode. No account needed. 32 read-only X-API endpoints." },
23
+ "apiKey": { "type": "string", "minLength": 1, "description": "Xquik API key (get one at dashboard.xquik.com). Use for account-backed X automation." },
24
+ "tempoSigningKey": { "type": "string", "minLength": 1, "description": "MPP signing key for pay-per-use mode. Use for accountless access to 32 read-only X-API endpoints." },
16
25
  "baseUrl": { "type": "string", "default": "https://xquik.com" },
17
26
  "pollingInterval": { "type": "number", "default": 60, "description": "Event polling interval in seconds" },
18
27
  "pollingEnabled": { "type": "boolean", "default": true }
19
- },
20
- "anyOf": [
21
- { "required": ["apiKey"] },
22
- { "required": ["tempoSigningKey"] }
23
- ]
28
+ }
24
29
  },
25
30
  "uiHints": {
26
31
  "apiKey": { "label": "Xquik API Key", "sensitive": true, "placeholder": "xq_...", "help": "Account-backed X automation. Generate at dashboard.xquik.com." },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xquik/tweetclaw",
3
- "version": "1.6.12",
3
+ "version": "1.6.14",
4
4
  "description": "Post tweets, reply, like, retweet, follow, DM & more from OpenClaw through structured Xquik endpoints.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "install": {
34
34
  "defaultChoice": "npm",
35
- "npmSpec": "@xquik/tweetclaw@1.6.12",
35
+ "npmSpec": "@xquik/tweetclaw@1.6.14",
36
36
  "minHostVersion": ">=2026.5.4"
37
37
  }
38
38
  },
@@ -1,20 +1,14 @@
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, and monitor accounts via structured Xquik endpoints. 2 tools (explore + tweetclaw), 2 commands (/xstatus, /xtrends)."
3
+ description: "Safety-reviewed guide for @xquik/tweetclaw, the Xquik OpenClaw plugin for structured X/Twitter workflows. Covers setup, credential boundaries, explicit approval for writes and paid actions, spending limits, private-data handling, and monitor controls."
4
4
  homepage: https://xquik.com
5
5
  read_when:
6
- - Posting, replying, liking, retweeting, or following on X/Twitter
7
- - Searching tweets or looking up X/Twitter users
8
- - Running giveaway draws from tweet replies
9
- - Monitoring X/Twitter accounts for new activity
10
- - Composing algorithm-optimized tweets
11
- - Extracting bulk data from X/Twitter (followers, replies, communities)
12
- - Downloading tweet media or uploading images
13
- - Sending DMs or updating X/Twitter profile
14
- - Checking credit balance
15
- - Browsing bookmarks, notifications, timeline, or DM history
16
- metadata: {"openclaw":{"emoji":"🐦","tags":["twitter","x","automation","social-media","tweets","scraping","giveaway","monitoring","rest-api","cheap-api"]}}
17
- license: MIT
6
+ - Installing or configuring the TweetClaw OpenClaw plugin
7
+ - Using Xquik from OpenClaw with explicit user approval
8
+ - Checking TweetClaw pricing, credentials, permissions, or safety boundaries
9
+ - Planning X/Twitter reads, writes, extractions, draws, or monitors safely
10
+ metadata: {"openclaw":{"emoji":"🐦","tags":["twitter","x","automation","social-media","tweets","scraping","giveaway","monitoring","rest-api","cheap-api"],"primaryEnv":"XQUIK_API_KEY","envVars":[{"name":"XQUIK_API_KEY","required":false,"description":"Optional Xquik API key for account-backed TweetClaw workflows. Prefer storing it in OpenClaw plugin config rather than exposing it to the agent session."},{"name":"MPP_SIGNING_KEY","required":false,"description":"Optional Machine Payments Protocol signing key for read-only pay-per-use mode. Store as sensitive OpenClaw plugin config and never print it."}]}}
11
+ license: MIT-0
18
12
  ---
19
13
 
20
14
  # TweetClaw
@@ -25,6 +19,22 @@ OpenClaw plugin for X/Twitter automation powered by Xquik.
25
19
  openclaw plugins install @xquik/tweetclaw
26
20
  ```
27
21
 
22
+ TweetClaw can be installed before credentials are configured. In that state, use `explore` for free endpoint discovery; live API calls will return setup guidance until the user configures an Xquik API key or MPP signing key.
23
+
24
+ ## Safety Rules
25
+
26
+ Use TweetClaw only for user-authorized X/Twitter workflows. Do not use it for spam, harassment, deceptive engagement, impersonation, credential collection, platform evasion, mass unsolicited DMs, or bulk follow/like/retweet campaigns.
27
+
28
+ Before any visible, state-changing, paid, or recurring action, summarize the exact target, account, action, text/media when relevant, and estimated credits, then wait for explicit user confirmation. This includes posting, replying, deleting, liking, retweeting, following, unfollowing, sending DMs, editing profiles, uploading media, creating webhooks, creating monitors, running draws, and starting extraction jobs.
29
+
30
+ For reads that expose private or account-scoped data, such as bookmarks, notifications, timelines, DMs, connected accounts, and account usage, confirm the user owns or is authorized to access the account before showing results. Redact credentials and avoid exposing sensitive personal data unless the user explicitly asks for that specific data.
31
+
32
+ For bulk extraction, draw, or monitor requests, keep limits narrow by default. State the requested limit, estimated cost, and storage or notification behavior. Ask for confirmation again if the user expands the scope, changes the target, or asks for recurring monitoring.
33
+
34
+ For content posting, show the final text and media list before sending. Do not post confidential, proprietary, personal, or third-party private information unless the user explicitly confirms they have the right to publish it. Do not add links, mentions, hashtags, or claims the user did not request.
35
+
36
+ MPP mode is read-only. Never attempt writes, account-backed actions, monitors, webhooks, DMs, profile changes, or uploads when only `tempoSigningKey` is configured. Treat the signing key as sensitive config and never print it.
37
+
28
38
  ## Pricing
29
39
 
30
40
  TweetClaw uses Xquik's credit-based pricing. 1 credit = $0.00015.
@@ -102,7 +112,7 @@ Do NOT use TweetClaw for browsing X in a browser, analytics dashboards, scheduli
102
112
 
103
113
  ## Configuration
104
114
 
105
- Credentials are stored in OpenClaw plugin config (not environment variables). Users configure them via `openclaw config set` commands - see the README for setup instructions.
115
+ Credentials are stored in OpenClaw plugin config after setup. Users should pass secrets through environment-variable commands and avoid pasting raw keys into chats, docs, shell history, or troubleshooting output.
106
116
 
107
117
  **IMPORTANT: Never log, echo, display, or include API keys or signing keys in tool output, chat responses, or error messages. Credentials are injected automatically by the plugin runtime - the agent must never handle them directly.**
108
118
 
@@ -124,20 +134,6 @@ Configure the signing key in your OpenClaw plugin config:
124
134
  { "tempoSigningKey": "your-66-char-hex-key" }
125
135
  ```
126
136
 
127
- ## Safety Rules
128
-
129
- Use TweetClaw only for user-authorized X/Twitter workflows. Do not use it for spam, harassment, deceptive engagement, impersonation, credential collection, platform evasion, mass unsolicited DMs, or bulk follow/like/retweet campaigns.
130
-
131
- Before any visible, state-changing, paid, or recurring action, summarize the exact target, account, action, text/media when relevant, and estimated credits, then wait for explicit user confirmation. This includes posting, replying, deleting, liking, retweeting, following, unfollowing, sending DMs, editing profiles, uploading media, creating webhooks, creating monitors, running draws, and starting extraction jobs.
132
-
133
- For reads that expose private or account-scoped data, such as bookmarks, notifications, timelines, DMs, connected accounts, and account usage, confirm the user owns or is authorized to access the account before showing results. Redact credentials and avoid exposing sensitive personal data unless the user explicitly asks for that specific data.
134
-
135
- For bulk extraction, draw, or monitor requests, keep limits narrow by default. State the requested limit, estimated cost, and storage or notification behavior. Ask for confirmation again if the user expands the scope, changes the target, or asks for recurring monitoring.
136
-
137
- For content posting, show the final text and media list before sending. Do not post confidential, proprietary, personal, or third-party private information unless the user explicitly confirms they have the right to publish it. Do not add links, mentions, hashtags, or claims the user did not request.
138
-
139
- MPP mode is read-only. Never attempt writes, account-backed actions, monitors, webhooks, DMs, profile changes, or uploads when only `tempoSigningKey` is configured. Treat the signing key as sensitive config and never print it.
140
-
141
137
  ## Tools
142
138
 
143
139
  TweetClaw registers 2 tools for the agent-safe Xquik endpoint catalog:
@@ -155,7 +151,8 @@ Structured endpoint invoker. The agent selects one endpoint from the catalog and
155
151
  - Only endpoints listed in the catalog can be invoked; unknown paths are rejected
156
152
  - Only the `xquik.com` origin can be reached; the runtime does not issue requests to any other host
157
153
  - No arbitrary commands, no shell, no filesystem access, no third-party network
158
- - The tool is registered as optional in OpenClaw. If it is unavailable after install, add `tweetclaw` to `tools.allow`
154
+ - The tool is registered as optional in OpenClaw. If the agent can see this skill but cannot call TweetClaw tools, add `explore` and `tweetclaw` to `tools.alsoAllow` so the normal tool profile stays intact
155
+ - After install or update, use `openclaw plugins inspect tweetclaw --runtime` and `openclaw skills info tweetclaw` to verify the runtime tool and skill registrations
159
156
 
160
157
  Example: "Post a tweet saying 'Hello from TweetClaw!'" invokes `POST /api/v1/x/tweets` with `{ account, text }` after fetching the connected account from `GET /api/v1/x/accounts`.
161
158
 
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ import { createProxiedRequest } from './request.js';
6
6
  import { createEventPoller } from './services/event-poller.js';
7
7
  import { normalizeMethod, requestNeedsApproval } from './tools/catalog.js';
8
8
  import { handleExplore, SEARCH_DESCRIPTION } from './tools/explore.js';
9
+ import { errorResult } from './tools/result.js';
9
10
  import { EXECUTE_DESCRIPTION, handleTweetclaw } from './tools/tweetclaw.js';
10
11
  import type { ExploreParams, FetchFunction, PluginConfig, TweetclawParams } from './types.js';
11
12
 
@@ -18,22 +19,16 @@ function isPollerEvent(value: unknown): value is PollerEvent {
18
19
  return typeof value === 'object' && value !== null;
19
20
  }
20
21
 
21
- function isPluginConfig(value: unknown): value is PluginConfig {
22
- if (typeof value !== 'object' || value === null) return false;
23
- return 'apiKey' in value || 'tempoSigningKey' in value;
24
- }
25
-
26
22
  const DEFAULT_POLLING_INTERVAL_SECONDS = 60;
23
+ const DEFAULT_BASE_URL = 'https://xquik.com';
24
+ const MISSING_CREDENTIALS_MESSAGE =
25
+ 'TweetClaw is installed but not configured. Add an Xquik API key for account-backed workflows or a Tempo signing key for MPP read-only mode in OpenClaw plugin config.';
27
26
 
28
27
  const CONFIG_SCHEMA = {
29
28
  additionalProperties: false,
30
- anyOf: [
31
- { required: ['apiKey'] },
32
- { required: ['tempoSigningKey'] },
33
- ],
34
29
  properties: {
35
30
  apiKey: {
36
- description: 'Xquik API key (get one at dashboard.xquik.com). Required for account-backed X automation.',
31
+ description: 'Xquik API key (get one at dashboard.xquik.com). Use for account-backed X automation.',
37
32
  minLength: 1,
38
33
  type: 'string',
39
34
  },
@@ -45,7 +40,7 @@ const CONFIG_SCHEMA = {
45
40
  type: 'number',
46
41
  },
47
42
  tempoSigningKey: {
48
- description: 'MPP signing key for pay-per-use mode. No account needed. 32 read-only X-API endpoints.',
43
+ description: 'MPP signing key for pay-per-use mode. Use for accountless access to 32 read-only X-API endpoints.',
49
44
  minLength: 1,
50
45
  type: 'string',
51
46
  },
@@ -86,6 +81,22 @@ type BeforeToolCallHandler = (
86
81
  event: BeforeToolCallEvent,
87
82
  ) => BeforeToolCallResult | Promise<BeforeToolCallResult | undefined> | undefined;
88
83
 
84
+ type CredentialMode = 'api-key' | 'mpp' | 'none';
85
+ type XquikRequest = ReturnType<typeof createProxiedRequest>;
86
+
87
+ interface RegisterToolsOptions {
88
+ readonly baseUrl: string;
89
+ readonly credential: string;
90
+ readonly credentialMode: CredentialMode;
91
+ readonly fetchFunction?: FetchFunction;
92
+ }
93
+
94
+ interface CredentialState {
95
+ readonly accountValue: string;
96
+ readonly mode: CredentialMode;
97
+ readonly signingValue: string;
98
+ }
99
+
89
100
  interface OpenClawApi {
90
101
  readonly logger: {
91
102
  readonly debug?: (message: string) => void;
@@ -142,7 +153,11 @@ const EXPLORE_PARAMETERS = {
142
153
  const TWEETCLAW_PARAMETERS = {
143
154
  additionalProperties: false,
144
155
  properties: {
145
- body: { description: 'JSON request body', type: ['object', 'array', 'string', 'number', 'boolean', 'null'] },
156
+ body: {
157
+ description: 'JSON request body',
158
+ items: {},
159
+ type: ['object', 'array', 'string', 'number', 'boolean', 'null'],
160
+ },
146
161
  method: { default: 'GET', description: 'HTTP method', enum: ['GET', 'POST', 'PATCH', 'PUT', 'DELETE'], type: 'string' },
147
162
  path: { description: 'Concrete /api/v1/... endpoint path from the catalog', type: 'string' },
148
163
  query: {
@@ -162,6 +177,20 @@ function asObject(value: unknown): Readonly<Record<string, unknown>> | undefined
162
177
  return Object.fromEntries(Object.entries(value));
163
178
  }
164
179
 
180
+ function asPluginConfig(value: unknown): PluginConfig {
181
+ const config = asObject(value);
182
+ if (config === undefined) return {};
183
+
184
+ const { apiKey, baseUrl, pollingEnabled, pollingInterval, tempoSigningKey } = config;
185
+ return {
186
+ ...(typeof apiKey === 'string' && apiKey.length > 0 ? { apiKey } : {}),
187
+ ...(typeof baseUrl === 'string' && baseUrl.length > 0 ? { baseUrl } : {}),
188
+ ...(typeof pollingEnabled === 'boolean' ? { pollingEnabled } : {}),
189
+ ...(typeof pollingInterval === 'number' ? { pollingInterval } : {}),
190
+ ...(typeof tempoSigningKey === 'string' && tempoSigningKey.length > 0 ? { tempoSigningKey } : {}),
191
+ };
192
+ }
193
+
165
194
  function asExploreParams(params: unknown): Readonly<ExploreParams> {
166
195
  const value = asObject(params);
167
196
  if (value === undefined) return {};
@@ -258,35 +287,35 @@ function registerWriteApprovalHook(api: OpenClawApi): void {
258
287
  );
259
288
  }
260
289
 
261
- function register(api: OpenClawApi, fetchFunction?: FetchFunction): void {
262
- const config: unknown = api.pluginConfig;
263
- if (!isPluginConfig(config)) {
264
- api.logger.warn(
265
- 'TweetClaw: No API key or signing key configured. See the README for setup instructions.',
266
- );
267
- return;
290
+ function resolveCredentialState(config: Readonly<PluginConfig>): CredentialState {
291
+ const accountValue = config.apiKey;
292
+ if (accountValue !== undefined) {
293
+ return { accountValue, mode: 'api-key', signingValue: '' };
268
294
  }
269
295
 
270
- const { apiKey, baseUrl = 'https://xquik.com', tempoSigningKey } = config;
271
- const isMppMode = apiKey === undefined && tempoSigningKey !== undefined;
272
- const credential = apiKey ?? '';
273
-
274
- if (isMppMode) {
275
- void (async (): Promise<void> => {
276
- try {
277
- await initMpp(tempoSigningKey);
278
- api.logger.info('TweetClaw: MPP initialized - payment account ready');
279
- } catch (error: unknown) {
280
- api.logger.error(`TweetClaw: MPP init failed - ${error instanceof Error ? error.message : String(error)}`);
281
- }
282
- })();
283
- api.logger.info('TweetClaw: MPP mode - pay-per-use (32 X-API endpoints, no subscription needed)');
296
+ const signingValue = config.tempoSigningKey;
297
+ if (signingValue !== undefined) {
298
+ return { accountValue: '', mode: 'mpp', signingValue };
284
299
  }
285
300
 
286
- const request = createProxiedRequest(baseUrl, credential, fetchFunction);
287
- registerWriteApprovalHook(api);
301
+ return { accountValue: '', mode: 'none', signingValue: '' };
302
+ }
303
+
304
+ function registerMppMode(api: OpenClawApi, credentialMode: CredentialMode, signingValue: string): void {
305
+ if (credentialMode !== 'mpp') return;
306
+
307
+ void (async (): Promise<void> => {
308
+ try {
309
+ await initMpp(signingValue);
310
+ api.logger.info('TweetClaw: MPP initialized - payment account ready');
311
+ } catch (error: unknown) {
312
+ api.logger.error(`TweetClaw: MPP init failed - ${error instanceof Error ? error.message : String(error)}`);
313
+ }
314
+ })();
315
+ api.logger.info('TweetClaw: MPP mode - pay-per-use (32 X-API endpoints, no subscription needed)');
316
+ }
288
317
 
289
- // --- Tools (2-tool approach, execute inside tool object) ---
318
+ function registerTools(api: OpenClawApi, options: RegisterToolsOptions): void {
290
319
  api.registerTool(
291
320
  {
292
321
  description: SEARCH_DESCRIPTION,
@@ -303,21 +332,28 @@ function register(api: OpenClawApi, fetchFunction?: FetchFunction): void {
303
332
  api.registerTool(
304
333
  {
305
334
  description: EXECUTE_DESCRIPTION,
306
- execute: async (_toolCallId, params) => handleTweetclaw({
307
- apiKey: credential,
308
- baseUrl,
309
- fetchFunction,
310
- mppMode: isMppMode,
311
- params: asTweetclawParams(params),
312
- }),
335
+ execute: async (_toolCallId, params) => {
336
+ if (options.credentialMode === 'none') {
337
+ await Promise.resolve();
338
+ return errorResult(new Error(MISSING_CREDENTIALS_MESSAGE));
339
+ }
340
+ return handleTweetclaw({
341
+ baseUrl: options.baseUrl,
342
+ credential: options.credential,
343
+ fetchFunction: options.fetchFunction,
344
+ mppMode: options.credentialMode === 'mpp',
345
+ params: asTweetclawParams(params),
346
+ });
347
+ },
313
348
  name: 'tweetclaw',
314
349
  parameters: TWEETCLAW_PARAMETERS,
315
350
  },
316
351
  { name: 'tweetclaw', optional: true },
317
352
  );
353
+ }
318
354
 
319
- // --- Commands (instant, no LLM) ---
320
- if (!isMppMode) {
355
+ function registerCommands(api: OpenClawApi, credentialMode: CredentialMode, request: XquikRequest): void {
356
+ if (credentialMode === 'api-key') {
321
357
  api.registerCommand({
322
358
  description: 'Show Xquik account status & usage',
323
359
  handler: async () => {
@@ -337,33 +373,55 @@ function register(api: OpenClawApi, fetchFunction?: FetchFunction): void {
337
373
  },
338
374
  name: 'xtrends',
339
375
  });
376
+ }
340
377
 
341
- // --- Background event poller (requires API key, not available in MPP mode) ---
342
- const { pollingEnabled, pollingInterval } = config;
343
- if (!isMppMode && pollingEnabled !== false) {
344
- const poller = createEventPoller({
345
- intervalSeconds: pollingInterval ?? DEFAULT_POLLING_INTERVAL_SECONDS,
346
- onEvents: (events) => {
347
- for (const event of events) {
348
- const eventType: string = isPollerEvent(event) && typeof event['eventType'] === 'string'
349
- ? event['eventType']
350
- : 'unknown';
351
- const username: string = isPollerEvent(event) && typeof event['xUsername'] === 'string'
352
- ? event['xUsername']
353
- : '';
354
- api.logger.info(`[TweetClaw] ${eventType} from @${username}`);
355
- }
356
- },
357
- request,
358
- });
378
+ function registerPoller(api: OpenClawApi, config: Readonly<PluginConfig>, credentialMode: CredentialMode, request: XquikRequest): void {
379
+ if (credentialMode !== 'api-key' || config.pollingEnabled === false) return;
380
+
381
+ const poller = createEventPoller({
382
+ intervalSeconds: config.pollingInterval ?? DEFAULT_POLLING_INTERVAL_SECONDS,
383
+ onEvents: (events) => {
384
+ for (const event of events) {
385
+ const eventType: string = isPollerEvent(event) && typeof event['eventType'] === 'string'
386
+ ? event['eventType']
387
+ : 'unknown';
388
+ const username: string = isPollerEvent(event) && typeof event['xUsername'] === 'string'
389
+ ? event['xUsername']
390
+ : '';
391
+ api.logger.info(`[TweetClaw] ${eventType} from @${username}`);
392
+ }
393
+ },
394
+ request,
395
+ });
359
396
 
360
- api.registerService({
361
- id: 'tweetclaw-poller',
362
- start: () => { poller.start(); },
363
- stop: () => { poller.stop(); },
364
- });
397
+ api.registerService({
398
+ id: 'tweetclaw-poller',
399
+ start: () => { poller.start(); },
400
+ stop: () => { poller.stop(); },
401
+ });
402
+ }
403
+
404
+ function register(api: OpenClawApi, fetchFunction?: FetchFunction): void {
405
+ const config = asPluginConfig(api.pluginConfig);
406
+ const { baseUrl = DEFAULT_BASE_URL } = config;
407
+ const credential = resolveCredentialState(config);
408
+
409
+ registerMppMode(api, credential.mode, credential.signingValue);
410
+ const request = createProxiedRequest(baseUrl, credential.accountValue, fetchFunction);
411
+ registerWriteApprovalHook(api);
412
+
413
+ if (credential.mode === 'none') {
414
+ api.logger.warn(
415
+ 'TweetClaw: No API key or signing key configured. Install succeeded; configure credentials before network calls.',
416
+ );
365
417
  }
366
418
 
419
+ const toolOptions: RegisterToolsOptions = fetchFunction === undefined
420
+ ? { baseUrl, credential: credential.accountValue, credentialMode: credential.mode }
421
+ : { baseUrl, credential: credential.accountValue, credentialMode: credential.mode, fetchFunction };
422
+ registerTools(api, toolOptions);
423
+ registerCommands(api, credential.mode, request);
424
+ registerPoller(api, config, credential.mode, request);
367
425
  api.logger.info('TweetClaw: Plugin registered successfully');
368
426
  }
369
427
 
package/src/request.ts CHANGED
@@ -86,7 +86,7 @@ function validateRequestPath(method: string, path: string): void {
86
86
 
87
87
  function createProxiedRequest(
88
88
  baseUrl: string,
89
- apiKey: string,
89
+ credential: string,
90
90
  fetchFunction: FetchFunction = fetch,
91
91
  ): RequestFunction {
92
92
  return async (path: string, options?: Readonly<RequestOptions>): Promise<unknown> => {
@@ -95,7 +95,7 @@ function createProxiedRequest(
95
95
  const hasBody = options?.body !== undefined;
96
96
  const response = await fetchFunction(buildFetchUrl(baseUrl, path, options?.query), {
97
97
  ...(hasBody ? { body: JSON.stringify(options.body) } : {}),
98
- headers: buildFetchHeaders(apiKey, hasBody),
98
+ headers: buildFetchHeaders(credential, hasBody),
99
99
  method,
100
100
  signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),
101
101
  });
@@ -40,8 +40,8 @@ const EXECUTION_TIMEOUT_MS = 30_000;
40
40
  const MS_PER_SECOND = 1000;
41
41
 
42
42
  interface TweetclawOptions {
43
- readonly apiKey: string;
44
43
  readonly baseUrl: string;
44
+ readonly credential: string;
45
45
  readonly fetchFunction?: FetchFunction | undefined;
46
46
  readonly mppMode?: boolean | undefined;
47
47
  readonly params: Readonly<TweetclawParams>;
@@ -50,8 +50,8 @@ interface TweetclawOptions {
50
50
 
51
51
  async function handleTweetclaw(options: Readonly<TweetclawOptions>): Promise<ToolResult> {
52
52
  const {
53
- apiKey,
54
53
  baseUrl,
54
+ credential,
55
55
  fetchFunction,
56
56
  mppMode = false,
57
57
  params,
@@ -60,7 +60,7 @@ async function handleTweetclaw(options: Readonly<TweetclawOptions>): Promise<Too
60
60
 
61
61
  try {
62
62
  const requestInfo = resolveCatalogRequest(params, { mppMode });
63
- const request: RequestFunction = createProxiedRequest(baseUrl, apiKey, fetchFunction);
63
+ const request: RequestFunction = createProxiedRequest(baseUrl, credential, fetchFunction);
64
64
  const result: unknown = await Promise.race([
65
65
  request(requestInfo.path, {
66
66
  ...(requestInfo.body === undefined ? {} : { body: requestInfo.body }),