ghostfill 0.2.2
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 +260 -0
- package/dist/chunk-VMCU3BNJ.mjs +275 -0
- package/dist/chunk-VMCU3BNJ.mjs.map +1 -0
- package/dist/index.d.mts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +2149 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1901 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server.d.mts +12 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.js +165 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +15 -0
- package/dist/server.mjs.map +1 -0
- package/dist/types-B3DGbZyx.d.mts +83 -0
- package/dist/types-B3DGbZyx.d.ts +83 -0
- package/package.json +52 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Configuration options for GhostFill */
|
|
2
|
+
interface GhostFillOptions {
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Browser API keys are insecure and ignored.
|
|
5
|
+
* Configure `ai` and keep provider credentials on your backend instead.
|
|
6
|
+
*/
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
/** Keyboard shortcut to toggle GhostFill (default: "Alt+G") */
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
/** Custom system prompt to prepend */
|
|
11
|
+
systemPrompt?: string;
|
|
12
|
+
/** Secure AI transport configuration */
|
|
13
|
+
ai?: GhostFillAIOptions;
|
|
14
|
+
}
|
|
15
|
+
type Provider = "openai" | "xai" | "moonshot";
|
|
16
|
+
declare const PROVIDERS: Record<Provider, {
|
|
17
|
+
label: string;
|
|
18
|
+
model: string;
|
|
19
|
+
baseURL: string;
|
|
20
|
+
helpText: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** Non-secret field metadata sent to an AI backend */
|
|
23
|
+
interface GhostFillPromptField {
|
|
24
|
+
index: number;
|
|
25
|
+
type: string;
|
|
26
|
+
name: string;
|
|
27
|
+
label: string;
|
|
28
|
+
options?: string[];
|
|
29
|
+
required: boolean;
|
|
30
|
+
min?: string;
|
|
31
|
+
max?: string;
|
|
32
|
+
pattern?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Secure AI request payload for a backend route or callback */
|
|
35
|
+
interface GhostFillAIRequest {
|
|
36
|
+
provider: Provider;
|
|
37
|
+
prompt: string;
|
|
38
|
+
systemPrompt?: string;
|
|
39
|
+
fields: GhostFillPromptField[];
|
|
40
|
+
}
|
|
41
|
+
type GhostFillAIHandler = (request: GhostFillAIRequest) => Promise<FieldFillData[]>;
|
|
42
|
+
/** Secure AI configuration. Requests must go through a backend or custom handler. */
|
|
43
|
+
interface GhostFillAIOptions {
|
|
44
|
+
/** Same-origin backend route. Defaults to `/api/ghostfill` when `ai` is enabled. */
|
|
45
|
+
endpoint?: string;
|
|
46
|
+
/** Optional custom transport that forwards requests to a secure backend. */
|
|
47
|
+
requestFillData?: GhostFillAIHandler;
|
|
48
|
+
/** Default provider shown in the UI. */
|
|
49
|
+
provider?: Provider;
|
|
50
|
+
}
|
|
51
|
+
/** A detected form field */
|
|
52
|
+
interface DetectedField {
|
|
53
|
+
/** The DOM element */
|
|
54
|
+
element: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
55
|
+
/** Field type: text, email, number, select, textarea, checkbox, radio, date, etc. */
|
|
56
|
+
type: string;
|
|
57
|
+
/** Field name attribute */
|
|
58
|
+
name: string;
|
|
59
|
+
/** Field label (from <label>, aria-label, or placeholder) */
|
|
60
|
+
label: string;
|
|
61
|
+
/** For <select>, the available options */
|
|
62
|
+
options?: string[];
|
|
63
|
+
/** Whether the field is required */
|
|
64
|
+
required: boolean;
|
|
65
|
+
/** Current value */
|
|
66
|
+
currentValue: string;
|
|
67
|
+
/** Min/max for number/date fields */
|
|
68
|
+
min?: string;
|
|
69
|
+
max?: string;
|
|
70
|
+
/** Pattern attribute */
|
|
71
|
+
pattern?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Field data returned by the AI */
|
|
74
|
+
interface FieldFillData {
|
|
75
|
+
/** Index matching the DetectedField array */
|
|
76
|
+
index: number;
|
|
77
|
+
/** Value to fill */
|
|
78
|
+
value: string;
|
|
79
|
+
/** For checkboxes: whether to check */
|
|
80
|
+
checked?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { type DetectedField as D, type FieldFillData as F, type GhostFillAIOptions as G, type Provider as P, type GhostFillOptions as a, type GhostFillAIRequest as b, type GhostFillPromptField as c, PROVIDERS as d };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Configuration options for GhostFill */
|
|
2
|
+
interface GhostFillOptions {
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Browser API keys are insecure and ignored.
|
|
5
|
+
* Configure `ai` and keep provider credentials on your backend instead.
|
|
6
|
+
*/
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
/** Keyboard shortcut to toggle GhostFill (default: "Alt+G") */
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
/** Custom system prompt to prepend */
|
|
11
|
+
systemPrompt?: string;
|
|
12
|
+
/** Secure AI transport configuration */
|
|
13
|
+
ai?: GhostFillAIOptions;
|
|
14
|
+
}
|
|
15
|
+
type Provider = "openai" | "xai" | "moonshot";
|
|
16
|
+
declare const PROVIDERS: Record<Provider, {
|
|
17
|
+
label: string;
|
|
18
|
+
model: string;
|
|
19
|
+
baseURL: string;
|
|
20
|
+
helpText: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** Non-secret field metadata sent to an AI backend */
|
|
23
|
+
interface GhostFillPromptField {
|
|
24
|
+
index: number;
|
|
25
|
+
type: string;
|
|
26
|
+
name: string;
|
|
27
|
+
label: string;
|
|
28
|
+
options?: string[];
|
|
29
|
+
required: boolean;
|
|
30
|
+
min?: string;
|
|
31
|
+
max?: string;
|
|
32
|
+
pattern?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Secure AI request payload for a backend route or callback */
|
|
35
|
+
interface GhostFillAIRequest {
|
|
36
|
+
provider: Provider;
|
|
37
|
+
prompt: string;
|
|
38
|
+
systemPrompt?: string;
|
|
39
|
+
fields: GhostFillPromptField[];
|
|
40
|
+
}
|
|
41
|
+
type GhostFillAIHandler = (request: GhostFillAIRequest) => Promise<FieldFillData[]>;
|
|
42
|
+
/** Secure AI configuration. Requests must go through a backend or custom handler. */
|
|
43
|
+
interface GhostFillAIOptions {
|
|
44
|
+
/** Same-origin backend route. Defaults to `/api/ghostfill` when `ai` is enabled. */
|
|
45
|
+
endpoint?: string;
|
|
46
|
+
/** Optional custom transport that forwards requests to a secure backend. */
|
|
47
|
+
requestFillData?: GhostFillAIHandler;
|
|
48
|
+
/** Default provider shown in the UI. */
|
|
49
|
+
provider?: Provider;
|
|
50
|
+
}
|
|
51
|
+
/** A detected form field */
|
|
52
|
+
interface DetectedField {
|
|
53
|
+
/** The DOM element */
|
|
54
|
+
element: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
55
|
+
/** Field type: text, email, number, select, textarea, checkbox, radio, date, etc. */
|
|
56
|
+
type: string;
|
|
57
|
+
/** Field name attribute */
|
|
58
|
+
name: string;
|
|
59
|
+
/** Field label (from <label>, aria-label, or placeholder) */
|
|
60
|
+
label: string;
|
|
61
|
+
/** For <select>, the available options */
|
|
62
|
+
options?: string[];
|
|
63
|
+
/** Whether the field is required */
|
|
64
|
+
required: boolean;
|
|
65
|
+
/** Current value */
|
|
66
|
+
currentValue: string;
|
|
67
|
+
/** Min/max for number/date fields */
|
|
68
|
+
min?: string;
|
|
69
|
+
max?: string;
|
|
70
|
+
/** Pattern attribute */
|
|
71
|
+
pattern?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Field data returned by the AI */
|
|
74
|
+
interface FieldFillData {
|
|
75
|
+
/** Index matching the DetectedField array */
|
|
76
|
+
index: number;
|
|
77
|
+
/** Value to fill */
|
|
78
|
+
value: string;
|
|
79
|
+
/** For checkboxes: whether to check */
|
|
80
|
+
checked?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { type DetectedField as D, type FieldFillData as F, type GhostFillAIOptions as G, type Provider as P, type GhostFillOptions as a, type GhostFillAIRequest as b, type GhostFillPromptField as c, PROVIDERS as d };
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ghostfill",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "Stop demoing with test123. Realistic, domain-aware form data in one click.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./server": {
|
|
15
|
+
"types": "./dist/server.d.ts",
|
|
16
|
+
"import": "./dist/server.mjs",
|
|
17
|
+
"require": "./dist/server.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"dev": "tsup --watch",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"demo": "npx serve demo"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"form-filler",
|
|
32
|
+
"ai",
|
|
33
|
+
"openai",
|
|
34
|
+
"fake-data",
|
|
35
|
+
"testing",
|
|
36
|
+
"developer-tool"
|
|
37
|
+
],
|
|
38
|
+
"author": "afkhalid",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/afkhalid/ghostfill.git"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/afkhalid/ghostfill#readme",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/afkhalid/ghostfill/issues"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"tsup": "^8.0.0",
|
|
50
|
+
"typescript": "^5.4.0"
|
|
51
|
+
}
|
|
52
|
+
}
|