@loucompanion/forge-bridge 0.1.3-dev.d1ca67076aa9 → 0.1.3-dev.e7b62d8fdd33

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 (170) hide show
  1. package/README.md +127 -0
  2. package/dist/bridge/bridge.base.d.ts +8 -1
  3. package/dist/bridge/bridge.service.d.ts +93 -3
  4. package/dist/bridge/bridge.service.js +1358 -47
  5. package/dist/bridge/bridge.types.d.ts +202 -1
  6. package/dist/bridge/runner-host-capabilities.d.ts +15 -0
  7. package/dist/bridge/runner-host-capabilities.js +93 -0
  8. package/dist/cleanup/cleanup.service.d.ts +14 -2
  9. package/dist/cleanup/cleanup.service.js +496 -3
  10. package/dist/cleanup/cleanup.types.d.ts +10 -0
  11. package/dist/cleanup/index.d.ts +1 -1
  12. package/dist/cleanup/index.js +1 -1
  13. package/dist/cleanup/internals.d.ts +2 -2
  14. package/dist/cleanup/internals.js +1 -1
  15. package/dist/cli/cli.help.js +47 -1
  16. package/dist/cli/cli.service.d.ts +45 -2
  17. package/dist/cli/cli.service.js +378 -26
  18. package/dist/cli/local-config.d.ts +7 -0
  19. package/dist/cli/local-config.js +51 -3
  20. package/dist/runtime/aspnet-runtime-prebuild.d.ts +36 -0
  21. package/dist/runtime/aspnet-runtime-prebuild.js +340 -0
  22. package/dist/runtime/attempt-node-runtime-launcher.d.ts +17 -0
  23. package/dist/runtime/attempt-node-runtime-launcher.js +105 -0
  24. package/dist/runtime/attempt-process-supervisor-registry.d.ts +20 -0
  25. package/dist/runtime/attempt-process-supervisor-registry.js +64 -0
  26. package/dist/runtime/attempt-process-supervisor.d.ts +97 -0
  27. package/dist/runtime/attempt-process-supervisor.js +386 -0
  28. package/dist/runtime/docker-engine-probe.d.ts +83 -0
  29. package/dist/runtime/docker-engine-probe.js +300 -0
  30. package/dist/runtime/generated-output-reset.d.ts +10 -0
  31. package/dist/runtime/generated-output-reset.js +103 -0
  32. package/dist/runtime/host-listener-inspector.d.ts +46 -0
  33. package/dist/runtime/host-listener-inspector.js +349 -0
  34. package/dist/runtime/host-port-broker.d.ts +76 -0
  35. package/dist/runtime/host-port-broker.js +333 -0
  36. package/dist/runtime/host-runtime-contract.d.ts +47 -0
  37. package/dist/runtime/host-runtime-contract.js +700 -0
  38. package/dist/runtime/host-runtime-lease.d.ts +197 -0
  39. package/dist/runtime/host-runtime-lease.js +2203 -0
  40. package/dist/runtime/host-runtime-promotion.d.ts +23 -0
  41. package/dist/runtime/host-runtime-promotion.js +159 -0
  42. package/dist/runtime/memory-capacity.d.ts +68 -0
  43. package/dist/runtime/memory-capacity.js +121 -0
  44. package/dist/runtime/node-host-runtime-adapter.d.ts +54 -0
  45. package/dist/runtime/node-host-runtime-adapter.js +284 -0
  46. package/dist/runtime/playwright-host-runtime-adapter.d.ts +21 -0
  47. package/dist/runtime/playwright-host-runtime-adapter.js +231 -0
  48. package/dist/runtime/runtime-isolation-lease.d.ts +67 -0
  49. package/dist/runtime/runtime-isolation-lease.js +158 -0
  50. package/dist/runtime/workspace-resource-estimator.d.ts +17 -0
  51. package/dist/runtime/workspace-resource-estimator.js +174 -0
  52. package/dist/sandbox/command-runner.d.ts +4 -0
  53. package/dist/sandbox/command-runner.js +47 -0
  54. package/dist/sandbox/contract.d.ts +5 -0
  55. package/dist/sandbox/contract.js +276 -0
  56. package/dist/sandbox/event-budget.d.ts +11 -0
  57. package/dist/sandbox/event-budget.js +27 -0
  58. package/dist/sandbox/image-policy.d.ts +35 -0
  59. package/dist/sandbox/image-policy.js +247 -0
  60. package/dist/sandbox/index.d.ts +5 -0
  61. package/dist/sandbox/index.js +5 -0
  62. package/dist/sandbox/lease-watchdog.d.ts +18 -0
  63. package/dist/sandbox/lease-watchdog.js +67 -0
  64. package/dist/sandbox/preflight.d.ts +84 -0
  65. package/dist/sandbox/preflight.js +521 -0
  66. package/dist/sandbox/process.d.ts +20 -0
  67. package/dist/sandbox/process.js +209 -0
  68. package/dist/sandbox/provider-auth/codex.d.ts +26 -0
  69. package/dist/sandbox/provider-auth/codex.js +212 -0
  70. package/dist/sandbox/repository-lock.d.ts +5 -0
  71. package/dist/sandbox/repository-lock.js +121 -0
  72. package/dist/sandbox/runtime.d.ts +297 -0
  73. package/dist/sandbox/runtime.js +2338 -0
  74. package/dist/sandbox/sandbox.types.d.ts +93 -0
  75. package/dist/sandbox/sandbox.types.js +1 -0
  76. package/dist/sandbox/smoke.d.ts +76 -0
  77. package/dist/sandbox/smoke.js +380 -0
  78. package/dist/sandbox/worker-supervisor.d.ts +13 -0
  79. package/dist/sandbox/worker-supervisor.js +36 -0
  80. package/dist/sandbox/worker.d.ts +1 -0
  81. package/dist/sandbox/worker.js +225 -0
  82. package/dist/sandbox/workspace.service.d.ts +13 -0
  83. package/dist/sandbox/workspace.service.js +72 -0
  84. package/dist/session/managed-attempt-tools.d.ts +21 -0
  85. package/dist/session/managed-attempt-tools.js +912 -0
  86. package/dist/session/managed-build-coordinator.d.ts +5 -0
  87. package/dist/session/managed-build-coordinator.js +105 -0
  88. package/dist/session/managed-build-receipt.d.ts +21 -0
  89. package/dist/session/managed-build-receipt.js +335 -0
  90. package/dist/session/phase-completion.artifacts.d.ts +17 -0
  91. package/dist/session/phase-completion.artifacts.js +256 -26
  92. package/dist/session/phase-completion.d.ts +12 -2
  93. package/dist/session/phase-completion.helpers.d.ts +5 -0
  94. package/dist/session/phase-completion.helpers.js +51 -10
  95. package/dist/session/phase-completion.js +14 -3
  96. package/dist/session/phase-completion.prompts.d.ts +3 -3
  97. package/dist/session/phase-completion.prompts.js +24 -8
  98. package/dist/session/phase-completion.runtime.d.ts +13 -1
  99. package/dist/session/phase-completion.runtime.js +189 -8
  100. package/dist/session/phase-completion.schemas.js +117 -4
  101. package/dist/session/phase-completion.validation.d.ts +4 -1
  102. package/dist/session/phase-completion.validation.js +153 -22
  103. package/dist/session/pre-publication-validation.d.ts +46 -0
  104. package/dist/session/pre-publication-validation.js +208 -0
  105. package/dist/session/provider-cli/ci-repair-readiness.d.ts +16 -0
  106. package/dist/session/provider-cli/ci-repair-readiness.js +110 -0
  107. package/dist/session/provider-cli/provider-cli.artifacts.d.ts +3 -2
  108. package/dist/session/provider-cli/provider-cli.artifacts.js +65 -7
  109. package/dist/session/provider-cli/provider-cli.base.d.ts +1 -0
  110. package/dist/session/provider-cli/provider-cli.deterministic.d.ts +2 -0
  111. package/dist/session/provider-cli/provider-cli.deterministic.js +68 -9
  112. package/dist/session/provider-cli/provider-cli.process.d.ts +26 -0
  113. package/dist/session/provider-cli/provider-cli.process.js +474 -23
  114. package/dist/session/provider-cli/provider-cli.prompts.d.ts +16 -2
  115. package/dist/session/provider-cli/provider-cli.prompts.js +224 -24
  116. package/dist/session/provider-cli/provider-cli.qa-sidecars.js +1 -0
  117. package/dist/session/provider-cli/provider-cli.repair-epoch.d.ts +6 -0
  118. package/dist/session/provider-cli/provider-cli.repair-epoch.js +11 -0
  119. package/dist/session/provider-cli/provider-cli.runtime.d.ts +1 -1
  120. package/dist/session/provider-cli/provider-cli.runtime.js +6 -3
  121. package/dist/session/provider-cli/provider-cli.service.d.ts +26 -3
  122. package/dist/session/provider-cli/provider-cli.service.js +650 -108
  123. package/dist/session/provider-cli/provider-cli.types.d.ts +6 -0
  124. package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
  125. package/dist/session/provider-cli/provider-output-state.js +91 -16
  126. package/dist/session/provider-cli/provider-usage.d.ts +7 -0
  127. package/dist/session/provider-cli/provider-usage.js +28 -5
  128. package/dist/session/session-redaction.d.ts +3 -0
  129. package/dist/session/session-redaction.js +38 -0
  130. package/dist/session/session.base.d.ts +6 -1
  131. package/dist/session/session.service.d.ts +8 -2
  132. package/dist/session/session.service.js +549 -58
  133. package/dist/session/session.types.d.ts +124 -1
  134. package/dist/session/session.types.js +231 -4
  135. package/dist/shared/format/format-bytes.d.ts +1 -0
  136. package/dist/shared/format/format-bytes.js +9 -0
  137. package/dist/shared/path/path.d.ts +1 -0
  138. package/dist/shared/path/path.js +21 -1
  139. package/dist/shared/process/dotnet-toolchain.d.ts +14 -0
  140. package/dist/shared/process/dotnet-toolchain.js +179 -0
  141. package/dist/shared/process/host-process-recovery.d.ts +12 -0
  142. package/dist/shared/process/host-process-recovery.js +78 -0
  143. package/dist/shared/process/host-process-supervisor.d.ts +59 -0
  144. package/dist/shared/process/host-process-supervisor.js +330 -0
  145. package/dist/shared/process/process.d.ts +1 -0
  146. package/dist/shared/process/process.js +1 -0
  147. package/dist/shared/process/windows-launch.d.ts +1 -1
  148. package/dist/shared/process/windows-launch.js +6 -3
  149. package/dist/shared/provider-capabilities.d.ts +1 -0
  150. package/dist/shared/provider-capabilities.js +3 -0
  151. package/dist/shared/redaction/redaction.js +16 -4
  152. package/dist/version.d.ts +1 -1
  153. package/dist/version.js +1 -1
  154. package/dist/worktree/artifact-injector.d.ts +3 -2
  155. package/dist/worktree/artifact-injector.js +43 -4
  156. package/dist/worktree/dependency-warmer.d.ts +39 -1
  157. package/dist/worktree/dependency-warmer.js +351 -8
  158. package/dist/worktree/index.d.ts +2 -1
  159. package/dist/worktree/index.js +1 -0
  160. package/dist/worktree/prior-phase-artifact-hydrator.d.ts +2 -0
  161. package/dist/worktree/prior-phase-artifact-hydrator.js +136 -0
  162. package/dist/worktree/worktree-paths.d.ts +4 -0
  163. package/dist/worktree/worktree-paths.js +30 -0
  164. package/dist/worktree/worktree.base.d.ts +3 -0
  165. package/dist/worktree/worktree.service.d.ts +13 -2
  166. package/dist/worktree/worktree.service.js +238 -47
  167. package/dist/worktree/worktree.types.d.ts +5 -1
  168. package/package.json +8 -4
  169. package/runtime/windows-job-supervisor.ps1 +444 -0
  170. package/runtime/windows-listener-owner.ps1 +33 -0
@@ -0,0 +1,197 @@
1
+ import type { RunOnceDispatchPacket } from "../session/session.types.js";
2
+ import { type ProviderProcessRunner } from "../session/provider-cli/provider-cli.process.js";
3
+ import { type RuntimeIsolationLease } from "./runtime-isolation-lease.js";
4
+ import { type LoadedHostRuntimeContract } from "./host-runtime-contract.js";
5
+ import { HostPortBroker } from "./host-port-broker.js";
6
+ import { NodeHostRuntimeAdapter, type NodeRuntimeAdapterLaunch, type NodeRuntimeCommand, type NodeRuntimeCommandLauncher } from "./node-host-runtime-adapter.js";
7
+ import type { AttemptProcessTreeMemoryTelemetry } from "./attempt-process-supervisor.js";
8
+ import { AttemptProcessSupervisorRegistry } from "./attempt-process-supervisor-registry.js";
9
+ import { HostListenerInspector } from "./host-listener-inspector.js";
10
+ import { type MemoryAdmissionDiagnostics } from "./memory-capacity.js";
11
+ import { PlaywrightHostRuntimeAdapter } from "./playwright-host-runtime-adapter.js";
12
+ import { HostParallelPromotionStore } from "./host-runtime-promotion.js";
13
+ import { type HostProcessRecovery } from "../shared/process/host-process-recovery.js";
14
+ export interface HostRuntimeLeaseStart {
15
+ readonly lease: RuntimeIsolationLease;
16
+ readonly environment: Readonly<Record<string, string>>;
17
+ readonly runtimeContract: LoadedHostRuntimeContract;
18
+ readonly executionClass: HostRuntimeExecutionClass;
19
+ }
20
+ export interface HostRuntimeAdmissionCheckpoint {
21
+ readonly code: "host_runtime_serial_admission_waiting";
22
+ readonly message: string;
23
+ readonly expiresAt: string;
24
+ }
25
+ export type HostRuntimeAdmissionCheckpointHandler = (checkpoint: HostRuntimeAdmissionCheckpoint) => void | Promise<void>;
26
+ export interface HostRuntimeProjectCheckpoint {
27
+ readonly code: "host_runtime_build_started" | "host_runtime_build_cached" | "host_runtime_build_completed";
28
+ readonly message: string;
29
+ readonly data?: Readonly<Record<string, unknown>>;
30
+ }
31
+ export type HostRuntimeProjectCheckpointHandler = (checkpoint: HostRuntimeProjectCheckpoint) => void | Promise<void>;
32
+ export type HostRuntimeExecutionClass = "analysis_only" | "managed_runtime";
33
+ export type HostRuntimeSafetyClass = "host_serial_only" | "host_parallel_candidate" | "host_parallel_safe";
34
+ export interface HostRuntimeProjectCapacitySnapshot {
35
+ readonly repoId: string;
36
+ readonly safetyClass: HostRuntimeSafetyClass;
37
+ readonly activeAttempts: number;
38
+ readonly reservedAttempts: number;
39
+ readonly waitingAttempts: number;
40
+ readonly degradedAttempts: number;
41
+ readonly runtimeContractFingerprint?: string | null;
42
+ readonly runtimeContractSource?: "project" | "derived" | null;
43
+ readonly promotedAt?: string | null;
44
+ }
45
+ export interface HostRuntimeCapacitySnapshot {
46
+ readonly activeAttempts: number;
47
+ readonly reservedAttempts: number;
48
+ readonly waitingAttempts: number;
49
+ readonly degradedAttempts: number;
50
+ readonly exclusiveReservations: number;
51
+ readonly sharedReservations: number;
52
+ readonly hardMaxAttempts: number;
53
+ readonly effectiveMaxAttempts: number;
54
+ readonly availableAttempts: number;
55
+ readonly totalMemoryBytes: number;
56
+ readonly availableMemoryBytes: number;
57
+ readonly hostReserveBytes: number;
58
+ readonly availableCpuMillis: number;
59
+ readonly availableWorkspaceBytes: number;
60
+ readonly activeReservationMemoryBytes: number;
61
+ readonly memoryAdmission: MemoryAdmissionDiagnostics;
62
+ readonly unavailableCode?: string | null;
63
+ readonly unavailableReason?: string | null;
64
+ readonly projects: readonly HostRuntimeProjectCapacitySnapshot[];
65
+ }
66
+ export interface HostRuntimeReapOptions {
67
+ readonly runnerId: string;
68
+ readonly runnerInstanceId: string;
69
+ readonly nowMs?: number;
70
+ }
71
+ export interface HostRuntimeReapReport {
72
+ readonly examined: number;
73
+ readonly reaped: number;
74
+ readonly processesTerminated: number;
75
+ readonly reusedPidsProtected: number;
76
+ readonly degraded: number;
77
+ }
78
+ export interface HostNodeRuntimeLaunch<T> extends NodeRuntimeAdapterLaunch<T> {
79
+ readonly runtimeLease: RuntimeIsolationLease;
80
+ }
81
+ export interface HostRuntimeLeaseRuntime {
82
+ acquire(dispatch: RunOnceDispatchPacket, signal?: AbortSignal): Promise<readonly string[]>;
83
+ start(dispatch: RunOnceDispatchPacket, worktreePath: string, signal?: AbortSignal, onAdmissionCheckpoint?: HostRuntimeAdmissionCheckpointHandler): Promise<HostRuntimeLeaseStart>;
84
+ startConfiguredProject(dispatchAttemptId: string, fencingToken: string, signal?: AbortSignal, onProjectCheckpoint?: HostRuntimeProjectCheckpointHandler): Promise<HostRuntimeLeaseStart>;
85
+ updateLease(dispatchAttemptId: string, fencingToken: string, expiresAt: string): Promise<void>;
86
+ providerProcessRunner?(dispatchAttemptId: string, fencingToken: string): ProviderProcessRunner | null;
87
+ providerMemoryTelemetry?(dispatchAttemptId: string, fencingToken: string): AttemptProcessTreeMemoryTelemetry | null;
88
+ release(dispatchAttemptId: string, fencingToken: string): Promise<RuntimeIsolationLease | null>;
89
+ invalidatePromotion?(repoId: string): Promise<void>;
90
+ hasForegroundDemand?(): boolean;
91
+ reap?(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport>;
92
+ snapshot?(): HostRuntimeCapacitySnapshot;
93
+ }
94
+ export interface HostCapacityResourceSample {
95
+ readonly totalMemoryBytes: number;
96
+ readonly availableMemoryBytes: number;
97
+ readonly totalCpuMillis: number;
98
+ readonly availableWorkspaceBytes: number;
99
+ }
100
+ export declare class HostRuntimeLeaseManager implements HostRuntimeLeaseRuntime {
101
+ private readonly stateRoot;
102
+ private readonly processSupervisors;
103
+ private readonly processRunner;
104
+ private readonly listenerInspector;
105
+ private readonly promotionStore;
106
+ private readonly playwrightAdapter;
107
+ private readonly processRecovery;
108
+ private readonly capacityResourceSample?;
109
+ private readonly active;
110
+ private readonly pendingRenewals;
111
+ private readonly acquiringAdmissions;
112
+ private readonly admissions;
113
+ private readonly singletonOwners;
114
+ private readonly singletonWaiters;
115
+ private readonly parallelProjectOwners;
116
+ private readonly parallelProjectWaiters;
117
+ private readonly capacityReservations;
118
+ private readonly capacityWaiters;
119
+ private capacityWaiterScanCursor;
120
+ private readonly backgroundAdmissionWaiters;
121
+ private readonly degraded;
122
+ private readonly knownPromotions;
123
+ private workspaceAvailableBytes;
124
+ private ambientMemoryCommitmentBytes;
125
+ private readonly portBroker;
126
+ private readonly nodeAdapter;
127
+ private readonly capacityConfiguration;
128
+ private readonly memoryAvailability;
129
+ constructor(stateRoot: string, portBroker?: HostPortBroker, nodeAdapter?: NodeHostRuntimeAdapter, processSupervisors?: AttemptProcessSupervisorRegistry, processRunner?: ProviderProcessRunner, listenerInspector?: HostListenerInspector, promotionStore?: HostParallelPromotionStore, playwrightAdapter?: PlaywrightHostRuntimeAdapter, processRecovery?: HostProcessRecovery, capacityResourceSample?: HostCapacityResourceSample | undefined);
130
+ reap(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport>;
131
+ snapshot(): HostRuntimeCapacitySnapshot;
132
+ hasForegroundDemand(): boolean;
133
+ acquire(dispatch: RunOnceDispatchPacket, signal?: AbortSignal): Promise<readonly string[]>;
134
+ private reserveHostCapacity;
135
+ private reserveBackgroundAdmission;
136
+ private hostCapacityAvailable;
137
+ private hostCapacityImpossibleReason;
138
+ private hostResourceSnapshot;
139
+ private refreshWorkspaceCapacity;
140
+ private releaseHostCapacity;
141
+ private drainCapacityWaiters;
142
+ private capacityWaitersForScan;
143
+ private detachCapacityWaiter;
144
+ private reserveSingletonKeys;
145
+ private reserveParallelProject;
146
+ private upgradeParallelProjectToSingleton;
147
+ start(dispatch: RunOnceDispatchPacket, worktreePath: string, signal?: AbortSignal, onAdmissionCheckpoint?: HostRuntimeAdmissionCheckpointHandler): Promise<HostRuntimeLeaseStart>;
148
+ updateLease(dispatchAttemptId: string, fencingToken: string, expiresAt: string): Promise<void>;
149
+ startConfiguredProject(dispatchAttemptId: string, fencingToken: string, signal?: AbortSignal, onProjectCheckpoint?: HostRuntimeProjectCheckpointHandler): Promise<HostRuntimeLeaseStart>;
150
+ providerProcessRunner(dispatchAttemptId: string, fencingToken: string): ProviderProcessRunner | null;
151
+ private markCapacityReservationRunning;
152
+ providerMemoryTelemetry(dispatchAttemptId: string, fencingToken: string): AttemptProcessTreeMemoryTelemetry | null;
153
+ private promoteVerifiedRuntime;
154
+ launchNodeRuntime<T>(dispatchAttemptId: string, fencingToken: string, portName: string, command: NodeRuntimeCommand, launcher: NodeRuntimeCommandLauncher<T>, signal?: AbortSignal): Promise<HostNodeRuntimeLaunch<T>>;
155
+ release(dispatchAttemptId: string, fencingToken: string): Promise<RuntimeIsolationLease | null>;
156
+ private readLedgers;
157
+ private recoverPersistedProcesses;
158
+ private markLedgerDegraded;
159
+ private rememberDegraded;
160
+ private forgetDegraded;
161
+ private attemptRoot;
162
+ private writeLedger;
163
+ private ledgerPath;
164
+ private singletonKeysAvailable;
165
+ private assignSingletonKeys;
166
+ private releaseSingletonKeys;
167
+ private convertSingletonToParallelProject;
168
+ private parallelProjectOwned;
169
+ private parallelProjectAvailable;
170
+ private assignParallelProject;
171
+ private releaseParallelProjectNoDrain;
172
+ private releaseParallelProjects;
173
+ private deleteAdmission;
174
+ private renewAdmissionWaiterDeadline;
175
+ private clearPendingRenewal;
176
+ private cancelAdmissionWaiters;
177
+ private drainSingletonWaiters;
178
+ private drainParallelProjectWaiters;
179
+ private drainBackgroundAdmissionWaiters;
180
+ private refreshKnownPromotions;
181
+ invalidatePromotion(repoId: string): Promise<void>;
182
+ private drainAdmissionWaiters;
183
+ private reconcileReservationOwners;
184
+ private reservationOwnerIsLive;
185
+ }
186
+ export declare class HostRuntimeLeaseCleanupError extends Error {
187
+ readonly lease: RuntimeIsolationLease;
188
+ constructor(lease: RuntimeIsolationLease, cause: unknown);
189
+ }
190
+ export declare class HostRuntimeAdmissionExpiredError extends Error {
191
+ constructor();
192
+ }
193
+ export declare class HostRuntimeCapacityRequestImpossibleError extends Error {
194
+ constructor(reason: string);
195
+ }
196
+ export declare function hostRuntimeEventResources(lease: RuntimeIsolationLease, runtimeContract?: LoadedHostRuntimeContract, executionClass?: HostRuntimeExecutionClass): Record<string, unknown>;
197
+ export declare function hostRuntimeSingletonKeys(dispatch: RunOnceDispatchPacket): readonly string[];