feat(core): demonstrate aube C ABI (bun:ffi) installer behind Npm.Service#37305
Closed
jdx wants to merge 1 commit into
Closed
feat(core): demonstrate aube C ABI (bun:ffi) installer behind Npm.Service#37305jdx wants to merge 1 commit into
jdx wants to merge 1 commit into
Conversation
…vice Companion demo to the @jdxcode/aube-node PR: same Npm.Service swap implemented over @jdxcode/aube-ffi via bun:ffi. aube_wait blocks its calling thread, so each operation runs in a Bun Worker that posts the handle back for main-thread aube_cancel. Raw package specifiers pass straight to aube_add. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Related PR Found:
Why it's related: PR #37300 is the Node-API variant companion mentioned in the description of #37305. Both PRs demonstrate alternative |
Author
|
Closing — the aube adoption will land as a single PR (#37300); this C ABI comparison is no longer needed. This comment was generated by an AI coding assistant. |
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.
Issue for this PR
References #37301 (demonstration companion to the Node-API variant; not intended to land alongside it)
Type of change
What does this PR do?
Demonstrates the C ABI / bun:ffi flavor of the same
Npm.Serviceswap proposed in #37301:packages/core/src/npm.tsbacked by@jdxcode/aube-ffiinstead of@npmcli/arborist. This exists so both aube embedding surfaces can be compared side by side against the Node-API PR; the Node-API variant is the one I'd recommend landing.How it works:
aube_waitblocks the thread that calls it, so each operation runs in a BunWorker(packages/core/src/aube-ffi/worker.ts) that dlopens the library, startsaube_install/aube_add, posts the operation handle back, then blocks inaube_waitand posts the JSON result. The client (aube-ffi/client.ts) maps the Effect scope'sAbortSignalto a main-threadaube_cancelon that handle, so the event loop is never blocked and cancellation works. Offline-first policy is identical to the Node-API PR.Notable differences vs the Node-API variant, from actually building both:
aube_addtakes an array of spec strings, so git/tarball/alias specs need no name/version splitting (the Node-API input is{name, version}pairs)..npmrcomit=dev|optional→ dependency-selection mapping that the Node-API addon does internally had to be reimplemented here, and the blocking-wait/worker/cancel choreography is ~150 lines that@jdxcode/aube-nodesimply doesn't need.bun:ffidoesn't exist under Node, so this variant can't back the node build. Progress-event callbacks are also off the table (aube's docs point Bun hosts to Node-API for JS callbacks).bunPluginfor embedding one platform addon per compiled target; doing the same for the FFI dylib would need hand-rolled embed/extract wiring, which I deliberately left out of a demo.How did you verify your code works?
packages/coresuite as the Node-API PR: 31/31 pass, including.npmrcomit=devandfile:spec cases (which exercise the raw-spec pass-through)tscclean forpackages/core;oxlint0 errors;prettiercleanwhich("prettier")andadd("@ai-sdk/openai@latest")resolve; repeated no-op installs are ~6.6 ms in-process (worker spawn dominates; the offline state check itself is sub-millisecond)Screenshots / recordings
Not a UI change.
Checklist
Written by an AI coding assistant (Claude Code), directed and reviewed by @jdx.