@knowledge-stack/ksapi 1.80.0 → 1.81.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.
- package/.openapi-generator/FILES +6 -0
- package/README.md +8 -2
- package/dist/apis/AgentApi.d.ts +4 -4
- package/dist/apis/AgentApi.js +2 -2
- package/dist/apis/SubscriptionsApi.d.ts +9 -9
- package/dist/apis/SubscriptionsApi.js +3 -3
- package/dist/apis/UsersApi.d.ts +130 -1
- package/dist/apis/UsersApi.js +130 -0
- package/dist/esm/apis/AgentApi.d.ts +4 -4
- package/dist/esm/apis/AgentApi.js +2 -2
- package/dist/esm/apis/SubscriptionsApi.d.ts +9 -9
- package/dist/esm/apis/SubscriptionsApi.js +4 -4
- package/dist/esm/apis/UsersApi.d.ts +130 -1
- package/dist/esm/apis/UsersApi.js +131 -1
- package/dist/esm/models/DocumentResponse.d.ts +6 -0
- package/dist/esm/models/DocumentResponse.js +2 -0
- package/dist/esm/models/FolderResponse.d.ts +6 -0
- package/dist/esm/models/FolderResponse.js +2 -0
- package/dist/esm/models/MeteredQuotaStatus.d.ts +6 -0
- package/dist/esm/models/MeteredQuotaStatus.js +2 -0
- package/dist/esm/models/OnboardingCompanyRequest.d.ts +53 -0
- package/dist/esm/models/OnboardingCompanyRequest.js +51 -0
- package/dist/esm/models/OnboardingProfileRequest.d.ts +59 -0
- package/dist/esm/models/OnboardingProfileRequest.js +50 -0
- package/dist/esm/models/SubmitSubscriptionResponse.d.ts +75 -0
- package/dist/esm/models/SubmitSubscriptionResponse.js +52 -0
- package/dist/esm/models/TenantSettingsResponse.d.ts +6 -0
- package/dist/esm/models/TenantSettingsResponse.js +2 -0
- package/dist/esm/models/TenantSettingsUpdate.d.ts +6 -0
- package/dist/esm/models/TenantSettingsUpdate.js +10 -1
- package/dist/esm/models/UserResponse.d.ts +12 -0
- package/dist/esm/models/UserResponse.js +4 -0
- package/dist/esm/models/index.d.ts +3 -0
- package/dist/esm/models/index.js +3 -0
- package/dist/models/DocumentResponse.d.ts +6 -0
- package/dist/models/DocumentResponse.js +2 -0
- package/dist/models/FolderResponse.d.ts +6 -0
- package/dist/models/FolderResponse.js +2 -0
- package/dist/models/MeteredQuotaStatus.d.ts +6 -0
- package/dist/models/MeteredQuotaStatus.js +2 -0
- package/dist/models/OnboardingCompanyRequest.d.ts +53 -0
- package/dist/models/OnboardingCompanyRequest.js +59 -0
- package/dist/models/OnboardingProfileRequest.d.ts +59 -0
- package/dist/models/OnboardingProfileRequest.js +58 -0
- package/dist/models/SubmitSubscriptionResponse.d.ts +75 -0
- package/dist/models/SubmitSubscriptionResponse.js +60 -0
- package/dist/models/TenantSettingsResponse.d.ts +6 -0
- package/dist/models/TenantSettingsResponse.js +2 -0
- package/dist/models/TenantSettingsUpdate.d.ts +6 -0
- package/dist/models/TenantSettingsUpdate.js +10 -1
- package/dist/models/UserResponse.d.ts +12 -0
- package/dist/models/UserResponse.js +4 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +3 -0
- package/docs/AgentApi.md +1 -1
- package/docs/DocumentResponse.md +2 -0
- package/docs/FolderResponse.md +2 -0
- package/docs/FolderResponseOrDocumentResponse.md +2 -0
- package/docs/MeteredQuotaStatus.md +2 -0
- package/docs/OnboardingCompanyRequest.md +37 -0
- package/docs/OnboardingProfileRequest.md +39 -0
- package/docs/SubmitSubscriptionResponse.md +39 -0
- package/docs/SubscriptionsApi.md +4 -4
- package/docs/TenantSettingsResponse.md +2 -0
- package/docs/TenantSettingsUpdate.md +2 -0
- package/docs/UserResponse.md +4 -0
- package/docs/UsersApi.md +222 -0
- package/package.json +1 -1
- package/src/apis/AgentApi.ts +4 -4
- package/src/apis/SubscriptionsApi.ts +12 -12
- package/src/apis/UsersApi.ts +254 -0
- package/src/models/DocumentResponse.ts +8 -0
- package/src/models/FolderResponse.ts +8 -0
- package/src/models/MeteredQuotaStatus.ts +8 -0
- package/src/models/OnboardingCompanyRequest.ts +96 -0
- package/src/models/OnboardingProfileRequest.ts +101 -0
- package/src/models/SubmitSubscriptionResponse.ts +117 -0
- package/src/models/TenantSettingsResponse.ts +8 -0
- package/src/models/TenantSettingsUpdate.ts +14 -0
- package/src/models/UserResponse.ts +16 -0
- package/src/models/index.ts +3 -0
|
@@ -9,6 +9,7 @@ Name | Type
|
|
|
9
9
|
------------ | -------------
|
|
10
10
|
`language` | [SupportedLanguage](SupportedLanguage.md)
|
|
11
11
|
`description` | string
|
|
12
|
+
`industry` | string
|
|
12
13
|
`timezone` | string
|
|
13
14
|
`brandName` | string
|
|
14
15
|
`brandColor` | string
|
|
@@ -24,6 +25,7 @@ import type { TenantSettingsUpdate } from '@knowledge-stack/ksapi'
|
|
|
24
25
|
const example = {
|
|
25
26
|
"language": null,
|
|
26
27
|
"description": null,
|
|
28
|
+
"industry": null,
|
|
27
29
|
"timezone": null,
|
|
28
30
|
"brandName": null,
|
|
29
31
|
"brandColor": null,
|
package/docs/UserResponse.md
CHANGED
|
@@ -14,6 +14,8 @@ Name | Type
|
|
|
14
14
|
`currentTenantId` | string
|
|
15
15
|
`currentTenantRole` | [TenantUserRole](TenantUserRole.md)
|
|
16
16
|
`defaultTenantId` | string
|
|
17
|
+
`jobTitle` | string
|
|
18
|
+
`onboardingCompletedAt` | Date
|
|
17
19
|
|
|
18
20
|
## Example
|
|
19
21
|
|
|
@@ -30,6 +32,8 @@ const example = {
|
|
|
30
32
|
"currentTenantId": null,
|
|
31
33
|
"currentTenantRole": null,
|
|
32
34
|
"defaultTenantId": null,
|
|
35
|
+
"jobTitle": null,
|
|
36
|
+
"onboardingCompletedAt": null,
|
|
33
37
|
} satisfies UserResponse
|
|
34
38
|
|
|
35
39
|
console.log(example)
|
package/docs/UsersApi.md
CHANGED
|
@@ -5,7 +5,10 @@ All URIs are relative to *http://localhost:8000*
|
|
|
5
5
|
| Method | HTTP request | Description |
|
|
6
6
|
|------------- | ------------- | -------------|
|
|
7
7
|
| [**getMe**](UsersApi.md#getme) | **GET** /v1/users/me | Get Me Handler |
|
|
8
|
+
| [**skipOnboarding**](UsersApi.md#skiponboarding) | **POST** /v1/users/me/onboarding/skip | Skip Onboarding Handler |
|
|
8
9
|
| [**updateMe**](UsersApi.md#updateme) | **PATCH** /v1/users | Update Me Handler |
|
|
10
|
+
| [**updateOnboardingCompany**](UsersApi.md#updateonboardingcompany) | **PATCH** /v1/users/me/onboarding/company | Update Onboarding Company Handler |
|
|
11
|
+
| [**updateOnboardingProfile**](UsersApi.md#updateonboardingprofile) | **PATCH** /v1/users/me/onboarding/profile | Update Onboarding Profile Handler |
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -80,6 +83,77 @@ No authorization required
|
|
|
80
83
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
81
84
|
|
|
82
85
|
|
|
86
|
+
## skipOnboarding
|
|
87
|
+
|
|
88
|
+
> UserResponse skipOnboarding(authorization, ksUat)
|
|
89
|
+
|
|
90
|
+
Skip Onboarding Handler
|
|
91
|
+
|
|
92
|
+
Mark onboarding complete without writing any profile/company fields. Idempotent — calling this after onboarding is already complete returns the current state unchanged (the CRUD only stamps the timestamp when it is NULL).
|
|
93
|
+
|
|
94
|
+
### Example
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import {
|
|
98
|
+
Configuration,
|
|
99
|
+
UsersApi,
|
|
100
|
+
} from '@knowledge-stack/ksapi';
|
|
101
|
+
import type { SkipOnboardingRequest } from '@knowledge-stack/ksapi';
|
|
102
|
+
|
|
103
|
+
async function example() {
|
|
104
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
105
|
+
const api = new UsersApi();
|
|
106
|
+
|
|
107
|
+
const body = {
|
|
108
|
+
// string (optional)
|
|
109
|
+
authorization: authorization_example,
|
|
110
|
+
// string (optional)
|
|
111
|
+
ksUat: ksUat_example,
|
|
112
|
+
} satisfies SkipOnboardingRequest;
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
const data = await api.skipOnboarding(body);
|
|
116
|
+
console.log(data);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error(error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Run the test
|
|
123
|
+
example().catch(console.error);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Parameters
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
| Name | Type | Description | Notes |
|
|
130
|
+
|------------- | ------------- | ------------- | -------------|
|
|
131
|
+
| **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
132
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
133
|
+
|
|
134
|
+
### Return type
|
|
135
|
+
|
|
136
|
+
[**UserResponse**](UserResponse.md)
|
|
137
|
+
|
|
138
|
+
### Authorization
|
|
139
|
+
|
|
140
|
+
No authorization required
|
|
141
|
+
|
|
142
|
+
### HTTP request headers
|
|
143
|
+
|
|
144
|
+
- **Content-Type**: Not defined
|
|
145
|
+
- **Accept**: `application/json`
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### HTTP response details
|
|
149
|
+
| Status code | Description | Response headers |
|
|
150
|
+
|-------------|-------------|------------------|
|
|
151
|
+
| **200** | Successful Response | - |
|
|
152
|
+
| **422** | Validation Error | - |
|
|
153
|
+
|
|
154
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
155
|
+
|
|
156
|
+
|
|
83
157
|
## updateMe
|
|
84
158
|
|
|
85
159
|
> UserResponse updateMe(updateUserRequest, authorization, ksUat)
|
|
@@ -153,3 +227,151 @@ No authorization required
|
|
|
153
227
|
|
|
154
228
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
155
229
|
|
|
230
|
+
|
|
231
|
+
## updateOnboardingCompany
|
|
232
|
+
|
|
233
|
+
> UserResponse updateOnboardingCompany(onboardingCompanyRequest, authorization, ksUat)
|
|
234
|
+
|
|
235
|
+
Update Onboarding Company Handler
|
|
236
|
+
|
|
237
|
+
Step 1 of onboarding: tenant-wide company info. Writes ``industry`` and ``description`` into the current tenant\'s settings JSONB. Restricted to OWNER and ADMIN — invited USERs see a pre-filled, read-only step on the frontend instead. Does not mark onboarding complete; the user finishes via the profile step. Re-running while the wizard is still open overwrites prior values; once onboarding has been completed/skipped, this endpoint returns 409. Post-onboarding edits go through PATCH /v1/tenants/{id}.
|
|
238
|
+
|
|
239
|
+
### Example
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
import {
|
|
243
|
+
Configuration,
|
|
244
|
+
UsersApi,
|
|
245
|
+
} from '@knowledge-stack/ksapi';
|
|
246
|
+
import type { UpdateOnboardingCompanyRequest } from '@knowledge-stack/ksapi';
|
|
247
|
+
|
|
248
|
+
async function example() {
|
|
249
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
250
|
+
const api = new UsersApi();
|
|
251
|
+
|
|
252
|
+
const body = {
|
|
253
|
+
// OnboardingCompanyRequest
|
|
254
|
+
onboardingCompanyRequest: ...,
|
|
255
|
+
// string (optional)
|
|
256
|
+
authorization: authorization_example,
|
|
257
|
+
// string (optional)
|
|
258
|
+
ksUat: ksUat_example,
|
|
259
|
+
} satisfies UpdateOnboardingCompanyRequest;
|
|
260
|
+
|
|
261
|
+
try {
|
|
262
|
+
const data = await api.updateOnboardingCompany(body);
|
|
263
|
+
console.log(data);
|
|
264
|
+
} catch (error) {
|
|
265
|
+
console.error(error);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Run the test
|
|
270
|
+
example().catch(console.error);
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Parameters
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
| Name | Type | Description | Notes |
|
|
277
|
+
|------------- | ------------- | ------------- | -------------|
|
|
278
|
+
| **onboardingCompanyRequest** | [OnboardingCompanyRequest](OnboardingCompanyRequest.md) | | |
|
|
279
|
+
| **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
280
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
281
|
+
|
|
282
|
+
### Return type
|
|
283
|
+
|
|
284
|
+
[**UserResponse**](UserResponse.md)
|
|
285
|
+
|
|
286
|
+
### Authorization
|
|
287
|
+
|
|
288
|
+
No authorization required
|
|
289
|
+
|
|
290
|
+
### HTTP request headers
|
|
291
|
+
|
|
292
|
+
- **Content-Type**: `application/json`
|
|
293
|
+
- **Accept**: `application/json`
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
### HTTP response details
|
|
297
|
+
| Status code | Description | Response headers |
|
|
298
|
+
|-------------|-------------|------------------|
|
|
299
|
+
| **200** | Successful Response | - |
|
|
300
|
+
| **422** | Validation Error | - |
|
|
301
|
+
|
|
302
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
## updateOnboardingProfile
|
|
306
|
+
|
|
307
|
+
> UserResponse updateOnboardingProfile(onboardingProfileRequest, authorization, ksUat)
|
|
308
|
+
|
|
309
|
+
Update Onboarding Profile Handler
|
|
310
|
+
|
|
311
|
+
Step 2 (final) of onboarding: per-user profile for the current tenant. Writes name to the User row (global) and job_title to the TenantUser row (per-tenant), then stamps ``onboarding_completed_at`` on the membership. Returns 409 if onboarding has already been completed or skipped — post-onboarding edits go through PATCH /v1/users (name) or a future per-membership profile endpoint (job_title).
|
|
312
|
+
|
|
313
|
+
### Example
|
|
314
|
+
|
|
315
|
+
```ts
|
|
316
|
+
import {
|
|
317
|
+
Configuration,
|
|
318
|
+
UsersApi,
|
|
319
|
+
} from '@knowledge-stack/ksapi';
|
|
320
|
+
import type { UpdateOnboardingProfileRequest } from '@knowledge-stack/ksapi';
|
|
321
|
+
|
|
322
|
+
async function example() {
|
|
323
|
+
console.log("🚀 Testing @knowledge-stack/ksapi SDK...");
|
|
324
|
+
const api = new UsersApi();
|
|
325
|
+
|
|
326
|
+
const body = {
|
|
327
|
+
// OnboardingProfileRequest
|
|
328
|
+
onboardingProfileRequest: ...,
|
|
329
|
+
// string (optional)
|
|
330
|
+
authorization: authorization_example,
|
|
331
|
+
// string (optional)
|
|
332
|
+
ksUat: ksUat_example,
|
|
333
|
+
} satisfies UpdateOnboardingProfileRequest;
|
|
334
|
+
|
|
335
|
+
try {
|
|
336
|
+
const data = await api.updateOnboardingProfile(body);
|
|
337
|
+
console.log(data);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
console.error(error);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// Run the test
|
|
344
|
+
example().catch(console.error);
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Parameters
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
| Name | Type | Description | Notes |
|
|
351
|
+
|------------- | ------------- | ------------- | -------------|
|
|
352
|
+
| **onboardingProfileRequest** | [OnboardingProfileRequest](OnboardingProfileRequest.md) | | |
|
|
353
|
+
| **authorization** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
354
|
+
| **ksUat** | `string` | | [Optional] [Defaults to `undefined`] |
|
|
355
|
+
|
|
356
|
+
### Return type
|
|
357
|
+
|
|
358
|
+
[**UserResponse**](UserResponse.md)
|
|
359
|
+
|
|
360
|
+
### Authorization
|
|
361
|
+
|
|
362
|
+
No authorization required
|
|
363
|
+
|
|
364
|
+
### HTTP request headers
|
|
365
|
+
|
|
366
|
+
- **Content-Type**: `application/json`
|
|
367
|
+
- **Accept**: `application/json`
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
### HTTP response details
|
|
371
|
+
| Status code | Description | Response headers |
|
|
372
|
+
|-------------|-------------|------------------|
|
|
373
|
+
| **200** | Successful Response | - |
|
|
374
|
+
| **422** | Validation Error | - |
|
|
375
|
+
|
|
376
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
377
|
+
|
package/package.json
CHANGED
package/src/apis/AgentApi.ts
CHANGED
|
@@ -64,7 +64,7 @@ export interface AgentApiInterface {
|
|
|
64
64
|
agentAskRequestOpts(requestParameters: AgentAskRequest): Promise<runtime.RequestOpts>;
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* Run a one-shot text agent request to completion and return the payload. The request blocks until the underlying Temporal workflow finishes. Clients should set a generous HTTP timeout to accommodate tool-heavy runs. Quota: consumes one MESSAGE before ``start_workflow``.
|
|
67
|
+
* Run a one-shot text agent request to completion and return the payload. The request blocks until the underlying Temporal workflow finishes. Clients should set a generous HTTP timeout to accommodate tool-heavy runs. Quota: consumes one MESSAGE before ``start_workflow``. Refund semantics distinguish cause: * **Cancellation** (client disconnect → ``asyncio.CancelledError``, OR explicit ``DELETE /v1/workflows/{id}`` while we await ``handle.result()`` → Temporal-wrapped ``CancelledError``) → **NO REFUND.** The user walked away or actively cancelled; that\'s their volition. We still best-effort cancel the workflow so the agent stops burning LLM tokens, but the consume stays charged. Detection uses ``temporalio.exceptions.is_cancelled_exception`` which spans both forms. * Any other exception (pre-enqueue ``start_workflow`` raise, Temporal failure, workflow-internal error) → **REFUND.** Server / our-problem failures don\'t bill the user.
|
|
68
68
|
* @summary Agent Ask Handler
|
|
69
69
|
* @param {AskRequest} askRequest
|
|
70
70
|
* @param {string} [authorization]
|
|
@@ -76,7 +76,7 @@ export interface AgentApiInterface {
|
|
|
76
76
|
agentAskRaw(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AskResponse>>;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* Run a one-shot text agent request to completion and return the payload. The request blocks until the underlying Temporal workflow finishes. Clients should set a generous HTTP timeout to accommodate tool-heavy runs. Quota: consumes one MESSAGE before ``start_workflow``.
|
|
79
|
+
* Run a one-shot text agent request to completion and return the payload. The request blocks until the underlying Temporal workflow finishes. Clients should set a generous HTTP timeout to accommodate tool-heavy runs. Quota: consumes one MESSAGE before ``start_workflow``. Refund semantics distinguish cause: * **Cancellation** (client disconnect → ``asyncio.CancelledError``, OR explicit ``DELETE /v1/workflows/{id}`` while we await ``handle.result()`` → Temporal-wrapped ``CancelledError``) → **NO REFUND.** The user walked away or actively cancelled; that\'s their volition. We still best-effort cancel the workflow so the agent stops burning LLM tokens, but the consume stays charged. Detection uses ``temporalio.exceptions.is_cancelled_exception`` which spans both forms. * Any other exception (pre-enqueue ``start_workflow`` raise, Temporal failure, workflow-internal error) → **REFUND.** Server / our-problem failures don\'t bill the user.
|
|
80
80
|
* Agent Ask Handler
|
|
81
81
|
*/
|
|
82
82
|
agentAsk(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AskResponse>;
|
|
@@ -150,7 +150,7 @@ export class AgentApi extends runtime.BaseAPI implements AgentApiInterface {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
/**
|
|
153
|
-
* Run a one-shot text agent request to completion and return the payload. The request blocks until the underlying Temporal workflow finishes. Clients should set a generous HTTP timeout to accommodate tool-heavy runs. Quota: consumes one MESSAGE before ``start_workflow``.
|
|
153
|
+
* Run a one-shot text agent request to completion and return the payload. The request blocks until the underlying Temporal workflow finishes. Clients should set a generous HTTP timeout to accommodate tool-heavy runs. Quota: consumes one MESSAGE before ``start_workflow``. Refund semantics distinguish cause: * **Cancellation** (client disconnect → ``asyncio.CancelledError``, OR explicit ``DELETE /v1/workflows/{id}`` while we await ``handle.result()`` → Temporal-wrapped ``CancelledError``) → **NO REFUND.** The user walked away or actively cancelled; that\'s their volition. We still best-effort cancel the workflow so the agent stops burning LLM tokens, but the consume stays charged. Detection uses ``temporalio.exceptions.is_cancelled_exception`` which spans both forms. * Any other exception (pre-enqueue ``start_workflow`` raise, Temporal failure, workflow-internal error) → **REFUND.** Server / our-problem failures don\'t bill the user.
|
|
154
154
|
* Agent Ask Handler
|
|
155
155
|
*/
|
|
156
156
|
async agentAskRaw(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AskResponse>> {
|
|
@@ -161,7 +161,7 @@ export class AgentApi extends runtime.BaseAPI implements AgentApiInterface {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
|
-
* Run a one-shot text agent request to completion and return the payload. The request blocks until the underlying Temporal workflow finishes. Clients should set a generous HTTP timeout to accommodate tool-heavy runs. Quota: consumes one MESSAGE before ``start_workflow``.
|
|
164
|
+
* Run a one-shot text agent request to completion and return the payload. The request blocks until the underlying Temporal workflow finishes. Clients should set a generous HTTP timeout to accommodate tool-heavy runs. Quota: consumes one MESSAGE before ``start_workflow``. Refund semantics distinguish cause: * **Cancellation** (client disconnect → ``asyncio.CancelledError``, OR explicit ``DELETE /v1/workflows/{id}`` while we await ``handle.result()`` → Temporal-wrapped ``CancelledError``) → **NO REFUND.** The user walked away or actively cancelled; that\'s their volition. We still best-effort cancel the workflow so the agent stops burning LLM tokens, but the consume stays charged. Detection uses ``temporalio.exceptions.is_cancelled_exception`` which spans both forms. * Any other exception (pre-enqueue ``start_workflow`` raise, Temporal failure, workflow-internal error) → **REFUND.** Server / our-problem failures don\'t bill the user.
|
|
165
165
|
* Agent Ask Handler
|
|
166
166
|
*/
|
|
167
167
|
async agentAsk(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AskResponse> {
|
|
@@ -17,18 +17,18 @@ import * as runtime from '../runtime';
|
|
|
17
17
|
import type {
|
|
18
18
|
ChangeSubscriptionRequest,
|
|
19
19
|
HTTPValidationError,
|
|
20
|
+
SubmitSubscriptionResponse,
|
|
20
21
|
SubscriptionPlanResponse,
|
|
21
|
-
TenantResponse,
|
|
22
22
|
} from '../models/index';
|
|
23
23
|
import {
|
|
24
24
|
ChangeSubscriptionRequestFromJSON,
|
|
25
25
|
ChangeSubscriptionRequestToJSON,
|
|
26
26
|
HTTPValidationErrorFromJSON,
|
|
27
27
|
HTTPValidationErrorToJSON,
|
|
28
|
+
SubmitSubscriptionResponseFromJSON,
|
|
29
|
+
SubmitSubscriptionResponseToJSON,
|
|
28
30
|
SubscriptionPlanResponseFromJSON,
|
|
29
31
|
SubscriptionPlanResponseToJSON,
|
|
30
|
-
TenantResponseFromJSON,
|
|
31
|
-
TenantResponseToJSON,
|
|
32
32
|
} from '../models/index';
|
|
33
33
|
|
|
34
34
|
export interface ChangeTenantSubscriptionRequest {
|
|
@@ -65,7 +65,7 @@ export interface SubscriptionsApiInterface {
|
|
|
65
65
|
changeTenantSubscriptionRequestOpts(requestParameters: ChangeTenantSubscriptionRequest): Promise<runtime.RequestOpts>;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Submit a subscription change (mock-Stripe). OWNER-only on the target tenant. Validates the request (tenant + plan exist, ``num_seats`` within bounds), submits the (mock-)Stripe subscription update, and returns 202. The plan/seat write is NOT applied here — that happens in ``POST /webhooks/stripe/subscription`` after Stripe confirms the change. Async two-hop workflow per ``docs/billing_additional_limits.md`` §\"Async payment workflow\": the dev environment exercises the same submit/webhook split as production will when the real Stripe SDK replaces the log-line stub in ``notify_billing``. Optional ``Idempotency-Key`` request header is forwarded to Stripe verbatim (clients that retry the same logical operation MUST send the same value across attempts; Stripe collapses duplicates server- side). Absent the header, the server generates a fresh ``uuid4()`` per call and emits a warning — but only when a Stripe call is actually about to fire (i.e. the validation passed AND the change is not a no-op). Warning before validation would false-positive on every 4xx and on every redundant submit. **Header value lands in structured logs.** The header value is forwarded into the ``stripe.update_subscription`` log event\'s ``idempotency_key`` field (and into the eventual real Stripe call). Use opaque random IDs (e.g. ``uuid4()``); do NOT pass user identifiers, tokens, or other sensitive material as the ``Idempotency-Key`` header.
|
|
69
69
|
* @summary Change Tenant Subscription Handler
|
|
70
70
|
* @param {string} tenantId
|
|
71
71
|
* @param {ChangeSubscriptionRequest} changeSubscriptionRequest
|
|
@@ -76,13 +76,13 @@ export interface SubscriptionsApiInterface {
|
|
|
76
76
|
* @throws {RequiredError}
|
|
77
77
|
* @memberof SubscriptionsApiInterface
|
|
78
78
|
*/
|
|
79
|
-
changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<
|
|
79
|
+
changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubmitSubscriptionResponse>>;
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* Submit a subscription change (mock-Stripe). OWNER-only on the target tenant. Validates the request (tenant + plan exist, ``num_seats`` within bounds), submits the (mock-)Stripe subscription update, and returns 202. The plan/seat write is NOT applied here — that happens in ``POST /webhooks/stripe/subscription`` after Stripe confirms the change. Async two-hop workflow per ``docs/billing_additional_limits.md`` §\"Async payment workflow\": the dev environment exercises the same submit/webhook split as production will when the real Stripe SDK replaces the log-line stub in ``notify_billing``. Optional ``Idempotency-Key`` request header is forwarded to Stripe verbatim (clients that retry the same logical operation MUST send the same value across attempts; Stripe collapses duplicates server- side). Absent the header, the server generates a fresh ``uuid4()`` per call and emits a warning — but only when a Stripe call is actually about to fire (i.e. the validation passed AND the change is not a no-op). Warning before validation would false-positive on every 4xx and on every redundant submit. **Header value lands in structured logs.** The header value is forwarded into the ``stripe.update_subscription`` log event\'s ``idempotency_key`` field (and into the eventual real Stripe call). Use opaque random IDs (e.g. ``uuid4()``); do NOT pass user identifiers, tokens, or other sensitive material as the ``Idempotency-Key`` header.
|
|
83
83
|
* Change Tenant Subscription Handler
|
|
84
84
|
*/
|
|
85
|
-
changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<
|
|
85
|
+
changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubmitSubscriptionResponse>;
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* Creates request options for getTenantSubscription without sending the request
|
|
@@ -165,21 +165,21 @@ export class SubscriptionsApi extends runtime.BaseAPI implements SubscriptionsAp
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
*
|
|
168
|
+
* Submit a subscription change (mock-Stripe). OWNER-only on the target tenant. Validates the request (tenant + plan exist, ``num_seats`` within bounds), submits the (mock-)Stripe subscription update, and returns 202. The plan/seat write is NOT applied here — that happens in ``POST /webhooks/stripe/subscription`` after Stripe confirms the change. Async two-hop workflow per ``docs/billing_additional_limits.md`` §\"Async payment workflow\": the dev environment exercises the same submit/webhook split as production will when the real Stripe SDK replaces the log-line stub in ``notify_billing``. Optional ``Idempotency-Key`` request header is forwarded to Stripe verbatim (clients that retry the same logical operation MUST send the same value across attempts; Stripe collapses duplicates server- side). Absent the header, the server generates a fresh ``uuid4()`` per call and emits a warning — but only when a Stripe call is actually about to fire (i.e. the validation passed AND the change is not a no-op). Warning before validation would false-positive on every 4xx and on every redundant submit. **Header value lands in structured logs.** The header value is forwarded into the ``stripe.update_subscription`` log event\'s ``idempotency_key`` field (and into the eventual real Stripe call). Use opaque random IDs (e.g. ``uuid4()``); do NOT pass user identifiers, tokens, or other sensitive material as the ``Idempotency-Key`` header.
|
|
169
169
|
* Change Tenant Subscription Handler
|
|
170
170
|
*/
|
|
171
|
-
async changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<
|
|
171
|
+
async changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubmitSubscriptionResponse>> {
|
|
172
172
|
const requestOptions = await this.changeTenantSubscriptionRequestOpts(requestParameters);
|
|
173
173
|
const response = await this.request(requestOptions, initOverrides);
|
|
174
174
|
|
|
175
|
-
return new runtime.JSONApiResponse(response, (jsonValue) =>
|
|
175
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => SubmitSubscriptionResponseFromJSON(jsonValue));
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
*
|
|
179
|
+
* Submit a subscription change (mock-Stripe). OWNER-only on the target tenant. Validates the request (tenant + plan exist, ``num_seats`` within bounds), submits the (mock-)Stripe subscription update, and returns 202. The plan/seat write is NOT applied here — that happens in ``POST /webhooks/stripe/subscription`` after Stripe confirms the change. Async two-hop workflow per ``docs/billing_additional_limits.md`` §\"Async payment workflow\": the dev environment exercises the same submit/webhook split as production will when the real Stripe SDK replaces the log-line stub in ``notify_billing``. Optional ``Idempotency-Key`` request header is forwarded to Stripe verbatim (clients that retry the same logical operation MUST send the same value across attempts; Stripe collapses duplicates server- side). Absent the header, the server generates a fresh ``uuid4()`` per call and emits a warning — but only when a Stripe call is actually about to fire (i.e. the validation passed AND the change is not a no-op). Warning before validation would false-positive on every 4xx and on every redundant submit. **Header value lands in structured logs.** The header value is forwarded into the ``stripe.update_subscription`` log event\'s ``idempotency_key`` field (and into the eventual real Stripe call). Use opaque random IDs (e.g. ``uuid4()``); do NOT pass user identifiers, tokens, or other sensitive material as the ``Idempotency-Key`` header.
|
|
180
180
|
* Change Tenant Subscription Handler
|
|
181
181
|
*/
|
|
182
|
-
async changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<
|
|
182
|
+
async changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubmitSubscriptionResponse> {
|
|
183
183
|
const response = await this.changeTenantSubscriptionRaw(requestParameters, initOverrides);
|
|
184
184
|
return await response.value();
|
|
185
185
|
}
|