flock-core 0.4.514__py3-none-any.whl → 0.4.516__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of flock-core might be problematic. Click here for more details.
- flock/core/flock_factory.py +1 -2
- flock/tools/file_tools.py +10 -1
- flock/webapp/app/main.py +69 -1
- {flock_core-0.4.514.dist-info → flock_core-0.4.516.dist-info}/METADATA +1 -1
- {flock_core-0.4.514.dist-info → flock_core-0.4.516.dist-info}/RECORD +8 -8
- {flock_core-0.4.514.dist-info → flock_core-0.4.516.dist-info}/WHEEL +0 -0
- {flock_core-0.4.514.dist-info → flock_core-0.4.516.dist-info}/entry_points.txt +0 -0
- {flock_core-0.4.514.dist-info → flock_core-0.4.516.dist-info}/licenses/LICENSE +0 -0
flock/core/flock_factory.py
CHANGED
|
@@ -472,7 +472,6 @@ class FlockFactory:
|
|
|
472
472
|
schedule_expression: str, # e.g., "every 1h", "0 0 * * *"
|
|
473
473
|
description: str | Callable[..., str] | None = None,
|
|
474
474
|
model: str | Callable[..., str] | None = None,
|
|
475
|
-
input: SignatureType = None, # Input might be implicit or none
|
|
476
475
|
output: SignatureType = None, # Input might be implicit or none
|
|
477
476
|
tools: list[Callable[..., Any] | Any] | None = None,
|
|
478
477
|
servers: list[str | FlockMCPServerBase] | None = None,
|
|
@@ -496,7 +495,7 @@ class FlockFactory:
|
|
|
496
495
|
name=name,
|
|
497
496
|
description=description,
|
|
498
497
|
model=model,
|
|
499
|
-
input=
|
|
498
|
+
input="trigger_time: str | Time of scheduled execution",
|
|
500
499
|
output=output,
|
|
501
500
|
tools=tools,
|
|
502
501
|
servers=servers,
|
flock/tools/file_tools.py
CHANGED
|
@@ -23,10 +23,19 @@ def file_get_anything_as_markdown(url_or_file_path: str):
|
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
@traced_and_logged
|
|
27
|
+
def file_append_to_file(content: str, filename: str):
|
|
28
|
+
try:
|
|
29
|
+
with open(filename, "a", encoding="utf-8") as f:
|
|
30
|
+
f.write(content)
|
|
31
|
+
except Exception:
|
|
32
|
+
raise
|
|
33
|
+
|
|
34
|
+
|
|
26
35
|
@traced_and_logged
|
|
27
36
|
def file_save_to_file(content: str, filename: str):
|
|
28
37
|
try:
|
|
29
|
-
with open(filename, "w") as f:
|
|
38
|
+
with open(filename, "w", encoding="utf-8") as f:
|
|
30
39
|
f.write(content)
|
|
31
40
|
except Exception:
|
|
32
41
|
raise
|
flock/webapp/app/main.py
CHANGED
|
@@ -27,6 +27,70 @@ from fastapi.staticfiles import StaticFiles
|
|
|
27
27
|
from fastapi.templating import Jinja2Templates
|
|
28
28
|
from pydantic import BaseModel
|
|
29
29
|
|
|
30
|
+
# Custom middleware for handling proxy headers
|
|
31
|
+
# from starlette.middleware.base import BaseHTTPMiddleware
|
|
32
|
+
# from starlette.requests import Request as StarletteRequest
|
|
33
|
+
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware
|
|
34
|
+
|
|
35
|
+
# class ProxyHeadersMiddleware(BaseHTTPMiddleware):
|
|
36
|
+
# """Middleware to handle proxy headers for HTTPS detection.
|
|
37
|
+
# This ensures url_for() generates HTTPS URLs when behind an HTTPS proxy.
|
|
38
|
+
# """
|
|
39
|
+
# async def dispatch(self, request: StarletteRequest, call_next):
|
|
40
|
+
# import logging
|
|
41
|
+
# logger = logging.getLogger(__name__)
|
|
42
|
+
# # Log original scheme and relevant headers for debugging
|
|
43
|
+
# original_scheme = request.scope.get("scheme", "unknown")
|
|
44
|
+
# logger.debug(f"Original scheme: {original_scheme}, URL: {request.url}")
|
|
45
|
+
# # Check for common proxy headers that indicate HTTPS
|
|
46
|
+
# forwarded_proto = request.headers.get("x-forwarded-proto")
|
|
47
|
+
# forwarded_scheme = request.headers.get("x-forwarded-scheme")
|
|
48
|
+
# cloudflare_proto = request.headers.get("cf-visitor")
|
|
49
|
+
# # Log proxy headers for debugging
|
|
50
|
+
# proxy_headers = {
|
|
51
|
+
# "x-forwarded-proto": forwarded_proto,
|
|
52
|
+
# "x-forwarded-scheme": forwarded_scheme,
|
|
53
|
+
# "cf-visitor": cloudflare_proto,
|
|
54
|
+
# "x-forwarded-for": request.headers.get("x-forwarded-for"),
|
|
55
|
+
# "host": request.headers.get("host")
|
|
56
|
+
# }
|
|
57
|
+
# logger.debug(f"Proxy headers: {proxy_headers}")
|
|
58
|
+
# scheme_updated = False
|
|
59
|
+
# # Handle X-Forwarded-Proto header
|
|
60
|
+
# if forwarded_proto:
|
|
61
|
+
# # Update the request scope to reflect the original protocol
|
|
62
|
+
# request.scope["scheme"] = forwarded_proto.lower()
|
|
63
|
+
# scheme_updated = True
|
|
64
|
+
# logger.debug(f"Updated scheme from X-Forwarded-Proto: {forwarded_proto}")
|
|
65
|
+
# # Handle X-Forwarded-Scheme header
|
|
66
|
+
# elif forwarded_scheme:
|
|
67
|
+
# request.scope["scheme"] = forwarded_scheme.lower()
|
|
68
|
+
# scheme_updated = True
|
|
69
|
+
# logger.debug(f"Updated scheme from X-Forwarded-Scheme: {forwarded_scheme}")
|
|
70
|
+
# # Handle Cloudflare's CF-Visitor header (JSON format)
|
|
71
|
+
# elif cloudflare_proto:
|
|
72
|
+
# try:
|
|
73
|
+
# import json
|
|
74
|
+
# visitor_info = json.loads(cloudflare_proto)
|
|
75
|
+
# if visitor_info.get("scheme"):
|
|
76
|
+
# request.scope["scheme"] = visitor_info["scheme"].lower()
|
|
77
|
+
# scheme_updated = True
|
|
78
|
+
# logger.debug(f"Updated scheme from CF-Visitor: {visitor_info['scheme']}")
|
|
79
|
+
# except (json.JSONDecodeError, KeyError) as e:
|
|
80
|
+
# logger.warning(f"Failed to parse CF-Visitor header: {e}")
|
|
81
|
+
# if not scheme_updated:
|
|
82
|
+
# logger.debug("No proxy headers found, keeping original scheme")
|
|
83
|
+
# # Handle X-Forwarded-For for client IP (optional but good practice)
|
|
84
|
+
# forwarded_for = request.headers.get("x-forwarded-for")
|
|
85
|
+
# if forwarded_for:
|
|
86
|
+
# # Take the first IP in the chain (the original client)
|
|
87
|
+
# client_ip = forwarded_for.split(",")[0].strip()
|
|
88
|
+
# request.scope["client"] = (client_ip, request.scope.get("client", ["", 0])[1])
|
|
89
|
+
# # Log final scheme
|
|
90
|
+
# final_scheme = request.scope.get("scheme")
|
|
91
|
+
# logger.debug(f"Final scheme: {final_scheme}")
|
|
92
|
+
# response = await call_next(request)
|
|
93
|
+
# return response
|
|
30
94
|
from flock.core.api.endpoints import create_api_router
|
|
31
95
|
from flock.core.api.run_store import RunStore
|
|
32
96
|
|
|
@@ -293,7 +357,11 @@ async def lifespan(app: FastAPI):
|
|
|
293
357
|
|
|
294
358
|
app = FastAPI(title="Flock Web UI & API", lifespan=lifespan, docs_url="/docs",
|
|
295
359
|
openapi_url="/openapi.json", root_path=os.getenv("FLOCK_ROOT_PATH", ""))
|
|
296
|
-
|
|
360
|
+
|
|
361
|
+
# Add middleware for handling proxy headers (HTTPS detection)
|
|
362
|
+
app.add_middleware(ProxyHeadersMiddleware)
|
|
363
|
+
logger.info("FastAPI booting complete with proxy headers middleware.")
|
|
364
|
+
|
|
297
365
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
298
366
|
app.mount("/static", StaticFiles(directory=str(BASE_DIR / "static")), name="static")
|
|
299
367
|
templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
|
|
@@ -29,7 +29,7 @@ flock/core/__init__.py,sha256=juwyNr3QqKXUS5-E3hlMYRhgqHgQBqgtP12OF3tUCAI,1249
|
|
|
29
29
|
flock/core/flock.py,sha256=iR4i0_z0w2ns_iHbP7FqN--7wlsPIWch1H-BVecPs_I,38205
|
|
30
30
|
flock/core/flock_agent.py,sha256=Hl6TONSiJi2I-N_49-1hkW2q_hyPXMebMr-5oZLI-PY,48842
|
|
31
31
|
flock/core/flock_evaluator.py,sha256=TPy6u6XX3cqkY1r9NW1w2lTwCMNW7pxhFYKLefnEbXg,1820
|
|
32
|
-
flock/core/flock_factory.py,sha256=
|
|
32
|
+
flock/core/flock_factory.py,sha256=siCShld0mHPzjsw2_TUhg_nesMYhocJympt1M8ch6p8,18724
|
|
33
33
|
flock/core/flock_module.py,sha256=ObILimpVaPnaaqYvcBYJJ20lQzfrjgTdADplaNRjHU0,7448
|
|
34
34
|
flock/core/flock_registry.py,sha256=KzdFfc3QC-Dk42G24hdf6Prp3HvGj9ymXR3TTBe-T-A,27161
|
|
35
35
|
flock/core/flock_router.py,sha256=1OAXDsdaIIFApEfo6SRfFEDoTuGt3Si7n2MXiySEfis,2644
|
|
@@ -482,7 +482,7 @@ flock/themes/zenwritten-light.toml,sha256=G1iEheCPfBNsMTGaVpEVpDzYBHA_T-MV27rolU
|
|
|
482
482
|
flock/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
483
483
|
flock/tools/azure_tools.py,sha256=OTJsb0B4l70GcD1W3ZMDHWd3X8nEnszhhz2sllD2z9E,30187
|
|
484
484
|
flock/tools/code_tools.py,sha256=xLpuFl84y_GVzmIBe4qrr7h9wI3yWpM-M21GgEUjSjE,5247
|
|
485
|
-
flock/tools/file_tools.py,sha256=
|
|
485
|
+
flock/tools/file_tools.py,sha256=VYjT942NqDMTnizHiF41O4Af6ySseSvahRNVVrGMXl8,4850
|
|
486
486
|
flock/tools/github_tools.py,sha256=HH47-4K3HL6tRJhZhUttWDo2aloP9Hs12wRC_f_-Vkc,5329
|
|
487
487
|
flock/tools/markdown_tools.py,sha256=94fjGAJ5DEutoioD0ke-YRbxF6IWJQKuPVBLkNqdBo4,6345
|
|
488
488
|
flock/tools/system_tools.py,sha256=IUB8MiSxtQH5ZfTGOck3vl4TKva8m1lfU4-W5D5b-4w,202
|
|
@@ -495,7 +495,7 @@ flock/webapp/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
495
495
|
flock/webapp/app/chat.py,sha256=d5a_mr3H2nuWNFSpSlI_HyqX-J_4krndd4A-8S25EKM,28679
|
|
496
496
|
flock/webapp/app/config.py,sha256=lqmneujnNZk-EFJV5cWpvxkqisxH3T3zT_YOI0JYThE,4809
|
|
497
497
|
flock/webapp/app/dependencies.py,sha256=JUcwY1N6SZplU141lMN2wk9dOC9er5HCedrKTJN9wJk,5533
|
|
498
|
-
flock/webapp/app/main.py,sha256=
|
|
498
|
+
flock/webapp/app/main.py,sha256=9wRxzahWhD8fFjByyvMhJOjsll7u4GnW2peGw2DXgPE,60727
|
|
499
499
|
flock/webapp/app/models_ui.py,sha256=vrEBLbhEp6FziAgBSFOLT1M7ckwadsTdT7qus5_NduE,329
|
|
500
500
|
flock/webapp/app/theme_mapper.py,sha256=QzWwLWpED78oYp3FjZ9zxv1KxCyj43m8MZ0fhfzz37w,34302
|
|
501
501
|
flock/webapp/app/utils.py,sha256=RF8DMKKAj1XPmm4txUdo2OdswI1ATQ7cqUm6G9JFDzA,2942
|
|
@@ -561,8 +561,8 @@ flock/workflow/agent_execution_activity.py,sha256=Gy6FtuVAjf0NiUXmC3syS2eJpNQF4R
|
|
|
561
561
|
flock/workflow/flock_workflow.py,sha256=iSUF_soFvWar0ffpkzE4irkDZRx0p4HnwmEBi_Ne2sY,9666
|
|
562
562
|
flock/workflow/temporal_config.py,sha256=3_8O7SDEjMsSMXsWJBfnb6XTp0TFaz39uyzSlMTSF_I,3988
|
|
563
563
|
flock/workflow/temporal_setup.py,sha256=YIHnSBntzOchHfMSh8hoLeNXrz3B1UbR14YrR6soM7A,1606
|
|
564
|
-
flock_core-0.4.
|
|
565
|
-
flock_core-0.4.
|
|
566
|
-
flock_core-0.4.
|
|
567
|
-
flock_core-0.4.
|
|
568
|
-
flock_core-0.4.
|
|
564
|
+
flock_core-0.4.516.dist-info/METADATA,sha256=FsymlwNMAW5sjRvcs_PIRsIbL1w484HIeYIsMGrucx0,22786
|
|
565
|
+
flock_core-0.4.516.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
566
|
+
flock_core-0.4.516.dist-info/entry_points.txt,sha256=rWaS5KSpkTmWySURGFZk6PhbJ87TmvcFQDi2uzjlagQ,37
|
|
567
|
+
flock_core-0.4.516.dist-info/licenses/LICENSE,sha256=iYEqWy0wjULzM9GAERaybP4LBiPeu7Z1NEliLUdJKSc,1072
|
|
568
|
+
flock_core-0.4.516.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|