Repository navigation
feat(studio): X04b bundle, serve and embed the chat widget - #1121
Merged
Merged
Conversation
- vite.widget.config.ts + src/widget/entry.ts build dist/widget/forge-chat.js (one IIFE registering <forge-chat>); build:studio runs it after the SPA build; fallow entry updated. - GET /serve/:id/widget.js serves the bundle publicly (enabled-gated, 404 LOUSHO_WIDGET_MISSING/LOUSHO_NOT_SERVED, 5-min cache). - Per-agent widget key (fwk_…, stored beside the serve token): accepted only on POST /serve/:id/chat from an allowed Origin - other routes 401 LOUSHO_WIDGET_KEY_SCOPE, missing/foreign Origin 403 LOUSHO_WIDGET_ORIGIN; POST/DELETE /agents/:id/serve/widget-key manage it; ServeStatus gains widgetKeyMasked; runtimeClient createWidgetKey/revokeWidgetKey. - ServeCard "Embed on a page" details: create/rotate/revoke, placeholder snippet, Copy with key (raw key in memory only), scope note. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
Summary
vite.widget.config.ts+src/widget/entry.ts→dist/widget/forge-chat.js(10.96 kB IIFE registering<forge-chat>);build:studio= SPA build → widget build → server build;.fallowrc.jsonentry updated.GET /serve/:id/widget.js— public bundle route (enabled-gated;LOUSHO_WIDGET_MISSING/LOUSHO_NOT_SERVED;Cache-Control: public, max-age=300; no CORS headers, no token).fwk_…, stored beside the serve token inServeFile): accepted only onPOST /serve/:id/chatfrom anallowedOriginsorigin — other routes401 LOUSHO_WIDGET_KEY_SCOPE, missing/foreign origin403 LOUSHO_WIDGET_ORIGIN, revoked → 401.POST/DELETE /agents/:id/serve/widget-keymanage it;ServeStatus.widgetKeyMasked;runtimeClient.createWidgetKey/revokeWidgetKey.Create widget key(disabledAdd an allowed origin firstwith empty origins), placeholder snippet (token="YOUR_WIDGET_KEY"),Copy with key(raw key in memory only), Rotate/Revoke, scope note. Serve token never appears.Note: this branch merges
fb-x04a-forge-chat(#1120) — X04b needs both the widget element and the Serve card; the X04a files in the diff are #1120's.Test plan
serveWidget.test.ts3 tests — 200+headers, missing bundle, disabled/bad idserveWidgetKey.test.ts6 tests — create/rotate/revoke, chat+origin 200 SSE+CORS, scope 401s, origin 403s, serve token unaffectedentry.test.ts+ ServeCard embed tests (5 new); widget suite 27 greennpm run build:studiowritesdist/index.html+dist/widget/forge-chat.js+dist-serverStacked on #1119 (contains #1120).
Generated with Devin