@loucompanion/forge-bridge 0.1.3-dev.0b2f81d660c0 → 0.1.3-dev.0d26c10244e1

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.
Files changed (148) hide show
  1. package/README.md +79 -0
  2. package/dist/bridge/bridge.base.d.ts +8 -1
  3. package/dist/bridge/bridge.service.d.ts +77 -3
  4. package/dist/bridge/bridge.service.js +1113 -34
  5. package/dist/bridge/bridge.types.d.ts +168 -1
  6. package/dist/cleanup/cleanup.service.d.ts +14 -2
  7. package/dist/cleanup/cleanup.service.js +469 -3
  8. package/dist/cleanup/cleanup.types.d.ts +10 -0
  9. package/dist/cleanup/index.d.ts +1 -1
  10. package/dist/cleanup/index.js +1 -1
  11. package/dist/cleanup/internals.d.ts +2 -2
  12. package/dist/cleanup/internals.js +1 -1
  13. package/dist/cli/cli.help.js +47 -1
  14. package/dist/cli/cli.service.d.ts +42 -2
  15. package/dist/cli/cli.service.js +357 -26
  16. package/dist/cli/local-config.d.ts +4 -0
  17. package/dist/cli/local-config.js +41 -1
  18. package/dist/runtime/aspnet-runtime-prebuild.d.ts +35 -0
  19. package/dist/runtime/aspnet-runtime-prebuild.js +168 -0
  20. package/dist/runtime/attempt-node-runtime-launcher.d.ts +17 -0
  21. package/dist/runtime/attempt-node-runtime-launcher.js +105 -0
  22. package/dist/runtime/attempt-process-supervisor-registry.d.ts +20 -0
  23. package/dist/runtime/attempt-process-supervisor-registry.js +64 -0
  24. package/dist/runtime/attempt-process-supervisor.d.ts +86 -0
  25. package/dist/runtime/attempt-process-supervisor.js +350 -0
  26. package/dist/runtime/generated-output-reset.d.ts +10 -0
  27. package/dist/runtime/generated-output-reset.js +103 -0
  28. package/dist/runtime/host-listener-inspector.d.ts +46 -0
  29. package/dist/runtime/host-listener-inspector.js +349 -0
  30. package/dist/runtime/host-port-broker.d.ts +76 -0
  31. package/dist/runtime/host-port-broker.js +333 -0
  32. package/dist/runtime/host-runtime-contract.d.ts +47 -0
  33. package/dist/runtime/host-runtime-contract.js +700 -0
  34. package/dist/runtime/host-runtime-lease.d.ts +179 -0
  35. package/dist/runtime/host-runtime-lease.js +1990 -0
  36. package/dist/runtime/host-runtime-promotion.d.ts +23 -0
  37. package/dist/runtime/host-runtime-promotion.js +159 -0
  38. package/dist/runtime/node-host-runtime-adapter.d.ts +54 -0
  39. package/dist/runtime/node-host-runtime-adapter.js +284 -0
  40. package/dist/runtime/playwright-host-runtime-adapter.d.ts +20 -0
  41. package/dist/runtime/playwright-host-runtime-adapter.js +220 -0
  42. package/dist/runtime/runtime-isolation-lease.d.ts +67 -0
  43. package/dist/runtime/runtime-isolation-lease.js +158 -0
  44. package/dist/runtime/workspace-resource-estimator.d.ts +16 -0
  45. package/dist/runtime/workspace-resource-estimator.js +165 -0
  46. package/dist/sandbox/command-runner.d.ts +4 -0
  47. package/dist/sandbox/command-runner.js +47 -0
  48. package/dist/sandbox/contract.d.ts +5 -0
  49. package/dist/sandbox/contract.js +276 -0
  50. package/dist/sandbox/event-budget.d.ts +11 -0
  51. package/dist/sandbox/event-budget.js +27 -0
  52. package/dist/sandbox/image-policy.d.ts +35 -0
  53. package/dist/sandbox/image-policy.js +247 -0
  54. package/dist/sandbox/index.d.ts +5 -0
  55. package/dist/sandbox/index.js +5 -0
  56. package/dist/sandbox/lease-watchdog.d.ts +18 -0
  57. package/dist/sandbox/lease-watchdog.js +67 -0
  58. package/dist/sandbox/preflight.d.ts +55 -0
  59. package/dist/sandbox/preflight.js +343 -0
  60. package/dist/sandbox/process.d.ts +20 -0
  61. package/dist/sandbox/process.js +209 -0
  62. package/dist/sandbox/provider-auth/codex.d.ts +26 -0
  63. package/dist/sandbox/provider-auth/codex.js +212 -0
  64. package/dist/sandbox/repository-lock.d.ts +5 -0
  65. package/dist/sandbox/repository-lock.js +119 -0
  66. package/dist/sandbox/runtime.d.ts +297 -0
  67. package/dist/sandbox/runtime.js +2338 -0
  68. package/dist/sandbox/sandbox.types.d.ts +86 -0
  69. package/dist/sandbox/sandbox.types.js +1 -0
  70. package/dist/sandbox/smoke.d.ts +76 -0
  71. package/dist/sandbox/smoke.js +380 -0
  72. package/dist/sandbox/worker-supervisor.d.ts +13 -0
  73. package/dist/sandbox/worker-supervisor.js +36 -0
  74. package/dist/sandbox/worker.d.ts +1 -0
  75. package/dist/sandbox/worker.js +225 -0
  76. package/dist/sandbox/workspace.service.d.ts +13 -0
  77. package/dist/sandbox/workspace.service.js +72 -0
  78. package/dist/session/managed-attempt-tools.d.ts +18 -0
  79. package/dist/session/managed-attempt-tools.js +797 -0
  80. package/dist/session/managed-build-coordinator.d.ts +5 -0
  81. package/dist/session/managed-build-coordinator.js +105 -0
  82. package/dist/session/phase-completion.artifacts.js +21 -3
  83. package/dist/session/phase-completion.d.ts +11 -2
  84. package/dist/session/phase-completion.helpers.d.ts +5 -0
  85. package/dist/session/phase-completion.helpers.js +51 -10
  86. package/dist/session/phase-completion.js +12 -3
  87. package/dist/session/phase-completion.prompts.d.ts +3 -3
  88. package/dist/session/phase-completion.prompts.js +21 -6
  89. package/dist/session/phase-completion.runtime.d.ts +13 -1
  90. package/dist/session/phase-completion.runtime.js +187 -8
  91. package/dist/session/phase-completion.schemas.js +108 -3
  92. package/dist/session/phase-completion.validation.d.ts +4 -1
  93. package/dist/session/phase-completion.validation.js +150 -21
  94. package/dist/session/provider-cli/ci-repair-readiness.d.ts +14 -0
  95. package/dist/session/provider-cli/ci-repair-readiness.js +105 -0
  96. package/dist/session/provider-cli/provider-cli.artifacts.d.ts +3 -2
  97. package/dist/session/provider-cli/provider-cli.artifacts.js +65 -7
  98. package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
  99. package/dist/session/provider-cli/provider-cli.deterministic.d.ts +2 -0
  100. package/dist/session/provider-cli/provider-cli.deterministic.js +66 -9
  101. package/dist/session/provider-cli/provider-cli.process.d.ts +16 -0
  102. package/dist/session/provider-cli/provider-cli.process.js +212 -25
  103. package/dist/session/provider-cli/provider-cli.prompts.d.ts +6 -1
  104. package/dist/session/provider-cli/provider-cli.prompts.js +129 -18
  105. package/dist/session/provider-cli/provider-cli.qa-sidecars.js +1 -0
  106. package/dist/session/provider-cli/provider-cli.runtime.d.ts +1 -1
  107. package/dist/session/provider-cli/provider-cli.runtime.js +3 -2
  108. package/dist/session/provider-cli/provider-cli.service.d.ts +23 -2
  109. package/dist/session/provider-cli/provider-cli.service.js +507 -88
  110. package/dist/session/provider-cli/provider-cli.types.d.ts +5 -0
  111. package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
  112. package/dist/session/provider-cli/provider-output-state.js +69 -7
  113. package/dist/session/session-redaction.d.ts +3 -0
  114. package/dist/session/session-redaction.js +38 -0
  115. package/dist/session/session.base.d.ts +6 -1
  116. package/dist/session/session.service.d.ts +8 -2
  117. package/dist/session/session.service.js +490 -42
  118. package/dist/session/session.types.d.ts +111 -1
  119. package/dist/session/session.types.js +192 -3
  120. package/dist/shared/format/format-bytes.d.ts +1 -0
  121. package/dist/shared/format/format-bytes.js +9 -0
  122. package/dist/shared/path/path.js +3 -1
  123. package/dist/shared/process/host-process-recovery.d.ts +12 -0
  124. package/dist/shared/process/host-process-recovery.js +78 -0
  125. package/dist/shared/process/host-process-supervisor.d.ts +57 -0
  126. package/dist/shared/process/host-process-supervisor.js +282 -0
  127. package/dist/shared/process/process.d.ts +1 -0
  128. package/dist/shared/process/process.js +1 -0
  129. package/dist/shared/redaction/redaction.js +6 -1
  130. package/dist/version.d.ts +1 -1
  131. package/dist/version.js +1 -1
  132. package/dist/worktree/artifact-injector.d.ts +3 -2
  133. package/dist/worktree/artifact-injector.js +43 -4
  134. package/dist/worktree/dependency-warmer.d.ts +10 -1
  135. package/dist/worktree/dependency-warmer.js +94 -5
  136. package/dist/worktree/index.d.ts +1 -0
  137. package/dist/worktree/index.js +1 -0
  138. package/dist/worktree/prior-phase-artifact-hydrator.d.ts +2 -0
  139. package/dist/worktree/prior-phase-artifact-hydrator.js +136 -0
  140. package/dist/worktree/worktree-paths.d.ts +4 -0
  141. package/dist/worktree/worktree-paths.js +30 -0
  142. package/dist/worktree/worktree.base.d.ts +3 -0
  143. package/dist/worktree/worktree.service.d.ts +8 -2
  144. package/dist/worktree/worktree.service.js +206 -43
  145. package/dist/worktree/worktree.types.d.ts +4 -1
  146. package/package.json +6 -3
  147. package/runtime/windows-job-supervisor.ps1 +356 -0
  148. package/runtime/windows-listener-owner.ps1 +33 -0
@@ -1,7 +1,33 @@
1
- import type { RunOnceResultPacket, RunnerDispatchEvent } from "../session/session.types.js";
1
+ import type { ApiKeySecretGrant, DispatchSandboxResourceRequest, RunOnceResultPacket, RunnerDispatchEvent } from "../session/session.types.js";
2
+ import type { SandboxFeatureMatrix } from "../sandbox/sandbox.types.js";
3
+ import type { HostRuntimeCapacitySnapshot } from "../runtime/host-runtime-lease.js";
2
4
  export interface BridgeServiceConfig {
3
5
  readonly serverUrl: string;
4
6
  readonly runnerId: string;
7
+ readonly runnerInstanceId: string;
8
+ readonly trustDomainId: string;
9
+ readonly maxConcurrentSandboxes: number;
10
+ readonly maxConcurrentSandboxBuilds: number;
11
+ readonly sandboxPidCapacity: number;
12
+ readonly dockerEnabled: boolean;
13
+ readonly allowOpenPublicSandbox: boolean;
14
+ readonly sandboxPublicationMode?: "bridge_push" | "shared_filesystem";
15
+ readonly dockerExecutable: string;
16
+ readonly dockerContext: string;
17
+ readonly sandboxStateRoot: string;
18
+ readonly requireRootlessDocker: boolean;
19
+ readonly diskHighWatermarkPercent: number;
20
+ readonly diskLowWatermarkPercent: number;
21
+ readonly minimumWorkspaceBytes: number;
22
+ readonly sandboxHostMemoryReserveBytes?: number;
23
+ readonly defaultSandboxWorkerMemoryLimitBytes: number;
24
+ readonly defaultSandboxServiceMemoryLimitBytes: number;
25
+ readonly sandboxRuntimeOverheadBytes: number;
26
+ readonly sandboxMemorySampleIntervalMs: number;
27
+ readonly imageRetentionCount: number;
28
+ readonly imageRetentionTtlMs: number;
29
+ readonly auditRetentionCount: number;
30
+ readonly auditRetentionTtlMs: number;
5
31
  readonly deviceToken: string;
6
32
  readonly deviceName: string;
7
33
  readonly defaultRepoRoot: string;
@@ -37,6 +63,7 @@ export interface QaAppLaunchTarget {
37
63
  readonly command?: string | null;
38
64
  readonly working_directory?: string | null;
39
65
  readonly ready_url?: string | null;
66
+ readonly managed_runtime_port?: string | null;
40
67
  readonly routes?: readonly string[] | null;
41
68
  readonly notes?: string | null;
42
69
  }
@@ -54,6 +81,28 @@ export interface BridgeCapabilities {
54
81
  readonly repoMappings?: readonly BridgeRepoMapping[] | null;
55
82
  readonly os?: string | null;
56
83
  readonly sandboxProfiles?: readonly string[] | null;
84
+ readonly runnerInstanceId?: string | null;
85
+ readonly trustDomainId?: string | null;
86
+ readonly sandboxRuntimes?: readonly string[] | null;
87
+ readonly sandboxRuntimeVersion?: string | null;
88
+ readonly sandboxFeatures?: SandboxFeatureMatrix | null;
89
+ readonly allowsOpenPublicSandbox?: boolean | null;
90
+ readonly sandboxPublicationModes?: readonly string[] | null;
91
+ readonly sandboxAuthModes?: Readonly<Record<string, readonly string[]>> | null;
92
+ readonly maxConcurrentSandboxes?: number | null;
93
+ readonly reservedSandboxCount?: number | null;
94
+ readonly activeSandboxCount?: number | null;
95
+ readonly startingSandboxCount?: number | null;
96
+ readonly degradedReservationCount?: number | null;
97
+ readonly availableMemoryBytes?: number | null;
98
+ readonly availableCpuMillis?: number | null;
99
+ readonly availableWorkspaceBytes?: number | null;
100
+ readonly diskLow?: boolean | null;
101
+ readonly preflightGeneration?: number | null;
102
+ readonly sandboxUnavailableCode?: string | null;
103
+ readonly sandboxUnavailableReason?: string | null;
104
+ readonly sandboxMemoryCapacity?: SandboxMemoryCapacityDiagnostics | null;
105
+ readonly hostRuntime?: HostRuntimeCapacitySnapshot | null;
57
106
  readonly supportsApiSecretGrant?: boolean | null;
58
107
  readonly supportsManagedWorktrees?: boolean | null;
59
108
  readonly supportsManagedForgeArtifacts?: boolean | null;
@@ -62,11 +111,34 @@ export interface BridgeCapabilities {
62
111
  readonly supportsDraftAttachments?: boolean | null;
63
112
  readonly supportsDraftImageAttachments?: boolean | null;
64
113
  }
114
+ export interface SandboxMemoryCapacityDiagnostics {
115
+ readonly defaultWorkerMemoryLimitBytes: number;
116
+ readonly defaultServiceMemoryLimitBytes: number;
117
+ readonly runtimeOverheadBytes: number;
118
+ readonly hostReserveBytes: number;
119
+ readonly activeReservationBytes: number;
120
+ readonly daemonTotalBytes: number;
121
+ readonly daemonAvailableBytes: number;
122
+ readonly availableForAdmissionBytes: number;
123
+ }
65
124
  export interface BridgeHelloRequest {
66
125
  readonly version: string;
67
126
  readonly protocolVersion: number;
68
127
  readonly capabilities: BridgeCapabilities;
69
128
  readonly minServerVersion?: string | null;
129
+ readonly runnerInstanceId: string;
130
+ }
131
+ export interface BridgePublishCredential {
132
+ readonly username: string;
133
+ readonly secret: string;
134
+ readonly remoteUrl: string;
135
+ readonly expiresAt: string;
136
+ }
137
+ export interface BridgePublishGrantRedemptionResponse {
138
+ readonly accepted: boolean;
139
+ readonly code?: string | null;
140
+ readonly message?: string | null;
141
+ readonly credential?: BridgePublishCredential | null;
70
142
  }
71
143
  export interface BridgeHeartbeatRequest {
72
144
  readonly status?: string | null;
@@ -82,17 +154,112 @@ export interface BridgeCallbackAck {
82
154
  export interface BridgeDispatchEventCallback {
83
155
  readonly leaseId: string;
84
156
  readonly fencingToken: string;
157
+ readonly dispatchAttemptId?: string | null;
158
+ readonly runnerInstanceId?: string | null;
85
159
  readonly event: RunnerDispatchEvent;
86
160
  }
87
161
  export interface BridgeDispatchResultCallback {
88
162
  readonly leaseId: string;
89
163
  readonly fencingToken: string;
164
+ readonly dispatchAttemptId?: string | null;
165
+ readonly runnerInstanceId?: string | null;
90
166
  readonly result: RunOnceResultPacket;
91
167
  }
168
+ export interface BridgeOfferDecisionCallback {
169
+ readonly dispatchAttemptId: string;
170
+ readonly leaseId: string;
171
+ readonly fencingToken: string;
172
+ readonly runnerInstanceId: string;
173
+ readonly accepted: boolean;
174
+ readonly code?: string | null;
175
+ readonly message?: string | null;
176
+ readonly reservedUntil?: string | null;
177
+ readonly reservedResources?: DispatchSandboxResourceRequest | null;
178
+ readonly sandboxConfigCommitSha?: string | null;
179
+ }
180
+ export interface BridgeDispatchStartedCallback {
181
+ readonly dispatchAttemptId: string;
182
+ readonly leaseId: string;
183
+ readonly fencingToken: string;
184
+ readonly runnerInstanceId: string;
185
+ }
186
+ export interface BridgeSecretGrantRedemptionRequest {
187
+ readonly dispatchAttemptId: string;
188
+ readonly leaseId: string;
189
+ readonly fencingToken: string;
190
+ readonly runnerInstanceId: string;
191
+ readonly grantId: string;
192
+ }
193
+ export interface BridgeSecretGrantRedemptionResponse extends BridgeCallbackAck {
194
+ readonly grant?: ApiKeySecretGrant | null;
195
+ }
196
+ export interface BridgeLeaseUpdateRequest {
197
+ readonly dispatchAttemptId: string;
198
+ readonly leaseId: string;
199
+ readonly fencingToken: string;
200
+ readonly runnerInstanceId: string;
201
+ readonly expiresAt: string;
202
+ }
92
203
  export interface BridgeCancelRequest {
93
204
  readonly leaseId: string;
94
205
  readonly fencingToken: string;
95
206
  readonly reason?: string | null;
96
207
  }
208
+ export interface BridgeReapRequest {
209
+ readonly runnerId: string;
210
+ readonly runnerInstanceId: string;
211
+ readonly requestedAt: string;
212
+ readonly reason?: string | null;
213
+ }
214
+ export interface BridgeAttemptSnapshotItem {
215
+ readonly dispatchAttemptId: string;
216
+ readonly fencingToken: string;
217
+ readonly runnerInstanceId: string;
218
+ readonly status: string;
219
+ readonly expiresAt: string;
220
+ }
221
+ export interface BridgeAttemptSnapshotResponse extends BridgeCallbackAck {
222
+ readonly attempts?: readonly BridgeAttemptSnapshotItem[] | null;
223
+ readonly generatedAt?: string | null;
224
+ }
97
225
  export type BridgeDispatchHandler = (dispatch: unknown) => Promise<void>;
226
+ export type BridgeOfferHandler = (dispatch: unknown) => Promise<void>;
227
+ export type BridgeStartHandler = (dispatch: unknown) => Promise<void>;
228
+ export type BridgeLeaseUpdateHandler = (request: BridgeLeaseUpdateRequest) => Promise<void>;
98
229
  export type BridgeCancelHandler = (request: BridgeCancelRequest) => Promise<void>;
230
+ export type BridgeReapHandler = (request: BridgeReapRequest) => Promise<void>;
231
+ export type BridgeReadinessProbeHandler = (request: unknown) => Promise<void>;
232
+ export interface BridgeRuntimeReadinessRequest {
233
+ readonly schemaVersion: 1;
234
+ readonly requestId: string;
235
+ readonly fencingToken: string;
236
+ readonly userId: string;
237
+ readonly projectId: string;
238
+ readonly repoId: string;
239
+ readonly runnerInstanceId: string;
240
+ readonly attempt: number;
241
+ readonly repoName: string;
242
+ readonly remoteUrl: string;
243
+ readonly defaultBranch: string;
244
+ readonly cloneOnDemand: boolean;
245
+ readonly runnerRepoLocalPath: string;
246
+ readonly revision: string;
247
+ readonly expiresAt: string;
248
+ }
249
+ export interface BridgeRuntimeReadinessResult {
250
+ readonly schemaVersion: 1;
251
+ readonly requestId: string;
252
+ readonly fencingToken: string;
253
+ readonly runnerInstanceId: string;
254
+ readonly status: "parallel_ready" | "serialized" | "failed";
255
+ readonly runtimeContractFingerprint?: string | null;
256
+ readonly runtimeContractSource?: string | null;
257
+ readonly reasonCode?: string | null;
258
+ readonly reasonMessage?: string | null;
259
+ readonly qaAppLaunchTarget?: BridgeRuntimeReadinessQaLaunchTarget | null;
260
+ readonly checkedAt: string;
261
+ }
262
+ export interface BridgeRuntimeReadinessQaLaunchTarget {
263
+ readonly managedRuntimePort: string;
264
+ readonly routes: readonly string[];
265
+ }
@@ -1,5 +1,17 @@
1
+ import { GitClient } from "../shared/git/git.js";
2
+ import type { WorktreeLifecycleCoordinator } from "../worktree/worktree.base.js";
1
3
  import type { CleanupService } from "./cleanup.base.js";
2
4
  import type { CleanupRequest, CleanupResult } from "./cleanup.types.js";
3
- export declare class NoopCleanupService implements CleanupService {
4
- run(_request: CleanupRequest): Promise<CleanupResult>;
5
+ export declare class ManagedWorktreeCleanupService implements CleanupService {
6
+ private readonly stateRoot;
7
+ private readonly git;
8
+ private readonly coordinator;
9
+ constructor(stateRoot?: string, git?: GitClient, coordinator?: WorktreeLifecycleCoordinator);
10
+ run(request: CleanupRequest): Promise<CleanupResult>;
11
+ private runLocked;
12
+ private listWorktrees;
13
+ private staleRuntimeReadinessPaths;
14
+ private scanManagedCandidates;
15
+ private readRuntimeLeases;
16
+ private worktreeMetadataRoot;
5
17
  }