@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
46 lines • 2.02 kB
JavaScript
import { recordTipShown } from "./history-writer.js";
import { resolveReasoningLevelNotice } from "./reasoning-level-notice.js";
import { TIP_DEFINITIONS } from "./registry.js";
import { resolveStartupTipLine } from "./startup-tip.js";
/**
* The tip block under the startup header, recorded in the settings tip history
* as it is resolved. The one-time reasoning-level notice (senpi#3090) goes
* first; on the launch it shows, the rotating tip skips its own `thinking-level`
* entry so the two do not repeat each other.
*/
export function resolveStartupTips(options) {
const { settings } = options;
const tipsEnabled = settings.getTipsEnabled();
// Header-only quiet startup keeps the header but not the startup details, tips included.
const quietStartup = settings.getQuietStartup() !== false;
const record = (tipId) => {
const next = recordTipShown(settings.getTipsHistory(), tipId, options.now);
settings.setTipShown(tipId, next[tipId] ?? options.now);
};
const reasoningNotice = tipsEnabled && !quietStartup
? resolveReasoningLevelNotice({
history: settings.getTipsHistory(),
modelReasoning: options.modelReasoning(),
keys: options.displayKeys,
})
: undefined;
if (reasoningNotice)
record(reasoningNotice.tipId);
const startupTip = resolveStartupTipLine({
tipsEnabled,
quietStartup,
history: settings.getTipsHistory(),
now: options.now,
definitions: TIP_DEFINITIONS,
keys: options.keys,
hasCommand: options.hasCommand,
...(reasoningNotice ? { exclude: new Set(["thinking-level"]) } : {}),
});
if (startupTip)
record(startupTip.tipId);
const shown = [reasoningNotice, startupTip].filter((tip) => tip !== undefined);
if (shown.length === 0)
return undefined;
return { text: shown.map((tip) => tip.line).join("\n"), tipIds: shown.map((tip) => tip.tipId) };
}
//# sourceMappingURL=startup-tips.js.map