pyre-agent-kit 4.2.22 → 4.3.1

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 +74 -67
  2. package/package.json +1 -1
package/dist/agent.js CHANGED
@@ -64,7 +64,7 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
64
64
  const posPnl = pv.valueSol - estCost;
65
65
  pnlStr = `${posPnl >= 0 ? '+' : ''}${posPnl.toFixed(4)}`;
66
66
  }
67
- factionRows.push(`(${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${pv.valueSol.toFixed(4)},${pnlStr},${sent > 0 ? '+' : ''}${sent},${loan})`);
67
+ factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${pv.valueSol.toFixed(4)},${pnlStr},${sent > 0 ? '+' : ''}${sent},${loan}`);
68
68
  }
69
69
  // Non-member factions
70
70
  const nonMember = factionCtx.all.filter(f => !seenMints.has(f.mint) && f.status !== 'razed');
@@ -81,7 +81,7 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
81
81
  seenMints.add(f.mint);
82
82
  const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
83
83
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
84
- factionRows.push(`(${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,0,${sent > 0 ? '+' : ''}${Math.round(sent * 10) / 10},false)`);
84
+ factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,0,${sent > 0 ? '+' : ''}${Math.round(sent * 10) / 10},false`);
85
85
  }
86
86
  const validatedFactions = [...ascended, ...ready, ...rising, ...nearby, ...unexplored];
87
87
  const doNotRepeat = recentMessages.length > 0
@@ -103,10 +103,9 @@ Maximize long-term profit and faction dominance.
103
103
  --- LEGEND:
104
104
  Factions are rival guilds with full treasuries. Higher MCAP = more power. Lifecycle: RS → RD → ASN.
105
105
  HLTH: your overall profit and loss. your health.
106
- AL/RVL: ally/rival agents, prefixed @AP.
107
106
  FID: the faction identifier.
108
107
  STATUS: RS (99 to 1300 SOL MCAP), RD (1300 MCAP), ASN (1300 MCAP and higher).
109
- RS: rising. new faction. the earlier you are, the more you contribute to the treasury. potentially higher profit.
108
+ RS: rising. new faction. the lower the MCAP, the more you contribute to the treasury.
110
109
  RD: ready, community transition stage before ascend.
111
110
  ASN: ascended factions, established, more members. treasuries active. 0.04% war tax to the faction.
112
111
  MBR: true = you are a member. false = you are not a member.
@@ -119,62 +118,65 @@ NAME: @AP${agent.publicKey.slice(0, 4)}
119
118
  BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personality]}
120
119
  MEMORIES: ${memoryBlock}
121
120
  HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL | VALUE: ${totalHoldingsValue.toFixed(4)} SOL | UNREALIZED: ${unrealizedPnl >= 0 ? '+' : ''}${unrealizedPnl.toFixed(4)} SOL
122
- SPEND RANGE: ${minSol}–${maxSol} SOL
123
- ${unrealizedPnl > 1 ? 'YOU ARE UP — consider taking profits.' : unrealizedPnl < -1 ? 'YOU ARE DOWN — be conservative. Consider downsizing.' : 'YOU BREAKEVEN — look for conviction plays.'}
121
+ ${unrealizedPnl > 1 ? 'YOU ARE UP — consider taking profits.' : unrealizedPnl < -1 ? 'YOU ARE DOWN — be conservative. consider downsizing.' : 'YOU BREAKEVEN — look for conviction plays.'}
124
122
  --- INTEL:
125
- AL: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
126
- RVL: ${agent.rivals.size > 0 ? [...agent.rivals].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
123
+ ALLIES: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
124
+ RIVALS: ${agent.rivals.size > 0 ? [...agent.rivals].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
127
125
  LATEST: ${intelSnippet}
128
126
  --- FACTIONS:
129
- (FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT,LOAN)
127
+ FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT,LOAN
130
128
  ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
131
129
  --- ACTIONS:
132
- (+) $pw "*" - join.
133
- (-) $pw "*" - leave or reduce position.
134
- (|) $pw "*" - infiltrate, sneak in.
135
- (&) $pw "*" - reinforce. increase position. bullish.
136
- (!) $pw "*" - talk in comms.
137
- (#) $pw "*" - fud or trash talk.
138
- (^) $pw - ascend. unlock treasury.
139
- (~) $pw - harvest fees.
140
- (?) $pw - borrow against position.
141
- (>) $pw - liquidate bad loan.
142
- (<) $pw - repay loan.
143
- (.) $pw - show support.
130
+ FORMAT: (action) $ "*"
131
+ REPLACE $ with EXACTLY one FID from FACTIONS (always ends in pw).
132
+ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
133
+ (+) $ "*" - join.
134
+ (-) $ "*" - leave or reduce position.
135
+ (|) $ "*" - infiltrate, sneak in.
136
+ (&) $ "*" - reinforce. increase position. bullish.
137
+ (!) $ "*" - talk in comms.
138
+ (#) $ "*" - fud or trash talk.
139
+ (^) $ - ascend. unlock treasury.
140
+ (~) $ - harvest fees.
141
+ (?) $ - borrow against position.
142
+ (>) $ - liquidate bad loan.
143
+ (<) $ - repay loan.
144
+ (.) $ - show support.
144
145
  (%) "{" - create new faction. { = creative name.
145
- (_) - skip turn.
146
- - REPLACE $pw with a FID from FACTIONS (always ends in pw).
147
- - REPLACE * with your RESPONSE, always in double quotes.
146
+ (_) - do nothing. wait until next turn.
148
147
  --- RULES:
149
- FACTIONS where MBR=false: (+), (|)
150
- FACTIONS where MBR=true: (-), (&), (#)
151
- FACTIONS where STATUS=RD: (^)
152
- FACTIONS where STATUS=ASN: (~)
153
- FACTIONS where (MBR=true,STATUS=ASN): (?), (>)
154
- FACTIONS where (LOAN=true): (<)
155
- any FACTIONS: (!), (.)
148
+ (%) or (_) no FACTIONS required.
149
+ (+) or (|) FACTIONS where MBR=false.
150
+ (-), (&) or (#) FACTIONS where MBR=true.
151
+ (^) FACTIONS where STATUS=RD.
152
+ (~) FACTIONS where STATUS=ASN.
153
+ (?) or (>) FACTIONS where STATUS=ASN and MBR=true.
154
+ (<) FACTIONS where LOAN=true.
155
+ (!) or (.) any FACTIONS.
156
156
  --- VOICE:
157
157
  - your personality is your tone. first person only. do not reference your NAME in third person.
158
- - talk TO and ABOUT agents from AL, RVL, and LATEST, always referencing the agent with @AP, inside your RESPONSE.
158
+ - talk TO and ABOUT agents from ALLIES, RIVALS, and LATEST, always referencing the agent with @AP, inside your RESPONSE.
159
+ - do NOT parrot or copy what other agents are saying. be unique.
159
160
  - what you say MUST match the intent of your action.
160
161
  - under 80 chars, plain English, one sentence. no hashtags, no angle brackets.
161
162
  - back up claims with real numbers from HLTH, VALUE, SENT. never generic.
162
163
  - dont talk just numbers. build your faction community and culture. form collective identities.${doNotRepeat}
163
164
  --- STRATEGIES:
164
- - find information about FACTIONS in LATEST (other agents always labeled with @AP). HLTH is your performance. PNL and SENT are per-faction direction. combine all three to decide.
165
+ - find information about FACTIONS and other agents in LATEST. HLTH is your performance. PNL and SENT are per-faction direction. use all three to decide.
165
166
  - limit FACTIONS where MBR=true to AT MOST 5.${positionValues.length > 3 ? ` MBR at ${positionValues.length} — consider (-) from underperformers.` : ''}
166
- - FACTIONS where (MBR=true,SENT:bullish) ARE your identity. promote what you hold. attack what you don't.${factionCtx.all.length <= 2 ? '\n- no FACTIONS? (%) to create one.' : ''}
167
- - FACTIONS with higher MCAP usually mean more members.
168
- - FACTIONS where (STATUS=RS,MBR=false) and lower MCAP could turn more profit if you (+) the right one.
169
- - (!) and (#) are your voice - use them to coordinate and talk with other agents.
170
- - (+), (&), (|), (!) increase MCAP. (-), (#) decrease it.
171
- - if (FNR=true,MBR=false), consider (+). this is your faction, promote it with (!).
167
+ - if MBR=false and FNR=true, consider (+). this is your faction, promote it with (!).
168
+ - FACTIONS where MBR=true and SENT is bullish ARE your identity. promote what you hold. attack what you don't.${factionCtx.all.length <= 2 ? '\n- no FACTIONS? (%) to create one.' : ''}
169
+ - FACTIONS where STATUS=RS and MBR=false and lower MCAP could turn more profit if you (+) the right one.
170
+ - (!) and (#) are your voice. (!) increases SENT. (#) decreases SENT. use them to coordinate and talk with other agents.
171
+ - (+), (&), (|) increase MCAP. (-) decrease it.
172
172
  - (|) to join a faction with intentions of (-) later. take this action when you are profit seeking or want to harm a rival faction.
173
- - (&) and (!) to push FACTIONS where (STATUS=RS,MBR=true) to (STATUS=ASN,MBR=true).
174
- - consider (-) to lock in profits on FACTIONS where (MBR=true,PNL:positive) or cut losses where (MBR=true,PNL:negative,SENT:bearish).
175
- - (_) if you are comfortable with your current positions and have nothing to say.
173
+ - (&) and (!) to push FACTIONS where MBR=true and STATUS=RS to STATUS=ASN.
174
+ - consider (-) to lock in profits on FACTIONS where MBR=true and PNL is positive.
175
+ - consider (-) FACTIONS where MBR=true and PNL is negative unless FNR=true or SENT is bullish.
176
+ - when HLTH is negative, prefer (-) weakest FACTIONS where MBR=true or (_). consider (+) or (&) ONLY if you see potential opportunity.
177
+ - (_) if you are comfortable with your current positions and have nothing to say. the best move is sometimes no move.
176
178
  ---
177
- ONE move per turn. output EXACTLY one line: (action) $pw "*" OR (_)
179
+ one move per turn. output EXACTLY one line: (action) $ "*" OR (_)
178
180
  example format: ${(0, util_1.pick)([
179
181
  `(+) ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"`,
180
182
  `(-) ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.', 'cutting the drag.'])}"`,
@@ -252,7 +254,7 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
252
254
  const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
253
255
  const fnr = foundedSet.has(f.mint);
254
256
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
255
- factionRows.push(`(${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${v.valueSol.toFixed(4)},${pnlLabel(v.valueSol, v.bal)},${sentLabel(sent)})`);
257
+ factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${v.valueSol.toFixed(4)},${pnlLabel(v.valueSol, v.bal)},${sentLabel(sent)}`);
256
258
  }
257
259
  // Non-member factions
258
260
  const nonMember = factionCtx.all.filter(f => !seenMints.has(f.mint) && f.status !== 'razed');
@@ -269,7 +271,7 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
269
271
  seenMints.add(f.mint);
270
272
  const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
271
273
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
272
- factionRows.push(`(${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,FLAT,${sentLabel(sent)})`);
274
+ factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,FLAT,${sentLabel(sent)}`);
273
275
  }
274
276
  const validatedFactions = [...ascended, ...ready, ...rising, ...nearby, ...unexplored];
275
277
  const mMint2 = [...heldMints][0] || (validatedFactions.length > 0 ? (0, util_1.pick)(validatedFactions).mint : null);
@@ -286,7 +288,7 @@ Factions are rival guilds with full treasuries. Higher MCAP = more power. Lifecy
286
288
  HLTH: your overall profit and loss. your health.
287
289
  FID: the faction identifier.
288
290
  STATUS: RS (99 to 1300 SOL MCAP), RD (1300 MCAP), ASN (1300 MCAP and higher).
289
- RS: rising. new faction. the earlier you are, the more you contribute to the treasury, but potentially higher profit.
291
+ RS: rising. new faction. the lower the MCAP, the more you contribute to the treasury.
290
292
  RD: ready, community transition stage before ascend.
291
293
  ASN: ascended factions, established, more members. treasuries active. 0.04% war tax to the faction.
292
294
  MBR: true = you are a member. false = you are not a member.
@@ -296,16 +298,17 @@ SENT: sentiment score. BULL=positive, BEAR=negative, NEUT=neutral.
296
298
  --- YOU ARE:
297
299
  NAME: @AP${agent.publicKey.slice(0, 4)}
298
300
  BIO: ${defaults_1.personalityDesc[agent.personality]}
299
- LAST MOVES: ${kit.state.history.length > 0 ? [...kit.state.history].slice(-2).join('; ') : 'none'}
300
301
  HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
301
302
  ${unrealizedPnl > 1 ? 'YOU ARE UP. consider taking profits.' : unrealizedPnl < -0.5 ? 'YOU ARE DOWN. be conservative. consider downsizing.' : 'BREAKEVEN. look for conviction plays.'}
302
303
  --- INTEL:
303
304
  ${intelSnippet}
304
305
  --- FACTIONS:
305
- (FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT)
306
+ FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT
306
307
  ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
307
308
  --- ACTIONS:
308
309
  FORMAT: (action) $ "*"
310
+ REPLACE $ with EXACTLY one FID from FACTIONS (always ends in pw).
311
+ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
309
312
  (+) $ "*" - join.
310
313
  (-) $ "*" - leave or reduce.
311
314
  (&) $ "*" - reinforce. increase position.
@@ -315,27 +318,27 @@ FORMAT: (action) $ "*"
315
318
  (~) $ - harvest fees.
316
319
  (%) "{" - create new faction. { = creative name.
317
320
  (_) - do nothing. wait until next turn.
318
- - REPLACE $ with EXACTLY one FID from FACTIONS (always ends in pw).
319
- - REPLACE * with a ONE sentence RESPONSE, always in double quotes.
320
321
  --- RULES:
321
- (^) FACTIONS where STATUS=RD
322
- (~) FACTIONS where STATUS=ASN
323
- (+) FACTIONS where MBR=false
324
- (-), (&), (#) FACTIONS where MBR=true
325
- (!) any FACTIONS
322
+ (%) or (_) no FACTIONS required.
323
+ (^) FACTIONS where STATUS=RD.
324
+ (~) FACTIONS where STATUS=ASN.
325
+ (+) FACTIONS where MBR=false.
326
+ (-), (&) or (#) FACTIONS where MBR=true.
327
+ (!) any FACTIONS.
326
328
  --- STRATEGIES:
327
329
  - your personality is your tone.
328
330
  - no FACTIONS? (%) to create one.
329
- - FACTIONS where FNR=true and MBR=false, consider (+). promote it with (!).
330
331
  - limit FACTIONS where MBR=true to AT MOST 5.${memberOf.length > 3 ? ` MBR=true on ${memberOf.length} FACTIONS — consider (-) from underperformers.` : ''}
331
- - find information about FACTIONS in INTEL (other agents labeled with @AP). HLTH is performance. PNL and SENT are per-faction direction. combine them to decide.
332
+ - find information about FACTIONS and other agents in INTEL. HLTH is performance. PNL and SENT are per-faction direction. use all three to decide.
333
+ - FACTIONS where FNR=true and MBR=false, consider (+). promote it with (!).
332
334
  - FACTIONS where STATUS=RS may have higher reward if you (+) the right one.
333
- - (+), (&) increase MCAP. (-) decreases MCAP.
334
- - (!) increases SENT. (#) decreases SENT.
335
+ - (!) and (#) are your voice.
336
+ - (+) and (&) increase MCAP. (-) decreases MCAP.
335
337
  - (&) and (!) to push FACTIONS where MBR=true and STATUS=RS to STATUS=ASN.
336
- - (-) on FACTIONS where MBR=true and PNL=WIN to lock in profits.
337
- - (-) on FACTIONS where MBR=true, PNL=LOSS, and SENT=BEAR unless FNR=true to cut losses.
338
- - (_) if you are comfortable with your current positions.
338
+ - consider (-) FACTIONS where MBR=true and PNL=WIN to lock in profits.
339
+ - consider (-) FACTIONS where MBR=true and PNL=LOSS unless FNR=true or SENT=BULL.
340
+ - when HLTH is negative, prefer (-) weakest FACTIONS where MBR=true or (_). consider (+) or (&) ONLY if you see potential opportunity.
341
+ - (_) if you are comfortable with your current positions. the best move is sometimes no move.
339
342
  ---
340
343
  one move per turn. output EXACTLY one line: (action) $ "*" OR (_)
341
344
  example format: ${(0, util_1.pick)([
@@ -659,17 +662,21 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
659
662
  };
660
663
  let intelSnippet = '';
661
664
  if (compact) {
662
- // Compact: one-line intel latest comms from a held faction
665
+ // Compact: up to 2 intel lines from held factions
663
666
  try {
664
667
  const heldMints = [...holdings.keys()];
665
- const heldFaction = allFactions.find((f) => heldMints.includes(f.mint));
666
- if (heldFaction) {
667
- const intel = await (0, faction_1.fetchFactionIntel)(kit, heldFaction);
668
+ const heldFactions = allFactions.filter((f) => heldMints.includes(f.mint)).slice(0, 2);
669
+ const lines = [];
670
+ for (const hf of heldFactions) {
671
+ if (lines.length >= 2)
672
+ break;
673
+ const intel = await (0, faction_1.fetchFactionIntel)(kit, hf);
668
674
  const latest = intel.recentComms.find((c) => c.sender !== agent.publicKey);
669
675
  if (latest) {
670
- intelSnippet = `@AP${latest.sender.slice(0, 4)} in ${intel.symbol}: "${latest.memo.replace(/^<+/, '').replace(/>+\s*$/, '').slice(0, 60)}"`;
676
+ lines.push(`@AP${latest.sender.slice(0, 4)} in ${hf.mint.slice(-8)}: "${latest.memo.replace(/^<+/, '').replace(/>+\s*$/, '').slice(0, 60)}"`);
671
677
  }
672
678
  }
679
+ intelSnippet = lines.join('\n');
673
680
  }
674
681
  catch { }
675
682
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-agent-kit",
3
- "version": "4.2.22",
3
+ "version": "4.3.1",
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",