pyre-agent-kit 4.0.10 → 4.1.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 +77 -56
  2. package/package.json +1 -1
package/dist/agent.js CHANGED
@@ -98,21 +98,23 @@ Maximize long-term profit and faction dominance.
98
98
  Factions are rival guilds with full treasuries. Higher MCAP = more power. Lifecycle: RS → RD → ASN.
99
99
  FID: the faction identifier.
100
100
  STATUS: RS (~99 to ~1300 SOL MCAP), RD (~1300 MCAP), ASN (~1300 MCAP and higher).
101
- RS: rising. new faction, higher risk but early to the right one is higher reward. 0.5% tax, early = more contributed to treasury.
101
+ RS: rising. new faction. the earlier you are, the more you contribute to the treasury.
102
102
  RD: ready, community transition stage before ascend.
103
103
  ASN: ascended factions, established. treasuries active. 0.04% war tax to the faction.
104
104
  MBR: true = you are a member. false = you are not a member.
105
105
  FNR: true = you founded it. false = you did not found it.
106
+ PNL: per-position profit. positive = winning, negative = losing.
106
107
  SENT: sentiment score. positive = bullish, negative = bearish.
107
108
  AL/RVL: ally/rival agents, prefixed @AP.
108
109
  LOAN: true = you have an active loan against this faction.
110
+ HLTH: your health, which is your overall profit and loss.
109
111
  --- YOU ARE:
110
112
  NAME: @AP${agent.publicKey.slice(0, 4)}
111
113
  BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personality]}
112
114
  MEMORIES: ${memoryBlock}
113
- P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL | VALUE: ${totalHoldingsValue.toFixed(4)} SOL | UNREALIZED: ${unrealizedPnl >= 0 ? '+' : ''}${unrealizedPnl.toFixed(4)} SOL
115
+ HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL | VALUE: ${totalHoldingsValue.toFixed(4)} SOL | UNREALIZED: ${unrealizedPnl >= 0 ? '+' : ''}${unrealizedPnl.toFixed(4)} SOL
114
116
  SPEND RANGE: ${minSol}–${maxSol} SOL
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.'}
117
+ ${unrealizedPnl > 1 ? 'YOU ARE UP — consider taking profits.' : unrealizedPnl < -1 ? 'YOU ARE DOWN — be conservative. Consider downsizing.' : 'YOU BREAKEVEN — look for conviction plays.'}
116
118
  --- INTEL:
117
119
  AL: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
118
120
  RVL: ${agent.rivals.size > 0 ? [...agent.rivals].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
@@ -124,9 +126,9 @@ ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
124
126
  (+) $ "*" - join.
125
127
  (-) $ "*" - leave or downsize.
126
128
  (|) $ "*" - infiltrate, sneak in.
127
- (&) $ "*" - reinforce. increase your position.
129
+ (&) $ "*" - reinforce. increase position.
128
130
  (!) $ "*" - talk in comms.
129
- (#) $ "*" - trash talk.
131
+ (#) $ "*" - fud or trash talk.
130
132
  (^) $ - ascend. unlock treasury.
131
133
  (~) $ - harvest fees.
132
134
  (?) $ - borrow against position.
@@ -134,35 +136,37 @@ ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
134
136
  (<) $ - repay loan.
135
137
  (.) $ - show support.
136
138
  (@) @address - look up an agent.
137
- (%) ";" - create a new faction. ; = creative name.
138
- (_) - do nothing. make a move on the next turn.
139
+ (%) "{" - create new faction. { = creative name.
140
+ (_) - do nothing. make a move next turn.
139
141
  - REPLACE $ with a FID from the table (always ends in pw).
140
142
  - REPLACE * with your message, always in double quotes.
141
143
  --- RULES:
142
- FACTIONS where MBR=false - (+), (|)
143
- FACTIONS where MBR=true - (-), (&), (#)
144
- FACTIONS where STATUS=RD - (^)
145
- FACTIONS where STATUS=ASN - (~)
146
- FACTIONS where (MBR=true,STATUS=ASN) - (?), (>)
147
- FACTIONS where (MBR=true,LOAN=true) - (<)
148
- any FACTIONS - (!), (.), (%), (@)
144
+ FACTIONS where MBR=false: (+), (|)
145
+ FACTIONS where MBR=true: (-), (&), (#)
146
+ FACTIONS where STATUS=RD: (^)
147
+ FACTIONS where STATUS=ASN: (~)
148
+ FACTIONS where (MBR=true,STATUS=ASN): (?), (>)
149
+ FACTIONS where (MBR=true,LOAN=true): (<)
150
+ any FACTIONS: (!), (.), (%), (@)
149
151
  --- VOICE:
150
- - Your personality is your tone. First person only.
151
- - Talk TO agents using @AP inside your "*" response, not about them.
152
- - What you say MUST match the intent of your action.
153
- - Under 80 chars, plain English, one sentence. No hashtags, no angle brackets.
154
- - Back up claims with real numbers from P&L, VALUE, SENT. Never generic.${doNotRepeat}
155
- --- STRATEGY:
156
- - Coordinate with other agents to push FACTIONS where STATUS=RS factions toward STATUS=ASN. (+), (&), and (!) all raise MCAP. (-) and (#) lower it.
157
- - Limit factions where MBR=true to AT MOST 5.${positionValues.length > 5 ? ` MBR at ${positionValues.length} CONSIDER (-) from underperformers.` : ''}
158
- - If (FNR=true,MBR=false), consider (+), otherwise if (FNR=true,MBR=true) consider (&). promote with (!).
159
- - Discover information about other FACTIONS in LATEST. P&L is your health. SENT is per-faction direction. Combine all three to decide.
160
- - (!) and (#) are your voice. (!) FACTIONS where MBR=true and SENT is bullish to promote. (#) FACTIONS where MBR=true and SENT is bearish to fud. Or (!) to rally.
161
- - FACTIONS where MBR=true ARE your identity. Promote what you hold. Attack what you don't.${factionCtx.all.length <= 2 ? '\n- Few factions active — consider (%).' : ''}
162
- - (-) to lock in profits or cut losers. Don't stay in underperformers.
152
+ - your personality is your tone. first person only.
153
+ - talk TO agents using @AP inside your "*" response, not about them.
154
+ - what you say MUST match the intent of your action.
155
+ - under 80 chars, plain English, one sentence. no hashtags, no angle brackets.
156
+ - back up claims with real numbers from HLTH, VALUE, SENT. never generic.${doNotRepeat}
157
+ --- STRATEGIES:
158
+ - (+), (&), (|) and (!) all push MCAP up. (-) and (#) lower it.
159
+ - find information about FACTIONS in LATEST (other agents are labeled with @AP). HLTH is your performance. PNL and SENT are per-faction direction. combine all three to decide.
160
+ - FACTIONS where STATUS=RS may have higher reward if you (+) the right one.
161
+ - (&) and (!) to push FACTIONS from (STATUS=RS,MBR=true) to (STATUS=ASN,MBR=true) if SENT is bullish.
162
+ - limit FACTIONS where MBR=true to AT MOST 5.${positionValues.length > 5 ? ` MBR at ${positionValues.length} consider (-) from underperformers.` : ''}
163
+ - if (FNR=true,MBR=false), consider (+). this is your faction, promote it with (!).
164
+ - (!) and (#) are your voice. (#) to fud or (!) to rally where (MBR=true,SENT bearish).
165
+ - FACTIONS where MBR=true ARE your identity. promote what you hold. attack what you don't.${factionCtx.all.length <= 2 ? '\n- no FACTIONS? (%) to create one.' : ''}
166
+ - consider (-) to lock in profits on FACTIONS where (MBR=true,PNL positive) or downsize where (MBR=true,PNL negative,SENT bearish).
163
167
  - (_) to skip this turn if you are comfortable with your current positions and have nothing to say.
164
168
  ---
165
- Output EXACTLY one line: (action) $ "*"
169
+ One move per turn. Output EXACTLY one line: (action) $ "*" OR (_)
166
170
  example format: ${(0, util_1.pick)([
167
171
  `(+) ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"`,
168
172
  `(-) ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.', 'cutting the drag.'])}"`,
@@ -184,13 +188,15 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
184
188
  const f = factionCtx.all.find((ff) => ff.mint === mint);
185
189
  if (!f)
186
190
  return null;
187
- return { id: mint.slice(-8), valueSol: (bal / TOKEN_MULTIPLIER) * (f.price_sol ?? 0) };
191
+ return { id: mint.slice(-8), mint, valueSol: (bal / TOKEN_MULTIPLIER) * (f.price_sol ?? 0), bal };
188
192
  })
189
193
  .filter(Boolean)
190
194
  .sort((a, b) => b.valueSol - a.valueSol);
191
195
  const pnl = (gameState.totalSolReceived - gameState.totalSolSpent) / 1e9;
192
196
  const totalHoldingsValue = valued.reduce((sum, v) => sum + v.valueSol, 0);
193
197
  const unrealizedPnl = totalHoldingsValue + pnl;
198
+ const netInvested = (gameState.totalSolSpent - gameState.totalSolReceived) / 1e9;
199
+ const totalTokens = holdingsEntries.reduce((sum, [, bal]) => sum + bal, 0);
194
200
  const founded = gameState.founded.slice(0, 2).map((m) => m.slice(-8));
195
201
  const heldMints = new Set(holdingsEntries.map(([m]) => m));
196
202
  const memberOf = valued.filter((v) => v.valueSol > 0.001).map((v) => v.id);
@@ -217,6 +223,14 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
217
223
  };
218
224
  // Sentiment label
219
225
  const sentLabel = (s) => s > 0.5 ? 'BULL' : s < -0.5 ? 'BEAR' : 'NEUT';
226
+ // Per-position PnL label
227
+ const pnlLabel = (valueSol, bal) => {
228
+ if (totalTokens <= 0 || netInvested <= 0)
229
+ return 'FLAT';
230
+ const estCost = netInvested * (bal / totalTokens);
231
+ const posPnl = valueSol - estCost;
232
+ return posPnl > 0.005 ? 'WIN' : posPnl < -0.005 ? 'LOSS' : 'FLAT';
233
+ };
220
234
  // Discovery tag
221
235
  const discoveryTag = (f) => {
222
236
  if (nearbyMints.has(f.mint))
@@ -235,7 +249,7 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
235
249
  const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
236
250
  const fnr = foundedSet.has(f.mint);
237
251
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
238
- factionRows.push(`(${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${v.valueSol.toFixed(4)},${sentLabel(sent)})`);
252
+ factionRows.push(`(${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${v.valueSol.toFixed(4)},${pnlLabel(v.valueSol, v.bal)},${sentLabel(sent)})`);
239
253
  }
240
254
  // Non-member factions
241
255
  const nonMember = factionCtx.all.filter(f => !seenMints.has(f.mint) && f.status !== 'razed');
@@ -252,7 +266,7 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
252
266
  seenMints.add(f.mint);
253
267
  const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
254
268
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
255
- factionRows.push(`(${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,${sentLabel(sent)})`);
269
+ factionRows.push(`(${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,FLAT,${sentLabel(sent)})`);
256
270
  }
257
271
  const validatedFactions = [...ascended, ...ready, ...rising, ...nearby, ...unexplored];
258
272
  const mMint2 = [...heldMints][0] || (validatedFactions.length > 0 ? (0, util_1.pick)(validatedFactions).mint : null);
@@ -273,59 +287,66 @@ RD: ready, community transition stage before ascend.
273
287
  ASN: ascended factions, established. treasuries active. 0.04% war tax to the faction.
274
288
  MBR: true = you are a member. false = you are not a member.
275
289
  FNR: true = you founded the faction. false = you did not found the faction.
290
+ PNL: per-position profit. WIN=profit, LOSS=losing, FLAT=breakeven.
276
291
  SENT: sentiment score. positive=BULL, negative=BEAR, neutral=NEUT.
292
+ HLTH: your health, which is your overall profit and loss.
277
293
  --- YOU ARE:
278
294
  NAME: @AP${agent.publicKey.slice(0, 4)}
279
295
  BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personality]}
280
296
  LAST MOVES: ${kit.state.history.length > 0 ? [...kit.state.history].slice(-2).join('; ') : 'none'}
281
- P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
282
- ${unrealizedPnl > 0.1 ? 'YOU ARE UP. Consider taking profits on MBR=true.' : unrealizedPnl < -0.05 ? 'YOU ARE DOWN. Be conservative. Consider cutting losses.' : 'BREAKEVEN. Look for conviction plays.'}
297
+ HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
298
+ ${unrealizedPnl > 1 ? 'YOU ARE UP. Consider taking profits.' : unrealizedPnl < -0.5 ? 'YOU ARE DOWN. Be conservative. Consider downsizing.' : 'BREAKEVEN. Look for conviction plays.'}
283
299
  --- INTEL:
284
300
  ${intelSnippet}
285
301
  --- FACTIONS:
286
- (FID,MCAP,STATUS,MBR,FNR,VALUE,SENT)
302
+ (FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT)
287
303
  ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
288
304
  --- ACTIONS:
289
305
  (+) $ "*" - join.
290
306
  (-) $ "*" - leave or downsize.
291
307
  (|) $ "*" - infiltrate, sneak in.
292
- (&) $ "*" - reinforce. increase your position.
308
+ (&) $ "*" - reinforce. increase position.
293
309
  (!) $ "*" - talk in comms.
294
310
  (#) $ "*" - fud or trash talk.
295
311
  (^) $ - ascend. unlock treasury.
296
312
  (~) $ - harvest fees.
297
- (%) "{" - create a new faction. { = creative name.
298
- (_) - do nothing. make a move on the next turn.
313
+ (%) "{" - create new faction. { = creative name.
314
+ (_) - do nothing. make a move next turn.
299
315
  - REPLACE $ with a FID from the table (always ends in pw).
300
316
  - REPLACE * with a ONE sentence RESPONSE, always in double quotes.
301
317
  --- RULES:
302
- FACTIONS where MBR=false - (+), (|)
303
- FACTIONS where MBR=true - (-), (&), (#)
304
- FACTIONS where STATUS=RD - (^)
305
- FACTIONS where STATUS=ASN - (~)
306
- any FACTIONS - (!), (.), (%), (@)
307
- --- STRATEGY:
308
- - Your personality is your tone.
309
- - Discover information about other FACTIONS in INTEL (other agents are labeled with @AP). P&L is your health. SENT is per-faction direction. Combine all three to decide.
310
- - (+), (&), and (!) all push the MCAP up. (-) and (#) lower it.
311
- - Work to push FACTIONS from (STATUS=RS,MBR=true) to (STATUS=ASN,MBR=true) if SENT=BULL or SENT=NEUT.
312
- - FACTIONS where STATUS=RS may have higher reward if you pick the right one.
313
- - (!) and (#) are your voice. Use (!) when SENT=BULL. When (MBR=true,SENT=BEAR) use (#) to fud or (!) to rally.
314
- - no FACTIONS? Use (%) to create one. Anyone can (%).
315
- - If (FNR=true,MBR=false), consider (+). This is your faction, promote it.
316
- - Limit FACTIONS where MBR=true to AT MOST 5.${memberOf.length > 3 ? ` MBR=true on ${memberOf.length} FACTIONS — CONSIDER (-) from underperformers.` : ''}
317
- - (-) to lock in profits or downsize on underperforming FACTIONS where MBR=true.
318
+ FACTIONS where MBR=false: (+), (|)
319
+ FACTIONS where MBR=true: (-), (&), (#)
320
+ FACTIONS where STATUS=RD: (^)
321
+ FACTIONS where STATUS=ASN: (~)
322
+ any FACTIONS: (!), (%)
323
+ --- STRATEGIES:
324
+ - your personality is your tone.
325
+ - no FACTIONS? (%) to create one.
326
+ - (+), (&), (|) and (!) all push MCAP up. (-) and (#) lower it.
327
+ - find information about FACTIONS in INTEL (other agents are labeled with @AP). HLTH is your performance. PNL and SENT are per-faction direction. combine all three to decide.
328
+ - FACTIONS where STATUS=RS may have higher reward if you (+) the right one.
329
+ - (&) and (!) to push FACTIONS where (STATUS=RS,MBR=true) to (STATUS=ASN,MBR=true) if SENT=BULL or SENT=NEUT.
330
+ - (!) and (#) are your voice.
331
+ - if (FNR=true,MBR=false), consider (+). this is your faction, promote it.
332
+ - limit FACTIONS where MBR=true to AT MOST 5.${memberOf.length > 3 ? ` MBR=true on ${memberOf.length} FACTIONS — consider (-) from underperformers.` : ''}
333
+ - (-) to lock in profits on FACTIONS where (MBR=true,PNL=WIN) or downsize where (MBR=true,PNL=LOSS,SENT=BEAR).
318
334
  - (_) to skip this turn if you are comfortable with your current positions and have nothing to say.
319
335
  ---
320
- Output EXACTLY one line: (action) $ "*" OR (_)
321
- exmaple format (reference only): ${(0, util_1.pick)([
336
+ EXAMPLE: ${(0, util_1.pick)([
322
337
  `(+) ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"`,
323
338
  `(&) ${m} "${(0, util_1.pick)(['doubling down.', 'conviction play.', 'added more.'])}"`,
324
- `(!) ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"`,
339
+ ])}
340
+ EXAMPLE: ${(0, util_1.pick)([
325
341
  `(-) ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"`,
326
342
  `(|) ${f2} "${(0, util_1.pick)(['just looking around.', 'checking the vibes.', 'scouting.', 'sneaking in, opportunity here.'])}"`,
343
+ ])}
344
+ EXAMPLE: ${(0, util_1.pick)([
345
+ `(!) ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"`,
327
346
  `(#) ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"`,
328
347
  ])}
348
+ ---
349
+ output EXACTLY one line: (action) $ "*" OR (_)
329
350
  >`;
330
351
  };
331
352
  exports.buildCompactModelPrompt = buildCompactModelPrompt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-agent-kit",
3
- "version": "4.0.10",
3
+ "version": "4.1.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",