@getglue/shared-types 2.1.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.d.ts +100 -0
- package/dist/annotation.d.ts.map +1 -0
- package/dist/annotation.js +3 -0
- package/dist/annotation.js.map +1 -0
- package/dist/element-ref.d.ts +83 -0
- package/dist/element-ref.d.ts.map +1 -0
- package/dist/element-ref.js +3 -0
- package/dist/element-ref.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { ElementRef } from './element-ref';
|
|
2
|
+
/**
|
|
3
|
+
* Structured comment types
|
|
4
|
+
*/
|
|
5
|
+
export type CommentKind = 'animation' | 'interaction' | 'style' | 'behavior' | 'general';
|
|
6
|
+
/**
|
|
7
|
+
* Structured comment data (optional, for AI parsing)
|
|
8
|
+
*/
|
|
9
|
+
export interface CommentStructured {
|
|
10
|
+
/** Comment kind */
|
|
11
|
+
kind?: CommentKind;
|
|
12
|
+
/** Trigger event (e.g., 'hover', 'click', 'scroll') */
|
|
13
|
+
trigger?: string;
|
|
14
|
+
/** Effect type (e.g., 'scale', 'fade', 'translate') */
|
|
15
|
+
effect?: string;
|
|
16
|
+
/** Effect value (effect-specific) */
|
|
17
|
+
value?: any;
|
|
18
|
+
/** Duration in milliseconds */
|
|
19
|
+
durationMs?: number;
|
|
20
|
+
/** Easing function */
|
|
21
|
+
easing?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Comment on a UI element
|
|
25
|
+
*
|
|
26
|
+
* This is the main annotation object stored by Glue.
|
|
27
|
+
*/
|
|
28
|
+
export interface Comment {
|
|
29
|
+
/** Unique identifier (UUID) */
|
|
30
|
+
id: string;
|
|
31
|
+
/** URL where the comment was created */
|
|
32
|
+
url: string;
|
|
33
|
+
/** Element reference with source location */
|
|
34
|
+
elementRef: ElementRef;
|
|
35
|
+
/** Comment text */
|
|
36
|
+
text: string;
|
|
37
|
+
/** Creation timestamp (ms since epoch) */
|
|
38
|
+
timestamp: number;
|
|
39
|
+
/** Whether the comment is resolved */
|
|
40
|
+
resolved?: boolean;
|
|
41
|
+
/** Last edited timestamp (ms since epoch) */
|
|
42
|
+
lastEdited?: number;
|
|
43
|
+
/** Optional structured comment data */
|
|
44
|
+
structured?: CommentStructured;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Comment storage structure
|
|
48
|
+
*/
|
|
49
|
+
export interface CommentStorage {
|
|
50
|
+
/** Storage format version */
|
|
51
|
+
version: string;
|
|
52
|
+
/** Comments grouped by URL */
|
|
53
|
+
comments: {
|
|
54
|
+
[url: string]: Comment[];
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Export format for agent consumption
|
|
59
|
+
*/
|
|
60
|
+
export interface AnnotationExport {
|
|
61
|
+
/** Annotation ID */
|
|
62
|
+
id: string;
|
|
63
|
+
/** URL where annotation was created */
|
|
64
|
+
url: string;
|
|
65
|
+
/** Creation timestamp (ISO 8601) */
|
|
66
|
+
createdAt: string;
|
|
67
|
+
/** Element reference */
|
|
68
|
+
elementRef: ElementRef;
|
|
69
|
+
/** Comment data */
|
|
70
|
+
comment: {
|
|
71
|
+
text: string;
|
|
72
|
+
kind?: CommentKind;
|
|
73
|
+
structured?: CommentStructured;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Export metadata
|
|
78
|
+
*/
|
|
79
|
+
export interface ExportMetadata {
|
|
80
|
+
/** Export timestamp (ISO 8601) */
|
|
81
|
+
exportedAt: string;
|
|
82
|
+
/** Storage format version */
|
|
83
|
+
version: string;
|
|
84
|
+
/** Tool name */
|
|
85
|
+
tool: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Full annotation export bundle
|
|
89
|
+
*/
|
|
90
|
+
export interface AnnotationBundle {
|
|
91
|
+
/** Success flag */
|
|
92
|
+
success: boolean;
|
|
93
|
+
/** Array of annotations */
|
|
94
|
+
annotations?: AnnotationExport[];
|
|
95
|
+
/** Export metadata */
|
|
96
|
+
metadata?: ExportMetadata;
|
|
97
|
+
/** Error message (if success = false) */
|
|
98
|
+
error?: string;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=annotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation.d.ts","sourceRoot":"","sources":["../src/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,mBAAmB;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,UAAU,EAAE,UAAU,CAAC;IACvB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,UAAU,CAAC,EAAE,iBAAiB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,QAAQ,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CAAC;KAC1B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,mBAAmB;IACnB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,WAAW,CAAC;QACnB,UAAU,CAAC,EAAE,iBAAiB,CAAC;KAChC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACjC,sBAAsB;IACtB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation.js","sourceRoot":"","sources":["../src/annotation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source location in code (file, line, column)
|
|
3
|
+
*/
|
|
4
|
+
export interface SourceLocation {
|
|
5
|
+
/** Relative file path (e.g., "src/components/Button.tsx") */
|
|
6
|
+
file: string;
|
|
7
|
+
/** Line number (1-indexed) */
|
|
8
|
+
line: number;
|
|
9
|
+
/** Column number (0-indexed) */
|
|
10
|
+
column: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Selector fallback types
|
|
14
|
+
*/
|
|
15
|
+
export type SelectorFallbackType = 'data-agent-id' | 'testid' | 'role' | 'css' | 'xpath';
|
|
16
|
+
/**
|
|
17
|
+
* A single selector fallback option
|
|
18
|
+
*/
|
|
19
|
+
export interface SelectorFallback {
|
|
20
|
+
/** Selector type */
|
|
21
|
+
type: SelectorFallbackType;
|
|
22
|
+
/** Selector value */
|
|
23
|
+
value: string;
|
|
24
|
+
/** Priority (higher = preferred, 100 = highest) */
|
|
25
|
+
priority: number;
|
|
26
|
+
/** ARIA role (for role selectors) */
|
|
27
|
+
role?: string;
|
|
28
|
+
/** Accessible name (for role selectors) */
|
|
29
|
+
accessibleName?: string;
|
|
30
|
+
/** Attribute name (for data attribute selectors) */
|
|
31
|
+
name?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Element context information
|
|
35
|
+
*/
|
|
36
|
+
export interface ElementContext {
|
|
37
|
+
/** HTML tag name (lowercase) */
|
|
38
|
+
tag: string;
|
|
39
|
+
/** Visible text content (truncated) */
|
|
40
|
+
text?: string;
|
|
41
|
+
/** Element bounding box */
|
|
42
|
+
bounds?: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
w: number;
|
|
46
|
+
h: number;
|
|
47
|
+
};
|
|
48
|
+
/** Element ID (if present) */
|
|
49
|
+
id?: string;
|
|
50
|
+
/** CSS classes */
|
|
51
|
+
classes?: string[];
|
|
52
|
+
/** Selected attributes */
|
|
53
|
+
attributes?: Record<string, string>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Primary selector type
|
|
57
|
+
*/
|
|
58
|
+
export type PrimarySelectorType = 'data-agent-id' | 'css' | 'xpath';
|
|
59
|
+
/**
|
|
60
|
+
* Primary selector
|
|
61
|
+
*/
|
|
62
|
+
export interface PrimarySelector {
|
|
63
|
+
/** Selector type */
|
|
64
|
+
type: PrimarySelectorType;
|
|
65
|
+
/** Selector value */
|
|
66
|
+
value: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Element reference with source location and fallback selectors
|
|
70
|
+
*
|
|
71
|
+
* This is the core schema for agent-ready annotations.
|
|
72
|
+
*/
|
|
73
|
+
export interface ElementRef {
|
|
74
|
+
/** Primary selector (most reliable) */
|
|
75
|
+
primary: PrimarySelector;
|
|
76
|
+
/** Source location (if available from instrumentation) */
|
|
77
|
+
source?: SourceLocation;
|
|
78
|
+
/** Fallback selectors (in priority order) */
|
|
79
|
+
fallbacks: SelectorFallback[];
|
|
80
|
+
/** Element context information */
|
|
81
|
+
context: ElementContext;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=element-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-ref.d.ts","sourceRoot":"","sources":["../src/element-ref.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB;IACpB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,MAAM,CAAC,EAAE;QACP,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IACF,8BAA8B;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kBAAkB;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,KAAK,GAAG,OAAO,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oBAAoB;IACpB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,OAAO,EAAE,eAAe,CAAC;IACzB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,6CAA6C;IAC7C,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,kCAAkC;IAClC,OAAO,EAAE,cAAc,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-ref.js","sourceRoot":"","sources":["../src/element-ref.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @glue/shared-types
|
|
3
|
+
*
|
|
4
|
+
* Shared TypeScript types for Glue annotation system
|
|
5
|
+
*/
|
|
6
|
+
export type { SourceLocation, SelectorFallback, SelectorFallbackType, ElementContext, PrimarySelector, PrimarySelectorType, ElementRef } from './element-ref';
|
|
7
|
+
export type { CommentKind, CommentStructured, Comment, CommentStorage, AnnotationExport, ExportMetadata, AnnotationBundle } from './annotation';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,UAAU,EACX,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EACjB,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getglue/shared-types",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Shared TypeScript types for Glue annotation system",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/billwithwillow/glue.git",
|
|
14
|
+
"directory": "packages/shared-types"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"watch": "tsc --watch",
|
|
22
|
+
"clean": "rm -rf dist"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"typescript",
|
|
26
|
+
"types",
|
|
27
|
+
"annotation",
|
|
28
|
+
"schema"
|
|
29
|
+
],
|
|
30
|
+
"author": "Tejas Priyadarshi",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typescript": "^5.3.3"
|
|
34
|
+
}
|
|
35
|
+
}
|