feat: base44.superagent namespace (superagent-for-apps PoC)#229
Open
cowchimp wants to merge 1 commit into
Open
feat: base44.superagent namespace (superagent-for-apps PoC)#229cowchimp wants to merge 1 commit into
cowchimp wants to merge 1 commit into
Conversation
… chat Adds base44.superagent.forApp(superagentAppId), returning a per-app cached handle that talks to the sibling superagent app's agents routes with a dedicated anonymous axios client (X-App-Id set to the superagent app, no Authorization token, so the anonymous-visitor-id interceptor fires) and a dedicated anonymous socket (handshake carries app_id + anonymous_id, never a token). Conversation creation always uses the fixed agent name your_agent. Also adds an explicit anonymous flag to RoomsSocketConfig so a socket can opt out of the stored-access-token fallback.
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.38-pr.229.6a453f4Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.38-pr.229.6a453f4"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.38-pr.229.6a453f4"
}
}
Preview published to npm registry — try new features instantly! |
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.
What
New
base44.superagentSDK namespace — a thin client for chatting with a published public Superagent linked to a Base44 app (demo/PoC; pairs with the apper branchsuperagent-for-apps-poc, stacked on apper#14972).How
src/modules/superagent.ts+superagent.types.ts, modeled on theagentsmodule;agent_nameis alwaysyour_agent; same runtime routes (/apps/{superagentAppId}/agents/...), v2 messages endpoint.forApp(appId)handle gets its own axios client (X-App-Id: <superagentAppId>, no Authorization → theX-Base44-Anonymous-Idinterceptor fires) and its own socket (app_id=<superagentAppId>,anonymous_idhandshake, no token). The host app's token never reaches the superagent app — covered by a dedicated test.socket-utils: new opt-inanonymousflag so the handshake skips both the config token and thegetAccessToken()localStorage fallback; existing callers unaffected.Why
The public Superagent runtime (apper#14972) serves anonymous visitors; a host app's generated chat widget needs a first-class SDK surface to talk to its linked superagent without cross-app token juggling.
Testing
npm test: 188/188 (incl. 7 new superagent tests: path construction, your_agent on create, v2 addMessage, no-Authorization isolation)npm run lint+npm run build: cleanPoC note: intended for a deploy-preview package to feed the apper staging env; not for immediate merge.