prumi 0.1.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 (45) hide show
  1. prumi/__init__.py +3 -0
  2. prumi/_runtime/home.css +162 -0
  3. prumi/_runtime/home.js +65 -0
  4. prumi/_runtime/provenance.js +671 -0
  5. prumi/_runtime/runtime.js +417 -0
  6. prumi/_runtime/shell.js +268 -0
  7. prumi/_runtime/theme.css +49 -0
  8. prumi/adapters.py +285 -0
  9. prumi/agent_output.py +124 -0
  10. prumi/cli.py +228 -0
  11. prumi/config.py +174 -0
  12. prumi/engine.py +454 -0
  13. prumi/issues.py +54 -0
  14. prumi/mcp/__init__.py +786 -0
  15. prumi/mcp/authoring_guide.md +748 -0
  16. prumi/registry/__init__.py +539 -0
  17. prumi/registry/migrations/0001_initial.sql +44 -0
  18. prumi/registry/migrations/0002_page_checks.sql +13 -0
  19. prumi/registry/migrations/0003_page_checks_without_data.sql +19 -0
  20. prumi/scrub.py +27 -0
  21. prumi/server/__init__.py +39 -0
  22. prumi/server/app.py +258 -0
  23. prumi/server/assets.py +23 -0
  24. prumi/server/guards.py +33 -0
  25. prumi/server/pages.py +350 -0
  26. prumi/services.py +164 -0
  27. prumi/source.py +103 -0
  28. prumi/spec/__init__.py +31 -0
  29. prumi/spec/dashboard-spec.v0.schema.json +506 -0
  30. prumi/spec/load.py +48 -0
  31. prumi/spec/models.py +107 -0
  32. prumi/spec/schema.py +46 -0
  33. prumi/time.py +350 -0
  34. prumi/validate/__init__.py +161 -0
  35. prumi/validate/_parse.py +312 -0
  36. prumi/validate/html.py +519 -0
  37. prumi/validate/layout.js +256 -0
  38. prumi/validate/page.py +792 -0
  39. prumi/validate/rules.py +302 -0
  40. prumi-0.1.0.dist-info/METADATA +55 -0
  41. prumi-0.1.0.dist-info/RECORD +45 -0
  42. prumi-0.1.0.dist-info/WHEEL +4 -0
  43. prumi-0.1.0.dist-info/entry_points.txt +2 -0
  44. prumi-0.1.0.dist-info/licenses/LICENSE +202 -0
  45. prumi-0.1.0.dist-info/licenses/NOTICE +2 -0
prumi/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """Prumi: governed AI dashboards on top of official metrics."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,162 @@
1
+ /* Prumi's home page. Colors, fonts and radius come from theme.css, so the page follows the
2
+ * OS's light or dark mode like the shell does.
3
+ */
4
+ *, *::before, *::after { box-sizing: border-box; }
5
+ [hidden] { display: none !important; }
6
+
7
+ html { background: var(--prumi-bg); }
8
+ body {
9
+ margin: 0;
10
+ min-height: 100vh;
11
+ display: flex;
12
+ flex-direction: column;
13
+ font-family: var(--prumi-font);
14
+ font-size: 15px;
15
+ line-height: 1.45;
16
+ background: var(--prumi-bg);
17
+ color: var(--prumi-text);
18
+ }
19
+ a { color: var(--prumi-accent); }
20
+ code { font-family: var(--prumi-font-mono); font-size: 0.9em; }
21
+ time { white-space: nowrap; }
22
+
23
+ .top, main, .bottom { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
24
+
25
+ .top {
26
+ display: flex;
27
+ flex-wrap: wrap;
28
+ align-items: baseline;
29
+ gap: 4px 16px;
30
+ padding-top: 20px;
31
+ padding-bottom: 16px;
32
+ border-bottom: 1px solid var(--prumi-border);
33
+ }
34
+ .wordmark { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
35
+ .source { margin: 0; color: var(--prumi-text-muted); font-size: 14px; }
36
+ .source span { white-space: nowrap; }
37
+
38
+ main { flex: 1; padding-top: 24px; padding-bottom: 32px; }
39
+ h1, h2 { margin: 0 0 12px; font-weight: 600; }
40
+ h1 { font-size: 18px; }
41
+ h2 { font-size: 16px; }
42
+
43
+ .section-head {
44
+ display: flex;
45
+ flex-wrap: wrap;
46
+ align-items: center;
47
+ justify-content: space-between;
48
+ gap: 8px 16px;
49
+ margin-bottom: 12px;
50
+ }
51
+ .section-head h1 { margin: 0; }
52
+ #search {
53
+ flex: 0 1 280px;
54
+ min-width: 0;
55
+ padding: 6px 10px;
56
+ font: inherit;
57
+ color: var(--prumi-text);
58
+ background: var(--prumi-surface);
59
+ border: 1px solid var(--prumi-border);
60
+ border-radius: var(--prumi-radius);
61
+ }
62
+ #search::placeholder { color: var(--prumi-text-muted); }
63
+ .no-match { color: var(--prumi-text-muted); }
64
+
65
+ .cards {
66
+ list-style: none;
67
+ margin: 0;
68
+ padding: 0;
69
+ display: grid;
70
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
71
+ gap: 12px;
72
+ }
73
+ .card {
74
+ min-width: 0;
75
+ padding: 14px 16px;
76
+ background: var(--prumi-surface);
77
+ border: 1px solid var(--prumi-border);
78
+ border-radius: var(--prumi-radius);
79
+ }
80
+ .card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
81
+ .card-title {
82
+ min-width: 0;
83
+ font-weight: 600;
84
+ font-size: 16px;
85
+ text-decoration: none;
86
+ overflow-wrap: anywhere;
87
+ }
88
+ .card-title:hover, .card-title:focus-visible { text-decoration: underline; }
89
+ .badge {
90
+ flex: none;
91
+ padding: 1px 8px;
92
+ border: 1px solid currentColor;
93
+ border-radius: 12px;
94
+ font-size: 12px;
95
+ white-space: nowrap;
96
+ }
97
+ .badge[data-kind="draft"] { color: var(--prumi-text-muted); }
98
+ .badge[data-kind="certified"] { color: var(--prumi-positive); }
99
+ .badge[data-kind="attention"] { color: var(--prumi-negative); font-weight: 600; }
100
+ .card-meta { margin: 6px 0 0; color: var(--prumi-text-muted); font-size: 13px; }
101
+ .card-meta code { overflow-wrap: anywhere; }
102
+ .labels { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
103
+ .labels li {
104
+ padding: 1px 8px;
105
+ border-radius: 4px;
106
+ background: var(--prumi-bg);
107
+ border: 1px solid var(--prumi-border);
108
+ font-size: 12px;
109
+ }
110
+ .labels .more { color: var(--prumi-text-muted); }
111
+
112
+ .empty {
113
+ max-width: 640px;
114
+ padding: 20px;
115
+ background: var(--prumi-surface);
116
+ border: 1px solid var(--prumi-border);
117
+ border-radius: var(--prumi-radius);
118
+ }
119
+ .empty p { margin: 0 0 8px; }
120
+ .command {
121
+ display: flex;
122
+ align-items: flex-start;
123
+ gap: 8px;
124
+ margin-top: 8px;
125
+ padding: 8px 10px;
126
+ background: var(--prumi-bg);
127
+ border: 1px solid var(--prumi-border);
128
+ border-radius: var(--prumi-radius);
129
+ }
130
+ .command code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
131
+ .copy {
132
+ flex: none;
133
+ padding: 2px 10px;
134
+ font: inherit;
135
+ font-size: 13px;
136
+ color: var(--prumi-accent);
137
+ background: var(--prumi-surface);
138
+ border: 1px solid var(--prumi-border);
139
+ border-radius: var(--prumi-radius);
140
+ cursor: pointer;
141
+ }
142
+
143
+ .requests { margin-top: 32px; }
144
+ .requests ul { margin: 0; padding: 0; list-style: none; }
145
+ .requests li {
146
+ display: flex;
147
+ justify-content: space-between;
148
+ gap: 16px;
149
+ padding: 6px 0;
150
+ border-bottom: 1px solid var(--prumi-border);
151
+ }
152
+ .requests li span { min-width: 0; overflow-wrap: anywhere; }
153
+ .requests time, .requests p { color: var(--prumi-text-muted); font-size: 13px; }
154
+ .requests p { margin: 8px 0 0; }
155
+
156
+ .bottom {
157
+ padding-top: 12px;
158
+ padding-bottom: 20px;
159
+ border-top: 1px solid var(--prumi-border);
160
+ color: var(--prumi-text-muted);
161
+ font-size: 13px;
162
+ }
prumi/_runtime/home.js ADDED
@@ -0,0 +1,65 @@
1
+ // Prumi's home page: the search box and the copy button. Everything it needs is already on
2
+ // the page; it never calls the server.
3
+ (function () {
4
+ "use strict";
5
+
6
+ function searchText(card) {
7
+ // The card's own text, plus the labels folded into "+N" (they're in its title).
8
+ var more = card.querySelector(".labels .more");
9
+ return (card.textContent + " " + (more ? more.title : "")).toLowerCase();
10
+ }
11
+
12
+ function setUpSearch() {
13
+ var input = document.getElementById("search");
14
+ if (!input) return;
15
+ var cards = Array.prototype.slice.call(document.querySelectorAll("#cards .card"));
16
+ var texts = cards.map(searchText);
17
+ var none = document.getElementById("no-match");
18
+ input.addEventListener("input", function () {
19
+ var words = input.value.toLowerCase().split(/\s+/).filter(Boolean);
20
+ var shown = 0;
21
+ cards.forEach(function (card, i) {
22
+ var match = words.every(function (word) { return texts[i].indexOf(word) !== -1; });
23
+ card.hidden = !match;
24
+ if (match) shown += 1;
25
+ });
26
+ none.hidden = shown > 0;
27
+ });
28
+ }
29
+
30
+ function selectText(element) {
31
+ var range = document.createRange();
32
+ range.selectNodeContents(element);
33
+ var selection = window.getSelection();
34
+ selection.removeAllRanges();
35
+ selection.addRange(range);
36
+ }
37
+
38
+ function setUpCopy() {
39
+ document.querySelectorAll("button[data-copy]").forEach(function (button) {
40
+ var source = document.getElementById(button.getAttribute("data-copy"));
41
+ var label = button.textContent;
42
+ var timer = null;
43
+ function show(text) {
44
+ button.textContent = text;
45
+ clearTimeout(timer);
46
+ timer = setTimeout(function () { button.textContent = label; }, 2000);
47
+ }
48
+ button.addEventListener("click", function () {
49
+ var text = source.textContent;
50
+ if (!navigator.clipboard) {
51
+ selectText(source);
52
+ show("Selected");
53
+ return;
54
+ }
55
+ navigator.clipboard.writeText(text).then(
56
+ function () { show("Copied"); },
57
+ function () { selectText(source); show("Selected"); }
58
+ );
59
+ });
60
+ });
61
+ }
62
+
63
+ setUpSearch();
64
+ setUpCopy();
65
+ })();