@bakers-build/addon-bakers-ui 0.6.1-next.5 → 0.6.1-next.7

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 (155) hide show
  1. package/dist/src/Component/section-list/index.d.ts +5 -5
  2. package/dist/src/Component/section-list/index.js +2 -2
  3. package/dist/src/Entity/conductor/Data/conductors.d.ts +2 -12
  4. package/dist/src/Entity/conductor/Data/conductors.js +3 -25
  5. package/dist/src/Entity/conductor/Data/own-conductor.d.ts +5 -7
  6. package/dist/src/Entity/conductor/Data/own-conductor.js +9 -16
  7. package/dist/src/Entity/project/Screen/projects-screen.js +1 -4
  8. package/dist/src/Entity/run/Component/run-detail/index.d.ts +1 -1
  9. package/dist/src/Entity/run/Component/run-detail/index.js +1 -1
  10. package/dist/src/Entity/run/Data/query.d.ts +0 -5
  11. package/dist/src/Entity/run/Data/query.js +0 -8
  12. package/dist/src/Entity/run/Data/runs.d.ts +0 -2
  13. package/dist/src/Entity/run/Data/runs.js +1 -26
  14. package/dist/src/Entity/run/Screen/run-detail.d.ts +5 -2
  15. package/dist/src/Entity/run/Screen/run-detail.js +13 -2
  16. package/dist/src/Entity/ticket/Component/edit-form/index.d.ts +1 -2
  17. package/dist/src/Entity/ticket/Component/edit-form/index.js +1 -2
  18. package/dist/src/Entity/ticket/Component/ticket-content/index.d.ts +3 -8
  19. package/dist/src/Entity/ticket/Component/ticket-content/index.js +4 -71
  20. package/dist/src/Entity/ticket/Component/ticket-content/model.d.ts +0 -25
  21. package/dist/src/Entity/ticket/Component/ticket-content/model.js +0 -195
  22. package/dist/src/Entity/ticket/Data/parents.d.ts +3 -3
  23. package/dist/src/Entity/ticket/Data/parents.js +8 -9
  24. package/dist/src/Entity/ticket/Data/query.d.ts +0 -2
  25. package/dist/src/Entity/ticket/Data/query.js +0 -8
  26. package/dist/src/Entity/ticket/Data/tickets.d.ts +0 -2
  27. package/dist/src/Entity/ticket/Data/tickets.js +1 -20
  28. package/dist/src/Entity/ticket/Data/write.d.ts +0 -32
  29. package/dist/src/Entity/ticket/Data/write.js +0 -94
  30. package/dist/src/Entity/ticket/Form/edit-data.js +10 -4
  31. package/dist/src/Entity/ticket/Form/edit-parent-source.d.ts +1 -1
  32. package/dist/src/Entity/ticket/Form/edit.d.ts +11 -8
  33. package/dist/src/Entity/ticket/Form/edit.js +1 -1
  34. package/dist/src/Entity/ticket/Form/parent-filter.d.ts +2 -2
  35. package/dist/src/Entity/ticket/Form/parent-filter.js +1 -1
  36. package/dist/src/Entity/ticket/Form/parent-source.d.ts +11 -2
  37. package/dist/src/Entity/ticket/Form/parent-source.js +5 -7
  38. package/dist/src/Entity/ticket/Screen/edit-assignment-form.d.ts +2 -2
  39. package/dist/src/Entity/ticket/Screen/edit-assignment-form.js +3 -3
  40. package/dist/src/Entity/ticket/Screen/parent-filter-form.js +3 -4
  41. package/dist/src/Entity/ticket/Screen/ticket-content-screen.d.ts +1 -1
  42. package/dist/src/Entity/ticket/Screen/ticket-content-screen.js +1 -1
  43. package/dist/src/Entity/ticket/Screen/ticket-react-markdown.js +2 -2
  44. package/dist/src/Entity/ticket/Screen/ticket-runs.d.ts +2 -0
  45. package/dist/src/Entity/ticket/Screen/ticket-runs.js +26 -16
  46. package/dist/src/Entity/ticket/Screen/ticket-search.d.ts +1 -1
  47. package/dist/src/Entity/ticket/Screen/tickets.d.ts +1 -2
  48. package/dist/src/Entity/ticket/Screen/tickets.js +0 -23
  49. package/dist/src/Entity/user/Data/member-context.d.ts +1 -1
  50. package/dist/src/Entity/user/Data/users.d.ts +17 -98
  51. package/dist/src/Entity/user/Data/users.js +27 -74
  52. package/dist/src/Entity/user/Screen/member-overview.d.ts +12 -29
  53. package/dist/src/Entity/user/Screen/member-overview.js +38 -38
  54. package/dist/src/Entity/workspace/Screen/workspace-picker.js +1 -2
  55. package/dist/src/Form/field.js +1 -1
  56. package/dist/src/Kernel/key-input.d.ts +1 -2
  57. package/dist/src/Kernel/key-input.js +1 -2
  58. package/dist/src/Kernel/logo.d.ts +3 -0
  59. package/dist/src/Kernel/logo.js +48 -0
  60. package/dist/src/Kernel/splash.js +5 -5
  61. package/dist/src/Kernel/tui-kernel.js +1 -5
  62. package/dist/src/Routing/context.d.ts +0 -5
  63. package/dist/src/Routing/context.js +0 -6
  64. package/dist/src/Routing/registry.js +3 -6
  65. package/dist/src/Routing/routes.js +1 -24
  66. package/dist/src/Screen/async-modal-screen.d.ts +1 -1
  67. package/dist/src/Screen/async-modal-screen.js +1 -1
  68. package/dist/src/Widget/chrome.d.ts +1 -1
  69. package/dist/src/Widget/chrome.js +1 -1
  70. package/dist/src/Widget/option-source.js +3 -3
  71. package/dist/src/Widget/types.d.ts +2 -3
  72. package/dist/src/index.d.ts +0 -1
  73. package/dist/src/index.js +1 -2
  74. package/dist/src/launcher.d.ts +7 -14
  75. package/dist/src/launcher.js +2 -10
  76. package/dist/src/lib/cursor.d.ts +5 -5
  77. package/dist/src/lib/cursor.js +5 -5
  78. package/dist/src/lib/refresh-signal.d.ts +2 -2
  79. package/dist/src/lib/refresh-signal.js +3 -2
  80. package/dist/src/lib/theme.d.ts +7 -23
  81. package/dist/src/lib/theme.js +7 -23
  82. package/dist/src/plugin.d.ts +1 -2
  83. package/dist/src/plugin.js +3 -7
  84. package/dist/src/react-experiment.js +0 -2
  85. package/dist/src/route.js +1 -1
  86. package/dist/src/types.d.ts +5 -56
  87. package/package.json +4 -4
  88. package/dist/src/Agent/launch.d.ts +0 -25
  89. package/dist/src/Agent/launch.js +0 -57
  90. package/dist/src/Component/badge/index.d.ts +0 -11
  91. package/dist/src/Component/badge/index.js +0 -10
  92. package/dist/src/Component/bar-chart/index.d.ts +0 -16
  93. package/dist/src/Component/bar-chart/index.js +0 -63
  94. package/dist/src/Component/heat-map/index.d.ts +0 -21
  95. package/dist/src/Component/heat-map/index.js +0 -86
  96. package/dist/src/Component/stats-panel/index.d.ts +0 -61
  97. package/dist/src/Component/stats-panel/index.js +0 -112
  98. package/dist/src/Component/team-member-workload-list/index.d.ts +0 -9
  99. package/dist/src/Component/team-member-workload-list/index.js +0 -31
  100. package/dist/src/Entity/team/Data/members.d.ts +0 -30
  101. package/dist/src/Entity/team/Data/members.js +0 -83
  102. package/dist/src/Entity/team/Data/projects.d.ts +0 -3
  103. package/dist/src/Entity/team/Data/projects.js +0 -23
  104. package/dist/src/Entity/team/Data/team.d.ts +0 -22
  105. package/dist/src/Entity/team/Data/team.js +0 -38
  106. package/dist/src/Entity/team/Data/teams.d.ts +0 -223
  107. package/dist/src/Entity/team/Data/teams.js +0 -268
  108. package/dist/src/Entity/team/Data/workload.d.ts +0 -25
  109. package/dist/src/Entity/team/Data/workload.js +0 -60
  110. package/dist/src/Entity/team/Screen/team-member-work.d.ts +0 -41
  111. package/dist/src/Entity/team/Screen/team-member-work.js +0 -56
  112. package/dist/src/Entity/team/Screen/team-users.d.ts +0 -63
  113. package/dist/src/Entity/team/Screen/team-users.js +0 -210
  114. package/dist/src/Entity/team/Screen/team-work.d.ts +0 -39
  115. package/dist/src/Entity/team/Screen/team-work.js +0 -112
  116. package/dist/src/Entity/team/Screen/teams-screen.d.ts +0 -110
  117. package/dist/src/Entity/team/Screen/teams-screen.js +0 -264
  118. package/dist/src/Entity/ticket/Component/create-form/index.d.ts +0 -28
  119. package/dist/src/Entity/ticket/Component/create-form/index.js +0 -74
  120. package/dist/src/Entity/ticket/Component/demo-statistics.d.ts +0 -14
  121. package/dist/src/Entity/ticket/Component/demo-statistics.js +0 -88
  122. package/dist/src/Entity/ticket/Component/react-statistics.d.ts +0 -14
  123. package/dist/src/Entity/ticket/Component/react-statistics.js +0 -23
  124. package/dist/src/Entity/ticket/Data/workflow.d.ts +0 -9
  125. package/dist/src/Entity/ticket/Data/workflow.js +0 -18
  126. package/dist/src/Entity/ticket/Form/create-data.d.ts +0 -75
  127. package/dist/src/Entity/ticket/Form/create-data.js +0 -217
  128. package/dist/src/Entity/ticket/Form/create.d.ts +0 -230
  129. package/dist/src/Entity/ticket/Form/create.js +0 -198
  130. package/dist/src/Entity/ticket/Screen/create-ticket-form.d.ts +0 -133
  131. package/dist/src/Entity/ticket/Screen/create-ticket-form.js +0 -621
  132. package/dist/src/Entity/ticket/Screen/ticket-agents.d.ts +0 -134
  133. package/dist/src/Entity/ticket/Screen/ticket-agents.js +0 -253
  134. package/dist/src/Entity/ticket/Screen/ticket-react.d.ts +0 -41
  135. package/dist/src/Entity/ticket/Screen/ticket-react.js +0 -136
  136. package/dist/src/Entity/ticket-template/Data/templates.d.ts +0 -26
  137. package/dist/src/Entity/ticket-template/Data/templates.js +0 -62
  138. package/dist/src/Kernel/braid.d.ts +0 -4
  139. package/dist/src/Kernel/braid.js +0 -10
  140. package/dist/src/Screen/empty-overview.d.ts +0 -9
  141. package/dist/src/Screen/empty-overview.js +0 -14
  142. package/dist/src/Statistics/client.d.ts +0 -73
  143. package/dist/src/Statistics/client.js +0 -220
  144. package/dist/src/Statistics/comparison-chart.d.ts +0 -7
  145. package/dist/src/Statistics/comparison-chart.js +0 -525
  146. package/dist/src/Statistics/dashboard.d.ts +0 -93
  147. package/dist/src/Statistics/dashboard.js +0 -206
  148. package/dist/src/Statistics/figures.d.ts +0 -18
  149. package/dist/src/Statistics/figures.js +0 -162
  150. package/dist/src/Statistics/member-stats.d.ts +0 -58
  151. package/dist/src/Statistics/member-stats.js +0 -152
  152. package/dist/src/Statistics/presentation.d.ts +0 -8
  153. package/dist/src/Statistics/presentation.js +0 -36
  154. package/dist/src/Statistics/screen.d.ts +0 -44
  155. package/dist/src/Statistics/screen.js +0 -204
@@ -1,5 +1,4 @@
1
1
  import { lineText, panelSectionKey, styledOf, } from '../../../../Component/section-list/index.js';
2
- import { compareRunsNewestFirst } from '../../../run/Data/runs.js';
3
2
  import { relativeCreated } from '../comment-item/index.js';
4
3
  import { TICKET_SECTIONS } from '../sections/index.js';
5
4
  import { commentItems, descriptionSummary, firstLineSummary, headerCreatedBy, sectionsForTab, } from '../ticket-detail/index.js';
@@ -200,194 +199,6 @@ const relatedProperties = (document) => [
200
199
  ...relatedTicketProperties(document, 'blocked_by', 'blocked by'),
201
200
  ...relatedTicketProperties(document, 'referenced_tickets', 'referenced'),
202
201
  ];
203
- const parseMetricNumber = (value) => {
204
- if (typeof value === 'number' && Number.isFinite(value))
205
- return value;
206
- const raw = asString(value);
207
- if (raw === undefined)
208
- return undefined;
209
- const numeric = Number(raw);
210
- return Number.isFinite(numeric) ? numeric : undefined;
211
- };
212
- const METRIC_LABEL = {
213
- ac_pass_rate: 'AC',
214
- review_bounces: 'bounce',
215
- time_to_done_h: 'time',
216
- rework_followups: 'rework',
217
- human_interventions: 'human',
218
- 'job_rating.score': 'score',
219
- };
220
- const metricLabel = (name) => METRIC_LABEL[name] ?? name.replaceAll('_', ' ').replaceAll('.', ' ');
221
- const clamp01 = (value) => Math.min(1, Math.max(0, value));
222
- const intensityAgainst = (value, cap) => cap <= 0 ? 0 : clamp01(value / cap);
223
- const attrNumber = (attributes, name) => {
224
- const numeric = parseMetricNumber(attributes?.[name]);
225
- return numeric === undefined ? 0 : numeric;
226
- };
227
- const runResources = (document) => (document.included ?? [])
228
- .filter((resource) => resource.type === 'bb_run--bb_run')
229
- .slice()
230
- .sort(compareRunsNewestFirst);
231
- export const FOOTPRINT_COLUMNS = [
232
- { key: 'tokens', label: 'tok' },
233
- { key: 'duration_s', label: 'dur' },
234
- { key: 'agent_turns', label: 'trn' },
235
- { key: 'tool_calls', label: 'tl' },
236
- ];
237
- const MAX_MATRIX_RUNS = 12;
238
- const formatCompact = (value) => {
239
- const abs = Math.abs(value);
240
- if (abs >= 1_000_000) {
241
- const scaled = value / 1_000_000;
242
- return `${scaled >= 10 ? scaled.toFixed(0) : scaled.toFixed(1).replace(/\.0$/, '')}m`;
243
- }
244
- if (abs >= 1000) {
245
- const scaled = value / 1000;
246
- return `${scaled >= 10 ? scaled.toFixed(0) : scaled.toFixed(1).replace(/\.0$/, '')}k`;
247
- }
248
- return String(Math.round(value));
249
- };
250
- const formatDurationCell = (seconds) => {
251
- if (seconds < 60)
252
- return `${Math.round(seconds)}s`;
253
- if (seconds < 3600)
254
- return `${Math.round(seconds / 60)}m`;
255
- const hours = seconds / 3600;
256
- return `${hours >= 10 ? hours.toFixed(0) : hours.toFixed(1).replace(/\.0$/, '')}h`;
257
- };
258
- const footprintDisplay = (key, value) => {
259
- if (key === 'tokens')
260
- return formatCompact(value);
261
- if (key === 'duration_s')
262
- return formatDurationCell(value);
263
- return String(Math.round(value));
264
- };
265
- const ticketMetricCell = (name, value, unit) => {
266
- const numeric = parseMetricNumber(value);
267
- if (numeric === undefined)
268
- return undefined;
269
- if (name === 'job_rating.score') {
270
- return {
271
- intensity: intensityAgainst(numeric, 5),
272
- display: String(Math.round(numeric)),
273
- };
274
- }
275
- const isRatio = unit === 'ratio' || (unit === undefined && name.endsWith('_rate'));
276
- if (isRatio) {
277
- const ratio = numeric > 1 ? numeric / 100 : numeric;
278
- return {
279
- intensity: clamp01(ratio),
280
- display: `${Math.round(ratio * 100)}%`,
281
- };
282
- }
283
- if (unit === 'h' || name.endsWith('_h')) {
284
- return {
285
- intensity: intensityAgainst(numeric, 48),
286
- display: `${formatCompact(numeric)}h`,
287
- };
288
- }
289
- return {
290
- intensity: intensityAgainst(numeric, 5),
291
- display: formatCompact(numeric),
292
- };
293
- };
294
- const ticketMetricColumns = (document) => {
295
- const raw = document.data?.attributes?.metrics;
296
- const rows = Array.isArray(raw) ? raw : [];
297
- const columns = [];
298
- const cells = [];
299
- let score;
300
- const extras = [];
301
- for (const row of rows) {
302
- if (row === null || typeof row !== 'object')
303
- continue;
304
- const metric = row;
305
- const name = asString(metric.name);
306
- if (name === undefined)
307
- continue;
308
- const cell = ticketMetricCell(name, metric.value, asString(metric.unit));
309
- if (cell === undefined)
310
- continue;
311
- const column = { key: name, label: metricLabel(name) };
312
- if (name === 'job_rating.score')
313
- score = { column, cell };
314
- else
315
- extras.push({ column, cell });
316
- }
317
- if (score !== undefined) {
318
- columns.push(score.column);
319
- cells.push(score.cell);
320
- }
321
- for (const extra of extras) {
322
- columns.push(extra.column);
323
- cells.push(extra.cell);
324
- }
325
- return { columns, cells };
326
- };
327
- const runLabel = (attributes, id) => {
328
- const internal = attributes?.drupal_internal__id;
329
- if (typeof internal === 'number' || typeof internal === 'string') {
330
- return `#${internal}`;
331
- }
332
- return id.slice(0, 6);
333
- };
334
- const EMPTY_GRID = { columns: [], rows: [] };
335
- const normalizeRunRows = (rows) => {
336
- const width = rows[0]?.values.length ?? 0;
337
- const peaks = Array.from({ length: width }, (_unused, column) => {
338
- let peak = 0;
339
- for (const row of rows) {
340
- const value = row.values[column];
341
- if (typeof value === 'number' && value > peak)
342
- peak = value;
343
- }
344
- return peak;
345
- });
346
- return rows.map((row) => ({
347
- id: row.id,
348
- label: row.label,
349
- cells: row.values.map((value, column) => {
350
- const peak = peaks[column] ?? 0;
351
- return {
352
- intensity: peak > 0 ? clamp01(value / peak) : 0,
353
- display: row.displays[column] ?? String(value),
354
- value,
355
- };
356
- }),
357
- }));
358
- };
359
- const metricMatrix = (document) => {
360
- const runs = runResources(document).slice(0, MAX_MATRIX_RUNS);
361
- const ticket = ticketMetricColumns(document);
362
- const footprint = FOOTPRINT_COLUMNS.filter((column) => runs.some((run) => attrNumber(run.attributes, column.key) > 0));
363
- const ticketGrid = ticket.columns.length === 0
364
- ? EMPTY_GRID
365
- : {
366
- columns: ticket.columns,
367
- rows: [
368
- {
369
- id: 'ticket',
370
- label: '',
371
- cells: ticket.cells.map((cell) => ({
372
- intensity: cell.intensity,
373
- display: cell.display,
374
- })),
375
- },
376
- ],
377
- };
378
- const runsGrid = footprint.length === 0 || runs.length === 0
379
- ? EMPTY_GRID
380
- : {
381
- columns: footprint,
382
- rows: normalizeRunRows(runs.map((run) => ({
383
- id: run.id ?? '',
384
- label: runLabel(run.attributes, run.id ?? ''),
385
- values: footprint.map((column) => attrNumber(run.attributes, column.key)),
386
- displays: footprint.map((column) => footprintDisplay(column.key, attrNumber(run.attributes, column.key))),
387
- }))),
388
- };
389
- return { ticket: ticketGrid, runs: runsGrid };
390
- };
391
202
  const originProperty = (document, key = 'origin') => {
392
203
  const origin = asString(document.data?.attributes?.origin);
393
204
  if (origin === undefined)
@@ -421,10 +232,6 @@ const overviewModel = (document, labels, nowSeconds, baseUrl) => {
421
232
  const links = origin === undefined
422
233
  ? listedLinks
423
234
  : [origin, ...listedLinks.filter((item) => item.value !== 'none')];
424
- const matrix = metricMatrix(document);
425
- // Stats are a retrospective: they only make sense — and only appear — once the
426
- // ticket has reached `done`, never mid-flight.
427
- const isDone = document.data?.attributes?.state === 'done';
428
235
  return {
429
236
  entries: [
430
237
  ...documents,
@@ -434,8 +241,6 @@ const overviewModel = (document, labels, nowSeconds, baseUrl) => {
434
241
  details,
435
242
  links,
436
243
  related: relatedProperties(document),
437
- matrix,
438
- showMetrics: isDone,
439
244
  },
440
245
  };
441
246
  };
@@ -21,15 +21,15 @@ export declare const PARENT_PAGE_SIZE = 50;
21
21
  * One project's tickets matching `query`, as parent candidates.
22
22
  *
23
23
  * `match` picks how wide `query` matches: `'identifier+title'` (the default,
24
- * the create form's behaviour — BB-257 S5) is the builder's free-text OR
24
+ * the edit form's Parent field — BB-257 S5) is the builder's free-text OR
25
25
  * group; `'identifier'` (the parent FILTER picker — BB-284, PM steer) is a
26
26
  * top-level `identifier CONTAINS` added after the builder, because the
27
27
  * operator filtering a list knows the identifier, not the title. The
28
28
  * identifier path also carries `filter[has_children]=1` (BB-300 D1): the
29
29
  * picker offers only tickets that HAVE children, answered server-side by
30
- * bb_core's HasChildrenFilterSubscriber; the create form emits no such
30
+ * bb_core's HasChildrenFilterSubscriber; the edit form emits no such
31
31
  * filter, because a ticket must be fileable under a childless parent. The
32
- * `closed` filter runs the other way round (BB-309 D13): the create form
32
+ * `closed` filter runs the other way round (BB-309 D13): the edit form
33
33
  * offers OPEN tickets only, the filter picker sends no `closed` filter at all.
34
34
  *
35
35
  * Yields the OUTCOME rather than a swallowed array, so the adapter can record a
@@ -8,7 +8,7 @@
8
8
  // screen's `/` search uses, and that reuse is the argument rather than a
9
9
  // convenience: it already implements the project filter plus the free-text
10
10
  // search, so the parent picker cannot drift from the ticket list. How WIDE the
11
- // search matches is the caller's choice (`match`): the create form keeps the
11
+ // search matches is the caller's choice (`match`): the edit form keeps the
12
12
  // builder's server-resolved identifier+title search (BB-257 S5), while the parent FILTER
13
13
  // picker matches by identifier only — the operator knows `BB-273`, not the
14
14
  // title (BB-284, PM steer during coding) — and asks for tickets WITH
@@ -46,15 +46,15 @@ const toCandidate = (item) => {
46
46
  * One project's tickets matching `query`, as parent candidates.
47
47
  *
48
48
  * `match` picks how wide `query` matches: `'identifier+title'` (the default,
49
- * the create form's behaviour — BB-257 S5) is the builder's free-text OR
49
+ * the edit form's Parent field — BB-257 S5) is the builder's free-text OR
50
50
  * group; `'identifier'` (the parent FILTER picker — BB-284, PM steer) is a
51
51
  * top-level `identifier CONTAINS` added after the builder, because the
52
52
  * operator filtering a list knows the identifier, not the title. The
53
53
  * identifier path also carries `filter[has_children]=1` (BB-300 D1): the
54
54
  * picker offers only tickets that HAVE children, answered server-side by
55
- * bb_core's HasChildrenFilterSubscriber; the create form emits no such
55
+ * bb_core's HasChildrenFilterSubscriber; the edit form emits no such
56
56
  * filter, because a ticket must be fileable under a childless parent. The
57
- * `closed` filter runs the other way round (BB-309 D13): the create form
57
+ * `closed` filter runs the other way round (BB-309 D13): the edit form
58
58
  * offers OPEN tickets only, the filter picker sends no `closed` filter at all.
59
59
  *
60
60
  * Yields the OUTCOME rather than a swallowed array, so the adapter can record a
@@ -66,12 +66,11 @@ export async function loadParentCandidates(client, projectId, query, match = 'id
66
66
  query: match === 'identifier' ? '' : query,
67
67
  state: null,
68
68
  // BB-309 D13 — the two callers answer different questions, so they
69
- // filter differently. The CREATE FORM offers OPEN tickets only
70
- // (`filter[closed]=0`): filing new work under a parent that is already
69
+ // filter differently. The EDIT FORM offers OPEN tickets only
70
+ // (`filter[closed]=0`): filing work under a parent that is already
71
71
  // finished is not a case the form should present. That reverses the
72
72
  // rationale this line carried until BB-309 ("the parent picker must
73
- // still find a closed ticket to attach a follow-up to", BB-257 D6) —
74
- // reversed by the human during `coding`, for the create form ALONE.
73
+ // still find a closed ticket to attach a follow-up to", BB-257 D6).
75
74
  // The parent FILTER picker keeps `null`, i.e. no `closed` filter at all:
76
75
  // narrowing a ticket list by a parent that has since been closed is
77
76
  // legitimate, and its children may well still be open.
@@ -97,7 +96,7 @@ export async function loadParentCandidates(client, projectId, query, match = 'id
97
96
  // BB-300 D1 — the parent FILTER picker offers only tickets that have
98
97
  // children; the server rewrites this param into a stock id IN (…) filter
99
98
  // (bb_core's HasChildrenFilterSubscriber), so paging stays honest. The
100
- // create form (identifier+title) deliberately emits NO such filter: it must
99
+ // edit form (identifier+title) deliberately emits NO such filter: it must
101
100
  // be able to file a ticket under a childless parent.
102
101
  if (match === 'identifier')
103
102
  params.addFilter('has_children', '1');
@@ -82,8 +82,6 @@ export declare function buildTicketQueryParams(projectId: string, criteria: Tick
82
82
  * scope is `assignee_user_id.id` instead of `project_id.id`.
83
83
  */
84
84
  export declare function buildUserTicketQueryParams(userId: string, criteria: TicketCriteria, options?: TicketQueryOptions): DrupalJsonApiParams;
85
- /** One assignee, constrained to the projects linked to the selected team. */
86
- export declare function buildTeamMemberTicketQueryParams(userId: string, projectIds: string[], criteria: TicketCriteria, options?: TicketQueryOptions): DrupalJsonApiParams;
87
85
  /**
88
86
  * Build the JSON:API query for the tickets assigned to one conductor —
89
87
  * open only, newest-changed first. Not project-scoped: a conductor may serve
@@ -91,14 +91,6 @@ export function buildUserTicketQueryParams(userId, criteria, options = {}) {
91
91
  });
92
92
  return params;
93
93
  }
94
- /** One assignee, constrained to the projects linked to the selected team. */
95
- export function buildTeamMemberTicketQueryParams(userId, projectIds, criteria, options = {}) {
96
- const params = new DrupalJsonApiParams();
97
- params.addFilter('assignee_user_id.id', userId);
98
- params.addFilter('project_id.id', projectIds, 'IN');
99
- applyTicketCriteria(params, criteria, options);
100
- return params;
101
- }
102
94
  /**
103
95
  * Build the JSON:API query for the tickets assigned to one conductor —
104
96
  * open only, newest-changed first. Not project-scoped: a conductor may serve
@@ -361,8 +361,6 @@ export declare function loadFilteredTickets(client: DropshClient, projectId: str
361
361
  export declare function loadFilteredUserTickets(client: DropshClient, userId: string, criteria: TicketCriteria, page?: number): Promise<TicketPage>;
362
362
  /** One page of tickets assigned to a user (BB-377 D2). */
363
363
  export declare function loadUserTickets(client: DropshClient, userId: string, criteria: TicketCriteria, page?: number): Promise<TicketPage>;
364
- /** One page assigned to a member within a team's linked project set. */
365
- export declare function loadTeamMemberTickets(client: DropshClient, userId: string, projectIds: string[], criteria: TicketCriteria, page?: number): Promise<TicketPage>;
366
364
  /** Every open ticket assigned to one user, or an error instead of a prefix. */
367
365
  export declare function loadAllUserTickets(client: DropshClient, userId: string, criteria: TicketCriteria): Promise<TicketPage>;
368
366
  export {};
@@ -5,7 +5,7 @@
5
5
  import { asString } from '../../../lib/format.js';
6
6
  import { loadPage, } from '../../collection.js';
7
7
  import { LIST_PAGE_SIZE } from '../../cycle.js';
8
- import { buildTeamMemberTicketQueryParams, buildTicketQueryParams, buildUserTicketQueryParams, } from './query.js';
8
+ import { buildTicketQueryParams, buildUserTicketQueryParams, } from './query.js';
9
9
  /** Build the {@link IncludedIndex} from a document's `included` array. */
10
10
  function indexIncluded(included) {
11
11
  const index = new Map();
@@ -376,25 +376,6 @@ export async function loadUserTickets(client, userId, criteria, page = 0) {
376
376
  return data.map((item) => mapTicketData(item, index));
377
377
  }, page, window);
378
378
  }
379
- /** One page assigned to a member within a team's linked project set. */
380
- export async function loadTeamMemberTickets(client, userId, projectIds, criteria, page = 0) {
381
- if (projectIds.length === 0) {
382
- return { rows: [], hasNext: false, page, total: 0, window: null };
383
- }
384
- const window = {
385
- offset: page * LIST_PAGE_SIZE,
386
- limit: LIST_PAGE_SIZE,
387
- };
388
- const params = buildTeamMemberTicketQueryParams(userId, projectIds, criteria, { page: { size: window.limit, index: page } });
389
- const result = await loadPage(client, 'bb_ticket/bb_ticket', params, (data, included) => {
390
- const index = indexIncluded(included);
391
- return data.map((item) => mapTicketData(item, index));
392
- }, page, window);
393
- if (result.withheld) {
394
- throw new Error('the control plane withheld team member ticket rows');
395
- }
396
- return result;
397
- }
398
379
  /** Every open ticket assigned to one user, or an error instead of a prefix. */
399
380
  export async function loadAllUserTickets(client, userId, criteria) {
400
381
  const rows = [];
@@ -1,5 +1,4 @@
1
1
  import type { DropshClient, ResourceWriteBody } from '../../../types.js';
2
- import type { CreateFormPayload } from '../Form/create.js';
3
2
  /** The JSON:API resource type every ticket write addresses. */
4
3
  export declare const TICKET_TYPE = "bb_ticket--bb_ticket";
5
4
  /**
@@ -18,34 +17,3 @@ export declare function updateTicketAssignment(client: DropshClient | undefined,
18
17
  * can put the server's words on the status line.
19
18
  */
20
19
  export declare function updateTicketFrozen(client: DropshClient | undefined, ticketId: string, frozen: boolean): Promise<unknown>;
21
- /** The text format every ticket description is stored in (`bb_rich`). */
22
- export declare const TICKET_DESCRIPTION_FORMAT = "bb_rich";
23
- /**
24
- * The create body for a directly-created ticket (BB-309 D4/D5).
25
- *
26
- * Pure: the payload in, the JSON:API document out, no client and no I/O — so
27
- * every claim about what a direct create writes is a unit test rather than a
28
- * live observation.
29
- *
30
- * Two rules are load-bearing and stated here because this is where they are
31
- * visible:
32
- *
33
- * 1. NOTHING server-owned is written — no `state` (the server lands the
34
- * ticket in the workflow's first state), no `identifier`, no `number`, no
35
- * `branch_name`, no `base_branch`. Acceptance criterion 5 is satisfied by
36
- * OMISSION, which is also what `@bakers-build/bb-create-ticket` does.
37
- * 2. A relationship with nothing picked is OMITTED, not sent as an explicit
38
- * `null`. A create has nothing to unset, so `null` would carry no
39
- * information a missing key does not — the exact opposite of the PATCH in
40
- * `Form/edit.ts`, which must send both linkages because an omitted field
41
- * cannot mean "remove it".
42
- */
43
- export declare function buildTicketCreateBody(payload: CreateFormPayload, projectId: string): ResourceWriteBody;
44
- /**
45
- * POST one `bb_ticket`.
46
- *
47
- * A rejection is deliberately NOT caught here, for the same reason
48
- * `updateTicketAssignment` does not catch one: only the caller knows where the
49
- * message belongs (spec D6).
50
- */
51
- export declare function createTicket(client: DropshClient | undefined, body: ResourceWriteBody): Promise<unknown>;
@@ -25,97 +25,3 @@ export function updateTicketAssignment(client, ticketId, body) {
25
25
  export function updateTicketFrozen(client, ticketId, frozen) {
26
26
  return updateTicketAssignment(client, ticketId, { attributes: { frozen } });
27
27
  }
28
- /** The text format every ticket description is stored in (`bb_rich`). */
29
- export const TICKET_DESCRIPTION_FORMAT = 'bb_rich';
30
- /** A JSON:API to-one linkage, or nothing at all. */
31
- const one = (type, id) => id ? { data: { type, id } } : undefined;
32
- /**
33
- * The create body for a directly-created ticket (BB-309 D4/D5).
34
- *
35
- * Pure: the payload in, the JSON:API document out, no client and no I/O — so
36
- * every claim about what a direct create writes is a unit test rather than a
37
- * live observation.
38
- *
39
- * Two rules are load-bearing and stated here because this is where they are
40
- * visible:
41
- *
42
- * 1. NOTHING server-owned is written — no `state` (the server lands the
43
- * ticket in the workflow's first state), no `identifier`, no `number`, no
44
- * `branch_name`, no `base_branch`. Acceptance criterion 5 is satisfied by
45
- * OMISSION, which is also what `@bakers-build/bb-create-ticket` does.
46
- * 2. A relationship with nothing picked is OMITTED, not sent as an explicit
47
- * `null`. A create has nothing to unset, so `null` would carry no
48
- * information a missing key does not — the exact opposite of the PATCH in
49
- * `Form/edit.ts`, which must send both linkages because an omitted field
50
- * cannot mean "remove it".
51
- */
52
- export function buildTicketCreateBody(payload, projectId) {
53
- const relationships = {
54
- project_id: {
55
- data: { type: 'bb_project--bb_project', id: projectId },
56
- },
57
- };
58
- const assignee = one('user--user', payload.assignee?.id);
59
- if (assignee)
60
- relationships.assignee_user_id = assignee;
61
- const conductor = one('bb_conductor--bb_conductor', payload.conductor?.id);
62
- if (conductor)
63
- relationships.conductor_id = conductor;
64
- const ticketType = one('bb_term--type', payload.ticketType?.id);
65
- if (ticketType)
66
- relationships.ticket_type = ticketType;
67
- const recipe = one('bb_term--recipe', payload.recipe?.id);
68
- if (recipe)
69
- relationships.recipe = recipe;
70
- if (payload.labels.length > 0) {
71
- relationships.labels = {
72
- data: payload.labels.map((l) => ({
73
- type: 'bb_term--label',
74
- id: l.id,
75
- })),
76
- };
77
- }
78
- if (payload.reviewers.length > 0) {
79
- relationships.reviewers = {
80
- data: payload.reviewers.map((r) => ({
81
- type: 'user--user',
82
- id: r.id,
83
- })),
84
- };
85
- }
86
- const parent = one('bb_ticket--bb_ticket', payload.parent?.id);
87
- if (parent)
88
- relationships.parent_id = parent;
89
- return {
90
- attributes: {
91
- // TRIMMED, because `Agent/launch.ts`'s `shortName()` already trims the
92
- // same field: without this the agent's tab read `Fix the thing` while the
93
- // ticket it created read ` Fix the thing `, and the server stores what
94
- // it is sent. The description is NOT trimmed — it is prose, and its
95
- // leading blanks can be Markdown.
96
- title: payload.title.trim(),
97
- // VERBATIM: what the operator typed, stored as-is. `bb_rich` renders it
98
- // as Markdown, so raw HTML is stripped on RENDER — a property of the
99
- // format, not of this write (spec R2).
100
- description: {
101
- value: payload.description,
102
- format: TICKET_DESCRIPTION_FORMAT,
103
- },
104
- ...(payload.workflow ? { workflow: payload.workflow.id } : {}),
105
- },
106
- relationships,
107
- };
108
- }
109
- /**
110
- * POST one `bb_ticket`.
111
- *
112
- * A rejection is deliberately NOT caught here, for the same reason
113
- * `updateTicketAssignment` does not catch one: only the caller knows where the
114
- * message belongs (spec D6).
115
- */
116
- export function createTicket(client, body) {
117
- if (!client) {
118
- return Promise.reject(new Error('no write client — `bakers ui` resolved no connection able to write'));
119
- }
120
- return client.create(TICKET_TYPE, body);
121
- }
@@ -1,5 +1,4 @@
1
- // BB-236 — the ADAPTER between the data services and the EDIT popup, and a sibling
2
- // of `loadCreateFormOptions` rather than a parameterisation of it. A data service
1
+ // BB-236 — the ADAPTER between the data services and the EDIT popup. A data service
3
2
  // (`users.ts`, `conductors.ts`, `terms.ts`) returns data and knows nothing about forms;
4
3
  // this module knows both sides and therefore owns the mapping to `Option` and this
5
4
  // popup's policy: read write-client-first for users/conductors, drop Anonymous, filter
@@ -8,15 +7,22 @@
8
7
  // Type and Recipe selects), and reorder ONLY the
9
8
  // conductor ring owner-first (BB-460) — the assignee ring is unordered because
10
9
  // the popup preselects the ticket's current assignee. Each rule has exactly one
11
- // user, so each is written once, here, beside the create adapter it differs from.
10
+ // user, so each is written once, here.
12
11
  //
13
12
  // BB-360: labels bag replaces the constant State select targets. Parent typeahead
14
13
  // is an OptionSource on the screen, not a batch bag here.
15
14
  import { listConductorsPreferringWrite, } from '../../conductor/Data/conductors.js';
16
15
  import { listTerms } from '../../term/Data/terms.js';
17
16
  import { listUsersPreferringWrite } from '../../user/Data/users.js';
18
- import { ownFirst } from './create-data.js';
19
17
  import { loadReviewerOptions } from './reviewer-options.js';
18
+ /**
19
+ * Stable-partition the matching rows to the front: index 0 is what a ring
20
+ * defaults to.
21
+ */
22
+ const ownFirst = (rows, isOwn) => [
23
+ ...rows.filter(isOwn),
24
+ ...rows.filter((row) => !isOwn(row)),
25
+ ];
20
26
  /** The vocabulary this popup offers as its labels (BB-360 D9 / D11). */
21
27
  const LABEL_VOCABULARY = 'label';
22
28
  /** The vocabularies of the single-valued `ticket_type` / `recipe` (BAKERS-17). */
@@ -1,6 +1,6 @@
1
1
  import type { DropshClient } from '../../../types.js';
2
2
  import type { OptionSource } from '../../../Widget/index.js';
3
- import type { ParentOption } from './create.js';
3
+ import { type ParentOption } from './parent-source.js';
4
4
  /**
5
5
  * Parent candidates for the edit popup: project-scoped, identifier+title match,
6
6
  * excluding `ticketId` so an operator cannot parent a ticket to itself.
@@ -1,6 +1,9 @@
1
- import { type FormState } from '../../../Form/index.js';
1
+ import { type FieldDecl, type FormState, type Option } from '../../../Form/index.js';
2
2
  import type { TicketDetailDocument } from '../../../types.js';
3
- import type { FieldDef, Option } from './create.js';
3
+ /** A declared field with a narrowed `id` — what the edit popup's field lists are. */
4
+ export type FieldDef<Id extends string = string> = Omit<FieldDecl, 'id'> & {
5
+ id: Id;
6
+ };
4
7
  export type EditFieldId = 'assignee' | 'reviewers' | 'conductor' | 'estimate' | 'spent' | 'parent' | 'ticketType' | 'recipe' | 'labels' | 'submit' | 'cancelTicket';
5
8
  /**
6
9
  * BB-313 / BB-360 — the ONE lifecycle move this popup offers, as a named
@@ -126,8 +129,8 @@ export interface CancelEditPayload {
126
129
  }
127
130
  /** The ordinary popup: a non-terminal ticket can be cancelled from it. */
128
131
  export declare const EDIT_FORM: {
129
- fields: import("../../../Form/field.js").FieldDecl[];
130
- activeField: (s: FormState<EditValues>) => import("../../../Form/field.js").FieldDecl;
132
+ fields: FieldDecl[];
133
+ activeField: (s: FormState<EditValues>) => FieldDecl;
131
134
  move: (s: FormState<EditValues>, d: number) => FormState<EditValues>;
132
135
  initial(options: EditFormOptions, prefill?: Partial<EditValues>): FormState<EditValues>;
133
136
  apply(s: FormState<EditValues>, options: EditFormOptions, intent: import("../../../Form/form.js").Intent): FormState<EditValues>;
@@ -135,8 +138,8 @@ export declare const EDIT_FORM: {
135
138
  };
136
139
  /** A terminal ticket's popup: assignment, times, structure — no Cancel ticket. */
137
140
  export declare const EDIT_FORM_TERMINAL: {
138
- fields: import("../../../Form/field.js").FieldDecl[];
139
- activeField: (s: FormState<EditValues>) => import("../../../Form/field.js").FieldDecl;
141
+ fields: FieldDecl[];
142
+ activeField: (s: FormState<EditValues>) => FieldDecl;
140
143
  move: (s: FormState<EditValues>, d: number) => FormState<EditValues>;
141
144
  initial(options: EditFormOptions, prefill?: Partial<EditValues>): FormState<EditValues>;
142
145
  apply(s: FormState<EditValues>, options: EditFormOptions, intent: import("../../../Form/form.js").Intent): FormState<EditValues>;
@@ -147,8 +150,8 @@ export declare const EDIT_FORM_TERMINAL: {
147
150
  * freezes a ticket on its stored `closed` flag and answers any PATCH with 403.
148
151
  */
149
152
  export declare const EDIT_FORM_CLOSED: {
150
- fields: import("../../../Form/field.js").FieldDecl[];
151
- activeField: (s: FormState<EditValues>) => import("../../../Form/field.js").FieldDecl;
153
+ fields: FieldDecl[];
154
+ activeField: (s: FormState<EditValues>) => FieldDecl;
152
155
  move: (s: FormState<EditValues>, d: number) => FormState<EditValues>;
153
156
  initial(options: EditFormOptions, prefill?: Partial<EditValues>): FormState<EditValues>;
154
157
  apply(s: FormState<EditValues>, options: EditFormOptions, intent: import("../../../Form/form.js").Intent): FormState<EditValues>;
@@ -9,7 +9,7 @@
9
9
  // `f.action` whose id is never `cancel` — that intent closes the popup (Esc).
10
10
  // Two declarations from one body: a terminal ticket's popup simply omits the
11
11
  // Cancel ticket action (D3), and `editFormFor` picks between them.
12
- import { declareForm } from '../../../Form/index.js';
12
+ import { declareForm, } from '../../../Form/index.js';
13
13
  import { formatDuration, parseDuration } from '../../../lib/format.js';
14
14
  import { PARENT_PAGE_SIZE } from '../Data/parents.js';
15
15
  /**
@@ -1,5 +1,5 @@
1
1
  import { type FormState } from '../../../Form/index.js';
2
- import type { ParentOption } from './create.js';
2
+ import type { ParentOption } from './parent-source.js';
3
3
  export interface ParentFilterValues {
4
4
  /** The PICKED parent's uuid, or null. `parentQuery` holds what was typed. */
5
5
  parent: string | null;
@@ -9,7 +9,7 @@ export interface ParentFilterOptions {
9
9
  /**
10
10
  * The parent candidates. Optional so an ABSENT bag ("nothing can be offered")
11
11
  * stays distinguishable from an empty one ("searched, nothing matched") — the
12
- * same rule as the create form's `parents` bag (BB-257 D8).
12
+ * same rule as the edit form's `parents` bag (BB-257 D8).
13
13
  */
14
14
  parents?: ParentOption[] | undefined;
15
15
  errors?: {
@@ -5,7 +5,7 @@
5
5
  // `Form/`; nothing of them is repeated here.
6
6
  //
7
7
  // AC-4: this screen's only ticket read is `loadParentCandidates`, composed as
8
- // `parentOptionSource` (D5) — the same source the create form's Parent field
8
+ // `parentOptionSource` (D5) — the same source the edit form's Parent field
9
9
  // loads through, never a second lookup path.
10
10
  import { declareForm } from '../../../Form/index.js';
11
11
  import { PARENT_PAGE_SIZE } from '../Data/parents.js';
@@ -1,7 +1,16 @@
1
+ import type { Option } from '../../../Form/index.js';
1
2
  import type { DropshClient } from '../../../types.js';
2
3
  import type { OptionSource } from '../../../Widget/index.js';
3
4
  import { type ParentCandidate } from '../Data/parents.js';
4
- import type { ParentOption } from './create.js';
5
+ /**
6
+ * A parent candidate as the pickers offer it (BB-257 D5): a kernel `Option`,
7
+ * filtered by `label`, that also carries the parent's own identifier and title
8
+ * so nothing has to parse the composed label back apart.
9
+ */
10
+ export interface ParentOption extends Option {
11
+ identifier: string;
12
+ title: string;
13
+ }
5
14
  /**
6
15
  * `BB-nnn · <title>` — the picker label, composed HERE (BB-257 D5).
7
16
  *
@@ -20,7 +29,7 @@ export declare const parentLabel: (row: ParentCandidate) => string;
20
29
  * `loadParentCandidates` builds its query with `parent: null` criteria, so an
21
30
  * active parent filter can never narrow the picker to that parent's children.
22
31
  *
23
- * `match` is forwarded to the read: the create form searches identifier AND
32
+ * `match` is forwarded to the read: the edit form searches identifier AND
24
33
  * title (default), the parent FILTER picker matches by identifier only
25
34
  * (BB-284, PM steer — the operator knows `BB-273`, not the title).
26
35
  */