monty-proto 0.0.21

A sandboxed, snapshotable Python interpreter written in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
// @generated by `make generate-proto` from proto/monty/v1/monty.proto — DO NOT EDIT.
#![allow(clippy::allow_attributes, clippy::pedantic, clippy::use_self, clippy::absolute_paths, missing_docs)]
// This file is @generated by prost-build.
/// Empty placeholder for valueless oneof arms. Defined locally (rather than
/// importing google.protobuf.Empty) so non-Rust decoders need nothing beyond
/// this single file.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Unit {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ObjectList {
    #[prost(message, repeated, tag = "1")]
    pub items: ::prost::alloc::vec::Vec<crate::WireObject>,
}
/// One key/value entry. Used for dicts and kwargs: proto maps cannot have
/// message keys and do not preserve order, while Python dicts allow arbitrary
/// hashable keys and are insertion-ordered.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Pair {
    #[prost(message, optional, tag = "1")]
    pub key: ::core::option::Option<crate::WireObject>,
    #[prost(message, optional, tag = "2")]
    pub value: ::core::option::Option<crate::WireObject>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Dict {
    #[prost(message, repeated, tag = "1")]
    pub pairs: ::prost::alloc::vec::Vec<Pair>,
}
/// Arbitrary-precision integer as sign + big-endian magnitude. Exact and O(n);
/// JS decode is `(negative ? -1n : 1n) * BigInt('0x' + hex(magnitude))`.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BigInt {
    #[prost(bool, tag = "1")]
    pub negative: bool,
    #[prost(bytes = "vec", tag = "2")]
    pub magnitude: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NamedTuple {
    /// Type name used in repr, e.g. "os.stat_result".
    #[prost(string, tag = "1")]
    pub type_name: ::prost::alloc::string::String,
    /// Attribute names, one per value.
    #[prost(string, repeated, tag = "2")]
    pub field_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(message, repeated, tag = "3")]
    pub values: ::prost::alloc::vec::Vec<crate::WireObject>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Date {
    /// Gregorian year in 1..=9999.
    #[prost(int32, tag = "1")]
    pub year: i32,
    /// 1..=12.
    #[prost(uint32, tag = "2")]
    pub month: u32,
    #[prost(uint32, tag = "3")]
    pub day: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DateTime {
    #[prost(int32, tag = "1")]
    pub year: i32,
    #[prost(uint32, tag = "2")]
    pub month: u32,
    #[prost(uint32, tag = "3")]
    pub day: u32,
    #[prost(uint32, tag = "4")]
    pub hour: u32,
    #[prost(uint32, tag = "5")]
    pub minute: u32,
    #[prost(uint32, tag = "6")]
    pub second: u32,
    /// 0..=999999.
    #[prost(uint32, tag = "7")]
    pub microsecond: u32,
    /// Fixed UTC offset for aware datetimes; absent for naive values.
    #[prost(int32, optional, tag = "8")]
    pub offset_seconds: ::core::option::Option<i32>,
    /// Optional timezone name; only valid when offset_seconds is set.
    #[prost(string, optional, tag = "9")]
    pub timezone_name: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TimeDelta {
    #[prost(int32, tag = "1")]
    pub days: i32,
    /// Normalized to 0..86400.
    #[prost(int32, tag = "2")]
    pub seconds: i32,
    /// Normalized to 0..1000000.
    #[prost(int32, tag = "3")]
    pub microseconds: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TimeZone {
    #[prost(int32, tag = "1")]
    pub offset_seconds: i32,
    #[prost(string, optional, tag = "2")]
    pub name: ::core::option::Option<::prost::alloc::string::String>,
}
/// A simple exception value: type name (e.g. "ValueError") + optional single
/// string argument.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Exception {
    #[prost(string, tag = "1")]
    pub exc_type: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "2")]
    pub arg: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FileHandle {
    /// Virtual (sandbox) path — never a host path.
    #[prost(string, tag = "1")]
    pub path: ::prost::alloc::string::String,
    /// Canonical Python open() mode string: one of r, rb, r+, rb+, w, wb, w+,
    /// wb+, a, ab, a+, ab+.
    #[prost(string, tag = "2")]
    pub mode: ::prost::alloc::string::String,
    /// Char index (text mode) or byte index (binary mode).
    #[prost(uint64, tag = "3")]
    pub position: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Dataclass {
    /// Class name, e.g. "Point".
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Host-side identity of the class, from `id(type(dc))`.
    #[prost(uint64, tag = "2")]
    pub type_id: u64,
    /// Declared field names in definition order.
    #[prost(string, repeated, tag = "3")]
    pub field_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// All attributes (fields and extras), in order.
    #[prost(message, optional, tag = "4")]
    pub attrs: ::core::option::Option<Dict>,
    #[prost(bool, tag = "5")]
    pub frozen: bool,
}
/// An external (host-provided) function value, usually supplied by the parent
/// in response to a `NameLookup` event.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Function {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "2")]
    pub docstring: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Cycle {
    /// Opaque identity token for the object the cycle refers back to: two
    /// cycle markers in the same result are the same object iff their tokens
    /// match. Meaningless outside the result that produced it.
    #[prost(uint64, tag = "1")]
    pub identity: u64,
    /// Type-specific placeholder shown in reprs, e.g. "\[...\]".
    #[prost(string, tag = "2")]
    pub placeholder: ::prost::alloc::string::String,
}
/// A raised Python exception with its traceback. Mirrors monty's
/// `MontyException`.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaisedException {
    /// Exception type name, e.g. "ValueError", "json.JSONDecodeError".
    #[prost(string, tag = "1")]
    pub exc_type: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "2")]
    pub message: ::core::option::Option<::prost::alloc::string::String>,
    /// Outermost frame first, matching Python traceback order.
    #[prost(message, repeated, tag = "3")]
    pub traceback: ::prost::alloc::vec::Vec<StackFrame>,
    /// Structured payload for exception types that carry more than a message;
    /// absent for most exceptions. Mirrors monty's `ExcData`.
    #[prost(message, optional, tag = "4")]
    pub data: ::core::option::Option<ExcData>,
}
/// Structured exception payload, mirroring monty's `ExcData` enum. Future
/// exception types that carry more than a message (e.g. OSError's errno)
/// get new oneof arms with fresh tags. An absent/empty kind means "no
/// payload" (`ExcData::None`).
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExcData {
    #[prost(oneof = "exc_data::Kind", tags = "1, 2")]
    pub kind: ::core::option::Option<exc_data::Kind>,
}
/// Nested message and enum types in `ExcData`.
pub mod exc_data {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Kind {
        #[prost(message, tag = "1")]
        Unicode(super::UnicodeErrorData),
        #[prost(message, tag = "2")]
        Json(super::JsonErrorData),
    }
}
/// CPython's UnicodeDecodeError/UnicodeEncodeError constructor fields
/// (encoding, object, start, end, reason), letting hosts rebuild the real
/// exception instead of a message-only fallback. Mirrors monty's
/// `UnicodeErrorData`.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UnicodeErrorData {
    /// Codec name as CPython reports it, e.g. "utf-8".
    #[prost(string, tag = "1")]
    pub encoding: ::prost::alloc::string::String,
    /// Failing range: byte offsets for decode errors, character indices for
    /// encode errors. `end` is exclusive.
    #[prost(uint64, tag = "4")]
    pub start: u64,
    #[prost(uint64, tag = "5")]
    pub end: u64,
    /// CPython's reason wording, e.g. "ordinal not in range(128)".
    #[prost(string, tag = "6")]
    pub reason: ::prost::alloc::string::String,
    /// The input that failed: bytes for decode errors, str for encode errors.
    #[prost(oneof = "unicode_error_data::Object", tags = "2, 3")]
    pub object: ::core::option::Option<unicode_error_data::Object>,
}
/// Nested message and enum types in `UnicodeErrorData`.
pub mod unicode_error_data {
    /// The input that failed: bytes for decode errors, str for encode errors.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Object {
        #[prost(bytes, tag = "2")]
        ObjectBytes(::prost::alloc::vec::Vec<u8>),
        #[prost(string, tag = "3")]
        ObjectStr(::prost::alloc::string::String),
    }
}
/// CPython's json.JSONDecodeError attribute fields (msg, doc, pos, lineno,
/// colno), letting hosts rebuild the real exception instead of a message-only
/// fallback. Mirrors monty's `JsonErrorData`.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct JsonErrorData {
    /// Bare error message, without the ": line N column M (char K)" suffix.
    #[prost(string, tag = "1")]
    pub msg: ::prost::alloc::string::String,
    /// The document being parsed; absent when larger than the sender's size cap
    /// or when bytes input is not valid UTF-8.
    #[prost(string, optional, tag = "2")]
    pub doc: ::core::option::Option<::prost::alloc::string::String>,
    /// Character index of the error in `doc`.
    #[prost(uint64, tag = "3")]
    pub pos: u64,
    /// 1-based line and column of the error.
    #[prost(uint64, tag = "4")]
    pub lineno: u64,
    #[prost(uint64, tag = "5")]
    pub colno: u64,
}
/// 1-based line/column source position (columns count characters, not bytes).
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CodeLoc {
    #[prost(uint32, tag = "1")]
    pub line: u32,
    #[prost(uint32, tag = "2")]
    pub column: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StackFrame {
    #[prost(string, tag = "1")]
    pub filename: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub start: ::core::option::Option<CodeLoc>,
    #[prost(message, optional, tag = "3")]
    pub end: ::core::option::Option<CodeLoc>,
    /// Function name; absent for module-level code (rendered as "<module>").
    #[prost(string, optional, tag = "4")]
    pub frame_name: ::core::option::Option<::prost::alloc::string::String>,
    /// Source line shown in the traceback preview.
    #[prost(string, optional, tag = "5")]
    pub preview_line: ::core::option::Option<::prost::alloc::string::String>,
    /// Suppress the `~~~` caret markers for this frame.
    #[prost(bool, tag = "6")]
    pub hide_caret: bool,
    /// Suppress the `, in <name>` suffix (SyntaxError style).
    #[prost(bool, tag = "7")]
    pub hide_frame_name: bool,
}
/// Sandbox resource limits, enforced inside the child. Absent fields mean
/// "unlimited" except recursion depth, which defaults to monty's standard
/// limit (1000) when absent.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ResourceLimits {
    #[prost(uint64, optional, tag = "1")]
    pub max_duration_micros: ::core::option::Option<u64>,
    #[prost(uint64, optional, tag = "2")]
    pub max_memory_bytes: ::core::option::Option<u64>,
    #[prost(uint64, optional, tag = "3")]
    pub gc_interval: ::core::option::Option<u64>,
    #[prost(uint64, optional, tag = "4")]
    pub max_recursion_depth: ::core::option::Option<u64>,
}
/// Outcome of an external function / OS call, decided by the parent. Mirrors
/// monty's `ExtFunctionResult`, plus `not_handled` (which only the child can
/// resolve, against its suspended call).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExtFunctionResult {
    #[prost(oneof = "ext_function_result::Kind", tags = "1, 2, 3, 4, 5")]
    pub kind: ::core::option::Option<ext_function_result::Kind>,
}
/// Nested message and enum types in `ExtFunctionResult`.
pub mod ext_function_result {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        /// The call returned this value.
        #[prost(message, tag = "1")]
        ReturnValue(crate::WireObject),
        /// The call raised this exception.
        #[prost(message, tag = "2")]
        Error(super::RaisedException),
        /// The call is asynchronous: register an external future for `call_id`
        /// (the id from the suspension event) and keep executing other tasks.
        #[prost(uint32, tag = "3")]
        Future(u32),
        /// No handler exists for this name — the child raises NameError.
        #[prost(string, tag = "4")]
        NotFound(::prost::alloc::string::String),
        /// No handler accepted this OS call — the child raises the call's own
        /// no-handler default (PermissionError naming the path for filesystem
        /// calls, RuntimeError for the rest). Only valid answering an `OsCall`
        /// suspension; the child computes it from its retained call payload.
        #[prost(message, tag = "5")]
        NotHandled(super::Unit),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FutureResult {
    #[prost(uint32, tag = "1")]
    pub call_id: u32,
    #[prost(message, optional, tag = "2")]
    pub result: ::core::option::Option<ExtFunctionResult>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NamedValue {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub value: ::core::option::Option<crate::WireObject>,
}
/// Tags 1-19 are reserved for `kind` arms and the message-level fields start
/// at 20, mirroring `ChildEvent` — a oneof shares its field-number space with
/// the enclosing message, so a new arm never has to jump the numbering. The
/// same caveats apply: arms past 15 cost a two-byte key, and a forwarding
/// server mirrors this numbering to classify frames without decoding them, so
/// adding an arm degrades to "opaque" while renumbering one would misroute.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ParentRequest {
    /// W3C `traceparent` identifying the caller's span, so a child that exports
    /// its own telemetry can attach its spans to the trace the request came
    /// from. Purely additive context: the child's execution of the request must
    /// not depend on it, and it is absent whenever the parent is not tracing.
    #[prost(string, optional, tag = "20")]
    pub trace_parent: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(oneof = "parent_request::Kind", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10")]
    pub kind: ::core::option::Option<parent_request::Kind>,
}
/// Nested message and enum types in `ParentRequest`.
pub mod parent_request {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        #[prost(message, tag = "1")]
        Configure(super::Configure),
        #[prost(message, tag = "2")]
        InstallDependencies(super::InstallDependencies),
        #[prost(message, tag = "3")]
        Feed(super::Feed),
        #[prost(message, tag = "4")]
        ResumeCall(super::ResumeCall),
        #[prost(message, tag = "5")]
        ResumeNameLookup(super::ResumeNameLookup),
        #[prost(message, tag = "6")]
        ResumeFutures(super::ResumeFutures),
        #[prost(message, tag = "7")]
        Dump(super::Dump),
        #[prost(message, tag = "8")]
        Load(super::Load),
        #[prost(message, tag = "9")]
        Reset(super::Reset),
        #[prost(message, tag = "10")]
        Shutdown(super::Shutdown),
    }
}
/// Configures the REPL session this child will serve until `Reset`, sent once
/// when the worker is checked out. The session's repl is materialized lazily on
/// the first `Feed` (or restored by `Load`), so a checked-out-but-unfed
/// worker can still be initialized by `Load` instead. Valid only when the
/// worker has no session yet.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Configure {
    #[prost(string, tag = "1")]
    pub script_name: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub limits: ::core::option::Option<ResourceLimits>,
    /// Type-check each fed snippet before executing it.
    #[prost(bool, tag = "3")]
    pub type_check: bool,
    /// Optional stub file contents used by type checking.
    #[prost(string, optional, tag = "4")]
    pub type_check_stubs: ::core::option::Option<::prost::alloc::string::String>,
    /// The parent's monty package version (e.g. "0.0.18"). INFORMATIONAL ONLY —
    /// it is never checked, only reported (in telemetry, and when diagnosing a
    /// rejected `protocol_version`). Parent and child may run different package
    /// versions as long as their protocol versions are compatible.
    #[prost(string, tag = "5")]
    pub monty_version: ::prost::alloc::string::String,
    /// Introspected `assert` failure messages (see limitations/assert.md).
    /// Absent = on with the default 120-byte operand-repr truncation; 0 disables
    /// annotations; any other value retains that many bytes per operand before
    /// any ellipsis, cutting on a character boundary.
    #[prost(uint32, optional, tag = "6")]
    pub assert_message_annotations: ::core::option::Option<u32>,
    /// How the child renders the diagnostics carried by `TypingError`. The
    /// structured diagnostics borrow the type checker's database and so cannot
    /// cross the wire — the parent picks the format up front and the child
    /// renders it. Ignored when `type_check` is false.
    #[prost(enumeration = "TypeCheckFormat", tag = "7")]
    pub type_check_format: i32,
    /// Render typing diagnostics with ANSI colour escapes. Only `FULL` and
    /// `CONCISE` carry colour; the machine-readable formats ignore it.
    #[prost(bool, tag = "8")]
    pub type_check_color: bool,
    /// Version of the wire schema the parent speaks. The child rejects the
    /// session with a `FatalError` naming its own supported range when this
    /// falls outside it, so a parent deployed separately from its worker (over
    /// a websocket, say) learns what to downgrade to without a handshake.
    ///
    /// 0 means the parent declared nothing — either it predates this field or it
    /// is not a monty parent — and is always rejected. The protocol has no
    /// in-band negotiation, so an undeclared peer cannot be assumed compatible.
    #[prost(uint32, tag = "9")]
    pub protocol_version: u32,
}
/// Executes one snippet against the session. Turn ends with `Complete`,
/// `Error`, `TypingError`, or a suspension event.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Feed {
    #[prost(string, tag = "1")]
    pub code: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "2")]
    pub inputs: ::prost::alloc::vec::Vec<NamedValue>,
    /// Skip type checking for this feed even when the session enables it.
    #[prost(bool, tag = "3")]
    pub skip_type_check: bool,
}
/// Answers a `FunctionCall` or `OsCall` suspension. `call_id` must match the
/// suspension event.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResumeCall {
    #[prost(uint32, tag = "1")]
    pub call_id: u32,
    #[prost(message, optional, tag = "2")]
    pub result: ::core::option::Option<ExtFunctionResult>,
}
/// Answers a `NameLookup` suspension.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResumeNameLookup {
    #[prost(oneof = "resume_name_lookup::Kind", tags = "1, 2")]
    pub kind: ::core::option::Option<resume_name_lookup::Kind>,
}
/// Nested message and enum types in `ResumeNameLookup`.
pub mod resume_name_lookup {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        /// The name resolves to this value.
        #[prost(message, tag = "1")]
        Value(crate::WireObject),
        /// The name is undefined — the child raises NameError.
        #[prost(message, tag = "2")]
        Undefined(super::Unit),
    }
}
/// Answers a `ResolveFutures` suspension with results for some or all pending
/// call ids.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResumeFutures {
    #[prost(message, repeated, tag = "1")]
    pub results: ::prost::alloc::vec::Vec<FutureResult>,
}
/// Requests an opaque serialized snapshot of the current session state
/// (idle or suspended). The child stays usable afterwards. The bytes carry
/// monty's own dump format, versioned independently of this schema, and can
/// only be restored via `Load` by a child built with the same dump version.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Dump {}
/// Restores state produced by `Dump`. Valid only from no session. If
/// the restored state was suspended, the child re-emits the suspension event so
/// the parent learns the resume point; otherwise it replies `Ok`.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Load {
    #[prost(bytes = "vec", tag = "1")]
    pub state: ::prost::alloc::vec::Vec<u8>,
}
/// Ends the checkout: the child drops all session state and returns to the
/// no-session state, ready for the next `Configure` or `Load`.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Reset {}
/// The child replies `Ok` and exits cleanly.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Shutdown {}
/// Installs third-party Python packages into the session before further feeds,
/// using `uv pip install --python <venv-python>` against the worker's session
/// virtualenv. Only the
/// embedded-CPython worker honors this; the Monty sandbox child rejects it with
/// an `Error` (it has no host interpreter to install for). Repeatable between
/// feeds. Turn ends with `Ok` on success or `Error` (carrying uv's stderr) on
/// failure. Valid only once a session exists (after `Configure`).
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InstallDependencies {
    /// PEP 508 requirement strings, e.g. "httpx>=0.27", "numpy". An empty list is
    /// a no-op that replies `Ok`.
    #[prost(string, repeated, tag = "1")]
    pub requirements: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// A oneof shares its field-number space with the enclosing message, so tags
/// 1-19 are reserved by convention for `kind` arms and the message-level
/// fields start at 20 — a new arm then never has to jump the numbering. Note
/// arms past 15 cost a two-byte key instead of one, which forwarding servers
/// (which walk only field keys, on every frame) pay per event. Such a server
/// mirrors this numbering to classify frames without decoding them; it treats
/// a tag it does not know as opaque, so adding an arm degrades rather than
/// misroutes, but renumbering an existing one would break it.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChildEvent {
    /// Cumulative execution time consumed by the session's sandbox code, in
    /// microseconds. The in-sandbox clock runs only while the interpreter is
    /// executing bytecode — never while suspended waiting on the parent or idle
    /// between feeds — and survives Dump/Load. Set on every turn-ending event
    /// while a session exists (zero on Print events and outside a session) so
    /// the parent can mirror the `max_duration` budget, e.g. to arm a watchdog
    /// backstop, without keeping a second clock.
    #[prost(uint64, tag = "20")]
    pub total_execution_micros: u64,
    /// The session's `max_duration` limit in microseconds, when one is
    /// configured. Reported alongside `total_execution_micros` so a parent that
    /// restored a session via `Load` (where the limits travel inside the opaque
    /// state bytes) still learns the budget.
    #[prost(uint64, optional, tag = "21")]
    pub max_duration_micros: ::core::option::Option<u64>,
    /// The session's script name, surfaced on a `Load` reply so a parent that
    /// restored a session (whose script name, like the limits above, travels
    /// inside the opaque dump bytes) learns it without parsing the dump. Set only
    /// on a successful `Load` reply; unset on all other events.
    #[prost(string, optional, tag = "22")]
    pub restored_script_name: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(oneof = "child_event::Kind", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")]
    pub kind: ::core::option::Option<child_event::Kind>,
}
/// Nested message and enum types in `ChildEvent`.
pub mod child_event {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Kind {
        #[prost(message, tag = "1")]
        Print(super::Print),
        #[prost(message, tag = "2")]
        FunctionCall(crate::WireFunctionCall),
        #[prost(message, tag = "3")]
        OsCall(super::OsCall),
        #[prost(message, tag = "4")]
        NameLookup(super::NameLookup),
        #[prost(message, tag = "5")]
        ResolveFutures(super::ResolveFutures),
        #[prost(message, tag = "6")]
        Complete(super::Complete),
        #[prost(message, tag = "7")]
        Error(super::Error),
        #[prost(message, tag = "8")]
        TypingError(super::TypingError),
        #[prost(message, tag = "9")]
        DumpResult(super::DumpResult),
        #[prost(message, tag = "10")]
        Ok(super::Ok),
        #[prost(message, tag = "11")]
        FatalError(super::FatalError),
        #[prost(message, tag = "12")]
        Shutdown(super::ShutdownDump),
    }
}
/// Streamed sandbox print() output. Zero or more of these precede each
/// turn-ending event; text is flushed at line granularity.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Print {
    #[prost(enumeration = "PrintStream", tag = "1")]
    pub stream: i32,
    #[prost(string, tag = "2")]
    pub text: ::prost::alloc::string::String,
}
/// Suspension: the sandbox performed an OS operation, surfaced for the parent
/// to service (e.g. from a mount) or answer with `ResumeCall`. One typed arm
/// per call; every path is a virtual POSIX sandbox path, never a host path.
/// Some calls have typed result expectations (e.g. `open` must return a
/// file_handle); a mismatched result becomes a Python-level error inside the
/// sandbox.
///
/// A parent with no handler should answer `ResumeCall` with
/// `ExtFunctionResult.not_handled`: the child raises the call's own default
/// (PermissionError naming the path for filesystem calls, RuntimeError for
/// the rest — monty's `OsFunctionCall::on_no_handler`).
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OsCall {
    #[prost(uint32, tag = "1")]
    pub call_id: u32,
    #[prost(
        oneof = "os_call::Call",
        tags = "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24"
    )]
    pub call: ::core::option::Option<os_call::Call>,
}
/// Nested message and enum types in `OsCall`.
pub mod os_call {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct TextWrite {
        #[prost(string, tag = "1")]
        pub path: ::prost::alloc::string::String,
        #[prost(string, tag = "2")]
        pub data: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct BytesWrite {
        #[prost(string, tag = "1")]
        pub path: ::prost::alloc::string::String,
        #[prost(bytes = "vec", tag = "2")]
        pub data: ::prost::alloc::vec::Vec<u8>,
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Open {
        #[prost(string, tag = "1")]
        pub path: ::prost::alloc::string::String,
        /// Canonical open() mode string, same set as `FileHandle.mode`.
        #[prost(string, tag = "2")]
        pub mode: ::prost::alloc::string::String,
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Mkdir {
        #[prost(string, tag = "1")]
        pub path: ::prost::alloc::string::String,
        #[prost(bool, tag = "2")]
        pub parents: bool,
        #[prost(bool, tag = "3")]
        pub exist_ok: bool,
    }
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct Rename {
        #[prost(string, tag = "1")]
        pub src: ::prost::alloc::string::String,
        #[prost(string, tag = "2")]
        pub dst: ::prost::alloc::string::String,
    }
    /// os.getenv(key, default) — `default` may be any Python value.
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Getenv {
        #[prost(string, tag = "1")]
        pub key: ::prost::alloc::string::String,
        #[prost(message, optional, tag = "2")]
        pub default: ::core::option::Option<crate::WireObject>,
    }
    /// datetime.now(tz) — the VM validates the argument to None-or-timezone
    /// before suspending, so the wire carries a typed TimeZone rather than an
    /// arbitrary MontyObject.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct DateTimeNow {
        /// Fixed-offset timezone for an aware result; absent for a naive one.
        #[prost(message, optional, tag = "1")]
        pub tz: ::core::option::Option<super::TimeZone>,
    }
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Call {
        /// ---- FS read / check / remove — the string is the virtual path -------
        ///
        /// Path.exists
        #[prost(string, tag = "2")]
        Exists(::prost::alloc::string::String),
        /// Path.is_file
        #[prost(string, tag = "3")]
        IsFile(::prost::alloc::string::String),
        /// Path.is_dir
        #[prost(string, tag = "4")]
        IsDir(::prost::alloc::string::String),
        /// Path.is_symlink
        #[prost(string, tag = "5")]
        IsSymlink(::prost::alloc::string::String),
        /// Path.read_text
        #[prost(string, tag = "6")]
        ReadText(::prost::alloc::string::String),
        /// Path.read_bytes
        #[prost(string, tag = "7")]
        ReadBytes(::prost::alloc::string::String),
        /// Path.stat
        #[prost(string, tag = "8")]
        Stat(::prost::alloc::string::String),
        /// Path.iterdir
        #[prost(string, tag = "9")]
        Iterdir(::prost::alloc::string::String),
        /// Path.resolve
        #[prost(string, tag = "10")]
        Resolve(::prost::alloc::string::String),
        /// Path.absolute
        #[prost(string, tag = "11")]
        Absolute(::prost::alloc::string::String),
        /// Path.unlink
        #[prost(string, tag = "12")]
        Unlink(::prost::alloc::string::String),
        /// Path.rmdir
        #[prost(string, tag = "13")]
        Rmdir(::prost::alloc::string::String),
        /// ---- FS write / mutate -----------------------------------------------
        ///
        /// Path.write_text (truncating)
        #[prost(message, tag = "14")]
        WriteText(TextWrite),
        /// Path.append_text
        #[prost(message, tag = "15")]
        AppendText(TextWrite),
        /// Path.write_bytes (truncating)
        #[prost(message, tag = "16")]
        WriteBytes(BytesWrite),
        /// Path.append_bytes
        #[prost(message, tag = "17")]
        AppendBytes(BytesWrite),
        #[prost(message, tag = "18")]
        Open(Open),
        #[prost(message, tag = "19")]
        Mkdir(Mkdir),
        #[prost(message, tag = "20")]
        Rename(Rename),
        /// ---- Non-FS ----------------------------------------------------------
        ///
        /// os.getenv
        #[prost(message, tag = "21")]
        Getenv(Getenv),
        /// the os.environ snapshot
        #[prost(message, tag = "22")]
        GetEnviron(super::Unit),
        /// date.today()
        #[prost(message, tag = "23")]
        DateToday(super::Unit),
        /// datetime.now(tz) — the timezone argument (absent for a naive result).
        #[prost(message, tag = "24")]
        DateTimeNow(DateTimeNow),
    }
}
/// Suspension: the sandbox read an undefined name — typically probing whether
/// the parent provides an external function. Answer with `ResumeNameLookup`.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct NameLookup {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
/// Suspension: every sandbox task is blocked on external futures previously
/// registered via `ExtFunctionResult.future`. Answer with `ResumeFutures`.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ResolveFutures {
    #[prost(uint32, repeated, tag = "1")]
    pub pending_call_ids: ::prost::alloc::vec::Vec<u32>,
}
/// Turn end: the snippet completed with this value. The session is ready for
/// the next `Feed`.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Complete {
    #[prost(message, optional, tag = "1")]
    pub value: ::core::option::Option<crate::WireObject>,
}
/// Turn end: the snippet (or request) failed with a Python exception. The
/// session survives — prior globals remain available to later feeds.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error {
    #[prost(message, optional, tag = "1")]
    pub exception: ::core::option::Option<RaisedException>,
}
/// Turn end: type checking rejected the fed snippet (only when the session
/// was created with type_check). The snippet was not executed; the session
/// survives.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TypingError {
    /// Diagnostics rendered in the session's `TypeCheckFormat`.
    #[prost(string, tag = "1")]
    pub diagnostics: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DumpResult {
    /// Opaque versioned snapshot; see `Dump`.
    #[prost(bytes = "vec", tag = "1")]
    pub state: ::prost::alloc::vec::Vec<u8>,
}
/// Generic acknowledgement for Configure / Load (idle) / Reset / Shutdown.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Ok {}
/// The child hit an unrecoverable error (frame desync, panic, unsupported
/// protocol version) and exits immediately after writing this. A child that
/// exits WITHOUT a FatalError crashed hard (segfault, abort, kill) — parents
/// must treat EOF as a crash.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FatalError {
    #[prost(string, tag = "1")]
    pub message: ::prost::alloc::string::String,
}
/// Turn end: the serving relay (monty-server, never a child) is shutting down
/// and did NOT run the request it is replying to. Sent only in reply to an
/// in-flight request, so the client is always reading when it arrives.
///
/// Every other server policy action (idle/session/turn timeout, capacity) is
/// just a dropped connection, which the client already classifies as a dead
/// worker — only shutdown needs a message, because only shutdown has state to
/// hand back.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ShutdownDump {
    /// Session state captured immediately before shutdown (same bytes as
    /// `DumpResult.state`), restorable into a fresh worker via `Load`. Absent
    /// when there was no session yet or the dump itself failed.
    #[prost(bytes = "vec", optional, tag = "1")]
    pub dump: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
}
/// Rendering of the typing diagnostics a `TypingError` carries; mirrors ty's
/// `DiagnosticFormat`.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TypeCheckFormat {
    /// Unset by an older parent — the child renders `FULL`.
    Unspecified = 0,
    Full = 1,
    Concise = 2,
    Azure = 3,
    Json = 4,
    JsonLines = 5,
    Rdjson = 6,
    Pylint = 7,
    Gitlab = 8,
    Github = 9,
}
impl TypeCheckFormat {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "TYPE_CHECK_FORMAT_UNSPECIFIED",
            Self::Full => "TYPE_CHECK_FORMAT_FULL",
            Self::Concise => "TYPE_CHECK_FORMAT_CONCISE",
            Self::Azure => "TYPE_CHECK_FORMAT_AZURE",
            Self::Json => "TYPE_CHECK_FORMAT_JSON",
            Self::JsonLines => "TYPE_CHECK_FORMAT_JSON_LINES",
            Self::Rdjson => "TYPE_CHECK_FORMAT_RDJSON",
            Self::Pylint => "TYPE_CHECK_FORMAT_PYLINT",
            Self::Gitlab => "TYPE_CHECK_FORMAT_GITLAB",
            Self::Github => "TYPE_CHECK_FORMAT_GITHUB",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TYPE_CHECK_FORMAT_UNSPECIFIED" => Some(Self::Unspecified),
            "TYPE_CHECK_FORMAT_FULL" => Some(Self::Full),
            "TYPE_CHECK_FORMAT_CONCISE" => Some(Self::Concise),
            "TYPE_CHECK_FORMAT_AZURE" => Some(Self::Azure),
            "TYPE_CHECK_FORMAT_JSON" => Some(Self::Json),
            "TYPE_CHECK_FORMAT_JSON_LINES" => Some(Self::JsonLines),
            "TYPE_CHECK_FORMAT_RDJSON" => Some(Self::Rdjson),
            "TYPE_CHECK_FORMAT_PYLINT" => Some(Self::Pylint),
            "TYPE_CHECK_FORMAT_GITLAB" => Some(Self::Gitlab),
            "TYPE_CHECK_FORMAT_GITHUB" => Some(Self::Github),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PrintStream {
    Unspecified = 0,
    Stdout = 1,
    Stderr = 2,
}
impl PrintStream {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "PRINT_STREAM_UNSPECIFIED",
            Self::Stdout => "PRINT_STREAM_STDOUT",
            Self::Stderr => "PRINT_STREAM_STDERR",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "PRINT_STREAM_UNSPECIFIED" => Some(Self::Unspecified),
            "PRINT_STREAM_STDOUT" => Some(Self::Stdout),
            "PRINT_STREAM_STDERR" => Some(Self::Stderr),
            _ => None,
        }
    }
}