pyre-agent-kit 2.0.22 → 2.0.24

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.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import { AgentState, FactionInfo, LLMAdapter, LLMDecision } from './types';
2
2
  import { Connection } from '@solana/web3.js';
3
+ export declare const pendingScoutResults: Map<string, string[]>;
4
+ /** Execute a SCOUT action — look up an agent's pyre_world registry profile */
5
+ export declare function executeScout(connection: Connection, targetAddress: string): Promise<string>;
3
6
  export declare const buildAgentPrompt: (agent: AgentState, factions: FactionInfo[], leaderboardSnippet: string, intelSnippet: string, recentMessages: string[], solRange?: [number, number], chainMemories?: string[]) => string;
4
7
  export declare function llmDecide(agent: AgentState, factions: FactionInfo[], connection: Connection, recentMessages: string[], llm: LLMAdapter, log: (msg: string) => void, solRange?: [number, number], chainMemories?: string[]): Promise<LLMDecision | null>;
package/dist/agent.js CHANGED
@@ -1,11 +1,41 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildAgentPrompt = void 0;
3
+ exports.buildAgentPrompt = exports.pendingScoutResults = void 0;
4
+ exports.executeScout = executeScout;
4
5
  exports.llmDecide = llmDecide;
5
6
  const pyre_world_kit_1 = require("pyre-world-kit");
6
7
  const defaults_1 = require("./defaults");
7
8
  const util_1 = require("./util");
8
9
  const faction_1 = require("./faction");
10
+ // Store scout results to show on the next turn
11
+ exports.pendingScoutResults = new Map();
12
+ /** Execute a SCOUT action — look up an agent's pyre_world registry profile */
13
+ async function executeScout(connection, targetAddress) {
14
+ try {
15
+ const p = await (0, pyre_world_kit_1.getRegistryProfile)(connection, targetAddress);
16
+ if (!p)
17
+ return ` @${targetAddress.slice(0, 8)}: no pyre identity found`;
18
+ const total = p.joins + p.defects + p.rallies + p.launches + p.messages +
19
+ p.fuds + p.infiltrates + p.reinforces + p.war_loans + p.repay_loans +
20
+ p.sieges + p.ascends + p.razes + p.tithes;
21
+ const topActions = [
22
+ { n: 'joins', v: p.joins }, { n: 'defects', v: p.defects },
23
+ { n: 'rallies', v: p.rallies }, { n: 'messages', v: p.messages },
24
+ { n: 'fuds', v: p.fuds }, { n: 'infiltrates', v: p.infiltrates },
25
+ { n: 'reinforces', v: p.reinforces }, { n: 'war_loans', v: p.war_loans },
26
+ { n: 'sieges', v: p.sieges },
27
+ ].sort((a, b) => b.v - a.v).filter(a => a.v > 0).slice(0, 4)
28
+ .map(a => `${a.n}:${a.v}`).join(', ');
29
+ const personality = p.personality_summary || 'unknown';
30
+ const checkpoint = p.last_checkpoint > 0
31
+ ? new Date(p.last_checkpoint * 1000).toISOString().slice(0, 10)
32
+ : 'never';
33
+ return ` @${targetAddress.slice(0, 8)}: "${personality}" | ${total} actions (${topActions}) | last seen: ${checkpoint}`;
34
+ }
35
+ catch {
36
+ return ` @${targetAddress.slice(0, 8)}: lookup failed`;
37
+ }
38
+ }
9
39
  const buildAgentPrompt = (agent, factions, leaderboardSnippet, intelSnippet, recentMessages, solRange, chainMemories) => {
10
40
  const [minSol, maxSol] = solRange ?? defaults_1.PERSONALITY_SOL[agent.personality];
11
41
  const holdingsList = [...agent.holdings.entries()]
@@ -104,12 +134,16 @@ Ruthless, profitable, and only available on ascended factions.
104
134
  create a new faction.
105
135
  LAUNCH creates a brand new faction from scratch.
106
136
  You're the founder — if it gains members and momentum, you're sitting on top. High risk, high reward.
137
+ - SCOUT @address —
138
+ look up an agent's on-chain identity from the pyre_world registry.
139
+ SCOUT reveals their personality, total actions, and what they do most (joins, defects, infiltrates, etc).
140
+ Use it to size up rivals, verify allies, or gather intel before making a move. The result will be shown to you next turn.
107
141
 
108
142
  Prefer actions that move tokens AND include a message — JOIN, DEFECT, FUD, INFILTRATE, REINFORCE all let you trade AND talk at the same time. However, experiment and find a strategy that is optimized for you to win.
109
143
  Comms are where the real game happens — trash talk, alliances, intel drops, call-outs, and power plays. Be specific. Reference real agents, real numbers, real moves. Generic messages are boring. Have an opinion and say it loud. Mix it up — trade often, but keep the comms active too.
110
144
 
111
145
  WHO YOU ARE:
112
- Your address: ${agent.publicKey.slice(0, 8)}
146
+ You are "${agent.publicKey.slice(0, 8)}" — always speak in FIRST PERSON. Say "I", "my", "me". Never refer to yourself in third person or by your address.
113
147
  Personality: ${agent.personality} — ${defaults_1.personalityDesc[agent.personality]}
114
148
  Voice this turn: ${voiceNudge}
115
149
  ${memoryBlock}
@@ -133,7 +167,7 @@ ${(0, faction_1.generateDynamicExamples)(factions, agent)}
133
167
 
134
168
  Use your messages to define who YOU are. Be unique — don't sound like every other agent. Explore different angles, develop your own voice, create a reputation. The pyre.world realm is vast — find your niche and own it. Keep it varied and conversational — talk like a real person, not a bot. Mix up your sentence structure, tone, and energy. Sometimes ask questions, sometimes make statements, sometimes joke around.
135
169
  Your message MUST match your action/intent — if you're joining, sound bullish. If you're defecting, talk trash on the way out. Make sure you make accurate claims unless you are specifically being sneaky.
136
- If referencing your own wallet address, reframe the message from third person to first person. For example, instead of "saw @5Vt7ENia dump 5%, I'm out" say "I just dumped 5%, deal with it". Occasionally, as a checkpoint step, message a faction with who you currently are (think of this like a checkpoint).
170
+ CRITICAL: Always speak as yourself in first person. Say "I'm going all in" NOT "${agent.publicKey.slice(0, 8)} is going all in". You ARE the agent use "I", "my", "me" in every message.
137
171
 
138
172
  Your response (one line only):`;
139
173
  };
@@ -144,6 +178,11 @@ function parseLLMDecision(raw, factions, agent, solRange) {
144
178
  return null;
145
179
  for (const candidate of lines) {
146
180
  const line = candidate.trim();
181
+ // Handle SCOUT @address
182
+ const scoutMatch = line.match(/^SCOUT\s+@?([A-Za-z0-9]{6,44})/i);
183
+ if (scoutMatch) {
184
+ return { action: 'scout', faction: scoutMatch[1], reasoning: line };
185
+ }
147
186
  const cleaned = line
148
187
  .replace(/\*+/g, '') // strip all bold/italic markdown (e.g. **DEFECT SBP "msg"**)
149
188
  .replace(/^[-•>#\d.)\s]+/, '').replace(/^(?:WARNING|NOTE|RESPONSE|OUTPUT|ANSWER|RESULT|SCPRT|SCRIPT)\s*:?\s*/i, '').replace(/^ACTION\s+/i, '')
@@ -323,7 +362,14 @@ async function llmDecide(agent, factions, connection, recentMessages, llm, log,
323
362
  catch {
324
363
  // intel fetch failed, proceed without it
325
364
  }
326
- const prompt = (0, exports.buildAgentPrompt)(agent, factions, leaderboardSnippet, intelSnippet, recentMessages, solRange, chainMemories);
365
+ // Include results from previous SCOUT actions
366
+ const scoutResults = exports.pendingScoutResults.get(agent.publicKey);
367
+ let scoutSnippet = '';
368
+ if (scoutResults && scoutResults.length > 0) {
369
+ scoutSnippet = '\nSCOUT RESULTS (from your previous SCOUT actions):\n' + scoutResults.join('\n');
370
+ exports.pendingScoutResults.delete(agent.publicKey);
371
+ }
372
+ const prompt = (0, exports.buildAgentPrompt)(agent, factions, leaderboardSnippet, intelSnippet + scoutSnippet, recentMessages, solRange, chainMemories);
327
373
  const raw = await llm.generate(prompt);
328
374
  if (!raw) {
329
375
  log(`[${agent.publicKey.slice(0, 8)}] LLM returned null`);
package/dist/defaults.js CHANGED
@@ -72,7 +72,8 @@ exports.ACTION_MAP = {
72
72
  'SEND': 'MESSAGE', 'SAY': 'MESSAGE', 'CHAT': 'MESSAGE', 'MSG': 'MESSAGE', 'MESSAGING': 'MESSAGE',
73
73
  'CREATE': 'LAUNCH', 'FOUND': 'LAUNCH', 'HARVEST': 'TITHE',
74
74
  'MIGRATE': 'ASCEND', 'RECLAIM': 'RAZE', 'SPY': 'INFILTRATE',
75
- 'INVESTIGATION': 'INFILTRATE', 'INVESTIGATE': 'INFILTRATE', 'SCOUT': 'INFILTRATE', 'RECON': 'INFILTRATE',
75
+ 'INVESTIGATION': 'INFILTRATE', 'INVESTIGATE': 'INFILTRATE', 'RECON': 'INFILTRATE',
76
+ 'SCOUT': 'SCOUT',
76
77
  'PLEDGE': 'JOIN', 'ALLY': 'JOIN', 'BACK': 'JOIN', 'FUND': 'JOIN',
77
78
  'WITHDRAW': 'DEFECT', 'RETREAT': 'DEFECT', 'ABANDON': 'DEFECT', 'BAIL': 'DEFECT',
78
79
  'ANNOUNCE': 'MESSAGE', 'BROADCAST': 'MESSAGE', 'COMM': 'MESSAGE', 'COMMS': 'MESSAGE', 'REPORT': 'MESSAGE',
package/dist/executor.js CHANGED
@@ -9,6 +9,7 @@ const stronghold_1 = require("./stronghold");
9
9
  const action_1 = require("./action");
10
10
  const error_1 = require("./error");
11
11
  const faction_1 = require("./faction");
12
+ const agent_1 = require("./agent");
12
13
  const findFaction = (factions, symbol) => factions.find(f => f.symbol === symbol);
13
14
  /** Vault creator key — may differ from agent key for linked vaults */
14
15
  const vault = (agent) => agent.vaultCreator ?? agent.publicKey;
@@ -372,6 +373,20 @@ const handlers = {
372
373
  ctx.agent.lastAction = `fud ${faction.symbol}`;
373
374
  return `argued in ${faction.symbol}: "${ctx.decision.message}"`;
374
375
  },
376
+ scout: async (ctx) => {
377
+ const target = ctx.decision.faction; // holds the address for scout
378
+ if (!target)
379
+ return null;
380
+ const result = await (0, agent_1.executeScout)(ctx.connection, target);
381
+ // Store result to show in next turn's prompt
382
+ const existing = agent_1.pendingScoutResults.get(ctx.agent.publicKey) ?? [];
383
+ existing.push(result);
384
+ if (existing.length > 5)
385
+ existing.shift();
386
+ agent_1.pendingScoutResults.set(ctx.agent.publicKey, existing);
387
+ ctx.agent.lastAction = `scouted @${target.slice(0, 8)}`;
388
+ return `scouted @${target.slice(0, 8)}`;
389
+ },
375
390
  };
376
391
  async function executeAction(ctx) {
377
392
  const short = ctx.agent.publicKey.slice(0, 8);
package/dist/index.d.ts CHANGED
@@ -4,5 +4,6 @@ export { assignPersonality, PERSONALITY_SOL, PERSONALITY_WEIGHTS, personalityDes
4
4
  export { ensureStronghold } from './stronghold';
5
5
  export { ensureRegistryProfile } from './registry';
6
6
  export { sendAndConfirm } from './tx';
7
+ export { executeScout, pendingScoutResults } from './agent';
7
8
  export { reconstructFromChain, computeWeightsFromHistory, classifyPersonality, weightsFromCounts, actionIndex } from './chain';
8
9
  export declare function createPyreAgent(config: PyreAgentConfig): Promise<PyreAgent>;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.actionIndex = exports.weightsFromCounts = exports.classifyPersonality = exports.computeWeightsFromHistory = exports.reconstructFromChain = exports.sendAndConfirm = exports.ensureRegistryProfile = exports.ensureStronghold = exports.VOICE_NUDGES = exports.personalityDesc = exports.PERSONALITY_WEIGHTS = exports.PERSONALITY_SOL = exports.assignPersonality = void 0;
3
+ exports.actionIndex = exports.weightsFromCounts = exports.classifyPersonality = exports.computeWeightsFromHistory = exports.reconstructFromChain = exports.pendingScoutResults = exports.executeScout = exports.sendAndConfirm = exports.ensureRegistryProfile = exports.ensureStronghold = exports.VOICE_NUDGES = exports.personalityDesc = exports.PERSONALITY_WEIGHTS = exports.PERSONALITY_SOL = exports.assignPersonality = void 0;
4
4
  exports.createPyreAgent = createPyreAgent;
5
5
  const pyre_world_kit_1 = require("pyre-world-kit");
6
6
  const defaults_1 = require("./defaults");
@@ -23,6 +23,9 @@ var registry_2 = require("./registry");
23
23
  Object.defineProperty(exports, "ensureRegistryProfile", { enumerable: true, get: function () { return registry_2.ensureRegistryProfile; } });
24
24
  var tx_1 = require("./tx");
25
25
  Object.defineProperty(exports, "sendAndConfirm", { enumerable: true, get: function () { return tx_1.sendAndConfirm; } });
26
+ var agent_2 = require("./agent");
27
+ Object.defineProperty(exports, "executeScout", { enumerable: true, get: function () { return agent_2.executeScout; } });
28
+ Object.defineProperty(exports, "pendingScoutResults", { enumerable: true, get: function () { return agent_2.pendingScoutResults; } });
26
29
  var chain_2 = require("./chain");
27
30
  Object.defineProperty(exports, "reconstructFromChain", { enumerable: true, get: function () { return chain_2.reconstructFromChain; } });
28
31
  Object.defineProperty(exports, "computeWeightsFromHistory", { enumerable: true, get: function () { return chain_2.computeWeightsFromHistory; } });
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Connection, Keypair } from '@solana/web3.js';
2
2
  export type Personality = 'loyalist' | 'mercenary' | 'provocateur' | 'scout' | 'whale';
3
- export type Action = 'join' | 'defect' | 'rally' | 'launch' | 'message' | 'stronghold' | 'war_loan' | 'repay_loan' | 'siege' | 'ascend' | 'raze' | 'tithe' | 'infiltrate' | 'fud';
3
+ export type Action = 'join' | 'defect' | 'rally' | 'launch' | 'message' | 'stronghold' | 'war_loan' | 'repay_loan' | 'siege' | 'ascend' | 'raze' | 'tithe' | 'infiltrate' | 'fud' | 'scout';
4
4
  export interface LLMDecision {
5
5
  action: Action;
6
6
  faction?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-agent-kit",
3
- "version": "2.0.22",
3
+ "version": "2.0.24",
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",