pyre-agent-kit 4.3.3 → 4.3.5

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
@@ -2,6 +2,7 @@ import type { PyreKit } from 'pyre-world-kit';
2
2
  import { AgentState, FactionInfo, LLMAdapter, LLMDecision } from './types';
3
3
  export interface LLMDecideOptions {
4
4
  compact?: boolean;
5
+ onPromptTable?: (header: string, rows: string[]) => void;
5
6
  }
6
7
  export declare const pendingScoutResults: Map<string, string[]>;
7
8
  export interface FactionContext {
package/dist/agent.js CHANGED
@@ -143,7 +143,7 @@ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
143
143
  (<) $ - repay loan.
144
144
  (.) $ - show support.
145
145
  (%) "{" - create new faction. { = creative name.
146
- (_) - do nothing. wait until next turn.
146
+ (_) - skip turn.
147
147
  --- RULES:
148
148
  (%) or (_) no FACTIONS required.
149
149
  (+) or (|) FACTIONS where MBR=false.
@@ -176,7 +176,7 @@ REPLACE * with a ONE sentence RESPONSE, always in double quotes.
176
176
  - when HLTH is negative, prefer (-) weakest FACTIONS where MBR=true or (_). consider (+) or (&) ONLY if you see potential opportunity.
177
177
  - (_) if holding is the optimal move.
178
178
  ---
179
- one move per turn. output EXACTLY one line: (action) $ "*" OR (_)
179
+ one move per turn. output EXACTLY one line.
180
180
  example format: ${(0, util_1.pick)([
181
181
  `(+) ${f1} "${(0, util_1.pick)(['rising fast and I want early exposure.', 'count me in.', 'early is everything.', 'strongest faction here.', 'lets go!'])}"`,
182
182
  `(-) ${m} "${(0, util_1.pick)(['taking profits.', 'time to move on.', 'sentiment is bearish, ready to cut losses.', 'cutting the drag.'])}"`,
@@ -254,7 +254,7 @@ const buildCompactModelPrompt = (kit, agent, factionCtx, intelSnippet, recentMes
254
254
  const mcap = f.market_cap_sol ? `${f.market_cap_sol.toFixed(2)}` : '?';
255
255
  const fnr = foundedSet.has(f.mint);
256
256
  const sent = kit.state.sentimentMap.get(f.mint) ?? 0;
257
- factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${v.valueSol.toFixed(4)},${pnlLabel(v.valueSol, v.bal)},${sentLabel(sent)}`);
257
+ factionRows.push(`${f.mint.slice(-8)},${mcap},${statusTag(f)},true,${fnr},${Math.max(v.valueSol, 0.005).toFixed(2)},${pnlLabel(v.valueSol, v.bal)},${sentLabel(sent)}`);
258
258
  }
259
259
  // Non-member factions
260
260
  const nonMember = factionCtx.all.filter(f => !seenMints.has(f.mint) && f.status !== 'razed');
@@ -690,17 +690,18 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
690
690
  ];
691
691
  if (toScout.length > 0) {
692
692
  const intels = await Promise.all(toScout.map((f) => (0, faction_1.fetchFactionIntel)(kit, f)));
693
- const lines = intels.map((intel) => {
693
+ const lines = intels.map((intel, i) => {
694
+ const fid = toScout[i].mint.slice(-8);
694
695
  const memberInfo = intel.totalMembers > 0
695
696
  ? `${intel.totalMembers} members, top holder: ${intel.members[0]?.percentage.toFixed(1)}%`
696
697
  : 'no members';
697
698
  const commsInfo = intel.recentComms.length > 0
698
699
  ? intel.recentComms
699
700
  .slice(0, 3)
700
- .map((c) => `@${c.sender.slice(0, 8)} said: "${c.memo.replace(/^<+/, '').replace(/>+\s*$/, '')}"`)
701
+ .map((c) => `@AP${c.sender.slice(0, 4)} said: "${c.memo.replace(/^<+/, '').replace(/>+\s*$/, '')}"`)
701
702
  .join(', ')
702
703
  : 'no recent comms';
703
- return ` [${intel.symbol}] ${memberInfo} | recent comms: ${commsInfo}`;
704
+ return ` [${fid}] ${memberInfo} | recent comms: ${commsInfo}`;
704
705
  });
705
706
  intelSnippet = 'FACTION INTEL:\n' + lines.join('\n');
706
707
  }
@@ -718,6 +719,16 @@ async function llmDecide(kit, agent, factions, recentMessages, llm, log, solRang
718
719
  }
719
720
  const buildPrompt = compact ? exports.buildCompactModelPrompt : exports.buildAgentPrompt;
720
721
  const prompt = buildPrompt(kit, agent, factionCtx, intelSnippet + scoutSnippet, recentMessages, solRange, holdings);
722
+ // Surface the faction table to the caller if requested
723
+ if (options?.onPromptTable) {
724
+ const tableStart = prompt.indexOf('--- FACTIONS:');
725
+ const tableEnd = prompt.indexOf('--- ACTIONS:');
726
+ if (tableStart !== -1 && tableEnd !== -1) {
727
+ const tableBlock = prompt.slice(tableStart + '--- FACTIONS:\n'.length, tableEnd).trim();
728
+ const lines = tableBlock.split('\n');
729
+ options.onPromptTable(lines[0], lines.slice(1));
730
+ }
731
+ }
721
732
  const raw = await llm.generate(prompt);
722
733
  if (!raw) {
723
734
  log(`[${agent.publicKey.slice(0, 8)}] LLM returned null`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-agent-kit",
3
- "version": "4.3.3",
3
+ "version": "4.3.5",
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",