codai-sdk 0.54.1 → 0.55.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/index.d.ts CHANGED
@@ -3055,6 +3055,126 @@ type paths$1 = {
3055
3055
  readonly patch?: never;
3056
3056
  readonly trace?: never;
3057
3057
  };
3058
+ readonly '/v1/sandboxes/{id}/fork': {
3059
+ readonly parameters: {
3060
+ readonly query?: never;
3061
+ readonly header?: never;
3062
+ readonly path?: never;
3063
+ readonly cookie?: never;
3064
+ };
3065
+ readonly get?: never;
3066
+ readonly put?: never;
3067
+ /**
3068
+ * Fork a running sandbox (v2)
3069
+ * @description Snapshots the running sandbox (it keeps running) and starts `count` new sandboxes from that snapshot, each with its own id, workspace copy and kernel state. Per child, `restored: false` means it started cold; a child that failed carries `error` and is not running.
3070
+ */
3071
+ readonly post: operations$1['forkSandbox'];
3072
+ readonly delete?: never;
3073
+ readonly options?: never;
3074
+ readonly head?: never;
3075
+ readonly patch?: never;
3076
+ readonly trace?: never;
3077
+ };
3078
+ readonly '/v1/sandboxes/{id}/kernel/reset': {
3079
+ readonly parameters: {
3080
+ readonly query?: never;
3081
+ readonly header?: never;
3082
+ readonly path?: never;
3083
+ readonly cookie?: never;
3084
+ };
3085
+ readonly get?: never;
3086
+ readonly put?: never;
3087
+ /**
3088
+ * Restart the kernel (v2)
3089
+ * @description Restarts the persistent Python kernel; all globals are lost, the workspace is kept.
3090
+ */
3091
+ readonly post: operations$1['resetSandboxKernel'];
3092
+ readonly delete?: never;
3093
+ readonly options?: never;
3094
+ readonly head?: never;
3095
+ readonly patch?: never;
3096
+ readonly trace?: never;
3097
+ };
3098
+ readonly '/v1/sandboxes/{id}/pause': {
3099
+ readonly parameters: {
3100
+ readonly query?: never;
3101
+ readonly header?: never;
3102
+ readonly path?: never;
3103
+ readonly cookie?: never;
3104
+ };
3105
+ readonly get?: never;
3106
+ readonly put?: never;
3107
+ /**
3108
+ * Pause a sandbox (v2)
3109
+ * @description Takes a memory snapshot (processes, kernel state and `/workspace`), then stops the pod. The sandbox moves to status `paused`; only snapshot storage is billed while paused (€0.05 per GB-month).
3110
+ */
3111
+ readonly post: operations$1['pauseSandbox'];
3112
+ readonly delete?: never;
3113
+ readonly options?: never;
3114
+ readonly head?: never;
3115
+ readonly patch?: never;
3116
+ readonly trace?: never;
3117
+ };
3118
+ readonly '/v1/sandboxes/{id}/preview': {
3119
+ readonly parameters: {
3120
+ readonly query?: never;
3121
+ readonly header?: never;
3122
+ readonly path?: never;
3123
+ readonly cookie?: never;
3124
+ };
3125
+ readonly get?: never;
3126
+ readonly put?: never;
3127
+ /**
3128
+ * Get a preview URL for a port (v2)
3129
+ * @description Signs a temporary HTTPS URL on `*.sbx.codai.ro` that forwards to a port inside the sandbox (for example a dev server, or noVNC on 6080 in the `desktop` template). The URL needs no key; it expires after `ttl_seconds` (default 900, at most 1 h).
3130
+ */
3131
+ readonly post: operations$1['previewSandbox'];
3132
+ readonly delete?: never;
3133
+ readonly options?: never;
3134
+ readonly head?: never;
3135
+ readonly patch?: never;
3136
+ readonly trace?: never;
3137
+ };
3138
+ readonly '/v1/sandboxes/{id}/resume': {
3139
+ readonly parameters: {
3140
+ readonly query?: never;
3141
+ readonly header?: never;
3142
+ readonly path?: never;
3143
+ readonly cookie?: never;
3144
+ };
3145
+ readonly get?: never;
3146
+ readonly put?: never;
3147
+ /**
3148
+ * Resume a paused sandbox (v2)
3149
+ * @description Restores the sandbox from its pause snapshot. `restored` tells whether the memory state came back (`true`) or the pod started cold from the workspace only (`false`); `ready_ms` is the time until the sandbox answered.
3150
+ */
3151
+ readonly post: operations$1['resumeSandbox'];
3152
+ readonly delete?: never;
3153
+ readonly options?: never;
3154
+ readonly head?: never;
3155
+ readonly patch?: never;
3156
+ readonly trace?: never;
3157
+ };
3158
+ readonly '/v1/sandboxes/{id}/run_code': {
3159
+ readonly parameters: {
3160
+ readonly query?: never;
3161
+ readonly header?: never;
3162
+ readonly path?: never;
3163
+ readonly cookie?: never;
3164
+ };
3165
+ readonly get?: never;
3166
+ readonly put?: never;
3167
+ /**
3168
+ * Run code in the persistent kernel (v2)
3169
+ * @description Runs Python in the sandbox kernel, which keeps its globals between calls, across pause/resume and into forks. The last expression of the cell is returned as `result` (repr, at most 64 KB). A call past its timeout restarts the kernel (`kernel_restarted: true`, state lost). Only for `backend: "v2"` sandboxes (closed canary).
3170
+ */
3171
+ readonly post: operations$1['runSandboxCode'];
3172
+ readonly delete?: never;
3173
+ readonly options?: never;
3174
+ readonly head?: never;
3175
+ readonly patch?: never;
3176
+ readonly trace?: never;
3177
+ };
3058
3178
  readonly '/v1/sandboxes/{id}/snapshot': {
3059
3179
  readonly parameters: {
3060
3180
  readonly query?: never;
@@ -12410,6 +12530,11 @@ type components$1 = {
12410
12530
  };
12411
12531
  /** Sandbox */
12412
12532
  readonly Sandbox: {
12533
+ /**
12534
+ * @description Backend chosen at create time.
12535
+ * @enum {string}
12536
+ */
12537
+ readonly backend: 'v1' | 'v2';
12413
12538
  /** Format: date-time */
12414
12539
  readonly created_at: string;
12415
12540
  readonly egress: components$1['schemas']['SandboxEgress'];
@@ -12424,8 +12549,10 @@ type components$1 = {
12424
12549
  };
12425
12550
  /** @enum {string} */
12426
12551
  readonly object: 'sandbox';
12552
+ /** @description Only on create of a `v2` sandbox: true when it started from a warm template snapshot. */
12553
+ readonly restored?: boolean;
12427
12554
  /** @enum {string} */
12428
- readonly status: 'running' | 'stopped' | 'expired' | 'destroyed';
12555
+ readonly status: 'running' | 'paused' | 'stopped' | 'expired' | 'destroyed';
12429
12556
  readonly template: string;
12430
12557
  readonly usage: {
12431
12558
  readonly exec_count: number;
@@ -12457,19 +12584,25 @@ type components$1 = {
12457
12584
  };
12458
12585
  /** Create sandbox request */
12459
12586
  readonly SandboxCreate: {
12587
+ /**
12588
+ * @description Execution backend: `v1` (default, workspace snapshots between execs) or `v2` (closed canary: long-lived pod with memory snapshots, pause/resume, fork, persistent kernel and preview URLs; no network egress).
12589
+ * @default v1
12590
+ * @enum {string}
12591
+ */
12592
+ readonly backend?: 'v1' | 'v2';
12460
12593
  readonly egress?: components$1['schemas']['SandboxEgress'];
12461
12594
  /** @description Your own labels, returned as-is. */
12462
12595
  readonly metadata?: {
12463
12596
  readonly [key: string]: string;
12464
12597
  };
12465
12598
  /**
12466
- * @description Image template.
12599
+ * @description Image template. `v1`: `codai-base` only. `v2`: `codai-base`, `brivio-acte` (office toolchain warmed up) or `desktop` (a Linux desktop over noVNC on port 6080).
12467
12600
  * @default codai-base
12468
12601
  * @enum {string}
12469
12602
  */
12470
- readonly template?: 'codai-base';
12603
+ readonly template?: 'codai-base' | 'brivio-acte' | 'desktop';
12471
12604
  /**
12472
- * @description Lifetime; the sandbox expires afterwards (sliding for chat sessions).
12605
+ * @description Lifetime; the sandbox expires afterwards (sliding for chat sessions). At most 86400 on `v1` and 604800 on `v2`.
12473
12606
  * @default 3600
12474
12607
  */
12475
12608
  readonly ttl_seconds?: number;
@@ -12517,6 +12650,7 @@ type components$1 = {
12517
12650
  readonly changed: readonly string[];
12518
12651
  readonly cpu_ms: number;
12519
12652
  readonly duration_ms: number;
12653
+ /** @description The command's own exit status; `128 + n` when it was ended by signal `n`. `null` only when the exec timed out (`timed_out: true`) or the process could not be started. */
12520
12654
  readonly exit_code: number | null;
12521
12655
  readonly generation: number;
12522
12656
  readonly receipt: components$1['schemas']['SandboxReceipt'];
@@ -12567,7 +12701,7 @@ type components$1 = {
12567
12701
  /** @description Present on `/v1/sandboxes/run`. */
12568
12702
  readonly artifacts?: readonly components$1['schemas']['SandboxArtifact'][];
12569
12703
  readonly duration_ms: number;
12570
- /** @description `null` when the process was killed. */
12704
+ /** @description The command's own exit status; `128 + n` when it was ended by signal `n`. `null` only when the exec timed out (`timed_out: true`) or the process could not be started. */
12571
12705
  readonly exit_code: number | null;
12572
12706
  readonly receipt: components$1['schemas']['SandboxReceipt'];
12573
12707
  /** @description Standard error (at most 1 MB). */
@@ -12594,6 +12728,33 @@ type components$1 = {
12594
12728
  readonly path: string;
12595
12729
  readonly sha256: string;
12596
12730
  };
12731
+ /** Fork sandbox request */
12732
+ readonly SandboxForkRequest: {
12733
+ /** @description How many children to start (1–5). */
12734
+ readonly count: number;
12735
+ /** @description Lifetime of each child in seconds (default: what is left of the parent). */
12736
+ readonly ttl_seconds?: number;
12737
+ };
12738
+ /** Fork result */
12739
+ readonly SandboxForkResult: {
12740
+ readonly data: readonly {
12741
+ /** @description Why this child failed (it is not running). */
12742
+ readonly error?: {
12743
+ readonly code: string;
12744
+ readonly message: string;
12745
+ };
12746
+ /** Format: uuid */
12747
+ readonly id: string;
12748
+ /** @description Milliseconds until the child answered. */
12749
+ readonly ready_ms: number;
12750
+ /** @description True when the child started from the memory snapshot, false when it started cold. */
12751
+ readonly restored: boolean;
12752
+ }[];
12753
+ /** @enum {string} */
12754
+ readonly object: 'list';
12755
+ /** Format: uuid */
12756
+ readonly parent_id: string;
12757
+ };
12597
12758
  /**
12598
12759
  * Sandbox input file
12599
12760
  * @description One input file: inline `base64` or an https `url`; `sha256` is verified when given.
@@ -12612,6 +12773,27 @@ type components$1 = {
12612
12773
  /** @enum {string} */
12613
12774
  readonly object?: 'list';
12614
12775
  };
12776
+ /** Preview URL */
12777
+ readonly SandboxPreview: {
12778
+ /** Format: date-time */
12779
+ readonly expires_at: string;
12780
+ readonly port: number;
12781
+ /**
12782
+ * Format: uri
12783
+ * @description Signed HTTPS URL; anyone holding it reaches the port until it expires.
12784
+ */
12785
+ readonly url: string;
12786
+ };
12787
+ /** Preview URL request */
12788
+ readonly SandboxPreviewRequest: {
12789
+ /** @description Port inside the sandbox (1024–65535, not 8080). */
12790
+ readonly port: number;
12791
+ /**
12792
+ * @description Validity in seconds (60–3600, default 900).
12793
+ * @default 900
12794
+ */
12795
+ readonly ttl_seconds?: number;
12796
+ };
12615
12797
  /**
12616
12798
  * Reproducibility receipt
12617
12799
  * @description What ran and what it produced: image digest, hashes of the inputs and the command, every output file with its SHA-256, and the workspace generations before and after.
@@ -12629,6 +12811,44 @@ type components$1 = {
12629
12811
  }[];
12630
12812
  readonly template: string;
12631
12813
  };
12814
+ /** Resumed sandbox */
12815
+ readonly SandboxResumed: components$1['schemas']['Sandbox'] & {
12816
+ /** @description Milliseconds until the sandbox answered. */
12817
+ readonly ready_ms: number;
12818
+ /** @description True when the memory state was restored, false on a cold start. */
12819
+ readonly restored: boolean;
12820
+ };
12821
+ /** Run code request */
12822
+ readonly SandboxRunCodeRequest: {
12823
+ /** @description Python source of the cell. */
12824
+ readonly code: string;
12825
+ /**
12826
+ * @description Seconds before the kernel is restarted (default 60, max 900).
12827
+ * @default 60
12828
+ */
12829
+ readonly timeout_seconds?: number;
12830
+ };
12831
+ /** Run code result */
12832
+ readonly SandboxRunCodeResult: {
12833
+ /** @description Wall-clock milliseconds. */
12834
+ readonly duration_ms: number;
12835
+ /** @description The uncaught exception, or null. */
12836
+ readonly error: {
12837
+ readonly name: string;
12838
+ readonly traceback: string;
12839
+ readonly value: string;
12840
+ } | null;
12841
+ /** @description Kernel execution counter. */
12842
+ readonly execution_count: number;
12843
+ /** @description True when the kernel was restarted (timeout or crash) and its state is lost. */
12844
+ readonly kernel_restarted: boolean;
12845
+ /** @description repr of the last expression, or null. */
12846
+ readonly result: string | null;
12847
+ /** @description Text printed to stderr during the cell. */
12848
+ readonly stderr: string;
12849
+ /** @description Text printed to stdout during the cell. */
12850
+ readonly stdout: string;
12851
+ };
12632
12852
  /**
12633
12853
  * One-shot run request
12634
12854
  * @description The fields of `SandboxCreate` plus those of `SandboxExecRequest`.
@@ -21974,7 +22194,7 @@ interface operations$1 {
21974
22194
  readonly parameters: {
21975
22195
  readonly query?: {
21976
22196
  /** @description Only sandboxes in this status. */
21977
- readonly status?: 'running' | 'stopped' | 'expired' | 'destroyed';
22197
+ readonly status?: 'running' | 'paused' | 'stopped' | 'expired' | 'destroyed';
21978
22198
  };
21979
22199
  readonly header?: {
21980
22200
  /** @description Client correlation id; echoed back as `x-codai-trace-id` and persisted on the usage row. */
@@ -22395,6 +22615,318 @@ interface operations$1 {
22395
22615
  };
22396
22616
  };
22397
22617
  };
22618
+ readonly forkSandbox: {
22619
+ readonly parameters: {
22620
+ readonly query?: never;
22621
+ readonly header?: {
22622
+ /** @description Client correlation id; echoed back as `x-codai-trace-id` and persisted on the usage row. */
22623
+ readonly 'x-request-id'?: components$1['parameters']['RequestId'];
22624
+ };
22625
+ readonly path: {
22626
+ /** @description Sandbox id (uuid). */
22627
+ readonly id: string;
22628
+ };
22629
+ readonly cookie?: never;
22630
+ };
22631
+ readonly requestBody: {
22632
+ readonly content: {
22633
+ readonly 'application/json': components$1['schemas']['SandboxForkRequest'];
22634
+ };
22635
+ };
22636
+ readonly responses: {
22637
+ /** @description The children. */
22638
+ readonly 200: {
22639
+ headers: {
22640
+ readonly [name: string]: unknown;
22641
+ };
22642
+ content: {
22643
+ readonly 'application/json': components$1['schemas']['SandboxForkResult'];
22644
+ };
22645
+ };
22646
+ readonly 400: components$1['responses']['BadRequest'];
22647
+ readonly 401: components$1['responses']['Unauthorized'];
22648
+ readonly 402: components$1['responses']['PaymentRequired'];
22649
+ /** @description The key does not reach tool level `l3_sandbox`. */
22650
+ readonly 403: {
22651
+ headers: {
22652
+ readonly [name: string]: unknown;
22653
+ };
22654
+ content: {
22655
+ readonly 'application/json': components$1['schemas']['Error'];
22656
+ };
22657
+ };
22658
+ readonly 404: components$1['responses']['NotFound'];
22659
+ /** @description The sandbox is not a `backend: "v2"` sandbox (`requires_v2`), is not running (`sandbox_not_running`) or another operation holds it (`sandbox_busy`). */
22660
+ readonly 409: {
22661
+ headers: {
22662
+ readonly [name: string]: unknown;
22663
+ };
22664
+ content: {
22665
+ readonly 'application/json': components$1['schemas']['Error'];
22666
+ };
22667
+ };
22668
+ /** @description The fork would take this key above 6 live sandboxes (`sandbox_concurrency_limit`). */
22669
+ readonly 429: {
22670
+ headers: {
22671
+ readonly [name: string]: unknown;
22672
+ };
22673
+ content: {
22674
+ readonly 'application/json': components$1['schemas']['Error'];
22675
+ };
22676
+ };
22677
+ };
22678
+ };
22679
+ readonly resetSandboxKernel: {
22680
+ readonly parameters: {
22681
+ readonly query?: never;
22682
+ readonly header?: {
22683
+ /** @description Client correlation id; echoed back as `x-codai-trace-id` and persisted on the usage row. */
22684
+ readonly 'x-request-id'?: components$1['parameters']['RequestId'];
22685
+ };
22686
+ readonly path: {
22687
+ /** @description Sandbox id (uuid). */
22688
+ readonly id: string;
22689
+ };
22690
+ readonly cookie?: never;
22691
+ };
22692
+ readonly requestBody?: never;
22693
+ readonly responses: {
22694
+ /** @description The kernel was restarted. */
22695
+ readonly 200: {
22696
+ headers: {
22697
+ readonly [name: string]: unknown;
22698
+ };
22699
+ content: {
22700
+ readonly 'application/json': {
22701
+ /** @enum {boolean} */
22702
+ readonly ok: true;
22703
+ };
22704
+ };
22705
+ };
22706
+ readonly 400: components$1['responses']['BadRequest'];
22707
+ readonly 401: components$1['responses']['Unauthorized'];
22708
+ readonly 402: components$1['responses']['PaymentRequired'];
22709
+ /** @description The key does not reach tool level `l3_sandbox`. */
22710
+ readonly 403: {
22711
+ headers: {
22712
+ readonly [name: string]: unknown;
22713
+ };
22714
+ content: {
22715
+ readonly 'application/json': components$1['schemas']['Error'];
22716
+ };
22717
+ };
22718
+ readonly 404: components$1['responses']['NotFound'];
22719
+ /** @description The sandbox is not a `backend: "v2"` sandbox (`requires_v2`), is not running (`sandbox_not_running`) or another operation holds it (`sandbox_busy`). */
22720
+ readonly 409: {
22721
+ headers: {
22722
+ readonly [name: string]: unknown;
22723
+ };
22724
+ content: {
22725
+ readonly 'application/json': components$1['schemas']['Error'];
22726
+ };
22727
+ };
22728
+ };
22729
+ };
22730
+ readonly pauseSandbox: {
22731
+ readonly parameters: {
22732
+ readonly query?: never;
22733
+ readonly header?: {
22734
+ /** @description Client correlation id; echoed back as `x-codai-trace-id` and persisted on the usage row. */
22735
+ readonly 'x-request-id'?: components$1['parameters']['RequestId'];
22736
+ };
22737
+ readonly path: {
22738
+ /** @description Sandbox id (uuid). */
22739
+ readonly id: string;
22740
+ };
22741
+ readonly cookie?: never;
22742
+ };
22743
+ readonly requestBody?: never;
22744
+ readonly responses: {
22745
+ /** @description The paused sandbox. */
22746
+ readonly 200: {
22747
+ headers: {
22748
+ readonly [name: string]: unknown;
22749
+ };
22750
+ content: {
22751
+ readonly 'application/json': components$1['schemas']['Sandbox'];
22752
+ };
22753
+ };
22754
+ readonly 400: components$1['responses']['BadRequest'];
22755
+ readonly 401: components$1['responses']['Unauthorized'];
22756
+ readonly 402: components$1['responses']['PaymentRequired'];
22757
+ /** @description The key does not reach tool level `l3_sandbox`. */
22758
+ readonly 403: {
22759
+ headers: {
22760
+ readonly [name: string]: unknown;
22761
+ };
22762
+ content: {
22763
+ readonly 'application/json': components$1['schemas']['Error'];
22764
+ };
22765
+ };
22766
+ readonly 404: components$1['responses']['NotFound'];
22767
+ /** @description The sandbox is not a `backend: "v2"` sandbox (`requires_v2`), is not running (`sandbox_not_running`) or another operation holds it (`sandbox_busy`). */
22768
+ readonly 409: {
22769
+ headers: {
22770
+ readonly [name: string]: unknown;
22771
+ };
22772
+ content: {
22773
+ readonly 'application/json': components$1['schemas']['Error'];
22774
+ };
22775
+ };
22776
+ };
22777
+ };
22778
+ readonly previewSandbox: {
22779
+ readonly parameters: {
22780
+ readonly query?: never;
22781
+ readonly header?: {
22782
+ /** @description Client correlation id; echoed back as `x-codai-trace-id` and persisted on the usage row. */
22783
+ readonly 'x-request-id'?: components$1['parameters']['RequestId'];
22784
+ };
22785
+ readonly path: {
22786
+ /** @description Sandbox id (uuid). */
22787
+ readonly id: string;
22788
+ };
22789
+ readonly cookie?: never;
22790
+ };
22791
+ readonly requestBody: {
22792
+ readonly content: {
22793
+ readonly 'application/json': components$1['schemas']['SandboxPreviewRequest'];
22794
+ };
22795
+ };
22796
+ readonly responses: {
22797
+ /** @description The signed preview URL. */
22798
+ readonly 200: {
22799
+ headers: {
22800
+ readonly [name: string]: unknown;
22801
+ };
22802
+ content: {
22803
+ readonly 'application/json': components$1['schemas']['SandboxPreview'];
22804
+ };
22805
+ };
22806
+ readonly 400: components$1['responses']['BadRequest'];
22807
+ readonly 401: components$1['responses']['Unauthorized'];
22808
+ readonly 402: components$1['responses']['PaymentRequired'];
22809
+ /** @description The key does not reach tool level `l3_sandbox`. */
22810
+ readonly 403: {
22811
+ headers: {
22812
+ readonly [name: string]: unknown;
22813
+ };
22814
+ content: {
22815
+ readonly 'application/json': components$1['schemas']['Error'];
22816
+ };
22817
+ };
22818
+ readonly 404: components$1['responses']['NotFound'];
22819
+ /** @description The sandbox is not a `backend: "v2"` sandbox (`requires_v2`), is not running (`sandbox_not_running`) or another operation holds it (`sandbox_busy`). */
22820
+ readonly 409: {
22821
+ headers: {
22822
+ readonly [name: string]: unknown;
22823
+ };
22824
+ content: {
22825
+ readonly 'application/json': components$1['schemas']['Error'];
22826
+ };
22827
+ };
22828
+ };
22829
+ };
22830
+ readonly resumeSandbox: {
22831
+ readonly parameters: {
22832
+ readonly query?: never;
22833
+ readonly header?: {
22834
+ /** @description Client correlation id; echoed back as `x-codai-trace-id` and persisted on the usage row. */
22835
+ readonly 'x-request-id'?: components$1['parameters']['RequestId'];
22836
+ };
22837
+ readonly path: {
22838
+ /** @description Sandbox id (uuid). */
22839
+ readonly id: string;
22840
+ };
22841
+ readonly cookie?: never;
22842
+ };
22843
+ readonly requestBody?: never;
22844
+ readonly responses: {
22845
+ /** @description The resumed sandbox. */
22846
+ readonly 200: {
22847
+ headers: {
22848
+ readonly [name: string]: unknown;
22849
+ };
22850
+ content: {
22851
+ readonly 'application/json': components$1['schemas']['SandboxResumed'];
22852
+ };
22853
+ };
22854
+ readonly 400: components$1['responses']['BadRequest'];
22855
+ readonly 401: components$1['responses']['Unauthorized'];
22856
+ readonly 402: components$1['responses']['PaymentRequired'];
22857
+ /** @description The key does not reach tool level `l3_sandbox`. */
22858
+ readonly 403: {
22859
+ headers: {
22860
+ readonly [name: string]: unknown;
22861
+ };
22862
+ content: {
22863
+ readonly 'application/json': components$1['schemas']['Error'];
22864
+ };
22865
+ };
22866
+ readonly 404: components$1['responses']['NotFound'];
22867
+ /** @description The sandbox is not a `backend: "v2"` sandbox (`requires_v2`), is not paused (`sandbox_not_paused`) or another operation holds it (`sandbox_busy`). */
22868
+ readonly 409: {
22869
+ headers: {
22870
+ readonly [name: string]: unknown;
22871
+ };
22872
+ content: {
22873
+ readonly 'application/json': components$1['schemas']['Error'];
22874
+ };
22875
+ };
22876
+ };
22877
+ };
22878
+ readonly runSandboxCode: {
22879
+ readonly parameters: {
22880
+ readonly query?: never;
22881
+ readonly header?: {
22882
+ /** @description Client correlation id; echoed back as `x-codai-trace-id` and persisted on the usage row. */
22883
+ readonly 'x-request-id'?: components$1['parameters']['RequestId'];
22884
+ };
22885
+ readonly path: {
22886
+ /** @description Sandbox id (uuid). */
22887
+ readonly id: string;
22888
+ };
22889
+ readonly cookie?: never;
22890
+ };
22891
+ readonly requestBody: {
22892
+ readonly content: {
22893
+ readonly 'application/json': components$1['schemas']['SandboxRunCodeRequest'];
22894
+ };
22895
+ };
22896
+ readonly responses: {
22897
+ /** @description The cell result. */
22898
+ readonly 200: {
22899
+ headers: {
22900
+ readonly [name: string]: unknown;
22901
+ };
22902
+ content: {
22903
+ readonly 'application/json': components$1['schemas']['SandboxRunCodeResult'];
22904
+ };
22905
+ };
22906
+ readonly 400: components$1['responses']['BadRequest'];
22907
+ readonly 401: components$1['responses']['Unauthorized'];
22908
+ readonly 402: components$1['responses']['PaymentRequired'];
22909
+ /** @description The key does not reach tool level `l3_sandbox`. */
22910
+ readonly 403: {
22911
+ headers: {
22912
+ readonly [name: string]: unknown;
22913
+ };
22914
+ content: {
22915
+ readonly 'application/json': components$1['schemas']['Error'];
22916
+ };
22917
+ };
22918
+ readonly 404: components$1['responses']['NotFound'];
22919
+ /** @description The sandbox is not a `backend: "v2"` sandbox (`requires_v2`), is not running (`sandbox_not_running`) or another operation holds it (`sandbox_busy`). */
22920
+ readonly 409: {
22921
+ headers: {
22922
+ readonly [name: string]: unknown;
22923
+ };
22924
+ content: {
22925
+ readonly 'application/json': components$1['schemas']['Error'];
22926
+ };
22927
+ };
22928
+ };
22929
+ };
22398
22930
  readonly snapshotSandbox: {
22399
22931
  readonly parameters: {
22400
22932
  readonly query?: never;
@@ -34013,6 +34545,32 @@ export type SandboxFileWritten = Reply<'putSandboxFile'>;
34013
34545
  export type SandboxSnapshot = Reply<'snapshotSandbox'>;
34014
34546
  export type SandboxStatus = Sandbox['status'];
34015
34547
  export type SandboxSnapshotInput = Mutable<NonNullable<Body<'snapshotSandbox'>>>;
34548
+ export type SandboxBackend = NonNullable<SandboxCreateInput['backend']>;
34549
+ export type SandboxTemplate = NonNullable<SandboxCreateInput['template']>;
34550
+ export type SandboxRunCodeResult = Schema<'SandboxRunCodeResult'>;
34551
+ export type SandboxResumed = Reply<'resumeSandbox'>;
34552
+ export type SandboxForkResult = Reply<'forkSandbox'>;
34553
+ export type SandboxPreview = Reply<'previewSandbox'>;
34554
+ /** Input of {@link Sandboxes.runCode}. */
34555
+ export interface SandboxRunCodeInput {
34556
+ code: string;
34557
+ /** Seconds before the kernel is restarted (1–900, server default 60). */
34558
+ timeoutSeconds?: number;
34559
+ }
34560
+ /** Input of {@link Sandboxes.fork}. */
34561
+ export interface SandboxForkInput {
34562
+ /** Children to start (1–5). */
34563
+ count: number;
34564
+ /** Lifetime of each child; default what is left of the parent. */
34565
+ ttlSeconds?: number;
34566
+ }
34567
+ /** Input of {@link Sandboxes.preview}. */
34568
+ export interface SandboxPreviewInput {
34569
+ /** Port inside the sandbox (1024–65535, not 8080). */
34570
+ port: number;
34571
+ /** URL validity in seconds (60–3600, server default 900). */
34572
+ ttlSeconds?: number;
34573
+ }
34016
34574
  type CallOpts$5 = {
34017
34575
  ext?: CodaiRequestExtensions;
34018
34576
  signal?: AbortSignal;
@@ -34040,7 +34598,11 @@ export declare class Sandboxes {
34040
34598
  private readonly http;
34041
34599
  readonly files: SandboxFiles;
34042
34600
  constructor(http: HttpClient);
34043
- /** `POST /v1/sandboxes` — start a sandbox (`ttl_seconds` 60–86400, default 3600; `egress` none by default). */
34601
+ /**
34602
+ * `POST /v1/sandboxes` — start a sandbox (`ttl_seconds` 60–86400, default 3600; `egress` none by default).
34603
+ * `backend: 'v2'` (closed canary) starts a long-lived pod with memory snapshots and accepts `template`
34604
+ * `codai-base` | `brivio-acte` | `desktop`; its reply may carry `restored`.
34605
+ */
34044
34606
  create(input?: SandboxCreateInput, opts?: CallOpts$5): Promise<Sandbox>;
34045
34607
  /** `GET /v1/sandboxes` — your sandboxes, newest first, optionally one `status`. */
34046
34608
  list(query?: {
@@ -34062,6 +34624,21 @@ export declare class Sandboxes {
34062
34624
  artifacts(id: string, opts?: CallOpts$5): Promise<SandboxArtifactList>;
34063
34625
  /** `POST /v1/sandboxes/{id}/snapshot` — store a compressed copy of the workspace. */
34064
34626
  snapshot(id: string, input?: SandboxSnapshotInput, opts?: CallOpts$5): Promise<SandboxSnapshot>;
34627
+ /**
34628
+ * `POST /v1/sandboxes/{id}/run_code` (v2) — run Python in the persistent kernel; globals survive between
34629
+ * calls, pause/resume and forks. The last expression comes back as `result`.
34630
+ */
34631
+ runCode(id: string, input: SandboxRunCodeInput, opts?: CallOpts$5): Promise<SandboxRunCodeResult>;
34632
+ /** `POST /v1/sandboxes/{id}/kernel/reset` (v2) — restart the kernel; globals are lost, files kept. */
34633
+ resetKernel(id: string, opts?: CallOpts$5): Promise<void>;
34634
+ /** `POST /v1/sandboxes/{id}/pause` (v2) — memory snapshot, then stop the pod (status `paused`). */
34635
+ pause(id: string, opts?: CallOpts$5): Promise<Sandbox>;
34636
+ /** `POST /v1/sandboxes/{id}/resume` (v2) — restore a paused sandbox; `restored: false` = cold start. */
34637
+ resume(id: string, opts?: CallOpts$5): Promise<SandboxResumed>;
34638
+ /** `POST /v1/sandboxes/{id}/fork` (v2) — start 1–5 copies of a running sandbox from a memory snapshot. */
34639
+ fork(id: string, input: SandboxForkInput, opts?: CallOpts$5): Promise<SandboxForkResult>;
34640
+ /** `POST /v1/sandboxes/{id}/preview` (v2) — signed HTTPS URL on `*.sbx.codai.ro` for a port (≤ 1 h). */
34641
+ preview(id: string, input: SandboxPreviewInput, opts?: CallOpts$5): Promise<SandboxPreview>;
34065
34642
  /** `DELETE /v1/sandboxes/{id}` — destroy the sandbox and its workspace (204). */
34066
34643
  delete(id: string, opts?: CallOpts$5): Promise<void>;
34067
34644
  /**