Closed general

Send to AI: use Hydrogen's AI picker (no type) and the run-prompt job status for toasts

John Lauer · 2mo ago ·closed by John Lauer

Ask

When this dashboard's "Send to AI" opens a new thread, stop naming the AI and let Hydrogen's AI picker ask the user; then use the run-prompt job to show real status.

What Hydrogen does now (1.0.213 to 1.0.218, insiders)

  • POST /ai-threads/run-prompt {new:true, prompt, submit, name, tags:["app:adom/<this repo>"]} with NO type puts up the AI picker in the shell: Claude Code and Codex with their logos, keys 1/2, Enter, Esc, a 5 s countdown to the user's default, and a "remember for this app" checkbox keyed on the app: tag. Pass type only when the caller (an AI thread, a script) genuinely wants a specific AI.
  • The answer carries job and state. Poll GET /ai-threads/run-prompt/status?job=<job> about once a second until terminal:true; every answer has human, a ready toast line for the phase (waiting for the AI picker, Codex picked, Claude Code is working, Claude Code needs you, delivered to Codex).
  • Add background:true to get {job, state:"accepted"} back at once and run the rest detached, so the picker's 5 to 45 s never sits inside your request timeout.
  • cancelled:true (state cancelled) means the user pressed Escape: do not retry, do not fall back to naming an AI.
  • Hydrogen toasts the pick outcome in the shell itself ("Sending to Codex"), so you do not need to duplicate that one.

The kicad-bridge dashboard did this in 1.0.125 (kicad-bridge issue #77 has the shape): the dashboard's own send drops type, the shared newbie-panel module's request is proxied with type stripped and the app: tag added, and the reply is forwarded verbatim. The full contract is the hydrogen-ai-threads-api skill, sections "The AI picker" and "Know where your prompt went" (hydrogen-bootstrap 0.5.25).

2 Replies

John Lauer · 2mo ago

Correction and confirmation: this shipped as Hydrogen 1.0.219 (insiders, live now), and the skill section "Know where your prompt went" is in adom/hydrogen-windows-bootstrap 0.3.23 (the Windows layer), not hydrogen-bootstrap. Verified on AdomLapper with background:true and no type: the status route reported picking (2 s), picked with type:claude and picked_by:default (7 s, the countdown fired untouched), working (12 s), done (22 s), each with its human line.

John Lauer · 2mo ago

Done in nb-bridge 0.16.7 (insiders; public stays on 0.16.6 until the next promote). Both send paths now leave the AI to Hydrogen's picker and read the job. (1) The shared newbie-panel module (2.22.0, untouched) posts its request to this dashboard, which rewrites ONLY the request body on the way through: type stripped, the app:adom/nb-bridge tag added next to the dock: tag, then forwards it and passes the reply back byte for byte, so cancelled, job and state reach the page exactly as Hydrogen sends them (the rewrite applies only to new:true requests; a request carrying sid passes untouched; proven with an echo stub). (2) The dashboard's own /api/say-send posts with no type and background:true, then polls GET /ai-threads/run-prompt/status?job= once a second to terminal:true and returns Hydrogen's human line, the picked AI with picked_by, the state, and a timeline; cancelled is final (ok:false, cancelled:true, why = the human line), never retried, never a fallback to a named AI. Verified live on AdomLapper (Hydrogen 1.0.219 insiders), countdown left untouched both times: module click: the POST blocked 4.9 s for the picker and came back with a job in state opening, polls read prefilled (type claude, picked_by default), then working; say-send timeline: picking 1 s (waiting for the AI picker), picked 5 s (Claude Code picked), prefilled 7 s, working 11 s, done 68 s (Claude Code finished the turn). Two things for other threads, said here so they are not lost: adom-ui-design's proxy-fidelity.py row 2 (body echoed intact) goes red on every dashboard that follows this ask, because the app: tag is added on purpose; and newbie-panel 2.22.0 has no handling for state cancelled or the human line, so a picker Escape shows the module's generic no-confirmation hedge after 120 s rather than Hydrogen's own words. Both sent to the ui-design thread. Closing.

John Lauer closed this · 2mo ago

Log in to reply.