@knowledge-stack/ksapi 1.139.0 → 1.140.0

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 (110) 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/SkillsApi.d.ts +4 -4
  8. package/dist/apis/SkillsApi.js +2 -2
  9. package/dist/apis/index.d.ts +2 -0
  10. package/dist/apis/index.js +2 -0
  11. package/dist/esm/apis/AdminKbApi.d.ts +109 -0
  12. package/dist/esm/apis/AdminKbApi.js +135 -0
  13. package/dist/esm/apis/AdminWorkflowsApi.d.ts +252 -0
  14. package/dist/esm/apis/AdminWorkflowsApi.js +300 -0
  15. package/dist/esm/apis/SkillsApi.d.ts +4 -4
  16. package/dist/esm/apis/SkillsApi.js +2 -2
  17. package/dist/esm/apis/index.d.ts +2 -0
  18. package/dist/esm/apis/index.js +2 -0
  19. package/dist/esm/models/DefinitionOutputStat.d.ts +65 -0
  20. package/dist/esm/models/DefinitionOutputStat.js +56 -0
  21. package/dist/esm/models/HourHistogramResponse.d.ts +53 -0
  22. package/dist/esm/models/HourHistogramResponse.js +54 -0
  23. package/dist/esm/models/KbMetric.d.ts +26 -0
  24. package/dist/esm/models/KbMetric.js +44 -0
  25. package/dist/esm/models/KbSummaryResponse.d.ts +152 -0
  26. package/dist/esm/models/KbSummaryResponse.js +109 -0
  27. package/dist/esm/models/KbTimeseriesResponse.d.ts +71 -0
  28. package/dist/esm/models/KbTimeseriesResponse.js +57 -0
  29. package/dist/esm/models/LabeledSeries.d.ts +54 -0
  30. package/dist/esm/models/LabeledSeries.js +47 -0
  31. package/dist/esm/models/LeaderboardEntry.d.ts +59 -0
  32. package/dist/esm/models/LeaderboardEntry.js +52 -0
  33. package/dist/esm/models/RunTimeseriesResponse.d.ts +61 -0
  34. package/dist/esm/models/RunTimeseriesResponse.js +52 -0
  35. package/dist/esm/models/SkillResponse.d.ts +7 -0
  36. package/dist/esm/models/SkillResponse.js +3 -0
  37. package/dist/esm/models/TimeBucket.d.ts +27 -0
  38. package/dist/esm/models/TimeBucket.js +45 -0
  39. package/dist/esm/models/TimeseriesPoint.d.ts +53 -0
  40. package/dist/esm/models/TimeseriesPoint.js +48 -0
  41. package/dist/esm/models/WorkflowLeaderboardResponse.d.ts +54 -0
  42. package/dist/esm/models/WorkflowLeaderboardResponse.js +45 -0
  43. package/dist/esm/models/WorkflowOutputStatsResponse.d.ts +54 -0
  44. package/dist/esm/models/WorkflowOutputStatsResponse.js +47 -0
  45. package/dist/esm/models/index.d.ts +12 -0
  46. package/dist/esm/models/index.js +12 -0
  47. package/dist/models/DefinitionOutputStat.d.ts +65 -0
  48. package/dist/models/DefinitionOutputStat.js +64 -0
  49. package/dist/models/HourHistogramResponse.d.ts +53 -0
  50. package/dist/models/HourHistogramResponse.js +62 -0
  51. package/dist/models/KbMetric.d.ts +26 -0
  52. package/dist/models/KbMetric.js +52 -0
  53. package/dist/models/KbSummaryResponse.d.ts +152 -0
  54. package/dist/models/KbSummaryResponse.js +117 -0
  55. package/dist/models/KbTimeseriesResponse.d.ts +71 -0
  56. package/dist/models/KbTimeseriesResponse.js +65 -0
  57. package/dist/models/LabeledSeries.d.ts +54 -0
  58. package/dist/models/LabeledSeries.js +55 -0
  59. package/dist/models/LeaderboardEntry.d.ts +59 -0
  60. package/dist/models/LeaderboardEntry.js +60 -0
  61. package/dist/models/RunTimeseriesResponse.d.ts +61 -0
  62. package/dist/models/RunTimeseriesResponse.js +60 -0
  63. package/dist/models/SkillResponse.d.ts +7 -0
  64. package/dist/models/SkillResponse.js +3 -0
  65. package/dist/models/TimeBucket.d.ts +27 -0
  66. package/dist/models/TimeBucket.js +53 -0
  67. package/dist/models/TimeseriesPoint.d.ts +53 -0
  68. package/dist/models/TimeseriesPoint.js +56 -0
  69. package/dist/models/WorkflowLeaderboardResponse.d.ts +54 -0
  70. package/dist/models/WorkflowLeaderboardResponse.js +53 -0
  71. package/dist/models/WorkflowOutputStatsResponse.d.ts +54 -0
  72. package/dist/models/WorkflowOutputStatsResponse.js +55 -0
  73. package/dist/models/index.d.ts +12 -0
  74. package/dist/models/index.js +12 -0
  75. package/docs/AdminKbApi.md +163 -0
  76. package/docs/AdminWorkflowsApi.md +424 -0
  77. package/docs/DefinitionOutputStat.md +41 -0
  78. package/docs/FolderResponseOrDocumentResponseOrWorkflowDefinitionResponseOrWorkflowRunResponseOrDataSourceResponseOrDataSourceSchemaR.md +2 -0
  79. package/docs/HourHistogramResponse.md +37 -0
  80. package/docs/KbMetric.md +33 -0
  81. package/docs/KbSummaryResponse.md +67 -0
  82. package/docs/KbTimeseriesResponse.md +41 -0
  83. package/docs/LabeledSeries.md +37 -0
  84. package/docs/LeaderboardEntry.md +39 -0
  85. package/docs/RunTimeseriesResponse.md +39 -0
  86. package/docs/SkillResponse.md +2 -0
  87. package/docs/SkillsApi.md +1 -1
  88. package/docs/TimeBucket.md +33 -0
  89. package/docs/TimeseriesPoint.md +37 -0
  90. package/docs/WorkflowLeaderboardResponse.md +37 -0
  91. package/docs/WorkflowOutputStatsResponse.md +37 -0
  92. package/package.json +1 -1
  93. package/src/apis/AdminKbApi.ts +237 -0
  94. package/src/apis/AdminWorkflowsApi.ts +539 -0
  95. package/src/apis/SkillsApi.ts +4 -4
  96. package/src/apis/index.ts +2 -0
  97. package/src/models/DefinitionOutputStat.ts +110 -0
  98. package/src/models/HourHistogramResponse.ts +97 -0
  99. package/src/models/KbMetric.ts +54 -0
  100. package/src/models/KbSummaryResponse.ts +235 -0
  101. package/src/models/KbTimeseriesResponse.ts +136 -0
  102. package/src/models/LabeledSeries.ts +99 -0
  103. package/src/models/LeaderboardEntry.ts +101 -0
  104. package/src/models/RunTimeseriesResponse.ts +117 -0
  105. package/src/models/SkillResponse.ts +15 -0
  106. package/src/models/TimeBucket.ts +55 -0
  107. package/src/models/TimeseriesPoint.ts +92 -0
  108. package/src/models/WorkflowLeaderboardResponse.ts +98 -0
  109. package/src/models/WorkflowOutputStatsResponse.ts +99 -0
  110. package/src/models/index.ts +12 -0
@@ -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
+
@@ -0,0 +1,97 @@
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
+ * Workflow runs by hour-of-day (0-23) in the resolved timezone.
18
+ * @export
19
+ * @interface HourHistogramResponse
20
+ */
21
+ export interface HourHistogramResponse {
22
+ /**
23
+ * IANA timezone the hours are in.
24
+ * @type {string}
25
+ * @memberof HourHistogramResponse
26
+ */
27
+ timezone: string;
28
+ /**
29
+ * Exactly 24 entries; index i is the run count for hour i.
30
+ * @type {Array<number>}
31
+ * @memberof HourHistogramResponse
32
+ */
33
+ countsByHour: Array<number>;
34
+ }
35
+ export const HourHistogramResponsePropertyValidationAttributesMap: {
36
+ [property: string]: {
37
+ maxLength?: number,
38
+ minLength?: number,
39
+ pattern?: string,
40
+ maximum?: number,
41
+ exclusiveMaximum?: boolean,
42
+ minimum?: number,
43
+ exclusiveMinimum?: boolean,
44
+ multipleOf?: number,
45
+ maxItems?: number,
46
+ minItems?: number,
47
+ uniqueItems?: boolean
48
+ }
49
+ } = {
50
+ countsByHour: {
51
+ maxItems: 24,
52
+ minItems: 24,
53
+ uniqueItems: false,
54
+ },
55
+ }
56
+
57
+
58
+ /**
59
+ * Check if a given object implements the HourHistogramResponse interface.
60
+ */
61
+ export function instanceOfHourHistogramResponse(value: object): value is HourHistogramResponse {
62
+ if (!('timezone' in value) || value['timezone'] === undefined) return false;
63
+ if (!('countsByHour' in value) || value['countsByHour'] === undefined) return false;
64
+ return true;
65
+ }
66
+
67
+ export function HourHistogramResponseFromJSON(json: any): HourHistogramResponse {
68
+ return HourHistogramResponseFromJSONTyped(json, false);
69
+ }
70
+
71
+ export function HourHistogramResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HourHistogramResponse {
72
+ if (json == null) {
73
+ return json;
74
+ }
75
+ return {
76
+
77
+ 'timezone': json['timezone'],
78
+ 'countsByHour': json['counts_by_hour'],
79
+ };
80
+ }
81
+
82
+ export function HourHistogramResponseToJSON(json: any): HourHistogramResponse {
83
+ return HourHistogramResponseToJSONTyped(json, false);
84
+ }
85
+
86
+ export function HourHistogramResponseToJSONTyped(value?: HourHistogramResponse | null, ignoreDiscriminator: boolean = false): any {
87
+ if (value == null) {
88
+ return value;
89
+ }
90
+
91
+ return {
92
+
93
+ 'timezone': value['timezone'],
94
+ 'counts_by_hour': value['countsByHour'],
95
+ };
96
+ }
97
+
@@ -0,0 +1,54 @@
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
+ /**
17
+ * A knowledge-base time series the dashboard can request.
18
+ * @export
19
+ */
20
+ export const KbMetric = {
21
+ DocumentUploads: 'document_uploads',
22
+ IngestionCompleted: 'ingestion_completed',
23
+ IngestionFailed: 'ingestion_failed'
24
+ } as const;
25
+ export type KbMetric = typeof KbMetric[keyof typeof KbMetric];
26
+
27
+
28
+ export function instanceOfKbMetric(value: any): boolean {
29
+ for (const key in KbMetric) {
30
+ if (Object.prototype.hasOwnProperty.call(KbMetric, key)) {
31
+ if (KbMetric[key as keyof typeof KbMetric] === value) {
32
+ return true;
33
+ }
34
+ }
35
+ }
36
+ return false;
37
+ }
38
+
39
+ export function KbMetricFromJSON(json: any): KbMetric {
40
+ return KbMetricFromJSONTyped(json, false);
41
+ }
42
+
43
+ export function KbMetricFromJSONTyped(json: any, ignoreDiscriminator: boolean): KbMetric {
44
+ return json as KbMetric;
45
+ }
46
+
47
+ export function KbMetricToJSON(value?: KbMetric | null): any {
48
+ return value as any;
49
+ }
50
+
51
+ export function KbMetricToJSONTyped(value: any, ignoreDiscriminator: boolean): KbMetric {
52
+ return value as KbMetric;
53
+ }
54
+
@@ -0,0 +1,235 @@
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
+ import type { MeteredQuotaStatus } from './MeteredQuotaStatus';
17
+ import {
18
+ MeteredQuotaStatusFromJSON,
19
+ MeteredQuotaStatusFromJSONTyped,
20
+ MeteredQuotaStatusToJSON,
21
+ MeteredQuotaStatusToJSONTyped,
22
+ } from './MeteredQuotaStatus';
23
+
24
+ /**
25
+ * Point-in-time knowledge-base totals for a tenant.
26
+ * @export
27
+ * @interface KbSummaryResponse
28
+ */
29
+ export interface KbSummaryResponse {
30
+ /**
31
+ *
32
+ * @type {number}
33
+ * @memberof KbSummaryResponse
34
+ */
35
+ documentsTotal: number;
36
+ /**
37
+ * Live document count keyed by document_origin.
38
+ * @type {{ [key: string]: number; }}
39
+ * @memberof KbSummaryResponse
40
+ */
41
+ documentsByOrigin: { [key: string]: number; };
42
+ /**
43
+ * Live document count keyed by document_type.
44
+ * @type {{ [key: string]: number; }}
45
+ * @memberof KbSummaryResponse
46
+ */
47
+ documentsByType: { [key: string]: number; };
48
+ /**
49
+ *
50
+ * @type {number}
51
+ * @memberof KbSummaryResponse
52
+ */
53
+ documentVersionsTotal: number;
54
+ /**
55
+ *
56
+ * @type {number}
57
+ * @memberof KbSummaryResponse
58
+ */
59
+ chunksTotal: number;
60
+ /**
61
+ *
62
+ * @type {{ [key: string]: number; }}
63
+ * @memberof KbSummaryResponse
64
+ */
65
+ chunksByType: { [key: string]: number; };
66
+ /**
67
+ * Sum of chunk.num_tokens (cl100k).
68
+ * @type {number}
69
+ * @memberof KbSummaryResponse
70
+ */
71
+ tokensTotal: number;
72
+ /**
73
+ *
74
+ * @type {number}
75
+ * @memberof KbSummaryResponse
76
+ */
77
+ sectionsTotal: number;
78
+ /**
79
+ *
80
+ * @type {number}
81
+ * @memberof KbSummaryResponse
82
+ */
83
+ threadsTotal: number;
84
+ /**
85
+ *
86
+ * @type {number}
87
+ * @memberof KbSummaryResponse
88
+ */
89
+ messagesTotal: number;
90
+ /**
91
+ *
92
+ * @type {{ [key: string]: number; }}
93
+ * @memberof KbSummaryResponse
94
+ */
95
+ messagesByRole: { [key: string]: number; };
96
+ /**
97
+ *
98
+ * @type {number}
99
+ * @memberof KbSummaryResponse
100
+ */
101
+ dataSourcesTotal: number;
102
+ /**
103
+ *
104
+ * @type {number}
105
+ * @memberof KbSummaryResponse
106
+ */
107
+ dataSourceTablesTotal: number;
108
+ /**
109
+ *
110
+ * @type {number}
111
+ * @memberof KbSummaryResponse
112
+ */
113
+ documentsCheckedOut: number;
114
+ /**
115
+ * Current-period usage vs limit per metered resource.
116
+ * @type {Array<MeteredQuotaStatus>}
117
+ * @memberof KbSummaryResponse
118
+ */
119
+ quota: Array<MeteredQuotaStatus>;
120
+ /**
121
+ *
122
+ * @type {number}
123
+ * @memberof KbSummaryResponse
124
+ */
125
+ feedbackUp: number;
126
+ /**
127
+ *
128
+ * @type {number}
129
+ * @memberof KbSummaryResponse
130
+ */
131
+ feedbackDown: number;
132
+ }
133
+ export const KbSummaryResponsePropertyValidationAttributesMap: {
134
+ [property: string]: {
135
+ maxLength?: number,
136
+ minLength?: number,
137
+ pattern?: string,
138
+ maximum?: number,
139
+ exclusiveMaximum?: boolean,
140
+ minimum?: number,
141
+ exclusiveMinimum?: boolean,
142
+ multipleOf?: number,
143
+ maxItems?: number,
144
+ minItems?: number,
145
+ uniqueItems?: boolean
146
+ }
147
+ } = {
148
+ }
149
+
150
+
151
+ /**
152
+ * Check if a given object implements the KbSummaryResponse interface.
153
+ */
154
+ export function instanceOfKbSummaryResponse(value: object): value is KbSummaryResponse {
155
+ if (!('documentsTotal' in value) || value['documentsTotal'] === undefined) return false;
156
+ if (!('documentsByOrigin' in value) || value['documentsByOrigin'] === undefined) return false;
157
+ if (!('documentsByType' in value) || value['documentsByType'] === undefined) return false;
158
+ if (!('documentVersionsTotal' in value) || value['documentVersionsTotal'] === undefined) return false;
159
+ if (!('chunksTotal' in value) || value['chunksTotal'] === undefined) return false;
160
+ if (!('chunksByType' in value) || value['chunksByType'] === undefined) return false;
161
+ if (!('tokensTotal' in value) || value['tokensTotal'] === undefined) return false;
162
+ if (!('sectionsTotal' in value) || value['sectionsTotal'] === undefined) return false;
163
+ if (!('threadsTotal' in value) || value['threadsTotal'] === undefined) return false;
164
+ if (!('messagesTotal' in value) || value['messagesTotal'] === undefined) return false;
165
+ if (!('messagesByRole' in value) || value['messagesByRole'] === undefined) return false;
166
+ if (!('dataSourcesTotal' in value) || value['dataSourcesTotal'] === undefined) return false;
167
+ if (!('dataSourceTablesTotal' in value) || value['dataSourceTablesTotal'] === undefined) return false;
168
+ if (!('documentsCheckedOut' in value) || value['documentsCheckedOut'] === undefined) return false;
169
+ if (!('quota' in value) || value['quota'] === undefined) return false;
170
+ if (!('feedbackUp' in value) || value['feedbackUp'] === undefined) return false;
171
+ if (!('feedbackDown' in value) || value['feedbackDown'] === undefined) return false;
172
+ return true;
173
+ }
174
+
175
+ export function KbSummaryResponseFromJSON(json: any): KbSummaryResponse {
176
+ return KbSummaryResponseFromJSONTyped(json, false);
177
+ }
178
+
179
+ export function KbSummaryResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): KbSummaryResponse {
180
+ if (json == null) {
181
+ return json;
182
+ }
183
+ return {
184
+
185
+ 'documentsTotal': json['documents_total'],
186
+ 'documentsByOrigin': json['documents_by_origin'],
187
+ 'documentsByType': json['documents_by_type'],
188
+ 'documentVersionsTotal': json['document_versions_total'],
189
+ 'chunksTotal': json['chunks_total'],
190
+ 'chunksByType': json['chunks_by_type'],
191
+ 'tokensTotal': json['tokens_total'],
192
+ 'sectionsTotal': json['sections_total'],
193
+ 'threadsTotal': json['threads_total'],
194
+ 'messagesTotal': json['messages_total'],
195
+ 'messagesByRole': json['messages_by_role'],
196
+ 'dataSourcesTotal': json['data_sources_total'],
197
+ 'dataSourceTablesTotal': json['data_source_tables_total'],
198
+ 'documentsCheckedOut': json['documents_checked_out'],
199
+ 'quota': ((json['quota'] as Array<any>).map(MeteredQuotaStatusFromJSON)),
200
+ 'feedbackUp': json['feedback_up'],
201
+ 'feedbackDown': json['feedback_down'],
202
+ };
203
+ }
204
+
205
+ export function KbSummaryResponseToJSON(json: any): KbSummaryResponse {
206
+ return KbSummaryResponseToJSONTyped(json, false);
207
+ }
208
+
209
+ export function KbSummaryResponseToJSONTyped(value?: KbSummaryResponse | null, ignoreDiscriminator: boolean = false): any {
210
+ if (value == null) {
211
+ return value;
212
+ }
213
+
214
+ return {
215
+
216
+ 'documents_total': value['documentsTotal'],
217
+ 'documents_by_origin': value['documentsByOrigin'],
218
+ 'documents_by_type': value['documentsByType'],
219
+ 'document_versions_total': value['documentVersionsTotal'],
220
+ 'chunks_total': value['chunksTotal'],
221
+ 'chunks_by_type': value['chunksByType'],
222
+ 'tokens_total': value['tokensTotal'],
223
+ 'sections_total': value['sectionsTotal'],
224
+ 'threads_total': value['threadsTotal'],
225
+ 'messages_total': value['messagesTotal'],
226
+ 'messages_by_role': value['messagesByRole'],
227
+ 'data_sources_total': value['dataSourcesTotal'],
228
+ 'data_source_tables_total': value['dataSourceTablesTotal'],
229
+ 'documents_checked_out': value['documentsCheckedOut'],
230
+ 'quota': ((value['quota'] as Array<any>).map(MeteredQuotaStatusToJSON)),
231
+ 'feedback_up': value['feedbackUp'],
232
+ 'feedback_down': value['feedbackDown'],
233
+ };
234
+ }
235
+
@@ -0,0 +1,136 @@
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
+ import type { KbMetric } from './KbMetric';
17
+ import {
18
+ KbMetricFromJSON,
19
+ KbMetricFromJSONTyped,
20
+ KbMetricToJSON,
21
+ KbMetricToJSONTyped,
22
+ } from './KbMetric';
23
+ import type { TimeBucket } from './TimeBucket';
24
+ import {
25
+ TimeBucketFromJSON,
26
+ TimeBucketFromJSONTyped,
27
+ TimeBucketToJSON,
28
+ TimeBucketToJSONTyped,
29
+ } from './TimeBucket';
30
+ import type { LabeledSeries } from './LabeledSeries';
31
+ import {
32
+ LabeledSeriesFromJSON,
33
+ LabeledSeriesFromJSONTyped,
34
+ LabeledSeriesToJSON,
35
+ LabeledSeriesToJSONTyped,
36
+ } from './LabeledSeries';
37
+
38
+ /**
39
+ * A knowledge-base metric bucketed over time.
40
+ *
41
+ * ``series`` carries one entry per split — two (SOURCE / GENERATED) for
42
+ * ``document_uploads``, one for the ingestion metrics.
43
+ * @export
44
+ * @interface KbTimeseriesResponse
45
+ */
46
+ export interface KbTimeseriesResponse {
47
+ /**
48
+ *
49
+ * @type {KbMetric}
50
+ * @memberof KbTimeseriesResponse
51
+ */
52
+ metric: KbMetric;
53
+ /**
54
+ *
55
+ * @type {string}
56
+ * @memberof KbTimeseriesResponse
57
+ */
58
+ timezone: string;
59
+ /**
60
+ *
61
+ * @type {TimeBucket}
62
+ * @memberof KbTimeseriesResponse
63
+ */
64
+ bucket: TimeBucket;
65
+ /**
66
+ *
67
+ * @type {Array<LabeledSeries>}
68
+ * @memberof KbTimeseriesResponse
69
+ */
70
+ series?: Array<LabeledSeries>;
71
+ }
72
+
73
+
74
+ export const KbTimeseriesResponsePropertyValidationAttributesMap: {
75
+ [property: string]: {
76
+ maxLength?: number,
77
+ minLength?: number,
78
+ pattern?: string,
79
+ maximum?: number,
80
+ exclusiveMaximum?: boolean,
81
+ minimum?: number,
82
+ exclusiveMinimum?: boolean,
83
+ multipleOf?: number,
84
+ maxItems?: number,
85
+ minItems?: number,
86
+ uniqueItems?: boolean
87
+ }
88
+ } = {
89
+ }
90
+
91
+
92
+ /**
93
+ * Check if a given object implements the KbTimeseriesResponse interface.
94
+ */
95
+ export function instanceOfKbTimeseriesResponse(value: object): value is KbTimeseriesResponse {
96
+ if (!('metric' in value) || value['metric'] === undefined) return false;
97
+ if (!('timezone' in value) || value['timezone'] === undefined) return false;
98
+ if (!('bucket' in value) || value['bucket'] === undefined) return false;
99
+ return true;
100
+ }
101
+
102
+ export function KbTimeseriesResponseFromJSON(json: any): KbTimeseriesResponse {
103
+ return KbTimeseriesResponseFromJSONTyped(json, false);
104
+ }
105
+
106
+ export function KbTimeseriesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): KbTimeseriesResponse {
107
+ if (json == null) {
108
+ return json;
109
+ }
110
+ return {
111
+
112
+ 'metric': KbMetricFromJSON(json['metric']),
113
+ 'timezone': json['timezone'],
114
+ 'bucket': TimeBucketFromJSON(json['bucket']),
115
+ 'series': json['series'] == null ? undefined : ((json['series'] as Array<any>).map(LabeledSeriesFromJSON)),
116
+ };
117
+ }
118
+
119
+ export function KbTimeseriesResponseToJSON(json: any): KbTimeseriesResponse {
120
+ return KbTimeseriesResponseToJSONTyped(json, false);
121
+ }
122
+
123
+ export function KbTimeseriesResponseToJSONTyped(value?: KbTimeseriesResponse | null, ignoreDiscriminator: boolean = false): any {
124
+ if (value == null) {
125
+ return value;
126
+ }
127
+
128
+ return {
129
+
130
+ 'metric': KbMetricToJSON(value['metric']),
131
+ 'timezone': value['timezone'],
132
+ 'bucket': TimeBucketToJSON(value['bucket']),
133
+ 'series': value['series'] == null ? undefined : ((value['series'] as Array<any>).map(LabeledSeriesToJSON)),
134
+ };
135
+ }
136
+