@sudobility/sider_types 0.0.5 → 0.0.8

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/actions.d.ts CHANGED
@@ -27,3 +27,31 @@ export interface ReadPageResult {
27
27
  items: ExtractedItem[];
28
28
  count: number;
29
29
  }
30
+ /**
31
+ * Icons a presented list may use.
32
+ *
33
+ * A closed set, not a free string: the panel maps each key to its own glyph, so
34
+ * the model cannot name an icon that does not exist or reach the DOM through it.
35
+ */
36
+ export declare const PRESENT_LIST_ICONS: readonly ["briefcase", "document", "location", "calendar", "tag", "person", "building", "cart", "star", "search"];
37
+ export type PresentListIcon = (typeof PRESENT_LIST_ICONS)[number];
38
+ /** One row of a presented list. */
39
+ export interface PresentedListItem {
40
+ title: string;
41
+ /** Short scalars shown under the title, e.g. ["Part time", "USF Hilltop Campus"]. */
42
+ meta?: string[];
43
+ /** Absolute URL, or a path resolved against the driven tab's origin. */
44
+ href?: string;
45
+ imageUrl?: string;
46
+ }
47
+ /**
48
+ * What the agent asks the panel to show.
49
+ *
50
+ * Data only — never markup. The agent decides WHAT matters; the panel decides
51
+ * how it looks.
52
+ */
53
+ export interface PresentedListSpec {
54
+ title?: string;
55
+ icon?: PresentListIcon;
56
+ items: PresentedListItem[];
57
+ }
package/dist/actions.js CHANGED
@@ -1,4 +1,21 @@
1
1
  // Structured results for the three model-facing browser actions (callSiderTool,
2
2
  // readPage, siderDomAction). One shape so the agent can aggregate outcomes and
3
3
  // report a status summary (e.g. "added 3/5; 2 pre-order only").
4
- export {};
4
+ /**
5
+ * Icons a presented list may use.
6
+ *
7
+ * A closed set, not a free string: the panel maps each key to its own glyph, so
8
+ * the model cannot name an icon that does not exist or reach the DOM through it.
9
+ */
10
+ export const PRESENT_LIST_ICONS = [
11
+ "briefcase",
12
+ "document",
13
+ "location",
14
+ "calendar",
15
+ "tag",
16
+ "person",
17
+ "building",
18
+ "cart",
19
+ "star",
20
+ "search",
21
+ ];
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from "./api";
6
6
  export * from "./actions";
7
7
  export * from "./templating";
8
8
  export * from "./recipe-hash";
9
+ export * from "./observe";
package/dist/index.js CHANGED
@@ -12,3 +12,4 @@ export * from "./api";
12
12
  export * from "./actions";
13
13
  export * from "./templating";
14
14
  export * from "./recipe-hash";
15
+ export * from "./observe";
@@ -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
+ }
@@ -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
@@ -1,23 +1,23 @@
1
1
  {
2
- "name": "@sudobility/sider_types",
3
- "version": "0.0.5",
4
- "description": "Shared domain types for Sider — AI assistance for generic web apps.",
5
- "license": "BUSL-1.1",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
- "type": "module",
10
- "main": "src/index.ts",
11
- "types": "src/index.ts",
12
- "files": [
13
- "src",
14
- "dist"
15
- ],
16
- "scripts": {
17
- "build": "tsc -p tsconfig.json",
18
- "typecheck": "tsc --noEmit"
19
- },
20
- "devDependencies": {
21
- "typescript": "^5.9.3"
22
- }
2
+ "name": "@sudobility/sider_types",
3
+ "version": "0.0.8",
4
+ "description": "Shared domain types for Sider — AI assistance for generic web apps.",
5
+ "license": "BUSL-1.1",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "type": "module",
10
+ "main": "src/index.ts",
11
+ "types": "src/index.ts",
12
+ "files": [
13
+ "src",
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.json",
18
+ "typecheck": "tsc --noEmit"
19
+ },
20
+ "devDependencies": {
21
+ "typescript": "^5.9.3"
22
+ }
23
23
  }
package/src/actions.ts CHANGED
@@ -41,3 +41,46 @@ export interface ReadPageResult {
41
41
  items: ExtractedItem[];
42
42
  count: number;
43
43
  }
44
+
45
+ /**
46
+ * Icons a presented list may use.
47
+ *
48
+ * A closed set, not a free string: the panel maps each key to its own glyph, so
49
+ * the model cannot name an icon that does not exist or reach the DOM through it.
50
+ */
51
+ export const PRESENT_LIST_ICONS = [
52
+ "briefcase",
53
+ "document",
54
+ "location",
55
+ "calendar",
56
+ "tag",
57
+ "person",
58
+ "building",
59
+ "cart",
60
+ "star",
61
+ "search",
62
+ ] as const;
63
+
64
+ export type PresentListIcon = (typeof PRESENT_LIST_ICONS)[number];
65
+
66
+ /** One row of a presented list. */
67
+ export interface PresentedListItem {
68
+ title: string;
69
+ /** Short scalars shown under the title, e.g. ["Part time", "USF Hilltop Campus"]. */
70
+ meta?: string[];
71
+ /** Absolute URL, or a path resolved against the driven tab's origin. */
72
+ href?: string;
73
+ imageUrl?: string;
74
+ }
75
+
76
+ /**
77
+ * What the agent asks the panel to show.
78
+ *
79
+ * Data only — never markup. The agent decides WHAT matters; the panel decides
80
+ * how it looks.
81
+ */
82
+ export interface PresentedListSpec {
83
+ title?: string;
84
+ icon?: PresentListIcon;
85
+ items: PresentedListItem[];
86
+ }
package/src/index.ts CHANGED
@@ -13,3 +13,4 @@ export * from "./api";
13
13
  export * from "./actions";
14
14
  export * from "./templating";
15
15
  export * from "./recipe-hash";
16
+ export * from "./observe";
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
+ }