kobako 0.30.0-aarch64-linux → 0.31.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.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.release-please-manifest.json +1 -1
  3. data/CHANGELOG.md +335 -0
  4. data/README.md +43 -3
  5. data/ROADMAP.md +1 -1
  6. data/crates/kobako-runtime/CHANGELOG.md +219 -0
  7. data/crates/kobako-runtime/README.md +7 -4
  8. data/crates/kobako-transport/CHANGELOG.md +31 -0
  9. data/crates/kobako-transport/README.md +3 -4
  10. data/crates/kobako-wasmtime/CHANGELOG.md +161 -0
  11. data/crates/kobako-wasmtime/README.md +3 -2
  12. data/crates/kobako-wasmtime/wit/deps/cli.wit +233 -0
  13. data/crates/kobako-wasmtime/wit/deps/clocks.wit +162 -0
  14. data/crates/kobako-wasmtime/wit/deps/filesystem.wit +589 -0
  15. data/crates/kobako-wasmtime/wit/deps/http.wit +733 -0
  16. data/crates/kobako-wasmtime/wit/deps/io.wit +299 -0
  17. data/crates/kobako-wasmtime/wit/deps/random.wit +92 -0
  18. data/crates/kobako-wasmtime/wit/deps/sockets.wit +949 -0
  19. data/data/kobako.wasm +0 -0
  20. data/lib/kobako/3.3/kobako.so +0 -0
  21. data/lib/kobako/3.4/kobako.so +0 -0
  22. data/lib/kobako/4.0/kobako.so +0 -0
  23. data/lib/kobako/catalog/extensions.rb +14 -2
  24. data/lib/kobako/catalog/flags.rb +3 -5
  25. data/lib/kobako/catalog/grants.rb +5 -4
  26. data/lib/kobako/catalog/handles.rb +5 -27
  27. data/lib/kobako/catalog/mount.rb +11 -3
  28. data/lib/kobako/catalog/network.rb +35 -0
  29. data/lib/kobako/catalog/replacements.rb +28 -0
  30. data/lib/kobako/catalog/services.rb +5 -19
  31. data/lib/kobako/catalog/snippets.rb +3 -18
  32. data/lib/kobako/catalog.rb +3 -0
  33. data/lib/kobako/codec/{utils.rb → boundary.rb} +4 -2
  34. data/lib/kobako/codec/decoder.rb +4 -4
  35. data/lib/kobako/codec/ext_types.rb +3 -3
  36. data/lib/kobako/codec/handle_walk.rb +3 -43
  37. data/lib/kobako/codec/value_budget.rb +132 -40
  38. data/lib/kobako/codec.rb +1 -1
  39. data/lib/kobako/context.rb +24 -11
  40. data/lib/kobako/errors.rb +15 -12
  41. data/lib/kobako/extension.rb +3 -2
  42. data/lib/kobako/filesystem.rb +9 -2
  43. data/lib/kobako/handle.rb +2 -2
  44. data/lib/kobako/names.rb +28 -0
  45. data/lib/kobako/network.rb +210 -0
  46. data/lib/kobako/outcome.rb +7 -7
  47. data/lib/kobako/pool.rb +45 -23
  48. data/lib/kobako/runtime.rb +3 -2
  49. data/lib/kobako/sandbox.rb +92 -35
  50. data/lib/kobako/sandbox_options.rb +41 -106
  51. data/lib/kobako/transport/argument_wrap.rb +64 -0
  52. data/lib/kobako/transport/block_failure.rb +1 -1
  53. data/lib/kobako/transport/dispatcher.rb +6 -6
  54. data/lib/kobako/transport/exposure.rb +26 -15
  55. data/lib/kobako/transport/reflection.rb +21 -4
  56. data/lib/kobako/transport/run.rb +8 -23
  57. data/lib/kobako/transport/yielder.rb +2 -9
  58. data/lib/kobako/transport.rb +1 -0
  59. data/lib/kobako/version.rb +1 -1
  60. data/lib/kobako.rb +6 -2
  61. data/release-please-config.json +15 -0
  62. data/sig/core/thread.rbs +6 -0
  63. data/sig/kobako/catalog/extensions.rbs +2 -0
  64. data/sig/kobako/catalog/grants.rbs +7 -4
  65. data/sig/kobako/catalog/handles.rbs +0 -2
  66. data/sig/kobako/catalog/mount.rbs +3 -1
  67. data/sig/kobako/catalog/network.rbs +20 -0
  68. data/sig/kobako/catalog/replacements.rbs +14 -0
  69. data/sig/kobako/catalog/services.rbs +0 -4
  70. data/sig/kobako/catalog/snippets.rbs +0 -2
  71. data/sig/kobako/codec/{utils.rbs → boundary.rbs} +2 -2
  72. data/sig/kobako/codec/handle_walk.rbs +0 -6
  73. data/sig/kobako/codec/value_budget.rbs +47 -4
  74. data/sig/kobako/context.rbs +3 -1
  75. data/sig/kobako/errors.rbs +4 -4
  76. data/sig/kobako/filesystem.rbs +21 -3
  77. data/sig/kobako/network.rbs +115 -0
  78. data/sig/kobako/outcome.rbs +1 -1
  79. data/sig/kobako/pool.rbs +7 -3
  80. data/sig/kobako/runtime.rbs +32 -3
  81. data/sig/kobako/sandbox.rbs +19 -2
  82. data/sig/kobako/sandbox_options.rbs +29 -38
  83. data/sig/kobako/transport/argument_wrap.rbs +15 -0
  84. data/sig/kobako/transport/error.rbs +1 -1
  85. data/sig/kobako/transport/exposure.rbs +2 -4
  86. data/sig/kobako/transport/reflection.rbs +10 -0
  87. data/sig/kobako/transport/run.rbs +0 -2
  88. data/sig/kobako/transport/yielder.rbs +0 -3
  89. data/sig/kobako/transport.rbs +1 -1
  90. data/sig/kobako.rbs +13 -0
  91. metadata +23 -9
  92. data/crates/kobako-runtime/tests/linux_baseline/linux-baseline-expected.txt +0 -16
  93. data/lib/kobako/constant_name.rb +0 -8
  94. data/sig/kobako/constant_name.rbs +0 -3
@@ -61,16 +61,17 @@ module Kobako
61
61
  # rescuable fault.
62
62
  rescue StandardError => e
63
63
  [:fault, *fault_of(e, failure)] # : [Symbol, String, String?]
64
- ensure
65
- yielder&.invalidate
66
64
  end
67
65
 
68
66
  class << self
69
67
  private
70
68
 
69
+ # Routing reads only the target and the method, so a dispatch that
70
+ # cannot route answers before its arguments are read.
71
71
  def run(call, resolver, handles, yielder)
72
- arguments, carried_handle = decode_arguments(call.payload)
73
72
  exposure = resolve_target(call.target, resolver, handles)
73
+ reject_unreachable(exposure, call.method_name.to_sym)
74
+ arguments, carried_handle = decode_arguments(call.payload)
74
75
  args, kwargs = resolve_call_args(arguments, handles, carried_handle)
75
76
  invoke(exposure, call.method_name, args, kwargs, yielder)
76
77
  end
@@ -111,13 +112,12 @@ module Kobako
111
112
  # unsplatted for methods that take no keywords.
112
113
  def invoke(exposure, method, args, kwargs, yielder)
113
114
  name = method.to_sym
114
- reject_unreachable(exposure, name)
115
115
  target = exposure.object
116
116
  block = yielder&.to_proc
117
117
  if kwargs.empty?
118
- target.public_send(name, *args, &block)
118
+ Reflection::PUBLIC_SEND.bind(target).call(name, *args, &block)
119
119
  else
120
- target.public_send(name, *args, **kwargs, &block)
120
+ Reflection::PUBLIC_SEND.bind(target).call(name, *args, **kwargs, &block)
121
121
  end
122
122
  end
123
123
 
@@ -14,15 +14,6 @@ module Kobako
14
14
  PREDICATE = :respond_to_guest?
15
15
  private_constant :PREDICATE
16
16
 
17
- # Kernel's own reflection, bound onto each object so a forwarder or a
18
- # BasicObject answers from its own method table rather than through
19
- # +method_missing+ / +respond_to_missing?+.
20
- CLASS_OF = Kernel.instance_method(:class)
21
- SINGLETON_CLASS_OF = Kernel.instance_method(:singleton_class)
22
- SINGLETON_METHODS = Kernel.instance_method(:singleton_methods)
23
- PRIVATE_METHODS = Kernel.instance_method(:private_methods)
24
- private_constant :CLASS_OF, :SINGLETON_CLASS_OF, :SINGLETON_METHODS, :PRIVATE_METHODS
25
-
26
17
  CALLABLE = Set.new(Reflection::CALLABLE_ALLOW).freeze
27
18
  NOTHING = Set.new.freeze
28
19
  private_constant :CALLABLE, :NOTHING
@@ -31,18 +22,38 @@ module Kobako
31
22
  # each class's own surface for a caller that makes many references at
32
23
  # once (a Handle table), so two objects of one class enumerate it once.
33
24
  def self.of(object, surfaces = {})
34
- klass = CLASS_OF.bind_call(object)
25
+ klass = Reflection::CLASS_OF.bind_call(object)
35
26
  names = narrows_itself?(object, klass) ? nil : resolve_default_names(object, klass, surfaces)
36
27
  new(object: object, names: names)
37
28
  end
38
29
 
30
+ # The class of +object+ when no reference may stand for it, as its
31
+ # reachable surface is not Service behaviour; +nil+ otherwise. A
32
+ # +Binding+ / +Method+ / +UnboundMethod+ hands the guest a callable
33
+ # proxy onto host reflection (a returned +Binding+ reaches
34
+ # +Binding#eval+); a +Class+ or +Module+ hands over its class-level API
35
+ # (+File.popen+ / +read+, +Kernel.system+), which the owner-based
36
+ # dispatch floor cannot see because a singleton-class owner matches no
37
+ # core-module list; a +Delegator+ (+SimpleDelegator+, +DelegateClass+,
38
+ # +WeakRef+, +Tempfile+) is a transparent forwarder whose public
39
+ # +method_missing+ binds and calls the private method the guest names
40
+ # (+Kernel#system+), a surface the floor reads as ordinary Service
41
+ # behaviour.
42
+ def self.refused_class_of(object)
43
+ case object
44
+ when Binding, Method, UnboundMethod, Module, Delegator
45
+ # Delegator < BasicObject exposes no static +#class+.
46
+ Reflection::CLASS_OF.bind_call(object)
47
+ end
48
+ end
49
+
39
50
  # Whether the guest may call +name+ through this reference. The
40
51
  # object's own predicate is consulted with the private surface
41
52
  # included, so the guest's +public_send+ can never reach it.
42
53
  def exposes?(name)
43
54
  return names.include?(name) if names
44
55
 
45
- object.__send__(PREDICATE, name) ? true : false
56
+ Reflection::SEND.bind_call(object, PREDICATE, name) ? true : false
46
57
  end
47
58
 
48
59
  class << self
@@ -53,8 +64,8 @@ module Kobako
53
64
  # +respond_to_missing?+ cannot answer for it.
54
65
  def narrows_itself?(object, klass)
55
66
  klass.method_defined?(PREDICATE) || klass.private_method_defined?(PREDICATE) ||
56
- PRIVATE_METHODS.bind_call(object, false).include?(PREDICATE) ||
57
- SINGLETON_METHODS.bind_call(object, false).include?(PREDICATE)
67
+ Reflection::PRIVATE_METHODS.bind_call(object, false).include?(PREDICATE) ||
68
+ Reflection::SINGLETON_METHODS.bind_call(object, false).include?(PREDICATE)
58
69
  end
59
70
 
60
71
  # A callable keeps its callable names; a class-level surface or a
@@ -76,9 +87,9 @@ module Kobako
76
87
  end
77
88
 
78
89
  def with_singleton(object, names)
79
- return names if SINGLETON_METHODS.bind_call(object, false).empty?
90
+ return names if Reflection::SINGLETON_METHODS.bind_call(object, false).empty?
80
91
 
81
- names.union(authored_names(SINGLETON_CLASS_OF.bind_call(object))).freeze
92
+ names.union(authored_names(Reflection::SINGLETON_CLASS_OF.bind_call(object))).freeze
82
93
  end
83
94
 
84
95
  # The public methods +owner+ itself defines in Ruby source.
@@ -17,6 +17,19 @@ module Kobako
17
17
  # callable exposes by default, so the floor and the Exposure agree.
18
18
  CALLABLE_ALLOW = %i[call [] yield arity lambda?].freeze
19
19
 
20
+ # Kernel's own reflection and dispatch, bound onto each object so a
21
+ # forwarder or a BasicObject answers from its own method table rather
22
+ # than through +method_missing+ / +respond_to_missing?+, for the floor,
23
+ # the Exposure, and the call alike.
24
+ CLASS_OF = Kernel.instance_method(:class)
25
+ IS_A = Kernel.instance_method(:is_a?)
26
+ SINGLETON_CLASS_OF = Kernel.instance_method(:singleton_class)
27
+ SINGLETON_METHODS = Kernel.instance_method(:singleton_methods)
28
+ PRIVATE_METHODS = Kernel.instance_method(:private_methods)
29
+ RESPOND_TO = Kernel.instance_method(:respond_to?)
30
+ PUBLIC_SEND = Kernel.instance_method(:public_send)
31
+ SEND = BasicObject.instance_method(:__send__)
32
+
20
33
  # The reason +name+ is unreachable through +exposure+, or +nil+ when
21
34
  # the dispatch may proceed. Composes the ambient-surface floor with the
22
35
  # reference's Exposure, in that order: the Exposure only narrows and
@@ -81,7 +94,7 @@ module Kobako
81
94
 
82
95
  klass = lookup_class(target)
83
96
  return public_method_refusal(target, name, klass) if klass.public_method_defined?(name)
84
- return "no public method #{name.inspect} on target" unless target.respond_to?(name)
97
+ return "no public method #{name.inspect} on target" unless RESPOND_TO.bind_call(target, name)
85
98
  return service_refusal(name) if klass.method_defined?(name) || klass.private_method_defined?(name)
86
99
 
87
100
  owner_refusal(target, name, klass)
@@ -117,9 +130,13 @@ module Kobako
117
130
  # singleton class is taken only when it already holds a public
118
131
  # method, since asking for it otherwise would create one.
119
132
  def lookup_class(target)
120
- return target.singleton_class if target.is_a?(Module) || target.singleton_methods.any?
133
+ return SINGLETON_CLASS_OF.bind_call(target) if module?(target) || SINGLETON_METHODS.bind_call(target).any?
134
+
135
+ CLASS_OF.bind_call(target)
136
+ end
121
137
 
122
- target.class
138
+ def module?(target)
139
+ IS_A.bind_call(target, Module)
123
140
  end
124
141
 
125
142
  # Whatever +Class+ inherits is surface every object shares rather
@@ -132,7 +149,7 @@ module Kobako
132
149
  def ambient_owner?(owner, target)
133
150
  owner >= Class ||
134
151
  GADGET_OWNERS.include?(owner) ||
135
- (target.is_a?(Module) && owner.singleton_class?)
152
+ (module?(target) && owner.singleton_class?)
136
153
  end
137
154
  end
138
155
  end
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../constant_name"
4
3
  require_relative "../handle"
4
+ require_relative "../names"
5
5
  require_relative "../codec"
6
6
  require_relative "../payload"
7
+ require_relative "argument_wrap"
7
8
 
8
9
  module Kobako
9
10
  module Transport
@@ -11,7 +12,7 @@ module Kobako
11
12
  # legitimately holds one.
12
13
  class Run < Data.define(:entrypoint, :args, :kwargs) # :nodoc:
13
14
  def initialize(entrypoint:, args: [], kwargs: {})
14
- entrypoint = normalize_entrypoint(entrypoint)
15
+ entrypoint = Kobako.to_constant_name(entrypoint, "entrypoint")
15
16
  validate_args(args)
16
17
  validate_kwargs(kwargs)
17
18
  super
@@ -23,42 +24,26 @@ module Kobako
23
24
  # is counted from.
24
25
  def encode_payload(handles)
25
26
  Payload::Arguments.new(
26
- args: Codec::HandleWalk.deep_wrap(args, handles, 1),
27
- kwargs: Codec::HandleWalk.deep_wrap(kwargs, handles, 1)
27
+ args: ArgumentWrap.wrap(args, handles, 1),
28
+ kwargs: ArgumentWrap.wrap(kwargs, handles, 1)
28
29
  ).encode
29
30
  end
30
31
 
31
32
  private
32
33
 
33
- # A target of the wrong type raises TypeError, a Host App programming
34
- # error caught before the run reaches the guest.
35
- def normalize_entrypoint(target)
36
- unless target.is_a?(Symbol) || target.is_a?(String)
37
- raise TypeError, "entrypoint must be a Symbol or String, got #{target.class}"
38
- end
39
-
40
- target_str = target.to_s
41
- unless CONSTANT_NAME.match?(target_str)
42
- raise ArgumentError,
43
- "entrypoint must match #{CONSTANT_NAME.inspect} (got #{target.inspect})"
44
- end
45
-
46
- target_str.to_sym
47
- end
48
-
49
34
  def validate_args(args)
50
- raise ArgumentError, "arguments must be an Array" unless args.is_a?(Array)
35
+ raise TypeError, "arguments must be an Array" unless args.is_a?(Array)
51
36
  raise ArgumentError, forged_handle_message("arguments") if args.any?(Kobako::Handle)
52
37
  end
53
38
 
54
39
  # Checked here so the Host App sees the host-side message before any
55
40
  # encode boundary.
56
41
  def validate_kwargs(kwargs)
57
- raise ArgumentError, "keyword arguments must be a Hash" unless kwargs.is_a?(Hash)
42
+ raise TypeError, "keyword arguments must be a Hash" unless kwargs.is_a?(Hash)
58
43
 
59
44
  bad_keys = kwargs.each_key.grep_v(Symbol)
60
45
  unless bad_keys.empty?
61
- raise ArgumentError,
46
+ raise TypeError,
62
47
  "keyword argument keys must be Symbols (got #{bad_keys.inspect})"
63
48
  end
64
49
  raise ArgumentError, forged_handle_message("keyword argument values") if kwargs.each_value.any?(Kobako::Handle)
@@ -11,18 +11,15 @@ module Kobako
11
11
  @break_tag = break_tag
12
12
  @handles = handles
13
13
  @failure = failure
14
- @active = true
15
14
  end
16
15
 
17
16
  # The ok value is consumed by the host Service, so a Capability Handle
18
17
  # in it is restored. A block exit stays in the guest, so the Service
19
18
  # is only unwound.
20
19
  def yield(*args)
21
- raise LocalJumpError, "guest block invoked after host dispatch frame returned" unless @active
22
-
23
- arm, body, klass = @guest_yielder.call(encode_args(args))
20
+ arm, body, class_name = @guest_yielder.call(encode_args(args))
24
21
  raise UnsupportedError, "the Sandbox runtime does not support yielding to a block" if arm == :unsupported
25
- raise @failure.remember(BlockError.new(body, klass: klass)) if arm == :error
22
+ raise @failure.remember(BlockError.new(body, class_name: class_name)) if arm == :error
26
23
 
27
24
  throw @break_tag if arm == :break
28
25
 
@@ -33,10 +30,6 @@ module Kobako
33
30
  method(:yield).to_proc
34
31
  end
35
32
 
36
- def invalidate
37
- @active = false
38
- end
39
-
40
33
  private
41
34
 
42
35
  # Restated so the Service reads a refusal of its own argument rather
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "transport/call"
4
+ require_relative "transport/argument_wrap"
4
5
  require_relative "transport/run"
5
6
  require_relative "transport/block_failure"
6
7
  require_relative "transport/yielder"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kobako
4
- VERSION = "0.30.0"
4
+ VERSION = "0.31.0"
5
5
  end
data/lib/kobako.rb CHANGED
@@ -23,8 +23,10 @@
23
23
  #
24
24
  # [A type sits at the lowest tier that needs it]
25
25
  # Kobako::Handle sits at the root, for Codec.
26
- # [A native-defined handle that needs nothing in +lib/+ sits at the root]
27
- # Kobako::Filesystem sits at the root, for the Catalog.
26
+ # [A native piece sits at the tier of the constant it registers on]
27
+ # Kobako::Filesystem and Kobako::Network sit at the root, for the
28
+ # Catalog, and so do the name rules on Kobako itself, for the Catalog and
29
+ # Transport; Kobako::Runtime sits with the Sandbox that drives it.
28
30
  # [Outcome may require <tt>transport/error.rb</tt>]
29
31
  # The gem contract fixes the class name.
30
32
  # [<tt>Codec.track_handles</tt> wraps only the decode call]
@@ -44,7 +46,9 @@ rescue LoadError
44
46
  end
45
47
 
46
48
  require_relative "kobako/filesystem"
49
+ require_relative "kobako/network"
47
50
  require_relative "kobako/errors"
51
+ require_relative "kobako/names"
48
52
  require_relative "kobako/unresolved"
49
53
  require_relative "kobako/extension"
50
54
  require_relative "kobako/transport"
@@ -115,6 +115,11 @@
115
115
  "path": "/wasm/kobako-baker/Cargo.lock",
116
116
  "jsonpath": "$.package[?(@.name=='kobako-baker')].version"
117
117
  },
118
+ {
119
+ "type": "toml",
120
+ "path": "/wasm/kobako-baker/Cargo.toml",
121
+ "jsonpath": "$.dependencies['kobako-transport'].version"
122
+ },
118
123
  {
119
124
  "type": "generic",
120
125
  "path": "/wasm/kobako-baker/README.md"
@@ -140,6 +145,11 @@
140
145
  "path": "/wasm/Cargo.lock",
141
146
  "jsonpath": "$.package[?(@.name=='kobako-transport')].version"
142
147
  },
148
+ {
149
+ "type": "toml",
150
+ "path": "/wasm/kobako-baker/Cargo.lock",
151
+ "jsonpath": "$.package[?(@.name=='kobako-transport')].version"
152
+ },
143
153
  {
144
154
  "type": "generic",
145
155
  "path": "/crates/kobako-transport/README.md"
@@ -160,6 +170,11 @@
160
170
  "path": "/wasm/Cargo.lock",
161
171
  "jsonpath": "$.package[?(@.name=='kobako-codec')].version"
162
172
  },
173
+ {
174
+ "type": "toml",
175
+ "path": "/crates/kobako-codec/Cargo.toml",
176
+ "jsonpath": "$.dependencies['kobako-transport'].version"
177
+ },
163
178
  {
164
179
  "type": "generic",
165
180
  "path": "/crates/kobako-codec/README.md"
@@ -0,0 +1,6 @@
1
+ # The block form rbs 4.2.0 leaves out. ruby/rbs types it after that release
2
+ # (7c396890); this goes once a release carrying it is the floor.
3
+ class Thread
4
+ def self.handle_interrupt: [T] (Hash[Class, :immediate | :on_blocking | :never] hash) { (nil) -> T } -> T
5
+ | ...
6
+ end
@@ -17,6 +17,8 @@ module Kobako
17
17
 
18
18
  def validate: (untyped extension) -> void
19
19
 
20
+ def validate_dependencies: (untyped dependencies) -> void
21
+
20
22
  def unmet_dependency: () -> [untyped, untyped]?
21
23
 
22
24
  def symbolize: (untyped name) -> untyped
@@ -1,13 +1,16 @@
1
1
  module Kobako
2
2
  module Catalog
3
3
  class Grants
4
- def initialize: () -> void
4
+ type key = [Symbol, String]
5
+
6
+ type grant = Mount | Network
5
7
 
6
- def register: (Mount grant) -> nil
8
+ def initialize: () -> void
7
9
 
8
- def include?: (Mount grant) -> bool
10
+ def register: (grant grant) -> nil
9
11
 
10
- def entries: (?Hash[String, Mount] overrides) -> Array[Mount::tuple]
12
+ def include?: (grant grant) -> bool
13
+ def entries: (?Hash[key, grant] overrides) -> [Array[Mount::tuple], Array[Network::tuple]]
11
14
  end
12
15
  end
13
16
  end
@@ -13,8 +13,6 @@ module Kobako
13
13
 
14
14
  private
15
15
 
16
- def reject_unwrappable: (untyped object) -> void
17
-
18
16
  def ensure_capacity: () -> void
19
17
 
20
18
  def require_bound: (Integer id) -> void
@@ -14,7 +14,9 @@ module Kobako
14
14
 
15
15
  def self.new: (at: untyped, access: untyped, filesystem: untyped, policy: policy?) -> Mount
16
16
 
17
- def key: () -> String
17
+ def initialize: (at: untyped, access: untyped, filesystem: untyped, policy: policy?) -> void
18
+
19
+ def key: () -> Grants::key
18
20
 
19
21
  def conflict: (Mount other) -> String?
20
22
 
@@ -0,0 +1,20 @@
1
+ module Kobako
2
+ module Catalog
3
+ class Network < Data
4
+ type tuple = [String, untyped]
5
+
6
+ attr_reader name: String
7
+ attr_reader entry: untyped
8
+
9
+ def self.new: (name: untyped, entry: untyped) ?{ (Kobako::Network::Builder) -> void } -> Network
10
+
11
+ def initialize: (name: untyped, entry: untyped) ?{ (Kobako::Network::Builder) -> void } -> void
12
+
13
+ def key: () -> Grants::key
14
+
15
+ def conflict: (Mount | Network other) -> String?
16
+
17
+ def to_native: () -> tuple
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ module Kobako
2
+ module Catalog
3
+ class Replacements
4
+ @grants: Grants
5
+ @replaced: Hash[Grants::key, Grants::grant]
6
+
7
+ def initialize: (Grants grants) -> void
8
+
9
+ def replace: (Grants::grant grant, String refusal) -> nil
10
+
11
+ def entries: () -> [Array[Mount::tuple], Array[Network::tuple]]
12
+ end
13
+ end
14
+ end
@@ -1,8 +1,6 @@
1
1
  module Kobako
2
2
  module Catalog
3
3
  class Services
4
- RESERVED_NAMESPACE: String
5
-
6
4
  def initialize: () -> void
7
5
 
8
6
  def bind: (Symbol | String path, untyped object) -> self
@@ -17,8 +15,6 @@ module Kobako
17
15
 
18
16
  def validate_path: (Symbol | String path) -> String
19
17
 
20
- def reserved?: (String path) -> bool
21
-
22
18
  def collision?: (String path) -> bool
23
19
  end
24
20
  end
@@ -22,8 +22,6 @@ module Kobako
22
22
  def register_binary: (String bytes) -> nil
23
23
 
24
24
  def entry_tuple: (entry) -> tuple
25
-
26
- def normalize_name: (Symbol | String name) -> Symbol
27
25
  end
28
26
  end
29
27
  end
@@ -1,9 +1,9 @@
1
1
  module Kobako
2
2
  module Codec
3
- module Utils
3
+ module Boundary
4
4
  def self.assert_utf8: (String string, String label) -> void
5
5
 
6
- def self.with_boundary: [T] () { () -> T } -> T
6
+ def self.within: [T] () { () -> T } -> T
7
7
  end
8
8
  end
9
9
  end
@@ -5,16 +5,10 @@ module Kobako
5
5
 
6
6
  def self.representable?: (untyped value, ?Integer depth) -> bool
7
7
 
8
- def self.deep_wrap: (untyped value, Kobako::Codec::_HandleTable handles, ?Integer depth) -> untyped
9
-
10
8
  def self.deep_restore: (untyped value, Kobako::Codec::_HandleTable handles) -> untyped
11
9
 
12
10
  private
13
11
 
14
- def self.guard_nesting: (Integer depth) -> void
15
-
16
- def self.deep_wrap_hash: (Hash[untyped, untyped] hash, Kobako::Codec::_HandleTable handles, Integer depth) -> Hash[untyped, untyped]
17
-
18
12
  def self.primitive_type?: (untyped value) -> bool
19
13
 
20
14
  def self.container_representable?: (untyped value, Integer depth) -> bool
@@ -9,15 +9,58 @@ module Kobako
9
9
 
10
10
  UINT: Hash[Integer, String]
11
11
 
12
+ FLOAT_FORMATS: Hash[Integer, String]
13
+
14
+ FLOATS: Regexp
15
+
16
+ NAN_ENTRY: Integer
17
+
12
18
  def self.assert_within: (String bytes, Integer? budget) -> void
13
19
 
14
- private
20
+ class Count
21
+ class OpenContainer < Struct[untyped]
22
+ attr_accessor held: Integer
23
+ attr_accessor keyed: bool
24
+ attr_accessor read: Integer
25
+ attr_accessor nan_keys: Integer
26
+ attr_accessor holds_nan: bool
27
+
28
+ def self.new: (Integer held, bool keyed, Integer read, Integer nan_keys, bool holds_nan) -> OpenContainer
29
+ end
30
+
31
+ @bytes: String
32
+ @budget: Integer
33
+ @remaining: Integer
34
+ @open: Array[OpenContainer]
35
+
36
+ @ended: bool
37
+
38
+ def initialize: (String bytes, Integer budget) -> void
39
+
40
+ def run: () -> void
15
41
 
16
- def self.step: (String bytes, Integer pos) -> [Integer?, Integer]
42
+ private
17
43
 
18
- def self.step_framed:(String bytes, Integer pos, Integer marker) -> [Integer?, Integer]
44
+ def count_value: (Integer pos, Integer children, bool keyed) -> void
45
+
46
+ def close_value: (bool holds_nan) -> void
47
+
48
+ def charge_key: (OpenContainer map) -> void
49
+
50
+ def spend: (Integer values) -> void
51
+
52
+ def nan?: (Integer pos) -> bool
53
+
54
+ def step: (Integer pos) -> [Integer?, Integer, bool]
55
+
56
+ def step_framed: (Integer pos, Integer marker) -> [Integer?, Integer, bool]
57
+
58
+ def uint: (Integer pos, Integer width) -> Integer
59
+ end
60
+
61
+ private
19
62
 
20
- def self.uint: (String bytes, Integer pos, Integer width) -> Integer
63
+ def self.within_by_size?: (String bytes, Integer budget) -> bool
21
64
  end
22
65
  end
23
66
  end
@@ -2,7 +2,7 @@ module Kobako
2
2
  class Context
3
3
  type preamble = [Array[String], Array[Kobako::Catalog::Snippets::tuple], Array[Kobako::Catalog::Flags::tuple]]
4
4
 
5
- @mounts: Hash[String, Kobako::Catalog::Mount]?
5
+ @replacements: Kobako::Catalog::Replacements
6
6
 
7
7
  def initialize: (
8
8
  runtime: Kobako::Runtime,
@@ -16,6 +16,8 @@ module Kobako
16
16
 
17
17
  def mount: (String at, Kobako::Filesystem::mountable filesystem, ?access: Kobako::Filesystem::access) ?{ (String path, Kobako::Filesystem::access access) -> boolish } -> self
18
18
 
19
+ def network: (Symbol | String name, ?untyped entry) ?{ (Kobako::Network::Builder) -> void } -> self
20
+
19
21
  def lookup: (Symbol | String path) -> Kobako::Transport::Exposure
20
22
 
21
23
  def eval: (String code) ?{ (Kobako::Context) -> void } -> Kobako::Execution
@@ -21,18 +21,18 @@ module Kobako
21
21
  class SetupError < Error
22
22
  end
23
23
 
24
- class ModuleNotBuiltError < SetupError
24
+ class GuestBinaryNotFoundError < SetupError
25
25
  end
26
26
 
27
27
  module Diagnosable : Error
28
28
  attr_reader origin: String?
29
- attr_reader klass: String?
29
+ attr_reader class_name: String?
30
30
  attr_reader backtrace_lines: Array[String]?
31
31
 
32
32
  def initialize: (
33
33
  String message,
34
34
  ?origin: String?,
35
- ?klass: String?,
35
+ ?class_name: String?,
36
36
  ?backtrace_lines: Array[String]?
37
37
  ) -> void
38
38
  end
@@ -81,7 +81,7 @@ module Kobako
81
81
  ?name: Symbol?,
82
82
  ?available: Array[Symbol],
83
83
  ?origin: String?,
84
- ?klass: String?,
84
+ ?class_name: String?,
85
85
  ?backtrace_lines: Array[String]?
86
86
  ) -> void
87
87
  end