gensyn-audit 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.
Files changed (53) hide show
  1. gensyn_audit-0.1.0/.gitignore +11 -0
  2. gensyn_audit-0.1.0/LICENSE +202 -0
  3. gensyn_audit-0.1.0/PKG-INFO +49 -0
  4. gensyn_audit-0.1.0/README.md +37 -0
  5. gensyn_audit-0.1.0/docs/long-running-audits.md +64 -0
  6. gensyn_audit-0.1.0/pyproject.toml +52 -0
  7. gensyn_audit-0.1.0/src/gensyn_audit/__init__.py +16 -0
  8. gensyn_audit-0.1.0/src/gensyn_audit/brand.py +66 -0
  9. gensyn_audit-0.1.0/src/gensyn_audit/cli.py +2344 -0
  10. gensyn_audit-0.1.0/src/gensyn_audit/commitments.py +197 -0
  11. gensyn_audit-0.1.0/src/gensyn_audit/convert.py +118 -0
  12. gensyn_audit-0.1.0/src/gensyn_audit/doctor.py +562 -0
  13. gensyn_audit-0.1.0/src/gensyn_audit/errors.py +20 -0
  14. gensyn_audit-0.1.0/src/gensyn_audit/fetch.py +260 -0
  15. gensyn_audit-0.1.0/src/gensyn_audit/gcs.py +496 -0
  16. gensyn_audit-0.1.0/src/gensyn_audit/handoff.py +150 -0
  17. gensyn_audit-0.1.0/src/gensyn_audit/handoffs.py +99 -0
  18. gensyn_audit-0.1.0/src/gensyn_audit/kit.py +636 -0
  19. gensyn_audit-0.1.0/src/gensyn_audit/manifest.py +185 -0
  20. gensyn_audit-0.1.0/src/gensyn_audit/mock.py +339 -0
  21. gensyn_audit-0.1.0/src/gensyn_audit/outcome.py +118 -0
  22. gensyn_audit-0.1.0/src/gensyn_audit/plan.py +396 -0
  23. gensyn_audit-0.1.0/src/gensyn_audit/progress.py +278 -0
  24. gensyn_audit-0.1.0/src/gensyn_audit/record.py +616 -0
  25. gensyn_audit-0.1.0/src/gensyn_audit/runner.py +595 -0
  26. gensyn_audit-0.1.0/src/gensyn_audit/steps.py +76 -0
  27. gensyn_audit-0.1.0/src/gensyn_audit/submit.py +209 -0
  28. gensyn_audit-0.1.0/src/gensyn_audit/ui.py +310 -0
  29. gensyn_audit-0.1.0/src/gensyn_audit/upload.py +334 -0
  30. gensyn_audit-0.1.0/src/gensyn_audit/verify.py +361 -0
  31. gensyn_audit-0.1.0/tests/conftest.py +128 -0
  32. gensyn_audit-0.1.0/tests/test_activity.py +32 -0
  33. gensyn_audit-0.1.0/tests/test_cli.py +563 -0
  34. gensyn_audit-0.1.0/tests/test_commitments.py +165 -0
  35. gensyn_audit-0.1.0/tests/test_convert.py +530 -0
  36. gensyn_audit-0.1.0/tests/test_detached_and_reuse.py +961 -0
  37. gensyn_audit-0.1.0/tests/test_doctor_memory.py +49 -0
  38. gensyn_audit-0.1.0/tests/test_gcs.py +286 -0
  39. gensyn_audit-0.1.0/tests/test_handoff_verification.py +958 -0
  40. gensyn_audit-0.1.0/tests/test_interval_end_to_end.py +582 -0
  41. gensyn_audit-0.1.0/tests/test_kit.py +454 -0
  42. gensyn_audit-0.1.0/tests/test_manifest.py +198 -0
  43. gensyn_audit-0.1.0/tests/test_packed_handoff_transport.py +102 -0
  44. gensyn_audit-0.1.0/tests/test_plan.py +390 -0
  45. gensyn_audit-0.1.0/tests/test_progress.py +240 -0
  46. gensyn_audit-0.1.0/tests/test_record.py +42 -0
  47. gensyn_audit-0.1.0/tests/test_record_flow.py +556 -0
  48. gensyn_audit-0.1.0/tests/test_runner.py +178 -0
  49. gensyn_audit-0.1.0/tests/test_steps.py +67 -0
  50. gensyn_audit-0.1.0/tests/test_ui.py +340 -0
  51. gensyn_audit-0.1.0/tests/test_upload_session.py +449 -0
  52. gensyn_audit-0.1.0/tools/make_demo_kit.py +289 -0
  53. gensyn_audit-0.1.0/uv.lock +148 -0
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ audit-*/
6
+ result.json
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+
10
+ # Local fixtures may carry withheld loss values.
11
+ src/gensyn_audit/mocks/
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.5
2
+ Name: gensyn-audit
3
+ Version: 0.1.0
4
+ Summary: Independently replay and verify Gensyn Open 1B training steps.
5
+ Project-URL: Website, https://open1b.gensyn.ai/#/
6
+ Project-URL: Repository, https://github.com/gensyn-ai/pretraining-audit-cli
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Requires-Python: <3.12,>=3.11
10
+ Requires-Dist: google-crc32c>=1.5
11
+ Description-Content-Type: text/markdown
12
+
13
+ # gensyn-audit
14
+
15
+ `gensyn-audit` independently replays Gensyn Open 1B training steps and verifies
16
+ the results against the run's published commitments.
17
+
18
+ ## Run an audit
19
+
20
+ The current Open 1B audit requires Python 3.11 and an Apple Silicon Mac.
21
+
22
+ Install the CLI:
23
+
24
+ ```bash
25
+ uv tool install --python 3.11 gensyn-audit
26
+ gensyn-audit --version
27
+ ```
28
+
29
+ Then go to:
30
+
31
+ https://open1b.gensyn.ai/#/
32
+
33
+ The site explains the available audits and their resource requirements, lets
34
+ you claim one, and gives you the exact command to run. Do not share its claim
35
+ token.
36
+
37
+ Run `gensyn-audit --help` for general CLI help.
38
+
39
+ ## What it verifies
40
+
41
+ Depending on the selected audit, `gensyn-audit` checks the downloaded training
42
+ code and kernels, checkpoint integrity, and the replayed state against the
43
+ run's published commitments. Claimed results are also compared with loss values
44
+ withheld by the record.
45
+
46
+ A match means your machine independently reproduced the state hash Gensyn
47
+ published for that training step. Each successful audit verifies one step of
48
+ Open 1B's training history and contributes toward independently auditing the
49
+ full run.
@@ -0,0 +1,37 @@
1
+ # gensyn-audit
2
+
3
+ `gensyn-audit` independently replays Gensyn Open 1B training steps and verifies
4
+ the results against the run's published commitments.
5
+
6
+ ## Run an audit
7
+
8
+ The current Open 1B audit requires Python 3.11 and an Apple Silicon Mac.
9
+
10
+ Install the CLI:
11
+
12
+ ```bash
13
+ uv tool install --python 3.11 gensyn-audit
14
+ gensyn-audit --version
15
+ ```
16
+
17
+ Then go to:
18
+
19
+ https://open1b.gensyn.ai/#/
20
+
21
+ The site explains the available audits and their resource requirements, lets
22
+ you claim one, and gives you the exact command to run. Do not share its claim
23
+ token.
24
+
25
+ Run `gensyn-audit --help` for general CLI help.
26
+
27
+ ## What it verifies
28
+
29
+ Depending on the selected audit, `gensyn-audit` checks the downloaded training
30
+ code and kernels, checkpoint integrity, and the replayed state against the
31
+ run's published commitments. Claimed results are also compared with loss values
32
+ withheld by the record.
33
+
34
+ A match means your machine independently reproduced the state hash Gensyn
35
+ published for that training step. Each successful audit verifies one step of
36
+ Open 1B's training history and contributes toward independently auditing the
37
+ full run.
@@ -0,0 +1,64 @@
1
+ # Long-running audits
2
+
3
+ An Open 1B interval step takes hours. This guide covers what the CLI does
4
+ while it runs, how to watch or abandon it, and what a low-memory machine is in
5
+ for. The README stays short because it doubles as the PyPI package
6
+ description; the audit website is the place to start.
7
+
8
+ ## The detached flow
9
+
10
+ The command the site gives you runs detached. The CLI prepares everything in
11
+ front of you: kit, preflight, download, predecessor check. Anything that fails
12
+ fast fails while you are watching. It then hands the rest to a copy of itself
13
+ in its own session. That copy replays, reports, submits under your claim and
14
+ uploads the hand-off on its own. Closing the terminal does not stop it, and
15
+ nothing needs re-running.
16
+
17
+ ```bash
18
+ gensyn-audit status --workdir <dir> --follow # watch it through to the submission
19
+ gensyn-audit logs --workdir <dir> # the replay's own output
20
+ gensyn-audit stop --workdir <dir> # abandon it
21
+ ```
22
+
23
+ Its screen is `<dir>/gensyn-audit.log`; the replay's own output is
24
+ `<dir>/audit.log`. The claim token is handed to the detached copy over a pipe,
25
+ not on its command line, so it does not appear in either log or in the
26
+ process list.
27
+
28
+ If the detached copy dies before reporting (a reboot, say), `status` says so.
29
+ Re-running the same `run` command reports and submits the finished replay
30
+ rather than starting another.
31
+
32
+ ## The next step
33
+
34
+ When the upload finishes, the CLI prints the command for the next step. Claim
35
+ that step on the site and run the printed command. The hand-off you just
36
+ uploaded is reused from this machine rather than downloaded again; it is still
37
+ digest-checked against what the record published before anything opens it.
38
+ Every step needs its own claim.
39
+
40
+ ## Memory and swap
41
+
42
+ Measured in the first week of Open 1B audits, a step takes roughly:
43
+
44
+ | Machine | Time per step |
45
+ |------------------------|-----------------|
46
+ | 24 GB MacBook Pro | about 18 hours |
47
+ | 48 GB MacBook Pro | about 6 hours |
48
+ | H100 | under an hour |
49
+
50
+ There is no minimum spec. The point is that an audit is doable on ordinary
51
+ hardware. Below about 40 GB of unified memory the replay lives in swap, so
52
+ expect the long form. `doctor` warns about this rather than refusing.
53
+
54
+ In that same week, two of three replays on 24 GB machines reported a hash that
55
+ matched nothing, a different one each time. What caused those two divergences
56
+ was not established. Nothing was measured that would separate a memory fault
57
+ from nondeterminism, a software defect or another hardware problem, so this
58
+ guide does not name a cause.
59
+
60
+ What to do with a NO MATCH from a heavily swapping machine: reproduce it before
61
+ reading it as a finding about the run. Re-run the same step on a machine with
62
+ more memory, or have another auditor take it. A mismatch that reproduces is
63
+ worth reporting as a divergence; one that does not is worth reporting too,
64
+ with both hashes, so the failure can be understood. Do not discard either.
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "gensyn-audit"
7
+ version = "0.1.0"
8
+ description = "Independently replay and verify Gensyn Open 1B training steps."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11,<3.12"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ dependencies = [
14
+ # A 31 KB C extension, and the only dependency. Checkpoint shards are
15
+ # composite objects for which GCS publishes no md5, so crc32c is the only
16
+ # checksum available for essentially the whole download; in pure Python it
17
+ # runs at ~20 MB/s and becomes the bottleneck instead of the network.
18
+ # gcs.py keeps a pure-Python fallback, so verification still works if this
19
+ # cannot be installed — it is just slow.
20
+ "google-crc32c>=1.5",
21
+ ]
22
+
23
+ [project.scripts]
24
+ # `audit` is taken: macOS ships /usr/sbin/audit, and shadowing a
25
+ # system binary on the only supported platform is a bad default.
26
+ gensyn-audit = "gensyn_audit.cli:main"
27
+
28
+ [project.urls]
29
+ Website = "https://open1b.gensyn.ai/#/"
30
+ Repository = "https://github.com/gensyn-ai/pretraining-audit-cli"
31
+
32
+ [tool.hatch.build.targets.wheel]
33
+ packages = ["src/gensyn_audit"]
34
+ # Local mock fixtures may contain withheld loss values and must never ship.
35
+ exclude = ["src/gensyn_audit/mocks/**"]
36
+
37
+ [tool.ruff]
38
+ line-length = 100
39
+ target-version = "py311"
40
+
41
+ [tool.ruff.lint.per-file-ignores]
42
+ "tests/**" = ["RUF012"]
43
+
44
+ [tool.pyrefly]
45
+ project-includes = ["src/**/*.py"]
46
+
47
+ [dependency-groups]
48
+ dev = [
49
+ "pyrefly>=1.3.0",
50
+ "pytest>=9.1.1",
51
+ "ruff>=0.16.7",
52
+ ]
@@ -0,0 +1,16 @@
1
+ """gensyn-audit — the local runner for one auditable-training replay.
2
+
3
+ The web record coordinates and explains; this tool verifies. It turns a step
4
+ number plus a manifest into the exact ``pretrain.cli.audit_replay`` invocation
5
+ the MPS runbook prescribes, launches it detached, follows it, and reports the
6
+ one thing that matters: whether the state hash you produced equals the hash the
7
+ run committed to.
8
+
9
+ It deliberately reproduces nothing itself. Every bit that is compared is
10
+ computed by ``audit_replay`` inside the training repo's own virtualenv, so an
11
+ auditor's trust rests on that code and not on this wrapper. ``gensyn-audit plan``
12
+ prints the command in full for exactly that reason -- you should be able to
13
+ read what this will run before you let it run.
14
+ """
15
+
16
+ __version__ = "0.1.0"
@@ -0,0 +1,66 @@
1
+ """The Gensyn mark, and the header it sits in.
2
+
3
+ The art below is the canonical symbol from ``brand.gensyn.ai`` (logo-symbol,
4
+ ``viewBox="0 0 306 306"``) rasterised onto a 32x16 terminal grid. That size is
5
+ not arbitrary: the symbol is a stepped octagon whose walls are 36.5 units on a
6
+ 300-unit field and whose faces are 81, so at 32 columns a wall lands on exactly
7
+ 4 cells and a face on 8, and nothing rounds. Smaller grids collapse the thick
8
+ walls into a thin diamond -- a different shape, and not the brand's.
9
+
10
+ Terminal cells are about twice as tall as they are wide, so 32x16 reads square.
11
+
12
+ The mark is decoration and must never be load-bearing: it degrades to plain
13
+ text when output is not a terminal, when NO_COLOR is set, or when the terminal
14
+ is too narrow to hold it.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from . import __version__
20
+ from .ui import color_enabled, paint, width
21
+
22
+ #: 32x16, from the canonical symbol. Do not hand-edit -- regenerate from the
23
+ #: published SVG if the brand asset ever changes.
24
+ MARK: tuple[str, ...] = (
25
+ " ████████",
26
+ " ████████",
27
+ " ████ ████",
28
+ " ████ ████",
29
+ " ████ ████",
30
+ " ████ ████",
31
+ "████ ████",
32
+ "████ ████",
33
+ "████ ████",
34
+ "████ ████",
35
+ " ████ ████",
36
+ " ████ ████",
37
+ " ████ ████",
38
+ " ████ ████",
39
+ " ████████",
40
+ " ████████",
41
+ )
42
+
43
+ #: The one-glyph fallback. U+25C8 reads as the mark's silhouette at 1x1.
44
+ GLYPH = "\u25c8"
45
+
46
+ WORDMARK = "gensyn audit"
47
+
48
+ #: Below this the mark would wrap, which looks worse than not drawing it.
49
+ MIN_WIDTH = 38
50
+
51
+
52
+ def mark_lines(indent: str = " ") -> list[str]:
53
+ return [indent + line for line in MARK]
54
+
55
+
56
+ def banner(*, force: bool | None = None) -> list[str]:
57
+ """The header block: art where there is room, one line otherwise."""
58
+ show = force if force is not None else (color_enabled() and width() >= MIN_WIDTH)
59
+ if not show:
60
+ return [f" {GLYPH} {WORDMARK} {__version__}"]
61
+ return [
62
+ "",
63
+ *[paint(line, "dim") for line in mark_lines()],
64
+ "",
65
+ f" {paint(WORDMARK, 'bold')} {paint(__version__, 'dim')}",
66
+ ]