@cat-factory/app 0.87.1 → 0.87.2

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.
@@ -5,6 +5,8 @@
5
5
  // message. Tone (summary/pre classes) is passed by the host so it blends into each surface
6
6
  // (rose banner vs slate history) while the guard + the `showDetail` key + the whitespace-
7
7
  // preserving `<pre>` structure live in one place.
8
+ import CopyButton from '~/components/common/CopyButton.vue'
9
+
8
10
  defineProps<{
9
11
  detail: string | null
10
12
  message: string
@@ -20,8 +22,15 @@ const { t } = useI18n()
20
22
  <summary class="cursor-pointer" :class="summaryClass">
21
23
  {{ t('board.failure.showDetail') }}
22
24
  </summary>
23
- <pre class="mt-1 max-h-32 overflow-auto whitespace-pre-wrap rounded p-1.5" :class="preClass">{{
24
- detail
25
- }}</pre>
25
+ <!-- The stack trace / extended detail: the first thing a user does with it is copy it, so
26
+ offer a copy affordance floated over the scroll box (UX-39). -->
27
+ <div class="relative mt-1">
28
+ <CopyButton :text="detail" class="absolute end-1 top-1 z-10" />
29
+ <pre
30
+ class="max-h-32 overflow-auto whitespace-pre-wrap rounded p-1.5 pe-9"
31
+ :class="preClass"
32
+ >{{ detail }}</pre
33
+ >
34
+ </div>
26
35
  </details>
27
36
  </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ // Standard icon-only "copy to clipboard" button with confirmation feedback. Routes through
3
+ // `useCopyToClipboard` so success/failure is always toasted (UX-38), and carries both a
4
+ // `title` and an `aria-label` so it's named for pointer tooltips and screen readers alike.
5
+ // Used to make error/detail surfaces copyable (UX-39) — the first thing a user does with a
6
+ // stack trace or failure summary is copy it.
7
+ const props = defineProps<{
8
+ /** The text to place on the clipboard. */
9
+ text: string
10
+ /** Accessible name + tooltip; defaults to the generic "Copy". */
11
+ label?: string
12
+ size?: 'xs' | 'sm' | 'md'
13
+ }>()
14
+
15
+ const { t } = useI18n()
16
+ const { copy } = useCopyToClipboard()
17
+ const label = computed(() => props.label ?? t('common.copy'))
18
+ </script>
19
+
20
+ <template>
21
+ <UButton
22
+ icon="i-lucide-copy"
23
+ color="neutral"
24
+ variant="ghost"
25
+ :size="size ?? 'xs'"
26
+ :title="label"
27
+ :aria-label="label"
28
+ @click.stop="copy(text)"
29
+ />
30
+ </template>
@@ -8,6 +8,7 @@
8
8
  // as `consensus` stream events arrive.
9
9
  import { computed } from 'vue'
10
10
  import type { ConsensusContribution, ConsensusSession } from '~/types/consensus'
11
+ import CopyButton from '~/components/common/CopyButton.vue'
11
12
 
12
13
  const { t, n } = useI18n()
13
14
 
@@ -149,9 +150,12 @@ function topScore(c: ConsensusContribution): { label: string; value: number } |
149
150
  <!-- failure -->
150
151
  <div
151
152
  v-if="session.status === 'failed'"
152
- class="mb-5 rounded-lg border border-rose-800/60 bg-rose-950/40 px-4 py-3 text-sm text-rose-200"
153
+ class="mb-5 flex items-start gap-2 rounded-lg border border-rose-800/60 bg-rose-950/40 px-4 py-3 text-sm text-rose-200"
153
154
  >
154
- {{ t('consensus.failed', { error: session.error ?? t('consensus.unknownError') }) }}
155
+ <span class="min-w-0 flex-1">{{
156
+ t('consensus.failed', { error: session.error ?? t('consensus.unknownError') })
157
+ }}</span>
158
+ <CopyButton v-if="session.error" :text="session.error" class="-me-1 shrink-0" />
155
159
  </div>
156
160
 
157
161
  <!-- synthesized result -->
@@ -12,6 +12,7 @@ import StepRestartControl from '~/components/panels/StepRestartControl.vue'
12
12
  import StepRunMeta from '~/components/panels/StepRunMeta.vue'
13
13
  import AttemptEntryHeader from '~/components/panels/AttemptEntryHeader.vue'
14
14
  import GateFailingCheckList from '~/components/gates/GateFailingCheckList.vue'
15
+ import CopyButton from '~/components/common/CopyButton.vue'
15
16
 
16
17
  const board = useBoardStore()
17
18
  const execution = useExecutionStore()
@@ -252,12 +253,15 @@ const conflictVerdict = computed(() => {
252
253
  <template v-else> {{ t('gates.humanReview.suffixAwaiting') }}</template>
253
254
  </span>
254
255
  </div>
255
- <p
256
+ <div
256
257
  v-if="gate.lastFailureSummary"
257
- class="mt-2 whitespace-pre-wrap rounded-md border border-slate-800 bg-slate-950/40 px-3 py-2 text-[12px] leading-relaxed text-slate-300"
258
+ class="relative mt-2 rounded-md border border-slate-800 bg-slate-950/40 px-3 py-2"
258
259
  >
259
- {{ gate.lastFailureSummary }}
260
- </p>
260
+ <CopyButton :text="gate.lastFailureSummary" class="absolute end-1 top-1" />
261
+ <p class="whitespace-pre-wrap pe-8 text-[12px] leading-relaxed text-slate-300">
262
+ {{ gate.lastFailureSummary }}
263
+ </p>
264
+ </div>
261
265
  <a
262
266
  v-if="prUrl"
263
267
  :href="prUrl"
@@ -330,12 +334,15 @@ const conflictVerdict = computed(() => {
330
334
  <!-- GitHub's API reports mergeability as a single bit (no file list), but the
331
335
  conflict resolver discovers the conflicting files in the container and
332
336
  reports them back — surface that account here. -->
333
- <p
337
+ <div
334
338
  v-if="gate.lastFailureSummary"
335
- class="mt-2 whitespace-pre-wrap rounded-md border border-slate-800 bg-slate-950/40 px-3 py-2 text-[12px] leading-relaxed text-slate-300"
339
+ class="relative mt-2 rounded-md border border-slate-800 bg-slate-950/40 px-3 py-2"
336
340
  >
337
- {{ gate.lastFailureSummary }}
338
- </p>
341
+ <CopyButton :text="gate.lastFailureSummary" class="absolute end-1 top-1" />
342
+ <p class="whitespace-pre-wrap pe-8 text-[12px] leading-relaxed text-slate-300">
343
+ {{ gate.lastFailureSummary }}
344
+ </p>
345
+ </div>
339
346
  <a
340
347
  v-if="prUrl"
341
348
  :href="prUrl"
@@ -195,8 +195,9 @@ onKeyStroke('Escape', () => {
195
195
  if (open.value) close()
196
196
  })
197
197
 
198
+ const { copy } = useCopyToClipboard()
198
199
  async function copyOutput() {
199
- if (step.value?.output) await navigator.clipboard?.writeText(step.value.output)
200
+ if (step.value?.output) await copy(step.value.output)
200
201
  }
201
202
  </script>
202
203
 
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import { useClipboard } from '@vueuse/core'
4
3
  import type { PipelineStep, RunContainerStatus } from '~/types/execution'
5
4
  import { containerPhaseLabel } from '~/utils/pipelineRender'
6
5
 
@@ -65,19 +64,7 @@ const phaseLabel = computed(() => containerPhaseLabel(props.step.container?.phas
65
64
 
66
65
  // Make the container id / URL one-click copyable (they're long and used to be
67
66
  // select-and-copy-by-hand), with a toast confirming the copy landed.
68
- const toast = useToast()
69
- const { copy, isSupported } = useClipboard()
70
- async function copyText(text: string) {
71
- // Only claim success once the write actually landed — a failed/unsupported clipboard
72
- // (insecure context, denied permission) must not show a misleading "Copied" toast.
73
- try {
74
- if (!isSupported.value) throw new Error('clipboard unsupported')
75
- await copy(text)
76
- toast.add({ title: t('common.copied'), color: 'success', icon: 'i-lucide-check' })
77
- } catch {
78
- toast.add({ title: t('common.copyFailed'), color: 'error', icon: 'i-lucide-x' })
79
- }
80
- }
67
+ const { copy: copyText } = useCopyToClipboard()
81
68
  </script>
82
69
 
83
70
  <template>
@@ -70,9 +70,10 @@ function formatClock(ms?: number | null): string | null {
70
70
  return ms ? d(new Date(ms), 'long') : null
71
71
  }
72
72
 
73
+ const { copy } = useCopyToClipboard()
73
74
  async function copyRunId() {
74
75
  const id = props.step.runId ?? props.instanceId
75
- if (id) await navigator.clipboard?.writeText(id)
76
+ if (id) await copy(id)
76
77
  }
77
78
  </script>
78
79
 
@@ -40,8 +40,9 @@ function formatClock(ms?: number | null): string | null {
40
40
  return ms ? d(new Date(ms), 'long') : null
41
41
  }
42
42
 
43
+ const { copy } = useCopyToClipboard()
43
44
  async function copyRunId() {
44
- if (runId.value) await navigator.clipboard?.writeText(runId.value)
45
+ if (runId.value) await copy(runId.value)
45
46
  }
46
47
  </script>
47
48
 
@@ -269,8 +269,9 @@ function optional(label: string): string {
269
269
  // example (not prose), so it stays inline rather than in the i18n catalog — mirroring the format
270
270
  // examples the i18n rules keep out of message bodies.
271
271
  const AUTO_SETUP_COMMAND = 'cat-factory k3s'
272
+ const { copy } = useCopyToClipboard()
272
273
  async function copyAutoSetupCommand() {
273
- await navigator.clipboard?.writeText(AUTO_SETUP_COMMAND)
274
+ await copy(AUTO_SETUP_COMMAND)
274
275
  }
275
276
  </script>
276
277
 
@@ -0,0 +1,29 @@
1
+ // Shared clipboard-with-feedback primitive. Wraps VueUse's `useClipboard` with a toast that
2
+ // confirms the copy actually landed (or reports failure) — the pattern first written inline in
3
+ // `StepContainerStatus.vue`, extracted here so every copy affordance behaves the same.
4
+ //
5
+ // UX-38: several copy handlers called `navigator.clipboard?.writeText(...)` directly with no
6
+ // feedback and no catch, so in an insecure context or when permission was denied the copy was a
7
+ // silent no-op the user couldn't tell apart from success. Routing every copy through this seam
8
+ // makes the outcome always visible.
9
+ import { useClipboard } from '@vueuse/core'
10
+
11
+ export function useCopyToClipboard() {
12
+ const { t } = useI18n()
13
+ const toast = useToast()
14
+ const { copy: writeClipboard, isSupported } = useClipboard()
15
+
16
+ async function copy(text: string) {
17
+ // Only claim success once the write actually landed — a failed/unsupported clipboard
18
+ // (insecure context, denied permission) must not show a misleading "Copied" toast.
19
+ try {
20
+ if (!isSupported.value) throw new Error('clipboard unsupported')
21
+ await writeClipboard(text)
22
+ toast.add({ title: t('common.copied'), color: 'success', icon: 'i-lucide-check' })
23
+ } catch {
24
+ toast.add({ title: t('common.copyFailed'), color: 'error', icon: 'i-lucide-x' })
25
+ }
26
+ }
27
+
28
+ return { copy, isSupported }
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/app",
3
- "version": "0.87.1",
3
+ "version": "0.87.2",
4
4
  "description": "Reusable Nuxt layer for the Agent Architecture Board SPA (components, stores, composables, pages). Consume it from a thin deployment app via `extends: ['@cat-factory/app']` and point it at your backend with NUXT_PUBLIC_API_BASE. See deploy/frontend for an example.",
5
5
  "repository": {
6
6
  "type": "git",