-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathllms.txt
More file actions
108 lines (79 loc) Β· 2.78 KB
/
Copy pathllms.txt
File metadata and controls
108 lines (79 loc) Β· 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# sinks/ β LLM context file
This directory contains all delivery sinks for Linnet.
Each sink receives the fully-built daily payload and delivers it to an external service.
See also: sinks/README.md (human guide), sinks/_template/ (starter)
---
## File map
```
base.py BaseSink ABC β credentials from env, config for display options
__init__.py SINK_REGISTRY list β all active sinks registered here
README.md Human-readable guide
llms.txt This file
slack/
__init__.py SlackSink β Block Kit via Incoming Webhook
README.md Setup, config, message structure, limitations
_template/
__init__.py Fully commented starter for new sinks
README.md How to use the template
```
---
## BaseSink contract
```python
class BaseSink(ABC):
key: str = "" # unique snake_case β must match sinks.<key> in sources.yaml
def __init__(self, config: dict): ...
@property
def enabled(self) -> bool:
return self.config.get("enabled", False) # sinks are opt-in
@abstractmethod
def deliver(self, payload: dict) -> None:
# Format and deliver payload to the external service.
# Raise on unrecoverable errors.
...
```
Sinks default to **disabled**. Must set `enabled: true` in sources.yaml to activate.
---
## Credential convention
Always read from `os.environ`, never from `self.config`:
```python
def deliver(self, payload):
token = os.environ.get("MY_TOKEN", "")
if not token:
raise EnvironmentError("MY_TOKEN is not set")
```
---
## Payload schema
```python
payload = {
"date": "YYYY-MM-DD",
"papers": list[dict], # see extensions/llms.txt β Papers schema
"hacker_news": list[dict], # see extensions/llms.txt β HN stories schema
"github_trending": list[dict], # see extensions/llms.txt β GitHub repos schema
"jobs": list[dict], # see extensions/llms.txt β Jobs schema
"supervisor_updates": list[dict], # see extensions/llms.txt β Supervisor schema
"meta": {
"duration_seconds": int,
"llm_model": str,
},
}
```
---
## SINK_REGISTRY
```python
# sinks/__init__.py
from sinks.base import BaseSink
from sinks.slack import SlackSink
SINK_REGISTRY: list[type[BaseSink]] = [
SlackSink,
# MySink, β add here
]
```
The orchestrator iterates SINK_REGISTRY, skips disabled sinks, and calls `sink.deliver(payload)`.
---
## How to add a sink (quick reference)
1. `cp -r sinks/_template sinks/my_sink`
2. Set `key`; implement `deliver()`; read credentials from `os.environ`
3. Add to `SINK_REGISTRY` in `sinks/__init__.py`
4. Add config block under `sinks:` in `config/sources.yaml`
5. Document required env var in `sinks/my_sink/README.md`
6. `PYTHONPATH=. pytest tests/ -q` β all must pass