@serovaai/ficta-contract 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Serova OÜ
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # @serovaai/ficta-contract
2
+
3
+ Language-neutral HTTP contract for building a frontend or operator integration for the Ficta
4
+ protection engine. The package includes a generated OpenAPI 3.1.1 document; TypeScript users also get
5
+ the source oRPC contract and Zod schemas, a fetch-based client, and shared error decoding.
6
+
7
+ This package covers the Ficta **control plane** only. OpenAI- and Anthropic-compatible model traffic
8
+ continues to use the providers' native wire formats through the proxy and is intentionally not
9
+ wrapped in oRPC.
10
+
11
+ ## Start here
12
+
13
+ Choose the smallest integration profile your product needs:
14
+
15
+ | Profile | Interface |
16
+ | --------------------- | -------------------------------------------------------------- |
17
+ | Transparent proxy | Send native Anthropic or OpenAI HTTP/SSE traffic through Ficta |
18
+ | Status-aware frontend | Discover capabilities, then read values-free protection status |
19
+ | Reviewed send | Preview exact text, render findings, then make one bound send |
20
+ | Operator liveness | Probe control-plane health with `GET` or `HEAD` |
21
+
22
+ The [frontend integration contract](https://github.com/SerovaAI/ficta/blob/main/packages/ficta/docs/control-plane.md)
23
+ defines compatibility, deployment and trust boundaries, native provider paths, scope isolation,
24
+ the reviewed-send lifecycle, errors, and conformance requirements. Read it alongside OpenAPI: the
25
+ schema defines control-plane wire shapes, while the guide defines behavior that OpenAPI cannot
26
+ express.
27
+
28
+ ## Install
29
+
30
+ ```sh
31
+ pnpm add @serovaai/ficta-contract
32
+ ```
33
+
34
+ ## Typed client
35
+
36
+ ```ts
37
+ import { createFictaControlClient, FICTA_SCOPE_HEADER } from "@serovaai/ficta-contract";
38
+
39
+ const client = createFictaControlClient({ baseUrl: "http://127.0.0.1:8787" });
40
+
41
+ const capabilities = await client.capabilities();
42
+ const health = await client.health();
43
+ const status = await client.status();
44
+
45
+ const scopedClient = createFictaControlClient({
46
+ baseUrl: "http://127.0.0.1:8787",
47
+ headers: { [FICTA_SCOPE_HEADER]: "my-workspace:my-user:my-thread" },
48
+ });
49
+ const preview = await scopedClient.protectionPreview({
50
+ text: "Review Project Juniper",
51
+ protectedValues: ["Project Juniper"],
52
+ });
53
+ ```
54
+
55
+ The proxy defaults to loopback and protection preview is loopback-only. A browser frontend should
56
+ normally call its own trusted server, which then calls Ficta; do not expose the proxy or manufacture
57
+ trusted scope headers from an untrusted browser.
58
+
59
+ ## Machine-readable OpenAPI
60
+
61
+ The generated specification is exported as `@serovaai/ficta-contract/openapi.json` and is also
62
+ included at `openapi/ficta-control-plane.openapi.json` in the package. It is generated from the same
63
+ oRPC contract used by the client and proxy implementation. Any OpenAPI 3.1-capable language or HTTP
64
+ client can use it; oRPC is optional.
65
+
66
+ The versioned capability response is the runtime compatibility handshake:
67
+
68
+ ```json
69
+ {
70
+ "ok": true,
71
+ "service": "ficta",
72
+ "protocolVersion": 1,
73
+ "capabilities": ["health", "status", "protection-preview"]
74
+ }
75
+ ```
76
+
77
+ Capability names are open for compatible extension. Clients must require the names they use and
78
+ ignore unrecognized names when `protocolVersion` remains compatible.
79
+
80
+ ## License
81
+
82
+ MIT — see [`LICENSE`](./LICENSE).
@@ -0,0 +1,11 @@
1
+ import type { ContractRouterClient } from "@orpc/contract";
2
+ import type { JsonifiedClient } from "@orpc/openapi-client";
3
+ import { fictaControlContract } from "./contract.js";
4
+ export type FictaControlClient = JsonifiedClient<ContractRouterClient<typeof fictaControlContract>>;
5
+ export interface CreateFictaControlClientOptions {
6
+ baseUrl: string | URL;
7
+ headers?: Headers | Record<string, string>;
8
+ fetch?: typeof globalThis.fetch;
9
+ }
10
+ /** Create a fetch-based client for any conforming Ficta control-plane implementation. */
11
+ export declare function createFictaControlClient(options: CreateFictaControlClientOptions): FictaControlClient;
package/dist/client.js ADDED
@@ -0,0 +1,18 @@
1
+ import { createORPCClient } from "@orpc/client";
2
+ import { OpenAPILink } from "@orpc/openapi-client/fetch";
3
+ import { fictaControlContract } from "./contract.js";
4
+ import { decodeFictaControlError } from "./errors.js";
5
+ /** Create a fetch-based client for any conforming Ficta control-plane implementation. */
6
+ export function createFictaControlClient(options) {
7
+ const link = new OpenAPILink(fictaControlContract, {
8
+ url: options.baseUrl,
9
+ headers: options.headers,
10
+ customErrorResponseBodyDecoder: decodeFictaControlError,
11
+ ...(options.fetch
12
+ ? {
13
+ fetch: (request, init) => options.fetch?.(request, init) ?? globalThis.fetch(request, init),
14
+ }
15
+ : {}),
16
+ });
17
+ return createORPCClient(link);
18
+ }
@@ -0,0 +1,139 @@
1
+ export declare const fictaControlContract: {
2
+ capabilities: import("@orpc/contract").ContractProcedure<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodObject<{
3
+ ok: import("zod").ZodLiteral<true>;
4
+ service: import("zod").ZodLiteral<"ficta">;
5
+ protocolVersion: import("zod").ZodLiteral<1>;
6
+ capabilities: import("zod").ZodArray<import("zod").ZodString>;
7
+ }, import("zod/v4/core").$strict>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
8
+ health: import("@orpc/contract").ContractProcedure<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodObject<{
9
+ ok: import("zod").ZodLiteral<true>;
10
+ service: import("zod").ZodLiteral<"ficta">;
11
+ }, import("zod/v4/core").$strict>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
12
+ status: import("@orpc/contract").ContractProcedure<import("@orpc/contract").Schema<unknown, unknown>, import("zod").ZodObject<{
13
+ ok: import("zod").ZodLiteral<true>;
14
+ service: import("zod").ZodLiteral<"ficta">;
15
+ protection: import("zod").ZodObject<{
16
+ enabled: import("zod").ZodBoolean;
17
+ protecting: import("zod").ZodBoolean;
18
+ registeredValues: import("zod").ZodNumber;
19
+ policyExcluded: import("zod").ZodNumber;
20
+ }, import("zod/v4/core").$strict>;
21
+ registry: import("zod").ZodOptional<import("zod").ZodObject<{
22
+ required: import("zod").ZodBoolean;
23
+ status: import("zod").ZodEnum<{
24
+ empty: "empty";
25
+ error: "error";
26
+ ready: "ready";
27
+ }>;
28
+ message: import("zod").ZodString;
29
+ }, import("zod/v4/core").$strict>>;
30
+ secretShapes: import("zod").ZodObject<{
31
+ enabled: import("zod").ZodBoolean;
32
+ status: import("zod").ZodEnum<{
33
+ off: "off";
34
+ ok: "ok";
35
+ }>;
36
+ message: import("zod").ZodString;
37
+ }, import("zod/v4/core").$strict>;
38
+ pii: import("zod").ZodObject<{
39
+ enabled: import("zod").ZodBoolean;
40
+ configuredBackend: import("zod").ZodString;
41
+ configuredBackends: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
42
+ backend: import("zod").ZodString;
43
+ status: import("zod").ZodEnum<{
44
+ blocking: "blocking";
45
+ degraded: "degraded";
46
+ off: "off";
47
+ ok: "ok";
48
+ }>;
49
+ failureMode: import("zod").ZodEnum<{
50
+ "fail-closed": "fail-closed";
51
+ "fail-open": "fail-open";
52
+ }>;
53
+ url: import("zod").ZodOptional<import("zod").ZodString>;
54
+ detail: import("zod").ZodOptional<import("zod").ZodString>;
55
+ message: import("zod").ZodString;
56
+ }, import("zod/v4/core").$strict>;
57
+ activity: import("zod").ZodOptional<import("zod").ZodObject<{
58
+ restoredValues: import("zod").ZodNumber;
59
+ withheldFromTools: import("zod").ZodNumber;
60
+ }, import("zod/v4/core").$strict>>;
61
+ }, import("zod/v4/core").$strict>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
62
+ protectionPreview: import("@orpc/contract").ContractProcedure<import("zod").ZodPipe<import("zod").ZodObject<{
63
+ text: import("zod").ZodString;
64
+ protectedValues: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>>>;
65
+ }, import("zod/v4/core").$strip>, import("zod").ZodTransform<{
66
+ text: string;
67
+ protectedValues: string[];
68
+ }, {
69
+ text: string;
70
+ protectedValues?: string[] | undefined;
71
+ }>>, import("zod").ZodObject<{
72
+ ok: import("zod").ZodLiteral<true>;
73
+ service: import("zod").ZodLiteral<"ficta">;
74
+ ticket: import("zod").ZodString;
75
+ textSha256: import("zod").ZodString;
76
+ redactedText: import("zod").ZodString;
77
+ findings: import("zod").ZodArray<import("zod").ZodObject<{
78
+ name: import("zod").ZodString;
79
+ source: import("zod").ZodString;
80
+ plugin: import("zod").ZodOptional<import("zod").ZodString>;
81
+ kind: import("zod").ZodOptional<import("zod").ZodEnum<{
82
+ custom: "custom";
83
+ pii: "pii";
84
+ secret: "secret";
85
+ }>>;
86
+ confidence: import("zod").ZodOptional<import("zod").ZodEnum<{
87
+ exact: "exact";
88
+ high: "high";
89
+ probabilistic: "probabilistic";
90
+ }>>;
91
+ start: import("zod").ZodNumber;
92
+ end: import("zod").ZodNumber;
93
+ surrogate: import("zod").ZodString;
94
+ origin: import("zod").ZodEnum<{
95
+ detected: "detected";
96
+ registry: "registry";
97
+ user: "user";
98
+ }>;
99
+ }, import("zod/v4/core").$strict>>;
100
+ }, import("zod/v4/core").$strict>, import("@orpc/contract").MergedErrorMap<Record<never, never>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
101
+ FORBIDDEN: {
102
+ status: number;
103
+ data: import("zod").ZodObject<{
104
+ ok: import("zod").ZodLiteral<false>;
105
+ service: import("zod").ZodLiteral<"ficta">;
106
+ message: import("zod").ZodString;
107
+ status: import("zod").ZodLiteral<"forbidden">;
108
+ }, import("zod/v4/core").$strict>;
109
+ };
110
+ INVALID_REQUEST: {
111
+ status: number;
112
+ data: import("zod").ZodObject<{
113
+ ok: import("zod").ZodLiteral<false>;
114
+ service: import("zod").ZodLiteral<"ficta">;
115
+ message: import("zod").ZodString;
116
+ status: import("zod").ZodLiteral<"invalid_request">;
117
+ }, import("zod/v4/core").$strict>;
118
+ };
119
+ DETECTOR_UNAVAILABLE: {
120
+ status: number;
121
+ data: import("zod").ZodObject<{
122
+ ok: import("zod").ZodLiteral<false>;
123
+ service: import("zod").ZodLiteral<"ficta">;
124
+ message: import("zod").ZodString;
125
+ status: import("zod").ZodLiteral<"detector_unavailable">;
126
+ }, import("zod/v4/core").$strict>;
127
+ };
128
+ INVARIANT: {
129
+ status: number;
130
+ data: import("zod").ZodObject<{
131
+ ok: import("zod").ZodLiteral<false>;
132
+ service: import("zod").ZodLiteral<"ficta">;
133
+ message: import("zod").ZodString;
134
+ status: import("zod").ZodLiteral<"invariant">;
135
+ }, import("zod/v4/core").$strict>;
136
+ };
137
+ }>>, Record<never, never>>;
138
+ };
139
+ export type FictaControlContract = typeof fictaControlContract;
@@ -0,0 +1,45 @@
1
+ import { FICTA_HEALTH_PATH, FICTA_PROTECTION_PREVIEW_PATH, FICTA_STATUS_PATH } from "@serovaai/ficta-protocol";
2
+ import { oc } from "@orpc/contract";
3
+ import { capabilitiesSchema, FICTA_CAPABILITIES_PATH, healthSchema, protectionPreviewDetectorUnavailableErrorSchema, protectionPreviewForbiddenErrorSchema, protectionPreviewInputSchema, protectionPreviewInvalidRequestErrorSchema, protectionPreviewInvariantErrorSchema, protectionPreviewSchema, protectionStatusSchema, } from "./schemas.js";
4
+ const controlProcedure = oc;
5
+ export const fictaControlContract = oc.tag("Ficta control plane").router({
6
+ capabilities: controlProcedure
7
+ .route({
8
+ method: "GET",
9
+ path: FICTA_CAPABILITIES_PATH,
10
+ operationId: "getFictaCapabilities",
11
+ summary: "Discover the Ficta control-plane version and supported procedures",
12
+ })
13
+ .output(capabilitiesSchema),
14
+ health: controlProcedure
15
+ .route({
16
+ method: "GET",
17
+ path: FICTA_HEALTH_PATH,
18
+ operationId: "getFictaHealth",
19
+ summary: "Check whether the Ficta proxy process is serving requests",
20
+ })
21
+ .output(healthSchema),
22
+ status: controlProcedure
23
+ .route({
24
+ method: "GET",
25
+ path: FICTA_STATUS_PATH,
26
+ operationId: "getFictaProtectionStatus",
27
+ summary: "Read values-free protection readiness and activity metadata",
28
+ })
29
+ .output(protectionStatusSchema),
30
+ protectionPreview: controlProcedure
31
+ .route({
32
+ method: "POST",
33
+ path: FICTA_PROTECTION_PREVIEW_PATH,
34
+ operationId: "createFictaProtectionPreview",
35
+ summary: "Preview protection and issue a short-lived send ticket",
36
+ })
37
+ .input(protectionPreviewInputSchema)
38
+ .output(protectionPreviewSchema)
39
+ .errors({
40
+ FORBIDDEN: { status: 403, data: protectionPreviewForbiddenErrorSchema },
41
+ INVALID_REQUEST: { status: 400, data: protectionPreviewInvalidRequestErrorSchema },
42
+ DETECTOR_UNAVAILABLE: { status: 503, data: protectionPreviewDetectorUnavailableErrorSchema },
43
+ INVARIANT: { status: 422, data: protectionPreviewInvariantErrorSchema },
44
+ }),
45
+ });
@@ -0,0 +1,10 @@
1
+ import { ORPCError } from "@orpc/client";
2
+ import { type FictaProtectionPreviewError } from "./schemas.js";
3
+ /** Encode defined preview errors with the stable pre-oRPC HTTP response body. */
4
+ export declare function encodeFictaControlError(error: ORPCError<string, unknown>): unknown;
5
+ /** Decode the stable HTTP error body back into the contract's typed oRPC error. */
6
+ export declare function decodeFictaControlError(body: unknown, response: {
7
+ status: number;
8
+ }): ORPCError<string, unknown> | undefined;
9
+ export declare function fictaControlErrorStatus(error: unknown): number | undefined;
10
+ export declare function fictaControlErrorData(error: unknown): FictaProtectionPreviewError | undefined;
package/dist/errors.js ADDED
@@ -0,0 +1,74 @@
1
+ import { ORPCError } from "@orpc/client";
2
+ import { protectionPreviewErrorSchema } from "./schemas.js";
3
+ const previewErrorCodes = {
4
+ forbidden: "FORBIDDEN",
5
+ invalid_request: "INVALID_REQUEST",
6
+ detector_unavailable: "DETECTOR_UNAVAILABLE",
7
+ invariant: "INVARIANT",
8
+ };
9
+ /** Encode defined preview errors with the stable pre-oRPC HTTP response body. */
10
+ export function encodeFictaControlError(error) {
11
+ const parsed = protectionPreviewErrorSchema.safeParse(error.data);
12
+ if (parsed.success)
13
+ return parsed.data;
14
+ if (error.code === "BAD_REQUEST") {
15
+ return {
16
+ ok: false,
17
+ service: "ficta",
18
+ status: "invalid_request",
19
+ message: protectionPreviewValidationMessage(error.data),
20
+ };
21
+ }
22
+ return undefined;
23
+ }
24
+ function protectionPreviewValidationMessage(data) {
25
+ if (!data || typeof data !== "object" || !("issues" in data) || !Array.isArray(data.issues)) {
26
+ return "Invalid protection preview request.";
27
+ }
28
+ const issue = data.issues[0];
29
+ if (!issue || typeof issue !== "object")
30
+ return "Invalid protection preview request.";
31
+ const record = issue;
32
+ const path = Array.isArray(record.path) ? record.path : [];
33
+ if (path.length === 0)
34
+ return "Preview body must be an object.";
35
+ if (path[0] === "text") {
36
+ return record.code === "too_big" || record.message === "Preview text is too large."
37
+ ? "Preview text is too large."
38
+ : "Preview text is required.";
39
+ }
40
+ if (path[0] === "protectedValues") {
41
+ if (path.length === 1) {
42
+ if (record.code === "too_big")
43
+ return "Too many protected values for one chat.";
44
+ if (record.message === "Protected values are too large for one chat.")
45
+ return record.message;
46
+ return "Protected values must be a list.";
47
+ }
48
+ return record.code === "invalid_type"
49
+ ? "Every protected value must be text."
50
+ : "A protected value is empty or too long.";
51
+ }
52
+ return "Invalid protection preview request.";
53
+ }
54
+ /** Decode the stable HTTP error body back into the contract's typed oRPC error. */
55
+ export function decodeFictaControlError(body, response) {
56
+ const parsed = protectionPreviewErrorSchema.safeParse(body);
57
+ if (!parsed.success)
58
+ return undefined;
59
+ return new ORPCError(previewErrorCodes[parsed.data.status], {
60
+ defined: true,
61
+ status: response.status,
62
+ message: parsed.data.message,
63
+ data: parsed.data,
64
+ });
65
+ }
66
+ export function fictaControlErrorStatus(error) {
67
+ return error instanceof ORPCError ? error.status : undefined;
68
+ }
69
+ export function fictaControlErrorData(error) {
70
+ if (!(error instanceof ORPCError))
71
+ return undefined;
72
+ const parsed = protectionPreviewErrorSchema.safeParse(error.data);
73
+ return parsed.success ? parsed.data : undefined;
74
+ }
@@ -0,0 +1,5 @@
1
+ export { FICTA_HEALTH_PATH, FICTA_PROTECTION_PREVIEW_PATH, FICTA_PROTECTION_TICKET_HEADER, FICTA_SCOPE_HEADER, FICTA_STATUS_PATH, } from "@serovaai/ficta-protocol";
2
+ export { createFictaControlClient, type CreateFictaControlClientOptions, type FictaControlClient } from "./client.js";
3
+ export { fictaControlContract, type FictaControlContract } from "./contract.js";
4
+ export { decodeFictaControlError, encodeFictaControlError, fictaControlErrorData, fictaControlErrorStatus, } from "./errors.js";
5
+ export { capabilitiesSchema, FICTA_CAPABILITIES_PATH, FICTA_CONTROL_CAPABILITIES, FICTA_CONTROL_PROTOCOL_VERSION, FICTA_SCOPE_MAX_LENGTH, healthSchema, PROTECTION_PREVIEW_TEXT_MAX_BYTES, PROTECTION_PREVIEW_VALUE_MAX, PROTECTION_PREVIEW_VALUES_MAX, PROTECTION_PREVIEW_VALUES_MAX_BYTES, protectionPreviewDetectorUnavailableErrorSchema, protectionPreviewErrorSchema, protectionPreviewFindingSchema, protectionPreviewForbiddenErrorSchema, protectionPreviewInputSchema, protectionPreviewInvalidRequestErrorSchema, protectionPreviewInvariantErrorSchema, protectionPreviewSchema, protectionStatusSchema, registryProtectionStatusSchema, type FictaCapabilities, type FictaHealth, type FictaProtectionPreview, type FictaProtectionPreviewError, type FictaProtectionPreviewInput, type FictaProtectionStatus, } from "./schemas.js";
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { FICTA_HEALTH_PATH, FICTA_PROTECTION_PREVIEW_PATH, FICTA_PROTECTION_TICKET_HEADER, FICTA_SCOPE_HEADER, FICTA_STATUS_PATH, } from "@serovaai/ficta-protocol";
2
+ export { createFictaControlClient } from "./client.js";
3
+ export { fictaControlContract } from "./contract.js";
4
+ export { decodeFictaControlError, encodeFictaControlError, fictaControlErrorData, fictaControlErrorStatus, } from "./errors.js";
5
+ export { capabilitiesSchema, FICTA_CAPABILITIES_PATH, FICTA_CONTROL_CAPABILITIES, FICTA_CONTROL_PROTOCOL_VERSION, FICTA_SCOPE_MAX_LENGTH, healthSchema, PROTECTION_PREVIEW_TEXT_MAX_BYTES, PROTECTION_PREVIEW_VALUE_MAX, PROTECTION_PREVIEW_VALUES_MAX, PROTECTION_PREVIEW_VALUES_MAX_BYTES, protectionPreviewDetectorUnavailableErrorSchema, protectionPreviewErrorSchema, protectionPreviewFindingSchema, protectionPreviewForbiddenErrorSchema, protectionPreviewInputSchema, protectionPreviewInvalidRequestErrorSchema, protectionPreviewInvariantErrorSchema, protectionPreviewSchema, protectionStatusSchema, registryProtectionStatusSchema, } from "./schemas.js";
@@ -0,0 +1,209 @@
1
+ import { z } from "zod";
2
+ export declare const FICTA_CAPABILITIES_PATH: "/__ficta/capabilities";
3
+ export declare const FICTA_CONTROL_PROTOCOL_VERSION: 1;
4
+ export declare const FICTA_CONTROL_CAPABILITIES: readonly ["health", "status", "protection-preview"];
5
+ export declare const FICTA_SCOPE_MAX_LENGTH = 256;
6
+ export declare const PROTECTION_PREVIEW_TEXT_MAX_BYTES: number;
7
+ export declare const PROTECTION_PREVIEW_VALUES_MAX = 200;
8
+ export declare const PROTECTION_PREVIEW_VALUE_MAX = 2000;
9
+ export declare const PROTECTION_PREVIEW_VALUES_MAX_BYTES: number;
10
+ export declare const healthSchema: z.ZodObject<{
11
+ ok: z.ZodLiteral<true>;
12
+ service: z.ZodLiteral<"ficta">;
13
+ }, z.core.$strict>;
14
+ export declare const capabilitiesSchema: z.ZodObject<{
15
+ ok: z.ZodLiteral<true>;
16
+ service: z.ZodLiteral<"ficta">;
17
+ protocolVersion: z.ZodLiteral<1>;
18
+ capabilities: z.ZodArray<z.ZodString>;
19
+ }, z.core.$strict>;
20
+ export declare const registryProtectionStatusSchema: z.ZodObject<{
21
+ required: z.ZodBoolean;
22
+ status: z.ZodEnum<{
23
+ empty: "empty";
24
+ error: "error";
25
+ ready: "ready";
26
+ }>;
27
+ message: z.ZodString;
28
+ }, z.core.$strict>;
29
+ export declare const protectionStatusSchema: z.ZodObject<{
30
+ ok: z.ZodLiteral<true>;
31
+ service: z.ZodLiteral<"ficta">;
32
+ protection: z.ZodObject<{
33
+ enabled: z.ZodBoolean;
34
+ protecting: z.ZodBoolean;
35
+ registeredValues: z.ZodNumber;
36
+ policyExcluded: z.ZodNumber;
37
+ }, z.core.$strict>;
38
+ registry: z.ZodOptional<z.ZodObject<{
39
+ required: z.ZodBoolean;
40
+ status: z.ZodEnum<{
41
+ empty: "empty";
42
+ error: "error";
43
+ ready: "ready";
44
+ }>;
45
+ message: z.ZodString;
46
+ }, z.core.$strict>>;
47
+ secretShapes: z.ZodObject<{
48
+ enabled: z.ZodBoolean;
49
+ status: z.ZodEnum<{
50
+ off: "off";
51
+ ok: "ok";
52
+ }>;
53
+ message: z.ZodString;
54
+ }, z.core.$strict>;
55
+ pii: z.ZodObject<{
56
+ enabled: z.ZodBoolean;
57
+ configuredBackend: z.ZodString;
58
+ configuredBackends: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
+ backend: z.ZodString;
60
+ status: z.ZodEnum<{
61
+ blocking: "blocking";
62
+ degraded: "degraded";
63
+ off: "off";
64
+ ok: "ok";
65
+ }>;
66
+ failureMode: z.ZodEnum<{
67
+ "fail-closed": "fail-closed";
68
+ "fail-open": "fail-open";
69
+ }>;
70
+ url: z.ZodOptional<z.ZodString>;
71
+ detail: z.ZodOptional<z.ZodString>;
72
+ message: z.ZodString;
73
+ }, z.core.$strict>;
74
+ activity: z.ZodOptional<z.ZodObject<{
75
+ restoredValues: z.ZodNumber;
76
+ withheldFromTools: z.ZodNumber;
77
+ }, z.core.$strict>>;
78
+ }, z.core.$strict>;
79
+ export declare const protectionHitSchema: z.ZodObject<{
80
+ name: z.ZodString;
81
+ source: z.ZodString;
82
+ plugin: z.ZodOptional<z.ZodString>;
83
+ kind: z.ZodOptional<z.ZodEnum<{
84
+ custom: "custom";
85
+ pii: "pii";
86
+ secret: "secret";
87
+ }>>;
88
+ confidence: z.ZodOptional<z.ZodEnum<{
89
+ exact: "exact";
90
+ high: "high";
91
+ probabilistic: "probabilistic";
92
+ }>>;
93
+ }, z.core.$strict>;
94
+ export declare const protectionPreviewFindingSchema: z.ZodObject<{
95
+ name: z.ZodString;
96
+ source: z.ZodString;
97
+ plugin: z.ZodOptional<z.ZodString>;
98
+ kind: z.ZodOptional<z.ZodEnum<{
99
+ custom: "custom";
100
+ pii: "pii";
101
+ secret: "secret";
102
+ }>>;
103
+ confidence: z.ZodOptional<z.ZodEnum<{
104
+ exact: "exact";
105
+ high: "high";
106
+ probabilistic: "probabilistic";
107
+ }>>;
108
+ start: z.ZodNumber;
109
+ end: z.ZodNumber;
110
+ surrogate: z.ZodString;
111
+ origin: z.ZodEnum<{
112
+ detected: "detected";
113
+ registry: "registry";
114
+ user: "user";
115
+ }>;
116
+ }, z.core.$strict>;
117
+ export declare const protectionPreviewTextSchema: z.ZodString;
118
+ export declare const protectionPreviewProtectedValuesSchema: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
119
+ export declare const protectionPreviewInputSchema: z.ZodPipe<z.ZodObject<{
120
+ text: z.ZodString;
121
+ protectedValues: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
122
+ }, z.core.$strip>, z.ZodTransform<{
123
+ text: string;
124
+ protectedValues: string[];
125
+ }, {
126
+ text: string;
127
+ protectedValues?: string[] | undefined;
128
+ }>>;
129
+ export declare const protectionPreviewSchema: z.ZodObject<{
130
+ ok: z.ZodLiteral<true>;
131
+ service: z.ZodLiteral<"ficta">;
132
+ ticket: z.ZodString;
133
+ textSha256: z.ZodString;
134
+ redactedText: z.ZodString;
135
+ findings: z.ZodArray<z.ZodObject<{
136
+ name: z.ZodString;
137
+ source: z.ZodString;
138
+ plugin: z.ZodOptional<z.ZodString>;
139
+ kind: z.ZodOptional<z.ZodEnum<{
140
+ custom: "custom";
141
+ pii: "pii";
142
+ secret: "secret";
143
+ }>>;
144
+ confidence: z.ZodOptional<z.ZodEnum<{
145
+ exact: "exact";
146
+ high: "high";
147
+ probabilistic: "probabilistic";
148
+ }>>;
149
+ start: z.ZodNumber;
150
+ end: z.ZodNumber;
151
+ surrogate: z.ZodString;
152
+ origin: z.ZodEnum<{
153
+ detected: "detected";
154
+ registry: "registry";
155
+ user: "user";
156
+ }>;
157
+ }, z.core.$strict>>;
158
+ }, z.core.$strict>;
159
+ export declare const protectionPreviewForbiddenErrorSchema: z.ZodObject<{
160
+ ok: z.ZodLiteral<false>;
161
+ service: z.ZodLiteral<"ficta">;
162
+ message: z.ZodString;
163
+ status: z.ZodLiteral<"forbidden">;
164
+ }, z.core.$strict>;
165
+ export declare const protectionPreviewInvalidRequestErrorSchema: z.ZodObject<{
166
+ ok: z.ZodLiteral<false>;
167
+ service: z.ZodLiteral<"ficta">;
168
+ message: z.ZodString;
169
+ status: z.ZodLiteral<"invalid_request">;
170
+ }, z.core.$strict>;
171
+ export declare const protectionPreviewDetectorUnavailableErrorSchema: z.ZodObject<{
172
+ ok: z.ZodLiteral<false>;
173
+ service: z.ZodLiteral<"ficta">;
174
+ message: z.ZodString;
175
+ status: z.ZodLiteral<"detector_unavailable">;
176
+ }, z.core.$strict>;
177
+ export declare const protectionPreviewInvariantErrorSchema: z.ZodObject<{
178
+ ok: z.ZodLiteral<false>;
179
+ service: z.ZodLiteral<"ficta">;
180
+ message: z.ZodString;
181
+ status: z.ZodLiteral<"invariant">;
182
+ }, z.core.$strict>;
183
+ export declare const protectionPreviewErrorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
184
+ ok: z.ZodLiteral<false>;
185
+ service: z.ZodLiteral<"ficta">;
186
+ message: z.ZodString;
187
+ status: z.ZodLiteral<"forbidden">;
188
+ }, z.core.$strict>, z.ZodObject<{
189
+ ok: z.ZodLiteral<false>;
190
+ service: z.ZodLiteral<"ficta">;
191
+ message: z.ZodString;
192
+ status: z.ZodLiteral<"invalid_request">;
193
+ }, z.core.$strict>, z.ZodObject<{
194
+ ok: z.ZodLiteral<false>;
195
+ service: z.ZodLiteral<"ficta">;
196
+ message: z.ZodString;
197
+ status: z.ZodLiteral<"detector_unavailable">;
198
+ }, z.core.$strict>, z.ZodObject<{
199
+ ok: z.ZodLiteral<false>;
200
+ service: z.ZodLiteral<"ficta">;
201
+ message: z.ZodString;
202
+ status: z.ZodLiteral<"invariant">;
203
+ }, z.core.$strict>], "status">;
204
+ export type FictaCapabilities = z.output<typeof capabilitiesSchema>;
205
+ export type FictaHealth = z.output<typeof healthSchema>;
206
+ export type FictaProtectionStatus = z.output<typeof protectionStatusSchema>;
207
+ export type FictaProtectionPreviewInput = z.input<typeof protectionPreviewInputSchema>;
208
+ export type FictaProtectionPreview = z.output<typeof protectionPreviewSchema>;
209
+ export type FictaProtectionPreviewError = z.output<typeof protectionPreviewErrorSchema>;