refactor(process): extract reusable provider lifecycle primitives

Introduce provider-neutral ownership, private runtime roots, absolute startup deadlines, pending-operation correlation, bounded output capture, and verified TERM-to-KILL process supervision.\n\nMigrate Hopper onto the shared lifecycle pieces while keeping its Unix-socket protocol and health/shutdown parsing adapter-specific. Preserve exact ownership checks and fail-closed cleanup, including descendant cleanup after the launcher leader exits.\n\nAdd reusable process fixtures and deterministic coverage for startup timeout, cancellation, output bounds, exit diagnostics, cleanup escalation, repeated close, spawn failure, and resource disposal. Update architecture, provider evaluation, contributor guidance, and generated API documentation.
This commit is contained in:
N0zoM1z0
2026-07-15 23:20:48 +09:00
committed by N0zoM1z0
parent a7621c2633
commit 70e1a0f532
82 changed files with 3400 additions and 436 deletions
@@ -14,9 +14,15 @@
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography"><p>Process handle returned by a bridge launcher.</p>
</div></section>
<div class="tsd-signature"><span class="tsd-signature-keyword">interface</span> <span class="tsd-kind-interface">BridgeLaunch</span> <span class="tsd-signature-symbol">{</span><br/>    <a class="tsd-kind-property" href="#cleanup">cleanup</a><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../types/application_ProcessOwnership.ProcessCleanupResult.html" class="tsd-signature-type tsd-kind-type-alias">ProcessCleanupResult</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">;</span><br/>    <a class="tsd-kind-property" href="#ownsprocesslifetime">ownsProcessLifetime</a><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/>    <a class="tsd-kind-property" href="#process">process</a><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ChildProcess</span><span class="tsd-signature-symbol">;</span><br/>    <a class="tsd-kind-property" href="#shutdownbycleanup">shutdownByCleanup</a><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></div><aside class="tsd-sources">
<div class="tsd-signature"><span class="tsd-signature-keyword">interface</span> <span class="tsd-kind-interface">BridgeLaunch</span> <span class="tsd-signature-symbol">{</span><br/>    <a class="tsd-kind-property" href="#cleanup">cleanup</a><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../types/process_ProcessOwnership.ProcessCleanupResult.html" class="tsd-signature-type tsd-kind-type-alias">ProcessCleanupResult</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">;</span><br/>    <a class="tsd-kind-property" href="#ownsprocesslifetime">ownsProcessLifetime</a><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/>    <a class="tsd-kind-property" href="#process">process</a><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ChildProcess</span><span class="tsd-signature-symbol">;</span><br/>    <a class="tsd-kind-property" href="#shutdownbycleanup">shutdownByCleanup</a><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></div>
<section class="tsd-panel tsd-hierarchy" data-refl="24425">
<h4>Hierarchy (<a href="../hierarchy.html#hopper/BridgeLauncher.BridgeLaunch">View Summary</a>)</h4>
<ul class="tsd-hierarchy">
<li class="tsd-hierarchy-item"><a href="process_ProviderProcess.ProviderProcessLaunch.html" class="tsd-signature-type tsd-kind-interface">ProviderProcessLaunch</a>
<ul class="tsd-hierarchy">
<li class="tsd-hierarchy-item"><span class="tsd-hierarchy-target">BridgeLaunch</span></li></ul></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/hopper/BridgeLauncher.ts#L27">src/hopper/BridgeLauncher.ts:27</a></li></ul></aside>
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/hopper/BridgeLauncher.ts#L28">src/hopper/BridgeLauncher.ts:28</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>
@@ -24,36 +30,39 @@
<div class="tsd-accordion-details">
<section class="tsd-index-section">
<h3 class="tsd-index-heading tsd-anchor-link" id="properties">Properties<a href="#properties" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3>
<div class="tsd-index-list"><a href="#cleanup" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>cleanup?</span></a>
<a href="#ownsprocesslifetime" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>owns<wbr/>Process<wbr/>Lifetime</span></a>
<a href="#process" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>process</span></a>
<div class="tsd-index-list"><a href="#cleanup" class="tsd-index-link tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>cleanup?</span></a>
<a href="#ownsprocesslifetime" class="tsd-index-link tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>owns<wbr/>Process<wbr/>Lifetime</span></a>
<a href="#process" class="tsd-index-link tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>process</span></a>
<a href="#shutdownbycleanup" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>shutdown<wbr/>By<wbr/>Cleanup?</span></a>
</div></section></div></details></section></section>
<details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>
<h2 class="tsd-anchor-link" id="properties-1">Properties<a href="#properties-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2></summary>
<section>
<section class="tsd-panel tsd-member">
<section class="tsd-panel tsd-member tsd-is-inherited">
<h3 class="tsd-anchor-link" id="cleanup"><code class="tsd-tag">Optional</code> <code class="tsd-tag">Readonly</code><span>cleanup</span><a href="#cleanup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">cleanup</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../types/application_ProcessOwnership.ProcessCleanupResult.html" class="tsd-signature-type tsd-kind-type-alias">ProcessCleanupResult</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources">
<div class="tsd-signature"><span class="tsd-kind-property">cleanup</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">()</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../types/process_ProcessOwnership.ProcessCleanupResult.html" class="tsd-signature-type tsd-kind-type-alias">ProcessCleanupResult</a><span class="tsd-signature-symbol">&gt;</span></div><aside class="tsd-sources">
<p>Inherited from <a href="process_ProviderProcess.ProviderProcessLaunch.html">ProviderProcessLaunch</a>.<a href="process_ProviderProcess.ProviderProcessLaunch.html#cleanup">cleanup</a></p>
<ul>
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/hopper/BridgeLauncher.ts#L32">src/hopper/BridgeLauncher.ts:32</a></li></ul></aside></section>
<section class="tsd-panel tsd-member">
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/process/ProviderProcess.ts#L33">src/process/ProviderProcess.ts:33</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-is-inherited">
<h3 class="tsd-anchor-link" id="ownsprocesslifetime"><code class="tsd-tag">Readonly</code><span>owns<wbr/>Process<wbr/>Lifetime</span><a href="#ownsprocesslifetime" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">ownsProcessLifetime</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources">
<p>Inherited from <a href="process_ProviderProcess.ProviderProcessLaunch.html">ProviderProcessLaunch</a>.<a href="process_ProviderProcess.ProviderProcessLaunch.html#ownsprocesslifetime">ownsProcessLifetime</a></p>
<ul>
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/hopper/BridgeLauncher.ts#L29">src/hopper/BridgeLauncher.ts:29</a></li></ul></aside></section>
<section class="tsd-panel tsd-member">
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/process/ProviderProcess.ts#L32">src/process/ProviderProcess.ts:32</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-is-inherited">
<h3 class="tsd-anchor-link" id="process"><code class="tsd-tag">Readonly</code><span>process</span><a href="#process" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">process</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ChildProcess</span></div><aside class="tsd-sources">
<p>Inherited from <a href="process_ProviderProcess.ProviderProcessLaunch.html">ProviderProcessLaunch</a>.<a href="process_ProviderProcess.ProviderProcessLaunch.html#process">process</a></p>
<ul>
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/hopper/BridgeLauncher.ts#L28">src/hopper/BridgeLauncher.ts:28</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/process/ProviderProcess.ts#L31">src/process/ProviderProcess.ts:31</a></li></ul></aside></section>
<section class="tsd-panel tsd-member">
<h3 class="tsd-anchor-link" id="shutdownbycleanup"><code class="tsd-tag">Optional</code> <code class="tsd-tag">Readonly</code><span>shutdown<wbr/>By<wbr/>Cleanup</span><a href="#shutdownbycleanup" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">shutdownByCleanup</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div>
<div class="tsd-comment tsd-typography"><p>True when verified process cleanup completes bridge shutdown.</p>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/hopper/BridgeLauncher.ts#L31">src/hopper/BridgeLauncher.ts:31</a></li></ul></aside></section></section></details></div>
<li>Defined in <a href="https://github.com/morluto/rea/blob/main/src/hopper/BridgeLauncher.ts#L30">src/hopper/BridgeLauncher.ts:30</a></li></ul></aside></section></section></details></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
@@ -69,7 +78,7 @@
<h3>On This Page</h3></summary>
<div class="tsd-accordion-details">
<details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary>
<div><a href="#cleanup"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>cleanup</span></a><a href="#ownsprocesslifetime"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>owns<wbr/>Process<wbr/>Lifetime</span></a><a href="#process"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>process</span></a><a href="#shutdownbycleanup"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>shutdown<wbr/>By<wbr/>Cleanup</span></a></div></details></div></details></div>
<div><a href="#cleanup" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>cleanup</span></a><a href="#ownsprocesslifetime" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>owns<wbr/>Process<wbr/>Lifetime</span></a><a href="#process" class="tsd-is-inherited"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>process</span></a><a href="#shutdownbycleanup"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>shutdown<wbr/>By<wbr/>Cleanup</span></a></div></details></div></details></div>
<div class="site-menu">
<nav class="tsd-navigation"><a href="../index.html">rea-agents - v1.6.0</a>
<ul class="tsd-small-nested-navigation" id="tsd-nav-container">