pyre-agent-kit 3.4.33 → 3.4.35
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/agent.js +49 -36
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -95,13 +95,16 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
|
|
|
95
95
|
--- GOAL:
|
|
96
96
|
Maximize long-term profit and faction dominance.
|
|
97
97
|
--- LEGEND:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
Factions are rival guilds with full treasuries. Higher MCAP = more power. Lifecycle: RS → RD → ASN.
|
|
99
|
+
FID: the faction identifier.
|
|
100
|
+
STATUS: RS, RD, ASN
|
|
101
|
+
RS: rising. new faction, higher risk but early to the right one is higher reward. 0.5% tax, early = more contributed to treasury
|
|
102
|
+
RD: ready, community transition stage before ascend.
|
|
103
|
+
ASN: ascended factions, established. treasuries active. 0.04% war tax to the faction.
|
|
104
|
+
MBR: true = you are a member of the faction.
|
|
105
|
+
FNR: true = you founded it.
|
|
106
|
+
SENT: sentiment score. positive = bullish, negative = bearish.
|
|
107
|
+
AL/RVL: ally/rival agents, prefixed @AP.
|
|
105
108
|
LOAN - you have an active loan against this faction.
|
|
106
109
|
--- YOU ARE:
|
|
107
110
|
NAME: @AP${agent.publicKey.slice(0, 4)}
|
|
@@ -109,7 +112,7 @@ BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personal
|
|
|
109
112
|
MEMORIES: ${memoryBlock}
|
|
110
113
|
P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL | VALUE: ${totalHoldingsValue.toFixed(4)} SOL | UNREALIZED: ${unrealizedPnl >= 0 ? '+' : ''}${unrealizedPnl.toFixed(4)} SOL
|
|
111
114
|
SPEND RANGE: ${minSol}–${maxSol} SOL
|
|
112
|
-
${unrealizedPnl > 0.1 ? '
|
|
115
|
+
${unrealizedPnl > 0.1 ? 'YOU ARE UP — consider taking profits with (-) on winners.' : unrealizedPnl < -0.05 ? 'YOU ARE DOWN — be conservative. Cut losers with (-). Smaller positions.' : 'YOU BREAKEVEN — look for conviction plays.'}
|
|
113
116
|
--- INTEL:
|
|
114
117
|
AL: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
|
|
115
118
|
RVL: ${agent.rivals.size > 0 ? [...agent.rivals].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
|
|
@@ -151,18 +154,19 @@ ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
|
|
|
151
154
|
- (-) to lock in profits or cut losers. Don't stay in underperformers.
|
|
152
155
|
- Coordinate with AL agents to push RS factions toward ASN.
|
|
153
156
|
- Your holdings ARE your identity. Promote what you hold. Attack what you don't.${factionCtx.all.length <= 2 ? '\n- Few factions active — consider (%).' : ''}
|
|
157
|
+
--- EXAMPLES:
|
|
158
|
+
(+) ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"
|
|
159
|
+
(-) ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"
|
|
160
|
+
(&) ${m} "${(0, util_1.pick)(['doubling down.', 'conviction play.', 'added more.'])}"
|
|
161
|
+
(!) ${f2} "${(0, util_1.pick)(['just looking around.', 'checking the vibes.', 'scouting.', 'sneaking in, opportunity here.'])}"
|
|
162
|
+
(=) ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"
|
|
163
|
+
(#) ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"
|
|
164
|
+
(^) ${m}
|
|
165
|
+
(~) ${m}
|
|
154
166
|
---
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
EXAMPLE: (!) ${f2} "${(0, util_1.pick)(['just looking around.', 'checking the vibes.', 'scouting.', 'sneaking in, opportunity here.'])}"
|
|
159
|
-
EXAMPLE: (^) ${m}
|
|
160
|
-
EXAMPLE: (~) ${m}
|
|
161
|
-
EXAMPLE: (=) ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"
|
|
162
|
-
EXAMPLE: (#) ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"
|
|
163
|
-
---
|
|
164
|
-
Output EXACTLY one line: (symbol) $ "*"
|
|
165
|
-
>`;
|
|
167
|
+
Output EXACTLY one line: (action) $ "*"
|
|
168
|
+
example format: (+) ${f1} "looks good here."
|
|
169
|
+
your move>`;
|
|
166
170
|
};
|
|
167
171
|
exports.buildAgentPrompt = buildAgentPrompt;
|
|
168
172
|
const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages, solRange, holdings) => {
|
|
@@ -180,9 +184,11 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
180
184
|
.filter(Boolean)
|
|
181
185
|
.sort((a, b) => b.valueSol - a.valueSol);
|
|
182
186
|
const pnl = (gameState.totalSolReceived - gameState.totalSolSpent) / 1e9;
|
|
187
|
+
const totalHoldingsValue = valued.reduce((sum, v) => sum + v.valueSol, 0);
|
|
188
|
+
const unrealizedPnl = totalHoldingsValue + pnl;
|
|
183
189
|
const founded = gameState.founded.slice(0, 2).map((m) => m.slice(-8));
|
|
184
190
|
const heldMints = new Set(holdingsEntries.map(([m]) => m));
|
|
185
|
-
const memberOf = valued.map((v) => v.id);
|
|
191
|
+
const memberOf = valued.filter((v) => v.valueSol > 0.001).map((v) => v.id);
|
|
186
192
|
const sentimentList = [...kit.state.sentimentMap]
|
|
187
193
|
.filter(([mint]) => heldMints.has(mint))
|
|
188
194
|
.map(([mint, score]) => {
|
|
@@ -252,9 +258,14 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
252
258
|
--- GOAL:
|
|
253
259
|
Maximize long-term profit and faction dominance.
|
|
254
260
|
--- LEGEND:
|
|
255
|
-
Factions are rival guilds with treasuries. Higher MCAP = more power. Lifecycle: RS → RD → ASN.
|
|
256
|
-
|
|
257
|
-
|
|
261
|
+
Factions are rival guilds with full treasuries. Higher MCAP = more power. Lifecycle: RS → RD → ASN.
|
|
262
|
+
FID: the faction identifier.
|
|
263
|
+
STATUS: RS, RD, ASN
|
|
264
|
+
RS: rising. new faction, higher risk but early to the right one is higher reward. 0.5% tax, early = more contributed to treasury
|
|
265
|
+
RD: ready, community transition stage before ascend.
|
|
266
|
+
ASN: ascended factions, established. treasuries active. 0.04% war tax to the faction.
|
|
267
|
+
MBR: true = you are a member of the faction.
|
|
268
|
+
FNR: true = you founded it.
|
|
258
269
|
SENT: sentiment score. positive = bullish, negative = bearish.
|
|
259
270
|
AL/RVL: ally/rival agents, prefixed @AP.
|
|
260
271
|
--- YOU ARE:
|
|
@@ -262,6 +273,7 @@ NAME: @AP${agent.publicKey.slice(0, 4)}
|
|
|
262
273
|
BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personality]}
|
|
263
274
|
LAST MOVES: ${kit.state.history.length > 0 ? [...kit.state.history].slice(-2).join('; ') : 'none'}
|
|
264
275
|
P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
|
|
276
|
+
${unrealizedPnl > 0.1 ? 'YOU ARE UP. Consider (-) to take profits on winners.' : unrealizedPnl < -0.05 ? 'YOU ARE DOWN. Be conservative. (-) losers. Smaller positions.' : 'BREAKEVEN. Look for conviction plays.'}
|
|
265
277
|
--- INTEL:
|
|
266
278
|
AL: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 2).map(a => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
|
|
267
279
|
RVL: ${agent.rivals.size > 0 ? [...agent.rivals].slice(0, 2).map(a => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
|
|
@@ -278,7 +290,7 @@ ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
|
|
|
278
290
|
(#) $ "*" - trash talk a faction.
|
|
279
291
|
(^) $ - ascend a faction.
|
|
280
292
|
(~) $ - harvest fees into treasury.
|
|
281
|
-
(%) ";" - create a faction.
|
|
293
|
+
(%) ";" - create a new faction.
|
|
282
294
|
- REPLACE $ with exactly ONE choice from FACTIONS using the FID column (always contains the pw suffix).
|
|
283
295
|
- REPLACE * with a ONE sentence RESPONSE for your ACTION, always in double quotes.
|
|
284
296
|
- REPLACE ; with a unique faction inspired name (eg. "Glitch Cult", "Whale Syndicate"), always in double quotes. only for (%).
|
|
@@ -295,16 +307,17 @@ ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
|
|
|
295
307
|
- Promote factions you are in. Attack your rival factions.
|
|
296
308
|
- (=)/(#) move sentiment and help coordinate with other agents — use (=) to promote your winners and (#) to fud your losers.
|
|
297
309
|
- (-) to lock in profits or downsize on underperforming factions.
|
|
310
|
+
--- EXAMPLES:
|
|
311
|
+
(+) ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"
|
|
312
|
+
(-) ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"
|
|
313
|
+
(&) ${m} "${(0, util_1.pick)(['doubling down.', 'conviction play.', 'added more.'])}"
|
|
314
|
+
(!) ${f2} "${(0, util_1.pick)(['just looking around.', 'checking the vibes.', 'scouting.', 'sneaking in, opportunity here.'])}"
|
|
315
|
+
(=) ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"
|
|
316
|
+
(#) ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"
|
|
298
317
|
---
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
EXAMPLE: (!) ${f2} "${(0, util_1.pick)(['just looking around.', 'checking the vibes.', 'scouting.', 'sneaking in, opportunity here.'])}"
|
|
303
|
-
EXAMPLE: (=) ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"
|
|
304
|
-
EXAMPLE: (#) ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"
|
|
305
|
-
---
|
|
306
|
-
Output EXACTLY one line: (symbol) $ "*"
|
|
307
|
-
>`;
|
|
318
|
+
Output EXACTLY one line: (action) $ "*"
|
|
319
|
+
example format: (+) ${f1} "looks good here."
|
|
320
|
+
your move>`;
|
|
308
321
|
};
|
|
309
322
|
exports.buildCompactModelPrompt = buildCompactModelPrompt;
|
|
310
323
|
/**
|
|
@@ -397,7 +410,7 @@ function parseLLMDecision(raw, factions, kit, agent, holdings, solRange) {
|
|
|
397
410
|
return { action: 'scout', faction: scoutMatch[1], reasoning: line };
|
|
398
411
|
}
|
|
399
412
|
// Strip YOUR MOVE: prefix before symbol detection
|
|
400
|
-
const stripped = line.trim().replace(/^(?:YOUR MOVE|YOUR MOVE
|
|
413
|
+
const stripped = line.trim().replace(/^(?:YOUR MOVE|YOUR MOVE:|your move>?)\s*:?\s*/i, '');
|
|
401
414
|
// Compact symbol actions like (+), (-), (#) — skip aggressive cleaning that would mangle them
|
|
402
415
|
const symbolActionMatch = stripped.match(/^(\([+\-!&#^~=%]\))\s+(.*)/) || stripped.match(/^([+\-!&#^~=%])\s+(.*)/);
|
|
403
416
|
const cleaned = symbolActionMatch
|
|
@@ -405,7 +418,7 @@ function parseLLMDecision(raw, factions, kit, agent, holdings, solRange) {
|
|
|
405
418
|
: line
|
|
406
419
|
.replace(/\*+/g, '')
|
|
407
420
|
.replace(/^[-•>#\d.)\s]+/, '')
|
|
408
|
-
.replace(/^(?:WARNING|NOTE|RESPONSE|OUTPUT|ANSWER|RESULT|SCPRT|SCRIPT|YOUR MOVE|YOUR MOVE
|
|
421
|
+
.replace(/^(?:WARNING|NOTE|RESPONSE|OUTPUT|ANSWER|RESULT|SCPRT|SCRIPT|YOUR MOVE|YOUR MOVE:|your move>?)\s*:?\s*/i, '')
|
|
409
422
|
.replace(/^ACTION\s+/i, '')
|
|
410
423
|
.replace(/^I\s+(?=JOIN|DEFECT|RALLY|LAUNCH|MESSAGE|FUD|REINFORCE|INFILTRATE|WAR_LOAN|REPAY_LOAN|SIEGE|ASCEND|RAZE|TITHE|SCOUT)/i, '')
|
|
411
424
|
.replace(/[АаА]/g, 'A')
|
|
@@ -622,7 +635,7 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
|
|
|
622
635
|
const intel = await (0, faction_1.fetchFactionIntel)(kit, heldFaction);
|
|
623
636
|
const latest = intel.recentComms.find((c) => c.sender !== agent.publicKey);
|
|
624
637
|
if (latest) {
|
|
625
|
-
intelSnippet =
|
|
638
|
+
intelSnippet = `@AP${latest.sender.slice(0, 4)} in ${intel.symbol}: "${latest.memo.replace(/^<+/, '').replace(/>+\s*$/, '').slice(0, 60)}"`;
|
|
626
639
|
}
|
|
627
640
|
}
|
|
628
641
|
}
|