mirror of
https://github.com/hanzoai/papers.git
synced 2026-11-02 00:27:07 +00:00
34 lines
1.2 KiB
TeX
34 lines
1.2 KiB
TeX
\section{Complete Tier 1 Hot-Reload Implementation}
|
|
|
|
\label{app:tier1}
|
|
|
|
\begin{algorithm}[H]
|
|
\caption{Tier 1: Runtime Tool Hot-Reload}
|
|
\label{alg:tier1}
|
|
\begin{algorithmic}[1]
|
|
\Require Friction event $\mathcal{F}$, agent tool registry $\mathcal{T}$
|
|
\Ensure New tool registered if valid; session state unchanged
|
|
\State $\text{spec} \gets \text{GenerateToolSpec}(\mathcal{F})$
|
|
\Comment{LLM generates JSON Schema}
|
|
\State $\text{impl} \gets \text{GenerateImplementation}(\text{spec}, \mathcal{F})$
|
|
\Comment{LLM writes TypeScript}
|
|
\State $\mathcal{C} \gets \text{ExtractTriggerCases}(\mathcal{F})$
|
|
\Comment{Cases from friction context}
|
|
\State $\text{passed} \gets 0$
|
|
\For{$c \in \mathcal{C}$}
|
|
\State $\text{out} \gets \text{SandboxExec}(\text{impl}, c.\text{input})$
|
|
\If{$\text{out} = c.\text{expected}$}
|
|
\State $\text{passed} \gets \text{passed} + 1$
|
|
\EndIf
|
|
\EndFor
|
|
\If{$\text{passed} < |\mathcal{C}|$}
|
|
\State \Return \textbf{fail} with diff of expected vs.\ actual
|
|
\EndIf
|
|
\State $\rho \gets (\text{spec}, \text{impl}, \mathcal{C}, \text{now}(), 7\text{d})$
|
|
\State $\mathcal{T}.\text{register}(\rho)$
|
|
\Comment{Hot-load into active session}
|
|
\State \Return \textbf{success}
|
|
\end{algorithmic}
|
|
\end{algorithm}
|
|
|