claude-rpc 0.6.2 → 0.6.3
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/default-config.js +2 -2
- package/src/format.js +17 -2
- package/src/install.js +19 -0
- package/src/version.js +1 -1
package/package.json
CHANGED
package/src/default-config.js
CHANGED
|
@@ -48,12 +48,12 @@ export const DEFAULT_CONFIG = {
|
|
|
48
48
|
byStatus: {
|
|
49
49
|
working: {
|
|
50
50
|
details: "Working in {project}",
|
|
51
|
-
state: "{currentToolPretty} · {currentFilePretty} · {
|
|
51
|
+
state: "{currentToolPretty} · {currentFilePretty} · {tokensLabel}",
|
|
52
52
|
largeImageText: "Working on a {fileLang} file",
|
|
53
53
|
},
|
|
54
54
|
thinking: {
|
|
55
55
|
details: "Thinking in {project}",
|
|
56
|
-
state: "{modelPretty} · {messagesLabel} · {
|
|
56
|
+
state: "{modelPretty} · {messagesLabel} · {tokensLabel}",
|
|
57
57
|
largeImageText: "Reasoning with {modelPretty}",
|
|
58
58
|
},
|
|
59
59
|
notification: {
|
package/src/format.js
CHANGED
|
@@ -379,7 +379,10 @@ export function buildVars(state, config, aggregate) {
|
|
|
379
379
|
// Literal single space — handy for blanking a line without `requires`.
|
|
380
380
|
empty: ' ',
|
|
381
381
|
|
|
382
|
-
//
|
|
382
|
+
// Pluralized session labels. tokensLabel is empty when zero so the
|
|
383
|
+
// `· {tokensLabel}` suffix in default templates collapses away —
|
|
384
|
+
// "Bash · · 0 tokens" is not a useful frame.
|
|
385
|
+
tokensLabel: sessionTokens > 0 ? `${fmtNum(sessionTokens)} tokens` : '',
|
|
383
386
|
messagesLabel: plural(messages, 'prompt'),
|
|
384
387
|
toolsLabel: plural(tools, 'tool call'),
|
|
385
388
|
filesEditedLabel: plural(filesEdited, 'edit'),
|
|
@@ -562,7 +565,19 @@ export function buildVars(state, config, aggregate) {
|
|
|
562
565
|
|
|
563
566
|
export function fillTemplate(tpl, vars) {
|
|
564
567
|
if (typeof tpl !== 'string') return tpl;
|
|
565
|
-
|
|
568
|
+
const filled = tpl.replace(/\{(\w+)\}/g, (_, key) => (key in vars ? String(vars[key]) : `{${key}}`));
|
|
569
|
+
return collapseSeparators(filled);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// After substitution, a template like "{currentToolPretty} · {currentFilePretty} · {tokensFmt} tokens"
|
|
573
|
+
// can resolve to "Bash · · 0 tokens" when the tool doesn't have a file path
|
|
574
|
+
// and no tokens have accumulated yet. Split on `·`, trim each segment, drop
|
|
575
|
+
// empty segments, rejoin — so empty middle vars don't leave orphan separators
|
|
576
|
+
// and trailing/leading separators disappear entirely. Templates without `·`
|
|
577
|
+
// pass through untouched.
|
|
578
|
+
function collapseSeparators(s) {
|
|
579
|
+
if (!s.includes('·')) return s;
|
|
580
|
+
return s.split('·').map((p) => p.trim()).filter(Boolean).join(' · ');
|
|
566
581
|
}
|
|
567
582
|
|
|
568
583
|
// Helper used by every "go stale" branch in applyIdle. Wipes the current-
|
package/src/install.js
CHANGED
|
@@ -260,6 +260,25 @@ export function migrateConfig() {
|
|
|
260
260
|
added.push('presence.largeImageText');
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
// v0.6.3: byStatus.working.state and .thinking.state used `{tokensFmt} tokens`
|
|
264
|
+
// which renders "0 tokens" before any session activity has accrued — combined
|
|
265
|
+
// with empty `{currentFilePretty}` for tools like Bash, that surfaced as
|
|
266
|
+
// "Bash · · 0 tokens" on the card. New default uses `{tokensLabel}` which is
|
|
267
|
+
// empty until tokens > 0, and fillTemplate now collapses adjacent separators.
|
|
268
|
+
// Migrate only the verbatim old template — leave anything the user customized.
|
|
269
|
+
const OLD_WORKING = '{currentToolPretty} · {currentFilePretty} · {tokensFmt} tokens';
|
|
270
|
+
const OLD_THINKING = '{modelPretty} · {messagesLabel} · {tokensFmt} tokens';
|
|
271
|
+
if (cfg.presence.byStatus?.working?.state === OLD_WORKING &&
|
|
272
|
+
DEFAULT_CONFIG.presence?.byStatus?.working?.state) {
|
|
273
|
+
cfg.presence.byStatus.working.state = DEFAULT_CONFIG.presence.byStatus.working.state;
|
|
274
|
+
added.push('presence.byStatus.working.state');
|
|
275
|
+
}
|
|
276
|
+
if (cfg.presence.byStatus?.thinking?.state === OLD_THINKING &&
|
|
277
|
+
DEFAULT_CONFIG.presence?.byStatus?.thinking?.state) {
|
|
278
|
+
cfg.presence.byStatus.thinking.state = DEFAULT_CONFIG.presence.byStatus.thinking.state;
|
|
279
|
+
added.push('presence.byStatus.thinking.state');
|
|
280
|
+
}
|
|
281
|
+
|
|
263
282
|
if (added.length === 0) {
|
|
264
283
|
console.log(` config up to date → ${CONFIG_PATH}`);
|
|
265
284
|
return false;
|