Commit f26e431
feat: redesign Ask as global pill with agent-driven UI actions (#304)
* docs: add ask-mode integration design spec
Designs the Explore Ask feature redesign as a global floating pill with
agent-driven UI actions, dynamic suggestions, and a shared
common/agent_tools registry for the NLQ engine and MCP server.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: add ask-mode integration implementation plan
31 TDD tasks across 10 phases implementing the approved spec: shared
agent_tools registry, NLQ engine action contract, suggestions endpoint,
MCP server refactor, floating pill component with suggestions and action
applier, DOMPurify markdown renderer, summary strip, and E2E coverage.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat(common): scaffold agent_tools package
* feat(common): add agent_tools.graph.find_path
* test(common): add find_path target-missing and no-path error cases
* feat(common): add entity detail tools to agent_tools
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(common): add discovery and stats tools to agent_tools
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(api/nlq): delegate _handle_find_path to common.agent_tools
Replace the inline name-resolution + find_shortest_path logic in
NLQToolRunner._handle_find_path with a call to the shared
common.agent_tools.find_path, injecting a resolve_name closure that
wraps EXPLORE_DISPATCH (handles numeric pass-through, missing type
pass-through, and named lookups).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(api/nlq): delegate remaining _handle_* methods to common.agent_tools
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(api/nlq): add Action discriminated-union schema
Defines 10 Pydantic action types with a `type` literal discriminator for strict
JSON parsing. parse_action_list drops malformed entries with a warning log.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(api/nlq): NLQResult carries agent-emitted UI actions
Add actions: list[Action] field to NLQResult, an _extract_actions()
helper that strips the <!--actions:[...]--> marker from agent text,
and extend the system prompt so Claude knows to emit the marker.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(api/routers/nlq): emit actions SSE event before result
Add an `actions` SSE event between status events and the final `result`
event in `_stream_response`, and include `actions` in the non-SSE JSON
response branch for consistency.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(api/nlq): template-based suggestion engine
* feat(api/routers/nlq): add /api/nlq/suggestions endpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(mcp-server): route find_path through common.agent_tools
Delegates mcp_server.find_path to common.agent_tools.find_path via
API-backed resolver closures (_api_get for name resolution, /api/path
for path traversal), so future shared tool additions automatically
benefit MCP clients without changes to server.py.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): scaffold NlqPill component with collapsed state
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): NlqPill expand/collapse with keyboard shortcuts
Add click-to-expand, ⌘K/Ctrl+K, ? (when no input focused), Esc-to-collapse,
and expanded-state render with focused input to NlqPill. Install
@testing-library/dom for fireEvent in tests.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): NlqSuggestions chip renderer and history store
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): NlqPill wires suggestions into expanded card
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): NlqActionApplier with ordering, sanitization, and undo
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): nlq-handlers bridge to graph/insights/trends
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore/graph): snapshot/restore/clearAll/addEntity for NLQ actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): DOMPurify-backed NLQ markdown renderer with entity injection
Adds nlq-markdown.js — a security-hardened markdown renderer that uses
DOMPurify RETURN_DOM_FRAGMENT (never innerHTML) and injects entity anchor
elements via createElement/textContent. Anchor tags from markdown source
are stripped by the ALLOWED_TAGS allowlist.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): NlqSummaryStrip with undo and dismiss
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): rewrite nlq.js as thin orchestrator over new components
Add fetchNlqSuggestions to ApiClient and replace the monolithic NLQPanel
class with a thin initNlq coordinator that delegates to NlqPill,
NlqSuggestions, NlqActionApplier, NlqSummaryStrip, and nlq-handlers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore(explore): remove legacy navbar NLQ toggle and panel
Remove the searchAskToggle/nlqPanel/nlqExamples navbar markup, the
initNlqPanel IIFE from app.js, and all test code that depended on the
old NLQPanel class. Add a guardrail test to prevent reintroduction.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(explore): wire initNlq into app startup and add strip mount point
Adds nlqStripMount div to index.html, calls window.NlqInit from app.js
DOMContentLoaded handler after exploreApp is set, and adds a static
assertion guardrail test.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(explore): load nlq.js as ES module to support imports
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* style(explore): NLQ pill, expanded card, and summary strip CSS
* test(e2e): Ask pill expand-and-submit end-to-end
* test(e2e): Ask cross-pane switch to insights
* test(explore): improve coverage for NLQ frontend modules
Add targeted tests covering initNlq orchestration, action applier
sanitizers, handler delegates, pill Enter-key submit, suggestions
non-array history reset, and graph addEntity app-delegate branch.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(api/nlq): improve coverage for actions, engine, routers, suggestions
Add targeted tests for previously uncovered branches: _extract_actions
invalid-JSON warning path, whitespace-only suggestion focus fallback,
explore-entity unknown-type guards, resolve_name None-return path,
suggestions cache hit/read-failure/write-failure, and jwt_secret=None
early-return. Add pragma: no cover to TYPE_CHECKING block and
unreachable non-list guard in _extract_actions.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 48f8172 commit f26e431
59 files changed
Lines changed: 7906 additions & 1347 deletions
File tree
- api
- nlq
- routers
- common/agent_tools
- docs/superpowers
- plans
- specs
- explore
- __tests__
- static
- css
- js
- mcp-server/mcp_server
- tests
- api
- nlq
- common
- e2e
- mcp-server
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
52 | 68 | | |
53 | 69 | | |
54 | 70 | | |
| |||
80 | 96 | | |
81 | 97 | | |
82 | 98 | | |
| 99 | + | |
83 | 100 | | |
84 | 101 | | |
85 | 102 | | |
| |||
162 | 179 | | |
163 | 180 | | |
164 | 181 | | |
165 | | - | |
166 | | - | |
167 | 182 | | |
168 | | - | |
169 | | - | |
| 183 | + | |
170 | 184 | | |
171 | 185 | | |
172 | 186 | | |
173 | 187 | | |
174 | 188 | | |
175 | 189 | | |
176 | 190 | | |
177 | | - | |
178 | | - | |
179 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
180 | 198 | | |
181 | 199 | | |
182 | | - | |
| 200 | + | |
183 | 201 | | |
184 | | - | |
| 202 | + | |
185 | 203 | | |
186 | 204 | | |
187 | 205 | | |
| |||
215 | 233 | | |
216 | 234 | | |
217 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
218 | 263 | | |
219 | 264 | | |
220 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
0 commit comments