@knowledge-stack/ksapi 1.139.1 → 1.140.1

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 (101) hide show
  1. package/.openapi-generator/FILES +28 -0
  2. package/README.md +25 -11
  3. package/dist/apis/AdminKbApi.d.ts +109 -0
  4. package/dist/apis/AdminKbApi.js +172 -0
  5. package/dist/apis/AdminWorkflowsApi.d.ts +252 -0
  6. package/dist/apis/AdminWorkflowsApi.js +337 -0
  7. package/dist/apis/index.d.ts +2 -0
  8. package/dist/apis/index.js +2 -0
  9. package/dist/esm/apis/AdminKbApi.d.ts +109 -0
  10. package/dist/esm/apis/AdminKbApi.js +135 -0
  11. package/dist/esm/apis/AdminWorkflowsApi.d.ts +252 -0
  12. package/dist/esm/apis/AdminWorkflowsApi.js +300 -0
  13. package/dist/esm/apis/index.d.ts +2 -0
  14. package/dist/esm/apis/index.js +2 -0
  15. package/dist/esm/models/CitedChunk.d.ts +6 -4
  16. package/dist/esm/models/DefinitionOutputStat.d.ts +65 -0
  17. package/dist/esm/models/DefinitionOutputStat.js +56 -0
  18. package/dist/esm/models/HourHistogramResponse.d.ts +53 -0
  19. package/dist/esm/models/HourHistogramResponse.js +54 -0
  20. package/dist/esm/models/KbMetric.d.ts +26 -0
  21. package/dist/esm/models/KbMetric.js +44 -0
  22. package/dist/esm/models/KbSummaryResponse.d.ts +152 -0
  23. package/dist/esm/models/KbSummaryResponse.js +109 -0
  24. package/dist/esm/models/KbTimeseriesResponse.d.ts +71 -0
  25. package/dist/esm/models/KbTimeseriesResponse.js +57 -0
  26. package/dist/esm/models/LabeledSeries.d.ts +54 -0
  27. package/dist/esm/models/LabeledSeries.js +47 -0
  28. package/dist/esm/models/LeaderboardEntry.d.ts +59 -0
  29. package/dist/esm/models/LeaderboardEntry.js +52 -0
  30. package/dist/esm/models/RunTimeseriesResponse.d.ts +61 -0
  31. package/dist/esm/models/RunTimeseriesResponse.js +52 -0
  32. package/dist/esm/models/TimeBucket.d.ts +27 -0
  33. package/dist/esm/models/TimeBucket.js +45 -0
  34. package/dist/esm/models/TimeseriesPoint.d.ts +53 -0
  35. package/dist/esm/models/TimeseriesPoint.js +48 -0
  36. package/dist/esm/models/WorkflowLeaderboardResponse.d.ts +54 -0
  37. package/dist/esm/models/WorkflowLeaderboardResponse.js +45 -0
  38. package/dist/esm/models/WorkflowOutputStatsResponse.d.ts +54 -0
  39. package/dist/esm/models/WorkflowOutputStatsResponse.js +47 -0
  40. package/dist/esm/models/index.d.ts +12 -0
  41. package/dist/esm/models/index.js +12 -0
  42. package/dist/models/CitedChunk.d.ts +6 -4
  43. package/dist/models/DefinitionOutputStat.d.ts +65 -0
  44. package/dist/models/DefinitionOutputStat.js +64 -0
  45. package/dist/models/HourHistogramResponse.d.ts +53 -0
  46. package/dist/models/HourHistogramResponse.js +62 -0
  47. package/dist/models/KbMetric.d.ts +26 -0
  48. package/dist/models/KbMetric.js +52 -0
  49. package/dist/models/KbSummaryResponse.d.ts +152 -0
  50. package/dist/models/KbSummaryResponse.js +117 -0
  51. package/dist/models/KbTimeseriesResponse.d.ts +71 -0
  52. package/dist/models/KbTimeseriesResponse.js +65 -0
  53. package/dist/models/LabeledSeries.d.ts +54 -0
  54. package/dist/models/LabeledSeries.js +55 -0
  55. package/dist/models/LeaderboardEntry.d.ts +59 -0
  56. package/dist/models/LeaderboardEntry.js +60 -0
  57. package/dist/models/RunTimeseriesResponse.d.ts +61 -0
  58. package/dist/models/RunTimeseriesResponse.js +60 -0
  59. package/dist/models/TimeBucket.d.ts +27 -0
  60. package/dist/models/TimeBucket.js +53 -0
  61. package/dist/models/TimeseriesPoint.d.ts +53 -0
  62. package/dist/models/TimeseriesPoint.js +56 -0
  63. package/dist/models/WorkflowLeaderboardResponse.d.ts +54 -0
  64. package/dist/models/WorkflowLeaderboardResponse.js +53 -0
  65. package/dist/models/WorkflowOutputStatsResponse.d.ts +54 -0
  66. package/dist/models/WorkflowOutputStatsResponse.js +55 -0
  67. package/dist/models/index.d.ts +12 -0
  68. package/dist/models/index.js +12 -0
  69. package/docs/AdminKbApi.md +163 -0
  70. package/docs/AdminWorkflowsApi.md +424 -0
  71. package/docs/CitedChunk.md +1 -1
  72. package/docs/DefinitionOutputStat.md +41 -0
  73. package/docs/HourHistogramResponse.md +37 -0
  74. package/docs/KbMetric.md +33 -0
  75. package/docs/KbSummaryResponse.md +67 -0
  76. package/docs/KbTimeseriesResponse.md +41 -0
  77. package/docs/LabeledSeries.md +37 -0
  78. package/docs/LeaderboardEntry.md +39 -0
  79. package/docs/RunTimeseriesResponse.md +39 -0
  80. package/docs/TimeBucket.md +33 -0
  81. package/docs/TimeseriesPoint.md +37 -0
  82. package/docs/WorkflowLeaderboardResponse.md +37 -0
  83. package/docs/WorkflowOutputStatsResponse.md +37 -0
  84. package/package.json +1 -1
  85. package/src/apis/AdminKbApi.ts +237 -0
  86. package/src/apis/AdminWorkflowsApi.ts +539 -0
  87. package/src/apis/index.ts +2 -0
  88. package/src/models/CitedChunk.ts +6 -4
  89. package/src/models/DefinitionOutputStat.ts +110 -0
  90. package/src/models/HourHistogramResponse.ts +97 -0
  91. package/src/models/KbMetric.ts +54 -0
  92. package/src/models/KbSummaryResponse.ts +235 -0
  93. package/src/models/KbTimeseriesResponse.ts +136 -0
  94. package/src/models/LabeledSeries.ts +99 -0
  95. package/src/models/LeaderboardEntry.ts +101 -0
  96. package/src/models/RunTimeseriesResponse.ts +117 -0
  97. package/src/models/TimeBucket.ts +55 -0
  98. package/src/models/TimeseriesPoint.ts +92 -0
  99. package/src/models/WorkflowLeaderboardResponse.ts +98 -0
  100. package/src/models/WorkflowOutputStatsResponse.ts +99 -0
  101. package/src/models/index.ts +12 -0
@@ -0,0 +1,539 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import * as runtime from '../runtime';
17
+ import type {
18
+ ErrorResponse,
19
+ HTTPValidationError,
20
+ HourHistogramResponse,
21
+ RunTimeseriesResponse,
22
+ TimeBucket,
23
+ WorkflowLeaderboardResponse,
24
+ WorkflowOutputStatsResponse,
25
+ WorkflowRunSummaryResponse,
26
+ } from '../models/index';
27
+ import {
28
+ ErrorResponseFromJSON,
29
+ ErrorResponseToJSON,
30
+ HTTPValidationErrorFromJSON,
31
+ HTTPValidationErrorToJSON,
32
+ HourHistogramResponseFromJSON,
33
+ HourHistogramResponseToJSON,
34
+ RunTimeseriesResponseFromJSON,
35
+ RunTimeseriesResponseToJSON,
36
+ TimeBucketFromJSON,
37
+ TimeBucketToJSON,
38
+ WorkflowLeaderboardResponseFromJSON,
39
+ WorkflowLeaderboardResponseToJSON,
40
+ WorkflowOutputStatsResponseFromJSON,
41
+ WorkflowOutputStatsResponseToJSON,
42
+ WorkflowRunSummaryResponseFromJSON,
43
+ WorkflowRunSummaryResponseToJSON,
44
+ } from '../models/index';
45
+
46
+ export interface GetAdminWorkflowByHourRequest {
47
+ since?: Date | null;
48
+ until?: Date | null;
49
+ timezone?: string | null;
50
+ definitionId?: string | null;
51
+ }
52
+
53
+ export interface GetAdminWorkflowLeaderboardRequest {
54
+ since?: Date | null;
55
+ until?: Date | null;
56
+ limit?: number;
57
+ }
58
+
59
+ export interface GetAdminWorkflowOutputStatsRequest {
60
+ since?: Date | null;
61
+ until?: Date | null;
62
+ }
63
+
64
+ export interface GetAdminWorkflowSummaryRequest {
65
+ since?: Date | null;
66
+ until?: Date | null;
67
+ definitionId?: string | null;
68
+ }
69
+
70
+ export interface GetAdminWorkflowTimeseriesRequest {
71
+ since?: Date | null;
72
+ until?: Date | null;
73
+ bucket?: TimeBucket;
74
+ timezone?: string | null;
75
+ definitionId?: string | null;
76
+ }
77
+
78
+ /**
79
+ * AdminWorkflowsApi - interface
80
+ *
81
+ * @export
82
+ * @interface AdminWorkflowsApiInterface
83
+ */
84
+ export interface AdminWorkflowsApiInterface {
85
+ /**
86
+ * Creates request options for getAdminWorkflowByHour without sending the request
87
+ * @param {Date} [since] Window start.
88
+ * @param {Date} [until] Window end.
89
+ * @param {string} [timezone] IANA tz override; defaults to tenant setting.
90
+ * @param {string} [definitionId] Scope to one workflow.
91
+ * @throws {RequiredError}
92
+ * @memberof AdminWorkflowsApiInterface
93
+ */
94
+ getAdminWorkflowByHourRequestOpts(requestParameters: GetAdminWorkflowByHourRequest): Promise<runtime.RequestOpts>;
95
+
96
+ /**
97
+ * Runs per hour-of-day (0-23) in the resolved timezone.
98
+ * @summary Get Admin Workflow By Hour Handler
99
+ * @param {Date} [since] Window start.
100
+ * @param {Date} [until] Window end.
101
+ * @param {string} [timezone] IANA tz override; defaults to tenant setting.
102
+ * @param {string} [definitionId] Scope to one workflow.
103
+ * @param {*} [options] Override http request option.
104
+ * @throws {RequiredError}
105
+ * @memberof AdminWorkflowsApiInterface
106
+ */
107
+ getAdminWorkflowByHourRaw(requestParameters: GetAdminWorkflowByHourRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HourHistogramResponse>>;
108
+
109
+ /**
110
+ * Runs per hour-of-day (0-23) in the resolved timezone.
111
+ * Get Admin Workflow By Hour Handler
112
+ */
113
+ getAdminWorkflowByHour(requestParameters: GetAdminWorkflowByHourRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HourHistogramResponse>;
114
+
115
+ /**
116
+ * Creates request options for getAdminWorkflowLeaderboard without sending the request
117
+ * @param {Date} [since] Window start.
118
+ * @param {Date} [until] Window end.
119
+ * @param {number} [limit] Top-N per leaderboard.
120
+ * @throws {RequiredError}
121
+ * @memberof AdminWorkflowsApiInterface
122
+ */
123
+ getAdminWorkflowLeaderboardRequestOpts(requestParameters: GetAdminWorkflowLeaderboardRequest): Promise<runtime.RequestOpts>;
124
+
125
+ /**
126
+ * Top workflows and top run owners by run count.
127
+ * @summary Get Admin Workflow Leaderboard Handler
128
+ * @param {Date} [since] Window start.
129
+ * @param {Date} [until] Window end.
130
+ * @param {number} [limit] Top-N per leaderboard.
131
+ * @param {*} [options] Override http request option.
132
+ * @throws {RequiredError}
133
+ * @memberof AdminWorkflowsApiInterface
134
+ */
135
+ getAdminWorkflowLeaderboardRaw(requestParameters: GetAdminWorkflowLeaderboardRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowLeaderboardResponse>>;
136
+
137
+ /**
138
+ * Top workflows and top run owners by run count.
139
+ * Get Admin Workflow Leaderboard Handler
140
+ */
141
+ getAdminWorkflowLeaderboard(requestParameters: GetAdminWorkflowLeaderboardRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowLeaderboardResponse>;
142
+
143
+ /**
144
+ * Creates request options for getAdminWorkflowOutputStats without sending the request
145
+ * @param {Date} [since] Window start.
146
+ * @param {Date} [until] Window end.
147
+ * @throws {RequiredError}
148
+ * @memberof AdminWorkflowsApiInterface
149
+ */
150
+ getAdminWorkflowOutputStatsRequestOpts(requestParameters: GetAdminWorkflowOutputStatsRequest): Promise<runtime.RequestOpts>;
151
+
152
+ /**
153
+ * Average output DOCUMENTs generated per workflow definition (completed runs).
154
+ * @summary Get Admin Workflow Output Stats Handler
155
+ * @param {Date} [since] Window start.
156
+ * @param {Date} [until] Window end.
157
+ * @param {*} [options] Override http request option.
158
+ * @throws {RequiredError}
159
+ * @memberof AdminWorkflowsApiInterface
160
+ */
161
+ getAdminWorkflowOutputStatsRaw(requestParameters: GetAdminWorkflowOutputStatsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowOutputStatsResponse>>;
162
+
163
+ /**
164
+ * Average output DOCUMENTs generated per workflow definition (completed runs).
165
+ * Get Admin Workflow Output Stats Handler
166
+ */
167
+ getAdminWorkflowOutputStats(requestParameters: GetAdminWorkflowOutputStatsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowOutputStatsResponse>;
168
+
169
+ /**
170
+ * Creates request options for getAdminWorkflowSummary without sending the request
171
+ * @param {Date} [since] Window start (inclusive). Defaults to 7 days ago.
172
+ * @param {Date} [until] Window end (inclusive).
173
+ * @param {string} [definitionId] Scope all numbers to one workflow.
174
+ * @throws {RequiredError}
175
+ * @memberof AdminWorkflowsApiInterface
176
+ */
177
+ getAdminWorkflowSummaryRequestOpts(requestParameters: GetAdminWorkflowSummaryRequest): Promise<runtime.RequestOpts>;
178
+
179
+ /**
180
+ * Tenant-wide run health: counts, failure rate, durations, approval backlog.
181
+ * @summary Get Admin Workflow Summary Handler
182
+ * @param {Date} [since] Window start (inclusive). Defaults to 7 days ago.
183
+ * @param {Date} [until] Window end (inclusive).
184
+ * @param {string} [definitionId] Scope all numbers to one workflow.
185
+ * @param {*} [options] Override http request option.
186
+ * @throws {RequiredError}
187
+ * @memberof AdminWorkflowsApiInterface
188
+ */
189
+ getAdminWorkflowSummaryRaw(requestParameters: GetAdminWorkflowSummaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunSummaryResponse>>;
190
+
191
+ /**
192
+ * Tenant-wide run health: counts, failure rate, durations, approval backlog.
193
+ * Get Admin Workflow Summary Handler
194
+ */
195
+ getAdminWorkflowSummary(requestParameters: GetAdminWorkflowSummaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunSummaryResponse>;
196
+
197
+ /**
198
+ * Creates request options for getAdminWorkflowTimeseries without sending the request
199
+ * @param {Date} [since] Window start.
200
+ * @param {Date} [until] Window end.
201
+ * @param {TimeBucket} [bucket] Bucket size.
202
+ * @param {string} [timezone] IANA tz override; defaults to tenant setting.
203
+ * @param {string} [definitionId] Scope to one workflow.
204
+ * @throws {RequiredError}
205
+ * @memberof AdminWorkflowsApiInterface
206
+ */
207
+ getAdminWorkflowTimeseriesRequestOpts(requestParameters: GetAdminWorkflowTimeseriesRequest): Promise<runtime.RequestOpts>;
208
+
209
+ /**
210
+ * Run counts bucketed over time, in the resolved timezone.
211
+ * @summary Get Admin Workflow Timeseries Handler
212
+ * @param {Date} [since] Window start.
213
+ * @param {Date} [until] Window end.
214
+ * @param {TimeBucket} [bucket] Bucket size.
215
+ * @param {string} [timezone] IANA tz override; defaults to tenant setting.
216
+ * @param {string} [definitionId] Scope to one workflow.
217
+ * @param {*} [options] Override http request option.
218
+ * @throws {RequiredError}
219
+ * @memberof AdminWorkflowsApiInterface
220
+ */
221
+ getAdminWorkflowTimeseriesRaw(requestParameters: GetAdminWorkflowTimeseriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RunTimeseriesResponse>>;
222
+
223
+ /**
224
+ * Run counts bucketed over time, in the resolved timezone.
225
+ * Get Admin Workflow Timeseries Handler
226
+ */
227
+ getAdminWorkflowTimeseries(requestParameters: GetAdminWorkflowTimeseriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RunTimeseriesResponse>;
228
+
229
+ }
230
+
231
+ /**
232
+ *
233
+ */
234
+ export class AdminWorkflowsApi extends runtime.BaseAPI implements AdminWorkflowsApiInterface {
235
+
236
+ /**
237
+ * Creates request options for getAdminWorkflowByHour without sending the request
238
+ */
239
+ async getAdminWorkflowByHourRequestOpts(requestParameters: GetAdminWorkflowByHourRequest): Promise<runtime.RequestOpts> {
240
+ const queryParameters: any = {};
241
+
242
+ if (requestParameters['since'] != null) {
243
+ queryParameters['since'] = (requestParameters['since'] as any).toISOString();
244
+ }
245
+
246
+ if (requestParameters['until'] != null) {
247
+ queryParameters['until'] = (requestParameters['until'] as any).toISOString();
248
+ }
249
+
250
+ if (requestParameters['timezone'] != null) {
251
+ queryParameters['timezone'] = requestParameters['timezone'];
252
+ }
253
+
254
+ if (requestParameters['definitionId'] != null) {
255
+ queryParameters['definition_id'] = requestParameters['definitionId'];
256
+ }
257
+
258
+ const headerParameters: runtime.HTTPHeaders = {};
259
+
260
+ if (this.configuration && this.configuration.accessToken) {
261
+ const token = this.configuration.accessToken;
262
+ const tokenString = await token("bearerAuth", []);
263
+
264
+ if (tokenString) {
265
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
266
+ }
267
+ }
268
+
269
+ let urlPath = `/v1/admin/workflows/by-hour`;
270
+
271
+ return {
272
+ path: urlPath,
273
+ method: 'GET',
274
+ headers: headerParameters,
275
+ query: queryParameters,
276
+ };
277
+ }
278
+
279
+ /**
280
+ * Runs per hour-of-day (0-23) in the resolved timezone.
281
+ * Get Admin Workflow By Hour Handler
282
+ */
283
+ async getAdminWorkflowByHourRaw(requestParameters: GetAdminWorkflowByHourRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HourHistogramResponse>> {
284
+ const requestOptions = await this.getAdminWorkflowByHourRequestOpts(requestParameters);
285
+ const response = await this.request(requestOptions, initOverrides);
286
+
287
+ return new runtime.JSONApiResponse(response, (jsonValue) => HourHistogramResponseFromJSON(jsonValue));
288
+ }
289
+
290
+ /**
291
+ * Runs per hour-of-day (0-23) in the resolved timezone.
292
+ * Get Admin Workflow By Hour Handler
293
+ */
294
+ async getAdminWorkflowByHour(requestParameters: GetAdminWorkflowByHourRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HourHistogramResponse> {
295
+ const response = await this.getAdminWorkflowByHourRaw(requestParameters, initOverrides);
296
+ return await response.value();
297
+ }
298
+
299
+ /**
300
+ * Creates request options for getAdminWorkflowLeaderboard without sending the request
301
+ */
302
+ async getAdminWorkflowLeaderboardRequestOpts(requestParameters: GetAdminWorkflowLeaderboardRequest): Promise<runtime.RequestOpts> {
303
+ const queryParameters: any = {};
304
+
305
+ if (requestParameters['since'] != null) {
306
+ queryParameters['since'] = (requestParameters['since'] as any).toISOString();
307
+ }
308
+
309
+ if (requestParameters['until'] != null) {
310
+ queryParameters['until'] = (requestParameters['until'] as any).toISOString();
311
+ }
312
+
313
+ if (requestParameters['limit'] != null) {
314
+ queryParameters['limit'] = requestParameters['limit'];
315
+ }
316
+
317
+ const headerParameters: runtime.HTTPHeaders = {};
318
+
319
+ if (this.configuration && this.configuration.accessToken) {
320
+ const token = this.configuration.accessToken;
321
+ const tokenString = await token("bearerAuth", []);
322
+
323
+ if (tokenString) {
324
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
325
+ }
326
+ }
327
+
328
+ let urlPath = `/v1/admin/workflows/leaderboard`;
329
+
330
+ return {
331
+ path: urlPath,
332
+ method: 'GET',
333
+ headers: headerParameters,
334
+ query: queryParameters,
335
+ };
336
+ }
337
+
338
+ /**
339
+ * Top workflows and top run owners by run count.
340
+ * Get Admin Workflow Leaderboard Handler
341
+ */
342
+ async getAdminWorkflowLeaderboardRaw(requestParameters: GetAdminWorkflowLeaderboardRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowLeaderboardResponse>> {
343
+ const requestOptions = await this.getAdminWorkflowLeaderboardRequestOpts(requestParameters);
344
+ const response = await this.request(requestOptions, initOverrides);
345
+
346
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowLeaderboardResponseFromJSON(jsonValue));
347
+ }
348
+
349
+ /**
350
+ * Top workflows and top run owners by run count.
351
+ * Get Admin Workflow Leaderboard Handler
352
+ */
353
+ async getAdminWorkflowLeaderboard(requestParameters: GetAdminWorkflowLeaderboardRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowLeaderboardResponse> {
354
+ const response = await this.getAdminWorkflowLeaderboardRaw(requestParameters, initOverrides);
355
+ return await response.value();
356
+ }
357
+
358
+ /**
359
+ * Creates request options for getAdminWorkflowOutputStats without sending the request
360
+ */
361
+ async getAdminWorkflowOutputStatsRequestOpts(requestParameters: GetAdminWorkflowOutputStatsRequest): Promise<runtime.RequestOpts> {
362
+ const queryParameters: any = {};
363
+
364
+ if (requestParameters['since'] != null) {
365
+ queryParameters['since'] = (requestParameters['since'] as any).toISOString();
366
+ }
367
+
368
+ if (requestParameters['until'] != null) {
369
+ queryParameters['until'] = (requestParameters['until'] as any).toISOString();
370
+ }
371
+
372
+ const headerParameters: runtime.HTTPHeaders = {};
373
+
374
+ if (this.configuration && this.configuration.accessToken) {
375
+ const token = this.configuration.accessToken;
376
+ const tokenString = await token("bearerAuth", []);
377
+
378
+ if (tokenString) {
379
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
380
+ }
381
+ }
382
+
383
+ let urlPath = `/v1/admin/workflows/output-stats`;
384
+
385
+ return {
386
+ path: urlPath,
387
+ method: 'GET',
388
+ headers: headerParameters,
389
+ query: queryParameters,
390
+ };
391
+ }
392
+
393
+ /**
394
+ * Average output DOCUMENTs generated per workflow definition (completed runs).
395
+ * Get Admin Workflow Output Stats Handler
396
+ */
397
+ async getAdminWorkflowOutputStatsRaw(requestParameters: GetAdminWorkflowOutputStatsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowOutputStatsResponse>> {
398
+ const requestOptions = await this.getAdminWorkflowOutputStatsRequestOpts(requestParameters);
399
+ const response = await this.request(requestOptions, initOverrides);
400
+
401
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowOutputStatsResponseFromJSON(jsonValue));
402
+ }
403
+
404
+ /**
405
+ * Average output DOCUMENTs generated per workflow definition (completed runs).
406
+ * Get Admin Workflow Output Stats Handler
407
+ */
408
+ async getAdminWorkflowOutputStats(requestParameters: GetAdminWorkflowOutputStatsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowOutputStatsResponse> {
409
+ const response = await this.getAdminWorkflowOutputStatsRaw(requestParameters, initOverrides);
410
+ return await response.value();
411
+ }
412
+
413
+ /**
414
+ * Creates request options for getAdminWorkflowSummary without sending the request
415
+ */
416
+ async getAdminWorkflowSummaryRequestOpts(requestParameters: GetAdminWorkflowSummaryRequest): Promise<runtime.RequestOpts> {
417
+ const queryParameters: any = {};
418
+
419
+ if (requestParameters['since'] != null) {
420
+ queryParameters['since'] = (requestParameters['since'] as any).toISOString();
421
+ }
422
+
423
+ if (requestParameters['until'] != null) {
424
+ queryParameters['until'] = (requestParameters['until'] as any).toISOString();
425
+ }
426
+
427
+ if (requestParameters['definitionId'] != null) {
428
+ queryParameters['definition_id'] = requestParameters['definitionId'];
429
+ }
430
+
431
+ const headerParameters: runtime.HTTPHeaders = {};
432
+
433
+ if (this.configuration && this.configuration.accessToken) {
434
+ const token = this.configuration.accessToken;
435
+ const tokenString = await token("bearerAuth", []);
436
+
437
+ if (tokenString) {
438
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
439
+ }
440
+ }
441
+
442
+ let urlPath = `/v1/admin/workflows/summary`;
443
+
444
+ return {
445
+ path: urlPath,
446
+ method: 'GET',
447
+ headers: headerParameters,
448
+ query: queryParameters,
449
+ };
450
+ }
451
+
452
+ /**
453
+ * Tenant-wide run health: counts, failure rate, durations, approval backlog.
454
+ * Get Admin Workflow Summary Handler
455
+ */
456
+ async getAdminWorkflowSummaryRaw(requestParameters: GetAdminWorkflowSummaryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WorkflowRunSummaryResponse>> {
457
+ const requestOptions = await this.getAdminWorkflowSummaryRequestOpts(requestParameters);
458
+ const response = await this.request(requestOptions, initOverrides);
459
+
460
+ return new runtime.JSONApiResponse(response, (jsonValue) => WorkflowRunSummaryResponseFromJSON(jsonValue));
461
+ }
462
+
463
+ /**
464
+ * Tenant-wide run health: counts, failure rate, durations, approval backlog.
465
+ * Get Admin Workflow Summary Handler
466
+ */
467
+ async getAdminWorkflowSummary(requestParameters: GetAdminWorkflowSummaryRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WorkflowRunSummaryResponse> {
468
+ const response = await this.getAdminWorkflowSummaryRaw(requestParameters, initOverrides);
469
+ return await response.value();
470
+ }
471
+
472
+ /**
473
+ * Creates request options for getAdminWorkflowTimeseries without sending the request
474
+ */
475
+ async getAdminWorkflowTimeseriesRequestOpts(requestParameters: GetAdminWorkflowTimeseriesRequest): Promise<runtime.RequestOpts> {
476
+ const queryParameters: any = {};
477
+
478
+ if (requestParameters['since'] != null) {
479
+ queryParameters['since'] = (requestParameters['since'] as any).toISOString();
480
+ }
481
+
482
+ if (requestParameters['until'] != null) {
483
+ queryParameters['until'] = (requestParameters['until'] as any).toISOString();
484
+ }
485
+
486
+ if (requestParameters['bucket'] != null) {
487
+ queryParameters['bucket'] = requestParameters['bucket'];
488
+ }
489
+
490
+ if (requestParameters['timezone'] != null) {
491
+ queryParameters['timezone'] = requestParameters['timezone'];
492
+ }
493
+
494
+ if (requestParameters['definitionId'] != null) {
495
+ queryParameters['definition_id'] = requestParameters['definitionId'];
496
+ }
497
+
498
+ const headerParameters: runtime.HTTPHeaders = {};
499
+
500
+ if (this.configuration && this.configuration.accessToken) {
501
+ const token = this.configuration.accessToken;
502
+ const tokenString = await token("bearerAuth", []);
503
+
504
+ if (tokenString) {
505
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
506
+ }
507
+ }
508
+
509
+ let urlPath = `/v1/admin/workflows/timeseries`;
510
+
511
+ return {
512
+ path: urlPath,
513
+ method: 'GET',
514
+ headers: headerParameters,
515
+ query: queryParameters,
516
+ };
517
+ }
518
+
519
+ /**
520
+ * Run counts bucketed over time, in the resolved timezone.
521
+ * Get Admin Workflow Timeseries Handler
522
+ */
523
+ async getAdminWorkflowTimeseriesRaw(requestParameters: GetAdminWorkflowTimeseriesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RunTimeseriesResponse>> {
524
+ const requestOptions = await this.getAdminWorkflowTimeseriesRequestOpts(requestParameters);
525
+ const response = await this.request(requestOptions, initOverrides);
526
+
527
+ return new runtime.JSONApiResponse(response, (jsonValue) => RunTimeseriesResponseFromJSON(jsonValue));
528
+ }
529
+
530
+ /**
531
+ * Run counts bucketed over time, in the resolved timezone.
532
+ * Get Admin Workflow Timeseries Handler
533
+ */
534
+ async getAdminWorkflowTimeseries(requestParameters: GetAdminWorkflowTimeseriesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RunTimeseriesResponse> {
535
+ const response = await this.getAdminWorkflowTimeseriesRaw(requestParameters, initOverrides);
536
+ return await response.value();
537
+ }
538
+
539
+ }
package/src/apis/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export * from './AdminKbApi';
4
+ export * from './AdminWorkflowsApi';
3
5
  export * from './AgentApi';
4
6
  export * from './ApiConnectionsApi';
5
7
  export * from './ApiKeysApi';
@@ -27,10 +27,12 @@ import {
27
27
  * ``chunk_id`` is the load-bearing field — every reader can use it via
28
28
  * ``/v1/chunks/bulk``. The document fields are populated by
29
29
  * ``ks_upload_from_sandbox`` when it resolves each chunk through the KS API at
30
- * save time; they stay ``None`` only when the chunk could not be resolved
31
- * (e.g. the agent cited an id that no longer exists, or the resolve call
32
- * failed). The doc-info snapshot is captured at save time; later renames
33
- * or replacements of the source document do not update it.
30
+ * save time; they stay ``None`` only when a *transient* resolve failure
31
+ * (network, 5xx) left the chunk unenriched. A chunk that no longer exists
32
+ * (a definitive 404) is dropped at save time rather than persisted with a
33
+ * bare id, so a dead citation never reaches the FE. The doc-info snapshot is
34
+ * captured at save time; later renames or replacements of the source document
35
+ * do not update it.
34
36
  * @export
35
37
  * @interface CitedChunk
36
38
  */
@@ -0,0 +1,110 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management. ## Integrating (RPA / machine clients) **Base URL.** Knowledge Stack is self-hosted — point at your own deployment host (see `servers`). The `localhost` entry is for local development only. **Authentication.** Send `Authorization: Bearer <api-key>` on every request. Mint an API key once via `POST /v1/api-keys` from a signed-in browser session; the raw `sk-user-...` secret is returned **only** at creation, so store it then. A key inherits its owning user\'s live tenant role and path permissions — create RPA keys from a least-privilege user, and set `expires_at` for rotation. The `ks_uat` cookie scheme is browser-only and cannot be used by headless clients. **Async work is polled, not pushed.** There are no outbound webhooks. - `POST /v1/documents/ingest` returns `201` immediately with a `workflow_id`; poll `GET /v1/system-jobs/document_versions/{workflow_id}` until `status` is terminal (anything other than `pending`/`processing`). The `Location` response header points at this poll resource. - `POST /v1/workflow-runs/{run_id}/start` returns `202`; poll `GET /v1/workflow-runs/{run_id}` until `execution_state` is `COMPLETED` or `FAILED`. The `Location` header points at the run resource. - `POST /v1/agent/ask` is **synchronous** — it blocks until the agent finishes and returns the answer inline. Use a generous HTTP timeout. **Pagination.** List endpoints accept `limit`/`offset` and return `{items, total, limit, offset}`. **Errors.** Every non-2xx body is `{detail, code, request_id}`. `code` is a stable value from a closed set (see the `ErrorResponse` schema\'s `code` enum) — branch on it rather than parsing `detail`. Quota rejections return `429` with a `Retry-After` header; transient lock contention returns a retryable `503`. Quote `request_id` (also the `x-request-id` response header) to support. **Idempotency.** `POST /v1/workflow-runs` accepts an `idempotency_key` to dedupe retried run creation. `agent/ask` charges one message *before* running and does not refund a client-cancelled call.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ * Average output-document count for one workflow definition.
18
+ * @export
19
+ * @interface DefinitionOutputStat
20
+ */
21
+ export interface DefinitionOutputStat {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof DefinitionOutputStat
26
+ */
27
+ definitionId: string;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof DefinitionOutputStat
32
+ */
33
+ name: string;
34
+ /**
35
+ * COMPLETED runs in the window.
36
+ * @type {number}
37
+ * @memberof DefinitionOutputStat
38
+ */
39
+ completedRuns: number;
40
+ /**
41
+ * Mean output DOCUMENTs generated per completed run.
42
+ * @type {number}
43
+ * @memberof DefinitionOutputStat
44
+ */
45
+ avgDocuments: number;
46
+ }
47
+ export const DefinitionOutputStatPropertyValidationAttributesMap: {
48
+ [property: string]: {
49
+ maxLength?: number,
50
+ minLength?: number,
51
+ pattern?: string,
52
+ maximum?: number,
53
+ exclusiveMaximum?: boolean,
54
+ minimum?: number,
55
+ exclusiveMinimum?: boolean,
56
+ multipleOf?: number,
57
+ maxItems?: number,
58
+ minItems?: number,
59
+ uniqueItems?: boolean
60
+ }
61
+ } = {
62
+ }
63
+
64
+
65
+ /**
66
+ * Check if a given object implements the DefinitionOutputStat interface.
67
+ */
68
+ export function instanceOfDefinitionOutputStat(value: object): value is DefinitionOutputStat {
69
+ if (!('definitionId' in value) || value['definitionId'] === undefined) return false;
70
+ if (!('name' in value) || value['name'] === undefined) return false;
71
+ if (!('completedRuns' in value) || value['completedRuns'] === undefined) return false;
72
+ if (!('avgDocuments' in value) || value['avgDocuments'] === undefined) return false;
73
+ return true;
74
+ }
75
+
76
+ export function DefinitionOutputStatFromJSON(json: any): DefinitionOutputStat {
77
+ return DefinitionOutputStatFromJSONTyped(json, false);
78
+ }
79
+
80
+ export function DefinitionOutputStatFromJSONTyped(json: any, ignoreDiscriminator: boolean): DefinitionOutputStat {
81
+ if (json == null) {
82
+ return json;
83
+ }
84
+ return {
85
+
86
+ 'definitionId': json['definition_id'],
87
+ 'name': json['name'],
88
+ 'completedRuns': json['completed_runs'],
89
+ 'avgDocuments': json['avg_documents'],
90
+ };
91
+ }
92
+
93
+ export function DefinitionOutputStatToJSON(json: any): DefinitionOutputStat {
94
+ return DefinitionOutputStatToJSONTyped(json, false);
95
+ }
96
+
97
+ export function DefinitionOutputStatToJSONTyped(value?: DefinitionOutputStat | null, ignoreDiscriminator: boolean = false): any {
98
+ if (value == null) {
99
+ return value;
100
+ }
101
+
102
+ return {
103
+
104
+ 'definition_id': value['definitionId'],
105
+ 'name': value['name'],
106
+ 'completed_runs': value['completedRuns'],
107
+ 'avg_documents': value['avgDocuments'],
108
+ };
109
+ }
110
+