2026-11-14 10:02:43 +00:00
let inboxSlot = null ;
2026-11-14 21:21:07 +00:00
const GONE_NOTICE = "already done or removed elsewhere" ;
function closeGone ( result , keys , label ) {
if ( result . status !== 404 || ! keys . length ) {
return false ;
}
state . inbox = state . inbox . filter (( item ) => ! keys . includes ( keyOf ( item )));
toast ( ` ${ label } : ${ GONE_NOTICE } ` , [], true );
render ( false );
drawStream ();
return true ;
}
async function reloadGone ( missing , keys , label ) {
await load ();
if ( missing === null ) {
return ;
}
const left = new Set ( state . inbox . map ( keyOf ));
if ( keys . some (( key ) => ! left . has ( key ))) {
toast ( ` ${ label } : ${ GONE_NOTICE } ` , [], true );
} else {
toast ( ` ${ label } : not possible` , fail ( missing ), false );
}
}
2026-11-06 08:28:04 +00:00
async function submit ( entries , label ) {
ui . busy = true ;
2026-11-14 21:21:07 +00:00
const keys = entries . map ( keyOf );
let missing = null ;
const gone = ( result ) => {
if ( keys . length > 1 && result . status === 404 ) {
missing = result ;
return true ;
}
return closeGone ( result , keys , label );
};
const signed = await proofFor ( entries , label , gone );
2026-11-06 08:28:04 +00:00
if ( signed === null ) {
ui . busy = false ;
2026-11-14 21:21:07 +00:00
await reloadGone ( missing , keys , label );
2026-11-06 08:28:04 +00:00
return false ;
}
const result = await sendJson ( "/api/inbox/approve" , { items : entries , proof : signed . proof });
ui . busy = false ;
if ( ! result . ok || ! result . data ) {
2026-11-14 21:21:07 +00:00
if ( ! gone ( result )) {
toast ( ` ${ label } : not possible` , fail ( result ), false );
}
await reloadGone ( missing , keys , label );
2026-11-06 08:28:04 +00:00
return false ;
}
known . batches . add ( result . data . id );
ui . selected . clear ();
undoToast ( result . data , label );
await load ();
return true ;
}
function undoToast ( batch , label ) {
const left = h ( "span" , { class : "muted" });
2026-11-08 17:26:51 +00:00
const button = h ( "button" , { type : "button" , class : "btn small" , ... named ( "Undo" )}, icon ( "bi-arrow-counterclockwise" ), "Undo" );
2026-11-06 08:28:04 +00:00
const box = h ( "div" , { class : "toast wait" , role : "status" }, h ( "strong" , {}, label ), h ( "div" , { class : "undo-row" }, left , h ( "span" , { class : "spacer" }), button ));
let timer = 0 ;
const count = () => {
const rest = Math . ceil ( batch . due - nowSeconds ());
if ( rest <= 0 ) {
window . clearInterval ( timer );
box . remove ();
load ();
return ;
}
2026-11-08 17:26:51 +00:00
left . textContent = `takes effect in ${ rest } s` ;
2026-11-06 08:28:04 +00:00
};
timer = window . setInterval ( count , 250 );
button . addEventListener ( "click" , async () => {
window . clearInterval ( timer );
button . disabled = true ;
const result = await send ( `/api/inbox/undo/ ${ encodeURIComponent ( batch . id ) } ` , "" , "application/json" );
box . remove ();
2026-11-08 17:26:51 +00:00
toast ( result . ok ? `Undone: ${ label } ` : "Too late: already in effect" , result . ok ? [] : [ ` ${ result . status } ${ result . text } ` . trim ()], result . ok );
2026-11-06 08:28:04 +00:00
await load ();
});
document . getElementById ( "toasts" ). append ( box );
count ();
}
function approveOne ( item ) {
2026-11-17 19:09:46 +00:00
if ( collecting ( item )) {
collect ( item );
return null ;
}
2026-11-07 18:14:21 +00:00
if ( item . kind === "rule" ) {
return acceptRule ( item );
}
2026-11-06 08:28:04 +00:00
if ( item . kind === "decision" ) {
if ( ! item . recommended ) {
openItem ( item );
return null ;
}
2026-11-09 06:53:55 +00:00
return submit ([ entryOf ( item , "approve" , item . recommended )], `Choice: ${ item . recommended } ` );
2026-11-06 08:28:04 +00:00
}
2026-11-08 17:26:51 +00:00
return submit ([ entryOf ( item , "approve" , "" )], ` ${ item . kind === "operator" ? "Run" : "Grant" } : ${ short ( item . title ) } ` );
2026-11-06 08:28:04 +00:00
}
2026-11-09 06:53:55 +00:00
const chooseOne = ( item , label ) => submit ([ entryOf ( item , "approve" , label )], `Choice: ${ label } ` );
2026-11-18 19:28:37 +00:00
const asked = ( item ) => item . kind === "operator" && item . check === "decision" ;
const answers = new Map ();
async function answerRow ( item , answer ) {
if ( ! item . agent ) {
toast ( "Answer: no agent to send it to" , [ "The row names no adding agent; answer in its session." ], false );
return ;
}
if ( await radioSend ({ to : item . agent , text : `Decision ${ item . id } \nAnswer: ${ answer } ` , cls : "post" , upload : "" , voice : "" })) {
answers . set ( keyOf ( item ), answer );
drawInbox ();
}
}
function otherAnswer ( item ) {
const input = h ( "input" , { class : "field" , type : "text" , placeholder : "Other answer …" , "aria-label" : `Other answer to ${ item . id } ` , disabled : answers . has ( keyOf ( item ))});
const form = h ( "form" , { class : "option other" }, input ,
h ( "button" , { type : "submit" , class : "btn small" , disabled : answers . has ( keyOf ( item )), ... named ( "Send" , revealed ( `Send: your passkey signs this answer, a post to ${ item . agent } ` ))}, icon ( "bi-send" ), "Send" ));
form . addEventListener ( "submit" , ( event ) => {
event . preventDefault ();
if ( input . value . trim ()) {
answerRow ( item , input . value . trim ());
}
});
return form ;
}
function choicePanel ( item , pick , other ) {
const done = answers . has ( keyOf ( item ));
const pane = item . options . some (( option ) => option . preview ) ? h ( "pre" , { class : "choice-preview" , "aria-label" : "Preview" }) : null ;
const show = ( option ) => {
if ( pane ) {
pane . textContent = revealedLines ( option . preview || "" );
}
};
const buttons = item . options . map (( option ) => h ( "button" , {
type : "button" , class : `option ${ option . label === item . recommended ? " recommended" : "" } ` , title : revealed ( ` ${ option . label } : your passkey signs this answer, a post to ${ item . agent } ` ), disabled : item . held || done ,
on : { click : () => pick ( option . label ), focus : () => show ( option ), mouseenter : () => show ( option )},
}, h ( "strong" , {}, revealed ( option . label )), option . description ? h ( "span" , {}, revealed ( option . description )) : null ));
show ( item . options . find (( option ) => option . label === item . recommended ) || item . options [ 0 ] || {});
const list = h ( "div" , { class : "options" }, buttons , other || null );
return pane ? h ( "div" , { class : "choice" }, list , pane ) : list ;
}
const choiceOf = ( item , after ) => item . kind === "decision"
? choicePanel ( item , ( label ) => { after (); chooseOne ( item , label ); })
: asked ( item ) ? [ answerTo ( item ), choicePanel ( item , ( label ) => { after (); answerRow ( item , label ); }, otherAnswer ( item ))] : null ;
/**
* @param {Object} item a decision row of the register.
* @returns {HTMLElement} who receives the answer: the row's first agent with role A, which any agent can set, so the operator sees it before signing.
*/
const answerTo = ( item ) => h ( "p" , { class : "muted answer-to" }, item . agent ? [ "Your answer goes to " , h ( "strong" , {}, revealed ( item . agent )), " as a passkey-signed post, with the row id and your answer only." ] : "No agent holds role A on this row: answer in its session." );
2026-11-06 08:28:04 +00:00
2026-11-17 19:09:46 +00:00
const deniable = ( item ) => item . deniable || item . kind === "review" ;
const denialOf = ( item , reason ) => ({... entryOf ( item , "reject" , "" ), channel : "post" , reason , to : item . to });
const pickable = ( item ) => ! item . held && ( selectable ( item ) || deniable ( item ));
2026-11-11 08:32:36 +00:00
function bulk ( items , label , deny ) {
2026-11-17 19:09:46 +00:00
const usable = items . filter ( deny ? deniable : selectable );
2026-11-06 08:28:04 +00:00
if ( ! usable . length ) {
2026-11-11 08:32:36 +00:00
toast ( ` ${ label } : nothing to ${ deny ? "deny" : "grant" } ` , [], false );
2026-11-06 08:28:04 +00:00
return ;
}
const rows = usable . map (( item ) => h ( "li" , {},
2026-11-13 18:14:17 +00:00
h ( "div" , { class : "row" }, pill ( ITEM_LABELS [ item . kind ], KIND_TONES [ item . kind ]), item . kind === "decision" && ! deny ? h ( "span" , { class : "muted" }, revealed ( `→ ${ item . recommended } ` )) : null ),
h ( "strong" , {}, revealed ( item . title )),
item . kind === "operator" ? h ( "div" , { class : "command" }, h ( "code" , {}, revealed ( item . command ))) : null ,
item . kind === "operator" ? h ( "span" , { class : "muted" }, revealed ( `in ${ item . directory } ` )) : null ,
item . kind === "ask" ? h ( "div" , { class : "command" }, h ( "code" , {}, revealed ( item . command ))) : null ));
2026-11-11 08:32:36 +00:00
const confirm = h ( "button" , { type : "button" , class : deny ? "btn danger" : "btn primary" }, ` ${ deny ? "Deny" : "Grant" } ${ usable . length } ` );
2026-11-17 19:09:46 +00:00
const reason = deny ? h ( "textarea" , { class : "field" , maxlength : DENY_REASON , rows : 3 , placeholder : "e.g. make the gate green first" }) : null ;
2026-11-06 08:28:04 +00:00
confirm . addEventListener ( "click" , () => {
closeSheet ();
2026-11-17 19:09:46 +00:00
submit ( usable . map (( item ) => ( deny ? denialOf ( item , reason . value ) : entryOf ( item , "approve" , item . kind === "decision" ? item . recommended : "" ))), ` ${ label } : ${ usable . length } entries` );
2026-11-06 08:28:04 +00:00
});
2026-11-11 08:32:36 +00:00
const note = deny
2026-11-17 19:09:46 +00:00
? "Every entry and every full command that gets denied; each requester gets its denial and the reason by post. After the click the passkey signs the whole selection once; then 3 s remain to undo."
2026-11-11 08:32:36 +00:00
: "Every entry and every full command that gets granted. After the click the passkey signs the whole selection once; then 3 s remain to undo." ;
2026-11-17 19:09:46 +00:00
openSheet ( label , [ h ( "p" , { class : "muted" }, note ), h ( "ul" , { class : "mini" }, rows ), ...( deny ? [ h ( "label" , { class : "deny-reason" }, "Reason (optional, every requester reads it)" , reason )] : []),
h ( "div" , { class : "actions" }, h ( "span" , { class : "spacer" }), btn ( "Cancel" , "btn ghost" , closeSheet ), confirm )], false );
( reason || confirm ). focus ();
}
2026-11-18 19:28:37 +00:00
/**
* @returns {object} the picked items as chosen, and the grant, deny and grant-all-green controls of the Grant menu.
*/
function selectionActions ( items ) {
2026-11-17 19:09:46 +00:00
const green = items . filter ( isGreen );
const chosen = items . filter (( item ) => ui . selected . has ( keyOf ( item )));
const denials = chosen . filter ( deniable );
const grantable = chosen . filter ( selectable );
2026-11-18 19:28:37 +00:00
return {
chosen ,
grant : h ( "button" , { type : "button" , class : "btn small primary" , ... named ( `Grant selection ( ${ grantable . length } )` ), disabled : ! grantable . length || ui . busy , on : { click : () => bulk ( chosen , "Grant selection" , false )}}, icon ( "bi-check2-square" ), `Grant ${ grantable . length } ` ),
deny : h ( "button" , { type : "button" , class : "menu-item danger" , ... named ( `Deny selection ( ${ denials . length } )` , `Deny selection ( ${ denials . length } ): each requester gets its denial and an optional reason by post, one passkey signature, 3 s to undo` ), disabled : ! denials . length || ui . busy , on : { click : () => bulk ( chosen , "Deny selection" , true )}}, icon ( "bi-x-square" ), `Deny ${ denials . length } ` ),
green : h ( "button" , { type : "button" , class : "menu-item" , ... named ( `Grant all green ( ${ green . length } )` ), disabled : ! green . length || ui . busy , on : { click : () => bulk ( green , "Grant all green" , false )}}, icon ( "bi-check2-all" ), `Grant all green ${ green . length } ` ),
};
2026-11-06 08:28:04 +00:00
}
async function mark ( item , until , pinned ) {
const result = await sendJson ( "/api/inbox/mark" , { kind : item . kind , id : item . id , until , pinned });
if ( ! result . ok ) {
2026-11-08 17:26:51 +00:00
toast ( "Marking failed" , [ ` ${ result . status } ${ result . text } ` . trim ()], false );
2026-11-06 08:28:04 +00:00
}
await load ();
}
function tomorrow () {
const date = new Date ();
date . setDate ( date . getDate () + 1 );
date . setHours ( 8 , 0 , 0 , 0 );
return date . getTime () / 1000 ;
}
2026-11-11 08:32:36 +00:00
function toggle ( item , refocus ) {
if ( ! item || ! pickable ( item )) {
2026-11-06 08:28:04 +00:00
return ;
}
const key = keyOf ( item );
if ( ui . selected . has ( key )) {
ui . selected . delete ( key );
} else {
ui . selected . add ( key );
}
2026-11-11 08:32:36 +00:00
ui . cursor = Math . max ( visibleInbox (). findIndex (( entry ) => keyOf ( entry ) === key ), 0 );
2026-11-06 08:28:04 +00:00
drawInbox ();
2026-11-18 19:28:37 +00:00
drawGrant ();
2026-11-11 08:32:36 +00:00
const box = inboxDom . querySelector ( `.item[data-index=" ${ ui . cursor } "] > input[type="checkbox"]` );
if ( refocus && box ) {
box . focus ({ preventScroll : true });
}
2026-11-06 08:28:04 +00:00
}
function actionsFor ( item ) {
if ( item . held ) {
2026-11-08 17:26:51 +00:00
return [ h ( "span" , { class : "muted" }, "takes effect …" )];
2026-11-06 08:28:04 +00:00
}
const buttons = [];
2026-11-17 19:09:46 +00:00
const grant = ( button ) => buttons . push ( grantPress ( button , item ));
2026-11-07 18:14:21 +00:00
if ( item . kind === "review" ) {
2026-11-17 19:09:46 +00:00
grant ( iconBtn ( "bi-check-lg" , "Grant" , "btn small primary" , () => approveOne ( item )));
buttons . push ( denySplit ( item ));
2026-11-07 18:14:21 +00:00
} else if ( item . kind === "ask" ) {
2026-11-17 19:09:46 +00:00
grant ( iconBtn ( "bi-check-lg" , "Grant" , "btn small primary" , () => approveOne ( item )));
2026-11-06 08:28:04 +00:00
} else if ( item . kind === "decision" && item . recommended ) {
2026-11-17 19:09:46 +00:00
grant ( h ( "button" , { type : "button" , class : "btn small primary" , ... named ( revealed ( `Recommendation: ${ item . recommended } ` )), on : { click : () => approveOne ( item )}}, icon ( "bi-check-lg" ), revealed ( item . recommended )));
2026-11-06 08:28:04 +00:00
} else if ( item . kind === "operator" && item . runnable ) {
2026-11-17 19:09:46 +00:00
grant ( iconBtn ( "bi-play-fill" , "Run" , "btn small primary" , () => approveOne ( item )));
2026-11-07 18:14:21 +00:00
} else if ( item . kind === "rule" ) {
2026-11-17 19:09:46 +00:00
grant ( h ( "button" , { type : "button" , class : "btn small primary" , ... named ( "Accept" , "Accept: the passkey signs exactly this rule, then it applies" ), on : { click : () => approveOne ( item )}}, icon ( "bi-shield-check" ), "Accept" ));
2026-11-07 18:14:21 +00:00
}
if ( item . deniable ) {
buttons . push ( denySplit ( item ));
}
if ( item . job && ! jobOpen ( item . job )) {
2026-11-08 17:26:51 +00:00
buttons . push ( iconBtn ( "bi-x-circle" , "Close" , "btn small ghost" , () => dismissJob ( item . job ), "Close: hide the console; a done row disappears with it" ));
2026-11-06 08:28:04 +00:00
}
return buttons ;
}
2026-11-14 10:02:43 +00:00
function inboxHeadline ( item ) {
return h ( "button" , { type : "button" , class : "linkish headline" , title : "Open" , on : { click : () => openItem ( item )}}, revealed ( item . kind === "operator" ? item . id : item . kind === "ask" ? item . title . split ( ": " )[ 0 ] : item . title ));
}
2026-11-06 08:28:04 +00:00
function inboxItem ( item , index ) {
const red = item . kind === "review" && item . gate !== "pass" ;
2026-11-18 19:28:37 +00:00
const commanded = item . kind === "ask" || ( item . kind === "operator" && ! asked ( item ));
2026-11-12 16:13:58 +00:00
const classes = [ "item" , "entry" , `k- ${ item . kind } ` , "waiting" , isGreen ( item ) ? "green" : "" , red ? "red" : "" , item . held ? "held" : "" , index === ui . cursor ? "cursor" : "" ]. filter ( Boolean ). join ( " " );
2026-11-11 08:32:36 +00:00
const box = h ( "input" , { type : "checkbox" , "aria-label" : `Select ${ item . title } ` , checked : ui . selected . has ( keyOf ( item )), disabled : ! pickable ( item ), on : { change : () => toggle ( item , true )}});
2026-11-12 16:13:58 +00:00
return h ( "li" , { class : classes , "data-index" : index , "data-ref" : keyOf ( item ), "data-to" : item . to || null },
2026-11-06 08:28:04 +00:00
box ,
2026-11-12 16:13:58 +00:00
h ( "div" , { class : "msg-meta" },
when ( item . ts ),
2026-11-18 19:28:37 +00:00
asked ( item ) ? pill ( "Decision" , KIND_TONES . decision ) : pill ( ITEM_LABELS [ item . kind ], KIND_TONES [ item . kind ]),
answers . has ( keyOf ( item )) ? pill ( revealed ( `answered: ${ answers . get ( keyOf ( item )) } ` ), "ok" ) : null ,
2026-11-12 16:13:58 +00:00
item . kind === "review" ? pill ( item . gate === "pass" ? "Gate green" : "Gate red" , item . gate === "pass" ? "ok" : "bad" ) : null ,
item . warnings . map (( warning ) => pill ( warning , "bad" )),
item . pinned ? pill ( "pinned" , "violet" ) : null ,
item . until ? pill ( `until ${ absolute . format ( stampOf ( item . until )) } ` , "neutral" ) : null ),
h ( "div" , { class : "entry-body" },
h ( "div" , { class : "route" },
2026-11-14 10:02:43 +00:00
inboxHeadline ( item ),
2026-11-12 16:13:58 +00:00
item . agent ? [ face ( item . agent , false ), person ( item . agent )] : null ),
2026-11-13 18:14:17 +00:00
item . kind === "review" ? h ( "div" , { class : "muted" }, revealed ( item . detail ), item . score ? revealed ( ` · ${ item . score } ` ) : "" ) : null ,
commanded ? h ( "div" , { class : "command" , "data-path" : item . directory || "-" }, h ( "code" , {}, revealed ( item . command )), copyButton ( item . command )) : null ,
commanded ? h ( "span" , { class : "muted" }, revealed ( `in ${ dash ( item . directory ) } ` )) : null ,
2026-11-18 19:28:37 +00:00
asked ( item ) ? h ( "p" , { class : "text question" }, revealed ( item . title )) : null ,
2026-11-13 18:14:17 +00:00
item . kind === "operator" && item . detail && item . detail !== "-" ? h ( "p" , { class : "text reason" }, revealed ( item . detail )) : null ,
2026-11-12 16:13:58 +00:00
diffBlocks ( item ),
2026-11-07 18:14:21 +00:00
item . job ? consoleOf ( item . job ) : null ,
item . kind === "rule" ? ruleRequestBody ( item ) : null ,
2026-11-18 19:28:37 +00:00
choiceOf ( item , () => {}),
2026-11-12 16:13:58 +00:00
feedbackList ( keyOf ( item ))),
h ( "div" , { class : "item-actions line-actions" },
2026-11-06 08:28:04 +00:00
actionsFor ( item ),
h ( "span" , { class : "spacer" }),
2026-11-08 17:26:51 +00:00
iconBtn ( "bi-hourglass-split" , "1 h" , "btn small ghost" , () => mark ( item , nowSeconds () + 3600 , item . pinned ), "1 h: snooze for one hour" ),
iconBtn ( "bi-sunrise" , "tomorrow" , "btn small ghost" , () => mark ( item , tomorrow (), item . pinned ), "tomorrow: snooze until 8 am tomorrow" ),
item . until ? iconBtn ( "bi-alarm" , "wake" , "btn small ghost" , () => mark ( item , 0 , item . pinned ), "wake: show again" ) : null ,
iconBtn ( item . pinned ? "bi-pin-angle-fill" : "bi-pin-angle" , item . pinned ? "unpin" : "pin" , "btn small ghost" , () => mark ( item , item . until , ! item . pinned ))));
2026-11-06 08:28:04 +00:00
}
2026-11-06 22:20:06 +00:00
function inboxScreen () {
2026-11-14 10:02:43 +00:00
inboxDom = h ( "div" , { class : "inbox" , "data-panel" : "tasks/operator" });
inboxSlot = h ( "span" , { "data-star-slot" : "" });
2026-11-06 22:20:06 +00:00
return inboxDom ;
}
2026-11-06 08:28:04 +00:00
function drawInbox () {
2026-11-06 22:20:06 +00:00
if ( ! inboxDom ) {
return ;
}
2026-11-06 08:28:04 +00:00
const items = visibleInbox ();
ui . cursor = Math . min ( ui . cursor , Math . max ( items . length - 1 , 0 ));
const present = new Set ( items . map ( keyOf ));
for ( const key of [... ui . selected ]) {
if ( ! present . has ( key )) {
ui . selected . delete ( key );
}
}
2026-11-17 19:09:46 +00:00
const mode = grantMode ();
2026-11-18 19:28:37 +00:00
const sig = JSON . stringify ([ mode , items . map ( withoutOutput ), [... ui . selected ], [... answers ], ui . cursor , ui . snoozed , ui . busy , Math . floor ( nowSeconds () / 60 ), diffView . version , state . messages . map (( message ) => message . id )]);
2026-11-06 08:28:04 +00:00
if ( sig === inboxSig ) {
2026-11-07 18:14:21 +00:00
repaintConsoles ( items );
2026-11-06 08:28:04 +00:00
return ;
}
inboxSig = sig ;
const hidden = state . inbox . length - waitingCount ();
const snoozed = h ( "input" , { type : "checkbox" , checked : ui . snoozed , on : { change : ( event ) => {
ui . snoozed = event . target . checked ;
drawInbox ();
}}});
2026-11-14 10:02:43 +00:00
Panels . keepFocus ( inboxSlot , () => inboxDom . replaceChildren (
2026-11-12 16:13:58 +00:00
h ( "div" , { class : "inbox-head" }, h ( "h2" , { class : "group-title" }, "Waits on Operator" , counter ( waitingCount ())), h ( "span" , { class : "spacer" }),
2026-11-14 10:02:43 +00:00
hidden ? h ( "label" , { class : "check" }, snoozed , ` ${ hidden } snoozed` ) : null , inboxSlot ),
2026-11-08 17:26:51 +00:00
onLocalhost () ? "" : h ( "p" , { class : "muted" }, "The passkey signs grants only under " , localLink ()),
2026-11-14 10:02:43 +00:00
items . length ? h ( "ol" , { class : "inbox-list" }, items . map ( inboxItem )) : emptyState ( "All done" , "Nothing is waiting for you right now." )));
2026-11-07 18:14:21 +00:00
settleConsoles ( items );
2026-11-06 22:20:06 +00:00
const current = inboxDom . querySelector ( `.item[data-index=" ${ ui . cursor } "]` );
2026-11-06 08:28:04 +00:00
if ( current && document . activeElement === document . body ) {
current . scrollIntoView ({ block : "nearest" });
}
}
function openItem ( item ) {
if ( ! item ) {
return ;
}
if ( item . kind === "review" ) {
reviewSheet ( item . id );
return ;
}
const body = [
h ( "div" , { class : "who" }, pill ( ITEM_LABELS [ item . kind ], KIND_TONES [ item . kind ]), item . agent ? face ( item . agent , false ) : null , item . agent ? person ( item . agent ) : null , when ( item . ts )),
2026-11-13 18:14:17 +00:00
h ( "p" , { class : "text" }, revealed ( item . title )),
2026-11-18 19:28:37 +00:00
item . command && ! asked ( item ) ? h ( "div" , { class : "command" }, h ( "code" , {}, revealed ( item . command )), copyButton ( item . command )) : null ,
asked ( item ) && item . detail && item . detail !== "-" ? h ( "p" , { class : "text reason" }, revealed ( item . detail )) : null ,
2026-11-07 18:14:21 +00:00
item . kind === "rule" ? ruleRequestBody ( item ) : null ,
2026-11-08 17:26:51 +00:00
meta ([[ "Directory" , item . directory ], [ "Warnings" , item . warnings . join ( ", " )], [ "Id" , item . id ]]),
2026-11-18 19:28:37 +00:00
choiceOf ( item , closeSheet ),
2026-11-06 08:28:04 +00:00
h ( "div" , { class : "actions" }, h ( "span" , { class : "spacer" }), actionsFor ( item ). map (( node ) => {
node . addEventListener ( "click" , closeSheet );
return node ;
})),
];
openSheet ( ITEM_LABELS [ item . kind ], body , false );
}