@skillcdn/console 0.6.3 → 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 (191) hide show
  1. package/README.md +6 -6
  2. package/dist/agent-page.d.ts.map +1 -1
  3. package/dist/agent-page.js +7 -3
  4. package/dist/agent-page.js.map +1 -1
  5. package/dist/api.d.ts +5 -4
  6. package/dist/api.d.ts.map +1 -1
  7. package/dist/api.js +5 -4
  8. package/dist/api.js.map +1 -1
  9. package/dist/cli/cli.d.ts.map +1 -1
  10. package/dist/cli/cli.js +660 -138
  11. package/dist/cli/cli.js.map +1 -1
  12. package/dist/cli/format.d.ts +32 -4
  13. package/dist/cli/format.d.ts.map +1 -1
  14. package/dist/cli/format.js +125 -4
  15. package/dist/cli/format.js.map +1 -1
  16. package/dist/cli/help.d.ts.map +1 -1
  17. package/dist/cli/help.js +91 -29
  18. package/dist/cli/help.js.map +1 -1
  19. package/dist/cli/pack.d.ts +11 -10
  20. package/dist/cli/pack.d.ts.map +1 -1
  21. package/dist/cli/pack.js +27 -41
  22. package/dist/cli/pack.js.map +1 -1
  23. package/dist/cli/plugin-cli.d.ts.map +1 -1
  24. package/dist/cli/plugin-cli.js +8 -5
  25. package/dist/cli/plugin-cli.js.map +1 -1
  26. package/dist/cli/runner-files.d.ts.map +1 -1
  27. package/dist/cli/runner-files.js +15 -0
  28. package/dist/cli/runner-files.js.map +1 -1
  29. package/dist/cli/skill-path.d.ts +11 -0
  30. package/dist/cli/skill-path.d.ts.map +1 -0
  31. package/dist/cli/skill-path.js +44 -0
  32. package/dist/cli/skill-path.js.map +1 -0
  33. package/dist/client.d.ts +17 -1
  34. package/dist/client.d.ts.map +1 -1
  35. package/dist/client.js +10 -1
  36. package/dist/client.js.map +1 -1
  37. package/dist/components/agent-page.d.ts +67 -5
  38. package/dist/components/agent-page.d.ts.map +1 -1
  39. package/dist/components/agent-page.js +161 -14
  40. package/dist/components/agent-page.js.map +1 -1
  41. package/dist/components/agents.d.ts +3 -4
  42. package/dist/components/agents.d.ts.map +1 -1
  43. package/dist/components/agents.js +7 -6
  44. package/dist/components/agents.js.map +1 -1
  45. package/dist/components/people.d.ts.map +1 -1
  46. package/dist/components/people.js +7 -2
  47. package/dist/components/people.js.map +1 -1
  48. package/dist/components/picker.d.ts +16 -0
  49. package/dist/components/picker.d.ts.map +1 -1
  50. package/dist/components/picker.js +69 -4
  51. package/dist/components/picker.js.map +1 -1
  52. package/dist/console.css +40 -0
  53. package/dist/console.d.ts.map +1 -1
  54. package/dist/console.js +1 -1
  55. package/dist/console.js.map +1 -1
  56. package/dist/i18n/en.d.ts +19 -5
  57. package/dist/i18n/en.d.ts.map +1 -1
  58. package/dist/i18n/en.js +26 -12
  59. package/dist/i18n/en.js.map +1 -1
  60. package/dist/i18n/ko.d.ts.map +1 -1
  61. package/dist/i18n/ko.js +22 -10
  62. package/dist/i18n/ko.js.map +1 -1
  63. package/dist/limits.d.ts +16 -0
  64. package/dist/limits.d.ts.map +1 -1
  65. package/dist/limits.js +16 -0
  66. package/dist/limits.js.map +1 -1
  67. package/dist/onboarding.d.ts +18 -6
  68. package/dist/onboarding.d.ts.map +1 -1
  69. package/dist/onboarding.js +42 -7
  70. package/dist/onboarding.js.map +1 -1
  71. package/dist/plugin/args.d.ts +24 -2
  72. package/dist/plugin/args.d.ts.map +1 -1
  73. package/dist/plugin/args.js +20 -2
  74. package/dist/plugin/args.js.map +1 -1
  75. package/dist/plugin/define.d.ts.map +1 -1
  76. package/dist/plugin/define.js +12 -3
  77. package/dist/plugin/define.js.map +1 -1
  78. package/dist/plugin/rest-schemas.d.ts +2 -0
  79. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  80. package/dist/plugin/rest-schemas.js +1 -0
  81. package/dist/plugin/rest-schemas.js.map +1 -1
  82. package/dist/routes.d.ts +2 -0
  83. package/dist/routes.d.ts.map +1 -1
  84. package/dist/routes.js +2 -0
  85. package/dist/routes.js.map +1 -1
  86. package/dist/rules.d.ts +4 -1
  87. package/dist/rules.d.ts.map +1 -1
  88. package/dist/rules.js +5 -2
  89. package/dist/rules.js.map +1 -1
  90. package/dist/runner/claude.d.ts.map +1 -1
  91. package/dist/runner/claude.js +48 -0
  92. package/dist/runner/claude.js.map +1 -1
  93. package/dist/runner/codex.d.ts.map +1 -1
  94. package/dist/runner/codex.js +4 -1
  95. package/dist/runner/codex.js.map +1 -1
  96. package/dist/runner/desk.d.ts.map +1 -1
  97. package/dist/runner/desk.js +5 -4
  98. package/dist/runner/desk.js.map +1 -1
  99. package/dist/runner/runner.d.ts +16 -0
  100. package/dist/runner/runner.d.ts.map +1 -1
  101. package/dist/runner/runner.js +157 -8
  102. package/dist/runner/runner.js.map +1 -1
  103. package/dist/runner/slack.d.ts.map +1 -1
  104. package/dist/runner/slack.js +14 -3
  105. package/dist/runner/slack.js.map +1 -1
  106. package/dist/runner/types.d.ts +19 -0
  107. package/dist/runner/types.d.ts.map +1 -1
  108. package/dist/runner/types.js.map +1 -1
  109. package/dist/schemas.d.ts +475 -5
  110. package/dist/schemas.d.ts.map +1 -1
  111. package/dist/schemas.js +117 -12
  112. package/dist/schemas.js.map +1 -1
  113. package/dist/secret-file.d.ts +21 -0
  114. package/dist/secret-file.d.ts.map +1 -0
  115. package/dist/secret-file.js +59 -0
  116. package/dist/secret-file.js.map +1 -0
  117. package/dist/services.d.ts.map +1 -1
  118. package/dist/services.js +3 -2
  119. package/dist/services.js.map +1 -1
  120. package/dist/setup-guide.d.ts +2 -2
  121. package/dist/setup-guide.d.ts.map +1 -1
  122. package/dist/setup-guide.js +6 -5
  123. package/dist/setup-guide.js.map +1 -1
  124. package/dist/vocabulary.d.ts +10 -2
  125. package/dist/vocabulary.d.ts.map +1 -1
  126. package/dist/vocabulary.js +9 -2
  127. package/dist/vocabulary.js.map +1 -1
  128. package/docs/specs/cli.md +22 -16
  129. package/docs/specs/plugins.md +5 -4
  130. package/docs/specs/rest.md +24 -12
  131. package/docs/specs/runner.md +19 -12
  132. package/docs/start.md +4 -3
  133. package/package.json +3 -3
  134. package/skills/building-a-plugin/SKILL.md +2 -2
  135. package/skills/keeping-the-pack/SKILL.md +87 -0
  136. package/skills/planning-the-board/SKILL.md +6 -6
  137. package/skills/planning-the-board/references/a-task.md +1 -1
  138. package/skills/planning-the-board/references/setting-up.md +9 -5
  139. package/skills/running-an-agent/SKILL.md +15 -14
  140. package/skills/running-an-agent/references/preparing-the-machine.md +3 -2
  141. package/skills/running-an-agent/references/several-tasks.md +8 -2
  142. package/skills/running-an-agent/references/slack-app.md +10 -4
  143. package/skills/running-an-agent/references/the-account-and-the-invitation.md +1 -1
  144. package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -1
  145. package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +3 -3
  146. package/skills/running-an-agent/references/your-first-task.md +4 -3
  147. package/skills/working-the-board/SKILL.md +4 -4
  148. package/skills/working-the-board/references/terms.md +3 -1
  149. package/skills/working-the-board/references/the-pack.md +12 -5
  150. package/src/agent-page.tsx +19 -3
  151. package/src/api.ts +27 -0
  152. package/src/cli/cli.ts +847 -192
  153. package/src/cli/format.ts +158 -4
  154. package/src/cli/help.ts +102 -28
  155. package/src/cli/pack.ts +49 -58
  156. package/src/cli/plugin-cli.ts +8 -5
  157. package/src/cli/runner-files.ts +17 -0
  158. package/src/cli/skill-path.ts +51 -0
  159. package/src/client.ts +50 -0
  160. package/src/components/agent-page.tsx +309 -30
  161. package/src/components/agents.tsx +7 -23
  162. package/src/components/people.tsx +7 -3
  163. package/src/components/picker.tsx +79 -5
  164. package/src/console.tsx +0 -1
  165. package/src/i18n/en.ts +28 -13
  166. package/src/i18n/ko.ts +24 -10
  167. package/src/limits.ts +16 -0
  168. package/src/onboarding.ts +60 -21
  169. package/src/plugin/args.ts +29 -3
  170. package/src/plugin/define.ts +18 -3
  171. package/src/plugin/rest-schemas.ts +3 -0
  172. package/src/routes.ts +2 -0
  173. package/src/rules.ts +5 -2
  174. package/src/runner/claude.ts +53 -0
  175. package/src/runner/codex.ts +4 -1
  176. package/src/runner/desk.ts +5 -4
  177. package/src/runner/runner.ts +199 -9
  178. package/src/runner/slack.ts +18 -7
  179. package/src/runner/types.ts +16 -0
  180. package/src/schemas.ts +148 -10
  181. package/src/secret-file.ts +76 -0
  182. package/src/services.ts +3 -2
  183. package/src/setup-guide.ts +6 -5
  184. package/src/styles/README.md +1 -1
  185. package/src/styles/pages/agents.css +40 -0
  186. package/src/vocabulary.ts +12 -2
  187. package/dist/cli/command-words.d.ts +0 -20
  188. package/dist/cli/command-words.d.ts.map +0 -1
  189. package/dist/cli/command-words.js +0 -51
  190. package/dist/cli/command-words.js.map +0 -1
  191. package/src/cli/command-words.ts +0 -56
@@ -14,8 +14,10 @@ import {
14
14
  type AgentState,
15
15
  type FileUpload,
16
16
  isSecretName,
17
+ MAX_AGENT_SECRET_BYTES,
17
18
  MAX_AGENT_SECRET_NAME_LENGTH,
18
19
  MAX_FILE_BYTES,
20
+ MAX_SECRET_FILE_BYTES,
19
21
  MAX_SECRET_OFFER_NOTE_LENGTH,
20
22
  MAX_SIGNAL_ATTACHMENTS,
21
23
  MAX_SIGNAL_LENGTH,
@@ -29,6 +31,8 @@ import {
29
31
  type RestSignal,
30
32
  type RestTranscriptEvent,
31
33
  SECRET_OFFER_DAYS,
34
+ type SecretFileRefusal,
35
+ secretOfFile,
32
36
  usageNear,
33
37
  usageSaidTogether,
34
38
  usedHundredths,
@@ -2552,7 +2556,6 @@ export function AgentRunnerFacts(props: { readonly runner: RestAgentRunner | nul
2552
2556
  <span key="product" className="sc-agent-product">
2553
2557
  {runner.product.name}
2554
2558
  {runner.product.version !== null && ` ${runner.product.version}`}
2555
- {!runner.product.tried && <Badge tone="warning">{words.untried}</Badge>}
2556
2559
  </span>,
2557
2560
  ],
2558
2561
  ] as [string, ReactNode][])),
@@ -2669,6 +2672,238 @@ export function AgentSecretOfferList(props: AgentSecretOfferListProps) {
2669
2672
  );
2670
2673
  }
2671
2674
 
2675
+ /** A file chosen as a secret's value: what it is called and how large it is, to show, and its text, to send. */
2676
+ interface ChosenSecret {
2677
+ readonly name: string;
2678
+ readonly bytes: number;
2679
+ readonly value: string;
2680
+ }
2681
+
2682
+ /** Why a file a person chose stands for no value: what the file is, or that it could not be read here. */
2683
+ type SecretFileProblem = SecretFileRefusal | "unread";
2684
+
2685
+ /**
2686
+ * The value of a secret on a form of the page (ADR-0184): typed unseen, or the text of a file
2687
+ * the person chose, a `.env` of several lines among them, as the command takes one with
2688
+ * `--file`. The file is read here, as bytes, and what it comes to is held until the form is sent
2689
+ * or the file taken out; one that is no value, too large, no text or empty, is refused with why
2690
+ * and nothing of it is kept. What was typed and what a file holds are never both the value.
2691
+ */
2692
+ function useSecretValue() {
2693
+ const [typed, setTyped] = useState("");
2694
+ const [chosen, setChosen] = useState<ChosenSecret>();
2695
+ const [problem, setProblem] = useState<SecretFileProblem>();
2696
+ /** The file asked for last: one chosen after another is the one that stands, whichever is read first. */
2697
+ const asked = useRef(0);
2698
+ const refuse = (why: SecretFileProblem) => {
2699
+ setChosen(undefined);
2700
+ setProblem(why);
2701
+ };
2702
+ const choose = (file: File | undefined) => {
2703
+ if (file === undefined) {
2704
+ return;
2705
+ }
2706
+ asked.current += 1;
2707
+ const mine = asked.current;
2708
+ setProblem(undefined);
2709
+ // A file past what a value may ever be is refused by its size, unread.
2710
+ if (file.size > MAX_SECRET_FILE_BYTES) {
2711
+ refuse("too_large");
2712
+ return;
2713
+ }
2714
+ if (typeof FileReader === "undefined") {
2715
+ refuse("unread");
2716
+ return;
2717
+ }
2718
+ const reader = new FileReader();
2719
+ reader.onload = () => {
2720
+ if (mine !== asked.current) {
2721
+ return;
2722
+ }
2723
+ const read = reader.result;
2724
+ if (!(read instanceof ArrayBuffer)) {
2725
+ refuse("unread");
2726
+ return;
2727
+ }
2728
+ const found = secretOfFile(new Uint8Array(read));
2729
+ if ("refused" in found) {
2730
+ refuse(found.refused);
2731
+ return;
2732
+ }
2733
+ setTyped("");
2734
+ setChosen({ name: file.name, bytes: file.size, value: found.value });
2735
+ };
2736
+ reader.onerror = () => {
2737
+ if (mine === asked.current) {
2738
+ refuse("unread");
2739
+ }
2740
+ };
2741
+ reader.readAsArrayBuffer(file);
2742
+ };
2743
+ return {
2744
+ /** The value as it would be sent: the file's text where one is chosen, else what was typed. */
2745
+ value: chosen?.value ?? typed,
2746
+ typed,
2747
+ chosen,
2748
+ problem,
2749
+ type: (value: string) => {
2750
+ setTyped(value);
2751
+ setProblem(undefined);
2752
+ },
2753
+ choose,
2754
+ /** Takes the file out, or empties the form once it was sent. */
2755
+ clear: () => {
2756
+ asked.current += 1;
2757
+ setTyped("");
2758
+ setChosen(undefined);
2759
+ setProblem(undefined);
2760
+ },
2761
+ };
2762
+ }
2763
+
2764
+ export interface SecretValueInputProps {
2765
+ /** What the field is called, for whoever does not see it. */
2766
+ readonly label: string;
2767
+ readonly placeholder?: string | undefined;
2768
+ /** What was typed, shown as dots. */
2769
+ readonly typed: string;
2770
+ /** The file chosen in the place of what is typed: its name and how large it is, and never its text. */
2771
+ readonly chosen: { readonly name: string; readonly bytes: number } | undefined;
2772
+ readonly disabled?: boolean | undefined;
2773
+ readonly onType: (value: string) => void;
2774
+ /** Takes the chosen file out, and the field is typed into again. */
2775
+ readonly onClear: () => void;
2776
+ }
2777
+
2778
+ /**
2779
+ * Where a secret's value stands on a form: a field typed unseen, or, once a file was chosen,
2780
+ * the file by its name with the way to take it out. A file's name is text a person brought, and
2781
+ * is drawn as text.
2782
+ */
2783
+ export function SecretValueInput(props: SecretValueInputProps) {
2784
+ const words = useWords().agents.page.secretFile;
2785
+ const { chosen } = props;
2786
+ if (chosen === undefined) {
2787
+ return (
2788
+ <input
2789
+ className="sc-input"
2790
+ type="password"
2791
+ aria-label={props.label}
2792
+ placeholder={props.placeholder}
2793
+ value={props.typed}
2794
+ autoComplete="new-password"
2795
+ disabled={props.disabled}
2796
+ onChange={(event) => props.onType(event.target.value)}
2797
+ />
2798
+ );
2799
+ }
2800
+ return (
2801
+ <ul className="sc-chosen-files" aria-label={props.label}>
2802
+ <li className="sc-chosen-file sc-agent-secret-file">
2803
+ <span className="sc-agent-secret-file-name">{chosen.name}</span>{" "}
2804
+ <span className="sc-muted">{formatBytes(chosen.bytes)}</span>{" "}
2805
+ <Button
2806
+ variant="ghost"
2807
+ size="sm"
2808
+ aria-label={words.remove(chosen.name)}
2809
+ disabled={props.disabled}
2810
+ onClick={props.onClear}
2811
+ >
2812
+ ×
2813
+ </Button>
2814
+ </li>
2815
+ </ul>
2816
+ );
2817
+ }
2818
+
2819
+ export interface SecretValueMoreProps {
2820
+ readonly disabled?: boolean | undefined;
2821
+ /** Called with the file a person chose as the value. */
2822
+ readonly onChoose: (file: File | undefined) => void;
2823
+ /**
2824
+ * The day the value ends on: `null` where it ends on none, which is how a form begins; else
2825
+ * what the date field gives, empty until a day is entered.
2826
+ */
2827
+ readonly expiresOn: string | null;
2828
+ readonly onExpiresOn: (day: string | null) => void;
2829
+ }
2830
+
2831
+ /**
2832
+ * Under a secret's fields, what the command says with flags (ADR-0184): the way to choose a
2833
+ * file as the value (`--file`), and the day the value ends on (`--expires`), which a token made
2834
+ * for a time has and most secrets have not. So that it ends on no day is what stands chosen, in
2835
+ * words, and the day's field is there only once a person says the value has one: an empty date
2836
+ * field said nothing of what leaving it empty means. The day is the value's own, never an
2837
+ * offer's, which waits its days whatever is said here.
2838
+ */
2839
+ export function SecretValueMore(props: SecretValueMoreProps) {
2840
+ const words = useWords().agents.page.secretFile;
2841
+ const dated = props.expiresOn !== null;
2842
+ return (
2843
+ <div className="sc-agent-secret-more">
2844
+ <label className="sc-button sc-button-ghost sc-button-sm sc-file-choice">
2845
+ {words.choose}
2846
+ <input
2847
+ className="sc-file-input"
2848
+ type="file"
2849
+ disabled={props.disabled}
2850
+ onChange={(event) => {
2851
+ props.onChoose(event.target.files?.[0]);
2852
+ // The box is emptied, so that a file taken out can be chosen again.
2853
+ event.target.value = "";
2854
+ }}
2855
+ />
2856
+ </label>
2857
+ <label className="sc-field sc-field-inline">
2858
+ <span className="sc-field-label">{words.ends}</span>
2859
+ <select
2860
+ className="sc-input"
2861
+ value={dated ? "day" : "none"}
2862
+ disabled={props.disabled}
2863
+ onChange={(event) => props.onExpiresOn(event.target.value === "day" ? "" : null)}
2864
+ >
2865
+ <option value="none">{words.endsNever}</option>
2866
+ <option value="day">{words.endsOnDay}</option>
2867
+ </select>
2868
+ </label>
2869
+ {dated && (
2870
+ <label className="sc-field sc-field-inline">
2871
+ <span className="sc-field-label">{words.expiresOn}</span>
2872
+ <input
2873
+ className="sc-input"
2874
+ type="date"
2875
+ // A day was asked for: the form is not sent without one, or the value would be kept
2876
+ // as one that never ends.
2877
+ required
2878
+ value={props.expiresOn ?? ""}
2879
+ disabled={props.disabled}
2880
+ onChange={(event) => props.onExpiresOn(event.target.value)}
2881
+ />
2882
+ </label>
2883
+ )}
2884
+ </div>
2885
+ );
2886
+ }
2887
+
2888
+ /** Why a chosen file stands for no value, as a line under the form. Nothing of the file but that. */
2889
+ export function SecretFileProblemLine(props: { readonly problem: SecretFileProblem | undefined }) {
2890
+ const words = useWords().agents.page.secretFile;
2891
+ if (props.problem === undefined) {
2892
+ return null;
2893
+ }
2894
+ return (
2895
+ <p className="sc-form-error" role="alert">
2896
+ {props.problem === "too_large"
2897
+ ? words.tooLarge(formatBytes(MAX_AGENT_SECRET_BYTES))
2898
+ : props.problem === "not_text"
2899
+ ? words.notText
2900
+ : props.problem === "empty"
2901
+ ? words.empty
2902
+ : words.unread}
2903
+ </p>
2904
+ );
2905
+ }
2906
+
2672
2907
  export interface AgentSecretOfferFormProps {
2673
2908
  /** What the account is called, for the line that says what becomes of an offer. */
2674
2909
  readonly account: string;
@@ -2678,17 +2913,24 @@ export interface AgentSecretOfferFormProps {
2678
2913
  readonly name: string;
2679
2914
  readonly value: string;
2680
2915
  readonly note: string | undefined;
2916
+ /** The day the value ends on, where one was said. */
2917
+ readonly expiresOn: string | undefined;
2681
2918
  }) => void;
2682
2919
  }
2683
2920
 
2684
- /** The way a member offers an agent account a secret (ADR-0169): its name, its value, typed unseen, and what it is for. */
2921
+ /**
2922
+ * The way a member offers an agent account a secret (ADR-0169): its name, its value, typed
2923
+ * unseen or the text of a file chosen here (ADR-0184), the day it ends on where it has one, and
2924
+ * what it is for.
2925
+ */
2685
2926
  export function AgentSecretOfferForm(props: AgentSecretOfferFormProps) {
2686
2927
  const words = useWords().agents.page.offers;
2687
2928
  const [name, setName] = useState("");
2688
- const [value, setValue] = useState("");
2929
+ const secret = useSecretValue();
2930
+ const [expiresOn, setExpiresOn] = useState<string | null>(null);
2689
2931
  const [note, setNote] = useState("");
2690
2932
  const busy = props.busy === true;
2691
- const ready = isSecretName(name.trim()) && value.length > 0;
2933
+ const ready = isSecretName(name.trim()) && secret.value.length > 0;
2692
2934
  const submit = (event: FormEvent) => {
2693
2935
  event.preventDefault();
2694
2936
  if (!ready || busy) {
@@ -2696,13 +2938,18 @@ export function AgentSecretOfferForm(props: AgentSecretOfferFormProps) {
2696
2938
  }
2697
2939
  props.onOffer({
2698
2940
  name: name.trim(),
2699
- value,
2941
+ value: secret.value,
2700
2942
  note: note.trim().length === 0 ? undefined : note.trim(),
2943
+ expiresOn: expiresOn === null || expiresOn === "" ? undefined : expiresOn,
2701
2944
  });
2702
2945
  setName("");
2703
- setValue("");
2946
+ secret.clear();
2947
+ setExpiresOn(null);
2704
2948
  setNote("");
2705
2949
  };
2950
+ // A field is its label's while it is typed into; a chosen file has a button of its own, which
2951
+ // a label would press.
2952
+ const ValueField = secret.chosen === undefined ? "label" : "div";
2706
2953
  return (
2707
2954
  <form className="sc-form" aria-label={words.offerAria} onSubmit={submit}>
2708
2955
  <div className="sc-field-row">
@@ -2719,17 +2966,25 @@ export function AgentSecretOfferForm(props: AgentSecretOfferFormProps) {
2719
2966
  onChange={(event) => setName(event.target.value.toLowerCase())}
2720
2967
  />
2721
2968
  </label>
2722
- <label className="sc-field">
2969
+ <ValueField className="sc-field">
2723
2970
  <span className="sc-field-label">{words.value}</span>
2724
- <input
2725
- className="sc-input"
2726
- type="password"
2727
- value={value}
2728
- autoComplete="new-password"
2729
- onChange={(event) => setValue(event.target.value)}
2971
+ <SecretValueInput
2972
+ label={words.value}
2973
+ typed={secret.typed}
2974
+ chosen={secret.chosen}
2975
+ disabled={busy}
2976
+ onType={secret.type}
2977
+ onClear={secret.clear}
2730
2978
  />
2731
- </label>
2979
+ </ValueField>
2732
2980
  </div>
2981
+ <SecretValueMore
2982
+ disabled={busy}
2983
+ onChoose={secret.choose}
2984
+ expiresOn={expiresOn}
2985
+ onExpiresOn={setExpiresOn}
2986
+ />
2987
+ <SecretFileProblemLine problem={secret.problem} />
2733
2988
  <label className="sc-field">
2734
2989
  <span className="sc-field-label">{words.note}</span>
2735
2990
  <input
@@ -2753,25 +3008,39 @@ export function AgentSecretOfferForm(props: AgentSecretOfferFormProps) {
2753
3008
  export interface AgentSecretListProps {
2754
3009
  readonly secrets: readonly RestAgentSecret[];
2755
3010
  readonly busy?: boolean | undefined;
2756
- /** Seeds a secret, write-only: only the account reads the value back. */
2757
- readonly onSeed: (name: string, value: string) => void;
3011
+ /**
3012
+ * Seeds a secret, write-only: only the account reads the value back. With the day the value
3013
+ * ends on, where one was said.
3014
+ */
3015
+ readonly onSeed: (name: string, value: string, expiresOn?: string) => void;
2758
3016
  readonly onRemove: (name: string) => void;
2759
3017
  }
2760
3018
 
2761
- /** The names of an agent account's secrets, and the way a supervisor seeds one or removes one. Never a value. */
3019
+ /**
3020
+ * The names of an agent account's secrets, and the way a supervisor seeds one or removes one:
3021
+ * the value typed unseen, or the text of a file chosen here, as the command takes one with
3022
+ * `--file` (ADR-0184). Never a value.
3023
+ */
2762
3024
  export function AgentSecretList(props: AgentSecretListProps) {
2763
3025
  const words = useWords().agents.page.settings.secrets;
2764
3026
  const [name, setName] = useState("");
2765
- const [value, setValue] = useState("");
3027
+ const secret = useSecretValue();
3028
+ const [expiresOn, setExpiresOn] = useState<string | null>(null);
2766
3029
  const busy = props.busy === true;
3030
+ const ready = isSecretName(name.trim()) && secret.value.length > 0;
2767
3031
  const submit = (event: FormEvent) => {
2768
3032
  event.preventDefault();
2769
- if (name.trim().length === 0 || value.length === 0 || busy) {
3033
+ if (!ready || busy) {
2770
3034
  return;
2771
3035
  }
2772
- props.onSeed(name.trim(), value);
3036
+ if (expiresOn === null || expiresOn === "") {
3037
+ props.onSeed(name.trim(), secret.value);
3038
+ } else {
3039
+ props.onSeed(name.trim(), secret.value, expiresOn);
3040
+ }
2773
3041
  setName("");
2774
- setValue("");
3042
+ secret.clear();
3043
+ setExpiresOn(null);
2775
3044
  };
2776
3045
  return (
2777
3046
  <div>
@@ -2805,22 +3074,32 @@ export function AgentSecretList(props: AgentSecretListProps) {
2805
3074
  aria-label={words.name}
2806
3075
  placeholder={words.namePlaceholder}
2807
3076
  value={name}
3077
+ maxLength={MAX_AGENT_SECRET_NAME_LENGTH}
2808
3078
  autoComplete="off"
2809
- onChange={(event) => setName(event.target.value)}
3079
+ spellCheck={false}
3080
+ aria-invalid={name.trim() !== "" && !isSecretName(name.trim())}
3081
+ onChange={(event) => setName(event.target.value.toLowerCase())}
2810
3082
  />
2811
- <input
2812
- className="sc-input"
2813
- type="password"
2814
- aria-label={words.value}
3083
+ <SecretValueInput
3084
+ label={words.value}
2815
3085
  placeholder={words.value}
2816
- value={value}
2817
- autoComplete="new-password"
2818
- onChange={(event) => setValue(event.target.value)}
3086
+ typed={secret.typed}
3087
+ chosen={secret.chosen}
3088
+ disabled={busy}
3089
+ onType={secret.type}
3090
+ onClear={secret.clear}
2819
3091
  />
2820
- <Button type="submit" disabled={busy || name.trim().length === 0 || value.length === 0}>
3092
+ <Button type="submit" disabled={busy || !ready}>
2821
3093
  {words.seed}
2822
3094
  </Button>
3095
+ <SecretValueMore
3096
+ disabled={busy}
3097
+ onChoose={secret.choose}
3098
+ expiresOn={expiresOn}
3099
+ onExpiresOn={setExpiresOn}
3100
+ />
2823
3101
  </form>
3102
+ <SecretFileProblemLine problem={secret.problem} />
2824
3103
  <p className="sc-field-hint">{words.intro}</p>
2825
3104
  </div>
2826
3105
  );
@@ -10,7 +10,6 @@ import {
10
10
  type RestAgentInput,
11
11
  type RestAgentProposal,
12
12
  type RestPerson,
13
- type RestProject,
14
13
  type RestProvider,
15
14
  type RestWorkspace,
16
15
  usageStanding,
@@ -378,8 +377,6 @@ export interface AgentAccountFormProps {
378
377
  readonly people: readonly RestPerson[];
379
378
  /** Whoever makes the account, who is its manager unless another is chosen. */
380
379
  readonly me?: RestPerson | undefined;
381
- /** The projects it may start in. */
382
- readonly projects: readonly RestProject[];
383
380
  readonly busy?: boolean | undefined;
384
381
  readonly error?: string | undefined;
385
382
  readonly onSubmit: (input: RestAgentInput) => void;
@@ -390,7 +387,8 @@ export interface AgentAccountFormProps {
390
387
  * "Add an agent account", in the three things it settles: who the account is, a persona chosen
391
388
  * among the proposals and edited; the account it signs in to this console with, at one of the
392
389
  * providers the deployment has, put together from the workspace's services and edited freely;
393
- * 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
394
392
  * login, so it says what kind of name it is and when the account has to be there: at a git host,
395
393
  * before the account is added, since a login nobody holds there is whoever registers it first.
396
394
  * Who makes the account at the provider is the organization's to say, and the form says nothing
@@ -415,7 +413,6 @@ export function AgentAccountForm(props: AgentAccountFormProps) {
415
413
  /** The login as typed; while nothing was typed, the one the handle and the provider suggest. */
416
414
  const [typedLogin, setTypedLogin] = useState<string | undefined>(undefined);
417
415
  const [manager, setManager] = useState<RestPerson | undefined>(props.me);
418
- const [project, setProject] = useState(props.projects[0]?.key ?? "");
419
416
  /** The login of the member whom the person said is to become the account, as it was then. */
420
417
  const [converting, setConverting] = useState<string | undefined>(undefined);
421
418
  const provider = props.providers.find((candidate) => candidate.key === host);
@@ -456,8 +453,7 @@ export function AgentAccountForm(props: AgentAccountFormProps) {
456
453
  handleOk &&
457
454
  loginOk &&
458
455
  (member === undefined || convert) &&
459
- manager !== undefined &&
460
- project !== "";
456
+ manager !== undefined;
461
457
  const submit = (event: FormEvent) => {
462
458
  event.preventDefault();
463
459
  if (!valid || host === undefined || manager === undefined) {
@@ -471,7 +467,6 @@ export function AgentAccountForm(props: AgentAccountFormProps) {
471
467
  ...(title.trim() === "" ? {} : { title: title.trim() }),
472
468
  ...(chosen === undefined ? {} : { avatarSeed: chosen.seed, avatarParts: chosen.avatarParts }),
473
469
  managerId: manager.id,
474
- project,
475
470
  ...(convert ? { convert: true } : {}),
476
471
  });
477
472
  };
@@ -633,30 +628,19 @@ export function AgentAccountForm(props: AgentAccountFormProps) {
633
628
  <span className="sc-field-label">{form.manager}</span>
634
629
  <Picker
635
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
636
634
  search={peopleSearch(props.people.filter((person) => person.status === "active"))}
637
635
  keyOf={(person) => person.id}
638
636
  render={(person) => <PersonChip person={person} />}
639
637
  renderOption={(person) => <PersonOption person={person} />}
640
638
  label={form.manager}
641
- placeholder={words.people.nobody}
639
+ placeholder={manager === undefined ? words.people.nobody : personName(manager)}
642
640
  disabled={props.busy === true}
643
641
  onChange={(person) => setManager(person)}
644
642
  />
645
643
  </div>
646
- <label className="sc-field">
647
- <span className="sc-field-label">{form.project}</span>
648
- <select
649
- className="sc-input"
650
- value={project}
651
- onChange={(event) => setProject(event.target.value)}
652
- >
653
- {props.projects.map((candidate) => (
654
- <option key={candidate.id} value={candidate.key}>
655
- {candidate.name}
656
- </option>
657
- ))}
658
- </select>
659
- </label>
660
644
  </div>
661
645
  <p className="sc-field-hint">{form.managerHint}</p>
662
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
  />