@buffcore/admin-shell 0.8.46 → 0.8.48

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 (46) hide show
  1. package/dist/prototype/SceneBoundary.js +1 -1
  2. package/dist/screens/assistant/use-ask.d.ts +16 -0
  3. package/dist/workbench/app/ServedComp.js +1 -1
  4. package/dist/workbench/app/ServedPrototype.js +1 -0
  5. package/dist/workbench/app/ServedWork.js +4 -19
  6. package/dist/workbench/app/WorkFooter.d.ts +14 -0
  7. package/dist/workbench/app/WorkFooter.js +19 -0
  8. package/dist/workbench/app/WorkMerge.d.ts +2 -1
  9. package/dist/workbench/app/WorkMerge.js +11 -2
  10. package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +1 -1
  11. package/dist/workbench/app/actions.d.ts +4 -0
  12. package/dist/workbench/app/actions.js +2 -0
  13. package/dist/workbench/app/places.d.ts +4 -0
  14. package/dist/workbench/app/prototype-comp.d.ts +5 -0
  15. package/dist/workbench/app/prototype.js +1 -0
  16. package/dist/workbench/app/studio-post.js +7 -3
  17. package/dist/workbench/app/test/loop-fixture.d.ts +68 -0
  18. package/dist/workbench/app/useStudio.d.ts +2 -0
  19. package/dist/workbench/app/work.d.ts +2 -0
  20. package/dist/workbench/app/work.js +3 -0
  21. package/dist/workbench/studio/i18n/later.en.d.ts +7 -0
  22. package/dist/workbench/studio/i18n/later.en.js +8 -1
  23. package/dist/workbench/studio/i18n/later.es.json +8 -1
  24. package/dist/workbench/studio/i18n/prototype.en.d.ts +4 -0
  25. package/dist/workbench/studio/i18n/prototype.en.js +4 -0
  26. package/dist/workbench/studio/i18n/prototype.es.json +5 -1
  27. package/dist/workbench/studio/i18n/work.en.d.ts +1 -0
  28. package/dist/workbench/studio/i18n/work.en.js +1 -0
  29. package/dist/workbench/studio/i18n/work.es.json +1 -0
  30. package/dist/workbench/studio/loop/ProtoApprovalRecord.d.ts +10 -0
  31. package/dist/workbench/studio/loop/ProtoApprovalRecord.js +51 -0
  32. package/dist/workbench/studio/loop/ProtoCompare.d.ts +1 -7
  33. package/dist/workbench/studio/loop/ProtoCompare.js +3 -39
  34. package/dist/workbench/studio/loop/PrototypeComp.d.ts +2 -0
  35. package/dist/workbench/studio/loop/PrototypeComp.js +2 -2
  36. package/dist/workbench/studio/loop/PrototypePage.d.ts +2 -0
  37. package/dist/workbench/studio/loop/PrototypeReview.js +2 -2
  38. package/dist/workbench/studio/loop/types.d.ts +5 -0
  39. package/dist/workbench/studio/work/DrawnWorkPage.js +2 -2
  40. package/dist/workbench/studio/work/FirstBuild.d.ts +5 -1
  41. package/dist/workbench/studio/work/FirstBuild.js +19 -1
  42. package/dist/workbench/studio/work/MergePreview.d.ts +3 -1
  43. package/dist/workbench/studio/work/MergePreview.js +2 -2
  44. package/dist/workbench/studio/work/types.d.ts +8 -0
  45. package/dist/workbench/studio/work/work-test-data.d.ts +34 -0
  46. package/package.json +6 -6
@@ -96,6 +96,10 @@ export declare function loopApi(initial?: {
96
96
  fingerprint: string;
97
97
  role?: string | undefined;
98
98
  agent?: string | undefined;
99
+ ai?: {
100
+ model?: string | undefined;
101
+ reason: string;
102
+ } | undefined;
99
103
  }[];
100
104
  rule?: {
101
105
  kind: "one";
@@ -109,6 +113,10 @@ export declare function loopApi(initial?: {
109
113
  by: string;
110
114
  } | undefined;
111
115
  };
116
+ reopened?: {
117
+ by: string;
118
+ at: string;
119
+ } | undefined;
112
120
  } | undefined;
113
121
  pending?: {
114
122
  version: number;
@@ -121,6 +129,10 @@ export declare function loopApi(initial?: {
121
129
  fingerprint: string;
122
130
  role?: string | undefined;
123
131
  agent?: string | undefined;
132
+ ai?: {
133
+ model?: string | undefined;
134
+ reason: string;
135
+ } | undefined;
124
136
  }[];
125
137
  rule?: {
126
138
  kind: "one";
@@ -134,6 +146,10 @@ export declare function loopApi(initial?: {
134
146
  by: string;
135
147
  } | undefined;
136
148
  };
149
+ reopened?: {
150
+ by: string;
151
+ at: string;
152
+ } | undefined;
137
153
  } | undefined;
138
154
  superseded?: {
139
155
  version: number;
@@ -146,6 +162,10 @@ export declare function loopApi(initial?: {
146
162
  fingerprint: string;
147
163
  role?: string | undefined;
148
164
  agent?: string | undefined;
165
+ ai?: {
166
+ model?: string | undefined;
167
+ reason: string;
168
+ } | undefined;
149
169
  }[];
150
170
  rule?: {
151
171
  kind: "one";
@@ -159,6 +179,10 @@ export declare function loopApi(initial?: {
159
179
  by: string;
160
180
  } | undefined;
161
181
  };
182
+ reopened?: {
183
+ by: string;
184
+ at: string;
185
+ } | undefined;
162
186
  }[] | undefined;
163
187
  approvalRefusal?: string | undefined;
164
188
  milestone?: string | undefined;
@@ -253,6 +277,10 @@ export declare function loopApi(initial?: {
253
277
  fingerprint: string;
254
278
  role?: string | undefined;
255
279
  agent?: string | undefined;
280
+ ai?: {
281
+ model?: string | undefined;
282
+ reason: string;
283
+ } | undefined;
256
284
  }[];
257
285
  rule?: {
258
286
  kind: "one";
@@ -298,7 +326,12 @@ export declare function loopApi(initial?: {
298
326
  merge: "clean" | "conflict" | "merged" | "unknown";
299
327
  dirty: number;
300
328
  revision?: string | undefined;
329
+ kept?: "inUse" | "unknown" | undefined;
301
330
  }[];
331
+ others?: {
332
+ path: string;
333
+ branch?: string | undefined;
334
+ }[] | undefined;
302
335
  clashes: {
303
336
  a: string;
304
337
  b: string;
@@ -315,6 +348,7 @@ export declare function loopApi(initial?: {
315
348
  head: string;
316
349
  kind: "merged" | "refused" | "waiting";
317
350
  again?: true | undefined;
351
+ automatic?: true | undefined;
318
352
  at: string;
319
353
  detail: string;
320
354
  }[] | undefined;
@@ -559,6 +593,10 @@ export declare function loopApi(initial?: {
559
593
  fingerprint: string;
560
594
  role?: string | undefined;
561
595
  agent?: string | undefined;
596
+ ai?: {
597
+ model?: string | undefined;
598
+ reason: string;
599
+ } | undefined;
562
600
  }[];
563
601
  rule?: {
564
602
  kind: "one";
@@ -572,6 +610,10 @@ export declare function loopApi(initial?: {
572
610
  by: string;
573
611
  } | undefined;
574
612
  };
613
+ reopened?: {
614
+ by: string;
615
+ at: string;
616
+ } | undefined;
575
617
  } | undefined;
576
618
  pending?: {
577
619
  version: number;
@@ -584,6 +626,10 @@ export declare function loopApi(initial?: {
584
626
  fingerprint: string;
585
627
  role?: string | undefined;
586
628
  agent?: string | undefined;
629
+ ai?: {
630
+ model?: string | undefined;
631
+ reason: string;
632
+ } | undefined;
587
633
  }[];
588
634
  rule?: {
589
635
  kind: "one";
@@ -597,6 +643,10 @@ export declare function loopApi(initial?: {
597
643
  by: string;
598
644
  } | undefined;
599
645
  };
646
+ reopened?: {
647
+ by: string;
648
+ at: string;
649
+ } | undefined;
600
650
  } | undefined;
601
651
  superseded?: {
602
652
  version: number;
@@ -609,6 +659,10 @@ export declare function loopApi(initial?: {
609
659
  fingerprint: string;
610
660
  role?: string | undefined;
611
661
  agent?: string | undefined;
662
+ ai?: {
663
+ model?: string | undefined;
664
+ reason: string;
665
+ } | undefined;
612
666
  }[];
613
667
  rule?: {
614
668
  kind: "one";
@@ -622,6 +676,10 @@ export declare function loopApi(initial?: {
622
676
  by: string;
623
677
  } | undefined;
624
678
  };
679
+ reopened?: {
680
+ by: string;
681
+ at: string;
682
+ } | undefined;
625
683
  }[] | undefined;
626
684
  approvalRefusal?: string | undefined;
627
685
  milestone?: string | undefined;
@@ -716,6 +774,10 @@ export declare function loopApi(initial?: {
716
774
  fingerprint: string;
717
775
  role?: string | undefined;
718
776
  agent?: string | undefined;
777
+ ai?: {
778
+ model?: string | undefined;
779
+ reason: string;
780
+ } | undefined;
719
781
  }[];
720
782
  rule?: {
721
783
  kind: "one";
@@ -761,7 +823,12 @@ export declare function loopApi(initial?: {
761
823
  merge: "clean" | "conflict" | "merged" | "unknown";
762
824
  dirty: number;
763
825
  revision?: string | undefined;
826
+ kept?: "inUse" | "unknown" | undefined;
764
827
  }[];
828
+ others?: {
829
+ path: string;
830
+ branch?: string | undefined;
831
+ }[] | undefined;
765
832
  clashes: {
766
833
  a: string;
767
834
  b: string;
@@ -778,6 +845,7 @@ export declare function loopApi(initial?: {
778
845
  head: string;
779
846
  kind: "merged" | "refused" | "waiting";
780
847
  again?: true | undefined;
848
+ automatic?: true | undefined;
781
849
  at: string;
782
850
  detail: string;
783
851
  }[] | undefined;
@@ -25,6 +25,7 @@ export declare function useStudio({ token, fetch, every }: StudioAppProps): {
25
25
  level: (level: (typeof import("@buffcore/contracts/workbench").LEVELS)[number], neverAsk?: boolean) => void;
26
26
  answerPermission?: (chat: string, card: string, answer: 'once' | 'always' | 'deny') => Promise<true | string>;
27
27
  approvePrototype?: (change: string, version: number) => unknown;
28
+ reopenPrototype?: (change: string) => unknown;
28
29
  chooseSurface?: (surface: 'desktop' | 'phone') => unknown;
29
30
  approvePlaces?: (change: string, revision: string) => unknown;
30
31
  approve?: (direction: string, fingerprint: string) => unknown;
@@ -51,6 +52,7 @@ export declare function useStudio({ token, fetch, every }: StudioAppProps): {
51
52
  previewMerge?: (change: string, signal: AbortSignal) => Promise<import("@buffcore/contracts/workbench").MergePreview | undefined>;
52
53
  retryTurn?: (chat: string) => Promise<unknown>;
53
54
  holdMerges?: (held: boolean) => Promise<unknown>;
55
+ withdrawMerge?: (change: string) => Promise<unknown>;
54
56
  removeWorktree: (change: string) => Promise<unknown>;
55
57
  fresh?: import("./fresh.ts").FreshActions;
56
58
  save: (step: import("./actions.ts").SaveStep, fingerprint?: string, files?: readonly string[], change?: string) => Promise<import("./actions.ts").SaveResult>;
@@ -5,6 +5,8 @@ import type { StudioActions } from './actions.ts';
5
5
  export declare const workCallbacks: (actions: StudioActions) => {
6
6
  onMerge: (change: string) => Promise<unknown>;
7
7
  };
8
+ /** Only an Autopilot wait can be withdrawn; a person's own merge request stays theirs. */
9
+ export declare const withdrawable: (state: StudioState, change: string) => boolean;
8
10
  /**
9
11
  * Only the selected change's latest recorded version can satisfy coding's prerequisite, unless the
10
12
  * change's header says it has no screens: then it is ready with no version (the server's coding
@@ -2,6 +2,8 @@ import { approvalHolds, signatureCount } from '@buffcore/contracts/approvals';
2
2
  import { changeNeedsPrototype } from '@buffcore/contracts/workbench';
3
3
  /** The container passes these callbacks to WorkPage; views do not perform network requests. */
4
4
  export const workCallbacks = (actions) => ({ onMerge: actions.merge });
5
+ /** Only an Autopilot wait can be withdrawn; a person's own merge request stays theirs. */
6
+ export const withdrawable = (state, change) => state.work?.merges?.some((entry) => entry.change === change && entry.kind === 'waiting' && entry.automatic) === true;
5
7
  /**
6
8
  * Only the selected change's latest recorded version can satisfy coding's prerequisite, unless the
7
9
  * change's header says it has no screens: then it is ready with no version (the server's coding
@@ -66,6 +68,7 @@ export function workView(state, actions) {
66
68
  validator: agents ? (agents.work.validation ?? agents.default) : '',
67
69
  first: {
68
70
  worktrees: trees,
71
+ others: work?.others ?? [],
69
72
  clashes: work?.clashes ?? [],
70
73
  queue: work?.merging ? { merging: work.merging } : undefined,
71
74
  },
@@ -168,6 +168,13 @@ declare const _default: {
168
168
  'studio.later.wt.inMain': string;
169
169
  'studio.later.wt.conflict': string;
170
170
  'studio.later.wt.foot': string;
171
+ 'studio.later.wt.kept.inUse': string;
172
+ 'studio.later.wt.kept.unknown': string;
173
+ 'studio.later.wt.others': string;
174
+ 'studio.later.wt.branch': string;
175
+ 'studio.later.wt.path': string;
176
+ 'studio.later.wt.detached': string;
177
+ 'studio.later.wt.othersFoot': string;
171
178
  'studio.later.rev.crumb': string;
172
179
  'studio.later.rev.page': string;
173
180
  'studio.later.rev.lead': string;
@@ -169,7 +169,14 @@ export default {
169
169
  'studio.later.wt.clean': 'Merges cleanly',
170
170
  'studio.later.wt.inMain': 'In main',
171
171
  'studio.later.wt.conflict': 'Conflicts with main',
172
- 'studio.later.wt.foot': 'Merge state is found without a checkout. A worktree can be removed only when it is clean and merged into main. Never loses work.',
172
+ 'studio.later.wt.foot': 'Merge state is found without a checkout. A worktree is removed after each merge and when the studio starts, only when it is clean, merged into main and unused. Never loses work.',
173
+ 'studio.later.wt.kept.inUse': 'Kept: a turn or another program is using it.',
174
+ 'studio.later.wt.kept.unknown': 'Kept: it could not be removed safely. Check its status.',
175
+ 'studio.later.wt.others': 'Other worktrees',
176
+ 'studio.later.wt.branch': 'Branch',
177
+ 'studio.later.wt.path': 'Folder',
178
+ 'studio.later.wt.detached': 'No branch',
179
+ 'studio.later.wt.othersFoot': 'Not a change’s, so the studio leaves them alone. To remove the merged, clean, unused ones, run',
173
180
  // A plan revision
174
181
  'studio.later.rev.crumb': 'Plan · {v}',
175
182
  'studio.later.rev.page': '{count, plural, one {# change} other {# changes}} across the milestones',
@@ -163,7 +163,14 @@
163
163
  "studio.later.wt.clean": "Se une limpio",
164
164
  "studio.later.wt.inMain": "En main",
165
165
  "studio.later.wt.conflict": "Choca con main",
166
- "studio.later.wt.foot": "El estado de unión se averigua sin descargar nada. Un árbol de trabajo solo se quita si está limpio y unido a main. Nunca pierde trabajo.",
166
+ "studio.later.wt.foot": "El estado de unión se averigua sin descargar nada. Un árbol de trabajo se quita tras cada unión y al abrir el estudio, solo si está limpio, unido a main y sin uso. Nunca pierde trabajo.",
167
+ "studio.later.wt.kept.inUse": "Se conserva: un turno u otro programa lo está usando.",
168
+ "studio.later.wt.kept.unknown": "Se conserva: no se pudo quitar con seguridad. Revisa su estado.",
169
+ "studio.later.wt.others": "Otros árboles de trabajo",
170
+ "studio.later.wt.branch": "Rama",
171
+ "studio.later.wt.path": "Carpeta",
172
+ "studio.later.wt.detached": "Sin rama",
173
+ "studio.later.wt.othersFoot": "No son de un cambio, así que el estudio no los toca. Para quitar los unidos, limpios y sin uso, ejecuta",
167
174
 
168
175
  "studio.later.rev.crumb": "Plan · {v}",
169
176
  "studio.later.rev.page": "{count, plural, one {# cambio} other {# cambios}} entre los hitos",
@@ -56,5 +56,9 @@ declare const _default: {
56
56
  'studio.prototype.sceneHelp': string;
57
57
  'studio.prototype.browse': string;
58
58
  'studio.prototype.signInHelp': string;
59
+ 'studio.loop.proto.aiApproval': string;
60
+ 'studio.loop.proto.rec.ai': string;
61
+ 'studio.loop.proto.reopen': string;
62
+ 'studio.loop.proto.reopenHelp': string;
59
63
  };
60
64
  export default _default;
@@ -56,4 +56,8 @@ export default {
56
56
  'studio.prototype.sceneHelp': 'Review the saved screens before approving a version.',
57
57
  'studio.prototype.browse': 'Browse scenes',
58
58
  'studio.prototype.signInHelp': 'Trouble signing in?',
59
+ 'studio.loop.proto.aiApproval': 'Approved by AI',
60
+ 'studio.loop.proto.rec.ai': 'AI ({model}): {reason}',
61
+ 'studio.loop.proto.reopen': 'Reopen',
62
+ 'studio.loop.proto.reopenHelp': 'A person reopens an AI approval; the version then waits for a person.',
59
63
  };
@@ -55,5 +55,9 @@
55
55
  "studio.prototype.scenes": "Pantallas",
56
56
  "studio.prototype.sceneHelp": "Revisa las pantallas guardadas antes de aprobar una versión.",
57
57
  "studio.prototype.browse": "Ver pantallas",
58
- "studio.prototype.signInHelp": "¿Problemas para iniciar sesión?"
58
+ "studio.prototype.signInHelp": "¿Problemas para iniciar sesión?",
59
+ "studio.loop.proto.aiApproval": "Aprobada por IA",
60
+ "studio.loop.proto.rec.ai": "IA ({model}): {reason}",
61
+ "studio.loop.proto.reopen": "Reabrir",
62
+ "studio.loop.proto.reopenHelp": "Una persona reabre una aprobación de IA; la versión espera entonces a una persona."
59
63
  }
@@ -102,6 +102,7 @@ declare const _default: {
102
102
  readonly 'studio.work.merge.tooLarge': 'Some details are too large to preview.';
103
103
  readonly 'studio.work.merge.snapshot': 'When required, a prototype snapshot runs on main after merging.';
104
104
  readonly 'studio.work.merge.confirm': 'Merge change';
105
+ readonly 'studio.work.merge.withdraw': 'Withdraw merge request';
105
106
  readonly 'studio.work.version': 'Prototype version {version}';
106
107
  readonly 'studio.work.status.no-change': 'Choose a change first';
107
108
  readonly 'studio.work.status.missing': 'Create this change’s prototype';
@@ -102,6 +102,7 @@ export default {
102
102
  'studio.work.merge.tooLarge': 'Some details are too large to preview.',
103
103
  'studio.work.merge.snapshot': 'When required, a prototype snapshot runs on main after merging.',
104
104
  'studio.work.merge.confirm': 'Merge change',
105
+ 'studio.work.merge.withdraw': 'Withdraw merge request',
105
106
  'studio.work.version': 'Prototype version {version}',
106
107
  'studio.work.status.no-change': 'Choose a change first',
107
108
  'studio.work.status.missing': 'Create this change’s prototype',
@@ -102,6 +102,7 @@
102
102
  "studio.work.merge.tooLarge": "Algunos detalles son demasiado grandes para la vista previa.",
103
103
  "studio.work.merge.snapshot": "Cuando se requiere, se genera una captura del prototipo en main después de la integración.",
104
104
  "studio.work.merge.confirm": "Integrar cambio",
105
+ "studio.work.merge.withdraw": "Retirar solicitud de integración",
105
106
  "studio.work.version": "Versión {version} del prototipo",
106
107
  "studio.work.status.no-change": "Primero elige un cambio",
107
108
  "studio.work.status.missing": "Crea el prototipo de este cambio",
@@ -0,0 +1,10 @@
1
+ import type { ProtoSample } from './types.ts';
2
+ /** The record of an approval: who, when, which commit. The build reads it; it never changes. */
3
+ export declare function ApprovalRecord({ proto, version, onBuild, onChange, onReopen, }: {
4
+ proto: ProtoSample;
5
+ version: string;
6
+ onBuild?: (label: string) => void;
7
+ onChange?: (label: string) => void;
8
+ /** A person reopens an AI approval (S4), at every level. */
9
+ onReopen?: () => void;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // The record of an approved prototype version (split from ProtoCompare.tsx): who approved, a person
3
+ // or AI (S4), when, which commit, and what the person can do next.
4
+ import { useLocale, useT } from '@buffcore/i18n/react';
5
+ import { Button } from '../../../components/Button.js';
6
+ import { Chip } from '../../../components/Chip.js';
7
+ import { KV } from '../../../components/KV.js';
8
+ import { Panel } from '../../../components/Panel.js';
9
+ import { bodyText, captionText, monoText } from '../../../components/styles.js';
10
+ import { Path, row, Seal } from './parts.js';
11
+ /** The record of an approval: who, when, which commit. The build reads it; it never changes. */
12
+ export function ApprovalRecord({ proto, version, onBuild, onChange, onReopen, }) {
13
+ const t = useT();
14
+ const { locale } = useLocale();
15
+ return (_jsxs(Panel, { title: _jsxs("span", { style: row, children: [_jsx(Seal, { children: t('studio.loop.proto.versionApproved', { version }) }), proto.approved.ai && (_jsx(Chip, { tone: "info", icon: "sparkles", size: "sm", children: t('studio.loop.proto.aiApproval') })), t('studio.loop.proto.mustMatch', { change: proto.change.id, version })] }), children: [_jsx(KV, { cols: 2, items: approvalItems(proto, locale, t) }), _jsx("p", { style: { ...bodyText, margin: 0 }, children: proto.record }), _jsx(ApprovedActions, { onBuild: onBuild, onChange: onChange }), proto.approved.ai && (_jsxs("div", { style: row, children: [_jsx(Button, { size: "sm", variant: "secondary", icon: "rotate-ccw", disabled: !onReopen, onClick: () => onReopen?.(), children: t('studio.loop.proto.reopen') }), _jsx("span", { style: captionText, children: t('studio.loop.proto.reopenHelp') })] }))] }));
16
+ }
17
+ function approvalItems(proto, locale, t) {
18
+ const a = proto.approved;
19
+ const when = new Intl.DateTimeFormat(locale, {
20
+ dateStyle: 'long',
21
+ timeStyle: 'short',
22
+ timeZone: 'UTC',
23
+ }).format(new Date(a.at));
24
+ const mono = (s) => (_jsx("span", { translate: "no", style: monoText, children: s }));
25
+ return [
26
+ [
27
+ t('studio.loop.proto.rec.by'),
28
+ _jsx("span", { translate: "no", children: a.ai
29
+ ? t('studio.loop.proto.rec.ai', {
30
+ model: a.ai.model ?? a.agent ?? '',
31
+ reason: a.ai.reason,
32
+ })
33
+ : a.agent
34
+ ? t(a.forYou === true ? 'studio.auto.chosen' : 'studio.auto.chosenFor', {
35
+ agent: a.agent,
36
+ by: a.by,
37
+ })
38
+ : a.by }, "by"),
39
+ ],
40
+ [t('studio.loop.proto.rec.when'), when],
41
+ [t('studio.loop.proto.rec.commit'), mono(a.commit)],
42
+ [t('studio.loop.proto.rec.fingerprint'), mono(a.fingerprint)],
43
+ [t('studio.loop.proto.rec.file'), _jsx(Path, { children: a.file }, "file")],
44
+ ];
45
+ }
46
+ function ApprovedActions({ onBuild, onChange, }) {
47
+ const t = useT();
48
+ const buildLabel = t('studio.loop.proto.startBuild');
49
+ const changeLabel = t('studio.loop.proto.startChange');
50
+ return (_jsxs("div", { style: row, children: [_jsx(Button, { size: "sm", icon: "wrench", disabled: !onBuild, onClick: () => onBuild?.(buildLabel), children: buildLabel }), _jsx(Button, { size: "sm", variant: "secondary", icon: "git-branch", disabled: !onChange, onClick: () => onChange?.(changeLabel), children: changeLabel })] }));
51
+ }
@@ -1,4 +1,5 @@
1
1
  import type { ProtoSample } from './types.ts';
2
+ export { ApprovalRecord } from './ProtoApprovalRecord.tsx';
2
3
  export declare function Compare({ proto, live, onClose, pair, onPair, version, approvedVersion, }: {
3
4
  proto: ProtoSample;
4
5
  version?: string;
@@ -8,10 +9,3 @@ export declare function Compare({ proto, live, onClose, pair, onPair, version, a
8
9
  onPair?: (a: string, b: string) => void;
9
10
  onClose?: () => void;
10
11
  }): import("react").JSX.Element;
11
- /** The record of an approval: who, when, which commit. The build reads it; it never changes. */
12
- export declare function ApprovalRecord({ proto, version, onBuild, onChange, }: {
13
- proto: ProtoSample;
14
- version: string;
15
- onBuild?: (label: string) => void;
16
- onChange?: (label: string) => void;
17
- }): import("react").JSX.Element;
@@ -1,15 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Draft v2 beside v1: the same screen in each version, then what changed in the screens, the data
3
3
  // model and the design. And the approval record of the version the build must match.
4
- import { useLocale, useT } from '@buffcore/i18n/react';
4
+ import { useT } from '@buffcore/i18n/react';
5
5
  import { Button } from '../../../components/Button.js';
6
6
  import { Chip } from '../../../components/Chip.js';
7
- import { KV } from '../../../components/KV.js';
8
7
  import { Panel } from '../../../components/Panel.js';
9
8
  import { Select } from '../../../components/Select.js';
10
9
  import { bodyText, captionText, monoText } from '../../../components/styles.js';
11
10
  import { AppScene } from '../frame/RealApp.js';
12
- import { Path, row, Seal } from './parts.js';
11
+ import { row } from './parts.js';
12
+ export { ApprovalRecord } from './ProtoApprovalRecord.js';
13
13
  /** A version of the same screen: its commit, and whether it is still a draft. */
14
14
  function VersionFrame({ v, scene, draft, approved, }) {
15
15
  const t = useT();
@@ -38,36 +38,6 @@ function ComparedVersions({ versions, scene, live, approvedVersion, }) {
38
38
  gap: 'var(--space-4)',
39
39
  }, children: versions.map((v) => v ? (_jsx(VersionFrame, { v: v, scene: live ? undefined : scene, draft: v === versions[1] && v.v !== approvedVersion, approved: v.v === approvedVersion }, v.v)) : null) }));
40
40
  }
41
- /** The record of an approval: who, when, which commit. The build reads it; it never changes. */
42
- export function ApprovalRecord({ proto, version, onBuild, onChange, }) {
43
- const t = useT();
44
- const { locale } = useLocale();
45
- return (_jsxs(Panel, { title: _jsxs("span", { style: row, children: [_jsx(Seal, { children: t('studio.loop.proto.versionApproved', { version }) }), t('studio.loop.proto.mustMatch', { change: proto.change.id, version })] }), children: [_jsx(KV, { cols: 2, items: approvalItems(proto, locale, t) }), _jsx("p", { style: { ...bodyText, margin: 0 }, children: proto.record }), _jsx(ApprovedActions, { onBuild: onBuild, onChange: onChange })] }));
46
- }
47
- function approvalItems(proto, locale, t) {
48
- const a = proto.approved;
49
- const when = new Intl.DateTimeFormat(locale, {
50
- dateStyle: 'long',
51
- timeStyle: 'short',
52
- timeZone: 'UTC',
53
- }).format(new Date(a.at));
54
- const mono = (s) => (_jsx("span", { translate: "no", style: monoText, children: s }));
55
- return [
56
- [
57
- t('studio.loop.proto.rec.by'),
58
- _jsx("span", { translate: "no", children: a.agent
59
- ? t(a.forYou === true ? 'studio.auto.chosen' : 'studio.auto.chosenFor', {
60
- agent: a.agent,
61
- by: a.by,
62
- })
63
- : a.by }, "by"),
64
- ],
65
- [t('studio.loop.proto.rec.when'), when],
66
- [t('studio.loop.proto.rec.commit'), mono(a.commit)],
67
- [t('studio.loop.proto.rec.fingerprint'), mono(a.fingerprint)],
68
- [t('studio.loop.proto.rec.file'), _jsx(Path, { children: a.file }, "file")],
69
- ];
70
- }
71
41
  function ComparePair({ proto, pair, onPair, }) {
72
42
  const t = useT();
73
43
  return (_jsx("div", { style: row, children: ['compareFrom', 'compareTo'].map((key, index) => (_jsx(Select, { disabled: !onPair, label: t(`studio.loop.proto.${key}`), value: pair[index] ?? '', options: proto.versions
@@ -87,9 +57,3 @@ function Differences({ proto }) {
87
57
  gridTemplateColumns: 'repeat(auto-fit, minmax(12rem, 1fr))',
88
58
  }, children: diffs.map(([h, text]) => (_jsx(Panel, { title: h, children: _jsx("span", { style: bodyText, children: text }) }, h))) }));
89
59
  }
90
- function ApprovedActions({ onBuild, onChange, }) {
91
- const t = useT();
92
- const buildLabel = t('studio.loop.proto.startBuild');
93
- const changeLabel = t('studio.loop.proto.startChange');
94
- return (_jsxs("div", { style: row, children: [_jsx(Button, { size: "sm", icon: "wrench", disabled: !onBuild, onClick: () => onBuild?.(buildLabel), children: buildLabel }), _jsx(Button, { size: "sm", variant: "secondary", icon: "git-branch", disabled: !onChange, onClick: () => onChange?.(changeLabel), children: changeLabel })] }));
95
- }
@@ -16,6 +16,8 @@ export interface PrototypeCompProps {
16
16
  approved: boolean;
17
17
  /** Who approved it (git's user.email), once approved. */
18
18
  approvedBy?: string;
19
+ /** Why the look is not approved: a host's refusal, in the words the other approvals show. */
20
+ why?: string;
19
21
  needsRight?: 'approve';
20
22
  result?: DesignResult;
21
23
  onApprove?: () => void;
@@ -43,11 +43,11 @@ function ScreenPicture({ screen, dark }) {
43
43
  return _jsx("img", { src: src, alt: screen.title, style: frame });
44
44
  return (_jsx("div", { role: "img", "aria-label": t('studio.comp.noPicture'), style: { ...frame, aspectRatio: '16 / 10', background: 'var(--surface-sunken)' } }));
45
45
  }
46
- function CompActions({ approved, approvedBy, needsRight, result, onApprove, onClose, }) {
46
+ function CompActions({ approved, approvedBy, why, needsRight, result, onApprove, onClose, }) {
47
47
  const t = useT();
48
48
  return (_jsx(ActionBar, { secondary: onClose && (_jsx(Button, { variant: "ghost", size: "lg", onClick: onClose, children: t('studio.comp.back') })), status: _jsx("span", { style: captionText, children: approved
49
49
  ? t('studio.comp.approvedBy', { by: approvedBy ?? '' })
50
- : (result?.output ?? t('studio.comp.change')) }), primary: approved ? (_jsx(Badge, { tone: "success", children: t('studio.comp.approved') })) : (_jsx(RightAction, { size: "lg", icon: "shield-check", needsRight: needsRight, loading: result?.busy, disabled: !onApprove, onClick: onApprove, children: t('studio.comp.approve') })) }));
50
+ : (result?.output ?? why ?? t('studio.comp.change')) }), primary: approved ? (_jsx(Badge, { tone: "success", children: t('studio.comp.approved') })) : (_jsx(RightAction, { size: "lg", icon: "shield-check", needsRight: needsRight, loading: result?.busy, disabled: !onApprove, onClick: onApprove, children: t('studio.comp.approve') })) }));
51
51
  }
52
52
  /** A neutral stand-in where `design/references.md` names no picture: shapes, never a product. */
53
53
  function ReferencePlaceholder({ variant, label }) {
@@ -29,6 +29,8 @@ export interface PrototypePageProps {
29
29
  moment?: LoopMoment;
30
30
  view?: ProtoView;
31
31
  onApprove?: () => void;
32
+ /** Reopen an AI approval (S4): a person's, at every level. */
33
+ onReopen?: () => void;
32
34
  onCompare?: (a: string, b: string) => void;
33
35
  onPair?: (a: string, b: string) => void;
34
36
  onComment?: (comment: PrototypeComment) => void;
@@ -39,14 +39,14 @@ export function ApproveWhy({ view }) {
39
39
  : latest && t('studio.prototype.why.older', { latest, approved });
40
40
  return words ? (_jsx("p", { role: "status", style: { margin: 0 }, children: words })) : null;
41
41
  }
42
- function PrototypeInfo({ sample, view, onBuild, onChange, onAction, onCatchUp, }) {
42
+ function PrototypeInfo({ sample, view, onBuild, onChange, onAction, onCatchUp, onReopen, }) {
43
43
  const { proto } = sample;
44
44
  const lane = view.lane;
45
45
  return (_jsx(ControlReason, { disabled: lane
46
46
  ? !onCatchUp && !onAction
47
47
  : view.approved
48
48
  ? !onBuild || !onChange
49
- : !view.live && !view.reviewOnly && !onAction, children: lane ? (_jsx(LaneInfo, { proto: proto, lane: lane, onAction: onAction, onCatchUp: onCatchUp })) : view.approved ? (_jsx(ApprovalRecord, { proto: proto, version: view.version, onBuild: onBuild, onChange: onChange })) : view.live || view.reviewOnly ? null : (_jsx(ChoiceCard, { onAction: onAction, def: sample.choices.list, agent: sample.product.agent.name })) }));
49
+ : !view.live && !view.reviewOnly && !onAction, children: lane ? (_jsx(LaneInfo, { proto: proto, lane: lane, onAction: onAction, onCatchUp: onCatchUp })) : view.approved ? (_jsx(ApprovalRecord, { proto: proto, version: view.version, onBuild: onBuild, onChange: onChange, onReopen: onReopen })) : view.live || view.reviewOnly ? null : (_jsx(ChoiceCard, { onAction: onAction, def: sample.choices.list, agent: sample.product.agent.name })) }));
50
50
  }
51
51
  export function PrototypeReview(props) {
52
52
  const t = useT();
@@ -174,6 +174,11 @@ export interface ProtoSample {
174
174
  file: string;
175
175
  agent?: string;
176
176
  forYou?: boolean;
177
+ /** An AI approval (S4): the approver's model and reason; never a person's. */
178
+ ai?: {
179
+ model?: string;
180
+ reason: string;
181
+ };
177
182
  };
178
183
  comment: {
179
184
  component: string;
@@ -8,7 +8,7 @@ import { Icon } from '../../../components/Icon.js';
8
8
  import { Page } from '../../../components/Page.js';
9
9
  import { Place, WithHostSide } from '../frame/Place.js';
10
10
  import { Segmented } from '../frame/Segmented.js';
11
- import { ClashWarning, OneAtATime, Worktrees } from './FirstBuild.js';
11
+ import { ClashWarning, OneAtATime, OtherWorktrees, Worktrees } from './FirstBuild.js';
12
12
  import { D, Mono, Row, Seal, Stack, strong, useTx } from './parts.js';
13
13
  import { Queue } from './Queue.js';
14
14
  import { Board } from './Swimlanes.js';
@@ -73,7 +73,7 @@ function WorkActions({ onPlan, onAction, group = 'milestone', onGroup, }) {
73
73
  ] }), _jsx(Button, { disabled: !onPlan, variant: "secondary", size: "sm", icon: "list-checks", onClick: onPlan, children: t('studio.later.work.plan') })] }));
74
74
  }
75
75
  function WorkContent({ view, where, onMerge, onSelect, onAction, onClash, onWaiting, }) {
76
- return (_jsxs(Stack, { children: [view.banners && _jsx(Notices, { onAction: onAction, list: view.banners }), view.servers && _jsx(Servers, { list: view.servers }), _jsx(Waiting, { onAction: onWaiting ?? onAction, list: view.waiting }), view.queue && _jsx(Queue, { onAction: onAction, q: view.queue }), view.first?.clash && _jsx(ClashWarning, { onAction: onAction, clash: view.first.clash }), view.first?.clashes?.map((clash) => (_jsx(ClashWarning, { onAction: onAction, onBoth: onClash, clash: clash }, `${clash.a}/${clash.b}`))), _jsx(Board, { lanes: view.lanes, cards: view.cards, onAction, onMerge, onSelect }), view.first && (_jsxs(_Fragment, { children: [view.first.queue && _jsx(OneAtATime, { q: view.first.queue }), _jsx(Worktrees, { list: view.first.worktrees, where: where })] }))] }));
76
+ return (_jsxs(Stack, { children: [view.banners && _jsx(Notices, { onAction: onAction, list: view.banners }), view.servers && _jsx(Servers, { list: view.servers }), _jsx(Waiting, { onAction: onWaiting ?? onAction, list: view.waiting }), view.queue && _jsx(Queue, { onAction: onAction, q: view.queue }), view.first?.clash && _jsx(ClashWarning, { onAction: onAction, clash: view.first.clash }), view.first?.clashes?.map((clash) => (_jsx(ClashWarning, { onAction: onAction, onBoth: onClash, clash: clash }, `${clash.a}/${clash.b}`))), _jsx(Board, { lanes: view.lanes, cards: view.cards, onAction, onMerge, onSelect }), view.first && (_jsxs(_Fragment, { children: [view.first.queue && _jsx(OneAtATime, { q: view.first.queue }), _jsx(Worktrees, { list: view.first.worktrees, where: where }), !!view.first.others?.length && _jsx(OtherWorktrees, { list: view.first.others })] }))] }));
77
77
  }
78
78
  export function WorkPage({ preparation, view, where, onPlan, onMerge, onSelect, onAction, group, onGroup, onClash, onWaiting, }) {
79
79
  const t = useT();
@@ -1,4 +1,4 @@
1
- import type { Clash, FirstQueue, Worktree } from './types.ts';
1
+ import type { Clash, FirstQueue, OtherWorktree, Worktree } from './types.ts';
2
2
  export declare function ClashWarning({ clash, onAction, onBoth, }: {
3
3
  clash: Clash;
4
4
  onBoth?: (change: string, label: string) => void;
@@ -12,3 +12,7 @@ export declare function Worktrees({ list, where }: {
12
12
  list: readonly Worktree[];
13
13
  where: string;
14
14
  }): import("react").JSX.Element;
15
+ /** Worktrees that are no change's, read-only: `ape worktrees clean` removes the merged ones. */
16
+ export declare function OtherWorktrees({ list }: {
17
+ list: readonly OtherWorktree[];
18
+ }): import("react").JSX.Element;
@@ -48,7 +48,8 @@ export function OneAtATime({ q }) {
48
48
  ] }), q.waiting && (_jsx("span", { style: small, children: tx('studio.later.first.waiting', { id: q.waiting }) }))] }));
49
49
  }
50
50
  function Branch({ w }) {
51
- return (_jsxs("span", { style: { display: 'grid' }, children: [_jsx(Mono, { children: w.change }), _jsx("span", { style: small, children: _jsx(Mono, { children: w.branch }) }), w.path && (_jsx("span", { style: small, children: _jsx(Mono, { children: w.path }) }))] }));
51
+ const t = useT();
52
+ return (_jsxs("span", { style: { display: 'grid' }, children: [_jsx(Mono, { children: w.change }), _jsx("span", { style: small, children: _jsx(Mono, { children: w.branch }) }), w.path && (_jsx("span", { style: small, children: _jsx(Mono, { children: w.path }) })), w.kept && _jsx("span", { style: small, children: t(`studio.later.wt.kept.${w.kept}`) })] }));
52
53
  }
53
54
  function FromMain({ w }) {
54
55
  const t = useT();
@@ -90,3 +91,20 @@ export function Worktrees({ list, where }) {
90
91
  { k: t('studio.later.wt.merge'), w: 'minmax(0,1.4fr)' },
91
92
  ], rows: list.map(row) }), _jsxs("span", { style: small, children: [t('studio.later.wt.foot'), " ", _jsx(D, { children: "git merge-tree" })] })] }));
92
93
  }
94
+ /** Worktrees that are no change's, read-only: `ape worktrees clean` removes the merged ones. */
95
+ export function OtherWorktrees({ list }) {
96
+ const t = useT();
97
+ return (_jsxs(Panel, { title: t('studio.later.wt.others'), children: [_jsx(DataList, { label: t('studio.later.wt.others'), cols: [
98
+ { k: t('studio.later.wt.branch'), w: 'minmax(0,1fr)' },
99
+ { k: t('studio.later.wt.path'), w: 'minmax(0,2fr)' },
100
+ ], rows: list.map((w) => ({
101
+ id: w.path,
102
+ cells: [
103
+ {
104
+ v: w.branch ?? '',
105
+ el: w.branch ? (_jsx(Mono, { children: w.branch })) : (_jsx("span", { style: muted, children: t('studio.later.wt.detached') })),
106
+ },
107
+ { v: w.path, el: _jsx(Mono, { children: w.path }) },
108
+ ],
109
+ })) }), _jsxs("span", { style: small, children: [t('studio.later.wt.othersFoot'), " ", _jsx(D, { children: "ape worktrees clean" })] })] }));
110
+ }