Repository navigation
Conversation
|
Hi! I'm the It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃 |
|
Dependency limit exceeded — report not shown. This pull request scan exceeded the 10,000-dependency limit applied to this scan, so the results are incomplete and may be inaccurate. To avoid reporting false positives, Socket has not posted a report. Upgrade your plan to raise the dependency limit and get complete reports, or view the partial scan in the dashboard. Socket is always free for open source. If this is a public open source project under an OSI-approved license, contact us to request a free Business plan upgrade. |
…d stream When NSOLID_GRPC or NSOLID_SAAS is set, the main thread starts one hidden thread, NSolidAgent, with a VirtualMachine of its own (modelled on the inspector's Debugger thread). It runs internal/nsolid/agent, which: - resolves the endpoint: NSOLID_GRPC (a bare port means localhost), or a SaaS token parsed the way N|Solid's parse_saas_token does (production, staging, and testing tokens that name their own endpoint); - opens the grpcagent.NSolidService/Command stream over node:http2 with the nsolid-agent-id, nsolid-version and, for SaaS, nsolid-saas metadata; - answers every CommandRequest with an empty CommandResponse, which the Console uses to tell a live agent from a dead one; - reconnects with jittered exponential backoff (1 s to 30 s). TLS is the default; plaintext needs NSOLID_GRPC_INSECURE, and a SaaS token only allows it in testing mode. The agent id is 40 random hex digits, one per process, kept in Rust so the public nsolid module can read the same id. The thread is never joined and does not keep the process alive. Workers never start one. Without the environment variables nothing changes. NSolidAgent.cpp compiles outside the unified bundles so that it moves no other file into another bundle. Decoding commands, the public nsolid module and everything the Console asks for after the handshake come next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
… build
The agent now speaks the protocol, not just the handshake:
- A protobuf codec for the agent. The protos are vendored in
packages/nsolid-protocol (N|Solid's, with the Console's later additions,
plus OTel's metrics, common and resource protos and protobuf's Struct);
generate.ts turns them into the schema tables in
src/js/internal/nsolid/messages.ts, and src/js/internal/nsolid/protobuf.ts
encodes and decodes against them. Checked against protobufjs.
- Commands are decoded and answered on the RPC the Console expects: info
(app, version, tags, host, entry script, versions without node or v8),
startup_times (process start, main module start, agent thread start, agent
ready, in nanoseconds since the process started), and reconfigure (the
merged configuration, every key, eBPF profiling unsupported). Everything
else gets N|Solid's 404 "Resource not available" at once.
- Configuration is read as N|Solid reads it: NSOLID_* variables, then the
"nsolid" key of the app's package.json, then defaults.
- `require("nsolid")` is an alias of the new `bun:nsolid` module; `id` is the
process's agent id, the one the agent reports. The id now lives in C++.
- The main thread hands the agent its entry point; the agent VM has none.
A Bun process running this build shows up in a local N|Solid Console with
its app name, version, tags and startup times, and its configuration
converges; a profile request is answered "not available" instead of
timing out.
.github/workflows/nsolid-bun.yml builds Linux x64 release, runs the N|Solid
tests against it and uploads the binary. scripts/nsolid/install-llvm.ts
installs the LLVM that Bun's CI images pin, from LLVM's release, for
machines that can't use apt.llvm.org.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
bun lint's no-duplicate-conditional-property-access flagged four properties read in an `if` and again in its body; each is now read once into a local. bun fmt orders generate.ts's imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nEe5T77UhAYmQxqQRbPpR
dad3681 to
91d408a
Compare
Phase 0 of nsolid-bun, the base of a stack of PRs, each targeting the one below it:
main)Rebased on 2026-12-04 onto
mainat 6cab274, which brings in oven-sh/bun at 39b4945. The commit SHAs in this description are the rebased ones. What the rebase changed here: upstream removedVM::hold_api_lock(oven-sh#49650), so the agent thread takes its VM's API lock withget_api_lock()and never releases it, as upstream's worker threads do.What does this PR do?
Phase 0 of nsolid-bun, NodeSource's build of Bun with an N|Solid agent.
When
NSOLID_GRPCorNSOLID_SAASis set, the main thread starts one hidden thread,NSolidAgent, with a VM of its own, as the inspector does for its Debugger thread. That VM runsinternal/nsolid/agent, which talks to the N|Solid Console over gRPC (grpcagent.NSolidService):node:http2with thensolid-agent-id,nsolid-versionand, for SaaS,nsolid-saasmetadata. SaaS tokens are routed the way N|Solid'sparse_saas_tokenroutes them. TLS by default; plaintext only withNSOLID_GRPC_INSECURE, and for a SaaS token only in testing mode. Reconnects back off from 1 s to 30 s with jitter.CommandRequestis acknowledged at once with an emptyCommandResponse, then answered on the RPC the Console expects:info(noversions.nodeorv8, so the Console doesn't treat the process as Node.js),startup_times(main module start, agent thread start and agent ready, in nanoseconds since the process started),reconfigure(every key, eBPF profiling unsupported). Everything else gets N|Solid's 404 "Resource not available" right away.NSOLID_*variables, then the"nsolid"key of the app'spackage.json, then defaults.packages/nsolid-protocol(N|Solid's, with the Console's later additions, OTel's metrics, common and resource protos, and protobuf'sStruct).generate.tswrites the schema tables insrc/js/internal/nsolid/messages.ts;protobuf.tsencodes and decodes against them. No new dependency.bun:nsolid, withrequire("nsolid")as an alias, as in N|Solid for Node.js. It exposesid, the process's agent id. It is not added tonode:module'sbuiltinModules, so Node compatibility counts are unchanged. Types inpackages/bun-types/nsolid.d.ts..github/workflows/nsolid-bun.ymlbuilds Linux x64 release, runs the N|Solid tests against it and uploads the binary.scripts/nsolid/install-llvm.tsinstalls the LLVM that Bun's CI images pin, with sha256 checks, for machines that can't use apt.llvm.org.Changes to existing upstream files are kept to hooks:
src/jsc/VirtualMachine.rs: two calls next toensure_debugger.src/jsc/lib.rs: the module.src/bun_core/env_var.rs:NSOLID_GRPCandNSOLID_SAAS.src/resolve_builtins/HardcodedModule.rs:bun:nsolidand thensolidalias.src/js/private.d.ts.packages/bun-types/index.d.ts.scripts/build/unified.ts:NSolidAgent.cppcompiles on its own, so it moves no other file between bundles.How did you verify your code works?
Tests.
test/js/bun/nsolid/nsolid-agent.test.tshas 6 tests. They pass withbun bd testand with the release build, and all fail with stock Bun.@grpc/grpc-js) built from the vendored protos.Codec. Cross-checked against protobufjs. OTel exponential histograms encode byte for byte the same. Also checked: 64-bit values above 2^53, negative integers, packed fields,
Struct, and frames split across chunks.Lints. The source lints,
builtins-manifestand thebun-typestests pass. Some only pass when they can find WebKit'saotsources, as in CI.End to end. Against a locally run N|Solid Console, the release binary was listed with its app name, version, tags, entry script and startup times, and its configuration converged. Through the Console's CLI,
infoandstartup_timescompleted, whileprofile,snapshot,heap_sampling,packagesandmetricsreturned 404 in about 2 s. A SaaS token connects. On SIGTERM the process exits and shows as disconnected; the exit event comes in Phase 1.Cost (release build, medians):
Bun.serveCI. The workflow's first run passed: https://github.com/nodesource/ns-bun/actions/runs/45256133468
After the rebase: every check passes at 91d408a.
Generated by Claude Code