@knowledge-stack/ksapi 1.79.1 → 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
@@ -161,6 +161,7 @@ docs/StepInput.md
161
161
  docs/StepKind.md
162
162
  docs/StepOutput.md
163
163
  docs/SubmitFeedbackRequest.md
164
+ docs/SubmitSubscriptionResponse.md
164
165
  docs/SubscriptionPlanResponse.md
165
166
  docs/SubscriptionsApi.md
166
167
  docs/SubtreeChunkGroup.md
@@ -396,6 +397,7 @@ src/models/StepInput.ts
396
397
  src/models/StepKind.ts
397
398
  src/models/StepOutput.ts
398
399
  src/models/SubmitFeedbackRequest.ts
400
+ src/models/SubmitSubscriptionResponse.ts
399
401
  src/models/SubscriptionPlanResponse.ts
400
402
  src/models/SubtreeChunkGroup.ts
401
403
  src/models/SubtreeChunksResponse.ts
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @knowledge-stack/ksapi@1.79.1
1
+ # @knowledge-stack/ksapi@1.80.1
2
2
 
3
3
  A TypeScript SDK client for the localhost API.
4
4
 
@@ -344,6 +344,7 @@ All URIs are relative to *http://localhost:8000*
344
344
  - [StepKind](docs/StepKind.md)
345
345
  - [StepOutput](docs/StepOutput.md)
346
346
  - [SubmitFeedbackRequest](docs/SubmitFeedbackRequest.md)
347
+ - [SubmitSubscriptionResponse](docs/SubmitSubscriptionResponse.md)
347
348
  - [SubscriptionPlanResponse](docs/SubscriptionPlanResponse.md)
348
349
  - [SubtreeChunkGroup](docs/SubtreeChunkGroup.md)
349
350
  - [SubtreeChunksResponse](docs/SubtreeChunksResponse.md)
@@ -408,7 +409,7 @@ and is automatically generated by the
408
409
  [OpenAPI Generator](https://openapi-generator.tech) project:
409
410
 
410
411
  - API version: `0.1.0`
411
- - Package version: `1.79.1`
412
+ - Package version: `1.80.1`
412
413
  - Generator version: `7.21.0`
413
414
  - Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
414
415
 
@@ -38,7 +38,7 @@ export interface AgentApiInterface {
38
38
  */
39
39
  agentAskRequestOpts(requestParameters: AgentAskRequest): Promise<runtime.RequestOpts>;
40
40
  /**
41
- * 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.
41
+ * 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.
42
42
  * @summary Agent Ask Handler
43
43
  * @param {AskRequest} askRequest
44
44
  * @param {string} [authorization]
@@ -49,7 +49,7 @@ export interface AgentApiInterface {
49
49
  */
50
50
  agentAskRaw(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AskResponse>>;
51
51
  /**
52
- * 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.
52
+ * 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.
53
53
  * Agent Ask Handler
54
54
  */
55
55
  agentAsk(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AskResponse>;
@@ -88,12 +88,12 @@ export declare class AgentApi extends runtime.BaseAPI implements AgentApiInterfa
88
88
  */
89
89
  agentAskRequestOpts(requestParameters: AgentAskRequest): Promise<runtime.RequestOpts>;
90
90
  /**
91
- * 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.
91
+ * 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.
92
92
  * Agent Ask Handler
93
93
  */
94
94
  agentAskRaw(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AskResponse>>;
95
95
  /**
96
- * 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.
96
+ * 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.
97
97
  * Agent Ask Handler
98
98
  */
99
99
  agentAsk(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AskResponse>;
@@ -87,7 +87,7 @@ class AgentApi extends runtime.BaseAPI {
87
87
  });
88
88
  }
89
89
  /**
90
- * 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.
90
+ * 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.
91
91
  * Agent Ask Handler
92
92
  */
93
93
  agentAskRaw(requestParameters, initOverrides) {
@@ -98,7 +98,7 @@ class AgentApi extends runtime.BaseAPI {
98
98
  });
99
99
  }
100
100
  /**
101
- * 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.
101
+ * 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.
102
102
  * Agent Ask Handler
103
103
  */
104
104
  agentAsk(requestParameters, initOverrides) {
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { ChangeSubscriptionRequest, SubscriptionPlanResponse, TenantResponse } from '../models/index';
13
+ import type { ChangeSubscriptionRequest, SubmitSubscriptionResponse, SubscriptionPlanResponse } from '../models/index';
14
14
  export interface ChangeTenantSubscriptionRequest {
15
15
  tenantId: string;
16
16
  changeSubscriptionRequest: ChangeSubscriptionRequest;
@@ -42,7 +42,7 @@ export interface SubscriptionsApiInterface {
42
42
  */
43
43
  changeTenantSubscriptionRequestOpts(requestParameters: ChangeTenantSubscriptionRequest): Promise<runtime.RequestOpts>;
44
44
  /**
45
- * 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.
45
+ * 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.
46
46
  * @summary Change Tenant Subscription Handler
47
47
  * @param {string} tenantId
48
48
  * @param {ChangeSubscriptionRequest} changeSubscriptionRequest
@@ -53,12 +53,12 @@ export interface SubscriptionsApiInterface {
53
53
  * @throws {RequiredError}
54
54
  * @memberof SubscriptionsApiInterface
55
55
  */
56
- changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TenantResponse>>;
56
+ changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubmitSubscriptionResponse>>;
57
57
  /**
58
- * 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.
58
+ * 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.
59
59
  * Change Tenant Subscription Handler
60
60
  */
61
- changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TenantResponse>;
61
+ changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubmitSubscriptionResponse>;
62
62
  /**
63
63
  * Creates request options for getTenantSubscription without sending the request
64
64
  * @param {string} tenantId
@@ -94,15 +94,15 @@ export declare class SubscriptionsApi extends runtime.BaseAPI implements Subscri
94
94
  */
95
95
  changeTenantSubscriptionRequestOpts(requestParameters: ChangeTenantSubscriptionRequest): Promise<runtime.RequestOpts>;
96
96
  /**
97
- * 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.
97
+ * 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.
98
98
  * Change Tenant Subscription Handler
99
99
  */
100
- changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TenantResponse>>;
100
+ changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubmitSubscriptionResponse>>;
101
101
  /**
102
- * 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.
102
+ * 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.
103
103
  * Change Tenant Subscription Handler
104
104
  */
105
- changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TenantResponse>;
105
+ changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubmitSubscriptionResponse>;
106
106
  /**
107
107
  * Creates request options for getTenantSubscription without sending the request
108
108
  */
@@ -94,18 +94,18 @@ class SubscriptionsApi extends runtime.BaseAPI {
94
94
  });
95
95
  }
96
96
  /**
97
- * 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.
97
+ * 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.
98
98
  * Change Tenant Subscription Handler
99
99
  */
100
100
  changeTenantSubscriptionRaw(requestParameters, initOverrides) {
101
101
  return __awaiter(this, void 0, void 0, function* () {
102
102
  const requestOptions = yield this.changeTenantSubscriptionRequestOpts(requestParameters);
103
103
  const response = yield this.request(requestOptions, initOverrides);
104
- return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.TenantResponseFromJSON)(jsonValue));
104
+ return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.SubmitSubscriptionResponseFromJSON)(jsonValue));
105
105
  });
106
106
  }
107
107
  /**
108
- * 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.
108
+ * 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.
109
109
  * Change Tenant Subscription Handler
110
110
  */
111
111
  changeTenantSubscription(requestParameters, initOverrides) {
@@ -38,7 +38,7 @@ export interface AgentApiInterface {
38
38
  */
39
39
  agentAskRequestOpts(requestParameters: AgentAskRequest): Promise<runtime.RequestOpts>;
40
40
  /**
41
- * 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.
41
+ * 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.
42
42
  * @summary Agent Ask Handler
43
43
  * @param {AskRequest} askRequest
44
44
  * @param {string} [authorization]
@@ -49,7 +49,7 @@ export interface AgentApiInterface {
49
49
  */
50
50
  agentAskRaw(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AskResponse>>;
51
51
  /**
52
- * 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.
52
+ * 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.
53
53
  * Agent Ask Handler
54
54
  */
55
55
  agentAsk(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AskResponse>;
@@ -88,12 +88,12 @@ export declare class AgentApi extends runtime.BaseAPI implements AgentApiInterfa
88
88
  */
89
89
  agentAskRequestOpts(requestParameters: AgentAskRequest): Promise<runtime.RequestOpts>;
90
90
  /**
91
- * 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.
91
+ * 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.
92
92
  * Agent Ask Handler
93
93
  */
94
94
  agentAskRaw(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AskResponse>>;
95
95
  /**
96
- * 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.
96
+ * 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.
97
97
  * Agent Ask Handler
98
98
  */
99
99
  agentAsk(requestParameters: AgentAskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AskResponse>;
@@ -51,7 +51,7 @@ export class AgentApi extends runtime.BaseAPI {
51
51
  });
52
52
  }
53
53
  /**
54
- * 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.
54
+ * 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.
55
55
  * Agent Ask Handler
56
56
  */
57
57
  agentAskRaw(requestParameters, initOverrides) {
@@ -62,7 +62,7 @@ export class AgentApi extends runtime.BaseAPI {
62
62
  });
63
63
  }
64
64
  /**
65
- * 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.
65
+ * 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.
66
66
  * Agent Ask Handler
67
67
  */
68
68
  agentAsk(requestParameters, initOverrides) {
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { ChangeSubscriptionRequest, SubscriptionPlanResponse, TenantResponse } from '../models/index';
13
+ import type { ChangeSubscriptionRequest, SubmitSubscriptionResponse, SubscriptionPlanResponse } from '../models/index';
14
14
  export interface ChangeTenantSubscriptionRequest {
15
15
  tenantId: string;
16
16
  changeSubscriptionRequest: ChangeSubscriptionRequest;
@@ -42,7 +42,7 @@ export interface SubscriptionsApiInterface {
42
42
  */
43
43
  changeTenantSubscriptionRequestOpts(requestParameters: ChangeTenantSubscriptionRequest): Promise<runtime.RequestOpts>;
44
44
  /**
45
- * 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.
45
+ * 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.
46
46
  * @summary Change Tenant Subscription Handler
47
47
  * @param {string} tenantId
48
48
  * @param {ChangeSubscriptionRequest} changeSubscriptionRequest
@@ -53,12 +53,12 @@ export interface SubscriptionsApiInterface {
53
53
  * @throws {RequiredError}
54
54
  * @memberof SubscriptionsApiInterface
55
55
  */
56
- changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TenantResponse>>;
56
+ changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubmitSubscriptionResponse>>;
57
57
  /**
58
- * 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.
58
+ * 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.
59
59
  * Change Tenant Subscription Handler
60
60
  */
61
- changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TenantResponse>;
61
+ changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubmitSubscriptionResponse>;
62
62
  /**
63
63
  * Creates request options for getTenantSubscription without sending the request
64
64
  * @param {string} tenantId
@@ -94,15 +94,15 @@ export declare class SubscriptionsApi extends runtime.BaseAPI implements Subscri
94
94
  */
95
95
  changeTenantSubscriptionRequestOpts(requestParameters: ChangeTenantSubscriptionRequest): Promise<runtime.RequestOpts>;
96
96
  /**
97
- * 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.
97
+ * 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.
98
98
  * Change Tenant Subscription Handler
99
99
  */
100
- changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TenantResponse>>;
100
+ changeTenantSubscriptionRaw(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SubmitSubscriptionResponse>>;
101
101
  /**
102
- * 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.
102
+ * 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.
103
103
  * Change Tenant Subscription Handler
104
104
  */
105
- changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TenantResponse>;
105
+ changeTenantSubscription(requestParameters: ChangeTenantSubscriptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SubmitSubscriptionResponse>;
106
106
  /**
107
107
  * Creates request options for getTenantSubscription without sending the request
108
108
  */
@@ -21,7 +21,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
21
  });
22
22
  };
23
23
  import * as runtime from '../runtime';
24
- import { ChangeSubscriptionRequestToJSON, SubscriptionPlanResponseFromJSON, TenantResponseFromJSON, } from '../models/index';
24
+ import { ChangeSubscriptionRequestToJSON, SubmitSubscriptionResponseFromJSON, SubscriptionPlanResponseFromJSON, } from '../models/index';
25
25
  /**
26
26
  *
27
27
  */
@@ -58,18 +58,18 @@ export class SubscriptionsApi extends runtime.BaseAPI {
58
58
  });
59
59
  }
60
60
  /**
61
- * 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.
61
+ * 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.
62
62
  * Change Tenant Subscription Handler
63
63
  */
64
64
  changeTenantSubscriptionRaw(requestParameters, initOverrides) {
65
65
  return __awaiter(this, void 0, void 0, function* () {
66
66
  const requestOptions = yield this.changeTenantSubscriptionRequestOpts(requestParameters);
67
67
  const response = yield this.request(requestOptions, initOverrides);
68
- return new runtime.JSONApiResponse(response, (jsonValue) => TenantResponseFromJSON(jsonValue));
68
+ return new runtime.JSONApiResponse(response, (jsonValue) => SubmitSubscriptionResponseFromJSON(jsonValue));
69
69
  });
70
70
  }
71
71
  /**
72
- * 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.
72
+ * 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.
73
73
  * Change Tenant Subscription Handler
74
74
  */
75
75
  changeTenantSubscription(requestParameters, initOverrides) {
@@ -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
@@ -85,6 +85,7 @@ export function DocumentResponseFromJSONTyped(json, ignoreDiscriminator) {
85
85
  'createdAt': (new Date(json['created_at'])),
86
86
  'updatedAt': (new Date(json['updated_at'])),
87
87
  'tags': json['tags'] == null ? undefined : (json['tags'].map(TagResponseFromJSON)),
88
+ 'canWrite': json['can_write'] == null ? undefined : json['can_write'],
88
89
  };
89
90
  }
90
91
  export function DocumentResponseToJSON(json) {
@@ -112,5 +113,6 @@ export function DocumentResponseToJSONTyped(value, ignoreDiscriminator = false)
112
113
  'created_at': value['createdAt'].toISOString(),
113
114
  'updated_at': value['updatedAt'].toISOString(),
114
115
  'tags': value['tags'] == null ? undefined : (value['tags'].map(TagResponseToJSON)),
116
+ 'can_write': value['canWrite'],
115
117
  };
116
118
  }
@@ -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
@@ -67,6 +67,7 @@ export function FolderResponseFromJSONTyped(json, ignoreDiscriminator) {
67
67
  'createdAt': (new Date(json['created_at'])),
68
68
  'updatedAt': (new Date(json['updated_at'])),
69
69
  'tags': json['tags'] == null ? undefined : (json['tags'].map(TagResponseFromJSON)),
70
+ 'canWrite': json['can_write'] == null ? undefined : json['can_write'],
70
71
  };
71
72
  }
72
73
  export function FolderResponseToJSON(json) {
@@ -89,5 +90,6 @@ export function FolderResponseToJSONTyped(value, ignoreDiscriminator = false) {
89
90
  'created_at': value['createdAt'].toISOString(),
90
91
  'updated_at': value['updatedAt'].toISOString(),
91
92
  'tags': value['tags'] == null ? undefined : (value['tags'].map(TagResponseToJSON)),
93
+ 'can_write': value['canWrite'],
92
94
  };
93
95
  }
@@ -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]: {
@@ -42,6 +42,7 @@ export function MeteredQuotaStatusFromJSONTyped(json, ignoreDiscriminator) {
42
42
  'limit': json['limit'],
43
43
  'periodStart': (new Date(json['period_start'])),
44
44
  'periodEnd': (new Date(json['period_end'])),
45
+ 'additionalBalance': json['additional_balance'] == null ? undefined : json['additional_balance'],
45
46
  };
46
47
  }
47
48
  export function MeteredQuotaStatusToJSON(json) {
@@ -57,5 +58,6 @@ export function MeteredQuotaStatusToJSONTyped(value, ignoreDiscriminator = false
57
58
  'limit': value['limit'],
58
59
  'period_start': value['periodStart'].toISOString(),
59
60
  'period_end': value['periodEnd'].toISOString(),
61
+ 'additional_balance': value['additionalBalance'],
60
62
  };
61
63
  }
@@ -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;