@lightsage/mcp 0.4.15 → 0.4.17

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.
Files changed (213) hide show
  1. package/README.md +2 -2
  2. package/api/mcp.js +30 -0
  3. package/bin/mcp-server.js +1766 -510
  4. package/bin/mcp-server.js.map +56 -25
  5. package/esm/funcs/agentAnalyticsCountriesList.d.ts +16 -0
  6. package/esm/funcs/agentAnalyticsCountriesList.d.ts.map +1 -0
  7. package/esm/funcs/agentAnalyticsCountriesList.js +94 -0
  8. package/esm/funcs/agentAnalyticsCountriesList.js.map +1 -0
  9. package/esm/funcs/agentAnalyticsErrorPagesList.d.ts +16 -0
  10. package/esm/funcs/agentAnalyticsErrorPagesList.d.ts.map +1 -0
  11. package/esm/funcs/agentAnalyticsErrorPagesList.js +96 -0
  12. package/esm/funcs/agentAnalyticsErrorPagesList.js.map +1 -0
  13. package/esm/funcs/agentAnalyticsPagesList.d.ts +16 -0
  14. package/esm/funcs/agentAnalyticsPagesList.d.ts.map +1 -0
  15. package/esm/funcs/agentAnalyticsPagesList.js +98 -0
  16. package/esm/funcs/agentAnalyticsPagesList.js.map +1 -0
  17. package/esm/funcs/agentAnalyticsSitesList.d.ts +15 -0
  18. package/esm/funcs/agentAnalyticsSitesList.d.ts.map +1 -0
  19. package/esm/funcs/agentAnalyticsSitesList.js +72 -0
  20. package/esm/funcs/agentAnalyticsSitesList.js.map +1 -0
  21. package/esm/funcs/agentAnalyticsSourcesList.d.ts +16 -0
  22. package/esm/funcs/agentAnalyticsSourcesList.d.ts.map +1 -0
  23. package/esm/funcs/agentAnalyticsSourcesList.js +93 -0
  24. package/esm/funcs/agentAnalyticsSourcesList.js.map +1 -0
  25. package/esm/funcs/agentAnalyticsSummaryRetrieve.d.ts +16 -0
  26. package/esm/funcs/agentAnalyticsSummaryRetrieve.d.ts.map +1 -0
  27. package/esm/funcs/agentAnalyticsSummaryRetrieve.js +93 -0
  28. package/esm/funcs/agentAnalyticsSummaryRetrieve.js.map +1 -0
  29. package/esm/funcs/tasksCreate.d.ts +16 -0
  30. package/esm/funcs/tasksCreate.d.ts.map +1 -0
  31. package/esm/funcs/tasksCreate.js +83 -0
  32. package/esm/funcs/tasksCreate.js.map +1 -0
  33. package/esm/landing-page.js +1 -1
  34. package/esm/lib/config.d.ts +2 -2
  35. package/esm/lib/config.js +2 -2
  36. package/esm/mcp-server/mcp-server.js +1 -1
  37. package/esm/mcp-server/server.d.ts.map +1 -1
  38. package/esm/mcp-server/server.js +15 -1
  39. package/esm/mcp-server/server.js.map +1 -1
  40. package/esm/mcp-server/tools/agentAnalyticsCountriesList.d.ts +7 -0
  41. package/esm/mcp-server/tools/agentAnalyticsCountriesList.d.ts.map +1 -0
  42. package/esm/mcp-server/tools/agentAnalyticsCountriesList.js +35 -0
  43. package/esm/mcp-server/tools/agentAnalyticsCountriesList.js.map +1 -0
  44. package/esm/mcp-server/tools/agentAnalyticsErrorPagesList.d.ts +7 -0
  45. package/esm/mcp-server/tools/agentAnalyticsErrorPagesList.d.ts.map +1 -0
  46. package/esm/mcp-server/tools/agentAnalyticsErrorPagesList.js +35 -0
  47. package/esm/mcp-server/tools/agentAnalyticsErrorPagesList.js.map +1 -0
  48. package/esm/mcp-server/tools/agentAnalyticsPagesList.d.ts +7 -0
  49. package/esm/mcp-server/tools/agentAnalyticsPagesList.d.ts.map +1 -0
  50. package/esm/mcp-server/tools/agentAnalyticsPagesList.js +35 -0
  51. package/esm/mcp-server/tools/agentAnalyticsPagesList.js.map +1 -0
  52. package/esm/mcp-server/tools/agentAnalyticsSitesList.d.ts +3 -0
  53. package/esm/mcp-server/tools/agentAnalyticsSitesList.d.ts.map +1 -0
  54. package/esm/mcp-server/tools/agentAnalyticsSitesList.js +30 -0
  55. package/esm/mcp-server/tools/agentAnalyticsSitesList.js.map +1 -0
  56. package/esm/mcp-server/tools/agentAnalyticsSourcesList.d.ts +7 -0
  57. package/esm/mcp-server/tools/agentAnalyticsSourcesList.d.ts.map +1 -0
  58. package/esm/mcp-server/tools/agentAnalyticsSourcesList.js +35 -0
  59. package/esm/mcp-server/tools/agentAnalyticsSourcesList.js.map +1 -0
  60. package/esm/mcp-server/tools/agentAnalyticsSummaryRetrieve.d.ts +7 -0
  61. package/esm/mcp-server/tools/agentAnalyticsSummaryRetrieve.d.ts.map +1 -0
  62. package/esm/mcp-server/tools/agentAnalyticsSummaryRetrieve.js +35 -0
  63. package/esm/mcp-server/tools/agentAnalyticsSummaryRetrieve.js.map +1 -0
  64. package/esm/mcp-server/tools/tasksCreate.d.ts +7 -0
  65. package/esm/mcp-server/tools/tasksCreate.d.ts.map +1 -0
  66. package/esm/mcp-server/tools/tasksCreate.js +35 -0
  67. package/esm/mcp-server/tools/tasksCreate.js.map +1 -0
  68. package/esm/models/createtaskrequest.d.ts +65 -0
  69. package/esm/models/createtaskrequest.d.ts.map +1 -0
  70. package/esm/models/createtaskrequest.js +64 -0
  71. package/esm/models/createtaskrequest.js.map +1 -0
  72. package/esm/models/graderdefinition.d.ts +15 -0
  73. package/esm/models/graderdefinition.d.ts.map +1 -1
  74. package/esm/models/graderdefinition.js +13 -0
  75. package/esm/models/graderdefinition.js.map +1 -1
  76. package/esm/models/publicagentanalyticscountrylistresponse.d.ts +10 -0
  77. package/esm/models/publicagentanalyticscountrylistresponse.d.ts.map +1 -0
  78. package/esm/models/publicagentanalyticscountrylistresponse.js +13 -0
  79. package/esm/models/publicagentanalyticscountrylistresponse.js.map +1 -0
  80. package/esm/models/publicagentanalyticserrorpagelistresponse.d.ts +11 -0
  81. package/esm/models/publicagentanalyticserrorpagelistresponse.d.ts.map +1 -0
  82. package/esm/models/publicagentanalyticserrorpagelistresponse.js +14 -0
  83. package/esm/models/publicagentanalyticserrorpagelistresponse.js.map +1 -0
  84. package/esm/models/publicagentanalyticspagelistresponse.d.ts +11 -0
  85. package/esm/models/publicagentanalyticspagelistresponse.d.ts.map +1 -0
  86. package/esm/models/publicagentanalyticspagelistresponse.js +14 -0
  87. package/esm/models/publicagentanalyticspagelistresponse.js.map +1 -0
  88. package/esm/models/publicagentanalyticssite.d.ts +9 -0
  89. package/esm/models/publicagentanalyticssite.d.ts.map +1 -0
  90. package/esm/models/publicagentanalyticssite.js +12 -0
  91. package/esm/models/publicagentanalyticssite.js.map +1 -0
  92. package/esm/models/publicagentanalyticssitelistresponse.d.ts +7 -0
  93. package/esm/models/publicagentanalyticssitelistresponse.d.ts.map +1 -0
  94. package/esm/models/publicagentanalyticssitelistresponse.js +10 -0
  95. package/esm/models/publicagentanalyticssitelistresponse.js.map +1 -0
  96. package/esm/models/publicagentanalyticssourcelistresponse.d.ts +10 -0
  97. package/esm/models/publicagentanalyticssourcelistresponse.d.ts.map +1 -0
  98. package/esm/models/publicagentanalyticssourcelistresponse.js +13 -0
  99. package/esm/models/publicagentanalyticssourcelistresponse.js.map +1 -0
  100. package/esm/models/publicagentanalyticssummary.d.ts +11 -0
  101. package/esm/models/publicagentanalyticssummary.d.ts.map +1 -0
  102. package/esm/models/publicagentanalyticssummary.js +14 -0
  103. package/esm/models/publicagentanalyticssummary.js.map +1 -0
  104. package/esm/models/publicagentcountry.d.ts +7 -0
  105. package/esm/models/publicagentcountry.d.ts.map +1 -0
  106. package/esm/models/publicagentcountry.js +11 -0
  107. package/esm/models/publicagentcountry.js.map +1 -0
  108. package/esm/models/publicagenterrorpage.d.ts +12 -0
  109. package/esm/models/publicagenterrorpage.d.ts.map +1 -0
  110. package/esm/models/publicagenterrorpage.js +16 -0
  111. package/esm/models/publicagenterrorpage.js.map +1 -0
  112. package/esm/models/publicagenterrorsource.d.ts +40 -0
  113. package/esm/models/publicagenterrorsource.d.ts.map +1 -0
  114. package/esm/models/publicagenterrorsource.js +40 -0
  115. package/esm/models/publicagenterrorsource.js.map +1 -0
  116. package/esm/models/publicagenttrafficpage.d.ts +14 -0
  117. package/esm/models/publicagenttrafficpage.d.ts.map +1 -0
  118. package/esm/models/publicagenttrafficpage.js +17 -0
  119. package/esm/models/publicagenttrafficpage.js.map +1 -0
  120. package/esm/models/publicagenttrafficsource.d.ts +47 -0
  121. package/esm/models/publicagenttrafficsource.d.ts.map +1 -0
  122. package/esm/models/publicagenttrafficsource.js +44 -0
  123. package/esm/models/publicagenttrafficsource.js.map +1 -0
  124. package/esm/models/publicagenttraffictotals.d.ts +13 -0
  125. package/esm/models/publicagenttraffictotals.d.ts.map +1 -0
  126. package/esm/models/publicagenttraffictotals.js +16 -0
  127. package/esm/models/publicagenttraffictotals.js.map +1 -0
  128. package/esm/models/updatetaskrequest.d.ts +8 -8
  129. package/esm/models/updatetaskrequest.d.ts.map +1 -1
  130. package/esm/models/updatetaskrequest.js +6 -6
  131. package/esm/models/updatetaskrequest.js.map +1 -1
  132. package/esm/models/v2agentanalyticscountrieslistop.d.ts +13 -0
  133. package/esm/models/v2agentanalyticscountrieslistop.d.ts.map +1 -0
  134. package/esm/models/v2agentanalyticscountrieslistop.js +18 -0
  135. package/esm/models/v2agentanalyticscountrieslistop.js.map +1 -0
  136. package/esm/models/v2agentanalyticserrorpageslistop.d.ts +39 -0
  137. package/esm/models/v2agentanalyticserrorpageslistop.d.ts.map +1 -0
  138. package/esm/models/v2agentanalyticserrorpageslistop.js +39 -0
  139. package/esm/models/v2agentanalyticserrorpageslistop.js.map +1 -0
  140. package/esm/models/v2agentanalyticspageslistop.d.ts +68 -0
  141. package/esm/models/v2agentanalyticspageslistop.d.ts.map +1 -0
  142. package/esm/models/v2agentanalyticspageslistop.js +65 -0
  143. package/esm/models/v2agentanalyticspageslistop.js.map +1 -0
  144. package/esm/models/v2agentanalyticssourceslistop.d.ts +12 -0
  145. package/esm/models/v2agentanalyticssourceslistop.d.ts.map +1 -0
  146. package/esm/models/v2agentanalyticssourceslistop.js +17 -0
  147. package/esm/models/v2agentanalyticssourceslistop.js.map +1 -0
  148. package/esm/models/v2agentanalyticssummaryretrieveop.d.ts +12 -0
  149. package/esm/models/v2agentanalyticssummaryretrieveop.d.ts.map +1 -0
  150. package/esm/models/v2agentanalyticssummaryretrieveop.js +17 -0
  151. package/esm/models/v2agentanalyticssummaryretrieveop.js.map +1 -0
  152. package/esm/models/v2inlinemcpdefinition.js +1 -1
  153. package/esm/models/v2inlinemcpdefinition.js.map +1 -1
  154. package/esm/models/v2publictask.js +1 -1
  155. package/esm/models/v2publictask.js.map +1 -1
  156. package/esm/models/v2repository.d.ts +4 -4
  157. package/esm/models/v2repository.d.ts.map +1 -1
  158. package/esm/models/v2repository.js +3 -3
  159. package/esm/models/v2repository.js.map +1 -1
  160. package/esm/models/v2taskscreateop.d.ts +13 -0
  161. package/esm/models/v2taskscreateop.d.ts.map +1 -0
  162. package/esm/models/v2taskscreateop.js +16 -0
  163. package/esm/models/v2taskscreateop.js.map +1 -0
  164. package/esm/tool-names.d.ts.map +1 -1
  165. package/esm/tool-names.js +28 -0
  166. package/esm/tool-names.js.map +1 -1
  167. package/lib/tracker.js +219 -0
  168. package/package.json +3 -1
  169. package/src/funcs/agentAnalyticsCountriesList.ts +159 -0
  170. package/src/funcs/agentAnalyticsErrorPagesList.ts +161 -0
  171. package/src/funcs/agentAnalyticsPagesList.ts +163 -0
  172. package/src/funcs/agentAnalyticsSitesList.ts +124 -0
  173. package/src/funcs/agentAnalyticsSourcesList.ts +158 -0
  174. package/src/funcs/agentAnalyticsSummaryRetrieve.ts +158 -0
  175. package/src/funcs/tasksCreate.ts +145 -0
  176. package/src/landing-page.ts +1 -1
  177. package/src/lib/config.ts +2 -2
  178. package/src/mcp-server/mcp-server.ts +1 -1
  179. package/src/mcp-server/server.ts +15 -1
  180. package/src/mcp-server/tools/agentAnalyticsCountriesList.ts +43 -0
  181. package/src/mcp-server/tools/agentAnalyticsErrorPagesList.ts +43 -0
  182. package/src/mcp-server/tools/agentAnalyticsPagesList.ts +43 -0
  183. package/src/mcp-server/tools/agentAnalyticsSitesList.ts +36 -0
  184. package/src/mcp-server/tools/agentAnalyticsSourcesList.ts +43 -0
  185. package/src/mcp-server/tools/agentAnalyticsSummaryRetrieve.ts +43 -0
  186. package/src/mcp-server/tools/tasksCreate.ts +43 -0
  187. package/src/models/createtaskrequest.ts +98 -0
  188. package/src/models/graderdefinition.ts +20 -0
  189. package/src/models/publicagentanalyticscountrylistresponse.ts +28 -0
  190. package/src/models/publicagentanalyticserrorpagelistresponse.ts +32 -0
  191. package/src/models/publicagentanalyticspagelistresponse.ts +30 -0
  192. package/src/models/publicagentanalyticssite.ts +26 -0
  193. package/src/models/publicagentanalyticssitelistresponse.ts +20 -0
  194. package/src/models/publicagentanalyticssourcelistresponse.ts +28 -0
  195. package/src/models/publicagentanalyticssummary.ts +28 -0
  196. package/src/models/publicagentcountry.ts +16 -0
  197. package/src/models/publicagenterrorpage.ts +35 -0
  198. package/src/models/publicagenterrorsource.ts +63 -0
  199. package/src/models/publicagenttrafficpage.ts +46 -0
  200. package/src/models/publicagenttrafficsource.ts +77 -0
  201. package/src/models/publicagenttraffictotals.ts +42 -0
  202. package/src/models/updatetaskrequest.ts +14 -10
  203. package/src/models/v2agentanalyticscountrieslistop.ts +45 -0
  204. package/src/models/v2agentanalyticserrorpageslistop.ts +79 -0
  205. package/src/models/v2agentanalyticspageslistop.ts +119 -0
  206. package/src/models/v2agentanalyticssourceslistop.ts +43 -0
  207. package/src/models/v2agentanalyticssummaryretrieveop.ts +43 -0
  208. package/src/models/v2inlinemcpdefinition.ts +1 -1
  209. package/src/models/v2publictask.ts +1 -1
  210. package/src/models/v2repository.ts +5 -5
  211. package/src/models/v2taskscreateop.ts +34 -0
  212. package/src/tool-names.ts +28 -0
  213. package/test/tracker.test.js +323 -0
@@ -0,0 +1,159 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: ccea98d3ab49
4
+ */
5
+
6
+ import { LightsageMcpCore } from "../core.js";
7
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { APIError } from "../models/errors/apierror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import {
23
+ V2AgentAnalyticsCountriesListRequest,
24
+ V2AgentAnalyticsCountriesListRequest$zodSchema,
25
+ } from "../models/v2agentanalyticscountrieslistop.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List Agent Analytics Countries
31
+ *
32
+ * @remarks
33
+ * Returns a site's visits from coding agents and AI assistants per country in the date range, most visits first.
34
+ */
35
+ export function agentAnalyticsCountriesList(
36
+ client$: LightsageMcpCore,
37
+ request: V2AgentAnalyticsCountriesListRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ Response,
42
+ | APIError
43
+ | SDKValidationError
44
+ | UnexpectedClientError
45
+ | InvalidRequestError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | ConnectionError
49
+ >
50
+ > {
51
+ return new APIPromise($do(
52
+ client$,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ async function $do(
59
+ client$: LightsageMcpCore,
60
+ request: V2AgentAnalyticsCountriesListRequest,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ Response,
66
+ | APIError
67
+ | SDKValidationError
68
+ | UnexpectedClientError
69
+ | InvalidRequestError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | ConnectionError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed$ = safeParse(
78
+ request,
79
+ (value$) => V2AgentAnalyticsCountriesListRequest$zodSchema.parse(value$),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed$.ok) {
83
+ return [parsed$, { status: "invalid" }];
84
+ }
85
+ const payload$ = parsed$.value;
86
+ const body$ = null;
87
+
88
+ const pathParams$ = {
89
+ site_id: encodeSimple("site_id", payload$.site_id, {
90
+ explode: false,
91
+ charEncoding: "percent",
92
+ }),
93
+ };
94
+ const path$ = pathToFunc("/v2/agent-analytics/sites/{site_id}/countries")(
95
+ pathParams$,
96
+ );
97
+ const query$ = encodeFormQuery({
98
+ "end_date": payload$.end_date,
99
+ "limit": payload$.limit,
100
+ "start_date": payload$.start_date,
101
+ });
102
+
103
+ const headers$ = new Headers(compactMap({
104
+ Accept: "application/json",
105
+ }));
106
+ const securityInput = await extractSecurity(client$._options.security);
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client$._options,
111
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
112
+ operationID: "v2_agent_analytics_countries_list",
113
+ oAuth2Scopes: null,
114
+ resolvedSecurity: requestSecurity,
115
+ securitySource: client$._options.security,
116
+ retryConfig: options?.retries
117
+ || client$._options.retryConfig
118
+ || { strategy: "none" },
119
+ retryCodes: options?.retryCodes || [
120
+ "429",
121
+ "500",
122
+ "502",
123
+ "503",
124
+ "504",
125
+ ],
126
+ };
127
+
128
+ const requestRes = client$._createRequest(context, {
129
+ security: requestSecurity,
130
+ method: "GET",
131
+ baseURL: options?.serverURL,
132
+ path: path$,
133
+ headers: headers$,
134
+ query: query$,
135
+ body: body$,
136
+ userAgent: client$._options.userAgent,
137
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs
138
+ || -1,
139
+ }, options);
140
+ if (!requestRes.ok) {
141
+ return [requestRes, { status: "invalid" }];
142
+ }
143
+ const req$ = requestRes.value;
144
+
145
+ const doResult = await client$._do(req$, {
146
+ context,
147
+ errorCodes: [],
148
+ retryConfig: context.retryConfig,
149
+ retryCodes: context.retryCodes,
150
+ });
151
+ if (!doResult.ok) {
152
+ return [doResult, { status: "request-error", request: req$ }];
153
+ }
154
+ return [doResult, {
155
+ status: "complete",
156
+ "request": req$,
157
+ response: doResult.value,
158
+ }];
159
+ }
@@ -0,0 +1,161 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: faa6836f47ec
4
+ */
5
+
6
+ import { LightsageMcpCore } from "../core.js";
7
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { APIError } from "../models/errors/apierror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import {
23
+ V2AgentAnalyticsErrorPagesListRequest,
24
+ V2AgentAnalyticsErrorPagesListRequest$zodSchema,
25
+ } from "../models/v2agentanalyticserrorpageslistop.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List Agent Analytics Error Pages
31
+ *
32
+ * @remarks
33
+ * Returns the pages on a site that returned an error status (400 and up) in the date range, most error requests first, with the agents, bots, and people that got each error. Set `status` to 404 for pages that were not found. Needs server-side tracking that records status codes; `status_codes_tracked` says whether the site has any.
34
+ */
35
+ export function agentAnalyticsErrorPagesList(
36
+ client$: LightsageMcpCore,
37
+ request: V2AgentAnalyticsErrorPagesListRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ Response,
42
+ | APIError
43
+ | SDKValidationError
44
+ | UnexpectedClientError
45
+ | InvalidRequestError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | ConnectionError
49
+ >
50
+ > {
51
+ return new APIPromise($do(
52
+ client$,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ async function $do(
59
+ client$: LightsageMcpCore,
60
+ request: V2AgentAnalyticsErrorPagesListRequest,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ Response,
66
+ | APIError
67
+ | SDKValidationError
68
+ | UnexpectedClientError
69
+ | InvalidRequestError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | ConnectionError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed$ = safeParse(
78
+ request,
79
+ (value$) => V2AgentAnalyticsErrorPagesListRequest$zodSchema.parse(value$),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed$.ok) {
83
+ return [parsed$, { status: "invalid" }];
84
+ }
85
+ const payload$ = parsed$.value;
86
+ const body$ = null;
87
+
88
+ const pathParams$ = {
89
+ site_id: encodeSimple("site_id", payload$.site_id, {
90
+ explode: false,
91
+ charEncoding: "percent",
92
+ }),
93
+ };
94
+ const path$ = pathToFunc("/v2/agent-analytics/sites/{site_id}/error-pages")(
95
+ pathParams$,
96
+ );
97
+ const query$ = encodeFormQuery({
98
+ "end_date": payload$.end_date,
99
+ "limit": payload$.limit,
100
+ "start_date": payload$.start_date,
101
+ "status": payload$.status,
102
+ "type": payload$.type,
103
+ });
104
+
105
+ const headers$ = new Headers(compactMap({
106
+ Accept: "application/json",
107
+ }));
108
+ const securityInput = await extractSecurity(client$._options.security);
109
+ const requestSecurity = resolveGlobalSecurity(securityInput);
110
+
111
+ const context = {
112
+ options: client$._options,
113
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
114
+ operationID: "v2_agent_analytics_error_pages_list",
115
+ oAuth2Scopes: null,
116
+ resolvedSecurity: requestSecurity,
117
+ securitySource: client$._options.security,
118
+ retryConfig: options?.retries
119
+ || client$._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || [
122
+ "429",
123
+ "500",
124
+ "502",
125
+ "503",
126
+ "504",
127
+ ],
128
+ };
129
+
130
+ const requestRes = client$._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "GET",
133
+ baseURL: options?.serverURL,
134
+ path: path$,
135
+ headers: headers$,
136
+ query: query$,
137
+ body: body$,
138
+ userAgent: client$._options.userAgent,
139
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs
140
+ || -1,
141
+ }, options);
142
+ if (!requestRes.ok) {
143
+ return [requestRes, { status: "invalid" }];
144
+ }
145
+ const req$ = requestRes.value;
146
+
147
+ const doResult = await client$._do(req$, {
148
+ context,
149
+ errorCodes: [],
150
+ retryConfig: context.retryConfig,
151
+ retryCodes: context.retryCodes,
152
+ });
153
+ if (!doResult.ok) {
154
+ return [doResult, { status: "request-error", request: req$ }];
155
+ }
156
+ return [doResult, {
157
+ status: "complete",
158
+ "request": req$,
159
+ response: doResult.value,
160
+ }];
161
+ }
@@ -0,0 +1,163 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 91b80cff41a8
4
+ */
5
+
6
+ import { LightsageMcpCore } from "../core.js";
7
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { APIError } from "../models/errors/apierror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import {
23
+ V2AgentAnalyticsPagesListRequest,
24
+ V2AgentAnalyticsPagesListRequest$zodSchema,
25
+ } from "../models/v2agentanalyticspageslistop.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List Agent Analytics Pages
31
+ *
32
+ * @remarks
33
+ * Returns the pages AI agents and bots read on a site in the date range, with visits per traffic type. Sorted by AI visits unless `sort` is set. With `type`, returns only pages that traffic type visited. With `agent`, returns only the pages that one coding agent read.
34
+ */
35
+ export function agentAnalyticsPagesList(
36
+ client$: LightsageMcpCore,
37
+ request: V2AgentAnalyticsPagesListRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ Response,
42
+ | APIError
43
+ | SDKValidationError
44
+ | UnexpectedClientError
45
+ | InvalidRequestError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | ConnectionError
49
+ >
50
+ > {
51
+ return new APIPromise($do(
52
+ client$,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ async function $do(
59
+ client$: LightsageMcpCore,
60
+ request: V2AgentAnalyticsPagesListRequest,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ Response,
66
+ | APIError
67
+ | SDKValidationError
68
+ | UnexpectedClientError
69
+ | InvalidRequestError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | ConnectionError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed$ = safeParse(
78
+ request,
79
+ (value$) => V2AgentAnalyticsPagesListRequest$zodSchema.parse(value$),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed$.ok) {
83
+ return [parsed$, { status: "invalid" }];
84
+ }
85
+ const payload$ = parsed$.value;
86
+ const body$ = null;
87
+
88
+ const pathParams$ = {
89
+ site_id: encodeSimple("site_id", payload$.site_id, {
90
+ explode: false,
91
+ charEncoding: "percent",
92
+ }),
93
+ };
94
+ const path$ = pathToFunc("/v2/agent-analytics/sites/{site_id}/pages")(
95
+ pathParams$,
96
+ );
97
+ const query$ = encodeFormQuery({
98
+ "agent": payload$.agent,
99
+ "end_date": payload$.end_date,
100
+ "limit": payload$.limit,
101
+ "search": payload$.search,
102
+ "sort": payload$.sort,
103
+ "start_date": payload$.start_date,
104
+ "type": payload$.type,
105
+ });
106
+
107
+ const headers$ = new Headers(compactMap({
108
+ Accept: "application/json",
109
+ }));
110
+ const securityInput = await extractSecurity(client$._options.security);
111
+ const requestSecurity = resolveGlobalSecurity(securityInput);
112
+
113
+ const context = {
114
+ options: client$._options,
115
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
116
+ operationID: "v2_agent_analytics_pages_list",
117
+ oAuth2Scopes: null,
118
+ resolvedSecurity: requestSecurity,
119
+ securitySource: client$._options.security,
120
+ retryConfig: options?.retries
121
+ || client$._options.retryConfig
122
+ || { strategy: "none" },
123
+ retryCodes: options?.retryCodes || [
124
+ "429",
125
+ "500",
126
+ "502",
127
+ "503",
128
+ "504",
129
+ ],
130
+ };
131
+
132
+ const requestRes = client$._createRequest(context, {
133
+ security: requestSecurity,
134
+ method: "GET",
135
+ baseURL: options?.serverURL,
136
+ path: path$,
137
+ headers: headers$,
138
+ query: query$,
139
+ body: body$,
140
+ userAgent: client$._options.userAgent,
141
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs
142
+ || -1,
143
+ }, options);
144
+ if (!requestRes.ok) {
145
+ return [requestRes, { status: "invalid" }];
146
+ }
147
+ const req$ = requestRes.value;
148
+
149
+ const doResult = await client$._do(req$, {
150
+ context,
151
+ errorCodes: [],
152
+ retryConfig: context.retryConfig,
153
+ retryCodes: context.retryCodes,
154
+ });
155
+ if (!doResult.ok) {
156
+ return [doResult, { status: "request-error", request: req$ }];
157
+ }
158
+ return [doResult, {
159
+ status: "complete",
160
+ "request": req$,
161
+ response: doResult.value,
162
+ }];
163
+ }
@@ -0,0 +1,124 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: bf8fa8ab4721
4
+ */
5
+
6
+ import { LightsageMcpCore } from "../core.js";
7
+ import { compactMap } from "../lib/primitives.js";
8
+ import { RequestOptions } from "../lib/sdks.js";
9
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
10
+ import { pathToFunc } from "../lib/url.js";
11
+ import { APIError } from "../models/errors/apierror.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../models/errors/httpclienterrors.js";
19
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
20
+ import { APICall, APIPromise } from "../types/async.js";
21
+ import { Result } from "../types/fp.js";
22
+
23
+ /**
24
+ * List Agent Analytics Sites
25
+ *
26
+ * @remarks
27
+ * Returns every site with tracked visits. Use a `site_id` from this list to read that site's agent traffic.
28
+ */
29
+ export function agentAnalyticsSitesList(
30
+ client$: LightsageMcpCore,
31
+ options?: RequestOptions,
32
+ ): APIPromise<
33
+ Result<
34
+ Response,
35
+ | APIError
36
+ | SDKValidationError
37
+ | UnexpectedClientError
38
+ | InvalidRequestError
39
+ | RequestAbortedError
40
+ | RequestTimeoutError
41
+ | ConnectionError
42
+ >
43
+ > {
44
+ return new APIPromise($do(
45
+ client$,
46
+ options,
47
+ ));
48
+ }
49
+
50
+ async function $do(
51
+ client$: LightsageMcpCore,
52
+ options?: RequestOptions,
53
+ ): Promise<
54
+ [
55
+ Result<
56
+ Response,
57
+ | APIError
58
+ | SDKValidationError
59
+ | UnexpectedClientError
60
+ | InvalidRequestError
61
+ | RequestAbortedError
62
+ | RequestTimeoutError
63
+ | ConnectionError
64
+ >,
65
+ APICall,
66
+ ]
67
+ > {
68
+ const path$ = pathToFunc("/v2/agent-analytics/sites")();
69
+
70
+ const headers$ = new Headers(compactMap({
71
+ Accept: "application/json",
72
+ }));
73
+ const securityInput = await extractSecurity(client$._options.security);
74
+ const requestSecurity = resolveGlobalSecurity(securityInput);
75
+
76
+ const context = {
77
+ options: client$._options,
78
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
79
+ operationID: "v2_agent_analytics_sites_list",
80
+ oAuth2Scopes: null,
81
+ resolvedSecurity: requestSecurity,
82
+ securitySource: client$._options.security,
83
+ retryConfig: options?.retries
84
+ || client$._options.retryConfig
85
+ || { strategy: "none" },
86
+ retryCodes: options?.retryCodes || [
87
+ "429",
88
+ "500",
89
+ "502",
90
+ "503",
91
+ "504",
92
+ ],
93
+ };
94
+
95
+ const requestRes = client$._createRequest(context, {
96
+ security: requestSecurity,
97
+ method: "GET",
98
+ baseURL: options?.serverURL,
99
+ path: path$,
100
+ headers: headers$,
101
+ userAgent: client$._options.userAgent,
102
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs
103
+ || -1,
104
+ }, options);
105
+ if (!requestRes.ok) {
106
+ return [requestRes, { status: "invalid" }];
107
+ }
108
+ const req$ = requestRes.value;
109
+
110
+ const doResult = await client$._do(req$, {
111
+ context,
112
+ errorCodes: [],
113
+ retryConfig: context.retryConfig,
114
+ retryCodes: context.retryCodes,
115
+ });
116
+ if (!doResult.ok) {
117
+ return [doResult, { status: "request-error", request: req$ }];
118
+ }
119
+ return [doResult, {
120
+ status: "complete",
121
+ "request": req$,
122
+ response: doResult.value,
123
+ }];
124
+ }