@sudobility/sider_client 0.1.12 → 0.1.13

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/core.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export { SiderClient } from "./network/SiderClient";
2
+ export type { PointsSummary } from "./network/SiderClient";
2
3
  export { createFetchNetworkClient } from "./network/fetchClient";
3
4
  export type * from "@sudobility/sider_types";
package/dist/hooks.d.ts CHANGED
@@ -25,6 +25,13 @@ export declare function useMcpList(networkClient: NetworkClient, baseUrl: string
25
25
  offset?: number;
26
26
  q?: string;
27
27
  }, options?: QueryOpts<Awaited<ReturnType<SiderClient["listMcp"]>>>): import("@tanstack/react-query").UseQueryResult<NoInfer<import("./network/SiderClient").DirectoryPage>, Error>;
28
+ /**
29
+ * This contributor's points.
30
+ *
31
+ * Enabled only when signed in: the endpoint is authenticated, so calling it
32
+ * without a token buys a 401 on every mount.
33
+ */
34
+ export declare function usePoints(networkClient: NetworkClient, baseUrl: string, options?: QueryOpts<Awaited<ReturnType<SiderClient["points"]>>>): import("@tanstack/react-query").UseQueryResult<NoInfer<import("./core").PointsSummary>, Error>;
28
35
  export declare function useMcpManifest(networkClient: NetworkClient, baseUrl: string, host: string | null, options?: QueryOpts<Awaited<ReturnType<SiderClient["mcpManifest"]>>>): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
29
36
  export declare function useGraphList(networkClient: NetworkClient, baseUrl: string, params: {
30
37
  limit?: number;
package/dist/hooks.js CHANGED
@@ -132,6 +132,19 @@ export function useMcpList(networkClient, baseUrl, params, options) {
132
132
  ...options,
133
133
  });
134
134
  }
135
+ /**
136
+ * This contributor's points.
137
+ *
138
+ * Enabled only when signed in: the endpoint is authenticated, so calling it
139
+ * without a token buys a 401 on every mount.
140
+ */
141
+ export function usePoints(networkClient, baseUrl, options) {
142
+ return useQuery({
143
+ queryKey: ["sider", "points"],
144
+ queryFn: () => client(networkClient, baseUrl).points(),
145
+ ...options,
146
+ });
147
+ }
135
148
  export function useMcpManifest(networkClient, baseUrl, host, options) {
136
149
  return useQuery({
137
150
  queryKey: ["sider", "mcp", "manifest", host],
@@ -5,6 +5,12 @@ import type { CaptureRequest, CaptureResponse, EndpointGraphEdge, EndpointTempla
5
5
  * concern (e.g. auth_lib's Firebase Bearer client); this class only builds
6
6
  * URLs and unwraps the ApiResponse envelope.
7
7
  */
8
+ /** Points earned for contributing training data. */
9
+ export interface PointsSummary {
10
+ total: number;
11
+ /** How many pages this contributor was first to land on. */
12
+ newPages: number;
13
+ }
8
14
  export declare class SiderClient {
9
15
  private readonly network;
10
16
  private readonly baseUrl;
@@ -28,6 +34,14 @@ export declare class SiderClient {
28
34
  getSiteSlots(siteId: string): Promise<SecretSlot[]>;
29
35
  getSiteGraph(siteId: string): Promise<EndpointGraphEdge[]>;
30
36
  getToolDetail(toolId: string): Promise<ToolDetailResponse>;
37
+ /**
38
+ * What this contributor has earned.
39
+ *
40
+ * Authenticated, and always about the caller: the server reads the
41
+ * contributor from the verified token, so there is no parameter to pass and
42
+ * no way to ask about anybody else.
43
+ */
44
+ points(): Promise<PointsSummary>;
31
45
  listMcp(params: {
32
46
  limit?: number;
33
47
  offset?: number;
@@ -1,8 +1,3 @@
1
- /**
2
- * Typed wrapper over the Sider API. Auth is the injected NetworkClient's
3
- * concern (e.g. auth_lib's Firebase Bearer client); this class only builds
4
- * URLs and unwraps the ApiResponse envelope.
5
- */
6
1
  export class SiderClient {
7
2
  network;
8
3
  baseUrl;
@@ -68,6 +63,16 @@ export class SiderClient {
68
63
  getToolDetail(toolId) {
69
64
  return this.get(`/api/v1/tools/${toolId}`);
70
65
  }
66
+ /**
67
+ * What this contributor has earned.
68
+ *
69
+ * Authenticated, and always about the caller: the server reads the
70
+ * contributor from the verified token, so there is no parameter to pass and
71
+ * no way to ask about anybody else.
72
+ */
73
+ points() {
74
+ return this.get("/api/v1/points");
75
+ }
71
76
  // --- public directories of what the graph knows -------------------------
72
77
  listMcp(params) {
73
78
  return this.get(`/api/v1/mcp${queryString(params)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/sider_client",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Sider frontend network library — injected NetworkClient + React Query hooks.",
5
5
  "license": "BUSL-1.1",
6
6
  "publishConfig": {
package/src/core.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  // React-free entry for service workers / non-React contexts.
2
2
  export { SiderClient } from "./network/SiderClient";
3
+ export type { PointsSummary } from "./network/SiderClient";
3
4
  export { createFetchNetworkClient } from "./network/fetchClient";
4
5
  export type * from "@sudobility/sider_types";
package/src/hooks.ts CHANGED
@@ -228,6 +228,24 @@ export function useMcpList(
228
228
  });
229
229
  }
230
230
 
231
+ /**
232
+ * This contributor's points.
233
+ *
234
+ * Enabled only when signed in: the endpoint is authenticated, so calling it
235
+ * without a token buys a 401 on every mount.
236
+ */
237
+ export function usePoints(
238
+ networkClient: NetworkClient,
239
+ baseUrl: string,
240
+ options?: QueryOpts<Awaited<ReturnType<SiderClient["points"]>>>,
241
+ ) {
242
+ return useQuery({
243
+ queryKey: ["sider", "points"],
244
+ queryFn: () => client(networkClient, baseUrl).points(),
245
+ ...options,
246
+ });
247
+ }
248
+
231
249
  export function useMcpManifest(
232
250
  networkClient: NetworkClient,
233
251
  baseUrl: string,
@@ -22,6 +22,13 @@ import type {
22
22
  * concern (e.g. auth_lib's Firebase Bearer client); this class only builds
23
23
  * URLs and unwraps the ApiResponse envelope.
24
24
  */
25
+ /** Points earned for contributing training data. */
26
+ export interface PointsSummary {
27
+ total: number;
28
+ /** How many pages this contributor was first to land on. */
29
+ newPages: number;
30
+ }
31
+
25
32
  export class SiderClient {
26
33
  constructor(
27
34
  private readonly network: NetworkClient,
@@ -107,6 +114,17 @@ export class SiderClient {
107
114
  return this.get(`/api/v1/tools/${toolId}`);
108
115
  }
109
116
 
117
+ /**
118
+ * What this contributor has earned.
119
+ *
120
+ * Authenticated, and always about the caller: the server reads the
121
+ * contributor from the verified token, so there is no parameter to pass and
122
+ * no way to ask about anybody else.
123
+ */
124
+ points(): Promise<PointsSummary> {
125
+ return this.get("/api/v1/points");
126
+ }
127
+
110
128
  // --- public directories of what the graph knows -------------------------
111
129
 
112
130
  listMcp(params: { limit?: number; offset?: number; q?: string }): Promise<DirectoryPage> {