@kitman-sh/cli 0.0.0-stage → 0.7.0

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.
@@ -0,0 +1,78 @@
1
+ // @bun
2
+ import {
3
+ build2,
4
+ succeed4,
5
+ provide2,
6
+ gen,
7
+ flatMap,
8
+ provideContext,
9
+ runForEach,
10
+ RunnerHeaders,
11
+ RunnerRpcProtocolVersion,
12
+ RunnerRpcs
13
+ } from "./chunk-704ws2q7.js";
14
+ import {
15
+ WebSocketConstructor,
16
+ layerWebSocketConstructorGlobal,
17
+ layerWebSocket,
18
+ layerJson,
19
+ make5,
20
+ withHeaders,
21
+ layerProtocolSocket
22
+ } from "./chunk-dwgta18y.js";
23
+
24
+ // packages/live/src/rpc/runner-client.ts
25
+ var proxiedWebSocket = (proxy) => succeed4(WebSocketConstructor)((target) => {
26
+ const options = { proxy };
27
+ return Reflect.construct(globalThis.WebSocket, [target, options]);
28
+ });
29
+ var runnerWebSocketProtocol2 = (url, options = {}) => layerProtocolSocket({ retryTransientErrors: true }).pipe(provide2(layerWebSocket(url)), provide2(options.proxy === undefined ? layerWebSocketConstructorGlobal : proxiedWebSocket(options.proxy)), provide2(layerJson));
30
+ function runnerRpcUrl2(apiUrl) {
31
+ const url = new URL("/v1/runners/rpc", apiUrl);
32
+ url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
33
+ return url.toString();
34
+ }
35
+ var makeRunnerRpcClient2 = (options) => gen(function* () {
36
+ const protocol = yield* build2(options.protocol);
37
+ const client = yield* make5(RunnerRpcs).pipe(provideContext(protocol));
38
+ const authorized = (call) => flatMap(options.bearer, (token) => withHeaders(call, {
39
+ authorization: `Bearer ${token}`,
40
+ [RunnerHeaders.runnerId]: options.runnerId,
41
+ [RunnerHeaders.protocolVersion]: String(RunnerRpcProtocolVersion)
42
+ }));
43
+ return {
44
+ claim: (input) => authorized(client.Claim(input)),
45
+ heartbeat: (input) => authorized(client.Heartbeat(input)),
46
+ complete: (input) => authorized(client.Complete(input)),
47
+ release: (input) => authorized(client.Release(input)),
48
+ recordActivity: (input) => authorized(client.RecordActivity(input)),
49
+ deferredDone: (input) => authorized(client.DeferredDone(input)),
50
+ scheduleClock: (input) => authorized(client.ScheduleClock(input)),
51
+ putQuestion: (input) => authorized(client.PutQuestion(input)),
52
+ programSecrets: (input) => authorized(client.ProgramSecrets(input)),
53
+ suspend: (input) => authorized(client.Suspend(input)),
54
+ finishProgram: (input) => authorized(client.FinishProgram(input)),
55
+ startAgentStep: (input) => authorized(client.StartAgentStep(input)),
56
+ startVerification: (input) => authorized(client.StartVerification(input)),
57
+ knownEvidence: (input) => authorized(client.KnownEvidence(input)),
58
+ awaitEvent: (input) => authorized(client.AwaitEvent(input)),
59
+ admitChild: (input) => authorized(client.AdmitChild(input)),
60
+ storeArtifact: (input) => authorized(client.StoreArtifact(input)),
61
+ recordNote: (input) => authorized(client.RecordNote(input)),
62
+ performHostEffect: (input) => authorized(client.PerformHostEffect(input)),
63
+ createPlanTasks: (input) => authorized(client.CreatePlanTasks(input)),
64
+ integrationBranch: (input) => authorized(client.IntegrationBranch(input)),
65
+ mergeChangeRequest: (input) => authorized(client.MergeChangeRequest(input)),
66
+ publishRelease: (input) => authorized(client.PublishRelease(input)),
67
+ bundle: (digest) => authorized(client.Bundle({ digest })),
68
+ settledRuns: (runIds) => authorized(client.SettledRuns({ runIds })),
69
+ reportSteer: (input) => authorized(client.ReportSteer(input)),
70
+ saveCheckpoint: (input) => authorized(client.SaveCheckpoint(input)),
71
+ resumeCheckpoint: (input) => authorized(client.ResumeCheckpoint(input)),
72
+ settledCheckpoints: authorized(client.SettledCheckpoints()),
73
+ forgetCheckpoints: (stepAttemptIds) => authorized(client.ForgetCheckpoints({ stepAttemptIds })),
74
+ listen: (runnerReplicaId, onSignal) => authorized(runForEach(client.Signals({ runnerReplicaId }), onSignal))
75
+ };
76
+ });
77
+
78
+ export { runnerWebSocketProtocol2, runnerRpcUrl2, makeRunnerRpcClient2 };