@skillcdn/console 0.6.1 → 0.6.3

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 (230) hide show
  1. package/README.md +14 -7
  2. package/SKILLCDN.md +3 -2
  3. package/dist/agent-page.d.ts +2 -0
  4. package/dist/agent-page.d.ts.map +1 -1
  5. package/dist/agent-page.js +77 -30
  6. package/dist/agent-page.js.map +1 -1
  7. package/dist/agent-state.d.ts +9 -0
  8. package/dist/agent-state.d.ts.map +1 -0
  9. package/dist/agent-state.js +28 -0
  10. package/dist/agent-state.js.map +1 -0
  11. package/dist/agent-usage.d.ts +9 -6
  12. package/dist/agent-usage.d.ts.map +1 -1
  13. package/dist/agent-usage.js +38 -8
  14. package/dist/agent-usage.js.map +1 -1
  15. package/dist/api.d.ts +4 -3
  16. package/dist/api.d.ts.map +1 -1
  17. package/dist/api.js +4 -3
  18. package/dist/api.js.map +1 -1
  19. package/dist/cli/cli.d.ts +2 -0
  20. package/dist/cli/cli.d.ts.map +1 -1
  21. package/dist/cli/cli.js +369 -130
  22. package/dist/cli/cli.js.map +1 -1
  23. package/dist/cli/format.d.ts +13 -4
  24. package/dist/cli/format.d.ts.map +1 -1
  25. package/dist/cli/format.js +43 -9
  26. package/dist/cli/format.js.map +1 -1
  27. package/dist/cli/help.d.ts +82 -9
  28. package/dist/cli/help.d.ts.map +1 -1
  29. package/dist/cli/help.js +780 -318
  30. package/dist/cli/help.js.map +1 -1
  31. package/dist/cli/pack.d.ts +2 -2
  32. package/dist/cli/pack.d.ts.map +1 -1
  33. package/dist/cli/pack.js +6 -4
  34. package/dist/cli/pack.js.map +1 -1
  35. package/dist/cli/runner-files.d.ts +16 -0
  36. package/dist/cli/runner-files.d.ts.map +1 -0
  37. package/dist/cli/runner-files.js +110 -0
  38. package/dist/cli/runner-files.js.map +1 -0
  39. package/dist/cli/runner-host.d.ts +7 -0
  40. package/dist/cli/runner-host.d.ts.map +1 -1
  41. package/dist/cli/runner-host.js +40 -2
  42. package/dist/cli/runner-host.js.map +1 -1
  43. package/dist/client.d.ts +22 -1
  44. package/dist/client.d.ts.map +1 -1
  45. package/dist/client.js +7 -1
  46. package/dist/client.js.map +1 -1
  47. package/dist/components/agent-page.d.ts +61 -11
  48. package/dist/components/agent-page.d.ts.map +1 -1
  49. package/dist/components/agent-page.js +146 -35
  50. package/dist/components/agent-page.js.map +1 -1
  51. package/dist/components/agents.d.ts +3 -2
  52. package/dist/components/agents.d.ts.map +1 -1
  53. package/dist/components/agents.js +9 -3
  54. package/dist/components/agents.js.map +1 -1
  55. package/dist/components/calendar.d.ts +24 -4
  56. package/dist/components/calendar.d.ts.map +1 -1
  57. package/dist/components/calendar.js +78 -35
  58. package/dist/components/calendar.js.map +1 -1
  59. package/dist/console.d.ts.map +1 -1
  60. package/dist/console.js +40 -12
  61. package/dist/console.js.map +1 -1
  62. package/dist/data.d.ts +2 -0
  63. package/dist/data.d.ts.map +1 -1
  64. package/dist/data.js +4 -0
  65. package/dist/data.js.map +1 -1
  66. package/dist/desk-page.js +5 -5
  67. package/dist/desk-page.js.map +1 -1
  68. package/dist/feed-words.d.ts.map +1 -1
  69. package/dist/feed-words.js +18 -1
  70. package/dist/feed-words.js.map +1 -1
  71. package/dist/i18n/en.d.ts +51 -1
  72. package/dist/i18n/en.d.ts.map +1 -1
  73. package/dist/i18n/en.js +44 -2
  74. package/dist/i18n/en.js.map +1 -1
  75. package/dist/i18n/ko.d.ts.map +1 -1
  76. package/dist/i18n/ko.js +52 -17
  77. package/dist/i18n/ko.js.map +1 -1
  78. package/dist/index.d.ts +1 -1
  79. package/dist/index.d.ts.map +1 -1
  80. package/dist/index.js +1 -1
  81. package/dist/index.js.map +1 -1
  82. package/dist/limits.d.ts +10 -0
  83. package/dist/limits.d.ts.map +1 -1
  84. package/dist/limits.js +10 -0
  85. package/dist/limits.js.map +1 -1
  86. package/dist/plugin/capabilities.d.ts +1 -1
  87. package/dist/plugin/capabilities.d.ts.map +1 -1
  88. package/dist/plugin/capabilities.js +6 -1
  89. package/dist/plugin/capabilities.js.map +1 -1
  90. package/dist/plugin/context.d.ts +101 -8
  91. package/dist/plugin/context.d.ts.map +1 -1
  92. package/dist/plugin/limits.d.ts +7 -0
  93. package/dist/plugin/limits.d.ts.map +1 -1
  94. package/dist/plugin/limits.js +7 -0
  95. package/dist/plugin/limits.js.map +1 -1
  96. package/dist/plugin/testing.d.ts +2 -0
  97. package/dist/plugin/testing.d.ts.map +1 -1
  98. package/dist/plugin/testing.js +2 -0
  99. package/dist/plugin/testing.js.map +1 -1
  100. package/dist/rules.js +1 -1
  101. package/dist/rules.js.map +1 -1
  102. package/dist/runner/acp.d.ts.map +1 -1
  103. package/dist/runner/acp.js +9 -3
  104. package/dist/runner/acp.js.map +1 -1
  105. package/dist/runner/claude.d.ts.map +1 -1
  106. package/dist/runner/claude.js +143 -10
  107. package/dist/runner/claude.js.map +1 -1
  108. package/dist/runner/codex.d.ts.map +1 -1
  109. package/dist/runner/codex.js +14 -2
  110. package/dist/runner/codex.js.map +1 -1
  111. package/dist/runner/config.d.ts +18 -0
  112. package/dist/runner/config.d.ts.map +1 -1
  113. package/dist/runner/config.js +77 -1
  114. package/dist/runner/config.js.map +1 -1
  115. package/dist/runner/desk.d.ts +7 -0
  116. package/dist/runner/desk.d.ts.map +1 -1
  117. package/dist/runner/desk.js +20 -4
  118. package/dist/runner/desk.js.map +1 -1
  119. package/dist/runner/message.d.ts +26 -2
  120. package/dist/runner/message.d.ts.map +1 -1
  121. package/dist/runner/message.js +120 -32
  122. package/dist/runner/message.js.map +1 -1
  123. package/dist/runner/runner.d.ts +40 -2
  124. package/dist/runner/runner.d.ts.map +1 -1
  125. package/dist/runner/runner.js +533 -32
  126. package/dist/runner/runner.js.map +1 -1
  127. package/dist/runner/slack-status.d.ts +19 -0
  128. package/dist/runner/slack-status.d.ts.map +1 -0
  129. package/dist/runner/slack-status.js +332 -0
  130. package/dist/runner/slack-status.js.map +1 -0
  131. package/dist/runner/slack.d.ts +17 -11
  132. package/dist/runner/slack.d.ts.map +1 -1
  133. package/dist/runner/slack.js +1199 -109
  134. package/dist/runner/slack.js.map +1 -1
  135. package/dist/runner/types.d.ts +205 -6
  136. package/dist/runner/types.d.ts.map +1 -1
  137. package/dist/runner/types.js.map +1 -1
  138. package/dist/runner/usage.d.ts +6 -1
  139. package/dist/runner/usage.d.ts.map +1 -1
  140. package/dist/runner/usage.js +9 -2
  141. package/dist/runner/usage.js.map +1 -1
  142. package/dist/runner.d.ts +4 -4
  143. package/dist/runner.d.ts.map +1 -1
  144. package/dist/runner.js +3 -3
  145. package/dist/runner.js.map +1 -1
  146. package/dist/schemas.d.ts +263 -1
  147. package/dist/schemas.d.ts.map +1 -1
  148. package/dist/schemas.js +137 -5
  149. package/dist/schemas.js.map +1 -1
  150. package/dist/vocabulary.d.ts +7 -0
  151. package/dist/vocabulary.d.ts.map +1 -1
  152. package/dist/vocabulary.js +6 -0
  153. package/dist/vocabulary.js.map +1 -1
  154. package/dist/wake-text.d.ts +43 -0
  155. package/dist/wake-text.d.ts.map +1 -0
  156. package/dist/wake-text.js +115 -0
  157. package/dist/wake-text.js.map +1 -0
  158. package/docs/specs/cli.md +21 -12
  159. package/docs/specs/plugins.md +12 -7
  160. package/docs/specs/rest.md +14 -5
  161. package/docs/specs/runner.md +133 -26
  162. package/docs/start.md +26 -5
  163. package/package.json +3 -3
  164. package/skills/building-a-plugin/SKILL.md +3 -3
  165. package/skills/deploying-a-console/SKILL.md +3 -3
  166. package/skills/deploying-a-console/references/access.md +15 -1
  167. package/skills/deploying-a-console/references/resources.md +2 -2
  168. package/skills/deploying-a-console/scripts/github-app.mjs +593 -0
  169. package/skills/planning-the-board/references/setting-up.md +1 -1
  170. package/skills/running-an-agent/SKILL.md +18 -72
  171. package/skills/running-an-agent/references/preparing-the-machine.md +17 -0
  172. package/skills/running-an-agent/references/several-tasks.md +1 -1
  173. package/skills/running-an-agent/references/slack-app.md +55 -8
  174. package/skills/running-an-agent/references/the-account-and-the-invitation.md +5 -0
  175. package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -0
  176. package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +16 -0
  177. package/skills/running-an-agent/references/your-first-task.md +19 -0
  178. package/skills/trying-a-console/SKILL.md +136 -0
  179. package/skills/trying-a-console/references/when-it-does-not-go.md +30 -0
  180. package/skills/working-the-board/SKILL.md +11 -15
  181. package/skills/working-the-board/references/a-pack-skills-questions.md +3 -0
  182. package/skills/working-the-board/references/a-plugins-commands.md +3 -0
  183. package/skills/working-the-board/references/a-review.md +3 -0
  184. package/skills/working-the-board/references/an-open-run.md +3 -0
  185. package/skills/working-the-board/references/requirements.md +7 -0
  186. package/skills/working-the-board/references/the-pack.md +3 -3
  187. package/skills/working-the-board/references/what-they-were-told.md +3 -0
  188. package/skills/working-the-board/references/work-given-in-chat.md +5 -0
  189. package/src/agent-page.tsx +133 -41
  190. package/src/agent-state.ts +33 -0
  191. package/src/agent-usage.ts +55 -12
  192. package/src/api.ts +23 -0
  193. package/src/cli/cli.ts +443 -137
  194. package/src/cli/format.ts +49 -9
  195. package/src/cli/help.ts +904 -359
  196. package/src/cli/pack.ts +6 -4
  197. package/src/cli/runner-files.ts +120 -0
  198. package/src/cli/runner-host.ts +48 -2
  199. package/src/client.ts +64 -0
  200. package/src/components/agent-page.tsx +264 -39
  201. package/src/components/agents.tsx +20 -5
  202. package/src/components/calendar.tsx +92 -36
  203. package/src/console.tsx +47 -10
  204. package/src/data.ts +6 -0
  205. package/src/desk-page.tsx +5 -5
  206. package/src/feed-words.ts +20 -1
  207. package/src/i18n/en.ts +50 -2
  208. package/src/i18n/ko.ts +62 -17
  209. package/src/index.ts +2 -0
  210. package/src/limits.ts +10 -0
  211. package/src/plugin/capabilities.ts +8 -1
  212. package/src/plugin/context.ts +103 -7
  213. package/src/plugin/limits.ts +7 -0
  214. package/src/plugin/testing.ts +4 -0
  215. package/src/rules.ts +1 -1
  216. package/src/runner/acp.ts +9 -3
  217. package/src/runner/claude.ts +159 -10
  218. package/src/runner/codex.ts +14 -2
  219. package/src/runner/config.ts +114 -1
  220. package/src/runner/desk.ts +23 -4
  221. package/src/runner/message.ts +144 -35
  222. package/src/runner/runner.ts +658 -35
  223. package/src/runner/slack-status.ts +423 -0
  224. package/src/runner/slack.ts +1509 -128
  225. package/src/runner/types.ts +200 -5
  226. package/src/runner/usage.ts +16 -3
  227. package/src/runner.ts +20 -1
  228. package/src/schemas.ts +161 -3
  229. package/src/vocabulary.ts +9 -0
  230. package/src/wake-text.ts +133 -0
@@ -10,6 +10,7 @@ import {
10
10
  import {
11
11
  addDays,
12
12
  addMonths,
13
+ dayOf,
13
14
  daysBetween,
14
15
  deviceLanguage,
15
16
  firstDayOfWeek,
@@ -31,17 +32,59 @@ import { CategoryBadge, cx, PersonChip, personName, StateBadge, Time, Workers }
31
32
  // The calendar of a project (ADR-0019): the month as a grid, or one week on its own. A task
32
33
  // planned from a start to a due day lies across its days as a bar, in a lane of its own within
33
34
  // each week so that the bars of one week never cross; a task with one day alone, a due day or
34
- // a start, sits on that day as a dot. On a project's calendar the person who has a task stands
35
- // before its title, since the days hold several people's work. Who has what says whether the
36
- // work is on its days. The task under the pointer is shown in full within its item, with the
37
- // facts its own page lists, above or below it where there is more room. Takes its data as props
38
- // and nothing from the network; the month or the week shown is the address's (ADR-0010).
35
+ // a start, sits on that day as a dot. A task with no day of its plan lies where it was worked,
36
+ // by the moments the board keeps, a bar or a dot the same way (ADR-0159). On a project's
37
+ // calendar the person who has a task stands before its title, since the days hold several
38
+ // people's work. Who has what says whether the work is on its days. The task under the pointer
39
+ // is shown in full within its item, with the facts its own page lists, above or below it where
40
+ // there is more room. Takes its data as props and nothing from the network; the month or the
41
+ // week shown is the address's (ADR-0010).
39
42
 
40
43
  const isOpen = (task: RestTaskBrief): boolean => OPEN_TASK_STATES.includes(task.state);
41
44
 
42
- /** Whether a task lies across days: a start and a due day, and the due day after the start. */
43
- const spans = (task: RestTaskBrief): boolean =>
44
- task.startsOn !== null && task.dueOn !== null && task.startsOn < task.dueOn;
45
+ /** The day a moment fell on, by this machine's clock, as the calendar spells a day. */
46
+ function dayOfMoment(moment: string | null): string | undefined {
47
+ if (moment === null) {
48
+ return undefined;
49
+ }
50
+ const date = new Date(moment);
51
+ return Number.isNaN(date.getTime()) ? undefined : dayOf(date);
52
+ }
53
+
54
+ /** The days a task lies on, on a calendar: the first and the last, one day where it lies on one. */
55
+ export interface TaskDays {
56
+ readonly from: string;
57
+ readonly to: string;
58
+ }
59
+
60
+ /**
61
+ * Where a task lies on a calendar, counted from `today`, or nowhere. A task with a day of its
62
+ * plan lies on its plan (ADR-0019): from its start to its due day, or on the one day it has. A
63
+ * task with none lies where it was worked, by the moments the board keeps (ADR-0159): from the
64
+ * day it was started through today while it is in progress, and else through the day its last
65
+ * run ended, which is where its work ended however long it waits for its review; with no run
66
+ * that ended, through the day it was done, or on the day it was started alone. The plan is read
67
+ * and never written: a task neither planned nor started lies nowhere.
68
+ */
69
+ export function daysOf(task: RestTaskBrief, today: string): TaskDays | undefined {
70
+ const planned = task.dueOn ?? task.startsOn;
71
+ if (planned !== null) {
72
+ const begins = task.startsOn !== null && task.startsOn < planned ? task.startsOn : planned;
73
+ return { from: begins, to: planned };
74
+ }
75
+ const done = dayOfMoment(task.doneAt);
76
+ // A task done before the board kept when it was started has the day it was done alone.
77
+ const from = dayOfMoment(task.startedAt) ?? done;
78
+ if (from === undefined) {
79
+ return undefined;
80
+ }
81
+ const ended = dayOfMoment(task.lastRunEndedAt ?? null);
82
+ // A run left open by hand may end after the task was done, which ended the work.
83
+ const over = ended !== undefined && done !== undefined && done < ended ? done : (ended ?? done);
84
+ const to = task.state === "in_progress" ? today : (over ?? from);
85
+ // The reader's clock may be behind the board's: such a task sits on the day it reaches.
86
+ return to < from ? { from: to, to } : { from, to };
87
+ }
45
88
 
46
89
  export interface CalendarProps<T extends RestTaskBrief = RestTaskBrief> {
47
90
  readonly tasks: readonly T[];
@@ -77,11 +120,14 @@ export interface WeekSegment<T extends RestTaskBrief = RestTaskBrief> {
77
120
  /**
78
121
  * The bars of one week: every task lying across days that touches the week, cut to it, each
79
122
  * in the first lane where it crosses nothing that was laid before it. The longest and earliest
80
- * go first, so that the lanes stay few.
123
+ * go first, so that the lanes stay few. A task with no day of its plan lies across the days it
124
+ * was worked, through `today` while it is at work ({@link daysOf}); the browser's today when left
125
+ * out.
81
126
  */
82
127
  export function weekSegments<T extends RestTaskBrief>(
83
128
  week: readonly GridDay[],
84
129
  tasks: readonly T[],
130
+ today: string = todayOf(),
85
131
  ): WeekSegment<T>[] {
86
132
  const first = week[0]?.day;
87
133
  const last = week[week.length - 1]?.day;
@@ -89,16 +135,14 @@ export function weekSegments<T extends RestTaskBrief>(
89
135
  return [];
90
136
  }
91
137
  const cut = tasks
92
- .filter(spans)
93
138
  .flatMap((task) => {
94
- const startsOn = task.startsOn ?? first;
95
- const dueOn = task.dueOn ?? last;
96
- if (dueOn < first || startsOn > last) {
139
+ const days = daysOf(task, today);
140
+ if (days === undefined || days.from === days.to || days.to < first || days.from > last) {
97
141
  return [];
98
142
  }
99
- const from = startsOn < first ? 0 : daysBetween(first, startsOn);
100
- const to = dueOn > last ? week.length - 1 : daysBetween(first, dueOn);
101
- return [{ task, from, to, begins: startsOn >= first, ends: dueOn <= last }];
143
+ const from = days.from < first ? 0 : daysBetween(first, days.from);
144
+ const to = days.to > last ? week.length - 1 : daysBetween(first, days.to);
145
+ return [{ task, from, to, begins: days.from >= first, ends: days.to <= last }];
102
146
  })
103
147
  .sort(
104
148
  (a, b) => a.from - b.from || b.to - b.from - (a.to - a.from) || a.task.number - b.task.number,
@@ -125,16 +169,19 @@ function push<T extends RestTaskBrief>(map: Map<string, T[]>, day: string, task:
125
169
  }
126
170
  }
127
171
 
128
- /** The tasks that sit on one day each, by day: due on it, or beginning on it with no due day yet. */
129
- function onDays<T extends RestTaskBrief>(tasks: readonly T[]): ReadonlyMap<string, readonly T[]> {
172
+ /**
173
+ * The tasks that sit on one day each, by day: due on it, beginning on it with no due day yet,
174
+ * or, with no day of its plan, worked on it alone ({@link daysOf}).
175
+ */
176
+ function onDays<T extends RestTaskBrief>(
177
+ tasks: readonly T[],
178
+ today: string,
179
+ ): ReadonlyMap<string, readonly T[]> {
130
180
  const on = new Map<string, T[]>();
131
181
  for (const task of tasks) {
132
- if (spans(task)) {
133
- continue;
134
- }
135
- const day = task.dueOn ?? task.startsOn;
136
- if (day !== null) {
137
- push(on, day, task);
182
+ const days = daysOf(task, today);
183
+ if (days !== undefined && days.from === days.to) {
184
+ push(on, days.from, task);
138
185
  }
139
186
  }
140
187
  // Within a day, what is still open comes first; the rest reads as what was.
@@ -144,14 +191,20 @@ function onDays<T extends RestTaskBrief>(tasks: readonly T[]): ReadonlyMap<strin
144
191
  return on;
145
192
  }
146
193
 
147
- /** The tasks of one day: those on it alone and those lying across it, the open ones first. */
148
- export function tasksOn<T extends RestTaskBrief>(day: string, tasks: readonly T[]): T[] {
194
+ /**
195
+ * The tasks of one day: those on it alone and those lying across it, the open ones first;
196
+ * counted from `today` as {@link daysOf} counts, the browser's today when left out.
197
+ */
198
+ export function tasksOn<T extends RestTaskBrief>(
199
+ day: string,
200
+ tasks: readonly T[],
201
+ today: string = todayOf(),
202
+ ): T[] {
149
203
  return tasks
150
- .filter((task) =>
151
- spans(task)
152
- ? (task.startsOn ?? day) <= day && day <= (task.dueOn ?? day)
153
- : (task.dueOn ?? task.startsOn) === day,
154
- )
204
+ .filter((task) => {
205
+ const days = daysOf(task, today);
206
+ return days !== undefined && days.from <= day && day <= days.to;
207
+ })
155
208
  .sort((a, b) => Number(isOpen(b)) - Number(isOpen(a)) || a.number - b.number);
156
209
  }
157
210
 
@@ -595,11 +648,14 @@ export function Calendar<T extends RestTaskBrief>(props: CalendarProps<T>) {
595
648
  const now = props.today ?? todayOf();
596
649
  const firstDay = firstDayOfWeek(deviceLanguage(tag), props.weekStart);
597
650
  const weeks = monthGrid(props.month, firstDay);
598
- const onPicked = picked === null ? [] : tasksOn(picked, props.tasks);
599
- const on = onDays(props.tasks);
651
+ const onPicked = picked === null ? [] : tasksOn(picked, props.tasks, now);
652
+ const on = onDays(props.tasks, now);
600
653
  const goalsOn = props.goalHref === undefined ? undefined : goalsOnDays(props.goals ?? []);
601
654
  const inMonth = (day: string) => monthOf(day) === props.month;
602
- const monthWeeks = weeks.map((week) => ({ week, segments: weekSegments(week, props.tasks) }));
655
+ const monthWeeks = weeks.map((week) => ({
656
+ week,
657
+ segments: weekSegments(week, props.tasks, now),
658
+ }));
603
659
  const nothing =
604
660
  [...on.keys()].every((day) => !inMonth(day)) &&
605
661
  monthWeeks.every(({ week, segments }) =>
@@ -732,8 +788,8 @@ export function Week<T extends RestTaskBrief>(props: WeekProps<T>) {
732
788
  const first = days[0] ?? now;
733
789
  const last = days[days.length - 1] ?? now;
734
790
  const week: GridDay[] = days.map((day) => ({ day, inMonth: true }));
735
- const on = onDays(props.tasks);
736
- const segments = weekSegments(week, props.tasks);
791
+ const on = onDays(props.tasks, now);
792
+ const segments = weekSegments(week, props.tasks, now);
737
793
  const nothing = segments.length === 0 && days.every((day) => !on.has(day));
738
794
  return (
739
795
  <div className="sc-calendar sc-week">
package/src/console.tsx CHANGED
@@ -2612,11 +2612,11 @@ function PlatePage(props: {
2612
2612
  ) {
2613
2613
  setForbidden(true);
2614
2614
  } else {
2615
- setProblem(errorWords(failure, couldNotLoad));
2615
+ setProblem(errorWords(failure, couldNotLoad, words));
2616
2616
  }
2617
2617
  });
2618
2618
  return () => controller.abort();
2619
- }, [load, couldNotLoad, refused, remember, early]);
2619
+ }, [load, couldNotLoad, refused, remember, early, words]);
2620
2620
  return (
2621
2621
  <>
2622
2622
  {props.headless !== true && (
@@ -2766,6 +2766,7 @@ function useMyDecisions(
2766
2766
  /** What the first page is remembered by, with whose it is. */
2767
2767
  remember: string,
2768
2768
  ): DecisionsRead {
2769
+ const words = useWords();
2769
2770
  const [items, setItems] = useState<RestMyDecisions["items"] | undefined>(
2770
2771
  () => rememberedAs<RememberedDecisions>(remember)?.items,
2771
2772
  );
@@ -2795,7 +2796,7 @@ function useMyDecisions(
2795
2796
  setMore(page.more);
2796
2797
  } catch (failure: unknown) {
2797
2798
  if (signal?.aborted !== true) {
2798
- setProblem(errorWords(failure, couldNotLoad));
2799
+ setProblem(errorWords(failure, couldNotLoad, words));
2799
2800
  }
2800
2801
  } finally {
2801
2802
  if (signal?.aborted !== true) {
@@ -2803,7 +2804,7 @@ function useMyDecisions(
2803
2804
  }
2804
2805
  }
2805
2806
  },
2806
- [myDecisions, raised, couldNotLoad, remember],
2807
+ [myDecisions, raised, couldNotLoad, remember, words],
2807
2808
  );
2808
2809
  useEffect(() => {
2809
2810
  const controller = new AbortController();
@@ -2836,7 +2837,8 @@ function NotificationsBell(props: {
2836
2837
  readonly data: ConsoleData;
2837
2838
  readonly onNavigate: (href: string) => void;
2838
2839
  }) {
2839
- const said = useWords().notifications;
2840
+ const words = useWords();
2841
+ const said = words.notifications;
2840
2842
  const { data } = props;
2841
2843
  const { notifications, readNotifications } = data.actions;
2842
2844
  const [items, setItems] = useState<RestNotifications["items"] | undefined>(undefined);
@@ -2866,10 +2868,10 @@ function NotificationsBell(props: {
2866
2868
  setMore(page.more);
2867
2869
  } catch (failure: unknown) {
2868
2870
  if (mine === turn.current) {
2869
- setProblem(errorWords(failure, said.couldNotLoad));
2871
+ setProblem(errorWords(failure, said.couldNotLoad, words));
2870
2872
  }
2871
2873
  }
2872
- }, [notifications, readNotifications, said.couldNotLoad]);
2874
+ }, [notifications, readNotifications, said.couldNotLoad, words]);
2873
2875
  const readMore = useCallback(async () => {
2874
2876
  const mine = turn.current;
2875
2877
  try {
@@ -2941,11 +2943,11 @@ function NotificationSettingsPage(props: { readonly data: ConsoleData }) {
2941
2943
  })
2942
2944
  .catch((failure: unknown) => {
2943
2945
  if (!controller.signal.aborted) {
2944
- setProblem(errorWords(failure, said.couldNotLoad));
2946
+ setProblem(errorWords(failure, said.couldNotLoad, words));
2945
2947
  }
2946
2948
  });
2947
2949
  return () => controller.abort();
2948
- }, [notificationSettings, said.couldNotLoad]);
2950
+ }, [notificationSettings, said.couldNotLoad, words]);
2949
2951
  const shownProblem = problem ?? error;
2950
2952
  return (
2951
2953
  <>
@@ -3055,6 +3057,34 @@ function MyDecisionsPage(props: { readonly data: ConsoleData }) {
3055
3057
  );
3056
3058
  }
3057
3059
 
3060
+ /** How often the agents are read again while a page that says how they stand is in view. */
3061
+ const AGENTS_AGAIN_MS = 30_000;
3062
+
3063
+ /**
3064
+ * Keeps the agent accounts as they stand while a page shows them, how each stands and what its
3065
+ * allowance has used (ADR-0156): read again as the page is opened, every half a minute while its
3066
+ * window is in view, as often as a runner says how it stands, and when the person comes back to
3067
+ * it. A window nobody looks at asks nothing.
3068
+ */
3069
+ function AgentsKept(props: { readonly data: ConsoleData }) {
3070
+ const { refreshAgents } = props.data.actions;
3071
+ useEffect(() => {
3072
+ const again = () => {
3073
+ if (document.visibilityState === "visible") {
3074
+ refreshAgents().catch(() => undefined);
3075
+ }
3076
+ };
3077
+ again();
3078
+ const timer = setInterval(again, AGENTS_AGAIN_MS);
3079
+ document.addEventListener("visibilitychange", again);
3080
+ return () => {
3081
+ clearInterval(timer);
3082
+ document.removeEventListener("visibilitychange", again);
3083
+ };
3084
+ }, [refreshAgents]);
3085
+ return null;
3086
+ }
3087
+
3058
3088
  function WorkPage(props: {
3059
3089
  readonly data: ConsoleData;
3060
3090
  readonly components: ConsoleComponents;
@@ -3065,7 +3095,12 @@ function WorkPage(props: {
3065
3095
  return (
3066
3096
  <PlatePage
3067
3097
  components={props.components}
3068
- under={<AgentsNeedingYou agents={props.data.agents} me={props.data.me?.person?.id} />}
3098
+ under={
3099
+ <>
3100
+ <AgentsKept data={props.data} />
3101
+ <AgentsNeedingYou agents={props.data.agents} me={props.data.me?.person?.id} />
3102
+ </>
3103
+ }
3069
3104
  load={plate}
3070
3105
  remember={`work:${props.data.me?.person?.id ?? ""}`}
3071
3106
  early="work"
@@ -3551,6 +3586,7 @@ function WorkspacePage(props: {
3551
3586
  client={client}
3552
3587
  viaToken={holdsToken(data)}
3553
3588
  providers={data.me?.signIn}
3589
+ me={data.me?.person?.id}
3554
3590
  work={(agent) => (
3555
3591
  <AgentWork agent={agent} data={data} components={components} week={route.week} />
3556
3592
  )}
@@ -3633,6 +3669,7 @@ function WorkspacePage(props: {
3633
3669
  {error !== undefined && <Callout tone="danger">{error}</Callout>}
3634
3670
  {view !== "connected" ? (
3635
3671
  <>
3672
+ <AgentsKept data={data} />
3636
3673
  <section className="sc-people-group" aria-label={agents.views.mine}>
3637
3674
  <p className="sc-lead">{accounts.intro}</p>
3638
3675
  <components.AgentAccountList
package/src/data.ts CHANGED
@@ -105,6 +105,8 @@ export interface ConsoleActions {
105
105
  * time it is shown, so that what waits in each project is what waits now (ADR-0107).
106
106
  */
107
107
  refreshProjects(): Promise<void>;
108
+ /** Reads the agent accounts again, for a page that says how they stand: what fails stays as it was. */
109
+ refreshAgents(): Promise<void>;
108
110
  /** Makes a project, whose owner the person becomes, with an image for its mark when one is given. */
109
111
  createProject(input: RestProjectInput, icon?: FileUpload): Promise<RestProject>;
110
112
  /** Changes the settings of the project the page is on; for an owner. */
@@ -742,6 +744,10 @@ export function useConsoleData(client: ConsoleClient, projectKey: string | undef
742
744
  const answer = await client.projects();
743
745
  setProjects(answer.items);
744
746
  },
747
+ async refreshAgents() {
748
+ const answer = await client.agents();
749
+ setAgents(answer.items);
750
+ },
745
751
  async createProject(input, icon) {
746
752
  const made = await client.createProject(input);
747
753
  const marked = icon === undefined ? made : await client.project(made.key).setIcon(icon);
package/src/desk-page.tsx CHANGED
@@ -147,11 +147,11 @@ export function DeskPage(props: DeskPageProps) {
147
147
  })
148
148
  .catch((failure: unknown) => {
149
149
  if (!controller.signal.aborted) {
150
- setProblem(errorWords(failure, couldNotLoad));
150
+ setProblem(errorWords(failure, couldNotLoad, pack));
151
151
  }
152
152
  });
153
153
  return () => controller.abort();
154
- }, [client, view, personId, couldNotLoad]);
154
+ }, [client, view, personId, couldNotLoad, pack]);
155
155
 
156
156
  // The closed work is read each time a view that shows it is come to, or its words change:
157
157
  // the first page of each project, for the figures everything, for the archive what the
@@ -173,7 +173,7 @@ export function DeskPage(props: DeskPageProps) {
173
173
  })
174
174
  .catch((failure: unknown) => {
175
175
  if (!controller.signal.aborted) {
176
- setProblem(errorWords(failure, couldNotLoad));
176
+ setProblem(errorWords(failure, couldNotLoad, pack));
177
177
  }
178
178
  })
179
179
  .finally(() => {
@@ -182,7 +182,7 @@ export function DeskPage(props: DeskPageProps) {
182
182
  }
183
183
  });
184
184
  return () => controller.abort();
185
- }, [client, reads, wanted, personId, projects, couldNotLoad]);
185
+ }, [client, reads, wanted, personId, projects, couldNotLoad, pack]);
186
186
 
187
187
  if (personId === undefined) {
188
188
  return null;
@@ -203,7 +203,7 @@ export function DeskPage(props: DeskPageProps) {
203
203
  };
204
204
  (shown.words.length === 0 ? setWhole : setFound)(next);
205
205
  })
206
- .catch((failure: unknown) => setProblem(errorWords(failure, couldNotLoad)))
206
+ .catch((failure: unknown) => setProblem(errorWords(failure, couldNotLoad, pack)))
207
207
  .finally(() => setBusy(false));
208
208
  };
209
209
  // A run that ended on a task still open has its title on the plate, where the plate was read.
package/src/feed-words.ts CHANGED
@@ -1,10 +1,17 @@
1
1
  import { en, type Messages } from "./i18n/en.js";
2
2
  import type { RestEvent } from "./schemas.js";
3
+ import type { AgentState, AgentStateReason } from "./vocabulary.js";
3
4
 
4
5
  // What an event of the feed says, as a sentence a person reads at a glance, in a language's
5
6
  // words (ADR-0012). Apart from the component that shows the feed, which is a page's, so that
6
7
  // the command says an event in the same sentence and loads nothing of a page for it.
7
8
 
9
+ /** The reason that says no more than the sentence of its state does, and is not said after it. */
10
+ const SAID_BY_THE_STATE: Readonly<Partial<Record<AgentState, AgentStateReason>>> = {
11
+ refused: "model_refused",
12
+ unheard: "no_heartbeat",
13
+ };
14
+
8
15
  /** What an event says, without its actor: the words after the name, in the words given; a board's event a plugin caused says so (ADR-0052). */
9
16
  export function describeEvent(event: RestEvent, words: Messages = en): string {
10
17
  const sentence = sentenceOf(event, words);
@@ -73,6 +80,12 @@ function sentenceOf(event: RestEvent, words: Messages): string {
73
80
  case "person.email_changed":
74
81
  return data.set === true ? feed.event.emailChanged(login) : feed.event.emailCleared(login);
75
82
  case "person.updated": {
83
+ // An account at a messenger said to be the member's, or theirs no longer (ADR-0164).
84
+ if (data.account !== undefined && data.messenger !== undefined) {
85
+ return data.set === true
86
+ ? feed.event.accountLinked(login, data.messenger, data.account)
87
+ : feed.event.accountUnlinked(login, data.messenger, data.account);
88
+ }
76
89
  const of = (data.fields ?? []).map(
77
90
  (field) => feed.personField[field] ?? feed.field[field] ?? field,
78
91
  );
@@ -93,7 +106,13 @@ function sentenceOf(event: RestEvent, words: Messages): string {
93
106
  : data.state === "unheard"
94
107
  ? feed.event.agentUnheard(agent)
95
108
  : feed.event.agentRunning(agent);
96
- return data.detail === undefined ? said : `${said}: ${data.detail}`;
109
+ if (data.detail === undefined || data.detail === SAID_BY_THE_STATE[data.state ?? "running"]) {
110
+ return said;
111
+ }
112
+ // Why, in the language's words; one the list has no word for is said as it came.
113
+ const reasons: Readonly<Record<string, string>> = words.agents.page.state.reasons;
114
+ const why = Object.hasOwn(reasons, data.detail) ? reasons[data.detail] : data.detail;
115
+ return `${said}: ${why}`;
97
116
  }
98
117
  case "team.created":
99
118
  return feed.event.teamCreated(data.team ?? feed.aTeam);
package/src/i18n/en.ts CHANGED
@@ -233,6 +233,12 @@ export const en = {
233
233
  "The value cannot be opened with this deployment's key. Whoever has it sets it again.",
234
234
  "secret.own_session":
235
235
  "The secret store is read by the account itself, signed in, not with a token it made.",
236
+ "secret.exists":
237
+ "The account keeps a secret of that name already. It takes the offer under another name, or in its place where it says so.",
238
+ "secret.offer_not_found": "No such offer waits for the account.",
239
+ "secret.too_many_offers":
240
+ "As many offers wait for the account as may. One is taken, left or runs out first.",
241
+ "secret.offer_own": "An account sets a secret of its own itself.",
236
242
  "agent.own_command":
237
243
  "This is asked by the account itself: its runner, on the command signed in as the account.",
238
244
  "signal.not_offered": "The model or the effort is none of those the agent's product offers.",
@@ -471,6 +477,11 @@ export const en = {
471
477
  opens:
472
478
  "Reads the work email of the people it may read, to match them to accounts elsewhere.",
473
479
  },
480
+ "people:accounts": {
481
+ name: "Accounts at a messenger",
482
+ opens:
483
+ "Says which account at a messenger is which member's. An agent account is told by it that a supervisor of its own wrote there, whose word it takes as an instruction.",
484
+ },
474
485
  "people:act": {
475
486
  name: "Acting for a person",
476
487
  opens:
@@ -512,7 +523,7 @@ export const en = {
512
523
  "notifications:read": {
513
524
  name: "Notifications",
514
525
  opens:
515
- "Reads whom the console tells of what happens in its board projects, to carry it to them elsewhere.",
526
+ "Reads whom the console tells of what happens in its board projects, to carry it to them elsewhere, and what whoever uses it chose to be told of.",
516
527
  },
517
528
  jobs: { name: "Schedule", opens: "Runs at the times it names." },
518
529
  endpoints: {
@@ -1395,6 +1406,7 @@ export const en = {
1395
1406
  name: "the name",
1396
1407
  avatar: "the avatar",
1397
1408
  kind: "the kind of account",
1409
+ account: "the account at a messenger",
1398
1410
  } as Readonly<Record<string, string>>,
1399
1411
  event: {
1400
1412
  personJoined: () => "joined the board",
@@ -1408,6 +1420,10 @@ export const en = {
1408
1420
  managerCleared: (login: string) => `cleared ${login}'s manager`,
1409
1421
  emailChanged: (login: string) => `changed ${login}'s work email`,
1410
1422
  emailCleared: (login: string) => `cleared ${login}'s work email`,
1423
+ accountLinked: (login: string, messenger: string, account: string) =>
1424
+ `said that the account ${account} at ${messenger} is ${login}'s`,
1425
+ accountUnlinked: (login: string, messenger: string, account: string) =>
1426
+ `said that the account ${account} at ${messenger} is ${login}'s no longer`,
1411
1427
  personUpdated: (fields: string, login: string) => `changed ${fields} of ${login}`,
1412
1428
  /** How an agent account stands now (ADR-0085): said by the account itself, or of `agent` by another. */
1413
1429
  agentRunning: (agent: string | undefined) =>
@@ -2062,6 +2078,23 @@ export const en = {
2062
2078
  title: "No such agent account",
2063
2079
  body: "It is not there, or it is not yours to see.",
2064
2080
  },
2081
+ offers: {
2082
+ title: "Offered secrets",
2083
+ offerTitle: "Offer a secret",
2084
+ offerAria: "Offer a secret",
2085
+ intro: (name: string, days: number) =>
2086
+ `${name} is told, and takes it or leaves it. The value is typed here once and shown to nobody; an offer not taken is gone after ${days} days.`,
2087
+ waits: (name: string) => `${name} takes each or leaves it. Never a value.`,
2088
+ own: "Take one or leave one with your command: console secrets --offered",
2089
+ name: "Name",
2090
+ namePlaceholder: "mail.password",
2091
+ value: "Value",
2092
+ note: "What it is for",
2093
+ offer: "Offer",
2094
+ someone: "Someone who is gone",
2095
+ takenAs: (name: string) => `as ${name}`,
2096
+ state: { waiting: "Waiting", taken: "Taken", left: "Left", lapsed: "Ran out" },
2097
+ },
2065
2098
  notSupervised: {
2066
2099
  title: "For its supervisors",
2067
2100
  body: "What an agent is doing is read by whom it reports to, those above them, and the administrators.",
@@ -2074,8 +2107,15 @@ export const en = {
2074
2107
  refused: "Refused",
2075
2108
  failed: "Failed",
2076
2109
  unheard: "Not heard from",
2077
- /** What stands before and after the moment a state began: "since 14:02". */
2110
+ /** What stands before and after the moment a state began, beside the state's badge: "since 14:02". */
2078
2111
  since: { before: "since ", after: "" },
2112
+ /**
2113
+ * The same where no badge stands beside the moment, with the state's own word, so that
2114
+ * the moment reads as the state's and not the reason's: "running since 14:02".
2115
+ */
2116
+ sinceAs: (state: string) => ({ before: `${state.toLowerCase()} since `, after: "" }),
2117
+ /** What stands before and after the moment a reason was said, after the reason: "a turn completed (14:02)". */
2118
+ reasonAt: { before: " (", after: ")" },
2079
2119
  /** What stands before and after the moment a state ends by itself, as when a usage limit resets: "until 03:30". */
2080
2120
  until: { before: "until ", after: "" },
2081
2121
  heard: "runner last heard from",
@@ -2436,6 +2476,14 @@ export const en = {
2436
2476
  submit: "Add the agent account",
2437
2477
  },
2438
2478
  },
2479
+ // What an agent account's status says at a messenger while it works (ADR-0170): the
2480
+ // runner's words, shown there and on no page. `{time}` stands for the moment it is back.
2481
+ status: {
2482
+ thinking: "Thinking",
2483
+ working: "Working · a reply may take a while",
2484
+ limited: "Out of usage",
2485
+ back: "back at {time}",
2486
+ },
2439
2487
  },
2440
2488
 
2441
2489
  sessions: {