@skillcdn/console 0.6.2 → 0.6.4

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 (253) hide show
  1. package/README.md +16 -9
  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 +46 -5
  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/api.d.ts +6 -4
  12. package/dist/api.d.ts.map +1 -1
  13. package/dist/api.js +6 -4
  14. package/dist/api.js.map +1 -1
  15. package/dist/cli/cli.d.ts +2 -0
  16. package/dist/cli/cli.d.ts.map +1 -1
  17. package/dist/cli/cli.js +948 -252
  18. package/dist/cli/cli.js.map +1 -1
  19. package/dist/cli/format.d.ts +44 -7
  20. package/dist/cli/format.d.ts.map +1 -1
  21. package/dist/cli/format.js +168 -13
  22. package/dist/cli/format.js.map +1 -1
  23. package/dist/cli/help.d.ts +82 -9
  24. package/dist/cli/help.d.ts.map +1 -1
  25. package/dist/cli/help.js +855 -331
  26. package/dist/cli/help.js.map +1 -1
  27. package/dist/cli/pack.d.ts +13 -12
  28. package/dist/cli/pack.d.ts.map +1 -1
  29. package/dist/cli/pack.js +33 -45
  30. package/dist/cli/pack.js.map +1 -1
  31. package/dist/cli/plugin-cli.d.ts.map +1 -1
  32. package/dist/cli/plugin-cli.js +8 -5
  33. package/dist/cli/plugin-cli.js.map +1 -1
  34. package/dist/cli/runner-files.d.ts +16 -0
  35. package/dist/cli/runner-files.d.ts.map +1 -0
  36. package/dist/cli/runner-files.js +125 -0
  37. package/dist/cli/runner-files.js.map +1 -0
  38. package/dist/cli/runner-host.d.ts +7 -0
  39. package/dist/cli/runner-host.d.ts.map +1 -1
  40. package/dist/cli/runner-host.js +40 -2
  41. package/dist/cli/runner-host.js.map +1 -1
  42. package/dist/cli/skill-path.d.ts +11 -0
  43. package/dist/cli/skill-path.d.ts.map +1 -0
  44. package/dist/cli/skill-path.js +44 -0
  45. package/dist/cli/skill-path.js.map +1 -0
  46. package/dist/client.d.ts +32 -1
  47. package/dist/client.d.ts.map +1 -1
  48. package/dist/client.js +15 -1
  49. package/dist/client.js.map +1 -1
  50. package/dist/components/agent-page.d.ts +93 -6
  51. package/dist/components/agent-page.d.ts.map +1 -1
  52. package/dist/components/agent-page.js +202 -10
  53. package/dist/components/agent-page.js.map +1 -1
  54. package/dist/components/agents.d.ts +6 -6
  55. package/dist/components/agents.d.ts.map +1 -1
  56. package/dist/components/agents.js +16 -9
  57. package/dist/components/agents.js.map +1 -1
  58. package/dist/components/people.d.ts.map +1 -1
  59. package/dist/components/people.js +7 -2
  60. package/dist/components/people.js.map +1 -1
  61. package/dist/components/picker.d.ts +16 -0
  62. package/dist/components/picker.d.ts.map +1 -1
  63. package/dist/components/picker.js +69 -4
  64. package/dist/components/picker.js.map +1 -1
  65. package/dist/console.css +40 -0
  66. package/dist/console.js +2 -2
  67. package/dist/console.js.map +1 -1
  68. package/dist/feed-words.d.ts.map +1 -1
  69. package/dist/feed-words.js +12 -1
  70. package/dist/feed-words.js.map +1 -1
  71. package/dist/i18n/en.d.ts +64 -6
  72. package/dist/i18n/en.d.ts.map +1 -1
  73. package/dist/i18n/en.js +59 -10
  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 +49 -9
  77. package/dist/i18n/ko.js.map +1 -1
  78. package/dist/limits.d.ts +26 -0
  79. package/dist/limits.d.ts.map +1 -1
  80. package/dist/limits.js +26 -0
  81. package/dist/limits.js.map +1 -1
  82. package/dist/onboarding.d.ts +18 -6
  83. package/dist/onboarding.d.ts.map +1 -1
  84. package/dist/onboarding.js +42 -7
  85. package/dist/onboarding.js.map +1 -1
  86. package/dist/plugin/args.d.ts +24 -2
  87. package/dist/plugin/args.d.ts.map +1 -1
  88. package/dist/plugin/args.js +20 -2
  89. package/dist/plugin/args.js.map +1 -1
  90. package/dist/plugin/context.d.ts +39 -7
  91. package/dist/plugin/context.d.ts.map +1 -1
  92. package/dist/plugin/define.d.ts.map +1 -1
  93. package/dist/plugin/define.js +12 -3
  94. package/dist/plugin/define.js.map +1 -1
  95. package/dist/plugin/rest-schemas.d.ts +2 -0
  96. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  97. package/dist/plugin/rest-schemas.js +1 -0
  98. package/dist/plugin/rest-schemas.js.map +1 -1
  99. package/dist/routes.d.ts +2 -0
  100. package/dist/routes.d.ts.map +1 -1
  101. package/dist/routes.js +2 -0
  102. package/dist/routes.js.map +1 -1
  103. package/dist/rules.d.ts +4 -1
  104. package/dist/rules.d.ts.map +1 -1
  105. package/dist/rules.js +5 -2
  106. package/dist/rules.js.map +1 -1
  107. package/dist/runner/acp.d.ts.map +1 -1
  108. package/dist/runner/acp.js +9 -3
  109. package/dist/runner/acp.js.map +1 -1
  110. package/dist/runner/claude.d.ts.map +1 -1
  111. package/dist/runner/claude.js +53 -1
  112. package/dist/runner/claude.js.map +1 -1
  113. package/dist/runner/codex.d.ts.map +1 -1
  114. package/dist/runner/codex.js +18 -3
  115. package/dist/runner/codex.js.map +1 -1
  116. package/dist/runner/config.d.ts +18 -0
  117. package/dist/runner/config.d.ts.map +1 -1
  118. package/dist/runner/config.js +77 -1
  119. package/dist/runner/config.js.map +1 -1
  120. package/dist/runner/desk.d.ts +7 -0
  121. package/dist/runner/desk.d.ts.map +1 -1
  122. package/dist/runner/desk.js +14 -4
  123. package/dist/runner/desk.js.map +1 -1
  124. package/dist/runner/message.d.ts +16 -22
  125. package/dist/runner/message.d.ts.map +1 -1
  126. package/dist/runner/message.js +72 -120
  127. package/dist/runner/message.js.map +1 -1
  128. package/dist/runner/runner.d.ts +41 -1
  129. package/dist/runner/runner.d.ts.map +1 -1
  130. package/dist/runner/runner.js +557 -23
  131. package/dist/runner/runner.js.map +1 -1
  132. package/dist/runner/slack-status.d.ts +19 -0
  133. package/dist/runner/slack-status.d.ts.map +1 -0
  134. package/dist/runner/slack-status.js +332 -0
  135. package/dist/runner/slack-status.js.map +1 -0
  136. package/dist/runner/slack.d.ts.map +1 -1
  137. package/dist/runner/slack.js +258 -59
  138. package/dist/runner/slack.js.map +1 -1
  139. package/dist/runner/types.d.ts +128 -15
  140. package/dist/runner/types.d.ts.map +1 -1
  141. package/dist/runner/types.js.map +1 -1
  142. package/dist/runner/usage.d.ts +6 -1
  143. package/dist/runner/usage.d.ts.map +1 -1
  144. package/dist/runner/usage.js +9 -2
  145. package/dist/runner/usage.js.map +1 -1
  146. package/dist/runner.d.ts +2 -2
  147. package/dist/runner.d.ts.map +1 -1
  148. package/dist/runner.js.map +1 -1
  149. package/dist/schemas.d.ts +635 -6
  150. package/dist/schemas.d.ts.map +1 -1
  151. package/dist/schemas.js +197 -15
  152. package/dist/schemas.js.map +1 -1
  153. package/dist/secret-file.d.ts +21 -0
  154. package/dist/secret-file.d.ts.map +1 -0
  155. package/dist/secret-file.js +59 -0
  156. package/dist/secret-file.js.map +1 -0
  157. package/dist/services.d.ts.map +1 -1
  158. package/dist/services.js +3 -2
  159. package/dist/services.js.map +1 -1
  160. package/dist/setup-guide.d.ts +2 -2
  161. package/dist/setup-guide.d.ts.map +1 -1
  162. package/dist/setup-guide.js +6 -5
  163. package/dist/setup-guide.js.map +1 -1
  164. package/dist/vocabulary.d.ts +17 -2
  165. package/dist/vocabulary.d.ts.map +1 -1
  166. package/dist/vocabulary.js +15 -2
  167. package/dist/vocabulary.js.map +1 -1
  168. package/dist/wake-text.d.ts +43 -0
  169. package/dist/wake-text.d.ts.map +1 -0
  170. package/dist/wake-text.js +115 -0
  171. package/dist/wake-text.js.map +1 -0
  172. package/docs/specs/cli.md +39 -25
  173. package/docs/specs/plugins.md +10 -9
  174. package/docs/specs/rest.md +34 -15
  175. package/docs/specs/runner.md +108 -25
  176. package/docs/start.md +28 -6
  177. package/package.json +3 -3
  178. package/skills/building-a-plugin/SKILL.md +2 -2
  179. package/skills/deploying-a-console/SKILL.md +3 -3
  180. package/skills/deploying-a-console/references/access.md +15 -1
  181. package/skills/deploying-a-console/references/resources.md +2 -2
  182. package/skills/deploying-a-console/scripts/github-app.mjs +593 -0
  183. package/skills/keeping-the-pack/SKILL.md +87 -0
  184. package/skills/planning-the-board/SKILL.md +6 -6
  185. package/skills/planning-the-board/references/a-task.md +1 -1
  186. package/skills/planning-the-board/references/setting-up.md +9 -5
  187. package/skills/running-an-agent/SKILL.md +21 -17
  188. package/skills/running-an-agent/references/preparing-the-machine.md +4 -3
  189. package/skills/running-an-agent/references/several-tasks.md +8 -2
  190. package/skills/running-an-agent/references/slack-app.md +31 -8
  191. package/skills/running-an-agent/references/the-account-and-the-invitation.md +1 -1
  192. package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -1
  193. package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +4 -4
  194. package/skills/running-an-agent/references/your-first-task.md +11 -5
  195. package/skills/trying-a-console/SKILL.md +136 -0
  196. package/skills/trying-a-console/references/when-it-does-not-go.md +30 -0
  197. package/skills/working-the-board/SKILL.md +6 -6
  198. package/skills/working-the-board/references/terms.md +3 -1
  199. package/skills/working-the-board/references/the-pack.md +14 -7
  200. package/skills/working-the-board/references/what-they-were-told.md +1 -1
  201. package/src/agent-page.tsx +111 -4
  202. package/src/agent-state.ts +33 -0
  203. package/src/api.ts +43 -0
  204. package/src/cli/cli.ts +1190 -313
  205. package/src/cli/format.ts +207 -13
  206. package/src/cli/help.ts +991 -372
  207. package/src/cli/pack.ts +55 -62
  208. package/src/cli/plugin-cli.ts +8 -5
  209. package/src/cli/runner-files.ts +137 -0
  210. package/src/cli/runner-host.ts +48 -2
  211. package/src/cli/skill-path.ts +51 -0
  212. package/src/client.ts +103 -0
  213. package/src/components/agent-page.tsx +446 -20
  214. package/src/components/agents.tsx +27 -28
  215. package/src/components/people.tsx +7 -3
  216. package/src/components/picker.tsx +79 -5
  217. package/src/console.tsx +1 -1
  218. package/src/feed-words.ts +14 -1
  219. package/src/i18n/en.ts +64 -11
  220. package/src/i18n/ko.ts +55 -9
  221. package/src/limits.ts +26 -0
  222. package/src/onboarding.ts +60 -21
  223. package/src/plugin/args.ts +29 -3
  224. package/src/plugin/context.ts +40 -7
  225. package/src/plugin/define.ts +18 -3
  226. package/src/plugin/rest-schemas.ts +3 -0
  227. package/src/routes.ts +2 -0
  228. package/src/rules.ts +5 -2
  229. package/src/runner/acp.ts +9 -3
  230. package/src/runner/claude.ts +58 -1
  231. package/src/runner/codex.ts +18 -3
  232. package/src/runner/config.ts +114 -1
  233. package/src/runner/desk.ts +15 -4
  234. package/src/runner/message.ts +88 -126
  235. package/src/runner/runner.ts +682 -27
  236. package/src/runner/slack-status.ts +423 -0
  237. package/src/runner/slack.ts +310 -67
  238. package/src/runner/types.ts +124 -13
  239. package/src/runner/usage.ts +16 -3
  240. package/src/runner.ts +4 -0
  241. package/src/schemas.ts +245 -13
  242. package/src/secret-file.ts +76 -0
  243. package/src/services.ts +3 -2
  244. package/src/setup-guide.ts +6 -5
  245. package/src/styles/README.md +1 -1
  246. package/src/styles/pages/agents.css +40 -0
  247. package/src/vocabulary.ts +21 -2
  248. package/src/wake-text.ts +133 -0
  249. package/dist/cli/command-words.d.ts +0 -20
  250. package/dist/cli/command-words.d.ts.map +0 -1
  251. package/dist/cli/command-words.js +0 -51
  252. package/dist/cli/command-words.js.map +0 -1
  253. package/src/cli/command-words.ts +0 -56
@@ -1,4 +1,5 @@
1
1
  import { type FormEvent, useContext, useEffect, useState } from "react";
2
+ import { reasonMoment } from "../agent-state.js";
2
3
  import {
3
4
  hostOfLogin,
4
5
  isHandle,
@@ -9,7 +10,6 @@ import {
9
10
  type RestAgentInput,
10
11
  type RestAgentProposal,
11
12
  type RestPerson,
12
- type RestProject,
13
13
  type RestProvider,
14
14
  type RestWorkspace,
15
15
  usageStanding,
@@ -122,8 +122,9 @@ export interface AgentAccountListProps {
122
122
 
123
123
  /**
124
124
  * Agent accounts, a card each, for whoever looks after several: the picture, the name with the
125
- * handle and what it does, and across from them how it stands; then what it is doing now and
126
- * since when, what it runs, and whom it reports to where that is someone else. Rows of one
125
+ * handle and what it does, and across from them how it stands; then why it stands so, with
126
+ * when that was said where it is another moment than the state's, and under it the state with
127
+ * since when it stands; what it runs, and whom it reports to where that is someone else. Rows of one
127
128
  * shape, so that the cards read alike down a column. The whole card leads to the account's
128
129
  * page; what is kept of the account, the login it signs in with among it, is said there.
129
130
  */
@@ -144,6 +145,10 @@ export function AgentAccountList(props: AgentAccountListProps) {
144
145
  const invited = person.invited === true;
145
146
  const title = person.title ?? "";
146
147
  const state = agent.state ?? null;
148
+ // The reason has a moment of its own where it was said under a state that stayed; the
149
+ // state's moment is said with the state's word, so that neither reads as the other's.
150
+ const said = state === null ? undefined : reasonMoment(state);
151
+ const stood = state === null ? undefined : states.sinceAs(states[state.state]);
147
152
  const product = agent.runner?.product ?? null;
148
153
  const usage = usageStanding(agent.usage, props.now ?? Date.now());
149
154
  const model = agent.runner?.running?.model ?? agent.runner?.settings.model ?? null;
@@ -192,12 +197,21 @@ export function AgentAccountList(props: AgentAccountListProps) {
192
197
  ) : (
193
198
  <span className="sc-agent-card-now">
194
199
  {state.reason !== null && (
195
- <span>{reasons[state.reason] ?? state.reason}</span>
200
+ <span>
201
+ {reasons[state.reason] ?? state.reason}
202
+ {said !== undefined && (
203
+ <span className="sc-muted">
204
+ {states.reasonAt.before}
205
+ <Time iso={said} precision="clock" />
206
+ {states.reasonAt.after}
207
+ </span>
208
+ )}
209
+ </span>
196
210
  )}
197
211
  <span className="sc-muted">
198
- {states.since.before}
212
+ {stood?.before}
199
213
  <Time iso={state.since} precision="clock" />
200
- {states.since.after}
214
+ {stood?.after}
201
215
  {state.until !== undefined && state.until !== null && (
202
216
  <>
203
217
  {" · "}
@@ -363,8 +377,6 @@ export interface AgentAccountFormProps {
363
377
  readonly people: readonly RestPerson[];
364
378
  /** Whoever makes the account, who is its manager unless another is chosen. */
365
379
  readonly me?: RestPerson | undefined;
366
- /** The projects it may start in. */
367
- readonly projects: readonly RestProject[];
368
380
  readonly busy?: boolean | undefined;
369
381
  readonly error?: string | undefined;
370
382
  readonly onSubmit: (input: RestAgentInput) => void;
@@ -375,7 +387,8 @@ export interface AgentAccountFormProps {
375
387
  * "Add an agent account", in the three things it settles: who the account is, a persona chosen
376
388
  * among the proposals and edited; the account it signs in to this console with, at one of the
377
389
  * providers the deployment has, put together from the workspace's services and edited freely;
378
- * and whom it reports to and where it starts. The one thing the form has to get right is that
390
+ * and whom it reports to. It names no project (ADR-0181): an account is put in one later, as
391
+ * any member is. The one thing the form has to get right is that
379
392
  * login, so it says what kind of name it is and when the account has to be there: at a git host,
380
393
  * before the account is added, since a login nobody holds there is whoever registers it first.
381
394
  * Who makes the account at the provider is the organization's to say, and the form says nothing
@@ -400,7 +413,6 @@ export function AgentAccountForm(props: AgentAccountFormProps) {
400
413
  /** The login as typed; while nothing was typed, the one the handle and the provider suggest. */
401
414
  const [typedLogin, setTypedLogin] = useState<string | undefined>(undefined);
402
415
  const [manager, setManager] = useState<RestPerson | undefined>(props.me);
403
- const [project, setProject] = useState(props.projects[0]?.key ?? "");
404
416
  /** The login of the member whom the person said is to become the account, as it was then. */
405
417
  const [converting, setConverting] = useState<string | undefined>(undefined);
406
418
  const provider = props.providers.find((candidate) => candidate.key === host);
@@ -441,8 +453,7 @@ export function AgentAccountForm(props: AgentAccountFormProps) {
441
453
  handleOk &&
442
454
  loginOk &&
443
455
  (member === undefined || convert) &&
444
- manager !== undefined &&
445
- project !== "";
456
+ manager !== undefined;
446
457
  const submit = (event: FormEvent) => {
447
458
  event.preventDefault();
448
459
  if (!valid || host === undefined || manager === undefined) {
@@ -456,7 +467,6 @@ export function AgentAccountForm(props: AgentAccountFormProps) {
456
467
  ...(title.trim() === "" ? {} : { title: title.trim() }),
457
468
  ...(chosen === undefined ? {} : { avatarSeed: chosen.seed, avatarParts: chosen.avatarParts }),
458
469
  managerId: manager.id,
459
- project,
460
470
  ...(convert ? { convert: true } : {}),
461
471
  });
462
472
  };
@@ -618,30 +628,19 @@ export function AgentAccountForm(props: AgentAccountFormProps) {
618
628
  <span className="sc-field-label">{form.manager}</span>
619
629
  <Picker
620
630
  value={manager}
631
+ // An account is made with a manager (ADR-0084): another is chosen in the place of
632
+ // whoever stands there, and the form is never left with none.
633
+ required
621
634
  search={peopleSearch(props.people.filter((person) => person.status === "active"))}
622
635
  keyOf={(person) => person.id}
623
636
  render={(person) => <PersonChip person={person} />}
624
637
  renderOption={(person) => <PersonOption person={person} />}
625
638
  label={form.manager}
626
- placeholder={words.people.nobody}
639
+ placeholder={manager === undefined ? words.people.nobody : personName(manager)}
627
640
  disabled={props.busy === true}
628
641
  onChange={(person) => setManager(person)}
629
642
  />
630
643
  </div>
631
- <label className="sc-field">
632
- <span className="sc-field-label">{form.project}</span>
633
- <select
634
- className="sc-input"
635
- value={project}
636
- onChange={(event) => setProject(event.target.value)}
637
- >
638
- {props.projects.map((candidate) => (
639
- <option key={candidate.id} value={candidate.key}>
640
- {candidate.name}
641
- </option>
642
- ))}
643
- </select>
644
- </label>
645
644
  </div>
646
645
  <p className="sc-field-hint">{form.managerHint}</p>
647
646
  </section>
@@ -275,8 +275,8 @@ export function PeopleList(props: PeopleListProps) {
275
275
  <div className="sc-person-fact">
276
276
  <dt>{people.role}</dt>
277
277
  <dd>
278
- {/* An agent account is never an administrator (ADR-0084): its role is read. */}
279
- {props.onChangeRole === undefined || agent ? (
278
+ {/* An agent account's role is chosen as a person's is (ADR-0180). */}
279
+ {props.onChangeRole === undefined ? (
280
280
  <RoleBadge role={person.role} />
281
281
  ) : (
282
282
  <select
@@ -310,6 +310,9 @@ export function PeopleList(props: PeopleListProps) {
310
310
  <Picker
311
311
  className="sc-picker-quiet"
312
312
  value={manager}
313
+ // An agent account always has a manager (ADR-0084): another is chosen in the
314
+ // place of the one it has, and the field never asks the console for none.
315
+ required={agent}
313
316
  search={peopleSearch(
314
317
  props.people.filter(
315
318
  (candidate) =>
@@ -321,7 +324,8 @@ export function PeopleList(props: PeopleListProps) {
321
324
  render={(candidate) => <PersonChip person={candidate} />}
322
325
  renderOption={(candidate) => <PersonOption person={candidate} />}
323
326
  label={people.managerOf(name)}
324
- placeholder={people.nobody}
327
+ // Over a manager that stays unless another is chosen, the field names them.
328
+ placeholder={agent && manager !== undefined ? personName(manager) : people.nobody}
325
329
  disabled={busy}
326
330
  onChange={(candidate) => props.onChangeManager?.(person, candidate?.id ?? null)}
327
331
  />
@@ -14,7 +14,9 @@ import { cx } from "./ui.js";
14
14
  // part of, the goal it works towards. The picker asks for what the words typed find, a page at a
15
15
  // time, and never holds the listing: the first page as soon as the field is entered, the words'
16
16
  // page once the typing rests, the next page on a press. What is chosen stands in the field's
17
- // place, and a press clears it. Takes a search and nothing else from the network.
17
+ // place, and a press clears it; where something must always be chosen, the press opens the
18
+ // field over it and what stood stands again unless another is chosen. Takes a search and
19
+ // nothing else from the network.
18
20
 
19
21
  /** How many items one page of a picker holds: enough to find the one meant, few enough to read at a glance. */
20
22
  export const PICKER_PAGE_LIMIT = 10;
@@ -50,9 +52,31 @@ export function opensAbove(
50
52
  return listHeight > below && over > below;
51
53
  }
52
54
 
55
+ /**
56
+ * What the press on a chosen value's button does. It clears a value that may be none. One that
57
+ * is required is never cleared, so the press opens the field in its place and saves nothing:
58
+ * another is chosen there, and the one that stood stands again where the field is left with
59
+ * nothing chosen. A press that saved "none" first would be refused by whatever requires the
60
+ * value, and the field to choose another in would never open.
61
+ */
62
+ export function pressOnChosen(required: boolean | undefined): "clear" | "replace" {
63
+ return required === true ? "replace" : "clear";
64
+ }
65
+
66
+ /** Whether choosing `next` in the place of `current` is a change to save: what stands already is none. */
67
+ export function savesChoice(current: string | undefined, next: string): boolean {
68
+ return current !== next;
69
+ }
70
+
53
71
  export interface PickerProps<T> {
54
72
  /** What is chosen, if anything. */
55
73
  readonly value: T | undefined;
74
+ /**
75
+ * Whether something is always chosen once something is, as an agent account's manager is:
76
+ * the press on it then changes it and never clears it (`pressOnChosen`). A value that is
77
+ * not there yet is chosen as any other.
78
+ */
79
+ readonly required?: boolean | undefined;
56
80
  /** What stands for a choice made but not read back yet: shown in the chip's place, and cleared as one. */
57
81
  readonly held?: ReactNode | undefined;
58
82
  readonly search: PickerSearch<T>;
@@ -88,8 +112,14 @@ export function Picker<T>(props: PickerProps<T>) {
88
112
  const [loading, setLoading] = useState(false);
89
113
  const [active, setActive] = useState(-1);
90
114
  const [above, setAbove] = useState(false);
115
+ // Whether the field stands over what is chosen, for another to be chosen in its place.
116
+ const [replacing, setReplacing] = useState(false);
91
117
  const field = useRef<HTMLInputElement>(null);
92
118
  const list = useRef<HTMLDivElement>(null);
119
+ const press = useRef<HTMLButtonElement>(null);
120
+ // Whether the chip's button takes the focus back once the chip stands again: after a choice
121
+ // or Escape, which the keyboard goes on from, and not where the focus moved on by itself.
122
+ const back = useRef(false);
93
123
  // The search and the exclusion as the page last gave them, read at the moment of a request,
94
124
  // so that a page rendering again starts no search over.
95
125
  const search = useRef(props.search);
@@ -180,7 +210,37 @@ export function Picker<T>(props: PickerProps<T>) {
180
210
  });
181
211
  };
182
212
 
213
+ // The field takes the focus as it opens over what is chosen; the chip's button takes it back
214
+ // when the chip stands again after a choice or Escape.
215
+ useEffect(() => {
216
+ if (replacing) {
217
+ field.current?.focus();
218
+ } else if (back.current) {
219
+ back.current = false;
220
+ press.current?.focus();
221
+ }
222
+ }, [replacing]);
223
+
224
+ /** The field over what is chosen is left: what stood stands again, unless another was chosen. */
225
+ const leave = (toButton: boolean) => {
226
+ back.current = toButton;
227
+ setReplacing(false);
228
+ setQuery("");
229
+ setOpen(false);
230
+ // The field opens again at once on the next press, over the list it last held: no option
231
+ // of that list is the one the keyboard goes on from.
232
+ setActive(-1);
233
+ };
234
+
183
235
  const choose = (item: T) => {
236
+ if (replacing) {
237
+ const current = props.value === undefined ? undefined : props.keyOf(props.value);
238
+ if (savesChoice(current, props.keyOf(item))) {
239
+ props.onChange(item);
240
+ }
241
+ leave(true);
242
+ return;
243
+ }
184
244
  props.onChange(item);
185
245
  setQuery("");
186
246
  setOpen(false);
@@ -206,24 +266,30 @@ export function Picker<T>(props: PickerProps<T>) {
206
266
  if (chosen !== undefined) {
207
267
  choose(chosen);
208
268
  }
269
+ } else if (event.key === "Escape" && replacing) {
270
+ // Nothing was chosen in the place of what stood: it stands again.
271
+ event.preventDefault();
272
+ leave(true);
209
273
  } else if (event.key === "Escape" && open) {
210
274
  event.preventDefault();
211
275
  setOpen(false);
212
276
  }
213
277
  };
214
278
 
215
- if (props.value !== undefined || props.held !== undefined) {
279
+ if ((props.value !== undefined || props.held !== undefined) && !replacing) {
280
+ const replaces = pressOnChosen(props.required) === "replace";
216
281
  return (
217
282
  <div className={cx("sc-picker", "sc-picker-chosen", props.className)}>
218
283
  <span className="sc-picker-value">
219
284
  {props.value === undefined ? props.held : props.render(props.value)}
220
285
  </span>
221
286
  <button
287
+ ref={press}
222
288
  type="button"
223
289
  className="sc-picker-clear"
224
- aria-label={words.remove}
290
+ aria-label={replaces ? words.change : words.remove}
225
291
  disabled={props.disabled}
226
- onClick={() => props.onChange(undefined)}
292
+ onClick={() => (replaces ? setReplacing(true) : props.onChange(undefined))}
227
293
  >
228
294
  <span aria-hidden="true">&times;</span>
229
295
  </button>
@@ -253,7 +319,15 @@ export function Picker<T>(props: PickerProps<T>) {
253
319
  setOpen(true);
254
320
  }}
255
321
  onFocus={() => setOpen(true)}
256
- onBlur={() => setOpen(false)}
322
+ onBlur={() => {
323
+ setOpen(false);
324
+ // The focus moved on with nothing chosen in the place of what stood: it stands again.
325
+ // Not where a choice or Escape already left the field, which a browser may tell of
326
+ // as the field goes.
327
+ if (replacing && !back.current) {
328
+ leave(false);
329
+ }
330
+ }}
257
331
  onKeyDown={onKeyDown}
258
332
  />
259
333
  {open && (
package/src/console.tsx CHANGED
@@ -3268,7 +3268,6 @@ function NewAgentPage(props: {
3268
3268
  workspace={data.me?.workspace}
3269
3269
  people={data.people}
3270
3270
  me={me}
3271
- projects={data.projects}
3272
3271
  busy={busy}
3273
3272
  error={error}
3274
3273
  onSubmit={(input) =>
@@ -3586,6 +3585,7 @@ function WorkspacePage(props: {
3586
3585
  client={client}
3587
3586
  viaToken={holdsToken(data)}
3588
3587
  providers={data.me?.signIn}
3588
+ me={data.me?.person?.id}
3589
3589
  work={(agent) => (
3590
3590
  <AgentWork agent={agent} data={data} components={components} week={route.week} />
3591
3591
  )}
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);
@@ -99,7 +106,13 @@ function sentenceOf(event: RestEvent, words: Messages): string {
99
106
  : data.state === "unheard"
100
107
  ? feed.event.agentUnheard(agent)
101
108
  : feed.event.agentRunning(agent);
102
- 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}`;
103
116
  }
104
117
  case "team.created":
105
118
  return feed.event.teamCreated(data.team ?? feed.aTeam);
package/src/i18n/en.ts CHANGED
@@ -97,6 +97,7 @@ export const en = {
97
97
  cancel: "Cancel",
98
98
  save: "Save",
99
99
  remove: "Remove",
100
+ change: "Change",
100
101
  edit: "Edit",
101
102
  done: "Done",
102
103
  loading: "Loading",
@@ -219,8 +220,7 @@ export const en = {
219
220
  "team.not_a_member": "The person is not in the team.",
220
221
  "person.invalid_manager":
221
222
  "A manager must be another active person, and not one of this person's own team.",
222
- "person.last_admin": "The workspace needs at least one administrator.",
223
- "person.agent_admin": "An agent account is never an administrator.",
223
+ "person.last_admin": "The workspace needs at least one administrator who is a person.",
224
224
  "person.manager_required":
225
225
  "An agent account always has a manager. Name another; the manager is never taken away.",
226
226
  "agent.too_many_accounts": "The account records as many accounts held elsewhere as one may.",
@@ -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.",
@@ -254,14 +260,15 @@ export const en = {
254
260
  "agent.not_found": "The agent account was not found.",
255
261
  "agent.handle_taken": "Another agent account has this handle.",
256
262
  "agent.exists": "This login is an agent account already.",
257
- "agent.administrator":
258
- "An administrator is not made an agent account. Make them a member first.",
259
263
  "agent.login_is_member":
260
264
  "A member signs in with this login already. Nothing was changed: write the login of the agent's own account, or say that this member is to become the agent account.",
261
265
  "agent.invalid_manager":
262
266
  "A manager must be another active member, and not one who reports to this account.",
263
- "agent.invalid_project": "The project it starts in was not found.",
264
267
  "agent.unknown_host": "Nobody signs in through that provider here.",
268
+ "note.closed": "The note is closed already.",
269
+ "note.not_found": "The note was not found.",
270
+ "note.too_many":
271
+ "You have as many notes open on the skills as one may, or left as many within the hour. Whoever keeps the skills closes some first, and an hour passes by itself.",
265
272
  "person.not_found": "The person was not found.",
266
273
  "person.of_organization": "The organization decides who is in. This can't be changed here.",
267
274
  "picture.refused": "This picture can't be shown.",
@@ -312,6 +319,7 @@ export const en = {
312
319
  "token.not_found": "The token was not found.",
313
320
  "session.not_found": "The session was not found.",
314
321
  "token.too_many": "You have as many tokens as you can hold. Remove one first.",
322
+ "workspace.keeper_not_found": "Nobody who is in has that id: the skills are kept by a member.",
315
323
  "workspace.pack_connect_refused": "SkillCDN refused the connection.",
316
324
  "workspace.pack_connect_unsupported": "This console can't connect a pack.",
317
325
  "workspace.identity_unavailable":
@@ -2072,6 +2080,38 @@ export const en = {
2072
2080
  title: "No such agent account",
2073
2081
  body: "It is not there, or it is not yours to see.",
2074
2082
  },
2083
+ offers: {
2084
+ title: "Offered secrets",
2085
+ offerTitle: "Offer a secret",
2086
+ offerAria: "Offer a secret",
2087
+ intro: (name: string, days: number) =>
2088
+ `${name} is told, and takes it or leaves it. The value is typed here once, or taken from a file's text, and shown to nobody; an offer not taken is gone after ${days} days.`,
2089
+ waits: (name: string) => `${name} takes each or leaves it. Never a value.`,
2090
+ own: "Take one or leave one with your command: console secrets --offered",
2091
+ name: "Name",
2092
+ namePlaceholder: "mail.password",
2093
+ value: "Value",
2094
+ note: "What it is for",
2095
+ offer: "Offer",
2096
+ someone: "Someone who is gone",
2097
+ takenAs: (name: string) => `as ${name}`,
2098
+ state: { waiting: "Waiting", taken: "Taken", left: "Left", lapsed: "Ran out" },
2099
+ },
2100
+ /** A secret's value taken from a file a person chose, and the day it ends on (ADR-0184). */
2101
+ secretFile: {
2102
+ choose: "Choose a file",
2103
+ remove: (name: string) => `Take ${name} out`,
2104
+ /** When the value itself ends, a token made for a time say: never, unless a day is chosen. */
2105
+ ends: "Value ends",
2106
+ endsNever: "Never",
2107
+ endsOnDay: "On a day",
2108
+ expiresOn: "Ends on",
2109
+ tooLarge: (most: string) =>
2110
+ `The file's text is longer than a secret's value may be: ${most} at the most.`,
2111
+ notText: "The file is no text. A secret's value is text, as a .env file's is.",
2112
+ empty: "The file holds nothing.",
2113
+ unread: "The file could not be read here. Choose it again.",
2114
+ },
2075
2115
  notSupervised: {
2076
2116
  title: "For its supervisors",
2077
2117
  body: "What an agent is doing is read by whom it reports to, those above them, and the administrators.",
@@ -2084,8 +2124,15 @@ export const en = {
2084
2124
  refused: "Refused",
2085
2125
  failed: "Failed",
2086
2126
  unheard: "Not heard from",
2087
- /** What stands before and after the moment a state began: "since 14:02". */
2127
+ /** What stands before and after the moment a state began, beside the state's badge: "since 14:02". */
2088
2128
  since: { before: "since ", after: "" },
2129
+ /**
2130
+ * The same where no badge stands beside the moment, with the state's own word, so that
2131
+ * the moment reads as the state's and not the reason's: "running since 14:02".
2132
+ */
2133
+ sinceAs: (state: string) => ({ before: `${state.toLowerCase()} since `, after: "" }),
2134
+ /** What stands before and after the moment a reason was said, after the reason: "a turn completed (14:02)". */
2135
+ reasonAt: { before: " (", after: ")" },
2089
2136
  /** What stands before and after the moment a state ends by itself, as when a usage limit resets: "until 03:30". */
2090
2137
  until: { before: "until ", after: "" },
2091
2138
  heard: "runner last heard from",
@@ -2276,7 +2323,6 @@ export const en = {
2276
2323
  user: "OS account",
2277
2324
  version: "Runner",
2278
2325
  product: "Product",
2279
- untried: "a version the driver was not tried with",
2280
2326
  signals: "Signals",
2281
2327
  delivered: (delivered: number, latest: number) => `${delivered} of ${latest} delivered`,
2282
2328
  sources: "Wake sources",
@@ -2313,7 +2359,7 @@ export const en = {
2313
2359
  secrets: {
2314
2360
  title: "Secrets",
2315
2361
  intro:
2316
- "By name. A value is typed here once and never shown again: only the account reads it back.",
2362
+ "By name. A value is typed here once, or taken from a file's text, and never shown again: only the account reads it back.",
2317
2363
  empty: "No secret is kept yet.",
2318
2364
  seedAria: "Seed a secret",
2319
2365
  seeded: "seeded by a supervisor",
@@ -2437,15 +2483,22 @@ export const en = {
2437
2483
  },
2438
2484
  loginDerived:
2439
2485
  "Put together from the workspace's services; change it where the account is called otherwise.",
2440
- reports: "Whom it reports to, and where it starts",
2486
+ reports: "Whom it reports to",
2441
2487
  next: "Next, on its page: an invitation that leads a machine to it.",
2442
2488
  manager: "Manager",
2443
2489
  managerHint:
2444
- "Its manager is whom it turns to first and who answers for it; an administrator names another at any time. It starts in the project chosen, as a member.",
2445
- project: "Starts in",
2490
+ "Its manager is whom it turns to first and who answers for it; an administrator names another at any time. A private project adds it as it adds any member.",
2446
2491
  submit: "Add the agent account",
2447
2492
  },
2448
2493
  },
2494
+ // What an agent account's status says at a messenger while it works (ADR-0170): the
2495
+ // runner's words, shown there and on no page. `{time}` stands for the moment it is back.
2496
+ status: {
2497
+ thinking: "Thinking",
2498
+ working: "Working · a bit slow to reply",
2499
+ limited: "Recharging",
2500
+ back: "back at {time}",
2501
+ },
2449
2502
  },
2450
2503
 
2451
2504
  sessions: {