@webability/core 1.14.0 → 1.15.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.
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Thin client of the hosted FIX judge (POST /api/judge-fixes on the WebAbility
3
+ * platform).
4
+ *
5
+ * This file holds the wire contract and one `fetch`. It holds NO judge: the
6
+ * prompts, model routing, verdict rules, value correction and agent tools run
7
+ * on the platform and never ship in this package. A caller sends { url, fixes }
8
+ * and gets back a verdict per fix: whether the fix is needed and right
9
+ * (`apply`), a better value when the sent one is wrong, and a one-line reason.
10
+ *
11
+ * The platform answers only a user bearer token or the hosted MCP's
12
+ * `x-mcp-internal` secret. Any non-2xx is an error: the caller treats every
13
+ * fix of that call as unjudged (never as approved).
14
+ */
15
+ /** Fixes per request; the platform rejects more. */
16
+ declare const FIX_JUDGE_MAX_FIXES = 20;
17
+ interface FixJudgeFix {
18
+ issue_type: string;
19
+ selector: string;
20
+ /** The attribute the fix writes (alt, aria-label, title, ...). */
21
+ attr: string;
22
+ value: string;
23
+ }
24
+ interface FixJudgeRequest {
25
+ /** The public page the fixes were produced on; the platform loads it itself. */
26
+ url: string;
27
+ viewport?: {
28
+ width: number;
29
+ height: number;
30
+ };
31
+ fixes: FixJudgeFix[];
32
+ }
33
+ type FixJudgeVerdictKind = 'correct_needed' | 'correct_unneeded' | 'wrong_value' | 'harmful' | 'unclear';
34
+ interface FixJudgeVerdict {
35
+ /** Position of the fix in the request. */
36
+ index: number;
37
+ verdict: FixJudgeVerdictKind;
38
+ /** True only when the judge is sure the fix is needed and right as sent. */
39
+ apply: boolean;
40
+ /** wrong_value only: the value the judge says would be right. */
41
+ suggestedValue?: string;
42
+ /** One line. */
43
+ reason: string;
44
+ }
45
+ type FixJudgeTransport = (req: FixJudgeRequest, signal: AbortSignal) => Promise<{
46
+ verdicts: FixJudgeVerdict[];
47
+ }>;
48
+ declare class FixJudgeHttpError extends Error {
49
+ readonly status?: number | undefined;
50
+ constructor(message: string, status?: number | undefined);
51
+ }
52
+ /**
53
+ * Transport for the hosted fix judge. `token` is a user bearer; `mcpInternalSecret` is the
54
+ * hosted MCP's shared secret. Send one or both; with neither the platform answers 401.
55
+ */
56
+ declare function hostedFixJudgeTransport(cfg: {
57
+ apiUrl: string;
58
+ token?: string;
59
+ mcpInternalSecret?: string;
60
+ }): FixJudgeTransport;
61
+
62
+ export { FIX_JUDGE_MAX_FIXES as F, type FixJudgeFix as a, FixJudgeHttpError as b, type FixJudgeRequest as c, type FixJudgeTransport as d, type FixJudgeVerdict as e, type FixJudgeVerdictKind as f, hostedFixJudgeTransport as h };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Thin client of the hosted FIX judge (POST /api/judge-fixes on the WebAbility
3
+ * platform).
4
+ *
5
+ * This file holds the wire contract and one `fetch`. It holds NO judge: the
6
+ * prompts, model routing, verdict rules, value correction and agent tools run
7
+ * on the platform and never ship in this package. A caller sends { url, fixes }
8
+ * and gets back a verdict per fix: whether the fix is needed and right
9
+ * (`apply`), a better value when the sent one is wrong, and a one-line reason.
10
+ *
11
+ * The platform answers only a user bearer token or the hosted MCP's
12
+ * `x-mcp-internal` secret. Any non-2xx is an error: the caller treats every
13
+ * fix of that call as unjudged (never as approved).
14
+ */
15
+ /** Fixes per request; the platform rejects more. */
16
+ declare const FIX_JUDGE_MAX_FIXES = 20;
17
+ interface FixJudgeFix {
18
+ issue_type: string;
19
+ selector: string;
20
+ /** The attribute the fix writes (alt, aria-label, title, ...). */
21
+ attr: string;
22
+ value: string;
23
+ }
24
+ interface FixJudgeRequest {
25
+ /** The public page the fixes were produced on; the platform loads it itself. */
26
+ url: string;
27
+ viewport?: {
28
+ width: number;
29
+ height: number;
30
+ };
31
+ fixes: FixJudgeFix[];
32
+ }
33
+ type FixJudgeVerdictKind = 'correct_needed' | 'correct_unneeded' | 'wrong_value' | 'harmful' | 'unclear';
34
+ interface FixJudgeVerdict {
35
+ /** Position of the fix in the request. */
36
+ index: number;
37
+ verdict: FixJudgeVerdictKind;
38
+ /** True only when the judge is sure the fix is needed and right as sent. */
39
+ apply: boolean;
40
+ /** wrong_value only: the value the judge says would be right. */
41
+ suggestedValue?: string;
42
+ /** One line. */
43
+ reason: string;
44
+ }
45
+ type FixJudgeTransport = (req: FixJudgeRequest, signal: AbortSignal) => Promise<{
46
+ verdicts: FixJudgeVerdict[];
47
+ }>;
48
+ declare class FixJudgeHttpError extends Error {
49
+ readonly status?: number | undefined;
50
+ constructor(message: string, status?: number | undefined);
51
+ }
52
+ /**
53
+ * Transport for the hosted fix judge. `token` is a user bearer; `mcpInternalSecret` is the
54
+ * hosted MCP's shared secret. Send one or both; with neither the platform answers 401.
55
+ */
56
+ declare function hostedFixJudgeTransport(cfg: {
57
+ apiUrl: string;
58
+ token?: string;
59
+ mcpInternalSecret?: string;
60
+ }): FixJudgeTransport;
61
+
62
+ export { FIX_JUDGE_MAX_FIXES as F, type FixJudgeFix as a, FixJudgeHttpError as b, type FixJudgeRequest as c, type FixJudgeTransport as d, type FixJudgeVerdict as e, type FixJudgeVerdictKind as f, hostedFixJudgeTransport as h };