kobako 0.19.0-aarch64-linux → 0.21.0-aarch64-linux
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.
- checksums.yaml +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +127 -0
- data/README.md +96 -44
- data/ROADMAP.md +1 -1
- data/crates/kobako-runtime/CHANGELOG.md +44 -0
- data/crates/kobako-runtime/README.md +1 -1
- data/crates/kobako-transport/CHANGELOG.md +31 -0
- data/crates/kobako-transport/README.md +43 -0
- data/crates/kobako-wasmtime/CHANGELOG.md +30 -0
- data/crates/kobako-wasmtime/README.md +1 -1
- data/data/kobako.wasm +0 -0
- data/lib/kobako/3.3/kobako.so +0 -0
- data/lib/kobako/3.4/kobako.so +0 -0
- data/lib/kobako/4.0/kobako.so +0 -0
- data/lib/kobako/catalog/extensions.rb +50 -43
- data/lib/kobako/catalog/handles.rb +7 -16
- data/lib/kobako/catalog/services.rb +24 -46
- data/lib/kobako/catalog/snippets.rb +16 -33
- data/lib/kobako/codec/decoder.rb +10 -13
- data/lib/kobako/codec/encoder.rb +7 -7
- data/lib/kobako/codec/error.rb +6 -6
- data/lib/kobako/codec/ext_types.rb +12 -72
- data/lib/kobako/codec/handle_walk.rb +6 -6
- data/lib/kobako/codec/state.rb +4 -56
- data/lib/kobako/codec/utils.rb +4 -4
- data/lib/kobako/codec.rb +11 -21
- data/lib/kobako/context.rb +208 -0
- data/lib/kobako/errors.rb +59 -16
- data/lib/kobako/execution.rb +52 -0
- data/lib/kobako/extension.rb +24 -10
- data/lib/kobako/outcome.rb +71 -128
- data/lib/kobako/payload/arguments.rb +59 -0
- data/lib/kobako/payload.rb +19 -0
- data/lib/kobako/pool.rb +1 -7
- data/lib/kobako/sandbox.rb +51 -191
- data/lib/kobako/sandbox_options.rb +24 -3
- data/lib/kobako/snippet/binary.rb +3 -4
- data/lib/kobako/snippet/source.rb +5 -6
- data/lib/kobako/snippet.rb +2 -2
- data/lib/kobako/transport/call.rb +21 -0
- data/lib/kobako/transport/dispatcher.rb +94 -142
- data/lib/kobako/transport/error.rb +21 -5
- data/lib/kobako/transport/reflection.rb +82 -0
- data/lib/kobako/transport/run.rb +25 -33
- data/lib/kobako/transport/yielder.rb +27 -36
- data/lib/kobako/transport.rb +11 -8
- data/lib/kobako/unresolved.rb +17 -0
- data/lib/kobako/usage.rb +7 -7
- data/lib/kobako/version.rb +1 -1
- data/lib/kobako.rb +1 -0
- data/release-please-config.json +47 -2
- data/sig/kobako/catalog/extensions.rbs +4 -6
- data/sig/kobako/catalog/handles.rbs +0 -2
- data/sig/kobako/catalog/services.rbs +4 -4
- data/sig/kobako/catalog/snippets.rbs +4 -2
- data/sig/kobako/codec/error.rbs +4 -4
- data/sig/kobako/codec/ext_types.rbs +0 -7
- data/sig/kobako/codec/state.rbs +0 -4
- data/sig/kobako/codec.rbs +4 -5
- data/sig/kobako/context.rbs +36 -0
- data/sig/kobako/errors.rbs +27 -6
- data/sig/kobako/execution.rbs +24 -0
- data/sig/kobako/extension.rbs +4 -2
- data/sig/kobako/outcome.rbs +12 -13
- data/sig/kobako/payload/arguments.rbs +26 -0
- data/sig/kobako/payload.rbs +4 -0
- data/sig/kobako/pool.rbs +0 -2
- data/sig/kobako/runtime.rbs +44 -14
- data/sig/kobako/sandbox.rbs +5 -24
- data/sig/kobako/sandbox_options.rbs +9 -2
- data/sig/kobako/snippet/binary.rbs +1 -1
- data/sig/kobako/snippet/source.rbs +1 -1
- data/sig/kobako/transport/call.rbs +21 -0
- data/sig/kobako/transport/dispatcher.rbs +9 -11
- data/sig/kobako/transport/error.rbs +11 -0
- data/sig/kobako/transport/reflection.rbs +15 -0
- data/sig/kobako/transport/run.rbs +1 -1
- data/sig/kobako/transport/yielder.rbs +2 -2
- data/sig/kobako/transport.rbs +8 -2
- data/sig/kobako/unresolved.rbs +4 -0
- metadata +18 -12
- data/lib/kobako/fault.rb +0 -38
- data/lib/kobako/outcome/panic.rb +0 -42
- data/lib/kobako/transport/request.rb +0 -76
- data/lib/kobako/transport/response.rb +0 -83
- data/lib/kobako/transport/yield.rb +0 -94
- data/sig/kobako/fault.rbs +0 -19
- data/sig/kobako/outcome/panic.rbs +0 -34
- data/sig/kobako/transport/request.rbs +0 -29
- data/sig/kobako/transport/response.rbs +0 -33
- data/sig/kobako/transport/yield.rbs +0 -34
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Kobako
|
|
2
|
+
module Payload
|
|
3
|
+
class Arguments < Data
|
|
4
|
+
attr_reader args: Array[Kobako::Codec::wire_value]
|
|
5
|
+
attr_reader kwargs: Hash[Symbol, Kobako::Codec::wire_value]
|
|
6
|
+
|
|
7
|
+
def self.new: (?args: Array[Kobako::Codec::wire_value], ?kwargs: Hash[Symbol, Kobako::Codec::wire_value]) -> Arguments
|
|
8
|
+
|
|
9
|
+
def self.decode: (String bytes) -> Arguments
|
|
10
|
+
|
|
11
|
+
def initialize: (?args: Array[Kobako::Codec::wire_value], ?kwargs: Hash[Symbol, Kobako::Codec::wire_value]) -> void
|
|
12
|
+
|
|
13
|
+
def encode: () -> String
|
|
14
|
+
|
|
15
|
+
def with: (?args: Array[Kobako::Codec::wire_value], ?kwargs: Hash[Symbol, Kobako::Codec::wire_value]) -> Arguments
|
|
16
|
+
|
|
17
|
+
def ==: (untyped other) -> bool
|
|
18
|
+
|
|
19
|
+
def hash: () -> Integer
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def validate_kwargs!: (Hash[untyped, untyped] kwargs) -> void
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/sig/kobako/pool.rbs
CHANGED
data/sig/kobako/runtime.rbs
CHANGED
|
@@ -6,28 +6,58 @@ module Kobako
|
|
|
6
6
|
String path,
|
|
7
7
|
(Float | Integer)? timeout_seconds,
|
|
8
8
|
Integer? memory_limit,
|
|
9
|
-
Integer?
|
|
10
|
-
Integer?
|
|
11
|
-
Symbol profile
|
|
9
|
+
Integer? stdout_limit,
|
|
10
|
+
Integer? stderr_limit,
|
|
11
|
+
Symbol profile,
|
|
12
|
+
Symbol gvl
|
|
12
13
|
) -> Runtime
|
|
13
14
|
|
|
14
|
-
def
|
|
15
|
+
def eval: (
|
|
16
|
+
Kobako::Transport::dispatch_proc dispatch,
|
|
17
|
+
Array[String] paths,
|
|
18
|
+
String source,
|
|
19
|
+
Array[Kobako::Catalog::Snippets::tuple] snippets
|
|
20
|
+
) -> Kobako::Runtime::Snapshot
|
|
21
|
+
|
|
22
|
+
def run: (
|
|
23
|
+
Kobako::Transport::dispatch_proc dispatch,
|
|
24
|
+
Array[String] paths,
|
|
25
|
+
Array[Kobako::Catalog::Snippets::tuple] snippets,
|
|
26
|
+
String entrypoint,
|
|
27
|
+
String payload
|
|
28
|
+
) -> Kobako::Runtime::Snapshot
|
|
15
29
|
|
|
16
|
-
def
|
|
30
|
+
def profile: () -> Symbol
|
|
17
31
|
|
|
18
|
-
|
|
32
|
+
# Frame-scoped guest re-entry handle the ext hands the dispatch Proc as
|
|
33
|
+
# its last argument — the production conformer of
|
|
34
|
+
# +Kobako::Transport::_GuestYielder+, answering the Yield Reply already
|
|
35
|
+
# split off the core envelope.
|
|
36
|
+
class GuestYielder
|
|
37
|
+
def call: (String args_bytes) -> [Symbol, String, String?]
|
|
38
|
+
end
|
|
19
39
|
|
|
20
|
-
|
|
40
|
+
# One invocation's result — the whole Snapshot the driver produced.
|
|
41
|
+
class Snapshot
|
|
42
|
+
def outcome: () -> [Symbol, String, Kobako::Outcome::panic_fields?]
|
|
21
43
|
|
|
22
|
-
|
|
44
|
+
def trapped?: () -> bool
|
|
23
45
|
|
|
24
|
-
|
|
46
|
+
def trap_kind: () -> Symbol?
|
|
25
47
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def
|
|
48
|
+
def trap_message: () -> String?
|
|
49
|
+
|
|
50
|
+
def wall_time: () -> Float
|
|
51
|
+
|
|
52
|
+
def memory_peak: () -> Integer
|
|
53
|
+
|
|
54
|
+
def stdout: () -> String
|
|
55
|
+
|
|
56
|
+
def stdout_truncated?: () -> bool
|
|
57
|
+
|
|
58
|
+
def stderr: () -> String
|
|
59
|
+
|
|
60
|
+
def stderr_truncated?: () -> bool
|
|
31
61
|
end
|
|
32
62
|
end
|
|
33
63
|
end
|
data/sig/kobako/sandbox.rbs
CHANGED
|
@@ -11,6 +11,7 @@ module Kobako
|
|
|
11
11
|
def stdout_limit: () -> Integer?
|
|
12
12
|
def stderr_limit: () -> Integer?
|
|
13
13
|
def profile: () -> Symbol
|
|
14
|
+
def gvl: () -> Symbol
|
|
14
15
|
|
|
15
16
|
# Every keyword beyond wasm_path forwards verbatim to
|
|
16
17
|
# SandboxOptions.new (the four caps + the profile floor).
|
|
@@ -19,43 +20,23 @@ module Kobako
|
|
|
19
20
|
**untyped options
|
|
20
21
|
) -> void
|
|
21
22
|
|
|
22
|
-
def
|
|
23
|
-
|
|
24
|
-
def stderr: () -> String
|
|
25
|
-
|
|
26
|
-
def stdout_truncated?: () -> bool
|
|
27
|
-
|
|
28
|
-
def stderr_truncated?: () -> bool
|
|
29
|
-
|
|
30
|
-
attr_reader usage: Kobako::Usage
|
|
31
|
-
|
|
32
|
-
def bind: (Symbol | String path, untyped object) -> Kobako::Sandbox
|
|
23
|
+
def bind: (Symbol | String path, ?untyped object) -> Kobako::Sandbox
|
|
33
24
|
|
|
34
25
|
def install: (*untyped extensions) -> Kobako::Sandbox
|
|
35
26
|
|
|
36
27
|
def preload: (code: String, name: Symbol | String) -> Kobako::Sandbox
|
|
37
28
|
| (binary: String) -> Kobako::Sandbox
|
|
38
29
|
|
|
39
|
-
def run: (Symbol | String target, *untyped args, **untyped kwargs) ->
|
|
30
|
+
def run: (Symbol | String target, *untyped args, **untyped kwargs) ?{ (Kobako::Context) -> void } -> Kobako::Execution
|
|
40
31
|
|
|
41
|
-
def eval: (String code) ->
|
|
42
|
-
|
|
43
|
-
def reset_invocation_state!: () -> void
|
|
32
|
+
def eval: (String code) ?{ (Kobako::Context) -> void } -> Kobako::Execution
|
|
44
33
|
|
|
45
34
|
private
|
|
46
35
|
|
|
47
36
|
def build_runtime!: () -> Kobako::Runtime
|
|
48
37
|
|
|
49
|
-
def
|
|
38
|
+
def new_invocation: () -> Kobako::Context
|
|
50
39
|
|
|
51
40
|
def begin_invocation!: () -> void
|
|
52
|
-
|
|
53
|
-
def read_usage!: () -> void
|
|
54
|
-
|
|
55
|
-
def read_captures!: () -> void
|
|
56
|
-
|
|
57
|
-
def trap_class_for: (Kobako::TrapError err) -> singleton(Kobako::TrapError)
|
|
58
|
-
|
|
59
|
-
def invoke!: (Symbol verb) { () -> String } -> untyped
|
|
60
41
|
end
|
|
61
42
|
end
|
|
@@ -5,19 +5,23 @@ module Kobako
|
|
|
5
5
|
DEFAULT_OUTPUT_LIMIT: Integer
|
|
6
6
|
DEFAULT_PROFILE: Symbol
|
|
7
7
|
PROFILES: Array[Symbol]
|
|
8
|
+
GVL_MODES: Array[Symbol]
|
|
9
|
+
DEFAULT_GVL: Symbol
|
|
8
10
|
|
|
9
11
|
attr_reader timeout: Float?
|
|
10
12
|
attr_reader memory_limit: Integer?
|
|
11
13
|
attr_reader stdout_limit: Integer?
|
|
12
14
|
attr_reader stderr_limit: Integer?
|
|
13
15
|
attr_reader profile: Symbol
|
|
16
|
+
attr_reader gvl: Symbol
|
|
14
17
|
|
|
15
18
|
def self.new: (
|
|
16
19
|
?timeout: (Float | Integer)?,
|
|
17
20
|
?memory_limit: Integer?,
|
|
18
21
|
?stdout_limit: Integer?,
|
|
19
22
|
?stderr_limit: Integer?,
|
|
20
|
-
?profile: Symbol
|
|
23
|
+
?profile: Symbol,
|
|
24
|
+
?gvl: Symbol
|
|
21
25
|
) -> SandboxOptions
|
|
22
26
|
|
|
23
27
|
def initialize: (
|
|
@@ -25,7 +29,8 @@ module Kobako
|
|
|
25
29
|
?memory_limit: Integer?,
|
|
26
30
|
?stdout_limit: Integer?,
|
|
27
31
|
?stderr_limit: Integer?,
|
|
28
|
-
?profile: Symbol
|
|
32
|
+
?profile: Symbol,
|
|
33
|
+
?gvl: Symbol
|
|
29
34
|
) -> void
|
|
30
35
|
|
|
31
36
|
def enforce_floor!: (Symbol declared) -> void
|
|
@@ -39,5 +44,7 @@ module Kobako
|
|
|
39
44
|
def normalize_output_limit: (Integer? limit, String name) -> Integer?
|
|
40
45
|
|
|
41
46
|
def normalize_profile: (untyped profile) -> Symbol
|
|
47
|
+
|
|
48
|
+
def normalize_gvl: (untyped gvl) -> Symbol
|
|
42
49
|
end
|
|
43
50
|
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Kobako
|
|
2
|
+
module Transport
|
|
3
|
+
class Call < Data
|
|
4
|
+
attr_reader target: String | Integer
|
|
5
|
+
attr_reader method_name: String
|
|
6
|
+
attr_reader block_given: bool
|
|
7
|
+
attr_reader payload: String
|
|
8
|
+
|
|
9
|
+
def self.new: (target: String | Integer, method_name: String, block_given: bool, payload: String) -> Call
|
|
10
|
+
| (String | Integer, String, bool, String) -> Call
|
|
11
|
+
|
|
12
|
+
def initialize: (target: String | Integer, method_name: String, block_given: bool, payload: String) -> void
|
|
13
|
+
|
|
14
|
+
def with: (?target: String | Integer, ?method_name: String, ?block_given: bool, ?payload: String) -> Call
|
|
15
|
+
|
|
16
|
+
def ==: (untyped other) -> bool
|
|
17
|
+
|
|
18
|
+
def hash: () -> Integer
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -6,29 +6,27 @@ module Kobako
|
|
|
6
6
|
|
|
7
7
|
BREAK_THROW: Symbol
|
|
8
8
|
|
|
9
|
-
META_OWNERS: Array[Module]
|
|
10
9
|
|
|
11
|
-
GADGET_OWNERS: Array[Module]
|
|
12
10
|
|
|
13
|
-
CALLABLE_ALLOW: Array[Symbol]
|
|
14
11
|
|
|
15
|
-
def self?.dispatch: (
|
|
12
|
+
def self?.dispatch: (Kobako::Transport::Call call, Kobako::Transport::_ServiceRegistry resolver, Kobako::Codec::_HandleTable handler, Kobako::Transport::_GuestYielder yield_to_guest) -> [bool, String, String?]
|
|
16
13
|
|
|
17
|
-
def self?.
|
|
14
|
+
def self?.run: (Kobako::Transport::Call call, Kobako::Transport::_ServiceRegistry resolver, Kobako::Codec::_HandleTable handler, Kobako::Transport::Yielder? yielder) -> untyped
|
|
18
15
|
|
|
19
|
-
def self?.
|
|
16
|
+
def self?.resolve_call_args: (Kobako::Payload::Arguments arguments, Kobako::Codec::_HandleTable handler, bool carried_handle) -> [Array[untyped], Hash[Symbol, untyped]]
|
|
17
|
+
|
|
18
|
+
def self?.caught_fault: (StandardError error) -> [String, String]
|
|
20
19
|
|
|
21
20
|
def self?.invoke: (untyped target, String method, Array[untyped] args, Hash[Symbol, untyped] kwargs, ?Kobako::Transport::Yielder? yielder) -> untyped
|
|
22
21
|
|
|
23
|
-
def self?.
|
|
22
|
+
def self?.reject_unreachable!: (untyped target, Symbol name) -> void
|
|
24
23
|
|
|
25
|
-
def self?.reject_unexposed!: (untyped target, Symbol name) -> void
|
|
26
24
|
|
|
27
25
|
def self?.resolve_arg: (untyped value, Kobako::Codec::_HandleTable handler) -> untyped
|
|
28
26
|
|
|
29
|
-
def self?.resolve_target: (String |
|
|
27
|
+
def self?.resolve_target: (String | Integer target, Kobako::Transport::_ServiceRegistry resolver, Kobako::Codec::_HandleTable handler) -> untyped
|
|
30
28
|
|
|
31
|
-
def self?.resolve_path: (String path, Kobako::Transport::_ServiceRegistry
|
|
29
|
+
def self?.resolve_path: (String path, Kobako::Transport::_ServiceRegistry resolver) -> untyped
|
|
32
30
|
|
|
33
31
|
def self?.require_live_object!: (Integer id, Kobako::Codec::_HandleTable handler) -> untyped
|
|
34
32
|
|
|
@@ -36,7 +34,7 @@ module Kobako
|
|
|
36
34
|
|
|
37
35
|
def self?.wrap_as_handle: (untyped value, Kobako::Codec::_HandleTable handler) -> Kobako::Handle
|
|
38
36
|
|
|
39
|
-
def self?.
|
|
37
|
+
def self?.fault: (String type, String message) -> [String, String]
|
|
40
38
|
end
|
|
41
39
|
end
|
|
42
40
|
end
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
module Kobako
|
|
2
2
|
module Transport
|
|
3
3
|
class Error < Kobako::SandboxError
|
|
4
|
+
@diagnostic: String?
|
|
5
|
+
|
|
6
|
+
def initialize: (
|
|
7
|
+
String message,
|
|
8
|
+
?diagnostic: String?,
|
|
9
|
+
?origin: String?,
|
|
10
|
+
?klass: String?,
|
|
11
|
+
?backtrace_lines: Array[String]?
|
|
12
|
+
) -> void
|
|
13
|
+
|
|
14
|
+
def detailed_message: (?highlight: bool, **untyped) -> String
|
|
4
15
|
end
|
|
5
16
|
end
|
|
6
17
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Kobako
|
|
2
|
+
module Transport
|
|
3
|
+
module Reflection
|
|
4
|
+
META_OWNERS: Array[Module]
|
|
5
|
+
GADGET_OWNERS: Array[Module]
|
|
6
|
+
CALLABLE_ALLOW: Array[Symbol]
|
|
7
|
+
|
|
8
|
+
def self?.refusal: (untyped target, Symbol name) -> String?
|
|
9
|
+
|
|
10
|
+
def self?.ambient_refusal: (untyped target, Symbol name) -> String?
|
|
11
|
+
|
|
12
|
+
def self?.narrowing_refusal: (untyped target, Symbol name) -> String?
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -11,7 +11,7 @@ module Kobako
|
|
|
11
11
|
|
|
12
12
|
def initialize: (entrypoint: Symbol | String, ?args: Array[untyped], ?kwargs: Hash[untyped, untyped]) -> void
|
|
13
13
|
|
|
14
|
-
def
|
|
14
|
+
def payload: (Kobako::Codec::_HandleTable handler) -> String
|
|
15
15
|
|
|
16
16
|
private
|
|
17
17
|
|
|
@@ -16,9 +16,9 @@ module Kobako
|
|
|
16
16
|
|
|
17
17
|
private
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def decode_body: (String body) -> [untyped, bool]
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def restore: (untyped value, bool carried_handle) -> untyped
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
data/sig/kobako/transport.rbs
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
module Kobako
|
|
2
2
|
module Transport
|
|
3
3
|
# The guest re-entry callable a dispatch hands to a Yielder: invoked
|
|
4
|
-
# with the encoded yield args, it returns the encoded
|
|
4
|
+
# with the encoded yield args, it returns the encoded Yield Reply.
|
|
5
5
|
# The ext's Kobako::Runtime::GuestYielder is the production conformer;
|
|
6
6
|
# modelled structurally so the Transport layer needs no upward
|
|
7
7
|
# dependency on Runtime.
|
|
8
8
|
interface _GuestYielder
|
|
9
|
-
def call: (String) -> String
|
|
9
|
+
def call: (String) -> [Symbol, String, String?]
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
# The per-invocation dispatch Proc, taking the routing fields the native
|
|
13
|
+
# side already decoded off the core envelope and answering the arm and
|
|
14
|
+
# body it puts on the Reply. Named here so the producer (Context) and the
|
|
15
|
+
# consumer (Runtime) cannot declare it differently.
|
|
16
|
+
type dispatch_proc = ^(String | Integer, String, bool, String, _GuestYielder) -> [bool, String, String?]
|
|
17
|
+
|
|
12
18
|
# The Service registry a dispatch resolves constant-path targets
|
|
13
19
|
# against. The Sandbox's Kobako::Catalog::Services is the
|
|
14
20
|
# production conformer; modelled structurally so the Transport
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kobako
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.21.0
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Aotokitsuruya
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: msgpack
|
|
@@ -41,6 +41,8 @@ files:
|
|
|
41
41
|
- SECURITY.md
|
|
42
42
|
- crates/kobako-runtime/CHANGELOG.md
|
|
43
43
|
- crates/kobako-runtime/README.md
|
|
44
|
+
- crates/kobako-transport/CHANGELOG.md
|
|
45
|
+
- crates/kobako-transport/README.md
|
|
44
46
|
- crates/kobako-wasmtime/CHANGELOG.md
|
|
45
47
|
- crates/kobako-wasmtime/README.md
|
|
46
48
|
- data/kobako.wasm
|
|
@@ -62,12 +64,14 @@ files:
|
|
|
62
64
|
- lib/kobako/codec/handle_walk.rb
|
|
63
65
|
- lib/kobako/codec/state.rb
|
|
64
66
|
- lib/kobako/codec/utils.rb
|
|
67
|
+
- lib/kobako/context.rb
|
|
65
68
|
- lib/kobako/errors.rb
|
|
69
|
+
- lib/kobako/execution.rb
|
|
66
70
|
- lib/kobako/extension.rb
|
|
67
|
-
- lib/kobako/fault.rb
|
|
68
71
|
- lib/kobako/handle.rb
|
|
69
72
|
- lib/kobako/outcome.rb
|
|
70
|
-
- lib/kobako/
|
|
73
|
+
- lib/kobako/payload.rb
|
|
74
|
+
- lib/kobako/payload/arguments.rb
|
|
71
75
|
- lib/kobako/pool.rb
|
|
72
76
|
- lib/kobako/runtime.rb
|
|
73
77
|
- lib/kobako/sandbox.rb
|
|
@@ -76,13 +80,13 @@ files:
|
|
|
76
80
|
- lib/kobako/snippet/binary.rb
|
|
77
81
|
- lib/kobako/snippet/source.rb
|
|
78
82
|
- lib/kobako/transport.rb
|
|
83
|
+
- lib/kobako/transport/call.rb
|
|
79
84
|
- lib/kobako/transport/dispatcher.rb
|
|
80
85
|
- lib/kobako/transport/error.rb
|
|
81
|
-
- lib/kobako/transport/
|
|
82
|
-
- lib/kobako/transport/response.rb
|
|
86
|
+
- lib/kobako/transport/reflection.rb
|
|
83
87
|
- lib/kobako/transport/run.rb
|
|
84
|
-
- lib/kobako/transport/yield.rb
|
|
85
88
|
- lib/kobako/transport/yielder.rb
|
|
89
|
+
- lib/kobako/unresolved.rb
|
|
86
90
|
- lib/kobako/usage.rb
|
|
87
91
|
- lib/kobako/version.rb
|
|
88
92
|
- release-please-config.json
|
|
@@ -102,12 +106,14 @@ files:
|
|
|
102
106
|
- sig/kobako/codec/handle_walk.rbs
|
|
103
107
|
- sig/kobako/codec/state.rbs
|
|
104
108
|
- sig/kobako/codec/utils.rbs
|
|
109
|
+
- sig/kobako/context.rbs
|
|
105
110
|
- sig/kobako/errors.rbs
|
|
111
|
+
- sig/kobako/execution.rbs
|
|
106
112
|
- sig/kobako/extension.rbs
|
|
107
|
-
- sig/kobako/fault.rbs
|
|
108
113
|
- sig/kobako/handle.rbs
|
|
109
114
|
- sig/kobako/outcome.rbs
|
|
110
|
-
- sig/kobako/
|
|
115
|
+
- sig/kobako/payload.rbs
|
|
116
|
+
- sig/kobako/payload/arguments.rbs
|
|
111
117
|
- sig/kobako/pool.rbs
|
|
112
118
|
- sig/kobako/runtime.rbs
|
|
113
119
|
- sig/kobako/sandbox.rbs
|
|
@@ -116,13 +122,13 @@ files:
|
|
|
116
122
|
- sig/kobako/snippet/binary.rbs
|
|
117
123
|
- sig/kobako/snippet/source.rbs
|
|
118
124
|
- sig/kobako/transport.rbs
|
|
125
|
+
- sig/kobako/transport/call.rbs
|
|
119
126
|
- sig/kobako/transport/dispatcher.rbs
|
|
120
127
|
- sig/kobako/transport/error.rbs
|
|
121
|
-
- sig/kobako/transport/
|
|
122
|
-
- sig/kobako/transport/response.rbs
|
|
128
|
+
- sig/kobako/transport/reflection.rbs
|
|
123
129
|
- sig/kobako/transport/run.rbs
|
|
124
|
-
- sig/kobako/transport/yield.rbs
|
|
125
130
|
- sig/kobako/transport/yielder.rbs
|
|
131
|
+
- sig/kobako/unresolved.rbs
|
|
126
132
|
- sig/kobako/usage.rbs
|
|
127
133
|
- sig/kobako/version.rbs
|
|
128
134
|
homepage: https://github.com/elct9620/kobako
|
data/lib/kobako/fault.rb
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kobako
|
|
4
|
-
# Wire-level value object for an ext-0x02 Exception envelope.
|
|
5
|
-
#
|
|
6
|
-
# Top-level shared wire primitive: like +Kobako::Handle+ (ext 0x01),
|
|
7
|
-
# +Fault+ is a MessagePack ext-type leaf registered by
|
|
8
|
-
# +Kobako::Codec::ExtTypes+ and rides nested inside other envelopes (a
|
|
9
|
-
# +Kobako::Transport::Response+ error payload, or another Fault's
|
|
10
|
-
# +details+). It lives at the kobako root rather than under +Transport+
|
|
11
|
-
# because the Codec layer must register it, and Codec must not depend
|
|
12
|
-
# upward on Transport.
|
|
13
|
-
#
|
|
14
|
-
# SPEC pins the payload
|
|
15
|
-
# ({docs/wire-codec.md}[link:../../docs/wire-codec.md] § Ext Types
|
|
16
|
-
# → ext 0x02) to a msgpack map with exactly three keys:
|
|
17
|
-
# * "type" — one of "runtime", "argument", "undefined"
|
|
18
|
-
# * "message" — human-readable string
|
|
19
|
-
# * "details" — any wire-legal value, or nil when absent
|
|
20
|
-
#
|
|
21
|
-
# This object holds the *encoded* form. Reifying the corresponding Ruby
|
|
22
|
-
# exception class (RuntimeError, ArgumentError, Kobako::ServiceError, ...)
|
|
23
|
-
# is the responsibility of the dispatch layer, not the codec.
|
|
24
|
-
#
|
|
25
|
-
# Built on the +class X < Data.define(...)+ subclass form (the
|
|
26
|
-
# Steep-friendly shape — see +lib/kobako/outcome/panic.rb+).
|
|
27
|
-
class Fault < Data.define(:type, :message, :details)
|
|
28
|
-
VALID_TYPES = %w[runtime argument undefined].freeze
|
|
29
|
-
|
|
30
|
-
def initialize(type:, message:, details: nil)
|
|
31
|
-
raise ArgumentError, "type must be String" unless type.is_a?(String)
|
|
32
|
-
raise ArgumentError, "message must be String" unless message.is_a?(String)
|
|
33
|
-
raise ArgumentError, "type=#{type.inspect} not one of #{VALID_TYPES.inspect}" unless VALID_TYPES.include?(type)
|
|
34
|
-
|
|
35
|
-
super
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
data/lib/kobako/outcome/panic.rb
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Kobako
|
|
4
|
-
module Outcome
|
|
5
|
-
# Wire-contract Outcome Envelope → Panic envelope ({docs/wire-contract.md
|
|
6
|
-
# Outcome Envelope}[link:../../../docs/wire-contract.md]). Wire-shaped failure record
|
|
7
|
-
# carried in the OUTCOME_BUFFER when the guest run terminates with
|
|
8
|
-
# an uncaught top-level exception.
|
|
9
|
-
#
|
|
10
|
-
# This is the **wire data**, not a raisable Ruby exception. The
|
|
11
|
-
# mapping from Panic to a three-layer Ruby exception (TrapError /
|
|
12
|
-
# SandboxError / ServiceError) happens at +Kobako::Outcome.decode+
|
|
13
|
-
# via +build_panic_error+ — callers never raise +Panic+ directly.
|
|
14
|
-
#
|
|
15
|
-
# The five fields mirror SPEC: +origin+ ("sandbox" / "service"),
|
|
16
|
-
# +klass+ (the guest-side exception class name as a String),
|
|
17
|
-
# +message+, +backtrace+ (Array of String), +details+ (any
|
|
18
|
-
# wire-legal value, nil when absent). Required-field validation is
|
|
19
|
-
# enforced at construction; the +ORIGIN_SANDBOX+ / +ORIGIN_SERVICE+
|
|
20
|
-
# constants pin the two SPEC-defined origin values.
|
|
21
|
-
#
|
|
22
|
-
# Built on the +class X < Data.define(...)+ subclass form so the
|
|
23
|
-
# class body is fully Steep-visible; ruby/rbs upstream documents
|
|
24
|
-
# this as the Steep-friendly shape and the +Style/DataInheritance+
|
|
25
|
-
# cop is disabled on that basis (see +.rubocop.yml+).
|
|
26
|
-
class Panic < Data.define(:origin, :klass, :message, :backtrace, :details)
|
|
27
|
-
ORIGIN_SANDBOX = "sandbox"
|
|
28
|
-
ORIGIN_SERVICE = "service"
|
|
29
|
-
|
|
30
|
-
def initialize(origin:, klass:, message:, backtrace: [], details: nil)
|
|
31
|
-
raise ArgumentError, "Panic origin must be String" unless origin.is_a?(String)
|
|
32
|
-
raise ArgumentError, "Panic class must be String" unless klass.is_a?(String)
|
|
33
|
-
raise ArgumentError, "Panic message must be String" unless message.is_a?(String)
|
|
34
|
-
unless backtrace.is_a?(Array) && backtrace.all?(String)
|
|
35
|
-
raise ArgumentError, "Panic backtrace must be Array of String"
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
super
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "../handle"
|
|
4
|
-
require_relative "../codec"
|
|
5
|
-
|
|
6
|
-
module Kobako
|
|
7
|
-
# See lib/kobako/transport.rb for the umbrella module doc; this file
|
|
8
|
-
# owns the Request value object and its +#encode+ / +.decode+ codec.
|
|
9
|
-
module Transport
|
|
10
|
-
# Value object for a single guest-initiated Transport Request
|
|
11
|
-
# ({docs/wire-codec.md Envelope Encoding → Request}[link:../../../docs/wire-codec.md]).
|
|
12
|
-
#
|
|
13
|
-
# 5-element msgpack array:
|
|
14
|
-
# +[target, method_name, args, kwargs, block_given]+. +target+ is
|
|
15
|
-
# either a +String+ (+"MyService::KV"+, e.g. +"MyService::KV"+)
|
|
16
|
-
# or a Handle. SPEC pins +kwargs+ map keys to ext 0x00 Symbol;
|
|
17
|
-
# enforced at construction so the Value Object is the single source of
|
|
18
|
-
# truth. +block_given+ is a Boolean signalling whether the guest call
|
|
19
|
-
# site supplied a block; the block body itself never crosses the
|
|
20
|
-
# wire.
|
|
21
|
-
#
|
|
22
|
-
# Built on the +class X < Data.define(...)+ subclass form so the
|
|
23
|
-
# class body is fully Steep-visible; see +lib/kobako/outcome/panic.rb+
|
|
24
|
-
# for the rationale.
|
|
25
|
-
class Request < Data.define(:target, :method_name, :args, :kwargs, :block_given)
|
|
26
|
-
def initialize(target:, method_name:, args: [], kwargs: {}, block_given: false)
|
|
27
|
-
unless target.is_a?(String) || target.is_a?(Kobako::Handle)
|
|
28
|
-
raise ArgumentError, "Request target must be String or Kobako::Handle, got #{target.class}"
|
|
29
|
-
end
|
|
30
|
-
raise ArgumentError, "Request method_name must be String" unless method_name.is_a?(String)
|
|
31
|
-
raise ArgumentError, "Request args must be Array" unless args.is_a?(Array)
|
|
32
|
-
unless block_given.is_a?(TrueClass) || block_given.is_a?(FalseClass)
|
|
33
|
-
raise ArgumentError, "Request block_given must be Boolean, got #{block_given.class}"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
validate_kwargs!(kwargs)
|
|
37
|
-
super
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Encode this Request to msgpack bytes. The Value Object's own
|
|
41
|
-
# invariants are the contract; this method does not re-check the shape.
|
|
42
|
-
def encode
|
|
43
|
-
Codec::Encoder.encode([target, method_name, args, kwargs, block_given])
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Decode +bytes+ into a Request. Raises +Codec::InvalidType+ when the
|
|
47
|
-
# envelope is not the expected 5-element msgpack array, when any
|
|
48
|
-
# position carries an ext 0x02 Fault envelope (a Request is a payload
|
|
49
|
-
# position; the Response fault field is the envelope's only home), or
|
|
50
|
-
# when the Value Object's construction invariants reject the decoded
|
|
51
|
-
# fields.
|
|
52
|
-
def self.decode(bytes)
|
|
53
|
-
Codec.forbid_faults do
|
|
54
|
-
Codec::Decoder.decode(bytes) do |arr|
|
|
55
|
-
unless arr.is_a?(Array) && arr.length == 5
|
|
56
|
-
raise Codec::InvalidType, "Request envelope is malformed (expected a 5-element array)"
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
target, method_name, args, kwargs, block_given = arr
|
|
60
|
-
new(target: target, method_name: method_name, args: args, kwargs: kwargs, block_given: block_given)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
private
|
|
66
|
-
|
|
67
|
-
def validate_kwargs!(kwargs)
|
|
68
|
-
raise ArgumentError, "Request kwargs must be Hash" unless kwargs.is_a?(Hash)
|
|
69
|
-
|
|
70
|
-
kwargs.each_key do |k|
|
|
71
|
-
raise ArgumentError, "Request kwargs keys must be Symbol, got #{k.class}" unless k.is_a?(Symbol)
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|