@knowledge-stack/ksapi 3.5.2 → 3.6.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.
- package/.openapi-generator/FILES +12 -0
- package/README.md +9 -2
- package/dist/apis/DiagnosticsApi.d.ts +102 -0
- package/dist/apis/DiagnosticsApi.js +162 -0
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +1 -0
- package/dist/esm/apis/DiagnosticsApi.d.ts +102 -0
- package/dist/esm/apis/DiagnosticsApi.js +125 -0
- package/dist/esm/apis/index.d.ts +1 -0
- package/dist/esm/apis/index.js +1 -0
- package/dist/esm/models/DiagnosticTraceFailureReason.d.ts +27 -0
- package/dist/esm/models/DiagnosticTraceFailureReason.js +45 -0
- package/dist/esm/models/DiagnosticTraceItem.d.ts +280 -0
- package/dist/esm/models/DiagnosticTraceItem.js +131 -0
- package/dist/esm/models/DiagnosticTraceStatus.d.ts +26 -0
- package/dist/esm/models/DiagnosticTraceStatus.js +44 -0
- package/dist/esm/models/DiagnosticsResponse.d.ts +54 -0
- package/dist/esm/models/DiagnosticsResponse.js +49 -0
- package/dist/esm/models/TraceKind.d.ts +25 -0
- package/dist/esm/models/TraceKind.js +43 -0
- package/dist/esm/models/index.d.ts +5 -0
- package/dist/esm/models/index.js +5 -0
- package/dist/models/DiagnosticTraceFailureReason.d.ts +27 -0
- package/dist/models/DiagnosticTraceFailureReason.js +53 -0
- package/dist/models/DiagnosticTraceItem.d.ts +280 -0
- package/dist/models/DiagnosticTraceItem.js +139 -0
- package/dist/models/DiagnosticTraceStatus.d.ts +26 -0
- package/dist/models/DiagnosticTraceStatus.js +52 -0
- package/dist/models/DiagnosticsResponse.d.ts +54 -0
- package/dist/models/DiagnosticsResponse.js +57 -0
- package/dist/models/TraceKind.d.ts +25 -0
- package/dist/models/TraceKind.js +51 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.js +5 -0
- package/docs/DiagnosticTraceFailureReason.md +32 -0
- package/docs/DiagnosticTraceItem.md +111 -0
- package/docs/DiagnosticTraceStatus.md +32 -0
- package/docs/DiagnosticsApi.md +160 -0
- package/docs/DiagnosticsResponse.md +36 -0
- package/docs/TraceKind.md +32 -0
- package/package.json +1 -1
- package/src/apis/DiagnosticsApi.ts +211 -0
- package/src/apis/index.ts +1 -0
- package/src/models/DiagnosticTraceFailureReason.ts +55 -0
- package/src/models/DiagnosticTraceItem.ts +415 -0
- package/src/models/DiagnosticTraceStatus.ts +54 -0
- package/src/models/DiagnosticsResponse.ts +100 -0
- package/src/models/TraceKind.ts +53 -0
- package/src/models/index.ts +5 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# DiagnosticsApi
|
|
2
|
+
|
|
3
|
+
All URIs are relative to *http://localhost:8000*
|
|
4
|
+
|
|
5
|
+
| Method | HTTP request | Description |
|
|
6
|
+
|------------- | ------------- | -------------|
|
|
7
|
+
| [**computeThreadDiagnostics**](DiagnosticsApi.md#computethreaddiagnostics) | **POST** /v1/diagnostics/threads/{thread_id} | Compute Thread Diagnostics Handler |
|
|
8
|
+
| [**computeWorkflowRunDiagnostics**](DiagnosticsApi.md#computeworkflowrundiagnostics) | **POST** /v1/diagnostics/workflow-runs/{run_id} | Compute Workflow Run Diagnostics Handler |
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## computeThreadDiagnostics
|
|
13
|
+
|
|
14
|
+
> DiagnosticsResponse computeThreadDiagnostics(threadId)
|
|
15
|
+
|
|
16
|
+
Compute Thread Diagnostics Handler
|
|
17
|
+
|
|
18
|
+
Stats and trace links for every turn; a run\'s thread answers as its run.
|
|
19
|
+
|
|
20
|
+
### Example
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import {
|
|
24
|
+
Configuration,
|
|
25
|
+
DiagnosticsApi,
|
|
26
|
+
} from '@knowledge-stack/ksapi';
|
|
27
|
+
import type { ComputeThreadDiagnosticsRequest } from '@knowledge-stack/ksapi';
|
|
28
|
+
|
|
29
|
+
async function example() {
|
|
30
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
31
|
+
const config = new Configuration({
|
|
32
|
+
// To configure API key authorization: cookieAuth
|
|
33
|
+
apiKey: "YOUR API KEY",
|
|
34
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
35
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
36
|
+
});
|
|
37
|
+
const api = new DiagnosticsApi(config);
|
|
38
|
+
|
|
39
|
+
const body = {
|
|
40
|
+
// string
|
|
41
|
+
threadId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
42
|
+
} satisfies ComputeThreadDiagnosticsRequest;
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const data = await api.computeThreadDiagnostics(body);
|
|
46
|
+
console.log(data);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error(error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Run the test
|
|
53
|
+
example().catch(console.error);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Parameters
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
| Name | Type | Description | Notes |
|
|
60
|
+
|------------- | ------------- | ------------- | -------------|
|
|
61
|
+
| **threadId** | `string` | | [Defaults to `undefined`] |
|
|
62
|
+
|
|
63
|
+
### Return type
|
|
64
|
+
|
|
65
|
+
[**DiagnosticsResponse**](DiagnosticsResponse.md)
|
|
66
|
+
|
|
67
|
+
### Authorization
|
|
68
|
+
|
|
69
|
+
[cookieAuth](../README.md#cookieAuth), [bearerAuth](../README.md#bearerAuth)
|
|
70
|
+
|
|
71
|
+
### HTTP request headers
|
|
72
|
+
|
|
73
|
+
- **Content-Type**: Not defined
|
|
74
|
+
- **Accept**: `application/json`
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### HTTP response details
|
|
78
|
+
| Status code | Description | Response headers |
|
|
79
|
+
|-------------|-------------|------------------|
|
|
80
|
+
| **200** | Successful Response | - |
|
|
81
|
+
| **422** | Validation Error | - |
|
|
82
|
+
| **0** | Error response. | - |
|
|
83
|
+
|
|
84
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
## computeWorkflowRunDiagnostics
|
|
88
|
+
|
|
89
|
+
> DiagnosticsResponse computeWorkflowRunDiagnostics(runId)
|
|
90
|
+
|
|
91
|
+
Compute Workflow Run Diagnostics Handler
|
|
92
|
+
|
|
93
|
+
Stats and trace links for the run\'s attempts and every turn in its thread.
|
|
94
|
+
|
|
95
|
+
### Example
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
import {
|
|
99
|
+
Configuration,
|
|
100
|
+
DiagnosticsApi,
|
|
101
|
+
} from '@knowledge-stack/ksapi';
|
|
102
|
+
import type { ComputeWorkflowRunDiagnosticsRequest } from '@knowledge-stack/ksapi';
|
|
103
|
+
|
|
104
|
+
async function example() {
|
|
105
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
106
|
+
const config = new Configuration({
|
|
107
|
+
// To configure API key authorization: cookieAuth
|
|
108
|
+
apiKey: "YOUR API KEY",
|
|
109
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
110
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
111
|
+
});
|
|
112
|
+
const api = new DiagnosticsApi(config);
|
|
113
|
+
|
|
114
|
+
const body = {
|
|
115
|
+
// string
|
|
116
|
+
runId: 38400000-8cf0-11bd-b23e-10b96e4ef00d,
|
|
117
|
+
} satisfies ComputeWorkflowRunDiagnosticsRequest;
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
const data = await api.computeWorkflowRunDiagnostics(body);
|
|
121
|
+
console.log(data);
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error(error);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Run the test
|
|
128
|
+
example().catch(console.error);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Parameters
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
| Name | Type | Description | Notes |
|
|
135
|
+
|------------- | ------------- | ------------- | -------------|
|
|
136
|
+
| **runId** | `string` | | [Defaults to `undefined`] |
|
|
137
|
+
|
|
138
|
+
### Return type
|
|
139
|
+
|
|
140
|
+
[**DiagnosticsResponse**](DiagnosticsResponse.md)
|
|
141
|
+
|
|
142
|
+
### Authorization
|
|
143
|
+
|
|
144
|
+
[cookieAuth](../README.md#cookieAuth), [bearerAuth](../README.md#bearerAuth)
|
|
145
|
+
|
|
146
|
+
### HTTP request headers
|
|
147
|
+
|
|
148
|
+
- **Content-Type**: Not defined
|
|
149
|
+
- **Accept**: `application/json`
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
### HTTP response details
|
|
153
|
+
| Status code | Description | Response headers |
|
|
154
|
+
|-------------|-------------|------------------|
|
|
155
|
+
| **200** | Successful Response | - |
|
|
156
|
+
| **422** | Validation Error | - |
|
|
157
|
+
| **0** | Error response. | - |
|
|
158
|
+
|
|
159
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
160
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# DiagnosticsResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`_final` | boolean
|
|
10
|
+
`traces` | [Array<DiagnosticTraceItem>](DiagnosticTraceItem.md)
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { DiagnosticsResponse } from '@knowledge-stack/ksapi'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"_final": null,
|
|
20
|
+
"traces": null,
|
|
21
|
+
} satisfies DiagnosticsResponse
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as DiagnosticsResponse
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
35
|
+
|
|
36
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
# TraceKind
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import type { TraceKind } from '@knowledge-stack/ksapi'
|
|
14
|
+
|
|
15
|
+
// TODO: Update the object below with actual values
|
|
16
|
+
const example = {
|
|
17
|
+
} satisfies TraceKind
|
|
18
|
+
|
|
19
|
+
console.log(example)
|
|
20
|
+
|
|
21
|
+
// Convert the instance to a JSON string
|
|
22
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
23
|
+
console.log(exampleJSON)
|
|
24
|
+
|
|
25
|
+
// Parse the JSON string back to an object
|
|
26
|
+
const exampleParsed = JSON.parse(exampleJSON) as TraceKind
|
|
27
|
+
console.log(exampleParsed)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
31
|
+
|
|
32
|
+
|
package/package.json
CHANGED
|
@@ -0,0 +1,211 @@
|
|
|
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
|
+
DiagnosticsResponse,
|
|
19
|
+
ErrorResponse,
|
|
20
|
+
HTTPValidationError,
|
|
21
|
+
} from '../models/index';
|
|
22
|
+
import {
|
|
23
|
+
DiagnosticsResponseFromJSON,
|
|
24
|
+
DiagnosticsResponseToJSON,
|
|
25
|
+
ErrorResponseFromJSON,
|
|
26
|
+
ErrorResponseToJSON,
|
|
27
|
+
HTTPValidationErrorFromJSON,
|
|
28
|
+
HTTPValidationErrorToJSON,
|
|
29
|
+
} from '../models/index';
|
|
30
|
+
|
|
31
|
+
export interface ComputeThreadDiagnosticsRequest {
|
|
32
|
+
threadId: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ComputeWorkflowRunDiagnosticsRequest {
|
|
36
|
+
runId: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* DiagnosticsApi - interface
|
|
41
|
+
*
|
|
42
|
+
* @export
|
|
43
|
+
* @interface DiagnosticsApiInterface
|
|
44
|
+
*/
|
|
45
|
+
export interface DiagnosticsApiInterface {
|
|
46
|
+
/**
|
|
47
|
+
* Creates request options for computeThreadDiagnostics without sending the request
|
|
48
|
+
* @param {string} threadId
|
|
49
|
+
* @throws {RequiredError}
|
|
50
|
+
* @memberof DiagnosticsApiInterface
|
|
51
|
+
*/
|
|
52
|
+
computeThreadDiagnosticsRequestOpts(requestParameters: ComputeThreadDiagnosticsRequest): Promise<runtime.RequestOpts>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Stats and trace links for every turn; a run\'s thread answers as its run.
|
|
56
|
+
* @summary Compute Thread Diagnostics Handler
|
|
57
|
+
* @param {string} threadId
|
|
58
|
+
* @param {*} [options] Override http request option.
|
|
59
|
+
* @throws {RequiredError}
|
|
60
|
+
* @memberof DiagnosticsApiInterface
|
|
61
|
+
*/
|
|
62
|
+
computeThreadDiagnosticsRaw(requestParameters: ComputeThreadDiagnosticsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DiagnosticsResponse>>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Stats and trace links for every turn; a run\'s thread answers as its run.
|
|
66
|
+
* Compute Thread Diagnostics Handler
|
|
67
|
+
*/
|
|
68
|
+
computeThreadDiagnostics(requestParameters: ComputeThreadDiagnosticsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DiagnosticsResponse>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Creates request options for computeWorkflowRunDiagnostics without sending the request
|
|
72
|
+
* @param {string} runId
|
|
73
|
+
* @throws {RequiredError}
|
|
74
|
+
* @memberof DiagnosticsApiInterface
|
|
75
|
+
*/
|
|
76
|
+
computeWorkflowRunDiagnosticsRequestOpts(requestParameters: ComputeWorkflowRunDiagnosticsRequest): Promise<runtime.RequestOpts>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Stats and trace links for the run\'s attempts and every turn in its thread.
|
|
80
|
+
* @summary Compute Workflow Run Diagnostics Handler
|
|
81
|
+
* @param {string} runId
|
|
82
|
+
* @param {*} [options] Override http request option.
|
|
83
|
+
* @throws {RequiredError}
|
|
84
|
+
* @memberof DiagnosticsApiInterface
|
|
85
|
+
*/
|
|
86
|
+
computeWorkflowRunDiagnosticsRaw(requestParameters: ComputeWorkflowRunDiagnosticsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DiagnosticsResponse>>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Stats and trace links for the run\'s attempts and every turn in its thread.
|
|
90
|
+
* Compute Workflow Run Diagnostics Handler
|
|
91
|
+
*/
|
|
92
|
+
computeWorkflowRunDiagnostics(requestParameters: ComputeWorkflowRunDiagnosticsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DiagnosticsResponse>;
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
export class DiagnosticsApi extends runtime.BaseAPI implements DiagnosticsApiInterface {
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Creates request options for computeThreadDiagnostics without sending the request
|
|
103
|
+
*/
|
|
104
|
+
async computeThreadDiagnosticsRequestOpts(requestParameters: ComputeThreadDiagnosticsRequest): Promise<runtime.RequestOpts> {
|
|
105
|
+
if (requestParameters['threadId'] == null) {
|
|
106
|
+
throw new runtime.RequiredError(
|
|
107
|
+
'threadId',
|
|
108
|
+
'Required parameter "threadId" was null or undefined when calling computeThreadDiagnostics().'
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const queryParameters: any = {};
|
|
113
|
+
|
|
114
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
115
|
+
|
|
116
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
117
|
+
const token = this.configuration.accessToken;
|
|
118
|
+
const tokenString = await token("bearerAuth", []);
|
|
119
|
+
|
|
120
|
+
if (tokenString) {
|
|
121
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let urlPath = `/v1/diagnostics/threads/{thread_id}`;
|
|
126
|
+
urlPath = urlPath.replace(`{${"thread_id"}}`, encodeURIComponent(String(requestParameters['threadId'])));
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
path: urlPath,
|
|
130
|
+
method: 'POST',
|
|
131
|
+
headers: headerParameters,
|
|
132
|
+
query: queryParameters,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Stats and trace links for every turn; a run\'s thread answers as its run.
|
|
138
|
+
* Compute Thread Diagnostics Handler
|
|
139
|
+
*/
|
|
140
|
+
async computeThreadDiagnosticsRaw(requestParameters: ComputeThreadDiagnosticsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DiagnosticsResponse>> {
|
|
141
|
+
const requestOptions = await this.computeThreadDiagnosticsRequestOpts(requestParameters);
|
|
142
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
143
|
+
|
|
144
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DiagnosticsResponseFromJSON(jsonValue));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Stats and trace links for every turn; a run\'s thread answers as its run.
|
|
149
|
+
* Compute Thread Diagnostics Handler
|
|
150
|
+
*/
|
|
151
|
+
async computeThreadDiagnostics(requestParameters: ComputeThreadDiagnosticsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DiagnosticsResponse> {
|
|
152
|
+
const response = await this.computeThreadDiagnosticsRaw(requestParameters, initOverrides);
|
|
153
|
+
return await response.value();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Creates request options for computeWorkflowRunDiagnostics without sending the request
|
|
158
|
+
*/
|
|
159
|
+
async computeWorkflowRunDiagnosticsRequestOpts(requestParameters: ComputeWorkflowRunDiagnosticsRequest): Promise<runtime.RequestOpts> {
|
|
160
|
+
if (requestParameters['runId'] == null) {
|
|
161
|
+
throw new runtime.RequiredError(
|
|
162
|
+
'runId',
|
|
163
|
+
'Required parameter "runId" was null or undefined when calling computeWorkflowRunDiagnostics().'
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const queryParameters: any = {};
|
|
168
|
+
|
|
169
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
170
|
+
|
|
171
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
172
|
+
const token = this.configuration.accessToken;
|
|
173
|
+
const tokenString = await token("bearerAuth", []);
|
|
174
|
+
|
|
175
|
+
if (tokenString) {
|
|
176
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
let urlPath = `/v1/diagnostics/workflow-runs/{run_id}`;
|
|
181
|
+
urlPath = urlPath.replace(`{${"run_id"}}`, encodeURIComponent(String(requestParameters['runId'])));
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
path: urlPath,
|
|
185
|
+
method: 'POST',
|
|
186
|
+
headers: headerParameters,
|
|
187
|
+
query: queryParameters,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Stats and trace links for the run\'s attempts and every turn in its thread.
|
|
193
|
+
* Compute Workflow Run Diagnostics Handler
|
|
194
|
+
*/
|
|
195
|
+
async computeWorkflowRunDiagnosticsRaw(requestParameters: ComputeWorkflowRunDiagnosticsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DiagnosticsResponse>> {
|
|
196
|
+
const requestOptions = await this.computeWorkflowRunDiagnosticsRequestOpts(requestParameters);
|
|
197
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
198
|
+
|
|
199
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => DiagnosticsResponseFromJSON(jsonValue));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Stats and trace links for the run\'s attempts and every turn in its thread.
|
|
204
|
+
* Compute Workflow Run Diagnostics Handler
|
|
205
|
+
*/
|
|
206
|
+
async computeWorkflowRunDiagnostics(requestParameters: ComputeWorkflowRunDiagnosticsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DiagnosticsResponse> {
|
|
207
|
+
const response = await this.computeWorkflowRunDiagnosticsRaw(requestParameters, initOverrides);
|
|
208
|
+
return await response.value();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
}
|
package/src/apis/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './ChunkLineagesApi';
|
|
|
15
15
|
export * from './ChunksApi';
|
|
16
16
|
export * from './DataSourcesApi';
|
|
17
17
|
export * from './DefaultApi';
|
|
18
|
+
export * from './DiagnosticsApi';
|
|
18
19
|
export * from './DocumentCheckoutApi';
|
|
19
20
|
export * from './DocumentVersionsApi';
|
|
20
21
|
export * from './DocumentsApi';
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
*
|
|
18
|
+
* @export
|
|
19
|
+
*/
|
|
20
|
+
export const DiagnosticTraceFailureReason = {
|
|
21
|
+
TooLarge: 'too_large',
|
|
22
|
+
ClickhouseError: 'clickhouse_error',
|
|
23
|
+
MalformedTrace: 'malformed_trace',
|
|
24
|
+
NoTrace: 'no_trace'
|
|
25
|
+
} as const;
|
|
26
|
+
export type DiagnosticTraceFailureReason = typeof DiagnosticTraceFailureReason[keyof typeof DiagnosticTraceFailureReason];
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export function instanceOfDiagnosticTraceFailureReason(value: any): boolean {
|
|
30
|
+
for (const key in DiagnosticTraceFailureReason) {
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(DiagnosticTraceFailureReason, key)) {
|
|
32
|
+
if (DiagnosticTraceFailureReason[key as keyof typeof DiagnosticTraceFailureReason] === value) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function DiagnosticTraceFailureReasonFromJSON(json: any): DiagnosticTraceFailureReason {
|
|
41
|
+
return DiagnosticTraceFailureReasonFromJSONTyped(json, false);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function DiagnosticTraceFailureReasonFromJSONTyped(json: any, ignoreDiscriminator: boolean): DiagnosticTraceFailureReason {
|
|
45
|
+
return json as DiagnosticTraceFailureReason;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function DiagnosticTraceFailureReasonToJSON(value?: DiagnosticTraceFailureReason | null): any {
|
|
49
|
+
return value as any;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function DiagnosticTraceFailureReasonToJSONTyped(value: any, ignoreDiscriminator: boolean): DiagnosticTraceFailureReason {
|
|
53
|
+
return value as DiagnosticTraceFailureReason;
|
|
54
|
+
}
|
|
55
|
+
|