create-principles-disciple 1.76.0 → 1.78.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/console/dist/server/config/feature-flags.d.ts +25 -0
- package/console/dist/server/config/feature-flags.js +101 -0
- package/console/dist/server/index.js +16 -0
- package/console/dist/server/models/FeedbackReportConsoleModel.d.ts +49 -0
- package/console/dist/server/models/FeedbackReportConsoleModel.js +242 -0
- package/console/dist/server/routes/feedback-reports.d.ts +18 -0
- package/console/dist/server/routes/feedback-reports.js +165 -0
- package/console/dist/ui/App.js +2 -1
- package/console/dist/ui/api.d.ts +26 -2
- package/console/dist/ui/api.js +18 -1
- package/console/dist/ui/components/app-sidebar.js +2 -1
- package/console/dist/ui/components/error-boundary.js +9 -2
- package/console/dist/ui/i18n/en.json +67 -1
- package/console/dist/ui/i18n/zh-CN.json +67 -1
- package/console/dist/ui/pages/ReportProblemPage.d.ts +1 -0
- package/console/dist/ui/pages/ReportProblemPage.js +186 -0
- package/console/dist/ui/pages/ReportProblemValidators.d.ts +51 -0
- package/console/dist/ui/pages/ReportProblemValidators.js +114 -0
- package/console/dist/web/assets/app.css +18 -0
- package/console/dist/web/assets/app.js +1047 -125
- package/console/package.json +1 -0
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +24 -1
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/feedback/create-report.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/feedback/create-report.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/create-report.test.js +402 -0
- package/core/dist/runtime-v2/__tests__/feedback/create-report.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/privacy-preview.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/feedback/privacy-preview.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/privacy-preview.test.js +128 -0
- package/core/dist/runtime-v2/__tests__/feedback/privacy-preview.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.js +231 -0
- package/core/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/render-github-url.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/feedback/render-github-url.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/render-github-url.test.js +102 -0
- package/core/dist/runtime-v2/__tests__/feedback/render-github-url.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/render-markdown.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/feedback/render-markdown.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/feedback/render-markdown.test.js +130 -0
- package/core/dist/runtime-v2/__tests__/feedback/render-markdown.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/workspace-guidance-migration.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/workspace-guidance-migration.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/workspace-guidance-migration.test.js +328 -0
- package/core/dist/runtime-v2/__tests__/workspace-guidance-migration.test.js.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.d.ts +2 -0
- package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js +343 -0
- package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js.map +1 -0
- package/core/dist/runtime-v2/activation/index.d.ts +2 -0
- package/core/dist/runtime-v2/activation/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/index.js +1 -0
- package/core/dist/runtime-v2/activation/index.js.map +1 -1
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts +34 -0
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts.map +1 -0
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js +109 -0
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +13 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js +141 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +4 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/index.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/index.js +1 -0
- package/core/dist/runtime-v2/feature-flags/index.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts +25 -0
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js +233 -0
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js.map +1 -0
- package/core/dist/runtime-v2/feedback/create-report.d.ts +14 -0
- package/core/dist/runtime-v2/feedback/create-report.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/create-report.js +257 -0
- package/core/dist/runtime-v2/feedback/create-report.js.map +1 -0
- package/core/dist/runtime-v2/feedback/feedback-types.d.ts +120 -0
- package/core/dist/runtime-v2/feedback/feedback-types.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/feedback-types.js +243 -0
- package/core/dist/runtime-v2/feedback/feedback-types.js.map +1 -0
- package/core/dist/runtime-v2/feedback/index.d.ts +9 -0
- package/core/dist/runtime-v2/feedback/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/index.js +11 -0
- package/core/dist/runtime-v2/feedback/index.js.map +1 -0
- package/core/dist/runtime-v2/feedback/internal-guards.d.ts +2 -0
- package/core/dist/runtime-v2/feedback/internal-guards.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/internal-guards.js +6 -0
- package/core/dist/runtime-v2/feedback/internal-guards.js.map +1 -0
- package/core/dist/runtime-v2/feedback/privacy-preview.d.ts +14 -0
- package/core/dist/runtime-v2/feedback/privacy-preview.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/privacy-preview.js +128 -0
- package/core/dist/runtime-v2/feedback/privacy-preview.js.map +1 -0
- package/core/dist/runtime-v2/feedback/redact-sensitive.d.ts +37 -0
- package/core/dist/runtime-v2/feedback/redact-sensitive.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/redact-sensitive.js +272 -0
- package/core/dist/runtime-v2/feedback/redact-sensitive.js.map +1 -0
- package/core/dist/runtime-v2/feedback/render-github-url.d.ts +21 -0
- package/core/dist/runtime-v2/feedback/render-github-url.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/render-github-url.js +57 -0
- package/core/dist/runtime-v2/feedback/render-github-url.js.map +1 -0
- package/core/dist/runtime-v2/feedback/render-markdown.d.ts +12 -0
- package/core/dist/runtime-v2/feedback/render-markdown.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/render-markdown.js +166 -0
- package/core/dist/runtime-v2/feedback/render-markdown.js.map +1 -0
- package/core/dist/runtime-v2/feedback/safe-stringify.d.ts +6 -0
- package/core/dist/runtime-v2/feedback/safe-stringify.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/safe-stringify.js +115 -0
- package/core/dist/runtime-v2/feedback/safe-stringify.js.map +1 -0
- package/core/dist/runtime-v2/index.d.ts +8 -1
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +12 -1
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/workspace-guidance-migration.d.ts +12 -0
- package/core/dist/runtime-v2/workspace-guidance-migration.d.ts.map +1 -0
- package/core/dist/runtime-v2/workspace-guidance-migration.js +193 -0
- package/core/dist/runtime-v2/workspace-guidance-migration.js.map +1 -0
- package/core/package.json +4 -0
- package/package.json +1 -1
- package/plugin/dist/commands/context.js +5 -5
- package/plugin/dist/commands/strategy.d.ts +0 -1
- package/plugin/dist/commands/strategy.js +0 -14
- package/plugin/dist/core/runtime-v2-prompt-activation-reader.d.ts +4 -13
- package/plugin/dist/core/runtime-v2-prompt-activation-reader.js +36 -74
- package/plugin/dist/core/surface-guard.d.ts +27 -0
- package/plugin/dist/core/surface-guard.js +82 -0
- package/plugin/dist/core/workspace-guidance-migrator.d.ts +12 -0
- package/plugin/dist/core/workspace-guidance-migrator.js +141 -0
- package/plugin/dist/hooks/prompt.js +20 -143
- package/plugin/dist/i18n/commands.js +2 -14
- package/plugin/dist/index.d.ts +27 -0
- package/plugin/dist/index.js +180 -65
- package/plugin/dist/service/correction-observer-service.d.ts +11 -0
- package/plugin/dist/service/correction-observer-service.js +172 -0
- package/plugin/dist/service/evolution-worker.js +1 -110
- package/plugin/dist/types.d.ts +2 -2
- package/plugin/dist/types.js +3 -3
- package/plugin/templates/langs/en/core/BOOTSTRAP.md +5 -19
- package/plugin/templates/langs/en/principles/THINKING_OS.md +1 -1
- package/plugin/templates/langs/en/skills/admin/SKILL.md +2 -2
- package/plugin/templates/langs/en/skills/bootstrap-tools/SKILL.md +1 -1
- package/plugin/templates/langs/en/skills/init-strategy/SKILL.md +1 -1
- package/plugin/templates/langs/en/skills/pd-mentor/SKILL.md +8 -23
- package/plugin/templates/langs/en/skills/reflection/SKILL.md +2 -2
- package/plugin/templates/langs/en/skills/report/SKILL.md +1 -1
- package/plugin/templates/langs/zh/core/BOOTSTRAP.md +3 -16
- package/plugin/templates/langs/zh/principles/THINKING_OS.md +1 -1
- package/plugin/templates/langs/zh/skills/admin/SKILL.md +2 -2
- package/plugin/templates/langs/zh/skills/bootstrap-tools/SKILL.md +1 -1
- package/plugin/templates/langs/zh/skills/init-strategy/SKILL.md +1 -1
- package/plugin/templates/langs/zh/skills/pd-mentor/SKILL.md +7 -22
- package/plugin/templates/langs/zh/skills/reflection/SKILL.md +2 -2
- package/plugin/templates/langs/zh/skills/report/SKILL.md +1 -1
- package/plugin/templates/workspace/.principles/THINKING_OS.md +1 -1
- package/templates/langs/en/core/BOOTSTRAP.md +1 -1
- package/templates/langs/en/principles/THINKING_OS.md +1 -1
- package/templates/langs/en/skills/admin/SKILL.md +2 -2
- package/templates/langs/en/skills/pd-grooming/SKILL.md +1 -1
- package/templates/langs/en/skills/reflection/SKILL.md +2 -2
- package/templates/langs/en/skills/report/SKILL.md +1 -1
- package/templates/langs/zh/core/BOOTSTRAP.md +1 -1
- package/templates/langs/zh/principles/THINKING_OS.md +1 -1
- package/templates/langs/zh/skills/admin/SKILL.md +2 -2
- package/templates/langs/zh/skills/pd-grooming/SKILL.md +1 -1
- package/templates/langs/zh/skills/reflection/SKILL.md +2 -2
- package/templates/langs/zh/skills/report/SKILL.md +1 -1
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/EXAMPLES.md +0 -63
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/REFERENCE.md +0 -136
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/SKILL.md +0 -67
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/agent-registry.json +0 -143
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/specs/bugfix-complex-template.json +0 -107
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/specs/feature-complex-template.json +0 -107
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal-verify.json +0 -95
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal.json +0 -98
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/workflow-v1-acceptance-checklist.md +0 -58
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/references/workflow-v1.4-work-unit-handoff.md +0 -190
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/archive.mjs +0 -310
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/contract-enforcement.mjs +0 -683
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/decision.mjs +0 -604
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/state-store.mjs +0 -32
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/task-specs.mjs +0 -707
- package/plugin/templates/langs/en/skills/ai-sprint-orchestration/scripts/run.mjs +0 -3455
- package/plugin/templates/langs/en/skills/evolve-system/SKILL.md +0 -46
- package/plugin/templates/langs/en/skills/manage-okr/SKILL.md +0 -96
- package/plugin/templates/langs/en/skills/pd-daily/SKILL.md +0 -199
- package/plugin/templates/langs/en/skills/pd-grooming/SKILL.md +0 -46
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/EXAMPLES.md +0 -63
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/REFERENCE.md +0 -136
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/SKILL.md +0 -67
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/agent-registry.json +0 -143
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/bugfix-complex-template.json +0 -107
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/feature-complex-template.json +0 -107
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/nocturnal-trinity-quality-enhancement.json +0 -111
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal-verify.json +0 -95
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal.json +0 -98
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/workflow-v1-acceptance-checklist.md +0 -58
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/references/workflow-v1.4-work-unit-handoff.md +0 -190
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/runtime/.gitignore +0 -2
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/archive.mjs +0 -310
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/contract-enforcement.mjs +0 -683
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/decision.mjs +0 -604
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/state-store.mjs +0 -32
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/task-specs.mjs +0 -707
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/scripts/run.mjs +0 -3455
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/test/archive.test.mjs +0 -230
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/test/contract-enforcement.test.mjs +0 -672
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/test/decision.test.mjs +0 -1321
- package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/test/run.test.mjs +0 -1435
- package/plugin/templates/langs/zh/skills/evolve-system/SKILL.md +0 -46
- package/plugin/templates/langs/zh/skills/manage-okr/SKILL.md +0 -109
- package/plugin/templates/langs/zh/skills/pd-daily/SKILL.md +0 -283
- package/plugin/templates/langs/zh/skills/pd-grooming/SKILL.md +0 -46
- package/plugin/templates/workspace/PLAN.md +0 -2
- package/templates/workspace/PLAN.md +0 -2
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// create-report.ts
|
|
2
|
+
// Orchestrator: validate input → collect diagnostics → redact → render.
|
|
3
|
+
// ERR-001/005/013: no `as` casts on untrusted input.
|
|
4
|
+
// ERR-002: failure paths return {ok: false, errors: ValidationError[]}; success returns {ok: true, report: FeedbackReport}.
|
|
5
|
+
// ERR-003: redaction uses segment-exact key matching (handled by redact-sensitive).
|
|
6
|
+
// ERR-014/016/017: bounded previews, BigInt-safe safeStringifyPreview.
|
|
7
|
+
import { isRecord, isString, isUserSeverity, normalizeFeedbackDraftInput, } from './feedback-types.js';
|
|
8
|
+
import { redactAbsolutePaths, redactTokenLikeValues, redactEnvLikeValues, redactSensitiveFields, } from './redact-sensitive.js';
|
|
9
|
+
import { renderReportMarkdown } from './render-markdown.js';
|
|
10
|
+
import { buildGitHubIssueDraftUrl } from './render-github-url.js';
|
|
11
|
+
import { buildPrivacyPreview, buildEmailText } from './privacy-preview.js';
|
|
12
|
+
const MAX_DESCRIPTION_FOR_REDACT = 8000;
|
|
13
|
+
const MAX_STEPS_FOR_REDACT = 8000;
|
|
14
|
+
const MAX_CONTEXT_REFS = 12;
|
|
15
|
+
const MAX_REDACTION_NOTES = 20;
|
|
16
|
+
function generateReportId() {
|
|
17
|
+
try {
|
|
18
|
+
if (typeof globalThis.crypto !== 'undefined' && typeof globalThis.crypto.randomUUID === 'function') {
|
|
19
|
+
return 'fb-' + globalThis.crypto.randomUUID();
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// Fallback below
|
|
24
|
+
}
|
|
25
|
+
const ts = Date.now().toString(36);
|
|
26
|
+
const rand = Math.random().toString(36).slice(2, 8);
|
|
27
|
+
return 'fb-' + ts + '-' + rand;
|
|
28
|
+
}
|
|
29
|
+
function applyUserTextRedactions(text) {
|
|
30
|
+
if (typeof text !== 'string')
|
|
31
|
+
return '';
|
|
32
|
+
let out = text;
|
|
33
|
+
if (out.length > MAX_DESCRIPTION_FOR_REDACT) {
|
|
34
|
+
out = out.slice(0, MAX_DESCRIPTION_FOR_REDACT);
|
|
35
|
+
}
|
|
36
|
+
out = redactAbsolutePaths(out);
|
|
37
|
+
out = redactTokenLikeValues(out);
|
|
38
|
+
out = redactEnvLikeValues(out);
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
function applyStepsRedactions(text) {
|
|
42
|
+
if (typeof text !== 'string')
|
|
43
|
+
return undefined;
|
|
44
|
+
let out = text;
|
|
45
|
+
if (out.length > MAX_STEPS_FOR_REDACT) {
|
|
46
|
+
out = out.slice(0, MAX_STEPS_FOR_REDACT);
|
|
47
|
+
}
|
|
48
|
+
out = redactAbsolutePaths(out);
|
|
49
|
+
out = redactTokenLikeValues(out);
|
|
50
|
+
out = redactEnvLikeValues(out);
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
function pushContextRef(refs, kind, args) {
|
|
54
|
+
if (refs.length >= MAX_CONTEXT_REFS)
|
|
55
|
+
return;
|
|
56
|
+
if (typeof args.id !== 'string' || args.id.length === 0)
|
|
57
|
+
return;
|
|
58
|
+
const r = { kind, id: args.id };
|
|
59
|
+
if (typeof args.label === 'string' && args.label.length > 0)
|
|
60
|
+
r.label = args.label;
|
|
61
|
+
refs.push(r);
|
|
62
|
+
}
|
|
63
|
+
function pickString(value) {
|
|
64
|
+
return typeof value === 'string' ? value : undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build a DiagnosticSummary from an unknown diagnostics value.
|
|
68
|
+
* Always returns a valid DiagnosticSummary. Records `unavailableReason` for
|
|
69
|
+
* unparseable versions/feature flags/canary — never throws.
|
|
70
|
+
*/
|
|
71
|
+
function collectDiagnostics(diagnostics) {
|
|
72
|
+
if (!isRecord(diagnostics)) {
|
|
73
|
+
return {
|
|
74
|
+
versions: { unavailableReason: 'diagnostics not provided' },
|
|
75
|
+
platform: { unavailableReason: 'diagnostics not provided' },
|
|
76
|
+
featureFlags: { unavailableReason: 'diagnostics not provided' },
|
|
77
|
+
canary: { status: 'unavailable', unavailableReason: 'diagnostics not provided' },
|
|
78
|
+
recentEvents: [],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// versions
|
|
82
|
+
let versions = { unavailableReason: 'versions not available' };
|
|
83
|
+
if (Object.hasOwn(diagnostics, 'versions') && isRecord(diagnostics.versions)) {
|
|
84
|
+
versions = { ...diagnostics.versions };
|
|
85
|
+
}
|
|
86
|
+
// platform
|
|
87
|
+
let platform = { unavailableReason: 'platform not available' };
|
|
88
|
+
if (Object.hasOwn(diagnostics, 'platform') && isRecord(diagnostics.platform)) {
|
|
89
|
+
platform = { ...diagnostics.platform };
|
|
90
|
+
}
|
|
91
|
+
// featureFlags
|
|
92
|
+
let featureFlags = { unavailableReason: 'feature flags not available' };
|
|
93
|
+
if (Object.hasOwn(diagnostics, 'featureFlags') && isRecord(diagnostics.featureFlags)) {
|
|
94
|
+
featureFlags = { ...diagnostics.featureFlags };
|
|
95
|
+
}
|
|
96
|
+
// canary
|
|
97
|
+
let canary = { status: 'unavailable', unavailableReason: 'canary not available' };
|
|
98
|
+
if (Object.hasOwn(diagnostics, 'canary') && isRecord(diagnostics.canary)) {
|
|
99
|
+
const c = diagnostics.canary;
|
|
100
|
+
if (Object.hasOwn(c, 'status') && (c.status === 'available' || c.status === 'unavailable')) {
|
|
101
|
+
const { status } = c;
|
|
102
|
+
const built = { status };
|
|
103
|
+
if (status === 'available') {
|
|
104
|
+
if (isString(c.summary))
|
|
105
|
+
built.summary = c.summary;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (isString(c.unavailableReason))
|
|
109
|
+
built.unavailableReason = c.unavailableReason;
|
|
110
|
+
else
|
|
111
|
+
built.unavailableReason = 'canary reported unavailable';
|
|
112
|
+
}
|
|
113
|
+
canary = built;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// recentEvents
|
|
117
|
+
let recentEvents = [];
|
|
118
|
+
if (Object.hasOwn(diagnostics, 'recentEvents') && Array.isArray(diagnostics.recentEvents)) {
|
|
119
|
+
const arr = diagnostics.recentEvents;
|
|
120
|
+
for (const e of arr) {
|
|
121
|
+
if (!isRecord(e))
|
|
122
|
+
continue;
|
|
123
|
+
const evType = pickString(e.type);
|
|
124
|
+
const evSummary = pickString(e.summary);
|
|
125
|
+
const evAt = pickString(e.at);
|
|
126
|
+
if (!evType || !evSummary || !evAt)
|
|
127
|
+
continue;
|
|
128
|
+
const ev = { type: evType, at: evAt, summary: evSummary };
|
|
129
|
+
const sev = pickString(e.severity);
|
|
130
|
+
if (sev)
|
|
131
|
+
ev.severity = sev;
|
|
132
|
+
recentEvents.push(ev);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { versions, platform, featureFlags, canary, recentEvents };
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Create a FeedbackReport from untrusted input + diagnostics.
|
|
139
|
+
* No `as` casts on untrusted values. Failure paths return structured errors.
|
|
140
|
+
*/
|
|
141
|
+
export function createFeedbackReport(input, diagnostics) {
|
|
142
|
+
// Step 1: validate and normalize the input
|
|
143
|
+
const norm = normalizeFeedbackDraftInput(input);
|
|
144
|
+
if (!norm.ok) {
|
|
145
|
+
return { ok: false, errors: norm.errors };
|
|
146
|
+
}
|
|
147
|
+
const draft = norm.value;
|
|
148
|
+
// Step 2: collect diagnostics (never throws; missing diagnostics produce
|
|
149
|
+
// structured unavailable entries, not errors)
|
|
150
|
+
const diagnosticSummary = collectDiagnostics(diagnostics);
|
|
151
|
+
// Step 3: redact the user-provided text fields
|
|
152
|
+
const redactionNotes = [];
|
|
153
|
+
const description = applyUserTextRedactions(draft.userText.description);
|
|
154
|
+
if (description !== draft.userText.description)
|
|
155
|
+
redactionNotes.push('description was redacted (paths/tokens/env values)');
|
|
156
|
+
const stepsInput = draft.userText.stepsToReproduce;
|
|
157
|
+
const stepsToReproduce = typeof stepsInput === 'string' ? applyStepsRedactions(stepsInput) : undefined;
|
|
158
|
+
if (typeof stepsInput === 'string' && stepsToReproduce !== stepsInput) {
|
|
159
|
+
redactionNotes.push('stepsToReproduce was redacted (paths/tokens/env values)');
|
|
160
|
+
}
|
|
161
|
+
const expectedInput = draft.userText.expectedBehavior;
|
|
162
|
+
const expectedBehavior = typeof expectedInput === 'string'
|
|
163
|
+
? redactAbsolutePaths(redactTokenLikeValues(redactEnvLikeValues(expectedInput)))
|
|
164
|
+
: undefined;
|
|
165
|
+
if (typeof expectedInput === 'string' && expectedBehavior !== expectedInput) {
|
|
166
|
+
redactionNotes.push('expectedBehavior was redacted');
|
|
167
|
+
}
|
|
168
|
+
const actualInput = draft.userText.actualBehavior;
|
|
169
|
+
const actualBehavior = typeof actualInput === 'string'
|
|
170
|
+
? redactAbsolutePaths(redactTokenLikeValues(redactEnvLikeValues(actualInput)))
|
|
171
|
+
: undefined;
|
|
172
|
+
if (typeof actualInput === 'string' && actualBehavior !== actualInput) {
|
|
173
|
+
redactionNotes.push('actualBehavior was redacted');
|
|
174
|
+
}
|
|
175
|
+
// Step 4: scrub the diagnosticSummary via redactSensitiveFields (defense in
|
|
176
|
+
// depth — versions and platform should already be low-sensitivity, but
|
|
177
|
+
// user-injected values must not leak tokens through the field structure).
|
|
178
|
+
const scrubbed = redactSensitiveFields(diagnosticSummary);
|
|
179
|
+
const safeDiagnostic = scrubbed.ok
|
|
180
|
+
? scrubbed.value
|
|
181
|
+
: diagnosticSummary;
|
|
182
|
+
if (scrubbed.ok) {
|
|
183
|
+
for (const n of scrubbed.notes) {
|
|
184
|
+
if (redactionNotes.length < MAX_REDACTION_NOTES)
|
|
185
|
+
redactionNotes.push(n);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Step 5: redact the title for the URL (but keep the original title in the
|
|
189
|
+
// report itself so the user can read what they wrote)
|
|
190
|
+
const redactedTitle = redactAbsolutePaths(redactTokenLikeValues(draft.title));
|
|
191
|
+
// Step 6: build contextRefs from the context object
|
|
192
|
+
const contextRefs = [];
|
|
193
|
+
if (draft.context) {
|
|
194
|
+
pushContextRef(contextRefs, 'source', { id: draft.context.source, label: `source=${draft.context.source}` });
|
|
195
|
+
pushContextRef(contextRefs, 'page', { id: draft.context.page });
|
|
196
|
+
pushContextRef(contextRefs, 'painId', { id: draft.context.painId });
|
|
197
|
+
pushContextRef(contextRefs, 'principleId', { id: draft.context.principleId });
|
|
198
|
+
pushContextRef(contextRefs, 'approvalId', { id: draft.context.approvalId });
|
|
199
|
+
pushContextRef(contextRefs, 'activationId', { id: draft.context.activationId });
|
|
200
|
+
pushContextRef(contextRefs, 'updateAttemptId', { id: draft.context.updateAttemptId });
|
|
201
|
+
}
|
|
202
|
+
if (draft.agentDraft) {
|
|
203
|
+
pushContextRef(contextRefs, 'agentDraft', { id: 'present', label: 'agentDraft attached' });
|
|
204
|
+
}
|
|
205
|
+
// Step 7: build the privacy preview
|
|
206
|
+
const privacy = buildPrivacyPreview(redactionNotes);
|
|
207
|
+
// Step 8: assemble the report
|
|
208
|
+
const userText = { description };
|
|
209
|
+
if (stepsToReproduce !== undefined)
|
|
210
|
+
userText.stepsToReproduce = stepsToReproduce;
|
|
211
|
+
if (draft.userText.expectedBehavior !== undefined)
|
|
212
|
+
userText.expectedBehavior = expectedBehavior;
|
|
213
|
+
if (draft.userText.actualBehavior !== undefined)
|
|
214
|
+
userText.actualBehavior = actualBehavior;
|
|
215
|
+
if (isUserSeverity(draft.userText.userSeverity))
|
|
216
|
+
userText.userSeverity = draft.userText.userSeverity;
|
|
217
|
+
const id = generateReportId();
|
|
218
|
+
const createdAt = new Date().toISOString();
|
|
219
|
+
// Step 9: render markdown and email text. Renderers mutate privacy.redactionNotes
|
|
220
|
+
// if they truncate; that's intentional and observable.
|
|
221
|
+
const report = {
|
|
222
|
+
id,
|
|
223
|
+
createdAt,
|
|
224
|
+
type: draft.type,
|
|
225
|
+
title: draft.title,
|
|
226
|
+
userText,
|
|
227
|
+
diagnosticSummary: safeDiagnostic,
|
|
228
|
+
contextRefs,
|
|
229
|
+
privacy,
|
|
230
|
+
outputs: { markdown: '', emailText: '', githubIssueUrl: '' },
|
|
231
|
+
};
|
|
232
|
+
// Surface the agent-attached evidence in the report so it propagates to
|
|
233
|
+
// markdown, emailText, and any later consumer.
|
|
234
|
+
// Redact sensitive values (paths/tokens/env) from agentDraft string fields.
|
|
235
|
+
if (draft.agentDraft) {
|
|
236
|
+
const ad = draft.agentDraft;
|
|
237
|
+
report.agentDraft = {
|
|
238
|
+
summary: redactEnvLikeValues(redactAbsolutePaths(redactTokenLikeValues(ad.summary))),
|
|
239
|
+
};
|
|
240
|
+
if (ad.observedFailure) {
|
|
241
|
+
report.agentDraft.observedFailure = redactEnvLikeValues(redactAbsolutePaths(redactTokenLikeValues(ad.observedFailure)));
|
|
242
|
+
}
|
|
243
|
+
if (ad.commandSummary) {
|
|
244
|
+
report.agentDraft.commandSummary = redactEnvLikeValues(redactAbsolutePaths(redactTokenLikeValues(ad.commandSummary)));
|
|
245
|
+
}
|
|
246
|
+
redactionNotes.push('agentDraft fields were redacted (paths/tokens/env values)');
|
|
247
|
+
}
|
|
248
|
+
report.outputs.markdown = renderReportMarkdown(report);
|
|
249
|
+
report.outputs.emailText = buildEmailText(report);
|
|
250
|
+
// Step 10: build the bounded GitHub issue draft URL using only the redacted
|
|
251
|
+
// title and a short summary (description truncated to 200 chars).
|
|
252
|
+
const shortSummary = `type=${draft.type}; ${description.slice(0, 200)}`;
|
|
253
|
+
const urlResult = buildGitHubIssueDraftUrl(redactedTitle, draft.type, shortSummary);
|
|
254
|
+
report.outputs.githubIssueUrl = urlResult.ok ? urlResult.url : '';
|
|
255
|
+
return { ok: true, report };
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=create-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-report.js","sourceRoot":"","sources":["../../../src/runtime-v2/feedback/create-report.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,wEAAwE;AACxE,qDAAqD;AACrD,4HAA4H;AAC5H,oFAAoF;AACpF,uEAAuE;AAWvE,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;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S,GAAG,wBAAwB,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACpF,MAAM,CAAC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAElE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export type FeedbackType = 'bug' | 'confusing' | 'privacy_concern' | 'feature_request' | 'other';
|
|
2
|
+
export type UserSeverity = 'low' | 'medium' | 'high';
|
|
3
|
+
export type FeedbackSource = 'console' | 'cli' | 'agent';
|
|
4
|
+
export interface FeedbackContext {
|
|
5
|
+
source: FeedbackSource;
|
|
6
|
+
page?: string;
|
|
7
|
+
painId?: string;
|
|
8
|
+
principleId?: string;
|
|
9
|
+
approvalId?: string;
|
|
10
|
+
activationId?: string;
|
|
11
|
+
updateAttemptId?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AgentDraft {
|
|
14
|
+
summary: string;
|
|
15
|
+
observedFailure?: string;
|
|
16
|
+
commandSummary?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FeedbackUserText {
|
|
19
|
+
description: string;
|
|
20
|
+
stepsToReproduce?: string;
|
|
21
|
+
expectedBehavior?: string;
|
|
22
|
+
actualBehavior?: string;
|
|
23
|
+
userSeverity?: UserSeverity;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The contract input: every field is typed as `unknown` because the input
|
|
27
|
+
* comes from untrusted sources (Console form, CLI, agent, or HTTP body).
|
|
28
|
+
* Callers must pass the value through `normalizeFeedbackDraftInput` before
|
|
29
|
+
* any other code touches the fields.
|
|
30
|
+
*/
|
|
31
|
+
export interface FeedbackDraftInput {
|
|
32
|
+
type: unknown;
|
|
33
|
+
title: unknown;
|
|
34
|
+
description: unknown;
|
|
35
|
+
stepsToReproduce?: unknown;
|
|
36
|
+
expectedBehavior?: unknown;
|
|
37
|
+
actualBehavior?: unknown;
|
|
38
|
+
userSeverity?: unknown;
|
|
39
|
+
context?: unknown;
|
|
40
|
+
agentDraft?: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The narrowed shape returned by `normalizeFeedbackDraftInput` on success.
|
|
44
|
+
* Safe to use throughout the rest of the pipeline.
|
|
45
|
+
*/
|
|
46
|
+
export interface NormalizedDraft {
|
|
47
|
+
type: FeedbackType;
|
|
48
|
+
title: string;
|
|
49
|
+
userText: FeedbackUserText;
|
|
50
|
+
context?: FeedbackContext;
|
|
51
|
+
agentDraft?: AgentDraft;
|
|
52
|
+
}
|
|
53
|
+
export interface RecentEvent {
|
|
54
|
+
type: string;
|
|
55
|
+
at: string;
|
|
56
|
+
severity?: string;
|
|
57
|
+
summary: string;
|
|
58
|
+
}
|
|
59
|
+
export interface CanaryStatus {
|
|
60
|
+
status: 'available' | 'unavailable';
|
|
61
|
+
summary?: string;
|
|
62
|
+
unavailableReason?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface DiagnosticSummary {
|
|
65
|
+
versions: Record<string, unknown>;
|
|
66
|
+
platform: Record<string, unknown>;
|
|
67
|
+
featureFlags: Record<string, unknown>;
|
|
68
|
+
canary: CanaryStatus;
|
|
69
|
+
recentEvents: RecentEvent[];
|
|
70
|
+
}
|
|
71
|
+
export interface ContextRef {
|
|
72
|
+
kind: string;
|
|
73
|
+
id: string;
|
|
74
|
+
label?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface PrivacyPreview {
|
|
77
|
+
includedSections: string[];
|
|
78
|
+
excludedByDefault: string[];
|
|
79
|
+
redactionNotes: string[];
|
|
80
|
+
}
|
|
81
|
+
export interface FeedbackReport {
|
|
82
|
+
id: string;
|
|
83
|
+
createdAt: string;
|
|
84
|
+
type: FeedbackType;
|
|
85
|
+
title: string;
|
|
86
|
+
userText: FeedbackUserText;
|
|
87
|
+
agentDraft?: AgentDraft;
|
|
88
|
+
diagnosticSummary: DiagnosticSummary;
|
|
89
|
+
contextRefs: ContextRef[];
|
|
90
|
+
privacy: PrivacyPreview;
|
|
91
|
+
outputs: {
|
|
92
|
+
markdown: string;
|
|
93
|
+
emailText: string;
|
|
94
|
+
githubIssueUrl: string;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export type ValidationError = {
|
|
98
|
+
field: string;
|
|
99
|
+
reason: string;
|
|
100
|
+
nextAction: string;
|
|
101
|
+
};
|
|
102
|
+
export type NormalizeResult = {
|
|
103
|
+
ok: true;
|
|
104
|
+
value: NormalizedDraft;
|
|
105
|
+
} | {
|
|
106
|
+
ok: false;
|
|
107
|
+
errors: ValidationError[];
|
|
108
|
+
};
|
|
109
|
+
export declare function isFeedbackType(value: unknown): value is FeedbackType;
|
|
110
|
+
export declare function isUserSeverity(value: unknown): value is UserSeverity;
|
|
111
|
+
export declare function isFeedbackSource(value: unknown): value is FeedbackSource;
|
|
112
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
113
|
+
export declare function isBoolean(value: unknown): value is boolean;
|
|
114
|
+
export { isString } from './internal-guards.js';
|
|
115
|
+
/**
|
|
116
|
+
* Validate and normalize a `FeedbackDraftInput` value.
|
|
117
|
+
* Returns a discriminated union. Never throws.
|
|
118
|
+
*/
|
|
119
|
+
export declare function normalizeFeedbackDraftInput(value: unknown): NormalizeResult;
|
|
120
|
+
//# sourceMappingURL=feedback-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback-types.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/feedback/feedback-types.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,YAAY,GACpB,KAAK,GACL,WAAW,GACX,iBAAiB,GACjB,iBAAiB,GACjB,OAAO,CAAC;AAEZ,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,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E,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GACpC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAe7C,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAGD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAiFhD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAwH3E"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// feedback-types.ts
|
|
2
|
+
// Core type definitions and runtime validators for the feedback report contract.
|
|
3
|
+
// ERR-001/005/013: no `as` casts on untrusted input. All validation uses typeof + Object.hasOwn + isRecord.
|
|
4
|
+
// ERR-002: failure paths include reason + nextAction.
|
|
5
|
+
import { isString } from './internal-guards.js';
|
|
6
|
+
// ── Type guards ──────────────────────────────────────────────────────────────
|
|
7
|
+
const FEEDBACK_TYPES = [
|
|
8
|
+
'bug',
|
|
9
|
+
'confusing',
|
|
10
|
+
'privacy_concern',
|
|
11
|
+
'feature_request',
|
|
12
|
+
'other',
|
|
13
|
+
];
|
|
14
|
+
const USER_SEVERITIES = ['low', 'medium', 'high'];
|
|
15
|
+
const FEEDBACK_SOURCES = ['console', 'cli', 'agent'];
|
|
16
|
+
export function isFeedbackType(value) {
|
|
17
|
+
return typeof value === 'string' && FEEDBACK_TYPES.includes(value);
|
|
18
|
+
}
|
|
19
|
+
export function isUserSeverity(value) {
|
|
20
|
+
return typeof value === 'string' && USER_SEVERITIES.includes(value);
|
|
21
|
+
}
|
|
22
|
+
export function isFeedbackSource(value) {
|
|
23
|
+
return typeof value === 'string' && FEEDBACK_SOURCES.includes(value);
|
|
24
|
+
}
|
|
25
|
+
export function isRecord(value) {
|
|
26
|
+
if (typeof value !== 'object' || value === null)
|
|
27
|
+
return false;
|
|
28
|
+
if (Array.isArray(value))
|
|
29
|
+
return false;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
export function isBoolean(value) {
|
|
33
|
+
return typeof value === 'boolean';
|
|
34
|
+
}
|
|
35
|
+
// Re-export the shared isString guard so callers can import everything from one place.
|
|
36
|
+
export { isString } from './internal-guards.js';
|
|
37
|
+
// ── Validators (return ValidationError[]; do not throw) ──────────────────────
|
|
38
|
+
function validateOptionalString(value, field, errors) {
|
|
39
|
+
if (value === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
if (!isString(value)) {
|
|
42
|
+
errors.push({
|
|
43
|
+
field,
|
|
44
|
+
reason: `${field} must be a string when provided (ERR-010)`,
|
|
45
|
+
nextAction: `provide a string value for ${field} or omit it`,
|
|
46
|
+
});
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
function validateFeedbackContext(value) {
|
|
52
|
+
const errors = [];
|
|
53
|
+
if (!isRecord(value)) {
|
|
54
|
+
errors.push({
|
|
55
|
+
field: 'context',
|
|
56
|
+
reason: 'context must be a non-null object when provided',
|
|
57
|
+
nextAction: 'provide a valid context object or omit it',
|
|
58
|
+
});
|
|
59
|
+
return errors;
|
|
60
|
+
}
|
|
61
|
+
if (!Object.hasOwn(value, 'source')) {
|
|
62
|
+
errors.push({
|
|
63
|
+
field: 'context.source',
|
|
64
|
+
reason: 'context.source is required when context is provided (ERR-009)',
|
|
65
|
+
nextAction: 'add context.source with a value of console, cli, or agent',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else if (!isFeedbackSource(value.source)) {
|
|
69
|
+
errors.push({
|
|
70
|
+
field: 'context.source',
|
|
71
|
+
reason: 'context.source must be one of: console, cli, agent (ERR-010)',
|
|
72
|
+
nextAction: 'set context.source to a valid FeedbackSource value',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
validateOptionalString(value.page, 'context.page', errors);
|
|
76
|
+
validateOptionalString(value.painId, 'context.painId', errors);
|
|
77
|
+
validateOptionalString(value.principleId, 'context.principleId', errors);
|
|
78
|
+
validateOptionalString(value.approvalId, 'context.approvalId', errors);
|
|
79
|
+
validateOptionalString(value.activationId, 'context.activationId', errors);
|
|
80
|
+
validateOptionalString(value.updateAttemptId, 'context.updateAttemptId', errors);
|
|
81
|
+
return errors;
|
|
82
|
+
}
|
|
83
|
+
function validateAgentDraft(value) {
|
|
84
|
+
const errors = [];
|
|
85
|
+
if (!isRecord(value)) {
|
|
86
|
+
errors.push({
|
|
87
|
+
field: 'agentDraft',
|
|
88
|
+
reason: 'agentDraft must be a non-null object when provided',
|
|
89
|
+
nextAction: 'provide a valid agentDraft object or omit it',
|
|
90
|
+
});
|
|
91
|
+
return errors;
|
|
92
|
+
}
|
|
93
|
+
if (!Object.hasOwn(value, 'summary')) {
|
|
94
|
+
errors.push({
|
|
95
|
+
field: 'agentDraft.summary',
|
|
96
|
+
reason: 'agentDraft.summary is required when agentDraft is provided (ERR-009)',
|
|
97
|
+
nextAction: 'add a summary field to agentDraft',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else if (!isString(value.summary)) {
|
|
101
|
+
errors.push({
|
|
102
|
+
field: 'agentDraft.summary',
|
|
103
|
+
reason: 'agentDraft.summary must be a string (ERR-010)',
|
|
104
|
+
nextAction: 'provide a string value for agentDraft.summary',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
validateOptionalString(value.observedFailure, 'agentDraft.observedFailure', errors);
|
|
108
|
+
validateOptionalString(value.commandSummary, 'agentDraft.commandSummary', errors);
|
|
109
|
+
return errors;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Validate and normalize a `FeedbackDraftInput` value.
|
|
113
|
+
* Returns a discriminated union. Never throws.
|
|
114
|
+
*/
|
|
115
|
+
export function normalizeFeedbackDraftInput(value) {
|
|
116
|
+
const errors = [];
|
|
117
|
+
if (!isRecord(value)) {
|
|
118
|
+
errors.push({
|
|
119
|
+
field: 'root',
|
|
120
|
+
reason: 'feedback input must be a non-null object',
|
|
121
|
+
nextAction: 'provide a valid feedback draft input object',
|
|
122
|
+
});
|
|
123
|
+
return { ok: false, errors };
|
|
124
|
+
}
|
|
125
|
+
// Required: type
|
|
126
|
+
if (!Object.hasOwn(value, 'type')) {
|
|
127
|
+
errors.push({
|
|
128
|
+
field: 'type',
|
|
129
|
+
reason: 'type is required (ERR-009)',
|
|
130
|
+
nextAction: 'add a type field with a valid FeedbackType value',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
else if (!isFeedbackType(value.type)) {
|
|
134
|
+
errors.push({
|
|
135
|
+
field: 'type',
|
|
136
|
+
reason: 'type must be one of: bug, confusing, privacy_concern, feature_request, other (ERR-010)',
|
|
137
|
+
nextAction: 'provide a valid FeedbackType string',
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// Required: title
|
|
141
|
+
if (!Object.hasOwn(value, 'title')) {
|
|
142
|
+
errors.push({
|
|
143
|
+
field: 'title',
|
|
144
|
+
reason: 'title is required (ERR-009)',
|
|
145
|
+
nextAction: 'add a title field with a string value',
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else if (!isString(value.title)) {
|
|
149
|
+
errors.push({
|
|
150
|
+
field: 'title',
|
|
151
|
+
reason: 'title must be a string (ERR-010)',
|
|
152
|
+
nextAction: 'provide a string value for title',
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
// Required: description
|
|
156
|
+
if (!Object.hasOwn(value, 'description')) {
|
|
157
|
+
errors.push({
|
|
158
|
+
field: 'description',
|
|
159
|
+
reason: 'description is required (ERR-009)',
|
|
160
|
+
nextAction: 'add a description field with a string value',
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else if (!isString(value.description)) {
|
|
164
|
+
errors.push({
|
|
165
|
+
field: 'description',
|
|
166
|
+
reason: 'description must be a string (ERR-010)',
|
|
167
|
+
nextAction: 'provide a string value for description',
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
// Optional: stepsToReproduce, expectedBehavior, actualBehavior
|
|
171
|
+
validateOptionalString(value.stepsToReproduce, 'stepsToReproduce', errors);
|
|
172
|
+
validateOptionalString(value.expectedBehavior, 'expectedBehavior', errors);
|
|
173
|
+
validateOptionalString(value.actualBehavior, 'actualBehavior', errors);
|
|
174
|
+
// Optional: userSeverity
|
|
175
|
+
if (value.userSeverity !== undefined && !isUserSeverity(value.userSeverity)) {
|
|
176
|
+
errors.push({
|
|
177
|
+
field: 'userSeverity',
|
|
178
|
+
reason: 'userSeverity must be one of: low, medium, high (ERR-010)',
|
|
179
|
+
nextAction: 'provide a valid UserSeverity value or omit it',
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// Optional: context (object, validated recursively)
|
|
183
|
+
let context = undefined;
|
|
184
|
+
if (value.context !== undefined) {
|
|
185
|
+
const ctxErrors = validateFeedbackContext(value.context);
|
|
186
|
+
for (const e of ctxErrors)
|
|
187
|
+
errors.push(e);
|
|
188
|
+
if (isRecord(value.context) && isFeedbackSource(value.context.source)) {
|
|
189
|
+
const c = value.context;
|
|
190
|
+
const built = { source: c.source };
|
|
191
|
+
if (isString(c.page))
|
|
192
|
+
built.page = c.page;
|
|
193
|
+
if (isString(c.painId))
|
|
194
|
+
built.painId = c.painId;
|
|
195
|
+
if (isString(c.principleId))
|
|
196
|
+
built.principleId = c.principleId;
|
|
197
|
+
if (isString(c.approvalId))
|
|
198
|
+
built.approvalId = c.approvalId;
|
|
199
|
+
if (isString(c.activationId))
|
|
200
|
+
built.activationId = c.activationId;
|
|
201
|
+
if (isString(c.updateAttemptId))
|
|
202
|
+
built.updateAttemptId = c.updateAttemptId;
|
|
203
|
+
context = built;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// Optional: agentDraft
|
|
207
|
+
let agentDraft = undefined;
|
|
208
|
+
if (value.agentDraft !== undefined) {
|
|
209
|
+
const adErrors = validateAgentDraft(value.agentDraft);
|
|
210
|
+
for (const e of adErrors)
|
|
211
|
+
errors.push(e);
|
|
212
|
+
if (isRecord(value.agentDraft) && isString(value.agentDraft.summary)) {
|
|
213
|
+
const a = value.agentDraft;
|
|
214
|
+
const built = { summary: a.summary };
|
|
215
|
+
if (isString(a.observedFailure))
|
|
216
|
+
built.observedFailure = a.observedFailure;
|
|
217
|
+
if (isString(a.commandSummary))
|
|
218
|
+
built.commandSummary = a.commandSummary;
|
|
219
|
+
agentDraft = built;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (errors.length > 0)
|
|
223
|
+
return { ok: false, errors };
|
|
224
|
+
const type = value.type;
|
|
225
|
+
const title = value.title;
|
|
226
|
+
const description = value.description;
|
|
227
|
+
const userText = { description };
|
|
228
|
+
if (isString(value.stepsToReproduce))
|
|
229
|
+
userText.stepsToReproduce = value.stepsToReproduce;
|
|
230
|
+
if (isString(value.expectedBehavior))
|
|
231
|
+
userText.expectedBehavior = value.expectedBehavior;
|
|
232
|
+
if (isString(value.actualBehavior))
|
|
233
|
+
userText.actualBehavior = value.actualBehavior;
|
|
234
|
+
if (isUserSeverity(value.userSeverity))
|
|
235
|
+
userText.userSeverity = value.userSeverity;
|
|
236
|
+
const normalized = { type, title, userText };
|
|
237
|
+
if (context)
|
|
238
|
+
normalized.context = context;
|
|
239
|
+
if (agentDraft)
|
|
240
|
+
normalized.agentDraft = agentDraft;
|
|
241
|
+
return { ok: true, value: normalized };
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=feedback-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback-types.js","sourceRoot":"","sources":["../../../src/runtime-v2/feedback/feedback-types.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,iFAAiF;AACjF,4GAA4G;AAC5G,sDAAsD;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AA+HhD,gFAAgF;AAEhF,MAAM,cAAc,GAA4B;IAC9C,KAAK;IACL,WAAW;IACX,iBAAiB;IACjB,iBAAiB;IACjB,OAAO;CACR,CAAC;AAEF,MAAM,eAAe,GAA4B,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC3E,MAAM,gBAAgB,GAA8B,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAEhF,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,cAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC5F,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,eAAqC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,gBAAsC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,OAAO,K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