Closed general

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

John Lauer · 1mo 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 · 1mo 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 · 5d ago

Done in 1.3.3. The dashboard's Send to AI now matches kicad-bridge #77:

  • say_send posts run-prompt with no type, background: true and tags dock:grok-bridge + app:adom/grok-bridge, so Hydrogen's AI picker asks the user and "remember for this app" is keyed to this app.
  • It polls GET /ai-threads/run-prompt/status?job= for up to 75 s and returns the human line. working / needs_you / done / delivered count as sent. cancelled comes back as cancelled: true and is never retried or re-sent with a named AI. submit_failed tells the user to press Enter in the new tab.
  • The /ai-threads/run-prompt proxy strips any type, adds the app: tag and defaults background: true. A new /ai-threads/run-prompt/status proxy route passes the ?job= query through unchanged.
  • newbie-panel.js is updated to the shared module that polls job status (copied unchanged from kicad-bridge).

Log in to reply.