(onDone, context, args)
| 409 | } |
| 410 | } |
| 411 | const call: LocalJSXCommandCall = async (onDone, context, args) => { |
| 412 | const blurb = args.trim(); |
| 413 | |
| 414 | // Bare /ultraplan (no args, no seed plan) just shows usage — no dialog. |
| 415 | if (!blurb) { |
| 416 | const msg = await launchUltraplan({ |
| 417 | blurb, |
| 418 | getAppState: context.getAppState, |
| 419 | setAppState: context.setAppState, |
| 420 | signal: context.abortController.signal |
| 421 | }); |
| 422 | onDone(msg, { |
| 423 | display: 'system' |
| 424 | }); |
| 425 | return null; |
| 426 | } |
| 427 | |
| 428 | // Guard matches launchUltraplan's own check — showing the dialog when a |
| 429 | // session is already active or launching would waste the user's click and set |
| 430 | // hasSeenUltraplanTerms before the launch fails. |
| 431 | const { |
| 432 | ultraplanSessionUrl: active, |
| 433 | ultraplanLaunching |
| 434 | } = context.getAppState(); |
| 435 | if (active || ultraplanLaunching) { |
| 436 | logEvent('tengu_ultraplan_create_failed', { |
| 437 | reason: (active ? 'already_polling' : 'already_launching') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 438 | }); |
| 439 | onDone(buildAlreadyActiveMessage(active), { |
| 440 | display: 'system' |
| 441 | }); |
| 442 | return null; |
| 443 | } |
| 444 | |
| 445 | // Mount the pre-launch dialog via focusedInputDialog (bottom region, like |
| 446 | // permission dialogs) rather than returning JSX (transcript area, anchors |
| 447 | // at top of scrollback). REPL.tsx handles launch/clear/cancel on choice. |
| 448 | context.setAppState(prev => ({ |
| 449 | ...prev, |
| 450 | ultraplanLaunchPending: { |
| 451 | blurb |
| 452 | } |
| 453 | })); |
| 454 | // 'skip' suppresses the (no content) echo — the dialog's choice handler |
| 455 | // adds the real /ultraplan echo + launch confirmation. |
| 456 | onDone(undefined, { |
| 457 | display: 'skip' |
| 458 | }); |
| 459 | return null; |
| 460 | }; |
| 461 | export default { |
| 462 | type: 'local-jsx', |
| 463 | name: 'ultraplan', |
nothing calls this directly
no test coverage detected