pyre-agent-kit 3.4.13 → 3.4.15
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 +40 -27
- package/dist/executor.js +30 -31
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -27,7 +27,8 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
|
|
|
27
27
|
const readyMints = new Set(ready.map(f => f.mint));
|
|
28
28
|
const seenMints = new Set([...heldMints, ...nearbyMints, ...risingMints, ...ascendedMints, ...readyMints]);
|
|
29
29
|
const unexplored = factionCtx.all.filter(f => !seenMints.has(f.mint)).sort(() => Math.random() - 0.5).slice(0, 3);
|
|
30
|
-
const
|
|
30
|
+
const fmtId = (f) => f.mint.slice(-8);
|
|
31
|
+
const fmtFaction = (f) => f.market_cap_sol ? `${fmtId(f)} (${f.market_cap_sol.toFixed(2)} SOL)` : fmtId(f);
|
|
31
32
|
const nearbyList = nearby.map(fmtFaction).join(', ') || 'none';
|
|
32
33
|
const risingList = rising.map(fmtFaction).join(', ') || 'none';
|
|
33
34
|
const ascendedList = ascended.map(fmtFaction).join(', ') || 'none';
|
|
@@ -41,7 +42,7 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
|
|
|
41
42
|
const f = factionCtx.all.find((ff) => ff.mint === mint);
|
|
42
43
|
if (!f)
|
|
43
44
|
continue;
|
|
44
|
-
const label =
|
|
45
|
+
const label = mint.slice(-8);
|
|
45
46
|
const uiBalance = bal / TOKEN_MULTIPLIER;
|
|
46
47
|
const valueSol = uiBalance * (f.price_sol ?? 0);
|
|
47
48
|
totalHoldingsValue += valueSol;
|
|
@@ -67,7 +68,7 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
|
|
|
67
68
|
.map(([mint, score]) => {
|
|
68
69
|
const f = factionCtx.all.find((ff) => ff.mint === mint);
|
|
69
70
|
const label = score > 3 ? 'bullish' : score < -3 ? 'bearish' : 'neutral';
|
|
70
|
-
return f ? `${f.
|
|
71
|
+
return f ? `${f.mint.slice(-8)}: ${label} (${score > 0 ? '+' : ''}${score})` : null;
|
|
71
72
|
})
|
|
72
73
|
.filter(Boolean)
|
|
73
74
|
.join(', ') || 'no strong feelings yet';
|
|
@@ -80,9 +81,12 @@ const buildAgentPrompt = (kit, agent, factionCtx, intelSnippet, recentMessages,
|
|
|
80
81
|
const memoryBlock = memoryEntries.length > 0
|
|
81
82
|
? memoryEntries.slice(0, 7).map((m) => `- ${m}`).join('; ')
|
|
82
83
|
: 'none';
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
const
|
|
84
|
+
const mMint = [...heldMints][0] || (validatedFactions.length > 0 ? (0, util_1.pick)(validatedFactions).mint : null);
|
|
85
|
+
const m = mMint ? mMint.slice(-8) : 'xxxxxx pw';
|
|
86
|
+
const f1Mint = validatedFactions.length > 0 ? (0, util_1.pick)(validatedFactions) : null;
|
|
87
|
+
const f1 = f1Mint ? f1Mint.mint.slice(-8) : m;
|
|
88
|
+
const f2Mint = validatedFactions.length > 1 ? (0, util_1.pick)(validatedFactions.filter(f => f.mint !== f1Mint?.mint)) : f1Mint;
|
|
89
|
+
const f2 = f2Mint ? f2Mint.mint.slice(-8) : f1;
|
|
86
90
|
return `You are an autonomous agent playing Pyre, a faction warfare game.
|
|
87
91
|
--- GOAL:
|
|
88
92
|
Maximize long-term profit and faction dominance.
|
|
@@ -102,11 +106,11 @@ PERSONALITY: ${gameState.personalitySummary ?? defaults_1.personalityDesc[agent.
|
|
|
102
106
|
MEMORIES: ${memoryBlock}
|
|
103
107
|
VALUE: ${totalHoldingsValue.toFixed(4)} SOL | Realized P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL | Unrealized: ${unrealizedPnl >= 0 ? '+' : ''}${unrealizedPnl.toFixed(4)} SOL
|
|
104
108
|
SPEND RANGE: ${minSol}–${maxSol} SOL
|
|
105
|
-
FOUNDED: ${gameState.founded.length > 0 ? `${gameState.founded.map((m) =>
|
|
109
|
+
FOUNDED: ${gameState.founded.length > 0 ? `${gameState.founded.map((m) => m.slice(-8)).join(', ')} — promote these aggressively` : 'none'}
|
|
106
110
|
MEMBER OF: ${holdingsList}
|
|
107
111
|
SENTIMENT: ${sentimentList}
|
|
108
112
|
${positionValues.length > 0 ? `BEST FACTION: ${positionValues.sort((a, b) => b.valueSol - a.valueSol)[0].label} (${positionValues.sort((a, b) => b.valueSol - a.valueSol)[0].valueSol.toFixed(4)} SOL)` : ''}
|
|
109
|
-
ACTIVE LOANS: ${gameState.activeLoans.size > 0 ? `${[...gameState.activeLoans].map((m) =>
|
|
113
|
+
ACTIVE LOANS: ${gameState.activeLoans.size > 0 ? `${[...gameState.activeLoans].map((m) => m.slice(-8)).join(', ')}` : 'none'}
|
|
110
114
|
${unrealizedPnl > 0.1 ? 'You are UP. Consider taking profits on your biggest winners with DEFECT.' : unrealizedPnl < -0.05 ? 'You are DOWN. Be conservative. Cut losers with DEFECT. Smaller positions.' : 'Near breakeven. Look for conviction plays.'}
|
|
111
115
|
--- INTEL:
|
|
112
116
|
ALLIES: ${allyList}
|
|
@@ -134,7 +138,7 @@ REPAY_LOAN $ — repay a loan (ascended factions only).
|
|
|
134
138
|
SIEGE $ — liquidate a bad loan (ascended factions only).
|
|
135
139
|
TITHE $ — harvest fees into the treasury to grow the faction economy (ascended factions only).
|
|
136
140
|
LAUNCH "name" — create a new faction. name should be original, be creative. wrap name in double quotes always.
|
|
137
|
-
- REPLACE $ with exactly ONE faction from ASCENDED, RISING, READY, NEARBY, UNEXPLORED, or MEMBER OF.
|
|
141
|
+
- REPLACE $ with exactly ONE faction from ASCENDED, RISING, READY, NEARBY, UNEXPLORED, or MEMBER OF (always contains the pw suffix).
|
|
138
142
|
- REPLACE * with what you have to say about your action, always in double quotes, if available on the action. optional but recommended.
|
|
139
143
|
EXAMPLE: JOIN ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"
|
|
140
144
|
EXAMPLE: DEFECT ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.'])}"
|
|
@@ -175,14 +179,14 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
175
179
|
const f = factionCtx.all.find((ff) => ff.mint === mint);
|
|
176
180
|
if (!f)
|
|
177
181
|
return null;
|
|
178
|
-
return {
|
|
182
|
+
return { id: mint.slice(-8), valueSol: (bal / TOKEN_MULTIPLIER) * (f.price_sol ?? 0) };
|
|
179
183
|
})
|
|
180
184
|
.filter(Boolean)
|
|
181
185
|
.sort((a, b) => b.valueSol - a.valueSol);
|
|
182
186
|
const pnl = (gameState.totalSolReceived - gameState.totalSolSpent) / 1e9;
|
|
183
|
-
const founded = gameState.founded.slice(0, 2);
|
|
187
|
+
const founded = gameState.founded.slice(0, 2).map((m) => m.slice(-8));
|
|
184
188
|
const heldMints = new Set(holdingsEntries.map(([m]) => m));
|
|
185
|
-
const memberOf = valued.slice(0, 5).map((v) => v.
|
|
189
|
+
const memberOf = valued.slice(0, 5).map((v) => v.id);
|
|
186
190
|
const sentimentList = [...kit.state.sentimentMap]
|
|
187
191
|
.filter(([mint]) => heldMints.has(mint))
|
|
188
192
|
.map(([mint, score]) => {
|
|
@@ -190,7 +194,7 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
190
194
|
if (!f)
|
|
191
195
|
return null;
|
|
192
196
|
const label = score > 3 ? 'bullish' : score < -3 ? 'bearish' : 'neutral';
|
|
193
|
-
return `${f.
|
|
197
|
+
return `${f.mint.slice(-8)}:${label}`;
|
|
194
198
|
})
|
|
195
199
|
.filter(Boolean)
|
|
196
200
|
.join(', ') || 'none';
|
|
@@ -205,9 +209,12 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
|
|
|
205
209
|
const seenMints = new Set([...heldMints, ...nearbyMints, ...risingMints, ...ascendedMints, ...readyMints]);
|
|
206
210
|
const unexplored = factionCtx.all.filter(f => !seenMints.has(f.mint)).sort(() => Math.random() - 0.5).slice(0, 3);
|
|
207
211
|
const validatedFactions = [...ascended, ...ready, ...rising, ...nearby, ...unexplored];
|
|
208
|
-
const
|
|
209
|
-
const
|
|
210
|
-
const
|
|
212
|
+
const mMint2 = [...heldMints][0] || (validatedFactions.length > 0 ? (0, util_1.pick)(validatedFactions).mint : null);
|
|
213
|
+
const m = mMint2 ? mMint2.slice(-8) : 'xxxxxxpw';
|
|
214
|
+
const f1v = validatedFactions.length > 0 ? (0, util_1.pick)(validatedFactions) : null;
|
|
215
|
+
const f1 = f1v ? f1v.mint.slice(-8) : m;
|
|
216
|
+
const f2v = validatedFactions.length > 1 ? (0, util_1.pick)(validatedFactions.filter(f => f.mint !== f1v?.mint)) : f1v;
|
|
217
|
+
const f2 = f2v ? f2v.mint.slice(-8) : f1;
|
|
211
218
|
return `You are an autonomous agent playing in Pyre, a faction warfare game.
|
|
212
219
|
--- GOAL:
|
|
213
220
|
Maximize long-term profit and faction dominance.
|
|
@@ -220,20 +227,20 @@ Ascended Factions are established. 0.04% war tax on every transaction, harvestab
|
|
|
220
227
|
NAME: ${agent.publicKey.slice(0, 8)}
|
|
221
228
|
PERSONALITY: ${defaults_1.personalityDesc[agent.personality]}
|
|
222
229
|
P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
|
|
223
|
-
FOUNDED: ${founded.length > 0 ? founded.
|
|
230
|
+
FOUNDED: ${founded.length > 0 ? founded.join(', ') : 'none'}
|
|
224
231
|
MEMBER OF: ${memberOf.length > 0 ? memberOf.join(', ') : 'none'}
|
|
225
|
-
MEMBERSHIP VALUE: ${valued.length > 0 ? valued.map(v => `${v.
|
|
232
|
+
MEMBERSHIP VALUE: ${valued.length > 0 ? valued.map(v => `${v.id}: ${v.valueSol.toFixed(4)} SOL`).join(', ') : 'no value'}
|
|
226
233
|
SENTIMENT: ${sentimentList}
|
|
227
234
|
--- INTEL:
|
|
228
235
|
ALLIES: ${agent.allies.size > 0 ? [...agent.allies].slice(0, 2).map(a => `@${a.slice(0, 8)}`).join(', ') : 'none'}
|
|
229
236
|
RIVALS: ${agent.rivals.size > 0 ? [...agent.rivals].slice(0, 2).map(a => `@${a.slice(0, 8)}`).join(', ') : 'none'}
|
|
230
237
|
LATEST: ${intelSnippet}
|
|
231
238
|
--- FACTIONS:
|
|
232
|
-
ASCENDED: ${ascended.length > 0 ? ascended.map(f => f.market_cap_sol ? `${f.
|
|
233
|
-
RISING: ${rising.length > 0 ? rising.map(f => f.market_cap_sol ? `${f.
|
|
234
|
-
READY: ${ready.length > 0 ? ready.map(f => f.market_cap_sol ? `${f.
|
|
235
|
-
NEARBY: ${nearby.length > 0 ? nearby.map(f => f.market_cap_sol ? `${f.
|
|
236
|
-
UNEXPLORED: ${unexplored.length > 0 ? unexplored.map(f => f.market_cap_sol ? `${f.
|
|
239
|
+
ASCENDED: ${ascended.length > 0 ? ascended.map(f => f.market_cap_sol ? `${f.mint.slice(-8)} (${f.market_cap_sol.toFixed(2)} SOL)` : f.mint.slice(-8)).join(', ') : 'none'}
|
|
240
|
+
RISING: ${rising.length > 0 ? rising.map(f => f.market_cap_sol ? `${f.mint.slice(-8)} (${f.market_cap_sol.toFixed(2)} SOL)` : f.mint.slice(-8)).join(', ') : 'none'}
|
|
241
|
+
READY: ${ready.length > 0 ? ready.map(f => f.market_cap_sol ? `${f.mint.slice(-8)} (${f.market_cap_sol.toFixed(2)} SOL)` : f.mint.slice(-8)).join(', ') : 'none'}
|
|
242
|
+
NEARBY: ${nearby.length > 0 ? nearby.map(f => f.market_cap_sol ? `${f.mint.slice(-8)} (${f.market_cap_sol.toFixed(2)} SOL)` : f.mint.slice(-8)).join(', ') : 'none'}
|
|
243
|
+
UNEXPLORED: ${unexplored.length > 0 ? unexplored.map(f => f.market_cap_sol ? `${f.mint.slice(-8)} (${f.market_cap_sol.toFixed(2)} SOL)` : f.mint.slice(-8)).join(', ') : 'none'}
|
|
237
244
|
--- ACTIONS:
|
|
238
245
|
JOIN $ "*" - join a faction.
|
|
239
246
|
DEFECT $ "*" - leave or decrease position in a faction.
|
|
@@ -244,7 +251,7 @@ FUD $ "*" - trash talk a faction.
|
|
|
244
251
|
ASCEND $ - transition a faction from ready to ascended.
|
|
245
252
|
TITHE $ - harvest fees into the treasury.
|
|
246
253
|
LAUNCH "^" - create a faction.
|
|
247
|
-
- REPLACE $ with exactly ONE choice from ASCENDED, RISING, READY, NEARBY, UNEXPLORED, or MEMBER OF
|
|
254
|
+
- REPLACE $ with exactly ONE choice from ASCENDED, RISING, READY, NEARBY, UNEXPLORED, or MEMBER OF (always contains the pw suffix).
|
|
248
255
|
- REPLACE * with a ONE sentence RESPONSE for your ACTION, always in double quotes.
|
|
249
256
|
- REPLACE ^ with a unique faction inspired name (eg. "Glitch Cult", "Whale Syndicate"), always in double quotes.
|
|
250
257
|
EXAMPLE: JOIN ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"
|
|
@@ -305,11 +312,17 @@ function editDistance1(a, b) {
|
|
|
305
312
|
}
|
|
306
313
|
return true;
|
|
307
314
|
}
|
|
308
|
-
function resolveFaction(
|
|
315
|
+
function resolveFaction(target, factions, holdings, kit, action) {
|
|
309
316
|
const gameState = kit.state.state;
|
|
310
|
-
if (!
|
|
317
|
+
if (!target)
|
|
311
318
|
return undefined;
|
|
312
|
-
const
|
|
319
|
+
const targetLower = target.toLowerCase();
|
|
320
|
+
// Try mint suffix match first (last-8 chars ending in pw)
|
|
321
|
+
const mintMatch = factions.find((f) => f.mint.toLowerCase().endsWith(targetLower));
|
|
322
|
+
if (mintMatch)
|
|
323
|
+
return mintMatch;
|
|
324
|
+
// Fall back to symbol match
|
|
325
|
+
const matches = factions.filter((f) => f.symbol.toLowerCase() === targetLower);
|
|
313
326
|
if (matches.length === 0)
|
|
314
327
|
return undefined;
|
|
315
328
|
if (matches.length === 1)
|
package/dist/executor.js
CHANGED
|
@@ -7,7 +7,6 @@ const action_1 = require("./action");
|
|
|
7
7
|
const error_1 = require("./error");
|
|
8
8
|
const faction_1 = require("./faction");
|
|
9
9
|
const agent_1 = require("./agent");
|
|
10
|
-
const pyre_world_kit_1 = require("pyre-world-kit");
|
|
11
10
|
const findFaction = (factions, mint) => factions.find((f) => f.mint === mint);
|
|
12
11
|
const vaultCreator = async (kit) => (await kit.state.getVaultCreator()) ?? kit.state.state.publicKey;
|
|
13
12
|
const handlers = {
|
|
@@ -51,8 +50,8 @@ const handlers = {
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
kit.state.markVoted(faction.mint);
|
|
54
|
-
agent.lastAction = `joined ${faction.
|
|
55
|
-
return `joined ${faction.
|
|
53
|
+
agent.lastAction = `joined ${faction.mint.slice(-8)}`;
|
|
54
|
+
return `joined ${faction.mint.slice(-8)} for ${sol.toFixed(4)} SOL${decision.message ? ` — "${decision.message}"` : ''}`;
|
|
56
55
|
},
|
|
57
56
|
async reinforce(kit, agent, factions, decision, log) {
|
|
58
57
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -78,8 +77,8 @@ const handlers = {
|
|
|
78
77
|
const { result, confirm } = await kit.exec('actions', 'join', params);
|
|
79
78
|
await (0, tx_1.sendAndConfirm)(kit.connection, agent.keypair, result);
|
|
80
79
|
await confirm();
|
|
81
|
-
agent.lastAction = `reinforced ${faction.
|
|
82
|
-
return `reinforced ${faction.
|
|
80
|
+
agent.lastAction = `reinforced ${faction.mint.slice(-8)}`;
|
|
81
|
+
return `reinforced ${faction.mint.slice(-8)} for ${sol.toFixed(4)} SOL${decision.message ? ` — "${decision.message}"` : ''}`;
|
|
83
82
|
},
|
|
84
83
|
async defect(kit, agent, factions, decision) {
|
|
85
84
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -129,8 +128,8 @@ const handlers = {
|
|
|
129
128
|
if ((await kit.state.getBalance(faction.mint)) <= 0)
|
|
130
129
|
agent.infiltrated.delete(faction.mint);
|
|
131
130
|
const prefix = isInfiltrated ? 'dumped (infiltration complete)' : 'defected from';
|
|
132
|
-
agent.lastAction = `defected ${faction.
|
|
133
|
-
return `${prefix} ${faction.
|
|
131
|
+
agent.lastAction = `defected ${faction.mint.slice(-8)}`;
|
|
132
|
+
return `${prefix} ${faction.mint.slice(-8)}${decision.message ? ` — "${decision.message}"` : ''}`;
|
|
134
133
|
},
|
|
135
134
|
async rally(kit, agent, factions, decision) {
|
|
136
135
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -144,8 +143,8 @@ const handlers = {
|
|
|
144
143
|
await (0, tx_1.sendAndConfirm)(kit.connection, agent.keypair, result);
|
|
145
144
|
await confirm();
|
|
146
145
|
kit.state.markRallied(faction.mint);
|
|
147
|
-
agent.lastAction = `rallied ${faction.
|
|
148
|
-
return `rallied ${faction.
|
|
146
|
+
agent.lastAction = `rallied ${faction.mint.slice(-8)}`;
|
|
147
|
+
return `rallied ${faction.mint.slice(-8)}`;
|
|
149
148
|
},
|
|
150
149
|
async launch(kit, agent, factions, decision, log, maxFoundedFactions, usedFactionNames, llm) {
|
|
151
150
|
const founded = kit.state.state?.founded ?? [];
|
|
@@ -181,8 +180,8 @@ const handlers = {
|
|
|
181
180
|
const mint = result.mint.toBase58();
|
|
182
181
|
factions.push({ mint, name, symbol, status: 'rising' });
|
|
183
182
|
usedFactionNames.add(name);
|
|
184
|
-
agent.lastAction = `launched ${
|
|
185
|
-
return `launched [${symbol}] ${name} (${
|
|
183
|
+
agent.lastAction = `launched ${mint.slice(-8)}`;
|
|
184
|
+
return `launched [${symbol}] ${name} (${mint.slice(-8)})`;
|
|
186
185
|
},
|
|
187
186
|
async message(kit, agent, factions, decision) {
|
|
188
187
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -219,8 +218,8 @@ const handlers = {
|
|
|
219
218
|
}
|
|
220
219
|
}
|
|
221
220
|
kit.state.markVoted(faction.mint);
|
|
222
|
-
agent.lastAction = `messaged ${faction.
|
|
223
|
-
return `said in ${faction.
|
|
221
|
+
agent.lastAction = `messaged ${faction.mint.slice(-8)}`;
|
|
222
|
+
return `said in ${faction.mint.slice(-8)}: "${decision.message}"`;
|
|
224
223
|
},
|
|
225
224
|
async fud(kit, agent, factions, decision) {
|
|
226
225
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -256,11 +255,11 @@ const handlers = {
|
|
|
256
255
|
}
|
|
257
256
|
if ((await kit.state.getBalance(faction.mint)) <= 0) {
|
|
258
257
|
agent.infiltrated.delete(faction.mint);
|
|
259
|
-
agent.lastAction = `defected ${faction.
|
|
260
|
-
return `fud cleared position in ${faction.
|
|
258
|
+
agent.lastAction = `defected ${faction.mint.slice(-8)}`;
|
|
259
|
+
return `fud cleared position in ${faction.mint.slice(-8)} → defected: "${decision.message}"`;
|
|
261
260
|
}
|
|
262
|
-
agent.lastAction = `fud ${faction.
|
|
263
|
-
return `argued in ${faction.
|
|
261
|
+
agent.lastAction = `fud ${faction.mint.slice(-8)}`;
|
|
262
|
+
return `argued in ${faction.mint.slice(-8)}: "${decision.message}"`;
|
|
264
263
|
},
|
|
265
264
|
async infiltrate(kit, agent, factions, decision) {
|
|
266
265
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -287,8 +286,8 @@ const handlers = {
|
|
|
287
286
|
await confirm();
|
|
288
287
|
agent.infiltrated.add(faction.mint);
|
|
289
288
|
kit.state.markVoted(faction.mint);
|
|
290
|
-
agent.lastAction = `infiltrated ${faction.
|
|
291
|
-
return `infiltrated ${faction.
|
|
289
|
+
agent.lastAction = `infiltrated ${faction.mint.slice(-8)}`;
|
|
290
|
+
return `infiltrated ${faction.mint.slice(-8)} for ${sol.toFixed(4)} SOL${decision.message ? ` — "${decision.message}"` : ''}`;
|
|
292
291
|
},
|
|
293
292
|
async war_loan(kit, agent, factions, decision) {
|
|
294
293
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -317,8 +316,8 @@ const handlers = {
|
|
|
317
316
|
});
|
|
318
317
|
await (0, tx_1.sendAndConfirm)(kit.connection, agent.keypair, result);
|
|
319
318
|
await confirm();
|
|
320
|
-
agent.lastAction = `war loan ${faction.
|
|
321
|
-
return `took war loan on ${faction.
|
|
319
|
+
agent.lastAction = `war loan ${faction.mint.slice(-8)}`;
|
|
320
|
+
return `took war loan on ${faction.mint.slice(-8)} (${collateral} tokens, ${(borrowLamports / web3_js_1.LAMPORTS_PER_SOL).toFixed(3)} SOL)`;
|
|
322
321
|
},
|
|
323
322
|
async repay_loan(kit, agent, factions, decision) {
|
|
324
323
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -341,8 +340,8 @@ const handlers = {
|
|
|
341
340
|
});
|
|
342
341
|
await (0, tx_1.sendAndConfirm)(kit.connection, agent.keypair, result);
|
|
343
342
|
await confirm();
|
|
344
|
-
agent.lastAction = `repaid loan ${faction.
|
|
345
|
-
return `repaid war loan on ${faction.
|
|
343
|
+
agent.lastAction = `repaid loan ${faction.mint.slice(-8)}`;
|
|
344
|
+
return `repaid war loan on ${faction.mint.slice(-8)} (${(loan.total_owed / web3_js_1.LAMPORTS_PER_SOL).toFixed(4)} SOL)`;
|
|
346
345
|
},
|
|
347
346
|
async siege(kit, agent, factions, decision) {
|
|
348
347
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -371,8 +370,8 @@ const handlers = {
|
|
|
371
370
|
});
|
|
372
371
|
await (0, tx_1.sendAndConfirm)(kit.connection, agent.keypair, result);
|
|
373
372
|
await confirm();
|
|
374
|
-
agent.lastAction = `siege ${faction.
|
|
375
|
-
return `sieged ${targetBorrower.slice(0, 8)}... in ${faction.
|
|
373
|
+
agent.lastAction = `siege ${faction.mint.slice(-8)}`;
|
|
374
|
+
return `sieged ${targetBorrower.slice(0, 8)}... in ${faction.mint.slice(-8)} (liquidation)`;
|
|
376
375
|
},
|
|
377
376
|
async ascend(kit, agent, factions, decision) {
|
|
378
377
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -385,8 +384,8 @@ const handlers = {
|
|
|
385
384
|
await (0, tx_1.sendAndConfirm)(kit.connection, agent.keypair, result);
|
|
386
385
|
await confirm();
|
|
387
386
|
faction.status = 'ascended';
|
|
388
|
-
agent.lastAction = `ascended ${faction.
|
|
389
|
-
return `ascended ${faction.
|
|
387
|
+
agent.lastAction = `ascended ${faction.mint.slice(-8)}`;
|
|
388
|
+
return `ascended ${faction.mint.slice(-8)} to DEX`;
|
|
390
389
|
},
|
|
391
390
|
async raze(kit, agent, factions, decision) {
|
|
392
391
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -398,8 +397,8 @@ const handlers = {
|
|
|
398
397
|
});
|
|
399
398
|
await (0, tx_1.sendAndConfirm)(kit.connection, agent.keypair, result);
|
|
400
399
|
await confirm();
|
|
401
|
-
agent.lastAction = `razed ${faction.
|
|
402
|
-
return `razed ${faction.
|
|
400
|
+
agent.lastAction = `razed ${faction.mint.slice(-8)}`;
|
|
401
|
+
return `razed ${faction.mint.slice(-8)} (reclaimed)`;
|
|
403
402
|
},
|
|
404
403
|
async tithe(kit, agent, factions, decision) {
|
|
405
404
|
const faction = findFaction(factions, decision.faction);
|
|
@@ -412,8 +411,8 @@ const handlers = {
|
|
|
412
411
|
});
|
|
413
412
|
await (0, tx_1.sendAndConfirm)(kit.connection, agent.keypair, result);
|
|
414
413
|
await confirm();
|
|
415
|
-
agent.lastAction = `tithed ${faction.
|
|
416
|
-
return `tithed ${faction.
|
|
414
|
+
agent.lastAction = `tithed ${faction.mint.slice(-8)}`;
|
|
415
|
+
return `tithed ${faction.mint.slice(-8)} (harvested fees)`;
|
|
417
416
|
},
|
|
418
417
|
async scout(kit, agent, factions, decision) {
|
|
419
418
|
const target = decision.faction;
|