@nanocollective/roster 0.1.0-alpha.4 → 0.1.0-alpha.41

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 (97) hide show
  1. package/README.md +70 -84
  2. package/dist/cli.js +4562 -2744
  3. package/docs/README.md +9 -6
  4. package/docs/agents.md +24 -20
  5. package/docs/architecture.md +13 -5
  6. package/docs/charters/analyst.md +65 -0
  7. package/docs/charters/cmo.md +69 -0
  8. package/docs/charters/community.md +63 -0
  9. package/docs/charters/cto.md +71 -0
  10. package/docs/charters/designer.md +65 -0
  11. package/docs/charters/devops.md +65 -0
  12. package/docs/charters/pm.md +70 -0
  13. package/docs/charters/qa.md +65 -0
  14. package/docs/charters/support.md +60 -0
  15. package/docs/charters/writer.md +63 -0
  16. package/docs/commands.md +90 -5
  17. package/docs/concepts.md +48 -14
  18. package/docs/cost.md +36 -1
  19. package/docs/developing.md +16 -21
  20. package/docs/doctor-codes.md +8 -2
  21. package/docs/export.md +2 -0
  22. package/docs/extending.md +2 -2
  23. package/docs/getting-started.md +126 -77
  24. package/docs/images/brain.jpg +0 -0
  25. package/docs/images/org.jpg +0 -0
  26. package/docs/images/prompt.jpg +0 -0
  27. package/docs/images/setup-org.jpg +0 -0
  28. package/docs/images/setup-plan.jpg +0 -0
  29. package/docs/images/staff.jpg +0 -0
  30. package/docs/manual-steps.md +94 -123
  31. package/docs/memory.md +21 -3
  32. package/docs/org-yaml.md +39 -2
  33. package/docs/portal.md +119 -44
  34. package/docs/prompts.md +31 -4
  35. package/docs/security.md +37 -5
  36. package/docs/session-workflow.md +49 -17
  37. package/docs/staff-yaml.md +14 -2
  38. package/docs/troubleshooting.md +8 -8
  39. package/docs/upgrading.md +9 -3
  40. package/docs/writing-a-charter.md +28 -0
  41. package/package.json +18 -20
  42. package/templates/brain/.github/workflows/%%STAFF%%-daily.yaml +6 -0
  43. package/templates/brain/.github/workflows/%%STAFF%%-mention.yaml +6 -0
  44. package/templates/brain/CHARTER.md +3 -3
  45. package/templates/brain/README.md +1 -0
  46. package/templates/brain/log/decisions.md +3 -0
  47. package/templates/brain/strategy/ideas.md +7 -0
  48. package/templates/briefs/priorities.md +46 -0
  49. package/templates/ops/.github/workflows/session.yaml +108 -14
  50. package/templates/ops/agents.mjs +7 -3
  51. package/templates/ops/compose.mjs +16 -3
  52. package/templates/ops/inflight.mjs +157 -0
  53. package/templates/ops/org/operating.md +21 -1
  54. package/templates/ops/org/voice.md +9 -0
  55. package/templates/ops/prompts/_inflight.md +14 -0
  56. package/templates/ops/prompts/_paths.md +2 -1
  57. package/templates/ops/prompts/daily.md +16 -7
  58. package/templates/ops/prompts/mention.md +2 -0
  59. package/templates/ops/run-record.mjs +144 -0
  60. package/templates/portal/css/base.css +146 -73
  61. package/templates/portal/css/brain.css +23 -20
  62. package/templates/portal/css/diff.css +10 -9
  63. package/templates/portal/css/graph.css +12 -7
  64. package/templates/portal/css/health.css +13 -11
  65. package/templates/portal/css/inbox.css +57 -25
  66. package/templates/portal/css/layout.css +96 -41
  67. package/templates/portal/css/markdown.css +36 -14
  68. package/templates/portal/css/runs.css +13 -0
  69. package/templates/portal/css/setup.css +116 -34
  70. package/templates/portal/index.html +18 -2
  71. package/templates/portal/js/api.js +41 -4
  72. package/templates/portal/js/app.js +132 -9
  73. package/templates/portal/js/dialog.js +82 -0
  74. package/templates/portal/js/icons.js +37 -0
  75. package/templates/portal/js/inflight.js +18 -0
  76. package/templates/portal/js/md.js +5 -2
  77. package/templates/portal/js/mdedit.js +84 -0
  78. package/templates/portal/js/readiness.js +35 -0
  79. package/templates/portal/js/refresh.js +2 -1
  80. package/templates/portal/js/state.js +17 -4
  81. package/templates/portal/js/views/app.js +24 -7
  82. package/templates/portal/js/views/checklist.js +10 -4
  83. package/templates/portal/js/views/credential.js +84 -0
  84. package/templates/portal/js/views/graph.js +1 -1
  85. package/templates/portal/js/views/health.js +17 -4
  86. package/templates/portal/js/views/hire.js +583 -0
  87. package/templates/portal/js/views/inbox.js +264 -84
  88. package/templates/portal/js/views/org.js +46 -106
  89. package/templates/portal/js/views/orgedit.js +234 -0
  90. package/templates/portal/js/views/paste.js +87 -21
  91. package/templates/portal/js/views/prompt.js +11 -4
  92. package/templates/portal/js/views/repos.js +20 -15
  93. package/templates/portal/js/views/runonce.js +94 -0
  94. package/templates/portal/js/views/runs.js +170 -0
  95. package/templates/portal/js/views/setup.js +257 -75
  96. package/templates/portal/js/views/staff.js +158 -243
  97. package/templates/portal/js/views/todo.js +62 -0
@@ -1,56 +1,63 @@
1
1
  /* The setup screen, and the copy-a-prompt panel it shares with the authoring screens. */
2
2
 
3
- .step{background:var(--panel);border:1px solid var(--line);border-radius:10px;
4
- padding:18px 20px 20px;margin-bottom:14px}
5
- .step.done{border-color:var(--accent-dim)}
3
+ .step{background:var(--panel);border:1px solid var(--line);border-radius:var(--r-lg);
4
+ padding:20px 22px 22px;margin-bottom:14px;box-shadow:var(--shadow-sm)}
5
+ .step.done{border-color:color-mix(in srgb,var(--accent) 30%,var(--line))}
6
6
  .stephead{display:flex;align-items:center;gap:11px;margin-bottom:10px}
7
- .stephead h2{margin:0;font:600 16px var(--sans);letter-spacing:-.01em}
8
- .stepn{flex:none;width:23px;height:23px;border-radius:50%;display:grid;place-items:center;
9
- background:var(--panel-2);border:1px solid var(--line);color:var(--ink-faint);
7
+ .stephead h2{margin:0;font:600 16px var(--sans);letter-spacing:-.018em}
8
+ .stepn{flex:none;width:24px;height:24px;border-radius:50%;display:grid;place-items:center;
9
+ background:var(--surface-2);border:1px solid transparent;color:var(--ink-dim);
10
10
  font:600 11px var(--mono)}
11
- .step.done .stepn{background:var(--accent-dim);border-color:var(--accent-dim);color:var(--bg)}
11
+ .step.done .stepn{background:var(--accent-fill);border-color:transparent;color:var(--accent-ink)}
12
12
 
13
13
  /* ---------- the form ---------- */
14
14
 
15
15
  .setupform{display:grid;gap:13px;margin:14px 0 18px;max-width:520px}
16
16
  .field{display:grid;gap:4px}
17
17
  .field>span{font:600 12px var(--sans);color:var(--ink-dim)}
18
- .field input,.field select{background:var(--panel-2);border:1px solid var(--line);color:var(--ink);
19
- border-radius:7px;padding:8px 11px;font:13px var(--sans);outline:none;width:100%}
20
- .field input:focus,.field select:focus{border-color:var(--accent-dim)}
18
+ .field input,.field select{background:var(--bg-elev);border:1px solid var(--border-strong);color:var(--ink);
19
+ border-radius:var(--r);padding:8px 11px;font:13px var(--sans);outline:none;width:100%;
20
+ transition:border-color .15s var(--ease),box-shadow .15s var(--ease)}
21
+ .field input:focus,.field select:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
21
22
  .field small{color:var(--ink-faint);font-size:11.5px;line-height:1.45}
22
23
 
23
24
  .choices{display:grid;gap:8px;margin:10px 0 4px;max-width:640px}
24
25
  .choice{display:grid;grid-template-columns:auto 1fr;gap:3px 10px;align-items:start;
25
- background:var(--panel-2);border:1px solid var(--line);border-radius:8px;
26
- padding:11px 13px;cursor:pointer}
27
- .choice:has(input:checked){border-color:var(--accent-dim)}
26
+ background:var(--bg-elev);border:1px solid var(--line);border-radius:var(--r);
27
+ padding:12px 14px;cursor:pointer;
28
+ transition:border-color .15s var(--ease),background .15s var(--ease),box-shadow .15s var(--ease)}
29
+ .choice:hover{border-color:var(--border-strong)}
30
+ .choice:has(input:checked){border-color:var(--accent-dim);background:var(--accent-soft)}
28
31
  .choice input{grid-row:1/3;margin-top:3px;accent-color:var(--accent)}
29
32
  .choice b{font:600 13px var(--sans)}
30
33
  .choice small{color:var(--ink-dim);font-size:12px;line-height:1.45}
31
34
  .choice code{grid-column:2;font:10.5px var(--mono);color:var(--ink-faint)}
32
35
 
33
36
  .row{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-top:6px}
34
- .btn{background:var(--panel-2);border:1px solid var(--line);color:var(--ink);border-radius:7px;
35
- padding:8px 13px;font:13px var(--sans);cursor:pointer;text-decoration:none;display:inline-block}
36
- .btn:hover{border-color:var(--accent-dim)}
37
+ .btn{background:var(--surface-2);border:1px solid transparent;color:var(--ink);border-radius:8px;
38
+ padding:7px 14px;font:500 13px var(--sans);cursor:pointer;text-decoration:none;display:inline-block;
39
+ transition:background .15s var(--ease),opacity .15s var(--ease)}
40
+ .btn:hover{background:color-mix(in srgb,var(--surface-2) 88%,var(--ink) 12%)}
41
+ .btn:active{opacity:.8}
37
42
  /* The full accent, not the dim one. Dim on the page background is pale-green-on-white with
38
43
  near-white text: the button that does the main thing on the screen read as disabled. */
39
- .btn.primary{background:var(--accent);border-color:var(--accent);color:var(--bg);font-weight:600}
40
- .btn.primary:hover{filter:brightness(1.08);background:var(--accent);border-color:var(--accent)}
41
- .btn[disabled]{opacity:.5;cursor:default}
44
+ .btn.primary{background:var(--accent-fill);border-color:transparent;color:var(--accent-ink);font-weight:600}
45
+ .btn.primary:hover{background:var(--accent-fill);opacity:.88}
46
+ .btn[disabled]{opacity:.45;cursor:default}
42
47
 
43
- .cmd{background:var(--panel-2);border:1px solid var(--line);border-radius:7px;padding:10px 12px;
48
+ .cmd{background:var(--bg);border:1px solid var(--line);border-radius:var(--r);padding:10px 12px;
44
49
  font:12px/1.6 var(--mono);color:var(--ink);overflow-x:auto;white-space:pre-wrap;
45
50
  word-break:break-word;margin:9px 0}
46
51
 
47
52
  .planout{margin-top:12px}
48
- .filelist{display:grid;gap:2px;margin:9px 0;max-height:240px;overflow-y:auto;
49
- background:var(--panel-2);border:1px solid var(--line);border-radius:7px;padding:10px 12px}
53
+ .filelist{display:grid;gap:2px;margin:9px 0;
54
+ background:var(--bg);border:1px solid var(--line);border-radius:var(--r);padding:10px 12px}
50
55
  .filelist code{font:11px var(--mono);color:var(--ink-dim)}
51
56
 
52
- .manual{background:var(--panel-2);border:1px solid var(--line);border-radius:8px;
57
+ .manual{background:var(--bg-elev);border:1px solid var(--line);border-radius:var(--r);
53
58
  padding:13px 15px;margin:11px 0}
59
+ /* A file step that is written says so in the border too, the way a finished step does. */
60
+ .manual.done{border-color:color-mix(in srgb,var(--accent) 30%,var(--line))}
54
61
  .manual b{display:block;font:600 13px var(--sans);margin-bottom:4px}
55
62
  .manual p{margin:0 0 6px;font-size:13px}
56
63
  .manual small{display:block;color:var(--ink-faint);font-size:11.5px;line-height:1.5;margin-bottom:9px}
@@ -59,32 +66,33 @@
59
66
 
60
67
  .paste{border-top:1px solid var(--line);margin-top:16px;padding-top:15px}
61
68
  .paste h3{margin:0 0 5px;font:600 14px var(--sans)}
62
- .briefpreview{background:var(--panel-2);border:1px solid var(--line);border-radius:7px;
69
+ .briefpreview{background:var(--bg);border:1px solid var(--line);border-radius:var(--r);
63
70
  padding:12px 14px;font:11.5px/1.6 var(--mono);max-height:340px;overflow:auto;
64
71
  white-space:pre-wrap;word-break:break-word;margin:10px 0}
65
- .pastebox{width:100%;background:var(--panel-2);border:1px solid var(--line);color:var(--ink);
66
- border-radius:7px;padding:10px 12px;font:12px/1.6 var(--mono);outline:none;resize:vertical;
72
+ .pastebox{width:100%;background:var(--bg-elev);border:1px solid var(--border-strong);color:var(--ink);
73
+ border-radius:var(--r);padding:10px 12px;font:12px/1.6 var(--mono);outline:none;resize:vertical;
67
74
  margin:4px 0}
68
- .pastebox:focus{border-color:var(--accent-dim)}
75
+ .pastebox:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
69
76
 
70
77
  .pasteresult{margin-top:12px}
71
78
  /* A model that replied in prose is the common case and not the person's mistake, so this reads
72
79
  as a next step rather than as a failure. */
73
- .problem{background:var(--panel-2);border:1px solid var(--warn);border-radius:8px;
80
+ .problem{background:color-mix(in srgb,var(--warn) 9%,transparent);
81
+ border:1px solid transparent;border-radius:var(--r);
74
82
  padding:12px 14px;margin-bottom:10px}
75
83
  .problem b{display:block;font:600 13px var(--sans);margin-bottom:7px}
76
84
 
77
- .pastefile{background:var(--panel-2);border:1px solid var(--line);border-radius:8px;
85
+ .pastefile{background:var(--bg-elev);border:1px solid var(--line);border-radius:var(--r);
78
86
  padding:12px 14px;margin-bottom:10px}
79
87
  .pastefile.saved{border-color:var(--accent-dim)}
80
88
  .pastefile b{font:600 13px var(--mono)}
81
89
  .pastefile .meta{margin-left:9px}
82
- .pastefile .diff{max-height:300px;overflow:auto;margin:9px 0}
90
+ .pastefile .diff{margin:9px 0}
83
91
 
84
92
  /* ---------- the doctor checklist ---------- */
85
93
 
86
- .check{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;align-items:start;
87
- padding:10px 0;border-top:1px solid var(--line)}
94
+ .check{display:grid;grid-template-columns:auto 1fr;gap:2px 12px;align-items:start;
95
+ padding:12px 0;border-top:1px solid var(--line)}
88
96
  .check:first-child{border-top:none}
89
97
  .checkmark{font:600 13px var(--mono);line-height:1.5}
90
98
  .check.fail .checkmark{color:var(--err)}
@@ -95,7 +103,7 @@
95
103
  /* ---------- the repo picker ---------- */
96
104
 
97
105
  .repolist{display:grid;gap:1px;max-height:280px;overflow-y:auto;
98
- border:1px solid var(--line);border-radius:7px;background:var(--line)}
106
+ border:1px solid var(--line);border-radius:var(--r);background:var(--line)}
99
107
  /* Scoped to the picker. Bare `.repo` also matched the project label on every inbox row,
100
108
  which is where the white box and the stray padding behind MARKETING came from. */
101
109
  .repolist .repo{display:flex;align-items:center;justify-content:space-between;gap:12px;
@@ -106,6 +114,80 @@
106
114
  .repolist .repo .sub{margin:2px 0 0;font-size:11.5px}
107
115
 
108
116
  /* Which of the two things this is: a new org, or one that already runs roster. */
109
- .verdict{background:var(--panel-2);border:1px solid var(--line);border-radius:7px;
117
+ .verdict{background:var(--accent-soft);border:1px solid transparent;border-radius:var(--r);
110
118
  padding:9px 12px;font-size:12.5px}
111
119
  .verdict p{margin:0}
120
+
121
+ .plansteps{margin:6px 0 12px;padding-left:20px;font-size:13.5px;line-height:1.7}
122
+ .planfiles{margin:0 0 12px}
123
+ .planfiles summary{cursor:pointer;color:var(--ink-dim);font-size:12.5px}
124
+
125
+ /* ---------- the numbered to-do list ---------- */
126
+
127
+ .todos{display:grid;gap:10px;margin-bottom:14px}
128
+ .todo{background:var(--panel);border:1px solid var(--line);border-radius:var(--r-lg);padding:16px 18px}
129
+ .todo.done{padding:11px 18px;border-color:color-mix(in srgb,var(--accent) 30%,var(--line))}
130
+ .todohead{display:flex;align-items:center;gap:11px}
131
+ .todohead h3{margin:0;font:600 14.5px var(--sans);flex:1}
132
+ .todon{flex:none;width:24px;height:24px;border-radius:50%;display:grid;place-items:center;
133
+ background:var(--surface-2);color:var(--ink-dim);font:600 11px var(--mono)}
134
+ .todo.done .todon{background:var(--accent-fill);color:var(--accent-ink)}
135
+ .todopill{font:600 11px var(--sans);padding:2px 8px;border-radius:99px;background:var(--surface-2);color:var(--ink-dim)}
136
+ .todo.done .todopill{background:var(--accent-soft);color:var(--accent)}
137
+ .todohint{margin:8px 0 0 35px}
138
+ .todobody{margin:12px 0 0 35px}
139
+ .todobody .row{margin-top:10px}
140
+ .todo.locked{background:transparent;border-style:dashed}
141
+ .todo.locked h3{color:var(--ink-dim)}
142
+ .todo.locked .todopill{background:none;border:1px solid var(--line);color:var(--ink-faint)}
143
+
144
+ /* ---------- hiring on the Staff screen ---------- */
145
+
146
+ .hirepane > h3{margin:0 0 10px;font:600 14.5px var(--sans)}
147
+ .roles{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px;max-width:920px}
148
+ .role{display:grid;gap:5px;align-content:start;text-align:left;cursor:pointer;
149
+ background:var(--panel);border:1px solid var(--line);border-radius:var(--r-lg);padding:14px 16px;
150
+ color:var(--ink);font:inherit;
151
+ transition:border-color .15s var(--ease),box-shadow .15s var(--ease),transform .15s var(--ease)}
152
+ .role:hover{border-color:var(--accent-dim);box-shadow:var(--shadow-sm);transform:translateY(-1px)}
153
+ .role:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
154
+ .role b{font:600 14px var(--sans);letter-spacing:-.01em}
155
+ .role span{color:var(--ink-dim);font:12.5px/1.5 var(--sans)}
156
+ .roleform{max-width:560px;margin:14px 0 0}
157
+ .roleform textarea{width:100%}
158
+ .hireflow{max-width:920px}
159
+ .hireflowhead{justify-content:space-between;margin:0 0 12px}
160
+ .hireflowhead h2{margin:0;font:600 17px var(--sans);letter-spacing:-.015em}
161
+ .hiresummary{margin:0;font:13.5px/1.55 var(--sans);color:var(--ink)}
162
+ .hiresummary.err{color:var(--err)}
163
+ .hireadvanced{margin-top:12px;padding:12px 14px;border:1px solid var(--line);border-radius:var(--r);max-width:560px}
164
+ .qfield{display:grid;gap:5px;margin:0 0 12px}
165
+ .qfield span{font:600 12.5px var(--sans)}
166
+ .qfield input{background:var(--bg-elev);border:1px solid var(--border-strong);color:var(--ink);
167
+ border-radius:var(--r);padding:8px 10px;font:13px var(--sans)}
168
+ .modes{display:inline-flex;gap:2px;padding:3px;margin:0 0 14px;background:var(--surface-2);
169
+ border-radius:var(--r);flex-wrap:wrap}
170
+ .mode{border:0;background:none;color:var(--ink-dim);font:600 12.5px var(--sans);padding:6px 12px;
171
+ border-radius:calc(var(--r) - 2px);cursor:pointer}
172
+ .mode:hover{color:var(--ink)}
173
+ .mode.on{background:var(--bg-elev);color:var(--ink);box-shadow:var(--shadow-sm)}
174
+ .modes + div > .paste{border-top:0;margin-top:0;padding-top:0}
175
+
176
+ /* ---------- a checked paste ---------- */
177
+ .verdict{margin:0 0 10px;font:600 13.5px var(--sans)}
178
+ .verdict.ok{color:var(--accent)}
179
+ .verdict.bad{color:var(--err)}
180
+ .pastepreview{border:1px solid var(--line);border-radius:var(--r);padding:14px 16px;margin-bottom:12px;background:var(--bg)}
181
+ .pastenotes{margin:0 0 12px}
182
+ .pastenotes summary{cursor:pointer;font:600 12.5px var(--sans);color:var(--ink-dim);margin-bottom:6px}
183
+ .pastenotes .md{border-left:3px solid var(--line);padding-left:12px}
184
+ .pastefile .diff{white-space:pre-wrap;overflow-wrap:anywhere}
185
+ .warnline{margin:10px 0 0;padding:8px 11px;border-radius:var(--r);background:color-mix(in srgb,var(--warn) 12%,transparent);color:var(--ink);font-size:13px}
186
+
187
+ /* A single-line text box, matching the question fields. */
188
+ .textfield{width:100%;background:var(--bg-elev);border:1px solid var(--border-strong);color:var(--ink);
189
+ border-radius:var(--r);padding:8px 10px;font:13px var(--sans);outline:none}
190
+ .textfield:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
191
+ .credform{display:grid;gap:10px}
192
+ .credform .row{margin:0}
193
+ .okline{margin:0 0 8px;color:var(--accent);font:600 13px var(--sans)}
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>roster</title>
7
7
  <!-- Inline, so a local page with no network still has a tab icon and the console stays clean. -->
8
- <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='%237cc7a4'/%3E%3C/svg%3E">
8
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%2334c759'/%3E%3C/svg%3E">
9
9
  <!-- Stylesheets and modules are served from /assets by `roster portal`. No build step:
10
10
  editing one of these files and reloading is the whole edit loop. -->
11
11
  <link rel="stylesheet" href="/assets/css/base.css">
@@ -16,6 +16,7 @@
16
16
  <link rel="stylesheet" href="/assets/css/graph.css">
17
17
  <link rel="stylesheet" href="/assets/css/diff.css">
18
18
  <link rel="stylesheet" href="/assets/css/health.css">
19
+ <link rel="stylesheet" href="/assets/css/runs.css">
19
20
  <link rel="stylesheet" href="/assets/css/setup.css">
20
21
  </head>
21
22
  <body>
@@ -26,16 +27,24 @@
26
27
  <span class="sync" data-icon="refresh"></span><span id="loaded">data now</span>
27
28
  </button>
28
29
 
30
+ <!-- Only while something is left to set up; app.js decides. -->
31
+ <button class="nav top" id="setupnav" data-view="setup" hidden>
32
+ <span class="ic" data-icon="task-done"></span> Getting started
33
+ </button>
29
34
  <button class="nav top" id="inboxnav" data-view="inbox">
30
35
  <span class="ic" data-icon="inbox"></span> Inbox
31
36
  <span class="n" id="inboxcount"></span>
32
37
  </button>
38
+ <div class="staffviews" id="inboxsub" hidden></div>
33
39
  <!-- "Pending work", not "Pull requests": what is behind it is finished work waiting on you,
34
40
  and the word for how it is delivered is not the word for what it is. -->
35
41
  <button class="nav" id="prsnav" data-view="prs" title="Finished work waiting on you to merge">
36
42
  <span class="ic" data-icon="merged"></span> Pending work
37
43
  <span class="n" id="prcount"></span>
38
44
  </button>
45
+ <button class="nav" id="runsnav" data-view="runs" title="What ran, how it ended, and what it cost">
46
+ <span class="ic" data-icon="play"></span> Runs
47
+ </button>
39
48
  <button class="nav" id="orgnav" data-view="org">
40
49
  <span class="ic" data-icon="file"></span> Org
41
50
  </button>
@@ -46,7 +55,14 @@
46
55
  <span class="ic" data-icon="docs"></span> Docs
47
56
  </button>
48
57
 
49
- <div class="sect">Staff</div>
58
+ <!-- The heading is the fold. Collapsed, it carries the count, because a hidden list still
59
+ has to say how much it is hiding. -->
60
+ <!-- Named apart from the Staff screen above it: two controls both called "Staff" is how a
61
+ click meant for the screen landed on the fold, for people and for automation alike. -->
62
+ <button class="sect sectfold" id="stafffold" aria-expanded="false" aria-controls="stafflist"
63
+ aria-label="Staff list" title="Show or hide each staff member's own screens">
64
+ <span class="caret" data-icon="chevron"></span>Staff<span class="n" id="staffcount" hidden></span>
65
+ </button>
50
66
  <div id="stafflist"></div>
51
67
 
52
68
  <div class="sidefoot">
@@ -7,6 +7,9 @@ export const getDocs = () => json("/api/docs");
7
7
  export const getInbox = (force) => json("/api/inbox" + (force ? "?refresh=1" : ""));
8
8
  export const getSync = () => json("/api/sync").catch(() => null);
9
9
 
10
+ /** Every staff member's recent runs and 30-day spend. Online only; offline it says so. */
11
+ export const getRuns = (force) => json("/api/runs" + (force ? "?refresh=1" : ""));
12
+
10
13
  /** The repos org.yaml lists. Off disk, so the new-issue form does not wait on the inbox. */
11
14
  export const getRepos = () => json("/api/repos");
12
15
 
@@ -47,7 +50,12 @@ export async function post(payload, url = "/api/act") {
47
50
  body: JSON.stringify(payload),
48
51
  });
49
52
  const data = await res.json().catch(() => ({}));
50
- if (!res.ok || data.error) throw new Error(data.error || "failed with " + res.status);
53
+ if (!res.ok || data.error) {
54
+ // The body travels with the error: a refusal often carries the next step, like a link.
55
+ const err = new Error(data.error || "failed with " + res.status);
56
+ err.data = data;
57
+ throw err;
58
+ }
51
59
  return data;
52
60
  }
53
61
 
@@ -78,8 +86,21 @@ export const planTenant = (params) =>
78
86
  export const createTenant = (params) => post(params, "/api/setup/apply");
79
87
 
80
88
  /** The copyable prompt, with every file it refers to carried inside it. */
81
- export const getBrief = (kind, staff) =>
82
- json("/api/brief?kind=" + encodeURIComponent(kind) + (staff ? "&staff=" + encodeURIComponent(staff) : ""));
89
+ export const getBrief = (kind, staff, example, about) =>
90
+ json(
91
+ "/api/brief?kind=" + encodeURIComponent(kind) +
92
+ (staff ? "&staff=" + encodeURIComponent(staff) : "") +
93
+ (example ? "&example=" + encodeURIComponent(example) : "") +
94
+ (about ? "&about=" + encodeURIComponent(about) : ""),
95
+ );
96
+
97
+ /** The worked charter that matches a staff member, with the business's name in it. */
98
+ export const getCharterExample = (staff) =>
99
+ json("/api/charter-example?staff=" + encodeURIComponent(staff));
100
+
101
+ /** Whether a staff member's App secrets are set and a daily run has succeeded. Online only. */
102
+ export const getStaffProgress = (staff, fresh) =>
103
+ json("/api/staff/progress?staff=" + encodeURIComponent(staff) + (fresh ? "&fresh=1" : ""));
83
104
 
84
105
  /** Parse what came back from the model. Reads only: saving is a second, deliberate step. */
85
106
  export const parsePaste = (kind, staff, answer) =>
@@ -98,10 +119,26 @@ export const getDoctor = (offline) => json("/api/doctor" + (offline ? "?offline=
98
119
  export const getFix = (offline) => json("/api/fix" + (offline ? "?offline=1" : ""));
99
120
 
100
121
  export const listRepos = (org) => json("/api/setup/repos?org=" + encodeURIComponent(org));
101
- export const addRepo = (name, role) => post({ name, role }, "/api/setup/add-repo");
122
+ /** Commits org.yaml and pushes, as every other write here does. */
123
+ export const addRepo = (name, role, visibility) =>
124
+ post({ name, role, visibility }, "/api/setup/add-repo");
102
125
  export const startApp = (staff, scope) => post({ staff, scope }, "/api/setup/app");
103
126
  export const appResult = (state) => json("/api/setup/app-result?state=" + encodeURIComponent(state));
104
127
 
105
128
  /** Does this org already run roster. "Create" and "join" are different answers. */
106
129
  export const checkOrg = (org) => json("/api/setup/check-org?org=" + encodeURIComponent(org));
107
130
  export const joinOrg = (org) => post({ org }, "/api/setup/join");
131
+
132
+ /** The ops repo's Actions access: read it, or ask the server to set it. */
133
+ export const getAccess = () => json("/api/setup/access");
134
+ export const setAccess = () => post({}, "/api/setup/access");
135
+
136
+ /** Where the agent credential goes, and storing it. The value only ever travels in a POST. */
137
+ export const getCredential = () => json("/api/setup/credential");
138
+ export const storeCredential = (value, repoSecrets) =>
139
+ post({ value, repoSecrets }, "/api/setup/credential");
140
+
141
+ /** One daily run, now, and where it has got to. */
142
+ export const startRun = (staff) => post({ staff }, "/api/run/start");
143
+ export const runStatus = (staff, id) =>
144
+ json("/api/run/state?staff=" + encodeURIComponent(staff) + "&id=" + encodeURIComponent(id));
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { getOrg } from "./api.js";
4
4
  import { $, el, store } from "./dom.js";
5
- import { icon, iconHTML } from "./icons.js";
5
+ import { icon, iconHTML, staffIcon } from "./icons.js";
6
6
  import { installLightbox } from "./lightbox.js";
7
7
  import { setPeople } from "./md.js";
8
8
  import {
@@ -14,7 +14,7 @@ import {
14
14
  syncNotice,
15
15
  } from "./refresh.js";
16
16
  import { onRender } from "./router.js";
17
- import { ORG_WIDE, S, VIEWS, applyHash, writeHash } from "./state.js";
17
+ import { ORG_WIDE, S, VIEWS, applyHash, humanLabel, readHash, writeHash } from "./state.js";
18
18
  import { viewBrain } from "./views/brain.js";
19
19
  import { viewChanged } from "./views/changed.js";
20
20
  import { viewDocs } from "./views/docs.js";
@@ -23,12 +23,16 @@ import { viewHealth } from "./views/health.js";
23
23
  import { viewInbox, viewPrs } from "./views/inbox.js";
24
24
  import { viewOrg } from "./views/org.js";
25
25
  import { viewPrompt } from "./views/prompt.js";
26
- import { viewSetup } from "./views/setup.js";
26
+ import { viewRuns } from "./views/runs.js";
27
+ import { sentence, whatsLeft } from "./readiness.js";
28
+ import { paintSetupNav, viewGettingStarted, viewSetup } from "./views/setup.js";
27
29
  import { viewStaff } from "./views/staff.js";
28
30
 
29
31
  const SCREEN = {
32
+ setup: viewGettingStarted,
30
33
  inbox: viewInbox,
31
34
  prs: viewPrs,
35
+ runs: viewRuns,
32
36
  org: viewOrg,
33
37
  staff: viewStaff,
34
38
  docs: viewDocs,
@@ -50,8 +54,38 @@ const SCREEN = {
50
54
  */
51
55
  const NEEDS = ["org", "name", "opsName", "staff"];
52
56
 
57
+ /** The org-wide screens in the sidebar, by button. */
58
+ const NAV = [
59
+ ["#setupnav", "setup"],
60
+ ["#inboxnav", "inbox"],
61
+ ["#prsnav", "prs"],
62
+ ["#runsnav", "runs"],
63
+ ["#staffnav", "staff"],
64
+ ["#orgnav", "org"],
65
+ ["#docsnav", "docs"],
66
+ ];
67
+
53
68
  export async function boot() {
54
69
  initTheme();
70
+
71
+ /* Bound before the first request rather than after it. The sidebar is markup, so it is on
72
+ screen and clickable while /api/org is still building the export, and a click in that
73
+ window used to do nothing at all: the first click on Staff after a load was simply lost.
74
+ Now it is remembered and honoured once there is something to render. */
75
+ let early = null;
76
+ for (const [id, view] of NAV) {
77
+ const b = $(id);
78
+ if (!b) continue;
79
+ b.onclick = () => {
80
+ if (!S.data) {
81
+ early = view;
82
+ return;
83
+ }
84
+ S.view = view;
85
+ render();
86
+ };
87
+ }
88
+
55
89
  /* Before the first render, and once: it is delegated, so it covers every image any screen
56
90
  draws from here on, including the setup screen. */
57
91
  installLightbox();
@@ -66,7 +100,7 @@ export async function boot() {
66
100
  /* Every one of these reads a tenant, so during setup they answer 409 and the sidebar is a
67
101
  row of four dead ends beside an empty Staff heading. There is one thing to do on this
68
102
  screen; the navigation comes back with the org. */
69
- for (const el of document.querySelectorAll("#inboxnav, #prsnav, #orgnav, #staffnav, #docsnav, #refreshall, .sect, #stafflist")) {
103
+ for (const el of document.querySelectorAll("#inboxnav, #prsnav, #runsnav, #orgnav, #staffnav, #docsnav, #refreshall, .sect, #stafflist")) {
70
104
  el.hidden = true;
71
105
  }
72
106
  for (const slot of document.querySelectorAll("[data-icon]")) {
@@ -78,6 +112,8 @@ export async function boot() {
78
112
 
79
113
  S.data = first;
80
114
  S.loadedAt = new Date();
115
+ S.staffOpen = null; // an open hire list survives a refresh, not a page load
116
+ S.readiness = null;
81
117
  S.staffHandle = S.data.staff[0]?.handle ?? null;
82
118
  $("#orgname").textContent = S.data.name + " · " + S.data.staff.length + " staff";
83
119
 
@@ -88,14 +124,15 @@ export async function boot() {
88
124
  slot.innerHTML = iconHTML(slot.dataset.icon);
89
125
  }
90
126
  onRender(render);
127
+ const linked = readHash() !== null;
91
128
  applyHash();
129
+ /* An org nobody has been hired into has an empty Inbox, which says nothing about what to do
130
+ next. It opens on what is left instead, unless a link or a click asked for somewhere else. */
131
+ if (early) S.view = early;
132
+ else if (!linked && (S.data.unfinished ?? []).includes("hire")) S.view = "setup";
133
+ initStaffFold();
92
134
  paintSidebar();
93
135
 
94
- $("#inboxnav").onclick = () => { S.view = "inbox"; render(); };
95
- $("#prsnav").onclick = () => { S.view = "prs"; render(); };
96
- $("#staffnav").onclick = () => { S.view = "staff"; render(); };
97
- $("#orgnav").onclick = () => { S.view = "org"; render(); };
98
- $("#docsnav").onclick = () => { S.view = "docs"; render(); };
99
136
  $("#refreshall").onclick = () => refreshAll(false);
100
137
 
101
138
  /* Coming back to the tab after a run should show the run — and coming back to it thirty
@@ -180,7 +217,44 @@ function learnPeople() {
180
217
  */
181
218
  let paintedRoster = null;
182
219
 
220
+ /**
221
+ * The Staff heading is a fold, and folded it carries the count.
222
+ *
223
+ * It starts folded, so the count is not decoration: a bare "STAFF" heading over nothing is how
224
+ * a loaded org would look if the export came back empty, and those two states have to be
225
+ * tellable apart at a glance. The count sits on the heading rather than beside it so there is
226
+ * one thing to click.
227
+ */
228
+ let staffOpen = true;
229
+
230
+ function paintStaffFold() {
231
+ const b = $("#stafffold");
232
+ if (b) b.setAttribute("aria-expanded", String(staffOpen));
233
+ const list = $("#stafflist");
234
+ if (list) list.hidden = !staffOpen;
235
+ const n = $("#staffcount");
236
+ if (n) {
237
+ n.textContent = "(" + (S.data?.staff?.length ?? 0) + ")";
238
+ n.hidden = staffOpen;
239
+ }
240
+ }
241
+
242
+ function initStaffFold() {
243
+ // Folded until you say otherwise: the count on the heading is enough to know the roster is
244
+ // there, and the four org-wide screens above it are where a session starts.
245
+ staffOpen = store("roster.staffopen") === "1";
246
+ paintStaffFold();
247
+ const b = $("#stafffold");
248
+ if (!b) return;
249
+ b.onclick = () => {
250
+ staffOpen = !staffOpen;
251
+ store("roster.staffopen", staffOpen ? "1" : "0");
252
+ paintStaffFold();
253
+ };
254
+ }
255
+
183
256
  function paintSidebar() {
257
+ paintInboxLinks();
184
258
  const host = $("#stafflist");
185
259
  host.replaceChildren();
186
260
  paintedRoster = S.data.staff.map((s) => s.handle).join(" ");
@@ -191,11 +265,20 @@ function paintSidebar() {
191
265
  const head = el("button", { className: "nav staffrow" });
192
266
  head.dataset.staff = s.handle;
193
267
  head.setAttribute("aria-expanded", String(open));
268
+ const dot = el("span", { className: "readydot", hidden: true });
194
269
  head.append(
195
270
  icon("chevron", "caret"),
271
+ icon(staffIcon(s), "ic"),
196
272
  el("span", { className: "t", textContent: s.name }),
273
+ dot,
197
274
  el("span", { className: "hh", textContent: s.handle }),
198
275
  );
276
+ whatsLeft(s).then((left) => {
277
+ if (!left.length) return;
278
+ dot.hidden = false;
279
+ head.title = "Not ready to run: " + sentence(left);
280
+ paintSetupNav();
281
+ });
199
282
 
200
283
  const views = el("div", { className: "staffviews" });
201
284
  views.hidden = !open;
@@ -228,10 +311,49 @@ function paintSidebar() {
228
311
 
229
312
  host.append(head, views);
230
313
  }
314
+
315
+ // A refresh can hire or retire someone, and the folded heading is where that number shows.
316
+ paintStaffFold();
231
317
  }
232
318
 
233
319
  /** Which rows are lit, and which staff member is unfolded. */
320
+ /* The inbox's filters, as links under Inbox: everything, what is on you, decisions, then one
321
+ per staff member. They replaced two dropdowns on the Inbox screen itself. */
322
+ function paintInboxLinks() {
323
+ const sub = $("#inboxsub");
324
+ if (!sub) return;
325
+ sub.replaceChildren();
326
+ // Inbox itself is everything. Under it: each staff member, then the product repos' issues.
327
+ const links = [
328
+ ["", "All", "inbox"],
329
+ ...S.data.staff.map((s) => [s.handle, s.name, staffIcon(s)]),
330
+ ["@issues", "Issues", "issue-open"],
331
+ ];
332
+ for (const [who, label, glyph] of links) {
333
+ const b = el("button", { className: "nav subnav inboxlink" }, [
334
+ icon(glyph, "ic"),
335
+ el("span", { className: "t", textContent: label }),
336
+ ...(who === "@unread" ? [el("span", { className: "n", id: "unreadcount" })] : []),
337
+ ]);
338
+ b.dataset.who = who;
339
+ b.onclick = () => {
340
+ S.view = "inbox";
341
+ S.inboxStaff = who;
342
+ S.inboxFilter = "";
343
+ S.inboxOpen = null;
344
+ render();
345
+ };
346
+ sub.append(b);
347
+ }
348
+ }
349
+
234
350
  function markSidebar() {
351
+ const sub = $("#inboxsub");
352
+ if (sub) sub.hidden = S.view !== "inbox";
353
+ for (const b of document.querySelectorAll(".inboxlink")) {
354
+ const on = S.view === "inbox" && b.dataset.who === (S.inboxStaff || "");
355
+ b.setAttribute("aria-current", String(on));
356
+ }
235
357
  for (const b of document.querySelectorAll(".nav")) {
236
358
  if (!b.dataset.view) continue;
237
359
  const mine = !b.dataset.staff || b.dataset.staff === S.staffHandle;
@@ -256,6 +378,7 @@ function render() {
256
378
  // A refresh can add or remove a staff member, and the sidebar is built once.
257
379
  const roster = S.data.staff.map((s) => s.handle).join(" ");
258
380
  if (roster !== paintedRoster) paintSidebar();
381
+ paintSetupNav();
259
382
  markSidebar();
260
383
  stampCounts();
261
384
  writeHash(true);