create-principles-disciple 1.121.10 → 1.122.1
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/index.js +17 -0
- package/console/dist/server/models/OwnerDecisionConsoleModel.d.ts +39 -0
- package/console/dist/server/models/OwnerDecisionConsoleModel.js +233 -0
- package/console/dist/server/models/PrincipleClassifier.d.ts +3 -3
- package/console/dist/server/models/PrincipleClassifier.js +12 -5
- package/console/dist/server/models/PrinciplesConsoleModel.d.ts +1 -1
- package/console/dist/server/models/PrinciplesConsoleModel.js +2 -2
- package/console/dist/server/routes/failed-tasks.js +40 -2
- package/console/dist/server/routes/owner-decisions.d.ts +25 -0
- package/console/dist/server/routes/owner-decisions.js +186 -0
- package/console/dist/server/routes/principles.js +15 -7
- package/console/dist/ui/api.d.ts +12 -1
- package/console/dist/ui/api.js +9 -2
- package/console/dist/ui/components/notifications/NotificationProvider.js +8 -2
- package/console/dist/ui/i18n/en.json +33 -1
- package/console/dist/ui/i18n/zh-CN.json +33 -1
- package/console/dist/ui/pages/failed-tasks/FailedTasksPage.js +5 -1
- package/console/dist/ui/pages/focus/FocusPage.js +19 -2
- package/console/dist/ui/pages/focus/OwnerDecisionCard.d.ts +6 -0
- package/console/dist/ui/pages/focus/OwnerDecisionCard.js +86 -0
- package/console/dist/ui/pages/principles/PrinciplesPage.js +11 -5
- package/console/dist/ui/utils/validators.d.ts +37 -0
- package/console/dist/ui/utils/validators.js +123 -0
- package/console/dist/web/assets/app.css +11 -0
- package/console/dist/web/assets/app.js +2740 -2350
- package/core/dist/runtime-v2/__tests__/admission-gate.test.js +23 -6
- package/core/dist/runtime-v2/__tests__/admission-gate.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/context-payload-validation.test.js +1 -1
- package/core/dist/runtime-v2/__tests__/context-payload-validation.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/evaluator-repair-loop.test.js +20 -0
- package/core/dist/runtime-v2/__tests__/evaluator-repair-loop.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/evidence-guards.test.js +2 -2
- package/core/dist/runtime-v2/__tests__/evidence-guards.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/golden-path-diagnostician-e2e.test.js +1 -1
- package/core/dist/runtime-v2/__tests__/golden-path-diagnostician-e2e.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/pain-evidence-contract.test.js +3 -3
- package/core/dist/runtime-v2/__tests__/pain-evidence-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js +1 -1
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.js +26 -5
- package/core/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.js.map +1 -1
- package/core/dist/runtime-v2/admission-gate.d.ts +8 -1
- package/core/dist/runtime-v2/admission-gate.d.ts.map +1 -1
- package/core/dist/runtime-v2/admission-gate.js +14 -0
- package/core/dist/runtime-v2/admission-gate.js.map +1 -1
- package/core/dist/runtime-v2/context-payload.d.ts +9 -3
- package/core/dist/runtime-v2/context-payload.d.ts.map +1 -1
- package/core/dist/runtime-v2/context-payload.js +3 -1
- package/core/dist/runtime-v2/context-payload.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js +2 -2
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts +1 -1
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.js +2 -2
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.d.ts +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -1
- package/core/dist/runtime-v2/evolution/evolution-types.d.ts +8 -4
- package/core/dist/runtime-v2/evolution/evolution-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/evolution/evolution-types.js +3 -1
- package/core/dist/runtime-v2/evolution/evolution-types.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +9 -1
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +6 -0
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.js +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.js +15 -14
- package/core/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/owner-decision-architecture.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-decision-architecture.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-decision-architecture.test.js +56 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-decision-architecture.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-decision.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-decision.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-decision.test.js +883 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-decision.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-override-resume.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-override-resume.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-override-resume.test.js +328 -0
- package/core/dist/runtime-v2/internalization/__tests__/owner-override-resume.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/evaluator-output.d.ts +63 -2
- package/core/dist/runtime-v2/internalization/evaluator-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-output.js +139 -2
- package/core/dist/runtime-v2/internalization/evaluator-output.js.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts +54 -2
- package/core/dist/runtime-v2/internalization/evaluator-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-prompt-builder.js +49 -2
- package/core/dist/runtime-v2/internalization/evaluator-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts +34 -0
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.js +295 -12
- package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/internalization-orchestrator.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/internalization-orchestrator.js +10 -54
- package/core/dist/runtime-v2/internalization/internalization-orchestrator.js.map +1 -1
- package/core/dist/runtime-v2/internalization/internalization-transition-decision.d.ts +7 -1
- package/core/dist/runtime-v2/internalization/internalization-transition-decision.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/internalization-transition-decision.js +9 -2
- package/core/dist/runtime-v2/internalization/internalization-transition-decision.js.map +1 -1
- package/core/dist/runtime-v2/internalization/owner-resolution-service.d.ts +89 -0
- package/core/dist/runtime-v2/internalization/owner-resolution-service.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/owner-resolution-service.js +272 -0
- package/core/dist/runtime-v2/internalization/owner-resolution-service.js.map +1 -0
- package/core/dist/runtime-v2/internalization/owner-retry.d.ts +12 -0
- package/core/dist/runtime-v2/internalization/owner-retry.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/owner-retry.js +23 -0
- package/core/dist/runtime-v2/internalization/owner-retry.js.map +1 -1
- package/core/dist/runtime-v2/internalization/owner-review.d.ts +195 -0
- package/core/dist/runtime-v2/internalization/owner-review.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/owner-review.js +470 -0
- package/core/dist/runtime-v2/internalization/owner-review.js.map +1 -0
- package/core/dist/runtime-v2/internalization/peer-runner-contracts.d.ts +5 -1
- package/core/dist/runtime-v2/internalization/peer-runner-contracts.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/peer-runner-contracts.js.map +1 -1
- package/core/dist/runtime-v2/internalization/pitask-metadata.d.ts +68 -0
- package/core/dist/runtime-v2/internalization/pitask-metadata.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/pitask-metadata.js +104 -0
- package/core/dist/runtime-v2/internalization/pitask-metadata.js.map +1 -1
- package/core/dist/runtime-v2/internalization/revision-reopen.d.ts +56 -0
- package/core/dist/runtime-v2/internalization/revision-reopen.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/revision-reopen.js +144 -0
- package/core/dist/runtime-v2/internalization/revision-reopen.js.map +1 -0
- package/core/dist/runtime-v2/internalization/rollout-reviewer-runner.d.ts +12 -0
- package/core/dist/runtime-v2/internalization/rollout-reviewer-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/rollout-reviewer-runner.js +145 -14
- package/core/dist/runtime-v2/internalization/rollout-reviewer-runner.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-bridge.d.ts +2 -0
- package/core/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-bridge.js +4 -3
- package/core/dist/runtime-v2/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime-v2/pain-to-principle-service.d.ts +1 -0
- package/core/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-to-principle-service.js +1 -0
- package/core/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
- package/core/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.js +6 -6
- package/core/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.js.map +1 -1
- package/core/dist/runtime-v2/store/context/sqlite-context-assembler.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/context/sqlite-context-assembler.js +25 -5
- package/core/dist/runtime-v2/store/context/sqlite-context-assembler.js.map +1 -1
- package/core/dist/runtime-v2/store/context/sqlite-context-assembler.test.js +39 -9
- package/core/dist/runtime-v2/store/context/sqlite-context-assembler.test.js.map +1 -1
- package/core/dist/runtime-v2/store/runtime-state-manager.d.ts +6 -0
- package/core/dist/runtime-v2/store/runtime-state-manager.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/runtime-state-manager.js +9 -0
- package/core/dist/runtime-v2/store/runtime-state-manager.js.map +1 -1
- package/core/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.d.ts +2 -0
- package/core/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.js +78 -0
- package/core/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.js.map +1 -0
- package/core/dist/runtime-v2/store/task/memory-task-store.d.ts +1 -0
- package/core/dist/runtime-v2/store/task/memory-task-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/task/memory-task-store.js +8 -0
- package/core/dist/runtime-v2/store/task/memory-task-store.js.map +1 -1
- package/core/dist/runtime-v2/store/task/sqlite-task-store.d.ts +1 -0
- package/core/dist/runtime-v2/store/task/sqlite-task-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/task/sqlite-task-store.js +52 -0
- package/core/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
- package/core/dist/runtime-v2/store/task/task-store.d.ts +9 -0
- package/core/dist/runtime-v2/store/task/task-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/workspace-isolation.test.js +1 -0
- package/core/dist/runtime-v2/store/workspace-isolation.test.js.map +1 -1
- package/core/dist/runtime-v2/task-status.d.ts +2 -1
- package/core/dist/runtime-v2/task-status.d.ts.map +1 -1
- package/core/dist/runtime-v2/task-status.js +5 -1
- package/core/dist/runtime-v2/task-status.js.map +1 -1
- package/host-runtime/dist/governance-observation-store.d.ts +7 -0
- package/host-runtime/dist/governance-observation-store.js +9 -0
- package/host-runtime/dist/governance-signal-admission.d.ts +228 -0
- package/host-runtime/dist/governance-signal-admission.js +841 -0
- package/host-runtime/dist/index.d.ts +1 -0
- package/host-runtime/dist/index.js +1 -0
- package/host-runtime/dist/production-pain-evidence.d.ts +60 -0
- package/host-runtime/dist/production-pain-evidence.js +73 -10
- package/package.json +2 -2
- package/pd-cli/dist/commands/codex-reconcile.d.ts +22 -0
- package/pd-cli/dist/commands/codex-reconcile.d.ts.map +1 -0
- package/pd-cli/dist/commands/codex-reconcile.js +61 -0
- package/pd-cli/dist/commands/codex-reconcile.js.map +1 -0
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +4 -2
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-retry.js +14 -0
- package/pd-cli/dist/commands/runtime-internalization-retry.js.map +1 -1
- package/pd-cli/dist/index.js +23 -0
- package/pd-cli/dist/index.js.map +1 -1
- package/plugin/dist/bundle.js +497 -486
- package/plugin/dist/core/signal-collector-host.d.ts +11 -0
- package/plugin/dist/core/signal-keyword-store.d.ts +12 -35
- package/plugin/dist/governance-audit.js +153 -153
- package/plugin/dist/hooks/triage-adapter.d.ts +1 -1
- package/plugin/dist/rulehost-evidence.js +180 -180
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +2 -2
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* OwnerDecisionCard — PRI-629 统一 Owner Inbox 的决策卡(evaluator/rollout)。
|
|
4
|
+
*
|
|
5
|
+
* 第一层只回答 Owner 关心的问题 (SPEC §26): 发生了什么 / 为什么找我 /
|
|
6
|
+
* 机器建议 / 可执行动作与后果。taskId / repairIteration / reasonCode 等
|
|
7
|
+
* 实现细节收纳在折叠的高级诊断里。动作经 resolveOwnerDecision 服务端重读
|
|
8
|
+
* durable facts — stale → 409,由本组件以可理解文案呈现并触发刷新。
|
|
9
|
+
*/
|
|
10
|
+
import { useState } from "react";
|
|
11
|
+
import { Link } from "react-router-dom";
|
|
12
|
+
import { useTranslation } from "react-i18next";
|
|
13
|
+
import { toast } from "sonner";
|
|
14
|
+
import { resolveOwnerDecision } from "../../api.js";
|
|
15
|
+
export function OwnerDecisionCard({ item, onResolved }) {
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const [actionLoading, setActionLoading] = useState(null);
|
|
18
|
+
const [instruction, setInstruction] = useState("");
|
|
19
|
+
const [showInstruction, setShowInstruction] = useState(false);
|
|
20
|
+
const [showAdvanced, setShowAdvanced] = useState(false);
|
|
21
|
+
const isTaskDecision = item.kind === "evaluator_review" || item.kind === "rollout_review";
|
|
22
|
+
const canAccept = item.allowedActions.includes("accept_current");
|
|
23
|
+
const canRevise = item.allowedActions.includes("revise_once");
|
|
24
|
+
const canReject = item.allowedActions.includes("reject_current");
|
|
25
|
+
async function handleAction(action) {
|
|
26
|
+
if (action === "revise_once" && showInstruction && instruction.trim().length === 0) {
|
|
27
|
+
// 指导为空也可以提交 — instruction 是可选的;这里仅在展开输入后要求非空确认
|
|
28
|
+
// (避免误提交空指导),Owner 可收起输入直接提交。
|
|
29
|
+
toast.error(t("pages.focus.ownerDecision.instructionRequired"));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setActionLoading(action);
|
|
33
|
+
try {
|
|
34
|
+
const response = await resolveOwnerDecision(item.taskId, {
|
|
35
|
+
action,
|
|
36
|
+
reviewKey: item.reviewKey,
|
|
37
|
+
expectedRevisionEpoch: item.expectedRevisionEpoch,
|
|
38
|
+
expectedSourceRunId: item.expectedSourceRunId,
|
|
39
|
+
expectedSourceArtifactId: item.expectedSourceArtifactId,
|
|
40
|
+
expectedSourceArtifactHash: item.expectedSourceArtifactHash,
|
|
41
|
+
...(action === "revise_once" && instruction.trim().length > 0
|
|
42
|
+
? { ownerInstruction: instruction.trim() }
|
|
43
|
+
: { ownerInstruction: null }),
|
|
44
|
+
});
|
|
45
|
+
if (!response.success) {
|
|
46
|
+
if (response.error === "stale_owner_decision") {
|
|
47
|
+
toast.error(t("pages.focus.ownerDecision.staleError"));
|
|
48
|
+
}
|
|
49
|
+
else if (response.error === "already_resolved") {
|
|
50
|
+
toast.info(t("pages.focus.ownerDecision.alreadyResolved"));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
toast.error(response.error ?? t("pages.focus.ownerDecision.actionFailed"));
|
|
54
|
+
}
|
|
55
|
+
onResolved();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
toast.success(t("pages.focus.ownerDecision.resolved"));
|
|
59
|
+
onResolved();
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
toast.error(t("pages.focus.ownerDecision.actionFailed"));
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
setActionLoading(null);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const kindLabel = item.kind === "rollout_review"
|
|
69
|
+
? t("pages.focus.ownerDecision.kindRollout")
|
|
70
|
+
: item.kind === "activation_approval"
|
|
71
|
+
? t("pages.focus.ownerDecision.kindApproval")
|
|
72
|
+
: item.kind === "rulecode_decision"
|
|
73
|
+
? t("pages.focus.ownerDecision.kindRulecode")
|
|
74
|
+
: t("pages.focus.ownerDecision.kindEvaluator");
|
|
75
|
+
return (_jsxs("article", { className: "bg-panel border border-line rounded-[6px] p-4 mb-3", "data-testid": `owner-decision-${item.taskId}`, children: [_jsxs("div", { className: "flex items-start justify-between gap-3 mb-2", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-ink text-[14px] font-medium leading-snug", children: item.title }), _jsx("div", { className: "mt-1 text-ink-4 text-[11px] font-mono uppercase tracking-[0.08em]", children: kindLabel })] }), item.legacy && (_jsx("span", { className: "shrink-0 text-ink-4 border border-line rounded-[2px] px-[7px] py-[3px] text-[10.5px] font-mono", children: t("pages.focus.ownerDecision.legacyBadge") }))] }), _jsx("p", { className: "text-ink-2 text-[13px] leading-relaxed mb-2", children: item.summary }), item.machineRecommendation && (_jsxs("p", { className: "text-ink-3 text-[12.5px] mb-1", children: [_jsx("span", { className: "font-medium", children: t("pages.focus.ownerDecision.machineRecommendationLabel") }), " ", item.machineRecommendation, item.score !== undefined && _jsx("span", { className: "font-mono ml-1", children: item.score.toFixed(2) })] })), item.kind === "rollout_review" && (_jsx("p", { className: "text-ink-4 text-[12px] mb-1", children: t("pages.focus.ownerDecision.rolloutSafetyNote") })), isTaskDecision ? (_jsxs(_Fragment, { children: [showInstruction && (_jsxs("div", { className: "mt-2 mb-2", children: [_jsx("label", { className: "block font-mono text-[11px] uppercase tracking-[0.08em] text-ink-3 mb-2", children: t("pages.focus.ownerDecision.instructionLabel") }), _jsx("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value.slice(0, 500)), "data-testid": `owner-instruction-${item.taskId}`, placeholder: t("pages.focus.ownerDecision.instructionPlaceholder"), className: "w-full border border-line rounded-[var(--radius-md)] bg-surface text-ink px-3 py-2 text-[13px] min-h-[64px] resize-y focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gov" })] })), _jsxs("div", { className: "flex flex-wrap gap-2 mt-3", children: [canAccept && (_jsx("button", { type: "button", onClick: () => handleAction("accept_current"), disabled: actionLoading !== null, "data-testid": `owner-accept-${item.taskId}`, className: "inline-flex items-center border border-gov text-gov bg-surface rounded-[3px] px-[14px] py-[6px] text-[12.5px] hover:bg-gov/5 transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: actionLoading === "accept_current" ? t("common.loading") : t("pages.focus.ownerDecision.acceptCurrent") })), canRevise && (_jsx("button", { type: "button", onClick: () => {
|
|
76
|
+
if (!showInstruction) {
|
|
77
|
+
setShowInstruction(true);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
void handleAction("revise_once");
|
|
81
|
+
}, disabled: actionLoading !== null, "data-testid": `owner-revise-${item.taskId}`, className: "inline-flex items-center border border-line text-ink bg-surface rounded-[3px] px-[14px] py-[6px] text-[12.5px] hover:border-line-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: actionLoading === "revise_once" ? t("common.loading") : t("pages.focus.ownerDecision.reviseOnce") })), canReject && (_jsx("button", { type: "button", onClick: () => handleAction("reject_current"), disabled: actionLoading !== null, "data-testid": `owner-reject-${item.taskId}`, className: "inline-flex items-center border border-danger text-danger bg-surface rounded-[3px] px-[14px] py-[6px] text-[12.5px] hover:bg-danger/5 transition-colors disabled:opacity-50 disabled:cursor-not-allowed", children: actionLoading === "reject_current" ? t("common.loading") : t("pages.focus.ownerDecision.rejectCurrent") }))] }), _jsx("div", { className: "mt-2 text-ink-4 text-[11.5px] leading-relaxed", children: t("pages.focus.ownerDecision.actionConsequence") }), _jsxs("button", { type: "button", onClick: () => setShowAdvanced(!showAdvanced), className: "mt-2 text-ink-4 text-[11px] font-mono uppercase tracking-[0.08em] hover:text-ink-3", "data-testid": `owner-advanced-toggle-${item.taskId}`, children: [showAdvanced ? "▾" : "▸", " ", t("pages.focus.ownerDecision.advanced")] }), showAdvanced && (_jsxs("dl", { className: "mt-2 grid gap-1 text-[11.5px] font-mono text-ink-4", children: [_jsxs("div", { children: ["taskId: ", item.taskId] }), _jsxs("div", { children: ["reasonCode: ", item.reasonCode] }), _jsxs("div", { children: ["reviewKey: ", item.reviewKey.slice(0, 24), "\u2026"] }), _jsxs("div", { children: ["epoch: ", item.expectedRevisionEpoch] })] }))] })) : (_jsxs("div", { className: "mt-2", children: [_jsx("p", { className: "text-ink-4 text-[12px] mb-2", children: item.kind === "activation_approval"
|
|
82
|
+
? t("pages.focus.ownerDecision.approvalHint")
|
|
83
|
+
: t("pages.focus.ownerDecision.rulecodeHint") }), item.kind === "activation_approval" ? (_jsx("button", { type: "button", onClick: () => {
|
|
84
|
+
document.getElementById("approval-queue-section")?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
85
|
+
}, "data-testid": `go-approvals-${item.taskId}`, className: "inline-flex items-center border border-gov text-gov bg-surface rounded-[3px] px-[14px] py-[6px] text-[12.5px] hover:bg-gov/5 transition-colors", children: t("pages.focus.ownerDecision.goApprovalsCta") })) : (_jsx(Link, { to: "/activation", "data-testid": `go-activation-${item.taskId}`, className: "inline-flex items-center border border-gov text-gov bg-surface rounded-[3px] px-[14px] py-[6px] text-[12.5px] hover:bg-gov/5 transition-colors", children: t("pages.focus.ownerDecision.goActivationCta") }))] }))] }));
|
|
86
|
+
}
|
|
@@ -22,19 +22,21 @@ function toReviewStatus(principleStatus, approvalStatus) {
|
|
|
22
22
|
return "parked";
|
|
23
23
|
if (principleStatus === "deprecated")
|
|
24
24
|
return "rejected";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return "
|
|
25
|
+
// PRI-629 INV-02: candidate/probation 是生命周期(内化进行中),不是"待你
|
|
26
|
+
// 审查"。真实 Owner 决策只在治理焦点 Owner Inbox 呈现。
|
|
27
|
+
return "candidate";
|
|
28
28
|
}
|
|
29
29
|
// ── Status visual mapping ───────────────────────────────────────────────────
|
|
30
30
|
const STATUS_BORDER = {
|
|
31
31
|
pending: "border-l-gov",
|
|
32
|
+
candidate: "border-l-ink-3",
|
|
32
33
|
approved: "border-l-green",
|
|
33
34
|
rejected: "border-l-danger",
|
|
34
35
|
parked: "border-l-ink-3",
|
|
35
36
|
};
|
|
36
37
|
const STATUS_TEXT = {
|
|
37
38
|
pending: "text-gov",
|
|
39
|
+
candidate: "text-ink-3",
|
|
38
40
|
approved: "text-green",
|
|
39
41
|
rejected: "text-danger",
|
|
40
42
|
parked: "text-ink-3",
|
|
@@ -47,6 +49,7 @@ const CHANNEL_LABELS = {
|
|
|
47
49
|
// ── PRI-558: timeline node fill + status-driven copy (theme tokens, dark-mode safe) ──
|
|
48
50
|
const STATUS_DOT_BG = {
|
|
49
51
|
pending: "bg-gov",
|
|
52
|
+
candidate: "bg-ink-3",
|
|
50
53
|
approved: "bg-green",
|
|
51
54
|
rejected: "bg-danger",
|
|
52
55
|
parked: "bg-ink-3",
|
|
@@ -56,12 +59,14 @@ const STATUS_DOT_BG = {
|
|
|
56
59
|
const GOV_DECISION = {
|
|
57
60
|
approved: { glyph: "✓", labelKey: "principles.govApproved" },
|
|
58
61
|
pending: { glyph: "⏳", labelKey: "principles.govPending" },
|
|
62
|
+
candidate: { glyph: "○", labelKey: "principles.statusCandidate" },
|
|
59
63
|
rejected: { glyph: "✗", labelKey: "principles.statusRejected" },
|
|
60
64
|
parked: { glyph: "⏸", labelKey: "principles.statusParked" },
|
|
61
65
|
};
|
|
62
66
|
const BLOCK_IMPACT_KEY = {
|
|
63
67
|
approved: "principles.blockImpactActive",
|
|
64
68
|
pending: "principles.blockImpactPending",
|
|
69
|
+
candidate: "principles.blockImpactPending",
|
|
65
70
|
rejected: "principles.blockImpactRejected",
|
|
66
71
|
parked: "principles.blockImpactParked",
|
|
67
72
|
};
|
|
@@ -145,8 +150,9 @@ export function PrinciplesPage() {
|
|
|
145
150
|
const [search, setSearch] = useState("");
|
|
146
151
|
const [statusFilter, setStatusFilter] = useState("all");
|
|
147
152
|
const [sortBy, setSortBy] = useState("updatedAt");
|
|
148
|
-
// PRI-
|
|
149
|
-
|
|
153
|
+
// PRI-629 (INV-02): 默认展示全部 — candidate 是生命周期而非待办,
|
|
154
|
+
// "只看待决策"不再作为默认视图 (真实决策在治理焦点)。
|
|
155
|
+
const [filterMode, setFilterMode] = useState('all');
|
|
150
156
|
const [categories, setCategories] = useState();
|
|
151
157
|
// Fetch data
|
|
152
158
|
const loadData = useCallback(async () => {
|
|
@@ -810,3 +810,40 @@ export interface OwnerIdentityUnregisterData {
|
|
|
810
810
|
governance: OwnerGovernanceReadinessData;
|
|
811
811
|
}
|
|
812
812
|
export declare function validateOwnerIdentityUnregister(v: unknown): OwnerIdentityUnregisterData | null;
|
|
813
|
+
export interface OwnerDecisionItemData {
|
|
814
|
+
reviewKey: string;
|
|
815
|
+
kind: string;
|
|
816
|
+
taskId: string;
|
|
817
|
+
title: string;
|
|
818
|
+
summary: string;
|
|
819
|
+
reasonCode: string;
|
|
820
|
+
legacy: boolean;
|
|
821
|
+
allowedActions: string[];
|
|
822
|
+
expectedRevisionEpoch: number;
|
|
823
|
+
expectedSourceRunId: string;
|
|
824
|
+
expectedSourceArtifactId: string;
|
|
825
|
+
expectedSourceArtifactHash: string;
|
|
826
|
+
createdAt: string;
|
|
827
|
+
machineRecommendation?: string;
|
|
828
|
+
score?: number;
|
|
829
|
+
principleId?: string;
|
|
830
|
+
}
|
|
831
|
+
export interface OwnerDecisionsData {
|
|
832
|
+
items: OwnerDecisionItemData[];
|
|
833
|
+
total: number;
|
|
834
|
+
generatedAt: string;
|
|
835
|
+
}
|
|
836
|
+
export declare function validateOwnerDecisionItem(v: unknown): OwnerDecisionItemData | null;
|
|
837
|
+
export declare function validateOwnerDecisionsData(v: unknown): OwnerDecisionsData | null;
|
|
838
|
+
export interface OwnerResolutionResultData {
|
|
839
|
+
status: 'resolved';
|
|
840
|
+
resolutionId: string;
|
|
841
|
+
reviewKey: string;
|
|
842
|
+
action: string;
|
|
843
|
+
applied: boolean;
|
|
844
|
+
runnerWillApply: boolean;
|
|
845
|
+
effectiveDecision?: string;
|
|
846
|
+
targetTaskId?: string;
|
|
847
|
+
nextAction?: string;
|
|
848
|
+
}
|
|
849
|
+
export declare function validateOwnerResolutionResult(v: unknown): OwnerResolutionResultData | null;
|
|
@@ -2326,3 +2326,126 @@ export function validateOwnerIdentityUnregister(v) {
|
|
|
2326
2326
|
return null;
|
|
2327
2327
|
return { ok: true, source: 'none', governance };
|
|
2328
2328
|
}
|
|
2329
|
+
// ── PRI-629: unified Owner Decision inbox (owner-decisions API) ──────────────
|
|
2330
|
+
const OWNER_DECISION_KINDS = new Set(['evaluator_review', 'rollout_review', 'activation_approval', 'rulecode_decision']);
|
|
2331
|
+
const OWNER_DECISION_ACTIONS = new Set(['accept_current', 'revise_once', 'reject_current', 'approve', 'reject', 'promote', 'reject_after_shadow']);
|
|
2332
|
+
export function validateOwnerDecisionItem(v) {
|
|
2333
|
+
if (!isObject(v))
|
|
2334
|
+
return null;
|
|
2335
|
+
const { reviewKey } = v;
|
|
2336
|
+
const { kind } = v;
|
|
2337
|
+
const { taskId } = v;
|
|
2338
|
+
const { title } = v;
|
|
2339
|
+
const { summary } = v;
|
|
2340
|
+
const { reasonCode } = v;
|
|
2341
|
+
const { createdAt } = v;
|
|
2342
|
+
if (!isString(reviewKey) || !isString(kind) || !isString(taskId) || !isString(title)
|
|
2343
|
+
|| !isString(summary) || !isString(reasonCode) || !isString(createdAt))
|
|
2344
|
+
return null;
|
|
2345
|
+
if (!OWNER_DECISION_KINDS.has(kind))
|
|
2346
|
+
return null;
|
|
2347
|
+
if (!Object.hasOwn(v, 'legacy') || !isBoolean(v.legacy))
|
|
2348
|
+
return null;
|
|
2349
|
+
if (!Object.hasOwn(v, 'allowedActions') || !Array.isArray(v.allowedActions))
|
|
2350
|
+
return null;
|
|
2351
|
+
for (const action of v.allowedActions) {
|
|
2352
|
+
if (typeof action !== 'string' || !OWNER_DECISION_ACTIONS.has(action))
|
|
2353
|
+
return null;
|
|
2354
|
+
}
|
|
2355
|
+
if (!Object.hasOwn(v, 'expectedRevisionEpoch') || !isNumber(v.expectedRevisionEpoch))
|
|
2356
|
+
return null;
|
|
2357
|
+
const { expectedRevisionEpoch } = v;
|
|
2358
|
+
const { expectedSourceRunId } = v;
|
|
2359
|
+
const { expectedSourceArtifactId } = v;
|
|
2360
|
+
const { expectedSourceArtifactHash } = v;
|
|
2361
|
+
if (!isString(expectedSourceRunId) || !isString(expectedSourceArtifactId) || !isString(expectedSourceArtifactHash))
|
|
2362
|
+
return null;
|
|
2363
|
+
const item = {
|
|
2364
|
+
reviewKey,
|
|
2365
|
+
kind,
|
|
2366
|
+
taskId,
|
|
2367
|
+
title,
|
|
2368
|
+
summary,
|
|
2369
|
+
reasonCode,
|
|
2370
|
+
legacy: v.legacy,
|
|
2371
|
+
allowedActions: v.allowedActions,
|
|
2372
|
+
expectedRevisionEpoch,
|
|
2373
|
+
expectedSourceRunId,
|
|
2374
|
+
expectedSourceArtifactId,
|
|
2375
|
+
expectedSourceArtifactHash,
|
|
2376
|
+
createdAt,
|
|
2377
|
+
};
|
|
2378
|
+
if (Object.hasOwn(v, 'machineRecommendation')) {
|
|
2379
|
+
if (!isString(v.machineRecommendation))
|
|
2380
|
+
return null;
|
|
2381
|
+
item.machineRecommendation = v.machineRecommendation;
|
|
2382
|
+
}
|
|
2383
|
+
if (Object.hasOwn(v, 'score')) {
|
|
2384
|
+
if (!isNumber(v.score))
|
|
2385
|
+
return null;
|
|
2386
|
+
item.score = v.score;
|
|
2387
|
+
}
|
|
2388
|
+
if (Object.hasOwn(v, 'principleId')) {
|
|
2389
|
+
if (!isString(v.principleId))
|
|
2390
|
+
return null;
|
|
2391
|
+
item.principleId = v.principleId;
|
|
2392
|
+
}
|
|
2393
|
+
return item;
|
|
2394
|
+
}
|
|
2395
|
+
export function validateOwnerDecisionsData(v) {
|
|
2396
|
+
if (!isObject(v))
|
|
2397
|
+
return null;
|
|
2398
|
+
if (!Object.hasOwn(v, 'items') || !Array.isArray(v.items))
|
|
2399
|
+
return null;
|
|
2400
|
+
const items = [];
|
|
2401
|
+
for (const entry of v.items) {
|
|
2402
|
+
const item = validateOwnerDecisionItem(entry);
|
|
2403
|
+
if (item === null)
|
|
2404
|
+
return null;
|
|
2405
|
+
items.push(item);
|
|
2406
|
+
}
|
|
2407
|
+
if (!Object.hasOwn(v, 'total') || !isNumber(v.total))
|
|
2408
|
+
return null;
|
|
2409
|
+
if (!Object.hasOwn(v, 'generatedAt') || !isString(v.generatedAt))
|
|
2410
|
+
return null;
|
|
2411
|
+
return { items, total: v.total, generatedAt: v.generatedAt };
|
|
2412
|
+
}
|
|
2413
|
+
export function validateOwnerResolutionResult(v) {
|
|
2414
|
+
if (!isObject(v))
|
|
2415
|
+
return null;
|
|
2416
|
+
if (!Object.hasOwn(v, 'status') || v.status !== 'resolved')
|
|
2417
|
+
return null;
|
|
2418
|
+
const { resolutionId } = v;
|
|
2419
|
+
const { reviewKey } = v;
|
|
2420
|
+
const { action } = v;
|
|
2421
|
+
if (!isString(resolutionId) || !isString(reviewKey) || !isString(action))
|
|
2422
|
+
return null;
|
|
2423
|
+
if (!Object.hasOwn(v, 'applied') || !isBoolean(v.applied))
|
|
2424
|
+
return null;
|
|
2425
|
+
if (!Object.hasOwn(v, 'runnerWillApply') || !isBoolean(v.runnerWillApply))
|
|
2426
|
+
return null;
|
|
2427
|
+
const result = {
|
|
2428
|
+
status: 'resolved',
|
|
2429
|
+
resolutionId,
|
|
2430
|
+
reviewKey,
|
|
2431
|
+
action,
|
|
2432
|
+
applied: v.applied,
|
|
2433
|
+
runnerWillApply: v.runnerWillApply,
|
|
2434
|
+
};
|
|
2435
|
+
if (Object.hasOwn(v, 'effectiveDecision')) {
|
|
2436
|
+
if (!isString(v.effectiveDecision))
|
|
2437
|
+
return null;
|
|
2438
|
+
result.effectiveDecision = v.effectiveDecision;
|
|
2439
|
+
}
|
|
2440
|
+
if (Object.hasOwn(v, 'targetTaskId')) {
|
|
2441
|
+
if (!isString(v.targetTaskId))
|
|
2442
|
+
return null;
|
|
2443
|
+
result.targetTaskId = v.targetTaskId;
|
|
2444
|
+
}
|
|
2445
|
+
if (Object.hasOwn(v, 'nextAction')) {
|
|
2446
|
+
if (!isString(v.nextAction))
|
|
2447
|
+
return null;
|
|
2448
|
+
result.nextAction = v.nextAction;
|
|
2449
|
+
}
|
|
2450
|
+
return result;
|
|
2451
|
+
}
|
|
@@ -667,6 +667,9 @@
|
|
|
667
667
|
.min-h-0 {
|
|
668
668
|
min-height: 0px;
|
|
669
669
|
}
|
|
670
|
+
.min-h-\[64px\] {
|
|
671
|
+
min-height: 64px;
|
|
672
|
+
}
|
|
670
673
|
.min-h-\[80px\] {
|
|
671
674
|
min-height: 80px;
|
|
672
675
|
}
|
|
@@ -2550,6 +2553,14 @@
|
|
|
2550
2553
|
.hover\:text-gov-2:hover {
|
|
2551
2554
|
color: var(--color-gov-2);
|
|
2552
2555
|
}
|
|
2556
|
+
.hover\:text-gov\/80:hover {
|
|
2557
|
+
color: color-mix(in srgb, #1e3a5f 80%, transparent);
|
|
2558
|
+
}
|
|
2559
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
2560
|
+
.hover\:text-gov\/80:hover {
|
|
2561
|
+
color: color-mix(in oklab, var(--color-gov) 80%, transparent);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2553
2564
|
.hover\:text-green:hover {
|
|
2554
2565
|
color: var(--color-green);
|
|
2555
2566
|
}
|