pennyrouter 0.1.13 → 0.1.14
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/package.json +1 -1
- package/src/statusline.js +18 -4
package/package.json
CHANGED
package/src/statusline.js
CHANGED
|
@@ -94,8 +94,16 @@ function readJson(path) {
|
|
|
94
94
|
function claudeEnv() {
|
|
95
95
|
const settings = readJson(join(os.homedir(), ".claude", "settings.json")) || {};
|
|
96
96
|
const env = settings.env || {};
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
// A normal install writes base + pr- key into settings.json's env block. Fall back to the
|
|
98
|
+
// process environment so an out-of-band launch that supplies them there instead — e.g. the
|
|
99
|
+
// interactive probe, which passes creds via `--settings <file>` + child env rather than the
|
|
100
|
+
// user's settings.json — still resolves Penny. Real installs never set these as env vars, so
|
|
101
|
+
// this fallback is inert for them.
|
|
102
|
+
const base = env.ANTHROPIC_BASE_URL || process.env.ANTHROPIC_BASE_URL || "";
|
|
103
|
+
const keyCandidates = [
|
|
104
|
+
env.ANTHROPIC_API_KEY, env.ANTHROPIC_AUTH_TOKEN,
|
|
105
|
+
process.env.ANTHROPIC_API_KEY, process.env.ANTHROPIC_AUTH_TOKEN,
|
|
106
|
+
];
|
|
99
107
|
const key = keyCandidates.find((v) => typeof v === "string" && v.startsWith("pr-")) || "";
|
|
100
108
|
return { base, key };
|
|
101
109
|
}
|
|
@@ -170,9 +178,15 @@ if (config.wrap_command) {
|
|
|
170
178
|
}
|
|
171
179
|
|
|
172
180
|
if (lines.length === 0) {
|
|
173
|
-
|
|
181
|
+
lines = [penny];
|
|
174
182
|
} else {
|
|
175
183
|
lines[0] = lines[0].trimEnd() + " | " + penny;
|
|
176
|
-
console.log(lines.join("\\n"));
|
|
177
184
|
}
|
|
185
|
+
// Ambient tip: the gateway rotates cache.tip on a slow clock (see tips.statusline_tip).
|
|
186
|
+
// Rendered as its own dim line so it never crowds the cost/model segments; absent field
|
|
187
|
+
// (tips off, old gateway, bypass) renders nothing.
|
|
188
|
+
if (pennyInstalled && cache && cache.tip && !cache.bypass) {
|
|
189
|
+
lines.push("\\x1b[2m" + cache.tip + "\\x1b[0m");
|
|
190
|
+
}
|
|
191
|
+
console.log(lines.join("\\n"));
|
|
178
192
|
`;
|