Repository navigation
feat(platform): @base44/platform/react, option A: the hook only - #315
Draft
amitbardos wants to merge 4 commits into
Draft
amitbardos wants to merge 4 commits into
amitbardos wants to merge 4 commits into
Conversation
…der chat One React hook, useBase44Chat, on a new subpath of the platform package. It opens the live session through the client, turns messages into items made for rendering, and binds every question the builder asks to the actions that answer it, typed per kind, so a component can only answer the question it renders. It renders nothing. React is an optional peer, loaded only by the /react entry; the root entry stays framework-free. The four Base44 calls come from a server object the partner implements, so no credential reaches the browser. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The lockfile entries for react, react-dom, their types and jsdom pointed at an internal registry mirror that CI cannot reach, so `npm ci` failed in every job. Same versions, resolved from registry.npmjs.org like the rest of the lockfile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.53-pr.315.6bdf6dbPrefer 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.53-pr.315.6bdf6db"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.53-pr.315.6bdf6db"
}
}
Preview published to npm registry — try new features instantly! |
Next.js App Router treats a module without the directive as a server module, so rendering the provider (or calling the hook) from a server component fails. The modules that use hooks or context now carry it, and the tarball test checks the compiled output keeps it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ned example examples/react-chat/ replaces the single-file example: the chat (Chat.tsx), its parts (chatParts.tsx) and the four server functions (server.ts), with a README saying what to read first. It imports @base44/platform/react from the workspace, so it needs no copy of the package, and the type tests check it, JSX included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
amitbardos
force-pushed
the
amitb/platform-react-hook-only
branch
from
October 10, 2026 18:00
51bc094 to
17c2d1a
Compare
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.
Start here:
examples/react-chat/is Tiny Sunny's chat rebuilt on this option:Chat.tsxis the chat,chatParts.tsxits look,server.tsthe four backend calls. It imports the package from the workspace, so the diff there is only new files.What
A new subpath of the platform package,
@base44/platform/react, with one hook:useBase44Chat. It runs a white-label builder chat for one app on top of the existing client and renders nothing. The partner draws everything.chat.itemsis the conversation, oldest first:role,text,steps(one per tool call) and, while the builder waits, aquestion.kind(choice,input,approval,unknown) and carries only the actions its kind allows, each bound to its own tool call. A component can only answer the question it renders, also when several are open.server: four calls the partner implements, in any language behind them (createApp,openLiveSession,sendMessage,submitToolCallInput). No credential reaches the browser.phaseanderrorinstead of pre-worded status text;canSendis false while a question is open, because Base44 drops a message sent into a stopped turn.error; a question whose reply failed opens again.Packaging
exports["./react"]plustypesVersionsfor node10 resolution.reactis an optional peer; the root entry does not import it. The tarball test asserts it is never a dependency.Where it comes from
The engine of the headless chat library prototyped in base44/base44-platform-starter#64 (Tiny Sunny), after Ronny's review there: bound question actions,
send/createsplit,{ phase, error }, explicit public types,serverbehind a ref.Tests
tests/unit/react/chat-items.test.ts: the message-to-items mapping, without React.tests/unit/react/useBase44Chat.test.ts: the hook under jsdom with a recorded platform client.tests/types/react.types.tsandexamples/react-chat/: compile against the subpath, JSX included.tests/package.test.mjs: the published/reactentry resolves at runtime and under NodeNext, Bundler and Node resolution.🤖 Generated with Claude Code