Skip to content

feat(ag-ui): context-aware welcome suggestions (App mode leads with itinerary prompts)#746

Open
blove wants to merge 2 commits into
mainfrom
blove/ag-ui-context-suggestions
Open

feat(ag-ui): context-aware welcome suggestions (App mode leads with itinerary prompts)#746
blove wants to merge 2 commits into
mainfrom
blove/ag-ui-context-suggestions

Conversation

@blove

@blove blove commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Salvaged from the closed #738 (its uncommitted/committed WIP) onto a fresh branch off main.

The welcome-state suggestions now reorder by context: each prompt is tagged kind: 'capability' | 'itinerary', and suggestionsForAppMode(appModeOn) leads with the itinerary prompts (featured + first in "More prompts") when the map cockpit is on, and with the broad transport-capability prompts in plain chat.

  • welcome-suggestions.tskind tagging + suggestionsForAppMode() split (CAPABILITY vs ITINERARY).
  • welcome-suggestions.component.tsappModeOn input; featured chip + More-prompts derive from suggestionsForAppMode.
  • embed / popup / sidebar modes bind [appModeOn]="shell.appMode() === 'on'" (the sidebar wiring is added here — the salvaged commit only covered embed/popup, but on main the sidebar renders welcome-suggestions and is where App mode actually lives).

Verified: lint 0 errors, unit ✓, build ✓, ag-ui e2e 28/28, and live in Chrome — embed (App off) features "Search docs and cite sources" (capability); sidebar App-on features "Read my itinerary" (itinerary).

🤖 Generated with Claude Code

blove and others added 2 commits July 5, 2026 21:58
…tinerary prompts)

Tag each welcome prompt as capability vs itinerary and pick the featured
prompt + "More prompts" order from the current context via
suggestionsForAppMode(appModeOn):

- App mode ON (map cockpit on screen): feature "Read my itinerary"; the
  remaining itinerary prompts lead the dropdown, capability prompts trail.
- App mode OFF (plain chat): feature "Search docs and cite sources";
  capability prompts lead, itinerary prompts trail.

Each mode passes [appModeOn]="shell.appMode() === 'on'" so the surface
reorders live when the toggle flips. Copy unchanged — only selection and
order — so no e2e assertions move.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
79dbc21 added the [appModeOn] binding to embed/popup only; main's sidebar
also renders <welcome-suggestions>, so wire it there too (context-aware
ordering must work in sidebar mode, where App mode actually lives).
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jul 6, 2026 5:04am

Request Review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 2m 44s —— View job


PR Review

  • Gather context (read diff, changed files)
  • Review welcome-suggestions.ts — kind tagging + suggestionsForAppMode
  • Review welcome-suggestions.component.ts — appModeOn input + signal wiring
  • Review mode bindings (embed/popup/sidebar)
  • Check for correctness bugs, type-safety, Angular pitfalls
  • Post findings

Summary

The implementation is clean. The kind tagging + suggestionsForAppMode() split is a clear model, the signal chain (input → computed → template) is correct for OnPush, and all three mode templates bind appModeOn consistently. No correctness bugs, security issues, or Angular pitfalls found.

Three minor items worth noting:


Stale JSDoc in WelcomeSuggestionsComponent

welcome-suggestions.component.ts lines 13–14: the class docstring still says "The featured chip is FEATURED_SUGGESTIONS[0] — consumer controls which prompt is featured by ordering the array." That's no longer true — the featured chip now comes from suggestionsForAppMode(appModeOn()). Since line 14 is outside the diff hunks I can't attach an inline comment there; mentioning it here instead. Suggested replacement:

 * else. The featured chip and "More prompts" order are driven by
 * `suggestionsForAppMode(appModeOn)` — itinerary prompts lead when App
 * mode is on, capability prompts lead in plain chat.

Back-compat content (positive)

FEATURED_SUGGESTIONS and MORE_SUGGESTIONS preserve the same items in the same order as before — no breakage for the one in-tree consumer that was already migrated away in this PR. The two inline comments above flag the WELCOME_SUGGESTIONS order shift and the theoretical empty-array risk in suggestionsForAppMode.


No new tests for suggestionsForAppMode

The function is pure and the two branches are easy to exercise. Given it's an example app the bar is lower, but a small spec file would lock in the expected ordering behaviour and prevent accidental regressions if the arrays are ever reordered.


Overall: good to go. The two inline comments above are low-severity notes, not blockers. Fix the stale docstring →

...ITINERARY_SUGGESTIONS,
...CAPABILITY_SUGGESTIONS.slice(3),
];
export const WELCOME_SUGGESTIONS: readonly WelcomeSuggestion[] = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WELCOME_SUGGESTIONS silently changed order: previously [...FEATURED_SUGGESTIONS, ...MORE_SUGGESTIONS] put "Delegate to a research subagent" last; now [...CAPABILITY_SUGGESTIONS, ...ITINERARY_SUGGESTIONS] promotes it to 4th (after the other capability prompts, before the itinerary ones). The comment says there are no in-tree consumers today, so this is low-risk — just worth noting if anyone has an external dependency on this export's ordering.

readonly more: readonly WelcomeSuggestion[];
} {
if (appModeOn) {
const [featured, ...restItinerary] = ITINERARY_SUGGESTIONS;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If ITINERARY_SUGGESTIONS is ever empty, featured will be undefined and the template will throw. The arrays are module-level constants so this can't happen today, but an explicit guard or a compile-time assertion (ITINERARY_SUGGESTIONS.length > 0 as true) would make the invariant explicit.

This is a very low-risk theoretical concern given the fixed constants — mentioning it only because the pattern is easy to break later if someone removes a suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant