@knowledge-stack/ksapi 1.80.0 → 1.80.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.openapi-generator/FILES +2 -0
  2. package/README.md +3 -2
  3. package/dist/apis/AgentApi.d.ts +4 -4
  4. package/dist/apis/AgentApi.js +2 -2
  5. package/dist/apis/SubscriptionsApi.d.ts +9 -9
  6. package/dist/apis/SubscriptionsApi.js +3 -3
  7. package/dist/esm/apis/AgentApi.d.ts +4 -4
  8. package/dist/esm/apis/AgentApi.js +2 -2
  9. package/dist/esm/apis/SubscriptionsApi.d.ts +9 -9
  10. package/dist/esm/apis/SubscriptionsApi.js +4 -4
  11. package/dist/esm/models/DocumentResponse.d.ts +6 -0
  12. package/dist/esm/models/DocumentResponse.js +2 -0
  13. package/dist/esm/models/FolderResponse.d.ts +6 -0
  14. package/dist/esm/models/FolderResponse.js +2 -0
  15. package/dist/esm/models/MeteredQuotaStatus.d.ts +6 -0
  16. package/dist/esm/models/MeteredQuotaStatus.js +2 -0
  17. package/dist/esm/models/SubmitSubscriptionResponse.d.ts +75 -0
  18. package/dist/esm/models/SubmitSubscriptionResponse.js +52 -0
  19. package/dist/esm/models/index.d.ts +1 -0
  20. package/dist/esm/models/index.js +1 -0
  21. package/dist/models/DocumentResponse.d.ts +6 -0
  22. package/dist/models/DocumentResponse.js +2 -0
  23. package/dist/models/FolderResponse.d.ts +6 -0
  24. package/dist/models/FolderResponse.js +2 -0
  25. package/dist/models/MeteredQuotaStatus.d.ts +6 -0
  26. package/dist/models/MeteredQuotaStatus.js +2 -0
  27. package/dist/models/SubmitSubscriptionResponse.d.ts +75 -0
  28. package/dist/models/SubmitSubscriptionResponse.js +60 -0
  29. package/dist/models/index.d.ts +1 -0
  30. package/dist/models/index.js +1 -0
  31. package/docs/AgentApi.md +1 -1
  32. package/docs/DocumentResponse.md +2 -0
  33. package/docs/FolderResponse.md +2 -0
  34. package/docs/FolderResponseOrDocumentResponse.md +2 -0
  35. package/docs/MeteredQuotaStatus.md +2 -0
  36. package/docs/SubmitSubscriptionResponse.md +39 -0
  37. package/docs/SubscriptionsApi.md +4 -4
  38. package/package.json +1 -1
  39. package/src/apis/AgentApi.ts +4 -4
  40. package/src/apis/SubscriptionsApi.ts +12 -12
  41. package/src/models/DocumentResponse.ts +8 -0
  42. package/src/models/FolderResponse.ts +8 -0
  43. package/src/models/MeteredQuotaStatus.ts +8 -0
  44. package/src/models/SubmitSubscriptionResponse.ts +117 -0
  45. package/src/models/index.ts +1 -0
@@ -0,0 +1,52 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Knowledge Stack API
5
+ * Knowledge Stack backend API for authentication and knowledge management
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
+ export const SubmitSubscriptionResponsePropertyValidationAttributesMap = {};
15
+ /**
16
+ * Check if a given object implements the SubmitSubscriptionResponse interface.
17
+ */
18
+ export function instanceOfSubmitSubscriptionResponse(value) {
19
+ if (!('submitted' in value) || value['submitted'] === undefined)
20
+ return false;
21
+ if (!('noop' in value) || value['noop'] === undefined)
22
+ return false;
23
+ if (!('idempotencyKey' in value) || value['idempotencyKey'] === undefined)
24
+ return false;
25
+ return true;
26
+ }
27
+ export function SubmitSubscriptionResponseFromJSON(json) {
28
+ return SubmitSubscriptionResponseFromJSONTyped(json, false);
29
+ }
30
+ export function SubmitSubscriptionResponseFromJSONTyped(json, ignoreDiscriminator) {
31
+ if (json == null) {
32
+ return json;
33
+ }
34
+ return {
35
+ 'submitted': json['submitted'],
36
+ 'noop': json['noop'],
37
+ 'idempotencyKey': json['idempotency_key'],
38
+ };
39
+ }
40
+ export function SubmitSubscriptionResponseToJSON(json) {
41
+ return SubmitSubscriptionResponseToJSONTyped(json, false);
42
+ }
43
+ export function SubmitSubscriptionResponseToJSONTyped(value, ignoreDiscriminator = false) {
44
+ if (value == null) {
45
+ return value;
46
+ }
47
+ return {
48
+ 'submitted': value['submitted'],
49
+ 'noop': value['noop'],
50
+ 'idempotency_key': value['idempotencyKey'],
51
+ };
52
+ }
@@ -142,6 +142,7 @@ export * from './StepInput';
142
142
  export * from './StepKind';
143
143
  export * from './StepOutput';
144
144
  export * from './SubmitFeedbackRequest';
145
+ export * from './SubmitSubscriptionResponse';
145
146
  export * from './SubscriptionPlanResponse';
146
147
  export * from './SubtreeChunkGroup';
147
148
  export * from './SubtreeChunksResponse';
@@ -144,6 +144,7 @@ export * from './StepInput';
144
144
  export * from './StepKind';
145
145
  export * from './StepOutput';
146
146
  export * from './SubmitFeedbackRequest';
147
+ export * from './SubmitSubscriptionResponse';
147
148
  export * from './SubscriptionPlanResponse';
148
149
  export * from './SubtreeChunkGroup';
149
150
  export * from './SubtreeChunksResponse';
@@ -121,6 +121,12 @@ export interface DocumentResponse {
121
121
  * @memberof DocumentResponse
122
122
  */
123
123
  tags?: Array<TagResponse> | null;
124
+ /**
125
+ * Whether the current caller has write access to this document. Only populated by endpoints that compute it (e.g. folder contents).
126
+ * @type {boolean}
127
+ * @memberof DocumentResponse
128
+ */
129
+ canWrite?: boolean | null;
124
130
  }
125
131
  /**
126
132
  * @export
@@ -93,6 +93,7 @@ function DocumentResponseFromJSONTyped(json, ignoreDiscriminator) {
93
93
  'createdAt': (new Date(json['created_at'])),
94
94
  'updatedAt': (new Date(json['updated_at'])),
95
95
  'tags': json['tags'] == null ? undefined : (json['tags'].map(TagResponse_1.TagResponseFromJSON)),
96
+ 'canWrite': json['can_write'] == null ? undefined : json['can_write'],
96
97
  };
97
98
  }
98
99
  function DocumentResponseToJSON(json) {
@@ -120,5 +121,6 @@ function DocumentResponseToJSONTyped(value, ignoreDiscriminator = false) {
120
121
  'created_at': value['createdAt'].toISOString(),
121
122
  'updated_at': value['updatedAt'].toISOString(),
122
123
  'tags': value['tags'] == null ? undefined : (value['tags'].map(TagResponse_1.TagResponseToJSON)),
124
+ 'can_write': value['canWrite'],
123
125
  };
124
126
  }
@@ -88,6 +88,12 @@ export interface FolderResponse {
88
88
  * @memberof FolderResponse
89
89
  */
90
90
  tags?: Array<TagResponse> | null;
91
+ /**
92
+ * Whether the current caller has write access to this folder. Only populated by endpoints that compute it (e.g. folder contents).
93
+ * @type {boolean}
94
+ * @memberof FolderResponse
95
+ */
96
+ canWrite?: boolean | null;
91
97
  }
92
98
  /**
93
99
  * @export
@@ -75,6 +75,7 @@ function FolderResponseFromJSONTyped(json, ignoreDiscriminator) {
75
75
  'createdAt': (new Date(json['created_at'])),
76
76
  'updatedAt': (new Date(json['updated_at'])),
77
77
  'tags': json['tags'] == null ? undefined : (json['tags'].map(TagResponse_1.TagResponseFromJSON)),
78
+ 'canWrite': json['can_write'] == null ? undefined : json['can_write'],
78
79
  };
79
80
  }
80
81
  function FolderResponseToJSON(json) {
@@ -97,5 +98,6 @@ function FolderResponseToJSONTyped(value, ignoreDiscriminator = false) {
97
98
  'created_at': value['createdAt'].toISOString(),
98
99
  'updated_at': value['updatedAt'].toISOString(),
99
100
  'tags': value['tags'] == null ? undefined : (value['tags'].map(TagResponse_1.TagResponseToJSON)),
101
+ 'can_write': value['canWrite'],
100
102
  };
101
103
  }
@@ -46,6 +46,12 @@ export interface MeteredQuotaStatus {
46
46
  * @memberof MeteredQuotaStatus
47
47
  */
48
48
  periodEnd: Date;
49
+ /**
50
+ * Persistent additional-quota balance for this metric. Unchanged by period rollover; decremented when included is exhausted, incremented on refund or top-up.
51
+ * @type {number}
52
+ * @memberof MeteredQuotaStatus
53
+ */
54
+ additionalBalance?: number;
49
55
  }
50
56
  export declare const MeteredQuotaStatusPropertyValidationAttributesMap: {
51
57
  [property: string]: {
@@ -50,6 +50,7 @@ function MeteredQuotaStatusFromJSONTyped(json, ignoreDiscriminator) {
50
50
  'limit': json['limit'],
51
51
  'periodStart': (new Date(json['period_start'])),
52
52
  'periodEnd': (new Date(json['period_end'])),
53
+ 'additionalBalance': json['additional_balance'] == null ? undefined : json['additional_balance'],
53
54
  };
54
55
  }
55
56
  function MeteredQuotaStatusToJSON(json) {
@@ -65,5 +66,6 @@ function MeteredQuotaStatusToJSONTyped(value, ignoreDiscriminator = false) {
65
66
  'limit': value['limit'],
66
67
  'period_start': value['periodStart'].toISOString(),
67
68
  'period_end': value['periodEnd'].toISOString(),
69
+ 'additional_balance': value['additionalBalance'],
68
70
  };
69
71
  }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Knowledge Stack API
3
+ * Knowledge Stack backend API for authentication and knowledge management
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
+ * Result envelope for the subscription-change submit endpoint.
14
+ *
15
+ * The endpoint returns immediately after the (mock-)Stripe charge is
16
+ * submitted; the actual plan/seat write happens later in the Stripe
17
+ * subscription webhook. ``submitted=True`` always when the route
18
+ * succeeds (errors raise via the global handler).
19
+ *
20
+ * ``noop=True`` indicates the tenant is already at the requested
21
+ * ``(plan, num_seats)`` — no Stripe call was issued, no webhook will
22
+ * arrive, and the user's account is unchanged. Symmetric with
23
+ * ``StripeWebhookAck.replayed`` so client UIs can render "already
24
+ * on this plan" rather than spinning a "waiting for webhook"
25
+ * indicator forever.
26
+ *
27
+ * ``idempotency_key`` echoes the value forwarded to Stripe — clients
28
+ * can store it to correlate the eventual webhook receipt with the
29
+ * original request, and re-send it verbatim on retries.
30
+ * @export
31
+ * @interface SubmitSubscriptionResponse
32
+ */
33
+ export interface SubmitSubscriptionResponse {
34
+ /**
35
+ * Always True when the submit returns 202.
36
+ * @type {boolean}
37
+ * @memberof SubmitSubscriptionResponse
38
+ */
39
+ submitted: boolean;
40
+ /**
41
+ * True when the tenant was already at the target ``(plan, num_seats)`` — no Stripe call was made and no webhook will arrive.
42
+ * @type {boolean}
43
+ * @memberof SubmitSubscriptionResponse
44
+ */
45
+ noop: boolean;
46
+ /**
47
+ * Idempotency key forwarded to Stripe — sourced from the ``Idempotency-Key`` request header or a server-generated uuid4 when absent.
48
+ * @type {string}
49
+ * @memberof SubmitSubscriptionResponse
50
+ */
51
+ idempotencyKey: string;
52
+ }
53
+ export declare const SubmitSubscriptionResponsePropertyValidationAttributesMap: {
54
+ [property: string]: {
55
+ maxLength?: number;
56
+ minLength?: number;
57
+ pattern?: string;
58
+ maximum?: number;
59
+ exclusiveMaximum?: boolean;
60
+ minimum?: number;
61
+ exclusiveMinimum?: boolean;
62
+ multipleOf?: number;
63
+ maxItems?: number;
64
+ minItems?: number;
65
+ uniqueItems?: boolean;
66
+ };
67
+ };
68
+ /**
69
+ * Check if a given object implements the SubmitSubscriptionResponse interface.
70
+ */
71
+ export declare function instanceOfSubmitSubscriptionResponse(value: object): value is SubmitSubscriptionResponse;
72
+ export declare function SubmitSubscriptionResponseFromJSON(json: any): SubmitSubscriptionResponse;
73
+ export declare function SubmitSubscriptionResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): SubmitSubscriptionResponse;
74
+ export declare function SubmitSubscriptionResponseToJSON(json: any): SubmitSubscriptionResponse;
75
+ export declare function SubmitSubscriptionResponseToJSONTyped(value?: SubmitSubscriptionResponse | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Knowledge Stack API
6
+ * Knowledge Stack backend API for authentication and knowledge management
7
+ *
8
+ * The version of the OpenAPI document: 0.1.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.SubmitSubscriptionResponsePropertyValidationAttributesMap = void 0;
17
+ exports.instanceOfSubmitSubscriptionResponse = instanceOfSubmitSubscriptionResponse;
18
+ exports.SubmitSubscriptionResponseFromJSON = SubmitSubscriptionResponseFromJSON;
19
+ exports.SubmitSubscriptionResponseFromJSONTyped = SubmitSubscriptionResponseFromJSONTyped;
20
+ exports.SubmitSubscriptionResponseToJSON = SubmitSubscriptionResponseToJSON;
21
+ exports.SubmitSubscriptionResponseToJSONTyped = SubmitSubscriptionResponseToJSONTyped;
22
+ exports.SubmitSubscriptionResponsePropertyValidationAttributesMap = {};
23
+ /**
24
+ * Check if a given object implements the SubmitSubscriptionResponse interface.
25
+ */
26
+ function instanceOfSubmitSubscriptionResponse(value) {
27
+ if (!('submitted' in value) || value['submitted'] === undefined)
28
+ return false;
29
+ if (!('noop' in value) || value['noop'] === undefined)
30
+ return false;
31
+ if (!('idempotencyKey' in value) || value['idempotencyKey'] === undefined)
32
+ return false;
33
+ return true;
34
+ }
35
+ function SubmitSubscriptionResponseFromJSON(json) {
36
+ return SubmitSubscriptionResponseFromJSONTyped(json, false);
37
+ }
38
+ function SubmitSubscriptionResponseFromJSONTyped(json, ignoreDiscriminator) {
39
+ if (json == null) {
40
+ return json;
41
+ }
42
+ return {
43
+ 'submitted': json['submitted'],
44
+ 'noop': json['noop'],
45
+ 'idempotencyKey': json['idempotency_key'],
46
+ };
47
+ }
48
+ function SubmitSubscriptionResponseToJSON(json) {
49
+ return SubmitSubscriptionResponseToJSONTyped(json, false);
50
+ }
51
+ function SubmitSubscriptionResponseToJSONTyped(value, ignoreDiscriminator = false) {
52
+ if (value == null) {
53
+ return value;
54
+ }
55
+ return {
56
+ 'submitted': value['submitted'],
57
+ 'noop': value['noop'],
58
+ 'idempotency_key': value['idempotencyKey'],
59
+ };
60
+ }
@@ -142,6 +142,7 @@ export * from './StepInput';
142
142
  export * from './StepKind';
143
143
  export * from './StepOutput';
144
144
  export * from './SubmitFeedbackRequest';
145
+ export * from './SubmitSubscriptionResponse';
145
146
  export * from './SubscriptionPlanResponse';
146
147
  export * from './SubtreeChunkGroup';
147
148
  export * from './SubtreeChunksResponse';
@@ -160,6 +160,7 @@ __exportStar(require("./StepInput"), exports);
160
160
  __exportStar(require("./StepKind"), exports);
161
161
  __exportStar(require("./StepOutput"), exports);
162
162
  __exportStar(require("./SubmitFeedbackRequest"), exports);
163
+ __exportStar(require("./SubmitSubscriptionResponse"), exports);
163
164
  __exportStar(require("./SubscriptionPlanResponse"), exports);
164
165
  __exportStar(require("./SubtreeChunkGroup"), exports);
165
166
  __exportStar(require("./SubtreeChunksResponse"), exports);
package/docs/AgentApi.md CHANGED
@@ -15,7 +15,7 @@ All URIs are relative to *http://localhost:8000*
15
15
 
16
16
  Agent Ask Handler
17
17
 
18
- 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 &#x60;&#x60;start_workflow&#x60;&#x60;. Refunds on any failure between consume and &#x60;&#x60;handle.result()&#x60;&#x60; returning pre-enqueue &#x60;&#x60;start_workflow&#x60;&#x60; raises and post-enqueue workflow failures both refund.
18
+ 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 &#x60;&#x60;start_workflow&#x60;&#x60;. Refund semantics distinguish cause: * **Cancellation** (client disconnect &#x60;&#x60;asyncio.CancelledError&#x60;&#x60;, OR explicit &#x60;&#x60;DELETE /v1/workflows/{id}&#x60;&#x60; while we await &#x60;&#x60;handle.result()&#x60;&#x60; Temporal-wrapped &#x60;&#x60;CancelledError&#x60;&#x60;) → **NO REFUND.** The user walked away or actively cancelled; that\&#39;s their volition. We still best-effort cancel the workflow so the agent stops burning LLM tokens, but the consume stays charged. Detection uses &#x60;&#x60;temporalio.exceptions.is_cancelled_exception&#x60;&#x60; which spans both forms. * Any other exception (pre-enqueue &#x60;&#x60;start_workflow&#x60;&#x60; raise, Temporal failure, workflow-internal error) → **REFUND.** Server / our-problem failures don\&#39;t bill the user.
19
19
 
20
20
  ### Example
21
21
 
@@ -24,6 +24,7 @@ Name | Type
24
24
  `createdAt` | Date
25
25
  `updatedAt` | Date
26
26
  `tags` | [Array&lt;TagResponse&gt;](TagResponse.md)
27
+ `canWrite` | boolean
27
28
 
28
29
  ## Example
29
30
 
@@ -49,6 +50,7 @@ const example = {
49
50
  "createdAt": null,
50
51
  "updatedAt": null,
51
52
  "tags": null,
53
+ "canWrite": null,
52
54
  } satisfies DocumentResponse
53
55
 
54
56
  console.log(example)
@@ -19,6 +19,7 @@ Name | Type
19
19
  `createdAt` | Date
20
20
  `updatedAt` | Date
21
21
  `tags` | [Array&lt;TagResponse&gt;](TagResponse.md)
22
+ `canWrite` | boolean
22
23
 
23
24
  ## Example
24
25
 
@@ -39,6 +40,7 @@ const example = {
39
40
  "createdAt": null,
40
41
  "updatedAt": null,
41
42
  "tags": null,
43
+ "canWrite": null,
42
44
  } satisfies FolderResponse
43
45
 
44
46
  console.log(example)
@@ -18,6 +18,7 @@ Name | Type
18
18
  `createdAt` | Date
19
19
  `updatedAt` | Date
20
20
  `tags` | [Array&lt;TagResponse&gt;](TagResponse.md)
21
+ `canWrite` | boolean
21
22
  `documentType` | [DocumentType](DocumentType.md)
22
23
  `documentOrigin` | [DocumentOrigin](DocumentOrigin.md)
23
24
  `activeVersionId` | string
@@ -43,6 +44,7 @@ const example = {
43
44
  "createdAt": null,
44
45
  "updatedAt": null,
45
46
  "tags": null,
47
+ "canWrite": null,
46
48
  "documentType": null,
47
49
  "documentOrigin": null,
48
50
  "activeVersionId": null,
@@ -12,6 +12,7 @@ Name | Type
12
12
  `limit` | number
13
13
  `periodStart` | Date
14
14
  `periodEnd` | Date
15
+ `additionalBalance` | number
15
16
 
16
17
  ## Example
17
18
 
@@ -25,6 +26,7 @@ const example = {
25
26
  "limit": null,
26
27
  "periodStart": null,
27
28
  "periodEnd": null,
29
+ "additionalBalance": null,
28
30
  } satisfies MeteredQuotaStatus
29
31
 
30
32
  console.log(example)
@@ -0,0 +1,39 @@
1
+
2
+ # SubmitSubscriptionResponse
3
+
4
+ Result envelope for the subscription-change submit endpoint. The endpoint returns immediately after the (mock-)Stripe charge is submitted; the actual plan/seat write happens later in the Stripe subscription webhook. ``submitted=True`` always when the route succeeds (errors raise via the global handler). ``noop=True`` indicates the tenant is already at the requested ``(plan, num_seats)`` — no Stripe call was issued, no webhook will arrive, and the user\'s account is unchanged. Symmetric with ``StripeWebhookAck.replayed`` so client UIs can render \"already on this plan\" rather than spinning a \"waiting for webhook\" indicator forever. ``idempotency_key`` echoes the value forwarded to Stripe — clients can store it to correlate the eventual webhook receipt with the original request, and re-send it verbatim on retries.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `submitted` | boolean
11
+ `noop` | boolean
12
+ `idempotencyKey` | string
13
+
14
+ ## Example
15
+
16
+ ```typescript
17
+ import type { SubmitSubscriptionResponse } from '@knowledge-stack/ksapi'
18
+
19
+ // TODO: Update the object below with actual values
20
+ const example = {
21
+ "submitted": null,
22
+ "noop": null,
23
+ "idempotencyKey": null,
24
+ } satisfies SubmitSubscriptionResponse
25
+
26
+ console.log(example)
27
+
28
+ // Convert the instance to a JSON string
29
+ const exampleJSON: string = JSON.stringify(example)
30
+ console.log(exampleJSON)
31
+
32
+ // Parse the JSON string back to an object
33
+ const exampleParsed = JSON.parse(exampleJSON) as SubmitSubscriptionResponse
34
+ console.log(exampleParsed)
35
+ ```
36
+
37
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
38
+
39
+
@@ -11,11 +11,11 @@ All URIs are relative to *http://localhost:8000*
11
11
 
12
12
  ## changeTenantSubscription
13
13
 
14
- > TenantResponse changeTenantSubscription(tenantId, changeSubscriptionRequest, idempotencyKey, authorization, ksUat)
14
+ > SubmitSubscriptionResponse changeTenantSubscription(tenantId, changeSubscriptionRequest, idempotencyKey, authorization, ksUat)
15
15
 
16
16
  Change Tenant Subscription Handler
17
17
 
18
- Change the tenant\&#39;s subscription plan and/or seat count. OWNER-only on the target tenant. Covers three scenarios with one shape: - Plan change (with optional seat-count change). - Pure seat-count change (same plan, different &#x60;&#x60;num_seats&#x60;&#x60;). - No-op (same plan, same seats) returns 200, performs no DB or Stripe writes. Optional &#x60;&#x60;Idempotency-Key&#x60;&#x60; 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 &#x60;&#x60;uuid4()&#x60;&#x60; per call and emits a warning — retries in that case are NOT deduplicated. v1 mock-Stripe doesn\&#39;t care, but the contract is in place for the real integration.
18
+ Submit a subscription change (mock-Stripe). OWNER-only on the target tenant. Validates the request (tenant + plan exist, &#x60;&#x60;num_seats&#x60;&#x60; within bounds), submits the (mock-)Stripe subscription update, and returns 202. The plan/seat write is NOT applied here — that happens in &#x60;&#x60;POST /webhooks/stripe/subscription&#x60;&#x60; after Stripe confirms the change. Async two-hop workflow per &#x60;&#x60;docs/billing_additional_limits.md&#x60;&#x60; §\&quot;Async payment workflow\&quot;: the dev environment exercises the same submit/webhook split as production will when the real Stripe SDK replaces the log-line stub in &#x60;&#x60;notify_billing&#x60;&#x60;. Optional &#x60;&#x60;Idempotency-Key&#x60;&#x60; 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 &#x60;&#x60;uuid4()&#x60;&#x60; 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 &#x60;&#x60;stripe.update_subscription&#x60;&#x60; log event\&#39;s &#x60;&#x60;idempotency_key&#x60;&#x60; field (and into the eventual real Stripe call). Use opaque random IDs (e.g. &#x60;&#x60;uuid4()&#x60;&#x60;); do NOT pass user identifiers, tokens, or other sensitive material as the &#x60;&#x60;Idempotency-Key&#x60;&#x60; header.
19
19
 
20
20
  ### Example
21
21
 
@@ -68,7 +68,7 @@ example().catch(console.error);
68
68
 
69
69
  ### Return type
70
70
 
71
- [**TenantResponse**](TenantResponse.md)
71
+ [**SubmitSubscriptionResponse**](SubmitSubscriptionResponse.md)
72
72
 
73
73
  ### Authorization
74
74
 
@@ -83,7 +83,7 @@ No authorization required
83
83
  ### HTTP response details
84
84
  | Status code | Description | Response headers |
85
85
  |-------------|-------------|------------------|
86
- | **200** | Successful Response | - |
86
+ | **202** | Successful Response | - |
87
87
  | **422** | Validation Error | - |
88
88
 
89
89
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowledge-stack/ksapi",
3
- "version": "1.80.0",
3
+ "version": "1.80.1",
4
4
  "description": "OpenAPI client for @knowledge-stack/ksapi",
5
5
  "author": "OpenAPI-Generator",
6
6
  "repository": {
@@ -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``. Refunds on any failure between consume and ``handle.result()`` returning pre-enqueue ``start_workflow`` raises and post-enqueue workflow failures both refund.
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``. Refunds on any failure between consume and ``handle.result()`` returning pre-enqueue ``start_workflow`` raises and post-enqueue workflow failures both refund.
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``. Refunds on any failure between consume and ``handle.result()`` returning pre-enqueue ``start_workflow`` raises and post-enqueue workflow failures both refund.
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``. Refunds on any failure between consume and ``handle.result()`` returning pre-enqueue ``start_workflow`` raises and post-enqueue workflow failures both refund.
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
- * Change the tenant\'s subscription plan and/or seat count. OWNER-only on the target tenant. Covers three scenarios with one shape: - Plan change (with optional seat-count change). - Pure seat-count change (same plan, different ``num_seats``). - No-op (same plan, same seats) returns 200, performs no DB or Stripe writes. 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 — retries in that case are NOT deduplicated. v1 mock-Stripe doesn\'t care, but the contract is in place for the real integration.
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<TenantResponse>>;
79
+ changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubmitSubscriptionResponse>>;
80
80
 
81
81
  /**
82
- * Change the tenant\'s subscription plan and/or seat count. OWNER-only on the target tenant. Covers three scenarios with one shape: - Plan change (with optional seat-count change). - Pure seat-count change (same plan, different ``num_seats``). - No-op (same plan, same seats) returns 200, performs no DB or Stripe writes. 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 — retries in that case are NOT deduplicated. v1 mock-Stripe doesn\'t care, but the contract is in place for the real integration.
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<TenantResponse>;
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
- * Change the tenant\'s subscription plan and/or seat count. OWNER-only on the target tenant. Covers three scenarios with one shape: - Plan change (with optional seat-count change). - Pure seat-count change (same plan, different ``num_seats``). - No-op (same plan, same seats) returns 200, performs no DB or Stripe writes. 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 — retries in that case are NOT deduplicated. v1 mock-Stripe doesn\'t care, but the contract is in place for the real integration.
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<TenantResponse>> {
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) => TenantResponseFromJSON(jsonValue));
175
+ return new runtime.JSONApiResponse(response, (jsonValue) => SubmitSubscriptionResponseFromJSON(jsonValue));
176
176
  }
177
177
 
178
178
  /**
179
- * Change the tenant\'s subscription plan and/or seat count. OWNER-only on the target tenant. Covers three scenarios with one shape: - Plan change (with optional seat-count change). - Pure seat-count change (same plan, different ``num_seats``). - No-op (same plan, same seats) returns 200, performs no DB or Stripe writes. 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 — retries in that case are NOT deduplicated. v1 mock-Stripe doesn\'t care, but the contract is in place for the real integration.
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<TenantResponse> {
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
  }