simmer-automaton 0.1.3 → 0.1.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/index.js +8 -4
- package/package.json +1 -1
- package/src/index.ts +9 -4
package/dist/index.js
CHANGED
|
@@ -64,6 +64,10 @@ async function refreshState(logger) {
|
|
|
64
64
|
logger.error(`[simmer] Failed to refresh state: ${e}`);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
function fmtCurrency(amount) {
|
|
68
|
+
const val = amount.toFixed(2);
|
|
69
|
+
return config.venue === "simmer" ? `${val} $SIM` : `$${val}`;
|
|
70
|
+
}
|
|
67
71
|
function buildPromptContext() {
|
|
68
72
|
if (!cachedState || !cachedState.initialized) {
|
|
69
73
|
return "[Simmer Automaton] Not initialized. Run: POST /api/sdk/automaton/init";
|
|
@@ -72,7 +76,7 @@ function buildPromptContext() {
|
|
|
72
76
|
"## Simmer Automaton — Survival Context (read-only)",
|
|
73
77
|
"",
|
|
74
78
|
`**Tier:** ${currentTier} | **Venue:** ${config.venue}`,
|
|
75
|
-
`**Budget:**
|
|
79
|
+
`**Budget:** ${fmtCurrency(cachedState.budget_usd)} | **Spent:** ${fmtCurrency(cachedState.spent_usd)} | **Remaining:** ${fmtCurrency(cachedState.remaining_usd)}`,
|
|
76
80
|
`**Halted:** ${cachedState.halted ? "YES — all trades blocked" : "no"}`,
|
|
77
81
|
`**Horizon:** ${cachedState.horizon_days} days`,
|
|
78
82
|
"",
|
|
@@ -113,9 +117,9 @@ function formatStatus() {
|
|
|
113
117
|
const lines = [
|
|
114
118
|
`Tier: ${currentTier}`,
|
|
115
119
|
`Venue: ${config.venue}`,
|
|
116
|
-
`Budget:
|
|
117
|
-
`Spent:
|
|
118
|
-
`Remaining:
|
|
120
|
+
`Budget: ${fmtCurrency(cachedState.budget_usd)}`,
|
|
121
|
+
`Spent: ${fmtCurrency(cachedState.spent_usd)}`,
|
|
122
|
+
`Remaining: ${fmtCurrency(cachedState.remaining_usd)}`,
|
|
119
123
|
`Halted: ${cachedState.halted ? "YES" : "no"}`,
|
|
120
124
|
`Horizon: ${cachedState.horizon_days} days`,
|
|
121
125
|
`Cycles: ${cycleCount}`,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -80,6 +80,11 @@ async function refreshState(logger: { info: (m: string) => void; error: (m: stri
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
function fmtCurrency(amount: number): string {
|
|
84
|
+
const val = amount.toFixed(2);
|
|
85
|
+
return config.venue === "simmer" ? `${val} $SIM` : `$${val}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
83
88
|
function buildPromptContext(): string {
|
|
84
89
|
if (!cachedState || !cachedState.initialized) {
|
|
85
90
|
return "[Simmer Automaton] Not initialized. Run: POST /api/sdk/automaton/init";
|
|
@@ -89,7 +94,7 @@ function buildPromptContext(): string {
|
|
|
89
94
|
"## Simmer Automaton — Survival Context (read-only)",
|
|
90
95
|
"",
|
|
91
96
|
`**Tier:** ${currentTier} | **Venue:** ${config.venue}`,
|
|
92
|
-
`**Budget:**
|
|
97
|
+
`**Budget:** ${fmtCurrency(cachedState.budget_usd)} | **Spent:** ${fmtCurrency(cachedState.spent_usd)} | **Remaining:** ${fmtCurrency(cachedState.remaining_usd)}`,
|
|
93
98
|
`**Halted:** ${cachedState.halted ? "YES — all trades blocked" : "no"}`,
|
|
94
99
|
`**Horizon:** ${cachedState.horizon_days} days`,
|
|
95
100
|
"",
|
|
@@ -135,9 +140,9 @@ function formatStatus(): string {
|
|
|
135
140
|
const lines = [
|
|
136
141
|
`Tier: ${currentTier}`,
|
|
137
142
|
`Venue: ${config.venue}`,
|
|
138
|
-
`Budget:
|
|
139
|
-
`Spent:
|
|
140
|
-
`Remaining:
|
|
143
|
+
`Budget: ${fmtCurrency(cachedState.budget_usd)}`,
|
|
144
|
+
`Spent: ${fmtCurrency(cachedState.spent_usd)}`,
|
|
145
|
+
`Remaining: ${fmtCurrency(cachedState.remaining_usd)}`,
|
|
141
146
|
`Halted: ${cachedState.halted ? "YES" : "no"}`,
|
|
142
147
|
`Horizon: ${cachedState.horizon_days} days`,
|
|
143
148
|
`Cycles: ${cycleCount}`,
|