Repository navigation
Conversation
… the message's reload The Connect card read `message` and `error` from the tool result with a plain property access, so an accessor-backed `message` ran and its value named the app. Read them as own data properties, as `isIntegrationAuthenticationActionResult` already does for `integration` and `connectUrl`. Try again now runs the message's reload override first, the same handler as the message's Regenerate action, and falls back to the chat's `onReload`. Tests: the card's states (command, host Connect and Reconnect, Try again, name fallback, overlong name, ref and className, escaped text), unsafe integration ids and project references, malformed results, variant and children overrides, and a sub-agent's tool inside the child-agent card.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of veryfront/veryfront-issue-inbox#4216 (Connect card in the local chat and the UI kit).
Problem
When a tool stops because its app isn't connected, the API answers with a structured result:
{ "error": "authentication_required", "integration": "salesforce", "connectUrl": "https://api.veryfront.com/oauth/connect/salesforce?project_reference=…", "message": "Authentication required for Salesforce." }Studio renders that as a Connect card. The UI kit's
ToolCall(used by<Chat>in every generated app and in the local chat) showed it as a raw JSON result, so the user saw a failed tool and had nothing to click.Change
IntegrationConnectCardin the UI kit, exported fromveryfront/chat: it names the app and says Not connected (or Connection expired forreconnect_required). By default it shows the exact command that connects it:npx veryfront integration connect <app> --project <project from the connect URL>, with a copy button. Try again reruns the turn (the chat'sonReload). A host that can run OAuth itself passesonConnectand gets a Connect button instead of the command.ToolCallrenders that card for a completeauthentication_required/reconnect_requiredresult, the same check the runtime uses (isIntegrationAuthenticationActionResult). This includes a sub-agent's tool inside aninvoke_agentcard. An incomplete result keeps the ordinary card. A customvariantorchildrenstill wins.connectUrl: in a browser it answers 401 without an API key. The--projectvalue comes from that URL only when it's a plain id, and the app name only when it matches^[a-z0-9][a-z0-9_-]*$, so nothing tool-supplied reaches the command unchecked.deno task docs, Deno 2.9.7) and theveryfront/chatexport list updated.Not end to end yet: blocked by the API
In a local run (
veryfront dev, connected to Cloud), the same call doesn't returnauthentication_required. It answersauthorization-denied: "Run context is not authorized for this integration tool", because the run ID is bound for tool authorization. So the local chat can't show this card until veryfront/veryfront-issue-inbox#4486 is fixed in the API. Once it is, the card appears there with no further Code change.Still open in #4216: a one-click Connect in the local chat. The dev server would need to create a one-time connect session with its own key, as
npx veryfront integration connectdoes, and resume the run once connected. That's a follow-up after #4486.Validation
deno task test:file src/react/components/chat/chat/components/tool-ui.test.tsx: 4 new tests (card with command and project; expired connection without a project; incomplete result keeps the ordinary card; Try again callsonReload). Three fail on main and pass here; the incomplete-result test is a guard.deno task test:file src/react/components/chat/: 158 passed.deno task test:file src/chat/: passed after adding the export.deno check src/chat/index.tsand the test file;deno fmtanddeno linton the changed files (Deno 2.9.7).Before: the local chat on the Salesforce template, staging, Salesforce not connected (
veryfront devfrom this branch's base). The sub-agent says Completed and the reply only says access was denied:After: Storybook › Chat/Components/ToolCall › Not connected, rendering the API's real
authentication_requiredresult:Test hardening (
9c359f650)A coverage audit found two defects in
tool-ui.tsxand fixed them.messageanderrorfrom the tool result with plain property access. A tool result with a getter onmessageran it and showed its value as the app name, which breaks the existing "renders hostile tool values" rule. All four fields are now read withreadToolResultOwnDataProperty.onReloadand ignored a reload passed toMessage.Root. It now uses the same handler as that message's Regenerate action and falls back to the chat'sonReload.integration-connect-card.test.tsx(10 tests):--project;onConnectbutton labelled Connect or Reconnect;tool-ui.test.tsx:variantandchildrenoverrides still win;tool-ui.tsxreverted to main, 9 tests fail.deno task test:file src/react/components/chat/ src/chat/gives 259 passed, 0 failed.lint:chat-composability,ban-chat-antipatterns.ts(no ceiling raised),audit-client-bundle.ts,storybook:checkanddocs:api-reference:checkpass. The full pre-push gate passed on Deno 2.9.7. The first attempt failed one unrelated timing test,ssr-module-loader/loader.test.ts, under parallel load; it passes 3/3 alone and on the retry.