feat: Support .ducklake() and .datatable() in agent workers (#8697)
* Update clients to check for agent workers * fixes * typescript uses 127.0.0.1 * Refresh system prompts * fix: check both localhost and 127.0.0.1 in workerHasInternalServer detection Both Python and TypeScript clients now check for both hostnames to avoid silent breakage if BASE_INTERNAL_URL uses one or the other. Also adds return type annotation to the Python method. Co-authored-by: Diego Imbert <diegoimbert@users.noreply.github.com> * refresh system prompts * nit localhost regex boundary * fix: use provider.language instead of undefined bare language in sqlUtils The language variable was referenced as a bare identifier in the fetch calls, resolving to undefined at runtime instead of reading from provider.language. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Diego Imbert <diegoimbert@users.noreply.github.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,11 @@ class Windmill:
|
||||
f"workspace required as an argument or as WM_WORKSPACE environment variable"
|
||||
)
|
||||
|
||||
def worker_has_internal_server(self) -> bool:
|
||||
return bool(
|
||||
re.match(r"^https?://(localhost|127\.0\.0\.1)(:|/|$)", self.base_url or "")
|
||||
)
|
||||
|
||||
def get_mocked_api(self) -> Optional[dict]:
|
||||
mocked_path = os.environ.get("WM_MOCKED_API_FILE")
|
||||
if not mocked_path:
|
||||
@@ -326,8 +331,15 @@ class Windmill:
|
||||
language: str,
|
||||
args: dict = None,
|
||||
) -> Any:
|
||||
"""Run a script on the current worker without creating a job"""
|
||||
endpoint = f"/w/{self.workspace}/jobs/run_inline/preview"
|
||||
"""Run a script on the current worker without creating a job.
|
||||
|
||||
On agent workers (no internal server), falls back to running a normal
|
||||
preview job and waiting for the result.
|
||||
"""
|
||||
if self.worker_has_internal_server():
|
||||
endpoint = f"/w/{self.workspace}/jobs/run_inline/preview"
|
||||
else:
|
||||
endpoint = f"/w/{self.workspace}/jobs/run_wait_result/preview"
|
||||
body = {
|
||||
"content": content,
|
||||
"language": language,
|
||||
|
||||
Reference in New Issue
Block a user