feat: add bounded diagnostics and improve UX feedback

Ask and Execute guidance, Runtime state, live announcements, loading states,
retry paths, settings focus, and update failures now provide consistent and
accessible feedback across the desktop experience.

Add bounded redacted Desktop and Agent diagnostic logs, a read-only Agent
diagnostics command, and an explicit opt-in for attaching a small Desktop
diagnostic summary to in-app feedback. Diagnostics stay local by default and
the existing feedback v1 service contract remains compatible.

Release note: 新增可选桌面诊断反馈与 Agent 诊断导出,并统一 Ask/Execute 状态、错误恢复和无障碍反馈;诊断默认保留在本地,仅在用户明确勾选时附加桌面摘要。
This commit is contained in:
mesalogo
2026-08-31 15:35:13 +08:00
parent b1729125e1
commit 2833a27f83
60 changed files with 4679 additions and 216 deletions
+55
View File
@@ -17,6 +17,7 @@ describe('feedback contracts', () => {
category,
title: ' Feedback title ',
description: ' A useful feedback description. ',
includeDiagnostics: false,
locale: 'zh-CN',
clientRequestId
})
@@ -33,6 +34,7 @@ describe('feedback contracts', () => {
category: 'bug',
title: 'Feedback title',
description: 'A useful feedback description.',
includeDiagnostics: false,
locale: 'zh-CN',
clientRequestId,
endpoint: 'https://attacker.example'
@@ -43,6 +45,7 @@ describe('feedback contracts', () => {
category: 'bug',
title: 'Feedback title',
description: 'A useful feedback description.',
includeDiagnostics: false,
contactEmail: 'not-an-email',
locale: 'zh-CN',
clientRequestId
@@ -53,6 +56,7 @@ describe('feedback contracts', () => {
category: 'bug',
title: 'Feedback title',
description: 'A useful feedback description.',
includeDiagnostics: false,
locale: 'zh-CN',
clientRequestId,
screenshot: {
@@ -65,6 +69,39 @@ describe('feedback contracts', () => {
).toThrow()
})
it('reserves description space only when diagnostics are selected', () => {
expect(
feedbackLimits.maximumDescriptionCharactersWithDiagnostics
).toBe(
feedbackLimits.maximumDescriptionCharacters -
feedbackLimits.maximumDiagnosticsSummaryCharacters -
'\n\n'.length
)
const description = 'x'.repeat(
feedbackLimits.maximumDescriptionCharactersWithDiagnostics + 1
)
expect(() =>
feedbackSubmitInputSchema.parse({
category: 'bug',
title: 'Feedback title',
description,
includeDiagnostics: true,
locale: 'zh-CN',
clientRequestId
})
).toThrow()
expect(
feedbackSubmitInputSchema.parse({
category: 'bug',
title: 'Feedback title',
description,
includeDiagnostics: false,
locale: 'zh-CN',
clientRequestId
}).description
).toBe(description)
})
it('matches the deployed version 1 public payload and response', () => {
expect(
feedbackPublicPayloadSchema.parse({
@@ -87,6 +124,24 @@ describe('feedback contracts', () => {
schemaVersion: 1,
productKey: 'goodbuddy'
})
expect(() =>
feedbackPublicPayloadSchema.parse({
schemaVersion: 1,
productKey: 'goodbuddy',
category: 'experience',
title: 'Feedback title',
description: 'A useful feedback description.',
includeDiagnostics: true,
environment: {
appVersion: '0.11.0',
platform: 'windows',
architecture: 'x64',
locale: 'en-US'
},
installationId,
clientRequestId
})
).toThrow()
expect(
feedbackPublicResponseSchema.parse({
reference: 'GOODBUDDY-1000000',
+32 -2
View File
@@ -7,10 +7,20 @@ export const feedbackCategories = [
'other'
] as const
const maximumDescriptionCharacters = 5_000
const maximumDiagnosticsSummaryCharacters = 1_600
const diagnosticsDescriptionSeparatorCharacters = '\n\n'.length
export const feedbackLimits = {
maximumTitleCharacters: 120,
minimumDescriptionCharacters: 10,
maximumDescriptionCharacters: 5_000,
maximumDescriptionCharacters,
maximumDiagnosticsSummaryCharacters,
maximumDiagnosticRecords: 20,
maximumDescriptionCharactersWithDiagnostics:
maximumDescriptionCharacters -
maximumDiagnosticsSummaryCharacters -
diagnosticsDescriptionSeparatorCharacters,
maximumEmailCharacters: 254,
maximumScreenshotBytes: 5 * 1_024 * 1_024,
maximumScreenshotDimension: 8_192,
@@ -61,11 +71,30 @@ const feedbackContentSchema = z
export const feedbackSubmitInputSchema = feedbackContentSchema
.extend({
includeDiagnostics: z.boolean(),
locale: feedbackLocaleSchema,
clientRequestId: z.uuid(),
screenshot: feedbackScreenshotInputSchema.optional()
})
.strict()
.superRefine((input, context) => {
if (
input.includeDiagnostics &&
input.description.length >
feedbackLimits.maximumDescriptionCharactersWithDiagnostics
) {
context.addIssue({
code: 'too_big',
maximum:
feedbackLimits.maximumDescriptionCharactersWithDiagnostics,
origin: 'string',
inclusive: true,
path: ['description'],
message:
'Description exceeds the limit when diagnostics are included'
})
}
})
export const feedbackEnvironmentSchema = z
.object({
@@ -103,7 +132,8 @@ export const feedbackSubmissionErrorCodes = [
'service-error',
'network',
'timeout',
'invalid-response'
'invalid-response',
'diagnostics-unavailable'
] as const
export const feedbackSubmitResultSchema = z.discriminatedUnion('ok', [