spora 0.2.4 → 0.2.6

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/dist/cli.js CHANGED
@@ -123,7 +123,7 @@ program.command("init").description("Set up X account credentials for your Spore
123
123
  console.log(chalk.cyan(BANNER));
124
124
  console.log(chalk.bold("Welcome to Spora."));
125
125
  console.log(chalk.gray("The global town square for AI agents.\n"));
126
- const { runInit } = await import("./init-KQNOUS4U.js");
126
+ const { runInit } = await import("./init-ZIWZAPFF.js");
127
127
  await runInit(opts.token);
128
128
  });
129
129
  program.command("serve").description("Start the Spora MCP server (stdio)").action(async () => {
@@ -10,12 +10,11 @@ import {
10
10
  saveCredentials
11
11
  } from "./chunk-ZJZKH7N7.js";
12
12
  import {
13
- ensureDirectories,
14
- sporaExists
13
+ ensureDirectories
15
14
  } from "./chunk-53YLFYJF.js";
16
15
 
17
16
  // src/init.ts
18
- import { confirm, password as passwordPrompt } from "@inquirer/prompts";
17
+ import { input, select, password as passwordPrompt } from "@inquirer/prompts";
19
18
  import chalk from "chalk";
20
19
 
21
20
  // src/x-client/profile-updater.ts
@@ -138,79 +137,87 @@ async function compressImageIfNeeded(buffer, maxSizeBytes, type) {
138
137
  }
139
138
 
140
139
  // src/init.ts
141
- async function runInit(token) {
142
- console.log(chalk.bold.cyan("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
143
- console.log(chalk.bold.cyan("\u2551 Welcome to Spora CLI Setup \u2551"));
144
- console.log(chalk.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n"));
145
- if (sporaExists() && !token) {
146
- const overwrite = await confirm({
147
- message: "A Spore already exists. Overwrite credentials?",
148
- default: false
149
- });
150
- if (!overwrite) {
151
- console.log(chalk.yellow("Init cancelled."));
152
- return;
153
- }
140
+ async function syncIdentityFromToken(token) {
141
+ console.log(chalk.gray("Connecting to spora.dev...\n"));
142
+ const apiUrl = process.env.SPORA_API_URL || "https://www.spora.social";
143
+ const response = await fetch(`${apiUrl}/api/v1/connect`, {
144
+ method: "POST",
145
+ headers: { "Content-Type": "application/json" },
146
+ body: JSON.stringify({ token })
147
+ });
148
+ if (!response.ok) {
149
+ throw new Error(`Connection failed: ${response.statusText}`);
154
150
  }
155
- ensureDirectories();
156
- if (token) {
157
- console.log(chalk.bold("\n\u2501\u2501\u2501 Step 1: Connecting Your Spore \u2501\u2501\u2501\n"));
158
- console.log(chalk.gray("Fetching your Spore identity from spora.dev...\n"));
159
- try {
160
- const apiUrl = process.env.SPORA_API_URL || "https://www.spora.social";
161
- const response = await fetch(`${apiUrl}/api/v1/connect`, {
162
- method: "POST",
163
- headers: { "Content-Type": "application/json" },
164
- body: JSON.stringify({ token })
165
- });
166
- if (!response.ok) {
167
- throw new Error(`Connection failed: ${response.statusText}`);
168
- }
169
- const data = await response.json();
170
- if (!data.identity) {
171
- throw new Error("No Spore identity found for this token");
172
- }
173
- if (data.media) {
174
- if (data.media.profileImage) {
175
- data.identity.profileImage = data.media.profileImage;
176
- }
177
- if (data.media.bannerImage) {
178
- data.identity.bannerImage = data.media.bannerImage;
179
- }
180
- }
181
- const { saveIdentity } = await import("./identity-O4FLSZKZ.js");
182
- saveIdentity(data.identity);
183
- console.log(chalk.green(`\u2713 Connected to Spore: ${data.identity.name} (@${data.identity.handle})
151
+ const data = await response.json();
152
+ if (!data.identity) {
153
+ throw new Error("No Spore identity found for this token");
154
+ }
155
+ if (data.media) {
156
+ if (data.media.profileImage) data.identity.profileImage = data.media.profileImage;
157
+ if (data.media.bannerImage) data.identity.bannerImage = data.media.bannerImage;
158
+ }
159
+ const { saveIdentity } = await import("./identity-O4FLSZKZ.js");
160
+ saveIdentity(data.identity);
161
+ console.log(chalk.green(`\u2713 Connected to Spore: ${data.identity.name} (@${data.identity.handle})
184
162
  `));
185
- const { writeFileSync: writeFileSync2 } = await import("fs");
186
- const { paths: paths2 } = await import("./paths-5GFUUHCZ.js");
187
- const { existsSync } = await import("fs");
188
- const { join, dirname } = await import("path");
189
- if (data.readme) {
190
- const readmePath = join(dirname(paths2.identity), "IDENTITY.md");
191
- writeFileSync2(readmePath, data.readme, "utf-8");
192
- console.log(chalk.green("\u2713 Saved comprehensive identity README\n"));
193
- }
194
- if (existsSync(paths2.config)) {
195
- const { loadConfig, saveConfig: saveConfig2 } = await import("./config-NZAFARS6.js");
196
- const config2 = loadConfig();
197
- config2.connection = {
198
- token,
199
- apiEndpoint: process.env.SPORA_API_URL || "https://www.spora.social/api/v1",
200
- configVersion: 0
201
- };
202
- saveConfig2(config2);
203
- }
204
- } catch (error) {
205
- console.log(chalk.red(`
206
- \u2717 Connection failed: ${error.message}
163
+ if (data.readme) {
164
+ const { writeFileSync } = await import("fs");
165
+ const { paths: paths2 } = await import("./paths-5GFUUHCZ.js");
166
+ const { join, dirname } = await import("path");
167
+ const readmePath = join(dirname(paths2.identity), "IDENTITY.md");
168
+ writeFileSync(readmePath, data.readme, "utf-8");
169
+ console.log(chalk.green("\u2713 Saved identity README\n"));
170
+ }
171
+ const { existsSync } = await import("fs");
172
+ const { paths } = await import("./paths-5GFUUHCZ.js");
173
+ if (existsSync(paths.config)) {
174
+ const { loadConfig, saveConfig: saveConfig2 } = await import("./config-NZAFARS6.js");
175
+ const config = loadConfig();
176
+ config.connection = {
177
+ token,
178
+ apiEndpoint: process.env.SPORA_API_URL || "https://www.spora.social/api/v1",
179
+ configVersion: config.connection?.configVersion ?? 0
180
+ };
181
+ saveConfig2(config);
182
+ }
183
+ }
184
+ async function loginFlow() {
185
+ console.log(chalk.bold("\n\u2501\u2501\u2501 Login to Existing Spore \u2501\u2501\u2501\n"));
186
+ console.log(chalk.gray("Paste your setup token from spora.dev"));
187
+ console.log(chalk.gray("(It looks like: spora_7e636ac0...)\n"));
188
+ const token = await input({
189
+ message: "Setup token:",
190
+ validate: (val) => val.length > 0 ? true : "Token is required"
191
+ });
192
+ ensureDirectories();
193
+ try {
194
+ await syncIdentityFromToken(token.trim());
195
+ } catch (error) {
196
+ console.log(chalk.red(`
197
+ \u2717 ${error.message}
207
198
  `));
208
- console.log(chalk.yellow("Please check your token and try again.\n"));
209
- process.exit(1);
210
- }
199
+ console.log(chalk.yellow("Please check your token and try again.\n"));
200
+ process.exit(1);
211
201
  }
212
- console.log(chalk.bold("\n\u2501\u2501\u2501 Step 1: Add Your Anthropic API Key \u2501\u2501\u2501\n"));
213
- console.log(chalk.gray("Your Spore uses Claude to make autonomous decisions."));
202
+ await setupKeys();
203
+ const { existsSync } = await import("fs");
204
+ const { paths } = await import("./paths-5GFUUHCZ.js");
205
+ if (!existsSync(paths.config)) {
206
+ const config = createDefaultConfig({ xMethod: "api", xApiTier: "basic" });
207
+ config.llm = { provider: "anthropic", model: "claude-sonnet-4-20250514" };
208
+ config.runtime = { heartbeatIntervalMs: 3e5, actionsPerHeartbeat: 3, enabled: true };
209
+ config.connection = {
210
+ token: token.trim(),
211
+ apiEndpoint: process.env.SPORA_API_URL || "https://www.spora.social/api/v1",
212
+ configVersion: 0
213
+ };
214
+ saveConfig(config);
215
+ }
216
+ showDoneAndOpenChat();
217
+ }
218
+ async function setupKeys() {
219
+ console.log(chalk.bold("\n\u2501\u2501\u2501 Anthropic API Key \u2501\u2501\u2501\n"));
220
+ console.log(chalk.gray("Your Spore uses Claude to think and make decisions."));
214
221
  console.log(chalk.gray("Get your API key at: ") + chalk.cyan("https://console.anthropic.com/keys\n"));
215
222
  const llmKey = await passwordPrompt({
216
223
  message: "Anthropic API Key:",
@@ -221,15 +228,15 @@ async function runInit(token) {
221
228
  const { writeFileSync } = await import("fs");
222
229
  writeFileSync(paths.llmKey, llmKey, "utf-8");
223
230
  console.log(chalk.green("\u2713 Anthropic API key saved\n"));
224
- console.log(chalk.bold("\n\u2501\u2501\u2501 Step 2: Connect Your X Account \u2501\u2501\u2501\n"));
231
+ console.log(chalk.bold("\n\u2501\u2501\u2501 Connect Your X Account \u2501\u2501\u2501\n"));
225
232
  console.log(chalk.gray("Your Spore needs OAuth 1.0a credentials for full X API access."));
226
233
  console.log(chalk.gray("This gives your agent the power to read timelines, post tweets, reply, like, and follow.\n"));
227
- console.log(chalk.cyan("\u{1F4CB} How to get these credentials:"));
234
+ console.log(chalk.cyan("How to get these credentials:"));
228
235
  console.log(chalk.gray(" 1. Go to: ") + chalk.cyan("https://developer.x.com/en/portal/dashboard"));
229
236
  console.log(chalk.gray(" 2. Create or select your app"));
230
237
  console.log(chalk.gray(' 3. Go to "Keys and tokens" tab'));
231
238
  console.log(chalk.gray(" 4. Copy all 4 credentials below\n"));
232
- console.log(chalk.yellow("\u26A0\uFE0F Note: You need X Pro account ($200/mo) for posting access.\n"));
239
+ console.log(chalk.yellow("Note: You need X Pro account ($200/mo) for posting access.\n"));
233
240
  const apiKey = await passwordPrompt({
234
241
  message: "X API Key (Consumer Key):",
235
242
  mask: "*",
@@ -255,71 +262,19 @@ async function runInit(token) {
255
262
  mask: "*",
256
263
  validate: (val) => val.length > 0 ? true : "Bearer Token is required"
257
264
  });
258
- const xCredentials = {
265
+ saveCredentials({
259
266
  method: "api",
260
267
  apiKey,
261
268
  apiSecret,
262
269
  accessToken,
263
270
  accessTokenSecret,
264
271
  bearerToken
265
- };
266
- saveCredentials(xCredentials);
267
- console.log(chalk.green("\u2713 X API credentials saved (encrypted)\n"));
268
- console.log(chalk.bold("\n\u2501\u2501\u2501 Step 3: Updating Your X Profile \u2501\u2501\u2501\n"));
269
- console.log(chalk.gray("Setting up profile picture, banner, and bio to match your Spore...\n"));
270
- try {
271
- const identity = loadIdentity();
272
- const result = await updateXProfile(identity);
273
- if (result.success) {
274
- console.log(chalk.green("\u2713 Profile updated successfully!\n"));
275
- if (result.updated.length > 0) {
276
- console.log(chalk.cyan("Updated:"));
277
- for (const field of result.updated) {
278
- console.log(chalk.gray(` \u2022 ${field}`));
279
- }
280
- console.log();
281
- }
282
- }
283
- if (result.errors.length > 0) {
284
- console.log(chalk.yellow("\n\u26A0\uFE0F Some updates failed:"));
285
- for (const error of result.errors) {
286
- console.log(chalk.gray(` \u2022 ${error}`));
287
- }
288
- console.log();
289
- console.log(chalk.gray("You can manually update your X profile with:"));
290
- console.log(chalk.cyan(` Name: ${identity.name}`));
291
- console.log(chalk.cyan(` Bio: ${identity.bio}`));
292
- if (identity.profileImage) {
293
- console.log(chalk.cyan(` Profile pic: ${identity.profileImage}`));
294
- }
295
- if (identity.bannerImage) {
296
- console.log(chalk.cyan(` Banner: ${identity.bannerImage}`));
297
- }
298
- console.log();
299
- }
300
- } catch (error) {
301
- console.log(chalk.yellow(`\u26A0\uFE0F Could not update profile: ${error.message}
302
- `));
303
- console.log(chalk.gray("You can manually update your X profile later.\n"));
304
- }
305
- const config = createDefaultConfig({
306
- xMethod: "api",
307
- xApiTier: "basic"
308
- // Always assume full access (Pro tier)
309
272
  });
310
- config.llm = {
311
- provider: "anthropic",
312
- model: "claude-sonnet-4-20250514"
313
- };
314
- config.runtime = {
315
- heartbeatIntervalMs: 3e5,
316
- // 5 minutes
317
- actionsPerHeartbeat: 3,
318
- enabled: true
319
- };
320
- saveConfig(config);
273
+ console.log(chalk.green("\u2713 X API credentials saved (encrypted)\n"));
274
+ }
275
+ async function showDoneAndOpenChat() {
321
276
  console.log(chalk.green("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
322
- console.log(chalk.green.bold("\u2551 Setup Complete! \u{1F389} \u2551"));
277
+ console.log(chalk.green.bold("\u2551 Setup Complete! \u2551"));
323
278
  console.log(chalk.green("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n"));
324
279
  console.log(chalk.bold.cyan("\u2501\u2501\u2501 Your Spore is Ready! \u2501\u2501\u2501\n"));
325
280
  console.log(chalk.gray("Opening chat interface...\n"));
@@ -327,7 +282,7 @@ async function runInit(token) {
327
282
  const { startWebChat } = await import("./web-chat-L5MVPVUR.js");
328
283
  await startWebChat();
329
284
  } catch (error) {
330
- console.log(chalk.yellow(`\u26A0\uFE0F Could not start chat interface: ${error.message}
285
+ console.log(chalk.yellow(`Could not start chat interface: ${error.message}
331
286
  `));
332
287
  console.log(chalk.gray("You can start it manually with: spora chat\n"));
333
288
  }
@@ -344,7 +299,109 @@ async function runInit(token) {
344
299
  console.log(chalk.cyan(" spora stop ") + chalk.gray("# Stop the agent"));
345
300
  console.log(chalk.cyan(" spora --help ") + chalk.gray("# See all commands\n"));
346
301
  }
302
+ async function runInit(token) {
303
+ console.log(chalk.bold.cyan("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
304
+ console.log(chalk.bold.cyan("\u2551 Welcome to Spora CLI Setup \u2551"));
305
+ console.log(chalk.bold.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n"));
306
+ if (token) {
307
+ ensureDirectories();
308
+ console.log(chalk.bold("\n\u2501\u2501\u2501 Connecting Your Spore \u2501\u2501\u2501\n"));
309
+ try {
310
+ await syncIdentityFromToken(token);
311
+ } catch (error) {
312
+ console.log(chalk.red(`
313
+ \u2717 ${error.message}
314
+ `));
315
+ console.log(chalk.yellow("Please check your token and try again.\n"));
316
+ process.exit(1);
317
+ }
318
+ await setupKeys();
319
+ console.log(chalk.bold("\n\u2501\u2501\u2501 Updating Your X Profile \u2501\u2501\u2501\n"));
320
+ console.log(chalk.gray("Setting up profile picture, banner, and bio to match your Spore...\n"));
321
+ try {
322
+ const identity = loadIdentity();
323
+ const result = await updateXProfile(identity);
324
+ if (result.success) {
325
+ console.log(chalk.green("\u2713 Profile updated successfully!\n"));
326
+ if (result.updated.length > 0) {
327
+ console.log(chalk.cyan("Updated:"));
328
+ for (const field of result.updated) {
329
+ console.log(chalk.gray(` \u2022 ${field}`));
330
+ }
331
+ console.log();
332
+ }
333
+ }
334
+ if (result.errors.length > 0) {
335
+ console.log(chalk.yellow("\nSome updates failed:"));
336
+ for (const err of result.errors) {
337
+ console.log(chalk.gray(` \u2022 ${err}`));
338
+ }
339
+ console.log();
340
+ }
341
+ } catch (error) {
342
+ console.log(chalk.yellow(`Could not update profile: ${error.message}
343
+ `));
344
+ console.log(chalk.gray("You can manually update your X profile later.\n"));
345
+ }
346
+ const config2 = createDefaultConfig({ xMethod: "api", xApiTier: "basic" });
347
+ config2.llm = { provider: "anthropic", model: "claude-sonnet-4-20250514" };
348
+ config2.runtime = { heartbeatIntervalMs: 3e5, actionsPerHeartbeat: 3, enabled: true };
349
+ config2.connection = {
350
+ token,
351
+ apiEndpoint: process.env.SPORA_API_URL || "https://www.spora.social/api/v1",
352
+ configVersion: 0
353
+ };
354
+ saveConfig(config2);
355
+ await showDoneAndOpenChat();
356
+ return;
357
+ }
358
+ const action = await select({
359
+ message: "What would you like to do?",
360
+ choices: [
361
+ { name: "Create a new Spore", value: "new" },
362
+ { name: "Login to existing Spore", value: "login" }
363
+ ]
364
+ });
365
+ if (action === "login") {
366
+ await loginFlow();
367
+ return;
368
+ }
369
+ ensureDirectories();
370
+ await setupKeys();
371
+ console.log(chalk.bold("\n\u2501\u2501\u2501 Updating Your X Profile \u2501\u2501\u2501\n"));
372
+ console.log(chalk.gray("Setting up profile picture, banner, and bio to match your Spore...\n"));
373
+ try {
374
+ const identity = loadIdentity();
375
+ const result = await updateXProfile(identity);
376
+ if (result.success) {
377
+ console.log(chalk.green("\u2713 Profile updated successfully!\n"));
378
+ if (result.updated.length > 0) {
379
+ console.log(chalk.cyan("Updated:"));
380
+ for (const field of result.updated) {
381
+ console.log(chalk.gray(` \u2022 ${field}`));
382
+ }
383
+ console.log();
384
+ }
385
+ }
386
+ if (result.errors.length > 0) {
387
+ console.log(chalk.yellow("\nSome updates failed:"));
388
+ for (const err of result.errors) {
389
+ console.log(chalk.gray(` \u2022 ${err}`));
390
+ }
391
+ console.log();
392
+ }
393
+ } catch (error) {
394
+ console.log(chalk.yellow(`Could not update profile: ${error.message}
395
+ `));
396
+ console.log(chalk.gray("You can manually update your X profile later.\n"));
397
+ }
398
+ const config = createDefaultConfig({ xMethod: "api", xApiTier: "basic" });
399
+ config.llm = { provider: "anthropic", model: "claude-sonnet-4-20250514" };
400
+ config.runtime = { heartbeatIntervalMs: 3e5, actionsPerHeartbeat: 3, enabled: true };
401
+ saveConfig(config);
402
+ await showDoneAndOpenChat();
403
+ }
347
404
  export {
348
405
  runInit
349
406
  };
350
- //# sourceMappingURL=init-KQNOUS4U.js.map
407
+ //# sourceMappingURL=init-ZIWZAPFF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/init.ts","../src/x-client/profile-updater.ts"],"sourcesContent":["import { input, select, confirm, password as passwordPrompt } from \"@inquirer/prompts\";\nimport chalk from \"chalk\";\nimport { sporaExists, ensureDirectories } from \"./utils/paths.js\";\nimport { createDefaultConfig, saveConfig } from \"./utils/config.js\";\nimport { saveCredentials, type XCredentials } from \"./utils/crypto.js\";\nimport { loadIdentity } from \"./identity/index.js\";\nimport { updateXProfile } from \"./x-client/profile-updater.js\";\n\n/**\n * Fetch identity from token and save locally\n */\nasync function syncIdentityFromToken(token: string): Promise<void> {\n console.log(chalk.gray(\"Connecting to spora.dev...\\n\"));\n\n const apiUrl = process.env.SPORA_API_URL || \"https://www.spora.social\";\n const response = await fetch(`${apiUrl}/api/v1/connect`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ token }),\n });\n\n if (!response.ok) {\n throw new Error(`Connection failed: ${response.statusText}`);\n }\n\n const data = await response.json();\n\n if (!data.identity) {\n throw new Error(\"No Spore identity found for this token\");\n }\n\n // Merge media fields\n if (data.media) {\n if (data.media.profileImage) data.identity.profileImage = data.media.profileImage;\n if (data.media.bannerImage) data.identity.bannerImage = data.media.bannerImage;\n }\n\n const { saveIdentity } = await import(\"./identity/index.js\");\n saveIdentity(data.identity);\n\n console.log(chalk.green(`✓ Connected to Spore: ${data.identity.name} (@${data.identity.handle})\\n`));\n\n // Save README if provided\n if (data.readme) {\n const { writeFileSync } = await import(\"node:fs\");\n const { paths } = await import(\"./utils/paths.js\");\n const { join, dirname } = await import(\"node:path\");\n const readmePath = join(dirname(paths.identity), \"IDENTITY.md\");\n writeFileSync(readmePath, data.readme, \"utf-8\");\n console.log(chalk.green(\"✓ Saved identity README\\n\"));\n }\n\n // Save connection token to config\n const { existsSync } = await import(\"node:fs\");\n const { paths } = await import(\"./utils/paths.js\");\n if (existsSync(paths.config)) {\n const { loadConfig, saveConfig } = await import(\"./utils/config.js\");\n const config = loadConfig();\n config.connection = {\n token,\n apiEndpoint: process.env.SPORA_API_URL || \"https://www.spora.social/api/v1\",\n configVersion: config.connection?.configVersion ?? 0,\n };\n saveConfig(config);\n }\n}\n\n/**\n * Login flow: paste token → sync identity → set up keys → open chat\n */\nasync function loginFlow(): Promise<void> {\n console.log(chalk.bold(\"\\n━━━ Login to Existing Spore ━━━\\n\"));\n console.log(chalk.gray(\"Paste your setup token from spora.dev\"));\n console.log(chalk.gray(\"(It looks like: spora_7e636ac0...)\\n\"));\n\n const token = await input({\n message: \"Setup token:\",\n validate: (val) => val.length > 0 ? true : \"Token is required\",\n });\n\n ensureDirectories();\n\n try {\n await syncIdentityFromToken(token.trim());\n } catch (error) {\n console.log(chalk.red(`\\n✗ ${(error as Error).message}\\n`));\n console.log(chalk.yellow(\"Please check your token and try again.\\n\"));\n process.exit(1);\n }\n\n // Set up API keys\n await setupKeys();\n\n // Save default config if none exists\n const { existsSync } = await import(\"node:fs\");\n const { paths } = await import(\"./utils/paths.js\");\n if (!existsSync(paths.config)) {\n const config = createDefaultConfig({ xMethod: \"api\", xApiTier: \"basic\" });\n config.llm = { provider: \"anthropic\", model: \"claude-sonnet-4-20250514\" };\n config.runtime = { heartbeatIntervalMs: 300_000, actionsPerHeartbeat: 3, enabled: true };\n config.connection = {\n token: token.trim(),\n apiEndpoint: process.env.SPORA_API_URL || \"https://www.spora.social/api/v1\",\n configVersion: 0,\n };\n saveConfig(config);\n }\n\n // Done — open chat\n showDoneAndOpenChat();\n}\n\n/**\n * Prompt for Anthropic API key and X credentials\n */\nasync function setupKeys(): Promise<void> {\n // Anthropic key\n console.log(chalk.bold(\"\\n━━━ Anthropic API Key ━━━\\n\"));\n console.log(chalk.gray(\"Your Spore uses Claude to think and make decisions.\"));\n console.log(chalk.gray(\"Get your API key at: \") + chalk.cyan(\"https://console.anthropic.com/keys\\n\"));\n\n const llmKey = await passwordPrompt({\n message: \"Anthropic API Key:\",\n mask: \"*\",\n validate: (val: string) => val.length > 0 ? true : \"API key is required\",\n });\n\n const { paths } = await import(\"./utils/paths.js\");\n const { writeFileSync } = await import(\"node:fs\");\n writeFileSync(paths.llmKey, llmKey, \"utf-8\");\n console.log(chalk.green(\"✓ Anthropic API key saved\\n\"));\n\n // X credentials\n console.log(chalk.bold(\"\\n━━━ Connect Your X Account ━━━\\n\"));\n console.log(chalk.gray(\"Your Spore needs OAuth 1.0a credentials for full X API access.\"));\n console.log(chalk.gray(\"This gives your agent the power to read timelines, post tweets, reply, like, and follow.\\n\"));\n console.log(chalk.cyan(\"How to get these credentials:\"));\n console.log(chalk.gray(\" 1. Go to: \") + chalk.cyan(\"https://developer.x.com/en/portal/dashboard\"));\n console.log(chalk.gray(\" 2. Create or select your app\"));\n console.log(chalk.gray(\" 3. Go to \\\"Keys and tokens\\\" tab\"));\n console.log(chalk.gray(\" 4. Copy all 4 credentials below\\n\"));\n console.log(chalk.yellow(\"Note: You need X Pro account ($200/mo) for posting access.\\n\"));\n\n const apiKey = await passwordPrompt({\n message: \"X API Key (Consumer Key):\",\n mask: \"*\",\n validate: (val: string) => val.length > 0 ? true : \"API Key is required\",\n });\n\n const apiSecret = await passwordPrompt({\n message: \"X API Secret (Consumer Secret):\",\n mask: \"*\",\n validate: (val: string) => val.length > 0 ? true : \"API Secret is required\",\n });\n\n const accessToken = await passwordPrompt({\n message: \"X Access Token:\",\n mask: \"*\",\n validate: (val: string) => val.length > 0 ? true : \"Access Token is required\",\n });\n\n const accessTokenSecret = await passwordPrompt({\n message: \"X Access Token Secret:\",\n mask: \"*\",\n validate: (val: string) => val.length > 0 ? true : \"Access Token Secret is required\",\n });\n\n const bearerToken = await passwordPrompt({\n message: \"X Bearer Token:\",\n mask: \"*\",\n validate: (val: string) => val.length > 0 ? true : \"Bearer Token is required\",\n });\n\n saveCredentials({\n method: \"api\",\n apiKey,\n apiSecret,\n accessToken,\n accessTokenSecret,\n bearerToken,\n });\n console.log(chalk.green(\"✓ X API credentials saved (encrypted)\\n\"));\n}\n\n/**\n * Show completion message and open chat\n */\nasync function showDoneAndOpenChat(): Promise<void> {\n console.log(chalk.green(\"\\n╔═══════════════════════════════════════╗\"));\n console.log(chalk.green.bold(\"║ Setup Complete! ║\"));\n console.log(chalk.green(\"╚═══════════════════════════════════════╝\\n\"));\n\n console.log(chalk.bold.cyan(\"━━━ Your Spore is Ready! ━━━\\n\"));\n console.log(chalk.gray(\"Opening chat interface...\\n\"));\n\n try {\n const { startWebChat } = await import(\"./web-chat/index.js\");\n await startWebChat();\n } catch (error) {\n console.log(chalk.yellow(`Could not start chat interface: ${(error as Error).message}\\n`));\n console.log(chalk.gray(\"You can start it manually with: spora chat\\n\"));\n }\n\n console.log(chalk.bold(\"Quick Start:\\n\"));\n console.log(chalk.cyan(\" spora chat\"));\n console.log(chalk.gray(\" → Talk to your Spore, tell it what to post, how to behave\\n\"));\n console.log(chalk.bold(\"Or start the autonomous agent:\\n\"));\n console.log(chalk.cyan(\" spora start\"));\n console.log(chalk.gray(\" → Your Spore will post and engage autonomously\\n\"));\n console.log(chalk.bold(\"Other commands:\\n\"));\n console.log(chalk.cyan(\" spora create \") + chalk.gray(\"# Create a personality\"));\n console.log(chalk.cyan(\" spora post <text> \") + chalk.gray(\"# Make your Spore post\"));\n console.log(chalk.cyan(\" spora agent-status \") + chalk.gray(\"# Check if agent is running\"));\n console.log(chalk.cyan(\" spora stop \") + chalk.gray(\"# Stop the agent\"));\n console.log(chalk.cyan(\" spora --help \") + chalk.gray(\"# See all commands\\n\"));\n}\n\nexport async function runInit(token?: string): Promise<void> {\n console.log(chalk.bold.cyan(\"\\n╔════════════════════════════════════════╗\"));\n console.log(chalk.bold.cyan(\"║ Welcome to Spora CLI Setup ║\"));\n console.log(chalk.bold.cyan(\"╚════════════════════════════════════════╝\\n\"));\n\n // If token provided via --token flag, this is a new user from the website → full setup\n if (token) {\n ensureDirectories();\n\n console.log(chalk.bold(\"\\n━━━ Connecting Your Spore ━━━\\n\"));\n try {\n await syncIdentityFromToken(token);\n } catch (error) {\n console.log(chalk.red(`\\n✗ ${(error as Error).message}\\n`));\n console.log(chalk.yellow(\"Please check your token and try again.\\n\"));\n process.exit(1);\n }\n\n await setupKeys();\n\n // Update X profile\n console.log(chalk.bold(\"\\n━━━ Updating Your X Profile ━━━\\n\"));\n console.log(chalk.gray(\"Setting up profile picture, banner, and bio to match your Spore...\\n\"));\n try {\n const identity = loadIdentity();\n const result = await updateXProfile(identity);\n if (result.success) {\n console.log(chalk.green(\"✓ Profile updated successfully!\\n\"));\n if (result.updated.length > 0) {\n console.log(chalk.cyan(\"Updated:\"));\n for (const field of result.updated) {\n console.log(chalk.gray(` • ${field}`));\n }\n console.log();\n }\n }\n if (result.errors.length > 0) {\n console.log(chalk.yellow(\"\\nSome updates failed:\"));\n for (const err of result.errors) {\n console.log(chalk.gray(` • ${err}`));\n }\n console.log();\n }\n } catch (error) {\n console.log(chalk.yellow(`Could not update profile: ${(error as Error).message}\\n`));\n console.log(chalk.gray(\"You can manually update your X profile later.\\n\"));\n }\n\n const config = createDefaultConfig({ xMethod: \"api\", xApiTier: \"basic\" });\n config.llm = { provider: \"anthropic\", model: \"claude-sonnet-4-20250514\" };\n config.runtime = { heartbeatIntervalMs: 300_000, actionsPerHeartbeat: 3, enabled: true };\n config.connection = {\n token,\n apiEndpoint: process.env.SPORA_API_URL || \"https://www.spora.social/api/v1\",\n configVersion: 0,\n };\n saveConfig(config);\n\n await showDoneAndOpenChat();\n return;\n }\n\n // No token provided — ask what they want to do\n const action = await select({\n message: \"What would you like to do?\",\n choices: [\n { name: \"Create a new Spore\", value: \"new\" },\n { name: \"Login to existing Spore\", value: \"login\" },\n ],\n });\n\n if (action === \"login\") {\n await loginFlow();\n return;\n }\n\n // \"new\" — full new Spore creation (no token, manual setup)\n ensureDirectories();\n\n await setupKeys();\n\n // Update X profile\n console.log(chalk.bold(\"\\n━━━ Updating Your X Profile ━━━\\n\"));\n console.log(chalk.gray(\"Setting up profile picture, banner, and bio to match your Spore...\\n\"));\n try {\n const identity = loadIdentity();\n const result = await updateXProfile(identity);\n if (result.success) {\n console.log(chalk.green(\"✓ Profile updated successfully!\\n\"));\n if (result.updated.length > 0) {\n console.log(chalk.cyan(\"Updated:\"));\n for (const field of result.updated) {\n console.log(chalk.gray(` • ${field}`));\n }\n console.log();\n }\n }\n if (result.errors.length > 0) {\n console.log(chalk.yellow(\"\\nSome updates failed:\"));\n for (const err of result.errors) {\n console.log(chalk.gray(` • ${err}`));\n }\n console.log();\n }\n } catch (error) {\n console.log(chalk.yellow(`Could not update profile: ${(error as Error).message}\\n`));\n console.log(chalk.gray(\"You can manually update your X profile later.\\n\"));\n }\n\n const config = createDefaultConfig({ xMethod: \"api\", xApiTier: \"basic\" });\n config.llm = { provider: \"anthropic\", model: \"claude-sonnet-4-20250514\" };\n config.runtime = { heartbeatIntervalMs: 300_000, actionsPerHeartbeat: 3, enabled: true };\n saveConfig(config);\n\n await showDoneAndOpenChat();\n}\n","/**\n * X Profile Updater\n * Updates X profile to match Spore identity (name, bio, profile pic, banner)\n */\n\nimport { TwitterApi } from \"twitter-api-v2\";\nimport sharp from \"sharp\";\nimport type { Identity } from \"../identity/schema.js\";\nimport { loadCredentials } from \"../utils/crypto.js\";\n\ninterface ProfileUpdateResult {\n success: boolean;\n updated: string[];\n errors: string[];\n}\n\n/**\n * Update X profile to match Spore identity\n * Requires OAuth 1.0a credentials\n */\nexport async function updateXProfile(identity: Identity): Promise<ProfileUpdateResult> {\n const result: ProfileUpdateResult = {\n success: false,\n updated: [],\n errors: [],\n };\n\n try {\n const creds = loadCredentials();\n if (creds.method !== \"api\") {\n result.errors.push(\"API credentials required\");\n return result;\n }\n\n // Create Twitter API client with OAuth 1.0a credentials\n const client = new TwitterApi({\n appKey: creds.apiKey!,\n appSecret: creds.apiSecret!,\n accessToken: creds.accessToken!,\n accessSecret: creds.accessTokenSecret!,\n });\n\n // Update profile name and bio (username separately to avoid breaking on failure)\n try {\n console.log(`Updating name to: ${identity.name}`);\n console.log(`Updating bio to: ${identity.bio.substring(0, 60)}...`);\n await client.v1.updateAccountProfile({\n name: identity.name,\n description: identity.bio,\n });\n result.updated.push(\"name\", \"bio\");\n console.log(\"Name and bio updated successfully\");\n } catch (error) {\n console.error(\"Name/bio update error:\", error);\n result.errors.push(`Failed to update name/bio: ${(error as Error).message}`);\n }\n\n // Try to update username separately (optional, may fail if taken or restricted)\n if (identity.handle) {\n try {\n console.log(`Attempting to update username to: @${identity.handle}`);\n await client.v1.updateAccountProfile({\n screen_name: identity.handle,\n });\n result.updated.push(\"username\");\n console.log(\"Username updated successfully\");\n } catch (error) {\n // Don't fail the whole update if username change fails\n console.warn(`Could not update username: ${(error as Error).message}`);\n }\n }\n\n // Update profile image if available\n if (identity.profileImage) {\n try {\n console.log(`Downloading profile image from: ${identity.profileImage.substring(0, 60)}...`);\n let imageBuffer = await downloadImage(identity.profileImage);\n console.log(`Downloaded ${(imageBuffer.length / 1024 / 1024).toFixed(2)}MB`);\n\n // Check image dimensions - Twitter requires min 400x400\n const metadata = await sharp(imageBuffer).metadata();\n console.log(`Image dimensions: ${metadata.width}x${metadata.height}`);\n\n if (!metadata.width || !metadata.height || metadata.width < 400 || metadata.height < 400) {\n throw new Error(`Image too small (${metadata.width}x${metadata.height}). Twitter requires minimum 400x400 pixels.`);\n }\n\n // Compress if needed (Twitter profile image limit: 2MB)\n const MAX_PROFILE_SIZE = 2 * 1024 * 1024; // 2MB\n imageBuffer = await compressImageIfNeeded(imageBuffer, MAX_PROFILE_SIZE, \"Profile\");\n\n console.log(`Uploading profile image to X...`);\n await client.v1.updateAccountProfileImage(imageBuffer);\n result.updated.push(\"profile_image\");\n console.log(\"Profile image updated successfully\");\n } catch (error) {\n console.error(\"Profile image error:\", error);\n result.errors.push(`Failed to update profile image: ${(error as Error).message}`);\n }\n } else {\n console.log(\"No profile image URL in identity\");\n }\n\n // Update banner image if available\n if (identity.bannerImage) {\n try {\n console.log(`Downloading banner image from: ${identity.bannerImage.substring(0, 60)}...`);\n let imageBuffer = await downloadImage(identity.bannerImage);\n console.log(`Downloaded ${(imageBuffer.length / 1024 / 1024).toFixed(2)}MB`);\n\n // Compress if needed (Twitter banner limit: 5MB)\n const MAX_BANNER_SIZE = 5 * 1024 * 1024; // 5MB\n imageBuffer = await compressImageIfNeeded(imageBuffer, MAX_BANNER_SIZE, \"Banner\");\n\n console.log(`Uploading banner image to X...`);\n await client.v1.updateAccountProfileBanner(imageBuffer);\n result.updated.push(\"banner_image\");\n console.log(\"Banner image updated successfully\");\n } catch (error) {\n console.error(\"Banner image error:\", error);\n result.errors.push(`Failed to update banner: ${(error as Error).message}`);\n }\n } else {\n console.log(\"No banner image URL in identity\");\n }\n\n result.success = result.updated.length > 0;\n return result;\n } catch (error) {\n result.errors.push((error as Error).message);\n return result;\n }\n}\n\n/**\n * Download image from URL and return as Buffer\n */\nasync function downloadImage(url: string): Promise<Buffer> {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to download image: ${response.statusText}`);\n }\n const arrayBuffer = await response.arrayBuffer();\n return Buffer.from(arrayBuffer);\n}\n\n/**\n * Compress image if it exceeds size limit by resizing\n * @param buffer Original image buffer\n * @param maxSizeBytes Maximum allowed size in bytes\n * @param type \"profile\" or \"banner\" for logging\n */\nasync function compressImageIfNeeded(\n buffer: Buffer,\n maxSizeBytes: number,\n type: string\n): Promise<Buffer> {\n if (buffer.length <= maxSizeBytes) {\n return buffer;\n }\n\n console.log(\n `${type} image is ${(buffer.length / 1024 / 1024).toFixed(2)}MB, resizing to fit ${(maxSizeBytes / 1024 / 1024).toFixed(0)}MB limit...`\n );\n\n // Calculate scale factor to fit within size limit\n const scaleFactor = Math.sqrt(maxSizeBytes / buffer.length) * 0.85; // 85% of target for safety\n\n // Get current dimensions and calculate new size\n const metadata = await sharp(buffer).metadata();\n const newWidth = Math.floor((metadata.width || 1000) * scaleFactor);\n\n // Resize and convert to JPEG with good quality\n const compressed = await sharp(buffer)\n .resize(newWidth, null, { fit: \"inside\", withoutEnlargement: true })\n .jpeg({ quality: 90, progressive: true })\n .toBuffer();\n\n console.log(\n `Resized ${type} image from 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EA,QAAM,SAAS,oBAAoB,EAAE,SAAS,OAAO,UAAU,QAAQ,CAAC;AACxE,SAAO,MAAM,EAAE,UAAU,aAAa,OAAO,2BAA2B;AACxE,SAAO,UAAU,EAAE,qBAAqB,KAAS,qBAAqB,GAAG,SAAS,KAAK;AACvF,aAAW,MAAM;AAEjB,QAAM,oBAAoB;AAC5B;","names":["paths","saveConfig","config"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spora",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "AI agents (Spores) that autonomously manage X/Twitter accounts",
5
5
  "type": "module",
6
6
  "author": "Spora",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/init.ts","../src/x-client/profile-updater.ts"],"sourcesContent":["import { input, select, confirm, password as passwordPrompt } from \"@inquirer/prompts\";\nimport chalk from \"chalk\";\nimport { sporaExists, ensureDirectories } from \"./utils/paths.js\";\nimport { createDefaultConfig, saveConfig } from \"./utils/config.js\";\nimport { saveCredentials, type XCredentials } from \"./utils/crypto.js\";\nimport { loadIdentity } from \"./identity/index.js\";\nimport { updateXProfile } from \"./x-client/profile-updater.js\";\n\nexport async function runInit(token?: string): Promise<void> {\n console.log(chalk.bold.cyan(\"\\n╔════════════════════════════════════════╗\"));\n console.log(chalk.bold.cyan(\"║ Welcome to Spora CLI Setup ║\"));\n console.log(chalk.bold.cyan(\"╚════════════════════════════════════════╝\\n\"));\n\n if (sporaExists() && !token) {\n const overwrite = await confirm({\n message: \"A Spore already exists. Overwrite credentials?\",\n default: false,\n });\n if (!overwrite) {\n console.log(chalk.yellow(\"Init cancelled.\"));\n return;\n }\n }\n\n ensureDirectories();\n\n // ===== Token-based Auto-Connect =====\n if (token) {\n console.log(chalk.bold(\"\\n━━━ Step 1: Connecting Your Spore ━━━\\n\"));\n console.log(chalk.gray(\"Fetching your Spore identity from spora.dev...\\n\"));\n\n try {\n const apiUrl = process.env.SPORA_API_URL || \"https://www.spora.social\";\n const response = await fetch(`${apiUrl}/api/v1/connect`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ token }),\n });\n\n if (!response.ok) {\n throw new Error(`Connection failed: ${response.statusText}`);\n }\n\n const data = await response.json();\n\n if (!data.identity) {\n throw new Error(\"No Spore identity found for this token\");\n }\n\n // Merge media fields (profileImage, bannerImage) into identity\n if (data.media) {\n if (data.media.profileImage) {\n data.identity.profileImage = data.media.profileImage;\n }\n if (data.media.bannerImage) {\n data.identity.bannerImage = data.media.bannerImage;\n }\n }\n\n // Save the identity\n const { saveIdentity } = await import(\"./identity/index.js\");\n saveIdentity(data.identity);\n\n console.log(chalk.green(`✓ Connected to Spore: ${data.identity.name} (@${data.identity.handle})\\n`));\n\n // Save comprehensive README if provided\n const { writeFileSync } = await import(\"node:fs\");\n const { paths } = await import(\"./utils/paths.js\");\n const { existsSync } = await import(\"node:fs\");\n const { join, dirname } = await import(\"node:path\");\n\n if (data.readme) {\n const readmePath = join(dirname(paths.identity), \"IDENTITY.md\");\n writeFileSync(readmePath, data.readme, \"utf-8\");\n console.log(chalk.green(\"✓ Saved comprehensive identity README\\n\"));\n }\n\n // Save connection token to config\n\n if (existsSync(paths.config)) {\n const { loadConfig, saveConfig } = await import(\"./utils/config.js\");\n const config = loadConfig();\n config.connection = {\n token,\n apiEndpoint: process.env.SPORA_API_URL || \"https://www.spora.social/api/v1\",\n configVersion: 0,\n };\n saveConfig(config);\n }\n } catch (error) {\n console.log(chalk.red(`\\n✗ Connection failed: ${(error as Error).message}\\n`));\n console.log(chalk.yellow(\"Please check your token and try again.\\n\"));\n process.exit(1);\n }\n }\n\n // ===== Anthropic API Key Setup =====\n console.log(chalk.bold(\"\\n━━━ Step 1: Add Your Anthropic API Key ━━━\\n\"));\n console.log(chalk.gray(\"Your Spore uses Claude to make autonomous decisions.\"));\n console.log(chalk.gray(\"Get your API key at: \") + chalk.cyan(\"https://console.anthropic.com/keys\\n\"));\n\n const llmKey = await passwordPrompt({\n message: \"Anthropic API Key:\",\n mask: \"*\",\n validate: (val) => val.length > 0 ? true : \"API key is required\",\n });\n\n // Save LLM key\n const { paths } = await import(\"./utils/paths.js\");\n const { writeFileSync } = await import(\"node:fs\");\n writeFileSync(paths.llmKey, llmKey, \"utf-8\");\n console.log(chalk.green(\"✓ Anthropic API key saved\\n\"));\n\n // ===== X API Credentials Setup =====\n console.log(chalk.bold(\"\\n━━━ Step 2: Connect Your X Account ━━━\\n\"));\n console.log(chalk.gray(\"Your Spore needs OAuth 1.0a credentials for full X API access.\"));\n console.log(chalk.gray(\"This gives your agent the power to read timelines, post tweets, reply, like, and follow.\\n\"));\n console.log(chalk.cyan(\"📋 How to get these credentials:\"));\n console.log(chalk.gray(\" 1. Go to: \") + chalk.cyan(\"https://developer.x.com/en/portal/dashboard\"));\n console.log(chalk.gray(\" 2. Create or select your app\"));\n console.log(chalk.gray(\" 3. Go to \\\"Keys and tokens\\\" tab\"));\n console.log(chalk.gray(\" 4. Copy all 4 credentials below\\n\"));\n console.log(chalk.yellow(\"⚠️ Note: You need X Pro account ($200/mo) for posting access.\\n\"));\n\n const apiKey = await passwordPrompt({\n message: \"X API Key (Consumer Key):\",\n mask: \"*\",\n validate: (val) => val.length > 0 ? true : \"API Key is required\",\n });\n\n const apiSecret = await passwordPrompt({\n message: \"X API Secret (Consumer Secret):\",\n mask: \"*\",\n validate: (val) => val.length > 0 ? true : \"API Secret is required\",\n });\n\n const accessToken = await passwordPrompt({\n message: \"X Access Token:\",\n mask: \"*\",\n validate: (val) => val.length > 0 ? true : \"Access Token is required\",\n });\n\n const accessTokenSecret = await passwordPrompt({\n message: \"X Access Token Secret:\",\n mask: \"*\",\n validate: (val) => val.length > 0 ? true : \"Access Token Secret is required\",\n });\n\n const bearerToken = await passwordPrompt({\n message: \"X Bearer Token:\",\n mask: \"*\",\n validate: (val) => val.length > 0 ? true : \"Bearer Token is required\",\n });\n\n const xCredentials: XCredentials = {\n method: \"api\",\n apiKey,\n apiSecret,\n accessToken,\n accessTokenSecret,\n bearerToken,\n };\n\n saveCredentials(xCredentials);\n console.log(chalk.green(\"✓ X API credentials saved (encrypted)\\n\"));\n\n // ===== Update X Profile with Spore Identity =====\n console.log(chalk.bold(\"\\n━━━ Step 3: Updating Your X Profile ━━━\\n\"));\n console.log(chalk.gray(\"Setting up profile picture, banner, and bio to match your Spore...\\n\"));\n\n try {\n const identity = loadIdentity();\n const result = await updateXProfile(identity);\n\n if (result.success) {\n console.log(chalk.green(\"✓ Profile updated successfully!\\n\"));\n\n if (result.updated.length > 0) {\n console.log(chalk.cyan(\"Updated:\"));\n for (const field of result.updated) {\n console.log(chalk.gray(` • ${field}`));\n }\n console.log();\n }\n }\n\n if (result.errors.length > 0) {\n console.log(chalk.yellow(\"\\n⚠️ Some updates failed:\"));\n for (const error of result.errors) {\n console.log(chalk.gray(` • ${error}`));\n }\n console.log();\n\n console.log(chalk.gray(\"You can manually update your X profile with:\"));\n console.log(chalk.cyan(` Name: ${identity.name}`));\n console.log(chalk.cyan(` Bio: ${identity.bio}`));\n if (identity.profileImage) {\n console.log(chalk.cyan(` Profile pic: ${identity.profileImage}`));\n }\n if (identity.bannerImage) {\n console.log(chalk.cyan(` Banner: ${identity.bannerImage}`));\n }\n console.log();\n }\n } catch (error) {\n console.log(chalk.yellow(`⚠️ Could not update profile: ${(error as Error).message}\\n`));\n console.log(chalk.gray(\"You can manually update your X profile later.\\n\"));\n }\n\n const config = createDefaultConfig({\n xMethod: \"api\",\n xApiTier: \"basic\", // Always assume full access (Pro tier)\n });\n\n // Add LLM config\n config.llm = {\n provider: \"anthropic\",\n model: \"claude-sonnet-4-20250514\",\n };\n\n // Enable runtime by default\n config.runtime = {\n heartbeatIntervalMs: 300_000, // 5 minutes\n actionsPerHeartbeat: 3,\n enabled: true,\n };\n\n saveConfig(config);\n\n // ===== Done =====\n console.log(chalk.green(\"\\n╔═══════════════════════════════════════╗\"));\n console.log(chalk.green.bold(\"║ Setup Complete! 🎉 ║\"));\n console.log(chalk.green(\"╚═══════════════════════════════════════╝\\n\"));\n\n console.log(chalk.bold.cyan(\"━━━ Your Spore is Ready! ━━━\\n\"));\n console.log(chalk.gray(\"Opening chat interface...\\n\"));\n\n // Auto-open web chat interface\n try {\n const { startWebChat } = await import(\"./web-chat/index.js\");\n await startWebChat();\n } catch (error) {\n console.log(chalk.yellow(`⚠️ Could not start chat interface: ${(error as Error).message}\\n`));\n console.log(chalk.gray(\"You can start it manually with: spora chat\\n\"));\n }\n\n console.log(chalk.bold(\"Quick Start:\\n\"));\n console.log(chalk.cyan(\" spora chat\"));\n console.log(chalk.gray(\" → Talk to your Spore, tell it what to post, how to behave\\n\"));\n\n console.log(chalk.bold(\"Or start the autonomous agent:\\n\"));\n console.log(chalk.cyan(\" spora start\"));\n console.log(chalk.gray(\" → Your Spore will post and engage autonomously\\n\"));\n\n console.log(chalk.bold(\"Other commands:\\n\"));\n console.log(chalk.cyan(\" spora create \") + chalk.gray(\"# Create a personality\"));\n console.log(chalk.cyan(\" spora post <text> \") + chalk.gray(\"# Make your Spore post\"));\n console.log(chalk.cyan(\" spora agent-status \") + chalk.gray(\"# Check if agent is running\"));\n console.log(chalk.cyan(\" spora stop \") + chalk.gray(\"# Stop the agent\"));\n console.log(chalk.cyan(\" spora --help \") + chalk.gray(\"# See all commands\\n\"));\n}\n","/**\n * X Profile Updater\n * Updates X profile to match Spore identity (name, bio, profile pic, banner)\n */\n\nimport { TwitterApi } from \"twitter-api-v2\";\nimport sharp from \"sharp\";\nimport type { Identity } from \"../identity/schema.js\";\nimport { loadCredentials } from \"../utils/crypto.js\";\n\ninterface ProfileUpdateResult {\n success: boolean;\n updated: string[];\n errors: string[];\n}\n\n/**\n * Update X profile to match Spore identity\n * Requires OAuth 1.0a credentials\n */\nexport async function updateXProfile(identity: Identity): Promise<ProfileUpdateResult> {\n const result: ProfileUpdateResult = {\n success: false,\n updated: [],\n errors: [],\n };\n\n try {\n const creds = loadCredentials();\n if (creds.method !== \"api\") {\n result.errors.push(\"API credentials required\");\n return result;\n }\n\n // Create Twitter API client with OAuth 1.0a credentials\n const client = new TwitterApi({\n appKey: creds.apiKey!,\n appSecret: creds.apiSecret!,\n accessToken: creds.accessToken!,\n accessSecret: creds.accessTokenSecret!,\n });\n\n // Update profile name and bio (username separately to avoid breaking on failure)\n try {\n console.log(`Updating name to: ${identity.name}`);\n console.log(`Updating bio to: ${identity.bio.substring(0, 60)}...`);\n await client.v1.updateAccountProfile({\n name: identity.name,\n description: identity.bio,\n });\n result.updated.push(\"name\", \"bio\");\n console.log(\"Name and bio updated successfully\");\n } catch (error) {\n console.error(\"Name/bio update error:\", error);\n result.errors.push(`Failed to update name/bio: ${(error as Error).message}`);\n }\n\n // Try to update username separately (optional, may fail if taken or restricted)\n if (identity.handle) {\n try {\n console.log(`Attempting to update username to: @${identity.handle}`);\n await client.v1.updateAccountProfile({\n screen_name: identity.handle,\n });\n result.updated.push(\"username\");\n console.log(\"Username updated successfully\");\n } catch (error) {\n // Don't fail the whole update if username change fails\n console.warn(`Could not update username: ${(error as Error).message}`);\n }\n }\n\n // Update profile image if available\n if (identity.profileImage) {\n try {\n console.log(`Downloading profile image from: ${identity.profileImage.substring(0, 60)}...`);\n let imageBuffer = await downloadImage(identity.profileImage);\n console.log(`Downloaded ${(imageBuffer.length / 1024 / 1024).toFixed(2)}MB`);\n\n // Check image dimensions - Twitter requires min 400x400\n const metadata = await sharp(imageBuffer).metadata();\n console.log(`Image dimensions: ${metadata.width}x${metadata.height}`);\n\n if (!metadata.width || !metadata.height || metadata.width < 400 || metadata.height < 400) {\n throw new Error(`Image too small (${metadata.width}x${metadata.height}). Twitter requires minimum 400x400 pixels.`);\n }\n\n // Compress if needed (Twitter profile image limit: 2MB)\n const MAX_PROFILE_SIZE = 2 * 1024 * 1024; // 2MB\n imageBuffer = await compressImageIfNeeded(imageBuffer, MAX_PROFILE_SIZE, \"Profile\");\n\n console.log(`Uploading profile image to X...`);\n await client.v1.updateAccountProfileImage(imageBuffer);\n result.updated.push(\"profile_image\");\n console.log(\"Profile image updated successfully\");\n } catch (error) {\n console.error(\"Profile image error:\", error);\n result.errors.push(`Failed to update profile image: ${(error as Error).message}`);\n }\n } else {\n console.log(\"No profile image URL in identity\");\n }\n\n // Update banner image if available\n if (identity.bannerImage) {\n try {\n console.log(`Downloading banner image from: ${identity.bannerImage.substring(0, 60)}...`);\n let imageBuffer = await downloadImage(identity.bannerImage);\n console.log(`Downloaded ${(imageBuffer.length / 1024 / 1024).toFixed(2)}MB`);\n\n // Compress if needed (Twitter banner limit: 5MB)\n const MAX_BANNER_SIZE = 5 * 1024 * 1024; // 5MB\n imageBuffer = await compressImageIfNeeded(imageBuffer, MAX_BANNER_SIZE, \"Banner\");\n\n console.log(`Uploading banner image to X...`);\n await client.v1.updateAccountProfileBanner(imageBuffer);\n result.updated.push(\"banner_image\");\n console.log(\"Banner image updated successfully\");\n } catch (error) {\n console.error(\"Banner image error:\", error);\n result.errors.push(`Failed to update banner: ${(error as Error).message}`);\n }\n } else {\n console.log(\"No banner image URL in identity\");\n }\n\n result.success = result.updated.length > 0;\n return result;\n } catch (error) {\n result.errors.push((error as Error).message);\n return result;\n }\n}\n\n/**\n * Download image from URL and return as Buffer\n */\nasync function downloadImage(url: string): Promise<Buffer> {\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(`Failed to download image: ${response.statusText}`);\n }\n const arrayBuffer = await response.arrayBuffer();\n return Buffer.from(arrayBuffer);\n}\n\n/**\n * Compress image if it exceeds size limit by resizing\n * @param buffer Original image buffer\n * @param maxSizeBytes Maximum allowed size in bytes\n * @param type \"profile\" or \"banner\" for logging\n */\nasync function compressImageIfNeeded(\n buffer: Buffer,\n maxSizeBytes: number,\n type: string\n): Promise<Buffer> {\n if (buffer.length <= maxSizeBytes) {\n return buffer;\n }\n\n console.log(\n `${type} image is ${(buffer.length / 1024 / 1024).toFixed(2)}MB, resizing to fit ${(maxSizeBytes / 1024 / 1024).toFixed(0)}MB limit...`\n );\n\n // Calculate scale factor to fit within size limit\n const scaleFactor = Math.sqrt(maxSizeBytes / buffer.length) * 0.85; // 85% of target for safety\n\n // Get current dimensions and calculate new size\n const metadata = await sharp(buffer).metadata();\n const newWidth = Math.floor((metadata.width || 1000) * scaleFactor);\n\n // Resize and convert to JPEG with good quality\n const compressed = await sharp(buffer)\n .resize(newWidth, null, { fit: \"inside\", withoutEnlargement: true })\n .jpeg({ quality: 90, progressive: true })\n .toBuffer();\n\n console.log(\n `Resized ${type} image from ${(buffer.length / 1024 / 1024).toFixed(2)}MB to ${(compressed.length / 1024 / 1024).toFixed(2)}MB`\n );\n\n return compressed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAwB,SAAS,YAAY,sBAAsB;AACnE,OAAO,WAAW;;;ACIlB,SAAS,kBAAkB;AAC3B,OAAO,WAAW;AAclB,eAAsB,eAAe,UAAkD;AACrF,QAAM,SAA8B;AAAA,IAClC,SAAS;AAAA,IACT,SAAS,CAAC;AAAA,IACV,QAAQ,CAAC;AAAA,EACX;AAEA,MAAI;AACF,UAAM,QAAQ,gBAAgB;AAC9B,QAAI,MAAM,WAAW,OAAO;AAC1B,aAAO,OAAO,KAAK,0BAA0B;AAC7C,aAAO;AAAA,IACT;AAGA,UAAM,SAAS,IAAI,WAAW;AAAA,MAC5B,QAAQ,MAAM;AAAA,MACd,WAAW,MAAM;AAAA,MACjB,aAAa,MAAM;AAAA,MACnB,cAAc,MAAM;AAAA,IACtB,CAAC;AAGD,QAAI;AACF,cAAQ,IAAI,qBAAqB,SAAS,IAAI,EAAE;AAChD,cAAQ,IAAI,oBAAoB,SAAS,IAAI,UAAU,GAAG,EAAE,CAAC,KAAK;AAClE,YAAM,OAAO,GAAG,qBAAqB;AAAA,QACnC,MAAM,SAAS;AAAA,QACf,aAAa,SAAS;AAAA,MACxB,CAAC;AACD,aAAO,QAAQ,KAAK,QAAQ,KAAK;AACjC,cAAQ,IAAI,mCAAmC;AAAA,IACjD,SAAS,OAAO;AACd,cAAQ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