force fresh session: ↻ new session button + /new-session
bus carries a one-shot AtomicBool armed by POST /api/new-session (or the /new-session slash command). next turn drops --continue, starting a fresh claude session; the flag clears automatically so subsequent turns resume normal behavior. /compact still always uses --continue — compacting a non-existent session is a no-op anyway. per-agent page grows an ↻ new session button next to the cancel-turn one (always visible, amber, confirms before posting since dropping --continue context isn't reversible). slash-command surface picks up /new-session for parity with the button. note row emitted on the live feed both at arm- time and again when the turn actually consumes the flag, so the operator can confirm it landed.
This commit is contained in:
parent
14aa7c7acc
commit
034b4fde10
6 changed files with 102 additions and 6 deletions
|
|
@ -170,11 +170,12 @@
|
|||
let termAPI = null;
|
||||
|
||||
const SLASH_COMMANDS = [
|
||||
{ name: '/help', desc: 'list slash commands' },
|
||||
{ name: '/clear', desc: 'wipe the terminal panel (local-only)' },
|
||||
{ name: '/cancel', desc: 'SIGINT the in-flight claude turn' },
|
||||
{ name: '/compact', desc: 'compact the persistent claude session' },
|
||||
{ name: '/model', desc: '/model <name> — switch claude model for future turns' },
|
||||
{ name: '/help', desc: 'list slash commands' },
|
||||
{ name: '/clear', desc: 'wipe the terminal panel (local-only)' },
|
||||
{ name: '/cancel', desc: 'SIGINT the in-flight claude turn' },
|
||||
{ name: '/compact', desc: 'compact the persistent claude session' },
|
||||
{ name: '/model', desc: '/model <name> — switch claude model for future turns' },
|
||||
{ name: '/new-session', desc: 'next turn runs without --continue (fresh claude session)' },
|
||||
];
|
||||
|
||||
async function postModel(name) {
|
||||
|
|
@ -213,6 +214,7 @@
|
|||
}
|
||||
const postCancelTurn = () => postSimple('/api/cancel', '/cancel');
|
||||
const postCompact = () => postSimple('/api/compact', '/compact');
|
||||
const postNewSession = () => postSimple('/api/new-session', '/new-session');
|
||||
|
||||
function handleSlashCommand(line) {
|
||||
if (!termAPI) return false;
|
||||
|
|
@ -236,6 +238,11 @@
|
|||
case '/compact':
|
||||
postCompact();
|
||||
return true;
|
||||
case '/new-session':
|
||||
if (window.confirm('arm a fresh claude session for the next turn? all prior --continue context will be dropped.')) {
|
||||
postNewSession();
|
||||
}
|
||||
return true;
|
||||
case '/model': {
|
||||
const parts = trimmed.split(/\s+/);
|
||||
if (parts.length < 2 || !parts[1]) {
|
||||
|
|
@ -431,6 +438,19 @@
|
|||
});
|
||||
})();
|
||||
|
||||
// Wire the new-session button (always visible; arms a one-shot for
|
||||
// the next turn). Mildly destructive (drops --continue context) so
|
||||
// we confirm before posting.
|
||||
(() => {
|
||||
const btn = $('new-session-btn');
|
||||
if (!btn) return;
|
||||
btn.addEventListener('click', () => {
|
||||
if (!window.confirm('arm a fresh claude session for the next turn? all prior --continue context will be dropped.')) return;
|
||||
btn.disabled = true;
|
||||
postNewSession().finally(() => { btn.disabled = false; });
|
||||
});
|
||||
})();
|
||||
|
||||
// Track banner activity by reference-counting in-flight turns. A turn
|
||||
// can begin while the previous turn_end is still in the pipeline (rare
|
||||
// but happens on tight wake cycles), so we count rather than toggle.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue