@sudobility/sider_types 0.0.5 → 0.0.6
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/observe.d.ts +46 -0
- package/dist/observe.js +8 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/observe.ts +56 -0
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type SnapshotActionKind = "navigate" | "submit" | "input" | "select" | "click";
|
|
2
|
+
/** A control's SHAPE. The graph hashes `tag|role|name|actionKind` into view identity. */
|
|
3
|
+
export interface SnapshotControl {
|
|
4
|
+
tag: string;
|
|
5
|
+
role?: string;
|
|
6
|
+
/** Accessible name, e.g. "Add to Cart". Plans reference controls by this. */
|
|
7
|
+
name?: string;
|
|
8
|
+
actionKind?: SnapshotActionKind;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A region of the page. Nesting matters: a region whose content-bearing children
|
|
12
|
+
* are all leaves sharing one shape collapses to a single repeat token, which is
|
|
13
|
+
* what stops a product list from changing the view's identity every time its
|
|
14
|
+
* contents change.
|
|
15
|
+
*/
|
|
16
|
+
export interface SnapshotRegion {
|
|
17
|
+
key: string;
|
|
18
|
+
role?: string;
|
|
19
|
+
controls?: SnapshotControl[];
|
|
20
|
+
children?: SnapshotRegion[];
|
|
21
|
+
}
|
|
22
|
+
export interface SnapshotLink {
|
|
23
|
+
toUrlPath: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface PageSnapshot {
|
|
27
|
+
/** Path with query VALUES dropped and keys kept: /search?q={q} */
|
|
28
|
+
urlPath: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
regions: SnapshotRegion[];
|
|
31
|
+
links: SnapshotLink[];
|
|
32
|
+
/** Structural text only — headings, control names, link labels, item titles. */
|
|
33
|
+
contentMd?: string;
|
|
34
|
+
/** How the agent arrived here, when known. */
|
|
35
|
+
trigger?: {
|
|
36
|
+
kind: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
} | null;
|
|
39
|
+
}
|
|
40
|
+
/** POST /api/v1/observe body. */
|
|
41
|
+
export interface ObserveBody {
|
|
42
|
+
/** Assistant thread id — correlates the snapshot with its run. */
|
|
43
|
+
threadId: string;
|
|
44
|
+
siteOrigin: string;
|
|
45
|
+
snapshot: PageSnapshot;
|
|
46
|
+
}
|
package/dist/observe.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The page-observation seam between sider_extension and sider_api.
|
|
2
|
+
//
|
|
3
|
+
// Deliberately absent: CSS selectors and page body prose. Selectors are
|
|
4
|
+
// regenerated per render and are useless to another user of the site; body prose
|
|
5
|
+
// is the current user's own data (order history, addresses) and the graph it
|
|
6
|
+
// would land in is shared with every other user of that site. Neither is omitted
|
|
7
|
+
// by a filter — neither exists in these types.
|
|
8
|
+
export {};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/observe.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// The page-observation seam between sider_extension and sider_api.
|
|
2
|
+
//
|
|
3
|
+
// Deliberately absent: CSS selectors and page body prose. Selectors are
|
|
4
|
+
// regenerated per render and are useless to another user of the site; body prose
|
|
5
|
+
// is the current user's own data (order history, addresses) and the graph it
|
|
6
|
+
// would land in is shared with every other user of that site. Neither is omitted
|
|
7
|
+
// by a filter — neither exists in these types.
|
|
8
|
+
|
|
9
|
+
export type SnapshotActionKind = "navigate" | "submit" | "input" | "select" | "click";
|
|
10
|
+
|
|
11
|
+
/** A control's SHAPE. The graph hashes `tag|role|name|actionKind` into view identity. */
|
|
12
|
+
export interface SnapshotControl {
|
|
13
|
+
tag: string;
|
|
14
|
+
role?: string;
|
|
15
|
+
/** Accessible name, e.g. "Add to Cart". Plans reference controls by this. */
|
|
16
|
+
name?: string;
|
|
17
|
+
actionKind?: SnapshotActionKind;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A region of the page. Nesting matters: a region whose content-bearing children
|
|
22
|
+
* are all leaves sharing one shape collapses to a single repeat token, which is
|
|
23
|
+
* what stops a product list from changing the view's identity every time its
|
|
24
|
+
* contents change.
|
|
25
|
+
*/
|
|
26
|
+
export interface SnapshotRegion {
|
|
27
|
+
key: string;
|
|
28
|
+
role?: string;
|
|
29
|
+
controls?: SnapshotControl[];
|
|
30
|
+
children?: SnapshotRegion[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface SnapshotLink {
|
|
34
|
+
toUrlPath: string;
|
|
35
|
+
label?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface PageSnapshot {
|
|
39
|
+
/** Path with query VALUES dropped and keys kept: /search?q={q} */
|
|
40
|
+
urlPath: string;
|
|
41
|
+
title?: string;
|
|
42
|
+
regions: SnapshotRegion[];
|
|
43
|
+
links: SnapshotLink[];
|
|
44
|
+
/** Structural text only — headings, control names, link labels, item titles. */
|
|
45
|
+
contentMd?: string;
|
|
46
|
+
/** How the agent arrived here, when known. */
|
|
47
|
+
trigger?: { kind: string; label?: string } | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** POST /api/v1/observe body. */
|
|
51
|
+
export interface ObserveBody {
|
|
52
|
+
/** Assistant thread id — correlates the snapshot with its run. */
|
|
53
|
+
threadId: string;
|
|
54
|
+
siteOrigin: string;
|
|
55
|
+
snapshot: PageSnapshot;
|
|
56
|
+
}
|