@loucompanion/forge-bridge 0.1.3-dev.d46a8e73d03d → 0.1.3-dev.eeefdb0d19c1

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 (118) hide show
  1. package/README.md +34 -0
  2. package/dist/bridge/bridge.base.d.ts +2 -1
  3. package/dist/bridge/bridge.service.d.ts +22 -3
  4. package/dist/bridge/bridge.service.js +416 -40
  5. package/dist/bridge/bridge.types.d.ts +59 -1
  6. package/dist/cleanup/cleanup.service.d.ts +13 -2
  7. package/dist/cleanup/cleanup.service.js +435 -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 +37 -3
  14. package/dist/cli/cli.service.d.ts +30 -2
  15. package/dist/cli/cli.service.js +182 -23
  16. package/dist/cli/local-config.d.ts +4 -0
  17. package/dist/cli/local-config.js +41 -1
  18. package/dist/runtime/attempt-node-runtime-launcher.d.ts +17 -0
  19. package/dist/runtime/attempt-node-runtime-launcher.js +101 -0
  20. package/dist/runtime/attempt-process-supervisor-registry.d.ts +20 -0
  21. package/dist/runtime/attempt-process-supervisor-registry.js +64 -0
  22. package/dist/runtime/attempt-process-supervisor.d.ts +86 -0
  23. package/dist/runtime/attempt-process-supervisor.js +343 -0
  24. package/dist/runtime/generated-output-reset.d.ts +10 -0
  25. package/dist/runtime/generated-output-reset.js +103 -0
  26. package/dist/runtime/host-listener-inspector.d.ts +44 -0
  27. package/dist/runtime/host-listener-inspector.js +324 -0
  28. package/dist/runtime/host-port-broker.d.ts +76 -0
  29. package/dist/runtime/host-port-broker.js +333 -0
  30. package/dist/runtime/host-runtime-contract.d.ts +47 -0
  31. package/dist/runtime/host-runtime-contract.js +700 -0
  32. package/dist/runtime/host-runtime-lease.d.ts +133 -0
  33. package/dist/runtime/host-runtime-lease.js +1460 -0
  34. package/dist/runtime/host-runtime-promotion.d.ts +23 -0
  35. package/dist/runtime/host-runtime-promotion.js +159 -0
  36. package/dist/runtime/node-host-runtime-adapter.d.ts +51 -0
  37. package/dist/runtime/node-host-runtime-adapter.js +268 -0
  38. package/dist/runtime/playwright-host-runtime-adapter.d.ts +20 -0
  39. package/dist/runtime/playwright-host-runtime-adapter.js +220 -0
  40. package/dist/runtime/runtime-isolation-lease.d.ts +67 -0
  41. package/dist/runtime/runtime-isolation-lease.js +158 -0
  42. package/dist/sandbox/preflight.d.ts +14 -0
  43. package/dist/sandbox/preflight.js +91 -12
  44. package/dist/sandbox/process.js +125 -40
  45. package/dist/sandbox/repository-lock.js +37 -1
  46. package/dist/sandbox/runtime.d.ts +66 -3
  47. package/dist/sandbox/runtime.js +670 -105
  48. package/dist/sandbox/sandbox.types.d.ts +3 -0
  49. package/dist/sandbox/smoke.d.ts +76 -0
  50. package/dist/sandbox/smoke.js +380 -0
  51. package/dist/sandbox/worker-supervisor.js +1 -1
  52. package/dist/sandbox/worker.js +2 -5
  53. package/dist/sandbox/workspace.service.d.ts +1 -0
  54. package/dist/sandbox/workspace.service.js +28 -5
  55. package/dist/session/managed-attempt-tools.d.ts +12 -0
  56. package/dist/session/managed-attempt-tools.js +350 -0
  57. package/dist/session/phase-completion.artifacts.js +9 -2
  58. package/dist/session/phase-completion.d.ts +4 -2
  59. package/dist/session/phase-completion.helpers.js +27 -3
  60. package/dist/session/phase-completion.js +12 -3
  61. package/dist/session/phase-completion.prompts.d.ts +3 -3
  62. package/dist/session/phase-completion.prompts.js +19 -5
  63. package/dist/session/phase-completion.runtime.d.ts +12 -1
  64. package/dist/session/phase-completion.runtime.js +127 -7
  65. package/dist/session/phase-completion.schemas.js +108 -3
  66. package/dist/session/phase-completion.validation.d.ts +4 -1
  67. package/dist/session/phase-completion.validation.js +106 -2
  68. package/dist/session/provider-cli/ci-repair-readiness.d.ts +8 -0
  69. package/dist/session/provider-cli/ci-repair-readiness.js +90 -0
  70. package/dist/session/provider-cli/provider-cli.artifacts.d.ts +1 -1
  71. package/dist/session/provider-cli/provider-cli.artifacts.js +28 -4
  72. package/dist/session/provider-cli/provider-cli.deterministic.js +47 -1
  73. package/dist/session/provider-cli/provider-cli.process.d.ts +16 -0
  74. package/dist/session/provider-cli/provider-cli.process.js +212 -25
  75. package/dist/session/provider-cli/provider-cli.prompts.d.ts +4 -1
  76. package/dist/session/provider-cli/provider-cli.prompts.js +84 -17
  77. package/dist/session/provider-cli/provider-cli.qa-sidecars.js +1 -0
  78. package/dist/session/provider-cli/provider-cli.runtime.d.ts +1 -1
  79. package/dist/session/provider-cli/provider-cli.runtime.js +3 -2
  80. package/dist/session/provider-cli/provider-cli.service.d.ts +3 -2
  81. package/dist/session/provider-cli/provider-cli.service.js +254 -71
  82. package/dist/session/provider-cli/provider-cli.types.d.ts +5 -0
  83. package/dist/session/provider-cli/provider-output-state.d.ts +2 -0
  84. package/dist/session/provider-cli/provider-output-state.js +30 -2
  85. package/dist/session/session-redaction.d.ts +3 -0
  86. package/dist/session/session-redaction.js +23 -0
  87. package/dist/session/session.base.d.ts +6 -1
  88. package/dist/session/session.service.d.ts +8 -2
  89. package/dist/session/session.service.js +436 -41
  90. package/dist/session/session.types.d.ts +55 -0
  91. package/dist/session/session.types.js +69 -2
  92. package/dist/shared/path/path.js +3 -1
  93. package/dist/shared/process/host-process-recovery.d.ts +12 -0
  94. package/dist/shared/process/host-process-recovery.js +78 -0
  95. package/dist/shared/process/host-process-supervisor.d.ts +57 -0
  96. package/dist/shared/process/host-process-supervisor.js +282 -0
  97. package/dist/shared/process/process.d.ts +1 -0
  98. package/dist/shared/process/process.js +1 -0
  99. package/dist/shared/redaction/redaction.js +6 -1
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/dist/worktree/artifact-injector.d.ts +3 -2
  103. package/dist/worktree/artifact-injector.js +43 -4
  104. package/dist/worktree/dependency-warmer.d.ts +10 -1
  105. package/dist/worktree/dependency-warmer.js +94 -5
  106. package/dist/worktree/index.d.ts +1 -0
  107. package/dist/worktree/index.js +1 -0
  108. package/dist/worktree/prior-phase-artifact-hydrator.d.ts +2 -0
  109. package/dist/worktree/prior-phase-artifact-hydrator.js +136 -0
  110. package/dist/worktree/worktree-paths.d.ts +4 -0
  111. package/dist/worktree/worktree-paths.js +30 -0
  112. package/dist/worktree/worktree.base.d.ts +3 -0
  113. package/dist/worktree/worktree.service.d.ts +7 -2
  114. package/dist/worktree/worktree.service.js +72 -44
  115. package/dist/worktree/worktree.types.d.ts +3 -1
  116. package/package.json +3 -2
  117. package/runtime/windows-job-supervisor.ps1 +356 -0
  118. package/runtime/windows-listener-owner.ps1 +33 -0
@@ -0,0 +1,133 @@
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 { AttemptProcessSupervisorRegistry } from "./attempt-process-supervisor-registry.js";
8
+ import { HostListenerInspector } from "./host-listener-inspector.js";
9
+ import { PlaywrightHostRuntimeAdapter } from "./playwright-host-runtime-adapter.js";
10
+ import { HostParallelPromotionStore } from "./host-runtime-promotion.js";
11
+ import { type HostProcessRecovery } from "../shared/process/host-process-recovery.js";
12
+ export interface HostRuntimeLeaseStart {
13
+ readonly lease: RuntimeIsolationLease;
14
+ readonly environment: Readonly<Record<string, string>>;
15
+ readonly runtimeContract: LoadedHostRuntimeContract;
16
+ readonly executionClass: HostRuntimeExecutionClass;
17
+ }
18
+ export type HostRuntimeExecutionClass = "analysis_only" | "managed_runtime";
19
+ export type HostRuntimeSafetyClass = "host_serial_only" | "host_parallel_candidate" | "host_parallel_safe";
20
+ export interface HostRuntimeProjectCapacitySnapshot {
21
+ readonly repoId: string;
22
+ readonly safetyClass: HostRuntimeSafetyClass;
23
+ readonly activeAttempts: number;
24
+ readonly reservedAttempts: number;
25
+ readonly waitingAttempts: number;
26
+ readonly degradedAttempts: number;
27
+ readonly runtimeContractFingerprint?: string | null;
28
+ readonly runtimeContractSource?: "project" | "derived" | null;
29
+ readonly promotedAt?: string | null;
30
+ }
31
+ export interface HostRuntimeCapacitySnapshot {
32
+ readonly activeAttempts: number;
33
+ readonly reservedAttempts: number;
34
+ readonly waitingAttempts: number;
35
+ readonly degradedAttempts: number;
36
+ readonly exclusiveReservations: number;
37
+ readonly sharedReservations: number;
38
+ readonly projects: readonly HostRuntimeProjectCapacitySnapshot[];
39
+ }
40
+ export interface HostRuntimeReapOptions {
41
+ readonly runnerId: string;
42
+ readonly runnerInstanceId: string;
43
+ readonly nowMs?: number;
44
+ }
45
+ export interface HostRuntimeReapReport {
46
+ readonly examined: number;
47
+ readonly reaped: number;
48
+ readonly processesTerminated: number;
49
+ readonly reusedPidsProtected: number;
50
+ readonly degraded: number;
51
+ }
52
+ export interface HostNodeRuntimeLaunch<T> extends NodeRuntimeAdapterLaunch<T> {
53
+ readonly runtimeLease: RuntimeIsolationLease;
54
+ }
55
+ export interface HostRuntimeLeaseRuntime {
56
+ acquire(dispatch: RunOnceDispatchPacket, signal?: AbortSignal): Promise<readonly string[]>;
57
+ start(dispatch: RunOnceDispatchPacket, worktreePath: string, signal?: AbortSignal): Promise<HostRuntimeLeaseStart>;
58
+ startConfiguredProject(dispatchAttemptId: string, fencingToken: string, signal?: AbortSignal): Promise<HostRuntimeLeaseStart>;
59
+ updateLease(dispatchAttemptId: string, fencingToken: string, expiresAt: string): Promise<void>;
60
+ providerProcessRunner?(dispatchAttemptId: string, fencingToken: string): ProviderProcessRunner | null;
61
+ release(dispatchAttemptId: string, fencingToken: string): Promise<RuntimeIsolationLease | null>;
62
+ invalidatePromotion?(repoId: string): Promise<void>;
63
+ reap?(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport>;
64
+ snapshot?(): HostRuntimeCapacitySnapshot;
65
+ }
66
+ export declare class HostRuntimeLeaseManager implements HostRuntimeLeaseRuntime {
67
+ private readonly stateRoot;
68
+ private readonly processSupervisors;
69
+ private readonly processRunner;
70
+ private readonly listenerInspector;
71
+ private readonly promotionStore;
72
+ private readonly playwrightAdapter;
73
+ private readonly processRecovery;
74
+ private readonly active;
75
+ private readonly pendingRenewals;
76
+ private readonly admissions;
77
+ private readonly singletonOwners;
78
+ private readonly singletonWaiters;
79
+ private readonly parallelProjectOwners;
80
+ private readonly parallelProjectWaiters;
81
+ private readonly degraded;
82
+ private readonly knownPromotions;
83
+ private readonly portBroker;
84
+ private readonly nodeAdapter;
85
+ constructor(stateRoot: string, portBroker?: HostPortBroker, nodeAdapter?: NodeHostRuntimeAdapter, processSupervisors?: AttemptProcessSupervisorRegistry, processRunner?: ProviderProcessRunner, listenerInspector?: HostListenerInspector, promotionStore?: HostParallelPromotionStore, playwrightAdapter?: PlaywrightHostRuntimeAdapter, processRecovery?: HostProcessRecovery);
86
+ reap(options: HostRuntimeReapOptions): Promise<HostRuntimeReapReport>;
87
+ snapshot(): HostRuntimeCapacitySnapshot;
88
+ acquire(dispatch: RunOnceDispatchPacket, signal?: AbortSignal): Promise<readonly string[]>;
89
+ private reserveSingletonKeys;
90
+ private reserveParallelProject;
91
+ start(dispatch: RunOnceDispatchPacket, worktreePath: string, signal?: AbortSignal): Promise<HostRuntimeLeaseStart>;
92
+ updateLease(dispatchAttemptId: string, fencingToken: string, expiresAt: string): Promise<void>;
93
+ startConfiguredProject(dispatchAttemptId: string, fencingToken: string, signal?: AbortSignal): Promise<HostRuntimeLeaseStart>;
94
+ providerProcessRunner(dispatchAttemptId: string, fencingToken: string): ProviderProcessRunner | null;
95
+ private promoteVerifiedRuntime;
96
+ launchNodeRuntime<T>(dispatchAttemptId: string, fencingToken: string, portName: string, command: NodeRuntimeCommand, launcher: NodeRuntimeCommandLauncher<T>, signal?: AbortSignal): Promise<HostNodeRuntimeLaunch<T>>;
97
+ release(dispatchAttemptId: string, fencingToken: string): Promise<RuntimeIsolationLease | null>;
98
+ private readLedgers;
99
+ private recoverPersistedProcesses;
100
+ private markLedgerDegraded;
101
+ private rememberDegraded;
102
+ private forgetDegraded;
103
+ private attemptRoot;
104
+ private writeLedger;
105
+ private ledgerPath;
106
+ private singletonKeysAvailable;
107
+ private assignSingletonKeys;
108
+ private releaseSingletonKeys;
109
+ private convertSingletonToParallelProject;
110
+ private parallelProjectOwned;
111
+ private parallelProjectAvailable;
112
+ private assignParallelProject;
113
+ private releaseParallelProjectNoDrain;
114
+ private releaseParallelProjects;
115
+ private deleteAdmission;
116
+ private renewAdmissionWaiterDeadline;
117
+ private clearPendingRenewal;
118
+ private cancelAdmissionWaiters;
119
+ private drainSingletonWaiters;
120
+ private drainParallelProjectWaiters;
121
+ private refreshKnownPromotions;
122
+ invalidatePromotion(repoId: string): Promise<void>;
123
+ private drainAdmissionWaiters;
124
+ }
125
+ export declare class HostRuntimeLeaseCleanupError extends Error {
126
+ readonly lease: RuntimeIsolationLease;
127
+ constructor(lease: RuntimeIsolationLease, cause: unknown);
128
+ }
129
+ export declare class HostRuntimeAdmissionExpiredError extends Error {
130
+ constructor();
131
+ }
132
+ export declare function hostRuntimeEventResources(lease: RuntimeIsolationLease, runtimeContract?: LoadedHostRuntimeContract, executionClass?: HostRuntimeExecutionClass): Record<string, unknown>;
133
+ export declare function hostRuntimeSingletonKeys(dispatch: RunOnceDispatchPacket): readonly string[];