@trioforge/crucible 0.0.0-stage → 0.2.0

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 (183) hide show
  1. package/LICENSE +21 -0
  2. package/client/package.json +4 -0
  3. package/emit/package.json +4 -0
  4. package/out/all.d.ts +7 -0
  5. package/out/all.luau +2 -0
  6. package/out/attribute.d.ts +7 -0
  7. package/out/attribute.luau +7 -0
  8. package/out/client/index.d.ts +10 -0
  9. package/out/client/init.luau +55 -0
  10. package/out/configs.d.ts +37 -0
  11. package/out/configs.luau +46 -0
  12. package/out/crucible-behaviour.d.ts +16 -0
  13. package/out/crucible-behaviour.luau +78 -0
  14. package/out/crucible-object.d.ts +10 -0
  15. package/out/crucible-object.luau +69 -0
  16. package/out/data.d.ts +224 -0
  17. package/out/data.luau +97 -0
  18. package/out/emit/configs.d.ts +4 -0
  19. package/out/emit/configs.luau +22 -0
  20. package/out/emit/data.d.ts +6 -0
  21. package/out/emit/data.luau +19 -0
  22. package/out/emit/index.d.ts +45 -0
  23. package/out/emit/init.luau +101 -0
  24. package/out/emit/network.d.ts +6 -0
  25. package/out/emit/network.luau +36 -0
  26. package/out/emit/replicated.d.ts +4 -0
  27. package/out/emit/replicated.luau +13 -0
  28. package/out/index.d.ts +20 -0
  29. package/out/init.luau +34 -0
  30. package/out/inject.d.ts +1 -0
  31. package/out/inject.luau +7 -0
  32. package/out/internal/binding.d.ts +1 -0
  33. package/out/internal/binding.luau +615 -0
  34. package/out/internal/boot.d.ts +1 -0
  35. package/out/internal/boot.luau +562 -0
  36. package/out/internal/configs/limits.d.ts +10 -0
  37. package/out/internal/configs/limits.luau +25 -0
  38. package/out/internal/configs/port.d.ts +29 -0
  39. package/out/internal/configs/port.luau +99 -0
  40. package/out/internal/configs/runtime.d.ts +21 -0
  41. package/out/internal/configs/runtime.luau +981 -0
  42. package/out/internal/construction-claim.d.ts +1 -0
  43. package/out/internal/construction-claim.luau +26 -0
  44. package/out/internal/data/admission.d.ts +1 -0
  45. package/out/internal/data/admission.luau +673 -0
  46. package/out/internal/data/declarations.d.ts +1 -0
  47. package/out/internal/data/declarations.luau +384 -0
  48. package/out/internal/data/envelope.d.ts +1 -0
  49. package/out/internal/data/envelope.luau +318 -0
  50. package/out/internal/data/handles.d.ts +1 -0
  51. package/out/internal/data/handles.luau +255 -0
  52. package/out/internal/data/inbox-transforms.d.ts +1 -0
  53. package/out/internal/data/inbox-transforms.luau +458 -0
  54. package/out/internal/data/inbox.d.ts +1 -0
  55. package/out/internal/data/inbox.luau +437 -0
  56. package/out/internal/data/lease.d.ts +1 -0
  57. package/out/internal/data/lease.luau +304 -0
  58. package/out/internal/data/limits.d.ts +1 -0
  59. package/out/internal/data/limits.luau +234 -0
  60. package/out/internal/data/messages.d.ts +1 -0
  61. package/out/internal/data/messages.luau +69 -0
  62. package/out/internal/data/operation-id.d.ts +1 -0
  63. package/out/internal/data/operation-id.luau +61 -0
  64. package/out/internal/data/paths.d.ts +2 -0
  65. package/out/internal/data/paths.luau +323 -0
  66. package/out/internal/data/port.d.ts +1 -0
  67. package/out/internal/data/port.luau +290 -0
  68. package/out/internal/data/profiles.d.ts +1 -0
  69. package/out/internal/data/profiles.luau +862 -0
  70. package/out/internal/data/receipts.d.ts +1 -0
  71. package/out/internal/data/receipts.luau +190 -0
  72. package/out/internal/data/record-bindings.d.ts +1 -0
  73. package/out/internal/data/record-bindings.luau +92 -0
  74. package/out/internal/data/record-declarations.d.ts +1 -0
  75. package/out/internal/data/record-declarations.luau +140 -0
  76. package/out/internal/data/records.d.ts +1 -0
  77. package/out/internal/data/records.luau +400 -0
  78. package/out/internal/data/runtime.d.ts +1 -0
  79. package/out/internal/data/runtime.luau +918 -0
  80. package/out/internal/data/scheduler.d.ts +1 -0
  81. package/out/internal/data/scheduler.luau +507 -0
  82. package/out/internal/data/session.d.ts +1 -0
  83. package/out/internal/data/session.luau +234 -0
  84. package/out/internal/data/shutdown.d.ts +1 -0
  85. package/out/internal/data/shutdown.luau +91 -0
  86. package/out/internal/data/waiters.d.ts +1 -0
  87. package/out/internal/data/waiters.luau +65 -0
  88. package/out/internal/dense-list.d.ts +1 -0
  89. package/out/internal/dense-list.luau +155 -0
  90. package/out/internal/diagnostics.d.ts +1 -0
  91. package/out/internal/diagnostics.luau +29 -0
  92. package/out/internal/hooks.d.ts +1 -0
  93. package/out/internal/hooks.luau +53 -0
  94. package/out/internal/implementers.d.ts +1 -0
  95. package/out/internal/implementers.luau +119 -0
  96. package/out/internal/lifecycle.d.ts +1 -0
  97. package/out/internal/lifecycle.luau +912 -0
  98. package/out/internal/log-output.d.ts +1 -0
  99. package/out/internal/log-output.luau +106 -0
  100. package/out/internal/network/catalog.d.ts +26 -0
  101. package/out/internal/network/catalog.luau +182 -0
  102. package/out/internal/network/claims.d.ts +1 -0
  103. package/out/internal/network/claims.luau +154 -0
  104. package/out/internal/network/client-session.d.ts +1 -0
  105. package/out/internal/network/client-session.luau +403 -0
  106. package/out/internal/network/codec.d.ts +63 -0
  107. package/out/internal/network/codec.luau +1183 -0
  108. package/out/internal/network/envelope.d.ts +1 -0
  109. package/out/internal/network/envelope.luau +247 -0
  110. package/out/internal/network/limits.d.ts +26 -0
  111. package/out/internal/network/limits.luau +55 -0
  112. package/out/internal/network/port.d.ts +1 -0
  113. package/out/internal/network/port.luau +19 -0
  114. package/out/internal/network/roblox-network-port.d.ts +1 -0
  115. package/out/internal/network/roblox-network-port.luau +105 -0
  116. package/out/internal/network/schema.d.ts +72 -0
  117. package/out/internal/network/schema.luau +386 -0
  118. package/out/internal/network/server-session.d.ts +1 -0
  119. package/out/internal/network/server-session.luau +393 -0
  120. package/out/internal/network/session.d.ts +1 -0
  121. package/out/internal/network/session.luau +266 -0
  122. package/out/internal/port.d.ts +1 -0
  123. package/out/internal/port.luau +12 -0
  124. package/out/internal/reactive/context.d.ts +1 -0
  125. package/out/internal/reactive/context.luau +149 -0
  126. package/out/internal/reactive/flush.d.ts +1 -0
  127. package/out/internal/reactive/flush.luau +355 -0
  128. package/out/internal/reactive/graph.d.ts +1 -0
  129. package/out/internal/reactive/graph.luau +626 -0
  130. package/out/internal/reactive/limits.d.ts +1 -0
  131. package/out/internal/reactive/limits.luau +54 -0
  132. package/out/internal/reactive/ownership.d.ts +1 -0
  133. package/out/internal/reactive/ownership.luau +626 -0
  134. package/out/internal/registry.d.ts +1 -0
  135. package/out/internal/registry.luau +455 -0
  136. package/out/internal/roblox-port.d.ts +1 -0
  137. package/out/internal/roblox-port.luau +117 -0
  138. package/out/internal/runner.d.ts +1 -0
  139. package/out/internal/runner.luau +86 -0
  140. package/out/internal/scheduler.d.ts +1 -0
  141. package/out/internal/scheduler.luau +207 -0
  142. package/out/internal/state.d.ts +1 -0
  143. package/out/internal/state.luau +41 -0
  144. package/out/internal/sync/client-sync.d.ts +1 -0
  145. package/out/internal/sync/client-sync.luau +157 -0
  146. package/out/internal/sync/declarations.d.ts +1 -0
  147. package/out/internal/sync/declarations.luau +276 -0
  148. package/out/internal/sync/frame.d.ts +1 -0
  149. package/out/internal/sync/frame.luau +91 -0
  150. package/out/internal/sync/server-sync.d.ts +1 -0
  151. package/out/internal/sync/server-sync.luau +502 -0
  152. package/out/internal/sync/values.d.ts +1 -0
  153. package/out/internal/sync/values.luau +930 -0
  154. package/out/log-level.d.ts +7 -0
  155. package/out/log-level.luau +21 -0
  156. package/out/logging.d.ts +34 -0
  157. package/out/logging.luau +233 -0
  158. package/out/network.d.ts +66 -0
  159. package/out/network.luau +24 -0
  160. package/out/reactive.d.ts +76 -0
  161. package/out/reactive.luau +136 -0
  162. package/out/replicated.d.ts +38 -0
  163. package/out/replicated.luau +45 -0
  164. package/out/server/data.d.ts +54 -0
  165. package/out/server/data.luau +44 -0
  166. package/out/server/index.d.ts +18 -0
  167. package/out/server/init.luau +62 -0
  168. package/out/server/publish.d.ts +20 -0
  169. package/out/server/publish.luau +24 -0
  170. package/out/subsystem.d.ts +4 -0
  171. package/out/subsystem.luau +30 -0
  172. package/out/vide/index.d.ts +7 -0
  173. package/out/vide/init.luau +50 -0
  174. package/package.json +52 -5
  175. package/server/package.json +4 -0
  176. package/transformer/data.cjs +72 -0
  177. package/transformer/declarations.cjs +153 -0
  178. package/transformer/diagnostics.cjs +19 -0
  179. package/transformer/index.js +741 -0
  180. package/transformer/network.cjs +961 -0
  181. package/transformer/type-id.cjs +80 -0
  182. package/vide/package.json +4 -0
  183. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,247 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _codec = TS.import(script, script.Parent, "codec")
4
+ local Reader = _codec.Reader
5
+ local Writer = _codec.Writer
6
+ local L = TS.import(script, script.Parent, "limits")
7
+ --* @internal
8
+ --* @internal
9
+ --* @internal
10
+ --* @internal
11
+ --* @internal
12
+ local EMPTY = table.freeze({})
13
+ local function varuintSize(value)
14
+ local size = 1
15
+ while value >= 128 do
16
+ value = math.floor(value / 128)
17
+ size += 1
18
+ end
19
+ return size
20
+ end
21
+ local function parse(packet)
22
+ local reader = Reader.new(packet, 0, EMPTY, 0)
23
+ local opcode = reader:u8()
24
+ if opcode == 0 then
25
+ local index = reader:varuint()
26
+ local slots = reader:varuint()
27
+ return {
28
+ opcode = opcode,
29
+ index = index,
30
+ slots = slots,
31
+ payloadAt = 1 + varuintSize(index) + varuintSize(slots),
32
+ }
33
+ end
34
+ if opcode == 1 or opcode == 2 then
35
+ local index = reader:varuint()
36
+ local nonce = reader:varuint()
37
+ local slots = reader:varuint()
38
+ local _arg0 = nonce > 0
39
+ assert(_arg0, "nonce 0")
40
+ local payloadAt = 1 + varuintSize(index) + varuintSize(nonce) + varuintSize(slots)
41
+ return if opcode == 1 then {
42
+ opcode = opcode,
43
+ index = index,
44
+ nonce = nonce,
45
+ slots = slots,
46
+ payloadAt = payloadAt,
47
+ } else {
48
+ opcode = opcode,
49
+ index = index,
50
+ nonce = nonce,
51
+ slots = slots,
52
+ payloadAt = payloadAt,
53
+ }
54
+ end
55
+ local header
56
+ if opcode == 3 then
57
+ local index = reader:varuint()
58
+ local nonce = reader:varuint()
59
+ local _arg0 = nonce > 0
60
+ assert(_arg0, "nonce 0")
61
+ header = {
62
+ opcode = opcode,
63
+ index = index,
64
+ nonce = nonce,
65
+ reason = reader:u8(),
66
+ }
67
+ elseif opcode == 4 then
68
+ header = {
69
+ opcode = opcode,
70
+ }
71
+ elseif opcode == 5 then
72
+ header = {
73
+ opcode = opcode,
74
+ reason = reader:u8(),
75
+ }
76
+ else
77
+ error("unknown opcode")
78
+ end
79
+ local _arg0 = reader:finished()
80
+ assert(_arg0, "trailing bytes")
81
+ return header
82
+ end
83
+ --[[
84
+ *
85
+ * @internal
86
+ * The highest non-nil argument position. roblox-ts lowers `select("#", ...args)` through `unpack`, which stops at a
87
+ * nil hole, so this walks the keys instead. A trailing nil argument carries nothing and stays invisible to it.
88
+
89
+ ]]
90
+ local function argumentCount(args)
91
+ local count = 0
92
+ for key in pairs(args) do
93
+ if type(key) == "number" and key > count then
94
+ count = key
95
+ end
96
+ end
97
+ return count
98
+ end
99
+ --* @internal
100
+ local function readHeader(argumentCount, packet, sidecar)
101
+ local _condition = argumentCount ~= 2
102
+ if not _condition then
103
+ local _packet = packet
104
+ _condition = not (type(_packet) == "buffer")
105
+ if not _condition then
106
+ local _sidecar = sidecar
107
+ _condition = not (type(_sidecar) == "table")
108
+ end
109
+ end
110
+ if _condition then
111
+ return nil
112
+ end
113
+ if getmetatable(sidecar) ~= nil then
114
+ return nil
115
+ end
116
+ local ok, header = pcall(parse, packet)
117
+ if not ok then
118
+ return nil
119
+ end
120
+ if header.opcode ~= 0 and header.opcode ~= 1 and header.opcode ~= 2 then
121
+ if (next(sidecar)) ~= nil then
122
+ return nil
123
+ end
124
+ end
125
+ return header
126
+ end
127
+ local function headerBytes(opcode, fields, reason)
128
+ local writer = Writer.new()
129
+ writer:u8(opcode)
130
+ for _, field in fields do
131
+ writer:varuint(field)
132
+ end
133
+ if reason ~= nil then
134
+ writer:u8(reason)
135
+ end
136
+ return (writer:finish(buffer.create(0)))
137
+ end
138
+ --* @internal
139
+ local function controlPacket(opcode, fields, reason)
140
+ local bytes = headerBytes(opcode, fields, reason)
141
+ return table.freeze({
142
+ bytes = bytes,
143
+ sidecar = EMPTY,
144
+ charge = buffer.len(bytes),
145
+ })
146
+ end
147
+ --* An assert's message carries the asserting chunk and line, which say nothing about the payload.
148
+ local function plain(err)
149
+ return (string.gsub(tostring(err), "^[^\n]-:%d+: ", ""))
150
+ end
151
+ local function describe(name, path, err)
152
+ local _err = err
153
+ local _condition = type(_err) == "table"
154
+ if _condition then
155
+ _condition = err.codecFailure == true
156
+ end
157
+ if _condition then
158
+ local failure = err
159
+ return `{name} {failure.path}: {plain(failure.reason)}`
160
+ end
161
+ return `{name} {path}: {plain(err)}`
162
+ end
163
+ --* @internal
164
+ --* @internal
165
+ local function encodeBody(name, codec, path, value)
166
+ local writer = Writer.new()
167
+ local ok, err = pcall(function()
168
+ return codec.encode(writer, value, path)
169
+ end)
170
+ if not ok then
171
+ error(describe(name, path, err), 0)
172
+ end
173
+ return {
174
+ name = name,
175
+ path = path,
176
+ writer = writer,
177
+ }
178
+ end
179
+ --* @internal
180
+ local function frame(body, opcode, fields)
181
+ local slots = #body.writer.slots
182
+ local bytes = buffer.create(0)
183
+ local sidecar = EMPTY
184
+ local ok, err = pcall(function()
185
+ local _writer = body.writer
186
+ local _exp = opcode
187
+ local _array = {}
188
+ local _length = #_array
189
+ local _fieldsLength = #fields
190
+ table.move(fields, 1, _fieldsLength, _length + 1, _array)
191
+ _length += _fieldsLength
192
+ _array[_length + 1] = slots
193
+ bytes, sidecar = _writer:finish(headerBytes(_exp, _array))
194
+ end)
195
+ if not ok then
196
+ error(describe(body.name, body.path, err), 0)
197
+ end
198
+ return table.freeze({
199
+ bytes = bytes,
200
+ sidecar = sidecar,
201
+ charge = buffer.len(bytes) + L.QUEUED_SLOT_CHARGE_BYTES * slots,
202
+ })
203
+ end
204
+ --* @internal
205
+ local function openBody(packet, sidecar, header)
206
+ return Reader.new(packet, header.payloadAt, sidecar, header.slots)
207
+ end
208
+ --* @internal
209
+ local function decodeBody(codec, path, reader)
210
+ local value = codec.decode(reader, path)
211
+ local _arg0 = reader:finished()
212
+ assert(_arg0, "trailing bytes or unconsumed slots")
213
+ return value
214
+ end
215
+ --* @internal
216
+ local function missingInstance(err)
217
+ local _err = err
218
+ local _condition = type(_err) == "table"
219
+ if _condition then
220
+ _condition = err.missing == true
221
+ end
222
+ return _condition
223
+ end
224
+ --* @internal
225
+ local function failureReason(err)
226
+ local _err = err
227
+ local _condition = type(_err) == "table"
228
+ if _condition then
229
+ _condition = err.codecFailure == true
230
+ end
231
+ if _condition then
232
+ local failure = err
233
+ return `{failure.path}: {plain(failure.reason)}`
234
+ end
235
+ return plain(err)
236
+ end
237
+ return {
238
+ argumentCount = argumentCount,
239
+ readHeader = readHeader,
240
+ controlPacket = controlPacket,
241
+ encodeBody = encodeBody,
242
+ frame = frame,
243
+ openBody = openBody,
244
+ decodeBody = decodeBody,
245
+ missingInstance = missingInstance,
246
+ failureReason = failureReason,
247
+ }
@@ -0,0 +1,26 @@
1
+ export declare const PROTOCOL_VERSION = 1;
2
+ export declare const REMOTE_NAME = "CrucibleNetwork";
3
+ export declare const PROTOCOL_ATTRIBUTE = "Protocol";
4
+ export declare const CATALOG_ATTRIBUTE = "Catalog";
5
+ export declare const KICK_MESSAGE = "Connection problem, please rejoin.";
6
+ export declare const MESSAGE_NAME_MAX_BYTES = 64;
7
+ export declare const MAX_MESSAGES = 1024;
8
+ export declare const CLIENT_DISCOVERY_TIMEOUT_SECONDS = 30;
9
+ export declare const MAX_QUEUED_PACKETS = 256;
10
+ export declare const MAX_QUEUED_BYTES = 1048576;
11
+ export declare const QUEUED_SLOT_CHARGE_BYTES = 64;
12
+ export declare const MAX_PACKET_BYTES = 262144;
13
+ export declare const MAX_INSTANCE_SLOTS = 256;
14
+ export declare const MAX_DEPTH = 32;
15
+ export declare const MAX_VALUE_VISITS = 65536;
16
+ export declare const MAX_COLLECTION_ENTRIES = 16384;
17
+ export declare const MAX_STRING_BYTES = 65536;
18
+ export declare const VARUINT_MAX_BYTES = 5;
19
+ export declare const MAX_UNION_BRANCHES = 256;
20
+ export declare const MAX_SCHEMA_NODES = 4096;
21
+ export declare const CFRAME_TOLERANCE = 0.001;
22
+ export declare const MAX_ACTIVE_HANDLERS = 64;
23
+ export declare const MAX_PENDING_ASKS = 64;
24
+ export declare const HANDLER_LIFETIME_SECONDS = 30;
25
+ export declare const DEFAULT_ASK_TIMEOUT_SECONDS = 10;
26
+ export declare const MAX_ASK_TIMEOUT_SECONDS = 120;
@@ -0,0 +1,55 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local PROTOCOL_VERSION = 1
3
+ local REMOTE_NAME = "CrucibleNetwork"
4
+ local PROTOCOL_ATTRIBUTE = "Protocol"
5
+ local CATALOG_ATTRIBUTE = "Catalog"
6
+ local KICK_MESSAGE = "Connection problem, please rejoin."
7
+ local MESSAGE_NAME_MAX_BYTES = 64
8
+ local MAX_MESSAGES = 1024
9
+ local CLIENT_DISCOVERY_TIMEOUT_SECONDS = 30
10
+ local MAX_QUEUED_PACKETS = 256
11
+ local MAX_QUEUED_BYTES = 1_048_576
12
+ local QUEUED_SLOT_CHARGE_BYTES = 64
13
+ local MAX_PACKET_BYTES = 262_144
14
+ local MAX_INSTANCE_SLOTS = 256
15
+ local MAX_DEPTH = 32
16
+ local MAX_VALUE_VISITS = 65_536
17
+ local MAX_COLLECTION_ENTRIES = 16_384
18
+ local MAX_STRING_BYTES = 65_536
19
+ local VARUINT_MAX_BYTES = 5
20
+ local MAX_UNION_BRANCHES = 256
21
+ local MAX_SCHEMA_NODES = 4096
22
+ local CFRAME_TOLERANCE = 0.001
23
+ local MAX_ACTIVE_HANDLERS = 64
24
+ local MAX_PENDING_ASKS = 64
25
+ local HANDLER_LIFETIME_SECONDS = 30
26
+ local DEFAULT_ASK_TIMEOUT_SECONDS = 10
27
+ local MAX_ASK_TIMEOUT_SECONDS = 120
28
+ return {
29
+ PROTOCOL_VERSION = PROTOCOL_VERSION,
30
+ REMOTE_NAME = REMOTE_NAME,
31
+ PROTOCOL_ATTRIBUTE = PROTOCOL_ATTRIBUTE,
32
+ CATALOG_ATTRIBUTE = CATALOG_ATTRIBUTE,
33
+ KICK_MESSAGE = KICK_MESSAGE,
34
+ MESSAGE_NAME_MAX_BYTES = MESSAGE_NAME_MAX_BYTES,
35
+ MAX_MESSAGES = MAX_MESSAGES,
36
+ CLIENT_DISCOVERY_TIMEOUT_SECONDS = CLIENT_DISCOVERY_TIMEOUT_SECONDS,
37
+ MAX_QUEUED_PACKETS = MAX_QUEUED_PACKETS,
38
+ MAX_QUEUED_BYTES = MAX_QUEUED_BYTES,
39
+ QUEUED_SLOT_CHARGE_BYTES = QUEUED_SLOT_CHARGE_BYTES,
40
+ MAX_PACKET_BYTES = MAX_PACKET_BYTES,
41
+ MAX_INSTANCE_SLOTS = MAX_INSTANCE_SLOTS,
42
+ MAX_DEPTH = MAX_DEPTH,
43
+ MAX_VALUE_VISITS = MAX_VALUE_VISITS,
44
+ MAX_COLLECTION_ENTRIES = MAX_COLLECTION_ENTRIES,
45
+ MAX_STRING_BYTES = MAX_STRING_BYTES,
46
+ VARUINT_MAX_BYTES = VARUINT_MAX_BYTES,
47
+ MAX_UNION_BRANCHES = MAX_UNION_BRANCHES,
48
+ MAX_SCHEMA_NODES = MAX_SCHEMA_NODES,
49
+ CFRAME_TOLERANCE = CFRAME_TOLERANCE,
50
+ MAX_ACTIVE_HANDLERS = MAX_ACTIVE_HANDLERS,
51
+ MAX_PENDING_ASKS = MAX_PENDING_ASKS,
52
+ HANDLER_LIFETIME_SECONDS = HANDLER_LIFETIME_SECONDS,
53
+ DEFAULT_ASK_TIMEOUT_SECONDS = DEFAULT_ASK_TIMEOUT_SECONDS,
54
+ MAX_ASK_TIMEOUT_SECONDS = MAX_ASK_TIMEOUT_SECONDS,
55
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local robloxNetworkPort = TS.import(script, script.Parent, "roblox-network-port").robloxNetworkPort
4
+ --* @internal
5
+ --* @internal
6
+ --* @internal
7
+ local installed
8
+ --* @internal
9
+ local function installNetworkPort(port)
10
+ installed = port
11
+ end
12
+ --* @internal
13
+ local function networkPort()
14
+ return installed or robloxNetworkPort()
15
+ end
16
+ return {
17
+ installNetworkPort = installNetworkPort,
18
+ networkPort = networkPort,
19
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,105 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local _limits = TS.import(script, script.Parent, "limits")
4
+ local CATALOG_ATTRIBUTE = _limits.CATALOG_ATTRIBUTE
5
+ local PROTOCOL_ATTRIBUTE = _limits.PROTOCOL_ATTRIBUTE
6
+ local REMOTE_NAME = _limits.REMOTE_NAME
7
+ --* @internal
8
+ local function robloxNetworkPort()
9
+ local players = game:GetService("Players")
10
+ local storage = game:GetService("ReplicatedStorage")
11
+ local remote
12
+ local connection
13
+ local function disconnect()
14
+ local _result = connection
15
+ if _result ~= nil then
16
+ _result:Disconnect()
17
+ end
18
+ connection = nil
19
+ end
20
+ return {
21
+ create = function(receive)
22
+ local created = Instance.new("RemoteEvent")
23
+ created.Name = REMOTE_NAME
24
+ connection = created.OnServerEvent:Connect(receive)
25
+ remote = created
26
+ end,
27
+ publish = function(protocol, catalog)
28
+ local target = remote or error("Crucible network remote was not created")
29
+ target:SetAttribute(PROTOCOL_ATTRIBUTE, protocol)
30
+ target:SetAttribute(CATALOG_ATTRIBUTE, catalog)
31
+ target.Parent = storage
32
+ end,
33
+ fireClient = function(player, packet, sidecar)
34
+ local _result = remote
35
+ if _result ~= nil then
36
+ _result = _result:FireClient(player, packet, sidecar)
37
+ end
38
+ return _result
39
+ end,
40
+ players = function()
41
+ return players:GetPlayers()
42
+ end,
43
+ onPlayerAdded = function(listener)
44
+ local c = players.PlayerAdded:Connect(listener)
45
+ return function()
46
+ return c:Disconnect()
47
+ end
48
+ end,
49
+ onPlayerRemoving = function(listener)
50
+ local c = players.PlayerRemoving:Connect(listener)
51
+ return function()
52
+ return c:Disconnect()
53
+ end
54
+ end,
55
+ kick = function(player, message)
56
+ return player:Kick(message)
57
+ end,
58
+ destroy = function()
59
+ disconnect()
60
+ local _result = remote
61
+ if _result ~= nil then
62
+ _result:Destroy()
63
+ end
64
+ remote = nil
65
+ end,
66
+ discover = function(timeout, receive)
67
+ local found = storage:WaitForChild(REMOTE_NAME, timeout)
68
+ if found == nil then
69
+ return nil
70
+ end
71
+ if found:IsA("RemoteEvent") then
72
+ remote = found
73
+ connection = found.OnClientEvent:Connect(receive)
74
+ end
75
+ return {
76
+ className = found.ClassName,
77
+ protocol = found:GetAttribute(PROTOCOL_ATTRIBUTE),
78
+ catalog = found:GetAttribute(CATALOG_ATTRIBUTE),
79
+ }
80
+ end,
81
+ disconnect = disconnect,
82
+ fireServer = function(packet, sidecar)
83
+ local _result = remote
84
+ if _result ~= nil then
85
+ _result = _result:FireServer(packet, sidecar)
86
+ end
87
+ return _result
88
+ end,
89
+ delay = function(seconds, callback)
90
+ local thread = task.delay(seconds, callback)
91
+ return function()
92
+ if coroutine.status(thread) == "suspended" then
93
+ task.cancel(thread)
94
+ end
95
+ end
96
+ end,
97
+ resume = function(thread, ...)
98
+ local args = { ... }
99
+ task.spawn(thread, unpack(args))
100
+ end,
101
+ }
102
+ end
103
+ return {
104
+ robloxNetworkPort = robloxNetworkPort,
105
+ }
@@ -0,0 +1,72 @@
1
+ export type Literal = string | number | boolean;
2
+ export type LeafKind = "nil" | "bool" | "f64" | "f32" | "u8" | "u16" | "u32" | "string" | "vector3" | "color3" | "cframe" | "dynamic";
3
+ export interface LeafNode<K extends LeafKind = LeafKind> {
4
+ readonly kind: K;
5
+ }
6
+ export interface LiteralNode<V extends Literal = Literal> {
7
+ readonly kind: "literal";
8
+ readonly value: V;
9
+ }
10
+ export interface InstanceNode {
11
+ readonly kind: "instance";
12
+ readonly classes: readonly (keyof Instances)[];
13
+ }
14
+ export interface ObjectNode {
15
+ readonly kind: "object";
16
+ readonly fields: readonly (readonly [name: string, value: Node])[];
17
+ }
18
+ export interface ArrayNode {
19
+ readonly kind: "array";
20
+ readonly element: Node;
21
+ }
22
+ export interface TupleNode {
23
+ readonly kind: "tuple";
24
+ readonly elements: readonly Node[];
25
+ }
26
+ export interface MapNode {
27
+ readonly kind: "map";
28
+ readonly key: MapKey;
29
+ readonly value: Node;
30
+ }
31
+ export interface VariantNode {
32
+ readonly kind: "variant";
33
+ readonly key: string;
34
+ readonly value: Literal;
35
+ readonly body: ObjectNode;
36
+ }
37
+ export type Branch = Node | VariantNode;
38
+ export interface UnionNode<B extends Branch = Branch> {
39
+ readonly kind: "union";
40
+ readonly branches: readonly B[];
41
+ }
42
+ export type Node = LeafNode | LiteralNode | InstanceNode | ObjectNode | ArrayNode | TupleNode | MapNode | UnionNode;
43
+ export type MapKey = LeafNode<"string" | "u8" | "u16" | "u32"> | UnionNode<LiteralNode<string | number>>;
44
+ export interface NodeBuilders {
45
+ readonly nil: LeafNode<"nil">;
46
+ readonly bool: LeafNode<"bool">;
47
+ readonly f64: LeafNode<"f64">;
48
+ readonly f32: LeafNode<"f32">;
49
+ readonly u8: LeafNode<"u8">;
50
+ readonly u16: LeafNode<"u16">;
51
+ readonly u32: LeafNode<"u32">;
52
+ readonly string: LeafNode<"string">;
53
+ readonly vector3: LeafNode<"vector3">;
54
+ readonly color3: LeafNode<"color3">;
55
+ readonly cframe: LeafNode<"cframe">;
56
+ readonly dynamic: LeafNode<"dynamic">;
57
+ readonly literal: <V extends Literal>(value: V) => LiteralNode<V>;
58
+ readonly instance: (classes: readonly (keyof Instances)[]) => InstanceNode;
59
+ readonly object: (fields: readonly (readonly [name: string, value: Node])[]) => ObjectNode;
60
+ readonly array: (element: Node) => ArrayNode;
61
+ readonly tuple: (elements: readonly Node[]) => TupleNode;
62
+ readonly map: (key: MapKey, value: Node) => MapNode;
63
+ readonly union: <B extends Branch>(branches: readonly B[]) => UnionNode<B>;
64
+ readonly variant: (key: string, value: Literal, body: ObjectNode) => VariantNode;
65
+ }
66
+ export declare function assertDescriptor(node: unknown): asserts node is Branch;
67
+ export declare function admitsNil(node: Branch): boolean;
68
+ export declare function runtimeKind(node: Branch): string;
69
+ export declare function literalLess(a: Literal, b: Literal): boolean;
70
+ /** Rule 63 order and rule 65 ambiguity, asserted by the builder and again by `compile`. */
71
+ export declare function checkUnion(branches: readonly Branch[]): void;
72
+ export declare const n: NodeBuilders;