pyre-agent-kit 4.5.3 → 4.5.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.
package/dist/agent.js CHANGED
@@ -299,10 +299,16 @@ const buildCompactModelPrompt = async (kit, agent, factionCtx, solRange, holding
299
299
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
300
300
  factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,0,${sentLabel(sent)}`);
301
301
  }
302
- // Fetch intel from table member factions only no off-screen FIDs
302
+ // Slice to 8 rows for compact prompt (5 held max + 3 new min)
303
+ const compactRows = factionRows.slice(0, 8);
304
+ const compactMints = new Set(compactRows.map(r => {
305
+ const fid = r.split(',')[0];
306
+ return [...seenMints].find(mint => mint.endsWith(fid)) ?? fid;
307
+ }));
308
+ // Fetch intel from compact table factions only — no off-screen FIDs
303
309
  let intelSnippet = '';
304
310
  try {
305
- const tableMemberMints = [...seenMints].filter(mint => heldMints.has(mint));
311
+ const tableMemberMints = [...compactMints].filter(mint => heldMints.has(mint));
306
312
  const lines = [];
307
313
  for (const mint of tableMemberMints.slice(0, 2)) {
308
314
  const f = factionCtx.all.find(ff => ff.mint === mint);
@@ -318,8 +324,8 @@ const buildCompactModelPrompt = async (kit, agent, factionCtx, solRange, holding
318
324
  }
319
325
  catch { }
320
326
  // Pick example FIDs only from factions actually shown in the table
321
- const tableFids = factionRows.map(r => r.split(',')[0]);
322
- const m = tableFids.find(fid => heldMints.has([...seenMints].find(mint => mint.endsWith(fid)) ?? '')) ?? tableFids[0] ?? 'xxxxxxpw';
327
+ const tableFids = compactRows.map(r => r.split(',')[0]);
328
+ const m = tableFids.find(fid => heldMints.has([...compactMints].find(mint => mint.endsWith(fid)) ?? '')) ?? tableFids[0] ?? 'xxxxxxpw';
323
329
  const nonMemberFids = tableFids.filter(fid => fid !== m);
324
330
  const f1 = nonMemberFids.length > 0 ? (0, util_1.pick)(nonMemberFids) : m;
325
331
  const f2 = nonMemberFids.length > 1 ? (0, util_1.pick)(nonMemberFids.filter(fid => fid !== f1)) : f1;
@@ -327,7 +333,7 @@ const buildCompactModelPrompt = async (kit, agent, factionCtx, solRange, holding
327
333
  --- GOAL:
328
334
  Maximize long-term profit and faction dominance.
329
335
  --- LEGEND:
330
- Factions are rival guilds with full treasuries. Higher MCAP = more power. Lifecycle: RS → RD → ASN.
336
+ Factions are rival guilds with treasuries. Higher MCAP = more power. Lifecycle: RS → RD → ASN.
331
337
  HLTH: your overall profit and loss. your health.
332
338
  FID: the faction identifier.
333
339
  STATUS: RS (99 to 1300 SOL MCAP), RD (1300 MCAP), ASN (1300 MCAP and higher).
@@ -340,35 +346,33 @@ PNL: per-position profit. positive = winning, negative = losing.
340
346
  SENT: sentiment score. positive = bullish, negative = bearish.
341
347
  --- YOU ARE:
342
348
  NAME: @AP${agent.publicKey.slice(0, 4)}
343
- BIO: ${defaults_1.personalityDesc[agent.personality]}
349
+ BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personality]}
344
350
  HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
345
351
  ${unrealizedPnl > 1 ? 'YOU ARE UP. consider taking profits.' : unrealizedPnl < -0.5 ? 'YOU ARE DOWN. be conservative. consider downsizing.' : 'BREAKEVEN. look for conviction plays.'}
346
352
  --- INTEL:
347
353
  ${intelSnippet}
348
354
  --- FACTIONS:
349
355
  FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT
350
- ${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
356
+ ${compactRows.length > 0 ? compactRows.join('\n') : 'none'}
351
357
  --- ACTIONS:
352
358
  FORMAT: (action) $ "*"
353
359
  REPLACE $ with EXACTLY one FID from FACTIONS ONLY (always ends in pw).
354
360
  REPLACE * with a ONE sentence RESPONSE, always in double quotes.
355
- (+) $ "*" - join.
361
+ (+) $ "*" - join or increase.
356
362
  (-) $ "*" - leave or reduce.
357
- (&) $ "*" - reinforce. increase position.
358
363
  (!) $ "*" - talk in comms. your voice.
359
364
  (#) $ "*" - trash talk.
360
365
  (^) $ - ascend. unlock treasury.
361
366
  (~) $ - harvest fees.
362
- (%) "..." - create new faction. "..." = creative name, in quotes.
367
+ (%) "&" - create new faction. & = creative name, in quotes.
363
368
  (_) - skip turn.
364
369
  --- RULES:
365
- (+) and (&) increase MCAP. (-) decreases MCAP.
370
+ (+) increases MCAP. (-) decreases MCAP.
366
371
  (!) increases SENT. (#) decreases SENT.
367
- (!) any FACTIONS.
368
372
  (^) FACTIONS where STATUS=RD.
369
373
  (~) FACTIONS where STATUS=ASN.
370
- (+) FACTIONS where MBR=false.
371
- (-), (&) or (#) FACTIONS where MBR=true.
374
+ (-) or (#) FACTIONS where MBR=true.
375
+ (+) or (!) any FACTIONS.
372
376
  --- STRATEGIES:
373
377
  - your personality is your tone.
374
378
  - no FACTIONS? (%) to create one.
@@ -377,19 +381,20 @@ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
377
381
  - FACTIONS where FNR=true and MBR=false, consider (+). (!) to promote it.
378
382
  - FACTIONS where STATUS=RS may have higher reward if you (+) the right one.
379
383
  - in FACTIONS where MBR=true, if MCAP increases, your PNL will increase.
380
- - (&) and (!) strengthen FACTIONS where MBR=true and STATUS=RS and push towards STATUS=ASN.
384
+ - (+) and (!) strengthen FACTIONS where MBR=true and STATUS=RS and push towards STATUS=ASN.
381
385
  - consider (-) FACTIONS where MBR=true and PNL is positive to lock in profits.
382
386
  - consider (-) FACTIONS where MBR=true and PNL is negative unless FNR=true or SENT is positive.
383
- - if HLTH is negative, consider (_) or (-) weakest FACTIONS where MBR=true. (+) or (&) ONLY if you see opportunity.
387
+ - when HLTH is negative, consider (_) or (-) weakest FACTIONS where MBR=true. (+) ONLY if you see opportunity.
384
388
  - (_) if you would prefer to hold and wait to take action.
385
389
  ---
386
390
  one move per turn. output EXACTLY one line.
387
391
  example format: ${(0, util_1.pick)([
388
- `(+) ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"`,
389
- `(&) ${m} "${(0, util_1.pick)(['doubling down.', 'conviction play.', 'added more.'])}"`,
392
+ `(+) ${f1} "${(0, util_1.pick)(['conviction play.', 'count me in.', 'early is everything.', 'strongest faction here.'])}"`,
390
393
  `(-) ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"`,
391
- `(!) ${m} "${(0, util_1.pick)(['love the energy. any strategies?', 'who else is here?', 'just getting started.', 'not leaving.'])}"`,
392
- `(#) ${m} "${(0, util_1.pick)(['founders went quiet.', 'dead faction.', 'overvalued.', 'this faction is underperforming.'])}"`,
394
+ `(!) ${m} "${(0, util_1.pick)(['any strategies?', 'not leaving.', 'just getting started.'])}"`,
395
+ `(#) ${m} "${(0, util_1.pick)(['dead faction.', 'overvalued.', 'full of larps.'])}"`,
396
+ `(!) ${m} "${(0, util_1.pick)(['who else is here?', 'love the energy.', 'lets go!'])}"`,
397
+ `(#) ${m} "${(0, util_1.pick)(['faction went quiet.', 'underperforming.'])}"`,
393
398
  ])}
394
399
  >`;
395
400
  };
@@ -473,10 +478,16 @@ const buildMinimumPrompt = async (kit, agent, factionCtx, solRange, holdings) =>
473
478
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
474
479
  factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,0,${sentLabel(sent)}`);
475
480
  }
476
- // Fetch intel from table member factions only no off-screen FIDs
481
+ // Slice to 4 rows for min prompt (3 held max + 1 new)
482
+ const minRows = factionRows.slice(0, 4);
483
+ const minMints = new Set(minRows.map(r => {
484
+ const fid = r.split(',')[0];
485
+ return [...seenMints].find(mint => mint.endsWith(fid)) ?? fid;
486
+ }));
487
+ // Fetch intel from min table factions only — no off-screen FIDs
477
488
  let intelSnippet = '';
478
489
  try {
479
- const tableMemberMints = [...seenMints].filter(mint => heldMints.has(mint));
490
+ const tableMemberMints = [...minMints].filter(mint => heldMints.has(mint));
480
491
  const lines = [];
481
492
  for (const mint of tableMemberMints.slice(0, 1)) {
482
493
  const f = factionCtx.all.find(ff => ff.mint === mint);
@@ -492,8 +503,8 @@ const buildMinimumPrompt = async (kit, agent, factionCtx, solRange, holdings) =>
492
503
  }
493
504
  catch { }
494
505
  // Pick example FIDs only from factions actually shown in the table
495
- const tableFids = factionRows.slice(0, 4).map(r => r.split(',')[0]);
496
- const m = tableFids.find(fid => heldMints.has([...seenMints].find(mint => mint.endsWith(fid)) ?? '')) ?? tableFids[0] ?? 'xxxxxxpw';
506
+ const tableFids = minRows.map(r => r.split(',')[0]);
507
+ const m = tableFids.find(fid => heldMints.has([...minMints].find(mint => mint.endsWith(fid)) ?? '')) ?? tableFids[0] ?? 'xxxxxxpw';
497
508
  const nonMemberFids = tableFids.filter(fid => fid !== m);
498
509
  const f1 = nonMemberFids.length > 0 ? (0, util_1.pick)(nonMemberFids) : m;
499
510
  return `Welcome to Pyre, a faction warfare game. Think in English only. Think linearly: situation → decision → reason. Do not repeat yourself. Do NOT overthink, chess/strategy mood.
@@ -513,35 +524,33 @@ PNL: per-position profit. positive = winning, negative = losing.
513
524
  SENT: sentiment score. positive = bullish, negative = bearish.
514
525
  --- YOU ARE:
515
526
  NAME: @AP${agent.publicKey.slice(0, 4)}
516
- BIO: ${defaults_1.personalityDesc[agent.personality]}
517
- HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(5)} SOL
527
+ BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personality]}
528
+ HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
518
529
  ${unrealizedPnl > 1 ? 'YOU ARE UP. consider taking profits.' : unrealizedPnl < -0.5 ? 'YOU ARE DOWN. be conservative. consider downsizing.' : 'BREAKEVEN. look for conviction plays.'}
519
530
  --- INTEL:
520
531
  ${intelSnippet}
521
532
  --- FACTIONS:
522
533
  FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT
523
- ${factionRows.length > 0 ? factionRows.slice(0, 4).join('\n') : 'none'}
534
+ ${minRows.length > 0 ? minRows.join('\n') : 'none'}
524
535
  --- ACTIONS:
525
- FORMAT: (action) $ OR (action) $ "*"
536
+ FORMAT: (action) $ "*"
526
537
  REPLACE $ with EXACTLY one FID from FACTIONS ONLY (always ends in pw).
527
- REPLACE * with a ONE sentence cno , always in double quotes.
528
- (+) $ - join.
529
- (-) $ - leave or reduce.
530
- (&) $ - increase position.
538
+ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
539
+ (+) $ "*" - join or increase.
540
+ (-) $ "*" - leave or reduce.
531
541
  (!) $ "*" - talk in comms. your voice.
532
542
  (#) $ "*" - trash talk.
533
543
  (^) $ - ascend. unlock treasury.
534
544
  (~) $ - harvest fees.
535
- (%) "..." - create new faction. "..." = creative name, in quotes.
545
+ (%) "&" - create new faction. & = creative name, in quotes.
536
546
  (_) - skip turn.
537
547
  --- RULES:
538
- (+) and (&) increase MCAP. (-) decreases MCAP.
539
- (!) increases SENT. (#) decreases SENT.the
540
- (!) any FACTIONS.
548
+ (+) increases MCAP. (-) decreases MCAP.
549
+ (!) increases SENT. (#) decreases SENT.
541
550
  (^) FACTIONS where STATUS=RD.
542
551
  (~) FACTIONS where STATUS=ASN.
543
- (+) FACTIONS where MBR=false.
544
- (-), (&) or (#) FACTIONS where MBR=true.
552
+ (-) or (#) FACTIONS where MBR=true.
553
+ (+) or (!) any FACTIONS.
545
554
  --- STRATEGIES:
546
555
  - your personality is your tone.
547
556
  - no FACTIONS? (%) to create one.
@@ -550,20 +559,19 @@ REPLACE * with a ONE sentence cno , always in double quotes.
550
559
  - FACTIONS where FNR=true and MBR=false, consider (+). (!) to promote it.
551
560
  - FACTIONS where STATUS=RS may have higher reward if you (+) the right one.
552
561
  - in FACTIONS where MBR=true, if MCAP increases, your PNL will increase.
553
- - (&) and (!) strengthen FACTIONS where MBR=true and STATUS=RS and push towards STATUS=ASN.
562
+ - (+) and (!) strengthen FACTIONS where MBR=true and STATUS=RS and push towards STATUS=ASN.
554
563
  - consider (-) FACTIONS where MBR=true and PNL is positive to lock in profits.
555
564
  - consider (-) FACTIONS where MBR=true and PNL is negative unless FNR=true or SENT is positive.
556
- - if HLTH is negative, consider (_) or (-) weakest FACTIONS where MBR=true. (+) or (&) ONLY if you see opportunity.
565
+ - when HLTH is negative, consider (_) or (-) weakest FACTIONS where MBR=true. (+) ONLY if you see opportunity.
557
566
  - (_) if you would prefer to hold and wait to take action.
558
567
  ---
559
568
  one move per turn. output EXACTLY one line.
560
569
  example format: ${(0, util_1.pick)([
561
- `(+) ${f1}`,
562
- `(&) ${m}`,
563
- `(-) ${m}`,
564
- `(!) ${m} "${(0, util_1.pick)(['any strategies?', 'not leaving.'])}"`,
565
- `(#) ${m} "${(0, util_1.pick)(['dead faction.', 'overvalued.'])}"`,
566
- `(!) ${m} "${(0, util_1.pick)(['who else is here?', 'love the energy.'])}"`,
570
+ `(+) ${f1} "${(0, util_1.pick)(['conviction play.', 'count me in.', 'early is everything.', 'strongest faction here.'])}"`,
571
+ `(-) ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"`,
572
+ `(!) ${m} "${(0, util_1.pick)(['any strategies?', 'not leaving.', 'just getting started.'])}"`,
573
+ `(#) ${m} "${(0, util_1.pick)(['dead faction.', 'overvalued.', 'full of larps.'])}"`,
574
+ `(!) ${m} "${(0, util_1.pick)(['who else is here?', 'love the energy.', 'lets go!'])}"`,
567
575
  `(#) ${m} "${(0, util_1.pick)(['faction went quiet.', 'underperforming.'])}"`,
568
576
  ])}
569
577
  >`;
package/dist/executor.js CHANGED
@@ -431,9 +431,19 @@ const handlers = {
431
431
  async function executeAction(kit, agent, factions, decision, brain, log, maxFoundedFactions, usedFactionNames, llm) {
432
432
  const short = agent.publicKey.slice(0, 8);
433
433
  try {
434
- const handler = handlers[decision.action];
434
+ // (+) resolves to 'join' — reroute to 'reinforce' if agent already holds the faction
435
+ let action = decision.action;
436
+ if (action === 'join' && decision.faction) {
437
+ const faction = factions.find(f => f.mint === decision.faction || f.mint.endsWith(decision.faction));
438
+ if (faction) {
439
+ const balance = await kit.state.getBalance(faction.mint);
440
+ if (balance > 0)
441
+ action = 'reinforce';
442
+ }
443
+ }
444
+ const handler = handlers[action];
435
445
  if (!handler)
436
- return { success: false, error: `unknown action: ${decision.action}` };
446
+ return { success: false, error: `unknown action: ${action}` };
437
447
  const desc = await handler(kit, agent, factions, decision, log, maxFoundedFactions, usedFactionNames, llm);
438
448
  if (!desc)
439
449
  return { success: false, error: 'action precondition not met' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-agent-kit",
3
- "version": "4.5.3",
3
+ "version": "4.5.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",