@knowledge-stack/ksapi 3.5.2 → 3.6.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 (49) hide show
  1. package/.openapi-generator/FILES +12 -0
  2. package/README.md +9 -2
  3. package/dist/apis/DiagnosticsApi.d.ts +102 -0
  4. package/dist/apis/DiagnosticsApi.js +162 -0
  5. package/dist/apis/index.d.ts +1 -0
  6. package/dist/apis/index.js +1 -0
  7. package/dist/esm/apis/DiagnosticsApi.d.ts +102 -0
  8. package/dist/esm/apis/DiagnosticsApi.js +125 -0
  9. package/dist/esm/apis/index.d.ts +1 -0
  10. package/dist/esm/apis/index.js +1 -0
  11. package/dist/esm/models/DiagnosticTraceFailureReason.d.ts +27 -0
  12. package/dist/esm/models/DiagnosticTraceFailureReason.js +45 -0
  13. package/dist/esm/models/DiagnosticTraceItem.d.ts +280 -0
  14. package/dist/esm/models/DiagnosticTraceItem.js +131 -0
  15. package/dist/esm/models/DiagnosticTraceStatus.d.ts +26 -0
  16. package/dist/esm/models/DiagnosticTraceStatus.js +44 -0
  17. package/dist/esm/models/DiagnosticsResponse.d.ts +54 -0
  18. package/dist/esm/models/DiagnosticsResponse.js +49 -0
  19. package/dist/esm/models/TraceKind.d.ts +25 -0
  20. package/dist/esm/models/TraceKind.js +43 -0
  21. package/dist/esm/models/index.d.ts +5 -0
  22. package/dist/esm/models/index.js +5 -0
  23. package/dist/models/DiagnosticTraceFailureReason.d.ts +27 -0
  24. package/dist/models/DiagnosticTraceFailureReason.js +53 -0
  25. package/dist/models/DiagnosticTraceItem.d.ts +280 -0
  26. package/dist/models/DiagnosticTraceItem.js +139 -0
  27. package/dist/models/DiagnosticTraceStatus.d.ts +26 -0
  28. package/dist/models/DiagnosticTraceStatus.js +52 -0
  29. package/dist/models/DiagnosticsResponse.d.ts +54 -0
  30. package/dist/models/DiagnosticsResponse.js +57 -0
  31. package/dist/models/TraceKind.d.ts +25 -0
  32. package/dist/models/TraceKind.js +51 -0
  33. package/dist/models/index.d.ts +5 -0
  34. package/dist/models/index.js +5 -0
  35. package/docs/DiagnosticTraceFailureReason.md +32 -0
  36. package/docs/DiagnosticTraceItem.md +111 -0
  37. package/docs/DiagnosticTraceStatus.md +32 -0
  38. package/docs/DiagnosticsApi.md +160 -0
  39. package/docs/DiagnosticsResponse.md +36 -0
  40. package/docs/TraceKind.md +32 -0
  41. package/package.json +1 -1
  42. package/src/apis/DiagnosticsApi.ts +211 -0
  43. package/src/apis/index.ts +1 -0
  44. package/src/models/DiagnosticTraceFailureReason.ts +55 -0
  45. package/src/models/DiagnosticTraceItem.ts +415 -0
  46. package/src/models/DiagnosticTraceStatus.ts +54 -0
  47. package/src/models/DiagnosticsResponse.ts +100 -0
  48. package/src/models/TraceKind.ts +53 -0
  49. package/src/models/index.ts +5 -0
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * 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.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ */
16
+ export declare const DiagnosticTraceFailureReason: {
17
+ readonly TooLarge: 'too_large';
18
+ readonly ClickhouseError: 'clickhouse_error';
19
+ readonly MalformedTrace: 'malformed_trace';
20
+ readonly NoTrace: 'no_trace';
21
+ };
22
+ export type DiagnosticTraceFailureReason = typeof DiagnosticTraceFailureReason[keyof typeof DiagnosticTraceFailureReason];
23
+ export declare function instanceOfDiagnosticTraceFailureReason(value: any): boolean;
24
+ export declare function DiagnosticTraceFailureReasonFromJSON(json: any): DiagnosticTraceFailureReason;
25
+ export declare function DiagnosticTraceFailureReasonFromJSONTyped(json: any, ignoreDiscriminator: boolean): DiagnosticTraceFailureReason;
26
+ export declare function DiagnosticTraceFailureReasonToJSON(value?: DiagnosticTraceFailureReason | null): any;
27
+ export declare function DiagnosticTraceFailureReasonToJSONTyped(value: any, ignoreDiscriminator: boolean): DiagnosticTraceFailureReason;
@@ -0,0 +1,45 @@
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
+ * @export
17
+ */
18
+ export const DiagnosticTraceFailureReason = {
19
+ TooLarge: 'too_large',
20
+ ClickhouseError: 'clickhouse_error',
21
+ MalformedTrace: 'malformed_trace',
22
+ NoTrace: 'no_trace'
23
+ };
24
+ export function instanceOfDiagnosticTraceFailureReason(value) {
25
+ for (const key in DiagnosticTraceFailureReason) {
26
+ if (Object.prototype.hasOwnProperty.call(DiagnosticTraceFailureReason, key)) {
27
+ if (DiagnosticTraceFailureReason[key] === value) {
28
+ return true;
29
+ }
30
+ }
31
+ }
32
+ return false;
33
+ }
34
+ export function DiagnosticTraceFailureReasonFromJSON(json) {
35
+ return DiagnosticTraceFailureReasonFromJSONTyped(json, false);
36
+ }
37
+ export function DiagnosticTraceFailureReasonFromJSONTyped(json, ignoreDiscriminator) {
38
+ return json;
39
+ }
40
+ export function DiagnosticTraceFailureReasonToJSON(value) {
41
+ return value;
42
+ }
43
+ export function DiagnosticTraceFailureReasonToJSONTyped(value, ignoreDiscriminator) {
44
+ return value;
45
+ }
@@ -0,0 +1,280 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * 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.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { TraceKind } from './TraceKind';
13
+ import type { DiagnosticTraceStatus } from './DiagnosticTraceStatus';
14
+ import type { DiagnosticTraceFailureReason } from './DiagnosticTraceFailureReason';
15
+ /**
16
+ * One trace of the conversation; stats and the link are null unless ready.
17
+ * @export
18
+ * @interface DiagnosticTraceItem
19
+ */
20
+ export interface DiagnosticTraceItem {
21
+ /**
22
+ *
23
+ * @type {DiagnosticTraceStatus}
24
+ * @memberof DiagnosticTraceItem
25
+ */
26
+ status: DiagnosticTraceStatus;
27
+ /**
28
+ *
29
+ * @type {TraceKind}
30
+ * @memberof DiagnosticTraceItem
31
+ */
32
+ kind: TraceKind;
33
+ /**
34
+ *
35
+ * @type {DiagnosticTraceFailureReason}
36
+ * @memberof DiagnosticTraceItem
37
+ */
38
+ reason?: DiagnosticTraceFailureReason;
39
+ /**
40
+ *
41
+ * @type {string}
42
+ * @memberof DiagnosticTraceItem
43
+ */
44
+ traceId: string | null;
45
+ /**
46
+ *
47
+ * @type {string}
48
+ * @memberof DiagnosticTraceItem
49
+ */
50
+ runId?: string | null;
51
+ /**
52
+ *
53
+ * @type {string}
54
+ * @memberof DiagnosticTraceItem
55
+ */
56
+ threadId?: string | null;
57
+ /**
58
+ *
59
+ * @type {string}
60
+ * @memberof DiagnosticTraceItem
61
+ */
62
+ messageId?: string | null;
63
+ /**
64
+ *
65
+ * @type {string}
66
+ * @memberof DiagnosticTraceItem
67
+ */
68
+ userId: string | null;
69
+ /**
70
+ *
71
+ * @type {Date}
72
+ * @memberof DiagnosticTraceItem
73
+ */
74
+ startedAt: Date | null;
75
+ /**
76
+ *
77
+ * @type {Date}
78
+ * @memberof DiagnosticTraceItem
79
+ */
80
+ endedAt?: Date | null;
81
+ /**
82
+ *
83
+ * @type {number}
84
+ * @memberof DiagnosticTraceItem
85
+ */
86
+ durationMs?: number | null;
87
+ /**
88
+ *
89
+ * @type {string}
90
+ * @memberof DiagnosticTraceItem
91
+ */
92
+ model?: string | null;
93
+ /**
94
+ *
95
+ * @type {number}
96
+ * @memberof DiagnosticTraceItem
97
+ */
98
+ generations?: number | null;
99
+ /**
100
+ *
101
+ * @type {number}
102
+ * @memberof DiagnosticTraceItem
103
+ */
104
+ toolCalls?: number | null;
105
+ /**
106
+ *
107
+ * @type {number}
108
+ * @memberof DiagnosticTraceItem
109
+ */
110
+ subagents?: number | null;
111
+ /**
112
+ *
113
+ * @type {number}
114
+ * @memberof DiagnosticTraceItem
115
+ */
116
+ inputTokens?: number | null;
117
+ /**
118
+ *
119
+ * @type {number}
120
+ * @memberof DiagnosticTraceItem
121
+ */
122
+ outputTokens?: number | null;
123
+ /**
124
+ *
125
+ * @type {number}
126
+ * @memberof DiagnosticTraceItem
127
+ */
128
+ cachedTokens?: number | null;
129
+ /**
130
+ *
131
+ * @type {number}
132
+ * @memberof DiagnosticTraceItem
133
+ */
134
+ reasoningTokens?: number | null;
135
+ /**
136
+ *
137
+ * @type {number}
138
+ * @memberof DiagnosticTraceItem
139
+ */
140
+ maxContext?: number | null;
141
+ /**
142
+ *
143
+ * @type {number}
144
+ * @memberof DiagnosticTraceItem
145
+ */
146
+ degenerateGens?: number | null;
147
+ /**
148
+ *
149
+ * @type {number}
150
+ * @memberof DiagnosticTraceItem
151
+ */
152
+ selfDoubtPer1k?: number | null;
153
+ /**
154
+ *
155
+ * @type {number}
156
+ * @memberof DiagnosticTraceItem
157
+ */
158
+ cacheRate?: number | null;
159
+ /**
160
+ *
161
+ * @type {number}
162
+ * @memberof DiagnosticTraceItem
163
+ */
164
+ reasoningShare?: number | null;
165
+ /**
166
+ *
167
+ * @type {number}
168
+ * @memberof DiagnosticTraceItem
169
+ */
170
+ singleToolRate?: number | null;
171
+ /**
172
+ *
173
+ * @type {number}
174
+ * @memberof DiagnosticTraceItem
175
+ */
176
+ nEvents?: number | null;
177
+ /**
178
+ *
179
+ * @type {{ [key: string]: any; }}
180
+ * @memberof DiagnosticTraceItem
181
+ */
182
+ metrics?: {
183
+ [key: string]: any;
184
+ } | null;
185
+ /**
186
+ *
187
+ * @type {boolean}
188
+ * @memberof DiagnosticTraceItem
189
+ */
190
+ traceComplete?: boolean | null;
191
+ /**
192
+ *
193
+ * @type {boolean}
194
+ * @memberof DiagnosticTraceItem
195
+ */
196
+ corruptResults?: boolean | null;
197
+ /**
198
+ *
199
+ * @type {string}
200
+ * @memberof DiagnosticTraceItem
201
+ */
202
+ backendVersion?: string | null;
203
+ /**
204
+ *
205
+ * @type {number}
206
+ * @memberof DiagnosticTraceItem
207
+ */
208
+ schemaVersion?: number | null;
209
+ /**
210
+ *
211
+ * @type {string}
212
+ * @memberof DiagnosticTraceItem
213
+ */
214
+ title?: string | null;
215
+ /**
216
+ *
217
+ * @type {string}
218
+ * @memberof DiagnosticTraceItem
219
+ */
220
+ path?: string | null;
221
+ /**
222
+ *
223
+ * @type {string}
224
+ * @memberof DiagnosticTraceItem
225
+ */
226
+ workflowId?: string | null;
227
+ /**
228
+ *
229
+ * @type {string}
230
+ * @memberof DiagnosticTraceItem
231
+ */
232
+ workflowName?: string | null;
233
+ /**
234
+ *
235
+ * @type {string}
236
+ * @memberof DiagnosticTraceItem
237
+ */
238
+ state?: string | null;
239
+ /**
240
+ *
241
+ * @type {string}
242
+ * @memberof DiagnosticTraceItem
243
+ */
244
+ runLabel?: string | null;
245
+ /**
246
+ *
247
+ * @type {string}
248
+ * @memberof DiagnosticTraceItem
249
+ */
250
+ traceUrl?: string | null;
251
+ /**
252
+ *
253
+ * @type {number}
254
+ * @memberof DiagnosticTraceItem
255
+ */
256
+ expiresInSeconds?: number | null;
257
+ }
258
+ export declare const DiagnosticTraceItemPropertyValidationAttributesMap: {
259
+ [property: string]: {
260
+ maxLength?: number;
261
+ minLength?: number;
262
+ pattern?: string;
263
+ maximum?: number;
264
+ exclusiveMaximum?: boolean;
265
+ minimum?: number;
266
+ exclusiveMinimum?: boolean;
267
+ multipleOf?: number;
268
+ maxItems?: number;
269
+ minItems?: number;
270
+ uniqueItems?: boolean;
271
+ };
272
+ };
273
+ /**
274
+ * Check if a given object implements the DiagnosticTraceItem interface.
275
+ */
276
+ export declare function instanceOfDiagnosticTraceItem(value: object): value is DiagnosticTraceItem;
277
+ export declare function DiagnosticTraceItemFromJSON(json: any): DiagnosticTraceItem;
278
+ export declare function DiagnosticTraceItemFromJSONTyped(json: any, ignoreDiscriminator: boolean): DiagnosticTraceItem;
279
+ export declare function DiagnosticTraceItemToJSON(json: any): DiagnosticTraceItem;
280
+ export declare function DiagnosticTraceItemToJSONTyped(value?: DiagnosticTraceItem | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,131 @@
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
+ import { TraceKindFromJSON, TraceKindToJSON, } from './TraceKind';
15
+ import { DiagnosticTraceStatusFromJSON, DiagnosticTraceStatusToJSON, } from './DiagnosticTraceStatus';
16
+ import { DiagnosticTraceFailureReasonFromJSON, DiagnosticTraceFailureReasonToJSON, } from './DiagnosticTraceFailureReason';
17
+ export const DiagnosticTraceItemPropertyValidationAttributesMap = {};
18
+ /**
19
+ * Check if a given object implements the DiagnosticTraceItem interface.
20
+ */
21
+ export function instanceOfDiagnosticTraceItem(value) {
22
+ if (!('status' in value) || value['status'] === undefined)
23
+ return false;
24
+ if (!('kind' in value) || value['kind'] === undefined)
25
+ return false;
26
+ if (!('traceId' in value) || value['traceId'] === undefined)
27
+ return false;
28
+ if (!('userId' in value) || value['userId'] === undefined)
29
+ return false;
30
+ if (!('startedAt' in value) || value['startedAt'] === undefined)
31
+ return false;
32
+ return true;
33
+ }
34
+ export function DiagnosticTraceItemFromJSON(json) {
35
+ return DiagnosticTraceItemFromJSONTyped(json, false);
36
+ }
37
+ export function DiagnosticTraceItemFromJSONTyped(json, ignoreDiscriminator) {
38
+ if (json == null) {
39
+ return json;
40
+ }
41
+ return {
42
+ 'status': DiagnosticTraceStatusFromJSON(json['status']),
43
+ 'kind': TraceKindFromJSON(json['kind']),
44
+ 'reason': json['reason'] == null ? undefined : DiagnosticTraceFailureReasonFromJSON(json['reason']),
45
+ 'traceId': json['trace_id'],
46
+ 'runId': json['run_id'] == null ? undefined : json['run_id'],
47
+ 'threadId': json['thread_id'] == null ? undefined : json['thread_id'],
48
+ 'messageId': json['message_id'] == null ? undefined : json['message_id'],
49
+ 'userId': json['user_id'],
50
+ 'startedAt': (json['started_at'] == null ? null : new Date(json['started_at'])),
51
+ 'endedAt': json['ended_at'] == null ? undefined : (new Date(json['ended_at'])),
52
+ 'durationMs': json['duration_ms'] == null ? undefined : json['duration_ms'],
53
+ 'model': json['model'] == null ? undefined : json['model'],
54
+ 'generations': json['generations'] == null ? undefined : json['generations'],
55
+ 'toolCalls': json['tool_calls'] == null ? undefined : json['tool_calls'],
56
+ 'subagents': json['subagents'] == null ? undefined : json['subagents'],
57
+ 'inputTokens': json['input_tokens'] == null ? undefined : json['input_tokens'],
58
+ 'outputTokens': json['output_tokens'] == null ? undefined : json['output_tokens'],
59
+ 'cachedTokens': json['cached_tokens'] == null ? undefined : json['cached_tokens'],
60
+ 'reasoningTokens': json['reasoning_tokens'] == null ? undefined : json['reasoning_tokens'],
61
+ 'maxContext': json['max_context'] == null ? undefined : json['max_context'],
62
+ 'degenerateGens': json['degenerate_gens'] == null ? undefined : json['degenerate_gens'],
63
+ 'selfDoubtPer1k': json['self_doubt_per_1k'] == null ? undefined : json['self_doubt_per_1k'],
64
+ 'cacheRate': json['cache_rate'] == null ? undefined : json['cache_rate'],
65
+ 'reasoningShare': json['reasoning_share'] == null ? undefined : json['reasoning_share'],
66
+ 'singleToolRate': json['single_tool_rate'] == null ? undefined : json['single_tool_rate'],
67
+ 'nEvents': json['n_events'] == null ? undefined : json['n_events'],
68
+ 'metrics': json['metrics'] == null ? undefined : json['metrics'],
69
+ 'traceComplete': json['trace_complete'] == null ? undefined : json['trace_complete'],
70
+ 'corruptResults': json['corrupt_results'] == null ? undefined : json['corrupt_results'],
71
+ 'backendVersion': json['backend_version'] == null ? undefined : json['backend_version'],
72
+ 'schemaVersion': json['schema_version'] == null ? undefined : json['schema_version'],
73
+ 'title': json['title'] == null ? undefined : json['title'],
74
+ 'path': json['path'] == null ? undefined : json['path'],
75
+ 'workflowId': json['workflow_id'] == null ? undefined : json['workflow_id'],
76
+ 'workflowName': json['workflow_name'] == null ? undefined : json['workflow_name'],
77
+ 'state': json['state'] == null ? undefined : json['state'],
78
+ 'runLabel': json['run_label'] == null ? undefined : json['run_label'],
79
+ 'traceUrl': json['trace_url'] == null ? undefined : json['trace_url'],
80
+ 'expiresInSeconds': json['expires_in_seconds'] == null ? undefined : json['expires_in_seconds'],
81
+ };
82
+ }
83
+ export function DiagnosticTraceItemToJSON(json) {
84
+ return DiagnosticTraceItemToJSONTyped(json, false);
85
+ }
86
+ export function DiagnosticTraceItemToJSONTyped(value, ignoreDiscriminator = false) {
87
+ if (value == null) {
88
+ return value;
89
+ }
90
+ return {
91
+ 'status': DiagnosticTraceStatusToJSON(value['status']),
92
+ 'kind': TraceKindToJSON(value['kind']),
93
+ 'reason': DiagnosticTraceFailureReasonToJSON(value['reason']),
94
+ 'trace_id': value['traceId'],
95
+ 'run_id': value['runId'],
96
+ 'thread_id': value['threadId'],
97
+ 'message_id': value['messageId'],
98
+ 'user_id': value['userId'],
99
+ 'started_at': value['startedAt'] == null ? value['startedAt'] : value['startedAt'].toISOString(),
100
+ 'ended_at': value['endedAt'] == null ? value['endedAt'] : value['endedAt'].toISOString(),
101
+ 'duration_ms': value['durationMs'],
102
+ 'model': value['model'],
103
+ 'generations': value['generations'],
104
+ 'tool_calls': value['toolCalls'],
105
+ 'subagents': value['subagents'],
106
+ 'input_tokens': value['inputTokens'],
107
+ 'output_tokens': value['outputTokens'],
108
+ 'cached_tokens': value['cachedTokens'],
109
+ 'reasoning_tokens': value['reasoningTokens'],
110
+ 'max_context': value['maxContext'],
111
+ 'degenerate_gens': value['degenerateGens'],
112
+ 'self_doubt_per_1k': value['selfDoubtPer1k'],
113
+ 'cache_rate': value['cacheRate'],
114
+ 'reasoning_share': value['reasoningShare'],
115
+ 'single_tool_rate': value['singleToolRate'],
116
+ 'n_events': value['nEvents'],
117
+ 'metrics': value['metrics'],
118
+ 'trace_complete': value['traceComplete'],
119
+ 'corrupt_results': value['corruptResults'],
120
+ 'backend_version': value['backendVersion'],
121
+ 'schema_version': value['schemaVersion'],
122
+ 'title': value['title'],
123
+ 'path': value['path'],
124
+ 'workflow_id': value['workflowId'],
125
+ 'workflow_name': value['workflowName'],
126
+ 'state': value['state'],
127
+ 'run_label': value['runLabel'],
128
+ 'trace_url': value['traceUrl'],
129
+ 'expires_in_seconds': value['expiresInSeconds'],
130
+ };
131
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * 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.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ */
16
+ export declare const DiagnosticTraceStatus: {
17
+ readonly Ready: 'ready';
18
+ readonly Pending: 'pending';
19
+ readonly Failed: 'failed';
20
+ };
21
+ export type DiagnosticTraceStatus = typeof DiagnosticTraceStatus[keyof typeof DiagnosticTraceStatus];
22
+ export declare function instanceOfDiagnosticTraceStatus(value: any): boolean;
23
+ export declare function DiagnosticTraceStatusFromJSON(json: any): DiagnosticTraceStatus;
24
+ export declare function DiagnosticTraceStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): DiagnosticTraceStatus;
25
+ export declare function DiagnosticTraceStatusToJSON(value?: DiagnosticTraceStatus | null): any;
26
+ export declare function DiagnosticTraceStatusToJSONTyped(value: any, ignoreDiscriminator: boolean): DiagnosticTraceStatus;
@@ -0,0 +1,44 @@
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
+ * @export
17
+ */
18
+ export const DiagnosticTraceStatus = {
19
+ Ready: 'ready',
20
+ Pending: 'pending',
21
+ Failed: 'failed'
22
+ };
23
+ export function instanceOfDiagnosticTraceStatus(value) {
24
+ for (const key in DiagnosticTraceStatus) {
25
+ if (Object.prototype.hasOwnProperty.call(DiagnosticTraceStatus, key)) {
26
+ if (DiagnosticTraceStatus[key] === value) {
27
+ return true;
28
+ }
29
+ }
30
+ }
31
+ return false;
32
+ }
33
+ export function DiagnosticTraceStatusFromJSON(json) {
34
+ return DiagnosticTraceStatusFromJSONTyped(json, false);
35
+ }
36
+ export function DiagnosticTraceStatusFromJSONTyped(json, ignoreDiscriminator) {
37
+ return json;
38
+ }
39
+ export function DiagnosticTraceStatusToJSON(value) {
40
+ return value;
41
+ }
42
+ export function DiagnosticTraceStatusToJSONTyped(value, ignoreDiscriminator) {
43
+ return value;
44
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * 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.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { DiagnosticTraceItem } from './DiagnosticTraceItem';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface DiagnosticsResponse
17
+ */
18
+ export interface DiagnosticsResponse {
19
+ /**
20
+ * True when no item is pending.
21
+ * @type {boolean}
22
+ * @memberof DiagnosticsResponse
23
+ */
24
+ _final: boolean;
25
+ /**
26
+ *
27
+ * @type {Array<DiagnosticTraceItem>}
28
+ * @memberof DiagnosticsResponse
29
+ */
30
+ traces: Array<DiagnosticTraceItem>;
31
+ }
32
+ export declare const DiagnosticsResponsePropertyValidationAttributesMap: {
33
+ [property: string]: {
34
+ maxLength?: number;
35
+ minLength?: number;
36
+ pattern?: string;
37
+ maximum?: number;
38
+ exclusiveMaximum?: boolean;
39
+ minimum?: number;
40
+ exclusiveMinimum?: boolean;
41
+ multipleOf?: number;
42
+ maxItems?: number;
43
+ minItems?: number;
44
+ uniqueItems?: boolean;
45
+ };
46
+ };
47
+ /**
48
+ * Check if a given object implements the DiagnosticsResponse interface.
49
+ */
50
+ export declare function instanceOfDiagnosticsResponse(value: object): value is DiagnosticsResponse;
51
+ export declare function DiagnosticsResponseFromJSON(json: any): DiagnosticsResponse;
52
+ export declare function DiagnosticsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DiagnosticsResponse;
53
+ export declare function DiagnosticsResponseToJSON(json: any): DiagnosticsResponse;
54
+ export declare function DiagnosticsResponseToJSONTyped(value?: DiagnosticsResponse | null, ignoreDiscriminator?: boolean): any;