@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,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* R1 mock fixtures — the complete dataset behind api/r1.ts mock mode.
|
|
3
|
+
*
|
|
4
|
+
* Exercises every UI state: derivation jobs in queued → running → complete
|
|
5
|
+
* progression, a retryable failure, a zero-obligation clean result; candidate
|
|
6
|
+
* rules across all three classifications and all disposition states; findings
|
|
7
|
+
* provenance (prime / cdts / superseded-by-regulatory); suggestion positions;
|
|
8
|
+
* suppressed findings; and the review summary. Plain data + a small stateful
|
|
9
|
+
* store so approve/reject/bulk flows behave like the real backend will.
|
|
10
|
+
*
|
|
11
|
+
* Types are structural here (no import from ./r1) to avoid a module cycle;
|
|
12
|
+
* ./r1 zod-validates nothing in mock mode — these objects ARE the contract
|
|
13
|
+
* fixtures and are asserted against the schemas in tests.
|
|
14
|
+
*/
|
|
15
|
+
export interface FixtureJob {
|
|
16
|
+
job_id: string;
|
|
17
|
+
prime_contract_id?: string;
|
|
18
|
+
file_name?: string;
|
|
19
|
+
status: "queued" | "running" | "failed" | "complete";
|
|
20
|
+
retryable?: boolean;
|
|
21
|
+
error?: string;
|
|
22
|
+
progress?: number;
|
|
23
|
+
result?: {
|
|
24
|
+
derived_playbook_id?: string;
|
|
25
|
+
candidate_rule_count: number;
|
|
26
|
+
zero_obligations?: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Fresh-upload job: polls advance it queued → running → complete. */
|
|
30
|
+
export declare const jobQueued: FixtureJob;
|
|
31
|
+
export declare const jobRunning: FixtureJob;
|
|
32
|
+
export declare const jobFailedRetryable: FixtureJob;
|
|
33
|
+
export declare const jobFailedFatal: FixtureJob;
|
|
34
|
+
export declare const jobComplete: FixtureJob;
|
|
35
|
+
/** Clean result: completed derivation that found nothing to flow down. */
|
|
36
|
+
export declare const jobZeroObligations: FixtureJob;
|
|
37
|
+
export declare const allJobs: FixtureJob[];
|
|
38
|
+
export interface FixtureCandidate {
|
|
39
|
+
id: string;
|
|
40
|
+
playbook_id: string;
|
|
41
|
+
verbatim_excerpt: string;
|
|
42
|
+
section_citation: string;
|
|
43
|
+
classification: "mandatory" | "conditionally_mandatory" | "discretionary";
|
|
44
|
+
generated_rule_text: string;
|
|
45
|
+
rationale: string;
|
|
46
|
+
status: "pending" | "approved" | "rejected";
|
|
47
|
+
approved_text?: string;
|
|
48
|
+
disposed_by?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare const DERIVED_PLAYBOOK_ID = "pbd-prime-001";
|
|
51
|
+
export declare const candidateRules: FixtureCandidate[];
|
|
52
|
+
export declare const provenancePrime: {
|
|
53
|
+
source: "prime";
|
|
54
|
+
prime_contract_id: string;
|
|
55
|
+
prime_section_ref: string;
|
|
56
|
+
source_excerpt: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const provenanceCdts: {
|
|
59
|
+
source: "cdts";
|
|
60
|
+
source_excerpt: string;
|
|
61
|
+
};
|
|
62
|
+
export declare const provenanceSuperseded: {
|
|
63
|
+
source: "prime";
|
|
64
|
+
prime_contract_id: string;
|
|
65
|
+
prime_section_ref: string;
|
|
66
|
+
source_excerpt: string;
|
|
67
|
+
superseded_by_regulatory: boolean;
|
|
68
|
+
};
|
|
69
|
+
export declare const positionsFull: {
|
|
70
|
+
preferred: string;
|
|
71
|
+
fallback: string;
|
|
72
|
+
walkaway: string;
|
|
73
|
+
};
|
|
74
|
+
export declare const positionsPreferredOnly: {
|
|
75
|
+
preferred: string;
|
|
76
|
+
};
|
|
77
|
+
export declare const reviewSummary: {
|
|
78
|
+
by_provenance: {
|
|
79
|
+
prime: number;
|
|
80
|
+
cdts: number;
|
|
81
|
+
};
|
|
82
|
+
by_severity: {
|
|
83
|
+
high: number;
|
|
84
|
+
medium: number;
|
|
85
|
+
low: number;
|
|
86
|
+
};
|
|
87
|
+
missing_flowdown_count: number;
|
|
88
|
+
escalation_count: number;
|
|
89
|
+
suppressed_count: number;
|
|
90
|
+
};
|
|
91
|
+
export interface MockR1Store {
|
|
92
|
+
uploadPrime: (fileName: string) => FixtureJob;
|
|
93
|
+
getJob: (jobId: string) => FixtureJob | null;
|
|
94
|
+
retryJob: (jobId: string) => FixtureJob | null;
|
|
95
|
+
listCandidates: (playbookId: string) => FixtureCandidate[];
|
|
96
|
+
dispose: (candidateId: string, status: "approved" | "rejected", disposedBy?: string, editedText?: string) => FixtureCandidate | null;
|
|
97
|
+
rulebookStatus: (playbookId: string) => {
|
|
98
|
+
playbook_id: string;
|
|
99
|
+
total: number;
|
|
100
|
+
disposed: number;
|
|
101
|
+
active: boolean;
|
|
102
|
+
};
|
|
103
|
+
reviewSummary: () => typeof reviewSummary;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Fresh mutable store seeded from the fixtures. Uploaded jobs progress one
|
|
107
|
+
* state per poll (queued → running → complete); file names containing "fail"
|
|
108
|
+
* produce a retryable failure and names containing "empty" a zero-obligation
|
|
109
|
+
* result, so every state is reachable from the live upload screen too.
|
|
110
|
+
*/
|
|
111
|
+
export declare const createMockR1Store: () => MockR1Store;
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redline polling transport + single-record fetch.
|
|
3
|
+
*
|
|
4
|
+
* POST /v1/redline/async 202 {job_id, status:"queued"}
|
|
5
|
+
* GET /v1/redline/jobs/{id} 200 {job_id, status, result?, error?}
|
|
6
|
+
* GET /api/redlines/{id} 200 one persisted suggestion Record
|
|
7
|
+
*
|
|
8
|
+
* ── Status of this module, stated plainly ────────────────────────────────
|
|
9
|
+
* SSE (`redlineStream.ts`) is the product path. This is the fallback
|
|
10
|
+
* transport: same orchestrator loop, no incremental frames, one JSON result
|
|
11
|
+
* at the end. It earns its place when SSE cannot be used — a proxy that
|
|
12
|
+
* buffers text/event-stream, a corporate network that kills long-lived
|
|
13
|
+
* connections — not as a second way to run a normal review.
|
|
14
|
+
*
|
|
15
|
+
* Persistence parity with SSE: since backend commit `0d94b43`, the job runner
|
|
16
|
+
* replays a finished review's suggestions through the SAME proposeSink the SSE
|
|
17
|
+
* transport uses, BEFORE the job flips to succeeded — so by the time a poll
|
|
18
|
+
* observes `succeeded`, every suggestion in the result has a `proposed` record
|
|
19
|
+
* in the disposition store and accept/reject on it works. Verified live on
|
|
20
|
+
* 2026-08-17 against a HEAD server: async submit → succeeded →
|
|
21
|
+
* `GET /api/redlines?document_id=` returned the record → PATCH accept 200.
|
|
22
|
+
* (Before that commit the async path skipped the store entirely and
|
|
23
|
+
* dispositions 404ed.) `asyncResultsArePersisted` below is the single place
|
|
24
|
+
* that claim is encoded — gate on it, don't re-derive it.
|
|
25
|
+
*
|
|
26
|
+
* `getRedlineRecord` (GET /api/redlines/{id}) is the third route here because
|
|
27
|
+
* `src/api/redlines.ts` — where it would naturally live next to
|
|
28
|
+
* `listRedlineRecords` — is owned by another workstream in this sprint. It is a
|
|
29
|
+
* deliberate, documented placement, not a design view.
|
|
30
|
+
*
|
|
31
|
+
* Base URL: these are redlining-server routes, so VITE_LAX_AI_REDLINE_URL wins
|
|
32
|
+
* when set; it falls back to VITE_LAX_AI_PLAYBOOK_URL because the consolidated
|
|
33
|
+
* binary serves both families on one host and only the playbook var is set in
|
|
34
|
+
* local dev (.env.local).
|
|
35
|
+
*/
|
|
36
|
+
import { z } from "zod";
|
|
37
|
+
export interface RedlineJobsApiConfig {
|
|
38
|
+
baseUrl?: string;
|
|
39
|
+
workspaceId?: string;
|
|
40
|
+
getAuthToken?: () => string | undefined | Promise<string | undefined>;
|
|
41
|
+
}
|
|
42
|
+
/** Configure once from the consumer (App.tsx / lax-web-portal). */
|
|
43
|
+
export declare const configureRedlineJobsApi: (next: RedlineJobsApiConfig) => void;
|
|
44
|
+
export declare class RedlineJobsApiError extends Error {
|
|
45
|
+
readonly status?: number;
|
|
46
|
+
/** Canonical `code` from the error envelope, when the body carries one. */
|
|
47
|
+
readonly code?: string;
|
|
48
|
+
constructor(message: string, status?: number, code?: string);
|
|
49
|
+
}
|
|
50
|
+
/** store.Status values (internal/redlining/store/store.go). */
|
|
51
|
+
export type RedlineJobStatus = "queued" | "running" | "succeeded" | "failed";
|
|
52
|
+
/** True once the job will not change state again. */
|
|
53
|
+
export declare const isTerminalJobStatus: (status: string) => boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether a review run through the async transport lands in the disposition
|
|
56
|
+
* store (and so can be accepted/rejected). TRUE since backend `0d94b43`
|
|
57
|
+
* (propose-before-succeeded replay through the SSE proposeSink — see the
|
|
58
|
+
* module docstring; verified live 2026-08-17). Exported so callers branch on
|
|
59
|
+
* the fact instead of re-deriving it; consumers (useRedlineReview's fallback)
|
|
60
|
+
* use it to decide whether async suggestions get the full accept/reject
|
|
61
|
+
* materializer or a display-only rendering.
|
|
62
|
+
*/
|
|
63
|
+
export declare const asyncResultsArePersisted = true;
|
|
64
|
+
export declare const asyncSubmitSchema: z.ZodObject<{
|
|
65
|
+
job_id: z.ZodString;
|
|
66
|
+
status: z.ZodString;
|
|
67
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
68
|
+
job_id: z.ZodString;
|
|
69
|
+
status: z.ZodString;
|
|
70
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
71
|
+
job_id: z.ZodString;
|
|
72
|
+
status: z.ZodString;
|
|
73
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
74
|
+
/** The subset of the review request body this transport sends. */
|
|
75
|
+
export interface AsyncReviewRequest {
|
|
76
|
+
document_id: string;
|
|
77
|
+
/** Canonical TipTap/ProseMirror document. Preferred over `document`. */
|
|
78
|
+
doc?: unknown;
|
|
79
|
+
/** Legacy raw-text input; used only when `doc` is absent. */
|
|
80
|
+
document?: string;
|
|
81
|
+
regimes?: string[];
|
|
82
|
+
markup_mode?: string;
|
|
83
|
+
schema_version?: string;
|
|
84
|
+
prime_contract_id?: string;
|
|
85
|
+
counterparty_type?: string;
|
|
86
|
+
strictness?: "" | "strict" | "permissive";
|
|
87
|
+
disabled_rule_ids?: string[];
|
|
88
|
+
rule_ids?: string[];
|
|
89
|
+
disabled_playbook_ids?: string[];
|
|
90
|
+
}
|
|
91
|
+
export interface SubmitAsyncOptions {
|
|
92
|
+
/**
|
|
93
|
+
* REQUIRED by the server — a submit without `Idempotency-Key` is a 400.
|
|
94
|
+
*
|
|
95
|
+
* A repeat submit with the same key returns the EXISTING job id and does not
|
|
96
|
+
* kick a second run — verified live: two posts, one job. The server does not
|
|
97
|
+
* exempt a FAILED job from that, so a key derived only from the review's
|
|
98
|
+
* identity pins a caller to a failed job forever, which is fatal for a
|
|
99
|
+
* transport whose whole purpose is retrying after SSE fails. Derive it from
|
|
100
|
+
* document + settings + an ATTEMPT counter: stable enough that a double
|
|
101
|
+
* click is deduplicated, distinct enough that a deliberate retry re-runs.
|
|
102
|
+
*/
|
|
103
|
+
idempotencyKey: string;
|
|
104
|
+
signal?: AbortSignal;
|
|
105
|
+
}
|
|
106
|
+
/** Submit a review for background processing. Resolves to the job id. */
|
|
107
|
+
export declare const submitAsyncReview: (request: AsyncReviewRequest, opts: SubmitAsyncOptions) => Promise<{
|
|
108
|
+
jobId: string;
|
|
109
|
+
status: string;
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* `result` is a json.RawMessage server-side, so it arrives as the review
|
|
113
|
+
* response OBJECT (not a JSON string). Left unvalidated here: it is the full
|
|
114
|
+
* ReviewResponse and validating it is redlineStream.ts's contract, not this
|
|
115
|
+
* module's transport concern.
|
|
116
|
+
*/
|
|
117
|
+
export declare const redlineJobSchema: z.ZodObject<{
|
|
118
|
+
job_id: z.ZodString;
|
|
119
|
+
status: z.ZodString;
|
|
120
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
121
|
+
error: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
122
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
123
|
+
job_id: z.ZodString;
|
|
124
|
+
status: z.ZodString;
|
|
125
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
126
|
+
error: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
127
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
128
|
+
job_id: z.ZodString;
|
|
129
|
+
status: z.ZodString;
|
|
130
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
131
|
+
error: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
132
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
133
|
+
export type RedlineJob = z.infer<typeof redlineJobSchema>;
|
|
134
|
+
/** Poll one job. A job owned by another workspace 404s, same as an unknown id. */
|
|
135
|
+
export declare const getRedlineJob: (jobId: string, opts?: {
|
|
136
|
+
signal?: AbortSignal;
|
|
137
|
+
}) => Promise<RedlineJob>;
|
|
138
|
+
export interface AwaitJobOptions {
|
|
139
|
+
/** Poll interval in ms (default 2000). */
|
|
140
|
+
intervalMs?: number;
|
|
141
|
+
/** Give up after this long (default 15 min — the server's own run cap). */
|
|
142
|
+
timeoutMs?: number;
|
|
143
|
+
signal?: AbortSignal;
|
|
144
|
+
/** Called on every poll, including the terminal one. */
|
|
145
|
+
onPoll?: (job: RedlineJob) => void;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Poll until the job reaches a terminal state, then return it. A `failed` job
|
|
149
|
+
* is RETURNED, not thrown — the caller decides whether a failed review is an
|
|
150
|
+
* error or a state to render. Only transport faults and the timeout throw.
|
|
151
|
+
*/
|
|
152
|
+
export declare const awaitRedlineJob: (jobId: string, opts?: AwaitJobOptions) => Promise<RedlineJob>;
|
|
153
|
+
/**
|
|
154
|
+
* One persisted suggestion record. NOTE the capitalized keys: the Go
|
|
155
|
+
* `suggestion.Record` struct carries NO json tags, so its field names ride the
|
|
156
|
+
* wire verbatim (`ID`, `State`, `Suggestion`, ...). The nested `Suggestion` is
|
|
157
|
+
* the v6 payload and IS snake_case. Verified against a live 200.
|
|
158
|
+
*/
|
|
159
|
+
export declare const redlineRecordSchema: z.ZodObject<{
|
|
160
|
+
ID: z.ZodString;
|
|
161
|
+
WorkspaceID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
162
|
+
DocumentID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
163
|
+
Lane: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
164
|
+
/** "proposed" | "accepted" | "rejected" | "ignored" | "dropped" */
|
|
165
|
+
State: z.ZodString;
|
|
166
|
+
RejectScope: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
167
|
+
RejectNote: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
168
|
+
CreatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
169
|
+
UpdatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
170
|
+
Suggestion: z.ZodOptional<z.ZodObject<{
|
|
171
|
+
id: z.ZodOptional<z.ZodString>;
|
|
172
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
173
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
174
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
175
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
176
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
177
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
178
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
179
|
+
state: z.ZodOptional<z.ZodString>;
|
|
180
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
181
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
183
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
184
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
185
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
186
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
187
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
188
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
189
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
190
|
+
id: z.ZodOptional<z.ZodString>;
|
|
191
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
192
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
193
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
194
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
195
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
196
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
197
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
198
|
+
state: z.ZodOptional<z.ZodString>;
|
|
199
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
200
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
201
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
202
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
203
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
204
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
205
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
206
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
207
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
208
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
209
|
+
id: z.ZodOptional<z.ZodString>;
|
|
210
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
211
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
212
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
213
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
214
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
215
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
216
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
217
|
+
state: z.ZodOptional<z.ZodString>;
|
|
218
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
219
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
220
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
221
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
222
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
223
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
224
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
225
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
226
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
227
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
228
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
229
|
+
ID: z.ZodString;
|
|
230
|
+
WorkspaceID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
231
|
+
DocumentID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
232
|
+
Lane: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
233
|
+
/** "proposed" | "accepted" | "rejected" | "ignored" | "dropped" */
|
|
234
|
+
State: z.ZodString;
|
|
235
|
+
RejectScope: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
236
|
+
RejectNote: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
237
|
+
CreatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
238
|
+
UpdatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
239
|
+
Suggestion: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
id: z.ZodOptional<z.ZodString>;
|
|
241
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
242
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
243
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
244
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
245
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
246
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
247
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
248
|
+
state: z.ZodOptional<z.ZodString>;
|
|
249
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
250
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
251
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
252
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
253
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
254
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
255
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
256
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
257
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
258
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
259
|
+
id: z.ZodOptional<z.ZodString>;
|
|
260
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
261
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
262
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
263
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
264
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
265
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
266
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
267
|
+
state: z.ZodOptional<z.ZodString>;
|
|
268
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
269
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
270
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
271
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
272
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
273
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
274
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
275
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
276
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
277
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
278
|
+
id: z.ZodOptional<z.ZodString>;
|
|
279
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
280
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
281
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
282
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
283
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
284
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
285
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
286
|
+
state: z.ZodOptional<z.ZodString>;
|
|
287
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
288
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
289
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
290
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
291
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
292
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
293
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
294
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
295
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
296
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
297
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
298
|
+
ID: z.ZodString;
|
|
299
|
+
WorkspaceID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
300
|
+
DocumentID: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
301
|
+
Lane: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
302
|
+
/** "proposed" | "accepted" | "rejected" | "ignored" | "dropped" */
|
|
303
|
+
State: z.ZodString;
|
|
304
|
+
RejectScope: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
305
|
+
RejectNote: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
306
|
+
CreatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
307
|
+
UpdatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
308
|
+
Suggestion: z.ZodOptional<z.ZodObject<{
|
|
309
|
+
id: z.ZodOptional<z.ZodString>;
|
|
310
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
311
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
312
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
313
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
314
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
315
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
316
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
317
|
+
state: z.ZodOptional<z.ZodString>;
|
|
318
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
319
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
320
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
321
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
322
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
323
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
324
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
325
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
326
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
327
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
328
|
+
id: z.ZodOptional<z.ZodString>;
|
|
329
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
330
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
331
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
332
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
333
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
334
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
335
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
336
|
+
state: z.ZodOptional<z.ZodString>;
|
|
337
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
338
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
339
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
340
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
341
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
342
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
343
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
344
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
345
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
346
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
347
|
+
id: z.ZodOptional<z.ZodString>;
|
|
348
|
+
document_id: z.ZodOptional<z.ZodString>;
|
|
349
|
+
position_path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
350
|
+
kind: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
351
|
+
text: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
352
|
+
rationale: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
353
|
+
category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
354
|
+
severity: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
355
|
+
state: z.ZodOptional<z.ZodString>;
|
|
356
|
+
reviewed_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
357
|
+
reviewed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
358
|
+
citation: z.ZodOptional<z.ZodObject<{
|
|
359
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
360
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
361
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
362
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
363
|
+
rule_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
364
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
365
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
366
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
367
|
+
export type RedlineRecord = z.infer<typeof redlineRecordSchema>;
|
|
368
|
+
/**
|
|
369
|
+
* Fetch ONE persisted suggestion by id — the refresh-one-item read, as
|
|
370
|
+
* opposed to `listRedlineRecords` (redlines.ts), which re-pulls a whole
|
|
371
|
+
* document. Errors: 404 for an unknown id AND for a record owned by another
|
|
372
|
+
* workspace (deliberately indistinguishable, so an id cannot be probed
|
|
373
|
+
* cross-tenant), plain-text body.
|
|
374
|
+
*/
|
|
375
|
+
export declare const getRedlineRecord: (id: string, opts?: {
|
|
376
|
+
signal?: AbortSignal;
|
|
377
|
+
}) => Promise<RedlineRecord>;
|