@lax-wp/editor 0.4.13 → 0.4.15-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/api/audit.d.ts +79 -0
- package/dist/api/derivedRulebook.d.ts +470 -0
- package/dist/api/documentVersions.d.ts +519 -0
- package/dist/api/effectiveRules.d.ts +372 -0
- package/dist/api/methodology.d.ts +62 -0
- package/dist/api/playbook.d.ts +604 -0
- package/dist/api/promotions.d.ts +1432 -0
- package/dist/api/r1.d.ts +1097 -0
- package/dist/api/r1.fixtures.d.ts +111 -0
- package/dist/api/redlineJobs.d.ts +377 -0
- package/dist/api/redlineStream.d.ts +2979 -0
- package/dist/api/redlines.d.ts +504 -0
- package/dist/api/regsync.d.ts +2355 -0
- package/dist/api/ruleAuthoring.d.ts +305 -0
- package/dist/api/ruleBuilder.d.ts +1009 -0
- package/dist/api/ruleOverrides.d.ts +31 -0
- package/dist/api/ruleStats.d.ts +84 -0
- package/dist/api/rulesCatalog.d.ts +234 -0
- package/dist/api/versions.d.ts +76 -0
- package/dist/api/workspace.d.ts +41 -0
- package/dist/components/EditorSidebar.d.ts +4 -1
- package/dist/components/audit/AuditView.d.ts +8 -0
- package/dist/components/capturededits/AddAsRuleModal.d.ts +8 -0
- package/dist/components/capturededits/CapturedEditCard.d.ts +15 -0
- package/dist/components/capturededits/CapturedEditsTray.d.ts +4 -0
- package/dist/components/capturededits/capturedEditIntent.d.ts +23 -0
- package/dist/components/common/EscDropdown.d.ts +2 -0
- package/dist/components/compliance/MethodologyPanel.d.ts +14 -0
- package/dist/components/compliance/RegSyncPanel.d.ts +18 -0
- package/dist/components/compliance/index.d.ts +8 -0
- package/dist/components/compliance/primitives.d.ts +41 -0
- package/dist/components/documents/DocumentVersionHistory.d.ts +12 -0
- package/dist/components/documents/documentDiff.d.ts +68 -0
- package/dist/components/documents/index.d.ts +4 -0
- package/dist/components/flowdown/FlowdownPanel.d.ts +28 -0
- package/dist/components/flowdown/FlowdownRowCard.d.ts +27 -0
- package/dist/components/flowdown/flowdownModel.d.ts +150 -0
- package/dist/components/history/PlaybookVersionHistory.d.ts +10 -0
- package/dist/components/history/versionDiff.d.ts +14 -0
- package/dist/components/playbook/AllPlaybooksView.d.ts +41 -0
- package/dist/components/playbook/DerivedRulebookView.d.ts +9 -0
- package/dist/components/playbook/DraftedRulePreview.d.ts +17 -0
- package/dist/components/playbook/EffectiveRulesView.d.ts +11 -0
- package/dist/components/playbook/NewRuleDrawer.d.ts +11 -0
- package/dist/components/playbook/PlaybookCard.d.ts +13 -0
- package/dist/components/playbook/PlaybookPage.d.ts +29 -0
- package/dist/components/playbook/PlaybookPanel.d.ts +73 -0
- package/dist/components/playbook/PromotionSuggestions.d.ts +1 -0
- package/dist/components/playbook/ReprioritizeDialog.d.ts +16 -0
- package/dist/components/playbook/RuleDetail.d.ts +27 -0
- package/dist/components/playbook/RuleEditorFields.d.ts +42 -0
- package/dist/components/playbook/RuleEditorModal.d.ts +27 -0
- package/dist/components/playbook/RulePerformancePanel.d.ts +4 -0
- package/dist/components/playbook/RuleRow.d.ts +26 -0
- package/dist/components/playbook/ThisDocumentView.d.ts +45 -0
- package/dist/components/playbook/ViewTabs.d.ts +8 -0
- package/dist/components/playbook/index.d.ts +14 -0
- package/dist/components/playbook/predicateSummary.d.ts +10 -0
- package/dist/components/playbook/primitives.d.ts +82 -0
- package/dist/components/playbook/useFocusTrap.d.ts +6 -0
- package/dist/components/playbook/usePlaybookData.d.ts +161 -0
- package/dist/components/playbook/usePlaybookLabel.d.ts +18 -0
- package/dist/components/r1/ApprovalPanel.d.ts +10 -0
- package/dist/components/r1/CandidateRuleCard.d.ts +8 -0
- package/dist/components/r1/ExecSummaryPanel.d.ts +23 -0
- package/dist/components/r1/PrimeUploadPanel.d.ts +8 -0
- package/dist/components/r1/ReviewStartControls.d.ts +24 -0
- package/dist/components/r1/ReviewSummaryTab.d.ts +38 -0
- package/dist/components/r1/index.d.ts +13 -0
- package/dist/components/r1/primitives.d.ts +59 -0
- package/dist/components/redline/AiReviewPanel.d.ts +194 -0
- package/dist/components/redline/RedlineHoverCard.d.ts +13 -0
- package/dist/components/redline/RedlineItem.d.ts +12 -0
- package/dist/components/redline/ReviewCard.d.ts +49 -0
- package/dist/components/redline/index.d.ts +6 -0
- package/dist/components/redline/reviewItems.d.ts +49 -0
- package/dist/components/redline/reviewPrefs.d.ts +18 -0
- package/dist/components/redline/useRunScopedCards.d.ts +16 -0
- package/dist/components/rulebuilder/AuthorForms.d.ts +28 -0
- package/dist/components/rulebuilder/CandidateQueue.d.ts +21 -0
- package/dist/components/rulebuilder/DraftPane.d.ts +12 -0
- package/dist/components/rulebuilder/RuleBuilderPanel.d.ts +6 -0
- package/dist/components/rulebuilder/RuleCard.d.ts +16 -0
- package/dist/components/rulebuilder/TestBench.d.ts +10 -0
- package/dist/components/rulebuilder/VocabularyPanel.d.ts +26 -0
- package/dist/components/rulebuilder/index.d.ts +13 -0
- package/dist/components/rulebuilder/primitives.d.ts +54 -0
- package/dist/components/rulebuilder/useRuleBuilder.d.ts +291 -0
- package/dist/components/sidebar/ExpandableSidebar.d.ts +2 -0
- package/dist/components/sidebar/WorkspaceRetentionPanel.d.ts +18 -0
- package/dist/components/sidebar/content/TrackChangesContent.d.ts +8 -0
- package/dist/components/sidebar/content/anonymization-page/PIIAnonymization.d.ts +1 -1
- package/dist/components/sidebar/content/anonymization-page/PiiIdleView.d.ts +12 -0
- package/dist/components/sidebar/content/anonymization-page/PiiRecoveryView.d.ts +16 -0
- package/dist/components/sidebar/content/anonymization-page/PiiSummaryView.d.ts +34 -0
- package/dist/components/sidebar/content/anonymization-page/PiiUnavailableView.d.ts +1 -0
- package/dist/components/sidebar/content/anonymization-page/RestoreConfirmDialog.d.ts +9 -0
- package/dist/components/sidebar/content/anonymization-page/anonymizationUtils.d.ts +38 -17
- package/dist/components/sidebar/content/anonymization-page/piiVault.d.ts +18 -0
- package/dist/components/sidebar/content/index.d.ts +0 -1
- package/dist/components/toolbar/AutocompletionToggle.d.ts +1 -0
- package/dist/components/trackChanges/TrackChangesCards.d.ts +1 -0
- package/dist/components/trackChanges/index.d.ts +2 -0
- package/dist/components/trackChanges/utils.d.ts +5 -0
- package/dist/config/EditorConfig.d.ts +197 -73
- package/dist/constants/Extensions.d.ts +12 -0
- package/dist/constants/playbook.d.ts +108 -0
- package/dist/contexts/CapturedEditsContext.d.ts +56 -0
- package/dist/contexts/EditorShellContext.d.ts +4 -1
- package/dist/editor.css +1 -1
- package/dist/extensions/AnonymizedText.d.ts +31 -2
- package/dist/extensions/VariableText.d.ts +20 -0
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/plugins/CapturedEditsPlugin.d.ts +90 -0
- package/dist/extensions/plugins/MarkHighlightPlugin.d.ts +0 -1
- package/dist/extensions/plugins/RedlinePlugin.d.ts +9 -0
- package/dist/extensions/redline/changeTypes.d.ts +70 -0
- package/dist/extensions/redline/constants.d.ts +25 -0
- package/dist/extensions/redline/engine/blockNodes.d.ts +31 -0
- package/dist/extensions/redline/engine/clipboard.d.ts +16 -0
- package/dist/extensions/redline/engine/deletion.d.ts +34 -0
- package/dist/extensions/redline/engine/formatSplit.d.ts +16 -0
- package/dist/extensions/redline/engine/insertion.d.ts +26 -0
- package/dist/extensions/redline/engine/predicates.d.ts +73 -0
- package/dist/extensions/redline/engine/textReplace.d.ts +19 -0
- package/dist/extensions/redline/id.d.ts +7 -0
- package/dist/extensions/redline/index.d.ts +36 -0
- package/dist/extensions/redline/plugin.d.ts +34 -0
- package/dist/extensions/redline/query/scan.d.ts +52 -0
- package/dist/extensions/redline/review/applyChange.d.ts +25 -0
- package/dist/extensions/redline/review/index.d.ts +1 -0
- package/dist/extensions/redline/review/nodeResolvers.d.ts +29 -0
- package/dist/extensions/redline/review/pairedNodes.d.ts +38 -0
- package/dist/extensions/redline/review/structuralRevert.d.ts +20 -0
- package/dist/extensions/redline/review/textResolver.d.ts +9 -0
- package/dist/extensions/redline/schema/marks.d.ts +65 -0
- package/dist/extensions/redline/schema/shared.d.ts +34 -0
- package/dist/extensions/redline/session.d.ts +71 -0
- package/dist/extensions/redline/types.d.ts +24 -0
- package/dist/extensions/trackedChanges/TrackedChanges.d.ts +64 -0
- package/dist/extensions/trackedChanges/constants.d.ts +34 -0
- package/dist/extensions/trackedChanges/engine.d.ts +32 -0
- package/dist/extensions/trackedChanges/index.d.ts +13 -0
- package/dist/extensions/trackedChanges/marks.d.ts +20 -0
- package/dist/extensions/trackedChanges/normalize.d.ts +2 -0
- package/dist/extensions/trackedChanges/plugin.d.ts +32 -0
- package/dist/extensions/trackedChanges/query.d.ts +3 -0
- package/dist/extensions/trackedChanges/review.d.ts +34 -0
- package/dist/extensions/trackedChanges/types.d.ts +72 -0
- package/dist/extensions/trackedChanges/utils.d.ts +20 -0
- package/dist/hooks/useMediaQuery.d.ts +2 -0
- package/dist/hooks/useRedlineHover.d.ts +17 -0
- package/dist/hooks/useRedlineReview.d.ts +83 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.es.js +38491 -22189
- package/dist/index.umd.js +224 -125
- package/dist/utils/cdts.d.ts +37 -0
- package/dist/utils/groundingAdapter.d.ts +36 -0
- package/package.json +39 -33
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playbook / rules API module — REQ-D1..D5.
|
|
3
|
+
*
|
|
4
|
+
* ALL playbook and rule HTTP lives here. Every response is validated with
|
|
5
|
+
* zod at the boundary; components never fetch directly and never see
|
|
6
|
+
* unvalidated JSON. Auth-header pass-through, error normalization, and
|
|
7
|
+
* caching (playbooks per workspace, rules per playbook id, invalidated on
|
|
8
|
+
* any rule save) also live here.
|
|
9
|
+
*
|
|
10
|
+
* Write paths (createRule / updateRule / duplicate) are fully built but
|
|
11
|
+
* merge-gated at PR level until backend persistence lands (REQ-S2).
|
|
12
|
+
*/
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { type CdtsScope } from "@/utils/cdts";
|
|
15
|
+
export declare const cdtsScopeSchema: z.ZodObject<{
|
|
16
|
+
category: z.ZodOptional<z.ZodString>;
|
|
17
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
18
|
+
type: z.ZodOptional<z.ZodString>;
|
|
19
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
21
|
+
category: z.ZodOptional<z.ZodString>;
|
|
22
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
23
|
+
type: z.ZodOptional<z.ZodString>;
|
|
24
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
26
|
+
category: z.ZodOptional<z.ZodString>;
|
|
27
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
28
|
+
type: z.ZodOptional<z.ZodString>;
|
|
29
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
31
|
+
export declare const ruleSchema: z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
playbook_id: z.ZodString;
|
|
34
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
35
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
36
|
+
name: z.ZodOptional<z.ZodString>;
|
|
37
|
+
category: z.ZodString;
|
|
38
|
+
default_severity: z.ZodString;
|
|
39
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
40
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
41
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
text: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
44
|
+
text: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
46
|
+
text: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
48
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
49
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
50
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
51
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
source: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
playbook_id: z.ZodString;
|
|
57
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
58
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
59
|
+
name: z.ZodOptional<z.ZodString>;
|
|
60
|
+
category: z.ZodString;
|
|
61
|
+
default_severity: z.ZodString;
|
|
62
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
63
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
64
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
text: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
67
|
+
text: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
69
|
+
text: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
71
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
72
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
73
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
74
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
source: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
playbook_id: z.ZodString;
|
|
80
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
81
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
82
|
+
name: z.ZodOptional<z.ZodString>;
|
|
83
|
+
category: z.ZodString;
|
|
84
|
+
default_severity: z.ZodString;
|
|
85
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
86
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
87
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
text: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
90
|
+
text: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
92
|
+
text: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
94
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
95
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
96
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
97
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
+
source: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
101
|
+
export declare const playbookSchema: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
regime: z.ZodOptional<z.ZodString>;
|
|
106
|
+
/** "base" on the bundled starter chain, "custom" on workspace-created. */
|
|
107
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
108
|
+
scope: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
109
|
+
category: z.ZodOptional<z.ZodString>;
|
|
110
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
111
|
+
type: z.ZodOptional<z.ZodString>;
|
|
112
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
114
|
+
category: z.ZodOptional<z.ZodString>;
|
|
115
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
116
|
+
type: z.ZodOptional<z.ZodString>;
|
|
117
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
119
|
+
category: z.ZodOptional<z.ZodString>;
|
|
120
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
121
|
+
type: z.ZodOptional<z.ZodString>;
|
|
122
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
124
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
effective_from: z.ZodOptional<z.ZodString>;
|
|
126
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
+
bundled: z.ZodOptional<z.ZodBoolean>;
|
|
128
|
+
/** REQ-D2: the ?cdts= response includes each chain playbook's rules inline. */
|
|
129
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
130
|
+
id: z.ZodString;
|
|
131
|
+
playbook_id: z.ZodString;
|
|
132
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
133
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
134
|
+
name: z.ZodOptional<z.ZodString>;
|
|
135
|
+
category: z.ZodString;
|
|
136
|
+
default_severity: z.ZodString;
|
|
137
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
138
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
139
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
text: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
142
|
+
text: z.ZodOptional<z.ZodString>;
|
|
143
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
144
|
+
text: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
146
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
147
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
148
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
149
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
source: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
153
|
+
id: z.ZodString;
|
|
154
|
+
playbook_id: z.ZodString;
|
|
155
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
156
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
157
|
+
name: z.ZodOptional<z.ZodString>;
|
|
158
|
+
category: z.ZodString;
|
|
159
|
+
default_severity: z.ZodString;
|
|
160
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
161
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
162
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
text: z.ZodOptional<z.ZodString>;
|
|
164
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
165
|
+
text: z.ZodOptional<z.ZodString>;
|
|
166
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
167
|
+
text: z.ZodOptional<z.ZodString>;
|
|
168
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
169
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
170
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
171
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
172
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
173
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
+
source: z.ZodOptional<z.ZodString>;
|
|
175
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
176
|
+
id: z.ZodString;
|
|
177
|
+
playbook_id: z.ZodString;
|
|
178
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
179
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
180
|
+
name: z.ZodOptional<z.ZodString>;
|
|
181
|
+
category: z.ZodString;
|
|
182
|
+
default_severity: z.ZodString;
|
|
183
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
184
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
185
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
186
|
+
text: z.ZodOptional<z.ZodString>;
|
|
187
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
188
|
+
text: z.ZodOptional<z.ZodString>;
|
|
189
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
190
|
+
text: z.ZodOptional<z.ZodString>;
|
|
191
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
192
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
193
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
194
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
195
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
196
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
+
source: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
199
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
200
|
+
id: z.ZodString;
|
|
201
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
202
|
+
name: z.ZodString;
|
|
203
|
+
regime: z.ZodOptional<z.ZodString>;
|
|
204
|
+
/** "base" on the bundled starter chain, "custom" on workspace-created. */
|
|
205
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
206
|
+
scope: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
207
|
+
category: z.ZodOptional<z.ZodString>;
|
|
208
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
209
|
+
type: z.ZodOptional<z.ZodString>;
|
|
210
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
211
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
212
|
+
category: z.ZodOptional<z.ZodString>;
|
|
213
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
214
|
+
type: z.ZodOptional<z.ZodString>;
|
|
215
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
216
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
217
|
+
category: z.ZodOptional<z.ZodString>;
|
|
218
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
219
|
+
type: z.ZodOptional<z.ZodString>;
|
|
220
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
221
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
222
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
effective_from: z.ZodOptional<z.ZodString>;
|
|
224
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
225
|
+
bundled: z.ZodOptional<z.ZodBoolean>;
|
|
226
|
+
/** REQ-D2: the ?cdts= response includes each chain playbook's rules inline. */
|
|
227
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
228
|
+
id: z.ZodString;
|
|
229
|
+
playbook_id: z.ZodString;
|
|
230
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
231
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
232
|
+
name: z.ZodOptional<z.ZodString>;
|
|
233
|
+
category: z.ZodString;
|
|
234
|
+
default_severity: z.ZodString;
|
|
235
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
236
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
237
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
238
|
+
text: z.ZodOptional<z.ZodString>;
|
|
239
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
240
|
+
text: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
242
|
+
text: z.ZodOptional<z.ZodString>;
|
|
243
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
244
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
245
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
246
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
247
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
248
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
249
|
+
source: z.ZodOptional<z.ZodString>;
|
|
250
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
251
|
+
id: z.ZodString;
|
|
252
|
+
playbook_id: z.ZodString;
|
|
253
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
254
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
255
|
+
name: z.ZodOptional<z.ZodString>;
|
|
256
|
+
category: z.ZodString;
|
|
257
|
+
default_severity: z.ZodString;
|
|
258
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
259
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
260
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
261
|
+
text: z.ZodOptional<z.ZodString>;
|
|
262
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
263
|
+
text: z.ZodOptional<z.ZodString>;
|
|
264
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
265
|
+
text: z.ZodOptional<z.ZodString>;
|
|
266
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
267
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
268
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
269
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
270
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
271
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
+
source: z.ZodOptional<z.ZodString>;
|
|
273
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
274
|
+
id: z.ZodString;
|
|
275
|
+
playbook_id: z.ZodString;
|
|
276
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
277
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
278
|
+
name: z.ZodOptional<z.ZodString>;
|
|
279
|
+
category: z.ZodString;
|
|
280
|
+
default_severity: z.ZodString;
|
|
281
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
282
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
283
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
284
|
+
text: z.ZodOptional<z.ZodString>;
|
|
285
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
286
|
+
text: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
288
|
+
text: z.ZodOptional<z.ZodString>;
|
|
289
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
290
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
291
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
292
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
293
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
294
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
+
source: z.ZodOptional<z.ZodString>;
|
|
296
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
297
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
298
|
+
id: z.ZodString;
|
|
299
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
300
|
+
name: z.ZodString;
|
|
301
|
+
regime: z.ZodOptional<z.ZodString>;
|
|
302
|
+
/** "base" on the bundled starter chain, "custom" on workspace-created. */
|
|
303
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
304
|
+
scope: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
305
|
+
category: z.ZodOptional<z.ZodString>;
|
|
306
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
307
|
+
type: z.ZodOptional<z.ZodString>;
|
|
308
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
309
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
310
|
+
category: z.ZodOptional<z.ZodString>;
|
|
311
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
312
|
+
type: z.ZodOptional<z.ZodString>;
|
|
313
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
314
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
315
|
+
category: z.ZodOptional<z.ZodString>;
|
|
316
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
317
|
+
type: z.ZodOptional<z.ZodString>;
|
|
318
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
319
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
320
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
321
|
+
effective_from: z.ZodOptional<z.ZodString>;
|
|
322
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
323
|
+
bundled: z.ZodOptional<z.ZodBoolean>;
|
|
324
|
+
/** REQ-D2: the ?cdts= response includes each chain playbook's rules inline. */
|
|
325
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
326
|
+
id: z.ZodString;
|
|
327
|
+
playbook_id: z.ZodString;
|
|
328
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
329
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
330
|
+
name: z.ZodOptional<z.ZodString>;
|
|
331
|
+
category: z.ZodString;
|
|
332
|
+
default_severity: z.ZodString;
|
|
333
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
334
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
335
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
336
|
+
text: z.ZodOptional<z.ZodString>;
|
|
337
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
338
|
+
text: z.ZodOptional<z.ZodString>;
|
|
339
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
340
|
+
text: z.ZodOptional<z.ZodString>;
|
|
341
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
342
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
343
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
344
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
345
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
346
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
347
|
+
source: z.ZodOptional<z.ZodString>;
|
|
348
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
349
|
+
id: z.ZodString;
|
|
350
|
+
playbook_id: z.ZodString;
|
|
351
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
352
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
353
|
+
name: z.ZodOptional<z.ZodString>;
|
|
354
|
+
category: z.ZodString;
|
|
355
|
+
default_severity: z.ZodString;
|
|
356
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
357
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
358
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
359
|
+
text: z.ZodOptional<z.ZodString>;
|
|
360
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
361
|
+
text: z.ZodOptional<z.ZodString>;
|
|
362
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
363
|
+
text: z.ZodOptional<z.ZodString>;
|
|
364
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
365
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
366
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
367
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
368
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
369
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
370
|
+
source: z.ZodOptional<z.ZodString>;
|
|
371
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
372
|
+
id: z.ZodString;
|
|
373
|
+
playbook_id: z.ZodString;
|
|
374
|
+
workspace_id: z.ZodOptional<z.ZodString>;
|
|
375
|
+
/** Optional display name; fall back via ruleDisplayName(). */
|
|
376
|
+
name: z.ZodOptional<z.ZodString>;
|
|
377
|
+
category: z.ZodString;
|
|
378
|
+
default_severity: z.ZodString;
|
|
379
|
+
verbatim_excerpt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
380
|
+
/** Phase-4 backend field: replaces `verbatim_excerpt` in responses. */
|
|
381
|
+
standard_position: z.ZodOptional<z.ZodObject<{
|
|
382
|
+
text: z.ZodOptional<z.ZodString>;
|
|
383
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
384
|
+
text: z.ZodOptional<z.ZodString>;
|
|
385
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
386
|
+
text: z.ZodOptional<z.ZodString>;
|
|
387
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
388
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
389
|
+
suggested_text: z.ZodOptional<z.ZodString>;
|
|
390
|
+
authority: z.ZodOptional<z.ZodString>;
|
|
391
|
+
mandatory: z.ZodOptional<z.ZodBoolean>;
|
|
392
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
393
|
+
source: z.ZodOptional<z.ZodString>;
|
|
394
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
395
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
396
|
+
export declare const citationSchema: z.ZodObject<{
|
|
397
|
+
playbook_id: z.ZodString;
|
|
398
|
+
playbook_scope: z.ZodOptional<z.ZodObject<{
|
|
399
|
+
category: z.ZodOptional<z.ZodString>;
|
|
400
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
401
|
+
type: z.ZodOptional<z.ZodString>;
|
|
402
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
403
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
404
|
+
category: z.ZodOptional<z.ZodString>;
|
|
405
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
406
|
+
type: z.ZodOptional<z.ZodString>;
|
|
407
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
408
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
409
|
+
category: z.ZodOptional<z.ZodString>;
|
|
410
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
411
|
+
type: z.ZodOptional<z.ZodString>;
|
|
412
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
413
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
414
|
+
rule_id: z.ZodString;
|
|
415
|
+
verbatim_excerpt: z.ZodOptional<z.ZodString>;
|
|
416
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
417
|
+
playbook_id: z.ZodString;
|
|
418
|
+
playbook_scope: z.ZodOptional<z.ZodObject<{
|
|
419
|
+
category: z.ZodOptional<z.ZodString>;
|
|
420
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
421
|
+
type: z.ZodOptional<z.ZodString>;
|
|
422
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
423
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
424
|
+
category: z.ZodOptional<z.ZodString>;
|
|
425
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
426
|
+
type: z.ZodOptional<z.ZodString>;
|
|
427
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
428
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
429
|
+
category: z.ZodOptional<z.ZodString>;
|
|
430
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
431
|
+
type: z.ZodOptional<z.ZodString>;
|
|
432
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
433
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
434
|
+
rule_id: z.ZodString;
|
|
435
|
+
verbatim_excerpt: z.ZodOptional<z.ZodString>;
|
|
436
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
437
|
+
playbook_id: z.ZodString;
|
|
438
|
+
playbook_scope: z.ZodOptional<z.ZodObject<{
|
|
439
|
+
category: z.ZodOptional<z.ZodString>;
|
|
440
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
441
|
+
type: z.ZodOptional<z.ZodString>;
|
|
442
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
443
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
444
|
+
category: z.ZodOptional<z.ZodString>;
|
|
445
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
446
|
+
type: z.ZodOptional<z.ZodString>;
|
|
447
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
448
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
449
|
+
category: z.ZodOptional<z.ZodString>;
|
|
450
|
+
domain: z.ZodOptional<z.ZodString>;
|
|
451
|
+
type: z.ZodOptional<z.ZodString>;
|
|
452
|
+
subtype: z.ZodOptional<z.ZodString>;
|
|
453
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
454
|
+
rule_id: z.ZodString;
|
|
455
|
+
verbatim_excerpt: z.ZodOptional<z.ZodString>;
|
|
456
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
457
|
+
export type Rule = z.infer<typeof ruleSchema>;
|
|
458
|
+
export type Playbook = z.infer<typeof playbookSchema>;
|
|
459
|
+
export type Citation = z.infer<typeof citationSchema>;
|
|
460
|
+
export type { CdtsScope };
|
|
461
|
+
/** Display name fallback chain: name → rationale → id. */
|
|
462
|
+
export declare const ruleDisplayName: (rule: Rule) => string;
|
|
463
|
+
/**
|
|
464
|
+
* Rule text fallback chain: standard_position.text → verbatim_excerpt.
|
|
465
|
+
* Deliberately NOT falling back to `rationale` — it carries the display name
|
|
466
|
+
* (see draftToPayload), and that fallback silently replaced rule text with
|
|
467
|
+
* the name on edit/duplicate round-trips.
|
|
468
|
+
*/
|
|
469
|
+
export declare const ruleText: (rule: Rule) => string;
|
|
470
|
+
/**
|
|
471
|
+
* Bundled (product-shipped, read-only) detection.
|
|
472
|
+
*
|
|
473
|
+
* The backend exposes NO `bundled`/`read_only` field on playbooks today — the
|
|
474
|
+
* embedded starter bundle is only identifiable by its id prefix (the loader in
|
|
475
|
+
* `playbooks/v1/` emits ids like `v1-gov-flow-down`; every rule it derives also
|
|
476
|
+
* carries a `[STARTER]` excerpt prefix). `pb_v1_` is kept for older fixtures.
|
|
477
|
+
*
|
|
478
|
+
* This stays a heuristic until the backend ships an explicit flag; when it
|
|
479
|
+
* does, the `??` chain below picks it up with no other change.
|
|
480
|
+
*/
|
|
481
|
+
export declare const isBundledPlaybook: (pb: Playbook) => boolean;
|
|
482
|
+
export type PlaybookApiErrorKind = "network" | "http" | "parse" | "unauthorized" | "forbidden" | "conflict" | "not_found" | "rate_limited" | "not_implemented" | "dependency_unavailable";
|
|
483
|
+
export declare class PlaybookApiError extends Error {
|
|
484
|
+
readonly kind: PlaybookApiErrorKind;
|
|
485
|
+
readonly status?: number;
|
|
486
|
+
/** Canonical `code` from the error envelope (FE_INTEGRATION_API §1.3). */
|
|
487
|
+
readonly code?: string;
|
|
488
|
+
/** From `details.retry_after_seconds` on a 503. */
|
|
489
|
+
readonly retryAfterSeconds?: number;
|
|
490
|
+
constructor(kind: PlaybookApiErrorKind, message: string, status?: number, code?: string, retryAfterSeconds?: number);
|
|
491
|
+
}
|
|
492
|
+
export interface PlaybookApiConfig {
|
|
493
|
+
/** Service base URL, e.g. https://host/api/v1/lax-ai-legal-editor */
|
|
494
|
+
baseUrl?: string;
|
|
495
|
+
/** Returns the bearer token (sync or async); omitted → no auth header. */
|
|
496
|
+
getAuthToken?: () => string | undefined | Promise<string | undefined>;
|
|
497
|
+
/** Workspace key for the playbook cache (REQ-D5). */
|
|
498
|
+
workspaceId?: string;
|
|
499
|
+
}
|
|
500
|
+
/** Configure once from the consumer (lax-web-portal) or PlaybookPanel props. */
|
|
501
|
+
export declare const configurePlaybookApi: (next: PlaybookApiConfig) => void;
|
|
502
|
+
/**
|
|
503
|
+
* Shared fetch core. Exported so sibling API modules (derivedRulebook.ts,
|
|
504
|
+
* pii.ts) reuse one auth/error/validation path rather than re-implementing
|
|
505
|
+
* it. `opts` overrides base URL / workspace for modules with their own
|
|
506
|
+
* config (pii.ts) — omit for the playbook config.
|
|
507
|
+
*/
|
|
508
|
+
export declare const request: <S extends z.ZodTypeAny>(path: string, schema: S, init?: RequestInit, opts?: Pick<PlaybookApiConfig, "baseUrl" | "workspaceId">) => Promise<z.output<S>>;
|
|
509
|
+
/** Invalidate on any rule save (REQ-D5). */
|
|
510
|
+
export declare const invalidatePlaybookCaches: () => void;
|
|
511
|
+
export interface ListPlaybooksOptions {
|
|
512
|
+
/**
|
|
513
|
+
* REQ-D2: document coordinate for the server-authoritative walk-up filter
|
|
514
|
+
* (`GET /v1/playbooks?cdts=`). If the backend rejects the param (400),
|
|
515
|
+
* degrades to an unfiltered fetch + client-side chain filter with a
|
|
516
|
+
* console.warn.
|
|
517
|
+
*/
|
|
518
|
+
cdts?: CdtsScope;
|
|
519
|
+
forceRefresh?: boolean;
|
|
520
|
+
}
|
|
521
|
+
export declare const listPlaybooks: (options?: ListPlaybooksOptions) => Promise<Playbook[]>;
|
|
522
|
+
/** Single-rule read (conflict-reload path in the editor modal). Uncached. */
|
|
523
|
+
export declare const getRule: (ruleId: string) => Promise<Rule>;
|
|
524
|
+
export interface ListRulesOptions {
|
|
525
|
+
/**
|
|
526
|
+
* The playbook's current version. The versioned read is the ONLY rule-list
|
|
527
|
+
* route the backend serves; when this is omitted the version is resolved
|
|
528
|
+
* first via `GET /v1/playbooks/{id}`.
|
|
529
|
+
*/
|
|
530
|
+
version?: number;
|
|
531
|
+
forceRefresh?: boolean;
|
|
532
|
+
}
|
|
533
|
+
export declare const listRules: (playbookId: string, options?: ListRulesOptions) => Promise<Rule[]>;
|
|
534
|
+
/** The rule editor's save payload (REQ-M2 fields). */
|
|
535
|
+
export interface RuleDraft {
|
|
536
|
+
/** Stable per editing session — double-submit posts the same id (REQ-M3). */
|
|
537
|
+
id: string;
|
|
538
|
+
name: string;
|
|
539
|
+
/** V6 category (mapped from the display category chip-select). */
|
|
540
|
+
category: string;
|
|
541
|
+
/** V6 severity (mapped from the tier segmented control). */
|
|
542
|
+
severity: string;
|
|
543
|
+
/** Rule text. Rendered as text, never HTML (REQ-D5). */
|
|
544
|
+
text: string;
|
|
545
|
+
/**
|
|
546
|
+
* Applies-to scope (REQ-M2): the workspace playbook at a CDTS coordinate,
|
|
547
|
+
* or this document only (doc-rules store; synthetic `doc:` playbook id
|
|
548
|
+
* pending a dedicated doc-rules endpoint).
|
|
549
|
+
*/
|
|
550
|
+
scope: {
|
|
551
|
+
kind: "playbook";
|
|
552
|
+
playbookId: string;
|
|
553
|
+
} | {
|
|
554
|
+
kind: "document";
|
|
555
|
+
documentId: string;
|
|
556
|
+
/**
|
|
557
|
+
* The document's CDTS scope — carried onto the auto-created
|
|
558
|
+
* `doc:<id>` playbook (the backend rejects a scopeless non-base
|
|
559
|
+
* playbook, so it must have at least scope.category).
|
|
560
|
+
*/
|
|
561
|
+
scope?: CdtsScope;
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
export declare const createRule: (draft: RuleDraft) => Promise<Rule>;
|
|
565
|
+
export declare const updateRule: (draft: RuleDraft) => Promise<Rule>;
|
|
566
|
+
/**
|
|
567
|
+
* Deletes a rule. The backend guards bundled/read-only rules and answers 403
|
|
568
|
+
* (`projection.ErrReadOnly`), so callers must not offer this on bundled rules;
|
|
569
|
+
* the 403 is a backstop, not the UX.
|
|
570
|
+
*/
|
|
571
|
+
export declare const deleteRule: (ruleId: string) => Promise<void>;
|
|
572
|
+
/**
|
|
573
|
+
* REQ-R4: duplicating a bundled rule creates an editable workspace copy that
|
|
574
|
+
* wins over the bundled original. Goes through createRule (single write path).
|
|
575
|
+
*/
|
|
576
|
+
export declare const duplicateRuleToWorkspace: (rule: Rule, targetPlaybookId: string) => Promise<Rule>;
|
|
577
|
+
/**
|
|
578
|
+
* Deletes a playbook (`DELETE /v1/playbooks/{id}` → 204 | 404 | 400).
|
|
579
|
+
* Base (bundled) playbooks are undeletable — bundled content reloads from the
|
|
580
|
+
* binary at boot — and answer 400 with code `base_playbook_undeletable`;
|
|
581
|
+
* callers render that envelope's message (it points at per-run exclusion
|
|
582
|
+
* instead). Callers must not offer this on bundled playbooks; the 400 is a
|
|
583
|
+
* backstop, not the UX.
|
|
584
|
+
*/
|
|
585
|
+
export declare const deletePlaybook: (playbookId: string) => Promise<void>;
|
|
586
|
+
/**
|
|
587
|
+
* The create payload `POST /v1/playbooks` validates: id, name and regime are
|
|
588
|
+
* required, and a playbook without scope.category must be kind="base" — so
|
|
589
|
+
* workspace copies always carry at least the source's category.
|
|
590
|
+
*/
|
|
591
|
+
export interface PlaybookDraft {
|
|
592
|
+
id: string;
|
|
593
|
+
name: string;
|
|
594
|
+
regime: string;
|
|
595
|
+
scope: CdtsScope;
|
|
596
|
+
}
|
|
597
|
+
export declare const createPlaybook: (draft: PlaybookDraft) => Promise<Playbook>;
|
|
598
|
+
/**
|
|
599
|
+
* Duplicates a whole (typically bundled) playbook into an editable workspace
|
|
600
|
+
* copy: one createPlaybook, then each rule copied via duplicateRuleToWorkspace
|
|
601
|
+
* (single write path). Rules copy sequentially so a mid-way failure leaves a
|
|
602
|
+
* usable partial copy rather than an interleaved mess.
|
|
603
|
+
*/
|
|
604
|
+
export declare const duplicatePlaybookToWorkspace: (source: Playbook) => Promise<Playbook>;
|