Extract headless cloud prompt server shims

This commit is contained in:
Ken Simpson
2026-08-29 11:48:46 -07:00
parent b7a1535586
commit bb59b94de7
5 changed files with 549 additions and 464 deletions
+1
View File
@@ -666,3 +666,4 @@
- Modal image policy is easier to verify when path filtering, environment construction, dependency layering, secrets, and class options move together. The stable entrypoint can keep constructing the actual `modal.Image` and decorators while importing these pure builders, preserving deployment shape without mixing it into runtime execution logic.
- Durable invocation extraction has two stable-boundary concerns: mutable fallback stores must move with the lifecycle functions that use them, while public cloud exception classes must stay in the entrypoint. Inject the exception factories once after those classes are defined, and patch the extracted state owner in tests; compatibility re-exports are call surfaces, not mutable-state aliases.
- Session-bridge replay crosses bootstrap and prompt-execution boundaries, but those upward calls do not justify importing the cloud entrypoint. Inject the narrow cloning, logging, graph, and execution callbacks after module initialization; keep bridge values, replay stacks, snapshot profiles, and their locks private to the session owner, and make tests patch that owner directly.
- Headless PromptServer compatibility is a distinct adapter boundary: custom-node imports need a queue and route surface, while PromptExecutor needs progress, preview, and boundary-output tracing. Move those shims together and inject only cache-slot normalization, progress filtering, and cloud logging so neither the shim module nor its tests depend on the monolithic entrypoint.