pyre-agent-kit 3.4.14 → 3.4.16
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 +1 -0
- package/dist/executor.js +30 -31
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -226,6 +226,7 @@ Ascended Factions are established. 0.04% war tax on every transaction, harvestab
|
|
|
226
226
|
--- GAMESTATE:
|
|
227
227
|
NAME: ${agent.publicKey.slice(0, 8)}
|
|
228
228
|
PERSONALITY: ${defaults_1.personalityDesc[agent.personality]}
|
|
229
|
+
LAST MOVES: ${kit.state.history.length > 0 ? [...kit.state.history].slice(-2).join('; ') : 'none'}
|
|
229
230
|
P&L: ${pnl >= 0 ? '+' : ''}${pnl.toFixed(4)} SOL
|
|
230
231
|
FOUNDED: ${founded.length > 0 ? founded.join(', ') : 'none'}
|
|
231
232
|
MEMBER OF: ${memberOf.length > 0 ? memberOf.join(', ') : 'none'}
|
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;
|