@sudobility/sider_types 0.0.3 → 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/api.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { EndpointGraphEdge, SafetyClass, SecretSlot, Site, ToolSpec, UXRecipe } from "./registry";
2
- import type { Observation, StepKind } from "./runtime";
1
+ import type { IsoTimestamp, JSONSchema } from "./common";
2
+ import type { EndpointGraphEdge, InvocationRecipe, SafetyClass, SecretSlot, Site, ToolSpec, ToolStatus, UXRecipe } from "./registry";
3
+ import type { CaptureBatch, Contributor, Observation, StepKind } from "./runtime";
3
4
  /** A planner decision (mirror of the ShapeShyft plan-next-step output). */
4
5
  export interface PlannerStep {
5
6
  kind: StepKind;
@@ -52,3 +53,68 @@ export interface StatsResponse {
52
53
  trustedToolCount: number;
53
54
  contributorCount: number;
54
55
  }
56
+ /** GET /api/v1/me — the signed-in contributor + aggregate counts. */
57
+ export interface MeResponse {
58
+ contributor: Contributor;
59
+ batchCount: number;
60
+ observationCount: number;
61
+ /** Tools this user has corroborated (cast a recipe vote on). */
62
+ toolsContributed: number;
63
+ /** Of those, how many are currently `trusted`. */
64
+ trustedToolsContributed: number;
65
+ }
66
+ /** One row of GET /api/v1/me/capture-batches. */
67
+ export interface MyCaptureBatchSummary extends CaptureBatch {
68
+ siteOrigin: string;
69
+ siteName: string;
70
+ }
71
+ /** GET /api/v1/me/capture-batches/:id — a batch plus its observations. */
72
+ export interface MyCaptureBatchDetail {
73
+ batch: MyCaptureBatchSummary;
74
+ observations: Observation[];
75
+ }
76
+ /** One row of GET /api/v1/me/tools — a tool this user corroborated. */
77
+ export interface MyToolEntry {
78
+ toolId: string;
79
+ siteId: string;
80
+ name: string;
81
+ status: ToolStatus;
82
+ safetyClass: SafetyClass;
83
+ version: number;
84
+ corroboratingUserCount: number;
85
+ /** Hash of MY independently-derived recipe. */
86
+ myRecipeHash: string;
87
+ /** Hash of the recipe currently stored on the tool. */
88
+ currentRecipeHash: string;
89
+ /** Whether my vote agrees with the stored recipe. */
90
+ agreesWithCurrent: boolean;
91
+ votedAt: IsoTimestamp;
92
+ }
93
+ /** GET /api/v1/tools/:id — full tool detail for the registry inspector. */
94
+ export interface ToolDetailResponse {
95
+ /** The tools table row (recipe, schema, safety, status, counts). */
96
+ tool: {
97
+ id: string;
98
+ siteId: string;
99
+ name: string;
100
+ description: string;
101
+ capabilityLabel: string;
102
+ inputSchema: JSONSchema;
103
+ safetyClass: SafetyClass;
104
+ directCallAvailable: boolean;
105
+ recipe: InvocationRecipe;
106
+ status: ToolStatus;
107
+ version: number;
108
+ observationCount: number;
109
+ corroboratingUserCount: number;
110
+ confidence: number;
111
+ createdAt: IsoTimestamp;
112
+ updatedAt: IsoTimestamp;
113
+ };
114
+ /** Anonymized corroboration breakdown: recipe hash → distinct-user count. */
115
+ corroboration: {
116
+ distinctUsers: number;
117
+ hashCounts: Record<string, number>;
118
+ trustThreshold: number;
119
+ };
120
+ }
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/sider_types",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "Shared domain types for Sider — AI assistance for generic web apps.",
5
5
  "license": "BUSL-1.1",
6
6
  "publishConfig": {
package/src/api.ts CHANGED
@@ -2,15 +2,18 @@
2
2
  // (to type its handlers) and sider_client (to type its calls). Keeping these
3
3
  // here is the single source of truth that stops the two sides from drifting.
4
4
 
5
+ import type { IsoTimestamp, JSONSchema } from "./common";
5
6
  import type {
6
7
  EndpointGraphEdge,
8
+ InvocationRecipe,
7
9
  SafetyClass,
8
10
  SecretSlot,
9
11
  Site,
10
12
  ToolSpec,
13
+ ToolStatus,
11
14
  UXRecipe,
12
15
  } from "./registry";
13
- import type { Observation, StepKind } from "./runtime";
16
+ import type { CaptureBatch, Contributor, Observation, StepKind } from "./runtime";
14
17
 
15
18
  /** A planner decision (mirror of the ShapeShyft plan-next-step output). */
16
19
  export interface PlannerStep {
@@ -66,3 +69,77 @@ export interface StatsResponse {
66
69
  trustedToolCount: number;
67
70
  contributorCount: number;
68
71
  }
72
+
73
+ // ---------------------------------------------------------------------------
74
+ // Dashboard DTOs (per-user + registry inspection). Spec 2026-07-20 §3.
75
+ // ---------------------------------------------------------------------------
76
+
77
+ /** GET /api/v1/me — the signed-in contributor + aggregate counts. */
78
+ export interface MeResponse {
79
+ contributor: Contributor;
80
+ batchCount: number;
81
+ observationCount: number;
82
+ /** Tools this user has corroborated (cast a recipe vote on). */
83
+ toolsContributed: number;
84
+ /** Of those, how many are currently `trusted`. */
85
+ trustedToolsContributed: number;
86
+ }
87
+
88
+ /** One row of GET /api/v1/me/capture-batches. */
89
+ export interface MyCaptureBatchSummary extends CaptureBatch {
90
+ siteOrigin: string;
91
+ siteName: string;
92
+ }
93
+
94
+ /** GET /api/v1/me/capture-batches/:id — a batch plus its observations. */
95
+ export interface MyCaptureBatchDetail {
96
+ batch: MyCaptureBatchSummary;
97
+ observations: Observation[];
98
+ }
99
+
100
+ /** One row of GET /api/v1/me/tools — a tool this user corroborated. */
101
+ export interface MyToolEntry {
102
+ toolId: string;
103
+ siteId: string;
104
+ name: string;
105
+ status: ToolStatus;
106
+ safetyClass: SafetyClass;
107
+ version: number;
108
+ corroboratingUserCount: number;
109
+ /** Hash of MY independently-derived recipe. */
110
+ myRecipeHash: string;
111
+ /** Hash of the recipe currently stored on the tool. */
112
+ currentRecipeHash: string;
113
+ /** Whether my vote agrees with the stored recipe. */
114
+ agreesWithCurrent: boolean;
115
+ votedAt: IsoTimestamp;
116
+ }
117
+
118
+ /** GET /api/v1/tools/:id — full tool detail for the registry inspector. */
119
+ export interface ToolDetailResponse {
120
+ /** The tools table row (recipe, schema, safety, status, counts). */
121
+ tool: {
122
+ id: string;
123
+ siteId: string;
124
+ name: string;
125
+ description: string;
126
+ capabilityLabel: string;
127
+ inputSchema: JSONSchema;
128
+ safetyClass: SafetyClass;
129
+ directCallAvailable: boolean;
130
+ recipe: InvocationRecipe;
131
+ status: ToolStatus;
132
+ version: number;
133
+ observationCount: number;
134
+ corroboratingUserCount: number;
135
+ confidence: number;
136
+ createdAt: IsoTimestamp;
137
+ updatedAt: IsoTimestamp;
138
+ };
139
+ /** Anonymized corroboration breakdown: recipe hash → distinct-user count. */
140
+ corroboration: {
141
+ distinctUsers: number;
142
+ hashCounts: Record<string, number>;
143
+ trustThreshold: number;
144
+ };
145
+ }
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
+ }