chaoscypher-neuron 0.1.0__tar.gz
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.
- chaoscypher_neuron-0.1.0/PKG-INFO +185 -0
- chaoscypher_neuron-0.1.0/README.md +160 -0
- chaoscypher_neuron-0.1.0/pyproject.toml +48 -0
- chaoscypher_neuron-0.1.0/setup.cfg +4 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/__init__.py +49 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/config.py +327 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/handlers/__init__.py +40 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/handlers/chat_completion.py +931 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/handlers/quality_scores.py +176 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/handlers/template_embedding.py +147 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/py.typed +0 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/recovery/__init__.py +18 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/recovery/extraction.py +226 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/recovery/sources.py +96 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/search_sweep.py +318 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/settings_sync.py +337 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/setup/__init__.py +20 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/setup/llm_handlers.py +113 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/setup/ops_handlers.py +373 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/setup/shared.py +146 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/types.py +58 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron/worker.py +1041 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron.egg-info/PKG-INFO +185 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron.egg-info/SOURCES.txt +26 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron.egg-info/dependency_links.txt +1 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron.egg-info/entry_points.txt +2 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron.egg-info/requires.txt +8 -0
- chaoscypher_neuron-0.1.0/src/chaoscypher_neuron.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chaoscypher-neuron
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Chaos Cypher Neuron - Background task processing workers (worker cells)
|
|
5
|
+
Author-email: Denis MacPherson <denis@chaoscypher.com>
|
|
6
|
+
License-Expression: AGPL-3.0-only
|
|
7
|
+
Project-URL: Homepage, https://github.com/chaoscypherinc/chaoscypher
|
|
8
|
+
Project-URL: Documentation, https://github.com/chaoscypherinc/chaoscypher#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/chaoscypherinc/chaoscypher
|
|
10
|
+
Project-URL: Issues, https://github.com/chaoscypherinc/chaoscypher/issues
|
|
11
|
+
Keywords: knowledge-graph,workers,background-tasks,queue,ai
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Requires-Python: >=3.14
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: chaoscypher-core>=0.1.0
|
|
19
|
+
Requires-Dist: structlog<26,>=25.5.0
|
|
20
|
+
Requires-Dist: pyyaml<7,>=6.0.3
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest<10,>=9.0.0; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-cov<8,>=7.1.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-asyncio<2,>=1.3.0; extra == "dev"
|
|
25
|
+
|
|
26
|
+
# ChaosCypher Neuron
|
|
27
|
+
|
|
28
|
+
**Background task processing — unified worker cell**
|
|
29
|
+
|
|
30
|
+
Neuron is ChaosCypher's background worker process. A single `cc-neuron`
|
|
31
|
+
entry point runs two independently-paced queues in one process:
|
|
32
|
+
|
|
33
|
+
- **LLM queue** — serialized (default 1 concurrent) for chat, embeddings,
|
|
34
|
+
tool calls, and chunk extraction. Sequential execution avoids overwhelming
|
|
35
|
+
the LLM provider and keeps priority queueing fair.
|
|
36
|
+
- **Operations queue** — parallel (default 8 concurrent) for source
|
|
37
|
+
processing, exports, workflows, vision-page work, and other CPU/IO-bound
|
|
38
|
+
tasks that benefit from concurrency.
|
|
39
|
+
|
|
40
|
+
Tasks are pulled from [Valkey](https://valkey.io/) via ChaosCypher's own
|
|
41
|
+
queue client (`chaoscypher_core.queue`); there is no ARQ, Celery, or RQ
|
|
42
|
+
dependency.
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Workspace sync — installs core + cortex + neuron + dev tools
|
|
48
|
+
uv sync --all-packages --extra dev
|
|
49
|
+
|
|
50
|
+
# Single-package mode (neuron + its core dependency only)
|
|
51
|
+
uv sync --package chaoscypher-neuron
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The repo uses uv workspaces (see root `pyproject.toml` `[tool.uv.workspace]`).
|
|
55
|
+
Install uv via [the official installer](https://docs.astral.sh/uv/getting-started/installation/)
|
|
56
|
+
before running these commands; `pip install -e .` is not supported.
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Start the unified worker (both queues)
|
|
62
|
+
cc-neuron
|
|
63
|
+
|
|
64
|
+
# With a custom Valkey instance
|
|
65
|
+
QUEUE_HOST=localhost QUEUE_PORT=6379 cc-neuron
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The worker auto-detects which queue handlers are registered and polls
|
|
69
|
+
each queue at its configured concurrency. There is no separate
|
|
70
|
+
`cc-neuron-llm` / `cc-neuron-ops` binary — both queues run in the same
|
|
71
|
+
process.
|
|
72
|
+
|
|
73
|
+
### Docker
|
|
74
|
+
|
|
75
|
+
In the all-in-one image, `cc-neuron` is launched by supervisord alongside
|
|
76
|
+
cortex, valkey, and nginx. In the multi-container deployments
|
|
77
|
+
(`packages/docker/multi-container/docker-compose.{dev,prod}.yml`) the
|
|
78
|
+
worker runs in its own `worker` service:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
docker run -e QUEUE_HOST=valkey -e QUEUE_PORT=6379 chaoscypher-neuron
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Configuration
|
|
85
|
+
|
|
86
|
+
Worker behaviour is configured through ChaosCypher's settings layer
|
|
87
|
+
(env var → `packages/docker/data/settings.yaml` → package default).
|
|
88
|
+
Concurrency and timeouts live under `QueueSettings`; only the Valkey
|
|
89
|
+
connection itself is read directly from the environment so the worker
|
|
90
|
+
can bootstrap before settings are loaded:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
QUEUE_HOST=localhost # Valkey hostname
|
|
94
|
+
QUEUE_PORT=6379 # Valkey port
|
|
95
|
+
QUEUE_PASSWORD=chaoscypher # Valkey password
|
|
96
|
+
QUEUE_DB=0 # Valkey logical DB
|
|
97
|
+
LOG_LEVEL=INFO
|
|
98
|
+
USE_JSON_LOGGING=false
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Per-queue concurrency, retry limits, and timeouts are not env-driven —
|
|
102
|
+
edit `settings.yaml` and restart the worker, or change them through the
|
|
103
|
+
Settings UI (cortex pushes updates via the `settings_changes` channel and
|
|
104
|
+
`cc-neuron` picks them up at the next poll boundary).
|
|
105
|
+
|
|
106
|
+
## Architecture
|
|
107
|
+
|
|
108
|
+
Neuron is part of the ChaosCypher neural architecture:
|
|
109
|
+
|
|
110
|
+
- **Core** — domain logic + operational substrate (queue, settings, handlers)
|
|
111
|
+
- **Cortex** — FastAPI backend that enqueues work
|
|
112
|
+
- **Neuron** — unified worker that consumes both queues 👈 You are here
|
|
113
|
+
- **Interface** — React UI
|
|
114
|
+
|
|
115
|
+
### Why one process, two queues?
|
|
116
|
+
|
|
117
|
+
- **Separate concurrency control.** The LLM queue intentionally throttles
|
|
118
|
+
to 1; the Operations queue parallelises to 8. Running them in the same
|
|
119
|
+
process avoids container overhead and the need for two scaler knobs
|
|
120
|
+
while keeping each queue independently paced.
|
|
121
|
+
- **Shared resources.** Database adapter, LLM provider, settings cache,
|
|
122
|
+
recovery loops, and the Valkey connection pool are initialised once
|
|
123
|
+
per process instead of duplicated across two worker images.
|
|
124
|
+
- **Startup recovery.** A single recovery sweep (`SourceRecovery` +
|
|
125
|
+
orphan-task rehydration) runs at boot, not twice.
|
|
126
|
+
|
|
127
|
+
## Task types
|
|
128
|
+
|
|
129
|
+
### LLM queue
|
|
130
|
+
- `llm_chat` — chat completion
|
|
131
|
+
- `llm_embedding` — generate embeddings
|
|
132
|
+
- `llm_tool_call` — execute tool with LLM
|
|
133
|
+
- `llm_extract_chunk` — entity / relationship extraction over a chunk
|
|
134
|
+
|
|
135
|
+
### Operations queue
|
|
136
|
+
- `operations_indexing` — chunking + entity prep
|
|
137
|
+
- `operations_embedding` — bulk embedding writeback
|
|
138
|
+
- `operations_commit` — graph commit + search index update
|
|
139
|
+
- `operations_vision_page` / `operations_vision_finalize` — per-page vision
|
|
140
|
+
- `operations_export` / `operations_import` — package export / import
|
|
141
|
+
- `operations_workflow` — workflow step execution
|
|
142
|
+
|
|
143
|
+
Canonical mapping lives in `chaoscypher_core.constants.OPERATION_QUEUE_ROUTING`
|
|
144
|
+
(enforced by lint rule CC044).
|
|
145
|
+
|
|
146
|
+
## Monitoring
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Container logs
|
|
150
|
+
docker compose logs -f chaoscypher # all-in-one (supervisord muxes)
|
|
151
|
+
docker compose logs -f worker # multi-container worker service
|
|
152
|
+
|
|
153
|
+
# Queue depth + per-task status via cortex
|
|
154
|
+
curl http://localhost/api/v1/queue/status
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Workspace install (from repo root)
|
|
161
|
+
uv sync --all-packages --extra dev
|
|
162
|
+
|
|
163
|
+
# Run tests
|
|
164
|
+
uv run pytest packages/neuron
|
|
165
|
+
|
|
166
|
+
# Auto-restart on source edits
|
|
167
|
+
uv run watchmedo auto-restart -d packages/neuron/src -p '*.py' -- cc-neuron
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Scaling
|
|
171
|
+
|
|
172
|
+
The all-in-one image runs exactly one `cc-neuron` instance under
|
|
173
|
+
supervisord. For horizontal scale-out, use the multi-container
|
|
174
|
+
deployment and replicate the `worker` service:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
cd packages/docker/multi-container
|
|
178
|
+
docker compose -f docker-compose.prod.yml up -d --scale worker=4
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Each replica polls both queues; Valkey distributes tasks across them.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
AGPL-3.0 — see the repository `LICENSE` file.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# ChaosCypher Neuron
|
|
2
|
+
|
|
3
|
+
**Background task processing — unified worker cell**
|
|
4
|
+
|
|
5
|
+
Neuron is ChaosCypher's background worker process. A single `cc-neuron`
|
|
6
|
+
entry point runs two independently-paced queues in one process:
|
|
7
|
+
|
|
8
|
+
- **LLM queue** — serialized (default 1 concurrent) for chat, embeddings,
|
|
9
|
+
tool calls, and chunk extraction. Sequential execution avoids overwhelming
|
|
10
|
+
the LLM provider and keeps priority queueing fair.
|
|
11
|
+
- **Operations queue** — parallel (default 8 concurrent) for source
|
|
12
|
+
processing, exports, workflows, vision-page work, and other CPU/IO-bound
|
|
13
|
+
tasks that benefit from concurrency.
|
|
14
|
+
|
|
15
|
+
Tasks are pulled from [Valkey](https://valkey.io/) via ChaosCypher's own
|
|
16
|
+
queue client (`chaoscypher_core.queue`); there is no ARQ, Celery, or RQ
|
|
17
|
+
dependency.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Workspace sync — installs core + cortex + neuron + dev tools
|
|
23
|
+
uv sync --all-packages --extra dev
|
|
24
|
+
|
|
25
|
+
# Single-package mode (neuron + its core dependency only)
|
|
26
|
+
uv sync --package chaoscypher-neuron
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The repo uses uv workspaces (see root `pyproject.toml` `[tool.uv.workspace]`).
|
|
30
|
+
Install uv via [the official installer](https://docs.astral.sh/uv/getting-started/installation/)
|
|
31
|
+
before running these commands; `pip install -e .` is not supported.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Start the unified worker (both queues)
|
|
37
|
+
cc-neuron
|
|
38
|
+
|
|
39
|
+
# With a custom Valkey instance
|
|
40
|
+
QUEUE_HOST=localhost QUEUE_PORT=6379 cc-neuron
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The worker auto-detects which queue handlers are registered and polls
|
|
44
|
+
each queue at its configured concurrency. There is no separate
|
|
45
|
+
`cc-neuron-llm` / `cc-neuron-ops` binary — both queues run in the same
|
|
46
|
+
process.
|
|
47
|
+
|
|
48
|
+
### Docker
|
|
49
|
+
|
|
50
|
+
In the all-in-one image, `cc-neuron` is launched by supervisord alongside
|
|
51
|
+
cortex, valkey, and nginx. In the multi-container deployments
|
|
52
|
+
(`packages/docker/multi-container/docker-compose.{dev,prod}.yml`) the
|
|
53
|
+
worker runs in its own `worker` service:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
docker run -e QUEUE_HOST=valkey -e QUEUE_PORT=6379 chaoscypher-neuron
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
Worker behaviour is configured through ChaosCypher's settings layer
|
|
62
|
+
(env var → `packages/docker/data/settings.yaml` → package default).
|
|
63
|
+
Concurrency and timeouts live under `QueueSettings`; only the Valkey
|
|
64
|
+
connection itself is read directly from the environment so the worker
|
|
65
|
+
can bootstrap before settings are loaded:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
QUEUE_HOST=localhost # Valkey hostname
|
|
69
|
+
QUEUE_PORT=6379 # Valkey port
|
|
70
|
+
QUEUE_PASSWORD=chaoscypher # Valkey password
|
|
71
|
+
QUEUE_DB=0 # Valkey logical DB
|
|
72
|
+
LOG_LEVEL=INFO
|
|
73
|
+
USE_JSON_LOGGING=false
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Per-queue concurrency, retry limits, and timeouts are not env-driven —
|
|
77
|
+
edit `settings.yaml` and restart the worker, or change them through the
|
|
78
|
+
Settings UI (cortex pushes updates via the `settings_changes` channel and
|
|
79
|
+
`cc-neuron` picks them up at the next poll boundary).
|
|
80
|
+
|
|
81
|
+
## Architecture
|
|
82
|
+
|
|
83
|
+
Neuron is part of the ChaosCypher neural architecture:
|
|
84
|
+
|
|
85
|
+
- **Core** — domain logic + operational substrate (queue, settings, handlers)
|
|
86
|
+
- **Cortex** — FastAPI backend that enqueues work
|
|
87
|
+
- **Neuron** — unified worker that consumes both queues 👈 You are here
|
|
88
|
+
- **Interface** — React UI
|
|
89
|
+
|
|
90
|
+
### Why one process, two queues?
|
|
91
|
+
|
|
92
|
+
- **Separate concurrency control.** The LLM queue intentionally throttles
|
|
93
|
+
to 1; the Operations queue parallelises to 8. Running them in the same
|
|
94
|
+
process avoids container overhead and the need for two scaler knobs
|
|
95
|
+
while keeping each queue independently paced.
|
|
96
|
+
- **Shared resources.** Database adapter, LLM provider, settings cache,
|
|
97
|
+
recovery loops, and the Valkey connection pool are initialised once
|
|
98
|
+
per process instead of duplicated across two worker images.
|
|
99
|
+
- **Startup recovery.** A single recovery sweep (`SourceRecovery` +
|
|
100
|
+
orphan-task rehydration) runs at boot, not twice.
|
|
101
|
+
|
|
102
|
+
## Task types
|
|
103
|
+
|
|
104
|
+
### LLM queue
|
|
105
|
+
- `llm_chat` — chat completion
|
|
106
|
+
- `llm_embedding` — generate embeddings
|
|
107
|
+
- `llm_tool_call` — execute tool with LLM
|
|
108
|
+
- `llm_extract_chunk` — entity / relationship extraction over a chunk
|
|
109
|
+
|
|
110
|
+
### Operations queue
|
|
111
|
+
- `operations_indexing` — chunking + entity prep
|
|
112
|
+
- `operations_embedding` — bulk embedding writeback
|
|
113
|
+
- `operations_commit` — graph commit + search index update
|
|
114
|
+
- `operations_vision_page` / `operations_vision_finalize` — per-page vision
|
|
115
|
+
- `operations_export` / `operations_import` — package export / import
|
|
116
|
+
- `operations_workflow` — workflow step execution
|
|
117
|
+
|
|
118
|
+
Canonical mapping lives in `chaoscypher_core.constants.OPERATION_QUEUE_ROUTING`
|
|
119
|
+
(enforced by lint rule CC044).
|
|
120
|
+
|
|
121
|
+
## Monitoring
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Container logs
|
|
125
|
+
docker compose logs -f chaoscypher # all-in-one (supervisord muxes)
|
|
126
|
+
docker compose logs -f worker # multi-container worker service
|
|
127
|
+
|
|
128
|
+
# Queue depth + per-task status via cortex
|
|
129
|
+
curl http://localhost/api/v1/queue/status
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Workspace install (from repo root)
|
|
136
|
+
uv sync --all-packages --extra dev
|
|
137
|
+
|
|
138
|
+
# Run tests
|
|
139
|
+
uv run pytest packages/neuron
|
|
140
|
+
|
|
141
|
+
# Auto-restart on source edits
|
|
142
|
+
uv run watchmedo auto-restart -d packages/neuron/src -p '*.py' -- cc-neuron
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Scaling
|
|
146
|
+
|
|
147
|
+
The all-in-one image runs exactly one `cc-neuron` instance under
|
|
148
|
+
supervisord. For horizontal scale-out, use the multi-container
|
|
149
|
+
deployment and replicate the `worker` service:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
cd packages/docker/multi-container
|
|
153
|
+
docker compose -f docker-compose.prod.yml up -d --scale worker=4
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Each replica polls both queues; Valkey distributes tasks across them.
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
AGPL-3.0 — see the repository `LICENSE` file.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=82.0.0,<90", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "chaoscypher-neuron"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Chaos Cypher Neuron - Background task processing workers (worker cells)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "AGPL-3.0-only"
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Denis MacPherson", email = "denis@chaoscypher.com"}
|
|
13
|
+
]
|
|
14
|
+
keywords = ["knowledge-graph", "workers", "background-tasks", "queue", "ai"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
]
|
|
21
|
+
requires-python = ">=3.14"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"chaoscypher-core>=0.1.0",
|
|
24
|
+
"structlog>=25.5.0,<26",
|
|
25
|
+
"pyyaml>=6.0.3,<7",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
dev = [
|
|
30
|
+
"pytest>=9.0.0,<10",
|
|
31
|
+
"pytest-cov>=7.1.0,<8",
|
|
32
|
+
"pytest-asyncio>=1.3.0,<2",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
cc-neuron = "chaoscypher_neuron.worker:main"
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/chaoscypherinc/chaoscypher"
|
|
40
|
+
Documentation = "https://github.com/chaoscypherinc/chaoscypher#readme"
|
|
41
|
+
Repository = "https://github.com/chaoscypherinc/chaoscypher"
|
|
42
|
+
Issues = "https://github.com/chaoscypherinc/chaoscypher/issues"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.packages.find]
|
|
45
|
+
where = ["src"]
|
|
46
|
+
|
|
47
|
+
[tool.setuptools.package-data]
|
|
48
|
+
chaoscypher_neuron = ["py.typed"]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Copyright (C) 2024-2026 Chaos Cypher, Inc.
|
|
2
|
+
# SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
|
|
4
|
+
"""Chaos Cypher Neuron - Background Task Processing Workers.
|
|
5
|
+
|
|
6
|
+
Background task processing capabilities with a unified worker that handles
|
|
7
|
+
both LLM and Operations queues concurrently. Part of the Neural Architecture.
|
|
8
|
+
|
|
9
|
+
Queue Configuration:
|
|
10
|
+
- LLM queue: Serialized AI operations (default 1 concurrent task)
|
|
11
|
+
(chat, embeddings, tool calls, chunk extraction)
|
|
12
|
+
- Operations queue: Parallel processing (default 8 concurrent tasks)
|
|
13
|
+
(source processing, exports, workflows, bulk operations)
|
|
14
|
+
|
|
15
|
+
Components:
|
|
16
|
+
- worker: Unified entry point (cc-neuron) running both queues
|
|
17
|
+
- config: Worker configuration management
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
Start the unified worker via CLI entry point::
|
|
21
|
+
|
|
22
|
+
# Start unified worker (both LLM and Operations queues)
|
|
23
|
+
cc-neuron
|
|
24
|
+
|
|
25
|
+
For programmatic access to configuration::
|
|
26
|
+
|
|
27
|
+
from chaoscypher_neuron.config import load_worker_config
|
|
28
|
+
|
|
29
|
+
config = load_worker_config("llm_worker")
|
|
30
|
+
llm_timeout = config["timeout"]
|
|
31
|
+
|
|
32
|
+
Note:
|
|
33
|
+
Workers require Valkey connection. Configure via environment:
|
|
34
|
+
- QUEUE_HOST: Valkey hostname (default: valkey)
|
|
35
|
+
- QUEUE_PORT: Valkey port (default: 6379)
|
|
36
|
+
|
|
37
|
+
See Also:
|
|
38
|
+
- packages/docker/multi-container/docker-compose.dev.yml for service orchestration
|
|
39
|
+
- packages/cortex/src/chaoscypher_cortex/shared/config for timeout/retry settings
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
__version__ = "0.1.0"
|
|
43
|
+
|
|
44
|
+
# Export config functions and types for external use
|
|
45
|
+
from chaoscypher_neuron.config import load_worker_config
|
|
46
|
+
from chaoscypher_neuron.types import WorkerContext
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
__all__ = ["WorkerContext", "load_worker_config"]
|