pyre-agent-kit 3.4.3 → 3.4.5

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.
Files changed (2) hide show
  1. package/dist/agent.js +56 -33
  2. 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.
@@ -128,35 +136,27 @@ WAR_LOAN $ — borrow against your size in a faction (ascended factions only).
128
136
  REPAY_LOAN $ — repay a loan (ascended factions only).
129
137
  SIEGE $ — liquidate a bad loan (ascended factions only).
130
138
  TITHE $ — harvest fees into the treasury to grow the faction economy (ascended factions only).
131
- LAUNCH name — create a new faction. name should be original, be creative.
139
+ LAUNCH "name" — create a new faction. name should be original, be creative. wrap name in double quotes always.
132
140
  - REPLACE $ with exactly ONE faction from ASCENDED, RISING, NEARBY, UNEXPLORED, or MEMBER OF. Alphanumeric strings like FVw8uGKk are wallet addresses, NOT factions.
133
141
  - REPLACE * with what you have to say about your action, always in double quotes, if available on the action. optional but recommended.
134
142
  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!'])}"
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,26 @@ 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;
201
+ const allies = gameState.founded;
200
202
  return `You are an autonomous agent playing in Pyre, a faction warfare game.
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 community. 0.5% realm tax + early moves contribute more to the treasury. later moves contribute less.
205
- ASCENDED: established. 0.04% war tax on every transaction — harvestable into the treasury.
206
+ RISING FACTIONS: new community. 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.
206
208
  --- GOAL:
207
209
  Maximize long-term profit and faction dominance.
208
210
  --- STATE:
209
211
  YOU: ${agent.publicKey.slice(0, 8)} - ${defaults_1.personalityDesc[agent.personality]}
210
212
  P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
213
+ FOUNDED: ${founded.length > 0 ? founded : 'none'}
211
214
  MEMBER OF: ${memberOf.length > 0 ? memberOf.join(', ') : 'none'}
212
215
  MEMBERSHIP VALUE: ${valued.length > 0 ? valued.map(v => `${v.symbol}: ${v.valueSol.toFixed(4)} SOL`).join(', ') : 'no value'}
213
216
  SENTIMENT: ${sentimentList}
217
+ ALLIES: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 3).map(a => `@${a.slice(0, 8)}`).join(', ') : 'none'}
218
+ FOUNDED: ${gameState.founded.length > 0 ? gameState.founded.slice(0, 3).map((m) => { const f = factionCtx.all.find((ff) => ff.mint === m); return f?.symbol ?? m.slice(0, 8); }).join(', ') : 'none'}
214
219
  FACTIONS: ${validatedFactions.length > 0 ? validatedFactions.map(f => f.symbol).join(', ') : 'none'}
220
+ INTEL: ${intelSnippet}
215
221
  --- ACTIONS:
216
222
  JOIN $ "*" - join a faction.
217
223
  DEFECT $ "*" - leave or decrease position in a faction you are a MEMBER OF.
@@ -221,28 +227,29 @@ MESSAGE $ "*" - talk in faction comms.
221
227
  FUD $ "*" - trash talk a faction you are a MEMBER OF.
222
228
  ASCEND $ - transition a faction from ready to ascended.
223
229
  TITHE $ - harvest fees into the treasury.
224
- LAUNCH ^ - create a faction.
230
+ LAUNCH "^" - create a faction.
225
231
  - 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. This is what you have to say.
227
- - REPLACE ^ with a creative faction name (eg. "Glitch Cult", "Whale Syndicate").
232
+ - 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.
233
+ - REPLACE ^ with a creative faction name (eg. "Glitch Cult", "Whale Syndicate"), always in double quotes.
234
+ 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!'])}"
235
+ EXAMPLE: DEFECT ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"
236
+ EXAMPLE: REINFORCE ${m} "${(0, util_1.pick)(['doubling down.', 'conviction play.', 'added more.'])}"
237
+ EXAMPLE: INFILTRATE ${f2} "${(0, util_1.pick)(['just looking around.', 'checking the vibes.', 'scouting.', 'sneaking in, opportunity here.'])}"
238
+ EXAMPLE: ASCEND ${m}
239
+ EXAMPLE: TITHE ${m}
240
+ EXAMPLE: MESSAGE ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"
241
+ EXAMPLE: FUD ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"
228
242
  --- STRATEGY:
229
243
  - Your personality is your tone.
230
244
  - Promote factions you are in. Attack your rivals.
231
245
  - 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
246
  - If no FACTIONS or you are not a MEMBER OF any, consider LAUNCH.
233
- - If you LAUNCH a faction, JOIN and promote it.
247
+ - If you FOUNDED a faction, JOIN and promote it.
234
248
  - MESSAGE/FUD move sentiment and help coordinate with other agents — use them.
235
- - DEFECT to lock in profits or downsize on underperforming faction.
236
249
  - To REINFORCE, DEFECT or FUD, you MUST be a MEMBER OF the faction.
250
+ - DEFECT to lock in profits or downsize on underperforming faction.
237
251
  ---
238
- 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!'])}"
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.
252
+ 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
253
  YOUR MOVE:`;
247
254
  };
248
255
  exports.buildCompactModelPrompt = buildCompactModelPrompt;
@@ -540,7 +547,22 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
540
547
  all: allFactions,
541
548
  };
542
549
  let intelSnippet = '';
543
- if (!compact)
550
+ if (compact) {
551
+ // Compact: one-line intel — latest comms from a held faction
552
+ try {
553
+ const heldMints = [...holdings.keys()];
554
+ const heldFaction = allFactions.find((f) => heldMints.includes(f.mint));
555
+ if (heldFaction) {
556
+ const intel = await (0, faction_1.fetchFactionIntel)(kit, heldFaction);
557
+ const latest = intel.recentComms.find((c) => c.sender !== agent.publicKey);
558
+ if (latest) {
559
+ intelSnippet = `LATEST: @${latest.sender.slice(0, 8)} in ${intel.symbol}: "${latest.memo.replace(/^<+/, '').replace(/>+\s*$/, '').slice(0, 60)}"`;
560
+ }
561
+ }
562
+ }
563
+ catch { }
564
+ }
565
+ else {
544
566
  try {
545
567
  const heldMints = [...holdings.keys()];
546
568
  const heldFactions = allFactions.filter((f) => heldMints.includes(f.mint));
@@ -567,6 +589,7 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
567
589
  }
568
590
  }
569
591
  catch { }
592
+ }
570
593
  // Include results from previous SCOUT actions (skip in compact mode)
571
594
  let scoutSnippet = '';
572
595
  if (!compact) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-agent-kit",
3
- "version": "3.4.3",
3
+ "version": "3.4.5",
4
4
  "description": "Autonomous agent kit for Pyre — plug in your own LLM and play pyre.world",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",