@buffcore/admin-shell 0.8.46 → 0.8.47

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 (32) 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/ServedPrototype.js +1 -0
  4. package/dist/workbench/app/ServedWork.js +4 -3
  5. package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +1 -1
  6. package/dist/workbench/app/actions.d.ts +2 -0
  7. package/dist/workbench/app/actions.js +1 -0
  8. package/dist/workbench/app/places.d.ts +4 -0
  9. package/dist/workbench/app/prototype-comp.d.ts +4 -0
  10. package/dist/workbench/app/prototype.js +1 -0
  11. package/dist/workbench/app/test/loop-fixture.d.ts +66 -0
  12. package/dist/workbench/app/useStudio.d.ts +1 -0
  13. package/dist/workbench/app/work.js +1 -0
  14. package/dist/workbench/studio/i18n/later.en.d.ts +7 -0
  15. package/dist/workbench/studio/i18n/later.en.js +8 -1
  16. package/dist/workbench/studio/i18n/later.es.json +8 -1
  17. package/dist/workbench/studio/i18n/prototype.en.d.ts +4 -0
  18. package/dist/workbench/studio/i18n/prototype.en.js +4 -0
  19. package/dist/workbench/studio/i18n/prototype.es.json +5 -1
  20. package/dist/workbench/studio/loop/ProtoApprovalRecord.d.ts +10 -0
  21. package/dist/workbench/studio/loop/ProtoApprovalRecord.js +51 -0
  22. package/dist/workbench/studio/loop/ProtoCompare.d.ts +1 -7
  23. package/dist/workbench/studio/loop/ProtoCompare.js +3 -39
  24. package/dist/workbench/studio/loop/PrototypePage.d.ts +2 -0
  25. package/dist/workbench/studio/loop/PrototypeReview.js +2 -2
  26. package/dist/workbench/studio/loop/types.d.ts +5 -0
  27. package/dist/workbench/studio/work/DrawnWorkPage.js +2 -2
  28. package/dist/workbench/studio/work/FirstBuild.d.ts +5 -1
  29. package/dist/workbench/studio/work/FirstBuild.js +19 -1
  30. package/dist/workbench/studio/work/types.d.ts +8 -0
  31. package/dist/workbench/studio/work/work-test-data.d.ts +33 -0
  32. package/package.json +6 -6
@@ -166,6 +166,7 @@ function prototypeApproval(state, change) {
166
166
  ...(signature?.agent
167
167
  ? { agent: signature.agent, forYou: choiceForViewer(signature.by, state.viewer) }
168
168
  : {}),
169
+ ...(signature?.ai ? { ai: signature.ai } : {}),
169
170
  at: signature?.at ?? '',
170
171
  commit: signature?.commit ?? '',
171
172
  fingerprint: signature?.fingerprint ?? '',
@@ -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;
@@ -559,6 +592,10 @@ export declare function loopApi(initial?: {
559
592
  fingerprint: string;
560
593
  role?: string | undefined;
561
594
  agent?: string | undefined;
595
+ ai?: {
596
+ model?: string | undefined;
597
+ reason: string;
598
+ } | undefined;
562
599
  }[];
563
600
  rule?: {
564
601
  kind: "one";
@@ -572,6 +609,10 @@ export declare function loopApi(initial?: {
572
609
  by: string;
573
610
  } | undefined;
574
611
  };
612
+ reopened?: {
613
+ by: string;
614
+ at: string;
615
+ } | undefined;
575
616
  } | undefined;
576
617
  pending?: {
577
618
  version: number;
@@ -584,6 +625,10 @@ export declare function loopApi(initial?: {
584
625
  fingerprint: string;
585
626
  role?: string | undefined;
586
627
  agent?: string | undefined;
628
+ ai?: {
629
+ model?: string | undefined;
630
+ reason: string;
631
+ } | undefined;
587
632
  }[];
588
633
  rule?: {
589
634
  kind: "one";
@@ -597,6 +642,10 @@ export declare function loopApi(initial?: {
597
642
  by: string;
598
643
  } | undefined;
599
644
  };
645
+ reopened?: {
646
+ by: string;
647
+ at: string;
648
+ } | undefined;
600
649
  } | undefined;
601
650
  superseded?: {
602
651
  version: number;
@@ -609,6 +658,10 @@ export declare function loopApi(initial?: {
609
658
  fingerprint: string;
610
659
  role?: string | undefined;
611
660
  agent?: string | undefined;
661
+ ai?: {
662
+ model?: string | undefined;
663
+ reason: string;
664
+ } | undefined;
612
665
  }[];
613
666
  rule?: {
614
667
  kind: "one";
@@ -622,6 +675,10 @@ export declare function loopApi(initial?: {
622
675
  by: string;
623
676
  } | undefined;
624
677
  };
678
+ reopened?: {
679
+ by: string;
680
+ at: string;
681
+ } | undefined;
625
682
  }[] | undefined;
626
683
  approvalRefusal?: string | undefined;
627
684
  milestone?: string | undefined;
@@ -716,6 +773,10 @@ export declare function loopApi(initial?: {
716
773
  fingerprint: string;
717
774
  role?: string | undefined;
718
775
  agent?: string | undefined;
776
+ ai?: {
777
+ model?: string | undefined;
778
+ reason: string;
779
+ } | undefined;
719
780
  }[];
720
781
  rule?: {
721
782
  kind: "one";
@@ -761,7 +822,12 @@ export declare function loopApi(initial?: {
761
822
  merge: "clean" | "conflict" | "merged" | "unknown";
762
823
  dirty: number;
763
824
  revision?: string | undefined;
825
+ kept?: "inUse" | "unknown" | undefined;
764
826
  }[];
827
+ others?: {
828
+ path: string;
829
+ branch?: string | undefined;
830
+ }[] | undefined;
765
831
  clashes: {
766
832
  a: string;
767
833
  b: string;
@@ -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;
@@ -66,6 +66,7 @@ export function workView(state, actions) {
66
66
  validator: agents ? (agents.work.validation ?? agents.default) : '',
67
67
  first: {
68
68
  worktrees: trees,
69
+ others: work?.others ?? [],
69
70
  clashes: work?.clashes ?? [],
70
71
  queue: work?.merging ? { merging: work.merging } : undefined,
71
72
  },
@@ -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
  }
@@ -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
- }
@@ -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
+ }
@@ -135,7 +135,14 @@ export interface Worktree {
135
135
  behind: number;
136
136
  merge: 'clean' | 'conflict' | 'merged' | 'unknown';
137
137
  dirty: boolean | number;
138
+ /** A merged worktree the last sweep kept: in use, or its removal failed. */
139
+ kept?: 'inUse' | 'unknown';
138
140
  }
141
+ /** A worktree that is no change's (a builder's, say). */
142
+ export type OtherWorktree = {
143
+ path: string;
144
+ branch?: string;
145
+ };
139
146
  export interface Clash {
140
147
  a: string;
141
148
  b: string;
@@ -160,6 +167,7 @@ export interface WorkView {
160
167
  clash?: Clash;
161
168
  clashes?: readonly Clash[];
162
169
  worktrees: readonly Worktree[];
170
+ others?: readonly OtherWorktree[];
163
171
  };
164
172
  /** Who codes and who validates, for the line under the title. */
165
173
  coder: string;