pyre-agent-kit 4.5.4 → 4.5.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.
Files changed (2) hide show
  1. package/dist/agent.js +42 -30
  2. package/package.json +1 -1
package/dist/agent.js CHANGED
@@ -259,7 +259,7 @@ const buildCompactModelPrompt = async (kit, agent, factionCtx, solRange, holding
259
259
  return 'RS';
260
260
  };
261
261
  // Sentiment label
262
- const sentLabel = (s) => `${s >= 0 ? '+' : ''}${s.toFixed(2)}`;
262
+ const sentLabel = (s) => `${s >= 0 ? '+' : ''}${s.toFixed(1)}`;
263
263
  // Per-position PnL (numeric, 2 decimal places)
264
264
  const pnlValue = (valueSol, bal) => {
265
265
  if (totalTokens <= 0 || netInvested <= 0)
@@ -277,7 +277,7 @@ const buildCompactModelPrompt = async (kit, agent, factionCtx, solRange, holding
277
277
  if (!f)
278
278
  continue;
279
279
  seenMints.add(f.mint);
280
- const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
280
+ const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(1)}` : '?';
281
281
  const fnr = foundedSet.has(f.mint);
282
282
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
283
283
  factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${Math.max(v.valueSol, 0.005).toFixed(2)},${pnlValue(v.valueSol, v.bal)},${sentLabel(sent)}`);
@@ -295,14 +295,20 @@ const buildCompactModelPrompt = async (kit, agent, factionCtx, solRange, holding
295
295
  if (seenMints.has(f.mint))
296
296
  continue;
297
297
  seenMints.add(f.mint);
298
- const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
298
+ const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(1)}` : '?';
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,14 +346,14 @@ 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]}
344
- HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
349
+ BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personality]}
350
+ HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(2)} 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).
@@ -361,7 +367,7 @@ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
361
367
  (%) "&" - create new faction. & = creative name, in quotes.
362
368
  (_) - skip turn.
363
369
  --- RULES:
364
- (+) increase MCAP. (-) decreases MCAP.
370
+ (+) increases MCAP. (-) decreases MCAP.
365
371
  (!) increases SENT. (#) decreases SENT.
366
372
  (^) FACTIONS where STATUS=RD.
367
373
  (~) FACTIONS where STATUS=ASN.
@@ -372,13 +378,13 @@ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
372
378
  - no FACTIONS? (%) to create one.
373
379
  - learn about FACTIONS and other agents in INTEL. HLTH is performance. PNL and SENT are per-faction direction. use all three to decide.
374
380
  - limit FACTIONS where MBR=true to AT MOST 5.${memberOf.length > 3 ? ` MBR=true on ${memberOf.length} FACTIONS — consider (-) from underperformers.` : ''}
375
- - FACTIONS where FNR=true and MBR=false, consider (+). (!) to promote it.
381
+ - consider (+) FACTIONS where FNR=true. (!) to promote it.
376
382
  - FACTIONS where STATUS=RS may have higher reward if you (+) the right one.
377
383
  - in FACTIONS where MBR=true, if MCAP increases, your PNL will increase.
378
- - (+) and (!) strengthen FACTIONS where MBR=true and STATUS=RS and push towards STATUS=ASN.
384
+ - (+) and (!) strengthen FACTIONS where STATUS=RS and push towards STATUS=ASN.
379
385
  - consider (-) FACTIONS where MBR=true and PNL is positive to lock in profits.
380
386
  - consider (-) FACTIONS where MBR=true and PNL is negative unless FNR=true or SENT is positive.
381
- - if HLTH is negative, consider (_) or (-) weakest FACTIONS where MBR=true. (+) ONLY if you see opportunity.
387
+ - when HLTH is negative, consider (_) or (-) weakest FACTIONS where MBR=true. (+) ONLY if you see opportunity.
382
388
  - (_) if you would prefer to hold and wait to take action.
383
389
  ---
384
390
  one move per turn. output EXACTLY one line.
@@ -432,7 +438,7 @@ const buildMinimumPrompt = async (kit, agent, factionCtx, solRange, holdings) =>
432
438
  return 'RS';
433
439
  };
434
440
  // Sentiment label
435
- const sentLabel = (s) => `${s >= 0 ? '+' : ''}${s.toFixed(2)}`;
441
+ const sentLabel = (s) => `${s >= 0 ? '+' : ''}${s.toFixed(1)}`;
436
442
  // Per-position PnL (numeric, 2 decimal places)
437
443
  const pnlValue = (valueSol, bal) => {
438
444
  if (totalTokens <= 0 || netInvested <= 0)
@@ -450,7 +456,7 @@ const buildMinimumPrompt = async (kit, agent, factionCtx, solRange, holdings) =>
450
456
  if (!f)
451
457
  continue;
452
458
  seenMints.add(f.mint);
453
- const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
459
+ const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(1)}` : '?';
454
460
  const fnr = foundedSet.has(f.mint);
455
461
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
456
462
  factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${Math.max(v.valueSol, 0.005).toFixed(2)},${pnlValue(v.valueSol, v.bal)},${sentLabel(sent)}`);
@@ -468,14 +474,20 @@ const buildMinimumPrompt = async (kit, agent, factionCtx, solRange, holdings) =>
468
474
  if (seenMints.has(f.mint))
469
475
  continue;
470
476
  seenMints.add(f.mint);
471
- const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
477
+ const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(1)}` : '?';
472
478
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
473
479
  factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,0,${sentLabel(sent)}`);
474
480
  }
475
- // 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
476
488
  let intelSnippet = '';
477
489
  try {
478
- const tableMemberMints = [...seenMints].filter(mint => heldMints.has(mint));
490
+ const tableMemberMints = [...minMints].filter(mint => heldMints.has(mint));
479
491
  const lines = [];
480
492
  for (const mint of tableMemberMints.slice(0, 1)) {
481
493
  const f = factionCtx.all.find(ff => ff.mint === mint);
@@ -491,8 +503,8 @@ const buildMinimumPrompt = async (kit, agent, factionCtx, solRange, holdings) =>
491
503
  }
492
504
  catch { }
493
505
  // Pick example FIDs only from factions actually shown in the table
494
- const tableFids = factionRows.slice(0, 4).map(r => r.split(',')[0]);
495
- 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';
496
508
  const nonMemberFids = tableFids.filter(fid => fid !== m);
497
509
  const f1 = nonMemberFids.length > 0 ? (0, util_1.pick)(nonMemberFids) : m;
498
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.
@@ -512,18 +524,18 @@ PNL: per-position profit. positive = winning, negative = losing.
512
524
  SENT: sentiment score. positive = bullish, negative = bearish.
513
525
  --- YOU ARE:
514
526
  NAME: @AP${agent.publicKey.slice(0, 4)}
515
- BIO: ${defaults_1.personalityDesc[agent.personality]}
516
- HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(5)} SOL
527
+ BIO: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.personality]}
528
+ HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(1)} SOL
517
529
  ${unrealizedPnl > 1 ? 'YOU ARE UP. consider taking profits.' : unrealizedPnl < -0.5 ? 'YOU ARE DOWN. be conservative. consider downsizing.' : 'BREAKEVEN. look for conviction plays.'}
518
530
  --- INTEL:
519
531
  ${intelSnippet}
520
532
  --- FACTIONS:
521
533
  FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT
522
- ${factionRows.length > 0 ? factionRows.slice(0, 4).join('\n') : 'none'}
534
+ ${minRows.length > 0 ? minRows.join('\n') : 'none'}
523
535
  --- ACTIONS:
524
- FORMAT: (action) $ OR (action) $ "*"
536
+ FORMAT: (action) $ "*"
525
537
  REPLACE $ with EXACTLY one FID from FACTIONS ONLY (always ends in pw).
526
- REPLACE * with a ONE sentence cno , always in double quotes.
538
+ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
527
539
  (+) $ "*" - join or increase.
528
540
  (-) $ "*" - leave or reduce.
529
541
  (!) $ "*" - talk in comms. your voice.
@@ -544,13 +556,13 @@ REPLACE * with a ONE sentence cno , always in double quotes.
544
556
  - no FACTIONS? (%) to create one.
545
557
  - learn about FACTIONS and other agents in INTEL. HLTH is performance. PNL and SENT are per-faction direction. use all three to decide.
546
558
  - limit FACTIONS where MBR=true to AT MOST 3.${memberOf.length > 1 ? ` MBR=true on ${memberOf.length} FACTIONS — consider (-) from underperformers.` : ''}
547
- - FACTIONS where FNR=true and MBR=false, consider (+). (!) to promote it.
559
+ - consider (+) FACTIONS where FNR=true. (!) to promote it.
548
560
  - FACTIONS where STATUS=RS may have higher reward if you (+) the right one.
549
561
  - in FACTIONS where MBR=true, if MCAP increases, your PNL will increase.
550
- - (+) and (!) strengthen FACTIONS where MBR=true and STATUS=RS and push towards STATUS=ASN.
562
+ - (+) and (!) strengthen FACTIONS where STATUS=RS and push towards STATUS=ASN.
551
563
  - consider (-) FACTIONS where MBR=true and PNL is positive to lock in profits.
552
564
  - consider (-) FACTIONS where MBR=true and PNL is negative unless FNR=true or SENT is positive.
553
- - if HLTH is negative, consider (_) or (-) weakest FACTIONS where MBR=true. (+) ONLY if you see opportunity.
565
+ - when HLTH is negative, consider (_) or (-) weakest FACTIONS where MBR=true. (+) ONLY if you see opportunity.
554
566
  - (_) if you would prefer to hold and wait to take action.
555
567
  ---
556
568
  one move per turn. output EXACTLY one line.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-agent-kit",
3
- "version": "4.5.4",
3
+ "version": "4.5.6",
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",