File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 11import uuid
2+ from importlib import resources
23from pathlib import Path
34
45import netifaces
1415)
1516from interactem .core .nats .config import NatsMode , get_nats_config
1617
17- from ._vector_template import VECTOR_CONFIG_TEMPLATE
18-
1918logger = get_logger ()
2019VECTOR_NATS_CREDS_TARGET = "/nats.creds"
2120
2221
22+ def _load_vector_template () -> str :
23+ return resources .files (__package__ ).joinpath ("templates/vector.yaml.j2" ).read_text (encoding = "utf-8" )
24+
2325class Settings (BaseSettings ):
2426 model_config = SettingsConfigDict (env_file = ".env" , extra = "ignore" )
2527 ID : uuid .UUID = Field (default_factory = uuid .uuid4 )
@@ -167,7 +169,7 @@ def generate_vector_config(self) -> Path | None:
167169 raise RuntimeError (
168170 f"Log directory { self .LOG_DIR } does not exist. Should not happen."
169171 )
170- templ : Template = Template (VECTOR_CONFIG_TEMPLATE )
172+ templ : Template = Template (_load_vector_template () )
171173 vector_yaml = templ .render (
172174 logs_dir = LOGS_DIR_IN_CONTAINER ,
173175 agent_id = self .ID ,
@@ -183,4 +185,3 @@ def generate_vector_config(self) -> Path | None:
183185
184186
185187cfg = Settings () # pyright: ignore[reportCallIssue]
186-
Original file line number Diff line number Diff line change 1- VECTOR_CONFIG_TEMPLATE = """ sources:
1+ sources:
22 operator_logs:
33 type: file
44 include:
3434
3535 # Extract deployment_id and operator_id from the file path
3636 # Format: {{ logs_dir }}/<deployment _id >/op-<operator _id >.log
37- file_match = parse_regex!(string!(.file), r'/(?P<deployment_id>[^/]+)/op-(?P<operator_id>[^.]+)\\ .log$')
37+ file_match = parse_regex!(string!(.file), r'/(?P<deployment _id >[^/]+)/op-(?P<operator _id >[^.]+)\.log$')
3838 .deployment_id = file_match.deployment_id
3939 .operator_id = file_match.operator_id
4040{% endraw %}
9393 .log_type = "agent"
9494
9595 # Strip ANSI color codes from the message
96- .log = replace(string!(.message), r'\\ x1b\ \ [[0-9;]*m', "")
96+ .log = replace(string!(.message), r'\x1b\[[0-9;]*m', "")
9797
9898 # Parse the Python logging format: ISO8601_TIMESTAMP - module.name - LEVEL - message
9999 # Example: 2025-10-08T13:02:06.547Z - module.name - INFO - message
204204 strategy: credentials_file
205205 credentials_file:
206206 path: "{{ nats_creds_path }}"
207- """
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ interactem-core = { path = "../core", editable = true }
3434
3535[tool .poetry ]
3636packages = [{ include = " interactem" }]
37+ include = [" interactem/agent/templates/*.j2" ]
38+
39+ [tool .uv .build-backend ]
40+ source-include = [" interactem/agent/templates/*.j2" ]
3741
3842[tool .poetry .dependencies ]
3943interactem-core = {path = " ../core" , develop = true }
You can’t perform that action at this time.
0 commit comments