Repository navigation
feat(platform)!: getSession with the socket path from the session, and asyncapi.json from production - #313
Merged
Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.53-pr.313.7fe73f7Prefer 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.313.7fe73f7"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.53-pr.313.7fe73f7"
}
}
Preview published to npm registry — try new features instantly! |
amitbardos
force-pushed
the
amitb/platform-asyncapi-sync
branch
from
October 11, 2026 12:41
bb9a3d5 to
10d8bae
Compare
amitbardos
force-pushed
the
amitb/platform-asyncapi-sync
branch
2 times, most recently
from
October 12, 2026 14:16
43c68a6 to
ffc290a
Compare
amitbardos
force-pushed
the
amitb/platform-event-codegen
branch
from
October 12, 2026 14:19
7e08ce4 to
419e113
Compare
amitbardos
force-pushed
the
amitb/platform-asyncapi-sync
branch
from
October 12, 2026 14:19
ffc290a to
c6d7478
Compare
amitbardos
marked this pull request as ready for review
October 13, 2026 07:20
asyncapi.json is the document production serves now that base44-dev/apper#29607 has deployed, and gen:events regenerated the types: TaskProgressed.event_type is the five task values, and current/total are integers. sync-asyncapi.mjs documents production as its default source, and PlatformSnapshot's JSDoc links to app.snapshot on Socket messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ough builder.init() takes getSession, which returns the Create socket session body unchanged. The socket opens at the session's socket_url and socket_path on the first connect(), and moves when a renewed session has a different address. createPlatformClient() takes no options; socketUrl, getSessionToken and PlatformClientOptions are gone. An invalid session rejects connect() with session_unavailable. SocketSession is listed with PlatformSnapshot under the builder page's Type Definitions. Version 0.2.0, with a CHANGELOG.md written against what 0.1.0 shipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
amitbardos
force-pushed
the
amitb/platform-asyncapi-sync
branch
from
October 13, 2026 12:06
95678d9 to
99cb9ca
Compare
🚀 Package Preview Available! (
|
An hourly workflow (and workflow_dispatch) compares https://app.base44.com/api/asyncapi.json with the committed copy first, so a run with nothing new stops before installing anything. When they differ it regenerates the event types, builds the docs, runs the Platform SDK tests and opens or updates one rolling PR on bot/platform-asyncapi-sync. It closes that PR when main already matches production. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
amitbardos
force-pushed
the
amitb/platform-asyncapi-sync
branch
from
October 13, 2026 12:11
99cb9ca to
5bea8e5
Compare
A new backend event now reaches partners when the service deploys it, as
{ type: "unknown", name, appId, data }, instead of being dropped until they
upgrade. Session events and room.* notices are still not forwarded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ozsay
reviewed
Oct 14, 2026
The catch-all sent every unknown event to the app-event path, which treats a frame with no app room as unroutable and fails every subscription with protocol_error. A future session-wide event (null room, like session.ended) would have ended all live subscriptions on 0.2.0. Now an unknown event is forwarded only when its room names an app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nges Both change checks compare against main, so while a sync PR waited every hourly run made a new commit with the same files and force-pushed it. The job now compares the new commit's tree with the open sync branch's and stops when they match. A moved main still changes the tree, so the branch is rebuilt then, and a closed PR still gets a new one on the next run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ozsay
approved these changes
Oct 14, 2026
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.
Based on
mainnow that #312 is merged.Four commits. #317 and #318 are folded in here and closed; #329 is folded in too. The Socket messages page is no longer generated in this repo: mintlify-docs builds it from the AsyncAPI document production serves (base44-dev/mintlify-docs#2479), and the JSDoc links to it at
/developers/references/apps-api/sections/socket-messages.1.
asyncapi.jsonfrom production (2316986)The committed document is the one production serves now that base44-dev/apper#29607 has deployed (identical to
https://app.base44.com/api/asyncapi.json), andgen:eventsregenerated the types.TaskProgressed.event_typeis now the five task values, andcurrent/totalare integers.2.
getSessionand the socket path from the session (686327c, breaking, 0.2.0)The browser passes one function instead of
socketUrlandgetSessionToken, and the socket path comes from the session instead of the hard-coded/ws/socket.io/.builder.init({ getSession, onError }):getSession: () => Promise<SocketSession>, whereSocketSessionis{ session_token, socket_url, socket_path }. Other keys (session_id,expires_in) are ignored.getSessionis called everywheregetSessionTokenwas called before: the first connect, renewal aftersession.endedwith reasonexpired, and the single renewal after aconnection_deniedon a cached token. The 20-second timeout and the cancellation inauthenticate()are unchanged.connect(), because the address is known only after the first session. Transport reconnects keep using the cached session.socket_urlorsocket_path, the SDK doesn't call the old socket's auth callback. It removes the old socket's listeners, disconnects it, opens a socket at the new address, and rejoins every active subscription.socket_urlmust be an HTTP(S) origin with no credentials, path, query or fragment (the same check as before).socket_pathmust be an absolute path with no query or fragment, and can't start with//.createPlatformClient()takes no arguments. No options are left. TypeScript callers that still pass{ socketUrl, getSessionToken }get a compile error instead of having the values silently ignored. An optional parameter can be added later without a breaking change.PlatformClientOptionsis removed.session_unavailable, whether the token, the URL or the path is invalid.connect()rejects with it andonErrorreceives it. NoTypeErroris thrown. The code already meant that the session endpoint gave the SDK nothing usable.CHANGELOG.mdwritten against what 0.1.0 shipped (Base44PlatformClient,serverUrl), including the type renames from feat(platform): generate event types from AsyncAPI, and Mintlify docs for @base44/platform #312. JSDoc, examples,README.md, unit, type and package tests are updated.SocketSessionis listed on the builder reference page.3. Hourly AsyncAPI sync (
5bea8e5).github/workflows/sync-asyncapi.ymlruns every hour, like mintlify-docs' OpenAPI syncs, and onworkflow_dispatch. It first compares production's document with the committed one, so an hour with nothing new stops beforenpm ci. Otherwise it runssync:asyncapiandgen:events. Ifasyncapi.jsonor the generated types changed, it builds the docs, runs the Platform SDK tests and opens or updates one rolling PR onbot/platform-asyncapi-sync, rebuilt frommainon every run. When an open sync PR already has the same tree, it skips the commit and force-push, so a waiting PR isn't pushed every hour. When nothing changed, it closes a leftover sync PR. It uses the pinnedactions/checkoutandactions/setup-node, the Wix gateway proxy and the runner'sgh, and adds no dependencies. Production already serves a document identical to the committed one, so a run today finds no diff. After merging, trigger it once by hand.4. Forward events the SDK doesn't know (
04e627a, changes Oz's event filtering)Before, the session registered a handler only for the generated event names, so a new backend event was dropped until a partner upgraded. Now known app events keep their own handlers, and
socket.onAnyforwards any other name toonEventas{ type: "unknown"; name: string; appId: string; data: Record<string, unknown> }. Session events (app.snapshot,session.ended) androom.*notices are still not forwarded; a new notice has no error code, so it's dropped. Envelope validation, per-app routing,protocol_errorand the rejoin after a mainconversation.changedare unchanged.discard()also callsoffAny().The type is
"unknown", not anOtherToolCall-styletype: string. In TypeScript 5.9 astring & {}member stopsevent.type === "message.updated"from narrowing at all, and plainstringnarrows to that event plus the catch-all, soevent.data.messagebecomesunknown. Either one breaks existing partner code. Backend event names always contain a dot, so"unknown"can't clash with a real one. Aswitchcovering every type now needscase "unknown"; it's in the CHANGELOG.New tests: an unknown event reaches only its app, known/session/
room.*names aren't delivered twice, a malformed unknown frame fails only its app,close()callsoffAny, an unknown event'sdataneeds a check before use, and known types still narrow.Tests
PATH=/opt/homebrew/bin:$PATH npm testinpackages/platform:npm run check:eventsreportsbuilder.events.generated.ts is up to date.npm run create-docs, run after the tests, completes.npm run lintis clean.New unit tests cover: the path taken from the session, extra keys in the body ignored, renewal at a new address moving the socket and rejoining both subscriptions, a failed renewal, a late session after
close(), and 11 invalid bodies.Needs attention
Oz's agreement on commit 4. It changes the original event filtering @ozsay wrote.
Publishing 0.2.0.
package.jsonis already at 0.2.0, somanual-publish.ymlwithversion: 0.2.0fails ("Version not changed"), and withminorit would publish 0.3.0. Either add--allow-same-versionto the workflow, or setpackage.jsonback to 0.1.0 and publish withminor.One release. feat(platform): generate event types from AsyncAPI, and Mintlify docs for @base44/platform #312 is on
mainand breaking without a version bump. Don't publish frommainuntil this PR merges; then publish both as 0.2.0.🤖 Generated with Claude Code