champion-continuum 0.5.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.
- champion_continuum-0.5.0/LICENSE +21 -0
- champion_continuum-0.5.0/PKG-INFO +95 -0
- champion_continuum-0.5.0/README.md +69 -0
- champion_continuum-0.5.0/pyproject.toml +42 -0
- champion_continuum-0.5.0/setup.cfg +4 -0
- champion_continuum-0.5.0/src/champion_continuum/__init__.py +20 -0
- champion_continuum-0.5.0/src/champion_continuum/cli.py +235 -0
- champion_continuum-0.5.0/src/champion_continuum/codex_archive.py +295 -0
- champion_continuum-0.5.0/src/champion_continuum/contracts.py +432 -0
- champion_continuum-0.5.0/src/champion_continuum/core.py +203 -0
- champion_continuum-0.5.0/src/champion_continuum/engine.py +106 -0
- champion_continuum-0.5.0/src/champion_continuum/mcp_proxy.py +110 -0
- champion_continuum-0.5.0/src/champion_continuum/processor.py +179 -0
- champion_continuum-0.5.0/src/champion_continuum/store.py +222 -0
- champion_continuum-0.5.0/src/champion_continuum/system_prompts.py +153 -0
- champion_continuum-0.5.0/src/champion_continuum.egg-info/PKG-INFO +95 -0
- champion_continuum-0.5.0/src/champion_continuum.egg-info/SOURCES.txt +20 -0
- champion_continuum-0.5.0/src/champion_continuum.egg-info/dependency_links.txt +1 -0
- champion_continuum-0.5.0/src/champion_continuum.egg-info/entry_points.txt +3 -0
- champion_continuum-0.5.0/src/champion_continuum.egg-info/requires.txt +2 -0
- champion_continuum-0.5.0/src/champion_continuum.egg-info/top_level.txt +1 -0
- champion_continuum-0.5.0/tests/test_continuum.py +151 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Champion Council / Continuum Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: champion-continuum
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Portable continuity and reacclimation memory primitive for agent runtimes.
|
|
5
|
+
Author: Champion Council
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Yufok1/champion-continuum
|
|
8
|
+
Project-URL: Source, https://github.com/Yufok1/champion-continuum
|
|
9
|
+
Project-URL: Live Demo, https://huggingface.co/spaces/tostido/champion-continuum
|
|
10
|
+
Project-URL: Repository, https://github.com/Yufok1/champion-continuum
|
|
11
|
+
Keywords: ai,memory,continuity,agents,tool-less,relay,reacclimation
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
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.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: mcp>=1.0.0
|
|
24
|
+
Requires-Dist: httpx>=0.27.0
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# Champion Continuum
|
|
28
|
+
|
|
29
|
+
Champion Continuum is a small, local-first continuity primitive extracted from the active Champion Council server posture.
|
|
30
|
+
|
|
31
|
+
It is not the full Champion Council backend. It is the portable memory and reacclimation layer that lets an agent:
|
|
32
|
+
|
|
33
|
+
- store continuity notes as local records
|
|
34
|
+
- search those records without a hosted service
|
|
35
|
+
- scan local Codex session archives when available
|
|
36
|
+
- emit a structured continuity packet
|
|
37
|
+
- reconstitute a bundled Champion Council backend payload when the VM can run it
|
|
38
|
+
|
|
39
|
+
The base memory and packet flow is local-first. MCP tool bridging adds runtime dependencies on `mcp` and `httpx`.
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
pip install -e .
|
|
45
|
+
continuum --root .continuum init
|
|
46
|
+
continuum --root .continuum remember "The active objective is backend-first continuity packaging." --tag bootstrap
|
|
47
|
+
continuum --root .continuum doctor
|
|
48
|
+
continuum --root .continuum packet --summary "resume the Champion Council package build"
|
|
49
|
+
continuum --root .continuum handoff --summary "browser agent audit"
|
|
50
|
+
continuum --root .continuum receipt "quickstart smoke" --summary "Continuum initialized and packet emitted"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`--root` may appear before or after the subcommand. Set `CONTINUUM_ROOT` to pin one memory store across working directories.
|
|
54
|
+
Structured commands emit JSON by default; `--json` is accepted for compatibility with older prompts.
|
|
55
|
+
|
|
56
|
+
## Portable Contracts
|
|
57
|
+
|
|
58
|
+
The bootstrap packet now carries a compact version of the Champion Council operating mechanics:
|
|
59
|
+
|
|
60
|
+
- `query_thread`: the current subject/objective/seam and next reads
|
|
61
|
+
- `output_state`: a bounded orienting surface over root status, archive status, memory hits, drift, and sources
|
|
62
|
+
- `drift_classes`: `confirmed`, `partly_confirmed`, `mismatch`, `stale_state`, `gated`, `no_archive_match`
|
|
63
|
+
- `failure_classes`: `truth`, `contract`, `transport`, `rendering`, `gating`, `stale_runtime_state`
|
|
64
|
+
- `recovery_questions`: the six-question fallback loop for confused agents
|
|
65
|
+
- `companion_packages`: optional detection for `cascade-lattice`, `quinesmith`, and `brotology-field-guide`
|
|
66
|
+
- `receipt_protocol`: a simple local receipt rule for meaningful changes
|
|
67
|
+
|
|
68
|
+
The package does not depend on those companion packages. It detects them when present and keeps working when absent.
|
|
69
|
+
|
|
70
|
+
Print a system prompt for the model you are giving the bundle to:
|
|
71
|
+
|
|
72
|
+
```powershell
|
|
73
|
+
continuum system-prompt --profile portable
|
|
74
|
+
continuum system-prompt --profile codex
|
|
75
|
+
continuum system-prompt --profile tiny
|
|
76
|
+
continuum system-prompt --profile no-tools
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Engine Payload
|
|
80
|
+
|
|
81
|
+
The drop-in export folder includes a full Champion Council research-capsule payload zip beside this package. Use:
|
|
82
|
+
|
|
83
|
+
```powershell
|
|
84
|
+
continuum engine --payload ..\payloads\champion_council_research_capsule.zip --target ..\engine\champion-council --self-test
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Add `--launch` only in an environment where the backend dependencies are installed or can be installed.
|
|
88
|
+
|
|
89
|
+
## Design Rule
|
|
90
|
+
|
|
91
|
+
Continuum follows the same rule as Champion Council:
|
|
92
|
+
|
|
93
|
+
- archive continuity helps re-entry
|
|
94
|
+
- live runtime truth outranks archive continuity
|
|
95
|
+
- docs and memory are planning surfaces, not authority planes
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Champion Continuum
|
|
2
|
+
|
|
3
|
+
Champion Continuum is a small, local-first continuity primitive extracted from the active Champion Council server posture.
|
|
4
|
+
|
|
5
|
+
It is not the full Champion Council backend. It is the portable memory and reacclimation layer that lets an agent:
|
|
6
|
+
|
|
7
|
+
- store continuity notes as local records
|
|
8
|
+
- search those records without a hosted service
|
|
9
|
+
- scan local Codex session archives when available
|
|
10
|
+
- emit a structured continuity packet
|
|
11
|
+
- reconstitute a bundled Champion Council backend payload when the VM can run it
|
|
12
|
+
|
|
13
|
+
The base memory and packet flow is local-first. MCP tool bridging adds runtime dependencies on `mcp` and `httpx`.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```powershell
|
|
18
|
+
pip install -e .
|
|
19
|
+
continuum --root .continuum init
|
|
20
|
+
continuum --root .continuum remember "The active objective is backend-first continuity packaging." --tag bootstrap
|
|
21
|
+
continuum --root .continuum doctor
|
|
22
|
+
continuum --root .continuum packet --summary "resume the Champion Council package build"
|
|
23
|
+
continuum --root .continuum handoff --summary "browser agent audit"
|
|
24
|
+
continuum --root .continuum receipt "quickstart smoke" --summary "Continuum initialized and packet emitted"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`--root` may appear before or after the subcommand. Set `CONTINUUM_ROOT` to pin one memory store across working directories.
|
|
28
|
+
Structured commands emit JSON by default; `--json` is accepted for compatibility with older prompts.
|
|
29
|
+
|
|
30
|
+
## Portable Contracts
|
|
31
|
+
|
|
32
|
+
The bootstrap packet now carries a compact version of the Champion Council operating mechanics:
|
|
33
|
+
|
|
34
|
+
- `query_thread`: the current subject/objective/seam and next reads
|
|
35
|
+
- `output_state`: a bounded orienting surface over root status, archive status, memory hits, drift, and sources
|
|
36
|
+
- `drift_classes`: `confirmed`, `partly_confirmed`, `mismatch`, `stale_state`, `gated`, `no_archive_match`
|
|
37
|
+
- `failure_classes`: `truth`, `contract`, `transport`, `rendering`, `gating`, `stale_runtime_state`
|
|
38
|
+
- `recovery_questions`: the six-question fallback loop for confused agents
|
|
39
|
+
- `companion_packages`: optional detection for `cascade-lattice`, `quinesmith`, and `brotology-field-guide`
|
|
40
|
+
- `receipt_protocol`: a simple local receipt rule for meaningful changes
|
|
41
|
+
|
|
42
|
+
The package does not depend on those companion packages. It detects them when present and keeps working when absent.
|
|
43
|
+
|
|
44
|
+
Print a system prompt for the model you are giving the bundle to:
|
|
45
|
+
|
|
46
|
+
```powershell
|
|
47
|
+
continuum system-prompt --profile portable
|
|
48
|
+
continuum system-prompt --profile codex
|
|
49
|
+
continuum system-prompt --profile tiny
|
|
50
|
+
continuum system-prompt --profile no-tools
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Engine Payload
|
|
54
|
+
|
|
55
|
+
The drop-in export folder includes a full Champion Council research-capsule payload zip beside this package. Use:
|
|
56
|
+
|
|
57
|
+
```powershell
|
|
58
|
+
continuum engine --payload ..\payloads\champion_council_research_capsule.zip --target ..\engine\champion-council --self-test
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Add `--launch` only in an environment where the backend dependencies are installed or can be installed.
|
|
62
|
+
|
|
63
|
+
## Design Rule
|
|
64
|
+
|
|
65
|
+
Continuum follows the same rule as Champion Council:
|
|
66
|
+
|
|
67
|
+
- archive continuity helps re-entry
|
|
68
|
+
- live runtime truth outranks archive continuity
|
|
69
|
+
- docs and memory are planning surfaces, not authority planes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "champion-continuum"
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
description = "Portable continuity and reacclimation memory primitive for agent runtimes."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Champion Council" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ai", "memory", "continuity", "agents", "tool-less", "relay", "reacclimation"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules"
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"mcp>=1.0.0",
|
|
28
|
+
"httpx>=0.27.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/Yufok1/champion-continuum"
|
|
33
|
+
Source = "https://github.com/Yufok1/champion-continuum"
|
|
34
|
+
"Live Demo" = "https://huggingface.co/spaces/tostido/champion-continuum"
|
|
35
|
+
Repository = "https://github.com/Yufok1/champion-continuum"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
continuum = "champion_continuum.cli:main"
|
|
39
|
+
champion-continuum = "champion_continuum.cli:main"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
where = ["src"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Portable continuity primitive for agent runtimes."""
|
|
2
|
+
|
|
3
|
+
from .core import Continuum
|
|
4
|
+
from .store import ContinuumStore
|
|
5
|
+
from .codex_archive import continuity_restore, continuity_status
|
|
6
|
+
from .contracts import companion_package_status
|
|
7
|
+
from .processor import parse_commands, process_text, render_results
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"Continuum",
|
|
11
|
+
"ContinuumStore",
|
|
12
|
+
"companion_package_status",
|
|
13
|
+
"continuity_restore",
|
|
14
|
+
"continuity_status",
|
|
15
|
+
"parse_commands",
|
|
16
|
+
"process_text",
|
|
17
|
+
"render_results",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
__version__ = "0.5.0"
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from . import __version__
|
|
11
|
+
from .core import Continuum
|
|
12
|
+
from .engine import engine_self_test, launch_engine, reconstitute_engine
|
|
13
|
+
from .system_prompts import get_system_prompt, list_profiles
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _print(payload: Any, as_json: bool = False) -> None:
|
|
17
|
+
if as_json or isinstance(payload, (dict, list)):
|
|
18
|
+
_emit(json.dumps(payload, indent=2, ensure_ascii=True))
|
|
19
|
+
else:
|
|
20
|
+
_emit(str(payload))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _emit(text: str) -> None:
|
|
24
|
+
try:
|
|
25
|
+
print(text)
|
|
26
|
+
except UnicodeEncodeError:
|
|
27
|
+
encoding = sys.stdout.encoding or "utf-8"
|
|
28
|
+
data = (text + "\n").encode(encoding, errors="backslashreplace")
|
|
29
|
+
if hasattr(sys.stdout, "buffer"):
|
|
30
|
+
sys.stdout.buffer.write(data)
|
|
31
|
+
sys.stdout.buffer.flush()
|
|
32
|
+
else:
|
|
33
|
+
print(data.decode(encoding, errors="replace"))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
37
|
+
parser = argparse.ArgumentParser(prog="continuum", description="Portable continuity memory primitive.")
|
|
38
|
+
default_root = os.environ.get("CONTINUUM_ROOT", ".continuum")
|
|
39
|
+
parser.add_argument("--root", default=default_root, help="Continuum data root (or set CONTINUUM_ROOT).")
|
|
40
|
+
parser.add_argument("--version", action="version", version=f"champion-continuum {__version__}")
|
|
41
|
+
|
|
42
|
+
# Shared parent so --root may also follow the subcommand. SUPPRESS keeps the
|
|
43
|
+
# attribute unset unless --root is passed here, so a value given before the
|
|
44
|
+
# subcommand is never clobbered by the subparser default.
|
|
45
|
+
root_after = argparse.ArgumentParser(add_help=False)
|
|
46
|
+
root_after.add_argument(
|
|
47
|
+
"--root", default=argparse.SUPPRESS, help="Continuum data root (may also precede the subcommand)."
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
sub = parser.add_subparsers(dest="command", required=True)
|
|
51
|
+
|
|
52
|
+
def _cmd(name: str, **kwargs: Any) -> argparse.ArgumentParser:
|
|
53
|
+
return sub.add_parser(name, parents=[root_after], **kwargs)
|
|
54
|
+
|
|
55
|
+
_cmd("init", help="Initialize a Continuum store.")
|
|
56
|
+
_cmd("status", help="Show local Continuum status.")
|
|
57
|
+
|
|
58
|
+
doctor = _cmd("doctor", help="Inspect root attachment, contracts, and optional companion packages.")
|
|
59
|
+
doctor.add_argument("--cwd", default="")
|
|
60
|
+
|
|
61
|
+
remember = _cmd("remember", help="Store a continuity record.")
|
|
62
|
+
remember.add_argument("text")
|
|
63
|
+
remember.add_argument("--kind", default="note")
|
|
64
|
+
remember.add_argument("--tag", action="append", default=[])
|
|
65
|
+
remember.add_argument("--json", action="store_true")
|
|
66
|
+
|
|
67
|
+
ingest = _cmd("ingest-file", help="Store a text file as a continuity record.")
|
|
68
|
+
ingest.add_argument("path")
|
|
69
|
+
ingest.add_argument("--kind", default="document")
|
|
70
|
+
ingest.add_argument("--tag", action="append", default=[])
|
|
71
|
+
ingest.add_argument("--json", action="store_true")
|
|
72
|
+
|
|
73
|
+
search = _cmd("search", help="Search local continuity records.")
|
|
74
|
+
search.add_argument("query")
|
|
75
|
+
search.add_argument("--limit", type=int, default=8)
|
|
76
|
+
search.add_argument("--json", action="store_true")
|
|
77
|
+
|
|
78
|
+
restore = _cmd("restore", help="Restore continuity from Codex session archives if present.")
|
|
79
|
+
restore.add_argument("--summary", default="")
|
|
80
|
+
restore.add_argument("--cwd", default="")
|
|
81
|
+
restore.add_argument("--codex-home", default=None)
|
|
82
|
+
restore.add_argument("--limit", type=int, default=3)
|
|
83
|
+
restore.add_argument("--scan-limit", type=int, default=80)
|
|
84
|
+
restore.add_argument("--json", action="store_true")
|
|
85
|
+
|
|
86
|
+
packet = _cmd("packet", help="Emit a full bootstrap packet.")
|
|
87
|
+
packet.add_argument("--summary", default="")
|
|
88
|
+
packet.add_argument("--cwd", default="")
|
|
89
|
+
packet.add_argument("--codex-home", default=None)
|
|
90
|
+
packet.add_argument("--scan-limit", type=int, default=48)
|
|
91
|
+
packet.add_argument("--json", action="store_true")
|
|
92
|
+
|
|
93
|
+
receipt = _cmd("receipt", help="Write a structured receipt for a meaningful action.")
|
|
94
|
+
receipt.add_argument("action")
|
|
95
|
+
receipt.add_argument("--summary", default="")
|
|
96
|
+
receipt.add_argument("--status", default="ok")
|
|
97
|
+
receipt.add_argument("--tag", action="append", default=[])
|
|
98
|
+
receipt.add_argument("--json", action="store_true")
|
|
99
|
+
|
|
100
|
+
handoff = _cmd("handoff", help="Emit browser/no-tools handoff text plus the backing packet.")
|
|
101
|
+
handoff.add_argument("--summary", default="")
|
|
102
|
+
handoff.add_argument("--cwd", default="")
|
|
103
|
+
handoff.add_argument("--audience", default="browser", choices=["browser", "tiny", "codex", "portable"])
|
|
104
|
+
handoff.add_argument("--codex-home", default=None)
|
|
105
|
+
handoff.add_argument("--scan-limit", type=int, default=24)
|
|
106
|
+
handoff.add_argument("--json", action="store_true")
|
|
107
|
+
|
|
108
|
+
export = _cmd("export", help="Export local records to JSON.")
|
|
109
|
+
export.add_argument("--output", default="")
|
|
110
|
+
|
|
111
|
+
import_cmd = _cmd("import", help="Import records from a Continuum JSON export.")
|
|
112
|
+
import_cmd.add_argument("source")
|
|
113
|
+
import_cmd.add_argument("--json", action="store_true")
|
|
114
|
+
|
|
115
|
+
system = _cmd("system-prompt", help="Print a model-facing Continuum system prompt.")
|
|
116
|
+
system.add_argument("--profile", default="portable", choices=list_profiles())
|
|
117
|
+
system.add_argument("--json", action="store_true")
|
|
118
|
+
|
|
119
|
+
process = _cmd("process", help="Execute continuum commands a tool-less agent emitted in its text.")
|
|
120
|
+
process.add_argument("--input", default="", help="File holding the agent's text (default: read stdin).")
|
|
121
|
+
process.add_argument("--json", action="store_true")
|
|
122
|
+
|
|
123
|
+
engine = _cmd("engine", help="Reconstitute or launch a bundled Champion Council backend payload.")
|
|
124
|
+
engine.add_argument("--payload", required=True)
|
|
125
|
+
engine.add_argument("--target", default="engine/champion-council")
|
|
126
|
+
engine.add_argument("--overwrite", action="store_true")
|
|
127
|
+
engine.add_argument("--self-test", action="store_true")
|
|
128
|
+
engine.add_argument("--launch", action="store_true")
|
|
129
|
+
engine.add_argument("--web-port", type=int, default=7866)
|
|
130
|
+
engine.add_argument("--mcp-port", type=int, default=8766)
|
|
131
|
+
engine.add_argument("--json", action="store_true")
|
|
132
|
+
|
|
133
|
+
return parser
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def main(argv: list[str] | None = None) -> int:
|
|
137
|
+
args = build_parser().parse_args(argv)
|
|
138
|
+
root_path = Path(args.root).resolve()
|
|
139
|
+
continuum = Continuum(root_path)
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
if args.command == "init":
|
|
143
|
+
_print(continuum.init(), True)
|
|
144
|
+
elif args.command == "status":
|
|
145
|
+
_print(continuum.status(), True)
|
|
146
|
+
elif args.command == "doctor":
|
|
147
|
+
_print(continuum.doctor(cwd=args.cwd), True)
|
|
148
|
+
elif args.command == "remember":
|
|
149
|
+
_print(continuum.remember(args.text, kind=args.kind, tags=args.tag), args.json)
|
|
150
|
+
elif args.command == "ingest-file":
|
|
151
|
+
_print(continuum.ingest_file(args.path, kind=args.kind, tags=args.tag), args.json)
|
|
152
|
+
elif args.command == "search":
|
|
153
|
+
_print(continuum.search(args.query, limit=args.limit), True)
|
|
154
|
+
elif args.command == "restore":
|
|
155
|
+
_print(
|
|
156
|
+
continuum.restore(
|
|
157
|
+
summary=args.summary,
|
|
158
|
+
cwd=args.cwd,
|
|
159
|
+
codex_home=args.codex_home,
|
|
160
|
+
limit=args.limit,
|
|
161
|
+
scan_limit=args.scan_limit,
|
|
162
|
+
),
|
|
163
|
+
True,
|
|
164
|
+
)
|
|
165
|
+
elif args.command == "packet":
|
|
166
|
+
_print(
|
|
167
|
+
continuum.packet(
|
|
168
|
+
summary=args.summary,
|
|
169
|
+
cwd=args.cwd,
|
|
170
|
+
codex_home=args.codex_home,
|
|
171
|
+
scan_limit=args.scan_limit,
|
|
172
|
+
),
|
|
173
|
+
True,
|
|
174
|
+
)
|
|
175
|
+
elif args.command == "receipt":
|
|
176
|
+
_print(
|
|
177
|
+
continuum.receipt(
|
|
178
|
+
action=args.action,
|
|
179
|
+
summary=args.summary,
|
|
180
|
+
status=args.status,
|
|
181
|
+
tags=args.tag,
|
|
182
|
+
),
|
|
183
|
+
True,
|
|
184
|
+
)
|
|
185
|
+
elif args.command == "handoff":
|
|
186
|
+
handoff = continuum.handoff(
|
|
187
|
+
summary=args.summary,
|
|
188
|
+
cwd=args.cwd,
|
|
189
|
+
audience=args.audience,
|
|
190
|
+
codex_home=args.codex_home,
|
|
191
|
+
scan_limit=args.scan_limit,
|
|
192
|
+
)
|
|
193
|
+
_print(handoff, True) if args.json else _emit(handoff["markdown"])
|
|
194
|
+
elif args.command == "export":
|
|
195
|
+
_print({"output": str(continuum.store.export_json(args.output or None))}, True)
|
|
196
|
+
elif args.command == "import":
|
|
197
|
+
_print(continuum.store.import_json(args.source), True)
|
|
198
|
+
elif args.command == "system-prompt":
|
|
199
|
+
prompt = get_system_prompt(args.profile)
|
|
200
|
+
_print({"profile": args.profile, "prompt": prompt}, True) if args.json else _emit(prompt)
|
|
201
|
+
elif args.command == "process":
|
|
202
|
+
from .processor import process_text
|
|
203
|
+
|
|
204
|
+
text = Path(args.input).read_text(encoding="utf-8", errors="replace") if args.input else sys.stdin.read()
|
|
205
|
+
result = process_text(text, root=root_path)
|
|
206
|
+
_print(result, True) if args.json else _emit(result["rendered"])
|
|
207
|
+
elif args.command == "engine":
|
|
208
|
+
if args.self_test:
|
|
209
|
+
result = engine_self_test(args.payload, args.target)
|
|
210
|
+
else:
|
|
211
|
+
result = reconstitute_engine(args.payload, args.target, overwrite=args.overwrite)
|
|
212
|
+
if args.launch:
|
|
213
|
+
proc = launch_engine(
|
|
214
|
+
Path(result["runtime_shell"]),
|
|
215
|
+
web_port=args.web_port,
|
|
216
|
+
mcp_port=args.mcp_port,
|
|
217
|
+
)
|
|
218
|
+
result["launch"] = {"pid": proc.pid, "web_port": args.web_port, "mcp_port": args.mcp_port}
|
|
219
|
+
_print(result, True)
|
|
220
|
+
return 0
|
|
221
|
+
except Exception as exc:
|
|
222
|
+
_print(
|
|
223
|
+
{
|
|
224
|
+
"error": "runtime_exception",
|
|
225
|
+
"command": getattr(args, "command", ""),
|
|
226
|
+
"message": str(exc),
|
|
227
|
+
"failure_classes": ["truth", "contract", "transport", "rendering", "gating", "stale_runtime_state"],
|
|
228
|
+
},
|
|
229
|
+
True,
|
|
230
|
+
)
|
|
231
|
+
return 1
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
if __name__ == "__main__":
|
|
235
|
+
raise SystemExit(main())
|