@contraagent/ui 0.8.0 → 0.9.0

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 (115) hide show
  1. package/README.md +1 -1
  2. package/custom-elements.json +104 -78
  3. package/dist/adapters/journal-columns.d.ts +2 -0
  4. package/dist/adapters/journal-columns.d.ts.map +1 -1
  5. package/dist/adapters/journal-columns.js +19 -6
  6. package/dist/adapters/journal-columns.js.map +1 -1
  7. package/dist/adapters/kpi-tiles.d.ts +8 -3
  8. package/dist/adapters/kpi-tiles.d.ts.map +1 -1
  9. package/dist/adapters/kpi-tiles.js +35 -15
  10. package/dist/adapters/kpi-tiles.js.map +1 -1
  11. package/dist/adapters/transcript/sections.d.ts +5 -0
  12. package/dist/adapters/transcript/sections.d.ts.map +1 -1
  13. package/dist/adapters/transcript/sections.js +7 -1
  14. package/dist/adapters/transcript/sections.js.map +1 -1
  15. package/dist/contraagent-ui.js +689 -700
  16. package/dist/elements/lists/ca-contracts.d.ts +3 -4
  17. package/dist/elements/lists/ca-contracts.d.ts.map +1 -1
  18. package/dist/elements/lists/ca-contracts.js +25 -19
  19. package/dist/elements/lists/ca-contracts.js.map +1 -1
  20. package/dist/elements/overview/ca-kpis.d.ts +3 -1
  21. package/dist/elements/overview/ca-kpis.d.ts.map +1 -1
  22. package/dist/elements/overview/ca-kpis.js +7 -2
  23. package/dist/elements/overview/ca-kpis.js.map +1 -1
  24. package/dist/elements/overview/ca-model-usage.d.ts +2 -1
  25. package/dist/elements/overview/ca-model-usage.d.ts.map +1 -1
  26. package/dist/elements/overview/ca-model-usage.js +3 -2
  27. package/dist/elements/overview/ca-model-usage.js.map +1 -1
  28. package/dist/elements/overview/ca-overview.d.ts +1 -5
  29. package/dist/elements/overview/ca-overview.d.ts.map +1 -1
  30. package/dist/elements/overview/ca-overview.js +53 -77
  31. package/dist/elements/overview/ca-overview.js.map +1 -1
  32. package/dist/elements/overview/ca-pipeline-graph.d.ts +8 -1
  33. package/dist/elements/overview/ca-pipeline-graph.d.ts.map +1 -1
  34. package/dist/elements/overview/ca-pipeline-graph.js +11 -6
  35. package/dist/elements/overview/ca-pipeline-graph.js.map +1 -1
  36. package/dist/elements/overview/ca-run-driver.d.ts.map +1 -1
  37. package/dist/elements/overview/ca-run-driver.js +6 -5
  38. package/dist/elements/overview/ca-run-driver.js.map +1 -1
  39. package/dist/elements/overview/ca-workers.js +1 -1
  40. package/dist/elements/overview/pipeline-graph/strings.js +3 -3
  41. package/dist/elements/overview/pipeline-graph/strings.js.map +1 -1
  42. package/dist/elements/shared/ca-definition.d.ts.map +1 -1
  43. package/dist/elements/shared/ca-definition.js +1 -2
  44. package/dist/elements/shared/ca-definition.js.map +1 -1
  45. package/dist/elements/shell/ca-hosts.d.ts.map +1 -1
  46. package/dist/elements/shell/ca-hosts.js +1 -2
  47. package/dist/elements/shell/ca-hosts.js.map +1 -1
  48. package/dist/elements/shell/ca-monitor.d.ts +3 -1
  49. package/dist/elements/shell/ca-monitor.d.ts.map +1 -1
  50. package/dist/elements/shell/ca-monitor.js +20 -9
  51. package/dist/elements/shell/ca-monitor.js.map +1 -1
  52. package/dist/elements/shell/ca-run-picker.js +1 -1
  53. package/dist/elements/shell/ca-run-picker.js.map +1 -1
  54. package/dist/elements/shell/ca-theme-switch.d.ts.map +1 -1
  55. package/dist/elements/shell/ca-theme-switch.js +6 -1
  56. package/dist/elements/shell/ca-theme-switch.js.map +1 -1
  57. package/dist/elements/task/ca-task-view.js +2 -2
  58. package/dist/elements/task/ca-task-view.js.map +1 -1
  59. package/dist/elements/task/ca-transcript.d.ts +3 -0
  60. package/dist/elements/task/ca-transcript.d.ts.map +1 -1
  61. package/dist/elements/task/ca-transcript.js +9 -2
  62. package/dist/elements/task/ca-transcript.js.map +1 -1
  63. package/dist/elements/task/header.d.ts +3 -0
  64. package/dist/elements/task/header.d.ts.map +1 -1
  65. package/dist/elements/task/header.js +22 -13
  66. package/dist/elements/task/header.js.map +1 -1
  67. package/dist/elements/task/panes/io.d.ts +1 -1
  68. package/dist/elements/task/panes/io.d.ts.map +1 -1
  69. package/dist/elements/task/panes/io.js +14 -21
  70. package/dist/elements/task/panes/io.js.map +1 -1
  71. package/dist/elements/trends/ca-trends.d.ts.map +1 -1
  72. package/dist/elements/trends/ca-trends.js +2 -1
  73. package/dist/elements/trends/ca-trends.js.map +1 -1
  74. package/dist/locales/ja.d.ts +16 -29
  75. package/dist/locales/ja.d.ts.map +1 -1
  76. package/dist/locales/ja.js +16 -29
  77. package/dist/locales/ja.js.map +1 -1
  78. package/dist/words/quota.d.ts +2 -0
  79. package/dist/words/quota.d.ts.map +1 -1
  80. package/dist/words/quota.js +4 -0
  81. package/dist/words/quota.js.map +1 -1
  82. package/dist/words/run-line.d.ts +5 -3
  83. package/dist/words/run-line.d.ts.map +1 -1
  84. package/dist/words/run-line.js +6 -4
  85. package/dist/words/run-line.js.map +1 -1
  86. package/dist/words/trends.d.ts +2 -2
  87. package/dist/words/trends.d.ts.map +1 -1
  88. package/dist/words/trends.js +5 -3
  89. package/dist/words/trends.js.map +1 -1
  90. package/package.json +3 -3
  91. package/src/adapters/journal-columns.ts +20 -6
  92. package/src/adapters/kpi-tiles.ts +37 -16
  93. package/src/adapters/transcript/sections.ts +10 -2
  94. package/src/elements/lists/ca-contracts.ts +25 -19
  95. package/src/elements/overview/ca-kpis.ts +4 -2
  96. package/src/elements/overview/ca-model-usage.ts +3 -2
  97. package/src/elements/overview/ca-overview.ts +49 -79
  98. package/src/elements/overview/ca-pipeline-graph.ts +11 -6
  99. package/src/elements/overview/ca-run-driver.ts +5 -6
  100. package/src/elements/overview/ca-workers.ts +1 -1
  101. package/src/elements/overview/pipeline-graph/strings.ts +3 -3
  102. package/src/elements/shared/ca-definition.ts +1 -2
  103. package/src/elements/shell/ca-hosts.ts +1 -2
  104. package/src/elements/shell/ca-monitor.ts +19 -8
  105. package/src/elements/shell/ca-run-picker.ts +1 -1
  106. package/src/elements/shell/ca-theme-switch.ts +6 -1
  107. package/src/elements/task/ca-task-view.ts +2 -2
  108. package/src/elements/task/ca-transcript.ts +7 -2
  109. package/src/elements/task/header.ts +24 -14
  110. package/src/elements/task/panes/io.ts +14 -21
  111. package/src/elements/trends/ca-trends.ts +2 -1
  112. package/src/locales/ja.ts +16 -29
  113. package/src/words/quota.ts +6 -0
  114. package/src/words/run-line.ts +8 -5
  115. package/src/words/trends.ts +5 -3
@@ -7,7 +7,6 @@ import {
7
7
  type TypedPanelBody,
8
8
  liveActivities,
9
9
  progress,
10
- result,
11
10
  runAccounts,
12
11
  runRelative,
13
12
  spendOf,
@@ -29,9 +28,9 @@ import { facts, kindUnit, localTime, sentence } from '../../words/format.js';
29
28
  import { notStartedCause, outcomeLabel, stateCount, stopLabel } from '../../words/index.js';
30
29
  import { base } from '@contraagent/elements/styles';
31
30
  import { pill, statusWord } from '@contraagent/elements/primitives';
32
- import { contractTone, outcomeTone } from '../../lib/tone.js';
31
+ import { outcomeTone } from '../../lib/tone.js';
33
32
  import { contractChip, formatOf } from '../shared/contract-parts.js';
34
- import { contractStatusLabel, contractStatusWhy } from '../../words/contract.js';
33
+ import { contractStatusLabel } from '../../words/contract.js';
35
34
  import { taskChip } from '../shared/task-chip.js';
36
35
  import '../lists/ca-proc-tree.js';
37
36
  import './ca-kpis.js';
@@ -132,11 +131,15 @@ export class CaOverview extends LitElement {
132
131
  }
133
132
  .ok { display: flex; align-items: baseline; gap: 6px; color: var(--text-2); }
134
133
  .ok span[aria-hidden] { color: var(--status-done); }
135
- /* a failed output: its status and its task on one line, what it is and where under them */
136
- .ofl { grid-template-columns: max-content minmax(0, 1fr); }
137
- .ofl > .jstop { white-space: nowrap; }
134
+ /* a failed output, under the chip of its status: its task and what it is on one line, where under them */
135
+ .ofl { grid-template-columns: minmax(0, 1fr) auto; }
138
136
  .ofl > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
139
- .ofl > .meta { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; }
137
+ .ofl > .meta { overflow: hidden; text-overflow: ellipsis; }
138
+ .ofl > .meta:last-child { grid-column: 1 / -1; }
139
+ .ogroup + .ogroup, .ogroup + .ct-row { margin-top: 10px; }
140
+ /* a heading that is a link to its tab */
141
+ h3 a.hl { color: inherit; text-decoration: none; }
142
+ h3 a.hl:hover { color: var(--accent); text-decoration: underline; }
140
143
  .ct-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
141
144
  .pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; }
142
145
  .pcard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 12px 14px; border-radius: 10px;
@@ -158,10 +161,8 @@ export class CaOverview extends LitElement {
158
161
  .ofl > .meta { white-space: nowrap; }
159
162
  .stopped { grid-column: 1 / 4; color: var(--text-muted); font-size: 11px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
160
163
  .fl.muted { opacity: 0.7; }
161
- .problems h4.sub { margin: 10px 0 2px; font-size: 11px; font-weight: 600; color: var(--text-muted); display: flex; }
162
- .problems h4.sub .r { margin-left: auto; font-weight: 400; }
163
- .next { margin: 10px 2px 2px; font-size: 12px; color: var(--text-2); }
164
- .next code { font-family: var(--mono); }
164
+ /* the tasks done after retrying: a group of their own under a rule, after the problems */
165
+ .recovered { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
165
166
  .more { font-size: 12px; margin: 6px 10px 0; }
166
167
  `,
167
168
  ];
@@ -211,29 +212,27 @@ export class CaOverview extends LitElement {
211
212
  <section class="panel enter problems">
212
213
  <h3>${msg('Problems')}
213
214
  <span class="r"><a class="lnk" href="#" @click=${(e: Event) => this.nav(e, () => emit(this, 'ca-navigate', { tab: 'journal', stop: 'bad' }))}>${msg('Failed attempts in history')}</a></span></h3>
214
- ${this.problems(live)}
215
+ ${this.problems()}
215
216
  </section>
216
217
  <section class="panel enter outputs">
217
- <h3 title=${msg('Checked files (OutputContract, InputContract)')}>${msg('Outputs')}
218
- <span class="r"><a class="lnk" href="#" @click=${(e: Event) => this.nav(e, () => this.go('outputs'))}>${msg('All outputs')}</a></span></h3>
218
+ <h3 title=${msg('Checked files (OutputContract, InputContract)')}><a class="hl" href="#" @click=${(e: Event) => this.nav(e, () => this.go('outputs'))}>${msg('Outputs')}</a></h3>
219
219
  ${this.outputs()}
220
220
  </section>
221
221
  ${running ? html`<div class="row">${this.runningCard(live, busy, max)}</div>` : nothing}
222
222
  </div>
223
223
  <section class="panel enter">
224
224
  <h3 title=${msg('Every task the run scheduled, by kind (plan.jsonl)')}>${msg('Pipeline')}
225
- <span class="r">${this.progressLine(live)}</span></h3>
225
+ ${live ? html`<span class="r">${this.progressLine()}</span>` : nothing}</h3>
226
226
  <ca-pipeline-graph .plan=${s.plan} .forecast=${s.forecast} .journal=${s.journal} .run=${this.run} .layer=${this.layer} .unit=${this.unit} .sel=${this.sel} ?live=${live}></ca-pipeline-graph>
227
227
  </section>
228
228
  <section class="panel enter">
229
229
  <h3 title=${msg('Counted from every finished attempt (journal.jsonl)')}>${msg('Totals')}</h3>
230
- <ca-kpis .journal=${s.journal} .plan=${s.plan}></ca-kpis>
230
+ <ca-kpis .journal=${s.journal} .plan=${s.plan} no-highest-cost></ca-kpis>
231
231
  </section>
232
232
  <div class="band parts">
233
233
  ${live
234
234
  ? html`<section class="panel enter">
235
- <h3>${msg('Process tree')}
236
- <span class="r"><a class="lnk" href="#" @click=${(e: Event) => this.nav(e, () => this.go('procs'))}>${msg('All processes')}</a></span></h3>
235
+ <h3><a class="hl" href="#" @click=${(e: Event) => this.nav(e, () => this.go('procs'))}>${msg('Process tree')}</a></h3>
237
236
  <ca-proc-tree .procs=${s.procs}></ca-proc-tree>
238
237
  </section>`
239
238
  : nothing}
@@ -245,15 +244,13 @@ export class CaOverview extends LitElement {
245
244
  : nothing}
246
245
  ${s.plan.models?.length
247
246
  ? html`<section class="panel enter">
248
- <h3 title=${msg('What the agent sessions spent on each model, each model of a model switch counted separately (Plan.models)')}>${msg('Models')}
249
- <span class="r">${s.plan.models.length === 1 ? msg('1 model') : msg(str`${s.plan.models.length} models`)}</span></h3>
247
+ <h3 title=${msg('What the agent sessions spent on each model, each model of a model switch counted separately (Plan.models)')}>${msg('Models')}</h3>
250
248
  <ca-model-usage .models=${s.plan.models}></ca-model-usage>
251
249
  </section>`
252
250
  : nothing}
253
251
  ${runAccounts(s.journal).length || s.plan.rests?.length
254
252
  ? html`<section class="panel enter">
255
- <h3 title=${msg('Account-wide | read at each agent session start')}>
256
- ${msg('Subscription usage')}<span class="r">${msg('Per account, first → last reading')}</span></h3>
253
+ <h3 title=${msg('Account-wide | first and last reading per account | read at each agent session start')}>${msg('Subscription usage')}</h3>
257
254
  <ca-quota .journal=${s.journal} .caps=${s.plan.quota_caps ?? []} .rests=${s.plan.rests ?? []} .rule=${s.plan.quota_rule ?? ''} ?live=${live}></ca-quota>
258
255
  </section>`
259
256
  : nothing}
@@ -277,8 +274,7 @@ export class CaOverview extends LitElement {
277
274
  </section>`
278
275
  : nothing}
279
276
  <section class="panel enter">
280
- <h3>${msg('Timeline')}
281
- <span class="r">${this.triesLine()}</span></h3>
277
+ <h3>${msg('Timeline')}</h3>
282
278
  <ca-timeline .journal=${s.journal} .plan=${s.plan} .procs=${s.procs} .live=${live} .run=${this.run}></ca-timeline>
283
279
  </section>
284
280
  </div>`;
@@ -298,60 +294,44 @@ export class CaOverview extends LitElement {
298
294
  if (!contracts.length) {
299
295
  return html`<div class="meta">${msg('No output files')}</div>`;
300
296
  }
301
- const chips = CT_ORDER.filter((k) => tally[k]);
302
297
  // Only what went wrong with a file; tasks that never started are the problems section's.
303
298
  const bad = contracts
304
299
  .flatMap((c) => (c.outputs ?? []).map((o): [ContractRecord, ContractSpec] => [c, o]))
305
300
  .filter(([, o]) => o.status === 'invalid' || o.status === 'failed');
306
301
  const shown = bad.slice(0, OUTPUTS_SHOWN);
307
- const refused = tally.refused;
308
- return html`<div class="ct-row">
309
- ${chips.length
310
- ? chips.map((k) => contractChip(k, tally[k]))
311
- : html`<span class="meta">${msg('No checked files')}</span>`}
312
- </div>
313
- ${shown.map(
314
- ([c, o]) => html`<button type="button" class="fl ofl" @click=${() => this.go('outputs')}>
315
- ${statusWord({ text: o.status ? contractStatusLabel(o.status) : '—', tone: contractTone(o.status), title: o.status ? contractStatusWhy(o.status) : null })}
316
- <b class="jmono" title=${c.key}>${kindUnit({ kind: c.kind, unit: c.unit === c.key ? '' : c.unit })}</b>
317
- <span class="meta">${formatOf(o)}</span>
318
- <span class="meta" title=${runRelative(o.errors?.[0] || o.path, this.run)}>${runRelative(o.errors?.[0] || o.path, this.run)}</span>
319
- </button>`,
302
+ // The rows shown sit under the chip of their status; the other statuses are a row of chips after them.
303
+ const groups = CT_ORDER.filter((k) => tally[k] && shown.some(([, o]) => o.status === k));
304
+ const chips = CT_ORDER.filter((k) => tally[k] && !groups.includes(k));
305
+ return html`${groups.map(
306
+ (k) => html`<div class="ogroup" role="group" aria-label=${contractStatusLabel(k)}>
307
+ <div class="ct-row">${contractChip(k, tally[k])}</div>
308
+ ${shown
309
+ .filter(([, o]) => o.status === k)
310
+ .map(
311
+ ([c, o]) => html`<button type="button" class="fl ofl" @click=${() => this.go('outputs')}>
312
+ <b class="jmono" title=${c.key}>${kindUnit({ kind: c.kind, unit: c.unit === c.key ? '' : c.unit })}</b>
313
+ <span class="meta">${formatOf(o)}</span>
314
+ <span class="meta" title=${runRelative(o.errors?.[0] || o.path, this.run)}>${runRelative(o.errors?.[0] || o.path, this.run)}</span>
315
+ </button>`,
316
+ )}
317
+ </div>`,
320
318
  )}
321
319
  ${bad.length > shown.length
322
320
  ? html`<div class="more"><a class="lnk" href="#" @click=${(e: Event) => this.nav(e, () => this.go('outputs'))}>${bad.length - shown.length === 1
323
321
  ? msg('1 more output')
324
322
  : msg(str`${bad.length - shown.length} more outputs`)}</a></div>`
325
323
  : nothing}
326
- ${refused
327
- ? html`<div class="meta more">${refused === 1
328
- ? msg('1 output not written (task not started)')
329
- : msg(str`${refused} outputs not written (tasks not started)`)}</div>`
324
+ ${chips.length || !groups.length
325
+ ? html`<div class="ct-row">
326
+ ${chips.length ? chips.map((k) => contractChip(k, tally[k])) : html`<span class="meta">${msg('No checked files')}</span>`}
327
+ </div>`
330
328
  : nothing}`;
331
329
  }
332
330
 
333
- /** While running, how far the run is; once over, how its tasks ended. */
334
- private progressLine(live: boolean): string {
335
- const plan = this.state.plan;
336
- const r = result(plan);
337
- if (live || r.left) {
338
- const p = progress(plan);
339
- return facts(msg(str`${p.pct}%`), msg(str`${p.done} of ${p.total} tasks done`), p.partial ? stateCount('partial', p.partial) : '', p.skipped ? stateCount('skipped', p.skipped) : '', p.cancelled ? stateCount('cancelled', p.cancelled) : '');
340
- }
341
- return facts(
342
- stateCount('done', r.done),
343
- r.skipped ? stateCount('skipped', r.skipped) : '',
344
- r.failed ? stateCount('failed', r.failed) : '',
345
- r.notStarted ? stateCount('not_started', r.notStarted) : '',
346
- r.partial ? stateCount('partial', r.partial) : '',
347
- r.cancelled ? stateCount('cancelled', r.cancelled) : '',
348
- );
349
- }
350
-
351
- /** "23 attempts | 4 not started": a task that never started has no attempt. */
352
- private triesLine(): string {
353
- const { tries, notStarted } = deriveRun(this.state.journal, this.state.plan).tries;
354
- return facts(tries === 1 ? msg('1 attempt') : msg(str`${tries} attempts`), notStarted ? stateCount('not_started', notStarted) : '');
331
+ /** While running, how far the run is; once over, the run's state and the tiles tell how its tasks ended. */
332
+ private progressLine(): string {
333
+ const p = progress(this.state.plan);
334
+ return facts(msg(str`${p.pct}%`), msg(str`${p.done} of ${p.total} tasks done`), p.partial ? stateCount('partial', p.partial) : '', p.skipped ? stateCount('skipped', p.skipped) : '', p.cancelled ? stateCount('cancelled', p.cancelled) : '');
355
335
  }
356
336
 
357
337
  /** A link's click: no navigation of the page's own, then `go`. */
@@ -425,7 +405,7 @@ export class CaOverview extends LitElement {
425
405
  return kindUnit(t);
426
406
  }
427
407
 
428
- private problems(live: boolean) {
408
+ private problems() {
429
409
  const { outcomes, problems } = deriveRun(this.state.journal, this.state.plan);
430
410
  const { failed, notStarted, partial, recovered } = problems;
431
411
  const issues = failed.length + notStarted.length + partial.length;
@@ -482,8 +462,8 @@ export class CaOverview extends LitElement {
482
462
  </div>`,
483
463
  )}
484
464
  ${rest(partial.length, PROBLEMS_SHOWN, 'partial')}
485
- ${recovered.length ? html`<h4 class="sub">${sentence(outcomeLabel('recovered'))} <span class="r">${recovered.length}</span></h4>` : nothing}
486
- ${repeat(
465
+ ${recovered.length
466
+ ? html`<div class="recovered" role="group" aria-label=${sentence(outcomeLabel('recovered'))}>${repeat(
487
467
  recovered.slice(0, RECOVERED_SHOWN),
488
468
  (t) => t.key,
489
469
  (t) => {
@@ -498,24 +478,14 @@ export class CaOverview extends LitElement {
498
478
  </div>`;
499
479
  },
500
480
  )}
501
- ${rest(recovered.length, RECOVERED_SHOWN, 'retried')}
502
- ${this.nextStep(live, issues)}`;
481
+ ${rest(recovered.length, RECOVERED_SHOWN, 'retried')}</div>`
482
+ : nothing}`;
503
483
  }
504
484
 
505
485
  /** A row's second line: one line, the whole of it in its tooltip. */
506
486
  private metaLine(text: string) {
507
487
  return html`<div class="meta" title=${text}>${text}</div>`;
508
488
  }
509
-
510
- /** For a finished run with problems: how many tasks are not done (the tasks resume=True runs again). */
511
- private nextStep(live: boolean, problemCount: number) {
512
- if (live || !problemCount) return nothing;
513
- const c = deriveRun(this.state.journal, this.state.plan).counts;
514
- // A partly done task is finished in this run, and not done: a resume runs it again.
515
- const again = c.total - c.finished + c.partial;
516
- if (!again) return nothing;
517
- return html`<div class="next" title="resume=True">${msg(str`${again} of ${c.total} tasks not done`)}</div>`;
518
- }
519
489
  }
520
490
 
521
491
  declare global {
@@ -102,7 +102,9 @@ const EMPTY_LAYER: LayerGraph = {
102
102
  * of passes or by status (`<cae-mark-matrix>`). The breadcrumb, shown on every layer
103
103
  * below the top (a loop named by its file and line), and Escape go back up. On a
104
104
  * narrow screen the graph runs top to bottom. "Graph | Table" changes the view; in a
105
- * loop's passes, "Graph" opens the layer the loop is in, with its box selected.
105
+ * loop's passes, "Graph" opens the layer the loop is in, with its box selected. With
106
+ * `controls` false, the graph is only shown: no outline, no "Show all inside" and
107
+ * "Hide all inside", no zoom buttons and no "Graph | Table".
106
108
  * A height set on the element (or given it by a flex or grid container) is the
107
109
  * graph's, less the outline's line above it: the drawing fits in it.
108
110
  *
@@ -119,6 +121,7 @@ export class CaPipelineGraph extends LitElement {
119
121
  journal: { attribute: false },
120
122
  run: {},
121
123
  live: { type: Boolean },
124
+ controls: { type: Boolean },
122
125
  layer: {},
123
126
  unit: {},
124
127
  sel: {},
@@ -139,6 +142,8 @@ export class CaPipelineGraph extends LitElement {
139
142
  run = '';
140
143
  /** The run is running: tasks still pending are waiting; once it is over, they did not run. */
141
144
  live = false;
145
+ /** The outline, "Show all inside" and "Hide all inside", the zoom buttons and "Graph | Table"; false for a graph that is only shown. */
146
+ controls = true;
142
147
  /** The layer shown: its segments (function names, then `loop:<line>` for a loop's passes) joined by `/`; '' for the layer the graph opens on. */
143
148
  layer = '';
144
149
  /** The unit highlighted while nothing is hovered or focused. */
@@ -436,8 +441,8 @@ export class CaPipelineGraph extends LitElement {
436
441
  // The graph keeps its place in one template whichever it is, and whether there is an
437
442
  // outline: a change between them (the first size report, a resize, a plan that gains a
438
443
  // function) keeps the graph's element, and with it the focus, the zoom and the pan.
439
- const side = this.wide && this.tree.length > 0;
440
- const part = !this.tree.length
444
+ const side = this.controls && this.wide && this.tree.length > 0;
445
+ const part = !this.controls || !this.tree.length
441
446
  ? nothing
442
447
  : side
443
448
  ? outline(this.oh, this.tree)
@@ -451,10 +456,10 @@ export class CaPipelineGraph extends LitElement {
451
456
  return html`<cae-layered-graph .graph=${this.input} .states=${this.states} .selected=${this.sel || null} .highlight=${this.unit || null}
452
457
  .order=${this.prevOrder} key=${this.segments.join('/')} direction=${this.down || this.tall ? 'down' : 'across'} .matrix=${this.matrixIn}
453
458
  .related=${this.lights} .strings=${graphStrings(!!parentLayer(this.segments, this.auto), functions)} .matrixStrings=${matrixStrings()}
454
- .renderIcon=${renderIcon} .iconStyles=${iconStyles}
459
+ .renderIcon=${renderIcon} .iconStyles=${iconStyles} .controls=${this.controls}
455
460
  @cae-select=${this.onSelect} @cae-activate=${this.onActivate} @cae-drill=${this.onDrill} @cae-view-change=${this.onView} @cae-toggle=${this.onToggle}
456
461
  @cae-sort=${(e: CustomEvent<{ id: string }>) => (this.sort = e.detail.id as MatrixSort)}>
457
- <div slot="crumbs">${crumbs(this.h, splitLayer(this.segments).loop ? null : openControls(this.openMode(), (m) => this.setMode(m)))}${missingLine(this.missing)}${this.segments.join('/') === this.auto.join('/') ? html`${forecastNote(this.plan, this.forecast)}${unawaitedLine(this.h)}` : nothing}</div>
462
+ <div slot="crumbs">${crumbs(this.h, splitLayer(this.segments).loop || !this.controls ? null : openControls(this.openMode(), (m) => this.setMode(m)))}${missingLine(this.missing)}${this.segments.join('/') === this.auto.join('/') ? html`${forecastNote(this.plan, this.forecast)}${unawaitedLine(this.h)}` : nothing}</div>
458
463
  ${s ? inspector(this.h, s) : nothing}
459
464
  </cae-layered-graph>`;
460
465
  }
@@ -462,7 +467,7 @@ export class CaPipelineGraph extends LitElement {
462
467
  /** The graph's own width: the element's, less the outline's column beside it. */
463
468
  private graphWidth(): number {
464
469
  const w = this.clientWidth || 1200;
465
- return this.tree.length && w >= OUTLINE_WIDE ? w - OUTLINE_COLUMN : w;
470
+ return this.controls && this.tree.length && w >= OUTLINE_WIDE ? w - OUTLINE_COLUMN : w;
466
471
  }
467
472
 
468
473
  /** The place keys on the way to the layer shown (the functions of its path). */
@@ -1,9 +1,9 @@
1
- import { elapsedS, result, runActivity, type HostSummary, type Plan, type Procs, type RunSummary } from '@contraagent/api';
1
+ import { result, runActivity, runIdOf, type HostSummary, type Plan, type Procs, type RunSummary } from '@contraagent/api';
2
2
  import { localized, msg, str } from '@lit/localize';
3
3
  import { LitElement, css, html, nothing } from 'lit';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
5
  import { starts } from '@contraagent/elements';
6
- import { facts, fmtDur, localTime, sentence } from '../../words/format.js';
6
+ import { facts, localTime, sentence } from '../../words/format.js';
7
7
  import { hostFact, lastReport, noReportLabel } from '../../words/hosts.js';
8
8
  import { preflightLabel, preflightStoppedCause, preflightStoppedTitle, preflightTip } from '../../words/preflight.js';
9
9
  import { preflightRows } from '../../adapters/preflight.js';
@@ -80,7 +80,6 @@ export class CaRunDriver extends LitElement {
80
80
  // Its host stopped reporting (a hub): not known to run, not known to have ended.
81
81
  const quiet = runActivity(r) === 'unresponsive';
82
82
  const [title, tone]: [string, Tone] = quiet ? [sentence(noReportLabel()), 'attention'] : this.stateTitle();
83
- const took = quiet ? null : elapsedS(r);
84
83
  return html`<div class="drv off">
85
84
  <div class="drv-ic" data-tone=${toneAttr(tone)} aria-hidden="true">${MARK[tone]}</div>
86
85
  <div>
@@ -89,8 +88,8 @@ export class CaRunDriver extends LitElement {
89
88
  this.plan.preflight?.stopped?.length ? preflightStoppedCause(this.plan.preflight.stopped) : '',
90
89
  quiet ? lastReport(this.host) : '',
91
90
  !r?.last_ts ? msg('No activity') : quiet ? msg(str`Last activity ${localTime(r.last_ts, true)}`) : msg(str`Ended ${localTime(r.last_ts, true)}`),
92
- took == null ? '' : msg(str`Took ${fmtDur(took)}`),
93
- r?.run_group ? msg(str`Run group ${r.run_group}`) : '',
91
+ // How long it took is in the header's run line; a run group named as the run is no fact of its own.
92
+ r?.run_group && r.run_group !== runIdOf(r) ? msg(str`Run group ${r.run_group}`) : '',
94
93
  quiet ? hostFact(r?.host_id ?? '') : '',
95
94
  )}</div>
96
95
  ${this.preflight()}
@@ -101,7 +100,7 @@ export class CaRunDriver extends LitElement {
101
100
  const since = starts.at(`drv:${p.pid ?? ''}`, Number.isNaN(started) ? 1 : (Date.now() - started) / 1000);
102
101
  const rows: [string, string | number][] = [
103
102
  [msg('PID'), p.pid ?? '—'],
104
- [msg('Run group'), p.run_group],
103
+ ...(r && p.run_group === runIdOf(r) ? [] : [[msg('Run group'), p.run_group] as [string, string]]),
105
104
  [msg('Running at once (limit)'), p.max_workers || '—'],
106
105
  [msg('Started'), localTime(p.started_at, true)],
107
106
  ];
@@ -40,7 +40,7 @@ export class CaWorkers extends LitElement {
40
40
  .wk.py .wk-ic { color: var(--text-muted); }
41
41
  .wk-el { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--status-running); }
42
42
  .wk-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; overflow: hidden; }
43
- .wk-bar i { position: absolute; top: 0; bottom: 0; width: 30%; background: linear-gradient(90deg, transparent, var(--status-running), transparent);
43
+ .wk-bar i { position: absolute; top: 0; bottom: 0; left: -30%; width: 30%; background: linear-gradient(90deg, transparent, var(--status-running), transparent);
44
44
  animation: scan 1.8s linear infinite; }
45
45
  `,
46
46
  ];
@@ -29,12 +29,12 @@ export function graphStrings(up: boolean, functions: boolean): Omit<LayeredGraph
29
29
  inspector: msg('Selected item'),
30
30
  stubTip: msg('Outside this layer'),
31
31
  more: (n) => msg(str`+${n}`),
32
- badge: msg('number of passes'),
32
+ badge: msg('Passes'),
33
33
  solidEdge: lineageWord('given_from'),
34
34
  dottedEdge: lineageWord('after'),
35
35
  dashedEdge: lineageWord('created_from'),
36
- cycle: msg('next pass'),
37
- drill: msg('has a level below'),
36
+ cycle: msg('Next pass'),
37
+ drill: msg('Has a level below'),
38
38
  open: msg('Show inside'),
39
39
  close: msg('Hide inside'),
40
40
  iconNames: { agent: msg('agent task'), python: msg('Python task') },
@@ -182,9 +182,8 @@ export class CaDefinition extends LitElement {
182
182
  };
183
183
  return html`<div class="df">
184
184
  <div class="df-hd">
185
- <button type="button" class="df-sum" aria-expanded=${isOpen ? 'true' : 'false'} @click=${toggle}>
185
+ <button type="button" class="df-sum" aria-expanded=${isOpen ? 'true' : 'false'} title=${isRole ? msg('Role of this kind') : nothing} @click=${toggle}>
186
186
  <span class="tag">${f.part}</span><span class="jmono">${f.path}</span>
187
- ${isRole ? html`<span class="ct-chip">${msg('Role of this kind')}</span>` : nothing}
188
187
  </button>
189
188
  ${isMd
190
189
  ? html`<button type="button" class="df-tog" @click=${flip}>${showSource ? msg('Show rendered') : msg('Show source')}</button>`
@@ -77,8 +77,7 @@ export class CaHosts extends LitElement {
77
77
  </section>
78
78
  ${quota.length
79
79
  ? html`<section class="panel c12 enter">
80
- <h3 title=${msg('Account-wide | read at each agent session start')}>
81
- ${msg('Subscription usage')}<span class="r">${msg('Per account, first → last reading')}</span></h3>
80
+ <h3 title=${msg('Account-wide | first and last reading per account | read at each agent session start')}>${msg('Subscription usage')}</h3>
82
81
  <ca-quota .accounts=${quota} .rests=${quota.flatMap((a) => a.rests ?? [])} live></ca-quota>
83
82
  </section>`
84
83
  : nothing}
@@ -9,6 +9,7 @@ import {
9
9
  runActivity,
10
10
  runIdOf,
11
11
  runRow,
12
+ tryCounts,
12
13
  type MonitorSnapshot,
13
14
  type RunDerived,
14
15
  } from '@contraagent/api';
@@ -24,7 +25,8 @@ import { ViewRouter, type ViewRouteCause, type ViewRouterMode } from '../../core
24
25
  import { LocaleController } from '../../controllers/locale.js';
25
26
  import { ShortcutsController, isShortcutScope, type ShortcutScope } from '../../controllers/shortcuts.js';
26
27
  import { ThemeController } from '../../controllers/theme.js';
27
- import { runLine, runLineAccounts, triesLine } from '../../words/index.js';
28
+ import { runLine, runLineAccounts, shownTasksLine, shownTriesLine } from '../../words/index.js';
29
+ import { filterJournal, filterTasks } from '../../adapters/filters.js';
28
30
  import { runMark } from '../../words/run-line.js';
29
31
  import { exportTip, exportedLabel } from '../../words/export.js';
30
32
  import { apiErrorLine } from '../../words/api-error.js';
@@ -477,9 +479,9 @@ export class CaMonitor extends LitElement {
477
479
  <span class="rs" title=${summary ? accountsTip(runLineAccounts(snap.state, summary)) : ''}>${summary ? runLine(snap.state, summary, derived) : ''}</span>`;
478
480
  }
479
481
 
480
- /** The run button's label on the trends page: its name, and what it shows. */
482
+ /** The run button's label on the trends page: its name, what it shows in its tooltip. */
481
483
  private trendsLabel() {
482
- return html`<span class="dot" data-tone="neutral" aria-hidden="true"></span><span class="rn">${trendsTitle()}</span><span class="rs">${trendsTip()}</span>`;
484
+ return html`<span class="dot" data-tone="neutral" aria-hidden="true"></span><span class="rn" title=${trendsTip()}>${trendsTitle()}</span>`;
483
485
  }
484
486
 
485
487
  /** The run button's label on the hosts page: the hosts in one line, attention while a host has no report. */
@@ -514,8 +516,7 @@ export class CaMonitor extends LitElement {
514
516
  private renderBar(d: RunDerived) {
515
517
  const { viewRoute } = this;
516
518
  if (viewRoute.tab !== 'tasks' && viewRoute.tab !== 'journal') return nothing;
517
- const { counts, kinds } = d;
518
- const total = counts.total;
519
+ const { kinds } = d;
519
520
  return html`<div class="bar">
520
521
  <select title=${msg('Kind')} aria-label=${msg('Kind')} @change=${(e: Event) => this.navigate({ kind: (e.target as HTMLSelectElement).value })}>
521
522
  <option value="" ?selected=${!viewRoute.kind}>${msg('All kinds')}</option>
@@ -523,11 +524,21 @@ export class CaMonitor extends LitElement {
523
524
  </select>
524
525
  <input placeholder=${msg('Filter')} aria-label=${msg('Text filter')} size="22" title=${this.shortcutScope !== 'off' ? msg('Text filter (/)') : msg('Text filter')} .value=${this.qDraft ?? viewRoute.q}
525
526
  @input=${(e: Event) => this.setQ((e.target as HTMLInputElement).value)} />
526
- <span class="meta">${viewRoute.tab === 'journal'
527
- ? triesLine(d.tries)
528
- : total === 1 ? msg('1 task') : msg(str`${total} tasks`)}</span>
527
+ <span class="meta" aria-live="polite">${this.shownLine(d)}</span>
529
528
  </div>`;
530
529
  }
530
+
531
+ /** While a filter is on, how many of the tab's rows it shows; the tab's badge counts them all. */
532
+ private shownLine(d: RunDerived): string {
533
+ const { viewRoute } = this;
534
+ const q = this.qDraft ?? viewRoute.q;
535
+ if (viewRoute.tab === 'journal') {
536
+ if (!viewRoute.kind && !q && !viewRoute.stop) return '';
537
+ return shownTriesLine(tryCounts(filterJournal(this.snap.state.journal, viewRoute.kind, viewRoute.stop, q)), d.tries.tries);
538
+ }
539
+ if (!viewRoute.kind && !q) return '';
540
+ return shownTasksLine(filterTasks(d.rows, viewRoute.kind, q).length, d.counts.total);
541
+ }
531
542
  }
532
543
 
533
544
  declare global {
@@ -270,7 +270,7 @@ export class CaRunPicker extends LitElement {
270
270
  </span>`
271
271
  : page === 'hosts'
272
272
  ? html`<span aria-hidden="true">⊞</span><span class="nm">${msg('Hosts')}</span><span class="when page">${hostsLine(this.hosts)}</span>`
273
- : html`<span aria-hidden="true">▥</span><span class="nm">${trendsTitle()}</span><span class="when page">${trendsTip()}</span>`}
273
+ : html`<span aria-hidden="true">▥</span><span class="nm" title=${trendsTip()}>${trendsTitle()}</span>`}
274
274
  </div>`;
275
275
  }
276
276
  }
@@ -38,6 +38,11 @@ export class CaThemeSwitch extends LitElement {
38
38
  padding: 2px 10px 2px 7px; font-size: 11px; color: var(--text-muted); cursor: pointer; }
39
39
  .trig:hover, .trig[aria-expanded='true'] { color: var(--text); border-color: var(--line2); }
40
40
  .trig svg { width: 13px; height: 13px; }
41
+ /* on a phone the icon alone: the word stays the button's accessible name */
42
+ @media (max-width: 480px) {
43
+ .trig { padding: 4px 6px; }
44
+ .trig .lbl { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
45
+ }
41
46
  .menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 236px; padding: 6px; z-index: 50;
42
47
  background: var(--panel); border: 1px solid var(--line2); border-radius: 12px;
43
48
  box-shadow: 0 18px 48px color-mix(in srgb, var(--shadow) 65%, transparent); animation: enter 0.16s var(--ease) both; }
@@ -148,7 +153,7 @@ export class CaThemeSwitch extends LitElement {
148
153
  return html`<button type="button" class="trig" aria-haspopup="menu" aria-expanded=${this.open ? 'true' : 'false'} aria-controls="menu"
149
154
  title=${msg(str`Theme: ${themeLabel(this.value)}`)} @click=${() => (this.open = !this.open)} @keydown=${(e: KeyboardEvent) => this.onTrigKey(e)}>
150
155
  <svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="6.25" fill="none" stroke="currentColor" stroke-width="1.5" /><path d="M8 1.75a6.25 6.25 0 0 1 0 12.5z" fill="currentColor" /></svg>
151
- ${msg('Theme')}
156
+ <span class="lbl">${msg('Theme')}</span>
152
157
  </button>
153
158
  ${this.open
154
159
  ? html`<div id="menu" class="menu" role="menu" aria-label=${msg('Theme')} @keydown=${(e: KeyboardEvent) => this.onMenuKey(e)}>
@@ -12,7 +12,7 @@ import './ca-transcript.js';
12
12
  import type { CaTranscript } from './ca-transcript.js';
13
13
  import { tagStyles } from '@contraagent/elements/transcript';
14
14
  import { isPy, type TaskContext } from './context.js';
15
- import { taskHeader } from './header.js';
15
+ import { taskHeader, taskWho } from './header.js';
16
16
  import { noTranscript } from './panes/transcript.js';
17
17
  import { inputPane, outputPane } from './panes/io.js';
18
18
  import { definitionPane } from './panes/definition.js';
@@ -112,7 +112,7 @@ export class CaTaskView extends LitElement {
112
112
  const view = this.shownView(d);
113
113
  return html`${taskHeader(c, key, (q, nth) => this.revealSearch(q, nth))} ${this.renderViews(d, view)}
114
114
  ${d.stream
115
- ? html`<ca-transcript .run=${this.run} .stream=${d.stream} base-url=${this.baseUrl} .client=${this.client} .live=${c.live}
115
+ ? html`<ca-transcript .run=${this.run} .stream=${d.stream} base-url=${this.baseUrl} .client=${this.client} .live=${c.live} .shownWho=${taskWho(c)}
116
116
  .rows=${d.rows} .round=${this.round} mode=${view === 'transcript' ? 'full' : view === 'input' ? 'tabs' : 'none'}
117
117
  @ca-rounds=${(e: CustomEvent<RoundsChangedDetail>) => {
118
118
  this.launches = e.detail.launches;
@@ -8,6 +8,7 @@ import { customElement, property, query, state } from 'lit/decorators.js';
8
8
  import { keyed } from 'lit/directives/keyed.js';
9
9
  import { classifyRounds } from '../../adapters/transcript/rounds.js';
10
10
  import { transcriptSections } from '../../adapters/transcript/sections.js';
11
+ import type { Who } from '../../adapters/transcript/who.js';
11
12
  import { StreamController } from '../../controllers/stream.js';
12
13
  import { emit, type RoundInfo, type RoundsChangedDetail } from '../../core/events.js';
13
14
  import { getLocale } from '../../core/i18n.js';
@@ -19,6 +20,7 @@ import { modelSwitchTip } from '../../words/hops.js';
19
20
 
20
21
  /** The transcript's words, in the reader's language (call at render time). */
21
22
  const strings = (): TranscriptStrings => ({
23
+ // the picker's accessible name: its buttons name each session
22
24
  sections: msg('Agent sessions'),
23
25
  sectionsTip: [
24
26
  `${msg('Retry')}: ${retryTip()}`,
@@ -90,6 +92,8 @@ export class CaTranscript extends LitElement {
90
92
  @property({ attribute: false }) round: number | null = null;
91
93
  /** The task's journal rows (finished tries): each round then says how it ended. */
92
94
  @property({ attribute: false }) rows: JournalRow[] = [];
95
+ /** Who the page names already (a task's header): each round's head shows only the coding agent, model and role that differ. */
96
+ @property({ attribute: false }) shownWho: Who | null = null;
93
97
  /** `full`; `tabs`: only the round picker (another view of the task is shown); `none`: hidden. */
94
98
  @property({ reflect: true }) mode: 'full' | 'tabs' | 'none' = 'full';
95
99
 
@@ -144,14 +148,15 @@ export class CaTranscript extends LitElement {
144
148
  /** The rounds and their sections, drawn again only when the transcript, the rows or the language changed. */
145
149
  private sections(): { rounds: RoundInfo[]; sections: TranscriptSection[] } {
146
150
  const active = this.live && this.feed.tailing;
147
- const key = [this.feed.version, this.rows, this.run, active, getLocale()];
151
+ const w = this.shownWho;
152
+ const key = [this.feed.version, this.rows, this.run, active, getLocale(), w?.agent, w?.model, w?.role];
148
153
  if (this.drawn?.key.every((k, i) => k === key[i])) return this.drawn;
149
154
  const t = this.feed.model;
150
155
  const rounds = classifyRounds(
151
156
  t.rounds.map((r) => r.launch),
152
157
  this.rows,
153
158
  );
154
- this.drawn = { key, rounds, sections: transcriptSections(t, rounds, { run: this.run, rows: this.rows, active }) };
159
+ this.drawn = { key, rounds, sections: transcriptSections(t, rounds, { run: this.run, rows: this.rows, active, shownWho: w }) };
155
160
  return this.drawn;
156
161
  }
157
162