kobako 0.11.1-aarch64-linux → 0.11.2-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 +11 -0
- 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/handles.rb +4 -4
- data/lib/kobako/codec/handle_walk.rb +131 -0
- data/lib/kobako/codec/utils.rb +4 -117
- data/lib/kobako/codec.rb +1 -0
- data/lib/kobako/handle.rb +1 -1
- data/lib/kobako/outcome.rb +2 -10
- data/lib/kobako/sandbox.rb +1 -1
- data/lib/kobako/transport/dispatcher.rb +3 -7
- data/lib/kobako/transport/run.rb +4 -4
- data/lib/kobako/transport/yielder.rb +1 -1
- data/lib/kobako/version.rb +1 -1
- data/release-please-config.json +0 -1
- data/sig/kobako/codec/handle_walk.rbs +17 -0
- data/sig/kobako/codec/utils.rbs +0 -12
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 104440cb3054865ba62674f02fbd98a2cd27ce880c7e5b2154d1538266a7a6f7
|
|
4
|
+
data.tar.gz: 01b419c59550464a8297f83dbbada29aaca72c519b14025d73379927b3f8610d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c66e885004d7ffca47a61953c4169e5bc8cdc2584dac47297b00ebe4de0236bcad81bd746eab4759a0a8e53c4b5840e972adab3a46cce02e634dff1d13e1fb5c
|
|
7
|
+
data.tar.gz: 0f26851171d0ddc4b101ddca82e7536f751343da81344bc1eb60f285729b47dc05c842dc09d77953daab88b98aefdc45ca49bbde90065e3ae62d0c82b12e33c2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{".":"0.11.
|
|
1
|
+
{".":"0.11.2","wasm/kobako-core":"0.5.2","wasm/kobako":"0.5.2","wasm/kobako-io":"0.5.2","wasm/kobako-regexp":"0.5.2","wasm/kobako-baker":"0.5.2"}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.11.2](https://github.com/elct9620/kobako/compare/v0.11.1...v0.11.2) (2026-06-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **codec:** encode guest Handle args/kwargs as ext 0x01 ([bd58538](https://github.com/elct9620/kobako/commit/bd58538f4dbbf91a0927d15fd37f47abc761f8a6))
|
|
9
|
+
* **codec:** refuse out-of-range inbound integers instead of saturating ([f9e9184](https://github.com/elct9620/kobako/commit/f9e91845e0f28fecbb0867d8b70c871cd1feafea))
|
|
10
|
+
* **dispatch:** keep short method names intact across kwarg unpacking ([c6e4a6f](https://github.com/elct9620/kobako/commit/c6e4a6f268970c0c2d2851d3a23e3bec153dc56d))
|
|
11
|
+
* **release:** drop the group PR title pattern that breaks tagging ([d797350](https://github.com/elct9620/kobako/commit/d797350953c2de82df592d3c88e44155d3f076dc))
|
|
12
|
+
* **release:** scope publish triggers to each release's owning tag ([58508a1](https://github.com/elct9620/kobako/commit/58508a1e967799522b2674a989233d8619cabbc9))
|
|
13
|
+
|
|
3
14
|
## [0.11.1](https://github.com/elct9620/kobako/compare/v0.11.0...v0.11.1) (2026-06-14)
|
|
4
15
|
|
|
5
16
|
|
data/data/kobako.wasm
CHANGED
|
Binary file
|
data/lib/kobako/3.3/kobako.so
CHANGED
|
Binary file
|
data/lib/kobako/3.4/kobako.so
CHANGED
|
Binary file
|
data/lib/kobako/4.0/kobako.so
CHANGED
|
Binary file
|
|
@@ -43,9 +43,9 @@ module Kobako
|
|
|
43
43
|
# and the allocator share the same invariant.
|
|
44
44
|
#
|
|
45
45
|
# Returning a Handle (rather than a bare Integer id) keeps the
|
|
46
|
-
# allocator's output a domain entity
|
|
47
|
-
#
|
|
48
|
-
#
|
|
46
|
+
# allocator's output a domain entity. An id is the Handle's only
|
|
47
|
+
# content, so the same internal +Kobako::Handle.restore+ constructor
|
|
48
|
+
# serves both this allocator and the codec's wire-decode path.
|
|
49
49
|
def alloc(object)
|
|
50
50
|
reject_unwrappable!(object)
|
|
51
51
|
ensure_capacity!
|
|
@@ -72,7 +72,7 @@ module Kobako
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# Number of currently-bound entries. Used by tests of the Dispatcher
|
|
75
|
-
# and Codec::
|
|
75
|
+
# and Codec::HandleWalk#deep_wrap to observe whether each path allocates
|
|
76
76
|
# exactly the Handle entries it should — the +Handles+ table itself never
|
|
77
77
|
# consults its own size, but the surrounding code's allocation
|
|
78
78
|
# contract is part of the observable boundary.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../handle"
|
|
4
|
+
|
|
5
|
+
module Kobako
|
|
6
|
+
module Codec
|
|
7
|
+
# Substitutes Capability Handles into and out of a Ruby value tree at
|
|
8
|
+
# the host↔guest boundary. {deep_wrap} allocates a +Kobako::Handle+ for
|
|
9
|
+
# each non-wire-representable leaf on the host→guest +#run+ argument
|
|
10
|
+
# path; {deep_restore} resolves each wire-decoded Handle back to its
|
|
11
|
+
# host object on every guest→host value path — the +#eval+ / +#run+
|
|
12
|
+
# result and the yield-block result alike. {representable?} is the
|
|
13
|
+
# by-value codec-type predicate that decides which leaves {deep_wrap}
|
|
14
|
+
# must wrap: the closed 12-entry wire type set
|
|
15
|
+
# ({docs/wire-codec.md}[link:../../../docs/wire-codec.md] § Type
|
|
16
|
+
# Mapping).
|
|
17
|
+
#
|
|
18
|
+
# All helpers are pure except {deep_wrap}, whose only side effect is
|
|
19
|
+
# allocating new Handle ids into the supplied table.
|
|
20
|
+
module HandleWalk
|
|
21
|
+
module_function
|
|
22
|
+
|
|
23
|
+
# Inclusive Integer range the msgpack gem encodes without raising
|
|
24
|
+
# +RangeError+ at encode time — signed +int 64+ minimum through
|
|
25
|
+
# unsigned +uint 64+ maximum
|
|
26
|
+
# ({docs/wire-codec.md}[link:../../../docs/wire-codec.md] § Type
|
|
27
|
+
# Mapping #3, the +fixint+ / +int 8..64+ / +uint 8..64+ union).
|
|
28
|
+
# Anchored as a +Range+ so {primitive_type?} stays a single
|
|
29
|
+
# dispatch line. This is the codec's encode domain — not to
|
|
30
|
+
# be confused with the Handle id range, which lives on
|
|
31
|
+
# +Kobako::Handle+ as +MIN_ID+ / +MAX_ID+ (1..2^31 − 1) and
|
|
32
|
+
# represents a different concept entirely.
|
|
33
|
+
MSGPACK_INT_RANGE = (-(2**63)..((2**64) - 1))
|
|
34
|
+
|
|
35
|
+
# Codec-type predicate
|
|
36
|
+
# ({docs/wire-codec.md}[link:../../../docs/wire-codec.md] § Type
|
|
37
|
+
# Mapping). Returns +true+ when +value+ belongs to the closed
|
|
38
|
+
# 12-entry codec type set — +nil+, +TrueClass+, +FalseClass+,
|
|
39
|
+
# +Integer+ (in the +i64..u64+ value domain), +Float+, +String+,
|
|
40
|
+
# +Symbol+, +Kobako::Handle+, +Array+ whose every element is itself
|
|
41
|
+
# representable, or +Hash+ whose every key and value are
|
|
42
|
+
# representable. Integers outside the codec's signed-64 /
|
|
43
|
+
# unsigned-64 union are rejected so the predicate agrees with the
|
|
44
|
+
# msgpack gem's encode-time +RangeError+ behaviour the codec
|
|
45
|
+
# already surfaces as {UnsupportedType}.
|
|
46
|
+
def representable?(value)
|
|
47
|
+
primitive_type?(value) || container_representable?(value)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Deep-walk Array / Hash containers in +value+ and replace every
|
|
51
|
+
# leaf that fails {representable?} with a +Kobako::Handle+
|
|
52
|
+
# allocated from +handler+. The
|
|
53
|
+
# walk only descends through representable container shapes
|
|
54
|
+
# (Array, Hash) one structural level at a time; a non-representable
|
|
55
|
+
# leaf is wrapped as-is without inspecting its internal structure.
|
|
56
|
+
# An existing +Kobako::Handle+ is representable and passes through
|
|
57
|
+
# unchanged — auto-wrap never re-wraps a Handle.
|
|
58
|
+
#
|
|
59
|
+
# +value+ may be any Ruby value; +handler+ must respond to
|
|
60
|
+
# +#alloc(object) -> Kobako::Handle+ (a host-side
|
|
61
|
+
# +Kobako::Catalog::Handles+). Returns a structurally equivalent value
|
|
62
|
+
# whose leaves are either representable or +Kobako::Handle+
|
|
63
|
+
# tokens.
|
|
64
|
+
#
|
|
65
|
+
# The block bodies spell +HandleWalk.deep_wrap+ explicitly rather
|
|
66
|
+
# than the unqualified +deep_wrap+ because +module_function+ makes
|
|
67
|
+
# the instance copy of these helpers private; an implicit receiver
|
|
68
|
+
# inside a block would resolve against the enclosing +self+
|
|
69
|
+
# (still +HandleWalk+ at definition time, but the qualified form
|
|
70
|
+
# keeps the dispatch readable when the recursive call sits inside a
|
|
71
|
+
# Proc captured from elsewhere).
|
|
72
|
+
def deep_wrap(value, handler)
|
|
73
|
+
case value
|
|
74
|
+
when ::Array then value.map { |element| HandleWalk.deep_wrap(element, handler) }
|
|
75
|
+
when ::Hash then value.transform_values { |val| HandleWalk.deep_wrap(val, handler) }
|
|
76
|
+
else
|
|
77
|
+
representable?(value) ? value : handler.alloc(value)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Deep-walk Array / Hash containers in +value+ and replace every
|
|
82
|
+
# +Kobako::Handle+ leaf with the host-side object +handler+ resolves
|
|
83
|
+
# it to. The symmetric inverse of {deep_wrap}: that walk allocates objects
|
|
84
|
+
# into Handles on the host→guest argument path; this walk resolves
|
|
85
|
+
# Handles back to their objects on every guest→host value path — the
|
|
86
|
+
# +#eval+ / +#run+ result and the yield-block result alike. The walk
|
|
87
|
+
# descends through Array elements and Hash keys and values one
|
|
88
|
+
# structural level at a time; any non-Handle leaf passes through
|
|
89
|
+
# unchanged.
|
|
90
|
+
#
|
|
91
|
+
# +value+ is a decoded Ruby value (a Handle here is a wire-decoded
|
|
92
|
+
# +Kobako::Handle+, never a guest-forged one); +handler+ must
|
|
93
|
+
# respond to +#fetch(id) -> object+ (a host-side
|
|
94
|
+
# +Kobako::Catalog::Handles+). +handler.fetch+ raises
|
|
95
|
+
# +Kobako::SandboxError+ for an id with no live binding, the
|
|
96
|
+
# corrupted-runtime fallback.
|
|
97
|
+
def deep_restore(value, handler)
|
|
98
|
+
case value
|
|
99
|
+
when ::Array then value.map { |element| HandleWalk.deep_restore(element, handler) }
|
|
100
|
+
when ::Hash
|
|
101
|
+
value.to_h { |key, val| [HandleWalk.deep_restore(key, handler), HandleWalk.deep_restore(val, handler)] }
|
|
102
|
+
when Kobako::Handle then handler.fetch(value.id)
|
|
103
|
+
else value
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# The non-container branch of {representable?}: returns +true+ for
|
|
108
|
+
# the scalar leaves and an existing Handle. Not part of the
|
|
109
|
+
# public surface; reach for {representable?} instead.
|
|
110
|
+
def primitive_type?(value)
|
|
111
|
+
case value
|
|
112
|
+
when ::NilClass, ::TrueClass, ::FalseClass, ::Float, ::String, ::Symbol, Kobako::Handle then true
|
|
113
|
+
when ::Integer then MSGPACK_INT_RANGE.cover?(value)
|
|
114
|
+
else false
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# The container branch of {representable?}: recurses into Array
|
|
119
|
+
# elements and Hash key+value pairs through the public
|
|
120
|
+
# {representable?}. Not part of the public surface; reach for
|
|
121
|
+
# {representable?} instead.
|
|
122
|
+
def container_representable?(value)
|
|
123
|
+
case value
|
|
124
|
+
when ::Array then value.all? { |element| HandleWalk.representable?(element) }
|
|
125
|
+
when ::Hash then value.all? { |key, val| HandleWalk.representable?(key) && HandleWalk.representable?(val) }
|
|
126
|
+
else false
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
data/lib/kobako/codec/utils.rb
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "error"
|
|
4
|
-
require_relative "../handle"
|
|
5
4
|
|
|
6
5
|
module Kobako
|
|
7
6
|
module Codec
|
|
8
|
-
#
|
|
9
|
-
#
|
|
7
|
+
# Byte-boundary helpers shared by the host-side encoder and decoder.
|
|
8
|
+
# Two concerns live here:
|
|
10
9
|
#
|
|
11
10
|
# - UTF-8 assertion at the codec boundary
|
|
12
11
|
# ({docs/wire-codec.md}[link:../../../docs/wire-codec.md]
|
|
@@ -16,14 +15,9 @@ module Kobako
|
|
|
16
15
|
# - +ArgumentError+ translation at the codec boundary
|
|
17
16
|
# ({with_boundary}) so the public taxonomy stays
|
|
18
17
|
# {Kobako::Codec::Error}.
|
|
19
|
-
# - Representability predicate ({representable?}) and the symmetric
|
|
20
|
-
# host→guest +#run+ argument walk ({deep_wrap}) used by
|
|
21
|
-
# +Kobako::Transport::Run#encode+ to route non-representable leaves
|
|
22
|
-
# through the Sandbox's +Kobako::Catalog::Handles+.
|
|
23
18
|
#
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
# new Handle ids into the supplied table.
|
|
19
|
+
# Both helpers are pure — they only inspect inputs, never mutate them.
|
|
20
|
+
# The host↔guest Handle substitution walk lives in {HandleWalk}.
|
|
27
21
|
module Utils
|
|
28
22
|
module_function
|
|
29
23
|
|
|
@@ -53,113 +47,6 @@ module Kobako
|
|
|
53
47
|
rescue ::ArgumentError => e
|
|
54
48
|
raise InvalidType, e.message
|
|
55
49
|
end
|
|
56
|
-
|
|
57
|
-
# Inclusive Integer range the msgpack gem encodes without raising
|
|
58
|
-
# +RangeError+ at encode time — signed +int 64+ minimum through
|
|
59
|
-
# unsigned +uint 64+ maximum
|
|
60
|
-
# ({docs/wire-codec.md}[link:../../../docs/wire-codec.md] § Type
|
|
61
|
-
# Mapping #3, the +fixint+ / +int 8..64+ / +uint 8..64+ union).
|
|
62
|
-
# Anchored as a +Range+ so {primitive_type?} stays a single
|
|
63
|
-
# dispatch line. This is the codec's encode domain — not to
|
|
64
|
-
# be confused with the Handle id range, which lives on
|
|
65
|
-
# +Kobako::Handle+ as +MIN_ID+ / +MAX_ID+ (1..2^31 − 1) and
|
|
66
|
-
# represents a different concept entirely.
|
|
67
|
-
MSGPACK_INT_RANGE = (-(2**63)..((2**64) - 1))
|
|
68
|
-
|
|
69
|
-
# Codec-type predicate
|
|
70
|
-
# ({docs/wire-codec.md}[link:../../../docs/wire-codec.md] § Type
|
|
71
|
-
# Mapping). Returns +true+ when +value+ belongs to the closed
|
|
72
|
-
# 12-entry codec type set — +nil+, +TrueClass+, +FalseClass+,
|
|
73
|
-
# +Integer+ (in the +i64..u64+ value domain), +Float+, +String+,
|
|
74
|
-
# +Symbol+, +Kobako::Handle+, +Array+ whose every element is itself
|
|
75
|
-
# representable, or +Hash+ whose every key and value are
|
|
76
|
-
# representable. Integers outside the codec's signed-64 /
|
|
77
|
-
# unsigned-64 union are rejected so the predicate agrees with the
|
|
78
|
-
# msgpack gem's encode-time +RangeError+ behaviour the codec
|
|
79
|
-
# already surfaces as {UnsupportedType}.
|
|
80
|
-
def representable?(value)
|
|
81
|
-
primitive_type?(value) || container_representable?(value)
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
# Deep-walk Array / Hash containers in +value+ and replace every
|
|
85
|
-
# leaf that fails {representable?} with a +Kobako::Handle+
|
|
86
|
-
# allocated from +handler+. The
|
|
87
|
-
# walk only descends through representable container shapes
|
|
88
|
-
# (Array, Hash) one structural level at a time; a non-representable
|
|
89
|
-
# leaf is wrapped as-is without inspecting its internal structure.
|
|
90
|
-
# An existing +Kobako::Handle+ is representable and passes through
|
|
91
|
-
# unchanged — auto-wrap never re-wraps a Handle.
|
|
92
|
-
#
|
|
93
|
-
# +value+ may be any Ruby value; +handler+ must respond to
|
|
94
|
-
# +#alloc(object) -> Kobako::Handle+ (a host-side
|
|
95
|
-
# +Kobako::Catalog::Handles+). Returns a structurally equivalent value
|
|
96
|
-
# whose leaves are either representable or +Kobako::Handle+
|
|
97
|
-
# tokens.
|
|
98
|
-
#
|
|
99
|
-
# The block bodies spell +Utils.deep_wrap+ explicitly rather than
|
|
100
|
-
# the unqualified +deep_wrap+ because +module_function+ makes the
|
|
101
|
-
# instance copy of these helpers private; an implicit receiver
|
|
102
|
-
# inside a block would resolve against the enclosing +self+
|
|
103
|
-
# (still +Utils+ at definition time, but the qualified form keeps
|
|
104
|
-
# the dispatch readable when the recursive call sits inside a
|
|
105
|
-
# Proc captured from elsewhere).
|
|
106
|
-
def deep_wrap(value, handler)
|
|
107
|
-
case value
|
|
108
|
-
when ::Array then value.map { |element| Utils.deep_wrap(element, handler) }
|
|
109
|
-
when ::Hash then value.transform_values { |val| Utils.deep_wrap(val, handler) }
|
|
110
|
-
else
|
|
111
|
-
representable?(value) ? value : handler.alloc(value)
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# Deep-walk Array / Hash containers in +value+ and replace every
|
|
116
|
-
# +Kobako::Handle+ leaf with the host-side object +handler+ resolves
|
|
117
|
-
# it to. The symmetric inverse of {deep_wrap}: that walk allocates objects
|
|
118
|
-
# into Handles on the host→guest argument path; this walk resolves
|
|
119
|
-
# Handles back to their objects on every guest→host value path — the
|
|
120
|
-
# +#eval+ / +#run+ result and the yield-block result alike. The walk
|
|
121
|
-
# descends through Array elements and Hash keys and values one
|
|
122
|
-
# structural level at a time; any non-Handle leaf passes through
|
|
123
|
-
# unchanged.
|
|
124
|
-
#
|
|
125
|
-
# +value+ is a decoded Ruby value (a Handle here is a wire-decoded
|
|
126
|
-
# +Kobako::Handle+, never a guest-forged one); +handler+ must
|
|
127
|
-
# respond to +#fetch(id) -> object+ (a host-side
|
|
128
|
-
# +Kobako::Catalog::Handles+). +handler.fetch+ raises
|
|
129
|
-
# +Kobako::SandboxError+ for an id with no live binding, the
|
|
130
|
-
# corrupted-runtime fallback.
|
|
131
|
-
def deep_restore(value, handler)
|
|
132
|
-
case value
|
|
133
|
-
when ::Array then value.map { |element| Utils.deep_restore(element, handler) }
|
|
134
|
-
when ::Hash
|
|
135
|
-
value.to_h { |key, val| [Utils.deep_restore(key, handler), Utils.deep_restore(val, handler)] }
|
|
136
|
-
when Kobako::Handle then handler.fetch(value.id)
|
|
137
|
-
else value
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
# The non-container branch of {representable?}: returns +true+ for
|
|
142
|
-
# the scalar leaves and an existing Handle. Not part of the
|
|
143
|
-
# public surface; reach for {representable?} instead.
|
|
144
|
-
def primitive_type?(value)
|
|
145
|
-
case value
|
|
146
|
-
when ::NilClass, ::TrueClass, ::FalseClass, ::Float, ::String, ::Symbol, Kobako::Handle then true
|
|
147
|
-
when ::Integer then MSGPACK_INT_RANGE.cover?(value)
|
|
148
|
-
else false
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
# The container branch of {representable?}: recurses into Array
|
|
153
|
-
# elements and Hash key+value pairs through the public
|
|
154
|
-
# {representable?}. Not part of the public surface; reach for
|
|
155
|
-
# {representable?} instead.
|
|
156
|
-
def container_representable?(value)
|
|
157
|
-
case value
|
|
158
|
-
when ::Array then value.all? { |element| Utils.representable?(element) }
|
|
159
|
-
when ::Hash then value.all? { |key, val| Utils.representable?(key) && Utils.representable?(val) }
|
|
160
|
-
else false
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
50
|
end
|
|
164
51
|
end
|
|
165
52
|
end
|
data/lib/kobako/codec.rb
CHANGED
data/lib/kobako/handle.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Kobako
|
|
|
17
17
|
# fields on raised error objects. The Host Gem itself constructs
|
|
18
18
|
# Handles through {.restore}, which exists at exactly two call
|
|
19
19
|
# sites: +Kobako::Codec::Factory#unpack_handle+ (wire decode) and
|
|
20
|
-
# +Kobako::Codec::
|
|
20
|
+
# +Kobako::Codec::HandleWalk.deep_wrap+ / +Kobako::Transport::Dispatcher#wrap_as_handle+
|
|
21
21
|
# (allocator paths). Both live inside +lib/kobako/+ and are not part
|
|
22
22
|
# of any public surface.
|
|
23
23
|
#
|
data/lib/kobako/outcome.rb
CHANGED
|
@@ -14,13 +14,6 @@ module Kobako
|
|
|
14
14
|
# +Kobako::Outcome::Panic+. The byte-level msgpack codec at
|
|
15
15
|
# +Kobako::Codec+ is invoked for the body itself; otherwise
|
|
16
16
|
# nothing in +Transport+ participates.
|
|
17
|
-
#
|
|
18
|
-
# * tag 0x01, decode OK → return decoded value
|
|
19
|
-
# * tag 0x01, decode fails → SandboxError
|
|
20
|
-
# * tag 0x02, origin="service" → ServiceError
|
|
21
|
-
# * tag 0x02, origin="sandbox"/missing → SandboxError
|
|
22
|
-
# * tag 0x02, decode fails → SandboxError
|
|
23
|
-
# * unknown tag → TrapError
|
|
24
17
|
module Outcome
|
|
25
18
|
# First byte of the OUTCOME_BUFFER for the success branch — body is
|
|
26
19
|
# the bare msgpack encoding of the returned value
|
|
@@ -47,9 +40,8 @@ module Kobako
|
|
|
47
40
|
# TrapError for unknown or absent tag
|
|
48
41
|
# ({docs/wire-codec.md ABI Signatures}[link:../../docs/wire-codec.md]:
|
|
49
42
|
# zero-length output and unrecognised first byte both walk the trap
|
|
50
|
-
# path). The
|
|
51
|
-
# raw
|
|
52
|
-
# in the message a caller sees.
|
|
43
|
+
# path). The absent-vs-present distinction selects the message;
|
|
44
|
+
# the raw byte is not actionable to a caller and is not surfaced.
|
|
53
45
|
def build_trap_error(tag)
|
|
54
46
|
if tag.nil?
|
|
55
47
|
TrapError.new("Sandbox exited without producing a result")
|
data/lib/kobako/sandbox.rb
CHANGED
|
@@ -289,7 +289,7 @@ module Kobako
|
|
|
289
289
|
# token; restore it to the host object the guest referenced before
|
|
290
290
|
# handing the value to the Host App. @handler still holds this
|
|
291
291
|
# invocation's table — reset only happens at the next #begin_invocation!.
|
|
292
|
-
Codec::
|
|
292
|
+
Codec::HandleWalk.deep_restore(Outcome.decode(snapshot.return_bytes), @handler)
|
|
293
293
|
rescue Kobako::TrapError => e
|
|
294
294
|
raise trap_class_for(e), "Sandbox##{verb} failed: #{e.message}"
|
|
295
295
|
ensure
|
|
@@ -100,13 +100,9 @@ module Kobako
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
# Map an error caught at the dispatch boundary to a +Response.error+
|
|
103
|
-
# envelope. +error+ is the +StandardError+ caught by
|
|
104
|
-
# rescue
|
|
105
|
-
# error
|
|
106
|
-
# +Kobako::Codec::Error+ → type="runtime" (malformed request);
|
|
107
|
-
# +UndefinedTargetError+ → type="undefined"; +ArgumentError+ →
|
|
108
|
-
# type="argument" (arity mismatch); everything else →
|
|
109
|
-
# type="runtime".
|
|
103
|
+
# envelope (binary msgpack). +error+ is the +StandardError+ caught by
|
|
104
|
+
# {#dispatch}'s rescue; the +type+ field tells the guest which kind
|
|
105
|
+
# of failure it was so it can raise the matching proxy-side error.
|
|
110
106
|
def encode_caught_error(error)
|
|
111
107
|
case error
|
|
112
108
|
when Kobako::Codec::Error then encode_error("runtime",
|
data/lib/kobako/transport/run.rb
CHANGED
|
@@ -51,8 +51,8 @@ module Kobako
|
|
|
51
51
|
# Encode this Run to the msgpack bytes the guest's +__kobako_run+
|
|
52
52
|
# entry point consumes as its command-buffer payload
|
|
53
53
|
# ({docs/wire-codec.md Invocation channels}[link:../../../docs/wire-codec.md]).
|
|
54
|
-
# Walks +args+ / +kwargs+ through {Codec::
|
|
55
|
-
# non-wire-representable leaf is allocated into +handler+ and
|
|
54
|
+
# Walks +args+ / +kwargs+ through {Codec::HandleWalk.deep_wrap} so
|
|
55
|
+
# any non-wire-representable leaf is allocated into +handler+ and
|
|
56
56
|
# replaced with a +Kobako::Handle+; the
|
|
57
57
|
# +handler+ argument is the Sandbox's table, sharing the same
|
|
58
58
|
# allocator the guest→host return path uses.
|
|
@@ -64,8 +64,8 @@ module Kobako
|
|
|
64
64
|
def encode(handler)
|
|
65
65
|
Codec::Encoder.encode(
|
|
66
66
|
"entrypoint" => entrypoint,
|
|
67
|
-
"args" => Codec::
|
|
68
|
-
"kwargs" => Codec::
|
|
67
|
+
"args" => Codec::HandleWalk.deep_wrap(args, handler),
|
|
68
|
+
"kwargs" => Codec::HandleWalk.deep_wrap(kwargs, handler)
|
|
69
69
|
)
|
|
70
70
|
end
|
|
71
71
|
|
|
@@ -82,7 +82,7 @@ module Kobako
|
|
|
82
82
|
# Array / Hash one level at a time; a plain value passes through
|
|
83
83
|
# unchanged.
|
|
84
84
|
def restore(value)
|
|
85
|
-
Kobako::Codec::
|
|
85
|
+
Kobako::Codec::HandleWalk.deep_restore(value, @handler)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
# Reify a +YieldResponse+ tag 0x04 payload into a +RuntimeError+ the
|
data/lib/kobako/version.rb
CHANGED
data/release-please-config.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
|
3
3
|
"release-type": "ruby",
|
|
4
4
|
"last-release-sha": "5694da60b08931ea260e13025689b8d8c47d767a",
|
|
5
|
-
"group-pull-request-title-pattern": "chore${scope}: release${component} ${version}",
|
|
6
5
|
"packages": {
|
|
7
6
|
".": {
|
|
8
7
|
"component": "kobako",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Kobako
|
|
2
|
+
module Codec
|
|
3
|
+
module HandleWalk
|
|
4
|
+
MSGPACK_INT_RANGE: Range[Integer]
|
|
5
|
+
|
|
6
|
+
def self?.representable?: (untyped value) -> bool
|
|
7
|
+
|
|
8
|
+
def self?.deep_wrap: (untyped value, Kobako::Catalog::Handles handler) -> untyped
|
|
9
|
+
|
|
10
|
+
def self?.deep_restore: (untyped value, Kobako::Catalog::Handles handler) -> untyped
|
|
11
|
+
|
|
12
|
+
def self?.primitive_type?: (untyped value) -> bool
|
|
13
|
+
|
|
14
|
+
def self?.container_representable?: (untyped value) -> bool
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/sig/kobako/codec/utils.rbs
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
module Kobako
|
|
2
2
|
module Codec
|
|
3
3
|
module Utils
|
|
4
|
-
MSGPACK_INT_RANGE: Range[Integer]
|
|
5
|
-
|
|
6
4
|
def self?.assert_utf8!: (String string, String label) -> void
|
|
7
5
|
|
|
8
6
|
def self?.with_boundary: [T] () { () -> T } -> T
|
|
9
|
-
|
|
10
|
-
def self?.representable?: (untyped value) -> bool
|
|
11
|
-
|
|
12
|
-
def self?.deep_wrap: (untyped value, Kobako::Catalog::Handles handler) -> untyped
|
|
13
|
-
|
|
14
|
-
def self?.deep_restore: (untyped value, Kobako::Catalog::Handles handler) -> untyped
|
|
15
|
-
|
|
16
|
-
def self?.primitive_type?: (untyped value) -> bool
|
|
17
|
-
|
|
18
|
-
def self?.container_representable?: (untyped value) -> bool
|
|
19
7
|
end
|
|
20
8
|
end
|
|
21
9
|
end
|
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.11.
|
|
4
|
+
version: 0.11.2
|
|
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-06-
|
|
11
|
+
date: 2026-06-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: msgpack
|
|
@@ -53,6 +53,7 @@ files:
|
|
|
53
53
|
- lib/kobako/codec/encoder.rb
|
|
54
54
|
- lib/kobako/codec/error.rb
|
|
55
55
|
- lib/kobako/codec/factory.rb
|
|
56
|
+
- lib/kobako/codec/handle_walk.rb
|
|
56
57
|
- lib/kobako/codec/utils.rb
|
|
57
58
|
- lib/kobako/errors.rb
|
|
58
59
|
- lib/kobako/fault.rb
|
|
@@ -91,6 +92,7 @@ files:
|
|
|
91
92
|
- sig/kobako/codec/encoder.rbs
|
|
92
93
|
- sig/kobako/codec/error.rbs
|
|
93
94
|
- sig/kobako/codec/factory.rbs
|
|
95
|
+
- sig/kobako/codec/handle_walk.rbs
|
|
94
96
|
- sig/kobako/codec/utils.rbs
|
|
95
97
|
- sig/kobako/errors.rbs
|
|
96
98
|
- sig/kobako/fault.rbs
|