@kubb/studio 5.3.17 → 5.3.19
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 +8 -1
- package/dist/index.cjs +367 -355
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -14
- package/dist/index.js +367 -355
- package/dist/index.js.map +1 -1
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.d.ts +5 -16
- package/dist/protocol.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { t as __name } from "./rolldown-runtime-CRm0XQPb.js";
|
|
|
2
2
|
import { AGENT_INSTANCE_HEADER, AgentApi, AgentCapacity, AgentCloseCode, AgentLoad, AgentPermissions, AgentRegisterInput, AgentRegisterResponse, ConfigEdit, ConnectMessagePayload, GenerateInput, GenerateResult, GenerationEvent, GenerationEventPayloads, GenerationEventType, GenerationRun, PublishSnapshotInput, PublishSnapshotResult, RpcClose, RpcConnection, RpcConnector, StudioApi, generationEventTypes } from "./protocol.js";
|
|
3
3
|
import { Config, Hookable, KubbHooks } from "@kubb/core";
|
|
4
4
|
import { Storage } from "unstorage";
|
|
5
|
-
//#region src/api.d.ts
|
|
5
|
+
//#region src/operations/api.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Thrown when Studio rejects the agent token itself (401). Retrying cannot help: the token was
|
|
8
8
|
* revoked, or the agent it belonged to was deleted in the Studio UI. Hosts catch this to forget
|
|
@@ -36,6 +36,15 @@ type StudioSnapshotChanges = {
|
|
|
36
36
|
changed: Array<string>;
|
|
37
37
|
removed: Array<string>;
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* `StudioSnapshotChanges` against a pull request's base branch. `baseFound` tells apart the two
|
|
41
|
+
* reasons `base` can be `null`: `false` when no CI agent is registered for the branch yet (the
|
|
42
|
+
* workflow has never run there), `true` when that agent exists but has no snapshot of this package
|
|
43
|
+
* to compare with.
|
|
44
|
+
*/
|
|
45
|
+
type StudioBranchSnapshotChanges = StudioSnapshotChanges & {
|
|
46
|
+
baseFound: boolean;
|
|
47
|
+
};
|
|
39
48
|
/**
|
|
40
49
|
* Package view returned on a successful snapshot job from Studio.
|
|
41
50
|
*/
|
|
@@ -71,7 +80,7 @@ type StudioSnapshot = {
|
|
|
71
80
|
/** What changed since the previous snapshot on the same agent. Absent when Studio or the agent predates it. */
|
|
72
81
|
changes?: StudioSnapshotChanges;
|
|
73
82
|
/** What differs from the latest snapshot of the CI agent `baseId` names. Absent without a base. */
|
|
74
|
-
branchChanges?:
|
|
83
|
+
branchChanges?: StudioBranchSnapshotChanges;
|
|
75
84
|
};
|
|
76
85
|
/**
|
|
77
86
|
* Job record from `POST /api/jobs` and `GET /api/jobs/{id}`.
|
|
@@ -117,7 +126,7 @@ type StudioJob = {
|
|
|
117
126
|
* const finished = await waitForJob({ studioUrl, token, id: job.id })
|
|
118
127
|
* ```
|
|
119
128
|
*/
|
|
120
|
-
export declare function createJob({ studioUrl, token, type, agentId, name, version, commit, baseId, config, timeoutMs, signal }: {
|
|
129
|
+
export declare function createJob({ studioUrl, token, type, agentId, name, version, commit, baseId, config, instanceId, timeoutMs, signal }: {
|
|
121
130
|
studioUrl: string;
|
|
122
131
|
token: string;
|
|
123
132
|
type: 'generation' | 'snapshot';
|
|
@@ -129,6 +138,11 @@ export declare function createJob({ studioUrl, token, type, agentId, name, versi
|
|
|
129
138
|
/** The `id` another CI agent's runs register under, such as the base branch's; this snapshot is also compared with its latest one. */
|
|
130
139
|
baseId?: string;
|
|
131
140
|
config?: Record<string, unknown>;
|
|
141
|
+
/**
|
|
142
|
+
* The agent process to run the job on, the `instanceId` its client connected with. A CI run passes
|
|
143
|
+
* its own, so an overlapping pipeline under the same CI agent never builds its checkout.
|
|
144
|
+
*/
|
|
145
|
+
instanceId?: string;
|
|
132
146
|
/**
|
|
133
147
|
* How long to keep retrying a busy or queue-full response before giving up, in milliseconds.
|
|
134
148
|
*
|
|
@@ -190,7 +204,7 @@ export declare function createAgent({ studioUrl, token, name, machineToken }: {
|
|
|
190
204
|
machineToken: string;
|
|
191
205
|
}): Promise<StudioAgent>;
|
|
192
206
|
//#endregion
|
|
193
|
-
//#region src/StudioSession.d.ts
|
|
207
|
+
//#region src/runtime/StudioSession.d.ts
|
|
194
208
|
type StudioSessionOptions = {
|
|
195
209
|
connector?: RpcConnector;
|
|
196
210
|
token: string;
|
|
@@ -230,7 +244,7 @@ type StudioSessionOptions = {
|
|
|
230
244
|
heartbeatInterval?: number;
|
|
231
245
|
/**
|
|
232
246
|
* What this agent process can take on, reported to Studio at registration. Unset fields come from
|
|
233
|
-
* `KUBB_AGENT_MAX_CONCURRENT
|
|
247
|
+
* `KUBB_AGENT_MAX_CONCURRENT`.
|
|
234
248
|
*/
|
|
235
249
|
capacity?: Partial<AgentCapacity>;
|
|
236
250
|
/**
|
|
@@ -259,8 +273,8 @@ type StudioSessionOptions = {
|
|
|
259
273
|
onTokenRejected?: (error: InvalidAgentTokenError) => void;
|
|
260
274
|
};
|
|
261
275
|
//#endregion
|
|
262
|
-
//#region src/client.d.ts
|
|
263
|
-
type ClientOptions = Omit<StudioSessionOptions, 'signal' | 'onTokenRejected' | '
|
|
276
|
+
//#region src/runtime/client.d.ts
|
|
277
|
+
type ClientOptions = Omit<StudioSessionOptions, 'signal' | 'onTokenRejected' | 'reconnectAttempt'> & {
|
|
264
278
|
/**
|
|
265
279
|
* Called once when the token is rejected during a background reconnect (401: revoked, or the
|
|
266
280
|
* agent was deleted). The client is already stopped by the time this fires, so a host only needs
|
|
@@ -297,7 +311,7 @@ type Client = {
|
|
|
297
311
|
*/
|
|
298
312
|
export declare function createClient({ onAuthRequired, ...options }: ClientOptions): Client;
|
|
299
313
|
//#endregion
|
|
300
|
-
//#region src/hooks.d.ts
|
|
314
|
+
//#region src/operations/hooks.d.ts
|
|
301
315
|
/**
|
|
302
316
|
* Events a host emits about its Kubb Studio session, as opposed to a generation. `kubb:` stays
|
|
303
317
|
* reserved for generation lifecycle.
|
|
@@ -403,14 +417,14 @@ declare global {
|
|
|
403
417
|
}
|
|
404
418
|
}
|
|
405
419
|
//#endregion
|
|
406
|
-
//#region src/constants.d.ts
|
|
420
|
+
//#region src/operations/constants.d.ts
|
|
407
421
|
/**
|
|
408
422
|
* Hosted Kubb Studio URL. Exported so credential stores can bind tokens to the resolved instance,
|
|
409
423
|
* not whatever default the client would pick on its own.
|
|
410
424
|
*/
|
|
411
425
|
export declare const defaultStudioUrl = "https://kubb.studio";
|
|
412
426
|
//#endregion
|
|
413
|
-
//#region src/machine.d.ts
|
|
427
|
+
//#region src/operations/machine.d.ts
|
|
414
428
|
/**
|
|
415
429
|
* Installs the storage driver the runtime persists to. Call once, before connecting.
|
|
416
430
|
*/
|
|
@@ -426,7 +440,7 @@ export declare function createFileStorage(base: string): Storage;
|
|
|
426
440
|
*/
|
|
427
441
|
export declare function machineTokenFrom(secret: string): string;
|
|
428
442
|
//#endregion
|
|
429
|
-
//#region src/runConnection.d.ts
|
|
443
|
+
//#region src/runtime/runConnection.d.ts
|
|
430
444
|
/**
|
|
431
445
|
* Why a connection ended: the host asked it to stop through its `signal`, or the host declined to
|
|
432
446
|
* replace a rejected token.
|
|
@@ -494,7 +508,7 @@ export declare function runConnection<TCredentials extends {
|
|
|
494
508
|
token: string;
|
|
495
509
|
}>({ credentials, clientOptions, onTokenRejected, signal }: ConnectionOptions<TCredentials>): Promise<ConnectionOutcome>;
|
|
496
510
|
//#endregion
|
|
497
|
-
//#region src/pair.d.ts
|
|
511
|
+
//#region src/operations/pair.d.ts
|
|
498
512
|
/**
|
|
499
513
|
* RFC 8628 device-authorization response from Studio's `/api/auth/device/code` endpoint.
|
|
500
514
|
* Field names match the RFC; the CLI polls with `device_code` and shows `user_code` to the user.
|
|
@@ -609,7 +623,7 @@ type PairAgentOptions = StartPairingOptions & {
|
|
|
609
623
|
*/
|
|
610
624
|
export declare function pairAgent({ onCode, onRetry, maxAttempts, ...options }: PairAgentOptions): Promise<PairingResult>;
|
|
611
625
|
//#endregion
|
|
612
|
-
//#region src/rpc.d.ts
|
|
626
|
+
//#region src/operations/rpc.d.ts
|
|
613
627
|
/**
|
|
614
628
|
* Opens an authenticated Cap'n Web session to Studio over a WebSocket. Rejects an unencrypted URL
|
|
615
629
|
* before opening the socket, so a bearer token never reaches a plaintext host.
|
|
@@ -622,5 +636,5 @@ export declare function pairAgent({ onCode, onRetry, maxAttempts, ...options }:
|
|
|
622
636
|
*/
|
|
623
637
|
export declare const connectWebSocketRpc: RpcConnector;
|
|
624
638
|
//#endregion
|
|
625
|
-
export { AGENT_INSTANCE_HEADER, type AgentApi, type AgentCapacity, AgentCloseCode, type AgentLoad, type AgentRegisterInput, type AgentRegisterResponse, type Client, type ClientOptions, type ConfigEdit, type ConnectMessagePayload, type ConnectionOptions, type GenerateInput, type GenerateResult, type GenerationEvent, type GenerationEventPayloads, type GenerationEventType, type GenerationRun, type PairingAgentType, type PairingResult, type PairingSession, type PublishSnapshotInput, type PublishSnapshotResult, type RpcClose, type RpcConnection, type RpcConnector, type StudioAgent, type StudioApi, type StudioConnectedContext, type StudioJob, type StudioJobStatus, type StudioSnapshot, type StudioSnapshotChanges, generationEventTypes };
|
|
639
|
+
export { AGENT_INSTANCE_HEADER, type AgentApi, type AgentCapacity, AgentCloseCode, type AgentLoad, type AgentRegisterInput, type AgentRegisterResponse, type Client, type ClientOptions, type ConfigEdit, type ConnectMessagePayload, type ConnectionOptions, type GenerateInput, type GenerateResult, type GenerationEvent, type GenerationEventPayloads, type GenerationEventType, type GenerationRun, type PairingAgentType, type PairingResult, type PairingSession, type PublishSnapshotInput, type PublishSnapshotResult, type RpcClose, type RpcConnection, type RpcConnector, type StudioAgent, type StudioApi, type StudioBranchSnapshotChanges, type StudioConnectedContext, type StudioJob, type StudioJobStatus, type StudioSnapshot, type StudioSnapshotChanges, generationEventTypes };
|
|
626
640
|
//# sourceMappingURL=index.d.ts.map
|