@lightsage/mcp 0.4.28 → 0.4.30

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 (182) hide show
  1. package/README.md +2 -2
  2. package/bin/mcp-server.js +1810 -664
  3. package/bin/mcp-server.js.map +47 -24
  4. package/esm/funcs/evalResultsList.d.ts +16 -0
  5. package/esm/funcs/evalResultsList.d.ts.map +1 -0
  6. package/esm/funcs/evalResultsList.js +91 -0
  7. package/esm/funcs/evalResultsList.js.map +1 -0
  8. package/esm/funcs/evalResultsSummary.d.ts +16 -0
  9. package/esm/funcs/evalResultsSummary.d.ts.map +1 -0
  10. package/esm/funcs/evalResultsSummary.js +87 -0
  11. package/esm/funcs/evalResultsSummary.js.map +1 -0
  12. package/esm/funcs/evalRunsList.d.ts +1 -1
  13. package/esm/funcs/evalRunsList.js +1 -1
  14. package/esm/funcs/promptsScheduleRetrieve.d.ts +15 -0
  15. package/esm/funcs/promptsScheduleRetrieve.d.ts.map +1 -0
  16. package/esm/funcs/promptsScheduleRetrieve.js +72 -0
  17. package/esm/funcs/promptsScheduleRetrieve.js.map +1 -0
  18. package/esm/funcs/promptsScheduleUpdate.d.ts +16 -0
  19. package/esm/funcs/promptsScheduleUpdate.d.ts.map +1 -0
  20. package/esm/funcs/promptsScheduleUpdate.js +83 -0
  21. package/esm/funcs/promptsScheduleUpdate.js.map +1 -0
  22. package/esm/funcs/promptsTargetsList.d.ts +1 -1
  23. package/esm/funcs/promptsTargetsList.js +1 -1
  24. package/esm/landing-page.js +1 -1
  25. package/esm/lib/config.d.ts +2 -2
  26. package/esm/lib/config.js +2 -2
  27. package/esm/mcp-server/mcp-server.js +1 -1
  28. package/esm/mcp-server/server.d.ts.map +1 -1
  29. package/esm/mcp-server/server.js +9 -1
  30. package/esm/mcp-server/server.js.map +1 -1
  31. package/esm/mcp-server/tools/evalResultsList.d.ts +7 -0
  32. package/esm/mcp-server/tools/evalResultsList.d.ts.map +1 -0
  33. package/esm/mcp-server/tools/evalResultsList.js +35 -0
  34. package/esm/mcp-server/tools/evalResultsList.js.map +1 -0
  35. package/esm/mcp-server/tools/evalResultsSummary.d.ts +7 -0
  36. package/esm/mcp-server/tools/evalResultsSummary.d.ts.map +1 -0
  37. package/esm/mcp-server/tools/evalResultsSummary.js +35 -0
  38. package/esm/mcp-server/tools/evalResultsSummary.js.map +1 -0
  39. package/esm/mcp-server/tools/evalRunsList.js +1 -1
  40. package/esm/mcp-server/tools/evalRunsList.js.map +1 -1
  41. package/esm/mcp-server/tools/promptsScheduleRetrieve.d.ts +3 -0
  42. package/esm/mcp-server/tools/promptsScheduleRetrieve.d.ts.map +1 -0
  43. package/esm/mcp-server/tools/promptsScheduleRetrieve.js +30 -0
  44. package/esm/mcp-server/tools/promptsScheduleRetrieve.js.map +1 -0
  45. package/esm/mcp-server/tools/promptsScheduleUpdate.d.ts +7 -0
  46. package/esm/mcp-server/tools/promptsScheduleUpdate.d.ts.map +1 -0
  47. package/esm/mcp-server/tools/promptsScheduleUpdate.js +35 -0
  48. package/esm/mcp-server/tools/promptsScheduleUpdate.js.map +1 -0
  49. package/esm/mcp-server/tools/promptsTargetsList.js +1 -1
  50. package/esm/mcp-server/tools/promptsTargetsList.js.map +1 -1
  51. package/esm/models/createv2evalrequest.js +1 -1
  52. package/esm/models/createv2evalrequest.js.map +1 -1
  53. package/esm/models/createv2evalrunrequest.js +1 -1
  54. package/esm/models/createv2evalrunrequest.js.map +1 -1
  55. package/esm/models/evaltemplateruntime.js +1 -1
  56. package/esm/models/evaltemplateruntime.js.map +1 -1
  57. package/esm/models/graderdefinition.d.ts +6 -0
  58. package/esm/models/graderdefinition.d.ts.map +1 -1
  59. package/esm/models/graderdefinition.js +28 -1
  60. package/esm/models/graderdefinition.js.map +1 -1
  61. package/esm/models/updatev2promptschedulerequest.d.ts +27 -0
  62. package/esm/models/updatev2promptschedulerequest.d.ts.map +1 -0
  63. package/esm/models/updatev2promptschedulerequest.js +27 -0
  64. package/esm/models/updatev2promptschedulerequest.js.map +1 -0
  65. package/esm/models/v2evalresultsfailedcheck.d.ts +9 -0
  66. package/esm/models/v2evalresultsfailedcheck.d.ts.map +1 -0
  67. package/esm/models/v2evalresultsfailedcheck.js +12 -0
  68. package/esm/models/v2evalresultsfailedcheck.js.map +1 -0
  69. package/esm/models/v2evalresultslistitem.d.ts +35 -0
  70. package/esm/models/v2evalresultslistitem.d.ts.map +1 -0
  71. package/esm/models/v2evalresultslistitem.js +34 -0
  72. package/esm/models/v2evalresultslistitem.js.map +1 -0
  73. package/esm/models/v2evalresultslistop.d.ts +33 -0
  74. package/esm/models/v2evalresultslistop.d.ts.map +1 -0
  75. package/esm/models/v2evalresultslistop.js +34 -0
  76. package/esm/models/v2evalresultslistop.js.map +1 -0
  77. package/esm/models/v2evalresultslistresponse.d.ts +10 -0
  78. package/esm/models/v2evalresultslistresponse.d.ts.map +1 -0
  79. package/esm/models/v2evalresultslistresponse.js +13 -0
  80. package/esm/models/v2evalresultslistresponse.js.map +1 -0
  81. package/esm/models/v2evalresultssummary.d.ts +14 -0
  82. package/esm/models/v2evalresultssummary.d.ts.map +1 -0
  83. package/esm/models/v2evalresultssummary.js +18 -0
  84. package/esm/models/v2evalresultssummary.js.map +1 -0
  85. package/esm/models/v2evalresultssummaryagent.d.ts +9 -0
  86. package/esm/models/v2evalresultssummaryagent.d.ts.map +1 -0
  87. package/esm/models/v2evalresultssummaryagent.js +12 -0
  88. package/esm/models/v2evalresultssummaryagent.js.map +1 -0
  89. package/esm/models/v2evalresultssummaryeval.d.ts +13 -0
  90. package/esm/models/v2evalresultssummaryeval.d.ts.map +1 -0
  91. package/esm/models/v2evalresultssummaryeval.js +16 -0
  92. package/esm/models/v2evalresultssummaryeval.js.map +1 -0
  93. package/esm/models/v2evalresultssummaryevalagent.d.ts +9 -0
  94. package/esm/models/v2evalresultssummaryevalagent.d.ts.map +1 -0
  95. package/esm/models/v2evalresultssummaryevalagent.js +12 -0
  96. package/esm/models/v2evalresultssummaryevalagent.js.map +1 -0
  97. package/esm/models/v2evalresultssummaryfigures.d.ts +12 -0
  98. package/esm/models/v2evalresultssummaryfigures.d.ts.map +1 -0
  99. package/esm/models/v2evalresultssummaryfigures.js +15 -0
  100. package/esm/models/v2evalresultssummaryfigures.js.map +1 -0
  101. package/esm/models/v2evalresultssummaryrange.d.ts +10 -0
  102. package/esm/models/v2evalresultssummaryrange.d.ts.map +1 -0
  103. package/esm/models/v2evalresultssummaryrange.js +13 -0
  104. package/esm/models/v2evalresultssummaryrange.js.map +1 -0
  105. package/esm/models/v2evalresultssummaryretrieveop.d.ts +11 -0
  106. package/esm/models/v2evalresultssummaryretrieveop.d.ts.map +1 -0
  107. package/esm/models/v2evalresultssummaryretrieveop.js +17 -0
  108. package/esm/models/v2evalresultssummaryretrieveop.js.map +1 -0
  109. package/esm/models/v2promptrunfrequency.d.ts +40 -0
  110. package/esm/models/v2promptrunfrequency.d.ts.map +1 -0
  111. package/esm/models/v2promptrunfrequency.js +38 -0
  112. package/esm/models/v2promptrunfrequency.js.map +1 -0
  113. package/esm/models/v2promptrunfrequencyinput.d.ts +47 -0
  114. package/esm/models/v2promptrunfrequencyinput.d.ts.map +1 -0
  115. package/esm/models/v2promptrunfrequencyinput.js +45 -0
  116. package/esm/models/v2promptrunfrequencyinput.js.map +1 -0
  117. package/esm/models/v2promptrunjobresponse.d.ts +1 -1
  118. package/esm/models/v2promptschedule.d.ts +31 -0
  119. package/esm/models/v2promptschedule.d.ts.map +1 -0
  120. package/esm/models/v2promptschedule.js +29 -0
  121. package/esm/models/v2promptschedule.js.map +1 -0
  122. package/esm/models/v2promptscheduleupdateop.d.ts +6 -0
  123. package/esm/models/v2promptscheduleupdateop.d.ts.map +1 -0
  124. package/esm/models/v2promptscheduleupdateop.js +12 -0
  125. package/esm/models/v2promptscheduleupdateop.js.map +1 -0
  126. package/esm/models/v2prompttarget.d.ts +6 -2
  127. package/esm/models/v2prompttarget.d.ts.map +1 -1
  128. package/esm/models/v2prompttarget.js +5 -3
  129. package/esm/models/v2prompttarget.js.map +1 -1
  130. package/esm/models/v2prompttargetinput.d.ts +10 -6
  131. package/esm/models/v2prompttargetinput.d.ts.map +1 -1
  132. package/esm/models/v2prompttargetinput.js +9 -6
  133. package/esm/models/v2prompttargetinput.js.map +1 -1
  134. package/esm/models/v2setupcommandoutput.js +1 -1
  135. package/esm/models/v2setupcommandoutput.js.map +1 -1
  136. package/esm/tool-names.d.ts.map +1 -1
  137. package/esm/tool-names.js +18 -2
  138. package/esm/tool-names.js.map +1 -1
  139. package/lib/feedback.js +2 -2
  140. package/lib/tool-overrides.js +196 -8
  141. package/package.json +1 -1
  142. package/src/funcs/evalResultsList.ts +153 -0
  143. package/src/funcs/evalResultsSummary.ts +150 -0
  144. package/src/funcs/evalRunsList.ts +1 -1
  145. package/src/funcs/promptsScheduleRetrieve.ts +124 -0
  146. package/src/funcs/promptsScheduleUpdate.ts +145 -0
  147. package/src/funcs/promptsTargetsList.ts +1 -1
  148. package/src/landing-page.ts +1 -1
  149. package/src/lib/config.ts +2 -2
  150. package/src/mcp-server/mcp-server.ts +1 -1
  151. package/src/mcp-server/server.ts +9 -1
  152. package/src/mcp-server/tools/evalResultsList.ts +43 -0
  153. package/src/mcp-server/tools/evalResultsSummary.ts +43 -0
  154. package/src/mcp-server/tools/evalRunsList.ts +1 -1
  155. package/src/mcp-server/tools/promptsScheduleRetrieve.ts +36 -0
  156. package/src/mcp-server/tools/promptsScheduleUpdate.ts +43 -0
  157. package/src/mcp-server/tools/promptsTargetsList.ts +1 -1
  158. package/src/models/createv2evalrequest.ts +1 -1
  159. package/src/models/createv2evalrunrequest.ts +1 -1
  160. package/src/models/evaltemplateruntime.ts +1 -1
  161. package/src/models/graderdefinition.ts +53 -19
  162. package/src/models/updatev2promptschedulerequest.ts +56 -0
  163. package/src/models/v2evalresultsfailedcheck.ts +24 -0
  164. package/src/models/v2evalresultslistitem.ts +70 -0
  165. package/src/models/v2evalresultslistop.ts +74 -0
  166. package/src/models/v2evalresultslistresponse.ts +28 -0
  167. package/src/models/v2evalresultssummary.ts +43 -0
  168. package/src/models/v2evalresultssummaryagent.ts +26 -0
  169. package/src/models/v2evalresultssummaryeval.ts +38 -0
  170. package/src/models/v2evalresultssummaryevalagent.ts +26 -0
  171. package/src/models/v2evalresultssummaryfigures.ts +38 -0
  172. package/src/models/v2evalresultssummaryrange.ts +26 -0
  173. package/src/models/v2evalresultssummaryretrieveop.ts +40 -0
  174. package/src/models/v2promptrunfrequency.ts +78 -0
  175. package/src/models/v2promptrunfrequencyinput.ts +76 -0
  176. package/src/models/v2promptschedule.ts +60 -0
  177. package/src/models/v2promptscheduleupdateop.ts +25 -0
  178. package/src/models/v2prompttarget.ts +8 -4
  179. package/src/models/v2prompttargetinput.ts +18 -11
  180. package/src/models/v2setupcommandoutput.ts +1 -1
  181. package/src/tool-names.ts +18 -2
  182. package/test/tool-overrides.test.js +121 -3
@@ -4,9 +4,14 @@
4
4
  // marked non-destructive and closed-world, and it builds names from operation
5
5
  // ids ("CLIs list" becomes "CL-is-list"). App directory reviews (OpenAI) check
6
6
  // these hints against what each tool does, so the tools below are corrected
7
- // here, after the generated tools are registered. This file is hand-written
7
+ // here, after the generated tools are registered. The same reviews reject
8
+ // tools that ask for API keys, tokens or passwords, so inputs that carry
9
+ // secret values are removed and descriptions that talk about secrets are
10
+ // reworded (see SECRET_INPUT_FIELDS and DESCRIPTION_EDITS). This file is hand-written
8
11
  // and outside the generated `src/` tree, so regeneration keeps it.
9
12
 
13
+ import { z } from "zod";
14
+
10
15
  /** Tools that overwrite or stop work and cannot be undone by the caller. */
11
16
  const DESTRUCTIVE_TOOLS = [
12
17
  // Replaces the full list of AI platforms a prompt runs on.
@@ -23,6 +28,8 @@ const DESTRUCTIVE_TOOLS = [
23
28
  "agent-preference-evals-update",
24
29
  // Renames a prompt topic or changes its description.
25
30
  "prompts-topics-update",
31
+ // Replaces how often prompts run on each AI platform.
32
+ "prompts-schedule-update",
26
33
  // Overwrites a task's status, owner and details.
27
34
  "tasks-update",
28
35
  // Overwrites an eval configuration's agents, model and settings.
@@ -31,6 +38,16 @@ const DESTRUCTIVE_TOOLS = [
31
38
  "eval-templates-update",
32
39
  // Overwrites a repository workspace's URL, branch and setup.
33
40
  "repositories-update",
41
+ // Renames a Library page or changes the day it went live.
42
+ "library-pages-update",
43
+ // Renames a Library redirect or changes the day it went live.
44
+ "library-redirects-update",
45
+ // Sends prompts to outside AI platforms and spends usage-based credits;
46
+ // neither can be taken back once the run starts.
47
+ "prompts-run",
48
+ // Starts coding agents and spends usage-based credits; neither can be
49
+ // taken back once the run starts.
50
+ "evals-run",
34
51
  ];
35
52
 
36
53
  /** Tools that send work to outside AI systems the caller does not control. */
@@ -39,20 +56,174 @@ const OPEN_WORLD_TOOLS = [
39
56
  "prompts-run",
40
57
  // Runs coding agents and AI models on an eval.
41
58
  "evals-run",
59
+ // Tracks a live page on the customer's own site, which Lightsage does not
60
+ // control (flagged by OpenAI's automated plugin review).
61
+ "library-pages-create",
62
+ // Records a redirect that is live on the customer's own site.
63
+ "library-redirects-create",
42
64
  ];
43
65
 
44
66
  /** Generated names that do not describe the tool. */
45
67
  export const TOOL_RENAMES = {
46
68
  "CL-is-list": "clis-list",
69
+ // Retrieves an eval run, not an eval (that is evals-retrieve).
70
+ "evals-get": "eval-runs-retrieve",
71
+ "MCP-servers-list": "mcp-servers-list",
72
+ "status-auth-status-get": "auth-status-get",
73
+ };
74
+
75
+ /**
76
+ * Free-form string maps that carry secret values: `env` on an eval run, and
77
+ * `env` / `headers` on an inline MCP server. ChatGPT's plugin guidelines treat
78
+ * API keys and passwords as restricted data a tool must not ask for, so the
79
+ * hosted MCP leaves these inputs out. Secrets live in the environments and
80
+ * MCP servers saved in the Lightsage app, which tools pick by ID.
81
+ */
82
+ export const SECRET_INPUT_FIELDS = ["env", "headers"];
83
+
84
+ /**
85
+ * Generated description text that directory reviews flag, per tool: wording
86
+ * that reads as asking for secrets, steps that send the model outside this
87
+ * server (such as fetching a link with curl), and side effects left unsaid.
88
+ */
89
+ export const DESCRIPTION_EDITS = {
90
+ "evals-run": [
91
+ [
92
+ "repository, write-only environment variables, saved or inline CLIs",
93
+ "repository, saved or inline CLIs",
94
+ ],
95
+ [
96
+ "A saved or inline environment containing an empty or placeholder credential is rejected with `400` before any evaluation is dispatched.",
97
+ "Environment variables come from the environments saved in the Lightsage app. A run whose environment has an empty or placeholder value is rejected with `400` before any evaluation is dispatched.",
98
+ ],
99
+ [
100
+ "The run fans out across",
101
+ "Agents, CLI installations, setup commands and cleanup commands run in an isolated Lightsage sandbox, never on the user's machine.\n\nThe run fans out across",
102
+ ],
103
+ ],
104
+ "plugin-evals-results-list": [
105
+ [
106
+ "The link works without an API key until `expires_at` (15 minutes), so fetch it with any HTTP client, for example `curl -o results.zip \"<download_url>\"`.",
107
+ "The link expires at `expires_at` (15 minutes); share it with the user to download.",
108
+ ],
109
+ ],
110
+ "evals-create": [
111
+ [
112
+ "Creating the eval does not start a run and does not accept secret environment values.",
113
+ "Creating the eval does not start a run.",
114
+ ],
115
+ ],
116
+ "environments-list": [
117
+ [
118
+ "Returns reusable environments without exposing secret values.",
119
+ "Returns the reusable environments saved in the Lightsage app. Variable values are not returned.",
120
+ ],
121
+ ],
122
+ "MCP-servers-list": [
123
+ [
124
+ "Returns reusable MCP servers without exposing credentials or secret values.",
125
+ "Returns the reusable MCP servers saved in the Lightsage app. Header and environment values are not returned.",
126
+ ],
127
+ ],
47
128
  };
48
129
 
49
- export const ANNOTATION_OVERRIDES = Object.fromEntries([
50
- ...DESTRUCTIVE_TOOLS.map((name) => [
51
- name,
52
- { readOnlyHint: false, destructiveHint: true },
53
- ]),
54
- ...OPEN_WORLD_TOOLS.map((name) => [name, { openWorldHint: true }]),
55
- ]);
130
+ /** Input field description text that refers to the removed fields. */
131
+ export const FIELD_DESCRIPTION_EDITS = [
132
+ [" Cannot be false when `env` is sent.", ""],
133
+ ];
134
+
135
+ export const ANNOTATION_OVERRIDES = {};
136
+ for (const name of DESTRUCTIVE_TOOLS) {
137
+ ANNOTATION_OVERRIDES[name] = { readOnlyHint: false, destructiveHint: true };
138
+ }
139
+ // A tool can be both: merge rather than replace.
140
+ for (const name of OPEN_WORLD_TOOLS) {
141
+ ANNOTATION_OVERRIDES[name] = {
142
+ ...ANNOTATION_OVERRIDES[name],
143
+ openWorldHint: true,
144
+ };
145
+ }
146
+
147
+ function describedLike(next, previous) {
148
+ const description = editFieldDescription(previous.description);
149
+ return description ? next.describe(description) : next;
150
+ }
151
+
152
+ function editFieldDescription(description) {
153
+ if (!description) return description;
154
+ return FIELD_DESCRIPTION_EDITS.reduce(
155
+ (text, [from, to]) => text.replace(from, to),
156
+ description,
157
+ );
158
+ }
159
+
160
+ /**
161
+ * Return `schema` without SECRET_INPUT_FIELDS string maps at any depth, with
162
+ * FIELD_DESCRIPTION_EDITS applied. Unchanged schemas are returned as is.
163
+ */
164
+ export function withoutSecretInputs(schema) {
165
+ const def = schema?._zod?.def;
166
+ if (!def) return schema;
167
+ const descriptionChanged =
168
+ editFieldDescription(schema.description) !== schema.description;
169
+
170
+ switch (def.type) {
171
+ case "object": {
172
+ const shape = {};
173
+ let changed = false;
174
+ for (const [key, value] of Object.entries(schema.shape)) {
175
+ if (SECRET_INPUT_FIELDS.includes(key) && isStringMap(value)) {
176
+ changed = true;
177
+ continue;
178
+ }
179
+ const next = withoutSecretInputs(value);
180
+ if (next !== value) changed = true;
181
+ shape[key] = next;
182
+ }
183
+ if (!changed && !descriptionChanged) return schema;
184
+ const next = def.catchall
185
+ ? z.object(shape).catchall(def.catchall)
186
+ : z.object(shape);
187
+ return describedLike(next, schema);
188
+ }
189
+ case "optional":
190
+ case "nullable": {
191
+ const inner = withoutSecretInputs(def.innerType);
192
+ if (inner === def.innerType && !descriptionChanged) return schema;
193
+ return describedLike(
194
+ def.type === "optional" ? inner.optional() : inner.nullable(),
195
+ schema,
196
+ );
197
+ }
198
+ case "default": {
199
+ const inner = withoutSecretInputs(def.innerType);
200
+ if (inner === def.innerType && !descriptionChanged) return schema;
201
+ return describedLike(inner.default(def.defaultValue), schema);
202
+ }
203
+ case "array": {
204
+ const element = withoutSecretInputs(def.element);
205
+ if (element === def.element && !descriptionChanged) return schema;
206
+ return describedLike(z.array(element), schema);
207
+ }
208
+ case "union": {
209
+ const options = def.options.map(withoutSecretInputs);
210
+ if (options.every((o, i) => o === def.options[i]) && !descriptionChanged) {
211
+ return schema;
212
+ }
213
+ return describedLike(z.union(options), schema);
214
+ }
215
+ default:
216
+ return descriptionChanged ? describedLike(schema, schema) : schema;
217
+ }
218
+ }
219
+
220
+ function isStringMap(schema) {
221
+ let current = schema;
222
+ while (["optional", "nullable"].includes(current?._zod?.def?.type)) {
223
+ current = current._zod.def.innerType;
224
+ }
225
+ return current?._zod?.def?.type === "record";
226
+ }
56
227
 
57
228
  /**
58
229
  * Apply the annotation corrections and renames to an McpServer whose
@@ -68,6 +239,23 @@ export function applyToolOverrides(mcpServer) {
68
239
  tool.update({ annotations: { ...(tool.annotations ?? {}), ...overrides } });
69
240
  }
70
241
 
242
+ for (const tool of Object.values(tools)) {
243
+ const shape = tool.inputSchema?.shape;
244
+ if (!shape) continue;
245
+ const next = withoutSecretInputs(tool.inputSchema);
246
+ if (next !== tool.inputSchema) tool.update({ paramsSchema: next.shape });
247
+ }
248
+
249
+ for (const [name, edits] of Object.entries(DESCRIPTION_EDITS)) {
250
+ const tool = tools[name];
251
+ if (!tool?.description) continue;
252
+ const description = edits.reduce(
253
+ (text, [from, to]) => text.replace(from, to),
254
+ tool.description,
255
+ );
256
+ if (description !== tool.description) tool.update({ description });
257
+ }
258
+
71
259
  for (const [from, to] of Object.entries(TOOL_RENAMES)) {
72
260
  const tool = tools[from];
73
261
  if (!tool || tools[to]) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsage/mcp",
3
- "version": "0.4.28",
3
+ "version": "0.4.30",
4
4
  "author": "Speakeasy",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -0,0 +1,153 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: f69ff79b79da
4
+ */
5
+
6
+ import { LightsageMcpCore } from "../core.js";
7
+ import { encodeFormQuery } 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
+ V2EvalResultsListRequest,
24
+ V2EvalResultsListRequest$zodSchema,
25
+ } from "../models/v2evalresultslistop.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List Results
31
+ *
32
+ * @remarks
33
+ * Lists eval results across runs, newest first: one per attempt by one agent, with the checks the judge failed and its reasons. Filter by `eval_id`, `agent` and `result` (use `result=failed` to see why evals fail). Each result has a `run_id` to pass to `GET /v2/eval-runs/{run_id}/trace` for the agent's step-by-step log. For totals across evals and agents, use `GET /v2/eval-results/summary` first.
34
+ */
35
+ export function evalResultsList(
36
+ client$: LightsageMcpCore,
37
+ request?: V2EvalResultsListRequest | undefined,
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?: V2EvalResultsListRequest | undefined,
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$) => V2EvalResultsListRequest$zodSchema.optional().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
+ const path$ = pathToFunc("/v2/eval-results")();
88
+ const query$ = encodeFormQuery({
89
+ "agent": payload$?.agent,
90
+ "cursor": payload$?.cursor,
91
+ "days": payload$?.days,
92
+ "eval_id": payload$?.eval_id,
93
+ "limit": payload$?.limit,
94
+ "result": payload$?.result,
95
+ });
96
+
97
+ const headers$ = new Headers(compactMap({
98
+ Accept: "application/json",
99
+ }));
100
+ const securityInput = await extractSecurity(client$._options.security);
101
+ const requestSecurity = resolveGlobalSecurity(securityInput);
102
+
103
+ const context = {
104
+ options: client$._options,
105
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
106
+ operationID: "v2_eval_results_list",
107
+ oAuth2Scopes: null,
108
+ resolvedSecurity: requestSecurity,
109
+ securitySource: client$._options.security,
110
+ retryConfig: options?.retries
111
+ || client$._options.retryConfig
112
+ || { strategy: "none" },
113
+ retryCodes: options?.retryCodes || [
114
+ "429",
115
+ "500",
116
+ "502",
117
+ "503",
118
+ "504",
119
+ ],
120
+ };
121
+
122
+ const requestRes = client$._createRequest(context, {
123
+ security: requestSecurity,
124
+ method: "GET",
125
+ baseURL: options?.serverURL,
126
+ path: path$,
127
+ headers: headers$,
128
+ query: query$,
129
+ body: body$,
130
+ userAgent: client$._options.userAgent,
131
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs
132
+ || -1,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req$ = requestRes.value;
138
+
139
+ const doResult = await client$._do(req$, {
140
+ context,
141
+ errorCodes: [],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req$ }];
147
+ }
148
+ return [doResult, {
149
+ status: "complete",
150
+ "request": req$,
151
+ response: doResult.value,
152
+ }];
153
+ }
@@ -0,0 +1,150 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: c732f1d8727a
4
+ */
5
+
6
+ import { LightsageMcpCore } from "../core.js";
7
+ import { encodeFormQuery } 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
+ V2EvalResultsSummaryRetrieveRequest,
24
+ V2EvalResultsSummaryRetrieveRequest$zodSchema,
25
+ } from "../models/v2evalresultssummaryretrieveop.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Retrieve Summary
31
+ *
32
+ * @remarks
33
+ * Start here for any question about how evals are doing. Returns, in one call, totals for the last `days` days and the same number of days before: for every eval and every agent (harness and model), the attempts, pass rate, average agent time and average tool calls, and how the pass rate changed. Answers which evals got worse and which agents fail most without retrieving runs one at a time. To see the individual results behind these figures and the judge's reasons, use `GET /v2/eval-results`.
34
+ */
35
+ export function evalResultsSummary(
36
+ client$: LightsageMcpCore,
37
+ request?: V2EvalResultsSummaryRetrieveRequest | undefined,
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?: V2EvalResultsSummaryRetrieveRequest | undefined,
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$) =>
80
+ V2EvalResultsSummaryRetrieveRequest$zodSchema.optional().parse(value$),
81
+ "Input validation failed",
82
+ );
83
+ if (!parsed$.ok) {
84
+ return [parsed$, { status: "invalid" }];
85
+ }
86
+ const payload$ = parsed$.value;
87
+ const body$ = null;
88
+ const path$ = pathToFunc("/v2/eval-results/summary")();
89
+ const query$ = encodeFormQuery({
90
+ "days": payload$?.days,
91
+ "eval_id": payload$?.eval_id,
92
+ });
93
+
94
+ const headers$ = new Headers(compactMap({
95
+ Accept: "application/json",
96
+ }));
97
+ const securityInput = await extractSecurity(client$._options.security);
98
+ const requestSecurity = resolveGlobalSecurity(securityInput);
99
+
100
+ const context = {
101
+ options: client$._options,
102
+ baseURL: options?.serverURL ?? client$._baseURL ?? "",
103
+ operationID: "v2_eval_results_summary_retrieve",
104
+ oAuth2Scopes: null,
105
+ resolvedSecurity: requestSecurity,
106
+ securitySource: client$._options.security,
107
+ retryConfig: options?.retries
108
+ || client$._options.retryConfig
109
+ || { strategy: "none" },
110
+ retryCodes: options?.retryCodes || [
111
+ "429",
112
+ "500",
113
+ "502",
114
+ "503",
115
+ "504",
116
+ ],
117
+ };
118
+
119
+ const requestRes = client$._createRequest(context, {
120
+ security: requestSecurity,
121
+ method: "GET",
122
+ baseURL: options?.serverURL,
123
+ path: path$,
124
+ headers: headers$,
125
+ query: query$,
126
+ body: body$,
127
+ userAgent: client$._options.userAgent,
128
+ timeoutMs: options?.timeoutMs || client$._options.timeoutMs
129
+ || -1,
130
+ }, options);
131
+ if (!requestRes.ok) {
132
+ return [requestRes, { status: "invalid" }];
133
+ }
134
+ const req$ = requestRes.value;
135
+
136
+ const doResult = await client$._do(req$, {
137
+ context,
138
+ errorCodes: [],
139
+ retryConfig: context.retryConfig,
140
+ retryCodes: context.retryCodes,
141
+ });
142
+ if (!doResult.ok) {
143
+ return [doResult, { status: "request-error", request: req$ }];
144
+ }
145
+ return [doResult, {
146
+ status: "complete",
147
+ "request": req$,
148
+ response: doResult.value,
149
+ }];
150
+ }
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
30
30
  * List Runs
31
31
  *
32
32
  * @remarks
33
- * Returns custom eval runs, ordered newest first, with lifecycle state and progress. Includes scheduled, onboarding, and pull request runs and runs started in the Lightsage app, as well as runs started through `POST /v2/eval-runs`.
33
+ * Returns custom eval runs, ordered newest first, with lifecycle state and progress. Includes scheduled, onboarding, and pull request runs and runs started in the Lightsage app, as well as runs started through `POST /v2/eval-runs`. This lists runs and their status only: to see how evals did across runs, use `GET /v2/eval-results/summary` and `GET /v2/eval-results` instead of retrieving runs one at a time.
34
34
  */
35
35
  export function evalRunsList(
36
36
  client$: LightsageMcpCore,
@@ -0,0 +1,124 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 93f08bbd6b44
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
+ * Get Prompt Schedule
25
+ *
26
+ * @remarks
27
+ * Returns whether scheduled prompt runs are on, when the daily run starts, the organization's default frequency, and how often each answer engine and coding-agent harness runs. The same settings as Settings > Schedules in the app.
28
+ */
29
+ export function promptsScheduleRetrieve(
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/prompts/schedule")();
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_prompt_schedule_retrieve",
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
+ }