Add support for creating stateless backends#150
Conversation
Confidence Score: 5/5 - Safe to MergeSafe to merge — this PR adds support for creating stateless backends and has passed automated review without any identified issues. The implementation appears clean with no logic bugs, security concerns, or correctness problems flagged by the review system. No pre-existing unresolved comments carry over into this PR's scope. Key Findings:
|
|
this is good, we need to make sure tihs work all the way to this repo https://github.com/mindsdb/cowork |
EntelligenceAI PR SummaryThis PR adds fullstack (FastAPI) artifact support to Anton, extending publishing, backend lifecycle management, LLM prompts, and the artifact metadata model.
Confidence Score: 5/5 - Safe to MergeSafe to merge — this PR adds support for creating stateless backends and has passed automated review with zero issues identified across all analysis dimensions. The implementation appears clean with no logic bugs, security concerns, or correctness problems flagged by either heuristic analysis or line-by-line review. No pre-existing unresolved comments are associated with this change. Key Findings:
|
ZoranPandovski
left a comment
There was a problem hiding this comment.
I've addded few comments but otherwise ready to merge
| return uuid.uuid4().hex[:8] | ||
|
|
||
|
|
||
| _UNSET = object() |
There was a problem hiding this comment.
Can we use pydantic dataclass instead of _UNSET ?
Summary
Adds the ability to generate, launch, and publish artifacts with a real backend process — not just static HTML. Introduces two new artifact types (
fullstack-stateless-app,fullstack-stateful-app), alaunch_backendtool, and fullstack-aware publishing with datasource-secret resolution.NOTE: In the future, fullstack artifacts generation is planned to be moved to a separate tool. This will enable us to ensure that the artifact code contains all the necessary code required for publishing. Work on this is being conducted in a separate branch feat/stateless_backend_creation_tool.
Core changes
Backend launching
core/artifacts/backend_launcher.py— standalone helper (decoupled via aScratchpadPoolLikeProtocol so cowork can reuse it): installsrequirements.txtinto the scratchpad venv, picks a free port, spawnsbackend.py --port N, runs an HTTP→TCP readiness probe, and idempotently reaps any prior process for the slug.launch_backendtool wiring it into aChatSession; tracked backends are reaped insession.close().ScratchpadRuntime.venv_python()/LocalScratchpadRuntime.ensure_venv()/ScratchpadManager.venv_python()expose the venv interpreter to auxiliary processes.Artifact metadata
DatasourceRefmodel +portanddatasourcesfields onArtifact.set_artifact_primarytool/handler/store-method generalized toupdate_artifact(primary+port+datasources), using an_UNSETsentinel so only passed fields change.schemaVersionfield (+METADATA_SCHEMA_VERSIONconstant) to version the on-disk layout for future migrations; legacy files load as v1.Publishing
publisher.publish()detects fullstack artifacts and bundlesbackend.py+static/+requirements.txt, resolvingDS_*__FIELDsecrets from the local vault into the JSON body (secrets travel beside the zip, not inside it). Sendspython_version./publishnow lists/selects both HTML reports and fullstack artifacts; explicitly publishing a fullstack app'sstatic/index.htmlcorrectly publishes the whole bundle instead of the orphaned frontend..py/.txtadded to credential-scrubbed extensions.Prompts
ARTIFACTScontract andBACKEND_GENERATIONguidance;output_contextreplaced byoutput_dirthreaded through the session config.Fixes
scrub_credentialsnow uses word-boundary regex (avoids over-eager substring redaction of short secrets) while keeping the empty-value guard (a registered-but-unset secret var no longer corrupts output).