@spotpatch/shared 1.12.0 → 1.14.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/dist/annotation-Cz-NNgR4.d.cts +102 -0
- package/dist/annotation-Cz-NNgR4.d.ts +102 -0
- package/dist/chunk-CLQ6MIJB.js +586 -0
- package/dist/chunk-CLQ6MIJB.js.map +1 -0
- package/dist/chunk-EWJTKNL4.js +90 -0
- package/dist/chunk-EWJTKNL4.js.map +1 -0
- package/dist/{chunk-JGOIBOFI.js → chunk-FPDSZDP2.js} +16 -2
- package/dist/chunk-FPDSZDP2.js.map +1 -0
- package/dist/{chunk-2LVIH7OA.js → chunk-IX6MSCK6.js} +6 -2
- package/dist/chunk-IX6MSCK6.js.map +1 -0
- package/dist/{chunk-JU5HIWX7.js → chunk-JTZFOTPT.js} +9 -174
- package/dist/chunk-JTZFOTPT.js.map +1 -0
- package/dist/chunk-R6QJFNT2.js +195 -0
- package/dist/chunk-R6QJFNT2.js.map +1 -0
- package/dist/contextual-ask-BpbkpFFf.d.cts +1476 -0
- package/dist/contextual-ask-BpbkpFFf.d.ts +1476 -0
- package/dist/contextual-ask-browser.cjs +201 -0
- package/dist/contextual-ask-browser.cjs.map +1 -0
- package/dist/contextual-ask-browser.d.cts +31 -0
- package/dist/contextual-ask-browser.d.ts +31 -0
- package/dist/contextual-ask-browser.js +66 -0
- package/dist/contextual-ask-browser.js.map +1 -0
- package/dist/contextual-ask-node.cjs +971 -0
- package/dist/contextual-ask-node.cjs.map +1 -0
- package/dist/contextual-ask-node.d.cts +14 -0
- package/dist/contextual-ask-node.d.ts +14 -0
- package/dist/contextual-ask-node.js +122 -0
- package/dist/contextual-ask-node.js.map +1 -0
- package/dist/{data-flow-runtime-BelOgo8s.d.ts → data-flow-runtime-DhWpQoik.d.ts} +26 -13
- package/dist/{data-flow-runtime-oq9m21IP.d.cts → data-flow-runtime-w43iwvGA.d.cts} +26 -13
- package/dist/data-flow-runtime.cjs +2 -0
- package/dist/data-flow-runtime.cjs.map +1 -1
- package/dist/data-flow-runtime.d.cts +2 -2
- package/dist/data-flow-runtime.d.ts +2 -2
- package/dist/data-flow-runtime.js +1 -1
- package/dist/{endpoints-GedF44M2.d.cts → endpoints-O3ohYyAo.d.cts} +7 -1
- package/dist/{endpoints-GedF44M2.d.ts → endpoints-O3ohYyAo.d.ts} +7 -1
- package/dist/error-code-DRz2eqcB.d.cts +63 -0
- package/dist/error-code-DRz2eqcB.d.ts +63 -0
- package/dist/external-agent-node.cjs +320 -141
- package/dist/external-agent-node.cjs.map +1 -1
- package/dist/external-agent-node.d.cts +43 -27
- package/dist/external-agent-node.d.ts +43 -27
- package/dist/external-agent-node.js +174 -20
- package/dist/external-agent-node.js.map +1 -1
- package/dist/{external-handoff-BNUyMfNb.d.ts → external-handoff-5zHu-fz2.d.ts} +41 -131
- package/dist/{external-handoff-BNUyMfNb.d.cts → external-handoff-DeiIvR-2.d.cts} +41 -131
- package/dist/external-handoff-browser.cjs +7 -1
- package/dist/external-handoff-browser.cjs.map +1 -1
- package/dist/external-handoff-browser.d.cts +4 -3
- package/dist/external-handoff-browser.d.ts +4 -3
- package/dist/external-handoff-browser.js +2 -2
- package/dist/index.cjs +1170 -426
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -178
- package/dist/index.d.ts +138 -178
- package/dist/index.js +116 -20
- package/dist/index.js.map +1 -1
- package/package.json +29 -2
- package/dist/chunk-2LVIH7OA.js.map +0 -1
- package/dist/chunk-JGOIBOFI.js.map +0 -1
- package/dist/chunk-JU5HIWX7.js.map +0 -1
- package/dist/{external-agent-control-BMoSq_xI.d.cts → external-agent-control-C79Nl85y.d.cts} +49 -49
- package/dist/{external-agent-control-BMoSq_xI.d.ts → external-agent-control-C79Nl85y.d.ts} +49 -49
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
interface ContextBudget {
|
|
2
|
+
readonly totalCharacters: number;
|
|
3
|
+
readonly domCharacters: number;
|
|
4
|
+
readonly cssCharacters: number;
|
|
5
|
+
readonly codeCharacters: number;
|
|
6
|
+
readonly maxCodeLines: number;
|
|
7
|
+
readonly maxComponentDepth: number;
|
|
8
|
+
}
|
|
9
|
+
interface CodeContext {
|
|
10
|
+
readonly relativePath: string;
|
|
11
|
+
readonly language: "tsx" | "jsx" | "astro";
|
|
12
|
+
readonly startLine: number;
|
|
13
|
+
readonly endLine: number;
|
|
14
|
+
readonly excerpt: string;
|
|
15
|
+
readonly boundary: "component" | "nearby-lines";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type SourceConfidence = "exact" | "probable" | "approximate" | "unknown";
|
|
19
|
+
type SourceOrigin = "jsx-host" | "astro-host" | "react-fiber" | "dom-ancestor" | "none";
|
|
20
|
+
interface SourceRef {
|
|
21
|
+
readonly fileId?: string;
|
|
22
|
+
readonly relativePath?: string;
|
|
23
|
+
readonly line?: number;
|
|
24
|
+
readonly column?: number;
|
|
25
|
+
readonly origin: SourceOrigin;
|
|
26
|
+
readonly confidence: SourceConfidence;
|
|
27
|
+
}
|
|
28
|
+
interface ReactContext {
|
|
29
|
+
readonly supported: boolean;
|
|
30
|
+
readonly version?: string;
|
|
31
|
+
readonly componentName?: string;
|
|
32
|
+
readonly componentSourceId?: string;
|
|
33
|
+
readonly sourceVersion?: string;
|
|
34
|
+
readonly componentStack: readonly string[];
|
|
35
|
+
readonly source?: SourceRef;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface MatchedStyleRule {
|
|
39
|
+
readonly selector: string;
|
|
40
|
+
readonly declarations: string;
|
|
41
|
+
readonly source?: string;
|
|
42
|
+
readonly media?: string;
|
|
43
|
+
}
|
|
44
|
+
interface StyleContext {
|
|
45
|
+
readonly classNames: readonly string[];
|
|
46
|
+
readonly inlineStyle?: string;
|
|
47
|
+
readonly matchedRules: readonly MatchedStyleRule[];
|
|
48
|
+
readonly computed: Readonly<Record<string, string>>;
|
|
49
|
+
readonly warnings: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface PageContext {
|
|
53
|
+
readonly url: string;
|
|
54
|
+
readonly pathname: string;
|
|
55
|
+
readonly title: string;
|
|
56
|
+
readonly viewportWidth: number;
|
|
57
|
+
readonly viewportHeight: number;
|
|
58
|
+
readonly devicePixelRatio: number;
|
|
59
|
+
}
|
|
60
|
+
interface ElementContext {
|
|
61
|
+
readonly tagName: string;
|
|
62
|
+
readonly selector: string;
|
|
63
|
+
readonly sanitizedHtml: string;
|
|
64
|
+
readonly textPreview?: string;
|
|
65
|
+
readonly role?: string;
|
|
66
|
+
readonly rect: Readonly<{
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
/** Protocol hard limit. Runtime configuration may choose a smaller limit. */
|
|
74
|
+
declare const MAX_ANNOTATION_TARGETS = 20;
|
|
75
|
+
/** Each target owns its requested change; the UI enforces the same bound. */
|
|
76
|
+
declare const MAX_TARGET_INSTRUCTION_CHARACTERS = 2000;
|
|
77
|
+
/** Keeps the complete, atomic user intent within the prompt and request budgets. */
|
|
78
|
+
declare const MAX_ANNOTATION_INSTRUCTION_CHARACTERS = 4000;
|
|
79
|
+
declare const SPOTPATCH_LOCALES: readonly ["en-US", "zh-CN"];
|
|
80
|
+
type SpotPatchLocale = (typeof SPOTPATCH_LOCALES)[number];
|
|
81
|
+
declare const SPOTPATCH_LOCALE_PREFERENCES: readonly ["auto", "en-US", "zh-CN"];
|
|
82
|
+
type SpotPatchLocalePreference = (typeof SPOTPATCH_LOCALE_PREFERENCES)[number];
|
|
83
|
+
interface SpotTargetContext {
|
|
84
|
+
readonly instruction: string;
|
|
85
|
+
readonly page?: Readonly<PageContext>;
|
|
86
|
+
readonly source: SourceRef;
|
|
87
|
+
readonly react: ReactContext;
|
|
88
|
+
readonly element: ElementContext;
|
|
89
|
+
readonly styles: StyleContext;
|
|
90
|
+
readonly code?: CodeContext;
|
|
91
|
+
readonly warnings: readonly string[];
|
|
92
|
+
}
|
|
93
|
+
interface SpotAnnotation {
|
|
94
|
+
readonly schemaVersion: 3;
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly locale: SpotPatchLocale;
|
|
97
|
+
readonly page: Readonly<PageContext>;
|
|
98
|
+
readonly targets: readonly SpotTargetContext[];
|
|
99
|
+
readonly createdAt: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { type ContextBudget as C, type ElementContext as E, MAX_ANNOTATION_INSTRUCTION_CHARACTERS as M, type PageContext as P, type ReactContext as R, type SpotAnnotation as S, type SpotPatchLocale as a, SPOTPATCH_LOCALE_PREFERENCES as b, type CodeContext as c, MAX_ANNOTATION_TARGETS as d, MAX_TARGET_INSTRUCTION_CHARACTERS as e, type MatchedStyleRule as f, SPOTPATCH_LOCALES as g, type SourceConfidence as h, type SourceOrigin as i, type SourceRef as j, type SpotPatchLocalePreference as k, type SpotTargetContext as l, type StyleContext as m };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
interface ContextBudget {
|
|
2
|
+
readonly totalCharacters: number;
|
|
3
|
+
readonly domCharacters: number;
|
|
4
|
+
readonly cssCharacters: number;
|
|
5
|
+
readonly codeCharacters: number;
|
|
6
|
+
readonly maxCodeLines: number;
|
|
7
|
+
readonly maxComponentDepth: number;
|
|
8
|
+
}
|
|
9
|
+
interface CodeContext {
|
|
10
|
+
readonly relativePath: string;
|
|
11
|
+
readonly language: "tsx" | "jsx" | "astro";
|
|
12
|
+
readonly startLine: number;
|
|
13
|
+
readonly endLine: number;
|
|
14
|
+
readonly excerpt: string;
|
|
15
|
+
readonly boundary: "component" | "nearby-lines";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type SourceConfidence = "exact" | "probable" | "approximate" | "unknown";
|
|
19
|
+
type SourceOrigin = "jsx-host" | "astro-host" | "react-fiber" | "dom-ancestor" | "none";
|
|
20
|
+
interface SourceRef {
|
|
21
|
+
readonly fileId?: string;
|
|
22
|
+
readonly relativePath?: string;
|
|
23
|
+
readonly line?: number;
|
|
24
|
+
readonly column?: number;
|
|
25
|
+
readonly origin: SourceOrigin;
|
|
26
|
+
readonly confidence: SourceConfidence;
|
|
27
|
+
}
|
|
28
|
+
interface ReactContext {
|
|
29
|
+
readonly supported: boolean;
|
|
30
|
+
readonly version?: string;
|
|
31
|
+
readonly componentName?: string;
|
|
32
|
+
readonly componentSourceId?: string;
|
|
33
|
+
readonly sourceVersion?: string;
|
|
34
|
+
readonly componentStack: readonly string[];
|
|
35
|
+
readonly source?: SourceRef;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface MatchedStyleRule {
|
|
39
|
+
readonly selector: string;
|
|
40
|
+
readonly declarations: string;
|
|
41
|
+
readonly source?: string;
|
|
42
|
+
readonly media?: string;
|
|
43
|
+
}
|
|
44
|
+
interface StyleContext {
|
|
45
|
+
readonly classNames: readonly string[];
|
|
46
|
+
readonly inlineStyle?: string;
|
|
47
|
+
readonly matchedRules: readonly MatchedStyleRule[];
|
|
48
|
+
readonly computed: Readonly<Record<string, string>>;
|
|
49
|
+
readonly warnings: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface PageContext {
|
|
53
|
+
readonly url: string;
|
|
54
|
+
readonly pathname: string;
|
|
55
|
+
readonly title: string;
|
|
56
|
+
readonly viewportWidth: number;
|
|
57
|
+
readonly viewportHeight: number;
|
|
58
|
+
readonly devicePixelRatio: number;
|
|
59
|
+
}
|
|
60
|
+
interface ElementContext {
|
|
61
|
+
readonly tagName: string;
|
|
62
|
+
readonly selector: string;
|
|
63
|
+
readonly sanitizedHtml: string;
|
|
64
|
+
readonly textPreview?: string;
|
|
65
|
+
readonly role?: string;
|
|
66
|
+
readonly rect: Readonly<{
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
/** Protocol hard limit. Runtime configuration may choose a smaller limit. */
|
|
74
|
+
declare const MAX_ANNOTATION_TARGETS = 20;
|
|
75
|
+
/** Each target owns its requested change; the UI enforces the same bound. */
|
|
76
|
+
declare const MAX_TARGET_INSTRUCTION_CHARACTERS = 2000;
|
|
77
|
+
/** Keeps the complete, atomic user intent within the prompt and request budgets. */
|
|
78
|
+
declare const MAX_ANNOTATION_INSTRUCTION_CHARACTERS = 4000;
|
|
79
|
+
declare const SPOTPATCH_LOCALES: readonly ["en-US", "zh-CN"];
|
|
80
|
+
type SpotPatchLocale = (typeof SPOTPATCH_LOCALES)[number];
|
|
81
|
+
declare const SPOTPATCH_LOCALE_PREFERENCES: readonly ["auto", "en-US", "zh-CN"];
|
|
82
|
+
type SpotPatchLocalePreference = (typeof SPOTPATCH_LOCALE_PREFERENCES)[number];
|
|
83
|
+
interface SpotTargetContext {
|
|
84
|
+
readonly instruction: string;
|
|
85
|
+
readonly page?: Readonly<PageContext>;
|
|
86
|
+
readonly source: SourceRef;
|
|
87
|
+
readonly react: ReactContext;
|
|
88
|
+
readonly element: ElementContext;
|
|
89
|
+
readonly styles: StyleContext;
|
|
90
|
+
readonly code?: CodeContext;
|
|
91
|
+
readonly warnings: readonly string[];
|
|
92
|
+
}
|
|
93
|
+
interface SpotAnnotation {
|
|
94
|
+
readonly schemaVersion: 3;
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly locale: SpotPatchLocale;
|
|
97
|
+
readonly page: Readonly<PageContext>;
|
|
98
|
+
readonly targets: readonly SpotTargetContext[];
|
|
99
|
+
readonly createdAt: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export { type ContextBudget as C, type ElementContext as E, MAX_ANNOTATION_INSTRUCTION_CHARACTERS as M, type PageContext as P, type ReactContext as R, type SpotAnnotation as S, type SpotPatchLocale as a, SPOTPATCH_LOCALE_PREFERENCES as b, type CodeContext as c, MAX_ANNOTATION_TARGETS as d, MAX_TARGET_INSTRUCTION_CHARACTERS as e, type MatchedStyleRule as f, SPOTPATCH_LOCALES as g, type SourceConfidence as h, type SourceOrigin as i, type SourceRef as j, type SpotPatchLocalePreference as k, type SpotTargetContext as l, type StyleContext as m };
|