@cat-factory/app 0.295.0 → 0.296.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.
- package/app/components/board/AgentFailureCard.vue +43 -2
- package/app/components/board/nodes/BlockNode.vue +17 -1
- package/app/components/bootstrap/BootstrapRunSteps.vue +50 -0
- package/app/components/panels/InspectorPanel.vue +25 -7
- package/app/components/panels/ObservabilityPanel.vue +66 -13
- package/app/composables/useBootstrapRunSteps.spec.ts +131 -0
- package/app/composables/useBootstrapRunSteps.ts +37 -0
- package/app/stores/agentRuns.ts +13 -0
- package/app/utils/bootstrapSteps.ts +60 -0
- package/app/utils/catalog.spec.ts +17 -1
- package/app/utils/catalog.ts +32 -1
- package/i18n/locales/de.json +28 -5
- package/i18n/locales/en.json +35 -3
- package/i18n/locales/es.json +28 -5
- package/i18n/locales/fr.json +28 -5
- package/i18n/locales/he.json +28 -5
- package/i18n/locales/it.json +28 -5
- package/i18n/locales/ja.json +28 -5
- package/i18n/locales/pl.json +28 -5
- package/i18n/locales/tr.json +28 -5
- package/i18n/locales/uk.json +28 -5
- package/package.json +2 -2
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type { ConflictReason, EnvironmentFailureReason } from '@cat-factory/contracts'
|
|
8
8
|
import type { AgentRunSummary } from '~/stores/agentRuns'
|
|
9
9
|
import FailureDetail from '~/components/board/FailureDetail.vue'
|
|
10
|
+
import BootstrapRunSteps from '~/components/bootstrap/BootstrapRunSteps.vue'
|
|
10
11
|
|
|
11
12
|
const props = withDefaults(
|
|
12
13
|
defineProps<{ run: AgentRunSummary; variant?: 'compact' | 'expanded' }>(),
|
|
@@ -92,9 +93,29 @@ const title = computed(() => {
|
|
|
92
93
|
? t('board.failure.bootstrapFailed')
|
|
93
94
|
: t('board.failure.runFailed')
|
|
94
95
|
})
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
// A MULTI-STEP bootstrap (the monorepo flow) is not retried from the top: the service resumes
|
|
97
|
+
// from the step the run reached, keeping the survey's paid-for reads and, past the review, the
|
|
98
|
+
// decisions a human already gave. So the button says which step it re-enters at, from the SAME
|
|
99
|
+
// rule the service branches on, rather than "retry", which invites the reviewer to expect to be
|
|
100
|
+
// asked for their decisions again. A single-step run has nothing to resume and keeps "retry".
|
|
101
|
+
const { resumeStep } = useBootstrapRunSteps(() =>
|
|
102
|
+
props.run.kind === 'bootstrap' ? props.run.runId : null,
|
|
97
103
|
)
|
|
104
|
+
const retryLabel = computed(() => {
|
|
105
|
+
if (props.run.kind !== 'bootstrap') return t('board.failure.retryRun')
|
|
106
|
+
const step = resumeStep.value
|
|
107
|
+
return step
|
|
108
|
+
? t('board.failure.resumeBootstrap', { step: t(`bootstrap.steps.name.${step}`) })
|
|
109
|
+
: t('board.failure.retryBootstrap')
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// The run's own observability panel. Offered here because a failed BOOTSTRAP has no step surface
|
|
113
|
+
// to reach it from (a task run's steps each carry their own "Model activity" control), and what
|
|
114
|
+
// a bootstrap failed on is exactly the question its model calls, provided context and tool-call
|
|
115
|
+
// trajectory answer.
|
|
116
|
+
function inspectRun() {
|
|
117
|
+
ui.openObservability(props.run.runId)
|
|
118
|
+
}
|
|
98
119
|
|
|
99
120
|
const retrying = ref(false)
|
|
100
121
|
async function retry() {
|
|
@@ -159,6 +180,14 @@ async function retry() {
|
|
|
159
180
|
}}
|
|
160
181
|
</p>
|
|
161
182
|
|
|
183
|
+
<!-- Which of the run's steps it got to. Renders for a multi-step (monorepo) bootstrap only;
|
|
184
|
+
see BootstrapRunSteps. -->
|
|
185
|
+
<BootstrapRunSteps
|
|
186
|
+
v-if="!compact && run.kind === 'bootstrap'"
|
|
187
|
+
:run-id="run.runId"
|
|
188
|
+
class="mt-2"
|
|
189
|
+
/>
|
|
190
|
+
|
|
162
191
|
<FailureDetail
|
|
163
192
|
v-if="!compact && failure"
|
|
164
193
|
:detail="failure.detail"
|
|
@@ -184,6 +213,18 @@ async function retry() {
|
|
|
184
213
|
{{ retrying ? t('board.failure.retrying') : compact ? t('common.retry') : retryLabel }}
|
|
185
214
|
</button>
|
|
186
215
|
|
|
216
|
+
<button
|
|
217
|
+
v-if="run.kind === 'bootstrap'"
|
|
218
|
+
type="button"
|
|
219
|
+
class="nodrag flex items-center gap-1 rounded-md bg-rose-900/20 text-rose-300 hover:bg-rose-900/50"
|
|
220
|
+
:class="compact ? 'px-2 py-0.5 text-[10px]' : 'px-2 py-1 text-[11px]'"
|
|
221
|
+
data-testid="agent-failure-inspect"
|
|
222
|
+
@click.stop="inspectRun"
|
|
223
|
+
>
|
|
224
|
+
<UIcon name="i-lucide-activity" :class="compact ? 'h-3 w-3' : 'h-3.5 w-3.5'" />
|
|
225
|
+
{{ t('observability.modelActivity') }}
|
|
226
|
+
</button>
|
|
227
|
+
|
|
187
228
|
<!-- Environment provisioning failures are almost always a deploy-backend / provider-config
|
|
188
229
|
issue, so link straight to where it's set up rather than leaving the user to hunt. The
|
|
189
230
|
destination + label follow the cause: a `deploy_runner_unwired` failure needs the runner
|
|
@@ -8,6 +8,7 @@ import ResizeGrips from './ResizeGrips.vue'
|
|
|
8
8
|
import AgentFailureCard from '~/components/board/AgentFailureCard.vue'
|
|
9
9
|
import AgentStopButton from '~/components/board/AgentStopButton.vue'
|
|
10
10
|
import AdoptionReviewModal from '~/components/bootstrap/AdoptionReviewModal.vue'
|
|
11
|
+
import BootstrapRunSteps from '~/components/bootstrap/BootstrapRunSteps.vue'
|
|
11
12
|
import { useBlockDrag } from '~/composables/useBlockDrag'
|
|
12
13
|
import { useFrameStacking } from '~/composables/useFrameStacking'
|
|
13
14
|
import { useViewport } from '~/composables/useViewport'
|
|
@@ -346,7 +347,21 @@ const ITEM_ICON: Record<string, string> = {
|
|
|
346
347
|
<span>{{ item.label }}</span>
|
|
347
348
|
</li>
|
|
348
349
|
</ul>
|
|
349
|
-
|
|
350
|
+
<!-- Which of the run's own steps it is on. A monorepo bootstrap is three moves around a
|
|
351
|
+
human decision, and the bar above reports only the current container's todo list, so
|
|
352
|
+
without this the card cannot say whether the survey, the review or the write is what
|
|
353
|
+
is happening. Renders nothing for a one-step new-repo run. -->
|
|
354
|
+
<BootstrapRunSteps v-if="run" :run-id="run.runId" class="mt-2" />
|
|
355
|
+
<div v-if="run" class="mt-2 flex items-center justify-end gap-1.5">
|
|
356
|
+
<UButton
|
|
357
|
+
size="xs"
|
|
358
|
+
color="neutral"
|
|
359
|
+
variant="ghost"
|
|
360
|
+
icon="i-lucide-activity"
|
|
361
|
+
@click.stop="ui.openObservability(run.runId)"
|
|
362
|
+
>
|
|
363
|
+
{{ t('observability.modelActivity') }}
|
|
364
|
+
</UButton>
|
|
350
365
|
<AgentStopButton :run-id="run.runId" :kind="run.kind" size="xs" variant="ghost" />
|
|
351
366
|
</div>
|
|
352
367
|
</div>
|
|
@@ -359,6 +374,7 @@ const ITEM_ICON: Record<string, string> = {
|
|
|
359
374
|
<UIcon name="i-lucide-user-check" class="mt-0.5 h-4 w-4 shrink-0 text-amber-400" />
|
|
360
375
|
<p class="text-xs text-amber-200/90">{{ t('bootstrap.adoption.cardPrompt') }}</p>
|
|
361
376
|
</div>
|
|
377
|
+
<BootstrapRunSteps :run-id="awaitingReview.id" />
|
|
362
378
|
<div class="flex justify-end">
|
|
363
379
|
<UButton size="xs" color="warning" variant="subtle" @click.stop="reviewOpen = true">
|
|
364
380
|
{{ t('bootstrap.adoption.cardAction') }}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// The steps a bootstrap run is made of, with the one it reached marked.
|
|
3
|
+
//
|
|
4
|
+
// A monorepo bootstrap is three moves around a human decision (survey → your adoption
|
|
5
|
+
// decisions → write the service and open the PR), and it was rendered as a single
|
|
6
|
+
// "bootstrapping…" bar. That bar cannot say which move a stopped run got to, so "retry" read
|
|
7
|
+
// as "start the whole thing again" when what the platform actually does is resume from the
|
|
8
|
+
// step reached, the survey's paid-for reads and the reviewer's settled decisions included.
|
|
9
|
+
//
|
|
10
|
+
// The steps and their states come from `@cat-factory/contracts`, which is also what
|
|
11
|
+
// `BootstrapService.retry` branches on: the label on the button and the behaviour behind it
|
|
12
|
+
// are one rule, not two. How a state RENDERS is `BOOTSTRAP_STEP_STYLE`, beside the vocabulary
|
|
13
|
+
// it is keyed by.
|
|
14
|
+
import type { BootstrapStepId, BootstrapStepState } from '@cat-factory/contracts'
|
|
15
|
+
|
|
16
|
+
const props = defineProps<{ runId: string }>()
|
|
17
|
+
|
|
18
|
+
const { t } = useI18n()
|
|
19
|
+
// A ONE-step run renders nothing: a new-repo bootstrap is a single move, which the banner around
|
|
20
|
+
// this already names, and a one-row checklist restating it is noise rather than information.
|
|
21
|
+
const { steps: allSteps, multiStep } = useBootstrapRunSteps(() => props.runId)
|
|
22
|
+
const steps = computed(() => (multiStep.value ? allSteps.value : []))
|
|
23
|
+
|
|
24
|
+
function stepLabel(id: BootstrapStepId): string {
|
|
25
|
+
return t(`bootstrap.steps.name.${id}`)
|
|
26
|
+
}
|
|
27
|
+
function stateLabel(state: BootstrapStepState): string {
|
|
28
|
+
return t(`bootstrap.steps.state.${state}`)
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<ol v-if="steps.length" class="space-y-1" data-testid="bootstrap-run-steps">
|
|
34
|
+
<li
|
|
35
|
+
v-for="step in steps"
|
|
36
|
+
:key="step.id"
|
|
37
|
+
class="flex items-start gap-1.5 text-[11px]"
|
|
38
|
+
:data-step="step.id"
|
|
39
|
+
:data-state="step.state"
|
|
40
|
+
>
|
|
41
|
+
<UIcon
|
|
42
|
+
:name="BOOTSTRAP_STEP_STYLE[step.state].icon"
|
|
43
|
+
class="mt-px h-3 w-3 shrink-0"
|
|
44
|
+
:class="BOOTSTRAP_STEP_STYLE[step.state].iconClass"
|
|
45
|
+
/>
|
|
46
|
+
<span :class="BOOTSTRAP_STEP_STYLE[step.state].labelClass">{{ stepLabel(step.id) }}</span>
|
|
47
|
+
<span class="ms-auto shrink-0 text-slate-500">{{ stateLabel(step.state) }}</span>
|
|
48
|
+
</li>
|
|
49
|
+
</ol>
|
|
50
|
+
</template>
|
|
@@ -7,6 +7,7 @@ import { inspectorPanels } from '~/modular/panels/inspector.logic'
|
|
|
7
7
|
import IconButton from '~/components/common/IconButton.vue'
|
|
8
8
|
import AgentFailureCard from '~/components/board/AgentFailureCard.vue'
|
|
9
9
|
import AgentStopButton from '~/components/board/AgentStopButton.vue'
|
|
10
|
+
import BootstrapRunSteps from '~/components/bootstrap/BootstrapRunSteps.vue'
|
|
10
11
|
import { BLUEPRINT_AGENT_KIND } from '@cat-factory/contracts'
|
|
11
12
|
import { VCS_PROVIDER_ICONS } from '~/utils/vcs'
|
|
12
13
|
|
|
@@ -489,16 +490,33 @@ const showOriginalDescription = ref(false)
|
|
|
489
490
|
<!-- failed run (bootstrap or execution): shared failure banner + retry -->
|
|
490
491
|
<AgentFailureCard v-if="failedRun" :run="failedRun" />
|
|
491
492
|
|
|
492
|
-
<!-- running bootstrap: let the user
|
|
493
|
+
<!-- running bootstrap: show the steps, let the user inspect it, let them stop it -->
|
|
493
494
|
<div
|
|
494
495
|
v-else-if="runningRun"
|
|
495
|
-
class="
|
|
496
|
+
class="space-y-2 rounded-lg border border-amber-900/60 bg-amber-950/30 px-3 py-2"
|
|
496
497
|
>
|
|
497
|
-
<
|
|
498
|
-
<
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
498
|
+
<div class="flex items-center justify-between gap-2">
|
|
499
|
+
<span class="flex items-center gap-1.5 text-xs text-amber-300">
|
|
500
|
+
<UIcon name="i-lucide-loader-circle" class="h-3.5 w-3.5 animate-spin" />
|
|
501
|
+
{{ t('panels.inspector.bootstrapping') }}
|
|
502
|
+
</span>
|
|
503
|
+
<div class="flex items-center gap-1.5">
|
|
504
|
+
<!-- A bootstrap has no step surface of its own, so this is where its run details are
|
|
505
|
+
reached from: the same panel every task run opens, over the same four sinks. -->
|
|
506
|
+
<UButton
|
|
507
|
+
v-if="runningRun.kind === 'bootstrap'"
|
|
508
|
+
size="xs"
|
|
509
|
+
color="neutral"
|
|
510
|
+
variant="ghost"
|
|
511
|
+
icon="i-lucide-activity"
|
|
512
|
+
@click="ui.openObservability(runningRun.runId)"
|
|
513
|
+
>
|
|
514
|
+
{{ t('observability.modelActivity') }}
|
|
515
|
+
</UButton>
|
|
516
|
+
<AgentStopButton :run-id="runningRun.runId" :kind="runningRun.kind" size="xs" />
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
<BootstrapRunSteps v-if="runningRun.kind === 'bootstrap'" :run-id="runningRun.runId" />
|
|
502
520
|
</div>
|
|
503
521
|
|
|
504
522
|
<!-- external links -->
|
|
@@ -50,13 +50,30 @@ const EMPTY_TRAJECTORY: RunToolCallTrajectory = Object.freeze({
|
|
|
50
50
|
const ui = useUiStore()
|
|
51
51
|
const execution = useExecutionStore()
|
|
52
52
|
const board = useBoardStore()
|
|
53
|
+
const agentRuns = useAgentRunsStore()
|
|
53
54
|
const observability = useObservabilityStore()
|
|
54
55
|
const { t, d } = useI18n()
|
|
55
56
|
|
|
56
57
|
const executionId = computed(() => ui.observabilityInstanceId)
|
|
57
58
|
const open = computed(() => !!executionId.value)
|
|
58
59
|
const instance = computed(() => execution.getInstance(executionId.value ?? undefined))
|
|
59
|
-
|
|
60
|
+
// The panel is opened over an AGENT RUN, and a repo bootstrap is one: it has no execution row,
|
|
61
|
+
// so everything below that reads `instance` answers nothing for it. Its own run supplies the two
|
|
62
|
+
// things the panel states about a run rather than about its calls: whose work this was, and what
|
|
63
|
+
// it failed on. The four telemetry reads need none of it: they are keyed by the run id alone.
|
|
64
|
+
const bootstrap = computed(() => agentRuns.bootstrapById(executionId.value))
|
|
65
|
+
const blockId = computed(() => instance.value?.blockId ?? bootstrap.value?.blockId ?? null)
|
|
66
|
+
const block = computed(() => (blockId.value ? board.getBlock(blockId.value) : undefined))
|
|
67
|
+
/**
|
|
68
|
+
* The line under the title. An execution names its pipeline; a bootstrap names itself, because
|
|
69
|
+
* "which pipeline" has no answer for it and an empty subtitle on a panel opened from a service
|
|
70
|
+
* card reads as a panel that failed to load rather than as a run of a different kind.
|
|
71
|
+
*/
|
|
72
|
+
const runSubtitle = computed(() =>
|
|
73
|
+
instance.value ? instance.value.pipelineName : bootstrap.value ? t('bootstrap.runKind') : '',
|
|
74
|
+
)
|
|
75
|
+
/** The structured failure the pinned summary speaks from, whichever kind of run this is. */
|
|
76
|
+
const runFailure = computed(() => instance.value?.failure ?? bootstrap.value?.failure ?? null)
|
|
60
77
|
|
|
61
78
|
const calls = computed<LlmCallMetric[]>(() =>
|
|
62
79
|
executionId.value ? observability.callsFor(executionId.value) : [],
|
|
@@ -201,7 +218,7 @@ const visibleCalls = computed(() => filterCallsByOutcome(calls.value, callFilter
|
|
|
201
218
|
*/
|
|
202
219
|
const failureEvidence = computed(() =>
|
|
203
220
|
deriveRunFailureEvidence({
|
|
204
|
-
failure:
|
|
221
|
+
failure: runFailure.value,
|
|
205
222
|
calls: calls.value,
|
|
206
223
|
callsAnswer: sinkAnswer({
|
|
207
224
|
loading: loading.value,
|
|
@@ -357,7 +374,19 @@ function sum(items: LlmCallMetric[], pick: (m: LlmCallMetric) => number): number
|
|
|
357
374
|
|
|
358
375
|
// Where the run's tokens went, by PHASE. Unlike the totals above (derived from the capped call
|
|
359
376
|
// list), this reads the engine's SQL rollup off the steps, so it stays honest on a long run.
|
|
360
|
-
|
|
377
|
+
//
|
|
378
|
+
// A run with NO execution row (a repo bootstrap) has no steps to fold one from, which is a
|
|
379
|
+
// different fact from a run whose phases each spent nothing, and the difference matters here
|
|
380
|
+
// more than anywhere: this rollup is also what prices the run, so left as an empty list it hides
|
|
381
|
+
// both the table and the cost tile, and a bootstrap that made N model calls reads as one that
|
|
382
|
+
// cost nothing. Stated as its own answer, and rendered as a note.
|
|
383
|
+
const phaseRollup = computed<{ available: boolean; rows: ReturnType<typeof foldRunPhaseMetrics> }>(
|
|
384
|
+
() =>
|
|
385
|
+
instance.value
|
|
386
|
+
? { available: true, rows: foldRunPhaseMetrics(instance.value.steps ?? []) }
|
|
387
|
+
: { available: false, rows: [] },
|
|
388
|
+
)
|
|
389
|
+
const phaseRows = computed(() => phaseRollup.value.rows)
|
|
361
390
|
const phaseCarryTotal = computed(() =>
|
|
362
391
|
phaseRows.value.reduce((acc, p) => acc + p.carryCostTokens, 0),
|
|
363
392
|
)
|
|
@@ -391,6 +420,18 @@ const showCost = computed(
|
|
|
391
420
|
const runCost = computed(() =>
|
|
392
421
|
formatCost(sumCosts(phaseRows.value.map((p) => p.costEstimate)), costCurrency.value),
|
|
393
422
|
)
|
|
423
|
+
/**
|
|
424
|
+
* What the cost tile SAYS when it shows no figure. An unpriced phase and a run kind with no
|
|
425
|
+
* rollup to price from are different facts, and the tile is rendered for the second one rather
|
|
426
|
+
* than dropped: a missing tile is indistinguishable from a run that cost nothing.
|
|
427
|
+
*/
|
|
428
|
+
const costNoteKey = computed(() =>
|
|
429
|
+
!phaseRollup.value.available
|
|
430
|
+
? 'observability.summary.costNoRollup'
|
|
431
|
+
: runCost.value
|
|
432
|
+
? 'observability.summary.costHint'
|
|
433
|
+
: 'observability.summary.costIncomplete',
|
|
434
|
+
)
|
|
394
435
|
/** Share of the run's carry cost a phase accounts for (0..100), or null when nothing carried. */
|
|
395
436
|
function carryShare(carryCostTokens: number): number | null {
|
|
396
437
|
return phaseCarryTotal.value > 0 ? pct(carryCostTokens / phaseCarryTotal.value) : null
|
|
@@ -473,7 +514,7 @@ function exportJson() {
|
|
|
473
514
|
{{ t('observability.modelActivity') }}
|
|
474
515
|
</h1>
|
|
475
516
|
<p v-if="block" class="truncate text-xs text-slate-500">
|
|
476
|
-
{{ block.title }} · {{
|
|
517
|
+
{{ block.title }} · {{ runSubtitle }}
|
|
477
518
|
</p>
|
|
478
519
|
</div>
|
|
479
520
|
<div class="ms-auto flex items-center gap-1.5">
|
|
@@ -569,18 +610,14 @@ function exportJson() {
|
|
|
569
610
|
</dt>
|
|
570
611
|
<dd class="mt-0.5 tabular-nums text-slate-200">{{ totals.calls }}</dd>
|
|
571
612
|
</div>
|
|
572
|
-
<div v-if="showCost">
|
|
613
|
+
<div v-if="showCost || !phaseRollup.available">
|
|
573
614
|
<dt class="text-[11px] uppercase tracking-wide text-slate-500">
|
|
574
615
|
{{ t('observability.summary.cost') }}
|
|
575
616
|
</dt>
|
|
576
617
|
<dd class="mt-0.5 tabular-nums text-slate-200">
|
|
577
618
|
{{ runCost ?? '—' }}
|
|
578
619
|
<span class="mt-0.5 block text-[11px] text-slate-500">
|
|
579
|
-
{{
|
|
580
|
-
runCost
|
|
581
|
-
? t('observability.summary.costHint')
|
|
582
|
-
: t('observability.summary.costIncomplete')
|
|
583
|
-
}}
|
|
620
|
+
{{ t(costNoteKey) }}
|
|
584
621
|
</span>
|
|
585
622
|
</dd>
|
|
586
623
|
</div>
|
|
@@ -683,18 +720,23 @@ function exportJson() {
|
|
|
683
720
|
<!-- where the run's tokens went, by phase (the engine's SQL rollup, not the
|
|
684
721
|
capped call list) -->
|
|
685
722
|
<section
|
|
686
|
-
v-if="phaseRows.length"
|
|
723
|
+
v-if="phaseRows.length || !phaseRollup.available"
|
|
687
724
|
class="rounded-xl border border-slate-800 bg-slate-900/50 p-4"
|
|
688
725
|
>
|
|
689
726
|
<div class="flex items-baseline gap-2">
|
|
690
727
|
<h2 class="text-[11px] uppercase tracking-wide text-slate-500">
|
|
691
728
|
{{ t('observability.phase.title') }}
|
|
692
729
|
</h2>
|
|
693
|
-
<span class="text-[11px] text-slate-600">
|
|
730
|
+
<span v-if="phaseRollup.available" class="text-[11px] text-slate-600">
|
|
694
731
|
{{ t('observability.phase.subtitle') }}
|
|
695
732
|
</span>
|
|
696
733
|
</div>
|
|
697
|
-
|
|
734
|
+
<!-- No rollup to fold: said in words, because an absent table and a run that spent
|
|
735
|
+
nothing look identical, and the calls listed above prove it spent something. -->
|
|
736
|
+
<p v-if="!phaseRollup.available" class="mt-2 text-[12px] text-slate-400">
|
|
737
|
+
{{ t('observability.phase.noRollup') }}
|
|
738
|
+
</p>
|
|
739
|
+
<div v-else class="mt-3 overflow-x-auto">
|
|
698
740
|
<table class="w-full min-w-[32rem] text-[12px]">
|
|
699
741
|
<thead>
|
|
700
742
|
<tr class="text-[11px] uppercase tracking-wide text-slate-500">
|
|
@@ -998,6 +1040,17 @@ function exportJson() {
|
|
|
998
1040
|
@show-failing-tools="revealFailingToolCalls"
|
|
999
1041
|
@retry="retryFailureEvidence"
|
|
1000
1042
|
/>
|
|
1043
|
+
<!-- A monorepo bootstrap's SURVEY explores through the platform's own bounded reader,
|
|
1044
|
+
whose every read lands on the run's adoption transcript rather than here (that is
|
|
1045
|
+
the record a reviewer checks a recommendation against, and it outlives this
|
|
1046
|
+
window). Said out loud because the apply container's calls below are not empty,
|
|
1047
|
+
so the survey's absence would otherwise read as a phase that used no tools. -->
|
|
1048
|
+
<p
|
|
1049
|
+
v-if="bootstrap?.monorepo"
|
|
1050
|
+
class="rounded-lg border border-dashed border-slate-800 px-3 py-2 text-[12px] text-slate-400"
|
|
1051
|
+
>
|
|
1052
|
+
{{ t('observability.toolCalls.surveyReadsElsewhere') }}
|
|
1053
|
+
</p>
|
|
1001
1054
|
<ToolCallList
|
|
1002
1055
|
v-model:filter="toolFilter"
|
|
1003
1056
|
:trajectory="trajectory"
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from 'vitest'
|
|
2
|
+
import type { BootstrapJob } from '~/types/domain'
|
|
3
|
+
import { useAgentRunsStore } from '~/stores/agentRuns'
|
|
4
|
+
import { useBootstrapRunSteps } from '~/composables/useBootstrapRunSteps'
|
|
5
|
+
|
|
6
|
+
// What this composable owns beyond the shared derivation (tested in `@cat-factory/contracts`):
|
|
7
|
+
// the SPA-only question of whether a run has more than one step, which is what decides whether
|
|
8
|
+
// the board renders a step list at all and whether the retry control offers to RESUME.
|
|
9
|
+
|
|
10
|
+
const MONOREPO: BootstrapJob['monorepo'] = {
|
|
11
|
+
repoGithubId: 7,
|
|
12
|
+
directory: 'services/payments',
|
|
13
|
+
repoOwner: 'acme',
|
|
14
|
+
repoName: 'platform',
|
|
15
|
+
branch: null,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function job(id: string, over: Partial<BootstrapJob> = {}): BootstrapJob {
|
|
19
|
+
return {
|
|
20
|
+
id,
|
|
21
|
+
workspaceId: 'ws_test',
|
|
22
|
+
referenceArchitectureId: null,
|
|
23
|
+
referenceArchitectureName: null,
|
|
24
|
+
repoName: id,
|
|
25
|
+
repoOwner: null,
|
|
26
|
+
repoUrl: null,
|
|
27
|
+
instructions: '',
|
|
28
|
+
status: 'running',
|
|
29
|
+
blockId: `blk_${id}`,
|
|
30
|
+
subtasks: null,
|
|
31
|
+
error: null,
|
|
32
|
+
failure: null,
|
|
33
|
+
monorepo: null,
|
|
34
|
+
phase: null,
|
|
35
|
+
// The base fixture is a new-repo run, so it takes that target's default delivery. The step
|
|
36
|
+
// rule never reads the field, which is why no case below overrides it: how a run's work
|
|
37
|
+
// lands says nothing about how many moves it takes to get there.
|
|
38
|
+
delivery: 'direct_push',
|
|
39
|
+
adoptionPlan: null,
|
|
40
|
+
adoptionReview: null,
|
|
41
|
+
prUrl: null,
|
|
42
|
+
createdAt: 1,
|
|
43
|
+
updatedAt: 1,
|
|
44
|
+
...over,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** A recorded plan; only its own status is read by the rule. */
|
|
49
|
+
function plan(status: 'ready' | 'unavailable'): BootstrapJob['adoptionPlan'] {
|
|
50
|
+
return { status } as unknown as BootstrapJob['adoptionPlan']
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
describe('useBootstrapRunSteps', () => {
|
|
54
|
+
let store: ReturnType<typeof useAgentRunsStore>
|
|
55
|
+
beforeEach(() => {
|
|
56
|
+
store = useAgentRunsStore()
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('offers nothing for a new-repo run, which has one move and so nothing to resume', () => {
|
|
60
|
+
store.upsertBootstrap(job('b1', { status: 'failed' }))
|
|
61
|
+
const { multiStep, resumeStep } = useBootstrapRunSteps('b1')
|
|
62
|
+
expect(multiStep.value).toBe(false)
|
|
63
|
+
// Null rather than 'scaffold': there is progress to keep on a monorepo run and none here,
|
|
64
|
+
// so the card must keep saying "retry" instead of promising a resume it cannot make.
|
|
65
|
+
expect(resumeStep.value).toBeNull()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('marks the survey done and the review as the step a broken monorepo run is holding', () => {
|
|
69
|
+
store.upsertBootstrap(
|
|
70
|
+
job('b2', {
|
|
71
|
+
monorepo: MONOREPO,
|
|
72
|
+
phase: 'survey',
|
|
73
|
+
status: 'failed',
|
|
74
|
+
failure: { kind: 'agent' } as unknown as BootstrapJob['failure'],
|
|
75
|
+
adoptionPlan: plan('ready'),
|
|
76
|
+
}),
|
|
77
|
+
)
|
|
78
|
+
const { steps, multiStep, resumeStep } = useBootstrapRunSteps('b2')
|
|
79
|
+
expect(multiStep.value).toBe(true)
|
|
80
|
+
expect(steps.value).toEqual([
|
|
81
|
+
{ id: 'survey', state: 'done' },
|
|
82
|
+
{ id: 'review', state: 'failed' },
|
|
83
|
+
{ id: 'apply', state: 'pending' },
|
|
84
|
+
])
|
|
85
|
+
expect(resumeStep.value).toBe('review')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('renders a run the reviewer STOPPED as stopped, not as a broken review step', () => {
|
|
89
|
+
// A stop is stored as a `failed` status with a `cancelled` kind, and this is the shape the
|
|
90
|
+
// card actually renders: stopping a parked run must not report the reviewer's own decision
|
|
91
|
+
// step back to them as a fault. The resume it offers is unchanged.
|
|
92
|
+
store.upsertBootstrap(
|
|
93
|
+
job('b2s', {
|
|
94
|
+
monorepo: MONOREPO,
|
|
95
|
+
phase: 'survey',
|
|
96
|
+
status: 'failed',
|
|
97
|
+
failure: { kind: 'cancelled' } as unknown as BootstrapJob['failure'],
|
|
98
|
+
adoptionPlan: plan('ready'),
|
|
99
|
+
}),
|
|
100
|
+
)
|
|
101
|
+
const { steps, resumeStep } = useBootstrapRunSteps('b2s')
|
|
102
|
+
expect(steps.value.map((step) => step.state)).toEqual(['done', 'stopped', 'pending'])
|
|
103
|
+
expect(resumeStep.value).toBe('review')
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
it('follows the run as live events advance it, rather than pinning the first read', () => {
|
|
107
|
+
// The card is open while the run moves: the review is settled and the apply dispatches, and
|
|
108
|
+
// the step list has to follow the store rather than the value it was mounted with.
|
|
109
|
+
store.upsertBootstrap(job('b3', { monorepo: MONOREPO, phase: 'survey', updatedAt: 1 }))
|
|
110
|
+
const { steps, resumeStep } = useBootstrapRunSteps('b3')
|
|
111
|
+
expect(steps.value.map((s) => s.state)).toEqual(['running', 'pending', 'pending'])
|
|
112
|
+
store.upsertBootstrap(
|
|
113
|
+
job('b3', {
|
|
114
|
+
monorepo: MONOREPO,
|
|
115
|
+
phase: 'apply',
|
|
116
|
+
adoptionPlan: plan('ready'),
|
|
117
|
+
adoptionReview: { choices: [] } as unknown as BootstrapJob['adoptionReview'],
|
|
118
|
+
updatedAt: 2,
|
|
119
|
+
}),
|
|
120
|
+
)
|
|
121
|
+
expect(steps.value.map((s) => s.state)).toEqual(['done', 'done', 'running'])
|
|
122
|
+
expect(resumeStep.value).toBe('apply')
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
it('answers empty for a run the store does not hold', () => {
|
|
126
|
+
const { steps, multiStep, resumeStep } = useBootstrapRunSteps('nope')
|
|
127
|
+
expect(steps.value).toEqual([])
|
|
128
|
+
expect(multiStep.value).toBe(false)
|
|
129
|
+
expect(resumeStep.value).toBeNull()
|
|
130
|
+
})
|
|
131
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { computed, type ComputedRef, type MaybeRefOrGetter, toValue } from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
bootstrapResumeStep,
|
|
4
|
+
bootstrapRunSteps,
|
|
5
|
+
type BootstrapRunStep,
|
|
6
|
+
type BootstrapStepId,
|
|
7
|
+
} from '@cat-factory/contracts'
|
|
8
|
+
import { useAgentRunsStore } from '~/stores/agentRuns'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A bootstrap run projected onto its steps, for the surfaces that render them and for the
|
|
12
|
+
* button that resumes one.
|
|
13
|
+
*
|
|
14
|
+
* The projection itself lives in `@cat-factory/contracts` and is shared with the backend, which
|
|
15
|
+
* BRANCHES on the same rule (`bootstrapResume`) in `BootstrapService.retry`; this side needs only
|
|
16
|
+
* the step it answers with, never the state it carries. What this composable adds is the
|
|
17
|
+
* one SPA-side question the backend never asks: whether the run has more than one step at all.
|
|
18
|
+
* A new-repo bootstrap is a single move, so for it a step list restates the banner it sits under
|
|
19
|
+
* and "resume from…" is a promise about progress there is none of: it simply starts again.
|
|
20
|
+
*/
|
|
21
|
+
export function useBootstrapRunSteps(runId: MaybeRefOrGetter<string | null | undefined>): {
|
|
22
|
+
/** The run's steps in order, with the reached one carrying the run's state. Empty if unknown. */
|
|
23
|
+
steps: ComputedRef<BootstrapRunStep[]>
|
|
24
|
+
/** Whether the run is a multi-step (monorepo) one: the gate every caller here needs. */
|
|
25
|
+
multiStep: ComputedRef<boolean>
|
|
26
|
+
/** The step a retry re-enters at, or null when the run is single-step or unknown. */
|
|
27
|
+
resumeStep: ComputedRef<BootstrapStepId | null>
|
|
28
|
+
} {
|
|
29
|
+
const agentRuns = useAgentRunsStore()
|
|
30
|
+
const job = computed(() => agentRuns.bootstrapById(toValue(runId)))
|
|
31
|
+
const steps = computed<BootstrapRunStep[]>(() => (job.value ? bootstrapRunSteps(job.value) : []))
|
|
32
|
+
const multiStep = computed(() => steps.value.length > 1)
|
|
33
|
+
const resumeStep = computed<BootstrapStepId | null>(() =>
|
|
34
|
+
job.value && multiStep.value ? bootstrapResumeStep(job.value) : null,
|
|
35
|
+
)
|
|
36
|
+
return { steps, multiStep, resumeStep }
|
|
37
|
+
}
|
package/app/stores/agentRuns.ts
CHANGED
|
@@ -158,6 +158,18 @@ export const useAgentRunsStore = defineStore('agentRuns', () => {
|
|
|
158
158
|
return map
|
|
159
159
|
})
|
|
160
160
|
|
|
161
|
+
/**
|
|
162
|
+
* One bootstrap run by its RUN id.
|
|
163
|
+
*
|
|
164
|
+
* The counterpart to `execution.getInstance`, and it exists for the same surfaces: anything
|
|
165
|
+
* that holds a run id and needs the run WHOLE rather than the coarse {@link byBlock} summary:
|
|
166
|
+
* the observability panel's header, and the step list a card renders. A retry mints a NEW id,
|
|
167
|
+
* so unlike the block-keyed reads below this one needs nothing of the list's ordering.
|
|
168
|
+
*/
|
|
169
|
+
function bootstrapById(runId: string | null | undefined): BootstrapJob | undefined {
|
|
170
|
+
return runId ? bootstrapJobs.value.find((job) => job.id === runId) : undefined
|
|
171
|
+
}
|
|
172
|
+
|
|
161
173
|
/**
|
|
162
174
|
* The parked monorepo bootstrap for a block, when it is waiting on an adoption review.
|
|
163
175
|
*
|
|
@@ -221,6 +233,7 @@ export const useAgentRunsStore = defineStore('agentRuns', () => {
|
|
|
221
233
|
|
|
222
234
|
return {
|
|
223
235
|
bootstrapJobs,
|
|
236
|
+
bootstrapById,
|
|
224
237
|
awaitingReview,
|
|
225
238
|
submitAdoptionReview,
|
|
226
239
|
hydrate,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { BootstrapStepState } from '@cat-factory/contracts'
|
|
2
|
+
|
|
3
|
+
// Display metadata for a bootstrap run's step states, the `catalog.ts` idea at the scale of one
|
|
4
|
+
// vocabulary: the icon and the two tones that render a state, in ONE record rather than three
|
|
5
|
+
// parallel ones keyed alike. Three had to be kept in step by hand, which is a silent way to give
|
|
6
|
+
// a newly added state (`stopped`, say) a red icon and calm text.
|
|
7
|
+
//
|
|
8
|
+
// Module scope rather than a component's `<script setup>`, where a top-level const is rebuilt for
|
|
9
|
+
// every instance: the step list renders on every in-progress, parked and failed bootstrap card on
|
|
10
|
+
// the board, plus the inspector and the failure card.
|
|
11
|
+
|
|
12
|
+
/** How one step state renders: its icon, the icon's tone, and the label's. */
|
|
13
|
+
export interface BootstrapStepStyle {
|
|
14
|
+
icon: string
|
|
15
|
+
iconClass: string
|
|
16
|
+
labelClass: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The style per state. `stopped` is deliberately NOT the failure red: a run someone stopped is
|
|
21
|
+
* stored as a failure without being one, and the step they stopped in is usually the review,
|
|
22
|
+
* whose only actor is the reviewer themselves.
|
|
23
|
+
*/
|
|
24
|
+
export const BOOTSTRAP_STEP_STYLE: Record<BootstrapStepState, BootstrapStepStyle> = {
|
|
25
|
+
pending: {
|
|
26
|
+
icon: 'i-lucide-circle',
|
|
27
|
+
iconClass: 'text-slate-500',
|
|
28
|
+
labelClass: 'text-slate-500',
|
|
29
|
+
},
|
|
30
|
+
running: {
|
|
31
|
+
icon: 'i-lucide-loader-circle',
|
|
32
|
+
iconClass: 'animate-spin text-amber-400',
|
|
33
|
+
labelClass: 'text-amber-100',
|
|
34
|
+
},
|
|
35
|
+
awaiting_review: {
|
|
36
|
+
icon: 'i-lucide-user-check',
|
|
37
|
+
iconClass: 'text-amber-400',
|
|
38
|
+
labelClass: 'text-amber-100',
|
|
39
|
+
},
|
|
40
|
+
done: {
|
|
41
|
+
icon: 'i-lucide-check-circle-2',
|
|
42
|
+
iconClass: 'text-emerald-400',
|
|
43
|
+
labelClass: 'text-slate-400',
|
|
44
|
+
},
|
|
45
|
+
failed: {
|
|
46
|
+
icon: 'i-lucide-alert-triangle',
|
|
47
|
+
iconClass: 'text-rose-400',
|
|
48
|
+
labelClass: 'text-rose-200',
|
|
49
|
+
},
|
|
50
|
+
stopped: {
|
|
51
|
+
icon: 'i-lucide-circle-stop',
|
|
52
|
+
iconClass: 'text-slate-400',
|
|
53
|
+
labelClass: 'text-slate-300',
|
|
54
|
+
},
|
|
55
|
+
unknown: {
|
|
56
|
+
icon: 'i-lucide-help-circle',
|
|
57
|
+
iconClass: 'text-slate-400',
|
|
58
|
+
labelClass: 'text-slate-400',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
MONOREPO_ADOPTION_AGENT_KIND,
|
|
4
|
+
PIPELINE_PURPOSES,
|
|
5
|
+
purposeAllowsAgentCategory,
|
|
6
|
+
REPO_BOOTSTRAP_AGENT_KIND,
|
|
7
|
+
} from '@cat-factory/contracts'
|
|
3
8
|
import type { AgentKind, BlockStatus, BlockType } from '~/types/domain'
|
|
4
9
|
import { narrowAgentPalette } from '~/utils/agentPalette'
|
|
5
10
|
import {
|
|
@@ -78,6 +83,17 @@ describe('catalog', () => {
|
|
|
78
83
|
}
|
|
79
84
|
})
|
|
80
85
|
|
|
86
|
+
it('names the kinds a bootstrap run files its telemetry under', () => {
|
|
87
|
+
// The backend stamps these two on a bootstrap run's metric, snapshot and tool-call rows, and
|
|
88
|
+
// the observability panel groups by kind. Unnamed here they roll up under the generic "Agent"
|
|
89
|
+
// fallback: the survey's model calls and the apply container's under one unlabelled heading,
|
|
90
|
+
// on the one panel whose job is telling them apart. Asserted through the same constants the
|
|
91
|
+
// backend imports, so this cannot pass against a stale spelling.
|
|
92
|
+
for (const kind of [REPO_BOOTSTRAP_AGENT_KIND, MONOREPO_ADOPTION_AGENT_KIND]) {
|
|
93
|
+
expect(agentKindMeta(kind).label, `${kind} falls back to the unnamed agent`).not.toBe('Agent')
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
|
|
81
97
|
it('classifies every built-in kind into a tier', () => {
|
|
82
98
|
// The palette / model-preset surfaces open on `basic`, so a built-in that forgot its tier
|
|
83
99
|
// would silently fall to the DEFAULT (intermediate) and vanish from the default view for
|