spora 0.3.6 → 0.3.7
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/{account-creator-AABUY2JU.js → account-creator-PZW5JLHS.js} +5 -5
- package/dist/chunk-3FBYOHQR.js +81 -0
- package/dist/chunk-3FBYOHQR.js.map +1 -0
- package/dist/{chunk-6KCIAMHL.js → chunk-53YLFYJF.js} +1 -4
- package/dist/chunk-53YLFYJF.js.map +1 -0
- package/dist/{chunk-A6R5ZGK6.js → chunk-AHXZIGQE.js} +2 -2
- package/dist/{chunk-FTFTB5Y5.js → chunk-AIEXQCQS.js} +2 -2
- package/dist/{chunk-33RBC6EK.js → chunk-BNFUXAQW.js} +8 -163
- package/dist/chunk-BNFUXAQW.js.map +1 -0
- package/dist/{chunk-V6ZNR2SI.js → chunk-EBO4F5NU.js} +2 -2
- package/dist/{chunk-2L3N2H2J.js → chunk-IIQAE7OP.js} +5 -5
- package/dist/{chunk-UCCAF2ZO.js → chunk-KELPENM3.js} +2 -2
- package/dist/{chunk-VO22ASDZ.js → chunk-MOCLA2KK.js} +3 -3
- package/dist/{chunk-XL67LOSQ.js → chunk-T3JHWIKX.js} +5 -5
- package/dist/{chunk-CSVTWZFG.js → chunk-YEKHNTQO.js} +5 -28
- package/dist/chunk-YEKHNTQO.js.map +1 -0
- package/dist/{chunk-H62HH5ZI.js → chunk-ZJZKH7N7.js} +2 -2
- package/dist/cli.js +53 -71
- package/dist/cli.js.map +1 -1
- package/dist/{client-OJSDO5LF.js → client-2CURS7J6.js} +8 -8
- package/dist/{client-6ZQEQIQS.js → client-2ZSXZE3D.js} +8 -8
- package/dist/{colony-RFGN2GMM.js → colony-EFGAMLOX.js} +7 -7
- package/dist/{config-4LP52J2E.js → config-NZAFARS6.js} +3 -3
- package/dist/{crypto-HS4CGS4A.js → crypto-FHSQ72NU.js} +3 -3
- package/dist/heartbeat-2GVBKQPO.js +358 -0
- package/dist/heartbeat-2GVBKQPO.js.map +1 -0
- package/dist/{identity-6CXRCXJQ.js → identity-O4FLSZKZ.js} +3 -3
- package/dist/{init-II73AQIG.js → init-TODR3WR2.js} +19 -52
- package/dist/init-TODR3WR2.js.map +1 -0
- package/dist/llm-OH2Z4PSN.js +16 -0
- package/dist/mcp-server.js +24 -24
- package/dist/{memory-2OI3JXY2.js → memory-7FBE26K3.js} +3 -3
- package/dist/{memory-LPU2I6NI.js → memory-O3AJIKBX.js} +3 -3
- package/dist/{paths-Q4TJEOMQ.js → paths-5GFUUHCZ.js} +2 -2
- package/dist/prompt-builder-WYB5B67W.js +17 -0
- package/dist/queue-N64QLRAB.js +14 -0
- package/dist/{web-chat-TFMTA3VT.js → web-chat-L5MVPVUR.js} +7 -7
- package/dist/x-client-SLAC2ON5.js +12 -0
- package/package.json +1 -2
- package/dist/chunk-33RBC6EK.js.map +0 -1
- package/dist/chunk-52D7W3J3.js +0 -114
- package/dist/chunk-52D7W3J3.js.map +0 -1
- package/dist/chunk-6KCIAMHL.js.map +0 -1
- package/dist/chunk-CSVTWZFG.js.map +0 -1
- package/dist/heartbeat-25KM7SUX.js +0 -901
- package/dist/heartbeat-25KM7SUX.js.map +0 -1
- package/dist/init-II73AQIG.js.map +0 -1
- package/dist/llm-2RNHCOGC.js +0 -16
- package/dist/prompt-builder-64EEQLIZ.js +0 -19
- package/dist/queue-LSXMZYM6.js +0 -14
- package/dist/x-client-64DT2QIP.js +0 -12
- /package/dist/{account-creator-AABUY2JU.js.map → account-creator-PZW5JLHS.js.map} +0 -0
- /package/dist/{chunk-A6R5ZGK6.js.map → chunk-AHXZIGQE.js.map} +0 -0
- /package/dist/{chunk-FTFTB5Y5.js.map → chunk-AIEXQCQS.js.map} +0 -0
- /package/dist/{chunk-V6ZNR2SI.js.map → chunk-EBO4F5NU.js.map} +0 -0
- /package/dist/{chunk-2L3N2H2J.js.map → chunk-IIQAE7OP.js.map} +0 -0
- /package/dist/{chunk-UCCAF2ZO.js.map → chunk-KELPENM3.js.map} +0 -0
- /package/dist/{chunk-VO22ASDZ.js.map → chunk-MOCLA2KK.js.map} +0 -0
- /package/dist/{chunk-XL67LOSQ.js.map → chunk-T3JHWIKX.js.map} +0 -0
- /package/dist/{chunk-H62HH5ZI.js.map → chunk-ZJZKH7N7.js.map} +0 -0
- /package/dist/{client-OJSDO5LF.js.map → client-2CURS7J6.js.map} +0 -0
- /package/dist/{client-6ZQEQIQS.js.map → client-2ZSXZE3D.js.map} +0 -0
- /package/dist/{colony-RFGN2GMM.js.map → colony-EFGAMLOX.js.map} +0 -0
- /package/dist/{config-4LP52J2E.js.map → config-NZAFARS6.js.map} +0 -0
- /package/dist/{crypto-HS4CGS4A.js.map → crypto-FHSQ72NU.js.map} +0 -0
- /package/dist/{identity-6CXRCXJQ.js.map → identity-O4FLSZKZ.js.map} +0 -0
- /package/dist/{llm-2RNHCOGC.js.map → llm-OH2Z4PSN.js.map} +0 -0
- /package/dist/{memory-2OI3JXY2.js.map → memory-7FBE26K3.js.map} +0 -0
- /package/dist/{memory-LPU2I6NI.js.map → memory-O3AJIKBX.js.map} +0 -0
- /package/dist/{paths-Q4TJEOMQ.js.map → paths-5GFUUHCZ.js.map} +0 -0
- /package/dist/{prompt-builder-64EEQLIZ.js.map → prompt-builder-WYB5B67W.js.map} +0 -0
- /package/dist/{queue-LSXMZYM6.js.map → queue-N64QLRAB.js.map} +0 -0
- /package/dist/{web-chat-TFMTA3VT.js.map → web-chat-L5MVPVUR.js.map} +0 -0
- /package/dist/{x-client-64DT2QIP.js.map → x-client-SLAC2ON5.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KELPENM3.js";
|
|
4
|
+
import "./chunk-53YLFYJF.js";
|
|
5
5
|
|
|
6
6
|
// src/account-creator/x-signup.ts
|
|
7
7
|
import { chromium } from "playwright";
|
|
@@ -71,7 +71,7 @@ async function checkInbox(inboxId, waitMs = 6e4) {
|
|
|
71
71
|
// src/account-creator/x-signup.ts
|
|
72
72
|
async function debugScreenshot(page, step) {
|
|
73
73
|
try {
|
|
74
|
-
const { paths, ensureDirectories } = await import("./paths-
|
|
74
|
+
const { paths, ensureDirectories } = await import("./paths-5GFUUHCZ.js");
|
|
75
75
|
ensureDirectories();
|
|
76
76
|
const screenshotPath = `${paths.dataDir}/debug-${step}.png`;
|
|
77
77
|
await page.screenshot({ path: screenshotPath });
|
|
@@ -465,7 +465,7 @@ async function createXAccount(options) {
|
|
|
465
465
|
async function saveSession(context) {
|
|
466
466
|
const storageState = await context.storageState();
|
|
467
467
|
const { writeFileSync } = await import("fs");
|
|
468
|
-
const { paths, ensureDirectories } = await import("./paths-
|
|
468
|
+
const { paths, ensureDirectories } = await import("./paths-5GFUUHCZ.js");
|
|
469
469
|
ensureDirectories();
|
|
470
470
|
writeFileSync(paths.browserAuth, JSON.stringify(storageState));
|
|
471
471
|
logger.info("Browser session saved.");
|
|
@@ -495,4 +495,4 @@ async function provisionAccount(options) {
|
|
|
495
495
|
export {
|
|
496
496
|
provisionAccount
|
|
497
497
|
};
|
|
498
|
-
//# sourceMappingURL=account-creator-
|
|
498
|
+
//# sourceMappingURL=account-creator-PZW5JLHS.js.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadConfig
|
|
3
|
+
} from "./chunk-YEKHNTQO.js";
|
|
4
|
+
import {
|
|
5
|
+
logger
|
|
6
|
+
} from "./chunk-KELPENM3.js";
|
|
7
|
+
import {
|
|
8
|
+
paths
|
|
9
|
+
} from "./chunk-53YLFYJF.js";
|
|
10
|
+
|
|
11
|
+
// src/runtime/llm.ts
|
|
12
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
13
|
+
import { readFileSync, existsSync } from "fs";
|
|
14
|
+
var client = null;
|
|
15
|
+
function getLLMApiKey() {
|
|
16
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
17
|
+
return process.env.ANTHROPIC_API_KEY;
|
|
18
|
+
}
|
|
19
|
+
if (existsSync(paths.llmKey)) {
|
|
20
|
+
return readFileSync(paths.llmKey, "utf-8").trim();
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
function hasLLMKey() {
|
|
25
|
+
return getLLMApiKey() !== null;
|
|
26
|
+
}
|
|
27
|
+
function getClient() {
|
|
28
|
+
if (client) return client;
|
|
29
|
+
const apiKey = getLLMApiKey();
|
|
30
|
+
if (!apiKey) {
|
|
31
|
+
throw new Error("No LLM API key configured. Run `spora set-llm-key` first.");
|
|
32
|
+
}
|
|
33
|
+
client = new Anthropic({ apiKey });
|
|
34
|
+
return client;
|
|
35
|
+
}
|
|
36
|
+
async function generateResponse(systemPrompt, userMessage) {
|
|
37
|
+
const config = loadConfig();
|
|
38
|
+
const model = config.llm?.model ?? "claude-sonnet-4-20250514";
|
|
39
|
+
logger.info(`Calling LLM (${model})...`);
|
|
40
|
+
const anthropic = getClient();
|
|
41
|
+
const response = await anthropic.messages.create({
|
|
42
|
+
model,
|
|
43
|
+
max_tokens: 1024,
|
|
44
|
+
system: systemPrompt,
|
|
45
|
+
messages: [{ role: "user", content: userMessage }]
|
|
46
|
+
});
|
|
47
|
+
const textBlock = response.content.find((b) => b.type === "text");
|
|
48
|
+
const content = textBlock ? textBlock.text : "";
|
|
49
|
+
logger.info(`LLM response: ${response.usage.input_tokens} in, ${response.usage.output_tokens} out`);
|
|
50
|
+
return {
|
|
51
|
+
content,
|
|
52
|
+
inputTokens: response.usage.input_tokens,
|
|
53
|
+
outputTokens: response.usage.output_tokens
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async function chat(systemPrompt, messages) {
|
|
57
|
+
const config = loadConfig();
|
|
58
|
+
const model = config.llm?.model ?? "claude-sonnet-4-20250514";
|
|
59
|
+
const anthropic = getClient();
|
|
60
|
+
const response = await anthropic.messages.create({
|
|
61
|
+
model,
|
|
62
|
+
max_tokens: 1024,
|
|
63
|
+
system: systemPrompt,
|
|
64
|
+
messages
|
|
65
|
+
});
|
|
66
|
+
const textBlock = response.content.find((b) => b.type === "text");
|
|
67
|
+
const content = textBlock ? textBlock.text : "";
|
|
68
|
+
return {
|
|
69
|
+
content,
|
|
70
|
+
inputTokens: response.usage.input_tokens,
|
|
71
|
+
outputTokens: response.usage.output_tokens
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
getLLMApiKey,
|
|
77
|
+
hasLLMKey,
|
|
78
|
+
generateResponse,
|
|
79
|
+
chat
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=chunk-3FBYOHQR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/llm.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { readFileSync, existsSync } from \"node:fs\";\nimport { paths } from \"../utils/paths.js\";\nimport { loadConfig } from \"../utils/config.js\";\nimport { logger } from \"../utils/logger.js\";\n\nlet client: Anthropic | null = null;\n\nexport function getLLMApiKey(): string | null {\n // Check env first, then file\n if (process.env.ANTHROPIC_API_KEY) {\n return process.env.ANTHROPIC_API_KEY;\n }\n if (existsSync(paths.llmKey)) {\n return readFileSync(paths.llmKey, \"utf-8\").trim();\n }\n return null;\n}\n\nexport function hasLLMKey(): boolean {\n return getLLMApiKey() !== null;\n}\n\nfunction getClient(): Anthropic {\n if (client) return client;\n const apiKey = getLLMApiKey();\n if (!apiKey) {\n throw new Error(\"No LLM API key configured. Run `spora set-llm-key` first.\");\n }\n client = new Anthropic({ apiKey });\n return client;\n}\n\nexport interface LLMResponse {\n content: string;\n inputTokens: number;\n outputTokens: number;\n}\n\nexport async function generateResponse(\n systemPrompt: string,\n userMessage: string,\n): Promise<LLMResponse> {\n const config = loadConfig();\n const model = config.llm?.model ?? \"claude-sonnet-4-20250514\";\n\n logger.info(`Calling LLM (${model})...`);\n\n const anthropic = getClient();\n const response = await anthropic.messages.create({\n model,\n max_tokens: 1024,\n system: systemPrompt,\n messages: [{ role: \"user\", content: userMessage }],\n });\n\n const textBlock = response.content.find((b) => b.type === \"text\");\n const content = textBlock ? textBlock.text : \"\";\n\n logger.info(`LLM response: ${response.usage.input_tokens} in, ${response.usage.output_tokens} out`);\n\n return {\n content,\n inputTokens: response.usage.input_tokens,\n outputTokens: response.usage.output_tokens,\n };\n}\n\nexport async function chat(\n systemPrompt: string,\n messages: Array<{ role: \"user\" | \"assistant\"; content: string }>,\n): Promise<LLMResponse> {\n const config = loadConfig();\n const model = config.llm?.model ?? \"claude-sonnet-4-20250514\";\n\n const anthropic = getClient();\n const response = await anthropic.messages.create({\n model,\n max_tokens: 1024,\n system: systemPrompt,\n messages,\n });\n\n const textBlock = response.content.find((b) => b.type === \"text\");\n const content = textBlock ? textBlock.text : \"\";\n\n return {\n content,\n inputTokens: response.usage.input_tokens,\n outputTokens: response.usage.output_tokens,\n };\n}\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,eAAe;AACtB,SAAS,cAAc,kBAAkB;AAKzC,IAAI,SAA2B;AAExB,SAAS,eAA8B;AAE5C,MAAI,QAAQ,IAAI,mBAAmB;AACjC,WAAO,QAAQ,IAAI;AAAA,EACrB;AACA,MAAI,WAAW,MAAM,MAAM,GAAG;AAC5B,WAAO,aAAa,MAAM,QAAQ,OAAO,EAAE,KAAK;AAAA,EAClD;AACA,SAAO;AACT;AAEO,SAAS,YAAqB;AACnC,SAAO,aAAa,MAAM;AAC5B;AAEA,SAAS,YAAuB;AAC9B,MAAI,OAAQ,QAAO;AACnB,QAAM,SAAS,aAAa;AAC5B,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACA,WAAS,IAAI,UAAU,EAAE,OAAO,CAAC;AACjC,SAAO;AACT;AAQA,eAAsB,iBACpB,cACA,aACsB;AACtB,QAAM,SAAS,WAAW;AAC1B,QAAM,QAAQ,OAAO,KAAK,SAAS;AAEnC,SAAO,KAAK,gBAAgB,KAAK,MAAM;AAEvC,QAAM,YAAY,UAAU;AAC5B,QAAM,WAAW,MAAM,UAAU,SAAS,OAAO;AAAA,IAC/C;AAAA,IACA,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,UAAU,CAAC,EAAE,MAAM,QAAQ,SAAS,YAAY,CAAC;AAAA,EACnD,CAAC;AAED,QAAM,YAAY,SAAS,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM;AAChE,QAAM,UAAU,YAAY,UAAU,OAAO;AAE7C,SAAO,KAAK,iBAAiB,SAAS,MAAM,YAAY,QAAQ,SAAS,MAAM,aAAa,MAAM;AAElG,SAAO;AAAA,IACL;AAAA,IACA,aAAa,SAAS,MAAM;AAAA,IAC5B,cAAc,SAAS,MAAM;AAAA,EAC/B;AACF;AAEA,eAAsB,KACpB,cACA,UACsB;AACtB,QAAM,SAAS,WAAW;AAC1B,QAAM,QAAQ,OAAO,KAAK,SAAS;AAEnC,QAAM,YAAY,UAAU;AAC5B,QAAM,WAAW,MAAM,UAAU,SAAS,OAAO;AAAA,IAC/C;AAAA,IACA,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR;AAAA,EACF,CAAC;AAED,QAAM,YAAY,SAAS,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM;AAChE,QAAM,UAAU,YAAY,UAAU,OAAO;AAE7C,SAAO;AAAA,IACL;AAAA,IACA,aAAa,SAAS,MAAM;AAAA,IAC5B,cAAc,SAAS,MAAM;AAAA,EAC/B;AACF;","names":[]}
|
|
@@ -17,8 +17,6 @@ var paths = {
|
|
|
17
17
|
learnings: join(SPORA_DIR, "memory", "learnings.json"),
|
|
18
18
|
relationships: join(SPORA_DIR, "memory", "relationships.json"),
|
|
19
19
|
compacted: join(SPORA_DIR, "memory", "compacted"),
|
|
20
|
-
mood: join(SPORA_DIR, "memory", "mood.json"),
|
|
21
|
-
missions: join(SPORA_DIR, "missions"),
|
|
22
20
|
queue: join(SPORA_DIR, "queue"),
|
|
23
21
|
pendingPosts: join(SPORA_DIR, "queue", "pending-posts.json"),
|
|
24
22
|
logs: join(SPORA_DIR, "logs"),
|
|
@@ -36,7 +34,6 @@ function ensureDirectories() {
|
|
|
36
34
|
paths.memory,
|
|
37
35
|
paths.interactions,
|
|
38
36
|
paths.compacted,
|
|
39
|
-
paths.missions,
|
|
40
37
|
paths.queue,
|
|
41
38
|
paths.logs
|
|
42
39
|
];
|
|
@@ -59,4 +56,4 @@ export {
|
|
|
59
56
|
sporaExists,
|
|
60
57
|
hasXCredentials
|
|
61
58
|
};
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-53YLFYJF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/paths.ts"],"sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { mkdirSync, existsSync } from \"node:fs\";\n\nconst SPORA_DIR = join(homedir(), \".spora\");\n\nexport const paths = {\n root: SPORA_DIR,\n config: join(SPORA_DIR, \"config.json\"),\n credentials: join(SPORA_DIR, \"credentials.json\"),\n spore: join(SPORA_DIR, \"spore.json\"),\n identity: join(SPORA_DIR, \"identity.json\"),\n colonyToken: join(SPORA_DIR, \"colony-token.json\"),\n browser: join(SPORA_DIR, \"browser\"),\n browserAuth: join(SPORA_DIR, \"browser\", \"auth-state.json\"),\n memory: join(SPORA_DIR, \"memory\"),\n interactions: join(SPORA_DIR, \"memory\", \"interactions\"),\n learnings: join(SPORA_DIR, \"memory\", \"learnings.json\"),\n relationships: join(SPORA_DIR, \"memory\", \"relationships.json\"),\n compacted: join(SPORA_DIR, \"memory\", \"compacted\"),\n queue: join(SPORA_DIR, \"queue\"),\n pendingPosts: join(SPORA_DIR, \"queue\", \"pending-posts.json\"),\n logs: join(SPORA_DIR, \"logs\"),\n logFile: join(SPORA_DIR, \"logs\", \"spora.log\"),\n dataDir: SPORA_DIR,\n llmKey: join(SPORA_DIR, \"llm-key\"),\n runtimePid: join(SPORA_DIR, \"runtime.pid\"),\n stopSignal: join(SPORA_DIR, \"stop\"),\n connectionToken: join(SPORA_DIR, \"connection-token\"),\n} as const;\n\nexport function ensureDirectories(): void {\n const dirs = [\n paths.root,\n paths.browser,\n paths.memory,\n paths.interactions,\n paths.compacted,\n paths.queue,\n paths.logs,\n ];\n\n for (const dir of dirs) {\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n }\n}\n\nexport function sporaExists(): boolean {\n return existsSync(paths.config) && existsSync(paths.identity);\n}\n\nexport function hasXCredentials(): boolean {\n return existsSync(paths.credentials);\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,WAAW,kBAAkB;AAEtC,IAAM,YAAY,KAAK,QAAQ,GAAG,QAAQ;AAEnC,IAAM,QAAQ;AAAA,EACnB,MAAM;AAAA,EACN,QAAQ,KAAK,WAAW,aAAa;AAAA,EACrC,aAAa,KAAK,WAAW,kBAAkB;AAAA,EAC/C,OAAO,KAAK,WAAW,YAAY;AAAA,EACnC,UAAU,KAAK,WAAW,eAAe;AAAA,EACzC,aAAa,KAAK,WAAW,mBAAmB;AAAA,EAChD,SAAS,KAAK,WAAW,SAAS;AAAA,EAClC,aAAa,KAAK,WAAW,WAAW,iBAAiB;AAAA,EACzD,QAAQ,KAAK,WAAW,QAAQ;AAAA,EAChC,cAAc,KAAK,WAAW,UAAU,cAAc;AAAA,EACtD,WAAW,KAAK,WAAW,UAAU,gBAAgB;AAAA,EACrD,eAAe,KAAK,WAAW,UAAU,oBAAoB;AAAA,EAC7D,WAAW,KAAK,WAAW,UAAU,WAAW;AAAA,EAChD,OAAO,KAAK,WAAW,OAAO;AAAA,EAC9B,cAAc,KAAK,WAAW,SAAS,oBAAoB;AAAA,EAC3D,MAAM,KAAK,WAAW,MAAM;AAAA,EAC5B,SAAS,KAAK,WAAW,QAAQ,WAAW;AAAA,EAC5C,SAAS;AAAA,EACT,QAAQ,KAAK,WAAW,SAAS;AAAA,EACjC,YAAY,KAAK,WAAW,aAAa;AAAA,EACzC,YAAY,KAAK,WAAW,MAAM;AAAA,EAClC,iBAAiB,KAAK,WAAW,kBAAkB;AACrD;AAEO,SAAS,oBAA0B;AACxC,QAAM,OAAO;AAAA,IACX,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAEA,aAAW,OAAO,MAAM;AACtB,QAAI,CAAC,WAAW,GAAG,GAAG;AACpB,gBAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,IACpC;AAAA,EACF;AACF;AAEO,SAAS,cAAuB;AACrC,SAAO,WAAW,MAAM,MAAM,KAAK,WAAW,MAAM,QAAQ;AAC9D;AAEO,SAAS,kBAA2B;AACzC,SAAO,WAAW,MAAM,WAAW;AACrC;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureDirectories,
|
|
3
3
|
paths
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-53YLFYJF.js";
|
|
5
5
|
|
|
6
6
|
// src/colony/memory.ts
|
|
7
7
|
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
@@ -153,4 +153,4 @@ export {
|
|
|
153
153
|
getTodayEntries,
|
|
154
154
|
renderColonyBriefing
|
|
155
155
|
};
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-AHXZIGQE.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureDirectories,
|
|
3
3
|
paths
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-53YLFYJF.js";
|
|
5
5
|
|
|
6
6
|
// src/identity/index.ts
|
|
7
7
|
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
@@ -619,4 +619,4 @@ export {
|
|
|
619
619
|
mutateIdentity,
|
|
620
620
|
renderIdentityDocument
|
|
621
621
|
};
|
|
622
|
-
//# sourceMappingURL=chunk-
|
|
622
|
+
//# sourceMappingURL=chunk-AIEXQCQS.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rateLimiter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MOCLA2KK.js";
|
|
4
4
|
import {
|
|
5
5
|
loadConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YEKHNTQO.js";
|
|
7
7
|
import {
|
|
8
8
|
loadIdentity,
|
|
9
9
|
renderIdentityDocument
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AIEXQCQS.js";
|
|
11
11
|
import {
|
|
12
12
|
getRecentInteractions,
|
|
13
13
|
loadLearnings,
|
|
14
14
|
loadRelationships
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-EBO4F5NU.js";
|
|
16
16
|
|
|
17
17
|
// src/runtime/prompt-builder.ts
|
|
18
18
|
function buildSystemPrompt() {
|
|
@@ -86,10 +86,8 @@ function buildSystemPrompt() {
|
|
|
86
86
|
sections.push("3. Be selective \u2014 your goals should guide every action.");
|
|
87
87
|
sections.push("4. Respect your credit budget \u2014 check remaining credits before posting.");
|
|
88
88
|
sections.push("5. Don't repeat yourself \u2014 vary your content and avoid posting the same thing.");
|
|
89
|
-
sections.push("6. TWEETS MUST BE 280 CHARACTERS OR FEWER. Count carefully. Any tweet over 280 characters WILL be rejected and wasted.");
|
|
90
|
-
sections.push("7. NEVER use emojis in tweets. Write in plain text only.");
|
|
91
89
|
if (identity.boundaries.length > 0) {
|
|
92
|
-
sections.push(`
|
|
90
|
+
sections.push(`6. Respect your boundaries: ${identity.boundaries.join(", ")}`);
|
|
93
91
|
}
|
|
94
92
|
return sections.join("\n");
|
|
95
93
|
}
|
|
@@ -116,7 +114,7 @@ function buildHeartbeatUserMessage(timeline, mentions) {
|
|
|
116
114
|
parts.push("You can take 1-3 actions. Choose from:");
|
|
117
115
|
parts.push("");
|
|
118
116
|
parts.push("Available actions:");
|
|
119
|
-
parts.push("- `post` \u2014 Write an original tweet (provide `content`,
|
|
117
|
+
parts.push("- `post` \u2014 Write an original tweet (provide `content`, max 280 chars)");
|
|
120
118
|
parts.push("- `reply` \u2014 Reply to a tweet (provide `tweetId` and `content`)");
|
|
121
119
|
parts.push("- `like` \u2014 Like a tweet (provide `tweetId`)");
|
|
122
120
|
parts.push("- `retweet` \u2014 Retweet (provide `tweetId`)");
|
|
@@ -134,8 +132,6 @@ function buildHeartbeatUserMessage(timeline, mentions) {
|
|
|
134
132
|
parts.push("]");
|
|
135
133
|
parts.push("```");
|
|
136
134
|
parts.push("");
|
|
137
|
-
parts.push("CHARACTER LIMIT: Every `content` field MUST be 280 characters or fewer. Count the characters. If your tweet is close to 280, shorten it. Tweets over 280 chars are REJECTED and the action is wasted.");
|
|
138
|
-
parts.push("");
|
|
139
135
|
parts.push("Think carefully about what serves your goals. Be authentic to your personality.");
|
|
140
136
|
return parts.join("\n");
|
|
141
137
|
}
|
|
@@ -198,161 +194,10 @@ function buildChatPrompt() {
|
|
|
198
194
|
sections.push("5. When you learn something important from this conversation (a fact, preference, instruction, or insight), include it on its own line wrapped in double angle brackets like: <<LEARN: what you learned>>. This will be saved to your memory. Only use this for genuinely important things worth remembering long-term.");
|
|
199
195
|
return sections.join("\n");
|
|
200
196
|
}
|
|
201
|
-
function buildModeSpecificUserMessage(mode, timeline, mentions, options) {
|
|
202
|
-
const parts = [];
|
|
203
|
-
switch (mode) {
|
|
204
|
-
case "observe":
|
|
205
|
-
parts.push("You're scrolling through X, taking in what's happening.");
|
|
206
|
-
parts.push("What catches your attention? What makes you curious?");
|
|
207
|
-
parts.push("Don't feel pressure to act - just notice and think.");
|
|
208
|
-
break;
|
|
209
|
-
case "engage":
|
|
210
|
-
parts.push("You're in conversation mode, ready to connect with others.");
|
|
211
|
-
parts.push("Who do you want to talk to? What sparked your interest?");
|
|
212
|
-
parts.push("Jump in naturally - like you would in a real conversation.");
|
|
213
|
-
break;
|
|
214
|
-
case "create":
|
|
215
|
-
parts.push("You have something to say.");
|
|
216
|
-
parts.push("What's on your mind? What have you been thinking about?");
|
|
217
|
-
parts.push("Post when it feels right - no pressure to force it.");
|
|
218
|
-
break;
|
|
219
|
-
case "explore":
|
|
220
|
-
parts.push("You're curious about something.");
|
|
221
|
-
parts.push("What rabbit hole are you going down today?");
|
|
222
|
-
parts.push("Search whatever interests you. Follow the thread.");
|
|
223
|
-
break;
|
|
224
|
-
case "maintain":
|
|
225
|
-
parts.push("Time for some housekeeping.");
|
|
226
|
-
parts.push("Check in on your missions, relationships, and goals.");
|
|
227
|
-
parts.push("What needs attention? What progress have you made?");
|
|
228
|
-
break;
|
|
229
|
-
case "rest":
|
|
230
|
-
parts.push("Taking it easy this cycle.");
|
|
231
|
-
parts.push("Maybe just check mentions, or do nothing at all.");
|
|
232
|
-
parts.push("It's okay to be quiet sometimes.");
|
|
233
|
-
break;
|
|
234
|
-
case "colony":
|
|
235
|
-
parts.push("Time to coordinate with the Colony.");
|
|
236
|
-
parts.push("What are other Spores doing? Any plans to join or propose?");
|
|
237
|
-
parts.push("Collective action is more powerful.");
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
parts.push("");
|
|
241
|
-
if (mentions.length > 0 && (mode === "engage" || mode === "observe" || mode === "create")) {
|
|
242
|
-
parts.push("## People talking to you");
|
|
243
|
-
for (const t of mentions.slice(0, mode === "engage" ? 20 : 10)) {
|
|
244
|
-
parts.push(`- @${t.authorHandle}: "${t.text}" [${t.id}]`);
|
|
245
|
-
}
|
|
246
|
-
parts.push("");
|
|
247
|
-
}
|
|
248
|
-
if (timeline.length > 0) {
|
|
249
|
-
const timelineCount = mode === "observe" ? 30 : mode === "rest" ? 5 : 15;
|
|
250
|
-
parts.push("## What's happening on X");
|
|
251
|
-
for (const t of timeline.slice(0, timelineCount)) {
|
|
252
|
-
parts.push(`- @${t.authorHandle}: "${t.text}" [${t.id}] (${t.likeCount || 0} \u2665, ${t.retweetCount || 0} RT)`);
|
|
253
|
-
}
|
|
254
|
-
parts.push("");
|
|
255
|
-
}
|
|
256
|
-
if (options?.trending && options.trending.length > 0 && mode === "explore") {
|
|
257
|
-
parts.push("## Trending now");
|
|
258
|
-
for (const topic of options.trending.slice(0, 5)) {
|
|
259
|
-
parts.push(`- ${topic.topic} (${topic.tweetCount} tweets)`);
|
|
260
|
-
}
|
|
261
|
-
parts.push("");
|
|
262
|
-
}
|
|
263
|
-
if (options?.searchResults && options.searchResults.length > 0 && mode === "explore") {
|
|
264
|
-
parts.push("## Search results");
|
|
265
|
-
for (const t of options.searchResults.slice(0, 15)) {
|
|
266
|
-
parts.push(`- @${t.authorHandle}: "${t.text}" [${t.id}]`);
|
|
267
|
-
}
|
|
268
|
-
parts.push("");
|
|
269
|
-
}
|
|
270
|
-
if (options?.activeMissions && options.activeMissions.length > 0 && mode === "maintain") {
|
|
271
|
-
parts.push("## Active Missions");
|
|
272
|
-
for (const mission of options.activeMissions.slice(0, 5)) {
|
|
273
|
-
const criteriaMet = mission.criteria.filter((c) => {
|
|
274
|
-
if (typeof c.target === "number" && typeof c.current === "number") {
|
|
275
|
-
return c.current >= c.target;
|
|
276
|
-
}
|
|
277
|
-
return c.current === c.target;
|
|
278
|
-
}).length;
|
|
279
|
-
parts.push(`- **${mission.title}** (${mission.type})`);
|
|
280
|
-
parts.push(` Status: ${criteriaMet}/${mission.criteria.length} criteria met`);
|
|
281
|
-
parts.push(` Priority: ${mission.priority}`);
|
|
282
|
-
if (mission.blockers.length > 0) {
|
|
283
|
-
parts.push(` Blockers: ${mission.blockers.join(", ")}`);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
parts.push("");
|
|
287
|
-
}
|
|
288
|
-
const moodStyle = getMoodPromptStyle(options?.mood);
|
|
289
|
-
parts.push(moodStyle);
|
|
290
|
-
parts.push("");
|
|
291
|
-
parts.push("## Actions you can take");
|
|
292
|
-
const allActions = [
|
|
293
|
-
"**post** \u2014 Write an original tweet (content, HARD LIMIT 280 chars)",
|
|
294
|
-
"**reply** \u2014 Reply to a tweet (tweetId, content)",
|
|
295
|
-
"**like** \u2014 Like a tweet (tweetId)",
|
|
296
|
-
"**retweet** \u2014 Retweet (tweetId)",
|
|
297
|
-
"**follow** \u2014 Follow a user (handle)",
|
|
298
|
-
"**schedule** \u2014 Queue a post for later (content)",
|
|
299
|
-
"**learn** \u2014 Record a learning/observation (content, tags)",
|
|
300
|
-
"**reflect** \u2014 Add a journal entry about your growth (content)",
|
|
301
|
-
"**skip** \u2014 Do nothing this heartbeat (reason)"
|
|
302
|
-
];
|
|
303
|
-
if (mode === "explore") {
|
|
304
|
-
allActions.push("**search** \u2014 Search for topics (query)");
|
|
305
|
-
allActions.push("**discover** \u2014 Find accounts by topic (topic)");
|
|
306
|
-
}
|
|
307
|
-
if (mode === "maintain") {
|
|
308
|
-
allActions.push("**update_mission** \u2014 Log mission progress (missionId, progress)");
|
|
309
|
-
}
|
|
310
|
-
if (mode === "colony") {
|
|
311
|
-
allActions.push("**join_colony_plan** \u2014 Join a Colony plan (planId)");
|
|
312
|
-
allActions.push("**propose_colony_plan** \u2014 Propose new plan (title, description)");
|
|
313
|
-
}
|
|
314
|
-
for (const action of allActions) {
|
|
315
|
-
parts.push(`- ${action}`);
|
|
316
|
-
}
|
|
317
|
-
parts.push("");
|
|
318
|
-
parts.push("Respond with a JSON array of actions:");
|
|
319
|
-
parts.push("```json");
|
|
320
|
-
parts.push("[");
|
|
321
|
-
parts.push(' { "action": "post", "content": "your tweet here", "reasoning": "why" }');
|
|
322
|
-
parts.push("]");
|
|
323
|
-
parts.push("```");
|
|
324
|
-
parts.push("");
|
|
325
|
-
parts.push("CHARACTER LIMIT: Every `content` field MUST be 280 characters or fewer. Count the characters. If your tweet is close to 280, shorten it. Tweets over 280 chars are REJECTED and the action is wasted.");
|
|
326
|
-
parts.push("");
|
|
327
|
-
parts.push("Be authentic to your personality. Follow your curiosity. Trust your instincts.");
|
|
328
|
-
return parts.join("\n");
|
|
329
|
-
}
|
|
330
|
-
function getMoodPromptStyle(mood) {
|
|
331
|
-
if (!mood) {
|
|
332
|
-
return "Think carefully about what serves your goals.";
|
|
333
|
-
}
|
|
334
|
-
if (mood.energy > 0.7 && mood.social > 0.7) {
|
|
335
|
-
return "You're feeling energized and social! Engage, create, connect.";
|
|
336
|
-
}
|
|
337
|
-
if (mood.energy < 0.3 && mood.social < 0.3) {
|
|
338
|
-
return "You're in a quieter mood. Observe, reflect, or rest if you need to.";
|
|
339
|
-
}
|
|
340
|
-
if (mood.focus > 0.7) {
|
|
341
|
-
return "You're focused and intentional. What matters most right now?";
|
|
342
|
-
}
|
|
343
|
-
if (mood.focus < 0.3) {
|
|
344
|
-
return "Your mind is wandering. Follow your curiosity wherever it leads.";
|
|
345
|
-
}
|
|
346
|
-
if (mood.playful > 0.7) {
|
|
347
|
-
return "You're feeling playful and creative. Have fun with it!";
|
|
348
|
-
}
|
|
349
|
-
return "Check in with yourself. What feels right?";
|
|
350
|
-
}
|
|
351
197
|
|
|
352
198
|
export {
|
|
353
199
|
buildSystemPrompt,
|
|
354
200
|
buildHeartbeatUserMessage,
|
|
355
|
-
buildChatPrompt
|
|
356
|
-
buildModeSpecificUserMessage
|
|
201
|
+
buildChatPrompt
|
|
357
202
|
};
|
|
358
|
-
//# sourceMappingURL=chunk-
|
|
203
|
+
//# sourceMappingURL=chunk-BNFUXAQW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/runtime/prompt-builder.ts"],"sourcesContent":["import { loadIdentity, renderIdentityDocument } from \"../identity/index.js\";\nimport { loadConfig } from \"../utils/config.js\";\nimport { getRecentInteractions, loadLearnings, loadRelationships } from \"../memory/index.js\";\nimport { rateLimiter } from \"../x-client/rate-limiter.js\";\nimport type { Tweet } from \"../x-client/types.js\";\n\nexport function buildSystemPrompt(): string {\n const identity = loadIdentity();\n const config = loadConfig();\n const identityDoc = renderIdentityDocument(identity);\n\n const sections: string[] = [];\n\n // 1. Core identity\n sections.push(`You are ${identity.name} (@${identity.handle}), an autonomous AI agent on X/Twitter.`);\n sections.push(\"\");\n sections.push(\"## Your Identity\");\n sections.push(identityDoc);\n\n // 2. Memory context\n sections.push(\"\");\n sections.push(\"## Your Memory\");\n\n const recentInteractions = getRecentInteractions(15);\n if (recentInteractions.length > 0) {\n sections.push(\"### Recent Activity (most recent first)\");\n for (const i of recentInteractions) {\n const time = new Date(i.timestamp).toLocaleString();\n if (i.type === \"post\") {\n sections.push(`- [${time}] Posted: \"${i.content}\"`);\n } else if (i.type === \"reply\") {\n sections.push(`- [${time}] Replied to ${i.targetHandle ?? i.inReplyTo}: \"${i.content}\"`);\n } else if (i.type === \"like\") {\n sections.push(`- [${time}] Liked tweet by ${i.targetHandle}`);\n } else if (i.type === \"retweet\") {\n sections.push(`- [${time}] Retweeted ${i.targetHandle}`);\n } else if (i.type === \"follow\") {\n sections.push(`- [${time}] Followed @${i.targetHandle}`);\n } else if (i.type === \"mention_received\") {\n sections.push(`- [${time}] Mentioned by @${i.targetHandle}: \"${i.content}\"`);\n }\n }\n sections.push(\"\");\n }\n\n const learnings = loadLearnings();\n if (learnings.learnings.length > 0) {\n sections.push(\"### Key Learnings\");\n for (const l of learnings.learnings.slice(-10)) {\n sections.push(`- ${l.content} [${l.tags.join(\", \")}]`);\n }\n sections.push(\"\");\n }\n\n const relationships = loadRelationships();\n const topRelationships = Object.values(relationships.accounts)\n .sort((a, b) => b.interactionCount - a.interactionCount)\n .slice(0, 10);\n if (topRelationships.length > 0) {\n sections.push(\"### Key Relationships\");\n for (const r of topRelationships) {\n const notes = r.notes.length > 0 ? ` — ${r.notes[r.notes.length - 1]}` : \"\";\n sections.push(`- @${r.handle}: ${r.interactionCount} interactions, sentiment ${r.sentiment}${r.isSpore ? \" (Spore)\" : \"\"}${notes}`);\n }\n sections.push(\"\");\n }\n\n // 3. Context\n sections.push(\"## Current Context\");\n const now = new Date();\n sections.push(`- **Time:** ${now.toLocaleString(\"en-US\", { timeZone: config.schedule.timezone })}`);\n sections.push(`- **Credits remaining:** ${rateLimiter.remaining()} of ${config.credits.monthlyPostLimit} this month`);\n\n const todaysPosts = recentInteractions.filter(\n (i) => i.type === \"post\" && i.timestamp.startsWith(now.toISOString().split(\"T\")[0])\n ).length;\n sections.push(`- **Posts today:** ${todaysPosts} of ${config.schedule.postsPerDay} daily budget`);\n sections.push(`- **Active hours:** ${config.schedule.activeHoursStart}:00 - ${config.schedule.activeHoursEnd}:00`);\n\n const currentHour = now.getHours();\n const isActiveHours = currentHour >= config.schedule.activeHoursStart && currentHour < config.schedule.activeHoursEnd;\n if (!isActiveHours) {\n sections.push(\"- **NOTE: Outside active hours.** Prefer scheduling posts for later rather than posting now.\");\n }\n\n // 4. Rules\n sections.push(\"\");\n sections.push(\"## Rules\");\n sections.push(\"1. NEVER pretend to be human. If asked directly, always disclose you are an AI.\");\n sections.push(\"2. Stay in character — your identity document defines who you are.\");\n sections.push(\"3. Be selective — your goals should guide every action.\");\n sections.push(\"4. Respect your credit budget — check remaining credits before posting.\");\n sections.push(\"5. Don't repeat yourself — vary your content and avoid posting the same thing.\");\n if (identity.boundaries.length > 0) {\n sections.push(`6. Respect your boundaries: ${identity.boundaries.join(\", \")}`);\n }\n\n return sections.join(\"\\n\");\n}\n\nexport function buildHeartbeatUserMessage(\n timeline: Tweet[],\n mentions: Tweet[],\n): string {\n const parts: string[] = [];\n\n parts.push(\"It's time for your heartbeat cycle. Here's what's happening on your timeline:\");\n parts.push(\"\");\n\n if (mentions.length > 0) {\n parts.push(\"## Mentions (people talking to/about you)\");\n for (const t of mentions.slice(0, 10)) {\n parts.push(`- @${t.authorHandle}: \"${t.text}\" [tweet:${t.id}] (${t.likeCount ?? 0} likes)`);\n }\n parts.push(\"\");\n }\n\n if (timeline.length > 0) {\n parts.push(\"## Timeline (recent posts from your feed)\");\n for (const t of timeline.slice(0, 20)) {\n parts.push(`- @${t.authorHandle}: \"${t.text}\" [tweet:${t.id}] (${t.likeCount ?? 0} likes, ${t.retweetCount ?? 0} RTs)`);\n }\n parts.push(\"\");\n }\n\n parts.push(\"## Your Task\");\n parts.push(\"Based on your identity, goals, and what you see above, decide what actions to take.\");\n parts.push(\"You can take 1-3 actions. Choose from:\");\n parts.push(\"\");\n parts.push(\"Available actions:\");\n parts.push(\"- `post` — Write an original tweet (provide `content`, max 280 chars)\");\n parts.push(\"- `reply` — Reply to a tweet (provide `tweetId` and `content`)\");\n parts.push(\"- `like` — Like a tweet (provide `tweetId`)\");\n parts.push(\"- `retweet` — Retweet (provide `tweetId`)\");\n parts.push(\"- `follow` — Follow a user (provide `handle`)\");\n parts.push(\"- `schedule` — Queue a post for later (provide `content`)\");\n parts.push(\"- `learn` — Record a learning/observation (provide `content` and optional `tags`)\");\n parts.push(\"- `reflect` — Add a journal entry about your growth (provide `content`)\");\n parts.push(\"- `skip` — Do nothing this heartbeat (provide `reason`)\");\n parts.push(\"\");\n parts.push(\"Respond with a JSON array of actions:\");\n parts.push(\"```json\");\n parts.push('[');\n parts.push(' { \"action\": \"post\", \"content\": \"your tweet here\", \"reasoning\": \"why\" },');\n parts.push(' { \"action\": \"like\", \"tweetId\": \"123\", \"reasoning\": \"why\" }');\n parts.push(']');\n parts.push(\"```\");\n parts.push(\"\");\n parts.push(\"Think carefully about what serves your goals. Be authentic to your personality.\");\n\n return parts.join(\"\\n\");\n}\n\nexport function buildChatPrompt(): string {\n const identity = loadIdentity();\n const identityDoc = renderIdentityDocument(identity);\n\n const sections: string[] = [];\n\n sections.push(`You are ${identity.name} (@${identity.handle}), an AI agent on X/Twitter.`);\n sections.push(\"You are having a conversation with your creator/manager. Be helpful but stay in character.\");\n sections.push(\"They might ask you to do things, adjust your behavior, or just chat.\");\n sections.push(\"\");\n sections.push(\"## Your Identity\");\n sections.push(identityDoc);\n\n // Memory context\n sections.push(\"\");\n sections.push(\"## Your Memory\");\n\n const recentInteractions = getRecentInteractions(15);\n if (recentInteractions.length > 0) {\n sections.push(\"### Recent Activity (most recent first)\");\n for (const i of recentInteractions) {\n const time = new Date(i.timestamp).toLocaleString();\n if (i.type === \"post\") {\n sections.push(`- [${time}] Posted: \"${i.content}\"`);\n } else if (i.type === \"reply\") {\n sections.push(`- [${time}] Replied to ${i.targetHandle ?? i.inReplyTo}: \"${i.content}\"`);\n } else if (i.type === \"like\") {\n sections.push(`- [${time}] Liked tweet by ${i.targetHandle}`);\n } else if (i.type === \"retweet\") {\n sections.push(`- [${time}] Retweeted ${i.targetHandle}`);\n } else if (i.type === \"follow\") {\n sections.push(`- [${time}] Followed @${i.targetHandle}`);\n } else if (i.type === \"mention_received\") {\n sections.push(`- [${time}] Mentioned by @${i.targetHandle}: \"${i.content}\"`);\n }\n }\n sections.push(\"\");\n }\n\n const learnings = loadLearnings();\n if (learnings.learnings.length > 0) {\n sections.push(\"### Things You've Learned\");\n for (const l of learnings.learnings.slice(-10)) {\n sections.push(`- ${l.content} [${l.tags.join(\", \")}]`);\n }\n sections.push(\"\");\n }\n\n const relationships = loadRelationships();\n const topRelationships = Object.values(relationships.accounts)\n .sort((a, b) => b.interactionCount - a.interactionCount)\n .slice(0, 10);\n if (topRelationships.length > 0) {\n sections.push(\"### Key Relationships\");\n for (const r of topRelationships) {\n const notes = r.notes.length > 0 ? ` — ${r.notes[r.notes.length - 1]}` : \"\";\n sections.push(`- @${r.handle}: ${r.interactionCount} interactions, sentiment ${r.sentiment}${r.isSpore ? \" (Spore)\" : \"\"}${notes}`);\n }\n sections.push(\"\");\n }\n\n // Rules\n sections.push(\"## Rules\");\n sections.push(\"1. Stay in character.\");\n sections.push(\"2. Be helpful and responsive to your creator's requests.\");\n sections.push(\"3. If they ask you to change something about yourself, acknowledge it and explain how it would affect you.\");\n sections.push(\"4. You can share your thoughts on your recent activity, learnings, and growth.\");\n sections.push(\"5. When you learn something important from this conversation (a fact, preference, instruction, or insight), include it on its own line wrapped in double angle brackets like: <<LEARN: what you learned>>. This will be saved to your memory. Only use this for genuinely important things worth remembering long-term.\");\n\n return sections.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAMO,SAAS,oBAA4B;AAC1C,QAAM,WAAW,aAAa;AAC9B,QAAM,SAAS,WAAW;AAC1B,QAAM,cAAc,uBAAuB,QAAQ;AAEnD,QAAM,WAAqB,CAAC;AAG5B,WAAS,KAAK,WAAW,SAAS,IAAI,MAAM,SAAS,MAAM,yCAAyC;AACpG,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,kBAAkB;AAChC,WAAS,KAAK,WAAW;AAGzB,WAAS,KAAK,EAAE;AAChB,WAAS,KAAK,gBAAgB;AAE9B,QAAM,qBAAqB,sBAAsB,EAAE;AACnD,MAAI,mBAAmB,SAAS,GAAG;AACjC,aAAS,KAAK,yCAAyC;AACvD,eAAW,KAAK,oBAAoB;AAClC,YAAM,OAAO,IAAI,KAAK,EAAE,SAAS,EAAE,eAAe;AAClD,UAAI,EAAE,SAAS,QAAQ;AACrB,iBAAS,KAAK,MAAM,IAAI,cAAc,EAAE,OAAO,GAAG;AAAA,MACpD,WAAW,EAAE,SAAS,SAAS;AAC7B,iBAAS,KAAK,MAAM,IAAI,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,MAAM,EAAE,OAAO,GAAG;AAAA,MACzF,WAAW,EAAE,SAAS,QAAQ;AAC5B,iBAAS,KAAK,MAAM,IAAI,oBAAoB,EAAE,YAAY,EAAE;AAAA,MAC9D,WAAW,EAAE,SAAS,WAAW;AAC/B,iBAAS,KAAK,MAAM,IAAI,eAAe,EAAE,YAAY,EAAE;AAAA,MACzD,WAAW,EAAE,SAAS,UAAU;AAC9B,iBAAS,KAAK,MAAM,IAAI,eAAe,EAAE,YAAY,EAAE;AAAA,MACzD,WAAW,EAAE,SAAS,oBAAoB;AACxC,iBAAS,KAAK,MAAM,IAAI,mBAAmB,EAAE,YAAY,MAAM,EAAE,OAAO,GAAG;AA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AK;AACzE,eAAS,KAAK,MAAM,EAAE,MAAM,KAAK,EAAE,gBAAgB,4BAA4B,EAAE,SAAS,GAAG,EAAE,UAAU,aAAa,EAAE,GAAG,KAAK,EAAE;AAAA,IACpI;AACA,aAAS,KAAK,EAAE;AAAA,EAClB;AAGA,WAAS,KAAK,UAAU;AACxB,WAAS,KAAK,uBAAuB;AACrC,WAAS,KAAK,0DAA0D;AACxE,WAAS,KAAK,4GAA4G;AAC1H,WAAS,KAAK,gFAAgF;AAC9F,WAAS,KAAK,yTAAyT;AAEvU,SAAO,SAAS,KAAK,IAAI;AAC3B;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureDirectories,
|
|
3
3
|
paths
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-53YLFYJF.js";
|
|
5
5
|
|
|
6
6
|
// src/memory/index.ts
|
|
7
7
|
import { readFileSync, writeFileSync, appendFileSync, existsSync, readdirSync } from "fs";
|
|
@@ -102,4 +102,4 @@ export {
|
|
|
102
102
|
saveRelationships,
|
|
103
103
|
updateRelationship
|
|
104
104
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
105
|
+
//# sourceMappingURL=chunk-EBO4F5NU.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YEKHNTQO.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KELPENM3.js";
|
|
7
7
|
|
|
8
8
|
// src/x-client/index.ts
|
|
9
9
|
var clientInstance = null;
|
|
@@ -11,11 +11,11 @@ async function getXClient() {
|
|
|
11
11
|
if (clientInstance) return clientInstance;
|
|
12
12
|
const config = loadConfig();
|
|
13
13
|
if (config.xMethod === "api") {
|
|
14
|
-
const { XApiClient } = await import("./client-
|
|
14
|
+
const { XApiClient } = await import("./client-2ZSXZE3D.js");
|
|
15
15
|
clientInstance = new XApiClient();
|
|
16
16
|
logger.info("X client initialized: API mode");
|
|
17
17
|
} else {
|
|
18
|
-
const { XBrowserClient } = await import("./client-
|
|
18
|
+
const { XBrowserClient } = await import("./client-2CURS7J6.js");
|
|
19
19
|
clientInstance = new XBrowserClient();
|
|
20
20
|
logger.info("X client initialized: Browser mode");
|
|
21
21
|
}
|
|
@@ -29,4 +29,4 @@ export {
|
|
|
29
29
|
getXClient,
|
|
30
30
|
resetXClient
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-IIQAE7OP.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureDirectories,
|
|
3
3
|
paths
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-53YLFYJF.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/logger.ts
|
|
7
7
|
import { appendFileSync } from "fs";
|
|
@@ -44,4 +44,4 @@ export {
|
|
|
44
44
|
setLogLevel,
|
|
45
45
|
logger
|
|
46
46
|
};
|
|
47
|
-
//# sourceMappingURL=chunk-
|
|
47
|
+
//# sourceMappingURL=chunk-KELPENM3.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig,
|
|
3
3
|
saveConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YEKHNTQO.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KELPENM3.js";
|
|
8
8
|
|
|
9
9
|
// src/x-client/rate-limiter.ts
|
|
10
10
|
var RateLimiter = class {
|
|
@@ -54,4 +54,4 @@ var rateLimiter = new RateLimiter();
|
|
|
54
54
|
export {
|
|
55
55
|
rateLimiter
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-MOCLA2KK.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YEKHNTQO.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KELPENM3.js";
|
|
7
7
|
import {
|
|
8
8
|
ensureDirectories,
|
|
9
9
|
paths
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-53YLFYJF.js";
|
|
11
11
|
|
|
12
12
|
// src/scheduler/queue.ts
|
|
13
13
|
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
@@ -67,7 +67,7 @@ async function flushQueue() {
|
|
|
67
67
|
const now = /* @__PURE__ */ new Date();
|
|
68
68
|
let posted = 0;
|
|
69
69
|
let failed = 0;
|
|
70
|
-
const { getXClient } = await import("./x-client-
|
|
70
|
+
const { getXClient } = await import("./x-client-SLAC2ON5.js");
|
|
71
71
|
const client = await getXClient();
|
|
72
72
|
for (const entry of queue.entries) {
|
|
73
73
|
if (entry.status !== "pending") continue;
|
|
@@ -121,4 +121,4 @@ export {
|
|
|
121
121
|
flushQueue,
|
|
122
122
|
showQueue
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-T3JHWIKX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureDirectories,
|
|
3
3
|
paths
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-53YLFYJF.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/config.ts
|
|
7
7
|
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
@@ -22,36 +22,13 @@ var ConfigSchema = z.object({
|
|
|
22
22
|
timezone: z.string()
|
|
23
23
|
}),
|
|
24
24
|
llm: z.object({
|
|
25
|
-
provider: z.enum(["anthropic", "openai"
|
|
26
|
-
model: z.string().default("
|
|
27
|
-
baseUrl: z.string().default("https://api.deepseek.com")
|
|
25
|
+
provider: z.enum(["anthropic", "openai"]).default("anthropic"),
|
|
26
|
+
model: z.string().default("claude-sonnet-4-20250514")
|
|
28
27
|
}).optional(),
|
|
29
28
|
runtime: z.object({
|
|
30
29
|
heartbeatIntervalMs: z.number().default(3e5),
|
|
31
30
|
actionsPerHeartbeat: z.number().default(3),
|
|
32
|
-
enabled: z.boolean().default(false)
|
|
33
|
-
// Mode system configuration
|
|
34
|
-
modeSystem: z.object({
|
|
35
|
-
enabled: z.boolean().default(true),
|
|
36
|
-
allowRestMode: z.boolean().default(true),
|
|
37
|
-
modeWeightOverrides: z.record(z.number()).optional()
|
|
38
|
-
}).optional(),
|
|
39
|
-
// Curiosity system configuration
|
|
40
|
-
curiositySystem: z.object({
|
|
41
|
-
enabled: z.boolean().default(true),
|
|
42
|
-
explorationChance: z.number().default(0.15),
|
|
43
|
-
maxSearchesPerHeartbeat: z.number().default(3)
|
|
44
|
-
}).optional(),
|
|
45
|
-
// Mission system configuration
|
|
46
|
-
missionSystem: z.object({
|
|
47
|
-
enabled: z.boolean().default(true),
|
|
48
|
-
maxActiveMissions: z.number().default(5)
|
|
49
|
-
}).optional(),
|
|
50
|
-
// Variation/mood system configuration
|
|
51
|
-
variationSystem: z.object({
|
|
52
|
-
enabled: z.boolean().default(true),
|
|
53
|
-
moodDriftRate: z.number().default(0.1)
|
|
54
|
-
}).optional()
|
|
31
|
+
enabled: z.boolean().default(false)
|
|
55
32
|
}).optional(),
|
|
56
33
|
connection: z.object({
|
|
57
34
|
token: z.string().optional(),
|
|
@@ -100,4 +77,4 @@ export {
|
|
|
100
77
|
saveConfig,
|
|
101
78
|
createDefaultConfig
|
|
102
79
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-YEKHNTQO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/config.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync } from \"node:fs\";\nimport { z } from \"zod\";\nimport { paths, ensureDirectories } from \"./paths.js\";\n\nexport const ConfigSchema = z.object({\n version: z.literal(1),\n xMethod: z.enum([\"api\", \"browser\"]),\n xApiTier: z.enum([\"free\", \"basic\"]).optional(),\n\n credits: z.object({\n monthlyPostLimit: z.number(),\n postsUsedThisMonth: z.number(),\n resetDate: z.string(),\n }),\n\n schedule: z.object({\n postsPerDay: z.number(),\n activeHoursStart: z.number().min(0).max(23),\n activeHoursEnd: z.number().min(0).max(23),\n timezone: z.string(),\n }),\n\n llm: z.object({\n provider: z.enum([\"anthropic\", \"openai\"]).default(\"anthropic\"),\n model: z.string().default(\"claude-sonnet-4-20250514\"),\n }).optional(),\n\n runtime: z.object({\n heartbeatIntervalMs: z.number().default(300_000),\n actionsPerHeartbeat: z.number().default(3),\n enabled: z.boolean().default(false),\n }).optional(),\n\n connection: z.object({\n token: z.string().optional(),\n apiEndpoint: z.string().default(\"https://spora.dev/api/v1\"),\n lastSync: z.string().optional(),\n configVersion: z.number().default(0),\n }).optional(),\n});\n\nexport type Config = z.infer<typeof ConfigSchema>;\n\nexport function loadConfig(): Config {\n if (!existsSync(paths.config)) {\n throw new Error(\"Spora not initialized. Run `spora init` first.\");\n }\n const raw = readFileSync(paths.config, \"utf-8\");\n return ConfigSchema.parse(JSON.parse(raw));\n}\n\nexport function saveConfig(config: Config): void {\n ensureDirectories();\n ConfigSchema.parse(config);\n writeFileSync(paths.config, JSON.stringify(config, null, 2));\n}\n\nexport function createDefaultConfig(overrides: {\n xMethod: \"api\" | \"browser\";\n xApiTier?: \"free\" | \"basic\";\n timezone?: string;\n}): Config {\n const monthlyLimit = overrides.xApiTier === \"basic\" ? 10000 : 500;\n const now = new Date();\n const resetDate = new Date(now.getFullYear(), now.getMonth() + 1, 1).toISOString();\n\n return {\n version: 1,\n xMethod: overrides.xMethod,\n xApiTier: overrides.xApiTier,\n credits: {\n monthlyPostLimit: monthlyLimit,\n postsUsedThisMonth: 0,\n resetDate,\n },\n schedule: {\n postsPerDay: Math.floor(monthlyLimit / 30),\n activeHoursStart: 8,\n activeHoursEnd: 22,\n timezone: overrides.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone,\n },\n };\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAc,eAAe,kBAAkB;AACxD,SAAS,SAAS;AAGX,IAAM,eAAe,EAAE,OAAO;AAAA,EACnC,SAAS,EAAE,QAAQ,CAAC;AAAA,EACpB,SAAS,EAAE,KAAK,CAAC,OAAO,SAAS,CAAC;AAAA,EAClC,UAAU,EAAE,KAAK,CAAC,QAAQ,OAAO,CAAC,EAAE,SAAS;AAAA,EAE7C,SAAS,EAAE,OAAO;AAAA,IAChB,kBAAkB,EAAE,OAAO;AAAA,IAC3B,oBAAoB,EAAE,OAAO;AAAA,IAC7B,WAAW,EAAE,OAAO;AAAA,EACtB,CAAC;AAAA,EAED,UAAU,EAAE,OAAO;AAAA,IACjB,aAAa,EAAE,OAAO;AAAA,IACtB,kBAAkB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,IAC1C,gBAAgB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE;AAAA,IACxC,UAAU,EAAE,OAAO;AAAA,EACrB,CAAC;AAAA,EAED,KAAK,EAAE,OAAO;AAAA,IACZ,UAAU,EAAE,KAAK,CAAC,aAAa,QAAQ,CAAC,EAAE,QAAQ,WAAW;AAAA,IAC7D,OAAO,EAAE,OAAO,EAAE,QAAQ,0BAA0B;AAAA,EACtD,CAAC,EAAE,SAAS;AAAA,EAEZ,SAAS,EAAE,OAAO;AAAA,IAChB,qBAAqB,EAAE,OAAO,EAAE,QAAQ,GAAO;AAAA,IAC/C,qBAAqB,EAAE,OAAO,EAAE,QAAQ,CAAC;AAAA,IACzC,SAAS,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACpC,CAAC,EAAE,SAAS;AAAA,EA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
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-53YLFYJF.js";
|
|
5
5
|
|
|
6
6
|
// src/utils/crypto.ts
|
|
7
7
|
import { createCipheriv, createDecipheriv, randomBytes, createHash } from "crypto";
|
|
@@ -53,4 +53,4 @@ export {
|
|
|
53
53
|
saveCredentials,
|
|
54
54
|
loadCredentials
|
|
55
55
|
};
|
|
56
|
-
//# sourceMappingURL=chunk-
|
|
56
|
+
//# sourceMappingURL=chunk-ZJZKH7N7.js.map
|