pyre-agent-kit 4.3.0 → 4.3.2
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 +31 -27
- 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(
|
|
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(
|
|
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
|
|
@@ -91,12 +91,12 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
|
|
|
91
91
|
const memoryBlock = memoryEntries.length > 0
|
|
92
92
|
? memoryEntries.slice(0, 7).map((m) => `- ${m}`).join('; ')
|
|
93
93
|
: 'none';
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
const f2 =
|
|
94
|
+
// Pick example FIDs only from factions actually shown in the table
|
|
95
|
+
const tableFids = factionRows.map(r => r.split(',')[0]);
|
|
96
|
+
const m = tableFids.find(fid => heldMints.has([...seenMints].find(mint => mint.endsWith(fid)) ?? '')) ?? tableFids[0] ?? 'xxxxxxpw';
|
|
97
|
+
const nonMemberFids = tableFids.filter(fid => fid !== m);
|
|
98
|
+
const f1 = nonMemberFids.length > 0 ? (0, util_1.pick)(nonMemberFids) : m;
|
|
99
|
+
const f2 = nonMemberFids.length > 1 ? (0, util_1.pick)(nonMemberFids.filter(fid => fid !== f1)) : f1;
|
|
100
100
|
return `You are an autonomous agent playing in Pyre, a faction warfare game. You form your own alliances, opinions, and grudges. Think in English only. Think linearly: situation → decision → reason. Do not repeat yourself. Do NOT overthink, chess/strategy mood.
|
|
101
101
|
--- GOAL:
|
|
102
102
|
Maximize long-term profit and faction dominance.
|
|
@@ -124,7 +124,7 @@ ALLIES: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 5).map((a) => `@AP$
|
|
|
124
124
|
RIVALS: ${agent.rivals.size > 0 ? [...agent.rivals].slice(0, 5).map((a) => `@AP${a.slice(0, 4)}`).join(', ') : 'none'}
|
|
125
125
|
LATEST: ${intelSnippet}
|
|
126
126
|
--- FACTIONS:
|
|
127
|
-
|
|
127
|
+
FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT,LOAN
|
|
128
128
|
${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
|
|
129
129
|
--- ACTIONS:
|
|
130
130
|
FORMAT: (action) $ "*"
|
|
@@ -172,7 +172,8 @@ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
|
|
|
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
173
|
- (&) and (!) to push FACTIONS where MBR=true and STATUS=RS to STATUS=ASN.
|
|
174
174
|
- consider (-) to lock in profits on FACTIONS where MBR=true and PNL is positive.
|
|
175
|
-
- consider (-)
|
|
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.
|
|
176
177
|
- (_) if you are comfortable with your current positions and have nothing to say. the best move is sometimes no move.
|
|
177
178
|
---
|
|
178
179
|
one move per turn. output EXACTLY one line: (action) $ "*" OR (_)
|
|
@@ -253,7 +254,7 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
253
254
|
const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
|
|
254
255
|
const fnr = foundedSet.has(f.mint);
|
|
255
256
|
const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
|
|
256
|
-
factionRows.push(
|
|
257
|
+
factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${v.valueSol.toFixed(4)},${pnlLabel(v.valueSol, v.bal)},${sentLabel(sent)}`);
|
|
257
258
|
}
|
|
258
259
|
// Non-member factions
|
|
259
260
|
const nonMember = factionCtx.all.filter(f => !seenMints.has(f.mint) && f.status !== 'razed');
|
|
@@ -270,15 +271,14 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
270
271
|
seenMints.add(f.mint);
|
|
271
272
|
const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
|
|
272
273
|
const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
|
|
273
|
-
factionRows.push(
|
|
274
|
+
factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},false,false,0,FLAT,${sentLabel(sent)}`);
|
|
274
275
|
}
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
const m =
|
|
278
|
-
const
|
|
279
|
-
const f1 =
|
|
280
|
-
const
|
|
281
|
-
const f2 = f2v ? f2v.mint.slice(-8) : f1;
|
|
276
|
+
// Pick example FIDs only from factions actually shown in the table
|
|
277
|
+
const tableFids = factionRows.map(r => r.split(',')[0]);
|
|
278
|
+
const m = tableFids.find(fid => heldMints.has([...seenMints].find(mint => mint.endsWith(fid)) ?? '')) ?? tableFids[0] ?? 'xxxxxxpw';
|
|
279
|
+
const nonMemberFids = tableFids.filter(fid => fid !== m);
|
|
280
|
+
const f1 = nonMemberFids.length > 0 ? (0, util_1.pick)(nonMemberFids) : m;
|
|
281
|
+
const f2 = nonMemberFids.length > 1 ? (0, util_1.pick)(nonMemberFids.filter(fid => fid !== f1)) : f1;
|
|
282
282
|
return `You are an autonomous agent playing in Pyre, a faction warfare game. Think in English only. Think linearly: situation → decision → reason. Do not repeat yourself. Do NOT overthink, chess/strategy mood.
|
|
283
283
|
--- GOAL:
|
|
284
284
|
Maximize long-term profit and faction dominance.
|
|
@@ -297,13 +297,12 @@ SENT: sentiment score. BULL=positive, BEAR=negative, NEUT=neutral.
|
|
|
297
297
|
--- YOU ARE:
|
|
298
298
|
NAME: @AP${agent.publicKey.slice(0, 4)}
|
|
299
299
|
BIO: ${defaults_1.personalityDesc[agent.personality]}
|
|
300
|
-
LAST MOVES: ${kit.state.history.length > 0 ? [...kit.state.history].slice(-2).join('; ') : 'none'}
|
|
301
300
|
HLTH: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
|
|
302
301
|
${unrealizedPnl > 1 ? 'YOU ARE UP. consider taking profits.' : unrealizedPnl < -0.5 ? 'YOU ARE DOWN. be conservative. consider downsizing.' : 'BREAKEVEN. look for conviction plays.'}
|
|
303
302
|
--- INTEL:
|
|
304
303
|
${intelSnippet}
|
|
305
304
|
--- FACTIONS:
|
|
306
|
-
|
|
305
|
+
FID,MCAP,STATUS,MBR,FNR,VALUE,PNL,SENT
|
|
307
306
|
${factionRows.length > 0 ? factionRows.join('\n') : 'none'}
|
|
308
307
|
--- ACTIONS:
|
|
309
308
|
FORMAT: (action) $ "*"
|
|
@@ -336,7 +335,8 @@ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
|
|
|
336
335
|
- (+) and (&) increase MCAP. (-) decreases MCAP.
|
|
337
336
|
- (&) and (!) to push FACTIONS where MBR=true and STATUS=RS to STATUS=ASN.
|
|
338
337
|
- consider (-) FACTIONS where MBR=true and PNL=WIN to lock in profits.
|
|
339
|
-
- consider (-) FACTIONS where MBR=true
|
|
338
|
+
- consider (-) FACTIONS where MBR=true and PNL=LOSS unless FNR=true or SENT=BULL.
|
|
339
|
+
- when HLTH is negative, prefer (-) weakest FACTIONS where MBR=true or (_). consider (+) or (&) ONLY if you see potential opportunity.
|
|
340
340
|
- (_) if you are comfortable with your current positions. the best move is sometimes no move.
|
|
341
341
|
---
|
|
342
342
|
one move per turn. output EXACTLY one line: (action) $ "*" OR (_)
|
|
@@ -661,17 +661,21 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
|
|
|
661
661
|
};
|
|
662
662
|
let intelSnippet = '';
|
|
663
663
|
if (compact) {
|
|
664
|
-
// Compact:
|
|
664
|
+
// Compact: up to 2 intel lines from held factions
|
|
665
665
|
try {
|
|
666
666
|
const heldMints = [...holdings.keys()];
|
|
667
|
-
const
|
|
668
|
-
|
|
669
|
-
|
|
667
|
+
const heldFactions = allFactions.filter((f) => heldMints.includes(f.mint)).slice(0, 2);
|
|
668
|
+
const lines = [];
|
|
669
|
+
for (const hf of heldFactions) {
|
|
670
|
+
if (lines.length >= 2)
|
|
671
|
+
break;
|
|
672
|
+
const intel = await (0, faction_1.fetchFactionIntel)(kit, hf);
|
|
670
673
|
const latest = intel.recentComms.find((c) => c.sender !== agent.publicKey);
|
|
671
674
|
if (latest) {
|
|
672
|
-
|
|
675
|
+
lines.push(`@AP${latest.sender.slice(0, 4)} in ${hf.mint.slice(-8)}: "${latest.memo.replace(/^<+/, '').replace(/>+\s*$/, '').slice(0, 60)}"`);
|
|
673
676
|
}
|
|
674
677
|
}
|
|
678
|
+
intelSnippet = lines.join('\n');
|
|
675
679
|
}
|
|
676
680
|
catch { }
|
|
677
681
|
}
|