@kubb/studio 5.3.16 → 5.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -109,14 +109,19 @@ the machine-facing surface, singular because the caller is describing itself. Th
109
109
  `/api/agents` is the collection a signed-in user manages in the browser, and the runtime never
110
110
  touches it.
111
111
 
112
- | Step | Call | What it does |
113
- | ---------- | ------------------------------------------------- | ---------------------------------------------------------------------------------- |
114
- | Register | `POST /api/agent/connect` | Binds the token to this machine with a `machineToken`. A failure here is not fatal |
115
- | Session | `POST /api/agent/sessions` | Returns `{ url, sessionId, expiresAt }` |
116
- | Connect | Configured RPC connector on `url` | Attaches the typed `AgentApi`/`StudioApi` RPC session |
117
- | Disconnect | `POST /api/agent/sessions/{sessionId}/disconnect` | Closes the session on a clean shutdown |
118
-
119
- The runtime reconnects on its own when a session drops, and keeps retrying while Studio is
112
+ | Step | Call | What it does |
113
+ | -------- | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
114
+ | Register | `POST /api/agent/connect` | Binds the token to this machine and process (`machineToken`, `instanceId`), reports `capacity`, and returns `socketUrl` |
115
+ | Connect | Configured RPC connector on `socketUrl` | Opens the process's one socket with the bearer token and `x-kubb-instance-id`, then attaches the typed `AgentApi`/`StudioApi` RPC session |
116
+
117
+ Every connection attempt registers first, so a reconnect is also how the agent registers again.
118
+ Each heartbeat carries the agent's load. A process keeps one socket, not one per job: Studio
119
+ schedules jobs onto it up to the advertised `maxConcurrent`. Studio's close codes say whether to
120
+ come back: `4001` registers and reconnects, `4002` (another instance took over) and `4003` (the
121
+ agent is too old or was deleted) stay down. A `426` at registration means the agent is too old for
122
+ that Studio.
123
+
124
+ The runtime reconnects on its own when the socket drops, and keeps retrying while Studio is
120
125
  unreachable. Generation progress is a native Cap'n Web `ReadableStream` on the generation
121
126
  capability; durable job status is read through the HTTP job API.
122
127
 
@@ -197,6 +202,15 @@ Pass `commit` with a snapshot job, and the finished snapshot carries `changes`:
197
202
  changed, and removed since the previous snapshot of the same package on the same agent, and which
198
203
  snapshot (and commit) that was. `base` is `null` on the first one.
199
204
 
205
+ Pass `baseId` (the `id` another CI agent's runs register under) and the snapshot also carries
206
+ `branchChanges`: the same comparison against that agent's latest snapshot. On a GitHub pull
207
+ request or a GitLab merge request, `kubb studio snapshot` passes the agent its base branch's runs
208
+ use. Elsewhere, pass `--base-id` with the `--id` those runs use.
209
+
210
+ Runs that share an agent (one pull request, or one branch) must not overlap, since registering it
211
+ again ends the other run's session. Serialize them per ref, such as a GitHub Actions `concurrency`
212
+ group on `github.ref` or a GitLab `resource_group` on `$CI_COMMIT_REF_SLUG`.
213
+
200
214
  A snapshot job packs the tarball on the agent, not on Studio. The agent `PUT`s an empty request to
201
215
  a path Studio provides, gets back a redirect to a short-lived storage URL, and uploads the tarball
202
216
  there. The storage URL never crosses the RPC socket.