kobako 0.20.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 +107 -0
- data/README.md +96 -44
- data/ROADMAP.md +1 -1
- data/crates/kobako-runtime/CHANGELOG.md +37 -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 +23 -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/services.rb +13 -21
- data/lib/kobako/catalog/snippets.rb +16 -34
- 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 +23 -17
- data/lib/kobako/errors.rb +32 -11
- 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/sandbox.rb +12 -13
- data/lib/kobako/sandbox_options.rb +1 -1
- 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 +86 -135
- 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/usage.rb +1 -1
- data/lib/kobako/version.rb +1 -1
- data/release-please-config.json +47 -2
- data/sig/kobako/catalog/services.rbs +1 -1
- data/sig/kobako/catalog/snippets.rbs +4 -4
- 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 +4 -4
- data/sig/kobako/errors.rbs +15 -3
- 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 +15 -13
- 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 +8 -10
- 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
- metadata +12 -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
data/lib/kobako/transport/run.rb
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "../handle"
|
|
4
4
|
require_relative "../codec"
|
|
5
|
+
require_relative "../payload"
|
|
5
6
|
|
|
6
7
|
module Kobako
|
|
7
8
|
# See lib/kobako/transport.rb for the umbrella module doc; this file
|
|
8
|
-
# owns
|
|
9
|
-
#
|
|
9
|
+
# owns +Run+, the host-side value object for one +#run+ request — the
|
|
10
|
+
# native side frames it into the envelope +__kobako_run+ consumes.
|
|
10
11
|
module Transport
|
|
11
12
|
# Host-side value object for a single +Sandbox#run+ invocation
|
|
12
13
|
# ({docs/wire-codec.md Invocation channels}[link:../../../docs/wire-codec.md]).
|
|
@@ -16,23 +17,20 @@ module Kobako
|
|
|
16
17
|
# arguments. Host pre-flight (entrypoint type / name pattern, forged
|
|
17
18
|
# Handle, kwargs-key type) is enforced at construction so the Value
|
|
18
19
|
# Object is the single source of truth — anything that passes
|
|
19
|
-
# +Run.new+ is safe to
|
|
20
|
+
# +Run.new+ is safe to ship to the guest.
|
|
20
21
|
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
# +
|
|
24
|
-
#
|
|
25
|
-
# +kwargs+ leaf through it as a +Kobako::Handle+ — the
|
|
26
|
-
# symmetric counterpart of the guest→host wrap path in the
|
|
27
|
-
# dispatcher. A +Kobako::Handle+ that arrives **already
|
|
22
|
+
# +#payload+ takes the invocation's +Catalog::Handles+ and routes any
|
|
23
|
+
# non-wire-representable +args+ / +kwargs+ leaf through it as a
|
|
24
|
+
# +Kobako::Handle+ — the symmetric counterpart of the guest→host wrap
|
|
25
|
+
# path in the dispatcher. A +Kobako::Handle+ that arrives **already
|
|
28
26
|
# constructed** in the caller's +args+ / +kwargs+ is rejected at
|
|
29
|
-
# construction: legitimate Handles only enter Host App code
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
27
|
+
# construction: legitimate Handles only enter Host App code through
|
|
28
|
+
# error fields, so a Handle reaching the call site is by definition
|
|
29
|
+
# smuggled in. +Runtime#run+ frames that payload with the entrypoint
|
|
30
|
+
# into the Run envelope the +__kobako_run+ command buffer carries.
|
|
33
31
|
#
|
|
34
32
|
# Built on the +class X < Data.define(...)+ subclass form (the
|
|
35
|
-
# Steep-friendly shape — see
|
|
33
|
+
# Steep-friendly shape — see +.rubocop.yml+ for the rationale).
|
|
36
34
|
class Run < Data.define(:entrypoint, :args, :kwargs)
|
|
37
35
|
# Ruby constant-name pattern enforced on the +entrypoint+ Symbol.
|
|
38
36
|
# Parallel to
|
|
@@ -48,25 +46,19 @@ module Kobako
|
|
|
48
46
|
super
|
|
49
47
|
end
|
|
50
48
|
|
|
51
|
-
# Encode this Run
|
|
52
|
-
#
|
|
53
|
-
# ({docs/wire-codec.md Invocation channels}[link:../../../docs/wire-codec.md]).
|
|
49
|
+
# Encode this Run's arguments as the codec payload the Run
|
|
50
|
+
# envelope carries — +Runtime#run+ frames it with the entrypoint.
|
|
54
51
|
# Walks +args+ / +kwargs+ through Codec::HandleWalk.deep_wrap so
|
|
55
52
|
# any non-wire-representable leaf is allocated into +handler+ and
|
|
56
|
-
# replaced with a +Kobako::Handle+; the
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
Codec::Encoder.encode(
|
|
66
|
-
"entrypoint" => entrypoint,
|
|
67
|
-
"args" => Codec::HandleWalk.deep_wrap(args, handler),
|
|
68
|
-
"kwargs" => Codec::HandleWalk.deep_wrap(kwargs, handler)
|
|
69
|
-
)
|
|
53
|
+
# replaced with a +Kobako::Handle+; the +handler+ argument is the
|
|
54
|
+
# invocation's table, sharing the same allocator the guest→host
|
|
55
|
+
# return path uses. A wrapped leaf rides as ext 0x01 in its
|
|
56
|
+
# original position (docs/wire/payload-msgpack.md § ext 0x01).
|
|
57
|
+
def payload(handler)
|
|
58
|
+
Payload::Arguments.new(
|
|
59
|
+
args: Codec::HandleWalk.deep_wrap(args, handler),
|
|
60
|
+
kwargs: Codec::HandleWalk.deep_wrap(kwargs, handler)
|
|
61
|
+
).encode
|
|
70
62
|
end
|
|
71
63
|
|
|
72
64
|
private
|
|
@@ -95,7 +87,7 @@ module Kobako
|
|
|
95
87
|
# Handle objects only through raised error fields, so a Handle
|
|
96
88
|
# reaching +args+ is a forged or smuggled token. Non-wire-
|
|
97
89
|
# representable arguments that are not Handles are handled by
|
|
98
|
-
# auto-wrap inside +#
|
|
90
|
+
# auto-wrap inside +#payload+ — the reject path is reserved
|
|
99
91
|
# for Handle objects specifically.
|
|
100
92
|
def validate_args!(args)
|
|
101
93
|
raise ArgumentError, "arguments must be an Array" unless args.is_a?(Array)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../codec"
|
|
4
|
-
require_relative "yield"
|
|
5
4
|
|
|
6
5
|
module Kobako
|
|
7
6
|
# See lib/kobako/transport.rb for the umbrella module doc; this file
|
|
@@ -15,24 +14,25 @@ module Kobako
|
|
|
15
14
|
# Service method observes it as an ordinary Ruby Proc through
|
|
16
15
|
# #to_proc; +yield val+ / +block.call(val)+ invokes #yield, which
|
|
17
16
|
# serialises the positional args, re-enters the guest via the injected
|
|
18
|
-
# +yield_to_guest+ lambda, and reifies the
|
|
17
|
+
# +yield_to_guest+ lambda, and reifies the Yield Reply into Ruby
|
|
19
18
|
# control flow:
|
|
20
19
|
#
|
|
21
|
-
# *
|
|
22
|
-
# *
|
|
23
|
-
#
|
|
24
|
-
# *
|
|
25
|
-
#
|
|
20
|
+
# * ok — return the decoded value to +yield+'s caller
|
|
21
|
+
# * break — +throw break_tag, value+ so the Dispatcher's +catch+
|
|
22
|
+
# frame unwinds the Service method
|
|
23
|
+
# * error — raise the guest's class and message at the Service's
|
|
24
|
+
# yield site
|
|
26
25
|
#
|
|
27
26
|
# The Dispatcher calls #invalidate! from its +ensure+ block once
|
|
28
27
|
# dispatch completes; any later call to a stashed Yielder then raises
|
|
29
28
|
# +LocalJumpError+ — the observable shape of an escaped Yielder.
|
|
30
29
|
class Yielder
|
|
31
|
-
# +yield_to_guest+ is
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
# +tag
|
|
30
|
+
# +yield_to_guest+ is the ext's per-dispatch
|
|
31
|
+
# +Kobako::Runtime::GuestYielder+, which #yield invokes to re-enter
|
|
32
|
+
# the guest: it takes the argument payload and answers the reply
|
|
33
|
+
# already split into +[arm, body, class]+. +break_tag+ is the
|
|
34
|
+
# +catch+ throw tag the Dispatcher matches against to unwind the
|
|
35
|
+
# Service on a break. +handler+ is the invocation's +Kobako::Catalog::Handles+,
|
|
36
36
|
# used to restore a Capability Handle in the block's ok value back to
|
|
37
37
|
# its host object before it reaches the Service +yield+ site.
|
|
38
38
|
def initialize(yield_to_guest, break_tag, handler)
|
|
@@ -42,7 +42,7 @@ module Kobako
|
|
|
42
42
|
@active = true
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
# Re-enter the guest with +args+ and reify the
|
|
45
|
+
# Re-enter the guest with +args+ and reify the Yield Reply into
|
|
46
46
|
# Ruby control flow. Raises +LocalJumpError+ if called after
|
|
47
47
|
# #invalidate!. The ok value is consumed by the host Service
|
|
48
48
|
# method, so a Capability Handle in it is restored to its host object.
|
|
@@ -52,18 +52,13 @@ module Kobako
|
|
|
52
52
|
def yield(*args)
|
|
53
53
|
raise LocalJumpError, "guest block invoked after host dispatch frame returned" unless @active
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
#
|
|
57
|
-
# this call site. The tracking bracket below opens only around the
|
|
58
|
-
# decode: the guest re-entry may run nested dispatches whose own
|
|
59
|
-
# brackets would otherwise pollute the signal.
|
|
60
|
-
bytes = @yield_to_guest.call(Kobako::Codec.forbid_faults { Kobako::Codec::Encoder.encode(args) })
|
|
61
|
-
response, carried_handle = Kobako::Codec.track_handles { Kobako::Transport::Yield.decode(bytes) }
|
|
62
|
-
return restore(response.value, carried_handle) if response.ok?
|
|
55
|
+
arm, body, klass = @yield_to_guest.call(Kobako::Codec::Encoder.encode(args))
|
|
56
|
+
raise "#{klass}: #{body}" if arm == :error
|
|
63
57
|
|
|
64
|
-
|
|
58
|
+
value, carried_handle = decode_body(body)
|
|
59
|
+
throw @break_tag, value if arm == :break
|
|
65
60
|
|
|
66
|
-
|
|
61
|
+
restore(value, carried_handle)
|
|
67
62
|
end
|
|
68
63
|
|
|
69
64
|
# The Proc the Dispatcher passes as +&block+, binding #yield so a
|
|
@@ -81,6 +76,15 @@ module Kobako
|
|
|
81
76
|
|
|
82
77
|
private
|
|
83
78
|
|
|
79
|
+
# Decode a value-carrying arm's payload, answering the value and
|
|
80
|
+
# whether the decode carried a Capability Handle. The tracking
|
|
81
|
+
# bracket opens only around this decode: the guest re-entry may run
|
|
82
|
+
# nested dispatches whose own brackets would otherwise pollute the
|
|
83
|
+
# signal.
|
|
84
|
+
def decode_body(body)
|
|
85
|
+
Kobako::Codec.track_handles { Kobako::Codec::Decoder.decode(body) }
|
|
86
|
+
end
|
|
87
|
+
|
|
84
88
|
# Restore any Capability Handle in a block's ok value to its host
|
|
85
89
|
# object via the injected +Catalog::Handles+. Only the
|
|
86
90
|
# ok path calls this — host code consumes the ok value, whereas a
|
|
@@ -92,19 +96,6 @@ module Kobako
|
|
|
92
96
|
|
|
93
97
|
Kobako::Codec::HandleWalk.deep_restore(value, @handler)
|
|
94
98
|
end
|
|
95
|
-
|
|
96
|
-
# Reify a +YieldResponse+ tag 0x04 payload into a +RuntimeError+ the
|
|
97
|
-
# Service method observes at its +yield+ site. The +{class, message,
|
|
98
|
-
# backtrace}+ shape mirrors the +Kobako::Transport::Yield+ tag 0x04
|
|
99
|
-
# payload; +default+ provides a fallback when the payload is not a
|
|
100
|
-
# Hash.
|
|
101
|
-
def yield_failure(payload, default:)
|
|
102
|
-
return RuntimeError.new(default) unless payload.is_a?(Hash)
|
|
103
|
-
|
|
104
|
-
klass = payload["class"] || "RuntimeError"
|
|
105
|
-
message = payload["message"] || default
|
|
106
|
-
RuntimeError.new("#{klass}: #{message}")
|
|
107
|
-
end
|
|
108
99
|
end
|
|
109
100
|
end
|
|
110
101
|
end
|
data/lib/kobako/transport.rb
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative "transport/
|
|
4
|
-
require_relative "transport/response"
|
|
3
|
+
require_relative "transport/call"
|
|
5
4
|
require_relative "transport/run"
|
|
6
|
-
require_relative "transport/yield"
|
|
7
5
|
require_relative "transport/yielder"
|
|
8
6
|
require_relative "transport/error"
|
|
7
|
+
require_relative "transport/reflection"
|
|
9
8
|
require_relative "transport/dispatcher"
|
|
10
9
|
|
|
11
10
|
module Kobako
|
|
12
|
-
# Kobako::Transport — host↔guest message transport namespace.
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
# +
|
|
16
|
-
#
|
|
11
|
+
# Kobako::Transport — host↔guest message transport namespace. Houses the
|
|
12
|
+
# host side of one Call/Reply exchange: the call value objects +Call+
|
|
13
|
+
# (guest→host, as the native side decoded it) and +Run+ (host→guest), the
|
|
14
|
+
# +Dispatcher+ that answers a routed Call, the +Yielder+ that re-enters
|
|
15
|
+
# the guest for a block, the +Reflection+ floor a dispatch must clear, and
|
|
16
|
+
# +Error+ for a wire violation the host detects. Each invocation's
|
|
17
|
+
# +Context+ composes them into the dispatch +Proc+ it passes +Runtime+ for
|
|
18
|
+
# that run.
|
|
19
|
+
#
|
|
17
20
|
# "RPC" was deliberately not chosen — it implies a cross-process boundary that
|
|
18
21
|
# kobako does not have, since host and guest share one OS thread and
|
|
19
22
|
# one wasm linear memory. See
|
data/lib/kobako/usage.rb
CHANGED
|
@@ -27,7 +27,7 @@ module Kobako
|
|
|
27
27
|
# invocation consumed.
|
|
28
28
|
#
|
|
29
29
|
# Built on the +class X < Data.define(...)+ subclass form (the
|
|
30
|
-
# Steep-friendly shape — see
|
|
30
|
+
# Steep-friendly shape — see +.rubocop.yml+ for the rationale).
|
|
31
31
|
class Usage < Data.define(:wall_time, :memory_peak)
|
|
32
32
|
# Pre-run sentinel. A fresh +Kobako::Context+ holds it until its guest
|
|
33
33
|
# runs, so an Execution's +#usage+ is never +nil+.
|
data/lib/kobako/version.rb
CHANGED
data/release-please-config.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
{
|
|
23
23
|
"type": "toml",
|
|
24
24
|
"path": "/wasm/kobako-core/Cargo.toml",
|
|
25
|
-
"jsonpath": "$.dependencies['kobako-
|
|
25
|
+
"jsonpath": "$.dependencies['kobako-transport'].version"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
"type": "generic",
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
"path": "/wasm/Cargo.lock",
|
|
40
40
|
"jsonpath": "$.package[?(@.name=='kobako-mruby')].version"
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
"type": "toml",
|
|
44
|
+
"path": "/wasm/kobako-mruby/Cargo.toml",
|
|
45
|
+
"jsonpath": "$.dependencies['kobako-transport'].version"
|
|
46
|
+
},
|
|
42
47
|
{
|
|
43
48
|
"type": "toml",
|
|
44
49
|
"path": "/wasm/kobako-mruby/Cargo.toml",
|
|
@@ -115,6 +120,31 @@
|
|
|
115
120
|
}
|
|
116
121
|
]
|
|
117
122
|
},
|
|
123
|
+
"crates/kobako-transport": {
|
|
124
|
+
"component": "kobako-transport",
|
|
125
|
+
"release-type": "rust",
|
|
126
|
+
"extra-files": [
|
|
127
|
+
{
|
|
128
|
+
"type": "toml",
|
|
129
|
+
"path": "/Cargo.lock",
|
|
130
|
+
"jsonpath": "$.package[?(@.name=='kobako-transport')].version"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "toml",
|
|
134
|
+
"path": "/crates/Cargo.lock",
|
|
135
|
+
"jsonpath": "$.package[?(@.name=='kobako-transport')].version"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "toml",
|
|
139
|
+
"path": "/wasm/Cargo.lock",
|
|
140
|
+
"jsonpath": "$.package[?(@.name=='kobako-transport')].version"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "generic",
|
|
144
|
+
"path": "/crates/kobako-transport/README.md"
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
118
148
|
"crates/kobako-codec": {
|
|
119
149
|
"component": "kobako-codec",
|
|
120
150
|
"release-type": "rust",
|
|
@@ -149,6 +179,11 @@
|
|
|
149
179
|
"path": "/Cargo.lock",
|
|
150
180
|
"jsonpath": "$.package[?(@.name=='kobako-runtime')].version"
|
|
151
181
|
},
|
|
182
|
+
{
|
|
183
|
+
"type": "toml",
|
|
184
|
+
"path": "/crates/kobako-runtime/Cargo.toml",
|
|
185
|
+
"jsonpath": "$.dependencies['kobako-transport'].version"
|
|
186
|
+
},
|
|
152
187
|
{
|
|
153
188
|
"type": "generic",
|
|
154
189
|
"path": "/crates/kobako-runtime/README.md"
|
|
@@ -174,6 +209,11 @@
|
|
|
174
209
|
"path": "/crates/kobako-wasmtime/Cargo.toml",
|
|
175
210
|
"jsonpath": "$.dependencies['kobako-runtime'].version"
|
|
176
211
|
},
|
|
212
|
+
{
|
|
213
|
+
"type": "toml",
|
|
214
|
+
"path": "/crates/kobako-wasmtime/Cargo.toml",
|
|
215
|
+
"jsonpath": "$.dependencies['kobako-transport'].version"
|
|
216
|
+
},
|
|
177
217
|
{
|
|
178
218
|
"type": "generic",
|
|
179
219
|
"path": "/crates/kobako-wasmtime/README.md"
|
|
@@ -189,6 +229,11 @@
|
|
|
189
229
|
"path": "/crates/Cargo.lock",
|
|
190
230
|
"jsonpath": "$.package[?(@.name=='kobako')].version"
|
|
191
231
|
},
|
|
232
|
+
{
|
|
233
|
+
"type": "toml",
|
|
234
|
+
"path": "/crates/kobako/Cargo.toml",
|
|
235
|
+
"jsonpath": "$.dependencies['kobako-transport'].version"
|
|
236
|
+
},
|
|
192
237
|
{
|
|
193
238
|
"type": "toml",
|
|
194
239
|
"path": "/crates/kobako/Cargo.toml",
|
|
@@ -215,7 +260,7 @@
|
|
|
215
260
|
{
|
|
216
261
|
"type": "linked-versions",
|
|
217
262
|
"groupName": "kobako crates",
|
|
218
|
-
"components": ["kobako-codec", "kobako-core", "kobako-mruby", "kobako-io", "kobako-json", "kobako-regexp", "kobako-baker", "kobako-runtime", "kobako-wasmtime", "kobako-sdk"]
|
|
263
|
+
"components": ["kobako-transport", "kobako-codec", "kobako-core", "kobako-mruby", "kobako-io", "kobako-json", "kobako-regexp", "kobako-baker", "kobako-runtime", "kobako-wasmtime", "kobako-sdk"]
|
|
219
264
|
}
|
|
220
265
|
],
|
|
221
266
|
"extra-files": [
|
|
@@ -5,13 +5,13 @@ module Kobako
|
|
|
5
5
|
|
|
6
6
|
type entry = Kobako::Snippet::Source | Kobako::Snippet::Binary
|
|
7
7
|
|
|
8
|
+
type tuple = [Symbol, String?, String]
|
|
9
|
+
|
|
8
10
|
def initialize: () -> void
|
|
9
11
|
|
|
10
12
|
def register: (?code: String?, ?name: (Symbol | String)?, ?binary: String?) -> (Symbol | nil)
|
|
11
13
|
|
|
12
|
-
def
|
|
13
|
-
|
|
14
|
-
def seal!: () -> self
|
|
14
|
+
def entries: () -> Array[tuple]
|
|
15
15
|
|
|
16
16
|
private
|
|
17
17
|
|
|
@@ -21,7 +21,7 @@ module Kobako
|
|
|
21
21
|
|
|
22
22
|
def register_binary!: (String bytes) -> nil
|
|
23
23
|
|
|
24
|
-
def
|
|
24
|
+
def entry_tuple: (entry) -> tuple
|
|
25
25
|
|
|
26
26
|
def normalize_name: (Symbol | String name) -> Symbol
|
|
27
27
|
end
|
data/sig/kobako/codec/error.rbs
CHANGED
|
@@ -3,16 +3,16 @@ module Kobako
|
|
|
3
3
|
class Error < StandardError
|
|
4
4
|
end
|
|
5
5
|
|
|
6
|
-
class
|
|
6
|
+
class TruncatedInputError < Error
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class InvalidTypeError < Error
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class InvalidEncodingError < Error
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
class
|
|
15
|
+
class UnsupportedTypeError < Error
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -3,7 +3,6 @@ module Kobako
|
|
|
3
3
|
module ExtTypes
|
|
4
4
|
EXT_SYMBOL: Integer
|
|
5
5
|
EXT_HANDLE: Integer
|
|
6
|
-
EXT_ERRENV: Integer
|
|
7
6
|
UNREPRESENTABLE_GUARD_ID: Integer
|
|
8
7
|
|
|
9
8
|
def self?.build_factory: () -> MessagePack::Factory
|
|
@@ -16,16 +15,10 @@ module Kobako
|
|
|
16
15
|
|
|
17
16
|
def self?.unpack_handle: (String payload, State state) -> Kobako::Handle
|
|
18
17
|
|
|
19
|
-
def self?.pack_fault: (Kobako::Fault fault, State state) -> String
|
|
20
|
-
|
|
21
|
-
def self?.unpack_fault: (String payload, State state) -> Kobako::Fault
|
|
22
|
-
|
|
23
18
|
def self?.register_symbol: (MessagePack::Factory factory) -> void
|
|
24
19
|
|
|
25
20
|
def self?.register_handle: (MessagePack::Factory factory) -> void
|
|
26
21
|
|
|
27
|
-
def self?.register_fault: (MessagePack::Factory factory) -> void
|
|
28
|
-
|
|
29
22
|
def self?.register_unrepresentable: (MessagePack::Factory factory) -> void
|
|
30
23
|
end
|
|
31
24
|
|
data/sig/kobako/codec/state.rbs
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
module Kobako
|
|
2
2
|
module Codec
|
|
3
3
|
class State
|
|
4
|
-
MAX_EXT_DEPTH: Integer
|
|
5
4
|
STATE_KEY: Symbol
|
|
6
5
|
|
|
7
6
|
def self.current: () -> State
|
|
8
7
|
|
|
9
8
|
def track_handles: [T] { () -> T } -> [T, bool]
|
|
10
9
|
def record_handle!: () -> void
|
|
11
|
-
def forbid_faults: [T] { () -> T } -> T
|
|
12
|
-
def faults_forbidden?: () -> bool
|
|
13
|
-
def within_ext_frame: [T] (singleton(Kobako::Codec::Error) over_limit) { () -> T } -> T
|
|
14
10
|
|
|
15
11
|
private
|
|
16
12
|
|
data/sig/kobako/codec.rbs
CHANGED
|
@@ -2,18 +2,17 @@ module Kobako
|
|
|
2
2
|
module Codec
|
|
3
3
|
MAX_NESTING_DEPTH: Integer
|
|
4
4
|
|
|
5
|
-
# A value in the closed wire type set (docs/wire-
|
|
6
|
-
# Mapping): the scalar leaves, a Capability Handle, and Array / Hash
|
|
5
|
+
# A value in the closed wire type set (docs/wire/payload-msgpack.md
|
|
6
|
+
# § Type Mapping): the scalar leaves, a Capability Handle, and Array / Hash
|
|
7
7
|
# containers of the same. The by-value payloads that cross the wire —
|
|
8
|
-
# dispatch arguments and success values — inhabit this type; a Fault
|
|
9
|
-
#
|
|
8
|
+
# dispatch arguments and success values — inhabit this type; a Fault is
|
|
9
|
+
# an envelope shape, not a wire_value.
|
|
10
10
|
type wire_value = nil | bool | Integer | Float | String | Symbol
|
|
11
11
|
| Kobako::Handle
|
|
12
12
|
| Array[wire_value]
|
|
13
13
|
| Hash[wire_value, wire_value]
|
|
14
14
|
|
|
15
15
|
def self.track_handles: [T] { () -> T } -> [T, bool]
|
|
16
|
-
def self.forbid_faults: [T] { () -> T } -> T
|
|
17
16
|
|
|
18
17
|
# The Handle allocator/resolver a wire walk works against: alloc
|
|
19
18
|
# registers a non-wire-representable object and returns its Handle,
|
data/sig/kobako/context.rbs
CHANGED
|
@@ -13,13 +13,13 @@ module Kobako
|
|
|
13
13
|
|
|
14
14
|
def eval: (String code) ?{ (Kobako::Context) -> void } -> Kobako::Execution
|
|
15
15
|
|
|
16
|
-
def run: (Kobako::Transport::Run
|
|
16
|
+
def run: (Kobako::Transport::Run request) ?{ (Kobako::Context) -> void } -> Kobako::Execution
|
|
17
17
|
|
|
18
18
|
private
|
|
19
19
|
|
|
20
20
|
def collect_overrides: () { (Kobako::Context) -> void } -> void
|
|
21
21
|
|
|
22
|
-
def dispatch_handler: () ->
|
|
22
|
+
def dispatch_handler: () -> Kobako::Transport::dispatch_proc
|
|
23
23
|
|
|
24
24
|
def populate_observability!: (Kobako::Runtime::Snapshot snapshot) -> void
|
|
25
25
|
|
|
@@ -29,8 +29,8 @@ module Kobako
|
|
|
29
29
|
|
|
30
30
|
def build_execution: (untyped value, failed: bool) -> Kobako::Execution
|
|
31
31
|
|
|
32
|
-
def settle_outcome: (Kobako::Runtime::Snapshot snapshot, Symbol verb) -> Kobako::Execution
|
|
32
|
+
def settle_outcome: (Kobako::Runtime::Snapshot snapshot, Symbol verb, Symbol? entrypoint) -> Kobako::Execution
|
|
33
33
|
|
|
34
|
-
def invoke!: (Symbol verb) { () -> Kobako::Runtime::Snapshot } -> Kobako::Execution
|
|
34
|
+
def invoke!: (Symbol verb, ?entrypoint: Symbol?) { () -> Kobako::Runtime::Snapshot } -> Kobako::Execution
|
|
35
35
|
end
|
|
36
36
|
end
|
data/sig/kobako/errors.rbs
CHANGED
|
@@ -28,14 +28,12 @@ module Kobako
|
|
|
28
28
|
attr_reader origin: String?
|
|
29
29
|
attr_reader klass: String?
|
|
30
30
|
attr_reader backtrace_lines: Array[String]?
|
|
31
|
-
attr_reader details: untyped
|
|
32
31
|
|
|
33
32
|
def initialize: (
|
|
34
33
|
String message,
|
|
35
34
|
?origin: String?,
|
|
36
35
|
?klass: String?,
|
|
37
|
-
?backtrace_lines: Array[String]
|
|
38
|
-
?details: untyped
|
|
36
|
+
?backtrace_lines: Array[String]?
|
|
39
37
|
) -> void
|
|
40
38
|
end
|
|
41
39
|
|
|
@@ -55,6 +53,20 @@ module Kobako
|
|
|
55
53
|
class BytecodeError < SandboxError
|
|
56
54
|
end
|
|
57
55
|
|
|
56
|
+
class UndefinedEntrypointError < SandboxError
|
|
57
|
+
attr_reader name: Symbol?
|
|
58
|
+
attr_reader available: Array[Symbol]
|
|
59
|
+
|
|
60
|
+
def initialize: (
|
|
61
|
+
String message,
|
|
62
|
+
?name: Symbol?,
|
|
63
|
+
?available: Array[Symbol],
|
|
64
|
+
?origin: String?,
|
|
65
|
+
?klass: String?,
|
|
66
|
+
?backtrace_lines: Array[String]?
|
|
67
|
+
) -> void
|
|
68
|
+
end
|
|
69
|
+
|
|
58
70
|
class PoolTimeoutError < Error
|
|
59
71
|
end
|
|
60
72
|
end
|
data/sig/kobako/outcome.rbs
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
module Kobako
|
|
2
2
|
module Outcome
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
ORIGIN_SANDBOX: String
|
|
4
|
+
ORIGIN_SERVICE: String
|
|
5
|
+
SUBCLASSES: Hash[String, singleton(SandboxError)]
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
type panic_fields = [String, String, String, Array[String], Array[String]]
|
|
7
8
|
|
|
8
|
-
def self?.
|
|
9
|
+
def self?.reify: (Symbol kind, String payload, panic_fields? panic, ?entrypoint: Symbol?) -> Kobako::Codec::wire_value
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
# Everything below is private_class_method at runtime; RBS cannot mark a
|
|
12
|
+
# `self?` method private, so the declarations stay visible to the checker.
|
|
13
|
+
def self?.panic_error: (panic_fields panic, Symbol? entrypoint) -> (SandboxError | ServiceError)
|
|
11
14
|
|
|
12
|
-
def self?.
|
|
15
|
+
def self?.error_class: (String origin, String klass) -> (singleton(SandboxError) | singleton(ServiceError))
|
|
13
16
|
|
|
14
|
-
def self?.
|
|
17
|
+
def self?.trap_error: (Symbol kind) -> TrapError
|
|
15
18
|
|
|
16
|
-
def self?.
|
|
19
|
+
def self?.decode_value: (String payload) -> Kobako::Codec::wire_value
|
|
17
20
|
|
|
18
|
-
def self?.
|
|
19
|
-
|
|
20
|
-
def self?.panic_target_class: (Panic panic) -> (singleton(SandboxError) | singleton(ServiceError))
|
|
21
|
-
|
|
22
|
-
def self?.build_transport_error: (String message, ?detail: String?) -> Transport::Error
|
|
21
|
+
def self?.wire_error: (String message, ?diagnostic: String?) -> Transport::Error
|
|
23
22
|
end
|
|
24
23
|
end
|
|
@@ -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
|