create-principles-disciple 1.143.0 → 1.143.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 +19 -0
- package/console/dist/server/models/OwnerDecisionViewModel.d.ts +65 -0
- package/console/dist/server/models/OwnerDecisionViewModel.js +686 -0
- package/console/dist/server/routes/owner-decision.d.ts +40 -0
- package/console/dist/server/routes/owner-decision.js +88 -0
- package/console/dist/server/routes/principles.d.ts +3 -0
- package/console/dist/server/routes/principles.js +3 -0
- package/console/dist/ui/api.d.ts +7 -3
- package/console/dist/ui/api.js +13 -2
- package/console/dist/ui/i18n/en.json +70 -4
- package/console/dist/ui/i18n/zh-CN.json +70 -4
- package/console/dist/ui/pages/focus/FocusPage.js +25 -2
- package/console/dist/ui/pages/principles/PrincipleDetailPage.d.ts +24 -0
- package/console/dist/ui/pages/principles/PrincipleDetailPage.js +168 -210
- package/console/dist/ui/pages/principles/PrinciplesPage.js +25 -10
- package/console/dist/ui/utils/enum-labels.d.ts +1 -1
- package/console/dist/ui/utils/enum-labels.js +8 -0
- package/console/dist/ui/utils/validators.d.ts +99 -1
- package/console/dist/ui/utils/validators.js +115 -0
- package/console/dist/web/assets/app.css +3 -0
- package/console/dist/web/assets/app.js +590 -349
- package/core/dist/runtime-v2/adapter/__tests__/principle-tree-ledger-adapter.test.js +25 -0
- package/core/dist/runtime-v2/adapter/__tests__/principle-tree-ledger-adapter.test.js.map +1 -1
- package/core/dist/runtime-v2/adapter/principle-tree-ledger-adapter.d.ts +16 -0
- package/core/dist/runtime-v2/adapter/principle-tree-ledger-adapter.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/principle-tree-ledger-adapter.js +22 -0
- package/core/dist/runtime-v2/adapter/principle-tree-ledger-adapter.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +7 -0
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +4 -0
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.d.ts +2 -0
- package/core/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.js +559 -0
- package/core/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.js.map +1 -0
- package/core/dist/runtime-v2/owner-decision/owner-decision-view-contract.d.ts +7868 -0
- package/core/dist/runtime-v2/owner-decision/owner-decision-view-contract.d.ts.map +1 -0
- package/core/dist/runtime-v2/owner-decision/owner-decision-view-contract.js +367 -0
- package/core/dist/runtime-v2/owner-decision/owner-decision-view-contract.js.map +1 -0
- package/core/dist/runtime-v2/owner-decision/owner-decision-view.d.ts +415 -0
- package/core/dist/runtime-v2/owner-decision/owner-decision-view.d.ts.map +1 -0
- package/core/dist/runtime-v2/owner-decision/owner-decision-view.js +856 -0
- package/core/dist/runtime-v2/owner-decision/owner-decision-view.js.map +1 -0
- package/core/dist/runtime-v2/owner-decision/semantic-selector.d.ts +72 -0
- package/core/dist/runtime-v2/owner-decision/semantic-selector.d.ts.map +1 -0
- package/core/dist/runtime-v2/owner-decision/semantic-selector.js +176 -0
- package/core/dist/runtime-v2/owner-decision/semantic-selector.js.map +1 -0
- package/package.json +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.d.ts +14 -0
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js +47 -7
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/pd-cli/dist/services/rulehost-pipeline-runner.d.ts +84 -0
- package/pd-cli/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/rulehost-pipeline-runner.js +215 -38
- package/pd-cli/dist/services/rulehost-pipeline-runner.js.map +1 -1
- package/plugin/dist/bundle.js +526 -526
- package/plugin/dist/governance-audit.js +205 -205
- package/plugin/dist/rulehost-evidence.js +246 -246
- package/release-manager/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owner Decision Experience v1 — canonical Owner-facing read endpoints
|
|
3
|
+
* (SPEC §15). Read-only: the Owner decision projection never mutates; the
|
|
4
|
+
* approval/activation mutation services remain the final write authority.
|
|
5
|
+
*
|
|
6
|
+
* GET /api/v1/principles/owner-decision-inbox (static; dispatch before /:id)
|
|
7
|
+
* GET /api/v1/principles/:id/owner-decision-view
|
|
8
|
+
*
|
|
9
|
+
* Both ride the existing `principle_governance_projection_v2` flag (no new
|
|
10
|
+
* runtime flag, SPEC §16) and reuse the route family's auth/workspace
|
|
11
|
+
* isolation. Security (SPEC §15/§31): fixed error messages never echo the
|
|
12
|
+
* requested id or target back to the caller.
|
|
13
|
+
*/
|
|
14
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
15
|
+
export interface OwnerDecisionRouteParams {
|
|
16
|
+
req: IncomingMessage;
|
|
17
|
+
res: ServerResponse;
|
|
18
|
+
workspaceDir: string;
|
|
19
|
+
featureFlags?: Record<string, {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
now: () => string;
|
|
23
|
+
}
|
|
24
|
+
/** GET /api/v1/principles/owner-decision-inbox */
|
|
25
|
+
export declare function handleOwnerDecisionInboxRoute(params: OwnerDecisionRouteParams): Promise<void>;
|
|
26
|
+
/** GET /api/v1/principles/owner-decision-library — compact titles/states for the Library list (§11.2). */
|
|
27
|
+
export declare function handleOwnerDecisionLibraryRoute(params: OwnerDecisionRouteParams): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Parses `/:id/owner-decision-view` sub paths. Returns the decoded principle
|
|
30
|
+
* id, or null when the sub path is not this route (caller continues routing),
|
|
31
|
+
* or 'invalid' when the id cannot be URL-decoded.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseOwnerDecisionViewSubPath(subPath: string): string | null | 'invalid';
|
|
34
|
+
/**
|
|
35
|
+
* GET /api/v1/principles/:id/owner-decision-view.
|
|
36
|
+
* Returns false when the sub path does not match (caller continues routing).
|
|
37
|
+
*/
|
|
38
|
+
export declare function handleOwnerDecisionViewRoute(params: OwnerDecisionRouteParams & {
|
|
39
|
+
subPath: string;
|
|
40
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { OwnerDecisionViewModel } from '../models/OwnerDecisionViewModel.js';
|
|
2
|
+
import { GovernanceProjectionCollectionError } from '../models/GovernanceProjectionCollector.js';
|
|
3
|
+
import { sendSuccess, sendError } from '../utils/response.js';
|
|
4
|
+
function featureDisabled(res) {
|
|
5
|
+
sendError(res, 403, 'feature_disabled', 'Owner decision projection is disabled.', { reason: 'feature_disabled', nextAction: 'Enable features.principle_governance_projection_v2 in .pd/config.yaml.' });
|
|
6
|
+
}
|
|
7
|
+
/** GET /api/v1/principles/owner-decision-inbox */
|
|
8
|
+
export async function handleOwnerDecisionInboxRoute(params) {
|
|
9
|
+
const { res, workspaceDir, featureFlags, now } = params;
|
|
10
|
+
if (featureFlags?.principle_governance_projection_v2?.enabled !== true) {
|
|
11
|
+
featureDisabled(res);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
const inbox = await new OwnerDecisionViewModel(workspaceDir).getInbox(now());
|
|
16
|
+
sendSuccess(res, inbox);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
sendError(res, 500, 'owner_decision_inbox_error', error instanceof Error ? error.message : String(error), { nextAction: 'inspect_runtime_state' });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** GET /api/v1/principles/owner-decision-library — compact titles/states for the Library list (§11.2). */
|
|
23
|
+
export async function handleOwnerDecisionLibraryRoute(params) {
|
|
24
|
+
const { res, workspaceDir, featureFlags, now } = params;
|
|
25
|
+
if (featureFlags?.principle_governance_projection_v2?.enabled !== true) {
|
|
26
|
+
featureDisabled(res);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const library = await new OwnerDecisionViewModel(workspaceDir).getLibraryCompact(now());
|
|
31
|
+
sendSuccess(res, library);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
sendError(res, 500, 'owner_decision_library_error', error instanceof Error ? error.message : String(error), { nextAction: 'inspect_runtime_state' });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Parses `/:id/owner-decision-view` sub paths. Returns the decoded principle
|
|
39
|
+
* id, or null when the sub path is not this route (caller continues routing),
|
|
40
|
+
* or 'invalid' when the id cannot be URL-decoded.
|
|
41
|
+
*/
|
|
42
|
+
export function parseOwnerDecisionViewSubPath(subPath) {
|
|
43
|
+
const segments = subPath.split('/').filter((segment) => segment !== '');
|
|
44
|
+
if (segments.length !== 2 || segments[1] !== 'owner-decision-view')
|
|
45
|
+
return null;
|
|
46
|
+
const raw = segments[0] ?? '';
|
|
47
|
+
try {
|
|
48
|
+
const decoded = decodeURIComponent(raw);
|
|
49
|
+
return decoded.length === 0 ? 'invalid' : decoded;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return 'invalid';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* GET /api/v1/principles/:id/owner-decision-view.
|
|
57
|
+
* Returns false when the sub path does not match (caller continues routing).
|
|
58
|
+
*/
|
|
59
|
+
export async function handleOwnerDecisionViewRoute(params) {
|
|
60
|
+
const { res, workspaceDir, featureFlags, now, subPath } = params;
|
|
61
|
+
const principleId = parseOwnerDecisionViewSubPath(subPath);
|
|
62
|
+
if (principleId === null)
|
|
63
|
+
return false;
|
|
64
|
+
if (featureFlags?.principle_governance_projection_v2?.enabled !== true) {
|
|
65
|
+
featureDisabled(res);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
if (principleId === 'invalid') {
|
|
69
|
+
sendError(res, 400, 'invalid_principle_id', 'Principle ID is missing or has invalid URL encoding', { nextAction: 'Provide a non-empty, correctly encoded principle ID.' });
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const view = await new OwnerDecisionViewModel(workspaceDir).getView(principleId, now());
|
|
74
|
+
sendSuccess(res, view);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (error instanceof GovernanceProjectionCollectionError && error.reasonCode === 'principle_not_found') {
|
|
78
|
+
sendError(res, 404, 'principle_not_found', 'Principle not found', { nextAction: 'Check the principle ID.' });
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
if (error instanceof Error && error.message === 'principle_not_found') {
|
|
82
|
+
sendError(res, 404, 'principle_not_found', 'Principle not found', { nextAction: 'Check the principle ID.' });
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
sendError(res, 500, 'owner_decision_view_error', error instanceof Error ? error.message : String(error), { nextAction: 'inspect_runtime_state' });
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
@@ -6,6 +6,9 @@ import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
|
6
6
|
* DB read). Dispatched in server/index.ts BEFORE the `/api/principles`
|
|
7
7
|
* catch-all so `core` is never parsed as `/:id`; the `/api/v1/principles`
|
|
8
8
|
* mount intentionally does NOT expose this endpoint.
|
|
9
|
+
*
|
|
10
|
+
* Owner Decision Experience v1: the canonical Owner decision read endpoints
|
|
11
|
+
* live in routes/owner-decision.ts and dispatch from handlePrinciplesRoute.
|
|
9
12
|
*/
|
|
10
13
|
export declare function handleCorePrinciplesRoute(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
11
14
|
interface PrinciplesRouteParams {
|
|
@@ -23,6 +23,9 @@ function getModel(workspaceDir) {
|
|
|
23
23
|
* DB read). Dispatched in server/index.ts BEFORE the `/api/principles`
|
|
24
24
|
* catch-all so `core` is never parsed as `/:id`; the `/api/v1/principles`
|
|
25
25
|
* mount intentionally does NOT expose this endpoint.
|
|
26
|
+
*
|
|
27
|
+
* Owner Decision Experience v1: the canonical Owner decision read endpoints
|
|
28
|
+
* live in routes/owner-decision.ts and dispatch from handlePrinciplesRoute.
|
|
26
29
|
*/
|
|
27
30
|
export async function handleCorePrinciplesRoute(req, res) {
|
|
28
31
|
if (req.method !== 'GET') {
|
package/console/dist/ui/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ApiResponse } from "../types.js";
|
|
2
|
-
import type { OwnerDecisionsData, OwnerResolutionResultData } from "./utils/validators.js";
|
|
3
|
-
import type { GovernanceExperienceSnapshot, OwnerGovernanceView } from '@principles/core/runtime-v2';
|
|
2
|
+
import type { OwnerDecisionsData, OwnerResolutionResultData, OwnerDecisionInboxData, OwnerDecisionLibraryData } from "./utils/validators.js";
|
|
3
|
+
import type { GovernanceExperienceSnapshot, OwnerGovernanceView, OwnerDecisionViewCore } from '@principles/core/runtime-v2';
|
|
4
4
|
import type { OwnerIdentityViewData, OwnerIdentityRegisterData, OwnerIdentityUnregisterData } from "./utils/validators.js";
|
|
5
5
|
import type { FeedbackReportData, FeedbackDraftSummaryData, FeedbackDraftEnvelopeData, FeedbackChannelsData, FeedbackSubmitResultData, DeleteEnvelopeData, WorkspaceEntryData, RemovedEnvelopeData, SyncResultData, ConfigSummaryData, ConfigCatalogData, AgentBindingUpdateData, DefaultRuntimeUpdateData, RuntimeProfileMutationData, ReadinessCheckData, FeatureFlagUpdateData, OutputLanguageData, GovernanceQueueData, RecoveryResultData, FailedTaskDetailData, ActivationsData, DisableActivationData, LifecycleMetricsData, UpdateStatusData, UpdateHistoryData, ApplyUpdateResultData, ApprovalRecordData, PrinciplesListData, CorePrinciplesData, ApprovalsGroupedData, EvidenceChainData, TrajectoryData, IntentSummaryData, IntentDecisionRecordData, IntentDecisionResultData, IntentDecisionSummaryData, FollowUpResponseData, IntentInitResultData, IntentSaveResultData, IntentRawContentData, IntentVersionData, RuleCodeOwnerReviewData, RuleCodeMutationData } from "./utils/validators.js";
|
|
6
6
|
declare function getToken(): string | null;
|
|
@@ -48,6 +48,9 @@ declare function fetchPrinciples(filter?: 'all' | 'actionable'): Promise<ApiResp
|
|
|
48
48
|
declare function fetchCorePrinciples(): Promise<ApiResponse<CorePrinciplesData>>;
|
|
49
49
|
declare function fetchPrincipleDetail(principleId: string): Promise<ApiResponse<unknown>>;
|
|
50
50
|
declare function fetchPrincipleGovernance(principleId: string): Promise<ApiResponse<OwnerGovernanceView>>;
|
|
51
|
+
declare function fetchOwnerDecisionView(principleId: string): Promise<ApiResponse<OwnerDecisionViewCore>>;
|
|
52
|
+
declare function fetchOwnerDecisionInbox(): Promise<ApiResponse<OwnerDecisionInboxData>>;
|
|
53
|
+
declare function fetchOwnerDecisionLibrary(): Promise<ApiResponse<OwnerDecisionLibraryData>>;
|
|
51
54
|
declare function archivePrinciple(principleId: string): Promise<ApiResponse<unknown>>;
|
|
52
55
|
declare function unarchivePrinciple(principleId: string): Promise<ApiResponse<unknown>>;
|
|
53
56
|
declare function fetchPrincipleTrajectory(principleId: string): Promise<ApiResponse<TrajectoryData>>;
|
|
@@ -248,9 +251,10 @@ export interface FollowUpPayload {
|
|
|
248
251
|
candidateId?: string;
|
|
249
252
|
}
|
|
250
253
|
declare function dispatchFollowUp(decisionId: string, payload: FollowUpPayload): Promise<ApiResponse<FollowUpResponseData>>;
|
|
251
|
-
export { request, getToken, setToken, clearToken, checkAuth, approveApproval, rejectApproval, editApproval, fetchPrinciples, fetchCorePrinciples, fetchPrincipleDetail, fetchPrincipleGovernance, fetchPrincipleTrajectory, fetchPrincipleReceipts, fetchReceiptCounts, archivePrinciple, unarchivePrinciple, createFeedbackReport, listFeedbackReports, getFeedbackReport, deleteFeedbackReport, fetchFeedbackChannels, submitFeedbackReport, markFeedbackReportSent, fetchConfigSummary, fetchConfigCatalog, updateAgentBinding, updateDefaultRuntime, createRuntimeProfile, updateRuntimeProfile, deleteRuntimeProfile, fetchAgentReadiness, patchFeatureFlag, fetchOutputLanguage, updateOutputLanguage, fetchWorkspaces, addWorkspace, removeWorkspace, syncWorkspace, fetchGovernanceQueue, fetchGovernanceExperience, recoverFailedTask, fetchFailedTaskDetail, fetchOwnerDecisions, resolveOwnerDecision, fetchApprovalsGrouped, fetchAllActivations, disableActivation, fetchRuleCodeOwnerReview, ruleCodeDecision, pauseAllRuleCode, releaseRuleCodePause, fetchLifecycleMetrics, fetchUpdateStatus, fetchUpdateHistory, applyFullUpdate, fetchEvidenceChain, fetchIntentSummary, fetchIntentContent, createIntentTemplate, saveIntentContent, fetchIntentVersions, recordIntentDecision, listIntentDecisionsByPainId, listIntentDecisionsByTaskId, fetchIntentDecisionSummary, dispatchFollowUp, };
|
|
254
|
+
export { request, getToken, setToken, clearToken, checkAuth, approveApproval, rejectApproval, editApproval, fetchPrinciples, fetchCorePrinciples, fetchPrincipleDetail, fetchPrincipleGovernance, fetchOwnerDecisionView, fetchOwnerDecisionInbox, fetchOwnerDecisionLibrary, fetchPrincipleTrajectory, fetchPrincipleReceipts, fetchReceiptCounts, archivePrinciple, unarchivePrinciple, createFeedbackReport, listFeedbackReports, getFeedbackReport, deleteFeedbackReport, fetchFeedbackChannels, submitFeedbackReport, markFeedbackReportSent, fetchConfigSummary, fetchConfigCatalog, updateAgentBinding, updateDefaultRuntime, createRuntimeProfile, updateRuntimeProfile, deleteRuntimeProfile, fetchAgentReadiness, patchFeatureFlag, fetchOutputLanguage, updateOutputLanguage, fetchWorkspaces, addWorkspace, removeWorkspace, syncWorkspace, fetchGovernanceQueue, fetchGovernanceExperience, recoverFailedTask, fetchFailedTaskDetail, fetchOwnerDecisions, resolveOwnerDecision, fetchApprovalsGrouped, fetchAllActivations, disableActivation, fetchRuleCodeOwnerReview, ruleCodeDecision, pauseAllRuleCode, releaseRuleCodePause, fetchLifecycleMetrics, fetchUpdateStatus, fetchUpdateHistory, applyFullUpdate, fetchEvidenceChain, fetchIntentSummary, fetchIntentContent, createIntentTemplate, saveIntentContent, fetchIntentVersions, recordIntentDecision, listIntentDecisionsByPainId, listIntentDecisionsByTaskId, fetchIntentDecisionSummary, dispatchFollowUp, };
|
|
252
255
|
export type { FeedbackReportData, FeedbackDraftSummaryData, FeedbackDraftEnvelopeData, FeedbackChannelsData, FeedbackSubmitResultData, DeleteEnvelopeData, WorkspaceEntryData, RemovedEnvelopeData, SyncResultData, ConfigSummaryData, ConfigCatalogData, AgentBindingUpdateData, DefaultRuntimeUpdateData, RuntimeProfileMutationData, ReadinessCheckData, FeatureFlagUpdateData, OutputLanguageData, GovernanceQueueData, RecoveryResultData, ActivationsData, DisableActivationData, RuleCodeOwnerReviewData, RuleCodeMutationData, FailedTaskDetailData, LifecycleMetricsData, UpdateStatusData, UpdateHistoryData, ApplyUpdateResultData, ApprovalRecordData, PrinciplesListData, CorePrinciplesData, CorePrincipleData, ApprovalsGroupedData, EvidenceChainData, EvidenceChainRecordData, EvidenceChainStateData, TrajectoryData, TrajectoryStageData, IntentSummaryData, IntentSectionsData, IntentDocWarningData, IntentDecisionRecordData, IntentDecisionResultData, IntentDecisionSummaryData, FollowUpResponseData, LinkCandidateFollowUpData, GuideRulehostFollowUpData, GeneratePatchProposalFollowUpData, IntentVersionEntry, IntentVersionData, } from "./utils/validators.js";
|
|
253
256
|
export type { ActivationRecordData as ActivationRecord } from "./utils/validators.js";
|
|
257
|
+
export type { OwnerDecisionInboxData, OwnerDecisionLibraryData } from "./utils/validators.js";
|
|
254
258
|
export type { ApprovalRecordData as ApprovalRecord } from "./utils/validators.js";
|
|
255
259
|
export type { WorkspaceEntryData as WorkspaceEntry } from "./utils/validators.js";
|
|
256
260
|
export type { PrincipleListItemData as PrincipleListItem } from "./utils/validators.js";
|
package/console/dist/ui/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clearStoredToken, loadStoredToken, storeToken } from "./utils/token-storage.js";
|
|
2
|
-
import { validateErrorResponse, validateHeaders, validateFeedbackReport, validateFeedbackDraftsList, validateFeedbackDraftEnvelope, validateFeedbackChannels, validateFeedbackSubmitResult, validateDeleteEnvelope, validateWorkspaceEntry, validateWorkspaceList, validateRemovedEnvelope, validateSyncResult, validateConfigSummary, validateConfigCatalog, validateAgentBindingUpdate, validateDefaultRuntimeUpdate, validateRuntimeProfileMutation, validateReadinessCheck, validateFeatureFlagUpdate, validateOutputLanguage, validateGovernanceQueue, validateRecoveryResult, validateFailedTaskDetail, validateOwnerDecisionsData, validateOwnerResolutionResult, validateActivations, validateDisableActivation, validateLifecycleMetrics, validateUpdateStatus, validateUpdateHistory, validateApplyUpdateResult, validateApprovalRecordDirect, validatePrinciplesList, validateCorePrinciples, validateApprovalsGrouped, validateEvidenceChain, validateTrajectoryData, validateIntentSummary, validateIntentDecisionList, validateIntentDecisionResult, validateIntentDecisionSummary, validateFollowUpResponse, validateIntentInitResult, validateIntentSaveResult, validateIntentRawContent, validateIntentVersions, validateOwnerGovernanceView, validateGovernanceExperienceSnapshot, validateRuleCodeOwnerReview, validateRuleCodeMutation, validateOwnerIdentityView, validateOwnerIdentityRegister, validateOwnerIdentityUnregister, } from "./utils/validators.js";
|
|
2
|
+
import { validateErrorResponse, validateHeaders, validateFeedbackReport, validateFeedbackDraftsList, validateFeedbackDraftEnvelope, validateFeedbackChannels, validateFeedbackSubmitResult, validateDeleteEnvelope, validateWorkspaceEntry, validateWorkspaceList, validateRemovedEnvelope, validateSyncResult, validateConfigSummary, validateConfigCatalog, validateAgentBindingUpdate, validateDefaultRuntimeUpdate, validateRuntimeProfileMutation, validateReadinessCheck, validateFeatureFlagUpdate, validateOutputLanguage, validateGovernanceQueue, validateRecoveryResult, validateFailedTaskDetail, validateOwnerDecisionsData, validateOwnerResolutionResult, validateActivations, validateDisableActivation, validateLifecycleMetrics, validateUpdateStatus, validateUpdateHistory, validateApplyUpdateResult, validateApprovalRecordDirect, validatePrinciplesList, validateCorePrinciples, validateApprovalsGrouped, validateEvidenceChain, validateTrajectoryData, validateIntentSummary, validateIntentDecisionList, validateIntentDecisionResult, validateIntentDecisionSummary, validateFollowUpResponse, validateIntentInitResult, validateIntentSaveResult, validateIntentRawContent, validateIntentVersions, validateOwnerGovernanceView, validateOwnerDecisionViewCore, validateOwnerDecisionInbox, validateOwnerDecisionLibrary, validateGovernanceExperienceSnapshot, validateRuleCodeOwnerReview, validateRuleCodeMutation, validateOwnerIdentityView, validateOwnerIdentityRegister, validateOwnerIdentityUnregister, } from "./utils/validators.js";
|
|
3
3
|
// ── Auth ──────────────────────────────────────────────────────────────────────
|
|
4
4
|
function getToken() {
|
|
5
5
|
// PRI-793: localStorage-backed (with one-time migration from the legacy
|
|
@@ -160,6 +160,17 @@ async function fetchPrincipleDetail(principleId) {
|
|
|
160
160
|
async function fetchPrincipleGovernance(principleId) {
|
|
161
161
|
return request(`/api/v1/principles/${encodeURIComponent(principleId)}/governance`, undefined, validateOwnerGovernanceView);
|
|
162
162
|
}
|
|
163
|
+
// Owner Decision Experience v1 (SPEC §15): canonical Owner-facing decision
|
|
164
|
+
// projection for the Detail first layer + compact Inbox. Read-only.
|
|
165
|
+
async function fetchOwnerDecisionView(principleId) {
|
|
166
|
+
return request(`/api/v1/principles/${encodeURIComponent(principleId)}/owner-decision-view`, undefined, validateOwnerDecisionViewCore);
|
|
167
|
+
}
|
|
168
|
+
async function fetchOwnerDecisionInbox() {
|
|
169
|
+
return request('/api/v1/principles/owner-decision-inbox', undefined, validateOwnerDecisionInbox);
|
|
170
|
+
}
|
|
171
|
+
async function fetchOwnerDecisionLibrary() {
|
|
172
|
+
return request('/api/v1/principles/owner-decision-library', undefined, validateOwnerDecisionLibrary);
|
|
173
|
+
}
|
|
163
174
|
async function archivePrinciple(principleId) {
|
|
164
175
|
return request(`/api/principles/${encodeURIComponent(principleId)}/archive`, {
|
|
165
176
|
method: "POST",
|
|
@@ -606,6 +617,6 @@ async function dispatchFollowUp(decisionId, payload) {
|
|
|
606
617
|
// ── Exports ───────────────────────────────────────────────────────────────────
|
|
607
618
|
export { request,
|
|
608
619
|
// auth
|
|
609
|
-
getToken, setToken, clearToken, checkAuth, approveApproval, rejectApproval, editApproval, fetchPrinciples, fetchCorePrinciples, fetchPrincipleDetail, fetchPrincipleGovernance, fetchPrincipleTrajectory, fetchPrincipleReceipts, fetchReceiptCounts, archivePrinciple, unarchivePrinciple, createFeedbackReport, listFeedbackReports, getFeedbackReport, deleteFeedbackReport,
|
|
620
|
+
getToken, setToken, clearToken, checkAuth, approveApproval, rejectApproval, editApproval, fetchPrinciples, fetchCorePrinciples, fetchPrincipleDetail, fetchPrincipleGovernance, fetchOwnerDecisionView, fetchOwnerDecisionInbox, fetchOwnerDecisionLibrary, fetchPrincipleTrajectory, fetchPrincipleReceipts, fetchReceiptCounts, archivePrinciple, unarchivePrinciple, createFeedbackReport, listFeedbackReports, getFeedbackReport, deleteFeedbackReport,
|
|
610
621
|
// Feedback submit ladder (Slice 3, spec §8)
|
|
611
622
|
fetchFeedbackChannels, submitFeedbackReport, markFeedbackReportSent, fetchConfigSummary, fetchConfigCatalog, updateAgentBinding, updateDefaultRuntime, createRuntimeProfile, updateRuntimeProfile, deleteRuntimeProfile, fetchAgentReadiness, patchFeatureFlag, fetchOutputLanguage, updateOutputLanguage, fetchWorkspaces, addWorkspace, removeWorkspace, syncWorkspace, fetchGovernanceQueue, fetchGovernanceExperience, recoverFailedTask, fetchFailedTaskDetail, fetchOwnerDecisions, resolveOwnerDecision, fetchApprovalsGrouped, fetchAllActivations, disableActivation, fetchRuleCodeOwnerReview, ruleCodeDecision, pauseAllRuleCode, releaseRuleCodePause, fetchLifecycleMetrics, fetchUpdateStatus, fetchUpdateHistory, applyFullUpdate, fetchEvidenceChain, fetchIntentSummary, fetchIntentContent, createIntentTemplate, saveIntentContent, fetchIntentVersions, recordIntentDecision, listIntentDecisionsByPainId, listIntentDecisionsByTaskId, fetchIntentDecisionSummary, dispatchFollowUp, };
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"warning": "Warning",
|
|
28
28
|
"info": "Info",
|
|
29
29
|
"total": "Total",
|
|
30
|
-
"active": "
|
|
30
|
+
"active": "Approved",
|
|
31
31
|
"inactive": "Inactive",
|
|
32
32
|
"pending": "Pending",
|
|
33
33
|
"completed": "Completed",
|
|
@@ -271,6 +271,14 @@
|
|
|
271
271
|
"zeroStateHealthy": "No items need your judgment right now. PD has checked behavior evidence, principle review queue, and system signals.",
|
|
272
272
|
"zeroStateDbMissing": "PD has not run in this workspace yet. Once the state database is initialized, governance data will appear here.",
|
|
273
273
|
"evidenceInProgress": "{{count}} behavior evidence item(s) recorded, being diagnosed and processed.",
|
|
274
|
+
"ownerInbox": {
|
|
275
|
+
"group": { "subjectMaterial": "Material for this decision (scoped to its own revision — no text borrowed from other revisions)",
|
|
276
|
+
"decision": "Needs decision", "blocked": "Blocked", "recovery": "Needs recovery" },
|
|
277
|
+
"sectionTitle": "Principle decisions",
|
|
278
|
+
"loadError": "Principle decision updates are temporarily unavailable.",
|
|
279
|
+
"empty": "No confirmed pending, blocked, or recovery-needed principle items right now.",
|
|
280
|
+
"viewLibrary": "View the principle library →"
|
|
281
|
+
},
|
|
274
282
|
"ownerDecision": {
|
|
275
283
|
"evidenceUnavailable": "This decision still needs you, but its evidence chain is incomplete. PD has paused all decision actions so you cannot approve the wrong version.",
|
|
276
284
|
"goRecoverCta": "View recovery details",
|
|
@@ -546,6 +554,7 @@
|
|
|
546
554
|
"blockBasis": "Formation Basis",
|
|
547
555
|
"blockBasisFallback": "This principle was distilled from historical behavior calibration. Its detailed source is not yet linked.",
|
|
548
556
|
"blockImpact": "Current Impact",
|
|
557
|
+
"blockImpactSeeDecisionView": "Whether this currently shapes behavior is shown on the detail page under current enforcement — this card does not assert impact from lifecycle status alone.",
|
|
549
558
|
"blockImpactActive": "This principle is currently shaping the Agent's subsequent behavior.",
|
|
550
559
|
"blockImpactPending": "Not yet active — awaiting Owner confirmation.",
|
|
551
560
|
"blockImpactRejected": "Rejected by Owner — no longer shapes the Agent's behavior.",
|
|
@@ -573,6 +582,17 @@
|
|
|
573
582
|
"channelDeferArchive": "Defer Archive",
|
|
574
583
|
"channelCodeToolHook": "Code Tool Hook",
|
|
575
584
|
"confidence": "Confidence",
|
|
585
|
+
"evaluabilityLabel": "Evaluability",
|
|
586
|
+
"ownerDecision": {
|
|
587
|
+
"state": {
|
|
588
|
+
"needs_owner_decision": "Needs your decision",
|
|
589
|
+
"processing": "Processing",
|
|
590
|
+
"blocked": "Judgment unavailable",
|
|
591
|
+
"recovery_needed": "Needs recovery",
|
|
592
|
+
"decided": "Decided",
|
|
593
|
+
"no_action": "No action needed"
|
|
594
|
+
}
|
|
595
|
+
},
|
|
576
596
|
"languageHintEn": "Generated in English",
|
|
577
597
|
"languageHintZh": "Generated in Chinese",
|
|
578
598
|
"languageHintUnknown": "Language unknown",
|
|
@@ -614,7 +634,7 @@
|
|
|
614
634
|
"reflectionQ3": "If it's wrong, do I know how to roll it back?",
|
|
615
635
|
"receipts": {
|
|
616
636
|
"title": "Receipt History",
|
|
617
|
-
"headline": "
|
|
637
|
+
"headline": "{{effectCount}} behavior-influence record(s) retained (last {{lastEffectAt}}) — historical observations, not a claim of current enforcement",
|
|
618
638
|
"headlinePresence": "Your principle is part of the agent's decision context — no recorded behavior effect yet",
|
|
619
639
|
"counts": "{{effectCount}} behavior effect(s) · {{presenceCount}} context injection(s)",
|
|
620
640
|
"zeroEffect": "Why 0 effects? Effects need evidence: a block, an auto-correction, or an agent self-report. So far this principle has only entered task context (Presence). Being present in a decision does not mean behavior changed — the first effect record will appear here as runtime evidence accumulates.",
|
|
@@ -714,7 +734,7 @@
|
|
|
714
734
|
"automationState": { "idle": "Idle", "queued": "Queued", "running": "Running", "retry_scheduled": "Retry scheduled", "stalled": "Stalled" },
|
|
715
735
|
"headline": {
|
|
716
736
|
"owner_decision": "Your decision is needed",
|
|
717
|
-
"recovery": "
|
|
737
|
+
"recovery": "Recovery processing is needed",
|
|
718
738
|
"revision": "PD is revising this principle",
|
|
719
739
|
"processing": "PD is processing this principle",
|
|
720
740
|
"active": "This principle is active",
|
|
@@ -732,7 +752,7 @@
|
|
|
732
752
|
},
|
|
733
753
|
"next": {
|
|
734
754
|
"review": "Review the existing approval actions below.",
|
|
735
|
-
"inspect_recovery": "
|
|
755
|
+
"inspect_recovery": "A historical processing issue exists; inspect recovery info first — its relation to the current action is unconfirmed, and any decision should rely on the decision view.",
|
|
736
756
|
"wait": "No action is needed now. Wait for PD to finish the current work.",
|
|
737
757
|
"monitor": "No action is needed. Monitor the active behavior channel.",
|
|
738
758
|
"inspect_data": "Inspect the evidence diagnostics and repair the referenced durable record.",
|
|
@@ -770,6 +790,52 @@
|
|
|
770
790
|
"failed": "Runtime task failed",
|
|
771
791
|
"human_review": "Human recovery review requested"
|
|
772
792
|
}
|
|
793
|
+
},
|
|
794
|
+
"ownerDecision": {
|
|
795
|
+
"title": "Decision view for this principle",
|
|
796
|
+
"technicalOriginalNote": "The text above is the original technical recommendation; no readable principle statement is available yet (kept verbatim for traceability).",
|
|
797
|
+
"state": {
|
|
798
|
+
"needs_owner_decision": "A decision is waiting for your review",
|
|
799
|
+
"processing": "The system is processing this proposal",
|
|
800
|
+
"blocked": "The system cannot establish a complete governance judgment yet",
|
|
801
|
+
"recovery_needed": "This processing needs recovery",
|
|
802
|
+
"decided": "This proposal already has a completed decision",
|
|
803
|
+
"no_action": "Nothing needs your decision right now"
|
|
804
|
+
},
|
|
805
|
+
"readsComplete": "All requested sources were read",
|
|
806
|
+
"readsPartial": "Some sources failed to read",
|
|
807
|
+
"incident": "What happened",
|
|
808
|
+
"learned": "The behavior principle the agent learned",
|
|
809
|
+
"sourceTier": "Source: {{tier}} (verbatim)",
|
|
810
|
+
"rationale": "Why PD judged it this way",
|
|
811
|
+
"applicability": "When it applies",
|
|
812
|
+
"expected": "What changes if approved (proposed, not deployed)",
|
|
813
|
+
"enforcementLabel": "Current enforcement",
|
|
814
|
+
"tier": { "scribe": "Formal draft (Scribe)", "distiller": "Abstracted principle (Distiller)", "philosopher": "Candidate principle (Philosopher)", "candidate_principle": "Original recommendation" },
|
|
815
|
+
"enforcement": {
|
|
816
|
+
"active": "An enforcement method is currently active (see details below).",
|
|
817
|
+
"deactivated": "The previous enforcement method is deactivated; nothing is enforcing right now.",
|
|
818
|
+
"partial": "Some enforcement methods are still running (see details below).",
|
|
819
|
+
"none": "No enforcement method is active for this principle.",
|
|
820
|
+
"since": "Active (since {{since}})",
|
|
821
|
+
"stopped": "Deactivated"
|
|
822
|
+
},
|
|
823
|
+
"evidence": "Behavior evidence",
|
|
824
|
+
"uncertainty": "Risks and uncertainty",
|
|
825
|
+
"riskNotAssessed": "No risk assessment has been done; that does not mean there are no risks.",
|
|
826
|
+
"rollback": "How to stop its influence",
|
|
827
|
+
"decision": "Your decision",
|
|
828
|
+
"history": "Decision history",
|
|
829
|
+
"historyState": { "approved": "Approved", "rejected": "Rejected", "cancelled": "Cancelled", "pending": "Pending" },
|
|
830
|
+
"channel": { "prompt": "context guidance channel", "code_tool_hook": "RuleCode enforcement channel", "defer_archive": "archive channel" },
|
|
831
|
+
"actionLabel": { "approve": "Approve", "reject": "Reject", "edit_approval": "Replace approval artifact", "disable": "Stop this enforcement going forward" },
|
|
832
|
+
"next": { "review": "A decision is waiting for your review: read the material above, then approve or reject.", "wait": "The system is processing this proposal; please wait.", "inspect_data": "The system cannot establish a complete governance judgment yet.", "inspect_recovery": "This processing has a historical issue; recovery info can be inspected.", "monitor": "This proposal already has a completed decision. Review its enforcement and behavior records.", "none": "Nothing needs your decision right now." },
|
|
833
|
+
"blocker": { "decision_material_missing": "This subject lacks the information needed for a safe approval; rejection can still be evaluated separately.", "lineage_not_available": "Governance identity is not established yet, so the system cannot tell whether your decision is needed.", "historical_processing_issue": "A historical processing issue exists; its relation to the current action is unconfirmed." },
|
|
834
|
+
"noActions": "No action is currently available.",
|
|
835
|
+
"unavailable": "The decision view is temporarily unavailable; do not decide based on this page alone.",
|
|
836
|
+
"invalidTarget": "Action target missing; cannot submit.",
|
|
837
|
+
"actionDone": "Submitted.",
|
|
838
|
+
"actionFailed": "Refused: {{detail}} Available actions were refreshed — decide again from the latest state."
|
|
773
839
|
}
|
|
774
840
|
}
|
|
775
841
|
},
|
|
@@ -271,6 +271,14 @@
|
|
|
271
271
|
"zeroStateHealthy": "当前没有需要你判断的事项。PD 已检查行为证据、原则审查队列和系统信号。",
|
|
272
272
|
"zeroStateDbMissing": "PD 尚未在此工作空间中运行。状态数据库初始化后,治理数据将在这里呈现。",
|
|
273
273
|
"evidenceInProgress": "{{count}} 条行为证据已记录,正在诊断和处理中。",
|
|
274
|
+
"ownerInbox": {
|
|
275
|
+
"group": { "subjectMaterial": "这项决定的材料(按修订隔离,不含其他修订的文本)",
|
|
276
|
+
"decision": "待决定", "blocked": "被阻塞", "recovery": "需要恢复" },
|
|
277
|
+
"sectionTitle": "原则决定动态",
|
|
278
|
+
"loadError": "决定动态暂时不可用。",
|
|
279
|
+
"empty": "当前没有已确认的待决定、被阻塞或需要恢复的原则事项。",
|
|
280
|
+
"viewLibrary": "查看原则库 →"
|
|
281
|
+
},
|
|
274
282
|
"ownerDecision": {
|
|
275
283
|
"evidenceUnavailable": "这项裁决仍在等待你,但证据链目前不完整。PD 已暂停所有裁决动作,避免你在看不到正确版本时做决定。",
|
|
276
284
|
"goRecoverCta": "查看恢复详情",
|
|
@@ -546,6 +554,7 @@
|
|
|
546
554
|
"blockBasis": "形成依据",
|
|
547
555
|
"blockBasisFallback": "该原则由历史行为校准沉淀而来,详细来源尚未关联。",
|
|
548
556
|
"blockImpact": "当前影响",
|
|
557
|
+
"blockImpactSeeDecisionView": "当前是否影响行为,以详情页「当前实际执行」为准(本卡片不据生命周期状态断言影响)。",
|
|
549
558
|
"blockImpactActive": "该原则正在影响智能体后续行为。",
|
|
550
559
|
"blockImpactPending": "尚未生效,等待拥有者确认。",
|
|
551
560
|
"blockImpactRejected": "拥有者已拒绝,不再影响智能体后续行为。",
|
|
@@ -573,6 +582,17 @@
|
|
|
573
582
|
"channelDeferArchive": "延迟归档",
|
|
574
583
|
"channelCodeToolHook": "Code Tool Hook",
|
|
575
584
|
"confidence": "置信度",
|
|
585
|
+
"evaluabilityLabel": "可评价性",
|
|
586
|
+
"ownerDecision": {
|
|
587
|
+
"state": {
|
|
588
|
+
"needs_owner_decision": "待你决定",
|
|
589
|
+
"processing": "处理中",
|
|
590
|
+
"blocked": "判断暂不可建立",
|
|
591
|
+
"recovery_needed": "需要恢复",
|
|
592
|
+
"decided": "已有决定",
|
|
593
|
+
"no_action": "无需决定"
|
|
594
|
+
}
|
|
595
|
+
},
|
|
576
596
|
"languageHintEn": "以英文生成",
|
|
577
597
|
"languageHintZh": "以中文生成",
|
|
578
598
|
"languageHintUnknown": "语言未知",
|
|
@@ -614,7 +634,7 @@
|
|
|
614
634
|
"reflectionQ3": "如果它错了,我是否知道如何回滚?",
|
|
615
635
|
"receipts": {
|
|
616
636
|
"title": "生效履历",
|
|
617
|
-
"headline": "
|
|
637
|
+
"headline": "保留记录中有 {{effectCount}} 次行为影响(最近 {{lastEffectAt}})——记录属历史观察,不代表当前仍在生效",
|
|
618
638
|
"headlinePresence": "原则已进入智能体决策上下文——尚无行为生效记录",
|
|
619
639
|
"counts": "行为生效 {{effectCount}} 次 · 参与上下文 {{presenceCount}} 次",
|
|
620
640
|
"zeroEffect": "为什么「行为生效」是 0?生效需要证据:一次拦截、一次自动纠正,或智能体自述遵循。目前这条原则只进入过任务上下文(Presence)——参与决策 ≠ 已改变行为。随着运行积累出第一条证据,「行为生效」会从这里开始计数。",
|
|
@@ -709,12 +729,12 @@
|
|
|
709
729
|
"derived": "推导",
|
|
710
730
|
"actionsNotAuthorized": "当前不需要拥有者决策。",
|
|
711
731
|
"confidence": { "strong": "有来源支撑", "degraded": "证据不完整" },
|
|
712
|
-
"state": { "candidate": "候选", "active": "
|
|
732
|
+
"state": { "candidate": "候选", "active": "已批准", "archived": "已归档", "deprecated": "已弃用", "probation": "观察中" },
|
|
713
733
|
"stage": { "generating": "生成中", "reviewing": "审查中", "revising": "修订中", "approval": "待审批", "activation": "激活中" },
|
|
714
734
|
"automationState": { "idle": "空闲", "queued": "已排队", "running": "运行中", "retry_scheduled": "已安排重试", "stalled": "已停滞" },
|
|
715
735
|
"headline": {
|
|
716
736
|
"owner_decision": "需要你的决策",
|
|
717
|
-
"recovery": "
|
|
737
|
+
"recovery": "存在待恢复的处理",
|
|
718
738
|
"revision": "PD 正在修订这条原则",
|
|
719
739
|
"processing": "PD 正在处理这条原则",
|
|
720
740
|
"active": "这条原则正在生效",
|
|
@@ -732,7 +752,7 @@
|
|
|
732
752
|
},
|
|
733
753
|
"next": {
|
|
734
754
|
"review": "使用下方现有审批操作完成审查。",
|
|
735
|
-
"inspect_recovery": "
|
|
755
|
+
"inspect_recovery": "存在历史处理问题;先查看恢复信息,其与当前操作的关系尚未确认,相关决定以决策视图为准。",
|
|
736
756
|
"wait": "当前无需操作,等待 PD 完成正在进行的工作。",
|
|
737
757
|
"monitor": "当前无需操作,继续观察生效通道。",
|
|
738
758
|
"inspect_data": "检查证据诊断,并修复所引用的持久化记录。",
|
|
@@ -770,6 +790,52 @@
|
|
|
770
790
|
"failed": "Runtime 任务失败",
|
|
771
791
|
"human_review": "已请求人工恢复审查"
|
|
772
792
|
}
|
|
793
|
+
},
|
|
794
|
+
"ownerDecision": {
|
|
795
|
+
"title": "这条原则的决策视图",
|
|
796
|
+
"technicalOriginalNote": "以上为原始技术建议文本;可读的行为准则暂缺(保留原文以保证可追溯)。",
|
|
797
|
+
"state": {
|
|
798
|
+
"needs_owner_decision": "有一项决定需要你审阅",
|
|
799
|
+
"processing": "系统正在处理这项提案",
|
|
800
|
+
"blocked": "系统暂时无法建立完整的治理判断",
|
|
801
|
+
"recovery_needed": "这项处理需要恢复",
|
|
802
|
+
"decided": "此提案已有完成的决定",
|
|
803
|
+
"no_action": "目前没有需要你决定的事项"
|
|
804
|
+
},
|
|
805
|
+
"readsComplete": "本次所需数据已读取",
|
|
806
|
+
"readsPartial": "部分数据源读取失败",
|
|
807
|
+
"incident": "发生了什么",
|
|
808
|
+
"learned": "智能体学到的行为准则",
|
|
809
|
+
"sourceTier": "来源:{{tier}}(未经改写)",
|
|
810
|
+
"rationale": "为什么这么判断",
|
|
811
|
+
"applicability": "什么时候适用",
|
|
812
|
+
"expected": "批准后会怎样(拟议行为,未部署)",
|
|
813
|
+
"enforcementLabel": "当前实际执行",
|
|
814
|
+
"tier": { "scribe": "正式原则草案(Scribe)", "distiller": "抽象原则(Distiller)", "philosopher": "候选原则(Philosopher)", "candidate_principle": "原始原则建议" },
|
|
815
|
+
"enforcement": {
|
|
816
|
+
"active": "当前有正在执行的生效方式(见下方明细)。",
|
|
817
|
+
"deactivated": "此前的执行方式已停用;当前没有正在执行的生效方式。",
|
|
818
|
+
"partial": "部分执行方式仍在运行(见下方明细)。",
|
|
819
|
+
"none": "这条原则当前没有生效中的执行方式。",
|
|
820
|
+
"since": "生效中(自 {{since}})",
|
|
821
|
+
"stopped": "已停用"
|
|
822
|
+
},
|
|
823
|
+
"evidence": "行为证据",
|
|
824
|
+
"uncertainty": "风险与不确定性",
|
|
825
|
+
"riskNotAssessed": "尚未做过风险评估;这不代表没有风险。",
|
|
826
|
+
"rollback": "如何停止影响",
|
|
827
|
+
"decision": "你的决定",
|
|
828
|
+
"history": "决定历史",
|
|
829
|
+
"historyState": { "approved": "已批准", "rejected": "已拒绝", "cancelled": "已取消", "pending": "待决定" },
|
|
830
|
+
"channel": { "prompt": "上下文提示通道", "code_tool_hook": "RuleCode 执行通道", "defer_archive": "归档通道" },
|
|
831
|
+
"actionLabel": { "approve": "批准", "reject": "拒绝", "edit_approval": "替换审批工件", "disable": "停止此执行方式今后的影响" },
|
|
832
|
+
"next": { "review": "有一项决定需要你审阅:请阅读上方说明后选择批准或拒绝。", "wait": "系统正在处理这项提案,请等待处理完成。", "inspect_data": "系统暂时无法建立完整的治理判断。", "inspect_recovery": "这项处理存在历史遗留问题;可查看恢复信息。", "monitor": "此提案已有完成的决定。可查看执行状态与行为记录。", "none": "目前没有需要你决定的事项。" },
|
|
833
|
+
"blocker": { "decision_material_missing": "这个对象缺少足够的信息让你安全地批准;拒绝仍可单独评估。", "lineage_not_available": "治理身份尚未建立,系统暂时无法判断是否需要你决定。", "historical_processing_issue": "存在历史处理问题,其与当前操作的关系尚未确认。" },
|
|
834
|
+
"noActions": "当前没有可以执行的操作。",
|
|
835
|
+
"unavailable": "决策视图暂时不可用,无法据此做决定。",
|
|
836
|
+
"invalidTarget": "动作目标缺失,无法提交。",
|
|
837
|
+
"actionDone": "操作已提交。",
|
|
838
|
+
"actionFailed": "操作被拒绝:{{detail}} 可用操作已刷新,请基于最新状态重新决定。"
|
|
773
839
|
}
|
|
774
840
|
}
|
|
775
841
|
},
|
|
@@ -10,7 +10,7 @@ import { DailyThoughtCard } from "../../components/focus/daily-thought-card.js";
|
|
|
10
10
|
import { ShinyText } from "../../components/ui/shiny-text.js";
|
|
11
11
|
import { fetchGovernanceQueue, fetchApprovalsGrouped, approveApproval, rejectApproval, editApproval, fetchAllActivations, fetchOwnerDecisions, } from "../../api.js";
|
|
12
12
|
import { OwnerDecisionCard } from "./OwnerDecisionCard.js";
|
|
13
|
-
import { fetchGovernanceExperience } from "../../api.js";
|
|
13
|
+
import { fetchGovernanceExperience, fetchOwnerDecisionInbox } from "../../api.js";
|
|
14
14
|
export function summarizeDecisionResults(results) {
|
|
15
15
|
const failures = results.filter((result) => !result.success);
|
|
16
16
|
const first = failures[0];
|
|
@@ -455,6 +455,10 @@ export function FocusPage({ featureFlags }) {
|
|
|
455
455
|
// PRI-629: 统一 Owner Inbox — 两种模式都加载 (决策与治理摘要模式正交)
|
|
456
456
|
const [ownerDecisionItems, setOwnerDecisionItems] = useState([]);
|
|
457
457
|
const [ownerDecisionError, setOwnerDecisionError] = useState(null);
|
|
458
|
+
// Owner Decision Experience v1: canonical decision inbox (3 groups + aggregate
|
|
459
|
+
// historical notice). Display-only; degradation is observable, never silent.
|
|
460
|
+
const [ownerInbox, setOwnerInbox] = useState(null);
|
|
461
|
+
const [ownerInboxError, setOwnerInboxError] = useState(null);
|
|
458
462
|
const loadData = useCallback(async () => {
|
|
459
463
|
setLoadingState("loading");
|
|
460
464
|
setErrorMessage(null);
|
|
@@ -515,6 +519,17 @@ export function FocusPage({ featureFlags }) {
|
|
|
515
519
|
setOwnerDecisionItems([]);
|
|
516
520
|
setOwnerDecisionError(decisionsResult.error ?? "Owner decisions unavailable");
|
|
517
521
|
}
|
|
522
|
+
// Owner Decision Experience v1 inbox: failure degrades observably (rc-9),
|
|
523
|
+
// never blocking the rest of the focus page.
|
|
524
|
+
const ownerInboxResult = await fetchOwnerDecisionInbox();
|
|
525
|
+
if (ownerInboxResult.success) {
|
|
526
|
+
setOwnerInbox(ownerInboxResult.data);
|
|
527
|
+
setOwnerInboxError(null);
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
setOwnerInbox(null);
|
|
531
|
+
setOwnerInboxError(ownerInboxResult.reason === 'feature_disabled' ? null : (ownerInboxResult.error ?? "Owner decision inbox unavailable"));
|
|
532
|
+
}
|
|
518
533
|
setLoadingState("loaded");
|
|
519
534
|
}, [experienceMode, t]);
|
|
520
535
|
useEffect(() => {
|
|
@@ -562,7 +577,9 @@ export function FocusPage({ featureFlags }) {
|
|
|
562
577
|
const stateReasonCount = stateReasonCode === "tasks_need_human_review" ? humanReviewCount : pendingCount;
|
|
563
578
|
const stateReason = getStateReasonText(stateReasonCode, t, stateReasonCount);
|
|
564
579
|
const nextAction = getNextActionText(nextActionCode, t);
|
|
565
|
-
return (_jsx(PageShell, { children: _jsxs("div", { className: "animate-[pdFadeIn_400ms_ease-out]", children: [_jsx("div", { className: "font-mono text-[12px] tracking-[0.14em] text-ink-3 uppercase mb-3", children: t("pages.focus.eyebrow") }), _jsx(ShinyText, { as: "h1", className: "text-[29px] font-semibold tracking-tight text-ink mb-2", duration: 4.5, brightness: 0.5, disabled: pendingCount === 0, children: t("pages.focus.title") }), _jsx("p", { className: "text-ink-3 text-[14px] max-w-[760px] leading-relaxed mb-7", children: t("pages.focus.subtitle") }), _jsxs("section", { "aria-label": t("pages.focus.
|
|
580
|
+
return (_jsx(PageShell, { children: _jsxs("div", { className: "animate-[pdFadeIn_400ms_ease-out]", children: [_jsx("div", { className: "font-mono text-[12px] tracking-[0.14em] text-ink-3 uppercase mb-3", children: t("pages.focus.eyebrow") }), _jsx(ShinyText, { as: "h1", className: "text-[29px] font-semibold tracking-tight text-ink mb-2", duration: 4.5, brightness: 0.5, disabled: pendingCount === 0, children: t("pages.focus.title") }), _jsx("p", { className: "text-ink-3 text-[14px] max-w-[760px] leading-relaxed mb-7", children: t("pages.focus.subtitle") }), _jsxs("section", { "aria-label": t("pages.focus.ownerInbox.sectionTitle"), className: "mb-7", "data-testid": "owner-decision-inbox-section", children: [_jsxs("div", { className: "flex items-baseline gap-2 mb-3", children: [_jsx(SectionTitle, { children: t("pages.focus.ownerInbox.sectionTitle") }), ownerInbox !== null && (_jsx("span", { className: "font-mono text-ink-4 text-[12px]", children: `· ${ownerInbox.groups.decision.length + ownerInbox.groups.blocked.filter((item) => item.inbox.attention === 'individual').length + ownerInbox.groups.recovery.length}` }))] }), ownerInboxError !== null && (_jsx("p", { className: "text-ink-4 text-[12.5px]", children: t("pages.focus.ownerInbox.loadError") })), ownerInbox !== null && ownerInboxError === null && (_jsxs(_Fragment, { children: [ownerInbox.groups.decision.length === 0
|
|
581
|
+
&& ownerInbox.groups.blocked.filter((item) => item.inbox.attention === 'individual').length === 0
|
|
582
|
+
&& ownerInbox.groups.recovery.length === 0 && (_jsx("p", { className: "text-ink-4 text-[13px]", children: t("pages.focus.ownerInbox.empty") })), ownerInbox.groups.decision.map((item) => (_jsx(InboxItem, { item: item, t: t }, item.principleId))), ownerInbox.groups.blocked.filter((item) => item.inbox.attention === 'individual').map((item) => (_jsx(InboxItem, { item: item, t: t }, item.principleId))), ownerInbox.groups.recovery.map((item) => (_jsx(InboxItem, { item: item, t: t }, item.principleId))), ownerInbox.historicalUnknown.count > 0 && (_jsxs("p", { className: "text-ink-4 text-[12.5px] leading-relaxed mt-2", "data-testid": "owner-inbox-aggregate-notice", children: [ownerInbox.historicalUnknown.reasonText, " ", _jsx(Link, { to: "/principles", className: "text-gov hover:underline", children: t("pages.focus.ownerInbox.viewLibrary") })] }))] }))] }), _jsxs("section", { "aria-label": t("pages.focus.ownerDecision.sectionTitle"), className: "mb-7", "data-testid": "owner-decisions-section", children: [_jsxs("div", { className: "flex items-baseline gap-2 mb-3", children: [_jsx(SectionTitle, { children: t("pages.focus.ownerDecision.sectionTitle") }), _jsx("span", { className: "font-mono text-ink-4 text-[12px]", children: ownerDecisionError !== null
|
|
566
583
|
? t("pages.focus.ownerDecision.unavailable")
|
|
567
584
|
: `· ${ownerDecisionItems.length}` })] }), ownerDecisionError !== null && (_jsx("p", { className: "text-ink-4 text-[12.5px]", children: t("pages.focus.ownerDecision.loadError") })), ownerDecisionError === null && ownerDecisionItems.length === 0 && (_jsx("p", { className: "text-ink-4 text-[13px]", children: t("pages.focus.ownerDecision.empty") })), ownerDecisionItems.map((item) => (_jsx(OwnerDecisionCard, { item: item, governanceReady: experienceData === null || (experienceData.readiness.authenticationMode === "authenticated"
|
|
568
585
|
&& experienceData.readiness.ownerIdentityConfiguration === "configured"), actionsLockedReason: ownerActionsLockedReason ?? undefined, onResolved: () => { void loadData(); } }, item.reviewKey)))] }), experienceMode && experienceData !== null ? (_jsx(ExperienceSummaryCard, { snapshot: experienceData })) : !experienceMode ? (_jsxs("div", { className: "mb-7 px-[18px] py-[14px] bg-panel border border-line rounded-[6px]", children: [_jsx("div", { className: "flex items-center gap-2 mb-1", children: _jsx("span", { className: `inline-flex items-center rounded-[2px] px-[7px] py-1 font-mono text-[11px] uppercase ${governanceState === "owner_review_ready" ? "bg-gov/10 text-gov border border-gov/20"
|
|
@@ -572,3 +589,9 @@ export function FocusPage({ featureFlags }) {
|
|
|
572
589
|
? t("pages.focus.sectionEvidenceInProgress")
|
|
573
590
|
: t("pages.focus.sectionDeviation") }), deviationCount > 0 ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "text-ink-2 text-sm mb-3", children: [_jsx("span", { className: "font-mono font-semibold text-ink", children: deviationCount }), " ", t("pages.focus.deviationCount", { count: deviationCount })] }), _jsx("div", { className: "text-ink-4 text-[13px] bg-surface/60 border-l-2 border-amber px-3 py-2 mb-4", children: t("pages.focus.deviationDisclaimer") }), _jsxs("details", { className: "group", children: [_jsx("summary", { className: "text-gov text-[13px] cursor-pointer hover:underline focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2", children: t("pages.focus.viewFullChain") }), _jsx("div", { className: "mt-2 pl-4 border-l-2 border-line text-ink-3 text-[13px]", children: t("pages.focus.deviationDetailPending") })] })] })) : evidenceCount > 0 ? (_jsx("div", { className: "text-ink-3 text-[13px] leading-relaxed py-3", children: t("pages.focus.evidenceInProgress", { count: evidenceCount }) })) : (_jsx("div", { className: "text-ink-3 text-[13px] leading-relaxed py-3", children: t("pages.focus.emptyDeviation") }))] })), !experienceMode && (_jsxs("section", { className: "mt-8", "aria-labelledby": "section-signals", children: [_jsx(SectionTitle, { id: "section-signals", children: t("pages.focus.sectionSignals") }), stagnationSignals.length > 0 ? (_jsx("div", { className: "space-y-[10px]", children: stagnationSignals.map((signal) => (_jsx(StagnationSignalCard, { signal: signal }, signal.principleId))) })) : (_jsx("div", { className: "text-ink-3 text-[13px] leading-relaxed py-3", children: t("pages.focus.emptySignals") }))] })), _jsx("footer", { className: "mt-12 pt-6 border-t border-line text-ink-3 text-[13px]", children: t("pages.focus.footer") })] }) }));
|
|
574
591
|
}
|
|
592
|
+
/** Owner Decision Experience v1 inbox item — display-only (SPEC §11.1). */
|
|
593
|
+
function InboxItem({ item, t }) {
|
|
594
|
+
return (_jsxs("div", { className: "mb-2 rounded-[var(--radius-md)] border border-line p-3", "data-testid": "owner-inbox-item", children: [_jsxs("div", { className: "flex flex-wrap items-baseline gap-2", children: [_jsx(Link, { to: `/principles/${encodeURIComponent(item.principleId)}`, className: "text-ink text-[13.5px] font-medium hover:underline", children: item.learnedPrinciple.status === 'known'
|
|
595
|
+
? item.learnedPrinciple.text
|
|
596
|
+
: item.learnedPrinciple.reasonText }), _jsx("span", { className: "font-mono text-[11px] text-ink-4 border border-line rounded-[2px] px-1.5 py-0.5", children: t(`pages.focus.ownerInbox.group.${item.inbox.group}`) })] }), _jsx("p", { className: "mt-1 text-ink-3 text-[12.5px] leading-relaxed", children: item.nextAction.ownerText })] }));
|
|
597
|
+
}
|
|
@@ -32,4 +32,28 @@ export declare function deriveGovernanceControlBlock(input: {
|
|
|
32
32
|
nextAction?: string;
|
|
33
33
|
} | null;
|
|
34
34
|
}): GovernanceControlBlock | null;
|
|
35
|
+
/** Narrative fields render as items; unknown carries its owner-facing reason. */
|
|
36
|
+
export type NarrativeRender = {
|
|
37
|
+
status: 'known';
|
|
38
|
+
texts: string[];
|
|
39
|
+
} | {
|
|
40
|
+
status: 'unknown';
|
|
41
|
+
reason: string;
|
|
42
|
+
};
|
|
43
|
+
export declare function narrativeTexts(field: {
|
|
44
|
+
status: string;
|
|
45
|
+
} & Record<string, unknown>): NarrativeRender;
|
|
46
|
+
/** Resolves the concrete mutation target id for an action (never from URL). */
|
|
47
|
+
export declare function actionTargetId(action: {
|
|
48
|
+
targetRefs: Array<{
|
|
49
|
+
kind: string;
|
|
50
|
+
id: string;
|
|
51
|
+
}>;
|
|
52
|
+
}, kind: 'approval' | 'activation'): string | null;
|
|
53
|
+
export declare function localizeActionLabel(action: {
|
|
54
|
+
semantic: string;
|
|
55
|
+
label: string;
|
|
56
|
+
}, t: (key: string, opts?: Record<string, unknown>) => string): string;
|
|
57
|
+
export declare function localizeNextAction(code: string, ownerText: string, t: (key: string, opts?: Record<string, unknown>) => string): string;
|
|
58
|
+
export declare function localizeBlocker(code: string, ownerText: string, t: (key: string, opts?: Record<string, unknown>) => string): string;
|
|
35
59
|
export declare function PrincipleDetailPage(): import("react").JSX.Element;
|