create-principles-disciple 1.146.3 → 1.146.6
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/_release/product-identity.json +1 -1
- package/console/dist/web/assets/app.js +26 -26
- package/console/package.json +1 -1
- package/package.json +3 -3
- package/pd-cli/package.json +1 -1
- package/release-manager/package.json +3 -3
- package/console/dist/ui/App.d.ts +0 -1
- package/console/dist/ui/App.js +0 -172
- package/console/dist/ui/api.d.ts +0 -611
- package/console/dist/ui/api.js +0 -1094
- package/console/dist/ui/components/auth/login-form.d.ts +0 -4
- package/console/dist/ui/components/auth/login-form.js +0 -142
- package/console/dist/ui/components/auth/splash-screen.d.ts +0 -9
- package/console/dist/ui/components/auth/splash-screen.js +0 -22
- package/console/dist/ui/components/error-boundary.d.ts +0 -15
- package/console/dist/ui/components/error-boundary.js +0 -30
- package/console/dist/ui/components/focus/daily-thought-card.d.ts +0 -1
- package/console/dist/ui/components/focus/daily-thought-card.js +0 -41
- package/console/dist/ui/components/language-switcher.d.ts +0 -2
- package/console/dist/ui/components/language-switcher.js +0 -17
- package/console/dist/ui/components/layout/app-sidebar.d.ts +0 -27
- package/console/dist/ui/components/layout/app-sidebar.js +0 -128
- package/console/dist/ui/components/layout/page-loading.d.ts +0 -13
- package/console/dist/ui/components/layout/page-loading.js +0 -14
- package/console/dist/ui/components/layout/page-shell.d.ts +0 -12
- package/console/dist/ui/components/layout/page-shell.js +0 -11
- package/console/dist/ui/components/layout/section-title.d.ts +0 -10
- package/console/dist/ui/components/layout/section-title.js +0 -9
- package/console/dist/ui/components/notifications/NotificationProvider.d.ts +0 -14
- package/console/dist/ui/components/notifications/NotificationProvider.js +0 -136
- package/console/dist/ui/components/notifications/favicon-badge.d.ts +0 -3
- package/console/dist/ui/components/notifications/favicon-badge.js +0 -68
- package/console/dist/ui/components/notifications/notification-reducer.d.ts +0 -9
- package/console/dist/ui/components/notifications/notification-reducer.js +0 -9
- package/console/dist/ui/components/notifications/sound-storage.d.ts +0 -3
- package/console/dist/ui/components/notifications/sound-storage.js +0 -37
- package/console/dist/ui/components/notifications/useNotifications.d.ts +0 -1
- package/console/dist/ui/components/notifications/useNotifications.js +0 -9
- package/console/dist/ui/components/onboarding/CircuitDiagram.d.ts +0 -8
- package/console/dist/ui/components/onboarding/CircuitDiagram.js +0 -18
- package/console/dist/ui/components/onboarding/DemoResultView.d.ts +0 -22
- package/console/dist/ui/components/onboarding/DemoResultView.js +0 -33
- package/console/dist/ui/components/onboarding/SlashCommandsCard.d.ts +0 -16
- package/console/dist/ui/components/onboarding/SlashCommandsCard.js +0 -20
- package/console/dist/ui/components/onboarding/slashCommands.d.ts +0 -20
- package/console/dist/ui/components/onboarding/slashCommands.js +0 -22
- package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.d.ts +0 -6
- package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.js +0 -66
- package/console/dist/ui/components/theme-provider.d.ts +0 -14
- package/console/dist/ui/components/theme-provider.js +0 -40
- package/console/dist/ui/components/theme-toggle.d.ts +0 -2
- package/console/dist/ui/components/theme-toggle.js +0 -11
- package/console/dist/ui/components/ui/alert-dialog.d.ts +0 -20
- package/console/dist/ui/components/ui/alert-dialog.js +0 -26
- package/console/dist/ui/components/ui/badge.d.ts +0 -9
- package/console/dist/ui/components/ui/badge.js +0 -22
- package/console/dist/ui/components/ui/button.d.ts +0 -11
- package/console/dist/ui/components/ui/button.js +0 -34
- package/console/dist/ui/components/ui/card.d.ts +0 -8
- package/console/dist/ui/components/ui/card.js +0 -16
- package/console/dist/ui/components/ui/charts.d.ts +0 -51
- package/console/dist/ui/components/ui/charts.js +0 -72
- package/console/dist/ui/components/ui/dialog.d.ts +0 -19
- package/console/dist/ui/components/ui/dialog.js +0 -22
- package/console/dist/ui/components/ui/input.d.ts +0 -3
- package/console/dist/ui/components/ui/input.js +0 -8
- package/console/dist/ui/components/ui/markdown.d.ts +0 -24
- package/console/dist/ui/components/ui/markdown.js +0 -119
- package/console/dist/ui/components/ui/progress-bar.d.ts +0 -20
- package/console/dist/ui/components/ui/progress-bar.js +0 -38
- package/console/dist/ui/components/ui/select.d.ts +0 -13
- package/console/dist/ui/components/ui/select.js +0 -26
- package/console/dist/ui/components/ui/separator.d.ts +0 -3
- package/console/dist/ui/components/ui/separator.js +0 -6
- package/console/dist/ui/components/ui/sheet.d.ts +0 -25
- package/console/dist/ui/components/ui/sheet.js +0 -37
- package/console/dist/ui/components/ui/shiny-text.d.ts +0 -28
- package/console/dist/ui/components/ui/shiny-text.js +0 -46
- package/console/dist/ui/components/ui/skeleton.d.ts +0 -3
- package/console/dist/ui/components/ui/skeleton.js +0 -6
- package/console/dist/ui/components/ui/sonner.d.ts +0 -3
- package/console/dist/ui/components/ui/sonner.js +0 -13
- package/console/dist/ui/components/ui/tooltip.d.ts +0 -7
- package/console/dist/ui/components/ui/tooltip.js +0 -10
- package/console/dist/ui/data/daily-thoughts.d.ts +0 -15
- package/console/dist/ui/data/daily-thoughts.js +0 -164
- package/console/dist/ui/hooks/useNotificationSound.d.ts +0 -12
- package/console/dist/ui/hooks/useNotificationSound.js +0 -74
- package/console/dist/ui/i18n/en.json +0 -2399
- package/console/dist/ui/i18n/index.d.ts +0 -2
- package/console/dist/ui/i18n/index.js +0 -32
- package/console/dist/ui/i18n/zh-CN.json +0 -2399
- package/console/dist/ui/main.d.ts +0 -1
- package/console/dist/ui/main.js +0 -9
- package/console/dist/ui/pages/ReportProblemValidators.d.ts +0 -144
- package/console/dist/ui/pages/ReportProblemValidators.js +0 -418
- package/console/dist/ui/pages/activation/ActivationPage.d.ts +0 -1
- package/console/dist/ui/pages/activation/ActivationPage.js +0 -512
- package/console/dist/ui/pages/activation/ActivationValidators.d.ts +0 -20
- package/console/dist/ui/pages/activation/ActivationValidators.js +0 -160
- package/console/dist/ui/pages/control-center/AgentCard.d.ts +0 -31
- package/console/dist/ui/pages/control-center/AgentCard.js +0 -212
- package/console/dist/ui/pages/control-center/AgentGroup.d.ts +0 -26
- package/console/dist/ui/pages/control-center/AgentGroup.js +0 -38
- package/console/dist/ui/pages/control-center/ControlCenterPage.d.ts +0 -1
- package/console/dist/ui/pages/control-center/ControlCenterPage.js +0 -509
- package/console/dist/ui/pages/control-center/DesignGatePanel.d.ts +0 -1
- package/console/dist/ui/pages/control-center/DesignGatePanel.js +0 -137
- package/console/dist/ui/pages/control-center/RuntimeProfileManager.d.ts +0 -31
- package/console/dist/ui/pages/control-center/RuntimeProfileManager.js +0 -199
- package/console/dist/ui/pages/control-center/WorkflowDiagram.d.ts +0 -17
- package/console/dist/ui/pages/control-center/WorkflowDiagram.js +0 -55
- package/console/dist/ui/pages/debt/DebtPage.d.ts +0 -2
- package/console/dist/ui/pages/debt/DebtPage.js +0 -222
- package/console/dist/ui/pages/design-system/DesignSystemPage.d.ts +0 -2
- package/console/dist/ui/pages/design-system/DesignSystemPage.js +0 -30
- package/console/dist/ui/pages/examiner/ExaminerPage.d.ts +0 -15
- package/console/dist/ui/pages/examiner/ExaminerPage.js +0 -158
- package/console/dist/ui/pages/failed-tasks/FailedTasksPage.d.ts +0 -1
- package/console/dist/ui/pages/failed-tasks/FailedTasksPage.js +0 -421
- package/console/dist/ui/pages/focus/ApprovalSubjectReading.d.ts +0 -24
- package/console/dist/ui/pages/focus/ApprovalSubjectReading.js +0 -133
- package/console/dist/ui/pages/focus/FocusPage.d.ts +0 -123
- package/console/dist/ui/pages/focus/FocusPage.js +0 -567
- package/console/dist/ui/pages/focus/OwnerDecisionCard.d.ts +0 -9
- package/console/dist/ui/pages/focus/OwnerDecisionCard.js +0 -111
- package/console/dist/ui/pages/focus/OwnerWorkbench.d.ts +0 -19
- package/console/dist/ui/pages/focus/OwnerWorkbench.js +0 -75
- package/console/dist/ui/pages/focus/RuleCandidateBindingPanel.d.ts +0 -34
- package/console/dist/ui/pages/focus/RuleCandidateBindingPanel.js +0 -298
- package/console/dist/ui/pages/focus/focus-validation.d.ts +0 -40
- package/console/dist/ui/pages/focus/focus-validation.js +0 -211
- package/console/dist/ui/pages/intent/IntentOnboarding.d.ts +0 -67
- package/console/dist/ui/pages/intent/IntentOnboarding.js +0 -289
- package/console/dist/ui/pages/intent/IntentPage.d.ts +0 -1
- package/console/dist/ui/pages/intent/IntentPage.js +0 -252
- package/console/dist/ui/pages/pain/PainEvidenceValidators.d.ts +0 -59
- package/console/dist/ui/pages/pain/PainEvidenceValidators.js +0 -125
- package/console/dist/ui/pages/pain/PainPage.d.ts +0 -1
- package/console/dist/ui/pages/pain/PainPage.js +0 -420
- package/console/dist/ui/pages/pain/pain-card-helpers.d.ts +0 -175
- package/console/dist/ui/pages/pain/pain-card-helpers.js +0 -181
- package/console/dist/ui/pages/principles/CorePrinciplesPage.d.ts +0 -10
- package/console/dist/ui/pages/principles/CorePrinciplesPage.js +0 -59
- package/console/dist/ui/pages/principles/PrincipleDetailPage.d.ts +0 -60
- package/console/dist/ui/pages/principles/PrincipleDetailPage.js +0 -602
- package/console/dist/ui/pages/principles/PrinciplesPage.d.ts +0 -1
- package/console/dist/ui/pages/principles/PrinciplesPage.js +0 -327
- package/console/dist/ui/pages/principles/PrinciplesViewNav.d.ts +0 -8
- package/console/dist/ui/pages/principles/PrinciplesViewNav.js +0 -15
- package/console/dist/ui/pages/report-problem/ReportProblemPage.d.ts +0 -1
- package/console/dist/ui/pages/report-problem/ReportProblemPage.js +0 -467
- package/console/dist/ui/pages/settings/SettingsPage.d.ts +0 -4
- package/console/dist/ui/pages/settings/SettingsPage.js +0 -457
- package/console/dist/ui/pages/settings/UpdatePage.d.ts +0 -1
- package/console/dist/ui/pages/settings/UpdatePage.js +0 -215
- package/console/dist/ui/pages/welcome/WelcomePage.d.ts +0 -5
- package/console/dist/ui/pages/welcome/WelcomePage.js +0 -187
- package/console/dist/ui/utils/agent-metadata.d.ts +0 -71
- package/console/dist/ui/utils/agent-metadata.js +0 -284
- package/console/dist/ui/utils/approval-review.d.ts +0 -30
- package/console/dist/ui/utils/approval-review.js +0 -50
- package/console/dist/ui/utils/approval-warning-localization.d.ts +0 -34
- package/console/dist/ui/utils/approval-warning-localization.js +0 -148
- package/console/dist/ui/utils/attention-presentation.d.ts +0 -35
- package/console/dist/ui/utils/attention-presentation.js +0 -46
- package/console/dist/ui/utils/blocker-localization.d.ts +0 -23
- package/console/dist/ui/utils/blocker-localization.js +0 -36
- package/console/dist/ui/utils/control-center-helpers.d.ts +0 -79
- package/console/dist/ui/utils/control-center-helpers.js +0 -189
- package/console/dist/ui/utils/enum-labels.d.ts +0 -50
- package/console/dist/ui/utils/enum-labels.js +0 -171
- package/console/dist/ui/utils/format-date.d.ts +0 -11
- package/console/dist/ui/utils/format-date.js +0 -17
- package/console/dist/ui/utils/onboarding-state.d.ts +0 -25
- package/console/dist/ui/utils/onboarding-state.js +0 -77
- package/console/dist/ui/utils/reading-layout.d.ts +0 -20
- package/console/dist/ui/utils/reading-layout.js +0 -46
- package/console/dist/ui/utils/rule-binding-validators.d.ts +0 -13
- package/console/dist/ui/utils/rule-binding-validators.js +0 -188
- package/console/dist/ui/utils/runtime-mode.d.ts +0 -11
- package/console/dist/ui/utils/runtime-mode.js +0 -11
- package/console/dist/ui/utils/token-storage.d.ts +0 -22
- package/console/dist/ui/utils/token-storage.js +0 -47
- package/console/dist/ui/utils/validators.d.ts +0 -1178
- package/console/dist/ui/utils/validators.js +0 -3297
- package/release-manager/dist/bootstrap-entry.d.ts +0 -2
- package/release-manager/dist/bootstrap-entry.d.ts.map +0 -1
- package/release-manager/dist/bootstrap-entry.js.map +0 -1
- package/release-manager/dist/i18n.d.ts +0 -6
- package/release-manager/dist/i18n.d.ts.map +0 -1
- package/release-manager/dist/i18n.js.map +0 -1
- package/release-manager/dist/index.d.ts +0 -7
- package/release-manager/dist/index.d.ts.map +0 -1
- package/release-manager/dist/index.js +0 -656
- package/release-manager/dist/index.js.map +0 -1
- package/release-manager/dist/installer.d.ts +0 -629
- package/release-manager/dist/installer.d.ts.map +0 -1
- package/release-manager/dist/installer.js.map +0 -1
- package/release-manager/dist/installers/codex-host-installer.d.ts +0 -39
- package/release-manager/dist/installers/codex-host-installer.d.ts.map +0 -1
- package/release-manager/dist/installers/codex-host-installer.js.map +0 -1
- package/release-manager/dist/installers/index.d.ts +0 -51
- package/release-manager/dist/installers/index.d.ts.map +0 -1
- package/release-manager/dist/installers/index.js.map +0 -1
- package/release-manager/dist/installers/openclaw-host-installer.d.ts +0 -14
- package/release-manager/dist/installers/openclaw-host-installer.d.ts.map +0 -1
- package/release-manager/dist/installers/openclaw-host-installer.js.map +0 -1
- package/release-manager/dist/installers/workbuddy-host-installer.d.ts +0 -335
- package/release-manager/dist/installers/workbuddy-host-installer.d.ts.map +0 -1
- package/release-manager/dist/installers/workbuddy-host-installer.js.map +0 -1
- package/release-manager/dist/mvp-config.d.ts +0 -233
- package/release-manager/dist/mvp-config.d.ts.map +0 -1
- package/release-manager/dist/mvp-config.js.map +0 -1
- package/release-manager/dist/prompts.d.ts +0 -43
- package/release-manager/dist/prompts.d.ts.map +0 -1
- package/release-manager/dist/prompts.js +0 -268
- package/release-manager/dist/prompts.js.map +0 -1
- package/release-manager/dist/skill-language.d.ts +0 -32
- package/release-manager/dist/skill-language.d.ts.map +0 -1
- package/release-manager/dist/skill-language.js.map +0 -1
- package/release-manager/dist/uninstaller.d.ts +0 -68
- package/release-manager/dist/uninstaller.d.ts.map +0 -1
- package/release-manager/dist/uninstaller.js +0 -746
- package/release-manager/dist/uninstaller.js.map +0 -1
- package/release-manager/dist/update/apply-payload.d.ts +0 -143
- package/release-manager/dist/update/apply-payload.d.ts.map +0 -1
- package/release-manager/dist/update/apply-payload.js.map +0 -1
- package/release-manager/dist/update/atomic-file.d.ts +0 -35
- package/release-manager/dist/update/atomic-file.d.ts.map +0 -1
- package/release-manager/dist/update/atomic-file.js.map +0 -1
- package/release-manager/dist/update/bootstrap-executor.d.ts +0 -21
- package/release-manager/dist/update/bootstrap-executor.d.ts.map +0 -1
- package/release-manager/dist/update/bootstrap-executor.js.map +0 -1
- package/release-manager/dist/update/bootstrap-protocol.d.ts +0 -56
- package/release-manager/dist/update/bootstrap-protocol.d.ts.map +0 -1
- package/release-manager/dist/update/bootstrap-protocol.js.map +0 -1
- package/release-manager/dist/update/channel-metadata.d.ts +0 -28
- package/release-manager/dist/update/channel-metadata.d.ts.map +0 -1
- package/release-manager/dist/update/channel-metadata.js.map +0 -1
- package/release-manager/dist/update/channel-promotion.d.ts +0 -39
- package/release-manager/dist/update/channel-promotion.d.ts.map +0 -1
- package/release-manager/dist/update/channel-promotion.js +0 -55
- package/release-manager/dist/update/channel-promotion.js.map +0 -1
- package/release-manager/dist/update/console-surface.d.ts +0 -19
- package/release-manager/dist/update/console-surface.d.ts.map +0 -1
- package/release-manager/dist/update/console-surface.js.map +0 -1
- package/release-manager/dist/update/data-compatibility.d.ts +0 -35
- package/release-manager/dist/update/data-compatibility.d.ts.map +0 -1
- package/release-manager/dist/update/data-compatibility.js +0 -45
- package/release-manager/dist/update/data-compatibility.js.map +0 -1
- package/release-manager/dist/update/install-layout.d.ts +0 -105
- package/release-manager/dist/update/install-layout.d.ts.map +0 -1
- package/release-manager/dist/update/install-layout.js.map +0 -1
- package/release-manager/dist/update/product-identity.d.ts +0 -70
- package/release-manager/dist/update/product-identity.d.ts.map +0 -1
- package/release-manager/dist/update/product-identity.js.map +0 -1
- package/release-manager/dist/update/release-asset-manifest.d.ts +0 -31
- package/release-manager/dist/update/release-asset-manifest.d.ts.map +0 -1
- package/release-manager/dist/update/release-asset-manifest.js.map +0 -1
- package/release-manager/dist/update/release-identity.d.ts +0 -33
- package/release-manager/dist/update/release-identity.d.ts.map +0 -1
- package/release-manager/dist/update/release-identity.js.map +0 -1
- package/release-manager/dist/update/release-manager-authority.d.ts +0 -39
- package/release-manager/dist/update/release-manager-authority.d.ts.map +0 -1
- package/release-manager/dist/update/release-manager-authority.js.map +0 -1
- package/release-manager/dist/update/release-manager.d.ts +0 -156
- package/release-manager/dist/update/release-manager.d.ts.map +0 -1
- package/release-manager/dist/update/release-manager.js.map +0 -1
- package/release-manager/dist/update/release-metadata-publisher.d.ts +0 -199
- package/release-manager/dist/update/release-metadata-publisher.d.ts.map +0 -1
- package/release-manager/dist/update/release-metadata-publisher.js +0 -478
- package/release-manager/dist/update/release-metadata-publisher.js.map +0 -1
- package/release-manager/dist/update/release-metadata-source.d.ts +0 -85
- package/release-manager/dist/update/release-metadata-source.d.ts.map +0 -1
- package/release-manager/dist/update/release-metadata-source.js.map +0 -1
- package/release-manager/dist/update/release-metadata.d.ts +0 -60
- package/release-manager/dist/update/release-metadata.d.ts.map +0 -1
- package/release-manager/dist/update/release-metadata.js.map +0 -1
- package/release-manager/dist/update/release-policy.d.ts +0 -51
- package/release-manager/dist/update/release-policy.d.ts.map +0 -1
- package/release-manager/dist/update/release-policy.js.map +0 -1
- package/release-manager/dist/update/rollback-policy.d.ts +0 -56
- package/release-manager/dist/update/rollback-policy.d.ts.map +0 -1
- package/release-manager/dist/update/rollback-policy.js +0 -61
- package/release-manager/dist/update/rollback-policy.js.map +0 -1
- package/release-manager/dist/update/transaction-journal.d.ts +0 -212
- package/release-manager/dist/update/transaction-journal.d.ts.map +0 -1
- package/release-manager/dist/update/transaction-journal.js.map +0 -1
- package/release-manager/dist/update/trust-metadata.d.ts +0 -55
- package/release-manager/dist/update/trust-metadata.d.ts.map +0 -1
- package/release-manager/dist/update/trust-metadata.js.map +0 -1
- package/release-manager/dist/update/trust-root-provisioning.d.ts +0 -99
- package/release-manager/dist/update/trust-root-provisioning.d.ts.map +0 -1
- package/release-manager/dist/update/trust-root-provisioning.js.map +0 -1
- package/release-manager/dist/update/update-history.d.ts +0 -46
- package/release-manager/dist/update/update-history.d.ts.map +0 -1
- package/release-manager/dist/update/update-history.js +0 -123
- package/release-manager/dist/update/update-history.js.map +0 -1
- package/release-manager/dist/utils/config-file-io.d.ts +0 -34
- package/release-manager/dist/utils/config-file-io.d.ts.map +0 -1
- package/release-manager/dist/utils/config-file-io.js.map +0 -1
- package/release-manager/dist/utils/env.d.ts +0 -94
- package/release-manager/dist/utils/env.d.ts.map +0 -1
- package/release-manager/dist/utils/env.js.map +0 -1
- package/release-manager/dist/utils/logger.d.ts +0 -15
- package/release-manager/dist/utils/logger.d.ts.map +0 -1
- package/release-manager/dist/utils/logger.js.map +0 -1
- package/release-manager/dist/utils/workspace-divergence.d.ts +0 -36
- package/release-manager/dist/utils/workspace-divergence.d.ts.map +0 -1
- package/release-manager/dist/utils/workspace-divergence.js.map +0 -1
|
@@ -1,420 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* PainPage — Behavior Evidence page showing real evidence/pain/diagnosis chain states.
|
|
4
|
-
*
|
|
5
|
-
* PRI-331: Replaces the old approach of deriving evidence from principle metrics
|
|
6
|
-
* with a direct read model from pain_events, tasks, candidates, and ledger.
|
|
7
|
-
*
|
|
8
|
-
* Privacy boundary (G.2 / F.3 / F.5):
|
|
9
|
-
* - No raw prompt, chat, trajectory, token, full absolute path, or stack trace
|
|
10
|
-
* - All summaries are already sanitized by the backend EvidenceChainConsoleModel
|
|
11
|
-
* - Degraded paths show reason + nextAction, never silent fallback (ERR-002)
|
|
12
|
-
*/
|
|
13
|
-
import { useState, useEffect, useCallback } from 'react';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import { useNavigate } from 'react-router-dom';
|
|
16
|
-
import { PageShell } from '../../components/layout/page-shell.js';
|
|
17
|
-
import { PageLoading } from '../../components/layout/page-loading.js';
|
|
18
|
-
import { Badge } from '../../components/ui/badge.js';
|
|
19
|
-
import { Card, CardContent, CardHeader, CardTitle } from '../../components/ui/card.js';
|
|
20
|
-
import { Button } from '../../components/ui/button.js';
|
|
21
|
-
import { ShinyText } from '../../components/ui/shiny-text.js';
|
|
22
|
-
import { fetchEvidenceChain, recordIntentDecision, listIntentDecisionsByPainId, listIntentDecisionsByTaskId, dispatchFollowUp } from '../../api.js';
|
|
23
|
-
import { formatDate } from '../../utils/format-date.js';
|
|
24
|
-
import i18n from '../../i18n/index.js';
|
|
25
|
-
import { buildCardLayers, buildDebugIdSummary, isLayer2EffectivelyEmpty, shouldRenderIntentTensionPanel, shouldRenderFollowUpActions, buildIntentDecisionPayload } from './pain-card-helpers.js';
|
|
26
|
-
import { enumLabel } from '../../utils/enum-labels.js';
|
|
27
|
-
// utils/format.js was retired into the defensive single-owner formatter
|
|
28
|
-
// (format-date.ts) — same datetime components, invalid dates now render the
|
|
29
|
-
// raw string instead of Intl throwing.
|
|
30
|
-
const DATETIME_FORMAT_OPTS = {
|
|
31
|
-
year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit',
|
|
32
|
-
};
|
|
33
|
-
function formatDateTime(iso) {
|
|
34
|
-
return formatDate(iso, i18n.language, DATETIME_FORMAT_OPTS);
|
|
35
|
-
}
|
|
36
|
-
function groupForState(state) {
|
|
37
|
-
switch (state) {
|
|
38
|
-
case 'evidence-only':
|
|
39
|
-
return 'evidence_only';
|
|
40
|
-
case 'recorded-only':
|
|
41
|
-
case 'diagnosis-queued':
|
|
42
|
-
case 'diagnosis-running':
|
|
43
|
-
case 'diagnosis-succeeded':
|
|
44
|
-
case 'candidate-generated':
|
|
45
|
-
case 'internalization-missing':
|
|
46
|
-
case 'internalization-pending':
|
|
47
|
-
case 'internalization-running':
|
|
48
|
-
case 'internalization-succeeded':
|
|
49
|
-
case 'owner-reviewable':
|
|
50
|
-
return 'active_chain';
|
|
51
|
-
case 'diagnosis-failed':
|
|
52
|
-
case 'diagnosis-retry-wait':
|
|
53
|
-
case 'internalization-failed':
|
|
54
|
-
return 'failed';
|
|
55
|
-
case 'malformed':
|
|
56
|
-
case 'degraded':
|
|
57
|
-
default:
|
|
58
|
-
return 'evidence_only';
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
const GROUP_ORDER = ['active_chain', 'failed', 'evidence_only'];
|
|
62
|
-
export function PainPage() {
|
|
63
|
-
const { t } = useTranslation();
|
|
64
|
-
const [state, setState] = useState({ status: 'loading' });
|
|
65
|
-
const [expandedIds, setExpandedIds] = useState(new Set());
|
|
66
|
-
const loadData = useCallback(async () => {
|
|
67
|
-
setState({ status: 'loading' });
|
|
68
|
-
const result = await fetchEvidenceChain();
|
|
69
|
-
if (!result.success) {
|
|
70
|
-
setState({ status: 'error', message: result.error ?? 'Unknown error' });
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (result.data) {
|
|
74
|
-
setState({ status: 'loaded', data: result.data });
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
// Validation returned null — degraded state
|
|
78
|
-
setState({
|
|
79
|
-
status: 'error',
|
|
80
|
-
message: t('pages.pain.validationError'),
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}, [t]);
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
loadData();
|
|
86
|
-
}, [loadData]);
|
|
87
|
-
const toggleExpanded = (id) => {
|
|
88
|
-
setExpandedIds((prev) => {
|
|
89
|
-
const next = new Set(prev);
|
|
90
|
-
if (next.has(id)) {
|
|
91
|
-
next.delete(id);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
next.add(id);
|
|
95
|
-
}
|
|
96
|
-
return next;
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
return (_jsxs(PageShell, { children: [_jsxs("div", { className: "mb-8", children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.14em] text-ink-3", children: t('pages.pain.eyebrow') }), _jsx(ShinyText, { as: "h1", className: "text-[29px] font-semibold tracking-tight text-ink mt-3 mb-2", duration: 4.5, brightness: 0.5, disabled: state.status !== 'loaded' || state.data.records.length === 0, children: t('pages.pain.title') }), _jsx("p", { className: "text-ink-3 text-sm leading-relaxed max-w-[712px]", children: t('pages.pain.description') })] }), _jsx("div", { className: "mb-6 p-3 bg-panel border border-line rounded-[var(--radius-md)] text-ink-3 text-[13px] leading-relaxed", children: t('pages.pain.honestyNote') }), state.status === 'loading' && (_jsx(PageLoading, { cardCount: 4, label: t('common.loading') })), state.status === 'error' && (_jsxs("div", { className: "py-8", children: [_jsxs("div", { className: "text-danger text-sm mb-2", children: [t('pages.pain.loadError'), ": ", state.message] }), _jsx(Button, { variant: "outline", size: "sm", onClick: loadData, children: t('common.refresh') })] })), state.status === 'loaded' && (_jsx("div", { className: "animate-[pdFadeIn_400ms_ease-out]", children: _jsx(LoadedContent, { data: state.data, expandedIds: expandedIds, onToggle: toggleExpanded, onRefresh: loadData, t: t }) }))] }));
|
|
100
|
-
}
|
|
101
|
-
function LoadedContent({ data, expandedIds, onToggle, onRefresh, t }) {
|
|
102
|
-
const [reviewQueueExpanded, setReviewQueueExpanded] = useState(false);
|
|
103
|
-
// Show degraded banner if data sources are partially unavailable
|
|
104
|
-
const hasDegraded = !!data.degradedReason;
|
|
105
|
-
// Group records by state category
|
|
106
|
-
const grouped = new Map();
|
|
107
|
-
for (const record of data.records) {
|
|
108
|
-
const group = groupForState(record.state);
|
|
109
|
-
const existing = grouped.get(group) ?? [];
|
|
110
|
-
existing.push(record);
|
|
111
|
-
grouped.set(group, existing);
|
|
112
|
-
}
|
|
113
|
-
const hasRecords = data.records.length > 0;
|
|
114
|
-
return (_jsxs(_Fragment, { children: [hasDegraded && (_jsxs("div", { className: "mb-4 p-3 bg-panel border border-amber/20 rounded-[var(--radius-md)] text-amber text-[13px]", children: [_jsx("div", { className: "mb-1", children: data.degradedReason }), data.nextAction && (_jsx("div", { className: "text-ink-3 text-[12px]", children: data.nextAction }))] })), !hasRecords && data.note && (_jsx("div", { className: "mb-4 p-3 bg-panel border border-line rounded-[var(--radius-md)] text-ink-3 text-[13px]", children: data.note })), !hasRecords && !hasDegraded && _jsx(EmptyState, { t: t }), hasRecords && (_jsx("div", { className: "space-y-8", children: GROUP_ORDER.map((group) => {
|
|
115
|
-
const records = grouped.get(group);
|
|
116
|
-
if (!records || records.length === 0)
|
|
117
|
-
return null;
|
|
118
|
-
// For active_chain group, fold owner-reviewable records into a count
|
|
119
|
-
// row when there are 2+ — they are already in the governance queue
|
|
120
|
-
// and repeating each as a full card here is noise. Single record
|
|
121
|
-
// stays expanded. Click the fold row to expand in-place.
|
|
122
|
-
if (group === 'active_chain') {
|
|
123
|
-
const inReview = records.filter((r) => r.state === 'owner-reviewable');
|
|
124
|
-
const others = records.filter((r) => r.state !== 'owner-reviewable');
|
|
125
|
-
const foldReviewQueue = inReview.length >= 2;
|
|
126
|
-
const reviewQueueLabel = t('pages.pain.inReviewQueueCount').replace('{{count}}', String(inReview.length));
|
|
127
|
-
return (_jsxs("div", { children: [_jsxs("div", { className: "font-mono text-[11px] uppercase tracking-[0.12em] text-ink-4 mb-3", children: [t(`pages.pain.group_${group}`), " (", records.length, ")"] }), _jsxs("div", { className: "space-y-4", children: [others.map((record) => (_jsx(EvidenceChainCard, { record: record, expanded: expandedIds.has(record.id), onToggle: () => onToggle(record.id), t: t }, record.id))), foldReviewQueue && !reviewQueueExpanded && (_jsxs("button", { type: "button", onClick: () => setReviewQueueExpanded(true), className: "w-full text-left p-3 bg-panel border border-line rounded-[var(--radius-md)] text-ink-3 text-sm hover:bg-paper-2 transition-colors", children: [reviewQueueLabel, " \u00B7 ", t('pages.pain.goToGovernance')] })), (!foldReviewQueue || reviewQueueExpanded) && inReview.map((record) => (_jsx(EvidenceChainCard, { record: record, expanded: expandedIds.has(record.id), onToggle: () => onToggle(record.id), t: t }, record.id))), foldReviewQueue && reviewQueueExpanded && (_jsxs("button", { type: "button", onClick: () => setReviewQueueExpanded(false), className: "font-mono text-[11px] text-ink-4 hover:text-ink-3 transition-colors", children: [reviewQueueLabel, " \u25B2"] }))] })] }, group));
|
|
128
|
-
}
|
|
129
|
-
return (_jsxs("div", { children: [_jsxs("div", { className: "font-mono text-[11px] uppercase tracking-[0.12em] text-ink-4 mb-3", children: [t(`pages.pain.group_${group}`), " (", records.length, ")"] }), _jsx("div", { className: "space-y-4", children: records.map((record) => (_jsx(EvidenceChainCard, { record: record, expanded: expandedIds.has(record.id), onToggle: () => onToggle(record.id), t: t }, record.id))) })] }, group));
|
|
130
|
-
}) })), _jsxs("div", { className: "mt-8 font-mono text-[11px] text-ink-4", children: [t('pages.pain.generatedAt'), ": ", formatDateTime(data.generatedAt)] })] }));
|
|
131
|
-
}
|
|
132
|
-
// ── Empty state (E section: guide next step, not "暂无数据") ──────────────────
|
|
133
|
-
function EmptyState({ t }) {
|
|
134
|
-
return (_jsx("div", { className: "py-8", children: _jsxs("div", { className: "p-5 bg-panel border border-line rounded-[var(--radius-md)]", children: [_jsx("h3", { className: "text-[17px] font-semibold text-ink mb-2", children: t('pages.pain.emptyTitle') }), _jsx("p", { className: "text-ink-3 text-sm leading-relaxed", children: t('pages.pain.emptyDescription') })] }) }));
|
|
135
|
-
}
|
|
136
|
-
function EvidenceChainCard({ record, expanded, onToggle, t }) {
|
|
137
|
-
const [copied, setCopied] = useState(false);
|
|
138
|
-
const navigate = useNavigate();
|
|
139
|
-
const layer2Empty = isLayer2EffectivelyEmpty(record);
|
|
140
|
-
const stateVariant = stateToVariant(record.state);
|
|
141
|
-
const stateLabel = enumLabel('evidenceState', record.state, t);
|
|
142
|
-
const sourceLabel = enumLabel('sourceKind', record.sourceKind, t);
|
|
143
|
-
const layers = buildCardLayers(record);
|
|
144
|
-
// Confidence label — resolve via enumLabel for consistent i18n
|
|
145
|
-
const confidenceDisplay = layers.layer2.confidence
|
|
146
|
-
? `${enumLabel('confidence', layers.layer2.confidence.label, t)} (${layers.layer2.confidence.raw.toFixed(2)})`
|
|
147
|
-
: null;
|
|
148
|
-
return (_jsxs(Card, { className: "overflow-hidden", children: [_jsx(CardHeader, { children: _jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [_jsx(Badge, { variant: stateVariant, children: stateLabel }), _jsx(Badge, { variant: "outline", children: sourceLabel }), record.hostKind && record.hostKind !== 'unknown' && (_jsx(Badge, { variant: "secondary", children: t(`pages.pain.hostKind.${record.hostKind}`) })), record.admissionDecision && (_jsx(Badge, { variant: "secondary", children: enumLabel('admission', record.admissionDecision, t) }))] }), _jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [_jsx(Button, { variant: "ghost", size: "sm", "data-testid": `pain-feedback-${record.id}`, onClick: () => {
|
|
149
|
-
const params = new URLSearchParams({ source: "pain_page", painId: record.id });
|
|
150
|
-
navigate(`/report-problem?${params.toString()}`);
|
|
151
|
-
}, children: t('pages.reportProblem.entryFeedback') }), _jsx("span", { className: "font-mono text-[11px] text-ink-4 whitespace-nowrap", children: formatDateTime(record.observedAt) })] })] }) }), _jsxs(CardContent, { children: [_jsxs("div", { className: "space-y-3 mb-4", children: [_jsxs("div", { children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.fieldTrigger') }), layer2Empty ? (_jsx("p", { className: "text-ink-3 text-sm italic leading-relaxed", children: t('pages.pain.noHumanSummary') })) : (_jsx(CardTitle, { className: "text-[15px] leading-relaxed", children: layers.layer2.triggerSummary }))] }), layers.layer2.conclusion && (_jsxs("div", { children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.fieldConclusion') }), _jsx("p", { className: "text-ink text-sm leading-relaxed font-medium", children: layers.layer2.conclusion })] })), layers.layer2.applicability && (_jsxs("div", { children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.fieldApplicability') }), _jsx("p", { className: "text-ink-2 text-sm leading-relaxed", children: layers.layer2.applicability })] })), confidenceDisplay && (_jsxs("div", { children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.fieldConfidence') }), _jsx("p", { className: "text-ink-2 text-sm", children: confidenceDisplay })] })), layers.layer2.failureReason && (_jsxs("div", { children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.fieldFailureReason') }), _jsx("p", { className: "text-danger text-sm leading-relaxed", children: layers.layer2.failureReason })] })), layers.layer2.degradedReason && (_jsxs("div", { children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.fieldDegradedReason') }), _jsx("p", { className: "text-amber text-sm leading-relaxed", children: layers.layer2.degradedReason })] })), layers.layer2.nextAction && (_jsxs("div", { children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.fieldNextAction') }), _jsx("p", { className: "text-ink-2 text-sm leading-relaxed", children: layers.layer2.nextAction })] }))] }), shouldRenderIntentTensionPanel(layers.layer2.intentTension) && (_jsx(IntentTensionPanel, { tension: layers.layer2.intentTension, recordId: record.id, painId: record.id, taskId: record.linkedTaskId ?? undefined, linkedCandidateId: record.linkedCandidateId ?? undefined, t: t })), _jsxs("div", { className: "mt-4 pt-3 border-t border-line", children: [_jsxs("div", { className: "flex items-center gap-3 flex-wrap", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: async () => {
|
|
152
|
-
try {
|
|
153
|
-
await navigator.clipboard.writeText(buildDebugIdSummary(record));
|
|
154
|
-
setCopied(true);
|
|
155
|
-
setTimeout(() => setCopied(false), 2000);
|
|
156
|
-
}
|
|
157
|
-
catch (error) {
|
|
158
|
-
// clipboard unavailable — expand details as fallback
|
|
159
|
-
console.warn("Debug ID copy failed; falling back to expanded details.", error);
|
|
160
|
-
if (!expanded)
|
|
161
|
-
onToggle();
|
|
162
|
-
}
|
|
163
|
-
}, className: "font-mono text-[11px] h-7", children: copied ? t('pages.pain.copied') : t('pages.pain.copyDebugId') }), _jsx("button", { type: "button", onClick: onToggle, className: "font-mono text-[11px] text-ink-4 hover:text-ink-3 transition-colors underline-offset-2 hover:underline", children: t('pages.pain.expandTechDetails') })] }), expanded && (_jsx("div", { className: "mt-3 p-3 bg-paper-2 border border-line rounded-[var(--radius-sm)]", children: _jsxs("div", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-[13px]", children: [_jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainId') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.id }), layers.layer3.linkedTaskId && (_jsxs(_Fragment, { children: [_jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainTaskId') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.linkedTaskId })] })), layers.layer3.linkedTaskStatus && (_jsxs(_Fragment, { children: [_jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainTaskStatus') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.linkedTaskStatus })] })), layers.layer3.linkedCandidateId && (_jsxs(_Fragment, { children: [_jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainCandidateId') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.linkedCandidateId })] })), layers.layer3.linkedPrincipleId && (_jsxs(_Fragment, { children: [_jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainPrincipleId') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.linkedPrincipleId })] })), layers.layer3.internalizationTaskId && (_jsxs(_Fragment, { children: [_jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainInternalizationTask') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.internalizationTaskId })] })), layers.layer3.dreamerTaskStatus && (_jsxs(_Fragment, { children: [_jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainDreamerStatus') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.dreamerTaskStatus })] })), _jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainSourceKind') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.sourceKind }), _jsx("span", { className: "font-mono text-ink-4", children: t('pages.pain.chainState') }), _jsx("span", { className: "font-mono text-ink-2", children: layers.layer3.state })] }) }))] })] })] }));
|
|
164
|
-
}
|
|
165
|
-
// ── Helpers ────────────────────────────────────────────────────────────────────
|
|
166
|
-
function stateToVariant(state) {
|
|
167
|
-
switch (state) {
|
|
168
|
-
case 'evidence-only':
|
|
169
|
-
return 'secondary';
|
|
170
|
-
case 'recorded-only':
|
|
171
|
-
case 'diagnosis-queued':
|
|
172
|
-
case 'diagnosis-running':
|
|
173
|
-
case 'internalization-pending':
|
|
174
|
-
case 'internalization-running':
|
|
175
|
-
return 'amber';
|
|
176
|
-
case 'diagnosis-succeeded':
|
|
177
|
-
case 'candidate-generated':
|
|
178
|
-
case 'internalization-succeeded':
|
|
179
|
-
case 'owner-reviewable':
|
|
180
|
-
return 'green';
|
|
181
|
-
case 'diagnosis-failed':
|
|
182
|
-
case 'internalization-failed':
|
|
183
|
-
return 'destructive';
|
|
184
|
-
case 'diagnosis-retry-wait':
|
|
185
|
-
return 'amber';
|
|
186
|
-
case 'malformed':
|
|
187
|
-
case 'degraded':
|
|
188
|
-
default:
|
|
189
|
-
return 'secondary';
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
// ── PRI-469: Intent Tension panel (SPEC §22.1) ───────────────────────────────
|
|
193
|
-
/**
|
|
194
|
-
* Convert a snake_case enum value to a PascalCase suffix for i18n keys.
|
|
195
|
-
* E.g. 'action_drift' → 'ActionDrift', 'none' → 'None'.
|
|
196
|
-
*/
|
|
197
|
-
function snakeToPascal(value) {
|
|
198
|
-
return value
|
|
199
|
-
.split('_')
|
|
200
|
-
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
201
|
-
.join('');
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Resolve an intentTension enum value to its localized label.
|
|
205
|
-
* kind determines the i18n key prefix:
|
|
206
|
-
* - 'source' → pages.pain.intentTensionSource{Pascal}
|
|
207
|
-
* - 'evidenceStrength' → pages.pain.intentTensionEvidenceStrength{Pascal}
|
|
208
|
-
* - 'suggestedAction' → pages.pain.intentTensionSuggestedAction{Pascal}
|
|
209
|
-
*/
|
|
210
|
-
function intentTensionEnumLabel(value, kind, t) {
|
|
211
|
-
const keyPrefix = kind === 'source'
|
|
212
|
-
? 'intentTensionSource'
|
|
213
|
-
: kind === 'evidenceStrength'
|
|
214
|
-
? 'intentTensionEvidenceStrength'
|
|
215
|
-
: 'intentTensionSuggestedAction';
|
|
216
|
-
return t(`pages.pain.${keyPrefix}${snakeToPascal(value)}`);
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* IntentTensionPanel — renders the intent tension decision panel (SPEC §22.1.2).
|
|
220
|
-
*
|
|
221
|
-
* This panel is rendered only when shouldRenderIntentTensionPanel returns true
|
|
222
|
-
* (i.e., tension is non-null AND source !== 'none' per SPEC §22.1.3).
|
|
223
|
-
*
|
|
224
|
-
* Follow-up actions (SPEC §22.1.4) appear only after a decision is persisted
|
|
225
|
-
* (PRI-471). The FollowUpActions component is rendered inside OwnerDecisionPanel
|
|
226
|
-
* when shouldRenderFollowUpActions returns true.
|
|
227
|
-
*
|
|
228
|
-
* Accessibility (EP-09):
|
|
229
|
-
* - Uses semantic <section> with aria-label
|
|
230
|
-
* - Uses <dl>/<dt>/<dd> for label-value pairs
|
|
231
|
-
* - Color is not the only indicator (text labels always present)
|
|
232
|
-
*/
|
|
233
|
-
function IntentTensionPanel({ tension, recordId, painId, taskId, linkedCandidateId, t }) {
|
|
234
|
-
const sourceLabel = intentTensionEnumLabel(tension.source, 'source', t);
|
|
235
|
-
const strengthLabel = intentTensionEnumLabel(tension.evidenceStrength, 'evidenceStrength', t);
|
|
236
|
-
const actionLabel = intentTensionEnumLabel(tension.suggestedOwnerAction, 'suggestedAction', t);
|
|
237
|
-
return (_jsxs("section", { className: "mt-4 p-4 border border-line rounded-[var(--radius-sm)] bg-paper-2", "aria-label": t('pages.pain.intentTensionTitle'), children: [_jsxs("h4", { className: "text-[13px] font-semibold text-ink mb-3 flex items-center gap-2", children: [_jsx("span", { "aria-hidden": "true", className: "inline-block w-1.5 h-1.5 rounded-full bg-amber" }), t('pages.pain.intentTensionTitle')] }), _jsxs("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-[13px]", children: [_jsx("dt", { className: "font-mono text-ink-4", children: t('pages.pain.intentTensionSourceLabel') }), _jsx("dd", { className: "text-ink-2", children: sourceLabel }), _jsx("dt", { className: "font-mono text-ink-4", children: t('pages.pain.intentTensionEvidenceStrengthLabel') }), _jsx("dd", { className: "text-ink-2", children: strengthLabel }), _jsx("dt", { className: "font-mono text-ink-4", children: t('pages.pain.intentTensionSuggestedActionLabel') }), _jsx("dd", { className: "text-ink-2 font-medium", children: actionLabel })] }), tension.relatedIntentFields.length > 0 && (_jsxs("div", { className: "mt-3", children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.intentTensionRelatedIntentFieldsLabel') }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: tension.relatedIntentFields.map((field, idx) => (_jsx(Badge, { variant: "outline", children: field }, `${field}-${idx}`))) })] })), tension.evidence.length > 0 && (_jsxs("div", { className: "mt-3", children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.intentTensionEvidenceLabel') }), _jsx("ul", { className: "text-ink-2 text-sm leading-relaxed space-y-1", children: tension.evidence.map((item, idx) => (_jsx("li", { className: "pl-3 relative before:content-[''] before:absolute before:left-0 before:top-2 before:w-1 before:h-1 before:rounded-full before:bg-ink-4", children: item }, `${idx}-${item.slice(0, 12)}`))) })] })), _jsxs("div", { className: "mt-3", children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.intentTensionExplanationLabel') }), _jsx("p", { className: "text-ink-2 text-sm leading-relaxed", children: tension.explanation })] }), tension.intentDocHash && (_jsxs("div", { className: "mt-3", children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.intentTensionIntentDocHashLabel') }), _jsx("p", { className: "font-mono text-[11px] text-ink-3 break-all", children: tension.intentDocHash })] })), _jsx(OwnerDecisionPanel, { tension: tension, recordId: recordId, painId: painId, taskId: taskId, linkedCandidateId: linkedCandidateId, t: t })] }));
|
|
238
|
-
}
|
|
239
|
-
const OWNER_ACTION_BUTTONS = [
|
|
240
|
-
{ action: 'confirm_drift', labelKey: 'pages.pain.ownerDecisionSubmitConfirmDrift' },
|
|
241
|
-
{ action: 'revise_intent', labelKey: 'pages.pain.ownerDecisionSubmitReviseIntent' },
|
|
242
|
-
{ action: 'observe', labelKey: 'pages.pain.ownerDecisionSubmitObserve' },
|
|
243
|
-
{ action: 'dismiss', labelKey: 'pages.pain.ownerDecisionSubmitDismiss' },
|
|
244
|
-
{ action: 'promote_to_principle', labelKey: 'pages.pain.ownerDecisionSubmitPromoteToPrinciple' },
|
|
245
|
-
{ action: 'promote_to_rulehost', labelKey: 'pages.pain.ownerDecisionSubmitPromoteToRulehost' },
|
|
246
|
-
];
|
|
247
|
-
/**
|
|
248
|
-
* SPEC §22.1.3 + §24.5: each `source` value has exactly ONE primary action.
|
|
249
|
-
* - action_drift → Confirm Drift (primary)
|
|
250
|
-
* - intent_suspect → Revise Intent (primary)
|
|
251
|
-
* - healthy_tension → Observe (primary)
|
|
252
|
-
* - none → (no decision panel rendered — handled by shouldRenderIntentTensionPanel)
|
|
253
|
-
*
|
|
254
|
-
* The primary button uses `variant="default"` (the Button component's primary
|
|
255
|
-
* style: bg-gov text-paper); all others use `variant="outline"`.
|
|
256
|
-
* This satisfies §24.5 acceptance criterion 4: "primary action 不相同,且每种状态只有一个 primary".
|
|
257
|
-
*/
|
|
258
|
-
const PRIMARY_ACTION_BY_SOURCE = {
|
|
259
|
-
action_drift: 'confirm_drift',
|
|
260
|
-
intent_suspect: 'revise_intent',
|
|
261
|
-
healthy_tension: 'observe',
|
|
262
|
-
};
|
|
263
|
-
/**
|
|
264
|
-
* OwnerDecisionPanel — renders the Owner decision flow for an intent tension.
|
|
265
|
-
*
|
|
266
|
-
* State machine: 'idle' | 'submitting' | 'recorded' | 'error'
|
|
267
|
-
* - On mount, fetches existing decisions by painId (or taskId fallback).
|
|
268
|
-
* - Shows 6 action buttons + optional note input.
|
|
269
|
-
* - On submit, calls buildIntentDecisionPayload + recordIntentDecision.
|
|
270
|
-
* - Follow-up actions placeholder appears when existingDecisions is non-empty.
|
|
271
|
-
*
|
|
272
|
-
* Accessibility (EP-09):
|
|
273
|
-
* - Uses semantic <section> with aria-label
|
|
274
|
-
* - Buttons have descriptive text labels
|
|
275
|
-
*/
|
|
276
|
-
function OwnerDecisionPanel({ tension, recordId, painId, taskId, linkedCandidateId, t }) {
|
|
277
|
-
const [panelState, setPanelState] = useState('idle');
|
|
278
|
-
const [loadState, setLoadState] = useState('loading');
|
|
279
|
-
const [existingDecisions, setExistingDecisions] = useState([]);
|
|
280
|
-
const [note, setNote] = useState('');
|
|
281
|
-
const [errorMsg, setErrorMsg] = useState(null);
|
|
282
|
-
// Fetch existing decisions on mount — use painId when available, fall back to taskId.
|
|
283
|
-
useEffect(() => {
|
|
284
|
-
let cancelled = false;
|
|
285
|
-
const loadExisting = async () => {
|
|
286
|
-
setLoadState('loading');
|
|
287
|
-
const hasPainId = painId !== undefined && painId.length > 0;
|
|
288
|
-
const hasTaskId = taskId !== undefined && taskId.length > 0;
|
|
289
|
-
if (!hasPainId && !hasTaskId) {
|
|
290
|
-
// Nothing to query by — skip loading, treat as empty.
|
|
291
|
-
if (!cancelled)
|
|
292
|
-
setLoadState('loaded');
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
const result = hasPainId
|
|
296
|
-
? await listIntentDecisionsByPainId(painId)
|
|
297
|
-
: await listIntentDecisionsByTaskId(taskId);
|
|
298
|
-
if (cancelled)
|
|
299
|
-
return;
|
|
300
|
-
if (!result.success) {
|
|
301
|
-
setLoadState('error');
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
setExistingDecisions(result.data);
|
|
305
|
-
setLoadState('loaded');
|
|
306
|
-
};
|
|
307
|
-
void loadExisting();
|
|
308
|
-
return () => { cancelled = true; };
|
|
309
|
-
}, [painId, taskId]);
|
|
310
|
-
const handleSubmit = async (ownerAction) => {
|
|
311
|
-
setPanelState('submitting');
|
|
312
|
-
setErrorMsg(null);
|
|
313
|
-
// P0 fix (PRI-471): server requires a caller-supplied decision id.
|
|
314
|
-
// Use crypto.randomUUID() — available in modern browsers and Node 19+.
|
|
315
|
-
// Fallback to a timestamp-based id if crypto is unavailable (defensive).
|
|
316
|
-
const decisionId = (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function')
|
|
317
|
-
? crypto.randomUUID()
|
|
318
|
-
: 'decision-' + Date.now() + '-' + Math.random().toString(36).slice(2, 10);
|
|
319
|
-
const context = {
|
|
320
|
-
id: decisionId,
|
|
321
|
-
recordId,
|
|
322
|
-
painId,
|
|
323
|
-
taskId,
|
|
324
|
-
intentDocHash: tension.intentDocHash,
|
|
325
|
-
};
|
|
326
|
-
const payload = buildIntentDecisionPayload(tension, context, { ownerAction, note });
|
|
327
|
-
const result = await recordIntentDecision(payload);
|
|
328
|
-
if (!result.success) {
|
|
329
|
-
setPanelState('error');
|
|
330
|
-
setErrorMsg(result.error ?? t('pages.pain.ownerDecisionFailed'));
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
setPanelState('recorded');
|
|
334
|
-
// Add the new decision so follow-up actions appear.
|
|
335
|
-
setExistingDecisions([result.data.record, ...existingDecisions]);
|
|
336
|
-
};
|
|
337
|
-
const hasExisting = existingDecisions.length > 0;
|
|
338
|
-
const showFollowUp = shouldRenderFollowUpActions(existingDecisions);
|
|
339
|
-
// PRI-471: the most recent decision drives which follow-up actions are shown.
|
|
340
|
-
// Decisions are sorted DESC by createdAt (server side), so [0] is the latest.
|
|
341
|
-
const latestDecision = existingDecisions[0];
|
|
342
|
-
return (_jsxs("div", { className: "mt-4 pt-3 border-t border-line", children: [_jsx("h5", { className: "text-[13px] font-semibold text-ink mb-1", children: t('pages.pain.ownerDecisionPanelTitle') }), _jsx("p", { className: "text-ink-3 text-[12px] leading-relaxed mb-3", children: t('pages.pain.ownerDecisionPanelSubtitle') }), loadState === 'loading' && (_jsx("p", { className: "text-ink-4 text-[12px] italic", children: t('pages.pain.ownerDecisionLoadingExisting') })), loadState === 'error' && (_jsx("p", { className: "text-amber text-[12px]", children: t('pages.pain.ownerDecisionLoadFailed') })), loadState === 'loaded' && hasExisting && panelState !== 'recorded' && (_jsx("p", { className: "text-ink-3 text-[12px] mb-3 italic", children: t('pages.pain.ownerDecisionExisting') })), panelState === 'recorded' && (_jsx("p", { className: "text-emerald text-[12px] mb-3 font-medium", children: t('pages.pain.ownerDecisionRecorded') })), panelState === 'error' && errorMsg && (_jsxs("p", { className: "text-danger text-[12px] mb-3", children: [t('pages.pain.ownerDecisionFailed'), ": ", errorMsg] })), panelState !== 'recorded' && loadState === 'loaded' && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-3", children: [_jsx("label", { className: "block font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.ownerDecisionNoteLabel') }), _jsx("input", { type: "text", value: note, onChange: (e) => setNote(e.target.value), placeholder: t('pages.pain.ownerDecisionNotePlaceholder'), disabled: panelState === 'submitting', className: "w-full px-3 py-1.5 text-[13px] bg-surface border border-line rounded-[var(--radius-sm)] text-ink-2 focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2 disabled:opacity-50" })] }), _jsx("div", { className: "flex flex-wrap gap-2", children: OWNER_ACTION_BUTTONS.map(({ action, labelKey }) => {
|
|
343
|
-
// SPEC §22.1.3: the source determines which single button is primary.
|
|
344
|
-
const isPrimary = PRIMARY_ACTION_BY_SOURCE[tension.source] === action;
|
|
345
|
-
return (_jsx(Button, { variant: isPrimary ? 'default' : 'outline', size: "sm", disabled: panelState === 'submitting', onClick: () => void handleSubmit(action), children: panelState === 'submitting'
|
|
346
|
-
? t('pages.pain.ownerDecisionSubmitting')
|
|
347
|
-
: t(labelKey) }, action));
|
|
348
|
-
}) })] })), showFollowUp && latestDecision && (_jsx(FollowUpActions, { decision: latestDecision, linkedCandidateId: linkedCandidateId, onDecisionUpdated: (updated) => {
|
|
349
|
-
// Replace the updated decision in the list (idempotent on id).
|
|
350
|
-
setExistingDecisions((prev) => prev.map((d) => (d.id === updated.id ? updated : d)));
|
|
351
|
-
}, t: t }))] }));
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* FollowUpActions — renders the governed follow-up actions available after an
|
|
355
|
-
* Owner decision has been persisted (SPEC §22.1.4).
|
|
356
|
-
*
|
|
357
|
-
* Which actions are shown depends on the decision's `ownerAction`:
|
|
358
|
-
* - `confirm_drift` → "Link Existing Candidate" (links to the evidence chain's
|
|
359
|
-
* linkedCandidateId, or prompts the Owner to enter one if not available).
|
|
360
|
-
* - `promote_to_rulehost` → "View RuleHost Guidance" (returns CLI command).
|
|
361
|
-
* - `revise_intent` → "View Intent Patch Proposal" (returns read-only markdown).
|
|
362
|
-
* - `observe` / `dismiss` → no follow-up actions rendered (SPEC §22.1.4).
|
|
363
|
-
*
|
|
364
|
-
* Boundaries respected:
|
|
365
|
-
* - No new activation channel — `link_candidate` only records an audit link.
|
|
366
|
-
* - No SkillFileWriter, no auto-modification of INTENT.md — the patch proposal
|
|
367
|
-
* is display-only.
|
|
368
|
-
* - No direct rule creation — `guide_rulehost` only returns CLI guidance.
|
|
369
|
-
*
|
|
370
|
-
* Accessibility (EP-09):
|
|
371
|
-
* - Uses semantic <section> with aria-label
|
|
372
|
-
* - Buttons have descriptive text labels
|
|
373
|
-
* - Status messages use role="status" for screen readers
|
|
374
|
-
*/
|
|
375
|
-
function FollowUpActions({ decision, linkedCandidateId, onDecisionUpdated, t }) {
|
|
376
|
-
const [busyState, setBusyState] = useState('idle');
|
|
377
|
-
const [errorMsg, setErrorMsg] = useState(null);
|
|
378
|
-
const [response, setResponse] = useState(null);
|
|
379
|
-
const [candidateIdInput, setCandidateIdInput] = useState(linkedCandidateId ?? '');
|
|
380
|
-
const ownerAction = decision.ownerAction;
|
|
381
|
-
// SPEC §22.1.4: observe and dismiss record decisions without follow-up actions.
|
|
382
|
-
if (ownerAction === 'observe' || ownerAction === 'dismiss') {
|
|
383
|
-
return null;
|
|
384
|
-
}
|
|
385
|
-
const handleDispatch = async (type) => {
|
|
386
|
-
setBusyState('dispatching');
|
|
387
|
-
setErrorMsg(null);
|
|
388
|
-
setResponse(null);
|
|
389
|
-
// Trim the candidate id so leading/trailing whitespace never reaches the
|
|
390
|
-
// audit trail (the disable-check already trims; the payload must match it).
|
|
391
|
-
// The server re-trims as the trust-boundary authority (EP-01).
|
|
392
|
-
const payload = type === 'link_candidate'
|
|
393
|
-
? { type, candidateId: candidateIdInput.trim() }
|
|
394
|
-
: { type };
|
|
395
|
-
const result = await dispatchFollowUp(decision.id, payload);
|
|
396
|
-
if (!result.success) {
|
|
397
|
-
setBusyState('error');
|
|
398
|
-
setErrorMsg(result.error ?? t('pages.pain.followUpDispatchFailed'));
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
setBusyState('dispatched');
|
|
402
|
-
setResponse(result.data);
|
|
403
|
-
// For follow-up types that update the record (link_candidate,
|
|
404
|
-
// generate_patch_proposal), propagate the updated record up so the
|
|
405
|
-
// parent's existingDecisions list stays in sync.
|
|
406
|
-
if (result.data.type === 'link_candidate' || result.data.type === 'generate_patch_proposal') {
|
|
407
|
-
onDecisionUpdated(result.data.record);
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
const isDispatching = busyState === 'dispatching';
|
|
411
|
-
return (_jsxs("div", { className: "mt-4 p-3 bg-paper-2 border border-line rounded-[var(--radius-sm)]", children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-2", children: t('pages.pain.followUpActionsTitle') }), ownerAction === 'confirm_drift' && (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-ink-2 text-[13px] leading-relaxed", children: t('pages.pain.followUpLinkCandidateDescription') }), _jsxs("div", { className: "flex gap-2 items-start", children: [_jsx("input", { type: "text", value: candidateIdInput, onChange: (e) => setCandidateIdInput(e.target.value), placeholder: t('pages.pain.followUpCandidateIdPlaceholder'), "aria-label": t('pages.pain.followUpCandidateIdAriaLabel'), disabled: isDispatching, className: "flex-1 px-3 py-1.5 text-[13px] bg-surface border border-line rounded-[var(--radius-sm)] text-ink-2 focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2 disabled:opacity-50 font-mono" }), _jsx(Button, { variant: "outline", size: "sm", disabled: isDispatching || candidateIdInput.trim() === '', onClick: () => void handleDispatch('link_candidate'), children: isDispatching
|
|
412
|
-
? t('pages.pain.followUpDispatching')
|
|
413
|
-
: t('pages.pain.followUpLinkCandidateButton') })] }), linkedCandidateId && (_jsx("p", { className: "text-ink-4 text-[11px] italic", children: t('pages.pain.followUpPrefilledFromEvidenceChain') })), busyState === 'dispatched' && response?.type === 'link_candidate' && (_jsxs("p", { role: "status", className: "text-emerald text-[12px] font-medium", children: [t('pages.pain.followUpLinkedSuccess'), ": ", _jsx("span", { className: "font-mono", children: response.linkedCandidateId })] }))] })), ownerAction === 'promote_to_rulehost' && (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-ink-2 text-[13px] leading-relaxed", children: t('pages.pain.followUpGuideRulehostDescription') }), _jsx(Button, { variant: "outline", size: "sm", disabled: isDispatching, onClick: () => void handleDispatch('guide_rulehost'), children: isDispatching
|
|
414
|
-
? t('pages.pain.followUpDispatching')
|
|
415
|
-
: t('pages.pain.followUpGuideRulehostButton') }), busyState === 'dispatched' && response?.type === 'guide_rulehost' && (_jsxs("div", { role: "status", className: "mt-2 p-2 bg-surface border border-line rounded-[var(--radius-sm)]", children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4 mb-1", children: t('pages.pain.followUpCliCommandLabel') }), _jsx("pre", { className: "font-mono text-[12px] text-ink-2 whitespace-pre-wrap break-all", children: response.cliCommand }), _jsx("p", { className: "text-ink-3 text-[12px] mt-2 leading-relaxed", children: response.note })] }))] })), ownerAction === 'revise_intent' && (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-ink-2 text-[13px] leading-relaxed", children: t('pages.pain.followUpPatchProposalDescription') }), _jsx(Button, { variant: "outline", size: "sm", disabled: isDispatching, onClick: () => void handleDispatch('generate_patch_proposal'), children: isDispatching
|
|
416
|
-
? t('pages.pain.followUpDispatching')
|
|
417
|
-
: t('pages.pain.followUpViewPatchProposalButton') }), busyState === 'dispatched' && response?.type === 'generate_patch_proposal' && (_jsxs("div", { role: "status", className: "mt-2 p-2 bg-surface border border-line rounded-[var(--radius-sm)]", children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx("div", { className: "font-mono text-[11px] uppercase tracking-[0.08em] text-ink-4", children: t('pages.pain.followUpPatchProposalLabel') }), _jsx(Badge, { variant: "outline", className: "text-[10px]", children: t('pages.pain.followUpPatchProposalReadOnlyBadge') })] }), _jsx("pre", { className: "font-mono text-[11px] text-ink-2 whitespace-pre-wrap break-all bg-paper-2 p-2 rounded-[var(--radius-sm)] border border-line max-h-80 overflow-y-auto", children: response.patchProposal.markdown }), _jsx("p", { className: "text-amber text-[11px] mt-2 italic", children: t('pages.pain.followUpPatchProposalWarning') })] }))] })), ownerAction === 'promote_to_principle' && (_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-ink-2 text-[13px] leading-relaxed", children: t('pages.pain.followUpPromoteToPrincipleDescription') }), _jsxs("div", { className: "flex gap-2 items-start", children: [_jsx("input", { type: "text", value: candidateIdInput, onChange: (e) => setCandidateIdInput(e.target.value), placeholder: t('pages.pain.followUpCandidateIdPlaceholder'), "aria-label": t('pages.pain.followUpCandidateIdAriaLabel'), disabled: isDispatching, className: "flex-1 px-3 py-1.5 text-[13px] bg-surface border border-line rounded-[var(--radius-sm)] text-ink-2 focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2 disabled:opacity-50 font-mono" }), _jsx(Button, { variant: "outline", size: "sm", disabled: isDispatching || candidateIdInput.trim() === '', onClick: () => void handleDispatch('link_candidate'), children: isDispatching
|
|
418
|
-
? t('pages.pain.followUpDispatching')
|
|
419
|
-
: t('pages.pain.followUpLinkCandidateButton') })] }), linkedCandidateId && (_jsx("p", { className: "text-ink-4 text-[11px] italic", children: t('pages.pain.followUpPrefilledFromEvidenceChain') })), busyState === 'dispatched' && response?.type === 'link_candidate' && (_jsxs("p", { role: "status", className: "text-emerald text-[12px] font-medium", children: [t('pages.pain.followUpLinkedSuccess'), ": ", _jsx("span", { className: "font-mono", children: response.linkedCandidateId })] }))] })), busyState === 'error' && errorMsg && (_jsxs("p", { role: "alert", className: "text-danger text-[12px] mt-2", children: [t('pages.pain.followUpDispatchFailed'), ": ", errorMsg] }))] }));
|
|
420
|
-
}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pain-card-helpers.ts — Pure display logic for EvidenceChainCard.
|
|
3
|
-
*
|
|
4
|
-
* PRI-344: Extracted from PainPage.tsx for testability.
|
|
5
|
-
* No React dependency, no I/O. All functions are pure.
|
|
6
|
-
*/
|
|
7
|
-
import type { IntentTensionData, IntentDecisionRecordData } from '../../utils/validators.js';
|
|
8
|
-
import type { IntentDecisionInputPayload } from '../../api.js';
|
|
9
|
-
export type ConfidenceLabel = 'high' | 'mid' | 'low';
|
|
10
|
-
/**
|
|
11
|
-
* Map a numeric confidence to a human-readable label.
|
|
12
|
-
* Thresholds: ≥0.7 → 'high', 0.4–<0.7 → 'mid', <0.4 → 'low'
|
|
13
|
-
*/
|
|
14
|
-
export declare function mapConfidenceLabel(confidence: number): ConfidenceLabel;
|
|
15
|
-
export interface Layer1Data {
|
|
16
|
-
stateLabel: string;
|
|
17
|
-
sourceLabel: string;
|
|
18
|
-
observedAt: string;
|
|
19
|
-
}
|
|
20
|
-
export interface Layer2Data {
|
|
21
|
-
/** trigger behavior summary — always present */
|
|
22
|
-
triggerSummary: string;
|
|
23
|
-
/** PD conclusion — only when candidateTitle exists */
|
|
24
|
-
conclusion: string | null;
|
|
25
|
-
/** applicability — candidateSummary or rootCauseSummary */
|
|
26
|
-
applicability: string | null;
|
|
27
|
-
/** confidence level label + raw value */
|
|
28
|
-
confidence: {
|
|
29
|
-
label: ConfidenceLabel;
|
|
30
|
-
raw: number;
|
|
31
|
-
} | null;
|
|
32
|
-
/** failure reason — only for failed states */
|
|
33
|
-
failureReason: string | null;
|
|
34
|
-
/** degraded reason — when data is degraded */
|
|
35
|
-
degradedReason: string | null;
|
|
36
|
-
/** next action guidance */
|
|
37
|
-
nextAction: string | null;
|
|
38
|
-
/**
|
|
39
|
-
* PRI-469: optional intent tension from the diagnostician artifact.
|
|
40
|
-
* Present only when the record carries a validated intentTension.
|
|
41
|
-
* The UI renders an IntentTensionPanel when this is non-null (SPEC §22.1.2).
|
|
42
|
-
*/
|
|
43
|
-
intentTension: IntentTensionData | null;
|
|
44
|
-
}
|
|
45
|
-
export interface Layer3Data {
|
|
46
|
-
id: string;
|
|
47
|
-
linkedTaskId: string | null;
|
|
48
|
-
linkedTaskStatus: string | null;
|
|
49
|
-
linkedCandidateId: string | null;
|
|
50
|
-
linkedPrincipleId: string | null;
|
|
51
|
-
sourceKind: string;
|
|
52
|
-
state: string;
|
|
53
|
-
/** PRI-380: internalization task linkage */
|
|
54
|
-
internalizationTaskId: string | null;
|
|
55
|
-
dreamerTaskStatus: string | null;
|
|
56
|
-
}
|
|
57
|
-
export interface CardLayers {
|
|
58
|
-
layer1: Layer1Data;
|
|
59
|
-
layer2: Layer2Data;
|
|
60
|
-
layer3: Layer3Data;
|
|
61
|
-
}
|
|
62
|
-
export interface RecordData {
|
|
63
|
-
id: string;
|
|
64
|
-
sourceKind: string;
|
|
65
|
-
observedAt: string;
|
|
66
|
-
state: string;
|
|
67
|
-
summary: string;
|
|
68
|
-
candidateTitle?: string;
|
|
69
|
-
candidateSummary?: string;
|
|
70
|
-
rootCauseSummary?: string;
|
|
71
|
-
confidence?: number;
|
|
72
|
-
recommendationKind?: string;
|
|
73
|
-
failureReason?: string;
|
|
74
|
-
degradedReason?: string;
|
|
75
|
-
nextAction?: string;
|
|
76
|
-
linkedTaskId?: string;
|
|
77
|
-
linkedTaskStatus?: string;
|
|
78
|
-
linkedCandidateId?: string;
|
|
79
|
-
linkedPrincipleId?: string;
|
|
80
|
-
/** PRI-380: internalization task linkage */
|
|
81
|
-
internalizationTaskId?: string;
|
|
82
|
-
dreamerTaskStatus?: string;
|
|
83
|
-
/** PRI-469: optional intent tension from diagnostician artifact (SPEC §16). */
|
|
84
|
-
intentTension?: IntentTensionData;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Build the three-layer card data from a record.
|
|
88
|
-
* - Layer 1: status badges + source + timestamp
|
|
89
|
-
* - Layer 2: human-readable content (trigger, conclusion, applicability, confidence)
|
|
90
|
-
* - Layer 3: technical IDs (collapsed by default)
|
|
91
|
-
*/
|
|
92
|
-
export declare function buildCardLayers(record: RecordData): CardLayers;
|
|
93
|
-
/**
|
|
94
|
-
* Build a copyable debug ID summary string for developer troubleshooting.
|
|
95
|
-
* Only includes non-null fields. Format: `key: value` per line.
|
|
96
|
-
*
|
|
97
|
-
* Purpose: replaces the 8-row ID table in Layer 3 with one copyable string,
|
|
98
|
-
* so Owners never need to read raw IDs in the UI — they copy this string
|
|
99
|
-
* only when reporting an issue to a developer.
|
|
100
|
-
*/
|
|
101
|
-
export declare function buildDebugIdSummary(record: RecordData): string;
|
|
102
|
-
/**
|
|
103
|
-
* Check if a record's Layer 2 human-readable content is effectively empty.
|
|
104
|
-
* Used to show an honest placeholder instead of a visually-empty card that
|
|
105
|
-
* invites the user to expand Layer 3 IDs.
|
|
106
|
-
*
|
|
107
|
-
* "Effectively empty" = triggerSummary is blank OR equals a generic state-machine
|
|
108
|
-
* string, AND no conclusion/applicability/failureReason/degradedReason.
|
|
109
|
-
*/
|
|
110
|
-
export declare function isLayer2EffectivelyEmpty(record: RecordData): boolean;
|
|
111
|
-
/**
|
|
112
|
-
* Whether the IntentTensionPanel should render a high-salience decision panel.
|
|
113
|
-
*
|
|
114
|
-
* SPEC §22.1.3: when `source = none`, do NOT render a high-salience decision
|
|
115
|
-
* panel. The tension may still be shown in technical details as "no intent
|
|
116
|
-
* tension", but it must not compete for the Owner's attention.
|
|
117
|
-
*
|
|
118
|
-
* This helper is pure and tested independently of the React component.
|
|
119
|
-
*/
|
|
120
|
-
export declare function shouldRenderIntentTensionPanel(tension: IntentTensionData | null | undefined): tension is IntentTensionData;
|
|
121
|
-
/**
|
|
122
|
-
* Whether follow-up actions (precipitate candidate principle, promote to
|
|
123
|
-
* RuleHost, view Intent Patch Proposal) should be visible.
|
|
124
|
-
*
|
|
125
|
-
* SPEC §22.1.4: follow-up actions are NOT the first-layer decision. They only
|
|
126
|
-
* appear after the Owner has confirmed a decision (an IntentDecisionRecord
|
|
127
|
-
* has been persisted for this tension).
|
|
128
|
-
*
|
|
129
|
-
* PRI-470: replaced the PRI-469 stub. Now returns true only when a non-empty
|
|
130
|
-
* decisions array exists — i.e., at least one IntentDecisionRecord has been
|
|
131
|
-
* persisted for this tension.
|
|
132
|
-
*/
|
|
133
|
-
export declare function shouldRenderFollowUpActions(decisions?: IntentDecisionRecordData[] | null): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Context needed to build an IntentDecisionInputPayload from a tension.
|
|
136
|
-
* `id` is a caller-supplied UUID for the decision record. `recordId` is the
|
|
137
|
-
* evidence chain record ID used as a fallback when taskId is not available.
|
|
138
|
-
* `painId` and `intentDocHash` are optional.
|
|
139
|
-
*/
|
|
140
|
-
export interface IntentDecisionContext {
|
|
141
|
-
id: string;
|
|
142
|
-
recordId: string;
|
|
143
|
-
painId?: string;
|
|
144
|
-
taskId?: string;
|
|
145
|
-
intentDocHash?: string;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* The Owner's decision on an intent tension. `ownerAction` overrides
|
|
149
|
-
* `tension.suggestedOwnerAction` — the Owner may choose a different action
|
|
150
|
-
* than the one PD suggested. `note` is an optional trimmed annotation.
|
|
151
|
-
*/
|
|
152
|
-
export interface IntentDecisionChoice {
|
|
153
|
-
ownerAction: string;
|
|
154
|
-
note?: string;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Build an IntentDecisionInputPayload from an IntentTension and the Owner's
|
|
158
|
-
* chosen action. The payload is sent to POST /api/v1/intent-decisions.
|
|
159
|
-
*
|
|
160
|
-
* - `id` is the caller-supplied decision UUID (P0 fix: server requires this).
|
|
161
|
-
* - `taskId` falls back to `recordId` when not provided.
|
|
162
|
-
* - Optional fields (painId, intentDocHash, note) are omitted when empty.
|
|
163
|
-
* - `note` is trimmed before being included.
|
|
164
|
-
* - `evidenceRefs` is passed through as-is; truncation is the backend's job
|
|
165
|
-
* (the frontend must not silently drop evidence the Owner might rely on).
|
|
166
|
-
* - `ownerAction` overrides `tension.suggestedOwnerAction` — the Owner may
|
|
167
|
-
* choose a different action than the one PD suggested.
|
|
168
|
-
*
|
|
169
|
-
* P0 fix (PRI-471): the previous payload used `evidence` + `explanation` +
|
|
170
|
-
* `suggestedAction` and omitted `id`, which did not match the server's
|
|
171
|
-
* `IntentDecisionInput` contract (SPEC §21.7). The server requires `id` and
|
|
172
|
-
* `evidenceRefs`, and does not accept `explanation` or `suggestedAction` —
|
|
173
|
-
* those are snapshot fields the server persists from the tension, not inputs.
|
|
174
|
-
*/
|
|
175
|
-
export declare function buildIntentDecisionPayload(tension: IntentTensionData, context: IntentDecisionContext, choice: IntentDecisionChoice): IntentDecisionInputPayload;
|