cluxion-agentplugin-preprocessing 0.2.0__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.
Files changed (48) hide show
  1. cluxion_agentplugin_adapters/claude/.claude-plugin/plugin.json +8 -0
  2. cluxion_agentplugin_adapters/claude/skills/preprocess/SKILL.md +33 -0
  3. cluxion_agentplugin_adapters/codex/config-snippet.toml +5 -0
  4. cluxion_agentplugin_docs/cluxion-Docs/README.md +22 -0
  5. cluxion_agentplugin_docs/cluxion-Docs/architecture.md +36 -0
  6. cluxion_agentplugin_docs/cluxion-Docs/harness-logic.md +51 -0
  7. cluxion_agentplugin_docs/cluxion-Docs/honesty-preprocessing.md +40 -0
  8. cluxion_agentplugin_docs/cluxion-Docs/install-and-operations.md +36 -0
  9. cluxion_agentplugin_docs/cluxion-Docs/security.md +27 -0
  10. cluxion_agentplugin_docs/github-profile/README.md +67 -0
  11. cluxion_agentplugin_preprocessing/__init__.py +7 -0
  12. cluxion_agentplugin_preprocessing/cli.py +124 -0
  13. cluxion_agentplugin_preprocessing/hermes_config.py +163 -0
  14. cluxion_agentplugin_preprocessing/plugin.py +135 -0
  15. cluxion_agentplugin_preprocessing/plugin.yaml +13 -0
  16. cluxion_agentplugin_preprocessing/runner.py +241 -0
  17. cluxion_agentplugin_preprocessing/schemas.py +148 -0
  18. cluxion_agentplugin_preprocessing-0.2.0.dist-info/METADATA +115 -0
  19. cluxion_agentplugin_preprocessing-0.2.0.dist-info/RECORD +48 -0
  20. cluxion_agentplugin_preprocessing-0.2.0.dist-info/WHEEL +4 -0
  21. cluxion_agentplugin_preprocessing-0.2.0.dist-info/entry_points.txt +8 -0
  22. cluxion_agentplugin_preprocessing-0.2.0.dist-info/licenses/LICENSE +197 -0
  23. cluxion_runtime/__init__.py +16 -0
  24. cluxion_runtime/__main__.py +5 -0
  25. cluxion_runtime/adapters/__init__.py +25 -0
  26. cluxion_runtime/adapters/contract.py +82 -0
  27. cluxion_runtime/adapters/grok_build.py +35 -0
  28. cluxion_runtime/adapters/hermes.py +161 -0
  29. cluxion_runtime/adapters/spec.py +35 -0
  30. cluxion_runtime/bootstrap.py +270 -0
  31. cluxion_runtime/cli.py +282 -0
  32. cluxion_runtime/core/__init__.py +36 -0
  33. cluxion_runtime/core/clarification.py +192 -0
  34. cluxion_runtime/core/dispatch_store.py +270 -0
  35. cluxion_runtime/core/harness.py +320 -0
  36. cluxion_runtime/core/intent.py +55 -0
  37. cluxion_runtime/core/ledger.py +189 -0
  38. cluxion_runtime/core/ledger_codec.py +38 -0
  39. cluxion_runtime/core/plan_codec.py +121 -0
  40. cluxion_runtime/core/preprocess.py +497 -0
  41. cluxion_runtime/core/types.py +220 -0
  42. cluxion_runtime/core/work_queue.py +73 -0
  43. cluxion_runtime/models/__init__.py +15 -0
  44. cluxion_runtime/models/supervisor.py +156 -0
  45. cluxion_runtime/models/vllm_mlx.py +87 -0
  46. cluxion_runtime/resources/__init__.py +7 -0
  47. cluxion_runtime/resources/queue_bridge.py +128 -0
  48. cluxion_runtime/resources/rust_bridge.py +82 -0
@@ -0,0 +1,135 @@
1
+ from __future__ import annotations
2
+
3
+ """Universal agent plugin entry point (Hermes, Claude, Codex, Grok Build)."""
4
+
5
+ import json
6
+ from typing import TYPE_CHECKING
7
+
8
+ from cluxion_agentplugin_preprocessing import runner
9
+ from cluxion_agentplugin_preprocessing.schemas import (
10
+ BOOTSTRAP_SCHEMA,
11
+ CLARIFY_SCHEMA,
12
+ HERMES_CONFIG_SCHEMA,
13
+ PLAN_SCHEMA,
14
+ QUEUE_BRIEF_SCHEMA,
15
+ QUEUE_NEXT_SCHEMA,
16
+ QUEUE_RECORD_SCHEMA,
17
+ SERVE_LOCAL_SCHEMA,
18
+ )
19
+
20
+ if TYPE_CHECKING:
21
+ from collections.abc import Callable
22
+
23
+
24
+ def register(ctx: object) -> None:
25
+ """Register Cluxion preprocessing tools with the host agent."""
26
+ ctx.register_tool(
27
+ name="cluxion_plan",
28
+ toolset="cluxion",
29
+ schema=PLAN_SCHEMA,
30
+ handler=_handle_plan,
31
+ check_fn=_check_runtime_available,
32
+ emoji="๐Ÿงญ",
33
+ )
34
+ ctx.register_tool(
35
+ name="cluxion_clarify",
36
+ toolset="cluxion",
37
+ schema=CLARIFY_SCHEMA,
38
+ handler=_handle_clarify,
39
+ check_fn=_check_runtime_available,
40
+ emoji="โ“",
41
+ )
42
+ ctx.register_tool(
43
+ name="cluxion_bootstrap",
44
+ toolset="cluxion",
45
+ schema=BOOTSTRAP_SCHEMA,
46
+ handler=_handle_bootstrap,
47
+ check_fn=_check_runtime_available,
48
+ emoji="๐Ÿ”ง",
49
+ )
50
+ ctx.register_tool(
51
+ name="cluxion_serve_local",
52
+ toolset="cluxion",
53
+ schema=SERVE_LOCAL_SCHEMA,
54
+ handler=_handle_serve_local,
55
+ check_fn=_check_runtime_available,
56
+ emoji="๐Ÿ–ฅ๏ธ",
57
+ )
58
+ ctx.register_tool(
59
+ name="cluxion_hermes_config",
60
+ toolset="cluxion",
61
+ schema=HERMES_CONFIG_SCHEMA,
62
+ handler=_handle_hermes_config,
63
+ check_fn=_check_runtime_available,
64
+ emoji="๐Ÿ”Œ",
65
+ )
66
+ ctx.register_tool(
67
+ name="cluxion_queue_next",
68
+ toolset="cluxion",
69
+ schema=QUEUE_NEXT_SCHEMA,
70
+ handler=_handle_queue_next,
71
+ check_fn=_check_runtime_available,
72
+ emoji="โžก๏ธ",
73
+ )
74
+ ctx.register_tool(
75
+ name="cluxion_queue_record",
76
+ toolset="cluxion",
77
+ schema=QUEUE_RECORD_SCHEMA,
78
+ handler=_handle_queue_record,
79
+ check_fn=_check_runtime_available,
80
+ emoji="๐Ÿงพ",
81
+ )
82
+ ctx.register_tool(
83
+ name="cluxion_queue_brief",
84
+ toolset="cluxion",
85
+ schema=QUEUE_BRIEF_SCHEMA,
86
+ handler=_handle_queue_brief,
87
+ check_fn=_check_runtime_available,
88
+ emoji="๐Ÿ“Œ",
89
+ )
90
+
91
+
92
+ def _check_runtime_available() -> bool:
93
+ return runner.runtime_available()
94
+
95
+
96
+ def _handle_plan(args: dict[str, object], **_: object) -> str:
97
+ return _json_result(lambda: runner.plan(args).to_json())
98
+
99
+
100
+ def _handle_clarify(args: dict[str, object], **_: object) -> str:
101
+ return _json_result(lambda: runner.plan(args).to_json())
102
+
103
+
104
+ def _handle_bootstrap(args: dict[str, object], **_: object) -> str:
105
+ return _json_result(lambda: runner.bootstrap(args).to_json())
106
+
107
+
108
+ def _handle_serve_local(args: dict[str, object], **_: object) -> str:
109
+ return _json_result(lambda: runner.serve_local(args).to_json())
110
+
111
+
112
+ def _handle_hermes_config(args: dict[str, object], **_: object) -> str:
113
+ return _json_result(lambda: runner.hermes_config(args).to_json())
114
+
115
+
116
+ def _handle_queue_next(args: dict[str, object], **_: object) -> str:
117
+ return _json_result(lambda: runner.queue_next(args).to_json())
118
+
119
+
120
+ def _handle_queue_record(args: dict[str, object], **_: object) -> str:
121
+ return _json_result(lambda: runner.queue_record(args).to_json())
122
+
123
+
124
+ def _handle_queue_brief(args: dict[str, object], **_: object) -> str:
125
+ return _json_result(lambda: runner.queue_brief(args).to_json())
126
+
127
+
128
+ def _json_result(callback: Callable[[], str]) -> str:
129
+ try:
130
+ return callback()
131
+ except ValueError as exc:
132
+ return json.dumps({"ok": False, "error": str(exc)}, ensure_ascii=False, sort_keys=True)
133
+
134
+
135
+ __all__ = ["register"]
@@ -0,0 +1,13 @@
1
+ name: hermes-cluxion
2
+ version: 0.1.9
3
+ description: "Universal agent preprocessing plugin: honesty contracts, clarification, Rust work queue, resource-aware harness handoff. Connected AI calls cluxion tools; plugin does not own models."
4
+ author: cluxion
5
+ kind: standalone
6
+ provides_tools:
7
+ - cluxion_bootstrap
8
+ - cluxion_plan
9
+ - cluxion_serve_local
10
+ - cluxion_hermes_config
11
+ - cluxion_queue_next
12
+ - cluxion_queue_record
13
+ - cluxion_queue_brief
@@ -0,0 +1,241 @@
1
+ from __future__ import annotations
2
+
3
+ """Subprocess bridge to an installed cluxion-runtime command."""
4
+
5
+ import json
6
+ import os
7
+ import shutil
8
+ import subprocess
9
+ import sys
10
+ from contextlib import redirect_stderr, redirect_stdout
11
+ from dataclasses import dataclass
12
+ from io import StringIO
13
+ from typing import TYPE_CHECKING
14
+
15
+ if TYPE_CHECKING:
16
+ from collections.abc import Callable, Mapping, Sequence
17
+
18
+ CommandRunner = Callable[[Sequence[str], str | None], subprocess.CompletedProcess[str]]
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class RuntimeResult:
23
+ """Normalized result returned to Hermes tools."""
24
+
25
+ ok: bool
26
+ command: tuple[str, ...]
27
+ payload: dict[str, object]
28
+
29
+ def to_json(self) -> str:
30
+ """Return a Hermes tool-compatible JSON string."""
31
+ return json.dumps({"ok": self.ok, "command": list(self.command), **self.payload}, ensure_ascii=False, sort_keys=True)
32
+
33
+
34
+ def runtime_available(binary: str | None = None) -> bool:
35
+ """Check whether cluxion-runtime is visible to Hermes."""
36
+ configured_binary = binary or os.environ.get("CLUXION_RUNTIME_BIN")
37
+ if configured_binary:
38
+ return shutil.which(configured_binary) is not None
39
+ return shutil.which("cluxion-runtime") is not None or _runtime_module_available()
40
+
41
+
42
+ def plan(payload: Mapping[str, object], *, command_runner: CommandRunner | None = None) -> RuntimeResult:
43
+ """Run cluxion-runtime plan for a Hermes task."""
44
+ command = (_runtime_binary(None), "plan", "--json-stdin", "--surface", "hermes")
45
+ stdin = json.dumps(dict(payload), ensure_ascii=False)
46
+ return _execute_json(command, stdin, command_runner or _run_command)
47
+
48
+
49
+ def bootstrap(payload: Mapping[str, object], *, command_runner: CommandRunner | None = None) -> RuntimeResult:
50
+ """Run cluxion-runtime bootstrap for local dependencies."""
51
+ command = [_runtime_binary(None), "bootstrap"]
52
+ if bool(payload.get("upgrade", False)):
53
+ command.append("--upgrade")
54
+ if bool(payload.get("dry_run", False)):
55
+ command.append("--dry-run")
56
+ packages = payload.get("packages", [])
57
+ if isinstance(packages, list):
58
+ for package in packages:
59
+ command.extend(("--package", str(package)))
60
+ return _execute_json(tuple(command), None, command_runner or _run_command)
61
+
62
+
63
+ def serve_local(payload: Mapping[str, object], *, command_runner: CommandRunner | None = None) -> RuntimeResult:
64
+ """Run cluxion-runtime serve-local with dry-run by default."""
65
+ model = _required_str(payload, "model")
66
+ command = [
67
+ _runtime_binary(None),
68
+ "serve-local",
69
+ "--model",
70
+ model,
71
+ "--host",
72
+ _str(payload, "host", "127.0.0.1"),
73
+ "--port",
74
+ str(_int(payload, "port", 23003)),
75
+ "--max-tokens",
76
+ str(_int(payload, "max_tokens", 128_000)),
77
+ ]
78
+ if not bool(payload.get("auto_install", True)):
79
+ command.append("--no-auto-install")
80
+ if bool(payload.get("upgrade_runtime", False)):
81
+ command.append("--upgrade-runtime")
82
+ if not bool(payload.get("start", False)):
83
+ command.append("--dry-run")
84
+ return _execute_json(tuple(command), None, command_runner or _run_command)
85
+
86
+
87
+ def hermes_config(payload: Mapping[str, object], *, command_runner: CommandRunner | None = None) -> RuntimeResult:
88
+ """Render Hermes config patch for a local endpoint."""
89
+ model = _required_str(payload, "model")
90
+ command = (
91
+ _runtime_binary(None),
92
+ "hermes-local-config",
93
+ "--model",
94
+ model,
95
+ "--host",
96
+ _str(payload, "host", "127.0.0.1"),
97
+ "--port",
98
+ str(_int(payload, "port", 23003)),
99
+ "--context-length",
100
+ str(_int(payload, "context_length", 131_072)),
101
+ "--provider-key",
102
+ _str(payload, "provider_key", "cluxion-local"),
103
+ "--display-name",
104
+ _str(payload, "display_name", "Cluxion Local"),
105
+ )
106
+ return _execute_json(command, None, command_runner or _run_command)
107
+
108
+
109
+ def queue_next(payload: Mapping[str, object], *, command_runner: CommandRunner | None = None) -> RuntimeResult:
110
+ """Return the next queued segment for Hermes model execution."""
111
+ command = (_runtime_binary(None), "queue-next", "--work-id", _required_str(payload, "work_id"))
112
+ return _execute_json(command, None, command_runner or _run_command)
113
+
114
+
115
+ def queue_record(payload: Mapping[str, object], *, command_runner: CommandRunner | None = None) -> RuntimeResult:
116
+ """Record the current Hermes model's result for a queued segment."""
117
+ command = (
118
+ _runtime_binary(None),
119
+ "queue-record",
120
+ "--work-id",
121
+ _required_str(payload, "work_id"),
122
+ "--step-id",
123
+ _required_str(payload, "step_id"),
124
+ "--json-stdin",
125
+ )
126
+ stdin = json.dumps(
127
+ {
128
+ "result": str(payload.get("result", "")),
129
+ "error": str(payload.get("error", "")),
130
+ "failed": bool(payload.get("failed", False)),
131
+ },
132
+ ensure_ascii=False,
133
+ )
134
+ return _execute_json(command, stdin, command_runner or _run_command)
135
+
136
+
137
+ def queue_brief(payload: Mapping[str, object], *, command_runner: CommandRunner | None = None) -> RuntimeResult:
138
+ """Build the final briefing prompt from recorded queued segment results."""
139
+ command = (_runtime_binary(None), "queue-brief", "--work-id", _required_str(payload, "work_id"))
140
+ return _execute_json(command, None, command_runner or _run_command)
141
+
142
+
143
+ def _execute_json(command: Sequence[str], stdin: str | None, command_runner: CommandRunner) -> RuntimeResult:
144
+ if shutil.which(command[0]) is None and not _can_run_inprocess(command[0]):
145
+ return RuntimeResult(False, tuple(command), {"error": "cluxion-runtime not found in PATH"})
146
+ try:
147
+ if shutil.which(command[0]) is None:
148
+ completed = _run_inprocess(command, stdin)
149
+ else:
150
+ completed = command_runner(command, stdin)
151
+ except OSError as exc:
152
+ return RuntimeResult(False, tuple(command), {"error": str(exc)})
153
+ if completed.returncode != 0:
154
+ return RuntimeResult(
155
+ False,
156
+ tuple(command),
157
+ {"error": "cluxion-runtime failed", "stderr": completed.stderr.strip(), "returncode": completed.returncode},
158
+ )
159
+ try:
160
+ parsed = json.loads(completed.stdout)
161
+ except json.JSONDecodeError as exc:
162
+ return RuntimeResult(False, tuple(command), {"error": f"invalid JSON from cluxion-runtime: {exc}"})
163
+ if not isinstance(parsed, dict):
164
+ return RuntimeResult(False, tuple(command), {"error": "cluxion-runtime returned non-object JSON"})
165
+ return RuntimeResult(True, tuple(command), {"result": parsed})
166
+
167
+
168
+ def _run_command(command: Sequence[str], stdin: str | None) -> subprocess.CompletedProcess[str]:
169
+ return subprocess.run(
170
+ list(command),
171
+ input=stdin,
172
+ text=True,
173
+ capture_output=True,
174
+ check=False,
175
+ )
176
+
177
+
178
+ def _run_inprocess(command: Sequence[str], stdin: str | None) -> subprocess.CompletedProcess[str]:
179
+ from cluxion_runtime.cli import main as runtime_main
180
+
181
+ old_stdin = sys.stdin
182
+ stdout = StringIO()
183
+ stderr = StringIO()
184
+ try:
185
+ sys.stdin = StringIO(stdin or "")
186
+ with redirect_stdout(stdout), redirect_stderr(stderr):
187
+ returncode = runtime_main(list(command[1:]))
188
+ except Exception as exc:
189
+ return subprocess.CompletedProcess(list(command), 1, stdout=stdout.getvalue(), stderr=str(exc))
190
+ finally:
191
+ sys.stdin = old_stdin
192
+ return subprocess.CompletedProcess(list(command), int(returncode), stdout=stdout.getvalue(), stderr=stderr.getvalue())
193
+
194
+
195
+ def _runtime_binary(binary: str | None) -> str:
196
+ return binary or os.environ.get("CLUXION_RUNTIME_BIN", "cluxion-runtime")
197
+
198
+
199
+ def _runtime_module_available() -> bool:
200
+ try:
201
+ import cluxion_runtime.cli
202
+ except ImportError:
203
+ return False
204
+ return cluxion_runtime.cli is not None
205
+
206
+
207
+ def _can_run_inprocess(binary: str) -> bool:
208
+ return binary == "cluxion-runtime" and "CLUXION_RUNTIME_BIN" not in os.environ and _runtime_module_available()
209
+
210
+
211
+ def _required_str(payload: Mapping[str, object], key: str) -> str:
212
+ value = str(payload.get(key, "")).strip()
213
+ if not value:
214
+ raise ValueError(f"{key} is required")
215
+ return value
216
+
217
+
218
+ def _str(payload: Mapping[str, object], key: str, default: str) -> str:
219
+ value = str(payload.get(key, default)).strip()
220
+ return value or default
221
+
222
+
223
+ def _int(payload: Mapping[str, object], key: str, default: int) -> int:
224
+ try:
225
+ value = int(payload.get(key, default))
226
+ except (TypeError, ValueError):
227
+ return default
228
+ return value if value > 0 else default
229
+
230
+
231
+ __all__ = [
232
+ "RuntimeResult",
233
+ "bootstrap",
234
+ "hermes_config",
235
+ "plan",
236
+ "queue_brief",
237
+ "queue_next",
238
+ "queue_record",
239
+ "runtime_available",
240
+ "serve_local",
241
+ ]
@@ -0,0 +1,148 @@
1
+ from __future__ import annotations
2
+
3
+ """Hermes tool schemas exposed by the Cluxion plugin."""
4
+
5
+ BOOTSTRAP_SCHEMA = {
6
+ "name": "cluxion_bootstrap",
7
+ "description": "Install or upgrade local runtime dependencies such as vllm-mlx.",
8
+ "parameters": {
9
+ "type": "object",
10
+ "properties": {
11
+ "upgrade": {"type": "boolean", "default": False},
12
+ "dry_run": {"type": "boolean", "default": False},
13
+ "packages": {
14
+ "type": "array",
15
+ "items": {"type": "string"},
16
+ "default": ["vllm-mlx"],
17
+ },
18
+ },
19
+ },
20
+ }
21
+
22
+ CLARIFY_SCHEMA = {
23
+ "name": "cluxion_clarify",
24
+ "description": "Assess whether user direction is clear. Ask blocking questions before queueing work.",
25
+ "parameters": {
26
+ "type": "object",
27
+ "properties": {
28
+ "prompt": {"type": "string", "description": "Task prompt to assess."},
29
+ "clarification_answers": {"type": "string", "default": ""},
30
+ "cwd": {"type": "string", "default": ""},
31
+ },
32
+ "required": ["prompt"],
33
+ },
34
+ }
35
+
36
+ PLAN_SCHEMA = {
37
+ "name": "cluxion_plan",
38
+ "description": "Plan a task through Cluxion honesty preprocessing, clarification, Rust queue, answer policy, and resource admission.",
39
+ "parameters": {
40
+ "type": "object",
41
+ "properties": {
42
+ "prompt": {"type": "string", "description": "Task prompt to plan."},
43
+ "priority": {
44
+ "type": "string",
45
+ "enum": ["critical", "high", "normal", "low"],
46
+ "default": "normal",
47
+ },
48
+ "model_route": {
49
+ "type": "string",
50
+ "default": "host/default",
51
+ "description": "Use host/default unless an explicit local route is requested.",
52
+ },
53
+ "expected_ram_mb": {"type": "integer", "minimum": 0, "default": 0},
54
+ "context_tokens": {"type": "integer", "minimum": 0, "default": 0},
55
+ "cwd": {"type": "string", "default": ""},
56
+ },
57
+ "required": ["prompt"],
58
+ },
59
+ }
60
+
61
+ SERVE_LOCAL_SCHEMA = {
62
+ "name": "cluxion_serve_local",
63
+ "description": "Prepare or start a Cluxion-managed vLLM-MLX local model endpoint.",
64
+ "parameters": {
65
+ "type": "object",
66
+ "properties": {
67
+ "model": {"type": "string", "description": "Local model id, usually an mlx-community model."},
68
+ "host": {"type": "string", "default": "127.0.0.1"},
69
+ "port": {"type": "integer", "minimum": 1, "maximum": 65535, "default": 23003},
70
+ "max_tokens": {"type": "integer", "minimum": 1, "default": 128000},
71
+ "auto_install": {"type": "boolean", "default": True},
72
+ "upgrade_runtime": {"type": "boolean", "default": False},
73
+ "start": {
74
+ "type": "boolean",
75
+ "default": False,
76
+ "description": "False returns the command without starting the heavy model server.",
77
+ },
78
+ },
79
+ "required": ["model"],
80
+ },
81
+ }
82
+
83
+ HERMES_CONFIG_SCHEMA = {
84
+ "name": "cluxion_hermes_config",
85
+ "description": "Render Hermes custom provider config for a Cluxion local OpenAI-compatible endpoint.",
86
+ "parameters": {
87
+ "type": "object",
88
+ "properties": {
89
+ "model": {"type": "string", "description": "Local model id."},
90
+ "host": {"type": "string", "default": "127.0.0.1"},
91
+ "port": {"type": "integer", "minimum": 1, "maximum": 65535, "default": 23003},
92
+ "context_length": {"type": "integer", "minimum": 1, "default": 131072},
93
+ "provider_key": {"type": "string", "default": "cluxion-local"},
94
+ "display_name": {"type": "string", "default": "Cluxion Local"},
95
+ },
96
+ "required": ["model"],
97
+ },
98
+ }
99
+
100
+ QUEUE_NEXT_SCHEMA = {
101
+ "name": "cluxion_queue_next",
102
+ "description": "Fetch the next queued Cluxion segment so the current Hermes model can process it.",
103
+ "parameters": {
104
+ "type": "object",
105
+ "properties": {
106
+ "work_id": {"type": "string"},
107
+ },
108
+ "required": ["work_id"],
109
+ },
110
+ }
111
+
112
+ QUEUE_RECORD_SCHEMA = {
113
+ "name": "cluxion_queue_record",
114
+ "description": "Record the current Hermes model's result for a queued Cluxion segment.",
115
+ "parameters": {
116
+ "type": "object",
117
+ "properties": {
118
+ "work_id": {"type": "string"},
119
+ "step_id": {"type": "string"},
120
+ "result": {"type": "string"},
121
+ "error": {"type": "string", "default": ""},
122
+ "failed": {"type": "boolean", "default": False},
123
+ },
124
+ "required": ["work_id", "step_id", "result"],
125
+ },
126
+ }
127
+
128
+ QUEUE_BRIEF_SCHEMA = {
129
+ "name": "cluxion_queue_brief",
130
+ "description": "Build a final briefing prompt after all queued Cluxion segment results are recorded.",
131
+ "parameters": {
132
+ "type": "object",
133
+ "properties": {
134
+ "work_id": {"type": "string"},
135
+ },
136
+ "required": ["work_id"],
137
+ },
138
+ }
139
+
140
+ __all__ = [
141
+ "BOOTSTRAP_SCHEMA",
142
+ "HERMES_CONFIG_SCHEMA",
143
+ "PLAN_SCHEMA",
144
+ "QUEUE_BRIEF_SCHEMA",
145
+ "QUEUE_NEXT_SCHEMA",
146
+ "QUEUE_RECORD_SCHEMA",
147
+ "SERVE_LOCAL_SCHEMA",
148
+ ]
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: cluxion-agentplugin-preprocessing
3
+ Version: 0.2.0
4
+ Summary: Universal agent plugin for Cluxion preprocessing, honesty contracts, clarification, Rust work queue, and resource-aware harness handoff.
5
+ Project-URL: Homepage, https://github.com/cluxion/cluxion-Agentplugin-preprocessing
6
+ Project-URL: Repository, https://github.com/cluxion/cluxion-Agentplugin-preprocessing
7
+ Project-URL: Issues, https://github.com/cluxion/cluxion-Agentplugin-preprocessing/issues
8
+ Author-email: cluxion <algocean1204@users.noreply.github.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: ai-agent,claude-code,cluxion,codex,hermes-agent,plugin,preprocessing
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Plugins
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: psutil>=5.9
22
+ Requires-Dist: pyyaml>=6.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: build>=1.2; extra == 'dev'
25
+ Requires-Dist: pytest>=8.0; extra == 'dev'
26
+ Requires-Dist: ruff>=0.8; extra == 'dev'
27
+ Requires-Dist: twine>=6.0; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # cluxion-Agentplugin-preprocessing
31
+
32
+ ๋ฒ”์šฉ ์—์ด์ „ํŠธ **์ „์ฒ˜๋ฆฌ ํ”Œ๋Ÿฌ๊ทธ์ธ** โ€” **Hermes, Claude Code, Codex, Grok Build**์—์„œ ๋™์ผ core๋กœ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.
33
+
34
+ **Repository:** https://github.com/cluxion/cluxion-Agentplugin-preprocessing
35
+
36
+ ## ํ•œ ์ค„ ์š”์•ฝ
37
+
38
+ ์ž‘์—… ์‹œ์ž‘ ์ „์— **๋ฐฉํ–ฅยท์ •์งํ•จยทํ**๋ฅผ ์ •๋ฆฌํ•ฉ๋‹ˆ๋‹ค. **์—ฐ๊ฒฐ๋œ AI**๊ฐ€ `cluxion_plan` ๋“ฑ ๋„๊ตฌ๋ฅผ ํ˜ธ์ถœํ•˜๊ณ , JSON ๊ณ„์•ฝ(`answer_policy`, `host_execution`)์— ๋”ฐ๋ผ ์‘๋‹ตํ•ฉ๋‹ˆ๋‹ค. ํ”Œ๋Ÿฌ๊ทธ์ธ์€ ์ถ”๊ฐ€ LLM ํ˜ธ์ถœ ์—†์ด ๊ฒฐ์ •๋ก ์  plan๋งŒ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
39
+
40
+ ## ๋ฒ”์šฉ ์—์ด์ „ํŠธ + Rust-First
41
+
42
+ | ๊ณ„์ธต | ๊ตฌํ˜„ |
43
+ |------|------|
44
+ | **Rust** (`cluxion-queue`) | SQLite ์ž‘์—…ํ, atomic dispatch |
45
+ | **Python** (`cluxion_runtime`, adapter) | harness plan, ์ „์ฒ˜๋ฆฌ, CLI |
46
+ | **Agent adapter** | `adapters/` โ€” Hermes plugin, Claude skill, Codex snippet |
47
+
48
+ ๋‚ด๋ถ€ hot path๋Š” **Rust**. Python์€ ๋“ฑ๋กยทJSON bridgeยทfallback์ž…๋‹ˆ๋‹ค.
49
+
50
+ ## ์ด ํ”Œ๋Ÿฌ๊ทธ์ธ์˜ ์—ญํ• 
51
+
52
+ - **์ •์งํ•จ**: context ๋ถ€์กฑ ์‹œ ๋ชจ๋ฅธ๋‹ค๊ณ  ๋‹ตํ•˜๋„๋ก `answer_policy` ์ƒ์„ฑ
53
+ - **๋ช…ํ™•ํ™”**: ์˜๋„๊ฐ€ ์• ๋งคํ•˜๋ฉด ํ ์ง„์ž… ์ „ ์งˆ๋ฌธ (`needs_clarification`)
54
+ - **์ž‘์—…ํ**: ๊ธด ์ž…๋ ฅ์„ segment๋กœ ๋ถ„ํ• , checksum ๋ณด์กด
55
+ - **๋ฆฌ์†Œ์Šค admission**: RAM/CPU ์••๋ ฅ์— ๋”ฐ๋ฅธ ์‹คํ–‰ ํ—ˆ์šฉ (๊ฒฐ์ •๋ก ์ )
56
+
57
+ **๋ชจ๋ธยทOAuthยทprovider๋Š” host agent ์†Œ์œ .** Cluxion์€ planยท๊ฒŒ์ดํŠธยทํ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋งŒ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
58
+
59
+ ## ์—ฐ๊ฒฐ๋œ AI๊ฐ€ ํ•˜๋Š” ์ผ
60
+
61
+ | ๋‹จ๊ณ„ | ๋™์ž‘ |
62
+ |------|------|
63
+ | ์š”์ฒญ ์ˆ˜์‹  | `cluxion_plan` ๋˜๋Š” `cluxion-runtime plan` |
64
+ | ๋ช…ํ™•ํ™” ํ•„์š” | `clarification.questions`๋กœ ์‚ฌ์šฉ์ž์—๊ฒŒ ์งˆ๋ฌธ |
65
+ | queued ๋ชจ๋“œ | `cluxion_queue_next` โ†’ ์ฒ˜๋ฆฌ โ†’ `cluxion_queue_record` โ†’ `cluxion_queue_brief` |
66
+ | ์‘๋‹ต | `answer_policy.required_checks` ์ค€์ˆ˜ |
67
+
68
+ ## ์„ค๊ณ„ ์š”์•ฝ
69
+
70
+ ```
71
+ User prompt โ†’ cluxion_plan โ†’ [clarification?] โ†’ preprocessing mode
72
+ โ†’ answer_policy + host_execution
73
+ โ†’ (queued) queue_next/record/brief
74
+ ```
75
+
76
+ **์„ค๊ณ„ ์›์น™**
77
+
78
+ 1. **์ถ”๊ฐ€ AI preflight ์—†์Œ** โ€” ๊ฒฐ์ •๋ก ์  plan
79
+ 2. ์งง์€ ์ผ๋ฐ˜ ์งˆ๋ฌธ์€ `simple_answer` fast path
80
+ 3. ๋ถˆํ™•์‹ค ์‹œ fake success ๊ธˆ์ง€ โ€” `needs_clarification`, `unknown_after_check`
81
+ 4. **opt-in** โ€” ์‚ฌ์šฉ์ž ๋™์˜ ์—†์ด ๊ถŒํ•œ ํ™•๋Œ€ ์—†์Œ
82
+
83
+ ## ๋น ๋ฅธ ์‹œ์ž‘
84
+
85
+ ```bash
86
+ pip install cluxion-agentplugin-preprocessing
87
+ cluxion-preprocess check
88
+ cluxion-preprocess enable # Hermes
89
+ ```
90
+
91
+ ```bash
92
+ cluxion-runtime plan --surface hermes --prompt "์ž‘์—… ์„ค๋ช…"
93
+ ```
94
+
95
+ ## ๋„๊ตฌ (`cluxion` toolset)
96
+
97
+ | Tool | ์„ค๋ช… |
98
+ |------|------|
99
+ | `cluxion_plan` | ์ „์ฒ˜๋ฆฌยท๋ฐฉํ–ฅยทํยท๋ฆฌ์†Œ์Šค ๊ณ„ํš |
100
+ | `cluxion_clarify` | ๋ช…ํ™•ํ™” ์งˆ๋ฌธ ๋ชฉ๋ก |
101
+ | `cluxion_queue_next` / `record` / `brief` | segment ํ |
102
+
103
+ ## ๋ฌธ์„œ
104
+
105
+ - [Docs/README.md](Docs/README.md) โ€” **์ฒ˜์Œ ์ฝ๋Š” ๋ถ„** + ๋ชฉ์ฐจ
106
+ - [Docs/architecture.md](Docs/architecture.md)
107
+ - [Docs/design.md](Docs/design.md)
108
+ - [Docs/installation.md](Docs/installation.md)
109
+ - [Docs/tools.md](Docs/tools.md)
110
+ - [Docs/agent-surfaces.md](Docs/agent-surfaces.md)
111
+ - [Docs/rust-architecture.md](Docs/rust-architecture.md)
112
+
113
+ ## License
114
+
115
+ Apache-2.0