pyre-agent-kit 3.4.4 → 3.4.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/agent.js +56 -35
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -67,8 +67,8 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
|
|
|
67
67
|
})
|
|
68
68
|
.filter(Boolean)
|
|
69
69
|
.join(', ') || 'no strong feelings yet';
|
|
70
|
-
const allyList = agent.allies.size > 0 ? [...agent.allies].map((a) => a.slice(0, 8)).join(', ') : 'none';
|
|
71
|
-
const rivalList = agent.rivals.size > 0 ? [...agent.rivals].map((a) => a.slice(0, 8)).join(', ') : 'none';
|
|
70
|
+
const allyList = agent.allies.size > 0 ? [...agent.allies].map((a) => `@${a.slice(0, 8)}`).join(', ') : 'none';
|
|
71
|
+
const rivalList = agent.rivals.size > 0 ? [...agent.rivals].map((a) => `@${a.slice(0, 8)}`).join(', ') : 'none';
|
|
72
72
|
const doNotRepeat = recentMessages.length > 0
|
|
73
73
|
? `\nDO NOT REPEAT OR PARAPHRASE:\n${recentMessages.map((m) => `- "${m}"`).join('\n')}\n`
|
|
74
74
|
: '';
|
|
@@ -113,6 +113,14 @@ ACTIVE LOANS: ${gameState.activeLoans.size > 0 ? `${[...gameState.activeLoans].m
|
|
|
113
113
|
ALLIES: ${allyList}
|
|
114
114
|
RIVALS: ${rivalList}
|
|
115
115
|
${unrealizedPnl > 0.1 ? 'You are UP. Consider taking profits on your biggest winners with DEFECT.' : unrealizedPnl < -0.05 ? 'You are DOWN. Be conservative. Cut losers with DEFECT. Smaller positions.' : 'Near breakeven. Look for conviction plays.'}
|
|
116
|
+
--- VOICE:
|
|
117
|
+
- Your personality is your tone.
|
|
118
|
+
- First person only. Be specific — @address (e.g. @${Math.random().toString(36).slice(2, 10)}), real numbers, real moves. Never generic.
|
|
119
|
+
- What you say MUST match the intent of action you are taking.
|
|
120
|
+
- Write something original and unique every time. Talk TO agents, not about them.
|
|
121
|
+
- Be concise. Under 80 chars, plain English, one sentence. No hashtags, no angle brackets.
|
|
122
|
+
- Referencing your actual P&L in messages is more convincing to other agents than if your claims do not match your actions.
|
|
123
|
+
- Your message should reflect YOUR faction.${doNotRepeat}
|
|
116
124
|
--- ACTIONS:
|
|
117
125
|
JOIN $ "*" — join a faction.
|
|
118
126
|
DEFECT $ "*" — leave or downsize a faction.
|
|
@@ -135,28 +143,20 @@ EXAMPLE: JOIN ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.
|
|
|
135
143
|
EXAMPLE: DEFECT ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"
|
|
136
144
|
EXAMPLE: REINFORCE ${m} "${(0, util_1.pick)(['doubling down.', 'conviction play.', 'added more.'])}"
|
|
137
145
|
EXAMPLE: INFILTRATE ${f2} "${(0, util_1.pick)(['just looking around.', 'checking the vibes.', 'scouting.', 'sneaking in, opportunity here.'])}"
|
|
146
|
+
EXAMPLE: ASCEND ${m}
|
|
147
|
+
EXAMPLE: TITHE ${m}
|
|
138
148
|
EXAMPLE: MESSAGE ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"
|
|
139
149
|
EXAMPLE: FUD ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"
|
|
140
|
-
--- VOICE:
|
|
141
|
-
- Your personality is your tone.
|
|
142
|
-
- First person only. Be specific — @address (e.g. @${Math.random().toString(36).slice(2, 10)}), real numbers, real moves. Never generic.
|
|
143
|
-
- What you say MUST match the intent of action you are taking.
|
|
144
|
-
- Write something original and unique every time. Talk TO agents, not about them.
|
|
145
|
-
- Be concise. Under 80 chars, plain English, one sentence. No hashtags, no angle brackets.
|
|
146
|
-
- Your message should reflect YOUR faction.
|
|
147
|
-
${doNotRepeat}
|
|
148
|
-
--- RULES:
|
|
149
|
-
- Respond with EXACTLY one line.
|
|
150
|
-
- ONE MOVE PER TURN.
|
|
151
150
|
--- STRATEGY:
|
|
152
151
|
- Limit to being a member of ~5 faction. MESSAGE/FUD in others is fine but factions you are in focused.${positionValues.length > 5 ? ` You are a member of ${positionValues.length} factions — consider DEFECT from your weakest.` : ''}
|
|
153
152
|
- MESSAGE/FUD cost almost nothing but move sentiment and help you coordinate with other agents — use them.
|
|
154
|
-
- Collaborate and coordinate with other agents to push factions. Working together can help you profit together.
|
|
153
|
+
- Collaborate and coordinate with other agents to push factions. Working together can help you profit together. You need to coordinate to push RISING factions to ASCENDED.
|
|
154
|
+
- If you FOUNDED a faction, consider JOIN and promote it to other agents.
|
|
155
155
|
- REINFORCE factions you believe in. Don't JOIN the same faction twice.
|
|
156
156
|
- DEFECT to lock in profits or cut losses. Don't stay in losers. You can only DEFECT or FUD factions you are a member of.
|
|
157
|
-
- Your holdings ARE your identity. Promote what you hold. Attack what you don't.
|
|
158
|
-
- Reference your actual P&L in messages. Agents who talk numbers are more convincing.${factionCtx.all.length <= 2 ? '\n- Few factions active — consider LAUNCH.' : ''}
|
|
157
|
+
- Your holdings ARE your identity. Promote what you hold. Attack what you don't.${factionCtx.all.length <= 2 ? '\n- Few factions active — consider LAUNCH.' : ''}
|
|
159
158
|
---
|
|
159
|
+
ONE MOVE PER TURN.
|
|
160
160
|
Your move:`;
|
|
161
161
|
};
|
|
162
162
|
exports.buildAgentPrompt = buildAgentPrompt;
|
|
@@ -175,6 +175,7 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
175
175
|
.filter(Boolean)
|
|
176
176
|
.sort((a, b) => b.valueSol - a.valueSol);
|
|
177
177
|
const pnl = (gameState.totalSolReceived - gameState.totalSolSpent) / 1e9;
|
|
178
|
+
const founded = gameState.founded.slice(0, 3);
|
|
178
179
|
const heldMints = new Set(holdingsEntries.map(([m]) => m));
|
|
179
180
|
const memberOf = valued.slice(0, 5).map((v) => v.symbol);
|
|
180
181
|
const sentimentList = [...kit.state.sentimentMap]
|
|
@@ -197,21 +198,25 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
197
198
|
const m = memberOf[0] || (validatedFactions.length > 0 ? (0, util_1.pick)(validatedFactions).symbol : 'IRON');
|
|
198
199
|
const f1 = validatedFactions.length > 0 ? (0, util_1.pick)(validatedFactions).symbol : m;
|
|
199
200
|
const f2 = validatedFactions.length > 1 ? (0, util_1.pick)(validatedFactions.filter(f => f.symbol !== f1)).symbol ?? f1 : f1;
|
|
200
|
-
|
|
201
|
+
const allies = gameState.founded;
|
|
202
|
+
return `You are an autonomous agent playing in Pyre, a faction warfare game. Maximize long-term profit and faction dominance.
|
|
201
203
|
--- INFO:
|
|
202
204
|
Factions are rival guilds and economies, with treasuries, members, and culture.
|
|
203
205
|
FACTION LIFECYCLE: LAUNCH → RISING → READY → VOTE → ASCENDED
|
|
204
|
-
RISING: new
|
|
205
|
-
ASCENDED: established. 0.04% war tax on every transaction — harvestable into the treasury.
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
YOU: ${agent.publicKey.slice(0, 8)} - ${defaults_1.personalityDesc[agent.personality]}
|
|
206
|
+
RISING FACTIONS: new. 0.5% realm tax + early moves contribute more to the treasury. later moves contribute less.
|
|
207
|
+
ASCENDED FACTIONS: established. 0.04% war tax on every transaction — harvestable into the treasury.
|
|
208
|
+
--- YOU:
|
|
209
|
+
NAME: ${agent.publicKey.slice(0, 8)}
|
|
210
|
+
PERSONALITY: ${defaults_1.personalityDesc[agent.personality]}
|
|
210
211
|
P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
|
|
212
|
+
FOUNDED: ${founded.length > 0 ? founded : 'none'}
|
|
211
213
|
MEMBER OF: ${memberOf.length > 0 ? memberOf.join(', ') : 'none'}
|
|
212
214
|
MEMBERSHIP VALUE: ${valued.length > 0 ? valued.map(v => `${v.symbol}: ${v.valueSol.toFixed(4)} SOL`).join(', ') : 'no value'}
|
|
213
215
|
SENTIMENT: ${sentimentList}
|
|
216
|
+
-- REALM:
|
|
214
217
|
FACTIONS: ${validatedFactions.length > 0 ? validatedFactions.map(f => f.symbol).join(', ') : 'none'}
|
|
218
|
+
ALLIES: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 3).map(a => `@${a.slice(0, 8)}`).join(', ') : 'none'}
|
|
219
|
+
INTEL: ${intelSnippet}
|
|
215
220
|
--- ACTIONS:
|
|
216
221
|
JOIN $ "*" - join a faction.
|
|
217
222
|
DEFECT $ "*" - leave or decrease position in a faction you are a MEMBER OF.
|
|
@@ -223,26 +228,26 @@ ASCEND $ - transition a faction from ready to ascended.
|
|
|
223
228
|
TITHE $ - harvest fees into the treasury.
|
|
224
229
|
LAUNCH "^" - create a faction.
|
|
225
230
|
- REPLACE $ with exactly ONE choice from FACTIONS or MEMBER OF (if not none).
|
|
226
|
-
- REPLACE * with a ONE sentence explaination for your ACTION, always in double quotes.
|
|
231
|
+
- REPLACE * with a ONE sentence explaination for your ACTION or talk to other agents from ALLIES and INTEL with @address (e.g. @${Math.random().toString(36).slice(2, 10)}), always in double quotes. NOT AVAILABLE on ASCEND, TITHE, FUD, or LAUNCH.
|
|
227
232
|
- REPLACE ^ with a creative faction name (eg. "Glitch Cult", "Whale Syndicate"), always in double quotes.
|
|
233
|
+
EXAMPLE: JOIN ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"
|
|
234
|
+
EXAMPLE: DEFECT ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"
|
|
235
|
+
EXAMPLE: REINFORCE ${m} "${(0, util_1.pick)(['doubling down.', 'conviction play.', 'added more.'])}"
|
|
236
|
+
EXAMPLE: ASCEND ${m}
|
|
237
|
+
EXAMPLE: TITHE ${m}
|
|
238
|
+
EXAMPLE: MESSAGE ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"
|
|
239
|
+
EXAMPLE: FUD ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"
|
|
228
240
|
--- STRATEGY:
|
|
229
241
|
- Your personality is your tone.
|
|
230
242
|
- Promote factions you are in. Attack your rivals.
|
|
231
243
|
- Limit yourself to being a MEMBER OF 5 factions.${memberOf.length > 3 ? ` You are a MEMBER OF ${memberOf.length} factions — consider DEFECT from your weakest.` : ''}
|
|
232
244
|
- If no FACTIONS or you are not a MEMBER OF any, consider LAUNCH.
|
|
233
|
-
- If you
|
|
245
|
+
- If you FOUNDED a faction, JOIN and promote it.
|
|
234
246
|
- MESSAGE/FUD move sentiment and help coordinate with other agents — use them.
|
|
235
|
-
- DEFECT to lock in profits or downsize on underperforming faction.
|
|
236
247
|
- To REINFORCE, DEFECT or FUD, you MUST be a MEMBER OF the faction.
|
|
248
|
+
- DEFECT to lock in profits or downsize on underperforming faction.
|
|
237
249
|
---
|
|
238
|
-
|
|
239
|
-
EXAMPLE: DEFECT ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"
|
|
240
|
-
EXAMPLE: REINFORCE ${m} "${(0, util_1.pick)(['doubling down.', 'conviction play.', 'added more.'])}"
|
|
241
|
-
EXAMPLE: INFILTRATE ${f2} "${(0, util_1.pick)(['just looking around.', 'checking the vibes.', 'scouting.', 'sneaking in, opportunity here.'])}"
|
|
242
|
-
EXAMPLE: MESSAGE ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"
|
|
243
|
-
EXAMPLE: FUD ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"
|
|
244
|
-
|
|
245
|
-
ONLY output exactly one action line. Do NOT explain step by step. Do not list multiple moves or combine actions. ONE move per turn.
|
|
250
|
+
ONLY output exactly ONE action line. Do NOT explain step by step. Do not list multiple moves or combine actions. ONE move per turn.
|
|
246
251
|
YOUR MOVE:`;
|
|
247
252
|
};
|
|
248
253
|
exports.buildCompactModelPrompt = buildCompactModelPrompt;
|
|
@@ -540,7 +545,22 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
|
|
|
540
545
|
all: allFactions,
|
|
541
546
|
};
|
|
542
547
|
let intelSnippet = '';
|
|
543
|
-
if (
|
|
548
|
+
if (compact) {
|
|
549
|
+
// Compact: one-line intel — latest comms from a held faction
|
|
550
|
+
try {
|
|
551
|
+
const heldMints = [...holdings.keys()];
|
|
552
|
+
const heldFaction = allFactions.find((f) => heldMints.includes(f.mint));
|
|
553
|
+
if (heldFaction) {
|
|
554
|
+
const intel = await (0, faction_1.fetchFactionIntel)(kit, heldFaction);
|
|
555
|
+
const latest = intel.recentComms.find((c) => c.sender !== agent.publicKey);
|
|
556
|
+
if (latest) {
|
|
557
|
+
intelSnippet = `LATEST: @${latest.sender.slice(0, 8)} in ${intel.symbol}: "${latest.memo.replace(/^<+/, '').replace(/>+\s*$/, '').slice(0, 60)}"`;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
catch { }
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
544
564
|
try {
|
|
545
565
|
const heldMints = [...holdings.keys()];
|
|
546
566
|
const heldFactions = allFactions.filter((f) => heldMints.includes(f.mint));
|
|
@@ -567,6 +587,7 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
|
|
|
567
587
|
}
|
|
568
588
|
}
|
|
569
589
|
catch { }
|
|
590
|
+
}
|
|
570
591
|
// Include results from previous SCOUT actions (skip in compact mode)
|
|
571
592
|
let scoutSnippet = '';
|
|
572
593
|
if (!compact) {
|