@parall/sdk 1.23.0 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +33 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +106 -6
- package/dist/constants.d.ts +45 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +43 -12
- package/dist/types.d.ts +219 -49
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +131 -6
- package/src/constants.ts +47 -12
- package/src/types.ts +272 -49
package/src/types.ts
CHANGED
|
@@ -62,7 +62,14 @@ export interface PushSubscribeRequest {
|
|
|
62
62
|
export interface NotifPrefs {
|
|
63
63
|
dm?: boolean;
|
|
64
64
|
mention?: boolean;
|
|
65
|
+
group_message?: boolean;
|
|
65
66
|
task_assign?: boolean;
|
|
67
|
+
task_comment?: boolean;
|
|
68
|
+
task_update?: boolean;
|
|
69
|
+
approval_request?: boolean;
|
|
70
|
+
schedule_fire?: boolean;
|
|
71
|
+
agent_alert?: boolean;
|
|
72
|
+
invitation?: boolean;
|
|
66
73
|
}
|
|
67
74
|
|
|
68
75
|
export interface NotificationPreferences {
|
|
@@ -154,29 +161,34 @@ export interface ToolResultContent {
|
|
|
154
161
|
collapsible: boolean;
|
|
155
162
|
}
|
|
156
163
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
label: string;
|
|
160
|
-
style: 'primary' | 'danger' | 'secondary';
|
|
161
|
-
}
|
|
162
|
-
|
|
164
|
+
// CardContent is the polymorphic content for 'card' message type.
|
|
165
|
+
// card_type discriminates the data payload.
|
|
163
166
|
export interface ApprovalCardContent {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
card_type: 'approval';
|
|
168
|
+
entity_id: string;
|
|
169
|
+
display: {
|
|
170
|
+
title: string;
|
|
171
|
+
description?: string;
|
|
172
|
+
requester?: { id: string; name: string };
|
|
173
|
+
};
|
|
174
|
+
interaction: {
|
|
175
|
+
action: string;
|
|
176
|
+
resource_type?: string;
|
|
177
|
+
resource_id?: string;
|
|
178
|
+
action_payload?: Record<string, unknown>;
|
|
179
|
+
actions: string[];
|
|
180
|
+
status: string;
|
|
181
|
+
decided_by?: string;
|
|
182
|
+
decided_at?: string;
|
|
183
|
+
execution_status?: ExecutionStatus | null;
|
|
184
|
+
execution_error?: string | null;
|
|
185
|
+
executed_at?: string | null;
|
|
186
|
+
};
|
|
173
187
|
}
|
|
174
188
|
|
|
175
|
-
// CardContent is the polymorphic content for 'card' message type.
|
|
176
|
-
// card_type discriminates the data payload.
|
|
177
189
|
export type CardContent =
|
|
178
|
-
|
|
|
179
|
-
| { card_type: string; data
|
|
190
|
+
| ApprovalCardContent
|
|
191
|
+
| { card_type: string; entity_id?: string; data?: Record<string, unknown> };
|
|
180
192
|
|
|
181
193
|
export type AgentState = 'thinking' | 'tool_calling' | 'streaming' | 'waiting_approval' | 'completed' | 'error';
|
|
182
194
|
|
|
@@ -245,22 +257,40 @@ export interface Attachment {
|
|
|
245
257
|
created_at: string;
|
|
246
258
|
}
|
|
247
259
|
|
|
248
|
-
export type ApprovalStatus = 'pending' | 'approved' | 'rejected' | 'expired';
|
|
260
|
+
export type ApprovalStatus = 'pending' | 'approved' | 'rejected' | 'expired' | 'cancelled';
|
|
261
|
+
|
|
262
|
+
export type ExecutionStatus = 'succeeded' | 'failed';
|
|
249
263
|
|
|
250
264
|
export interface Approval {
|
|
251
265
|
id: string;
|
|
252
|
-
|
|
253
|
-
chat_id: string;
|
|
254
|
-
requester_id: string;
|
|
255
|
-
status: ApprovalStatus;
|
|
266
|
+
org_id: string;
|
|
256
267
|
action_type: string;
|
|
268
|
+
resource_uri: string;
|
|
257
269
|
action_payload: Record<string, unknown>;
|
|
270
|
+
title: string;
|
|
271
|
+
requester_id: string;
|
|
258
272
|
decided_by: string | null;
|
|
259
273
|
decided_at: string | null;
|
|
274
|
+
status: ApprovalStatus;
|
|
260
275
|
expires_at: string | null;
|
|
276
|
+
execution_status?: ExecutionStatus | null;
|
|
277
|
+
execution_error?: string | null;
|
|
278
|
+
executed_at?: string | null;
|
|
279
|
+
chat_id: string;
|
|
280
|
+
message_id?: string | null;
|
|
261
281
|
created_at: string;
|
|
262
282
|
}
|
|
263
283
|
|
|
284
|
+
export interface CreateApprovalRequest {
|
|
285
|
+
action_type: string;
|
|
286
|
+
resource_uri: string;
|
|
287
|
+
action_payload?: Record<string, unknown>;
|
|
288
|
+
chat_id: string;
|
|
289
|
+
title: string;
|
|
290
|
+
reason?: string;
|
|
291
|
+
expires_at?: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
264
294
|
export type OrgMemberRole = 'owner' | 'admin' | 'member';
|
|
265
295
|
|
|
266
296
|
export interface Organization {
|
|
@@ -273,6 +303,7 @@ export interface Organization {
|
|
|
273
303
|
smart_routing_strategy: string | null;
|
|
274
304
|
/** Agent ID for strategy='agent'. NULL when strategy is 'llm' or unset. */
|
|
275
305
|
smart_routing_agent_id: string | null;
|
|
306
|
+
onboarding_agent_id: string | null;
|
|
276
307
|
created_at: string;
|
|
277
308
|
}
|
|
278
309
|
|
|
@@ -486,8 +517,13 @@ export interface CreateAgentRequest {
|
|
|
486
517
|
model_management?: string; // "platform" | "self"; default by hosting type
|
|
487
518
|
agent_permissions?: string[];
|
|
488
519
|
runtime_type?: string; // "openclaw" | "claude-code" | "codex"; default "openclaw"
|
|
520
|
+
description?: string;
|
|
489
521
|
machine_type?: string;
|
|
490
|
-
machine_label?: string;
|
|
522
|
+
machine_label?: string; // preset: "lite" | "standard" | "pro" | "custom"
|
|
523
|
+
// Required when machine_label === "custom". Validated server-side.
|
|
524
|
+
cpu_cores?: number;
|
|
525
|
+
memory_mb?: number;
|
|
526
|
+
storage_gb?: number;
|
|
491
527
|
provider_config?: AgentProviderConfig;
|
|
492
528
|
}
|
|
493
529
|
|
|
@@ -495,32 +531,42 @@ export interface CreateAgentRequest {
|
|
|
495
531
|
* AgentProviderConfig is the WRITE shape: what a client sends on
|
|
496
532
|
* CreateAgent.provider_config or UpdateAgentProviderConfigRequest.
|
|
497
533
|
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
534
|
+
* Hosted agents default to "managed by Parall" — the hosting service
|
|
535
|
+
* points the runtime CLI at Parall's LLM proxy and authenticates with
|
|
536
|
+
* the agent's own API key, keeping billing and attribution server-side.
|
|
537
|
+
* These per-agent fields are the BYO override: bring your own ChatGPT/
|
|
538
|
+
* Anthropic subscription, point at Azure OpenAI, or use an OpenAI/
|
|
539
|
+
* Anthropic-compatible proxy.
|
|
540
|
+
*
|
|
541
|
+
* Each runtime consumes exactly one credential family:
|
|
542
|
+
* - codex → openai_*
|
|
543
|
+
* - claude-code → anthropic_*
|
|
503
544
|
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
507
|
-
*
|
|
545
|
+
* The server rejects cross-family fields (e.g. anthropic_* on codex).
|
|
546
|
+
* Unset / empty-string fields are dropped at provisioning time, so a
|
|
547
|
+
* partial form doesn't mask the managed proxy path with an empty string.
|
|
548
|
+
* Sensitive fields (API key / auth token) are injected via K8s
|
|
549
|
+
* Secret-ref; endpoint overrides land as plain env.
|
|
508
550
|
*/
|
|
509
551
|
export interface AgentProviderConfig {
|
|
510
552
|
openai_api_key?: string;
|
|
511
553
|
openai_base_url?: string;
|
|
554
|
+
anthropic_auth_token?: string;
|
|
555
|
+
anthropic_base_url?: string;
|
|
512
556
|
}
|
|
513
557
|
|
|
514
558
|
/**
|
|
515
559
|
* AgentProviderConfigRead is the READ shape returned by GET / list /
|
|
516
|
-
* PATCH-response paths. The server never echoes the raw
|
|
517
|
-
*
|
|
518
|
-
* a previously-configured
|
|
519
|
-
* non-sensitive and round-
|
|
560
|
+
* PATCH-response paths. The server never echoes the raw secrets — only
|
|
561
|
+
* presence flags — so no org admin (or log leak) can ever exfiltrate
|
|
562
|
+
* a previously-configured value from the wire. Base URLs are
|
|
563
|
+
* non-sensitive and round-trip cleartext.
|
|
520
564
|
*/
|
|
521
565
|
export interface AgentProviderConfigRead {
|
|
522
566
|
openai_api_key_set: boolean;
|
|
523
567
|
openai_base_url?: string;
|
|
568
|
+
anthropic_auth_token_set: boolean;
|
|
569
|
+
anthropic_base_url?: string;
|
|
524
570
|
}
|
|
525
571
|
|
|
526
572
|
/**
|
|
@@ -537,6 +583,7 @@ export interface UpdateAgentRequest {
|
|
|
537
583
|
agent_model?: string;
|
|
538
584
|
model_management?: string;
|
|
539
585
|
agent_permissions?: string[];
|
|
586
|
+
description?: string;
|
|
540
587
|
}
|
|
541
588
|
|
|
542
589
|
// ---- Machine types ----
|
|
@@ -547,6 +594,13 @@ export interface Machine {
|
|
|
547
594
|
id: string;
|
|
548
595
|
org_id: string;
|
|
549
596
|
label: string;
|
|
597
|
+
// Persisted spec — set at creation by agent.go from MachinePresets[label]
|
|
598
|
+
// or user-supplied custom values, and used by hosting.Service.Provision +
|
|
599
|
+
// billing.go as the authoritative source. Mirrors the server-side
|
|
600
|
+
// `model.Machine` Go struct.
|
|
601
|
+
cpu_cores: number;
|
|
602
|
+
memory_mb: number;
|
|
603
|
+
storage_gb: number;
|
|
550
604
|
status: MachineStatus;
|
|
551
605
|
compute_provider: string;
|
|
552
606
|
runtime_type: string;
|
|
@@ -571,6 +625,7 @@ export interface AgentProfile {
|
|
|
571
625
|
permissions: string[];
|
|
572
626
|
machine_id: string | null;
|
|
573
627
|
runtime_type: string;
|
|
628
|
+
description: string | null;
|
|
574
629
|
run_config?: RunConfig;
|
|
575
630
|
created_by: string;
|
|
576
631
|
created_at: string;
|
|
@@ -596,11 +651,12 @@ export interface AgentWithRuntime extends User {
|
|
|
596
651
|
export interface PresignUploadRequest {
|
|
597
652
|
file_name: string;
|
|
598
653
|
file_size: number;
|
|
599
|
-
mime_type
|
|
654
|
+
mime_type?: string;
|
|
600
655
|
}
|
|
601
656
|
|
|
602
657
|
export interface FileUrlResponse {
|
|
603
658
|
url: string;
|
|
659
|
+
is_proxy_url?: boolean;
|
|
604
660
|
expires_in: number;
|
|
605
661
|
width?: number;
|
|
606
662
|
height?: number;
|
|
@@ -609,6 +665,10 @@ export interface FileUrlResponse {
|
|
|
609
665
|
mime_type: string;
|
|
610
666
|
}
|
|
611
667
|
|
|
668
|
+
export interface AvatarUploadResponse {
|
|
669
|
+
avatar_url: string;
|
|
670
|
+
}
|
|
671
|
+
|
|
612
672
|
// ============================================================
|
|
613
673
|
// Task Types
|
|
614
674
|
// ============================================================
|
|
@@ -747,14 +807,13 @@ export interface UpdateProjectRequest {
|
|
|
747
807
|
|
|
748
808
|
export type ScheduleSpecType = 'cron' | 'interval' | 'one_shot';
|
|
749
809
|
export type ScheduleStatus = 'active' | 'paused' | 'completed' | 'cancelled';
|
|
750
|
-
export type ScheduleCancelReason = 'user_cancel' | 'attached_gone' | '
|
|
810
|
+
export type ScheduleCancelReason = 'user_cancel' | 'attached_gone' | 'creator_ineligible';
|
|
751
811
|
export type ScheduleRunStatus = 'delivered' | 'missed' | 'failed';
|
|
752
812
|
|
|
753
813
|
export interface Schedule {
|
|
754
814
|
id: string;
|
|
755
815
|
org_id: string;
|
|
756
816
|
creator_id: string;
|
|
757
|
-
target_id: string;
|
|
758
817
|
attached_to_uri: string | null;
|
|
759
818
|
name: string;
|
|
760
819
|
description: string;
|
|
@@ -767,6 +826,8 @@ export interface Schedule {
|
|
|
767
826
|
end_at: string | null;
|
|
768
827
|
max_runs: number | null;
|
|
769
828
|
catchup_window_seconds: number;
|
|
829
|
+
duration_seconds: number | null;
|
|
830
|
+
target_ids: string[];
|
|
770
831
|
status: ScheduleStatus;
|
|
771
832
|
cancel_reason: ScheduleCancelReason | null;
|
|
772
833
|
next_fire_at: string | null;
|
|
@@ -784,8 +845,6 @@ export interface ScheduleRun {
|
|
|
784
845
|
status: ScheduleRunStatus;
|
|
785
846
|
fired_description: string | null;
|
|
786
847
|
fired_attached_uri: string | null;
|
|
787
|
-
dispatch_event_id: string | null;
|
|
788
|
-
inbox_item_id: string | null;
|
|
789
848
|
error: string | null;
|
|
790
849
|
created_at: string;
|
|
791
850
|
}
|
|
@@ -793,7 +852,7 @@ export interface ScheduleRun {
|
|
|
793
852
|
export interface CreateScheduleInput {
|
|
794
853
|
name: string;
|
|
795
854
|
description: string;
|
|
796
|
-
|
|
855
|
+
target_ids: string[];
|
|
797
856
|
attached_to_uri?: string;
|
|
798
857
|
spec_type: ScheduleSpecType;
|
|
799
858
|
cron_expr?: string;
|
|
@@ -804,12 +863,13 @@ export interface CreateScheduleInput {
|
|
|
804
863
|
end_at?: string;
|
|
805
864
|
max_runs?: number;
|
|
806
865
|
catchup_window_seconds?: number;
|
|
866
|
+
duration_seconds?: number;
|
|
807
867
|
}
|
|
808
868
|
|
|
809
869
|
export interface UpdateScheduleInput {
|
|
810
870
|
name?: string;
|
|
811
871
|
description?: string;
|
|
812
|
-
|
|
872
|
+
target_ids?: string[];
|
|
813
873
|
attached_to_uri?: string;
|
|
814
874
|
/** Explicitly clear attached_to_uri. Server honors this over `attached_to_uri`. */
|
|
815
875
|
attached_to_uri_clear?: boolean;
|
|
@@ -827,11 +887,13 @@ export interface UpdateScheduleInput {
|
|
|
827
887
|
/** Explicitly clear max_runs. Server honors this over `max_runs`. */
|
|
828
888
|
max_runs_clear?: boolean;
|
|
829
889
|
catchup_window_seconds?: number;
|
|
890
|
+
duration_seconds?: number;
|
|
891
|
+
duration_seconds_clear?: boolean;
|
|
830
892
|
}
|
|
831
893
|
|
|
832
894
|
export interface ScheduleFilters {
|
|
833
895
|
attached_to?: string;
|
|
834
|
-
|
|
896
|
+
attendee_id?: string;
|
|
835
897
|
creator_id?: string;
|
|
836
898
|
/** Comma-separated list of statuses (e.g. 'active,paused'). */
|
|
837
899
|
status?: string;
|
|
@@ -1301,12 +1363,15 @@ export type ApprovalUpdateData = CardUpdateData;
|
|
|
1301
1363
|
|
|
1302
1364
|
export interface CardUpdateData {
|
|
1303
1365
|
card_type: string;
|
|
1304
|
-
|
|
1366
|
+
entity_id: string;
|
|
1305
1367
|
message_id: string;
|
|
1306
1368
|
chat_id: string;
|
|
1307
1369
|
status: string;
|
|
1370
|
+
execution_status?: ExecutionStatus | null;
|
|
1308
1371
|
decided_by?: string;
|
|
1309
1372
|
decided_at?: string;
|
|
1373
|
+
executed_at?: string | null;
|
|
1374
|
+
execution_error?: string | null;
|
|
1310
1375
|
}
|
|
1311
1376
|
|
|
1312
1377
|
export interface RecoveryOverflowData {
|
|
@@ -1523,8 +1588,9 @@ export interface InboxItem {
|
|
|
1523
1588
|
// Dispatch Types (agent event delivery)
|
|
1524
1589
|
// ============================================================
|
|
1525
1590
|
|
|
1526
|
-
export type DispatchEventType = 'message' | 'task_assign' | 'task_comment' | 'schedule.fire';
|
|
1591
|
+
export type DispatchEventType = 'message' | 'task_assign' | 'task_update' | 'task_comment' | 'schedule.fire';
|
|
1527
1592
|
export type DispatchStatus = 'pending' | 'acked';
|
|
1593
|
+
export type DispatchDeliveryReason = 'mention' | 'watcher';
|
|
1528
1594
|
|
|
1529
1595
|
export interface DispatchEvent {
|
|
1530
1596
|
id: string;
|
|
@@ -1543,6 +1609,12 @@ export interface DispatchEvent {
|
|
|
1543
1609
|
* (@mention, DM, task assignment, active-mode fanout).
|
|
1544
1610
|
*/
|
|
1545
1611
|
source_mode: string | null;
|
|
1612
|
+
/**
|
|
1613
|
+
* Recipient-resolution hint. For task_comment dispatches this distinguishes
|
|
1614
|
+
* explicit @mention delivery from implicit task watcher delivery while the
|
|
1615
|
+
* dispatch event itself remains a source pointer.
|
|
1616
|
+
*/
|
|
1617
|
+
delivery_reason: DispatchDeliveryReason | null;
|
|
1546
1618
|
status: DispatchStatus;
|
|
1547
1619
|
acked_at: string | null;
|
|
1548
1620
|
created_at: string;
|
|
@@ -1575,7 +1647,8 @@ export interface ReadPositionUpdateData {
|
|
|
1575
1647
|
export interface NotificationAlertData {
|
|
1576
1648
|
title: string;
|
|
1577
1649
|
body: string;
|
|
1578
|
-
category: string;
|
|
1650
|
+
category: string;
|
|
1651
|
+
collapse_id?: string;
|
|
1579
1652
|
data: Record<string, string> | null; // {org_id, chat_id, url, ...}
|
|
1580
1653
|
}
|
|
1581
1654
|
|
|
@@ -1629,6 +1702,11 @@ export type WsEventMap = {
|
|
|
1629
1702
|
'schedule.updated': ScheduleUpdatedData;
|
|
1630
1703
|
'schedule.deleted': ScheduleDeletedData;
|
|
1631
1704
|
'schedule.fired': ScheduleFiredData;
|
|
1705
|
+
'billing.balance_updated': BillingBalanceUpdatedEvent;
|
|
1706
|
+
'billing.low_balance': BillingLowBalanceEvent;
|
|
1707
|
+
'billing.machine_stopped': BillingMachineStoppedEvent;
|
|
1708
|
+
'billing.insufficient': BillingInsufficientEvent;
|
|
1709
|
+
'user.updated': User;
|
|
1632
1710
|
};
|
|
1633
1711
|
|
|
1634
1712
|
// Invitation WS event data
|
|
@@ -1865,3 +1943,148 @@ export interface SetRuntimeModeRequest {
|
|
|
1865
1943
|
update_mode: RuntimeUpdateMode;
|
|
1866
1944
|
pinned_tag?: string | null;
|
|
1867
1945
|
}
|
|
1946
|
+
|
|
1947
|
+
// ============================================================
|
|
1948
|
+
// Billing & Credits
|
|
1949
|
+
// ============================================================
|
|
1950
|
+
|
|
1951
|
+
export interface CreditWallet {
|
|
1952
|
+
org_id: string;
|
|
1953
|
+
balance: number;
|
|
1954
|
+
updated_at: string;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
export interface CreditTransaction {
|
|
1958
|
+
id: string;
|
|
1959
|
+
org_id: string;
|
|
1960
|
+
type: 'topup' | 'auto_reload' | 'llm_deduct' | 'compute_deduct' | 'adjustment' | 'refund' | 'grant' | 'grant_expire';
|
|
1961
|
+
amount: number;
|
|
1962
|
+
balance_after: number;
|
|
1963
|
+
grant_id: string | null;
|
|
1964
|
+
description: string | null;
|
|
1965
|
+
reference_type: string | null;
|
|
1966
|
+
reference_id: string | null;
|
|
1967
|
+
metadata: Record<string, unknown> | null;
|
|
1968
|
+
created_at: string;
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
export interface BillingSummary {
|
|
1972
|
+
balance: number;
|
|
1973
|
+
llm_usage_this_month: number;
|
|
1974
|
+
compute_usage_this_month: number;
|
|
1975
|
+
total_usage_this_month: number;
|
|
1976
|
+
grants?: CreditGrant[];
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
// CreditGrant is shipped to user-facing clients via BillingSummary.grants
|
|
1980
|
+
// (read-only — issued only by admin). `type` stays `string` so a server-side
|
|
1981
|
+
// custom type (an ops one-off, e.g. "incident-1234") doesn't break typed
|
|
1982
|
+
// clients.
|
|
1983
|
+
//
|
|
1984
|
+
// IssueGrantRequest, GrantTypePreset, and GRANT_TYPE_PRESETS are intentionally
|
|
1985
|
+
// NOT exported here — those are admin-only contracts (POST body for
|
|
1986
|
+
// /internal/admin/orgs/{id}/grants and the admin dropdown defaults).
|
|
1987
|
+
// The admin dashboard maintains its own mirror in `ts/admin/lib/api.ts`
|
|
1988
|
+
// to stay decoupled from the public SDK ecosystem and its own deploy
|
|
1989
|
+
// (standalone Docker, internal network only).
|
|
1990
|
+
export interface CreditGrant {
|
|
1991
|
+
id: string;
|
|
1992
|
+
org_id: string;
|
|
1993
|
+
type: string;
|
|
1994
|
+
name: string;
|
|
1995
|
+
original_amount: number;
|
|
1996
|
+
remaining: number;
|
|
1997
|
+
priority: number;
|
|
1998
|
+
expires_at: string | null;
|
|
1999
|
+
metadata: Record<string, unknown> | null;
|
|
2000
|
+
created_by: string | null;
|
|
2001
|
+
created_at: string;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
// Read model — what GET /billing/auto-reload returns.
|
|
2005
|
+
// `has_payment_method` is server-derived from Stripe customer state.
|
|
2006
|
+
export interface AutoReloadSettings {
|
|
2007
|
+
enabled: boolean;
|
|
2008
|
+
threshold: number;
|
|
2009
|
+
reload_amount: number;
|
|
2010
|
+
stripe_price: number;
|
|
2011
|
+
has_payment_method: boolean;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
// Write model — what PUT /billing/auto-reload accepts. Excludes derived /
|
|
2015
|
+
// read-only fields (has_payment_method) so callers can't accidentally try
|
|
2016
|
+
// to clobber server-side state.
|
|
2017
|
+
export interface UpdateAutoReloadRequest {
|
|
2018
|
+
enabled: boolean;
|
|
2019
|
+
threshold: number;
|
|
2020
|
+
reload_amount: number;
|
|
2021
|
+
stripe_price: number;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
export interface ComputePricing {
|
|
2025
|
+
id: string;
|
|
2026
|
+
component: string;
|
|
2027
|
+
unit: string;
|
|
2028
|
+
price_per_hour: number;
|
|
2029
|
+
effective_from: string;
|
|
2030
|
+
created_at: string;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
// Response shape for GET /api/v1/billing/compute-pricing — map keyed by
|
|
2034
|
+
// component name ("cpu" | "memory" | "storage").
|
|
2035
|
+
export type ComputePricingResponse = Record<string, ComputePricing>;
|
|
2036
|
+
|
|
2037
|
+
export interface MachinePreset {
|
|
2038
|
+
key: string;
|
|
2039
|
+
cpu_cores: number;
|
|
2040
|
+
memory_mb: number;
|
|
2041
|
+
storage_gb: number;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
export interface CreateCheckoutRequest {
|
|
2045
|
+
amount_cents: number;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
export interface CreateCheckoutResponse {
|
|
2049
|
+
checkout_url: string;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
export interface CreateSetupIntentResponse {
|
|
2053
|
+
/** Stripe-hosted Checkout Session URL (mode=setup). The frontend redirects
|
|
2054
|
+
* with `window.location.href = setup_url`; Stripe handles the card form
|
|
2055
|
+
* and redirects back to /settings?tab=billing&setup={success|cancelled}.
|
|
2056
|
+
*/
|
|
2057
|
+
setup_url: string;
|
|
2058
|
+
/** @deprecated Always empty string. Retained so legacy clients that
|
|
2059
|
+
* destructured `client_secret` from the response don't crash; new code
|
|
2060
|
+
* should use `setup_url`. The redirect-style flow superseded the
|
|
2061
|
+
* Payment Element flow before any consumer wired this field. */
|
|
2062
|
+
client_secret?: string;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
// ResizeMachineRequest was retired pending the server-side
|
|
2066
|
+
// `PATCH /machines/{id}/spec` route. Reintroduce alongside the route and
|
|
2067
|
+
// the matching ParallClient method when in-place resize is implemented.
|
|
2068
|
+
|
|
2069
|
+
// Invalidation signal: server publishes only { org_id } on any wallet
|
|
2070
|
+
// change; clients refetch `getBilling` / `listBillingTransactions` to get
|
|
2071
|
+
// the latest state.
|
|
2072
|
+
export interface BillingBalanceUpdatedEvent {
|
|
2073
|
+
org_id: string;
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
export interface BillingLowBalanceEvent {
|
|
2077
|
+
org_id: string;
|
|
2078
|
+
machine_id: string;
|
|
2079
|
+
grace_ends: string;
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
export interface BillingMachineStoppedEvent {
|
|
2083
|
+
org_id: string;
|
|
2084
|
+
machine_id: string;
|
|
2085
|
+
reason: string;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
export interface BillingInsufficientEvent {
|
|
2089
|
+
org_id: string;
|
|
2090
|
+
}
|