spora 0.7.5 → 0.7.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/{autonomy-DFPA3OK6.js → autonomy-NNFTM5NW.js} +3 -3
- package/dist/{chunk-A2XTKC7B.js → chunk-JIMONWKO.js} +470 -1
- package/dist/chunk-JIMONWKO.js.map +1 -0
- package/dist/{chunk-HXI2EH5C.js → chunk-TTM54LQR.js} +487 -56
- package/dist/chunk-TTM54LQR.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{heartbeat-RAOEIKWC.js → heartbeat-WJJSGUAQ.js} +3 -3
- package/dist/{init-ETUTFHT6.js → init-6HY4ZPFJ.js} +52 -5
- package/dist/init-6HY4ZPFJ.js.map +1 -0
- package/dist/{prompt-builder-XJHXZCSQ.js → prompt-builder-ZFUZNQY2.js} +2 -2
- package/dist/{web-chat-TB3ACPVF.js → web-chat-AKUEBSWS.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-A2XTKC7B.js.map +0 -1
- package/dist/chunk-HXI2EH5C.js.map +0 -1
- package/dist/init-ETUTFHT6.js.map +0 -1
- /package/dist/{autonomy-DFPA3OK6.js.map → autonomy-NNFTM5NW.js.map} +0 -0
- /package/dist/{heartbeat-RAOEIKWC.js.map → heartbeat-WJJSGUAQ.js.map} +0 -0
- /package/dist/{prompt-builder-XJHXZCSQ.js.map → prompt-builder-ZFUZNQY2.js.map} +0 -0
- /package/dist/{web-chat-TB3ACPVF.js.map → web-chat-AKUEBSWS.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runAutonomyCycle
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TTM54LQR.js";
|
|
4
4
|
import "./chunk-5R4AJZHN.js";
|
|
5
5
|
import "./chunk-ZLSDFYBR.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-JIMONWKO.js";
|
|
7
7
|
import "./chunk-OTZNHIXT.js";
|
|
8
8
|
import "./chunk-CAWWG3MD.js";
|
|
9
9
|
import "./chunk-CP6JWCLY.js";
|
|
@@ -17,4 +17,4 @@ import "./chunk-ZWKTKWS6.js";
|
|
|
17
17
|
export {
|
|
18
18
|
runAutonomyCycle
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=autonomy-
|
|
20
|
+
//# sourceMappingURL=autonomy-NNFTM5NW.js.map
|
|
@@ -23,6 +23,446 @@ import {
|
|
|
23
23
|
loadRelationships
|
|
24
24
|
} from "./chunk-BBXHECZ5.js";
|
|
25
25
|
|
|
26
|
+
// src/runtime/persona-constraints.ts
|
|
27
|
+
function normalizeHandle(handle) {
|
|
28
|
+
return handle.replace(/^@/, "").trim().toLowerCase();
|
|
29
|
+
}
|
|
30
|
+
function unique(values) {
|
|
31
|
+
return [...new Set(values)];
|
|
32
|
+
}
|
|
33
|
+
function extractHandles(text) {
|
|
34
|
+
const fromMentions = [...text.matchAll(/@([a-zA-Z0-9_]{1,15})/g)].map((m) => m[1]);
|
|
35
|
+
const fromUrls = [...text.matchAll(/x\.com\/([a-zA-Z0-9_]{1,15})/gi)].map((m) => m[1]);
|
|
36
|
+
return unique(
|
|
37
|
+
[...fromMentions, ...fromUrls].map(normalizeHandle).filter((handle) => handle.length > 0)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
var BARE_HANDLE_STOPWORDS = /* @__PURE__ */ new Set([
|
|
41
|
+
"him",
|
|
42
|
+
"her",
|
|
43
|
+
"them",
|
|
44
|
+
"someone",
|
|
45
|
+
"anyone",
|
|
46
|
+
"everyone",
|
|
47
|
+
"anybody",
|
|
48
|
+
"everybody",
|
|
49
|
+
"people",
|
|
50
|
+
"person",
|
|
51
|
+
"users",
|
|
52
|
+
"user",
|
|
53
|
+
"others",
|
|
54
|
+
"other",
|
|
55
|
+
"my",
|
|
56
|
+
"me",
|
|
57
|
+
"you",
|
|
58
|
+
"to",
|
|
59
|
+
"with",
|
|
60
|
+
"for",
|
|
61
|
+
"only",
|
|
62
|
+
"just",
|
|
63
|
+
"reply",
|
|
64
|
+
"respond",
|
|
65
|
+
"interact",
|
|
66
|
+
"engage"
|
|
67
|
+
]);
|
|
68
|
+
var NAME_TO_HANDLE = [
|
|
69
|
+
[/\bgrok\b/i, "grok"],
|
|
70
|
+
[/\belon musk\b/i, "elonmusk"],
|
|
71
|
+
[/\belon\b/i, "elonmusk"],
|
|
72
|
+
[/\bmark zuckerberg\b/i, "zuck"],
|
|
73
|
+
[/\bzuck\b/i, "zuck"],
|
|
74
|
+
[/\bspora\s*ai\b/i, "sporaai"],
|
|
75
|
+
[/\bsporaai\b/i, "sporaai"]
|
|
76
|
+
];
|
|
77
|
+
function extractBareConstraintTargets(text) {
|
|
78
|
+
const found = /* @__PURE__ */ new Set();
|
|
79
|
+
const candidates = [
|
|
80
|
+
...text.matchAll(/\bonly\s+(?:reply|respond|interact|engage|talk|speak)(?:\s+\w+){0,3}\s+(?:to|with)\s+@?([a-zA-Z0-9_]{2,15})\b/gi),
|
|
81
|
+
...text.matchAll(/\b(?:reply|respond|interact|engage|talk|speak)\s+only(?:\s+\w+){0,3}\s+(?:to|with)\s+@?([a-zA-Z0-9_]{2,15})\b/gi)
|
|
82
|
+
];
|
|
83
|
+
for (const match of candidates) {
|
|
84
|
+
const raw = String(match[1] ?? "").replace(/'s$/i, "");
|
|
85
|
+
const handle = normalizeHandle(raw);
|
|
86
|
+
if (!handle) continue;
|
|
87
|
+
if (!/^[a-z0-9_]{2,15}$/.test(handle)) continue;
|
|
88
|
+
if (BARE_HANDLE_STOPWORDS.has(handle)) continue;
|
|
89
|
+
found.add(handle);
|
|
90
|
+
}
|
|
91
|
+
for (const [pattern, handle] of NAME_TO_HANDLE) {
|
|
92
|
+
if (pattern.test(text)) found.add(handle);
|
|
93
|
+
}
|
|
94
|
+
return [...found];
|
|
95
|
+
}
|
|
96
|
+
function includesOnlyQualifier(text) {
|
|
97
|
+
return /\b(only|just|exclusively|strictly)\b/i.test(text);
|
|
98
|
+
}
|
|
99
|
+
function includesReplyIntent(text) {
|
|
100
|
+
return /\b(reply|respond|response|replying)\b/i.test(text);
|
|
101
|
+
}
|
|
102
|
+
function includesInteractionIntent(text) {
|
|
103
|
+
return /\b(interact|engage|talk|chat|speak|communicate|message)\b/i.test(text);
|
|
104
|
+
}
|
|
105
|
+
function impliesNoOriginalPosts(text) {
|
|
106
|
+
const lower = text.toLowerCase();
|
|
107
|
+
if (/\bonly\s+repl(?:y|ies)\b/.test(lower)) return true;
|
|
108
|
+
if (/\brepl(?:y|ies)\s+only\b/.test(lower)) return true;
|
|
109
|
+
if (/\breply-?only\b/.test(lower)) return true;
|
|
110
|
+
if (/\b(no|never|don['’]?t|dont|avoid)\s+(?:do\s+)?(?:original\s+)?posts?\b/.test(lower)) return true;
|
|
111
|
+
if (/\bno\s+tweets?\b/.test(lower)) return true;
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
function getPersonaConstraints(identityArg) {
|
|
115
|
+
const identity = identityArg ?? loadIdentity();
|
|
116
|
+
const strictReplyHandles = /* @__PURE__ */ new Set();
|
|
117
|
+
const strictInteractionHandles = /* @__PURE__ */ new Set();
|
|
118
|
+
const lines = [
|
|
119
|
+
...identity.goals ?? [],
|
|
120
|
+
...identity.boundaries ?? [],
|
|
121
|
+
identity.bio ?? "",
|
|
122
|
+
identity.originStory ?? "",
|
|
123
|
+
identity.worldview ?? "",
|
|
124
|
+
identity.tone ?? ""
|
|
125
|
+
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
126
|
+
let replyOnlyMode = false;
|
|
127
|
+
let noOriginalPosts = false;
|
|
128
|
+
for (const line of lines) {
|
|
129
|
+
const handles = unique([
|
|
130
|
+
...extractHandles(line),
|
|
131
|
+
...extractBareConstraintTargets(line)
|
|
132
|
+
]);
|
|
133
|
+
const hasOnly = includesOnlyQualifier(line);
|
|
134
|
+
const hasReply = includesReplyIntent(line);
|
|
135
|
+
const hasInteract = includesInteractionIntent(line);
|
|
136
|
+
if (impliesNoOriginalPosts(line)) {
|
|
137
|
+
replyOnlyMode = true;
|
|
138
|
+
noOriginalPosts = true;
|
|
139
|
+
}
|
|
140
|
+
if (hasOnly && hasReply) {
|
|
141
|
+
replyOnlyMode = true;
|
|
142
|
+
noOriginalPosts = true;
|
|
143
|
+
for (const handle of handles) {
|
|
144
|
+
strictReplyHandles.add(handle);
|
|
145
|
+
strictInteractionHandles.add(handle);
|
|
146
|
+
}
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (hasOnly && hasInteract) {
|
|
150
|
+
noOriginalPosts = true;
|
|
151
|
+
for (const handle of handles) {
|
|
152
|
+
strictInteractionHandles.add(handle);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (strictReplyHandles.size > 0) {
|
|
157
|
+
replyOnlyMode = true;
|
|
158
|
+
noOriginalPosts = true;
|
|
159
|
+
}
|
|
160
|
+
if (strictInteractionHandles.size > 0) {
|
|
161
|
+
noOriginalPosts = true;
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
onlyReplyToHandles: [...strictReplyHandles],
|
|
165
|
+
onlyInteractWithHandles: [...strictInteractionHandles],
|
|
166
|
+
noOriginalPosts,
|
|
167
|
+
replyOnlyMode
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function personaConstraintHandles(constraints) {
|
|
171
|
+
return unique([
|
|
172
|
+
...constraints.onlyReplyToHandles.map(normalizeHandle),
|
|
173
|
+
...constraints.onlyInteractWithHandles.map(normalizeHandle)
|
|
174
|
+
]).filter(Boolean);
|
|
175
|
+
}
|
|
176
|
+
function buildPersonaConstraintLines(constraints) {
|
|
177
|
+
const lines = [];
|
|
178
|
+
if (constraints.onlyReplyToHandles.length > 0) {
|
|
179
|
+
lines.push(`- Hard constraint: only reply to @${constraints.onlyReplyToHandles.join(", @")}`);
|
|
180
|
+
} else if (constraints.replyOnlyMode) {
|
|
181
|
+
lines.push("- Hard constraint: reply-only mode (no like/retweet/follow/post actions).");
|
|
182
|
+
}
|
|
183
|
+
const onlyInteract = constraints.onlyInteractWithHandles.filter(
|
|
184
|
+
(handle) => !constraints.onlyReplyToHandles.includes(handle)
|
|
185
|
+
);
|
|
186
|
+
if (onlyInteract.length > 0) {
|
|
187
|
+
lines.push(`- Hard constraint: only interact with @${onlyInteract.join(", @")}`);
|
|
188
|
+
}
|
|
189
|
+
if (constraints.noOriginalPosts) {
|
|
190
|
+
lines.push("- Hard constraint: do not create standalone original posts.");
|
|
191
|
+
}
|
|
192
|
+
return lines;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// src/runtime/persona-action-profile.ts
|
|
196
|
+
function clamp(value, min, max) {
|
|
197
|
+
return Math.max(min, Math.min(max, value));
|
|
198
|
+
}
|
|
199
|
+
function unique2(values) {
|
|
200
|
+
return [...new Set(values)];
|
|
201
|
+
}
|
|
202
|
+
function normalizeText(text) {
|
|
203
|
+
return text.toLowerCase().trim();
|
|
204
|
+
}
|
|
205
|
+
function hasAny(text, terms) {
|
|
206
|
+
const lower = normalizeText(text);
|
|
207
|
+
return terms.some((term) => lower.includes(term));
|
|
208
|
+
}
|
|
209
|
+
function applyGoalBias(actionBias, sourceBias, goals, rationale) {
|
|
210
|
+
for (const goal of goals) {
|
|
211
|
+
if (hasAny(goal, ["grow followers", "go viral", "audience", "reach"])) {
|
|
212
|
+
actionBias.reply += 0.35;
|
|
213
|
+
actionBias.post += 0.45;
|
|
214
|
+
sourceBias.mention += 0.2;
|
|
215
|
+
rationale.push("growth goals favor reply+post mix");
|
|
216
|
+
}
|
|
217
|
+
if (hasAny(goal, ["build community", "community", "connect", "relationships"])) {
|
|
218
|
+
actionBias.reply += 0.4;
|
|
219
|
+
actionBias.like += 0.3;
|
|
220
|
+
actionBias.follow += 0.45;
|
|
221
|
+
sourceBias.people_watch += 0.35;
|
|
222
|
+
rationale.push("community goals favor social interaction actions");
|
|
223
|
+
}
|
|
224
|
+
if (hasAny(goal, ["debate", "challenge", "argue", "provoc"])) {
|
|
225
|
+
actionBias.reply += 0.5;
|
|
226
|
+
sourceBias.mention += 0.25;
|
|
227
|
+
rationale.push("debate goals bias toward replies in active conversations");
|
|
228
|
+
}
|
|
229
|
+
if (hasAny(goal, ["curate", "signal", "filter"])) {
|
|
230
|
+
actionBias.retweet += 0.8;
|
|
231
|
+
actionBias.like += 0.2;
|
|
232
|
+
sourceBias.topic_search += 0.35;
|
|
233
|
+
rationale.push("curation goals bias toward retweet/like actions");
|
|
234
|
+
}
|
|
235
|
+
if (hasAny(goal, ["seek truth", "research", "facts", "evidence"])) {
|
|
236
|
+
actionBias.reply += 0.25;
|
|
237
|
+
actionBias.post += 0.2;
|
|
238
|
+
sourceBias.topic_search += 0.45;
|
|
239
|
+
rationale.push("truth-seeking goals bias toward topic-search grounded actions");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function compilePersonaActionProfile(input) {
|
|
244
|
+
const { identity, strategy, constraints } = input;
|
|
245
|
+
const rationale = [];
|
|
246
|
+
const actionBias = {
|
|
247
|
+
reply: 0,
|
|
248
|
+
like: 0,
|
|
249
|
+
retweet: 0,
|
|
250
|
+
follow: 0,
|
|
251
|
+
post: 0
|
|
252
|
+
};
|
|
253
|
+
const sourceBias = {
|
|
254
|
+
mention: 0,
|
|
255
|
+
timeline: 0,
|
|
256
|
+
topic_search: 0,
|
|
257
|
+
people_watch: 0,
|
|
258
|
+
synthesis: 0
|
|
259
|
+
};
|
|
260
|
+
const mix = identity.engagementStrategy.contentMix;
|
|
261
|
+
actionBias.post += (mix.originalPosts - 25) / 25;
|
|
262
|
+
actionBias.reply += (mix.replies - 30) / 25;
|
|
263
|
+
actionBias.retweet += (mix.retweets - 15) / 20;
|
|
264
|
+
actionBias.like += (mix.likes - 15) / 20;
|
|
265
|
+
rationale.push("contentMix translated into action priors");
|
|
266
|
+
if (identity.engagementStrategy.replyStyle === "strategic") {
|
|
267
|
+
actionBias.reply += 0.3;
|
|
268
|
+
sourceBias.people_watch += 0.35;
|
|
269
|
+
sourceBias.topic_search += 0.25;
|
|
270
|
+
sourceBias.timeline -= 0.15;
|
|
271
|
+
rationale.push("strategic replyStyle favors selective people/topic opportunities");
|
|
272
|
+
} else if (identity.engagementStrategy.replyStyle === "reactive") {
|
|
273
|
+
actionBias.reply += 0.4;
|
|
274
|
+
sourceBias.mention += 0.45;
|
|
275
|
+
sourceBias.timeline += 0.2;
|
|
276
|
+
rationale.push("reactive replyStyle favors mentions/timeline");
|
|
277
|
+
} else if (identity.engagementStrategy.replyStyle === "generous") {
|
|
278
|
+
actionBias.reply += 0.25;
|
|
279
|
+
actionBias.like += 0.25;
|
|
280
|
+
sourceBias.mention += 0.25;
|
|
281
|
+
sourceBias.timeline += 0.2;
|
|
282
|
+
rationale.push("generous replyStyle favors broader conversation participation");
|
|
283
|
+
} else if (identity.engagementStrategy.replyStyle === "selective") {
|
|
284
|
+
sourceBias.people_watch += 0.25;
|
|
285
|
+
sourceBias.topic_search += 0.2;
|
|
286
|
+
sourceBias.timeline -= 0.2;
|
|
287
|
+
rationale.push("selective replyStyle favors quality-filtered contexts");
|
|
288
|
+
}
|
|
289
|
+
if (identity.engagementStrategy.followStrategy === "aggressive") {
|
|
290
|
+
actionBias.follow += 0.7;
|
|
291
|
+
rationale.push("aggressive followStrategy boosts follow actions");
|
|
292
|
+
} else if (identity.engagementStrategy.followStrategy === "none") {
|
|
293
|
+
actionBias.follow -= 2;
|
|
294
|
+
rationale.push("followStrategy=none suppresses follow actions");
|
|
295
|
+
} else if (identity.engagementStrategy.followStrategy === "curated") {
|
|
296
|
+
actionBias.follow -= 0.25;
|
|
297
|
+
sourceBias.people_watch += 0.15;
|
|
298
|
+
rationale.push("curated followStrategy slightly restricts follow actions");
|
|
299
|
+
}
|
|
300
|
+
const traits = identity.traits;
|
|
301
|
+
if (traits.curiosity >= 0.65) {
|
|
302
|
+
actionBias.reply += 0.35;
|
|
303
|
+
sourceBias.mention += 0.2;
|
|
304
|
+
sourceBias.people_watch += 0.2;
|
|
305
|
+
rationale.push("high curiosity increases reply preference");
|
|
306
|
+
}
|
|
307
|
+
if (traits.empathy >= 0.65) {
|
|
308
|
+
actionBias.like += 0.35;
|
|
309
|
+
actionBias.follow += 0.25;
|
|
310
|
+
rationale.push("high empathy increases supportive actions");
|
|
311
|
+
}
|
|
312
|
+
if (traits.confidence >= 0.7 || traits.aggression >= 0.65) {
|
|
313
|
+
actionBias.reply += 0.25;
|
|
314
|
+
actionBias.post += 0.15;
|
|
315
|
+
actionBias.like -= 0.15;
|
|
316
|
+
rationale.push("assertive traits increase reply/post decisiveness");
|
|
317
|
+
}
|
|
318
|
+
if (traits.originality >= 0.7) {
|
|
319
|
+
actionBias.post += 0.25;
|
|
320
|
+
actionBias.reply += 0.1;
|
|
321
|
+
sourceBias.synthesis += 0.25;
|
|
322
|
+
rationale.push("high originality favors fresh synthesis posts");
|
|
323
|
+
}
|
|
324
|
+
if (traits.humor >= 0.7) {
|
|
325
|
+
actionBias.reply += 0.15;
|
|
326
|
+
actionBias.post += 0.15;
|
|
327
|
+
sourceBias.timeline += 0.15;
|
|
328
|
+
rationale.push("high humor increases conversational/timeline engagement");
|
|
329
|
+
}
|
|
330
|
+
if (identity.vocabularyStyle === "casual" || identity.vocabularyStyle === "internet-native") {
|
|
331
|
+
actionBias.reply += 0.2;
|
|
332
|
+
actionBias.like += 0.1;
|
|
333
|
+
sourceBias.timeline += 0.2;
|
|
334
|
+
sourceBias.synthesis -= 0.15;
|
|
335
|
+
rationale.push("casual/internet-native vocabulary favors timeline-native interactions");
|
|
336
|
+
}
|
|
337
|
+
if (identity.tweetStyle === "one-liners" || identity.tweetStyle === "short-form") {
|
|
338
|
+
actionBias.reply += 0.25;
|
|
339
|
+
actionBias.like += 0.15;
|
|
340
|
+
actionBias.post -= 0.15;
|
|
341
|
+
sourceBias.timeline += 0.2;
|
|
342
|
+
rationale.push("short tweet style favors reactive conversational actions");
|
|
343
|
+
} else if (identity.tweetStyle === "threads") {
|
|
344
|
+
actionBias.post += 0.25;
|
|
345
|
+
sourceBias.synthesis += 0.2;
|
|
346
|
+
rationale.push("thread style favors synthesis-driven posting");
|
|
347
|
+
}
|
|
348
|
+
if (identity.framework !== "philosopher") {
|
|
349
|
+
sourceBias.synthesis -= 0.1;
|
|
350
|
+
rationale.push("non-philosopher frameworks slightly downweight abstract synthesis");
|
|
351
|
+
}
|
|
352
|
+
switch (identity.framework) {
|
|
353
|
+
case "conqueror":
|
|
354
|
+
actionBias.post += 0.45;
|
|
355
|
+
actionBias.reply += 0.35;
|
|
356
|
+
actionBias.follow += 0.25;
|
|
357
|
+
actionBias.like -= 0.2;
|
|
358
|
+
sourceBias.mention += 0.15;
|
|
359
|
+
rationale.push("conqueror framework favors decisive high-visibility actions");
|
|
360
|
+
break;
|
|
361
|
+
case "authentic":
|
|
362
|
+
actionBias.reply += 0.45;
|
|
363
|
+
actionBias.like += 0.4;
|
|
364
|
+
actionBias.follow += 0.2;
|
|
365
|
+
actionBias.post += 0.1;
|
|
366
|
+
sourceBias.mention += 0.25;
|
|
367
|
+
sourceBias.timeline += 0.2;
|
|
368
|
+
sourceBias.synthesis -= 0.15;
|
|
369
|
+
rationale.push("authentic framework favors relational and grounded conversation");
|
|
370
|
+
break;
|
|
371
|
+
case "curator":
|
|
372
|
+
actionBias.retweet += 0.8;
|
|
373
|
+
actionBias.like += 0.3;
|
|
374
|
+
actionBias.post -= 0.2;
|
|
375
|
+
rationale.push("curator framework favors retweets/likes");
|
|
376
|
+
break;
|
|
377
|
+
case "community-builder":
|
|
378
|
+
actionBias.reply += 0.35;
|
|
379
|
+
actionBias.like += 0.3;
|
|
380
|
+
actionBias.follow += 0.35;
|
|
381
|
+
rationale.push("community-builder framework favors relationship actions");
|
|
382
|
+
break;
|
|
383
|
+
case "growth-hacker":
|
|
384
|
+
actionBias.post += 0.3;
|
|
385
|
+
actionBias.reply += 0.25;
|
|
386
|
+
rationale.push("growth-hacker framework favors visible output + replies");
|
|
387
|
+
break;
|
|
388
|
+
case "truthseeker":
|
|
389
|
+
actionBias.reply += 0.25;
|
|
390
|
+
actionBias.post += 0.2;
|
|
391
|
+
sourceBias.topic_search += 0.3;
|
|
392
|
+
rationale.push("truthseeker framework favors research-grounded conversation");
|
|
393
|
+
break;
|
|
394
|
+
case "philosopher":
|
|
395
|
+
actionBias.post += 0.35;
|
|
396
|
+
actionBias.reply += 0.1;
|
|
397
|
+
sourceBias.synthesis += 0.25;
|
|
398
|
+
rationale.push("philosopher framework leans toward original perspective posts");
|
|
399
|
+
break;
|
|
400
|
+
case "provocateur":
|
|
401
|
+
actionBias.reply += 0.55;
|
|
402
|
+
actionBias.post += 0.35;
|
|
403
|
+
actionBias.like -= 0.15;
|
|
404
|
+
sourceBias.mention += 0.25;
|
|
405
|
+
sourceBias.timeline += 0.15;
|
|
406
|
+
rationale.push("provocateur framework favors sharp, conversational confrontation");
|
|
407
|
+
break;
|
|
408
|
+
case "shitposter":
|
|
409
|
+
actionBias.post += 0.45;
|
|
410
|
+
actionBias.reply += 0.25;
|
|
411
|
+
sourceBias.timeline += 0.2;
|
|
412
|
+
rationale.push("shitposter framework favors high-frequency social expression");
|
|
413
|
+
break;
|
|
414
|
+
default:
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
applyGoalBias(actionBias, sourceBias, identity.goals ?? [], rationale);
|
|
418
|
+
if ((strategy.currentFocus ?? []).length > 0 || (strategy.shortTermGoals ?? []).length > 0) {
|
|
419
|
+
sourceBias.topic_search += 0.2;
|
|
420
|
+
sourceBias.people_watch += 0.15;
|
|
421
|
+
rationale.push("active strategy focus boosts targeted discovery sources");
|
|
422
|
+
}
|
|
423
|
+
if (constraints.noOriginalPosts) {
|
|
424
|
+
actionBias.post -= 2;
|
|
425
|
+
rationale.push("hard constraint suppresses original posts");
|
|
426
|
+
}
|
|
427
|
+
if (constraints.replyOnlyMode) {
|
|
428
|
+
actionBias.reply += 1.5;
|
|
429
|
+
actionBias.like -= 1.2;
|
|
430
|
+
actionBias.retweet -= 1.2;
|
|
431
|
+
actionBias.follow -= 1.2;
|
|
432
|
+
actionBias.post -= 2;
|
|
433
|
+
rationale.push("reply-only hard constraint dominates action policy");
|
|
434
|
+
}
|
|
435
|
+
const clampedActionBias = {
|
|
436
|
+
reply: clamp(actionBias.reply, -2.5, 2.5),
|
|
437
|
+
like: clamp(actionBias.like, -2.5, 2.5),
|
|
438
|
+
retweet: clamp(actionBias.retweet, -2.5, 2.5),
|
|
439
|
+
follow: clamp(actionBias.follow, -2.5, 2.5),
|
|
440
|
+
post: clamp(actionBias.post, -2.5, 2.5)
|
|
441
|
+
};
|
|
442
|
+
const clampedSourceBias = {
|
|
443
|
+
mention: clamp(sourceBias.mention, -1.5, 1.5),
|
|
444
|
+
timeline: clamp(sourceBias.timeline, -1.5, 1.5),
|
|
445
|
+
topic_search: clamp(sourceBias.topic_search, -1.5, 1.5),
|
|
446
|
+
people_watch: clamp(sourceBias.people_watch, -1.5, 1.5),
|
|
447
|
+
synthesis: clamp(sourceBias.synthesis, -1.5, 1.5)
|
|
448
|
+
};
|
|
449
|
+
const prioritizedActions = Object.entries(clampedActionBias).sort((a, b) => b[1] - a[1]).map(([action]) => action);
|
|
450
|
+
const priorityTopics = unique2(
|
|
451
|
+
[
|
|
452
|
+
...identity.topics ?? [],
|
|
453
|
+
...strategy.currentFocus ?? [],
|
|
454
|
+
...strategy.shortTermGoals ?? []
|
|
455
|
+
].map((topic) => String(topic).trim()).filter(Boolean).slice(0, 12)
|
|
456
|
+
);
|
|
457
|
+
return {
|
|
458
|
+
actionBias: clampedActionBias,
|
|
459
|
+
sourceBias: clampedSourceBias,
|
|
460
|
+
prioritizedActions,
|
|
461
|
+
priorityTopics,
|
|
462
|
+
rationale: unique2(rationale).slice(0, 12)
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
|
|
26
466
|
// src/runtime/prompt-builder.ts
|
|
27
467
|
var PROMPT_TOKEN_STOPWORDS = /* @__PURE__ */ new Set([
|
|
28
468
|
"about",
|
|
@@ -145,6 +585,7 @@ function buildVoiceLockLines(identity) {
|
|
|
145
585
|
}
|
|
146
586
|
function buildSystemPrompt() {
|
|
147
587
|
const identity = loadIdentity();
|
|
588
|
+
const constraints = getPersonaConstraints(identity);
|
|
148
589
|
const config = loadConfig();
|
|
149
590
|
const identityDoc = renderIdentityDocument(identity);
|
|
150
591
|
const sections = [];
|
|
@@ -154,6 +595,13 @@ function buildSystemPrompt() {
|
|
|
154
595
|
for (const line of buildVoiceLockLines(identity)) {
|
|
155
596
|
sections.push(line);
|
|
156
597
|
}
|
|
598
|
+
const constraintLines = buildPersonaConstraintLines(constraints);
|
|
599
|
+
if (constraintLines.length > 0) {
|
|
600
|
+
sections.push("- Operational constraints override all other behavior:");
|
|
601
|
+
for (const line of constraintLines) {
|
|
602
|
+
sections.push(` ${line}`);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
157
605
|
sections.push("");
|
|
158
606
|
sections.push("## Your Identity");
|
|
159
607
|
sections.push(identityDoc);
|
|
@@ -442,7 +890,9 @@ function buildToolDecisionMessage(input) {
|
|
|
442
890
|
}
|
|
443
891
|
function buildOpportunityPortfolioMessage(input) {
|
|
444
892
|
const identity = loadIdentity();
|
|
893
|
+
const constraints = getPersonaConstraints(identity);
|
|
445
894
|
const strategy = loadStrategy();
|
|
895
|
+
const personaProfile = compilePersonaActionProfile({ identity, strategy, constraints });
|
|
446
896
|
const recentWritten = recentWrittenTextsForPrompt(12);
|
|
447
897
|
const overusedOpenings = findOverusedOpenings(recentWritten);
|
|
448
898
|
const overusedTokens = findOverusedTokens(recentWritten);
|
|
@@ -467,6 +917,21 @@ function buildOpportunityPortfolioMessage(input) {
|
|
|
467
917
|
for (const line of buildVoiceLockLines(identity)) {
|
|
468
918
|
parts.push(line);
|
|
469
919
|
}
|
|
920
|
+
const constraintLines = buildPersonaConstraintLines(constraints);
|
|
921
|
+
if (constraintLines.length > 0) {
|
|
922
|
+
parts.push("Operational constraints (hard):");
|
|
923
|
+
for (const line of constraintLines) {
|
|
924
|
+
parts.push(line);
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
parts.push("Persona action priors (soft):");
|
|
928
|
+
parts.push(`- Preferred actions this heartbeat: ${personaProfile.prioritizedActions.slice(0, 4).join(", ")}`);
|
|
929
|
+
parts.push(
|
|
930
|
+
`- Preferred sources: ${Object.entries(personaProfile.sourceBias).sort((a, b) => b[1] - a[1]).map(([source]) => source).slice(0, 3).join(", ")}`
|
|
931
|
+
);
|
|
932
|
+
if (personaProfile.priorityTopics.length > 0) {
|
|
933
|
+
parts.push(`- Priority topics: ${personaProfile.priorityTopics.slice(0, 6).join(", ")}`);
|
|
934
|
+
}
|
|
470
935
|
parts.push("");
|
|
471
936
|
parts.push("Human style rotation:");
|
|
472
937
|
parts.push("- For each `reply`/`post`, pick one lane: quick reaction, curious question, friendly pushback, playful line, plain observation.");
|
|
@@ -735,6 +1200,10 @@ function buildReflectionPrompt(actionResults) {
|
|
|
735
1200
|
}
|
|
736
1201
|
|
|
737
1202
|
export {
|
|
1203
|
+
getPersonaConstraints,
|
|
1204
|
+
personaConstraintHandles,
|
|
1205
|
+
buildPersonaConstraintLines,
|
|
1206
|
+
compilePersonaActionProfile,
|
|
738
1207
|
buildSystemPrompt,
|
|
739
1208
|
buildHeartbeatUserMessage,
|
|
740
1209
|
buildToolDecisionMessage,
|
|
@@ -743,4 +1212,4 @@ export {
|
|
|
743
1212
|
buildTrainingChatPrompt,
|
|
744
1213
|
buildReflectionPrompt
|
|
745
1214
|
};
|
|
746
|
-
//# sourceMappingURL=chunk-
|
|
1215
|
+
//# sourceMappingURL=chunk-JIMONWKO.js.map
|