fusion-artifacts-engine 0.7.18__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.
- fusion_artifacts_engine/__init__.py +0 -0
- fusion_artifacts_engine/__main__.py +263 -0
- fusion_artifacts_engine/ai_client.py +54 -0
- fusion_artifacts_engine/auto_identifier.py +148 -0
- fusion_artifacts_engine/compactor.py +164 -0
- fusion_artifacts_engine/config.py +462 -0
- fusion_artifacts_engine/default_config.yaml +144 -0
- fusion_artifacts_engine/dsl_parser.py +231 -0
- fusion_artifacts_engine/engine.py +1372 -0
- fusion_artifacts_engine/gateway_client.py +396 -0
- fusion_artifacts_engine/ipc_consumer.py +321 -0
- fusion_artifacts_engine/long_context.py +392 -0
- fusion_artifacts_engine/metrics.py +144 -0
- fusion_artifacts_engine/models.py +168 -0
- fusion_artifacts_engine/office_ingest.py +365 -0
- fusion_artifacts_engine/rate_limiter.py +82 -0
- fusion_artifacts_engine/ref_parser.py +77 -0
- fusion_artifacts_engine/render.py +184 -0
- fusion_artifacts_engine/rpc/__init__.py +0 -0
- fusion_artifacts_engine/rpc/errors.py +61 -0
- fusion_artifacts_engine/rpc/event_bus.py +95 -0
- fusion_artifacts_engine/rpc/methods.py +1365 -0
- fusion_artifacts_engine/rpc/server.py +1279 -0
- fusion_artifacts_engine/section_index.py +189 -0
- fusion_artifacts_engine/share.py +326 -0
- fusion_artifacts_engine/storage/__init__.py +0 -0
- fusion_artifacts_engine/storage/base.py +270 -0
- fusion_artifacts_engine/storage/sqlite_storage.py +2813 -0
- fusion_artifacts_engine/token_budget.py +119 -0
- fusion_artifacts_engine/token_counter.py +80 -0
- fusion_artifacts_engine/tracing.py +132 -0
- fusion_artifacts_engine/utils.py +170 -0
- fusion_artifacts_engine/visual_dispatcher.py +135 -0
- fusion_artifacts_engine/visual_error_boundary.py +52 -0
- fusion_artifacts_engine/visual_primitives/__init__.py +34 -0
- fusion_artifacts_engine/visual_primitives/array_grid.py +66 -0
- fusion_artifacts_engine/visual_primitives/base.py +79 -0
- fusion_artifacts_engine/visual_primitives/bucket_divider.py +66 -0
- fusion_artifacts_engine/visual_primitives/data_chart.py +65 -0
- fusion_artifacts_engine/visual_primitives/flow_card.py +101 -0
- fusion_artifacts_engine/visual_primitives/geometry_2d.py +80 -0
- fusion_artifacts_engine/visual_primitives/isometric_3d.py +82 -0
- fusion_artifacts_engine/visual_primitives/tape_diagram.py +58 -0
- fusion_artifacts_engine/visual_primitives/track_timeline.py +58 -0
- fusion_artifacts_engine/webui_dist/assets/abnfDiagram-WEYOIA3C-2ebtMp5N.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/architectureDiagram-ZHVYKT53-COvSzFYy.js +36 -0
- fusion_artifacts_engine/webui_dist/assets/blockDiagram-RJAE7QA3-CsO2Iy8b.js +140 -0
- fusion_artifacts_engine/webui_dist/assets/c4Diagram-XDPPPE54-dFggQosH.js +38 -0
- fusion_artifacts_engine/webui_dist/assets/channel-BXYZthxM.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-2E7WHVMD-B93QdjG6.js +88 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-2Q5K7J3B-DHEJLJup.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-4EMNKR2T-OGUUH-PY.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-55XCU76K-CKbux1-g.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-5VM5RSS4-CPHhHyIF.js +15 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-JWPE2WC7-CJSxuarC.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-VQ5W62QI-LHItmtfv.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-XXDRQBXY-BRYBW56M.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/chunk-ZCHMQSOR-cGbkforM.js +2 -0
- fusion_artifacts_engine/webui_dist/assets/classDiagram-v2-4MYWR3UA-RVdXT7ne.js +217 -0
- fusion_artifacts_engine/webui_dist/assets/cose-bilkent-JH36ORCC-C1hy4K0b.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/cynefin-EF2NZ3EQ-D8ytFvIy.js +141 -0
- fusion_artifacts_engine/webui_dist/assets/cynefinDiagram-WF24UDRP-9iOV04Va.js +62 -0
- fusion_artifacts_engine/webui_dist/assets/cytoscape.esm-BLAcgzS2.js +331 -0
- fusion_artifacts_engine/webui_dist/assets/dagre-NK4GIZVX-zE4dzUJh.js +4 -0
- fusion_artifacts_engine/webui_dist/assets/defaultLocale-5voVPcsN.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-CBK3MWTC-BrXmQtKM.js +24 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-I5XIIV2D-Bctxj8zx.js +24 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-ODIL2UCW-DfDzzeod.js +30 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-PFBEJUXE-BGZKfFXu.js +3 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-RJA3I4VV-CXB6A2jx.js +41 -0
- fusion_artifacts_engine/webui_dist/assets/diagram-TYUNFSNR-gfqyjmIj.js +200 -0
- fusion_artifacts_engine/webui_dist/assets/ebnfDiagram-V4P3TTPT-CZ1BZkcl.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/elk-QONTBCTQ-C5YzS41r.js +27 -0
- fusion_artifacts_engine/webui_dist/assets/erDiagram-KYQIGQAA-B-DYTd4O.js +99 -0
- fusion_artifacts_engine/webui_dist/assets/flowDiagram-IUGLLWBU-IRAKfxcJ.js +213 -0
- fusion_artifacts_engine/webui_dist/assets/ganttDiagram-R7GPNTJY-DRdmsg6i.js +292 -0
- fusion_artifacts_engine/webui_dist/assets/gitGraphDiagram-PDYL7XHY-B0QL_KrV.js +106 -0
- fusion_artifacts_engine/webui_dist/assets/graph-Bn3Yngep.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/index-CCsQ6nhB.js +374 -0
- fusion_artifacts_engine/webui_dist/assets/index-Cw23dyL1.css +1 -0
- fusion_artifacts_engine/webui_dist/assets/infoDiagram-MVDRKAX5-DMlVkZRb.js +2 -0
- fusion_artifacts_engine/webui_dist/assets/init-DDsq4BXF.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/ishikawaDiagram-HPEHV2GE-yZW7Bvw7.js +70 -0
- fusion_artifacts_engine/webui_dist/assets/journeyDiagram-BOSHW7O7-C0UaOGz2.js +139 -0
- fusion_artifacts_engine/webui_dist/assets/kanban-definition-FNSA4HC5-D2VjWSCv.js +89 -0
- fusion_artifacts_engine/webui_dist/assets/katex-Be3d8Y4U.js +257 -0
- fusion_artifacts_engine/webui_dist/assets/linear-B0L4ZWGd.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/mermaid.core-C0Fw4Tzk.js +314 -0
- fusion_artifacts_engine/webui_dist/assets/mindmap-definition-6OY57UG3-Dy3WTB5p.js +98 -0
- fusion_artifacts_engine/webui_dist/assets/ordinal-_ShbN0yz.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/pegDiagram-ECIUJNBX-Cdm0XnAV.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/pieDiagram-GNMPY74T-TrdpBRYl.js +39 -0
- fusion_artifacts_engine/webui_dist/assets/quadrantDiagram-D57K4MC3-N1OmHTjQ.js +7 -0
- fusion_artifacts_engine/webui_dist/assets/railroadDiagram-Y72NRBL7-DhZcDSX6.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/requirementDiagram-EQYSW5RA-CGmfo0LK.js +84 -0
- fusion_artifacts_engine/webui_dist/assets/sankeyDiagram-SY24JHO5-CnAXR6RI.js +40 -0
- fusion_artifacts_engine/webui_dist/assets/sequenceDiagram-BLEHNHQU-Divp82Qv.js +169 -0
- fusion_artifacts_engine/webui_dist/assets/sizeCapture-INFHLROL-BxUSO2gs.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/stateDiagram-v2-A6IESKWZ-Ch2o3gee.js +291 -0
- fusion_artifacts_engine/webui_dist/assets/swimlanes-B3ENRKFQ-CBnYOtut.js +1 -0
- fusion_artifacts_engine/webui_dist/assets/swimlanesDiagram-AYQRV4AK-Bdp49byx.js +8 -0
- fusion_artifacts_engine/webui_dist/assets/timeline-definition-JXYKGLGB-Cp8DPlck.js +120 -0
- fusion_artifacts_engine/webui_dist/assets/usecaseDiagram-WPOLBNNX-CcF_Y4cE.js +370 -0
- fusion_artifacts_engine/webui_dist/assets/vennDiagram-Q3Y3IDCW-Dplzp3gZ.js +34 -0
- fusion_artifacts_engine/webui_dist/assets/wardleyDiagram-IVAIDKWA-fKoKxoZw.js +78 -0
- fusion_artifacts_engine/webui_dist/assets/xychartDiagram-4URNHDU4-DRVZF7Gc.js +7 -0
- fusion_artifacts_engine/webui_dist/favicon.svg +1 -0
- fusion_artifacts_engine/webui_dist/index.html +14 -0
- fusion_artifacts_engine-0.7.18.dist-info/METADATA +1115 -0
- fusion_artifacts_engine-0.7.18.dist-info/RECORD +114 -0
- fusion_artifacts_engine-0.7.18.dist-info/WHEEL +5 -0
- fusion_artifacts_engine-0.7.18.dist-info/entry_points.txt +2 -0
- fusion_artifacts_engine-0.7.18.dist-info/licenses/LICENSE +201 -0
- fusion_artifacts_engine-0.7.18.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
import yaml
|
|
7
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
_PACKAGE_DIR = Path(__file__).parent
|
|
12
|
+
_DEFAULT_CONFIG_PATH = _PACKAGE_DIR / "default_config.yaml"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _default_user_config_path() -> Path:
|
|
16
|
+
# M-1: do not capture env at import time; read live on each load_config so long-running
|
|
17
|
+
# processes pick up config rotation
|
|
18
|
+
return Path(
|
|
19
|
+
os.environ.get(
|
|
20
|
+
"FUSION_ARTIFACTS_CONFIG",
|
|
21
|
+
str(Path.home() / ".fusion" / "artifacts" / "config.yaml"),
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _load_yaml(path: Path) -> dict[str, Any]:
|
|
27
|
+
try:
|
|
28
|
+
with open(path) as f:
|
|
29
|
+
data = yaml.safe_load(f)
|
|
30
|
+
logger.info("Loaded config from %s", path)
|
|
31
|
+
return data or {}
|
|
32
|
+
except FileNotFoundError:
|
|
33
|
+
logger.debug("Config file not found: %s", path)
|
|
34
|
+
return {}
|
|
35
|
+
except yaml.YAMLError as e:
|
|
36
|
+
# C-14: YAML parse failure no longer silently falls back to fail-open defaults; raise directly
|
|
37
|
+
logger.error("Failed to parse config %s: %s", path, e)
|
|
38
|
+
raise RuntimeError(f"Invalid YAML config {path}: {e}") from e
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _expanduser_path(v: str) -> Path:
|
|
42
|
+
# L-23: expand ~ uniformly for env and YAML paths
|
|
43
|
+
return Path(os.path.expanduser(v))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _parse_bool(v: str) -> bool:
|
|
47
|
+
# P1-12: env bool parsing - accepts true/false/1/0/yes/no (case-insensitive); invalid values
|
|
48
|
+
# raise to trigger the env_map warning
|
|
49
|
+
s = v.strip().lower()
|
|
50
|
+
if s in ("true", "1", "yes", "on"):
|
|
51
|
+
return True
|
|
52
|
+
if s in ("false", "0", "no", "off"):
|
|
53
|
+
return False
|
|
54
|
+
raise ValueError(f"invalid bool: {v}")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _resolve_contract_env() -> dict[str, Any]:
|
|
58
|
+
# #69 (config Phase 2.2): contract vars FUSION_ARTIFACTS_PORT / FUSION_ARTIFACTS_DATA_DIR
|
|
59
|
+
# are resolved via fusion_core.config as the single point (config-conventions §1/§2).
|
|
60
|
+
# fusion_core is a monorepo sibling package and may be missing in isolated CI - fall back to a
|
|
61
|
+
# semantically equivalent in-repo resolution (same pattern as dsl_parser's
|
|
62
|
+
# _fallback_validate_dsl); both paths behave identically.
|
|
63
|
+
overrides: dict[str, Any] = {}
|
|
64
|
+
raw_port = os.environ.get("FUSION_ARTIFACTS_PORT", "")
|
|
65
|
+
if raw_port:
|
|
66
|
+
try:
|
|
67
|
+
from fusion_core.config import service_port
|
|
68
|
+
except ImportError:
|
|
69
|
+
try:
|
|
70
|
+
overrides["server_port"] = int(raw_port)
|
|
71
|
+
except ValueError:
|
|
72
|
+
logger.warning("Invalid env FUSION_ARTIFACTS_PORT=%s: not an integer", raw_port)
|
|
73
|
+
else:
|
|
74
|
+
try:
|
|
75
|
+
overrides["server_port"] = service_port("artifacts", default=11451)
|
|
76
|
+
except ValueError as exc:
|
|
77
|
+
logger.warning("Invalid FUSION_ARTIFACTS_PORT: %s", exc)
|
|
78
|
+
raw_dir = os.environ.get("FUSION_ARTIFACTS_DATA_DIR", "")
|
|
79
|
+
if raw_dir:
|
|
80
|
+
try:
|
|
81
|
+
from fusion_core.config import service_data_dir
|
|
82
|
+
except ImportError:
|
|
83
|
+
overrides["storage_root"] = _expanduser_path(raw_dir)
|
|
84
|
+
else:
|
|
85
|
+
# fusion_core does not expand ~ (upstream gap); expand in-repo to stay consistent
|
|
86
|
+
# with STORAGE_ROOT
|
|
87
|
+
overrides["storage_root"] = _expanduser_path(str(service_data_dir("artifacts", default=raw_dir)))
|
|
88
|
+
return overrides
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _flatten_yaml_config(data: dict[str, Any]) -> dict[str, Any]:
|
|
92
|
+
# A-9: the yaml section.key -> model field mapping is centralized in this one table;
|
|
93
|
+
# new fields only touch this. Path values are ~-expanded via _expanduser_path;
|
|
94
|
+
# empty sync_root normalizes to None.
|
|
95
|
+
section_map: dict[str, dict[str, tuple[str, Any | None]]] = {
|
|
96
|
+
"server": {
|
|
97
|
+
"host": ("server_host", None),
|
|
98
|
+
"port": ("server_port", None),
|
|
99
|
+
"max_workers": ("server_max_workers", None),
|
|
100
|
+
},
|
|
101
|
+
"storage": {
|
|
102
|
+
"root": ("storage_root", _expanduser_path),
|
|
103
|
+
"db_name": ("db_name", None),
|
|
104
|
+
"small_content_limit": ("small_content_limit", None),
|
|
105
|
+
"sync_root": ("sync_root", _expanduser_path),
|
|
106
|
+
"disk_space_warning_pct": ("disk_space_warning_pct", None),
|
|
107
|
+
"wal_checkpoint_interval": ("wal_checkpoint_interval", None),
|
|
108
|
+
"metadata_indexed_keys": ("metadata_indexed_keys", None),
|
|
109
|
+
},
|
|
110
|
+
"thresholds": {
|
|
111
|
+
"auto_create_lines": ("auto_create_threshold_lines", None),
|
|
112
|
+
"auto_create_chars": ("auto_create_threshold_chars", None),
|
|
113
|
+
},
|
|
114
|
+
"artifact": {
|
|
115
|
+
"id_prefix": ("artifact_id_prefix", None),
|
|
116
|
+
"max_versions_per_artifact": ("max_versions_per_artifact", None),
|
|
117
|
+
"max_content_bytes": ("max_content_bytes", None),
|
|
118
|
+
"max_metadata_bytes": ("max_metadata_bytes", None),
|
|
119
|
+
"max_event_payload_bytes": ("max_event_payload_bytes", None),
|
|
120
|
+
},
|
|
121
|
+
"security": {
|
|
122
|
+
"api_key": ("api_key", None),
|
|
123
|
+
"allow_no_auth": ("allow_no_auth", None),
|
|
124
|
+
"recycle_retention_days": ("recycle_retention_days", None),
|
|
125
|
+
"share_max_ttl_days": ("share_max_ttl_days", None),
|
|
126
|
+
},
|
|
127
|
+
"sse": {
|
|
128
|
+
"heartbeat_interval": ("sse_heartbeat_interval", None),
|
|
129
|
+
"max_lifetime": ("sse_max_lifetime", None),
|
|
130
|
+
"max_event_bytes": ("sse_max_event_bytes", None),
|
|
131
|
+
"max_connections": ("sse_max_connections", None),
|
|
132
|
+
},
|
|
133
|
+
"rate_limit": {
|
|
134
|
+
"rps": ("rate_limit_rps", None),
|
|
135
|
+
"burst": ("rate_limit_burst", None),
|
|
136
|
+
"public_rps": ("public_rate_limit_rps", None),
|
|
137
|
+
"public_burst": ("public_rate_limit_burst", None),
|
|
138
|
+
},
|
|
139
|
+
"metrics": {
|
|
140
|
+
"enabled": ("metrics_enabled", None),
|
|
141
|
+
"token": ("metrics_token", None),
|
|
142
|
+
},
|
|
143
|
+
"tracing": {
|
|
144
|
+
"enabled": ("tracing_enabled", None),
|
|
145
|
+
"service_name": ("tracing_service_name", None),
|
|
146
|
+
},
|
|
147
|
+
"gateway": {
|
|
148
|
+
"enabled": ("gateway_enabled", None),
|
|
149
|
+
"url": ("gateway_url", None),
|
|
150
|
+
"module_id": ("gateway_module_id", None),
|
|
151
|
+
"admin_key": ("gateway_admin_key", None),
|
|
152
|
+
"key_file": ("gateway_key_file", _expanduser_path),
|
|
153
|
+
"heartbeat_interval": ("gateway_heartbeat_interval", None),
|
|
154
|
+
},
|
|
155
|
+
"share": {
|
|
156
|
+
"public_base_url": ("share_public_base_url", None),
|
|
157
|
+
},
|
|
158
|
+
"ai": {
|
|
159
|
+
"base_url": ("ai_base_url", None),
|
|
160
|
+
"model": ("ai_model", None),
|
|
161
|
+
"timeout": ("ai_timeout", None),
|
|
162
|
+
"api_key": ("ai_api_key", None),
|
|
163
|
+
},
|
|
164
|
+
"ipc": {
|
|
165
|
+
"enabled": ("ipc_enabled", None),
|
|
166
|
+
"design_dir": ("ipc_design_dir", _expanduser_path),
|
|
167
|
+
"poll_interval": ("ipc_poll_interval", None),
|
|
168
|
+
"office_enabled": ("ipc_office_enabled", None),
|
|
169
|
+
"office_dir": ("ipc_office_dir", _expanduser_path),
|
|
170
|
+
},
|
|
171
|
+
"long_context": {
|
|
172
|
+
"summary_threshold": ("long_context_summary_threshold", None),
|
|
173
|
+
"summary_model": ("long_context_summary_model", None),
|
|
174
|
+
"mlx_url": ("long_context_mlx_url", None),
|
|
175
|
+
"mlx_api_key": ("long_context_mlx_api_key", None),
|
|
176
|
+
"rag_enabled": ("long_context_rag_enabled", None),
|
|
177
|
+
"rag_url": ("long_context_rag_url", None),
|
|
178
|
+
"rag_api_key": ("long_context_rag_api_key", None),
|
|
179
|
+
"rag_kb_id": ("long_context_rag_kb_id", None),
|
|
180
|
+
},
|
|
181
|
+
}
|
|
182
|
+
flat: dict[str, Any] = {}
|
|
183
|
+
for section, field_map in section_map.items():
|
|
184
|
+
section_data = data.get(section, {})
|
|
185
|
+
if not isinstance(section_data, dict):
|
|
186
|
+
logger.warning("Config section %s not a dict, skip: %r", section, section_data)
|
|
187
|
+
continue
|
|
188
|
+
for yaml_key, (field_name, converter) in field_map.items():
|
|
189
|
+
if yaml_key not in section_data:
|
|
190
|
+
continue
|
|
191
|
+
val = section_data[yaml_key]
|
|
192
|
+
# Empty string normalizes to None: path defaults are derived in code (sync_root
|
|
193
|
+
# disabled / gateway_key_file uses storage_root default / ipc_design_dir uses the
|
|
194
|
+
# convention dir)
|
|
195
|
+
if (
|
|
196
|
+
field_name in ("sync_root", "gateway_key_file", "ipc_design_dir", "ipc_office_dir")
|
|
197
|
+
and not val
|
|
198
|
+
):
|
|
199
|
+
flat[field_name] = None
|
|
200
|
+
continue
|
|
201
|
+
if converter is not None:
|
|
202
|
+
val = converter(val)
|
|
203
|
+
flat[field_name] = val
|
|
204
|
+
return flat
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def load_config(user_config_path: Path | None = None) -> "ArtifactEngineConfig":
|
|
208
|
+
default_data = _flatten_yaml_config(_load_yaml(_DEFAULT_CONFIG_PATH))
|
|
209
|
+
user_path = user_config_path or _default_user_config_path()
|
|
210
|
+
user_data = _flatten_yaml_config(_load_yaml(user_path))
|
|
211
|
+
merged = {**default_data, **user_data}
|
|
212
|
+
|
|
213
|
+
env_overrides: dict[str, Any] = {}
|
|
214
|
+
env_map = {
|
|
215
|
+
"FUSION_ARTIFACTS_HOST": ("server_host", str),
|
|
216
|
+
# FUSION_ARTIFACTS_PORT / FUSION_ARTIFACTS_DATA_DIR contract vars are resolved
|
|
217
|
+
# via fusion_core in _resolve_contract_env (#69), no longer through env_map.
|
|
218
|
+
# L-23: env STORAGE_ROOT is also ~-expanded. Legacy alias after #69; prefer DATA_DIR.
|
|
219
|
+
"FUSION_ARTIFACTS_STORAGE_ROOT": ("storage_root", _expanduser_path),
|
|
220
|
+
"FUSION_ARTIFACTS_API_KEY": ("api_key", str),
|
|
221
|
+
# P1-12/M22: ops-tunable env override completion - container/multi-node deployments
|
|
222
|
+
# can tune parameters without editing YAML
|
|
223
|
+
"FUSION_ARTIFACTS_MAX_WORKERS": ("server_max_workers", int),
|
|
224
|
+
"FUSION_ARTIFACTS_RATE_LIMIT_RPS": ("rate_limit_rps", float),
|
|
225
|
+
"FUSION_ARTIFACTS_RATE_LIMIT_BURST": ("rate_limit_burst", int),
|
|
226
|
+
"FUSION_ARTIFACTS_PUBLIC_RPS": ("public_rate_limit_rps", float),
|
|
227
|
+
"FUSION_ARTIFACTS_PUBLIC_BURST": ("public_rate_limit_burst", int),
|
|
228
|
+
"FUSION_ARTIFACTS_METRICS_ENABLED": ("metrics_enabled", _parse_bool),
|
|
229
|
+
"FUSION_ARTIFACTS_METRICS_TOKEN": ("metrics_token", str),
|
|
230
|
+
"FUSION_ARTIFACTS_DISK_WARNING_PCT": ("disk_space_warning_pct", int),
|
|
231
|
+
# P1-4: WAL checkpoint interval env override
|
|
232
|
+
"FUSION_ARTIFACTS_WAL_CHECKPOINT_INTERVAL": ("wal_checkpoint_interval", int),
|
|
233
|
+
"FUSION_ARTIFACTS_SSE_MAX_LIFETIME": ("sse_max_lifetime", int),
|
|
234
|
+
"FUSION_ARTIFACTS_SSE_MAX_EVENT_BYTES": ("sse_max_event_bytes", int),
|
|
235
|
+
"FUSION_ARTIFACTS_SSE_MAX_CONNECTIONS": ("sse_max_connections", int),
|
|
236
|
+
# P2-5: OTel tracing env override
|
|
237
|
+
"FUSION_ARTIFACTS_TRACING_ENABLED": ("tracing_enabled", _parse_bool),
|
|
238
|
+
"FUSION_ARTIFACTS_TRACING_SERVICE_NAME": ("tracing_service_name", str),
|
|
239
|
+
# #75: web-shell integration env override
|
|
240
|
+
"FUSION_ARTIFACTS_GATEWAY_ENABLED": ("gateway_enabled", _parse_bool),
|
|
241
|
+
"FUSION_ARTIFACTS_GATEWAY_URL": ("gateway_url", str),
|
|
242
|
+
"FUSION_ARTIFACTS_GATEWAY_MODULE_ID": ("gateway_module_id", str),
|
|
243
|
+
"FUSION_ARTIFACTS_GATEWAY_ADMIN_KEY": ("gateway_admin_key", str),
|
|
244
|
+
"FUSION_ARTIFACTS_GATEWAY_KEY_FILE": ("gateway_key_file", _expanduser_path),
|
|
245
|
+
"FUSION_ARTIFACTS_GATEWAY_HEARTBEAT_INTERVAL": (
|
|
246
|
+
"gateway_heartbeat_interval",
|
|
247
|
+
int,
|
|
248
|
+
),
|
|
249
|
+
# #83: public share page base URL (empty = derived from server host/port)
|
|
250
|
+
"FUSION_ARTIFACTS_SHARE_PUBLIC_BASE_URL": ("share_public_base_url", str),
|
|
251
|
+
# #84: fusion-design save_artifact file-IPC consumption
|
|
252
|
+
"FUSION_ARTIFACTS_IPC_ENABLED": ("ipc_enabled", _parse_bool),
|
|
253
|
+
"FUSION_ARTIFACTS_IPC_DESIGN_DIR": ("ipc_design_dir", _expanduser_path),
|
|
254
|
+
"FUSION_ARTIFACTS_IPC_POLL_INTERVAL": ("ipc_poll_interval", float),
|
|
255
|
+
# v0.7.0: fusion-office file ingest (docx/xlsx/pptx -> sectioned markdown)
|
|
256
|
+
"FUSION_ARTIFACTS_IPC_OFFICE_ENABLED": ("ipc_office_enabled", _parse_bool),
|
|
257
|
+
"FUSION_ARTIFACTS_IPC_OFFICE_DIR": ("ipc_office_dir", _expanduser_path),
|
|
258
|
+
# v0.7.1 #91: rolling summary + RAG archival
|
|
259
|
+
"FUSION_ARTIFACTS_LC_SUMMARY_THRESHOLD": ("long_context_summary_threshold", int),
|
|
260
|
+
"FUSION_ARTIFACTS_LC_RAG_ENABLED": ("long_context_rag_enabled", _parse_bool),
|
|
261
|
+
"FUSION_ARTIFACTS_LC_MLX_URL": ("long_context_mlx_url", None),
|
|
262
|
+
"FUSION_ARTIFACTS_LC_RAG_URL": ("long_context_rag_url", None),
|
|
263
|
+
}
|
|
264
|
+
for env_key, (field_name, converter) in env_map.items():
|
|
265
|
+
val = os.environ.get(env_key)
|
|
266
|
+
if val is not None:
|
|
267
|
+
try:
|
|
268
|
+
env_overrides[field_name] = converter(val)
|
|
269
|
+
logger.debug("Config override from env %s", env_key)
|
|
270
|
+
except (ValueError, TypeError) as e:
|
|
271
|
+
logger.warning("Invalid env %s=%s: %s", env_key, val, e)
|
|
272
|
+
|
|
273
|
+
merged.update(env_overrides)
|
|
274
|
+
|
|
275
|
+
# #69: contract vars (PORT/DATA_DIR) applied afterwards - higher priority than legacy
|
|
276
|
+
# STORAGE_ROOT; STORAGE_ROOT kept during migration (config-conventions §6); setting it
|
|
277
|
+
# warns and points to DATA_DIR.
|
|
278
|
+
merged.update(_resolve_contract_env())
|
|
279
|
+
if os.environ.get("FUSION_ARTIFACTS_STORAGE_ROOT", ""):
|
|
280
|
+
logger.warning(
|
|
281
|
+
"FUSION_ARTIFACTS_STORAGE_ROOT is deprecated, set FUSION_ARTIFACTS_DATA_DIR instead "
|
|
282
|
+
"(config-conventions §1, issue #69)"
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
# Strip stale keys no longer present on the model from user config, avoiding
|
|
286
|
+
# extra="forbid" errors (P2-18).
|
|
287
|
+
valid_fields = set(ArtifactEngineConfig.model_fields.keys())
|
|
288
|
+
stale_keys = [k for k in merged if k not in valid_fields]
|
|
289
|
+
for stale in stale_keys:
|
|
290
|
+
logger.warning("Stripping stale config key: %s", stale)
|
|
291
|
+
merged.pop(stale, None)
|
|
292
|
+
|
|
293
|
+
# L-21: no longer pop/reassign to bypass pydantic validation; host/port are validated
|
|
294
|
+
# via model construction too
|
|
295
|
+
return ArtifactEngineConfig(**merged)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
class ArtifactEngineConfig(BaseModel):
|
|
299
|
+
model_config = ConfigDict(extra="forbid")
|
|
300
|
+
|
|
301
|
+
storage_root: Path = Field(default=Path.home() / ".fusion" / "artifacts")
|
|
302
|
+
db_name: str = Field(default="meta.db")
|
|
303
|
+
auto_create_threshold_lines: int = Field(default=30)
|
|
304
|
+
auto_create_threshold_chars: int = Field(default=1500)
|
|
305
|
+
small_content_limit: int = Field(default=10240)
|
|
306
|
+
artifact_id_prefix: str = Field(default="art_")
|
|
307
|
+
server_host: str = Field(default="127.0.0.1")
|
|
308
|
+
server_port: int = Field(default=11451)
|
|
309
|
+
# R1: HTTP thread-pool cap, 0 = unlimited (falls back to ThreadingMixIn default).
|
|
310
|
+
# Prevents SSE/concurrency from exhausting threads
|
|
311
|
+
server_max_workers: int = Field(default=64)
|
|
312
|
+
recycle_retention_days: int = Field(default=7)
|
|
313
|
+
# L-6: max share expires_at TTL (days), 0 = unlimited; past dates are always rejected
|
|
314
|
+
share_max_ttl_days: int = Field(default=90)
|
|
315
|
+
# C-4: fail-closed by default; requests without api_key are rejected. Local single-user
|
|
316
|
+
# setups may set allow_no_auth=true explicitly
|
|
317
|
+
allow_no_auth: bool = Field(default=False)
|
|
318
|
+
api_key: str | None = Field(default=None)
|
|
319
|
+
sse_heartbeat_interval: int = Field(default=30)
|
|
320
|
+
# P1-7/M7: max SSE single-connection lifetime in seconds. 0 = unlimited. After timeout
|
|
321
|
+
# the server closes the stream proactively to prompt client reconnect, preventing zombie
|
|
322
|
+
# long-lived connections from hogging threads. Production recommends 3600 (1h);
|
|
323
|
+
# clients should implement auto-reconnect.
|
|
324
|
+
sse_max_lifetime: int = Field(default=3600)
|
|
325
|
+
# F5: max serialized byte size per SSE event. Oversized events are dropped (log only),
|
|
326
|
+
# preventing large payloads from blocking a connection thread long-term plus client
|
|
327
|
+
# buffer blowup. 0 = unlimited (backward compatible).
|
|
328
|
+
sse_max_event_bytes: int = Field(default=262144)
|
|
329
|
+
# P2-1/F1/H3: dedicated SSE concurrency cap. After the SSE handshake the RPC worker
|
|
330
|
+
# semaphore is released and this dedicated semaphore held, so long-lived connections no
|
|
331
|
+
# longer monopolize the 64 RPC threads - 64 SSE clients no longer saturate the backend
|
|
332
|
+
# causing new RPCs to all 503. Default 16: enough for local single-machine
|
|
333
|
+
# (fusion-studio typically 1-2 SSE); 0 = no dedicated cap (old behavior, not recommended).
|
|
334
|
+
sse_max_connections: int = Field(default=16)
|
|
335
|
+
context_budget_default: int = Field(default=200000)
|
|
336
|
+
# C-1: root dir for sync_artifact_file reads/writes; paths must stay under it
|
|
337
|
+
sync_root: Path | None = Field(default=None)
|
|
338
|
+
# R9: per-artifact version cap, 0 = unlimited; over the cap the oldest non-snapshot
|
|
339
|
+
# version is evicted (prevents unbounded disk growth)
|
|
340
|
+
max_versions_per_artifact: int = Field(default=100)
|
|
341
|
+
# P0-5/H9: per-version content byte cap, 0 = unlimited; over the cap writes are rejected
|
|
342
|
+
# to prevent OOM/disk exhaustion
|
|
343
|
+
max_content_bytes: int = Field(default=0)
|
|
344
|
+
# P0-5/H9: per-artifact metadata JSON byte cap, 0 = unlimited; over the cap writes are rejected
|
|
345
|
+
max_metadata_bytes: int = Field(default=0)
|
|
346
|
+
# P0-5/H6: emit_event payload JSON byte cap, default 64KB; over the cap writes are
|
|
347
|
+
# rejected to prevent event-bus amplification
|
|
348
|
+
max_event_payload_bytes: int = Field(default=65536)
|
|
349
|
+
# R9: disk usage warning percentage (0-100), 0 = disables monitoring. Pre-write check
|
|
350
|
+
# plus log warning. Field default 0 (disabled, so unit tests do not depend on host disk
|
|
351
|
+
# state); production sets 90 via default_config.yaml.
|
|
352
|
+
disk_space_warning_pct: int = Field(default=0)
|
|
353
|
+
# P1-4: WAL periodic checkpoint interval in seconds. 0 = disables background checkpoint
|
|
354
|
+
# (relies on SQLite default 1000-page auto checkpoint). Production recommends 300 -
|
|
355
|
+
# background PASSIVE checkpoint controls -wal file growth, paired with backup.sh online backup.
|
|
356
|
+
wal_checkpoint_interval: int = Field(default=300)
|
|
357
|
+
# Ops-1: token-bucket rate limiting. rps=0 means unlimited (default). The default bucket
|
|
358
|
+
# covers JSON-RPC + authenticated REST
|
|
359
|
+
rate_limit_rps: float = Field(default=0)
|
|
360
|
+
rate_limit_burst: int = Field(default=0)
|
|
361
|
+
# Ops-1: isolated quota for public share endpoints (unauthenticated, easily abused,
|
|
362
|
+
# needs its own bucket)
|
|
363
|
+
public_rate_limit_rps: float = Field(default=0)
|
|
364
|
+
public_rate_limit_burst: int = Field(default=0)
|
|
365
|
+
# Ops-2: Prometheus /metrics endpoint switch
|
|
366
|
+
metrics_enabled: bool = Field(default=True)
|
|
367
|
+
# LOW-4: optional token auth for /metrics. When set, /metrics requires a matching
|
|
368
|
+
# X-Metrics-Token header (constant-time compare). Empty = no auth (relies on the
|
|
369
|
+
# 127.0.0.1 binding for local isolation). Must be set when exposing 0.0.0.0, otherwise
|
|
370
|
+
# ops metrics leak.
|
|
371
|
+
metrics_token: str | None = Field(default=None)
|
|
372
|
+
# P2-5/H12(trace)/M20: OTel distributed tracing switch. Default false - local-first
|
|
373
|
+
# single-tenant needs no tracing, and opentelemetry-sdk is an optional dependency
|
|
374
|
+
# ([otel] extra). With enabled=true and the SDK missing it is a no-op + WARN.
|
|
375
|
+
tracing_enabled: bool = Field(default=False)
|
|
376
|
+
tracing_service_name: str = Field(default="fusion-artifacts-engine")
|
|
377
|
+
# P2-7/F6: high-frequency metadata filter field names. Builds a json_extract expression
|
|
378
|
+
# index per key so metadata_filter no longer does full table scans. Empty list = no
|
|
379
|
+
# indexes (backward compatible). Only safe identifier characters allowed.
|
|
380
|
+
metadata_indexed_keys: list[str] = Field(default_factory=list)
|
|
381
|
+
# #75: web-shell integration - self-register the shell manifest to fusion-gateway plus
|
|
382
|
+
# periodic heartbeat. enabled=false (default) zero overhead; enabled=true and api_key
|
|
383
|
+
# configured starts the registration/heartbeat thread.
|
|
384
|
+
gateway_enabled: bool = Field(default=False)
|
|
385
|
+
gateway_url: str = Field(default="http://127.0.0.1:11432")
|
|
386
|
+
gateway_module_id: str = Field(default="fusion-artifacts")
|
|
387
|
+
# For first-registration bootstrap only (gateway web_shell.admin_key); after successful
|
|
388
|
+
# registration the engine's own api_key handles heartbeat and #369 self-heal
|
|
389
|
+
# re-registration, and admin_key can be removed from config.
|
|
390
|
+
gateway_admin_key: str | None = Field(default=None)
|
|
391
|
+
# #82: persistence file for the gateway-issued fm- service key (empty =
|
|
392
|
+
# storage_root/gateway_service_key)
|
|
393
|
+
gateway_key_file: str | None = Field(default=None)
|
|
394
|
+
gateway_heartbeat_interval: int = Field(default=15)
|
|
395
|
+
# #83: public share page base URL (empty = derived from server host/port)
|
|
396
|
+
share_public_base_url: str = Field(default="")
|
|
397
|
+
# #84: fusion-design save_artifact file-IPC consumption (dir default =
|
|
398
|
+
# ~/.fusion-design/fusion-artifacts-engine)
|
|
399
|
+
ipc_enabled: bool = Field(default=True)
|
|
400
|
+
ipc_design_dir: str | None = Field(default=None)
|
|
401
|
+
ipc_poll_interval: float = Field(default=3.0)
|
|
402
|
+
# v0.7.0: fusion-office file ingest (dir default = ~/.fusion-office/fusion-artifacts-engine)
|
|
403
|
+
ipc_office_enabled: bool = Field(default=True)
|
|
404
|
+
ipc_office_dir: str | None = Field(default=None)
|
|
405
|
+
# v0.7.1 #91: layered context compaction - rolling summary (fusion-mlx) plus
|
|
406
|
+
# old-version archival (fusion-rag)
|
|
407
|
+
long_context_summary_threshold: int = Field(default=5)
|
|
408
|
+
long_context_summary_model: str = Field(default="")
|
|
409
|
+
long_context_mlx_url: str = Field(default="http://127.0.0.1:11434")
|
|
410
|
+
long_context_mlx_api_key: str = Field(default="")
|
|
411
|
+
long_context_rag_enabled: bool = Field(default=True)
|
|
412
|
+
# The /kb prefix is the fusion-rag application-layer route (openapi: /kb/bases/...)
|
|
413
|
+
long_context_rag_url: str = Field(default="http://127.0.0.1:11436/kb")
|
|
414
|
+
long_context_rag_api_key: str = Field(default="")
|
|
415
|
+
long_context_rag_kb_id: str = Field(default="fusion-artifacts")
|
|
416
|
+
# v0.7.5 #97: AI generate/iterate entry - webui calls the fusion-mlx OpenAI-compatible
|
|
417
|
+
# API via the ai.generate RPC. Empty model = auto-pick the first available model
|
|
418
|
+
# from /v1/models.
|
|
419
|
+
ai_base_url: str = Field(default="http://127.0.0.1:11434")
|
|
420
|
+
ai_model: str = Field(default="")
|
|
421
|
+
ai_timeout: float = Field(default=120.0)
|
|
422
|
+
ai_api_key: str = Field(default="")
|
|
423
|
+
|
|
424
|
+
@property
|
|
425
|
+
def gateway_service_key_path(self) -> Path:
|
|
426
|
+
if self.gateway_key_file:
|
|
427
|
+
return Path(self.gateway_key_file).expanduser()
|
|
428
|
+
return self.storage_root / "gateway_service_key"
|
|
429
|
+
|
|
430
|
+
@property
|
|
431
|
+
def share_base_url(self) -> str:
|
|
432
|
+
if self.share_public_base_url:
|
|
433
|
+
return self.share_public_base_url.rstrip("/")
|
|
434
|
+
return f"http://{self.server_host}:{self.server_port}"
|
|
435
|
+
|
|
436
|
+
@property
|
|
437
|
+
def ipc_design_path(self) -> Path:
|
|
438
|
+
if self.ipc_design_dir:
|
|
439
|
+
return Path(self.ipc_design_dir).expanduser()
|
|
440
|
+
base = os.environ.get("FUSION_DESIGN_DATA_DIR", "")
|
|
441
|
+
root = Path(base).expanduser() if base else Path.home() / ".fusion-design"
|
|
442
|
+
return root / "fusion-artifacts-engine"
|
|
443
|
+
|
|
444
|
+
@property
|
|
445
|
+
def ipc_office_path(self) -> Path:
|
|
446
|
+
if self.ipc_office_dir:
|
|
447
|
+
return Path(self.ipc_office_dir).expanduser()
|
|
448
|
+
base = os.environ.get("FUSION_OFFICE_DATA_DIR", "")
|
|
449
|
+
root = Path(base).expanduser() if base else Path.home() / ".fusion-office"
|
|
450
|
+
return root / "fusion-artifacts-engine"
|
|
451
|
+
|
|
452
|
+
@property
|
|
453
|
+
def ipc_office_outbox_path(self) -> Path:
|
|
454
|
+
return self.ipc_office_path / ".outbox"
|
|
455
|
+
|
|
456
|
+
@property
|
|
457
|
+
def db_path(self) -> Path:
|
|
458
|
+
return self.storage_root / self.db_name
|
|
459
|
+
|
|
460
|
+
@property
|
|
461
|
+
def content_dir(self) -> Path:
|
|
462
|
+
return self.storage_root / "content"
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Default configuration for fusion-artifacts-engine
|
|
2
|
+
|
|
3
|
+
server:
|
|
4
|
+
host: "127.0.0.1"
|
|
5
|
+
port: 11451
|
|
6
|
+
# R1: HTTP 线程池上限,防 SSE/并发连接耗尽线程。0=不限
|
|
7
|
+
max_workers: 64
|
|
8
|
+
|
|
9
|
+
storage:
|
|
10
|
+
root: "~/.fusion/artifacts"
|
|
11
|
+
db_name: "meta.db"
|
|
12
|
+
small_content_limit: 10240
|
|
13
|
+
# C-1: artifact.sync 文件读写根目录,留空则禁用 sync;设为目录则限制 sync 路径在其下
|
|
14
|
+
sync_root: ""
|
|
15
|
+
# R9: 磁盘水位告警百分比(0-100),0=禁用监控
|
|
16
|
+
disk_space_warning_pct: 90
|
|
17
|
+
# P1-4: WAL 周期 checkpoint 间隔秒。0=禁用(依赖 SQLite 默认 1000 页自动)。
|
|
18
|
+
# 生产建议 300——后台 PASSIVE checkpoint 控制 -wal 文件增长,配合 scripts/backup.sh 在线备份。
|
|
19
|
+
wal_checkpoint_interval: 300
|
|
20
|
+
# P2-7/F6: metadata 高频过滤字段名列表。对每个 key 建 json_extract 表达式索引,
|
|
21
|
+
# 使 list 的 metadata_filter 不再全表扫。留空=不建索引(向后兼容)。
|
|
22
|
+
# 仅可填安全标识符(字母/下划线/数字),用于常被过滤的 metadata 字段。
|
|
23
|
+
metadata_indexed_keys: []
|
|
24
|
+
|
|
25
|
+
thresholds:
|
|
26
|
+
auto_create_lines: 30
|
|
27
|
+
auto_create_chars: 1500
|
|
28
|
+
|
|
29
|
+
artifact:
|
|
30
|
+
id_prefix: "art_"
|
|
31
|
+
# R9: 单 artifact 版本上限,0=不限;超限淘汰最旧非快照版本
|
|
32
|
+
max_versions_per_artifact: 100
|
|
33
|
+
# P0-5/H9: 单版本内容字节上限,0=不限;超限拒绝写入防 OOM/磁盘耗尽
|
|
34
|
+
max_content_bytes: 0
|
|
35
|
+
# P0-5/H9: 单 artifact metadata JSON 字节上限,0=不限;超限拒绝写入
|
|
36
|
+
max_metadata_bytes: 0
|
|
37
|
+
# P0-5/H6: emit_event payload JSON 字节上限,默认 64KB;超限拒绝写入防事件总线放大
|
|
38
|
+
max_event_payload_bytes: 65536
|
|
39
|
+
|
|
40
|
+
security:
|
|
41
|
+
# C-4/P1-6: 默认 fail-closed。无 api_key 且 allow_no_auth=false 时拒绝所有请求(安全默认)。
|
|
42
|
+
# 生产:设 api_key(env FUSION_ARTIFACTS_API_KEY 或下方 api_key 字段),鉴权 X-API-Key 头。
|
|
43
|
+
# 本地单机受信网络:可显式 allow_no_auth=true 跳过鉴权(不推荐公网/多租户)。
|
|
44
|
+
allow_no_auth: false
|
|
45
|
+
recycle_retention_days: 7
|
|
46
|
+
# L-6: share expires_at 最大 TTL(天),0=不限;过去日期一律拒绝
|
|
47
|
+
share_max_ttl_days: 90
|
|
48
|
+
|
|
49
|
+
share:
|
|
50
|
+
# #83: 公开 share 页面 base URL(/s/<share_id>)。空=按 server.host/port 推导
|
|
51
|
+
# (如 http://127.0.0.1:11451)。反向代理/公网部署时设为外部可达地址。
|
|
52
|
+
public_base_url: ""
|
|
53
|
+
|
|
54
|
+
sse:
|
|
55
|
+
heartbeat_interval: 30
|
|
56
|
+
# P1-7/M7: SSE 单连接最大存活秒。0=不限。超时服务端主动关流促重连,防僵尸长连接占线程
|
|
57
|
+
max_lifetime: 3600
|
|
58
|
+
# F5: SSE 单事件序列化后字节上限。超限事件被丢弃(仅记日志),防大 payload 阻塞连接线程。0=不限
|
|
59
|
+
max_event_bytes: 262144
|
|
60
|
+
# P2-1: SSE 独立并发上限。握手后释放 RPC worker 槽、占此专用信号量,长连接不再独占 64 RPC 线程。
|
|
61
|
+
# 0=不设独立上限(回退旧行为,不推荐)。本地单机 16 足够;多端共享调大需配合线程/fd 上限。
|
|
62
|
+
max_connections: 16
|
|
63
|
+
|
|
64
|
+
rate_limit:
|
|
65
|
+
# 运维1: 令牌桶限流。rps=0 表示不限流(向后兼容,但生产不建议)。
|
|
66
|
+
# default 桶覆盖 JSON-RPC + 鉴权 REST;超限返回 429(JSON-RPC 用 -32003)
|
|
67
|
+
# P1-1/H4: 生产默认值——default rps:200/burst:400,公开端点 rps:50/burst:100
|
|
68
|
+
rps: 200
|
|
69
|
+
burst: 400
|
|
70
|
+
# 公开 share 端点独立配额(无鉴权,易被刷量)
|
|
71
|
+
public_rps: 50
|
|
72
|
+
public_burst: 100
|
|
73
|
+
|
|
74
|
+
metrics:
|
|
75
|
+
# 运维2: Prometheus /metrics 端点开关。自实现文本格式,无外部依赖
|
|
76
|
+
enabled: true
|
|
77
|
+
# LOW-4: /metrics 可选 token 鉴权。设值后 /metrics 要求 X-Metrics-Token 头匹配。
|
|
78
|
+
# 留空=不鉴权(依赖 127.0.0.1 绑定的本机隔离)。暴露 0.0.0.0 / 公网时必须设值。
|
|
79
|
+
token: ""
|
|
80
|
+
tracing:
|
|
81
|
+
# P2-5/H12(trace)/M20: OTel 分布式追踪开关。默认 false——local-first 单租户场景
|
|
82
|
+
# 无需分布式追踪,且 opentelemetry-sdk 为可选依赖(pip install -e ".[otel]")。
|
|
83
|
+
# enabled=true 时记录 rpc.server.duration + db.storage.duration span,
|
|
84
|
+
# 默认 ConsoleSpanExporter;生产经 OTEL_EXPORTER_OTLP_ENDPOINT 外接 OTLP collector。
|
|
85
|
+
enabled: false
|
|
86
|
+
service_name: "fusion-artifacts-engine"
|
|
87
|
+
|
|
88
|
+
gateway:
|
|
89
|
+
# #75: web-shell 集成。enabled=true 时启动时向 fusion-gateway 自注册 shell
|
|
90
|
+
# manifest(侧栏 Artifacts 菜单 + /shell/<module_id>/ 代理路由)并周期心跳。
|
|
91
|
+
# #82: 注册体不带 api_key —— gateway 签发 fm- service key(raw_key 仅返回一次),
|
|
92
|
+
# 引擎持久化到关键文件并用它心跳;引擎同时接受该 key 的 Bearer(代理注入通道)。
|
|
93
|
+
enabled: false
|
|
94
|
+
url: "http://127.0.0.1:11432"
|
|
95
|
+
module_id: "fusion-artifacts"
|
|
96
|
+
# 首次注册引导用(gateway web_shell.admin_key);签发 fm- key 后不再需要。
|
|
97
|
+
admin_key: ""
|
|
98
|
+
# gateway 签发 key 的持久化文件;空=storage.root/gateway_service_key(权限 600)
|
|
99
|
+
key_file: ""
|
|
100
|
+
# 心跳间隔秒(gateway heartbeat_timeout 默认 30s,须小于它)
|
|
101
|
+
heartbeat_interval: 15
|
|
102
|
+
|
|
103
|
+
ipc:
|
|
104
|
+
# #84: fusion-design [Save to Artifacts] 文件 IPC 消费。enabled=true 时轮询
|
|
105
|
+
# <base>/fusion-artifacts-engine/*.json,save_artifact 消息落库后归档。
|
|
106
|
+
enabled: true
|
|
107
|
+
# 消息目录;空= <FUSION_DESIGN_DATA_DIR 或 ~/.fusion-design>/fusion-artifacts-engine
|
|
108
|
+
design_dir: ""
|
|
109
|
+
# 轮询间隔秒
|
|
110
|
+
poll_interval: 3.0
|
|
111
|
+
# v0.7.0: fusion-office 文件摄取(docx/xlsx/pptx → 分段 markdown,section 可寻址;
|
|
112
|
+
# patch/update 后写回导出到 <office_dir>/.outbox/)
|
|
113
|
+
office_enabled: true
|
|
114
|
+
# 消息目录;空= <FUSION_OFFICE_DATA_DIR 或 ~/.fusion-office>/fusion-artifacts-engine
|
|
115
|
+
office_dir: ""
|
|
116
|
+
|
|
117
|
+
long_context:
|
|
118
|
+
# v0.7.1 #91: 分层上下文压缩主机制(compactor 保持最后兜底)。
|
|
119
|
+
# 滚动摘要:版本数达 summary_threshold 后用 fusion-mlx 生成 changelog 摘要,
|
|
120
|
+
# 写回 artifact.summary(ref_text 自动携带)+ metadata.summary_version 防重。0=禁用
|
|
121
|
+
summary_threshold: 5
|
|
122
|
+
# 摘要生成模型;空=fusion-mlx 默认模型
|
|
123
|
+
summary_model: ""
|
|
124
|
+
mlx_url: "http://127.0.0.1:11434"
|
|
125
|
+
# 空=env FUSION_MLX_API_KEY
|
|
126
|
+
mlx_api_key: ""
|
|
127
|
+
# RAG 归档:版本被取代时把旧版本推入 fusion-rag(幂等,metadata.archived_versions 防重)。
|
|
128
|
+
# rag 不可达仅告警,绝不阻断版本创建。
|
|
129
|
+
rag_enabled: true
|
|
130
|
+
# /kb 前缀是 fusion-rag 应用层路由(/kb/bases/...)
|
|
131
|
+
rag_url: "http://127.0.0.1:11436/kb"
|
|
132
|
+
# 空=env FUSION_RAG_API_KEY
|
|
133
|
+
rag_api_key: ""
|
|
134
|
+
rag_kb_id: "fusion-artifacts"
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
ai:
|
|
138
|
+
# v0.7.5 #97: webui AI 生成/迭代入口的后端(OpenAI 兼容 /v1/chat/completions)。
|
|
139
|
+
base_url: "http://127.0.0.1:11434"
|
|
140
|
+
# 空=自动取 /v1/models 第一个可用模型
|
|
141
|
+
model: ""
|
|
142
|
+
timeout: 120.0
|
|
143
|
+
# 空=不发送 Authorization 头(fusion-mlx 本地默认无鉴权)
|
|
144
|
+
api_key: ""
|