base120 2.0.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.
base120/__init__.py ADDED
@@ -0,0 +1,79 @@
1
+ # Copyright 2024-2026 HUMMBL, LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ """base120 — 120 reasoning operators for structured thinking.
18
+
19
+ Version 2 of the base120 Python SDK. Stdlib-only. Zero third-party runtime
20
+ dependencies. Tuple-native output aligned to the VERUM sovereignty model.
21
+
22
+ Quick start::
23
+
24
+ from base120 import Engine
25
+
26
+ engine = Engine()
27
+
28
+ # Discover operators
29
+ op = engine.get("P6") # Operator(code='P6', name='Point-of-View Anchoring', ...)
30
+ ops = engine.list(family="DE") # 20 Decomposition operators
31
+
32
+ # Generate a system prompt for any LLM
33
+ prompt = engine.prompt("P6", "How should we price the certification tier?")
34
+
35
+ # Record an application as a governance artifact
36
+ result = engine.record("P6", "How should...", "Anchor to compliance officer POV", 0.85)
37
+ t = result.to_tuple() # OperatorTuple(id='P6', time='...Z', state='...', drift=0.15)
38
+ # Append to the VERUM audit ledger
39
+ from base120 import Ledger
40
+ ledger = Ledger()
41
+ ledger.append(t) # ~/.base120/ledger.jsonl
42
+ high_drift = ledger.cut(0.5) # entries with drift > 0.5
43
+
44
+ VERUM alignment:
45
+ to_tuple() fields map to the 4 VERUM node fields:
46
+ id → who/what (operator code)
47
+ time → when (UTC ISO-8601)
48
+ state → current condition (recommendation)
49
+ drift → deviation from setpoint (1.0 - confidence)
50
+
51
+ CLI::
52
+
53
+ base120 list
54
+ base120 list --family DE
55
+ base120 get P6
56
+ base120 prompt P6 "your problem here"
57
+ base120 families
58
+
59
+ Apache 2.0. Copyright 2026 HUMMBL, LLC.
60
+ """
61
+
62
+ from __future__ import annotations
63
+
64
+ from base120.engine import FAMILIES, FAMILY_NAMES, Engine
65
+ from base120.ledger import Ledger
66
+ from base120.models import ApplyResult, Operator, OperatorTuple
67
+
68
+ __version__ = "2.0.0"
69
+
70
+ __all__ = [
71
+ "FAMILIES",
72
+ "FAMILY_NAMES",
73
+ "ApplyResult",
74
+ "Engine",
75
+ "Ledger",
76
+ "Operator",
77
+ "OperatorTuple",
78
+ "__version__",
79
+ ]
base120/cli.py ADDED
@@ -0,0 +1,131 @@
1
+ # Copyright 2024-2026 HUMMBL, LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ """Base120 CLI.
18
+
19
+ Commands:
20
+ base120 list — list all 120 operators
21
+ base120 list --family DE — list operators for one family
22
+ base120 get P6 — show one operator's details
23
+ base120 prompt P6 "problem" — generate a system prompt
24
+ base120 families — list the 6 families with descriptions
25
+
26
+ Stdlib only. Zero third-party dependencies.
27
+ """
28
+
29
+ from __future__ import annotations
30
+
31
+ import argparse
32
+ import sys
33
+
34
+ from base120.engine import FAMILY_NAMES, Engine
35
+
36
+
37
+ def _cmd_list(engine: Engine, args: argparse.Namespace) -> int:
38
+ family: str | None = args.family
39
+ ops = engine.list(family=family)
40
+ if not ops:
41
+ print(f"No operators found for family {family!r}.", file=sys.stderr)
42
+ return 1
43
+ if family:
44
+ fname = FAMILY_NAMES.get(family.upper(), family.upper())
45
+ print(f"{fname} ({family.upper()}) — {len(ops)} operators\n")
46
+ for op in ops:
47
+ print(f" {op.code:<6} {op.name}")
48
+ return 0
49
+
50
+
51
+ def _cmd_get(engine: Engine, args: argparse.Namespace) -> int:
52
+ op = engine.get(args.code)
53
+ if op is None:
54
+ print(f"Unknown operator code: {args.code!r}", file=sys.stderr)
55
+ return 1
56
+ fname = FAMILY_NAMES.get(op.transformation, op.transformation)
57
+ print(f"{op.code}: {op.name}")
58
+ print(f" Family: {op.transformation} — {fname}")
59
+ print(f" Definition: {op.definition}")
60
+ return 0
61
+
62
+
63
+ def _cmd_prompt(engine: Engine, args: argparse.Namespace) -> int:
64
+ try:
65
+ prompt = engine.prompt(args.code, args.problem)
66
+ except ValueError as exc:
67
+ print(f"Error: {exc}", file=sys.stderr)
68
+ return 1
69
+ print(prompt)
70
+ return 0
71
+
72
+
73
+ def _cmd_families(engine: Engine, _args: argparse.Namespace) -> int:
74
+ for fam in engine.families():
75
+ name = FAMILY_NAMES.get(fam, fam)
76
+ ops = engine.list(family=fam)
77
+ print(f" {fam:<4} {name:<16} {len(ops)} operators")
78
+ return 0
79
+
80
+
81
+ def build_parser() -> argparse.ArgumentParser:
82
+ parser = argparse.ArgumentParser(
83
+ prog="base120",
84
+ description="Base120 — 120 reasoning operators for structured thinking.",
85
+ )
86
+ sub = parser.add_subparsers(dest="command", metavar="command")
87
+ sub.required = True
88
+
89
+ # list
90
+ p_list = sub.add_parser("list", help="List operators")
91
+ p_list.add_argument(
92
+ "--family",
93
+ metavar="FAMILY",
94
+ help="Filter by family: P, IN, CO, DE, RE, SY",
95
+ )
96
+
97
+ # get
98
+ p_get = sub.add_parser("get", help="Show operator details")
99
+ p_get.add_argument("code", help="Operator code, e.g. P6 or DE1")
100
+
101
+ # prompt
102
+ p_prompt = sub.add_parser("prompt", help="Generate a system prompt")
103
+ p_prompt.add_argument("code", help="Operator code, e.g. P6")
104
+ p_prompt.add_argument("problem", help="Problem statement to reason about")
105
+
106
+ # families
107
+ sub.add_parser("families", help="List the 6 operator families")
108
+
109
+ return parser
110
+
111
+
112
+ def main(argv: list[str] | None = None) -> int:
113
+ parser = build_parser()
114
+ args = parser.parse_args(argv)
115
+ engine = Engine()
116
+
117
+ dispatch = {
118
+ "list": _cmd_list,
119
+ "get": _cmd_get,
120
+ "prompt": _cmd_prompt,
121
+ "families": _cmd_families,
122
+ }
123
+ handler = dispatch.get(args.command)
124
+ if handler is None:
125
+ parser.print_help()
126
+ return 1
127
+ return handler(engine, args)
128
+
129
+
130
+ if __name__ == "__main__":
131
+ sys.exit(main())