From 9f87a1caef980cee701f7c4b35ce771f879b3cde Mon Sep 17 00:00:00 2001 From: Daniel Vigovszky Date: Mon, 17 Aug 2026 13:14:10 +0200 Subject: [PATCH 1/7] streaming invocation base --- .gitignore | 3 + Cargo.lock | 2 + cli/golem-cli/src/bridge_gen/scala/mod.rs | 29 +- cli/golem-cli/wit/deps/golem-agent/guest.wit | 5 +- .../wit/deps/golem-core-v2/golem-core-v2.wit | 15 +- .../proto/golem/schema/schema.proto | 8 + .../golem/worker/invocation_session.proto | 123 + .../golem/worker/v1/worker_service.proto | 2 + .../workerexecutor/v1/worker_executor.proto | 52 +- golem-api-grpc/src/lib.rs | 268 + golem-common/src/model/agent/extraction.rs | 11 + golem-common/src/model/component_metadata.rs | 49 +- golem-common/src/model/oplog/matcher.rs | 1 + golem-common/src/model/oplog/protobuf.rs | 32 +- golem-common/src/model/worker.rs | 30 +- golem-common/src/schema/agent/mod.rs | 247 +- golem-common/src/schema/agent/tests.rs | 145 +- golem-common/src/schema/mod.rs | 2 +- golem-common/src/schema/render/json_value.rs | 1 + .../src/schema/tests/protobuf_tests.rs | 6 +- golem-common/src/schema/tests/wit_tests.rs | 56 +- .../src/schema/validation/placement.rs | 118 +- .../validation/tests/placement_tests.rs | 63 +- golem-common/wit/deps/golem-agent/guest.wit | 5 +- .../wit/deps/golem-core-v2/golem-core-v2.wit | 15 +- golem-registry-service/src/grpc/api_impl.rs | 15 +- golem-schema-derive/src/codegen/poem.rs | 5 + golem-schema/Cargo.toml | 1 + golem-schema/src/schema/conversion.rs | 1 + golem-schema/src/schema/mod.rs | 4 + golem-schema/src/schema/protobuf.rs | 140 +- golem-schema/src/schema/schema_value.rs | 14 + golem-schema/src/schema/stream.rs | 347 + golem-schema/src/schema/validation/value.rs | 2 + golem-schema/src/schema/wit/decode.rs | 167 +- golem-schema/src/schema/wit/encode.rs | 285 +- golem-schema/src/schema/wit/host.rs | 5 +- golem-schema/src/schema/wit/mod.rs | 85 +- .../wit/deps/golem-core-v2/golem-core-v2.wit | 15 +- golem-service-base/src/grpc/client.rs | 65 +- golem-service-base/src/model/agent_secret.rs | 12 +- golem-service-base/src/model/component.rs | 12 +- golem-service-base/src/model/environment.rs | 16 +- golem-worker-executor-test-utils/Cargo.toml | 1 + .../src/dsl_impl.rs | 174 +- golem-worker-executor-test-utils/src/lib.rs | 5 +- .../src/durable_host/concurrent/call.rs | 110 +- .../src/durable_host/concurrent/delivery.rs | 4 +- .../src/durable_host/concurrent/tests.rs | 8 +- .../src/durable_host/durability.rs | 45 +- .../src/durable_host/golem/retry_api.rs | 8 +- .../src/durable_host/golem/v1x.rs | 52 +- .../src/durable_host/http/inline_retry.rs | 17 +- .../src/durable_host/http/outgoing_http.rs | 2 + .../src/durable_host/http/policy.rs | 14 +- .../src/durable_host/http/types.rs | 5 +- .../src/durable_host/logging/policy.rs | 17 +- golem-worker-executor/src/durable_host/mod.rs | 539 +- .../src/durable_host/p3/cli.rs | 33 +- .../src/durable_host/p3/filesystem.rs | 60 +- .../src/durable_host/p3/http/replay.rs | 2 +- .../src/durable_host/p3/http/send.rs | 7 +- .../src/durable_host/quota/mod.rs | 24 +- .../src/durable_host/schema_value_stream.rs | 293 + .../src/durable_host/secrets/mod.rs | 24 +- .../src/durable_host/stream_session.rs | 2688 +++ .../src/durable_host/stream_transport.rs | 370 + .../src/durable_host/wasm_rpc/mod.rs | 418 +- golem-worker-executor/src/grpc/invocation.rs | 8 +- .../src/grpc/invocation_session.rs | 742 + golem-worker-executor/src/grpc/mod.rs | 402 +- golem-worker-executor/src/lib.rs | 8 +- .../src/services/linear_memory.rs | 91 +- .../src/services/oplog/plugin.rs | 9 +- golem-worker-executor/src/services/rpc.rs | 494 +- .../src/services/worker_proxy.rs | 74 +- .../src/worker/invocation.rs | 342 +- .../src/worker/invocation_loop.rs | 106 +- golem-worker-executor/src/worker/mod.rs | 91 +- golem-worker-executor/tests/agent.rs | 53 +- golem-worker-executor/tests/rpc.rs | 253 +- .../src/custom_api/call_agent/mod.rs | 5 +- golem-worker-service/src/grpcapi/worker.rs | 365 +- .../src/mcp/invoke/resource.rs | 5 +- golem-worker-service/src/mcp/invoke/tool.rs | 5 +- .../src/service/worker/client.rs | 472 +- .../src/service/worker/service.rs | 116 +- integration-tests/tests/api/mod.rs | 1 + integration-tests/tests/api/streaming_rpc.rs | 271 + sdks/moonbit/AGENTS.md | 15 +- sdks/moonbit/golem_sdk/agents/agents.mbt | 4 +- sdks/moonbit/golem_sdk/agents/dispatch.mbt | 95 +- .../golem_sdk/agents/dispatch_wbtest.mbt | 40 + sdks/moonbit/golem_sdk/agents/moon.pkg | 1 + .../golem_sdk/agents/pkg.generated.mbti | 12 +- sdks/moonbit/golem_sdk/config/moon.pkg | 1 + sdks/moonbit/golem_sdk/config/top.mbt | 28 +- sdks/moonbit/golem_sdk/errors/errors.mbt | 36 +- sdks/moonbit/golem_sdk/errors/moon.pkg | 2 + sdks/moonbit/golem_sdk/errors/tests.mbt | 81 +- sdks/moonbit/golem_sdk/gen/ffi.mbt | 76 +- .../gen/interface/golem/agent/guest/ffi.mbt | 2385 +-- .../gen/interface/golem/agent/guest/top.mbt | 5 +- .../interface/golem/api/load-snapshot/ffi.mbt | 14 +- .../gen/interface/golem/tool/guest/ffi.mbt | 484 +- .../interface/golem/agent/host/ffi.mbt | 106 +- .../interface/golem/agent/host/top.mbt | 5546 +++--- .../interface/golem/api/context/ffi.mbt | 38 +- .../interface/golem/api/host/ffi.mbt | 54 +- .../interface/golem/api/oplog/ffi.mbt | 106 +- .../interface/golem/api/oplog/top.mbt | 15426 ++++++++-------- .../interface/golem/api/retry/ffi.mbt | 38 +- .../interface/golem/core/types/ffi.mbt | 2033 +- .../interface/golem/core/types/moon.pkg | 4 + .../golem/core/types/pkg.generated.mbti | 10 + .../interface/golem/core/types/top.mbt | 88 + .../golem/durability/durability/ffi.mbt | 98 +- .../golem/durability/durability/top.mbt | 1886 +- .../interface/golem/quota/types/ffi.mbt | 30 +- .../interface/golem/rdbms/ignite2/ffi.mbt | 100 +- .../interface/golem/rdbms/mysql/ffi.mbt | 100 +- .../interface/golem/rdbms/postgres/ffi.mbt | 120 +- .../interface/golem/secrets/reveal/ffi.mbt | 60 +- .../interface/golem/secrets/reveal/top.mbt | 6 + .../interface/golem/secrets/types/ffi.mbt | 40 +- .../interface/golem/tool/host/ffi.mbt | 94 +- .../interface/golem/tool/host/top.mbt | 1521 +- .../interface/golem/websocket/client/ffi.mbt | 36 +- .../wasi/blobstore/blobstore/ffi.mbt | 8 +- .../wasi/blobstore/container/ffi.mbt | 34 +- .../interface/wasi/blobstore/types/ffi.mbt | 26 +- .../interface/wasi/cli/environment/ffi.mbt | 18 +- .../wasi/clocks/system-clock/ffi.mbt | 18 +- .../interface/wasi/config/store/ffi.mbt | 16 +- .../wasi/filesystem/preopens/ffi.mbt | 8 +- .../interface/wasi/filesystem/types/ffi.mbt | 50 +- .../interface/wasi/http/client/ffi.mbt | 32 +- .../interface/wasi/http/types/ffi.mbt | 58 +- .../golem_sdk/interface/wasi/io/error/ffi.mbt | 18 +- .../wasi/io/error/pkg.generated.mbti | 4 +- .../golem_sdk/interface/wasi/io/poll/ffi.mbt | 8 +- .../interface/wasi/io/streams/ffi.mbt | 38 +- .../interface/wasi/keyvalue/cache/ffi.mbt | 8 +- .../wasi/keyvalue/eventual-batch/ffi.mbt | 28 +- .../interface/wasi/keyvalue/eventual/ffi.mbt | 14 +- .../interface/wasi/keyvalue/types/ffi.mbt | 46 +- .../wasi/keyvalue/wasi-keyvalue-error/ffi.mbt | 18 +- .../wasi-keyvalue-error/pkg.generated.mbti | 4 +- sdks/moonbit/golem_sdk/moon.mod | 27 + sdks/moonbit/golem_sdk/moon.mod.json | 13 - sdks/moonbit/golem_sdk/quota/tests.mbt | 43 +- .../moonbit/golem_sdk/schema/agent_stream.mbt | 90 + sdks/moonbit/golem_sdk/schema/moon.pkg | 3 + .../golem_sdk/schema/pkg.generated.mbti | 10 + .../moonbit/golem_sdk/schema/records_test.mbt | 7 +- .../golem_sdk/schema/rich_types_test.mbt | 7 +- sdks/moonbit/golem_sdk/schema/schema.mbt | 1 + sdks/moonbit/golem_sdk/schema/schema_test.mbt | 105 +- sdks/moonbit/golem_sdk/schema_model/model.mbt | 57 +- sdks/moonbit/golem_sdk/schema_model/moon.pkg | 2 + .../golem_sdk/schema_model/pkg.generated.mbti | 27 +- .../schema_model/resource_cleanup_wbtest.mbt | 174 + .../golem_sdk/schema_model/roundtrip_test.mbt | 112 +- .../schema_value_stream_handle.mbt | 129 + sdks/moonbit/golem_sdk/schema_model/wit.mbt | 350 +- .../golem_sdk/schema_model_host/decode.mbt | 23 + .../golem_sdk/schema_model_host/moon.pkg | 4 + .../schema_model_host/pkg.generated.mbti | 23 + .../golem_sdk/scripts/regen-bindings.sh | 2 +- .../golem_sdk/tool/canonical_input.mbt | 124 +- sdks/moonbit/golem_sdk/tool/client.mbt | 132 +- sdks/moonbit/golem_sdk/tool/dispatch.mbt | 120 +- sdks/moonbit/golem_sdk/tool/moon.pkg | 1 + .../moonbit/golem_sdk/tool/pkg.generated.mbti | 24 +- sdks/moonbit/golem_sdk/tool/registry.mbt | 180 +- .../tool/resource_cleanup_wbtest.mbt | 266 + .../tool/{tool_test.mbt => tool_wbtest.mbt} | 932 +- .../golem_sdk/wit/deps/golem-agent/guest.wit | 5 +- .../wit/deps/golem-core-v2/golem-core-v2.wit | 15 +- sdks/moonbit/golem_sdk_example1/golem.yaml | 8 +- .../golem_moonbit_examples/golem_tools.mbt | 741 +- .../golem_moonbit_examples/pkg.generated.mbti | 144 +- sdks/moonbit/golem_sdk_example1/moon.mod | 19 + sdks/moonbit/golem_sdk_example1/moon.mod.json | 13 - .../golem_sdk_tools/lib/agents_emit.mbt | 4 +- .../golem_sdk_tools/lib/agents_test.mbt | 48 +- .../golem_sdk_tools/lib/clients_emit.mbt | 25 +- .../golem_sdk_tools/lib/clients_emit_test.mbt | 5 +- sdks/moonbit/golem_sdk_tools/lib/tools.mbt | 7 - .../golem_sdk_tools/lib/tools_emit.mbt | 53 +- .../golem_sdk_tools/lib/tools_emit_test.mbt | 37 + .../golem_sdk_tools/lib/tools_test.mbt | 6 - sdks/moonbit/scripts/moon.mod | 7 + sdks/moonbit/scripts/moon.mod.json | 7 - sdks/moonbit/scripts/release/main.mbt | 3 +- .../scripts/release/pkg.generated.mbti | 13 + sdks/rust/Cargo.lock | 28 + .../src/agentic/agent_definition_impl.rs | 4 + .../src/agentic/agent_implementation_impl.rs | 81 +- .../src/agentic/client_generation.rs | 64 +- sdks/rust/golem-rust/src/agentic/agent.rs | 6 +- .../rust/golem-rust/src/agentic/agent_impl.rs | 23 +- .../golem-rust/src/agentic/agent_stream.rs | 129 + sdks/rust/golem-rust/src/agentic/mod.rs | 2 + sdks/rust/golem-rust/src/agentic/schema.rs | 77 + sdks/rust/golem-rust/src/lib.rs | 6 + sdks/rust/golem-rust/tests/agent.rs | 175 +- .../ui/fail/agent_stream_alias_constructor.rs | 11 + .../agent_stream_alias_constructor.stderr | 5 + .../scalar_named_agent_stream_constructor.rs | 13 + .../golem-rust/wit/deps/golem-agent/guest.wit | 5 +- .../wit/deps/golem-core-v2/golem-core-v2.wit | 15 +- sdks/scala/build.sbt | 9 +- .../scala/golem/codegen/rpc/RpcCodegen.scala | 2 +- .../scala/golem/host/SchemaWireInterop.scala | 65 + .../golem/host/js/schema/SchemaTypes.scala | 23 + .../host/js/schema/SchemaValueStreamApi.scala | 20 + .../runtime/autowire/MethodBinding.scala | 6 +- .../runtime/autowire/SchemaPayload.scala | 7 + .../scala/golem/runtime/guest/Guest.scala | 11 +- .../runtime/rpc/AbstractRemoteMethod.scala | 2 +- .../runtime/rpc/AgentClientRuntime.scala | 97 +- .../golem/runtime/rpc/SchemaRpcCodec.scala | 8 + .../js/schema-value-stream-module-loader.cjs | 14 + .../golem/host/SchemaWireInteropSpec.scala | 36 + .../runtime/autowire/SchemaPayloadSpec.scala | 41 +- .../runtime/rpc/AgentClientRuntimeSpec.scala | 27 +- .../main/scala/golem/schema/AgentStream.scala | 145 + .../main/scala/golem/schema/SchemaValue.scala | 8 +- .../schema/validation/ValueValidation.scala | 1 + .../main/scala/golem/schema/wire/Wire.scala | 3 +- .../scala/golem/schema/wire/WireCodec.scala | 20 + .../scala/golem/schema/AgentStreamSpec.scala | 47 + .../scala/golem/schema/SchemaModelSpec.scala | 18 + sdks/scala/wit/deps/golem-agent/guest.wit | 5 +- .../wit/deps/golem-core-v2/golem-core-v2.wit | 15 +- sdks/scala/wit/dts/exports.d.ts | 5 +- .../scala/wit/dts/golem_core_2_0_0_types.d.ts | 14 + .../packages/golem-ts-sdk/src/bridge/agent.ts | 3 +- .../ts/packages/golem-ts-sdk/src/httpTypes.ts | 3 +- sdks/ts/packages/golem-ts-sdk/src/index.ts | 2 +- .../src/internal/schema-model/index.ts | 1 + .../src/internal/schema-model/model.ts | 8 +- .../schema-model/schemaValueStreamHandle.ts | 23 + .../src/internal/schema-model/wit.ts | 160 +- sdks/ts/packages/golem-ts-sdk/src/runtime.ts | 4 +- .../golem-ts-sdk/src/schema/agentStream.ts | 235 + .../golem-ts-sdk/src/schema/markers.ts | 33 +- .../golem-ts-sdk/tests/bridge.test.ts | 54 +- .../tests/schema-model/errors.test.ts | 3 + .../tests/schema-value-stream.test.ts | 197 + .../packages/golem-ts-sdk/tests/testSetup.ts | 9 + .../packages/golem-ts-sdk/types/exports.d.ts | 5 +- .../types/golem_core_2_0_0_types.d.ts | 14 + sdks/ts/wit/deps/golem-agent/guest.wit | 5 +- .../wit/deps/golem-core-v2/golem-core-v2.wit | 15 +- .../golem-it-agent-rpc-rust/Cargo.lock | 78 + .../golem-it-agent-rpc-rust/src/lib.rs | 270 + test-components/agent-rpc/golem.yaml | 4 +- test-components/agent-rpc/package-lock.json | 6 +- wit/deps/golem-agent/guest.wit | 5 +- wit/deps/golem-core-v2/golem-core-v2.wit | 15 +- 262 files changed, 32675 insertions(+), 16503 deletions(-) create mode 100644 golem-api-grpc/proto/golem/worker/invocation_session.proto create mode 100644 golem-schema/src/schema/stream.rs create mode 100644 golem-worker-executor/src/durable_host/schema_value_stream.rs create mode 100644 golem-worker-executor/src/durable_host/stream_session.rs create mode 100644 golem-worker-executor/src/durable_host/stream_transport.rs create mode 100644 golem-worker-executor/src/grpc/invocation_session.rs create mode 100644 integration-tests/tests/api/streaming_rpc.rs create mode 100644 sdks/moonbit/golem_sdk/agents/dispatch_wbtest.mbt create mode 100644 sdks/moonbit/golem_sdk/moon.mod delete mode 100644 sdks/moonbit/golem_sdk/moon.mod.json create mode 100644 sdks/moonbit/golem_sdk/schema/agent_stream.mbt create mode 100644 sdks/moonbit/golem_sdk/schema_model/resource_cleanup_wbtest.mbt create mode 100644 sdks/moonbit/golem_sdk/schema_model/schema_value_stream_handle.mbt create mode 100644 sdks/moonbit/golem_sdk/schema_model_host/decode.mbt create mode 100644 sdks/moonbit/golem_sdk/schema_model_host/moon.pkg create mode 100644 sdks/moonbit/golem_sdk/schema_model_host/pkg.generated.mbti create mode 100644 sdks/moonbit/golem_sdk/tool/resource_cleanup_wbtest.mbt rename sdks/moonbit/golem_sdk/tool/{tool_test.mbt => tool_wbtest.mbt} (59%) create mode 100644 sdks/moonbit/golem_sdk_example1/moon.mod delete mode 100644 sdks/moonbit/golem_sdk_example1/moon.mod.json create mode 100644 sdks/moonbit/scripts/moon.mod delete mode 100644 sdks/moonbit/scripts/moon.mod.json create mode 100644 sdks/moonbit/scripts/release/pkg.generated.mbti create mode 100644 sdks/rust/golem-rust/src/agentic/agent_stream.rs create mode 100644 sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.rs create mode 100644 sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.stderr create mode 100644 sdks/rust/golem-rust/tests/ui/pass/scalar_named_agent_stream_constructor.rs create mode 100644 sdks/scala/core/js/src/main/scala/golem/host/js/schema/SchemaValueStreamApi.scala create mode 100644 sdks/scala/core/js/src/test/js/schema-value-stream-module-loader.cjs create mode 100644 sdks/scala/model/src/main/scala/golem/schema/AgentStream.scala create mode 100644 sdks/scala/model/src/test/scala/golem/schema/AgentStreamSpec.scala create mode 100644 sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/schemaValueStreamHandle.ts create mode 100644 sdks/ts/packages/golem-ts-sdk/src/schema/agentStream.ts create mode 100644 sdks/ts/packages/golem-ts-sdk/tests/schema-value-stream.test.ts diff --git a/.gitignore b/.gitignore index 92d29f836a..59c14e1391 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,6 @@ docs/snippets/loop.log /sdks/scala/out/ /sdks/scala/mill/out/ + +/sdks/moonbit/_build +/sdks/moonbit/.mooncakes diff --git a/Cargo.lock b/Cargo.lock index 0b8fdacc95..024ea77af3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4024,6 +4024,7 @@ dependencies = [ "base64 0.22.1", "bigdecimal", "bit-vec 0.6.3", + "blake3", "bytes", "chrono", "combine", @@ -4367,6 +4368,7 @@ dependencies = [ "tempfile", "test-r", "tokio", + "tokio-stream", "tokio-util", "tonic 0.14.5", "tonic-tracing-opentelemetry", diff --git a/cli/golem-cli/src/bridge_gen/scala/mod.rs b/cli/golem-cli/src/bridge_gen/scala/mod.rs index b0606ca258..ff520ad22d 100644 --- a/cli/golem-cli/src/bridge_gen/scala/mod.rs +++ b/cli/golem-cli/src/bridge_gen/scala/mod.rs @@ -897,15 +897,20 @@ impl ScalaBridgeGenerator { writer.line(format!("def apply({param_decls}): {FUTURE}[{ret_ty}] = {{")); writer.indent(); writer.line(format!( - "val parameters = {GUEST_CODEC}.encodeValue(methodParameters({invoke_args}))" + "{GUEST_CODEC}.encodeValueAsync(methodParameters({invoke_args})).flatMap {{ parameters =>" )); writer.line(format!( - "resolved.asyncInvokeAndAwait({method_name_lit}, parameters).map {{ __result =>" + "resolved.asyncInvokeAndAwait({method_name_lit}, parameters).flatMap {{ __result =>" )); writer.indent(); + writer.line(format!( + "{GUEST_CODEC}.decodeResultAsync(__result).map {{ __value =>" + )); writer.line(decode_block.clone()); + writer.line("}(_root_.scala.scalajs.concurrent.JSExecutionContext.Implicits.queue)"); writer.dedent(); writer.line("}(_root_.scala.scalajs.concurrent.JSExecutionContext.Implicits.queue)"); + writer.line("}(_root_.scala.scalajs.concurrent.JSExecutionContext.Implicits.queue)"); writer.dedent(); writer.line("}"); writer.blank(); @@ -915,17 +920,14 @@ impl ScalaBridgeGenerator { )); writer.indent(); writer.line(format!( - "val parameters = {GUEST_CODEC}.encodeValue(methodParameters({invoke_args}))" + "var __underlying = _root_.scala.Option.empty[_root_.golem.runtime.rpc.CancellationToken]\nvar __cancelled = false\nval __token = _root_.golem.runtime.rpc.CancellationToken.fromFunction(() => {{ __cancelled = true; __underlying.foreach(_.cancel()) }})\nval __future = {GUEST_CODEC}.encodeValueAsync(methodParameters({invoke_args})).flatMap {{ parameters =>" )); writer.line(format!( - "val (__future, __token) = resolved.cancelableAsyncInvokeAndAwait({method_name_lit}, parameters)" + "val (__rawFuture, __rawToken) = resolved.cancelableAsyncInvokeAndAwait({method_name_lit}, parameters)\n__underlying = _root_.scala.Some(__rawToken)\nif (__cancelled) __rawToken.cancel()\n__rawFuture.flatMap {{ __result => {GUEST_CODEC}.decodeResultAsync(__result).map {{ __value =>" )); - writer.line("(__future.map { __result =>"); - writer.indent(); writer.line(decode_block.clone()); - writer.dedent(); writer.line( - "}(_root_.scala.scalajs.concurrent.JSExecutionContext.Implicits.queue), __token)", + "}(_root_.scala.scalajs.concurrent.JSExecutionContext.Implicits.queue) }(_root_.scala.scalajs.concurrent.JSExecutionContext.Implicits.queue) }(_root_.scala.scalajs.concurrent.JSExecutionContext.Implicits.queue)\n(__future, __token)", ); writer.dedent(); writer.line("}"); @@ -1232,7 +1234,7 @@ impl ScalaBridgeGenerator { let name = self.multimodal_name(&cases)?; let ret_ty = self.multimodal_list_type(&name); let block = format!( - "val __tree = __result.getOrElse(throw {GUEST_CLIENT_ERROR}(\"Missing result value for an await invocation\"))\nval __value = {GUEST_CODEC}.decodeValue(__tree)\n{}.{CODECS_OBJECT}.decode{name}List(__value)", + "{}.{CODECS_OBJECT}.decode{name}List(__value)", self.client_pkg() ); return Ok((ret_ty, block)); @@ -1242,9 +1244,7 @@ impl ScalaBridgeGenerator { OutputSchema::Single(ty) => { let ret_ty = self.type_reference(ty)?; let decode = self.rewrite_guest_runtime_refs(self.decode_expr("__value", ty, 0)?); - let block = format!( - "val __tree = __result.getOrElse(throw {GUEST_CLIENT_ERROR}(\"Missing result value for an await invocation\"))\nval __value = {GUEST_CODEC}.decodeValue(__tree)\n{decode}" - ); + let block = decode; Ok((ret_ty, block)) } } @@ -3482,6 +3482,7 @@ mod tests { .unwrap(); assert!(client_source.contains("_root_.golem.schema.SchemaValue.StringValue(message)")); assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.encodeValue")); + assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.encodeValueAsync")); assert!(client_source.contains("_root_.golem.runtime.rpc.RemoteAgentClient.resolve")); assert!(client_source.contains("resolved.asyncInvokeAndAwait")); assert!(client_source.contains("def cancelable(")); @@ -3489,7 +3490,9 @@ mod tests { assert!(client_source.contains("def scheduleCancelableAt(")); assert!(client_source.contains("resolved.scheduleCancelableInvocation")); assert!(client_source.contains("_root_.golem.runtime.rpc.CancellationToken")); - assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.decodeValue")); + assert!( + client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.decodeResultAsync") + ); assert!(!client_source.contains("golem.bridge.runtime")); assert!(!client_source.contains("Bridge.createAgent")); } diff --git a/cli/golem-cli/wit/deps/golem-agent/guest.wit b/cli/golem-cli/wit/deps/golem-agent/guest.wit index dbe97ff310..d72413c288 100644 --- a/cli/golem-cli/wit/deps/golem-agent/guest.wit +++ b/cli/golem-cli/wit/deps/golem-agent/guest.wit @@ -15,8 +15,9 @@ interface guest { /// Invokes an agent. If create was not called before, it fails. /// /// `input` is a value tree whose root encodes the method's parameter list. - /// The result is `none` when the method's `output-schema` is `unit`, and - /// `some(value)` for a `single` output. + /// Streams are represented recursively by `stream-value` nodes. The result + /// is `none` when the method's `output-schema` is `unit`, and `some(value)` + /// for a `single` output. invoke: async func(method-name: string, input: schema-value-tree, principal: principal) -> result, agent-error>; /// Gets the agent type. If create was not called before, it fails diff --git a/cli/golem-cli/wit/deps/golem-core-v2/golem-core-v2.wit b/cli/golem-cli/wit/deps/golem-core-v2/golem-core-v2.wit index bb7dda191e..8a8dd02254 100644 --- a/cli/golem-cli/wit/deps/golem-core-v2/golem-core-v2.wit +++ b/cli/golem-cli/wit/deps/golem-core-v2/golem-core-v2.wit @@ -125,6 +125,17 @@ interface types { /// and reveal it only through capability-gated host interfaces. resource secret; + /// An affine wrapper around a native Component Model stream of schema + /// values. The indirection lets a stream occur anywhere in a recursive + /// `schema-value-tree` while preserving the native stream endpoint. + resource schema-value-stream { + /// Wraps any native schema-value reader for placement in a value tree. + wrap: static async func(reader: stream) -> own; + + /// Consumes a schema-value-stream wrapper and returns its native reader. + unwrap: static async func(value: own) -> stream; + } + // ============================================================ // Schema graph (self-contained type carrier) // ============================================================ @@ -524,8 +535,7 @@ interface types { // Capability nodes secret-value(own), quota-token-handle(own), - - // WASI P3 stubs (parseable only in the schema; no constructible values). + stream-value(own), } record variant-value-payload { @@ -584,4 +594,5 @@ interface types { graph: schema-graph, value: schema-value-tree, } + } diff --git a/golem-api-grpc/proto/golem/schema/schema.proto b/golem-api-grpc/proto/golem/schema/schema.proto index f7bfe3b912..4a25c64c52 100644 --- a/golem-api-grpc/proto/golem/schema/schema.proto +++ b/golem-api-grpc/proto/golem/schema/schema.proto @@ -330,9 +330,17 @@ message SchemaValue { // Capability nodes SecretValue secret_value = 70; QuotaTokenValue quota_token_value = 71; + + // Live invocation only. The ID is scoped to one live value session and + // must be resolved by that session rather than by generic protobuf decoding. + SchemaValueStreamReference stream_reference = 80; } } +message SchemaValueStreamReference { + uint64 stream_id = 1; +} + message RecordValue { repeated SchemaValue fields = 1; } diff --git a/golem-api-grpc/proto/golem/worker/invocation_session.proto b/golem-api-grpc/proto/golem/worker/invocation_session.proto new file mode 100644 index 0000000000..681436f852 --- /dev/null +++ b/golem-api-grpc/proto/golem/worker/invocation_session.proto @@ -0,0 +1,123 @@ +syntax = "proto3"; + +package golem.worker; + +import "golem/auth/auth_ctx.proto"; +import "golem/common/account_id.proto"; +import "golem/common/empty.proto"; +import "golem/common/environment.proto"; +import "golem/common/uuid.proto"; +import "golem/component/agent.proto"; +import "golem/schema/schema.proto"; +import "golem/worker/agent_config.proto"; +import "golem/worker/idempotency_key.proto"; +import "golem/worker/invocation.proto"; +import "golem/worker/invocation_context.proto"; +import "golem/worker/v1/worker_execution_error.proto"; +import "golem/worker/worker_id.proto"; +import "google/protobuf/timestamp.proto"; + +message InvocationStart { + golem.worker.AgentId agent_id = 1; + optional string method_name = 2; + golem.schema.SchemaValue input = 3; + golem.worker.IdempotencyKey idempotency_key = 4; + golem.worker.InvocationContext context = 5; + golem.auth.AuthCtx auth_ctx = 6; + golem.component.Principal principal = 7; + golem.common.EnvironmentId environment_id = 8; + repeated golem.worker.AgentConfigEntryDto config = 9; + golem.common.AccountId component_owner_account_id = 10; + golem.worker.AgentInvocationMode mode = 11; + optional google.protobuf.Timestamp schedule_at = 12; + InvocationFreshnessDisposition freshness_disposition = 13; +} + +enum InvocationFreshnessDisposition { + INVOCATION_FRESHNESS_DISPOSITION_MAY_EXIST = 0; + INVOCATION_FRESHNESS_DISPOSITION_KNOWN_FRESH = 1; +} + +message InvocationResult { + oneof result { + golem.schema.SchemaValue method_result = 1; + golem.common.Empty no_result = 2; + } + optional uint64 fuel_consumed = 3; + optional uint64 component_revision = 4; + optional golem.worker.InvocationStatus status = 5; + optional uint64 oplog_index = 6; + optional golem.common.UUID agent_fingerprint = 7; + optional golem.worker.AgentId agent_id = 8; + optional golem.worker.IdempotencyKey idempotency_key = 9; +} + +message StreamDemand { + uint64 stream_id = 1; +} + +message StreamItem { + uint64 stream_id = 1; + golem.schema.SchemaValue value = 2; +} + +message StreamEnd { + uint64 stream_id = 1; +} + +message StreamError { + uint64 stream_id = 1; + string details = 2; +} + +message StreamDetach { + uint64 stream_id = 1; +} + +message InvocationProtocolFailure { + enum Kind { + PROTOCOL = 0; + DENIED = 1; + NOT_FOUND = 2; + REMOTE_INTERNAL = 3; + TRANSPORT = 4; + } + + Kind kind = 1; + string details = 2; +} + +message InvocationCancel { + enum Kind { + SEMANTIC = 0; + TRANSPORT = 1; + PROTOCOL = 2; + } + + Kind kind = 1; + optional string details = 2; +} + +message InvocationSessionFinished { + oneof outcome { + golem.common.Empty success = 1; + golem.worker.v1.WorkerExecutionError failure = 2; + InvocationProtocolFailure protocol_failure = 3; + } +} + +message InvocationFrame { + reserved 2 to 4; + + oneof frame { + InvocationStart start = 1; + InvocationResult result = 5; + StreamDemand demand = 6; + StreamItem item = 7; + StreamEnd end = 8; + StreamError stream_error = 9; + StreamDetach detach = 10; + InvocationCancel cancel = 11; + InvocationSessionFinished finished = 12; + } +} diff --git a/golem-api-grpc/proto/golem/worker/v1/worker_service.proto b/golem-api-grpc/proto/golem/worker/v1/worker_service.proto index ff343d1c2d..f22cefea2b 100644 --- a/golem-api-grpc/proto/golem/worker/v1/worker_service.proto +++ b/golem-api-grpc/proto/golem/worker/v1/worker_service.proto @@ -18,6 +18,7 @@ import "golem/worker/filesystem.proto"; import "golem/worker/idempotency_key.proto"; import "golem/worker/invocation.proto"; import "golem/worker/invocation_context.proto"; +import "golem/worker/invocation_session.proto"; import "golem/worker/log_event.proto"; import "golem/worker/oplog_cursor.proto"; import "golem/worker/public_oplog.proto"; @@ -37,6 +38,7 @@ service WorkerService { rpc RevertWorker(RevertWorkerRequest) returns (RevertWorkerResponse); rpc CompletePromise (CompletePromiseRequest) returns (CompletePromiseResponse); rpc InvokeAgent (InvokeAgentRequest) returns (InvokeAgentResponse); + rpc InvokeAgentSession (stream golem.worker.InvocationFrame) returns (stream golem.worker.InvocationFrame); rpc CancelInvocation (CancelInvocationRequest) returns (CancelInvocationResponse); rpc ProcessOplogEntries (ProcessOplogEntriesRequest) returns (ProcessOplogEntriesResponse); } diff --git a/golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto b/golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto index d97b15fc69..606cccd014 100644 --- a/golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto +++ b/golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto @@ -10,14 +10,13 @@ import "golem/common/revert_worker_response.proto"; import "golem/common/uuid.proto"; import "golem/component/agent.proto"; import "golem/component/component_id.proto"; -import "golem/schema/schema.proto"; import "golem/shardmanager/shard_id.proto"; import "golem/worker/agent_config.proto"; import "golem/worker/cursor.proto"; import "golem/worker/filesystem.proto"; import "golem/worker/idempotency_key.proto"; -import "golem/worker/invocation.proto"; import "golem/worker/invocation_context.proto"; +import "golem/worker/invocation_session.proto"; import "golem/worker/log_event.proto"; import "golem/worker/oplog_cursor.proto"; import "golem/worker/promise_id.proto"; @@ -29,7 +28,6 @@ import "golem/worker/worker_filter.proto"; import "golem/worker/worker_id.proto"; import "golem/worker/worker_metadata.proto"; import "golem/worker/worker_status.proto"; -import "google/protobuf/timestamp.proto"; service WorkerExecutor { rpc CreateWorker(CreateWorkerRequest) returns (CreateWorkerResponse); @@ -59,7 +57,7 @@ service WorkerExecutor { rpc ActivatePlugin(ActivatePluginRequest) returns (ActivatePluginResponse); rpc DeactivatePlugin(DeactivatePluginRequest) returns (DeactivatePluginResponse); - rpc InvokeAgent(InvokeAgentRequest) returns (InvokeAgentResponse); + rpc InvokeAgentSession(stream golem.worker.InvocationFrame) returns (stream golem.worker.InvocationFrame); rpc ProcessOplogEntries(ProcessOplogEntriesRequest) returns (ProcessOplogEntriesResponse); } @@ -466,52 +464,6 @@ message CancelInvocationResponse { } } -message InvokeAgentRequest { - golem.worker.AgentId agent_id = 1; - optional string method_name = 5; - optional golem.schema.SchemaValue method_parameters = 6; - golem.worker.AgentInvocationMode mode = 7; - optional google.protobuf.Timestamp schedule_at = 8; - optional golem.worker.IdempotencyKey idempotency_key = 9; - golem.common.AccountId component_owner_account_id = 10; - golem.common.EnvironmentId environment_id = 11; - golem.auth.AuthCtx auth_ctx = 12; - optional golem.worker.InvocationContext context = 13; - golem.component.Principal principal = 14; - InvocationFreshnessDisposition freshness_disposition = 15; - repeated golem.worker.AgentConfigEntryDto config = 16; -} - -enum InvocationFreshnessDisposition { - INVOCATION_FRESHNESS_DISPOSITION_MAY_EXIST = 0; - INVOCATION_FRESHNESS_DISPOSITION_KNOWN_FRESH = 1; -} - -message InvokeAgentResponse { - oneof result { - InvokeAgentSuccess success = 1; - golem.worker.v1.WorkerExecutionError failure = 2; - } -} - -message InvokeAgentSuccess { - optional golem.schema.SchemaValue result = 1; - optional uint64 fuel_consumed = 2; - optional uint64 component_revision = 3; - optional golem.worker.InvocationStatus status = 4; - // Oplog index of the agent right after this invocation completed. - optional uint64 oplog_index = 5; - // Per-instance agent fingerprint (UUID) of the agent that produced this - // invocation result. - optional golem.common.UUID agent_fingerprint = 6; - // Final invocation target. For ephemeral agents this contains the generated - // one-shot phantom ID and can be used by observation and control APIs. - optional golem.worker.AgentId agent_id = 7; - // Final invocation key. Together with agent_id this identifies the logical - // invocation across retries and asynchronous result lookup. - optional golem.worker.IdempotencyKey idempotency_key = 8; -} - message ProcessOplogEntriesRequest { golem.worker.AgentId agent_id = 1; golem.common.EnvironmentId environment_id = 2; diff --git a/golem-api-grpc/src/lib.rs b/golem-api-grpc/src/lib.rs index d59f80deed..d4675144fd 100644 --- a/golem-api-grpc/src/lib.rs +++ b/golem-api-grpc/src/lib.rs @@ -72,3 +72,271 @@ pub mod proto { } } } + +use proto::golem::worker::{ + InvocationCancel, InvocationFrame, InvocationStart, invocation_cancel, invocation_frame, +}; + +pub fn expect_invocation_start(frame: InvocationFrame) -> Result { + match frame.frame { + Some(invocation_frame::Frame::Start(start)) => Ok(start), + Some(_) => Err("the first invocation frame must be start".to_string()), + None => Err("invocation frame has no payload".to_string()), + } +} + +pub fn validate_invocation_request_tail(frame: InvocationFrame) -> Result { + match frame.frame.as_ref() { + Some( + invocation_frame::Frame::Demand(_) + | invocation_frame::Frame::Item(_) + | invocation_frame::Frame::End(_) + | invocation_frame::Frame::StreamError(_) + | invocation_frame::Frame::Detach(_), + ) => Ok(frame), + Some(invocation_frame::Frame::Cancel(cancel)) => { + let kind = cancel.kind; + invocation_cancel::Kind::try_from(kind) + .map(|_| frame) + .map_err(|_| format!("invalid invocation cancellation kind {kind}")) + } + Some(invocation_frame::Frame::Start(_)) => { + Err("invocation start may only appear as the first frame".to_string()) + } + Some(invocation_frame::Frame::Result(_) | invocation_frame::Frame::Finished(_)) => { + Err("response frame received on invocation request stream".to_string()) + } + None => Err("invocation frame has no payload".to_string()), + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum InvocationResponsePhase { + BeforeResult, + AfterResult, + Complete, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct InvocationResponseState { + phase: InvocationResponsePhase, +} + +impl Default for InvocationResponseState { + fn default() -> Self { + Self { + phase: InvocationResponsePhase::BeforeResult, + } + } +} + +impl InvocationResponseState { + pub fn validate(&mut self, frame: &InvocationFrame) -> Result<(), String> { + if self.phase == InvocationResponsePhase::Complete { + return Err("invocation response frame received after completion".to_string()); + } + + match frame.frame.as_ref() { + Some(invocation_frame::Frame::Start(_)) | Some(invocation_frame::Frame::Cancel(_)) => { + Err("request frame received on invocation response stream".to_string()) + } + Some(invocation_frame::Frame::Result(_)) => match self.phase { + InvocationResponsePhase::BeforeResult => { + self.phase = InvocationResponsePhase::AfterResult; + Ok(()) + } + InvocationResponsePhase::AfterResult => { + Err("invocation response contains more than one result".to_string()) + } + InvocationResponsePhase::Complete => unreachable!(), + }, + Some(invocation_frame::Frame::Finished(finished)) => { + use proto::golem::worker::invocation_session_finished::Outcome; + + match finished.outcome.as_ref() { + Some(Outcome::Success(_)) + if self.phase == InvocationResponsePhase::BeforeResult => + { + return Err( + "invocation completed successfully before publishing a result" + .to_string(), + ); + } + Some(Outcome::ProtocolFailure(failure)) => { + if proto::golem::worker::invocation_protocol_failure::Kind::try_from( + failure.kind, + ) + .is_err() + { + return Err(format!( + "invalid invocation protocol failure kind {}", + failure.kind + )); + } + } + Some(Outcome::Success(_) | Outcome::Failure(_)) => {} + None => return Err("invocation completion has no outcome".to_string()), + } + self.phase = InvocationResponsePhase::Complete; + Ok(()) + } + Some( + invocation_frame::Frame::Demand(_) + | invocation_frame::Frame::Item(_) + | invocation_frame::Frame::End(_) + | invocation_frame::Frame::StreamError(_) + | invocation_frame::Frame::Detach(_), + ) => Ok(()), + None => Err("invocation frame has no payload".to_string()), + } + } + + pub fn is_complete(&self) -> bool { + self.phase == InvocationResponsePhase::Complete + } +} + +pub fn invocation_cancel_frame( + kind: invocation_cancel::Kind, + details: Option, +) -> InvocationFrame { + InvocationFrame { + frame: Some(invocation_frame::Frame::Cancel(InvocationCancel { + kind: kind as i32, + details, + })), + } +} + +#[cfg(test)] +mod protocol_tests { + use super::*; + use proto::golem::common::Empty; + use proto::golem::worker::invocation_session_finished::Outcome; + use proto::golem::worker::{InvocationResult, InvocationSessionFinished, StreamDemand}; + use test_r::test; + + fn response_frame(frame: invocation_frame::Frame) -> InvocationFrame { + InvocationFrame { frame: Some(frame) } + } + + fn successful_completion() -> invocation_frame::Frame { + invocation_frame::Frame::Finished(InvocationSessionFinished { + outcome: Some(Outcome::Success(Empty {})), + }) + } + + #[test] + fn request_start_rules() { + assert!(expect_invocation_start(InvocationFrame::default()).is_err()); + assert!( + expect_invocation_start(response_frame(invocation_frame::Frame::Result( + InvocationResult::default(), + ))) + .is_err() + ); + assert!( + expect_invocation_start(response_frame(invocation_frame::Frame::Start( + InvocationStart::default(), + ))) + .is_ok() + ); + } + + #[test] + fn request_tail_rules() { + assert!( + validate_invocation_request_tail(response_frame(invocation_frame::Frame::Demand( + StreamDemand { stream_id: 1 }, + ))) + .is_ok() + ); + assert!( + validate_invocation_request_tail(invocation_cancel_frame( + invocation_cancel::Kind::Semantic, + None, + )) + .is_ok() + ); + + let invalid = [ + InvocationFrame::default(), + response_frame(invocation_frame::Frame::Start(InvocationStart::default())), + response_frame(invocation_frame::Frame::Result(InvocationResult::default())), + response_frame(successful_completion()), + ]; + for frame in invalid { + assert!(validate_invocation_request_tail(frame).is_err()); + } + } + + #[test] + fn response_requires_one_result_before_successful_completion() { + let mut state = InvocationResponseState::default(); + assert!( + state + .validate(&response_frame(invocation_frame::Frame::Demand( + StreamDemand { stream_id: 1 }, + ))) + .is_ok() + ); + assert!( + state + .validate(&response_frame(successful_completion())) + .is_err() + ); + assert!( + state + .validate(&response_frame(invocation_frame::Frame::Result( + InvocationResult::default(), + ))) + .is_ok() + ); + assert!( + state + .validate(&response_frame(invocation_frame::Frame::Result( + InvocationResult::default(), + ))) + .is_err() + ); + assert!( + state + .validate(&response_frame(successful_completion())) + .is_ok() + ); + assert!(state.is_complete()); + } + + #[test] + fn response_failure_is_a_single_completion() { + let mut state = InvocationResponseState::default(); + let failure = || { + response_frame(invocation_frame::Frame::Finished( + InvocationSessionFinished { + outcome: Some(Outcome::ProtocolFailure( + proto::golem::worker::InvocationProtocolFailure { + kind: proto::golem::worker::invocation_protocol_failure::Kind::Protocol + as i32, + details: "failed".to_string(), + }, + )), + }, + )) + }; + assert!(state.validate(&failure()).is_ok()); + assert!(state.is_complete()); + assert!(state.validate(&failure()).is_err()); + } + + #[test] + fn response_rejects_request_and_empty_frames() { + let invalid = [ + InvocationFrame::default(), + response_frame(invocation_frame::Frame::Start(InvocationStart::default())), + invocation_cancel_frame(invocation_cancel::Kind::Semantic, None), + ]; + for frame in invalid { + assert!(InvocationResponseState::default().validate(&frame).is_err()); + } + } +} diff --git a/golem-common/src/model/agent/extraction.rs b/golem-common/src/model/agent/extraction.rs index 0a4f90ae48..2af065cf4a 100644 --- a/golem-common/src/model/agent/extraction.rs +++ b/golem-common/src/model/agent/extraction.rs @@ -20,6 +20,7 @@ use crate::schema::tool::Tool; use crate::schema::tool::validation::validate_tool; use crate::schema::tool::wit::{decode_tool, wire as tool_wire}; use anyhow::anyhow; +use golem_schema::schema::SchemaValueStreamHandleRep; use golem_schema::schema::wit::{ QuotaTokenHandleDropper, QuotaTokenHandleRep, SecretHandleDropper, SecretHandleRep, }; @@ -516,6 +517,10 @@ fn is_secret_resource(interface_name: &str, resource_name: &str) -> bool { ) } +fn is_schema_value_stream_resource(interface_name: &str, resource_name: &str) -> bool { + interface_name == "golem:core/types@2.0.0" && resource_name == "schema-value-stream" +} + fn dynamic_import( name: &str, engine: &Engine, @@ -582,6 +587,12 @@ fn dynamic_import( ResourceType::host::(), |_store, _rep| Ok(()), )?; + } else if is_schema_value_stream_resource(&name, &inner_name) { + instance.resource( + &inner_name, + ResourceType::host::(), + |_store, _rep| Ok(()), + )?; } else if &inner_name != "pollable" && inner_name != "wasi-io-pollable" && &inner_name != "input-stream" diff --git a/golem-common/src/model/component_metadata.rs b/golem-common/src/model/component_metadata.rs index 379c44c812..bdf5502191 100644 --- a/golem-common/src/model/component_metadata.rs +++ b/golem-common/src/model/component_metadata.rs @@ -717,17 +717,21 @@ mod protobuf { } } - impl From for golem_api_grpc::proto::golem::component::ComponentMetadata { - fn from(value: ComponentMetadata) -> Self { - value.data.as_ref().clone().into() + impl TryFrom for golem_api_grpc::proto::golem::component::ComponentMetadata { + type Error = String; + + fn try_from(value: ComponentMetadata) -> Result { + value.data.as_ref().clone().try_into() } } - impl From + impl TryFrom for golem_api_grpc::proto::golem::component::ComponentMetadata { - fn from(value: ComponentMetadataInnerData) -> Self { - Self { + type Error = String; + + fn try_from(value: ComponentMetadataInnerData) -> Result { + Ok(Self { known_exports: Some(value.known_exports.into()), producers: value .producers @@ -745,16 +749,9 @@ mod protobuf { agent_type_provision_configs: value .agent_type_provision_configs .into_iter() - .map(|(k, v)| { - ( - k.0, - golem_api_grpc::proto::golem::component::AgentTypeProvisionConfig::from( - v, - ), - ) - }) - .collect(), - } + .map(|(k, v)| v.try_into().map(|config| (k.0, config))) + .collect::>()?, + }) } } @@ -798,21 +795,23 @@ mod protobuf { } } - impl From + impl TryFrom for golem_api_grpc::proto::golem::component::AgentTypeProvisionConfig { - fn from(config: AgentTypeProvisionConfig) -> Self { + type Error = String; + + fn try_from(config: AgentTypeProvisionConfig) -> Result { use crate::base_model::component::{InitialAgentFile, InstalledPlugin}; - Self { + Ok(Self { initial_permissions: crate::serialization::serialize(&config.initial_permissions) .expect("failed to serialize agent initial permission card"), env: config.env.into_iter().collect(), config: config .config .into_iter() - .map(golem_api_grpc::proto::golem::worker::TypedAgentConfigEntry::from) - .collect(), + .map(TryInto::try_into) + .collect::>()?, plugins: config .plugins .into_iter() @@ -827,7 +826,7 @@ mod protobuf { golem_api_grpc::proto::golem::component::InitialAgentFile::from(f) }) .collect(), - } + }) } } } @@ -958,7 +957,8 @@ mod tests { )]), ); - let proto: golem_api_grpc::proto::golem::component::ComponentMetadata = metadata.into(); + let proto: golem_api_grpc::proto::golem::component::ComponentMetadata = + metadata.try_into().unwrap(); let decoded = ComponentMetadata::try_from(proto).unwrap(); assert_eq!( @@ -982,7 +982,8 @@ mod tests { BTreeMap::new(), ); - let proto: golem_api_grpc::proto::golem::component::ComponentMetadata = metadata.into(); + let proto: golem_api_grpc::proto::golem::component::ComponentMetadata = + metadata.try_into().unwrap(); let decoded = ComponentMetadata::try_from(proto).unwrap(); assert!(decoded.memories()[0].shared); diff --git a/golem-common/src/model/oplog/matcher.rs b/golem-common/src/model/oplog/matcher.rs index 1d32540f32..e07df506a1 100644 --- a/golem-common/src/model/oplog/matcher.rs +++ b/golem-common/src/model/oplog/matcher.rs @@ -788,6 +788,7 @@ impl PublicOplogEntry { SchemaValue::QuotaToken(payload) => { Self::string_match(&payload.resource_name, path_stack, query_path, query) } + SchemaValue::Stream(_) => false, } } } diff --git a/golem-common/src/model/oplog/protobuf.rs b/golem-common/src/model/oplog/protobuf.rs index 1f85c40bf3..9560866bee 100644 --- a/golem-common/src/model/oplog/protobuf.rs +++ b/golem-common/src/model/oplog/protobuf.rs @@ -71,14 +71,16 @@ use golem_api_grpc::proto::golem::worker::{ use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::num::NonZeroU64; -impl From +impl TryFrom for golem_api_grpc::proto::golem::worker::PublicTypedAgentConfigEntry { - fn from(value: PublicTypedAgentConfigEntry) -> Self { - Self { + type Error = String; + + fn try_from(value: PublicTypedAgentConfigEntry) -> Result { + Ok(Self { path: value.path, - value: Some(value.value.into()), - } + value: Some(value.value.try_into()?), + }) } } @@ -1063,8 +1065,8 @@ impl TryFrom for golem_api_grpc::proto::golem::worker::OplogEn config: create .local_agent_config .into_iter() - .map(Into::into) - .collect(), + .map(TryInto::try_into) + .collect::>()?, created_by: Some(create.created_by.into()), environment_id: Some(create.environment_id.into()), parent: create.parent.map(Into::into), @@ -1087,7 +1089,7 @@ impl TryFrom for golem_api_grpc::proto::golem::worker::OplogEn timestamp: Some(start.timestamp.into()), parent_start_index: start.parent_start_index.map(|id| id.as_u64()), function_name: start.function_name.clone(), - request: start.request.map(Into::into), + request: start.request.map(TryInto::try_into).transpose()?, durable_function_type: Some(start.durable_function_type.into()), }, )), @@ -1098,7 +1100,7 @@ impl TryFrom for golem_api_grpc::proto::golem::worker::OplogEn golem_api_grpc::proto::golem::worker::EndParameters { timestamp: Some(end.timestamp.into()), start_index: end.start_index.as_u64(), - response: end.response.map(Into::into), + response: end.response.map(TryInto::try_into).transpose()?, forced_commit: end.forced_commit, }, )), @@ -1109,7 +1111,7 @@ impl TryFrom for golem_api_grpc::proto::golem::worker::OplogEn golem_api_grpc::proto::golem::worker::CancelledParameters { timestamp: Some(cancelled.timestamp.into()), start_index: cancelled.start_index.as_u64(), - partial: cancelled.partial.map(Into::into), + partial: cancelled.partial.map(TryInto::try_into).transpose()?, }, )), } @@ -1632,7 +1634,7 @@ impl TryFrom for golem_api_grpc::proto::golem::worker::OplogEn timestamp: Some(params.timestamp.into()), parent_start_index: params.parent_start_index.as_u64(), kind: host_stream_kind_to_proto(params.kind) as i32, - payload: Some(params.payload.into()), + payload: Some(params.payload.try_into()?), }, )), } @@ -1883,7 +1885,7 @@ impl TryFrom Invocation::AgentInitialization( golem_api_grpc::proto::golem::worker::PublicAgentInitializationInvocation { idempotency_key: Some(init.idempotency_key.into()), - constructor_parameters: Some(init.constructor_parameters.into()), + constructor_parameters: Some(init.constructor_parameters.try_into()?), trace_id: init.trace_id.to_string(), trace_states: init.trace_states, invocation_context, @@ -1896,7 +1898,7 @@ impl TryFrom golem_api_grpc::proto::golem::worker::PublicAgentMethodInvocation { idempotency_key: Some(method.idempotency_key.into()), method_name: method.method_name, - function_input: Some(method.function_input.into()), + function_input: Some(method.function_input.try_into()?), trace_id: method.trace_id.to_string(), trace_states: method.trace_states, invocation_context, @@ -2091,10 +2093,10 @@ impl TryFrom use golem_api_grpc::proto::golem::worker::public_agent_invocation_result::Result as ProtoResult; let result = match value { PublicAgentInvocationResult::AgentInitialization(output) => { - ProtoResult::AgentInitializationOutput(output.output.into()) + ProtoResult::AgentInitializationOutput(output.output.try_into()?) } PublicAgentInvocationResult::AgentMethod(output) => { - ProtoResult::AgentMethodOutput(output.output.into()) + ProtoResult::AgentMethodOutput(output.output.try_into()?) } PublicAgentInvocationResult::ManualUpdate(_) => { ProtoResult::ManualUpdate(golem_api_grpc::proto::golem::common::Empty {}) diff --git a/golem-common/src/model/worker.rs b/golem-common/src/model/worker.rs index 0589e1f90f..bb46fcb911 100644 --- a/golem-common/src/model/worker.rs +++ b/golem-common/src/model/worker.rs @@ -177,8 +177,10 @@ mod protobuf { } } - impl From for golem_api_grpc::proto::golem::worker::AgentMetadata { - fn from(value: AgentMetadataDto) -> Self { + impl TryFrom for golem_api_grpc::proto::golem::worker::AgentMetadata { + type Error = String; + + fn try_from(value: AgentMetadataDto) -> Result { let mut owned_resources = Vec::new(); for instance in value.exported_resource_instances { owned_resources.push(golem_api_grpc::proto::golem::worker::ResourceDescription { @@ -189,12 +191,16 @@ mod protobuf { }); } - Self { + Ok(Self { agent_id: Some(value.agent_id.into()), environment_id: Some(value.environment_id.into()), created_by: Some(value.created_by.into()), env: value.env, - config: value.config.into_iter().map(Into::into).collect(), + config: value + .config + .into_iter() + .map(TryInto::try_into) + .collect::>()?, status: value.status.into(), component_revision: value.component_revision.into(), retry_count: value.retry_count, @@ -222,7 +228,7 @@ mod protobuf { .collect(), oplog_idx: u64::from(value.last_oplog_index), fingerprint: Some(value.fingerprint.0.into()), - } + }) } } @@ -425,12 +431,16 @@ mod protobuf { } } - impl From for golem_api_grpc::proto::golem::worker::TypedAgentConfigEntry { - fn from(value: TypedAgentConfigEntry) -> Self { - Self { + impl TryFrom + for golem_api_grpc::proto::golem::worker::TypedAgentConfigEntry + { + type Error = String; + + fn try_from(value: TypedAgentConfigEntry) -> Result { + Ok(Self { path: value.path, - value: Some(value.value.into()), - } + value: Some(value.value.try_into()?), + }) } } } diff --git a/golem-common/src/schema/agent/mod.rs b/golem-common/src/schema/agent/mod.rs index 8bdea52faa..6685eadf18 100644 --- a/golem-common/src/schema/agent/mod.rs +++ b/golem-common/src/schema/agent/mod.rs @@ -39,6 +39,7 @@ use crate::schema::graph::{SchemaGraph, TypedSchemaValue}; use crate::schema::metadata::MetadataEnvelope; use crate::schema::schema_type::{NamedFieldType, SchemaType}; use crate::schema::schema_value::SchemaValue; +use crate::schema::validation::placement::validate_agent_type_placement; use crate::schema::validation::value::validate_value; use golem_schema_derive::{FromSchema, IntoSchema}; use serde::{Deserialize, Serialize}; @@ -496,11 +497,8 @@ impl AgentTypeSchema { agent_types.into_iter().map(Self::normalized).collect() } - /// Validates the semantic constraints of the agent type. Mirrors the legacy - /// `AgentType::validate`: ephemeral agents must not declare read-only - /// methods (there is no shared state to read from). Additionally rejects - /// the WASI P3 stub types (`future`/`stream`) anywhere in the agent's - /// schemas — see [`reject_p3_stub_types`]. + /// Validates semantic constraints of the agent type, including stream + /// placement and definitions that are not reachable from an allowed use. pub fn validate(&self) -> Result<(), String> { if self.mode == AgentMode::Ephemeral { for method in &self.methods { @@ -514,142 +512,156 @@ impl AgentTypeSchema { } } } - reject_p3_stub_types(self) - } -} - -/// Rejects the WASI P3 stub types (`future`/`stream`) anywhere in an agent -/// type's schemas: shared type definitions, constructor and method inputs, -/// method outputs, config value types, and the same positions of every -/// dependency. -/// -/// These types parse ([`SchemaType::Future`] / [`SchemaType::Stream`]) but -/// have no [`SchemaValue`] representation and cannot be marshalled across the -/// invocation boundary, so accepting them at upload time would only defer the -/// failure to invocation time as a confusing shape mismatch. `error-context` -/// has no [`SchemaType`] representation at all, so it cannot occur here. -fn reject_p3_stub_types(agent_type: &AgentTypeSchema) -> Result<(), String> { - check_signatures_for_p3_stubs( - &agent_type.type_name, - None, - &agent_type.schema, - &agent_type.constructor, - &agent_type.methods, - )?; - for config in &agent_type.config { - if let Some(kind) = find_p3_stub(&config.value_type) { - return Err(p3_stub_error( - &agent_type.type_name, - &format!("config value at path '{}'", config.path.join(".")), - kind, - )); + validate_agent_type_placement(self).map_err(|errors| { + errors + .into_iter() + .map(|error| error.to_string()) + .collect::>() + .join("; ") + })?; + validate_schema_definitions(&self.type_name, None, &self.schema, &self.methods)?; + for dependency in &self.dependencies { + validate_schema_definitions( + &self.type_name, + Some(&dependency.type_name), + &dependency.schema, + &dependency.methods, + )?; } + Ok(()) } - for dependency in &agent_type.dependencies { - check_signatures_for_p3_stubs( - &agent_type.type_name, - Some(&dependency.type_name), - &dependency.schema, - &dependency.constructor, - &dependency.methods, - )?; - } - Ok(()) } -/// Checks one (graph, constructor, methods) signature set for P3 stub types. -/// `dependency` prefixes the reported location when the set belongs to an -/// [`AgentDependencySchema`] rather than the agent type itself. -fn check_signatures_for_p3_stubs( +fn validate_schema_definitions( agent: &AgentTypeName, dependency: Option<&str>, graph: &SchemaGraph, - constructor: &AgentConstructorSchema, methods: &[AgentMethodSchema], ) -> Result<(), String> { - let loc = |location: String| match dependency { - Some(dep) => format!("dependency '{dep}' {location}"), - None => location, - }; - for def in &graph.defs { - if let Some(kind) = find_p3_stub(&def.body) { - return Err(p3_stub_error( - agent, - &loc(format!("shared type definition '{}'", def.id)), - kind, - )); - } - } - for field in constructor.input_schema.fields() { - if let Some(kind) = find_p3_stub(&field.schema) { - return Err(p3_stub_error( - agent, - &loc(format!("constructor parameter '{}'", field.name)), - kind, + let owner = dependency + .map(|name| format!("dependency '{name}' ")) + .unwrap_or_default(); + let method_definitions = methods + .iter() + .flat_map(|method| { + let inputs = method + .input_schema + .fields() + .iter() + .filter(|field| matches!(field.source, FieldSource::UserSupplied)) + .map(|field| &field.schema); + let output = method.output_schema.schema().into_iter(); + inputs.chain(output) + }) + .flat_map(|root| reachable_defs(graph, root)) + .map(|definition| definition.id) + .collect::>(); + + for definition in &graph.defs { + if contains_future(&definition.body) { + return Err(format!( + "Agent type '{agent}' {owner}shared type definition '{}' contains the unsupported type 'future'", + definition.id )); } - } - for method in methods { - for field in method.input_schema.fields() { - if let Some(kind) = find_p3_stub(&field.schema) { - return Err(p3_stub_error( - agent, - &loc(format!( - "method '{}' parameter '{}'", - method.name, field.name - )), - kind, - )); - } - } - if let Some(output) = method.output_schema.schema() - && let Some(kind) = find_p3_stub(output) + if contains_stream_in_graph(graph, &definition.body) + && !method_definitions.contains(&definition.id) { - return Err(p3_stub_error( - agent, - &loc(format!("method '{}' output", method.name)), - kind, + return Err(format!( + "Agent type '{agent}' {owner}shared type definition '{}' contains a stream but is not reachable from a caller-supplied method input or method output", + definition.id )); } } Ok(()) } -fn p3_stub_error(agent: &AgentTypeName, location: &str, kind: &str) -> String { - format!( - "Agent type '{agent}' uses the unsupported type '{kind}' in {location}. \ - Stream, future, and error-context types have no value representation and \ - cannot be used in agent constructor, method, or config schemas." - ) +pub fn contains_stream_in_graph(graph: &SchemaGraph, ty: &SchemaType) -> bool { + contains_stream(ty) + || reachable_defs(graph, ty) + .iter() + .any(|definition| contains_stream(&definition.body)) +} + +fn contains_future(ty: &SchemaType) -> bool { + match ty { + SchemaType::Future { .. } => true, + SchemaType::Record { fields, .. } => { + fields.iter().any(|field| contains_future(&field.body)) + } + SchemaType::Variant { cases, .. } => cases + .iter() + .filter_map(|case| case.payload.as_ref()) + .any(contains_future), + SchemaType::Tuple { elements, .. } => elements.iter().any(contains_future), + SchemaType::List { element, .. } | SchemaType::FixedList { element, .. } => { + contains_future(element) + } + SchemaType::Map { key, value, .. } => contains_future(key) || contains_future(value), + SchemaType::Option { inner, .. } => contains_future(inner), + SchemaType::Result { spec, .. } => { + spec.ok.as_deref().is_some_and(contains_future) + || spec.err.as_deref().is_some_and(contains_future) + } + SchemaType::Union { spec, .. } => spec + .branches + .iter() + .any(|branch| contains_future(&branch.body)), + SchemaType::Secret { spec, .. } => contains_future(&spec.inner), + SchemaType::Stream { inner, .. } => inner.as_deref().is_some_and(contains_future), + SchemaType::Ref { .. } + | SchemaType::Bool { .. } + | SchemaType::S8 { .. } + | SchemaType::S16 { .. } + | SchemaType::S32 { .. } + | SchemaType::S64 { .. } + | SchemaType::U8 { .. } + | SchemaType::U16 { .. } + | SchemaType::U32 { .. } + | SchemaType::U64 { .. } + | SchemaType::F32 { .. } + | SchemaType::F64 { .. } + | SchemaType::Char { .. } + | SchemaType::String { .. } + | SchemaType::Enum { .. } + | SchemaType::Flags { .. } + | SchemaType::Text { .. } + | SchemaType::Binary { .. } + | SchemaType::Path { .. } + | SchemaType::Url { .. } + | SchemaType::Datetime { .. } + | SchemaType::Duration { .. } + | SchemaType::Quantity { .. } + | SchemaType::QuotaToken { .. } => false, + } } -/// Finds the first WASI P3 stub node (`future`/`stream`) in `ty`, descending -/// through all structural children but not following refs — named definitions -/// are scanned directly by [`check_signatures_for_p3_stubs`]. Returns the -/// offending node's kind name. -fn find_p3_stub(ty: &SchemaType) -> Option<&'static str> { +fn contains_stream(ty: &SchemaType) -> bool { match ty { - SchemaType::Future { .. } => Some("future"), - SchemaType::Stream { .. } => Some("stream"), - SchemaType::Record { fields, .. } => fields.iter().find_map(|f| find_p3_stub(&f.body)), + SchemaType::Stream { .. } => true, + SchemaType::Record { fields, .. } => { + fields.iter().any(|field| contains_stream(&field.body)) + } SchemaType::Variant { cases, .. } => cases .iter() - .find_map(|c| c.payload.as_ref().and_then(find_p3_stub)), - SchemaType::Tuple { elements, .. } => elements.iter().find_map(find_p3_stub), + .filter_map(|case| case.payload.as_ref()) + .any(contains_stream), + SchemaType::Tuple { elements, .. } => elements.iter().any(contains_stream), SchemaType::List { element, .. } | SchemaType::FixedList { element, .. } => { - find_p3_stub(element) + contains_stream(element) + } + SchemaType::Map { key, value, .. } => contains_stream(key) || contains_stream(value), + SchemaType::Option { inner, .. } => contains_stream(inner), + SchemaType::Result { spec, .. } => { + spec.ok.as_deref().is_some_and(contains_stream) + || spec.err.as_deref().is_some_and(contains_stream) } - SchemaType::Map { key, value, .. } => find_p3_stub(key).or_else(|| find_p3_stub(value)), - SchemaType::Option { inner, .. } => find_p3_stub(inner), - SchemaType::Result { spec, .. } => spec - .ok - .as_deref() - .and_then(find_p3_stub) - .or_else(|| spec.err.as_deref().and_then(find_p3_stub)), - SchemaType::Union { spec, .. } => spec.branches.iter().find_map(|b| find_p3_stub(&b.body)), - // Leaf nodes carrying no child `SchemaType`. Listed explicitly (no - // wildcard) so a future child-bearing variant forces this match to be - // updated. + SchemaType::Union { spec, .. } => spec + .branches + .iter() + .any(|branch| contains_stream(&branch.body)), + SchemaType::Secret { spec, .. } => contains_stream(&spec.inner), + SchemaType::Future { inner, .. } => inner.as_deref().is_some_and(contains_stream), SchemaType::Ref { .. } | SchemaType::Bool { .. } | SchemaType::S8 { .. } @@ -673,8 +685,7 @@ fn find_p3_stub(ty: &SchemaType) -> Option<&'static str> { | SchemaType::Datetime { .. } | SchemaType::Duration { .. } | SchemaType::Quantity { .. } - | SchemaType::Secret { .. } - | SchemaType::QuotaToken { .. } => None, + | SchemaType::QuotaToken { .. } => false, } } diff --git a/golem-common/src/schema/agent/tests.rs b/golem-common/src/schema/agent/tests.rs index d4f72f488d..5648be45c8 100644 --- a/golem-common/src/schema/agent/tests.rs +++ b/golem-common/src/schema/agent/tests.rs @@ -17,7 +17,7 @@ use crate::base_model::agent::{AgentConfigSource, AgentMode, AgentTypeName, Snap use crate::schema::agent::{ AgentConfigDeclarationSchema, AgentConstructorSchema, AgentDependencySchema, AgentMethodSchema, AgentTypeSchema, AutoInjectedKind, FieldSource, InputSchema, NamedField, OutputSchema, - ParsedAgentId, json_input_schema_value_to_typed_schema_value, + ParsedAgentId, contains_stream_in_graph, json_input_schema_value_to_typed_schema_value, typed_schema_value_with_projected_defs, }; use crate::schema::graph::{SchemaGraph, SchemaTypeDef, TypedSchemaValue}; @@ -652,7 +652,7 @@ fn projected_helper_drops_all_defs_for_ref_free_root() { assert!(typed.graph().defs.is_empty()); } -// --- AgentTypeSchema::validate: rejection of P3 stub types (future/stream) --- +// --- AgentTypeSchema::validate: stream placement and shared definitions --- fn method(name: &str, input: Vec, output: OutputSchema) -> AgentMethodSchema { AgentMethodSchema { @@ -680,22 +680,54 @@ fn validate_accepts_agent_type_without_p3_stubs() { } #[test] -fn validate_rejects_stream_in_method_output() { +fn validate_accepts_streams_in_method_input_and_output() { let agent = AgentTypeSchema { methods: vec![method( - "download", - vec![], + "transform", + vec![NamedField::user_supplied( + "input", + SchemaType::stream(Some(SchemaType::string())), + )], OutputSchema::Single(Box::new(SchemaType::stream(Some(SchemaType::u8())))), )], ..sample_agent_type() }; - let err = agent - .validate() - .expect_err("stream output must be rejected"); + agent.validate().expect("method streams must be accepted"); +} + +#[test] +fn stream_classification_ignores_definitions_unreachable_from_the_method() { + let graph = registry(vec![ + proj_def("Plain", SchemaType::string()), + proj_def( + "UnrelatedStream", + SchemaType::stream(Some(SchemaType::u8())), + ), + ]); + let method = method( + "plain", + vec![NamedField::user_supplied( + "input", + SchemaType::ref_to(TypeId::new("Plain")), + )], + OutputSchema::Single(Box::new(SchemaType::u64())), + ); + assert!( - err.contains("unsupported type 'stream'") && err.contains("method 'download' output"), - "unexpected error: {err}" + method + .input_schema + .fields() + .iter() + .all(|field| !contains_stream_in_graph(&graph, &field.schema)) ); + assert!( + !contains_stream_in_graph(&graph, method.output_schema.schema().unwrap()), + "the unrelated stream definition must not classify the method as streaming" + ); + assert!(contains_stream_in_graph( + &graph, + &SchemaType::ref_to(TypeId::new("UnrelatedStream")) + )); } #[test] @@ -715,8 +747,50 @@ fn validate_rejects_future_in_method_parameter() { .validate() .expect_err("future parameter must be rejected"); assert!( - err.contains("unsupported type 'future'") - && err.contains("method 'wait-for' parameter 'signal'"), + err.contains("future values are not allowed in scope AgentMethodInput"), + "unexpected error: {err}" + ); +} + +#[test] +fn validate_rejects_future_in_unreferenced_shared_definition() { + let agent = AgentTypeSchema { + schema: registry(vec![proj_def( + "UnusedFuture", + SchemaType::future(Some(SchemaType::string())), + )]), + ..sample_agent_type() + }; + let err = agent + .validate() + .expect_err("future must be rejected even in an unreferenced definition"); + assert!( + err.contains( + "shared type definition 'UnusedFuture' contains the unsupported type 'future'" + ), + "unexpected error: {err}" + ); +} + +#[test] +fn validate_rejects_stream_in_auto_injected_method_parameter() { + let agent = AgentTypeSchema { + methods: vec![method( + "invalid", + vec![NamedField::auto_injected( + "principal", + AutoInjectedKind::Principal, + SchemaType::stream(Some(SchemaType::string())), + )], + OutputSchema::Unit, + )], + ..sample_agent_type() + }; + let err = agent + .validate() + .expect_err("auto-injected streams must be rejected"); + assert!( + err.contains("stream values are not allowed in scope Boundary"), "unexpected error: {err}" ); } @@ -740,29 +814,43 @@ fn validate_rejects_stream_nested_in_constructor_parameter() { .validate() .expect_err("nested stream in constructor must be rejected"); assert!( - err.contains("unsupported type 'stream'") - && err.contains("constructor parameter 'sources'"), + err.contains("stream values are not allowed in scope Constructor"), "unexpected error: {err}" ); } #[test] -fn validate_rejects_stream_in_shared_type_definition() { +fn validate_accepts_stream_in_shared_type_definition_used_by_method() { let agent = AgentTypeSchema { schema: registry(vec![proj_def( "Chunks", SchemaType::stream(Some(SchemaType::u8())), )]), + methods: vec![method( + "download", + vec![], + OutputSchema::Single(Box::new(SchemaType::ref_to(TypeId::new("Chunks")))), + )], + ..sample_agent_type() + }; + agent + .validate() + .expect("method may reference a shared stream definition"); +} + +#[test] +fn validate_rejects_stream_in_unreferenced_shared_definition() { + let agent = AgentTypeSchema { + schema: registry(vec![proj_def( + "UnusedStream", + SchemaType::stream(Some(SchemaType::string())), + )]), ..sample_agent_type() }; - let err = agent + + agent .validate() - .expect_err("stream in a shared type definition must be rejected"); - assert!( - err.contains("unsupported type 'stream'") - && err.contains("shared type definition 'Chunks'"), - "unexpected error: {err}" - ); + .expect_err("streams are allowed only at explicit agent method input/output positions"); } #[test] @@ -779,13 +867,13 @@ fn validate_rejects_future_in_config_value_type() { .validate() .expect_err("future config value type must be rejected"); assert!( - err.contains("unsupported type 'future'") && err.contains("config value at path 'a.b'"), + err.contains("future values are not allowed in scope Boundary"), "unexpected error: {err}" ); } #[test] -fn validate_rejects_stream_in_dependency_method_parameter() { +fn validate_accepts_stream_in_dependency_method_parameter() { let agent = AgentTypeSchema { dependencies: vec![AgentDependencySchema { type_name: "helper".to_string(), @@ -808,12 +896,7 @@ fn validate_rejects_stream_in_dependency_method_parameter() { }], ..sample_agent_type() }; - let err = agent + agent .validate() - .expect_err("stream in a dependency method must be rejected"); - assert!( - err.contains("unsupported type 'stream'") - && err.contains("dependency 'helper' method 'feed' parameter 'data'"), - "unexpected error: {err}" - ); + .expect("dependency method streams must be accepted"); } diff --git a/golem-common/src/schema/mod.rs b/golem-common/src/schema/mod.rs index 55ddef7cc5..7757b2f934 100644 --- a/golem-common/src/schema/mod.rs +++ b/golem-common/src/schema/mod.rs @@ -33,7 +33,7 @@ pub use golem_schema::schema::proptest_strategies; pub use golem_schema::schema::wit; pub use golem_schema::schema::{ canonical, conversion, derive, graph, host_managed, metadata, multimodal, schema_type, - schema_value, unstructured, + schema_value, stream, unstructured, }; #[cfg(test)] diff --git a/golem-common/src/schema/render/json_value.rs b/golem-common/src/schema/render/json_value.rs index 33fdc8405d..75591958e9 100644 --- a/golem-common/src/schema/render/json_value.rs +++ b/golem-common/src/schema/render/json_value.rs @@ -1095,6 +1095,7 @@ fn value_name(value: &SchemaValue) -> &'static str { SchemaValue::Union(_) => "union", SchemaValue::Secret(_) => "secret", SchemaValue::QuotaToken(_) => "quota-token", + SchemaValue::Stream(_) => "stream", } } diff --git a/golem-common/src/schema/tests/protobuf_tests.rs b/golem-common/src/schema/tests/protobuf_tests.rs index 42c8e2652b..4d72f6a962 100644 --- a/golem-common/src/schema/tests/protobuf_tests.rs +++ b/golem-common/src/schema/tests/protobuf_tests.rs @@ -57,7 +57,8 @@ proptest! { /// quantity / secret / quota-token). #[test] fn schema_value_proto_round_trip(value in schema_value_strategy()) { - let proto: golem_api_grpc::proto::golem::schema::SchemaValue = value.clone().into(); + let proto: golem_api_grpc::proto::golem::schema::SchemaValue = + value.clone().try_into().expect("encode"); let back: SchemaValue = proto.try_into().expect("decode"); prop_assert!( schema_values_eq(&value, &back), @@ -68,7 +69,8 @@ proptest! { /// The typed pair (graph + value) round-trips through its protobuf mirror. #[test] fn typed_schema_value_proto_round_trip(typed in typed_schema_value_strategy()) { - let proto: golem_api_grpc::proto::golem::schema::TypedSchemaValue = typed.clone().into(); + let proto: golem_api_grpc::proto::golem::schema::TypedSchemaValue = + typed.clone().try_into().expect("encode"); let back: TypedSchemaValue = proto.try_into().expect("decode"); prop_assert_eq!(typed.graph(), back.graph()); prop_assert!( diff --git a/golem-common/src/schema/tests/wit_tests.rs b/golem-common/src/schema/tests/wit_tests.rs index a76cd1d766..470e5be19c 100644 --- a/golem-common/src/schema/tests/wit_tests.rs +++ b/golem-common/src/schema/tests/wit_tests.rs @@ -18,13 +18,14 @@ use crate::schema::proptest_strategies as strategies; use crate::schema::schema_type::SchemaType; use crate::schema::schema_value::{QuotaTokenValuePayload, SchemaValue, SecretValuePayload}; use crate::schema::wit::{ - DecodeError, EncodeError, QuotaTokenHandleRep, QuotaTokenResolver, SecretHandleRep, - SecretResolver, decode_graph, decode_typed, decode_typed_rejecting_quota_with, decode_value, - decode_value_rejecting_quota_with, decode_value_with, encode_graph, encode_typed, encode_value, - encode_value_with, wire, + DecodeError, EncodeError, QuotaTokenHandleRep, QuotaTokenResolver, SchemaValueStreamResolver, + SecretHandleRep, SecretResolver, decode_graph, decode_typed, decode_typed_rejecting_quota_with, + decode_value, decode_value_rejecting_quota_with, decode_value_with, encode_graph, encode_typed, + encode_value, encode_value_with, wire, }; use chrono::{TimeZone, Utc}; use golem_schema::model::EnvironmentId; +use golem_schema::schema::{SchemaValueStream, SchemaValueStreamHandleRep}; use proptest::prelude::*; use strategies::{ schema_graph_strategy, transportable_schema_value_strategy, @@ -381,6 +382,34 @@ impl SecretResolver for TableResolver { } } +impl SchemaValueStreamResolver for TableResolver { + type Error = anyhow::Error; + + fn handle_from_stream( + &mut self, + stream: SchemaValueStream, + ) -> Result, Self::Error> { + let handle = self.table.push(SchemaValueStreamHandleRep::new(stream))?; + self.live += 1; + Ok(handle) + } + + fn stream_from_handle( + &mut self, + handle: Resource, + ) -> Result { + let stream = self.table.delete(handle)?.into_stream(); + self.live -= 1; + Ok(stream) + } + + fn drop_stream_handle(&mut self, handle: Resource) { + if self.table.delete(handle).is_ok() { + self.live -= 1; + } + } +} + #[test] fn quota_token_round_trips_through_resolver() { let value = SchemaValue::QuotaToken(sample_snapshot()); @@ -402,6 +431,25 @@ fn secret_round_trips_through_resolver() { assert_eq!(resolver.live, 0); } +#[test] +fn stream_decodes_through_the_standard_resolver_path() { + let stream = SchemaValueStream::from_host_endpoint(42_u32); + let mut resolver = TableResolver::new(); + let handle = resolver.handle_from_stream(stream).unwrap(); + let tree = wire::SchemaValueTree { + value_nodes: vec![wire::SchemaValueNode::StreamValue(handle)], + root: 0, + }; + + let decoded = decode_value_with(tree, &mut resolver).expect("decode stream"); + let SchemaValue::Stream(decoded) = decoded else { + panic!("expected stream value"); + }; + + assert_eq!(decoded.take_host_endpoint::().unwrap(), 42); + assert_eq!(resolver.live, 0); +} + #[test] fn nested_quota_token_round_trips_through_resolver() { let value = SchemaValue::Record { diff --git a/golem-common/src/schema/validation/placement.rs b/golem-common/src/schema/validation/placement.rs index 39403c4845..fa439094e4 100644 --- a/golem-common/src/schema/validation/placement.rs +++ b/golem-common/src/schema/validation/placement.rs @@ -24,15 +24,15 @@ //! (typed values, `Custom` oplog payloads, REST/RPC envelopes). //! - [`validate_agent_type_placement`] walks an [`AgentTypeSchema`]: the //! constructor input fields are validated against -//! [`SchemaScope::Constructor`], method inputs and outputs against -//! [`SchemaScope::Boundary`], the agent's named defs against -//! [`SchemaScope::Boundary`], and each dependency recursively against -//! its own graph. The sentinel `graph.root` on agent carriers is not -//! walked. +//! [`SchemaScope::Constructor`], method inputs and outputs against their +//! stream-capable method scopes, and each dependency recursively against its +//! own graph. Named definitions are validated at each use site because the +//! same definition may be legal in a method and illegal in a constructor. +//! The sentinel `graph.root` on agent carriers is not walked. use crate::schema::agent::{ - AgentConstructorSchema, AgentDependencySchema, AgentMethodSchema, AgentTypeSchema, InputSchema, - OutputSchema, + AgentConstructorSchema, AgentDependencySchema, AgentMethodSchema, AgentTypeSchema, FieldSource, + InputSchema, OutputSchema, }; use crate::schema::graph::SchemaGraph; use crate::schema::host_managed::HostManagedKind; @@ -51,6 +51,10 @@ pub enum SchemaScope { Persisted, /// REST / RPC boundary payloads. Boundary, + /// Agent method inputs, whose recursive value trees may contain streams. + AgentMethodInput, + /// Agent method outputs, whose recursive value trees may contain streams. + AgentMethodOutput, /// Public docs / schema rendering. Docs, /// User-provided `Custom` durable payloads. @@ -69,6 +73,11 @@ pub enum PlacementError { /// A field / definition annotated with [`Role::Multimodal`] whose body /// is `list>` appeared in [`SchemaScope::Constructor`]. MultimodalListNotAllowedInConstructor, + /// A [`SchemaType::Stream`] node appeared outside a stream-capable method. + StreamNotAllowed { scope: SchemaScope }, + /// A [`SchemaType::Future`] node appeared in a schema boundary. Future + /// values are not part of the agent ABI. + FutureNotAllowed { scope: SchemaScope }, } impl Display for PlacementError { @@ -84,6 +93,12 @@ impl Display for PlacementError { f, "a multimodal `list>` is not allowed in constructor scope" ), + PlacementError::StreamNotAllowed { scope } => { + write!(f, "stream values are not allowed in scope {scope:?}") + } + PlacementError::FutureNotAllowed { scope } => { + write!(f, "future values are not allowed in scope {scope:?}") + } } } } @@ -144,6 +159,21 @@ fn walk_type<'a>( errors: &mut Vec, visited: &mut Vec<&'a TypeId>, ) { + match ty { + SchemaType::Stream { .. } + if !matches!( + scope, + SchemaScope::AgentMethodInput | SchemaScope::AgentMethodOutput + ) => + { + errors.push(PlacementError::StreamNotAllowed { scope }); + } + SchemaType::Future { .. } => { + errors.push(PlacementError::FutureNotAllowed { scope }); + } + _ => {} + } + // Constructor-scope check: a list> tagged anywhere on its // metadata-carrying nodes (enclosing field/def metadata, list node // metadata, inner element Ref metadata, or inner variant metadata) with @@ -376,14 +406,14 @@ fn resolve_ref_chain<'a>( /// /// Walks: /// - the constructor input fields against [`SchemaScope::Constructor`] -/// - each method's input and output bodies against [`SchemaScope::Boundary`] -/// - every named def in [`AgentTypeSchema::schema`] against -/// [`SchemaScope::Boundary`] +/// - each method's input and output bodies against the corresponding +/// stream-capable method scope +/// - config value types against the scalar-only [`SchemaScope::Boundary`] /// - each dependency, recursively, against its own /// [`AgentDependencySchema::schema`] /// -/// The sentinel `graph.root` carried by agent-layer [`SchemaGraph`]s is -/// **not** walked (see §4.22). +/// Named definitions are resolved and checked at each use site. The sentinel +/// `graph.root` carried by agent-layer [`SchemaGraph`]s is **not** walked. /// /// This is a **placement-only** validator. Structural well-formedness /// (dangling refs, duplicate ids, …) is the responsibility of @@ -396,7 +426,18 @@ pub fn validate_agent_type_placement(ty: &AgentTypeSchema) -> Result<(), Vec, ) { - walk_input_schema(graph, &method.input_schema, SchemaScope::Boundary, errors); - walk_output_schema(graph, &method.output_schema, SchemaScope::Boundary, errors); + match &method.input_schema { + InputSchema::Parameters(fields) => { + for field in fields { + let scope = match field.source { + FieldSource::UserSupplied => SchemaScope::AgentMethodInput, + FieldSource::AutoInjected(_) => SchemaScope::Boundary, + }; + let mut visited = Vec::new(); + walk_type( + graph, + &field.schema, + &field.metadata, + scope, + errors, + &mut visited, + ); + } + } + } + walk_output_schema( + graph, + &method.output_schema, + SchemaScope::AgentMethodOutput, + errors, + ); } fn walk_input_schema( @@ -483,26 +546,3 @@ fn walk_output_schema( } } } - -/// Walk every def in `graph.defs` at [`SchemaScope::Boundary`]. -/// -/// Defs are validated at Boundary because shared defs may legitimately be -/// used by method inputs/outputs, where Constructor-only restrictions -/// (e.g. `Secret`) do not apply. Constructor-specific restrictions are -/// still enforced at constructor use sites: when a constructor parameter -/// is a [`SchemaType::Ref`], the constructor walk resolves the ref and -/// re-checks the resolved body under [`SchemaScope::Constructor`]. -fn walk_agent_graph_defs(graph: &SchemaGraph, errors: &mut Vec) { - for def in &graph.defs { - let body_metadata = def.body.metadata().clone(); - let mut visited: Vec<&TypeId> = Vec::new(); - walk_type( - graph, - &def.body, - &body_metadata, - SchemaScope::Boundary, - errors, - &mut visited, - ); - } -} diff --git a/golem-common/src/schema/validation/tests/placement_tests.rs b/golem-common/src/schema/validation/tests/placement_tests.rs index ac178b0721..1803eca2f9 100644 --- a/golem-common/src/schema/validation/tests/placement_tests.rs +++ b/golem-common/src/schema/validation/tests/placement_tests.rs @@ -157,6 +157,8 @@ fn plain_primitives_allowed_in_every_scope() { SchemaScope::Constructor, SchemaScope::Persisted, SchemaScope::Boundary, + SchemaScope::AgentMethodInput, + SchemaScope::AgentMethodOutput, SchemaScope::Docs, SchemaScope::Custom, ] { @@ -164,6 +166,44 @@ fn plain_primitives_allowed_in_every_scope() { } } +#[test] +fn streams_are_allowed_only_on_agent_method_boundaries() { + let graph = SchemaGraph::anonymous(SchemaType::stream(Some(SchemaType::string()))); + for scope in [ + SchemaScope::Constructor, + SchemaScope::Persisted, + SchemaScope::Boundary, + SchemaScope::Docs, + SchemaScope::Custom, + ] { + let errors = validate_placement(&graph, scope).expect_err("stream must be rejected"); + assert!(errors.contains(&PlacementError::StreamNotAllowed { scope })); + } + for scope in [ + SchemaScope::AgentMethodInput, + SchemaScope::AgentMethodOutput, + ] { + validate_placement(&graph, scope).expect("stream must be accepted"); + } +} + +#[test] +fn futures_are_rejected_in_every_scope() { + let graph = SchemaGraph::anonymous(SchemaType::future(Some(SchemaType::string()))); + for scope in [ + SchemaScope::Constructor, + SchemaScope::Persisted, + SchemaScope::Boundary, + SchemaScope::AgentMethodInput, + SchemaScope::AgentMethodOutput, + SchemaScope::Docs, + SchemaScope::Custom, + ] { + let errors = validate_placement(&graph, scope).expect_err("future must be rejected"); + assert!(errors.contains(&PlacementError::FutureNotAllowed { scope })); + } +} + // -------------------------------------------------------------------------- // Agent-aware placement // -------------------------------------------------------------------------- @@ -174,7 +214,7 @@ mod agent { use crate::base_model::agent::{AgentMode, AgentTypeName, Snapshotting}; use crate::schema::agent::{ AgentConstructorSchema, AgentDependencySchema, AgentMethodSchema, AgentTypeSchema, - InputSchema, NamedField, OutputSchema, + AutoInjectedKind, InputSchema, NamedField, OutputSchema, }; use crate::schema::schema_type::SecretSpec; use crate::schema::validation::placement::{ @@ -209,6 +249,27 @@ mod agent { validate_agent_type_placement(&agent).expect("empty agent should pass"); } + #[test] + fn auto_injected_method_stream_fails_agent_placement_validation() { + let mut agent = empty_agent("a"); + agent.methods.push(AgentMethodSchema { + name: "invalid".into(), + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(vec![NamedField::auto_injected( + "principal", + AutoInjectedKind::Principal, + SchemaType::stream(Some(SchemaType::string())), + )]), + output_schema: OutputSchema::Unit, + http_endpoint: vec![], + read_only: None, + }); + + validate_agent_type_placement(&agent) + .expect_err("method input streams must be in caller-supplied fields"); + } + #[test] fn secret_in_constructor_input_is_rejected_at_agent_layer() { let mut agent = empty_agent("a"); diff --git a/golem-common/wit/deps/golem-agent/guest.wit b/golem-common/wit/deps/golem-agent/guest.wit index dbe97ff310..d72413c288 100644 --- a/golem-common/wit/deps/golem-agent/guest.wit +++ b/golem-common/wit/deps/golem-agent/guest.wit @@ -15,8 +15,9 @@ interface guest { /// Invokes an agent. If create was not called before, it fails. /// /// `input` is a value tree whose root encodes the method's parameter list. - /// The result is `none` when the method's `output-schema` is `unit`, and - /// `some(value)` for a `single` output. + /// Streams are represented recursively by `stream-value` nodes. The result + /// is `none` when the method's `output-schema` is `unit`, and `some(value)` + /// for a `single` output. invoke: async func(method-name: string, input: schema-value-tree, principal: principal) -> result, agent-error>; /// Gets the agent type. If create was not called before, it fails diff --git a/golem-common/wit/deps/golem-core-v2/golem-core-v2.wit b/golem-common/wit/deps/golem-core-v2/golem-core-v2.wit index bb7dda191e..8a8dd02254 100644 --- a/golem-common/wit/deps/golem-core-v2/golem-core-v2.wit +++ b/golem-common/wit/deps/golem-core-v2/golem-core-v2.wit @@ -125,6 +125,17 @@ interface types { /// and reveal it only through capability-gated host interfaces. resource secret; + /// An affine wrapper around a native Component Model stream of schema + /// values. The indirection lets a stream occur anywhere in a recursive + /// `schema-value-tree` while preserving the native stream endpoint. + resource schema-value-stream { + /// Wraps any native schema-value reader for placement in a value tree. + wrap: static async func(reader: stream) -> own; + + /// Consumes a schema-value-stream wrapper and returns its native reader. + unwrap: static async func(value: own) -> stream; + } + // ============================================================ // Schema graph (self-contained type carrier) // ============================================================ @@ -524,8 +535,7 @@ interface types { // Capability nodes secret-value(own), quota-token-handle(own), - - // WASI P3 stubs (parseable only in the schema; no constructible values). + stream-value(own), } record variant-value-payload { @@ -584,4 +594,5 @@ interface types { graph: schema-graph, value: schema-value-tree, } + } diff --git a/golem-registry-service/src/grpc/api_impl.rs b/golem-registry-service/src/grpc/api_impl.rs index 74f4bdc69c..8b6947a683 100644 --- a/golem-registry-service/src/grpc/api_impl.rs +++ b/golem-registry-service/src/grpc/api_impl.rs @@ -293,7 +293,7 @@ impl RegistryServiceGrpcApi { .await?; Ok(GetComponentMetadataSuccessResponse { - component: Some(component.into()), + component: Some(component.try_into()?), }) } @@ -312,7 +312,7 @@ impl RegistryServiceGrpcApi { .await?; Ok(GetDeployedComponentMetadataSuccessResponse { - component: Some(component.into()), + component: Some(component.try_into()?), }) } @@ -331,7 +331,10 @@ impl RegistryServiceGrpcApi { .await?; Ok(GetAllDeployedComponentRevisionsSuccessResponse { - components: components.into_iter().map(|c| c.into()).collect(), + components: components + .into_iter() + .map(TryInto::try_into) + .collect::>()?, }) } @@ -368,7 +371,7 @@ impl RegistryServiceGrpcApi { .await?; Ok(ResolveComponentSuccessResponse { - component: Some(component.into()), + component: Some(component.try_into()?), }) } @@ -487,7 +490,7 @@ impl RegistryServiceGrpcApi { .await?; Ok(GetCurrentEnvironmentStateSuccessResponse { - environment_state: Some(environment_state.into()), + environment_state: Some(environment_state.try_into()?), }) } @@ -523,7 +526,7 @@ impl RegistryServiceGrpcApi { .collect(), retry_policies: Vec::new(), } - .into(), + .try_into()?, ), }) } diff --git a/golem-schema-derive/src/codegen/poem.rs b/golem-schema-derive/src/codegen/poem.rs index 01b9210817..4d5e19c46e 100644 --- a/golem-schema-derive/src/codegen/poem.rs +++ b/golem-schema-derive/src/codegen/poem.rs @@ -58,6 +58,7 @@ struct SerdeFieldAttrs { #[derive(Default)] struct SerdeVariantAttrs { rename: Option, + skip: bool, } pub fn expand_poem_schema(input: &DeriveInput) -> syn::Result { @@ -220,6 +221,9 @@ fn expand_adjacent_enum( let mut variant_blocks = Vec::new(); for variant in &data.variants { let vattrs = parse_serde_variant_attrs(&variant.attrs)?; + if vattrs.skip { + continue; + } let case = resolve_variant_name(&variant.ident, &vattrs, serde.rename_all); let case_lit = LitStr::new(&case, variant.ident.span()); @@ -972,6 +976,7 @@ fn parse_serde_variant_attrs(attrs: &[Attribute]) -> syn::Result()?.value()); } + "skip" => out.skip = true, other => { return Err(meta.error(format!( "PoemSchema does not support `#[serde({other})]` on a variant" diff --git a/golem-schema/Cargo.toml b/golem-schema/Cargo.toml index edc7e8359a..415fd65e86 100644 --- a/golem-schema/Cargo.toml +++ b/golem-schema/Cargo.toml @@ -36,6 +36,7 @@ golem-schema-derive = { workspace = true } base64 = { workspace = true } bigdecimal = { workspace = true } bit-vec = { workspace = true } +blake3 = { workspace = true } bytes = { workspace = true, optional = true } chrono = { workspace = true } combine = { workspace = true } diff --git a/golem-schema/src/schema/conversion.rs b/golem-schema/src/schema/conversion.rs index 5ff1b7c337..76043db3fb 100644 --- a/golem-schema/src/schema/conversion.rs +++ b/golem-schema/src/schema/conversion.rs @@ -460,6 +460,7 @@ pub fn value_kind(v: &SchemaValue) -> &'static str { SchemaValue::Union(_) => "union", SchemaValue::Secret(_) => "secret", SchemaValue::QuotaToken(_) => "quota-token", + SchemaValue::Stream(_) => "stream", } } diff --git a/golem-schema/src/schema/mod.rs b/golem-schema/src/schema/mod.rs index b57421ad0f..67158daa55 100644 --- a/golem-schema/src/schema/mod.rs +++ b/golem-schema/src/schema/mod.rs @@ -25,6 +25,7 @@ pub mod multimodal; pub mod protobuf; pub mod schema_type; pub mod schema_value; +pub mod stream; pub mod tool; pub mod unstructured; pub mod validation; @@ -56,3 +57,6 @@ pub use schema_value::{ BinaryValuePayload, DurationValuePayload, QuotaTokenValuePayload, ResultValuePayload, SchemaValue, SecretValuePayload, TextValuePayload, UnionValuePayload, VariantValuePayload, }; +pub use stream::SchemaValueStream; +#[cfg(all(feature = "host", not(feature = "guest")))] +pub use stream::SchemaValueStreamHandleRep; diff --git a/golem-schema/src/schema/protobuf.rs b/golem-schema/src/schema/protobuf.rs index 4eafeaa3cd..5b46e04274 100644 --- a/golem-schema/src/schema/protobuf.rs +++ b/golem-schema/src/schema/protobuf.rs @@ -15,6 +15,7 @@ //! Conversions between the recursive in-memory schema model and its protobuf //! mirror in the `golem.schema` package. +#[cfg(not(all(feature = "guest", not(feature = "host"))))] use crate::model::EnvironmentId; use crate::schema::graph::{SchemaGraph, SchemaTypeDef, TypedSchemaValue}; use crate::schema::metadata::{MetadataEnvelope, Role, TypeId}; @@ -25,9 +26,11 @@ use crate::schema::schema_type::{ UrlRestrictions, VariantCaseType, }; use crate::schema::schema_value::{ - BinaryValuePayload, DurationValuePayload, QuotaTokenValuePayload, ResultValuePayload, - SchemaValue, SecretValuePayload, TextValuePayload, UnionValuePayload, VariantValuePayload, + BinaryValuePayload, DurationValuePayload, ResultValuePayload, SchemaValue, TextValuePayload, + UnionValuePayload, VariantValuePayload, }; +#[cfg(not(all(feature = "guest", not(feature = "host"))))] +use crate::schema::schema_value::{QuotaTokenValuePayload, SecretValuePayload}; use chrono::{DateTime, TimeZone, Utc}; use golem_api_grpc::proto::golem::common::Empty as ProtoEmpty; use golem_api_grpc::proto::golem::schema as proto; @@ -87,8 +90,8 @@ fn req_box_from_proto( // --- value-side helpers ------------------------------------------------------ -fn value_to_boxed_proto(value: SchemaValue) -> Box { - Box::new(value.into()) +fn value_to_boxed_proto(value: SchemaValue) -> Result, String> { + Ok(Box::new(value.try_into()?)) } fn opt_box_value_from_proto( @@ -908,8 +911,10 @@ impl TryFrom for SchemaTypeDef { // --- SchemaValue / TypedSchemaValue ------------------------------------------ -impl From for proto::SchemaValue { - fn from(value: SchemaValue) -> Self { +impl TryFrom for proto::SchemaValue { + type Error = String; + + fn try_from(value: SchemaValue) -> Result { let body = match value { SchemaValue::Bool(b) => ValueBody::BoolValue(b), SchemaValue::S8(v) => ValueBody::S8Value(v as i32), @@ -925,45 +930,64 @@ impl From for proto::SchemaValue { SchemaValue::Char(c) => ValueBody::CharValue(c as u32), SchemaValue::String(s) => ValueBody::StringValue(s), SchemaValue::Record { fields } => ValueBody::RecordValue(proto::RecordValue { - fields: fields.into_iter().map(Into::into).collect(), + fields: fields + .into_iter() + .map(TryInto::try_into) + .collect::>()?, }), SchemaValue::Variant(p) => ValueBody::VariantValue(Box::new(proto::VariantValue { case: p.case, - payload: p.payload.map(|value| value_to_boxed_proto(*value)), + payload: p + .payload + .map(|value| value_to_boxed_proto(*value)) + .transpose()?, })), SchemaValue::Enum { case } => ValueBody::EnumValue(case), SchemaValue::Flags { bits } => ValueBody::FlagsValue(proto::FlagsValue { bits }), SchemaValue::Tuple { elements } => ValueBody::TupleValue(proto::TupleValue { - elements: elements.into_iter().map(Into::into).collect(), + elements: elements + .into_iter() + .map(TryInto::try_into) + .collect::>()?, }), SchemaValue::List { elements } => ValueBody::ListValue(proto::ListValue { - elements: elements.into_iter().map(Into::into).collect(), + elements: elements + .into_iter() + .map(TryInto::try_into) + .collect::>()?, }), SchemaValue::FixedList { elements } => { ValueBody::FixedListValue(proto::FixedListValue { - elements: elements.into_iter().map(Into::into).collect(), + elements: elements + .into_iter() + .map(TryInto::try_into) + .collect::>()?, }) } SchemaValue::Map { entries } => ValueBody::MapValue(proto::MapValue { entries: entries .into_iter() - .map(|(k, v)| proto::MapEntry { - key: Some(k.into()), - value: Some(v.into()), + .map(|(k, v)| { + Ok(proto::MapEntry { + key: Some(k.try_into()?), + value: Some(v.try_into()?), + }) }) - .collect(), + .collect::>()?, }), SchemaValue::Option { inner } => ValueBody::OptionValue(Box::new(proto::OptionValue { - inner: inner.map(|value| value_to_boxed_proto(*value)), + inner: inner + .map(|value| value_to_boxed_proto(*value)) + .transpose()?, })), SchemaValue::Result(r) => ValueBody::ResultValue(Box::new(proto::ResultValue { result: Some(match r { ResultValuePayload::Ok { value } => match value { - Some(v) => ResultBody::Ok(value_to_boxed_proto(*v)), + Some(v) => ResultBody::Ok(value_to_boxed_proto(*v)?), None => ResultBody::OkUnit(ProtoEmpty {}), }, ResultValuePayload::Err { value } => match value { - Some(v) => ResultBody::Err(value_to_boxed_proto(*v)), + Some(v) => ResultBody::Err(value_to_boxed_proto(*v)?), None => ResultBody::ErrUnit(ProtoEmpty {}), }, }), @@ -985,8 +1009,9 @@ impl From for proto::SchemaValue { SchemaValue::Quantity(q) => ValueBody::QuantityValue(q.into()), SchemaValue::Union(u) => ValueBody::UnionValue(Box::new(proto::UnionValue { tag: u.tag, - body: Some(value_to_boxed_proto(*u.body)), + body: Some(value_to_boxed_proto(*u.body)?), })), + #[cfg(not(all(feature = "guest", not(feature = "host"))))] SchemaValue::Secret(s) => ValueBody::SecretValue(proto::SecretValue { secret_id: Some(s.secret_id.into()), config_key: s.config_key.map(|items| proto::StringList { items }), @@ -994,6 +1019,7 @@ impl From for proto::SchemaValue { resolved_at: Some(datetime_to_proto(s.resolved_at)), category: s.category, }), + #[cfg(not(all(feature = "guest", not(feature = "host"))))] SchemaValue::QuotaToken(q) => ValueBody::QuotaTokenValue(proto::QuotaTokenValue { environment_id: Some(q.environment_id.uuid.into()), resource_name: q.resource_name, @@ -1001,8 +1027,25 @@ impl From for proto::SchemaValue { last_credit: q.last_credit, last_credit_at: Some(datetime_to_proto(q.last_credit_at)), }), + #[cfg(all(feature = "guest", not(feature = "host")))] + SchemaValue::Secret(_) => { + return Err( + "live secret handles cannot be converted to protobuf values".to_string() + ); + } + #[cfg(all(feature = "guest", not(feature = "host")))] + SchemaValue::QuotaToken(_) => { + return Err( + "live quota-token handles cannot be converted to protobuf values".to_string(), + ); + } + SchemaValue::Stream(_) => { + return Err( + "live schema value streams cannot be converted to protobuf values".to_string(), + ); + } }; - Self { value: Some(body) } + Ok(Self { value: Some(body) }) } } @@ -1109,6 +1152,7 @@ impl TryFrom for SchemaValue { body: req_box_value_from_proto(uv.body, "UnionValue.body")?, }) } + #[cfg(not(all(feature = "guest", not(feature = "host"))))] ValueBody::SecretValue(s) => SchemaValue::Secret(SecretValuePayload { secret_id: s .secret_id @@ -1122,6 +1166,7 @@ impl TryFrom for SchemaValue { )?, category: s.category, }), + #[cfg(not(all(feature = "guest", not(feature = "host"))))] ValueBody::QuotaTokenValue(q) => SchemaValue::QuotaToken(QuotaTokenValuePayload { environment_id: EnvironmentId::new( q.environment_id @@ -1137,18 +1182,34 @@ impl TryFrom for SchemaValue { })?, )?, }), + #[cfg(all(feature = "guest", not(feature = "host")))] + ValueBody::SecretValue(_) => { + return Err("protobuf values cannot create live secret handles".to_string()); + } + #[cfg(all(feature = "guest", not(feature = "host")))] + ValueBody::QuotaTokenValue(_) => { + return Err("protobuf values cannot create live quota-token handles".to_string()); + } + ValueBody::StreamReference(reference) => { + return Err(format!( + "live schema value stream reference {} cannot be decoded outside its session", + reference.stream_id + )); + } }; Ok(result) } } -impl From for proto::TypedSchemaValue { - fn from(value: TypedSchemaValue) -> Self { +impl TryFrom for proto::TypedSchemaValue { + type Error = String; + + fn try_from(value: TypedSchemaValue) -> Result { let (graph, val) = value.into_parts(); - Self { + Ok(Self { graph: Some(graph.into()), - value: Some(val.into()), - } + value: Some(val.try_into()?), + }) } } @@ -1173,6 +1234,35 @@ mod tests { use super::*; use test_r::test; + #[cfg(all(feature = "host", not(feature = "guest")))] + #[test] + fn generic_protobuf_encoding_rejects_live_streams() { + let value = SchemaValue::Stream(crate::schema::SchemaValueStream::from_host_endpoint(())); + + let error = proto::SchemaValue::try_from(value).unwrap_err(); + + assert_eq!( + error, + "live schema value streams cannot be converted to protobuf values" + ); + } + + #[test] + fn generic_protobuf_decoding_rejects_live_stream_references() { + let value = proto::SchemaValue { + value: Some(ValueBody::StreamReference( + proto::SchemaValueStreamReference { stream_id: 42 }, + )), + }; + + let error = SchemaValue::try_from(value).unwrap_err(); + + assert_eq!( + error, + "live schema value stream reference 42 cannot be decoded outside its session" + ); + } + #[test] fn proto_secret_spec_defaults_inner_to_string_when_absent() { let proto = proto::SchemaType { diff --git a/golem-schema/src/schema/schema_value.rs b/golem-schema/src/schema/schema_value.rs index 4e6c4a0564..158b7736d6 100644 --- a/golem-schema/src/schema/schema_value.rs +++ b/golem-schema/src/schema/schema_value.rs @@ -14,6 +14,7 @@ use crate::model::EnvironmentId; use crate::schema::schema_type::QuantityValue; +use crate::schema::stream::SchemaValueStream; use chrono::{DateTime, Utc}; use golem_schema_derive::{FromSchema, IntoSchema}; use serde::{Deserialize, Serialize}; @@ -130,8 +131,21 @@ pub enum SchemaValue { Union(UnionValuePayload), // Capability nodes + #[cfg_attr(all(feature = "guest", not(feature = "host")), serde(skip))] + #[cfg_attr( + all(feature = "full", feature = "guest", not(feature = "host")), + transient + )] Secret(SecretVariantValue), + #[cfg_attr(all(feature = "guest", not(feature = "host")), serde(skip))] + #[cfg_attr( + all(feature = "full", feature = "guest", not(feature = "host")), + transient + )] QuotaToken(QuotaTokenVariantValue), + #[serde(skip)] + #[cfg_attr(feature = "full", transient)] + Stream(SchemaValueStream), } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, IntoSchema, FromSchema)] diff --git a/golem-schema/src/schema/stream.rs b/golem-schema/src/schema/stream.rs new file mode 100644 index 0000000000..8e2c9b5fca --- /dev/null +++ b/golem-schema/src/schema/stream.rs @@ -0,0 +1,347 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Affine native streams carried recursively by [`super::SchemaValue`]. + +use crate::schema::conversion::{FromSchema, FromSchemaError, IntoSchema, SchemaBuilder}; +use crate::schema::metadata::{MetadataEnvelope, TypeId}; +use crate::schema::schema_type::SchemaType; +use crate::schema::schema_value::SchemaValue; + +#[cfg(all(feature = "guest", not(feature = "host")))] +type RawSchemaValueStream = wit_bindgen::StreamReader; + +#[cfg(all(feature = "host", not(feature = "guest")))] +mod active { + use std::any::Any; + use std::sync::{Arc, Mutex}; + + type OpaqueEndpoint = Box; + + /// Host-side stream leaf. Clones share one take-once endpoint; they never + /// duplicate a live stream. + /// + /// The endpoint is deliberately type-erased here. The schema model owns + /// affine transfer semantics, while the embedding runtime owns the relay + /// protocol used to connect Store-local Component Model streams. + #[derive(Clone)] + pub struct SchemaValueStream { + inner: Arc>>, + } + + impl SchemaValueStream { + #[doc(hidden)] + pub fn from_host_endpoint(endpoint: impl Any + Send) -> Self { + Self { + inner: Arc::new(Mutex::new(Some(Box::new(endpoint)))), + } + } + + #[doc(hidden)] + pub fn take_host_endpoint(&self) -> Result { + let endpoint = self + .inner + .lock() + .expect("schema value stream mutex poisoned") + .take() + .ok_or_else(|| "schema value stream was already transferred".to_string())?; + endpoint + .downcast::() + .map(|endpoint| *endpoint) + .map_err(|_| { + "schema value stream endpoint belongs to an incompatible runtime".to_string() + }) + } + + #[doc(hidden)] + pub fn with_host_endpoint( + &self, + f: impl FnOnce(&T) -> R, + ) -> Result { + let endpoint = self + .inner + .lock() + .expect("schema value stream mutex poisoned"); + let endpoint = endpoint + .as_ref() + .ok_or_else(|| "schema value stream was already transferred".to_string())?; + endpoint.downcast_ref::().map(f).ok_or_else(|| { + "schema value stream endpoint belongs to an incompatible runtime".to_string() + }) + } + + #[doc(hidden)] + pub fn take_for_transfer(&self) -> Option { + self.inner + .lock() + .expect("schema value stream mutex poisoned") + .take() + .map(|endpoint| Self { + inner: Arc::new(Mutex::new(Some(endpoint))), + }) + } + + #[doc(hidden)] + pub fn is_present(&self) -> bool { + self.inner + .lock() + .expect("schema value stream mutex poisoned") + .is_some() + } + + #[doc(hidden)] + pub fn cell_id(&self) -> *const () { + Arc::as_ptr(&self.inner).cast() + } + } + + impl std::fmt::Debug for SchemaValueStream { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_tuple("SchemaValueStream") + .field(&if self.is_present() { + "present" + } else { + "consumed" + }) + .finish() + } + } + + impl PartialEq for SchemaValueStream { + fn eq(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.inner, &other.inner) + } + } + + /// Resource-table representation of `golem:core/types.schema-value-stream`. + /// It owns one affine runtime endpoint. Component Model readers are + /// created or consumed only by the embedding runtime while it has access + /// to the endpoint's Store. + pub struct SchemaValueStreamHandleRep { + stream: SchemaValueStream, + } + + impl SchemaValueStreamHandleRep { + #[doc(hidden)] + pub fn new(stream: SchemaValueStream) -> Self { + Self { stream } + } + + #[doc(hidden)] + pub fn into_stream(self) -> SchemaValueStream { + self.stream + } + } +} + +#[cfg(all(feature = "guest", not(feature = "host")))] +mod active { + use super::RawSchemaValueStream; + use crate::schema::wit::wire; + use std::sync::{Arc, Mutex, MutexGuard}; + + enum State { + Wrapped(wire::SchemaValueStream), + Native(RawSchemaValueStream), + } + + /// Guest-side stream leaf. A leaf can hold the recursive WIT resource or + /// the native reader obtained from it. Clones share one take-once state. + #[derive(Clone)] + pub struct SchemaValueStream { + inner: Arc>>, + } + + impl SchemaValueStream { + fn state(&self) -> MutexGuard<'_, Option> { + self.inner + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + } + + #[doc(hidden)] + pub fn from_native(reader: RawSchemaValueStream) -> Self { + Self { + inner: Arc::new(Mutex::new(Some(State::Native(reader)))), + } + } + + #[doc(hidden)] + pub fn from_wrapped(stream: wire::SchemaValueStream) -> Self { + Self { + inner: Arc::new(Mutex::new(Some(State::Wrapped(stream)))), + } + } + + #[doc(hidden)] + pub fn is_present(&self) -> bool { + self.state().is_some() + } + + #[doc(hidden)] + pub fn is_wrapped(&self) -> bool { + matches!(&*self.state(), Some(State::Wrapped(_))) + } + + #[doc(hidden)] + pub fn cell_id(&self) -> *const () { + Arc::as_ptr(&self.inner).cast() + } + + #[doc(hidden)] + pub fn take_wrapped(&self) -> Option { + let mut state = self.state(); + match state.take() { + Some(State::Wrapped(stream)) => Some(stream), + Some(native @ State::Native(_)) => { + *state = Some(native); + None + } + None => None, + } + } + + #[doc(hidden)] + pub async fn take_wrapped_async(&self) -> Result { + let state = self + .state() + .take() + .ok_or_else(|| "schema value stream was already transferred".to_string())?; + Ok(match state { + State::Wrapped(stream) => stream, + State::Native(reader) => wire::SchemaValueStream::wrap(reader).await, + }) + } + + #[doc(hidden)] + pub async fn ensure_wrapped(&self) -> Result<(), String> { + let state = self + .state() + .take() + .ok_or_else(|| "schema value stream was already transferred".to_string())?; + *self.state() = Some(match state { + State::Wrapped(stream) => State::Wrapped(stream), + State::Native(reader) => { + State::Wrapped(wire::SchemaValueStream::wrap(reader).await) + } + }); + Ok(()) + } + + #[doc(hidden)] + pub async fn take_native(self) -> Result { + let state = self + .state() + .take() + .ok_or_else(|| "schema value stream was already transferred".to_string())?; + Ok(match state { + State::Wrapped(stream) => wire::SchemaValueStream::unwrap(stream).await, + State::Native(reader) => reader, + }) + } + + #[doc(hidden)] + pub async fn next_wire(&self) -> Result, String> { + let state = self.state().take().ok_or_else(|| { + "schema value stream is already in use or was transferred".to_string() + })?; + let mut reader = match state { + State::Wrapped(stream) => wire::SchemaValueStream::unwrap(stream).await, + State::Native(reader) => reader, + }; + let item = reader.next().await; + *self.state() = Some(State::Native(reader)); + Ok(item) + } + } + + impl std::fmt::Debug for SchemaValueStream { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let state = match &*self.state() { + Some(State::Wrapped(_)) => "wrapped", + Some(State::Native(_)) => "native", + None => "consumed", + }; + f.debug_tuple("SchemaValueStream").field(&state).finish() + } + } + + impl PartialEq for SchemaValueStream { + fn eq(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.inner, &other.inner) + } + } +} + +#[cfg(any( + all(feature = "host", not(feature = "guest")), + all(feature = "guest", not(feature = "host")) +))] +pub use active::SchemaValueStream; + +#[cfg(all(feature = "host", not(feature = "guest")))] +pub use active::SchemaValueStreamHandleRep; + +#[cfg(not(any( + all(feature = "host", not(feature = "guest")), + all(feature = "guest", not(feature = "host")) +)))] +#[derive(Clone, Debug, PartialEq)] +pub struct SchemaValueStream(()); + +impl serde::Serialize for SchemaValueStream { + fn serialize(&self, _serializer: S) -> Result { + Err(serde::ser::Error::custom( + "live schema value streams cannot be serialized", + )) + } +} + +impl<'de> serde::Deserialize<'de> for SchemaValueStream { + fn deserialize>(_deserializer: D) -> Result { + Err(serde::de::Error::custom( + "live schema value streams cannot be deserialized", + )) + } +} + +impl IntoSchema for SchemaValueStream { + fn type_id() -> TypeId { + TypeId::new("golem.core.SchemaValueStream") + } + + fn register_in(_builder: &mut SchemaBuilder) -> SchemaType { + SchemaType::Stream { + inner: None, + metadata: MetadataEnvelope::default(), + } + } + + fn to_value(&self) -> SchemaValue { + SchemaValue::Stream(self.clone()) + } +} + +impl FromSchema for SchemaValueStream { + fn from_value(value: &SchemaValue) -> Result { + match value { + SchemaValue::Stream(stream) => Ok(stream.clone()), + other => Err(FromSchemaError::shape_mismatch( + "stream", + format!("{other:?}"), + "SchemaValueStream", + )), + } + } +} diff --git a/golem-schema/src/schema/validation/value.rs b/golem-schema/src/schema/validation/value.rs index 8e24cf6398..eb367ec869 100644 --- a/golem-schema/src/schema/validation/value.rs +++ b/golem-schema/src/schema/validation/value.rs @@ -557,6 +557,7 @@ fn shape_name(value: &SchemaValue) -> &'static str { SchemaValue::Union(_) => "union", SchemaValue::Secret(_) => "secret", SchemaValue::QuotaToken(_) => "quota-token", + SchemaValue::Stream(_) => "stream", } } @@ -813,6 +814,7 @@ fn check<'a>( #[cfg(all(feature = "guest", not(feature = "host")))] let _ = (spec, payload); } + (SchemaType::Stream { .. }, SchemaValue::Stream(_)) => {} (SchemaType::Record { fields, .. }, SchemaValue::Record { fields: vs }) => { if fields.len() != vs.len() { diff --git a/golem-schema/src/schema/wit/decode.rs b/golem-schema/src/schema/wit/decode.rs index 8343b70300..674299b2a5 100644 --- a/golem-schema/src/schema/wit/decode.rs +++ b/golem-schema/src/schema/wit/decode.rs @@ -43,6 +43,11 @@ type WireSecretHandle = wasmtime::component::Resource; #[cfg(all(feature = "guest", not(feature = "host")))] type WireSecretHandle = wire::Secret; +#[cfg(all(feature = "host", not(feature = "guest")))] +type WireStreamHandle = wasmtime::component::Resource; +#[cfg(all(feature = "guest", not(feature = "host")))] +type WireStreamHandle = wire::SchemaValueStream; + /// Errors that can occur while decoding the flat wire form into the /// recursive in-memory representation. #[derive(Debug, Clone, PartialEq, Eq)] @@ -78,6 +83,8 @@ pub enum DecodeError { /// An owned `secret` handle was present in the value tree but never reached /// from the root. UnconsumedSecretHandle(wire::ValueNodeIndex), + /// An owned stream wrapper was present but never reached from the root. + UnconsumedStream(wire::ValueNodeIndex), /// The host `QuotaTokenResolver` failed to snapshot an owned handle. QuotaResolver(String), /// The host `SecretResolver` failed to snapshot an owned handle. @@ -92,6 +99,12 @@ pub enum DecodeError { /// does not permit secret transport. The handle is dropped from the resource /// table before this error is returned, so nothing leaks. SecretNotPermitted(wire::ValueNodeIndex), + /// A stream wrapper was encountered at a non-stream-aware host boundary. + StreamRequiresStore(wire::ValueNodeIndex), + /// A live stream was encountered at a materializing boundary. + StreamNotPermitted(wire::ValueNodeIndex), + /// The host failed to transfer a schema-value-stream resource into a native reader. + StreamResolver(String), } impl Display for DecodeError { @@ -130,6 +143,9 @@ impl Display for DecodeError { DecodeError::UnconsumedSecretHandle(i) => { write!(f, "secret handle not referenced from the root: {i}") } + DecodeError::UnconsumedStream(i) => { + write!(f, "schema value stream not referenced from the root: {i}") + } DecodeError::QuotaResolver(msg) => { write!(f, "quota-token handle could not be resolved: {msg}") } @@ -142,6 +158,21 @@ impl Display for DecodeError { DecodeError::SecretNotPermitted(i) => { write!(f, "secret handle not permitted at this boundary: {i}") } + DecodeError::StreamRequiresStore(i) => { + write!( + f, + "schema value stream requires a stream-aware store boundary: {i}" + ) + } + DecodeError::StreamNotPermitted(i) => { + write!( + f, + "live schema value stream not permitted at this boundary: {i}" + ) + } + DecodeError::StreamResolver(message) => { + write!(f, "schema value stream could not be transferred: {message}") + } } } } @@ -240,6 +271,7 @@ pub fn decode_value(wire_tree: wire::SchemaValueTree) -> Result Err(e), }; @@ -260,6 +292,9 @@ pub fn decode_value(wire_tree: wire::SchemaValueTree) -> Result { + leaked.get_or_insert(DecodeError::UnconsumedStream(i as wire::ValueNodeIndex)); + } other => *slot = other, } } @@ -709,27 +744,30 @@ fn decode_value_node( wire::SchemaValueNode::QuotaTokenHandle(_) => { return Err(DecodeError::QuotaTokenRequiresResolver); } + wire::SchemaValueNode::StreamValue(_) => { + return Err(DecodeError::StreamRequiresStore(0)); + } }; Ok(out) } -/// Decode an owned value tree, lifting each `quota-token-handle` node into a -/// trusted [`SchemaValue::QuotaToken`] snapshot via the supplied resolver. +/// Decode an owned value tree, lifting each resource node into its native +/// [`SchemaValue`] representation via the supplied resolver. /// /// The tree is consumed because the owned handles it carries are affine: each /// must be moved out and snapshotted exactly once. Any node referenced more /// than once (or forming a cycle) is rejected with /// [`DecodeError::AliasedValueNode`]. /// -/// Every `own` handle present in the tree has already been -/// transferred to the host, so each must be consumed exactly once. After -/// decoding, any handle that was never reached from the root is released through -/// [`super::QuotaTokenResolver::drop_handle`] (so none leak from the table) and, -/// on an otherwise successful decode, the tree is rejected as malformed with -/// [`DecodeError::UnconsumedQuotaTokenHandle`]. The same cleanup runs when -/// decoding fails partway through. +/// Every owned resource present in the tree has already been transferred to +/// the host, so each must be consumed exactly once. After decoding, any handle +/// that was never reached from the root is released through its resolver (so +/// none leak from the table) and the tree is rejected as malformed. The same +/// cleanup runs when decoding fails partway through. #[cfg(all(feature = "host", not(feature = "guest")))] -pub fn decode_value_with( +pub fn decode_value_with< + R: super::QuotaTokenResolver + super::SecretResolver + super::SchemaValueStreamResolver, +>( wire_tree: wire::SchemaValueTree, resolver: &mut R, ) -> Result { @@ -737,55 +775,67 @@ pub fn decode_value_with( let root = wire_tree.root; let mut slots: Vec> = wire_tree.value_nodes.into_iter().map(Some).collect(); - // Validate the whole tree before snapshotting any owned handle, so a - // malformed sibling cannot cause an already-snapshotted token to be - // discarded. After a successful preflight the only fallible step left is the - // snapshot itself. + // Validate the whole tree before resolving any owned handle, so a + // malformed sibling cannot cause an already-resolved resource to be + // discarded. After a successful preflight the only fallible steps left are + // the resolver calls themselves. let result = match preflight_owned_value_tree(&slots, root) { Ok(()) => decode_owned_at( &mut slots, root, &mut |handle| { - let mut resolver = resolver.borrow_mut(); resolver + .borrow_mut() .snapshot_handle(handle) - .map_err(|e| DecodeError::QuotaResolver(e.to_string())) + .map_err(|error| DecodeError::QuotaResolver(error.to_string())) }, &mut |handle| { - let mut resolver = resolver.borrow_mut(); resolver + .borrow_mut() .snapshot_secret_handle(handle) - .map_err(|e| DecodeError::SecretResolver(e.to_string())) + .map_err(|error| DecodeError::SecretResolver(error.to_string())) + }, + &mut |handle| { + resolver + .borrow_mut() + .stream_from_handle(handle) + .map_err(|error| DecodeError::StreamResolver(error.to_string())) }, ), - Err(e) => Err(e), + Err(error) => Err(error), }; - // Drop every handle that was not consumed while walking the tree, regardless - // of success or failure, so no owned resource leaks from the table. - let mut leaked: Option = None; + // Drop every handle that was not consumed while walking the tree, + // regardless of success or failure, so no owned resource leaks from the + // table. + let mut unconsumed = None; let mut resolver = resolver.borrow_mut(); - for (i, slot) in slots.iter_mut().enumerate() { + for (index, slot) in slots.iter_mut().enumerate() { match slot.take() { Some(wire::SchemaValueNode::QuotaTokenHandle(handle)) => { resolver.drop_handle(handle); - leaked.get_or_insert(DecodeError::UnconsumedQuotaTokenHandle( - i as wire::ValueNodeIndex, + unconsumed.get_or_insert(DecodeError::UnconsumedQuotaTokenHandle( + index as wire::ValueNodeIndex, )); } Some(wire::SchemaValueNode::SecretValue(handle)) => { super::SecretResolver::drop_secret_handle(&mut **resolver, handle); - leaked.get_or_insert(DecodeError::UnconsumedSecretHandle( - i as wire::ValueNodeIndex, + unconsumed.get_or_insert(DecodeError::UnconsumedSecretHandle( + index as wire::ValueNodeIndex, )); } + Some(wire::SchemaValueNode::StreamValue(handle)) => { + resolver.drop_stream_handle(handle); + unconsumed + .get_or_insert(DecodeError::UnconsumedStream(index as wire::ValueNodeIndex)); + } other => *slot = other, } } match result { - Ok(value) => leaked.map_or(Ok(value), Err), - Err(err) => Err(err), + Ok(value) => unconsumed.map_or(Ok(value), Err), + Err(error) => Err(error), } } @@ -942,6 +992,9 @@ fn preflight_owned_value_tree( i as wire::ValueNodeIndex, )); } + Some(wire::SchemaValueNode::StreamValue(_)) if !reached[i] => { + return Err(DecodeError::UnconsumedStream(i as wire::ValueNodeIndex)); + } _ => {} } } @@ -1007,6 +1060,7 @@ fn preflight_owned_at( datetime_from_wire(d)?; } wire::SchemaValueNode::SecretValue(_) => {} + wire::SchemaValueNode::StreamValue(_) => {} // All remaining node kinds are leaves with no child indices and no // extra decode-time validation. Quota handles are leaves too; their // reachability is checked by the caller after the walk. @@ -1024,6 +1078,9 @@ fn reject_handles_in_pure_value_tree(wire_tree: &wire::SchemaValueTree) -> Resul wire::SchemaValueNode::QuotaTokenHandle(_) => { return Err(DecodeError::QuotaTokenRequiresResolver); } + wire::SchemaValueNode::StreamValue(_) => { + return Err(DecodeError::StreamRequiresStore(0)); + } _ => {} } } @@ -1044,6 +1101,9 @@ fn decode_owned_at( idx: wire::ValueNodeIndex, lift_quota: &mut dyn FnMut(WireQuotaHandle) -> Result, lift_secret: &mut dyn FnMut(WireSecretHandle) -> Result, + lift_stream: &mut dyn FnMut( + WireStreamHandle, + ) -> Result, ) -> Result { let pos = usize_index_v(idx)?; let node = slots @@ -1068,7 +1128,13 @@ fn decode_owned_at( wire::SchemaValueNode::RecordValue(fields) => { let mut decoded = Vec::with_capacity(fields.len()); for i in fields { - decoded.push(decode_owned_at(slots, i, lift_quota, lift_secret)?); + decoded.push(decode_owned_at( + slots, + i, + lift_quota, + lift_secret, + lift_stream, + )?); } SchemaValue::Record { fields: decoded } } @@ -1079,6 +1145,7 @@ fn decode_owned_at( i, lift_quota, lift_secret, + lift_stream, )?)), None => None, }; @@ -1092,29 +1159,47 @@ fn decode_owned_at( wire::SchemaValueNode::TupleValue(elements) => { let mut decoded = Vec::with_capacity(elements.len()); for i in elements { - decoded.push(decode_owned_at(slots, i, lift_quota, lift_secret)?); + decoded.push(decode_owned_at( + slots, + i, + lift_quota, + lift_secret, + lift_stream, + )?); } SchemaValue::Tuple { elements: decoded } } wire::SchemaValueNode::ListValue(elements) => { let mut decoded = Vec::with_capacity(elements.len()); for i in elements { - decoded.push(decode_owned_at(slots, i, lift_quota, lift_secret)?); + decoded.push(decode_owned_at( + slots, + i, + lift_quota, + lift_secret, + lift_stream, + )?); } SchemaValue::List { elements: decoded } } wire::SchemaValueNode::FixedListValue(elements) => { let mut decoded = Vec::with_capacity(elements.len()); for i in elements { - decoded.push(decode_owned_at(slots, i, lift_quota, lift_secret)?); + decoded.push(decode_owned_at( + slots, + i, + lift_quota, + lift_secret, + lift_stream, + )?); } SchemaValue::FixedList { elements: decoded } } wire::SchemaValueNode::MapValue(entries) => { let mut decoded = Vec::with_capacity(entries.len()); for e in entries { - let key = decode_owned_at(slots, e.key, lift_quota, lift_secret)?; - let value = decode_owned_at(slots, e.value, lift_quota, lift_secret)?; + let key = decode_owned_at(slots, e.key, lift_quota, lift_secret, lift_stream)?; + let value = decode_owned_at(slots, e.value, lift_quota, lift_secret, lift_stream)?; decoded.push((key, value)); } SchemaValue::Map { entries: decoded } @@ -1126,6 +1211,7 @@ fn decode_owned_at( i, lift_quota, lift_secret, + lift_stream, )?)), None => None, }, @@ -1139,6 +1225,7 @@ fn decode_owned_at( i, lift_quota, lift_secret, + lift_stream, )?)), None => None, }, @@ -1150,6 +1237,7 @@ fn decode_owned_at( i, lift_quota, lift_secret, + lift_stream, )?)), None => None, }, @@ -1180,12 +1268,19 @@ fn decode_owned_at( }), wire::SchemaValueNode::UnionValue(p) => SchemaValue::Union(UnionValuePayload { tag: p.tag, - body: Box::new(decode_owned_at(slots, p.body, lift_quota, lift_secret)?), + body: Box::new(decode_owned_at( + slots, + p.body, + lift_quota, + lift_secret, + lift_stream, + )?), }), wire::SchemaValueNode::SecretValue(handle) => SchemaValue::Secret(lift_secret(handle)?), wire::SchemaValueNode::QuotaTokenHandle(handle) => { SchemaValue::QuotaToken(lift_quota(handle)?) } + wire::SchemaValueNode::StreamValue(stream) => SchemaValue::Stream(lift_stream(stream)?), }; Ok(out) } diff --git a/golem-schema/src/schema/wit/encode.rs b/golem-schema/src/schema/wit/encode.rs index ccc36b5059..492c75038b 100644 --- a/golem-schema/src/schema/wit/encode.rs +++ b/golem-schema/src/schema/wit/encode.rs @@ -64,6 +64,17 @@ pub enum EncodeError { /// (Guest) The same owned secret handle appeared more than once in a single /// value tree. AliasedSecretHandle, + /// A live stream was used at a materializing boundary rather than a + /// stream-aware invocation boundary. + StreamNotTransportable, + /// A stream endpoint was already transferred by an earlier encode. + StreamAlreadyConsumed, + /// The same affine stream leaf appeared more than once in one value tree. + AliasedStream, + /// A guest-native reader must first be wrapped asynchronously. + StreamRequiresAsyncEncoding, + /// The host failed to transfer a native reader into a schema-value-stream resource. + StreamResolver(String), } impl Display for EncodeError { @@ -103,6 +114,26 @@ impl Display for EncodeError { "the same secret handle appeared more than once in one value tree" ) } + EncodeError::StreamNotTransportable => write!( + f, + "live streams cannot cross this materializing value boundary" + ), + EncodeError::StreamAlreadyConsumed => { + write!(f, "schema value stream was already transferred") + } + EncodeError::AliasedStream => { + write!( + f, + "the same affine stream appeared more than once in one value tree" + ) + } + EncodeError::StreamRequiresAsyncEncoding => write!( + f, + "a native schema value stream requires the asynchronous guest encoder" + ), + EncodeError::StreamResolver(message) => { + write!(f, "schema value stream could not be transferred: {message}") + } } } } @@ -178,6 +209,7 @@ pub fn encode_value(value: &SchemaValue) -> Result Result Result { + preflight_guest_handles(value)?; + let mut streams = Vec::new(); + collect_streams(value, &mut streams); + for stream in streams { + stream + .ensure_wrapped() + .await + .map_err(|_| EncodeError::StreamAlreadyConsumed)?; + } + encode_value(value) +} + /// Walk a value tree and verify that every quota-token handle is still present /// and unique, without taking any handle. Returns an error if a handle was /// already consumed or the same handle appears more than once. @@ -221,6 +276,7 @@ fn preflight_guest_handles(value: &SchemaValue) -> Result<(), EncodeError> { value: &SchemaValue, seen_quota: &mut std::collections::HashSet<*const ()>, seen_secret: &mut std::collections::HashSet<*const ()>, + seen_stream: &mut std::collections::HashSet<*const ()>, ) -> Result<(), EncodeError> { match value { SchemaValue::QuotaToken(handle) => { @@ -241,9 +297,18 @@ fn preflight_guest_handles(value: &SchemaValue) -> Result<(), EncodeError> { } Ok(()) } + SchemaValue::Stream(stream) => { + if !stream.is_present() { + return Err(EncodeError::StreamAlreadyConsumed); + } + if !seen_stream.insert(stream.cell_id()) { + return Err(EncodeError::AliasedStream); + } + Ok(()) + } SchemaValue::Record { fields } => { for f in fields { - walk(f, seen_quota, seen_secret)?; + walk(f, seen_quota, seen_secret, seen_stream)?; } Ok(()) } @@ -251,26 +316,26 @@ fn preflight_guest_handles(value: &SchemaValue) -> Result<(), EncodeError> { | SchemaValue::List { elements } | SchemaValue::FixedList { elements } => { for e in elements { - walk(e, seen_quota, seen_secret)?; + walk(e, seen_quota, seen_secret, seen_stream)?; } Ok(()) } SchemaValue::Variant(p) => { if let Some(payload) = &p.payload { - walk(payload, seen_quota, seen_secret)?; + walk(payload, seen_quota, seen_secret, seen_stream)?; } Ok(()) } SchemaValue::Map { entries } => { for (k, v) in entries { - walk(k, seen_quota, seen_secret)?; - walk(v, seen_quota, seen_secret)?; + walk(k, seen_quota, seen_secret, seen_stream)?; + walk(v, seen_quota, seen_secret, seen_stream)?; } Ok(()) } SchemaValue::Option { inner } => { if let Some(inner) = inner { - walk(inner, seen_quota, seen_secret)?; + walk(inner, seen_quota, seen_secret, seen_stream)?; } Ok(()) } @@ -279,18 +344,67 @@ fn preflight_guest_handles(value: &SchemaValue) -> Result<(), EncodeError> { ResultValuePayload::Ok { value } | ResultValuePayload::Err { value } => value, }; if let Some(inner) = inner { - walk(inner, seen_quota, seen_secret)?; + walk(inner, seen_quota, seen_secret, seen_stream)?; } Ok(()) } - SchemaValue::Union(p) => walk(&p.body, seen_quota, seen_secret), + SchemaValue::Union(p) => walk(&p.body, seen_quota, seen_secret, seen_stream), _ => Ok(()), } } let mut seen_quota = std::collections::HashSet::new(); let mut seen_secret = std::collections::HashSet::new(); - walk(value, &mut seen_quota, &mut seen_secret) + let mut seen_stream = std::collections::HashSet::new(); + walk(value, &mut seen_quota, &mut seen_secret, &mut seen_stream) +} + +#[cfg(all(feature = "guest", not(feature = "host")))] +fn collect_streams<'a>( + value: &'a SchemaValue, + streams: &mut Vec<&'a crate::schema::SchemaValueStream>, +) { + match value { + SchemaValue::Stream(stream) => streams.push(stream), + SchemaValue::Record { fields } => { + for value in fields { + collect_streams(value, streams); + } + } + SchemaValue::Tuple { elements } + | SchemaValue::List { elements } + | SchemaValue::FixedList { elements } => { + for value in elements { + collect_streams(value, streams); + } + } + SchemaValue::Variant(payload) => { + if let Some(value) = &payload.payload { + collect_streams(value, streams); + } + } + SchemaValue::Map { entries } => { + for (key, value) in entries { + collect_streams(key, streams); + collect_streams(value, streams); + } + } + SchemaValue::Option { inner } => { + if let Some(value) = inner { + collect_streams(value, streams); + } + } + SchemaValue::Result(payload) => { + let value = match payload { + ResultValuePayload::Ok { value } | ResultValuePayload::Err { value } => value, + }; + if let Some(value) = value { + collect_streams(value, streams); + } + } + SchemaValue::Union(payload) => collect_streams(&payload.body, streams), + _ => {} + } } /// Encode a value tree, turning each [`SchemaValue::QuotaToken`] snapshot into a @@ -328,6 +442,7 @@ pub fn encode_value_with( .map_err(|e| EncodeError::SecretResolver(e.to_string()))?; Ok(wire::SchemaValueNode::SecretValue(handle)) }, + &mut |_stream| Err(EncodeError::StreamNotTransportable), ); match root { Ok(root) => Ok(wire::SchemaValueTree { @@ -350,13 +465,137 @@ pub fn encode_value_with( } } +#[cfg(all(feature = "host", not(feature = "guest")))] +pub fn encode_value_with_streams< + R: super::QuotaTokenResolver + super::SecretResolver + super::SchemaValueStreamResolver, +>( + value: &SchemaValue, + resolver: &mut R, +) -> Result { + preflight_host_streams(value)?; + let resolver = std::cell::RefCell::new(resolver); + let mut ctx = ValueCtx::default(); + let root = ctx.encode( + value, + &mut |snapshot| { + let handle = resolver + .borrow_mut() + .handle_from_snapshot(snapshot) + .map_err(|error| EncodeError::QuotaResolver(error.to_string()))?; + Ok(wire::SchemaValueNode::QuotaTokenHandle(handle)) + }, + &mut |snapshot| { + let handle = resolver + .borrow_mut() + .secret_handle_from_snapshot(snapshot) + .map_err(|error| EncodeError::SecretResolver(error.to_string()))?; + Ok(wire::SchemaValueNode::SecretValue(handle)) + }, + &mut |stream| { + let stream = stream + .take_for_transfer() + .ok_or(EncodeError::StreamAlreadyConsumed)?; + let handle = resolver + .borrow_mut() + .handle_from_stream(stream) + .map_err(|error| EncodeError::StreamResolver(error.to_string()))?; + Ok(wire::SchemaValueNode::StreamValue(handle)) + }, + ); + match root { + Ok(root) => Ok(wire::SchemaValueTree { + value_nodes: ctx.value_nodes, + root, + }), + Err(error) => { + let mut resolver = resolver.borrow_mut(); + for node in ctx.value_nodes { + match node { + wire::SchemaValueNode::QuotaTokenHandle(handle) => resolver.drop_handle(handle), + wire::SchemaValueNode::SecretValue(handle) => { + super::SecretResolver::drop_secret_handle(&mut **resolver, handle) + } + wire::SchemaValueNode::StreamValue(handle) => { + resolver.drop_stream_handle(handle) + } + _ => {} + } + } + Err(error) + } + } +} + +#[cfg(all(feature = "host", not(feature = "guest")))] +fn preflight_host_streams(value: &SchemaValue) -> Result<(), EncodeError> { + fn walk( + value: &SchemaValue, + seen: &mut std::collections::HashSet<*const ()>, + ) -> Result<(), EncodeError> { + match value { + SchemaValue::Stream(stream) => { + if !stream.is_present() { + return Err(EncodeError::StreamAlreadyConsumed); + } + if !seen.insert(stream.cell_id()) { + return Err(EncodeError::AliasedStream); + } + } + SchemaValue::Record { fields } => { + for value in fields { + walk(value, seen)?; + } + } + SchemaValue::Tuple { elements } + | SchemaValue::List { elements } + | SchemaValue::FixedList { elements } => { + for value in elements { + walk(value, seen)?; + } + } + SchemaValue::Variant(payload) => { + if let Some(value) = &payload.payload { + walk(value, seen)?; + } + } + SchemaValue::Map { entries } => { + for (key, value) in entries { + walk(key, seen)?; + walk(value, seen)?; + } + } + SchemaValue::Option { inner } => { + if let Some(value) = inner { + walk(value, seen)?; + } + } + SchemaValue::Result(payload) => { + let value = match payload { + ResultValuePayload::Ok { value } | ResultValuePayload::Err { value } => value, + }; + if let Some(value) = value { + walk(value, seen)?; + } + } + SchemaValue::Union(payload) => walk(&payload.body, seen)?, + _ => {} + } + Ok(()) + } + + walk(value, &mut std::collections::HashSet::new()) +} + fn encode_value_inner( value: &SchemaValue, quota: &mut dyn FnMut(&QuotaTokenVariantValue) -> Result, secret: &mut dyn FnMut(&SecretVariantValue) -> Result, + stream: &mut dyn FnMut( + &crate::schema::SchemaValueStream, + ) -> Result, ) -> Result { let mut ctx = ValueCtx::default(); - let root = ctx.encode(value, quota, secret)?; + let root = ctx.encode(value, quota, secret, stream)?; Ok(wire::SchemaValueTree { value_nodes: ctx.value_nodes, root, @@ -737,6 +976,9 @@ impl ValueCtx { &QuotaTokenVariantValue, ) -> Result, secret: &mut dyn FnMut(&SecretVariantValue) -> Result, + stream: &mut dyn FnMut( + &crate::schema::SchemaValueStream, + ) -> Result, ) -> Result { let node = match value { SchemaValue::Bool(b) => wire::SchemaValueNode::BoolValue(*b), @@ -755,13 +997,13 @@ impl ValueCtx { SchemaValue::Record { fields } => { let mut indices = Vec::with_capacity(fields.len()); for v in fields { - indices.push(self.encode(v, quota, secret)?); + indices.push(self.encode(v, quota, secret, stream)?); } wire::SchemaValueNode::RecordValue(indices) } SchemaValue::Variant(p) => { let payload = match &p.payload { - Some(v) => Some(self.encode(v, quota, secret)?), + Some(v) => Some(self.encode(v, quota, secret, stream)?), None => None, }; wire::SchemaValueNode::VariantValue(wire::VariantValuePayload { @@ -774,21 +1016,21 @@ impl ValueCtx { SchemaValue::Tuple { elements } => { let mut indices = Vec::with_capacity(elements.len()); for v in elements { - indices.push(self.encode(v, quota, secret)?); + indices.push(self.encode(v, quota, secret, stream)?); } wire::SchemaValueNode::TupleValue(indices) } SchemaValue::List { elements } => { let mut indices = Vec::with_capacity(elements.len()); for v in elements { - indices.push(self.encode(v, quota, secret)?); + indices.push(self.encode(v, quota, secret, stream)?); } wire::SchemaValueNode::ListValue(indices) } SchemaValue::FixedList { elements } => { let mut indices = Vec::with_capacity(elements.len()); for v in elements { - indices.push(self.encode(v, quota, secret)?); + indices.push(self.encode(v, quota, secret, stream)?); } wire::SchemaValueNode::FixedListValue(indices) } @@ -796,15 +1038,15 @@ impl ValueCtx { let mut encoded = Vec::with_capacity(entries.len()); for (k, v) in entries { encoded.push(wire::MapEntry { - key: self.encode(k, quota, secret)?, - value: self.encode(v, quota, secret)?, + key: self.encode(k, quota, secret, stream)?, + value: self.encode(v, quota, secret, stream)?, }); } wire::SchemaValueNode::MapValue(encoded) } SchemaValue::Option { inner } => { let inner = match inner { - Some(v) => Some(self.encode(v, quota, secret)?), + Some(v) => Some(self.encode(v, quota, secret, stream)?), None => None, }; wire::SchemaValueNode::OptionValue(inner) @@ -813,14 +1055,14 @@ impl ValueCtx { let payload = match p { ResultValuePayload::Ok { value } => { let v = match value { - Some(v) => Some(self.encode(v, quota, secret)?), + Some(v) => Some(self.encode(v, quota, secret, stream)?), None => None, }; wire::ResultValuePayload::OkValue(v) } ResultValuePayload::Err { value } => { let v = match value { - Some(v) => Some(self.encode(v, quota, secret)?), + Some(v) => Some(self.encode(v, quota, secret, stream)?), None => None, }; wire::ResultValuePayload::ErrValue(v) @@ -861,7 +1103,7 @@ impl ValueCtx { }) } SchemaValue::Union(p) => { - let body = self.encode(&p.body, quota, secret)?; + let body = self.encode(&p.body, quota, secret, stream)?; wire::SchemaValueNode::UnionValue(wire::UnionValuePayload { tag: p.tag.clone(), body, @@ -869,6 +1111,7 @@ impl ValueCtx { } SchemaValue::Secret(s) => secret(s)?, SchemaValue::QuotaToken(q) => quota(q)?, + SchemaValue::Stream(s) => stream(s)?, }; Ok(self.push(node)) } diff --git a/golem-schema/src/schema/wit/host.rs b/golem-schema/src/schema/wit/host.rs index e8eefe6d12..230fd1e971 100644 --- a/golem-schema/src/schema/wit/host.rs +++ b/golem-schema/src/schema/wit/host.rs @@ -19,7 +19,9 @@ pub mod generated { path: "wit", world: "golem-schema", imports: { - default: async | trappable, + "golem:core/types.[static]schema-value-stream.unwrap": async | store | trappable, + "golem:core/types.[static]schema-value-stream.wrap": async | store | trappable, + default: async | store, }, exports: { default: async }, require_store_data_send: true, @@ -28,6 +30,7 @@ pub mod generated { with: { "golem:core/types@2.0.0.quota-token": crate::schema::wit::QuotaTokenHandleRep, "golem:core/types@2.0.0.secret": crate::schema::wit::SecretHandleRep, + "golem:core/types@2.0.0.schema-value-stream": crate::schema::SchemaValueStreamHandleRep, }, }); } diff --git a/golem-schema/src/schema/wit/mod.rs b/golem-schema/src/schema/wit/mod.rs index 959ca00ca6..a019d28ce3 100644 --- a/golem-schema/src/schema/wit/mod.rs +++ b/golem-schema/src/schema/wit/mod.rs @@ -46,6 +46,8 @@ pub use host::generated::golem::core::types as wire; pub use decode::{ DecodeError, GraphDecoder, decode_graph, decode_metadata, decode_typed, decode_value, }; +#[cfg(all(feature = "guest", not(feature = "host")))] +pub use encode::encode_value_async; pub use encode::{ EncodeError, GraphEncoder, encode_graph, encode_metadata, encode_typed, encode_value, }; @@ -57,16 +59,25 @@ pub use decode::{ reject_quota_handles_in_value_tree, reject_secret_handles_in_value_tree, }; #[cfg(all(feature = "host", not(feature = "guest")))] -pub use encode::encode_value_with; +pub use encode::{encode_value_with, encode_value_with_streams}; #[cfg(all(feature = "host", not(feature = "guest")))] pub use host_support::{ - QuotaTokenHandleDropper, QuotaTokenHandleRep, QuotaTokenResolver, SecretHandleDropper, - SecretHandleRep, SecretResolver, + QuotaTokenHandleDropper, QuotaTokenHandleRep, QuotaTokenResolver, SchemaValueStreamResolver, + SecretHandleDropper, SecretHandleRep, SecretResolver, }; #[cfg(all(feature = "guest", not(feature = "host")))] pub use guest_support::{GuestQuotaTokenHandle, GuestSecretHandle}; +/// Create a native Component Model stream carrying schema value trees. +#[cfg(all(feature = "guest", not(feature = "host")))] +pub fn new_schema_value_stream() -> ( + wit_bindgen::StreamWriter, + wit_bindgen::StreamReader, +) { + guest::generated::wit_stream::new() +} + /// Host-side bridge for the opaque `golem:core/types.quota-token` resource. /// /// The resource is generated by this crate's host bindings and mapped (via the @@ -78,8 +89,25 @@ pub use guest_support::{GuestQuotaTokenHandle, GuestSecretHandle}; #[cfg(all(feature = "host", not(feature = "guest")))] mod host_support { use crate::schema::schema_value::{QuotaTokenValuePayload, SecretValuePayload}; + use crate::schema::{SchemaValueStream, SchemaValueStreamHandleRep}; use wasmtime::component::Resource; + pub trait SchemaValueStreamResolver { + type Error: std::fmt::Display; + + fn handle_from_stream( + &mut self, + stream: SchemaValueStream, + ) -> Result, Self::Error>; + + fn stream_from_handle( + &mut self, + handle: Resource, + ) -> Result; + + fn drop_stream_handle(&mut self, handle: Resource); + } + /// Opaque host representation backing the `quota-token` WIT resource. /// /// The boxed payload is owned and interpreted solely by the embedder; this @@ -264,12 +292,11 @@ mod guest_support { use crate::schema::metadata::TypeId; use crate::schema::schema_type::{QuotaTokenSpec, SchemaType}; use crate::schema::schema_value::SchemaValue; - use std::cell::RefCell; - use std::rc::Rc; + use std::sync::{Arc, Mutex}; #[derive(Clone)] pub struct GuestQuotaTokenHandle { - inner: Rc>>, + inner: Arc>>, } // The methods below expose the affine owned handle so the codec (this @@ -287,7 +314,7 @@ mod guest_support { #[doc(hidden)] pub fn new(handle: wire::QuotaToken) -> Self { Self { - inner: Rc::new(RefCell::new(Some(handle))), + inner: Arc::new(Mutex::new(Some(handle))), } } @@ -295,13 +322,19 @@ mod guest_support { /// already transferred (consumed) by a previous encode. #[doc(hidden)] pub fn take(&self) -> Option { - self.inner.borrow_mut().take() + self.inner + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + .take() } /// Whether the handle is still present (not yet transferred). #[doc(hidden)] pub fn is_present(&self) -> bool { - self.inner.borrow().is_some() + self.inner + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + .is_some() } /// Run `f` with a shared reference to the owned handle, if it is still @@ -313,14 +346,18 @@ mod guest_support { /// ownership of it. #[doc(hidden)] pub fn with_handle(&self, f: impl FnOnce(&wire::QuotaToken) -> R) -> Option { - self.inner.borrow().as_ref().map(f) + self.inner + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + .as_ref() + .map(f) } /// Identity of the shared cell, used to detect the same token appearing /// more than once in a single value tree. #[doc(hidden)] pub fn cell_id(&self) -> *const () { - Rc::as_ptr(&self.inner).cast() + Arc::as_ptr(&self.inner).cast() } } @@ -337,7 +374,7 @@ mod guest_support { impl PartialEq for GuestQuotaTokenHandle { fn eq(&self, other: &Self) -> bool { - Rc::ptr_eq(&self.inner, &other.inner) + Arc::ptr_eq(&self.inner, &other.inner) } } @@ -386,7 +423,7 @@ mod guest_support { #[derive(Clone)] pub struct GuestSecretHandle { - inner: Rc>>, + inner: Arc>>, } impl GuestSecretHandle { @@ -394,7 +431,7 @@ mod guest_support { #[doc(hidden)] pub fn new(handle: wire::Secret) -> Self { Self { - inner: Rc::new(RefCell::new(Some(handle))), + inner: Arc::new(Mutex::new(Some(handle))), } } @@ -402,27 +439,37 @@ mod guest_support { /// already transferred by a previous encode. #[doc(hidden)] pub fn take(&self) -> Option { - self.inner.borrow_mut().take() + self.inner + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + .take() } /// Whether the handle is still present (not yet transferred). #[doc(hidden)] pub fn is_present(&self) -> bool { - self.inner.borrow().is_some() + self.inner + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + .is_some() } /// Run `f` with a shared reference to the owned handle, if it is still /// present. #[doc(hidden)] pub fn with_handle(&self, f: impl FnOnce(&wire::Secret) -> R) -> Option { - self.inner.borrow().as_ref().map(f) + self.inner + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + .as_ref() + .map(f) } /// Identity of the shared cell, used to detect the same secret /// appearing more than once in a single value tree. #[doc(hidden)] pub fn cell_id(&self) -> *const () { - Rc::as_ptr(&self.inner).cast() + Arc::as_ptr(&self.inner).cast() } } @@ -439,7 +486,7 @@ mod guest_support { impl PartialEq for GuestSecretHandle { fn eq(&self, other: &Self) -> bool { - Rc::ptr_eq(&self.inner, &other.inner) + Arc::ptr_eq(&self.inner, &other.inner) } } diff --git a/golem-schema/wit/deps/golem-core-v2/golem-core-v2.wit b/golem-schema/wit/deps/golem-core-v2/golem-core-v2.wit index bb7dda191e..8a8dd02254 100644 --- a/golem-schema/wit/deps/golem-core-v2/golem-core-v2.wit +++ b/golem-schema/wit/deps/golem-core-v2/golem-core-v2.wit @@ -125,6 +125,17 @@ interface types { /// and reveal it only through capability-gated host interfaces. resource secret; + /// An affine wrapper around a native Component Model stream of schema + /// values. The indirection lets a stream occur anywhere in a recursive + /// `schema-value-tree` while preserving the native stream endpoint. + resource schema-value-stream { + /// Wraps any native schema-value reader for placement in a value tree. + wrap: static async func(reader: stream) -> own; + + /// Consumes a schema-value-stream wrapper and returns its native reader. + unwrap: static async func(value: own) -> stream; + } + // ============================================================ // Schema graph (self-contained type carrier) // ============================================================ @@ -524,8 +535,7 @@ interface types { // Capability nodes secret-value(own), quota-token-handle(own), - - // WASI P3 stubs (parseable only in the schema; no constructible values). + stream-value(own), } record variant-value-payload { @@ -584,4 +594,5 @@ interface types { graph: schema-graph, value: schema-value-tree, } + } diff --git a/golem-service-base/src/grpc/client.rs b/golem-service-base/src/grpc/client.rs index 28528acd46..5cbec46ef8 100644 --- a/golem-service-base/src/grpc/client.rs +++ b/golem-service-base/src/grpc/client.rs @@ -202,6 +202,35 @@ impl MultiTargetGrpcClient { endpoint: Uri, f: F, ) -> Result + where + F: for<'a> Fn(&'a mut T) -> Pin> + 'a + Send>> + + Send, + { + self.call_with_retry(description, endpoint, true, f).await + } + + /// Performs one attempt, even for `Unavailable`, for operations whose request stream cannot + /// be replayed. + pub async fn call_without_retry( + &self, + description: impl AsRef, + endpoint: Uri, + f: F, + ) -> Result + where + F: for<'a> Fn(&'a mut T) -> Pin> + 'a + Send>> + + Send, + { + self.call_with_retry(description, endpoint, false, f).await + } + + async fn call_with_retry( + &self, + description: impl AsRef, + endpoint: Uri, + retry_on_unavailable: bool, + f: F, + ) -> Result where F: for<'a> Fn(&'a mut T) -> Pin> + 'a + Send>> + Send, @@ -232,7 +261,7 @@ impl MultiTargetGrpcClient { Err(e) => { if requires_reconnect(&e) { self.clients.remove_async(&endpoint).await; - if !retries.failed_attempt().await { + if !retry_on_unavailable || !retries.failed_attempt().await { span.in_scope(|| { warn!("gRPC call failed: {:?}, no more retries", e); }); @@ -435,3 +464,37 @@ impl EnabledGrpcClientTlsConfig { fn requires_reconnect(e: &Status) -> bool { e.code() == Code::Unavailable } + +#[cfg(test)] +mod tests { + use super::{GrpcClientConfig, MultiTargetGrpcClient}; + use std::sync::Arc; + use std::sync::atomic::{AtomicUsize, Ordering}; + use test_r::test; + use tonic::Status; + + #[derive(Clone)] + struct TestClient; + + #[test] + async fn multi_target_call_without_retry_attempts_unavailable_request_once() { + let client = + MultiTargetGrpcClient::new("test", |_, _| TestClient, GrpcClientConfig::default()); + let attempts = Arc::new(AtomicUsize::new(0)); + let attempts_for_call = attempts.clone(); + + let result = client + .call_without_retry( + "non-replayable", + "http://127.0.0.1:1".parse().unwrap(), + move |_| { + attempts_for_call.fetch_add(1, Ordering::Relaxed); + Box::pin(async { Err::<(), _>(Status::unavailable("failed")) }) + }, + ) + .await; + + assert!(result.is_err()); + assert_eq!(attempts.load(Ordering::Relaxed), 1); + } +} diff --git a/golem-service-base/src/model/agent_secret.rs b/golem-service-base/src/model/agent_secret.rs index 68122e536e..589ec95c71 100644 --- a/golem-service-base/src/model/agent_secret.rs +++ b/golem-service-base/src/model/agent_secret.rs @@ -51,16 +51,18 @@ impl From for golem_common::model::agent_secret::AgentSecretDto { } } -impl From for golem_api_grpc::proto::golem::registry::AgentSecret { - fn from(value: AgentSecret) -> Self { - Self { +impl TryFrom for golem_api_grpc::proto::golem::registry::AgentSecret { + type Error = String; + + fn try_from(value: AgentSecret) -> Result { + Ok(Self { agent_secret_id: Some(value.id.into()), environment_id: Some(value.environment_id.into()), path: value.path.0, revision: value.revision.into(), secret_type: Some(value.secret_type.into()), - secret_value: value.secret_value.map(Into::into), - } + secret_value: value.secret_value.map(TryInto::try_into).transpose()?, + }) } } diff --git a/golem-service-base/src/model/component.rs b/golem-service-base/src/model/component.rs index 43363b1fd5..dfcc78f079 100644 --- a/golem-service-base/src/model/component.rs +++ b/golem-service-base/src/model/component.rs @@ -135,14 +135,16 @@ impl TryFrom for Component { } } -impl From for golem_api_grpc::proto::golem::component::Component { - fn from(value: Component) -> Self { - Self { +impl TryFrom for golem_api_grpc::proto::golem::component::Component { + type Error = String; + + fn try_from(value: Component) -> Result { + Ok(Self { component_id: Some(value.id.into()), revision: value.revision.into(), component_name: value.component_name.0, component_size: value.component_size, - metadata: Some(value.metadata.into()), + metadata: Some(value.metadata.try_into()?), account_id: Some(value.account_id.into()), account_email: value.account_email.into_inner(), application_id: Some(value.application_id.into()), @@ -155,6 +157,6 @@ impl From for golem_api_grpc::proto::golem::component::Component { wasm_hash: Some(value.wasm_hash.into()), hash: Some(value.hash.into()), object_store_key: value.object_store_key, - } + }) } } diff --git a/golem-service-base/src/model/environment.rs b/golem-service-base/src/model/environment.rs index 1078771f56..5ce15a5fb7 100644 --- a/golem-service-base/src/model/environment.rs +++ b/golem-service-base/src/model/environment.rs @@ -28,17 +28,23 @@ pub struct EnvironmentState { pub retry_policies: Vec, } -impl From for golem_api_grpc::proto::golem::registry::EnvironmentState { - fn from(value: EnvironmentState) -> Self { - Self { +impl TryFrom for golem_api_grpc::proto::golem::registry::EnvironmentState { + type Error = String; + + fn try_from(value: EnvironmentState) -> Result { + Ok(Self { agent_deployment_details: value .agent_deployment_details .into_values() .map(Into::into) .collect(), - agent_secrets: value.agent_secrets.into_values().map(Into::into).collect(), + agent_secrets: value + .agent_secrets + .into_values() + .map(TryInto::try_into) + .collect::>()?, retry_policies: value.retry_policies.into_iter().map(Into::into).collect(), - } + }) } } diff --git a/golem-worker-executor-test-utils/Cargo.toml b/golem-worker-executor-test-utils/Cargo.toml index ca823f317c..013a7063a6 100644 --- a/golem-worker-executor-test-utils/Cargo.toml +++ b/golem-worker-executor-test-utils/Cargo.toml @@ -35,6 +35,7 @@ serde = { workspace = true } serde_json = { workspace = true } tempfile = { workspace = true } tokio = { workspace = true } +tokio-stream = { workspace = true } tokio-util = { workspace = true } tonic = { workspace = true } tonic-tracing-opentelemetry = { workspace = true } diff --git a/golem-worker-executor-test-utils/src/dsl_impl.rs b/golem-worker-executor-test-utils/src/dsl_impl.rs index 08c1e09f52..b5db0caa04 100644 --- a/golem-worker-executor-test-utils/src/dsl_impl.rs +++ b/golem-worker-executor-test-utils/src/dsl_impl.rs @@ -17,7 +17,11 @@ use crate::component_writer::CachedAnalysis; use anyhow::anyhow; use applying::Apply; use bytes::Bytes; -use golem_api_grpc::proto::golem::worker::{LogEvent, UpdateMode}; +use golem_api_grpc::InvocationResponseState; +use golem_api_grpc::proto::golem::worker::invocation_session_finished::Outcome; +use golem_api_grpc::proto::golem::worker::{ + InvocationFrame, InvocationResult, InvocationStart, LogEvent, UpdateMode, invocation_frame, +}; use golem_api_grpc::proto::golem::workerexecutor; use golem_api_grpc::proto::golem::workerexecutor::v1::{ CancelInvocationRequest, CompletePromiseRequest, ConnectWorkerRequest, CreateWorkerRequest, @@ -60,6 +64,8 @@ use golem_test_framework::dsl::{AgentResult, TestDsl, WorkerLogEventStream}; use golem_test_framework::model::IFSEntry; use std::collections::{BTreeMap, HashMap}; use std::sync::Arc; +use tokio::sync::mpsc; +use tokio_stream::wrappers::ReceiverStream; use tonic::Streaming; use uuid::Uuid; @@ -84,6 +90,71 @@ fn invocation_agent_id( .map_err(|err| anyhow!("Invalid agent id: {err}")) } +impl TestWorkerExecutor { + pub async fn invoke_agent_session( + &self, + start: InvocationStart, + ) -> anyhow::Result { + let (requests, receiver) = mpsc::channel(1); + requests + .send(InvocationFrame { + frame: Some(invocation_frame::Frame::Start(start)), + }) + .await + .map_err(|_| anyhow!("invocation session request ended before start"))?; + let mut responses = self + .client + .clone() + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + let mut state = InvocationResponseState::default(); + let mut result = None; + + while let Some(frame) = responses.message().await? { + state.validate(&frame).map_err(anyhow::Error::msg)?; + match frame.frame { + Some(invocation_frame::Frame::Result(invocation_result)) => { + result = Some(invocation_result); + } + Some(invocation_frame::Frame::Finished(finished)) => { + return match finished.outcome { + Some(Outcome::Success(_)) => { + result.ok_or_else(|| anyhow!("invocation completed without a result")) + } + Some(Outcome::Failure(failure)) => { + Err(anyhow!("Agent invocation failed: {failure:?}")) + } + Some(Outcome::ProtocolFailure(failure)) => { + Err(anyhow!("Invocation protocol failed: {}", failure.details)) + } + None => Err(anyhow!("invocation completion has no outcome")), + }; + } + Some( + invocation_frame::Frame::Demand(_) + | invocation_frame::Frame::Item(_) + | invocation_frame::Frame::End(_) + | invocation_frame::Frame::StreamError(_) + | invocation_frame::Frame::Detach(_), + ) => { + return Err(anyhow!( + "non-streaming test invocation received a stream frame" + )); + } + Some(invocation_frame::Frame::Start(_) | invocation_frame::Frame::Cancel(_)) => { + unreachable!("response validation rejects request frames") + } + None => unreachable!("response validation rejects empty frames"), + } + } + + Err(anyhow!( + "invocation session response ended before completion" + )) + } +} + #[async_trait::async_trait] impl TestDsl for TestWorkerExecutor { type WorkerError = WorkerExecutorError; @@ -445,40 +516,27 @@ impl TestDsl for TestWorkerExecutor { let (_graph, value) = params.into_parts(); let proto_method_parameters: golem_api_grpc::proto::golem::schema::SchemaValue = - value.into(); - - let result = self - .client - .clone() - .invoke_agent(workerexecutor::v1::InvokeAgentRequest { - agent_id: Some(agent_id.clone().into()), - method_name: Some(method_name.to_string()), - method_parameters: Some(proto_method_parameters), - mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule as i32, - schedule_at: None, - idempotency_key: Some(idempotency_key.clone().into()), - component_owner_account_id: Some(component.account_id.into()), - environment_id: Some(component.environment_id.into()), - auth_ctx: Some(self.auth_ctx().into()), - context: None, - principal: None, - freshness_disposition: workerexecutor::v1::InvocationFreshnessDisposition::MayExist + value.try_into().map_err(anyhow::Error::msg)?; + + self.invoke_agent_session(InvocationStart { + agent_id: Some(agent_id.clone().into()), + method_name: Some(method_name.to_string()), + input: Some(proto_method_parameters), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule as i32, + schedule_at: None, + idempotency_key: Some(idempotency_key.clone().into()), + component_owner_account_id: Some(component.account_id.into()), + environment_id: Some(component.environment_id.into()), + auth_ctx: Some(self.auth_ctx().into()), + context: None, + principal: None, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist as i32, - config: Vec::new(), - }) - .await; - - let result = result?.into_inner(); - - match result.result { - None => Err(anyhow!( - "No response from golem-worker-executor invoke_agent call" - )), - Some(workerexecutor::v1::invoke_agent_response::Result::Success(_)) => Ok(()), - Some(workerexecutor::v1::invoke_agent_response::Result::Failure(error)) => { - Err(anyhow!("Failed converting error: {error:?}")) - } - } + config: Vec::new(), + }) + .await?; + Ok(()) } #[tracing::instrument(level = "info", skip_all, fields(component_id = %component.id, %agent_id, method_name))] @@ -499,15 +557,13 @@ impl TestDsl for TestWorkerExecutor { let (_graph, value) = params.into_parts(); let proto_method_parameters: golem_api_grpc::proto::golem::schema::SchemaValue = - value.into(); + value.try_into().map_err(anyhow::Error::msg)?; let result = self - .client - .clone() - .invoke_agent(workerexecutor::v1::InvokeAgentRequest { + .invoke_agent_session(InvocationStart { agent_id: Some(worker_agent_id.clone().into()), method_name: Some(method_name.to_string()), - method_parameters: Some(proto_method_parameters), + input: Some(proto_method_parameters), mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, schedule_at: None, idempotency_key: Some(key.into()), @@ -516,32 +572,26 @@ impl TestDsl for TestWorkerExecutor { auth_ctx: Some(self.auth_ctx().into()), context: None, principal: principal.map(Into::into), - freshness_disposition: workerexecutor::v1::InvocationFreshnessDisposition::MayExist - as i32, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, config: Vec::new(), }) - .await; - - let result = result?.into_inner(); + .await?; - match result.result { - None => Err(anyhow!( - "No response from golem-worker-executor invoke_agent call" - )), - Some(workerexecutor::v1::invoke_agent_response::Result::Success(success)) => { - let value = match success.result { - Some(proto_val) => Some( - SchemaValue::try_from(proto_val) - .map_err(|err| anyhow!("SchemaValue conversion error: {err}"))?, - ), - None => None, - }; - Ok(AgentResult::new(value)) - } - Some(workerexecutor::v1::invoke_agent_response::Result::Failure(error)) => { - Err(anyhow!("Agent invocation failed: {error:?}")) - } - } + let value = match result.result { + Some( + golem_api_grpc::proto::golem::worker::invocation_result::Result::MethodResult( + proto_value, + ), + ) => Some( + SchemaValue::try_from(proto_value) + .map_err(|err| anyhow!("SchemaValue conversion error: {err}"))?, + ), + Some(golem_api_grpc::proto::golem::worker::invocation_result::Result::NoResult(_)) + | None => None, + }; + Ok(AgentResult::new(value)) } #[tracing::instrument(level = "info", skip_all, fields(%agent_id))] diff --git a/golem-worker-executor-test-utils/src/lib.rs b/golem-worker-executor-test-utils/src/lib.rs index 1e867daf02..f6a7488764 100644 --- a/golem-worker-executor-test-utils/src/lib.rs +++ b/golem-worker-executor-test-utils/src/lib.rs @@ -2155,7 +2155,10 @@ impl Bootstrap &mut linker, >::durable_ctx_mut, )?; - golem_schema::schema::wit::wire::add_to_linker::<_, HasSelf>>( + golem_schema::schema::wit::wire::add_to_linker::< + _, + golem_worker_executor::durable_host::CoreTypesHost, + >( &mut linker, >::durable_ctx_mut, )?; diff --git a/golem-worker-executor/src/durable_host/concurrent/call.rs b/golem-worker-executor/src/durable_host/concurrent/call.rs index 6e42c0dd62..67a90eb133 100644 --- a/golem-worker-executor/src/durable_host/concurrent/call.rs +++ b/golem-worker-executor/src/durable_host/concurrent/call.rs @@ -118,14 +118,14 @@ pub struct CallHandle { /// pre-call index and `end_durable_function` only uses it to commit at the right boundary. pub(super) begin_index: OplogIndex, pub(super) is_live: bool, - /// `true` when a `Start` entry was actually appended. It is `false` while snapshotting (where - /// nothing is persisted) and for replay handles. + /// `true` when a `Start` entry was actually appended. It is `false` during unpersisted + /// execution and for replay handles. pub(super) persisted: bool, /// Tracks the (possibly deferred) blob upload of this call's request payload, started when the /// `Start` was reserved. Awaited before the matching `End` / `Cancelled` is appended so an /// upload failure surfaces at the call site rather than only at the leaf oplog's commit barrier. - /// `PendingUpload::already_durable()` (a no-op) for replay handles, snapshotting, and inline - /// requests. + /// `PendingUpload::already_durable()` (a no-op) for replay handles, unpersisted execution, and + /// inline requests. pub(super) request_upload: PendingUpload, /// Replay-side resolver receiver; `Some` only for replay handles. pub(super) replay: Option, @@ -257,7 +257,7 @@ impl CallExecutionScope { /// Builds an *unregistered* atomic-region lease: it preserves the call's initiation-time region /// for trap/retry classification (matching the immutable capture used before leases existed) but /// is not a member of any region registry, so it never transfers or detaches on region close. -/// Used for replay and snapshotting handles, which do not participate in the live in-flight +/// Used for replay and unpersisted handles, which do not participate in the live in-flight /// member guard. pub(super) fn unregistered_atomic_lease( atomic_region: Option, @@ -273,7 +273,7 @@ pub(super) fn unregistered_atomic_lease( struct PreparedAccessStart { is_live: bool, - snapshotting: bool, + unpersisted: bool, oplog: Arc, public_state: PublicDurableWorkerState, replay_state: crate::durable_host::replay_state::ReplayState, @@ -707,7 +707,7 @@ impl CallHandle { /// ordering and settlement accounting survive. /// /// This handoff is only performed once *this* call is a persisted live barrier (never for - /// replay or snapshotting handles): until then the prior observer must stay armed so a guest + /// replay or unpersisted handles): until then the prior observer must stay armed so a guest /// cancellation landing before this call's `Start` still records its `CompletionDiscarded` /// marker and parks replay at the prior call. /// @@ -780,13 +780,13 @@ impl CallHandle { persistence_level: ctx.state.persistence_level, }; let is_live = durable_execution_state.is_live; - let snapshotting = durable_execution_state.snapshotting_mode.is_some(); + let unpersisted = durable_execution_state.is_unpersisted_execution; let retry = InFunctionRetryController::new(function_type, durable_execution_state, Pair::FQFN); // A live persisted call initiated inside an open atomic region joins the region's member // registry: its lease starts owned by that region and follows the region's close // transitions (transfer to the enclosing region, or detachment at the outermost close). - let atomic_lease = if is_live && !snapshotting { + let atomic_lease = if is_live && !unpersisted { match atomic_region { Some(begin_index) => Some( ctx.state @@ -809,7 +809,7 @@ impl CallHandle { let live_host_calls = ctx.state.live_host_call_counter(); Ok(PreparedAccessStart { is_live, - snapshotting, + unpersisted, oplog: ctx.state.oplog.clone(), public_state: ctx.public_state.clone(), replay_state: ctx.state.replay_state.clone(), @@ -830,8 +830,8 @@ impl CallHandle { }) } - /// Persistence-suppression model: only **snapshotting** is handled here (the live - /// `persisted: false` branch). `PersistenceLevel::PersistNothing` deliberately is *not* — a + /// Unpersisted executions take the live `persisted: false` branch. + /// `PersistenceLevel::PersistNothing` deliberately is *not* treated this way — a /// live call inside a persist-nothing zone still appends its `Start`/`End`, exactly like the /// legacy P2 path (`persist_durable_function_invocation`), because the PersistNothing contract /// is enforced elsewhere: `PrimaryOplog::commit` suppresses non-`Always` commits while the @@ -851,7 +851,7 @@ impl CallHandle { let starts_scope = opens_accessor_scope( prepared.retry.function_type(), prepared.retry.durable_execution_state().assume_idempotence, - prepared.snapshotting, + prepared.unpersisted, ); let scope_start = if starts_scope { Some(Self::execute_access_scope_start(&prepared).await?) @@ -871,7 +871,7 @@ impl CallHandle { DurableExecutionState { is_live: true, persistence_level: previous.persistence_level, - snapshotting_mode: previous.snapshotting_mode, + is_unpersisted_execution: previous.is_unpersisted_execution, assume_idempotence: previous.assume_idempotence, max_in_function_retry_delay: previous.max_in_function_retry_delay, }, @@ -914,7 +914,7 @@ impl CallHandle { })?; if is_live { - if prepared.snapshotting { + if prepared.unpersisted { let start_idx = prepared.oplog.current_oplog_index().await; let atomic_lease = unregistered_atomic_lease( execution_scope.atomic_region, @@ -1566,6 +1566,10 @@ impl CallHandle { .max_in_function_retry_delay, current_retry_policy_state, retry_properties: properties.clone(), + is_unpersisted_execution: self + .retry + .durable_execution_state() + .is_unpersisted_execution, worker, }; @@ -2642,25 +2646,37 @@ where D: HasData + ?Sized, Ctx: WorkerCtx, { - let (opens_scope, is_live, replay_handle, replay_state, oplog, public_state) = - store.with(|mut access| { - let ctx = get_ctx(access.data_mut()); - let opens_scope = ctx.state.opens_durable_scope(&function_type); - let is_live = ctx.state.is_live(); - let replay_handle = if opens_scope && !is_live { - ctx.state.take_durable_scope_replay_handle(begin_index) - } else { - None - }; - ( - opens_scope, - is_live, - replay_handle, - ctx.state.replay_state.clone(), - ctx.state.oplog.clone(), - ctx.public_state.clone(), - ) - }); + let ( + opens_scope, + is_live, + is_unpersisted_execution, + replay_handle, + replay_state, + oplog, + public_state, + ) = store.with(|mut access| { + let ctx = get_ctx(access.data_mut()); + let opens_scope = ctx.state.opens_durable_scope(&function_type); + let is_live = ctx.state.is_live(); + let replay_handle = if opens_scope && !is_live { + ctx.state.take_durable_scope_replay_handle(begin_index) + } else { + None + }; + ( + opens_scope, + is_live, + ctx.is_unpersisted_execution(), + replay_handle, + ctx.state.replay_state.clone(), + ctx.state.oplog.clone(), + ctx.public_state.clone(), + ) + }); + + if is_unpersisted_execution { + return Ok(()); + } if opens_scope { if is_live { @@ -2807,20 +2823,21 @@ where D: HasData + ?Sized, Ctx: WorkerCtx, { - let (is_live, worker, replay_state) = store.with(|mut access| { + let (is_live, is_unpersisted_execution, worker, replay_state) = store.with(|mut access| { let ctx = get_ctx(access.data_mut()); ( ctx.state.is_live(), + ctx.is_unpersisted_execution(), ctx.public_state.worker(), ctx.state.replay_state.clone(), ) }); - if is_live { + if is_live && !is_unpersisted_execution { worker .add_to_oplog(OplogEntry::finish_span(span_id.clone())) .await; - } else { + } else if !is_live { crate::get_oplog_entry_owned!(replay_state, OplogEntry::FinishSpan)?; } @@ -2843,9 +2860,9 @@ fn is_accessor_supported_function_type(function_type: &DurableFunctionType) -> b fn opens_accessor_scope( function_type: &DurableFunctionType, assume_idempotence: bool, - snapshotting: bool, + unpersisted: bool, ) -> bool { - !snapshotting + !unpersisted && ((*function_type == DurableFunctionType::WriteRemote && !assume_idempotence) || matches!(function_type, DurableFunctionType::WriteRemoteBatched(None))) } @@ -3298,24 +3315,23 @@ impl BegunCall { } /// Second phase on the live path: upload the request and append the eager host-call `Start` - /// (or, while snapshotting, persist nothing). + /// (or, during an unpersisted execution, persist nothing). pub async fn start_live( self, ctx: &mut DurableWorkerCtx, request: Pair::Req, ) -> Result, WorkerExecutorError> { debug_assert!(self.is_live(), "start_live() called on a replay handle"); - let snapshotting = self + let is_unpersisted_execution = self .retry .durable_execution_state() - .snapshotting_mode - .is_some(); + .is_unpersisted_execution; // The host-call `Start` nests inside the enclosing durable scope captured at initiation // (its own opened scope, or the scope encoded in the function type), derived explicitly — // never from the set of temporally-open sibling scopes. `None` for a top-level unscoped call. let parent_start_index = self.execution_scope.parent_start_index; - let (start_idx, persisted, request_upload) = if snapshotting { - // Snapshotting mode persists nothing. + let (start_idx, persisted, request_upload) = if is_unpersisted_execution { + // Unpersisted execution writes no durable call records. let oplog = ctx.state.oplog.clone(); ( oplog.current_oplog_index().await, @@ -3366,7 +3382,7 @@ impl BegunCall { None } } else { - // Snapshotting persists nothing; keep the initiation-time region for trap/retry + // Unpersisted execution writes nothing; keep the initiation-time region for trap/retry // classification without joining the live in-flight member guard. unregistered_atomic_lease( self.execution_scope.atomic_region, @@ -3453,7 +3469,7 @@ impl Drop for CallHandle { self.drop_sink.as_ref(), ); } - // Not persisted (snapshotting): there is nothing on disk to reconcile. + // Not persisted: there is nothing on disk to reconcile. } else { if opens_replay_durable_scope( self.retry.function_type(), diff --git a/golem-worker-executor/src/durable_host/concurrent/delivery.rs b/golem-worker-executor/src/durable_host/concurrent/delivery.rs index b3899bdc92..c9696d060a 100644 --- a/golem-worker-executor/src/durable_host/concurrent/delivery.rs +++ b/golem-worker-executor/src/durable_host/concurrent/delivery.rs @@ -99,7 +99,7 @@ pub struct CompletionDelivery { pub(super) enum CompletionDeliveryState { /// Live, armed: the `End` is persisted and a torn/failed delivery must record a marker. Live(Box), - /// Live, but the call was not persisted (snapshotting): nothing to reconcile. + /// Live, but the call was not persisted: nothing to reconcile. Unarmed, /// Replay of a normally delivered completion. ReplayDelivered, @@ -231,7 +231,7 @@ impl CompletionDelivery { /// recorded, replay re-executes the host code past this `End` deterministically and /// re-consumes the response internally, so no marker is needed. /// - /// Non-live tokens (replay, unpersisted snapshotting calls) settle immediately; if the + /// Non-live tokens (replay and unpersisted calls) settle immediately; if the /// accessor has no guest-visible host subtask (e.g. a spawned background task), the token /// settles without a marker, matching the pre-observer behavior of consuming it at the host /// return. diff --git a/golem-worker-executor/src/durable_host/concurrent/tests.rs b/golem-worker-executor/src/durable_host/concurrent/tests.rs index b010ec0b90..5d940688e3 100644 --- a/golem-worker-executor/src/durable_host/concurrent/tests.rs +++ b/golem-worker-executor/src/durable_host/concurrent/tests.rs @@ -28,7 +28,7 @@ fn durable_execution_state() -> DurableExecutionState { DurableExecutionState { is_live: true, persistence_level: PersistenceLevel::Smart, - snapshotting_mode: None, + is_unpersisted_execution: false, assume_idempotence: true, max_in_function_retry_delay: Duration::from_secs(20), } @@ -173,7 +173,7 @@ fn live_unfinished_handle_with_atomic_region( let durable_execution_state = DurableExecutionState { is_live: true, persistence_level: PersistenceLevel::Smart, - snapshotting_mode: None, + is_unpersisted_execution: false, assume_idempotence: false, max_in_function_retry_delay: Duration::ZERO, }; @@ -218,7 +218,7 @@ fn synthetic_finished_handle_with_scope( let durable_execution_state = DurableExecutionState { is_live: true, persistence_level: PersistenceLevel::Smart, - snapshotting_mode: None, + is_unpersisted_execution: false, assume_idempotence: false, max_in_function_retry_delay: Duration::ZERO, }; @@ -1505,7 +1505,7 @@ fn can_reexecute_matches_internal_retry_eligibility() { DurableExecutionState { is_live: true, persistence_level: PersistenceLevel::Smart, - snapshotting_mode: None, + is_unpersisted_execution: false, assume_idempotence, max_in_function_retry_delay: Duration::ZERO, }, diff --git a/golem-worker-executor/src/durable_host/durability.rs b/golem-worker-executor/src/durable_host/durability.rs index 0872951429..39b7ab1c2d 100644 --- a/golem-worker-executor/src/durable_host/durability.rs +++ b/golem-worker-executor/src/durable_host/durability.rs @@ -369,7 +369,7 @@ pub enum AsyncRetryDecision { pub struct DurableExecutionState { pub is_live: bool, pub persistence_level: PersistenceLevel, - pub snapshotting_mode: Option, + pub is_unpersisted_execution: bool, /// Whether the executor assumes idempotence for remote writes. pub assume_idempotence: bool, /// Maximum delay for in-function retries. Delays exceeding this fall back to trap+replay. @@ -1083,6 +1083,9 @@ impl durability::Host for DurableWorkerCtx { let response_typed = response_typed.map_err(|e| { anyhow::anyhow!("Failed to decode durable function response schema value: {e}") })?; + if self.is_unpersisted_execution() { + return Ok(()); + } DurabilityHost::persist_durable_function_invocation( self, HostFunctionName::Custom(function_name), @@ -1126,10 +1129,11 @@ impl InFunctionRetryHost for DurableWorkerCtx { } fn durable_execution_state(&self) -> DurableExecutionState { + let is_unpersisted_execution = self.is_unpersisted_execution(); DurableExecutionState { - is_live: self.state.is_live() || self.state.snapshotting_mode.is_some(), + is_live: self.state.is_live() || is_unpersisted_execution, persistence_level: self.state.persistence_level, - snapshotting_mode: self.state.snapshotting_mode, + is_unpersisted_execution, assume_idempotence: self.state.assume_idempotence, max_in_function_retry_delay: self.state.config.max_in_function_retry_delay, } @@ -1151,7 +1155,7 @@ impl InFunctionRetryHost for DurableWorkerCtx { inside_atomic_region: bool, retry_policy_state: Option, ) { - if self.state.snapshotting_mode.is_some() { + if self.is_unpersisted_execution() { return; } @@ -1213,7 +1217,7 @@ impl DurabilityHost for DurableWorkerCtx { forced_commit: bool, ) -> Result<(), WorkerExecutorError> { self.end_function(function_type, begin_index).await?; - if self.state.snapshotting_mode.is_none() + if !self.is_unpersisted_execution() && (function_type == &DurableFunctionType::WriteRemote || matches!(function_type, DurableFunctionType::WriteRemoteBatched(_)) || matches!( @@ -1363,6 +1367,10 @@ impl DurabilityHost for DurableWorkerCtx { let status = self.execution_status.read().unwrap(); status.create_await_interrupt_signal() }; + let live_stream_cancellation = self + .live_stream_tracker + .as_ref() + .map(|tracker| tracker.cancellation_token()); if self .state .invocation_deadline_exceeded @@ -1371,6 +1379,9 @@ impl DurabilityHost for DurableWorkerCtx { .state .tail_work_deadline_exceeded .load(std::sync::atomic::Ordering::Acquire) + || live_stream_cancellation + .as_ref() + .is_some_and(tokio_util::sync::CancellationToken::is_cancelled) { let status = self.execution_status.read().unwrap(); if matches!(&*status, ExecutionStatus::Interrupting { .. }) { @@ -1380,7 +1391,18 @@ impl DurabilityHost for DurableWorkerCtx { Timestamp::now_utc(), ))); } - interrupt_signal + match live_stream_cancellation { + Some(cancellation) => Box::pin(async move { + tokio::select! { + biased; + interrupt = interrupt_signal => interrupt, + () = cancellation.cancelled() => { + InterruptKind::Interrupt(Timestamp::now_utc()) + } + } + }), + None => interrupt_signal, + } } fn check_read_only_allows(&self, host_function: &str) -> Result<(), GolemSpecificWasmTrap> { @@ -1644,6 +1666,8 @@ pub struct TaskRetryContext { pub current_retry_policy_state: Option, /// Properties describing the error context (verb, URI, status code, etc.) for predicate evaluation. pub retry_properties: RetryProperties, + /// Whether retry bookkeeping belongs to an unpersisted execution and must not be recorded. + pub is_unpersisted_execution: bool, /// Reference to the worker that owns this task. pub worker: Arc>, } @@ -1685,7 +1709,7 @@ impl InFunctionRetryHost for TaskRetryContext { DurableExecutionState { is_live: true, persistence_level: PersistenceLevel::Smart, - snapshotting_mode: None, + is_unpersisted_execution: false, assume_idempotence: true, max_in_function_retry_delay: self.max_in_function_retry_delay, } @@ -1697,6 +1721,11 @@ impl InFunctionRetryHost for TaskRetryContext { inside_atomic_region: bool, retry_policy_state: Option, ) { + if self.is_unpersisted_execution { + self.current_retry_policy_state = retry_policy_state; + return; + } + use golem_common::model::oplog::AgentError; let entry = OplogEntry::error( AgentError::TransientError("in-function retry".to_string()), @@ -1839,7 +1868,7 @@ mod tests { DurableExecutionState { is_live: true, persistence_level: PersistenceLevel::Smart, - snapshotting_mode: None, + is_unpersisted_execution: false, assume_idempotence: self.assume_idempotence, max_in_function_retry_delay: self.max_in_function_retry_delay, } diff --git a/golem-worker-executor/src/durable_host/golem/retry_api.rs b/golem-worker-executor/src/durable_host/golem/retry_api.rs index dbaa706aa2..0c09bc967d 100644 --- a/golem-worker-executor/src/durable_host/golem/retry_api.rs +++ b/golem-worker-executor/src/durable_host/golem/retry_api.rs @@ -128,8 +128,8 @@ impl Host for DurableWorkerCtx { let named_policy: NamedRetryPolicy = policy.into(); - if self.state.snapshotting_mode.is_some() { - // Snapshot loading restores in-memory retry policy changes without recording them again. + if self.state.is_unpersisted_execution() { + // Apply the in-memory change without creating durable history. } else if self.state.is_live() { self.public_state .worker() @@ -146,8 +146,8 @@ impl Host for DurableWorkerCtx { async fn remove_retry_policy(&mut self, name: String) -> anyhow::Result<()> { self.observe_function_call("golem::api::retry", "remove_retry_policy"); - if self.state.snapshotting_mode.is_some() { - // Snapshot loading restores in-memory retry policy changes without recording them again. + if self.state.is_unpersisted_execution() { + // Apply the in-memory change without creating durable history. } else if self.state.is_live() { self.public_state .worker() diff --git a/golem-worker-executor/src/durable_host/golem/v1x.rs b/golem-worker-executor/src/durable_host/golem/v1x.rs index 4969e0b865..1f4a20d732 100644 --- a/golem-worker-executor/src/durable_host/golem/v1x.rs +++ b/golem-worker-executor/src/durable_host/golem/v1x.rs @@ -322,7 +322,7 @@ impl Host for DurableWorkerCtx { async fn get_oplog_index(&mut self) -> anyhow::Result { self.observe_function_call("golem::api", "get_oplog_index"); - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { Ok(self.state.current_oplog_index().await.into()) } else if self.state.is_live() { // Use the index returned by `add` — a concurrently running host task (a durable @@ -362,7 +362,7 @@ impl Host for DurableWorkerCtx { oplog_idx: golem_api_1_x::oplog::OplogIndex, ) -> anyhow::Result<()> { self.observe_function_call("golem::api", "set_oplog_index"); - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { return Ok(()); } if self.state.is_live() { @@ -445,7 +445,7 @@ impl Host for DurableWorkerCtx { async fn mark_begin_operation(&mut self) -> anyhow::Result { self.observe_function_call("golem::api", "mark_begin_operation"); - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { Ok(self.state.current_oplog_index().await.into()) } else if self.state.is_live() { let next_idempotency_key_oplog_index = self @@ -532,7 +532,7 @@ impl Host for DurableWorkerCtx { begin: golem_api_1_x::oplog::OplogIndex, ) -> anyhow::Result<()> { self.observe_function_call("golem::api", "mark_end_operation"); - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { return Ok(()); } let begin_index = OplogIndex::from_u64(begin); @@ -606,7 +606,7 @@ impl Host for DurableWorkerCtx { self.observe_function_call("golem::api", "set_oplog_persistence_level"); let new_persistence_level = new_persistence_level.into(); - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { return Ok(()); } @@ -631,24 +631,20 @@ impl Host for DurableWorkerCtx { // eventual `End` outside the zone would reference a `Start` replay never sees. // Such a scope must be closed before the zone is. // - // During snapshotting no oplog entries are written, so no boundary is created and - // the guard is skipped. - if self.state.snapshotting_mode.is_none() { - drain_queued_dropped_call_events(self) - .await - .map_err(anyhow::Error::from)?; - if self.state.has_in_flight_live_host_calls() { - return Err(anyhow!( - "Cannot change oplog persistence level: durable host calls are still in flight" - )); - } - if self.state.persistence_level == PersistenceLevel::PersistNothing - && self.state.has_open_scope_in_persist_nothing_zone() - { - return Err(anyhow!( - "Cannot change oplog persistence level: a durable scope (batched remote write or transaction) opened inside the PersistNothing zone is still open" - )); - } + drain_queued_dropped_call_events(self) + .await + .map_err(anyhow::Error::from)?; + if self.state.has_in_flight_live_host_calls() { + return Err(anyhow!( + "Cannot change oplog persistence level: durable host calls are still in flight" + )); + } + if self.state.persistence_level == PersistenceLevel::PersistNothing + && self.state.has_open_scope_in_persist_nothing_zone() + { + return Err(anyhow!( + "Cannot change oplog persistence level: a durable scope (batched remote write or transaction) opened inside the PersistNothing zone is still open" + )); } self.public_state .worker() @@ -1255,10 +1251,12 @@ impl Host for DurableWorkerCtx { .state .opens_durable_scope(&DurableFunctionType::WriteRemote) .then_some(oplog_index_cut_off); - self.public_state - .worker() - .commit_oplog_and_update_state(CommitLevel::Always) - .await; + if !self.is_unpersisted_execution() { + self.public_state + .worker() + .commit_oplog_and_update_state(CommitLevel::Always) + .await; + } let created_by = self.created_by(); let fork_result = loop { diff --git a/golem-worker-executor/src/durable_host/http/inline_retry.rs b/golem-worker-executor/src/durable_host/http/inline_retry.rs index d0d51b158a..9760422030 100644 --- a/golem-worker-executor/src/durable_host/http/inline_retry.rs +++ b/golem-worker-executor/src/durable_host/http/inline_retry.rs @@ -127,8 +127,8 @@ pub(crate) fn take_http_background_retry_fallback( pub enum InlineRetryIneligible { /// Worker is in replay mode (not live). NotLive, - /// Worker is in snapshotting mode. - Snapshotting, + /// Worker is executing host operations without persistence. + UnpersistedExecution, /// Persistence level is PersistNothing — no oplog data to reconstruct from. PersistNothing, /// Worker is inside a user-defined atomic region; a failure must escalate @@ -165,7 +165,9 @@ impl From for InlineRetryIneligible { fn from(reason: HttpRetryDisallowedReason) -> Self { match reason { HttpRetryDisallowedReason::NotLive => InlineRetryIneligible::NotLive, - HttpRetryDisallowedReason::Snapshotting => InlineRetryIneligible::Snapshotting, + HttpRetryDisallowedReason::UnpersistedExecution => { + InlineRetryIneligible::UnpersistedExecution + } HttpRetryDisallowedReason::PersistNothing => InlineRetryIneligible::PersistNothing, HttpRetryDisallowedReason::InAtomicRegion => InlineRetryIneligible::InAtomicRegion, HttpRetryDisallowedReason::NotIdempotent => InlineRetryIneligible::NotIdempotent, @@ -699,6 +701,7 @@ pub(crate) fn spawn_http_status_retry_after_body_finish, max_delay: Duration, begin_index: OplogIndex, + is_unpersisted_execution: bool, ) -> FutureIncomingResponseHandle { // No span: this task waits for the guest to finish its outgoing body, so its // duration is decided by guest code rather than by an operation the executor @@ -752,6 +755,7 @@ pub(crate) fn spawn_http_status_retry_after_body_finish( max_delay: Duration, begin_index: OplogIndex, execution_status: Arc>, + is_unpersisted_execution: bool, ) -> FutureIncomingResponseHandle { // Capture config fields individually since OutgoingRequestConfig is not Clone let use_tls = config.use_tls; @@ -1001,6 +1006,7 @@ pub fn spawn_http_request_with_retry( max_in_function_retry_delay: max_delay, current_retry_policy_state, retry_properties, + is_unpersisted_execution, worker, }; @@ -1276,6 +1282,7 @@ pub async fn try_output_stream_inline_retry( exec_state.max_in_function_retry_delay, request_state.begin_index, ctx.execution_status.clone(), + ctx.is_unpersisted_execution(), ); HostFutureIncomingResponse::pending(retry_handle) } else { @@ -1553,7 +1560,7 @@ pub(crate) enum StatusRetryOutcome { /// This is invoked from `HostFutureIncomingResponse::get` *after* the response has /// arrived (so its status is known) but *before* the response is exposed to guest /// code or persisted. Behavior: -/// - In replay mode, snapshotting mode, `PersistNothing`, or inside an atomic region +/// - In replay mode, unpersisted execution, `PersistNothing`, or inside an atomic region /// the function is a no-op (`NoRetry`) — by design (atomic-region semantics: skip /// in v1, the user-land throw triggers atomic-region replay). /// - Otherwise eligibility is checked using the same rules as @@ -1825,7 +1832,7 @@ mod tests { DurableExecutionState { is_live: true, persistence_level: PersistenceLevel::PersistRemoteSideEffects, - snapshotting_mode: None, + is_unpersisted_execution: false, assume_idempotence: true, max_in_function_retry_delay: Duration::from_secs(1), } diff --git a/golem-worker-executor/src/durable_host/http/outgoing_http.rs b/golem-worker-executor/src/durable_host/http/outgoing_http.rs index fda84bcae9..6151effb29 100644 --- a/golem-worker-executor/src/durable_host/http/outgoing_http.rs +++ b/golem-worker-executor/src/durable_host/http/outgoing_http.rs @@ -100,6 +100,7 @@ pub(crate) async fn maybe_enable_http_background_retry( durable_state.max_in_function_retry_delay, state.begin_index, ctx.execution_status.clone(), + ctx.is_unpersisted_execution(), ); HostFutureIncomingResponse::pending(retry_handle) } else { @@ -184,6 +185,7 @@ pub(crate) async fn maybe_enable_http_pending_status_retry( agent_type, ctx.state.config.max_in_function_retry_delay, state.begin_index, + ctx.is_unpersisted_execution(), )) } else { old diff --git a/golem-worker-executor/src/durable_host/http/policy.rs b/golem-worker-executor/src/durable_host/http/policy.rs index 366754fc2d..89933501c4 100644 --- a/golem-worker-executor/src/durable_host/http/policy.rs +++ b/golem-worker-executor/src/durable_host/http/policy.rs @@ -65,8 +65,8 @@ pub(crate) fn is_http_request_idempotent( pub(crate) enum HttpRetryDisallowedReason { /// Worker is in replay mode (not live). NotLive, - /// Worker is in snapshotting mode. - Snapshotting, + /// Worker is executing host operations without persistence. + UnpersistedExecution, /// Persistence level is PersistNothing — no oplog data to reconstruct from. PersistNothing, /// Worker is inside a user-defined atomic region; a failure must escalate @@ -87,8 +87,8 @@ pub(crate) fn http_worker_state_allows_retry( if !exec_state.is_live { return Err(HttpRetryDisallowedReason::NotLive); } - if exec_state.snapshotting_mode.is_some() { - return Err(HttpRetryDisallowedReason::Snapshotting); + if exec_state.is_unpersisted_execution { + return Err(HttpRetryDisallowedReason::UnpersistedExecution); } if exec_state.persistence_level == PersistenceLevel::PersistNothing { return Err(HttpRetryDisallowedReason::PersistNothing); @@ -302,7 +302,7 @@ mod tests { DurableExecutionState { is_live: true, persistence_level: PersistenceLevel::Smart, - snapshotting_mode: None, + is_unpersisted_execution: false, assume_idempotence: false, max_in_function_retry_delay: std::time::Duration::from_secs(1), } @@ -327,12 +327,12 @@ mod tests { assert_eq!( http_worker_state_allows_retry( &DurableExecutionState { - snapshotting_mode: Some(PersistenceLevel::Smart), + is_unpersisted_execution: true, ..live_exec_state() }, false ), - Err(HttpRetryDisallowedReason::Snapshotting) + Err(HttpRetryDisallowedReason::UnpersistedExecution) ); assert_eq!( http_worker_state_allows_retry( diff --git a/golem-worker-executor/src/durable_host/http/types.rs b/golem-worker-executor/src/durable_host/http/types.rs index c80ee5397a..cbde7a3cf2 100644 --- a/golem-worker-executor/src/durable_host/http/types.rs +++ b/golem-worker-executor/src/durable_host/http/types.rs @@ -891,7 +891,7 @@ impl HostFutureIncomingResponse for DurableWorkerCtx { let handle = self_.rep(); let durable_execution_state = self.durable_execution_state(); - if durable_execution_state.is_live || self.state.snapshotting_mode.is_some() { + if durable_execution_state.is_live { let request_state = self .state .open_http_requests @@ -1439,6 +1439,7 @@ impl DurableWorkerCtx { exec_state.max_in_function_retry_delay, request_state.begin_index, self.execution_status.clone(), + self.is_unpersisted_execution(), ); wasmtime_wasi_http::p2::types::HostFutureIncomingResponse::pending(retry_handle) } else { @@ -1534,7 +1535,7 @@ async fn persist_http_response( serializable_response: &SerializableHttpResponse, begin_index: golem_common::model::oplog::OplogIndex, ) { - if ctx.state.snapshotting_mode.is_none() { + if !ctx.is_unpersisted_execution() { ctx.append_completed_child_call( HttpTypesFutureIncomingResponseGet::HOST_FUNCTION_NAME, &HostRequest::HttpRequest(request), diff --git a/golem-worker-executor/src/durable_host/logging/policy.rs b/golem-worker-executor/src/durable_host/logging/policy.rs index e39f9fa355..5b3983e69b 100644 --- a/golem-worker-executor/src/durable_host/logging/policy.rs +++ b/golem-worker-executor/src/durable_host/logging/policy.rs @@ -32,9 +32,10 @@ use std::sync::Arc; /// Applies the common log emission policy for a single worker log event. /// -/// `is_live` must be sampled from the worker state at the time of the call; `oplog` must be the -/// worker's private oplog (used by the [`LogEventEmitBehaviour::Always`] branch, which appends -/// without going through the invocation queue). +/// `is_live` and `is_unpersisted_execution` must be sampled from worker state at the time +/// of the call; `oplog` must be the worker's private oplog (used by the +/// [`LogEventEmitBehaviour::Always`] branch, which appends without going through the invocation +/// queue). pub async fn emit_log_event_with_state( event: InternalWorkerEvent, has_oplog_processor: bool, @@ -43,6 +44,7 @@ pub async fn emit_log_event_with_state( replay_state: &ReplayState, oplog: &Arc, is_live: bool, + is_unpersisted_execution: bool, ) { if let Some(entry) = event.as_oplog_entry() && let OplogEntry::Log { @@ -103,7 +105,9 @@ pub async fn emit_log_event_with_state( if !replay_state.seen_log(*level, context, message).await { // haven't seen this log before public_state.event_service().emit_event(event.clone(), true); - public_state.worker().add_to_oplog(entry).await; + if !is_unpersisted_execution { + public_state.worker().add_to_oplog(entry).await; + } } else { // we have persisted emitting this log before, so we mark it as non-live and // remove the entry from the seen log set. @@ -119,7 +123,10 @@ pub async fn emit_log_event_with_state( LogEventEmitBehaviour::Always => { public_state.event_service().emit_event(event.clone(), true); - if is_live && !replay_state.seen_log(*level, context, message).await { + if is_live + && !is_unpersisted_execution + && !replay_state.seen_log(*level, context, message).await + { oplog.add(entry).await; } } diff --git a/golem-worker-executor/src/durable_host/mod.rs b/golem-worker-executor/src/durable_host/mod.rs index 3a7bdbe810..155e4cc56c 100644 --- a/golem-worker-executor/src/durable_host/mod.rs +++ b/golem-worker-executor/src/durable_host/mod.rs @@ -32,8 +32,12 @@ pub mod quota; mod random; pub mod rdbms; mod replay_state; +pub(crate) mod schema_value_stream; mod secrets; +pub use schema_value_stream::CoreTypesHost; mod sockets; +pub(crate) mod stream_session; +pub(crate) mod stream_transport; mod suspendable_wait; pub mod tail_work; pub mod tool; @@ -46,14 +50,18 @@ use crate::durable_host::io::{ManagedStdErr, ManagedStdIn, ManagedStdOut}; use crate::durable_host::replay_state::{OplogEntryLookupResult, ReplayState}; use crate::metrics::ephemeral::record_non_suspending_failure; use crate::metrics::storage::{ - STORAGE_TYPE_FILESYSTEM, record_storage_bytes_deleted, record_storage_bytes_written, + STORAGE_TYPE_FILESYSTEM, record_filesystem_pool_released, record_storage_bytes_deleted, + record_storage_bytes_written, }; use crate::metrics::wasm::{record_number_of_replayed_functions, record_resume_worker}; use crate::model::event::InternalWorkerEvent; use crate::model::{ AgentConfig, ExecutionStatus, InvocationContext, LastError, ReadFileResult, TrapType, }; -use crate::services::active_workers::MemoryGrant; +use crate::services::active_workers::{ + FilesystemStoragePermit, MemoryGrant, bytes_to_filesystem_storage_permits, + filesystem_storage_permits_to_bytes, +}; use crate::services::agent_storage_meter::AgentStorageMeter; use crate::services::agent_types::AgentTypesService; use crate::services::agent_webhooks::AgentWebhooksService; @@ -176,6 +184,93 @@ impl WorkerDir { } } +#[derive(Debug)] +struct UnpersistedFilesystemStorage { + baseline_bytes: u64, + permit: Option, +} + +impl UnpersistedFilesystemStorage { + fn new(baseline_bytes: u64) -> Self { + Self { + baseline_bytes, + permit: None, + } + } + + fn extra_permits_for(&self, current_bytes: u64) -> u32 { + bytes_to_filesystem_storage_permits(current_bytes) + .saturating_sub(bytes_to_filesystem_storage_permits(self.baseline_bytes)) + } + + fn capacity_growth(&self, current_bytes: u64, new_bytes: u64) -> u64 { + let before = self.extra_permits_for(current_bytes); + let after = self.extra_permits_for(current_bytes.saturating_add(new_bytes)); + filesystem_storage_permits_to_bytes(after.saturating_sub(before)) + } + + fn merge(&mut self, permit: Option) { + let Some(permit) = permit else { + return; + }; + match &mut self.permit { + Some(existing) => existing.merge(permit), + None => self.permit = Some(permit), + } + } + + fn reconcile(&mut self, current_bytes: u64) { + let target = self.extra_permits_for(current_bytes) as usize; + let held = self + .permit + .as_ref() + .map_or(0, FilesystemStoragePermit::num_permits); + let excess = held.saturating_sub(target); + if excess > 0 + && let Some(permit) = &mut self.permit + { + record_filesystem_pool_released(filesystem_storage_permits_to_bytes(excess as u32)); + drop(permit.split(excess)); + } + if self + .permit + .as_ref() + .is_some_and(|permit| permit.num_permits() == 0) + { + self.permit = None; + } + } +} + +impl Drop for UnpersistedFilesystemStorage { + fn drop(&mut self) { + let permits = self + .permit + .as_ref() + .map_or(0, FilesystemStoragePermit::num_permits); + if permits > 0 { + record_filesystem_pool_released(filesystem_storage_permits_to_bytes(permits as u32)); + } + } +} + +/// An execution that performs real host operations but must not create replayable worker history. +/// +/// This is stronger than `PersistenceLevel::PersistNothing`: persist-nothing zones may retain +/// observability entries that replay skips, while an unpersisted execution writes no invocation, +/// durable-call, retry, resource, span, or status entries at all. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum UnpersistedExecutionKind { + SnapshottingFunction, + StreamingInvocation, +} + +#[derive(Debug, Clone, Copy)] +struct UnpersistedExecution { + kind: UnpersistedExecutionKind, + previous_persistence_level: PersistenceLevel, +} + impl Drop for WorkerDir { fn drop(&mut self) { if let WorkerDir::Deterministic(p) = self @@ -380,9 +475,18 @@ pub struct DurableWorkerCtx { resource_limits: Arc, linear_memory: LinearMemoryTracker, storage_meter: AgentStorageMeter, + /// Capacity acquired only for an unpersisted execution. Durable baseline capacity stays on + /// the running worker; this excess is Store-owned and is returned when the execution ends or + /// the Store is discarded. + unpersisted_filesystem_storage: Option, /// Per-instance cache of resolved typed guest export handles, populated /// lazily on first use during invocation dispatch. agent_export_funcs: AgentExportFuncs, + /// Source lifecycle for the live streaming invocation currently executing + /// in this Store. `schema-value-stream.wrap` attaches newly created source + /// endpoints to it so the invocation can keep the Store event loop alive + /// until downstream readers finish or detach. + live_stream_tracker: Option>, _store_alive_guard: StoreAliveGuard, } @@ -829,7 +933,9 @@ impl DurableWorkerCtx { resource_limits, linear_memory, storage_meter, + unpersisted_filesystem_storage: None, agent_export_funcs: AgentExportFuncs::default(), + live_stream_tracker: None, _store_alive_guard: StoreAliveGuard::new(), }) } @@ -1040,6 +1146,29 @@ impl DurableWorkerCtx { return Ok(()); } + if self.is_unpersisted_execution() { + for pending_event in self.pending_card_events_at_boundary().await? { + match pending_event.event { + QueuedCardEvent::Revoke(event) => { + self.apply_card_revoked(event.card_id, pending_event.oplog_index, true) + .await?; + } + QueuedCardEvent::Install(event) => { + let Some(card) = event.card else { + return Err(WorkerExecutorError::runtime( + "queued card install is missing card payload", + )); + }; + let _ = self + .apply_card_install(Some(pending_event.oplog_index), card) + .await?; + } + } + } + self.remove_expired_cards().await; + return Ok(()); + } + while let Some(pending_event) = self.pending_card_events_at_boundary().await?.first() { match &pending_event.event { QueuedCardEvent::Revoke(event) => { @@ -1155,7 +1284,9 @@ impl DurableWorkerCtx { _ => CardInstallFailure::NotFound, }; - if let Some(queued_event_index) = queued_event_index { + if let Some(queued_event_index) = queued_event_index + && !self.is_unpersisted_execution() + { self.public_state .worker() .add_and_commit_oplog(OplogEntry::card_install_failed( @@ -1180,10 +1311,12 @@ impl DurableWorkerCtx { .set_card_interest(self.owned_agent_id.clone(), &wallet_card_ids) .await; - self.public_state - .worker() - .add_and_commit_oplog(OplogEntry::card_installed(queued_event_index, card)) - .await; + if !self.is_unpersisted_execution() { + self.public_state + .worker() + .add_and_commit_oplog(OplogEntry::card_installed(queued_event_index, card)) + .await; + } Ok(Ok(())) } } @@ -1212,10 +1345,12 @@ impl DurableWorkerCtx { .set_card_interest(self.owned_agent_id.clone(), &wallet_card_ids) .await; - self.public_state - .worker() - .add_and_commit_oplog(OplogEntry::card_revoked(queued_event_index, card_id)) - .await; + if !self.is_unpersisted_execution() { + self.public_state + .worker() + .add_and_commit_oplog(OplogEntry::card_revoked(queued_event_index, card_id)) + .await; + } } Ok(()) @@ -1255,11 +1390,13 @@ impl DurableWorkerCtx { .set_card_interest(self.owned_agent_id.clone(), &wallet_card_ids) .await; - for card_id in cards_to_expire { - self.public_state - .worker() - .add_and_commit_oplog(OplogEntry::card_expired(card_id)) - .await; + if !self.is_unpersisted_execution() { + for card_id in cards_to_expire { + self.public_state + .worker() + .add_and_commit_oplog(OplogEntry::card_expired(card_id)) + .await; + } } } @@ -1421,6 +1558,27 @@ impl DurableWorkerCtx { if self.state.is_replay() { return Ok(()); } + if self.is_unpersisted_execution() { + let current_bytes = self.state.current_filesystem_storage_usage; + let capacity_bytes = self + .unpersisted_filesystem_storage + .as_ref() + .expect( + "unpersisted filesystem accounting must be active during unpersisted execution", + ) + .capacity_growth(current_bytes, new_bytes); + let permit = self + .public_state + .worker() + .acquire_unpersisted_filesystem_storage_space(capacity_bytes) + .await?; + self.unpersisted_filesystem_storage + .as_mut() + .expect("unpersisted filesystem accounting must remain active across acquisition") + .merge(permit); + self.state.current_filesystem_storage_usage = current_bytes.saturating_add(new_bytes); + return Ok(()); + } // Acquire the semaphore permit first (non-blocking try). Writing the // oplog entry after a confirmed acquire ensures the oplog accurately // reflects only committed storage changes — a failed acquire leaves no @@ -1459,6 +1617,16 @@ impl DurableWorkerCtx { if freed_bytes == 0 { return; } + if self.is_unpersisted_execution() { + self.state.current_filesystem_storage_usage -= freed_bytes; + self.unpersisted_filesystem_storage + .as_mut() + .expect( + "unpersisted filesystem accounting must be active during unpersisted execution", + ) + .reconcile(self.state.current_filesystem_storage_usage); + return; + } self.public_state .worker() .add_to_oplog(OplogEntry::filesystem_storage_usage_update( @@ -1495,13 +1663,28 @@ impl DurableWorkerCtx { pub(crate) fn prepare_filesystem_storage_reservation( &mut self, new_bytes: u64, - ) -> anyhow::Result>>> { + ) -> anyhow::Result>, u64, bool)>> { if new_bytes == 0 || self.state.is_replay() { return Ok(None); } self.check_filesystem_storage_quota(new_bytes)?; + let is_unpersisted_execution = self.is_unpersisted_execution(); + let capacity_bytes = if is_unpersisted_execution { + self.unpersisted_filesystem_storage + .as_ref() + .expect( + "unpersisted filesystem accounting must be active during unpersisted execution", + ) + .capacity_growth(self.state.current_filesystem_storage_usage, new_bytes) + } else { + new_bytes + }; self.state.current_filesystem_storage_usage += new_bytes; - Ok(Some(self.public_state.worker())) + Ok(Some(( + self.public_state.worker(), + capacity_bytes, + is_unpersisted_execution, + ))) } pub(crate) fn rollback_filesystem_storage_reservation(&mut self, new_bytes: u64) { @@ -1511,10 +1694,22 @@ impl DurableWorkerCtx { self.state.current_filesystem_storage_usage -= new_bytes; } - pub(crate) fn finish_filesystem_storage_reservation(&mut self, new_bytes: u64) { + pub(crate) fn finish_filesystem_storage_reservation( + &mut self, + new_bytes: u64, + is_unpersisted_execution: bool, + unpersisted_permit: Option, + ) { if new_bytes == 0 || self.state.is_replay() { return; } + if is_unpersisted_execution { + if let Some(storage) = &mut self.unpersisted_filesystem_storage { + storage.merge(unpersisted_permit); + } + return; + } + debug_assert!(unpersisted_permit.is_none()); let account_id = self.created_by().to_string(); let environment_id = self.state.owned_agent_id.environment_id().to_string(); record_storage_bytes_written( @@ -1537,14 +1732,27 @@ impl DurableWorkerCtx { None } else { self.state.current_filesystem_storage_usage -= freed_bytes; + if self.is_unpersisted_execution() { + self.unpersisted_filesystem_storage + .as_mut() + .expect("unpersisted filesystem accounting must be active during unpersisted execution") + .reconcile(self.state.current_filesystem_storage_usage); + } Some((self.public_state.worker(), freed_bytes)) } } - pub(crate) fn finish_filesystem_storage_release(&mut self, freed_bytes: u64) { + pub(crate) fn finish_filesystem_storage_release( + &mut self, + freed_bytes: u64, + is_unpersisted_execution: bool, + ) { if freed_bytes == 0 || self.state.is_replay() { return; } + if is_unpersisted_execution { + return; + } let account_id = self.created_by().to_string(); let environment_id = self.state.owned_agent_id.environment_id().to_string(); record_storage_bytes_deleted( @@ -1557,7 +1765,7 @@ impl DurableWorkerCtx { pub fn increase_memory(&mut self, delta: u64) { let (_, reconciling) = self.linear_memory.grow(delta, Instant::now()); - if self.state.is_live() && !reconciling { + if self.state.is_live() && !reconciling && !self.is_unpersisted_execution() { // This is called from the `memory.grow` async resource limiter, which // Wasmtime runs through a blocking libcall on the store's fiber. While // that libcall waits, the store cannot make progress, so nothing may be @@ -1601,7 +1809,11 @@ impl DurableWorkerCtx { crate::metrics::workers::record_worker_memory_grow_rejected(); return Err(GolemSpecificWasmTrap::WorkerOutOfMemory.into()); }; - tracker.retain_growth_grant(grant); + if self.is_unpersisted_execution() { + tracker.retain_transient_growth_grant(grant); + } else { + tracker.retain_growth_grant(grant); + } } Ok(true) } @@ -1901,6 +2113,7 @@ impl DurableWorkerCtx { &self.state.replay_state, &self.state.oplog, self.state.is_live(), + self.is_unpersisted_execution(), ) .await; } @@ -1909,7 +2122,7 @@ impl DurableWorkerCtx { &mut self, function_type: &DurableFunctionType, ) -> Result { - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { let begin_index = self.state.current_oplog_index().await; self.state.current_retry_point = begin_index; return Ok(begin_index); @@ -2093,7 +2306,7 @@ impl DurableWorkerCtx { function_type: &DurableFunctionType, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { return Ok(()); } @@ -2266,7 +2479,7 @@ impl DurableWorkerCtx { where Err: From, { - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { let (_, tx) = handler.create_new().await?; let begin_index = self.state.current_oplog_index().await; Ok((begin_index, tx)) @@ -2493,7 +2706,7 @@ impl DurableWorkerCtx { &mut self, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { Ok(()) } else if self.is_live() { // There is some logic in the test code that intercepts oplogs adds for _just_ the oplog the is provided to the worker. @@ -2522,7 +2735,7 @@ impl DurableWorkerCtx { &mut self, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { Ok(()) } else if self.is_live() { // There is some logic in the test code that intercepts oplogs adds for _just_ the oplog the is provided to the worker. @@ -2551,7 +2764,7 @@ impl DurableWorkerCtx { &mut self, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { return Ok(()); } else if self.is_live() { // There is some logic in the test code that intercepts oplogs adds for _just_ the oplog the is provided to the worker. @@ -2602,7 +2815,7 @@ impl DurableWorkerCtx { &mut self, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.snapshotting_mode.is_some() { + if self.state.is_unpersisted_execution() { return Ok(()); } else if self.is_live() { // There is some logic in the test code that intercepts oplogs adds for _just_ the oplog the is provided to the worker. @@ -3114,6 +3327,33 @@ impl DurableWorkerCtx { self.state.tail_work_tracker() } + pub(crate) fn live_stream_tracker(&self) -> Option> { + self.live_stream_tracker.clone() + } + + pub(crate) fn is_live_streaming_invocation(&self) -> bool { + self.live_stream_tracker.is_some() + } + + pub(crate) fn is_unpersisted_execution(&self) -> bool { + self.state.is_unpersisted_execution() + } + + pub(crate) fn set_live_stream_tracker( + &mut self, + tracker: Arc, + ) { + assert!( + self.live_stream_tracker.is_none(), + "a live streaming invocation is already active in this Store" + ); + self.live_stream_tracker = Some(tracker); + } + + pub(crate) fn clear_live_stream_tracker(&mut self) { + self.live_stream_tracker = None; + } + /// Arms the optional per-invocation wall-clock deadline (`limits.max_invocation_duration`) /// and returns its guard. Called at the start of every guest invocation. /// @@ -3206,9 +3446,80 @@ impl DurableWorkerCtx { ) } + fn begin_unpersisted_execution(&mut self, kind: UnpersistedExecutionKind) { + assert!( + self.state.unpersisted_execution.is_none(), + "cannot begin {kind:?} while {:?} is active", + self.state + .unpersisted_execution + .map(|execution| execution.kind) + ); + assert!( + self.unpersisted_filesystem_storage.is_none(), + "unpersisted filesystem accounting is already active" + ); + + self.unpersisted_filesystem_storage = Some(UnpersistedFilesystemStorage::new( + self.state.current_filesystem_storage_usage, + )); + self.state.unpersisted_execution = Some(UnpersistedExecution { + kind, + previous_persistence_level: self.state.persistence_level, + }); + self.state.persistence_level = PersistenceLevel::PersistNothing; + } + + fn end_unpersisted_execution(&mut self, expected_kind: UnpersistedExecutionKind) { + let execution = self.state.unpersisted_execution.take().unwrap_or_else(|| { + panic!("cannot end {expected_kind:?}: no unpersisted execution is active") + }); + assert_eq!( + execution.kind, expected_kind, + "cannot end {expected_kind:?} while {:?} is active", + execution.kind + ); + + self.state.persistence_level = execution.previous_persistence_level; + let storage = self + .unpersisted_filesystem_storage + .take() + .expect("unpersisted filesystem accounting must be active"); + self.state.current_filesystem_storage_usage = storage.baseline_bytes; + } + + pub(crate) fn begin_unpersisted_streaming_invocation(&mut self) { + self.begin_unpersisted_execution(UnpersistedExecutionKind::StreamingInvocation); + } + + pub(crate) fn end_unpersisted_streaming_invocation_if_active(&mut self) { + match self + .state + .unpersisted_execution + .map(|execution| execution.kind) + { + Some(UnpersistedExecutionKind::StreamingInvocation) => { + self.end_unpersisted_execution(UnpersistedExecutionKind::StreamingInvocation); + } + Some(kind) => panic!( + "cannot end streaming invocation while {kind:?} is the active unpersisted execution" + ), + None => {} + } + } + pub(crate) fn end_call_snapshotting_function_if_active(&mut self) { - if self.state.snapshotting_mode.is_some() { - self.end_call_snapshotting_function(); + match self + .state + .unpersisted_execution + .map(|execution| execution.kind) + { + Some(UnpersistedExecutionKind::SnapshottingFunction) => { + self.end_call_snapshotting_function(); + } + Some(kind) => panic!( + "cannot end snapshotting function while {kind:?} is the active unpersisted execution" + ), + None => {} } } @@ -3551,6 +3862,13 @@ impl StatusManagement for DurableWorkerCtx { return Some(*interrupt_kind); } } + if self + .live_stream_tracker + .as_ref() + .is_some_and(|tracker| tracker.cancellation_token().is_cancelled()) + { + return Some(InterruptKind::Interrupt(Timestamp::now_utc())); + } // An exceeded invocation or tail-work deadline surfaces as a synthetic interrupt so work // traps at the next epoch check. The corresponding invocation boundary converts the // unwind into the appropriate timeout failure. @@ -3633,7 +3951,7 @@ impl InvocationHooks for DurableWorkerCtx { &mut self, mut invocation: AgentInvocation, ) -> Result<(), WorkerExecutorError> { - if self.state.snapshotting_mode.is_none() { + if !self.is_unpersisted_execution() { let stack = self.get_current_invocation_context().await; match &mut invocation { @@ -3675,10 +3993,11 @@ impl InvocationHooks for DurableWorkerCtx { full_function_name: &str, trap_type: &TrapType, ) -> RetryDecision { + let is_unpersisted_execution = self.is_unpersisted_execution(); let current_idempotency_key = self.get_current_idempotency_key().await; if self.state.is_live() - && self.state.snapshotting_mode.is_none() + && !is_unpersisted_execution && let Err(err) = concurrent::drain_queued_dropped_call_events(self).await { error!("failed to drain dropped durable calls before invocation failure entry: {err}"); @@ -3741,7 +4060,7 @@ impl InvocationHooks for DurableWorkerCtx { )), }; - if let Some(entry) = oplog_entry { + if !is_unpersisted_execution && let Some(entry) = oplog_entry { self.public_state.worker().add_and_commit_oplog(entry).await; }; @@ -3762,7 +4081,7 @@ impl InvocationHooks for DurableWorkerCtx { AgentStatus::Interrupted | AgentStatus::Exited ) || decision == RetryDecision::None; - if giving_up { + if giving_up && !is_unpersisted_execution { // Giving up, associating the stored result with the current and upcoming invocations if let Some(idempotency_key) = self.state.get_current_idempotency_key() { self.public_state @@ -3821,7 +4140,7 @@ impl InvocationHooks for DurableWorkerCtx { let is_live = self.state.is_live(); if is_live { - if self.state.snapshotting_mode.is_none() { + if !self.is_unpersisted_execution() { concurrent::drain_queued_dropped_call_events(self) .await .map_err(|err| err.source)?; @@ -3978,7 +4297,7 @@ impl ResourceStore for DurableWorkerCtx { async fn add(&mut self, resource: ResourceAny, name: ResourceTypeId) -> u64 { let id = self.state.add(resource, name.clone()).await; let resource_id = AgentResourceId(id); - if self.state.is_live() { + if self.state.is_live() && !self.is_unpersisted_execution() { let entry = OplogEntry::create_resource(resource_id, name.clone()); self.public_state.worker().add_to_oplog(entry).await; } @@ -3989,7 +4308,7 @@ impl ResourceStore for DurableWorkerCtx { let result = self.state.borrow(resource_id).await; if let Some((resource_type_id, _)) = &result { let id = AgentResourceId(resource_id); - if self.state.is_live() { + if self.state.is_live() && !self.is_unpersisted_execution() { let entry = OplogEntry::drop_resource(id, resource_type_id.clone()); self.public_state.worker().add_to_oplog(entry).await; } @@ -4009,35 +4328,11 @@ impl UpdateManagement for DurableWorkerCtx { } fn begin_call_snapshotting_function(&mut self) { - // While calling a snapshotting function (load/save), we completely turn off persistence - // In addition to the user-controllable persistence level we also skip writing the - // oplog entries marking the exported function call. - if self.state.snapshotting_mode.is_some() { - warn!( - "begin_call_snapshotting_function called while snapshotting is already active; \ - leaving persistence level unchanged" - ); - return; - } - - let previous_level = self.state.persistence_level; - self.state.snapshotting_mode = Some(previous_level); - self.state.persistence_level = PersistenceLevel::PersistNothing; + self.begin_unpersisted_execution(UnpersistedExecutionKind::SnapshottingFunction); } fn end_call_snapshotting_function(&mut self) { - // Restoring the state of persistence after calling a snapshotting function - match self.state.snapshotting_mode.take() { - Some(level) => { - self.state.persistence_level = level; - } - None => { - warn!( - "end_call_snapshotting_function called without a matching begin_call_snapshotting_function; \ - leaving persistence level unchanged" - ); - } - } + self.end_unpersisted_execution(UnpersistedExecutionKind::SnapshottingFunction); } async fn on_worker_update_failed( @@ -4156,7 +4451,7 @@ impl InvocationContextManagement for DurableWorkerCtx { span.set_attribute(name.clone(), value.clone()); } - if is_live { + if is_live && !self.is_unpersisted_execution() { self.public_state .worker() .add_to_oplog(OplogEntry::StartSpan { @@ -4196,12 +4491,12 @@ impl InvocationContextManagement for DurableWorkerCtx { } async fn finish_span(&mut self, span_id: &SpanId) -> Result<(), WorkerExecutorError> { - if self.is_live() { + if self.is_live() && !self.is_unpersisted_execution() { self.public_state .worker() .add_to_oplog(OplogEntry::finish_span(span_id.clone())) .await; - } else { + } else if !self.is_live() { crate::get_oplog_entry!(self.state.replay_state, OplogEntry::FinishSpan)?; } @@ -4234,7 +4529,7 @@ impl InvocationContextManagement for DurableWorkerCtx { .invocation_context .set_attribute(span_id, key.to_string(), value.clone()) .map_err(WorkerExecutorError::runtime)?; - if self.is_live() { + if self.is_live() && !self.is_unpersisted_execution() { self.public_state .worker() .add_to_oplog(OplogEntry::set_span_attribute( @@ -4243,7 +4538,7 @@ impl InvocationContextManagement for DurableWorkerCtx { value, )) .await; - } else { + } else if !self.is_live() { crate::get_oplog_entry!(self.state.replay_state, OplogEntry::SetSpanAttribute)?; } Ok(()) @@ -4782,6 +5077,38 @@ mod tests { ); } + #[test] + fn unpersisted_filesystem_capacity_reuses_the_durable_baseline() { + let storage = UnpersistedFilesystemStorage::new(1500); + + assert_eq!(storage.capacity_growth(0, 1000), 0); + assert_eq!(storage.capacity_growth(0, 2200), 1024); + assert_eq!(storage.capacity_growth(1500, 600), 1024); + assert_eq!(storage.capacity_growth(2100, 300), 0); + } + + #[test] + async fn unpersisted_filesystem_capacity_is_released_before_store_reuse() { + let semaphore = crate::services::active_workers::FilesystemStorageSemaphore::new( + 4 * 1024, + Duration::from_millis(1), + ); + let mut storage = UnpersistedFilesystemStorage::new(500); + + let growth = storage.capacity_growth(500, 600); + storage.merge(semaphore.try_acquire(growth).await); + assert_eq!(semaphore.available_bytes(), 3 * 1024); + + storage.reconcile(500); + assert_eq!(semaphore.available_bytes(), 4 * 1024); + + let growth = storage.capacity_growth(500, 2000); + storage.merge(semaphore.try_acquire(growth).await); + assert_eq!(semaphore.available_bytes(), 2 * 1024); + drop(storage); + assert_eq!(semaphore.available_bytes(), 4 * 1024); + } + #[test] fn snapshot_boundary_all_clear_has_no_blocker() { assert_eq!(SnapshotBoundaryConditions::default().blocker(), None); @@ -4825,6 +5152,14 @@ mod tests { }, SnapshotBoundaryBlocker::Snapshotting, ), + ( + SnapshotBoundaryConditions { + persist_nothing: true, + streaming_invocation: true, + ..Default::default() + }, + SnapshotBoundaryBlocker::StreamingInvocation, + ), ( SnapshotBoundaryConditions { in_flight_host_call: true, @@ -4844,16 +5179,17 @@ mod tests { #[test] fn snapshot_boundary_any_condition_combination_blocks() { - // Exhaustive truth table over the six conditions: a snapshot is admitted iff every + // Exhaustive truth table over the seven conditions: a snapshot is admitted iff every // condition is clear, and the reported blocker is always one of the set conditions. - for bits in 0u32..64 { + for bits in 0u32..128 { let conditions = SnapshotBoundaryConditions { replaying: bits & 1 != 0, open_atomic_region: bits & 2 != 0, open_durable_scope: bits & 4 != 0, persist_nothing: bits & 8 != 0, snapshotting: bits & 16 != 0, - in_flight_host_call: bits & 32 != 0, + streaming_invocation: bits & 32 != 0, + in_flight_host_call: bits & 64 != 0, }; let blocker = conditions.blocker(); assert_eq!( @@ -4868,6 +5204,7 @@ mod tests { SnapshotBoundaryBlocker::OpenDurableScope => conditions.open_durable_scope, SnapshotBoundaryBlocker::PersistNothing => conditions.persist_nothing, SnapshotBoundaryBlocker::Snapshotting => conditions.snapshotting, + SnapshotBoundaryBlocker::StreamingInvocation => conditions.streaming_invocation, SnapshotBoundaryBlocker::InFlightHostCall => conditions.in_flight_host_call, }; assert!( @@ -4887,19 +5224,19 @@ mod tests { let open_atomic_region = bits & 2 != 0; let open_durable_scope = bits & 4 != 0; let persist_nothing = bits & 8 != 0; - let snapshotting = bits & 16 != 0; + let unpersisted_execution = bits & 16 != 0; assert_eq!( PrivateDurableWorkerState::clean_checkpoint_boundary( replaying, open_atomic_region, open_durable_scope, persist_nothing, - snapshotting, + unpersisted_execution, ), bits == 0, "checkpoint must be admitted iff no condition is set; replaying: {replaying}, \ open_atomic_region: {open_atomic_region}, open_durable_scope: {open_durable_scope}, \ - persist_nothing: {persist_nothing}, snapshotting: {snapshotting}" + persist_nothing: {persist_nothing}, unpersisted_execution: {unpersisted_execution}" ); } } @@ -4908,21 +5245,22 @@ mod tests { fn snapshot_boundary_is_checkpoint_boundary_with_no_in_flight_host_call() { // The documented sync invariant between the two predicates: `blocker() == None` is // equivalent to `at_clean_checkpoint_boundary() && !has_in_flight_live_host_calls()`. - for bits in 0u32..64 { + for bits in 0u32..128 { let conditions = SnapshotBoundaryConditions { replaying: bits & 1 != 0, open_atomic_region: bits & 2 != 0, open_durable_scope: bits & 4 != 0, persist_nothing: bits & 8 != 0, snapshotting: bits & 16 != 0, - in_flight_host_call: bits & 32 != 0, + streaming_invocation: bits & 32 != 0, + in_flight_host_call: bits & 64 != 0, }; let at_checkpoint_boundary = PrivateDurableWorkerState::clean_checkpoint_boundary( conditions.replaying, conditions.open_atomic_region, conditions.open_durable_scope, conditions.persist_nothing, - conditions.snapshotting, + conditions.snapshotting || conditions.streaming_invocation, ); assert_eq!( conditions.blocker().is_none(), @@ -6373,7 +6711,7 @@ struct PrivateDurableWorkerState { /// the HttpRequestState. Keyed by outgoing request rep. pending_http_retry_eligibility: HashMap, - snapshotting_mode: Option, + unpersisted_execution: Option, /// Tracks whether the currently executing invocation is restricted to read-only side effects. /// When `ReadOnly`, outgoing HTTP and RPC host calls are trapped before any oplog entry is @@ -6714,7 +7052,7 @@ impl PrivateDurableWorkerState { open_filesystem_input_streams: HashSet::new(), file_stream_pollables: HashSet::new(), tcp_taken_streams: HashMap::new(), - snapshotting_mode: None, + unpersisted_execution: None, invocation_strictness: InvocationStrictness::Normal, read_only_method_name: None, component_metadata, @@ -6849,14 +7187,14 @@ impl PrivateDurableWorkerState { /// [`DurableWorkerCtx::end_function`] — namely a non-idempotent remote write or the first /// (`None`) call of a batched remote write. /// - /// Snapshotting turns off persistence entirely, and `persist`/`replay` skip `end_function` - /// while snapshotting, so no scope must be opened either: otherwise the scope `Start` (written + /// Unpersisted execution turns off persistence entirely, and `persist`/`replay` skip + /// `end_function`, so no scope must be opened either: otherwise the scope `Start` (written /// through `add_and_commit_oplog`, which commits with `CommitLevel::Always` and therefore /// ignores `PersistNothing`) would be committed with no matching `End`, corrupting later replay. - /// A snapshotting region never straddles a single scope's begin/end, so guarding both ends with - /// the same predicate keeps the durable-scope stack balanced. + /// An unpersisted execution never straddles a single scope's begin/end, so guarding both ends + /// with the same predicate keeps the durable-scope stack balanced. fn opens_durable_scope(&self, function_type: &DurableFunctionType) -> bool { - self.snapshotting_mode.is_none() + !self.is_unpersisted_execution() && ((*function_type == DurableFunctionType::WriteRemote && !self.assume_idempotence) || matches!( *function_type, @@ -7218,6 +7556,10 @@ impl PrivateDurableWorkerState { self.replay_state.is_live() } + pub fn is_unpersisted_execution(&self) -> bool { + self.unpersisted_execution.is_some() + } + /// Whether the current oplog tip is a structurally clean boundary at which a mid-invocation /// status checkpoint may be taken: we are live, no rollback-capable region is open (so no later /// trap/replay can append a jump that deletes the tip), and we are not in a persistence regime @@ -7229,7 +7571,7 @@ impl PrivateDurableWorkerState { !self.active_atomic_regions.is_empty(), !self.active_durable_scopes.is_empty(), self.persistence_level == PersistenceLevel::PersistNothing, - self.snapshotting_mode.is_some(), + self.is_unpersisted_execution(), ) } @@ -7241,13 +7583,13 @@ impl PrivateDurableWorkerState { open_atomic_region: bool, open_durable_scope: bool, persist_nothing: bool, - snapshotting: bool, + unpersisted_execution: bool, ) -> bool { !replaying && !open_atomic_region && !open_durable_scope && !persist_nothing - && !snapshotting + && !unpersisted_execution } /// The first condition currently blocking a snapshot, or `None` when the worker is at a safe @@ -7271,7 +7613,14 @@ impl PrivateDurableWorkerState { open_atomic_region: !self.active_atomic_regions.is_empty(), open_durable_scope: !self.active_durable_scopes.is_empty(), persist_nothing: self.persistence_level == PersistenceLevel::PersistNothing, - snapshotting: self.snapshotting_mode.is_some(), + snapshotting: matches!( + self.unpersisted_execution.map(|execution| execution.kind), + Some(UnpersistedExecutionKind::SnapshottingFunction) + ), + streaming_invocation: matches!( + self.unpersisted_execution.map(|execution| execution.kind), + Some(UnpersistedExecutionKind::StreamingInvocation) + ), in_flight_host_call: self.has_in_flight_live_host_calls(), } .blocker() @@ -7329,6 +7678,8 @@ struct SnapshotBoundaryConditions { persist_nothing: bool, /// A snapshotting function (save/load) call is already in progress. snapshotting: bool, + /// A live streaming invocation is currently using the Store without persistence. + streaming_invocation: bool, /// A live durable host call is in flight: its `Start` may precede the cut while its /// terminal entry lands after it. in_flight_host_call: bool, @@ -7344,10 +7695,12 @@ impl SnapshotBoundaryConditions { Some(SnapshotBoundaryBlocker::OpenAtomicRegion) } else if self.open_durable_scope { Some(SnapshotBoundaryBlocker::OpenDurableScope) - } else if self.persist_nothing { - Some(SnapshotBoundaryBlocker::PersistNothing) } else if self.snapshotting { Some(SnapshotBoundaryBlocker::Snapshotting) + } else if self.streaming_invocation { + Some(SnapshotBoundaryBlocker::StreamingInvocation) + } else if self.persist_nothing { + Some(SnapshotBoundaryBlocker::PersistNothing) } else if self.in_flight_host_call { Some(SnapshotBoundaryBlocker::InFlightHostCall) } else { @@ -7365,6 +7718,7 @@ pub enum SnapshotBoundaryBlocker { OpenDurableScope, PersistNothing, Snapshotting, + StreamingInvocation, InFlightHostCall, } @@ -7378,6 +7732,9 @@ impl Display for SnapshotBoundaryBlocker { write!(f, "persistence is currently disabled (persist-nothing)") } Self::Snapshotting => write!(f, "a snapshot function call is already in progress"), + Self::StreamingInvocation => { + write!(f, "a live streaming invocation is already in progress") + } Self::InFlightHostCall => write!(f, "a durable host call is still in flight"), } } diff --git a/golem-worker-executor/src/durable_host/p3/cli.rs b/golem-worker-executor/src/durable_host/p3/cli.rs index ca167be9f8..a7b0a2000f 100644 --- a/golem-worker-executor/src/durable_host/p3/cli.rs +++ b/golem-worker-executor/src/durable_host/p3/cli.rs @@ -333,18 +333,26 @@ async fn emit_log_event_access( accessor: &Accessor>, event: InternalWorkerEvent, ) { - let (has_oplog_processor, owned_agent_id, public_state, replay_state, oplog, is_live) = - accessor.with(|mut access| { - let ctx = durable_worker_ctx::(access.data_mut()); - ( - ctx.state.component_metadata.metadata.has_oplog_processor(), - ctx.owned_agent_id.clone(), - ctx.public_state.clone(), - ctx.state.replay_state.clone(), - ctx.state.oplog.clone(), - ctx.state.is_live(), - ) - }); + let ( + has_oplog_processor, + owned_agent_id, + public_state, + replay_state, + oplog, + is_live, + is_unpersisted_execution, + ) = accessor.with(|mut access| { + let ctx = durable_worker_ctx::(access.data_mut()); + ( + ctx.state.component_metadata.metadata.has_oplog_processor(), + ctx.owned_agent_id.clone(), + ctx.public_state.clone(), + ctx.state.replay_state.clone(), + ctx.state.oplog.clone(), + ctx.state.is_live(), + ctx.is_unpersisted_execution(), + ) + }); logging_policy::emit_log_event_with_state::( event, @@ -354,6 +362,7 @@ async fn emit_log_event_access( &replay_state, &oplog, is_live, + is_unpersisted_execution, ) .await; } diff --git a/golem-worker-executor/src/durable_host/p3/filesystem.rs b/golem-worker-executor/src/durable_host/p3/filesystem.rs index 9b01694600..ab34ab0a58 100644 --- a/golem-worker-executor/src/durable_host/p3/filesystem.rs +++ b/golem-worker-executor/src/durable_host/p3/filesystem.rs @@ -572,26 +572,43 @@ where return Ok(()); } - if let Some(worker) = accessor + if let Some((worker, capacity_bytes, is_unpersisted_execution)) = accessor .with(|mut access| { durable_worker_ctx::(access.data_mut()) .prepare_filesystem_storage_reservation(bytes) }) .map_err(wasmtime::Error::from_anyhow)? { - if let Err(error) = worker.acquire_filesystem_storage_space(bytes).await { - accessor.with(|mut access| { - durable_worker_ctx::(access.data_mut()) - .rollback_filesystem_storage_reservation(bytes); - }); - return Err(wasmtime::Error::from_anyhow(error)); + let unpersisted_permit = match if is_unpersisted_execution { + worker + .acquire_unpersisted_filesystem_storage_space(capacity_bytes) + .await + } else { + worker + .acquire_filesystem_storage_space(capacity_bytes) + .await + .map(|()| None) + } { + Ok(permit) => permit, + Err(error) => { + accessor.with(|mut access| { + durable_worker_ctx::(access.data_mut()) + .rollback_filesystem_storage_reservation(bytes); + }); + return Err(wasmtime::Error::from_anyhow(error)); + } + }; + if !is_unpersisted_execution { + worker + .add_to_oplog(OplogEntry::filesystem_storage_usage_update(bytes as i64)) + .await; } - worker - .add_to_oplog(OplogEntry::filesystem_storage_usage_update(bytes as i64)) - .await; accessor.with(|mut access| { - durable_worker_ctx::(access.data_mut()) - .finish_filesystem_storage_reservation(bytes); + durable_worker_ctx::(access.data_mut()).finish_filesystem_storage_reservation( + bytes, + is_unpersisted_execution, + unpersisted_permit, + ); }); } @@ -610,16 +627,21 @@ where return Ok(()); } - if let Some((worker, bytes)) = accessor.with(|mut access| { - durable_worker_ctx::(access.data_mut()).prepare_filesystem_storage_release(bytes) + if let Some((worker, bytes, is_unpersisted_execution)) = accessor.with(|mut access| { + let ctx = durable_worker_ctx::(access.data_mut()); + let is_unpersisted_execution = ctx.is_unpersisted_execution(); + ctx.prepare_filesystem_storage_release(bytes) + .map(|(worker, bytes)| (worker, bytes, is_unpersisted_execution)) }) { - worker - .add_to_oplog(OplogEntry::filesystem_storage_usage_update(-(bytes as i64))) - .await; - worker.release_filesystem_storage_space(bytes).await; + if !is_unpersisted_execution { + worker + .add_to_oplog(OplogEntry::filesystem_storage_usage_update(-(bytes as i64))) + .await; + worker.release_filesystem_storage_space(bytes).await; + } accessor.with(|mut access| { durable_worker_ctx::(access.data_mut()) - .finish_filesystem_storage_release(bytes); + .finish_filesystem_storage_release(bytes, is_unpersisted_execution); }); } diff --git a/golem-worker-executor/src/durable_host/p3/http/replay.rs b/golem-worker-executor/src/durable_host/p3/http/replay.rs index 7f402814b5..15c5d5bf30 100644 --- a/golem-worker-executor/src/durable_host/p3/http/replay.rs +++ b/golem-worker-executor/src/durable_host/p3/http/replay.rs @@ -240,7 +240,7 @@ where let ctx = durable_worker_ctx::(access.data_mut()); ( ctx.state.oplog.clone(), - ctx.state.snapshotting_mode.is_none() + !ctx.is_unpersisted_execution() && ctx.state.persistence_level != PersistenceLevel::PersistNothing, ) }); diff --git a/golem-worker-executor/src/durable_host/p3/http/send.rs b/golem-worker-executor/src/durable_host/p3/http/send.rs index c875ec5238..b494f6881e 100644 --- a/golem-worker-executor/src/durable_host/p3/http/send.rs +++ b/golem-worker-executor/src/durable_host/p3/http/send.rs @@ -478,7 +478,7 @@ where && store.with(|mut access| { let ctx = durable_worker_ctx::(access.data_mut()); ctx.state.is_live() - && ctx.state.snapshotting_mode.is_none() + && !ctx.is_unpersisted_execution() && ctx.state.persistence_level != golem_common::model::oplog::PersistenceLevel::PersistNothing }) @@ -902,7 +902,7 @@ where ( ctx.wasi_http.connection_pool.clone(), ctx.state.oplog.clone(), - ctx.state.snapshotting_mode.is_none() + !ctx.is_unpersisted_execution() && ctx.state.persistence_level != golem_common::model::oplog::PersistenceLevel::PersistNothing, ) @@ -1057,6 +1057,9 @@ where max_in_function_retry_delay, current_retry_policy_state, retry_properties, + is_unpersisted_execution: store.with(|mut access| { + durable_worker_ctx::(access.data_mut()).is_unpersisted_execution() + }), worker, } } diff --git a/golem-worker-executor/src/durable_host/quota/mod.rs b/golem-worker-executor/src/durable_host/quota/mod.rs index f5506f5646..ecdf8bf8fd 100644 --- a/golem-worker-executor/src/durable_host/quota/mod.rs +++ b/golem-worker-executor/src/durable_host/quota/mod.rs @@ -33,12 +33,14 @@ use golem_common::model::quota::ReserveResult; use golem_common::model::quota::ResourceName; use golem_common::model::{ScheduledAction, Timestamp}; use golem_schema::schema::schema_value::QuotaTokenValuePayload; -use golem_schema::schema::wit::wire::HostQuotaToken; +use golem_schema::schema::wit::wire::HostQuotaTokenWithStore; use golem_schema::schema::wit::{QuotaTokenHandleRep, QuotaTokenResolver}; use golem_service_base::error::worker_executor::GolemSpecificWasmTrap; use golem_service_base::error::worker_executor::WorkerExecutorError; use tracing::debug; -use wasmtime::component::Resource; +use wasmtime::component::{Accessor, Resource}; + +use crate::durable_host::schema_value_stream::CoreTypesHost; /// Borrow the [`QuotaTokenEntry`] stored inside a `quota-token` resource handle. /// @@ -446,11 +448,19 @@ impl Host for DurableWorkerCtx { /// opaque [`QuotaTokenHandleRep`] by golem-schema. The only operation the core /// interface declares for it is `drop`, which releases the underlying lease /// state back to the executor pool. -impl HostQuotaToken for DurableWorkerCtx { - async fn drop(&mut self, rep: Resource) -> anyhow::Result<()> { - DurabilityHost::observe_function_call(self, "golem::core::quota-token", "drop"); - self.table().delete(rep)?; - Ok(()) +impl HostQuotaTokenWithStore for CoreTypesHost { + fn drop( + accessor: &Accessor, + rep: Resource, + ) -> impl Future> + Send { + async move { + accessor.with(|mut access| { + let ctx = access.get(); + DurabilityHost::observe_function_call(ctx, "golem::core::quota-token", "drop"); + ctx.table().delete(rep)?; + Ok(()) + }) + } } } diff --git a/golem-worker-executor/src/durable_host/schema_value_stream.rs b/golem-worker-executor/src/durable_host/schema_value_stream.rs new file mode 100644 index 0000000000..1fd1e0a483 --- /dev/null +++ b/golem-worker-executor/src/durable_host/schema_value_stream.rs @@ -0,0 +1,293 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::durable_host::DurableWorkerCtx; +use crate::durable_host::stream_transport::{RelayProducer, RelayReceiver, relay_pair}; +use crate::workerctx::WorkerCtx; +use golem_schema::schema::schema_value::{QuotaTokenValuePayload, SecretValuePayload}; +use golem_schema::schema::wit::wire::{ + Host, HostQuotaToken, HostSchemaValueStream, HostSchemaValueStreamWithStore, HostSecret, + HostWithStore, SchemaValueTree, Uuid, +}; +use golem_schema::schema::wit::{ + QuotaTokenHandleRep, QuotaTokenResolver, SchemaValueStreamResolver, SecretHandleRep, + SecretResolver, +}; +use golem_schema::schema::{SchemaValue, SchemaValueStream, SchemaValueStreamHandleRep}; +use golem_service_base::error::worker_executor::WorkerExecutorError; +use std::marker::PhantomData; +use wasmtime::StoreContextMut; +use wasmtime::component::{Accessor, HasData, Resource, StreamReader}; + +pub(crate) fn contains_stream(value: &SchemaValue) -> bool { + match value { + SchemaValue::Stream(_) => true, + SchemaValue::Record { fields } => fields.iter().any(contains_stream), + SchemaValue::Tuple { elements } + | SchemaValue::List { elements } + | SchemaValue::FixedList { elements } => elements.iter().any(contains_stream), + SchemaValue::Variant(payload) => payload.payload.as_deref().is_some_and(contains_stream), + SchemaValue::Map { entries } => entries + .iter() + .any(|(key, value)| contains_stream(key) || contains_stream(value)), + SchemaValue::Option { inner } => inner.as_deref().is_some_and(contains_stream), + SchemaValue::Result(payload) => match payload { + golem_schema::schema::schema_value::ResultValuePayload::Ok { value } + | golem_schema::schema::schema_value::ResultValuePayload::Err { value } => { + value.as_deref().is_some_and(contains_stream) + } + }, + SchemaValue::Union(payload) => contains_stream(&payload.body), + _ => false, + } +} + +pub struct StoreValueResolver<'a, 'store, Ctx: WorkerCtx> { + store: &'a mut StoreContextMut<'store, Ctx>, +} + +impl<'a, 'store, Ctx: WorkerCtx> StoreValueResolver<'a, 'store, Ctx> { + pub fn new(store: &'a mut StoreContextMut<'store, Ctx>) -> Self { + Self { store } + } +} + +impl QuotaTokenResolver for StoreValueResolver<'_, '_, Ctx> { + type Error = WorkerExecutorError; + + fn snapshot_handle( + &mut self, + handle: Resource, + ) -> Result { + self.store + .data_mut() + .durable_ctx_mut() + .snapshot_handle(handle) + } + + fn handle_from_snapshot( + &mut self, + snapshot: &QuotaTokenValuePayload, + ) -> Result, Self::Error> { + self.store + .data_mut() + .durable_ctx_mut() + .handle_from_snapshot(snapshot) + } + + fn drop_handle(&mut self, handle: Resource) { + self.store.data_mut().durable_ctx_mut().drop_handle(handle) + } +} + +impl SecretResolver for StoreValueResolver<'_, '_, Ctx> { + type Error = WorkerExecutorError; + + fn snapshot_secret_handle( + &mut self, + handle: Resource, + ) -> Result { + self.store + .data_mut() + .durable_ctx_mut() + .snapshot_secret_handle(handle) + } + + fn secret_handle_from_snapshot( + &mut self, + snapshot: &SecretValuePayload, + ) -> Result, Self::Error> { + self.store + .data_mut() + .durable_ctx_mut() + .secret_handle_from_snapshot(snapshot) + } + + fn drop_secret_handle(&mut self, handle: Resource) { + self.store + .data_mut() + .durable_ctx_mut() + .drop_secret_handle(handle) + } +} + +impl SchemaValueStreamResolver for StoreValueResolver<'_, '_, Ctx> { + type Error = WorkerExecutorError; + + fn handle_from_stream( + &mut self, + stream: SchemaValueStream, + ) -> Result, Self::Error> { + if let Some(tracker) = self.store.data().durable_ctx().live_stream_tracker() { + stream + .with_host_endpoint::(|receiver| receiver.attach(tracker)) + .map_err(WorkerExecutorError::runtime)?; + } + self.store + .data_mut() + .durable_ctx_mut() + .table() + .push(SchemaValueStreamHandleRep::new(stream)) + .map_err(|error| { + WorkerExecutorError::runtime(format!( + "failed to create schema-value-stream handle: {error}" + )) + }) + } + + fn stream_from_handle( + &mut self, + handle: Resource, + ) -> Result { + let stream = self + .store + .data_mut() + .durable_ctx_mut() + .table() + .delete(handle) + .map_err(|error| { + WorkerExecutorError::runtime(format!("invalid schema-value-stream handle: {error}")) + })? + .into_stream(); + Ok(stream) + } + + fn drop_stream_handle(&mut self, handle: Resource) { + let _ = self + .store + .data_mut() + .durable_ctx_mut() + .table() + .delete(handle); + } +} + +impl SchemaValueStreamResolver for DurableWorkerCtx { + type Error = WorkerExecutorError; + + fn handle_from_stream( + &mut self, + stream: SchemaValueStream, + ) -> Result, Self::Error> { + if let Some(tracker) = self.live_stream_tracker() { + stream + .with_host_endpoint::(|receiver| receiver.attach(tracker)) + .map_err(WorkerExecutorError::runtime)?; + } + self.table() + .push(SchemaValueStreamHandleRep::new(stream)) + .map_err(|error| { + WorkerExecutorError::runtime(format!( + "failed to create schema-value-stream handle: {error}" + )) + }) + } + + fn stream_from_handle( + &mut self, + handle: Resource, + ) -> Result { + self.table() + .delete(handle) + .map(SchemaValueStreamHandleRep::into_stream) + .map_err(|error| { + WorkerExecutorError::runtime(format!("invalid schema-value-stream handle: {error}")) + }) + } + + fn drop_stream_handle(&mut self, handle: Resource) { + let _ = self.table().delete(handle); + } +} + +pub struct CoreTypesHost(PhantomData); + +impl HasData for CoreTypesHost { + type Data<'a> = &'a mut DurableWorkerCtx; +} + +impl HostQuotaToken for DurableWorkerCtx {} +impl HostSecret for DurableWorkerCtx {} +impl HostSchemaValueStream for DurableWorkerCtx {} + +impl HostSchemaValueStreamWithStore for CoreTypesHost { + async fn wrap( + accessor: &Accessor, + reader: StreamReader, + ) -> anyhow::Result> { + accessor + .with(|mut access| -> wasmtime::Result<_> { + let tracker = access.get().live_stream_tracker(); + let (consumer, stream) = relay_pair(tracker); + reader.pipe(&mut access, consumer)?; + access + .get() + .table() + .push(SchemaValueStreamHandleRep::new(stream)) + .map_err(|error| wasmtime::Error::msg(error.to_string())) + }) + .map_err(|error| anyhow::anyhow!(error.to_string())) + } + + async fn unwrap( + accessor: &Accessor, + value: Resource, + ) -> anyhow::Result> { + accessor + .with(|mut access| -> wasmtime::Result<_> { + let stream = access + .get() + .table() + .delete(value) + .map_err(|error| wasmtime::Error::msg(error.to_string())) + .map(SchemaValueStreamHandleRep::into_stream)?; + let receiver = stream + .take_host_endpoint::() + .map_err(wasmtime::Error::msg)?; + StreamReader::new(&mut access, RelayProducer::new(receiver)) + }) + .map_err(|error| anyhow::anyhow!(error.to_string())) + } + + fn drop( + accessor: &Accessor, + rep: Resource, + ) -> impl Future> + Send { + async move { + accessor.with(|mut access| { + access + .get() + .table() + .delete(rep) + .map_err(|error| anyhow::anyhow!(error.to_string())) + })?; + Ok(()) + } + } +} + +impl Host for DurableWorkerCtx {} + +impl HostWithStore for CoreTypesHost { + async fn parse_uuid(_accessor: &Accessor, uuid: String) -> Result { + uuid::Uuid::parse_str(&uuid) + .map(Into::into) + .map_err(|error| error.to_string()) + } + + async fn uuid_to_string(_accessor: &Accessor, uuid: Uuid) -> String { + let uuid: uuid::Uuid = uuid.into(); + uuid.to_string() + } +} diff --git a/golem-worker-executor/src/durable_host/secrets/mod.rs b/golem-worker-executor/src/durable_host/secrets/mod.rs index 3e5da0e9a8..4a8ed7f840 100644 --- a/golem-worker-executor/src/durable_host/secrets/mod.rs +++ b/golem-worker-executor/src/durable_host/secrets/mod.rs @@ -38,11 +38,13 @@ use golem_common::schema::schema_type::SchemaType; use golem_common::schema::schema_value::{SchemaValue, SecretValuePayload}; use golem_common::schema::validation::subtyping::is_equivalent_cross_graph; use golem_common::schema::validation::value::validate_value; -use golem_schema::schema::wit::wire::{HostSecret, SchemaValueTree}; +use golem_schema::schema::wit::wire::{HostSecretWithStore, SchemaValueTree}; use golem_schema::schema::wit::{SecretHandleRep, SecretResolver, decode_graph, encode_value_with}; use golem_service_base::error::worker_executor::WorkerExecutorError; use golem_service_base::model::agent_secret::AgentSecret; -use wasmtime::component::Resource; +use wasmtime::component::{Accessor, Resource}; + +use crate::durable_host::schema_value_stream::CoreTypesHost; fn secret_entry<'a, Ctx: WorkerCtx>( ctx: &'a mut DurableWorkerCtx, @@ -171,11 +173,19 @@ fn reveal_error_to_wit(error: SecretRevealError) -> SecretError { } } -impl HostSecret for DurableWorkerCtx { - async fn drop(&mut self, rep: Resource) -> anyhow::Result<()> { - DurabilityHost::observe_function_call(self, "golem::core::secret", "drop"); - self.table().delete(rep)?; - Ok(()) +impl HostSecretWithStore for CoreTypesHost { + fn drop( + accessor: &Accessor, + rep: Resource, + ) -> impl Future> + Send { + async move { + accessor.with(|mut access| { + let ctx = access.get(); + DurabilityHost::observe_function_call(ctx, "golem::core::secret", "drop"); + ctx.table().delete(rep)?; + Ok(()) + }) + } } } diff --git a/golem-worker-executor/src/durable_host/stream_session.rs b/golem-worker-executor/src/durable_host/stream_session.rs new file mode 100644 index 0000000000..ea937cb95e --- /dev/null +++ b/golem-worker-executor/src/durable_host/stream_session.rs @@ -0,0 +1,2688 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::durable_host::schema_value_stream::contains_stream; +#[cfg(test)] +use crate::durable_host::stream_transport::LiveStreamTracker; +use crate::durable_host::stream_transport::{ + RelayPeer, RelayReceiver, SourceLifecycle, relay_endpoint_pair, +}; +use golem_api_grpc::proto::golem::common::Empty; +use golem_api_grpc::proto::golem::schema::{ + FixedListValue, ListValue, MapEntry, MapValue, OptionValue, RecordValue, ResultValue, + SchemaValue as ProtoSchemaValue, SchemaValueStreamReference, TupleValue, UnionValue, + VariantValue, result_value as proto_result_value, schema_value as proto_schema_value, +}; +use golem_api_grpc::proto::golem::worker::{ + InvocationFrame as LiveInvocationFrame, StreamDemand as LiveStreamDemand, + StreamDetach as LiveStreamDetach, StreamEnd as LiveStreamEnd, StreamError as LiveStreamError, + StreamItem as LiveStreamItem, invocation_frame as live_invocation_frame, +}; +use golem_schema::schema::SchemaValue; +#[cfg(test)] +use golem_schema::schema::SchemaValueStreamHandleRep; +use std::collections::{HashMap, HashSet}; +use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex}; +use tokio::sync::mpsc; + +enum ImportedStreamEvent { + Item(ImportedStreamItem), + End, + Error(String), +} + +struct ImportedStreamItem { + value: SchemaValue, + registrations: ImportedRegistrationBatch, +} + +#[must_use = "imported stream registrations must be committed or rolled back"] +#[derive(Default)] +struct ImportedRegistrationBatch { + stream_ids: Vec, +} + +impl ImportedRegistrationBatch { + fn discharge_by_session_cancellation(self) {} + + fn is_empty(&self) -> bool { + self.stream_ids.is_empty() + } +} + +#[derive(Clone)] +struct ImportedStreamRoute { + events: mpsc::Sender, + demand_outstanding: Arc, + lifecycle: Arc, +} + +enum ImportedStreamState { + Registering(ImportedStreamRoute), + Active(ImportedStreamRoute), + DetachPending { response_outstanding: bool }, + DetachedAwaitingResponse, +} + +#[derive(Default)] +struct ImportedStreams { + states: HashMap, +} + +enum ExportedStreamCommand { + Demand, + Detach, +} + +#[derive(Default)] +struct SessionActivity { + active: AtomicUsize, + changed: tokio::sync::Notify, +} + +impl SessionActivity { + fn start(self: &Arc) -> SessionActivityGuard { + self.active.fetch_add(1, Ordering::AcqRel); + self.changed.notify_waiters(); + SessionActivityGuard(self.clone()) + } + + fn is_idle(&self) -> bool { + self.active.load(Ordering::Acquire) == 0 + } +} + +struct SessionActivityGuard(Arc); + +impl Drop for SessionActivityGuard { + fn drop(&mut self) { + let previous = self.0.active.fetch_sub(1, Ordering::AcqRel); + debug_assert!(previous > 0, "live invocation activity count underflow"); + self.0.changed.notify_waiters(); + } +} + +struct LiveValueSessionInner { + next_stream_id: std::sync::atomic::AtomicU64, + expected_remote_parity: u64, + frames: mpsc::Sender, + exported: Mutex>>, + imported: Mutex, + imported_changed: tokio::sync::Notify, + seen_remote_stream_ids: Mutex>, + activity: Arc, + cancelled: tokio_util::sync::CancellationToken, + failure: Mutex>, +} + +/// Converts recursive live values to and from the session protocol and drives +/// one demand/item exchange per stream. The two peers allocate disjoint odd +/// and even stream IDs, so sibling streams cannot alias even when nested +/// streams are discovered in later items. +#[derive(Clone)] +pub(crate) struct LiveValueSession { + inner: Arc, +} + +impl LiveValueSession { + pub(crate) fn new( + first_local_stream_id: u64, + frames: mpsc::Sender, + ) -> Self { + debug_assert!(first_local_stream_id == 1 || first_local_stream_id == 2); + Self { + inner: Arc::new(LiveValueSessionInner { + next_stream_id: std::sync::atomic::AtomicU64::new(first_local_stream_id), + expected_remote_parity: 1 - (first_local_stream_id & 1), + frames, + exported: Mutex::new(HashMap::new()), + imported: Mutex::new(ImportedStreams::default()), + imported_changed: tokio::sync::Notify::new(), + seen_remote_stream_ids: Mutex::new(HashSet::new()), + activity: Arc::new(SessionActivity::default()), + cancelled: tokio_util::sync::CancellationToken::new(), + failure: Mutex::new(None), + }), + } + } + + pub(crate) fn encode(&self, value: &SchemaValue) -> Result { + self.encode_with_registered_streams(value) + .map(|(value, _)| value) + } + + fn encode_with_registered_streams( + &self, + value: &SchemaValue, + ) -> Result<(ProtoSchemaValue, Vec), String> { + let mut registered_stream_ids = Vec::new(); + match self.encode_inner(value, &mut registered_stream_ids) { + Ok(value) => Ok((value, registered_stream_ids)), + Err(error) => { + self.discard_exported_streams(®istered_stream_ids); + Err(error) + } + } + } + + fn discard_exported_streams(&self, stream_ids: &[u64]) { + let mut exported = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned"); + for id in stream_ids { + exported.remove(id); + } + } + + fn encode_inner( + &self, + value: &SchemaValue, + registered_stream_ids: &mut Vec, + ) -> Result { + if !contains_stream(value) { + return value.clone().try_into(); + } + + let value = match value { + SchemaValue::Stream(stream) => { + let id = self.allocate_local_stream_id()?; + let receiver = stream.take_host_endpoint::()?; + self.spawn_exported(id, receiver)?; + registered_stream_ids.push(id); + proto_schema_value::Value::StreamReference(SchemaValueStreamReference { + stream_id: id, + }) + } + SchemaValue::Record { fields } => proto_schema_value::Value::RecordValue(RecordValue { + fields: fields + .iter() + .map(|field| self.encode_inner(field, registered_stream_ids)) + .collect::>()?, + }), + SchemaValue::Variant(value) => { + proto_schema_value::Value::VariantValue(Box::new(VariantValue { + case: value.case, + payload: value + .payload + .as_deref() + .map(|payload| self.encode_inner(payload, registered_stream_ids)) + .transpose()? + .map(Box::new), + })) + } + SchemaValue::Tuple { elements } => proto_schema_value::Value::TupleValue(TupleValue { + elements: elements + .iter() + .map(|element| self.encode_inner(element, registered_stream_ids)) + .collect::>()?, + }), + SchemaValue::List { elements } => proto_schema_value::Value::ListValue(ListValue { + elements: elements + .iter() + .map(|element| self.encode_inner(element, registered_stream_ids)) + .collect::>()?, + }), + SchemaValue::FixedList { elements } => { + proto_schema_value::Value::FixedListValue(FixedListValue { + elements: elements + .iter() + .map(|element| self.encode_inner(element, registered_stream_ids)) + .collect::>()?, + }) + } + SchemaValue::Map { entries } => proto_schema_value::Value::MapValue(MapValue { + entries: entries + .iter() + .map(|(key, value)| { + Ok(MapEntry { + key: Some(self.encode_inner(key, registered_stream_ids)?), + value: Some(self.encode_inner(value, registered_stream_ids)?), + }) + }) + .collect::>()?, + }), + SchemaValue::Option { inner } => { + proto_schema_value::Value::OptionValue(Box::new(OptionValue { + inner: inner + .as_deref() + .map(|inner| self.encode_inner(inner, registered_stream_ids)) + .transpose()? + .map(Box::new), + })) + } + SchemaValue::Result(result) => { + let result = match result { + golem_schema::schema::schema_value::ResultValuePayload::Ok { value } => { + match value.as_deref() { + Some(value) => proto_result_value::Result::Ok(Box::new( + self.encode_inner(value, registered_stream_ids)?, + )), + None => proto_result_value::Result::OkUnit(Empty {}), + } + } + golem_schema::schema::schema_value::ResultValuePayload::Err { value } => { + match value.as_deref() { + Some(value) => proto_result_value::Result::Err(Box::new( + self.encode_inner(value, registered_stream_ids)?, + )), + None => proto_result_value::Result::ErrUnit(Empty {}), + } + } + }; + proto_schema_value::Value::ResultValue(Box::new(ResultValue { + result: Some(result), + })) + } + SchemaValue::Union(value) => { + proto_schema_value::Value::UnionValue(Box::new(UnionValue { + tag: value.tag.clone(), + body: Some(Box::new( + self.encode_inner(&value.body, registered_stream_ids)?, + )), + })) + } + _ => { + return Err( + "a stream-bearing live value has an unsupported structural shape".to_string(), + ); + } + }; + Ok(ProtoSchemaValue { value: Some(value) }) + } + + pub(crate) async fn decode(&self, value: ProtoSchemaValue) -> Result { + let _activity = self.inner.activity.start(); + let (value, registrations) = self.decode_with_registered_streams(value); + match value { + Ok(value) => { + self.commit_imported_streams(registrations); + Ok(value) + } + Err(error) => { + self.rollback_imported_streams(registrations).await; + Err(error) + } + } + } + + fn decode_with_registered_streams( + &self, + value: ProtoSchemaValue, + ) -> (Result, ImportedRegistrationBatch) { + let mut registrations = ImportedRegistrationBatch::default(); + let value = self.decode_inner(value, &mut registrations); + (value, registrations) + } + + fn decode_inner( + &self, + value: ProtoSchemaValue, + registrations: &mut ImportedRegistrationBatch, + ) -> Result { + match value + .value + .ok_or_else(|| "schema value has no value".to_string())? + { + proto_schema_value::Value::StreamReference(reference) => { + self.validate_remote_id(reference.stream_id)?; + let (peer, stream) = relay_endpoint_pair(None); + self.spawn_imported(reference.stream_id, peer)?; + registrations.stream_ids.push(reference.stream_id); + Ok(SchemaValue::Stream(stream)) + } + proto_schema_value::Value::RecordValue(value) => Ok(SchemaValue::Record { + fields: value + .fields + .into_iter() + .map(|field| self.decode_inner(field, registrations)) + .collect::>()?, + }), + proto_schema_value::Value::VariantValue(value) => Ok(SchemaValue::Variant( + golem_schema::schema::schema_value::VariantValuePayload { + case: value.case, + payload: value + .payload + .map(|payload| self.decode_inner(*payload, registrations).map(Box::new)) + .transpose()?, + }, + )), + proto_schema_value::Value::TupleValue(value) => Ok(SchemaValue::Tuple { + elements: value + .elements + .into_iter() + .map(|element| self.decode_inner(element, registrations)) + .collect::>()?, + }), + proto_schema_value::Value::ListValue(value) => Ok(SchemaValue::List { + elements: value + .elements + .into_iter() + .map(|element| self.decode_inner(element, registrations)) + .collect::>()?, + }), + proto_schema_value::Value::FixedListValue(value) => Ok(SchemaValue::FixedList { + elements: value + .elements + .into_iter() + .map(|element| self.decode_inner(element, registrations)) + .collect::>()?, + }), + proto_schema_value::Value::MapValue(value) => Ok(SchemaValue::Map { + entries: value + .entries + .into_iter() + .map(|entry| { + Ok(( + self.decode_inner( + entry + .key + .ok_or_else(|| "live map entry has no key".to_string())?, + registrations, + )?, + self.decode_inner( + entry + .value + .ok_or_else(|| "live map entry has no value".to_string())?, + registrations, + )?, + )) + }) + .collect::>()?, + }), + proto_schema_value::Value::OptionValue(value) => Ok(SchemaValue::Option { + inner: value + .inner + .map(|inner| self.decode_inner(*inner, registrations).map(Box::new)) + .transpose()?, + }), + proto_schema_value::Value::ResultValue(value) => { + let result = match value + .result + .ok_or_else(|| "result value has no result arm".to_string())? + { + proto_result_value::Result::Ok(value) => { + golem_schema::schema::schema_value::ResultValuePayload::Ok { + value: Some(Box::new(self.decode_inner(*value, registrations)?)), + } + } + proto_result_value::Result::Err(value) => { + golem_schema::schema::schema_value::ResultValuePayload::Err { + value: Some(Box::new(self.decode_inner(*value, registrations)?)), + } + } + proto_result_value::Result::OkUnit(_) => { + golem_schema::schema::schema_value::ResultValuePayload::Ok { value: None } + } + proto_result_value::Result::ErrUnit(_) => { + golem_schema::schema::schema_value::ResultValuePayload::Err { value: None } + } + }; + Ok(SchemaValue::Result(result)) + } + proto_schema_value::Value::UnionValue(value) => Ok(SchemaValue::Union( + golem_schema::schema::schema_value::UnionValuePayload { + tag: value.tag, + body: Box::new( + self.decode_inner( + *value + .body + .ok_or_else(|| "live union value has no body".to_string())?, + registrations, + )?, + ), + }, + )), + value => ProtoSchemaValue { value: Some(value) }.try_into(), + } + } + + pub(crate) async fn route_stream_frame( + &self, + frame: live_invocation_frame::Frame, + ) -> Result { + let _activity = self.inner.activity.start(); + match frame { + live_invocation_frame::Frame::Demand(demand) => { + let sender = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .get(&demand.stream_id) + .cloned() + .ok_or_else(|| format!("demand for unknown stream {}", demand.stream_id))?; + let result = tokio::select! { + result = sender.send(ExportedStreamCommand::Demand) => result, + _ = self.inner.cancelled.cancelled() => return Ok(true), + }; + result.map_err(|_| format!("stream {} is no longer readable", demand.stream_id))?; + Ok(true) + } + live_invocation_frame::Frame::Detach(detach) => { + let sender = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .get(&detach.stream_id) + .cloned() + .ok_or_else(|| format!("detach for unknown stream {}", detach.stream_id))?; + tokio::select! { + _ = sender.send(ExportedStreamCommand::Detach) => {} + _ = self.inner.cancelled.cancelled() => {} + } + self.inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .remove(&detach.stream_id); + Ok(true) + } + live_invocation_frame::Frame::Item(item) => { + let stream_id = item.stream_id; + let value = item + .value + .ok_or_else(|| format!("stream {stream_id} item has no value"))?; + let route = self.take_imported_route(stream_id, false)?; + let (value, registrations) = self.decode_with_registered_streams(value); + let value = match value { + Ok(value) => value, + Err(error) => { + self.rollback_imported_streams(registrations).await; + return Err(error); + } + }; + let item = ImportedStreamItem { + value, + registrations, + }; + if let Some(route) = route { + if let Err(item) = self.send_imported_item(route, item).await { + self.rollback_imported_item(item).await; + self.ensure_imported_detached(stream_id).await; + } + } else { + self.rollback_imported_item(item).await; + } + Ok(true) + } + live_invocation_frame::Frame::End(end) => { + let route = self.take_imported_route(end.stream_id, true)?; + if let Some(route) = route { + self.send_imported(route, ImportedStreamEvent::End).await; + } + Ok(true) + } + live_invocation_frame::Frame::StreamError(error) => { + let route = self.take_imported_route(error.stream_id, true)?; + if let Some(route) = route { + self.send_imported(route, ImportedStreamEvent::Error(error.details)) + .await; + } + Ok(true) + } + _ => Ok(false), + } + } + + pub(crate) async fn wait_idle(&self) { + loop { + let activity_changed = self.inner.activity.changed.notified(); + let imported_changed = self.inner.imported_changed.notified(); + let imported_settled = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .states + .values() + .all(|state| matches!(state, ImportedStreamState::Active(_))); + if self.inner.activity.is_idle() && imported_settled { + return; + } + tokio::select! { + _ = activity_changed => {} + _ = imported_changed => {} + } + } + } + + pub(crate) fn cancel(&self) { + self.inner.cancelled.cancel(); + self.inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .states + .retain(|_, state| matches!(state, ImportedStreamState::Active(_))); + self.inner.imported_changed.notify_waiters(); + } + + pub(crate) fn is_cancelled(&self) -> bool { + self.inner.cancelled.is_cancelled() + } + + pub(crate) async fn finish_invocation(&self) -> Result<(), String> { + loop { + let activity_changed = self.inner.activity.changed.notified(); + let imported_changed = self.inner.imported_changed.notified(); + let (imported, imported_settling) = { + let imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + let mut active = Vec::new(); + let mut settling = false; + for (id, state) in &imported.states { + match state { + ImportedStreamState::Active(route) + if route.lifecycle.finished.load(Ordering::Acquire) => + { + settling = true; + } + ImportedStreamState::Registering(_) + | ImportedStreamState::DetachPending { .. } + | ImportedStreamState::DetachedAwaitingResponse => settling = true, + ImportedStreamState::Active(_) => active.push(*id), + } + } + (active, settling) + }; + let exported = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .keys() + .copied() + .collect::>(); + if imported.is_empty() && exported.is_empty() { + if !self.inner.activity.is_idle() || imported_settling { + tokio::select! { + _ = activity_changed => continue, + _ = imported_changed => continue, + _ = self.inner.cancelled.cancelled() => return Ok(()), + } + } + self.cancel(); + return Ok(()); + } + + let details = format!( + "live invocation terminated with open imported streams {imported:?} and open exported streams {exported:?}" + ); + self.fail(details.clone()); + return Err(details); + } + } + + pub(crate) fn fail(&self, error: String) { + *self + .inner + .failure + .lock() + .expect("live invocation failure mutex poisoned") = Some(error); + self.cancel(); + } + + async fn send_frame(&self, frame: live_invocation_frame::Frame) -> bool { + tokio::select! { + result = self.inner.frames.send(LiveInvocationFrame { frame: Some(frame) }) => { + result.is_ok() + } + _ = self.inner.cancelled.cancelled() => false, + } + } + + async fn rollback_imported_item(&self, item: ImportedStreamItem) { + let ImportedStreamItem { + value, + registrations, + } = item; + self.rollback_imported_streams(registrations).await; + drop(value); + } + + async fn rollback_imported_streams(&self, registrations: ImportedRegistrationBatch) { + if registrations.is_empty() { + return; + } + for id in registrations.stream_ids { + self.ensure_imported_detached(id).await; + } + } + + async fn ensure_imported_detached(&self, id: u64) { + enum DetachStep { + Send, + Wait, + Done, + } + + loop { + let imported_changed = self.inner.imported_changed.notified(); + let step = { + let mut imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + match imported.states.get(&id) { + Some( + ImportedStreamState::Registering(route) + | ImportedStreamState::Active(route), + ) => { + let response_outstanding = + route.demand_outstanding.swap(false, Ordering::AcqRel); + imported.states.insert( + id, + ImportedStreamState::DetachPending { + response_outstanding, + }, + ); + DetachStep::Send + } + Some(ImportedStreamState::DetachPending { .. }) => DetachStep::Wait, + Some(ImportedStreamState::DetachedAwaitingResponse) | None => DetachStep::Done, + } + }; + match step { + DetachStep::Send => { + self.inner.imported_changed.notify_waiters(); + let sent = self + .send_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: id, + })) + .await; + let mut imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + let response_outstanding = match imported.states.get(&id) { + Some(ImportedStreamState::DetachPending { + response_outstanding, + }) => Some(*response_outstanding), + _ => None, + }; + match response_outstanding { + Some(true) if sent && !self.is_cancelled() => { + imported + .states + .insert(id, ImportedStreamState::DetachedAwaitingResponse); + } + Some(_) => { + imported.states.remove(&id); + } + None => {} + } + drop(imported); + self.inner.imported_changed.notify_waiters(); + if !sent && !self.is_cancelled() { + self.cancel(); + } + return; + } + DetachStep::Wait => { + tokio::select! { + _ = imported_changed => {} + _ = self.inner.cancelled.cancelled() => { + let mut imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + if matches!( + imported.states.get(&id), + Some(ImportedStreamState::DetachPending { .. }) + ) { + imported.states.remove(&id); + } + drop(imported); + self.inner.imported_changed.notify_waiters(); + return; + } + } + } + DetachStep::Done => return, + } + } + } + + fn commit_imported_streams(&self, registrations: ImportedRegistrationBatch) { + if registrations.is_empty() { + return; + } + let mut imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + for id in registrations.stream_ids { + let route = match imported.states.get(&id) { + Some(ImportedStreamState::Registering(route)) => Some(route.clone()), + _ => None, + }; + if let Some(route) = route { + imported + .states + .insert(id, ImportedStreamState::Active(route)); + } + } + drop(imported); + self.inner.imported_changed.notify_waiters(); + } + + async fn send_exported_terminal( + &self, + id: u64, + frame: live_invocation_frame::Frame, + command_rx: &mut mpsc::Receiver, + ) -> bool { + loop { + tokio::select! { + biased; + command = command_rx.recv() => match command { + Some(ExportedStreamCommand::Demand) => {} + Some(ExportedStreamCommand::Detach) => { + return self.send_detached_response(id).await; + } + None => return false, + }, + result = self.inner.frames.send(LiveInvocationFrame { + frame: Some(frame.clone()), + }) => return result.is_ok(), + _ = self.inner.cancelled.cancelled() => return false, + } + } + } + + async fn send_detached_response(&self, id: u64) -> bool { + self.send_frame(live_invocation_frame::Frame::End(LiveStreamEnd { + stream_id: id, + })) + .await + } + + fn validate_remote_id(&self, id: u64) -> Result<(), String> { + if id == 0 || id & 1 != self.inner.expected_remote_parity { + Err(format!("invalid remote stream id {id}")) + } else { + Ok(()) + } + } + + fn allocate_local_stream_id(&self) -> Result { + loop { + let current = self.inner.next_stream_id.load(Ordering::Acquire); + if current == 0 { + return Err("live stream ID space is exhausted".to_string()); + } + let next = current.checked_add(2).unwrap_or(0); + if self + .inner + .next_stream_id + .compare_exchange(current, next, Ordering::AcqRel, Ordering::Acquire) + .is_ok() + { + return Ok(current); + } + } + } + + fn spawn_exported(&self, id: u64, mut receiver: RelayReceiver) -> Result<(), String> { + let (commands, mut command_rx) = mpsc::channel(1); + let mut exported = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned"); + match exported.entry(id) { + std::collections::hash_map::Entry::Vacant(entry) => { + entry.insert(commands); + } + std::collections::hash_map::Entry::Occupied(_) => { + return Err(format!("duplicate local stream id {id}")); + } + } + drop(exported); + let session = self.clone(); + let activity = self.inner.activity.start(); + tokio::spawn(async move { + let _activity = activity; + loop { + let command = tokio::select! { + command = command_rx.recv() => command, + _ = session.inner.cancelled.cancelled() => None, + }; + let Some(command) = command else { + break; + }; + match command { + ExportedStreamCommand::Demand => { + let next = tokio::select! { + biased; + command = command_rx.recv() => match command { + Some(ExportedStreamCommand::Detach) => { + session.send_detached_response(id).await; + None + } + None => None, + Some(ExportedStreamCommand::Demand) => { + session.send_exported_terminal( + id, + live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: id, + details: "stream received overlapping demand".to_string(), + }), + &mut command_rx, + ).await; + None + } + }, + next = receiver.next() => Some(next), + _ = session.inner.cancelled.cancelled() => break, + }; + let Some(next) = next else { + break; + }; + let (frame, registered_stream_ids) = match next { + Ok(Some(value)) => match session.encode_with_registered_streams(&value) + { + Ok((value, registered_stream_ids)) => ( + live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: id, + value: Some(value), + }), + registered_stream_ids, + ), + Err(error) => ( + live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: id, + details: error, + }), + Vec::new(), + ), + }, + Ok(None) => ( + live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: id }), + Vec::new(), + ), + Err(error) => ( + live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: id, + details: error, + }), + Vec::new(), + ), + }; + let terminal = matches!( + frame, + live_invocation_frame::Frame::End(_) + | live_invocation_frame::Frame::StreamError(_) + ); + let sent = tokio::select! { + biased; + command = command_rx.recv() => { + match command { + Some(ExportedStreamCommand::Demand) => { + session.discard_exported_streams(®istered_stream_ids); + session.send_exported_terminal( + id, + live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: id, + details: "stream received overlapping demand".to_string(), + }), + &mut command_rx, + ).await; + } + Some(ExportedStreamCommand::Detach) => { + session.discard_exported_streams(®istered_stream_ids); + session.send_detached_response(id).await; + } + None => {} + } + false + }, + result = session.inner.frames.send(LiveInvocationFrame { + frame: Some(frame), + }) => result.is_ok(), + _ = session.inner.cancelled.cancelled() => false, + }; + if !sent { + session.discard_exported_streams(®istered_stream_ids); + } + if !sent || terminal { + break; + } + } + ExportedStreamCommand::Detach => break, + } + } + session + .inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .remove(&id); + }); + Ok(()) + } + + fn spawn_imported(&self, id: u64, mut peer: RelayPeer) -> Result<(), String> { + if !self + .inner + .seen_remote_stream_ids + .lock() + .expect("live stream ID set mutex poisoned") + .insert(id) + { + return Err(format!("duplicate remote stream id {id}")); + } + let (events, mut event_rx) = mpsc::channel(1); + let demand_outstanding = Arc::new(AtomicBool::new(false)); + let previous = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .states + .insert( + id, + ImportedStreamState::Registering(ImportedStreamRoute { + events, + demand_outstanding: demand_outstanding.clone(), + lifecycle: peer.lifecycle.clone(), + }), + ); + debug_assert!(previous.is_none(), "new remote stream ID already imported"); + self.inner.imported_changed.notify_waiters(); + let session = self.clone(); + let activity = self.inner.activity.start(); + tokio::spawn(async move { + let _activity = activity; + loop { + tokio::select! { + biased; + event = event_rx.recv() => match event { + Some(ImportedStreamEvent::Item(item)) => { + let permit = tokio::select! { + result = peer.item_tx.reserve() => result.ok(), + _ = session.inner.cancelled.cancelled() => None, + }; + if let Some(permit) = permit.filter(|_| !session.is_cancelled()) { + let ImportedStreamItem { + value, + registrations, + } = item; + session.commit_imported_streams(registrations); + permit.send(Ok(value)); + } else { + session.rollback_imported_item(item).await; + break; + } + } + Some(ImportedStreamEvent::Error(error)) => { + tokio::select! { + _ = peer.item_tx.send(Err(error)) => {} + _ = session.inner.cancelled.cancelled() => {} + } + break; + } + Some(ImportedStreamEvent::End) | None => break, + }, + _ = session.inner.cancelled.cancelled() => { + let error = session + .inner + .failure + .lock() + .expect("live invocation failure mutex poisoned") + .clone() + .unwrap_or_else(|| "live streaming invocation was cancelled".to_string()); + let _ = peer.item_tx.try_send(Err(error)); + break; + }, + demand = peer.demand_rx.recv() => match demand { + Some(()) => { + if demand_outstanding.swap(true, Ordering::AcqRel) { + let error = format!( + "remote stream {id} received overlapping local demand" + ); + session.fail(error.clone()); + let _ = peer.item_tx.try_send(Err(error)); + break; + } + if !session.send_frame( + live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: id, + }), + ).await { + demand_outstanding.store(false, Ordering::Release); + break; + } + } + None => break, + }, + } + } + event_rx.close(); + while let Ok(event) = event_rx.try_recv() { + if let ImportedStreamEvent::Item(item) = event { + if session.is_cancelled() { + let ImportedStreamItem { + value, + registrations, + } = item; + registrations.discharge_by_session_cancellation(); + drop(value); + } else { + session.rollback_imported_item(item).await; + } + } + } + session.ensure_imported_detached(id).await; + }); + Ok(()) + } + + fn take_imported_route( + &self, + id: u64, + terminal: bool, + ) -> Result, String> { + self.validate_remote_id(id)?; + let mut imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + let result = match imported.states.get_mut(&id) { + Some(ImportedStreamState::Registering(route) | ImportedStreamState::Active(route)) => { + if !route.demand_outstanding.swap(false, Ordering::AcqRel) { + return Err(format!( + "frame for remote stream {id} received without outstanding demand" + )); + } + let detached = route.lifecycle.finished.load(Ordering::Acquire); + let route = (!detached).then(|| route.clone()); + if terminal { + imported.states.remove(&id); + } + Ok(route) + } + Some(ImportedStreamState::DetachPending { + response_outstanding, + }) if *response_outstanding => { + *response_outstanding = false; + Ok(None) + } + Some(ImportedStreamState::DetachedAwaitingResponse) => { + imported.states.remove(&id); + Ok(None) + } + Some(ImportedStreamState::DetachPending { .. }) | None => { + Err(format!("frame for unknown remote stream {id}")) + } + }; + drop(imported); + self.inner.imported_changed.notify_waiters(); + result + } + + async fn send_imported_item( + &self, + route: ImportedStreamRoute, + item: ImportedStreamItem, + ) -> Result<(), ImportedStreamItem> { + let permit = tokio::select! { + result = route.events.reserve() => result.ok(), + _ = self.inner.cancelled.cancelled() => None, + }; + if let Some(permit) = permit { + permit.send(ImportedStreamEvent::Item(item)); + Ok(()) + } else { + Err(item) + } + } + + async fn send_imported(&self, route: ImportedStreamRoute, event: ImportedStreamEvent) { + tokio::select! { + _ = route.events.send(event) => {} + _ = self.inner.cancelled.cancelled() => {} + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use test_r::{test, timeout}; + + fn stream_id(value: &ProtoSchemaValue) -> u64 { + match value.value.as_ref() { + Some(proto_schema_value::Value::StreamReference(reference)) => reference.stream_id, + other => panic!("expected stream id, got {other:?}"), + } + } + + fn stream_reference(id: u64) -> ProtoSchemaValue { + ProtoSchemaValue { + value: Some(proto_schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: id }, + )), + } + } + + fn stream_value() -> SchemaValue { + let (_source, stream) = relay_endpoint_pair(None); + SchemaValue::Stream(stream) + } + + fn count_streams(value: &SchemaValue) -> usize { + match value { + SchemaValue::Stream(_) => 1, + SchemaValue::Record { fields } => fields.iter().map(count_streams).sum(), + SchemaValue::Variant(value) => value + .payload + .as_deref() + .map(count_streams) + .unwrap_or_default(), + SchemaValue::Tuple { elements } + | SchemaValue::List { elements } + | SchemaValue::FixedList { elements } => elements.iter().map(count_streams).sum(), + SchemaValue::Map { entries } => entries + .iter() + .map(|(key, value)| count_streams(key) + count_streams(value)) + .sum(), + SchemaValue::Option { inner } => { + inner.as_deref().map(count_streams).unwrap_or_default() + } + SchemaValue::Result(value) => match value { + golem_schema::schema::schema_value::ResultValuePayload::Ok { value } + | golem_schema::schema::schema_value::ResultValuePayload::Err { value } => { + value.as_deref().map(count_streams).unwrap_or_default() + } + }, + SchemaValue::Union(value) => count_streams(&value.body), + _ => 0, + } + } + + #[test] + async fn recursive_composites_preserve_live_streams() { + use golem_schema::schema::schema_value::{ + ResultValuePayload, UnionValuePayload, VariantValuePayload, + }; + + let value = SchemaValue::Record { + fields: vec![ + SchemaValue::Variant(VariantValuePayload { + case: 1, + payload: Some(Box::new(stream_value())), + }), + SchemaValue::Tuple { + elements: vec![stream_value()], + }, + SchemaValue::List { + elements: vec![stream_value()], + }, + SchemaValue::FixedList { + elements: vec![stream_value()], + }, + SchemaValue::Map { + entries: vec![(stream_value(), stream_value())], + }, + SchemaValue::Option { + inner: Some(Box::new(stream_value())), + }, + SchemaValue::Result(ResultValuePayload::Ok { + value: Some(Box::new(stream_value())), + }), + SchemaValue::Result(ResultValuePayload::Err { + value: Some(Box::new(stream_value())), + }), + SchemaValue::Union(UnionValuePayload { + tag: "stream".to_string(), + body: Box::new(stream_value()), + }), + ], + }; + let (sender_frames, _sender_frame_rx) = mpsc::channel(32); + let sender = LiveValueSession::new(1, sender_frames); + let encoded = sender.encode(&value).unwrap(); + let (receiver_frames, _receiver_frame_rx) = mpsc::channel(32); + let receiver = LiveValueSession::new(2, receiver_frames); + + let decoded = receiver.decode(encoded).await.unwrap(); + + assert_eq!(count_streams(&decoded), 10); + sender.cancel(); + receiver.cancel(); + } + + #[test] + async fn stream_ids_are_affine_and_validated_per_session() { + let (frames, _frame_rx) = mpsc::channel(8); + let receiver = LiveValueSession::new(1, frames); + + assert_eq!( + receiver.decode(stream_reference(0)).await.unwrap_err(), + "invalid remote stream id 0" + ); + assert_eq!( + receiver.decode(stream_reference(1)).await.unwrap_err(), + "invalid remote stream id 1" + ); + assert!(matches!( + receiver.decode(stream_reference(2)).await.unwrap(), + SchemaValue::Stream(_) + )); + assert_eq!( + receiver.decode(stream_reference(2)).await.unwrap_err(), + "duplicate remote stream id 2" + ); + + let (_source, stream) = relay_endpoint_pair(None); + let alias = stream.clone(); + let (frames, _frame_rx) = mpsc::channel(8); + let sender = LiveValueSession::new(1, frames); + sender.encode(&SchemaValue::Stream(stream)).unwrap(); + assert_eq!( + sender.encode(&SchemaValue::Stream(alias)).unwrap_err(), + "schema value stream was already transferred" + ); + receiver.cancel(); + sender.cancel(); + } + + #[test] + fn local_stream_id_exhaustion_must_not_reuse_an_active_id() { + let (frames, _frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new(1, frames); + + let first_id = stream_id(&session.encode(&stream_value()).unwrap()); + session + .inner + .next_stream_id + .store(u64::MAX, Ordering::Release); + let last_id = stream_id(&session.encode(&stream_value()).unwrap()); + let error = session.encode(&stream_value()).unwrap_err(); + + session.cancel(); + assert_ne!(first_id, last_id); + assert_eq!(error, "live stream ID space is exhausted"); + } + + #[test] + async fn failed_recursive_encode_releases_streams_registered_before_the_error() { + let (_source, stream) = relay_endpoint_pair(None); + let alias = stream.clone(); + let (frames, _frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new(1, frames); + + let result = session.encode(&SchemaValue::Tuple { + elements: vec![SchemaValue::Stream(stream), SchemaValue::Stream(alias)], + }); + + assert!(result.is_err(), "aliasing a stream must be rejected"); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("a failed encode must not leave an exported stream active"); + } + + #[test] + async fn failed_recursive_decode_releases_streams_registered_before_the_error() { + let (frames, mut frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new(1, frames); + let value = ProtoSchemaValue { + value: Some(proto_schema_value::Value::TupleValue(TupleValue { + elements: vec![stream_reference(2), stream_reference(2)], + })), + }; + + let error = session.decode(value).await.unwrap_err(); + + assert_eq!(error, "duplicate remote stream id 2"); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: 2 + })) + )); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("a failed decode must not leave an imported stream active"); + } + + #[test] + async fn equal_stream_ids_in_different_sessions_do_not_alias() { + let (first_frames, mut first_frame_rx) = mpsc::channel(8); + let first = LiveValueSession::new(1, first_frames); + let (second_frames, mut second_frame_rx) = mpsc::channel(8); + let second = LiveValueSession::new(1, second_frames); + let SchemaValue::Stream(first_stream) = first.decode(stream_reference(2)).await.unwrap() + else { + panic!("expected first stream"); + }; + let SchemaValue::Stream(second_stream) = second.decode(stream_reference(2)).await.unwrap() + else { + panic!("expected second stream"); + }; + let mut first_reader = first_stream.take_host_endpoint::().unwrap(); + let mut second_reader = second_stream.take_host_endpoint::().unwrap(); + let first_next = tokio::spawn(async move { first_reader.next().await }); + let second_next = tokio::spawn(async move { second_reader.next().await }); + assert!(matches!( + first_frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + assert!(matches!( + second_frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + + first + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(SchemaValue::String("first".to_string()).try_into().unwrap()), + })) + .await + .unwrap(); + second + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some( + SchemaValue::String("second".to_string()) + .try_into() + .unwrap(), + ), + })) + .await + .unwrap(); + + assert_eq!( + first_next.await.unwrap().unwrap(), + Some(SchemaValue::String("first".to_string())) + ); + assert_eq!( + second_next.await.unwrap().unwrap(), + Some(SchemaValue::String("second".to_string())) + ); + } + + #[test] + async fn frames_for_unknown_remote_streams_are_rejected() { + let (frames, _frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + + let error = session + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(SchemaValue::Bool(true).try_into().unwrap()), + })) + .await + .unwrap_err(); + + assert_eq!(error, "frame for unknown remote stream 2"); + + for frame in [ + live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: 2 }), + live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: 2, + details: "unknown".to_string(), + }), + ] { + assert_eq!( + session.route_stream_frame(frame).await.unwrap_err(), + "frame for unknown remote stream 2" + ); + } + } + + #[test] + async fn exported_streams_do_not_read_before_demand() { + let (mut source, stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let encoded = session.encode(&SchemaValue::Stream(stream)).unwrap(); + let id = stream_id(&encoded); + + tokio::task::yield_now().await; + assert!(source.demand_rx.try_recv().is_err()); + assert!(frame_rx.try_recv().is_err()); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: id, + })) + .await + .unwrap(); + assert_eq!(source.demand_rx.recv().await, Some(())); + source + .item_tx + .send(Ok(SchemaValue::Bool(true))) + .await + .unwrap(); + + let frame = frame_rx.recv().await.unwrap().frame.unwrap(); + let live_invocation_frame::Frame::Item(item) = frame else { + panic!("expected item frame"); + }; + assert_eq!(item.stream_id, id); + assert_eq!( + session.decode(item.value.unwrap()).await.unwrap(), + SchemaValue::Bool(true) + ); + } + + #[test] + async fn sibling_stream_demands_are_isolated() { + let (mut first, first_stream) = relay_endpoint_pair(None); + let (mut second, second_stream) = relay_endpoint_pair(None); + let (frames, _frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let encoded = session + .encode(&SchemaValue::Tuple { + elements: vec![ + SchemaValue::Stream(first_stream), + SchemaValue::Stream(second_stream), + ], + }) + .unwrap(); + let proto_schema_value::Value::TupleValue(tuple) = encoded.value.unwrap() else { + panic!("expected tuple"); + }; + let first_id = stream_id(&tuple.elements[0]); + let second_id = stream_id(&tuple.elements[1]); + assert_ne!(first_id, second_id); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: second_id, + })) + .await + .unwrap(); + assert_eq!(second.demand_rx.recv().await, Some(())); + assert!(first.demand_rx.try_recv().is_err()); + + session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: first_id, + })) + .await + .unwrap(); + session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: second_id, + })) + .await + .unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .unwrap(); + } + + #[test] + async fn imported_stream_preserves_demand_and_items() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let value = session.decode(stream_reference(2)).await.unwrap(); + let SchemaValue::Stream(stream) = value else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + let next = tokio::spawn(async move { receiver.next().await }); + + let frame = frame_rx.recv().await.unwrap().frame.unwrap(); + assert!(matches!( + frame, + live_invocation_frame::Frame::Demand(LiveStreamDemand { stream_id: 2 }) + )); + session + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(SchemaValue::U32(42).try_into().unwrap()), + })) + .await + .unwrap(); + + assert_eq!(next.await.unwrap().unwrap(), Some(SchemaValue::U32(42))); + } + + #[test] + async fn imported_stream_rejects_item_before_demand() { + let (frames, _frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(_stream) = session.decode(stream_reference(2)).await.unwrap() + else { + panic!("expected stream"); + }; + + let result = session + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(SchemaValue::U32(42).try_into().unwrap()), + })) + .await; + + assert!( + result.is_err(), + "an item without outstanding demand must be rejected" + ); + } + + #[test] + async fn producer_errors_are_terminal_and_scoped_to_the_stream() { + let (mut source, stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let encoded = session.encode(&SchemaValue::Stream(stream)).unwrap(); + let id = stream_id(&encoded); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: id, + })) + .await + .unwrap(); + assert_eq!(source.demand_rx.recv().await, Some(())); + source + .item_tx + .send(Err("producer failed".to_string())) + .await + .unwrap(); + + let frame = frame_rx.recv().await.unwrap().frame.unwrap(); + assert!(matches!( + frame, + live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id, + details, + }) if stream_id == id && details == "producer failed" + )); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .unwrap(); + } + + #[test] + async fn overlapping_exported_demand_is_terminal_for_that_stream() { + let (mut source, stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: id, + })) + .await + .unwrap(); + assert_eq!(source.demand_rx.recv().await, Some(())); + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: id, + })) + .await + .unwrap(); + + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id, + details, + })) if stream_id == id && details == "stream received overlapping demand" + )); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("overlapping demand must terminate the exported relay"); + } + + #[test] + async fn overlapping_imported_demand_fails_the_session() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + + receiver.demand_tx.send(()).await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + receiver.demand_tx.send(()).await.unwrap(); + + assert_eq!( + receiver.item_rx.recv().await.unwrap().unwrap_err(), + "remote stream 2 received overlapping local demand" + ); + assert!(session.is_cancelled()); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("overlapping imported demand must terminate the session relay"); + } + + #[test] + async fn invocation_terminal_requires_all_imported_streams_to_finish() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + let next = tokio::spawn(async move { receiver.next().await }); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + + let error = session.finish_invocation().await.unwrap_err(); + + assert!(error.contains("open imported streams [2]")); + assert_eq!(next.await.unwrap().unwrap_err(), error); + } + + #[test] + async fn premature_invocation_terminal_reaches_reader_before_first_demand() { + let (frames, _frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + + let error = session.finish_invocation().await.unwrap_err(); + session.wait_idle().await; + receiver.demand_tx.closed().await; + + assert_eq!(receiver.next().await.unwrap_err(), error); + } + + #[test] + async fn imported_stream_reports_session_cancellation_instead_of_eof() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + let next = tokio::spawn(async move { receiver.next().await }); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + + session.cancel(); + + let result = next.await.unwrap(); + assert!( + result.is_err(), + "semantic invocation cancellation must not be reported as clean EOF" + ); + } + + #[test] + async fn imported_stream_terminal_is_monotonic() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + let next = tokio::spawn(async move { receiver.next().await }); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + + session + .route_stream_frame(live_invocation_frame::Frame::End(LiveStreamEnd { + stream_id: 2, + })) + .await + .unwrap(); + assert_eq!( + session + .route_stream_frame(live_invocation_frame::Frame::End(LiveStreamEnd { + stream_id: 2, + })) + .await + .unwrap_err(), + "frame for unknown remote stream 2" + ); + session.finish_invocation().await.unwrap(); + assert_eq!(next.await.unwrap().unwrap(), None); + assert_eq!( + session.decode(stream_reference(2)).await.unwrap_err(), + "duplicate remote stream id 2" + ); + } + + #[test] + async fn imported_error_terminal_cannot_be_repeated_or_replaced() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + let next = tokio::spawn(async move { receiver.next().await }); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + + session + .route_stream_frame(live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: 2, + details: "failed".to_string(), + })) + .await + .unwrap(); + assert_eq!(next.await.unwrap().unwrap_err(), "failed"); + + for frame in [ + live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: 2, + details: "duplicate".to_string(), + }), + live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: 2 }), + ] { + assert_eq!( + session.route_stream_frame(frame).await.unwrap_err(), + "frame for unknown remote stream 2" + ); + } + } + + #[test] + async fn streams_discovered_in_items_get_independent_ids() { + let (mut outer_source, outer_stream) = relay_endpoint_pair(None); + let (mut nested_source, nested_stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new(1, frames); + let outer_id = stream_id(&session.encode(&SchemaValue::Stream(outer_stream)).unwrap()); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: outer_id, + })) + .await + .unwrap(); + assert_eq!(outer_source.demand_rx.recv().await, Some(())); + outer_source + .item_tx + .send(Ok(SchemaValue::Option { + inner: Some(Box::new(SchemaValue::Stream(nested_stream))), + })) + .await + .unwrap(); + + let live_invocation_frame::Frame::Item(item) = + frame_rx.recv().await.unwrap().frame.unwrap() + else { + panic!("expected item frame"); + }; + let proto_schema_value::Value::OptionValue(option) = item.value.unwrap().value.unwrap() + else { + panic!("expected option item"); + }; + let nested_id = stream_id(option.inner.as_deref().unwrap()); + assert_ne!(outer_id, nested_id); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: nested_id, + })) + .await + .unwrap(); + assert_eq!(nested_source.demand_rx.recv().await, Some(())); + + for id in [outer_id, nested_id] { + session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: id, + })) + .await + .unwrap(); + } + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .unwrap(); + } + + #[test] + async fn nested_stream_remains_live_after_its_outer_stream_ends() { + let (mut outer_source, outer_stream) = relay_endpoint_pair(None); + let (mut nested_source, nested_stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new(1, frames); + let outer_id = stream_id(&session.encode(&SchemaValue::Stream(outer_stream)).unwrap()); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: outer_id, + })) + .await + .unwrap(); + assert_eq!(outer_source.demand_rx.recv().await, Some(())); + outer_source + .item_tx + .send(Ok(SchemaValue::Stream(nested_stream))) + .await + .unwrap(); + let Some(live_invocation_frame::Frame::Item(item)) = frame_rx.recv().await.unwrap().frame + else { + panic!("expected outer item"); + }; + let nested_id = stream_id(item.value.as_ref().unwrap()); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: outer_id, + })) + .await + .unwrap(); + assert_eq!(outer_source.demand_rx.recv().await, Some(())); + drop(outer_source.item_tx); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::End(LiveStreamEnd { stream_id })) + if stream_id == outer_id + )); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: nested_id, + })) + .await + .unwrap(); + assert_eq!(nested_source.demand_rx.recv().await, Some(())); + session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: nested_id, + })) + .await + .unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("the nested stream should be independent of its terminated outer stream"); + } + + #[test] + async fn detaching_one_source_does_not_finish_its_sibling() { + let cancellation = tokio_util::sync::CancellationToken::new(); + let tracker = Arc::new(LiveStreamTracker::new(cancellation)); + let (_first_source, first_stream) = relay_endpoint_pair(Some(tracker.clone())); + let (_second_source, second_stream) = relay_endpoint_pair(Some(tracker.clone())); + let (frames, _frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let encoded = session + .encode(&SchemaValue::Tuple { + elements: vec![ + SchemaValue::Stream(first_stream), + SchemaValue::Stream(second_stream), + ], + }) + .unwrap(); + let proto_schema_value::Value::TupleValue(tuple) = encoded.value.unwrap() else { + panic!("expected tuple"); + }; + let first_id = stream_id(&tuple.elements[0]); + let second_id = stream_id(&tuple.elements[1]); + + session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: first_id, + })) + .await + .unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(1), async { + while tracker.active.load(Ordering::Acquire) != 1 { + tokio::task::yield_now().await; + } + }) + .await + .unwrap(); + + session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: second_id, + })) + .await + .unwrap(); + tokio::time::timeout( + std::time::Duration::from_secs(1), + tracker.wait_for_sources(), + ) + .await + .unwrap(); + } + + #[test] + async fn dropping_an_imported_handle_detaches_its_remote_stream() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + + drop(stream); + + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: 2 + })) + )); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("dropping an imported handle must release its relay task"); + session.finish_invocation().await.unwrap(); + } + + #[test] + async fn detached_imported_stream_accepts_one_racing_response() { + for response in 0..3 { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() + else { + panic!("expected stream"); + }; + let receiver = stream.take_host_endpoint::().unwrap(); + receiver.demand_tx.send(()).await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + + drop(receiver); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: 2 + })) + )); + let idle_session = session.clone(); + let idle = tokio::spawn(async move { idle_session.wait_idle().await }); + tokio::task::yield_now().await; + assert!( + !idle.is_finished(), + "the detached imported relay must await its outstanding response" + ); + + let frame = match response { + 0 => live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(SchemaValue::U32(42).try_into().unwrap()), + }), + 1 => live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: 2 }), + _ => live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: 2, + details: "racing failure".to_string(), + }), + }; + session.route_stream_frame(frame.clone()).await.unwrap(); + idle.await.unwrap(); + assert_eq!( + session.route_stream_frame(frame).await.unwrap_err(), + "frame for unknown remote stream 2" + ); + assert_eq!( + session.decode(stream_reference(2)).await.unwrap_err(), + "duplicate remote stream id 2" + ); + session.finish_invocation().await.unwrap(); + } + } + + #[test] + #[timeout("2s")] + async fn server_idle_must_wait_for_detached_response_with_nested_stream() { + let cancellation = tokio_util::sync::CancellationToken::new(); + let tracker = Arc::new(LiveStreamTracker::new(cancellation)); + let (mut outer_source, outer_stream) = relay_endpoint_pair(Some(tracker.clone())); + let (_nested_source, nested_stream) = relay_endpoint_pair(Some(tracker.clone())); + + let (client_frames, mut client_frame_rx) = mpsc::channel(8); + let client = LiveValueSession::new(1, client_frames); + let encoded_outer = client.encode(&SchemaValue::Stream(outer_stream)).unwrap(); + + let (server_frames, mut server_frame_rx) = mpsc::channel(8); + let server = LiveValueSession::new(2, server_frames); + let SchemaValue::Stream(imported_outer) = server.decode(encoded_outer).await.unwrap() + else { + panic!("expected imported outer stream"); + }; + let receiver = imported_outer + .take_host_endpoint::() + .unwrap(); + receiver.demand_tx.send(()).await.unwrap(); + let Some(live_invocation_frame::Frame::Demand(demand)) = + server_frame_rx.recv().await.unwrap().frame + else { + panic!("expected outer demand"); + }; + client + .route_stream_frame(live_invocation_frame::Frame::Demand(demand)) + .await + .unwrap(); + assert_eq!(outer_source.demand_rx.recv().await, Some(())); + + outer_source + .item_tx + .send(Ok(SchemaValue::Stream(nested_stream))) + .await + .unwrap(); + let racing_item = client_frame_rx.recv().await.unwrap(); + + drop(receiver); + let Some(live_invocation_frame::Frame::Detach(detach)) = + server_frame_rx.recv().await.unwrap().frame + else { + panic!("expected outer detach"); + }; + assert!( + tokio::time::timeout(std::time::Duration::from_millis(50), server.wait_idle()) + .await + .is_err(), + "server idle must wait for the response already outstanding when detach was sent" + ); + client + .route_stream_frame(live_invocation_frame::Frame::Detach(detach)) + .await + .unwrap(); + + server + .route_stream_frame(racing_item.frame.unwrap()) + .await + .unwrap(); + let Some(live_invocation_frame::Frame::Detach(nested_detach)) = + server_frame_rx.recv().await.unwrap().frame + else { + panic!("expected nested detach"); + }; + client + .route_stream_frame(live_invocation_frame::Frame::Detach(nested_detach)) + .await + .unwrap(); + server.wait_idle().await; + + let result = client.finish_invocation().await; + assert!( + result.is_ok(), + "the detached racing item must not leave its nested source attached: {result:?}" + ); + tracker.wait_for_sources().await; + } + + #[test] + #[timeout("2s")] + async fn detached_imported_item_must_rollback_undelivered_nested_streams() { + let (frames, mut frame_rx) = mpsc::channel(1); + let session = LiveValueSession::new(1, frames.clone()); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let receiver = stream.take_host_endpoint::().unwrap(); + receiver.demand_tx.send(()).await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + + frames + .send(LiveInvocationFrame { frame: None }) + .await + .unwrap(); + drop(receiver); + tokio::task::yield_now().await; + + let route_session = session.clone(); + let routing = tokio::spawn(async move { + route_session + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(stream_reference(4)), + })) + .await + }); + let finish_session = session.clone(); + let finishing = tokio::spawn(async move { finish_session.finish_invocation().await }); + tokio::task::yield_now().await; + assert!( + !finishing.is_finished(), + "invocation completion must wait for accepted detach frames" + ); + + frame_rx.recv().await.unwrap(); + let mut detached = HashSet::new(); + for _ in 0..2 { + let frame = frame_rx + .recv() + .await + .expect("both outer and nested detach frames must be sent") + .frame + .expect("detach frame must have a payload"); + let live_invocation_frame::Frame::Detach(detach) = frame else { + panic!("expected detach frame, got {frame:?}"); + }; + detached.insert(detach.stream_id); + } + routing + .await + .unwrap() + .expect("one response racing a valid detach should be accepted"); + assert_eq!(detached, HashSet::from([2, 4])); + + let result = finishing.await.unwrap(); + assert!( + result.is_ok(), + "a nested stream in an item that could not be delivered to the detached reader must be rolled back: {result:?}" + ); + } + + #[test] + #[timeout("2s")] + async fn failed_imported_item_delivery_rolls_back_nested_and_detaches_outer() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + receiver.demand_tx.send(()).await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + receiver.item_rx.close(); + + session + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(stream_reference(4)), + })) + .await + .unwrap(); + + let mut detached = HashSet::new(); + for _ in 0..2 { + let frame = frame_rx.recv().await.unwrap().frame.unwrap(); + let live_invocation_frame::Frame::Detach(detach) = frame else { + panic!("expected detach frame, got {frame:?}"); + }; + detached.insert(detach.stream_id); + } + assert_eq!(detached, HashSet::from([2, 4])); + session.wait_idle().await; + session.finish_invocation().await.unwrap(); + } + + #[test] + #[timeout("2s")] + async fn cancellation_discharges_a_blocked_nested_rollback() { + let (frames, mut frame_rx) = mpsc::channel(1); + let session = LiveValueSession::new(1, frames.clone()); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let receiver = stream.take_host_endpoint::().unwrap(); + receiver.demand_tx.send(()).await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + frames + .send(LiveInvocationFrame { frame: None }) + .await + .unwrap(); + drop(receiver); + tokio::task::yield_now().await; + + let route_session = session.clone(); + let routing = tokio::spawn(async move { + route_session + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(stream_reference(4)), + })) + .await + }); + tokio::time::timeout(std::time::Duration::from_secs(1), async { + loop { + if session + .inner + .seen_remote_stream_ids + .lock() + .expect("live stream ID set mutex poisoned") + .contains(&4) + { + break; + } + tokio::task::yield_now().await; + } + }) + .await + .expect("the nested rollback should block on its detach frame"); + session.cancel(); + + routing.await.unwrap().unwrap(); + session.wait_idle().await; + } + + #[test] + async fn detached_imported_item_still_validates_nested_stream_ids() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let receiver = stream.take_host_endpoint::().unwrap(); + receiver.demand_tx.send(()).await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: 2 + })) + )); + + drop(receiver); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: 2 + })) + )); + + let result = session + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(stream_reference(3)), + })) + .await; + + assert!( + result.is_err(), + "wrong-parity nested stream IDs must remain invalid when an item races detach" + ); + session.wait_idle().await; + } + + #[test] + async fn dropping_an_untransferred_stream_releases_its_tracker() { + let cancellation = tokio_util::sync::CancellationToken::new(); + let tracker = Arc::new(LiveStreamTracker::new(cancellation)); + let (_source, stream) = relay_endpoint_pair(Some(tracker.clone())); + assert_eq!(tracker.active.load(Ordering::Acquire), 1); + + drop(stream); + + tokio::time::timeout( + std::time::Duration::from_secs(1), + tracker.wait_for_sources(), + ) + .await + .expect("dropping an untransferred stream must release its source tracker"); + } + + #[test] + async fn dropping_a_store_resource_table_releases_its_stream_handle() { + let cancellation = tokio_util::sync::CancellationToken::new(); + let tracker = Arc::new(LiveStreamTracker::new(cancellation)); + let (_source, stream) = relay_endpoint_pair(Some(tracker.clone())); + let mut table = wasmtime::component::ResourceTable::new(); + table + .push(SchemaValueStreamHandleRep::new(stream)) + .expect("the stream handle should fit in a new resource table"); + assert_eq!(tracker.active.load(Ordering::Acquire), 1); + + drop(table); + + tokio::time::timeout( + std::time::Duration::from_secs(1), + tracker.wait_for_sources(), + ) + .await + .expect("discarding a Store must release stream handles still in its resource table"); + } + + #[test] + async fn dropping_an_exported_source_after_demand_sends_end() { + let (mut source, stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: id, + })) + .await + .unwrap(); + assert_eq!(source.demand_rx.recv().await, Some(())); + + drop(source.item_tx); + + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::End(LiveStreamEnd { stream_id })) + if stream_id == id + )); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("dropping an exported source must terminate its relay"); + } + + #[test] + async fn invocation_cancellation_releases_all_attached_sources() { + let cancellation = tokio_util::sync::CancellationToken::new(); + let tracker = Arc::new(LiveStreamTracker::new(cancellation.clone())); + let (_source, stream) = relay_endpoint_pair(Some(tracker.clone())); + assert_eq!(tracker.active.load(Ordering::Acquire), 1); + + cancellation.cancel(); + tokio::time::timeout( + std::time::Duration::from_secs(1), + tracker.wait_for_sources(), + ) + .await + .unwrap(); + assert_eq!(tracker.active.load(Ordering::Acquire), 0); + + drop(stream); + assert_eq!(tracker.active.load(Ordering::Acquire), 0); + } + + #[test] + async fn cancellation_releases_exported_stream_blocked_on_an_item() { + let (mut source, stream) = relay_endpoint_pair(None); + let (frames, _frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let stream_id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id, + })) + .await + .unwrap(); + assert_eq!(source.demand_rx.recv().await, Some(())); + + session.cancel(); + + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("cancellation must release a producer blocked waiting for its next item"); + } + + #[test] + async fn cancellation_releases_exported_stream_blocked_sending_an_item() { + let (mut source, stream) = relay_endpoint_pair(None); + let (frames, _frame_rx) = mpsc::channel(1); + frames + .send(LiveInvocationFrame { frame: None }) + .await + .unwrap(); + let session = LiveValueSession::new(1, frames); + let stream_id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id, + })) + .await + .unwrap(); + assert_eq!(source.demand_rx.recv().await, Some(())); + source.item_tx.send(Ok(SchemaValue::U32(42))).await.unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(1), async { + while source.item_tx.capacity() == 0 { + tokio::task::yield_now().await; + } + }) + .await + .expect("the exported relay should consume the item before blocking on the frame channel"); + + session.cancel(); + + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("cancellation must release an exported stream blocked sending an item"); + } + + #[test] + async fn detach_discards_nested_streams_from_an_undelivered_item() { + let (mut outer_source, outer_stream) = relay_endpoint_pair(None); + let (mut nested_source, nested_stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(1); + frames + .send(LiveInvocationFrame { frame: None }) + .await + .unwrap(); + let session = LiveValueSession::new(1, frames); + let outer_id = stream_id(&session.encode(&SchemaValue::Stream(outer_stream)).unwrap()); + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id: outer_id, + })) + .await + .unwrap(); + assert_eq!(outer_source.demand_rx.recv().await, Some(())); + outer_source + .item_tx + .send(Ok(SchemaValue::Stream(nested_stream))) + .await + .unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(1), async { + while outer_source.item_tx.capacity() == 0 { + tokio::task::yield_now().await; + } + }) + .await + .expect("the outer relay should consume the nested item before blocking"); + + session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id: outer_id, + })) + .await + .unwrap(); + + frame_rx.recv().await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::End(LiveStreamEnd { + stream_id + })) if stream_id == outer_id + )); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("detach must release the blocked outer and undisclosed nested relays"); + assert_eq!(nested_source.demand_rx.recv().await, None); + } + + #[test] + async fn detach_racing_a_blocked_terminal_frame_is_accepted() { + let (mut source, stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(1); + frames + .send(LiveInvocationFrame { frame: None }) + .await + .unwrap(); + let session = LiveValueSession::new(1, frames); + let stream_id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id, + })) + .await + .unwrap(); + assert_eq!(source.demand_rx.recv().await, Some(())); + + drop(source.item_tx); + tokio::task::yield_now().await; + assert!( + session + .inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .contains_key(&stream_id), + "the exported route must remain addressable while its terminal frame is blocked" + ); + + let result = session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id, + })) + .await; + + assert!( + result.is_ok(), + "detach is valid until the peer can observe the terminal frame: {result:?}" + ); + frame_rx.recv().await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::End(LiveStreamEnd { + stream_id: id + })) if id == stream_id + )); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("detach must interrupt a blocked terminal frame send"); + } + + #[test] + async fn detach_must_interrupt_blocked_overlapping_demand_error() { + let (mut source, stream) = relay_endpoint_pair(None); + let (frames, mut frame_rx) = mpsc::channel(1); + frames + .send(LiveInvocationFrame { frame: None }) + .await + .unwrap(); + let session = LiveValueSession::new(1, frames); + let stream_id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id, + })) + .await + .unwrap(); + assert_eq!(source.demand_rx.recv().await, Some(())); + source.item_tx.send(Ok(SchemaValue::U32(42))).await.unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(1), async { + while source.item_tx.capacity() == 0 { + tokio::task::yield_now().await; + } + }) + .await + .expect("the exported relay should block while sending the item frame"); + + session + .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { + stream_id, + })) + .await + .unwrap(); + session + .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { + stream_id, + })) + .await + .unwrap(); + + frame_rx.recv().await.unwrap(); + assert!(matches!( + frame_rx.recv().await.unwrap().frame, + Some(live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: id })) + | Some(live_invocation_frame::Frame::StreamError(LiveStreamError { + stream_id: id, + .. + })) if id == stream_id + )); + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("detach must interrupt the blocked overlapping-demand error frame"); + } + + #[test] + async fn cancellation_releases_imported_stream_with_buffered_item() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames); + let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + panic!("expected stream"); + }; + let mut receiver = stream.take_host_endpoint::().unwrap(); + let mut next = Box::pin(receiver.next()); + + let frame = tokio::select! { + frame = frame_rx.recv() => frame.unwrap().frame.unwrap(), + result = &mut next => panic!("read completed before receiving an item: {result:?}"), + }; + assert!(matches!( + frame, + live_invocation_frame::Frame::Demand(LiveStreamDemand { stream_id: 2 }) + )); + drop(next); + + session + .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + stream_id: 2, + value: Some(SchemaValue::U32(42).try_into().unwrap()), + })) + .await + .unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(1), async { + while receiver.item_rx.len() != 1 { + tokio::task::yield_now().await; + } + }) + .await + .expect("the delivered item should become buffered"); + + session.cancel(); + + tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + .await + .expect("cancellation must release an imported stream with a buffered item"); + } +} diff --git a/golem-worker-executor/src/durable_host/stream_transport.rs b/golem-worker-executor/src/durable_host/stream_transport.rs new file mode 100644 index 0000000000..253cd4725a --- /dev/null +++ b/golem-worker-executor/src/durable_host/stream_transport.rs @@ -0,0 +1,370 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::durable_host::schema_value_stream::StoreValueResolver; +use crate::workerctx::WorkerCtx; +use golem_schema::schema::wit::wire::SchemaValueTree; +use golem_schema::schema::wit::{decode_value_with, encode_value_with_streams}; +use golem_schema::schema::{SchemaValue, SchemaValueStream}; +use std::pin::Pin; +use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex}; +use std::task::{Context, Poll}; +use tokio::sync::mpsc; +use wasmtime::StoreContextMut; +use wasmtime::component::{Destination, Source, StreamConsumer, StreamProducer, StreamResult}; + +/// Tracks source endpoints created by one live streaming invocation. The +/// invocation keeps its Store event loop running until every source has +/// reached end-of-stream or the downstream reader has detached. +#[derive(Debug)] +pub(crate) struct LiveStreamTracker { + pub(super) active: AtomicUsize, + changed: tokio::sync::Notify, + cancelled: tokio_util::sync::CancellationToken, +} + +impl LiveStreamTracker { + pub(crate) fn new(cancelled: tokio_util::sync::CancellationToken) -> Self { + Self { + active: AtomicUsize::new(0), + changed: tokio::sync::Notify::new(), + cancelled, + } + } + + fn add_source(&self) { + self.active.fetch_add(1, Ordering::AcqRel); + self.changed.notify_waiters(); + } + + fn source_finished(&self) { + let previous = self.active.fetch_sub(1, Ordering::AcqRel); + debug_assert!(previous > 0, "live stream source count underflow"); + self.changed.notify_waiters(); + } + + pub(crate) async fn wait_for_sources(&self) { + loop { + let changed = self.changed.notified(); + if self.active.load(Ordering::Acquire) == 0 { + return; + } + changed.await; + } + } + + async fn cancelled(&self) { + self.cancelled.cancelled().await; + } + + pub(crate) fn cancellation_token(&self) -> tokio_util::sync::CancellationToken { + self.cancelled.clone() + } +} + +#[derive(Debug, Default)] +pub(super) struct SourceLifecycle { + pub(super) finished: AtomicBool, + finished_notify: tokio::sync::Notify, + trackers: Mutex>>, + cancelled: tokio_util::sync::CancellationToken, +} + +impl SourceLifecycle { + fn attach(self: &Arc, tracker: Arc) { + let mut trackers = self + .trackers + .lock() + .expect("stream lifecycle mutex poisoned"); + if self.finished.load(Ordering::Acquire) + || trackers + .iter() + .any(|current| Arc::ptr_eq(current, &tracker)) + { + return; + } + tracker.add_source(); + trackers.push(tracker.clone()); + let lifecycle = self.clone(); + tokio::spawn(async move { + tokio::select! { + _ = tracker.cancelled() => { + lifecycle.cancelled.cancel(); + lifecycle.finish(); + } + _ = lifecycle.wait_finished() => {} + } + }); + } + + async fn wait_finished(&self) { + loop { + let finished = self.finished_notify.notified(); + if self.finished.load(Ordering::Acquire) { + return; + } + finished.await; + } + } + + fn finish(&self) { + if self.finished.swap(true, Ordering::AcqRel) { + return; + } + self.finished_notify.notify_waiters(); + let trackers = std::mem::take( + &mut *self + .trackers + .lock() + .expect("stream lifecycle mutex poisoned"), + ); + for tracker in trackers { + tracker.source_finished(); + } + } +} + +pub(super) struct RelayReceiver { + pub(super) demand_tx: mpsc::Sender<()>, + pub(super) item_rx: mpsc::Receiver>, + lifecycle: Arc, +} + +impl RelayReceiver { + pub(super) fn attach(&self, tracker: Arc) { + self.lifecycle.attach(tracker); + } + + pub(super) async fn next(&mut self) -> Result, String> { + tokio::select! { + result = self.demand_tx.send(()) => { + if result.is_err() { + return match self.item_rx.recv().await { + Some(Ok(value)) => Ok(Some(value)), + Some(Err(error)) => Err(error), + None => Ok(None), + }; + } + } + _ = self.lifecycle.cancelled.cancelled() => { + self.lifecycle.finish(); + return Err("live streaming invocation was cancelled".to_string()); + } + } + tokio::select! { + item = self.item_rx.recv() => match item { + Some(Ok(value)) => Ok(Some(value)), + Some(Err(error)) => Err(error), + None => Ok(None), + }, + _ = self.lifecycle.cancelled.cancelled() => { + self.lifecycle.finish(); + Err("live streaming invocation was cancelled".to_string()) + } + } + } +} + +impl Drop for RelayReceiver { + fn drop(&mut self) { + self.lifecycle.finish(); + } +} + +pub(super) struct RelayConsumer { + demand_rx: mpsc::Receiver<()>, + item_tx: mpsc::Sender>, + lifecycle: Arc, + has_demand: bool, +} + +pub(super) struct RelayPeer { + pub(super) demand_rx: mpsc::Receiver<()>, + pub(super) item_tx: mpsc::Sender>, + pub(super) lifecycle: Arc, +} + +impl Drop for RelayConsumer { + fn drop(&mut self) { + self.lifecycle.finish(); + } +} + +pub(super) fn relay_pair( + tracker: Option>, +) -> (RelayConsumer, SchemaValueStream) { + let (peer, stream) = relay_endpoint_pair(tracker); + ( + RelayConsumer { + demand_rx: peer.demand_rx, + item_tx: peer.item_tx, + lifecycle: peer.lifecycle, + has_demand: false, + }, + stream, + ) +} + +pub(super) fn relay_endpoint_pair( + tracker: Option>, +) -> (RelayPeer, SchemaValueStream) { + let (demand_tx, demand_rx) = mpsc::channel(1); + let (item_tx, item_rx) = mpsc::channel(1); + let lifecycle = Arc::new(SourceLifecycle::default()); + if let Some(tracker) = tracker { + lifecycle.attach(tracker); + } + let receiver = RelayReceiver { + demand_tx, + item_rx, + lifecycle: lifecycle.clone(), + }; + ( + RelayPeer { + demand_rx, + item_tx, + lifecycle: lifecycle.clone(), + }, + SchemaValueStream::from_host_endpoint(receiver), + ) +} + +impl StreamConsumer for RelayConsumer { + type Item = SchemaValueTree; + + fn poll_consume( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + mut store: StoreContextMut, + mut source: Source<'_, Self::Item>, + finish: bool, + ) -> Poll> { + if finish || self.item_tx.is_closed() { + self.lifecycle.finish(); + return Poll::Ready(Ok(if finish { + StreamResult::Cancelled + } else { + StreamResult::Dropped + })); + } + + if !self.has_demand { + match self.demand_rx.poll_recv(cx) { + Poll::Pending => return Poll::Pending, + Poll::Ready(Some(())) => self.has_demand = true, + Poll::Ready(None) => { + self.lifecycle.finish(); + return Poll::Ready(Ok(StreamResult::Dropped)); + } + } + } + + let mut item = None; + source.read(&mut store, &mut item)?; + let Some(item) = item else { + return Poll::Ready(Ok(StreamResult::Completed)); + }; + + let decoded = { + let mut resolver = StoreValueResolver::new(&mut store); + decode_value_with(item, &mut resolver).map_err(|error| error.to_string()) + }; + self.has_demand = false; + match self.item_tx.try_send(decoded) { + Ok(()) => Poll::Ready(Ok(StreamResult::Completed)), + Err(mpsc::error::TrySendError::Closed(_)) => { + self.lifecycle.finish(); + Poll::Ready(Ok(StreamResult::Dropped)) + } + Err(mpsc::error::TrySendError::Full(_)) => Poll::Ready(Err(wasmtime::Error::msg( + "schema value stream relay accepted an item without matching demand", + ))), + } + } +} + +pub(super) struct RelayProducer { + receiver: RelayReceiver, + demand_pending: bool, + finished: bool, +} + +impl RelayProducer { + pub(super) fn new(receiver: RelayReceiver) -> Self { + Self { + receiver, + demand_pending: false, + finished: false, + } + } +} + +impl StreamProducer for RelayProducer { + type Item = SchemaValueTree; + type Buffer = Option; + + fn poll_produce<'a>( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + mut store: StoreContextMut<'a, Ctx>, + mut destination: Destination<'a, Self::Item, Self::Buffer>, + finish: bool, + ) -> Poll> { + if self.finished { + return Poll::Ready(Ok(StreamResult::Dropped)); + } + if finish { + self.finished = true; + self.receiver.lifecycle.finish(); + return Poll::Ready(Ok(StreamResult::Cancelled)); + } + + if !self.demand_pending { + match self.receiver.demand_tx.try_send(()) { + Ok(()) => self.demand_pending = true, + Err(mpsc::error::TrySendError::Closed(_)) => { + self.finished = true; + self.receiver.lifecycle.finish(); + return Poll::Ready(Ok(StreamResult::Dropped)); + } + Err(mpsc::error::TrySendError::Full(_)) => self.demand_pending = true, + } + } + + match self.receiver.item_rx.poll_recv(cx) { + Poll::Pending => Poll::Pending, + Poll::Ready(None) => { + self.finished = true; + self.receiver.lifecycle.finish(); + Poll::Ready(Ok(StreamResult::Dropped)) + } + Poll::Ready(Some(Err(error))) => { + self.finished = true; + self.receiver.lifecycle.finish(); + Poll::Ready(Err(wasmtime::Error::msg(error))) + } + Poll::Ready(Some(Ok(value))) => { + self.demand_pending = false; + let encoded = { + let mut resolver = StoreValueResolver::new(&mut store); + encode_value_with_streams(&value, &mut resolver) + .map_err(|error| wasmtime::Error::msg(error.to_string()))? + }; + destination.set_buffer(Some(encoded)); + Poll::Ready(Ok(StreamResult::Completed)) + } + } + } +} diff --git a/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs b/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs index 8bd8c88ec9..c0809de002 100644 --- a/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs +++ b/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs @@ -60,10 +60,11 @@ use golem_common::schema::schema_value::SchemaValue; use golem_common::serialization::{deserialize, serialize}; use golem_common::tracing::TraceOrigin; use golem_schema::schema::wit::{ - EncodeError, decode_typed_rejecting_quota_with, decode_value_with, encode_value_with, + EncodeError, decode_typed_rejecting_quota_with, decode_value_with, encode_value_with_streams, }; use crate::durable_host::golem::agent::schema_value_tree_to_typed_constructor_parameters; +use crate::worker::invocation::method_uses_streams; use golem_schema::schema::wit::wire as core_wire; use std::any::Any; use std::fmt::{Debug, Formatter}; @@ -256,6 +257,19 @@ impl HostWasmRpc for DurableWorkerCtx { let mut logical_remote_agent_id = OwnedAgentId::new(self.owned_agent_id.environment_id, &logical_remote_agent_id); + if self.is_live_streaming_invocation() { + return construct_ephemeral_wasm_rpc_resource( + self, + logical_remote_agent_id, + logical_agent_id, + env, + config, + span, + remote_agent_type, + component_revision, + ); + } + let mut handle = CallHandle::::start( self, HostRequestGolemRpcCreate { @@ -306,6 +320,19 @@ impl HostWasmRpc for DurableWorkerCtx { ); } + if self.is_live_streaming_invocation() { + return construct_live_wasm_rpc_resource( + self, + remote_agent_id, + &env, + config, + span, + remote_agent_type, + component_revision, + ) + .await; + } + let handle = CallHandle::::start( self, HostRequestGolemRpcCreate { @@ -377,6 +404,46 @@ impl HostWasmRpc for DurableWorkerCtx { Err(err) => return Ok(Err(err)), }; + if prepared.is_streaming() { + if !self.state.is_live() { + return Ok(Err(RpcError::ProtocolError( + "live streaming invocation cannot be replayed".to_string(), + ))); + } + let idempotency_key = IdempotencyKey::fresh(); + let remote_agent_id = invocation_target_agent_id( + &prepared.logical_remote_agent_id, + prepared.ephemeral_logical_agent_id.as_ref(), + &idempotency_key, + )?; + let metadata = invocation_metadata(&remote_agent_id, &idempotency_key); + if !prepared.is_ephemeral() { + ensure_rpc_target_activated(self, self_).await?; + } + let result = self + .rpc() + .invoke_and_await_streaming( + &remote_agent_id, + Some(idempotency_key), + prepared.method_name, + prepared.input_value, + self.created_by(), + &self.agent_id().clone(), + &prepared.env, + self.clone_as_inherited_stack(&prepared.connection_span_id), + prepared.config, + &self.agent_auth_ctx(), + ) + .await; + return match result { + Ok(value) => Ok(Ok(InvocationResultWithMetadata { + metadata, + result: schema_value_to_wire_output(&value, self)?, + })), + Err(error) => Ok(Err(error.into())), + }; + } + let begun = CallHandle::::begin( self, DurableFunctionType::WriteRemote, @@ -445,6 +512,12 @@ impl HostWasmRpc for DurableWorkerCtx { Err(err) => return Ok(Err(err)), }; + if prepared.is_streaming() { + return Ok(Err(RpcError::ProtocolError( + "live streams require invoke-and-await".to_string(), + ))); + } + let begun = CallHandle::::begin( self, DurableFunctionType::WriteRemote, @@ -584,6 +657,77 @@ impl HostWasmRpc for DurableWorkerCtx { }); } }; + let method = find_agent_method(&remote_agent_type, &method_name)?; + if method_uses_streams(&remote_agent_type, method, &input_value) { + if !self.state.is_live() { + let oplog_index = self.state.oplog.current_oplog_index().await; + let idempotency_key = self.derive_idempotency_key(oplog_index); + let remote_agent_id = invocation_target_agent_id( + &logical_remote_agent_id, + ephemeral_logical_agent_id.as_ref(), + &idempotency_key, + )?; + let metadata = invocation_metadata(&remote_agent_id, &idempotency_key); + let span = create_invocation_span( + self, + &connection_span_id, + &method_name, + &idempotency_key, + ) + .await?; + let fut = self.table().push(FutureInvokeResultEntry { + payload: Box::new(FutureInvokeResultState::Baked { + result: Ok(Err(InternalRpcError::ProtocolError { + details: "live streaming invocation cannot be replayed".to_string(), + })), + span_id: span.span_id().clone(), + }), + child_pollables: Vec::new(), + drop_pending: false, + })?; + return Ok(AsyncInvocationWithMetadata { + future: fut, + metadata, + }); + } + + let idempotency_key = IdempotencyKey::fresh(); + let remote_agent_id = invocation_target_agent_id( + &logical_remote_agent_id, + ephemeral_logical_agent_id.as_ref(), + &idempotency_key, + )?; + let metadata = invocation_metadata(&remote_agent_id, &idempotency_key); + let span = + create_invocation_span(self, &connection_span_id, &method_name, &idempotency_key) + .await?; + if ephemeral_logical_agent_id.is_none() { + ensure_rpc_target_activated(self, this).await?; + } + let task = spawn_streaming_invoke_and_await_task( + self, + remote_agent_id, + idempotency_key, + method_name, + input_value, + env, + config, + span.span_id(), + ); + let fut = self.table().push(FutureInvokeResultEntry { + payload: Box::new(FutureInvokeResultState::Live { + task: Some(Arc::new(tokio::sync::Mutex::new(task))), + span_id: span.span_id().clone(), + cancel_token: tokio_util::sync::CancellationToken::new(), + }), + child_pollables: Vec::new(), + drop_pending: false, + })?; + return Ok(AsyncInvocationWithMetadata { + future: fut, + metadata, + }); + } // Open the single durable host call for this async RPC as a `WriteRemote` — the same // durable function type as the synchronous `invoke_and_await`. It is a two-step call: @@ -818,7 +962,12 @@ impl DurableWorkerCtx { // invocation. let input_value = decode_value_with(input, self) .map_err(|err| anyhow::anyhow!("Invalid RPC input: {err}"))?; - find_agent_method(&remote_agent_type, &method_name)?; + let method = find_agent_method(&remote_agent_type, &method_name)?; + if method_uses_streams(&remote_agent_type, method, &input_value) { + return Err(anyhow::anyhow!( + "live streams cannot be used in scheduled invocations" + )); + } let scheduled_at = chrono::DateTime::from_timestamp(datetime.seconds, datetime.nanoseconds) .ok_or_else(|| { anyhow::Error::from(WorkerExecutorError::runtime(format!( @@ -981,6 +1130,7 @@ struct PreparedRpcInvocation { config: Vec, method_name: String, input_value: SchemaValue, + streaming: bool, } impl PreparedRpcInvocation { @@ -1002,6 +1152,10 @@ impl PreparedRpcInvocation { fn is_ephemeral(&self) -> bool { self.ephemeral_logical_agent_id.is_some() } + + fn is_streaming(&self) -> bool { + self.streaming + } } fn prepare_rpc_invocation( @@ -1046,6 +1200,12 @@ fn prepare_rpc_invocation( Ok(input_value) => input_value, Err(err) => return Ok(Err(err.into())), }; + let method = remote_agent_type + .methods + .iter() + .find(|method| method.name == method_name) + .expect("method existence was checked while decoding RPC input"); + let streaming = method_uses_streams(&remote_agent_type, method, &input_value); if ephemeral_logical_agent_id.is_none() && logical_remote_agent_id == own_agent_id { return Err(anyhow::anyhow!( @@ -1061,6 +1221,7 @@ fn prepare_rpc_invocation( config, method_name, input_value, + streaming, })) } @@ -1334,20 +1495,21 @@ async fn finish_span_access( accessor: &Accessor>>, span_id: &SpanId, ) -> Result<(), WorkerExecutorError> { - let (is_live, worker, replay_state) = accessor.with(|mut access| { + let (is_live, is_unpersisted_execution, worker, replay_state) = accessor.with(|mut access| { let ctx = access.get(); ( ctx.state.is_live(), + ctx.is_unpersisted_execution(), ctx.public_state.worker(), ctx.state.replay_state.clone(), ) }); - if is_live { + if is_live && !is_unpersisted_execution { worker .add_to_oplog(OplogEntry::finish_span(span_id.clone())) .await; - } else { + } else if !is_live { crate::get_oplog_entry_owned!(replay_state, OplogEntry::FinishSpan)?; } @@ -1472,6 +1634,13 @@ impl HostFutureInvokeResultWithStore span_id: SpanId, cancel_token: tokio_util::sync::CancellationToken, }, + /// A non-durable live session. No call handle or replay data exists; `get` only awaits + /// the result head and lowers it into the current Store. + Live { + task: FutureInvokeTaskHandle, + span_id: SpanId, + cancel_token: tokio_util::sync::CancellationToken, + }, } let plan = accessor.with(|mut access| { @@ -1547,6 +1716,17 @@ impl HostFutureInvokeResultWithStore cancel_token: cancel_token.clone(), } } + FutureInvokeResultState::Live { + task, + span_id, + cancel_token, + } => GetPlan::Live { + task: task + .take() + .ok_or_else(|| anyhow::anyhow!("future-invoke-result already consumed"))?, + span_id: span_id.clone(), + cancel_token: cancel_token.clone(), + }, }) })?; @@ -1561,6 +1741,48 @@ impl HostFutureInvokeResultWithStore } result } + GetPlan::Live { + task, + span_id, + cancel_token, + } => { + let task_result = { + let mut guard = task.lock().await; + tokio::select! { + biased; + _ = cancel_token.cancelled() => None, + result = &mut *guard => Some(result), + } + }; + let result = match task_result { + Some(result) => accessor.with(|mut access| { + future_invoke_get_result_to_wire( + future_invoke_task_result_to_get_result(&result), + access.get(), + ) + }), + None => Ok(Err(RpcError::ProtocolError( + "Invocation cancelled".to_string(), + ))), + }; + finish_span_access(accessor, &span_id).await?; + accessor.with(|mut access| { + let ctx = access.get(); + let entry = ctx + .table() + .get_mut(&Resource::::new_borrow(this_rep))?; + let state = entry + .payload + .as_any_mut() + .downcast_mut::() + .unwrap(); + *state = FutureInvokeResultState::Consumed { + span_id: span_id.clone(), + }; + Ok::<_, anyhow::Error>(()) + })?; + result + } GetPlan::Active { mut handle, task, @@ -1825,6 +2047,17 @@ impl HostFutureInvokeResultWithStore FutureInvokeResultState::Baked { span_id, .. } => DropPlan::FinishSpan { span_id: span_id.clone(), }, + FutureInvokeResultState::Live { + task, + span_id, + cancel_token, + } => { + task.take(); + cancel_token.cancel(); + DropPlan::FinishSpan { + span_id: span_id.clone(), + } + } FutureInvokeResultState::Cancelled { .. } | FutureInvokeResultState::Consumed { .. } => DropPlan::Nothing, }) @@ -1885,6 +2118,8 @@ impl HostFutureInvokeResult for DurableWorkerCtx { idempotency_key: IdempotencyKey, span_id: SpanId, }, + /// A non-durable live session only needs its invocation span closed. + FinishSpan { span_id: SpanId }, /// Nothing to cancel: a baked failure, or already cancelled / consumed. Nothing, } @@ -1927,35 +2162,58 @@ impl HostFutureInvokeResult for DurableWorkerCtx { CancelPlan::Nothing } }, + FutureInvokeResultState::Live { + task, + span_id, + cancel_token, + } => { + if task.take().is_some() { + let span_id = span_id.clone(); + *state = FutureInvokeResultState::Cancelled { + span_id: span_id.clone(), + }; + CancelPlan::FinishSpan { span_id } + } else { + cancel_token.cancel(); + CancelPlan::Nothing + } + } FutureInvokeResultState::Baked { .. } | FutureInvokeResultState::Cancelled { .. } | FutureInvokeResultState::Consumed { .. } => CancelPlan::Nothing, } }; - if let CancelPlan::Cancel { - handle, - remote_agent_id, - idempotency_key, - span_id, - } = plan - { - // Best-effort remote cancellation, only meaningful for a live call — on replay the - // recorded `Cancelled` is re-applied without re-issuing the side effect. - if handle.is_live() - && let Err(err) = self - .worker_proxy() - .cancel_invocation(&remote_agent_id, idempotency_key, &self.agent_auth_ctx()) + match plan { + CancelPlan::Cancel { + handle, + remote_agent_id, + idempotency_key, + span_id, + } => { + // Best-effort remote cancellation, only meaningful for a live call — on replay the + // recorded `Cancelled` is re-applied without re-issuing the side effect. + if handle.is_live() + && let Err(err) = self + .worker_proxy() + .cancel_invocation( + &remote_agent_id, + idempotency_key, + &self.agent_auth_ctx(), + ) + .await + { + tracing::info!(err=%err, "Best-effort cancel_invocation failed"); + } + + handle + .cancel(self, None) .await - { - tracing::info!(err=%err, "Best-effort cancel_invocation failed"); + .map_err(anyhow::Error::from)?; + self.finish_span(&span_id).await?; } - - handle - .cancel(self, None) - .await - .map_err(anyhow::Error::from)?; - self.finish_span(&span_id).await?; + CancelPlan::FinishSpan { span_id } => self.finish_span(&span_id).await?, + CancelPlan::Nothing => {} } Ok(()) @@ -2010,22 +2268,6 @@ impl HostCancellationToken for DurableWorkerCtx { } } -impl core_wire::Host for DurableWorkerCtx { - async fn parse_uuid( - &mut self, - uuid: String, - ) -> anyhow::Result> { - Ok(uuid::Uuid::parse_str(&uuid) - .map(|uuid| uuid.into()) - .map_err(|e| e.to_string())) - } - - async fn uuid_to_string(&mut self, uuid: core_wire::Uuid) -> anyhow::Result { - let uuid: uuid::Uuid = uuid.into(); - Ok(uuid.to_string()) - } -} - fn construct_ephemeral_wasm_rpc_resource( ctx: &mut DurableWorkerCtx, remote_agent_id: OwnedAgentId, @@ -2069,6 +2311,51 @@ fn invocation_target_agent_id( )) } +async fn construct_live_wasm_rpc_resource( + ctx: &mut DurableWorkerCtx, + remote_agent_id: AgentId, + env: &[(String, String)], + config: Vec, + span: Arc, + remote_agent_type: Arc, + remote_component_revision: ComponentRevision, +) -> anyhow::Result> { + let stack = ctx.clone_as_inherited_stack(span.span_id()); + let target_component = ctx + .component_service() + .get_metadata(remote_agent_id.component_id, None) + .await?; + let remote_agent_id = OwnedAgentId::new(target_component.environment_id, &remote_agent_id); + let demand = ctx + .rpc() + .create_demand( + &remote_agent_id, + ctx.created_by(), + ctx.agent_id(), + env, + stack, + config.clone(), + &ctx.agent_auth_ctx(), + ) + .await?; + let target_fingerprint = demand.fingerprint(); + Ok(ctx.table().push(WasmRpcEntry { + payload: Box::new(WasmRpcEntryPayload { + remote_agent_id, + ephemeral_logical_agent_id: None, + span_id: span.span_id().clone(), + target_activation: WasmRpcTargetActivation::Activated { + demand, + target_fingerprint, + env: env.to_vec(), + config, + }, + remote_agent_type, + remote_component_revision, + }), + })?) +} + pub async fn construct_wasm_rpc_resource( ctx: &mut DurableWorkerCtx, mut handle: CallHandle, @@ -2277,6 +2564,7 @@ struct TaskRetryParams { runtime_retry_policy_mutations: std::collections::BTreeMap>, retry_properties: RetryProperties, max_in_function_retry_delay: Duration, + is_unpersisted_execution: bool, worker: Arc>, retry_point: OplogIndex, execution_status: Arc>, @@ -2447,6 +2735,7 @@ fn spawn_rpc_task_with_retry( max_in_function_retry_delay: retry_params.max_in_function_retry_delay, current_retry_policy_state, retry_properties: retry_params.retry_properties, + is_unpersisted_execution: retry_params.is_unpersisted_execution, worker: retry_params.worker, }; crate::durable_host::durability::in_task_retry_loop( @@ -2501,6 +2790,7 @@ fn spawn_invoke_and_await_task( runtime_retry_policy_mutations: ctx.state.runtime_retry_policy_mutations.clone(), retry_properties, max_in_function_retry_delay: ctx.durable_execution_state().max_in_function_retry_delay, + is_unpersisted_execution: ctx.is_unpersisted_execution(), worker: ctx.public_state.worker(), retry_point, execution_status: ctx.execution_status.clone(), @@ -2524,6 +2814,39 @@ fn spawn_invoke_and_await_task( ) } +fn spawn_streaming_invoke_and_await_task( + ctx: &mut DurableWorkerCtx, + remote_agent_id: OwnedAgentId, + idempotency_key: IdempotencyKey, + method_name: String, + input: SchemaValue, + env: Vec<(String, String)>, + config: Vec, + span_id: &SpanId, +) -> AbortOnDropJoinHandle { + let rpc = ctx.rpc(); + let created_by = ctx.created_by(); + let agent_id = ctx.agent_id().clone(); + let stack = ctx.clone_as_inherited_stack(span_id); + let auth_ctx = ctx.agent_auth_ctx(); + wasmtime_wasi::runtime::spawn(async move { + Ok(rpc + .invoke_and_await_streaming( + &remote_agent_id, + Some(idempotency_key), + method_name, + input, + created_by, + &agent_id, + &env, + stack, + config, + &auth_ctx, + ) + .await) + }) +} + pub struct WasmRpcEntryPayload { pub remote_agent_id: OwnedAgentId, pub ephemeral_logical_agent_id: Option, @@ -2686,7 +3009,7 @@ fn schema_value_to_wire_output( ) -> Result, EncodeError> { match value { SchemaValue::Tuple { elements } if elements.is_empty() => Ok(None), - value => Ok(Some(encode_value_with(value, resolver)?)), + value => Ok(Some(encode_value_with_streams(value, resolver)?)), } } @@ -2769,6 +3092,14 @@ enum FutureInvokeResultState { span_id: SpanId, cancel_token: tokio_util::sync::CancellationToken, }, + /// A stream-bearing invocation is intentionally outside the oplog. The task owns the live + /// session until `get` takes it, while `cancel_token` lets a concurrent `cancel` stop an + /// in-flight `get` without serializing either the input or output value tree. + Live { + task: Option, + span_id: SpanId, + cancel_token: tokio_util::sync::CancellationToken, + }, /// Method resolution / input lifting failed deterministically before any host call was opened, /// so no `Start` / `End` is written for this future. `get` surfaces the baked error and finishes /// the span. Live and replay agree because the failure is a pure function of the cached remote @@ -2788,6 +3119,7 @@ impl Debug for FutureInvokeResultState { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { Self::Active { .. } => write!(f, "Active"), + Self::Live { .. } => write!(f, "Live"), Self::Baked { .. } => write!(f, "Baked"), Self::Cancelled { .. } => write!(f, "Cancelled"), Self::Consumed { .. } => write!(f, "Consumed"), diff --git a/golem-worker-executor/src/grpc/invocation.rs b/golem-worker-executor/src/grpc/invocation.rs index 80230bf6d4..4ab365bbfb 100644 --- a/golem-worker-executor/src/grpc/invocation.rs +++ b/golem-worker-executor/src/grpc/invocation.rs @@ -174,9 +174,7 @@ impl ProtobufInvocationDetails } } -impl ProtobufInvocationDetails - for golem_api_grpc::proto::golem::workerexecutor::v1::InvokeAgentRequest -{ +impl ProtobufInvocationDetails for golem_api_grpc::proto::golem::worker::InvocationStart { fn proto_agent_id(&self) -> &Option { &self.agent_id } @@ -222,7 +220,7 @@ mod tests { #[test] fn invoke_agent_request_decodes_creation_config() { - let request = golem_api_grpc::proto::golem::workerexecutor::v1::InvokeAgentRequest { + let request = golem_api_grpc::proto::golem::worker::InvocationStart { config: vec![golem_api_grpc::proto::golem::worker::AgentConfigEntryDto { path: vec!["database".into(), "port".into()], value: "5432".into(), @@ -238,7 +236,7 @@ mod tests { #[test] fn invoke_agent_request_rejects_invalid_creation_config_json() { - let request = golem_api_grpc::proto::golem::workerexecutor::v1::InvokeAgentRequest { + let request = golem_api_grpc::proto::golem::worker::InvocationStart { config: vec![golem_api_grpc::proto::golem::worker::AgentConfigEntryDto { path: vec!["database".into(), "port".into()], value: "not-json".into(), diff --git a/golem-worker-executor/src/grpc/invocation_session.rs b/golem-worker-executor/src/grpc/invocation_session.rs new file mode 100644 index 0000000000..50f9efc2da --- /dev/null +++ b/golem-worker-executor/src/grpc/invocation_session.rs @@ -0,0 +1,742 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use super::{WorkerExecutorImpl, extract_owned_agent_id}; +use crate::durable_host::stream_session::LiveValueSession; +use crate::grpc::invocation::{CanStartWorker, from_proto_invocation_context}; +use crate::services::{HasAll, HasComponentService, HasSchedulerService, UsesAllDeps}; +use crate::worker::Worker; +use crate::worker::invocation::agent_method_uses_streams; +use crate::workerctx::WorkerCtx; +use chrono::{DateTime, Utc}; +use futures::{Stream, StreamExt}; +use golem_api_grpc::proto::golem; +use golem_api_grpc::proto::golem::worker::{ + InvocationFrame, InvocationProtocolFailure, InvocationResult, InvocationSessionFinished, + InvocationStart, invocation_cancel, invocation_frame, invocation_protocol_failure, + invocation_result, invocation_session_finished, +}; +use golem_api_grpc::{expect_invocation_start, validate_invocation_request_tail}; +use golem_common::model::account::AccountId; +use golem_common::model::agent::{ + AgentMode, InvocationFreshnessDisposition, ParsedAgentId, Principal, +}; +use golem_common::model::{ + AgentId, AgentInvocation, AgentInvocationOutput, AgentInvocationResult, IdempotencyKey, + InvocationStatus, ScheduledAction, +}; +use golem_common::schema::SchemaValue; +use golem_service_base::error::worker_executor::WorkerExecutorError; +use std::pin::Pin; +use tokio::sync::mpsc; +use tokio_stream::wrappers::ReceiverStream; +use tonic::{Request, Response, Status}; + +pub(super) type InvocationSessionStream = + Pin> + Send + 'static>>; + +pub(super) async fn invoke_agent_session< + Ctx: WorkerCtx, + Svcs: HasAll + UsesAllDeps + Send + Sync + 'static, +>( + executor: &WorkerExecutorImpl, + request: Request>, +) -> Result, Status> { + let inbound = request.into_inner(); + let (frames, receiver) = mpsc::channel(32); + let executor = (*executor).clone(); + tokio::spawn(async move { + executor.run_agent_session(inbound, frames).await; + }); + Ok(Response::new(Box::pin( + ReceiverStream::new(receiver).map(Ok), + ))) +} + +fn decode_invocation_freshness_disposition(value: i32) -> InvocationFreshnessDisposition { + if value == golem::worker::InvocationFreshnessDisposition::KnownFresh as i32 { + InvocationFreshnessDisposition::KnownFresh + } else { + InvocationFreshnessDisposition::MayExist + } +} + +impl + UsesAllDeps + Send + Sync + 'static> + WorkerExecutorImpl +{ + async fn invoke_agent_internal( + &self, + request: &InvocationStart, + method_parameters: Option, + cancellation: tokio_util::sync::CancellationToken, + ) -> Result { + Self::validate_auth_ctx(&request.auth_ctx)?; + + let freshness_disposition = + decode_invocation_freshness_disposition(request.freshness_disposition); + + let idempotency_key: Option = + request.idempotency_key.clone().map(|k| k.into()); + + if freshness_disposition == InvocationFreshnessDisposition::KnownFresh + && idempotency_key.is_none() + { + return Err(WorkerExecutorError::invalid_request( + "KnownFresh requires an idempotency key", + )); + } + + let mode = request.mode(); + + let ik = idempotency_key.unwrap_or(IdempotencyKey::fresh()); + let final_agent_id: AgentId = request + .agent_id + .clone() + .ok_or(WorkerExecutorError::invalid_request("agent_id not found"))? + .try_into() + .map_err(WorkerExecutorError::invalid_request)?; + + if matches!( + mode, + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup + ) { + if freshness_disposition == InvocationFreshnessDisposition::KnownFresh { + return Err(WorkerExecutorError::invalid_request( + "KnownFresh cannot be used for an invocation lookup", + )); + } + let inv_status = match self.get_or_create_pending_for_lookup(request).await? { + Some(worker) => match worker.lookup_invocation_result(&ik).await { + crate::model::LookupResult::Complete(Ok(_)) => InvocationStatus::Complete, + crate::model::LookupResult::Complete(Err(err)) => return Err(err), + crate::model::LookupResult::Pending => InvocationStatus::Pending, + crate::model::LookupResult::New | crate::model::LookupResult::Interrupted => { + InvocationStatus::Unknown + } + }, + None => InvocationStatus::Unknown, + }; + return Ok(AgentInvocationOutput { + result: AgentInvocationResult::AgentInitialization, + consumed_fuel: None, + invocation_status: Some(inv_status), + component_revision: None, + agent_id: Some(final_agent_id), + idempotency_key: Some(ik), + oplog_index: None, + agent_fingerprint: None, + }); + } + + let method_name = + request + .method_name + .clone() + .ok_or(WorkerExecutorError::invalid_request( + "method_name is required for non-lookup invocations", + ))?; + + let method_parameters = method_parameters.ok_or(WorkerExecutorError::invalid_request( + "input is required for non-lookup invocations", + ))?; + + let schedule_at: Option> = request + .schedule_at + .as_ref() + .and_then(|ts| DateTime::from_timestamp(ts.seconds, ts.nanos as u32)); + + let account_id: AccountId = request + .component_owner_account_id + .ok_or(WorkerExecutorError::invalid_request("account_id not found"))? + .try_into() + .map_err(|e| { + WorkerExecutorError::invalid_request(format!("Invalid account id: {e}")) + })?; + + let owned_agent_id = + extract_owned_agent_id(request, |r| &r.agent_id, |r| &r.environment_id)?; + + Worker::::validate_invocation_freshness( + self, + &owned_agent_id, + &ik, + freshness_disposition, + ) + .await?; + + let principal: Principal = request + .principal + .clone() + .map(|p| p.try_into()) + .transpose() + .map_err(|e: String| { + WorkerExecutorError::invalid_request(format!("failed converting principal: {e}")) + })? + .unwrap_or_else(Principal::anonymous); + + let invocation_context = self + .limit_invocation_context_stack_depth(from_proto_invocation_context(&request.context)); + let worker_creation_principal = principal.clone(); + + let invocation = AgentInvocation::AgentMethod { + idempotency_key: ik.clone(), + method_name: method_name.clone(), + input: method_parameters.clone(), + invocation_context, + principal, + }; + + match mode { + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await => { + let worker = self + .get_or_create_pending_with_freshness(request, freshness_disposition) + .await?; + let component_revision = worker.get_last_known_status().await.component_revision; + let component = self + .component_service() + .get_metadata(owned_agent_id.component_id(), Some(component_revision)) + .await?; + let parsed_agent_id = + ParsedAgentId::parse(&owned_agent_id.agent_id.agent_id, &component.metadata) + .map_err(WorkerExecutorError::invalid_request)?; + let streaming = agent_method_uses_streams( + &component.metadata, + Some(&parsed_agent_id), + &method_name, + &method_parameters, + )?; + let mut invocation_output = if streaming { + let fingerprint = worker.get_initial_worker_metadata().fingerprint; + AgentInvocationOutput { + result: AgentInvocationResult::AgentMethod { + output: worker + .clone() + .invoke_live_streaming(invocation, cancellation) + .await?, + }, + consumed_fuel: None, + invocation_status: None, + component_revision: Some(component.revision), + agent_id: None, + idempotency_key: None, + oplog_index: None, + agent_fingerprint: Some(fingerprint), + } + } else { + worker.invoke_and_await(invocation).await? + }; + invocation_output.agent_id = Some(final_agent_id); + invocation_output.idempotency_key = Some(ik); + Ok(invocation_output) + } + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule => { + match schedule_at { + Some(scheduled_time) => { + let component = self + .component_service() + .get_metadata(owned_agent_id.component_id(), None) + .await?; + let parsed_agent_id = ParsedAgentId::parse( + &owned_agent_id.agent_id.agent_id, + &component.metadata, + ) + .map_err(WorkerExecutorError::invalid_request)?; + let agent_mode = component + .metadata + .find_agent_type_by_name_ref(&parsed_agent_id.agent_type) + .map(|agent_type| agent_type.mode) + .ok_or_else(|| { + WorkerExecutorError::invalid_request( + "Scheduled invocation target is not a registered agent type", + ) + })?; + let action = if agent_mode == AgentMode::Ephemeral { + ScheduledAction::InvokeEphemeral { + account_id, + owned_agent_id, + invocation: Box::new(invocation), + component_revision: component.revision, + env: request.env().unwrap_or_default(), + config: request.config()?, + parent: request.parent(), + creation_principal: Box::new(worker_creation_principal), + } + } else { + let worker = self + .get_or_create_pending_with_freshness( + request, + freshness_disposition, + ) + .await?; + let target_worker_fingerprint = + worker.get_initial_worker_metadata().fingerprint; + ScheduledAction::Invoke { + account_id, + owned_agent_id, + invocation: Box::new(invocation), + target_worker_fingerprint, + } + }; + self.scheduler_service() + .schedule(scheduled_time, action) + .await; + Ok(AgentInvocationOutput { + result: AgentInvocationResult::AgentInitialization, + consumed_fuel: None, + invocation_status: None, + component_revision: None, + agent_id: Some(final_agent_id), + idempotency_key: Some(ik), + oplog_index: None, + agent_fingerprint: None, + }) + } + None => { + let worker = self + .get_or_create_pending_with_freshness(request, freshness_disposition) + .await?; + match worker.clone().invoke(invocation).await? { + crate::worker::ResultOrSubscription::Finished(Err(err)) => { + return Err(err); + } + crate::worker::ResultOrSubscription::Finished(Ok(_)) => {} + crate::worker::ResultOrSubscription::Pending(_) => { + Worker::start_if_needed(worker).await?; + } + } + Ok(AgentInvocationOutput { + result: AgentInvocationResult::AgentInitialization, + consumed_fuel: None, + invocation_status: None, + component_revision: None, + agent_id: Some(final_agent_id), + idempotency_key: Some(ik), + oplog_index: None, + agent_fingerprint: None, + }) + } + } + } + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup => { + unreachable!("Lookup mode handled above") + } + } + } + + async fn run_agent_session( + &self, + mut inbound: tonic::Streaming, + frames: mpsc::Sender, + ) { + let start = match inbound.message().await { + Ok(Some(frame)) => match expect_invocation_start(frame) { + Ok(start) => start, + Err(error) => { + send_protocol_failure( + &frames, + invocation_protocol_failure::Kind::Protocol, + error, + ) + .await; + return; + } + }, + Ok(None) => { + send_protocol_failure( + &frames, + invocation_protocol_failure::Kind::Transport, + "invocation request transport closed before start".to_string(), + ) + .await; + return; + } + Err(error) => { + send_protocol_failure( + &frames, + invocation_protocol_failure::Kind::Transport, + error.to_string(), + ) + .await; + return; + } + }; + + let session = LiveValueSession::new(2, frames.clone()); + let input = + if start.mode() == golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup { + Ok(None) + } else { + match start.input.clone() { + Some(input) => session.decode(input).await.map(Some), + None => Err("invocation start has no input".to_string()), + } + }; + let input = match input { + Ok(input) => input, + Err(error) => { + send_protocol_failure(&frames, invocation_protocol_failure::Kind::Protocol, error) + .await; + session.cancel(); + return; + } + }; + + let cancellation = tokio_util::sync::CancellationToken::new(); + let _cancel_on_drop = cancellation.clone().drop_guard(); + let invocation = self.invoke_agent_internal(&start, input, cancellation); + tokio::pin!(invocation); + let output = loop { + tokio::select! { + result = &mut invocation => break result, + frame = inbound.message() => match frame { + Ok(Some(frame)) => { + if !route_live_request_frame(&session, &frames, frame).await { + return; + } + } + Ok(None) => { + fail_session_transport( + &session, + &frames, + "invocation request transport closed before the result".to_string(), + ) + .await; + return; + } + Err(error) => { + fail_session_transport(&session, &frames, error.to_string()).await; + return; + } + } + } + }; + + let output = match output { + Ok(output) => output, + Err(error) => { + send_worker_failure(&frames, error).await; + session.cancel(); + return; + } + }; + let result = match &output.result { + AgentInvocationResult::AgentMethod { output } => match session.encode(output) { + Ok(output) => Some(invocation_result::Result::MethodResult(output)), + Err(error) => { + send_protocol_failure( + &frames, + invocation_protocol_failure::Kind::Protocol, + error, + ) + .await; + session.cancel(); + return; + } + }, + _ => Some(invocation_result::Result::NoResult(golem::common::Empty {})), + }; + if frames + .send(InvocationFrame { + frame: Some(invocation_frame::Frame::Result(InvocationResult { + result, + fuel_consumed: output.consumed_fuel, + component_revision: output.component_revision.map(|revision| revision.get()), + status: output.invocation_status.map(|status| { + golem_api_grpc::proto::golem::worker::InvocationStatus::from(status) as i32 + }), + oplog_index: output.oplog_index.map(u64::from), + agent_fingerprint: output + .agent_fingerprint + .map(|fingerprint| fingerprint.0.into()), + agent_id: output.agent_id.map(Into::into), + idempotency_key: output.idempotency_key.map(Into::into), + })), + }) + .await + .is_err() + { + session.cancel(); + return; + } + + let idle = session.wait_idle(); + tokio::pin!(idle); + loop { + tokio::select! { + () = &mut idle => { + let _ = frames.send(InvocationFrame { + frame: Some(invocation_frame::Frame::Finished( + InvocationSessionFinished { + outcome: Some(invocation_session_finished::Outcome::Success( + golem::common::Empty {}, + )), + }, + )), + }).await; + return; + } + frame = inbound.message() => match frame { + Ok(Some(frame)) => { + if !route_live_request_frame(&session, &frames, frame).await { + return; + } + } + Ok(None) => { + fail_session_transport( + &session, + &frames, + "invocation request transport closed before completion".to_string(), + ) + .await; + return; + } + Err(error) => { + fail_session_transport(&session, &frames, error.to_string()).await; + return; + } + } + } + } + } +} + +async fn send_protocol_failure( + frames: &mpsc::Sender, + kind: invocation_protocol_failure::Kind, + details: String, +) { + let _ = frames + .send(InvocationFrame { + frame: Some(invocation_frame::Frame::Finished( + InvocationSessionFinished { + outcome: Some(invocation_session_finished::Outcome::ProtocolFailure( + InvocationProtocolFailure { + kind: kind as i32, + details, + }, + )), + }, + )), + }) + .await; +} + +async fn send_worker_failure(frames: &mpsc::Sender, error: WorkerExecutorError) { + let _ = frames + .send(InvocationFrame { + frame: Some(invocation_frame::Frame::Finished( + InvocationSessionFinished { + outcome: Some(invocation_session_finished::Outcome::Failure(error.into())), + }, + )), + }) + .await; +} + +async fn fail_session_transport( + session: &LiveValueSession, + frames: &mpsc::Sender, + details: String, +) { + session.fail(details.clone()); + send_protocol_failure( + frames, + invocation_protocol_failure::Kind::Transport, + details, + ) + .await; +} + +async fn route_live_request_frame( + session: &LiveValueSession, + frames: &mpsc::Sender, + frame: InvocationFrame, +) -> bool { + let frame = match validate_invocation_request_tail(frame) { + Ok(frame) => frame.frame.expect("validated request frame has a payload"), + Err(details) => { + session.fail(details.clone()); + send_protocol_failure(frames, invocation_protocol_failure::Kind::Protocol, details) + .await; + return false; + } + }; + match frame { + invocation_frame::Frame::Cancel(cancel) => { + let kind = match invocation_cancel::Kind::try_from(cancel.kind) { + Ok(kind) => kind, + Err(_) => { + let details = format!("invalid invocation cancellation kind {}", cancel.kind); + session.fail(details.clone()); + send_protocol_failure( + frames, + invocation_protocol_failure::Kind::Protocol, + details, + ) + .await; + return false; + } + }; + match kind { + invocation_cancel::Kind::Semantic => session.cancel(), + invocation_cancel::Kind::Transport => { + let details = cancel + .details + .unwrap_or_else(|| "invocation request transport failed".to_string()); + fail_session_transport(session, frames, details).await; + } + invocation_cancel::Kind::Protocol => { + let details = cancel + .details + .unwrap_or_else(|| "invalid invocation request frame".to_string()); + session.fail(details.clone()); + send_protocol_failure( + frames, + invocation_protocol_failure::Kind::Protocol, + details, + ) + .await; + } + } + false + } + frame => match session.route_stream_frame(frame).await { + Ok(true) => true, + Ok(false) => { + let details = "unexpected frame on invocation request stream".to_string(); + session.fail(details.clone()); + send_protocol_failure(frames, invocation_protocol_failure::Kind::Protocol, details) + .await; + false + } + Err(details) => { + session.fail(details.clone()); + send_protocol_failure(frames, invocation_protocol_failure::Kind::Protocol, details) + .await; + false + } + }, + } +} + +#[cfg(test)] +mod freshness_tests { + use super::decode_invocation_freshness_disposition; + use golem_common::model::agent::InvocationFreshnessDisposition; + use test_r::test; + + #[test] + fn invocation_freshness_defaults_unknown_values_to_may_exist() { + assert_eq!( + decode_invocation_freshness_disposition(0), + InvocationFreshnessDisposition::MayExist + ); + assert_eq!( + decode_invocation_freshness_disposition(i32::MAX), + InvocationFreshnessDisposition::MayExist + ); + } + + #[test] + fn invocation_freshness_decodes_known_fresh_explicitly() { + assert_eq!( + decode_invocation_freshness_disposition( + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::KnownFresh + as i32 + ), + InvocationFreshnessDisposition::KnownFresh + ); + } +} + +#[cfg(test)] +mod protocol_tests { + use super::route_live_request_frame; + use crate::durable_host::stream_session::LiveValueSession; + use golem_api_grpc::invocation_cancel_frame; + use golem_api_grpc::proto::golem::worker::invocation_session_finished::Outcome; + use golem_api_grpc::proto::golem::worker::{ + InvocationSessionFinished, invocation_cancel, invocation_frame, invocation_protocol_failure, + }; + use test_r::test; + use tokio::sync::mpsc; + + #[test] + async fn semantic_cancellation_does_not_report_transport_failure() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(2, frames.clone()); + + assert!( + !route_live_request_frame( + &session, + &frames, + invocation_cancel_frame(invocation_cancel::Kind::Semantic, None), + ) + .await + ); + assert!(frame_rx.try_recv().is_err()); + } + + #[test] + async fn transport_cancellation_reports_typed_failure() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(2, frames.clone()); + + assert!( + !route_live_request_frame( + &session, + &frames, + invocation_cancel_frame( + invocation_cancel::Kind::Transport, + Some("connection lost".to_string()), + ), + ) + .await + ); + let frame = frame_rx.recv().await.unwrap().frame.unwrap(); + assert!(matches!( + frame, + invocation_frame::Frame::Finished(InvocationSessionFinished { + outcome: Some(Outcome::ProtocolFailure(failure)), + }) if failure.kind == invocation_protocol_failure::Kind::Transport as i32 + && failure.details == "connection lost" + )); + } + + #[test] + async fn protocol_cancellation_reports_typed_failure() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(2, frames.clone()); + + assert!( + !route_live_request_frame( + &session, + &frames, + invocation_cancel_frame( + invocation_cancel::Kind::Protocol, + Some("duplicate start".to_string()), + ), + ) + .await + ); + let frame = frame_rx.recv().await.unwrap().frame.unwrap(); + assert!(matches!( + frame, + invocation_frame::Frame::Finished(InvocationSessionFinished { + outcome: Some(Outcome::ProtocolFailure(failure)), + }) if failure.kind == invocation_protocol_failure::Kind::Protocol as i32 + && failure.details == "duplicate start" + )); + } +} diff --git a/golem-worker-executor/src/grpc/mod.rs b/golem-worker-executor/src/grpc/mod.rs index eab184ca95..56ef7c7d01 100644 --- a/golem-worker-executor/src/grpc/mod.rs +++ b/golem-worker-executor/src/grpc/mod.rs @@ -13,6 +13,7 @@ // limitations under the License. mod invocation; +mod invocation_session; use crate::grpc::invocation::{CanStartWorker, from_proto_invocation_context}; use crate::model::event::InternalWorkerEvent; @@ -27,17 +28,15 @@ use crate::services::worker_activator::{ use crate::services::worker_event::WorkerEventReceiver; use crate::services::{ All, HasActiveWorkers, HasAll, HasComponentService, HasEvents, HasOplogService, - HasPromiseService, HasRunningWorkerEnumerationService, HasSchedulerService, - HasShardManagerService, HasShardService, HasWorkerEnumerationService, HasWorkerService, - UsesAllDeps, + HasPromiseService, HasRunningWorkerEnumerationService, HasShardManagerService, HasShardService, + HasWorkerEnumerationService, HasWorkerService, UsesAllDeps, }; use crate::worker::Worker; use crate::workerctx::WorkerCtx; -use chrono::{DateTime, Utc}; use futures::Stream; use futures::StreamExt; use golem_api_grpc::proto::golem; -use golem_api_grpc::proto::golem::worker::{Cursor, UpdateMode}; +use golem_api_grpc::proto::golem::worker::{Cursor, InvocationFrame, UpdateMode}; use golem_api_grpc::proto::golem::workerexecutor::v1::worker_executor_server::WorkerExecutor; use golem_api_grpc::proto::golem::workerexecutor::v1::{ ActivatePluginRequest, ActivatePluginResponse, CancelInvocationRequest, @@ -46,10 +45,9 @@ use golem_api_grpc::proto::golem::workerexecutor::v1::{ GetAgentWalletRequest, GetAgentWalletResponse, GetAgentWalletSuccess, GetFileContentsRequest, GetFileContentsResponse, GetFileSystemNodeRequest, GetFileSystemNodeResponse, GetOplogRequest, GetOplogResponse, GetRunningWorkersMetadataRequest, GetRunningWorkersMetadataResponse, - GetWorkersMetadataRequest, GetWorkersMetadataResponse, InvokeAgentRequest, InvokeAgentResponse, - ProcessOplogEntriesRequest, ProcessOplogEntriesResponse, RevertWorkerRequest, - RevertWorkerResponse, SearchOplogRequest, SearchOplogResponse, UpdateWorkerRequest, - UpdateWorkerResponse, process_oplog_entries_response, + GetWorkersMetadataRequest, GetWorkersMetadataResponse, ProcessOplogEntriesRequest, + ProcessOplogEntriesResponse, RevertWorkerRequest, RevertWorkerResponse, SearchOplogRequest, + SearchOplogResponse, UpdateWorkerRequest, UpdateWorkerResponse, process_oplog_entries_response, }; use golem_common::metrics::api::record_new_grpc_api_active_stream; use golem_common::model::account::AccountId; @@ -64,11 +62,9 @@ use golem_common::model::oplog::{OplogIndex, UpdateDescription}; use golem_common::model::protobuf::to_protobuf_resource_description; use golem_common::model::worker::{AgentConfigEntryDto, AgentMetadataDto, TypedAgentConfigEntry}; use golem_common::model::{ - AgentEvent, AgentFilter, AgentFingerprint, AgentId, AgentInvocation, AgentInvocationOutput, - AgentInvocationResult, AgentMetadata, AgentStatus, IdempotencyKey, InvocationStatus, - OwnedAgentId, PendingUpdateKind, ScanCursor, ScheduledAction, ShardId, Timestamp, + AgentEvent, AgentFilter, AgentFingerprint, AgentId, AgentInvocation, AgentMetadata, + AgentStatus, IdempotencyKey, OwnedAgentId, PendingUpdateKind, ScanCursor, ShardId, Timestamp, }; -use golem_common::schema::SchemaValue; use golem_common::{model as common_model, recorded_grpc_api_request}; use golem_service_base::error::worker_executor::*; use golem_service_base::grpc::{ @@ -82,7 +78,6 @@ use std::marker::PhantomData; use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; -use tokio; use tokio::sync::broadcast::error::RecvError; use tokio_stream::wrappers::errors::BroadcastStreamRecvError; use tonic::{Request, Response, Status}; @@ -118,14 +113,6 @@ impl + UsesAllDeps + Send + Sync + type ResponseResult = Result, Status>; type ResponseStream = WorkerEventStream; -fn decode_invocation_freshness_disposition(value: i32) -> InvocationFreshnessDisposition { - if value == golem::workerexecutor::v1::InvocationFreshnessDisposition::KnownFresh as i32 { - InvocationFreshnessDisposition::KnownFresh - } else { - InvocationFreshnessDisposition::MayExist - } -} - impl + UsesAllDeps + Send + Sync + 'static> WorkerExecutorImpl { @@ -1889,252 +1876,6 @@ impl + UsesAllDeps + Send + Sync + } } - async fn invoke_agent_internal( - &self, - request: InvokeAgentRequest, - ) -> Result<(Option, Option), WorkerExecutorError> { - Self::validate_auth_ctx(&request.auth_ctx)?; - - let freshness_disposition = - decode_invocation_freshness_disposition(request.freshness_disposition); - - let idempotency_key: Option = - request.idempotency_key.clone().map(|k| k.into()); - - if freshness_disposition == InvocationFreshnessDisposition::KnownFresh - && idempotency_key.is_none() - { - return Err(WorkerExecutorError::invalid_request( - "KnownFresh requires an idempotency key", - )); - } - - let mode = request.mode(); - - let ik = idempotency_key.unwrap_or(IdempotencyKey::fresh()); - let final_agent_id: AgentId = request - .agent_id - .clone() - .ok_or(WorkerExecutorError::invalid_request("agent_id not found"))? - .try_into() - .map_err(WorkerExecutorError::invalid_request)?; - - if matches!( - mode, - golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup - ) { - if freshness_disposition == InvocationFreshnessDisposition::KnownFresh { - return Err(WorkerExecutorError::invalid_request( - "KnownFresh cannot be used for an invocation lookup", - )); - } - let inv_status = match self.get_or_create_pending_for_lookup(&request).await? { - Some(worker) => match worker.lookup_invocation_result(&ik).await { - crate::model::LookupResult::Complete(Ok(_)) => InvocationStatus::Complete, - crate::model::LookupResult::Complete(Err(err)) => return Err(err), - crate::model::LookupResult::Pending => InvocationStatus::Pending, - crate::model::LookupResult::New | crate::model::LookupResult::Interrupted => { - InvocationStatus::Unknown - } - }, - None => InvocationStatus::Unknown, - }; - return Ok(( - Some(AgentInvocationOutput { - result: AgentInvocationResult::AgentInitialization, - consumed_fuel: None, - invocation_status: Some(inv_status), - component_revision: None, - agent_id: Some(final_agent_id), - idempotency_key: Some(ik), - oplog_index: None, - agent_fingerprint: None, - }), - None, - )); - } - - let method_name = - request - .method_name - .clone() - .ok_or(WorkerExecutorError::invalid_request( - "method_name is required for non-lookup invocations", - ))?; - - let method_parameters: SchemaValue = request - .method_parameters - .clone() - .ok_or(WorkerExecutorError::invalid_request( - "method_parameters is required for non-lookup invocations", - ))? - .try_into() - .map_err(|e| { - WorkerExecutorError::invalid_request(format!( - "failed converting method_parameters: {e}" - )) - })?; - - let schedule_at: Option> = request - .schedule_at - .and_then(|ts| DateTime::from_timestamp(ts.seconds, ts.nanos as u32)); - - let account_id: AccountId = request - .component_owner_account_id - .ok_or(WorkerExecutorError::invalid_request("account_id not found"))? - .try_into() - .map_err(|e| { - WorkerExecutorError::invalid_request(format!("Invalid account id: {e}")) - })?; - - let owned_agent_id = - extract_owned_agent_id(&request, |r| &r.agent_id, |r| &r.environment_id)?; - - Worker::::validate_invocation_freshness( - self, - &owned_agent_id, - &ik, - freshness_disposition, - ) - .await?; - - let principal: Principal = request - .principal - .clone() - .map(|p| p.try_into()) - .transpose() - .map_err(|e: String| { - WorkerExecutorError::invalid_request(format!("failed converting principal: {e}")) - })? - .unwrap_or_else(Principal::anonymous); - - let invocation_context = self - .limit_invocation_context_stack_depth(from_proto_invocation_context(&request.context)); - let worker_creation_principal = principal.clone(); - - let invocation = AgentInvocation::AgentMethod { - idempotency_key: ik.clone(), - method_name, - input: method_parameters, - invocation_context, - principal, - }; - - match mode { - golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await => { - // Use the `pending` variant so we do NOT start the wasmtime instance - // up front. `Worker::invoke_and_await` checks the read-only cache first; - // on a cache hit (`ResultOrSubscription::Finished`) it returns without - // loading the agent. The Pending path starts the instance lazily so - // queued invocations still get processed. - let worker = self - .get_or_create_pending_with_freshness(&request, freshness_disposition) - .await?; - let mut invocation_output = worker.invoke_and_await(invocation).await?; - invocation_output.agent_id = Some(final_agent_id); - invocation_output.idempotency_key = Some(ik); - Ok((Some(invocation_output), None)) - } - golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule => { - match schedule_at { - Some(scheduled_time) => { - let component = self - .component_service() - .get_metadata(owned_agent_id.component_id(), None) - .await?; - let parsed_agent_id = ParsedAgentId::parse( - &owned_agent_id.agent_id.agent_id, - &component.metadata, - ) - .map_err(WorkerExecutorError::invalid_request)?; - let agent_mode = component - .metadata - .find_agent_type_by_name_ref(&parsed_agent_id.agent_type) - .map(|agent_type| agent_type.mode) - .ok_or_else(|| { - WorkerExecutorError::invalid_request( - "Scheduled invocation target is not a registered agent type", - ) - })?; - let action = if agent_mode == AgentMode::Ephemeral { - ScheduledAction::InvokeEphemeral { - account_id, - owned_agent_id, - invocation: Box::new(invocation), - component_revision: component.revision, - env: request.env().unwrap_or_default(), - config: request.config()?, - parent: request.parent(), - creation_principal: Box::new(worker_creation_principal), - } - } else { - let worker = self - .get_or_create_pending_with_freshness( - &request, - freshness_disposition, - ) - .await?; - let target_worker_fingerprint = - worker.get_initial_worker_metadata().fingerprint; - ScheduledAction::Invoke { - account_id, - owned_agent_id, - invocation: Box::new(invocation), - target_worker_fingerprint, - } - }; - self.scheduler_service() - .schedule(scheduled_time, action) - .await; - Ok(( - Some(AgentInvocationOutput { - result: AgentInvocationResult::AgentInitialization, - consumed_fuel: None, - invocation_status: None, - component_revision: None, - agent_id: Some(final_agent_id), - idempotency_key: Some(ik), - oplog_index: None, - agent_fingerprint: None, - }), - None, - )) - } - None => { - let worker = self - .get_or_create_pending_with_freshness(&request, freshness_disposition) - .await?; - match worker.clone().invoke(invocation).await? { - crate::worker::ResultOrSubscription::Finished(Err(err)) => { - return Err(err); - } - crate::worker::ResultOrSubscription::Finished(Ok(_)) => {} - crate::worker::ResultOrSubscription::Pending(_) => { - Worker::start_if_needed(worker).await?; - } - } - Ok(( - Some(AgentInvocationOutput { - result: AgentInvocationResult::AgentInitialization, - consumed_fuel: None, - invocation_status: None, - component_revision: None, - agent_id: Some(final_agent_id), - idempotency_key: Some(ik), - oplog_index: None, - agent_fingerprint: None, - }), - None, - )) - } - } - } - golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup => { - unreachable!("Lookup mode handled above") - } - } - } - async fn process_oplog_entries_internal( &self, request: ProcessOplogEntriesRequest, @@ -2284,7 +2025,16 @@ impl + UsesAllDeps + Send + Sync + agent_id: Some(metadata.agent_id.into()), environment_id: Some(metadata.environment_id.into()), env: HashMap::from_iter(metadata.env.iter().cloned()), - config: metadata.config.into_iter().map(Into::into).collect(), + config: metadata + .config + .into_iter() + .map(TryInto::try_into) + .collect::>() + .map_err(|error| { + WorkerExecutorError::unknown(format!( + "failed converting agent configuration: {error}" + )) + })?, created_by: Some(metadata.created_by.into()), component_revision: latest_status.component_revision.into(), status: Into::::into(latest_status.status).into(), @@ -3167,85 +2917,13 @@ impl + UsesAllDeps + Send + Sync + } } - async fn invoke_agent( - &self, - request: Request, - ) -> Result, Status> { - let request = request.into_inner(); - let record = recorded_grpc_api_request!( - "invoke_agent", - agent_id = proto_agent_id_string(&request.agent_id), - method_name = request.method_name.clone(), - idempotency_key = proto_idempotency_key_string(&request.idempotency_key), - ); + type InvokeAgentSessionStream = invocation_session::InvocationSessionStream; - match self - .invoke_agent_internal(request) - .instrument(record.span.clone()) - .await - { - Ok((result, _status)) => { - let ( - result_value, - fuel_consumed, - component_revision, - invocation_status, - oplog_index, - agent_fingerprint, - agent_id, - idempotency_key, - ) = match result { - Some(output) => { - let value = match &output.result { - AgentInvocationResult::AgentMethod { output } => { - Some(output.clone().into()) - } - _ => None, - }; - let proto_status = output.invocation_status.map(|s| { - golem_api_grpc::proto::golem::worker::InvocationStatus::from(s) as i32 - }); - ( - value, - output.consumed_fuel, - output.component_revision.map(|r| r.get()), - proto_status, - output.oplog_index.map(u64::from), - output.agent_fingerprint.map(|fp| fp.0.into()), - output.agent_id.map(Into::into), - output.idempotency_key.map(Into::into), - ) - } - None => (None, None, None, None, None, None, None, None), - }; - record.succeed(Ok(Response::new(InvokeAgentResponse { - result: Some( - golem::workerexecutor::v1::invoke_agent_response::Result::Success( - golem::workerexecutor::v1::InvokeAgentSuccess { - result: result_value, - fuel_consumed, - component_revision, - status: invocation_status, - oplog_index, - agent_fingerprint, - agent_id, - idempotency_key, - }, - ), - ), - }))) - } - Err(mut err) => record.fail( - Ok(Response::new(InvokeAgentResponse { - result: Some( - golem::workerexecutor::v1::invoke_agent_response::Result::Failure( - err.clone().into(), - ), - ), - })), - &mut err, - ), - } + async fn invoke_agent_session( + &self, + request: Request>, + ) -> ResponseResult { + invocation_session::invoke_agent_session(self, request).await } async fn process_oplog_entries( @@ -3356,33 +3034,3 @@ fn extract_owned_agent_id( Ok(OwnedAgentId::new(environment_id, &agent_id)) } - -#[cfg(test)] -mod freshness_tests { - use super::decode_invocation_freshness_disposition; - use golem_common::model::agent::InvocationFreshnessDisposition; - use test_r::test; - - #[test] - fn invocation_freshness_defaults_unknown_values_to_may_exist() { - assert_eq!( - decode_invocation_freshness_disposition(0), - InvocationFreshnessDisposition::MayExist - ); - assert_eq!( - decode_invocation_freshness_disposition(i32::MAX), - InvocationFreshnessDisposition::MayExist - ); - } - - #[test] - fn invocation_freshness_decodes_known_fresh_explicitly() { - assert_eq!( - decode_invocation_freshness_disposition( - golem_api_grpc::proto::golem::workerexecutor::v1::InvocationFreshnessDisposition::KnownFresh - as i32 - ), - InvocationFreshnessDisposition::KnownFresh - ); - } -} diff --git a/golem-worker-executor/src/lib.rs b/golem-worker-executor/src/lib.rs index 2ed51725d3..bd5cac39bf 100644 --- a/golem-worker-executor/src/lib.rs +++ b/golem-worker-executor/src/lib.rs @@ -523,10 +523,10 @@ pub trait Bootstrap { &mut linker, DurableWorkerCtxView::durable_ctx_mut, )?; - golem_schema::schema::wit::wire::add_to_linker::<_, HasSelf>>( - &mut linker, - DurableWorkerCtxView::durable_ctx_mut, - )?; + golem_schema::schema::wit::wire::add_to_linker::< + _, + durable_host::schema_value_stream::CoreTypesHost, + >(&mut linker, DurableWorkerCtxView::durable_ctx_mut)?; Ok(linker) } } diff --git a/golem-worker-executor/src/services/linear_memory.rs b/golem-worker-executor/src/services/linear_memory.rs index 2f074aa6ba..ffd90c04fb 100644 --- a/golem-worker-executor/src/services/linear_memory.rs +++ b/golem-worker-executor/src/services/linear_memory.rs @@ -42,7 +42,8 @@ struct Inner { startup_bytes_remaining: AtomicU64, pending_growth_prepaid: AtomicU64, growth_has_pending_grant: AtomicBool, - pending_growth_grants: Mutex>, + pending_growth_grants: Mutex>, + transient_growth_grants: Mutex>, retained_growth_grant: Arc>, reconciling: AtomicBool, replaying: AtomicBool, @@ -51,6 +52,12 @@ struct Inner { meter: AgentMemoryMeter, } +#[derive(Debug)] +struct PendingGrowthGrant { + grant: MemoryGrant, + transient: bool, +} + impl LinearMemoryTracker { pub(crate) fn new( bytes: u64, @@ -70,6 +77,7 @@ impl LinearMemoryTracker { pending_growth_prepaid: AtomicU64::new(0), growth_has_pending_grant: AtomicBool::new(false), pending_growth_grants: Mutex::new(Vec::new()), + transient_growth_grants: Mutex::new(Vec::new()), retained_growth_grant, reconciling: AtomicBool::new(true), replaying: AtomicBool::new(replaying), @@ -138,8 +146,16 @@ impl LinearMemoryTracker { .store(0, Ordering::Release); let pending_grants = std::mem::take(&mut *self.inner.pending_growth_grants.lock().unwrap()); let mut retained_grant = self.inner.retained_growth_grant.lock().unwrap(); - for grant in pending_grants { - retained_grant.merge(grant); + for pending in pending_grants { + if pending.transient { + self.inner + .transient_growth_grants + .lock() + .unwrap() + .push(pending.grant); + } else { + retained_grant.merge(pending.grant); + } } self.inner .growth_has_pending_grant @@ -154,13 +170,21 @@ impl LinearMemoryTracker { .inner .growth_has_pending_grant .swap(false, Ordering::AcqRel) - && let Some(grant) = self.inner.pending_growth_grants.lock().unwrap().pop() + && let Some(pending) = self.inner.pending_growth_grants.lock().unwrap().pop() { - self.inner - .retained_growth_grant - .lock() - .unwrap() - .merge(grant); + if pending.transient { + self.inner + .transient_growth_grants + .lock() + .unwrap() + .push(pending.grant); + } else { + self.inner + .retained_growth_grant + .lock() + .unwrap() + .merge(pending.grant); + } } let reconciling = self.inner.reconciling.load(Ordering::Acquire); let prepaid = self @@ -240,8 +264,20 @@ impl LinearMemoryTracker { } pub(crate) fn retain_growth_grant(&self, grant: MemoryGrant) { + self.retain_pending_growth_grant(grant, false); + } + + pub(crate) fn retain_transient_growth_grant(&self, grant: MemoryGrant) { + self.retain_pending_growth_grant(grant, true); + } + + fn retain_pending_growth_grant(&self, grant: MemoryGrant, transient: bool) { let _transition = self.inner.transitions.lock().unwrap(); - self.inner.pending_growth_grants.lock().unwrap().push(grant); + self.inner + .pending_growth_grants + .lock() + .unwrap() + .push(PendingGrowthGrant { grant, transient }); self.inner .growth_has_pending_grant .store(true, Ordering::Release); @@ -531,6 +567,41 @@ mod tests { ); } + #[test] + async fn transient_growth_grant_is_released_with_its_store_tracker() { + let now = Instant::now(); + let controller = Arc::new(AdmissionController::new( + Box::new(FixedProbe::new(100, 0)), + AdmissionPolicy { usable_ratio: 1.0 }, + )); + let retained_grant = Arc::new(Mutex::new( + controller.admit(40, &NoEvictionSource).await.unwrap(), + )); + let tracker = LinearMemoryTracker::new( + 40, + 40, + AgentMode::Durable, + false, + Arc::new(AtomicResourceEntry::new(0, 0, 0, 0, 0)), + retained_grant.clone(), + now, + ); + tracker.reconcile(40, now); + + let transient_grant = controller.admit(10, &NoEvictionSource).await.unwrap(); + tracker.retain_transient_growth_grant(transient_grant); + tracker.grow(10, now); + assert_eq!(controller.headroom_bytes(), 50); + + drop(tracker); + assert_eq!( + controller.headroom_bytes(), + 60, + "snapshot-only capacity must not be retained by the running worker" + ); + assert_eq!(retained_grant.lock().unwrap().bytes(), 40); + } + #[test] fn committed_growth_rechecks_a_concurrently_lowered_limit() { let now = Instant::now(); diff --git a/golem-worker-executor/src/services/oplog/plugin.rs b/golem-worker-executor/src/services/oplog/plugin.rs index e12e448670..e0796cb433 100644 --- a/golem-worker-executor/src/services/oplog/plugin.rs +++ b/golem-worker-executor/src/services/oplog/plugin.rs @@ -324,8 +324,13 @@ impl OplogProcessorPlugin for PerExecutorOplogProcessorPlugin>() + .map_err(|error| { + WorkerExecutorError::unknown(format!( + "failed converting agent configuration: {error}" + )) + })?, created_by: Some(worker_metadata.created_by.into()), component_revision: latest_status.component_revision.into(), status: Into::::into( diff --git a/golem-worker-executor/src/services/rpc.rs b/golem-worker-executor/src/services/rpc.rs index 378456cb37..b913954592 100644 --- a/golem-worker-executor/src/services/rpc.rs +++ b/golem-worker-executor/src/services/rpc.rs @@ -17,12 +17,13 @@ use super::direct_invocation_auth::DirectInvocationAuthService; use super::environment_state::EnvironmentStateService; use super::file_loader::FileLoader; use super::{HasAgentWebhooksService, HasEnvironmentStateService, HasWebSocketConnectionPool}; +use crate::durable_host::stream_session::LiveValueSession; use crate::durable_host::websocket::WebSocketConnectionPool; use crate::services::events::Events; use crate::services::oplog::plugin::OplogProcessorPlugin; use crate::services::resource_limits::ResourceLimits; use crate::services::shard::ShardService; -use crate::services::worker_proxy::{WorkerProxy, WorkerProxyError}; +use crate::services::worker_proxy::{InvocationResponseStream, WorkerProxy, WorkerProxyError}; use crate::services::{ HasActiveWorkers, HasAgentTypesService, HasBlobStoreService, HasCardService, HasComponentService, HasConfig, HasEvents, HasExtraDeps, HasFileLoader, HasHttpConnectionPool, @@ -38,6 +39,18 @@ use crate::services::{ use crate::worker::Worker; use crate::workerctx::WorkerCtx; use async_trait::async_trait; +use futures::StreamExt; +use golem_api_grpc::proto::golem::worker::{ + InvocationFrame as LiveInvocationFrame, InvocationProtocolFailure as LiveInvocationFailure, + InvocationSessionFinished, InvocationStart as LiveInvocationStart, + invocation_cancel as live_invocation_cancel, invocation_frame as live_invocation_frame, + invocation_protocol_failure as live_invocation_failure, invocation_result, + invocation_session_finished, +}; +use golem_api_grpc::{ + InvocationResponseState as LiveInvocationResponseState, + invocation_cancel_frame as live_invocation_cancel_frame, +}; use golem_common::model::account::AccountId; use golem_common::model::agent::{ AgentInvocationMode, AgentPrincipal, InvocationFreshnessDisposition, Principal, @@ -56,6 +69,8 @@ use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::sync::Arc; use tokio::runtime::Handle; +use tokio::sync::mpsc; +use tokio_stream::wrappers::ReceiverStream; use tracing::debug; use wasmtime_wasi_http::HttpConnectionPool; @@ -87,6 +102,28 @@ pub trait Rpc: Send + Sync { auth_ctx: &AuthCtx, ) -> Result; + /// Executes an awaited invocation whose recursive value tree contains live + /// streams. This is a non-durable session: implementations must not route + /// the value through ordinary protobuf/oplog serialization. + async fn invoke_and_await_streaming( + &self, + _owned_agent_id: &OwnedAgentId, + _idempotency_key: Option, + _method_name: String, + _method_parameters: SchemaValue, + _self_created_by: AccountId, + _self_agent_id: &AgentId, + _self_env: &[(String, String)], + _self_stack: InvocationContextStack, + _config: Vec, + _auth_ctx: &AuthCtx, + ) -> Result { + Err(RpcError::ProtocolError { + details: "live streaming invocation is not supported by this RPC implementation" + .to_string(), + }) + } + async fn invoke( &self, owned_agent_id: &OwnedAgentId, @@ -103,6 +140,45 @@ pub trait Rpc: Send + Sync { ) -> Result<(), RpcError>; } +struct RemoteLiveRequestGuard { + session: LiveValueSession, + frames: Option>, +} + +impl RemoteLiveRequestGuard { + fn new(session: LiveValueSession, frames: mpsc::Sender) -> Self { + Self { + session, + frames: Some(frames), + } + } + + fn disarm(&mut self) { + self.frames = None; + } +} + +impl Drop for RemoteLiveRequestGuard { + fn drop(&mut self) { + let Some(frames) = self.frames.take() else { + return; + }; + if self.session.is_cancelled() { + return; + } + self.session.cancel(); + let frame = live_invocation_cancel_frame(live_invocation_cancel::Kind::Semantic, None); + match frames.try_send(frame) { + Ok(()) | Err(mpsc::error::TrySendError::Closed(_)) => {} + Err(mpsc::error::TrySendError::Full(frame)) => { + tokio::spawn(async move { + let _ = frames.send(frame).await; + }); + } + } + } +} + #[derive(Debug, Clone, PartialEq, Eq)] pub enum RpcError { ProtocolError { details: String }, @@ -376,6 +452,168 @@ impl Rpc for RemoteInvocationRpc { } } + async fn invoke_and_await_streaming( + &self, + owned_agent_id: &OwnedAgentId, + idempotency_key: Option, + method_name: String, + method_parameters: SchemaValue, + _self_created_by: AccountId, + self_agent_id: &AgentId, + self_env: &[(String, String)], + self_stack: InvocationContextStack, + config: Vec, + auth_ctx: &AuthCtx, + ) -> Result { + let (frames, receiver) = mpsc::channel(32); + let session = LiveValueSession::new(1, frames.clone()); + let input = session + .encode(&method_parameters) + .map_err(|details| RpcError::ProtocolError { details })?; + frames + .send(LiveInvocationFrame { + frame: Some(live_invocation_frame::Frame::Start(LiveInvocationStart { + agent_id: Some(owned_agent_id.agent_id().into()), + method_name: Some(method_name), + input: Some(input), + idempotency_key: idempotency_key.map(Into::into), + context: Some(golem_api_grpc::proto::golem::worker::InvocationContext { + parent: Some(self_agent_id.clone().into()), + env: HashMap::from_iter(self_env.to_vec()), + tracing: Some(self_stack.into()), + }), + auth_ctx: Some(auth_ctx.clone().into()), + principal: Some(caller_agent_principal(self_agent_id).into()), + environment_id: Some(owned_agent_id.environment_id.into()), + config: config.into_iter().map(Into::into).collect(), + component_owner_account_id: None, + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + schedule_at: None, + freshness_disposition: golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + })), + }) + .await + .map_err(|_| RpcError::ProtocolError { + details: "live invocation request ended before start".to_string(), + })?; + let mut cancel_on_drop = RemoteLiveRequestGuard::new(session.clone(), frames.clone()); + let mut inbound = match self + .worker_proxy + .invoke_agent_session(Box::pin(ReceiverStream::new(receiver))) + .await + { + Ok(inbound) => inbound, + Err(error) => { + session.cancel(); + return Err(error.into()); + } + }; + let mut response_state = LiveInvocationResponseState::default(); + + while let Some(frame) = inbound.next().await { + let frame = match frame { + Ok(frame) => frame, + Err(error) => { + let details = error.to_string(); + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Transport, + details, + ) + .await; + return Err(error.into()); + } + }; + if let Err(details) = response_state.validate(&frame) { + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Protocol, + details.clone(), + ) + .await; + return Err(RpcError::ProtocolError { details }); + } + match frame.frame { + Some(live_invocation_frame::Frame::Result(result)) => { + let output = match result.result { + Some(invocation_result::Result::MethodResult(output)) => { + match session.decode(output).await { + Ok(output) => output, + Err(details) => { + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Protocol, + details.clone(), + ) + .await; + return Err(RpcError::ProtocolError { details }); + } + } + } + Some(invocation_result::Result::NoResult(_)) | None => { + let details = + "streaming agent invocation returned no method result".to_string(); + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Protocol, + details.clone(), + ) + .await; + return Err(RpcError::ProtocolError { details }); + } + }; + spawn_live_response_router(session, inbound, frames, response_state); + cancel_on_drop.disarm(); + return Ok(output); + } + Some(live_invocation_frame::Frame::Finished(finished)) => { + let error = rpc_error_from_invocation_finished(finished); + session.fail(error.to_string()); + return Err(error); + } + Some(frame) => match session.route_stream_frame(frame).await { + Ok(true) => {} + Ok(false) => { + let details = "unexpected frame before the invocation result".to_string(); + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Protocol, + details.clone(), + ) + .await; + return Err(RpcError::ProtocolError { details }); + } + Err(details) => { + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Protocol, + details.clone(), + ) + .await; + return Err(RpcError::ProtocolError { details }); + } + }, + None => unreachable!("response state validation rejects empty frames"), + } + } + let details = "invocation response ended before publishing a result".to_string(); + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Transport, + details.clone(), + ) + .await; + Err(RpcError::ProtocolError { details }) + } + async fn invoke( &self, owned_agent_id: &OwnedAgentId, @@ -415,6 +653,164 @@ impl Rpc for RemoteInvocationRpc { } } +fn spawn_live_response_router( + session: LiveValueSession, + mut inbound: InvocationResponseStream, + frames: mpsc::Sender, + mut response_state: LiveInvocationResponseState, +) { + tokio::spawn(async move { + while let Some(frame) = inbound.next().await { + let frame = match frame { + Ok(frame) => frame, + Err(error) => { + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Transport, + error.to_string(), + ) + .await; + return; + } + }; + if let Err(details) = response_state.validate(&frame) { + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Protocol, + details, + ) + .await; + return; + } + match frame.frame { + Some(live_invocation_frame::Frame::Finished(finished)) => { + match finished.outcome { + Some(invocation_session_finished::Outcome::Success(_)) => { + if let Err(details) = session.finish_invocation().await { + let _ = frames + .send(live_invocation_cancel_frame( + live_invocation_cancel::Kind::Protocol, + Some(details), + )) + .await; + } + } + Some(invocation_session_finished::Outcome::Failure(failure)) => { + session.fail(worker_failure_details(failure)); + } + Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { + session.fail(failure.details); + } + None => session.fail("invocation completion has no outcome".to_string()), + } + return; + } + Some(frame) => match session.route_stream_frame(frame).await { + Ok(true) => {} + Ok(false) => { + let details = "unexpected frame after the invocation result".to_string(); + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Protocol, + details, + ) + .await; + return; + } + Err(details) => { + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Protocol, + details, + ) + .await; + return; + } + }, + None => unreachable!("response state validation rejects empty frames"), + } + } + if !response_state.is_complete() { + fail_live_response_transport( + &session, + &frames, + live_invocation_cancel::Kind::Transport, + "invocation response ended before completion".to_string(), + ) + .await; + } + }); +} + +async fn fail_live_response_transport( + session: &LiveValueSession, + frames: &mpsc::Sender, + kind: live_invocation_cancel::Kind, + details: String, +) { + let _ = frames + .send(live_invocation_cancel_frame(kind, Some(details.clone()))) + .await; + session.fail(details); +} + +fn rpc_error_from_live_failure(failure: LiveInvocationFailure) -> RpcError { + match live_invocation_failure::Kind::try_from(failure.kind) + .unwrap_or(live_invocation_failure::Kind::RemoteInternal) + { + live_invocation_failure::Kind::Protocol => RpcError::ProtocolError { + details: failure.details, + }, + live_invocation_failure::Kind::Denied => RpcError::Denied { + details: failure.details, + }, + live_invocation_failure::Kind::NotFound => RpcError::NotFound { + details: failure.details, + }, + live_invocation_failure::Kind::RemoteInternal => RpcError::RemoteInternalError { + details: failure.details, + }, + live_invocation_failure::Kind::Transport => RpcError::ProtocolError { + details: format!("live invocation transport failed: {}", failure.details), + }, + } +} + +fn worker_failure_details( + failure: golem_api_grpc::proto::golem::worker::v1::WorkerExecutionError, +) -> String { + let result: Result = failure.try_into(); + result + .map(|error| error.to_string()) + .unwrap_or_else(|error| format!("failed to decode worker execution error: {error}")) +} + +fn rpc_error_from_invocation_finished(finished: InvocationSessionFinished) -> RpcError { + match finished.outcome { + Some(invocation_session_finished::Outcome::Failure(failure)) => { + let result: Result = failure.try_into(); + result + .map(Into::into) + .unwrap_or_else(|error| RpcError::RemoteInternalError { + details: format!("failed to decode worker execution error: {error}"), + }) + } + Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { + rpc_error_from_live_failure(failure) + } + Some(invocation_session_finished::Outcome::Success(_)) => RpcError::ProtocolError { + details: "invocation completed successfully before publishing a result".to_string(), + }, + None => RpcError::ProtocolError { + details: "invocation completion has no outcome".to_string(), + }, + } +} + fn caller_agent_principal(self_agent_id: &AgentId) -> Principal { Principal::Agent(AgentPrincipal { agent_id: self_agent_id.clone(), @@ -977,6 +1373,77 @@ impl Rpc for DirectWorkerInvocationRpc { } } + async fn invoke_and_await_streaming( + &self, + owned_agent_id: &OwnedAgentId, + idempotency_key: Option, + method_name: String, + method_parameters: SchemaValue, + self_created_by: AccountId, + self_agent_id: &AgentId, + self_env: &[(String, String)], + self_stack: InvocationContextStack, + config: Vec, + auth_ctx: &AuthCtx, + ) -> Result { + let owned_agent_id = &self.canonicalize_owned_agent_id(owned_agent_id).await?; + if self + .shard_service() + .check_worker(&owned_agent_id.agent_id) + .is_err() + { + return self + .remote_rpc + .invoke_and_await_streaming( + owned_agent_id, + idempotency_key, + method_name, + method_parameters, + self_created_by, + self_agent_id, + self_env, + self_stack, + config, + auth_ctx, + ) + .await; + } + + self.direct_invocation_auth + .check( + self_created_by, + owned_agent_id, + AgentVerb::Invoke, + AgentResourcePattern::Method(AgentMethodName(method_name.clone())), + auth_ctx, + ) + .await?; + let principal = caller_agent_principal(self_agent_id); + let worker = Worker::get_or_create_suspended( + self, + owned_agent_id, + Some(self_env.to_vec()), + config, + None, + Some(self_agent_id.clone()), + &self_stack, + principal.clone(), + ) + .await?; + let invocation = AgentInvocation::AgentMethod { + idempotency_key: idempotency_key.unwrap_or(IdempotencyKey::fresh()), + method_name, + input: method_parameters, + invocation_context: self_stack, + principal, + }; + let cancellation = tokio_util::sync::CancellationToken::new(); + worker + .invoke_live_streaming(invocation, cancellation) + .await + .map_err(Into::into) + } + async fn invoke( &self, owned_agent_id: &OwnedAgentId, @@ -1075,3 +1542,28 @@ impl Rpc for DirectWorkerInvocationRpc { } } } + +#[cfg(test)] +mod protocol_tests { + use super::RemoteLiveRequestGuard; + use crate::durable_host::stream_session::LiveValueSession; + use golem_api_grpc::proto::golem::worker::{invocation_cancel, invocation_frame}; + use test_r::test; + use tokio::sync::mpsc; + + #[test] + async fn dropped_remote_request_sends_semantic_cancellation() { + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new(1, frames.clone()); + let guard = RemoteLiveRequestGuard::new(session, frames); + + drop(guard); + + let frame = frame_rx.recv().await.unwrap().frame.unwrap(); + assert!(matches!( + frame, + invocation_frame::Frame::Cancel(cancel) + if cancel.kind == invocation_cancel::Kind::Semantic as i32 + )); + } +} diff --git a/golem-worker-executor/src/services/worker_proxy.rs b/golem-worker-executor/src/services/worker_proxy.rs index 477530789f..68ac712dd2 100644 --- a/golem-worker-executor/src/services/worker_proxy.rs +++ b/golem-worker-executor/src/services/worker_proxy.rs @@ -16,6 +16,7 @@ use super::golem_config::WorkerServiceGrpcConfig; use async_trait::async_trait; use chrono::{DateTime, Utc}; use desert_rust::BinaryCodec; +use futures::Stream; use golem_api_grpc::proto::golem::worker::v1::worker_service_client::WorkerServiceClient; use golem_api_grpc::proto::golem::worker::v1::{ AgentError, CancelInvocationRequest, CancelInvocationResponse, CompletePromiseRequest, @@ -27,7 +28,7 @@ use golem_api_grpc::proto::golem::worker::v1::{ invoke_agent_response, launch_new_worker_response, process_oplog_entries_response, resume_worker_response, revert_worker_response, update_worker_response, }; -use golem_api_grpc::proto::golem::worker::{CompleteParameters, UpdateMode}; +use golem_api_grpc::proto::golem::worker::{CompleteParameters, InvocationFrame, UpdateMode}; use golem_common::model::account::AccountId; use golem_common::model::agent::{AgentInvocationMode, InvocationFreshnessDisposition, Principal}; use golem_common::model::component::ComponentRevision; @@ -46,12 +47,38 @@ use golem_service_base::model::auth::AuthCtx; use std::collections::HashMap; use std::error::Error; use std::fmt::{Display, Formatter}; +use std::future::Future; +use std::pin::Pin; +use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; +use tonic::Status; use tonic::codec::CompressionEncoding; use tonic::transport::Channel; use tonic_tracing_opentelemetry::middleware::client::OtelGrpcService; use tracing::debug; +pub type InvocationRequestStream = Pin + Send + 'static>>; +pub type InvocationResponseStream = + Pin> + Send + 'static>>; + +fn invoke_agent_session_once<'a>( + client: &'a mut WorkerServiceClient>, + request: Option, +) -> Pin< + Box< + dyn Future>, Status>> + + Send + + 'a, + >, +> { + match request { + Some(request) => Box::pin(client.invoke_agent_session(request)), + None => Box::pin(std::future::ready(Err(Status::aborted( + "invocation session request was already consumed", + )))), + } +} + #[async_trait] pub trait WorkerProxy: Send + Sync { async fn start( @@ -83,6 +110,17 @@ pub trait WorkerProxy: Send + Sync { auth_ctx: &AuthCtx, ) -> Result; + async fn invoke_agent_session( + &self, + _request: InvocationRequestStream, + ) -> Result { + Err(WorkerProxyError::InternalError( + WorkerExecutorError::invalid_request( + "invocation sessions are not supported by this worker proxy", + ), + )) + } + async fn update( &self, owned_agent_id: &OwnedAgentId, @@ -346,7 +384,11 @@ impl WorkerProxy for RemoteWorkerProxy { }); let proto_method_parameters: golem_api_grpc::proto::golem::schema::SchemaValue = - method_parameters.into(); + method_parameters.try_into().map_err(|error| { + WorkerProxyError::BadRequest(vec![format!( + "method parameters cannot cross the remote worker boundary: {error}" + )]) + })?; let first_dispatch = AtomicBool::new(true); let response: InvokeAgentResponse = self @@ -458,6 +500,24 @@ impl WorkerProxy for RemoteWorkerProxy { } } + async fn invoke_agent_session( + &self, + request: InvocationRequestStream, + ) -> Result { + let request = Arc::new(std::sync::Mutex::new(Some(request))); + let response = self + .worker_service_client + .call_without_retry("invoke_agent_session", move |client| { + let request = request + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + .take(); + invoke_agent_session_once(client, request) + }) + .await?; + Ok(Box::pin(response.into_inner())) + } + async fn update( &self, owned_agent_id: &OwnedAgentId, @@ -774,6 +834,9 @@ mod tests { #[tonic::async_trait] impl WorkerService for FlakyWorkerService { + type InvokeAgentSessionStream = + Pin> + Send + 'static>>; + unimplemented_rpc!( launch_new_worker, LaunchNewWorkerRequest, @@ -799,6 +862,13 @@ mod tests { ProcessOplogEntriesResponse ); + async fn invoke_agent_session( + &self, + _request: Request>, + ) -> Result, Status> { + Err(Status::unimplemented("invoke_agent_session")) + } + async fn invoke_agent( &self, request: Request, diff --git a/golem-worker-executor/src/worker/invocation.rs b/golem-worker-executor/src/worker/invocation.rs index 13dce176dd..2710c7f335 100644 --- a/golem-worker-executor/src/worker/invocation.rs +++ b/golem-worker-executor/src/worker/invocation.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::durable_host::schema_value_stream::{StoreValueResolver, contains_stream}; +use crate::durable_host::stream_transport::LiveStreamTracker; use crate::metrics::wasm::{record_invocation, record_invocation_consumption}; use crate::model::TrapType; use crate::preview2::exports::golem::agent::guest as guest_exports; @@ -21,19 +23,25 @@ use crate::preview2::oplog_processor_plugin::exports::golem::api1_5_0::oplog_pro use crate::preview2::{golem_agent, golem_api_1_x}; use crate::workerctx::{PublicWorkerIo, WorkerCtx}; use futures::FutureExt; +use futures::channel::oneshot; use golem_common::model::agent::{AgentMode, ParsedAgentId}; use golem_common::model::component_metadata::ComponentMetadata; use golem_common::model::oplog::AgentError as OplogAgentError; use golem_common::model::{AgentInvocation, AgentInvocationResult, OplogIndex}; use golem_common::schema::SchemaValue; use golem_common::schema::agent::wit::decode_agent_error_rejecting_quota_with; -use golem_common::schema::agent::{AgentTypeSchema, FieldSource, InputSchema}; +use golem_common::schema::agent::{ + AgentMethodSchema, AgentTypeSchema, FieldSource, InputSchema, contains_stream_in_graph, +}; use golem_common::schema::graph::SchemaGraph; use golem_common::schema::schema_type::SchemaType; use golem_common::schema::validation::value::{validate_record_fields, validate_value}; use golem_schema::schema::wit::wire as core_wire; -use golem_schema::schema::wit::{decode_value_with, encode_value_with}; +use golem_schema::schema::wit::{decode_value_with, encode_value_with, encode_value_with_streams}; use golem_service_base::error::worker_executor::{InterruptKind, WorkerExecutorError}; +use std::any::Any; +use std::sync::Arc; +use std::sync::Mutex; use tracing::{Instrument, Level, debug, span}; use wasmtime::component::Accessor; use wasmtime::{AsContextMut, StoreContextMut}; @@ -106,6 +114,204 @@ pub async fn invoke_observed_and_traced( } } +type LiveStreamingResponse = Result; +type LiveStreamingResponseSender = Arc>>>; + +fn publish_live_streaming_response( + response: &LiveStreamingResponseSender, + result: LiveStreamingResponse, +) -> bool { + response + .lock() + .expect("live streaming response mutex poisoned") + .take() + .is_some_and(|response| response.send(result).is_ok()) +} + +fn panic_payload_message(payload: &(dyn Any + Send)) -> String { + if let Some(message) = payload.downcast_ref::() { + message.clone() + } else if let Some(message) = payload.downcast_ref::<&str>() { + (*message).to_string() + } else { + "unknown panic payload".to_string() + } +} + +/// Runs one live, non-durable agent RPC whose value tree may contain recursive +/// streams. The result head is published as soon as `guest.invoke` returns; +/// the Store remains exclusively owned by this call until every stream sourced +/// by the guest reaches its terminal state or the downstream reader detaches. +pub async fn invoke_live_streaming_rpc( + lowered: LoweredInvocation, + store: &mut impl AsContextMut, + instance: &wasmtime::component::Instance, + response: oneshot::Sender>, + cancellation: tokio_util::sync::CancellationToken, +) -> Result<(), WorkerExecutorError> { + let mut store = store.as_context_mut(); + let response = Arc::new(Mutex::new(Some(response))); + let LoweredInvocation { + display_name, + read_only_method, + call, + } = lowered; + let guest = match load_agent_guest(&mut store, instance) { + Ok(guest) => guest, + Err(error) => { + publish_live_streaming_response(&response, Err(error.clone())); + return Err(error); + } + }; + if let Some(blocker) = store.data().snapshot_boundary_blocker() { + let error = WorkerExecutorError::runtime(format!( + "cannot start a live streaming invocation while {blocker}" + )); + publish_live_streaming_response(&response, Err(error.clone())); + return Err(error); + } + let LoweredCall::Invoke { + method_name, + input, + principal, + expected_output, + } = call + else { + let error = WorkerExecutorError::invalid_request( + "live streaming RPC is only supported for agent method invocations", + ); + publish_live_streaming_response(&response, Err(error.clone())); + return Err(error); + }; + let tracker = Arc::new(LiveStreamTracker::new(cancellation)); + let mut tracker_installed = false; + let mut unpersisted_execution_active = false; + let mut read_only_active = false; + let mut invocation_started = false; + let response_for_call = response.clone(); + let tracker_for_call = tracker.clone(); + let validation_name = display_name.clone(); + + let call = std::panic::AssertUnwindSafe(async { + store + .data_mut() + .durable_ctx_mut() + .set_live_stream_tracker(tracker_for_call.clone()); + tracker_installed = true; + store + .data_mut() + .durable_ctx_mut() + .begin_unpersisted_streaming_invocation(); + unpersisted_execution_active = true; + + let input = { + let mut resolver = StoreValueResolver::new(&mut store); + encode_value_with_streams(&input, &mut resolver).map_err(|error| { + WorkerExecutorError::runtime(format!( + "Failed to encode live agent method input: {error}" + )) + })? + }; + + prepare_guest_call(&mut store, &display_name).await; + invocation_started = true; + store.data_mut().set_running(); + let _deadline = store.data().durable_ctx().arm_invocation_deadline(); + + if let Some(method_name) = &read_only_method { + store.data_mut().enter_read_only_mode(method_name.clone()); + read_only_active = true; + } + + run_guest_call_settled(&mut store, async move |accessor| { + match guest + .call_invoke(accessor, method_name, input, principal) + .await + { + Ok(Ok(output)) => { + let output = accessor.with(|mut access| match output { + None => Ok(SchemaValue::Tuple { + elements: Vec::new(), + }), + Some(tree) => { + let mut store = access.as_context_mut(); + let mut resolver = StoreValueResolver::new(&mut store); + decode_value_with(tree, &mut resolver) + .map_err(|error| wasmtime::Error::msg(error.to_string())) + } + })?; + validate_invoke_output(&validation_name, &expected_output, &output) + .map_err(|error| wasmtime::Error::msg(error.to_string()))?; + if publish_live_streaming_response(&response_for_call, Ok(output)) { + tracker_for_call.wait_for_sources().await; + } + Ok(true) + } + Ok(Err(error)) => { + let message = format!("agent method returned an error: {error:?}"); + publish_live_streaming_response( + &response_for_call, + Err(WorkerExecutorError::runtime(message)), + ); + Ok(false) + } + Err(error) => { + publish_live_streaming_response( + &response_for_call, + Err(WorkerExecutorError::runtime(error.to_string())), + ); + Err(error) + } + } + }) + .await + .and_then(|result| result) + .map_err(|error| WorkerExecutorError::runtime(error.to_string())) + }) + .catch_unwind() + .await; + + let (result, completed_successfully) = match call { + Ok(Ok(completed_successfully)) => (Ok(()), completed_successfully), + Ok(Err(error)) => (Err(error), false), + Err(payload) => ( + Err(WorkerExecutorError::runtime(format!( + "live streaming invocation panicked: {}", + panic_payload_message(payload.as_ref()) + ))), + false, + ), + }; + + if !completed_successfully { + tracker.cancellation_token().cancel(); + } + if read_only_active { + store.data_mut().exit_read_only_mode(); + } + if unpersisted_execution_active { + store + .data_mut() + .durable_ctx_mut() + .end_unpersisted_streaming_invocation_if_active(); + } + if tracker_installed { + store + .data_mut() + .durable_ctx_mut() + .clear_live_stream_tracker(); + } + if invocation_started { + let _ = finish_invocation_and_get_fuel_consumption(&mut store, &display_name).await?; + store.data().set_suspended(); + } + + if let Err(error) = &result { + publish_live_streaming_response(&response, Err(error.clone())); + } + result +} + /// Invokes a worker and calls the appropriate hooks to observe the invocation async fn invoke_observed( lowered: LoweredInvocation, @@ -368,8 +574,8 @@ async fn dispatch_call( let consumed_fuel = finish_invocation_and_get_fuel_consumption(store, display_name).await?; match result { - Ok(Ok(maybe_output)) => { - let output = decode_invoke_output(store, maybe_output)?; + Ok(Ok(invoke_output)) => { + let output = decode_invoke_output(store, invoke_output)?; validate_invoke_output(display_name, &expected_output, &output)?; Ok(InvokeResult::Succeeded { consumed_fuel, @@ -527,26 +733,39 @@ fn invoke_result_from_agent_error( }) } -/// Decodes the `option` output of `invoke` into the -/// schema-native [`SchemaValue`] carried across the gRPC / oplog boundary. +/// Decodes the optional value returned by `invoke` into the schema-native +/// [`SchemaValue`] carried across the gRPC / oplog boundary. /// /// A `none` result (the declared `unit` output) is represented by the /// canonical empty tuple, matching the `unit` projection used on the caller /// side ([`schema_value_to_wire_output`](crate::durable_host::wasm_rpc)). fn decode_invoke_output( store: &mut StoreContextMut<'_, Ctx>, - maybe_output: Option, + output: Option, ) -> Result { - match maybe_output { + match output { // `none` is the declared `unit` output. None => Ok(SchemaValue::Tuple { elements: Vec::new(), }), - // The output is a guest-owned value tree, so any `quota-token` handles - // it carries are lifted into trusted snapshots (and consumed) here. - Some(tree) => decode_value_with(tree, store.data_mut().durable_ctx_mut()).map_err(|e| { - WorkerExecutorError::runtime(format!("Failed to decode agent method output: {e}")) - }), + // The output is crossing a durable/materializing boundary. Quota-token + // handles are lifted into trusted snapshots, while live stream handles + // are rejected and remain exclusive to `invoke_live_streaming_rpc`. + Some(tree) => { + let output = + decode_value_with(tree, store.data_mut().durable_ctx_mut()).map_err(|e| { + WorkerExecutorError::runtime(format!( + "Failed to decode agent method output: {e}" + )) + })?; + if contains_stream(&output) { + Err(WorkerExecutorError::runtime( + "Agent method output contains a live stream at a materializing invocation boundary", + )) + } else { + Ok(output) + } + } } } @@ -1082,6 +1301,45 @@ pub fn lower_invocation( } } +pub fn agent_method_uses_streams( + component_metadata: &ComponentMetadata, + agent_id: Option<&ParsedAgentId>, + method_name: &str, + input: &SchemaValue, +) -> Result { + let agent_type = resolve_agent_type(component_metadata, agent_id)?; + let method = agent_type + .methods + .iter() + .find(|method| method.name == method_name) + .ok_or_else(|| { + WorkerExecutorError::invalid_request(format!( + "Agent method '{method_name}' not found in agent type '{}'", + agent_type.type_name + )) + })?; + + Ok(method_uses_streams(agent_type, method, input)) +} + +pub fn method_uses_streams( + agent_type: &AgentTypeSchema, + method: &AgentMethodSchema, + input: &SchemaValue, +) -> bool { + contains_stream(input) + || method + .input_schema + .fields() + .iter() + .filter(|field| matches!(field.source, FieldSource::UserSupplied)) + .any(|field| contains_stream_in_graph(&agent_type.schema, &field.schema)) + || method + .output_schema + .schema() + .is_some_and(|output| contains_stream_in_graph(&agent_type.schema, output)) +} + fn validate_schema_input_against_method_schema( input: &SchemaValue, agent_type: &AgentTypeSchema, @@ -1179,6 +1437,37 @@ mod tests { const AGENT_TYPE: &str = "test-agent"; const METHOD_NAME: &str = "do-work"; + #[test] + async fn live_streaming_response_is_published_exactly_once() { + let (sender, receiver) = oneshot::channel(); + let response = Arc::new(Mutex::new(Some(sender))); + + assert!(publish_live_streaming_response( + &response, + Ok(SchemaValue::Tuple { + elements: Vec::new(), + }) + )); + assert!(!publish_live_streaming_response( + &response, + Err(WorkerExecutorError::runtime("late failure")) + )); + + assert!(matches!( + receiver.await.unwrap(), + Ok(SchemaValue::Tuple { elements }) if elements.is_empty() + )); + } + + #[test] + fn live_streaming_panic_payload_is_reported() { + let owned: Box = Box::new("owned panic".to_string()); + let borrowed: Box = Box::new("borrowed panic"); + + assert_eq!(panic_payload_message(owned.as_ref()), "owned panic"); + assert_eq!(panic_payload_message(borrowed.as_ref()), "borrowed panic"); + } + /// Component metadata with one agent type whose `do-work` method takes two /// user-supplied parameters (`count: u32`, `label: string`) plus an /// auto-injected `principal` field. @@ -1200,6 +1489,10 @@ mod tests { http_endpoint: Vec::new(), read_only: None, }; + metadata_with_method(method) + } + + fn metadata_with_method(method: AgentMethodSchema) -> ComponentMetadata { let at = AgentTypeSchema { type_name: AgentTypeName(AGENT_TYPE.to_string()), description: String::new(), @@ -1312,6 +1605,29 @@ mod tests { ); } + #[test] + fn streaming_output_is_accepted_at_the_invocation_boundary() { + let metadata = metadata_with_method(AgentMethodSchema { + name: METHOD_NAME.to_string(), + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(Vec::new()), + output_schema: OutputSchema::Single(Box::new(SchemaType::stream(Some( + SchemaType::u32(), + )))), + http_endpoint: Vec::new(), + read_only: None, + }); + let result = lower_invocation( + method_invocation(SchemaValue::Record { fields: Vec::new() }), + &metadata, + Some(&agent_id()), + ); + if let Err(error) = result { + panic!("unexpected error: {error}"); + } + } + // --- validate_invoke_output --- fn unit_expected_output() -> ExpectedInvokeOutput { diff --git a/golem-worker-executor/src/worker/invocation_loop.rs b/golem-worker-executor/src/worker/invocation_loop.rs index c1d18630c0..f5ac2b1471 100644 --- a/golem-worker-executor/src/worker/invocation_loop.rs +++ b/golem-worker-executor/src/worker/invocation_loop.rs @@ -19,7 +19,8 @@ use crate::services::linear_memory::LinearMemoryTracker; use crate::services::oplog::{CommitLevel, EphemeralOplog, OplogOps}; use crate::services::{HasEvents, HasOplog, HasWorker}; use crate::worker::invocation::{ - InvocationMode, InvokeResult, invoke_observed_and_traced, lower_invocation, + InvocationMode, InvokeResult, invoke_live_streaming_rpc, invoke_observed_and_traced, + lower_invocation, }; use crate::worker::status_checkpointer; use crate::worker::{ @@ -594,7 +595,7 @@ impl InnerInvocationLoop<'_, Ctx> { break self.interrupt(interrupt).await; } - let message = self.active.write().await.pop_front(); + let message = self.pop_ready_internal_invocation().await; let result = if let Some(message) = message { self.internal_invocation(message).await @@ -666,6 +667,21 @@ impl InnerInvocationLoop<'_, Ctx> { } } + async fn pop_ready_internal_invocation(&self) -> Option { + let live_invocation_is_next = matches!( + self.active.read().await.front(), + Some(QueuedWorkerInvocation::LiveStreamingInvocation { .. }) + ); + if live_invocation_is_next { + let status = self.parent.get_non_detached_last_known_status().await; + if !status.pending_updates.is_empty() || !status.pending_invocations.is_empty() { + return None; + } + } + + self.active.write().await.pop_front() + } + /// Checks — before publishing `waiting_for_command = true`, which makes the /// worker eligible for idle eviction — that no Golem-spawned store task is /// still active. Every guest call drains its tail work before returning @@ -1040,10 +1056,66 @@ impl Invocation<'_, Ctx> { let _ = sender.send(Ok(())); CommandOutcome::Continue } + QueuedWorkerInvocation::LiveStreamingInvocation { + invocation, + sender, + cancellation, + } => { + self.invoke_live_streaming(invocation, sender, cancellation) + .await + } QueuedWorkerInvocation::SaveSnapshot => self.save_snapshot().await, } } + async fn invoke_live_streaming( + &mut self, + invocation: AgentInvocation, + sender: oneshot::Sender>, + cancellation: tokio_util::sync::CancellationToken, + ) -> CommandOutcome { + if cancellation.is_cancelled() { + let _ = sender.send(Err(WorkerExecutorError::runtime( + "live streaming invocation was cancelled before execution", + ))); + return CommandOutcome::Continue; + } + let idempotency_key = invocation + .idempotency_key() + .cloned() + .unwrap_or_else(IdempotencyKey::fresh); + let mut invocation_context = invocation.invocation_context(); + let result = async { + self.store + .data_mut() + .set_current_idempotency_key(idempotency_key.clone()) + .await; + Self::extend_invocation_context( + &mut invocation_context, + &idempotency_key, + &invocation, + &self.owned_agent_id.agent_id(), + &self.parent.parsed_agent_id, + ); + self.store + .data_mut() + .set_current_invocation_context(invocation_context) + .await?; + let lowered = lower_invocation( + invocation, + &self.store.data().component_metadata().metadata, + self.parent.parsed_agent_id.as_ref(), + )?; + invoke_live_streaming_rpc(lowered, self.store, self.instance, sender, cancellation) + .await + } + .await; + if let Err(error) = result { + tracing::warn!("live streaming invocation failed: {error}"); + } + live_streaming_invocation_outcome(self.parent.agent_mode()) + } + /// Process an external queued worker invocation - this is either an exported function invocation /// or a manual update request (which involves invoking the exported save-snapshot functions, so /// it is a special case of the exported function invocation). @@ -1768,6 +1840,16 @@ fn failed_agent_invocation_outcome( } } +fn live_streaming_invocation_outcome(agent_mode: AgentMode) -> CommandOutcome { + if agent_mode == AgentMode::Ephemeral { + CommandOutcome::BreakInnerLoopAndArchiveEphemeralOplog(RetryDecision::None) + } else { + // Live streams are not replayable yet. Recreate the Store from the last durable boundary + // before any later command can observe unjournaled guest-memory changes. + CommandOutcome::BreakInnerLoop(RetryDecision::Immediate) + } +} + fn should_cleanup_terminal_ephemeral_invocation( agent_mode: AgentMode, is_agent_component: bool, @@ -1826,8 +1908,8 @@ fn snapshot_action_at( mod tests { use super::{ CommandOutcome, PeriodicSnapshotAction, failed_agent_invocation_outcome, - periodic_snapshot_failure_outcome, snapshot_action_at, snapshot_baseline_timestamp, - successful_agent_invocation_outcome, + live_streaming_invocation_outcome, periodic_snapshot_failure_outcome, snapshot_action_at, + snapshot_baseline_timestamp, successful_agent_invocation_outcome, }; use crate::worker::RetryDecision; use crate::worker::invocation::InvokeResult; @@ -1957,4 +2039,20 @@ mod tests { CommandOutcome::BreakInnerLoop(RetryDecision::None) ); } + + #[test] + fn durable_live_streaming_invocation_always_reconstructs_the_store() { + assert_eq!( + live_streaming_invocation_outcome(AgentMode::Durable), + CommandOutcome::BreakInnerLoop(RetryDecision::Immediate) + ); + } + + #[test] + fn ephemeral_live_streaming_invocation_archives_its_ephemeral_oplog() { + assert_eq!( + live_streaming_invocation_outcome(AgentMode::Ephemeral), + CommandOutcome::BreakInnerLoopAndArchiveEphemeralOplog(RetryDecision::None) + ); + } } diff --git a/golem-worker-executor/src/worker/mod.rs b/golem-worker-executor/src/worker/mod.rs index 59f484158d..1581644bf2 100644 --- a/golem-worker-executor/src/worker/mod.rs +++ b/golem-worker-executor/src/worker/mod.rs @@ -2179,11 +2179,38 @@ impl Worker { } } - /// Acquire storage semaphore permits for a write operation. - /// Called from `DurableWorkerCtx::acquire_filesystem_space` in live mode only. + /// Acquire temporary storage semaphore permits for an unpersisted execution. + /// Called from the durable host in live mode only. /// Returns `NodeOutOfFilesystemStorage` if the executor pool is exhausted. /// /// Should only be called from the invocation loop. + pub async fn acquire_unpersisted_filesystem_storage_space( + &self, + new_bytes: u64, + ) -> anyhow::Result> { + if new_bytes == 0 { + return Ok(None); + } + match &*self.instance.lock().await { + WorkerInstance::Running(_) => { + if let Some(permit) = self + .active_workers() + .try_acquire_filesystem_storage(new_bytes) + .await + { + self.desired_extra_filesystem_storage + .store(0, Ordering::Relaxed); + Ok(Some(permit)) + } else { + self.desired_extra_filesystem_storage + .store(new_bytes, Ordering::Relaxed); + Err(anyhow!(GolemSpecificWasmTrap::NodeOutOfFilesystemStorage)) + } + } + _ => Ok(None), + } + } + pub async fn acquire_filesystem_storage_space(&self, new_bytes: u64) -> anyhow::Result<()> { match &mut *self.instance.lock().await { WorkerInstance::Running(running) => { @@ -2595,6 +2622,48 @@ impl Worker { receiver.await.unwrap() } + /// Runs an awaited agent invocation through the dedicated live-streaming + /// path. Unlike normal invocations, this path is intentionally not added to + /// the durable queue and never serializes its result into the oplog. + pub async fn invoke_live_streaming( + self: Arc, + invocation: AgentInvocation, + cancellation: tokio_util::sync::CancellationToken, + ) -> Result { + let mut cancel_on_drop = CancelLiveInvocationOnDrop(Some(cancellation.clone())); + let instance_guard = self.lock_non_stopping_worker().await; + if instance_guard.is_deleting() { + return Err(WorkerExecutorError::invalid_request( + "Cannot invoke a deleting worker", + )); + } + if let Some(err) = instance_guard.startup_failure() { + return Err(err.clone()); + } + + let (sender, receiver) = oneshot::channel(); + self.queue + .write() + .await + .push_back(QueuedWorkerInvocation::LiveStreamingInvocation { + invocation, + sender, + cancellation, + }); + if let WorkerInstance::Running(running) = &*instance_guard { + running.sender.send(WorkerCommand::WorkAvailable).unwrap(); + } + drop(instance_guard); + Worker::start_if_needed(self).await?; + let result = receiver.await.map_err(|_| { + WorkerExecutorError::runtime( + "live streaming invocation ended before publishing a result", + ) + })?; + cancel_on_drop.0 = None; + result + } + /// Appends an oplog entry without forcing a durable commit. Callers that /// require ordering must await the append before exposing subsequent work. pub async fn add_to_oplog(&self, entry: OplogEntry) -> OplogIndex { @@ -3159,6 +3228,9 @@ impl Worker { QueuedWorkerInvocation::AwaitReadyToProcessCommands { sender } => { let _ = sender.send(Err(error.clone())); } + QueuedWorkerInvocation::LiveStreamingInvocation { sender, .. } => { + let _ = sender.send(Err(error.clone())); + } QueuedWorkerInvocation::SaveSnapshot => {} } } @@ -5192,9 +5264,24 @@ pub enum QueuedWorkerInvocation { AwaitReadyToProcessCommands { sender: oneshot::Sender>, }, + LiveStreamingInvocation { + invocation: AgentInvocation, + sender: oneshot::Sender>, + cancellation: tokio_util::sync::CancellationToken, + }, SaveSnapshot, } +struct CancelLiveInvocationOnDrop(Option); + +impl Drop for CancelLiveInvocationOnDrop { + fn drop(&mut self) { + if let Some(cancellation) = self.0.take() { + cancellation.cancel(); + } + } +} + #[allow(clippy::large_enum_variant)] pub enum ResultOrSubscription { Finished(Result), diff --git a/golem-worker-executor/tests/agent.rs b/golem-worker-executor/tests/agent.rs index a1e48beb01..cc0d484681 100644 --- a/golem-worker-executor/tests/agent.rs +++ b/golem-worker-executor/tests/agent.rs @@ -14,7 +14,7 @@ use crate::Tracing; -use golem_api_grpc::proto::golem::workerexecutor; +use golem_api_grpc::proto::golem::worker::InvocationStart; use golem_common::model::agent::AgentMode; use golem_common::model::oplog::{OplogIndex, PublicOplogEntry}; use golem_common::model::worker::AgentConfigEntryDto; @@ -388,12 +388,14 @@ async fn immediate_scheduled_ephemeral_invocation_reuses_completed_result( AgentId::from_agent_id(component.id, &final_agent_id).map_err(anyhow::Error::msg)?; executor - .client - .clone() - .invoke_agent(workerexecutor::v1::InvokeAgentRequest { + .invoke_agent_session(InvocationStart { agent_id: Some(worker_id.into()), method_name: Some("changeAndGet".to_string()), - method_parameters: Some(SchemaValue::Tuple { elements: vec![] }.into()), + input: Some( + SchemaValue::Tuple { elements: vec![] } + .try_into() + .map_err(anyhow::Error::msg)?, + ), mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule as i32, schedule_at: None, idempotency_key: Some(idempotency_key.into()), @@ -402,8 +404,9 @@ async fn immediate_scheduled_ephemeral_invocation_reuses_completed_result( auth_ctx: Some(executor.auth_ctx().into()), context: None, principal: None, - freshness_disposition: workerexecutor::v1::InvocationFreshnessDisposition::MayExist - as i32, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, config: Vec::new(), }) .await?; @@ -438,12 +441,10 @@ async fn ephemeral_invocation_lookup_does_not_create_unknown_agent( AgentId::from_agent_id(component.id, &final_agent_id).map_err(anyhow::Error::msg)?; let response = executor - .client - .clone() - .invoke_agent(workerexecutor::v1::InvokeAgentRequest { + .invoke_agent_session(InvocationStart { agent_id: Some(worker_id.clone().into()), method_name: None, - method_parameters: None, + input: None, mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup as i32, schedule_at: None, idempotency_key: Some(idempotency_key.into()), @@ -452,19 +453,14 @@ async fn ephemeral_invocation_lookup_does_not_create_unknown_agent( auth_ctx: Some(executor.auth_ctx().into()), context: None, principal: None, - freshness_disposition: workerexecutor::v1::InvocationFreshnessDisposition::MayExist - as i32, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, config: Vec::new(), }) - .await? - .into_inner(); - - let success = match response.result { - Some(workerexecutor::v1::invoke_agent_response::Result::Success(success)) => success, - other => anyhow::bail!("unexpected lookup response: {other:?}"), - }; + .await?; assert_eq!( - success.status, + response.status, Some( golem_api_grpc::proto::golem::worker::InvocationStatus::from(InvocationStatus::Unknown,) as i32 @@ -502,12 +498,14 @@ async fn scheduled_ephemeral_invocation_uses_schedule_time_component_revision( AgentId::from_agent_id(component.id, &final_agent_id).map_err(anyhow::Error::msg)?; executor - .client - .clone() - .invoke_agent(workerexecutor::v1::InvokeAgentRequest { + .invoke_agent_session(InvocationStart { agent_id: Some(worker_id.clone().into()), method_name: Some("changeAndGet".to_string()), - method_parameters: Some(SchemaValue::Tuple { elements: vec![] }.into()), + input: Some( + SchemaValue::Tuple { elements: vec![] } + .try_into() + .map_err(anyhow::Error::msg)?, + ), mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule as i32, schedule_at: Some(prost_types::Timestamp { seconds: chrono::Utc::now().timestamp() + 3, @@ -519,8 +517,9 @@ async fn scheduled_ephemeral_invocation_uses_schedule_time_component_revision( auth_ctx: Some(executor.auth_ctx().into()), context: None, principal: None, - freshness_disposition: workerexecutor::v1::InvocationFreshnessDisposition::MayExist - as i32, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, config: Vec::new(), }) .await?; diff --git a/golem-worker-executor/tests/rpc.rs b/golem-worker-executor/tests/rpc.rs index f8dda85c50..e21214a80d 100644 --- a/golem-worker-executor/tests/rpc.rs +++ b/golem-worker-executor/tests/rpc.rs @@ -13,18 +13,27 @@ // limitations under the License. use crate::Tracing; +use golem_api_grpc::proto::golem::worker::{ + InvocationFrame, InvocationStart, invocation_frame, invocation_result, + invocation_session_finished, +}; +use golem_common::model::agent::ParsedAgentId; +use golem_common::model::component::ComponentDto; use golem_common::model::oplog::OplogIndex; -use golem_common::model::{AgentStatus, IdempotencyKey, PromiseId}; +use golem_common::model::{AgentId, AgentStatus, IdempotencyKey, PromiseId}; use golem_common::schema::schema_value::ResultValuePayload; -use golem_common::schema::{FromSchema, SchemaValue}; +use golem_common::schema::{FromSchema, SchemaValue, TypedSchemaValue}; use golem_common::{agent_id, data_value}; use golem_test_framework::dsl::TestDsl; use golem_worker_executor_test_utils::{ - LastUniqueId, PrecompiledComponent, TestContext, WorkerExecutorTestDependencies, start, + LastUniqueId, PrecompiledComponent, TestContext, TestWorkerExecutor, + WorkerExecutorTestDependencies, start, }; use pretty_assertions::assert_eq; use std::time::Duration; -use test_r::{inherit_test_dep, test}; +use test_r::{inherit_test_dep, test, timeout}; +use tokio::sync::mpsc; +use tokio_stream::wrappers::ReceiverStream; use tracing::Instrument; inherit_test_dep!(WorkerExecutorTestDependencies); @@ -43,6 +52,242 @@ inherit_test_dep!( ); inherit_test_dep!(Tracing); +async fn invoke_agent_session( + executor: &TestWorkerExecutor, + component: &ComponentDto, + agent_id: &ParsedAgentId, + method_name: &str, + params: TypedSchemaValue, +) -> anyhow::Result> { + let worker_agent_id = AgentId::from_agent_id(component.id, agent_id) + .map_err(|error| anyhow::anyhow!("invalid agent id: {error}"))?; + let (_, input) = params.into_parts(); + let input = input.try_into().map_err(anyhow::Error::msg)?; + let (frames, receiver) = mpsc::channel(8); + frames + .send(InvocationFrame { + frame: Some(invocation_frame::Frame::Start(InvocationStart { + agent_id: Some(worker_agent_id.into()), + method_name: Some(method_name.to_string()), + input: Some(input), + idempotency_key: Some(IdempotencyKey::fresh().into()), + context: None, + auth_ctx: Some(executor.auth_ctx().into()), + principal: None, + environment_id: Some(component.environment_id.into()), + config: Vec::new(), + component_owner_account_id: Some(component.account_id.into()), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + schedule_at: None, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + })), + }) + .await?; + let mut inbound = executor + .client + .clone() + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + let mut result = None; + while let Some(frame) = inbound.message().await? { + match frame.frame { + Some(invocation_frame::Frame::Result(value)) => { + if result.is_some() { + anyhow::bail!("invocation session returned more than one result"); + } + result = match value.result { + Some(invocation_result::Result::MethodResult(value)) => { + Some(value.try_into().map_err(anyhow::Error::msg)?) + } + Some(invocation_result::Result::NoResult(_)) | None => { + anyhow::bail!("invocation session returned no method result") + } + }; + } + Some(invocation_frame::Frame::Finished(finished)) => match finished.outcome { + Some(invocation_session_finished::Outcome::Success(_)) => { + return result.map(Ok).ok_or_else(|| { + anyhow::anyhow!("invocation session ended without a result") + }); + } + Some(invocation_session_finished::Outcome::Failure(failure)) => { + return Ok(Err(format!("{failure:?}"))); + } + Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { + return Ok(Err(failure.details)); + } + None => anyhow::bail!("invocation session completion has no outcome"), + }, + Some(other) => { + anyhow::bail!("unexpected outer invocation session frame: {other:?}") + } + None => anyhow::bail!("empty outer invocation session frame"), + } + } + anyhow::bail!("invocation session response ended before completion") +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn generated_rust_client_streaming_rpc_e2e( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let caller_agent_id = agent_id!("StreamingRpcCaller", "generated_streaming_rpc_e2e"); + let caller = executor + .start_agent(&component.id, caller_agent_id.clone()) + .await?; + + let result = invoke_agent_session( + &executor, + &component, + &caller_agent_id, + "run", + data_value!(), + ) + .await? + .map_err(anyhow::Error::msg)?; + let SchemaValue::Record { fields } = result else { + panic!("expected streaming RPC report record"); + }; + assert_eq!(fields.len(), 10); + assert_eq!( + fields[0], + SchemaValue::List { + elements: vec![ + SchemaValue::U32(1), + SchemaValue::U32(2), + SchemaValue::U32(3) + ] + } + ); + assert_eq!( + fields[1], + SchemaValue::List { + elements: vec![ + SchemaValue::U32(4), + SchemaValue::U32(5), + SchemaValue::U32(6) + ] + } + ); + assert_eq!( + fields[2], + SchemaValue::List { + elements: vec![ + SchemaValue::U32(70), + SchemaValue::U32(80), + SchemaValue::U32(90) + ] + } + ); + assert_eq!( + fields[3], + SchemaValue::List { + elements: vec![ + SchemaValue::String("left".to_string()), + SchemaValue::String("right".to_string()) + ] + } + ); + assert_eq!( + fields[4], + SchemaValue::List { + elements: vec![SchemaValue::U32(10), SchemaValue::U32(11)] + } + ); + assert_eq!( + fields[5], + SchemaValue::List { + elements: vec![ + SchemaValue::String("first".to_string()), + SchemaValue::String("second".to_string()) + ] + } + ); + assert_eq!( + fields[6], + SchemaValue::List { + elements: vec![ + SchemaValue::List { + elements: vec![SchemaValue::U32(1), SchemaValue::U32(2)] + }, + SchemaValue::List { + elements: vec![ + SchemaValue::U32(3), + SchemaValue::U32(4), + SchemaValue::U32(5) + ] + } + ] + } + ); + assert_eq!( + fields[7], + SchemaValue::List { + elements: vec![ + SchemaValue::String("a".to_string()), + SchemaValue::String("b".to_string()) + ] + } + ); + assert_eq!( + fields[8], + SchemaValue::List { + elements: (0..64).map(SchemaValue::U32).collect() + } + ); + assert_eq!(fields[9], SchemaValue::U64(42)); + + let producer_error = invoke_agent_session( + &executor, + &component, + &caller_agent_id, + "call_producer_error", + data_value!(), + ) + .await? + .expect_err("producer stream error must fail the invocation session"); + assert!( + producer_error.contains("value-node index out of range: 0"), + "unexpected producer error: {producer_error}" + ); + + let first = executor + .invoke_and_await_agent( + &component, + &caller_agent_id, + "call_stream_free", + data_value!(), + ) + .await? + .into_typed::()?; + let second = executor + .invoke_and_await_agent( + &component, + &caller_agent_id, + "call_stream_free", + data_value!(), + ) + .await? + .into_typed::()?; + assert_eq!((first, second), (1, 2)); + executor.check_oplog_is_queryable(&caller).await?; + Ok(()) +} + #[test] #[tracing::instrument] async fn rust_rpc_with_payload( diff --git a/golem-worker-service/src/custom_api/call_agent/mod.rs b/golem-worker-service/src/custom_api/call_agent/mod.rs index b2c7a07a05..323c9da2ec 100644 --- a/golem-worker-service/src/custom_api/call_agent/mod.rs +++ b/golem-worker-service/src/custom_api/call_agent/mod.rs @@ -106,7 +106,9 @@ impl CallAgentHandler { }; let proto_method_parameters: golem_api_grpc::proto::golem::schema::SchemaValue = - method_params_value.into(); + method_params_value.try_into().map_err(|error| { + anyhow!("method parameters cannot cross the worker boundary: {error}") + })?; let invocation_context = Some(golem_api_grpc::proto::golem::worker::InvocationContext { parent: None, @@ -133,7 +135,6 @@ impl CallAgentHandler { Vec::new(), AuthCtx::System, proto_principal, - Some(resolved_route.route.environment_id), ) .await?; diff --git a/golem-worker-service/src/grpcapi/worker.rs b/golem-worker-service/src/grpcapi/worker.rs index 5740849494..b7497e1e34 100644 --- a/golem-worker-service/src/grpcapi/worker.rs +++ b/golem-worker-service/src/grpcapi/worker.rs @@ -14,7 +14,11 @@ use super::error::WorkerTraceErrorKind; use super::{bad_request_error, validate_protobuf_agent_id}; -use crate::service::worker::{WorkerService, WorkerServiceError}; +use crate::service::worker::{ + InvocationRequestStream, InvocationResponseStream, WorkerService, WorkerServiceError, +}; +use futures::{Stream, StreamExt, stream}; +use golem_api_grpc::InvocationResponseState; use golem_api_grpc::proto::golem::common::Empty; use golem_api_grpc::proto::golem::worker::v1::worker_service_server::WorkerService as GrpcWorkerService; use golem_api_grpc::proto::golem::worker::v1::{ @@ -28,6 +32,13 @@ use golem_api_grpc::proto::golem::worker::v1::{ launch_new_worker_response, process_oplog_entries_response, resume_worker_response, revert_worker_response, update_worker_response, }; +use golem_api_grpc::proto::golem::worker::{ + InvocationFrame, InvocationProtocolFailure, InvocationSessionFinished, invocation_cancel, + invocation_frame, invocation_protocol_failure, invocation_session_finished, +}; +use golem_api_grpc::{ + expect_invocation_start, invocation_cancel_frame, validate_invocation_request_tail, +}; use golem_common::model::agent::InvocationFreshnessDisposition; use golem_common::model::component::{ComponentId, ComponentRevision}; use golem_common::model::oplog::OplogIndex; @@ -41,6 +52,119 @@ use std::sync::Arc; use tonic::{Request, Response, Status}; use tracing::Instrument; +fn service_failure_stream( + kind: invocation_protocol_failure::Kind, + details: String, +) -> InvocationResponseStream { + Box::pin(stream::once(async move { + Ok(protocol_failure_frame(kind, details)) + })) +} + +fn protocol_failure_frame( + kind: invocation_protocol_failure::Kind, + details: String, +) -> InvocationFrame { + InvocationFrame { + frame: Some(invocation_frame::Frame::Finished( + InvocationSessionFinished { + outcome: Some(invocation_session_finished::Outcome::ProtocolFailure( + InvocationProtocolFailure { + kind: kind as i32, + details, + }, + )), + }, + )), + } +} + +fn validated_response_stream(inbound: S) -> InvocationResponseStream +where + S: Stream> + Send + Unpin + 'static, +{ + Box::pin(stream::unfold( + Some((inbound, InvocationResponseState::default())), + |state| async move { + let (mut inbound, mut response_state) = state?; + match inbound.next().await { + Some(Ok(frame)) => match response_state.validate(&frame) { + Ok(()) if response_state.is_complete() => match inbound.next().await { + None => Some((Ok(frame), None)), + Some(Ok(frame_after_terminal)) => { + let details = + response_state.validate(&frame_after_terminal).unwrap_err(); + Some(( + Ok(protocol_failure_frame( + invocation_protocol_failure::Kind::Protocol, + details, + )), + None, + )) + } + Some(Err(error)) => Some(( + Ok(protocol_failure_frame( + invocation_protocol_failure::Kind::Transport, + error.to_string(), + )), + None, + )), + }, + Ok(()) => Some((Ok(frame), Some((inbound, response_state)))), + Err(details) => Some(( + Ok(protocol_failure_frame( + invocation_protocol_failure::Kind::Protocol, + details, + )), + None, + )), + }, + Some(Err(error)) => Some(( + Ok(protocol_failure_frame( + invocation_protocol_failure::Kind::Transport, + error.to_string(), + )), + None, + )), + None if response_state.is_complete() => None, + None => Some(( + Ok(protocol_failure_frame( + invocation_protocol_failure::Kind::Transport, + "invocation response transport closed before completion".to_string(), + )), + None, + )), + } + }, + )) +} + +fn validated_request_tail(inbound: S) -> InvocationRequestStream +where + S: Stream> + Send + Unpin + 'static, +{ + Box::pin(stream::unfold(Some(inbound), |state| async move { + let mut inbound = state?; + match inbound.next().await { + Some(Ok(frame)) => match validate_invocation_request_tail(frame) { + Ok(frame) => Some((frame, Some(inbound))), + Err(details) => Some(( + invocation_cancel_frame(invocation_cancel::Kind::Protocol, Some(details)), + None, + )), + }, + Some(Err(error)) => Some(( + invocation_cancel_frame( + invocation_cancel::Kind::Transport, + Some(error.to_string()), + ), + None, + )), + None => None, + } + })) +} + /// The only way to turn a wire-level freshness disposition into the internal /// [`InvocationFreshnessDisposition`]. Decoding and trust-sanitization are /// deliberately fused into a single function so that no gRPC entry point can @@ -53,8 +177,7 @@ fn sanitize_invocation_freshness_disposition( trusted_internal_caller: bool, ) -> InvocationFreshnessDisposition { let decoded = if wire_value - == golem_api_grpc::proto::golem::worker::v1::InvocationFreshnessDisposition::KnownFresh - as i32 + == golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::KnownFresh as i32 { InvocationFreshnessDisposition::KnownFresh } else { @@ -271,6 +394,100 @@ impl GrpcWorkerService for WorkerGrpcApi { })) } + type InvokeAgentSessionStream = InvocationResponseStream; + + async fn invoke_agent_session( + &self, + request: Request>, + ) -> Result, Status> { + let mut inbound = request.into_inner(); + let mut start = match inbound.message().await { + Ok(Some(frame)) => match expect_invocation_start(frame) { + Ok(start) => start, + Err(error) => { + return Ok(Response::new(service_failure_stream( + invocation_protocol_failure::Kind::Protocol, + error, + ))); + } + }, + Ok(None) => { + return Ok(Response::new(service_failure_stream( + invocation_protocol_failure::Kind::Protocol, + "invocation request ended before start".to_string(), + ))); + } + Err(error) => { + return Ok(Response::new(service_failure_stream( + invocation_protocol_failure::Kind::Transport, + error.to_string(), + ))); + } + }; + let auth = match start.auth_ctx.clone() { + Some(auth) => match auth.try_into() { + Ok(auth) => auth, + Err(error) => { + return Ok(Response::new(service_failure_stream( + invocation_protocol_failure::Kind::Protocol, + format!("failed converting auth_ctx: {error}"), + ))); + } + }, + None => { + return Ok(Response::new(service_failure_stream( + invocation_protocol_failure::Kind::Protocol, + "auth_ctx not found".to_string(), + ))); + } + }; + let trusted_internal_caller = matches!(&auth, AuthCtx::System | AuthCtx::Agent(_)); + start.freshness_disposition = match sanitize_invocation_freshness_disposition( + start.freshness_disposition, + trusted_internal_caller, + ) { + InvocationFreshnessDisposition::MayExist => { + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32 + } + InvocationFreshnessDisposition::KnownFresh => { + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::KnownFresh + as i32 + } + }; + let tail = validated_request_tail(inbound); + match self + .worker_service + .invoke_agent_session(start, tail, trusted_internal_caller, auth) + .await + { + Ok(response) => Ok(Response::new(validated_response_stream(response))), + Err(error) => { + let kind = match &error { + WorkerServiceError::AuthError(_) | WorkerServiceError::LimitError(_) => { + invocation_protocol_failure::Kind::Denied + } + WorkerServiceError::ComponentNotFound(_) + | WorkerServiceError::AgentNotFound(_) + | WorkerServiceError::AccountIdNotFound(_) => { + invocation_protocol_failure::Kind::NotFound + } + WorkerServiceError::TypeChecker(_) => { + invocation_protocol_failure::Kind::Protocol + } + WorkerServiceError::InternalCallError(_) => { + invocation_protocol_failure::Kind::Transport + } + _ => invocation_protocol_failure::Kind::RemoteInternal, + }; + Ok(Response::new(service_failure_stream( + kind, + error.to_string(), + ))) + } + } + } + async fn cancel_invocation( &self, request: Request, @@ -522,12 +739,6 @@ impl WorkerGrpcApi { .principal .unwrap_or_else(|| golem_common::model::agent::Principal::anonymous().into()); - let environment_id = request - .environment_id - .map(|id| id.try_into()) - .transpose() - .map_err(|e| bad_request_error(format!("invalid environment_id: {e}")))?; - let output = self .worker_service .invoke_agent( @@ -543,13 +754,16 @@ impl WorkerGrpcApi { config, auth, principal, - environment_id, ) .await?; let result_value = match &output.result { golem_common::model::AgentInvocationResult::AgentMethod { output } => { - Some(output.clone().into()) + Some(output.clone().try_into().map_err(|error| { + WorkerServiceError::Internal(format!( + "agent output cannot cross the gRPC boundary: {error}" + )) + })?) } _ => None, }; @@ -687,3 +901,132 @@ mod freshness_tests { ); } } + +#[cfg(test)] +mod protocol_tests { + use super::{validated_request_tail, validated_response_stream}; + use futures::{StreamExt, stream}; + use golem_api_grpc::proto::golem::common::Empty; + use golem_api_grpc::proto::golem::worker::invocation_session_finished::Outcome; + use golem_api_grpc::proto::golem::worker::{ + InvocationFrame, InvocationResult, InvocationSessionFinished, InvocationStart, + invocation_cancel, invocation_frame, invocation_protocol_failure, + }; + use test_r::test; + use tonic::Status; + + fn successful_completion() -> invocation_frame::Frame { + invocation_frame::Frame::Finished(InvocationSessionFinished { + outcome: Some(Outcome::Success(Empty {})), + }) + } + + #[test] + async fn request_transport_error_becomes_typed_cancellation() { + let inbound = stream::iter([Err(Status::unavailable("request transport failed"))]); + let mut tail = validated_request_tail(inbound); + + let frame = tail.next().await.unwrap().frame.unwrap(); + let invocation_frame::Frame::Cancel(cancel) = frame else { + panic!("expected cancellation frame"); + }; + assert_eq!( + invocation_cancel::Kind::try_from(cancel.kind).unwrap(), + invocation_cancel::Kind::Transport + ); + assert!(cancel.details.unwrap().contains("request transport failed")); + assert!(tail.next().await.is_none()); + } + + #[test] + async fn malformed_request_tail_becomes_protocol_cancellation() { + let inbound = stream::iter([Ok::<_, Status>(InvocationFrame { + frame: Some(invocation_frame::Frame::Start(InvocationStart::default())), + })]); + let mut tail = validated_request_tail(inbound); + + let frame = tail.next().await.unwrap().frame.unwrap(); + let invocation_frame::Frame::Cancel(cancel) = frame else { + panic!("expected cancellation frame"); + }; + assert_eq!( + invocation_cancel::Kind::try_from(cancel.kind).unwrap(), + invocation_cancel::Kind::Protocol + ); + assert!(cancel.details.unwrap().contains("first frame")); + assert!(tail.next().await.is_none()); + } + + #[test] + async fn response_transport_error_becomes_typed_failure() { + let inbound = stream::iter([Err(Status::unavailable("response transport failed"))]); + let mut response = validated_response_stream(inbound); + + let frame = response.next().await.unwrap().unwrap().frame.unwrap(); + assert!(matches!( + frame, + invocation_frame::Frame::Finished(InvocationSessionFinished { + outcome: Some(Outcome::ProtocolFailure(failure)), + }) if failure.kind == invocation_protocol_failure::Kind::Transport as i32 + && failure.details.contains("response transport failed") + )); + assert!(response.next().await.is_none()); + } + + #[test] + async fn valid_response_preserves_terminal_outcome() { + let inbound = stream::iter([ + Ok::<_, Status>(InvocationFrame { + frame: Some(invocation_frame::Frame::Result(InvocationResult::default())), + }), + Ok(InvocationFrame { + frame: Some(successful_completion()), + }), + ]); + let mut response = validated_response_stream(inbound); + + assert!(matches!( + response.next().await.unwrap().unwrap().frame, + Some(invocation_frame::Frame::Result(_)) + )); + assert!(matches!( + response.next().await.unwrap().unwrap().frame, + Some(invocation_frame::Frame::Finished( + InvocationSessionFinished { + outcome: Some(Outcome::Success(_)), + } + )) + )); + assert!(response.next().await.is_none()); + } + + #[test] + async fn repeated_response_terminal_becomes_protocol_failure() { + let inbound = stream::iter([ + Ok::<_, Status>(InvocationFrame { + frame: Some(invocation_frame::Frame::Result(InvocationResult::default())), + }), + Ok(InvocationFrame { + frame: Some(successful_completion()), + }), + Ok(InvocationFrame { + frame: Some(successful_completion()), + }), + ]); + let mut response = validated_response_stream(inbound); + + assert!(matches!( + response.next().await.unwrap().unwrap().frame, + Some(invocation_frame::Frame::Result(_)) + )); + let frame = response.next().await.unwrap().unwrap().frame.unwrap(); + assert!(matches!( + frame, + invocation_frame::Frame::Finished(InvocationSessionFinished { + outcome: Some(Outcome::ProtocolFailure(failure)), + }) if failure.kind == invocation_protocol_failure::Kind::Protocol as i32 + && failure.details.contains("after completion") + )); + assert!(response.next().await.is_none()); + } +} diff --git a/golem-worker-service/src/mcp/invoke/resource.rs b/golem-worker-service/src/mcp/invoke/resource.rs index e7bb29913d..6e597bb42a 100644 --- a/golem-worker-service/src/mcp/invoke/resource.rs +++ b/golem-worker-service/src/mcp/invoke/resource.rs @@ -82,7 +82,9 @@ pub async fn invoke_resource( let method_parameters = SchemaValue::Record { fields: vec![] }; let proto_method_parameters: golem_api_grpc::proto::golem::schema::SchemaValue = - method_parameters.into(); + method_parameters.try_into().map_err(|error| { + ErrorData::internal_error(format!("Failed to encode method parameters: {error}"), None) + })?; let principal = Principal::anonymous(); let proto_principal: golem_api_grpc::proto::golem::component::Principal = principal.into(); @@ -108,7 +110,6 @@ pub async fn invoke_resource( Vec::new(), auth_ctx, proto_principal, - None, ) .await .map_err(|e| { diff --git a/golem-worker-service/src/mcp/invoke/tool.rs b/golem-worker-service/src/mcp/invoke/tool.rs index 40f414eef0..860bd19f90 100644 --- a/golem-worker-service/src/mcp/invoke/tool.rs +++ b/golem-worker-service/src/mcp/invoke/tool.rs @@ -91,7 +91,9 @@ pub async fn invoke_tool( })?; let proto_method_parameters: golem_api_grpc::proto::golem::schema::SchemaValue = - method_parameters.into(); + method_parameters.try_into().map_err(|error| { + ErrorData::internal_error(format!("Failed to encode method parameters: {error}"), None) + })?; let principal = Principal::anonymous(); let proto_principal: golem_api_grpc::proto::golem::component::Principal = principal.into(); @@ -117,7 +119,6 @@ pub async fn invoke_tool( Vec::new(), auth_ctx, proto_principal, - None, ) .await .map_err(|e| { diff --git a/golem-worker-service/src/service/worker/client.rs b/golem-worker-service/src/service/worker/client.rs index 697d26b05f..cded1d27ef 100644 --- a/golem-worker-service/src/service/worker/client.rs +++ b/golem-worker-service/src/service/worker/client.rs @@ -21,7 +21,13 @@ use async_trait::async_trait; use bytes::Bytes; use futures::stream::TryStreamExt; use futures::{Stream, StreamExt}; -use golem_api_grpc::proto::golem::worker::{InvocationContext, LogEvent}; +use golem_api_grpc::proto::golem::worker::invocation_frame; +use golem_api_grpc::proto::golem::worker::invocation_result; +use golem_api_grpc::proto::golem::worker::invocation_session_finished; +use golem_api_grpc::proto::golem::worker::{ + InvocationContext, InvocationFrame, InvocationProtocolFailure, InvocationResult, + InvocationStart, LogEvent, +}; use golem_api_grpc::proto::golem::workerexecutor; use golem_api_grpc::proto::golem::workerexecutor::v1::worker_executor_client::WorkerExecutorClient; use golem_api_grpc::proto::golem::workerexecutor::v1::{ @@ -53,11 +59,14 @@ use golem_service_base::grpc::client::MultiTargetGrpcClient; use golem_service_base::model::auth::AuthCtx; use golem_service_base::model::{ComponentFileSystemNode, GetOplogResponse}; use golem_service_base::service::routing_table::{HasRoutingTableService, RoutingTableService}; +use std::future::Future; use std::pin::Pin; use std::sync::atomic::{AtomicBool, Ordering}; use std::{collections::HashMap, sync::Arc}; -use tonic::Code; +use tokio::sync::mpsc; +use tokio_stream::wrappers::ReceiverStream; use tonic::transport::Channel; +use tonic::{Code, Status}; use tonic_tracing_opentelemetry::middleware::client::OtelGrpcService; fn freshness_disposition_for_dispatch( @@ -73,6 +82,163 @@ fn freshness_disposition_for_dispatch( } } +pub type InvocationRequestStream = Pin + Send + 'static>>; +pub type InvocationResponseStream = + Pin> + Send + 'static>>; + +fn invoke_agent_session_once<'a>( + client: &'a mut WorkerExecutorClient>, + request: Option, +) -> Pin< + Box< + dyn Future>, Status>> + + Send + + 'a, + >, +> { + match request { + Some(request) => Box::pin(client.invoke_agent_session(request)), + None => Box::pin(std::future::ready(Err(Status::aborted( + "invocation session request was already consumed", + )))), + } +} + +#[derive(Debug)] +enum OneShotInvocationSessionResult { + Success(AgentInvocationOutput), + Failure(golem_api_grpc::proto::golem::worker::v1::WorkerExecutionError), + ProtocolFailure(InvocationProtocolFailure), +} + +fn protocol_failure(details: impl Into) -> OneShotInvocationSessionResult { + OneShotInvocationSessionResult::ProtocolFailure(InvocationProtocolFailure { + kind: golem_api_grpc::proto::golem::worker::invocation_protocol_failure::Kind::Protocol + as i32, + details: details.into(), + }) +} + +fn decode_invocation_result(wire: InvocationResult) -> Result { + let result = match wire.result.ok_or("invocation result has no payload")? { + invocation_result::Result::MethodResult(value) => AgentInvocationResult::AgentMethod { + output: value.try_into()?, + }, + invocation_result::Result::NoResult(_) => AgentInvocationResult::AgentInitialization, + }; + let invocation_status = result_status(wire.status); + Ok(AgentInvocationOutput { + result, + consumed_fuel: wire.fuel_consumed, + invocation_status, + component_revision: wire + .component_revision + .map(ComponentRevision::new) + .transpose() + .map_err(|error| error.to_string())?, + agent_id: wire.agent_id.map(TryInto::try_into).transpose()?, + idempotency_key: wire.idempotency_key.map(Into::into), + oplog_index: wire.oplog_index.map(OplogIndex::from_u64), + agent_fingerprint: wire + .agent_fingerprint + .map(|uuid| AgentFingerprint(uuid.into())), + }) +} + +fn result_status(status: Option) -> Option { + status.and_then(|status| { + golem_api_grpc::proto::golem::worker::InvocationStatus::try_from(status) + .ok() + .map(InvocationStatus::from) + }) +} + +async fn run_one_shot_invocation_session( + client: &mut WorkerExecutorClient>, + start: InvocationStart, +) -> Result { + let (requests, receiver) = mpsc::channel(1); + requests + .send(InvocationFrame { + frame: Some(invocation_frame::Frame::Start(start)), + }) + .await + .map_err(|_| Status::unavailable("invocation session request ended before start"))?; + let responses = client + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + collect_one_shot_invocation_session(responses).await +} + +async fn collect_one_shot_invocation_session( + mut responses: S, +) -> Result +where + S: Stream> + Unpin, +{ + let mut state = golem_api_grpc::InvocationResponseState::default(); + let mut result = None; + let mut terminal_outcome = None; + + while let Some(frame) = responses.next().await.transpose()? { + if let Err(details) = state.validate(&frame) { + return Ok(protocol_failure(details)); + } + match frame.frame { + Some(invocation_frame::Frame::Result(invocation_result)) => { + result = match decode_invocation_result(invocation_result) { + Ok(result) => Some(result), + Err(details) => return Ok(protocol_failure(details)), + }; + } + Some(invocation_frame::Frame::Finished(finished)) => { + terminal_outcome = Some(match finished.outcome { + Some(invocation_session_finished::Outcome::Success(_)) => result + .take() + .map(OneShotInvocationSessionResult::Success) + .ok_or_else(|| Status::internal("invocation completed without a result")), + Some(invocation_session_finished::Outcome::Failure(failure)) => { + Ok(OneShotInvocationSessionResult::Failure(failure)) + } + Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { + if failure.kind + == golem_api_grpc::proto::golem::worker::invocation_protocol_failure::Kind::Transport + as i32 + { + Err(Status::unavailable(failure.details)) + } else { + Ok(OneShotInvocationSessionResult::ProtocolFailure(failure)) + } + } + None => Ok(protocol_failure("invocation completion has no outcome")), + }); + } + Some( + invocation_frame::Frame::Demand(_) + | invocation_frame::Frame::Item(_) + | invocation_frame::Frame::End(_) + | invocation_frame::Frame::StreamError(_) + | invocation_frame::Frame::Detach(_), + ) => { + return Ok(protocol_failure( + "a non-streaming invocation received a stream frame", + )); + } + Some(invocation_frame::Frame::Start(_) | invocation_frame::Frame::Cancel(_)) => { + unreachable!("response validation rejects request frames") + } + None => unreachable!("response validation rejects empty frames"), + } + } + + terminal_outcome.unwrap_or_else(|| { + Err(Status::unavailable( + "invocation session response ended before completion", + )) + }) +} + #[async_trait] pub trait WorkerClient: Send + Sync { async fn create( @@ -262,6 +428,16 @@ pub trait WorkerClient: Send + Sync { principal: golem_api_grpc::proto::golem::component::Principal, ) -> WorkerResult; + async fn invoke_agent_session( + &self, + _agent_id: &AgentId, + _request: InvocationRequestStream, + ) -> WorkerResult { + Err(WorkerServiceError::Internal( + "invocation sessions are not supported by this worker client".to_string(), + )) + } + async fn process_oplog_entries( &self, target_agent_id: &AgentId, @@ -1391,89 +1567,45 @@ impl WorkerClient for WorkerExecutorWorkerClient { let result = self .call_worker_executor( agent_id.clone(), - "invoke_agent", + "invoke_agent_session", move |worker_executor_client| { let freshness_disposition = freshness_disposition_for_dispatch(freshness_disposition, &first_dispatch); - Box::pin(worker_executor_client.invoke_agent( - workerexecutor::v1::InvokeAgentRequest { - agent_id: Some(agent_id_clone.clone().into()), - method_name: method_name.clone(), - method_parameters: method_parameters.clone(), - mode, - schedule_at, - idempotency_key: idempotency_key.clone().map(|k| k.into()), - component_owner_account_id: Some(account_id.into()), - environment_id: Some(environment_id.into()), - auth_ctx: Some(auth_ctx.clone().into()), - context: invocation_context.clone(), - principal: Some(principal.clone()), - freshness_disposition: match freshness_disposition { - InvocationFreshnessDisposition::MayExist => { - workerexecutor::v1::InvocationFreshnessDisposition::MayExist - as i32 - } - InvocationFreshnessDisposition::KnownFresh => { - workerexecutor::v1::InvocationFreshnessDisposition::KnownFresh - as i32 - } - }, - config: config.clone().into_iter().map(Into::into).collect(), + let start = InvocationStart { + agent_id: Some(agent_id_clone.clone().into()), + method_name: method_name.clone(), + input: method_parameters.clone(), + idempotency_key: idempotency_key.clone().map(Into::into), + context: invocation_context.clone(), + auth_ctx: Some(auth_ctx.clone().into()), + principal: Some(principal.clone()), + environment_id: Some(environment_id.into()), + config: config.clone().into_iter().map(Into::into).collect(), + component_owner_account_id: Some(account_id.into()), + mode, + schedule_at, + freshness_disposition: match freshness_disposition { + InvocationFreshnessDisposition::MayExist => { + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32 + } + InvocationFreshnessDisposition::KnownFresh => { + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::KnownFresh + as i32 + } }, + }; + Box::pin(run_one_shot_invocation_session( + worker_executor_client, + start, )) }, - |response| match response.into_inner() { - workerexecutor::v1::InvokeAgentResponse { - result: - Some(workerexecutor::v1::invoke_agent_response::Result::Success( - workerexecutor::v1::InvokeAgentSuccess { - result, - fuel_consumed, - component_revision, - status, - oplog_index, - agent_fingerprint, - agent_id, - idempotency_key, - }, - )), - } => { - let invocation_result = match result { - Some(proto_val) => { - let output = golem_common::schema::SchemaValue::try_from(proto_val) - .map_err(WorkerExecutorError::unknown)?; - AgentInvocationResult::AgentMethod { output } - } - None => AgentInvocationResult::AgentInitialization, - }; - let invocation_status = status.and_then(|s| { - golem_api_grpc::proto::golem::worker::InvocationStatus::try_from(s) - .ok() - .map(InvocationStatus::from) - }); - Ok(AgentInvocationOutput { - result: invocation_result, - consumed_fuel: fuel_consumed, - invocation_status, - component_revision: component_revision - .map(ComponentRevision::new) - .transpose() - .map_err(|err| WorkerExecutorError::unknown(err.to_string()))?, - agent_id: agent_id - .map(TryInto::try_into) - .transpose() - .map_err(|err: String| WorkerExecutorError::unknown(err))?, - idempotency_key: idempotency_key.map(Into::into), - oplog_index: oplog_index.map(OplogIndex::from_u64), - agent_fingerprint: agent_fingerprint - .map(|uuid| AgentFingerprint(uuid.into())), - }) + |outcome| match outcome { + OneShotInvocationSessionResult::Success(output) => Ok(output), + OneShotInvocationSessionResult::Failure(error) => Err(error.into()), + OneShotInvocationSessionResult::ProtocolFailure(failure) => { + Err(WorkerExecutorError::invalid_request(failure.details).into()) } - workerexecutor::v1::InvokeAgentResponse { - result: - Some(workerexecutor::v1::invoke_agent_response::Result::Failure(err)), - } => Err(err.into()), - workerexecutor::v1::InvokeAgentResponse { .. } => Err("Empty response".into()), }, WorkerServiceError::InternalCallError, ) @@ -1482,6 +1614,48 @@ impl WorkerClient for WorkerExecutorWorkerClient { Ok(result) } + async fn invoke_agent_session( + &self, + agent_id: &AgentId, + request: InvocationRequestStream, + ) -> WorkerResult { + let routing_table = self + .routing_table_service + .get_routing_table() + .await + .map_err(|error| { + WorkerServiceError::InternalCallError( + CallWorkerExecutorError::FailedToGetRoutingTable(error), + ) + })?; + let pod = routing_table.lookup(agent_id).ok_or_else(|| { + WorkerServiceError::InternalCallError(CallWorkerExecutorError::FailedToConnectToPod( + Status::unavailable(format!("no active shard for agent {agent_id}")), + )) + })?; + let request = Arc::new(std::sync::Mutex::new(Some(request))); + let response = self + .worker_executor_clients + .call_without_retry( + "invoke_agent_session", + pod.uri(self.worker_executor_clients.uses_tls()), + move |worker_executor_client| { + let request = request + .lock() + .unwrap_or_else(|poison| poison.into_inner()) + .take(); + invoke_agent_session_once(worker_executor_client, request) + }, + ) + .await + .map_err(|status| { + WorkerServiceError::InternalCallError( + CallWorkerExecutorError::FailedToConnectToPod(status), + ) + })?; + Ok(Box::pin(response.into_inner())) + } + async fn process_oplog_entries( &self, target_agent_id: &AgentId, @@ -1600,3 +1774,145 @@ mod freshness_tests { ); } } + +#[cfg(test)] +mod one_shot_session_tests { + use super::{OneShotInvocationSessionResult, collect_one_shot_invocation_session}; + use futures::stream; + use golem_api_grpc::proto::golem::common::Empty; + use golem_api_grpc::proto::golem::worker::invocation_result; + use golem_api_grpc::proto::golem::worker::invocation_session_finished::Outcome; + use golem_api_grpc::proto::golem::worker::v1::WorkerExecutionError; + use golem_api_grpc::proto::golem::worker::{ + InvocationFrame, InvocationProtocolFailure, InvocationResult, InvocationSessionFinished, + InvocationStatus, invocation_frame, invocation_protocol_failure, + }; + use golem_common::model::InvocationStatus as ModelInvocationStatus; + use test_r::test; + use tonic::Status; + + fn frame(frame: invocation_frame::Frame) -> Result { + Ok(InvocationFrame { frame: Some(frame) }) + } + + fn finished(outcome: Outcome) -> invocation_frame::Frame { + invocation_frame::Frame::Finished(InvocationSessionFinished { + outcome: Some(outcome), + }) + } + + fn no_result() -> invocation_frame::Frame { + invocation_frame::Frame::Result(InvocationResult { + result: Some(invocation_result::Result::NoResult(Empty {})), + ..Default::default() + }) + } + + #[test] + async fn successful_session_preserves_unary_result_metadata() { + let responses = stream::iter([ + frame(invocation_frame::Frame::Result(InvocationResult { + result: Some(invocation_result::Result::NoResult(Empty {})), + fuel_consumed: Some(17), + component_revision: Some(3), + status: Some(InvocationStatus::Complete as i32), + oplog_index: Some(29), + agent_fingerprint: None, + agent_id: None, + idempotency_key: None, + })), + frame(finished(Outcome::Success(Empty {}))), + ]); + + let result = collect_one_shot_invocation_session(responses) + .await + .unwrap(); + let OneShotInvocationSessionResult::Success(output) = result else { + panic!("expected a successful invocation session"); + }; + assert_eq!(output.consumed_fuel, Some(17)); + assert_eq!(output.component_revision.unwrap().get(), 3); + assert_eq!( + output.invocation_status, + Some(ModelInvocationStatus::Complete) + ); + assert_eq!(u64::from(output.oplog_index.unwrap()), 29); + } + + #[test] + async fn structured_executor_failure_survives_the_session_adapter() { + let responses = stream::iter([frame(finished(Outcome::Failure( + WorkerExecutionError::default(), + )))]); + + let result = collect_one_shot_invocation_session(responses) + .await + .unwrap(); + assert!(matches!( + result, + OneShotInvocationSessionResult::Failure(WorkerExecutionError { error: None }) + )); + } + + #[test] + async fn successful_completion_before_result_is_a_protocol_failure() { + let responses = stream::iter([frame(finished(Outcome::Success(Empty {})))]); + + let result = collect_one_shot_invocation_session(responses) + .await + .unwrap(); + assert!(matches!( + result, + OneShotInvocationSessionResult::ProtocolFailure(failure) + if failure.details.contains("before publishing a result") + )); + } + + #[test] + async fn session_is_drained_and_rejects_frames_after_completion() { + let responses = stream::iter([ + frame(no_result()), + frame(finished(Outcome::Success(Empty {}))), + frame(no_result()), + ]); + + let result = collect_one_shot_invocation_session(responses) + .await + .unwrap(); + assert!(matches!( + result, + OneShotInvocationSessionResult::ProtocolFailure(failure) + if failure.details.contains("after completion") + )); + } + + #[test] + async fn response_transport_error_after_completion_is_retriable() { + let responses = stream::iter([ + frame(no_result()), + frame(finished(Outcome::Success(Empty {}))), + Err(Status::unavailable("response did not close cleanly")), + ]); + + let error = collect_one_shot_invocation_session(responses) + .await + .unwrap_err(); + assert_eq!(error.code(), tonic::Code::Unavailable); + } + + #[test] + async fn typed_transport_failure_is_retriable() { + let responses = stream::iter([frame(finished(Outcome::ProtocolFailure( + InvocationProtocolFailure { + kind: invocation_protocol_failure::Kind::Transport as i32, + details: "request transport failed".to_string(), + }, + )))]); + + let error = collect_one_shot_invocation_session(responses) + .await + .unwrap_err(); + assert_eq!(error.code(), tonic::Code::Unavailable); + assert!(error.message().contains("request transport failed")); + } +} diff --git a/golem-worker-service/src/service/worker/service.rs b/golem-worker-service/src/service/worker/service.rs index 3be7d2c6e4..0413b7dea6 100644 --- a/golem-worker-service/src/service/worker/service.rs +++ b/golem-worker-service/src/service/worker/service.rs @@ -13,7 +13,10 @@ // limitations under the License. use super::WorkerResult; -use super::{ConnectWorkerStream, WorkerClient, WorkerServiceError}; +use super::{ + ConnectWorkerStream, InvocationRequestStream, InvocationResponseStream, WorkerClient, + WorkerServiceError, +}; use crate::api::agents::{ AgentInvocationMode, AgentInvocationRequest, AgentInvocationResult, CreateAgentRequest, CreateAgentResponse, @@ -23,8 +26,10 @@ use crate::service::auth::{AuthService, AuthServiceError}; use crate::service::component::ComponentService; use crate::service::limit::LimitService; use bytes::Bytes; -use futures::Stream; -use golem_api_grpc::proto::golem::worker::InvocationContext; +use futures::{Stream, StreamExt, stream}; +use golem_api_grpc::proto::golem::worker::{ + InvocationContext, InvocationFrame, InvocationStart, invocation_frame, +}; use golem_common::model::AgentInvocationOutput; use golem_common::model::account::AccountId; use golem_common::model::agent::{ @@ -934,13 +939,12 @@ impl WorkerService { config: Vec, auth_ctx: AuthCtx, principal: golem_api_grpc::proto::golem::component::Principal, - known_environment_id: Option, ) -> WorkerResult { let component = self .component_service .get_current_by_id(agent_id.component_id) .await?; - let environment_id = known_environment_id.unwrap_or(component.environment_id); + let environment_id = component.environment_id; let account_id = component.account_id; self.dispatch_agent_invocation( &component, @@ -976,6 +980,83 @@ impl WorkerService { .await } + pub async fn invoke_agent_session( + &self, + mut start: InvocationStart, + tail: InvocationRequestStream, + allow_derived_ephemeral_phantom: bool, + auth_ctx: AuthCtx, + ) -> WorkerResult { + let agent_id: AgentId = start + .agent_id + .clone() + .ok_or_else(|| WorkerServiceError::TypeChecker("agent_id not found".to_string()))? + .try_into() + .map_err(WorkerServiceError::TypeChecker)?; + let component = self + .component_service + .get_current_by_id(agent_id.component_id) + .await?; + let observation_only = + start.mode() == golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup; + let freshness_disposition = if start.freshness_disposition() + == golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::KnownFresh + { + InvocationFreshnessDisposition::KnownFresh + } else { + InvocationFreshnessDisposition::MayExist + }; + let (agent_id, idempotency_key, mut freshness_disposition) = + normalize_agent_invocation_identity( + &component, + &agent_id, + start.idempotency_key.clone().map(Into::into), + allow_derived_ephemeral_phantom, + observation_only, + freshness_disposition, + )?; + if observation_only { + freshness_disposition = InvocationFreshnessDisposition::MayExist; + } + authorize_agent_permission( + &auth_ctx, + &component, + &agent_id, + agent_verb_for_invocation_mode(start.mode), + start + .method_name + .as_ref() + .map(|method_name| { + AgentResourcePattern::Method(AgentMethodName(method_name.clone())) + }) + .unwrap_or(AgentResourcePattern::Any), + )?; + + start.agent_id = Some(agent_id.clone().into()); + start.idempotency_key = Some(idempotency_key.into()); + start.environment_id = Some(component.environment_id.into()); + start.component_owner_account_id = Some(component.account_id.into()); + start.freshness_disposition = match freshness_disposition { + InvocationFreshnessDisposition::MayExist => { + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32 + } + InvocationFreshnessDisposition::KnownFresh => { + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::KnownFresh + as i32 + } + }; + let request = stream::once(async move { + InvocationFrame { + frame: Some(invocation_frame::Frame::Start(start)), + } + }) + .chain(tail); + self.worker_client + .invoke_agent_session(&agent_id, Box::pin(request)) + .await + } + /// Shared invocation-dispatch core: normalizes the invocation identity, /// authorizes against the final agent id, dispatches to the executor, and /// backfills the final identity into the invocation output. @@ -1210,7 +1291,11 @@ impl WorkerService { .1; let proto_method_parameters: golem_api_grpc::proto::golem::schema::SchemaValue = - method_parameters.into(); + method_parameters.try_into().map_err(|error| { + WorkerServiceError::TypeChecker(format!( + "Agent method parameters cannot cross the worker boundary: {error}" + )) + })?; let proto_mode = match request.mode { AgentInvocationMode::Await => { @@ -1843,6 +1928,7 @@ mod tests { struct RecordingWorkerClient { created_agent_ids: Mutex>, invocations: Mutex>, + invocation_environments: Mutex>, invocation_output: AgentInvocationOutput, } @@ -1851,6 +1937,7 @@ mod tests { Self { created_agent_ids: Mutex::new(Vec::new()), invocations: Mutex::new(Vec::new()), + invocation_environments: Mutex::new(Vec::new()), invocation_output, } } @@ -1866,6 +1953,10 @@ mod tests { fn invocations(&self) -> Vec<(AgentId, IdempotencyKey, InvocationFreshnessDisposition)> { self.invocations.lock().unwrap().clone() } + + fn invocation_environment(&self) -> EnvironmentId { + self.invocation_environments.lock().unwrap()[0] + } } #[async_trait] @@ -2089,7 +2180,7 @@ mod tests { _: Option, freshness_disposition: InvocationFreshnessDisposition, _: Vec, - _: EnvironmentId, + environment_id: EnvironmentId, _: AccountId, _: AuthCtx, _: golem_api_grpc::proto::golem::component::Principal, @@ -2099,6 +2190,10 @@ mod tests { idempotency_key.expect("worker service should supply an idempotency key"), freshness_disposition, )); + self.invocation_environments + .lock() + .unwrap() + .push(environment_id); Ok(self.invocation_output.clone()) } @@ -2125,6 +2220,7 @@ mod tests { agent_type_name: AgentTypeName, component_id: ComponentId, component_revision: ComponentRevision, + environment_id: EnvironmentId, } impl RestHarness { @@ -2188,6 +2284,7 @@ mod tests { agent_type_name, component_id, component_revision, + environment_id, } } @@ -2356,6 +2453,10 @@ mod tests { Some(harness.component_revision) ); assert_eq!(response.agent_id, harness.worker_client.invoked_agent_id()); + assert_eq!( + harness.worker_client.invocation_environment(), + harness.environment_id + ); assert!(phantom_id(&response.agent_id).is_some()); let invocations = harness.worker_client.invocations(); assert_eq!(invocations.len(), 1); @@ -2475,7 +2576,6 @@ mod tests { Vec::new(), AuthCtx::system(), Principal::anonymous().into(), - None, ) .await .unwrap(); diff --git a/integration-tests/tests/api/mod.rs b/integration-tests/tests/api/mod.rs index 9e1e068c90..df144c20df 100644 --- a/integration-tests/tests/api/mod.rs +++ b/integration-tests/tests/api/mod.rs @@ -30,6 +30,7 @@ mod resource_definition; mod retry_policies; mod rpc_auth; mod security_schemes; +mod streaming_rpc; use golem_test_framework::config::EnvBasedTestDependencies; use test_r::inherit_test_dep; diff --git a/integration-tests/tests/api/streaming_rpc.rs b/integration-tests/tests/api/streaming_rpc.rs new file mode 100644 index 0000000000..d31072dc91 --- /dev/null +++ b/integration-tests/tests/api/streaming_rpc.rs @@ -0,0 +1,271 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use golem_api_grpc::proto::golem::worker::v1::worker_service_client::WorkerServiceClient; +use golem_api_grpc::proto::golem::worker::{ + InvocationFrame, InvocationStart, invocation_frame, invocation_result, + invocation_session_finished, +}; +use golem_client::model::ComponentDto; +use golem_common::model::agent::ParsedAgentId; +use golem_common::model::{AgentId, IdempotencyKey, RoutingTable}; +use golem_common::schema::{SchemaValue, TypedSchemaValue}; +use golem_common::{agent_id, data_value}; +use golem_service_base::model::auth::AuthCtx; +use golem_test_framework::config::{EnvBasedTestDependencies, TestDependencies}; +use golem_test_framework::dsl::{TestDsl, TestDslExtended}; +use test_r::{inherit_test_dep, test, timeout}; +use tokio::sync::mpsc; +use tokio_stream::wrappers::ReceiverStream; + +inherit_test_dep!(EnvBasedTestDependencies); + +fn cross_executor_agent_name( + component: &ComponentDto, + routing_table: &RoutingTable, +) -> anyhow::Result { + for index in 0..10_000 { + let name = format!("generated-streaming-rpc-cross-{index}"); + let caller = agent_id!("StreamingRpcCaller", name.clone()); + let target = agent_id!("StreamingRpcTarget", name.clone()); + let caller = AgentId::from_agent_id(component.id, &caller) + .map_err(|error| anyhow::anyhow!("invalid caller agent id: {error}"))?; + let target = AgentId::from_agent_id(component.id, &target) + .map_err(|error| anyhow::anyhow!("invalid target agent id: {error}"))?; + let caller_pod = routing_table + .lookup(&caller) + .ok_or_else(|| anyhow::anyhow!("caller agent has no executor assignment"))?; + let target_pod = routing_table + .lookup(&target) + .ok_or_else(|| anyhow::anyhow!("target agent has no executor assignment"))?; + if caller_pod != target_pod { + return Ok(name); + } + } + + anyhow::bail!("could not find caller and target agent IDs assigned to different executors") +} + +async fn invoke_agent_session( + deps: &EnvBasedTestDependencies, + component: &ComponentDto, + agent_id: &ParsedAgentId, + method_name: &str, + params: TypedSchemaValue, +) -> anyhow::Result> { + let agent_id = AgentId::from_agent_id(component.id, agent_id) + .map_err(|error| anyhow::anyhow!("invalid agent id: {error}"))?; + let (_, input) = params.into_parts(); + let input = input.try_into().map_err(anyhow::Error::msg)?; + let (frames, receiver) = mpsc::channel(8); + frames + .send(InvocationFrame { + frame: Some(invocation_frame::Frame::Start(InvocationStart { + agent_id: Some(agent_id.into()), + method_name: Some(method_name.to_string()), + input: Some(input), + idempotency_key: Some(IdempotencyKey::fresh().into()), + context: None, + auth_ctx: Some(AuthCtx::System.into()), + principal: None, + environment_id: None, + config: Vec::new(), + component_owner_account_id: None, + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + schedule_at: None, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + })), + }) + .await?; + + let worker_service = deps.worker_service(); + let mut client = WorkerServiceClient::connect(format!( + "http://{}:{}", + worker_service.grpc_host(), + worker_service.gprc_port() + )) + .await?; + let mut inbound = client + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + let mut result = None; + while let Some(frame) = inbound.message().await? { + match frame.frame { + Some(invocation_frame::Frame::Result(value)) => { + if result.is_some() { + anyhow::bail!("invocation session returned more than one result"); + } + result = match value.result { + Some(invocation_result::Result::MethodResult(value)) => { + Some(value.try_into().map_err(anyhow::Error::msg)?) + } + Some(invocation_result::Result::NoResult(_)) | None => { + anyhow::bail!("invocation session returned no method result") + } + }; + } + Some(invocation_frame::Frame::Finished(finished)) => match finished.outcome { + Some(invocation_session_finished::Outcome::Success(_)) => { + return result.map(Ok).ok_or_else(|| { + anyhow::anyhow!("invocation session ended without a result") + }); + } + Some(invocation_session_finished::Outcome::Failure(failure)) => { + return Ok(Err(format!("{failure:?}"))); + } + Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { + return Ok(Err(failure.details)); + } + None => anyhow::bail!("invocation session completion has no outcome"), + }, + Some(other) => { + anyhow::bail!("unexpected outer invocation session frame: {other:?}") + } + None => anyhow::bail!("empty outer invocation session frame"), + } + } + anyhow::bail!("invocation session response ended before completion") +} + +fn assert_streaming_report(value: SchemaValue) { + assert_eq!( + value, + SchemaValue::Record { + fields: vec![ + SchemaValue::List { + elements: vec![ + SchemaValue::U32(1), + SchemaValue::U32(2), + SchemaValue::U32(3), + ], + }, + SchemaValue::List { + elements: vec![ + SchemaValue::U32(4), + SchemaValue::U32(5), + SchemaValue::U32(6), + ], + }, + SchemaValue::List { + elements: vec![ + SchemaValue::U32(70), + SchemaValue::U32(80), + SchemaValue::U32(90), + ], + }, + SchemaValue::List { + elements: vec![ + SchemaValue::String("left".to_string()), + SchemaValue::String("right".to_string()), + ], + }, + SchemaValue::List { + elements: vec![SchemaValue::U32(10), SchemaValue::U32(11)], + }, + SchemaValue::List { + elements: vec![ + SchemaValue::String("first".to_string()), + SchemaValue::String("second".to_string()), + ], + }, + SchemaValue::List { + elements: vec![ + SchemaValue::List { + elements: vec![SchemaValue::U32(1), SchemaValue::U32(2)], + }, + SchemaValue::List { + elements: vec![ + SchemaValue::U32(3), + SchemaValue::U32(4), + SchemaValue::U32(5), + ], + }, + ], + }, + SchemaValue::List { + elements: vec![ + SchemaValue::String("a".to_string()), + SchemaValue::String("b".to_string()), + ], + }, + SchemaValue::List { + elements: (0..64).map(SchemaValue::U32).collect(), + }, + SchemaValue::U64(42), + ], + } + ); +} + +#[test] +#[timeout("4 minutes")] +#[tracing::instrument] +async fn generated_rust_client_streaming_rpc_cross_executor( + deps: &EnvBasedTestDependencies, +) -> anyhow::Result<()> { + let user = deps.user().await?; + let (_, environment) = user.app_and_env().await?; + let component = user + .component(&environment.id, "golem_it_agent_rpc_rust_release") + .name("golem-it:agent-rpc-rust") + .unique() + .store() + .await?; + let routing_table = deps.shard_manager().get_routing_table().await?; + let name = cross_executor_agent_name(&component, &routing_table)?; + let caller_agent_id = agent_id!("StreamingRpcCaller", name); + + let result = invoke_agent_session(deps, &component, &caller_agent_id, "run", data_value!()) + .await? + .map_err(anyhow::Error::msg)?; + assert_streaming_report(result); + + let producer_error = invoke_agent_session( + deps, + &component, + &caller_agent_id, + "call_producer_error", + data_value!(), + ) + .await? + .expect_err("producer stream error must fail the invocation session"); + assert!( + producer_error.contains("value-node index out of range: 0"), + "unexpected producer error: {producer_error}" + ); + + let first = user + .invoke_and_await_agent( + &component, + &caller_agent_id, + "call_stream_free", + data_value!(), + ) + .await? + .into_typed::()?; + let second = user + .invoke_and_await_agent( + &component, + &caller_agent_id, + "call_stream_free", + data_value!(), + ) + .await? + .into_typed::()?; + assert_eq!((first, second), (1, 2)); + Ok(()) +} diff --git a/sdks/moonbit/AGENTS.md b/sdks/moonbit/AGENTS.md index 21f054c4d7..b872eefc31 100644 --- a/sdks/moonbit/AGENTS.md +++ b/sdks/moonbit/AGENTS.md @@ -154,14 +154,14 @@ files. Regenerate with the script, which requires this exact revision of the ```sh cargo install --locked --git https://github.com/golemcloud/wit-bindgen \ - --rev 4407232ead86d9bcbd06cbebd790a52120a4087a wit-bindgen-cli + --rev e759a320fdd1ecad92dc484af59cfc0c5fff38c6 wit-bindgen-cli ``` The pin incorporates Bytecode Alliance's draft [MoonBit component-model async PR #1659](https://github.com/bytecodealliance/wit-bindgen/pull/1659) -and Golem's additional outline-lift, named-memory-lowering, and export-disambiguation changes. -Released wit-bindgen and upstream `main` do not yet generate the async MoonBit exports required by -this SDK. +and Golem's additional outline-lift, named-memory-lowering, export-disambiguation, and deterministic +emission changes. Released wit-bindgen and upstream `main` do not yet generate the async MoonBit +exports required by this SDK. ```sh cd golem_sdk @@ -526,10 +526,11 @@ published to mooncakes.io for the release template to work. ## Dependencies & Tools - **wit-bindgen** — Golem's fork pinned at - `4407232ead86d9bcbd06cbebd790a52120a4087a`. It combines draft upstream PR #1659's MoonBit + `e759a320fdd1ecad92dc484af59cfc0c5fff38c6`. It combines draft upstream PR #1659's MoonBit component-model async support with Golem's outline-lift, named-memory-lowering, and export - disambiguation changes. Bindings are regenerated via `scripts/regen-bindings.sh`, which rejects - any other generator revision and applies the s8/s16 sign-extension fix in post-processing. + disambiguation changes, and emits deterministic bindings. Bindings are regenerated via + `scripts/regen-bindings.sh`, which rejects any other generator revision and applies the s8/s16 + sign-extension fix in post-processing. - **wasm-tools** — `component embed` (adds WIT type info) and `component new` (creates the Component Model WASM). - **moon** — MoonBit build tool. diff --git a/sdks/moonbit/golem_sdk/agents/agents.mbt b/sdks/moonbit/golem_sdk/agents/agents.mbt index bea7afefda..41231a3c6b 100644 --- a/sdks/moonbit/golem_sdk/agents/agents.mbt +++ b/sdks/moonbit/golem_sdk/agents/agents.mbt @@ -76,7 +76,7 @@ pub(all) struct ConstructedAgent { pub(all) struct RegisteredAgent { name : String agent_type : @common.AgentType - construct : (@types.SchemaValueTree, @common.Principal) -> Result[ + construct : async (@types.SchemaValueTree, @common.Principal) -> Result[ ConstructedAgent, @common.AgentError, ] @@ -97,7 +97,7 @@ pub(all) struct AgentInstance { ///| /// Constructs an agent and sets it as the current instance. /// Shared logic used by both `initialize` and snapshot-based `load`. -pub fn construct_and_set_instance( +pub async fn construct_and_set_instance( agent_type : String, input : @types.SchemaValueTree, principal : @common.Principal, diff --git a/sdks/moonbit/golem_sdk/agents/dispatch.mbt b/sdks/moonbit/golem_sdk/agents/dispatch.mbt index 8215491136..2f639805dc 100644 --- a/sdks/moonbit/golem_sdk/agents/dispatch.mbt +++ b/sdks/moonbit/golem_sdk/agents/dispatch.mbt @@ -12,24 +12,28 @@ /// Decodes an invocation/constructor input wire value into its ordered /// parameter values, validating that it is a record of exactly `arity` fields. /// Decode and shape errors are mapped to `AgentError::InvalidInput`. -pub fn decode_invocation_input( +pub async fn decode_invocation_input( input : @types.SchemaValueTree, arity : Int, context : String, ) -> Array[@model.SchemaValue] raise @common.AgentError { - let value = @model.schema_value_from_wit(input) catch { + let drops = @model_host.resource_drops() + let value = @model_host.schema_value_from_wit(input) catch { e => raise @common.AgentError::InvalidInput( "\{context}: invalid schema value input: \{e}", ) } let fields = @schema.expect_record(value, context) catch { - e => + e => { + value.release_resources(drops) raise @common.AgentError::InvalidInput( "\{context}: expected a record input: \{e}", ) + } } guard fields.length() == arity else { + value.release_resources(drops) raise @common.AgentError::InvalidInput( "\{context}: expected \{arity} parameter(s), got \{fields.length()}", ) @@ -44,32 +48,54 @@ pub fn[T : @schema.FromSchema] decode_param( fields : Array[@model.SchemaValue], index : Int, context : String, +) -> T raise @common.AgentError { + decode_param_with_resource_drops( + fields, + index, + context, + @model_host.resource_drops(), + ) +} + +///| +fn[T : @schema.FromSchema] decode_param_with_resource_drops( + fields : Array[@model.SchemaValue], + index : Int, + context : String, + drops : @model.SchemaValueResourceDrops, ) -> T raise @common.AgentError { let field = @schema.record_field(fields, index, context) catch { - e => + e => { + @model.SchemaValue::Record(fields).release_resources(drops) raise @common.AgentError::InvalidInput( "\{context}: missing parameter \{index}: \{e}", ) + } } @schema.from_value_as(field) catch { - e => + e => { + @model.SchemaValue::Record(fields).release_resources(drops) raise @common.AgentError::InvalidInput( "\{context}: failed decoding parameter \{index}: \{e}", ) + } } } ///| /// Encodes a method/constructor return value into a wire output value. /// Serialization errors are mapped to `AgentError::InvalidType`. -pub fn[T : @schema.IntoSchema] encode_output( +pub async fn[T : @schema.IntoSchema] encode_output( value : T, ) -> @types.SchemaValueTree raise @common.AgentError { - @model.schema_value_to_wit(@schema.to_value_as(value)) catch { - e => + let model_value = @schema.to_value_as(value) + @model.schema_value_to_wit_async(model_value) catch { + e => { + model_value.release_resources(@model_host.resource_drops()) raise @common.AgentError::InvalidType( "failed serializing return value: \{e}", ) + } } } @@ -80,31 +106,74 @@ pub fn[T : @schema.IntoSchema] encode_output( pub fn encode_invocation_input( values : Array[@model.SchemaValue], ) -> @types.SchemaValueTree raise @common.AgentError { - @model.schema_value_to_wit(@model.SchemaValue::Record(values)) catch { - e => + let model_value = @model.SchemaValue::Record(values) + @model.schema_value_to_wit(model_value) catch { + e => { + model_value.release_resources(@model_host.resource_drops()) + raise @common.AgentError::InvalidInput( + "failed encoding invocation input: \{e}", + ) + } + } +} + +///| +/// Asynchronously encodes the ordered parameter values of an awaited +/// invocation, including native streams nested anywhere in the input record. +pub async fn encode_invocation_input_async( + values : Array[@model.SchemaValue], +) -> @types.SchemaValueTree raise @common.AgentError { + let model_value = @model.SchemaValue::Record(values) + @model.schema_value_to_wit_async(model_value) catch { + e => { + model_value.release_resources(@model_host.resource_drops()) raise @common.AgentError::InvalidInput( "failed encoding invocation input: \{e}", ) + } } } ///| /// Decodes the single output value of an RPC invocation result. /// Decode errors are mapped to `AgentError::InvalidType`. -pub fn[T : @schema.FromSchema] decode_output( +pub async fn[T : @schema.FromSchema] decode_output( output : @types.SchemaValueTree, context : String, ) -> T raise @common.AgentError { - let value = @model.schema_value_from_wit(output) catch { + let drops = @model_host.resource_drops() + let value = @model_host.schema_value_from_wit(output) catch { e => raise @common.AgentError::InvalidType( "\{context}: invalid schema value output: \{e}", ) } @schema.from_value_as(value) catch { - e => + e => { + value.release_resources(drops) raise @common.AgentError::InvalidType( "\{context}: failed decoding return value: \{e}", ) + } + } +} + +///| +/// Releases a wire value that cannot be delivered to an agent method. +pub fn discard_wire_value(value : @types.SchemaValueTree) -> Unit { + let drops = @model_host.resource_drops() + try @model_host.schema_value_from_wit(value) catch { + _ => () + } noraise { + decoded => decoded.release_resources(drops) + } +} + +///| +/// Releases an optional invocation result that the caller does not consume. +pub fn discard_optional_wire_value(value : @types.SchemaValueTree?) -> Unit { + match value { + Some(tree) => discard_wire_value(tree) + None => () } } diff --git a/sdks/moonbit/golem_sdk/agents/dispatch_wbtest.mbt b/sdks/moonbit/golem_sdk/agents/dispatch_wbtest.mbt new file mode 100644 index 0000000000..b00f6c850a --- /dev/null +++ b/sdks/moonbit/golem_sdk/agents/dispatch_wbtest.mbt @@ -0,0 +1,40 @@ +///| +test "parameter failure rolls back an earlier decoded stream" { + let first_source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(1), + ) + let second_source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(2), + ) + let fields = [ + @model.SchemaValue::Stream(first_source), + @model.SchemaValue::Stream(second_source), + ] + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + let first : @schema.AgentStream[Int] = decode_param_with_resource_drops( + fields, 0, "partial transfer", drops, + ) + guard @schema.to_value_as(first) is @model.SchemaValue::Stream(first_owned) else { + fail("expected the first stream to decode") + } + assert_true(first_source.is_present()) + assert_true(first_owned.is_present()) + let result : Result[Int, _] = try? decode_param_with_resource_drops( + fields, 1, "partial transfer", drops, + ) + guard result is Err(@common.AgentError::InvalidInput(_)) else { + fail("decoding the second stream as Int must fail") + } + assert_false(first_owned.is_present()) + assert_false(first_source.is_present()) + assert_false(second_source.is_present()) + @model.SchemaValue::Stream(first_owned).release_resources(drops) + @model.SchemaValue::Record(fields).release_resources(drops) + assert_eq(dropped[0], 2) +} diff --git a/sdks/moonbit/golem_sdk/agents/moon.pkg b/sdks/moonbit/golem_sdk/agents/moon.pkg index ae96fc4c3e..f7c00c93d9 100644 --- a/sdks/moonbit/golem_sdk/agents/moon.pkg +++ b/sdks/moonbit/golem_sdk/agents/moon.pkg @@ -2,6 +2,7 @@ import { "golemcloud/golem_sdk/interface/golem/agent/common", "golemcloud/golem_sdk/interface/golem/core/types", "golemcloud/golem_sdk/schema_model" @model, + "golemcloud/golem_sdk/schema_model_host" @model_host, "golemcloud/golem_sdk/schema", "golemcloud/golem_sdk/interface/wasi/logging/logging", } diff --git a/sdks/moonbit/golem_sdk/agents/pkg.generated.mbti b/sdks/moonbit/golem_sdk/agents/pkg.generated.mbti index 07adc07684..360b637dd1 100644 --- a/sdks/moonbit/golem_sdk/agents/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk/agents/pkg.generated.mbti @@ -10,17 +10,19 @@ import { } // Values -pub fn construct_and_set_instance(String, @types.SchemaValueTree, @common.Principal) -> Result[Unit, @common.AgentError] +pub async fn construct_and_set_instance(String, @types.SchemaValueTree, @common.Principal) -> Result[Unit, @common.AgentError] -pub fn decode_invocation_input(@types.SchemaValueTree, Int, String) -> Array[@schema_model.SchemaValue] raise @common.AgentError +pub async fn decode_invocation_input(@types.SchemaValueTree, Int, String) -> Array[@schema_model.SchemaValue] raise @common.AgentError -pub fn[T : @schema.FromSchema] decode_output(@types.SchemaValueTree, String) -> T raise @common.AgentError +pub async fn[T : @schema.FromSchema] decode_output(@types.SchemaValueTree, String) -> T raise @common.AgentError pub fn[T : @schema.FromSchema] decode_param(Array[@schema_model.SchemaValue], Int, String) -> T raise @common.AgentError pub fn encode_invocation_input(Array[@schema_model.SchemaValue]) -> @types.SchemaValueTree raise @common.AgentError -pub fn[T : @schema.IntoSchema] encode_output(T) -> @types.SchemaValueTree raise @common.AgentError +pub async fn encode_invocation_input_async(Array[@schema_model.SchemaValue]) -> @types.SchemaValueTree raise @common.AgentError + +pub async fn[T : @schema.IntoSchema] encode_output(T) -> @types.SchemaValueTree raise @common.AgentError pub fn get_agent_instance() -> AgentInstance? @@ -113,7 +115,7 @@ pub(all) enum InputParamSource { pub(all) struct RegisteredAgent { name : String agent_type : @common.AgentType - construct : (@types.SchemaValueTree, @common.Principal) -> Result[ConstructedAgent, @common.AgentError] + construct : async (@types.SchemaValueTree, @common.Principal) -> Result[ConstructedAgent, @common.AgentError] } pub(all) enum SnapshotFormat { diff --git a/sdks/moonbit/golem_sdk/config/moon.pkg b/sdks/moonbit/golem_sdk/config/moon.pkg index e8a4d2261f..9b7658c53c 100644 --- a/sdks/moonbit/golem_sdk/config/moon.pkg +++ b/sdks/moonbit/golem_sdk/config/moon.pkg @@ -4,5 +4,6 @@ import { "golemcloud/golem_sdk/interface/golem/secrets/reveal", "golemcloud/golem_sdk/schema", "golemcloud/golem_sdk/schema_model" @model, + "golemcloud/golem_sdk/schema_model_host" @model_host, "golemcloud/golem_sdk/agents", } diff --git a/sdks/moonbit/golem_sdk/config/top.mbt b/sdks/moonbit/golem_sdk/config/top.mbt index 668f5b98c5..f51a8102c5 100644 --- a/sdks/moonbit/golem_sdk/config/top.mbt +++ b/sdks/moonbit/golem_sdk/config/top.mbt @@ -67,11 +67,14 @@ pub fn[T : @schema.IntoSchema + @schema.FromSchema] load_config_value( e => raise @common.AgentError::InvalidInput(e.to_string()) } let wire_value = @host.get_config_value(key, wire_graph) - let model_value = @model.schema_value_from_wit(wire_value) catch { + let model_value = @model_host.schema_value_from_wit(wire_value) catch { e => raise @common.AgentError::InvalidInput(e.to_string()) } let decoded : T = @schema.from_value_as(model_value) catch { - e => raise @common.AgentError::InvalidInput(e.to_string()) + e => { + model_value.release_resources(@model_host.resource_drops()) + raise @common.AgentError::InvalidInput(e.to_string()) + } } decoded } @@ -87,19 +90,21 @@ pub fn[T : @schema.IntoSchema + @schema.FromSchema] Secret::get( let secret_wire_graph = @model.schema_graph_to_wit(secret_graph) catch { e => raise @common.AgentError::InvalidInput(e.to_string()) } + let inner_wire_graph = @model.schema_graph_to_wit(inner_graph) catch { + e => raise @common.AgentError::InvalidInput(e.to_string()) + } let secret_wire_value = @host.get_config_value(self.key, secret_wire_graph) - let secret_model_value = @model.schema_value_from_wit(secret_wire_value) catch { + let secret_model_value = @model_host.schema_value_from_wit(secret_wire_value) catch { e => raise @common.AgentError::InvalidInput(e.to_string()) } let handle = match secret_model_value { Secret(handle) => handle - other => + other => { + other.release_resources(@model_host.resource_drops()) raise @common.AgentError::InvalidInput( "expected secret handle from config, got \{@schema.value_kind(other)}", ) - } - let inner_wire_graph = @model.schema_graph_to_wit(inner_graph) catch { - e => raise @common.AgentError::InvalidInput(e.to_string()) + } } let raw_handle = match handle.take() { Some(h) => h @@ -117,11 +122,16 @@ pub fn[T : @schema.IntoSchema + @schema.FromSchema] Secret::get( raise @common.AgentError::InvalidInput("secret reveal failed: \{msg}") } } - let revealed_model_value = @model.schema_value_from_wit(revealed_wire_value) catch { + let revealed_model_value = @model_host.schema_value_from_wit( + revealed_wire_value, + ) catch { e => raise @common.AgentError::InvalidInput(e.to_string()) } let decoded : T = @schema.from_value_as(revealed_model_value) catch { - e => raise @common.AgentError::InvalidInput(e.to_string()) + e => { + revealed_model_value.release_resources(@model_host.resource_drops()) + raise @common.AgentError::InvalidInput(e.to_string()) + } } decoded } diff --git a/sdks/moonbit/golem_sdk/errors/errors.mbt b/sdks/moonbit/golem_sdk/errors/errors.mbt index 5bea8b053d..754d0f8995 100644 --- a/sdks/moonbit/golem_sdk/errors/errors.mbt +++ b/sdks/moonbit/golem_sdk/errors/errors.mbt @@ -14,11 +14,17 @@ /// (`value.into_typed_schema_value()` → `encode_typed_schema_value`), exposed /// here as a typed helper. Raises if the value's schema is malformed or the WIT /// encoding fails. -pub fn[T : @schema.IntoSchema] custom_error_of( +pub async fn[T : @schema.IntoSchema] custom_error_of( value : T, ) -> @common.AgentError raise { let typed = @schema.try_into_typed_schema_value(value) - @common.AgentError::CustomError(@model.typed_schema_value_to_wit(typed)) + let wire = @model.typed_schema_value_to_wit_async(typed) catch { + error => { + typed.value.release_resources(@model_host.resource_drops()) + raise error + } + } + @common.AgentError::CustomError(wire) } ///| @@ -26,9 +32,14 @@ pub fn[T : @schema.IntoSchema] custom_error_of( /// the Rust `custom_error(impl ToString)` / TS `createCustomError(string)` — /// infallible, because a bare string always produces a well-formed schema. pub fn custom_error(message : String) -> @common.AgentError { - try custom_error_of(message) catch { + let typed = @schema.try_into_typed_schema_value(message) catch { // Unreachable: a `String` schema graph is always well-formed and encodable. e => abort("failed to encode custom agent error: \{e}") + } noraise { + value => value + } + try @common.AgentError::CustomError(@model.typed_schema_value_to_wit(typed)) catch { + e => abort("failed to encode custom agent error: \{e}") } noraise { error => error } @@ -69,11 +80,26 @@ pub fn invalid_type_error(message : String) -> @common.AgentError { /// payload (or render it). pub fn[T : @schema.FromSchema] decode_custom_error( error : @common.AgentError, +) -> T? raise { + decode_custom_error_with_resource_drops(error, @model_host.resource_drops()) +} + +///| +fn[T : @schema.FromSchema] decode_custom_error_with_resource_drops( + error : @common.AgentError, + drops : @model.SchemaValueResourceDrops, ) -> T? raise { match error { CustomError(typed) => { - let decoded = @model.typed_schema_value_from_wit(typed) - Some(@schema.from_value_as(decoded.value)) + let decoded = @model.typed_schema_value_from_wit(typed, drops) + try Some(@schema.from_value_as(decoded.value)) catch { + error => { + decoded.value.release_resources(drops) + raise error + } + } noraise { + value => value + } } _ => None } diff --git a/sdks/moonbit/golem_sdk/errors/moon.pkg b/sdks/moonbit/golem_sdk/errors/moon.pkg index 0241ce3abf..70c0d3dd87 100644 --- a/sdks/moonbit/golem_sdk/errors/moon.pkg +++ b/sdks/moonbit/golem_sdk/errors/moon.pkg @@ -1,5 +1,7 @@ import { "golemcloud/golem_sdk/interface/golem/agent/common", + "golemcloud/golem_sdk/interface/golem/core/types", "golemcloud/golem_sdk/schema", "golemcloud/golem_sdk/schema_model" @model, + "golemcloud/golem_sdk/schema_model_host" @model_host, } diff --git a/sdks/moonbit/golem_sdk/errors/tests.mbt b/sdks/moonbit/golem_sdk/errors/tests.mbt index 6af027077e..b1133a58cf 100644 --- a/sdks/moonbit/golem_sdk/errors/tests.mbt +++ b/sdks/moonbit/golem_sdk/errors/tests.mbt @@ -4,18 +4,54 @@ // schema encode/decode codec is pure, so the full construct → carrier → decode // round-trip runs host-free. +///| +fn test_resource_drops() -> @model.SchemaValueResourceDrops { + { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + } +} + +///| +fn[T : @schema.FromSchema] decode_custom_error_for_test( + error : @common.AgentError, +) -> T? raise { + decode_custom_error_with_resource_drops(error, test_resource_drops()) +} + +///| +fn run_async_test_noraise(block : async () -> Unit noraise) -> Unit = "%async.run" + +///| +fn run_async_test(block : async () -> Unit) -> Unit { + let failure : Array[String?] = [None] + run_async_test_noraise(() => { + try block() catch { + error => failure[0] = Some(repr(error)) + } noraise { + _ => () + } + }) + match failure[0] { + Some(message) => abort(message) + None => () + } +} + ///| test "custom_error round-trips a string message" { let err = custom_error("boom") guard err is CustomError(_) else { fail("expected CustomError") } - let decoded : String? = decode_custom_error(err) + let decoded : String? = decode_custom_error_for_test(err) inspect(decoded, content="Some(boom)") } ///| test "internal_error prefixes and round-trips" { let err = internal_error("disk full") - let decoded : String? = decode_custom_error(err) + let decoded : String? = decode_custom_error_for_test(err) inspect( decoded, content=( @@ -26,10 +62,39 @@ test "internal_error prefixes and round-trips" { ///| test "custom_error_of round-trips a typed (non-string) value" { - let err = custom_error_of((42 : Int)) - guard err is CustomError(_) else { fail("expected CustomError") } - let decoded : Int? = decode_custom_error(err) - inspect(decoded, content="Some(42)") + run_async_test(async fn() { + let err = custom_error_of((42 : Int)) + guard err is CustomError(_) else { fail("expected CustomError") } + let decoded : Int? = decode_custom_error_for_test(err) + inspect(decoded, content="Some(42)") + }) +} + +///| +test "failed custom error conversion drops its decoded stream" { + run_async_test(async fn() { + let handle = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(90), + ) + let stream : @schema.AgentStream[Int] = @schema.from_value_as( + @model.SchemaValue::Stream(handle), + ) + let error = custom_error_of(stream) + let dropped = [0] + let result : Result[Int?, _] = try? decode_custom_error_with_resource_drops( + error, + { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + }, + ) + guard result is Err(_) else { + fail("decoding a stream custom error as Int must fail") + } + assert_eq(dropped[0], 1) + }) } ///| @@ -65,13 +130,13 @@ test "invalid_* helpers build the matching variants" { ///| test "decode_custom_error returns None for non-custom errors" { - let decoded : String? = decode_custom_error(invalid_input_error("x")) + let decoded : String? = decode_custom_error_for_test(invalid_input_error("x")) inspect(decoded, content="None") } ///| test "decode_custom_error raises on a type mismatch" { let err = custom_error("not a number") - let r : Result[Int?, _] = try? decode_custom_error(err) + let r : Result[Int?, _] = try? decode_custom_error_for_test(err) guard r is Err(_) else { fail("expected a decode error") } } diff --git a/sdks/moonbit/golem_sdk/gen/ffi.mbt b/sdks/moonbit/golem_sdk/gen/ffi.mbt index e35c7d7c5c..314132418a 100644 --- a/sdks/moonbit/golem_sdk/gen/ffi.mbt +++ b/sdks/moonbit/golem_sdk/gen/ffi.mbt @@ -54,18 +54,14 @@ pub fn wasmExportInitialize(p0 : Int) -> Int { ///| #doc(hidden) -pub fn wasmExportAsyncInitialize( - event_raw : Int, - waitable : Int, - code : Int, -) -> Int { - @guest0.wasmExportAsyncInitialize(event_raw, waitable, code) +pub fn wasmExportInvokeGolemAgentGuest(p0 : Int) -> Int { + @guest0.wasmExportInvokeGolemAgentGuest(p0) } ///| #doc(hidden) -pub fn wasmExportInvokeGolemToolGuest(p0 : Int) -> Int { - @guest.wasmExportInvokeGolemToolGuest(p0) +pub fn wasmExportLoad(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + @load-snapshot.wasmExportLoad(p0, p1, p2, p3) } ///| @@ -76,40 +72,50 @@ pub fn wasmExportSave() -> Int { ///| #doc(hidden) -pub fn wasmExportAsyncInvokeGolemToolGuest( +pub fn wasmExportInvokeGolemToolGuest(p0 : Int) -> Int { + @guest.wasmExportInvokeGolemToolGuest(p0) +} + +///| +#doc(hidden) +pub fn wasmExportAsyncInitialize( event_raw : Int, waitable : Int, code : Int, ) -> Int { - @guest.wasmExportAsyncInvokeGolemToolGuest(event_raw, waitable, code) + @guest0.wasmExportAsyncInitialize(event_raw, waitable, code) } ///| #doc(hidden) -pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { - @guest.wasmExportGetToolPostReturn(p0) +pub fn wasmExportAsyncInvokeGolemAgentGuest( + event_raw : Int, + waitable : Int, + code : Int, +) -> Int { + @guest0.wasmExportAsyncInvokeGolemAgentGuest(event_raw, waitable, code) } ///| #doc(hidden) -pub fn wasmExportDiscoverTools() -> Int { - @guest.wasmExportDiscoverTools() +pub fn wasmExportAsyncLoad(event_raw : Int, waitable : Int, code : Int) -> Int { + @load-snapshot.wasmExportAsyncLoad(event_raw, waitable, code) } ///| #doc(hidden) -pub fn wasmExportGetTool(p0 : Int, p1 : Int) -> Int { - @guest.wasmExportGetTool(p0, p1) +pub fn wasmExportAsyncSave(event_raw : Int, waitable : Int, code : Int) -> Int { + @save-snapshot.wasmExportAsyncSave(event_raw, waitable, code) } ///| #doc(hidden) -pub fn wasmExportAsyncInvokeGolemAgentGuest( +pub fn wasmExportAsyncInvokeGolemToolGuest( event_raw : Int, waitable : Int, code : Int, ) -> Int { - @guest0.wasmExportAsyncInvokeGolemAgentGuest(event_raw, waitable, code) + @guest.wasmExportAsyncInvokeGolemToolGuest(event_raw, waitable, code) } ///| @@ -120,48 +126,42 @@ pub fn wasmExportDiscoverAgentTypesPostReturn(p0 : Int) -> Unit { ///| #doc(hidden) -pub fn wasmExportAsyncSave(event_raw : Int, waitable : Int, code : Int) -> Int { - @save-snapshot.wasmExportAsyncSave(event_raw, waitable, code) -} - -///| -#doc(hidden) -pub fn wasmExportAsyncLoad(event_raw : Int, waitable : Int, code : Int) -> Int { - @load-snapshot.wasmExportAsyncLoad(event_raw, waitable, code) +pub fn wasmExportGetDefinitionPostReturn(p0 : Int) -> Unit { + @guest0.wasmExportGetDefinitionPostReturn(p0) } ///| #doc(hidden) -pub fn wasmExportGetDefinition() -> Int { - @guest0.wasmExportGetDefinition() +pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { + @guest.wasmExportDiscoverToolsPostReturn(p0) } ///| #doc(hidden) -pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { - @guest.wasmExportDiscoverToolsPostReturn(p0) +pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { + @guest.wasmExportGetToolPostReturn(p0) } ///| #doc(hidden) -pub fn wasmExportGetDefinitionPostReturn(p0 : Int) -> Unit { - @guest0.wasmExportGetDefinitionPostReturn(p0) +pub fn wasmExportDiscoverAgentTypes() -> Int { + @guest0.wasmExportDiscoverAgentTypes() } ///| #doc(hidden) -pub fn wasmExportInvokeGolemAgentGuest(p0 : Int) -> Int { - @guest0.wasmExportInvokeGolemAgentGuest(p0) +pub fn wasmExportGetDefinition() -> Int { + @guest0.wasmExportGetDefinition() } ///| #doc(hidden) -pub fn wasmExportDiscoverAgentTypes() -> Int { - @guest0.wasmExportDiscoverAgentTypes() +pub fn wasmExportDiscoverTools() -> Int { + @guest.wasmExportDiscoverTools() } ///| #doc(hidden) -pub fn wasmExportLoad(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { - @load-snapshot.wasmExportLoad(p0, p1, p2, p3) +pub fn wasmExportGetTool(p0 : Int, p1 : Int) -> Int { + @guest.wasmExportGetTool(p0, p1) } diff --git a/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/ffi.mbt b/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/ffi.mbt index afe2fee203..1fb9a4246d 100644 --- a/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/ffi.mbt +++ b/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/ffi.mbt @@ -288,6 +288,12 @@ pub fn wasmExportInitialize(p0 : Int) -> Int { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -480,8 +486,6 @@ fn initialize_task_return( let cleanup_list : Array[Int] = [] let ( - lowered502, - lowered503, lowered504, lowered505, lowered506, @@ -490,19 +494,21 @@ fn initialize_task_return( lowered509, lowered510, lowered511, + lowered512, + lowered513, ) = match return_value { Ok(_payload) => (0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Err(payload46) => { let ( lowered, - lowered494, - lowered495, lowered496, lowered497, lowered498, lowered499, lowered500, lowered501, + lowered502, + lowered503, ) = match payload46 { InvalidInput(payload47) => { let ptr = mbt_ffi_str2ptr(payload47) @@ -2994,14 +3000,14 @@ fn initialize_task_return( cleanup_list.push(ptr417) } - let address492 = mbt_ffi_malloc( + let address494 = mbt_ffi_malloc( payload54.value.value_nodes.length() * 32, ) - for index493 = 0 - index493 < payload54.value.value_nodes.length() - index493 = index493 + 1 { - let iter_elem : @types.SchemaValueNode = payload54.value.value_nodes[index493] - let iter_base = address492 + index493 * 32 + for index495 = 0 + index495 < payload54.value.value_nodes.length() + index495 = index495 + 1 { + let iter_elem : @types.SchemaValueNode = payload54.value.value_nodes[index495] + let iter_base = address494 + index495 * 32 match iter_elem { BoolValue(payload423) => { @@ -3439,13 +3445,21 @@ fn initialize_task_return( let @types.QuotaToken(handle491) = payload490 mbt_ffi_store32(iter_base + 8, handle491) + () + } + StreamValue(payload492) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle493) = payload492 + mbt_ffi_store32(iter_base + 8, handle493) + () } } } cleanup_list.push(address415) cleanup_list.push(address421) - cleanup_list.push(address492) + cleanup_list.push(address494) ( 4, @@ -3454,7 +3468,7 @@ fn initialize_task_return( address421, payload54.graph.defs.length(), payload54.graph.root, - address492, + address494, payload54.value.value_nodes.length(), payload54.value.root, ) @@ -3462,15 +3476,15 @@ fn initialize_task_return( } ( - 1, lowered, lowered494, lowered495, lowered496, lowered497, lowered498, - lowered499, lowered500, lowered501, + 1, lowered, lowered496, lowered497, lowered498, lowered499, lowered500, + lowered501, lowered502, lowered503, ) } } wasmExportAsyncInitializeTaskReturn( - lowered502, lowered503, lowered504, lowered505, lowered506, lowered507, lowered508, - lowered509, lowered510, lowered511, + lowered504, lowered505, lowered506, lowered507, lowered508, lowered509, lowered510, + lowered511, lowered512, lowered513, ) cleanup_list.each(mbt_ffi_free) @@ -3779,6 +3793,12 @@ pub fn wasmExportInvokeGolemAgentGuest(p0 : Int) -> Int { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -3973,29 +3993,29 @@ fn invoke_task_return( let cleanup_list : Array[Int] = [] let ( - lowered580, - lowered581, - lowered582, - lowered583, lowered584, lowered585, lowered586, lowered587, lowered588, lowered589, + lowered590, + lowered591, + lowered592, + lowered593, ) = match return_value { Ok(payload) => { - let (lowered, lowered117, lowered118, lowered119) = match payload { + let (lowered, lowered119, lowered120, lowered121) = match payload { None => (0, 0, 0, 0) Some(payload47) => { - let address115 = mbt_ffi_malloc( + let address117 = mbt_ffi_malloc( payload47.value_nodes.length() * 32, ) - for index116 = 0 - index116 < payload47.value_nodes.length() - index116 = index116 + 1 { - let iter_elem : @types.SchemaValueNode = payload47.value_nodes[index116] - let iter_base = address115 + index116 * 32 + for index118 = 0 + index118 < payload47.value_nodes.length() + index118 = index118 + 1 { + let iter_elem : @types.SchemaValueNode = payload47.value_nodes[index118] + let iter_base = address117 + index118 * 32 match iter_elem { BoolValue(payload48) => { @@ -4426,68 +4446,76 @@ fn invoke_task_return( let @types.QuotaToken(handle114) = payload113 mbt_ffi_store32(iter_base + 8, handle114) + () + } + StreamValue(payload115) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle116) = payload115 + mbt_ffi_store32(iter_base + 8, handle116) + () } } } - cleanup_list.push(address115) + cleanup_list.push(address117) - (1, address115, payload47.value_nodes.length(), payload47.root) + (1, address117, payload47.value_nodes.length(), payload47.root) } } - (0, lowered, lowered117, lowered118, lowered119, 0, 0, 0, 0, 0) + (0, lowered, lowered119, lowered120, lowered121, 0, 0, 0, 0, 0) } - Err(payload120) => { + Err(payload122) => { let ( - lowered571, - lowered572, - lowered573, - lowered574, lowered575, lowered576, lowered577, lowered578, lowered579, - ) = match payload120 { - InvalidInput(payload121) => { - let ptr122 = mbt_ffi_str2ptr(payload121) - cleanup_list.push(ptr122) - - (0, ptr122, payload121.length(), 0, 0, 0, 0, 0, 0) - } - InvalidMethod(payload123) => { + lowered580, + lowered581, + lowered582, + lowered583, + ) = match payload122 { + InvalidInput(payload123) => { let ptr124 = mbt_ffi_str2ptr(payload123) cleanup_list.push(ptr124) - (1, ptr124, payload123.length(), 0, 0, 0, 0, 0, 0) + (0, ptr124, payload123.length(), 0, 0, 0, 0, 0, 0) } - InvalidType(payload125) => { + InvalidMethod(payload125) => { let ptr126 = mbt_ffi_str2ptr(payload125) cleanup_list.push(ptr126) - (2, ptr126, payload125.length(), 0, 0, 0, 0, 0, 0) + (1, ptr126, payload125.length(), 0, 0, 0, 0, 0, 0) } - InvalidAgentId(payload127) => { + InvalidType(payload127) => { let ptr128 = mbt_ffi_str2ptr(payload127) cleanup_list.push(ptr128) - (3, ptr128, payload127.length(), 0, 0, 0, 0, 0, 0) + (2, ptr128, payload127.length(), 0, 0, 0, 0, 0, 0) } - CustomError(payload129) => { - let address491 = mbt_ffi_malloc( - payload129.graph.type_nodes.length() * 144, + InvalidAgentId(payload129) => { + let ptr130 = mbt_ffi_str2ptr(payload129) + cleanup_list.push(ptr130) + + (3, ptr130, payload129.length(), 0, 0, 0, 0, 0, 0) + } + CustomError(payload131) => { + let address493 = mbt_ffi_malloc( + payload131.graph.type_nodes.length() * 144, ) - for index492 = 0 - index492 < payload129.graph.type_nodes.length() - index492 = index492 + 1 { - let iter_elem : @types.SchemaTypeNode = payload129.graph.type_nodes[index492] - let iter_base = address491 + index492 * 144 + for index494 = 0 + index494 < payload131.graph.type_nodes.length() + index494 = index494 + 1 { + let iter_elem : @types.SchemaTypeNode = payload131.graph.type_nodes[index494] + let iter_base = address493 + index494 * 144 match iter_elem.body { - RefType(payload130) => { + RefType(payload132) => { mbt_ffi_store8(iter_base + 0, 0) - mbt_ffi_store32(iter_base + 8, payload130) + mbt_ffi_store32(iter_base + 8, payload132) () } @@ -4496,48 +4524,48 @@ fn invoke_task_return( () } - S8Type(payload132) => { + S8Type(payload134) => { mbt_ffi_store8(iter_base + 0, 2) - match payload132 { + match payload134 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload134) => { + Some(payload136) => { mbt_ffi_store8(iter_base + 8, 1) - match payload134.min { + match payload136.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload136) => { + Some(payload138) => { mbt_ffi_store8(iter_base + 16, 1) - match payload136 { - Signed(payload137) => { + match payload138 { + Signed(payload139) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload137) + mbt_ffi_store64(iter_base + 32, payload139) () } - Unsigned(payload138) => { + Unsigned(payload140) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload138.reinterpret_as_int64(), + payload140.reinterpret_as_int64(), ) () } - FloatBits(payload139) => { + FloatBits(payload141) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload139.reinterpret_as_int64(), + payload141.reinterpret_as_int64(), ) () @@ -4548,36 +4576,36 @@ fn invoke_task_return( } } - match payload134.max { + match payload136.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload141) => { + Some(payload143) => { mbt_ffi_store8(iter_base + 40, 1) - match payload141 { - Signed(payload142) => { + match payload143 { + Signed(payload144) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload142) + mbt_ffi_store64(iter_base + 56, payload144) () } - Unsigned(payload143) => { + Unsigned(payload145) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload143.reinterpret_as_int64(), + payload145.reinterpret_as_int64(), ) () } - FloatBits(payload144) => { + FloatBits(payload146) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload144.reinterpret_as_int64(), + payload146.reinterpret_as_int64(), ) () @@ -4588,19 +4616,19 @@ fn invoke_task_return( } } - match payload134.unit { + match payload136.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload146) => { + Some(payload148) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr147 = mbt_ffi_str2ptr(payload146) - mbt_ffi_store32(iter_base + 72, payload146.length()) - mbt_ffi_store32(iter_base + 68, ptr147) - cleanup_list.push(ptr147) + let ptr149 = mbt_ffi_str2ptr(payload148) + mbt_ffi_store32(iter_base + 72, payload148.length()) + mbt_ffi_store32(iter_base + 68, ptr149) + cleanup_list.push(ptr149) () } @@ -4612,48 +4640,48 @@ fn invoke_task_return( () } - S16Type(payload148) => { + S16Type(payload150) => { mbt_ffi_store8(iter_base + 0, 3) - match payload148 { + match payload150 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload150) => { + Some(payload152) => { mbt_ffi_store8(iter_base + 8, 1) - match payload150.min { + match payload152.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload152) => { + Some(payload154) => { mbt_ffi_store8(iter_base + 16, 1) - match payload152 { - Signed(payload153) => { + match payload154 { + Signed(payload155) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload153) + mbt_ffi_store64(iter_base + 32, payload155) () } - Unsigned(payload154) => { + Unsigned(payload156) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload154.reinterpret_as_int64(), + payload156.reinterpret_as_int64(), ) () } - FloatBits(payload155) => { + FloatBits(payload157) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload155.reinterpret_as_int64(), + payload157.reinterpret_as_int64(), ) () @@ -4664,36 +4692,36 @@ fn invoke_task_return( } } - match payload150.max { + match payload152.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload157) => { + Some(payload159) => { mbt_ffi_store8(iter_base + 40, 1) - match payload157 { - Signed(payload158) => { + match payload159 { + Signed(payload160) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload158) + mbt_ffi_store64(iter_base + 56, payload160) () } - Unsigned(payload159) => { + Unsigned(payload161) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload159.reinterpret_as_int64(), + payload161.reinterpret_as_int64(), ) () } - FloatBits(payload160) => { + FloatBits(payload162) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload160.reinterpret_as_int64(), + payload162.reinterpret_as_int64(), ) () @@ -4704,19 +4732,19 @@ fn invoke_task_return( } } - match payload150.unit { + match payload152.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload162) => { + Some(payload164) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr163 = mbt_ffi_str2ptr(payload162) - mbt_ffi_store32(iter_base + 72, payload162.length()) - mbt_ffi_store32(iter_base + 68, ptr163) - cleanup_list.push(ptr163) + let ptr165 = mbt_ffi_str2ptr(payload164) + mbt_ffi_store32(iter_base + 72, payload164.length()) + mbt_ffi_store32(iter_base + 68, ptr165) + cleanup_list.push(ptr165) () } @@ -4728,48 +4756,48 @@ fn invoke_task_return( () } - S32Type(payload164) => { + S32Type(payload166) => { mbt_ffi_store8(iter_base + 0, 4) - match payload164 { + match payload166 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload166) => { + Some(payload168) => { mbt_ffi_store8(iter_base + 8, 1) - match payload166.min { + match payload168.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload168) => { + Some(payload170) => { mbt_ffi_store8(iter_base + 16, 1) - match payload168 { - Signed(payload169) => { + match payload170 { + Signed(payload171) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload169) + mbt_ffi_store64(iter_base + 32, payload171) () } - Unsigned(payload170) => { + Unsigned(payload172) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload170.reinterpret_as_int64(), + payload172.reinterpret_as_int64(), ) () } - FloatBits(payload171) => { + FloatBits(payload173) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload171.reinterpret_as_int64(), + payload173.reinterpret_as_int64(), ) () @@ -4780,36 +4808,36 @@ fn invoke_task_return( } } - match payload166.max { + match payload168.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload173) => { + Some(payload175) => { mbt_ffi_store8(iter_base + 40, 1) - match payload173 { - Signed(payload174) => { + match payload175 { + Signed(payload176) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload174) + mbt_ffi_store64(iter_base + 56, payload176) () } - Unsigned(payload175) => { + Unsigned(payload177) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload175.reinterpret_as_int64(), + payload177.reinterpret_as_int64(), ) () } - FloatBits(payload176) => { + FloatBits(payload178) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload176.reinterpret_as_int64(), + payload178.reinterpret_as_int64(), ) () @@ -4820,19 +4848,19 @@ fn invoke_task_return( } } - match payload166.unit { + match payload168.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload178) => { + Some(payload180) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr179 = mbt_ffi_str2ptr(payload178) - mbt_ffi_store32(iter_base + 72, payload178.length()) - mbt_ffi_store32(iter_base + 68, ptr179) - cleanup_list.push(ptr179) + let ptr181 = mbt_ffi_str2ptr(payload180) + mbt_ffi_store32(iter_base + 72, payload180.length()) + mbt_ffi_store32(iter_base + 68, ptr181) + cleanup_list.push(ptr181) () } @@ -4844,48 +4872,48 @@ fn invoke_task_return( () } - S64Type(payload180) => { + S64Type(payload182) => { mbt_ffi_store8(iter_base + 0, 5) - match payload180 { + match payload182 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload182) => { + Some(payload184) => { mbt_ffi_store8(iter_base + 8, 1) - match payload182.min { + match payload184.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload184) => { + Some(payload186) => { mbt_ffi_store8(iter_base + 16, 1) - match payload184 { - Signed(payload185) => { + match payload186 { + Signed(payload187) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload185) + mbt_ffi_store64(iter_base + 32, payload187) () } - Unsigned(payload186) => { + Unsigned(payload188) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload186.reinterpret_as_int64(), + payload188.reinterpret_as_int64(), ) () } - FloatBits(payload187) => { + FloatBits(payload189) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload187.reinterpret_as_int64(), + payload189.reinterpret_as_int64(), ) () @@ -4896,36 +4924,36 @@ fn invoke_task_return( } } - match payload182.max { + match payload184.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload189) => { + Some(payload191) => { mbt_ffi_store8(iter_base + 40, 1) - match payload189 { - Signed(payload190) => { + match payload191 { + Signed(payload192) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload190) + mbt_ffi_store64(iter_base + 56, payload192) () } - Unsigned(payload191) => { + Unsigned(payload193) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload191.reinterpret_as_int64(), + payload193.reinterpret_as_int64(), ) () } - FloatBits(payload192) => { + FloatBits(payload194) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload192.reinterpret_as_int64(), + payload194.reinterpret_as_int64(), ) () @@ -4936,19 +4964,19 @@ fn invoke_task_return( } } - match payload182.unit { + match payload184.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload194) => { + Some(payload196) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr195 = mbt_ffi_str2ptr(payload194) - mbt_ffi_store32(iter_base + 72, payload194.length()) - mbt_ffi_store32(iter_base + 68, ptr195) - cleanup_list.push(ptr195) + let ptr197 = mbt_ffi_str2ptr(payload196) + mbt_ffi_store32(iter_base + 72, payload196.length()) + mbt_ffi_store32(iter_base + 68, ptr197) + cleanup_list.push(ptr197) () } @@ -4960,48 +4988,48 @@ fn invoke_task_return( () } - U8Type(payload196) => { + U8Type(payload198) => { mbt_ffi_store8(iter_base + 0, 6) - match payload196 { + match payload198 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload198) => { + Some(payload200) => { mbt_ffi_store8(iter_base + 8, 1) - match payload198.min { + match payload200.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload200) => { + Some(payload202) => { mbt_ffi_store8(iter_base + 16, 1) - match payload200 { - Signed(payload201) => { + match payload202 { + Signed(payload203) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload201) + mbt_ffi_store64(iter_base + 32, payload203) () } - Unsigned(payload202) => { + Unsigned(payload204) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload202.reinterpret_as_int64(), + payload204.reinterpret_as_int64(), ) () } - FloatBits(payload203) => { + FloatBits(payload205) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload203.reinterpret_as_int64(), + payload205.reinterpret_as_int64(), ) () @@ -5012,36 +5040,36 @@ fn invoke_task_return( } } - match payload198.max { + match payload200.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload205) => { + Some(payload207) => { mbt_ffi_store8(iter_base + 40, 1) - match payload205 { - Signed(payload206) => { + match payload207 { + Signed(payload208) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload206) + mbt_ffi_store64(iter_base + 56, payload208) () } - Unsigned(payload207) => { + Unsigned(payload209) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload207.reinterpret_as_int64(), + payload209.reinterpret_as_int64(), ) () } - FloatBits(payload208) => { + FloatBits(payload210) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload208.reinterpret_as_int64(), + payload210.reinterpret_as_int64(), ) () @@ -5052,19 +5080,19 @@ fn invoke_task_return( } } - match payload198.unit { + match payload200.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload210) => { + Some(payload212) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr211 = mbt_ffi_str2ptr(payload210) - mbt_ffi_store32(iter_base + 72, payload210.length()) - mbt_ffi_store32(iter_base + 68, ptr211) - cleanup_list.push(ptr211) + let ptr213 = mbt_ffi_str2ptr(payload212) + mbt_ffi_store32(iter_base + 72, payload212.length()) + mbt_ffi_store32(iter_base + 68, ptr213) + cleanup_list.push(ptr213) () } @@ -5076,48 +5104,48 @@ fn invoke_task_return( () } - U16Type(payload212) => { + U16Type(payload214) => { mbt_ffi_store8(iter_base + 0, 7) - match payload212 { + match payload214 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload214) => { + Some(payload216) => { mbt_ffi_store8(iter_base + 8, 1) - match payload214.min { + match payload216.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload216) => { + Some(payload218) => { mbt_ffi_store8(iter_base + 16, 1) - match payload216 { - Signed(payload217) => { + match payload218 { + Signed(payload219) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload217) + mbt_ffi_store64(iter_base + 32, payload219) () } - Unsigned(payload218) => { + Unsigned(payload220) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload218.reinterpret_as_int64(), + payload220.reinterpret_as_int64(), ) () } - FloatBits(payload219) => { + FloatBits(payload221) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload219.reinterpret_as_int64(), + payload221.reinterpret_as_int64(), ) () @@ -5128,36 +5156,36 @@ fn invoke_task_return( } } - match payload214.max { + match payload216.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload221) => { + Some(payload223) => { mbt_ffi_store8(iter_base + 40, 1) - match payload221 { - Signed(payload222) => { + match payload223 { + Signed(payload224) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload222) + mbt_ffi_store64(iter_base + 56, payload224) () } - Unsigned(payload223) => { + Unsigned(payload225) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload223.reinterpret_as_int64(), + payload225.reinterpret_as_int64(), ) () } - FloatBits(payload224) => { + FloatBits(payload226) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload224.reinterpret_as_int64(), + payload226.reinterpret_as_int64(), ) () @@ -5168,19 +5196,19 @@ fn invoke_task_return( } } - match payload214.unit { + match payload216.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload226) => { + Some(payload228) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr227 = mbt_ffi_str2ptr(payload226) - mbt_ffi_store32(iter_base + 72, payload226.length()) - mbt_ffi_store32(iter_base + 68, ptr227) - cleanup_list.push(ptr227) + let ptr229 = mbt_ffi_str2ptr(payload228) + mbt_ffi_store32(iter_base + 72, payload228.length()) + mbt_ffi_store32(iter_base + 68, ptr229) + cleanup_list.push(ptr229) () } @@ -5192,48 +5220,48 @@ fn invoke_task_return( () } - U32Type(payload228) => { + U32Type(payload230) => { mbt_ffi_store8(iter_base + 0, 8) - match payload228 { + match payload230 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload230) => { + Some(payload232) => { mbt_ffi_store8(iter_base + 8, 1) - match payload230.min { + match payload232.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload232) => { + Some(payload234) => { mbt_ffi_store8(iter_base + 16, 1) - match payload232 { - Signed(payload233) => { + match payload234 { + Signed(payload235) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload233) + mbt_ffi_store64(iter_base + 32, payload235) () } - Unsigned(payload234) => { + Unsigned(payload236) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload234.reinterpret_as_int64(), + payload236.reinterpret_as_int64(), ) () } - FloatBits(payload235) => { + FloatBits(payload237) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload235.reinterpret_as_int64(), + payload237.reinterpret_as_int64(), ) () @@ -5244,36 +5272,36 @@ fn invoke_task_return( } } - match payload230.max { + match payload232.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload237) => { + Some(payload239) => { mbt_ffi_store8(iter_base + 40, 1) - match payload237 { - Signed(payload238) => { + match payload239 { + Signed(payload240) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload238) + mbt_ffi_store64(iter_base + 56, payload240) () } - Unsigned(payload239) => { + Unsigned(payload241) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload239.reinterpret_as_int64(), + payload241.reinterpret_as_int64(), ) () } - FloatBits(payload240) => { + FloatBits(payload242) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload240.reinterpret_as_int64(), + payload242.reinterpret_as_int64(), ) () @@ -5284,19 +5312,19 @@ fn invoke_task_return( } } - match payload230.unit { + match payload232.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload242) => { + Some(payload244) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr243 = mbt_ffi_str2ptr(payload242) - mbt_ffi_store32(iter_base + 72, payload242.length()) - mbt_ffi_store32(iter_base + 68, ptr243) - cleanup_list.push(ptr243) + let ptr245 = mbt_ffi_str2ptr(payload244) + mbt_ffi_store32(iter_base + 72, payload244.length()) + mbt_ffi_store32(iter_base + 68, ptr245) + cleanup_list.push(ptr245) () } @@ -5308,48 +5336,48 @@ fn invoke_task_return( () } - U64Type(payload244) => { + U64Type(payload246) => { mbt_ffi_store8(iter_base + 0, 9) - match payload244 { + match payload246 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload246) => { + Some(payload248) => { mbt_ffi_store8(iter_base + 8, 1) - match payload246.min { + match payload248.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload248) => { + Some(payload250) => { mbt_ffi_store8(iter_base + 16, 1) - match payload248 { - Signed(payload249) => { + match payload250 { + Signed(payload251) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload249) + mbt_ffi_store64(iter_base + 32, payload251) () } - Unsigned(payload250) => { + Unsigned(payload252) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload250.reinterpret_as_int64(), + payload252.reinterpret_as_int64(), ) () } - FloatBits(payload251) => { + FloatBits(payload253) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload251.reinterpret_as_int64(), + payload253.reinterpret_as_int64(), ) () @@ -5360,36 +5388,36 @@ fn invoke_task_return( } } - match payload246.max { + match payload248.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload253) => { + Some(payload255) => { mbt_ffi_store8(iter_base + 40, 1) - match payload253 { - Signed(payload254) => { + match payload255 { + Signed(payload256) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload254) + mbt_ffi_store64(iter_base + 56, payload256) () } - Unsigned(payload255) => { + Unsigned(payload257) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload255.reinterpret_as_int64(), + payload257.reinterpret_as_int64(), ) () } - FloatBits(payload256) => { + FloatBits(payload258) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload256.reinterpret_as_int64(), + payload258.reinterpret_as_int64(), ) () @@ -5400,19 +5428,19 @@ fn invoke_task_return( } } - match payload246.unit { + match payload248.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload258) => { + Some(payload260) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr259 = mbt_ffi_str2ptr(payload258) - mbt_ffi_store32(iter_base + 72, payload258.length()) - mbt_ffi_store32(iter_base + 68, ptr259) - cleanup_list.push(ptr259) + let ptr261 = mbt_ffi_str2ptr(payload260) + mbt_ffi_store32(iter_base + 72, payload260.length()) + mbt_ffi_store32(iter_base + 68, ptr261) + cleanup_list.push(ptr261) () } @@ -5424,48 +5452,48 @@ fn invoke_task_return( () } - F32Type(payload260) => { + F32Type(payload262) => { mbt_ffi_store8(iter_base + 0, 10) - match payload260 { + match payload262 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload262) => { + Some(payload264) => { mbt_ffi_store8(iter_base + 8, 1) - match payload262.min { + match payload264.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload264) => { + Some(payload266) => { mbt_ffi_store8(iter_base + 16, 1) - match payload264 { - Signed(payload265) => { + match payload266 { + Signed(payload267) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload265) + mbt_ffi_store64(iter_base + 32, payload267) () } - Unsigned(payload266) => { + Unsigned(payload268) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload266.reinterpret_as_int64(), + payload268.reinterpret_as_int64(), ) () } - FloatBits(payload267) => { + FloatBits(payload269) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload267.reinterpret_as_int64(), + payload269.reinterpret_as_int64(), ) () @@ -5476,36 +5504,36 @@ fn invoke_task_return( } } - match payload262.max { + match payload264.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload269) => { + Some(payload271) => { mbt_ffi_store8(iter_base + 40, 1) - match payload269 { - Signed(payload270) => { + match payload271 { + Signed(payload272) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload270) + mbt_ffi_store64(iter_base + 56, payload272) () } - Unsigned(payload271) => { + Unsigned(payload273) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload271.reinterpret_as_int64(), + payload273.reinterpret_as_int64(), ) () } - FloatBits(payload272) => { + FloatBits(payload274) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload272.reinterpret_as_int64(), + payload274.reinterpret_as_int64(), ) () @@ -5516,19 +5544,19 @@ fn invoke_task_return( } } - match payload262.unit { + match payload264.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload274) => { + Some(payload276) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr275 = mbt_ffi_str2ptr(payload274) - mbt_ffi_store32(iter_base + 72, payload274.length()) - mbt_ffi_store32(iter_base + 68, ptr275) - cleanup_list.push(ptr275) + let ptr277 = mbt_ffi_str2ptr(payload276) + mbt_ffi_store32(iter_base + 72, payload276.length()) + mbt_ffi_store32(iter_base + 68, ptr277) + cleanup_list.push(ptr277) () } @@ -5540,48 +5568,48 @@ fn invoke_task_return( () } - F64Type(payload276) => { + F64Type(payload278) => { mbt_ffi_store8(iter_base + 0, 11) - match payload276 { + match payload278 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload278) => { + Some(payload280) => { mbt_ffi_store8(iter_base + 8, 1) - match payload278.min { + match payload280.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload280) => { + Some(payload282) => { mbt_ffi_store8(iter_base + 16, 1) - match payload280 { - Signed(payload281) => { + match payload282 { + Signed(payload283) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload281) + mbt_ffi_store64(iter_base + 32, payload283) () } - Unsigned(payload282) => { + Unsigned(payload284) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload282.reinterpret_as_int64(), + payload284.reinterpret_as_int64(), ) () } - FloatBits(payload283) => { + FloatBits(payload285) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload283.reinterpret_as_int64(), + payload285.reinterpret_as_int64(), ) () @@ -5592,36 +5620,36 @@ fn invoke_task_return( } } - match payload278.max { + match payload280.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload285) => { + Some(payload287) => { mbt_ffi_store8(iter_base + 40, 1) - match payload285 { - Signed(payload286) => { + match payload287 { + Signed(payload288) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload286) + mbt_ffi_store64(iter_base + 56, payload288) () } - Unsigned(payload287) => { + Unsigned(payload289) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload287.reinterpret_as_int64(), + payload289.reinterpret_as_int64(), ) () } - FloatBits(payload288) => { + FloatBits(payload290) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload288.reinterpret_as_int64(), + payload290.reinterpret_as_int64(), ) () @@ -5632,19 +5660,19 @@ fn invoke_task_return( } } - match payload278.unit { + match payload280.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload290) => { + Some(payload292) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr291 = mbt_ffi_str2ptr(payload290) - mbt_ffi_store32(iter_base + 72, payload290.length()) - mbt_ffi_store32(iter_base + 68, ptr291) - cleanup_list.push(ptr291) + let ptr293 = mbt_ffi_str2ptr(payload292) + mbt_ffi_store32(iter_base + 72, payload292.length()) + mbt_ffi_store32(iter_base + 68, ptr293) + cleanup_list.push(ptr293) () } @@ -5666,19 +5694,19 @@ fn invoke_task_return( () } - RecordType(payload294) => { + RecordType(payload296) => { mbt_ffi_store8(iter_base + 0, 14) - let address315 = mbt_ffi_malloc(payload294.length() * 68) - for index316 = 0 - index316 < payload294.length() - index316 = index316 + 1 { - let iter_elem : @types.NamedFieldType = payload294[index316] - let iter_base = address315 + index316 * 68 + let address317 = mbt_ffi_malloc(payload296.length() * 68) + for index318 = 0 + index318 < payload296.length() + index318 = index318 + 1 { + let iter_elem : @types.NamedFieldType = payload296[index318] + let iter_base = address317 + index318 * 68 - let ptr295 = mbt_ffi_str2ptr(iter_elem.name) + let ptr297 = mbt_ffi_str2ptr(iter_elem.name) mbt_ffi_store32(iter_base + 4, iter_elem.name.length()) - mbt_ffi_store32(iter_base + 0, ptr295) + mbt_ffi_store32(iter_base + 0, ptr297) mbt_ffi_store32(iter_base + 8, iter_elem.body) match iter_elem.metadata.doc { @@ -5687,57 +5715,57 @@ fn invoke_task_return( () } - Some(payload297) => { + Some(payload299) => { mbt_ffi_store8(iter_base + 12, 1) - let ptr298 = mbt_ffi_str2ptr(payload297) - mbt_ffi_store32(iter_base + 20, payload297.length()) - mbt_ffi_store32(iter_base + 16, ptr298) - cleanup_list.push(ptr298) + let ptr300 = mbt_ffi_str2ptr(payload299) + mbt_ffi_store32(iter_base + 20, payload299.length()) + mbt_ffi_store32(iter_base + 16, ptr300) + cleanup_list.push(ptr300) () } } - let address300 = mbt_ffi_malloc( + let address302 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index301 = 0 - index301 < iter_elem.metadata.aliases.length() - index301 = index301 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index301] - let iter_base = address300 + index301 * 8 + for index303 = 0 + index303 < iter_elem.metadata.aliases.length() + index303 = index303 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index303] + let iter_base = address302 + index303 * 8 - let ptr299 = mbt_ffi_str2ptr(iter_elem) + let ptr301 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr299) - cleanup_list.push(ptr299) + mbt_ffi_store32(iter_base + 0, ptr301) + cleanup_list.push(ptr301) } mbt_ffi_store32( iter_base + 28, iter_elem.metadata.aliases.length(), ) - mbt_ffi_store32(iter_base + 24, address300) + mbt_ffi_store32(iter_base + 24, address302) - let address303 = mbt_ffi_malloc( + let address305 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index304 = 0 - index304 < iter_elem.metadata.examples.length() - index304 = index304 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index304] - let iter_base = address303 + index304 * 8 + for index306 = 0 + index306 < iter_elem.metadata.examples.length() + index306 = index306 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index306] + let iter_base = address305 + index306 * 8 - let ptr302 = mbt_ffi_str2ptr(iter_elem) + let ptr304 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr302) - cleanup_list.push(ptr302) + mbt_ffi_store32(iter_base + 0, ptr304) + cleanup_list.push(ptr304) } mbt_ffi_store32( iter_base + 36, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 32, address303) + mbt_ffi_store32(iter_base + 32, address305) match iter_elem.metadata.deprecated { None => { @@ -5745,13 +5773,13 @@ fn invoke_task_return( () } - Some(payload306) => { + Some(payload308) => { mbt_ffi_store8(iter_base + 40, 1) - let ptr307 = mbt_ffi_str2ptr(payload306) - mbt_ffi_store32(iter_base + 48, payload306.length()) - mbt_ffi_store32(iter_base + 44, ptr307) - cleanup_list.push(ptr307) + let ptr309 = mbt_ffi_str2ptr(payload308) + mbt_ffi_store32(iter_base + 48, payload308.length()) + mbt_ffi_store32(iter_base + 44, ptr309) + cleanup_list.push(ptr309) () } @@ -5763,10 +5791,10 @@ fn invoke_task_return( () } - Some(payload309) => { + Some(payload311) => { mbt_ffi_store8(iter_base + 52, 1) - match payload309 { + match payload311 { Multimodal => { mbt_ffi_store8(iter_base + 56, 0) @@ -5782,16 +5810,16 @@ fn invoke_task_return( () } - Other(payload313) => { + Other(payload315) => { mbt_ffi_store8(iter_base + 56, 3) - let ptr314 = mbt_ffi_str2ptr(payload313) + let ptr316 = mbt_ffi_str2ptr(payload315) mbt_ffi_store32( iter_base + 64, - payload313.length(), + payload315.length(), ) - mbt_ffi_store32(iter_base + 60, ptr314) - cleanup_list.push(ptr314) + mbt_ffi_store32(iter_base + 60, ptr316) + cleanup_list.push(ptr316) () } @@ -5800,29 +5828,29 @@ fn invoke_task_return( () } } - cleanup_list.push(ptr295) - cleanup_list.push(address300) - cleanup_list.push(address303) + cleanup_list.push(ptr297) + cleanup_list.push(address302) + cleanup_list.push(address305) } - mbt_ffi_store32(iter_base + 12, payload294.length()) - mbt_ffi_store32(iter_base + 8, address315) - cleanup_list.push(address315) + mbt_ffi_store32(iter_base + 12, payload296.length()) + mbt_ffi_store32(iter_base + 8, address317) + cleanup_list.push(address317) () } - VariantType(payload317) => { + VariantType(payload319) => { mbt_ffi_store8(iter_base + 0, 15) - let address340 = mbt_ffi_malloc(payload317.length() * 72) - for index341 = 0 - index341 < payload317.length() - index341 = index341 + 1 { - let iter_elem : @types.VariantCaseType = payload317[index341] - let iter_base = address340 + index341 * 72 + let address342 = mbt_ffi_malloc(payload319.length() * 72) + for index343 = 0 + index343 < payload319.length() + index343 = index343 + 1 { + let iter_elem : @types.VariantCaseType = payload319[index343] + let iter_base = address342 + index343 * 72 - let ptr318 = mbt_ffi_str2ptr(iter_elem.name) + let ptr320 = mbt_ffi_str2ptr(iter_elem.name) mbt_ffi_store32(iter_base + 4, iter_elem.name.length()) - mbt_ffi_store32(iter_base + 0, ptr318) + mbt_ffi_store32(iter_base + 0, ptr320) match iter_elem.payload { None => { @@ -5830,9 +5858,9 @@ fn invoke_task_return( () } - Some(payload320) => { + Some(payload322) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload320) + mbt_ffi_store32(iter_base + 12, payload322) () } @@ -5844,57 +5872,57 @@ fn invoke_task_return( () } - Some(payload322) => { + Some(payload324) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr323 = mbt_ffi_str2ptr(payload322) - mbt_ffi_store32(iter_base + 24, payload322.length()) - mbt_ffi_store32(iter_base + 20, ptr323) - cleanup_list.push(ptr323) + let ptr325 = mbt_ffi_str2ptr(payload324) + mbt_ffi_store32(iter_base + 24, payload324.length()) + mbt_ffi_store32(iter_base + 20, ptr325) + cleanup_list.push(ptr325) () } } - let address325 = mbt_ffi_malloc( + let address327 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index326 = 0 - index326 < iter_elem.metadata.aliases.length() - index326 = index326 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index326] - let iter_base = address325 + index326 * 8 + for index328 = 0 + index328 < iter_elem.metadata.aliases.length() + index328 = index328 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index328] + let iter_base = address327 + index328 * 8 - let ptr324 = mbt_ffi_str2ptr(iter_elem) + let ptr326 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr324) - cleanup_list.push(ptr324) + mbt_ffi_store32(iter_base + 0, ptr326) + cleanup_list.push(ptr326) } mbt_ffi_store32( iter_base + 32, iter_elem.metadata.aliases.length(), ) - mbt_ffi_store32(iter_base + 28, address325) + mbt_ffi_store32(iter_base + 28, address327) - let address328 = mbt_ffi_malloc( + let address330 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index329 = 0 - index329 < iter_elem.metadata.examples.length() - index329 = index329 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index329] - let iter_base = address328 + index329 * 8 + for index331 = 0 + index331 < iter_elem.metadata.examples.length() + index331 = index331 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index331] + let iter_base = address330 + index331 * 8 - let ptr327 = mbt_ffi_str2ptr(iter_elem) + let ptr329 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr327) - cleanup_list.push(ptr327) + mbt_ffi_store32(iter_base + 0, ptr329) + cleanup_list.push(ptr329) } mbt_ffi_store32( iter_base + 40, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 36, address328) + mbt_ffi_store32(iter_base + 36, address330) match iter_elem.metadata.deprecated { None => { @@ -5902,13 +5930,13 @@ fn invoke_task_return( () } - Some(payload331) => { + Some(payload333) => { mbt_ffi_store8(iter_base + 44, 1) - let ptr332 = mbt_ffi_str2ptr(payload331) - mbt_ffi_store32(iter_base + 52, payload331.length()) - mbt_ffi_store32(iter_base + 48, ptr332) - cleanup_list.push(ptr332) + let ptr334 = mbt_ffi_str2ptr(payload333) + mbt_ffi_store32(iter_base + 52, payload333.length()) + mbt_ffi_store32(iter_base + 48, ptr334) + cleanup_list.push(ptr334) () } @@ -5920,10 +5948,10 @@ fn invoke_task_return( () } - Some(payload334) => { + Some(payload336) => { mbt_ffi_store8(iter_base + 56, 1) - match payload334 { + match payload336 { Multimodal => { mbt_ffi_store8(iter_base + 60, 0) @@ -5939,16 +5967,16 @@ fn invoke_task_return( () } - Other(payload338) => { + Other(payload340) => { mbt_ffi_store8(iter_base + 60, 3) - let ptr339 = mbt_ffi_str2ptr(payload338) + let ptr341 = mbt_ffi_str2ptr(payload340) mbt_ffi_store32( iter_base + 68, - payload338.length(), + payload340.length(), ) - mbt_ffi_store32(iter_base + 64, ptr339) - cleanup_list.push(ptr339) + mbt_ffi_store32(iter_base + 64, ptr341) + cleanup_list.push(ptr341) () } @@ -5957,130 +5985,130 @@ fn invoke_task_return( () } } - cleanup_list.push(ptr318) - cleanup_list.push(address325) - cleanup_list.push(address328) + cleanup_list.push(ptr320) + cleanup_list.push(address327) + cleanup_list.push(address330) } - mbt_ffi_store32(iter_base + 12, payload317.length()) - mbt_ffi_store32(iter_base + 8, address340) - cleanup_list.push(address340) + mbt_ffi_store32(iter_base + 12, payload319.length()) + mbt_ffi_store32(iter_base + 8, address342) + cleanup_list.push(address342) () } - EnumType(payload342) => { + EnumType(payload344) => { mbt_ffi_store8(iter_base + 0, 16) - let address344 = mbt_ffi_malloc(payload342.length() * 8) - for index345 = 0 - index345 < payload342.length() - index345 = index345 + 1 { - let iter_elem : String = payload342[index345] - let iter_base = address344 + index345 * 8 + let address346 = mbt_ffi_malloc(payload344.length() * 8) + for index347 = 0 + index347 < payload344.length() + index347 = index347 + 1 { + let iter_elem : String = payload344[index347] + let iter_base = address346 + index347 * 8 - let ptr343 = mbt_ffi_str2ptr(iter_elem) + let ptr345 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr343) - cleanup_list.push(ptr343) + mbt_ffi_store32(iter_base + 0, ptr345) + cleanup_list.push(ptr345) } - mbt_ffi_store32(iter_base + 12, payload342.length()) - mbt_ffi_store32(iter_base + 8, address344) - cleanup_list.push(address344) + mbt_ffi_store32(iter_base + 12, payload344.length()) + mbt_ffi_store32(iter_base + 8, address346) + cleanup_list.push(address346) () } - FlagsType(payload346) => { + FlagsType(payload348) => { mbt_ffi_store8(iter_base + 0, 17) - let address348 = mbt_ffi_malloc(payload346.length() * 8) - for index349 = 0 - index349 < payload346.length() - index349 = index349 + 1 { - let iter_elem : String = payload346[index349] - let iter_base = address348 + index349 * 8 + let address350 = mbt_ffi_malloc(payload348.length() * 8) + for index351 = 0 + index351 < payload348.length() + index351 = index351 + 1 { + let iter_elem : String = payload348[index351] + let iter_base = address350 + index351 * 8 - let ptr347 = mbt_ffi_str2ptr(iter_elem) + let ptr349 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr347) - cleanup_list.push(ptr347) + mbt_ffi_store32(iter_base + 0, ptr349) + cleanup_list.push(ptr349) } - mbt_ffi_store32(iter_base + 12, payload346.length()) - mbt_ffi_store32(iter_base + 8, address348) - cleanup_list.push(address348) + mbt_ffi_store32(iter_base + 12, payload348.length()) + mbt_ffi_store32(iter_base + 8, address350) + cleanup_list.push(address350) () } - TupleType(payload350) => { + TupleType(payload352) => { mbt_ffi_store8(iter_base + 0, 18) - let address351 = mbt_ffi_malloc(payload350.length() * 4) - for index352 = 0 - index352 < payload350.length() - index352 = index352 + 1 { - let iter_elem : Int = payload350[index352] - let iter_base = address351 + index352 * 4 + let address353 = mbt_ffi_malloc(payload352.length() * 4) + for index354 = 0 + index354 < payload352.length() + index354 = index354 + 1 { + let iter_elem : Int = payload352[index354] + let iter_base = address353 + index354 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload350.length()) - mbt_ffi_store32(iter_base + 8, address351) - cleanup_list.push(address351) + mbt_ffi_store32(iter_base + 12, payload352.length()) + mbt_ffi_store32(iter_base + 8, address353) + cleanup_list.push(address353) () } - ListType(payload353) => { + ListType(payload355) => { mbt_ffi_store8(iter_base + 0, 19) - mbt_ffi_store32(iter_base + 8, payload353) + mbt_ffi_store32(iter_base + 8, payload355) () } - FixedListType(payload354) => { + FixedListType(payload356) => { mbt_ffi_store8(iter_base + 0, 20) - mbt_ffi_store32(iter_base + 8, payload354.element) + mbt_ffi_store32(iter_base + 8, payload356.element) mbt_ffi_store32( iter_base + 12, - payload354.length.reinterpret_as_int(), + payload356.length.reinterpret_as_int(), ) () } - MapType(payload355) => { + MapType(payload357) => { mbt_ffi_store8(iter_base + 0, 21) - mbt_ffi_store32(iter_base + 8, payload355.key) - mbt_ffi_store32(iter_base + 12, payload355.value) + mbt_ffi_store32(iter_base + 8, payload357.key) + mbt_ffi_store32(iter_base + 12, payload357.value) () } - OptionType(payload356) => { + OptionType(payload358) => { mbt_ffi_store8(iter_base + 0, 22) - mbt_ffi_store32(iter_base + 8, payload356) + mbt_ffi_store32(iter_base + 8, payload358) () } - ResultType(payload357) => { + ResultType(payload359) => { mbt_ffi_store8(iter_base + 0, 23) - match payload357.ok { + match payload359.ok { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload359) => { + Some(payload361) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload359) + mbt_ffi_store32(iter_base + 12, payload361) () } } - match payload357.err { + match payload359.err { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload361) => { + Some(payload363) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store32(iter_base + 20, payload361) + mbt_ffi_store32(iter_base + 20, payload363) () } @@ -6088,85 +6116,85 @@ fn invoke_task_return( () } - TextType(payload362) => { + TextType(payload364) => { mbt_ffi_store8(iter_base + 0, 24) - match payload362.languages { + match payload364.languages { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload364) => { + Some(payload366) => { mbt_ffi_store8(iter_base + 8, 1) - let address366 = mbt_ffi_malloc(payload364.length() * 8) - for index367 = 0 - index367 < payload364.length() - index367 = index367 + 1 { - let iter_elem : String = payload364[index367] - let iter_base = address366 + index367 * 8 + let address368 = mbt_ffi_malloc(payload366.length() * 8) + for index369 = 0 + index369 < payload366.length() + index369 = index369 + 1 { + let iter_elem : String = payload366[index369] + let iter_base = address368 + index369 * 8 - let ptr365 = mbt_ffi_str2ptr(iter_elem) + let ptr367 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr365) - cleanup_list.push(ptr365) + mbt_ffi_store32(iter_base + 0, ptr367) + cleanup_list.push(ptr367) } - mbt_ffi_store32(iter_base + 16, payload364.length()) - mbt_ffi_store32(iter_base + 12, address366) - cleanup_list.push(address366) + mbt_ffi_store32(iter_base + 16, payload366.length()) + mbt_ffi_store32(iter_base + 12, address368) + cleanup_list.push(address368) () } } - match payload362.min_length { + match payload364.min_length { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload369) => { + Some(payload371) => { mbt_ffi_store8(iter_base + 20, 1) mbt_ffi_store32( iter_base + 24, - payload369.reinterpret_as_int(), + payload371.reinterpret_as_int(), ) () } } - match payload362.max_length { + match payload364.max_length { None => { mbt_ffi_store8(iter_base + 28, 0) () } - Some(payload371) => { + Some(payload373) => { mbt_ffi_store8(iter_base + 28, 1) mbt_ffi_store32( iter_base + 32, - payload371.reinterpret_as_int(), + payload373.reinterpret_as_int(), ) () } } - match payload362.regex { + match payload364.regex { None => { mbt_ffi_store8(iter_base + 36, 0) () } - Some(payload373) => { + Some(payload375) => { mbt_ffi_store8(iter_base + 36, 1) - let ptr374 = mbt_ffi_str2ptr(payload373) - mbt_ffi_store32(iter_base + 44, payload373.length()) - mbt_ffi_store32(iter_base + 40, ptr374) - cleanup_list.push(ptr374) + let ptr376 = mbt_ffi_str2ptr(payload375) + mbt_ffi_store32(iter_base + 44, payload375.length()) + mbt_ffi_store32(iter_base + 40, ptr376) + cleanup_list.push(ptr376) () } @@ -6174,66 +6202,66 @@ fn invoke_task_return( () } - BinaryType(payload375) => { + BinaryType(payload377) => { mbt_ffi_store8(iter_base + 0, 25) - match payload375.mime_types { + match payload377.mime_types { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload377) => { + Some(payload379) => { mbt_ffi_store8(iter_base + 8, 1) - let address379 = mbt_ffi_malloc(payload377.length() * 8) - for index380 = 0 - index380 < payload377.length() - index380 = index380 + 1 { - let iter_elem : String = payload377[index380] - let iter_base = address379 + index380 * 8 + let address381 = mbt_ffi_malloc(payload379.length() * 8) + for index382 = 0 + index382 < payload379.length() + index382 = index382 + 1 { + let iter_elem : String = payload379[index382] + let iter_base = address381 + index382 * 8 - let ptr378 = mbt_ffi_str2ptr(iter_elem) + let ptr380 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr378) - cleanup_list.push(ptr378) + mbt_ffi_store32(iter_base + 0, ptr380) + cleanup_list.push(ptr380) } - mbt_ffi_store32(iter_base + 16, payload377.length()) - mbt_ffi_store32(iter_base + 12, address379) - cleanup_list.push(address379) + mbt_ffi_store32(iter_base + 16, payload379.length()) + mbt_ffi_store32(iter_base + 12, address381) + cleanup_list.push(address381) () } } - match payload375.min_bytes { + match payload377.min_bytes { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload382) => { + Some(payload384) => { mbt_ffi_store8(iter_base + 20, 1) mbt_ffi_store32( iter_base + 24, - payload382.reinterpret_as_int(), + payload384.reinterpret_as_int(), ) () } } - match payload375.max_bytes { + match payload377.max_bytes { None => { mbt_ffi_store8(iter_base + 28, 0) () } - Some(payload384) => { + Some(payload386) => { mbt_ffi_store8(iter_base + 28, 1) mbt_ffi_store32( iter_base + 32, - payload384.reinterpret_as_int(), + payload386.reinterpret_as_int(), ) () @@ -6242,67 +6270,67 @@ fn invoke_task_return( () } - PathType(payload385) => { + PathType(payload387) => { mbt_ffi_store8(iter_base + 0, 26) mbt_ffi_store8( iter_base + 8, - payload385.direction.ordinal(), + payload387.direction.ordinal(), ) - mbt_ffi_store8(iter_base + 9, payload385.kind.ordinal()) + mbt_ffi_store8(iter_base + 9, payload387.kind.ordinal()) - match payload385.allowed_mime_types { + match payload387.allowed_mime_types { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload387) => { + Some(payload389) => { mbt_ffi_store8(iter_base + 12, 1) - let address389 = mbt_ffi_malloc(payload387.length() * 8) - for index390 = 0 - index390 < payload387.length() - index390 = index390 + 1 { - let iter_elem : String = payload387[index390] - let iter_base = address389 + index390 * 8 + let address391 = mbt_ffi_malloc(payload389.length() * 8) + for index392 = 0 + index392 < payload389.length() + index392 = index392 + 1 { + let iter_elem : String = payload389[index392] + let iter_base = address391 + index392 * 8 - let ptr388 = mbt_ffi_str2ptr(iter_elem) + let ptr390 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr388) - cleanup_list.push(ptr388) + mbt_ffi_store32(iter_base + 0, ptr390) + cleanup_list.push(ptr390) } - mbt_ffi_store32(iter_base + 20, payload387.length()) - mbt_ffi_store32(iter_base + 16, address389) - cleanup_list.push(address389) + mbt_ffi_store32(iter_base + 20, payload389.length()) + mbt_ffi_store32(iter_base + 16, address391) + cleanup_list.push(address391) () } } - match payload385.allowed_extensions { + match payload387.allowed_extensions { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload392) => { + Some(payload394) => { mbt_ffi_store8(iter_base + 24, 1) - let address394 = mbt_ffi_malloc(payload392.length() * 8) - for index395 = 0 - index395 < payload392.length() - index395 = index395 + 1 { - let iter_elem : String = payload392[index395] - let iter_base = address394 + index395 * 8 + let address396 = mbt_ffi_malloc(payload394.length() * 8) + for index397 = 0 + index397 < payload394.length() + index397 = index397 + 1 { + let iter_elem : String = payload394[index397] + let iter_base = address396 + index397 * 8 - let ptr393 = mbt_ffi_str2ptr(iter_elem) + let ptr395 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr393) - cleanup_list.push(ptr393) + mbt_ffi_store32(iter_base + 0, ptr395) + cleanup_list.push(ptr395) } - mbt_ffi_store32(iter_base + 32, payload392.length()) - mbt_ffi_store32(iter_base + 28, address394) - cleanup_list.push(address394) + mbt_ffi_store32(iter_base + 32, payload394.length()) + mbt_ffi_store32(iter_base + 28, address396) + cleanup_list.push(address396) () } @@ -6310,62 +6338,62 @@ fn invoke_task_return( () } - UrlType(payload396) => { + UrlType(payload398) => { mbt_ffi_store8(iter_base + 0, 27) - match payload396.allowed_schemes { + match payload398.allowed_schemes { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload398) => { + Some(payload400) => { mbt_ffi_store8(iter_base + 8, 1) - let address400 = mbt_ffi_malloc(payload398.length() * 8) - for index401 = 0 - index401 < payload398.length() - index401 = index401 + 1 { - let iter_elem : String = payload398[index401] - let iter_base = address400 + index401 * 8 + let address402 = mbt_ffi_malloc(payload400.length() * 8) + for index403 = 0 + index403 < payload400.length() + index403 = index403 + 1 { + let iter_elem : String = payload400[index403] + let iter_base = address402 + index403 * 8 - let ptr399 = mbt_ffi_str2ptr(iter_elem) + let ptr401 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr399) - cleanup_list.push(ptr399) + mbt_ffi_store32(iter_base + 0, ptr401) + cleanup_list.push(ptr401) } - mbt_ffi_store32(iter_base + 16, payload398.length()) - mbt_ffi_store32(iter_base + 12, address400) - cleanup_list.push(address400) + mbt_ffi_store32(iter_base + 16, payload400.length()) + mbt_ffi_store32(iter_base + 12, address402) + cleanup_list.push(address402) () } } - match payload396.allowed_hosts { + match payload398.allowed_hosts { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload403) => { + Some(payload405) => { mbt_ffi_store8(iter_base + 20, 1) - let address405 = mbt_ffi_malloc(payload403.length() * 8) - for index406 = 0 - index406 < payload403.length() - index406 = index406 + 1 { - let iter_elem : String = payload403[index406] - let iter_base = address405 + index406 * 8 + let address407 = mbt_ffi_malloc(payload405.length() * 8) + for index408 = 0 + index408 < payload405.length() + index408 = index408 + 1 { + let iter_elem : String = payload405[index408] + let iter_base = address407 + index408 * 8 - let ptr404 = mbt_ffi_str2ptr(iter_elem) + let ptr406 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr404) - cleanup_list.push(ptr404) + mbt_ffi_store32(iter_base + 0, ptr406) + cleanup_list.push(ptr406) } - mbt_ffi_store32(iter_base + 28, payload403.length()) - mbt_ffi_store32(iter_base + 24, address405) - cleanup_list.push(address405) + mbt_ffi_store32(iter_base + 28, payload405.length()) + mbt_ffi_store32(iter_base + 24, address407) + cleanup_list.push(address407) () } @@ -6383,117 +6411,107 @@ fn invoke_task_return( () } - QuantityType(payload409) => { + QuantityType(payload411) => { mbt_ffi_store8(iter_base + 0, 30) - let ptr410 = mbt_ffi_str2ptr(payload409.base_unit) + let ptr412 = mbt_ffi_str2ptr(payload411.base_unit) mbt_ffi_store32( iter_base + 12, - payload409.base_unit.length(), + payload411.base_unit.length(), ) - mbt_ffi_store32(iter_base + 8, ptr410) + mbt_ffi_store32(iter_base + 8, ptr412) - let address412 = mbt_ffi_malloc( - payload409.allowed_suffixes.length() * 8, + let address414 = mbt_ffi_malloc( + payload411.allowed_suffixes.length() * 8, ) - for index413 = 0 - index413 < payload409.allowed_suffixes.length() - index413 = index413 + 1 { - let iter_elem : String = payload409.allowed_suffixes[index413] - let iter_base = address412 + index413 * 8 + for index415 = 0 + index415 < payload411.allowed_suffixes.length() + index415 = index415 + 1 { + let iter_elem : String = payload411.allowed_suffixes[index415] + let iter_base = address414 + index415 * 8 - let ptr411 = mbt_ffi_str2ptr(iter_elem) + let ptr413 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr411) - cleanup_list.push(ptr411) + mbt_ffi_store32(iter_base + 0, ptr413) + cleanup_list.push(ptr413) } mbt_ffi_store32( iter_base + 20, - payload409.allowed_suffixes.length(), + payload411.allowed_suffixes.length(), ) - mbt_ffi_store32(iter_base + 16, address412) + mbt_ffi_store32(iter_base + 16, address414) - match payload409.min { + match payload411.min { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload415) => { + Some(payload417) => { mbt_ffi_store8(iter_base + 24, 1) - mbt_ffi_store64(iter_base + 32, payload415.mantissa) - mbt_ffi_store32(iter_base + 40, payload415.scale) + mbt_ffi_store64(iter_base + 32, payload417.mantissa) + mbt_ffi_store32(iter_base + 40, payload417.scale) - let ptr416 = mbt_ffi_str2ptr(payload415.unit) + let ptr418 = mbt_ffi_str2ptr(payload417.unit) mbt_ffi_store32( iter_base + 48, - payload415.unit.length(), + payload417.unit.length(), ) - mbt_ffi_store32(iter_base + 44, ptr416) - cleanup_list.push(ptr416) + mbt_ffi_store32(iter_base + 44, ptr418) + cleanup_list.push(ptr418) () } } - match payload409.max { + match payload411.max { None => { mbt_ffi_store8(iter_base + 56, 0) () } - Some(payload418) => { + Some(payload420) => { mbt_ffi_store8(iter_base + 56, 1) - mbt_ffi_store64(iter_base + 64, payload418.mantissa) - mbt_ffi_store32(iter_base + 72, payload418.scale) + mbt_ffi_store64(iter_base + 64, payload420.mantissa) + mbt_ffi_store32(iter_base + 72, payload420.scale) - let ptr419 = mbt_ffi_str2ptr(payload418.unit) + let ptr421 = mbt_ffi_str2ptr(payload420.unit) mbt_ffi_store32( iter_base + 80, - payload418.unit.length(), + payload420.unit.length(), ) - mbt_ffi_store32(iter_base + 76, ptr419) - cleanup_list.push(ptr419) + mbt_ffi_store32(iter_base + 76, ptr421) + cleanup_list.push(ptr421) () } } - cleanup_list.push(ptr410) - cleanup_list.push(address412) + cleanup_list.push(ptr412) + cleanup_list.push(address414) () } - UnionType(payload420) => { + UnionType(payload422) => { mbt_ffi_store8(iter_base + 0, 31) - let address456 = mbt_ffi_malloc( - payload420.branches.length() * 92, + let address458 = mbt_ffi_malloc( + payload422.branches.length() * 92, ) - for index457 = 0 - index457 < payload420.branches.length() - index457 = index457 + 1 { - let iter_elem : @types.UnionBranch = payload420.branches[index457] - let iter_base = address456 + index457 * 92 + for index459 = 0 + index459 < payload422.branches.length() + index459 = index459 + 1 { + let iter_elem : @types.UnionBranch = payload422.branches[index459] + let iter_base = address458 + index459 * 92 - let ptr421 = mbt_ffi_str2ptr(iter_elem.tag) + let ptr423 = mbt_ffi_str2ptr(iter_elem.tag) mbt_ffi_store32(iter_base + 4, iter_elem.tag.length()) - mbt_ffi_store32(iter_base + 0, ptr421) + mbt_ffi_store32(iter_base + 0, ptr423) mbt_ffi_store32(iter_base + 8, iter_elem.body) match iter_elem.discriminator { - Prefix(payload422) => { + Prefix(payload424) => { mbt_ffi_store8(iter_base + 12, 0) - let ptr423 = mbt_ffi_str2ptr(payload422) - mbt_ffi_store32(iter_base + 20, payload422.length()) - mbt_ffi_store32(iter_base + 16, ptr423) - cleanup_list.push(ptr423) - - () - } - Suffix(payload424) => { - mbt_ffi_store8(iter_base + 12, 1) - let ptr425 = mbt_ffi_str2ptr(payload424) mbt_ffi_store32(iter_base + 20, payload424.length()) mbt_ffi_store32(iter_base + 16, ptr425) @@ -6501,8 +6519,8 @@ fn invoke_task_return( () } - Contains(payload426) => { - mbt_ffi_store8(iter_base + 12, 2) + Suffix(payload426) => { + mbt_ffi_store8(iter_base + 12, 1) let ptr427 = mbt_ffi_str2ptr(payload426) mbt_ffi_store32(iter_base + 20, payload426.length()) @@ -6511,8 +6529,8 @@ fn invoke_task_return( () } - Regex(payload428) => { - mbt_ffi_store8(iter_base + 12, 3) + Contains(payload428) => { + mbt_ffi_store8(iter_base + 12, 2) let ptr429 = mbt_ffi_str2ptr(payload428) mbt_ffi_store32(iter_base + 20, payload428.length()) @@ -6521,47 +6539,57 @@ fn invoke_task_return( () } - FieldEquals(payload430) => { + Regex(payload430) => { + mbt_ffi_store8(iter_base + 12, 3) + + let ptr431 = mbt_ffi_str2ptr(payload430) + mbt_ffi_store32(iter_base + 20, payload430.length()) + mbt_ffi_store32(iter_base + 16, ptr431) + cleanup_list.push(ptr431) + + () + } + FieldEquals(payload432) => { mbt_ffi_store8(iter_base + 12, 4) - let ptr431 = mbt_ffi_str2ptr(payload430.field_name) + let ptr433 = mbt_ffi_str2ptr(payload432.field_name) mbt_ffi_store32( iter_base + 20, - payload430.field_name.length(), + payload432.field_name.length(), ) - mbt_ffi_store32(iter_base + 16, ptr431) + mbt_ffi_store32(iter_base + 16, ptr433) - match payload430.literal { + match payload432.literal { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload433) => { + Some(payload435) => { mbt_ffi_store8(iter_base + 24, 1) - let ptr434 = mbt_ffi_str2ptr(payload433) + let ptr436 = mbt_ffi_str2ptr(payload435) mbt_ffi_store32( iter_base + 32, - payload433.length(), + payload435.length(), ) - mbt_ffi_store32(iter_base + 28, ptr434) - cleanup_list.push(ptr434) + mbt_ffi_store32(iter_base + 28, ptr436) + cleanup_list.push(ptr436) () } } - cleanup_list.push(ptr431) + cleanup_list.push(ptr433) () } - FieldAbsent(payload435) => { + FieldAbsent(payload437) => { mbt_ffi_store8(iter_base + 12, 5) - let ptr436 = mbt_ffi_str2ptr(payload435) - mbt_ffi_store32(iter_base + 20, payload435.length()) - mbt_ffi_store32(iter_base + 16, ptr436) - cleanup_list.push(ptr436) + let ptr438 = mbt_ffi_str2ptr(payload437) + mbt_ffi_store32(iter_base + 20, payload437.length()) + mbt_ffi_store32(iter_base + 16, ptr438) + cleanup_list.push(ptr438) () } @@ -6573,57 +6601,57 @@ fn invoke_task_return( () } - Some(payload438) => { + Some(payload440) => { mbt_ffi_store8(iter_base + 36, 1) - let ptr439 = mbt_ffi_str2ptr(payload438) - mbt_ffi_store32(iter_base + 44, payload438.length()) - mbt_ffi_store32(iter_base + 40, ptr439) - cleanup_list.push(ptr439) + let ptr441 = mbt_ffi_str2ptr(payload440) + mbt_ffi_store32(iter_base + 44, payload440.length()) + mbt_ffi_store32(iter_base + 40, ptr441) + cleanup_list.push(ptr441) () } } - let address441 = mbt_ffi_malloc( + let address443 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index442 = 0 - index442 < iter_elem.metadata.aliases.length() - index442 = index442 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index442] - let iter_base = address441 + index442 * 8 + for index444 = 0 + index444 < iter_elem.metadata.aliases.length() + index444 = index444 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index444] + let iter_base = address443 + index444 * 8 - let ptr440 = mbt_ffi_str2ptr(iter_elem) + let ptr442 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr440) - cleanup_list.push(ptr440) + mbt_ffi_store32(iter_base + 0, ptr442) + cleanup_list.push(ptr442) } mbt_ffi_store32( iter_base + 52, iter_elem.metadata.aliases.length(), ) - mbt_ffi_store32(iter_base + 48, address441) + mbt_ffi_store32(iter_base + 48, address443) - let address444 = mbt_ffi_malloc( + let address446 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index445 = 0 - index445 < iter_elem.metadata.examples.length() - index445 = index445 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index445] - let iter_base = address444 + index445 * 8 + for index447 = 0 + index447 < iter_elem.metadata.examples.length() + index447 = index447 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index447] + let iter_base = address446 + index447 * 8 - let ptr443 = mbt_ffi_str2ptr(iter_elem) + let ptr445 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr443) - cleanup_list.push(ptr443) + mbt_ffi_store32(iter_base + 0, ptr445) + cleanup_list.push(ptr445) } mbt_ffi_store32( iter_base + 60, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 56, address444) + mbt_ffi_store32(iter_base + 56, address446) match iter_elem.metadata.deprecated { None => { @@ -6631,13 +6659,13 @@ fn invoke_task_return( () } - Some(payload447) => { + Some(payload449) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr448 = mbt_ffi_str2ptr(payload447) - mbt_ffi_store32(iter_base + 72, payload447.length()) - mbt_ffi_store32(iter_base + 68, ptr448) - cleanup_list.push(ptr448) + let ptr450 = mbt_ffi_str2ptr(payload449) + mbt_ffi_store32(iter_base + 72, payload449.length()) + mbt_ffi_store32(iter_base + 68, ptr450) + cleanup_list.push(ptr450) () } @@ -6649,10 +6677,10 @@ fn invoke_task_return( () } - Some(payload450) => { + Some(payload452) => { mbt_ffi_store8(iter_base + 76, 1) - match payload450 { + match payload452 { Multimodal => { mbt_ffi_store8(iter_base + 80, 0) @@ -6668,16 +6696,16 @@ fn invoke_task_return( () } - Other(payload454) => { + Other(payload456) => { mbt_ffi_store8(iter_base + 80, 3) - let ptr455 = mbt_ffi_str2ptr(payload454) + let ptr457 = mbt_ffi_str2ptr(payload456) mbt_ffi_store32( iter_base + 88, - payload454.length(), + payload456.length(), ) - mbt_ffi_store32(iter_base + 84, ptr455) - cleanup_list.push(ptr455) + mbt_ffi_store32(iter_base + 84, ptr457) + cleanup_list.push(ptr457) () } @@ -6686,36 +6714,36 @@ fn invoke_task_return( () } } - cleanup_list.push(ptr421) - cleanup_list.push(address441) - cleanup_list.push(address444) + cleanup_list.push(ptr423) + cleanup_list.push(address443) + cleanup_list.push(address446) } mbt_ffi_store32( iter_base + 12, - payload420.branches.length(), + payload422.branches.length(), ) - mbt_ffi_store32(iter_base + 8, address456) - cleanup_list.push(address456) + mbt_ffi_store32(iter_base + 8, address458) + cleanup_list.push(address458) () } - SecretType(payload458) => { + SecretType(payload460) => { mbt_ffi_store8(iter_base + 0, 32) - mbt_ffi_store32(iter_base + 8, payload458.inner) + mbt_ffi_store32(iter_base + 8, payload460.inner) - match payload458.category { + match payload460.category { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload460) => { + Some(payload462) => { mbt_ffi_store8(iter_base + 12, 1) - let ptr461 = mbt_ffi_str2ptr(payload460) - mbt_ffi_store32(iter_base + 20, payload460.length()) - mbt_ffi_store32(iter_base + 16, ptr461) - cleanup_list.push(ptr461) + let ptr463 = mbt_ffi_str2ptr(payload462) + mbt_ffi_store32(iter_base + 20, payload462.length()) + mbt_ffi_store32(iter_base + 16, ptr463) + cleanup_list.push(ptr463) () } @@ -6723,22 +6751,22 @@ fn invoke_task_return( () } - QuotaTokenType(payload462) => { + QuotaTokenType(payload464) => { mbt_ffi_store8(iter_base + 0, 33) - match payload462.resource_name { + match payload464.resource_name { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload464) => { + Some(payload466) => { mbt_ffi_store8(iter_base + 8, 1) - let ptr465 = mbt_ffi_str2ptr(payload464) - mbt_ffi_store32(iter_base + 16, payload464.length()) - mbt_ffi_store32(iter_base + 12, ptr465) - cleanup_list.push(ptr465) + let ptr467 = mbt_ffi_str2ptr(payload466) + mbt_ffi_store32(iter_base + 16, payload466.length()) + mbt_ffi_store32(iter_base + 12, ptr467) + cleanup_list.push(ptr467) () } @@ -6746,18 +6774,18 @@ fn invoke_task_return( () } - FutureType(payload466) => { + FutureType(payload468) => { mbt_ffi_store8(iter_base + 0, 34) - match payload466 { + match payload468 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload468) => { + Some(payload470) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload468) + mbt_ffi_store32(iter_base + 12, payload470) () } @@ -6765,18 +6793,18 @@ fn invoke_task_return( () } - StreamType(payload469) => { + StreamType(payload471) => { mbt_ffi_store8(iter_base + 0, 35) - match payload469 { + match payload471 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload471) => { + Some(payload473) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload471) + mbt_ffi_store32(iter_base + 12, payload473) () } @@ -6792,57 +6820,57 @@ fn invoke_task_return( () } - Some(payload473) => { + Some(payload475) => { mbt_ffi_store8(iter_base + 88, 1) - let ptr474 = mbt_ffi_str2ptr(payload473) - mbt_ffi_store32(iter_base + 96, payload473.length()) - mbt_ffi_store32(iter_base + 92, ptr474) - cleanup_list.push(ptr474) + let ptr476 = mbt_ffi_str2ptr(payload475) + mbt_ffi_store32(iter_base + 96, payload475.length()) + mbt_ffi_store32(iter_base + 92, ptr476) + cleanup_list.push(ptr476) () } } - let address476 = mbt_ffi_malloc( + let address478 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index477 = 0 - index477 < iter_elem.metadata.aliases.length() - index477 = index477 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index477] - let iter_base = address476 + index477 * 8 + for index479 = 0 + index479 < iter_elem.metadata.aliases.length() + index479 = index479 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index479] + let iter_base = address478 + index479 * 8 - let ptr475 = mbt_ffi_str2ptr(iter_elem) + let ptr477 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr475) - cleanup_list.push(ptr475) + mbt_ffi_store32(iter_base + 0, ptr477) + cleanup_list.push(ptr477) } mbt_ffi_store32( iter_base + 104, iter_elem.metadata.aliases.length(), ) - mbt_ffi_store32(iter_base + 100, address476) + mbt_ffi_store32(iter_base + 100, address478) - let address479 = mbt_ffi_malloc( + let address481 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index480 = 0 - index480 < iter_elem.metadata.examples.length() - index480 = index480 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index480] - let iter_base = address479 + index480 * 8 + for index482 = 0 + index482 < iter_elem.metadata.examples.length() + index482 = index482 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index482] + let iter_base = address481 + index482 * 8 - let ptr478 = mbt_ffi_str2ptr(iter_elem) + let ptr480 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr478) - cleanup_list.push(ptr478) + mbt_ffi_store32(iter_base + 0, ptr480) + cleanup_list.push(ptr480) } mbt_ffi_store32( iter_base + 112, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 108, address479) + mbt_ffi_store32(iter_base + 108, address481) match iter_elem.metadata.deprecated { None => { @@ -6850,13 +6878,13 @@ fn invoke_task_return( () } - Some(payload482) => { + Some(payload484) => { mbt_ffi_store8(iter_base + 116, 1) - let ptr483 = mbt_ffi_str2ptr(payload482) - mbt_ffi_store32(iter_base + 124, payload482.length()) - mbt_ffi_store32(iter_base + 120, ptr483) - cleanup_list.push(ptr483) + let ptr485 = mbt_ffi_str2ptr(payload484) + mbt_ffi_store32(iter_base + 124, payload484.length()) + mbt_ffi_store32(iter_base + 120, ptr485) + cleanup_list.push(ptr485) () } @@ -6868,10 +6896,10 @@ fn invoke_task_return( () } - Some(payload485) => { + Some(payload487) => { mbt_ffi_store8(iter_base + 128, 1) - match payload485 { + match payload487 { Multimodal => { mbt_ffi_store8(iter_base + 132, 0) @@ -6887,13 +6915,13 @@ fn invoke_task_return( () } - Other(payload489) => { + Other(payload491) => { mbt_ffi_store8(iter_base + 132, 3) - let ptr490 = mbt_ffi_str2ptr(payload489) - mbt_ffi_store32(iter_base + 140, payload489.length()) - mbt_ffi_store32(iter_base + 136, ptr490) - cleanup_list.push(ptr490) + let ptr492 = mbt_ffi_str2ptr(payload491) + mbt_ffi_store32(iter_base + 140, payload491.length()) + mbt_ffi_store32(iter_base + 136, ptr492) + cleanup_list.push(ptr492) () } @@ -6902,22 +6930,22 @@ fn invoke_task_return( () } } - cleanup_list.push(address476) - cleanup_list.push(address479) + cleanup_list.push(address478) + cleanup_list.push(address481) } - let address497 = mbt_ffi_malloc( - payload129.graph.defs.length() * 24, + let address499 = mbt_ffi_malloc( + payload131.graph.defs.length() * 24, ) - for index498 = 0 - index498 < payload129.graph.defs.length() - index498 = index498 + 1 { - let iter_elem : @types.SchemaTypeDef = payload129.graph.defs[index498] - let iter_base = address497 + index498 * 24 + for index500 = 0 + index500 < payload131.graph.defs.length() + index500 = index500 + 1 { + let iter_elem : @types.SchemaTypeDef = payload131.graph.defs[index500] + let iter_base = address499 + index500 * 24 - let ptr493 = mbt_ffi_str2ptr(iter_elem.id) + let ptr495 = mbt_ffi_str2ptr(iter_elem.id) mbt_ffi_store32(iter_base + 4, iter_elem.id.length()) - mbt_ffi_store32(iter_base + 0, ptr493) + mbt_ffi_store32(iter_base + 0, ptr495) match iter_elem.name { None => { @@ -6925,36 +6953,36 @@ fn invoke_task_return( () } - Some(payload495) => { + Some(payload497) => { mbt_ffi_store8(iter_base + 8, 1) - let ptr496 = mbt_ffi_str2ptr(payload495) - mbt_ffi_store32(iter_base + 16, payload495.length()) - mbt_ffi_store32(iter_base + 12, ptr496) - cleanup_list.push(ptr496) + let ptr498 = mbt_ffi_str2ptr(payload497) + mbt_ffi_store32(iter_base + 16, payload497.length()) + mbt_ffi_store32(iter_base + 12, ptr498) + cleanup_list.push(ptr498) () } } mbt_ffi_store32(iter_base + 20, iter_elem.body) - cleanup_list.push(ptr493) + cleanup_list.push(ptr495) } - let address569 = mbt_ffi_malloc( - payload129.value.value_nodes.length() * 32, + let address573 = mbt_ffi_malloc( + payload131.value.value_nodes.length() * 32, ) - for index570 = 0 - index570 < payload129.value.value_nodes.length() - index570 = index570 + 1 { - let iter_elem : @types.SchemaValueNode = payload129.value.value_nodes[index570] - let iter_base = address569 + index570 * 32 + for index574 = 0 + index574 < payload131.value.value_nodes.length() + index574 = index574 + 1 { + let iter_elem : @types.SchemaValueNode = payload131.value.value_nodes[index574] + let iter_base = address573 + index574 * 32 match iter_elem { - BoolValue(payload499) => { + BoolValue(payload501) => { mbt_ffi_store8(iter_base + 0, 0) mbt_ffi_store8( iter_base + 8, - if payload499 { + if payload501 { 1 } else { 0 @@ -6963,124 +6991,124 @@ fn invoke_task_return( () } - S8Value(payload500) => { + S8Value(payload502) => { mbt_ffi_store8(iter_base + 0, 1) - mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload500)) + mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload502)) () } - S16Value(payload501) => { + S16Value(payload503) => { mbt_ffi_store8(iter_base + 0, 2) - mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload501)) + mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload503)) () } - S32Value(payload502) => { + S32Value(payload504) => { mbt_ffi_store8(iter_base + 0, 3) - mbt_ffi_store32(iter_base + 8, payload502) + mbt_ffi_store32(iter_base + 8, payload504) () } - S64Value(payload503) => { + S64Value(payload505) => { mbt_ffi_store8(iter_base + 0, 4) - mbt_ffi_store64(iter_base + 8, payload503) + mbt_ffi_store64(iter_base + 8, payload505) () } - U8Value(payload504) => { + U8Value(payload506) => { mbt_ffi_store8(iter_base + 0, 5) - mbt_ffi_store8(iter_base + 8, payload504.to_int()) + mbt_ffi_store8(iter_base + 8, payload506.to_int()) () } - U16Value(payload505) => { + U16Value(payload507) => { mbt_ffi_store8(iter_base + 0, 6) mbt_ffi_store16( iter_base + 8, - payload505.reinterpret_as_int(), + payload507.reinterpret_as_int(), ) () } - U32Value(payload506) => { + U32Value(payload508) => { mbt_ffi_store8(iter_base + 0, 7) mbt_ffi_store32( iter_base + 8, - payload506.reinterpret_as_int(), + payload508.reinterpret_as_int(), ) () } - U64Value(payload507) => { + U64Value(payload509) => { mbt_ffi_store8(iter_base + 0, 8) mbt_ffi_store64( iter_base + 8, - payload507.reinterpret_as_int64(), + payload509.reinterpret_as_int64(), ) () } - F32Value(payload508) => { + F32Value(payload510) => { mbt_ffi_store8(iter_base + 0, 9) - mbt_ffi_storef32(iter_base + 8, payload508) + mbt_ffi_storef32(iter_base + 8, payload510) () } - F64Value(payload509) => { + F64Value(payload511) => { mbt_ffi_store8(iter_base + 0, 10) - mbt_ffi_storef64(iter_base + 8, payload509) + mbt_ffi_storef64(iter_base + 8, payload511) () } - CharValue(payload510) => { + CharValue(payload512) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload510.to_int()) + mbt_ffi_store32(iter_base + 8, payload512.to_int()) () } - StringValue(payload511) => { + StringValue(payload513) => { mbt_ffi_store8(iter_base + 0, 12) - let ptr512 = mbt_ffi_str2ptr(payload511) - mbt_ffi_store32(iter_base + 12, payload511.length()) - mbt_ffi_store32(iter_base + 8, ptr512) - cleanup_list.push(ptr512) + let ptr514 = mbt_ffi_str2ptr(payload513) + mbt_ffi_store32(iter_base + 12, payload513.length()) + mbt_ffi_store32(iter_base + 8, ptr514) + cleanup_list.push(ptr514) () } - RecordValue(payload513) => { + RecordValue(payload515) => { mbt_ffi_store8(iter_base + 0, 13) - let address514 = mbt_ffi_malloc(payload513.length() * 4) - for index515 = 0 - index515 < payload513.length() - index515 = index515 + 1 { - let iter_elem : Int = payload513[index515] - let iter_base = address514 + index515 * 4 + let address516 = mbt_ffi_malloc(payload515.length() * 4) + for index517 = 0 + index517 < payload515.length() + index517 = index517 + 1 { + let iter_elem : Int = payload515[index517] + let iter_base = address516 + index517 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload513.length()) - mbt_ffi_store32(iter_base + 8, address514) - cleanup_list.push(address514) + mbt_ffi_store32(iter_base + 12, payload515.length()) + mbt_ffi_store32(iter_base + 8, address516) + cleanup_list.push(address516) () } - VariantValue(payload516) => { + VariantValue(payload518) => { mbt_ffi_store8(iter_base + 0, 14) mbt_ffi_store32( iter_base + 8, - payload516.case.reinterpret_as_int(), + payload518.case.reinterpret_as_int(), ) - match payload516.payload { + match payload518.payload { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload518) => { + Some(payload520) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload518) + mbt_ffi_store32(iter_base + 16, payload520) () } @@ -7088,24 +7116,24 @@ fn invoke_task_return( () } - EnumValue(payload519) => { + EnumValue(payload521) => { mbt_ffi_store8(iter_base + 0, 15) mbt_ffi_store32( iter_base + 8, - payload519.reinterpret_as_int(), + payload521.reinterpret_as_int(), ) () } - FlagsValue(payload520) => { + FlagsValue(payload522) => { mbt_ffi_store8(iter_base + 0, 16) - let address521 = mbt_ffi_malloc(payload520.length() * 1) - for index522 = 0 - index522 < payload520.length() - index522 = index522 + 1 { - let iter_elem : Bool = payload520[index522] - let iter_base = address521 + index522 * 1 + let address523 = mbt_ffi_malloc(payload522.length() * 1) + for index524 = 0 + index524 < payload522.length() + index524 = index524 + 1 { + let iter_elem : Bool = payload522[index524] + let iter_base = address523 + index524 * 1 mbt_ffi_store8( iter_base + 0, if iter_elem { @@ -7115,93 +7143,93 @@ fn invoke_task_return( }, ) } - mbt_ffi_store32(iter_base + 12, payload520.length()) - mbt_ffi_store32(iter_base + 8, address521) - cleanup_list.push(address521) + mbt_ffi_store32(iter_base + 12, payload522.length()) + mbt_ffi_store32(iter_base + 8, address523) + cleanup_list.push(address523) () } - TupleValue(payload523) => { + TupleValue(payload525) => { mbt_ffi_store8(iter_base + 0, 17) - let address524 = mbt_ffi_malloc(payload523.length() * 4) - for index525 = 0 - index525 < payload523.length() - index525 = index525 + 1 { - let iter_elem : Int = payload523[index525] - let iter_base = address524 + index525 * 4 + let address526 = mbt_ffi_malloc(payload525.length() * 4) + for index527 = 0 + index527 < payload525.length() + index527 = index527 + 1 { + let iter_elem : Int = payload525[index527] + let iter_base = address526 + index527 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload523.length()) - mbt_ffi_store32(iter_base + 8, address524) - cleanup_list.push(address524) + mbt_ffi_store32(iter_base + 12, payload525.length()) + mbt_ffi_store32(iter_base + 8, address526) + cleanup_list.push(address526) () } - ListValue(payload526) => { + ListValue(payload528) => { mbt_ffi_store8(iter_base + 0, 18) - let address527 = mbt_ffi_malloc(payload526.length() * 4) - for index528 = 0 - index528 < payload526.length() - index528 = index528 + 1 { - let iter_elem : Int = payload526[index528] - let iter_base = address527 + index528 * 4 + let address529 = mbt_ffi_malloc(payload528.length() * 4) + for index530 = 0 + index530 < payload528.length() + index530 = index530 + 1 { + let iter_elem : Int = payload528[index530] + let iter_base = address529 + index530 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload526.length()) - mbt_ffi_store32(iter_base + 8, address527) - cleanup_list.push(address527) + mbt_ffi_store32(iter_base + 12, payload528.length()) + mbt_ffi_store32(iter_base + 8, address529) + cleanup_list.push(address529) () } - FixedListValue(payload529) => { + FixedListValue(payload531) => { mbt_ffi_store8(iter_base + 0, 19) - let address530 = mbt_ffi_malloc(payload529.length() * 4) - for index531 = 0 - index531 < payload529.length() - index531 = index531 + 1 { - let iter_elem : Int = payload529[index531] - let iter_base = address530 + index531 * 4 + let address532 = mbt_ffi_malloc(payload531.length() * 4) + for index533 = 0 + index533 < payload531.length() + index533 = index533 + 1 { + let iter_elem : Int = payload531[index533] + let iter_base = address532 + index533 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload529.length()) - mbt_ffi_store32(iter_base + 8, address530) - cleanup_list.push(address530) + mbt_ffi_store32(iter_base + 12, payload531.length()) + mbt_ffi_store32(iter_base + 8, address532) + cleanup_list.push(address532) () } - MapValue(payload532) => { + MapValue(payload534) => { mbt_ffi_store8(iter_base + 0, 20) - let address533 = mbt_ffi_malloc(payload532.length() * 8) - for index534 = 0 - index534 < payload532.length() - index534 = index534 + 1 { - let iter_elem : @types.MapEntry = payload532[index534] - let iter_base = address533 + index534 * 8 + let address535 = mbt_ffi_malloc(payload534.length() * 8) + for index536 = 0 + index536 < payload534.length() + index536 = index536 + 1 { + let iter_elem : @types.MapEntry = payload534[index536] + let iter_base = address535 + index536 * 8 mbt_ffi_store32(iter_base + 0, iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.value) } - mbt_ffi_store32(iter_base + 12, payload532.length()) - mbt_ffi_store32(iter_base + 8, address533) - cleanup_list.push(address533) + mbt_ffi_store32(iter_base + 12, payload534.length()) + mbt_ffi_store32(iter_base + 8, address535) + cleanup_list.push(address535) () } - OptionValue(payload535) => { + OptionValue(payload537) => { mbt_ffi_store8(iter_base + 0, 21) - match payload535 { + match payload537 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload537) => { + Some(payload539) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload537) + mbt_ffi_store32(iter_base + 12, payload539) () } @@ -7209,22 +7237,22 @@ fn invoke_task_return( () } - ResultValue(payload538) => { + ResultValue(payload540) => { mbt_ffi_store8(iter_base + 0, 22) - match payload538 { - OkValue(payload539) => { + match payload540 { + OkValue(payload541) => { mbt_ffi_store8(iter_base + 8, 0) - match payload539 { + match payload541 { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload541) => { + Some(payload543) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload541) + mbt_ffi_store32(iter_base + 16, payload543) () } @@ -7232,18 +7260,18 @@ fn invoke_task_return( () } - ErrValue(payload542) => { + ErrValue(payload544) => { mbt_ffi_store8(iter_base + 8, 1) - match payload542 { + match payload544 { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload544) => { + Some(payload546) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload544) + mbt_ffi_store32(iter_base + 16, payload546) () } @@ -7255,168 +7283,176 @@ fn invoke_task_return( () } - TextValue(payload545) => { + TextValue(payload547) => { mbt_ffi_store8(iter_base + 0, 23) - let ptr546 = mbt_ffi_str2ptr(payload545.text) - mbt_ffi_store32(iter_base + 12, payload545.text.length()) - mbt_ffi_store32(iter_base + 8, ptr546) + let ptr548 = mbt_ffi_str2ptr(payload547.text) + mbt_ffi_store32(iter_base + 12, payload547.text.length()) + mbt_ffi_store32(iter_base + 8, ptr548) - match payload545.language { + match payload547.language { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload548) => { + Some(payload550) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr549 = mbt_ffi_str2ptr(payload548) - mbt_ffi_store32(iter_base + 24, payload548.length()) - mbt_ffi_store32(iter_base + 20, ptr549) - cleanup_list.push(ptr549) + let ptr551 = mbt_ffi_str2ptr(payload550) + mbt_ffi_store32(iter_base + 24, payload550.length()) + mbt_ffi_store32(iter_base + 20, ptr551) + cleanup_list.push(ptr551) () } } - cleanup_list.push(ptr546) + cleanup_list.push(ptr548) () } - BinaryValue(payload550) => { + BinaryValue(payload552) => { mbt_ffi_store8(iter_base + 0, 24) - let ptr551 = mbt_ffi_bytes2ptr(payload550.bytes) + let ptr553 = mbt_ffi_bytes2ptr(payload552.bytes) - mbt_ffi_store32(iter_base + 12, payload550.bytes.length()) - mbt_ffi_store32(iter_base + 8, ptr551) + mbt_ffi_store32(iter_base + 12, payload552.bytes.length()) + mbt_ffi_store32(iter_base + 8, ptr553) - match payload550.mime_type { + match payload552.mime_type { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload553) => { + Some(payload555) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr554 = mbt_ffi_str2ptr(payload553) - mbt_ffi_store32(iter_base + 24, payload553.length()) - mbt_ffi_store32(iter_base + 20, ptr554) - cleanup_list.push(ptr554) + let ptr556 = mbt_ffi_str2ptr(payload555) + mbt_ffi_store32(iter_base + 24, payload555.length()) + mbt_ffi_store32(iter_base + 20, ptr556) + cleanup_list.push(ptr556) () } } - cleanup_list.push(ptr551) + cleanup_list.push(ptr553) () } - PathValue(payload555) => { + PathValue(payload557) => { mbt_ffi_store8(iter_base + 0, 25) - let ptr556 = mbt_ffi_str2ptr(payload555) - mbt_ffi_store32(iter_base + 12, payload555.length()) - mbt_ffi_store32(iter_base + 8, ptr556) - cleanup_list.push(ptr556) + let ptr558 = mbt_ffi_str2ptr(payload557) + mbt_ffi_store32(iter_base + 12, payload557.length()) + mbt_ffi_store32(iter_base + 8, ptr558) + cleanup_list.push(ptr558) () } - UrlValue(payload557) => { + UrlValue(payload559) => { mbt_ffi_store8(iter_base + 0, 26) - let ptr558 = mbt_ffi_str2ptr(payload557) - mbt_ffi_store32(iter_base + 12, payload557.length()) - mbt_ffi_store32(iter_base + 8, ptr558) - cleanup_list.push(ptr558) + let ptr560 = mbt_ffi_str2ptr(payload559) + mbt_ffi_store32(iter_base + 12, payload559.length()) + mbt_ffi_store32(iter_base + 8, ptr560) + cleanup_list.push(ptr560) () } - DatetimeValue(payload559) => { + DatetimeValue(payload561) => { mbt_ffi_store8(iter_base + 0, 27) - mbt_ffi_store64(iter_base + 8, payload559.seconds) + mbt_ffi_store64(iter_base + 8, payload561.seconds) mbt_ffi_store32( iter_base + 16, - payload559.nanoseconds.reinterpret_as_int(), + payload561.nanoseconds.reinterpret_as_int(), ) () } - DurationValue(payload560) => { + DurationValue(payload562) => { mbt_ffi_store8(iter_base + 0, 28) - mbt_ffi_store64(iter_base + 8, payload560.nanoseconds) + mbt_ffi_store64(iter_base + 8, payload562.nanoseconds) () } - QuantityValueNode(payload561) => { + QuantityValueNode(payload563) => { mbt_ffi_store8(iter_base + 0, 29) - mbt_ffi_store64(iter_base + 8, payload561.mantissa) - mbt_ffi_store32(iter_base + 16, payload561.scale) + mbt_ffi_store64(iter_base + 8, payload563.mantissa) + mbt_ffi_store32(iter_base + 16, payload563.scale) - let ptr562 = mbt_ffi_str2ptr(payload561.unit) - mbt_ffi_store32(iter_base + 24, payload561.unit.length()) - mbt_ffi_store32(iter_base + 20, ptr562) - cleanup_list.push(ptr562) + let ptr564 = mbt_ffi_str2ptr(payload563.unit) + mbt_ffi_store32(iter_base + 24, payload563.unit.length()) + mbt_ffi_store32(iter_base + 20, ptr564) + cleanup_list.push(ptr564) () } - UnionValue(payload563) => { + UnionValue(payload565) => { mbt_ffi_store8(iter_base + 0, 30) - let ptr564 = mbt_ffi_str2ptr(payload563.tag) - mbt_ffi_store32(iter_base + 12, payload563.tag.length()) - mbt_ffi_store32(iter_base + 8, ptr564) - mbt_ffi_store32(iter_base + 16, payload563.body) - cleanup_list.push(ptr564) + let ptr566 = mbt_ffi_str2ptr(payload565.tag) + mbt_ffi_store32(iter_base + 12, payload565.tag.length()) + mbt_ffi_store32(iter_base + 8, ptr566) + mbt_ffi_store32(iter_base + 16, payload565.body) + cleanup_list.push(ptr566) () } - SecretValue(payload565) => { + SecretValue(payload567) => { mbt_ffi_store8(iter_base + 0, 31) - let @types.Secret(handle566) = payload565 - mbt_ffi_store32(iter_base + 8, handle566) + let @types.Secret(handle568) = payload567 + mbt_ffi_store32(iter_base + 8, handle568) () } - QuotaTokenHandle(payload567) => { + QuotaTokenHandle(payload569) => { mbt_ffi_store8(iter_base + 0, 32) - let @types.QuotaToken(handle568) = payload567 - mbt_ffi_store32(iter_base + 8, handle568) + let @types.QuotaToken(handle570) = payload569 + mbt_ffi_store32(iter_base + 8, handle570) + + () + } + StreamValue(payload571) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle572) = payload571 + mbt_ffi_store32(iter_base + 8, handle572) () } } } - cleanup_list.push(address491) - cleanup_list.push(address497) - cleanup_list.push(address569) + cleanup_list.push(address493) + cleanup_list.push(address499) + cleanup_list.push(address573) ( 4, - address491, - payload129.graph.type_nodes.length(), - address497, - payload129.graph.defs.length(), - payload129.graph.root, - address569, - payload129.value.value_nodes.length(), - payload129.value.root, + address493, + payload131.graph.type_nodes.length(), + address499, + payload131.graph.defs.length(), + payload131.graph.root, + address573, + payload131.value.value_nodes.length(), + payload131.value.root, ) } } ( - 1, lowered571, lowered572, lowered573, lowered574, lowered575, lowered576, - lowered577, lowered578, lowered579, + 1, lowered575, lowered576, lowered577, lowered578, lowered579, lowered580, + lowered581, lowered582, lowered583, ) } } wasmExportAsyncInvokeGolemAgentGuestTaskReturn( - lowered580, lowered581, lowered582, lowered583, lowered584, lowered585, lowered586, - lowered587, lowered588, lowered589, + lowered584, lowered585, lowered586, lowered587, lowered588, lowered589, lowered590, + lowered591, lowered592, lowered593, ) cleanup_list.each(mbt_ffi_free) @@ -7442,7 +7478,7 @@ pub fn wasmExportAsyncInvokeGolemAgentGuest( pub fn wasmExportGetDefinition() -> Int { let result : @common.AgentType = get_definition() let return_area = mbt_ffi_malloc(176) - __wit_bindgen_lower_t402(return_area + 0, result) + __wit_bindgen_lower_t405(return_area + 0, result) let ret = return_area return ret } @@ -8928,7 +8964,7 @@ pub fn wasmExportDiscoverAgentTypes() -> Int { for index = 0; index < payload.length(); index = index + 1 { let iter_elem : @common.AgentType = payload[index] let iter_base = address + index * 176 - __wit_bindgen_lower_t402(iter_base + 0, iter_elem) + __wit_bindgen_lower_t405(iter_base + 0, iter_elem) } mbt_ffi_store32(return_area + 8, payload.length()) mbt_ffi_store32(return_area + 4, address) @@ -8937,7 +8973,7 @@ pub fn wasmExportDiscoverAgentTypes() -> Int { } Err(payload0) => { mbt_ffi_store8(return_area + 0, 1) - __wit_bindgen_lower_t405(return_area + 4, payload0) + __wit_bindgen_lower_t408(return_area + 4, payload0) () } @@ -11014,6 +11050,7 @@ pub fn wasmExportDiscoverAgentTypesPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -11034,7 +11071,7 @@ fn __wit_bindgen_lower_t5(ptr : Int, value : @types.Datetime) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t16(ptr : Int, value : @types.SchemaTypeDef) -> Unit { +fn __wit_bindgen_lower_t17(ptr : Int, value : @types.SchemaTypeDef) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.id) mbt_ffi_store32(ptr + 4, value.id.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -11060,7 +11097,7 @@ fn __wit_bindgen_lower_t16(ptr : Int, value : @types.SchemaTypeDef) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t17(ptr : Int, value : @types.Role) -> Unit { +fn __wit_bindgen_lower_t18(ptr : Int, value : @types.Role) -> Unit { match value { Multimodal => { mbt_ffi_store8(ptr + 0, 0) @@ -11091,7 +11128,7 @@ fn __wit_bindgen_lower_t17(ptr : Int, value : @types.Role) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { +fn __wit_bindgen_lower_t21(ptr : Int, value : @types.MetadataEnvelope) -> Unit { match value.doc { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11158,7 +11195,7 @@ fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { } Some(payload10) => { mbt_ffi_store8(ptr + 40, 1) - __wit_bindgen_lower_t17(ptr + 44, payload10) + __wit_bindgen_lower_t18(ptr + 44, payload10) () } @@ -11167,17 +11204,17 @@ fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t21(ptr : Int, value : @types.NamedFieldType) -> Unit { +fn __wit_bindgen_lower_t22(ptr : Int, value : @types.NamedFieldType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) mbt_ffi_store32(ptr + 8, value.body) - __wit_bindgen_lower_t20(ptr + 12, value.metadata) + __wit_bindgen_lower_t21(ptr + 12, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t23(ptr : Int, value : @types.VariantCaseType) -> Unit { +fn __wit_bindgen_lower_t24(ptr : Int, value : @types.VariantCaseType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -11195,26 +11232,26 @@ fn __wit_bindgen_lower_t23(ptr : Int, value : @types.VariantCaseType) -> Unit { () } } - __wit_bindgen_lower_t20(ptr + 16, value.metadata) + __wit_bindgen_lower_t21(ptr + 16, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t24(ptr : Int, value : @types.FixedListSpec) -> Unit { +fn __wit_bindgen_lower_t25(ptr : Int, value : @types.FixedListSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.element) mbt_ffi_store32(ptr + 4, value.length.reinterpret_as_int()) } ///| #doc(hidden) -fn __wit_bindgen_lower_t25(ptr : Int, value : @types.MapSpec) -> Unit { +fn __wit_bindgen_lower_t26(ptr : Int, value : @types.MapSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.key) mbt_ffi_store32(ptr + 4, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t26(ptr : Int, value : @types.ResultSpec) -> Unit { +fn __wit_bindgen_lower_t27(ptr : Int, value : @types.ResultSpec) -> Unit { match value.ok { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11246,7 +11283,7 @@ fn __wit_bindgen_lower_t26(ptr : Int, value : @types.ResultSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t27(ptr : Int, value : @types.NumericBound) -> Unit { +fn __wit_bindgen_lower_t28(ptr : Int, value : @types.NumericBound) -> Unit { match value { Signed(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -11271,7 +11308,7 @@ fn __wit_bindgen_lower_t27(ptr : Int, value : @types.NumericBound) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t29( +fn __wit_bindgen_lower_t30( ptr : Int, value : @types.NumericRestrictions, ) -> Unit { @@ -11283,7 +11320,7 @@ fn __wit_bindgen_lower_t29( } Some(payload0) => { mbt_ffi_store8(ptr + 0, 1) - __wit_bindgen_lower_t27(ptr + 8, payload0) + __wit_bindgen_lower_t28(ptr + 8, payload0) () } @@ -11297,7 +11334,7 @@ fn __wit_bindgen_lower_t29( } Some(payload2) => { mbt_ffi_store8(ptr + 24, 1) - __wit_bindgen_lower_t27(ptr + 32, payload2) + __wit_bindgen_lower_t28(ptr + 32, payload2) () } @@ -11323,7 +11360,7 @@ fn __wit_bindgen_lower_t29( ///| #doc(hidden) -fn __wit_bindgen_lower_t32(ptr : Int, value : @types.TextRestrictions) -> Unit { +fn __wit_bindgen_lower_t33(ptr : Int, value : @types.TextRestrictions) -> Unit { match value.languages { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11397,7 +11434,7 @@ fn __wit_bindgen_lower_t32(ptr : Int, value : @types.TextRestrictions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t33( +fn __wit_bindgen_lower_t34( ptr : Int, value : @types.BinaryRestrictions, ) -> Unit { @@ -11457,7 +11494,7 @@ fn __wit_bindgen_lower_t33( ///| #doc(hidden) -fn __wit_bindgen_lower_t36(ptr : Int, value : @types.PathSpec) -> Unit { +fn __wit_bindgen_lower_t37(ptr : Int, value : @types.PathSpec) -> Unit { mbt_ffi_store8(ptr + 0, value.direction.ordinal()) mbt_ffi_store8(ptr + 1, value.kind.ordinal()) @@ -11514,7 +11551,7 @@ fn __wit_bindgen_lower_t36(ptr : Int, value : @types.PathSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t37(ptr : Int, value : @types.UrlRestrictions) -> Unit { +fn __wit_bindgen_lower_t38(ptr : Int, value : @types.UrlRestrictions) -> Unit { match value.allowed_schemes { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11568,7 +11605,7 @@ fn __wit_bindgen_lower_t37(ptr : Int, value : @types.UrlRestrictions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t38(ptr : Int, value : @types.QuantityValue) -> Unit { +fn __wit_bindgen_lower_t39(ptr : Int, value : @types.QuantityValue) -> Unit { mbt_ffi_store64(ptr + 0, value.mantissa) mbt_ffi_store32(ptr + 8, value.scale) @@ -11579,7 +11616,7 @@ fn __wit_bindgen_lower_t38(ptr : Int, value : @types.QuantityValue) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { +fn __wit_bindgen_lower_t41(ptr : Int, value : @types.QuantitySpec) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.base_unit) mbt_ffi_store32(ptr + 4, value.base_unit.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -11604,7 +11641,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { } Some(payload2) => { mbt_ffi_store8(ptr + 16, 1) - __wit_bindgen_lower_t38(ptr + 24, payload2) + __wit_bindgen_lower_t39(ptr + 24, payload2) () } @@ -11618,7 +11655,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 48, 1) - __wit_bindgen_lower_t38(ptr + 56, payload4) + __wit_bindgen_lower_t39(ptr + 56, payload4) () } @@ -11627,7 +11664,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t41( +fn __wit_bindgen_lower_t42( ptr : Int, value : @types.FieldDiscriminator, ) -> Unit { @@ -11655,7 +11692,7 @@ fn __wit_bindgen_lower_t41( ///| #doc(hidden) -fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit { +fn __wit_bindgen_lower_t43(ptr : Int, value : @types.DiscriminatorRule) -> Unit { match value { Prefix(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -11695,7 +11732,7 @@ fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit } FieldEquals(payload7) => { mbt_ffi_store8(ptr + 0, 4) - __wit_bindgen_lower_t41(ptr + 4, payload7) + __wit_bindgen_lower_t42(ptr + 4, payload7) () } @@ -11713,23 +11750,23 @@ fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t43(ptr : Int, value : @types.UnionBranch) -> Unit { +fn __wit_bindgen_lower_t44(ptr : Int, value : @types.UnionBranch) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.tag) mbt_ffi_store32(ptr + 4, value.tag.length()) mbt_ffi_store32(ptr + 0, ptr0) mbt_ffi_store32(ptr + 8, value.body) - __wit_bindgen_lower_t42(ptr + 12, value.discriminator) - __wit_bindgen_lower_t20(ptr + 36, value.metadata) + __wit_bindgen_lower_t43(ptr + 12, value.discriminator) + __wit_bindgen_lower_t21(ptr + 36, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t45(ptr : Int, value : @types.UnionSpec) -> Unit { +fn __wit_bindgen_lower_t46(ptr : Int, value : @types.UnionSpec) -> Unit { let address = mbt_ffi_malloc(value.branches.length() * 92) for index = 0; index < value.branches.length(); index = index + 1 { let iter_elem : @types.UnionBranch = value.branches[index] let iter_base = address + index * 92 - __wit_bindgen_lower_t43(iter_base + 0, iter_elem) + __wit_bindgen_lower_t44(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.branches.length()) mbt_ffi_store32(ptr + 0, address) @@ -11737,7 +11774,7 @@ fn __wit_bindgen_lower_t45(ptr : Int, value : @types.UnionSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t46(ptr : Int, value : @types.SecretSpec) -> Unit { +fn __wit_bindgen_lower_t47(ptr : Int, value : @types.SecretSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.inner) match value.category { @@ -11760,7 +11797,7 @@ fn __wit_bindgen_lower_t46(ptr : Int, value : @types.SecretSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t47(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { +fn __wit_bindgen_lower_t48(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { match value.resource_name { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11781,7 +11818,7 @@ fn __wit_bindgen_lower_t47(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { +fn __wit_bindgen_lower_t53(ptr : Int, value : @types.SchemaTypeBody) -> Unit { match value { RefType(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -11805,7 +11842,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload3) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload3) + __wit_bindgen_lower_t30(ptr + 16, payload3) () } @@ -11824,7 +11861,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload6) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload6) + __wit_bindgen_lower_t30(ptr + 16, payload6) () } @@ -11843,7 +11880,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload9) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload9) + __wit_bindgen_lower_t30(ptr + 16, payload9) () } @@ -11862,7 +11899,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload12) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload12) + __wit_bindgen_lower_t30(ptr + 16, payload12) () } @@ -11881,7 +11918,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload15) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload15) + __wit_bindgen_lower_t30(ptr + 16, payload15) () } @@ -11900,7 +11937,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload18) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload18) + __wit_bindgen_lower_t30(ptr + 16, payload18) () } @@ -11919,7 +11956,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload21) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload21) + __wit_bindgen_lower_t30(ptr + 16, payload21) () } @@ -11938,7 +11975,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload24) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload24) + __wit_bindgen_lower_t30(ptr + 16, payload24) () } @@ -11957,7 +11994,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload27) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload27) + __wit_bindgen_lower_t30(ptr + 16, payload27) () } @@ -11976,7 +12013,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload30) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload30) + __wit_bindgen_lower_t30(ptr + 16, payload30) () } @@ -12001,7 +12038,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { for index = 0; index < payload33.length(); index = index + 1 { let iter_elem : @types.NamedFieldType = payload33[index] let iter_base = address + index * 68 - __wit_bindgen_lower_t21(iter_base + 0, iter_elem) + __wit_bindgen_lower_t22(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload33.length()) mbt_ffi_store32(ptr + 8, address) @@ -12015,7 +12052,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { for index36 = 0; index36 < payload34.length(); index36 = index36 + 1 { let iter_elem : @types.VariantCaseType = payload34[index36] let iter_base = address35 + index36 * 72 - __wit_bindgen_lower_t23(iter_base + 0, iter_elem) + __wit_bindgen_lower_t24(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload34.length()) mbt_ffi_store32(ptr + 8, address35) @@ -12078,13 +12115,13 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } FixedListType(payload49) => { mbt_ffi_store8(ptr + 0, 20) - __wit_bindgen_lower_t24(ptr + 8, payload49) + __wit_bindgen_lower_t25(ptr + 8, payload49) () } MapType(payload50) => { mbt_ffi_store8(ptr + 0, 21) - __wit_bindgen_lower_t25(ptr + 8, payload50) + __wit_bindgen_lower_t26(ptr + 8, payload50) () } @@ -12096,31 +12133,31 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } ResultType(payload52) => { mbt_ffi_store8(ptr + 0, 23) - __wit_bindgen_lower_t26(ptr + 8, payload52) + __wit_bindgen_lower_t27(ptr + 8, payload52) () } TextType(payload53) => { mbt_ffi_store8(ptr + 0, 24) - __wit_bindgen_lower_t32(ptr + 8, payload53) + __wit_bindgen_lower_t33(ptr + 8, payload53) () } BinaryType(payload54) => { mbt_ffi_store8(ptr + 0, 25) - __wit_bindgen_lower_t33(ptr + 8, payload54) + __wit_bindgen_lower_t34(ptr + 8, payload54) () } PathType(payload55) => { mbt_ffi_store8(ptr + 0, 26) - __wit_bindgen_lower_t36(ptr + 8, payload55) + __wit_bindgen_lower_t37(ptr + 8, payload55) () } UrlType(payload56) => { mbt_ffi_store8(ptr + 0, 27) - __wit_bindgen_lower_t37(ptr + 8, payload56) + __wit_bindgen_lower_t38(ptr + 8, payload56) () } @@ -12136,25 +12173,25 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } QuantityType(payload59) => { mbt_ffi_store8(ptr + 0, 30) - __wit_bindgen_lower_t40(ptr + 8, payload59) + __wit_bindgen_lower_t41(ptr + 8, payload59) () } UnionType(payload60) => { mbt_ffi_store8(ptr + 0, 31) - __wit_bindgen_lower_t45(ptr + 8, payload60) + __wit_bindgen_lower_t46(ptr + 8, payload60) () } SecretType(payload61) => { mbt_ffi_store8(ptr + 0, 32) - __wit_bindgen_lower_t46(ptr + 8, payload61) + __wit_bindgen_lower_t47(ptr + 8, payload61) () } QuotaTokenType(payload62) => { mbt_ffi_store8(ptr + 0, 33) - __wit_bindgen_lower_t47(ptr + 8, payload62) + __wit_bindgen_lower_t48(ptr + 8, payload62) () } @@ -12201,19 +12238,19 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t53(ptr : Int, value : @types.SchemaTypeNode) -> Unit { - __wit_bindgen_lower_t52(ptr + 0, value.body) - __wit_bindgen_lower_t20(ptr + 88, value.metadata) +fn __wit_bindgen_lower_t54(ptr : Int, value : @types.SchemaTypeNode) -> Unit { + __wit_bindgen_lower_t53(ptr + 0, value.body) + __wit_bindgen_lower_t21(ptr + 88, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { +fn __wit_bindgen_lower_t57(ptr : Int, value : @types.SchemaGraph) -> Unit { let address = mbt_ffi_malloc(value.type_nodes.length() * 144) for index = 0; index < value.type_nodes.length(); index = index + 1 { let iter_elem : @types.SchemaTypeNode = value.type_nodes[index] let iter_base = address + index * 144 - __wit_bindgen_lower_t53(iter_base + 0, iter_elem) + __wit_bindgen_lower_t54(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.type_nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -12222,7 +12259,7 @@ fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { for index1 = 0; index1 < value.defs.length(); index1 = index1 + 1 { let iter_elem : @types.SchemaTypeDef = value.defs[index1] let iter_base = address0 + index1 * 24 - __wit_bindgen_lower_t16(iter_base + 0, iter_elem) + __wit_bindgen_lower_t17(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, value.defs.length()) mbt_ffi_store32(ptr + 8, address0) @@ -12231,7 +12268,7 @@ fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t58( +fn __wit_bindgen_lower_t59( ptr : Int, value : @types.VariantValuePayload, ) -> Unit { @@ -12254,14 +12291,14 @@ fn __wit_bindgen_lower_t58( ///| #doc(hidden) -fn __wit_bindgen_lower_t59(ptr : Int, value : @types.MapEntry) -> Unit { +fn __wit_bindgen_lower_t60(ptr : Int, value : @types.MapEntry) -> Unit { mbt_ffi_store32(ptr + 0, value.key) mbt_ffi_store32(ptr + 4, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t60( +fn __wit_bindgen_lower_t61( ptr : Int, value : @types.ResultValuePayload, ) -> Unit { @@ -12309,7 +12346,7 @@ fn __wit_bindgen_lower_t60( ///| #doc(hidden) -fn __wit_bindgen_lower_t61(ptr : Int, value : @types.TextValuePayload) -> Unit { +fn __wit_bindgen_lower_t62(ptr : Int, value : @types.TextValuePayload) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.text) mbt_ffi_store32(ptr + 4, value.text.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12334,7 +12371,7 @@ fn __wit_bindgen_lower_t61(ptr : Int, value : @types.TextValuePayload) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t63( +fn __wit_bindgen_lower_t64( ptr : Int, value : @types.BinaryValuePayload, ) -> Unit { @@ -12363,7 +12400,7 @@ fn __wit_bindgen_lower_t63( ///| #doc(hidden) -fn __wit_bindgen_lower_t64( +fn __wit_bindgen_lower_t65( ptr : Int, value : @types.DurationValuePayload, ) -> Unit { @@ -12372,7 +12409,7 @@ fn __wit_bindgen_lower_t64( ///| #doc(hidden) -fn __wit_bindgen_lower_t65(ptr : Int, value : @types.UnionValuePayload) -> Unit { +fn __wit_bindgen_lower_t66(ptr : Int, value : @types.UnionValuePayload) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.tag) mbt_ffi_store32(ptr + 4, value.tag.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12381,7 +12418,7 @@ fn __wit_bindgen_lower_t65(ptr : Int, value : @types.UnionValuePayload) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { +fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueNode) -> Unit { match value { BoolValue(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -12480,7 +12517,7 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } VariantValue(payload14) => { mbt_ffi_store8(ptr + 0, 14) - __wit_bindgen_lower_t58(ptr + 8, payload14) + __wit_bindgen_lower_t59(ptr + 8, payload14) () } @@ -12553,7 +12590,7 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { for index30 = 0; index30 < payload28.length(); index30 = index30 + 1 { let iter_elem : @types.MapEntry = payload28[index30] let iter_base = address29 + index30 * 8 - __wit_bindgen_lower_t59(iter_base + 0, iter_elem) + __wit_bindgen_lower_t60(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload28.length()) mbt_ffi_store32(ptr + 8, address29) @@ -12581,19 +12618,19 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } ResultValue(payload34) => { mbt_ffi_store8(ptr + 0, 22) - __wit_bindgen_lower_t60(ptr + 8, payload34) + __wit_bindgen_lower_t61(ptr + 8, payload34) () } TextValue(payload35) => { mbt_ffi_store8(ptr + 0, 23) - __wit_bindgen_lower_t61(ptr + 8, payload35) + __wit_bindgen_lower_t62(ptr + 8, payload35) () } BinaryValue(payload36) => { mbt_ffi_store8(ptr + 0, 24) - __wit_bindgen_lower_t63(ptr + 8, payload36) + __wit_bindgen_lower_t64(ptr + 8, payload36) () } @@ -12623,19 +12660,19 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } DurationValue(payload42) => { mbt_ffi_store8(ptr + 0, 28) - __wit_bindgen_lower_t64(ptr + 8, payload42) + __wit_bindgen_lower_t65(ptr + 8, payload42) () } QuantityValueNode(payload43) => { mbt_ffi_store8(ptr + 0, 29) - __wit_bindgen_lower_t38(ptr + 8, payload43) + __wit_bindgen_lower_t39(ptr + 8, payload43) () } UnionValue(payload44) => { mbt_ffi_store8(ptr + 0, 30) - __wit_bindgen_lower_t65(ptr + 8, payload44) + __wit_bindgen_lower_t66(ptr + 8, payload44) () } @@ -12653,6 +12690,14 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { let @types.QuotaToken(handle47) = payload46 mbt_ffi_store32(ptr + 8, handle47) + () + } + StreamValue(payload48) => { + mbt_ffi_store8(ptr + 0, 33) + + let @types.SchemaValueStream(handle49) = payload48 + mbt_ffi_store32(ptr + 8, handle49) + () } } @@ -12660,12 +12705,12 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueTree) -> Unit { +fn __wit_bindgen_lower_t75(ptr : Int, value : @types.SchemaValueTree) -> Unit { let address = mbt_ffi_malloc(value.value_nodes.length() * 32) for index = 0; index < value.value_nodes.length(); index = index + 1 { let iter_elem : @types.SchemaValueNode = value.value_nodes[index] let iter_base = address + index * 32 - __wit_bindgen_lower_t71(iter_base + 0, iter_elem) + __wit_bindgen_lower_t73(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.value_nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -12674,14 +12719,14 @@ fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueTree) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t74(ptr : Int, value : @types.TypedSchemaValue) -> Unit { - __wit_bindgen_lower_t56(ptr + 0, value.graph) - __wit_bindgen_lower_t73(ptr + 20, value.value) +fn __wit_bindgen_lower_t76(ptr : Int, value : @types.TypedSchemaValue) -> Unit { + __wit_bindgen_lower_t57(ptr + 0, value.graph) + __wit_bindgen_lower_t75(ptr + 20, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t361(ptr : Int, value : @common.FieldSource) -> Unit { +fn __wit_bindgen_lower_t364(ptr : Int, value : @common.FieldSource) -> Unit { match value { UserSupplied => { mbt_ffi_store8(ptr + 0, 0) @@ -12699,18 +12744,18 @@ fn __wit_bindgen_lower_t361(ptr : Int, value : @common.FieldSource) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t362(ptr : Int, value : @common.NamedField) -> Unit { +fn __wit_bindgen_lower_t365(ptr : Int, value : @common.NamedField) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t361(ptr + 8, value.source) + __wit_bindgen_lower_t364(ptr + 8, value.source) mbt_ffi_store32(ptr + 12, value.schema) - __wit_bindgen_lower_t20(ptr + 16, value.metadata) + __wit_bindgen_lower_t21(ptr + 16, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t364(ptr : Int, value : @common.InputSchema) -> Unit { +fn __wit_bindgen_lower_t367(ptr : Int, value : @common.InputSchema) -> Unit { match value { Parameters(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -12719,7 +12764,7 @@ fn __wit_bindgen_lower_t364(ptr : Int, value : @common.InputSchema) -> Unit { for index = 0; index < payload.length(); index = index + 1 { let iter_elem : @common.NamedField = payload[index] let iter_base = address + index * 72 - __wit_bindgen_lower_t362(iter_base + 0, iter_elem) + __wit_bindgen_lower_t365(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload.length()) mbt_ffi_store32(ptr + 4, address) @@ -12731,7 +12776,7 @@ fn __wit_bindgen_lower_t364(ptr : Int, value : @common.InputSchema) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t365(ptr : Int, value : @common.OutputSchema) -> Unit { +fn __wit_bindgen_lower_t368(ptr : Int, value : @common.OutputSchema) -> Unit { match value { Unit => { mbt_ffi_store8(ptr + 0, 0) @@ -12749,7 +12794,7 @@ fn __wit_bindgen_lower_t365(ptr : Int, value : @common.OutputSchema) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t366(ptr : Int, value : @common.CachePolicy) -> Unit { +fn __wit_bindgen_lower_t369(ptr : Int, value : @common.CachePolicy) -> Unit { match value { NoCache => { mbt_ffi_store8(ptr + 0, 0) @@ -12772,14 +12817,14 @@ fn __wit_bindgen_lower_t366(ptr : Int, value : @common.CachePolicy) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t367(ptr : Int, value : @common.ReadOnlyConfig) -> Unit { - __wit_bindgen_lower_t366(ptr + 0, value.cache_policy) +fn __wit_bindgen_lower_t370(ptr : Int, value : @common.ReadOnlyConfig) -> Unit { + __wit_bindgen_lower_t369(ptr + 0, value.cache_policy) mbt_ffi_store8(ptr + 16, if value.uses_principal { 1 } else { 0 }) } ///| #doc(hidden) -fn __wit_bindgen_lower_t369(ptr : Int, value : @common.CorsOptions) -> Unit { +fn __wit_bindgen_lower_t372(ptr : Int, value : @common.CorsOptions) -> Unit { let address = mbt_ffi_malloc(value.allowed_patterns.length() * 8) for index = 0; index < value.allowed_patterns.length(); index = index + 1 { let iter_elem : String = value.allowed_patterns[index] @@ -12795,7 +12840,7 @@ fn __wit_bindgen_lower_t369(ptr : Int, value : @common.CorsOptions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t370(ptr : Int, value : @common.HttpMethod) -> Unit { +fn __wit_bindgen_lower_t373(ptr : Int, value : @common.HttpMethod) -> Unit { match value { Get => { mbt_ffi_store8(ptr + 0, 0) @@ -12856,7 +12901,7 @@ fn __wit_bindgen_lower_t370(ptr : Int, value : @common.HttpMethod) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t372(ptr : Int, value : @common.PathVariable) -> Unit { +fn __wit_bindgen_lower_t375(ptr : Int, value : @common.PathVariable) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.variable_name) mbt_ffi_store32(ptr + 4, value.variable_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12864,7 +12909,7 @@ fn __wit_bindgen_lower_t372(ptr : Int, value : @common.PathVariable) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t373(ptr : Int, value : @common.PathSegment) -> Unit { +fn __wit_bindgen_lower_t376(ptr : Int, value : @common.PathSegment) -> Unit { match value { Literal(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -12883,13 +12928,13 @@ fn __wit_bindgen_lower_t373(ptr : Int, value : @common.PathSegment) -> Unit { } PathVariable(payload2) => { mbt_ffi_store8(ptr + 0, 2) - __wit_bindgen_lower_t372(ptr + 4, payload2) + __wit_bindgen_lower_t375(ptr + 4, payload2) () } RemainingPathVariable(payload3) => { mbt_ffi_store8(ptr + 0, 3) - __wit_bindgen_lower_t372(ptr + 4, payload3) + __wit_bindgen_lower_t375(ptr + 4, payload3) () } @@ -12898,7 +12943,7 @@ fn __wit_bindgen_lower_t373(ptr : Int, value : @common.PathSegment) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t374(ptr : Int, value : @common.HeaderVariable) -> Unit { +fn __wit_bindgen_lower_t377(ptr : Int, value : @common.HeaderVariable) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.header_name) mbt_ffi_store32(ptr + 4, value.header_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12910,7 +12955,7 @@ fn __wit_bindgen_lower_t374(ptr : Int, value : @common.HeaderVariable) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t375(ptr : Int, value : @common.QueryVariable) -> Unit { +fn __wit_bindgen_lower_t378(ptr : Int, value : @common.QueryVariable) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.query_param_name) mbt_ffi_store32(ptr + 4, value.query_param_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12922,13 +12967,13 @@ fn __wit_bindgen_lower_t375(ptr : Int, value : @common.QueryVariable) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t376(ptr : Int, value : @common.AuthDetails) -> Unit { +fn __wit_bindgen_lower_t379(ptr : Int, value : @common.AuthDetails) -> Unit { mbt_ffi_store8(ptr + 0, if value.required { 1 } else { 0 }) } ///| #doc(hidden) -fn __wit_bindgen_lower_t379( +fn __wit_bindgen_lower_t382( ptr : Int, value : @common.HttpMountDetails, ) -> Unit { @@ -12936,7 +12981,7 @@ fn __wit_bindgen_lower_t379( for index = 0; index < value.path_prefix.length(); index = index + 1 { let iter_elem : @common.PathSegment = value.path_prefix[index] let iter_base = address + index * 12 - __wit_bindgen_lower_t373(iter_base + 0, iter_elem) + __wit_bindgen_lower_t376(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.path_prefix.length()) mbt_ffi_store32(ptr + 0, address) @@ -12949,19 +12994,19 @@ fn __wit_bindgen_lower_t379( } Some(payload0) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t376(ptr + 9, payload0) + __wit_bindgen_lower_t379(ptr + 9, payload0) () } } mbt_ffi_store8(ptr + 10, if value.phantom_agent { 1 } else { 0 }) - __wit_bindgen_lower_t369(ptr + 12, value.cors_options) + __wit_bindgen_lower_t372(ptr + 12, value.cors_options) let address1 = mbt_ffi_malloc(value.webhook_suffix.length() * 12) for index2 = 0; index2 < value.webhook_suffix.length(); index2 = index2 + 1 { let iter_elem : @common.PathSegment = value.webhook_suffix[index2] let iter_base = address1 + index2 * 12 - __wit_bindgen_lower_t373(iter_base + 0, iter_elem) + __wit_bindgen_lower_t376(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 24, value.webhook_suffix.length()) mbt_ffi_store32(ptr + 20, address1) @@ -12969,17 +13014,17 @@ fn __wit_bindgen_lower_t379( ///| #doc(hidden) -fn __wit_bindgen_lower_t382( +fn __wit_bindgen_lower_t385( ptr : Int, value : @common.HttpEndpointDetails, ) -> Unit { - __wit_bindgen_lower_t370(ptr + 0, value.http_method) + __wit_bindgen_lower_t373(ptr + 0, value.http_method) let address = mbt_ffi_malloc(value.path_suffix.length() * 12) for index = 0; index < value.path_suffix.length(); index = index + 1 { let iter_elem : @common.PathSegment = value.path_suffix[index] let iter_base = address + index * 12 - __wit_bindgen_lower_t373(iter_base + 0, iter_elem) + __wit_bindgen_lower_t376(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 16, value.path_suffix.length()) mbt_ffi_store32(ptr + 12, address) @@ -12988,7 +13033,7 @@ fn __wit_bindgen_lower_t382( for index1 = 0; index1 < value.header_vars.length(); index1 = index1 + 1 { let iter_elem : @common.HeaderVariable = value.header_vars[index1] let iter_base = address0 + index1 * 16 - __wit_bindgen_lower_t374(iter_base + 0, iter_elem) + __wit_bindgen_lower_t377(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 24, value.header_vars.length()) mbt_ffi_store32(ptr + 20, address0) @@ -12997,7 +13042,7 @@ fn __wit_bindgen_lower_t382( for index3 = 0; index3 < value.query_vars.length(); index3 = index3 + 1 { let iter_elem : @common.QueryVariable = value.query_vars[index3] let iter_base = address2 + index3 * 16 - __wit_bindgen_lower_t375(iter_base + 0, iter_elem) + __wit_bindgen_lower_t378(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 32, value.query_vars.length()) mbt_ffi_store32(ptr + 28, address2) @@ -13010,17 +13055,17 @@ fn __wit_bindgen_lower_t382( } Some(payload4) => { mbt_ffi_store8(ptr + 36, 1) - __wit_bindgen_lower_t376(ptr + 37, payload4) + __wit_bindgen_lower_t379(ptr + 37, payload4) () } } - __wit_bindgen_lower_t369(ptr + 40, value.cors_options) + __wit_bindgen_lower_t372(ptr + 40, value.cors_options) } ///| #doc(hidden) -fn __wit_bindgen_lower_t386(ptr : Int, value : @common.AgentMethod) -> Unit { +fn __wit_bindgen_lower_t389(ptr : Int, value : @common.AgentMethod) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -13033,7 +13078,7 @@ fn __wit_bindgen_lower_t386(ptr : Int, value : @common.AgentMethod) -> Unit { for index = 0; index < value.http_endpoint.length(); index = index + 1 { let iter_elem : @common.HttpEndpointDetails = value.http_endpoint[index] let iter_base = address + index * 48 - __wit_bindgen_lower_t382(iter_base + 0, iter_elem) + __wit_bindgen_lower_t385(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 20, value.http_endpoint.length()) mbt_ffi_store32(ptr + 16, address) @@ -13054,8 +13099,8 @@ fn __wit_bindgen_lower_t386(ptr : Int, value : @common.AgentMethod) -> Unit { () } } - __wit_bindgen_lower_t364(ptr + 36, value.input_schema) - __wit_bindgen_lower_t365(ptr + 48, value.output_schema) + __wit_bindgen_lower_t367(ptr + 36, value.input_schema) + __wit_bindgen_lower_t368(ptr + 48, value.output_schema) match value.read_only { None => { @@ -13065,7 +13110,7 @@ fn __wit_bindgen_lower_t386(ptr : Int, value : @common.AgentMethod) -> Unit { } Some(payload5) => { mbt_ffi_store8(ptr + 56, 1) - __wit_bindgen_lower_t367(ptr + 64, payload5) + __wit_bindgen_lower_t370(ptr + 64, payload5) () } @@ -13074,7 +13119,7 @@ fn __wit_bindgen_lower_t386(ptr : Int, value : @common.AgentMethod) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t392( +fn __wit_bindgen_lower_t395( ptr : Int, value : @common.AgentConstructor, ) -> Unit { @@ -13115,12 +13160,12 @@ fn __wit_bindgen_lower_t392( () } } - __wit_bindgen_lower_t364(ptr + 32, value.input_schema) + __wit_bindgen_lower_t367(ptr + 32, value.input_schema) } ///| #doc(hidden) -fn __wit_bindgen_lower_t394(ptr : Int, value : @common.AgentDependency) -> Unit { +fn __wit_bindgen_lower_t397(ptr : Int, value : @common.AgentDependency) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.type_name) mbt_ffi_store32(ptr + 4, value.type_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -13141,14 +13186,14 @@ fn __wit_bindgen_lower_t394(ptr : Int, value : @common.AgentDependency) -> Unit () } } - __wit_bindgen_lower_t56(ptr + 20, value.schema) - __wit_bindgen_lower_t392(ptr + 40, value.constructor_) + __wit_bindgen_lower_t57(ptr + 20, value.schema) + __wit_bindgen_lower_t395(ptr + 40, value.constructor_) let address = mbt_ffi_malloc(value.methods.length() * 88) for index = 0; index < value.methods.length(); index = index + 1 { let iter_elem : @common.AgentMethod = value.methods[index] let iter_base = address + index * 88 - __wit_bindgen_lower_t386(iter_base + 0, iter_elem) + __wit_bindgen_lower_t389(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 88, value.methods.length()) mbt_ffi_store32(ptr + 84, address) @@ -13156,7 +13201,7 @@ fn __wit_bindgen_lower_t394(ptr : Int, value : @common.AgentDependency) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t395( +fn __wit_bindgen_lower_t398( ptr : Int, value : @common.SnapshottingConfig, ) -> Unit { @@ -13183,7 +13228,7 @@ fn __wit_bindgen_lower_t395( ///| #doc(hidden) -fn __wit_bindgen_lower_t396(ptr : Int, value : @common.Snapshotting) -> Unit { +fn __wit_bindgen_lower_t399(ptr : Int, value : @common.Snapshotting) -> Unit { match value { Disabled => { mbt_ffi_store8(ptr + 0, 0) @@ -13192,7 +13237,7 @@ fn __wit_bindgen_lower_t396(ptr : Int, value : @common.Snapshotting) -> Unit { } Enabled(payload0) => { mbt_ffi_store8(ptr + 0, 1) - __wit_bindgen_lower_t395(ptr + 8, payload0) + __wit_bindgen_lower_t398(ptr + 8, payload0) () } @@ -13201,7 +13246,7 @@ fn __wit_bindgen_lower_t396(ptr : Int, value : @common.Snapshotting) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t398( +fn __wit_bindgen_lower_t401( ptr : Int, value : @common.AgentConfigDeclaration, ) -> Unit { @@ -13223,7 +13268,7 @@ fn __wit_bindgen_lower_t398( ///| #doc(hidden) -fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentType) -> Unit { +fn __wit_bindgen_lower_t405(ptr : Int, value : @common.AgentType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.type_name) mbt_ffi_store32(ptr + 4, value.type_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -13235,14 +13280,14 @@ fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentType) -> Unit { let ptr2 = mbt_ffi_str2ptr(value.source_language) mbt_ffi_store32(ptr + 20, value.source_language.length()) mbt_ffi_store32(ptr + 16, ptr2) - __wit_bindgen_lower_t56(ptr + 24, value.schema) - __wit_bindgen_lower_t392(ptr + 44, value.constructor_) + __wit_bindgen_lower_t57(ptr + 24, value.schema) + __wit_bindgen_lower_t395(ptr + 44, value.constructor_) let address = mbt_ffi_malloc(value.methods.length() * 88) for index = 0; index < value.methods.length(); index = index + 1 { let iter_elem : @common.AgentMethod = value.methods[index] let iter_base = address + index * 88 - __wit_bindgen_lower_t386(iter_base + 0, iter_elem) + __wit_bindgen_lower_t389(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 92, value.methods.length()) mbt_ffi_store32(ptr + 88, address) @@ -13251,7 +13296,7 @@ fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentType) -> Unit { for index4 = 0; index4 < value.dependencies.length(); index4 = index4 + 1 { let iter_elem : @common.AgentDependency = value.dependencies[index4] let iter_base = address3 + index4 * 92 - __wit_bindgen_lower_t394(iter_base + 0, iter_elem) + __wit_bindgen_lower_t397(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 100, value.dependencies.length()) mbt_ffi_store32(ptr + 96, address3) @@ -13265,18 +13310,18 @@ fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentType) -> Unit { } Some(payload5) => { mbt_ffi_store8(ptr + 108, 1) - __wit_bindgen_lower_t379(ptr + 112, payload5) + __wit_bindgen_lower_t382(ptr + 112, payload5) () } } - __wit_bindgen_lower_t396(ptr + 144, value.snapshotting) + __wit_bindgen_lower_t399(ptr + 144, value.snapshotting) let address6 = mbt_ffi_malloc(value.config.length() * 16) for index7 = 0; index7 < value.config.length(); index7 = index7 + 1 { let iter_elem : @common.AgentConfigDeclaration = value.config[index7] let iter_base = address6 + index7 * 16 - __wit_bindgen_lower_t398(iter_base + 0, iter_elem) + __wit_bindgen_lower_t401(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 172, value.config.length()) mbt_ffi_store32(ptr + 168, address6) @@ -13284,7 +13329,7 @@ fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentType) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t405(ptr : Int, value : @common.AgentError) -> Unit { +fn __wit_bindgen_lower_t408(ptr : Int, value : @common.AgentError) -> Unit { match value { InvalidInput(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -13324,45 +13369,74 @@ fn __wit_bindgen_lower_t405(ptr : Int, value : @common.AgentError) -> Unit { } CustomError(payload7) => { mbt_ffi_store8(ptr + 0, 4) - __wit_bindgen_lower_t74(ptr + 4, payload7) + __wit_bindgen_lower_t76(ptr + 4, payload7) () } } } +///| +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) + ///| extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) +///| +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) + +///| +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + ///| extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #|(func (param i32) (param i32) (result i32) @@ -13370,10 +13444,6 @@ extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #| local.get 1 call $moonbit.init_array8 #| local.get 0) -///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) - ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) @@ -13382,24 +13452,16 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) - -///| -extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = - #|(func (param i32) (result f32) local.get 0 f32.load) - -///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = @@ -13410,22 +13472,5 @@ extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) - -///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) - -///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) - -///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) - -///| -extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend8_s) +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/top.mbt b/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/top.mbt index 4c7a922e0c..76ea0f3d66 100644 --- a/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/top.mbt +++ b/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/top.mbt @@ -18,8 +18,9 @@ declare pub async fn initialize( /// Invokes an agent. If create was not called before, it fails. /// /// `input` is a value tree whose root encodes the method's parameter list. -/// The result is `none` when the method's `output-schema` is `unit`, and -/// `some(value)` for a `single` output. +/// Streams are represented recursively by `stream-value` nodes. The result +/// is `none` when the method's `output-schema` is `unit`, and `some(value)` +/// for a `single` output. declare pub async fn invoke( method_name : String, input : @types.SchemaValueTree, diff --git a/sdks/moonbit/golem_sdk/gen/interface/golem/api/load-snapshot/ffi.mbt b/sdks/moonbit/golem_sdk/gen/interface/golem/api/load-snapshot/ffi.mbt index 94092ad353..566f6a2dde 100644 --- a/sdks/moonbit/golem_sdk/gen/interface/golem/api/load-snapshot/ffi.mbt +++ b/sdks/moonbit/golem_sdk/gen/interface/golem/api/load-snapshot/ffi.mbt @@ -56,13 +56,6 @@ pub fn wasmExportAsyncLoad(event_raw : Int, waitable : Int, code : Int) -> Int { @async-core.cb(event_raw, waitable, code) } -///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) - ///| #owned(str) extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = @@ -72,6 +65,13 @@ extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) +///| +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) + ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) diff --git a/sdks/moonbit/golem_sdk/gen/interface/golem/tool/guest/ffi.mbt b/sdks/moonbit/golem_sdk/gen/interface/golem/tool/guest/ffi.mbt index 133252758c..9eb4a5fbfc 100644 --- a/sdks/moonbit/golem_sdk/gen/interface/golem/tool/guest/ffi.mbt +++ b/sdks/moonbit/golem_sdk/gen/interface/golem/tool/guest/ffi.mbt @@ -14,7 +14,7 @@ pub fn wasmExportDiscoverTools() -> Int { for index = 0; index < payload.length(); index = index + 1 { let iter_elem : @common.Tool = payload[index] let iter_base = address + index * 36 - __wit_bindgen_lower_t510(iter_base + 0, iter_elem) + __wit_bindgen_lower_t513(iter_base + 0, iter_elem) } mbt_ffi_store32(return_area + 8, payload.length()) mbt_ffi_store32(return_area + 4, address) @@ -23,7 +23,7 @@ pub fn wasmExportDiscoverTools() -> Int { } Err(payload0) => { mbt_ffi_store8(return_area + 0, 1) - __wit_bindgen_lower_t511(return_area + 4, payload0) + __wit_bindgen_lower_t514(return_area + 4, payload0) () } @@ -155,6 +155,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -290,6 +291,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -422,6 +424,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -547,6 +550,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -627,6 +631,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -707,6 +712,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -808,6 +814,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -890,6 +897,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -969,6 +977,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -1049,6 +1058,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -1128,6 +1138,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2351,6 +2362,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2373,13 +2385,13 @@ pub fn wasmExportGetTool(p0 : Int, p1 : Int) -> Int { match result0 { Ok(payload) => { mbt_ffi_store8(return_area + 0, 0) - __wit_bindgen_lower_t510(return_area + 4, payload) + __wit_bindgen_lower_t513(return_area + 4, payload) () } Err(payload1) => { mbt_ffi_store8(return_area + 0, 1) - __wit_bindgen_lower_t511(return_area + 4, payload1) + __wit_bindgen_lower_t514(return_area + 4, payload1) () } @@ -2505,6 +2517,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2639,6 +2652,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2770,6 +2784,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2894,6 +2909,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2973,6 +2989,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3052,6 +3069,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3137,6 +3155,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3218,6 +3237,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3297,6 +3317,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3376,6 +3397,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3455,6 +3477,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -4666,6 +4689,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -7204,6 +7228,12 @@ pub fn wasmExportInvokeGolemToolGuest(p0 : Int) -> Int { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -7457,7 +7487,7 @@ fn invoke_task_return( index256 = index256 + 1 { let iter_elem : @types.SchemaTypeNode = payload255.graph.type_nodes[index256] let iter_base = address + index256 * 144 - __wit_bindgen_lower_t53(iter_base + 0, iter_elem) + __wit_bindgen_lower_t54(iter_base + 0, iter_elem) } let address257 = mbt_ffi_malloc( @@ -7468,7 +7498,7 @@ fn invoke_task_return( index258 = index258 + 1 { let iter_elem : @types.SchemaTypeDef = payload255.graph.defs[index258] let iter_base = address257 + index258 * 24 - __wit_bindgen_lower_t16(iter_base + 0, iter_elem) + __wit_bindgen_lower_t17(iter_base + 0, iter_elem) } let address259 = mbt_ffi_malloc( @@ -7479,7 +7509,7 @@ fn invoke_task_return( index260 = index260 + 1 { let iter_elem : @types.SchemaValueNode = payload255.value.value_nodes[index260] let iter_base = address259 + index260 * 32 - __wit_bindgen_lower_t71(iter_base + 0, iter_elem) + __wit_bindgen_lower_t73(iter_base + 0, iter_elem) } cleanup_list.push(address) cleanup_list.push(address257) @@ -7577,7 +7607,7 @@ fn invoke_task_return( index287 = index287 + 1 { let iter_elem : @types.SchemaTypeNode = payload285.graph.type_nodes[index287] let iter_base = address286 + index287 * 144 - __wit_bindgen_lower_t53(iter_base + 0, iter_elem) + __wit_bindgen_lower_t54(iter_base + 0, iter_elem) } let address288 = mbt_ffi_malloc( @@ -7588,7 +7618,7 @@ fn invoke_task_return( index289 = index289 + 1 { let iter_elem : @types.SchemaTypeDef = payload285.graph.defs[index289] let iter_base = address288 + index289 * 24 - __wit_bindgen_lower_t16(iter_base + 0, iter_elem) + __wit_bindgen_lower_t17(iter_base + 0, iter_elem) } let address290 = mbt_ffi_malloc( @@ -7599,7 +7629,7 @@ fn invoke_task_return( index291 = index291 + 1 { let iter_elem : @types.SchemaValueNode = payload285.value.value_nodes[index291] let iter_base = address290 + index291 * 32 - __wit_bindgen_lower_t71(iter_base + 0, iter_elem) + __wit_bindgen_lower_t73(iter_base + 0, iter_elem) } cleanup_list.push(address286) cleanup_list.push(address288) @@ -7658,7 +7688,7 @@ fn __wit_bindgen_lower_t5(ptr : Int, value : @types.Datetime) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t16(ptr : Int, value : @types.SchemaTypeDef) -> Unit { +fn __wit_bindgen_lower_t17(ptr : Int, value : @types.SchemaTypeDef) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.id) mbt_ffi_store32(ptr + 4, value.id.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -7684,7 +7714,7 @@ fn __wit_bindgen_lower_t16(ptr : Int, value : @types.SchemaTypeDef) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t17(ptr : Int, value : @types.Role) -> Unit { +fn __wit_bindgen_lower_t18(ptr : Int, value : @types.Role) -> Unit { match value { Multimodal => { mbt_ffi_store8(ptr + 0, 0) @@ -7715,7 +7745,7 @@ fn __wit_bindgen_lower_t17(ptr : Int, value : @types.Role) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { +fn __wit_bindgen_lower_t21(ptr : Int, value : @types.MetadataEnvelope) -> Unit { match value.doc { None => { mbt_ffi_store8(ptr + 0, 0) @@ -7782,7 +7812,7 @@ fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { } Some(payload10) => { mbt_ffi_store8(ptr + 40, 1) - __wit_bindgen_lower_t17(ptr + 44, payload10) + __wit_bindgen_lower_t18(ptr + 44, payload10) () } @@ -7791,17 +7821,17 @@ fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t21(ptr : Int, value : @types.NamedFieldType) -> Unit { +fn __wit_bindgen_lower_t22(ptr : Int, value : @types.NamedFieldType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) mbt_ffi_store32(ptr + 8, value.body) - __wit_bindgen_lower_t20(ptr + 12, value.metadata) + __wit_bindgen_lower_t21(ptr + 12, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t23(ptr : Int, value : @types.VariantCaseType) -> Unit { +fn __wit_bindgen_lower_t24(ptr : Int, value : @types.VariantCaseType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -7819,26 +7849,26 @@ fn __wit_bindgen_lower_t23(ptr : Int, value : @types.VariantCaseType) -> Unit { () } } - __wit_bindgen_lower_t20(ptr + 16, value.metadata) + __wit_bindgen_lower_t21(ptr + 16, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t24(ptr : Int, value : @types.FixedListSpec) -> Unit { +fn __wit_bindgen_lower_t25(ptr : Int, value : @types.FixedListSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.element) mbt_ffi_store32(ptr + 4, value.length.reinterpret_as_int()) } ///| #doc(hidden) -fn __wit_bindgen_lower_t25(ptr : Int, value : @types.MapSpec) -> Unit { +fn __wit_bindgen_lower_t26(ptr : Int, value : @types.MapSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.key) mbt_ffi_store32(ptr + 4, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t26(ptr : Int, value : @types.ResultSpec) -> Unit { +fn __wit_bindgen_lower_t27(ptr : Int, value : @types.ResultSpec) -> Unit { match value.ok { None => { mbt_ffi_store8(ptr + 0, 0) @@ -7870,7 +7900,7 @@ fn __wit_bindgen_lower_t26(ptr : Int, value : @types.ResultSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t27(ptr : Int, value : @types.NumericBound) -> Unit { +fn __wit_bindgen_lower_t28(ptr : Int, value : @types.NumericBound) -> Unit { match value { Signed(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -7895,7 +7925,7 @@ fn __wit_bindgen_lower_t27(ptr : Int, value : @types.NumericBound) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t29( +fn __wit_bindgen_lower_t30( ptr : Int, value : @types.NumericRestrictions, ) -> Unit { @@ -7907,7 +7937,7 @@ fn __wit_bindgen_lower_t29( } Some(payload0) => { mbt_ffi_store8(ptr + 0, 1) - __wit_bindgen_lower_t27(ptr + 8, payload0) + __wit_bindgen_lower_t28(ptr + 8, payload0) () } @@ -7921,7 +7951,7 @@ fn __wit_bindgen_lower_t29( } Some(payload2) => { mbt_ffi_store8(ptr + 24, 1) - __wit_bindgen_lower_t27(ptr + 32, payload2) + __wit_bindgen_lower_t28(ptr + 32, payload2) () } @@ -7947,7 +7977,7 @@ fn __wit_bindgen_lower_t29( ///| #doc(hidden) -fn __wit_bindgen_lower_t32(ptr : Int, value : @types.TextRestrictions) -> Unit { +fn __wit_bindgen_lower_t33(ptr : Int, value : @types.TextRestrictions) -> Unit { match value.languages { None => { mbt_ffi_store8(ptr + 0, 0) @@ -8021,7 +8051,7 @@ fn __wit_bindgen_lower_t32(ptr : Int, value : @types.TextRestrictions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t33( +fn __wit_bindgen_lower_t34( ptr : Int, value : @types.BinaryRestrictions, ) -> Unit { @@ -8081,7 +8111,7 @@ fn __wit_bindgen_lower_t33( ///| #doc(hidden) -fn __wit_bindgen_lower_t36(ptr : Int, value : @types.PathSpec) -> Unit { +fn __wit_bindgen_lower_t37(ptr : Int, value : @types.PathSpec) -> Unit { mbt_ffi_store8(ptr + 0, value.direction.ordinal()) mbt_ffi_store8(ptr + 1, value.kind.ordinal()) @@ -8138,7 +8168,7 @@ fn __wit_bindgen_lower_t36(ptr : Int, value : @types.PathSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t37(ptr : Int, value : @types.UrlRestrictions) -> Unit { +fn __wit_bindgen_lower_t38(ptr : Int, value : @types.UrlRestrictions) -> Unit { match value.allowed_schemes { None => { mbt_ffi_store8(ptr + 0, 0) @@ -8192,7 +8222,7 @@ fn __wit_bindgen_lower_t37(ptr : Int, value : @types.UrlRestrictions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t38(ptr : Int, value : @types.QuantityValue) -> Unit { +fn __wit_bindgen_lower_t39(ptr : Int, value : @types.QuantityValue) -> Unit { mbt_ffi_store64(ptr + 0, value.mantissa) mbt_ffi_store32(ptr + 8, value.scale) @@ -8203,7 +8233,7 @@ fn __wit_bindgen_lower_t38(ptr : Int, value : @types.QuantityValue) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { +fn __wit_bindgen_lower_t41(ptr : Int, value : @types.QuantitySpec) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.base_unit) mbt_ffi_store32(ptr + 4, value.base_unit.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -8228,7 +8258,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { } Some(payload2) => { mbt_ffi_store8(ptr + 16, 1) - __wit_bindgen_lower_t38(ptr + 24, payload2) + __wit_bindgen_lower_t39(ptr + 24, payload2) () } @@ -8242,7 +8272,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 48, 1) - __wit_bindgen_lower_t38(ptr + 56, payload4) + __wit_bindgen_lower_t39(ptr + 56, payload4) () } @@ -8251,7 +8281,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t41( +fn __wit_bindgen_lower_t42( ptr : Int, value : @types.FieldDiscriminator, ) -> Unit { @@ -8279,7 +8309,7 @@ fn __wit_bindgen_lower_t41( ///| #doc(hidden) -fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit { +fn __wit_bindgen_lower_t43(ptr : Int, value : @types.DiscriminatorRule) -> Unit { match value { Prefix(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -8319,7 +8349,7 @@ fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit } FieldEquals(payload7) => { mbt_ffi_store8(ptr + 0, 4) - __wit_bindgen_lower_t41(ptr + 4, payload7) + __wit_bindgen_lower_t42(ptr + 4, payload7) () } @@ -8337,23 +8367,23 @@ fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t43(ptr : Int, value : @types.UnionBranch) -> Unit { +fn __wit_bindgen_lower_t44(ptr : Int, value : @types.UnionBranch) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.tag) mbt_ffi_store32(ptr + 4, value.tag.length()) mbt_ffi_store32(ptr + 0, ptr0) mbt_ffi_store32(ptr + 8, value.body) - __wit_bindgen_lower_t42(ptr + 12, value.discriminator) - __wit_bindgen_lower_t20(ptr + 36, value.metadata) + __wit_bindgen_lower_t43(ptr + 12, value.discriminator) + __wit_bindgen_lower_t21(ptr + 36, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t45(ptr : Int, value : @types.UnionSpec) -> Unit { +fn __wit_bindgen_lower_t46(ptr : Int, value : @types.UnionSpec) -> Unit { let address = mbt_ffi_malloc(value.branches.length() * 92) for index = 0; index < value.branches.length(); index = index + 1 { let iter_elem : @types.UnionBranch = value.branches[index] let iter_base = address + index * 92 - __wit_bindgen_lower_t43(iter_base + 0, iter_elem) + __wit_bindgen_lower_t44(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.branches.length()) mbt_ffi_store32(ptr + 0, address) @@ -8361,7 +8391,7 @@ fn __wit_bindgen_lower_t45(ptr : Int, value : @types.UnionSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t46(ptr : Int, value : @types.SecretSpec) -> Unit { +fn __wit_bindgen_lower_t47(ptr : Int, value : @types.SecretSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.inner) match value.category { @@ -8384,7 +8414,7 @@ fn __wit_bindgen_lower_t46(ptr : Int, value : @types.SecretSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t47(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { +fn __wit_bindgen_lower_t48(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { match value.resource_name { None => { mbt_ffi_store8(ptr + 0, 0) @@ -8405,7 +8435,7 @@ fn __wit_bindgen_lower_t47(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { +fn __wit_bindgen_lower_t53(ptr : Int, value : @types.SchemaTypeBody) -> Unit { match value { RefType(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -8429,7 +8459,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload3) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload3) + __wit_bindgen_lower_t30(ptr + 16, payload3) () } @@ -8448,7 +8478,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload6) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload6) + __wit_bindgen_lower_t30(ptr + 16, payload6) () } @@ -8467,7 +8497,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload9) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload9) + __wit_bindgen_lower_t30(ptr + 16, payload9) () } @@ -8486,7 +8516,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload12) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload12) + __wit_bindgen_lower_t30(ptr + 16, payload12) () } @@ -8505,7 +8535,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload15) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload15) + __wit_bindgen_lower_t30(ptr + 16, payload15) () } @@ -8524,7 +8554,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload18) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload18) + __wit_bindgen_lower_t30(ptr + 16, payload18) () } @@ -8543,7 +8573,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload21) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload21) + __wit_bindgen_lower_t30(ptr + 16, payload21) () } @@ -8562,7 +8592,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload24) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload24) + __wit_bindgen_lower_t30(ptr + 16, payload24) () } @@ -8581,7 +8611,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload27) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload27) + __wit_bindgen_lower_t30(ptr + 16, payload27) () } @@ -8600,7 +8630,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload30) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload30) + __wit_bindgen_lower_t30(ptr + 16, payload30) () } @@ -8625,7 +8655,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { for index = 0; index < payload33.length(); index = index + 1 { let iter_elem : @types.NamedFieldType = payload33[index] let iter_base = address + index * 68 - __wit_bindgen_lower_t21(iter_base + 0, iter_elem) + __wit_bindgen_lower_t22(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload33.length()) mbt_ffi_store32(ptr + 8, address) @@ -8639,7 +8669,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { for index36 = 0; index36 < payload34.length(); index36 = index36 + 1 { let iter_elem : @types.VariantCaseType = payload34[index36] let iter_base = address35 + index36 * 72 - __wit_bindgen_lower_t23(iter_base + 0, iter_elem) + __wit_bindgen_lower_t24(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload34.length()) mbt_ffi_store32(ptr + 8, address35) @@ -8702,13 +8732,13 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } FixedListType(payload49) => { mbt_ffi_store8(ptr + 0, 20) - __wit_bindgen_lower_t24(ptr + 8, payload49) + __wit_bindgen_lower_t25(ptr + 8, payload49) () } MapType(payload50) => { mbt_ffi_store8(ptr + 0, 21) - __wit_bindgen_lower_t25(ptr + 8, payload50) + __wit_bindgen_lower_t26(ptr + 8, payload50) () } @@ -8720,31 +8750,31 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } ResultType(payload52) => { mbt_ffi_store8(ptr + 0, 23) - __wit_bindgen_lower_t26(ptr + 8, payload52) + __wit_bindgen_lower_t27(ptr + 8, payload52) () } TextType(payload53) => { mbt_ffi_store8(ptr + 0, 24) - __wit_bindgen_lower_t32(ptr + 8, payload53) + __wit_bindgen_lower_t33(ptr + 8, payload53) () } BinaryType(payload54) => { mbt_ffi_store8(ptr + 0, 25) - __wit_bindgen_lower_t33(ptr + 8, payload54) + __wit_bindgen_lower_t34(ptr + 8, payload54) () } PathType(payload55) => { mbt_ffi_store8(ptr + 0, 26) - __wit_bindgen_lower_t36(ptr + 8, payload55) + __wit_bindgen_lower_t37(ptr + 8, payload55) () } UrlType(payload56) => { mbt_ffi_store8(ptr + 0, 27) - __wit_bindgen_lower_t37(ptr + 8, payload56) + __wit_bindgen_lower_t38(ptr + 8, payload56) () } @@ -8760,25 +8790,25 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } QuantityType(payload59) => { mbt_ffi_store8(ptr + 0, 30) - __wit_bindgen_lower_t40(ptr + 8, payload59) + __wit_bindgen_lower_t41(ptr + 8, payload59) () } UnionType(payload60) => { mbt_ffi_store8(ptr + 0, 31) - __wit_bindgen_lower_t45(ptr + 8, payload60) + __wit_bindgen_lower_t46(ptr + 8, payload60) () } SecretType(payload61) => { mbt_ffi_store8(ptr + 0, 32) - __wit_bindgen_lower_t46(ptr + 8, payload61) + __wit_bindgen_lower_t47(ptr + 8, payload61) () } QuotaTokenType(payload62) => { mbt_ffi_store8(ptr + 0, 33) - __wit_bindgen_lower_t47(ptr + 8, payload62) + __wit_bindgen_lower_t48(ptr + 8, payload62) () } @@ -8825,19 +8855,19 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t53(ptr : Int, value : @types.SchemaTypeNode) -> Unit { - __wit_bindgen_lower_t52(ptr + 0, value.body) - __wit_bindgen_lower_t20(ptr + 88, value.metadata) +fn __wit_bindgen_lower_t54(ptr : Int, value : @types.SchemaTypeNode) -> Unit { + __wit_bindgen_lower_t53(ptr + 0, value.body) + __wit_bindgen_lower_t21(ptr + 88, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { +fn __wit_bindgen_lower_t57(ptr : Int, value : @types.SchemaGraph) -> Unit { let address = mbt_ffi_malloc(value.type_nodes.length() * 144) for index = 0; index < value.type_nodes.length(); index = index + 1 { let iter_elem : @types.SchemaTypeNode = value.type_nodes[index] let iter_base = address + index * 144 - __wit_bindgen_lower_t53(iter_base + 0, iter_elem) + __wit_bindgen_lower_t54(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.type_nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -8846,7 +8876,7 @@ fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { for index1 = 0; index1 < value.defs.length(); index1 = index1 + 1 { let iter_elem : @types.SchemaTypeDef = value.defs[index1] let iter_base = address0 + index1 * 24 - __wit_bindgen_lower_t16(iter_base + 0, iter_elem) + __wit_bindgen_lower_t17(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, value.defs.length()) mbt_ffi_store32(ptr + 8, address0) @@ -8855,7 +8885,7 @@ fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t58( +fn __wit_bindgen_lower_t59( ptr : Int, value : @types.VariantValuePayload, ) -> Unit { @@ -8878,14 +8908,14 @@ fn __wit_bindgen_lower_t58( ///| #doc(hidden) -fn __wit_bindgen_lower_t59(ptr : Int, value : @types.MapEntry) -> Unit { +fn __wit_bindgen_lower_t60(ptr : Int, value : @types.MapEntry) -> Unit { mbt_ffi_store32(ptr + 0, value.key) mbt_ffi_store32(ptr + 4, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t60( +fn __wit_bindgen_lower_t61( ptr : Int, value : @types.ResultValuePayload, ) -> Unit { @@ -8933,7 +8963,7 @@ fn __wit_bindgen_lower_t60( ///| #doc(hidden) -fn __wit_bindgen_lower_t61(ptr : Int, value : @types.TextValuePayload) -> Unit { +fn __wit_bindgen_lower_t62(ptr : Int, value : @types.TextValuePayload) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.text) mbt_ffi_store32(ptr + 4, value.text.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -8958,7 +8988,7 @@ fn __wit_bindgen_lower_t61(ptr : Int, value : @types.TextValuePayload) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t63( +fn __wit_bindgen_lower_t64( ptr : Int, value : @types.BinaryValuePayload, ) -> Unit { @@ -8987,7 +9017,7 @@ fn __wit_bindgen_lower_t63( ///| #doc(hidden) -fn __wit_bindgen_lower_t64( +fn __wit_bindgen_lower_t65( ptr : Int, value : @types.DurationValuePayload, ) -> Unit { @@ -8996,7 +9026,7 @@ fn __wit_bindgen_lower_t64( ///| #doc(hidden) -fn __wit_bindgen_lower_t65(ptr : Int, value : @types.UnionValuePayload) -> Unit { +fn __wit_bindgen_lower_t66(ptr : Int, value : @types.UnionValuePayload) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.tag) mbt_ffi_store32(ptr + 4, value.tag.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9005,7 +9035,7 @@ fn __wit_bindgen_lower_t65(ptr : Int, value : @types.UnionValuePayload) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { +fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueNode) -> Unit { match value { BoolValue(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -9104,7 +9134,7 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } VariantValue(payload14) => { mbt_ffi_store8(ptr + 0, 14) - __wit_bindgen_lower_t58(ptr + 8, payload14) + __wit_bindgen_lower_t59(ptr + 8, payload14) () } @@ -9177,7 +9207,7 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { for index30 = 0; index30 < payload28.length(); index30 = index30 + 1 { let iter_elem : @types.MapEntry = payload28[index30] let iter_base = address29 + index30 * 8 - __wit_bindgen_lower_t59(iter_base + 0, iter_elem) + __wit_bindgen_lower_t60(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload28.length()) mbt_ffi_store32(ptr + 8, address29) @@ -9205,19 +9235,19 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } ResultValue(payload34) => { mbt_ffi_store8(ptr + 0, 22) - __wit_bindgen_lower_t60(ptr + 8, payload34) + __wit_bindgen_lower_t61(ptr + 8, payload34) () } TextValue(payload35) => { mbt_ffi_store8(ptr + 0, 23) - __wit_bindgen_lower_t61(ptr + 8, payload35) + __wit_bindgen_lower_t62(ptr + 8, payload35) () } BinaryValue(payload36) => { mbt_ffi_store8(ptr + 0, 24) - __wit_bindgen_lower_t63(ptr + 8, payload36) + __wit_bindgen_lower_t64(ptr + 8, payload36) () } @@ -9247,19 +9277,19 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } DurationValue(payload42) => { mbt_ffi_store8(ptr + 0, 28) - __wit_bindgen_lower_t64(ptr + 8, payload42) + __wit_bindgen_lower_t65(ptr + 8, payload42) () } QuantityValueNode(payload43) => { mbt_ffi_store8(ptr + 0, 29) - __wit_bindgen_lower_t38(ptr + 8, payload43) + __wit_bindgen_lower_t39(ptr + 8, payload43) () } UnionValue(payload44) => { mbt_ffi_store8(ptr + 0, 30) - __wit_bindgen_lower_t65(ptr + 8, payload44) + __wit_bindgen_lower_t66(ptr + 8, payload44) () } @@ -9277,6 +9307,14 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { let @types.QuotaToken(handle47) = payload46 mbt_ffi_store32(ptr + 8, handle47) + () + } + StreamValue(payload48) => { + mbt_ffi_store8(ptr + 0, 33) + + let @types.SchemaValueStream(handle49) = payload48 + mbt_ffi_store32(ptr + 8, handle49) + () } } @@ -9284,12 +9322,12 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueTree) -> Unit { +fn __wit_bindgen_lower_t75(ptr : Int, value : @types.SchemaValueTree) -> Unit { let address = mbt_ffi_malloc(value.value_nodes.length() * 32) for index = 0; index < value.value_nodes.length(); index = index + 1 { let iter_elem : @types.SchemaValueNode = value.value_nodes[index] let iter_base = address + index * 32 - __wit_bindgen_lower_t71(iter_base + 0, iter_elem) + __wit_bindgen_lower_t73(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.value_nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -9298,14 +9336,14 @@ fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueTree) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t74(ptr : Int, value : @types.TypedSchemaValue) -> Unit { - __wit_bindgen_lower_t56(ptr + 0, value.graph) - __wit_bindgen_lower_t73(ptr + 20, value.value) +fn __wit_bindgen_lower_t76(ptr : Int, value : @types.TypedSchemaValue) -> Unit { + __wit_bindgen_lower_t57(ptr + 0, value.graph) + __wit_bindgen_lower_t75(ptr + 20, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t457( +fn __wit_bindgen_lower_t460( ptr : Int, value : @common.CommandAnnotations, ) -> Unit { @@ -9317,7 +9355,7 @@ fn __wit_bindgen_lower_t457( ///| #doc(hidden) -fn __wit_bindgen_lower_t459(ptr : Int, value : @common.Repetition) -> Unit { +fn __wit_bindgen_lower_t462(ptr : Int, value : @common.Repetition) -> Unit { match value { Repeated => { mbt_ffi_store8(ptr + 0, 0) @@ -9341,28 +9379,28 @@ fn __wit_bindgen_lower_t459(ptr : Int, value : @common.Repetition) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t460( +fn __wit_bindgen_lower_t463( ptr : Int, value : @common.RepeatableListShape, ) -> Unit { - __wit_bindgen_lower_t459(ptr + 0, value.repetition) + __wit_bindgen_lower_t462(ptr + 0, value.repetition) mbt_ffi_store32(ptr + 8, value.item_type) } ///| #doc(hidden) -fn __wit_bindgen_lower_t461( +fn __wit_bindgen_lower_t464( ptr : Int, value : @common.RepeatableMapShape, ) -> Unit { - __wit_bindgen_lower_t459(ptr + 0, value.repetition) + __wit_bindgen_lower_t462(ptr + 0, value.repetition) mbt_ffi_store32(ptr + 8, value.map_type) mbt_ffi_store8(ptr + 12, value.duplicate_key_policy.ordinal()) } ///| #doc(hidden) -fn __wit_bindgen_lower_t462(ptr : Int, value : @common.OptionShape) -> Unit { +fn __wit_bindgen_lower_t465(ptr : Int, value : @common.OptionShape) -> Unit { match value { Scalar(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -9378,13 +9416,13 @@ fn __wit_bindgen_lower_t462(ptr : Int, value : @common.OptionShape) -> Unit { } RepeatableList(payload1) => { mbt_ffi_store8(ptr + 0, 2) - __wit_bindgen_lower_t460(ptr + 4, payload1) + __wit_bindgen_lower_t463(ptr + 4, payload1) () } RepeatableMap(payload2) => { mbt_ffi_store8(ptr + 0, 3) - __wit_bindgen_lower_t461(ptr + 4, payload2) + __wit_bindgen_lower_t464(ptr + 4, payload2) () } @@ -9393,18 +9431,18 @@ fn __wit_bindgen_lower_t462(ptr : Int, value : @common.OptionShape) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t463(ptr : Int, value : @common.BoolFlagShape) -> Unit { +fn __wit_bindgen_lower_t466(ptr : Int, value : @common.BoolFlagShape) -> Unit { mbt_ffi_store8(ptr + 0, if value.default { 1 } else { 0 }) mbt_ffi_store8(ptr + 1, if value.negatable { 1 } else { 0 }) } ///| #doc(hidden) -fn __wit_bindgen_lower_t465(ptr : Int, value : @common.FlagShape) -> Unit { +fn __wit_bindgen_lower_t468(ptr : Int, value : @common.FlagShape) -> Unit { match value { BoolFlag(payload) => { mbt_ffi_store8(ptr + 0, 0) - __wit_bindgen_lower_t463(ptr + 4, payload) + __wit_bindgen_lower_t466(ptr + 4, payload) () } @@ -9432,16 +9470,16 @@ fn __wit_bindgen_lower_t465(ptr : Int, value : @common.FlagShape) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t466(ptr : Int, value : @common.ValueIsRef) -> Unit { +fn __wit_bindgen_lower_t469(ptr : Int, value : @common.ValueIsRef) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t73(ptr + 8, value.value) + __wit_bindgen_lower_t75(ptr + 8, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t467(ptr : Int, value : @common.Ref) -> Unit { +fn __wit_bindgen_lower_t470(ptr : Int, value : @common.Ref) -> Unit { match value { Present(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -9454,7 +9492,7 @@ fn __wit_bindgen_lower_t467(ptr : Int, value : @common.Ref) -> Unit { } ValueIs(payload1) => { mbt_ffi_store8(ptr + 0, 1) - __wit_bindgen_lower_t466(ptr + 4, payload1) + __wit_bindgen_lower_t469(ptr + 4, payload1) () } @@ -9463,12 +9501,12 @@ fn __wit_bindgen_lower_t467(ptr : Int, value : @common.Ref) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t469(ptr : Int, value : @common.RefGroup) -> Unit { +fn __wit_bindgen_lower_t472(ptr : Int, value : @common.RefGroup) -> Unit { let address = mbt_ffi_malloc(value.refs.length() * 24) for index = 0; index < value.refs.length(); index = index + 1 { let iter_elem : @common.Ref = value.refs[index] let iter_base = address + index * 24 - __wit_bindgen_lower_t467(iter_base + 0, iter_elem) + __wit_bindgen_lower_t470(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.refs.length()) mbt_ffi_store32(ptr + 0, address) @@ -9476,14 +9514,14 @@ fn __wit_bindgen_lower_t469(ptr : Int, value : @common.RefGroup) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t471(ptr : Int, value : @common.ImpliesC) -> Unit { +fn __wit_bindgen_lower_t474(ptr : Int, value : @common.ImpliesC) -> Unit { mbt_ffi_store8(ptr + 0, value.lhs_quant.ordinal()) let address = mbt_ffi_malloc(value.lhs.length() * 24) for index = 0; index < value.lhs.length(); index = index + 1 { let iter_elem : @common.Ref = value.lhs[index] let iter_base = address + index * 24 - __wit_bindgen_lower_t467(iter_base + 0, iter_elem) + __wit_bindgen_lower_t470(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, value.lhs.length()) mbt_ffi_store32(ptr + 4, address) @@ -9493,7 +9531,7 @@ fn __wit_bindgen_lower_t471(ptr : Int, value : @common.ImpliesC) -> Unit { for index1 = 0; index1 < value.rhs.length(); index1 = index1 + 1 { let iter_elem : @common.Ref = value.rhs[index1] let iter_base = address0 + index1 * 24 - __wit_bindgen_lower_t467(iter_base + 0, iter_elem) + __wit_bindgen_lower_t470(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 20, value.rhs.length()) mbt_ffi_store32(ptr + 16, address0) @@ -9501,14 +9539,14 @@ fn __wit_bindgen_lower_t471(ptr : Int, value : @common.ImpliesC) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t472(ptr : Int, value : @common.ForbidsC) -> Unit { +fn __wit_bindgen_lower_t475(ptr : Int, value : @common.ForbidsC) -> Unit { mbt_ffi_store8(ptr + 0, value.lhs_quant.ordinal()) let address = mbt_ffi_malloc(value.lhs.length() * 24) for index = 0; index < value.lhs.length(); index = index + 1 { let iter_elem : @common.Ref = value.lhs[index] let iter_base = address + index * 24 - __wit_bindgen_lower_t467(iter_base + 0, iter_elem) + __wit_bindgen_lower_t470(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, value.lhs.length()) mbt_ffi_store32(ptr + 4, address) @@ -9517,7 +9555,7 @@ fn __wit_bindgen_lower_t472(ptr : Int, value : @common.ForbidsC) -> Unit { for index1 = 0; index1 < value.rhs.length(); index1 = index1 + 1 { let iter_elem : @common.Ref = value.rhs[index1] let iter_base = address0 + index1 * 24 - __wit_bindgen_lower_t467(iter_base + 0, iter_elem) + __wit_bindgen_lower_t470(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 16, value.rhs.length()) mbt_ffi_store32(ptr + 12, address0) @@ -9525,7 +9563,7 @@ fn __wit_bindgen_lower_t472(ptr : Int, value : @common.ForbidsC) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t474(ptr : Int, value : @common.Constraint) -> Unit { +fn __wit_bindgen_lower_t477(ptr : Int, value : @common.Constraint) -> Unit { match value { RequiresAll(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -9534,7 +9572,7 @@ fn __wit_bindgen_lower_t474(ptr : Int, value : @common.Constraint) -> Unit { for index = 0; index < payload.length(); index = index + 1 { let iter_elem : @common.Ref = payload[index] let iter_base = address + index * 24 - __wit_bindgen_lower_t467(iter_base + 0, iter_elem) + __wit_bindgen_lower_t470(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload.length()) mbt_ffi_store32(ptr + 4, address) @@ -9548,7 +9586,7 @@ fn __wit_bindgen_lower_t474(ptr : Int, value : @common.Constraint) -> Unit { for index2 = 0; index2 < payload0.length(); index2 = index2 + 1 { let iter_elem : @common.Ref = payload0[index2] let iter_base = address1 + index2 * 24 - __wit_bindgen_lower_t467(iter_base + 0, iter_elem) + __wit_bindgen_lower_t470(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload0.length()) mbt_ffi_store32(ptr + 4, address1) @@ -9562,7 +9600,7 @@ fn __wit_bindgen_lower_t474(ptr : Int, value : @common.Constraint) -> Unit { for index5 = 0; index5 < payload3.length(); index5 = index5 + 1 { let iter_elem : @common.Ref = payload3[index5] let iter_base = address4 + index5 * 24 - __wit_bindgen_lower_t467(iter_base + 0, iter_elem) + __wit_bindgen_lower_t470(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload3.length()) mbt_ffi_store32(ptr + 4, address4) @@ -9576,7 +9614,7 @@ fn __wit_bindgen_lower_t474(ptr : Int, value : @common.Constraint) -> Unit { for index8 = 0; index8 < payload6.length(); index8 = index8 + 1 { let iter_elem : @common.RefGroup = payload6[index8] let iter_base = address7 + index8 * 8 - __wit_bindgen_lower_t469(iter_base + 0, iter_elem) + __wit_bindgen_lower_t472(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload6.length()) mbt_ffi_store32(ptr + 4, address7) @@ -9585,13 +9623,13 @@ fn __wit_bindgen_lower_t474(ptr : Int, value : @common.Constraint) -> Unit { } Implies(payload9) => { mbt_ffi_store8(ptr + 0, 4) - __wit_bindgen_lower_t471(ptr + 4, payload9) + __wit_bindgen_lower_t474(ptr + 4, payload9) () } Forbids(payload10) => { mbt_ffi_store8(ptr + 0, 5) - __wit_bindgen_lower_t472(ptr + 4, payload10) + __wit_bindgen_lower_t475(ptr + 4, payload10) () } @@ -9600,7 +9638,7 @@ fn __wit_bindgen_lower_t474(ptr : Int, value : @common.Constraint) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t476(ptr : Int, value : @common.Example) -> Unit { +fn __wit_bindgen_lower_t479(ptr : Int, value : @common.Example) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.title) mbt_ffi_store32(ptr + 4, value.title.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9612,7 +9650,7 @@ fn __wit_bindgen_lower_t476(ptr : Int, value : @common.Example) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t478(ptr : Int, value : @common.Doc) -> Unit { +fn __wit_bindgen_lower_t481(ptr : Int, value : @common.Doc) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.summary) mbt_ffi_store32(ptr + 4, value.summary.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9625,7 +9663,7 @@ fn __wit_bindgen_lower_t478(ptr : Int, value : @common.Doc) -> Unit { for index = 0; index < value.examples.length(); index = index + 1 { let iter_elem : @common.Example = value.examples[index] let iter_base = address + index * 16 - __wit_bindgen_lower_t476(iter_base + 0, iter_elem) + __wit_bindgen_lower_t479(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 20, value.examples.length()) mbt_ffi_store32(ptr + 16, address) @@ -9633,11 +9671,11 @@ fn __wit_bindgen_lower_t478(ptr : Int, value : @common.Doc) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t481(ptr : Int, value : @common.Positional) -> Unit { +fn __wit_bindgen_lower_t484(ptr : Int, value : @common.Positional) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t478(ptr + 8, value.doc) + __wit_bindgen_lower_t481(ptr + 8, value.doc) match value.value_name { None => { @@ -9665,7 +9703,7 @@ fn __wit_bindgen_lower_t481(ptr : Int, value : @common.Positional) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 48, 1) - __wit_bindgen_lower_t73(ptr + 52, payload4) + __wit_bindgen_lower_t75(ptr + 52, payload4) () } @@ -9676,11 +9714,11 @@ fn __wit_bindgen_lower_t481(ptr : Int, value : @common.Positional) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t482(ptr : Int, value : @common.TailPositional) -> Unit { +fn __wit_bindgen_lower_t485(ptr : Int, value : @common.TailPositional) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t478(ptr + 8, value.doc) + __wit_bindgen_lower_t481(ptr + 8, value.doc) match value.value_name { None => { @@ -9737,12 +9775,12 @@ fn __wit_bindgen_lower_t482(ptr : Int, value : @common.TailPositional) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t485(ptr : Int, value : @common.Positionals) -> Unit { +fn __wit_bindgen_lower_t488(ptr : Int, value : @common.Positionals) -> Unit { let address = mbt_ffi_malloc(value.fixed.length() * 68) for index = 0; index < value.fixed.length(); index = index + 1 { let iter_elem : @common.Positional = value.fixed[index] let iter_base = address + index * 68 - __wit_bindgen_lower_t481(iter_base + 0, iter_elem) + __wit_bindgen_lower_t484(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.fixed.length()) mbt_ffi_store32(ptr + 0, address) @@ -9755,7 +9793,7 @@ fn __wit_bindgen_lower_t485(ptr : Int, value : @common.Positionals) -> Unit { } Some(payload0) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t482(ptr + 12, payload0) + __wit_bindgen_lower_t485(ptr + 12, payload0) () } @@ -9764,7 +9802,7 @@ fn __wit_bindgen_lower_t485(ptr : Int, value : @common.Positionals) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t488(ptr : Int, value : @common.OptionSpec) -> Unit { +fn __wit_bindgen_lower_t491(ptr : Int, value : @common.OptionSpec) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.long) mbt_ffi_store32(ptr + 4, value.long.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9794,7 +9832,7 @@ fn __wit_bindgen_lower_t488(ptr : Int, value : @common.OptionSpec) -> Unit { } mbt_ffi_store32(ptr + 20, value.aliases.length()) mbt_ffi_store32(ptr + 16, address) - __wit_bindgen_lower_t478(ptr + 24, value.doc) + __wit_bindgen_lower_t481(ptr + 24, value.doc) match value.value_name { None => { @@ -9812,7 +9850,7 @@ fn __wit_bindgen_lower_t488(ptr : Int, value : @common.OptionSpec) -> Unit { () } } - __wit_bindgen_lower_t462(ptr + 60, value.shape) + __wit_bindgen_lower_t465(ptr + 60, value.shape) match value.default { None => { @@ -9822,7 +9860,7 @@ fn __wit_bindgen_lower_t488(ptr : Int, value : @common.OptionSpec) -> Unit { } Some(payload7) => { mbt_ffi_store8(ptr + 80, 1) - __wit_bindgen_lower_t73(ptr + 84, payload7) + __wit_bindgen_lower_t75(ptr + 84, payload7) () } @@ -9849,7 +9887,7 @@ fn __wit_bindgen_lower_t488(ptr : Int, value : @common.OptionSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t489(ptr : Int, value : @common.FlagSpec) -> Unit { +fn __wit_bindgen_lower_t492(ptr : Int, value : @common.FlagSpec) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.long) mbt_ffi_store32(ptr + 4, value.long.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9879,8 +9917,8 @@ fn __wit_bindgen_lower_t489(ptr : Int, value : @common.FlagSpec) -> Unit { } mbt_ffi_store32(ptr + 20, value.aliases.length()) mbt_ffi_store32(ptr + 16, address) - __wit_bindgen_lower_t478(ptr + 24, value.doc) - __wit_bindgen_lower_t465(ptr + 48, value.shape) + __wit_bindgen_lower_t481(ptr + 24, value.doc) + __wit_bindgen_lower_t468(ptr + 48, value.shape) match value.env_var { None => { @@ -9902,12 +9940,12 @@ fn __wit_bindgen_lower_t489(ptr : Int, value : @common.FlagSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t492(ptr : Int, value : @common.Globals) -> Unit { +fn __wit_bindgen_lower_t495(ptr : Int, value : @common.Globals) -> Unit { let address = mbt_ffi_malloc(value.options.length() * 112) for index = 0; index < value.options.length(); index = index + 1 { let iter_elem : @common.OptionSpec = value.options[index] let iter_base = address + index * 112 - __wit_bindgen_lower_t488(iter_base + 0, iter_elem) + __wit_bindgen_lower_t491(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.options.length()) mbt_ffi_store32(ptr + 0, address) @@ -9916,7 +9954,7 @@ fn __wit_bindgen_lower_t492(ptr : Int, value : @common.Globals) -> Unit { for index1 = 0; index1 < value.flags.length(); index1 = index1 + 1 { let iter_elem : @common.FlagSpec = value.flags[index1] let iter_base = address0 + index1 * 72 - __wit_bindgen_lower_t489(iter_base + 0, iter_elem) + __wit_bindgen_lower_t492(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, value.flags.length()) mbt_ffi_store32(ptr + 8, address0) @@ -9924,8 +9962,8 @@ fn __wit_bindgen_lower_t492(ptr : Int, value : @common.Globals) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t493(ptr : Int, value : @common.StreamSpec) -> Unit { - __wit_bindgen_lower_t478(ptr + 0, value.doc) +fn __wit_bindgen_lower_t496(ptr : Int, value : @common.StreamSpec) -> Unit { + __wit_bindgen_lower_t481(ptr + 0, value.doc) let address = mbt_ffi_malloc(value.mime.length() * 8) for index = 0; index < value.mime.length(); index = index + 1 { @@ -9943,24 +9981,24 @@ fn __wit_bindgen_lower_t493(ptr : Int, value : @common.StreamSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t494(ptr : Int, value : @common.Formatter) -> Unit { +fn __wit_bindgen_lower_t497(ptr : Int, value : @common.Formatter) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t478(ptr + 8, value.doc) + __wit_bindgen_lower_t481(ptr + 8, value.doc) } ///| #doc(hidden) -fn __wit_bindgen_lower_t496(ptr : Int, value : @common.ResultSpec) -> Unit { +fn __wit_bindgen_lower_t499(ptr : Int, value : @common.ResultSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.type_) - __wit_bindgen_lower_t478(ptr + 4, value.doc) + __wit_bindgen_lower_t481(ptr + 4, value.doc) let address = mbt_ffi_malloc(value.formatters.length() * 32) for index = 0; index < value.formatters.length(); index = index + 1 { let iter_elem : @common.Formatter = value.formatters[index] let iter_base = address + index * 32 - __wit_bindgen_lower_t494(iter_base + 0, iter_elem) + __wit_bindgen_lower_t497(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 32, value.formatters.length()) mbt_ffi_store32(ptr + 28, address) @@ -9972,11 +10010,11 @@ fn __wit_bindgen_lower_t496(ptr : Int, value : @common.ResultSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t498(ptr : Int, value : @common.ErrorCase) -> Unit { +fn __wit_bindgen_lower_t501(ptr : Int, value : @common.ErrorCase) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t478(ptr + 8, value.doc) + __wit_bindgen_lower_t481(ptr + 8, value.doc) mbt_ffi_store8(ptr + 32, value.kind.ordinal()) mbt_ffi_store8(ptr + 33, value.exit_code.to_int()) @@ -9997,14 +10035,14 @@ fn __wit_bindgen_lower_t498(ptr : Int, value : @common.ErrorCase) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { - __wit_bindgen_lower_t485(ptr + 0, value.positionals) +fn __wit_bindgen_lower_t507(ptr : Int, value : @common.CommandBody) -> Unit { + __wit_bindgen_lower_t488(ptr + 0, value.positionals) let address = mbt_ffi_malloc(value.options.length() * 112) for index = 0; index < value.options.length(); index = index + 1 { let iter_elem : @common.OptionSpec = value.options[index] let iter_base = address + index * 112 - __wit_bindgen_lower_t488(iter_base + 0, iter_elem) + __wit_bindgen_lower_t491(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 92, value.options.length()) mbt_ffi_store32(ptr + 88, address) @@ -10013,7 +10051,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { for index1 = 0; index1 < value.flags.length(); index1 = index1 + 1 { let iter_elem : @common.FlagSpec = value.flags[index1] let iter_base = address0 + index1 * 72 - __wit_bindgen_lower_t489(iter_base + 0, iter_elem) + __wit_bindgen_lower_t492(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 100, value.flags.length()) mbt_ffi_store32(ptr + 96, address0) @@ -10022,7 +10060,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { for index3 = 0; index3 < value.constraints.length(); index3 = index3 + 1 { let iter_elem : @common.Constraint = value.constraints[index3] let iter_base = address2 + index3 * 28 - __wit_bindgen_lower_t474(iter_base + 0, iter_elem) + __wit_bindgen_lower_t477(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 108, value.constraints.length()) mbt_ffi_store32(ptr + 104, address2) @@ -10035,7 +10073,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 112, 1) - __wit_bindgen_lower_t493(ptr + 116, payload4) + __wit_bindgen_lower_t496(ptr + 116, payload4) () } @@ -10049,7 +10087,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { } Some(payload6) => { mbt_ffi_store8(ptr + 152, 1) - __wit_bindgen_lower_t493(ptr + 156, payload6) + __wit_bindgen_lower_t496(ptr + 156, payload6) () } @@ -10063,7 +10101,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { } Some(payload8) => { mbt_ffi_store8(ptr + 192, 1) - __wit_bindgen_lower_t496(ptr + 196, payload8) + __wit_bindgen_lower_t499(ptr + 196, payload8) () } @@ -10073,7 +10111,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { for index10 = 0; index10 < value.errors.length(); index10 = index10 + 1 { let iter_elem : @common.ErrorCase = value.errors[index10] let iter_base = address9 + index10 * 44 - __wit_bindgen_lower_t498(iter_base + 0, iter_elem) + __wit_bindgen_lower_t501(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 244, value.errors.length()) mbt_ffi_store32(ptr + 240, address9) @@ -10086,7 +10124,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { } Some(payload12) => { mbt_ffi_store8(ptr + 248, 1) - __wit_bindgen_lower_t457(ptr + 249, payload12) + __wit_bindgen_lower_t460(ptr + 249, payload12) () } @@ -10095,7 +10133,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t507(ptr : Int, value : @common.CommandNode) -> Unit { +fn __wit_bindgen_lower_t510(ptr : Int, value : @common.CommandNode) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -10111,8 +10149,8 @@ fn __wit_bindgen_lower_t507(ptr : Int, value : @common.CommandNode) -> Unit { } mbt_ffi_store32(ptr + 12, value.aliases.length()) mbt_ffi_store32(ptr + 8, address) - __wit_bindgen_lower_t478(ptr + 16, value.doc) - __wit_bindgen_lower_t492(ptr + 40, value.globals) + __wit_bindgen_lower_t481(ptr + 16, value.doc) + __wit_bindgen_lower_t495(ptr + 40, value.globals) let address2 = mbt_ffi_malloc(value.subcommands.length() * 4) for index3 = 0; index3 < value.subcommands.length(); index3 = index3 + 1 { @@ -10131,7 +10169,7 @@ fn __wit_bindgen_lower_t507(ptr : Int, value : @common.CommandNode) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 64, 1) - __wit_bindgen_lower_t504(ptr + 68, payload4) + __wit_bindgen_lower_t507(ptr + 68, payload4) () } @@ -10140,12 +10178,12 @@ fn __wit_bindgen_lower_t507(ptr : Int, value : @common.CommandNode) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t509(ptr : Int, value : @common.CommandTree) -> Unit { +fn __wit_bindgen_lower_t512(ptr : Int, value : @common.CommandTree) -> Unit { let address = mbt_ffi_malloc(value.nodes.length() * 324) for index = 0; index < value.nodes.length(); index = index + 1 { let iter_elem : @common.CommandNode = value.nodes[index] let iter_base = address + index * 324 - __wit_bindgen_lower_t507(iter_base + 0, iter_elem) + __wit_bindgen_lower_t510(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -10153,17 +10191,17 @@ fn __wit_bindgen_lower_t509(ptr : Int, value : @common.CommandTree) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t510(ptr : Int, value : @common.Tool) -> Unit { +fn __wit_bindgen_lower_t513(ptr : Int, value : @common.Tool) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.version) mbt_ffi_store32(ptr + 4, value.version.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t509(ptr + 8, value.commands) - __wit_bindgen_lower_t56(ptr + 16, value.schema) + __wit_bindgen_lower_t512(ptr + 8, value.commands) + __wit_bindgen_lower_t57(ptr + 16, value.schema) } ///| #doc(hidden) -fn __wit_bindgen_lower_t511(ptr : Int, value : @common.ToolError) -> Unit { +fn __wit_bindgen_lower_t514(ptr : Int, value : @common.ToolError) -> Unit { match value { InvalidToolName(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -10220,7 +10258,7 @@ fn __wit_bindgen_lower_t511(ptr : Int, value : @common.ToolError) -> Unit { } CustomError(payload9) => { mbt_ffi_store8(ptr + 0, 5) - __wit_bindgen_lower_t74(ptr + 4, payload9) + __wit_bindgen_lower_t76(ptr + 4, payload9) () } @@ -10233,50 +10271,41 @@ extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) - -///| -extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend8_s) - -///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| -extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = - #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = @@ -10287,12 +10316,8 @@ extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) - -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = @@ -10302,26 +10327,39 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.get 1) ///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) + +///| +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/agent/host/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/agent/host/ffi.mbt index 50b2bf7600..a0116b6372 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/agent/host/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/agent/host/ffi.mbt @@ -136,52 +136,50 @@ fn wasmImportGetConfigValue( ) = "golem:agent/host@2.0.0" "get-config-value" ///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = - #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = @@ -192,28 +190,25 @@ extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = #|(func (param i32) (result f64) local.get 0 f64.load) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) - -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) - -///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) - -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| -extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend8_s) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) ///| extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = @@ -223,13 +218,18 @@ extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) -///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) - ///| extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) + +///| +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/agent/host/top.mbt b/sdks/moonbit/golem_sdk/interface/golem/agent/host/top.mbt index 778b628d44..acb6e9be5c 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/agent/host/top.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/agent/host/top.mbt @@ -9724,10 +9724,10 @@ pub fn make_agent_id( let ptr = mbt_ffi_str2ptr(agent_type_name) - let address66 = mbt_ffi_malloc(input.value_nodes.length() * 32) - for index67 = 0; index67 < input.value_nodes.length(); index67 = index67 + 1 { - let iter_elem : @types.SchemaValueNode = input.value_nodes[index67] - let iter_base = address66 + index67 * 32 + let address68 = mbt_ffi_malloc(input.value_nodes.length() * 32) + for index69 = 0; index69 < input.value_nodes.length(); index69 = index69 + 1 { + let iter_elem : @types.SchemaValueNode = input.value_nodes[index69] + let iter_base = address68 + index69 * 32 match iter_elem { BoolValue(payload) => { @@ -10124,34 +10124,42 @@ pub fn make_agent_id( let @types.QuotaToken(handle65) = payload64 mbt_ffi_store32(iter_base + 8, handle65) + () + } + StreamValue(payload66) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle67) = payload66 + mbt_ffi_store32(iter_base + 8, handle67) + () } } } - let (lowered, lowered70, lowered71) = match phantom_id { + let (lowered, lowered72, lowered73) = match phantom_id { None => (0, 0L, 0L) - Some(payload69) => + Some(payload71) => ( 1, - payload69.high_bits.reinterpret_as_int64(), - payload69.low_bits.reinterpret_as_int64(), + payload71.high_bits.reinterpret_as_int64(), + payload71.low_bits.reinterpret_as_int64(), ) } let return_area = mbt_ffi_malloc(40) wasmImportMakeAgentId( ptr, agent_type_name.length(), - address66, + address68, input.value_nodes.length(), input.root, lowered, - lowered70, - lowered71, + lowered72, + lowered73, return_area, ) - let lifted309 = match mbt_ffi_load8_u(return_area + 0) { + let lifted311 = match mbt_ffi_load8_u(return_area + 0) { 0 => { let result = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 4), @@ -10161,55 +10169,55 @@ pub fn make_agent_id( Result::Ok(result) } 1 => { - let lifted308 = match mbt_ffi_load8_u(return_area + 4) { + let lifted310 = match mbt_ffi_load8_u(return_area + 4) { 0 => { - let result72 = mbt_ffi_ptr2str( + let result74 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - @common.AgentError::InvalidInput(result72) + @common.AgentError::InvalidInput(result74) } 1 => { - let result73 = mbt_ffi_ptr2str( + let result75 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - @common.AgentError::InvalidMethod(result73) + @common.AgentError::InvalidMethod(result75) } 2 => { - let result74 = mbt_ffi_ptr2str( + let result76 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - @common.AgentError::InvalidType(result74) + @common.AgentError::InvalidType(result76) } 3 => { - let result75 = mbt_ffi_ptr2str( + let result77 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - @common.AgentError::InvalidAgentId(result75) + @common.AgentError::InvalidAgentId(result77) } 4 => { - let array270 : Array[@types.SchemaTypeNode] = [] - for index271 = 0 - index271 < mbt_ffi_load32(return_area + 12) - index271 = index271 + 1 { - let iter_base = mbt_ffi_load32(return_area + 8) + index271 * 144 + let array272 : Array[@types.SchemaTypeNode] = [] + for index273 = 0 + index273 < mbt_ffi_load32(return_area + 12) + index273 = index273 + 1 { + let iter_base = mbt_ffi_load32(return_area + 8) + index273 * 144 - let lifted256 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted258 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType(mbt_ffi_load32(iter_base + 8)) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted81 : @types.NumericRestrictions? = match + let lifted83 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted76 : @types.NumericBound? = match + let lifted78 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { @@ -10234,11 +10242,11 @@ pub fn make_agent_id( _ => panic() } - let lifted78 : @types.NumericBound? = match + let lifted80 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted77 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted79 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10254,46 +10262,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted77) + Option::Some(lifted79) } _ => panic() } - let lifted80 : String? = match + let lifted82 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result79 = mbt_ffi_ptr2str( + let result81 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result79) + Option::Some(result81) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted76, - max: lifted78, - unit: lifted80, + min: lifted78, + max: lifted80, + unit: lifted82, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted81) + @types.SchemaTypeBody::S8Type(lifted83) } 3 => { - let lifted88 : @types.NumericRestrictions? = match + let lifted90 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted83 : @types.NumericBound? = match + let lifted85 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted82 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted84 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10309,16 +10317,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted82) + Option::Some(lifted84) } _ => panic() } - let lifted85 : @types.NumericBound? = match + let lifted87 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted84 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted86 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10334,46 +10342,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted84) + Option::Some(lifted86) } _ => panic() } - let lifted87 : String? = match + let lifted89 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result86 = mbt_ffi_ptr2str( + let result88 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result86) + Option::Some(result88) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted83, - max: lifted85, - unit: lifted87, + min: lifted85, + max: lifted87, + unit: lifted89, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted88) + @types.SchemaTypeBody::S16Type(lifted90) } 4 => { - let lifted95 : @types.NumericRestrictions? = match + let lifted97 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted90 : @types.NumericBound? = match + let lifted92 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted89 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted91 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10389,16 +10397,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted89) + Option::Some(lifted91) } _ => panic() } - let lifted92 : @types.NumericBound? = match + let lifted94 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted91 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted93 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10414,46 +10422,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted91) + Option::Some(lifted93) } _ => panic() } - let lifted94 : String? = match + let lifted96 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result93 = mbt_ffi_ptr2str( + let result95 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result93) + Option::Some(result95) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted90, - max: lifted92, - unit: lifted94, + min: lifted92, + max: lifted94, + unit: lifted96, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted95) + @types.SchemaTypeBody::S32Type(lifted97) } 5 => { - let lifted102 : @types.NumericRestrictions? = match + let lifted104 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted97 : @types.NumericBound? = match + let lifted99 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted96 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted98 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10469,16 +10477,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted96) + Option::Some(lifted98) } _ => panic() } - let lifted99 : @types.NumericBound? = match + let lifted101 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted98 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted100 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10494,46 +10502,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted98) + Option::Some(lifted100) } _ => panic() } - let lifted101 : String? = match + let lifted103 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result100 = mbt_ffi_ptr2str( + let result102 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result100) + Option::Some(result102) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted97, - max: lifted99, - unit: lifted101, + min: lifted99, + max: lifted101, + unit: lifted103, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted102) + @types.SchemaTypeBody::S64Type(lifted104) } 6 => { - let lifted109 : @types.NumericRestrictions? = match + let lifted111 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted104 : @types.NumericBound? = match + let lifted106 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted103 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted105 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10549,16 +10557,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted103) + Option::Some(lifted105) } _ => panic() } - let lifted106 : @types.NumericBound? = match + let lifted108 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted105 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted107 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10574,46 +10582,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted105) + Option::Some(lifted107) } _ => panic() } - let lifted108 : String? = match + let lifted110 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result107 = mbt_ffi_ptr2str( + let result109 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result107) + Option::Some(result109) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted104, - max: lifted106, - unit: lifted108, + min: lifted106, + max: lifted108, + unit: lifted110, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted109) + @types.SchemaTypeBody::U8Type(lifted111) } 7 => { - let lifted116 : @types.NumericRestrictions? = match + let lifted118 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted111 : @types.NumericBound? = match + let lifted113 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted110 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted112 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10629,16 +10637,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted110) + Option::Some(lifted112) } _ => panic() } - let lifted113 : @types.NumericBound? = match + let lifted115 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted112 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted114 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10654,46 +10662,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted112) + Option::Some(lifted114) } _ => panic() } - let lifted115 : String? = match + let lifted117 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result114 = mbt_ffi_ptr2str( + let result116 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result114) + Option::Some(result116) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted111, - max: lifted113, - unit: lifted115, + min: lifted113, + max: lifted115, + unit: lifted117, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted116) + @types.SchemaTypeBody::U16Type(lifted118) } 8 => { - let lifted123 : @types.NumericRestrictions? = match + let lifted125 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted118 : @types.NumericBound? = match + let lifted120 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted117 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted119 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10709,16 +10717,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted117) + Option::Some(lifted119) } _ => panic() } - let lifted120 : @types.NumericBound? = match + let lifted122 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted119 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted121 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10734,46 +10742,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted119) + Option::Some(lifted121) } _ => panic() } - let lifted122 : String? = match + let lifted124 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result121 = mbt_ffi_ptr2str( + let result123 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result121) + Option::Some(result123) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted118, - max: lifted120, - unit: lifted122, + min: lifted120, + max: lifted122, + unit: lifted124, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted123) + @types.SchemaTypeBody::U32Type(lifted125) } 9 => { - let lifted130 : @types.NumericRestrictions? = match + let lifted132 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted125 : @types.NumericBound? = match + let lifted127 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted124 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted126 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10789,16 +10797,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted124) + Option::Some(lifted126) } _ => panic() } - let lifted127 : @types.NumericBound? = match + let lifted129 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted126 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted128 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10814,46 +10822,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted126) + Option::Some(lifted128) } _ => panic() } - let lifted129 : String? = match + let lifted131 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result128 = mbt_ffi_ptr2str( + let result130 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result128) + Option::Some(result130) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted125, - max: lifted127, - unit: lifted129, + min: lifted127, + max: lifted129, + unit: lifted131, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted130) + @types.SchemaTypeBody::U64Type(lifted132) } 10 => { - let lifted137 : @types.NumericRestrictions? = match + let lifted139 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted132 : @types.NumericBound? = match + let lifted134 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted131 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted133 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10869,16 +10877,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted131) + Option::Some(lifted133) } _ => panic() } - let lifted134 : @types.NumericBound? = match + let lifted136 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted133 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted135 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10894,46 +10902,46 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted133) + Option::Some(lifted135) } _ => panic() } - let lifted136 : String? = match + let lifted138 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result135 = mbt_ffi_ptr2str( + let result137 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result135) + Option::Some(result137) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted132, - max: lifted134, - unit: lifted136, + min: lifted134, + max: lifted136, + unit: lifted138, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted137) + @types.SchemaTypeBody::F32Type(lifted139) } 11 => { - let lifted144 : @types.NumericRestrictions? = match + let lifted146 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted139 : @types.NumericBound? = match + let lifted141 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted138 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted140 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -10949,16 +10957,16 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted138) + Option::Some(lifted140) } _ => panic() } - let lifted141 : @types.NumericBound? = match + let lifted143 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted140 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted142 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -10974,316 +10982,316 @@ pub fn make_agent_id( _ => panic() } - Option::Some(lifted140) + Option::Some(lifted142) } _ => panic() } - let lifted143 : String? = match + let lifted145 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result142 = mbt_ffi_ptr2str( + let result144 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result142) + Option::Some(result144) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted139, - max: lifted141, - unit: lifted143, + min: lifted141, + max: lifted143, + unit: lifted145, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted144) + @types.SchemaTypeBody::F64Type(lifted146) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array158 : Array[@types.NamedFieldType] = [] - for index159 = 0 - index159 < mbt_ffi_load32(iter_base + 12) - index159 = index159 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index159 * 68 + let array160 : Array[@types.NamedFieldType] = [] + for index161 = 0 + index161 < mbt_ffi_load32(iter_base + 12) + index161 = index161 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index161 * 68 - let result145 = mbt_ffi_ptr2str( + let result147 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted147 : String? = match + let lifted149 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result146 = mbt_ffi_ptr2str( + let result148 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result146) + Option::Some(result148) } _ => panic() } let array : Array[String] = [] - for index149 = 0 - index149 < mbt_ffi_load32(iter_base + 28) - index149 = index149 + 1 { + for index151 = 0 + index151 < mbt_ffi_load32(iter_base + 28) + index151 = index151 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index149 * 8 + index151 * 8 - let result148 = mbt_ffi_ptr2str( + let result150 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array.push(result148) + array.push(result150) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array151 : Array[String] = [] - for index152 = 0 - index152 < mbt_ffi_load32(iter_base + 36) - index152 = index152 + 1 { + let array153 : Array[String] = [] + for index154 = 0 + index154 < mbt_ffi_load32(iter_base + 36) + index154 = index154 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index152 * 8 + index154 * 8 - let result150 = mbt_ffi_ptr2str( + let result152 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array151.push(result150) + array153.push(result152) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted154 : String? = match + let lifted156 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result153 = mbt_ffi_ptr2str( + let result155 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result153) + Option::Some(result155) } _ => panic() } - let lifted157 : @types.Role? = match + let lifted159 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted156 = match mbt_ffi_load8_u(iter_base + 56) { + let lifted158 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result155 = mbt_ffi_ptr2str( + let result157 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result155) + @types.Role::Other(result157) } _ => panic() } - Option::Some(lifted156) + Option::Some(lifted158) } _ => panic() } - array158.push(@types.NamedFieldType::{ - name: result145, + array160.push(@types.NamedFieldType::{ + name: result147, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted147, + doc: lifted149, aliases: array, - examples: array151, - deprecated: lifted154, - role: lifted157, + examples: array153, + deprecated: lifted156, + role: lifted159, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array158) + @types.SchemaTypeBody::RecordType(array160) } 15 => { - let array175 : Array[@types.VariantCaseType] = [] - for index176 = 0 - index176 < mbt_ffi_load32(iter_base + 12) - index176 = index176 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index176 * 72 + let array177 : Array[@types.VariantCaseType] = [] + for index178 = 0 + index178 < mbt_ffi_load32(iter_base + 12) + index178 = index178 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index178 * 72 - let result160 = mbt_ffi_ptr2str( + let result162 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted161 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted163 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted163 : String? = match + let lifted165 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result162 = mbt_ffi_ptr2str( + let result164 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result162) + Option::Some(result164) } _ => panic() } - let array165 : Array[String] = [] - for index166 = 0 - index166 < mbt_ffi_load32(iter_base + 32) - index166 = index166 + 1 { + let array167 : Array[String] = [] + for index168 = 0 + index168 < mbt_ffi_load32(iter_base + 32) + index168 = index168 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index166 * 8 + index168 * 8 - let result164 = mbt_ffi_ptr2str( + let result166 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array165.push(result164) + array167.push(result166) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array168 : Array[String] = [] - for index169 = 0 - index169 < mbt_ffi_load32(iter_base + 40) - index169 = index169 + 1 { + let array170 : Array[String] = [] + for index171 = 0 + index171 < mbt_ffi_load32(iter_base + 40) + index171 = index171 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index169 * 8 + index171 * 8 - let result167 = mbt_ffi_ptr2str( + let result169 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array168.push(result167) + array170.push(result169) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted171 : String? = match + let lifted173 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result170 = mbt_ffi_ptr2str( + let result172 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result170) + Option::Some(result172) } _ => panic() } - let lifted174 : @types.Role? = match + let lifted176 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted173 = match mbt_ffi_load8_u(iter_base + 60) { + let lifted175 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result172 = mbt_ffi_ptr2str( + let result174 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result172) + @types.Role::Other(result174) } _ => panic() } - Option::Some(lifted173) + Option::Some(lifted175) } _ => panic() } - array175.push(@types.VariantCaseType::{ - name: result160, - payload: lifted161, + array177.push(@types.VariantCaseType::{ + name: result162, + payload: lifted163, metadata: @types.MetadataEnvelope::{ - doc: lifted163, - aliases: array165, - examples: array168, - deprecated: lifted171, - role: lifted174, + doc: lifted165, + aliases: array167, + examples: array170, + deprecated: lifted173, + role: lifted176, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array175) + @types.SchemaTypeBody::VariantType(array177) } 16 => { - let array178 : Array[String] = [] - for index179 = 0 - index179 < mbt_ffi_load32(iter_base + 12) - index179 = index179 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index179 * 8 + let array180 : Array[String] = [] + for index181 = 0 + index181 < mbt_ffi_load32(iter_base + 12) + index181 = index181 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index181 * 8 - let result177 = mbt_ffi_ptr2str( + let result179 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array178.push(result177) + array180.push(result179) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array178) + @types.SchemaTypeBody::EnumType(array180) } 17 => { - let array181 : Array[String] = [] - for index182 = 0 - index182 < mbt_ffi_load32(iter_base + 12) - index182 = index182 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index182 * 8 + let array183 : Array[String] = [] + for index184 = 0 + index184 < mbt_ffi_load32(iter_base + 12) + index184 = index184 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index184 * 8 - let result180 = mbt_ffi_ptr2str( + let result182 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array181.push(result180) + array183.push(result182) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array181) + @types.SchemaTypeBody::FlagsType(array183) } 18 => { - let array183 : Array[Int] = [] - for index184 = 0 - index184 < mbt_ffi_load32(iter_base + 12) - index184 = index184 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index184 * 4 + let array185 : Array[Int] = [] + for index186 = 0 + index186 < mbt_ffi_load32(iter_base + 12) + index186 = index186 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index186 * 4 - array183.push(mbt_ffi_load32(iter_base + 0)) + array185.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array183) + @types.SchemaTypeBody::TupleType(array185) } 19 => @types.SchemaTypeBody::ListType(mbt_ffi_load32(iter_base + 8)) @@ -11300,50 +11308,50 @@ pub fn make_agent_id( 22 => @types.SchemaTypeBody::OptionType(mbt_ffi_load32(iter_base + 8)) 23 => { - let lifted185 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted187 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted186 : Int? = match mbt_ffi_load8_u(iter_base + 16) { + let lifted188 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) _ => panic() } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted185, - err: lifted186, + ok: lifted187, + err: lifted188, }) } 24 => { - let lifted190 : Array[String]? = match + let lifted192 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array188 : Array[String] = [] - for index189 = 0 - index189 < mbt_ffi_load32(iter_base + 16) - index189 = index189 + 1 { + let array190 : Array[String] = [] + for index191 = 0 + index191 < mbt_ffi_load32(iter_base + 16) + index191 = index191 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index189 * 8 + index191 * 8 - let result187 = mbt_ffi_ptr2str( + let result189 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array188.push(result187) + array190.push(result189) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array188) + Option::Some(array190) } _ => panic() } - let lifted191 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { + let lifted193 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => Option::Some( @@ -11352,7 +11360,7 @@ pub fn make_agent_id( _ => panic() } - let lifted192 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { + let lifted194 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => Option::Some( @@ -11361,54 +11369,54 @@ pub fn make_agent_id( _ => panic() } - let lifted194 : String? = match + let lifted196 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result193 = mbt_ffi_ptr2str( + let result195 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result193) + Option::Some(result195) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted190, - min_length: lifted191, - max_length: lifted192, - regex: lifted194, + languages: lifted192, + min_length: lifted193, + max_length: lifted194, + regex: lifted196, }) } 25 => { - let lifted198 : Array[String]? = match + let lifted200 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array196 : Array[String] = [] - for index197 = 0 - index197 < mbt_ffi_load32(iter_base + 16) - index197 = index197 + 1 { + let array198 : Array[String] = [] + for index199 = 0 + index199 < mbt_ffi_load32(iter_base + 16) + index199 = index199 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index197 * 8 + index199 * 8 - let result195 = mbt_ffi_ptr2str( + let result197 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array196.push(result195) + array198.push(result197) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array196) + Option::Some(array198) } _ => panic() } - let lifted199 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { + let lifted201 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => Option::Some( @@ -11417,7 +11425,7 @@ pub fn make_agent_id( _ => panic() } - let lifted200 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { + let lifted202 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => Option::Some( @@ -11427,58 +11435,58 @@ pub fn make_agent_id( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted198, - min_bytes: lifted199, - max_bytes: lifted200, + mime_types: lifted200, + min_bytes: lifted201, + max_bytes: lifted202, }) } 26 => { - let lifted204 : Array[String]? = match + let lifted206 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array202 : Array[String] = [] - for index203 = 0 - index203 < mbt_ffi_load32(iter_base + 20) - index203 = index203 + 1 { + let array204 : Array[String] = [] + for index205 = 0 + index205 < mbt_ffi_load32(iter_base + 20) + index205 = index205 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index203 * 8 + index205 * 8 - let result201 = mbt_ffi_ptr2str( + let result203 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array202.push(result201) + array204.push(result203) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array202) + Option::Some(array204) } _ => panic() } - let lifted208 : Array[String]? = match + let lifted210 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array206 : Array[String] = [] - for index207 = 0 - index207 < mbt_ffi_load32(iter_base + 32) - index207 = index207 + 1 { + let array208 : Array[String] = [] + for index209 = 0 + index209 < mbt_ffi_load32(iter_base + 32) + index209 = index209 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index207 * 8 + index209 * 8 - let result205 = mbt_ffi_ptr2str( + let result207 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array206.push(result205) + array208.push(result207) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array206) + Option::Some(array208) } _ => panic() } @@ -11488,94 +11496,94 @@ pub fn make_agent_id( mbt_ffi_load8_u(iter_base + 8), ), kind: @types.PathKind::from(mbt_ffi_load8_u(iter_base + 9)), - allowed_mime_types: lifted204, - allowed_extensions: lifted208, + allowed_mime_types: lifted206, + allowed_extensions: lifted210, }) } 27 => { - let lifted212 : Array[String]? = match + let lifted214 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array210 : Array[String] = [] - for index211 = 0 - index211 < mbt_ffi_load32(iter_base + 16) - index211 = index211 + 1 { + let array212 : Array[String] = [] + for index213 = 0 + index213 < mbt_ffi_load32(iter_base + 16) + index213 = index213 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index211 * 8 + index213 * 8 - let result209 = mbt_ffi_ptr2str( + let result211 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array210.push(result209) + array212.push(result211) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array210) + Option::Some(array212) } _ => panic() } - let lifted216 : Array[String]? = match + let lifted218 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array214 : Array[String] = [] - for index215 = 0 - index215 < mbt_ffi_load32(iter_base + 28) - index215 = index215 + 1 { + let array216 : Array[String] = [] + for index217 = 0 + index217 < mbt_ffi_load32(iter_base + 28) + index217 = index217 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index215 * 8 + index217 * 8 - let result213 = mbt_ffi_ptr2str( + let result215 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array214.push(result213) + array216.push(result215) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array214) + Option::Some(array216) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted212, - allowed_hosts: lifted216, + allowed_schemes: lifted214, + allowed_hosts: lifted218, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result217 = mbt_ffi_ptr2str( + let result219 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array219 : Array[String] = [] - for index220 = 0 - index220 < mbt_ffi_load32(iter_base + 20) - index220 = index220 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 16) + index220 * 8 + let array221 : Array[String] = [] + for index222 = 0 + index222 < mbt_ffi_load32(iter_base + 20) + index222 = index222 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 16) + index222 * 8 - let result218 = mbt_ffi_ptr2str( + let result220 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array219.push(result218) + array221.push(result220) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted222 : @types.QuantityValue? = match + let lifted224 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result221 = mbt_ffi_ptr2str( + let result223 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -11583,17 +11591,17 @@ pub fn make_agent_id( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result221, + unit: result223, }) } _ => panic() } - let lifted224 : @types.QuantityValue? = match + let lifted226 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result223 = mbt_ffi_ptr2str( + let result225 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -11601,394 +11609,394 @@ pub fn make_agent_id( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result223, + unit: result225, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result217, - allowed_suffixes: array219, - min: lifted222, - max: lifted224, + base_unit: result219, + allowed_suffixes: array221, + min: lifted224, + max: lifted226, }) } 31 => { - let array248 : Array[@types.UnionBranch] = [] - for index249 = 0 - index249 < mbt_ffi_load32(iter_base + 12) - index249 = index249 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index249 * 92 + let array250 : Array[@types.UnionBranch] = [] + for index251 = 0 + index251 < mbt_ffi_load32(iter_base + 12) + index251 = index251 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index251 * 92 - let result225 = mbt_ffi_ptr2str( + let result227 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted234 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted236 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result226 = mbt_ffi_ptr2str( + let result228 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result226) + @types.DiscriminatorRule::Prefix(result228) } 1 => { - let result227 = mbt_ffi_ptr2str( + let result229 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result227) + @types.DiscriminatorRule::Suffix(result229) } 2 => { - let result228 = mbt_ffi_ptr2str( + let result230 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result228) + @types.DiscriminatorRule::Contains(result230) } 3 => { - let result229 = mbt_ffi_ptr2str( + let result231 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result229) + @types.DiscriminatorRule::Regex(result231) } 4 => { - let result230 = mbt_ffi_ptr2str( + let result232 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted232 : String? = match + let lifted234 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result231 = mbt_ffi_ptr2str( + let result233 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result231) + Option::Some(result233) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result230, - literal: lifted232, + field_name: result232, + literal: lifted234, }) } 5 => { - let result233 = mbt_ffi_ptr2str( + let result235 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result233) + @types.DiscriminatorRule::FieldAbsent(result235) } _ => panic() } - let lifted236 : String? = match + let lifted238 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result235 = mbt_ffi_ptr2str( + let result237 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result235) + Option::Some(result237) } _ => panic() } - let array238 : Array[String] = [] - for index239 = 0 - index239 < mbt_ffi_load32(iter_base + 52) - index239 = index239 + 1 { + let array240 : Array[String] = [] + for index241 = 0 + index241 < mbt_ffi_load32(iter_base + 52) + index241 = index241 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index239 * 8 + index241 * 8 - let result237 = mbt_ffi_ptr2str( + let result239 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array238.push(result237) + array240.push(result239) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array241 : Array[String] = [] - for index242 = 0 - index242 < mbt_ffi_load32(iter_base + 60) - index242 = index242 + 1 { + let array243 : Array[String] = [] + for index244 = 0 + index244 < mbt_ffi_load32(iter_base + 60) + index244 = index244 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index242 * 8 + index244 * 8 - let result240 = mbt_ffi_ptr2str( + let result242 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array241.push(result240) + array243.push(result242) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted244 : String? = match + let lifted246 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result243 = mbt_ffi_ptr2str( + let result245 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result243) + Option::Some(result245) } _ => panic() } - let lifted247 : @types.Role? = match + let lifted249 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted246 = match mbt_ffi_load8_u(iter_base + 80) { + let lifted248 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result245 = mbt_ffi_ptr2str( + let result247 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result245) + @types.Role::Other(result247) } _ => panic() } - Option::Some(lifted246) + Option::Some(lifted248) } _ => panic() } - array248.push(@types.UnionBranch::{ - tag: result225, + array250.push(@types.UnionBranch::{ + tag: result227, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted234, + discriminator: lifted236, metadata: @types.MetadataEnvelope::{ - doc: lifted236, - aliases: array238, - examples: array241, - deprecated: lifted244, - role: lifted247, + doc: lifted238, + aliases: array240, + examples: array243, + deprecated: lifted246, + role: lifted249, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array248, + branches: array250, }) } 32 => { - let lifted251 : String? = match + let lifted253 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result250 = mbt_ffi_ptr2str( + let result252 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result250) + Option::Some(result252) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted251, + category: lifted253, }) } 33 => { - let lifted253 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted255 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result252 = mbt_ffi_ptr2str( + let result254 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result252) + Option::Some(result254) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted253, + resource_name: lifted255, }) } 34 => { - let lifted254 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted256 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted254) + @types.SchemaTypeBody::FutureType(lifted256) } 35 => { - let lifted255 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted257 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted255) + @types.SchemaTypeBody::StreamType(lifted257) } _ => panic() } - let lifted258 : String? = match mbt_ffi_load8_u(iter_base + 88) { + let lifted260 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result257 = mbt_ffi_ptr2str( + let result259 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result257) + Option::Some(result259) } _ => panic() } - let array260 : Array[String] = [] - for index261 = 0 - index261 < mbt_ffi_load32(iter_base + 104) - index261 = index261 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index261 * 8 + let array262 : Array[String] = [] + for index263 = 0 + index263 < mbt_ffi_load32(iter_base + 104) + index263 = index263 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index263 * 8 - let result259 = mbt_ffi_ptr2str( + let result261 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array260.push(result259) + array262.push(result261) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array263 : Array[String] = [] - for index264 = 0 - index264 < mbt_ffi_load32(iter_base + 112) - index264 = index264 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index264 * 8 + let array265 : Array[String] = [] + for index266 = 0 + index266 < mbt_ffi_load32(iter_base + 112) + index266 = index266 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index266 * 8 - let result262 = mbt_ffi_ptr2str( + let result264 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array263.push(result262) + array265.push(result264) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted266 : String? = match mbt_ffi_load8_u(iter_base + 116) { + let lifted268 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result265 = mbt_ffi_ptr2str( + let result267 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result265) + Option::Some(result267) } _ => panic() } - let lifted269 : @types.Role? = match + let lifted271 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted268 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted270 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result267 = mbt_ffi_ptr2str( + let result269 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result267) + @types.Role::Other(result269) } _ => panic() } - Option::Some(lifted268) + Option::Some(lifted270) } _ => panic() } - array270.push(@types.SchemaTypeNode::{ - body: lifted256, + array272.push(@types.SchemaTypeNode::{ + body: lifted258, metadata: @types.MetadataEnvelope::{ - doc: lifted258, - aliases: array260, - examples: array263, - deprecated: lifted266, - role: lifted269, + doc: lifted260, + aliases: array262, + examples: array265, + deprecated: lifted268, + role: lifted271, }, }) } mbt_ffi_free(mbt_ffi_load32(return_area + 8)) - let array275 : Array[@types.SchemaTypeDef] = [] - for index276 = 0 - index276 < mbt_ffi_load32(return_area + 20) - index276 = index276 + 1 { - let iter_base = mbt_ffi_load32(return_area + 16) + index276 * 24 + let array277 : Array[@types.SchemaTypeDef] = [] + for index278 = 0 + index278 < mbt_ffi_load32(return_area + 20) + index278 = index278 + 1 { + let iter_base = mbt_ffi_load32(return_area + 16) + index278 * 24 - let result272 = mbt_ffi_ptr2str( + let result274 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted274 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted276 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result273 = mbt_ffi_ptr2str( + let result275 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result273) + Option::Some(result275) } _ => panic() } - array275.push(@types.SchemaTypeDef::{ - id: result272, - name: lifted274, + array277.push(@types.SchemaTypeDef::{ + id: result274, + name: lifted276, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(return_area + 16)) - let array306 : Array[@types.SchemaValueNode] = [] - for index307 = 0 - index307 < mbt_ffi_load32(return_area + 32) - index307 = index307 + 1 { - let iter_base = mbt_ffi_load32(return_area + 28) + index307 * 32 + let array308 : Array[@types.SchemaValueNode] = [] + for index309 = 0 + index309 < mbt_ffi_load32(return_area + 32) + index309 = index309 + 1 { + let iter_base = mbt_ffi_load32(return_area + 28) + index309 * 32 - let lifted305 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted307 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -12027,28 +12035,28 @@ pub fn make_agent_id( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result277 = mbt_ffi_ptr2str( + let result279 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result277) + @types.SchemaValueNode::StringValue(result279) } 13 => { - let array278 : Array[Int] = [] - for index279 = 0 - index279 < mbt_ffi_load32(iter_base + 12) - index279 = index279 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index279 * 4 + let array280 : Array[Int] = [] + for index281 = 0 + index281 < mbt_ffi_load32(iter_base + 12) + index281 = index281 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index281 * 4 - array278.push(mbt_ffi_load32(iter_base + 0)) + array280.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array278) + @types.SchemaValueNode::RecordValue(array280) } 14 => { - let lifted280 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + let lifted282 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() @@ -12056,7 +12064,7 @@ pub fn make_agent_id( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted280, + payload: lifted282, }) } 15 => @@ -12064,32 +12072,19 @@ pub fn make_agent_id( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array281 : Array[Bool] = [] - for index282 = 0 - index282 < mbt_ffi_load32(iter_base + 12) - index282 = index282 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index282 * 1 - - array281.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array281) - } - 17 => { - let array283 : Array[Int] = [] + let array283 : Array[Bool] = [] for index284 = 0 index284 < mbt_ffi_load32(iter_base + 12) index284 = index284 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index284 * 4 + let iter_base = mbt_ffi_load32(iter_base + 8) + index284 * 1 - array283.push(mbt_ffi_load32(iter_base + 0)) + array283.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array283) + @types.SchemaValueNode::FlagsValue(array283) } - 18 => { + 17 => { let array285 : Array[Int] = [] for index286 = 0 index286 < mbt_ffi_load32(iter_base + 12) @@ -12100,9 +12095,9 @@ pub fn make_agent_id( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array285) + @types.SchemaValueNode::TupleValue(array285) } - 19 => { + 18 => { let array287 : Array[Int] = [] for index288 = 0 index288 < mbt_ffi_load32(iter_base + 12) @@ -12113,125 +12108,138 @@ pub fn make_agent_id( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array287) + @types.SchemaValueNode::ListValue(array287) } - 20 => { - let array289 : Array[@types.MapEntry] = [] + 19 => { + let array289 : Array[Int] = [] for index290 = 0 index290 < mbt_ffi_load32(iter_base + 12) index290 = index290 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index290 * 8 + let iter_base = mbt_ffi_load32(iter_base + 8) + index290 * 4 + + array289.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - array289.push(@types.MapEntry::{ + @types.SchemaValueNode::FixedListValue(array289) + } + 20 => { + let array291 : Array[@types.MapEntry] = [] + for index292 = 0 + index292 < mbt_ffi_load32(iter_base + 12) + index292 = index292 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index292 * 8 + + array291.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array289) + @types.SchemaValueNode::MapValue(array291) } 21 => { - let lifted291 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted293 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted291) + @types.SchemaValueNode::OptionValue(lifted293) } 22 => { - let lifted294 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted296 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted292 : Int? = match + let lifted294 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted292) + @types.ResultValuePayload::OkValue(lifted294) } 1 => { - let lifted293 : Int? = match + let lifted295 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted293) + @types.ResultValuePayload::ErrValue(lifted295) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted294) + @types.SchemaValueNode::ResultValue(lifted296) } 23 => { - let result295 = mbt_ffi_ptr2str( + let result297 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted297 : String? = match + let lifted299 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result296 = mbt_ffi_ptr2str( + let result298 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result296) + Option::Some(result298) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result295, - language: lifted297, + text: result297, + language: lifted299, }) } 24 => { - let result298 = mbt_ffi_ptr2bytes( + let result300 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted300 : String? = match + let lifted302 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result299 = mbt_ffi_ptr2str( + let result301 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result299) + Option::Some(result301) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result298, - mime_type: lifted300, + bytes: result300, + mime_type: lifted302, }) } 25 => { - let result301 = mbt_ffi_ptr2str( + let result303 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result301) + @types.SchemaValueNode::PathValue(result303) } 26 => { - let result302 = mbt_ffi_ptr2str( + let result304 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result302) + @types.SchemaValueNode::UrlValue(result304) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -12243,7 +12251,7 @@ pub fn make_agent_id( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result303 = mbt_ffi_ptr2str( + let result305 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -12251,17 +12259,17 @@ pub fn make_agent_id( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result303, + unit: result305, }) } 30 => { - let result304 = mbt_ffi_ptr2str( + let result306 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result304, + tag: result306, body: mbt_ffi_load32(iter_base + 16), }) } @@ -12273,21 +12281,27 @@ pub fn make_agent_id( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array306.push(lifted305) + array308.push(lifted307) } mbt_ffi_free(mbt_ffi_load32(return_area + 28)) @common.AgentError::CustomError(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array270, - defs: array275, + type_nodes: array272, + defs: array277, root: mbt_ffi_load32(return_area + 24), }, value: @types.SchemaValueTree::{ - value_nodes: array306, + value_nodes: array308, root: mbt_ffi_load32(return_area + 36), }, }) @@ -12295,13 +12309,13 @@ pub fn make_agent_id( _ => panic() } - Result::Err(lifted308) + Result::Err(lifted310) } _ => panic() } - let ret = lifted309 + let ret = lifted311 mbt_ffi_free(ptr) - mbt_ffi_free(address66) + mbt_ffi_free(address68) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -14363,6 +14377,12 @@ pub fn parse_agent_id( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -16511,6 +16531,12 @@ pub fn parse_agent_id( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -16588,12 +16614,12 @@ pub fn WasmRpc::wasm_rpc( let ptr = mbt_ffi_str2ptr(agent_type_name) - let address66 = mbt_ffi_malloc(constructor_.value_nodes.length() * 32) - for index67 = 0 - index67 < constructor_.value_nodes.length() - index67 = index67 + 1 { - let iter_elem : @types.SchemaValueNode = constructor_.value_nodes[index67] - let iter_base = address66 + index67 * 32 + let address68 = mbt_ffi_malloc(constructor_.value_nodes.length() * 32) + for index69 = 0 + index69 < constructor_.value_nodes.length() + index69 = index69 + 1 { + let iter_elem : @types.SchemaValueNode = constructor_.value_nodes[index69] + let iter_base = address68 + index69 * 32 match iter_elem { BoolValue(payload) => { @@ -16990,52 +17016,60 @@ pub fn WasmRpc::wasm_rpc( let @types.QuotaToken(handle65) = payload64 mbt_ffi_store32(iter_base + 8, handle65) + () + } + StreamValue(payload66) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle67) = payload66 + mbt_ffi_store32(iter_base + 8, handle67) + () } } } - let (lowered, lowered70, lowered71) = match phantom_id { + let (lowered, lowered72, lowered73) = match phantom_id { None => (0, 0L, 0L) - Some(payload69) => + Some(payload71) => ( 1, - payload69.high_bits.reinterpret_as_int64(), - payload69.low_bits.reinterpret_as_int64(), + payload71.high_bits.reinterpret_as_int64(), + payload71.low_bits.reinterpret_as_int64(), ) } - let address516 = mbt_ffi_malloc(agent_config.length() * 40) - for index517 = 0; index517 < agent_config.length(); index517 = index517 + 1 { - let iter_elem : @common.TypedAgentConfigValue = agent_config[index517] - let iter_base = address516 + index517 * 40 + let address520 = mbt_ffi_malloc(agent_config.length() * 40) + for index521 = 0; index521 < agent_config.length(); index521 = index521 + 1 { + let iter_elem : @common.TypedAgentConfigValue = agent_config[index521] + let iter_base = address520 + index521 * 40 - let address73 = mbt_ffi_malloc(iter_elem.path.length() * 8) - for index74 = 0; index74 < iter_elem.path.length(); index74 = index74 + 1 { - let iter_elem : String = iter_elem.path[index74] - let iter_base = address73 + index74 * 8 + let address75 = mbt_ffi_malloc(iter_elem.path.length() * 8) + for index76 = 0; index76 < iter_elem.path.length(); index76 = index76 + 1 { + let iter_elem : String = iter_elem.path[index76] + let iter_base = address75 + index76 * 8 - let ptr72 = mbt_ffi_str2ptr(iter_elem) + let ptr74 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr72) - cleanup_list.push(ptr72) + mbt_ffi_store32(iter_base + 0, ptr74) + cleanup_list.push(ptr74) } mbt_ffi_store32(iter_base + 4, iter_elem.path.length()) - mbt_ffi_store32(iter_base + 0, address73) + mbt_ffi_store32(iter_base + 0, address75) - let address436 = mbt_ffi_malloc( + let address438 = mbt_ffi_malloc( iter_elem.value.graph.type_nodes.length() * 144, ) - for index437 = 0 - index437 < iter_elem.value.graph.type_nodes.length() - index437 = index437 + 1 { - let iter_elem : @types.SchemaTypeNode = iter_elem.value.graph.type_nodes[index437] - let iter_base = address436 + index437 * 144 + for index439 = 0 + index439 < iter_elem.value.graph.type_nodes.length() + index439 = index439 + 1 { + let iter_elem : @types.SchemaTypeNode = iter_elem.value.graph.type_nodes[index439] + let iter_base = address438 + index439 * 144 match iter_elem.body { - RefType(payload75) => { + RefType(payload77) => { mbt_ffi_store8(iter_base + 0, 0) - mbt_ffi_store32(iter_base + 8, payload75) + mbt_ffi_store32(iter_base + 8, payload77) () } @@ -17044,48 +17078,48 @@ pub fn WasmRpc::wasm_rpc( () } - S8Type(payload77) => { + S8Type(payload79) => { mbt_ffi_store8(iter_base + 0, 2) - match payload77 { + match payload79 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload79) => { + Some(payload81) => { mbt_ffi_store8(iter_base + 8, 1) - match payload79.min { + match payload81.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload81) => { + Some(payload83) => { mbt_ffi_store8(iter_base + 16, 1) - match payload81 { - Signed(payload82) => { + match payload83 { + Signed(payload84) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload82) + mbt_ffi_store64(iter_base + 32, payload84) () } - Unsigned(payload83) => { + Unsigned(payload85) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload83.reinterpret_as_int64(), + payload85.reinterpret_as_int64(), ) () } - FloatBits(payload84) => { + FloatBits(payload86) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload84.reinterpret_as_int64(), + payload86.reinterpret_as_int64(), ) () @@ -17096,36 +17130,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload79.max { + match payload81.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload86) => { + Some(payload88) => { mbt_ffi_store8(iter_base + 40, 1) - match payload86 { - Signed(payload87) => { + match payload88 { + Signed(payload89) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload87) + mbt_ffi_store64(iter_base + 56, payload89) () } - Unsigned(payload88) => { + Unsigned(payload90) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload88.reinterpret_as_int64(), + payload90.reinterpret_as_int64(), ) () } - FloatBits(payload89) => { + FloatBits(payload91) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload89.reinterpret_as_int64(), + payload91.reinterpret_as_int64(), ) () @@ -17136,19 +17170,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload79.unit { + match payload81.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload91) => { + Some(payload93) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr92 = mbt_ffi_str2ptr(payload91) - mbt_ffi_store32(iter_base + 72, payload91.length()) - mbt_ffi_store32(iter_base + 68, ptr92) - cleanup_list.push(ptr92) + let ptr94 = mbt_ffi_str2ptr(payload93) + mbt_ffi_store32(iter_base + 72, payload93.length()) + mbt_ffi_store32(iter_base + 68, ptr94) + cleanup_list.push(ptr94) () } @@ -17160,48 +17194,48 @@ pub fn WasmRpc::wasm_rpc( () } - S16Type(payload93) => { + S16Type(payload95) => { mbt_ffi_store8(iter_base + 0, 3) - match payload93 { + match payload95 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload95) => { + Some(payload97) => { mbt_ffi_store8(iter_base + 8, 1) - match payload95.min { + match payload97.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload97) => { + Some(payload99) => { mbt_ffi_store8(iter_base + 16, 1) - match payload97 { - Signed(payload98) => { + match payload99 { + Signed(payload100) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload98) + mbt_ffi_store64(iter_base + 32, payload100) () } - Unsigned(payload99) => { + Unsigned(payload101) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload99.reinterpret_as_int64(), + payload101.reinterpret_as_int64(), ) () } - FloatBits(payload100) => { + FloatBits(payload102) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload100.reinterpret_as_int64(), + payload102.reinterpret_as_int64(), ) () @@ -17212,36 +17246,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload95.max { + match payload97.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload102) => { + Some(payload104) => { mbt_ffi_store8(iter_base + 40, 1) - match payload102 { - Signed(payload103) => { + match payload104 { + Signed(payload105) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload103) + mbt_ffi_store64(iter_base + 56, payload105) () } - Unsigned(payload104) => { + Unsigned(payload106) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload104.reinterpret_as_int64(), + payload106.reinterpret_as_int64(), ) () } - FloatBits(payload105) => { + FloatBits(payload107) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload105.reinterpret_as_int64(), + payload107.reinterpret_as_int64(), ) () @@ -17252,19 +17286,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload95.unit { + match payload97.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload107) => { + Some(payload109) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr108 = mbt_ffi_str2ptr(payload107) - mbt_ffi_store32(iter_base + 72, payload107.length()) - mbt_ffi_store32(iter_base + 68, ptr108) - cleanup_list.push(ptr108) + let ptr110 = mbt_ffi_str2ptr(payload109) + mbt_ffi_store32(iter_base + 72, payload109.length()) + mbt_ffi_store32(iter_base + 68, ptr110) + cleanup_list.push(ptr110) () } @@ -17276,48 +17310,48 @@ pub fn WasmRpc::wasm_rpc( () } - S32Type(payload109) => { + S32Type(payload111) => { mbt_ffi_store8(iter_base + 0, 4) - match payload109 { + match payload111 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload111) => { + Some(payload113) => { mbt_ffi_store8(iter_base + 8, 1) - match payload111.min { + match payload113.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload113) => { + Some(payload115) => { mbt_ffi_store8(iter_base + 16, 1) - match payload113 { - Signed(payload114) => { + match payload115 { + Signed(payload116) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload114) + mbt_ffi_store64(iter_base + 32, payload116) () } - Unsigned(payload115) => { + Unsigned(payload117) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload115.reinterpret_as_int64(), + payload117.reinterpret_as_int64(), ) () } - FloatBits(payload116) => { + FloatBits(payload118) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload116.reinterpret_as_int64(), + payload118.reinterpret_as_int64(), ) () @@ -17328,36 +17362,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload111.max { + match payload113.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload118) => { + Some(payload120) => { mbt_ffi_store8(iter_base + 40, 1) - match payload118 { - Signed(payload119) => { + match payload120 { + Signed(payload121) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload119) + mbt_ffi_store64(iter_base + 56, payload121) () } - Unsigned(payload120) => { + Unsigned(payload122) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload120.reinterpret_as_int64(), + payload122.reinterpret_as_int64(), ) () } - FloatBits(payload121) => { + FloatBits(payload123) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload121.reinterpret_as_int64(), + payload123.reinterpret_as_int64(), ) () @@ -17368,19 +17402,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload111.unit { + match payload113.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload123) => { + Some(payload125) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr124 = mbt_ffi_str2ptr(payload123) - mbt_ffi_store32(iter_base + 72, payload123.length()) - mbt_ffi_store32(iter_base + 68, ptr124) - cleanup_list.push(ptr124) + let ptr126 = mbt_ffi_str2ptr(payload125) + mbt_ffi_store32(iter_base + 72, payload125.length()) + mbt_ffi_store32(iter_base + 68, ptr126) + cleanup_list.push(ptr126) () } @@ -17392,48 +17426,48 @@ pub fn WasmRpc::wasm_rpc( () } - S64Type(payload125) => { + S64Type(payload127) => { mbt_ffi_store8(iter_base + 0, 5) - match payload125 { + match payload127 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload127) => { + Some(payload129) => { mbt_ffi_store8(iter_base + 8, 1) - match payload127.min { + match payload129.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload129) => { + Some(payload131) => { mbt_ffi_store8(iter_base + 16, 1) - match payload129 { - Signed(payload130) => { + match payload131 { + Signed(payload132) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload130) + mbt_ffi_store64(iter_base + 32, payload132) () } - Unsigned(payload131) => { + Unsigned(payload133) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload131.reinterpret_as_int64(), + payload133.reinterpret_as_int64(), ) () } - FloatBits(payload132) => { + FloatBits(payload134) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload132.reinterpret_as_int64(), + payload134.reinterpret_as_int64(), ) () @@ -17444,36 +17478,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload127.max { + match payload129.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload134) => { + Some(payload136) => { mbt_ffi_store8(iter_base + 40, 1) - match payload134 { - Signed(payload135) => { + match payload136 { + Signed(payload137) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload135) + mbt_ffi_store64(iter_base + 56, payload137) () } - Unsigned(payload136) => { + Unsigned(payload138) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload136.reinterpret_as_int64(), + payload138.reinterpret_as_int64(), ) () } - FloatBits(payload137) => { + FloatBits(payload139) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload137.reinterpret_as_int64(), + payload139.reinterpret_as_int64(), ) () @@ -17484,19 +17518,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload127.unit { + match payload129.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload139) => { + Some(payload141) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr140 = mbt_ffi_str2ptr(payload139) - mbt_ffi_store32(iter_base + 72, payload139.length()) - mbt_ffi_store32(iter_base + 68, ptr140) - cleanup_list.push(ptr140) + let ptr142 = mbt_ffi_str2ptr(payload141) + mbt_ffi_store32(iter_base + 72, payload141.length()) + mbt_ffi_store32(iter_base + 68, ptr142) + cleanup_list.push(ptr142) () } @@ -17508,48 +17542,48 @@ pub fn WasmRpc::wasm_rpc( () } - U8Type(payload141) => { + U8Type(payload143) => { mbt_ffi_store8(iter_base + 0, 6) - match payload141 { + match payload143 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload143) => { + Some(payload145) => { mbt_ffi_store8(iter_base + 8, 1) - match payload143.min { + match payload145.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload145) => { + Some(payload147) => { mbt_ffi_store8(iter_base + 16, 1) - match payload145 { - Signed(payload146) => { + match payload147 { + Signed(payload148) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload146) + mbt_ffi_store64(iter_base + 32, payload148) () } - Unsigned(payload147) => { + Unsigned(payload149) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload147.reinterpret_as_int64(), + payload149.reinterpret_as_int64(), ) () } - FloatBits(payload148) => { + FloatBits(payload150) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload148.reinterpret_as_int64(), + payload150.reinterpret_as_int64(), ) () @@ -17560,36 +17594,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload143.max { + match payload145.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload150) => { + Some(payload152) => { mbt_ffi_store8(iter_base + 40, 1) - match payload150 { - Signed(payload151) => { + match payload152 { + Signed(payload153) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload151) + mbt_ffi_store64(iter_base + 56, payload153) () } - Unsigned(payload152) => { + Unsigned(payload154) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload152.reinterpret_as_int64(), + payload154.reinterpret_as_int64(), ) () } - FloatBits(payload153) => { + FloatBits(payload155) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload153.reinterpret_as_int64(), + payload155.reinterpret_as_int64(), ) () @@ -17600,19 +17634,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload143.unit { + match payload145.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload155) => { + Some(payload157) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr156 = mbt_ffi_str2ptr(payload155) - mbt_ffi_store32(iter_base + 72, payload155.length()) - mbt_ffi_store32(iter_base + 68, ptr156) - cleanup_list.push(ptr156) + let ptr158 = mbt_ffi_str2ptr(payload157) + mbt_ffi_store32(iter_base + 72, payload157.length()) + mbt_ffi_store32(iter_base + 68, ptr158) + cleanup_list.push(ptr158) () } @@ -17624,48 +17658,48 @@ pub fn WasmRpc::wasm_rpc( () } - U16Type(payload157) => { + U16Type(payload159) => { mbt_ffi_store8(iter_base + 0, 7) - match payload157 { + match payload159 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload159) => { + Some(payload161) => { mbt_ffi_store8(iter_base + 8, 1) - match payload159.min { + match payload161.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload161) => { + Some(payload163) => { mbt_ffi_store8(iter_base + 16, 1) - match payload161 { - Signed(payload162) => { + match payload163 { + Signed(payload164) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload162) + mbt_ffi_store64(iter_base + 32, payload164) () } - Unsigned(payload163) => { + Unsigned(payload165) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload163.reinterpret_as_int64(), + payload165.reinterpret_as_int64(), ) () } - FloatBits(payload164) => { + FloatBits(payload166) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload164.reinterpret_as_int64(), + payload166.reinterpret_as_int64(), ) () @@ -17676,36 +17710,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload159.max { + match payload161.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload166) => { + Some(payload168) => { mbt_ffi_store8(iter_base + 40, 1) - match payload166 { - Signed(payload167) => { + match payload168 { + Signed(payload169) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload167) + mbt_ffi_store64(iter_base + 56, payload169) () } - Unsigned(payload168) => { + Unsigned(payload170) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload168.reinterpret_as_int64(), + payload170.reinterpret_as_int64(), ) () } - FloatBits(payload169) => { + FloatBits(payload171) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload169.reinterpret_as_int64(), + payload171.reinterpret_as_int64(), ) () @@ -17716,19 +17750,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload159.unit { + match payload161.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload171) => { + Some(payload173) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr172 = mbt_ffi_str2ptr(payload171) - mbt_ffi_store32(iter_base + 72, payload171.length()) - mbt_ffi_store32(iter_base + 68, ptr172) - cleanup_list.push(ptr172) + let ptr174 = mbt_ffi_str2ptr(payload173) + mbt_ffi_store32(iter_base + 72, payload173.length()) + mbt_ffi_store32(iter_base + 68, ptr174) + cleanup_list.push(ptr174) () } @@ -17740,48 +17774,48 @@ pub fn WasmRpc::wasm_rpc( () } - U32Type(payload173) => { + U32Type(payload175) => { mbt_ffi_store8(iter_base + 0, 8) - match payload173 { + match payload175 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload175) => { + Some(payload177) => { mbt_ffi_store8(iter_base + 8, 1) - match payload175.min { + match payload177.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload177) => { + Some(payload179) => { mbt_ffi_store8(iter_base + 16, 1) - match payload177 { - Signed(payload178) => { + match payload179 { + Signed(payload180) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload178) + mbt_ffi_store64(iter_base + 32, payload180) () } - Unsigned(payload179) => { + Unsigned(payload181) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload179.reinterpret_as_int64(), + payload181.reinterpret_as_int64(), ) () } - FloatBits(payload180) => { + FloatBits(payload182) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload180.reinterpret_as_int64(), + payload182.reinterpret_as_int64(), ) () @@ -17792,36 +17826,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload175.max { + match payload177.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload182) => { + Some(payload184) => { mbt_ffi_store8(iter_base + 40, 1) - match payload182 { - Signed(payload183) => { + match payload184 { + Signed(payload185) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload183) + mbt_ffi_store64(iter_base + 56, payload185) () } - Unsigned(payload184) => { + Unsigned(payload186) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload184.reinterpret_as_int64(), + payload186.reinterpret_as_int64(), ) () } - FloatBits(payload185) => { + FloatBits(payload187) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload185.reinterpret_as_int64(), + payload187.reinterpret_as_int64(), ) () @@ -17832,19 +17866,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload175.unit { + match payload177.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload187) => { + Some(payload189) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr188 = mbt_ffi_str2ptr(payload187) - mbt_ffi_store32(iter_base + 72, payload187.length()) - mbt_ffi_store32(iter_base + 68, ptr188) - cleanup_list.push(ptr188) + let ptr190 = mbt_ffi_str2ptr(payload189) + mbt_ffi_store32(iter_base + 72, payload189.length()) + mbt_ffi_store32(iter_base + 68, ptr190) + cleanup_list.push(ptr190) () } @@ -17856,48 +17890,48 @@ pub fn WasmRpc::wasm_rpc( () } - U64Type(payload189) => { + U64Type(payload191) => { mbt_ffi_store8(iter_base + 0, 9) - match payload189 { + match payload191 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload191) => { + Some(payload193) => { mbt_ffi_store8(iter_base + 8, 1) - match payload191.min { + match payload193.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload193) => { + Some(payload195) => { mbt_ffi_store8(iter_base + 16, 1) - match payload193 { - Signed(payload194) => { + match payload195 { + Signed(payload196) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload194) + mbt_ffi_store64(iter_base + 32, payload196) () } - Unsigned(payload195) => { + Unsigned(payload197) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload195.reinterpret_as_int64(), + payload197.reinterpret_as_int64(), ) () } - FloatBits(payload196) => { + FloatBits(payload198) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload196.reinterpret_as_int64(), + payload198.reinterpret_as_int64(), ) () @@ -17908,36 +17942,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload191.max { + match payload193.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload198) => { + Some(payload200) => { mbt_ffi_store8(iter_base + 40, 1) - match payload198 { - Signed(payload199) => { + match payload200 { + Signed(payload201) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload199) + mbt_ffi_store64(iter_base + 56, payload201) () } - Unsigned(payload200) => { + Unsigned(payload202) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload200.reinterpret_as_int64(), + payload202.reinterpret_as_int64(), ) () } - FloatBits(payload201) => { + FloatBits(payload203) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload201.reinterpret_as_int64(), + payload203.reinterpret_as_int64(), ) () @@ -17948,19 +17982,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload191.unit { + match payload193.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload203) => { + Some(payload205) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr204 = mbt_ffi_str2ptr(payload203) - mbt_ffi_store32(iter_base + 72, payload203.length()) - mbt_ffi_store32(iter_base + 68, ptr204) - cleanup_list.push(ptr204) + let ptr206 = mbt_ffi_str2ptr(payload205) + mbt_ffi_store32(iter_base + 72, payload205.length()) + mbt_ffi_store32(iter_base + 68, ptr206) + cleanup_list.push(ptr206) () } @@ -17972,48 +18006,48 @@ pub fn WasmRpc::wasm_rpc( () } - F32Type(payload205) => { + F32Type(payload207) => { mbt_ffi_store8(iter_base + 0, 10) - match payload205 { + match payload207 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload207) => { + Some(payload209) => { mbt_ffi_store8(iter_base + 8, 1) - match payload207.min { + match payload209.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload209) => { + Some(payload211) => { mbt_ffi_store8(iter_base + 16, 1) - match payload209 { - Signed(payload210) => { + match payload211 { + Signed(payload212) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload210) + mbt_ffi_store64(iter_base + 32, payload212) () } - Unsigned(payload211) => { + Unsigned(payload213) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload211.reinterpret_as_int64(), + payload213.reinterpret_as_int64(), ) () } - FloatBits(payload212) => { + FloatBits(payload214) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload212.reinterpret_as_int64(), + payload214.reinterpret_as_int64(), ) () @@ -18024,36 +18058,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload207.max { + match payload209.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload214) => { + Some(payload216) => { mbt_ffi_store8(iter_base + 40, 1) - match payload214 { - Signed(payload215) => { + match payload216 { + Signed(payload217) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload215) + mbt_ffi_store64(iter_base + 56, payload217) () } - Unsigned(payload216) => { + Unsigned(payload218) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload216.reinterpret_as_int64(), + payload218.reinterpret_as_int64(), ) () } - FloatBits(payload217) => { + FloatBits(payload219) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload217.reinterpret_as_int64(), + payload219.reinterpret_as_int64(), ) () @@ -18064,19 +18098,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload207.unit { + match payload209.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload219) => { + Some(payload221) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr220 = mbt_ffi_str2ptr(payload219) - mbt_ffi_store32(iter_base + 72, payload219.length()) - mbt_ffi_store32(iter_base + 68, ptr220) - cleanup_list.push(ptr220) + let ptr222 = mbt_ffi_str2ptr(payload221) + mbt_ffi_store32(iter_base + 72, payload221.length()) + mbt_ffi_store32(iter_base + 68, ptr222) + cleanup_list.push(ptr222) () } @@ -18088,48 +18122,48 @@ pub fn WasmRpc::wasm_rpc( () } - F64Type(payload221) => { + F64Type(payload223) => { mbt_ffi_store8(iter_base + 0, 11) - match payload221 { + match payload223 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload223) => { + Some(payload225) => { mbt_ffi_store8(iter_base + 8, 1) - match payload223.min { + match payload225.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload225) => { + Some(payload227) => { mbt_ffi_store8(iter_base + 16, 1) - match payload225 { - Signed(payload226) => { + match payload227 { + Signed(payload228) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload226) + mbt_ffi_store64(iter_base + 32, payload228) () } - Unsigned(payload227) => { + Unsigned(payload229) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload227.reinterpret_as_int64(), + payload229.reinterpret_as_int64(), ) () } - FloatBits(payload228) => { + FloatBits(payload230) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload228.reinterpret_as_int64(), + payload230.reinterpret_as_int64(), ) () @@ -18140,36 +18174,36 @@ pub fn WasmRpc::wasm_rpc( } } - match payload223.max { + match payload225.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload230) => { + Some(payload232) => { mbt_ffi_store8(iter_base + 40, 1) - match payload230 { - Signed(payload231) => { + match payload232 { + Signed(payload233) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload231) + mbt_ffi_store64(iter_base + 56, payload233) () } - Unsigned(payload232) => { + Unsigned(payload234) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload232.reinterpret_as_int64(), + payload234.reinterpret_as_int64(), ) () } - FloatBits(payload233) => { + FloatBits(payload235) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload233.reinterpret_as_int64(), + payload235.reinterpret_as_int64(), ) () @@ -18180,19 +18214,19 @@ pub fn WasmRpc::wasm_rpc( } } - match payload223.unit { + match payload225.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload235) => { + Some(payload237) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr236 = mbt_ffi_str2ptr(payload235) - mbt_ffi_store32(iter_base + 72, payload235.length()) - mbt_ffi_store32(iter_base + 68, ptr236) - cleanup_list.push(ptr236) + let ptr238 = mbt_ffi_str2ptr(payload237) + mbt_ffi_store32(iter_base + 72, payload237.length()) + mbt_ffi_store32(iter_base + 68, ptr238) + cleanup_list.push(ptr238) () } @@ -18214,19 +18248,19 @@ pub fn WasmRpc::wasm_rpc( () } - RecordType(payload239) => { + RecordType(payload241) => { mbt_ffi_store8(iter_base + 0, 14) - let address260 = mbt_ffi_malloc(payload239.length() * 68) - for index261 = 0 - index261 < payload239.length() - index261 = index261 + 1 { - let iter_elem : @types.NamedFieldType = payload239[index261] - let iter_base = address260 + index261 * 68 + let address262 = mbt_ffi_malloc(payload241.length() * 68) + for index263 = 0 + index263 < payload241.length() + index263 = index263 + 1 { + let iter_elem : @types.NamedFieldType = payload241[index263] + let iter_base = address262 + index263 * 68 - let ptr240 = mbt_ffi_str2ptr(iter_elem.name) + let ptr242 = mbt_ffi_str2ptr(iter_elem.name) mbt_ffi_store32(iter_base + 4, iter_elem.name.length()) - mbt_ffi_store32(iter_base + 0, ptr240) + mbt_ffi_store32(iter_base + 0, ptr242) mbt_ffi_store32(iter_base + 8, iter_elem.body) match iter_elem.metadata.doc { @@ -18235,54 +18269,54 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload242) => { + Some(payload244) => { mbt_ffi_store8(iter_base + 12, 1) - let ptr243 = mbt_ffi_str2ptr(payload242) - mbt_ffi_store32(iter_base + 20, payload242.length()) - mbt_ffi_store32(iter_base + 16, ptr243) - cleanup_list.push(ptr243) + let ptr245 = mbt_ffi_str2ptr(payload244) + mbt_ffi_store32(iter_base + 20, payload244.length()) + mbt_ffi_store32(iter_base + 16, ptr245) + cleanup_list.push(ptr245) () } } - let address245 = mbt_ffi_malloc( + let address247 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index246 = 0 - index246 < iter_elem.metadata.aliases.length() - index246 = index246 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index246] - let iter_base = address245 + index246 * 8 + for index248 = 0 + index248 < iter_elem.metadata.aliases.length() + index248 = index248 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index248] + let iter_base = address247 + index248 * 8 - let ptr244 = mbt_ffi_str2ptr(iter_elem) + let ptr246 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr244) - cleanup_list.push(ptr244) + mbt_ffi_store32(iter_base + 0, ptr246) + cleanup_list.push(ptr246) } mbt_ffi_store32(iter_base + 28, iter_elem.metadata.aliases.length()) - mbt_ffi_store32(iter_base + 24, address245) + mbt_ffi_store32(iter_base + 24, address247) - let address248 = mbt_ffi_malloc( + let address250 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index249 = 0 - index249 < iter_elem.metadata.examples.length() - index249 = index249 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index249] - let iter_base = address248 + index249 * 8 + for index251 = 0 + index251 < iter_elem.metadata.examples.length() + index251 = index251 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index251] + let iter_base = address250 + index251 * 8 - let ptr247 = mbt_ffi_str2ptr(iter_elem) + let ptr249 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr247) - cleanup_list.push(ptr247) + mbt_ffi_store32(iter_base + 0, ptr249) + cleanup_list.push(ptr249) } mbt_ffi_store32( iter_base + 36, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 32, address248) + mbt_ffi_store32(iter_base + 32, address250) match iter_elem.metadata.deprecated { None => { @@ -18290,13 +18324,13 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload251) => { + Some(payload253) => { mbt_ffi_store8(iter_base + 40, 1) - let ptr252 = mbt_ffi_str2ptr(payload251) - mbt_ffi_store32(iter_base + 48, payload251.length()) - mbt_ffi_store32(iter_base + 44, ptr252) - cleanup_list.push(ptr252) + let ptr254 = mbt_ffi_str2ptr(payload253) + mbt_ffi_store32(iter_base + 48, payload253.length()) + mbt_ffi_store32(iter_base + 44, ptr254) + cleanup_list.push(ptr254) () } @@ -18308,10 +18342,10 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload254) => { + Some(payload256) => { mbt_ffi_store8(iter_base + 52, 1) - match payload254 { + match payload256 { Multimodal => { mbt_ffi_store8(iter_base + 56, 0) @@ -18327,13 +18361,13 @@ pub fn WasmRpc::wasm_rpc( () } - Other(payload258) => { + Other(payload260) => { mbt_ffi_store8(iter_base + 56, 3) - let ptr259 = mbt_ffi_str2ptr(payload258) - mbt_ffi_store32(iter_base + 64, payload258.length()) - mbt_ffi_store32(iter_base + 60, ptr259) - cleanup_list.push(ptr259) + let ptr261 = mbt_ffi_str2ptr(payload260) + mbt_ffi_store32(iter_base + 64, payload260.length()) + mbt_ffi_store32(iter_base + 60, ptr261) + cleanup_list.push(ptr261) () } @@ -18342,29 +18376,29 @@ pub fn WasmRpc::wasm_rpc( () } } - cleanup_list.push(ptr240) - cleanup_list.push(address245) - cleanup_list.push(address248) + cleanup_list.push(ptr242) + cleanup_list.push(address247) + cleanup_list.push(address250) } - mbt_ffi_store32(iter_base + 12, payload239.length()) - mbt_ffi_store32(iter_base + 8, address260) - cleanup_list.push(address260) + mbt_ffi_store32(iter_base + 12, payload241.length()) + mbt_ffi_store32(iter_base + 8, address262) + cleanup_list.push(address262) () } - VariantType(payload262) => { + VariantType(payload264) => { mbt_ffi_store8(iter_base + 0, 15) - let address285 = mbt_ffi_malloc(payload262.length() * 72) - for index286 = 0 - index286 < payload262.length() - index286 = index286 + 1 { - let iter_elem : @types.VariantCaseType = payload262[index286] - let iter_base = address285 + index286 * 72 + let address287 = mbt_ffi_malloc(payload264.length() * 72) + for index288 = 0 + index288 < payload264.length() + index288 = index288 + 1 { + let iter_elem : @types.VariantCaseType = payload264[index288] + let iter_base = address287 + index288 * 72 - let ptr263 = mbt_ffi_str2ptr(iter_elem.name) + let ptr265 = mbt_ffi_str2ptr(iter_elem.name) mbt_ffi_store32(iter_base + 4, iter_elem.name.length()) - mbt_ffi_store32(iter_base + 0, ptr263) + mbt_ffi_store32(iter_base + 0, ptr265) match iter_elem.payload { None => { @@ -18372,9 +18406,9 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload265) => { + Some(payload267) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload265) + mbt_ffi_store32(iter_base + 12, payload267) () } @@ -18386,54 +18420,54 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload267) => { + Some(payload269) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr268 = mbt_ffi_str2ptr(payload267) - mbt_ffi_store32(iter_base + 24, payload267.length()) - mbt_ffi_store32(iter_base + 20, ptr268) - cleanup_list.push(ptr268) + let ptr270 = mbt_ffi_str2ptr(payload269) + mbt_ffi_store32(iter_base + 24, payload269.length()) + mbt_ffi_store32(iter_base + 20, ptr270) + cleanup_list.push(ptr270) () } } - let address270 = mbt_ffi_malloc( + let address272 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index271 = 0 - index271 < iter_elem.metadata.aliases.length() - index271 = index271 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index271] - let iter_base = address270 + index271 * 8 + for index273 = 0 + index273 < iter_elem.metadata.aliases.length() + index273 = index273 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index273] + let iter_base = address272 + index273 * 8 - let ptr269 = mbt_ffi_str2ptr(iter_elem) + let ptr271 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr269) - cleanup_list.push(ptr269) + mbt_ffi_store32(iter_base + 0, ptr271) + cleanup_list.push(ptr271) } mbt_ffi_store32(iter_base + 32, iter_elem.metadata.aliases.length()) - mbt_ffi_store32(iter_base + 28, address270) + mbt_ffi_store32(iter_base + 28, address272) - let address273 = mbt_ffi_malloc( + let address275 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index274 = 0 - index274 < iter_elem.metadata.examples.length() - index274 = index274 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index274] - let iter_base = address273 + index274 * 8 + for index276 = 0 + index276 < iter_elem.metadata.examples.length() + index276 = index276 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index276] + let iter_base = address275 + index276 * 8 - let ptr272 = mbt_ffi_str2ptr(iter_elem) + let ptr274 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr272) - cleanup_list.push(ptr272) + mbt_ffi_store32(iter_base + 0, ptr274) + cleanup_list.push(ptr274) } mbt_ffi_store32( iter_base + 40, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 36, address273) + mbt_ffi_store32(iter_base + 36, address275) match iter_elem.metadata.deprecated { None => { @@ -18441,13 +18475,13 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload276) => { + Some(payload278) => { mbt_ffi_store8(iter_base + 44, 1) - let ptr277 = mbt_ffi_str2ptr(payload276) - mbt_ffi_store32(iter_base + 52, payload276.length()) - mbt_ffi_store32(iter_base + 48, ptr277) - cleanup_list.push(ptr277) + let ptr279 = mbt_ffi_str2ptr(payload278) + mbt_ffi_store32(iter_base + 52, payload278.length()) + mbt_ffi_store32(iter_base + 48, ptr279) + cleanup_list.push(ptr279) () } @@ -18459,10 +18493,10 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload279) => { + Some(payload281) => { mbt_ffi_store8(iter_base + 56, 1) - match payload279 { + match payload281 { Multimodal => { mbt_ffi_store8(iter_base + 60, 0) @@ -18478,13 +18512,13 @@ pub fn WasmRpc::wasm_rpc( () } - Other(payload283) => { + Other(payload285) => { mbt_ffi_store8(iter_base + 60, 3) - let ptr284 = mbt_ffi_str2ptr(payload283) - mbt_ffi_store32(iter_base + 68, payload283.length()) - mbt_ffi_store32(iter_base + 64, ptr284) - cleanup_list.push(ptr284) + let ptr286 = mbt_ffi_str2ptr(payload285) + mbt_ffi_store32(iter_base + 68, payload285.length()) + mbt_ffi_store32(iter_base + 64, ptr286) + cleanup_list.push(ptr286) () } @@ -18493,130 +18527,130 @@ pub fn WasmRpc::wasm_rpc( () } } - cleanup_list.push(ptr263) - cleanup_list.push(address270) - cleanup_list.push(address273) + cleanup_list.push(ptr265) + cleanup_list.push(address272) + cleanup_list.push(address275) } - mbt_ffi_store32(iter_base + 12, payload262.length()) - mbt_ffi_store32(iter_base + 8, address285) - cleanup_list.push(address285) + mbt_ffi_store32(iter_base + 12, payload264.length()) + mbt_ffi_store32(iter_base + 8, address287) + cleanup_list.push(address287) () } - EnumType(payload287) => { + EnumType(payload289) => { mbt_ffi_store8(iter_base + 0, 16) - let address289 = mbt_ffi_malloc(payload287.length() * 8) - for index290 = 0 - index290 < payload287.length() - index290 = index290 + 1 { - let iter_elem : String = payload287[index290] - let iter_base = address289 + index290 * 8 + let address291 = mbt_ffi_malloc(payload289.length() * 8) + for index292 = 0 + index292 < payload289.length() + index292 = index292 + 1 { + let iter_elem : String = payload289[index292] + let iter_base = address291 + index292 * 8 - let ptr288 = mbt_ffi_str2ptr(iter_elem) + let ptr290 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr288) - cleanup_list.push(ptr288) + mbt_ffi_store32(iter_base + 0, ptr290) + cleanup_list.push(ptr290) } - mbt_ffi_store32(iter_base + 12, payload287.length()) - mbt_ffi_store32(iter_base + 8, address289) - cleanup_list.push(address289) + mbt_ffi_store32(iter_base + 12, payload289.length()) + mbt_ffi_store32(iter_base + 8, address291) + cleanup_list.push(address291) () } - FlagsType(payload291) => { + FlagsType(payload293) => { mbt_ffi_store8(iter_base + 0, 17) - let address293 = mbt_ffi_malloc(payload291.length() * 8) - for index294 = 0 - index294 < payload291.length() - index294 = index294 + 1 { - let iter_elem : String = payload291[index294] - let iter_base = address293 + index294 * 8 + let address295 = mbt_ffi_malloc(payload293.length() * 8) + for index296 = 0 + index296 < payload293.length() + index296 = index296 + 1 { + let iter_elem : String = payload293[index296] + let iter_base = address295 + index296 * 8 - let ptr292 = mbt_ffi_str2ptr(iter_elem) + let ptr294 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr292) - cleanup_list.push(ptr292) + mbt_ffi_store32(iter_base + 0, ptr294) + cleanup_list.push(ptr294) } - mbt_ffi_store32(iter_base + 12, payload291.length()) - mbt_ffi_store32(iter_base + 8, address293) - cleanup_list.push(address293) + mbt_ffi_store32(iter_base + 12, payload293.length()) + mbt_ffi_store32(iter_base + 8, address295) + cleanup_list.push(address295) () } - TupleType(payload295) => { + TupleType(payload297) => { mbt_ffi_store8(iter_base + 0, 18) - let address296 = mbt_ffi_malloc(payload295.length() * 4) - for index297 = 0 - index297 < payload295.length() - index297 = index297 + 1 { - let iter_elem : Int = payload295[index297] - let iter_base = address296 + index297 * 4 + let address298 = mbt_ffi_malloc(payload297.length() * 4) + for index299 = 0 + index299 < payload297.length() + index299 = index299 + 1 { + let iter_elem : Int = payload297[index299] + let iter_base = address298 + index299 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload295.length()) - mbt_ffi_store32(iter_base + 8, address296) - cleanup_list.push(address296) + mbt_ffi_store32(iter_base + 12, payload297.length()) + mbt_ffi_store32(iter_base + 8, address298) + cleanup_list.push(address298) () } - ListType(payload298) => { + ListType(payload300) => { mbt_ffi_store8(iter_base + 0, 19) - mbt_ffi_store32(iter_base + 8, payload298) + mbt_ffi_store32(iter_base + 8, payload300) () } - FixedListType(payload299) => { + FixedListType(payload301) => { mbt_ffi_store8(iter_base + 0, 20) - mbt_ffi_store32(iter_base + 8, payload299.element) + mbt_ffi_store32(iter_base + 8, payload301.element) mbt_ffi_store32( iter_base + 12, - payload299.length.reinterpret_as_int(), + payload301.length.reinterpret_as_int(), ) () } - MapType(payload300) => { + MapType(payload302) => { mbt_ffi_store8(iter_base + 0, 21) - mbt_ffi_store32(iter_base + 8, payload300.key) - mbt_ffi_store32(iter_base + 12, payload300.value) + mbt_ffi_store32(iter_base + 8, payload302.key) + mbt_ffi_store32(iter_base + 12, payload302.value) () } - OptionType(payload301) => { + OptionType(payload303) => { mbt_ffi_store8(iter_base + 0, 22) - mbt_ffi_store32(iter_base + 8, payload301) + mbt_ffi_store32(iter_base + 8, payload303) () } - ResultType(payload302) => { + ResultType(payload304) => { mbt_ffi_store8(iter_base + 0, 23) - match payload302.ok { + match payload304.ok { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload304) => { + Some(payload306) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload304) + mbt_ffi_store32(iter_base + 12, payload306) () } } - match payload302.err { + match payload304.err { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload306) => { + Some(payload308) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store32(iter_base + 20, payload306) + mbt_ffi_store32(iter_base + 20, payload308) () } @@ -18624,79 +18658,79 @@ pub fn WasmRpc::wasm_rpc( () } - TextType(payload307) => { + TextType(payload309) => { mbt_ffi_store8(iter_base + 0, 24) - match payload307.languages { + match payload309.languages { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload309) => { + Some(payload311) => { mbt_ffi_store8(iter_base + 8, 1) - let address311 = mbt_ffi_malloc(payload309.length() * 8) - for index312 = 0 - index312 < payload309.length() - index312 = index312 + 1 { - let iter_elem : String = payload309[index312] - let iter_base = address311 + index312 * 8 + let address313 = mbt_ffi_malloc(payload311.length() * 8) + for index314 = 0 + index314 < payload311.length() + index314 = index314 + 1 { + let iter_elem : String = payload311[index314] + let iter_base = address313 + index314 * 8 - let ptr310 = mbt_ffi_str2ptr(iter_elem) + let ptr312 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr310) - cleanup_list.push(ptr310) + mbt_ffi_store32(iter_base + 0, ptr312) + cleanup_list.push(ptr312) } - mbt_ffi_store32(iter_base + 16, payload309.length()) - mbt_ffi_store32(iter_base + 12, address311) - cleanup_list.push(address311) + mbt_ffi_store32(iter_base + 16, payload311.length()) + mbt_ffi_store32(iter_base + 12, address313) + cleanup_list.push(address313) () } } - match payload307.min_length { + match payload309.min_length { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload314) => { + Some(payload316) => { mbt_ffi_store8(iter_base + 20, 1) - mbt_ffi_store32(iter_base + 24, payload314.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 24, payload316.reinterpret_as_int()) () } } - match payload307.max_length { + match payload309.max_length { None => { mbt_ffi_store8(iter_base + 28, 0) () } - Some(payload316) => { + Some(payload318) => { mbt_ffi_store8(iter_base + 28, 1) - mbt_ffi_store32(iter_base + 32, payload316.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 32, payload318.reinterpret_as_int()) () } } - match payload307.regex { + match payload309.regex { None => { mbt_ffi_store8(iter_base + 36, 0) () } - Some(payload318) => { + Some(payload320) => { mbt_ffi_store8(iter_base + 36, 1) - let ptr319 = mbt_ffi_str2ptr(payload318) - mbt_ffi_store32(iter_base + 44, payload318.length()) - mbt_ffi_store32(iter_base + 40, ptr319) - cleanup_list.push(ptr319) + let ptr321 = mbt_ffi_str2ptr(payload320) + mbt_ffi_store32(iter_base + 44, payload320.length()) + mbt_ffi_store32(iter_base + 40, ptr321) + cleanup_list.push(ptr321) () } @@ -18704,61 +18738,61 @@ pub fn WasmRpc::wasm_rpc( () } - BinaryType(payload320) => { + BinaryType(payload322) => { mbt_ffi_store8(iter_base + 0, 25) - match payload320.mime_types { + match payload322.mime_types { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload322) => { + Some(payload324) => { mbt_ffi_store8(iter_base + 8, 1) - let address324 = mbt_ffi_malloc(payload322.length() * 8) - for index325 = 0 - index325 < payload322.length() - index325 = index325 + 1 { - let iter_elem : String = payload322[index325] - let iter_base = address324 + index325 * 8 + let address326 = mbt_ffi_malloc(payload324.length() * 8) + for index327 = 0 + index327 < payload324.length() + index327 = index327 + 1 { + let iter_elem : String = payload324[index327] + let iter_base = address326 + index327 * 8 - let ptr323 = mbt_ffi_str2ptr(iter_elem) + let ptr325 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr323) - cleanup_list.push(ptr323) + mbt_ffi_store32(iter_base + 0, ptr325) + cleanup_list.push(ptr325) } - mbt_ffi_store32(iter_base + 16, payload322.length()) - mbt_ffi_store32(iter_base + 12, address324) - cleanup_list.push(address324) + mbt_ffi_store32(iter_base + 16, payload324.length()) + mbt_ffi_store32(iter_base + 12, address326) + cleanup_list.push(address326) () } } - match payload320.min_bytes { + match payload322.min_bytes { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload327) => { + Some(payload329) => { mbt_ffi_store8(iter_base + 20, 1) - mbt_ffi_store32(iter_base + 24, payload327.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 24, payload329.reinterpret_as_int()) () } } - match payload320.max_bytes { + match payload322.max_bytes { None => { mbt_ffi_store8(iter_base + 28, 0) () } - Some(payload329) => { + Some(payload331) => { mbt_ffi_store8(iter_base + 28, 1) - mbt_ffi_store32(iter_base + 32, payload329.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 32, payload331.reinterpret_as_int()) () } @@ -18766,64 +18800,64 @@ pub fn WasmRpc::wasm_rpc( () } - PathType(payload330) => { + PathType(payload332) => { mbt_ffi_store8(iter_base + 0, 26) - mbt_ffi_store8(iter_base + 8, payload330.direction.ordinal()) - mbt_ffi_store8(iter_base + 9, payload330.kind.ordinal()) + mbt_ffi_store8(iter_base + 8, payload332.direction.ordinal()) + mbt_ffi_store8(iter_base + 9, payload332.kind.ordinal()) - match payload330.allowed_mime_types { + match payload332.allowed_mime_types { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload332) => { + Some(payload334) => { mbt_ffi_store8(iter_base + 12, 1) - let address334 = mbt_ffi_malloc(payload332.length() * 8) - for index335 = 0 - index335 < payload332.length() - index335 = index335 + 1 { - let iter_elem : String = payload332[index335] - let iter_base = address334 + index335 * 8 + let address336 = mbt_ffi_malloc(payload334.length() * 8) + for index337 = 0 + index337 < payload334.length() + index337 = index337 + 1 { + let iter_elem : String = payload334[index337] + let iter_base = address336 + index337 * 8 - let ptr333 = mbt_ffi_str2ptr(iter_elem) + let ptr335 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr333) - cleanup_list.push(ptr333) + mbt_ffi_store32(iter_base + 0, ptr335) + cleanup_list.push(ptr335) } - mbt_ffi_store32(iter_base + 20, payload332.length()) - mbt_ffi_store32(iter_base + 16, address334) - cleanup_list.push(address334) + mbt_ffi_store32(iter_base + 20, payload334.length()) + mbt_ffi_store32(iter_base + 16, address336) + cleanup_list.push(address336) () } } - match payload330.allowed_extensions { + match payload332.allowed_extensions { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload337) => { + Some(payload339) => { mbt_ffi_store8(iter_base + 24, 1) - let address339 = mbt_ffi_malloc(payload337.length() * 8) - for index340 = 0 - index340 < payload337.length() - index340 = index340 + 1 { - let iter_elem : String = payload337[index340] - let iter_base = address339 + index340 * 8 + let address341 = mbt_ffi_malloc(payload339.length() * 8) + for index342 = 0 + index342 < payload339.length() + index342 = index342 + 1 { + let iter_elem : String = payload339[index342] + let iter_base = address341 + index342 * 8 - let ptr338 = mbt_ffi_str2ptr(iter_elem) + let ptr340 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr338) - cleanup_list.push(ptr338) + mbt_ffi_store32(iter_base + 0, ptr340) + cleanup_list.push(ptr340) } - mbt_ffi_store32(iter_base + 32, payload337.length()) - mbt_ffi_store32(iter_base + 28, address339) - cleanup_list.push(address339) + mbt_ffi_store32(iter_base + 32, payload339.length()) + mbt_ffi_store32(iter_base + 28, address341) + cleanup_list.push(address341) () } @@ -18831,62 +18865,62 @@ pub fn WasmRpc::wasm_rpc( () } - UrlType(payload341) => { + UrlType(payload343) => { mbt_ffi_store8(iter_base + 0, 27) - match payload341.allowed_schemes { + match payload343.allowed_schemes { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload343) => { + Some(payload345) => { mbt_ffi_store8(iter_base + 8, 1) - let address345 = mbt_ffi_malloc(payload343.length() * 8) - for index346 = 0 - index346 < payload343.length() - index346 = index346 + 1 { - let iter_elem : String = payload343[index346] - let iter_base = address345 + index346 * 8 + let address347 = mbt_ffi_malloc(payload345.length() * 8) + for index348 = 0 + index348 < payload345.length() + index348 = index348 + 1 { + let iter_elem : String = payload345[index348] + let iter_base = address347 + index348 * 8 - let ptr344 = mbt_ffi_str2ptr(iter_elem) + let ptr346 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr344) - cleanup_list.push(ptr344) + mbt_ffi_store32(iter_base + 0, ptr346) + cleanup_list.push(ptr346) } - mbt_ffi_store32(iter_base + 16, payload343.length()) - mbt_ffi_store32(iter_base + 12, address345) - cleanup_list.push(address345) + mbt_ffi_store32(iter_base + 16, payload345.length()) + mbt_ffi_store32(iter_base + 12, address347) + cleanup_list.push(address347) () } } - match payload341.allowed_hosts { + match payload343.allowed_hosts { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload348) => { + Some(payload350) => { mbt_ffi_store8(iter_base + 20, 1) - let address350 = mbt_ffi_malloc(payload348.length() * 8) - for index351 = 0 - index351 < payload348.length() - index351 = index351 + 1 { - let iter_elem : String = payload348[index351] - let iter_base = address350 + index351 * 8 + let address352 = mbt_ffi_malloc(payload350.length() * 8) + for index353 = 0 + index353 < payload350.length() + index353 = index353 + 1 { + let iter_elem : String = payload350[index353] + let iter_base = address352 + index353 * 8 - let ptr349 = mbt_ffi_str2ptr(iter_elem) + let ptr351 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr349) - cleanup_list.push(ptr349) + mbt_ffi_store32(iter_base + 0, ptr351) + cleanup_list.push(ptr351) } - mbt_ffi_store32(iter_base + 28, payload348.length()) - mbt_ffi_store32(iter_base + 24, address350) - cleanup_list.push(address350) + mbt_ffi_store32(iter_base + 28, payload350.length()) + mbt_ffi_store32(iter_base + 24, address352) + cleanup_list.push(address352) () } @@ -18904,103 +18938,93 @@ pub fn WasmRpc::wasm_rpc( () } - QuantityType(payload354) => { + QuantityType(payload356) => { mbt_ffi_store8(iter_base + 0, 30) - let ptr355 = mbt_ffi_str2ptr(payload354.base_unit) - mbt_ffi_store32(iter_base + 12, payload354.base_unit.length()) - mbt_ffi_store32(iter_base + 8, ptr355) + let ptr357 = mbt_ffi_str2ptr(payload356.base_unit) + mbt_ffi_store32(iter_base + 12, payload356.base_unit.length()) + mbt_ffi_store32(iter_base + 8, ptr357) - let address357 = mbt_ffi_malloc( - payload354.allowed_suffixes.length() * 8, + let address359 = mbt_ffi_malloc( + payload356.allowed_suffixes.length() * 8, ) - for index358 = 0 - index358 < payload354.allowed_suffixes.length() - index358 = index358 + 1 { - let iter_elem : String = payload354.allowed_suffixes[index358] - let iter_base = address357 + index358 * 8 + for index360 = 0 + index360 < payload356.allowed_suffixes.length() + index360 = index360 + 1 { + let iter_elem : String = payload356.allowed_suffixes[index360] + let iter_base = address359 + index360 * 8 - let ptr356 = mbt_ffi_str2ptr(iter_elem) + let ptr358 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr356) - cleanup_list.push(ptr356) + mbt_ffi_store32(iter_base + 0, ptr358) + cleanup_list.push(ptr358) } - mbt_ffi_store32(iter_base + 20, payload354.allowed_suffixes.length()) - mbt_ffi_store32(iter_base + 16, address357) + mbt_ffi_store32(iter_base + 20, payload356.allowed_suffixes.length()) + mbt_ffi_store32(iter_base + 16, address359) - match payload354.min { + match payload356.min { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload360) => { + Some(payload362) => { mbt_ffi_store8(iter_base + 24, 1) - mbt_ffi_store64(iter_base + 32, payload360.mantissa) - mbt_ffi_store32(iter_base + 40, payload360.scale) + mbt_ffi_store64(iter_base + 32, payload362.mantissa) + mbt_ffi_store32(iter_base + 40, payload362.scale) - let ptr361 = mbt_ffi_str2ptr(payload360.unit) - mbt_ffi_store32(iter_base + 48, payload360.unit.length()) - mbt_ffi_store32(iter_base + 44, ptr361) - cleanup_list.push(ptr361) + let ptr363 = mbt_ffi_str2ptr(payload362.unit) + mbt_ffi_store32(iter_base + 48, payload362.unit.length()) + mbt_ffi_store32(iter_base + 44, ptr363) + cleanup_list.push(ptr363) () } } - match payload354.max { + match payload356.max { None => { mbt_ffi_store8(iter_base + 56, 0) () } - Some(payload363) => { + Some(payload365) => { mbt_ffi_store8(iter_base + 56, 1) - mbt_ffi_store64(iter_base + 64, payload363.mantissa) - mbt_ffi_store32(iter_base + 72, payload363.scale) + mbt_ffi_store64(iter_base + 64, payload365.mantissa) + mbt_ffi_store32(iter_base + 72, payload365.scale) - let ptr364 = mbt_ffi_str2ptr(payload363.unit) - mbt_ffi_store32(iter_base + 80, payload363.unit.length()) - mbt_ffi_store32(iter_base + 76, ptr364) - cleanup_list.push(ptr364) + let ptr366 = mbt_ffi_str2ptr(payload365.unit) + mbt_ffi_store32(iter_base + 80, payload365.unit.length()) + mbt_ffi_store32(iter_base + 76, ptr366) + cleanup_list.push(ptr366) () } } - cleanup_list.push(ptr355) - cleanup_list.push(address357) + cleanup_list.push(ptr357) + cleanup_list.push(address359) () } - UnionType(payload365) => { + UnionType(payload367) => { mbt_ffi_store8(iter_base + 0, 31) - let address401 = mbt_ffi_malloc(payload365.branches.length() * 92) - for index402 = 0 - index402 < payload365.branches.length() - index402 = index402 + 1 { - let iter_elem : @types.UnionBranch = payload365.branches[index402] - let iter_base = address401 + index402 * 92 + let address403 = mbt_ffi_malloc(payload367.branches.length() * 92) + for index404 = 0 + index404 < payload367.branches.length() + index404 = index404 + 1 { + let iter_elem : @types.UnionBranch = payload367.branches[index404] + let iter_base = address403 + index404 * 92 - let ptr366 = mbt_ffi_str2ptr(iter_elem.tag) + let ptr368 = mbt_ffi_str2ptr(iter_elem.tag) mbt_ffi_store32(iter_base + 4, iter_elem.tag.length()) - mbt_ffi_store32(iter_base + 0, ptr366) + mbt_ffi_store32(iter_base + 0, ptr368) mbt_ffi_store32(iter_base + 8, iter_elem.body) match iter_elem.discriminator { - Prefix(payload367) => { + Prefix(payload369) => { mbt_ffi_store8(iter_base + 12, 0) - let ptr368 = mbt_ffi_str2ptr(payload367) - mbt_ffi_store32(iter_base + 20, payload367.length()) - mbt_ffi_store32(iter_base + 16, ptr368) - cleanup_list.push(ptr368) - - () - } - Suffix(payload369) => { - mbt_ffi_store8(iter_base + 12, 1) - let ptr370 = mbt_ffi_str2ptr(payload369) mbt_ffi_store32(iter_base + 20, payload369.length()) mbt_ffi_store32(iter_base + 16, ptr370) @@ -19008,8 +19032,8 @@ pub fn WasmRpc::wasm_rpc( () } - Contains(payload371) => { - mbt_ffi_store8(iter_base + 12, 2) + Suffix(payload371) => { + mbt_ffi_store8(iter_base + 12, 1) let ptr372 = mbt_ffi_str2ptr(payload371) mbt_ffi_store32(iter_base + 20, payload371.length()) @@ -19018,8 +19042,8 @@ pub fn WasmRpc::wasm_rpc( () } - Regex(payload373) => { - mbt_ffi_store8(iter_base + 12, 3) + Contains(payload373) => { + mbt_ffi_store8(iter_base + 12, 2) let ptr374 = mbt_ffi_str2ptr(payload373) mbt_ffi_store32(iter_base + 20, payload373.length()) @@ -19028,41 +19052,51 @@ pub fn WasmRpc::wasm_rpc( () } - FieldEquals(payload375) => { - mbt_ffi_store8(iter_base + 12, 4) + Regex(payload375) => { + mbt_ffi_store8(iter_base + 12, 3) - let ptr376 = mbt_ffi_str2ptr(payload375.field_name) - mbt_ffi_store32(iter_base + 20, payload375.field_name.length()) + let ptr376 = mbt_ffi_str2ptr(payload375) + mbt_ffi_store32(iter_base + 20, payload375.length()) mbt_ffi_store32(iter_base + 16, ptr376) + cleanup_list.push(ptr376) + + () + } + FieldEquals(payload377) => { + mbt_ffi_store8(iter_base + 12, 4) + + let ptr378 = mbt_ffi_str2ptr(payload377.field_name) + mbt_ffi_store32(iter_base + 20, payload377.field_name.length()) + mbt_ffi_store32(iter_base + 16, ptr378) - match payload375.literal { + match payload377.literal { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload378) => { + Some(payload380) => { mbt_ffi_store8(iter_base + 24, 1) - let ptr379 = mbt_ffi_str2ptr(payload378) - mbt_ffi_store32(iter_base + 32, payload378.length()) - mbt_ffi_store32(iter_base + 28, ptr379) - cleanup_list.push(ptr379) + let ptr381 = mbt_ffi_str2ptr(payload380) + mbt_ffi_store32(iter_base + 32, payload380.length()) + mbt_ffi_store32(iter_base + 28, ptr381) + cleanup_list.push(ptr381) () } } - cleanup_list.push(ptr376) + cleanup_list.push(ptr378) () } - FieldAbsent(payload380) => { + FieldAbsent(payload382) => { mbt_ffi_store8(iter_base + 12, 5) - let ptr381 = mbt_ffi_str2ptr(payload380) - mbt_ffi_store32(iter_base + 20, payload380.length()) - mbt_ffi_store32(iter_base + 16, ptr381) - cleanup_list.push(ptr381) + let ptr383 = mbt_ffi_str2ptr(payload382) + mbt_ffi_store32(iter_base + 20, payload382.length()) + mbt_ffi_store32(iter_base + 16, ptr383) + cleanup_list.push(ptr383) () } @@ -19074,54 +19108,54 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload383) => { + Some(payload385) => { mbt_ffi_store8(iter_base + 36, 1) - let ptr384 = mbt_ffi_str2ptr(payload383) - mbt_ffi_store32(iter_base + 44, payload383.length()) - mbt_ffi_store32(iter_base + 40, ptr384) - cleanup_list.push(ptr384) + let ptr386 = mbt_ffi_str2ptr(payload385) + mbt_ffi_store32(iter_base + 44, payload385.length()) + mbt_ffi_store32(iter_base + 40, ptr386) + cleanup_list.push(ptr386) () } } - let address386 = mbt_ffi_malloc( + let address388 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index387 = 0 - index387 < iter_elem.metadata.aliases.length() - index387 = index387 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index387] - let iter_base = address386 + index387 * 8 + for index389 = 0 + index389 < iter_elem.metadata.aliases.length() + index389 = index389 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index389] + let iter_base = address388 + index389 * 8 - let ptr385 = mbt_ffi_str2ptr(iter_elem) + let ptr387 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr385) - cleanup_list.push(ptr385) + mbt_ffi_store32(iter_base + 0, ptr387) + cleanup_list.push(ptr387) } mbt_ffi_store32(iter_base + 52, iter_elem.metadata.aliases.length()) - mbt_ffi_store32(iter_base + 48, address386) + mbt_ffi_store32(iter_base + 48, address388) - let address389 = mbt_ffi_malloc( + let address391 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index390 = 0 - index390 < iter_elem.metadata.examples.length() - index390 = index390 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index390] - let iter_base = address389 + index390 * 8 + for index392 = 0 + index392 < iter_elem.metadata.examples.length() + index392 = index392 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index392] + let iter_base = address391 + index392 * 8 - let ptr388 = mbt_ffi_str2ptr(iter_elem) + let ptr390 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr388) - cleanup_list.push(ptr388) + mbt_ffi_store32(iter_base + 0, ptr390) + cleanup_list.push(ptr390) } mbt_ffi_store32( iter_base + 60, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 56, address389) + mbt_ffi_store32(iter_base + 56, address391) match iter_elem.metadata.deprecated { None => { @@ -19129,13 +19163,13 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload392) => { + Some(payload394) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr393 = mbt_ffi_str2ptr(payload392) - mbt_ffi_store32(iter_base + 72, payload392.length()) - mbt_ffi_store32(iter_base + 68, ptr393) - cleanup_list.push(ptr393) + let ptr395 = mbt_ffi_str2ptr(payload394) + mbt_ffi_store32(iter_base + 72, payload394.length()) + mbt_ffi_store32(iter_base + 68, ptr395) + cleanup_list.push(ptr395) () } @@ -19147,10 +19181,10 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload395) => { + Some(payload397) => { mbt_ffi_store8(iter_base + 76, 1) - match payload395 { + match payload397 { Multimodal => { mbt_ffi_store8(iter_base + 80, 0) @@ -19166,13 +19200,13 @@ pub fn WasmRpc::wasm_rpc( () } - Other(payload399) => { + Other(payload401) => { mbt_ffi_store8(iter_base + 80, 3) - let ptr400 = mbt_ffi_str2ptr(payload399) - mbt_ffi_store32(iter_base + 88, payload399.length()) - mbt_ffi_store32(iter_base + 84, ptr400) - cleanup_list.push(ptr400) + let ptr402 = mbt_ffi_str2ptr(payload401) + mbt_ffi_store32(iter_base + 88, payload401.length()) + mbt_ffi_store32(iter_base + 84, ptr402) + cleanup_list.push(ptr402) () } @@ -19181,33 +19215,33 @@ pub fn WasmRpc::wasm_rpc( () } } - cleanup_list.push(ptr366) - cleanup_list.push(address386) - cleanup_list.push(address389) + cleanup_list.push(ptr368) + cleanup_list.push(address388) + cleanup_list.push(address391) } - mbt_ffi_store32(iter_base + 12, payload365.branches.length()) - mbt_ffi_store32(iter_base + 8, address401) - cleanup_list.push(address401) + mbt_ffi_store32(iter_base + 12, payload367.branches.length()) + mbt_ffi_store32(iter_base + 8, address403) + cleanup_list.push(address403) () } - SecretType(payload403) => { + SecretType(payload405) => { mbt_ffi_store8(iter_base + 0, 32) - mbt_ffi_store32(iter_base + 8, payload403.inner) + mbt_ffi_store32(iter_base + 8, payload405.inner) - match payload403.category { + match payload405.category { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload405) => { + Some(payload407) => { mbt_ffi_store8(iter_base + 12, 1) - let ptr406 = mbt_ffi_str2ptr(payload405) - mbt_ffi_store32(iter_base + 20, payload405.length()) - mbt_ffi_store32(iter_base + 16, ptr406) - cleanup_list.push(ptr406) + let ptr408 = mbt_ffi_str2ptr(payload407) + mbt_ffi_store32(iter_base + 20, payload407.length()) + mbt_ffi_store32(iter_base + 16, ptr408) + cleanup_list.push(ptr408) () } @@ -19215,22 +19249,22 @@ pub fn WasmRpc::wasm_rpc( () } - QuotaTokenType(payload407) => { + QuotaTokenType(payload409) => { mbt_ffi_store8(iter_base + 0, 33) - match payload407.resource_name { + match payload409.resource_name { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload409) => { + Some(payload411) => { mbt_ffi_store8(iter_base + 8, 1) - let ptr410 = mbt_ffi_str2ptr(payload409) - mbt_ffi_store32(iter_base + 16, payload409.length()) - mbt_ffi_store32(iter_base + 12, ptr410) - cleanup_list.push(ptr410) + let ptr412 = mbt_ffi_str2ptr(payload411) + mbt_ffi_store32(iter_base + 16, payload411.length()) + mbt_ffi_store32(iter_base + 12, ptr412) + cleanup_list.push(ptr412) () } @@ -19238,18 +19272,18 @@ pub fn WasmRpc::wasm_rpc( () } - FutureType(payload411) => { + FutureType(payload413) => { mbt_ffi_store8(iter_base + 0, 34) - match payload411 { + match payload413 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload413) => { + Some(payload415) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload413) + mbt_ffi_store32(iter_base + 12, payload415) () } @@ -19257,18 +19291,18 @@ pub fn WasmRpc::wasm_rpc( () } - StreamType(payload414) => { + StreamType(payload416) => { mbt_ffi_store8(iter_base + 0, 35) - match payload414 { + match payload416 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload416) => { + Some(payload418) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload416) + mbt_ffi_store32(iter_base + 12, payload418) () } @@ -19284,47 +19318,47 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload418) => { + Some(payload420) => { mbt_ffi_store8(iter_base + 88, 1) - let ptr419 = mbt_ffi_str2ptr(payload418) - mbt_ffi_store32(iter_base + 96, payload418.length()) - mbt_ffi_store32(iter_base + 92, ptr419) - cleanup_list.push(ptr419) + let ptr421 = mbt_ffi_str2ptr(payload420) + mbt_ffi_store32(iter_base + 96, payload420.length()) + mbt_ffi_store32(iter_base + 92, ptr421) + cleanup_list.push(ptr421) () } } - let address421 = mbt_ffi_malloc(iter_elem.metadata.aliases.length() * 8) - for index422 = 0 - index422 < iter_elem.metadata.aliases.length() - index422 = index422 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index422] - let iter_base = address421 + index422 * 8 + let address423 = mbt_ffi_malloc(iter_elem.metadata.aliases.length() * 8) + for index424 = 0 + index424 < iter_elem.metadata.aliases.length() + index424 = index424 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index424] + let iter_base = address423 + index424 * 8 - let ptr420 = mbt_ffi_str2ptr(iter_elem) + let ptr422 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr420) - cleanup_list.push(ptr420) + mbt_ffi_store32(iter_base + 0, ptr422) + cleanup_list.push(ptr422) } mbt_ffi_store32(iter_base + 104, iter_elem.metadata.aliases.length()) - mbt_ffi_store32(iter_base + 100, address421) + mbt_ffi_store32(iter_base + 100, address423) - let address424 = mbt_ffi_malloc(iter_elem.metadata.examples.length() * 8) - for index425 = 0 - index425 < iter_elem.metadata.examples.length() - index425 = index425 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index425] - let iter_base = address424 + index425 * 8 + let address426 = mbt_ffi_malloc(iter_elem.metadata.examples.length() * 8) + for index427 = 0 + index427 < iter_elem.metadata.examples.length() + index427 = index427 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index427] + let iter_base = address426 + index427 * 8 - let ptr423 = mbt_ffi_str2ptr(iter_elem) + let ptr425 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr423) - cleanup_list.push(ptr423) + mbt_ffi_store32(iter_base + 0, ptr425) + cleanup_list.push(ptr425) } mbt_ffi_store32(iter_base + 112, iter_elem.metadata.examples.length()) - mbt_ffi_store32(iter_base + 108, address424) + mbt_ffi_store32(iter_base + 108, address426) match iter_elem.metadata.deprecated { None => { @@ -19332,13 +19366,13 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload427) => { + Some(payload429) => { mbt_ffi_store8(iter_base + 116, 1) - let ptr428 = mbt_ffi_str2ptr(payload427) - mbt_ffi_store32(iter_base + 124, payload427.length()) - mbt_ffi_store32(iter_base + 120, ptr428) - cleanup_list.push(ptr428) + let ptr430 = mbt_ffi_str2ptr(payload429) + mbt_ffi_store32(iter_base + 124, payload429.length()) + mbt_ffi_store32(iter_base + 120, ptr430) + cleanup_list.push(ptr430) () } @@ -19350,10 +19384,10 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload430) => { + Some(payload432) => { mbt_ffi_store8(iter_base + 128, 1) - match payload430 { + match payload432 { Multimodal => { mbt_ffi_store8(iter_base + 132, 0) @@ -19369,13 +19403,13 @@ pub fn WasmRpc::wasm_rpc( () } - Other(payload434) => { + Other(payload436) => { mbt_ffi_store8(iter_base + 132, 3) - let ptr435 = mbt_ffi_str2ptr(payload434) - mbt_ffi_store32(iter_base + 140, payload434.length()) - mbt_ffi_store32(iter_base + 136, ptr435) - cleanup_list.push(ptr435) + let ptr437 = mbt_ffi_str2ptr(payload436) + mbt_ffi_store32(iter_base + 140, payload436.length()) + mbt_ffi_store32(iter_base + 136, ptr437) + cleanup_list.push(ptr437) () } @@ -19384,22 +19418,22 @@ pub fn WasmRpc::wasm_rpc( () } } - cleanup_list.push(address421) - cleanup_list.push(address424) + cleanup_list.push(address423) + cleanup_list.push(address426) } mbt_ffi_store32(iter_base + 12, iter_elem.value.graph.type_nodes.length()) - mbt_ffi_store32(iter_base + 8, address436) + mbt_ffi_store32(iter_base + 8, address438) - let address442 = mbt_ffi_malloc(iter_elem.value.graph.defs.length() * 24) - for index443 = 0 - index443 < iter_elem.value.graph.defs.length() - index443 = index443 + 1 { - let iter_elem : @types.SchemaTypeDef = iter_elem.value.graph.defs[index443] - let iter_base = address442 + index443 * 24 + let address444 = mbt_ffi_malloc(iter_elem.value.graph.defs.length() * 24) + for index445 = 0 + index445 < iter_elem.value.graph.defs.length() + index445 = index445 + 1 { + let iter_elem : @types.SchemaTypeDef = iter_elem.value.graph.defs[index445] + let iter_base = address444 + index445 * 24 - let ptr438 = mbt_ffi_str2ptr(iter_elem.id) + let ptr440 = mbt_ffi_str2ptr(iter_elem.id) mbt_ffi_store32(iter_base + 4, iter_elem.id.length()) - mbt_ffi_store32(iter_base + 0, ptr438) + mbt_ffi_store32(iter_base + 0, ptr440) match iter_elem.name { None => { @@ -19407,146 +19441,146 @@ pub fn WasmRpc::wasm_rpc( () } - Some(payload440) => { + Some(payload442) => { mbt_ffi_store8(iter_base + 8, 1) - let ptr441 = mbt_ffi_str2ptr(payload440) - mbt_ffi_store32(iter_base + 16, payload440.length()) - mbt_ffi_store32(iter_base + 12, ptr441) - cleanup_list.push(ptr441) + let ptr443 = mbt_ffi_str2ptr(payload442) + mbt_ffi_store32(iter_base + 16, payload442.length()) + mbt_ffi_store32(iter_base + 12, ptr443) + cleanup_list.push(ptr443) () } } mbt_ffi_store32(iter_base + 20, iter_elem.body) - cleanup_list.push(ptr438) + cleanup_list.push(ptr440) } mbt_ffi_store32(iter_base + 20, iter_elem.value.graph.defs.length()) - mbt_ffi_store32(iter_base + 16, address442) + mbt_ffi_store32(iter_base + 16, address444) mbt_ffi_store32(iter_base + 24, iter_elem.value.graph.root) - let address514 = mbt_ffi_malloc( + let address518 = mbt_ffi_malloc( iter_elem.value.value.value_nodes.length() * 32, ) - for index515 = 0 - index515 < iter_elem.value.value.value_nodes.length() - index515 = index515 + 1 { - let iter_elem : @types.SchemaValueNode = iter_elem.value.value.value_nodes[index515] - let iter_base = address514 + index515 * 32 + for index519 = 0 + index519 < iter_elem.value.value.value_nodes.length() + index519 = index519 + 1 { + let iter_elem : @types.SchemaValueNode = iter_elem.value.value.value_nodes[index519] + let iter_base = address518 + index519 * 32 match iter_elem { - BoolValue(payload444) => { + BoolValue(payload446) => { mbt_ffi_store8(iter_base + 0, 0) - mbt_ffi_store8(iter_base + 8, if payload444 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 8, if payload446 { 1 } else { 0 }) () } - S8Value(payload445) => { + S8Value(payload447) => { mbt_ffi_store8(iter_base + 0, 1) - mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload445)) + mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload447)) () } - S16Value(payload446) => { + S16Value(payload448) => { mbt_ffi_store8(iter_base + 0, 2) - mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload446)) + mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload448)) () } - S32Value(payload447) => { + S32Value(payload449) => { mbt_ffi_store8(iter_base + 0, 3) - mbt_ffi_store32(iter_base + 8, payload447) + mbt_ffi_store32(iter_base + 8, payload449) () } - S64Value(payload448) => { + S64Value(payload450) => { mbt_ffi_store8(iter_base + 0, 4) - mbt_ffi_store64(iter_base + 8, payload448) + mbt_ffi_store64(iter_base + 8, payload450) () } - U8Value(payload449) => { + U8Value(payload451) => { mbt_ffi_store8(iter_base + 0, 5) - mbt_ffi_store8(iter_base + 8, payload449.to_int()) + mbt_ffi_store8(iter_base + 8, payload451.to_int()) () } - U16Value(payload450) => { + U16Value(payload452) => { mbt_ffi_store8(iter_base + 0, 6) - mbt_ffi_store16(iter_base + 8, payload450.reinterpret_as_int()) + mbt_ffi_store16(iter_base + 8, payload452.reinterpret_as_int()) () } - U32Value(payload451) => { + U32Value(payload453) => { mbt_ffi_store8(iter_base + 0, 7) - mbt_ffi_store32(iter_base + 8, payload451.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 8, payload453.reinterpret_as_int()) () } - U64Value(payload452) => { + U64Value(payload454) => { mbt_ffi_store8(iter_base + 0, 8) - mbt_ffi_store64(iter_base + 8, payload452.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 8, payload454.reinterpret_as_int64()) () } - F32Value(payload453) => { + F32Value(payload455) => { mbt_ffi_store8(iter_base + 0, 9) - mbt_ffi_storef32(iter_base + 8, payload453) + mbt_ffi_storef32(iter_base + 8, payload455) () } - F64Value(payload454) => { + F64Value(payload456) => { mbt_ffi_store8(iter_base + 0, 10) - mbt_ffi_storef64(iter_base + 8, payload454) + mbt_ffi_storef64(iter_base + 8, payload456) () } - CharValue(payload455) => { + CharValue(payload457) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload455.to_int()) + mbt_ffi_store32(iter_base + 8, payload457.to_int()) () } - StringValue(payload456) => { + StringValue(payload458) => { mbt_ffi_store8(iter_base + 0, 12) - let ptr457 = mbt_ffi_str2ptr(payload456) - mbt_ffi_store32(iter_base + 12, payload456.length()) - mbt_ffi_store32(iter_base + 8, ptr457) - cleanup_list.push(ptr457) + let ptr459 = mbt_ffi_str2ptr(payload458) + mbt_ffi_store32(iter_base + 12, payload458.length()) + mbt_ffi_store32(iter_base + 8, ptr459) + cleanup_list.push(ptr459) () } - RecordValue(payload458) => { + RecordValue(payload460) => { mbt_ffi_store8(iter_base + 0, 13) - let address459 = mbt_ffi_malloc(payload458.length() * 4) - for index460 = 0 - index460 < payload458.length() - index460 = index460 + 1 { - let iter_elem : Int = payload458[index460] - let iter_base = address459 + index460 * 4 + let address461 = mbt_ffi_malloc(payload460.length() * 4) + for index462 = 0 + index462 < payload460.length() + index462 = index462 + 1 { + let iter_elem : Int = payload460[index462] + let iter_base = address461 + index462 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload458.length()) - mbt_ffi_store32(iter_base + 8, address459) - cleanup_list.push(address459) + mbt_ffi_store32(iter_base + 12, payload460.length()) + mbt_ffi_store32(iter_base + 8, address461) + cleanup_list.push(address461) () } - VariantValue(payload461) => { + VariantValue(payload463) => { mbt_ffi_store8(iter_base + 0, 14) - mbt_ffi_store32(iter_base + 8, payload461.case.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 8, payload463.case.reinterpret_as_int()) - match payload461.payload { + match payload463.payload { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload463) => { + Some(payload465) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload463) + mbt_ffi_store32(iter_base + 16, payload465) () } @@ -19554,110 +19588,110 @@ pub fn WasmRpc::wasm_rpc( () } - EnumValue(payload464) => { + EnumValue(payload466) => { mbt_ffi_store8(iter_base + 0, 15) - mbt_ffi_store32(iter_base + 8, payload464.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 8, payload466.reinterpret_as_int()) () } - FlagsValue(payload465) => { + FlagsValue(payload467) => { mbt_ffi_store8(iter_base + 0, 16) - let address466 = mbt_ffi_malloc(payload465.length() * 1) - for index467 = 0 - index467 < payload465.length() - index467 = index467 + 1 { - let iter_elem : Bool = payload465[index467] - let iter_base = address466 + index467 * 1 + let address468 = mbt_ffi_malloc(payload467.length() * 1) + for index469 = 0 + index469 < payload467.length() + index469 = index469 + 1 { + let iter_elem : Bool = payload467[index469] + let iter_base = address468 + index469 * 1 mbt_ffi_store8(iter_base + 0, if iter_elem { 1 } else { 0 }) } - mbt_ffi_store32(iter_base + 12, payload465.length()) - mbt_ffi_store32(iter_base + 8, address466) - cleanup_list.push(address466) + mbt_ffi_store32(iter_base + 12, payload467.length()) + mbt_ffi_store32(iter_base + 8, address468) + cleanup_list.push(address468) () } - TupleValue(payload468) => { + TupleValue(payload470) => { mbt_ffi_store8(iter_base + 0, 17) - let address469 = mbt_ffi_malloc(payload468.length() * 4) - for index470 = 0 - index470 < payload468.length() - index470 = index470 + 1 { - let iter_elem : Int = payload468[index470] - let iter_base = address469 + index470 * 4 + let address471 = mbt_ffi_malloc(payload470.length() * 4) + for index472 = 0 + index472 < payload470.length() + index472 = index472 + 1 { + let iter_elem : Int = payload470[index472] + let iter_base = address471 + index472 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload468.length()) - mbt_ffi_store32(iter_base + 8, address469) - cleanup_list.push(address469) + mbt_ffi_store32(iter_base + 12, payload470.length()) + mbt_ffi_store32(iter_base + 8, address471) + cleanup_list.push(address471) () } - ListValue(payload471) => { + ListValue(payload473) => { mbt_ffi_store8(iter_base + 0, 18) - let address472 = mbt_ffi_malloc(payload471.length() * 4) - for index473 = 0 - index473 < payload471.length() - index473 = index473 + 1 { - let iter_elem : Int = payload471[index473] - let iter_base = address472 + index473 * 4 + let address474 = mbt_ffi_malloc(payload473.length() * 4) + for index475 = 0 + index475 < payload473.length() + index475 = index475 + 1 { + let iter_elem : Int = payload473[index475] + let iter_base = address474 + index475 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload471.length()) - mbt_ffi_store32(iter_base + 8, address472) - cleanup_list.push(address472) + mbt_ffi_store32(iter_base + 12, payload473.length()) + mbt_ffi_store32(iter_base + 8, address474) + cleanup_list.push(address474) () } - FixedListValue(payload474) => { + FixedListValue(payload476) => { mbt_ffi_store8(iter_base + 0, 19) - let address475 = mbt_ffi_malloc(payload474.length() * 4) - for index476 = 0 - index476 < payload474.length() - index476 = index476 + 1 { - let iter_elem : Int = payload474[index476] - let iter_base = address475 + index476 * 4 + let address477 = mbt_ffi_malloc(payload476.length() * 4) + for index478 = 0 + index478 < payload476.length() + index478 = index478 + 1 { + let iter_elem : Int = payload476[index478] + let iter_base = address477 + index478 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload474.length()) - mbt_ffi_store32(iter_base + 8, address475) - cleanup_list.push(address475) + mbt_ffi_store32(iter_base + 12, payload476.length()) + mbt_ffi_store32(iter_base + 8, address477) + cleanup_list.push(address477) () } - MapValue(payload477) => { + MapValue(payload479) => { mbt_ffi_store8(iter_base + 0, 20) - let address478 = mbt_ffi_malloc(payload477.length() * 8) - for index479 = 0 - index479 < payload477.length() - index479 = index479 + 1 { - let iter_elem : @types.MapEntry = payload477[index479] - let iter_base = address478 + index479 * 8 + let address480 = mbt_ffi_malloc(payload479.length() * 8) + for index481 = 0 + index481 < payload479.length() + index481 = index481 + 1 { + let iter_elem : @types.MapEntry = payload479[index481] + let iter_base = address480 + index481 * 8 mbt_ffi_store32(iter_base + 0, iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.value) } - mbt_ffi_store32(iter_base + 12, payload477.length()) - mbt_ffi_store32(iter_base + 8, address478) - cleanup_list.push(address478) + mbt_ffi_store32(iter_base + 12, payload479.length()) + mbt_ffi_store32(iter_base + 8, address480) + cleanup_list.push(address480) () } - OptionValue(payload480) => { + OptionValue(payload482) => { mbt_ffi_store8(iter_base + 0, 21) - match payload480 { + match payload482 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload482) => { + Some(payload484) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload482) + mbt_ffi_store32(iter_base + 12, payload484) () } @@ -19665,22 +19699,22 @@ pub fn WasmRpc::wasm_rpc( () } - ResultValue(payload483) => { + ResultValue(payload485) => { mbt_ffi_store8(iter_base + 0, 22) - match payload483 { - OkValue(payload484) => { + match payload485 { + OkValue(payload486) => { mbt_ffi_store8(iter_base + 8, 0) - match payload484 { + match payload486 { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload486) => { + Some(payload488) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload486) + mbt_ffi_store32(iter_base + 16, payload488) () } @@ -19688,18 +19722,18 @@ pub fn WasmRpc::wasm_rpc( () } - ErrValue(payload487) => { + ErrValue(payload489) => { mbt_ffi_store8(iter_base + 8, 1) - match payload487 { + match payload489 { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload489) => { + Some(payload491) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload489) + mbt_ffi_store32(iter_base + 16, payload491) () } @@ -19711,164 +19745,172 @@ pub fn WasmRpc::wasm_rpc( () } - TextValue(payload490) => { + TextValue(payload492) => { mbt_ffi_store8(iter_base + 0, 23) - let ptr491 = mbt_ffi_str2ptr(payload490.text) - mbt_ffi_store32(iter_base + 12, payload490.text.length()) - mbt_ffi_store32(iter_base + 8, ptr491) + let ptr493 = mbt_ffi_str2ptr(payload492.text) + mbt_ffi_store32(iter_base + 12, payload492.text.length()) + mbt_ffi_store32(iter_base + 8, ptr493) - match payload490.language { + match payload492.language { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload493) => { + Some(payload495) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr494 = mbt_ffi_str2ptr(payload493) - mbt_ffi_store32(iter_base + 24, payload493.length()) - mbt_ffi_store32(iter_base + 20, ptr494) - cleanup_list.push(ptr494) + let ptr496 = mbt_ffi_str2ptr(payload495) + mbt_ffi_store32(iter_base + 24, payload495.length()) + mbt_ffi_store32(iter_base + 20, ptr496) + cleanup_list.push(ptr496) () } } - cleanup_list.push(ptr491) + cleanup_list.push(ptr493) () } - BinaryValue(payload495) => { + BinaryValue(payload497) => { mbt_ffi_store8(iter_base + 0, 24) - let ptr496 = mbt_ffi_bytes2ptr(payload495.bytes) + let ptr498 = mbt_ffi_bytes2ptr(payload497.bytes) - mbt_ffi_store32(iter_base + 12, payload495.bytes.length()) - mbt_ffi_store32(iter_base + 8, ptr496) + mbt_ffi_store32(iter_base + 12, payload497.bytes.length()) + mbt_ffi_store32(iter_base + 8, ptr498) - match payload495.mime_type { + match payload497.mime_type { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload498) => { + Some(payload500) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr499 = mbt_ffi_str2ptr(payload498) - mbt_ffi_store32(iter_base + 24, payload498.length()) - mbt_ffi_store32(iter_base + 20, ptr499) - cleanup_list.push(ptr499) + let ptr501 = mbt_ffi_str2ptr(payload500) + mbt_ffi_store32(iter_base + 24, payload500.length()) + mbt_ffi_store32(iter_base + 20, ptr501) + cleanup_list.push(ptr501) () } } - cleanup_list.push(ptr496) + cleanup_list.push(ptr498) () } - PathValue(payload500) => { + PathValue(payload502) => { mbt_ffi_store8(iter_base + 0, 25) - let ptr501 = mbt_ffi_str2ptr(payload500) - mbt_ffi_store32(iter_base + 12, payload500.length()) - mbt_ffi_store32(iter_base + 8, ptr501) - cleanup_list.push(ptr501) + let ptr503 = mbt_ffi_str2ptr(payload502) + mbt_ffi_store32(iter_base + 12, payload502.length()) + mbt_ffi_store32(iter_base + 8, ptr503) + cleanup_list.push(ptr503) () } - UrlValue(payload502) => { + UrlValue(payload504) => { mbt_ffi_store8(iter_base + 0, 26) - let ptr503 = mbt_ffi_str2ptr(payload502) - mbt_ffi_store32(iter_base + 12, payload502.length()) - mbt_ffi_store32(iter_base + 8, ptr503) - cleanup_list.push(ptr503) + let ptr505 = mbt_ffi_str2ptr(payload504) + mbt_ffi_store32(iter_base + 12, payload504.length()) + mbt_ffi_store32(iter_base + 8, ptr505) + cleanup_list.push(ptr505) () } - DatetimeValue(payload504) => { + DatetimeValue(payload506) => { mbt_ffi_store8(iter_base + 0, 27) - mbt_ffi_store64(iter_base + 8, payload504.seconds) + mbt_ffi_store64(iter_base + 8, payload506.seconds) mbt_ffi_store32( iter_base + 16, - payload504.nanoseconds.reinterpret_as_int(), + payload506.nanoseconds.reinterpret_as_int(), ) () } - DurationValue(payload505) => { + DurationValue(payload507) => { mbt_ffi_store8(iter_base + 0, 28) - mbt_ffi_store64(iter_base + 8, payload505.nanoseconds) + mbt_ffi_store64(iter_base + 8, payload507.nanoseconds) () } - QuantityValueNode(payload506) => { + QuantityValueNode(payload508) => { mbt_ffi_store8(iter_base + 0, 29) - mbt_ffi_store64(iter_base + 8, payload506.mantissa) - mbt_ffi_store32(iter_base + 16, payload506.scale) + mbt_ffi_store64(iter_base + 8, payload508.mantissa) + mbt_ffi_store32(iter_base + 16, payload508.scale) - let ptr507 = mbt_ffi_str2ptr(payload506.unit) - mbt_ffi_store32(iter_base + 24, payload506.unit.length()) - mbt_ffi_store32(iter_base + 20, ptr507) - cleanup_list.push(ptr507) + let ptr509 = mbt_ffi_str2ptr(payload508.unit) + mbt_ffi_store32(iter_base + 24, payload508.unit.length()) + mbt_ffi_store32(iter_base + 20, ptr509) + cleanup_list.push(ptr509) () } - UnionValue(payload508) => { + UnionValue(payload510) => { mbt_ffi_store8(iter_base + 0, 30) - let ptr509 = mbt_ffi_str2ptr(payload508.tag) - mbt_ffi_store32(iter_base + 12, payload508.tag.length()) - mbt_ffi_store32(iter_base + 8, ptr509) - mbt_ffi_store32(iter_base + 16, payload508.body) - cleanup_list.push(ptr509) + let ptr511 = mbt_ffi_str2ptr(payload510.tag) + mbt_ffi_store32(iter_base + 12, payload510.tag.length()) + mbt_ffi_store32(iter_base + 8, ptr511) + mbt_ffi_store32(iter_base + 16, payload510.body) + cleanup_list.push(ptr511) () } - SecretValue(payload510) => { + SecretValue(payload512) => { mbt_ffi_store8(iter_base + 0, 31) - let @types.Secret(handle511) = payload510 - mbt_ffi_store32(iter_base + 8, handle511) + let @types.Secret(handle513) = payload512 + mbt_ffi_store32(iter_base + 8, handle513) () } - QuotaTokenHandle(payload512) => { + QuotaTokenHandle(payload514) => { mbt_ffi_store8(iter_base + 0, 32) - let @types.QuotaToken(handle513) = payload512 - mbt_ffi_store32(iter_base + 8, handle513) + let @types.QuotaToken(handle515) = payload514 + mbt_ffi_store32(iter_base + 8, handle515) + + () + } + StreamValue(payload516) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle517) = payload516 + mbt_ffi_store32(iter_base + 8, handle517) () } } } mbt_ffi_store32(iter_base + 32, iter_elem.value.value.value_nodes.length()) - mbt_ffi_store32(iter_base + 28, address514) + mbt_ffi_store32(iter_base + 28, address518) mbt_ffi_store32(iter_base + 36, iter_elem.value.value.root) - cleanup_list.push(address73) - cleanup_list.push(address436) - cleanup_list.push(address442) - cleanup_list.push(address514) + cleanup_list.push(address75) + cleanup_list.push(address438) + cleanup_list.push(address444) + cleanup_list.push(address518) } let result : Int = wasmImportConstructorWasmRpc( ptr, agent_type_name.length(), - address66, + address68, constructor_.value_nodes.length(), constructor_.root, lowered, - lowered70, - lowered71, - address516, + lowered72, + lowered73, + address520, agent_config.length(), ) let ret = WasmRpc::WasmRpc(result) mbt_ffi_free(ptr) - mbt_ffi_free(address66) - mbt_ffi_free(address516) + mbt_ffi_free(address68) + mbt_ffi_free(address520) cleanup_list.each(mbt_ffi_free) return ret @@ -19890,10 +19932,10 @@ pub fn WasmRpc::invoke_and_await( let ptr = mbt_ffi_str2ptr(method_name) - let address67 = mbt_ffi_malloc(input.value_nodes.length() * 32) - for index68 = 0; index68 < input.value_nodes.length(); index68 = index68 + 1 { - let iter_elem : @types.SchemaValueNode = input.value_nodes[index68] - let iter_base = address67 + index68 * 32 + let address69 = mbt_ffi_malloc(input.value_nodes.length() * 32) + for index70 = 0; index70 < input.value_nodes.length(); index70 = index70 + 1 { + let iter_elem : @types.SchemaValueNode = input.value_nodes[index70] + let iter_base = address69 + index70 * 32 match iter_elem { BoolValue(payload) => { @@ -20290,6 +20332,14 @@ pub fn WasmRpc::invoke_and_await( let @types.QuotaToken(handle66) = payload65 mbt_ffi_store32(iter_base + 8, handle66) + () + } + StreamValue(payload67) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle68) = payload67 + mbt_ffi_store32(iter_base + 8, handle68) + () } } @@ -20299,35 +20349,35 @@ pub fn WasmRpc::invoke_and_await( handle, ptr, method_name.length(), - address67, + address69, input.value_nodes.length(), input.root, return_area, ) - let lifted344 = match mbt_ffi_load8_u(return_area + 0) { + let lifted346 = match mbt_ffi_load8_u(return_area + 0) { 0 => { let result = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 4), mbt_ffi_load32(return_area + 8), ) - let result69 = mbt_ffi_ptr2str( + let result71 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - let lifted99 : @types.SchemaValueTree? = match + let lifted101 : @types.SchemaValueTree? = match mbt_ffi_load8_u(return_area + 20) { 0 => Option::None 1 => { - let array97 : Array[@types.SchemaValueNode] = [] - for index98 = 0 - index98 < mbt_ffi_load32(return_area + 28) - index98 = index98 + 1 { - let iter_base = mbt_ffi_load32(return_area + 24) + index98 * 32 + let array99 : Array[@types.SchemaValueNode] = [] + for index100 = 0 + index100 < mbt_ffi_load32(return_area + 28) + index100 = index100 + 1 { + let iter_base = mbt_ffi_load32(return_area + 24) + index100 * 32 - let lifted96 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted98 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -20366,19 +20416,19 @@ pub fn WasmRpc::invoke_and_await( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result70 = mbt_ffi_ptr2str( + let result72 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result70) + @types.SchemaValueNode::StringValue(result72) } 13 => { let array : Array[Int] = [] - for index71 = 0 - index71 < mbt_ffi_load32(iter_base + 12) - index71 = index71 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index71 * 4 + for index73 = 0 + index73 < mbt_ffi_load32(iter_base + 12) + index73 = index73 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index73 * 4 array.push(mbt_ffi_load32(iter_base + 0)) } @@ -20403,32 +20453,19 @@ pub fn WasmRpc::invoke_and_await( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array72 : Array[Bool] = [] - for index73 = 0 - index73 < mbt_ffi_load32(iter_base + 12) - index73 = index73 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index73 * 1 - - array72.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array72) - } - 17 => { - let array74 : Array[Int] = [] + let array74 : Array[Bool] = [] for index75 = 0 index75 < mbt_ffi_load32(iter_base + 12) index75 = index75 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index75 * 4 + let iter_base = mbt_ffi_load32(iter_base + 8) + index75 * 1 - array74.push(mbt_ffi_load32(iter_base + 0)) + array74.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array74) + @types.SchemaValueNode::FlagsValue(array74) } - 18 => { + 17 => { let array76 : Array[Int] = [] for index77 = 0 index77 < mbt_ffi_load32(iter_base + 12) @@ -20439,9 +20476,9 @@ pub fn WasmRpc::invoke_and_await( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array76) + @types.SchemaValueNode::TupleValue(array76) } - 19 => { + 18 => { let array78 : Array[Int] = [] for index79 = 0 index79 < mbt_ffi_load32(iter_base + 12) @@ -20452,123 +20489,136 @@ pub fn WasmRpc::invoke_and_await( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array78) + @types.SchemaValueNode::ListValue(array78) } - 20 => { - let array80 : Array[@types.MapEntry] = [] + 19 => { + let array80 : Array[Int] = [] for index81 = 0 index81 < mbt_ffi_load32(iter_base + 12) index81 = index81 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index81 * 8 + let iter_base = mbt_ffi_load32(iter_base + 8) + index81 * 4 + + array80.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array80) + } + 20 => { + let array82 : Array[@types.MapEntry] = [] + for index83 = 0 + index83 < mbt_ffi_load32(iter_base + 12) + index83 = index83 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index83 * 8 - array80.push(@types.MapEntry::{ + array82.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array80) + @types.SchemaValueNode::MapValue(array82) } 21 => { - let lifted82 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted84 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted82) + @types.SchemaValueNode::OptionValue(lifted84) } 22 => { - let lifted85 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted87 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted83 : Int? = match + let lifted85 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted83) + @types.ResultValuePayload::OkValue(lifted85) } 1 => { - let lifted84 : Int? = match + let lifted86 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted84) + @types.ResultValuePayload::ErrValue(lifted86) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted85) + @types.SchemaValueNode::ResultValue(lifted87) } 23 => { - let result86 = mbt_ffi_ptr2str( + let result88 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted88 : String? = match mbt_ffi_load8_u(iter_base + 16) { + let lifted90 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result87 = mbt_ffi_ptr2str( + let result89 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result87) + Option::Some(result89) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result86, - language: lifted88, + text: result88, + language: lifted90, }) } 24 => { - let result89 = mbt_ffi_ptr2bytes( + let result91 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted91 : String? = match mbt_ffi_load8_u(iter_base + 16) { + let lifted93 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result90 = mbt_ffi_ptr2str( + let result92 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result90) + Option::Some(result92) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result89, - mime_type: lifted91, + bytes: result91, + mime_type: lifted93, }) } 25 => { - let result92 = mbt_ffi_ptr2str( + let result94 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result92) + @types.SchemaValueNode::PathValue(result94) } 26 => { - let result93 = mbt_ffi_ptr2str( + let result95 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result93) + @types.SchemaValueNode::UrlValue(result95) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -20580,7 +20630,7 @@ pub fn WasmRpc::invoke_and_await( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result94 = mbt_ffi_ptr2str( + let result96 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -20588,17 +20638,17 @@ pub fn WasmRpc::invoke_and_await( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result94, + unit: result96, }) } 30 => { - let result95 = mbt_ffi_ptr2str( + let result97 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result95, + tag: result97, body: mbt_ffi_load32(iter_base + 16), }) } @@ -20610,15 +20660,21 @@ pub fn WasmRpc::invoke_and_await( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array97.push(lifted96) + array99.push(lifted98) } mbt_ffi_free(mbt_ffi_load32(return_area + 24)) Option::Some(@types.SchemaValueTree::{ - value_nodes: array97, + value_nodes: array99, root: mbt_ffi_load32(return_area + 32), }) } @@ -20628,103 +20684,103 @@ pub fn WasmRpc::invoke_and_await( Result::Ok(InvocationResultWithMetadata::{ metadata: InvocationMetadata::{ agent_id: result, - idempotency_key: result69, + idempotency_key: result71, }, - result: lifted99, + result: lifted101, }) } 1 => { - let lifted343 = match mbt_ffi_load8_u(return_area + 4) { + let lifted345 = match mbt_ffi_load8_u(return_area + 4) { 0 => { - let result100 = mbt_ffi_ptr2str( + let result102 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::ProtocolError(result100) + RpcError::ProtocolError(result102) } 1 => { - let result101 = mbt_ffi_ptr2str( + let result103 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::Denied(result101) + RpcError::Denied(result103) } 2 => { - let result102 = mbt_ffi_ptr2str( + let result104 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::NotFound(result102) + RpcError::NotFound(result104) } 3 => { - let result103 = mbt_ffi_ptr2str( + let result105 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::RemoteInternalError(result103) + RpcError::RemoteInternalError(result105) } 4 => { - let lifted342 = match mbt_ffi_load8_u(return_area + 8) { + let lifted344 = match mbt_ffi_load8_u(return_area + 8) { 0 => { - let result104 = mbt_ffi_ptr2str( + let result106 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.AgentError::InvalidInput(result104) + @common.AgentError::InvalidInput(result106) } 1 => { - let result105 = mbt_ffi_ptr2str( + let result107 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.AgentError::InvalidMethod(result105) + @common.AgentError::InvalidMethod(result107) } 2 => { - let result106 = mbt_ffi_ptr2str( + let result108 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.AgentError::InvalidType(result106) + @common.AgentError::InvalidType(result108) } 3 => { - let result107 = mbt_ffi_ptr2str( + let result109 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.AgentError::InvalidAgentId(result107) + @common.AgentError::InvalidAgentId(result109) } 4 => { - let array304 : Array[@types.SchemaTypeNode] = [] - for index305 = 0 - index305 < mbt_ffi_load32(return_area + 16) - index305 = index305 + 1 { + let array306 : Array[@types.SchemaTypeNode] = [] + for index307 = 0 + index307 < mbt_ffi_load32(return_area + 16) + index307 = index307 + 1 { let iter_base = mbt_ffi_load32(return_area + 12) + - index305 * 144 + index307 * 144 - let lifted290 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted292 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted114 : @types.NumericRestrictions? = match + let lifted116 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted109 : @types.NumericBound? = match + let lifted111 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted108 = match + let lifted110 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20741,16 +20797,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted108) + Option::Some(lifted110) } _ => panic() } - let lifted111 : @types.NumericBound? = match + let lifted113 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted110 = match + let lifted112 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20767,46 +20823,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted110) + Option::Some(lifted112) } _ => panic() } - let lifted113 : String? = match + let lifted115 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result112 = mbt_ffi_ptr2str( + let result114 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result112) + Option::Some(result114) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted109, - max: lifted111, - unit: lifted113, + min: lifted111, + max: lifted113, + unit: lifted115, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted114) + @types.SchemaTypeBody::S8Type(lifted116) } 3 => { - let lifted121 : @types.NumericRestrictions? = match + let lifted123 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted116 : @types.NumericBound? = match + let lifted118 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted115 = match + let lifted117 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20823,16 +20879,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted115) + Option::Some(lifted117) } _ => panic() } - let lifted118 : @types.NumericBound? = match + let lifted120 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted117 = match + let lifted119 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20849,46 +20905,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted117) + Option::Some(lifted119) } _ => panic() } - let lifted120 : String? = match + let lifted122 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result119 = mbt_ffi_ptr2str( + let result121 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result119) + Option::Some(result121) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted116, - max: lifted118, - unit: lifted120, + min: lifted118, + max: lifted120, + unit: lifted122, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted121) + @types.SchemaTypeBody::S16Type(lifted123) } 4 => { - let lifted128 : @types.NumericRestrictions? = match + let lifted130 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted123 : @types.NumericBound? = match + let lifted125 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted122 = match + let lifted124 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20905,16 +20961,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted122) + Option::Some(lifted124) } _ => panic() } - let lifted125 : @types.NumericBound? = match + let lifted127 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted124 = match + let lifted126 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20931,46 +20987,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted124) + Option::Some(lifted126) } _ => panic() } - let lifted127 : String? = match + let lifted129 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result126 = mbt_ffi_ptr2str( + let result128 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result126) + Option::Some(result128) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted123, - max: lifted125, - unit: lifted127, + min: lifted125, + max: lifted127, + unit: lifted129, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted128) + @types.SchemaTypeBody::S32Type(lifted130) } 5 => { - let lifted135 : @types.NumericRestrictions? = match + let lifted137 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted130 : @types.NumericBound? = match + let lifted132 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted129 = match + let lifted131 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20987,16 +21043,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted129) + Option::Some(lifted131) } _ => panic() } - let lifted132 : @types.NumericBound? = match + let lifted134 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted131 = match + let lifted133 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21013,46 +21069,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted131) + Option::Some(lifted133) } _ => panic() } - let lifted134 : String? = match + let lifted136 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result133 = mbt_ffi_ptr2str( + let result135 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result133) + Option::Some(result135) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted130, - max: lifted132, - unit: lifted134, + min: lifted132, + max: lifted134, + unit: lifted136, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted135) + @types.SchemaTypeBody::S64Type(lifted137) } 6 => { - let lifted142 : @types.NumericRestrictions? = match + let lifted144 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted137 : @types.NumericBound? = match + let lifted139 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted136 = match + let lifted138 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21069,16 +21125,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted136) + Option::Some(lifted138) } _ => panic() } - let lifted139 : @types.NumericBound? = match + let lifted141 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted138 = match + let lifted140 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21095,46 +21151,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted138) + Option::Some(lifted140) } _ => panic() } - let lifted141 : String? = match + let lifted143 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result140 = mbt_ffi_ptr2str( + let result142 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result140) + Option::Some(result142) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted137, - max: lifted139, - unit: lifted141, + min: lifted139, + max: lifted141, + unit: lifted143, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted142) + @types.SchemaTypeBody::U8Type(lifted144) } 7 => { - let lifted149 : @types.NumericRestrictions? = match + let lifted151 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted144 : @types.NumericBound? = match + let lifted146 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted143 = match + let lifted145 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21151,16 +21207,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted143) + Option::Some(lifted145) } _ => panic() } - let lifted146 : @types.NumericBound? = match + let lifted148 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted145 = match + let lifted147 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21177,46 +21233,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted145) + Option::Some(lifted147) } _ => panic() } - let lifted148 : String? = match + let lifted150 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result147 = mbt_ffi_ptr2str( + let result149 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result147) + Option::Some(result149) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted144, - max: lifted146, - unit: lifted148, + min: lifted146, + max: lifted148, + unit: lifted150, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted149) + @types.SchemaTypeBody::U16Type(lifted151) } 8 => { - let lifted156 : @types.NumericRestrictions? = match + let lifted158 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted151 : @types.NumericBound? = match + let lifted153 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted150 = match + let lifted152 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21233,16 +21289,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted150) + Option::Some(lifted152) } _ => panic() } - let lifted153 : @types.NumericBound? = match + let lifted155 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted152 = match + let lifted154 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21259,46 +21315,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted152) + Option::Some(lifted154) } _ => panic() } - let lifted155 : String? = match + let lifted157 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result154 = mbt_ffi_ptr2str( + let result156 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result154) + Option::Some(result156) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted151, - max: lifted153, - unit: lifted155, + min: lifted153, + max: lifted155, + unit: lifted157, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted156) + @types.SchemaTypeBody::U32Type(lifted158) } 9 => { - let lifted163 : @types.NumericRestrictions? = match + let lifted165 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted158 : @types.NumericBound? = match + let lifted160 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted157 = match + let lifted159 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21315,16 +21371,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted157) + Option::Some(lifted159) } _ => panic() } - let lifted160 : @types.NumericBound? = match + let lifted162 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted159 = match + let lifted161 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21341,46 +21397,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted159) + Option::Some(lifted161) } _ => panic() } - let lifted162 : String? = match + let lifted164 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result161 = mbt_ffi_ptr2str( + let result163 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result161) + Option::Some(result163) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted158, - max: lifted160, - unit: lifted162, + min: lifted160, + max: lifted162, + unit: lifted164, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted163) + @types.SchemaTypeBody::U64Type(lifted165) } 10 => { - let lifted170 : @types.NumericRestrictions? = match + let lifted172 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted165 : @types.NumericBound? = match + let lifted167 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted164 = match + let lifted166 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21397,16 +21453,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted164) + Option::Some(lifted166) } _ => panic() } - let lifted167 : @types.NumericBound? = match + let lifted169 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted166 = match + let lifted168 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21423,46 +21479,46 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted166) + Option::Some(lifted168) } _ => panic() } - let lifted169 : String? = match + let lifted171 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result168 = mbt_ffi_ptr2str( + let result170 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result168) + Option::Some(result170) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted165, - max: lifted167, - unit: lifted169, + min: lifted167, + max: lifted169, + unit: lifted171, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted170) + @types.SchemaTypeBody::F32Type(lifted172) } 11 => { - let lifted177 : @types.NumericRestrictions? = match + let lifted179 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted172 : @types.NumericBound? = match + let lifted174 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted171 = match + let lifted173 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21479,16 +21535,16 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted171) + Option::Some(lifted173) } _ => panic() } - let lifted174 : @types.NumericBound? = match + let lifted176 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted173 = match + let lifted175 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21505,324 +21561,324 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - Option::Some(lifted173) + Option::Some(lifted175) } _ => panic() } - let lifted176 : String? = match + let lifted178 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result175 = mbt_ffi_ptr2str( + let result177 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result175) + Option::Some(result177) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted172, - max: lifted174, - unit: lifted176, + min: lifted174, + max: lifted176, + unit: lifted178, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted177) + @types.SchemaTypeBody::F64Type(lifted179) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array192 : Array[@types.NamedFieldType] = [] - for index193 = 0 - index193 < mbt_ffi_load32(iter_base + 12) - index193 = index193 + 1 { + let array194 : Array[@types.NamedFieldType] = [] + for index195 = 0 + index195 < mbt_ffi_load32(iter_base + 12) + index195 = index195 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index193 * 68 + index195 * 68 - let result178 = mbt_ffi_ptr2str( + let result180 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted180 : String? = match + let lifted182 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result179 = mbt_ffi_ptr2str( + let result181 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result179) + Option::Some(result181) } _ => panic() } - let array182 : Array[String] = [] - for index183 = 0 - index183 < mbt_ffi_load32(iter_base + 28) - index183 = index183 + 1 { + let array184 : Array[String] = [] + for index185 = 0 + index185 < mbt_ffi_load32(iter_base + 28) + index185 = index185 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index183 * 8 + index185 * 8 - let result181 = mbt_ffi_ptr2str( + let result183 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array182.push(result181) + array184.push(result183) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array185 : Array[String] = [] - for index186 = 0 - index186 < mbt_ffi_load32(iter_base + 36) - index186 = index186 + 1 { + let array187 : Array[String] = [] + for index188 = 0 + index188 < mbt_ffi_load32(iter_base + 36) + index188 = index188 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index186 * 8 + index188 * 8 - let result184 = mbt_ffi_ptr2str( + let result186 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array185.push(result184) + array187.push(result186) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted188 : String? = match + let lifted190 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result187 = mbt_ffi_ptr2str( + let result189 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result187) + Option::Some(result189) } _ => panic() } - let lifted191 : @types.Role? = match + let lifted193 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted190 = match + let lifted192 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result189 = mbt_ffi_ptr2str( + let result191 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result189) + @types.Role::Other(result191) } _ => panic() } - Option::Some(lifted190) + Option::Some(lifted192) } _ => panic() } - array192.push(@types.NamedFieldType::{ - name: result178, + array194.push(@types.NamedFieldType::{ + name: result180, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted180, - aliases: array182, - examples: array185, - deprecated: lifted188, - role: lifted191, + doc: lifted182, + aliases: array184, + examples: array187, + deprecated: lifted190, + role: lifted193, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array192) + @types.SchemaTypeBody::RecordType(array194) } 15 => { - let array209 : Array[@types.VariantCaseType] = [] - for index210 = 0 - index210 < mbt_ffi_load32(iter_base + 12) - index210 = index210 + 1 { + let array211 : Array[@types.VariantCaseType] = [] + for index212 = 0 + index212 < mbt_ffi_load32(iter_base + 12) + index212 = index212 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index210 * 72 + index212 * 72 - let result194 = mbt_ffi_ptr2str( + let result196 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted195 : Int? = match + let lifted197 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted197 : String? = match + let lifted199 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result196 = mbt_ffi_ptr2str( + let result198 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result196) + Option::Some(result198) } _ => panic() } - let array199 : Array[String] = [] - for index200 = 0 - index200 < mbt_ffi_load32(iter_base + 32) - index200 = index200 + 1 { + let array201 : Array[String] = [] + for index202 = 0 + index202 < mbt_ffi_load32(iter_base + 32) + index202 = index202 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index200 * 8 + index202 * 8 - let result198 = mbt_ffi_ptr2str( + let result200 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array199.push(result198) + array201.push(result200) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array202 : Array[String] = [] - for index203 = 0 - index203 < mbt_ffi_load32(iter_base + 40) - index203 = index203 + 1 { + let array204 : Array[String] = [] + for index205 = 0 + index205 < mbt_ffi_load32(iter_base + 40) + index205 = index205 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index203 * 8 + index205 * 8 - let result201 = mbt_ffi_ptr2str( + let result203 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array202.push(result201) + array204.push(result203) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted205 : String? = match + let lifted207 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result204 = mbt_ffi_ptr2str( + let result206 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result204) + Option::Some(result206) } _ => panic() } - let lifted208 : @types.Role? = match + let lifted210 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted207 = match + let lifted209 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result206 = mbt_ffi_ptr2str( + let result208 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result206) + @types.Role::Other(result208) } _ => panic() } - Option::Some(lifted207) + Option::Some(lifted209) } _ => panic() } - array209.push(@types.VariantCaseType::{ - name: result194, - payload: lifted195, + array211.push(@types.VariantCaseType::{ + name: result196, + payload: lifted197, metadata: @types.MetadataEnvelope::{ - doc: lifted197, - aliases: array199, - examples: array202, - deprecated: lifted205, - role: lifted208, + doc: lifted199, + aliases: array201, + examples: array204, + deprecated: lifted207, + role: lifted210, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array209) + @types.SchemaTypeBody::VariantType(array211) } 16 => { - let array212 : Array[String] = [] - for index213 = 0 - index213 < mbt_ffi_load32(iter_base + 12) - index213 = index213 + 1 { + let array214 : Array[String] = [] + for index215 = 0 + index215 < mbt_ffi_load32(iter_base + 12) + index215 = index215 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index213 * 8 + index215 * 8 - let result211 = mbt_ffi_ptr2str( + let result213 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array212.push(result211) + array214.push(result213) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array212) + @types.SchemaTypeBody::EnumType(array214) } 17 => { - let array215 : Array[String] = [] - for index216 = 0 - index216 < mbt_ffi_load32(iter_base + 12) - index216 = index216 + 1 { + let array217 : Array[String] = [] + for index218 = 0 + index218 < mbt_ffi_load32(iter_base + 12) + index218 = index218 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index216 * 8 + index218 * 8 - let result214 = mbt_ffi_ptr2str( + let result216 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array215.push(result214) + array217.push(result216) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array215) + @types.SchemaTypeBody::FlagsType(array217) } 18 => { - let array217 : Array[Int] = [] - for index218 = 0 - index218 < mbt_ffi_load32(iter_base + 12) - index218 = index218 + 1 { + let array219 : Array[Int] = [] + for index220 = 0 + index220 < mbt_ffi_load32(iter_base + 12) + index220 = index220 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index218 * 4 + index220 * 4 - array217.push(mbt_ffi_load32(iter_base + 0)) + array219.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array217) + @types.SchemaTypeBody::TupleType(array219) } 19 => @types.SchemaTypeBody::ListType( @@ -21843,14 +21899,14 @@ pub fn WasmRpc::invoke_and_await( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted219 : Int? = match + let lifted221 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted220 : Int? = match + let lifted222 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -21858,37 +21914,37 @@ pub fn WasmRpc::invoke_and_await( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted219, - err: lifted220, + ok: lifted221, + err: lifted222, }) } 24 => { - let lifted224 : Array[String]? = match + let lifted226 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array222 : Array[String] = [] - for index223 = 0 - index223 < mbt_ffi_load32(iter_base + 16) - index223 = index223 + 1 { + let array224 : Array[String] = [] + for index225 = 0 + index225 < mbt_ffi_load32(iter_base + 16) + index225 = index225 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index223 * 8 + index225 * 8 - let result221 = mbt_ffi_ptr2str( + let result223 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array222.push(result221) + array224.push(result223) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array222) + Option::Some(array224) } _ => panic() } - let lifted225 : UInt? = match + let lifted227 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -21898,7 +21954,7 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - let lifted226 : UInt? = match + let lifted228 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -21908,54 +21964,54 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - let lifted228 : String? = match + let lifted230 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result227 = mbt_ffi_ptr2str( + let result229 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result227) + Option::Some(result229) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted224, - min_length: lifted225, - max_length: lifted226, - regex: lifted228, + languages: lifted226, + min_length: lifted227, + max_length: lifted228, + regex: lifted230, }) } 25 => { - let lifted232 : Array[String]? = match + let lifted234 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array230 : Array[String] = [] - for index231 = 0 - index231 < mbt_ffi_load32(iter_base + 16) - index231 = index231 + 1 { + let array232 : Array[String] = [] + for index233 = 0 + index233 < mbt_ffi_load32(iter_base + 16) + index233 = index233 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index231 * 8 + index233 * 8 - let result229 = mbt_ffi_ptr2str( + let result231 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array230.push(result229) + array232.push(result231) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array230) + Option::Some(array232) } _ => panic() } - let lifted233 : UInt? = match + let lifted235 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -21965,7 +22021,7 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - let lifted234 : UInt? = match + let lifted236 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -21976,58 +22032,58 @@ pub fn WasmRpc::invoke_and_await( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted232, - min_bytes: lifted233, - max_bytes: lifted234, + mime_types: lifted234, + min_bytes: lifted235, + max_bytes: lifted236, }) } 26 => { - let lifted238 : Array[String]? = match + let lifted240 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array236 : Array[String] = [] - for index237 = 0 - index237 < mbt_ffi_load32(iter_base + 20) - index237 = index237 + 1 { + let array238 : Array[String] = [] + for index239 = 0 + index239 < mbt_ffi_load32(iter_base + 20) + index239 = index239 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index237 * 8 + index239 * 8 - let result235 = mbt_ffi_ptr2str( + let result237 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array236.push(result235) + array238.push(result237) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array236) + Option::Some(array238) } _ => panic() } - let lifted242 : Array[String]? = match + let lifted244 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array240 : Array[String] = [] - for index241 = 0 - index241 < mbt_ffi_load32(iter_base + 32) - index241 = index241 + 1 { + let array242 : Array[String] = [] + for index243 = 0 + index243 < mbt_ffi_load32(iter_base + 32) + index243 = index243 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index241 * 8 + index243 * 8 - let result239 = mbt_ffi_ptr2str( + let result241 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array240.push(result239) + array242.push(result241) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array240) + Option::Some(array242) } _ => panic() } @@ -22039,95 +22095,95 @@ pub fn WasmRpc::invoke_and_await( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted238, - allowed_extensions: lifted242, + allowed_mime_types: lifted240, + allowed_extensions: lifted244, }) } 27 => { - let lifted246 : Array[String]? = match + let lifted248 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array244 : Array[String] = [] - for index245 = 0 - index245 < mbt_ffi_load32(iter_base + 16) - index245 = index245 + 1 { + let array246 : Array[String] = [] + for index247 = 0 + index247 < mbt_ffi_load32(iter_base + 16) + index247 = index247 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index245 * 8 + index247 * 8 - let result243 = mbt_ffi_ptr2str( + let result245 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array244.push(result243) + array246.push(result245) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array244) + Option::Some(array246) } _ => panic() } - let lifted250 : Array[String]? = match + let lifted252 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array248 : Array[String] = [] - for index249 = 0 - index249 < mbt_ffi_load32(iter_base + 28) - index249 = index249 + 1 { + let array250 : Array[String] = [] + for index251 = 0 + index251 < mbt_ffi_load32(iter_base + 28) + index251 = index251 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index249 * 8 + index251 * 8 - let result247 = mbt_ffi_ptr2str( + let result249 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array248.push(result247) + array250.push(result249) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array248) + Option::Some(array250) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted246, - allowed_hosts: lifted250, + allowed_schemes: lifted248, + allowed_hosts: lifted252, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result251 = mbt_ffi_ptr2str( + let result253 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array253 : Array[String] = [] - for index254 = 0 - index254 < mbt_ffi_load32(iter_base + 20) - index254 = index254 + 1 { + let array255 : Array[String] = [] + for index256 = 0 + index256 < mbt_ffi_load32(iter_base + 20) + index256 = index256 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index254 * 8 + index256 * 8 - let result252 = mbt_ffi_ptr2str( + let result254 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array253.push(result252) + array255.push(result254) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted256 : @types.QuantityValue? = match + let lifted258 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result255 = mbt_ffi_ptr2str( + let result257 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -22135,17 +22191,17 @@ pub fn WasmRpc::invoke_and_await( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result255, + unit: result257, }) } _ => panic() } - let lifted258 : @types.QuantityValue? = match + let lifted260 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result257 = mbt_ffi_ptr2str( + let result259 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -22153,401 +22209,401 @@ pub fn WasmRpc::invoke_and_await( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result257, + unit: result259, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result251, - allowed_suffixes: array253, - min: lifted256, - max: lifted258, + base_unit: result253, + allowed_suffixes: array255, + min: lifted258, + max: lifted260, }) } 31 => { - let array282 : Array[@types.UnionBranch] = [] - for index283 = 0 - index283 < mbt_ffi_load32(iter_base + 12) - index283 = index283 + 1 { + let array284 : Array[@types.UnionBranch] = [] + for index285 = 0 + index285 < mbt_ffi_load32(iter_base + 12) + index285 = index285 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index283 * 92 + index285 * 92 - let result259 = mbt_ffi_ptr2str( + let result261 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted268 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted270 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result260 = mbt_ffi_ptr2str( + let result262 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result260) + @types.DiscriminatorRule::Prefix(result262) } 1 => { - let result261 = mbt_ffi_ptr2str( + let result263 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result261) + @types.DiscriminatorRule::Suffix(result263) } 2 => { - let result262 = mbt_ffi_ptr2str( + let result264 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result262) + @types.DiscriminatorRule::Contains(result264) } 3 => { - let result263 = mbt_ffi_ptr2str( + let result265 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result263) + @types.DiscriminatorRule::Regex(result265) } 4 => { - let result264 = mbt_ffi_ptr2str( + let result266 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted266 : String? = match + let lifted268 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result265 = mbt_ffi_ptr2str( + let result267 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result265) + Option::Some(result267) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result264, - literal: lifted266, + field_name: result266, + literal: lifted268, }) } 5 => { - let result267 = mbt_ffi_ptr2str( + let result269 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result267) + @types.DiscriminatorRule::FieldAbsent(result269) } _ => panic() } - let lifted270 : String? = match + let lifted272 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result269 = mbt_ffi_ptr2str( + let result271 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result269) + Option::Some(result271) } _ => panic() } - let array272 : Array[String] = [] - for index273 = 0 - index273 < mbt_ffi_load32(iter_base + 52) - index273 = index273 + 1 { + let array274 : Array[String] = [] + for index275 = 0 + index275 < mbt_ffi_load32(iter_base + 52) + index275 = index275 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index273 * 8 + index275 * 8 - let result271 = mbt_ffi_ptr2str( + let result273 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array272.push(result271) + array274.push(result273) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array275 : Array[String] = [] - for index276 = 0 - index276 < mbt_ffi_load32(iter_base + 60) - index276 = index276 + 1 { + let array277 : Array[String] = [] + for index278 = 0 + index278 < mbt_ffi_load32(iter_base + 60) + index278 = index278 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index276 * 8 + index278 * 8 - let result274 = mbt_ffi_ptr2str( + let result276 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array275.push(result274) + array277.push(result276) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted278 : String? = match + let lifted280 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result277 = mbt_ffi_ptr2str( + let result279 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result277) + Option::Some(result279) } _ => panic() } - let lifted281 : @types.Role? = match + let lifted283 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted280 = match + let lifted282 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result279 = mbt_ffi_ptr2str( + let result281 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result279) + @types.Role::Other(result281) } _ => panic() } - Option::Some(lifted280) + Option::Some(lifted282) } _ => panic() } - array282.push(@types.UnionBranch::{ - tag: result259, + array284.push(@types.UnionBranch::{ + tag: result261, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted268, + discriminator: lifted270, metadata: @types.MetadataEnvelope::{ - doc: lifted270, - aliases: array272, - examples: array275, - deprecated: lifted278, - role: lifted281, + doc: lifted272, + aliases: array274, + examples: array277, + deprecated: lifted280, + role: lifted283, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array282, + branches: array284, }) } 32 => { - let lifted285 : String? = match + let lifted287 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result284 = mbt_ffi_ptr2str( + let result286 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result284) + Option::Some(result286) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted285, + category: lifted287, }) } 33 => { - let lifted287 : String? = match + let lifted289 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result286 = mbt_ffi_ptr2str( + let result288 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result286) + Option::Some(result288) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted287, + resource_name: lifted289, }) } 34 => { - let lifted288 : Int? = match + let lifted290 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted288) + @types.SchemaTypeBody::FutureType(lifted290) } 35 => { - let lifted289 : Int? = match + let lifted291 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted289) + @types.SchemaTypeBody::StreamType(lifted291) } _ => panic() } - let lifted292 : String? = match + let lifted294 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result291 = mbt_ffi_ptr2str( + let result293 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result291) + Option::Some(result293) } _ => panic() } - let array294 : Array[String] = [] - for index295 = 0 - index295 < mbt_ffi_load32(iter_base + 104) - index295 = index295 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index295 * 8 + let array296 : Array[String] = [] + for index297 = 0 + index297 < mbt_ffi_load32(iter_base + 104) + index297 = index297 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index297 * 8 - let result293 = mbt_ffi_ptr2str( + let result295 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array294.push(result293) + array296.push(result295) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array297 : Array[String] = [] - for index298 = 0 - index298 < mbt_ffi_load32(iter_base + 112) - index298 = index298 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index298 * 8 + let array299 : Array[String] = [] + for index300 = 0 + index300 < mbt_ffi_load32(iter_base + 112) + index300 = index300 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index300 * 8 - let result296 = mbt_ffi_ptr2str( + let result298 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array297.push(result296) + array299.push(result298) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted300 : String? = match + let lifted302 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result299 = mbt_ffi_ptr2str( + let result301 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result299) + Option::Some(result301) } _ => panic() } - let lifted303 : @types.Role? = match + let lifted305 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted302 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted304 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result301 = mbt_ffi_ptr2str( + let result303 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result301) + @types.Role::Other(result303) } _ => panic() } - Option::Some(lifted302) + Option::Some(lifted304) } _ => panic() } - array304.push(@types.SchemaTypeNode::{ - body: lifted290, + array306.push(@types.SchemaTypeNode::{ + body: lifted292, metadata: @types.MetadataEnvelope::{ - doc: lifted292, - aliases: array294, - examples: array297, - deprecated: lifted300, - role: lifted303, + doc: lifted294, + aliases: array296, + examples: array299, + deprecated: lifted302, + role: lifted305, }, }) } mbt_ffi_free(mbt_ffi_load32(return_area + 12)) - let array309 : Array[@types.SchemaTypeDef] = [] - for index310 = 0 - index310 < mbt_ffi_load32(return_area + 24) - index310 = index310 + 1 { - let iter_base = mbt_ffi_load32(return_area + 20) + index310 * 24 + let array311 : Array[@types.SchemaTypeDef] = [] + for index312 = 0 + index312 < mbt_ffi_load32(return_area + 24) + index312 = index312 + 1 { + let iter_base = mbt_ffi_load32(return_area + 20) + index312 * 24 - let result306 = mbt_ffi_ptr2str( + let result308 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted308 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted310 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result307 = mbt_ffi_ptr2str( + let result309 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result307) + Option::Some(result309) } _ => panic() } - array309.push(@types.SchemaTypeDef::{ - id: result306, - name: lifted308, + array311.push(@types.SchemaTypeDef::{ + id: result308, + name: lifted310, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(return_area + 20)) - let array340 : Array[@types.SchemaValueNode] = [] - for index341 = 0 - index341 < mbt_ffi_load32(return_area + 36) - index341 = index341 + 1 { - let iter_base = mbt_ffi_load32(return_area + 32) + index341 * 32 + let array342 : Array[@types.SchemaValueNode] = [] + for index343 = 0 + index343 < mbt_ffi_load32(return_area + 36) + index343 = index343 + 1 { + let iter_base = mbt_ffi_load32(return_area + 32) + index343 * 32 - let lifted339 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted341 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -22599,29 +22655,29 @@ pub fn WasmRpc::invoke_and_await( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result311 = mbt_ffi_ptr2str( + let result313 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result311) + @types.SchemaValueNode::StringValue(result313) } 13 => { - let array312 : Array[Int] = [] - for index313 = 0 - index313 < mbt_ffi_load32(iter_base + 12) - index313 = index313 + 1 { + let array314 : Array[Int] = [] + for index315 = 0 + index315 < mbt_ffi_load32(iter_base + 12) + index315 = index315 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index313 * 4 + index315 * 4 - array312.push(mbt_ffi_load32(iter_base + 0)) + array314.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array312) + @types.SchemaValueNode::RecordValue(array314) } 14 => { - let lifted314 : Int? = match + let lifted316 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -22630,7 +22686,7 @@ pub fn WasmRpc::invoke_and_await( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted314, + payload: lifted316, }) } 15 => @@ -22638,34 +22694,20 @@ pub fn WasmRpc::invoke_and_await( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array315 : Array[Bool] = [] - for index316 = 0 - index316 < mbt_ffi_load32(iter_base + 12) - index316 = index316 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index316 * 1 - - array315.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array315) - } - 17 => { - let array317 : Array[Int] = [] + let array317 : Array[Bool] = [] for index318 = 0 index318 < mbt_ffi_load32(iter_base + 12) index318 = index318 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index318 * 4 + index318 * 1 - array317.push(mbt_ffi_load32(iter_base + 0)) + array317.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array317) + @types.SchemaValueNode::FlagsValue(array317) } - 18 => { + 17 => { let array319 : Array[Int] = [] for index320 = 0 index320 < mbt_ffi_load32(iter_base + 12) @@ -22677,9 +22719,9 @@ pub fn WasmRpc::invoke_and_await( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array319) + @types.SchemaValueNode::TupleValue(array319) } - 19 => { + 18 => { let array321 : Array[Int] = [] for index322 = 0 index322 < mbt_ffi_load32(iter_base + 12) @@ -22691,127 +22733,141 @@ pub fn WasmRpc::invoke_and_await( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array321) + @types.SchemaValueNode::ListValue(array321) } - 20 => { - let array323 : Array[@types.MapEntry] = [] + 19 => { + let array323 : Array[Int] = [] for index324 = 0 index324 < mbt_ffi_load32(iter_base + 12) index324 = index324 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index324 * 8 + index324 * 4 + + array323.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array323) + } + 20 => { + let array325 : Array[@types.MapEntry] = [] + for index326 = 0 + index326 < mbt_ffi_load32(iter_base + 12) + index326 = index326 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index326 * 8 - array323.push(@types.MapEntry::{ + array325.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array323) + @types.SchemaValueNode::MapValue(array325) } 21 => { - let lifted325 : Int? = match + let lifted327 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted325) + @types.SchemaValueNode::OptionValue(lifted327) } 22 => { - let lifted328 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted330 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted326 : Int? = match + let lifted328 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted326) + @types.ResultValuePayload::OkValue(lifted328) } 1 => { - let lifted327 : Int? = match + let lifted329 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted327) + @types.ResultValuePayload::ErrValue(lifted329) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted328) + @types.SchemaValueNode::ResultValue(lifted330) } 23 => { - let result329 = mbt_ffi_ptr2str( + let result331 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted331 : String? = match + let lifted333 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result330 = mbt_ffi_ptr2str( + let result332 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result330) + Option::Some(result332) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result329, - language: lifted331, + text: result331, + language: lifted333, }) } 24 => { - let result332 = mbt_ffi_ptr2bytes( + let result334 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted334 : String? = match + let lifted336 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result333 = mbt_ffi_ptr2str( + let result335 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result333) + Option::Some(result335) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result332, - mime_type: lifted334, + bytes: result334, + mime_type: lifted336, }) } 25 => { - let result335 = mbt_ffi_ptr2str( + let result337 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result335) + @types.SchemaValueNode::PathValue(result337) } 26 => { - let result336 = mbt_ffi_ptr2str( + let result338 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result336) + @types.SchemaValueNode::UrlValue(result338) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -22823,7 +22879,7 @@ pub fn WasmRpc::invoke_and_await( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result337 = mbt_ffi_ptr2str( + let result339 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -22831,17 +22887,17 @@ pub fn WasmRpc::invoke_and_await( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result337, + unit: result339, }) } 30 => { - let result338 = mbt_ffi_ptr2str( + let result340 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result338, + tag: result340, body: mbt_ffi_load32(iter_base + 16), }) } @@ -22855,21 +22911,27 @@ pub fn WasmRpc::invoke_and_await( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array340.push(lifted339) + array342.push(lifted341) } mbt_ffi_free(mbt_ffi_load32(return_area + 32)) @common.AgentError::CustomError(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array304, - defs: array309, + type_nodes: array306, + defs: array311, root: mbt_ffi_load32(return_area + 28), }, value: @types.SchemaValueTree::{ - value_nodes: array340, + value_nodes: array342, root: mbt_ffi_load32(return_area + 40), }, }) @@ -22877,18 +22939,18 @@ pub fn WasmRpc::invoke_and_await( _ => panic() } - RpcError::RemoteAgentError(lifted342) + RpcError::RemoteAgentError(lifted344) } _ => panic() } - Result::Err(lifted343) + Result::Err(lifted345) } _ => panic() } - let ret = lifted344 + let ret = lifted346 mbt_ffi_free(ptr) - mbt_ffi_free(address67) + mbt_ffi_free(address69) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -22909,10 +22971,10 @@ pub fn WasmRpc::invoke( let ptr = mbt_ffi_str2ptr(method_name) - let address67 = mbt_ffi_malloc(input.value_nodes.length() * 32) - for index68 = 0; index68 < input.value_nodes.length(); index68 = index68 + 1 { - let iter_elem : @types.SchemaValueNode = input.value_nodes[index68] - let iter_base = address67 + index68 * 32 + let address69 = mbt_ffi_malloc(input.value_nodes.length() * 32) + for index70 = 0; index70 < input.value_nodes.length(); index70 = index70 + 1 { + let iter_elem : @types.SchemaValueNode = input.value_nodes[index70] + let iter_base = address69 + index70 * 32 match iter_elem { BoolValue(payload) => { @@ -23309,6 +23371,14 @@ pub fn WasmRpc::invoke( let @types.QuotaToken(handle66) = payload65 mbt_ffi_store32(iter_base + 8, handle66) + () + } + StreamValue(payload67) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle68) = payload67 + mbt_ffi_store32(iter_base + 8, handle68) + () } } @@ -23318,117 +23388,117 @@ pub fn WasmRpc::invoke( handle, ptr, method_name.length(), - address67, + address69, input.value_nodes.length(), input.root, return_area, ) - let lifted312 = match mbt_ffi_load8_u(return_area + 0) { + let lifted314 = match mbt_ffi_load8_u(return_area + 0) { 0 => { let result = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 4), mbt_ffi_load32(return_area + 8), ) - let result69 = mbt_ffi_ptr2str( + let result71 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) Result::Ok(InvocationMetadata::{ agent_id: result, - idempotency_key: result69, + idempotency_key: result71, }) } 1 => { - let lifted311 = match mbt_ffi_load8_u(return_area + 4) { + let lifted313 = match mbt_ffi_load8_u(return_area + 4) { 0 => { - let result70 = mbt_ffi_ptr2str( + let result72 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::ProtocolError(result70) + RpcError::ProtocolError(result72) } 1 => { - let result71 = mbt_ffi_ptr2str( + let result73 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::Denied(result71) + RpcError::Denied(result73) } 2 => { - let result72 = mbt_ffi_ptr2str( + let result74 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::NotFound(result72) + RpcError::NotFound(result74) } 3 => { - let result73 = mbt_ffi_ptr2str( + let result75 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::RemoteInternalError(result73) + RpcError::RemoteInternalError(result75) } 4 => { - let lifted310 = match mbt_ffi_load8_u(return_area + 8) { + let lifted312 = match mbt_ffi_load8_u(return_area + 8) { 0 => { - let result74 = mbt_ffi_ptr2str( + let result76 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.AgentError::InvalidInput(result74) + @common.AgentError::InvalidInput(result76) } 1 => { - let result75 = mbt_ffi_ptr2str( + let result77 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.AgentError::InvalidMethod(result75) + @common.AgentError::InvalidMethod(result77) } 2 => { - let result76 = mbt_ffi_ptr2str( + let result78 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.AgentError::InvalidType(result76) + @common.AgentError::InvalidType(result78) } 3 => { - let result77 = mbt_ffi_ptr2str( + let result79 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.AgentError::InvalidAgentId(result77) + @common.AgentError::InvalidAgentId(result79) } 4 => { - let array272 : Array[@types.SchemaTypeNode] = [] - for index273 = 0 - index273 < mbt_ffi_load32(return_area + 16) - index273 = index273 + 1 { + let array274 : Array[@types.SchemaTypeNode] = [] + for index275 = 0 + index275 < mbt_ffi_load32(return_area + 16) + index275 = index275 + 1 { let iter_base = mbt_ffi_load32(return_area + 12) + - index273 * 144 + index275 * 144 - let lifted258 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted260 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted83 : @types.NumericRestrictions? = match + let lifted85 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted78 : @types.NumericBound? = match + let lifted80 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { @@ -23453,11 +23523,11 @@ pub fn WasmRpc::invoke( _ => panic() } - let lifted80 : @types.NumericBound? = match + let lifted82 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted79 = match + let lifted81 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23474,46 +23544,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted79) + Option::Some(lifted81) } _ => panic() } - let lifted82 : String? = match + let lifted84 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result81 = mbt_ffi_ptr2str( + let result83 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result81) + Option::Some(result83) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted78, - max: lifted80, - unit: lifted82, + min: lifted80, + max: lifted82, + unit: lifted84, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted83) + @types.SchemaTypeBody::S8Type(lifted85) } 3 => { - let lifted90 : @types.NumericRestrictions? = match + let lifted92 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted85 : @types.NumericBound? = match + let lifted87 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted84 = match + let lifted86 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23530,16 +23600,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted84) + Option::Some(lifted86) } _ => panic() } - let lifted87 : @types.NumericBound? = match + let lifted89 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted86 = match + let lifted88 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23556,46 +23626,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted86) + Option::Some(lifted88) } _ => panic() } - let lifted89 : String? = match + let lifted91 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result88 = mbt_ffi_ptr2str( + let result90 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result88) + Option::Some(result90) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted85, - max: lifted87, - unit: lifted89, + min: lifted87, + max: lifted89, + unit: lifted91, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted90) + @types.SchemaTypeBody::S16Type(lifted92) } 4 => { - let lifted97 : @types.NumericRestrictions? = match + let lifted99 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted92 : @types.NumericBound? = match + let lifted94 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted91 = match + let lifted93 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23612,16 +23682,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted91) + Option::Some(lifted93) } _ => panic() } - let lifted94 : @types.NumericBound? = match + let lifted96 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted93 = match + let lifted95 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23638,46 +23708,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted93) + Option::Some(lifted95) } _ => panic() } - let lifted96 : String? = match + let lifted98 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result95 = mbt_ffi_ptr2str( + let result97 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result95) + Option::Some(result97) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted92, - max: lifted94, - unit: lifted96, + min: lifted94, + max: lifted96, + unit: lifted98, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted97) + @types.SchemaTypeBody::S32Type(lifted99) } 5 => { - let lifted104 : @types.NumericRestrictions? = match + let lifted106 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted99 : @types.NumericBound? = match + let lifted101 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted98 = match + let lifted100 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23694,16 +23764,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted98) + Option::Some(lifted100) } _ => panic() } - let lifted101 : @types.NumericBound? = match + let lifted103 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted100 = match + let lifted102 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23720,46 +23790,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted100) + Option::Some(lifted102) } _ => panic() } - let lifted103 : String? = match + let lifted105 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result102 = mbt_ffi_ptr2str( + let result104 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result102) + Option::Some(result104) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted99, - max: lifted101, - unit: lifted103, + min: lifted101, + max: lifted103, + unit: lifted105, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted104) + @types.SchemaTypeBody::S64Type(lifted106) } 6 => { - let lifted111 : @types.NumericRestrictions? = match + let lifted113 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted106 : @types.NumericBound? = match + let lifted108 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted105 = match + let lifted107 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23776,16 +23846,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted105) + Option::Some(lifted107) } _ => panic() } - let lifted108 : @types.NumericBound? = match + let lifted110 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted107 = match + let lifted109 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23802,46 +23872,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted107) + Option::Some(lifted109) } _ => panic() } - let lifted110 : String? = match + let lifted112 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result109 = mbt_ffi_ptr2str( + let result111 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result109) + Option::Some(result111) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted106, - max: lifted108, - unit: lifted110, + min: lifted108, + max: lifted110, + unit: lifted112, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted111) + @types.SchemaTypeBody::U8Type(lifted113) } 7 => { - let lifted118 : @types.NumericRestrictions? = match + let lifted120 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted113 : @types.NumericBound? = match + let lifted115 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted112 = match + let lifted114 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23858,16 +23928,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted112) + Option::Some(lifted114) } _ => panic() } - let lifted115 : @types.NumericBound? = match + let lifted117 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted114 = match + let lifted116 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23884,46 +23954,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted114) + Option::Some(lifted116) } _ => panic() } - let lifted117 : String? = match + let lifted119 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result116 = mbt_ffi_ptr2str( + let result118 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result116) + Option::Some(result118) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted113, - max: lifted115, - unit: lifted117, + min: lifted115, + max: lifted117, + unit: lifted119, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted118) + @types.SchemaTypeBody::U16Type(lifted120) } 8 => { - let lifted125 : @types.NumericRestrictions? = match + let lifted127 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted120 : @types.NumericBound? = match + let lifted122 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted119 = match + let lifted121 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23940,16 +24010,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted119) + Option::Some(lifted121) } _ => panic() } - let lifted122 : @types.NumericBound? = match + let lifted124 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted121 = match + let lifted123 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23966,46 +24036,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted121) + Option::Some(lifted123) } _ => panic() } - let lifted124 : String? = match + let lifted126 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result123 = mbt_ffi_ptr2str( + let result125 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result123) + Option::Some(result125) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted120, - max: lifted122, - unit: lifted124, + min: lifted122, + max: lifted124, + unit: lifted126, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted125) + @types.SchemaTypeBody::U32Type(lifted127) } 9 => { - let lifted132 : @types.NumericRestrictions? = match + let lifted134 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted127 : @types.NumericBound? = match + let lifted129 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted126 = match + let lifted128 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -24022,16 +24092,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted126) + Option::Some(lifted128) } _ => panic() } - let lifted129 : @types.NumericBound? = match + let lifted131 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted128 = match + let lifted130 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -24048,46 +24118,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted128) + Option::Some(lifted130) } _ => panic() } - let lifted131 : String? = match + let lifted133 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result130 = mbt_ffi_ptr2str( + let result132 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result130) + Option::Some(result132) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted127, - max: lifted129, - unit: lifted131, + min: lifted129, + max: lifted131, + unit: lifted133, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted132) + @types.SchemaTypeBody::U64Type(lifted134) } 10 => { - let lifted139 : @types.NumericRestrictions? = match + let lifted141 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted134 : @types.NumericBound? = match + let lifted136 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted133 = match + let lifted135 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -24104,16 +24174,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted133) + Option::Some(lifted135) } _ => panic() } - let lifted136 : @types.NumericBound? = match + let lifted138 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted135 = match + let lifted137 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -24130,46 +24200,46 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted135) + Option::Some(lifted137) } _ => panic() } - let lifted138 : String? = match + let lifted140 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result137 = mbt_ffi_ptr2str( + let result139 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result137) + Option::Some(result139) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted134, - max: lifted136, - unit: lifted138, + min: lifted136, + max: lifted138, + unit: lifted140, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted139) + @types.SchemaTypeBody::F32Type(lifted141) } 11 => { - let lifted146 : @types.NumericRestrictions? = match + let lifted148 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted141 : @types.NumericBound? = match + let lifted143 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted140 = match + let lifted142 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -24186,16 +24256,16 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted140) + Option::Some(lifted142) } _ => panic() } - let lifted143 : @types.NumericBound? = match + let lifted145 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted142 = match + let lifted144 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -24212,324 +24282,324 @@ pub fn WasmRpc::invoke( _ => panic() } - Option::Some(lifted142) + Option::Some(lifted144) } _ => panic() } - let lifted145 : String? = match + let lifted147 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result144 = mbt_ffi_ptr2str( + let result146 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result144) + Option::Some(result146) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted141, - max: lifted143, - unit: lifted145, + min: lifted143, + max: lifted145, + unit: lifted147, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted146) + @types.SchemaTypeBody::F64Type(lifted148) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array160 : Array[@types.NamedFieldType] = [] - for index161 = 0 - index161 < mbt_ffi_load32(iter_base + 12) - index161 = index161 + 1 { + let array162 : Array[@types.NamedFieldType] = [] + for index163 = 0 + index163 < mbt_ffi_load32(iter_base + 12) + index163 = index163 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index161 * 68 + index163 * 68 - let result147 = mbt_ffi_ptr2str( + let result149 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted149 : String? = match + let lifted151 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result148 = mbt_ffi_ptr2str( + let result150 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result148) + Option::Some(result150) } _ => panic() } let array : Array[String] = [] - for index151 = 0 - index151 < mbt_ffi_load32(iter_base + 28) - index151 = index151 + 1 { + for index153 = 0 + index153 < mbt_ffi_load32(iter_base + 28) + index153 = index153 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index151 * 8 + index153 * 8 - let result150 = mbt_ffi_ptr2str( + let result152 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array.push(result150) + array.push(result152) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array153 : Array[String] = [] - for index154 = 0 - index154 < mbt_ffi_load32(iter_base + 36) - index154 = index154 + 1 { + let array155 : Array[String] = [] + for index156 = 0 + index156 < mbt_ffi_load32(iter_base + 36) + index156 = index156 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index154 * 8 + index156 * 8 - let result152 = mbt_ffi_ptr2str( + let result154 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array153.push(result152) + array155.push(result154) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted156 : String? = match + let lifted158 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result155 = mbt_ffi_ptr2str( + let result157 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result155) + Option::Some(result157) } _ => panic() } - let lifted159 : @types.Role? = match + let lifted161 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted158 = match + let lifted160 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result157 = mbt_ffi_ptr2str( + let result159 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result157) + @types.Role::Other(result159) } _ => panic() } - Option::Some(lifted158) + Option::Some(lifted160) } _ => panic() } - array160.push(@types.NamedFieldType::{ - name: result147, + array162.push(@types.NamedFieldType::{ + name: result149, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted149, + doc: lifted151, aliases: array, - examples: array153, - deprecated: lifted156, - role: lifted159, + examples: array155, + deprecated: lifted158, + role: lifted161, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array160) + @types.SchemaTypeBody::RecordType(array162) } 15 => { - let array177 : Array[@types.VariantCaseType] = [] - for index178 = 0 - index178 < mbt_ffi_load32(iter_base + 12) - index178 = index178 + 1 { + let array179 : Array[@types.VariantCaseType] = [] + for index180 = 0 + index180 < mbt_ffi_load32(iter_base + 12) + index180 = index180 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index178 * 72 + index180 * 72 - let result162 = mbt_ffi_ptr2str( + let result164 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted163 : Int? = match + let lifted165 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted165 : String? = match + let lifted167 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result164 = mbt_ffi_ptr2str( + let result166 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result164) + Option::Some(result166) } _ => panic() } - let array167 : Array[String] = [] - for index168 = 0 - index168 < mbt_ffi_load32(iter_base + 32) - index168 = index168 + 1 { + let array169 : Array[String] = [] + for index170 = 0 + index170 < mbt_ffi_load32(iter_base + 32) + index170 = index170 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index168 * 8 + index170 * 8 - let result166 = mbt_ffi_ptr2str( + let result168 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array167.push(result166) + array169.push(result168) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array170 : Array[String] = [] - for index171 = 0 - index171 < mbt_ffi_load32(iter_base + 40) - index171 = index171 + 1 { + let array172 : Array[String] = [] + for index173 = 0 + index173 < mbt_ffi_load32(iter_base + 40) + index173 = index173 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index171 * 8 + index173 * 8 - let result169 = mbt_ffi_ptr2str( + let result171 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array170.push(result169) + array172.push(result171) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted173 : String? = match + let lifted175 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result172 = mbt_ffi_ptr2str( + let result174 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result172) + Option::Some(result174) } _ => panic() } - let lifted176 : @types.Role? = match + let lifted178 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted175 = match + let lifted177 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result174 = mbt_ffi_ptr2str( + let result176 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result174) + @types.Role::Other(result176) } _ => panic() } - Option::Some(lifted175) + Option::Some(lifted177) } _ => panic() } - array177.push(@types.VariantCaseType::{ - name: result162, - payload: lifted163, + array179.push(@types.VariantCaseType::{ + name: result164, + payload: lifted165, metadata: @types.MetadataEnvelope::{ - doc: lifted165, - aliases: array167, - examples: array170, - deprecated: lifted173, - role: lifted176, + doc: lifted167, + aliases: array169, + examples: array172, + deprecated: lifted175, + role: lifted178, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array177) + @types.SchemaTypeBody::VariantType(array179) } 16 => { - let array180 : Array[String] = [] - for index181 = 0 - index181 < mbt_ffi_load32(iter_base + 12) - index181 = index181 + 1 { + let array182 : Array[String] = [] + for index183 = 0 + index183 < mbt_ffi_load32(iter_base + 12) + index183 = index183 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index181 * 8 + index183 * 8 - let result179 = mbt_ffi_ptr2str( + let result181 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array180.push(result179) + array182.push(result181) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array180) + @types.SchemaTypeBody::EnumType(array182) } 17 => { - let array183 : Array[String] = [] - for index184 = 0 - index184 < mbt_ffi_load32(iter_base + 12) - index184 = index184 + 1 { + let array185 : Array[String] = [] + for index186 = 0 + index186 < mbt_ffi_load32(iter_base + 12) + index186 = index186 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index184 * 8 + index186 * 8 - let result182 = mbt_ffi_ptr2str( + let result184 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array183.push(result182) + array185.push(result184) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array183) + @types.SchemaTypeBody::FlagsType(array185) } 18 => { - let array185 : Array[Int] = [] - for index186 = 0 - index186 < mbt_ffi_load32(iter_base + 12) - index186 = index186 + 1 { + let array187 : Array[Int] = [] + for index188 = 0 + index188 < mbt_ffi_load32(iter_base + 12) + index188 = index188 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index186 * 4 + index188 * 4 - array185.push(mbt_ffi_load32(iter_base + 0)) + array187.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array185) + @types.SchemaTypeBody::TupleType(array187) } 19 => @types.SchemaTypeBody::ListType( @@ -24550,14 +24620,14 @@ pub fn WasmRpc::invoke( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted187 : Int? = match + let lifted189 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted188 : Int? = match + let lifted190 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -24565,37 +24635,37 @@ pub fn WasmRpc::invoke( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted187, - err: lifted188, + ok: lifted189, + err: lifted190, }) } 24 => { - let lifted192 : Array[String]? = match + let lifted194 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array190 : Array[String] = [] - for index191 = 0 - index191 < mbt_ffi_load32(iter_base + 16) - index191 = index191 + 1 { + let array192 : Array[String] = [] + for index193 = 0 + index193 < mbt_ffi_load32(iter_base + 16) + index193 = index193 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index191 * 8 + index193 * 8 - let result189 = mbt_ffi_ptr2str( + let result191 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array190.push(result189) + array192.push(result191) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array190) + Option::Some(array192) } _ => panic() } - let lifted193 : UInt? = match + let lifted195 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -24605,7 +24675,7 @@ pub fn WasmRpc::invoke( _ => panic() } - let lifted194 : UInt? = match + let lifted196 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -24615,54 +24685,54 @@ pub fn WasmRpc::invoke( _ => panic() } - let lifted196 : String? = match + let lifted198 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result195 = mbt_ffi_ptr2str( + let result197 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result195) + Option::Some(result197) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted192, - min_length: lifted193, - max_length: lifted194, - regex: lifted196, + languages: lifted194, + min_length: lifted195, + max_length: lifted196, + regex: lifted198, }) } 25 => { - let lifted200 : Array[String]? = match + let lifted202 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array198 : Array[String] = [] - for index199 = 0 - index199 < mbt_ffi_load32(iter_base + 16) - index199 = index199 + 1 { + let array200 : Array[String] = [] + for index201 = 0 + index201 < mbt_ffi_load32(iter_base + 16) + index201 = index201 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index199 * 8 + index201 * 8 - let result197 = mbt_ffi_ptr2str( + let result199 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array198.push(result197) + array200.push(result199) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array198) + Option::Some(array200) } _ => panic() } - let lifted201 : UInt? = match + let lifted203 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -24672,7 +24742,7 @@ pub fn WasmRpc::invoke( _ => panic() } - let lifted202 : UInt? = match + let lifted204 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -24683,58 +24753,58 @@ pub fn WasmRpc::invoke( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted200, - min_bytes: lifted201, - max_bytes: lifted202, + mime_types: lifted202, + min_bytes: lifted203, + max_bytes: lifted204, }) } 26 => { - let lifted206 : Array[String]? = match + let lifted208 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array204 : Array[String] = [] - for index205 = 0 - index205 < mbt_ffi_load32(iter_base + 20) - index205 = index205 + 1 { + let array206 : Array[String] = [] + for index207 = 0 + index207 < mbt_ffi_load32(iter_base + 20) + index207 = index207 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index205 * 8 + index207 * 8 - let result203 = mbt_ffi_ptr2str( + let result205 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array204.push(result203) + array206.push(result205) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array204) + Option::Some(array206) } _ => panic() } - let lifted210 : Array[String]? = match + let lifted212 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array208 : Array[String] = [] - for index209 = 0 - index209 < mbt_ffi_load32(iter_base + 32) - index209 = index209 + 1 { + let array210 : Array[String] = [] + for index211 = 0 + index211 < mbt_ffi_load32(iter_base + 32) + index211 = index211 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index209 * 8 + index211 * 8 - let result207 = mbt_ffi_ptr2str( + let result209 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array208.push(result207) + array210.push(result209) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array208) + Option::Some(array210) } _ => panic() } @@ -24746,95 +24816,95 @@ pub fn WasmRpc::invoke( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted206, - allowed_extensions: lifted210, + allowed_mime_types: lifted208, + allowed_extensions: lifted212, }) } 27 => { - let lifted214 : Array[String]? = match + let lifted216 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array212 : Array[String] = [] - for index213 = 0 - index213 < mbt_ffi_load32(iter_base + 16) - index213 = index213 + 1 { + let array214 : Array[String] = [] + for index215 = 0 + index215 < mbt_ffi_load32(iter_base + 16) + index215 = index215 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index213 * 8 + index215 * 8 - let result211 = mbt_ffi_ptr2str( + let result213 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array212.push(result211) + array214.push(result213) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array212) + Option::Some(array214) } _ => panic() } - let lifted218 : Array[String]? = match + let lifted220 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array216 : Array[String] = [] - for index217 = 0 - index217 < mbt_ffi_load32(iter_base + 28) - index217 = index217 + 1 { + let array218 : Array[String] = [] + for index219 = 0 + index219 < mbt_ffi_load32(iter_base + 28) + index219 = index219 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index217 * 8 + index219 * 8 - let result215 = mbt_ffi_ptr2str( + let result217 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array216.push(result215) + array218.push(result217) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array216) + Option::Some(array218) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted214, - allowed_hosts: lifted218, + allowed_schemes: lifted216, + allowed_hosts: lifted220, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result219 = mbt_ffi_ptr2str( + let result221 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array221 : Array[String] = [] - for index222 = 0 - index222 < mbt_ffi_load32(iter_base + 20) - index222 = index222 + 1 { + let array223 : Array[String] = [] + for index224 = 0 + index224 < mbt_ffi_load32(iter_base + 20) + index224 = index224 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index222 * 8 + index224 * 8 - let result220 = mbt_ffi_ptr2str( + let result222 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array221.push(result220) + array223.push(result222) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted224 : @types.QuantityValue? = match + let lifted226 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result223 = mbt_ffi_ptr2str( + let result225 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -24842,17 +24912,17 @@ pub fn WasmRpc::invoke( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result223, + unit: result225, }) } _ => panic() } - let lifted226 : @types.QuantityValue? = match + let lifted228 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result225 = mbt_ffi_ptr2str( + let result227 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -24860,401 +24930,401 @@ pub fn WasmRpc::invoke( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result225, + unit: result227, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result219, - allowed_suffixes: array221, - min: lifted224, - max: lifted226, + base_unit: result221, + allowed_suffixes: array223, + min: lifted226, + max: lifted228, }) } 31 => { - let array250 : Array[@types.UnionBranch] = [] - for index251 = 0 - index251 < mbt_ffi_load32(iter_base + 12) - index251 = index251 + 1 { + let array252 : Array[@types.UnionBranch] = [] + for index253 = 0 + index253 < mbt_ffi_load32(iter_base + 12) + index253 = index253 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index251 * 92 + index253 * 92 - let result227 = mbt_ffi_ptr2str( + let result229 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted236 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted238 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result228 = mbt_ffi_ptr2str( + let result230 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result228) + @types.DiscriminatorRule::Prefix(result230) } 1 => { - let result229 = mbt_ffi_ptr2str( + let result231 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result229) + @types.DiscriminatorRule::Suffix(result231) } 2 => { - let result230 = mbt_ffi_ptr2str( + let result232 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result230) + @types.DiscriminatorRule::Contains(result232) } 3 => { - let result231 = mbt_ffi_ptr2str( + let result233 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result231) + @types.DiscriminatorRule::Regex(result233) } 4 => { - let result232 = mbt_ffi_ptr2str( + let result234 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted234 : String? = match + let lifted236 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result233 = mbt_ffi_ptr2str( + let result235 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result233) + Option::Some(result235) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result232, - literal: lifted234, + field_name: result234, + literal: lifted236, }) } 5 => { - let result235 = mbt_ffi_ptr2str( + let result237 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result235) + @types.DiscriminatorRule::FieldAbsent(result237) } _ => panic() } - let lifted238 : String? = match + let lifted240 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result237 = mbt_ffi_ptr2str( + let result239 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result237) + Option::Some(result239) } _ => panic() } - let array240 : Array[String] = [] - for index241 = 0 - index241 < mbt_ffi_load32(iter_base + 52) - index241 = index241 + 1 { + let array242 : Array[String] = [] + for index243 = 0 + index243 < mbt_ffi_load32(iter_base + 52) + index243 = index243 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index241 * 8 + index243 * 8 - let result239 = mbt_ffi_ptr2str( + let result241 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array240.push(result239) + array242.push(result241) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array243 : Array[String] = [] - for index244 = 0 - index244 < mbt_ffi_load32(iter_base + 60) - index244 = index244 + 1 { + let array245 : Array[String] = [] + for index246 = 0 + index246 < mbt_ffi_load32(iter_base + 60) + index246 = index246 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index244 * 8 + index246 * 8 - let result242 = mbt_ffi_ptr2str( + let result244 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array243.push(result242) + array245.push(result244) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted246 : String? = match + let lifted248 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result245 = mbt_ffi_ptr2str( + let result247 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result245) + Option::Some(result247) } _ => panic() } - let lifted249 : @types.Role? = match + let lifted251 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted248 = match + let lifted250 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result247 = mbt_ffi_ptr2str( + let result249 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result247) + @types.Role::Other(result249) } _ => panic() } - Option::Some(lifted248) + Option::Some(lifted250) } _ => panic() } - array250.push(@types.UnionBranch::{ - tag: result227, + array252.push(@types.UnionBranch::{ + tag: result229, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted236, + discriminator: lifted238, metadata: @types.MetadataEnvelope::{ - doc: lifted238, - aliases: array240, - examples: array243, - deprecated: lifted246, - role: lifted249, + doc: lifted240, + aliases: array242, + examples: array245, + deprecated: lifted248, + role: lifted251, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array250, + branches: array252, }) } 32 => { - let lifted253 : String? = match + let lifted255 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result252 = mbt_ffi_ptr2str( + let result254 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result252) + Option::Some(result254) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted253, + category: lifted255, }) } 33 => { - let lifted255 : String? = match + let lifted257 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result254 = mbt_ffi_ptr2str( + let result256 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result254) + Option::Some(result256) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted255, + resource_name: lifted257, }) } 34 => { - let lifted256 : Int? = match + let lifted258 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted256) + @types.SchemaTypeBody::FutureType(lifted258) } 35 => { - let lifted257 : Int? = match + let lifted259 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted257) + @types.SchemaTypeBody::StreamType(lifted259) } _ => panic() } - let lifted260 : String? = match + let lifted262 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result259 = mbt_ffi_ptr2str( + let result261 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result259) + Option::Some(result261) } _ => panic() } - let array262 : Array[String] = [] - for index263 = 0 - index263 < mbt_ffi_load32(iter_base + 104) - index263 = index263 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index263 * 8 + let array264 : Array[String] = [] + for index265 = 0 + index265 < mbt_ffi_load32(iter_base + 104) + index265 = index265 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index265 * 8 - let result261 = mbt_ffi_ptr2str( + let result263 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array262.push(result261) + array264.push(result263) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array265 : Array[String] = [] - for index266 = 0 - index266 < mbt_ffi_load32(iter_base + 112) - index266 = index266 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index266 * 8 + let array267 : Array[String] = [] + for index268 = 0 + index268 < mbt_ffi_load32(iter_base + 112) + index268 = index268 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index268 * 8 - let result264 = mbt_ffi_ptr2str( + let result266 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array265.push(result264) + array267.push(result266) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted268 : String? = match + let lifted270 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result267 = mbt_ffi_ptr2str( + let result269 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result267) + Option::Some(result269) } _ => panic() } - let lifted271 : @types.Role? = match + let lifted273 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted270 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted272 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result269 = mbt_ffi_ptr2str( + let result271 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result269) + @types.Role::Other(result271) } _ => panic() } - Option::Some(lifted270) + Option::Some(lifted272) } _ => panic() } - array272.push(@types.SchemaTypeNode::{ - body: lifted258, + array274.push(@types.SchemaTypeNode::{ + body: lifted260, metadata: @types.MetadataEnvelope::{ - doc: lifted260, - aliases: array262, - examples: array265, - deprecated: lifted268, - role: lifted271, + doc: lifted262, + aliases: array264, + examples: array267, + deprecated: lifted270, + role: lifted273, }, }) } mbt_ffi_free(mbt_ffi_load32(return_area + 12)) - let array277 : Array[@types.SchemaTypeDef] = [] - for index278 = 0 - index278 < mbt_ffi_load32(return_area + 24) - index278 = index278 + 1 { - let iter_base = mbt_ffi_load32(return_area + 20) + index278 * 24 + let array279 : Array[@types.SchemaTypeDef] = [] + for index280 = 0 + index280 < mbt_ffi_load32(return_area + 24) + index280 = index280 + 1 { + let iter_base = mbt_ffi_load32(return_area + 20) + index280 * 24 - let result274 = mbt_ffi_ptr2str( + let result276 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted276 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted278 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result275 = mbt_ffi_ptr2str( + let result277 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result275) + Option::Some(result277) } _ => panic() } - array277.push(@types.SchemaTypeDef::{ - id: result274, - name: lifted276, + array279.push(@types.SchemaTypeDef::{ + id: result276, + name: lifted278, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(return_area + 20)) - let array308 : Array[@types.SchemaValueNode] = [] - for index309 = 0 - index309 < mbt_ffi_load32(return_area + 36) - index309 = index309 + 1 { - let iter_base = mbt_ffi_load32(return_area + 32) + index309 * 32 + let array310 : Array[@types.SchemaValueNode] = [] + for index311 = 0 + index311 < mbt_ffi_load32(return_area + 36) + index311 = index311 + 1 { + let iter_base = mbt_ffi_load32(return_area + 32) + index311 * 32 - let lifted307 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted309 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -25306,29 +25376,29 @@ pub fn WasmRpc::invoke( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result279 = mbt_ffi_ptr2str( + let result281 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result279) + @types.SchemaValueNode::StringValue(result281) } 13 => { - let array280 : Array[Int] = [] - for index281 = 0 - index281 < mbt_ffi_load32(iter_base + 12) - index281 = index281 + 1 { + let array282 : Array[Int] = [] + for index283 = 0 + index283 < mbt_ffi_load32(iter_base + 12) + index283 = index283 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index281 * 4 + index283 * 4 - array280.push(mbt_ffi_load32(iter_base + 0)) + array282.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array280) + @types.SchemaValueNode::RecordValue(array282) } 14 => { - let lifted282 : Int? = match + let lifted284 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -25337,7 +25407,7 @@ pub fn WasmRpc::invoke( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted282, + payload: lifted284, }) } 15 => @@ -25345,34 +25415,20 @@ pub fn WasmRpc::invoke( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array283 : Array[Bool] = [] - for index284 = 0 - index284 < mbt_ffi_load32(iter_base + 12) - index284 = index284 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index284 * 1 - - array283.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array283) - } - 17 => { - let array285 : Array[Int] = [] + let array285 : Array[Bool] = [] for index286 = 0 index286 < mbt_ffi_load32(iter_base + 12) index286 = index286 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index286 * 4 + index286 * 1 - array285.push(mbt_ffi_load32(iter_base + 0)) + array285.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array285) + @types.SchemaValueNode::FlagsValue(array285) } - 18 => { + 17 => { let array287 : Array[Int] = [] for index288 = 0 index288 < mbt_ffi_load32(iter_base + 12) @@ -25384,9 +25440,9 @@ pub fn WasmRpc::invoke( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array287) + @types.SchemaValueNode::TupleValue(array287) } - 19 => { + 18 => { let array289 : Array[Int] = [] for index290 = 0 index290 < mbt_ffi_load32(iter_base + 12) @@ -25398,127 +25454,141 @@ pub fn WasmRpc::invoke( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array289) + @types.SchemaValueNode::ListValue(array289) } - 20 => { - let array291 : Array[@types.MapEntry] = [] + 19 => { + let array291 : Array[Int] = [] for index292 = 0 index292 < mbt_ffi_load32(iter_base + 12) index292 = index292 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index292 * 8 + index292 * 4 + + array291.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array291) + } + 20 => { + let array293 : Array[@types.MapEntry] = [] + for index294 = 0 + index294 < mbt_ffi_load32(iter_base + 12) + index294 = index294 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index294 * 8 - array291.push(@types.MapEntry::{ + array293.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array291) + @types.SchemaValueNode::MapValue(array293) } 21 => { - let lifted293 : Int? = match + let lifted295 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted293) + @types.SchemaValueNode::OptionValue(lifted295) } 22 => { - let lifted296 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted298 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted294 : Int? = match + let lifted296 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted294) + @types.ResultValuePayload::OkValue(lifted296) } 1 => { - let lifted295 : Int? = match + let lifted297 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted295) + @types.ResultValuePayload::ErrValue(lifted297) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted296) + @types.SchemaValueNode::ResultValue(lifted298) } 23 => { - let result297 = mbt_ffi_ptr2str( + let result299 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted299 : String? = match + let lifted301 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result298 = mbt_ffi_ptr2str( + let result300 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result298) + Option::Some(result300) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result297, - language: lifted299, + text: result299, + language: lifted301, }) } 24 => { - let result300 = mbt_ffi_ptr2bytes( + let result302 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted302 : String? = match + let lifted304 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result301 = mbt_ffi_ptr2str( + let result303 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result301) + Option::Some(result303) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result300, - mime_type: lifted302, + bytes: result302, + mime_type: lifted304, }) } 25 => { - let result303 = mbt_ffi_ptr2str( + let result305 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result303) + @types.SchemaValueNode::PathValue(result305) } 26 => { - let result304 = mbt_ffi_ptr2str( + let result306 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result304) + @types.SchemaValueNode::UrlValue(result306) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -25530,7 +25600,7 @@ pub fn WasmRpc::invoke( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result305 = mbt_ffi_ptr2str( + let result307 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -25538,17 +25608,17 @@ pub fn WasmRpc::invoke( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result305, + unit: result307, }) } 30 => { - let result306 = mbt_ffi_ptr2str( + let result308 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result306, + tag: result308, body: mbt_ffi_load32(iter_base + 16), }) } @@ -25562,21 +25632,27 @@ pub fn WasmRpc::invoke( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array308.push(lifted307) + array310.push(lifted309) } mbt_ffi_free(mbt_ffi_load32(return_area + 32)) @common.AgentError::CustomError(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array272, - defs: array277, + type_nodes: array274, + defs: array279, root: mbt_ffi_load32(return_area + 28), }, value: @types.SchemaValueTree::{ - value_nodes: array308, + value_nodes: array310, root: mbt_ffi_load32(return_area + 40), }, }) @@ -25584,18 +25660,18 @@ pub fn WasmRpc::invoke( _ => panic() } - RpcError::RemoteAgentError(lifted310) + RpcError::RemoteAgentError(lifted312) } _ => panic() } - Result::Err(lifted311) + Result::Err(lifted313) } _ => panic() } - let ret = lifted312 + let ret = lifted314 mbt_ffi_free(ptr) - mbt_ffi_free(address67) + mbt_ffi_free(address69) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -25618,10 +25694,10 @@ pub fn WasmRpc::async_invoke_and_await( let ptr = mbt_ffi_str2ptr(method_name) - let address67 = mbt_ffi_malloc(input.value_nodes.length() * 32) - for index68 = 0; index68 < input.value_nodes.length(); index68 = index68 + 1 { - let iter_elem : @types.SchemaValueNode = input.value_nodes[index68] - let iter_base = address67 + index68 * 32 + let address69 = mbt_ffi_malloc(input.value_nodes.length() * 32) + for index70 = 0; index70 < input.value_nodes.length(); index70 = index70 + 1 { + let iter_elem : @types.SchemaValueNode = input.value_nodes[index70] + let iter_base = address69 + index70 * 32 match iter_elem { BoolValue(payload) => { @@ -26018,6 +26094,14 @@ pub fn WasmRpc::async_invoke_and_await( let @types.QuotaToken(handle66) = payload65 mbt_ffi_store32(iter_base + 8, handle66) + () + } + StreamValue(payload67) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle68) = payload67 + mbt_ffi_store32(iter_base + 8, handle68) + () } } @@ -26027,7 +26111,7 @@ pub fn WasmRpc::async_invoke_and_await( handle, ptr, method_name.length(), - address67, + address69, input.value_nodes.length(), input.root, return_area, @@ -26038,21 +26122,21 @@ pub fn WasmRpc::async_invoke_and_await( mbt_ffi_load32(return_area + 4), ) - let result69 = mbt_ffi_ptr2str( + let result71 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) let ret = AsyncInvocationWithMetadata::{ metadata: InvocationMetadata::{ agent_id: result, - idempotency_key: result69, + idempotency_key: result71, }, future: FutureInvokeResult::FutureInvokeResult( mbt_ffi_load32(return_area + 16), ), } mbt_ffi_free(ptr) - mbt_ffi_free(address67) + mbt_ffi_free(address69) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -26073,10 +26157,10 @@ pub fn WasmRpc::schedule_invocation( let ptr = mbt_ffi_str2ptr(method_name) - let address67 = mbt_ffi_malloc(input.value_nodes.length() * 32) - for index68 = 0; index68 < input.value_nodes.length(); index68 = index68 + 1 { - let iter_elem : @types.SchemaValueNode = input.value_nodes[index68] - let iter_base = address67 + index68 * 32 + let address69 = mbt_ffi_malloc(input.value_nodes.length() * 32) + for index70 = 0; index70 < input.value_nodes.length(); index70 = index70 + 1 { + let iter_elem : @types.SchemaValueNode = input.value_nodes[index70] + let iter_base = address69 + index70 * 32 match iter_elem { BoolValue(payload) => { @@ -26473,6 +26557,14 @@ pub fn WasmRpc::schedule_invocation( let @types.QuotaToken(handle66) = payload65 mbt_ffi_store32(iter_base + 8, handle66) + () + } + StreamValue(payload67) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle68) = payload67 + mbt_ffi_store32(iter_base + 8, handle68) + () } } @@ -26484,7 +26576,7 @@ pub fn WasmRpc::schedule_invocation( scheduled_time.nanoseconds.reinterpret_as_int(), ptr, method_name.length(), - address67, + address69, input.value_nodes.length(), input.root, return_area, @@ -26495,18 +26587,18 @@ pub fn WasmRpc::schedule_invocation( mbt_ffi_load32(return_area + 4), ) - let result69 = mbt_ffi_ptr2str( + let result71 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) let ret = ScheduledInvocationReceipt::{ metadata: InvocationMetadata::{ agent_id: result, - idempotency_key: result69, + idempotency_key: result71, }, } mbt_ffi_free(ptr) - mbt_ffi_free(address67) + mbt_ffi_free(address69) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -26529,10 +26621,10 @@ pub fn WasmRpc::schedule_cancelable_invocation( let ptr = mbt_ffi_str2ptr(method_name) - let address67 = mbt_ffi_malloc(input.value_nodes.length() * 32) - for index68 = 0; index68 < input.value_nodes.length(); index68 = index68 + 1 { - let iter_elem : @types.SchemaValueNode = input.value_nodes[index68] - let iter_base = address67 + index68 * 32 + let address69 = mbt_ffi_malloc(input.value_nodes.length() * 32) + for index70 = 0; index70 < input.value_nodes.length(); index70 = index70 + 1 { + let iter_elem : @types.SchemaValueNode = input.value_nodes[index70] + let iter_base = address69 + index70 * 32 match iter_elem { BoolValue(payload) => { @@ -26929,6 +27021,14 @@ pub fn WasmRpc::schedule_cancelable_invocation( let @types.QuotaToken(handle66) = payload65 mbt_ffi_store32(iter_base + 8, handle66) + () + } + StreamValue(payload67) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle68) = payload67 + mbt_ffi_store32(iter_base + 8, handle68) + () } } @@ -26940,7 +27040,7 @@ pub fn WasmRpc::schedule_cancelable_invocation( scheduled_time.nanoseconds.reinterpret_as_int(), ptr, method_name.length(), - address67, + address69, input.value_nodes.length(), input.root, return_area, @@ -26951,21 +27051,21 @@ pub fn WasmRpc::schedule_cancelable_invocation( mbt_ffi_load32(return_area + 4), ) - let result69 = mbt_ffi_ptr2str( + let result71 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) let ret = CancelableScheduledInvocationReceipt::{ metadata: InvocationMetadata::{ agent_id: result, - idempotency_key: result69, + idempotency_key: result71, }, cancellation_token: CancellationToken::CancellationToken( mbt_ffi_load32(return_area + 16), ), } mbt_ffi_free(ptr) - mbt_ffi_free(address67) + mbt_ffi_free(address69) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -27052,6 +27152,10 @@ pub async fn FutureInvokeResult::get( @types.Secret::Secret(mbt_ffi_load32(iter_base + 8)).drop() 32 => @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)).drop() + 33 => + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ).drop() _ => panic() } } @@ -27662,6 +27766,10 @@ pub async fn FutureInvokeResult::get( @types.QuotaToken::QuotaToken( mbt_ffi_load32(iter_base + 8), ).drop() + 33 => + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ).drop() _ => panic() } } @@ -27971,6 +28079,12 @@ pub async fn FutureInvokeResult::get( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -30209,6 +30323,12 @@ pub async fn FutureInvokeResult::get( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -32960,6 +33080,12 @@ pub fn get_config_value( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } diff --git a/sdks/moonbit/golem_sdk/interface/golem/api/context/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/api/context/ffi.mbt index 65d2535283..b3749b7889 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/api/context/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/api/context/ffi.mbt @@ -69,13 +69,6 @@ fn wasmImportMethodInvocationContextGetAttributeChains(p0 : Int, p1 : Int) = "go ///| fn wasmImportMethodInvocationContextTraceContextHeaders(p0 : Int, p1 : Int) = "golem:api/context@1.5.0" "[method]invocation-context.trace-context-headers" -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - ///| #owned(str) extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = @@ -85,6 +78,25 @@ extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) @@ -92,22 +104,10 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 1 call $moonbit.init_array16 #| local.get 0) -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) - ///| extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) - ///| extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) - -///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) diff --git a/sdks/moonbit/golem_sdk/interface/golem/api/host/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/api/host/ffi.mbt index 1edf6fde80..846e6a4bc5 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/api/host/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/api/host/ffi.mbt @@ -150,22 +150,16 @@ fn wasmImportResolveAgentIdStrict( ///| fn wasmImportFork(p0 : Int) = "golem:api/host@1.5.0" "fork" -///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) - -///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) - ///| #owned(bytes) extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = #|(func (param i32) (result i32) local.get 0) +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) + ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) @@ -175,8 +169,19 @@ extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = @@ -185,26 +190,21 @@ extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #| local.get 1 call $moonbit.init_array8 #| local.get 0) +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) + ///| extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) - -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - -///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) diff --git a/sdks/moonbit/golem_sdk/interface/golem/api/oplog/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/api/oplog/ffi.mbt index c4d35b4ab6..2ed6fff7f8 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/api/oplog/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/api/oplog/ffi.mbt @@ -46,100 +46,100 @@ fn wasmImportConstructorSearchOplog( fn wasmImportMethodSearchOplogGetNext(p0 : Int, p1 : Int) = "golem:api/oplog@1.5.0" "[method]search-oplog.get-next" ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) - -///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| -extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend8_s) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| -extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = - #|(func (param i32) (result f32) local.get 0 f32.load) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) ///| extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) + +///| +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/api/oplog/top.mbt b/sdks/moonbit/golem_sdk/interface/golem/api/oplog/top.mbt index bd7d9ddf75..9286181b57 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/api/oplog/top.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/api/oplog/top.mbt @@ -1019,10 +1019,10 @@ pub fn enrich_oplog_entries( let ptr = mbt_ffi_str2ptr(agent_id.agent_id) - let address459 = mbt_ffi_malloc(entries.length() * 216) - for index460 = 0; index460 < entries.length(); index460 = index460 + 1 { - let iter_elem : (UInt64, OplogEntry) = entries[index460] - let iter_base = address459 + index460 * 216 + let address461 = mbt_ffi_malloc(entries.length() * 216) + for index462 = 0; index462 < entries.length(); index462 = index462 + 1 { + let iter_elem : (UInt64, OplogEntry) = entries[index462] + let iter_base = address461 + index462 * 216 mbt_ffi_store64(iter_base + 0, iter_elem.0.reinterpret_as_int64()) match iter_elem.1 { @@ -1142,12 +1142,12 @@ pub fn enrich_oplog_entries( ) mbt_ffi_store32(iter_base + 160, address6) - let address82 = mbt_ffi_malloc(payload.local_agent_config.length() * 20) - for index83 = 0 - index83 < payload.local_agent_config.length() - index83 = index83 + 1 { - let iter_elem : RawLocalAgentConfigEntry = payload.local_agent_config[index83] - let iter_base = address82 + index83 * 20 + let address84 = mbt_ffi_malloc(payload.local_agent_config.length() * 20) + for index85 = 0 + index85 < payload.local_agent_config.length() + index85 = index85 + 1 { + let iter_elem : RawLocalAgentConfigEntry = payload.local_agent_config[index85] + let iter_base = address84 + index85 * 20 let address9 = mbt_ffi_malloc(iter_elem.path.length() * 8) for index10 = 0 @@ -1164,14 +1164,14 @@ pub fn enrich_oplog_entries( mbt_ffi_store32(iter_base + 4, iter_elem.path.length()) mbt_ffi_store32(iter_base + 0, address9) - let address80 = mbt_ffi_malloc( + let address82 = mbt_ffi_malloc( iter_elem.value.value_nodes.length() * 32, ) - for index81 = 0 - index81 < iter_elem.value.value_nodes.length() - index81 = index81 + 1 { - let iter_elem : @types.SchemaValueNode = iter_elem.value.value_nodes[index81] - let iter_base = address80 + index81 * 32 + for index83 = 0 + index83 < iter_elem.value.value_nodes.length() + index83 = index83 + 1 { + let iter_elem : @types.SchemaValueNode = iter_elem.value.value_nodes[index83] + let iter_base = address82 + index83 * 32 match iter_elem { BoolValue(payload11) => { @@ -1583,18 +1583,26 @@ pub fn enrich_oplog_entries( let @types.QuotaToken(handle79) = payload78 mbt_ffi_store32(iter_base + 8, handle79) + () + } + StreamValue(payload80) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle81) = payload80 + mbt_ffi_store32(iter_base + 8, handle81) + () } } } mbt_ffi_store32(iter_base + 12, iter_elem.value.value_nodes.length()) - mbt_ffi_store32(iter_base + 8, address80) + mbt_ffi_store32(iter_base + 8, address82) mbt_ffi_store32(iter_base + 16, iter_elem.value.root) cleanup_list.push(address9) - cleanup_list.push(address80) + cleanup_list.push(address82) } mbt_ffi_store32(iter_base + 172, payload.local_agent_config.length()) - mbt_ffi_store32(iter_base + 168, address82) + mbt_ffi_store32(iter_base + 168, address84) match payload.original_phantom_id { None => { @@ -1602,15 +1610,15 @@ pub fn enrich_oplog_entries( () } - Some(payload85) => { + Some(payload87) => { mbt_ffi_store8(iter_base + 176, 1) mbt_ffi_store64( iter_base + 184, - payload85.high_bits.reinterpret_as_int64(), + payload87.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 192, - payload85.low_bits.reinterpret_as_int64(), + payload87.low_bits.reinterpret_as_int64(), ) () @@ -1627,73 +1635,73 @@ pub fn enrich_oplog_entries( cleanup_list.push(ptr0) cleanup_list.push(address) cleanup_list.push(address6) - cleanup_list.push(address82) + cleanup_list.push(address84) () } - Start(payload86) => { + Start(payload88) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store64(iter_base + 16, payload86.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload88.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload86.timestamp.nanoseconds.reinterpret_as_int(), + payload88.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload86.parent_start_index { + match payload88.parent_start_index { None => { mbt_ffi_store8(iter_base + 32, 0) () } - Some(payload88) => { + Some(payload90) => { mbt_ffi_store8(iter_base + 32, 1) - mbt_ffi_store64(iter_base + 40, payload88.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 40, payload90.reinterpret_as_int64()) () } } - let ptr89 = mbt_ffi_str2ptr(payload86.function_name) - mbt_ffi_store32(iter_base + 52, payload86.function_name.length()) - mbt_ffi_store32(iter_base + 48, ptr89) + let ptr91 = mbt_ffi_str2ptr(payload88.function_name) + mbt_ffi_store32(iter_base + 52, payload88.function_name.length()) + mbt_ffi_store32(iter_base + 48, ptr91) - match payload86.request { + match payload88.request { None => { mbt_ffi_store8(iter_base + 56, 0) () } - Some(payload91) => { + Some(payload93) => { mbt_ffi_store8(iter_base + 56, 1) - match payload91 { - Inline(payload92) => { + match payload93 { + Inline(payload94) => { mbt_ffi_store8(iter_base + 64, 0) - let ptr93 = mbt_ffi_bytes2ptr(payload92) + let ptr95 = mbt_ffi_bytes2ptr(payload94) - mbt_ffi_store32(iter_base + 76, payload92.length()) - mbt_ffi_store32(iter_base + 72, ptr93) - cleanup_list.push(ptr93) + mbt_ffi_store32(iter_base + 76, payload94.length()) + mbt_ffi_store32(iter_base + 72, ptr95) + cleanup_list.push(ptr95) () } - External(payload94) => { + External(payload96) => { mbt_ffi_store8(iter_base + 64, 1) mbt_ffi_store64( iter_base + 72, - payload94.payload_id.high_bits.reinterpret_as_int64(), + payload96.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 80, - payload94.payload_id.low_bits.reinterpret_as_int64(), + payload96.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr95 = mbt_ffi_bytes2ptr(payload94.md5_hash) + let ptr97 = mbt_ffi_bytes2ptr(payload96.md5_hash) - mbt_ffi_store32(iter_base + 92, payload94.md5_hash.length()) - mbt_ffi_store32(iter_base + 88, ptr95) - cleanup_list.push(ptr95) + mbt_ffi_store32(iter_base + 92, payload96.md5_hash.length()) + mbt_ffi_store32(iter_base + 88, ptr97) + cleanup_list.push(ptr97) () } @@ -1703,7 +1711,7 @@ pub fn enrich_oplog_entries( } } - match payload86.durable_function_type { + match payload88.durable_function_type { ReadLocal => { mbt_ffi_store8(iter_base + 96, 0) @@ -1724,20 +1732,20 @@ pub fn enrich_oplog_entries( () } - WriteRemoteBatched(payload100) => { + WriteRemoteBatched(payload102) => { mbt_ffi_store8(iter_base + 96, 4) - match payload100 { + match payload102 { None => { mbt_ffi_store8(iter_base + 104, 0) () } - Some(payload102) => { + Some(payload104) => { mbt_ffi_store8(iter_base + 104, 1) mbt_ffi_store64( iter_base + 112, - payload102.reinterpret_as_int64(), + payload104.reinterpret_as_int64(), ) () @@ -1746,20 +1754,20 @@ pub fn enrich_oplog_entries( () } - WriteRemoteTransaction(payload103) => { + WriteRemoteTransaction(payload105) => { mbt_ffi_store8(iter_base + 96, 5) - match payload103 { + match payload105 { None => { mbt_ffi_store8(iter_base + 104, 0) () } - Some(payload105) => { + Some(payload107) => { mbt_ffi_store8(iter_base + 104, 1) mbt_ffi_store64( iter_base + 112, - payload105.reinterpret_as_int64(), + payload107.reinterpret_as_int64(), ) () @@ -1769,59 +1777,59 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr89) + cleanup_list.push(ptr91) () } - End(payload106) => { + End(payload108) => { mbt_ffi_store8(iter_base + 8, 2) - mbt_ffi_store64(iter_base + 16, payload106.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload108.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload106.timestamp.nanoseconds.reinterpret_as_int(), + payload108.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload106.start_index.reinterpret_as_int64(), + payload108.start_index.reinterpret_as_int64(), ) - match payload106.response { + match payload108.response { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload108) => { + Some(payload110) => { mbt_ffi_store8(iter_base + 40, 1) - match payload108 { - Inline(payload109) => { + match payload110 { + Inline(payload111) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr110 = mbt_ffi_bytes2ptr(payload109) + let ptr112 = mbt_ffi_bytes2ptr(payload111) - mbt_ffi_store32(iter_base + 60, payload109.length()) - mbt_ffi_store32(iter_base + 56, ptr110) - cleanup_list.push(ptr110) + mbt_ffi_store32(iter_base + 60, payload111.length()) + mbt_ffi_store32(iter_base + 56, ptr112) + cleanup_list.push(ptr112) () } - External(payload111) => { + External(payload113) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload111.payload_id.high_bits.reinterpret_as_int64(), + payload113.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 64, - payload111.payload_id.low_bits.reinterpret_as_int64(), + payload113.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr112 = mbt_ffi_bytes2ptr(payload111.md5_hash) + let ptr114 = mbt_ffi_bytes2ptr(payload113.md5_hash) - mbt_ffi_store32(iter_base + 76, payload111.md5_hash.length()) - mbt_ffi_store32(iter_base + 72, ptr112) - cleanup_list.push(ptr112) + mbt_ffi_store32(iter_base + 76, payload113.md5_hash.length()) + mbt_ffi_store32(iter_base + 72, ptr114) + cleanup_list.push(ptr114) () } @@ -1832,7 +1840,7 @@ pub fn enrich_oplog_entries( } mbt_ffi_store8( iter_base + 80, - if payload106.forced_commit { + if payload108.forced_commit { 1 } else { 0 @@ -1841,55 +1849,55 @@ pub fn enrich_oplog_entries( () } - Cancelled(payload113) => { + Cancelled(payload115) => { mbt_ffi_store8(iter_base + 8, 3) - mbt_ffi_store64(iter_base + 16, payload113.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload115.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload113.timestamp.nanoseconds.reinterpret_as_int(), + payload115.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload113.start_index.reinterpret_as_int64(), + payload115.start_index.reinterpret_as_int64(), ) - match payload113.partial { + match payload115.partial { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload115) => { + Some(payload117) => { mbt_ffi_store8(iter_base + 40, 1) - match payload115 { - Inline(payload116) => { + match payload117 { + Inline(payload118) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr117 = mbt_ffi_bytes2ptr(payload116) + let ptr119 = mbt_ffi_bytes2ptr(payload118) - mbt_ffi_store32(iter_base + 60, payload116.length()) - mbt_ffi_store32(iter_base + 56, ptr117) - cleanup_list.push(ptr117) + mbt_ffi_store32(iter_base + 60, payload118.length()) + mbt_ffi_store32(iter_base + 56, ptr119) + cleanup_list.push(ptr119) () } - External(payload118) => { + External(payload120) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload118.payload_id.high_bits.reinterpret_as_int64(), + payload120.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 64, - payload118.payload_id.low_bits.reinterpret_as_int64(), + payload120.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr119 = mbt_ffi_bytes2ptr(payload118.md5_hash) + let ptr121 = mbt_ffi_bytes2ptr(payload120.md5_hash) - mbt_ffi_store32(iter_base + 76, payload118.md5_hash.length()) - mbt_ffi_store32(iter_base + 72, ptr119) - cleanup_list.push(ptr119) + mbt_ffi_store32(iter_base + 76, payload120.md5_hash.length()) + mbt_ffi_store32(iter_base + 72, ptr121) + cleanup_list.push(ptr121) () } @@ -1901,292 +1909,292 @@ pub fn enrich_oplog_entries( () } - AgentInvocationStarted(payload120) => { + AgentInvocationStarted(payload122) => { mbt_ffi_store8(iter_base + 8, 4) - mbt_ffi_store64(iter_base + 16, payload120.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload122.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload120.timestamp.nanoseconds.reinterpret_as_int(), + payload122.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr121 = mbt_ffi_str2ptr(payload120.idempotency_key) - mbt_ffi_store32(iter_base + 36, payload120.idempotency_key.length()) - mbt_ffi_store32(iter_base + 32, ptr121) + let ptr123 = mbt_ffi_str2ptr(payload122.idempotency_key) + mbt_ffi_store32(iter_base + 36, payload122.idempotency_key.length()) + mbt_ffi_store32(iter_base + 32, ptr123) - match payload120.payload { - Inline(payload122) => { + match payload122.payload { + Inline(payload124) => { mbt_ffi_store8(iter_base + 40, 0) - let ptr123 = mbt_ffi_bytes2ptr(payload122) + let ptr125 = mbt_ffi_bytes2ptr(payload124) - mbt_ffi_store32(iter_base + 52, payload122.length()) - mbt_ffi_store32(iter_base + 48, ptr123) - cleanup_list.push(ptr123) + mbt_ffi_store32(iter_base + 52, payload124.length()) + mbt_ffi_store32(iter_base + 48, ptr125) + cleanup_list.push(ptr125) () } - External(payload124) => { + External(payload126) => { mbt_ffi_store8(iter_base + 40, 1) mbt_ffi_store64( iter_base + 48, - payload124.payload_id.high_bits.reinterpret_as_int64(), + payload126.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 56, - payload124.payload_id.low_bits.reinterpret_as_int64(), + payload126.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr125 = mbt_ffi_bytes2ptr(payload124.md5_hash) + let ptr127 = mbt_ffi_bytes2ptr(payload126.md5_hash) - mbt_ffi_store32(iter_base + 68, payload124.md5_hash.length()) - mbt_ffi_store32(iter_base + 64, ptr125) - cleanup_list.push(ptr125) + mbt_ffi_store32(iter_base + 68, payload126.md5_hash.length()) + mbt_ffi_store32(iter_base + 64, ptr127) + cleanup_list.push(ptr127) () } } - let ptr126 = mbt_ffi_str2ptr(payload120.trace_id) - mbt_ffi_store32(iter_base + 76, payload120.trace_id.length()) - mbt_ffi_store32(iter_base + 72, ptr126) + let ptr128 = mbt_ffi_str2ptr(payload122.trace_id) + mbt_ffi_store32(iter_base + 76, payload122.trace_id.length()) + mbt_ffi_store32(iter_base + 72, ptr128) - let address128 = mbt_ffi_malloc(payload120.trace_states.length() * 8) - for index129 = 0 - index129 < payload120.trace_states.length() - index129 = index129 + 1 { - let iter_elem : String = payload120.trace_states[index129] - let iter_base = address128 + index129 * 8 + let address130 = mbt_ffi_malloc(payload122.trace_states.length() * 8) + for index131 = 0 + index131 < payload122.trace_states.length() + index131 = index131 + 1 { + let iter_elem : String = payload122.trace_states[index131] + let iter_base = address130 + index131 * 8 - let ptr127 = mbt_ffi_str2ptr(iter_elem) + let ptr129 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr127) - cleanup_list.push(ptr127) + mbt_ffi_store32(iter_base + 0, ptr129) + cleanup_list.push(ptr129) } - mbt_ffi_store32(iter_base + 84, payload120.trace_states.length()) - mbt_ffi_store32(iter_base + 80, address128) + mbt_ffi_store32(iter_base + 84, payload122.trace_states.length()) + mbt_ffi_store32(iter_base + 80, address130) - let address144 = mbt_ffi_malloc( - payload120.invocation_context.length() * 80, + let address146 = mbt_ffi_malloc( + payload122.invocation_context.length() * 80, ) - for index145 = 0 - index145 < payload120.invocation_context.length() - index145 = index145 + 1 { - let iter_elem : SpanData = payload120.invocation_context[index145] - let iter_base = address144 + index145 * 80 + for index147 = 0 + index147 < payload122.invocation_context.length() + index147 = index147 + 1 { + let iter_elem : SpanData = payload122.invocation_context[index147] + let iter_base = address146 + index147 * 80 match iter_elem { - LocalSpan(payload130) => { + LocalSpan(payload132) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr131 = mbt_ffi_str2ptr(payload130.span_id) - mbt_ffi_store32(iter_base + 12, payload130.span_id.length()) - mbt_ffi_store32(iter_base + 8, ptr131) - mbt_ffi_store64(iter_base + 16, payload130.start.seconds) + let ptr133 = mbt_ffi_str2ptr(payload132.span_id) + mbt_ffi_store32(iter_base + 12, payload132.span_id.length()) + mbt_ffi_store32(iter_base + 8, ptr133) + mbt_ffi_store64(iter_base + 16, payload132.start.seconds) mbt_ffi_store32( iter_base + 24, - payload130.start.nanoseconds.reinterpret_as_int(), + payload132.start.nanoseconds.reinterpret_as_int(), ) - match payload130.parent { + match payload132.parent { None => { mbt_ffi_store8(iter_base + 32, 0) () } - Some(payload133) => { + Some(payload135) => { mbt_ffi_store8(iter_base + 32, 1) - let ptr134 = mbt_ffi_str2ptr(payload133) - mbt_ffi_store32(iter_base + 40, payload133.length()) - mbt_ffi_store32(iter_base + 36, ptr134) - cleanup_list.push(ptr134) + let ptr136 = mbt_ffi_str2ptr(payload135) + mbt_ffi_store32(iter_base + 40, payload135.length()) + mbt_ffi_store32(iter_base + 36, ptr136) + cleanup_list.push(ptr136) () } } - match payload130.linked_context { + match payload132.linked_context { None => { mbt_ffi_store8(iter_base + 48, 0) () } - Some(payload136) => { + Some(payload138) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload136.reinterpret_as_int64(), + payload138.reinterpret_as_int64(), ) () } } - let address140 = mbt_ffi_malloc( - payload130.attributes.length() * 20, + let address142 = mbt_ffi_malloc( + payload132.attributes.length() * 20, ) - for index141 = 0 - index141 < payload130.attributes.length() - index141 = index141 + 1 { - let iter_elem : @context.Attribute = payload130.attributes[index141] - let iter_base = address140 + index141 * 20 + for index143 = 0 + index143 < payload132.attributes.length() + index143 = index143 + 1 { + let iter_elem : @context.Attribute = payload132.attributes[index143] + let iter_base = address142 + index143 * 20 - let ptr137 = mbt_ffi_str2ptr(iter_elem.key) + let ptr139 = mbt_ffi_str2ptr(iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.key.length()) - mbt_ffi_store32(iter_base + 0, ptr137) + mbt_ffi_store32(iter_base + 0, ptr139) match iter_elem.value { - String(payload138) => { + String(payload140) => { mbt_ffi_store8(iter_base + 8, 0) - let ptr139 = mbt_ffi_str2ptr(payload138) - mbt_ffi_store32(iter_base + 16, payload138.length()) - mbt_ffi_store32(iter_base + 12, ptr139) - cleanup_list.push(ptr139) + let ptr141 = mbt_ffi_str2ptr(payload140) + mbt_ffi_store32(iter_base + 16, payload140.length()) + mbt_ffi_store32(iter_base + 12, ptr141) + cleanup_list.push(ptr141) () } } - cleanup_list.push(ptr137) + cleanup_list.push(ptr139) } - mbt_ffi_store32(iter_base + 68, payload130.attributes.length()) - mbt_ffi_store32(iter_base + 64, address140) + mbt_ffi_store32(iter_base + 68, payload132.attributes.length()) + mbt_ffi_store32(iter_base + 64, address142) mbt_ffi_store8( iter_base + 72, - if payload130.inherited { + if payload132.inherited { 1 } else { 0 }, ) - cleanup_list.push(ptr131) - cleanup_list.push(address140) + cleanup_list.push(ptr133) + cleanup_list.push(address142) () } - ExternalSpan(payload142) => { + ExternalSpan(payload144) => { mbt_ffi_store8(iter_base + 0, 1) - let ptr143 = mbt_ffi_str2ptr(payload142.span_id) - mbt_ffi_store32(iter_base + 12, payload142.span_id.length()) - mbt_ffi_store32(iter_base + 8, ptr143) - cleanup_list.push(ptr143) + let ptr145 = mbt_ffi_str2ptr(payload144.span_id) + mbt_ffi_store32(iter_base + 12, payload144.span_id.length()) + mbt_ffi_store32(iter_base + 8, ptr145) + cleanup_list.push(ptr145) () } } } - mbt_ffi_store32(iter_base + 92, payload120.invocation_context.length()) - mbt_ffi_store32(iter_base + 88, address144) - cleanup_list.push(ptr121) - cleanup_list.push(ptr126) - cleanup_list.push(address128) - cleanup_list.push(address144) + mbt_ffi_store32(iter_base + 92, payload122.invocation_context.length()) + mbt_ffi_store32(iter_base + 88, address146) + cleanup_list.push(ptr123) + cleanup_list.push(ptr128) + cleanup_list.push(address130) + cleanup_list.push(address146) () } - AgentInvocationFinished(payload146) => { + AgentInvocationFinished(payload148) => { mbt_ffi_store8(iter_base + 8, 5) - mbt_ffi_store64(iter_base + 16, payload146.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload148.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload146.timestamp.nanoseconds.reinterpret_as_int(), + payload148.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload146.result { - Inline(payload147) => { + match payload148.result { + Inline(payload149) => { mbt_ffi_store8(iter_base + 32, 0) - let ptr148 = mbt_ffi_bytes2ptr(payload147) + let ptr150 = mbt_ffi_bytes2ptr(payload149) - mbt_ffi_store32(iter_base + 44, payload147.length()) - mbt_ffi_store32(iter_base + 40, ptr148) - cleanup_list.push(ptr148) + mbt_ffi_store32(iter_base + 44, payload149.length()) + mbt_ffi_store32(iter_base + 40, ptr150) + cleanup_list.push(ptr150) () } - External(payload149) => { + External(payload151) => { mbt_ffi_store8(iter_base + 32, 1) mbt_ffi_store64( iter_base + 40, - payload149.payload_id.high_bits.reinterpret_as_int64(), + payload151.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload149.payload_id.low_bits.reinterpret_as_int64(), + payload151.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr150 = mbt_ffi_bytes2ptr(payload149.md5_hash) + let ptr152 = mbt_ffi_bytes2ptr(payload151.md5_hash) - mbt_ffi_store32(iter_base + 60, payload149.md5_hash.length()) - mbt_ffi_store32(iter_base + 56, ptr150) - cleanup_list.push(ptr150) + mbt_ffi_store32(iter_base + 60, payload151.md5_hash.length()) + mbt_ffi_store32(iter_base + 56, ptr152) + cleanup_list.push(ptr152) () } } - match payload146.method_name { + match payload148.method_name { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload152) => { + Some(payload154) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr153 = mbt_ffi_str2ptr(payload152) - mbt_ffi_store32(iter_base + 72, payload152.length()) - mbt_ffi_store32(iter_base + 68, ptr153) - cleanup_list.push(ptr153) + let ptr155 = mbt_ffi_str2ptr(payload154) + mbt_ffi_store32(iter_base + 72, payload154.length()) + mbt_ffi_store32(iter_base + 68, ptr155) + cleanup_list.push(ptr155) () } } - mbt_ffi_store64(iter_base + 80, payload146.consumed_fuel) + mbt_ffi_store64(iter_base + 80, payload148.consumed_fuel) mbt_ffi_store64( iter_base + 88, - payload146.component_revision.reinterpret_as_int64(), + payload148.component_revision.reinterpret_as_int64(), ) () } - Suspend(payload154) => { + Suspend(payload156) => { mbt_ffi_store8(iter_base + 8, 6) - mbt_ffi_store64(iter_base + 16, payload154.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload156.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload154.timestamp.nanoseconds.reinterpret_as_int(), + payload156.timestamp.nanoseconds.reinterpret_as_int(), ) () } - Error(payload155) => { + Error(payload157) => { mbt_ffi_store8(iter_base + 8, 7) - mbt_ffi_store64(iter_base + 16, payload155.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload157.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload155.timestamp.nanoseconds.reinterpret_as_int(), + payload157.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload155.error { - Unknown(payload156) => { + match payload157.error { + Unknown(payload158) => { mbt_ffi_store8(iter_base + 32, 0) - let ptr157 = mbt_ffi_str2ptr(payload156) - mbt_ffi_store32(iter_base + 44, payload156.length()) - mbt_ffi_store32(iter_base + 40, ptr157) - cleanup_list.push(ptr157) + let ptr159 = mbt_ffi_str2ptr(payload158) + mbt_ffi_store32(iter_base + 44, payload158.length()) + mbt_ffi_store32(iter_base + 40, ptr159) + cleanup_list.push(ptr159) () } - InvalidRequest(payload158) => { + InvalidRequest(payload160) => { mbt_ffi_store8(iter_base + 32, 1) - let ptr159 = mbt_ffi_str2ptr(payload158) - mbt_ffi_store32(iter_base + 44, payload158.length()) - mbt_ffi_store32(iter_base + 40, ptr159) - cleanup_list.push(ptr159) + let ptr161 = mbt_ffi_str2ptr(payload160) + mbt_ffi_store32(iter_base + 44, payload160.length()) + mbt_ffi_store32(iter_base + 40, ptr161) + cleanup_list.push(ptr161) () } @@ -2205,19 +2213,9 @@ pub fn enrich_oplog_entries( () } - InternalError(payload163) => { + InternalError(payload165) => { mbt_ffi_store8(iter_base + 32, 5) - let ptr164 = mbt_ffi_str2ptr(payload163) - mbt_ffi_store32(iter_base + 44, payload163.length()) - mbt_ffi_store32(iter_base + 40, ptr164) - cleanup_list.push(ptr164) - - () - } - DeterministicTrap(payload165) => { - mbt_ffi_store8(iter_base + 32, 6) - let ptr166 = mbt_ffi_str2ptr(payload165) mbt_ffi_store32(iter_base + 44, payload165.length()) mbt_ffi_store32(iter_base + 40, ptr166) @@ -2225,8 +2223,8 @@ pub fn enrich_oplog_entries( () } - TransientError(payload167) => { - mbt_ffi_store8(iter_base + 32, 7) + DeterministicTrap(payload167) => { + mbt_ffi_store8(iter_base + 32, 6) let ptr168 = mbt_ffi_str2ptr(payload167) mbt_ffi_store32(iter_base + 44, payload167.length()) @@ -2235,8 +2233,8 @@ pub fn enrich_oplog_entries( () } - PermanentError(payload169) => { - mbt_ffi_store8(iter_base + 32, 8) + TransientError(payload169) => { + mbt_ffi_store8(iter_base + 32, 7) let ptr170 = mbt_ffi_str2ptr(payload169) mbt_ffi_store32(iter_base + 44, payload169.length()) @@ -2245,6 +2243,16 @@ pub fn enrich_oplog_entries( () } + PermanentError(payload171) => { + mbt_ffi_store8(iter_base + 32, 8) + + let ptr172 = mbt_ffi_str2ptr(payload171) + mbt_ffi_store32(iter_base + 44, payload171.length()) + mbt_ffi_store32(iter_base + 40, ptr172) + cleanup_list.push(ptr172) + + () + } ExceededTableLimit => { mbt_ffi_store8(iter_base + 32, 9) @@ -2270,107 +2278,107 @@ pub fn enrich_oplog_entries( () } - AgentTerminatedByQuota(payload176) => { + AgentTerminatedByQuota(payload178) => { mbt_ffi_store8(iter_base + 32, 14) mbt_ffi_store64( iter_base + 40, - payload176.environment_id.uuid.high_bits.reinterpret_as_int64(), + payload178.environment_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload176.environment_id.uuid.low_bits.reinterpret_as_int64(), + payload178.environment_id.uuid.low_bits.reinterpret_as_int64(), ) - let ptr177 = mbt_ffi_str2ptr(payload176.resource_name) - mbt_ffi_store32(iter_base + 60, payload176.resource_name.length()) - mbt_ffi_store32(iter_base + 56, ptr177) - cleanup_list.push(ptr177) + let ptr179 = mbt_ffi_str2ptr(payload178.resource_name) + mbt_ffi_store32(iter_base + 60, payload178.resource_name.length()) + mbt_ffi_store32(iter_base + 56, ptr179) + cleanup_list.push(ptr179) () } - EphemeralSleepTooLong(payload178) => { + EphemeralSleepTooLong(payload180) => { mbt_ffi_store8(iter_base + 32, 15) mbt_ffi_store64( iter_base + 40, - payload178.requested_nanos.reinterpret_as_int64(), + payload180.requested_nanos.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload178.max_nanos.reinterpret_as_int64(), + payload180.max_nanos.reinterpret_as_int64(), ) () } - EphemeralFuelExhausted(payload179) => { + EphemeralFuelExhausted(payload181) => { mbt_ffi_store8(iter_base + 32, 16) mbt_ffi_store64( iter_base + 40, - payload179.overdraft_limit.reinterpret_as_int64(), + payload181.overdraft_limit.reinterpret_as_int64(), ) () } - EphemeralCannotSuspend(payload180) => { + EphemeralCannotSuspend(payload182) => { mbt_ffi_store8(iter_base + 32, 17) - let ptr181 = mbt_ffi_str2ptr(payload180.reason) - mbt_ffi_store32(iter_base + 44, payload180.reason.length()) - mbt_ffi_store32(iter_base + 40, ptr181) - cleanup_list.push(ptr181) + let ptr183 = mbt_ffi_str2ptr(payload182.reason) + mbt_ffi_store32(iter_base + 44, payload182.reason.length()) + mbt_ffi_store32(iter_base + 40, ptr183) + cleanup_list.push(ptr183) () } - ReadOnlyViolation(payload182) => { + ReadOnlyViolation(payload184) => { mbt_ffi_store8(iter_base + 32, 18) - let ptr183 = mbt_ffi_str2ptr(payload182.method_) - mbt_ffi_store32(iter_base + 44, payload182.method_.length()) - mbt_ffi_store32(iter_base + 40, ptr183) + let ptr185 = mbt_ffi_str2ptr(payload184.method_) + mbt_ffi_store32(iter_base + 44, payload184.method_.length()) + mbt_ffi_store32(iter_base + 40, ptr185) - let ptr184 = mbt_ffi_str2ptr(payload182.host_function) - mbt_ffi_store32(iter_base + 52, payload182.host_function.length()) - mbt_ffi_store32(iter_base + 48, ptr184) - cleanup_list.push(ptr183) - cleanup_list.push(ptr184) + let ptr186 = mbt_ffi_str2ptr(payload184.host_function) + mbt_ffi_store32(iter_base + 52, payload184.host_function.length()) + mbt_ffi_store32(iter_base + 48, ptr186) + cleanup_list.push(ptr185) + cleanup_list.push(ptr186) () } } mbt_ffi_store64( iter_base + 64, - payload155.retry_from.reinterpret_as_int64(), + payload157.retry_from.reinterpret_as_int64(), ) mbt_ffi_store8( iter_base + 72, - if payload155.inside_atomic_region { + if payload157.inside_atomic_region { 1 } else { 0 }, ) - match payload155.retry_policy_state { + match payload157.retry_policy_state { None => { mbt_ffi_store8(iter_base + 76, 0) () } - Some(payload186) => { + Some(payload188) => { mbt_ffi_store8(iter_base + 76, 1) - let address193 = mbt_ffi_malloc(payload186.nodes.length() * 16) - for index194 = 0 - index194 < payload186.nodes.length() - index194 = index194 + 1 { - let iter_elem : StateNode = payload186.nodes[index194] - let iter_base = address193 + index194 * 16 + let address195 = mbt_ffi_malloc(payload188.nodes.length() * 16) + for index196 = 0 + index196 < payload188.nodes.length() + index196 = index196 + 1 { + let iter_elem : StateNode = payload188.nodes[index196] + let iter_base = address195 + index196 * 16 match iter_elem { - Counter(payload187) => { + Counter(payload189) => { mbt_ffi_store8(iter_base + 0, 0) mbt_ffi_store32( iter_base + 4, - payload187.reinterpret_as_int(), + payload189.reinterpret_as_int(), ) () @@ -2380,29 +2388,29 @@ pub fn enrich_oplog_entries( () } - Wrapper(payload189) => { + Wrapper(payload191) => { mbt_ffi_store8(iter_base + 0, 2) - mbt_ffi_store32(iter_base + 4, payload189) + mbt_ffi_store32(iter_base + 4, payload191) () } - CountBox(payload190) => { + CountBox(payload192) => { mbt_ffi_store8(iter_base + 0, 3) mbt_ffi_store32( iter_base + 4, - payload190.attempts.reinterpret_as_int(), + payload192.attempts.reinterpret_as_int(), ) - mbt_ffi_store32(iter_base + 8, payload190.inner) + mbt_ffi_store32(iter_base + 8, payload192.inner) () } - AndThen(payload191) => { + AndThen(payload193) => { mbt_ffi_store8(iter_base + 0, 4) - mbt_ffi_store32(iter_base + 4, payload191.left) - mbt_ffi_store32(iter_base + 8, payload191.right) + mbt_ffi_store32(iter_base + 4, payload193.left) + mbt_ffi_store32(iter_base + 8, payload193.right) mbt_ffi_store8( iter_base + 12, - if payload191.on_right { + if payload193.on_right { 1 } else { 0 @@ -2411,18 +2419,18 @@ pub fn enrich_oplog_entries( () } - Pair(payload192) => { + Pair(payload194) => { mbt_ffi_store8(iter_base + 0, 5) - mbt_ffi_store32(iter_base + 4, payload192.left) - mbt_ffi_store32(iter_base + 8, payload192.right) + mbt_ffi_store32(iter_base + 4, payload194.left) + mbt_ffi_store32(iter_base + 8, payload194.right) () } } } - mbt_ffi_store32(iter_base + 84, payload186.nodes.length()) - mbt_ffi_store32(iter_base + 80, address193) - cleanup_list.push(address193) + mbt_ffi_store32(iter_base + 84, payload188.nodes.length()) + mbt_ffi_store32(iter_base + 80, address195) + cleanup_list.push(address195) () } @@ -2430,321 +2438,321 @@ pub fn enrich_oplog_entries( () } - NoOp(payload195) => { + NoOp(payload197) => { mbt_ffi_store8(iter_base + 8, 8) - mbt_ffi_store64(iter_base + 16, payload195.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload197.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload195.timestamp.nanoseconds.reinterpret_as_int(), + payload197.timestamp.nanoseconds.reinterpret_as_int(), ) () } - Jump(payload196) => { + Jump(payload198) => { mbt_ffi_store8(iter_base + 8, 9) - mbt_ffi_store64(iter_base + 16, payload196.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload198.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload196.timestamp.nanoseconds.reinterpret_as_int(), + payload198.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload196.jump.start.reinterpret_as_int64(), + payload198.jump.start.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload196.jump.end.reinterpret_as_int64(), + payload198.jump.end.reinterpret_as_int64(), ) () } - Interrupted(payload197) => { + Interrupted(payload199) => { mbt_ffi_store8(iter_base + 8, 10) - mbt_ffi_store64(iter_base + 16, payload197.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload199.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload197.timestamp.nanoseconds.reinterpret_as_int(), + payload199.timestamp.nanoseconds.reinterpret_as_int(), ) () } - Exited(payload198) => { + Exited(payload200) => { mbt_ffi_store8(iter_base + 8, 11) - mbt_ffi_store64(iter_base + 16, payload198.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload200.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload198.timestamp.nanoseconds.reinterpret_as_int(), + payload200.timestamp.nanoseconds.reinterpret_as_int(), ) () } - BeginAtomicRegion(payload199) => { + BeginAtomicRegion(payload201) => { mbt_ffi_store8(iter_base + 8, 12) - mbt_ffi_store64(iter_base + 16, payload199.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload201.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload199.timestamp.nanoseconds.reinterpret_as_int(), + payload201.timestamp.nanoseconds.reinterpret_as_int(), ) () } - EndAtomicRegion(payload200) => { + EndAtomicRegion(payload202) => { mbt_ffi_store8(iter_base + 8, 13) - mbt_ffi_store64(iter_base + 16, payload200.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload202.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload200.timestamp.nanoseconds.reinterpret_as_int(), + payload202.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload200.begin_index.reinterpret_as_int64(), + payload202.begin_index.reinterpret_as_int64(), ) () } - PendingAgentInvocation(payload201) => { + PendingAgentInvocation(payload203) => { mbt_ffi_store8(iter_base + 8, 14) - mbt_ffi_store64(iter_base + 16, payload201.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload203.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload201.timestamp.nanoseconds.reinterpret_as_int(), + payload203.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr202 = mbt_ffi_str2ptr(payload201.idempotency_key) - mbt_ffi_store32(iter_base + 36, payload201.idempotency_key.length()) - mbt_ffi_store32(iter_base + 32, ptr202) + let ptr204 = mbt_ffi_str2ptr(payload203.idempotency_key) + mbt_ffi_store32(iter_base + 36, payload203.idempotency_key.length()) + mbt_ffi_store32(iter_base + 32, ptr204) - match payload201.payload { - Inline(payload203) => { + match payload203.payload { + Inline(payload205) => { mbt_ffi_store8(iter_base + 40, 0) - let ptr204 = mbt_ffi_bytes2ptr(payload203) + let ptr206 = mbt_ffi_bytes2ptr(payload205) - mbt_ffi_store32(iter_base + 52, payload203.length()) - mbt_ffi_store32(iter_base + 48, ptr204) - cleanup_list.push(ptr204) + mbt_ffi_store32(iter_base + 52, payload205.length()) + mbt_ffi_store32(iter_base + 48, ptr206) + cleanup_list.push(ptr206) () } - External(payload205) => { + External(payload207) => { mbt_ffi_store8(iter_base + 40, 1) mbt_ffi_store64( iter_base + 48, - payload205.payload_id.high_bits.reinterpret_as_int64(), + payload207.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 56, - payload205.payload_id.low_bits.reinterpret_as_int64(), + payload207.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr206 = mbt_ffi_bytes2ptr(payload205.md5_hash) + let ptr208 = mbt_ffi_bytes2ptr(payload207.md5_hash) - mbt_ffi_store32(iter_base + 68, payload205.md5_hash.length()) - mbt_ffi_store32(iter_base + 64, ptr206) - cleanup_list.push(ptr206) + mbt_ffi_store32(iter_base + 68, payload207.md5_hash.length()) + mbt_ffi_store32(iter_base + 64, ptr208) + cleanup_list.push(ptr208) () } } - let ptr207 = mbt_ffi_str2ptr(payload201.trace_id) - mbt_ffi_store32(iter_base + 76, payload201.trace_id.length()) - mbt_ffi_store32(iter_base + 72, ptr207) + let ptr209 = mbt_ffi_str2ptr(payload203.trace_id) + mbt_ffi_store32(iter_base + 76, payload203.trace_id.length()) + mbt_ffi_store32(iter_base + 72, ptr209) - let address209 = mbt_ffi_malloc(payload201.trace_states.length() * 8) - for index210 = 0 - index210 < payload201.trace_states.length() - index210 = index210 + 1 { - let iter_elem : String = payload201.trace_states[index210] - let iter_base = address209 + index210 * 8 + let address211 = mbt_ffi_malloc(payload203.trace_states.length() * 8) + for index212 = 0 + index212 < payload203.trace_states.length() + index212 = index212 + 1 { + let iter_elem : String = payload203.trace_states[index212] + let iter_base = address211 + index212 * 8 - let ptr208 = mbt_ffi_str2ptr(iter_elem) + let ptr210 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr208) - cleanup_list.push(ptr208) + mbt_ffi_store32(iter_base + 0, ptr210) + cleanup_list.push(ptr210) } - mbt_ffi_store32(iter_base + 84, payload201.trace_states.length()) - mbt_ffi_store32(iter_base + 80, address209) + mbt_ffi_store32(iter_base + 84, payload203.trace_states.length()) + mbt_ffi_store32(iter_base + 80, address211) - let address225 = mbt_ffi_malloc( - payload201.invocation_context.length() * 80, + let address227 = mbt_ffi_malloc( + payload203.invocation_context.length() * 80, ) - for index226 = 0 - index226 < payload201.invocation_context.length() - index226 = index226 + 1 { - let iter_elem : SpanData = payload201.invocation_context[index226] - let iter_base = address225 + index226 * 80 + for index228 = 0 + index228 < payload203.invocation_context.length() + index228 = index228 + 1 { + let iter_elem : SpanData = payload203.invocation_context[index228] + let iter_base = address227 + index228 * 80 match iter_elem { - LocalSpan(payload211) => { + LocalSpan(payload213) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr212 = mbt_ffi_str2ptr(payload211.span_id) - mbt_ffi_store32(iter_base + 12, payload211.span_id.length()) - mbt_ffi_store32(iter_base + 8, ptr212) - mbt_ffi_store64(iter_base + 16, payload211.start.seconds) + let ptr214 = mbt_ffi_str2ptr(payload213.span_id) + mbt_ffi_store32(iter_base + 12, payload213.span_id.length()) + mbt_ffi_store32(iter_base + 8, ptr214) + mbt_ffi_store64(iter_base + 16, payload213.start.seconds) mbt_ffi_store32( iter_base + 24, - payload211.start.nanoseconds.reinterpret_as_int(), + payload213.start.nanoseconds.reinterpret_as_int(), ) - match payload211.parent { + match payload213.parent { None => { mbt_ffi_store8(iter_base + 32, 0) () } - Some(payload214) => { + Some(payload216) => { mbt_ffi_store8(iter_base + 32, 1) - let ptr215 = mbt_ffi_str2ptr(payload214) - mbt_ffi_store32(iter_base + 40, payload214.length()) - mbt_ffi_store32(iter_base + 36, ptr215) - cleanup_list.push(ptr215) + let ptr217 = mbt_ffi_str2ptr(payload216) + mbt_ffi_store32(iter_base + 40, payload216.length()) + mbt_ffi_store32(iter_base + 36, ptr217) + cleanup_list.push(ptr217) () } } - match payload211.linked_context { + match payload213.linked_context { None => { mbt_ffi_store8(iter_base + 48, 0) () } - Some(payload217) => { + Some(payload219) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload217.reinterpret_as_int64(), + payload219.reinterpret_as_int64(), ) () } } - let address221 = mbt_ffi_malloc( - payload211.attributes.length() * 20, + let address223 = mbt_ffi_malloc( + payload213.attributes.length() * 20, ) - for index222 = 0 - index222 < payload211.attributes.length() - index222 = index222 + 1 { - let iter_elem : @context.Attribute = payload211.attributes[index222] - let iter_base = address221 + index222 * 20 + for index224 = 0 + index224 < payload213.attributes.length() + index224 = index224 + 1 { + let iter_elem : @context.Attribute = payload213.attributes[index224] + let iter_base = address223 + index224 * 20 - let ptr218 = mbt_ffi_str2ptr(iter_elem.key) + let ptr220 = mbt_ffi_str2ptr(iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.key.length()) - mbt_ffi_store32(iter_base + 0, ptr218) + mbt_ffi_store32(iter_base + 0, ptr220) match iter_elem.value { - String(payload219) => { + String(payload221) => { mbt_ffi_store8(iter_base + 8, 0) - let ptr220 = mbt_ffi_str2ptr(payload219) - mbt_ffi_store32(iter_base + 16, payload219.length()) - mbt_ffi_store32(iter_base + 12, ptr220) - cleanup_list.push(ptr220) + let ptr222 = mbt_ffi_str2ptr(payload221) + mbt_ffi_store32(iter_base + 16, payload221.length()) + mbt_ffi_store32(iter_base + 12, ptr222) + cleanup_list.push(ptr222) () } } - cleanup_list.push(ptr218) + cleanup_list.push(ptr220) } - mbt_ffi_store32(iter_base + 68, payload211.attributes.length()) - mbt_ffi_store32(iter_base + 64, address221) + mbt_ffi_store32(iter_base + 68, payload213.attributes.length()) + mbt_ffi_store32(iter_base + 64, address223) mbt_ffi_store8( iter_base + 72, - if payload211.inherited { + if payload213.inherited { 1 } else { 0 }, ) - cleanup_list.push(ptr212) - cleanup_list.push(address221) + cleanup_list.push(ptr214) + cleanup_list.push(address223) () } - ExternalSpan(payload223) => { + ExternalSpan(payload225) => { mbt_ffi_store8(iter_base + 0, 1) - let ptr224 = mbt_ffi_str2ptr(payload223.span_id) - mbt_ffi_store32(iter_base + 12, payload223.span_id.length()) - mbt_ffi_store32(iter_base + 8, ptr224) - cleanup_list.push(ptr224) + let ptr226 = mbt_ffi_str2ptr(payload225.span_id) + mbt_ffi_store32(iter_base + 12, payload225.span_id.length()) + mbt_ffi_store32(iter_base + 8, ptr226) + cleanup_list.push(ptr226) () } } } - mbt_ffi_store32(iter_base + 92, payload201.invocation_context.length()) - mbt_ffi_store32(iter_base + 88, address225) - cleanup_list.push(ptr202) - cleanup_list.push(ptr207) - cleanup_list.push(address209) - cleanup_list.push(address225) + mbt_ffi_store32(iter_base + 92, payload203.invocation_context.length()) + mbt_ffi_store32(iter_base + 88, address227) + cleanup_list.push(ptr204) + cleanup_list.push(ptr209) + cleanup_list.push(address211) + cleanup_list.push(address227) () } - PendingUpdate(payload227) => { + PendingUpdate(payload229) => { mbt_ffi_store8(iter_base + 8, 15) - mbt_ffi_store64(iter_base + 16, payload227.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload229.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload227.timestamp.nanoseconds.reinterpret_as_int(), + payload229.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload227.description { - Automatic(payload228) => { + match payload229.description { + Automatic(payload230) => { mbt_ffi_store8(iter_base + 32, 0) - mbt_ffi_store64(iter_base + 40, payload228.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 40, payload230.reinterpret_as_int64()) () } - SnapshotBased(payload229) => { + SnapshotBased(payload231) => { mbt_ffi_store8(iter_base + 32, 1) mbt_ffi_store64( iter_base + 40, - payload229.target_revision.reinterpret_as_int64(), + payload231.target_revision.reinterpret_as_int64(), ) - match payload229.payload { - Inline(payload230) => { + match payload231.payload { + Inline(payload232) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr231 = mbt_ffi_bytes2ptr(payload230) + let ptr233 = mbt_ffi_bytes2ptr(payload232) - mbt_ffi_store32(iter_base + 60, payload230.length()) - mbt_ffi_store32(iter_base + 56, ptr231) - cleanup_list.push(ptr231) + mbt_ffi_store32(iter_base + 60, payload232.length()) + mbt_ffi_store32(iter_base + 56, ptr233) + cleanup_list.push(ptr233) () } - External(payload232) => { + External(payload234) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload232.payload_id.high_bits.reinterpret_as_int64(), + payload234.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 64, - payload232.payload_id.low_bits.reinterpret_as_int64(), + payload234.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr233 = mbt_ffi_bytes2ptr(payload232.md5_hash) + let ptr235 = mbt_ffi_bytes2ptr(payload234.md5_hash) - mbt_ffi_store32(iter_base + 76, payload232.md5_hash.length()) - mbt_ffi_store32(iter_base + 72, ptr233) - cleanup_list.push(ptr233) + mbt_ffi_store32(iter_base + 76, payload234.md5_hash.length()) + mbt_ffi_store32(iter_base + 72, ptr235) + cleanup_list.push(ptr235) () } } - let ptr234 = mbt_ffi_str2ptr(payload229.mime_type) - mbt_ffi_store32(iter_base + 84, payload229.mime_type.length()) - mbt_ffi_store32(iter_base + 80, ptr234) - cleanup_list.push(ptr234) + let ptr236 = mbt_ffi_str2ptr(payload231.mime_type) + mbt_ffi_store32(iter_base + 84, payload231.mime_type.length()) + mbt_ffi_store32(iter_base + 80, ptr236) + cleanup_list.push(ptr236) () } @@ -2752,30 +2760,30 @@ pub fn enrich_oplog_entries( () } - SuccessfulUpdate(payload235) => { + SuccessfulUpdate(payload237) => { mbt_ffi_store8(iter_base + 8, 16) - mbt_ffi_store64(iter_base + 16, payload235.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload237.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload235.timestamp.nanoseconds.reinterpret_as_int(), + payload237.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload235.target_revision.reinterpret_as_int64(), + payload237.target_revision.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload235.new_component_size.reinterpret_as_int64(), + payload237.new_component_size.reinterpret_as_int64(), ) - let address236 = mbt_ffi_malloc( - payload235.new_active_plugins.length() * 16, + let address238 = mbt_ffi_malloc( + payload237.new_active_plugins.length() * 16, ) - for index237 = 0 - index237 < payload235.new_active_plugins.length() - index237 = index237 + 1 { - let iter_elem : EnvironmentPluginGrantId = payload235.new_active_plugins[index237] - let iter_base = address236 + index237 * 16 + for index239 = 0 + index239 < payload237.new_active_plugins.length() + index239 = index239 + 1 { + let iter_elem : EnvironmentPluginGrantId = payload237.new_active_plugins[index239] + let iter_base = address238 + index239 * 16 mbt_ffi_store64( iter_base + 0, iter_elem.uuid.high_bits.reinterpret_as_int64(), @@ -2785,37 +2793,37 @@ pub fn enrich_oplog_entries( iter_elem.uuid.low_bits.reinterpret_as_int64(), ) } - mbt_ffi_store32(iter_base + 52, payload235.new_active_plugins.length()) - mbt_ffi_store32(iter_base + 48, address236) - cleanup_list.push(address236) + mbt_ffi_store32(iter_base + 52, payload237.new_active_plugins.length()) + mbt_ffi_store32(iter_base + 48, address238) + cleanup_list.push(address238) () } - FailedUpdate(payload238) => { + FailedUpdate(payload240) => { mbt_ffi_store8(iter_base + 8, 17) - mbt_ffi_store64(iter_base + 16, payload238.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload240.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload238.timestamp.nanoseconds.reinterpret_as_int(), + payload240.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload238.target_revision.reinterpret_as_int64(), + payload240.target_revision.reinterpret_as_int64(), ) - match payload238.details { + match payload240.details { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload240) => { + Some(payload242) => { mbt_ffi_store8(iter_base + 40, 1) - let ptr241 = mbt_ffi_str2ptr(payload240) - mbt_ffi_store32(iter_base + 48, payload240.length()) - mbt_ffi_store32(iter_base + 44, ptr241) - cleanup_list.push(ptr241) + let ptr243 = mbt_ffi_str2ptr(payload242) + mbt_ffi_store32(iter_base + 48, payload242.length()) + mbt_ffi_store32(iter_base + 44, ptr243) + cleanup_list.push(ptr243) () } @@ -2823,319 +2831,319 @@ pub fn enrich_oplog_entries( () } - GrowMemory(payload242) => { + GrowMemory(payload244) => { mbt_ffi_store8(iter_base + 8, 18) - mbt_ffi_store64(iter_base + 16, payload242.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload244.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload242.timestamp.nanoseconds.reinterpret_as_int(), + payload244.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store64(iter_base + 32, payload242.delta.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 32, payload244.delta.reinterpret_as_int64()) () } - FilesystemStorageUsageUpdate(payload243) => { + FilesystemStorageUsageUpdate(payload245) => { mbt_ffi_store8(iter_base + 8, 19) - mbt_ffi_store64(iter_base + 16, payload243.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload245.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload243.timestamp.nanoseconds.reinterpret_as_int(), + payload245.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store64(iter_base + 32, payload243.delta) + mbt_ffi_store64(iter_base + 32, payload245.delta) () } - CreateResource(payload244) => { + CreateResource(payload246) => { mbt_ffi_store8(iter_base + 8, 20) - mbt_ffi_store64(iter_base + 16, payload244.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload246.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload244.timestamp.nanoseconds.reinterpret_as_int(), + payload246.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store64(iter_base + 32, payload244.id.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 32, payload246.id.reinterpret_as_int64()) - let ptr245 = mbt_ffi_str2ptr(payload244.resource_type_id.name) + let ptr247 = mbt_ffi_str2ptr(payload246.resource_type_id.name) mbt_ffi_store32( iter_base + 44, - payload244.resource_type_id.name.length(), + payload246.resource_type_id.name.length(), ) - mbt_ffi_store32(iter_base + 40, ptr245) + mbt_ffi_store32(iter_base + 40, ptr247) - let ptr246 = mbt_ffi_str2ptr(payload244.resource_type_id.owner) + let ptr248 = mbt_ffi_str2ptr(payload246.resource_type_id.owner) mbt_ffi_store32( iter_base + 52, - payload244.resource_type_id.owner.length(), + payload246.resource_type_id.owner.length(), ) - mbt_ffi_store32(iter_base + 48, ptr246) - cleanup_list.push(ptr245) - cleanup_list.push(ptr246) + mbt_ffi_store32(iter_base + 48, ptr248) + cleanup_list.push(ptr247) + cleanup_list.push(ptr248) () } - DropResource(payload247) => { + DropResource(payload249) => { mbt_ffi_store8(iter_base + 8, 21) - mbt_ffi_store64(iter_base + 16, payload247.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload249.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload247.timestamp.nanoseconds.reinterpret_as_int(), + payload249.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store64(iter_base + 32, payload247.id.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 32, payload249.id.reinterpret_as_int64()) - let ptr248 = mbt_ffi_str2ptr(payload247.resource_type_id.name) + let ptr250 = mbt_ffi_str2ptr(payload249.resource_type_id.name) mbt_ffi_store32( iter_base + 44, - payload247.resource_type_id.name.length(), + payload249.resource_type_id.name.length(), ) - mbt_ffi_store32(iter_base + 40, ptr248) + mbt_ffi_store32(iter_base + 40, ptr250) - let ptr249 = mbt_ffi_str2ptr(payload247.resource_type_id.owner) + let ptr251 = mbt_ffi_str2ptr(payload249.resource_type_id.owner) mbt_ffi_store32( iter_base + 52, - payload247.resource_type_id.owner.length(), + payload249.resource_type_id.owner.length(), ) - mbt_ffi_store32(iter_base + 48, ptr249) - cleanup_list.push(ptr248) - cleanup_list.push(ptr249) + mbt_ffi_store32(iter_base + 48, ptr251) + cleanup_list.push(ptr250) + cleanup_list.push(ptr251) () } - Log(payload250) => { + Log(payload252) => { mbt_ffi_store8(iter_base + 8, 22) - mbt_ffi_store64(iter_base + 16, payload250.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload252.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload250.timestamp.nanoseconds.reinterpret_as_int(), + payload252.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store8(iter_base + 32, payload250.level.ordinal()) + mbt_ffi_store8(iter_base + 32, payload252.level.ordinal()) - let ptr251 = mbt_ffi_str2ptr(payload250.context) - mbt_ffi_store32(iter_base + 40, payload250.context.length()) - mbt_ffi_store32(iter_base + 36, ptr251) + let ptr253 = mbt_ffi_str2ptr(payload252.context) + mbt_ffi_store32(iter_base + 40, payload252.context.length()) + mbt_ffi_store32(iter_base + 36, ptr253) - let ptr252 = mbt_ffi_str2ptr(payload250.message) - mbt_ffi_store32(iter_base + 48, payload250.message.length()) - mbt_ffi_store32(iter_base + 44, ptr252) - cleanup_list.push(ptr251) - cleanup_list.push(ptr252) + let ptr254 = mbt_ffi_str2ptr(payload252.message) + mbt_ffi_store32(iter_base + 48, payload252.message.length()) + mbt_ffi_store32(iter_base + 44, ptr254) + cleanup_list.push(ptr253) + cleanup_list.push(ptr254) () } - Restart(payload253) => { + Restart(payload255) => { mbt_ffi_store8(iter_base + 8, 23) - mbt_ffi_store64(iter_base + 16, payload253.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload255.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload253.timestamp.nanoseconds.reinterpret_as_int(), + payload255.timestamp.nanoseconds.reinterpret_as_int(), ) () } - ActivatePlugin(payload254) => { + ActivatePlugin(payload256) => { mbt_ffi_store8(iter_base + 8, 24) - mbt_ffi_store64(iter_base + 16, payload254.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload256.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload254.timestamp.nanoseconds.reinterpret_as_int(), + payload256.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload254.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), + payload256.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload254.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), + payload256.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), ) () } - DeactivatePlugin(payload255) => { + DeactivatePlugin(payload257) => { mbt_ffi_store8(iter_base + 8, 25) - mbt_ffi_store64(iter_base + 16, payload255.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload257.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload255.timestamp.nanoseconds.reinterpret_as_int(), + payload257.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload255.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), + payload257.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload255.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), + payload257.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), ) () } - Revert(payload256) => { + Revert(payload258) => { mbt_ffi_store8(iter_base + 8, 26) - mbt_ffi_store64(iter_base + 16, payload256.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload258.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload256.timestamp.nanoseconds.reinterpret_as_int(), + payload258.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload256.dropped_region.start.reinterpret_as_int64(), + payload258.dropped_region.start.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload256.dropped_region.end.reinterpret_as_int64(), + payload258.dropped_region.end.reinterpret_as_int64(), ) () } - CancelPendingInvocation(payload257) => { + CancelPendingInvocation(payload259) => { mbt_ffi_store8(iter_base + 8, 27) - mbt_ffi_store64(iter_base + 16, payload257.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload259.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload257.timestamp.nanoseconds.reinterpret_as_int(), + payload259.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr258 = mbt_ffi_str2ptr(payload257.idempotency_key) - mbt_ffi_store32(iter_base + 36, payload257.idempotency_key.length()) - mbt_ffi_store32(iter_base + 32, ptr258) - cleanup_list.push(ptr258) + let ptr260 = mbt_ffi_str2ptr(payload259.idempotency_key) + mbt_ffi_store32(iter_base + 36, payload259.idempotency_key.length()) + mbt_ffi_store32(iter_base + 32, ptr260) + cleanup_list.push(ptr260) () } - StartSpan(payload259) => { + StartSpan(payload261) => { mbt_ffi_store8(iter_base + 8, 28) - mbt_ffi_store64(iter_base + 16, payload259.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload261.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload259.timestamp.nanoseconds.reinterpret_as_int(), + payload261.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr260 = mbt_ffi_str2ptr(payload259.span_id) - mbt_ffi_store32(iter_base + 36, payload259.span_id.length()) - mbt_ffi_store32(iter_base + 32, ptr260) + let ptr262 = mbt_ffi_str2ptr(payload261.span_id) + mbt_ffi_store32(iter_base + 36, payload261.span_id.length()) + mbt_ffi_store32(iter_base + 32, ptr262) - match payload259.parent { + match payload261.parent { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload262) => { + Some(payload264) => { mbt_ffi_store8(iter_base + 40, 1) - let ptr263 = mbt_ffi_str2ptr(payload262) - mbt_ffi_store32(iter_base + 48, payload262.length()) - mbt_ffi_store32(iter_base + 44, ptr263) - cleanup_list.push(ptr263) + let ptr265 = mbt_ffi_str2ptr(payload264) + mbt_ffi_store32(iter_base + 48, payload264.length()) + mbt_ffi_store32(iter_base + 44, ptr265) + cleanup_list.push(ptr265) () } } - match payload259.linked_context_id { + match payload261.linked_context_id { None => { mbt_ffi_store8(iter_base + 52, 0) () } - Some(payload265) => { + Some(payload267) => { mbt_ffi_store8(iter_base + 52, 1) - let ptr266 = mbt_ffi_str2ptr(payload265) - mbt_ffi_store32(iter_base + 60, payload265.length()) - mbt_ffi_store32(iter_base + 56, ptr266) - cleanup_list.push(ptr266) + let ptr268 = mbt_ffi_str2ptr(payload267) + mbt_ffi_store32(iter_base + 60, payload267.length()) + mbt_ffi_store32(iter_base + 56, ptr268) + cleanup_list.push(ptr268) () } } - let address270 = mbt_ffi_malloc(payload259.attributes.length() * 20) - for index271 = 0 - index271 < payload259.attributes.length() - index271 = index271 + 1 { - let iter_elem : @context.Attribute = payload259.attributes[index271] - let iter_base = address270 + index271 * 20 + let address272 = mbt_ffi_malloc(payload261.attributes.length() * 20) + for index273 = 0 + index273 < payload261.attributes.length() + index273 = index273 + 1 { + let iter_elem : @context.Attribute = payload261.attributes[index273] + let iter_base = address272 + index273 * 20 - let ptr267 = mbt_ffi_str2ptr(iter_elem.key) + let ptr269 = mbt_ffi_str2ptr(iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.key.length()) - mbt_ffi_store32(iter_base + 0, ptr267) + mbt_ffi_store32(iter_base + 0, ptr269) match iter_elem.value { - String(payload268) => { + String(payload270) => { mbt_ffi_store8(iter_base + 8, 0) - let ptr269 = mbt_ffi_str2ptr(payload268) - mbt_ffi_store32(iter_base + 16, payload268.length()) - mbt_ffi_store32(iter_base + 12, ptr269) - cleanup_list.push(ptr269) + let ptr271 = mbt_ffi_str2ptr(payload270) + mbt_ffi_store32(iter_base + 16, payload270.length()) + mbt_ffi_store32(iter_base + 12, ptr271) + cleanup_list.push(ptr271) () } } - cleanup_list.push(ptr267) + cleanup_list.push(ptr269) } - mbt_ffi_store32(iter_base + 68, payload259.attributes.length()) - mbt_ffi_store32(iter_base + 64, address270) - cleanup_list.push(ptr260) - cleanup_list.push(address270) + mbt_ffi_store32(iter_base + 68, payload261.attributes.length()) + mbt_ffi_store32(iter_base + 64, address272) + cleanup_list.push(ptr262) + cleanup_list.push(address272) () } - FinishSpan(payload272) => { + FinishSpan(payload274) => { mbt_ffi_store8(iter_base + 8, 29) - mbt_ffi_store64(iter_base + 16, payload272.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload274.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload272.timestamp.nanoseconds.reinterpret_as_int(), + payload274.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr273 = mbt_ffi_str2ptr(payload272.span_id) - mbt_ffi_store32(iter_base + 36, payload272.span_id.length()) - mbt_ffi_store32(iter_base + 32, ptr273) - cleanup_list.push(ptr273) + let ptr275 = mbt_ffi_str2ptr(payload274.span_id) + mbt_ffi_store32(iter_base + 36, payload274.span_id.length()) + mbt_ffi_store32(iter_base + 32, ptr275) + cleanup_list.push(ptr275) () } - SetSpanAttribute(payload274) => { + SetSpanAttribute(payload276) => { mbt_ffi_store8(iter_base + 8, 30) - mbt_ffi_store64(iter_base + 16, payload274.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload276.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload274.timestamp.nanoseconds.reinterpret_as_int(), + payload276.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr275 = mbt_ffi_str2ptr(payload274.span_id) - mbt_ffi_store32(iter_base + 36, payload274.span_id.length()) - mbt_ffi_store32(iter_base + 32, ptr275) + let ptr277 = mbt_ffi_str2ptr(payload276.span_id) + mbt_ffi_store32(iter_base + 36, payload276.span_id.length()) + mbt_ffi_store32(iter_base + 32, ptr277) - let ptr276 = mbt_ffi_str2ptr(payload274.key) - mbt_ffi_store32(iter_base + 44, payload274.key.length()) - mbt_ffi_store32(iter_base + 40, ptr276) + let ptr278 = mbt_ffi_str2ptr(payload276.key) + mbt_ffi_store32(iter_base + 44, payload276.key.length()) + mbt_ffi_store32(iter_base + 40, ptr278) - match payload274.value { - String(payload277) => { + match payload276.value { + String(payload279) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr278 = mbt_ffi_str2ptr(payload277) - mbt_ffi_store32(iter_base + 56, payload277.length()) - mbt_ffi_store32(iter_base + 52, ptr278) - cleanup_list.push(ptr278) + let ptr280 = mbt_ffi_str2ptr(payload279) + mbt_ffi_store32(iter_base + 56, payload279.length()) + mbt_ffi_store32(iter_base + 52, ptr280) + cleanup_list.push(ptr280) () } } - cleanup_list.push(ptr275) - cleanup_list.push(ptr276) + cleanup_list.push(ptr277) + cleanup_list.push(ptr278) () } - ChangePersistenceLevel(payload279) => { + ChangePersistenceLevel(payload281) => { mbt_ffi_store8(iter_base + 8, 31) - mbt_ffi_store64(iter_base + 16, payload279.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload281.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload279.timestamp.nanoseconds.reinterpret_as_int(), + payload281.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload279.persistence_level { + match payload281.persistence_level { PersistNothing => { mbt_ffi_store8(iter_base + 32, 0) @@ -3155,467 +3163,467 @@ pub fn enrich_oplog_entries( () } - BeginRemoteTransaction(payload283) => { + BeginRemoteTransaction(payload285) => { mbt_ffi_store8(iter_base + 8, 32) - mbt_ffi_store64(iter_base + 16, payload283.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload285.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload283.timestamp.nanoseconds.reinterpret_as_int(), + payload285.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr284 = mbt_ffi_str2ptr(payload283.transaction_id) - mbt_ffi_store32(iter_base + 36, payload283.transaction_id.length()) - mbt_ffi_store32(iter_base + 32, ptr284) + let ptr286 = mbt_ffi_str2ptr(payload285.transaction_id) + mbt_ffi_store32(iter_base + 36, payload285.transaction_id.length()) + mbt_ffi_store32(iter_base + 32, ptr286) - match payload283.original_begin_index { + match payload285.original_begin_index { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload286) => { + Some(payload288) => { mbt_ffi_store8(iter_base + 40, 1) - mbt_ffi_store64(iter_base + 48, payload286.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 48, payload288.reinterpret_as_int64()) () } } - cleanup_list.push(ptr284) + cleanup_list.push(ptr286) () } - PreCommitRemoteTransaction(payload287) => { + PreCommitRemoteTransaction(payload289) => { mbt_ffi_store8(iter_base + 8, 33) - mbt_ffi_store64(iter_base + 16, payload287.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload289.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload287.timestamp.nanoseconds.reinterpret_as_int(), + payload289.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload287.begin_index.reinterpret_as_int64(), + payload289.begin_index.reinterpret_as_int64(), ) () } - PreRollbackRemoteTransaction(payload288) => { + PreRollbackRemoteTransaction(payload290) => { mbt_ffi_store8(iter_base + 8, 34) - mbt_ffi_store64(iter_base + 16, payload288.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload290.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload288.timestamp.nanoseconds.reinterpret_as_int(), + payload290.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload288.begin_index.reinterpret_as_int64(), + payload290.begin_index.reinterpret_as_int64(), ) () } - CommittedRemoteTransaction(payload289) => { + CommittedRemoteTransaction(payload291) => { mbt_ffi_store8(iter_base + 8, 35) - mbt_ffi_store64(iter_base + 16, payload289.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload291.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload289.timestamp.nanoseconds.reinterpret_as_int(), + payload291.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload289.begin_index.reinterpret_as_int64(), + payload291.begin_index.reinterpret_as_int64(), ) () } - RolledBackRemoteTransaction(payload290) => { + RolledBackRemoteTransaction(payload292) => { mbt_ffi_store8(iter_base + 8, 36) - mbt_ffi_store64(iter_base + 16, payload290.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload292.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload290.timestamp.nanoseconds.reinterpret_as_int(), + payload292.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload290.begin_index.reinterpret_as_int64(), + payload292.begin_index.reinterpret_as_int64(), ) () } - Snapshot(payload291) => { + Snapshot(payload293) => { mbt_ffi_store8(iter_base + 8, 37) - mbt_ffi_store64(iter_base + 16, payload291.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload293.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload291.timestamp.nanoseconds.reinterpret_as_int(), + payload293.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload291.data { - Inline(payload292) => { + match payload293.data { + Inline(payload294) => { mbt_ffi_store8(iter_base + 32, 0) - let ptr293 = mbt_ffi_bytes2ptr(payload292) + let ptr295 = mbt_ffi_bytes2ptr(payload294) - mbt_ffi_store32(iter_base + 44, payload292.length()) - mbt_ffi_store32(iter_base + 40, ptr293) - cleanup_list.push(ptr293) + mbt_ffi_store32(iter_base + 44, payload294.length()) + mbt_ffi_store32(iter_base + 40, ptr295) + cleanup_list.push(ptr295) () } - External(payload294) => { + External(payload296) => { mbt_ffi_store8(iter_base + 32, 1) mbt_ffi_store64( iter_base + 40, - payload294.payload_id.high_bits.reinterpret_as_int64(), + payload296.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload294.payload_id.low_bits.reinterpret_as_int64(), + payload296.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr295 = mbt_ffi_bytes2ptr(payload294.md5_hash) + let ptr297 = mbt_ffi_bytes2ptr(payload296.md5_hash) - mbt_ffi_store32(iter_base + 60, payload294.md5_hash.length()) - mbt_ffi_store32(iter_base + 56, ptr295) - cleanup_list.push(ptr295) + mbt_ffi_store32(iter_base + 60, payload296.md5_hash.length()) + mbt_ffi_store32(iter_base + 56, ptr297) + cleanup_list.push(ptr297) () } } - let ptr296 = mbt_ffi_str2ptr(payload291.mime_type) - mbt_ffi_store32(iter_base + 68, payload291.mime_type.length()) - mbt_ffi_store32(iter_base + 64, ptr296) - cleanup_list.push(ptr296) + let ptr298 = mbt_ffi_str2ptr(payload293.mime_type) + mbt_ffi_store32(iter_base + 68, payload293.mime_type.length()) + mbt_ffi_store32(iter_base + 64, ptr298) + cleanup_list.push(ptr298) () } - OplogProcessorCheckpoint(payload297) => { + OplogProcessorCheckpoint(payload299) => { mbt_ffi_store8(iter_base + 8, 38) - mbt_ffi_store64(iter_base + 16, payload297.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload299.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload297.timestamp.nanoseconds.reinterpret_as_int(), + payload299.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload297.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), + payload299.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload297.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), + payload299.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload297.target_agent_id.component_id.uuid.high_bits.reinterpret_as_int64(), + payload299.target_agent_id.component_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 56, - payload297.target_agent_id.component_id.uuid.low_bits.reinterpret_as_int64(), + payload299.target_agent_id.component_id.uuid.low_bits.reinterpret_as_int64(), ) - let ptr298 = mbt_ffi_str2ptr(payload297.target_agent_id.agent_id) + let ptr300 = mbt_ffi_str2ptr(payload299.target_agent_id.agent_id) mbt_ffi_store32( iter_base + 68, - payload297.target_agent_id.agent_id.length(), + payload299.target_agent_id.agent_id.length(), ) - mbt_ffi_store32(iter_base + 64, ptr298) + mbt_ffi_store32(iter_base + 64, ptr300) mbt_ffi_store64( iter_base + 72, - payload297.confirmed_up_to.reinterpret_as_int64(), + payload299.confirmed_up_to.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 80, - payload297.sending_up_to.reinterpret_as_int64(), + payload299.sending_up_to.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 88, - payload297.last_batch_start.reinterpret_as_int64(), + payload299.last_batch_start.reinterpret_as_int64(), ) - cleanup_list.push(ptr298) + cleanup_list.push(ptr300) () } - SetRetryPolicy(payload299) => { + SetRetryPolicy(payload301) => { mbt_ffi_store8(iter_base + 8, 39) - mbt_ffi_store64(iter_base + 16, payload299.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload301.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload299.timestamp.nanoseconds.reinterpret_as_int(), + payload301.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr300 = mbt_ffi_str2ptr(payload299.policy.name) - mbt_ffi_store32(iter_base + 36, payload299.policy.name.length()) - mbt_ffi_store32(iter_base + 32, ptr300) + let ptr302 = mbt_ffi_str2ptr(payload301.policy.name) + mbt_ffi_store32(iter_base + 36, payload301.policy.name.length()) + mbt_ffi_store32(iter_base + 32, ptr302) mbt_ffi_store32( iter_base + 40, - payload299.policy.priority.reinterpret_as_int(), + payload301.policy.priority.reinterpret_as_int(), ) - let address361 = mbt_ffi_malloc( - payload299.policy.predicate.nodes.length() * 32, + let address363 = mbt_ffi_malloc( + payload301.policy.predicate.nodes.length() * 32, ) - for index362 = 0 - index362 < payload299.policy.predicate.nodes.length() - index362 = index362 + 1 { - let iter_elem : @retry.PredicateNode = payload299.policy.predicate.nodes[index362] - let iter_base = address361 + index362 * 32 + for index364 = 0 + index364 < payload301.policy.predicate.nodes.length() + index364 = index364 + 1 { + let iter_elem : @retry.PredicateNode = payload301.policy.predicate.nodes[index364] + let iter_base = address363 + index364 * 32 match iter_elem { - PropEq(payload301) => { + PropEq(payload303) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr302 = mbt_ffi_str2ptr(payload301.property_name) - mbt_ffi_store32(iter_base + 12, payload301.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr302) + let ptr304 = mbt_ffi_str2ptr(payload303.property_name) + mbt_ffi_store32(iter_base + 12, payload303.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr304) - match payload301.value { - Text(payload303) => { + match payload303.value { + Text(payload305) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr304 = mbt_ffi_str2ptr(payload303) - mbt_ffi_store32(iter_base + 28, payload303.length()) - mbt_ffi_store32(iter_base + 24, ptr304) - cleanup_list.push(ptr304) + let ptr306 = mbt_ffi_str2ptr(payload305) + mbt_ffi_store32(iter_base + 28, payload305.length()) + mbt_ffi_store32(iter_base + 24, ptr306) + cleanup_list.push(ptr306) () } - Integer(payload305) => { + Integer(payload307) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload305) + mbt_ffi_store64(iter_base + 24, payload307) () } - Boolean(payload306) => { + Boolean(payload308) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload306 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload308 { 1 } else { 0 }) () } } - cleanup_list.push(ptr302) + cleanup_list.push(ptr304) () } - PropNeq(payload307) => { + PropNeq(payload309) => { mbt_ffi_store8(iter_base + 0, 1) - let ptr308 = mbt_ffi_str2ptr(payload307.property_name) - mbt_ffi_store32(iter_base + 12, payload307.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr308) + let ptr310 = mbt_ffi_str2ptr(payload309.property_name) + mbt_ffi_store32(iter_base + 12, payload309.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr310) - match payload307.value { - Text(payload309) => { + match payload309.value { + Text(payload311) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr310 = mbt_ffi_str2ptr(payload309) - mbt_ffi_store32(iter_base + 28, payload309.length()) - mbt_ffi_store32(iter_base + 24, ptr310) - cleanup_list.push(ptr310) + let ptr312 = mbt_ffi_str2ptr(payload311) + mbt_ffi_store32(iter_base + 28, payload311.length()) + mbt_ffi_store32(iter_base + 24, ptr312) + cleanup_list.push(ptr312) () } - Integer(payload311) => { + Integer(payload313) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload311) + mbt_ffi_store64(iter_base + 24, payload313) () } - Boolean(payload312) => { + Boolean(payload314) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload312 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload314 { 1 } else { 0 }) () } } - cleanup_list.push(ptr308) + cleanup_list.push(ptr310) () } - PropGt(payload313) => { + PropGt(payload315) => { mbt_ffi_store8(iter_base + 0, 2) - let ptr314 = mbt_ffi_str2ptr(payload313.property_name) - mbt_ffi_store32(iter_base + 12, payload313.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr314) + let ptr316 = mbt_ffi_str2ptr(payload315.property_name) + mbt_ffi_store32(iter_base + 12, payload315.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr316) - match payload313.value { - Text(payload315) => { + match payload315.value { + Text(payload317) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr316 = mbt_ffi_str2ptr(payload315) - mbt_ffi_store32(iter_base + 28, payload315.length()) - mbt_ffi_store32(iter_base + 24, ptr316) - cleanup_list.push(ptr316) + let ptr318 = mbt_ffi_str2ptr(payload317) + mbt_ffi_store32(iter_base + 28, payload317.length()) + mbt_ffi_store32(iter_base + 24, ptr318) + cleanup_list.push(ptr318) () } - Integer(payload317) => { + Integer(payload319) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload317) + mbt_ffi_store64(iter_base + 24, payload319) () } - Boolean(payload318) => { + Boolean(payload320) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload318 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload320 { 1 } else { 0 }) () } } - cleanup_list.push(ptr314) + cleanup_list.push(ptr316) () } - PropGte(payload319) => { + PropGte(payload321) => { mbt_ffi_store8(iter_base + 0, 3) - let ptr320 = mbt_ffi_str2ptr(payload319.property_name) - mbt_ffi_store32(iter_base + 12, payload319.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr320) + let ptr322 = mbt_ffi_str2ptr(payload321.property_name) + mbt_ffi_store32(iter_base + 12, payload321.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr322) - match payload319.value { - Text(payload321) => { + match payload321.value { + Text(payload323) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr322 = mbt_ffi_str2ptr(payload321) - mbt_ffi_store32(iter_base + 28, payload321.length()) - mbt_ffi_store32(iter_base + 24, ptr322) - cleanup_list.push(ptr322) + let ptr324 = mbt_ffi_str2ptr(payload323) + mbt_ffi_store32(iter_base + 28, payload323.length()) + mbt_ffi_store32(iter_base + 24, ptr324) + cleanup_list.push(ptr324) () } - Integer(payload323) => { + Integer(payload325) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload323) + mbt_ffi_store64(iter_base + 24, payload325) () } - Boolean(payload324) => { + Boolean(payload326) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload324 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload326 { 1 } else { 0 }) () } } - cleanup_list.push(ptr320) + cleanup_list.push(ptr322) () } - PropLt(payload325) => { + PropLt(payload327) => { mbt_ffi_store8(iter_base + 0, 4) - let ptr326 = mbt_ffi_str2ptr(payload325.property_name) - mbt_ffi_store32(iter_base + 12, payload325.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr326) + let ptr328 = mbt_ffi_str2ptr(payload327.property_name) + mbt_ffi_store32(iter_base + 12, payload327.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr328) - match payload325.value { - Text(payload327) => { + match payload327.value { + Text(payload329) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr328 = mbt_ffi_str2ptr(payload327) - mbt_ffi_store32(iter_base + 28, payload327.length()) - mbt_ffi_store32(iter_base + 24, ptr328) - cleanup_list.push(ptr328) + let ptr330 = mbt_ffi_str2ptr(payload329) + mbt_ffi_store32(iter_base + 28, payload329.length()) + mbt_ffi_store32(iter_base + 24, ptr330) + cleanup_list.push(ptr330) () } - Integer(payload329) => { + Integer(payload331) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload329) + mbt_ffi_store64(iter_base + 24, payload331) () } - Boolean(payload330) => { + Boolean(payload332) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload330 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload332 { 1 } else { 0 }) () } } - cleanup_list.push(ptr326) + cleanup_list.push(ptr328) () } - PropLte(payload331) => { + PropLte(payload333) => { mbt_ffi_store8(iter_base + 0, 5) - let ptr332 = mbt_ffi_str2ptr(payload331.property_name) - mbt_ffi_store32(iter_base + 12, payload331.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr332) + let ptr334 = mbt_ffi_str2ptr(payload333.property_name) + mbt_ffi_store32(iter_base + 12, payload333.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr334) - match payload331.value { - Text(payload333) => { + match payload333.value { + Text(payload335) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr334 = mbt_ffi_str2ptr(payload333) - mbt_ffi_store32(iter_base + 28, payload333.length()) - mbt_ffi_store32(iter_base + 24, ptr334) - cleanup_list.push(ptr334) + let ptr336 = mbt_ffi_str2ptr(payload335) + mbt_ffi_store32(iter_base + 28, payload335.length()) + mbt_ffi_store32(iter_base + 24, ptr336) + cleanup_list.push(ptr336) () } - Integer(payload335) => { + Integer(payload337) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload335) + mbt_ffi_store64(iter_base + 24, payload337) () } - Boolean(payload336) => { + Boolean(payload338) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload336 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload338 { 1 } else { 0 }) () } } - cleanup_list.push(ptr332) + cleanup_list.push(ptr334) () } - PropExists(payload337) => { + PropExists(payload339) => { mbt_ffi_store8(iter_base + 0, 6) - let ptr338 = mbt_ffi_str2ptr(payload337) - mbt_ffi_store32(iter_base + 12, payload337.length()) - mbt_ffi_store32(iter_base + 8, ptr338) - cleanup_list.push(ptr338) + let ptr340 = mbt_ffi_str2ptr(payload339) + mbt_ffi_store32(iter_base + 12, payload339.length()) + mbt_ffi_store32(iter_base + 8, ptr340) + cleanup_list.push(ptr340) () } - PropIn(payload339) => { + PropIn(payload341) => { mbt_ffi_store8(iter_base + 0, 7) - let ptr340 = mbt_ffi_str2ptr(payload339.property_name) - mbt_ffi_store32(iter_base + 12, payload339.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr340) + let ptr342 = mbt_ffi_str2ptr(payload341.property_name) + mbt_ffi_store32(iter_base + 12, payload341.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr342) - let address345 = mbt_ffi_malloc(payload339.values.length() * 16) - for index346 = 0 - index346 < payload339.values.length() - index346 = index346 + 1 { - let iter_elem : @retry.PredicateValue = payload339.values[index346] - let iter_base = address345 + index346 * 16 + let address347 = mbt_ffi_malloc(payload341.values.length() * 16) + for index348 = 0 + index348 < payload341.values.length() + index348 = index348 + 1 { + let iter_elem : @retry.PredicateValue = payload341.values[index348] + let iter_base = address347 + index348 * 16 match iter_elem { - Text(payload341) => { + Text(payload343) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr342 = mbt_ffi_str2ptr(payload341) - mbt_ffi_store32(iter_base + 12, payload341.length()) - mbt_ffi_store32(iter_base + 8, ptr342) - cleanup_list.push(ptr342) + let ptr344 = mbt_ffi_str2ptr(payload343) + mbt_ffi_store32(iter_base + 12, payload343.length()) + mbt_ffi_store32(iter_base + 8, ptr344) + cleanup_list.push(ptr344) () } - Integer(payload343) => { + Integer(payload345) => { mbt_ffi_store8(iter_base + 0, 1) - mbt_ffi_store64(iter_base + 8, payload343) + mbt_ffi_store64(iter_base + 8, payload345) () } - Boolean(payload344) => { + Boolean(payload346) => { mbt_ffi_store8(iter_base + 0, 2) mbt_ffi_store8( iter_base + 8, - if payload344 { + if payload346 { 1 } else { 0 @@ -3626,75 +3634,75 @@ pub fn enrich_oplog_entries( } } } - mbt_ffi_store32(iter_base + 20, payload339.values.length()) - mbt_ffi_store32(iter_base + 16, address345) - cleanup_list.push(ptr340) - cleanup_list.push(address345) + mbt_ffi_store32(iter_base + 20, payload341.values.length()) + mbt_ffi_store32(iter_base + 16, address347) + cleanup_list.push(ptr342) + cleanup_list.push(address347) () } - PropMatches(payload347) => { + PropMatches(payload349) => { mbt_ffi_store8(iter_base + 0, 8) - let ptr348 = mbt_ffi_str2ptr(payload347.property_name) - mbt_ffi_store32(iter_base + 12, payload347.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr348) + let ptr350 = mbt_ffi_str2ptr(payload349.property_name) + mbt_ffi_store32(iter_base + 12, payload349.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr350) - let ptr349 = mbt_ffi_str2ptr(payload347.pattern) - mbt_ffi_store32(iter_base + 20, payload347.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr349) - cleanup_list.push(ptr348) - cleanup_list.push(ptr349) + let ptr351 = mbt_ffi_str2ptr(payload349.pattern) + mbt_ffi_store32(iter_base + 20, payload349.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr351) + cleanup_list.push(ptr350) + cleanup_list.push(ptr351) () } - PropStartsWith(payload350) => { + PropStartsWith(payload352) => { mbt_ffi_store8(iter_base + 0, 9) - let ptr351 = mbt_ffi_str2ptr(payload350.property_name) - mbt_ffi_store32(iter_base + 12, payload350.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr351) + let ptr353 = mbt_ffi_str2ptr(payload352.property_name) + mbt_ffi_store32(iter_base + 12, payload352.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr353) - let ptr352 = mbt_ffi_str2ptr(payload350.pattern) - mbt_ffi_store32(iter_base + 20, payload350.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr352) - cleanup_list.push(ptr351) - cleanup_list.push(ptr352) + let ptr354 = mbt_ffi_str2ptr(payload352.pattern) + mbt_ffi_store32(iter_base + 20, payload352.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr354) + cleanup_list.push(ptr353) + cleanup_list.push(ptr354) () } - PropContains(payload353) => { + PropContains(payload355) => { mbt_ffi_store8(iter_base + 0, 10) - let ptr354 = mbt_ffi_str2ptr(payload353.property_name) - mbt_ffi_store32(iter_base + 12, payload353.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr354) + let ptr356 = mbt_ffi_str2ptr(payload355.property_name) + mbt_ffi_store32(iter_base + 12, payload355.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr356) - let ptr355 = mbt_ffi_str2ptr(payload353.pattern) - mbt_ffi_store32(iter_base + 20, payload353.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr355) - cleanup_list.push(ptr354) - cleanup_list.push(ptr355) + let ptr357 = mbt_ffi_str2ptr(payload355.pattern) + mbt_ffi_store32(iter_base + 20, payload355.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr357) + cleanup_list.push(ptr356) + cleanup_list.push(ptr357) () } - PredAnd(payload356) => { + PredAnd(payload358) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload356.0) - mbt_ffi_store32(iter_base + 12, payload356.1) + mbt_ffi_store32(iter_base + 8, payload358.0) + mbt_ffi_store32(iter_base + 12, payload358.1) () } - PredOr(payload357) => { + PredOr(payload359) => { mbt_ffi_store8(iter_base + 0, 12) - mbt_ffi_store32(iter_base + 8, payload357.0) - mbt_ffi_store32(iter_base + 12, payload357.1) + mbt_ffi_store32(iter_base + 8, payload359.0) + mbt_ffi_store32(iter_base + 12, payload359.1) () } - PredNot(payload358) => { + PredNot(payload360) => { mbt_ffi_store8(iter_base + 0, 13) - mbt_ffi_store32(iter_base + 8, payload358) + mbt_ffi_store32(iter_base + 8, payload360) () } @@ -3712,45 +3720,45 @@ pub fn enrich_oplog_entries( } mbt_ffi_store32( iter_base + 48, - payload299.policy.predicate.nodes.length(), + payload301.policy.predicate.nodes.length(), ) - mbt_ffi_store32(iter_base + 44, address361) + mbt_ffi_store32(iter_base + 44, address363) - let address439 = mbt_ffi_malloc( - payload299.policy.policy.nodes.length() * 32, + let address441 = mbt_ffi_malloc( + payload301.policy.policy.nodes.length() * 32, ) - for index440 = 0 - index440 < payload299.policy.policy.nodes.length() - index440 = index440 + 1 { - let iter_elem : @retry.PolicyNode = payload299.policy.policy.nodes[index440] - let iter_base = address439 + index440 * 32 + for index442 = 0 + index442 < payload301.policy.policy.nodes.length() + index442 = index442 + 1 { + let iter_elem : @retry.PolicyNode = payload301.policy.policy.nodes[index442] + let iter_base = address441 + index442 * 32 match iter_elem { - Periodic(payload363) => { + Periodic(payload365) => { mbt_ffi_store8(iter_base + 0, 0) - mbt_ffi_store64(iter_base + 8, payload363.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 8, payload365.reinterpret_as_int64()) () } - Exponential(payload364) => { + Exponential(payload366) => { mbt_ffi_store8(iter_base + 0, 1) mbt_ffi_store64( iter_base + 8, - payload364.base_delay.reinterpret_as_int64(), + payload366.base_delay.reinterpret_as_int64(), ) - mbt_ffi_storef64(iter_base + 16, payload364.factor) + mbt_ffi_storef64(iter_base + 16, payload366.factor) () } - Fibonacci(payload365) => { + Fibonacci(payload367) => { mbt_ffi_store8(iter_base + 0, 2) mbt_ffi_store64( iter_base + 8, - payload365.first.reinterpret_as_int64(), + payload367.first.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 16, - payload365.second.reinterpret_as_int64(), + payload367.second.reinterpret_as_int64(), ) () @@ -3765,102 +3773,102 @@ pub fn enrich_oplog_entries( () } - CountBox(payload368) => { + CountBox(payload370) => { mbt_ffi_store8(iter_base + 0, 5) mbt_ffi_store32( iter_base + 8, - payload368.max_retries.reinterpret_as_int(), + payload370.max_retries.reinterpret_as_int(), ) - mbt_ffi_store32(iter_base + 12, payload368.inner) + mbt_ffi_store32(iter_base + 12, payload370.inner) () } - TimeBox(payload369) => { + TimeBox(payload371) => { mbt_ffi_store8(iter_base + 0, 6) mbt_ffi_store64( iter_base + 8, - payload369.limit.reinterpret_as_int64(), + payload371.limit.reinterpret_as_int64(), ) - mbt_ffi_store32(iter_base + 16, payload369.inner) + mbt_ffi_store32(iter_base + 16, payload371.inner) () } - ClampDelay(payload370) => { + ClampDelay(payload372) => { mbt_ffi_store8(iter_base + 0, 7) mbt_ffi_store64( iter_base + 8, - payload370.min_delay.reinterpret_as_int64(), + payload372.min_delay.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 16, - payload370.max_delay.reinterpret_as_int64(), + payload372.max_delay.reinterpret_as_int64(), ) - mbt_ffi_store32(iter_base + 24, payload370.inner) + mbt_ffi_store32(iter_base + 24, payload372.inner) () } - AddDelay(payload371) => { + AddDelay(payload373) => { mbt_ffi_store8(iter_base + 0, 8) mbt_ffi_store64( iter_base + 8, - payload371.delay.reinterpret_as_int64(), + payload373.delay.reinterpret_as_int64(), ) - mbt_ffi_store32(iter_base + 16, payload371.inner) + mbt_ffi_store32(iter_base + 16, payload373.inner) () } - Jitter(payload372) => { + Jitter(payload374) => { mbt_ffi_store8(iter_base + 0, 9) - mbt_ffi_storef64(iter_base + 8, payload372.factor) - mbt_ffi_store32(iter_base + 16, payload372.inner) + mbt_ffi_storef64(iter_base + 8, payload374.factor) + mbt_ffi_store32(iter_base + 16, payload374.inner) () } - FilteredOn(payload373) => { + FilteredOn(payload375) => { mbt_ffi_store8(iter_base + 0, 10) - let address434 = mbt_ffi_malloc( - payload373.predicate.nodes.length() * 32, + let address436 = mbt_ffi_malloc( + payload375.predicate.nodes.length() * 32, ) - for index435 = 0 - index435 < payload373.predicate.nodes.length() - index435 = index435 + 1 { - let iter_elem : @retry.PredicateNode = payload373.predicate.nodes[index435] - let iter_base = address434 + index435 * 32 + for index437 = 0 + index437 < payload375.predicate.nodes.length() + index437 = index437 + 1 { + let iter_elem : @retry.PredicateNode = payload375.predicate.nodes[index437] + let iter_base = address436 + index437 * 32 match iter_elem { - PropEq(payload374) => { + PropEq(payload376) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr375 = mbt_ffi_str2ptr(payload374.property_name) + let ptr377 = mbt_ffi_str2ptr(payload376.property_name) mbt_ffi_store32( iter_base + 12, - payload374.property_name.length(), + payload376.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr375) + mbt_ffi_store32(iter_base + 8, ptr377) - match payload374.value { - Text(payload376) => { + match payload376.value { + Text(payload378) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr377 = mbt_ffi_str2ptr(payload376) - mbt_ffi_store32(iter_base + 28, payload376.length()) - mbt_ffi_store32(iter_base + 24, ptr377) - cleanup_list.push(ptr377) + let ptr379 = mbt_ffi_str2ptr(payload378) + mbt_ffi_store32(iter_base + 28, payload378.length()) + mbt_ffi_store32(iter_base + 24, ptr379) + cleanup_list.push(ptr379) () } - Integer(payload378) => { + Integer(payload380) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload378) + mbt_ffi_store64(iter_base + 24, payload380) () } - Boolean(payload379) => { + Boolean(payload381) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload379 { + if payload381 { 1 } else { 0 @@ -3870,42 +3878,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr375) + cleanup_list.push(ptr377) () } - PropNeq(payload380) => { + PropNeq(payload382) => { mbt_ffi_store8(iter_base + 0, 1) - let ptr381 = mbt_ffi_str2ptr(payload380.property_name) + let ptr383 = mbt_ffi_str2ptr(payload382.property_name) mbt_ffi_store32( iter_base + 12, - payload380.property_name.length(), + payload382.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr381) + mbt_ffi_store32(iter_base + 8, ptr383) - match payload380.value { - Text(payload382) => { + match payload382.value { + Text(payload384) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr383 = mbt_ffi_str2ptr(payload382) - mbt_ffi_store32(iter_base + 28, payload382.length()) - mbt_ffi_store32(iter_base + 24, ptr383) - cleanup_list.push(ptr383) + let ptr385 = mbt_ffi_str2ptr(payload384) + mbt_ffi_store32(iter_base + 28, payload384.length()) + mbt_ffi_store32(iter_base + 24, ptr385) + cleanup_list.push(ptr385) () } - Integer(payload384) => { + Integer(payload386) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload384) + mbt_ffi_store64(iter_base + 24, payload386) () } - Boolean(payload385) => { + Boolean(payload387) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload385 { + if payload387 { 1 } else { 0 @@ -3915,42 +3923,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr381) + cleanup_list.push(ptr383) () } - PropGt(payload386) => { + PropGt(payload388) => { mbt_ffi_store8(iter_base + 0, 2) - let ptr387 = mbt_ffi_str2ptr(payload386.property_name) + let ptr389 = mbt_ffi_str2ptr(payload388.property_name) mbt_ffi_store32( iter_base + 12, - payload386.property_name.length(), + payload388.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr387) + mbt_ffi_store32(iter_base + 8, ptr389) - match payload386.value { - Text(payload388) => { + match payload388.value { + Text(payload390) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr389 = mbt_ffi_str2ptr(payload388) - mbt_ffi_store32(iter_base + 28, payload388.length()) - mbt_ffi_store32(iter_base + 24, ptr389) - cleanup_list.push(ptr389) + let ptr391 = mbt_ffi_str2ptr(payload390) + mbt_ffi_store32(iter_base + 28, payload390.length()) + mbt_ffi_store32(iter_base + 24, ptr391) + cleanup_list.push(ptr391) () } - Integer(payload390) => { + Integer(payload392) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload390) + mbt_ffi_store64(iter_base + 24, payload392) () } - Boolean(payload391) => { + Boolean(payload393) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload391 { + if payload393 { 1 } else { 0 @@ -3960,42 +3968,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr387) + cleanup_list.push(ptr389) () } - PropGte(payload392) => { + PropGte(payload394) => { mbt_ffi_store8(iter_base + 0, 3) - let ptr393 = mbt_ffi_str2ptr(payload392.property_name) + let ptr395 = mbt_ffi_str2ptr(payload394.property_name) mbt_ffi_store32( iter_base + 12, - payload392.property_name.length(), + payload394.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr393) + mbt_ffi_store32(iter_base + 8, ptr395) - match payload392.value { - Text(payload394) => { + match payload394.value { + Text(payload396) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr395 = mbt_ffi_str2ptr(payload394) - mbt_ffi_store32(iter_base + 28, payload394.length()) - mbt_ffi_store32(iter_base + 24, ptr395) - cleanup_list.push(ptr395) + let ptr397 = mbt_ffi_str2ptr(payload396) + mbt_ffi_store32(iter_base + 28, payload396.length()) + mbt_ffi_store32(iter_base + 24, ptr397) + cleanup_list.push(ptr397) () } - Integer(payload396) => { + Integer(payload398) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload396) + mbt_ffi_store64(iter_base + 24, payload398) () } - Boolean(payload397) => { + Boolean(payload399) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload397 { + if payload399 { 1 } else { 0 @@ -4005,42 +4013,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr393) + cleanup_list.push(ptr395) () } - PropLt(payload398) => { + PropLt(payload400) => { mbt_ffi_store8(iter_base + 0, 4) - let ptr399 = mbt_ffi_str2ptr(payload398.property_name) + let ptr401 = mbt_ffi_str2ptr(payload400.property_name) mbt_ffi_store32( iter_base + 12, - payload398.property_name.length(), + payload400.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr399) + mbt_ffi_store32(iter_base + 8, ptr401) - match payload398.value { - Text(payload400) => { + match payload400.value { + Text(payload402) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr401 = mbt_ffi_str2ptr(payload400) - mbt_ffi_store32(iter_base + 28, payload400.length()) - mbt_ffi_store32(iter_base + 24, ptr401) - cleanup_list.push(ptr401) + let ptr403 = mbt_ffi_str2ptr(payload402) + mbt_ffi_store32(iter_base + 28, payload402.length()) + mbt_ffi_store32(iter_base + 24, ptr403) + cleanup_list.push(ptr403) () } - Integer(payload402) => { + Integer(payload404) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload402) + mbt_ffi_store64(iter_base + 24, payload404) () } - Boolean(payload403) => { + Boolean(payload405) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload403 { + if payload405 { 1 } else { 0 @@ -4050,42 +4058,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr399) + cleanup_list.push(ptr401) () } - PropLte(payload404) => { + PropLte(payload406) => { mbt_ffi_store8(iter_base + 0, 5) - let ptr405 = mbt_ffi_str2ptr(payload404.property_name) + let ptr407 = mbt_ffi_str2ptr(payload406.property_name) mbt_ffi_store32( iter_base + 12, - payload404.property_name.length(), + payload406.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr405) + mbt_ffi_store32(iter_base + 8, ptr407) - match payload404.value { - Text(payload406) => { + match payload406.value { + Text(payload408) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr407 = mbt_ffi_str2ptr(payload406) - mbt_ffi_store32(iter_base + 28, payload406.length()) - mbt_ffi_store32(iter_base + 24, ptr407) - cleanup_list.push(ptr407) + let ptr409 = mbt_ffi_str2ptr(payload408) + mbt_ffi_store32(iter_base + 28, payload408.length()) + mbt_ffi_store32(iter_base + 24, ptr409) + cleanup_list.push(ptr409) () } - Integer(payload408) => { + Integer(payload410) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload408) + mbt_ffi_store64(iter_base + 24, payload410) () } - Boolean(payload409) => { + Boolean(payload411) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload409 { + if payload411 { 1 } else { 0 @@ -4095,61 +4103,61 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr405) + cleanup_list.push(ptr407) () } - PropExists(payload410) => { + PropExists(payload412) => { mbt_ffi_store8(iter_base + 0, 6) - let ptr411 = mbt_ffi_str2ptr(payload410) - mbt_ffi_store32(iter_base + 12, payload410.length()) - mbt_ffi_store32(iter_base + 8, ptr411) - cleanup_list.push(ptr411) + let ptr413 = mbt_ffi_str2ptr(payload412) + mbt_ffi_store32(iter_base + 12, payload412.length()) + mbt_ffi_store32(iter_base + 8, ptr413) + cleanup_list.push(ptr413) () } - PropIn(payload412) => { + PropIn(payload414) => { mbt_ffi_store8(iter_base + 0, 7) - let ptr413 = mbt_ffi_str2ptr(payload412.property_name) + let ptr415 = mbt_ffi_str2ptr(payload414.property_name) mbt_ffi_store32( iter_base + 12, - payload412.property_name.length(), + payload414.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr413) + mbt_ffi_store32(iter_base + 8, ptr415) - let address418 = mbt_ffi_malloc( - payload412.values.length() * 16, + let address420 = mbt_ffi_malloc( + payload414.values.length() * 16, ) - for index419 = 0 - index419 < payload412.values.length() - index419 = index419 + 1 { - let iter_elem : @retry.PredicateValue = payload412.values[index419] - let iter_base = address418 + index419 * 16 + for index421 = 0 + index421 < payload414.values.length() + index421 = index421 + 1 { + let iter_elem : @retry.PredicateValue = payload414.values[index421] + let iter_base = address420 + index421 * 16 match iter_elem { - Text(payload414) => { + Text(payload416) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr415 = mbt_ffi_str2ptr(payload414) - mbt_ffi_store32(iter_base + 12, payload414.length()) - mbt_ffi_store32(iter_base + 8, ptr415) - cleanup_list.push(ptr415) + let ptr417 = mbt_ffi_str2ptr(payload416) + mbt_ffi_store32(iter_base + 12, payload416.length()) + mbt_ffi_store32(iter_base + 8, ptr417) + cleanup_list.push(ptr417) () } - Integer(payload416) => { + Integer(payload418) => { mbt_ffi_store8(iter_base + 0, 1) - mbt_ffi_store64(iter_base + 8, payload416) + mbt_ffi_store64(iter_base + 8, payload418) () } - Boolean(payload417) => { + Boolean(payload419) => { mbt_ffi_store8(iter_base + 0, 2) mbt_ffi_store8( iter_base + 8, - if payload417 { + if payload419 { 1 } else { 0 @@ -4160,84 +4168,84 @@ pub fn enrich_oplog_entries( } } } - mbt_ffi_store32(iter_base + 20, payload412.values.length()) - mbt_ffi_store32(iter_base + 16, address418) - cleanup_list.push(ptr413) - cleanup_list.push(address418) + mbt_ffi_store32(iter_base + 20, payload414.values.length()) + mbt_ffi_store32(iter_base + 16, address420) + cleanup_list.push(ptr415) + cleanup_list.push(address420) () } - PropMatches(payload420) => { + PropMatches(payload422) => { mbt_ffi_store8(iter_base + 0, 8) - let ptr421 = mbt_ffi_str2ptr(payload420.property_name) + let ptr423 = mbt_ffi_str2ptr(payload422.property_name) mbt_ffi_store32( iter_base + 12, - payload420.property_name.length(), + payload422.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr421) + mbt_ffi_store32(iter_base + 8, ptr423) - let ptr422 = mbt_ffi_str2ptr(payload420.pattern) - mbt_ffi_store32(iter_base + 20, payload420.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr422) - cleanup_list.push(ptr421) - cleanup_list.push(ptr422) + let ptr424 = mbt_ffi_str2ptr(payload422.pattern) + mbt_ffi_store32(iter_base + 20, payload422.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr424) + cleanup_list.push(ptr423) + cleanup_list.push(ptr424) () } - PropStartsWith(payload423) => { + PropStartsWith(payload425) => { mbt_ffi_store8(iter_base + 0, 9) - let ptr424 = mbt_ffi_str2ptr(payload423.property_name) + let ptr426 = mbt_ffi_str2ptr(payload425.property_name) mbt_ffi_store32( iter_base + 12, - payload423.property_name.length(), + payload425.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr424) + mbt_ffi_store32(iter_base + 8, ptr426) - let ptr425 = mbt_ffi_str2ptr(payload423.pattern) - mbt_ffi_store32(iter_base + 20, payload423.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr425) - cleanup_list.push(ptr424) - cleanup_list.push(ptr425) + let ptr427 = mbt_ffi_str2ptr(payload425.pattern) + mbt_ffi_store32(iter_base + 20, payload425.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr427) + cleanup_list.push(ptr426) + cleanup_list.push(ptr427) () } - PropContains(payload426) => { + PropContains(payload428) => { mbt_ffi_store8(iter_base + 0, 10) - let ptr427 = mbt_ffi_str2ptr(payload426.property_name) + let ptr429 = mbt_ffi_str2ptr(payload428.property_name) mbt_ffi_store32( iter_base + 12, - payload426.property_name.length(), + payload428.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr427) + mbt_ffi_store32(iter_base + 8, ptr429) - let ptr428 = mbt_ffi_str2ptr(payload426.pattern) - mbt_ffi_store32(iter_base + 20, payload426.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr428) - cleanup_list.push(ptr427) - cleanup_list.push(ptr428) + let ptr430 = mbt_ffi_str2ptr(payload428.pattern) + mbt_ffi_store32(iter_base + 20, payload428.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr430) + cleanup_list.push(ptr429) + cleanup_list.push(ptr430) () } - PredAnd(payload429) => { + PredAnd(payload431) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload429.0) - mbt_ffi_store32(iter_base + 12, payload429.1) + mbt_ffi_store32(iter_base + 8, payload431.0) + mbt_ffi_store32(iter_base + 12, payload431.1) () } - PredOr(payload430) => { + PredOr(payload432) => { mbt_ffi_store8(iter_base + 0, 12) - mbt_ffi_store32(iter_base + 8, payload430.0) - mbt_ffi_store32(iter_base + 12, payload430.1) + mbt_ffi_store32(iter_base + 8, payload432.0) + mbt_ffi_store32(iter_base + 12, payload432.1) () } - PredNot(payload431) => { + PredNot(payload433) => { mbt_ffi_store8(iter_base + 0, 13) - mbt_ffi_store32(iter_base + 8, payload431) + mbt_ffi_store32(iter_base + 8, payload433) () } @@ -4255,91 +4263,91 @@ pub fn enrich_oplog_entries( } mbt_ffi_store32( iter_base + 12, - payload373.predicate.nodes.length(), + payload375.predicate.nodes.length(), ) - mbt_ffi_store32(iter_base + 8, address434) - mbt_ffi_store32(iter_base + 16, payload373.inner) - cleanup_list.push(address434) + mbt_ffi_store32(iter_base + 8, address436) + mbt_ffi_store32(iter_base + 16, payload375.inner) + cleanup_list.push(address436) () } - AndThen(payload436) => { + AndThen(payload438) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload436.0) - mbt_ffi_store32(iter_base + 12, payload436.1) + mbt_ffi_store32(iter_base + 8, payload438.0) + mbt_ffi_store32(iter_base + 12, payload438.1) () } - PolicyUnion(payload437) => { + PolicyUnion(payload439) => { mbt_ffi_store8(iter_base + 0, 12) - mbt_ffi_store32(iter_base + 8, payload437.0) - mbt_ffi_store32(iter_base + 12, payload437.1) + mbt_ffi_store32(iter_base + 8, payload439.0) + mbt_ffi_store32(iter_base + 12, payload439.1) () } - PolicyIntersect(payload438) => { + PolicyIntersect(payload440) => { mbt_ffi_store8(iter_base + 0, 13) - mbt_ffi_store32(iter_base + 8, payload438.0) - mbt_ffi_store32(iter_base + 12, payload438.1) + mbt_ffi_store32(iter_base + 8, payload440.0) + mbt_ffi_store32(iter_base + 12, payload440.1) () } } } - mbt_ffi_store32(iter_base + 56, payload299.policy.policy.nodes.length()) - mbt_ffi_store32(iter_base + 52, address439) - cleanup_list.push(ptr300) - cleanup_list.push(address361) - cleanup_list.push(address439) + mbt_ffi_store32(iter_base + 56, payload301.policy.policy.nodes.length()) + mbt_ffi_store32(iter_base + 52, address441) + cleanup_list.push(ptr302) + cleanup_list.push(address363) + cleanup_list.push(address441) () } - RemoveRetryPolicy(payload441) => { + RemoveRetryPolicy(payload443) => { mbt_ffi_store8(iter_base + 8, 40) - mbt_ffi_store64(iter_base + 16, payload441.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload443.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload441.timestamp.nanoseconds.reinterpret_as_int(), + payload443.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr442 = mbt_ffi_str2ptr(payload441.name) - mbt_ffi_store32(iter_base + 36, payload441.name.length()) - mbt_ffi_store32(iter_base + 32, ptr442) - cleanup_list.push(ptr442) + let ptr444 = mbt_ffi_str2ptr(payload443.name) + mbt_ffi_store32(iter_base + 36, payload443.name.length()) + mbt_ffi_store32(iter_base + 32, ptr444) + cleanup_list.push(ptr444) () } - CardEventQueued(payload443) => { + CardEventQueued(payload445) => { mbt_ffi_store8(iter_base + 8, 41) - mbt_ffi_store64(iter_base + 16, payload443.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload445.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload443.timestamp.nanoseconds.reinterpret_as_int(), + payload445.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload443.event { - Install(payload444) => { + match payload445.event { + Install(payload446) => { mbt_ffi_store8(iter_base + 32, 0) mbt_ffi_store64( iter_base + 40, - payload444.card_id.uuid.high_bits.reinterpret_as_int64(), + payload446.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload444.card_id.uuid.low_bits.reinterpret_as_int64(), + payload446.card_id.uuid.low_bits.reinterpret_as_int64(), ) () } - Revoke(payload445) => { + Revoke(payload447) => { mbt_ffi_store8(iter_base + 32, 1) mbt_ffi_store64( iter_base + 40, - payload445.card_id.uuid.high_bits.reinterpret_as_int64(), + payload447.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload445.card_id.uuid.low_bits.reinterpret_as_int64(), + payload447.card_id.uuid.low_bits.reinterpret_as_int64(), ) () @@ -4348,140 +4356,140 @@ pub fn enrich_oplog_entries( () } - CardInstalled(payload446) => { + CardInstalled(payload448) => { mbt_ffi_store8(iter_base + 8, 42) - mbt_ffi_store64(iter_base + 16, payload446.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload448.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload446.timestamp.nanoseconds.reinterpret_as_int(), + payload448.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload446.queued_event_index { + match payload448.queued_event_index { None => { mbt_ffi_store8(iter_base + 32, 0) () } - Some(payload448) => { + Some(payload450) => { mbt_ffi_store8(iter_base + 32, 1) - mbt_ffi_store64(iter_base + 40, payload448.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 40, payload450.reinterpret_as_int64()) () } } - let ptr449 = mbt_ffi_bytes2ptr(payload446.card) + let ptr451 = mbt_ffi_bytes2ptr(payload448.card) - mbt_ffi_store32(iter_base + 52, payload446.card.length()) - mbt_ffi_store32(iter_base + 48, ptr449) - cleanup_list.push(ptr449) + mbt_ffi_store32(iter_base + 52, payload448.card.length()) + mbt_ffi_store32(iter_base + 48, ptr451) + cleanup_list.push(ptr451) () } - CardInstallFailed(payload450) => { + CardInstallFailed(payload452) => { mbt_ffi_store8(iter_base + 8, 43) - mbt_ffi_store64(iter_base + 16, payload450.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload452.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload450.timestamp.nanoseconds.reinterpret_as_int(), + payload452.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload450.queued_event_index.reinterpret_as_int64(), + payload452.queued_event_index.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload450.card_id.uuid.high_bits.reinterpret_as_int64(), + payload452.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload450.card_id.uuid.low_bits.reinterpret_as_int64(), + payload452.card_id.uuid.low_bits.reinterpret_as_int64(), ) - mbt_ffi_store8(iter_base + 56, payload450.reason.ordinal()) + mbt_ffi_store8(iter_base + 56, payload452.reason.ordinal()) () } - CardRevoked(payload451) => { + CardRevoked(payload453) => { mbt_ffi_store8(iter_base + 8, 44) - mbt_ffi_store64(iter_base + 16, payload451.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload453.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload451.timestamp.nanoseconds.reinterpret_as_int(), + payload453.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload451.queued_event_index.reinterpret_as_int64(), + payload453.queued_event_index.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload451.card_id.uuid.high_bits.reinterpret_as_int64(), + payload453.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload451.card_id.uuid.low_bits.reinterpret_as_int64(), + payload453.card_id.uuid.low_bits.reinterpret_as_int64(), ) () } - CardExpired(payload452) => { + CardExpired(payload454) => { mbt_ffi_store8(iter_base + 8, 45) - mbt_ffi_store64(iter_base + 16, payload452.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload454.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload452.timestamp.nanoseconds.reinterpret_as_int(), + payload454.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload452.card_id.uuid.high_bits.reinterpret_as_int64(), + payload454.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload452.card_id.uuid.low_bits.reinterpret_as_int64(), + payload454.card_id.uuid.low_bits.reinterpret_as_int64(), ) () } - HostStreamFrame(payload453) => { + HostStreamFrame(payload455) => { mbt_ffi_store8(iter_base + 8, 46) - mbt_ffi_store64(iter_base + 16, payload453.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload455.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload453.timestamp.nanoseconds.reinterpret_as_int(), + payload455.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload453.parent_start_index.reinterpret_as_int64(), + payload455.parent_start_index.reinterpret_as_int64(), ) - mbt_ffi_store8(iter_base + 40, payload453.kind.ordinal()) + mbt_ffi_store8(iter_base + 40, payload455.kind.ordinal()) - match payload453.payload { - Inline(payload454) => { + match payload455.payload { + Inline(payload456) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr455 = mbt_ffi_bytes2ptr(payload454) + let ptr457 = mbt_ffi_bytes2ptr(payload456) - mbt_ffi_store32(iter_base + 60, payload454.length()) - mbt_ffi_store32(iter_base + 56, ptr455) - cleanup_list.push(ptr455) + mbt_ffi_store32(iter_base + 60, payload456.length()) + mbt_ffi_store32(iter_base + 56, ptr457) + cleanup_list.push(ptr457) () } - External(payload456) => { + External(payload458) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload456.payload_id.high_bits.reinterpret_as_int64(), + payload458.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 64, - payload456.payload_id.low_bits.reinterpret_as_int64(), + payload458.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr457 = mbt_ffi_bytes2ptr(payload456.md5_hash) + let ptr459 = mbt_ffi_bytes2ptr(payload458.md5_hash) - mbt_ffi_store32(iter_base + 76, payload456.md5_hash.length()) - mbt_ffi_store32(iter_base + 72, ptr457) - cleanup_list.push(ptr457) + mbt_ffi_store32(iter_base + 76, payload458.md5_hash.length()) + mbt_ffi_store32(iter_base + 72, ptr459) + cleanup_list.push(ptr459) () } @@ -4489,16 +4497,16 @@ pub fn enrich_oplog_entries( () } - CompletionDiscarded(payload458) => { + CompletionDiscarded(payload460) => { mbt_ffi_store8(iter_base + 8, 47) - mbt_ffi_store64(iter_base + 16, payload458.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload460.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload458.timestamp.nanoseconds.reinterpret_as_int(), + payload460.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload458.start_index.reinterpret_as_int64(), + payload460.start_index.reinterpret_as_int64(), ) () @@ -4513,21 +4521,21 @@ pub fn enrich_oplog_entries( agent_id.component_id.uuid.low_bits.reinterpret_as_int64(), ptr, agent_id.agent_id.length(), - address459, + address461, entries.length(), component_revision.reinterpret_as_int64(), return_area, ) - let lifted3300 = match mbt_ffi_load8_u(return_area + 0) { + let lifted3302 = match mbt_ffi_load8_u(return_area + 0) { 0 => { - let array3297 : Array[PublicOplogEntry] = [] - for index3298 = 0 - index3298 < mbt_ffi_load32(return_area + 8) - index3298 = index3298 + 1 { - let iter_base = mbt_ffi_load32(return_area + 4) + index3298 * 208 + let array3299 : Array[PublicOplogEntry] = [] + for index3300 = 0 + index3300 < mbt_ffi_load32(return_area + 8) + index3300 = index3300 + 1 { + let iter_base = mbt_ffi_load32(return_area + 4) + index3300 * 208 - let lifted3296 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3298 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { let result = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), @@ -4535,22 +4543,22 @@ pub fn enrich_oplog_entries( ) let array : Array[(String, String)] = [] - for index463 = 0 - index463 < mbt_ffi_load32(iter_base + 68) - index463 = index463 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 64) + index463 * 16 + for index465 = 0 + index465 < mbt_ffi_load32(iter_base + 68) + index465 = index465 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 64) + index465 * 16 - let result461 = mbt_ffi_ptr2str( + let result463 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result462 = mbt_ffi_ptr2str( + let result464 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array.push((result461, result462)) + array.push((result463, result464)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) @@ -4558,7 +4566,7 @@ pub fn enrich_oplog_entries( mbt_ffi_load8_u(iter_base + 104) { 0 => Option::None 1 => { - let result464 = mbt_ffi_ptr2str( + let result466 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 128), mbt_ffi_load32(iter_base + 132), ) @@ -4570,49 +4578,49 @@ pub fn enrich_oplog_entries( low_bits: mbt_ffi_load64(iter_base + 120).reinterpret_as_uint64(), }, }, - agent_id: result464, + agent_id: result466, }) } _ => panic() } - let array471 : Array[PluginInstallationDescription] = [] - for index472 = 0 - index472 < mbt_ffi_load32(iter_base + 156) - index472 = index472 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 152) + index472 * 48 + let array473 : Array[PluginInstallationDescription] = [] + for index474 = 0 + index474 < mbt_ffi_load32(iter_base + 156) + index474 = index474 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 152) + index474 * 48 - let result465 = mbt_ffi_ptr2str( + let result467 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - let result466 = mbt_ffi_ptr2str( + let result468 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - let array469 : Array[(String, String)] = [] - for index470 = 0 - index470 < mbt_ffi_load32(iter_base + 40) - index470 = index470 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index470 * 16 + let array471 : Array[(String, String)] = [] + for index472 = 0 + index472 < mbt_ffi_load32(iter_base + 40) + index472 = index472 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index472 * 16 - let result467 = mbt_ffi_ptr2str( + let result469 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result468 = mbt_ffi_ptr2str( + let result470 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array469.push((result467, result468)) + array471.push((result469, result470)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - array471.push(PluginInstallationDescription::{ + array473.push(PluginInstallationDescription::{ environment_plugin_grant_id: EnvironmentPluginGrantId::{ uuid: @types.Uuid::{ high_bits: mbt_ffi_load64(iter_base + 0).reinterpret_as_uint64(), @@ -4620,56 +4628,56 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 16), - plugin_name: result465, - plugin_version: result466, - parameters: array469, + plugin_name: result467, + plugin_version: result468, + parameters: array471, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 152)) - let array710 : Array[LocalAgentConfigEntry] = [] - for index711 = 0 - index711 < mbt_ffi_load32(iter_base + 164) - index711 = index711 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 160) + index711 * 40 + let array712 : Array[LocalAgentConfigEntry] = [] + for index713 = 0 + index713 < mbt_ffi_load32(iter_base + 164) + index713 = index713 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 160) + index713 * 40 - let array474 : Array[String] = [] - for index475 = 0 - index475 < mbt_ffi_load32(iter_base + 4) - index475 = index475 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 0) + index475 * 8 + let array476 : Array[String] = [] + for index477 = 0 + index477 < mbt_ffi_load32(iter_base + 4) + index477 = index477 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 0) + index477 * 8 - let result473 = mbt_ffi_ptr2str( + let result475 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array474.push(result473) + array476.push(result475) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - let array672 : Array[@types.SchemaTypeNode] = [] - for index673 = 0 - index673 < mbt_ffi_load32(iter_base + 12) - index673 = index673 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index673 * 144 + let array674 : Array[@types.SchemaTypeNode] = [] + for index675 = 0 + index675 < mbt_ffi_load32(iter_base + 12) + index675 = index675 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index675 * 144 - let lifted658 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted660 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted482 : @types.NumericRestrictions? = match + let lifted484 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted477 : @types.NumericBound? = match + let lifted479 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted476 = match + let lifted478 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -4686,16 +4694,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted476) + Option::Some(lifted478) } _ => panic() } - let lifted479 : @types.NumericBound? = match + let lifted481 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted478 = match + let lifted480 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -4712,46 +4720,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted478) + Option::Some(lifted480) } _ => panic() } - let lifted481 : String? = match + let lifted483 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result480 = mbt_ffi_ptr2str( + let result482 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result480) + Option::Some(result482) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted477, - max: lifted479, - unit: lifted481, + min: lifted479, + max: lifted481, + unit: lifted483, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted482) + @types.SchemaTypeBody::S8Type(lifted484) } 3 => { - let lifted489 : @types.NumericRestrictions? = match + let lifted491 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted484 : @types.NumericBound? = match + let lifted486 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted483 = match + let lifted485 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -4768,16 +4776,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted483) + Option::Some(lifted485) } _ => panic() } - let lifted486 : @types.NumericBound? = match + let lifted488 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted485 = match + let lifted487 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -4794,46 +4802,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted485) + Option::Some(lifted487) } _ => panic() } - let lifted488 : String? = match + let lifted490 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result487 = mbt_ffi_ptr2str( + let result489 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result487) + Option::Some(result489) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted484, - max: lifted486, - unit: lifted488, + min: lifted486, + max: lifted488, + unit: lifted490, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted489) + @types.SchemaTypeBody::S16Type(lifted491) } 4 => { - let lifted496 : @types.NumericRestrictions? = match + let lifted498 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted491 : @types.NumericBound? = match + let lifted493 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted490 = match + let lifted492 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -4850,16 +4858,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted490) + Option::Some(lifted492) } _ => panic() } - let lifted493 : @types.NumericBound? = match + let lifted495 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted492 = match + let lifted494 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -4876,46 +4884,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted492) + Option::Some(lifted494) } _ => panic() } - let lifted495 : String? = match + let lifted497 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result494 = mbt_ffi_ptr2str( + let result496 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result494) + Option::Some(result496) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted491, - max: lifted493, - unit: lifted495, + min: lifted493, + max: lifted495, + unit: lifted497, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted496) + @types.SchemaTypeBody::S32Type(lifted498) } 5 => { - let lifted503 : @types.NumericRestrictions? = match + let lifted505 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted498 : @types.NumericBound? = match + let lifted500 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted497 = match + let lifted499 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -4932,16 +4940,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted497) + Option::Some(lifted499) } _ => panic() } - let lifted500 : @types.NumericBound? = match + let lifted502 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted499 = match + let lifted501 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -4958,46 +4966,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted499) + Option::Some(lifted501) } _ => panic() } - let lifted502 : String? = match + let lifted504 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result501 = mbt_ffi_ptr2str( + let result503 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result501) + Option::Some(result503) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted498, - max: lifted500, - unit: lifted502, + min: lifted500, + max: lifted502, + unit: lifted504, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted503) + @types.SchemaTypeBody::S64Type(lifted505) } 6 => { - let lifted510 : @types.NumericRestrictions? = match + let lifted512 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted505 : @types.NumericBound? = match + let lifted507 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted504 = match + let lifted506 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5014,16 +5022,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted504) + Option::Some(lifted506) } _ => panic() } - let lifted507 : @types.NumericBound? = match + let lifted509 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted506 = match + let lifted508 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5040,46 +5048,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted506) + Option::Some(lifted508) } _ => panic() } - let lifted509 : String? = match + let lifted511 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result508 = mbt_ffi_ptr2str( + let result510 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result508) + Option::Some(result510) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted505, - max: lifted507, - unit: lifted509, + min: lifted507, + max: lifted509, + unit: lifted511, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted510) + @types.SchemaTypeBody::U8Type(lifted512) } 7 => { - let lifted517 : @types.NumericRestrictions? = match + let lifted519 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted512 : @types.NumericBound? = match + let lifted514 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted511 = match + let lifted513 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5096,16 +5104,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted511) + Option::Some(lifted513) } _ => panic() } - let lifted514 : @types.NumericBound? = match + let lifted516 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted513 = match + let lifted515 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5122,46 +5130,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted513) + Option::Some(lifted515) } _ => panic() } - let lifted516 : String? = match + let lifted518 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result515 = mbt_ffi_ptr2str( + let result517 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result515) + Option::Some(result517) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted512, - max: lifted514, - unit: lifted516, + min: lifted514, + max: lifted516, + unit: lifted518, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted517) + @types.SchemaTypeBody::U16Type(lifted519) } 8 => { - let lifted524 : @types.NumericRestrictions? = match + let lifted526 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted519 : @types.NumericBound? = match + let lifted521 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted518 = match + let lifted520 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5178,16 +5186,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted518) + Option::Some(lifted520) } _ => panic() } - let lifted521 : @types.NumericBound? = match + let lifted523 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted520 = match + let lifted522 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5204,46 +5212,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted520) + Option::Some(lifted522) } _ => panic() } - let lifted523 : String? = match + let lifted525 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result522 = mbt_ffi_ptr2str( + let result524 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result522) + Option::Some(result524) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted519, - max: lifted521, - unit: lifted523, + min: lifted521, + max: lifted523, + unit: lifted525, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted524) + @types.SchemaTypeBody::U32Type(lifted526) } 9 => { - let lifted531 : @types.NumericRestrictions? = match + let lifted533 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted526 : @types.NumericBound? = match + let lifted528 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted525 = match + let lifted527 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5260,16 +5268,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted525) + Option::Some(lifted527) } _ => panic() } - let lifted528 : @types.NumericBound? = match + let lifted530 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted527 = match + let lifted529 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5286,46 +5294,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted527) + Option::Some(lifted529) } _ => panic() } - let lifted530 : String? = match + let lifted532 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result529 = mbt_ffi_ptr2str( + let result531 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result529) + Option::Some(result531) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted526, - max: lifted528, - unit: lifted530, + min: lifted528, + max: lifted530, + unit: lifted532, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted531) + @types.SchemaTypeBody::U64Type(lifted533) } 10 => { - let lifted538 : @types.NumericRestrictions? = match + let lifted540 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted533 : @types.NumericBound? = match + let lifted535 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted532 = match + let lifted534 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5342,16 +5350,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted532) + Option::Some(lifted534) } _ => panic() } - let lifted535 : @types.NumericBound? = match + let lifted537 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted534 = match + let lifted536 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5368,46 +5376,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted534) + Option::Some(lifted536) } _ => panic() } - let lifted537 : String? = match + let lifted539 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result536 = mbt_ffi_ptr2str( + let result538 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result536) + Option::Some(result538) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted533, - max: lifted535, - unit: lifted537, + min: lifted535, + max: lifted537, + unit: lifted539, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted538) + @types.SchemaTypeBody::F32Type(lifted540) } 11 => { - let lifted545 : @types.NumericRestrictions? = match + let lifted547 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted540 : @types.NumericBound? = match + let lifted542 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted539 = match + let lifted541 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5424,16 +5432,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted539) + Option::Some(lifted541) } _ => panic() } - let lifted542 : @types.NumericBound? = match + let lifted544 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted541 = match + let lifted543 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5450,324 +5458,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted541) + Option::Some(lifted543) } _ => panic() } - let lifted544 : String? = match + let lifted546 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result543 = mbt_ffi_ptr2str( + let result545 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result543) + Option::Some(result545) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted540, - max: lifted542, - unit: lifted544, + min: lifted542, + max: lifted544, + unit: lifted546, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted545) + @types.SchemaTypeBody::F64Type(lifted547) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array560 : Array[@types.NamedFieldType] = [] - for index561 = 0 - index561 < mbt_ffi_load32(iter_base + 12) - index561 = index561 + 1 { + let array562 : Array[@types.NamedFieldType] = [] + for index563 = 0 + index563 < mbt_ffi_load32(iter_base + 12) + index563 = index563 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index561 * 68 + index563 * 68 - let result546 = mbt_ffi_ptr2str( + let result548 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted548 : String? = match + let lifted550 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result547 = mbt_ffi_ptr2str( + let result549 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result547) + Option::Some(result549) } _ => panic() } - let array550 : Array[String] = [] - for index551 = 0 - index551 < mbt_ffi_load32(iter_base + 28) - index551 = index551 + 1 { + let array552 : Array[String] = [] + for index553 = 0 + index553 < mbt_ffi_load32(iter_base + 28) + index553 = index553 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index551 * 8 + index553 * 8 - let result549 = mbt_ffi_ptr2str( + let result551 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array550.push(result549) + array552.push(result551) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array553 : Array[String] = [] - for index554 = 0 - index554 < mbt_ffi_load32(iter_base + 36) - index554 = index554 + 1 { + let array555 : Array[String] = [] + for index556 = 0 + index556 < mbt_ffi_load32(iter_base + 36) + index556 = index556 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index554 * 8 + index556 * 8 - let result552 = mbt_ffi_ptr2str( + let result554 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array553.push(result552) + array555.push(result554) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted556 : String? = match + let lifted558 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result555 = mbt_ffi_ptr2str( + let result557 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result555) + Option::Some(result557) } _ => panic() } - let lifted559 : @types.Role? = match + let lifted561 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted558 = match + let lifted560 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result557 = mbt_ffi_ptr2str( + let result559 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result557) + @types.Role::Other(result559) } _ => panic() } - Option::Some(lifted558) + Option::Some(lifted560) } _ => panic() } - array560.push(@types.NamedFieldType::{ - name: result546, + array562.push(@types.NamedFieldType::{ + name: result548, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted548, - aliases: array550, - examples: array553, - deprecated: lifted556, - role: lifted559, + doc: lifted550, + aliases: array552, + examples: array555, + deprecated: lifted558, + role: lifted561, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array560) + @types.SchemaTypeBody::RecordType(array562) } 15 => { - let array577 : Array[@types.VariantCaseType] = [] - for index578 = 0 - index578 < mbt_ffi_load32(iter_base + 12) - index578 = index578 + 1 { + let array579 : Array[@types.VariantCaseType] = [] + for index580 = 0 + index580 < mbt_ffi_load32(iter_base + 12) + index580 = index580 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index578 * 72 + index580 * 72 - let result562 = mbt_ffi_ptr2str( + let result564 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted563 : Int? = match + let lifted565 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted565 : String? = match + let lifted567 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result564 = mbt_ffi_ptr2str( + let result566 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result564) + Option::Some(result566) } _ => panic() } - let array567 : Array[String] = [] - for index568 = 0 - index568 < mbt_ffi_load32(iter_base + 32) - index568 = index568 + 1 { + let array569 : Array[String] = [] + for index570 = 0 + index570 < mbt_ffi_load32(iter_base + 32) + index570 = index570 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index568 * 8 + index570 * 8 - let result566 = mbt_ffi_ptr2str( + let result568 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array567.push(result566) + array569.push(result568) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array570 : Array[String] = [] - for index571 = 0 - index571 < mbt_ffi_load32(iter_base + 40) - index571 = index571 + 1 { + let array572 : Array[String] = [] + for index573 = 0 + index573 < mbt_ffi_load32(iter_base + 40) + index573 = index573 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index571 * 8 + index573 * 8 - let result569 = mbt_ffi_ptr2str( + let result571 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array570.push(result569) + array572.push(result571) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted573 : String? = match + let lifted575 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result572 = mbt_ffi_ptr2str( + let result574 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result572) + Option::Some(result574) } _ => panic() } - let lifted576 : @types.Role? = match + let lifted578 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted575 = match + let lifted577 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result574 = mbt_ffi_ptr2str( + let result576 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result574) + @types.Role::Other(result576) } _ => panic() } - Option::Some(lifted575) + Option::Some(lifted577) } _ => panic() } - array577.push(@types.VariantCaseType::{ - name: result562, - payload: lifted563, + array579.push(@types.VariantCaseType::{ + name: result564, + payload: lifted565, metadata: @types.MetadataEnvelope::{ - doc: lifted565, - aliases: array567, - examples: array570, - deprecated: lifted573, - role: lifted576, + doc: lifted567, + aliases: array569, + examples: array572, + deprecated: lifted575, + role: lifted578, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array577) + @types.SchemaTypeBody::VariantType(array579) } 16 => { - let array580 : Array[String] = [] - for index581 = 0 - index581 < mbt_ffi_load32(iter_base + 12) - index581 = index581 + 1 { + let array582 : Array[String] = [] + for index583 = 0 + index583 < mbt_ffi_load32(iter_base + 12) + index583 = index583 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index581 * 8 + index583 * 8 - let result579 = mbt_ffi_ptr2str( + let result581 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array580.push(result579) + array582.push(result581) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array580) + @types.SchemaTypeBody::EnumType(array582) } 17 => { - let array583 : Array[String] = [] - for index584 = 0 - index584 < mbt_ffi_load32(iter_base + 12) - index584 = index584 + 1 { + let array585 : Array[String] = [] + for index586 = 0 + index586 < mbt_ffi_load32(iter_base + 12) + index586 = index586 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index584 * 8 + index586 * 8 - let result582 = mbt_ffi_ptr2str( + let result584 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array583.push(result582) + array585.push(result584) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array583) + @types.SchemaTypeBody::FlagsType(array585) } 18 => { - let array585 : Array[Int] = [] - for index586 = 0 - index586 < mbt_ffi_load32(iter_base + 12) - index586 = index586 + 1 { + let array587 : Array[Int] = [] + for index588 = 0 + index588 < mbt_ffi_load32(iter_base + 12) + index588 = index588 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index586 * 4 + index588 * 4 - array585.push(mbt_ffi_load32(iter_base + 0)) + array587.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array585) + @types.SchemaTypeBody::TupleType(array587) } 19 => @types.SchemaTypeBody::ListType( @@ -5788,14 +5796,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted587 : Int? = match + let lifted589 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted588 : Int? = match + let lifted590 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -5803,37 +5811,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted587, - err: lifted588, + ok: lifted589, + err: lifted590, }) } 24 => { - let lifted592 : Array[String]? = match + let lifted594 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array590 : Array[String] = [] - for index591 = 0 - index591 < mbt_ffi_load32(iter_base + 16) - index591 = index591 + 1 { + let array592 : Array[String] = [] + for index593 = 0 + index593 < mbt_ffi_load32(iter_base + 16) + index593 = index593 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index591 * 8 + index593 * 8 - let result589 = mbt_ffi_ptr2str( + let result591 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array590.push(result589) + array592.push(result591) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array590) + Option::Some(array592) } _ => panic() } - let lifted593 : UInt? = match + let lifted595 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -5843,7 +5851,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted594 : UInt? = match + let lifted596 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -5853,54 +5861,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted596 : String? = match + let lifted598 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result595 = mbt_ffi_ptr2str( + let result597 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result595) + Option::Some(result597) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted592, - min_length: lifted593, - max_length: lifted594, - regex: lifted596, + languages: lifted594, + min_length: lifted595, + max_length: lifted596, + regex: lifted598, }) } 25 => { - let lifted600 : Array[String]? = match + let lifted602 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array598 : Array[String] = [] - for index599 = 0 - index599 < mbt_ffi_load32(iter_base + 16) - index599 = index599 + 1 { + let array600 : Array[String] = [] + for index601 = 0 + index601 < mbt_ffi_load32(iter_base + 16) + index601 = index601 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index599 * 8 + index601 * 8 - let result597 = mbt_ffi_ptr2str( + let result599 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array598.push(result597) + array600.push(result599) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array598) + Option::Some(array600) } _ => panic() } - let lifted601 : UInt? = match + let lifted603 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -5910,7 +5918,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted602 : UInt? = match + let lifted604 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -5921,58 +5929,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted600, - min_bytes: lifted601, - max_bytes: lifted602, + mime_types: lifted602, + min_bytes: lifted603, + max_bytes: lifted604, }) } 26 => { - let lifted606 : Array[String]? = match + let lifted608 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array604 : Array[String] = [] - for index605 = 0 - index605 < mbt_ffi_load32(iter_base + 20) - index605 = index605 + 1 { + let array606 : Array[String] = [] + for index607 = 0 + index607 < mbt_ffi_load32(iter_base + 20) + index607 = index607 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index605 * 8 + index607 * 8 - let result603 = mbt_ffi_ptr2str( + let result605 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array604.push(result603) + array606.push(result605) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array604) + Option::Some(array606) } _ => panic() } - let lifted610 : Array[String]? = match + let lifted612 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array608 : Array[String] = [] - for index609 = 0 - index609 < mbt_ffi_load32(iter_base + 32) - index609 = index609 + 1 { + let array610 : Array[String] = [] + for index611 = 0 + index611 < mbt_ffi_load32(iter_base + 32) + index611 = index611 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index609 * 8 + index611 * 8 - let result607 = mbt_ffi_ptr2str( + let result609 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array608.push(result607) + array610.push(result609) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array608) + Option::Some(array610) } _ => panic() } @@ -5984,95 +5992,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted606, - allowed_extensions: lifted610, + allowed_mime_types: lifted608, + allowed_extensions: lifted612, }) } 27 => { - let lifted614 : Array[String]? = match + let lifted616 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array612 : Array[String] = [] - for index613 = 0 - index613 < mbt_ffi_load32(iter_base + 16) - index613 = index613 + 1 { + let array614 : Array[String] = [] + for index615 = 0 + index615 < mbt_ffi_load32(iter_base + 16) + index615 = index615 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index613 * 8 + index615 * 8 - let result611 = mbt_ffi_ptr2str( + let result613 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array612.push(result611) + array614.push(result613) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array612) + Option::Some(array614) } _ => panic() } - let lifted618 : Array[String]? = match + let lifted620 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array616 : Array[String] = [] - for index617 = 0 - index617 < mbt_ffi_load32(iter_base + 28) - index617 = index617 + 1 { + let array618 : Array[String] = [] + for index619 = 0 + index619 < mbt_ffi_load32(iter_base + 28) + index619 = index619 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index617 * 8 + index619 * 8 - let result615 = mbt_ffi_ptr2str( + let result617 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array616.push(result615) + array618.push(result617) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array616) + Option::Some(array618) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted614, - allowed_hosts: lifted618, + allowed_schemes: lifted616, + allowed_hosts: lifted620, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result619 = mbt_ffi_ptr2str( + let result621 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array621 : Array[String] = [] - for index622 = 0 - index622 < mbt_ffi_load32(iter_base + 20) - index622 = index622 + 1 { + let array623 : Array[String] = [] + for index624 = 0 + index624 < mbt_ffi_load32(iter_base + 20) + index624 = index624 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index622 * 8 + index624 * 8 - let result620 = mbt_ffi_ptr2str( + let result622 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array621.push(result620) + array623.push(result622) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted624 : @types.QuantityValue? = match + let lifted626 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result623 = mbt_ffi_ptr2str( + let result625 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -6080,17 +6088,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result623, + unit: result625, }) } _ => panic() } - let lifted626 : @types.QuantityValue? = match + let lifted628 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result625 = mbt_ffi_ptr2str( + let result627 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -6098,401 +6106,401 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result625, + unit: result627, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result619, - allowed_suffixes: array621, - min: lifted624, - max: lifted626, + base_unit: result621, + allowed_suffixes: array623, + min: lifted626, + max: lifted628, }) } 31 => { - let array650 : Array[@types.UnionBranch] = [] - for index651 = 0 - index651 < mbt_ffi_load32(iter_base + 12) - index651 = index651 + 1 { + let array652 : Array[@types.UnionBranch] = [] + for index653 = 0 + index653 < mbt_ffi_load32(iter_base + 12) + index653 = index653 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index651 * 92 + index653 * 92 - let result627 = mbt_ffi_ptr2str( + let result629 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted636 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted638 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result628 = mbt_ffi_ptr2str( + let result630 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result628) + @types.DiscriminatorRule::Prefix(result630) } 1 => { - let result629 = mbt_ffi_ptr2str( + let result631 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result629) + @types.DiscriminatorRule::Suffix(result631) } 2 => { - let result630 = mbt_ffi_ptr2str( + let result632 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result630) + @types.DiscriminatorRule::Contains(result632) } 3 => { - let result631 = mbt_ffi_ptr2str( + let result633 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result631) + @types.DiscriminatorRule::Regex(result633) } 4 => { - let result632 = mbt_ffi_ptr2str( + let result634 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted634 : String? = match + let lifted636 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result633 = mbt_ffi_ptr2str( + let result635 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result633) + Option::Some(result635) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result632, - literal: lifted634, + field_name: result634, + literal: lifted636, }) } 5 => { - let result635 = mbt_ffi_ptr2str( + let result637 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result635) + @types.DiscriminatorRule::FieldAbsent(result637) } _ => panic() } - let lifted638 : String? = match + let lifted640 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result637 = mbt_ffi_ptr2str( + let result639 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result637) + Option::Some(result639) } _ => panic() } - let array640 : Array[String] = [] - for index641 = 0 - index641 < mbt_ffi_load32(iter_base + 52) - index641 = index641 + 1 { + let array642 : Array[String] = [] + for index643 = 0 + index643 < mbt_ffi_load32(iter_base + 52) + index643 = index643 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index641 * 8 + index643 * 8 - let result639 = mbt_ffi_ptr2str( + let result641 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array640.push(result639) + array642.push(result641) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array643 : Array[String] = [] - for index644 = 0 - index644 < mbt_ffi_load32(iter_base + 60) - index644 = index644 + 1 { + let array645 : Array[String] = [] + for index646 = 0 + index646 < mbt_ffi_load32(iter_base + 60) + index646 = index646 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index644 * 8 + index646 * 8 - let result642 = mbt_ffi_ptr2str( + let result644 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array643.push(result642) + array645.push(result644) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted646 : String? = match + let lifted648 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result645 = mbt_ffi_ptr2str( + let result647 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result645) + Option::Some(result647) } _ => panic() } - let lifted649 : @types.Role? = match + let lifted651 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted648 = match + let lifted650 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result647 = mbt_ffi_ptr2str( + let result649 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result647) + @types.Role::Other(result649) } _ => panic() } - Option::Some(lifted648) + Option::Some(lifted650) } _ => panic() } - array650.push(@types.UnionBranch::{ - tag: result627, + array652.push(@types.UnionBranch::{ + tag: result629, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted636, + discriminator: lifted638, metadata: @types.MetadataEnvelope::{ - doc: lifted638, - aliases: array640, - examples: array643, - deprecated: lifted646, - role: lifted649, + doc: lifted640, + aliases: array642, + examples: array645, + deprecated: lifted648, + role: lifted651, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array650, + branches: array652, }) } 32 => { - let lifted653 : String? = match + let lifted655 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result652 = mbt_ffi_ptr2str( + let result654 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result652) + Option::Some(result654) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted653, + category: lifted655, }) } 33 => { - let lifted655 : String? = match + let lifted657 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result654 = mbt_ffi_ptr2str( + let result656 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result654) + Option::Some(result656) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted655, + resource_name: lifted657, }) } 34 => { - let lifted656 : Int? = match + let lifted658 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted656) + @types.SchemaTypeBody::FutureType(lifted658) } 35 => { - let lifted657 : Int? = match + let lifted659 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted657) + @types.SchemaTypeBody::StreamType(lifted659) } _ => panic() } - let lifted660 : String? = match + let lifted662 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result659 = mbt_ffi_ptr2str( + let result661 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result659) + Option::Some(result661) } _ => panic() } - let array662 : Array[String] = [] - for index663 = 0 - index663 < mbt_ffi_load32(iter_base + 104) - index663 = index663 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index663 * 8 + let array664 : Array[String] = [] + for index665 = 0 + index665 < mbt_ffi_load32(iter_base + 104) + index665 = index665 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index665 * 8 - let result661 = mbt_ffi_ptr2str( + let result663 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array662.push(result661) + array664.push(result663) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array665 : Array[String] = [] - for index666 = 0 - index666 < mbt_ffi_load32(iter_base + 112) - index666 = index666 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index666 * 8 + let array667 : Array[String] = [] + for index668 = 0 + index668 < mbt_ffi_load32(iter_base + 112) + index668 = index668 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index668 * 8 - let result664 = mbt_ffi_ptr2str( + let result666 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array665.push(result664) + array667.push(result666) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted668 : String? = match + let lifted670 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result667 = mbt_ffi_ptr2str( + let result669 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result667) + Option::Some(result669) } _ => panic() } - let lifted671 : @types.Role? = match + let lifted673 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted670 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted672 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result669 = mbt_ffi_ptr2str( + let result671 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result669) + @types.Role::Other(result671) } _ => panic() } - Option::Some(lifted670) + Option::Some(lifted672) } _ => panic() } - array672.push(@types.SchemaTypeNode::{ - body: lifted658, + array674.push(@types.SchemaTypeNode::{ + body: lifted660, metadata: @types.MetadataEnvelope::{ - doc: lifted660, - aliases: array662, - examples: array665, - deprecated: lifted668, - role: lifted671, + doc: lifted662, + aliases: array664, + examples: array667, + deprecated: lifted670, + role: lifted673, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - let array677 : Array[@types.SchemaTypeDef] = [] - for index678 = 0 - index678 < mbt_ffi_load32(iter_base + 20) - index678 = index678 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 16) + index678 * 24 + let array679 : Array[@types.SchemaTypeDef] = [] + for index680 = 0 + index680 < mbt_ffi_load32(iter_base + 20) + index680 = index680 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 16) + index680 * 24 - let result674 = mbt_ffi_ptr2str( + let result676 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted676 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted678 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result675 = mbt_ffi_ptr2str( + let result677 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result675) + Option::Some(result677) } _ => panic() } - array677.push(@types.SchemaTypeDef::{ - id: result674, - name: lifted676, + array679.push(@types.SchemaTypeDef::{ + id: result676, + name: lifted678, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let array708 : Array[@types.SchemaValueNode] = [] - for index709 = 0 - index709 < mbt_ffi_load32(iter_base + 32) - index709 = index709 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 28) + index709 * 32 + let array710 : Array[@types.SchemaValueNode] = [] + for index711 = 0 + index711 < mbt_ffi_load32(iter_base + 32) + index711 = index711 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 28) + index711 * 32 - let lifted707 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted709 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -6544,29 +6552,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result679 = mbt_ffi_ptr2str( + let result681 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result679) + @types.SchemaValueNode::StringValue(result681) } 13 => { - let array680 : Array[Int] = [] - for index681 = 0 - index681 < mbt_ffi_load32(iter_base + 12) - index681 = index681 + 1 { + let array682 : Array[Int] = [] + for index683 = 0 + index683 < mbt_ffi_load32(iter_base + 12) + index683 = index683 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index681 * 4 + index683 * 4 - array680.push(mbt_ffi_load32(iter_base + 0)) + array682.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array680) + @types.SchemaValueNode::RecordValue(array682) } 14 => { - let lifted682 : Int? = match + let lifted684 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -6575,7 +6583,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted682, + payload: lifted684, }) } 15 => @@ -6583,34 +6591,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array683 : Array[Bool] = [] - for index684 = 0 - index684 < mbt_ffi_load32(iter_base + 12) - index684 = index684 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index684 * 1 - - array683.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array683) - } - 17 => { - let array685 : Array[Int] = [] + let array685 : Array[Bool] = [] for index686 = 0 index686 < mbt_ffi_load32(iter_base + 12) index686 = index686 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index686 * 4 + index686 * 1 - array685.push(mbt_ffi_load32(iter_base + 0)) + array685.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array685) + @types.SchemaValueNode::FlagsValue(array685) } - 18 => { + 17 => { let array687 : Array[Int] = [] for index688 = 0 index688 < mbt_ffi_load32(iter_base + 12) @@ -6622,9 +6616,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array687) + @types.SchemaValueNode::TupleValue(array687) } - 19 => { + 18 => { let array689 : Array[Int] = [] for index690 = 0 index690 < mbt_ffi_load32(iter_base + 12) @@ -6636,127 +6630,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array689) + @types.SchemaValueNode::ListValue(array689) } - 20 => { - let array691 : Array[@types.MapEntry] = [] + 19 => { + let array691 : Array[Int] = [] for index692 = 0 index692 < mbt_ffi_load32(iter_base + 12) index692 = index692 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index692 * 8 + index692 * 4 + + array691.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array691) + } + 20 => { + let array693 : Array[@types.MapEntry] = [] + for index694 = 0 + index694 < mbt_ffi_load32(iter_base + 12) + index694 = index694 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index694 * 8 - array691.push(@types.MapEntry::{ + array693.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array691) + @types.SchemaValueNode::MapValue(array693) } 21 => { - let lifted693 : Int? = match + let lifted695 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted693) + @types.SchemaValueNode::OptionValue(lifted695) } 22 => { - let lifted696 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted698 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted694 : Int? = match + let lifted696 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted694) + @types.ResultValuePayload::OkValue(lifted696) } 1 => { - let lifted695 : Int? = match + let lifted697 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted695) + @types.ResultValuePayload::ErrValue(lifted697) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted696) + @types.SchemaValueNode::ResultValue(lifted698) } 23 => { - let result697 = mbt_ffi_ptr2str( + let result699 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted699 : String? = match + let lifted701 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result698 = mbt_ffi_ptr2str( + let result700 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result698) + Option::Some(result700) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result697, - language: lifted699, + text: result699, + language: lifted701, }) } 24 => { - let result700 = mbt_ffi_ptr2bytes( + let result702 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted702 : String? = match + let lifted704 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result701 = mbt_ffi_ptr2str( + let result703 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result701) + Option::Some(result703) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result700, - mime_type: lifted702, + bytes: result702, + mime_type: lifted704, }) } 25 => { - let result703 = mbt_ffi_ptr2str( + let result705 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result703) + @types.SchemaValueNode::PathValue(result705) } 26 => { - let result704 = mbt_ffi_ptr2str( + let result706 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result704) + @types.SchemaValueNode::UrlValue(result706) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -6768,7 +6776,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result705 = mbt_ffi_ptr2str( + let result707 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -6776,17 +6784,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result705, + unit: result707, }) } 30 => { - let result706 = mbt_ffi_ptr2str( + let result708 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result706, + tag: result708, body: mbt_ffi_load32(iter_base + 16), }) } @@ -6800,23 +6808,29 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array708.push(lifted707) + array710.push(lifted709) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - array710.push(LocalAgentConfigEntry::{ - path: array474, + array712.push(LocalAgentConfigEntry::{ + path: array476, value: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array672, - defs: array677, + type_nodes: array674, + defs: array679, root: mbt_ffi_load32(iter_base + 24), }, value: @types.SchemaValueTree::{ - value_nodes: array708, + value_nodes: array710, root: mbt_ffi_load32(iter_base + 36), }, }, @@ -6824,7 +6838,7 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 160)) - let lifted712 : @types.Uuid? = match + let lifted714 : @types.Uuid? = match mbt_ffi_load8_u(iter_base + 168) { 0 => Option::None 1 => @@ -6867,9 +6881,9 @@ pub fn enrich_oplog_entries( parent: lifted, component_size: mbt_ffi_load64(iter_base + 136).reinterpret_as_uint64(), initial_total_linear_memory_size: mbt_ffi_load64(iter_base + 144).reinterpret_as_uint64(), - initial_active_plugins: array471, - local_agent_config: array710, - original_phantom_id: lifted712, + initial_active_plugins: array473, + local_agent_config: array712, + original_phantom_id: lifted714, instance_id: @types.Uuid::{ high_bits: mbt_ffi_load64(iter_base + 192).reinterpret_as_uint64(), low_bits: mbt_ffi_load64(iter_base + 200).reinterpret_as_uint64(), @@ -6877,7 +6891,7 @@ pub fn enrich_oplog_entries( }) } 1 => { - let lifted713 : UInt64? = match mbt_ffi_load8_u(iter_base + 24) { + let lifted715 : UInt64? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => Option::Some( @@ -6886,38 +6900,38 @@ pub fn enrich_oplog_entries( _ => panic() } - let result714 = mbt_ffi_ptr2str( + let result716 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - let lifted949 : @types.TypedSchemaValue? = match + let lifted951 : @types.TypedSchemaValue? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => { - let array911 : Array[@types.SchemaTypeNode] = [] - for index912 = 0 - index912 < mbt_ffi_load32(iter_base + 56) - index912 = index912 + 1 { + let array913 : Array[@types.SchemaTypeNode] = [] + for index914 = 0 + index914 < mbt_ffi_load32(iter_base + 56) + index914 = index914 + 1 { let iter_base = mbt_ffi_load32(iter_base + 52) + - index912 * 144 + index914 * 144 - let lifted897 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted899 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted721 : @types.NumericRestrictions? = match + let lifted723 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted716 : @types.NumericBound? = match + let lifted718 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted715 = match + let lifted717 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -6934,16 +6948,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted715) + Option::Some(lifted717) } _ => panic() } - let lifted718 : @types.NumericBound? = match + let lifted720 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted717 = match + let lifted719 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -6960,46 +6974,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted717) + Option::Some(lifted719) } _ => panic() } - let lifted720 : String? = match + let lifted722 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result719 = mbt_ffi_ptr2str( + let result721 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result719) + Option::Some(result721) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted716, - max: lifted718, - unit: lifted720, + min: lifted718, + max: lifted720, + unit: lifted722, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted721) + @types.SchemaTypeBody::S8Type(lifted723) } 3 => { - let lifted728 : @types.NumericRestrictions? = match + let lifted730 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted723 : @types.NumericBound? = match + let lifted725 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted722 = match + let lifted724 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7016,16 +7030,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted722) + Option::Some(lifted724) } _ => panic() } - let lifted725 : @types.NumericBound? = match + let lifted727 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted724 = match + let lifted726 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7042,46 +7056,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted724) + Option::Some(lifted726) } _ => panic() } - let lifted727 : String? = match + let lifted729 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result726 = mbt_ffi_ptr2str( + let result728 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result726) + Option::Some(result728) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted723, - max: lifted725, - unit: lifted727, + min: lifted725, + max: lifted727, + unit: lifted729, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted728) + @types.SchemaTypeBody::S16Type(lifted730) } 4 => { - let lifted735 : @types.NumericRestrictions? = match + let lifted737 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted730 : @types.NumericBound? = match + let lifted732 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted729 = match + let lifted731 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7098,16 +7112,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted729) + Option::Some(lifted731) } _ => panic() } - let lifted732 : @types.NumericBound? = match + let lifted734 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted731 = match + let lifted733 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7124,46 +7138,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted731) + Option::Some(lifted733) } _ => panic() } - let lifted734 : String? = match + let lifted736 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result733 = mbt_ffi_ptr2str( + let result735 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result733) + Option::Some(result735) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted730, - max: lifted732, - unit: lifted734, + min: lifted732, + max: lifted734, + unit: lifted736, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted735) + @types.SchemaTypeBody::S32Type(lifted737) } 5 => { - let lifted742 : @types.NumericRestrictions? = match + let lifted744 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted737 : @types.NumericBound? = match + let lifted739 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted736 = match + let lifted738 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7180,16 +7194,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted736) + Option::Some(lifted738) } _ => panic() } - let lifted739 : @types.NumericBound? = match + let lifted741 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted738 = match + let lifted740 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7206,46 +7220,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted738) + Option::Some(lifted740) } _ => panic() } - let lifted741 : String? = match + let lifted743 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result740 = mbt_ffi_ptr2str( + let result742 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result740) + Option::Some(result742) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted737, - max: lifted739, - unit: lifted741, + min: lifted739, + max: lifted741, + unit: lifted743, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted742) + @types.SchemaTypeBody::S64Type(lifted744) } 6 => { - let lifted749 : @types.NumericRestrictions? = match + let lifted751 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted744 : @types.NumericBound? = match + let lifted746 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted743 = match + let lifted745 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7262,16 +7276,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted743) + Option::Some(lifted745) } _ => panic() } - let lifted746 : @types.NumericBound? = match + let lifted748 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted745 = match + let lifted747 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7288,46 +7302,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted745) + Option::Some(lifted747) } _ => panic() } - let lifted748 : String? = match + let lifted750 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result747 = mbt_ffi_ptr2str( + let result749 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result747) + Option::Some(result749) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted744, - max: lifted746, - unit: lifted748, + min: lifted746, + max: lifted748, + unit: lifted750, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted749) + @types.SchemaTypeBody::U8Type(lifted751) } 7 => { - let lifted756 : @types.NumericRestrictions? = match + let lifted758 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted751 : @types.NumericBound? = match + let lifted753 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted750 = match + let lifted752 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7344,16 +7358,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted750) + Option::Some(lifted752) } _ => panic() } - let lifted753 : @types.NumericBound? = match + let lifted755 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted752 = match + let lifted754 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7370,46 +7384,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted752) + Option::Some(lifted754) } _ => panic() } - let lifted755 : String? = match + let lifted757 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result754 = mbt_ffi_ptr2str( + let result756 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result754) + Option::Some(result756) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted751, - max: lifted753, - unit: lifted755, + min: lifted753, + max: lifted755, + unit: lifted757, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted756) + @types.SchemaTypeBody::U16Type(lifted758) } 8 => { - let lifted763 : @types.NumericRestrictions? = match + let lifted765 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted758 : @types.NumericBound? = match + let lifted760 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted757 = match + let lifted759 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7426,16 +7440,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted757) + Option::Some(lifted759) } _ => panic() } - let lifted760 : @types.NumericBound? = match + let lifted762 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted759 = match + let lifted761 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7452,46 +7466,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted759) + Option::Some(lifted761) } _ => panic() } - let lifted762 : String? = match + let lifted764 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result761 = mbt_ffi_ptr2str( + let result763 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result761) + Option::Some(result763) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted758, - max: lifted760, - unit: lifted762, + min: lifted760, + max: lifted762, + unit: lifted764, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted763) + @types.SchemaTypeBody::U32Type(lifted765) } 9 => { - let lifted770 : @types.NumericRestrictions? = match + let lifted772 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted765 : @types.NumericBound? = match + let lifted767 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted764 = match + let lifted766 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7508,16 +7522,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted764) + Option::Some(lifted766) } _ => panic() } - let lifted767 : @types.NumericBound? = match + let lifted769 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted766 = match + let lifted768 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7534,46 +7548,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted766) + Option::Some(lifted768) } _ => panic() } - let lifted769 : String? = match + let lifted771 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result768 = mbt_ffi_ptr2str( + let result770 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result768) + Option::Some(result770) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted765, - max: lifted767, - unit: lifted769, + min: lifted767, + max: lifted769, + unit: lifted771, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted770) + @types.SchemaTypeBody::U64Type(lifted772) } 10 => { - let lifted777 : @types.NumericRestrictions? = match + let lifted779 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted772 : @types.NumericBound? = match + let lifted774 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted771 = match + let lifted773 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7590,16 +7604,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted771) + Option::Some(lifted773) } _ => panic() } - let lifted774 : @types.NumericBound? = match + let lifted776 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted773 = match + let lifted775 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7616,46 +7630,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted773) + Option::Some(lifted775) } _ => panic() } - let lifted776 : String? = match + let lifted778 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result775 = mbt_ffi_ptr2str( + let result777 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result775) + Option::Some(result777) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted772, - max: lifted774, - unit: lifted776, + min: lifted774, + max: lifted776, + unit: lifted778, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted777) + @types.SchemaTypeBody::F32Type(lifted779) } 11 => { - let lifted784 : @types.NumericRestrictions? = match + let lifted786 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted779 : @types.NumericBound? = match + let lifted781 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted778 = match + let lifted780 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7672,16 +7686,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted778) + Option::Some(lifted780) } _ => panic() } - let lifted781 : @types.NumericBound? = match + let lifted783 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted780 = match + let lifted782 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7698,324 +7712,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted780) + Option::Some(lifted782) } _ => panic() } - let lifted783 : String? = match + let lifted785 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result782 = mbt_ffi_ptr2str( + let result784 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result782) + Option::Some(result784) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted779, - max: lifted781, - unit: lifted783, + min: lifted781, + max: lifted783, + unit: lifted785, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted784) + @types.SchemaTypeBody::F64Type(lifted786) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array799 : Array[@types.NamedFieldType] = [] - for index800 = 0 - index800 < mbt_ffi_load32(iter_base + 12) - index800 = index800 + 1 { + let array801 : Array[@types.NamedFieldType] = [] + for index802 = 0 + index802 < mbt_ffi_load32(iter_base + 12) + index802 = index802 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index800 * 68 + index802 * 68 - let result785 = mbt_ffi_ptr2str( + let result787 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted787 : String? = match + let lifted789 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result786 = mbt_ffi_ptr2str( + let result788 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result786) + Option::Some(result788) } _ => panic() } - let array789 : Array[String] = [] - for index790 = 0 - index790 < mbt_ffi_load32(iter_base + 28) - index790 = index790 + 1 { + let array791 : Array[String] = [] + for index792 = 0 + index792 < mbt_ffi_load32(iter_base + 28) + index792 = index792 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index790 * 8 + index792 * 8 - let result788 = mbt_ffi_ptr2str( + let result790 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array789.push(result788) + array791.push(result790) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array792 : Array[String] = [] - for index793 = 0 - index793 < mbt_ffi_load32(iter_base + 36) - index793 = index793 + 1 { + let array794 : Array[String] = [] + for index795 = 0 + index795 < mbt_ffi_load32(iter_base + 36) + index795 = index795 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index793 * 8 + index795 * 8 - let result791 = mbt_ffi_ptr2str( + let result793 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array792.push(result791) + array794.push(result793) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted795 : String? = match + let lifted797 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result794 = mbt_ffi_ptr2str( + let result796 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result794) + Option::Some(result796) } _ => panic() } - let lifted798 : @types.Role? = match + let lifted800 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted797 = match + let lifted799 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result796 = mbt_ffi_ptr2str( + let result798 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result796) + @types.Role::Other(result798) } _ => panic() } - Option::Some(lifted797) + Option::Some(lifted799) } _ => panic() } - array799.push(@types.NamedFieldType::{ - name: result785, + array801.push(@types.NamedFieldType::{ + name: result787, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted787, - aliases: array789, - examples: array792, - deprecated: lifted795, - role: lifted798, + doc: lifted789, + aliases: array791, + examples: array794, + deprecated: lifted797, + role: lifted800, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array799) + @types.SchemaTypeBody::RecordType(array801) } 15 => { - let array816 : Array[@types.VariantCaseType] = [] - for index817 = 0 - index817 < mbt_ffi_load32(iter_base + 12) - index817 = index817 + 1 { + let array818 : Array[@types.VariantCaseType] = [] + for index819 = 0 + index819 < mbt_ffi_load32(iter_base + 12) + index819 = index819 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index817 * 72 + index819 * 72 - let result801 = mbt_ffi_ptr2str( + let result803 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted802 : Int? = match + let lifted804 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted804 : String? = match + let lifted806 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result803 = mbt_ffi_ptr2str( + let result805 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result803) + Option::Some(result805) } _ => panic() } - let array806 : Array[String] = [] - for index807 = 0 - index807 < mbt_ffi_load32(iter_base + 32) - index807 = index807 + 1 { + let array808 : Array[String] = [] + for index809 = 0 + index809 < mbt_ffi_load32(iter_base + 32) + index809 = index809 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index807 * 8 + index809 * 8 - let result805 = mbt_ffi_ptr2str( + let result807 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array806.push(result805) + array808.push(result807) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array809 : Array[String] = [] - for index810 = 0 - index810 < mbt_ffi_load32(iter_base + 40) - index810 = index810 + 1 { + let array811 : Array[String] = [] + for index812 = 0 + index812 < mbt_ffi_load32(iter_base + 40) + index812 = index812 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index810 * 8 + index812 * 8 - let result808 = mbt_ffi_ptr2str( + let result810 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array809.push(result808) + array811.push(result810) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted812 : String? = match + let lifted814 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result811 = mbt_ffi_ptr2str( + let result813 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result811) + Option::Some(result813) } _ => panic() } - let lifted815 : @types.Role? = match + let lifted817 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted814 = match + let lifted816 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result813 = mbt_ffi_ptr2str( + let result815 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result813) + @types.Role::Other(result815) } _ => panic() } - Option::Some(lifted814) + Option::Some(lifted816) } _ => panic() } - array816.push(@types.VariantCaseType::{ - name: result801, - payload: lifted802, + array818.push(@types.VariantCaseType::{ + name: result803, + payload: lifted804, metadata: @types.MetadataEnvelope::{ - doc: lifted804, - aliases: array806, - examples: array809, - deprecated: lifted812, - role: lifted815, + doc: lifted806, + aliases: array808, + examples: array811, + deprecated: lifted814, + role: lifted817, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array816) + @types.SchemaTypeBody::VariantType(array818) } 16 => { - let array819 : Array[String] = [] - for index820 = 0 - index820 < mbt_ffi_load32(iter_base + 12) - index820 = index820 + 1 { + let array821 : Array[String] = [] + for index822 = 0 + index822 < mbt_ffi_load32(iter_base + 12) + index822 = index822 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index820 * 8 + index822 * 8 - let result818 = mbt_ffi_ptr2str( + let result820 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array819.push(result818) + array821.push(result820) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array819) + @types.SchemaTypeBody::EnumType(array821) } 17 => { - let array822 : Array[String] = [] - for index823 = 0 - index823 < mbt_ffi_load32(iter_base + 12) - index823 = index823 + 1 { + let array824 : Array[String] = [] + for index825 = 0 + index825 < mbt_ffi_load32(iter_base + 12) + index825 = index825 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index823 * 8 + index825 * 8 - let result821 = mbt_ffi_ptr2str( + let result823 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array822.push(result821) + array824.push(result823) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array822) + @types.SchemaTypeBody::FlagsType(array824) } 18 => { - let array824 : Array[Int] = [] - for index825 = 0 - index825 < mbt_ffi_load32(iter_base + 12) - index825 = index825 + 1 { + let array826 : Array[Int] = [] + for index827 = 0 + index827 < mbt_ffi_load32(iter_base + 12) + index827 = index827 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index825 * 4 + index827 * 4 - array824.push(mbt_ffi_load32(iter_base + 0)) + array826.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array824) + @types.SchemaTypeBody::TupleType(array826) } 19 => @types.SchemaTypeBody::ListType( @@ -8036,14 +8050,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted826 : Int? = match + let lifted828 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted827 : Int? = match + let lifted829 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -8051,37 +8065,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted826, - err: lifted827, + ok: lifted828, + err: lifted829, }) } 24 => { - let lifted831 : Array[String]? = match + let lifted833 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array829 : Array[String] = [] - for index830 = 0 - index830 < mbt_ffi_load32(iter_base + 16) - index830 = index830 + 1 { + let array831 : Array[String] = [] + for index832 = 0 + index832 < mbt_ffi_load32(iter_base + 16) + index832 = index832 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index830 * 8 + index832 * 8 - let result828 = mbt_ffi_ptr2str( + let result830 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array829.push(result828) + array831.push(result830) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array829) + Option::Some(array831) } _ => panic() } - let lifted832 : UInt? = match + let lifted834 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -8091,7 +8105,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted833 : UInt? = match + let lifted835 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -8101,54 +8115,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted835 : String? = match + let lifted837 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result834 = mbt_ffi_ptr2str( + let result836 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result834) + Option::Some(result836) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted831, - min_length: lifted832, - max_length: lifted833, - regex: lifted835, + languages: lifted833, + min_length: lifted834, + max_length: lifted835, + regex: lifted837, }) } 25 => { - let lifted839 : Array[String]? = match + let lifted841 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array837 : Array[String] = [] - for index838 = 0 - index838 < mbt_ffi_load32(iter_base + 16) - index838 = index838 + 1 { + let array839 : Array[String] = [] + for index840 = 0 + index840 < mbt_ffi_load32(iter_base + 16) + index840 = index840 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index838 * 8 + index840 * 8 - let result836 = mbt_ffi_ptr2str( + let result838 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array837.push(result836) + array839.push(result838) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array837) + Option::Some(array839) } _ => panic() } - let lifted840 : UInt? = match + let lifted842 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -8158,7 +8172,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted841 : UInt? = match + let lifted843 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -8169,58 +8183,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted839, - min_bytes: lifted840, - max_bytes: lifted841, + mime_types: lifted841, + min_bytes: lifted842, + max_bytes: lifted843, }) } 26 => { - let lifted845 : Array[String]? = match + let lifted847 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array843 : Array[String] = [] - for index844 = 0 - index844 < mbt_ffi_load32(iter_base + 20) - index844 = index844 + 1 { + let array845 : Array[String] = [] + for index846 = 0 + index846 < mbt_ffi_load32(iter_base + 20) + index846 = index846 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index844 * 8 + index846 * 8 - let result842 = mbt_ffi_ptr2str( + let result844 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array843.push(result842) + array845.push(result844) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array843) + Option::Some(array845) } _ => panic() } - let lifted849 : Array[String]? = match + let lifted851 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array847 : Array[String] = [] - for index848 = 0 - index848 < mbt_ffi_load32(iter_base + 32) - index848 = index848 + 1 { + let array849 : Array[String] = [] + for index850 = 0 + index850 < mbt_ffi_load32(iter_base + 32) + index850 = index850 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index848 * 8 + index850 * 8 - let result846 = mbt_ffi_ptr2str( + let result848 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array847.push(result846) + array849.push(result848) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array847) + Option::Some(array849) } _ => panic() } @@ -8232,95 +8246,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted845, - allowed_extensions: lifted849, + allowed_mime_types: lifted847, + allowed_extensions: lifted851, }) } 27 => { - let lifted853 : Array[String]? = match + let lifted855 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array851 : Array[String] = [] - for index852 = 0 - index852 < mbt_ffi_load32(iter_base + 16) - index852 = index852 + 1 { + let array853 : Array[String] = [] + for index854 = 0 + index854 < mbt_ffi_load32(iter_base + 16) + index854 = index854 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index852 * 8 + index854 * 8 - let result850 = mbt_ffi_ptr2str( + let result852 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array851.push(result850) + array853.push(result852) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array851) + Option::Some(array853) } _ => panic() } - let lifted857 : Array[String]? = match + let lifted859 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array855 : Array[String] = [] - for index856 = 0 - index856 < mbt_ffi_load32(iter_base + 28) - index856 = index856 + 1 { + let array857 : Array[String] = [] + for index858 = 0 + index858 < mbt_ffi_load32(iter_base + 28) + index858 = index858 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index856 * 8 + index858 * 8 - let result854 = mbt_ffi_ptr2str( + let result856 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array855.push(result854) + array857.push(result856) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array855) + Option::Some(array857) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted853, - allowed_hosts: lifted857, + allowed_schemes: lifted855, + allowed_hosts: lifted859, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result858 = mbt_ffi_ptr2str( + let result860 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array860 : Array[String] = [] - for index861 = 0 - index861 < mbt_ffi_load32(iter_base + 20) - index861 = index861 + 1 { + let array862 : Array[String] = [] + for index863 = 0 + index863 < mbt_ffi_load32(iter_base + 20) + index863 = index863 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index861 * 8 + index863 * 8 - let result859 = mbt_ffi_ptr2str( + let result861 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array860.push(result859) + array862.push(result861) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted863 : @types.QuantityValue? = match + let lifted865 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result862 = mbt_ffi_ptr2str( + let result864 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -8328,17 +8342,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result862, + unit: result864, }) } _ => panic() } - let lifted865 : @types.QuantityValue? = match + let lifted867 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result864 = mbt_ffi_ptr2str( + let result866 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -8346,404 +8360,404 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result864, + unit: result866, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result858, - allowed_suffixes: array860, - min: lifted863, - max: lifted865, + base_unit: result860, + allowed_suffixes: array862, + min: lifted865, + max: lifted867, }) } 31 => { - let array889 : Array[@types.UnionBranch] = [] - for index890 = 0 - index890 < mbt_ffi_load32(iter_base + 12) - index890 = index890 + 1 { + let array891 : Array[@types.UnionBranch] = [] + for index892 = 0 + index892 < mbt_ffi_load32(iter_base + 12) + index892 = index892 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index890 * 92 + index892 * 92 - let result866 = mbt_ffi_ptr2str( + let result868 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted875 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted877 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result867 = mbt_ffi_ptr2str( + let result869 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result867) + @types.DiscriminatorRule::Prefix(result869) } 1 => { - let result868 = mbt_ffi_ptr2str( + let result870 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result868) + @types.DiscriminatorRule::Suffix(result870) } 2 => { - let result869 = mbt_ffi_ptr2str( + let result871 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result869) + @types.DiscriminatorRule::Contains(result871) } 3 => { - let result870 = mbt_ffi_ptr2str( + let result872 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result870) + @types.DiscriminatorRule::Regex(result872) } 4 => { - let result871 = mbt_ffi_ptr2str( + let result873 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted873 : String? = match + let lifted875 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result872 = mbt_ffi_ptr2str( + let result874 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result872) + Option::Some(result874) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result871, - literal: lifted873, + field_name: result873, + literal: lifted875, }) } 5 => { - let result874 = mbt_ffi_ptr2str( + let result876 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result874) + @types.DiscriminatorRule::FieldAbsent(result876) } _ => panic() } - let lifted877 : String? = match + let lifted879 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result876 = mbt_ffi_ptr2str( + let result878 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result876) + Option::Some(result878) } _ => panic() } - let array879 : Array[String] = [] - for index880 = 0 - index880 < mbt_ffi_load32(iter_base + 52) - index880 = index880 + 1 { + let array881 : Array[String] = [] + for index882 = 0 + index882 < mbt_ffi_load32(iter_base + 52) + index882 = index882 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index880 * 8 + index882 * 8 - let result878 = mbt_ffi_ptr2str( + let result880 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array879.push(result878) + array881.push(result880) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array882 : Array[String] = [] - for index883 = 0 - index883 < mbt_ffi_load32(iter_base + 60) - index883 = index883 + 1 { + let array884 : Array[String] = [] + for index885 = 0 + index885 < mbt_ffi_load32(iter_base + 60) + index885 = index885 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index883 * 8 + index885 * 8 - let result881 = mbt_ffi_ptr2str( + let result883 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array882.push(result881) + array884.push(result883) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted885 : String? = match + let lifted887 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result884 = mbt_ffi_ptr2str( + let result886 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result884) + Option::Some(result886) } _ => panic() } - let lifted888 : @types.Role? = match + let lifted890 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted887 = match + let lifted889 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result886 = mbt_ffi_ptr2str( + let result888 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result886) + @types.Role::Other(result888) } _ => panic() } - Option::Some(lifted887) + Option::Some(lifted889) } _ => panic() } - array889.push(@types.UnionBranch::{ - tag: result866, + array891.push(@types.UnionBranch::{ + tag: result868, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted875, + discriminator: lifted877, metadata: @types.MetadataEnvelope::{ - doc: lifted877, - aliases: array879, - examples: array882, - deprecated: lifted885, - role: lifted888, + doc: lifted879, + aliases: array881, + examples: array884, + deprecated: lifted887, + role: lifted890, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array889, + branches: array891, }) } 32 => { - let lifted892 : String? = match + let lifted894 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result891 = mbt_ffi_ptr2str( + let result893 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result891) + Option::Some(result893) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted892, + category: lifted894, }) } 33 => { - let lifted894 : String? = match + let lifted896 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result893 = mbt_ffi_ptr2str( + let result895 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result893) + Option::Some(result895) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted894, + resource_name: lifted896, }) } 34 => { - let lifted895 : Int? = match + let lifted897 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted895) + @types.SchemaTypeBody::FutureType(lifted897) } 35 => { - let lifted896 : Int? = match + let lifted898 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted896) + @types.SchemaTypeBody::StreamType(lifted898) } _ => panic() } - let lifted899 : String? = match + let lifted901 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result898 = mbt_ffi_ptr2str( + let result900 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result898) + Option::Some(result900) } _ => panic() } - let array901 : Array[String] = [] - for index902 = 0 - index902 < mbt_ffi_load32(iter_base + 104) - index902 = index902 + 1 { + let array903 : Array[String] = [] + for index904 = 0 + index904 < mbt_ffi_load32(iter_base + 104) + index904 = index904 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index902 * 8 + index904 * 8 - let result900 = mbt_ffi_ptr2str( + let result902 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array901.push(result900) + array903.push(result902) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array904 : Array[String] = [] - for index905 = 0 - index905 < mbt_ffi_load32(iter_base + 112) - index905 = index905 + 1 { + let array906 : Array[String] = [] + for index907 = 0 + index907 < mbt_ffi_load32(iter_base + 112) + index907 = index907 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index905 * 8 + index907 * 8 - let result903 = mbt_ffi_ptr2str( + let result905 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array904.push(result903) + array906.push(result905) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted907 : String? = match + let lifted909 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result906 = mbt_ffi_ptr2str( + let result908 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result906) + Option::Some(result908) } _ => panic() } - let lifted910 : @types.Role? = match + let lifted912 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted909 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted911 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result908 = mbt_ffi_ptr2str( + let result910 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result908) + @types.Role::Other(result910) } _ => panic() } - Option::Some(lifted909) + Option::Some(lifted911) } _ => panic() } - array911.push(@types.SchemaTypeNode::{ - body: lifted897, + array913.push(@types.SchemaTypeNode::{ + body: lifted899, metadata: @types.MetadataEnvelope::{ - doc: lifted899, - aliases: array901, - examples: array904, - deprecated: lifted907, - role: lifted910, + doc: lifted901, + aliases: array903, + examples: array906, + deprecated: lifted909, + role: lifted912, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 52)) - let array916 : Array[@types.SchemaTypeDef] = [] - for index917 = 0 - index917 < mbt_ffi_load32(iter_base + 64) - index917 = index917 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 60) + index917 * 24 + let array918 : Array[@types.SchemaTypeDef] = [] + for index919 = 0 + index919 < mbt_ffi_load32(iter_base + 64) + index919 = index919 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 60) + index919 * 24 - let result913 = mbt_ffi_ptr2str( + let result915 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted915 : String? = match + let lifted917 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result914 = mbt_ffi_ptr2str( + let result916 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result914) + Option::Some(result916) } _ => panic() } - array916.push(@types.SchemaTypeDef::{ - id: result913, - name: lifted915, + array918.push(@types.SchemaTypeDef::{ + id: result915, + name: lifted917, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) - let array947 : Array[@types.SchemaValueNode] = [] - for index948 = 0 - index948 < mbt_ffi_load32(iter_base + 76) - index948 = index948 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 72) + index948 * 32 + let array949 : Array[@types.SchemaValueNode] = [] + for index950 = 0 + index950 < mbt_ffi_load32(iter_base + 76) + index950 = index950 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 72) + index950 * 32 - let lifted946 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted948 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -8795,29 +8809,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result918 = mbt_ffi_ptr2str( + let result920 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result918) + @types.SchemaValueNode::StringValue(result920) } 13 => { - let array919 : Array[Int] = [] - for index920 = 0 - index920 < mbt_ffi_load32(iter_base + 12) - index920 = index920 + 1 { + let array921 : Array[Int] = [] + for index922 = 0 + index922 < mbt_ffi_load32(iter_base + 12) + index922 = index922 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index920 * 4 + index922 * 4 - array919.push(mbt_ffi_load32(iter_base + 0)) + array921.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array919) + @types.SchemaValueNode::RecordValue(array921) } 14 => { - let lifted921 : Int? = match + let lifted923 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -8826,7 +8840,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted921, + payload: lifted923, }) } 15 => @@ -8834,34 +8848,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array922 : Array[Bool] = [] - for index923 = 0 - index923 < mbt_ffi_load32(iter_base + 12) - index923 = index923 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index923 * 1 - - array922.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array922) - } - 17 => { - let array924 : Array[Int] = [] + let array924 : Array[Bool] = [] for index925 = 0 index925 < mbt_ffi_load32(iter_base + 12) index925 = index925 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index925 * 4 + index925 * 1 - array924.push(mbt_ffi_load32(iter_base + 0)) + array924.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array924) + @types.SchemaValueNode::FlagsValue(array924) } - 18 => { + 17 => { let array926 : Array[Int] = [] for index927 = 0 index927 < mbt_ffi_load32(iter_base + 12) @@ -8873,9 +8873,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array926) + @types.SchemaValueNode::TupleValue(array926) } - 19 => { + 18 => { let array928 : Array[Int] = [] for index929 = 0 index929 < mbt_ffi_load32(iter_base + 12) @@ -8887,127 +8887,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array928) + @types.SchemaValueNode::ListValue(array928) } - 20 => { - let array930 : Array[@types.MapEntry] = [] + 19 => { + let array930 : Array[Int] = [] for index931 = 0 index931 < mbt_ffi_load32(iter_base + 12) index931 = index931 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index931 * 8 + index931 * 4 + + array930.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array930) + } + 20 => { + let array932 : Array[@types.MapEntry] = [] + for index933 = 0 + index933 < mbt_ffi_load32(iter_base + 12) + index933 = index933 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index933 * 8 - array930.push(@types.MapEntry::{ + array932.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array930) + @types.SchemaValueNode::MapValue(array932) } 21 => { - let lifted932 : Int? = match + let lifted934 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted932) + @types.SchemaValueNode::OptionValue(lifted934) } 22 => { - let lifted935 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted937 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted933 : Int? = match + let lifted935 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted933) + @types.ResultValuePayload::OkValue(lifted935) } 1 => { - let lifted934 : Int? = match + let lifted936 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted934) + @types.ResultValuePayload::ErrValue(lifted936) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted935) + @types.SchemaValueNode::ResultValue(lifted937) } 23 => { - let result936 = mbt_ffi_ptr2str( + let result938 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted938 : String? = match + let lifted940 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result937 = mbt_ffi_ptr2str( + let result939 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result937) + Option::Some(result939) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result936, - language: lifted938, + text: result938, + language: lifted940, }) } 24 => { - let result939 = mbt_ffi_ptr2bytes( + let result941 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted941 : String? = match + let lifted943 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result940 = mbt_ffi_ptr2str( + let result942 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result940) + Option::Some(result942) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result939, - mime_type: lifted941, + bytes: result941, + mime_type: lifted943, }) } 25 => { - let result942 = mbt_ffi_ptr2str( + let result944 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result942) + @types.SchemaValueNode::PathValue(result944) } 26 => { - let result943 = mbt_ffi_ptr2str( + let result945 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result943) + @types.SchemaValueNode::UrlValue(result945) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -9019,7 +9033,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result944 = mbt_ffi_ptr2str( + let result946 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -9027,17 +9041,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result944, + unit: result946, }) } 30 => { - let result945 = mbt_ffi_ptr2str( + let result947 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result945, + tag: result947, body: mbt_ffi_load32(iter_base + 16), }) } @@ -9051,21 +9065,27 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array947.push(lifted946) + array949.push(lifted948) } mbt_ffi_free(mbt_ffi_load32(iter_base + 72)) Option::Some(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array911, - defs: array916, + type_nodes: array913, + defs: array918, root: mbt_ffi_load32(iter_base + 68), }, value: @types.SchemaValueTree::{ - value_nodes: array947, + value_nodes: array949, root: mbt_ffi_load32(iter_base + 80), }, }) @@ -9073,13 +9093,13 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted952 = match mbt_ffi_load8_u(iter_base + 88) { + let lifted954 = match mbt_ffi_load8_u(iter_base + 88) { 0 => WrappedFunctionType::ReadLocal 1 => WrappedFunctionType::WriteLocal 2 => WrappedFunctionType::ReadRemote 3 => WrappedFunctionType::WriteRemote 4 => { - let lifted950 : UInt64? = match + let lifted952 : UInt64? = match mbt_ffi_load8_u(iter_base + 96) { 0 => Option::None 1 => @@ -9089,10 +9109,10 @@ pub fn enrich_oplog_entries( _ => panic() } - WrappedFunctionType::WriteRemoteBatched(lifted950) + WrappedFunctionType::WriteRemoteBatched(lifted952) } 5 => { - let lifted951 : UInt64? = match + let lifted953 : UInt64? = match mbt_ffi_load8_u(iter_base + 96) { 0 => Option::None 1 => @@ -9102,7 +9122,7 @@ pub fn enrich_oplog_entries( _ => panic() } - WrappedFunctionType::WriteRemoteTransaction(lifted951) + WrappedFunctionType::WriteRemoteTransaction(lifted953) } _ => panic() } @@ -9112,122 +9132,40 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - parent_start_index: lifted713, - function_name: result714, - request: lifted949, - durable_function_type: lifted952, + parent_start_index: lifted715, + function_name: result716, + request: lifted951, + durable_function_type: lifted954, }) } 2 => { - let lifted1187 : @types.TypedSchemaValue? = match + let lifted1189 : @types.TypedSchemaValue? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let array1149 : Array[@types.SchemaTypeNode] = [] - for index1150 = 0 - index1150 < mbt_ffi_load32(iter_base + 40) - index1150 = index1150 + 1 { + let array1151 : Array[@types.SchemaTypeNode] = [] + for index1152 = 0 + index1152 < mbt_ffi_load32(iter_base + 40) + index1152 = index1152 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1150 * 144 + index1152 * 144 - let lifted1135 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1137 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted959 : @types.NumericRestrictions? = match + let lifted961 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted954 : @types.NumericBound? = match - mbt_ffi_load8_u(iter_base + 16) { - 0 => Option::None - 1 => { - let lifted953 = match - mbt_ffi_load8_u(iter_base + 24) { - 0 => - @types.NumericBound::Signed( - mbt_ffi_load64(iter_base + 32), - ) - 1 => - @types.NumericBound::Unsigned( - mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), - ) - 2 => - @types.NumericBound::FloatBits( - mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), - ) - _ => panic() - } - - Option::Some(lifted953) - } - _ => panic() - } - let lifted956 : @types.NumericBound? = match - mbt_ffi_load8_u(iter_base + 40) { - 0 => Option::None - 1 => { - let lifted955 = match - mbt_ffi_load8_u(iter_base + 48) { - 0 => - @types.NumericBound::Signed( - mbt_ffi_load64(iter_base + 56), - ) - 1 => - @types.NumericBound::Unsigned( - mbt_ffi_load64(iter_base + 56).reinterpret_as_uint64(), - ) - 2 => - @types.NumericBound::FloatBits( - mbt_ffi_load64(iter_base + 56).reinterpret_as_uint64(), - ) - _ => panic() - } - - Option::Some(lifted955) - } - _ => panic() - } - - let lifted958 : String? = match - mbt_ffi_load8_u(iter_base + 64) { - 0 => Option::None - 1 => { - let result957 = mbt_ffi_ptr2str( - mbt_ffi_load32(iter_base + 68), - mbt_ffi_load32(iter_base + 72), - ) - - Option::Some(result957) - } - _ => panic() - } - - Option::Some(@types.NumericRestrictions::{ - min: lifted954, - max: lifted956, - unit: lifted958, - }) - } - _ => panic() - } - - @types.SchemaTypeBody::S8Type(lifted959) - } - 3 => { - let lifted966 : @types.NumericRestrictions? = match - mbt_ffi_load8_u(iter_base + 8) { - 0 => Option::None - 1 => { - let lifted961 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted960 = match + let lifted955 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9244,16 +9182,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted960) + Option::Some(lifted955) } _ => panic() } - let lifted963 : @types.NumericBound? = match + let lifted958 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted962 = match + let lifted957 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9270,46 +9208,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted962) + Option::Some(lifted957) } _ => panic() } - let lifted965 : String? = match + let lifted960 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result964 = mbt_ffi_ptr2str( + let result959 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result964) + Option::Some(result959) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted961, - max: lifted963, - unit: lifted965, + min: lifted956, + max: lifted958, + unit: lifted960, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted966) + @types.SchemaTypeBody::S8Type(lifted961) } - 4 => { - let lifted973 : @types.NumericRestrictions? = match + 3 => { + let lifted968 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted968 : @types.NumericBound? = match + let lifted963 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted967 = match + let lifted962 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9326,16 +9264,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted967) + Option::Some(lifted962) } _ => panic() } - let lifted970 : @types.NumericBound? = match + let lifted965 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted969 = match + let lifted964 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9352,46 +9290,128 @@ pub fn enrich_oplog_entries( _ => panic() } + Option::Some(lifted964) + } + _ => panic() + } + + let lifted967 : String? = match + mbt_ffi_load8_u(iter_base + 64) { + 0 => Option::None + 1 => { + let result966 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 68), + mbt_ffi_load32(iter_base + 72), + ) + + Option::Some(result966) + } + _ => panic() + } + + Option::Some(@types.NumericRestrictions::{ + min: lifted963, + max: lifted965, + unit: lifted967, + }) + } + _ => panic() + } + + @types.SchemaTypeBody::S16Type(lifted968) + } + 4 => { + let lifted975 : @types.NumericRestrictions? = match + mbt_ffi_load8_u(iter_base + 8) { + 0 => Option::None + 1 => { + let lifted970 : @types.NumericBound? = match + mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let lifted969 = match + mbt_ffi_load8_u(iter_base + 24) { + 0 => + @types.NumericBound::Signed( + mbt_ffi_load64(iter_base + 32), + ) + 1 => + @types.NumericBound::Unsigned( + mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), + ) + 2 => + @types.NumericBound::FloatBits( + mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), + ) + _ => panic() + } + Option::Some(lifted969) } _ => panic() } - let lifted972 : String? = match + let lifted972 : @types.NumericBound? = match + mbt_ffi_load8_u(iter_base + 40) { + 0 => Option::None + 1 => { + let lifted971 = match + mbt_ffi_load8_u(iter_base + 48) { + 0 => + @types.NumericBound::Signed( + mbt_ffi_load64(iter_base + 56), + ) + 1 => + @types.NumericBound::Unsigned( + mbt_ffi_load64(iter_base + 56).reinterpret_as_uint64(), + ) + 2 => + @types.NumericBound::FloatBits( + mbt_ffi_load64(iter_base + 56).reinterpret_as_uint64(), + ) + _ => panic() + } + + Option::Some(lifted971) + } + _ => panic() + } + + let lifted974 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result971 = mbt_ffi_ptr2str( + let result973 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result971) + Option::Some(result973) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted968, - max: lifted970, - unit: lifted972, + min: lifted970, + max: lifted972, + unit: lifted974, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted973) + @types.SchemaTypeBody::S32Type(lifted975) } 5 => { - let lifted980 : @types.NumericRestrictions? = match + let lifted982 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted975 : @types.NumericBound? = match + let lifted977 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted974 = match + let lifted976 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9408,16 +9428,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted974) + Option::Some(lifted976) } _ => panic() } - let lifted977 : @types.NumericBound? = match + let lifted979 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted976 = match + let lifted978 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9434,46 +9454,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted976) + Option::Some(lifted978) } _ => panic() } - let lifted979 : String? = match + let lifted981 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result978 = mbt_ffi_ptr2str( + let result980 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result978) + Option::Some(result980) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted975, - max: lifted977, - unit: lifted979, + min: lifted977, + max: lifted979, + unit: lifted981, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted980) + @types.SchemaTypeBody::S64Type(lifted982) } 6 => { - let lifted987 : @types.NumericRestrictions? = match + let lifted989 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted982 : @types.NumericBound? = match + let lifted984 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted981 = match + let lifted983 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9490,16 +9510,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted981) + Option::Some(lifted983) } _ => panic() } - let lifted984 : @types.NumericBound? = match + let lifted986 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted983 = match + let lifted985 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9516,46 +9536,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted983) + Option::Some(lifted985) } _ => panic() } - let lifted986 : String? = match + let lifted988 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result985 = mbt_ffi_ptr2str( + let result987 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result985) + Option::Some(result987) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted982, - max: lifted984, - unit: lifted986, + min: lifted984, + max: lifted986, + unit: lifted988, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted987) + @types.SchemaTypeBody::U8Type(lifted989) } 7 => { - let lifted994 : @types.NumericRestrictions? = match + let lifted996 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted989 : @types.NumericBound? = match + let lifted991 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted988 = match + let lifted990 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9572,16 +9592,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted988) + Option::Some(lifted990) } _ => panic() } - let lifted991 : @types.NumericBound? = match + let lifted993 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted990 = match + let lifted992 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9598,46 +9618,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted990) + Option::Some(lifted992) } _ => panic() } - let lifted993 : String? = match + let lifted995 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result992 = mbt_ffi_ptr2str( + let result994 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result992) + Option::Some(result994) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted989, - max: lifted991, - unit: lifted993, + min: lifted991, + max: lifted993, + unit: lifted995, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted994) + @types.SchemaTypeBody::U16Type(lifted996) } 8 => { - let lifted1001 : @types.NumericRestrictions? = match + let lifted1003 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted996 : @types.NumericBound? = match + let lifted998 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted995 = match + let lifted997 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9654,16 +9674,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted995) + Option::Some(lifted997) } _ => panic() } - let lifted998 : @types.NumericBound? = match + let lifted1000 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted997 = match + let lifted999 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9680,46 +9700,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted997) + Option::Some(lifted999) } _ => panic() } - let lifted1000 : String? = match + let lifted1002 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result999 = mbt_ffi_ptr2str( + let result1001 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result999) + Option::Some(result1001) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted996, - max: lifted998, - unit: lifted1000, + min: lifted998, + max: lifted1000, + unit: lifted1002, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1001) + @types.SchemaTypeBody::U32Type(lifted1003) } 9 => { - let lifted1008 : @types.NumericRestrictions? = match + let lifted1010 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1003 : @types.NumericBound? = match + let lifted1005 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1002 = match + let lifted1004 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9736,16 +9756,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1002) + Option::Some(lifted1004) } _ => panic() } - let lifted1005 : @types.NumericBound? = match + let lifted1007 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1004 = match + let lifted1006 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9762,46 +9782,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1004) + Option::Some(lifted1006) } _ => panic() } - let lifted1007 : String? = match + let lifted1009 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1006 = mbt_ffi_ptr2str( + let result1008 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1006) + Option::Some(result1008) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1003, - max: lifted1005, - unit: lifted1007, + min: lifted1005, + max: lifted1007, + unit: lifted1009, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1008) + @types.SchemaTypeBody::U64Type(lifted1010) } 10 => { - let lifted1015 : @types.NumericRestrictions? = match + let lifted1017 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1010 : @types.NumericBound? = match + let lifted1012 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1009 = match + let lifted1011 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9818,16 +9838,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1009) + Option::Some(lifted1011) } _ => panic() } - let lifted1012 : @types.NumericBound? = match + let lifted1014 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1011 = match + let lifted1013 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9844,46 +9864,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1011) + Option::Some(lifted1013) } _ => panic() } - let lifted1014 : String? = match + let lifted1016 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1013 = mbt_ffi_ptr2str( + let result1015 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1013) + Option::Some(result1015) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1010, - max: lifted1012, - unit: lifted1014, + min: lifted1012, + max: lifted1014, + unit: lifted1016, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1015) + @types.SchemaTypeBody::F32Type(lifted1017) } 11 => { - let lifted1022 : @types.NumericRestrictions? = match + let lifted1024 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1017 : @types.NumericBound? = match + let lifted1019 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1016 = match + let lifted1018 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9900,16 +9920,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1016) + Option::Some(lifted1018) } _ => panic() } - let lifted1019 : @types.NumericBound? = match + let lifted1021 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1018 = match + let lifted1020 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9926,324 +9946,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1018) + Option::Some(lifted1020) } _ => panic() } - let lifted1021 : String? = match + let lifted1023 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1020 = mbt_ffi_ptr2str( + let result1022 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1020) + Option::Some(result1022) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1017, - max: lifted1019, - unit: lifted1021, + min: lifted1019, + max: lifted1021, + unit: lifted1023, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted1022) + @types.SchemaTypeBody::F64Type(lifted1024) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array1037 : Array[@types.NamedFieldType] = [] - for index1038 = 0 - index1038 < mbt_ffi_load32(iter_base + 12) - index1038 = index1038 + 1 { + let array1039 : Array[@types.NamedFieldType] = [] + for index1040 = 0 + index1040 < mbt_ffi_load32(iter_base + 12) + index1040 = index1040 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1038 * 68 + index1040 * 68 - let result1023 = mbt_ffi_ptr2str( + let result1025 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1025 : String? = match + let lifted1027 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1024 = mbt_ffi_ptr2str( + let result1026 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1024) + Option::Some(result1026) } _ => panic() } - let array1027 : Array[String] = [] - for index1028 = 0 - index1028 < mbt_ffi_load32(iter_base + 28) - index1028 = index1028 + 1 { + let array1029 : Array[String] = [] + for index1030 = 0 + index1030 < mbt_ffi_load32(iter_base + 28) + index1030 = index1030 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1028 * 8 + index1030 * 8 - let result1026 = mbt_ffi_ptr2str( + let result1028 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1027.push(result1026) + array1029.push(result1028) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array1030 : Array[String] = [] - for index1031 = 0 - index1031 < mbt_ffi_load32(iter_base + 36) - index1031 = index1031 + 1 { + let array1032 : Array[String] = [] + for index1033 = 0 + index1033 < mbt_ffi_load32(iter_base + 36) + index1033 = index1033 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index1031 * 8 + index1033 * 8 - let result1029 = mbt_ffi_ptr2str( + let result1031 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1030.push(result1029) + array1032.push(result1031) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted1033 : String? = match + let lifted1035 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result1032 = mbt_ffi_ptr2str( + let result1034 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result1032) + Option::Some(result1034) } _ => panic() } - let lifted1036 : @types.Role? = match + let lifted1038 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted1035 = match + let lifted1037 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1034 = mbt_ffi_ptr2str( + let result1036 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result1034) + @types.Role::Other(result1036) } _ => panic() } - Option::Some(lifted1035) + Option::Some(lifted1037) } _ => panic() } - array1037.push(@types.NamedFieldType::{ - name: result1023, + array1039.push(@types.NamedFieldType::{ + name: result1025, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted1025, - aliases: array1027, - examples: array1030, - deprecated: lifted1033, - role: lifted1036, + doc: lifted1027, + aliases: array1029, + examples: array1032, + deprecated: lifted1035, + role: lifted1038, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array1037) + @types.SchemaTypeBody::RecordType(array1039) } 15 => { - let array1054 : Array[@types.VariantCaseType] = [] - for index1055 = 0 - index1055 < mbt_ffi_load32(iter_base + 12) - index1055 = index1055 + 1 { + let array1056 : Array[@types.VariantCaseType] = [] + for index1057 = 0 + index1057 < mbt_ffi_load32(iter_base + 12) + index1057 = index1057 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1055 * 72 + index1057 * 72 - let result1039 = mbt_ffi_ptr2str( + let result1041 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1040 : Int? = match + let lifted1042 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1042 : String? = match + let lifted1044 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1041 = mbt_ffi_ptr2str( + let result1043 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1041) + Option::Some(result1043) } _ => panic() } - let array1044 : Array[String] = [] - for index1045 = 0 - index1045 < mbt_ffi_load32(iter_base + 32) - index1045 = index1045 + 1 { + let array1046 : Array[String] = [] + for index1047 = 0 + index1047 < mbt_ffi_load32(iter_base + 32) + index1047 = index1047 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1045 * 8 + index1047 * 8 - let result1043 = mbt_ffi_ptr2str( + let result1045 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1044.push(result1043) + array1046.push(result1045) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array1047 : Array[String] = [] - for index1048 = 0 - index1048 < mbt_ffi_load32(iter_base + 40) - index1048 = index1048 + 1 { + let array1049 : Array[String] = [] + for index1050 = 0 + index1050 < mbt_ffi_load32(iter_base + 40) + index1050 = index1050 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1048 * 8 + index1050 * 8 - let result1046 = mbt_ffi_ptr2str( + let result1048 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1047.push(result1046) + array1049.push(result1048) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted1050 : String? = match + let lifted1052 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result1049 = mbt_ffi_ptr2str( + let result1051 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result1049) + Option::Some(result1051) } _ => panic() } - let lifted1053 : @types.Role? = match + let lifted1055 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted1052 = match + let lifted1054 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1051 = mbt_ffi_ptr2str( + let result1053 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result1051) + @types.Role::Other(result1053) } _ => panic() } - Option::Some(lifted1052) + Option::Some(lifted1054) } _ => panic() } - array1054.push(@types.VariantCaseType::{ - name: result1039, - payload: lifted1040, + array1056.push(@types.VariantCaseType::{ + name: result1041, + payload: lifted1042, metadata: @types.MetadataEnvelope::{ - doc: lifted1042, - aliases: array1044, - examples: array1047, - deprecated: lifted1050, - role: lifted1053, + doc: lifted1044, + aliases: array1046, + examples: array1049, + deprecated: lifted1052, + role: lifted1055, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array1054) + @types.SchemaTypeBody::VariantType(array1056) } 16 => { - let array1057 : Array[String] = [] - for index1058 = 0 - index1058 < mbt_ffi_load32(iter_base + 12) - index1058 = index1058 + 1 { + let array1059 : Array[String] = [] + for index1060 = 0 + index1060 < mbt_ffi_load32(iter_base + 12) + index1060 = index1060 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1058 * 8 + index1060 * 8 - let result1056 = mbt_ffi_ptr2str( + let result1058 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1057.push(result1056) + array1059.push(result1058) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array1057) + @types.SchemaTypeBody::EnumType(array1059) } 17 => { - let array1060 : Array[String] = [] - for index1061 = 0 - index1061 < mbt_ffi_load32(iter_base + 12) - index1061 = index1061 + 1 { + let array1062 : Array[String] = [] + for index1063 = 0 + index1063 < mbt_ffi_load32(iter_base + 12) + index1063 = index1063 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1061 * 8 + index1063 * 8 - let result1059 = mbt_ffi_ptr2str( + let result1061 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1060.push(result1059) + array1062.push(result1061) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array1060) + @types.SchemaTypeBody::FlagsType(array1062) } 18 => { - let array1062 : Array[Int] = [] - for index1063 = 0 - index1063 < mbt_ffi_load32(iter_base + 12) - index1063 = index1063 + 1 { + let array1064 : Array[Int] = [] + for index1065 = 0 + index1065 < mbt_ffi_load32(iter_base + 12) + index1065 = index1065 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1063 * 4 + index1065 * 4 - array1062.push(mbt_ffi_load32(iter_base + 0)) + array1064.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array1062) + @types.SchemaTypeBody::TupleType(array1064) } 19 => @types.SchemaTypeBody::ListType( @@ -10264,14 +10284,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted1064 : Int? = match + let lifted1066 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1065 : Int? = match + let lifted1067 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -10279,37 +10299,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted1064, - err: lifted1065, + ok: lifted1066, + err: lifted1067, }) } 24 => { - let lifted1069 : Array[String]? = match + let lifted1071 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1067 : Array[String] = [] - for index1068 = 0 - index1068 < mbt_ffi_load32(iter_base + 16) - index1068 = index1068 + 1 { + let array1069 : Array[String] = [] + for index1070 = 0 + index1070 < mbt_ffi_load32(iter_base + 16) + index1070 = index1070 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1068 * 8 + index1070 * 8 - let result1066 = mbt_ffi_ptr2str( + let result1068 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1067.push(result1066) + array1069.push(result1068) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1067) + Option::Some(array1069) } _ => panic() } - let lifted1070 : UInt? = match + let lifted1072 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -10319,7 +10339,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1071 : UInt? = match + let lifted1073 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -10329,54 +10349,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1073 : String? = match + let lifted1075 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1072 = mbt_ffi_ptr2str( + let result1074 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1072) + Option::Some(result1074) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted1069, - min_length: lifted1070, - max_length: lifted1071, - regex: lifted1073, + languages: lifted1071, + min_length: lifted1072, + max_length: lifted1073, + regex: lifted1075, }) } 25 => { - let lifted1077 : Array[String]? = match + let lifted1079 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1075 : Array[String] = [] - for index1076 = 0 - index1076 < mbt_ffi_load32(iter_base + 16) - index1076 = index1076 + 1 { + let array1077 : Array[String] = [] + for index1078 = 0 + index1078 < mbt_ffi_load32(iter_base + 16) + index1078 = index1078 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1076 * 8 + index1078 * 8 - let result1074 = mbt_ffi_ptr2str( + let result1076 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1075.push(result1074) + array1077.push(result1076) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1075) + Option::Some(array1077) } _ => panic() } - let lifted1078 : UInt? = match + let lifted1080 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -10386,7 +10406,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1079 : UInt? = match + let lifted1081 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -10397,58 +10417,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted1077, - min_bytes: lifted1078, - max_bytes: lifted1079, + mime_types: lifted1079, + min_bytes: lifted1080, + max_bytes: lifted1081, }) } 26 => { - let lifted1083 : Array[String]? = match + let lifted1085 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array1081 : Array[String] = [] - for index1082 = 0 - index1082 < mbt_ffi_load32(iter_base + 20) - index1082 = index1082 + 1 { + let array1083 : Array[String] = [] + for index1084 = 0 + index1084 < mbt_ffi_load32(iter_base + 20) + index1084 = index1084 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1082 * 8 + index1084 * 8 - let result1080 = mbt_ffi_ptr2str( + let result1082 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1081.push(result1080) + array1083.push(result1082) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array1081) + Option::Some(array1083) } _ => panic() } - let lifted1087 : Array[String]? = match + let lifted1089 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array1085 : Array[String] = [] - for index1086 = 0 - index1086 < mbt_ffi_load32(iter_base + 32) - index1086 = index1086 + 1 { + let array1087 : Array[String] = [] + for index1088 = 0 + index1088 < mbt_ffi_load32(iter_base + 32) + index1088 = index1088 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1086 * 8 + index1088 * 8 - let result1084 = mbt_ffi_ptr2str( + let result1086 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1085.push(result1084) + array1087.push(result1086) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array1085) + Option::Some(array1087) } _ => panic() } @@ -10460,95 +10480,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted1083, - allowed_extensions: lifted1087, + allowed_mime_types: lifted1085, + allowed_extensions: lifted1089, }) } 27 => { - let lifted1091 : Array[String]? = match + let lifted1093 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1089 : Array[String] = [] - for index1090 = 0 - index1090 < mbt_ffi_load32(iter_base + 16) - index1090 = index1090 + 1 { + let array1091 : Array[String] = [] + for index1092 = 0 + index1092 < mbt_ffi_load32(iter_base + 16) + index1092 = index1092 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1090 * 8 + index1092 * 8 - let result1088 = mbt_ffi_ptr2str( + let result1090 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1089.push(result1088) + array1091.push(result1090) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1089) + Option::Some(array1091) } _ => panic() } - let lifted1095 : Array[String]? = match + let lifted1097 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array1093 : Array[String] = [] - for index1094 = 0 - index1094 < mbt_ffi_load32(iter_base + 28) - index1094 = index1094 + 1 { + let array1095 : Array[String] = [] + for index1096 = 0 + index1096 < mbt_ffi_load32(iter_base + 28) + index1096 = index1096 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1094 * 8 + index1096 * 8 - let result1092 = mbt_ffi_ptr2str( + let result1094 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1093.push(result1092) + array1095.push(result1094) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array1093) + Option::Some(array1095) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted1091, - allowed_hosts: lifted1095, + allowed_schemes: lifted1093, + allowed_hosts: lifted1097, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result1096 = mbt_ffi_ptr2str( + let result1098 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array1098 : Array[String] = [] - for index1099 = 0 - index1099 < mbt_ffi_load32(iter_base + 20) - index1099 = index1099 + 1 { + let array1100 : Array[String] = [] + for index1101 = 0 + index1101 < mbt_ffi_load32(iter_base + 20) + index1101 = index1101 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1099 * 8 + index1101 * 8 - let result1097 = mbt_ffi_ptr2str( + let result1099 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1098.push(result1097) + array1100.push(result1099) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted1101 : @types.QuantityValue? = match + let lifted1103 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1100 = mbt_ffi_ptr2str( + let result1102 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -10556,17 +10576,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result1100, + unit: result1102, }) } _ => panic() } - let lifted1103 : @types.QuantityValue? = match + let lifted1105 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result1102 = mbt_ffi_ptr2str( + let result1104 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -10574,406 +10594,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result1102, + unit: result1104, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result1096, - allowed_suffixes: array1098, - min: lifted1101, - max: lifted1103, + base_unit: result1098, + allowed_suffixes: array1100, + min: lifted1103, + max: lifted1105, }) } 31 => { - let array1127 : Array[@types.UnionBranch] = [] - for index1128 = 0 - index1128 < mbt_ffi_load32(iter_base + 12) - index1128 = index1128 + 1 { + let array1129 : Array[@types.UnionBranch] = [] + for index1130 = 0 + index1130 < mbt_ffi_load32(iter_base + 12) + index1130 = index1130 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1128 * 92 + index1130 * 92 - let result1104 = mbt_ffi_ptr2str( + let result1106 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1113 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted1115 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result1105 = mbt_ffi_ptr2str( + let result1107 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result1105) + @types.DiscriminatorRule::Prefix(result1107) } 1 => { - let result1106 = mbt_ffi_ptr2str( + let result1108 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result1106) + @types.DiscriminatorRule::Suffix(result1108) } 2 => { - let result1107 = mbt_ffi_ptr2str( + let result1109 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result1107) + @types.DiscriminatorRule::Contains(result1109) } 3 => { - let result1108 = mbt_ffi_ptr2str( + let result1110 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result1108) + @types.DiscriminatorRule::Regex(result1110) } 4 => { - let result1109 = mbt_ffi_ptr2str( + let result1111 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted1111 : String? = match + let lifted1113 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1110 = mbt_ffi_ptr2str( + let result1112 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result1110) + Option::Some(result1112) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result1109, - literal: lifted1111, + field_name: result1111, + literal: lifted1113, }) } 5 => { - let result1112 = mbt_ffi_ptr2str( + let result1114 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result1112) + @types.DiscriminatorRule::FieldAbsent(result1114) } _ => panic() } - let lifted1115 : String? = match + let lifted1117 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1114 = mbt_ffi_ptr2str( + let result1116 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1114) + Option::Some(result1116) } _ => panic() } - let array1117 : Array[String] = [] - for index1118 = 0 - index1118 < mbt_ffi_load32(iter_base + 52) - index1118 = index1118 + 1 { + let array1119 : Array[String] = [] + for index1120 = 0 + index1120 < mbt_ffi_load32(iter_base + 52) + index1120 = index1120 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1118 * 8 + index1120 * 8 - let result1116 = mbt_ffi_ptr2str( + let result1118 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1117.push(result1116) + array1119.push(result1118) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1120 : Array[String] = [] - for index1121 = 0 - index1121 < mbt_ffi_load32(iter_base + 60) - index1121 = index1121 + 1 { + let array1122 : Array[String] = [] + for index1123 = 0 + index1123 < mbt_ffi_load32(iter_base + 60) + index1123 = index1123 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1121 * 8 + index1123 * 8 - let result1119 = mbt_ffi_ptr2str( + let result1121 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1120.push(result1119) + array1122.push(result1121) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted1123 : String? = match + let lifted1125 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1122 = mbt_ffi_ptr2str( + let result1124 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1122) + Option::Some(result1124) } _ => panic() } - let lifted1126 : @types.Role? = match + let lifted1128 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted1125 = match + let lifted1127 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1124 = mbt_ffi_ptr2str( + let result1126 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result1124) + @types.Role::Other(result1126) } _ => panic() } - Option::Some(lifted1125) + Option::Some(lifted1127) } _ => panic() } - array1127.push(@types.UnionBranch::{ - tag: result1104, + array1129.push(@types.UnionBranch::{ + tag: result1106, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted1113, + discriminator: lifted1115, metadata: @types.MetadataEnvelope::{ - doc: lifted1115, - aliases: array1117, - examples: array1120, - deprecated: lifted1123, - role: lifted1126, + doc: lifted1117, + aliases: array1119, + examples: array1122, + deprecated: lifted1125, + role: lifted1128, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array1127, + branches: array1129, }) } 32 => { - let lifted1130 : String? = match + let lifted1132 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1129 = mbt_ffi_ptr2str( + let result1131 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1129) + Option::Some(result1131) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted1130, + category: lifted1132, }) } 33 => { - let lifted1132 : String? = match + let lifted1134 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1131 = mbt_ffi_ptr2str( + let result1133 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1131) + Option::Some(result1133) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted1132, + resource_name: lifted1134, }) } 34 => { - let lifted1133 : Int? = match + let lifted1135 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted1133) + @types.SchemaTypeBody::FutureType(lifted1135) } 35 => { - let lifted1134 : Int? = match + let lifted1136 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted1134) + @types.SchemaTypeBody::StreamType(lifted1136) } _ => panic() } - let lifted1137 : String? = match + let lifted1139 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result1136 = mbt_ffi_ptr2str( + let result1138 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result1136) + Option::Some(result1138) } _ => panic() } - let array1139 : Array[String] = [] - for index1140 = 0 - index1140 < mbt_ffi_load32(iter_base + 104) - index1140 = index1140 + 1 { + let array1141 : Array[String] = [] + for index1142 = 0 + index1142 < mbt_ffi_load32(iter_base + 104) + index1142 = index1142 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index1140 * 8 + index1142 * 8 - let result1138 = mbt_ffi_ptr2str( + let result1140 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1139.push(result1138) + array1141.push(result1140) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array1142 : Array[String] = [] - for index1143 = 0 - index1143 < mbt_ffi_load32(iter_base + 112) - index1143 = index1143 + 1 { + let array1144 : Array[String] = [] + for index1145 = 0 + index1145 < mbt_ffi_load32(iter_base + 112) + index1145 = index1145 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index1143 * 8 + index1145 * 8 - let result1141 = mbt_ffi_ptr2str( + let result1143 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1142.push(result1141) + array1144.push(result1143) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted1145 : String? = match + let lifted1147 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result1144 = mbt_ffi_ptr2str( + let result1146 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result1144) + Option::Some(result1146) } _ => panic() } - let lifted1148 : @types.Role? = match + let lifted1150 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted1147 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted1149 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1146 = mbt_ffi_ptr2str( + let result1148 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result1146) + @types.Role::Other(result1148) } _ => panic() } - Option::Some(lifted1147) + Option::Some(lifted1149) } _ => panic() } - array1149.push(@types.SchemaTypeNode::{ - body: lifted1135, + array1151.push(@types.SchemaTypeNode::{ + body: lifted1137, metadata: @types.MetadataEnvelope::{ - doc: lifted1137, - aliases: array1139, - examples: array1142, - deprecated: lifted1145, - role: lifted1148, + doc: lifted1139, + aliases: array1141, + examples: array1144, + deprecated: lifted1147, + role: lifted1150, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array1154 : Array[@types.SchemaTypeDef] = [] - for index1155 = 0 - index1155 < mbt_ffi_load32(iter_base + 48) - index1155 = index1155 + 1 { + let array1156 : Array[@types.SchemaTypeDef] = [] + for index1157 = 0 + index1157 < mbt_ffi_load32(iter_base + 48) + index1157 = index1157 + 1 { let iter_base = mbt_ffi_load32(iter_base + 44) + - index1155 * 24 + index1157 * 24 - let result1151 = mbt_ffi_ptr2str( + let result1153 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1153 : String? = match + let lifted1155 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1152 = mbt_ffi_ptr2str( + let result1154 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1152) + Option::Some(result1154) } _ => panic() } - array1154.push(@types.SchemaTypeDef::{ - id: result1151, - name: lifted1153, + array1156.push(@types.SchemaTypeDef::{ + id: result1153, + name: lifted1155, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 44)) - let array1185 : Array[@types.SchemaValueNode] = [] - for index1186 = 0 - index1186 < mbt_ffi_load32(iter_base + 60) - index1186 = index1186 + 1 { + let array1187 : Array[@types.SchemaValueNode] = [] + for index1188 = 0 + index1188 < mbt_ffi_load32(iter_base + 60) + index1188 = index1188 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1186 * 32 + index1188 * 32 - let lifted1184 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1186 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -11025,29 +11045,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result1156 = mbt_ffi_ptr2str( + let result1158 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result1156) + @types.SchemaValueNode::StringValue(result1158) } 13 => { - let array1157 : Array[Int] = [] - for index1158 = 0 - index1158 < mbt_ffi_load32(iter_base + 12) - index1158 = index1158 + 1 { + let array1159 : Array[Int] = [] + for index1160 = 0 + index1160 < mbt_ffi_load32(iter_base + 12) + index1160 = index1160 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1158 * 4 + index1160 * 4 - array1157.push(mbt_ffi_load32(iter_base + 0)) + array1159.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array1157) + @types.SchemaValueNode::RecordValue(array1159) } 14 => { - let lifted1159 : Int? = match + let lifted1161 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -11056,7 +11076,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted1159, + payload: lifted1161, }) } 15 => @@ -11064,34 +11084,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array1160 : Array[Bool] = [] - for index1161 = 0 - index1161 < mbt_ffi_load32(iter_base + 12) - index1161 = index1161 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index1161 * 1 - - array1160.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array1160) - } - 17 => { - let array1162 : Array[Int] = [] + let array1162 : Array[Bool] = [] for index1163 = 0 index1163 < mbt_ffi_load32(iter_base + 12) index1163 = index1163 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1163 * 4 + index1163 * 1 - array1162.push(mbt_ffi_load32(iter_base + 0)) + array1162.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array1162) + @types.SchemaValueNode::FlagsValue(array1162) } - 18 => { + 17 => { let array1164 : Array[Int] = [] for index1165 = 0 index1165 < mbt_ffi_load32(iter_base + 12) @@ -11103,9 +11109,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array1164) + @types.SchemaValueNode::TupleValue(array1164) } - 19 => { + 18 => { let array1166 : Array[Int] = [] for index1167 = 0 index1167 < mbt_ffi_load32(iter_base + 12) @@ -11117,127 +11123,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array1166) + @types.SchemaValueNode::ListValue(array1166) } - 20 => { - let array1168 : Array[@types.MapEntry] = [] + 19 => { + let array1168 : Array[Int] = [] for index1169 = 0 index1169 < mbt_ffi_load32(iter_base + 12) index1169 = index1169 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1169 * 8 + index1169 * 4 + + array1168.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array1168) + } + 20 => { + let array1170 : Array[@types.MapEntry] = [] + for index1171 = 0 + index1171 < mbt_ffi_load32(iter_base + 12) + index1171 = index1171 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index1171 * 8 - array1168.push(@types.MapEntry::{ + array1170.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array1168) + @types.SchemaValueNode::MapValue(array1170) } 21 => { - let lifted1170 : Int? = match + let lifted1172 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted1170) + @types.SchemaValueNode::OptionValue(lifted1172) } 22 => { - let lifted1173 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted1175 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted1171 : Int? = match + let lifted1173 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted1171) + @types.ResultValuePayload::OkValue(lifted1173) } 1 => { - let lifted1172 : Int? = match + let lifted1174 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted1172) + @types.ResultValuePayload::ErrValue(lifted1174) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted1173) + @types.SchemaValueNode::ResultValue(lifted1175) } 23 => { - let result1174 = mbt_ffi_ptr2str( + let result1176 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1176 : String? = match + let lifted1178 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1175 = mbt_ffi_ptr2str( + let result1177 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1175) + Option::Some(result1177) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result1174, - language: lifted1176, + text: result1176, + language: lifted1178, }) } 24 => { - let result1177 = mbt_ffi_ptr2bytes( + let result1179 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1179 : String? = match + let lifted1181 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1178 = mbt_ffi_ptr2str( + let result1180 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1178) + Option::Some(result1180) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result1177, - mime_type: lifted1179, + bytes: result1179, + mime_type: lifted1181, }) } 25 => { - let result1180 = mbt_ffi_ptr2str( + let result1182 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result1180) + @types.SchemaValueNode::PathValue(result1182) } 26 => { - let result1181 = mbt_ffi_ptr2str( + let result1183 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result1181) + @types.SchemaValueNode::UrlValue(result1183) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -11249,7 +11269,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result1182 = mbt_ffi_ptr2str( + let result1184 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -11257,17 +11277,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result1182, + unit: result1184, }) } 30 => { - let result1183 = mbt_ffi_ptr2str( + let result1185 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result1183, + tag: result1185, body: mbt_ffi_load32(iter_base + 16), }) } @@ -11281,21 +11301,27 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array1185.push(lifted1184) + array1187.push(lifted1186) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) Option::Some(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array1149, - defs: array1154, + type_nodes: array1151, + defs: array1156, root: mbt_ffi_load32(iter_base + 52), }, value: @types.SchemaValueTree::{ - value_nodes: array1185, + value_nodes: array1187, root: mbt_ffi_load32(iter_base + 64), }, }) @@ -11309,38 +11335,38 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, start_index: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - response: lifted1187, + response: lifted1189, forced_commit: mbt_ffi_load8_u(iter_base + 68) != 0, }) } 3 => { - let lifted1422 : @types.TypedSchemaValue? = match + let lifted1424 : @types.TypedSchemaValue? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let array1384 : Array[@types.SchemaTypeNode] = [] - for index1385 = 0 - index1385 < mbt_ffi_load32(iter_base + 40) - index1385 = index1385 + 1 { + let array1386 : Array[@types.SchemaTypeNode] = [] + for index1387 = 0 + index1387 < mbt_ffi_load32(iter_base + 40) + index1387 = index1387 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1385 * 144 + index1387 * 144 - let lifted1370 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1372 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted1194 : @types.NumericRestrictions? = match + let lifted1196 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1189 : @types.NumericBound? = match + let lifted1191 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1188 = match + let lifted1190 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11357,16 +11383,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1188) + Option::Some(lifted1190) } _ => panic() } - let lifted1191 : @types.NumericBound? = match + let lifted1193 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1190 = match + let lifted1192 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11383,46 +11409,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1190) + Option::Some(lifted1192) } _ => panic() } - let lifted1193 : String? = match + let lifted1195 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1192 = mbt_ffi_ptr2str( + let result1194 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1192) + Option::Some(result1194) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1189, - max: lifted1191, - unit: lifted1193, + min: lifted1191, + max: lifted1193, + unit: lifted1195, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted1194) + @types.SchemaTypeBody::S8Type(lifted1196) } 3 => { - let lifted1201 : @types.NumericRestrictions? = match + let lifted1203 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1196 : @types.NumericBound? = match + let lifted1198 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1195 = match + let lifted1197 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11439,16 +11465,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1195) + Option::Some(lifted1197) } _ => panic() } - let lifted1198 : @types.NumericBound? = match + let lifted1200 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1197 = match + let lifted1199 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11465,46 +11491,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1197) + Option::Some(lifted1199) } _ => panic() } - let lifted1200 : String? = match + let lifted1202 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1199 = mbt_ffi_ptr2str( + let result1201 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1199) + Option::Some(result1201) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1196, - max: lifted1198, - unit: lifted1200, + min: lifted1198, + max: lifted1200, + unit: lifted1202, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted1201) + @types.SchemaTypeBody::S16Type(lifted1203) } 4 => { - let lifted1208 : @types.NumericRestrictions? = match + let lifted1210 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1203 : @types.NumericBound? = match + let lifted1205 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1202 = match + let lifted1204 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11521,16 +11547,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1202) + Option::Some(lifted1204) } _ => panic() } - let lifted1205 : @types.NumericBound? = match + let lifted1207 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1204 = match + let lifted1206 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11547,46 +11573,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1204) + Option::Some(lifted1206) } _ => panic() } - let lifted1207 : String? = match + let lifted1209 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1206 = mbt_ffi_ptr2str( + let result1208 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1206) + Option::Some(result1208) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1203, - max: lifted1205, - unit: lifted1207, + min: lifted1205, + max: lifted1207, + unit: lifted1209, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted1208) + @types.SchemaTypeBody::S32Type(lifted1210) } 5 => { - let lifted1215 : @types.NumericRestrictions? = match + let lifted1217 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1210 : @types.NumericBound? = match + let lifted1212 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1209 = match + let lifted1211 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11603,16 +11629,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1209) + Option::Some(lifted1211) } _ => panic() } - let lifted1212 : @types.NumericBound? = match + let lifted1214 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1211 = match + let lifted1213 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11629,46 +11655,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1211) + Option::Some(lifted1213) } _ => panic() } - let lifted1214 : String? = match + let lifted1216 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1213 = mbt_ffi_ptr2str( + let result1215 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1213) + Option::Some(result1215) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1210, - max: lifted1212, - unit: lifted1214, + min: lifted1212, + max: lifted1214, + unit: lifted1216, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted1215) + @types.SchemaTypeBody::S64Type(lifted1217) } 6 => { - let lifted1222 : @types.NumericRestrictions? = match + let lifted1224 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1217 : @types.NumericBound? = match + let lifted1219 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1216 = match + let lifted1218 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11685,16 +11711,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1216) + Option::Some(lifted1218) } _ => panic() } - let lifted1219 : @types.NumericBound? = match + let lifted1221 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1218 = match + let lifted1220 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11711,46 +11737,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1218) + Option::Some(lifted1220) } _ => panic() } - let lifted1221 : String? = match + let lifted1223 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1220 = mbt_ffi_ptr2str( + let result1222 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1220) + Option::Some(result1222) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1217, - max: lifted1219, - unit: lifted1221, + min: lifted1219, + max: lifted1221, + unit: lifted1223, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted1222) + @types.SchemaTypeBody::U8Type(lifted1224) } 7 => { - let lifted1229 : @types.NumericRestrictions? = match + let lifted1231 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1224 : @types.NumericBound? = match + let lifted1226 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1223 = match + let lifted1225 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11767,16 +11793,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1223) + Option::Some(lifted1225) } _ => panic() } - let lifted1226 : @types.NumericBound? = match + let lifted1228 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1225 = match + let lifted1227 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11793,46 +11819,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1225) + Option::Some(lifted1227) } _ => panic() } - let lifted1228 : String? = match + let lifted1230 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1227 = mbt_ffi_ptr2str( + let result1229 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1227) + Option::Some(result1229) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1224, - max: lifted1226, - unit: lifted1228, + min: lifted1226, + max: lifted1228, + unit: lifted1230, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted1229) + @types.SchemaTypeBody::U16Type(lifted1231) } 8 => { - let lifted1236 : @types.NumericRestrictions? = match + let lifted1238 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1231 : @types.NumericBound? = match + let lifted1233 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1230 = match + let lifted1232 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11849,16 +11875,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1230) + Option::Some(lifted1232) } _ => panic() } - let lifted1233 : @types.NumericBound? = match + let lifted1235 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1232 = match + let lifted1234 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11875,46 +11901,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1232) + Option::Some(lifted1234) } _ => panic() } - let lifted1235 : String? = match + let lifted1237 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1234 = mbt_ffi_ptr2str( + let result1236 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1234) + Option::Some(result1236) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1231, - max: lifted1233, - unit: lifted1235, + min: lifted1233, + max: lifted1235, + unit: lifted1237, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1236) + @types.SchemaTypeBody::U32Type(lifted1238) } 9 => { - let lifted1243 : @types.NumericRestrictions? = match + let lifted1245 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1238 : @types.NumericBound? = match + let lifted1240 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1237 = match + let lifted1239 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11931,16 +11957,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1237) + Option::Some(lifted1239) } _ => panic() } - let lifted1240 : @types.NumericBound? = match + let lifted1242 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1239 = match + let lifted1241 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11957,46 +11983,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1239) + Option::Some(lifted1241) } _ => panic() } - let lifted1242 : String? = match + let lifted1244 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1241 = mbt_ffi_ptr2str( + let result1243 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1241) + Option::Some(result1243) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1238, - max: lifted1240, - unit: lifted1242, + min: lifted1240, + max: lifted1242, + unit: lifted1244, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1243) + @types.SchemaTypeBody::U64Type(lifted1245) } 10 => { - let lifted1250 : @types.NumericRestrictions? = match + let lifted1252 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1245 : @types.NumericBound? = match + let lifted1247 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1244 = match + let lifted1246 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -12013,16 +12039,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1244) + Option::Some(lifted1246) } _ => panic() } - let lifted1247 : @types.NumericBound? = match + let lifted1249 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1246 = match + let lifted1248 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -12039,46 +12065,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1246) + Option::Some(lifted1248) } _ => panic() } - let lifted1249 : String? = match + let lifted1251 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1248 = mbt_ffi_ptr2str( + let result1250 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1248) + Option::Some(result1250) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1245, - max: lifted1247, - unit: lifted1249, + min: lifted1247, + max: lifted1249, + unit: lifted1251, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1250) + @types.SchemaTypeBody::F32Type(lifted1252) } 11 => { - let lifted1257 : @types.NumericRestrictions? = match + let lifted1259 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1252 : @types.NumericBound? = match + let lifted1254 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1251 = match + let lifted1253 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -12095,16 +12121,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1251) + Option::Some(lifted1253) } _ => panic() } - let lifted1254 : @types.NumericBound? = match + let lifted1256 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1253 = match + let lifted1255 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -12121,324 +12147,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1253) + Option::Some(lifted1255) } _ => panic() } - let lifted1256 : String? = match + let lifted1258 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1255 = mbt_ffi_ptr2str( + let result1257 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1255) + Option::Some(result1257) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1252, - max: lifted1254, - unit: lifted1256, + min: lifted1254, + max: lifted1256, + unit: lifted1258, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted1257) + @types.SchemaTypeBody::F64Type(lifted1259) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array1272 : Array[@types.NamedFieldType] = [] - for index1273 = 0 - index1273 < mbt_ffi_load32(iter_base + 12) - index1273 = index1273 + 1 { + let array1274 : Array[@types.NamedFieldType] = [] + for index1275 = 0 + index1275 < mbt_ffi_load32(iter_base + 12) + index1275 = index1275 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1273 * 68 + index1275 * 68 - let result1258 = mbt_ffi_ptr2str( + let result1260 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1260 : String? = match + let lifted1262 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1259 = mbt_ffi_ptr2str( + let result1261 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1259) + Option::Some(result1261) } _ => panic() } - let array1262 : Array[String] = [] - for index1263 = 0 - index1263 < mbt_ffi_load32(iter_base + 28) - index1263 = index1263 + 1 { + let array1264 : Array[String] = [] + for index1265 = 0 + index1265 < mbt_ffi_load32(iter_base + 28) + index1265 = index1265 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1263 * 8 + index1265 * 8 - let result1261 = mbt_ffi_ptr2str( + let result1263 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1262.push(result1261) + array1264.push(result1263) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array1265 : Array[String] = [] - for index1266 = 0 - index1266 < mbt_ffi_load32(iter_base + 36) - index1266 = index1266 + 1 { + let array1267 : Array[String] = [] + for index1268 = 0 + index1268 < mbt_ffi_load32(iter_base + 36) + index1268 = index1268 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index1266 * 8 + index1268 * 8 - let result1264 = mbt_ffi_ptr2str( + let result1266 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1265.push(result1264) + array1267.push(result1266) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted1268 : String? = match + let lifted1270 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result1267 = mbt_ffi_ptr2str( + let result1269 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result1267) + Option::Some(result1269) } _ => panic() } - let lifted1271 : @types.Role? = match + let lifted1273 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted1270 = match + let lifted1272 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1269 = mbt_ffi_ptr2str( + let result1271 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result1269) + @types.Role::Other(result1271) } _ => panic() } - Option::Some(lifted1270) + Option::Some(lifted1272) } _ => panic() } - array1272.push(@types.NamedFieldType::{ - name: result1258, + array1274.push(@types.NamedFieldType::{ + name: result1260, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted1260, - aliases: array1262, - examples: array1265, - deprecated: lifted1268, - role: lifted1271, + doc: lifted1262, + aliases: array1264, + examples: array1267, + deprecated: lifted1270, + role: lifted1273, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array1272) + @types.SchemaTypeBody::RecordType(array1274) } 15 => { - let array1289 : Array[@types.VariantCaseType] = [] - for index1290 = 0 - index1290 < mbt_ffi_load32(iter_base + 12) - index1290 = index1290 + 1 { + let array1291 : Array[@types.VariantCaseType] = [] + for index1292 = 0 + index1292 < mbt_ffi_load32(iter_base + 12) + index1292 = index1292 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1290 * 72 + index1292 * 72 - let result1274 = mbt_ffi_ptr2str( + let result1276 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1275 : Int? = match + let lifted1277 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1277 : String? = match + let lifted1279 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1276 = mbt_ffi_ptr2str( + let result1278 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1276) + Option::Some(result1278) } _ => panic() } - let array1279 : Array[String] = [] - for index1280 = 0 - index1280 < mbt_ffi_load32(iter_base + 32) - index1280 = index1280 + 1 { + let array1281 : Array[String] = [] + for index1282 = 0 + index1282 < mbt_ffi_load32(iter_base + 32) + index1282 = index1282 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1280 * 8 + index1282 * 8 - let result1278 = mbt_ffi_ptr2str( + let result1280 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1279.push(result1278) + array1281.push(result1280) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array1282 : Array[String] = [] - for index1283 = 0 - index1283 < mbt_ffi_load32(iter_base + 40) - index1283 = index1283 + 1 { + let array1284 : Array[String] = [] + for index1285 = 0 + index1285 < mbt_ffi_load32(iter_base + 40) + index1285 = index1285 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1283 * 8 + index1285 * 8 - let result1281 = mbt_ffi_ptr2str( + let result1283 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1282.push(result1281) + array1284.push(result1283) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted1285 : String? = match + let lifted1287 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result1284 = mbt_ffi_ptr2str( + let result1286 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result1284) + Option::Some(result1286) } _ => panic() } - let lifted1288 : @types.Role? = match + let lifted1290 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted1287 = match + let lifted1289 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1286 = mbt_ffi_ptr2str( + let result1288 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result1286) + @types.Role::Other(result1288) } _ => panic() } - Option::Some(lifted1287) + Option::Some(lifted1289) } _ => panic() } - array1289.push(@types.VariantCaseType::{ - name: result1274, - payload: lifted1275, + array1291.push(@types.VariantCaseType::{ + name: result1276, + payload: lifted1277, metadata: @types.MetadataEnvelope::{ - doc: lifted1277, - aliases: array1279, - examples: array1282, - deprecated: lifted1285, - role: lifted1288, + doc: lifted1279, + aliases: array1281, + examples: array1284, + deprecated: lifted1287, + role: lifted1290, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array1289) + @types.SchemaTypeBody::VariantType(array1291) } 16 => { - let array1292 : Array[String] = [] - for index1293 = 0 - index1293 < mbt_ffi_load32(iter_base + 12) - index1293 = index1293 + 1 { + let array1294 : Array[String] = [] + for index1295 = 0 + index1295 < mbt_ffi_load32(iter_base + 12) + index1295 = index1295 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1293 * 8 + index1295 * 8 - let result1291 = mbt_ffi_ptr2str( + let result1293 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1292.push(result1291) + array1294.push(result1293) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array1292) + @types.SchemaTypeBody::EnumType(array1294) } 17 => { - let array1295 : Array[String] = [] - for index1296 = 0 - index1296 < mbt_ffi_load32(iter_base + 12) - index1296 = index1296 + 1 { + let array1297 : Array[String] = [] + for index1298 = 0 + index1298 < mbt_ffi_load32(iter_base + 12) + index1298 = index1298 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1296 * 8 + index1298 * 8 - let result1294 = mbt_ffi_ptr2str( + let result1296 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1295.push(result1294) + array1297.push(result1296) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array1295) + @types.SchemaTypeBody::FlagsType(array1297) } 18 => { - let array1297 : Array[Int] = [] - for index1298 = 0 - index1298 < mbt_ffi_load32(iter_base + 12) - index1298 = index1298 + 1 { + let array1299 : Array[Int] = [] + for index1300 = 0 + index1300 < mbt_ffi_load32(iter_base + 12) + index1300 = index1300 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1298 * 4 + index1300 * 4 - array1297.push(mbt_ffi_load32(iter_base + 0)) + array1299.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array1297) + @types.SchemaTypeBody::TupleType(array1299) } 19 => @types.SchemaTypeBody::ListType( @@ -12459,14 +12485,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted1299 : Int? = match + let lifted1301 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1300 : Int? = match + let lifted1302 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -12474,37 +12500,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted1299, - err: lifted1300, + ok: lifted1301, + err: lifted1302, }) } 24 => { - let lifted1304 : Array[String]? = match + let lifted1306 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1302 : Array[String] = [] - for index1303 = 0 - index1303 < mbt_ffi_load32(iter_base + 16) - index1303 = index1303 + 1 { + let array1304 : Array[String] = [] + for index1305 = 0 + index1305 < mbt_ffi_load32(iter_base + 16) + index1305 = index1305 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1303 * 8 + index1305 * 8 - let result1301 = mbt_ffi_ptr2str( + let result1303 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1302.push(result1301) + array1304.push(result1303) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1302) + Option::Some(array1304) } _ => panic() } - let lifted1305 : UInt? = match + let lifted1307 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -12514,7 +12540,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1306 : UInt? = match + let lifted1308 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -12524,54 +12550,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1308 : String? = match + let lifted1310 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1307 = mbt_ffi_ptr2str( + let result1309 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1307) + Option::Some(result1309) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted1304, - min_length: lifted1305, - max_length: lifted1306, - regex: lifted1308, + languages: lifted1306, + min_length: lifted1307, + max_length: lifted1308, + regex: lifted1310, }) } 25 => { - let lifted1312 : Array[String]? = match + let lifted1314 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1310 : Array[String] = [] - for index1311 = 0 - index1311 < mbt_ffi_load32(iter_base + 16) - index1311 = index1311 + 1 { + let array1312 : Array[String] = [] + for index1313 = 0 + index1313 < mbt_ffi_load32(iter_base + 16) + index1313 = index1313 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1311 * 8 + index1313 * 8 - let result1309 = mbt_ffi_ptr2str( + let result1311 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1310.push(result1309) + array1312.push(result1311) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1310) + Option::Some(array1312) } _ => panic() } - let lifted1313 : UInt? = match + let lifted1315 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -12581,7 +12607,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1314 : UInt? = match + let lifted1316 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -12592,58 +12618,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted1312, - min_bytes: lifted1313, - max_bytes: lifted1314, + mime_types: lifted1314, + min_bytes: lifted1315, + max_bytes: lifted1316, }) } 26 => { - let lifted1318 : Array[String]? = match + let lifted1320 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array1316 : Array[String] = [] - for index1317 = 0 - index1317 < mbt_ffi_load32(iter_base + 20) - index1317 = index1317 + 1 { + let array1318 : Array[String] = [] + for index1319 = 0 + index1319 < mbt_ffi_load32(iter_base + 20) + index1319 = index1319 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1317 * 8 + index1319 * 8 - let result1315 = mbt_ffi_ptr2str( + let result1317 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1316.push(result1315) + array1318.push(result1317) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array1316) + Option::Some(array1318) } _ => panic() } - let lifted1322 : Array[String]? = match + let lifted1324 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array1320 : Array[String] = [] - for index1321 = 0 - index1321 < mbt_ffi_load32(iter_base + 32) - index1321 = index1321 + 1 { + let array1322 : Array[String] = [] + for index1323 = 0 + index1323 < mbt_ffi_load32(iter_base + 32) + index1323 = index1323 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1321 * 8 + index1323 * 8 - let result1319 = mbt_ffi_ptr2str( + let result1321 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1320.push(result1319) + array1322.push(result1321) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array1320) + Option::Some(array1322) } _ => panic() } @@ -12655,95 +12681,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted1318, - allowed_extensions: lifted1322, + allowed_mime_types: lifted1320, + allowed_extensions: lifted1324, }) } 27 => { - let lifted1326 : Array[String]? = match + let lifted1328 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1324 : Array[String] = [] - for index1325 = 0 - index1325 < mbt_ffi_load32(iter_base + 16) - index1325 = index1325 + 1 { + let array1326 : Array[String] = [] + for index1327 = 0 + index1327 < mbt_ffi_load32(iter_base + 16) + index1327 = index1327 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1325 * 8 + index1327 * 8 - let result1323 = mbt_ffi_ptr2str( + let result1325 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1324.push(result1323) + array1326.push(result1325) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1324) + Option::Some(array1326) } _ => panic() } - let lifted1330 : Array[String]? = match + let lifted1332 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array1328 : Array[String] = [] - for index1329 = 0 - index1329 < mbt_ffi_load32(iter_base + 28) - index1329 = index1329 + 1 { + let array1330 : Array[String] = [] + for index1331 = 0 + index1331 < mbt_ffi_load32(iter_base + 28) + index1331 = index1331 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1329 * 8 + index1331 * 8 - let result1327 = mbt_ffi_ptr2str( + let result1329 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1328.push(result1327) + array1330.push(result1329) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array1328) + Option::Some(array1330) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted1326, - allowed_hosts: lifted1330, + allowed_schemes: lifted1328, + allowed_hosts: lifted1332, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result1331 = mbt_ffi_ptr2str( + let result1333 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array1333 : Array[String] = [] - for index1334 = 0 - index1334 < mbt_ffi_load32(iter_base + 20) - index1334 = index1334 + 1 { + let array1335 : Array[String] = [] + for index1336 = 0 + index1336 < mbt_ffi_load32(iter_base + 20) + index1336 = index1336 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1334 * 8 + index1336 * 8 - let result1332 = mbt_ffi_ptr2str( + let result1334 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1333.push(result1332) + array1335.push(result1334) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted1336 : @types.QuantityValue? = match + let lifted1338 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1335 = mbt_ffi_ptr2str( + let result1337 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -12751,17 +12777,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result1335, + unit: result1337, }) } _ => panic() } - let lifted1338 : @types.QuantityValue? = match + let lifted1340 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result1337 = mbt_ffi_ptr2str( + let result1339 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -12769,406 +12795,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result1337, + unit: result1339, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result1331, - allowed_suffixes: array1333, - min: lifted1336, - max: lifted1338, + base_unit: result1333, + allowed_suffixes: array1335, + min: lifted1338, + max: lifted1340, }) } 31 => { - let array1362 : Array[@types.UnionBranch] = [] - for index1363 = 0 - index1363 < mbt_ffi_load32(iter_base + 12) - index1363 = index1363 + 1 { + let array1364 : Array[@types.UnionBranch] = [] + for index1365 = 0 + index1365 < mbt_ffi_load32(iter_base + 12) + index1365 = index1365 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1363 * 92 + index1365 * 92 - let result1339 = mbt_ffi_ptr2str( + let result1341 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1348 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted1350 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result1340 = mbt_ffi_ptr2str( + let result1342 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result1340) + @types.DiscriminatorRule::Prefix(result1342) } 1 => { - let result1341 = mbt_ffi_ptr2str( + let result1343 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result1341) + @types.DiscriminatorRule::Suffix(result1343) } 2 => { - let result1342 = mbt_ffi_ptr2str( + let result1344 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result1342) + @types.DiscriminatorRule::Contains(result1344) } 3 => { - let result1343 = mbt_ffi_ptr2str( + let result1345 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result1343) + @types.DiscriminatorRule::Regex(result1345) } 4 => { - let result1344 = mbt_ffi_ptr2str( + let result1346 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted1346 : String? = match + let lifted1348 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1345 = mbt_ffi_ptr2str( + let result1347 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result1345) + Option::Some(result1347) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result1344, - literal: lifted1346, + field_name: result1346, + literal: lifted1348, }) } 5 => { - let result1347 = mbt_ffi_ptr2str( + let result1349 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result1347) + @types.DiscriminatorRule::FieldAbsent(result1349) } _ => panic() } - let lifted1350 : String? = match + let lifted1352 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1349 = mbt_ffi_ptr2str( + let result1351 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1349) + Option::Some(result1351) } _ => panic() } - let array1352 : Array[String] = [] - for index1353 = 0 - index1353 < mbt_ffi_load32(iter_base + 52) - index1353 = index1353 + 1 { + let array1354 : Array[String] = [] + for index1355 = 0 + index1355 < mbt_ffi_load32(iter_base + 52) + index1355 = index1355 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1353 * 8 + index1355 * 8 - let result1351 = mbt_ffi_ptr2str( + let result1353 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1352.push(result1351) + array1354.push(result1353) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1355 : Array[String] = [] - for index1356 = 0 - index1356 < mbt_ffi_load32(iter_base + 60) - index1356 = index1356 + 1 { + let array1357 : Array[String] = [] + for index1358 = 0 + index1358 < mbt_ffi_load32(iter_base + 60) + index1358 = index1358 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1356 * 8 + index1358 * 8 - let result1354 = mbt_ffi_ptr2str( + let result1356 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1355.push(result1354) + array1357.push(result1356) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted1358 : String? = match + let lifted1360 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1357 = mbt_ffi_ptr2str( + let result1359 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1357) + Option::Some(result1359) } _ => panic() } - let lifted1361 : @types.Role? = match + let lifted1363 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted1360 = match + let lifted1362 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1359 = mbt_ffi_ptr2str( + let result1361 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result1359) + @types.Role::Other(result1361) } _ => panic() } - Option::Some(lifted1360) + Option::Some(lifted1362) } _ => panic() } - array1362.push(@types.UnionBranch::{ - tag: result1339, + array1364.push(@types.UnionBranch::{ + tag: result1341, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted1348, + discriminator: lifted1350, metadata: @types.MetadataEnvelope::{ - doc: lifted1350, - aliases: array1352, - examples: array1355, - deprecated: lifted1358, - role: lifted1361, + doc: lifted1352, + aliases: array1354, + examples: array1357, + deprecated: lifted1360, + role: lifted1363, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array1362, + branches: array1364, }) } 32 => { - let lifted1365 : String? = match + let lifted1367 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1364 = mbt_ffi_ptr2str( + let result1366 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1364) + Option::Some(result1366) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted1365, + category: lifted1367, }) } 33 => { - let lifted1367 : String? = match + let lifted1369 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1366 = mbt_ffi_ptr2str( + let result1368 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1366) + Option::Some(result1368) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted1367, + resource_name: lifted1369, }) } 34 => { - let lifted1368 : Int? = match + let lifted1370 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted1368) + @types.SchemaTypeBody::FutureType(lifted1370) } 35 => { - let lifted1369 : Int? = match + let lifted1371 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted1369) + @types.SchemaTypeBody::StreamType(lifted1371) } _ => panic() } - let lifted1372 : String? = match + let lifted1374 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result1371 = mbt_ffi_ptr2str( + let result1373 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result1371) + Option::Some(result1373) } _ => panic() } - let array1374 : Array[String] = [] - for index1375 = 0 - index1375 < mbt_ffi_load32(iter_base + 104) - index1375 = index1375 + 1 { + let array1376 : Array[String] = [] + for index1377 = 0 + index1377 < mbt_ffi_load32(iter_base + 104) + index1377 = index1377 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index1375 * 8 + index1377 * 8 - let result1373 = mbt_ffi_ptr2str( + let result1375 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1374.push(result1373) + array1376.push(result1375) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array1377 : Array[String] = [] - for index1378 = 0 - index1378 < mbt_ffi_load32(iter_base + 112) - index1378 = index1378 + 1 { + let array1379 : Array[String] = [] + for index1380 = 0 + index1380 < mbt_ffi_load32(iter_base + 112) + index1380 = index1380 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index1378 * 8 + index1380 * 8 - let result1376 = mbt_ffi_ptr2str( + let result1378 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1377.push(result1376) + array1379.push(result1378) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted1380 : String? = match + let lifted1382 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result1379 = mbt_ffi_ptr2str( + let result1381 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result1379) + Option::Some(result1381) } _ => panic() } - let lifted1383 : @types.Role? = match + let lifted1385 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted1382 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted1384 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1381 = mbt_ffi_ptr2str( + let result1383 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result1381) + @types.Role::Other(result1383) } _ => panic() } - Option::Some(lifted1382) + Option::Some(lifted1384) } _ => panic() } - array1384.push(@types.SchemaTypeNode::{ - body: lifted1370, + array1386.push(@types.SchemaTypeNode::{ + body: lifted1372, metadata: @types.MetadataEnvelope::{ - doc: lifted1372, - aliases: array1374, - examples: array1377, - deprecated: lifted1380, - role: lifted1383, + doc: lifted1374, + aliases: array1376, + examples: array1379, + deprecated: lifted1382, + role: lifted1385, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array1389 : Array[@types.SchemaTypeDef] = [] - for index1390 = 0 - index1390 < mbt_ffi_load32(iter_base + 48) - index1390 = index1390 + 1 { + let array1391 : Array[@types.SchemaTypeDef] = [] + for index1392 = 0 + index1392 < mbt_ffi_load32(iter_base + 48) + index1392 = index1392 + 1 { let iter_base = mbt_ffi_load32(iter_base + 44) + - index1390 * 24 + index1392 * 24 - let result1386 = mbt_ffi_ptr2str( + let result1388 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1388 : String? = match + let lifted1390 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1387 = mbt_ffi_ptr2str( + let result1389 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1387) + Option::Some(result1389) } _ => panic() } - array1389.push(@types.SchemaTypeDef::{ - id: result1386, - name: lifted1388, + array1391.push(@types.SchemaTypeDef::{ + id: result1388, + name: lifted1390, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 44)) - let array1420 : Array[@types.SchemaValueNode] = [] - for index1421 = 0 - index1421 < mbt_ffi_load32(iter_base + 60) - index1421 = index1421 + 1 { + let array1422 : Array[@types.SchemaValueNode] = [] + for index1423 = 0 + index1423 < mbt_ffi_load32(iter_base + 60) + index1423 = index1423 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1421 * 32 + index1423 * 32 - let lifted1419 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1421 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -13220,29 +13246,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result1391 = mbt_ffi_ptr2str( + let result1393 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result1391) + @types.SchemaValueNode::StringValue(result1393) } 13 => { - let array1392 : Array[Int] = [] - for index1393 = 0 - index1393 < mbt_ffi_load32(iter_base + 12) - index1393 = index1393 + 1 { + let array1394 : Array[Int] = [] + for index1395 = 0 + index1395 < mbt_ffi_load32(iter_base + 12) + index1395 = index1395 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1393 * 4 + index1395 * 4 - array1392.push(mbt_ffi_load32(iter_base + 0)) + array1394.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array1392) + @types.SchemaValueNode::RecordValue(array1394) } 14 => { - let lifted1394 : Int? = match + let lifted1396 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -13251,7 +13277,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted1394, + payload: lifted1396, }) } 15 => @@ -13259,34 +13285,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array1395 : Array[Bool] = [] - for index1396 = 0 - index1396 < mbt_ffi_load32(iter_base + 12) - index1396 = index1396 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index1396 * 1 - - array1395.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array1395) - } - 17 => { - let array1397 : Array[Int] = [] + let array1397 : Array[Bool] = [] for index1398 = 0 index1398 < mbt_ffi_load32(iter_base + 12) index1398 = index1398 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1398 * 4 + index1398 * 1 - array1397.push(mbt_ffi_load32(iter_base + 0)) + array1397.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array1397) + @types.SchemaValueNode::FlagsValue(array1397) } - 18 => { + 17 => { let array1399 : Array[Int] = [] for index1400 = 0 index1400 < mbt_ffi_load32(iter_base + 12) @@ -13298,9 +13310,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array1399) + @types.SchemaValueNode::TupleValue(array1399) } - 19 => { + 18 => { let array1401 : Array[Int] = [] for index1402 = 0 index1402 < mbt_ffi_load32(iter_base + 12) @@ -13312,127 +13324,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array1401) + @types.SchemaValueNode::ListValue(array1401) } - 20 => { - let array1403 : Array[@types.MapEntry] = [] + 19 => { + let array1403 : Array[Int] = [] for index1404 = 0 index1404 < mbt_ffi_load32(iter_base + 12) index1404 = index1404 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1404 * 8 + index1404 * 4 + + array1403.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array1403) + } + 20 => { + let array1405 : Array[@types.MapEntry] = [] + for index1406 = 0 + index1406 < mbt_ffi_load32(iter_base + 12) + index1406 = index1406 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index1406 * 8 - array1403.push(@types.MapEntry::{ + array1405.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array1403) + @types.SchemaValueNode::MapValue(array1405) } 21 => { - let lifted1405 : Int? = match + let lifted1407 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted1405) + @types.SchemaValueNode::OptionValue(lifted1407) } 22 => { - let lifted1408 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted1410 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted1406 : Int? = match + let lifted1408 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted1406) + @types.ResultValuePayload::OkValue(lifted1408) } 1 => { - let lifted1407 : Int? = match + let lifted1409 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted1407) + @types.ResultValuePayload::ErrValue(lifted1409) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted1408) + @types.SchemaValueNode::ResultValue(lifted1410) } 23 => { - let result1409 = mbt_ffi_ptr2str( + let result1411 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1411 : String? = match + let lifted1413 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1410 = mbt_ffi_ptr2str( + let result1412 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1410) + Option::Some(result1412) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result1409, - language: lifted1411, + text: result1411, + language: lifted1413, }) } 24 => { - let result1412 = mbt_ffi_ptr2bytes( + let result1414 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1414 : String? = match + let lifted1416 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1413 = mbt_ffi_ptr2str( + let result1415 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1413) + Option::Some(result1415) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result1412, - mime_type: lifted1414, + bytes: result1414, + mime_type: lifted1416, }) } 25 => { - let result1415 = mbt_ffi_ptr2str( + let result1417 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result1415) + @types.SchemaValueNode::PathValue(result1417) } 26 => { - let result1416 = mbt_ffi_ptr2str( + let result1418 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result1416) + @types.SchemaValueNode::UrlValue(result1418) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -13444,7 +13470,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result1417 = mbt_ffi_ptr2str( + let result1419 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -13452,17 +13478,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result1417, + unit: result1419, }) } 30 => { - let result1418 = mbt_ffi_ptr2str( + let result1420 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result1418, + tag: result1420, body: mbt_ffi_load32(iter_base + 16), }) } @@ -13476,21 +13502,27 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array1420.push(lifted1419) + array1422.push(lifted1421) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) Option::Some(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array1384, - defs: array1389, + type_nodes: array1386, + defs: array1391, root: mbt_ffi_load32(iter_base + 52), }, value: @types.SchemaValueTree::{ - value_nodes: array1420, + value_nodes: array1422, root: mbt_ffi_load32(iter_base + 64), }, }) @@ -13504,40 +13536,40 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, start_index: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - partial: lifted1422, + partial: lifted1424, }) } 4 => { - let lifted1935 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted1937 = match mbt_ffi_load8_u(iter_base + 24) { 0 => { - let result1423 = mbt_ffi_ptr2str( + let result1425 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let array1620 : Array[@types.SchemaTypeNode] = [] - for index1621 = 0 - index1621 < mbt_ffi_load32(iter_base + 44) - index1621 = index1621 + 1 { + let array1622 : Array[@types.SchemaTypeNode] = [] + for index1623 = 0 + index1623 < mbt_ffi_load32(iter_base + 44) + index1623 = index1623 + 1 { let iter_base = mbt_ffi_load32(iter_base + 40) + - index1621 * 144 + index1623 * 144 - let lifted1606 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1608 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted1430 : @types.NumericRestrictions? = match + let lifted1432 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1425 : @types.NumericBound? = match + let lifted1427 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1424 = match + let lifted1426 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13554,16 +13586,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1424) + Option::Some(lifted1426) } _ => panic() } - let lifted1427 : @types.NumericBound? = match + let lifted1429 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1426 = match + let lifted1428 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13580,46 +13612,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1426) + Option::Some(lifted1428) } _ => panic() } - let lifted1429 : String? = match + let lifted1431 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1428 = mbt_ffi_ptr2str( + let result1430 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1428) + Option::Some(result1430) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1425, - max: lifted1427, - unit: lifted1429, + min: lifted1427, + max: lifted1429, + unit: lifted1431, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted1430) + @types.SchemaTypeBody::S8Type(lifted1432) } 3 => { - let lifted1437 : @types.NumericRestrictions? = match + let lifted1439 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1432 : @types.NumericBound? = match + let lifted1434 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1431 = match + let lifted1433 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13636,16 +13668,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1431) + Option::Some(lifted1433) } _ => panic() } - let lifted1434 : @types.NumericBound? = match + let lifted1436 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1433 = match + let lifted1435 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13662,46 +13694,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1433) + Option::Some(lifted1435) } _ => panic() } - let lifted1436 : String? = match + let lifted1438 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1435 = mbt_ffi_ptr2str( + let result1437 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1435) + Option::Some(result1437) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1432, - max: lifted1434, - unit: lifted1436, + min: lifted1434, + max: lifted1436, + unit: lifted1438, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted1437) + @types.SchemaTypeBody::S16Type(lifted1439) } 4 => { - let lifted1444 : @types.NumericRestrictions? = match + let lifted1446 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1439 : @types.NumericBound? = match + let lifted1441 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1438 = match + let lifted1440 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13718,16 +13750,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1438) + Option::Some(lifted1440) } _ => panic() } - let lifted1441 : @types.NumericBound? = match + let lifted1443 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1440 = match + let lifted1442 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13744,46 +13776,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1440) + Option::Some(lifted1442) } _ => panic() } - let lifted1443 : String? = match + let lifted1445 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1442 = mbt_ffi_ptr2str( + let result1444 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1442) + Option::Some(result1444) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1439, - max: lifted1441, - unit: lifted1443, + min: lifted1441, + max: lifted1443, + unit: lifted1445, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted1444) + @types.SchemaTypeBody::S32Type(lifted1446) } 5 => { - let lifted1451 : @types.NumericRestrictions? = match + let lifted1453 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1446 : @types.NumericBound? = match + let lifted1448 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1445 = match + let lifted1447 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13800,16 +13832,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1445) + Option::Some(lifted1447) } _ => panic() } - let lifted1448 : @types.NumericBound? = match + let lifted1450 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1447 = match + let lifted1449 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13826,46 +13858,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1447) + Option::Some(lifted1449) } _ => panic() } - let lifted1450 : String? = match + let lifted1452 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1449 = mbt_ffi_ptr2str( + let result1451 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1449) + Option::Some(result1451) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1446, - max: lifted1448, - unit: lifted1450, + min: lifted1448, + max: lifted1450, + unit: lifted1452, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted1451) + @types.SchemaTypeBody::S64Type(lifted1453) } 6 => { - let lifted1458 : @types.NumericRestrictions? = match + let lifted1460 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1453 : @types.NumericBound? = match + let lifted1455 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1452 = match + let lifted1454 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13882,16 +13914,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1452) + Option::Some(lifted1454) } _ => panic() } - let lifted1455 : @types.NumericBound? = match + let lifted1457 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1454 = match + let lifted1456 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13908,46 +13940,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1454) + Option::Some(lifted1456) } _ => panic() } - let lifted1457 : String? = match + let lifted1459 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1456 = mbt_ffi_ptr2str( + let result1458 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1456) + Option::Some(result1458) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1453, - max: lifted1455, - unit: lifted1457, + min: lifted1455, + max: lifted1457, + unit: lifted1459, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted1458) + @types.SchemaTypeBody::U8Type(lifted1460) } 7 => { - let lifted1465 : @types.NumericRestrictions? = match + let lifted1467 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1460 : @types.NumericBound? = match + let lifted1462 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1459 = match + let lifted1461 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13964,16 +13996,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1459) + Option::Some(lifted1461) } _ => panic() } - let lifted1462 : @types.NumericBound? = match + let lifted1464 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1461 = match + let lifted1463 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13990,46 +14022,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1461) + Option::Some(lifted1463) } _ => panic() } - let lifted1464 : String? = match + let lifted1466 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1463 = mbt_ffi_ptr2str( + let result1465 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1463) + Option::Some(result1465) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1460, - max: lifted1462, - unit: lifted1464, + min: lifted1462, + max: lifted1464, + unit: lifted1466, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted1465) + @types.SchemaTypeBody::U16Type(lifted1467) } 8 => { - let lifted1472 : @types.NumericRestrictions? = match + let lifted1474 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1467 : @types.NumericBound? = match + let lifted1469 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1466 = match + let lifted1468 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -14046,16 +14078,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1466) + Option::Some(lifted1468) } _ => panic() } - let lifted1469 : @types.NumericBound? = match + let lifted1471 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1468 = match + let lifted1470 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14072,46 +14104,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1468) + Option::Some(lifted1470) } _ => panic() } - let lifted1471 : String? = match + let lifted1473 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1470 = mbt_ffi_ptr2str( + let result1472 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1470) + Option::Some(result1472) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1467, - max: lifted1469, - unit: lifted1471, + min: lifted1469, + max: lifted1471, + unit: lifted1473, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1472) + @types.SchemaTypeBody::U32Type(lifted1474) } 9 => { - let lifted1479 : @types.NumericRestrictions? = match + let lifted1481 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1474 : @types.NumericBound? = match + let lifted1476 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1473 = match + let lifted1475 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -14128,16 +14160,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1473) + Option::Some(lifted1475) } _ => panic() } - let lifted1476 : @types.NumericBound? = match + let lifted1478 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1475 = match + let lifted1477 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14154,46 +14186,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1475) + Option::Some(lifted1477) } _ => panic() } - let lifted1478 : String? = match + let lifted1480 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1477 = mbt_ffi_ptr2str( + let result1479 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1477) + Option::Some(result1479) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1474, - max: lifted1476, - unit: lifted1478, + min: lifted1476, + max: lifted1478, + unit: lifted1480, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1479) + @types.SchemaTypeBody::U64Type(lifted1481) } 10 => { - let lifted1486 : @types.NumericRestrictions? = match + let lifted1488 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1481 : @types.NumericBound? = match + let lifted1483 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1480 = match + let lifted1482 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -14210,16 +14242,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1480) + Option::Some(lifted1482) } _ => panic() } - let lifted1483 : @types.NumericBound? = match + let lifted1485 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1482 = match + let lifted1484 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14236,46 +14268,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1482) + Option::Some(lifted1484) } _ => panic() } - let lifted1485 : String? = match + let lifted1487 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1484 = mbt_ffi_ptr2str( + let result1486 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1484) + Option::Some(result1486) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1481, - max: lifted1483, - unit: lifted1485, + min: lifted1483, + max: lifted1485, + unit: lifted1487, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1486) + @types.SchemaTypeBody::F32Type(lifted1488) } 11 => { - let lifted1493 : @types.NumericRestrictions? = match + let lifted1495 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1488 : @types.NumericBound? = match + let lifted1490 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1487 = match + let lifted1489 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -14292,16 +14324,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1487) + Option::Some(lifted1489) } _ => panic() } - let lifted1490 : @types.NumericBound? = match + let lifted1492 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1489 = match + let lifted1491 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14318,324 +14350,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1489) + Option::Some(lifted1491) } _ => panic() } - let lifted1492 : String? = match + let lifted1494 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1491 = mbt_ffi_ptr2str( + let result1493 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1491) + Option::Some(result1493) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1488, - max: lifted1490, - unit: lifted1492, + min: lifted1490, + max: lifted1492, + unit: lifted1494, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted1493) + @types.SchemaTypeBody::F64Type(lifted1495) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array1508 : Array[@types.NamedFieldType] = [] - for index1509 = 0 - index1509 < mbt_ffi_load32(iter_base + 12) - index1509 = index1509 + 1 { + let array1510 : Array[@types.NamedFieldType] = [] + for index1511 = 0 + index1511 < mbt_ffi_load32(iter_base + 12) + index1511 = index1511 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1509 * 68 + index1511 * 68 - let result1494 = mbt_ffi_ptr2str( + let result1496 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1496 : String? = match + let lifted1498 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1495 = mbt_ffi_ptr2str( + let result1497 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1495) + Option::Some(result1497) } _ => panic() } - let array1498 : Array[String] = [] - for index1499 = 0 - index1499 < mbt_ffi_load32(iter_base + 28) - index1499 = index1499 + 1 { + let array1500 : Array[String] = [] + for index1501 = 0 + index1501 < mbt_ffi_load32(iter_base + 28) + index1501 = index1501 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1499 * 8 + index1501 * 8 - let result1497 = mbt_ffi_ptr2str( + let result1499 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1498.push(result1497) + array1500.push(result1499) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array1501 : Array[String] = [] - for index1502 = 0 - index1502 < mbt_ffi_load32(iter_base + 36) - index1502 = index1502 + 1 { + let array1503 : Array[String] = [] + for index1504 = 0 + index1504 < mbt_ffi_load32(iter_base + 36) + index1504 = index1504 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index1502 * 8 + index1504 * 8 - let result1500 = mbt_ffi_ptr2str( + let result1502 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1501.push(result1500) + array1503.push(result1502) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted1504 : String? = match + let lifted1506 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result1503 = mbt_ffi_ptr2str( + let result1505 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result1503) + Option::Some(result1505) } _ => panic() } - let lifted1507 : @types.Role? = match + let lifted1509 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted1506 = match + let lifted1508 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1505 = mbt_ffi_ptr2str( + let result1507 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result1505) + @types.Role::Other(result1507) } _ => panic() } - Option::Some(lifted1506) + Option::Some(lifted1508) } _ => panic() } - array1508.push(@types.NamedFieldType::{ - name: result1494, + array1510.push(@types.NamedFieldType::{ + name: result1496, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted1496, - aliases: array1498, - examples: array1501, - deprecated: lifted1504, - role: lifted1507, + doc: lifted1498, + aliases: array1500, + examples: array1503, + deprecated: lifted1506, + role: lifted1509, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array1508) + @types.SchemaTypeBody::RecordType(array1510) } 15 => { - let array1525 : Array[@types.VariantCaseType] = [] - for index1526 = 0 - index1526 < mbt_ffi_load32(iter_base + 12) - index1526 = index1526 + 1 { + let array1527 : Array[@types.VariantCaseType] = [] + for index1528 = 0 + index1528 < mbt_ffi_load32(iter_base + 12) + index1528 = index1528 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1526 * 72 + index1528 * 72 - let result1510 = mbt_ffi_ptr2str( + let result1512 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1511 : Int? = match + let lifted1513 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1513 : String? = match + let lifted1515 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1512 = mbt_ffi_ptr2str( + let result1514 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1512) + Option::Some(result1514) } _ => panic() } - let array1515 : Array[String] = [] - for index1516 = 0 - index1516 < mbt_ffi_load32(iter_base + 32) - index1516 = index1516 + 1 { + let array1517 : Array[String] = [] + for index1518 = 0 + index1518 < mbt_ffi_load32(iter_base + 32) + index1518 = index1518 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1516 * 8 + index1518 * 8 - let result1514 = mbt_ffi_ptr2str( + let result1516 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1515.push(result1514) + array1517.push(result1516) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array1518 : Array[String] = [] - for index1519 = 0 - index1519 < mbt_ffi_load32(iter_base + 40) - index1519 = index1519 + 1 { + let array1520 : Array[String] = [] + for index1521 = 0 + index1521 < mbt_ffi_load32(iter_base + 40) + index1521 = index1521 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1519 * 8 + index1521 * 8 - let result1517 = mbt_ffi_ptr2str( + let result1519 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1518.push(result1517) + array1520.push(result1519) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted1521 : String? = match + let lifted1523 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result1520 = mbt_ffi_ptr2str( + let result1522 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result1520) + Option::Some(result1522) } _ => panic() } - let lifted1524 : @types.Role? = match + let lifted1526 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted1523 = match + let lifted1525 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1522 = mbt_ffi_ptr2str( + let result1524 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result1522) + @types.Role::Other(result1524) } _ => panic() } - Option::Some(lifted1523) + Option::Some(lifted1525) } _ => panic() } - array1525.push(@types.VariantCaseType::{ - name: result1510, - payload: lifted1511, + array1527.push(@types.VariantCaseType::{ + name: result1512, + payload: lifted1513, metadata: @types.MetadataEnvelope::{ - doc: lifted1513, - aliases: array1515, - examples: array1518, - deprecated: lifted1521, - role: lifted1524, + doc: lifted1515, + aliases: array1517, + examples: array1520, + deprecated: lifted1523, + role: lifted1526, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array1525) + @types.SchemaTypeBody::VariantType(array1527) } 16 => { - let array1528 : Array[String] = [] - for index1529 = 0 - index1529 < mbt_ffi_load32(iter_base + 12) - index1529 = index1529 + 1 { + let array1530 : Array[String] = [] + for index1531 = 0 + index1531 < mbt_ffi_load32(iter_base + 12) + index1531 = index1531 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1529 * 8 + index1531 * 8 - let result1527 = mbt_ffi_ptr2str( + let result1529 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1528.push(result1527) + array1530.push(result1529) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array1528) + @types.SchemaTypeBody::EnumType(array1530) } 17 => { - let array1531 : Array[String] = [] - for index1532 = 0 - index1532 < mbt_ffi_load32(iter_base + 12) - index1532 = index1532 + 1 { + let array1533 : Array[String] = [] + for index1534 = 0 + index1534 < mbt_ffi_load32(iter_base + 12) + index1534 = index1534 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1532 * 8 + index1534 * 8 - let result1530 = mbt_ffi_ptr2str( + let result1532 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1531.push(result1530) + array1533.push(result1532) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array1531) + @types.SchemaTypeBody::FlagsType(array1533) } 18 => { - let array1533 : Array[Int] = [] - for index1534 = 0 - index1534 < mbt_ffi_load32(iter_base + 12) - index1534 = index1534 + 1 { + let array1535 : Array[Int] = [] + for index1536 = 0 + index1536 < mbt_ffi_load32(iter_base + 12) + index1536 = index1536 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1534 * 4 + index1536 * 4 - array1533.push(mbt_ffi_load32(iter_base + 0)) + array1535.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array1533) + @types.SchemaTypeBody::TupleType(array1535) } 19 => @types.SchemaTypeBody::ListType( @@ -14656,14 +14688,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted1535 : Int? = match + let lifted1537 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1536 : Int? = match + let lifted1538 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -14671,37 +14703,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted1535, - err: lifted1536, + ok: lifted1537, + err: lifted1538, }) } 24 => { - let lifted1540 : Array[String]? = match + let lifted1542 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1538 : Array[String] = [] - for index1539 = 0 - index1539 < mbt_ffi_load32(iter_base + 16) - index1539 = index1539 + 1 { + let array1540 : Array[String] = [] + for index1541 = 0 + index1541 < mbt_ffi_load32(iter_base + 16) + index1541 = index1541 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1539 * 8 + index1541 * 8 - let result1537 = mbt_ffi_ptr2str( + let result1539 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1538.push(result1537) + array1540.push(result1539) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1538) + Option::Some(array1540) } _ => panic() } - let lifted1541 : UInt? = match + let lifted1543 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -14711,7 +14743,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1542 : UInt? = match + let lifted1544 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -14721,54 +14753,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1544 : String? = match + let lifted1546 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1543 = mbt_ffi_ptr2str( + let result1545 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1543) + Option::Some(result1545) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted1540, - min_length: lifted1541, - max_length: lifted1542, - regex: lifted1544, + languages: lifted1542, + min_length: lifted1543, + max_length: lifted1544, + regex: lifted1546, }) } 25 => { - let lifted1548 : Array[String]? = match + let lifted1550 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1546 : Array[String] = [] - for index1547 = 0 - index1547 < mbt_ffi_load32(iter_base + 16) - index1547 = index1547 + 1 { + let array1548 : Array[String] = [] + for index1549 = 0 + index1549 < mbt_ffi_load32(iter_base + 16) + index1549 = index1549 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1547 * 8 + index1549 * 8 - let result1545 = mbt_ffi_ptr2str( + let result1547 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1546.push(result1545) + array1548.push(result1547) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1546) + Option::Some(array1548) } _ => panic() } - let lifted1549 : UInt? = match + let lifted1551 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -14778,7 +14810,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1550 : UInt? = match + let lifted1552 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -14789,58 +14821,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted1548, - min_bytes: lifted1549, - max_bytes: lifted1550, + mime_types: lifted1550, + min_bytes: lifted1551, + max_bytes: lifted1552, }) } 26 => { - let lifted1554 : Array[String]? = match + let lifted1556 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array1552 : Array[String] = [] - for index1553 = 0 - index1553 < mbt_ffi_load32(iter_base + 20) - index1553 = index1553 + 1 { + let array1554 : Array[String] = [] + for index1555 = 0 + index1555 < mbt_ffi_load32(iter_base + 20) + index1555 = index1555 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1553 * 8 + index1555 * 8 - let result1551 = mbt_ffi_ptr2str( + let result1553 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1552.push(result1551) + array1554.push(result1553) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array1552) + Option::Some(array1554) } _ => panic() } - let lifted1558 : Array[String]? = match + let lifted1560 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array1556 : Array[String] = [] - for index1557 = 0 - index1557 < mbt_ffi_load32(iter_base + 32) - index1557 = index1557 + 1 { + let array1558 : Array[String] = [] + for index1559 = 0 + index1559 < mbt_ffi_load32(iter_base + 32) + index1559 = index1559 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1557 * 8 + index1559 * 8 - let result1555 = mbt_ffi_ptr2str( + let result1557 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1556.push(result1555) + array1558.push(result1557) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array1556) + Option::Some(array1558) } _ => panic() } @@ -14852,95 +14884,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted1554, - allowed_extensions: lifted1558, + allowed_mime_types: lifted1556, + allowed_extensions: lifted1560, }) } 27 => { - let lifted1562 : Array[String]? = match + let lifted1564 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1560 : Array[String] = [] - for index1561 = 0 - index1561 < mbt_ffi_load32(iter_base + 16) - index1561 = index1561 + 1 { + let array1562 : Array[String] = [] + for index1563 = 0 + index1563 < mbt_ffi_load32(iter_base + 16) + index1563 = index1563 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1561 * 8 + index1563 * 8 - let result1559 = mbt_ffi_ptr2str( + let result1561 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1560.push(result1559) + array1562.push(result1561) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1560) + Option::Some(array1562) } _ => panic() } - let lifted1566 : Array[String]? = match + let lifted1568 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array1564 : Array[String] = [] - for index1565 = 0 - index1565 < mbt_ffi_load32(iter_base + 28) - index1565 = index1565 + 1 { + let array1566 : Array[String] = [] + for index1567 = 0 + index1567 < mbt_ffi_load32(iter_base + 28) + index1567 = index1567 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1565 * 8 + index1567 * 8 - let result1563 = mbt_ffi_ptr2str( + let result1565 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1564.push(result1563) + array1566.push(result1565) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array1564) + Option::Some(array1566) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted1562, - allowed_hosts: lifted1566, + allowed_schemes: lifted1564, + allowed_hosts: lifted1568, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result1567 = mbt_ffi_ptr2str( + let result1569 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array1569 : Array[String] = [] - for index1570 = 0 - index1570 < mbt_ffi_load32(iter_base + 20) - index1570 = index1570 + 1 { + let array1571 : Array[String] = [] + for index1572 = 0 + index1572 < mbt_ffi_load32(iter_base + 20) + index1572 = index1572 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1570 * 8 + index1572 * 8 - let result1568 = mbt_ffi_ptr2str( + let result1570 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1569.push(result1568) + array1571.push(result1570) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted1572 : @types.QuantityValue? = match + let lifted1574 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1571 = mbt_ffi_ptr2str( + let result1573 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -14948,17 +14980,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result1571, + unit: result1573, }) } _ => panic() } - let lifted1574 : @types.QuantityValue? = match + let lifted1576 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result1573 = mbt_ffi_ptr2str( + let result1575 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -14966,406 +14998,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result1573, + unit: result1575, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result1567, - allowed_suffixes: array1569, - min: lifted1572, - max: lifted1574, + base_unit: result1569, + allowed_suffixes: array1571, + min: lifted1574, + max: lifted1576, }) } 31 => { - let array1598 : Array[@types.UnionBranch] = [] - for index1599 = 0 - index1599 < mbt_ffi_load32(iter_base + 12) - index1599 = index1599 + 1 { + let array1600 : Array[@types.UnionBranch] = [] + for index1601 = 0 + index1601 < mbt_ffi_load32(iter_base + 12) + index1601 = index1601 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1599 * 92 + index1601 * 92 - let result1575 = mbt_ffi_ptr2str( + let result1577 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1584 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted1586 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result1576 = mbt_ffi_ptr2str( + let result1578 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result1576) + @types.DiscriminatorRule::Prefix(result1578) } 1 => { - let result1577 = mbt_ffi_ptr2str( + let result1579 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result1577) + @types.DiscriminatorRule::Suffix(result1579) } 2 => { - let result1578 = mbt_ffi_ptr2str( + let result1580 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result1578) + @types.DiscriminatorRule::Contains(result1580) } 3 => { - let result1579 = mbt_ffi_ptr2str( + let result1581 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result1579) + @types.DiscriminatorRule::Regex(result1581) } 4 => { - let result1580 = mbt_ffi_ptr2str( + let result1582 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted1582 : String? = match + let lifted1584 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1581 = mbt_ffi_ptr2str( + let result1583 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result1581) + Option::Some(result1583) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result1580, - literal: lifted1582, + field_name: result1582, + literal: lifted1584, }) } 5 => { - let result1583 = mbt_ffi_ptr2str( + let result1585 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result1583) + @types.DiscriminatorRule::FieldAbsent(result1585) } _ => panic() } - let lifted1586 : String? = match + let lifted1588 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1585 = mbt_ffi_ptr2str( + let result1587 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1585) + Option::Some(result1587) } _ => panic() } - let array1588 : Array[String] = [] - for index1589 = 0 - index1589 < mbt_ffi_load32(iter_base + 52) - index1589 = index1589 + 1 { + let array1590 : Array[String] = [] + for index1591 = 0 + index1591 < mbt_ffi_load32(iter_base + 52) + index1591 = index1591 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1589 * 8 + index1591 * 8 - let result1587 = mbt_ffi_ptr2str( + let result1589 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1588.push(result1587) + array1590.push(result1589) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1591 : Array[String] = [] - for index1592 = 0 - index1592 < mbt_ffi_load32(iter_base + 60) - index1592 = index1592 + 1 { + let array1593 : Array[String] = [] + for index1594 = 0 + index1594 < mbt_ffi_load32(iter_base + 60) + index1594 = index1594 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1592 * 8 + index1594 * 8 - let result1590 = mbt_ffi_ptr2str( + let result1592 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1591.push(result1590) + array1593.push(result1592) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted1594 : String? = match + let lifted1596 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1593 = mbt_ffi_ptr2str( + let result1595 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1593) + Option::Some(result1595) } _ => panic() } - let lifted1597 : @types.Role? = match + let lifted1599 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted1596 = match + let lifted1598 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1595 = mbt_ffi_ptr2str( + let result1597 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result1595) + @types.Role::Other(result1597) } _ => panic() } - Option::Some(lifted1596) + Option::Some(lifted1598) } _ => panic() } - array1598.push(@types.UnionBranch::{ - tag: result1575, + array1600.push(@types.UnionBranch::{ + tag: result1577, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted1584, + discriminator: lifted1586, metadata: @types.MetadataEnvelope::{ - doc: lifted1586, - aliases: array1588, - examples: array1591, - deprecated: lifted1594, - role: lifted1597, + doc: lifted1588, + aliases: array1590, + examples: array1593, + deprecated: lifted1596, + role: lifted1599, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array1598, + branches: array1600, }) } 32 => { - let lifted1601 : String? = match + let lifted1603 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1600 = mbt_ffi_ptr2str( + let result1602 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1600) + Option::Some(result1602) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted1601, + category: lifted1603, }) } 33 => { - let lifted1603 : String? = match + let lifted1605 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1602 = mbt_ffi_ptr2str( + let result1604 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1602) + Option::Some(result1604) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted1603, + resource_name: lifted1605, }) } 34 => { - let lifted1604 : Int? = match + let lifted1606 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted1604) + @types.SchemaTypeBody::FutureType(lifted1606) } 35 => { - let lifted1605 : Int? = match + let lifted1607 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted1605) + @types.SchemaTypeBody::StreamType(lifted1607) } _ => panic() } - let lifted1608 : String? = match + let lifted1610 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result1607 = mbt_ffi_ptr2str( + let result1609 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result1607) + Option::Some(result1609) } _ => panic() } - let array1610 : Array[String] = [] - for index1611 = 0 - index1611 < mbt_ffi_load32(iter_base + 104) - index1611 = index1611 + 1 { + let array1612 : Array[String] = [] + for index1613 = 0 + index1613 < mbt_ffi_load32(iter_base + 104) + index1613 = index1613 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index1611 * 8 + index1613 * 8 - let result1609 = mbt_ffi_ptr2str( + let result1611 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1610.push(result1609) + array1612.push(result1611) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array1613 : Array[String] = [] - for index1614 = 0 - index1614 < mbt_ffi_load32(iter_base + 112) - index1614 = index1614 + 1 { + let array1615 : Array[String] = [] + for index1616 = 0 + index1616 < mbt_ffi_load32(iter_base + 112) + index1616 = index1616 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index1614 * 8 + index1616 * 8 - let result1612 = mbt_ffi_ptr2str( + let result1614 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1613.push(result1612) + array1615.push(result1614) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted1616 : String? = match + let lifted1618 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result1615 = mbt_ffi_ptr2str( + let result1617 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result1615) + Option::Some(result1617) } _ => panic() } - let lifted1619 : @types.Role? = match + let lifted1621 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted1618 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted1620 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1617 = mbt_ffi_ptr2str( + let result1619 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result1617) + @types.Role::Other(result1619) } _ => panic() } - Option::Some(lifted1618) + Option::Some(lifted1620) } _ => panic() } - array1620.push(@types.SchemaTypeNode::{ - body: lifted1606, + array1622.push(@types.SchemaTypeNode::{ + body: lifted1608, metadata: @types.MetadataEnvelope::{ - doc: lifted1608, - aliases: array1610, - examples: array1613, - deprecated: lifted1616, - role: lifted1619, + doc: lifted1610, + aliases: array1612, + examples: array1615, + deprecated: lifted1618, + role: lifted1621, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 40)) - let array1625 : Array[@types.SchemaTypeDef] = [] - for index1626 = 0 - index1626 < mbt_ffi_load32(iter_base + 52) - index1626 = index1626 + 1 { + let array1627 : Array[@types.SchemaTypeDef] = [] + for index1628 = 0 + index1628 < mbt_ffi_load32(iter_base + 52) + index1628 = index1628 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1626 * 24 + index1628 * 24 - let result1622 = mbt_ffi_ptr2str( + let result1624 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1624 : String? = match + let lifted1626 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1623 = mbt_ffi_ptr2str( + let result1625 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1623) + Option::Some(result1625) } _ => panic() } - array1625.push(@types.SchemaTypeDef::{ - id: result1622, - name: lifted1624, + array1627.push(@types.SchemaTypeDef::{ + id: result1624, + name: lifted1626, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1656 : Array[@types.SchemaValueNode] = [] - for index1657 = 0 - index1657 < mbt_ffi_load32(iter_base + 64) - index1657 = index1657 + 1 { + let array1658 : Array[@types.SchemaValueNode] = [] + for index1659 = 0 + index1659 < mbt_ffi_load32(iter_base + 64) + index1659 = index1659 + 1 { let iter_base = mbt_ffi_load32(iter_base + 60) + - index1657 * 32 + index1659 * 32 - let lifted1655 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1657 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -15417,29 +15449,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result1627 = mbt_ffi_ptr2str( + let result1629 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result1627) + @types.SchemaValueNode::StringValue(result1629) } 13 => { - let array1628 : Array[Int] = [] - for index1629 = 0 - index1629 < mbt_ffi_load32(iter_base + 12) - index1629 = index1629 + 1 { + let array1630 : Array[Int] = [] + for index1631 = 0 + index1631 < mbt_ffi_load32(iter_base + 12) + index1631 = index1631 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1629 * 4 + index1631 * 4 - array1628.push(mbt_ffi_load32(iter_base + 0)) + array1630.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array1628) + @types.SchemaValueNode::RecordValue(array1630) } 14 => { - let lifted1630 : Int? = match + let lifted1632 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -15448,7 +15480,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted1630, + payload: lifted1632, }) } 15 => @@ -15456,34 +15488,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array1631 : Array[Bool] = [] - for index1632 = 0 - index1632 < mbt_ffi_load32(iter_base + 12) - index1632 = index1632 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index1632 * 1 - - array1631.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array1631) - } - 17 => { - let array1633 : Array[Int] = [] + let array1633 : Array[Bool] = [] for index1634 = 0 index1634 < mbt_ffi_load32(iter_base + 12) index1634 = index1634 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1634 * 4 + index1634 * 1 - array1633.push(mbt_ffi_load32(iter_base + 0)) + array1633.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array1633) + @types.SchemaValueNode::FlagsValue(array1633) } - 18 => { + 17 => { let array1635 : Array[Int] = [] for index1636 = 0 index1636 < mbt_ffi_load32(iter_base + 12) @@ -15495,9 +15513,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array1635) + @types.SchemaValueNode::TupleValue(array1635) } - 19 => { + 18 => { let array1637 : Array[Int] = [] for index1638 = 0 index1638 < mbt_ffi_load32(iter_base + 12) @@ -15509,127 +15527,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array1637) + @types.SchemaValueNode::ListValue(array1637) } - 20 => { - let array1639 : Array[@types.MapEntry] = [] + 19 => { + let array1639 : Array[Int] = [] for index1640 = 0 index1640 < mbt_ffi_load32(iter_base + 12) index1640 = index1640 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1640 * 8 + index1640 * 4 + + array1639.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array1639) + } + 20 => { + let array1641 : Array[@types.MapEntry] = [] + for index1642 = 0 + index1642 < mbt_ffi_load32(iter_base + 12) + index1642 = index1642 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index1642 * 8 - array1639.push(@types.MapEntry::{ + array1641.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array1639) + @types.SchemaValueNode::MapValue(array1641) } 21 => { - let lifted1641 : Int? = match + let lifted1643 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted1641) + @types.SchemaValueNode::OptionValue(lifted1643) } 22 => { - let lifted1644 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted1646 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted1642 : Int? = match + let lifted1644 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted1642) + @types.ResultValuePayload::OkValue(lifted1644) } 1 => { - let lifted1643 : Int? = match + let lifted1645 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted1643) + @types.ResultValuePayload::ErrValue(lifted1645) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted1644) + @types.SchemaValueNode::ResultValue(lifted1646) } 23 => { - let result1645 = mbt_ffi_ptr2str( + let result1647 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1647 : String? = match + let lifted1649 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1646 = mbt_ffi_ptr2str( + let result1648 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1646) + Option::Some(result1648) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result1645, - language: lifted1647, + text: result1647, + language: lifted1649, }) } 24 => { - let result1648 = mbt_ffi_ptr2bytes( + let result1650 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1650 : String? = match + let lifted1652 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1649 = mbt_ffi_ptr2str( + let result1651 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1649) + Option::Some(result1651) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result1648, - mime_type: lifted1650, + bytes: result1650, + mime_type: lifted1652, }) } 25 => { - let result1651 = mbt_ffi_ptr2str( + let result1653 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result1651) + @types.SchemaValueNode::PathValue(result1653) } 26 => { - let result1652 = mbt_ffi_ptr2str( + let result1654 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result1652) + @types.SchemaValueNode::UrlValue(result1654) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -15641,7 +15673,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result1653 = mbt_ffi_ptr2str( + let result1655 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -15649,17 +15681,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result1653, + unit: result1655, }) } 30 => { - let result1654 = mbt_ffi_ptr2str( + let result1656 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result1654, + tag: result1656, body: mbt_ffi_load32(iter_base + 16), }) } @@ -15673,68 +15705,74 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array1656.push(lifted1655) + array1658.push(lifted1657) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) - let result1658 = mbt_ffi_ptr2str( + let result1660 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 72), mbt_ffi_load32(iter_base + 76), ) - let array1660 : Array[String] = [] - for index1661 = 0 - index1661 < mbt_ffi_load32(iter_base + 84) - index1661 = index1661 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 80) + index1661 * 8 + let array1662 : Array[String] = [] + for index1663 = 0 + index1663 < mbt_ffi_load32(iter_base + 84) + index1663 = index1663 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 80) + index1663 * 8 - let result1659 = mbt_ffi_ptr2str( + let result1661 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1660.push(result1659) + array1662.push(result1661) } mbt_ffi_free(mbt_ffi_load32(iter_base + 80)) - let array1675 : Array[Array[SpanData]] = [] - for index1676 = 0 - index1676 < mbt_ffi_load32(iter_base + 92) - index1676 = index1676 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 88) + index1676 * 8 + let array1677 : Array[Array[SpanData]] = [] + for index1678 = 0 + index1678 < mbt_ffi_load32(iter_base + 92) + index1678 = index1678 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 88) + index1678 * 8 - let array1673 : Array[SpanData] = [] - for index1674 = 0 - index1674 < mbt_ffi_load32(iter_base + 4) - index1674 = index1674 + 1 { + let array1675 : Array[SpanData] = [] + for index1676 = 0 + index1676 < mbt_ffi_load32(iter_base + 4) + index1676 = index1676 + 1 { let iter_base = mbt_ffi_load32(iter_base + 0) + - index1674 * 80 + index1676 * 80 - let lifted1672 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1674 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result1662 = mbt_ffi_ptr2str( + let result1664 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1664 : String? = match + let lifted1666 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result1663 = mbt_ffi_ptr2str( + let result1665 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result1663) + Option::Some(result1665) } _ => panic() } - let lifted1665 : UInt64? = match + let lifted1667 : UInt64? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -15744,123 +15782,123 @@ pub fn enrich_oplog_entries( _ => panic() } - let array1669 : Array[@context.Attribute] = [] - for index1670 = 0 - index1670 < mbt_ffi_load32(iter_base + 68) - index1670 = index1670 + 1 { + let array1671 : Array[@context.Attribute] = [] + for index1672 = 0 + index1672 < mbt_ffi_load32(iter_base + 68) + index1672 = index1672 + 1 { let iter_base = mbt_ffi_load32(iter_base + 64) + - index1670 * 20 + index1672 * 20 - let result1666 = mbt_ffi_ptr2str( + let result1668 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1668 = match + let lifted1670 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result1667 = mbt_ffi_ptr2str( + let result1669 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result1667) + @context.AttributeValue::String(result1669) } _ => panic() } - array1669.push(@context.Attribute::{ - key: result1666, - value: lifted1668, + array1671.push(@context.Attribute::{ + key: result1668, + value: lifted1670, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) SpanData::LocalSpan(LocalSpanData::{ - span_id: result1662, + span_id: result1664, start: @system-clock.Instant::{ seconds: mbt_ffi_load64(iter_base + 16), nanoseconds: mbt_ffi_load32(iter_base + 24).reinterpret_as_uint(), }, - parent: lifted1664, - linked_context: lifted1665, - attributes: array1669, + parent: lifted1666, + linked_context: lifted1667, + attributes: array1671, inherited: mbt_ffi_load8_u(iter_base + 72) != 0, }) } 1 => { - let result1671 = mbt_ffi_ptr2str( + let result1673 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) SpanData::ExternalSpan(ExternalSpanData::{ - span_id: result1671, + span_id: result1673, }) } _ => panic() } - array1673.push(lifted1672) + array1675.push(lifted1674) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - array1675.push(array1673) + array1677.push(array1675) } mbt_ffi_free(mbt_ffi_load32(iter_base + 88)) AgentInvocation::AgentInitialization(AgentInitializationParameters::{ - idempotency_key: result1423, + idempotency_key: result1425, constructor_parameters: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array1620, - defs: array1625, + type_nodes: array1622, + defs: array1627, root: mbt_ffi_load32(iter_base + 56), }, value: @types.SchemaValueTree::{ - value_nodes: array1656, + value_nodes: array1658, root: mbt_ffi_load32(iter_base + 68), }, }, - trace_id: result1658, - trace_states: array1660, - invocation_context: array1675, + trace_id: result1660, + trace_states: array1662, + invocation_context: array1677, }) } 1 => { - let result1677 = mbt_ffi_ptr2str( + let result1679 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result1678 = mbt_ffi_ptr2str( + let result1680 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - let array1875 : Array[@types.SchemaTypeNode] = [] - for index1876 = 0 - index1876 < mbt_ffi_load32(iter_base + 52) - index1876 = index1876 + 1 { + let array1877 : Array[@types.SchemaTypeNode] = [] + for index1878 = 0 + index1878 < mbt_ffi_load32(iter_base + 52) + index1878 = index1878 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1876 * 144 + index1878 * 144 - let lifted1861 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1863 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted1685 : @types.NumericRestrictions? = match + let lifted1687 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1680 : @types.NumericBound? = match + let lifted1682 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1679 = match + let lifted1681 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -15877,16 +15915,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1679) + Option::Some(lifted1681) } _ => panic() } - let lifted1682 : @types.NumericBound? = match + let lifted1684 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1681 = match + let lifted1683 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -15903,46 +15941,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1681) + Option::Some(lifted1683) } _ => panic() } - let lifted1684 : String? = match + let lifted1686 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1683 = mbt_ffi_ptr2str( + let result1685 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1683) + Option::Some(result1685) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1680, - max: lifted1682, - unit: lifted1684, + min: lifted1682, + max: lifted1684, + unit: lifted1686, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted1685) + @types.SchemaTypeBody::S8Type(lifted1687) } 3 => { - let lifted1692 : @types.NumericRestrictions? = match + let lifted1694 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1687 : @types.NumericBound? = match + let lifted1689 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1686 = match + let lifted1688 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -15959,16 +15997,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1686) + Option::Some(lifted1688) } _ => panic() } - let lifted1689 : @types.NumericBound? = match + let lifted1691 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1688 = match + let lifted1690 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -15985,46 +16023,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1688) + Option::Some(lifted1690) } _ => panic() } - let lifted1691 : String? = match + let lifted1693 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1690 = mbt_ffi_ptr2str( + let result1692 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1690) + Option::Some(result1692) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1687, - max: lifted1689, - unit: lifted1691, + min: lifted1689, + max: lifted1691, + unit: lifted1693, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted1692) + @types.SchemaTypeBody::S16Type(lifted1694) } 4 => { - let lifted1699 : @types.NumericRestrictions? = match + let lifted1701 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1694 : @types.NumericBound? = match + let lifted1696 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1693 = match + let lifted1695 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16041,16 +16079,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1693) + Option::Some(lifted1695) } _ => panic() } - let lifted1696 : @types.NumericBound? = match + let lifted1698 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1695 = match + let lifted1697 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16067,46 +16105,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1695) + Option::Some(lifted1697) } _ => panic() } - let lifted1698 : String? = match + let lifted1700 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1697 = mbt_ffi_ptr2str( + let result1699 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1697) + Option::Some(result1699) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1694, - max: lifted1696, - unit: lifted1698, + min: lifted1696, + max: lifted1698, + unit: lifted1700, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted1699) + @types.SchemaTypeBody::S32Type(lifted1701) } 5 => { - let lifted1706 : @types.NumericRestrictions? = match + let lifted1708 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1701 : @types.NumericBound? = match + let lifted1703 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1700 = match + let lifted1702 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16123,16 +16161,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1700) + Option::Some(lifted1702) } _ => panic() } - let lifted1703 : @types.NumericBound? = match + let lifted1705 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1702 = match + let lifted1704 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16149,46 +16187,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1702) + Option::Some(lifted1704) } _ => panic() } - let lifted1705 : String? = match + let lifted1707 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1704 = mbt_ffi_ptr2str( + let result1706 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1704) + Option::Some(result1706) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1701, - max: lifted1703, - unit: lifted1705, + min: lifted1703, + max: lifted1705, + unit: lifted1707, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted1706) + @types.SchemaTypeBody::S64Type(lifted1708) } 6 => { - let lifted1713 : @types.NumericRestrictions? = match + let lifted1715 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1708 : @types.NumericBound? = match + let lifted1710 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1707 = match + let lifted1709 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16205,16 +16243,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1707) + Option::Some(lifted1709) } _ => panic() } - let lifted1710 : @types.NumericBound? = match + let lifted1712 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1709 = match + let lifted1711 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16231,46 +16269,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1709) + Option::Some(lifted1711) } _ => panic() } - let lifted1712 : String? = match + let lifted1714 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1711 = mbt_ffi_ptr2str( + let result1713 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1711) + Option::Some(result1713) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1708, - max: lifted1710, - unit: lifted1712, + min: lifted1710, + max: lifted1712, + unit: lifted1714, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted1713) + @types.SchemaTypeBody::U8Type(lifted1715) } 7 => { - let lifted1720 : @types.NumericRestrictions? = match + let lifted1722 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1715 : @types.NumericBound? = match + let lifted1717 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1714 = match + let lifted1716 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16287,16 +16325,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1714) + Option::Some(lifted1716) } _ => panic() } - let lifted1717 : @types.NumericBound? = match + let lifted1719 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1716 = match + let lifted1718 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16313,46 +16351,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1716) + Option::Some(lifted1718) } _ => panic() } - let lifted1719 : String? = match + let lifted1721 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1718 = mbt_ffi_ptr2str( + let result1720 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1718) + Option::Some(result1720) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1715, - max: lifted1717, - unit: lifted1719, + min: lifted1717, + max: lifted1719, + unit: lifted1721, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted1720) + @types.SchemaTypeBody::U16Type(lifted1722) } 8 => { - let lifted1727 : @types.NumericRestrictions? = match + let lifted1729 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1722 : @types.NumericBound? = match + let lifted1724 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1721 = match + let lifted1723 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16369,16 +16407,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1721) + Option::Some(lifted1723) } _ => panic() } - let lifted1724 : @types.NumericBound? = match + let lifted1726 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1723 = match + let lifted1725 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16395,46 +16433,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1723) + Option::Some(lifted1725) } _ => panic() } - let lifted1726 : String? = match + let lifted1728 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1725 = mbt_ffi_ptr2str( + let result1727 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1725) + Option::Some(result1727) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1722, - max: lifted1724, - unit: lifted1726, + min: lifted1724, + max: lifted1726, + unit: lifted1728, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1727) + @types.SchemaTypeBody::U32Type(lifted1729) } 9 => { - let lifted1734 : @types.NumericRestrictions? = match + let lifted1736 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1729 : @types.NumericBound? = match + let lifted1731 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1728 = match + let lifted1730 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16451,16 +16489,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1728) + Option::Some(lifted1730) } _ => panic() } - let lifted1731 : @types.NumericBound? = match + let lifted1733 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1730 = match + let lifted1732 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16477,46 +16515,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1730) + Option::Some(lifted1732) } _ => panic() } - let lifted1733 : String? = match + let lifted1735 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1732 = mbt_ffi_ptr2str( + let result1734 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1732) + Option::Some(result1734) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1729, - max: lifted1731, - unit: lifted1733, + min: lifted1731, + max: lifted1733, + unit: lifted1735, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1734) + @types.SchemaTypeBody::U64Type(lifted1736) } 10 => { - let lifted1741 : @types.NumericRestrictions? = match + let lifted1743 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1736 : @types.NumericBound? = match + let lifted1738 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1735 = match + let lifted1737 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16533,16 +16571,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1735) + Option::Some(lifted1737) } _ => panic() } - let lifted1738 : @types.NumericBound? = match + let lifted1740 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1737 = match + let lifted1739 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16559,46 +16597,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1737) + Option::Some(lifted1739) } _ => panic() } - let lifted1740 : String? = match + let lifted1742 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1739 = mbt_ffi_ptr2str( + let result1741 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1739) + Option::Some(result1741) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1736, - max: lifted1738, - unit: lifted1740, + min: lifted1738, + max: lifted1740, + unit: lifted1742, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1741) + @types.SchemaTypeBody::F32Type(lifted1743) } 11 => { - let lifted1748 : @types.NumericRestrictions? = match + let lifted1750 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1743 : @types.NumericBound? = match + let lifted1745 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1742 = match + let lifted1744 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16615,16 +16653,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1742) + Option::Some(lifted1744) } _ => panic() } - let lifted1745 : @types.NumericBound? = match + let lifted1747 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1744 = match + let lifted1746 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16641,324 +16679,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1744) + Option::Some(lifted1746) } _ => panic() } - let lifted1747 : String? = match + let lifted1749 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1746 = mbt_ffi_ptr2str( + let result1748 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1746) + Option::Some(result1748) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1743, - max: lifted1745, - unit: lifted1747, + min: lifted1745, + max: lifted1747, + unit: lifted1749, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted1748) + @types.SchemaTypeBody::F64Type(lifted1750) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array1763 : Array[@types.NamedFieldType] = [] - for index1764 = 0 - index1764 < mbt_ffi_load32(iter_base + 12) - index1764 = index1764 + 1 { + let array1765 : Array[@types.NamedFieldType] = [] + for index1766 = 0 + index1766 < mbt_ffi_load32(iter_base + 12) + index1766 = index1766 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1764 * 68 + index1766 * 68 - let result1749 = mbt_ffi_ptr2str( + let result1751 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1751 : String? = match + let lifted1753 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1750 = mbt_ffi_ptr2str( + let result1752 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1750) + Option::Some(result1752) } _ => panic() } - let array1753 : Array[String] = [] - for index1754 = 0 - index1754 < mbt_ffi_load32(iter_base + 28) - index1754 = index1754 + 1 { + let array1755 : Array[String] = [] + for index1756 = 0 + index1756 < mbt_ffi_load32(iter_base + 28) + index1756 = index1756 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1754 * 8 + index1756 * 8 - let result1752 = mbt_ffi_ptr2str( + let result1754 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1753.push(result1752) + array1755.push(result1754) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array1756 : Array[String] = [] - for index1757 = 0 - index1757 < mbt_ffi_load32(iter_base + 36) - index1757 = index1757 + 1 { + let array1758 : Array[String] = [] + for index1759 = 0 + index1759 < mbt_ffi_load32(iter_base + 36) + index1759 = index1759 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index1757 * 8 + index1759 * 8 - let result1755 = mbt_ffi_ptr2str( + let result1757 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1756.push(result1755) + array1758.push(result1757) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted1759 : String? = match + let lifted1761 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result1758 = mbt_ffi_ptr2str( + let result1760 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result1758) + Option::Some(result1760) } _ => panic() } - let lifted1762 : @types.Role? = match + let lifted1764 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted1761 = match + let lifted1763 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1760 = mbt_ffi_ptr2str( + let result1762 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result1760) + @types.Role::Other(result1762) } _ => panic() } - Option::Some(lifted1761) + Option::Some(lifted1763) } _ => panic() } - array1763.push(@types.NamedFieldType::{ - name: result1749, + array1765.push(@types.NamedFieldType::{ + name: result1751, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted1751, - aliases: array1753, - examples: array1756, - deprecated: lifted1759, - role: lifted1762, + doc: lifted1753, + aliases: array1755, + examples: array1758, + deprecated: lifted1761, + role: lifted1764, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array1763) + @types.SchemaTypeBody::RecordType(array1765) } 15 => { - let array1780 : Array[@types.VariantCaseType] = [] - for index1781 = 0 - index1781 < mbt_ffi_load32(iter_base + 12) - index1781 = index1781 + 1 { + let array1782 : Array[@types.VariantCaseType] = [] + for index1783 = 0 + index1783 < mbt_ffi_load32(iter_base + 12) + index1783 = index1783 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1781 * 72 + index1783 * 72 - let result1765 = mbt_ffi_ptr2str( + let result1767 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1766 : Int? = match + let lifted1768 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1768 : String? = match + let lifted1770 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1767 = mbt_ffi_ptr2str( + let result1769 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1767) + Option::Some(result1769) } _ => panic() } - let array1770 : Array[String] = [] - for index1771 = 0 - index1771 < mbt_ffi_load32(iter_base + 32) - index1771 = index1771 + 1 { + let array1772 : Array[String] = [] + for index1773 = 0 + index1773 < mbt_ffi_load32(iter_base + 32) + index1773 = index1773 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1771 * 8 + index1773 * 8 - let result1769 = mbt_ffi_ptr2str( + let result1771 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1770.push(result1769) + array1772.push(result1771) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array1773 : Array[String] = [] - for index1774 = 0 - index1774 < mbt_ffi_load32(iter_base + 40) - index1774 = index1774 + 1 { + let array1775 : Array[String] = [] + for index1776 = 0 + index1776 < mbt_ffi_load32(iter_base + 40) + index1776 = index1776 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1774 * 8 + index1776 * 8 - let result1772 = mbt_ffi_ptr2str( + let result1774 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1773.push(result1772) + array1775.push(result1774) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted1776 : String? = match + let lifted1778 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result1775 = mbt_ffi_ptr2str( + let result1777 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result1775) + Option::Some(result1777) } _ => panic() } - let lifted1779 : @types.Role? = match + let lifted1781 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted1778 = match + let lifted1780 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1777 = mbt_ffi_ptr2str( + let result1779 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result1777) + @types.Role::Other(result1779) } _ => panic() } - Option::Some(lifted1778) + Option::Some(lifted1780) } _ => panic() } - array1780.push(@types.VariantCaseType::{ - name: result1765, - payload: lifted1766, + array1782.push(@types.VariantCaseType::{ + name: result1767, + payload: lifted1768, metadata: @types.MetadataEnvelope::{ - doc: lifted1768, - aliases: array1770, - examples: array1773, - deprecated: lifted1776, - role: lifted1779, + doc: lifted1770, + aliases: array1772, + examples: array1775, + deprecated: lifted1778, + role: lifted1781, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array1780) + @types.SchemaTypeBody::VariantType(array1782) } 16 => { - let array1783 : Array[String] = [] - for index1784 = 0 - index1784 < mbt_ffi_load32(iter_base + 12) - index1784 = index1784 + 1 { + let array1785 : Array[String] = [] + for index1786 = 0 + index1786 < mbt_ffi_load32(iter_base + 12) + index1786 = index1786 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1784 * 8 + index1786 * 8 - let result1782 = mbt_ffi_ptr2str( + let result1784 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1783.push(result1782) + array1785.push(result1784) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array1783) + @types.SchemaTypeBody::EnumType(array1785) } 17 => { - let array1786 : Array[String] = [] - for index1787 = 0 - index1787 < mbt_ffi_load32(iter_base + 12) - index1787 = index1787 + 1 { + let array1788 : Array[String] = [] + for index1789 = 0 + index1789 < mbt_ffi_load32(iter_base + 12) + index1789 = index1789 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1787 * 8 + index1789 * 8 - let result1785 = mbt_ffi_ptr2str( + let result1787 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1786.push(result1785) + array1788.push(result1787) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array1786) + @types.SchemaTypeBody::FlagsType(array1788) } 18 => { - let array1788 : Array[Int] = [] - for index1789 = 0 - index1789 < mbt_ffi_load32(iter_base + 12) - index1789 = index1789 + 1 { + let array1790 : Array[Int] = [] + for index1791 = 0 + index1791 < mbt_ffi_load32(iter_base + 12) + index1791 = index1791 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1789 * 4 + index1791 * 4 - array1788.push(mbt_ffi_load32(iter_base + 0)) + array1790.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array1788) + @types.SchemaTypeBody::TupleType(array1790) } 19 => @types.SchemaTypeBody::ListType( @@ -16979,14 +17017,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted1790 : Int? = match + let lifted1792 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1791 : Int? = match + let lifted1793 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -16994,37 +17032,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted1790, - err: lifted1791, + ok: lifted1792, + err: lifted1793, }) } 24 => { - let lifted1795 : Array[String]? = match + let lifted1797 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1793 : Array[String] = [] - for index1794 = 0 - index1794 < mbt_ffi_load32(iter_base + 16) - index1794 = index1794 + 1 { + let array1795 : Array[String] = [] + for index1796 = 0 + index1796 < mbt_ffi_load32(iter_base + 16) + index1796 = index1796 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1794 * 8 + index1796 * 8 - let result1792 = mbt_ffi_ptr2str( + let result1794 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1793.push(result1792) + array1795.push(result1794) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1793) + Option::Some(array1795) } _ => panic() } - let lifted1796 : UInt? = match + let lifted1798 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -17034,7 +17072,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1797 : UInt? = match + let lifted1799 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -17044,54 +17082,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1799 : String? = match + let lifted1801 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1798 = mbt_ffi_ptr2str( + let result1800 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1798) + Option::Some(result1800) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted1795, - min_length: lifted1796, - max_length: lifted1797, - regex: lifted1799, + languages: lifted1797, + min_length: lifted1798, + max_length: lifted1799, + regex: lifted1801, }) } 25 => { - let lifted1803 : Array[String]? = match + let lifted1805 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1801 : Array[String] = [] - for index1802 = 0 - index1802 < mbt_ffi_load32(iter_base + 16) - index1802 = index1802 + 1 { + let array1803 : Array[String] = [] + for index1804 = 0 + index1804 < mbt_ffi_load32(iter_base + 16) + index1804 = index1804 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1802 * 8 + index1804 * 8 - let result1800 = mbt_ffi_ptr2str( + let result1802 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1801.push(result1800) + array1803.push(result1802) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1801) + Option::Some(array1803) } _ => panic() } - let lifted1804 : UInt? = match + let lifted1806 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -17101,7 +17139,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1805 : UInt? = match + let lifted1807 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -17112,58 +17150,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted1803, - min_bytes: lifted1804, - max_bytes: lifted1805, + mime_types: lifted1805, + min_bytes: lifted1806, + max_bytes: lifted1807, }) } 26 => { - let lifted1809 : Array[String]? = match + let lifted1811 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array1807 : Array[String] = [] - for index1808 = 0 - index1808 < mbt_ffi_load32(iter_base + 20) - index1808 = index1808 + 1 { + let array1809 : Array[String] = [] + for index1810 = 0 + index1810 < mbt_ffi_load32(iter_base + 20) + index1810 = index1810 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1808 * 8 + index1810 * 8 - let result1806 = mbt_ffi_ptr2str( + let result1808 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1807.push(result1806) + array1809.push(result1808) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array1807) + Option::Some(array1809) } _ => panic() } - let lifted1813 : Array[String]? = match + let lifted1815 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array1811 : Array[String] = [] - for index1812 = 0 - index1812 < mbt_ffi_load32(iter_base + 32) - index1812 = index1812 + 1 { + let array1813 : Array[String] = [] + for index1814 = 0 + index1814 < mbt_ffi_load32(iter_base + 32) + index1814 = index1814 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1812 * 8 + index1814 * 8 - let result1810 = mbt_ffi_ptr2str( + let result1812 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1811.push(result1810) + array1813.push(result1812) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array1811) + Option::Some(array1813) } _ => panic() } @@ -17175,95 +17213,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted1809, - allowed_extensions: lifted1813, + allowed_mime_types: lifted1811, + allowed_extensions: lifted1815, }) } 27 => { - let lifted1817 : Array[String]? = match + let lifted1819 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1815 : Array[String] = [] - for index1816 = 0 - index1816 < mbt_ffi_load32(iter_base + 16) - index1816 = index1816 + 1 { + let array1817 : Array[String] = [] + for index1818 = 0 + index1818 < mbt_ffi_load32(iter_base + 16) + index1818 = index1818 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1816 * 8 + index1818 * 8 - let result1814 = mbt_ffi_ptr2str( + let result1816 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1815.push(result1814) + array1817.push(result1816) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1815) + Option::Some(array1817) } _ => panic() } - let lifted1821 : Array[String]? = match + let lifted1823 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array1819 : Array[String] = [] - for index1820 = 0 - index1820 < mbt_ffi_load32(iter_base + 28) - index1820 = index1820 + 1 { + let array1821 : Array[String] = [] + for index1822 = 0 + index1822 < mbt_ffi_load32(iter_base + 28) + index1822 = index1822 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1820 * 8 + index1822 * 8 - let result1818 = mbt_ffi_ptr2str( + let result1820 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1819.push(result1818) + array1821.push(result1820) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array1819) + Option::Some(array1821) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted1817, - allowed_hosts: lifted1821, + allowed_schemes: lifted1819, + allowed_hosts: lifted1823, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result1822 = mbt_ffi_ptr2str( + let result1824 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array1824 : Array[String] = [] - for index1825 = 0 - index1825 < mbt_ffi_load32(iter_base + 20) - index1825 = index1825 + 1 { + let array1826 : Array[String] = [] + for index1827 = 0 + index1827 < mbt_ffi_load32(iter_base + 20) + index1827 = index1827 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1825 * 8 + index1827 * 8 - let result1823 = mbt_ffi_ptr2str( + let result1825 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1824.push(result1823) + array1826.push(result1825) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted1827 : @types.QuantityValue? = match + let lifted1829 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1826 = mbt_ffi_ptr2str( + let result1828 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -17271,17 +17309,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result1826, + unit: result1828, }) } _ => panic() } - let lifted1829 : @types.QuantityValue? = match + let lifted1831 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result1828 = mbt_ffi_ptr2str( + let result1830 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -17289,406 +17327,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result1828, + unit: result1830, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result1822, - allowed_suffixes: array1824, - min: lifted1827, - max: lifted1829, + base_unit: result1824, + allowed_suffixes: array1826, + min: lifted1829, + max: lifted1831, }) } 31 => { - let array1853 : Array[@types.UnionBranch] = [] - for index1854 = 0 - index1854 < mbt_ffi_load32(iter_base + 12) - index1854 = index1854 + 1 { + let array1855 : Array[@types.UnionBranch] = [] + for index1856 = 0 + index1856 < mbt_ffi_load32(iter_base + 12) + index1856 = index1856 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1854 * 92 + index1856 * 92 - let result1830 = mbt_ffi_ptr2str( + let result1832 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1839 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted1841 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result1831 = mbt_ffi_ptr2str( + let result1833 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result1831) + @types.DiscriminatorRule::Prefix(result1833) } 1 => { - let result1832 = mbt_ffi_ptr2str( + let result1834 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result1832) + @types.DiscriminatorRule::Suffix(result1834) } 2 => { - let result1833 = mbt_ffi_ptr2str( + let result1835 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result1833) + @types.DiscriminatorRule::Contains(result1835) } 3 => { - let result1834 = mbt_ffi_ptr2str( + let result1836 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result1834) + @types.DiscriminatorRule::Regex(result1836) } 4 => { - let result1835 = mbt_ffi_ptr2str( + let result1837 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted1837 : String? = match + let lifted1839 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1836 = mbt_ffi_ptr2str( + let result1838 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result1836) + Option::Some(result1838) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result1835, - literal: lifted1837, + field_name: result1837, + literal: lifted1839, }) } 5 => { - let result1838 = mbt_ffi_ptr2str( + let result1840 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result1838) + @types.DiscriminatorRule::FieldAbsent(result1840) } _ => panic() } - let lifted1841 : String? = match + let lifted1843 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1840 = mbt_ffi_ptr2str( + let result1842 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1840) + Option::Some(result1842) } _ => panic() } - let array1843 : Array[String] = [] - for index1844 = 0 - index1844 < mbt_ffi_load32(iter_base + 52) - index1844 = index1844 + 1 { + let array1845 : Array[String] = [] + for index1846 = 0 + index1846 < mbt_ffi_load32(iter_base + 52) + index1846 = index1846 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1844 * 8 + index1846 * 8 - let result1842 = mbt_ffi_ptr2str( + let result1844 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1843.push(result1842) + array1845.push(result1844) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1846 : Array[String] = [] - for index1847 = 0 - index1847 < mbt_ffi_load32(iter_base + 60) - index1847 = index1847 + 1 { + let array1848 : Array[String] = [] + for index1849 = 0 + index1849 < mbt_ffi_load32(iter_base + 60) + index1849 = index1849 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1847 * 8 + index1849 * 8 - let result1845 = mbt_ffi_ptr2str( + let result1847 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1846.push(result1845) + array1848.push(result1847) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted1849 : String? = match + let lifted1851 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1848 = mbt_ffi_ptr2str( + let result1850 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1848) + Option::Some(result1850) } _ => panic() } - let lifted1852 : @types.Role? = match + let lifted1854 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted1851 = match + let lifted1853 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1850 = mbt_ffi_ptr2str( + let result1852 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result1850) + @types.Role::Other(result1852) } _ => panic() } - Option::Some(lifted1851) + Option::Some(lifted1853) } _ => panic() } - array1853.push(@types.UnionBranch::{ - tag: result1830, + array1855.push(@types.UnionBranch::{ + tag: result1832, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted1839, + discriminator: lifted1841, metadata: @types.MetadataEnvelope::{ - doc: lifted1841, - aliases: array1843, - examples: array1846, - deprecated: lifted1849, - role: lifted1852, + doc: lifted1843, + aliases: array1845, + examples: array1848, + deprecated: lifted1851, + role: lifted1854, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array1853, + branches: array1855, }) } 32 => { - let lifted1856 : String? = match + let lifted1858 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1855 = mbt_ffi_ptr2str( + let result1857 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1855) + Option::Some(result1857) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted1856, + category: lifted1858, }) } 33 => { - let lifted1858 : String? = match + let lifted1860 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1857 = mbt_ffi_ptr2str( + let result1859 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1857) + Option::Some(result1859) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted1858, + resource_name: lifted1860, }) } 34 => { - let lifted1859 : Int? = match + let lifted1861 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted1859) + @types.SchemaTypeBody::FutureType(lifted1861) } 35 => { - let lifted1860 : Int? = match + let lifted1862 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted1860) + @types.SchemaTypeBody::StreamType(lifted1862) } _ => panic() } - let lifted1863 : String? = match + let lifted1865 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result1862 = mbt_ffi_ptr2str( + let result1864 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result1862) + Option::Some(result1864) } _ => panic() } - let array1865 : Array[String] = [] - for index1866 = 0 - index1866 < mbt_ffi_load32(iter_base + 104) - index1866 = index1866 + 1 { + let array1867 : Array[String] = [] + for index1868 = 0 + index1868 < mbt_ffi_load32(iter_base + 104) + index1868 = index1868 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index1866 * 8 + index1868 * 8 - let result1864 = mbt_ffi_ptr2str( + let result1866 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1865.push(result1864) + array1867.push(result1866) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array1868 : Array[String] = [] - for index1869 = 0 - index1869 < mbt_ffi_load32(iter_base + 112) - index1869 = index1869 + 1 { + let array1870 : Array[String] = [] + for index1871 = 0 + index1871 < mbt_ffi_load32(iter_base + 112) + index1871 = index1871 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index1869 * 8 + index1871 * 8 - let result1867 = mbt_ffi_ptr2str( + let result1869 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1868.push(result1867) + array1870.push(result1869) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted1871 : String? = match + let lifted1873 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result1870 = mbt_ffi_ptr2str( + let result1872 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result1870) + Option::Some(result1872) } _ => panic() } - let lifted1874 : @types.Role? = match + let lifted1876 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted1873 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted1875 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1872 = mbt_ffi_ptr2str( + let result1874 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result1872) + @types.Role::Other(result1874) } _ => panic() } - Option::Some(lifted1873) + Option::Some(lifted1875) } _ => panic() } - array1875.push(@types.SchemaTypeNode::{ - body: lifted1861, + array1877.push(@types.SchemaTypeNode::{ + body: lifted1863, metadata: @types.MetadataEnvelope::{ - doc: lifted1863, - aliases: array1865, - examples: array1868, - deprecated: lifted1871, - role: lifted1874, + doc: lifted1865, + aliases: array1867, + examples: array1870, + deprecated: lifted1873, + role: lifted1876, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1880 : Array[@types.SchemaTypeDef] = [] - for index1881 = 0 - index1881 < mbt_ffi_load32(iter_base + 60) - index1881 = index1881 + 1 { + let array1882 : Array[@types.SchemaTypeDef] = [] + for index1883 = 0 + index1883 < mbt_ffi_load32(iter_base + 60) + index1883 = index1883 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1881 * 24 + index1883 * 24 - let result1877 = mbt_ffi_ptr2str( + let result1879 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1879 : String? = match + let lifted1881 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1878 = mbt_ffi_ptr2str( + let result1880 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1878) + Option::Some(result1880) } _ => panic() } - array1880.push(@types.SchemaTypeDef::{ - id: result1877, - name: lifted1879, + array1882.push(@types.SchemaTypeDef::{ + id: result1879, + name: lifted1881, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let array1911 : Array[@types.SchemaValueNode] = [] - for index1912 = 0 - index1912 < mbt_ffi_load32(iter_base + 72) - index1912 = index1912 + 1 { + let array1913 : Array[@types.SchemaValueNode] = [] + for index1914 = 0 + index1914 < mbt_ffi_load32(iter_base + 72) + index1914 = index1914 + 1 { let iter_base = mbt_ffi_load32(iter_base + 68) + - index1912 * 32 + index1914 * 32 - let lifted1910 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1912 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -17740,29 +17778,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result1882 = mbt_ffi_ptr2str( + let result1884 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result1882) + @types.SchemaValueNode::StringValue(result1884) } 13 => { - let array1883 : Array[Int] = [] - for index1884 = 0 - index1884 < mbt_ffi_load32(iter_base + 12) - index1884 = index1884 + 1 { + let array1885 : Array[Int] = [] + for index1886 = 0 + index1886 < mbt_ffi_load32(iter_base + 12) + index1886 = index1886 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1884 * 4 + index1886 * 4 - array1883.push(mbt_ffi_load32(iter_base + 0)) + array1885.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array1883) + @types.SchemaValueNode::RecordValue(array1885) } 14 => { - let lifted1885 : Int? = match + let lifted1887 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -17771,7 +17809,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted1885, + payload: lifted1887, }) } 15 => @@ -17779,34 +17817,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array1886 : Array[Bool] = [] - for index1887 = 0 - index1887 < mbt_ffi_load32(iter_base + 12) - index1887 = index1887 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index1887 * 1 - - array1886.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array1886) - } - 17 => { - let array1888 : Array[Int] = [] + let array1888 : Array[Bool] = [] for index1889 = 0 index1889 < mbt_ffi_load32(iter_base + 12) index1889 = index1889 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1889 * 4 + index1889 * 1 - array1888.push(mbt_ffi_load32(iter_base + 0)) + array1888.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array1888) + @types.SchemaValueNode::FlagsValue(array1888) } - 18 => { + 17 => { let array1890 : Array[Int] = [] for index1891 = 0 index1891 < mbt_ffi_load32(iter_base + 12) @@ -17818,9 +17842,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array1890) + @types.SchemaValueNode::TupleValue(array1890) } - 19 => { + 18 => { let array1892 : Array[Int] = [] for index1893 = 0 index1893 < mbt_ffi_load32(iter_base + 12) @@ -17832,127 +17856,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array1892) + @types.SchemaValueNode::ListValue(array1892) } - 20 => { - let array1894 : Array[@types.MapEntry] = [] + 19 => { + let array1894 : Array[Int] = [] for index1895 = 0 index1895 < mbt_ffi_load32(iter_base + 12) index1895 = index1895 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1895 * 8 + index1895 * 4 + + array1894.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array1894) + } + 20 => { + let array1896 : Array[@types.MapEntry] = [] + for index1897 = 0 + index1897 < mbt_ffi_load32(iter_base + 12) + index1897 = index1897 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index1897 * 8 - array1894.push(@types.MapEntry::{ + array1896.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array1894) + @types.SchemaValueNode::MapValue(array1896) } 21 => { - let lifted1896 : Int? = match + let lifted1898 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted1896) + @types.SchemaValueNode::OptionValue(lifted1898) } 22 => { - let lifted1899 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted1901 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted1897 : Int? = match + let lifted1899 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted1897) + @types.ResultValuePayload::OkValue(lifted1899) } 1 => { - let lifted1898 : Int? = match + let lifted1900 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted1898) + @types.ResultValuePayload::ErrValue(lifted1900) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted1899) + @types.SchemaValueNode::ResultValue(lifted1901) } 23 => { - let result1900 = mbt_ffi_ptr2str( + let result1902 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1902 : String? = match + let lifted1904 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1901 = mbt_ffi_ptr2str( + let result1903 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1901) + Option::Some(result1903) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result1900, - language: lifted1902, + text: result1902, + language: lifted1904, }) } 24 => { - let result1903 = mbt_ffi_ptr2bytes( + let result1905 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1905 : String? = match + let lifted1907 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1904 = mbt_ffi_ptr2str( + let result1906 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1904) + Option::Some(result1906) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result1903, - mime_type: lifted1905, + bytes: result1905, + mime_type: lifted1907, }) } 25 => { - let result1906 = mbt_ffi_ptr2str( + let result1908 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result1906) + @types.SchemaValueNode::PathValue(result1908) } 26 => { - let result1907 = mbt_ffi_ptr2str( + let result1909 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result1907) + @types.SchemaValueNode::UrlValue(result1909) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -17964,7 +18002,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result1908 = mbt_ffi_ptr2str( + let result1910 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -17972,17 +18010,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result1908, + unit: result1910, }) } 30 => { - let result1909 = mbt_ffi_ptr2str( + let result1911 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result1909, + tag: result1911, body: mbt_ffi_load32(iter_base + 16), }) } @@ -17996,68 +18034,74 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array1911.push(lifted1910) + array1913.push(lifted1912) } mbt_ffi_free(mbt_ffi_load32(iter_base + 68)) - let result1913 = mbt_ffi_ptr2str( + let result1915 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 80), mbt_ffi_load32(iter_base + 84), ) - let array1915 : Array[String] = [] - for index1916 = 0 - index1916 < mbt_ffi_load32(iter_base + 92) - index1916 = index1916 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 88) + index1916 * 8 + let array1917 : Array[String] = [] + for index1918 = 0 + index1918 < mbt_ffi_load32(iter_base + 92) + index1918 = index1918 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 88) + index1918 * 8 - let result1914 = mbt_ffi_ptr2str( + let result1916 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1915.push(result1914) + array1917.push(result1916) } mbt_ffi_free(mbt_ffi_load32(iter_base + 88)) - let array1930 : Array[Array[SpanData]] = [] - for index1931 = 0 - index1931 < mbt_ffi_load32(iter_base + 100) - index1931 = index1931 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 96) + index1931 * 8 + let array1932 : Array[Array[SpanData]] = [] + for index1933 = 0 + index1933 < mbt_ffi_load32(iter_base + 100) + index1933 = index1933 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 96) + index1933 * 8 - let array1928 : Array[SpanData] = [] - for index1929 = 0 - index1929 < mbt_ffi_load32(iter_base + 4) - index1929 = index1929 + 1 { + let array1930 : Array[SpanData] = [] + for index1931 = 0 + index1931 < mbt_ffi_load32(iter_base + 4) + index1931 = index1931 + 1 { let iter_base = mbt_ffi_load32(iter_base + 0) + - index1929 * 80 + index1931 * 80 - let lifted1927 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1929 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result1917 = mbt_ffi_ptr2str( + let result1919 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1919 : String? = match + let lifted1921 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result1918 = mbt_ffi_ptr2str( + let result1920 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result1918) + Option::Some(result1920) } _ => panic() } - let lifted1920 : UInt64? = match + let lifted1922 : UInt64? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -18067,117 +18111,117 @@ pub fn enrich_oplog_entries( _ => panic() } - let array1924 : Array[@context.Attribute] = [] - for index1925 = 0 - index1925 < mbt_ffi_load32(iter_base + 68) - index1925 = index1925 + 1 { + let array1926 : Array[@context.Attribute] = [] + for index1927 = 0 + index1927 < mbt_ffi_load32(iter_base + 68) + index1927 = index1927 + 1 { let iter_base = mbt_ffi_load32(iter_base + 64) + - index1925 * 20 + index1927 * 20 - let result1921 = mbt_ffi_ptr2str( + let result1923 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1923 = match + let lifted1925 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result1922 = mbt_ffi_ptr2str( + let result1924 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result1922) + @context.AttributeValue::String(result1924) } _ => panic() } - array1924.push(@context.Attribute::{ - key: result1921, - value: lifted1923, + array1926.push(@context.Attribute::{ + key: result1923, + value: lifted1925, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) SpanData::LocalSpan(LocalSpanData::{ - span_id: result1917, + span_id: result1919, start: @system-clock.Instant::{ seconds: mbt_ffi_load64(iter_base + 16), nanoseconds: mbt_ffi_load32(iter_base + 24).reinterpret_as_uint(), }, - parent: lifted1919, - linked_context: lifted1920, - attributes: array1924, + parent: lifted1921, + linked_context: lifted1922, + attributes: array1926, inherited: mbt_ffi_load8_u(iter_base + 72) != 0, }) } 1 => { - let result1926 = mbt_ffi_ptr2str( + let result1928 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) SpanData::ExternalSpan(ExternalSpanData::{ - span_id: result1926, + span_id: result1928, }) } _ => panic() } - array1928.push(lifted1927) + array1930.push(lifted1929) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - array1930.push(array1928) + array1932.push(array1930) } mbt_ffi_free(mbt_ffi_load32(iter_base + 96)) AgentInvocation::AgentMethodInvocation(AgentMethodInvocationParameters::{ - idempotency_key: result1677, - method_name: result1678, + idempotency_key: result1679, + method_name: result1680, function_input: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array1875, - defs: array1880, + type_nodes: array1877, + defs: array1882, root: mbt_ffi_load32(iter_base + 64), }, value: @types.SchemaValueTree::{ - value_nodes: array1911, + value_nodes: array1913, root: mbt_ffi_load32(iter_base + 76), }, }, - trace_id: result1913, - trace_states: array1915, - invocation_context: array1930, + trace_id: result1915, + trace_states: array1917, + invocation_context: array1932, }) } 2 => AgentInvocation::SaveSnapshot 3 => { - let result1932 = mbt_ffi_ptr2bytes( + let result1934 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result1933 = mbt_ffi_ptr2str( + let result1935 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) AgentInvocation::LoadSnapshot(LoadSnapshotParameters::{ snapshot: SnapshotData::{ - data: result1932, - mime_type: result1933, + data: result1934, + mime_type: result1935, }, }) } 4 => { - let result1934 = mbt_ffi_ptr2str( + let result1936 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) AgentInvocation::ProcessOplogEntries(ProcessOplogEntriesParameters::{ - idempotency_key: result1934, + idempotency_key: result1936, }) } 5 => @@ -18192,35 +18236,35 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - invocation: lifted1935, + invocation: lifted1937, }) } 5 => { - let lifted2410 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted2412 = match mbt_ffi_load8_u(iter_base + 24) { 0 => { - let array2132 : Array[@types.SchemaTypeNode] = [] - for index2133 = 0 - index2133 < mbt_ffi_load32(iter_base + 32) - index2133 = index2133 + 1 { + let array2134 : Array[@types.SchemaTypeNode] = [] + for index2135 = 0 + index2135 < mbt_ffi_load32(iter_base + 32) + index2135 = index2135 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2133 * 144 + index2135 * 144 - let lifted2118 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2120 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted1942 : @types.NumericRestrictions? = match + let lifted1944 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1937 : @types.NumericBound? = match + let lifted1939 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1936 = match + let lifted1938 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18237,16 +18281,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1936) + Option::Some(lifted1938) } _ => panic() } - let lifted1939 : @types.NumericBound? = match + let lifted1941 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1938 = match + let lifted1940 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18263,46 +18307,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1938) + Option::Some(lifted1940) } _ => panic() } - let lifted1941 : String? = match + let lifted1943 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1940 = mbt_ffi_ptr2str( + let result1942 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1940) + Option::Some(result1942) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1937, - max: lifted1939, - unit: lifted1941, + min: lifted1939, + max: lifted1941, + unit: lifted1943, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted1942) + @types.SchemaTypeBody::S8Type(lifted1944) } 3 => { - let lifted1949 : @types.NumericRestrictions? = match + let lifted1951 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1944 : @types.NumericBound? = match + let lifted1946 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1943 = match + let lifted1945 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18319,16 +18363,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1943) + Option::Some(lifted1945) } _ => panic() } - let lifted1946 : @types.NumericBound? = match + let lifted1948 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1945 = match + let lifted1947 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18345,46 +18389,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1945) + Option::Some(lifted1947) } _ => panic() } - let lifted1948 : String? = match + let lifted1950 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1947 = mbt_ffi_ptr2str( + let result1949 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1947) + Option::Some(result1949) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1944, - max: lifted1946, - unit: lifted1948, + min: lifted1946, + max: lifted1948, + unit: lifted1950, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted1949) + @types.SchemaTypeBody::S16Type(lifted1951) } 4 => { - let lifted1956 : @types.NumericRestrictions? = match + let lifted1958 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1951 : @types.NumericBound? = match + let lifted1953 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1950 = match + let lifted1952 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18401,16 +18445,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1950) + Option::Some(lifted1952) } _ => panic() } - let lifted1953 : @types.NumericBound? = match + let lifted1955 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1952 = match + let lifted1954 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18427,46 +18471,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1952) + Option::Some(lifted1954) } _ => panic() } - let lifted1955 : String? = match + let lifted1957 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1954 = mbt_ffi_ptr2str( + let result1956 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1954) + Option::Some(result1956) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1951, - max: lifted1953, - unit: lifted1955, + min: lifted1953, + max: lifted1955, + unit: lifted1957, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted1956) + @types.SchemaTypeBody::S32Type(lifted1958) } 5 => { - let lifted1963 : @types.NumericRestrictions? = match + let lifted1965 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1958 : @types.NumericBound? = match + let lifted1960 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1957 = match + let lifted1959 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18483,16 +18527,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1957) + Option::Some(lifted1959) } _ => panic() } - let lifted1960 : @types.NumericBound? = match + let lifted1962 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1959 = match + let lifted1961 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18509,46 +18553,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1959) + Option::Some(lifted1961) } _ => panic() } - let lifted1962 : String? = match + let lifted1964 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1961 = mbt_ffi_ptr2str( + let result1963 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1961) + Option::Some(result1963) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1958, - max: lifted1960, - unit: lifted1962, + min: lifted1960, + max: lifted1962, + unit: lifted1964, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted1963) + @types.SchemaTypeBody::S64Type(lifted1965) } 6 => { - let lifted1970 : @types.NumericRestrictions? = match + let lifted1972 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1965 : @types.NumericBound? = match + let lifted1967 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1964 = match + let lifted1966 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18565,16 +18609,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1964) + Option::Some(lifted1966) } _ => panic() } - let lifted1967 : @types.NumericBound? = match + let lifted1969 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1966 = match + let lifted1968 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18591,46 +18635,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1966) + Option::Some(lifted1968) } _ => panic() } - let lifted1969 : String? = match + let lifted1971 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1968 = mbt_ffi_ptr2str( + let result1970 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1968) + Option::Some(result1970) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1965, - max: lifted1967, - unit: lifted1969, + min: lifted1967, + max: lifted1969, + unit: lifted1971, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted1970) + @types.SchemaTypeBody::U8Type(lifted1972) } 7 => { - let lifted1977 : @types.NumericRestrictions? = match + let lifted1979 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1972 : @types.NumericBound? = match + let lifted1974 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1971 = match + let lifted1973 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18647,16 +18691,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1971) + Option::Some(lifted1973) } _ => panic() } - let lifted1974 : @types.NumericBound? = match + let lifted1976 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1973 = match + let lifted1975 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18673,46 +18717,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1973) + Option::Some(lifted1975) } _ => panic() } - let lifted1976 : String? = match + let lifted1978 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1975 = mbt_ffi_ptr2str( + let result1977 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1975) + Option::Some(result1977) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1972, - max: lifted1974, - unit: lifted1976, + min: lifted1974, + max: lifted1976, + unit: lifted1978, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted1977) + @types.SchemaTypeBody::U16Type(lifted1979) } 8 => { - let lifted1984 : @types.NumericRestrictions? = match + let lifted1986 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1979 : @types.NumericBound? = match + let lifted1981 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1978 = match + let lifted1980 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18729,16 +18773,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1978) + Option::Some(lifted1980) } _ => panic() } - let lifted1981 : @types.NumericBound? = match + let lifted1983 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1980 = match + let lifted1982 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18755,46 +18799,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1980) + Option::Some(lifted1982) } _ => panic() } - let lifted1983 : String? = match + let lifted1985 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1982 = mbt_ffi_ptr2str( + let result1984 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1982) + Option::Some(result1984) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1979, - max: lifted1981, - unit: lifted1983, + min: lifted1981, + max: lifted1983, + unit: lifted1985, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1984) + @types.SchemaTypeBody::U32Type(lifted1986) } 9 => { - let lifted1991 : @types.NumericRestrictions? = match + let lifted1993 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1986 : @types.NumericBound? = match + let lifted1988 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1985 = match + let lifted1987 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18811,16 +18855,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1985) + Option::Some(lifted1987) } _ => panic() } - let lifted1988 : @types.NumericBound? = match + let lifted1990 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1987 = match + let lifted1989 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18837,46 +18881,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1987) + Option::Some(lifted1989) } _ => panic() } - let lifted1990 : String? = match + let lifted1992 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1989 = mbt_ffi_ptr2str( + let result1991 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1989) + Option::Some(result1991) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1986, - max: lifted1988, - unit: lifted1990, + min: lifted1988, + max: lifted1990, + unit: lifted1992, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1991) + @types.SchemaTypeBody::U64Type(lifted1993) } 10 => { - let lifted1998 : @types.NumericRestrictions? = match + let lifted2000 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1993 : @types.NumericBound? = match + let lifted1995 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1992 = match + let lifted1994 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18893,16 +18937,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1992) + Option::Some(lifted1994) } _ => panic() } - let lifted1995 : @types.NumericBound? = match + let lifted1997 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1994 = match + let lifted1996 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18919,46 +18963,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1994) + Option::Some(lifted1996) } _ => panic() } - let lifted1997 : String? = match + let lifted1999 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1996 = mbt_ffi_ptr2str( + let result1998 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1996) + Option::Some(result1998) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1993, - max: lifted1995, - unit: lifted1997, + min: lifted1995, + max: lifted1997, + unit: lifted1999, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1998) + @types.SchemaTypeBody::F32Type(lifted2000) } 11 => { - let lifted2005 : @types.NumericRestrictions? = match + let lifted2007 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2000 : @types.NumericBound? = match + let lifted2002 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1999 = match + let lifted2001 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18975,16 +19019,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1999) + Option::Some(lifted2001) } _ => panic() } - let lifted2002 : @types.NumericBound? = match + let lifted2004 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2001 = match + let lifted2003 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -19001,324 +19045,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2001) + Option::Some(lifted2003) } _ => panic() } - let lifted2004 : String? = match + let lifted2006 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2003 = mbt_ffi_ptr2str( + let result2005 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2003) + Option::Some(result2005) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2000, - max: lifted2002, - unit: lifted2004, + min: lifted2002, + max: lifted2004, + unit: lifted2006, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted2005) + @types.SchemaTypeBody::F64Type(lifted2007) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array2020 : Array[@types.NamedFieldType] = [] - for index2021 = 0 - index2021 < mbt_ffi_load32(iter_base + 12) - index2021 = index2021 + 1 { + let array2022 : Array[@types.NamedFieldType] = [] + for index2023 = 0 + index2023 < mbt_ffi_load32(iter_base + 12) + index2023 = index2023 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2021 * 68 + index2023 * 68 - let result2006 = mbt_ffi_ptr2str( + let result2008 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2008 : String? = match + let lifted2010 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2007 = mbt_ffi_ptr2str( + let result2009 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2007) + Option::Some(result2009) } _ => panic() } - let array2010 : Array[String] = [] - for index2011 = 0 - index2011 < mbt_ffi_load32(iter_base + 28) - index2011 = index2011 + 1 { + let array2012 : Array[String] = [] + for index2013 = 0 + index2013 < mbt_ffi_load32(iter_base + 28) + index2013 = index2013 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2011 * 8 + index2013 * 8 - let result2009 = mbt_ffi_ptr2str( + let result2011 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2010.push(result2009) + array2012.push(result2011) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array2013 : Array[String] = [] - for index2014 = 0 - index2014 < mbt_ffi_load32(iter_base + 36) - index2014 = index2014 + 1 { + let array2015 : Array[String] = [] + for index2016 = 0 + index2016 < mbt_ffi_load32(iter_base + 36) + index2016 = index2016 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index2014 * 8 + index2016 * 8 - let result2012 = mbt_ffi_ptr2str( + let result2014 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2013.push(result2012) + array2015.push(result2014) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted2016 : String? = match + let lifted2018 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result2015 = mbt_ffi_ptr2str( + let result2017 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result2015) + Option::Some(result2017) } _ => panic() } - let lifted2019 : @types.Role? = match + let lifted2021 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted2018 = match + let lifted2020 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2017 = mbt_ffi_ptr2str( + let result2019 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result2017) + @types.Role::Other(result2019) } _ => panic() } - Option::Some(lifted2018) + Option::Some(lifted2020) } _ => panic() } - array2020.push(@types.NamedFieldType::{ - name: result2006, + array2022.push(@types.NamedFieldType::{ + name: result2008, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted2008, - aliases: array2010, - examples: array2013, - deprecated: lifted2016, - role: lifted2019, + doc: lifted2010, + aliases: array2012, + examples: array2015, + deprecated: lifted2018, + role: lifted2021, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array2020) + @types.SchemaTypeBody::RecordType(array2022) } 15 => { - let array2037 : Array[@types.VariantCaseType] = [] - for index2038 = 0 - index2038 < mbt_ffi_load32(iter_base + 12) - index2038 = index2038 + 1 { + let array2039 : Array[@types.VariantCaseType] = [] + for index2040 = 0 + index2040 < mbt_ffi_load32(iter_base + 12) + index2040 = index2040 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2038 * 72 + index2040 * 72 - let result2022 = mbt_ffi_ptr2str( + let result2024 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2023 : Int? = match + let lifted2025 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2025 : String? = match + let lifted2027 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2024 = mbt_ffi_ptr2str( + let result2026 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2024) + Option::Some(result2026) } _ => panic() } - let array2027 : Array[String] = [] - for index2028 = 0 - index2028 < mbt_ffi_load32(iter_base + 32) - index2028 = index2028 + 1 { + let array2029 : Array[String] = [] + for index2030 = 0 + index2030 < mbt_ffi_load32(iter_base + 32) + index2030 = index2030 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2028 * 8 + index2030 * 8 - let result2026 = mbt_ffi_ptr2str( + let result2028 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2027.push(result2026) + array2029.push(result2028) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2030 : Array[String] = [] - for index2031 = 0 - index2031 < mbt_ffi_load32(iter_base + 40) - index2031 = index2031 + 1 { + let array2032 : Array[String] = [] + for index2033 = 0 + index2033 < mbt_ffi_load32(iter_base + 40) + index2033 = index2033 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2031 * 8 + index2033 * 8 - let result2029 = mbt_ffi_ptr2str( + let result2031 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2030.push(result2029) + array2032.push(result2031) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted2033 : String? = match + let lifted2035 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2032 = mbt_ffi_ptr2str( + let result2034 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2032) + Option::Some(result2034) } _ => panic() } - let lifted2036 : @types.Role? = match + let lifted2038 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted2035 = match + let lifted2037 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2034 = mbt_ffi_ptr2str( + let result2036 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result2034) + @types.Role::Other(result2036) } _ => panic() } - Option::Some(lifted2035) + Option::Some(lifted2037) } _ => panic() } - array2037.push(@types.VariantCaseType::{ - name: result2022, - payload: lifted2023, + array2039.push(@types.VariantCaseType::{ + name: result2024, + payload: lifted2025, metadata: @types.MetadataEnvelope::{ - doc: lifted2025, - aliases: array2027, - examples: array2030, - deprecated: lifted2033, - role: lifted2036, + doc: lifted2027, + aliases: array2029, + examples: array2032, + deprecated: lifted2035, + role: lifted2038, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array2037) + @types.SchemaTypeBody::VariantType(array2039) } 16 => { - let array2040 : Array[String] = [] - for index2041 = 0 - index2041 < mbt_ffi_load32(iter_base + 12) - index2041 = index2041 + 1 { + let array2042 : Array[String] = [] + for index2043 = 0 + index2043 < mbt_ffi_load32(iter_base + 12) + index2043 = index2043 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2041 * 8 + index2043 * 8 - let result2039 = mbt_ffi_ptr2str( + let result2041 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2040.push(result2039) + array2042.push(result2041) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array2040) + @types.SchemaTypeBody::EnumType(array2042) } 17 => { - let array2043 : Array[String] = [] - for index2044 = 0 - index2044 < mbt_ffi_load32(iter_base + 12) - index2044 = index2044 + 1 { + let array2045 : Array[String] = [] + for index2046 = 0 + index2046 < mbt_ffi_load32(iter_base + 12) + index2046 = index2046 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2044 * 8 + index2046 * 8 - let result2042 = mbt_ffi_ptr2str( + let result2044 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2043.push(result2042) + array2045.push(result2044) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array2043) + @types.SchemaTypeBody::FlagsType(array2045) } 18 => { - let array2045 : Array[Int] = [] - for index2046 = 0 - index2046 < mbt_ffi_load32(iter_base + 12) - index2046 = index2046 + 1 { + let array2047 : Array[Int] = [] + for index2048 = 0 + index2048 < mbt_ffi_load32(iter_base + 12) + index2048 = index2048 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2046 * 4 + index2048 * 4 - array2045.push(mbt_ffi_load32(iter_base + 0)) + array2047.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array2045) + @types.SchemaTypeBody::TupleType(array2047) } 19 => @types.SchemaTypeBody::ListType( @@ -19339,14 +19383,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted2047 : Int? = match + let lifted2049 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2048 : Int? = match + let lifted2050 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -19354,37 +19398,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted2047, - err: lifted2048, + ok: lifted2049, + err: lifted2050, }) } 24 => { - let lifted2052 : Array[String]? = match + let lifted2054 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2050 : Array[String] = [] - for index2051 = 0 - index2051 < mbt_ffi_load32(iter_base + 16) - index2051 = index2051 + 1 { + let array2052 : Array[String] = [] + for index2053 = 0 + index2053 < mbt_ffi_load32(iter_base + 16) + index2053 = index2053 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2051 * 8 + index2053 * 8 - let result2049 = mbt_ffi_ptr2str( + let result2051 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2050.push(result2049) + array2052.push(result2051) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2050) + Option::Some(array2052) } _ => panic() } - let lifted2053 : UInt? = match + let lifted2055 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -19394,7 +19438,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2054 : UInt? = match + let lifted2056 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -19404,54 +19448,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2056 : String? = match + let lifted2058 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2055 = mbt_ffi_ptr2str( + let result2057 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2055) + Option::Some(result2057) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted2052, - min_length: lifted2053, - max_length: lifted2054, - regex: lifted2056, + languages: lifted2054, + min_length: lifted2055, + max_length: lifted2056, + regex: lifted2058, }) } 25 => { - let lifted2060 : Array[String]? = match + let lifted2062 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2058 : Array[String] = [] - for index2059 = 0 - index2059 < mbt_ffi_load32(iter_base + 16) - index2059 = index2059 + 1 { + let array2060 : Array[String] = [] + for index2061 = 0 + index2061 < mbt_ffi_load32(iter_base + 16) + index2061 = index2061 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2059 * 8 + index2061 * 8 - let result2057 = mbt_ffi_ptr2str( + let result2059 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2058.push(result2057) + array2060.push(result2059) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2058) + Option::Some(array2060) } _ => panic() } - let lifted2061 : UInt? = match + let lifted2063 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -19461,7 +19505,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2062 : UInt? = match + let lifted2064 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -19472,58 +19516,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted2060, - min_bytes: lifted2061, - max_bytes: lifted2062, + mime_types: lifted2062, + min_bytes: lifted2063, + max_bytes: lifted2064, }) } 26 => { - let lifted2066 : Array[String]? = match + let lifted2068 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array2064 : Array[String] = [] - for index2065 = 0 - index2065 < mbt_ffi_load32(iter_base + 20) - index2065 = index2065 + 1 { + let array2066 : Array[String] = [] + for index2067 = 0 + index2067 < mbt_ffi_load32(iter_base + 20) + index2067 = index2067 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2065 * 8 + index2067 * 8 - let result2063 = mbt_ffi_ptr2str( + let result2065 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2064.push(result2063) + array2066.push(result2065) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array2064) + Option::Some(array2066) } _ => panic() } - let lifted2070 : Array[String]? = match + let lifted2072 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array2068 : Array[String] = [] - for index2069 = 0 - index2069 < mbt_ffi_load32(iter_base + 32) - index2069 = index2069 + 1 { + let array2070 : Array[String] = [] + for index2071 = 0 + index2071 < mbt_ffi_load32(iter_base + 32) + index2071 = index2071 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2069 * 8 + index2071 * 8 - let result2067 = mbt_ffi_ptr2str( + let result2069 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2068.push(result2067) + array2070.push(result2069) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array2068) + Option::Some(array2070) } _ => panic() } @@ -19535,95 +19579,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted2066, - allowed_extensions: lifted2070, + allowed_mime_types: lifted2068, + allowed_extensions: lifted2072, }) } 27 => { - let lifted2074 : Array[String]? = match + let lifted2076 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2072 : Array[String] = [] - for index2073 = 0 - index2073 < mbt_ffi_load32(iter_base + 16) - index2073 = index2073 + 1 { + let array2074 : Array[String] = [] + for index2075 = 0 + index2075 < mbt_ffi_load32(iter_base + 16) + index2075 = index2075 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2073 * 8 + index2075 * 8 - let result2071 = mbt_ffi_ptr2str( + let result2073 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2072.push(result2071) + array2074.push(result2073) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2072) + Option::Some(array2074) } _ => panic() } - let lifted2078 : Array[String]? = match + let lifted2080 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array2076 : Array[String] = [] - for index2077 = 0 - index2077 < mbt_ffi_load32(iter_base + 28) - index2077 = index2077 + 1 { + let array2078 : Array[String] = [] + for index2079 = 0 + index2079 < mbt_ffi_load32(iter_base + 28) + index2079 = index2079 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2077 * 8 + index2079 * 8 - let result2075 = mbt_ffi_ptr2str( + let result2077 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2076.push(result2075) + array2078.push(result2077) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array2076) + Option::Some(array2078) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted2074, - allowed_hosts: lifted2078, + allowed_schemes: lifted2076, + allowed_hosts: lifted2080, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result2079 = mbt_ffi_ptr2str( + let result2081 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array2081 : Array[String] = [] - for index2082 = 0 - index2082 < mbt_ffi_load32(iter_base + 20) - index2082 = index2082 + 1 { + let array2083 : Array[String] = [] + for index2084 = 0 + index2084 < mbt_ffi_load32(iter_base + 20) + index2084 = index2084 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2082 * 8 + index2084 * 8 - let result2080 = mbt_ffi_ptr2str( + let result2082 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2081.push(result2080) + array2083.push(result2082) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted2084 : @types.QuantityValue? = match + let lifted2086 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2083 = mbt_ffi_ptr2str( + let result2085 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -19631,17 +19675,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result2083, + unit: result2085, }) } _ => panic() } - let lifted2086 : @types.QuantityValue? = match + let lifted2088 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result2085 = mbt_ffi_ptr2str( + let result2087 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -19649,406 +19693,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result2085, + unit: result2087, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result2079, - allowed_suffixes: array2081, - min: lifted2084, - max: lifted2086, + base_unit: result2081, + allowed_suffixes: array2083, + min: lifted2086, + max: lifted2088, }) } 31 => { - let array2110 : Array[@types.UnionBranch] = [] - for index2111 = 0 - index2111 < mbt_ffi_load32(iter_base + 12) - index2111 = index2111 + 1 { + let array2112 : Array[@types.UnionBranch] = [] + for index2113 = 0 + index2113 < mbt_ffi_load32(iter_base + 12) + index2113 = index2113 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2111 * 92 + index2113 * 92 - let result2087 = mbt_ffi_ptr2str( + let result2089 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2096 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted2098 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result2088 = mbt_ffi_ptr2str( + let result2090 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result2088) + @types.DiscriminatorRule::Prefix(result2090) } 1 => { - let result2089 = mbt_ffi_ptr2str( + let result2091 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result2089) + @types.DiscriminatorRule::Suffix(result2091) } 2 => { - let result2090 = mbt_ffi_ptr2str( + let result2092 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result2090) + @types.DiscriminatorRule::Contains(result2092) } 3 => { - let result2091 = mbt_ffi_ptr2str( + let result2093 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result2091) + @types.DiscriminatorRule::Regex(result2093) } 4 => { - let result2092 = mbt_ffi_ptr2str( + let result2094 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted2094 : String? = match + let lifted2096 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2093 = mbt_ffi_ptr2str( + let result2095 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result2093) + Option::Some(result2095) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result2092, - literal: lifted2094, + field_name: result2094, + literal: lifted2096, }) } 5 => { - let result2095 = mbt_ffi_ptr2str( + let result2097 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result2095) + @types.DiscriminatorRule::FieldAbsent(result2097) } _ => panic() } - let lifted2098 : String? = match + let lifted2100 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2097 = mbt_ffi_ptr2str( + let result2099 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2097) + Option::Some(result2099) } _ => panic() } - let array2100 : Array[String] = [] - for index2101 = 0 - index2101 < mbt_ffi_load32(iter_base + 52) - index2101 = index2101 + 1 { + let array2102 : Array[String] = [] + for index2103 = 0 + index2103 < mbt_ffi_load32(iter_base + 52) + index2103 = index2103 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2101 * 8 + index2103 * 8 - let result2099 = mbt_ffi_ptr2str( + let result2101 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2100.push(result2099) + array2102.push(result2101) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2103 : Array[String] = [] - for index2104 = 0 - index2104 < mbt_ffi_load32(iter_base + 60) - index2104 = index2104 + 1 { + let array2105 : Array[String] = [] + for index2106 = 0 + index2106 < mbt_ffi_load32(iter_base + 60) + index2106 = index2106 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2104 * 8 + index2106 * 8 - let result2102 = mbt_ffi_ptr2str( + let result2104 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2103.push(result2102) + array2105.push(result2104) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted2106 : String? = match + let lifted2108 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2105 = mbt_ffi_ptr2str( + let result2107 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2105) + Option::Some(result2107) } _ => panic() } - let lifted2109 : @types.Role? = match + let lifted2111 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted2108 = match + let lifted2110 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2107 = mbt_ffi_ptr2str( + let result2109 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result2107) + @types.Role::Other(result2109) } _ => panic() } - Option::Some(lifted2108) + Option::Some(lifted2110) } _ => panic() } - array2110.push(@types.UnionBranch::{ - tag: result2087, + array2112.push(@types.UnionBranch::{ + tag: result2089, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted2096, + discriminator: lifted2098, metadata: @types.MetadataEnvelope::{ - doc: lifted2098, - aliases: array2100, - examples: array2103, - deprecated: lifted2106, - role: lifted2109, + doc: lifted2100, + aliases: array2102, + examples: array2105, + deprecated: lifted2108, + role: lifted2111, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array2110, + branches: array2112, }) } 32 => { - let lifted2113 : String? = match + let lifted2115 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2112 = mbt_ffi_ptr2str( + let result2114 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2112) + Option::Some(result2114) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted2113, + category: lifted2115, }) } 33 => { - let lifted2115 : String? = match + let lifted2117 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2114 = mbt_ffi_ptr2str( + let result2116 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2114) + Option::Some(result2116) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted2115, + resource_name: lifted2117, }) } 34 => { - let lifted2116 : Int? = match + let lifted2118 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted2116) + @types.SchemaTypeBody::FutureType(lifted2118) } 35 => { - let lifted2117 : Int? = match + let lifted2119 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted2117) + @types.SchemaTypeBody::StreamType(lifted2119) } _ => panic() } - let lifted2120 : String? = match + let lifted2122 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result2119 = mbt_ffi_ptr2str( + let result2121 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result2119) + Option::Some(result2121) } _ => panic() } - let array2122 : Array[String] = [] - for index2123 = 0 - index2123 < mbt_ffi_load32(iter_base + 104) - index2123 = index2123 + 1 { + let array2124 : Array[String] = [] + for index2125 = 0 + index2125 < mbt_ffi_load32(iter_base + 104) + index2125 = index2125 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index2123 * 8 + index2125 * 8 - let result2121 = mbt_ffi_ptr2str( + let result2123 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2122.push(result2121) + array2124.push(result2123) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array2125 : Array[String] = [] - for index2126 = 0 - index2126 < mbt_ffi_load32(iter_base + 112) - index2126 = index2126 + 1 { + let array2127 : Array[String] = [] + for index2128 = 0 + index2128 < mbt_ffi_load32(iter_base + 112) + index2128 = index2128 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index2126 * 8 + index2128 * 8 - let result2124 = mbt_ffi_ptr2str( + let result2126 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2125.push(result2124) + array2127.push(result2126) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted2128 : String? = match + let lifted2130 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result2127 = mbt_ffi_ptr2str( + let result2129 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result2127) + Option::Some(result2129) } _ => panic() } - let lifted2131 : @types.Role? = match + let lifted2133 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted2130 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted2132 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2129 = mbt_ffi_ptr2str( + let result2131 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result2129) + @types.Role::Other(result2131) } _ => panic() } - Option::Some(lifted2130) + Option::Some(lifted2132) } _ => panic() } - array2132.push(@types.SchemaTypeNode::{ - body: lifted2118, + array2134.push(@types.SchemaTypeNode::{ + body: lifted2120, metadata: @types.MetadataEnvelope::{ - doc: lifted2120, - aliases: array2122, - examples: array2125, - deprecated: lifted2128, - role: lifted2131, + doc: lifted2122, + aliases: array2124, + examples: array2127, + deprecated: lifted2130, + role: lifted2133, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2137 : Array[@types.SchemaTypeDef] = [] - for index2138 = 0 - index2138 < mbt_ffi_load32(iter_base + 40) - index2138 = index2138 + 1 { + let array2139 : Array[@types.SchemaTypeDef] = [] + for index2140 = 0 + index2140 < mbt_ffi_load32(iter_base + 40) + index2140 = index2140 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2138 * 24 + index2140 * 24 - let result2134 = mbt_ffi_ptr2str( + let result2136 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2136 : String? = match + let lifted2138 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2135 = mbt_ffi_ptr2str( + let result2137 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2135) + Option::Some(result2137) } _ => panic() } - array2137.push(@types.SchemaTypeDef::{ - id: result2134, - name: lifted2136, + array2139.push(@types.SchemaTypeDef::{ + id: result2136, + name: lifted2138, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array2168 : Array[@types.SchemaValueNode] = [] - for index2169 = 0 - index2169 < mbt_ffi_load32(iter_base + 52) - index2169 = index2169 + 1 { + let array2170 : Array[@types.SchemaValueNode] = [] + for index2171 = 0 + index2171 < mbt_ffi_load32(iter_base + 52) + index2171 = index2171 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2169 * 32 + index2171 * 32 - let lifted2167 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2169 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -20100,29 +20144,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result2139 = mbt_ffi_ptr2str( + let result2141 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result2139) + @types.SchemaValueNode::StringValue(result2141) } 13 => { - let array2140 : Array[Int] = [] - for index2141 = 0 - index2141 < mbt_ffi_load32(iter_base + 12) - index2141 = index2141 + 1 { + let array2142 : Array[Int] = [] + for index2143 = 0 + index2143 < mbt_ffi_load32(iter_base + 12) + index2143 = index2143 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2141 * 4 + index2143 * 4 - array2140.push(mbt_ffi_load32(iter_base + 0)) + array2142.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array2140) + @types.SchemaValueNode::RecordValue(array2142) } 14 => { - let lifted2142 : Int? = match + let lifted2144 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -20131,7 +20175,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted2142, + payload: lifted2144, }) } 15 => @@ -20139,34 +20183,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array2143 : Array[Bool] = [] - for index2144 = 0 - index2144 < mbt_ffi_load32(iter_base + 12) - index2144 = index2144 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index2144 * 1 - - array2143.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array2143) - } - 17 => { - let array2145 : Array[Int] = [] + let array2145 : Array[Bool] = [] for index2146 = 0 index2146 < mbt_ffi_load32(iter_base + 12) index2146 = index2146 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2146 * 4 + index2146 * 1 - array2145.push(mbt_ffi_load32(iter_base + 0)) + array2145.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array2145) + @types.SchemaValueNode::FlagsValue(array2145) } - 18 => { + 17 => { let array2147 : Array[Int] = [] for index2148 = 0 index2148 < mbt_ffi_load32(iter_base + 12) @@ -20178,9 +20208,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array2147) + @types.SchemaValueNode::TupleValue(array2147) } - 19 => { + 18 => { let array2149 : Array[Int] = [] for index2150 = 0 index2150 < mbt_ffi_load32(iter_base + 12) @@ -20192,127 +20222,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array2149) + @types.SchemaValueNode::ListValue(array2149) } - 20 => { - let array2151 : Array[@types.MapEntry] = [] + 19 => { + let array2151 : Array[Int] = [] for index2152 = 0 index2152 < mbt_ffi_load32(iter_base + 12) index2152 = index2152 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2152 * 8 + index2152 * 4 + + array2151.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array2151) + } + 20 => { + let array2153 : Array[@types.MapEntry] = [] + for index2154 = 0 + index2154 < mbt_ffi_load32(iter_base + 12) + index2154 = index2154 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index2154 * 8 - array2151.push(@types.MapEntry::{ + array2153.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array2151) + @types.SchemaValueNode::MapValue(array2153) } 21 => { - let lifted2153 : Int? = match + let lifted2155 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted2153) + @types.SchemaValueNode::OptionValue(lifted2155) } 22 => { - let lifted2156 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2158 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted2154 : Int? = match + let lifted2156 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted2154) + @types.ResultValuePayload::OkValue(lifted2156) } 1 => { - let lifted2155 : Int? = match + let lifted2157 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted2155) + @types.ResultValuePayload::ErrValue(lifted2157) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted2156) + @types.SchemaValueNode::ResultValue(lifted2158) } 23 => { - let result2157 = mbt_ffi_ptr2str( + let result2159 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2159 : String? = match + let lifted2161 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2158 = mbt_ffi_ptr2str( + let result2160 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2158) + Option::Some(result2160) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result2157, - language: lifted2159, + text: result2159, + language: lifted2161, }) } 24 => { - let result2160 = mbt_ffi_ptr2bytes( + let result2162 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2162 : String? = match + let lifted2164 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2161 = mbt_ffi_ptr2str( + let result2163 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2161) + Option::Some(result2163) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result2160, - mime_type: lifted2162, + bytes: result2162, + mime_type: lifted2164, }) } 25 => { - let result2163 = mbt_ffi_ptr2str( + let result2165 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result2163) + @types.SchemaValueNode::PathValue(result2165) } 26 => { - let result2164 = mbt_ffi_ptr2str( + let result2166 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result2164) + @types.SchemaValueNode::UrlValue(result2166) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -20324,7 +20368,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result2165 = mbt_ffi_ptr2str( + let result2167 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -20332,17 +20376,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result2165, + unit: result2167, }) } 30 => { - let result2166 = mbt_ffi_ptr2str( + let result2168 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result2166, + tag: result2168, body: mbt_ffi_load32(iter_base + 16), }) } @@ -20356,51 +20400,57 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array2168.push(lifted2167) + array2170.push(lifted2169) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) AgentInvocationResult::AgentInitialization(AgentInvocationOutputParameters::{ output: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array2132, - defs: array2137, + type_nodes: array2134, + defs: array2139, root: mbt_ffi_load32(iter_base + 44), }, value: @types.SchemaValueTree::{ - value_nodes: array2168, + value_nodes: array2170, root: mbt_ffi_load32(iter_base + 56), }, }, }) } 1 => { - let array2366 : Array[@types.SchemaTypeNode] = [] - for index2367 = 0 - index2367 < mbt_ffi_load32(iter_base + 32) - index2367 = index2367 + 1 { + let array2368 : Array[@types.SchemaTypeNode] = [] + for index2369 = 0 + index2369 < mbt_ffi_load32(iter_base + 32) + index2369 = index2369 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2367 * 144 + index2369 * 144 - let lifted2352 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2354 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted2176 : @types.NumericRestrictions? = match + let lifted2178 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2171 : @types.NumericBound? = match + let lifted2173 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2170 = match + let lifted2172 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20417,16 +20467,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2170) + Option::Some(lifted2172) } _ => panic() } - let lifted2173 : @types.NumericBound? = match + let lifted2175 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2172 = match + let lifted2174 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20443,46 +20493,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2172) + Option::Some(lifted2174) } _ => panic() } - let lifted2175 : String? = match + let lifted2177 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2174 = mbt_ffi_ptr2str( + let result2176 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2174) + Option::Some(result2176) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2171, - max: lifted2173, - unit: lifted2175, + min: lifted2173, + max: lifted2175, + unit: lifted2177, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted2176) + @types.SchemaTypeBody::S8Type(lifted2178) } 3 => { - let lifted2183 : @types.NumericRestrictions? = match + let lifted2185 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2178 : @types.NumericBound? = match + let lifted2180 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2177 = match + let lifted2179 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20499,16 +20549,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2177) + Option::Some(lifted2179) } _ => panic() } - let lifted2180 : @types.NumericBound? = match + let lifted2182 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2179 = match + let lifted2181 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20525,46 +20575,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2179) + Option::Some(lifted2181) } _ => panic() } - let lifted2182 : String? = match + let lifted2184 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2181 = mbt_ffi_ptr2str( + let result2183 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2181) + Option::Some(result2183) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2178, - max: lifted2180, - unit: lifted2182, + min: lifted2180, + max: lifted2182, + unit: lifted2184, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted2183) + @types.SchemaTypeBody::S16Type(lifted2185) } 4 => { - let lifted2190 : @types.NumericRestrictions? = match + let lifted2192 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2185 : @types.NumericBound? = match + let lifted2187 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2184 = match + let lifted2186 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20581,16 +20631,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2184) + Option::Some(lifted2186) } _ => panic() } - let lifted2187 : @types.NumericBound? = match + let lifted2189 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2186 = match + let lifted2188 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20607,46 +20657,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2186) + Option::Some(lifted2188) } _ => panic() } - let lifted2189 : String? = match + let lifted2191 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2188 = mbt_ffi_ptr2str( + let result2190 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2188) + Option::Some(result2190) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2185, - max: lifted2187, - unit: lifted2189, + min: lifted2187, + max: lifted2189, + unit: lifted2191, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted2190) + @types.SchemaTypeBody::S32Type(lifted2192) } 5 => { - let lifted2197 : @types.NumericRestrictions? = match + let lifted2199 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2192 : @types.NumericBound? = match + let lifted2194 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2191 = match + let lifted2193 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20663,16 +20713,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2191) + Option::Some(lifted2193) } _ => panic() } - let lifted2194 : @types.NumericBound? = match + let lifted2196 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2193 = match + let lifted2195 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20689,46 +20739,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2193) + Option::Some(lifted2195) } _ => panic() } - let lifted2196 : String? = match + let lifted2198 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2195 = mbt_ffi_ptr2str( + let result2197 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2195) + Option::Some(result2197) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2192, - max: lifted2194, - unit: lifted2196, + min: lifted2194, + max: lifted2196, + unit: lifted2198, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted2197) + @types.SchemaTypeBody::S64Type(lifted2199) } 6 => { - let lifted2204 : @types.NumericRestrictions? = match + let lifted2206 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2199 : @types.NumericBound? = match + let lifted2201 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2198 = match + let lifted2200 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20745,16 +20795,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2198) + Option::Some(lifted2200) } _ => panic() } - let lifted2201 : @types.NumericBound? = match + let lifted2203 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2200 = match + let lifted2202 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20771,46 +20821,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2200) + Option::Some(lifted2202) } _ => panic() } - let lifted2203 : String? = match + let lifted2205 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2202 = mbt_ffi_ptr2str( + let result2204 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2202) + Option::Some(result2204) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2199, - max: lifted2201, - unit: lifted2203, + min: lifted2201, + max: lifted2203, + unit: lifted2205, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted2204) + @types.SchemaTypeBody::U8Type(lifted2206) } 7 => { - let lifted2211 : @types.NumericRestrictions? = match + let lifted2213 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2206 : @types.NumericBound? = match + let lifted2208 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2205 = match + let lifted2207 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20827,16 +20877,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2205) + Option::Some(lifted2207) } _ => panic() } - let lifted2208 : @types.NumericBound? = match + let lifted2210 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2207 = match + let lifted2209 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20853,46 +20903,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2207) + Option::Some(lifted2209) } _ => panic() } - let lifted2210 : String? = match + let lifted2212 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2209 = mbt_ffi_ptr2str( + let result2211 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2209) + Option::Some(result2211) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2206, - max: lifted2208, - unit: lifted2210, + min: lifted2208, + max: lifted2210, + unit: lifted2212, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted2211) + @types.SchemaTypeBody::U16Type(lifted2213) } 8 => { - let lifted2218 : @types.NumericRestrictions? = match + let lifted2220 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2213 : @types.NumericBound? = match + let lifted2215 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2212 = match + let lifted2214 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20909,16 +20959,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2212) + Option::Some(lifted2214) } _ => panic() } - let lifted2215 : @types.NumericBound? = match + let lifted2217 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2214 = match + let lifted2216 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20935,46 +20985,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2214) + Option::Some(lifted2216) } _ => panic() } - let lifted2217 : String? = match + let lifted2219 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2216 = mbt_ffi_ptr2str( + let result2218 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2216) + Option::Some(result2218) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2213, - max: lifted2215, - unit: lifted2217, + min: lifted2215, + max: lifted2217, + unit: lifted2219, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted2218) + @types.SchemaTypeBody::U32Type(lifted2220) } 9 => { - let lifted2225 : @types.NumericRestrictions? = match + let lifted2227 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2220 : @types.NumericBound? = match + let lifted2222 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2219 = match + let lifted2221 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20991,16 +21041,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2219) + Option::Some(lifted2221) } _ => panic() } - let lifted2222 : @types.NumericBound? = match + let lifted2224 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2221 = match + let lifted2223 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21017,46 +21067,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2221) + Option::Some(lifted2223) } _ => panic() } - let lifted2224 : String? = match + let lifted2226 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2223 = mbt_ffi_ptr2str( + let result2225 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2223) + Option::Some(result2225) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2220, - max: lifted2222, - unit: lifted2224, + min: lifted2222, + max: lifted2224, + unit: lifted2226, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted2225) + @types.SchemaTypeBody::U64Type(lifted2227) } 10 => { - let lifted2232 : @types.NumericRestrictions? = match + let lifted2234 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2227 : @types.NumericBound? = match + let lifted2229 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2226 = match + let lifted2228 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21073,16 +21123,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2226) + Option::Some(lifted2228) } _ => panic() } - let lifted2229 : @types.NumericBound? = match + let lifted2231 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2228 = match + let lifted2230 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21099,46 +21149,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2228) + Option::Some(lifted2230) } _ => panic() } - let lifted2231 : String? = match + let lifted2233 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2230 = mbt_ffi_ptr2str( + let result2232 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2230) + Option::Some(result2232) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2227, - max: lifted2229, - unit: lifted2231, + min: lifted2229, + max: lifted2231, + unit: lifted2233, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted2232) + @types.SchemaTypeBody::F32Type(lifted2234) } 11 => { - let lifted2239 : @types.NumericRestrictions? = match + let lifted2241 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2234 : @types.NumericBound? = match + let lifted2236 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2233 = match + let lifted2235 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21155,16 +21205,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2233) + Option::Some(lifted2235) } _ => panic() } - let lifted2236 : @types.NumericBound? = match + let lifted2238 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2235 = match + let lifted2237 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21181,324 +21231,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2235) + Option::Some(lifted2237) } _ => panic() } - let lifted2238 : String? = match + let lifted2240 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2237 = mbt_ffi_ptr2str( + let result2239 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2237) + Option::Some(result2239) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2234, - max: lifted2236, - unit: lifted2238, + min: lifted2236, + max: lifted2238, + unit: lifted2240, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted2239) + @types.SchemaTypeBody::F64Type(lifted2241) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array2254 : Array[@types.NamedFieldType] = [] - for index2255 = 0 - index2255 < mbt_ffi_load32(iter_base + 12) - index2255 = index2255 + 1 { + let array2256 : Array[@types.NamedFieldType] = [] + for index2257 = 0 + index2257 < mbt_ffi_load32(iter_base + 12) + index2257 = index2257 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2255 * 68 + index2257 * 68 - let result2240 = mbt_ffi_ptr2str( + let result2242 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2242 : String? = match + let lifted2244 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2241 = mbt_ffi_ptr2str( + let result2243 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2241) + Option::Some(result2243) } _ => panic() } - let array2244 : Array[String] = [] - for index2245 = 0 - index2245 < mbt_ffi_load32(iter_base + 28) - index2245 = index2245 + 1 { + let array2246 : Array[String] = [] + for index2247 = 0 + index2247 < mbt_ffi_load32(iter_base + 28) + index2247 = index2247 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2245 * 8 + index2247 * 8 - let result2243 = mbt_ffi_ptr2str( + let result2245 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2244.push(result2243) + array2246.push(result2245) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array2247 : Array[String] = [] - for index2248 = 0 - index2248 < mbt_ffi_load32(iter_base + 36) - index2248 = index2248 + 1 { + let array2249 : Array[String] = [] + for index2250 = 0 + index2250 < mbt_ffi_load32(iter_base + 36) + index2250 = index2250 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index2248 * 8 + index2250 * 8 - let result2246 = mbt_ffi_ptr2str( + let result2248 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2247.push(result2246) + array2249.push(result2248) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted2250 : String? = match + let lifted2252 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result2249 = mbt_ffi_ptr2str( + let result2251 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result2249) + Option::Some(result2251) } _ => panic() } - let lifted2253 : @types.Role? = match + let lifted2255 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted2252 = match + let lifted2254 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2251 = mbt_ffi_ptr2str( + let result2253 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result2251) + @types.Role::Other(result2253) } _ => panic() } - Option::Some(lifted2252) + Option::Some(lifted2254) } _ => panic() } - array2254.push(@types.NamedFieldType::{ - name: result2240, + array2256.push(@types.NamedFieldType::{ + name: result2242, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted2242, - aliases: array2244, - examples: array2247, - deprecated: lifted2250, - role: lifted2253, + doc: lifted2244, + aliases: array2246, + examples: array2249, + deprecated: lifted2252, + role: lifted2255, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array2254) + @types.SchemaTypeBody::RecordType(array2256) } 15 => { - let array2271 : Array[@types.VariantCaseType] = [] - for index2272 = 0 - index2272 < mbt_ffi_load32(iter_base + 12) - index2272 = index2272 + 1 { + let array2273 : Array[@types.VariantCaseType] = [] + for index2274 = 0 + index2274 < mbt_ffi_load32(iter_base + 12) + index2274 = index2274 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2272 * 72 + index2274 * 72 - let result2256 = mbt_ffi_ptr2str( + let result2258 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2257 : Int? = match + let lifted2259 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2259 : String? = match + let lifted2261 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2258 = mbt_ffi_ptr2str( + let result2260 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2258) + Option::Some(result2260) } _ => panic() } - let array2261 : Array[String] = [] - for index2262 = 0 - index2262 < mbt_ffi_load32(iter_base + 32) - index2262 = index2262 + 1 { + let array2263 : Array[String] = [] + for index2264 = 0 + index2264 < mbt_ffi_load32(iter_base + 32) + index2264 = index2264 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2262 * 8 + index2264 * 8 - let result2260 = mbt_ffi_ptr2str( + let result2262 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2261.push(result2260) + array2263.push(result2262) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2264 : Array[String] = [] - for index2265 = 0 - index2265 < mbt_ffi_load32(iter_base + 40) - index2265 = index2265 + 1 { + let array2266 : Array[String] = [] + for index2267 = 0 + index2267 < mbt_ffi_load32(iter_base + 40) + index2267 = index2267 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2265 * 8 + index2267 * 8 - let result2263 = mbt_ffi_ptr2str( + let result2265 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2264.push(result2263) + array2266.push(result2265) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted2267 : String? = match + let lifted2269 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2266 = mbt_ffi_ptr2str( + let result2268 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2266) + Option::Some(result2268) } _ => panic() } - let lifted2270 : @types.Role? = match + let lifted2272 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted2269 = match + let lifted2271 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2268 = mbt_ffi_ptr2str( + let result2270 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result2268) + @types.Role::Other(result2270) } _ => panic() } - Option::Some(lifted2269) + Option::Some(lifted2271) } _ => panic() } - array2271.push(@types.VariantCaseType::{ - name: result2256, - payload: lifted2257, + array2273.push(@types.VariantCaseType::{ + name: result2258, + payload: lifted2259, metadata: @types.MetadataEnvelope::{ - doc: lifted2259, - aliases: array2261, - examples: array2264, - deprecated: lifted2267, - role: lifted2270, + doc: lifted2261, + aliases: array2263, + examples: array2266, + deprecated: lifted2269, + role: lifted2272, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array2271) + @types.SchemaTypeBody::VariantType(array2273) } 16 => { - let array2274 : Array[String] = [] - for index2275 = 0 - index2275 < mbt_ffi_load32(iter_base + 12) - index2275 = index2275 + 1 { + let array2276 : Array[String] = [] + for index2277 = 0 + index2277 < mbt_ffi_load32(iter_base + 12) + index2277 = index2277 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2275 * 8 + index2277 * 8 - let result2273 = mbt_ffi_ptr2str( + let result2275 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2274.push(result2273) + array2276.push(result2275) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array2274) + @types.SchemaTypeBody::EnumType(array2276) } 17 => { - let array2277 : Array[String] = [] - for index2278 = 0 - index2278 < mbt_ffi_load32(iter_base + 12) - index2278 = index2278 + 1 { + let array2279 : Array[String] = [] + for index2280 = 0 + index2280 < mbt_ffi_load32(iter_base + 12) + index2280 = index2280 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2278 * 8 + index2280 * 8 - let result2276 = mbt_ffi_ptr2str( + let result2278 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2277.push(result2276) + array2279.push(result2278) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array2277) + @types.SchemaTypeBody::FlagsType(array2279) } 18 => { - let array2279 : Array[Int] = [] - for index2280 = 0 - index2280 < mbt_ffi_load32(iter_base + 12) - index2280 = index2280 + 1 { + let array2281 : Array[Int] = [] + for index2282 = 0 + index2282 < mbt_ffi_load32(iter_base + 12) + index2282 = index2282 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2280 * 4 + index2282 * 4 - array2279.push(mbt_ffi_load32(iter_base + 0)) + array2281.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array2279) + @types.SchemaTypeBody::TupleType(array2281) } 19 => @types.SchemaTypeBody::ListType( @@ -21519,14 +21569,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted2281 : Int? = match + let lifted2283 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2282 : Int? = match + let lifted2284 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -21534,37 +21584,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted2281, - err: lifted2282, + ok: lifted2283, + err: lifted2284, }) } 24 => { - let lifted2286 : Array[String]? = match + let lifted2288 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2284 : Array[String] = [] - for index2285 = 0 - index2285 < mbt_ffi_load32(iter_base + 16) - index2285 = index2285 + 1 { + let array2286 : Array[String] = [] + for index2287 = 0 + index2287 < mbt_ffi_load32(iter_base + 16) + index2287 = index2287 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2285 * 8 + index2287 * 8 - let result2283 = mbt_ffi_ptr2str( + let result2285 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2284.push(result2283) + array2286.push(result2285) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2284) + Option::Some(array2286) } _ => panic() } - let lifted2287 : UInt? = match + let lifted2289 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -21574,7 +21624,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2288 : UInt? = match + let lifted2290 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -21584,54 +21634,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2290 : String? = match + let lifted2292 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2289 = mbt_ffi_ptr2str( + let result2291 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2289) + Option::Some(result2291) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted2286, - min_length: lifted2287, - max_length: lifted2288, - regex: lifted2290, + languages: lifted2288, + min_length: lifted2289, + max_length: lifted2290, + regex: lifted2292, }) } 25 => { - let lifted2294 : Array[String]? = match + let lifted2296 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2292 : Array[String] = [] - for index2293 = 0 - index2293 < mbt_ffi_load32(iter_base + 16) - index2293 = index2293 + 1 { + let array2294 : Array[String] = [] + for index2295 = 0 + index2295 < mbt_ffi_load32(iter_base + 16) + index2295 = index2295 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2293 * 8 + index2295 * 8 - let result2291 = mbt_ffi_ptr2str( + let result2293 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2292.push(result2291) + array2294.push(result2293) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2292) + Option::Some(array2294) } _ => panic() } - let lifted2295 : UInt? = match + let lifted2297 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -21641,7 +21691,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2296 : UInt? = match + let lifted2298 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -21652,58 +21702,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted2294, - min_bytes: lifted2295, - max_bytes: lifted2296, + mime_types: lifted2296, + min_bytes: lifted2297, + max_bytes: lifted2298, }) } 26 => { - let lifted2300 : Array[String]? = match + let lifted2302 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array2298 : Array[String] = [] - for index2299 = 0 - index2299 < mbt_ffi_load32(iter_base + 20) - index2299 = index2299 + 1 { + let array2300 : Array[String] = [] + for index2301 = 0 + index2301 < mbt_ffi_load32(iter_base + 20) + index2301 = index2301 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2299 * 8 + index2301 * 8 - let result2297 = mbt_ffi_ptr2str( + let result2299 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2298.push(result2297) + array2300.push(result2299) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array2298) + Option::Some(array2300) } _ => panic() } - let lifted2304 : Array[String]? = match + let lifted2306 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array2302 : Array[String] = [] - for index2303 = 0 - index2303 < mbt_ffi_load32(iter_base + 32) - index2303 = index2303 + 1 { + let array2304 : Array[String] = [] + for index2305 = 0 + index2305 < mbt_ffi_load32(iter_base + 32) + index2305 = index2305 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2303 * 8 + index2305 * 8 - let result2301 = mbt_ffi_ptr2str( + let result2303 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2302.push(result2301) + array2304.push(result2303) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array2302) + Option::Some(array2304) } _ => panic() } @@ -21715,95 +21765,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted2300, - allowed_extensions: lifted2304, + allowed_mime_types: lifted2302, + allowed_extensions: lifted2306, }) } 27 => { - let lifted2308 : Array[String]? = match + let lifted2310 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2306 : Array[String] = [] - for index2307 = 0 - index2307 < mbt_ffi_load32(iter_base + 16) - index2307 = index2307 + 1 { + let array2308 : Array[String] = [] + for index2309 = 0 + index2309 < mbt_ffi_load32(iter_base + 16) + index2309 = index2309 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2307 * 8 + index2309 * 8 - let result2305 = mbt_ffi_ptr2str( + let result2307 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2306.push(result2305) + array2308.push(result2307) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2306) + Option::Some(array2308) } _ => panic() } - let lifted2312 : Array[String]? = match + let lifted2314 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array2310 : Array[String] = [] - for index2311 = 0 - index2311 < mbt_ffi_load32(iter_base + 28) - index2311 = index2311 + 1 { + let array2312 : Array[String] = [] + for index2313 = 0 + index2313 < mbt_ffi_load32(iter_base + 28) + index2313 = index2313 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2311 * 8 + index2313 * 8 - let result2309 = mbt_ffi_ptr2str( + let result2311 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2310.push(result2309) + array2312.push(result2311) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array2310) + Option::Some(array2312) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted2308, - allowed_hosts: lifted2312, + allowed_schemes: lifted2310, + allowed_hosts: lifted2314, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result2313 = mbt_ffi_ptr2str( + let result2315 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array2315 : Array[String] = [] - for index2316 = 0 - index2316 < mbt_ffi_load32(iter_base + 20) - index2316 = index2316 + 1 { + let array2317 : Array[String] = [] + for index2318 = 0 + index2318 < mbt_ffi_load32(iter_base + 20) + index2318 = index2318 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2316 * 8 + index2318 * 8 - let result2314 = mbt_ffi_ptr2str( + let result2316 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2315.push(result2314) + array2317.push(result2316) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted2318 : @types.QuantityValue? = match + let lifted2320 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2317 = mbt_ffi_ptr2str( + let result2319 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -21811,17 +21861,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result2317, + unit: result2319, }) } _ => panic() } - let lifted2320 : @types.QuantityValue? = match + let lifted2322 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result2319 = mbt_ffi_ptr2str( + let result2321 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -21829,406 +21879,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result2319, + unit: result2321, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result2313, - allowed_suffixes: array2315, - min: lifted2318, - max: lifted2320, + base_unit: result2315, + allowed_suffixes: array2317, + min: lifted2320, + max: lifted2322, }) } 31 => { - let array2344 : Array[@types.UnionBranch] = [] - for index2345 = 0 - index2345 < mbt_ffi_load32(iter_base + 12) - index2345 = index2345 + 1 { + let array2346 : Array[@types.UnionBranch] = [] + for index2347 = 0 + index2347 < mbt_ffi_load32(iter_base + 12) + index2347 = index2347 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2345 * 92 + index2347 * 92 - let result2321 = mbt_ffi_ptr2str( + let result2323 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2330 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted2332 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result2322 = mbt_ffi_ptr2str( + let result2324 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result2322) + @types.DiscriminatorRule::Prefix(result2324) } 1 => { - let result2323 = mbt_ffi_ptr2str( + let result2325 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result2323) + @types.DiscriminatorRule::Suffix(result2325) } 2 => { - let result2324 = mbt_ffi_ptr2str( + let result2326 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result2324) + @types.DiscriminatorRule::Contains(result2326) } 3 => { - let result2325 = mbt_ffi_ptr2str( + let result2327 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result2325) + @types.DiscriminatorRule::Regex(result2327) } 4 => { - let result2326 = mbt_ffi_ptr2str( + let result2328 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted2328 : String? = match + let lifted2330 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2327 = mbt_ffi_ptr2str( + let result2329 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result2327) + Option::Some(result2329) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result2326, - literal: lifted2328, + field_name: result2328, + literal: lifted2330, }) } 5 => { - let result2329 = mbt_ffi_ptr2str( + let result2331 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result2329) + @types.DiscriminatorRule::FieldAbsent(result2331) } _ => panic() } - let lifted2332 : String? = match + let lifted2334 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2331 = mbt_ffi_ptr2str( + let result2333 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2331) + Option::Some(result2333) } _ => panic() } - let array2334 : Array[String] = [] - for index2335 = 0 - index2335 < mbt_ffi_load32(iter_base + 52) - index2335 = index2335 + 1 { + let array2336 : Array[String] = [] + for index2337 = 0 + index2337 < mbt_ffi_load32(iter_base + 52) + index2337 = index2337 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2335 * 8 + index2337 * 8 - let result2333 = mbt_ffi_ptr2str( + let result2335 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2334.push(result2333) + array2336.push(result2335) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2337 : Array[String] = [] - for index2338 = 0 - index2338 < mbt_ffi_load32(iter_base + 60) - index2338 = index2338 + 1 { + let array2339 : Array[String] = [] + for index2340 = 0 + index2340 < mbt_ffi_load32(iter_base + 60) + index2340 = index2340 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2338 * 8 + index2340 * 8 - let result2336 = mbt_ffi_ptr2str( + let result2338 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2337.push(result2336) + array2339.push(result2338) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted2340 : String? = match + let lifted2342 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2339 = mbt_ffi_ptr2str( + let result2341 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2339) + Option::Some(result2341) } _ => panic() } - let lifted2343 : @types.Role? = match + let lifted2345 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted2342 = match + let lifted2344 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2341 = mbt_ffi_ptr2str( + let result2343 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result2341) + @types.Role::Other(result2343) } _ => panic() } - Option::Some(lifted2342) + Option::Some(lifted2344) } _ => panic() } - array2344.push(@types.UnionBranch::{ - tag: result2321, + array2346.push(@types.UnionBranch::{ + tag: result2323, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted2330, + discriminator: lifted2332, metadata: @types.MetadataEnvelope::{ - doc: lifted2332, - aliases: array2334, - examples: array2337, - deprecated: lifted2340, - role: lifted2343, + doc: lifted2334, + aliases: array2336, + examples: array2339, + deprecated: lifted2342, + role: lifted2345, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array2344, + branches: array2346, }) } 32 => { - let lifted2347 : String? = match + let lifted2349 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2346 = mbt_ffi_ptr2str( + let result2348 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2346) + Option::Some(result2348) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted2347, + category: lifted2349, }) } 33 => { - let lifted2349 : String? = match + let lifted2351 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2348 = mbt_ffi_ptr2str( + let result2350 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2348) + Option::Some(result2350) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted2349, + resource_name: lifted2351, }) } 34 => { - let lifted2350 : Int? = match + let lifted2352 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted2350) + @types.SchemaTypeBody::FutureType(lifted2352) } 35 => { - let lifted2351 : Int? = match + let lifted2353 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted2351) + @types.SchemaTypeBody::StreamType(lifted2353) } _ => panic() } - let lifted2354 : String? = match + let lifted2356 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result2353 = mbt_ffi_ptr2str( + let result2355 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result2353) + Option::Some(result2355) } _ => panic() } - let array2356 : Array[String] = [] - for index2357 = 0 - index2357 < mbt_ffi_load32(iter_base + 104) - index2357 = index2357 + 1 { + let array2358 : Array[String] = [] + for index2359 = 0 + index2359 < mbt_ffi_load32(iter_base + 104) + index2359 = index2359 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index2357 * 8 + index2359 * 8 - let result2355 = mbt_ffi_ptr2str( + let result2357 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2356.push(result2355) + array2358.push(result2357) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array2359 : Array[String] = [] - for index2360 = 0 - index2360 < mbt_ffi_load32(iter_base + 112) - index2360 = index2360 + 1 { + let array2361 : Array[String] = [] + for index2362 = 0 + index2362 < mbt_ffi_load32(iter_base + 112) + index2362 = index2362 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index2360 * 8 + index2362 * 8 - let result2358 = mbt_ffi_ptr2str( + let result2360 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2359.push(result2358) + array2361.push(result2360) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted2362 : String? = match + let lifted2364 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result2361 = mbt_ffi_ptr2str( + let result2363 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result2361) + Option::Some(result2363) } _ => panic() } - let lifted2365 : @types.Role? = match + let lifted2367 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted2364 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted2366 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2363 = mbt_ffi_ptr2str( + let result2365 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result2363) + @types.Role::Other(result2365) } _ => panic() } - Option::Some(lifted2364) + Option::Some(lifted2366) } _ => panic() } - array2366.push(@types.SchemaTypeNode::{ - body: lifted2352, + array2368.push(@types.SchemaTypeNode::{ + body: lifted2354, metadata: @types.MetadataEnvelope::{ - doc: lifted2354, - aliases: array2356, - examples: array2359, - deprecated: lifted2362, - role: lifted2365, + doc: lifted2356, + aliases: array2358, + examples: array2361, + deprecated: lifted2364, + role: lifted2367, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2371 : Array[@types.SchemaTypeDef] = [] - for index2372 = 0 - index2372 < mbt_ffi_load32(iter_base + 40) - index2372 = index2372 + 1 { + let array2373 : Array[@types.SchemaTypeDef] = [] + for index2374 = 0 + index2374 < mbt_ffi_load32(iter_base + 40) + index2374 = index2374 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2372 * 24 + index2374 * 24 - let result2368 = mbt_ffi_ptr2str( + let result2370 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2370 : String? = match + let lifted2372 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2369 = mbt_ffi_ptr2str( + let result2371 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2369) + Option::Some(result2371) } _ => panic() } - array2371.push(@types.SchemaTypeDef::{ - id: result2368, - name: lifted2370, + array2373.push(@types.SchemaTypeDef::{ + id: result2370, + name: lifted2372, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array2402 : Array[@types.SchemaValueNode] = [] - for index2403 = 0 - index2403 < mbt_ffi_load32(iter_base + 52) - index2403 = index2403 + 1 { + let array2404 : Array[@types.SchemaValueNode] = [] + for index2405 = 0 + index2405 < mbt_ffi_load32(iter_base + 52) + index2405 = index2405 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2403 * 32 + index2405 * 32 - let lifted2401 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2403 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -22280,29 +22330,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result2373 = mbt_ffi_ptr2str( + let result2375 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result2373) + @types.SchemaValueNode::StringValue(result2375) } 13 => { - let array2374 : Array[Int] = [] - for index2375 = 0 - index2375 < mbt_ffi_load32(iter_base + 12) - index2375 = index2375 + 1 { + let array2376 : Array[Int] = [] + for index2377 = 0 + index2377 < mbt_ffi_load32(iter_base + 12) + index2377 = index2377 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2375 * 4 + index2377 * 4 - array2374.push(mbt_ffi_load32(iter_base + 0)) + array2376.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array2374) + @types.SchemaValueNode::RecordValue(array2376) } 14 => { - let lifted2376 : Int? = match + let lifted2378 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -22311,7 +22361,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted2376, + payload: lifted2378, }) } 15 => @@ -22319,34 +22369,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array2377 : Array[Bool] = [] - for index2378 = 0 - index2378 < mbt_ffi_load32(iter_base + 12) - index2378 = index2378 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index2378 * 1 - - array2377.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array2377) - } - 17 => { - let array2379 : Array[Int] = [] + let array2379 : Array[Bool] = [] for index2380 = 0 index2380 < mbt_ffi_load32(iter_base + 12) index2380 = index2380 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2380 * 4 + index2380 * 1 - array2379.push(mbt_ffi_load32(iter_base + 0)) + array2379.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array2379) + @types.SchemaValueNode::FlagsValue(array2379) } - 18 => { + 17 => { let array2381 : Array[Int] = [] for index2382 = 0 index2382 < mbt_ffi_load32(iter_base + 12) @@ -22358,9 +22394,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array2381) + @types.SchemaValueNode::TupleValue(array2381) } - 19 => { + 18 => { let array2383 : Array[Int] = [] for index2384 = 0 index2384 < mbt_ffi_load32(iter_base + 12) @@ -22372,127 +22408,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array2383) + @types.SchemaValueNode::ListValue(array2383) } - 20 => { - let array2385 : Array[@types.MapEntry] = [] + 19 => { + let array2385 : Array[Int] = [] for index2386 = 0 index2386 < mbt_ffi_load32(iter_base + 12) index2386 = index2386 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2386 * 8 + index2386 * 4 - array2385.push(@types.MapEntry::{ + array2385.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array2385) + } + 20 => { + let array2387 : Array[@types.MapEntry] = [] + for index2388 = 0 + index2388 < mbt_ffi_load32(iter_base + 12) + index2388 = index2388 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index2388 * 8 + + array2387.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array2385) + @types.SchemaValueNode::MapValue(array2387) } 21 => { - let lifted2387 : Int? = match + let lifted2389 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted2387) + @types.SchemaValueNode::OptionValue(lifted2389) } 22 => { - let lifted2390 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2392 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted2388 : Int? = match + let lifted2390 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted2388) + @types.ResultValuePayload::OkValue(lifted2390) } 1 => { - let lifted2389 : Int? = match + let lifted2391 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted2389) + @types.ResultValuePayload::ErrValue(lifted2391) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted2390) + @types.SchemaValueNode::ResultValue(lifted2392) } 23 => { - let result2391 = mbt_ffi_ptr2str( + let result2393 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2393 : String? = match + let lifted2395 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2392 = mbt_ffi_ptr2str( + let result2394 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2392) + Option::Some(result2394) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result2391, - language: lifted2393, + text: result2393, + language: lifted2395, }) } 24 => { - let result2394 = mbt_ffi_ptr2bytes( + let result2396 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2396 : String? = match + let lifted2398 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2395 = mbt_ffi_ptr2str( + let result2397 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2395) + Option::Some(result2397) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result2394, - mime_type: lifted2396, + bytes: result2396, + mime_type: lifted2398, }) } 25 => { - let result2397 = mbt_ffi_ptr2str( + let result2399 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result2397) + @types.SchemaValueNode::PathValue(result2399) } 26 => { - let result2398 = mbt_ffi_ptr2str( + let result2400 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result2398) + @types.SchemaValueNode::UrlValue(result2400) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -22504,7 +22554,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result2399 = mbt_ffi_ptr2str( + let result2401 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -22512,17 +22562,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result2399, + unit: result2401, }) } 30 => { - let result2400 = mbt_ffi_ptr2str( + let result2402 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result2400, + tag: result2402, body: mbt_ffi_load32(iter_base + 16), }) } @@ -22536,22 +22586,28 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array2402.push(lifted2401) + array2404.push(lifted2403) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) AgentInvocationResult::AgentMethod(AgentInvocationOutputParameters::{ output: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array2366, - defs: array2371, + type_nodes: array2368, + defs: array2373, root: mbt_ffi_load32(iter_base + 44), }, value: @types.SchemaValueTree::{ - value_nodes: array2402, + value_nodes: array2404, root: mbt_ffi_load32(iter_base + 56), }, }, @@ -22559,73 +22615,73 @@ pub fn enrich_oplog_entries( } 2 => AgentInvocationResult::ManualUpdate 3 => { - let lifted2405 : String? = match + let lifted2407 : String? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => { - let result2404 = mbt_ffi_ptr2str( + let result2406 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - Option::Some(result2404) + Option::Some(result2406) } _ => panic() } AgentInvocationResult::LoadSnapshot(FallibleResultParameters::{ - error: lifted2405, + error: lifted2407, }) } 4 => { - let result2406 = mbt_ffi_ptr2bytes( + let result2408 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - let result2407 = mbt_ffi_ptr2str( + let result2409 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) AgentInvocationResult::SaveSnapshot(SaveSnapshotResultParameters::{ snapshot: SnapshotData::{ - data: result2406, - mime_type: result2407, + data: result2408, + mime_type: result2409, }, }) } 5 => { - let lifted2409 : String? = match + let lifted2411 : String? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => { - let result2408 = mbt_ffi_ptr2str( + let result2410 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - Option::Some(result2408) + Option::Some(result2410) } _ => panic() } AgentInvocationResult::ProcessOplogEntries(FallibleResultParameters::{ - error: lifted2409, + error: lifted2411, }) } _ => panic() } - let lifted2412 : String? = match mbt_ffi_load8_u(iter_base + 60) { + let lifted2414 : String? = match mbt_ffi_load8_u(iter_base + 60) { 0 => Option::None 1 => { - let result2411 = mbt_ffi_ptr2str( + let result2413 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - Option::Some(result2411) + Option::Some(result2413) } _ => panic() } @@ -22635,8 +22691,8 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - result: lifted2410, - method_name: lifted2412, + result: lifted2412, + method_name: lifted2414, consumed_fuel: mbt_ffi_load64(iter_base + 72), component_revision: mbt_ffi_load64(iter_base + 80).reinterpret_as_uint64(), }) @@ -22649,23 +22705,23 @@ pub fn enrich_oplog_entries( }, }) 7 => { - let result2413 = mbt_ffi_ptr2str( + let result2415 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let lifted2417 : RetryPolicyState? = match + let lifted2419 : RetryPolicyState? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let array2415 : Array[StateNode] = [] - for index2416 = 0 - index2416 < mbt_ffi_load32(iter_base + 52) - index2416 = index2416 + 1 { + let array2417 : Array[StateNode] = [] + for index2418 = 0 + index2418 < mbt_ffi_load32(iter_base + 52) + index2418 = index2418 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2416 * 16 + index2418 * 16 - let lifted2414 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2416 = match mbt_ffi_load8_u(iter_base + 0) { 0 => StateNode::Counter( mbt_ffi_load32(iter_base + 4).reinterpret_as_uint(), @@ -22691,11 +22747,11 @@ pub fn enrich_oplog_entries( _ => panic() } - array2415.push(lifted2414) + array2417.push(lifted2416) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - Option::Some(RetryPolicyState::{ nodes: array2415 }) + Option::Some(RetryPolicyState::{ nodes: array2417 }) } _ => panic() } @@ -22705,10 +22761,10 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - error: result2413, + error: result2415, retry_from: mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), inside_atomic_region: mbt_ffi_load8_u(iter_base + 40) != 0, - retry_policy_state: lifted2417, + retry_policy_state: lifted2419, }) } 8 => @@ -22759,36 +22815,36 @@ pub fn enrich_oplog_entries( begin_index: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), }) 14 => { - let lifted2930 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted2932 = match mbt_ffi_load8_u(iter_base + 24) { 0 => { - let result2418 = mbt_ffi_ptr2str( + let result2420 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let array2615 : Array[@types.SchemaTypeNode] = [] - for index2616 = 0 - index2616 < mbt_ffi_load32(iter_base + 44) - index2616 = index2616 + 1 { + let array2617 : Array[@types.SchemaTypeNode] = [] + for index2618 = 0 + index2618 < mbt_ffi_load32(iter_base + 44) + index2618 = index2618 + 1 { let iter_base = mbt_ffi_load32(iter_base + 40) + - index2616 * 144 + index2618 * 144 - let lifted2601 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2603 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted2425 : @types.NumericRestrictions? = match + let lifted2427 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2420 : @types.NumericBound? = match + let lifted2422 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2419 = match + let lifted2421 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -22805,16 +22861,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2419) + Option::Some(lifted2421) } _ => panic() } - let lifted2422 : @types.NumericBound? = match + let lifted2424 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2421 = match + let lifted2423 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -22831,46 +22887,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2421) + Option::Some(lifted2423) } _ => panic() } - let lifted2424 : String? = match + let lifted2426 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2423 = mbt_ffi_ptr2str( + let result2425 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2423) + Option::Some(result2425) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2420, - max: lifted2422, - unit: lifted2424, + min: lifted2422, + max: lifted2424, + unit: lifted2426, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted2425) + @types.SchemaTypeBody::S8Type(lifted2427) } 3 => { - let lifted2432 : @types.NumericRestrictions? = match + let lifted2434 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2427 : @types.NumericBound? = match + let lifted2429 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2426 = match + let lifted2428 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -22887,16 +22943,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2426) + Option::Some(lifted2428) } _ => panic() } - let lifted2429 : @types.NumericBound? = match + let lifted2431 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2428 = match + let lifted2430 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -22913,46 +22969,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2428) + Option::Some(lifted2430) } _ => panic() } - let lifted2431 : String? = match + let lifted2433 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2430 = mbt_ffi_ptr2str( + let result2432 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2430) + Option::Some(result2432) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2427, - max: lifted2429, - unit: lifted2431, + min: lifted2429, + max: lifted2431, + unit: lifted2433, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted2432) + @types.SchemaTypeBody::S16Type(lifted2434) } 4 => { - let lifted2439 : @types.NumericRestrictions? = match + let lifted2441 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2434 : @types.NumericBound? = match + let lifted2436 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2433 = match + let lifted2435 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -22969,16 +23025,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2433) + Option::Some(lifted2435) } _ => panic() } - let lifted2436 : @types.NumericBound? = match + let lifted2438 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2435 = match + let lifted2437 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -22995,46 +23051,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2435) + Option::Some(lifted2437) } _ => panic() } - let lifted2438 : String? = match + let lifted2440 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2437 = mbt_ffi_ptr2str( + let result2439 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2437) + Option::Some(result2439) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2434, - max: lifted2436, - unit: lifted2438, + min: lifted2436, + max: lifted2438, + unit: lifted2440, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted2439) + @types.SchemaTypeBody::S32Type(lifted2441) } 5 => { - let lifted2446 : @types.NumericRestrictions? = match + let lifted2448 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2441 : @types.NumericBound? = match + let lifted2443 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2440 = match + let lifted2442 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23051,16 +23107,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2440) + Option::Some(lifted2442) } _ => panic() } - let lifted2443 : @types.NumericBound? = match + let lifted2445 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2442 = match + let lifted2444 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23077,46 +23133,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2442) + Option::Some(lifted2444) } _ => panic() } - let lifted2445 : String? = match + let lifted2447 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2444 = mbt_ffi_ptr2str( + let result2446 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2444) + Option::Some(result2446) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2441, - max: lifted2443, - unit: lifted2445, + min: lifted2443, + max: lifted2445, + unit: lifted2447, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted2446) + @types.SchemaTypeBody::S64Type(lifted2448) } 6 => { - let lifted2453 : @types.NumericRestrictions? = match + let lifted2455 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2448 : @types.NumericBound? = match + let lifted2450 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2447 = match + let lifted2449 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23133,16 +23189,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2447) + Option::Some(lifted2449) } _ => panic() } - let lifted2450 : @types.NumericBound? = match + let lifted2452 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2449 = match + let lifted2451 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23159,46 +23215,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2449) + Option::Some(lifted2451) } _ => panic() } - let lifted2452 : String? = match + let lifted2454 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2451 = mbt_ffi_ptr2str( + let result2453 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2451) + Option::Some(result2453) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2448, - max: lifted2450, - unit: lifted2452, + min: lifted2450, + max: lifted2452, + unit: lifted2454, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted2453) + @types.SchemaTypeBody::U8Type(lifted2455) } 7 => { - let lifted2460 : @types.NumericRestrictions? = match + let lifted2462 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2455 : @types.NumericBound? = match + let lifted2457 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2454 = match + let lifted2456 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23215,16 +23271,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2454) + Option::Some(lifted2456) } _ => panic() } - let lifted2457 : @types.NumericBound? = match + let lifted2459 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2456 = match + let lifted2458 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23241,46 +23297,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2456) + Option::Some(lifted2458) } _ => panic() } - let lifted2459 : String? = match + let lifted2461 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2458 = mbt_ffi_ptr2str( + let result2460 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2458) + Option::Some(result2460) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2455, - max: lifted2457, - unit: lifted2459, + min: lifted2457, + max: lifted2459, + unit: lifted2461, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted2460) + @types.SchemaTypeBody::U16Type(lifted2462) } 8 => { - let lifted2467 : @types.NumericRestrictions? = match + let lifted2469 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2462 : @types.NumericBound? = match + let lifted2464 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2461 = match + let lifted2463 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23297,16 +23353,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2461) + Option::Some(lifted2463) } _ => panic() } - let lifted2464 : @types.NumericBound? = match + let lifted2466 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2463 = match + let lifted2465 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23323,46 +23379,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2463) + Option::Some(lifted2465) } _ => panic() } - let lifted2466 : String? = match + let lifted2468 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2465 = mbt_ffi_ptr2str( + let result2467 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2465) + Option::Some(result2467) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2462, - max: lifted2464, - unit: lifted2466, + min: lifted2464, + max: lifted2466, + unit: lifted2468, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted2467) + @types.SchemaTypeBody::U32Type(lifted2469) } 9 => { - let lifted2474 : @types.NumericRestrictions? = match + let lifted2476 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2469 : @types.NumericBound? = match + let lifted2471 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2468 = match + let lifted2470 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23379,16 +23435,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2468) + Option::Some(lifted2470) } _ => panic() } - let lifted2471 : @types.NumericBound? = match + let lifted2473 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2470 = match + let lifted2472 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23405,46 +23461,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2470) + Option::Some(lifted2472) } _ => panic() } - let lifted2473 : String? = match + let lifted2475 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2472 = mbt_ffi_ptr2str( + let result2474 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2472) + Option::Some(result2474) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2469, - max: lifted2471, - unit: lifted2473, + min: lifted2471, + max: lifted2473, + unit: lifted2475, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted2474) + @types.SchemaTypeBody::U64Type(lifted2476) } 10 => { - let lifted2481 : @types.NumericRestrictions? = match + let lifted2483 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2476 : @types.NumericBound? = match + let lifted2478 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2475 = match + let lifted2477 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23461,16 +23517,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2475) + Option::Some(lifted2477) } _ => panic() } - let lifted2478 : @types.NumericBound? = match + let lifted2480 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2477 = match + let lifted2479 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23487,46 +23543,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2477) + Option::Some(lifted2479) } _ => panic() } - let lifted2480 : String? = match + let lifted2482 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2479 = mbt_ffi_ptr2str( + let result2481 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2479) + Option::Some(result2481) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2476, - max: lifted2478, - unit: lifted2480, + min: lifted2478, + max: lifted2480, + unit: lifted2482, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted2481) + @types.SchemaTypeBody::F32Type(lifted2483) } 11 => { - let lifted2488 : @types.NumericRestrictions? = match + let lifted2490 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2483 : @types.NumericBound? = match + let lifted2485 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2482 = match + let lifted2484 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23543,16 +23599,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2482) + Option::Some(lifted2484) } _ => panic() } - let lifted2485 : @types.NumericBound? = match + let lifted2487 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2484 = match + let lifted2486 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23569,324 +23625,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2484) + Option::Some(lifted2486) } _ => panic() } - let lifted2487 : String? = match + let lifted2489 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2486 = mbt_ffi_ptr2str( + let result2488 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2486) + Option::Some(result2488) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2483, - max: lifted2485, - unit: lifted2487, + min: lifted2485, + max: lifted2487, + unit: lifted2489, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted2488) + @types.SchemaTypeBody::F64Type(lifted2490) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array2503 : Array[@types.NamedFieldType] = [] - for index2504 = 0 - index2504 < mbt_ffi_load32(iter_base + 12) - index2504 = index2504 + 1 { + let array2505 : Array[@types.NamedFieldType] = [] + for index2506 = 0 + index2506 < mbt_ffi_load32(iter_base + 12) + index2506 = index2506 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2504 * 68 + index2506 * 68 - let result2489 = mbt_ffi_ptr2str( + let result2491 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2491 : String? = match + let lifted2493 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2490 = mbt_ffi_ptr2str( + let result2492 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2490) + Option::Some(result2492) } _ => panic() } - let array2493 : Array[String] = [] - for index2494 = 0 - index2494 < mbt_ffi_load32(iter_base + 28) - index2494 = index2494 + 1 { + let array2495 : Array[String] = [] + for index2496 = 0 + index2496 < mbt_ffi_load32(iter_base + 28) + index2496 = index2496 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2494 * 8 + index2496 * 8 - let result2492 = mbt_ffi_ptr2str( + let result2494 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2493.push(result2492) + array2495.push(result2494) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array2496 : Array[String] = [] - for index2497 = 0 - index2497 < mbt_ffi_load32(iter_base + 36) - index2497 = index2497 + 1 { + let array2498 : Array[String] = [] + for index2499 = 0 + index2499 < mbt_ffi_load32(iter_base + 36) + index2499 = index2499 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index2497 * 8 + index2499 * 8 - let result2495 = mbt_ffi_ptr2str( + let result2497 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2496.push(result2495) + array2498.push(result2497) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted2499 : String? = match + let lifted2501 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result2498 = mbt_ffi_ptr2str( + let result2500 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result2498) + Option::Some(result2500) } _ => panic() } - let lifted2502 : @types.Role? = match + let lifted2504 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted2501 = match + let lifted2503 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2500 = mbt_ffi_ptr2str( + let result2502 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result2500) + @types.Role::Other(result2502) } _ => panic() } - Option::Some(lifted2501) + Option::Some(lifted2503) } _ => panic() } - array2503.push(@types.NamedFieldType::{ - name: result2489, + array2505.push(@types.NamedFieldType::{ + name: result2491, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted2491, - aliases: array2493, - examples: array2496, - deprecated: lifted2499, - role: lifted2502, + doc: lifted2493, + aliases: array2495, + examples: array2498, + deprecated: lifted2501, + role: lifted2504, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array2503) + @types.SchemaTypeBody::RecordType(array2505) } 15 => { - let array2520 : Array[@types.VariantCaseType] = [] - for index2521 = 0 - index2521 < mbt_ffi_load32(iter_base + 12) - index2521 = index2521 + 1 { + let array2522 : Array[@types.VariantCaseType] = [] + for index2523 = 0 + index2523 < mbt_ffi_load32(iter_base + 12) + index2523 = index2523 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2521 * 72 + index2523 * 72 - let result2505 = mbt_ffi_ptr2str( + let result2507 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2506 : Int? = match + let lifted2508 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2508 : String? = match + let lifted2510 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2507 = mbt_ffi_ptr2str( + let result2509 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2507) + Option::Some(result2509) } _ => panic() } - let array2510 : Array[String] = [] - for index2511 = 0 - index2511 < mbt_ffi_load32(iter_base + 32) - index2511 = index2511 + 1 { + let array2512 : Array[String] = [] + for index2513 = 0 + index2513 < mbt_ffi_load32(iter_base + 32) + index2513 = index2513 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2511 * 8 + index2513 * 8 - let result2509 = mbt_ffi_ptr2str( + let result2511 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2510.push(result2509) + array2512.push(result2511) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2513 : Array[String] = [] - for index2514 = 0 - index2514 < mbt_ffi_load32(iter_base + 40) - index2514 = index2514 + 1 { + let array2515 : Array[String] = [] + for index2516 = 0 + index2516 < mbt_ffi_load32(iter_base + 40) + index2516 = index2516 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2514 * 8 + index2516 * 8 - let result2512 = mbt_ffi_ptr2str( + let result2514 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2513.push(result2512) + array2515.push(result2514) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted2516 : String? = match + let lifted2518 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2515 = mbt_ffi_ptr2str( + let result2517 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2515) + Option::Some(result2517) } _ => panic() } - let lifted2519 : @types.Role? = match + let lifted2521 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted2518 = match + let lifted2520 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2517 = mbt_ffi_ptr2str( + let result2519 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result2517) + @types.Role::Other(result2519) } _ => panic() } - Option::Some(lifted2518) + Option::Some(lifted2520) } _ => panic() } - array2520.push(@types.VariantCaseType::{ - name: result2505, - payload: lifted2506, + array2522.push(@types.VariantCaseType::{ + name: result2507, + payload: lifted2508, metadata: @types.MetadataEnvelope::{ - doc: lifted2508, - aliases: array2510, - examples: array2513, - deprecated: lifted2516, - role: lifted2519, + doc: lifted2510, + aliases: array2512, + examples: array2515, + deprecated: lifted2518, + role: lifted2521, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array2520) + @types.SchemaTypeBody::VariantType(array2522) } 16 => { - let array2523 : Array[String] = [] - for index2524 = 0 - index2524 < mbt_ffi_load32(iter_base + 12) - index2524 = index2524 + 1 { + let array2525 : Array[String] = [] + for index2526 = 0 + index2526 < mbt_ffi_load32(iter_base + 12) + index2526 = index2526 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2524 * 8 + index2526 * 8 - let result2522 = mbt_ffi_ptr2str( + let result2524 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2523.push(result2522) + array2525.push(result2524) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array2523) + @types.SchemaTypeBody::EnumType(array2525) } 17 => { - let array2526 : Array[String] = [] - for index2527 = 0 - index2527 < mbt_ffi_load32(iter_base + 12) - index2527 = index2527 + 1 { + let array2528 : Array[String] = [] + for index2529 = 0 + index2529 < mbt_ffi_load32(iter_base + 12) + index2529 = index2529 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2527 * 8 + index2529 * 8 - let result2525 = mbt_ffi_ptr2str( + let result2527 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2526.push(result2525) + array2528.push(result2527) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array2526) + @types.SchemaTypeBody::FlagsType(array2528) } 18 => { - let array2528 : Array[Int] = [] - for index2529 = 0 - index2529 < mbt_ffi_load32(iter_base + 12) - index2529 = index2529 + 1 { + let array2530 : Array[Int] = [] + for index2531 = 0 + index2531 < mbt_ffi_load32(iter_base + 12) + index2531 = index2531 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2529 * 4 + index2531 * 4 - array2528.push(mbt_ffi_load32(iter_base + 0)) + array2530.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array2528) + @types.SchemaTypeBody::TupleType(array2530) } 19 => @types.SchemaTypeBody::ListType( @@ -23907,14 +23963,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted2530 : Int? = match + let lifted2532 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2531 : Int? = match + let lifted2533 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -23922,37 +23978,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted2530, - err: lifted2531, + ok: lifted2532, + err: lifted2533, }) } 24 => { - let lifted2535 : Array[String]? = match + let lifted2537 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2533 : Array[String] = [] - for index2534 = 0 - index2534 < mbt_ffi_load32(iter_base + 16) - index2534 = index2534 + 1 { + let array2535 : Array[String] = [] + for index2536 = 0 + index2536 < mbt_ffi_load32(iter_base + 16) + index2536 = index2536 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2534 * 8 + index2536 * 8 - let result2532 = mbt_ffi_ptr2str( + let result2534 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2533.push(result2532) + array2535.push(result2534) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2533) + Option::Some(array2535) } _ => panic() } - let lifted2536 : UInt? = match + let lifted2538 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -23962,7 +24018,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2537 : UInt? = match + let lifted2539 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -23972,54 +24028,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2539 : String? = match + let lifted2541 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2538 = mbt_ffi_ptr2str( + let result2540 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2538) + Option::Some(result2540) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted2535, - min_length: lifted2536, - max_length: lifted2537, - regex: lifted2539, + languages: lifted2537, + min_length: lifted2538, + max_length: lifted2539, + regex: lifted2541, }) } 25 => { - let lifted2543 : Array[String]? = match + let lifted2545 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2541 : Array[String] = [] - for index2542 = 0 - index2542 < mbt_ffi_load32(iter_base + 16) - index2542 = index2542 + 1 { + let array2543 : Array[String] = [] + for index2544 = 0 + index2544 < mbt_ffi_load32(iter_base + 16) + index2544 = index2544 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2542 * 8 + index2544 * 8 - let result2540 = mbt_ffi_ptr2str( + let result2542 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2541.push(result2540) + array2543.push(result2542) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2541) + Option::Some(array2543) } _ => panic() } - let lifted2544 : UInt? = match + let lifted2546 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -24029,7 +24085,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2545 : UInt? = match + let lifted2547 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -24040,58 +24096,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted2543, - min_bytes: lifted2544, - max_bytes: lifted2545, + mime_types: lifted2545, + min_bytes: lifted2546, + max_bytes: lifted2547, }) } 26 => { - let lifted2549 : Array[String]? = match + let lifted2551 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array2547 : Array[String] = [] - for index2548 = 0 - index2548 < mbt_ffi_load32(iter_base + 20) - index2548 = index2548 + 1 { + let array2549 : Array[String] = [] + for index2550 = 0 + index2550 < mbt_ffi_load32(iter_base + 20) + index2550 = index2550 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2548 * 8 + index2550 * 8 - let result2546 = mbt_ffi_ptr2str( + let result2548 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2547.push(result2546) + array2549.push(result2548) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array2547) + Option::Some(array2549) } _ => panic() } - let lifted2553 : Array[String]? = match + let lifted2555 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array2551 : Array[String] = [] - for index2552 = 0 - index2552 < mbt_ffi_load32(iter_base + 32) - index2552 = index2552 + 1 { + let array2553 : Array[String] = [] + for index2554 = 0 + index2554 < mbt_ffi_load32(iter_base + 32) + index2554 = index2554 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2552 * 8 + index2554 * 8 - let result2550 = mbt_ffi_ptr2str( + let result2552 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2551.push(result2550) + array2553.push(result2552) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array2551) + Option::Some(array2553) } _ => panic() } @@ -24103,95 +24159,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted2549, - allowed_extensions: lifted2553, + allowed_mime_types: lifted2551, + allowed_extensions: lifted2555, }) } 27 => { - let lifted2557 : Array[String]? = match + let lifted2559 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2555 : Array[String] = [] - for index2556 = 0 - index2556 < mbt_ffi_load32(iter_base + 16) - index2556 = index2556 + 1 { + let array2557 : Array[String] = [] + for index2558 = 0 + index2558 < mbt_ffi_load32(iter_base + 16) + index2558 = index2558 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2556 * 8 + index2558 * 8 - let result2554 = mbt_ffi_ptr2str( + let result2556 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2555.push(result2554) + array2557.push(result2556) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2555) + Option::Some(array2557) } _ => panic() } - let lifted2561 : Array[String]? = match + let lifted2563 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array2559 : Array[String] = [] - for index2560 = 0 - index2560 < mbt_ffi_load32(iter_base + 28) - index2560 = index2560 + 1 { + let array2561 : Array[String] = [] + for index2562 = 0 + index2562 < mbt_ffi_load32(iter_base + 28) + index2562 = index2562 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2560 * 8 + index2562 * 8 - let result2558 = mbt_ffi_ptr2str( + let result2560 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2559.push(result2558) + array2561.push(result2560) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array2559) + Option::Some(array2561) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted2557, - allowed_hosts: lifted2561, + allowed_schemes: lifted2559, + allowed_hosts: lifted2563, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result2562 = mbt_ffi_ptr2str( + let result2564 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array2564 : Array[String] = [] - for index2565 = 0 - index2565 < mbt_ffi_load32(iter_base + 20) - index2565 = index2565 + 1 { + let array2566 : Array[String] = [] + for index2567 = 0 + index2567 < mbt_ffi_load32(iter_base + 20) + index2567 = index2567 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2565 * 8 + index2567 * 8 - let result2563 = mbt_ffi_ptr2str( + let result2565 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2564.push(result2563) + array2566.push(result2565) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted2567 : @types.QuantityValue? = match + let lifted2569 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2566 = mbt_ffi_ptr2str( + let result2568 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -24199,17 +24255,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result2566, + unit: result2568, }) } _ => panic() } - let lifted2569 : @types.QuantityValue? = match + let lifted2571 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result2568 = mbt_ffi_ptr2str( + let result2570 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -24217,406 +24273,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result2568, + unit: result2570, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result2562, - allowed_suffixes: array2564, - min: lifted2567, - max: lifted2569, + base_unit: result2564, + allowed_suffixes: array2566, + min: lifted2569, + max: lifted2571, }) } 31 => { - let array2593 : Array[@types.UnionBranch] = [] - for index2594 = 0 - index2594 < mbt_ffi_load32(iter_base + 12) - index2594 = index2594 + 1 { + let array2595 : Array[@types.UnionBranch] = [] + for index2596 = 0 + index2596 < mbt_ffi_load32(iter_base + 12) + index2596 = index2596 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2594 * 92 + index2596 * 92 - let result2570 = mbt_ffi_ptr2str( + let result2572 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2579 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted2581 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result2571 = mbt_ffi_ptr2str( + let result2573 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result2571) + @types.DiscriminatorRule::Prefix(result2573) } 1 => { - let result2572 = mbt_ffi_ptr2str( + let result2574 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result2572) + @types.DiscriminatorRule::Suffix(result2574) } 2 => { - let result2573 = mbt_ffi_ptr2str( + let result2575 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result2573) + @types.DiscriminatorRule::Contains(result2575) } 3 => { - let result2574 = mbt_ffi_ptr2str( + let result2576 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result2574) + @types.DiscriminatorRule::Regex(result2576) } 4 => { - let result2575 = mbt_ffi_ptr2str( + let result2577 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted2577 : String? = match + let lifted2579 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2576 = mbt_ffi_ptr2str( + let result2578 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result2576) + Option::Some(result2578) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result2575, - literal: lifted2577, + field_name: result2577, + literal: lifted2579, }) } 5 => { - let result2578 = mbt_ffi_ptr2str( + let result2580 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result2578) + @types.DiscriminatorRule::FieldAbsent(result2580) } _ => panic() } - let lifted2581 : String? = match + let lifted2583 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2580 = mbt_ffi_ptr2str( + let result2582 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2580) + Option::Some(result2582) } _ => panic() } - let array2583 : Array[String] = [] - for index2584 = 0 - index2584 < mbt_ffi_load32(iter_base + 52) - index2584 = index2584 + 1 { + let array2585 : Array[String] = [] + for index2586 = 0 + index2586 < mbt_ffi_load32(iter_base + 52) + index2586 = index2586 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2584 * 8 + index2586 * 8 - let result2582 = mbt_ffi_ptr2str( + let result2584 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2583.push(result2582) + array2585.push(result2584) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2586 : Array[String] = [] - for index2587 = 0 - index2587 < mbt_ffi_load32(iter_base + 60) - index2587 = index2587 + 1 { + let array2588 : Array[String] = [] + for index2589 = 0 + index2589 < mbt_ffi_load32(iter_base + 60) + index2589 = index2589 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2587 * 8 + index2589 * 8 - let result2585 = mbt_ffi_ptr2str( + let result2587 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2586.push(result2585) + array2588.push(result2587) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted2589 : String? = match + let lifted2591 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2588 = mbt_ffi_ptr2str( + let result2590 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2588) + Option::Some(result2590) } _ => panic() } - let lifted2592 : @types.Role? = match + let lifted2594 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted2591 = match + let lifted2593 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2590 = mbt_ffi_ptr2str( + let result2592 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result2590) + @types.Role::Other(result2592) } _ => panic() } - Option::Some(lifted2591) + Option::Some(lifted2593) } _ => panic() } - array2593.push(@types.UnionBranch::{ - tag: result2570, + array2595.push(@types.UnionBranch::{ + tag: result2572, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted2579, + discriminator: lifted2581, metadata: @types.MetadataEnvelope::{ - doc: lifted2581, - aliases: array2583, - examples: array2586, - deprecated: lifted2589, - role: lifted2592, + doc: lifted2583, + aliases: array2585, + examples: array2588, + deprecated: lifted2591, + role: lifted2594, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array2593, + branches: array2595, }) } 32 => { - let lifted2596 : String? = match + let lifted2598 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2595 = mbt_ffi_ptr2str( + let result2597 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2595) + Option::Some(result2597) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted2596, + category: lifted2598, }) } 33 => { - let lifted2598 : String? = match + let lifted2600 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2597 = mbt_ffi_ptr2str( + let result2599 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2597) + Option::Some(result2599) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted2598, + resource_name: lifted2600, }) } 34 => { - let lifted2599 : Int? = match + let lifted2601 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted2599) + @types.SchemaTypeBody::FutureType(lifted2601) } 35 => { - let lifted2600 : Int? = match + let lifted2602 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted2600) + @types.SchemaTypeBody::StreamType(lifted2602) } _ => panic() } - let lifted2603 : String? = match + let lifted2605 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result2602 = mbt_ffi_ptr2str( + let result2604 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result2602) + Option::Some(result2604) } _ => panic() } - let array2605 : Array[String] = [] - for index2606 = 0 - index2606 < mbt_ffi_load32(iter_base + 104) - index2606 = index2606 + 1 { + let array2607 : Array[String] = [] + for index2608 = 0 + index2608 < mbt_ffi_load32(iter_base + 104) + index2608 = index2608 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index2606 * 8 + index2608 * 8 - let result2604 = mbt_ffi_ptr2str( + let result2606 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2605.push(result2604) + array2607.push(result2606) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array2608 : Array[String] = [] - for index2609 = 0 - index2609 < mbt_ffi_load32(iter_base + 112) - index2609 = index2609 + 1 { + let array2610 : Array[String] = [] + for index2611 = 0 + index2611 < mbt_ffi_load32(iter_base + 112) + index2611 = index2611 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index2609 * 8 + index2611 * 8 - let result2607 = mbt_ffi_ptr2str( + let result2609 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2608.push(result2607) + array2610.push(result2609) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted2611 : String? = match + let lifted2613 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result2610 = mbt_ffi_ptr2str( + let result2612 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result2610) + Option::Some(result2612) } _ => panic() } - let lifted2614 : @types.Role? = match + let lifted2616 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted2613 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted2615 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2612 = mbt_ffi_ptr2str( + let result2614 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result2612) + @types.Role::Other(result2614) } _ => panic() } - Option::Some(lifted2613) + Option::Some(lifted2615) } _ => panic() } - array2615.push(@types.SchemaTypeNode::{ - body: lifted2601, + array2617.push(@types.SchemaTypeNode::{ + body: lifted2603, metadata: @types.MetadataEnvelope::{ - doc: lifted2603, - aliases: array2605, - examples: array2608, - deprecated: lifted2611, - role: lifted2614, + doc: lifted2605, + aliases: array2607, + examples: array2610, + deprecated: lifted2613, + role: lifted2616, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 40)) - let array2620 : Array[@types.SchemaTypeDef] = [] - for index2621 = 0 - index2621 < mbt_ffi_load32(iter_base + 52) - index2621 = index2621 + 1 { + let array2622 : Array[@types.SchemaTypeDef] = [] + for index2623 = 0 + index2623 < mbt_ffi_load32(iter_base + 52) + index2623 = index2623 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2621 * 24 + index2623 * 24 - let result2617 = mbt_ffi_ptr2str( + let result2619 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2619 : String? = match + let lifted2621 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2618 = mbt_ffi_ptr2str( + let result2620 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2618) + Option::Some(result2620) } _ => panic() } - array2620.push(@types.SchemaTypeDef::{ - id: result2617, - name: lifted2619, + array2622.push(@types.SchemaTypeDef::{ + id: result2619, + name: lifted2621, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2651 : Array[@types.SchemaValueNode] = [] - for index2652 = 0 - index2652 < mbt_ffi_load32(iter_base + 64) - index2652 = index2652 + 1 { + let array2653 : Array[@types.SchemaValueNode] = [] + for index2654 = 0 + index2654 < mbt_ffi_load32(iter_base + 64) + index2654 = index2654 + 1 { let iter_base = mbt_ffi_load32(iter_base + 60) + - index2652 * 32 + index2654 * 32 - let lifted2650 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2652 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -24668,29 +24724,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result2622 = mbt_ffi_ptr2str( + let result2624 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result2622) + @types.SchemaValueNode::StringValue(result2624) } 13 => { - let array2623 : Array[Int] = [] - for index2624 = 0 - index2624 < mbt_ffi_load32(iter_base + 12) - index2624 = index2624 + 1 { + let array2625 : Array[Int] = [] + for index2626 = 0 + index2626 < mbt_ffi_load32(iter_base + 12) + index2626 = index2626 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2624 * 4 + index2626 * 4 - array2623.push(mbt_ffi_load32(iter_base + 0)) + array2625.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array2623) + @types.SchemaValueNode::RecordValue(array2625) } 14 => { - let lifted2625 : Int? = match + let lifted2627 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -24699,7 +24755,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted2625, + payload: lifted2627, }) } 15 => @@ -24707,34 +24763,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array2626 : Array[Bool] = [] - for index2627 = 0 - index2627 < mbt_ffi_load32(iter_base + 12) - index2627 = index2627 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index2627 * 1 - - array2626.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array2626) - } - 17 => { - let array2628 : Array[Int] = [] + let array2628 : Array[Bool] = [] for index2629 = 0 index2629 < mbt_ffi_load32(iter_base + 12) index2629 = index2629 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2629 * 4 + index2629 * 1 - array2628.push(mbt_ffi_load32(iter_base + 0)) + array2628.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array2628) + @types.SchemaValueNode::FlagsValue(array2628) } - 18 => { + 17 => { let array2630 : Array[Int] = [] for index2631 = 0 index2631 < mbt_ffi_load32(iter_base + 12) @@ -24746,9 +24788,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array2630) + @types.SchemaValueNode::TupleValue(array2630) } - 19 => { + 18 => { let array2632 : Array[Int] = [] for index2633 = 0 index2633 < mbt_ffi_load32(iter_base + 12) @@ -24760,127 +24802,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array2632) + @types.SchemaValueNode::ListValue(array2632) } - 20 => { - let array2634 : Array[@types.MapEntry] = [] + 19 => { + let array2634 : Array[Int] = [] for index2635 = 0 index2635 < mbt_ffi_load32(iter_base + 12) index2635 = index2635 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2635 * 8 + index2635 * 4 - array2634.push(@types.MapEntry::{ + array2634.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array2634) + } + 20 => { + let array2636 : Array[@types.MapEntry] = [] + for index2637 = 0 + index2637 < mbt_ffi_load32(iter_base + 12) + index2637 = index2637 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index2637 * 8 + + array2636.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array2634) + @types.SchemaValueNode::MapValue(array2636) } 21 => { - let lifted2636 : Int? = match + let lifted2638 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted2636) + @types.SchemaValueNode::OptionValue(lifted2638) } 22 => { - let lifted2639 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2641 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted2637 : Int? = match + let lifted2639 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted2637) + @types.ResultValuePayload::OkValue(lifted2639) } 1 => { - let lifted2638 : Int? = match + let lifted2640 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted2638) + @types.ResultValuePayload::ErrValue(lifted2640) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted2639) + @types.SchemaValueNode::ResultValue(lifted2641) } 23 => { - let result2640 = mbt_ffi_ptr2str( + let result2642 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2642 : String? = match + let lifted2644 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2641 = mbt_ffi_ptr2str( + let result2643 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2641) + Option::Some(result2643) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result2640, - language: lifted2642, + text: result2642, + language: lifted2644, }) } 24 => { - let result2643 = mbt_ffi_ptr2bytes( + let result2645 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2645 : String? = match + let lifted2647 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2644 = mbt_ffi_ptr2str( + let result2646 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2644) + Option::Some(result2646) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result2643, - mime_type: lifted2645, + bytes: result2645, + mime_type: lifted2647, }) } 25 => { - let result2646 = mbt_ffi_ptr2str( + let result2648 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result2646) + @types.SchemaValueNode::PathValue(result2648) } 26 => { - let result2647 = mbt_ffi_ptr2str( + let result2649 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result2647) + @types.SchemaValueNode::UrlValue(result2649) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -24892,7 +24948,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result2648 = mbt_ffi_ptr2str( + let result2650 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -24900,17 +24956,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result2648, + unit: result2650, }) } 30 => { - let result2649 = mbt_ffi_ptr2str( + let result2651 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result2649, + tag: result2651, body: mbt_ffi_load32(iter_base + 16), }) } @@ -24924,68 +24980,74 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array2651.push(lifted2650) + array2653.push(lifted2652) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) - let result2653 = mbt_ffi_ptr2str( + let result2655 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 72), mbt_ffi_load32(iter_base + 76), ) - let array2655 : Array[String] = [] - for index2656 = 0 - index2656 < mbt_ffi_load32(iter_base + 84) - index2656 = index2656 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 80) + index2656 * 8 + let array2657 : Array[String] = [] + for index2658 = 0 + index2658 < mbt_ffi_load32(iter_base + 84) + index2658 = index2658 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 80) + index2658 * 8 - let result2654 = mbt_ffi_ptr2str( + let result2656 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2655.push(result2654) + array2657.push(result2656) } mbt_ffi_free(mbt_ffi_load32(iter_base + 80)) - let array2670 : Array[Array[SpanData]] = [] - for index2671 = 0 - index2671 < mbt_ffi_load32(iter_base + 92) - index2671 = index2671 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 88) + index2671 * 8 + let array2672 : Array[Array[SpanData]] = [] + for index2673 = 0 + index2673 < mbt_ffi_load32(iter_base + 92) + index2673 = index2673 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 88) + index2673 * 8 - let array2668 : Array[SpanData] = [] - for index2669 = 0 - index2669 < mbt_ffi_load32(iter_base + 4) - index2669 = index2669 + 1 { + let array2670 : Array[SpanData] = [] + for index2671 = 0 + index2671 < mbt_ffi_load32(iter_base + 4) + index2671 = index2671 + 1 { let iter_base = mbt_ffi_load32(iter_base + 0) + - index2669 * 80 + index2671 * 80 - let lifted2667 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2669 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result2657 = mbt_ffi_ptr2str( + let result2659 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2659 : String? = match + let lifted2661 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result2658 = mbt_ffi_ptr2str( + let result2660 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result2658) + Option::Some(result2660) } _ => panic() } - let lifted2660 : UInt64? = match + let lifted2662 : UInt64? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -24995,123 +25057,123 @@ pub fn enrich_oplog_entries( _ => panic() } - let array2664 : Array[@context.Attribute] = [] - for index2665 = 0 - index2665 < mbt_ffi_load32(iter_base + 68) - index2665 = index2665 + 1 { + let array2666 : Array[@context.Attribute] = [] + for index2667 = 0 + index2667 < mbt_ffi_load32(iter_base + 68) + index2667 = index2667 + 1 { let iter_base = mbt_ffi_load32(iter_base + 64) + - index2665 * 20 + index2667 * 20 - let result2661 = mbt_ffi_ptr2str( + let result2663 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2663 = match + let lifted2665 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result2662 = mbt_ffi_ptr2str( + let result2664 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result2662) + @context.AttributeValue::String(result2664) } _ => panic() } - array2664.push(@context.Attribute::{ - key: result2661, - value: lifted2663, + array2666.push(@context.Attribute::{ + key: result2663, + value: lifted2665, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) SpanData::LocalSpan(LocalSpanData::{ - span_id: result2657, + span_id: result2659, start: @system-clock.Instant::{ seconds: mbt_ffi_load64(iter_base + 16), nanoseconds: mbt_ffi_load32(iter_base + 24).reinterpret_as_uint(), }, - parent: lifted2659, - linked_context: lifted2660, - attributes: array2664, + parent: lifted2661, + linked_context: lifted2662, + attributes: array2666, inherited: mbt_ffi_load8_u(iter_base + 72) != 0, }) } 1 => { - let result2666 = mbt_ffi_ptr2str( + let result2668 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) SpanData::ExternalSpan(ExternalSpanData::{ - span_id: result2666, + span_id: result2668, }) } _ => panic() } - array2668.push(lifted2667) + array2670.push(lifted2669) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - array2670.push(array2668) + array2672.push(array2670) } mbt_ffi_free(mbt_ffi_load32(iter_base + 88)) AgentInvocation::AgentInitialization(AgentInitializationParameters::{ - idempotency_key: result2418, + idempotency_key: result2420, constructor_parameters: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array2615, - defs: array2620, + type_nodes: array2617, + defs: array2622, root: mbt_ffi_load32(iter_base + 56), }, value: @types.SchemaValueTree::{ - value_nodes: array2651, + value_nodes: array2653, root: mbt_ffi_load32(iter_base + 68), }, }, - trace_id: result2653, - trace_states: array2655, - invocation_context: array2670, + trace_id: result2655, + trace_states: array2657, + invocation_context: array2672, }) } 1 => { - let result2672 = mbt_ffi_ptr2str( + let result2674 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result2673 = mbt_ffi_ptr2str( + let result2675 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - let array2870 : Array[@types.SchemaTypeNode] = [] - for index2871 = 0 - index2871 < mbt_ffi_load32(iter_base + 52) - index2871 = index2871 + 1 { + let array2872 : Array[@types.SchemaTypeNode] = [] + for index2873 = 0 + index2873 < mbt_ffi_load32(iter_base + 52) + index2873 = index2873 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2871 * 144 + index2873 * 144 - let lifted2856 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2858 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted2680 : @types.NumericRestrictions? = match + let lifted2682 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2675 : @types.NumericBound? = match + let lifted2677 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2674 = match + let lifted2676 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25128,16 +25190,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2674) + Option::Some(lifted2676) } _ => panic() } - let lifted2677 : @types.NumericBound? = match + let lifted2679 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2676 = match + let lifted2678 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25154,46 +25216,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2676) + Option::Some(lifted2678) } _ => panic() } - let lifted2679 : String? = match + let lifted2681 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2678 = mbt_ffi_ptr2str( + let result2680 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2678) + Option::Some(result2680) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2675, - max: lifted2677, - unit: lifted2679, + min: lifted2677, + max: lifted2679, + unit: lifted2681, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted2680) + @types.SchemaTypeBody::S8Type(lifted2682) } 3 => { - let lifted2687 : @types.NumericRestrictions? = match + let lifted2689 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2682 : @types.NumericBound? = match + let lifted2684 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2681 = match + let lifted2683 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25210,16 +25272,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2681) + Option::Some(lifted2683) } _ => panic() } - let lifted2684 : @types.NumericBound? = match + let lifted2686 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2683 = match + let lifted2685 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25236,46 +25298,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2683) + Option::Some(lifted2685) } _ => panic() } - let lifted2686 : String? = match + let lifted2688 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2685 = mbt_ffi_ptr2str( + let result2687 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2685) + Option::Some(result2687) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2682, - max: lifted2684, - unit: lifted2686, + min: lifted2684, + max: lifted2686, + unit: lifted2688, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted2687) + @types.SchemaTypeBody::S16Type(lifted2689) } 4 => { - let lifted2694 : @types.NumericRestrictions? = match + let lifted2696 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2689 : @types.NumericBound? = match + let lifted2691 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2688 = match + let lifted2690 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25292,16 +25354,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2688) + Option::Some(lifted2690) } _ => panic() } - let lifted2691 : @types.NumericBound? = match + let lifted2693 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2690 = match + let lifted2692 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25318,46 +25380,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2690) + Option::Some(lifted2692) } _ => panic() } - let lifted2693 : String? = match + let lifted2695 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2692 = mbt_ffi_ptr2str( + let result2694 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2692) + Option::Some(result2694) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2689, - max: lifted2691, - unit: lifted2693, + min: lifted2691, + max: lifted2693, + unit: lifted2695, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted2694) + @types.SchemaTypeBody::S32Type(lifted2696) } 5 => { - let lifted2701 : @types.NumericRestrictions? = match + let lifted2703 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2696 : @types.NumericBound? = match + let lifted2698 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2695 = match + let lifted2697 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25374,16 +25436,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2695) + Option::Some(lifted2697) } _ => panic() } - let lifted2698 : @types.NumericBound? = match + let lifted2700 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2697 = match + let lifted2699 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25400,46 +25462,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2697) + Option::Some(lifted2699) } _ => panic() } - let lifted2700 : String? = match + let lifted2702 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2699 = mbt_ffi_ptr2str( + let result2701 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2699) + Option::Some(result2701) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2696, - max: lifted2698, - unit: lifted2700, + min: lifted2698, + max: lifted2700, + unit: lifted2702, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted2701) + @types.SchemaTypeBody::S64Type(lifted2703) } 6 => { - let lifted2708 : @types.NumericRestrictions? = match + let lifted2710 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2703 : @types.NumericBound? = match + let lifted2705 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2702 = match + let lifted2704 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25456,16 +25518,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2702) + Option::Some(lifted2704) } _ => panic() } - let lifted2705 : @types.NumericBound? = match + let lifted2707 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2704 = match + let lifted2706 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25482,46 +25544,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2704) + Option::Some(lifted2706) } _ => panic() } - let lifted2707 : String? = match + let lifted2709 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2706 = mbt_ffi_ptr2str( + let result2708 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2706) + Option::Some(result2708) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2703, - max: lifted2705, - unit: lifted2707, + min: lifted2705, + max: lifted2707, + unit: lifted2709, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted2708) + @types.SchemaTypeBody::U8Type(lifted2710) } 7 => { - let lifted2715 : @types.NumericRestrictions? = match + let lifted2717 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2710 : @types.NumericBound? = match + let lifted2712 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2709 = match + let lifted2711 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25538,16 +25600,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2709) + Option::Some(lifted2711) } _ => panic() } - let lifted2712 : @types.NumericBound? = match + let lifted2714 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2711 = match + let lifted2713 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25564,46 +25626,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2711) + Option::Some(lifted2713) } _ => panic() } - let lifted2714 : String? = match + let lifted2716 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2713 = mbt_ffi_ptr2str( + let result2715 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2713) + Option::Some(result2715) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2710, - max: lifted2712, - unit: lifted2714, + min: lifted2712, + max: lifted2714, + unit: lifted2716, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted2715) + @types.SchemaTypeBody::U16Type(lifted2717) } 8 => { - let lifted2722 : @types.NumericRestrictions? = match + let lifted2724 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2717 : @types.NumericBound? = match + let lifted2719 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2716 = match + let lifted2718 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25620,16 +25682,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2716) + Option::Some(lifted2718) } _ => panic() } - let lifted2719 : @types.NumericBound? = match + let lifted2721 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2718 = match + let lifted2720 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25646,46 +25708,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2718) + Option::Some(lifted2720) } _ => panic() } - let lifted2721 : String? = match + let lifted2723 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2720 = mbt_ffi_ptr2str( + let result2722 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2720) + Option::Some(result2722) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2717, - max: lifted2719, - unit: lifted2721, + min: lifted2719, + max: lifted2721, + unit: lifted2723, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted2722) + @types.SchemaTypeBody::U32Type(lifted2724) } 9 => { - let lifted2729 : @types.NumericRestrictions? = match + let lifted2731 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2724 : @types.NumericBound? = match + let lifted2726 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2723 = match + let lifted2725 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25702,16 +25764,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2723) + Option::Some(lifted2725) } _ => panic() } - let lifted2726 : @types.NumericBound? = match + let lifted2728 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2725 = match + let lifted2727 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25728,46 +25790,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2725) + Option::Some(lifted2727) } _ => panic() } - let lifted2728 : String? = match + let lifted2730 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2727 = mbt_ffi_ptr2str( + let result2729 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2727) + Option::Some(result2729) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2724, - max: lifted2726, - unit: lifted2728, + min: lifted2726, + max: lifted2728, + unit: lifted2730, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted2729) + @types.SchemaTypeBody::U64Type(lifted2731) } 10 => { - let lifted2736 : @types.NumericRestrictions? = match + let lifted2738 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2731 : @types.NumericBound? = match + let lifted2733 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2730 = match + let lifted2732 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25784,16 +25846,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2730) + Option::Some(lifted2732) } _ => panic() } - let lifted2733 : @types.NumericBound? = match + let lifted2735 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2732 = match + let lifted2734 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25810,46 +25872,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2732) + Option::Some(lifted2734) } _ => panic() } - let lifted2735 : String? = match + let lifted2737 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2734 = mbt_ffi_ptr2str( + let result2736 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2734) + Option::Some(result2736) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2731, - max: lifted2733, - unit: lifted2735, + min: lifted2733, + max: lifted2735, + unit: lifted2737, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted2736) + @types.SchemaTypeBody::F32Type(lifted2738) } 11 => { - let lifted2743 : @types.NumericRestrictions? = match + let lifted2745 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2738 : @types.NumericBound? = match + let lifted2740 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2737 = match + let lifted2739 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25866,16 +25928,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2737) + Option::Some(lifted2739) } _ => panic() } - let lifted2740 : @types.NumericBound? = match + let lifted2742 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2739 = match + let lifted2741 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25892,324 +25954,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2739) + Option::Some(lifted2741) } _ => panic() } - let lifted2742 : String? = match + let lifted2744 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2741 = mbt_ffi_ptr2str( + let result2743 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2741) + Option::Some(result2743) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2738, - max: lifted2740, - unit: lifted2742, + min: lifted2740, + max: lifted2742, + unit: lifted2744, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted2743) + @types.SchemaTypeBody::F64Type(lifted2745) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array2758 : Array[@types.NamedFieldType] = [] - for index2759 = 0 - index2759 < mbt_ffi_load32(iter_base + 12) - index2759 = index2759 + 1 { + let array2760 : Array[@types.NamedFieldType] = [] + for index2761 = 0 + index2761 < mbt_ffi_load32(iter_base + 12) + index2761 = index2761 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2759 * 68 + index2761 * 68 - let result2744 = mbt_ffi_ptr2str( + let result2746 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2746 : String? = match + let lifted2748 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2745 = mbt_ffi_ptr2str( + let result2747 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2745) + Option::Some(result2747) } _ => panic() } - let array2748 : Array[String] = [] - for index2749 = 0 - index2749 < mbt_ffi_load32(iter_base + 28) - index2749 = index2749 + 1 { + let array2750 : Array[String] = [] + for index2751 = 0 + index2751 < mbt_ffi_load32(iter_base + 28) + index2751 = index2751 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2749 * 8 + index2751 * 8 - let result2747 = mbt_ffi_ptr2str( + let result2749 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2748.push(result2747) + array2750.push(result2749) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array2751 : Array[String] = [] - for index2752 = 0 - index2752 < mbt_ffi_load32(iter_base + 36) - index2752 = index2752 + 1 { + let array2753 : Array[String] = [] + for index2754 = 0 + index2754 < mbt_ffi_load32(iter_base + 36) + index2754 = index2754 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index2752 * 8 + index2754 * 8 - let result2750 = mbt_ffi_ptr2str( + let result2752 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2751.push(result2750) + array2753.push(result2752) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted2754 : String? = match + let lifted2756 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result2753 = mbt_ffi_ptr2str( + let result2755 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result2753) + Option::Some(result2755) } _ => panic() } - let lifted2757 : @types.Role? = match + let lifted2759 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted2756 = match + let lifted2758 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2755 = mbt_ffi_ptr2str( + let result2757 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result2755) + @types.Role::Other(result2757) } _ => panic() } - Option::Some(lifted2756) + Option::Some(lifted2758) } _ => panic() } - array2758.push(@types.NamedFieldType::{ - name: result2744, + array2760.push(@types.NamedFieldType::{ + name: result2746, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted2746, - aliases: array2748, - examples: array2751, - deprecated: lifted2754, - role: lifted2757, + doc: lifted2748, + aliases: array2750, + examples: array2753, + deprecated: lifted2756, + role: lifted2759, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array2758) + @types.SchemaTypeBody::RecordType(array2760) } 15 => { - let array2775 : Array[@types.VariantCaseType] = [] - for index2776 = 0 - index2776 < mbt_ffi_load32(iter_base + 12) - index2776 = index2776 + 1 { + let array2777 : Array[@types.VariantCaseType] = [] + for index2778 = 0 + index2778 < mbt_ffi_load32(iter_base + 12) + index2778 = index2778 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2776 * 72 + index2778 * 72 - let result2760 = mbt_ffi_ptr2str( + let result2762 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2761 : Int? = match + let lifted2763 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2763 : String? = match + let lifted2765 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2762 = mbt_ffi_ptr2str( + let result2764 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2762) + Option::Some(result2764) } _ => panic() } - let array2765 : Array[String] = [] - for index2766 = 0 - index2766 < mbt_ffi_load32(iter_base + 32) - index2766 = index2766 + 1 { + let array2767 : Array[String] = [] + for index2768 = 0 + index2768 < mbt_ffi_load32(iter_base + 32) + index2768 = index2768 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2766 * 8 + index2768 * 8 - let result2764 = mbt_ffi_ptr2str( + let result2766 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2765.push(result2764) + array2767.push(result2766) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2768 : Array[String] = [] - for index2769 = 0 - index2769 < mbt_ffi_load32(iter_base + 40) - index2769 = index2769 + 1 { + let array2770 : Array[String] = [] + for index2771 = 0 + index2771 < mbt_ffi_load32(iter_base + 40) + index2771 = index2771 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2769 * 8 + index2771 * 8 - let result2767 = mbt_ffi_ptr2str( + let result2769 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2768.push(result2767) + array2770.push(result2769) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted2771 : String? = match + let lifted2773 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2770 = mbt_ffi_ptr2str( + let result2772 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2770) + Option::Some(result2772) } _ => panic() } - let lifted2774 : @types.Role? = match + let lifted2776 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted2773 = match + let lifted2775 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2772 = mbt_ffi_ptr2str( + let result2774 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result2772) + @types.Role::Other(result2774) } _ => panic() } - Option::Some(lifted2773) + Option::Some(lifted2775) } _ => panic() } - array2775.push(@types.VariantCaseType::{ - name: result2760, - payload: lifted2761, + array2777.push(@types.VariantCaseType::{ + name: result2762, + payload: lifted2763, metadata: @types.MetadataEnvelope::{ - doc: lifted2763, - aliases: array2765, - examples: array2768, - deprecated: lifted2771, - role: lifted2774, + doc: lifted2765, + aliases: array2767, + examples: array2770, + deprecated: lifted2773, + role: lifted2776, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array2775) + @types.SchemaTypeBody::VariantType(array2777) } 16 => { - let array2778 : Array[String] = [] - for index2779 = 0 - index2779 < mbt_ffi_load32(iter_base + 12) - index2779 = index2779 + 1 { + let array2780 : Array[String] = [] + for index2781 = 0 + index2781 < mbt_ffi_load32(iter_base + 12) + index2781 = index2781 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2779 * 8 + index2781 * 8 - let result2777 = mbt_ffi_ptr2str( + let result2779 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2778.push(result2777) + array2780.push(result2779) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array2778) + @types.SchemaTypeBody::EnumType(array2780) } 17 => { - let array2781 : Array[String] = [] - for index2782 = 0 - index2782 < mbt_ffi_load32(iter_base + 12) - index2782 = index2782 + 1 { + let array2783 : Array[String] = [] + for index2784 = 0 + index2784 < mbt_ffi_load32(iter_base + 12) + index2784 = index2784 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2782 * 8 + index2784 * 8 - let result2780 = mbt_ffi_ptr2str( + let result2782 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2781.push(result2780) + array2783.push(result2782) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array2781) + @types.SchemaTypeBody::FlagsType(array2783) } 18 => { - let array2783 : Array[Int] = [] - for index2784 = 0 - index2784 < mbt_ffi_load32(iter_base + 12) - index2784 = index2784 + 1 { + let array2785 : Array[Int] = [] + for index2786 = 0 + index2786 < mbt_ffi_load32(iter_base + 12) + index2786 = index2786 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2784 * 4 + index2786 * 4 - array2783.push(mbt_ffi_load32(iter_base + 0)) + array2785.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array2783) + @types.SchemaTypeBody::TupleType(array2785) } 19 => @types.SchemaTypeBody::ListType( @@ -26230,14 +26292,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted2785 : Int? = match + let lifted2787 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2786 : Int? = match + let lifted2788 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -26245,37 +26307,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted2785, - err: lifted2786, + ok: lifted2787, + err: lifted2788, }) } 24 => { - let lifted2790 : Array[String]? = match + let lifted2792 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2788 : Array[String] = [] - for index2789 = 0 - index2789 < mbt_ffi_load32(iter_base + 16) - index2789 = index2789 + 1 { + let array2790 : Array[String] = [] + for index2791 = 0 + index2791 < mbt_ffi_load32(iter_base + 16) + index2791 = index2791 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2789 * 8 + index2791 * 8 - let result2787 = mbt_ffi_ptr2str( + let result2789 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2788.push(result2787) + array2790.push(result2789) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2788) + Option::Some(array2790) } _ => panic() } - let lifted2791 : UInt? = match + let lifted2793 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -26285,7 +26347,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2792 : UInt? = match + let lifted2794 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -26295,54 +26357,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2794 : String? = match + let lifted2796 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2793 = mbt_ffi_ptr2str( + let result2795 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2793) + Option::Some(result2795) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted2790, - min_length: lifted2791, - max_length: lifted2792, - regex: lifted2794, + languages: lifted2792, + min_length: lifted2793, + max_length: lifted2794, + regex: lifted2796, }) } 25 => { - let lifted2798 : Array[String]? = match + let lifted2800 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2796 : Array[String] = [] - for index2797 = 0 - index2797 < mbt_ffi_load32(iter_base + 16) - index2797 = index2797 + 1 { + let array2798 : Array[String] = [] + for index2799 = 0 + index2799 < mbt_ffi_load32(iter_base + 16) + index2799 = index2799 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2797 * 8 + index2799 * 8 - let result2795 = mbt_ffi_ptr2str( + let result2797 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2796.push(result2795) + array2798.push(result2797) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2796) + Option::Some(array2798) } _ => panic() } - let lifted2799 : UInt? = match + let lifted2801 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -26352,7 +26414,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2800 : UInt? = match + let lifted2802 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -26363,58 +26425,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted2798, - min_bytes: lifted2799, - max_bytes: lifted2800, + mime_types: lifted2800, + min_bytes: lifted2801, + max_bytes: lifted2802, }) } 26 => { - let lifted2804 : Array[String]? = match + let lifted2806 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array2802 : Array[String] = [] - for index2803 = 0 - index2803 < mbt_ffi_load32(iter_base + 20) - index2803 = index2803 + 1 { + let array2804 : Array[String] = [] + for index2805 = 0 + index2805 < mbt_ffi_load32(iter_base + 20) + index2805 = index2805 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2803 * 8 + index2805 * 8 - let result2801 = mbt_ffi_ptr2str( + let result2803 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2802.push(result2801) + array2804.push(result2803) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array2802) + Option::Some(array2804) } _ => panic() } - let lifted2808 : Array[String]? = match + let lifted2810 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array2806 : Array[String] = [] - for index2807 = 0 - index2807 < mbt_ffi_load32(iter_base + 32) - index2807 = index2807 + 1 { + let array2808 : Array[String] = [] + for index2809 = 0 + index2809 < mbt_ffi_load32(iter_base + 32) + index2809 = index2809 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2807 * 8 + index2809 * 8 - let result2805 = mbt_ffi_ptr2str( + let result2807 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2806.push(result2805) + array2808.push(result2807) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array2806) + Option::Some(array2808) } _ => panic() } @@ -26426,95 +26488,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted2804, - allowed_extensions: lifted2808, + allowed_mime_types: lifted2806, + allowed_extensions: lifted2810, }) } 27 => { - let lifted2812 : Array[String]? = match + let lifted2814 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2810 : Array[String] = [] - for index2811 = 0 - index2811 < mbt_ffi_load32(iter_base + 16) - index2811 = index2811 + 1 { + let array2812 : Array[String] = [] + for index2813 = 0 + index2813 < mbt_ffi_load32(iter_base + 16) + index2813 = index2813 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2811 * 8 + index2813 * 8 - let result2809 = mbt_ffi_ptr2str( + let result2811 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2810.push(result2809) + array2812.push(result2811) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2810) + Option::Some(array2812) } _ => panic() } - let lifted2816 : Array[String]? = match + let lifted2818 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array2814 : Array[String] = [] - for index2815 = 0 - index2815 < mbt_ffi_load32(iter_base + 28) - index2815 = index2815 + 1 { + let array2816 : Array[String] = [] + for index2817 = 0 + index2817 < mbt_ffi_load32(iter_base + 28) + index2817 = index2817 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2815 * 8 + index2817 * 8 - let result2813 = mbt_ffi_ptr2str( + let result2815 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2814.push(result2813) + array2816.push(result2815) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array2814) + Option::Some(array2816) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted2812, - allowed_hosts: lifted2816, + allowed_schemes: lifted2814, + allowed_hosts: lifted2818, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result2817 = mbt_ffi_ptr2str( + let result2819 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array2819 : Array[String] = [] - for index2820 = 0 - index2820 < mbt_ffi_load32(iter_base + 20) - index2820 = index2820 + 1 { + let array2821 : Array[String] = [] + for index2822 = 0 + index2822 < mbt_ffi_load32(iter_base + 20) + index2822 = index2822 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2820 * 8 + index2822 * 8 - let result2818 = mbt_ffi_ptr2str( + let result2820 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2819.push(result2818) + array2821.push(result2820) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted2822 : @types.QuantityValue? = match + let lifted2824 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2821 = mbt_ffi_ptr2str( + let result2823 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -26522,17 +26584,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result2821, + unit: result2823, }) } _ => panic() } - let lifted2824 : @types.QuantityValue? = match + let lifted2826 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result2823 = mbt_ffi_ptr2str( + let result2825 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -26540,406 +26602,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result2823, + unit: result2825, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result2817, - allowed_suffixes: array2819, - min: lifted2822, - max: lifted2824, + base_unit: result2819, + allowed_suffixes: array2821, + min: lifted2824, + max: lifted2826, }) } 31 => { - let array2848 : Array[@types.UnionBranch] = [] - for index2849 = 0 - index2849 < mbt_ffi_load32(iter_base + 12) - index2849 = index2849 + 1 { + let array2850 : Array[@types.UnionBranch] = [] + for index2851 = 0 + index2851 < mbt_ffi_load32(iter_base + 12) + index2851 = index2851 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2849 * 92 + index2851 * 92 - let result2825 = mbt_ffi_ptr2str( + let result2827 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2834 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted2836 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result2826 = mbt_ffi_ptr2str( + let result2828 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result2826) + @types.DiscriminatorRule::Prefix(result2828) } 1 => { - let result2827 = mbt_ffi_ptr2str( + let result2829 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result2827) + @types.DiscriminatorRule::Suffix(result2829) } 2 => { - let result2828 = mbt_ffi_ptr2str( + let result2830 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result2828) + @types.DiscriminatorRule::Contains(result2830) } 3 => { - let result2829 = mbt_ffi_ptr2str( + let result2831 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result2829) + @types.DiscriminatorRule::Regex(result2831) } 4 => { - let result2830 = mbt_ffi_ptr2str( + let result2832 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted2832 : String? = match + let lifted2834 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2831 = mbt_ffi_ptr2str( + let result2833 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result2831) + Option::Some(result2833) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result2830, - literal: lifted2832, + field_name: result2832, + literal: lifted2834, }) } 5 => { - let result2833 = mbt_ffi_ptr2str( + let result2835 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result2833) + @types.DiscriminatorRule::FieldAbsent(result2835) } _ => panic() } - let lifted2836 : String? = match + let lifted2838 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2835 = mbt_ffi_ptr2str( + let result2837 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2835) + Option::Some(result2837) } _ => panic() } - let array2838 : Array[String] = [] - for index2839 = 0 - index2839 < mbt_ffi_load32(iter_base + 52) - index2839 = index2839 + 1 { + let array2840 : Array[String] = [] + for index2841 = 0 + index2841 < mbt_ffi_load32(iter_base + 52) + index2841 = index2841 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2839 * 8 + index2841 * 8 - let result2837 = mbt_ffi_ptr2str( + let result2839 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2838.push(result2837) + array2840.push(result2839) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2841 : Array[String] = [] - for index2842 = 0 - index2842 < mbt_ffi_load32(iter_base + 60) - index2842 = index2842 + 1 { + let array2843 : Array[String] = [] + for index2844 = 0 + index2844 < mbt_ffi_load32(iter_base + 60) + index2844 = index2844 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2842 * 8 + index2844 * 8 - let result2840 = mbt_ffi_ptr2str( + let result2842 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2841.push(result2840) + array2843.push(result2842) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted2844 : String? = match + let lifted2846 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2843 = mbt_ffi_ptr2str( + let result2845 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2843) + Option::Some(result2845) } _ => panic() } - let lifted2847 : @types.Role? = match + let lifted2849 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted2846 = match + let lifted2848 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2845 = mbt_ffi_ptr2str( + let result2847 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result2845) + @types.Role::Other(result2847) } _ => panic() } - Option::Some(lifted2846) + Option::Some(lifted2848) } _ => panic() } - array2848.push(@types.UnionBranch::{ - tag: result2825, + array2850.push(@types.UnionBranch::{ + tag: result2827, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted2834, + discriminator: lifted2836, metadata: @types.MetadataEnvelope::{ - doc: lifted2836, - aliases: array2838, - examples: array2841, - deprecated: lifted2844, - role: lifted2847, + doc: lifted2838, + aliases: array2840, + examples: array2843, + deprecated: lifted2846, + role: lifted2849, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array2848, + branches: array2850, }) } 32 => { - let lifted2851 : String? = match + let lifted2853 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2850 = mbt_ffi_ptr2str( + let result2852 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2850) + Option::Some(result2852) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted2851, + category: lifted2853, }) } 33 => { - let lifted2853 : String? = match + let lifted2855 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2852 = mbt_ffi_ptr2str( + let result2854 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2852) + Option::Some(result2854) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted2853, + resource_name: lifted2855, }) } 34 => { - let lifted2854 : Int? = match + let lifted2856 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted2854) + @types.SchemaTypeBody::FutureType(lifted2856) } 35 => { - let lifted2855 : Int? = match + let lifted2857 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted2855) + @types.SchemaTypeBody::StreamType(lifted2857) } _ => panic() } - let lifted2858 : String? = match + let lifted2860 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result2857 = mbt_ffi_ptr2str( + let result2859 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result2857) + Option::Some(result2859) } _ => panic() } - let array2860 : Array[String] = [] - for index2861 = 0 - index2861 < mbt_ffi_load32(iter_base + 104) - index2861 = index2861 + 1 { + let array2862 : Array[String] = [] + for index2863 = 0 + index2863 < mbt_ffi_load32(iter_base + 104) + index2863 = index2863 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index2861 * 8 + index2863 * 8 - let result2859 = mbt_ffi_ptr2str( + let result2861 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2860.push(result2859) + array2862.push(result2861) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array2863 : Array[String] = [] - for index2864 = 0 - index2864 < mbt_ffi_load32(iter_base + 112) - index2864 = index2864 + 1 { + let array2865 : Array[String] = [] + for index2866 = 0 + index2866 < mbt_ffi_load32(iter_base + 112) + index2866 = index2866 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index2864 * 8 + index2866 * 8 - let result2862 = mbt_ffi_ptr2str( + let result2864 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2863.push(result2862) + array2865.push(result2864) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted2866 : String? = match + let lifted2868 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result2865 = mbt_ffi_ptr2str( + let result2867 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result2865) + Option::Some(result2867) } _ => panic() } - let lifted2869 : @types.Role? = match + let lifted2871 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted2868 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted2870 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2867 = mbt_ffi_ptr2str( + let result2869 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result2867) + @types.Role::Other(result2869) } _ => panic() } - Option::Some(lifted2868) + Option::Some(lifted2870) } _ => panic() } - array2870.push(@types.SchemaTypeNode::{ - body: lifted2856, + array2872.push(@types.SchemaTypeNode::{ + body: lifted2858, metadata: @types.MetadataEnvelope::{ - doc: lifted2858, - aliases: array2860, - examples: array2863, - deprecated: lifted2866, - role: lifted2869, + doc: lifted2860, + aliases: array2862, + examples: array2865, + deprecated: lifted2868, + role: lifted2871, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2875 : Array[@types.SchemaTypeDef] = [] - for index2876 = 0 - index2876 < mbt_ffi_load32(iter_base + 60) - index2876 = index2876 + 1 { + let array2877 : Array[@types.SchemaTypeDef] = [] + for index2878 = 0 + index2878 < mbt_ffi_load32(iter_base + 60) + index2878 = index2878 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2876 * 24 + index2878 * 24 - let result2872 = mbt_ffi_ptr2str( + let result2874 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2874 : String? = match + let lifted2876 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2873 = mbt_ffi_ptr2str( + let result2875 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2873) + Option::Some(result2875) } _ => panic() } - array2875.push(@types.SchemaTypeDef::{ - id: result2872, - name: lifted2874, + array2877.push(@types.SchemaTypeDef::{ + id: result2874, + name: lifted2876, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let array2906 : Array[@types.SchemaValueNode] = [] - for index2907 = 0 - index2907 < mbt_ffi_load32(iter_base + 72) - index2907 = index2907 + 1 { + let array2908 : Array[@types.SchemaValueNode] = [] + for index2909 = 0 + index2909 < mbt_ffi_load32(iter_base + 72) + index2909 = index2909 + 1 { let iter_base = mbt_ffi_load32(iter_base + 68) + - index2907 * 32 + index2909 * 32 - let lifted2905 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2907 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -26991,29 +27053,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result2877 = mbt_ffi_ptr2str( + let result2879 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result2877) + @types.SchemaValueNode::StringValue(result2879) } 13 => { - let array2878 : Array[Int] = [] - for index2879 = 0 - index2879 < mbt_ffi_load32(iter_base + 12) - index2879 = index2879 + 1 { + let array2880 : Array[Int] = [] + for index2881 = 0 + index2881 < mbt_ffi_load32(iter_base + 12) + index2881 = index2881 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2879 * 4 + index2881 * 4 - array2878.push(mbt_ffi_load32(iter_base + 0)) + array2880.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array2878) + @types.SchemaValueNode::RecordValue(array2880) } 14 => { - let lifted2880 : Int? = match + let lifted2882 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -27022,7 +27084,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted2880, + payload: lifted2882, }) } 15 => @@ -27030,34 +27092,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array2881 : Array[Bool] = [] - for index2882 = 0 - index2882 < mbt_ffi_load32(iter_base + 12) - index2882 = index2882 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index2882 * 1 - - array2881.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array2881) - } - 17 => { - let array2883 : Array[Int] = [] + let array2883 : Array[Bool] = [] for index2884 = 0 index2884 < mbt_ffi_load32(iter_base + 12) index2884 = index2884 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2884 * 4 + index2884 * 1 - array2883.push(mbt_ffi_load32(iter_base + 0)) + array2883.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array2883) + @types.SchemaValueNode::FlagsValue(array2883) } - 18 => { + 17 => { let array2885 : Array[Int] = [] for index2886 = 0 index2886 < mbt_ffi_load32(iter_base + 12) @@ -27069,9 +27117,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array2885) + @types.SchemaValueNode::TupleValue(array2885) } - 19 => { + 18 => { let array2887 : Array[Int] = [] for index2888 = 0 index2888 < mbt_ffi_load32(iter_base + 12) @@ -27083,127 +27131,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array2887) + @types.SchemaValueNode::ListValue(array2887) } - 20 => { - let array2889 : Array[@types.MapEntry] = [] + 19 => { + let array2889 : Array[Int] = [] for index2890 = 0 index2890 < mbt_ffi_load32(iter_base + 12) index2890 = index2890 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2890 * 8 + index2890 * 4 - array2889.push(@types.MapEntry::{ + array2889.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array2889) + } + 20 => { + let array2891 : Array[@types.MapEntry] = [] + for index2892 = 0 + index2892 < mbt_ffi_load32(iter_base + 12) + index2892 = index2892 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index2892 * 8 + + array2891.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array2889) + @types.SchemaValueNode::MapValue(array2891) } 21 => { - let lifted2891 : Int? = match + let lifted2893 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted2891) + @types.SchemaValueNode::OptionValue(lifted2893) } 22 => { - let lifted2894 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2896 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted2892 : Int? = match + let lifted2894 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted2892) + @types.ResultValuePayload::OkValue(lifted2894) } 1 => { - let lifted2893 : Int? = match + let lifted2895 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted2893) + @types.ResultValuePayload::ErrValue(lifted2895) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted2894) + @types.SchemaValueNode::ResultValue(lifted2896) } 23 => { - let result2895 = mbt_ffi_ptr2str( + let result2897 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2897 : String? = match + let lifted2899 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2896 = mbt_ffi_ptr2str( + let result2898 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2896) + Option::Some(result2898) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result2895, - language: lifted2897, + text: result2897, + language: lifted2899, }) } 24 => { - let result2898 = mbt_ffi_ptr2bytes( + let result2900 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2900 : String? = match + let lifted2902 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2899 = mbt_ffi_ptr2str( + let result2901 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2899) + Option::Some(result2901) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result2898, - mime_type: lifted2900, + bytes: result2900, + mime_type: lifted2902, }) } 25 => { - let result2901 = mbt_ffi_ptr2str( + let result2903 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result2901) + @types.SchemaValueNode::PathValue(result2903) } 26 => { - let result2902 = mbt_ffi_ptr2str( + let result2904 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result2902) + @types.SchemaValueNode::UrlValue(result2904) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -27215,7 +27277,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result2903 = mbt_ffi_ptr2str( + let result2905 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -27223,17 +27285,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result2903, + unit: result2905, }) } 30 => { - let result2904 = mbt_ffi_ptr2str( + let result2906 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result2904, + tag: result2906, body: mbt_ffi_load32(iter_base + 16), }) } @@ -27247,68 +27309,74 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array2906.push(lifted2905) + array2908.push(lifted2907) } mbt_ffi_free(mbt_ffi_load32(iter_base + 68)) - let result2908 = mbt_ffi_ptr2str( + let result2910 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 80), mbt_ffi_load32(iter_base + 84), ) - let array2910 : Array[String] = [] - for index2911 = 0 - index2911 < mbt_ffi_load32(iter_base + 92) - index2911 = index2911 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 88) + index2911 * 8 + let array2912 : Array[String] = [] + for index2913 = 0 + index2913 < mbt_ffi_load32(iter_base + 92) + index2913 = index2913 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 88) + index2913 * 8 - let result2909 = mbt_ffi_ptr2str( + let result2911 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2910.push(result2909) + array2912.push(result2911) } mbt_ffi_free(mbt_ffi_load32(iter_base + 88)) - let array2925 : Array[Array[SpanData]] = [] - for index2926 = 0 - index2926 < mbt_ffi_load32(iter_base + 100) - index2926 = index2926 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 96) + index2926 * 8 + let array2927 : Array[Array[SpanData]] = [] + for index2928 = 0 + index2928 < mbt_ffi_load32(iter_base + 100) + index2928 = index2928 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 96) + index2928 * 8 - let array2923 : Array[SpanData] = [] - for index2924 = 0 - index2924 < mbt_ffi_load32(iter_base + 4) - index2924 = index2924 + 1 { + let array2925 : Array[SpanData] = [] + for index2926 = 0 + index2926 < mbt_ffi_load32(iter_base + 4) + index2926 = index2926 + 1 { let iter_base = mbt_ffi_load32(iter_base + 0) + - index2924 * 80 + index2926 * 80 - let lifted2922 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2924 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result2912 = mbt_ffi_ptr2str( + let result2914 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2914 : String? = match + let lifted2916 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result2913 = mbt_ffi_ptr2str( + let result2915 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result2913) + Option::Some(result2915) } _ => panic() } - let lifted2915 : UInt64? = match + let lifted2917 : UInt64? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -27318,117 +27386,117 @@ pub fn enrich_oplog_entries( _ => panic() } - let array2919 : Array[@context.Attribute] = [] - for index2920 = 0 - index2920 < mbt_ffi_load32(iter_base + 68) - index2920 = index2920 + 1 { + let array2921 : Array[@context.Attribute] = [] + for index2922 = 0 + index2922 < mbt_ffi_load32(iter_base + 68) + index2922 = index2922 + 1 { let iter_base = mbt_ffi_load32(iter_base + 64) + - index2920 * 20 + index2922 * 20 - let result2916 = mbt_ffi_ptr2str( + let result2918 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2918 = match + let lifted2920 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result2917 = mbt_ffi_ptr2str( + let result2919 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result2917) + @context.AttributeValue::String(result2919) } _ => panic() } - array2919.push(@context.Attribute::{ - key: result2916, - value: lifted2918, + array2921.push(@context.Attribute::{ + key: result2918, + value: lifted2920, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) SpanData::LocalSpan(LocalSpanData::{ - span_id: result2912, + span_id: result2914, start: @system-clock.Instant::{ seconds: mbt_ffi_load64(iter_base + 16), nanoseconds: mbt_ffi_load32(iter_base + 24).reinterpret_as_uint(), }, - parent: lifted2914, - linked_context: lifted2915, - attributes: array2919, + parent: lifted2916, + linked_context: lifted2917, + attributes: array2921, inherited: mbt_ffi_load8_u(iter_base + 72) != 0, }) } 1 => { - let result2921 = mbt_ffi_ptr2str( + let result2923 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) SpanData::ExternalSpan(ExternalSpanData::{ - span_id: result2921, + span_id: result2923, }) } _ => panic() } - array2923.push(lifted2922) + array2925.push(lifted2924) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - array2925.push(array2923) + array2927.push(array2925) } mbt_ffi_free(mbt_ffi_load32(iter_base + 96)) AgentInvocation::AgentMethodInvocation(AgentMethodInvocationParameters::{ - idempotency_key: result2672, - method_name: result2673, + idempotency_key: result2674, + method_name: result2675, function_input: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array2870, - defs: array2875, + type_nodes: array2872, + defs: array2877, root: mbt_ffi_load32(iter_base + 64), }, value: @types.SchemaValueTree::{ - value_nodes: array2906, + value_nodes: array2908, root: mbt_ffi_load32(iter_base + 76), }, }, - trace_id: result2908, - trace_states: array2910, - invocation_context: array2925, + trace_id: result2910, + trace_states: array2912, + invocation_context: array2927, }) } 2 => AgentInvocation::SaveSnapshot 3 => { - let result2927 = mbt_ffi_ptr2bytes( + let result2929 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result2928 = mbt_ffi_ptr2str( + let result2930 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) AgentInvocation::LoadSnapshot(LoadSnapshotParameters::{ snapshot: SnapshotData::{ - data: result2927, - mime_type: result2928, + data: result2929, + mime_type: result2930, }, }) } 4 => { - let result2929 = mbt_ffi_ptr2str( + let result2931 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) AgentInvocation::ProcessOplogEntries(ProcessOplogEntriesParameters::{ - idempotency_key: result2929, + idempotency_key: result2931, }) } 5 => @@ -27443,26 +27511,26 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - invocation: lifted2930, + invocation: lifted2932, }) } 15 => { - let lifted2933 = match mbt_ffi_load8_u(iter_base + 32) { + let lifted2935 = match mbt_ffi_load8_u(iter_base + 32) { 0 => UpdateDescription::AutoUpdate 1 => { - let result2931 = mbt_ffi_ptr2bytes( + let result2933 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - let result2932 = mbt_ffi_ptr2str( + let result2934 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) UpdateDescription::SnapshotBased(@host.Snapshot::{ - payload: result2931, - mime_type: result2932, + payload: result2933, + mime_type: result2934, }) } _ => panic() @@ -27474,47 +27542,47 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, target_revision: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - description: lifted2933, + description: lifted2935, }) } 16 => { - let array2940 : Array[PluginInstallationDescription] = [] - for index2941 = 0 - index2941 < mbt_ffi_load32(iter_base + 44) - index2941 = index2941 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 40) + index2941 * 48 + let array2942 : Array[PluginInstallationDescription] = [] + for index2943 = 0 + index2943 < mbt_ffi_load32(iter_base + 44) + index2943 = index2943 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 40) + index2943 * 48 - let result2934 = mbt_ffi_ptr2str( + let result2936 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - let result2935 = mbt_ffi_ptr2str( + let result2937 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - let array2938 : Array[(String, String)] = [] - for index2939 = 0 - index2939 < mbt_ffi_load32(iter_base + 40) - index2939 = index2939 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index2939 * 16 + let array2940 : Array[(String, String)] = [] + for index2941 = 0 + index2941 < mbt_ffi_load32(iter_base + 40) + index2941 = index2941 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index2941 * 16 - let result2936 = mbt_ffi_ptr2str( + let result2938 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result2937 = mbt_ffi_ptr2str( + let result2939 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array2938.push((result2936, result2937)) + array2940.push((result2938, result2939)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - array2940.push(PluginInstallationDescription::{ + array2942.push(PluginInstallationDescription::{ environment_plugin_grant_id: EnvironmentPluginGrantId::{ uuid: @types.Uuid::{ high_bits: mbt_ffi_load64(iter_base + 0).reinterpret_as_uint64(), @@ -27522,9 +27590,9 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 16), - plugin_name: result2934, - plugin_version: result2935, - parameters: array2938, + plugin_name: result2936, + plugin_version: result2937, + parameters: array2940, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 40)) @@ -27536,19 +27604,19 @@ pub fn enrich_oplog_entries( }, target_revision: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), new_component_size: mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), - new_active_plugins: array2940, + new_active_plugins: array2942, }) } 17 => { - let lifted2943 : String? = match mbt_ffi_load8_u(iter_base + 32) { + let lifted2945 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result2942 = mbt_ffi_ptr2str( + let result2944 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result2942) + Option::Some(result2944) } _ => panic() } @@ -27559,7 +27627,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, target_revision: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - details: lifted2943, + details: lifted2945, }) } 18 => @@ -27579,12 +27647,12 @@ pub fn enrich_oplog_entries( delta: mbt_ffi_load64(iter_base + 24), }) 20 => { - let result2944 = mbt_ffi_ptr2str( + let result2946 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result2945 = mbt_ffi_ptr2str( + let result2947 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) @@ -27595,17 +27663,17 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, id: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - name: result2944, - owner: result2945, + name: result2946, + owner: result2947, }) } 21 => { - let result2946 = mbt_ffi_ptr2str( + let result2948 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result2947 = mbt_ffi_ptr2str( + let result2949 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) @@ -27616,17 +27684,17 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, id: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - name: result2946, - owner: result2947, + name: result2948, + owner: result2949, }) } 22 => { - let result2948 = mbt_ffi_ptr2str( + let result2950 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - let result2949 = mbt_ffi_ptr2str( + let result2951 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) @@ -27637,8 +27705,8 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, level: LogLevel::from(mbt_ffi_load8_u(iter_base + 24)), - context: result2948, - message: result2949, + context: result2950, + message: result2951, }) } 23 => @@ -27649,33 +27717,33 @@ pub fn enrich_oplog_entries( }, }) 24 => { - let result2950 = mbt_ffi_ptr2str( + let result2952 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - let result2951 = mbt_ffi_ptr2str( + let result2953 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 52), mbt_ffi_load32(iter_base + 56), ) - let array2954 : Array[(String, String)] = [] - for index2955 = 0 - index2955 < mbt_ffi_load32(iter_base + 64) - index2955 = index2955 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 60) + index2955 * 16 + let array2956 : Array[(String, String)] = [] + for index2957 = 0 + index2957 < mbt_ffi_load32(iter_base + 64) + index2957 = index2957 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 60) + index2957 * 16 - let result2952 = mbt_ffi_ptr2str( + let result2954 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result2953 = mbt_ffi_ptr2str( + let result2955 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array2954.push((result2952, result2953)) + array2956.push((result2954, result2955)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) @@ -27692,40 +27760,40 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 40), - plugin_name: result2950, - plugin_version: result2951, - parameters: array2954, + plugin_name: result2952, + plugin_version: result2953, + parameters: array2956, }, }) } 25 => { - let result2956 = mbt_ffi_ptr2str( + let result2958 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - let result2957 = mbt_ffi_ptr2str( + let result2959 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 52), mbt_ffi_load32(iter_base + 56), ) - let array2960 : Array[(String, String)] = [] - for index2961 = 0 - index2961 < mbt_ffi_load32(iter_base + 64) - index2961 = index2961 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 60) + index2961 * 16 + let array2962 : Array[(String, String)] = [] + for index2963 = 0 + index2963 < mbt_ffi_load32(iter_base + 64) + index2963 = index2963 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 60) + index2963 * 16 - let result2958 = mbt_ffi_ptr2str( + let result2960 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result2959 = mbt_ffi_ptr2str( + let result2961 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array2960.push((result2958, result2959)) + array2962.push((result2960, result2961)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) @@ -27742,9 +27810,9 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 40), - plugin_name: result2956, - plugin_version: result2957, - parameters: array2960, + plugin_name: result2958, + plugin_version: result2959, + parameters: array2962, }, }) } @@ -27760,7 +27828,7 @@ pub fn enrich_oplog_entries( }, }) 27 => { - let result2962 = mbt_ffi_ptr2str( + let result2964 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) @@ -27770,67 +27838,67 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - idempotency_key: result2962, + idempotency_key: result2964, }) } 28 => { - let result2963 = mbt_ffi_ptr2str( + let result2965 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let lifted2965 : String? = match mbt_ffi_load8_u(iter_base + 32) { + let lifted2967 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result2964 = mbt_ffi_ptr2str( + let result2966 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result2964) + Option::Some(result2966) } _ => panic() } - let lifted2967 : String? = match mbt_ffi_load8_u(iter_base + 44) { + let lifted2969 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2966 = mbt_ffi_ptr2str( + let result2968 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2966) + Option::Some(result2968) } _ => panic() } - let array2971 : Array[@context.Attribute] = [] - for index2972 = 0 - index2972 < mbt_ffi_load32(iter_base + 60) - index2972 = index2972 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 56) + index2972 * 20 + let array2973 : Array[@context.Attribute] = [] + for index2974 = 0 + index2974 < mbt_ffi_load32(iter_base + 60) + index2974 = index2974 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 56) + index2974 * 20 - let result2968 = mbt_ffi_ptr2str( + let result2970 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2970 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2972 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result2969 = mbt_ffi_ptr2str( + let result2971 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result2969) + @context.AttributeValue::String(result2971) } _ => panic() } - array2971.push(@context.Attribute::{ - key: result2968, - value: lifted2970, + array2973.push(@context.Attribute::{ + key: result2970, + value: lifted2972, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) @@ -27840,14 +27908,14 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - span_id: result2963, - parent: lifted2965, - linked_context_id: lifted2967, - attributes: array2971, + span_id: result2965, + parent: lifted2967, + linked_context_id: lifted2969, + attributes: array2973, }) } 29 => { - let result2973 = mbt_ffi_ptr2str( + let result2975 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) @@ -27857,28 +27925,28 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - span_id: result2973, + span_id: result2975, }) } 30 => { - let result2974 = mbt_ffi_ptr2str( + let result2976 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let result2975 = mbt_ffi_ptr2str( + let result2977 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let lifted2977 = match mbt_ffi_load8_u(iter_base + 40) { + let lifted2979 = match mbt_ffi_load8_u(iter_base + 40) { 0 => { - let result2976 = mbt_ffi_ptr2str( + let result2978 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - @context.AttributeValue::String(result2976) + @context.AttributeValue::String(result2978) } _ => panic() } @@ -27888,13 +27956,13 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - span_id: result2974, - key: result2975, - value: lifted2977, + span_id: result2976, + key: result2977, + value: lifted2979, }) } 31 => { - let lifted2978 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted2980 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @host.PersistenceLevel::PersistNothing 1 => @host.PersistenceLevel::PersistRemoteSideEffects 2 => @host.PersistenceLevel::Smart @@ -27906,11 +27974,11 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - persistence_level: lifted2978, + persistence_level: lifted2980, }) } 32 => { - let result2979 = mbt_ffi_ptr2str( + let result2981 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) @@ -27920,7 +27988,7 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - transaction_id: result2979, + transaction_id: result2981, }) } 33 => @@ -27956,12 +28024,12 @@ pub fn enrich_oplog_entries( begin_index: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), }) 37 => { - let result2980 = mbt_ffi_ptr2bytes( + let result2982 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let result2981 = mbt_ffi_ptr2str( + let result2983 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) @@ -27971,41 +28039,41 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - data: SnapshotData::{ data: result2980, mime_type: result2981 }, + data: SnapshotData::{ data: result2982, mime_type: result2983 }, }) } 38 => { - let result2982 = mbt_ffi_ptr2str( + let result2984 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - let result2983 = mbt_ffi_ptr2str( + let result2985 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 52), mbt_ffi_load32(iter_base + 56), ) - let array2986 : Array[(String, String)] = [] - for index2987 = 0 - index2987 < mbt_ffi_load32(iter_base + 64) - index2987 = index2987 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 60) + index2987 * 16 + let array2988 : Array[(String, String)] = [] + for index2989 = 0 + index2989 < mbt_ffi_load32(iter_base + 64) + index2989 = index2989 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 60) + index2989 * 16 - let result2984 = mbt_ffi_ptr2str( + let result2986 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result2985 = mbt_ffi_ptr2str( + let result2987 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array2986.push((result2984, result2985)) + array2988.push((result2986, result2987)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) - let result2988 = mbt_ffi_ptr2str( + let result2990 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 88), mbt_ffi_load32(iter_base + 92), ) @@ -28023,9 +28091,9 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 40), - plugin_name: result2982, - plugin_version: result2983, - parameters: array2986, + plugin_name: result2984, + plugin_version: result2985, + parameters: array2988, }, target_agent_id: @types.AgentId::{ component_id: @types.ComponentId::{ @@ -28034,7 +28102,7 @@ pub fn enrich_oplog_entries( low_bits: mbt_ffi_load64(iter_base + 80).reinterpret_as_uint64(), }, }, - agent_id: result2988, + agent_id: result2990, }, confirmed_up_to: mbt_ffi_load64(iter_base + 96).reinterpret_as_uint64(), sending_up_to: mbt_ffi_load64(iter_base + 104).reinterpret_as_uint64(), @@ -28042,32 +28110,32 @@ pub fn enrich_oplog_entries( }) } 39 => { - let result2989 = mbt_ffi_ptr2str( + let result2991 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let array3021 : Array[@retry.PredicateNode] = [] - for index3022 = 0 - index3022 < mbt_ffi_load32(iter_base + 40) - index3022 = index3022 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index3022 * 32 + let array3023 : Array[@retry.PredicateNode] = [] + for index3024 = 0 + index3024 < mbt_ffi_load32(iter_base + 40) + index3024 = index3024 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index3024 * 32 - let lifted3020 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3022 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result2990 = mbt_ffi_ptr2str( + let result2992 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2992 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted2994 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result2991 = mbt_ffi_ptr2str( + let result2993 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result2991) + @retry.PredicateValue::Text(result2993) } 1 => @retry.PredicateValue::Integer( @@ -28081,24 +28149,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropEq(@retry.PropertyComparison::{ - property_name: result2990, - value: lifted2992, + property_name: result2992, + value: lifted2994, }) } 1 => { - let result2993 = mbt_ffi_ptr2str( + let result2995 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2995 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted2997 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result2994 = mbt_ffi_ptr2str( + let result2996 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result2994) + @retry.PredicateValue::Text(result2996) } 1 => @retry.PredicateValue::Integer( @@ -28112,24 +28180,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropNeq(@retry.PropertyComparison::{ - property_name: result2993, - value: lifted2995, + property_name: result2995, + value: lifted2997, }) } 2 => { - let result2996 = mbt_ffi_ptr2str( + let result2998 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2998 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3000 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result2997 = mbt_ffi_ptr2str( + let result2999 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result2997) + @retry.PredicateValue::Text(result2999) } 1 => @retry.PredicateValue::Integer( @@ -28143,24 +28211,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropGt(@retry.PropertyComparison::{ - property_name: result2996, - value: lifted2998, + property_name: result2998, + value: lifted3000, }) } 3 => { - let result2999 = mbt_ffi_ptr2str( + let result3001 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3001 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3003 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3000 = mbt_ffi_ptr2str( + let result3002 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3000) + @retry.PredicateValue::Text(result3002) } 1 => @retry.PredicateValue::Integer( @@ -28174,24 +28242,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropGte(@retry.PropertyComparison::{ - property_name: result2999, - value: lifted3001, + property_name: result3001, + value: lifted3003, }) } 4 => { - let result3002 = mbt_ffi_ptr2str( + let result3004 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3004 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3006 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3003 = mbt_ffi_ptr2str( + let result3005 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3003) + @retry.PredicateValue::Text(result3005) } 1 => @retry.PredicateValue::Integer( @@ -28205,24 +28273,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropLt(@retry.PropertyComparison::{ - property_name: result3002, - value: lifted3004, + property_name: result3004, + value: lifted3006, }) } 5 => { - let result3005 = mbt_ffi_ptr2str( + let result3007 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3007 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3009 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3006 = mbt_ffi_ptr2str( + let result3008 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3006) + @retry.PredicateValue::Text(result3008) } 1 => @retry.PredicateValue::Integer( @@ -28236,39 +28304,39 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropLte(@retry.PropertyComparison::{ - property_name: result3005, - value: lifted3007, + property_name: result3007, + value: lifted3009, }) } 6 => { - let result3008 = mbt_ffi_ptr2str( + let result3010 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @retry.PredicateNode::PropExists(result3008) + @retry.PredicateNode::PropExists(result3010) } 7 => { - let result3009 = mbt_ffi_ptr2str( + let result3011 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array3012 : Array[@retry.PredicateValue] = [] - for index3013 = 0 - index3013 < mbt_ffi_load32(iter_base + 20) - index3013 = index3013 + 1 { + let array3014 : Array[@retry.PredicateValue] = [] + for index3015 = 0 + index3015 < mbt_ffi_load32(iter_base + 20) + index3015 = index3015 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index3013 * 16 + index3015 * 16 - let lifted3011 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3013 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result3010 = mbt_ffi_ptr2str( + let result3012 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @retry.PredicateValue::Text(result3010) + @retry.PredicateValue::Text(result3012) } 1 => @retry.PredicateValue::Integer( @@ -28281,61 +28349,61 @@ pub fn enrich_oplog_entries( _ => panic() } - array3012.push(lifted3011) + array3014.push(lifted3013) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) @retry.PredicateNode::PropIn(@retry.PropertySetCheck::{ - property_name: result3009, - values: array3012, + property_name: result3011, + values: array3014, }) } 8 => { - let result3014 = mbt_ffi_ptr2str( + let result3016 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3015 = mbt_ffi_ptr2str( + let result3017 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropMatches(@retry.PropertyPattern::{ - property_name: result3014, - pattern: result3015, + property_name: result3016, + pattern: result3017, }) } 9 => { - let result3016 = mbt_ffi_ptr2str( + let result3018 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3017 = mbt_ffi_ptr2str( + let result3019 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropStartsWith(@retry.PropertyPattern::{ - property_name: result3016, - pattern: result3017, + property_name: result3018, + pattern: result3019, }) } 10 => { - let result3018 = mbt_ffi_ptr2str( + let result3020 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3019 = mbt_ffi_ptr2str( + let result3021 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropContains(@retry.PropertyPattern::{ - property_name: result3018, - pattern: result3019, + property_name: result3020, + pattern: result3021, }) } 11 => @@ -28359,17 +28427,17 @@ pub fn enrich_oplog_entries( _ => panic() } - array3021.push(lifted3020) + array3023.push(lifted3022) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array3057 : Array[@retry.PolicyNode] = [] - for index3058 = 0 - index3058 < mbt_ffi_load32(iter_base + 48) - index3058 = index3058 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 44) + index3058 * 32 + let array3059 : Array[@retry.PolicyNode] = [] + for index3060 = 0 + index3060 < mbt_ffi_load32(iter_base + 48) + index3060 = index3060 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 44) + index3060 * 32 - let lifted3056 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3058 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @retry.PolicyNode::Periodic( mbt_ffi_load64(iter_base + 8).reinterpret_as_uint64(), @@ -28413,28 +28481,28 @@ pub fn enrich_oplog_entries( inner: mbt_ffi_load32(iter_base + 16), }) 10 => { - let array3054 : Array[@retry.PredicateNode] = [] - for index3055 = 0 - index3055 < mbt_ffi_load32(iter_base + 12) - index3055 = index3055 + 1 { + let array3056 : Array[@retry.PredicateNode] = [] + for index3057 = 0 + index3057 < mbt_ffi_load32(iter_base + 12) + index3057 = index3057 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3055 * 32 + index3057 * 32 - let lifted3053 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3055 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result3023 = mbt_ffi_ptr2str( + let result3025 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3025 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3027 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3024 = mbt_ffi_ptr2str( + let result3026 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3024) + @retry.PredicateValue::Text(result3026) } 1 => @retry.PredicateValue::Integer( @@ -28448,24 +28516,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropEq(@retry.PropertyComparison::{ - property_name: result3023, - value: lifted3025, + property_name: result3025, + value: lifted3027, }) } 1 => { - let result3026 = mbt_ffi_ptr2str( + let result3028 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3028 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3030 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3027 = mbt_ffi_ptr2str( + let result3029 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3027) + @retry.PredicateValue::Text(result3029) } 1 => @retry.PredicateValue::Integer( @@ -28479,24 +28547,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropNeq(@retry.PropertyComparison::{ - property_name: result3026, - value: lifted3028, + property_name: result3028, + value: lifted3030, }) } 2 => { - let result3029 = mbt_ffi_ptr2str( + let result3031 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3031 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3033 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3030 = mbt_ffi_ptr2str( + let result3032 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3030) + @retry.PredicateValue::Text(result3032) } 1 => @retry.PredicateValue::Integer( @@ -28510,24 +28578,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropGt(@retry.PropertyComparison::{ - property_name: result3029, - value: lifted3031, + property_name: result3031, + value: lifted3033, }) } 3 => { - let result3032 = mbt_ffi_ptr2str( + let result3034 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3034 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3036 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3033 = mbt_ffi_ptr2str( + let result3035 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3033) + @retry.PredicateValue::Text(result3035) } 1 => @retry.PredicateValue::Integer( @@ -28541,24 +28609,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropGte(@retry.PropertyComparison::{ - property_name: result3032, - value: lifted3034, + property_name: result3034, + value: lifted3036, }) } 4 => { - let result3035 = mbt_ffi_ptr2str( + let result3037 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3037 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3039 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3036 = mbt_ffi_ptr2str( + let result3038 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3036) + @retry.PredicateValue::Text(result3038) } 1 => @retry.PredicateValue::Integer( @@ -28572,24 +28640,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropLt(@retry.PropertyComparison::{ - property_name: result3035, - value: lifted3037, + property_name: result3037, + value: lifted3039, }) } 5 => { - let result3038 = mbt_ffi_ptr2str( + let result3040 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3040 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3042 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3039 = mbt_ffi_ptr2str( + let result3041 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3039) + @retry.PredicateValue::Text(result3041) } 1 => @retry.PredicateValue::Integer( @@ -28603,40 +28671,40 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropLte(@retry.PropertyComparison::{ - property_name: result3038, - value: lifted3040, + property_name: result3040, + value: lifted3042, }) } 6 => { - let result3041 = mbt_ffi_ptr2str( + let result3043 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @retry.PredicateNode::PropExists(result3041) + @retry.PredicateNode::PropExists(result3043) } 7 => { - let result3042 = mbt_ffi_ptr2str( + let result3044 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array3045 : Array[@retry.PredicateValue] = [] - for index3046 = 0 - index3046 < mbt_ffi_load32(iter_base + 20) - index3046 = index3046 + 1 { + let array3047 : Array[@retry.PredicateValue] = [] + for index3048 = 0 + index3048 < mbt_ffi_load32(iter_base + 20) + index3048 = index3048 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index3046 * 16 + index3048 * 16 - let lifted3044 = match + let lifted3046 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result3043 = mbt_ffi_ptr2str( + let result3045 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @retry.PredicateValue::Text(result3043) + @retry.PredicateValue::Text(result3045) } 1 => @retry.PredicateValue::Integer( @@ -28649,61 +28717,61 @@ pub fn enrich_oplog_entries( _ => panic() } - array3045.push(lifted3044) + array3047.push(lifted3046) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) @retry.PredicateNode::PropIn(@retry.PropertySetCheck::{ - property_name: result3042, - values: array3045, + property_name: result3044, + values: array3047, }) } 8 => { - let result3047 = mbt_ffi_ptr2str( + let result3049 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3048 = mbt_ffi_ptr2str( + let result3050 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropMatches(@retry.PropertyPattern::{ - property_name: result3047, - pattern: result3048, + property_name: result3049, + pattern: result3050, }) } 9 => { - let result3049 = mbt_ffi_ptr2str( + let result3051 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3050 = mbt_ffi_ptr2str( + let result3052 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropStartsWith(@retry.PropertyPattern::{ - property_name: result3049, - pattern: result3050, + property_name: result3051, + pattern: result3052, }) } 10 => { - let result3051 = mbt_ffi_ptr2str( + let result3053 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3052 = mbt_ffi_ptr2str( + let result3054 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropContains(@retry.PropertyPattern::{ - property_name: result3051, - pattern: result3052, + property_name: result3053, + pattern: result3054, }) } 11 => @@ -28729,12 +28797,12 @@ pub fn enrich_oplog_entries( _ => panic() } - array3054.push(lifted3053) + array3056.push(lifted3055) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @retry.PolicyNode::FilteredOn(@retry.FilteredConfig::{ - predicate: @retry.RetryPredicate::{ nodes: array3054 }, + predicate: @retry.RetryPredicate::{ nodes: array3056 }, inner: mbt_ffi_load32(iter_base + 16), }) } @@ -28762,7 +28830,7 @@ pub fn enrich_oplog_entries( _ => panic() } - array3057.push(lifted3056) + array3059.push(lifted3058) } mbt_ffi_free(mbt_ffi_load32(iter_base + 44)) @@ -28772,15 +28840,15 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, policy: @retry.NamedRetryPolicy::{ - name: result2989, + name: result2991, priority: mbt_ffi_load32(iter_base + 32).reinterpret_as_uint(), - predicate: @retry.RetryPredicate::{ nodes: array3021 }, - policy: @retry.RetryPolicy::{ nodes: array3057 }, + predicate: @retry.RetryPredicate::{ nodes: array3023 }, + policy: @retry.RetryPolicy::{ nodes: array3059 }, }, }) } 40 => { - let result3059 = mbt_ffi_ptr2str( + let result3061 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) @@ -28790,11 +28858,11 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - name: result3059, + name: result3061, }) } 41 => { - let lifted3060 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted3062 = match mbt_ffi_load8_u(iter_base + 24) { 0 => QueuedCardEvent::Install(QueuedCardEventInstall::{ card_id: @types.CardId::{ @@ -28821,11 +28889,11 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - event: lifted3060, + event: lifted3062, }) } 42 => { - let lifted3061 : UInt64? = match mbt_ffi_load8_u(iter_base + 24) { + let lifted3063 : UInt64? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => Option::Some( @@ -28839,7 +28907,7 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - queued_event_index: lifted3061, + queued_event_index: lifted3063, card_id: @types.CardId::{ uuid: @types.Uuid::{ high_bits: mbt_ffi_load64(iter_base + 40).reinterpret_as_uint64(), @@ -28891,26 +28959,26 @@ pub fn enrich_oplog_entries( }, }) 46 => { - let array3258 : Array[@types.SchemaTypeNode] = [] - for index3259 = 0 - index3259 < mbt_ffi_load32(iter_base + 40) - index3259 = index3259 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index3259 * 144 + let array3260 : Array[@types.SchemaTypeNode] = [] + for index3261 = 0 + index3261 < mbt_ffi_load32(iter_base + 40) + index3261 = index3261 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index3261 * 144 - let lifted3244 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3246 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType(mbt_ffi_load32(iter_base + 8)) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted3068 : @types.NumericRestrictions? = match + let lifted3070 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3063 : @types.NumericBound? = match + let lifted3065 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3062 = match + let lifted3064 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -28927,16 +28995,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3062) + Option::Some(lifted3064) } _ => panic() } - let lifted3065 : @types.NumericBound? = match + let lifted3067 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3064 = match + let lifted3066 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -28953,46 +29021,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3064) + Option::Some(lifted3066) } _ => panic() } - let lifted3067 : String? = match + let lifted3069 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3066 = mbt_ffi_ptr2str( + let result3068 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3066) + Option::Some(result3068) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3063, - max: lifted3065, - unit: lifted3067, + min: lifted3065, + max: lifted3067, + unit: lifted3069, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted3068) + @types.SchemaTypeBody::S8Type(lifted3070) } 3 => { - let lifted3075 : @types.NumericRestrictions? = match + let lifted3077 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3070 : @types.NumericBound? = match + let lifted3072 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3069 = match + let lifted3071 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29009,16 +29077,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3069) + Option::Some(lifted3071) } _ => panic() } - let lifted3072 : @types.NumericBound? = match + let lifted3074 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3071 = match + let lifted3073 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29035,46 +29103,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3071) + Option::Some(lifted3073) } _ => panic() } - let lifted3074 : String? = match + let lifted3076 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3073 = mbt_ffi_ptr2str( + let result3075 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3073) + Option::Some(result3075) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3070, - max: lifted3072, - unit: lifted3074, + min: lifted3072, + max: lifted3074, + unit: lifted3076, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted3075) + @types.SchemaTypeBody::S16Type(lifted3077) } 4 => { - let lifted3082 : @types.NumericRestrictions? = match + let lifted3084 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3077 : @types.NumericBound? = match + let lifted3079 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3076 = match + let lifted3078 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29091,16 +29159,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3076) + Option::Some(lifted3078) } _ => panic() } - let lifted3079 : @types.NumericBound? = match + let lifted3081 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3078 = match + let lifted3080 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29117,46 +29185,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3078) + Option::Some(lifted3080) } _ => panic() } - let lifted3081 : String? = match + let lifted3083 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3080 = mbt_ffi_ptr2str( + let result3082 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3080) + Option::Some(result3082) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3077, - max: lifted3079, - unit: lifted3081, + min: lifted3079, + max: lifted3081, + unit: lifted3083, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted3082) + @types.SchemaTypeBody::S32Type(lifted3084) } 5 => { - let lifted3089 : @types.NumericRestrictions? = match + let lifted3091 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3084 : @types.NumericBound? = match + let lifted3086 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3083 = match + let lifted3085 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29173,16 +29241,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3083) + Option::Some(lifted3085) } _ => panic() } - let lifted3086 : @types.NumericBound? = match + let lifted3088 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3085 = match + let lifted3087 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29199,46 +29267,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3085) + Option::Some(lifted3087) } _ => panic() } - let lifted3088 : String? = match + let lifted3090 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3087 = mbt_ffi_ptr2str( + let result3089 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3087) + Option::Some(result3089) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3084, - max: lifted3086, - unit: lifted3088, + min: lifted3086, + max: lifted3088, + unit: lifted3090, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted3089) + @types.SchemaTypeBody::S64Type(lifted3091) } 6 => { - let lifted3096 : @types.NumericRestrictions? = match + let lifted3098 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3091 : @types.NumericBound? = match + let lifted3093 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3090 = match + let lifted3092 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29255,16 +29323,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3090) + Option::Some(lifted3092) } _ => panic() } - let lifted3093 : @types.NumericBound? = match + let lifted3095 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3092 = match + let lifted3094 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29281,46 +29349,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3092) + Option::Some(lifted3094) } _ => panic() } - let lifted3095 : String? = match + let lifted3097 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3094 = mbt_ffi_ptr2str( + let result3096 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3094) + Option::Some(result3096) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3091, - max: lifted3093, - unit: lifted3095, + min: lifted3093, + max: lifted3095, + unit: lifted3097, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted3096) + @types.SchemaTypeBody::U8Type(lifted3098) } 7 => { - let lifted3103 : @types.NumericRestrictions? = match + let lifted3105 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3098 : @types.NumericBound? = match + let lifted3100 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3097 = match + let lifted3099 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29337,16 +29405,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3097) + Option::Some(lifted3099) } _ => panic() } - let lifted3100 : @types.NumericBound? = match + let lifted3102 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3099 = match + let lifted3101 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29363,46 +29431,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3099) + Option::Some(lifted3101) } _ => panic() } - let lifted3102 : String? = match + let lifted3104 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3101 = mbt_ffi_ptr2str( + let result3103 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3101) + Option::Some(result3103) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3098, - max: lifted3100, - unit: lifted3102, + min: lifted3100, + max: lifted3102, + unit: lifted3104, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted3103) + @types.SchemaTypeBody::U16Type(lifted3105) } 8 => { - let lifted3110 : @types.NumericRestrictions? = match + let lifted3112 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3105 : @types.NumericBound? = match + let lifted3107 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3104 = match + let lifted3106 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29419,16 +29487,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3104) + Option::Some(lifted3106) } _ => panic() } - let lifted3107 : @types.NumericBound? = match + let lifted3109 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3106 = match + let lifted3108 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29445,46 +29513,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3106) + Option::Some(lifted3108) } _ => panic() } - let lifted3109 : String? = match + let lifted3111 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3108 = mbt_ffi_ptr2str( + let result3110 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3108) + Option::Some(result3110) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3105, - max: lifted3107, - unit: lifted3109, + min: lifted3107, + max: lifted3109, + unit: lifted3111, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted3110) + @types.SchemaTypeBody::U32Type(lifted3112) } 9 => { - let lifted3117 : @types.NumericRestrictions? = match + let lifted3119 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3112 : @types.NumericBound? = match + let lifted3114 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3111 = match + let lifted3113 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29501,16 +29569,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3111) + Option::Some(lifted3113) } _ => panic() } - let lifted3114 : @types.NumericBound? = match + let lifted3116 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3113 = match + let lifted3115 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29527,46 +29595,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3113) + Option::Some(lifted3115) } _ => panic() } - let lifted3116 : String? = match + let lifted3118 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3115 = mbt_ffi_ptr2str( + let result3117 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3115) + Option::Some(result3117) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3112, - max: lifted3114, - unit: lifted3116, + min: lifted3114, + max: lifted3116, + unit: lifted3118, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted3117) + @types.SchemaTypeBody::U64Type(lifted3119) } 10 => { - let lifted3124 : @types.NumericRestrictions? = match + let lifted3126 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3119 : @types.NumericBound? = match + let lifted3121 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3118 = match + let lifted3120 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29583,16 +29651,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3118) + Option::Some(lifted3120) } _ => panic() } - let lifted3121 : @types.NumericBound? = match + let lifted3123 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3120 = match + let lifted3122 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29609,46 +29677,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3120) + Option::Some(lifted3122) } _ => panic() } - let lifted3123 : String? = match + let lifted3125 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3122 = mbt_ffi_ptr2str( + let result3124 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3122) + Option::Some(result3124) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3119, - max: lifted3121, - unit: lifted3123, + min: lifted3121, + max: lifted3123, + unit: lifted3125, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted3124) + @types.SchemaTypeBody::F32Type(lifted3126) } 11 => { - let lifted3131 : @types.NumericRestrictions? = match + let lifted3133 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3126 : @types.NumericBound? = match + let lifted3128 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3125 = match + let lifted3127 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29665,16 +29733,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3125) + Option::Some(lifted3127) } _ => panic() } - let lifted3128 : @types.NumericBound? = match + let lifted3130 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3127 = match + let lifted3129 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29691,322 +29759,322 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3127) + Option::Some(lifted3129) } _ => panic() } - let lifted3130 : String? = match + let lifted3132 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3129 = mbt_ffi_ptr2str( + let result3131 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3129) + Option::Some(result3131) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3126, - max: lifted3128, - unit: lifted3130, + min: lifted3128, + max: lifted3130, + unit: lifted3132, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted3131) + @types.SchemaTypeBody::F64Type(lifted3133) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array3146 : Array[@types.NamedFieldType] = [] - for index3147 = 0 - index3147 < mbt_ffi_load32(iter_base + 12) - index3147 = index3147 + 1 { + let array3148 : Array[@types.NamedFieldType] = [] + for index3149 = 0 + index3149 < mbt_ffi_load32(iter_base + 12) + index3149 = index3149 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3147 * 68 + index3149 * 68 - let result3132 = mbt_ffi_ptr2str( + let result3134 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted3134 : String? = match + let lifted3136 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result3133 = mbt_ffi_ptr2str( + let result3135 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result3133) + Option::Some(result3135) } _ => panic() } - let array3136 : Array[String] = [] - for index3137 = 0 - index3137 < mbt_ffi_load32(iter_base + 28) - index3137 = index3137 + 1 { + let array3138 : Array[String] = [] + for index3139 = 0 + index3139 < mbt_ffi_load32(iter_base + 28) + index3139 = index3139 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index3137 * 8 + index3139 * 8 - let result3135 = mbt_ffi_ptr2str( + let result3137 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3136.push(result3135) + array3138.push(result3137) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array3139 : Array[String] = [] - for index3140 = 0 - index3140 < mbt_ffi_load32(iter_base + 36) - index3140 = index3140 + 1 { + let array3141 : Array[String] = [] + for index3142 = 0 + index3142 < mbt_ffi_load32(iter_base + 36) + index3142 = index3142 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index3140 * 8 + index3142 * 8 - let result3138 = mbt_ffi_ptr2str( + let result3140 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3139.push(result3138) + array3141.push(result3140) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted3142 : String? = match + let lifted3144 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result3141 = mbt_ffi_ptr2str( + let result3143 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result3141) + Option::Some(result3143) } _ => panic() } - let lifted3145 : @types.Role? = match + let lifted3147 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted3144 = match mbt_ffi_load8_u(iter_base + 56) { + let lifted3146 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result3143 = mbt_ffi_ptr2str( + let result3145 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result3143) + @types.Role::Other(result3145) } _ => panic() } - Option::Some(lifted3144) + Option::Some(lifted3146) } _ => panic() } - array3146.push(@types.NamedFieldType::{ - name: result3132, + array3148.push(@types.NamedFieldType::{ + name: result3134, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted3134, - aliases: array3136, - examples: array3139, - deprecated: lifted3142, - role: lifted3145, + doc: lifted3136, + aliases: array3138, + examples: array3141, + deprecated: lifted3144, + role: lifted3147, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array3146) + @types.SchemaTypeBody::RecordType(array3148) } 15 => { - let array3163 : Array[@types.VariantCaseType] = [] - for index3164 = 0 - index3164 < mbt_ffi_load32(iter_base + 12) - index3164 = index3164 + 1 { + let array3165 : Array[@types.VariantCaseType] = [] + for index3166 = 0 + index3166 < mbt_ffi_load32(iter_base + 12) + index3166 = index3166 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3164 * 72 + index3166 * 72 - let result3148 = mbt_ffi_ptr2str( + let result3150 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted3149 : Int? = match + let lifted3151 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted3151 : String? = match + let lifted3153 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result3150 = mbt_ffi_ptr2str( + let result3152 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result3150) + Option::Some(result3152) } _ => panic() } - let array3153 : Array[String] = [] - for index3154 = 0 - index3154 < mbt_ffi_load32(iter_base + 32) - index3154 = index3154 + 1 { + let array3155 : Array[String] = [] + for index3156 = 0 + index3156 < mbt_ffi_load32(iter_base + 32) + index3156 = index3156 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index3154 * 8 + index3156 * 8 - let result3152 = mbt_ffi_ptr2str( + let result3154 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3153.push(result3152) + array3155.push(result3154) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array3156 : Array[String] = [] - for index3157 = 0 - index3157 < mbt_ffi_load32(iter_base + 40) - index3157 = index3157 + 1 { + let array3158 : Array[String] = [] + for index3159 = 0 + index3159 < mbt_ffi_load32(iter_base + 40) + index3159 = index3159 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index3157 * 8 + index3159 * 8 - let result3155 = mbt_ffi_ptr2str( + let result3157 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3156.push(result3155) + array3158.push(result3157) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted3159 : String? = match + let lifted3161 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result3158 = mbt_ffi_ptr2str( + let result3160 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result3158) + Option::Some(result3160) } _ => panic() } - let lifted3162 : @types.Role? = match + let lifted3164 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted3161 = match mbt_ffi_load8_u(iter_base + 60) { + let lifted3163 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result3160 = mbt_ffi_ptr2str( + let result3162 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result3160) + @types.Role::Other(result3162) } _ => panic() } - Option::Some(lifted3161) + Option::Some(lifted3163) } _ => panic() } - array3163.push(@types.VariantCaseType::{ - name: result3148, - payload: lifted3149, + array3165.push(@types.VariantCaseType::{ + name: result3150, + payload: lifted3151, metadata: @types.MetadataEnvelope::{ - doc: lifted3151, - aliases: array3153, - examples: array3156, - deprecated: lifted3159, - role: lifted3162, + doc: lifted3153, + aliases: array3155, + examples: array3158, + deprecated: lifted3161, + role: lifted3164, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array3163) + @types.SchemaTypeBody::VariantType(array3165) } 16 => { - let array3166 : Array[String] = [] - for index3167 = 0 - index3167 < mbt_ffi_load32(iter_base + 12) - index3167 = index3167 + 1 { + let array3168 : Array[String] = [] + for index3169 = 0 + index3169 < mbt_ffi_load32(iter_base + 12) + index3169 = index3169 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3167 * 8 + index3169 * 8 - let result3165 = mbt_ffi_ptr2str( + let result3167 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3166.push(result3165) + array3168.push(result3167) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array3166) + @types.SchemaTypeBody::EnumType(array3168) } 17 => { - let array3169 : Array[String] = [] - for index3170 = 0 - index3170 < mbt_ffi_load32(iter_base + 12) - index3170 = index3170 + 1 { + let array3171 : Array[String] = [] + for index3172 = 0 + index3172 < mbt_ffi_load32(iter_base + 12) + index3172 = index3172 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3170 * 8 + index3172 * 8 - let result3168 = mbt_ffi_ptr2str( + let result3170 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3169.push(result3168) + array3171.push(result3170) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array3169) + @types.SchemaTypeBody::FlagsType(array3171) } 18 => { - let array3171 : Array[Int] = [] - for index3172 = 0 - index3172 < mbt_ffi_load32(iter_base + 12) - index3172 = index3172 + 1 { + let array3173 : Array[Int] = [] + for index3174 = 0 + index3174 < mbt_ffi_load32(iter_base + 12) + index3174 = index3174 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3172 * 4 + index3174 * 4 - array3171.push(mbt_ffi_load32(iter_base + 0)) + array3173.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array3171) + @types.SchemaTypeBody::TupleType(array3173) } 19 => @types.SchemaTypeBody::ListType(mbt_ffi_load32(iter_base + 8)) @@ -30025,13 +30093,13 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted3173 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3175 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted3174 : Int? = match + let lifted3176 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -30039,37 +30107,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted3173, - err: lifted3174, + ok: lifted3175, + err: lifted3176, }) } 24 => { - let lifted3178 : Array[String]? = match + let lifted3180 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array3176 : Array[String] = [] - for index3177 = 0 - index3177 < mbt_ffi_load32(iter_base + 16) - index3177 = index3177 + 1 { + let array3178 : Array[String] = [] + for index3179 = 0 + index3179 < mbt_ffi_load32(iter_base + 16) + index3179 = index3179 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index3177 * 8 + index3179 * 8 - let result3175 = mbt_ffi_ptr2str( + let result3177 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3176.push(result3175) + array3178.push(result3177) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array3176) + Option::Some(array3178) } _ => panic() } - let lifted3179 : UInt? = match + let lifted3181 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -30079,7 +30147,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted3180 : UInt? = match + let lifted3182 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -30089,54 +30157,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted3182 : String? = match + let lifted3184 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result3181 = mbt_ffi_ptr2str( + let result3183 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result3181) + Option::Some(result3183) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted3178, - min_length: lifted3179, - max_length: lifted3180, - regex: lifted3182, + languages: lifted3180, + min_length: lifted3181, + max_length: lifted3182, + regex: lifted3184, }) } 25 => { - let lifted3186 : Array[String]? = match + let lifted3188 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array3184 : Array[String] = [] - for index3185 = 0 - index3185 < mbt_ffi_load32(iter_base + 16) - index3185 = index3185 + 1 { + let array3186 : Array[String] = [] + for index3187 = 0 + index3187 < mbt_ffi_load32(iter_base + 16) + index3187 = index3187 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index3185 * 8 + index3187 * 8 - let result3183 = mbt_ffi_ptr2str( + let result3185 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3184.push(result3183) + array3186.push(result3185) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array3184) + Option::Some(array3186) } _ => panic() } - let lifted3187 : UInt? = match + let lifted3189 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -30146,7 +30214,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted3188 : UInt? = match + let lifted3190 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -30157,58 +30225,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted3186, - min_bytes: lifted3187, - max_bytes: lifted3188, + mime_types: lifted3188, + min_bytes: lifted3189, + max_bytes: lifted3190, }) } 26 => { - let lifted3192 : Array[String]? = match + let lifted3194 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array3190 : Array[String] = [] - for index3191 = 0 - index3191 < mbt_ffi_load32(iter_base + 20) - index3191 = index3191 + 1 { + let array3192 : Array[String] = [] + for index3193 = 0 + index3193 < mbt_ffi_load32(iter_base + 20) + index3193 = index3193 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index3191 * 8 + index3193 * 8 - let result3189 = mbt_ffi_ptr2str( + let result3191 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3190.push(result3189) + array3192.push(result3191) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array3190) + Option::Some(array3192) } _ => panic() } - let lifted3196 : Array[String]? = match + let lifted3198 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array3194 : Array[String] = [] - for index3195 = 0 - index3195 < mbt_ffi_load32(iter_base + 32) - index3195 = index3195 + 1 { + let array3196 : Array[String] = [] + for index3197 = 0 + index3197 < mbt_ffi_load32(iter_base + 32) + index3197 = index3197 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index3195 * 8 + index3197 * 8 - let result3193 = mbt_ffi_ptr2str( + let result3195 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3194.push(result3193) + array3196.push(result3195) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array3194) + Option::Some(array3196) } _ => panic() } @@ -30218,95 +30286,95 @@ pub fn enrich_oplog_entries( mbt_ffi_load8_u(iter_base + 8), ), kind: @types.PathKind::from(mbt_ffi_load8_u(iter_base + 9)), - allowed_mime_types: lifted3192, - allowed_extensions: lifted3196, + allowed_mime_types: lifted3194, + allowed_extensions: lifted3198, }) } 27 => { - let lifted3200 : Array[String]? = match + let lifted3202 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array3198 : Array[String] = [] - for index3199 = 0 - index3199 < mbt_ffi_load32(iter_base + 16) - index3199 = index3199 + 1 { + let array3200 : Array[String] = [] + for index3201 = 0 + index3201 < mbt_ffi_load32(iter_base + 16) + index3201 = index3201 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index3199 * 8 + index3201 * 8 - let result3197 = mbt_ffi_ptr2str( + let result3199 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3198.push(result3197) + array3200.push(result3199) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array3198) + Option::Some(array3200) } _ => panic() } - let lifted3204 : Array[String]? = match + let lifted3206 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array3202 : Array[String] = [] - for index3203 = 0 - index3203 < mbt_ffi_load32(iter_base + 28) - index3203 = index3203 + 1 { + let array3204 : Array[String] = [] + for index3205 = 0 + index3205 < mbt_ffi_load32(iter_base + 28) + index3205 = index3205 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index3203 * 8 + index3205 * 8 - let result3201 = mbt_ffi_ptr2str( + let result3203 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3202.push(result3201) + array3204.push(result3203) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array3202) + Option::Some(array3204) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted3200, - allowed_hosts: lifted3204, + allowed_schemes: lifted3202, + allowed_hosts: lifted3206, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result3205 = mbt_ffi_ptr2str( + let result3207 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array3207 : Array[String] = [] - for index3208 = 0 - index3208 < mbt_ffi_load32(iter_base + 20) - index3208 = index3208 + 1 { + let array3209 : Array[String] = [] + for index3210 = 0 + index3210 < mbt_ffi_load32(iter_base + 20) + index3210 = index3210 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index3208 * 8 + index3210 * 8 - let result3206 = mbt_ffi_ptr2str( + let result3208 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3207.push(result3206) + array3209.push(result3208) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted3210 : @types.QuantityValue? = match + let lifted3212 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result3209 = mbt_ffi_ptr2str( + let result3211 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -30314,17 +30382,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result3209, + unit: result3211, }) } _ => panic() } - let lifted3212 : @types.QuantityValue? = match + let lifted3214 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result3211 = mbt_ffi_ptr2str( + let result3213 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -30332,397 +30400,397 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result3211, + unit: result3213, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result3205, - allowed_suffixes: array3207, - min: lifted3210, - max: lifted3212, + base_unit: result3207, + allowed_suffixes: array3209, + min: lifted3212, + max: lifted3214, }) } 31 => { - let array3236 : Array[@types.UnionBranch] = [] - for index3237 = 0 - index3237 < mbt_ffi_load32(iter_base + 12) - index3237 = index3237 + 1 { + let array3238 : Array[@types.UnionBranch] = [] + for index3239 = 0 + index3239 < mbt_ffi_load32(iter_base + 12) + index3239 = index3239 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3237 * 92 + index3239 * 92 - let result3213 = mbt_ffi_ptr2str( + let result3215 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted3222 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted3224 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result3214 = mbt_ffi_ptr2str( + let result3216 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result3214) + @types.DiscriminatorRule::Prefix(result3216) } 1 => { - let result3215 = mbt_ffi_ptr2str( + let result3217 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result3215) + @types.DiscriminatorRule::Suffix(result3217) } 2 => { - let result3216 = mbt_ffi_ptr2str( + let result3218 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result3216) + @types.DiscriminatorRule::Contains(result3218) } 3 => { - let result3217 = mbt_ffi_ptr2str( + let result3219 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result3217) + @types.DiscriminatorRule::Regex(result3219) } 4 => { - let result3218 = mbt_ffi_ptr2str( + let result3220 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted3220 : String? = match + let lifted3222 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result3219 = mbt_ffi_ptr2str( + let result3221 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result3219) + Option::Some(result3221) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result3218, - literal: lifted3220, + field_name: result3220, + literal: lifted3222, }) } 5 => { - let result3221 = mbt_ffi_ptr2str( + let result3223 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result3221) + @types.DiscriminatorRule::FieldAbsent(result3223) } _ => panic() } - let lifted3224 : String? = match + let lifted3226 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result3223 = mbt_ffi_ptr2str( + let result3225 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result3223) + Option::Some(result3225) } _ => panic() } - let array3226 : Array[String] = [] - for index3227 = 0 - index3227 < mbt_ffi_load32(iter_base + 52) - index3227 = index3227 + 1 { + let array3228 : Array[String] = [] + for index3229 = 0 + index3229 < mbt_ffi_load32(iter_base + 52) + index3229 = index3229 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index3227 * 8 + index3229 * 8 - let result3225 = mbt_ffi_ptr2str( + let result3227 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3226.push(result3225) + array3228.push(result3227) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array3229 : Array[String] = [] - for index3230 = 0 - index3230 < mbt_ffi_load32(iter_base + 60) - index3230 = index3230 + 1 { + let array3231 : Array[String] = [] + for index3232 = 0 + index3232 < mbt_ffi_load32(iter_base + 60) + index3232 = index3232 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index3230 * 8 + index3232 * 8 - let result3228 = mbt_ffi_ptr2str( + let result3230 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3229.push(result3228) + array3231.push(result3230) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted3232 : String? = match + let lifted3234 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3231 = mbt_ffi_ptr2str( + let result3233 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3231) + Option::Some(result3233) } _ => panic() } - let lifted3235 : @types.Role? = match + let lifted3237 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted3234 = match mbt_ffi_load8_u(iter_base + 80) { + let lifted3236 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result3233 = mbt_ffi_ptr2str( + let result3235 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result3233) + @types.Role::Other(result3235) } _ => panic() } - Option::Some(lifted3234) + Option::Some(lifted3236) } _ => panic() } - array3236.push(@types.UnionBranch::{ - tag: result3213, + array3238.push(@types.UnionBranch::{ + tag: result3215, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted3222, + discriminator: lifted3224, metadata: @types.MetadataEnvelope::{ - doc: lifted3224, - aliases: array3226, - examples: array3229, - deprecated: lifted3232, - role: lifted3235, + doc: lifted3226, + aliases: array3228, + examples: array3231, + deprecated: lifted3234, + role: lifted3237, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array3236, + branches: array3238, }) } 32 => { - let lifted3239 : String? = match + let lifted3241 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result3238 = mbt_ffi_ptr2str( + let result3240 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result3238) + Option::Some(result3240) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted3239, + category: lifted3241, }) } 33 => { - let lifted3241 : String? = match + let lifted3243 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result3240 = mbt_ffi_ptr2str( + let result3242 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result3240) + Option::Some(result3242) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted3241, + resource_name: lifted3243, }) } 34 => { - let lifted3242 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3244 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted3242) + @types.SchemaTypeBody::FutureType(lifted3244) } 35 => { - let lifted3243 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3245 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted3243) + @types.SchemaTypeBody::StreamType(lifted3245) } _ => panic() } - let lifted3246 : String? = match mbt_ffi_load8_u(iter_base + 88) { + let lifted3248 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result3245 = mbt_ffi_ptr2str( + let result3247 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result3245) + Option::Some(result3247) } _ => panic() } - let array3248 : Array[String] = [] - for index3249 = 0 - index3249 < mbt_ffi_load32(iter_base + 104) - index3249 = index3249 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index3249 * 8 + let array3250 : Array[String] = [] + for index3251 = 0 + index3251 < mbt_ffi_load32(iter_base + 104) + index3251 = index3251 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index3251 * 8 - let result3247 = mbt_ffi_ptr2str( + let result3249 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3248.push(result3247) + array3250.push(result3249) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array3251 : Array[String] = [] - for index3252 = 0 - index3252 < mbt_ffi_load32(iter_base + 112) - index3252 = index3252 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index3252 * 8 + let array3253 : Array[String] = [] + for index3254 = 0 + index3254 < mbt_ffi_load32(iter_base + 112) + index3254 = index3254 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index3254 * 8 - let result3250 = mbt_ffi_ptr2str( + let result3252 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3251.push(result3250) + array3253.push(result3252) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted3254 : String? = match + let lifted3256 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result3253 = mbt_ffi_ptr2str( + let result3255 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result3253) + Option::Some(result3255) } _ => panic() } - let lifted3257 : @types.Role? = match + let lifted3259 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted3256 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted3258 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result3255 = mbt_ffi_ptr2str( + let result3257 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result3255) + @types.Role::Other(result3257) } _ => panic() } - Option::Some(lifted3256) + Option::Some(lifted3258) } _ => panic() } - array3258.push(@types.SchemaTypeNode::{ - body: lifted3244, + array3260.push(@types.SchemaTypeNode::{ + body: lifted3246, metadata: @types.MetadataEnvelope::{ - doc: lifted3246, - aliases: array3248, - examples: array3251, - deprecated: lifted3254, - role: lifted3257, + doc: lifted3248, + aliases: array3250, + examples: array3253, + deprecated: lifted3256, + role: lifted3259, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array3263 : Array[@types.SchemaTypeDef] = [] - for index3264 = 0 - index3264 < mbt_ffi_load32(iter_base + 48) - index3264 = index3264 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 44) + index3264 * 24 + let array3265 : Array[@types.SchemaTypeDef] = [] + for index3266 = 0 + index3266 < mbt_ffi_load32(iter_base + 48) + index3266 = index3266 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 44) + index3266 * 24 - let result3260 = mbt_ffi_ptr2str( + let result3262 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted3262 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3264 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result3261 = mbt_ffi_ptr2str( + let result3263 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result3261) + Option::Some(result3263) } _ => panic() } - array3263.push(@types.SchemaTypeDef::{ - id: result3260, - name: lifted3262, + array3265.push(@types.SchemaTypeDef::{ + id: result3262, + name: lifted3264, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 44)) - let array3294 : Array[@types.SchemaValueNode] = [] - for index3295 = 0 - index3295 < mbt_ffi_load32(iter_base + 60) - index3295 = index3295 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 56) + index3295 * 32 + let array3296 : Array[@types.SchemaValueNode] = [] + for index3297 = 0 + index3297 < mbt_ffi_load32(iter_base + 60) + index3297 = index3297 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 56) + index3297 * 32 - let lifted3293 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3295 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -30772,29 +30840,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result3265 = mbt_ffi_ptr2str( + let result3267 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result3265) + @types.SchemaValueNode::StringValue(result3267) } 13 => { - let array3266 : Array[Int] = [] - for index3267 = 0 - index3267 < mbt_ffi_load32(iter_base + 12) - index3267 = index3267 + 1 { + let array3268 : Array[Int] = [] + for index3269 = 0 + index3269 < mbt_ffi_load32(iter_base + 12) + index3269 = index3269 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3267 * 4 + index3269 * 4 - array3266.push(mbt_ffi_load32(iter_base + 0)) + array3268.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array3266) + @types.SchemaValueNode::RecordValue(array3268) } 14 => { - let lifted3268 : Int? = match + let lifted3270 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -30803,7 +30871,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted3268, + payload: lifted3270, }) } 15 => @@ -30811,34 +30879,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array3269 : Array[Bool] = [] - for index3270 = 0 - index3270 < mbt_ffi_load32(iter_base + 12) - index3270 = index3270 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index3270 * 1 - - array3269.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array3269) - } - 17 => { - let array3271 : Array[Int] = [] + let array3271 : Array[Bool] = [] for index3272 = 0 index3272 < mbt_ffi_load32(iter_base + 12) index3272 = index3272 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3272 * 4 + index3272 * 1 - array3271.push(mbt_ffi_load32(iter_base + 0)) + array3271.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array3271) + @types.SchemaValueNode::FlagsValue(array3271) } - 18 => { + 17 => { let array3273 : Array[Int] = [] for index3274 = 0 index3274 < mbt_ffi_load32(iter_base + 12) @@ -30850,9 +30904,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array3273) + @types.SchemaValueNode::TupleValue(array3273) } - 19 => { + 18 => { let array3275 : Array[Int] = [] for index3276 = 0 index3276 < mbt_ffi_load32(iter_base + 12) @@ -30864,126 +30918,140 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array3275) + @types.SchemaValueNode::ListValue(array3275) } - 20 => { - let array3277 : Array[@types.MapEntry] = [] + 19 => { + let array3277 : Array[Int] = [] for index3278 = 0 index3278 < mbt_ffi_load32(iter_base + 12) index3278 = index3278 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3278 * 8 + index3278 * 4 + + array3277.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - array3277.push(@types.MapEntry::{ + @types.SchemaValueNode::FixedListValue(array3277) + } + 20 => { + let array3279 : Array[@types.MapEntry] = [] + for index3280 = 0 + index3280 < mbt_ffi_load32(iter_base + 12) + index3280 = index3280 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index3280 * 8 + + array3279.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array3277) + @types.SchemaValueNode::MapValue(array3279) } 21 => { - let lifted3279 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3281 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted3279) + @types.SchemaValueNode::OptionValue(lifted3281) } 22 => { - let lifted3282 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3284 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted3280 : Int? = match + let lifted3282 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted3280) + @types.ResultValuePayload::OkValue(lifted3282) } 1 => { - let lifted3281 : Int? = match + let lifted3283 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted3281) + @types.ResultValuePayload::ErrValue(lifted3283) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted3282) + @types.SchemaValueNode::ResultValue(lifted3284) } 23 => { - let result3283 = mbt_ffi_ptr2str( + let result3285 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3285 : String? = match + let lifted3287 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result3284 = mbt_ffi_ptr2str( + let result3286 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result3284) + Option::Some(result3286) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result3283, - language: lifted3285, + text: result3285, + language: lifted3287, }) } 24 => { - let result3286 = mbt_ffi_ptr2bytes( + let result3288 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3288 : String? = match + let lifted3290 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result3287 = mbt_ffi_ptr2str( + let result3289 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result3287) + Option::Some(result3289) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result3286, - mime_type: lifted3288, + bytes: result3288, + mime_type: lifted3290, }) } 25 => { - let result3289 = mbt_ffi_ptr2str( + let result3291 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result3289) + @types.SchemaValueNode::PathValue(result3291) } 26 => { - let result3290 = mbt_ffi_ptr2str( + let result3292 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result3290) + @types.SchemaValueNode::UrlValue(result3292) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -30995,7 +31063,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result3291 = mbt_ffi_ptr2str( + let result3293 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -31003,17 +31071,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result3291, + unit: result3293, }) } 30 => { - let result3292 = mbt_ffi_ptr2str( + let result3294 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result3292, + tag: result3294, body: mbt_ffi_load32(iter_base + 16), }) } @@ -31025,10 +31093,16 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array3294.push(lifted3293) + array3296.push(lifted3295) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) @@ -31041,12 +31115,12 @@ pub fn enrich_oplog_entries( kind: HostStreamKind::from(mbt_ffi_load8_u(iter_base + 32)), payload: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array3258, - defs: array3263, + type_nodes: array3260, + defs: array3265, root: mbt_ffi_load32(iter_base + 52), }, value: @types.SchemaValueTree::{ - value_nodes: array3294, + value_nodes: array3296, root: mbt_ffi_load32(iter_base + 64), }, }, @@ -31063,25 +31137,25 @@ pub fn enrich_oplog_entries( _ => panic() } - array3297.push(lifted3296) + array3299.push(lifted3298) } mbt_ffi_free(mbt_ffi_load32(return_area + 4)) - Result::Ok(array3297) + Result::Ok(array3299) } 1 => { - let result3299 = mbt_ffi_ptr2str( + let result3301 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 4), mbt_ffi_load32(return_area + 8), ) - Result::Err(result3299) + Result::Err(result3301) } _ => panic() } - let ret = lifted3300 + let ret = lifted3302 mbt_ffi_free(ptr) - mbt_ffi_free(address459) + mbt_ffi_free(address461) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -33394,6 +33468,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -35645,6 +35725,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -37873,6 +37959,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -40066,6 +40158,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -42263,6 +42361,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -44586,6 +44690,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -46946,6 +47056,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -49126,6 +49242,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -51514,6 +51636,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -53837,6 +53965,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -57615,6 +57749,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -59978,6 +60118,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -62229,6 +62375,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -64457,6 +64609,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -66650,6 +66808,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -68847,6 +69011,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -71170,6 +71340,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -73531,6 +73707,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -75711,6 +75893,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -78099,6 +78287,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -80422,6 +80616,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -84201,6 +84401,12 @@ pub fn SearchOplog::get_next( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } diff --git a/sdks/moonbit/golem_sdk/interface/golem/api/retry/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/api/retry/ffi.mbt index 2c1a0ca033..f5bae3691e 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/api/retry/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/api/retry/ffi.mbt @@ -32,25 +32,29 @@ fn wasmImportSetRetryPolicy( fn wasmImportRemoveRetryPolicy(p0 : Int, p1 : Int) = "golem:api/retry@1.5.0" "remove-retry-policy" ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = #|(func (param i32) (result i64) local.get 0 i64.load) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = @@ -59,18 +63,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.tee 1 i32.const 0 call $moonbit.init_array8 #| local.get 1) -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) - -///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) - -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) - ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) @@ -78,6 +70,14 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 1 call $moonbit.init_array16 #| local.get 0) +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) + ///| extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) diff --git a/sdks/moonbit/golem_sdk/interface/golem/core/types/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/core/types/ffi.mbt index 02956c85ba..3656948d65 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/core/types/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/core/types/ffi.mbt @@ -6,39 +6,2030 @@ fn wasmImportResourceDropQuotaToken(resource : Int) = "golem:core/types@2.0.0" " ///| fn wasmImportResourceDropSecret(resource : Int) = "golem:core/types@2.0.0" "[resource-drop]secret" +///| +fn wasmImportResourceDropSchemaValueStream(resource : Int) = "golem:core/types@2.0.0" "[resource-drop]schema-value-stream" + ///| fn wasmImportParseUuid(p0 : Int, p1 : Int, p2 : Int) = "golem:core/types@2.0.0" "parse-uuid" ///| fn wasmImportUuidToString(p0 : Int64, p1 : Int64, p2 : Int) = "golem:core/types@2.0.0" "uuid-to-string" +///| +fn wasmImportStaticSchemaValueStreamWrap(p0 : Int, p1 : Int) -> Int = "golem:core/types@2.0.0" "[async-lower][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0Read( + handle : Int, + buffer_ptr : Int, + length : Int, +) -> Int = "golem:core/types@2.0.0" "[async-lower][stream-read-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0CancelRead( + handle : Int, +) -> Int = "golem:core/types@2.0.0" "[stream-cancel-read-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + handle : Int, +) = "golem:core/types@2.0.0" "[stream-drop-readable-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0New() -> UInt64 = "golem:core/types@2.0.0" "[stream-new-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0Write( + handle : Int, + buffer_ptr : Int, + length : Int, +) -> Int = "golem:core/types@2.0.0" "[async-lower][stream-write-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0CancelWrite( + handle : Int, +) -> Int = "golem:core/types@2.0.0" "[stream-cancel-write-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropWritable( + handle : Int, +) = "golem:core/types@2.0.0" "[stream-drop-writable-0][static]schema-value-stream.wrap" + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc( + length : Int, +) -> Int { + let ptr = mbt_ffi_malloc(12 * length) + ptr +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Commit( + ptr : Int, + start : Int, + length : Int, +) -> Unit { + for i in start..<(start + length) { + let elem_ptr = ptr + i * 12 + + for index = 0; index < mbt_ffi_load32(elem_ptr + 4); index = index + 1 { + let iter_base = mbt_ffi_load32(elem_ptr + 0) + index * 32 + + match mbt_ffi_load8_u(iter_base + 0) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => () + 5 => () + 6 => () + 7 => () + 8 => () + 9 => () + 10 => () + 11 => () + 12 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 13 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 14 => () + 15 => () + 16 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 17 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 18 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 19 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 20 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 21 => () + 22 => () + 23 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 24 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 25 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 26 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 27 => () + 28 => () + 29 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 31 => () + 32 => () + 33 => () + _ => panic() + } + } + mbt_ffi_free(mbt_ffi_load32(elem_ptr + 0)) + } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject( + ptr : Int, + start : Int, + length : Int, +) -> Unit { + for i in start..<(start + length) { + let elem_ptr = ptr + i * 12 + + for index = 0; index < mbt_ffi_load32(elem_ptr + 4); index = index + 1 { + let iter_base = mbt_ffi_load32(elem_ptr + 0) + index * 32 + + match mbt_ffi_load8_u(iter_base + 0) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => () + 5 => () + 6 => () + 7 => () + 8 => () + 9 => () + 10 => () + 11 => () + 12 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 13 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 14 => () + 15 => () + 16 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 17 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 18 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 19 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 20 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 21 => () + 22 => () + 23 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 24 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 25 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 26 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 27 => () + 28 => () + 29 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 31 => Secret::Secret(mbt_ffi_load32(iter_base + 8)).drop() + 32 => QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)).drop() + 33 => + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(iter_base + 8)).drop() + _ => panic() + } + } + mbt_ffi_free(mbt_ffi_load32(elem_ptr + 0)) + } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lift( + ptr : Int, +) -> SchemaValueTree { + let array25 : Array[SchemaValueNode] = [] + for index26 = 0; index26 < mbt_ffi_load32(ptr + 4); index26 = index26 + 1 { + let iter_base = mbt_ffi_load32(ptr + 0) + index26 * 32 + + let lifted24 = match mbt_ffi_load8_u(iter_base + 0) { + 0 => SchemaValueNode::BoolValue(mbt_ffi_load8_u(iter_base + 8) != 0) + 1 => SchemaValueNode::S8Value(mbt_ffi_load8(iter_base + 8)) + 2 => SchemaValueNode::S16Value(mbt_ffi_load16(iter_base + 8)) + 3 => SchemaValueNode::S32Value(mbt_ffi_load32(iter_base + 8)) + 4 => SchemaValueNode::S64Value(mbt_ffi_load64(iter_base + 8)) + 5 => SchemaValueNode::U8Value(mbt_ffi_load8_u(iter_base + 8).to_byte()) + 6 => + SchemaValueNode::U16Value( + mbt_ffi_load16_u(iter_base + 8).land(0xFFFF).reinterpret_as_uint(), + ) + 7 => + SchemaValueNode::U32Value( + mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + ) + 8 => + SchemaValueNode::U64Value( + mbt_ffi_load64(iter_base + 8).reinterpret_as_uint64(), + ) + 9 => SchemaValueNode::F32Value(mbt_ffi_loadf32(iter_base + 8)) + 10 => SchemaValueNode::F64Value(mbt_ffi_loadf64(iter_base + 8)) + 11 => + SchemaValueNode::CharValue( + Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), + ) + 12 => { + let result = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::StringValue(result) + } + 13 => { + let array : Array[Int] = [] + for index = 0; index < mbt_ffi_load32(iter_base + 12); index = index + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index * 4 + + array.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::RecordValue(array) + } + 14 => { + let lifted : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + SchemaValueNode::VariantValue(VariantValuePayload::{ + case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + payload: lifted, + }) + } + 15 => + SchemaValueNode::EnumValue( + mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + ) + 16 => { + let array0 : Array[Bool] = [] + for index1 = 0 + index1 < mbt_ffi_load32(iter_base + 12) + index1 = index1 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index1 * 1 + + array0.push(mbt_ffi_load8_u(iter_base + 0) != 0) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::FlagsValue(array0) + } + 17 => { + let array2 : Array[Int] = [] + for index3 = 0 + index3 < mbt_ffi_load32(iter_base + 12) + index3 = index3 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index3 * 4 + + array2.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::TupleValue(array2) + } + 18 => { + let array4 : Array[Int] = [] + for index5 = 0 + index5 < mbt_ffi_load32(iter_base + 12) + index5 = index5 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index5 * 4 + + array4.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::ListValue(array4) + } + 19 => { + let array6 : Array[Int] = [] + for index7 = 0 + index7 < mbt_ffi_load32(iter_base + 12) + index7 = index7 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index7 * 4 + + array6.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::FixedListValue(array6) + } + 20 => { + let array8 : Array[MapEntry] = [] + for index9 = 0 + index9 < mbt_ffi_load32(iter_base + 12) + index9 = index9 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index9 * 8 + + array8.push(MapEntry::{ + key: mbt_ffi_load32(iter_base + 0), + value: mbt_ffi_load32(iter_base + 4), + }) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::MapValue(array8) + } + 21 => { + let lifted10 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) + _ => panic() + } + + SchemaValueNode::OptionValue(lifted10) + } + 22 => { + let lifted13 = match mbt_ffi_load8_u(iter_base + 8) { + 0 => { + let lifted11 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + ResultValuePayload::OkValue(lifted11) + } + 1 => { + let lifted12 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + ResultValuePayload::ErrValue(lifted12) + } + _ => panic() + } + + SchemaValueNode::ResultValue(lifted13) + } + 23 => { + let result14 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + let lifted16 : String? = match mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let result15 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + Option::Some(result15) + } + _ => panic() + } + + SchemaValueNode::TextValue(TextValuePayload::{ + text: result14, + language: lifted16, + }) + } + 24 => { + let result17 = mbt_ffi_ptr2bytes( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + let lifted19 : String? = match mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let result18 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + Option::Some(result18) + } + _ => panic() + } + + SchemaValueNode::BinaryValue(BinaryValuePayload::{ + bytes: result17, + mime_type: lifted19, + }) + } + 25 => { + let result20 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::PathValue(result20) + } + 26 => { + let result21 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::UrlValue(result21) + } + 27 => + SchemaValueNode::DatetimeValue(Datetime::{ + seconds: mbt_ffi_load64(iter_base + 8), + nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), + }) + 28 => + SchemaValueNode::DurationValue(DurationValuePayload::{ + nanoseconds: mbt_ffi_load64(iter_base + 8), + }) + 29 => { + let result22 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + SchemaValueNode::QuantityValueNode(QuantityValue::{ + mantissa: mbt_ffi_load64(iter_base + 8), + scale: mbt_ffi_load32(iter_base + 16), + unit: result22, + }) + } + 30 => { + let result23 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::UnionValue(UnionValuePayload::{ + tag: result23, + body: mbt_ffi_load32(iter_base + 16), + }) + } + 31 => + SchemaValueNode::SecretValue( + Secret::Secret(mbt_ffi_load32(iter_base + 8)), + ) + 32 => + SchemaValueNode::QuotaTokenHandle( + QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), + ) + 33 => + SchemaValueNode::StreamValue( + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(iter_base + 8)), + ) + _ => panic() + } + + array25.push(lifted24) + } + mbt_ffi_free(mbt_ffi_load32(ptr + 0)) + + SchemaValueTree::{ value_nodes: array25, root: mbt_ffi_load32(ptr + 8) } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lower( + value : SchemaValueTree, + ptr : Int, +) -> Unit { + let address68 = mbt_ffi_malloc(value.value_nodes.length() * 32) + for index69 = 0; index69 < value.value_nodes.length(); index69 = index69 + 1 { + let iter_elem : SchemaValueNode = value.value_nodes[index69] + let iter_base = address68 + index69 * 32 + + match iter_elem { + BoolValue(payload) => { + mbt_ffi_store8(iter_base + 0, 0) + mbt_ffi_store8(iter_base + 8, if payload { 1 } else { 0 }) + + () + } + S8Value(payload0) => { + mbt_ffi_store8(iter_base + 0, 1) + mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload0)) + + () + } + S16Value(payload1) => { + mbt_ffi_store8(iter_base + 0, 2) + mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload1)) + + () + } + S32Value(payload2) => { + mbt_ffi_store8(iter_base + 0, 3) + mbt_ffi_store32(iter_base + 8, payload2) + + () + } + S64Value(payload3) => { + mbt_ffi_store8(iter_base + 0, 4) + mbt_ffi_store64(iter_base + 8, payload3) + + () + } + U8Value(payload4) => { + mbt_ffi_store8(iter_base + 0, 5) + mbt_ffi_store8(iter_base + 8, payload4.to_int()) + + () + } + U16Value(payload5) => { + mbt_ffi_store8(iter_base + 0, 6) + mbt_ffi_store16(iter_base + 8, payload5.reinterpret_as_int()) + + () + } + U32Value(payload6) => { + mbt_ffi_store8(iter_base + 0, 7) + mbt_ffi_store32(iter_base + 8, payload6.reinterpret_as_int()) + + () + } + U64Value(payload7) => { + mbt_ffi_store8(iter_base + 0, 8) + mbt_ffi_store64(iter_base + 8, payload7.reinterpret_as_int64()) + + () + } + F32Value(payload8) => { + mbt_ffi_store8(iter_base + 0, 9) + mbt_ffi_storef32(iter_base + 8, payload8) + + () + } + F64Value(payload9) => { + mbt_ffi_store8(iter_base + 0, 10) + mbt_ffi_storef64(iter_base + 8, payload9) + + () + } + CharValue(payload10) => { + mbt_ffi_store8(iter_base + 0, 11) + mbt_ffi_store32(iter_base + 8, payload10.to_int()) + + () + } + StringValue(payload11) => { + mbt_ffi_store8(iter_base + 0, 12) + + let ptr12 = mbt_ffi_str2ptr(payload11) + mbt_ffi_store32(iter_base + 12, payload11.length()) + mbt_ffi_store32(iter_base + 8, ptr12) + + () + } + RecordValue(payload13) => { + mbt_ffi_store8(iter_base + 0, 13) + + let address = mbt_ffi_malloc(payload13.length() * 4) + for index = 0; index < payload13.length(); index = index + 1 { + let iter_elem : Int = payload13[index] + let iter_base = address + index * 4 + mbt_ffi_store32(iter_base + 0, iter_elem) + } + mbt_ffi_store32(iter_base + 12, payload13.length()) + mbt_ffi_store32(iter_base + 8, address) + + () + } + VariantValue(payload14) => { + mbt_ffi_store8(iter_base + 0, 14) + mbt_ffi_store32(iter_base + 8, payload14.case.reinterpret_as_int()) + + match payload14.payload { + None => { + mbt_ffi_store8(iter_base + 12, 0) + + () + } + Some(payload16) => { + mbt_ffi_store8(iter_base + 12, 1) + mbt_ffi_store32(iter_base + 16, payload16) + + () + } + } + + () + } + EnumValue(payload17) => { + mbt_ffi_store8(iter_base + 0, 15) + mbt_ffi_store32(iter_base + 8, payload17.reinterpret_as_int()) + + () + } + FlagsValue(payload18) => { + mbt_ffi_store8(iter_base + 0, 16) + + let address19 = mbt_ffi_malloc(payload18.length() * 1) + for index20 = 0; index20 < payload18.length(); index20 = index20 + 1 { + let iter_elem : Bool = payload18[index20] + let iter_base = address19 + index20 * 1 + mbt_ffi_store8(iter_base + 0, if iter_elem { 1 } else { 0 }) + } + mbt_ffi_store32(iter_base + 12, payload18.length()) + mbt_ffi_store32(iter_base + 8, address19) + + () + } + TupleValue(payload21) => { + mbt_ffi_store8(iter_base + 0, 17) + + let address22 = mbt_ffi_malloc(payload21.length() * 4) + for index23 = 0; index23 < payload21.length(); index23 = index23 + 1 { + let iter_elem : Int = payload21[index23] + let iter_base = address22 + index23 * 4 + mbt_ffi_store32(iter_base + 0, iter_elem) + } + mbt_ffi_store32(iter_base + 12, payload21.length()) + mbt_ffi_store32(iter_base + 8, address22) + + () + } + ListValue(payload24) => { + mbt_ffi_store8(iter_base + 0, 18) + + let address25 = mbt_ffi_malloc(payload24.length() * 4) + for index26 = 0; index26 < payload24.length(); index26 = index26 + 1 { + let iter_elem : Int = payload24[index26] + let iter_base = address25 + index26 * 4 + mbt_ffi_store32(iter_base + 0, iter_elem) + } + mbt_ffi_store32(iter_base + 12, payload24.length()) + mbt_ffi_store32(iter_base + 8, address25) + + () + } + FixedListValue(payload27) => { + mbt_ffi_store8(iter_base + 0, 19) + + let address28 = mbt_ffi_malloc(payload27.length() * 4) + for index29 = 0; index29 < payload27.length(); index29 = index29 + 1 { + let iter_elem : Int = payload27[index29] + let iter_base = address28 + index29 * 4 + mbt_ffi_store32(iter_base + 0, iter_elem) + } + mbt_ffi_store32(iter_base + 12, payload27.length()) + mbt_ffi_store32(iter_base + 8, address28) + + () + } + MapValue(payload30) => { + mbt_ffi_store8(iter_base + 0, 20) + + let address31 = mbt_ffi_malloc(payload30.length() * 8) + for index32 = 0; index32 < payload30.length(); index32 = index32 + 1 { + let iter_elem : MapEntry = payload30[index32] + let iter_base = address31 + index32 * 8 + mbt_ffi_store32(iter_base + 0, iter_elem.key) + mbt_ffi_store32(iter_base + 4, iter_elem.value) + } + mbt_ffi_store32(iter_base + 12, payload30.length()) + mbt_ffi_store32(iter_base + 8, address31) + + () + } + OptionValue(payload33) => { + mbt_ffi_store8(iter_base + 0, 21) + + match payload33 { + None => { + mbt_ffi_store8(iter_base + 8, 0) + + () + } + Some(payload35) => { + mbt_ffi_store8(iter_base + 8, 1) + mbt_ffi_store32(iter_base + 12, payload35) + + () + } + } + + () + } + ResultValue(payload36) => { + mbt_ffi_store8(iter_base + 0, 22) + + match payload36 { + OkValue(payload37) => { + mbt_ffi_store8(iter_base + 8, 0) + + match payload37 { + None => { + mbt_ffi_store8(iter_base + 12, 0) + + () + } + Some(payload39) => { + mbt_ffi_store8(iter_base + 12, 1) + mbt_ffi_store32(iter_base + 16, payload39) + + () + } + } + + () + } + ErrValue(payload40) => { + mbt_ffi_store8(iter_base + 8, 1) + + match payload40 { + None => { + mbt_ffi_store8(iter_base + 12, 0) + + () + } + Some(payload42) => { + mbt_ffi_store8(iter_base + 12, 1) + mbt_ffi_store32(iter_base + 16, payload42) + + () + } + } + + () + } + } + + () + } + TextValue(payload43) => { + mbt_ffi_store8(iter_base + 0, 23) + + let ptr44 = mbt_ffi_str2ptr(payload43.text) + mbt_ffi_store32(iter_base + 12, payload43.text.length()) + mbt_ffi_store32(iter_base + 8, ptr44) + + match payload43.language { + None => { + mbt_ffi_store8(iter_base + 16, 0) + + () + } + Some(payload46) => { + mbt_ffi_store8(iter_base + 16, 1) + + let ptr47 = mbt_ffi_str2ptr(payload46) + mbt_ffi_store32(iter_base + 24, payload46.length()) + mbt_ffi_store32(iter_base + 20, ptr47) + + () + } + } + + () + } + BinaryValue(payload48) => { + mbt_ffi_store8(iter_base + 0, 24) + + let ptr49 = mbt_ffi_bytes2ptr(payload48.bytes) + + mbt_ffi_store32(iter_base + 12, payload48.bytes.length()) + mbt_ffi_store32(iter_base + 8, ptr49) + + match payload48.mime_type { + None => { + mbt_ffi_store8(iter_base + 16, 0) + + () + } + Some(payload51) => { + mbt_ffi_store8(iter_base + 16, 1) + + let ptr52 = mbt_ffi_str2ptr(payload51) + mbt_ffi_store32(iter_base + 24, payload51.length()) + mbt_ffi_store32(iter_base + 20, ptr52) + + () + } + } + + () + } + PathValue(payload53) => { + mbt_ffi_store8(iter_base + 0, 25) + + let ptr54 = mbt_ffi_str2ptr(payload53) + mbt_ffi_store32(iter_base + 12, payload53.length()) + mbt_ffi_store32(iter_base + 8, ptr54) + + () + } + UrlValue(payload55) => { + mbt_ffi_store8(iter_base + 0, 26) + + let ptr56 = mbt_ffi_str2ptr(payload55) + mbt_ffi_store32(iter_base + 12, payload55.length()) + mbt_ffi_store32(iter_base + 8, ptr56) + + () + } + DatetimeValue(payload57) => { + mbt_ffi_store8(iter_base + 0, 27) + mbt_ffi_store64(iter_base + 8, payload57.seconds) + mbt_ffi_store32( + iter_base + 16, + payload57.nanoseconds.reinterpret_as_int(), + ) + + () + } + DurationValue(payload58) => { + mbt_ffi_store8(iter_base + 0, 28) + mbt_ffi_store64(iter_base + 8, payload58.nanoseconds) + + () + } + QuantityValueNode(payload59) => { + mbt_ffi_store8(iter_base + 0, 29) + mbt_ffi_store64(iter_base + 8, payload59.mantissa) + mbt_ffi_store32(iter_base + 16, payload59.scale) + + let ptr60 = mbt_ffi_str2ptr(payload59.unit) + mbt_ffi_store32(iter_base + 24, payload59.unit.length()) + mbt_ffi_store32(iter_base + 20, ptr60) + + () + } + UnionValue(payload61) => { + mbt_ffi_store8(iter_base + 0, 30) + + let ptr62 = mbt_ffi_str2ptr(payload61.tag) + mbt_ffi_store32(iter_base + 12, payload61.tag.length()) + mbt_ffi_store32(iter_base + 8, ptr62) + mbt_ffi_store32(iter_base + 16, payload61.body) + + () + } + SecretValue(payload63) => { + mbt_ffi_store8(iter_base + 0, 31) + + let Secret(handle) = payload63 + mbt_ffi_store32(iter_base + 8, handle) + + () + } + QuotaTokenHandle(payload64) => { + mbt_ffi_store8(iter_base + 0, 32) + + let QuotaToken(handle65) = payload64 + mbt_ffi_store32(iter_base + 8, handle65) + + () + } + StreamValue(payload66) => { + mbt_ffi_store8(iter_base + 0, 33) + + let SchemaValueStream(handle67) = payload66 + mbt_ffi_store32(iter_base + 8, handle67) + + () + } + } + } + mbt_ffi_store32(ptr + 4, value.value_nodes.length()) + mbt_ffi_store32(ptr + 0, address68) + mbt_ffi_store32(ptr + 8, value.root) +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0ListLift( + ptr : Int, + length : Int, +) -> FixedArray[SchemaValueTree] { + FixedArray::makei(length, index => { + let ptr = ptr + index * 12 + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lift(ptr) + }) +} + +///| +priv struct WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource { + handle : Int + mut closed : Bool + mut reading : Bool + mut read_task : Int + mut read_buffer : Int + mut read_discarding : Bool + mut read_cleanup_done : Bool + read_cleanup : @async-core.CondVar +} + +///| +fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::finish_read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit { + self.reading = false + self.read_task = 0 + self.read_buffer = 0 + self.read_discarding = false + // Keep completion latched until a later read starts so every waiter woken + // by the broadcast can observe it. +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::wait_for_read_cleanup( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit noraise { + @async-core.protect_from_cancel( + () => { + while !self.read_cleanup_done { + self.read_cleanup.wait() + } + }, + resume_on_cancel=true, + ) catch { + _ => () + } +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::cancel_active_read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit noraise { + if !self.reading { + return + } + if self.read_discarding { + self.wait_for_read_cleanup() + return + } + self.read_discarding = true + let progress_ref = Ref(0) + @async-core.protect_from_cancel( + () => { + progress_ref.val = @async-core.cancel_stream_read( + self.read_task, + self.handle, + () => { + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0CancelRead( + self.handle, + ) + }, + ) + }, + resume_on_cancel=true, + ) catch { + _ => () + } + let progress = progress_ref.val + if progress > 0 && self.read_buffer != 0 { + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject( + self.read_buffer, + 0, + progress, + ) + } + self.read_cleanup_done = true + self.read_cleanup.broadcast() +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::close( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit noraise { + if self.closed { + return + } + if self.reading { + self.cancel_active_read() + } + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + self.handle, + ) +} + +///| +fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::close_sync( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit { + if self.closed || self.reading { + return + } + + if wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamRejectPrepared( + self.handle, + ) { + self.closed = true + return + } + + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + self.handle, + ) +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, + count : Int, +) -> FixedArray[SchemaValueTree]? { + if self.closed { + return None + } + if count <= 0 { + return Some([]) + } + if self.reading { + raise @async-core.EndpointBusy::Read + } + // `Stream.read` promises at most `count`; bound one canonical allocation. + let read_count = if count < 64 { count } else { 64 } + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc( + read_count, + ) + let mut owns_buffer = false + defer (if !owns_buffer { mbt_ffi_free(ptr) }) + self.reading = true + self.read_task = @async-core.current_component_task_token() + self.read_buffer = ptr + self.read_discarding = false + self.read_cleanup_done = false + let (progress, end) = @async-core.suspend_for_stream_read( + self.handle, + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0Read( + self.handle, + ptr, + read_count, + ), + ) catch { + err => { + if self.read_discarding { + self.wait_for_read_cleanup() + self.finish_read() + return None + } + if err is @async-core.Cancelled::Cancelled { + self.cancel_active_read() + if !self.closed { + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + self.handle, + ) + } + } + self.finish_read() + raise err + } + } + if self.read_discarding { + self.wait_for_read_cleanup() + self.finish_read() + return None + } + if progress == 0 { + self.finish_read() + if end { + self.close() + return None + } + return Some([]) + } + let values = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0ListLift( + ptr, progress, + ) + owns_buffer = false + self.finish_read() + if end { + self.close() + } + Some(values) +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamLift( + handle : Int, +) -> @async-core.Stream[SchemaValueTree] { + let source = WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::{ + handle, + closed: false, + reading: false, + read_task: 0, + read_buffer: 0, + read_discarding: false, + read_cleanup_done: false, + read_cleanup: CondVar(), + } + @async-core.Stream::from_source( + count => source.read(count), + () => source.close(), + () => source.close_sync(), + ) +} + +///| +priv struct WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducer { + stream : @async-core.Stream[SchemaValueTree] + writer : Int +} + +///| +let wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers : Map[ + Int, + WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducer, +] = Map([]) + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamRejectPrepared( + handle : Int, +) -> Bool { + guard wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.get( + handle, + ) + is Some(prepared) else { + return false + } + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.remove( + handle, + ) + let writer = prepared.writer + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + handle, + ) + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropWritable( + writer, + ) + @async-core.spawn_component_task_current(async fn() { + @async-core.protect_from_cancel( + () => { + prepared.stream.reject((value : SchemaValueTree) => { + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc( + 1, + ) + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lower( + value, ptr, + ) + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject( + ptr, 0, 1, + ) + mbt_ffi_free(ptr) + }) + }, + resume_on_cancel=true, + ) catch { + _ => () + } + }) + true +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamCommit( + handle : Int, +) -> Unit { + guard wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.get( + handle, + ) + is Some(prepared) else { + return + } + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.remove( + handle, + ) + let stream = prepared.stream + let writer = prepared.writer + if !@async-core.has_component_task_scope() { + abort("component stream producer requires an async task scope") + } + let producer = stream.take_producer() + @async-core.spawn_component_task_current(async fn() { + let writer_closed = Ref(false) + let writer_lock = @async-core.Mutex() + let close_writer = fn() -> Unit { + if !writer_closed.val { + writer_closed.val = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropWritable( + writer, + ) + } + } + let close_writer_serialized = async fn() -> Unit { + writer_lock.acquire() + defer writer_lock.release() + close_writer() + } + let cleanup_value = fn(value : SchemaValueTree) -> Unit { + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc(1) + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lower(value, ptr) + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject(ptr, 0, 1) + mbt_ffi_free(ptr) + } + let sink = @async-core.Sink::from_callbacks( + (data : ArrayView[SchemaValueTree]) => { + writer_lock.acquire() + defer writer_lock.release() + if writer_closed.val || data.length() == 0 { + return 0 + } + let data_len = if data.length() < 64 { data.length() } else { 64 } + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc( + data_len, + ) + for i in 0.. Unit { + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Commit( + ptr, 0, transferred, + ) + if transferred < data_len { + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject( + ptr, + transferred, + data_len - transferred, + ) + } + mbt_ffi_free(ptr) + } + let mut total = 0 + let mut dropped = false + while total < data_len { + let (progress, end) = @async-core.suspend_for_stream_write( + writer, + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0Write( + writer, + ptr + total * 12, + data_len - total, + ), + ) catch { + _ => { + total = total + + @async-core.cancel_stream_write(writer, () => { + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0CancelWrite( + writer, + ) + }) + settle_staging(total) + close_writer() + return data_len + } + } + total = total + progress + if end { + dropped = true + break + } + } + settle_staging(total) + if dropped { + close_writer() + } + // The canonical writer accepted `total`; generated cleanup + // consumed the rest of this staging window. + data_len + }, + () => close_writer_serialized(), + () => !writer_closed.val, + Some(cleanup_value), + ) + let relay_source = producer is None + let run_producer = async fn() -> Unit { + match producer { + Some(producer) => { + producer(sink) + sink.close() + } + None => + for ;; { + match stream.read(64) { + Some(data) => + if !sink.write_all(data[:]) { + stream.reject(cleanup_value) + return + } + None => { + sink.close() + return + } + } + } + } + } + run_producer() catch { + _ => + if relay_source { + @async-core.protect_from_cancel( + () => stream.reject(cleanup_value), + resume_on_cancel=true, + ) catch { + _ => () + } + } + } + // A retained Sink may still own an in-flight canonical write after its + // producer returns. Do not drop the writable endpoint until that write + // has reached a terminal event and released its staging buffer. + @async-core.protect_from_cancel( + () => close_writer_serialized(), + resume_on_cancel=true, + ) + }) +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamLower( + stream : @async-core.Stream[SchemaValueTree], +) -> Int { + if !@async-core.has_component_task_scope() { + abort("component stream producer requires an async task scope") + } + let pair = wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0New() + let reader = pair.to_int() + let writer = (pair >> 32).to_int() + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.set( + reader, + { stream, writer }, + ) + reader +} + +///| +fn wasmImportStaticSchemaValueStreamUnwrap(p0 : Int, p1 : Int) -> Int = "golem:core/types@2.0.0" "[async-lower][static]schema-value-stream.unwrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Read( + handle : Int, + buffer_ptr : Int, + length : Int, +) -> Int = "golem:core/types@2.0.0" "[async-lower][stream-read-0][static]schema-value-stream.unwrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0CancelRead( + handle : Int, +) -> Int = "golem:core/types@2.0.0" "[stream-cancel-read-0][static]schema-value-stream.unwrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0DropReadable( + handle : Int, +) = "golem:core/types@2.0.0" "[stream-drop-readable-0][static]schema-value-stream.unwrap" + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Malloc( + length : Int, +) -> Int { + let ptr = mbt_ffi_malloc(12 * length) + ptr +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Reject( + ptr : Int, + start : Int, + length : Int, +) -> Unit { + for i in start..<(start + length) { + let elem_ptr = ptr + i * 12 + + for index = 0; index < mbt_ffi_load32(elem_ptr + 4); index = index + 1 { + let iter_base = mbt_ffi_load32(elem_ptr + 0) + index * 32 + + match mbt_ffi_load8_u(iter_base + 0) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => () + 5 => () + 6 => () + 7 => () + 8 => () + 9 => () + 10 => () + 11 => () + 12 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 13 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 14 => () + 15 => () + 16 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 17 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 18 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 19 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 20 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 21 => () + 22 => () + 23 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 24 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 25 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 26 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 27 => () + 28 => () + 29 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 31 => Secret::Secret(mbt_ffi_load32(iter_base + 8)).drop() + 32 => QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)).drop() + 33 => + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(iter_base + 8)).drop() + _ => panic() + } + } + mbt_ffi_free(mbt_ffi_load32(elem_ptr + 0)) + } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Lift( + ptr : Int, +) -> SchemaValueTree { + let array25 : Array[SchemaValueNode] = [] + for index26 = 0; index26 < mbt_ffi_load32(ptr + 4); index26 = index26 + 1 { + let iter_base = mbt_ffi_load32(ptr + 0) + index26 * 32 + + let lifted24 = match mbt_ffi_load8_u(iter_base + 0) { + 0 => SchemaValueNode::BoolValue(mbt_ffi_load8_u(iter_base + 8) != 0) + 1 => SchemaValueNode::S8Value(mbt_ffi_load8(iter_base + 8)) + 2 => SchemaValueNode::S16Value(mbt_ffi_load16(iter_base + 8)) + 3 => SchemaValueNode::S32Value(mbt_ffi_load32(iter_base + 8)) + 4 => SchemaValueNode::S64Value(mbt_ffi_load64(iter_base + 8)) + 5 => SchemaValueNode::U8Value(mbt_ffi_load8_u(iter_base + 8).to_byte()) + 6 => + SchemaValueNode::U16Value( + mbt_ffi_load16_u(iter_base + 8).land(0xFFFF).reinterpret_as_uint(), + ) + 7 => + SchemaValueNode::U32Value( + mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + ) + 8 => + SchemaValueNode::U64Value( + mbt_ffi_load64(iter_base + 8).reinterpret_as_uint64(), + ) + 9 => SchemaValueNode::F32Value(mbt_ffi_loadf32(iter_base + 8)) + 10 => SchemaValueNode::F64Value(mbt_ffi_loadf64(iter_base + 8)) + 11 => + SchemaValueNode::CharValue( + Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), + ) + 12 => { + let result = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::StringValue(result) + } + 13 => { + let array : Array[Int] = [] + for index = 0; index < mbt_ffi_load32(iter_base + 12); index = index + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index * 4 + + array.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::RecordValue(array) + } + 14 => { + let lifted : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + SchemaValueNode::VariantValue(VariantValuePayload::{ + case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + payload: lifted, + }) + } + 15 => + SchemaValueNode::EnumValue( + mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + ) + 16 => { + let array0 : Array[Bool] = [] + for index1 = 0 + index1 < mbt_ffi_load32(iter_base + 12) + index1 = index1 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index1 * 1 + + array0.push(mbt_ffi_load8_u(iter_base + 0) != 0) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::FlagsValue(array0) + } + 17 => { + let array2 : Array[Int] = [] + for index3 = 0 + index3 < mbt_ffi_load32(iter_base + 12) + index3 = index3 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index3 * 4 + + array2.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::TupleValue(array2) + } + 18 => { + let array4 : Array[Int] = [] + for index5 = 0 + index5 < mbt_ffi_load32(iter_base + 12) + index5 = index5 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index5 * 4 + + array4.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::ListValue(array4) + } + 19 => { + let array6 : Array[Int] = [] + for index7 = 0 + index7 < mbt_ffi_load32(iter_base + 12) + index7 = index7 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index7 * 4 + + array6.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::FixedListValue(array6) + } + 20 => { + let array8 : Array[MapEntry] = [] + for index9 = 0 + index9 < mbt_ffi_load32(iter_base + 12) + index9 = index9 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index9 * 8 + + array8.push(MapEntry::{ + key: mbt_ffi_load32(iter_base + 0), + value: mbt_ffi_load32(iter_base + 4), + }) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::MapValue(array8) + } + 21 => { + let lifted10 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) + _ => panic() + } + + SchemaValueNode::OptionValue(lifted10) + } + 22 => { + let lifted13 = match mbt_ffi_load8_u(iter_base + 8) { + 0 => { + let lifted11 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + ResultValuePayload::OkValue(lifted11) + } + 1 => { + let lifted12 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + ResultValuePayload::ErrValue(lifted12) + } + _ => panic() + } + + SchemaValueNode::ResultValue(lifted13) + } + 23 => { + let result14 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + let lifted16 : String? = match mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let result15 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + Option::Some(result15) + } + _ => panic() + } + + SchemaValueNode::TextValue(TextValuePayload::{ + text: result14, + language: lifted16, + }) + } + 24 => { + let result17 = mbt_ffi_ptr2bytes( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + let lifted19 : String? = match mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let result18 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + Option::Some(result18) + } + _ => panic() + } + + SchemaValueNode::BinaryValue(BinaryValuePayload::{ + bytes: result17, + mime_type: lifted19, + }) + } + 25 => { + let result20 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::PathValue(result20) + } + 26 => { + let result21 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::UrlValue(result21) + } + 27 => + SchemaValueNode::DatetimeValue(Datetime::{ + seconds: mbt_ffi_load64(iter_base + 8), + nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), + }) + 28 => + SchemaValueNode::DurationValue(DurationValuePayload::{ + nanoseconds: mbt_ffi_load64(iter_base + 8), + }) + 29 => { + let result22 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + SchemaValueNode::QuantityValueNode(QuantityValue::{ + mantissa: mbt_ffi_load64(iter_base + 8), + scale: mbt_ffi_load32(iter_base + 16), + unit: result22, + }) + } + 30 => { + let result23 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::UnionValue(UnionValuePayload::{ + tag: result23, + body: mbt_ffi_load32(iter_base + 16), + }) + } + 31 => + SchemaValueNode::SecretValue( + Secret::Secret(mbt_ffi_load32(iter_base + 8)), + ) + 32 => + SchemaValueNode::QuotaTokenHandle( + QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), + ) + 33 => + SchemaValueNode::StreamValue( + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(iter_base + 8)), + ) + _ => panic() + } + + array25.push(lifted24) + } + mbt_ffi_free(mbt_ffi_load32(ptr + 0)) + + SchemaValueTree::{ value_nodes: array25, root: mbt_ffi_load32(ptr + 8) } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0ListLift( + ptr : Int, + length : Int, +) -> FixedArray[SchemaValueTree] { + FixedArray::makei(length, index => { + let ptr = ptr + index * 12 + wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Lift(ptr) + }) +} + +///| +priv struct WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource { + handle : Int + mut closed : Bool + mut reading : Bool + mut read_task : Int + mut read_buffer : Int + mut read_discarding : Bool + mut read_cleanup_done : Bool + read_cleanup : @async-core.CondVar +} + +///| +fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::finish_read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit { + self.reading = false + self.read_task = 0 + self.read_buffer = 0 + self.read_discarding = false + // Keep completion latched until a later read starts so every waiter woken + // by the broadcast can observe it. +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::wait_for_read_cleanup( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit noraise { + @async-core.protect_from_cancel( + () => { + while !self.read_cleanup_done { + self.read_cleanup.wait() + } + }, + resume_on_cancel=true, + ) catch { + _ => () + } +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::cancel_active_read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit noraise { + if !self.reading { + return + } + if self.read_discarding { + self.wait_for_read_cleanup() + return + } + self.read_discarding = true + let progress_ref = Ref(0) + @async-core.protect_from_cancel( + () => { + progress_ref.val = @async-core.cancel_stream_read( + self.read_task, + self.handle, + () => { + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0CancelRead( + self.handle, + ) + }, + ) + }, + resume_on_cancel=true, + ) catch { + _ => () + } + let progress = progress_ref.val + if progress > 0 && self.read_buffer != 0 { + wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Reject( + self.read_buffer, + 0, + progress, + ) + } + self.read_cleanup_done = true + self.read_cleanup.broadcast() +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::close( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit noraise { + if self.closed { + return + } + if self.reading { + self.cancel_active_read() + } + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0DropReadable( + self.handle, + ) +} + +///| +fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::close_sync( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit { + if self.closed || self.reading { + return + } + + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0DropReadable( + self.handle, + ) +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, + count : Int, +) -> FixedArray[SchemaValueTree]? { + if self.closed { + return None + } + if count <= 0 { + return Some([]) + } + if self.reading { + raise @async-core.EndpointBusy::Read + } + // `Stream.read` promises at most `count`; bound one canonical allocation. + let read_count = if count < 64 { count } else { 64 } + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Malloc( + read_count, + ) + let mut owns_buffer = false + defer (if !owns_buffer { mbt_ffi_free(ptr) }) + self.reading = true + self.read_task = @async-core.current_component_task_token() + self.read_buffer = ptr + self.read_discarding = false + self.read_cleanup_done = false + let (progress, end) = @async-core.suspend_for_stream_read( + self.handle, + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Read( + self.handle, + ptr, + read_count, + ), + ) catch { + err => { + if self.read_discarding { + self.wait_for_read_cleanup() + self.finish_read() + return None + } + if err is @async-core.Cancelled::Cancelled { + self.cancel_active_read() + if !self.closed { + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0DropReadable( + self.handle, + ) + } + } + self.finish_read() + raise err + } + } + if self.read_discarding { + self.wait_for_read_cleanup() + self.finish_read() + return None + } + if progress == 0 { + self.finish_read() + if end { + self.close() + return None + } + return Some([]) + } + let values = wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0ListLift( + ptr, progress, + ) + owns_buffer = false + self.finish_read() + if end { + self.close() + } + Some(values) +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamLift( + handle : Int, +) -> @async-core.Stream[SchemaValueTree] { + let source = WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::{ + handle, + closed: false, + reading: false, + read_task: 0, + read_buffer: 0, + read_discarding: false, + read_cleanup_done: false, + read_cleanup: CondVar(), + } + @async-core.Stream::from_source( + count => source.read(count), + () => source.close(), + () => source.close_sync(), + ) +} + +///| +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) + ///| #owned(str) extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = #|(func (param i32) (result i32) local.get 0) +///| +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) + +///| +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) + +///| +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) + ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + +///| +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = @@ -46,3 +2037,27 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0 #| local.get 1 call $moonbit.init_array16 #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) + +///| +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/core/types/moon.pkg b/sdks/moonbit/golem_sdk/interface/golem/core/types/moon.pkg index e2a6033b7d..df9e86010b 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/core/types/moon.pkg +++ b/sdks/moonbit/golem_sdk/interface/golem/core/types/moon.pkg @@ -1 +1,5 @@ warnings = "-44" + +import { + "golemcloud/golem_sdk/async-core", +} diff --git a/sdks/moonbit/golem_sdk/interface/golem/core/types/pkg.generated.mbti b/sdks/moonbit/golem_sdk/interface/golem/core/types/pkg.generated.mbti index 17928cc385..7b1a5f5e96 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/core/types/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk/interface/golem/core/types/pkg.generated.mbti @@ -1,6 +1,10 @@ // Generated using `moon info`, DON'T EDIT IT package "golemcloud/golem_sdk/interface/golem/core/types" +import { + "golemcloud/golem_sdk/async-core", +} + // Values pub fn parse_uuid(String) -> Result[Uuid, String] @@ -260,8 +264,14 @@ pub(all) enum SchemaValueNode { UnionValue(UnionValuePayload) SecretValue(Secret) QuotaTokenHandle(QuotaToken) + StreamValue(SchemaValueStream) } derive(Eq, Show) +pub(all) struct SchemaValueStream(Int) derive(Eq, Show) +pub fn SchemaValueStream::drop(Self) -> Unit +pub async fn SchemaValueStream::unwrap(Self) -> @async-core.Stream[SchemaValueTree] +pub async fn SchemaValueStream::wrap(@async-core.Stream[SchemaValueTree]) -> Self + pub(all) struct SchemaValueTree { value_nodes : Array[SchemaValueNode] root : Int diff --git a/sdks/moonbit/golem_sdk/interface/golem/core/types/top.mbt b/sdks/moonbit/golem_sdk/interface/golem/core/types/top.mbt index 8724dbfbd2..0f7dda136f 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/core/types/top.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/core/types/top.mbt @@ -93,6 +93,19 @@ pub fn Secret::drop(self : Secret) -> Unit { wasmImportResourceDropSecret(resource) } +///| +/// An affine wrapper around a native Component Model stream of schema +/// values. The indirection lets a stream occur anywhere in a recursive +/// `schema-value-tree` while preserving the native stream endpoint. +pub(all) struct SchemaValueStream(Int) derive(Show, Eq) + +///| +/// Drops a resource handle. +pub fn SchemaValueStream::drop(self : SchemaValueStream) -> Unit { + let SchemaValueStream(resource) = self + wasmImportResourceDropSchemaValueStream(resource) +} + ///| /// A named type definition inside a `schema-graph`. /// @@ -511,6 +524,7 @@ pub(all) enum SchemaValueNode { UnionValue(UnionValuePayload) SecretValue(Secret) QuotaTokenHandle(QuotaToken) + StreamValue(SchemaValueStream) } derive(Show, Eq) ///| @@ -590,3 +604,77 @@ pub fn uuid_to_string(uuid : Uuid) -> String { mbt_ffi_free(return_area) return ret } + +///| +/// Wraps any native schema-value reader for placement in a value tree. +pub async fn SchemaValueStream::wrap( + reader : @async-core.Stream[SchemaValueTree], +) -> SchemaValueStream { + let lower_arg = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamLower( + reader, + ) + let result_ptr = mbt_ffi_malloc(4 * 1) + defer mbt_ffi_free(result_ptr) + + let subtask_code = wasmImportStaticSchemaValueStreamWrap( + lower_arg, result_ptr, + ) + @async-core.suspend_for_subtask( + subtask_code, + fn(before_started) { + if before_started { + let result = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamLift( + lower_arg, + ) + result.drop_sync() + } else { + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamCommit( + lower_arg, + ) + } + }, + fn() { + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(result_ptr + 0)).drop() + }, + ) + + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(result_ptr + 0)) +} + +///| +/// Consumes a schema-value-stream wrapper and returns its native reader. +pub async fn SchemaValueStream::unwrap( + value : SchemaValueStream, +) -> @async-core.Stream[SchemaValueTree] { + let SchemaValueStream(handle) = value + + let lower_arg = handle + let result_ptr = mbt_ffi_malloc(4 * 1) + defer mbt_ffi_free(result_ptr) + + let subtask_code = wasmImportStaticSchemaValueStreamUnwrap( + lower_arg, result_ptr, + ) + @async-core.suspend_for_subtask( + subtask_code, + fn(before_started) { + if before_started { + SchemaValueStream::SchemaValueStream(lower_arg).drop() + } else { + () + } + }, + fn() { + let result = wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamLift( + mbt_ffi_load32(result_ptr + 0), + ) + result.drop_sync() + }, + ) + + let result = wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamLift( + mbt_ffi_load32(result_ptr + 0), + ) + + result +} diff --git a/sdks/moonbit/golem_sdk/interface/golem/durability/durability/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/durability/durability/ffi.mbt index a09a64fdb1..65aebd1dc8 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/durability/durability/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/durability/durability/ffi.mbt @@ -25,41 +25,65 @@ fn wasmImportPersistDurableFunctionInvocation(p0 : Int) = "golem:durability/dura fn wasmImportReadPersistedDurableFunctionInvocation(p0 : Int) = "golem:durability/durability@1.5.0" "read-persisted-durable-function-invocation" ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = - #|(func (param i32) (result f32) local.get 0 f32.load) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) + +///| +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) + ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| -extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = - #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = @@ -68,11 +92,6 @@ extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #| local.get 1 call $moonbit.init_array8 #| local.get 0) -///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) - ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) @@ -81,44 +100,25 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - -///| -extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend8_s) - -///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) - -///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) - -///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) - -///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) + +///| +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/durability/durability/top.mbt b/sdks/moonbit/golem_sdk/interface/golem/durability/durability/top.mbt index 9aa7a7f983..82b6f3c58a 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/durability/durability/top.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/durability/durability/top.mbt @@ -2565,12 +2565,12 @@ pub fn persist_durable_function_invocation( mbt_ffi_store32(return_area + 16, address364) mbt_ffi_store32(return_area + 24, request.graph.root) - let address435 = mbt_ffi_malloc(request.value.value_nodes.length() * 32) - for index436 = 0 - index436 < request.value.value_nodes.length() - index436 = index436 + 1 { - let iter_elem : @types.SchemaValueNode = request.value.value_nodes[index436] - let iter_base = address435 + index436 * 32 + let address437 = mbt_ffi_malloc(request.value.value_nodes.length() * 32) + for index438 = 0 + index438 < request.value.value_nodes.length() + index438 = index438 + 1 { + let iter_elem : @types.SchemaValueNode = request.value.value_nodes[index438] + let iter_base = address437 + index438 * 32 match iter_elem { BoolValue(payload366) => { @@ -2979,25 +2979,33 @@ pub fn persist_durable_function_invocation( let @types.QuotaToken(handle434) = payload433 mbt_ffi_store32(iter_base + 8, handle434) + () + } + StreamValue(payload435) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle436) = payload435 + mbt_ffi_store32(iter_base + 8, handle436) + () } } } mbt_ffi_store32(return_area + 32, request.value.value_nodes.length()) - mbt_ffi_store32(return_area + 28, address435) + mbt_ffi_store32(return_area + 28, address437) mbt_ffi_store32(return_area + 36, request.value.root) - let address798 = mbt_ffi_malloc(response.graph.type_nodes.length() * 144) - for index799 = 0 - index799 < response.graph.type_nodes.length() - index799 = index799 + 1 { - let iter_elem : @types.SchemaTypeNode = response.graph.type_nodes[index799] - let iter_base = address798 + index799 * 144 + let address800 = mbt_ffi_malloc(response.graph.type_nodes.length() * 144) + for index801 = 0 + index801 < response.graph.type_nodes.length() + index801 = index801 + 1 { + let iter_elem : @types.SchemaTypeNode = response.graph.type_nodes[index801] + let iter_base = address800 + index801 * 144 match iter_elem.body { - RefType(payload437) => { + RefType(payload439) => { mbt_ffi_store8(iter_base + 0, 0) - mbt_ffi_store32(iter_base + 8, payload437) + mbt_ffi_store32(iter_base + 8, payload439) () } @@ -3006,48 +3014,48 @@ pub fn persist_durable_function_invocation( () } - S8Type(payload439) => { + S8Type(payload441) => { mbt_ffi_store8(iter_base + 0, 2) - match payload439 { + match payload441 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload441) => { + Some(payload443) => { mbt_ffi_store8(iter_base + 8, 1) - match payload441.min { + match payload443.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload443) => { + Some(payload445) => { mbt_ffi_store8(iter_base + 16, 1) - match payload443 { - Signed(payload444) => { + match payload445 { + Signed(payload446) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload444) + mbt_ffi_store64(iter_base + 32, payload446) () } - Unsigned(payload445) => { + Unsigned(payload447) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload445.reinterpret_as_int64(), + payload447.reinterpret_as_int64(), ) () } - FloatBits(payload446) => { + FloatBits(payload448) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload446.reinterpret_as_int64(), + payload448.reinterpret_as_int64(), ) () @@ -3058,36 +3066,36 @@ pub fn persist_durable_function_invocation( } } - match payload441.max { + match payload443.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload448) => { + Some(payload450) => { mbt_ffi_store8(iter_base + 40, 1) - match payload448 { - Signed(payload449) => { + match payload450 { + Signed(payload451) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload449) + mbt_ffi_store64(iter_base + 56, payload451) () } - Unsigned(payload450) => { + Unsigned(payload452) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload450.reinterpret_as_int64(), + payload452.reinterpret_as_int64(), ) () } - FloatBits(payload451) => { + FloatBits(payload453) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload451.reinterpret_as_int64(), + payload453.reinterpret_as_int64(), ) () @@ -3098,19 +3106,19 @@ pub fn persist_durable_function_invocation( } } - match payload441.unit { + match payload443.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload453) => { + Some(payload455) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr454 = mbt_ffi_str2ptr(payload453) - mbt_ffi_store32(iter_base + 72, payload453.length()) - mbt_ffi_store32(iter_base + 68, ptr454) - cleanup_list.push(ptr454) + let ptr456 = mbt_ffi_str2ptr(payload455) + mbt_ffi_store32(iter_base + 72, payload455.length()) + mbt_ffi_store32(iter_base + 68, ptr456) + cleanup_list.push(ptr456) () } @@ -3122,48 +3130,48 @@ pub fn persist_durable_function_invocation( () } - S16Type(payload455) => { + S16Type(payload457) => { mbt_ffi_store8(iter_base + 0, 3) - match payload455 { + match payload457 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload457) => { + Some(payload459) => { mbt_ffi_store8(iter_base + 8, 1) - match payload457.min { + match payload459.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload459) => { + Some(payload461) => { mbt_ffi_store8(iter_base + 16, 1) - match payload459 { - Signed(payload460) => { + match payload461 { + Signed(payload462) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload460) + mbt_ffi_store64(iter_base + 32, payload462) () } - Unsigned(payload461) => { + Unsigned(payload463) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload461.reinterpret_as_int64(), + payload463.reinterpret_as_int64(), ) () } - FloatBits(payload462) => { + FloatBits(payload464) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload462.reinterpret_as_int64(), + payload464.reinterpret_as_int64(), ) () @@ -3174,36 +3182,36 @@ pub fn persist_durable_function_invocation( } } - match payload457.max { + match payload459.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload464) => { + Some(payload466) => { mbt_ffi_store8(iter_base + 40, 1) - match payload464 { - Signed(payload465) => { + match payload466 { + Signed(payload467) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload465) + mbt_ffi_store64(iter_base + 56, payload467) () } - Unsigned(payload466) => { + Unsigned(payload468) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload466.reinterpret_as_int64(), + payload468.reinterpret_as_int64(), ) () } - FloatBits(payload467) => { + FloatBits(payload469) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload467.reinterpret_as_int64(), + payload469.reinterpret_as_int64(), ) () @@ -3214,19 +3222,19 @@ pub fn persist_durable_function_invocation( } } - match payload457.unit { + match payload459.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload469) => { + Some(payload471) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr470 = mbt_ffi_str2ptr(payload469) - mbt_ffi_store32(iter_base + 72, payload469.length()) - mbt_ffi_store32(iter_base + 68, ptr470) - cleanup_list.push(ptr470) + let ptr472 = mbt_ffi_str2ptr(payload471) + mbt_ffi_store32(iter_base + 72, payload471.length()) + mbt_ffi_store32(iter_base + 68, ptr472) + cleanup_list.push(ptr472) () } @@ -3238,48 +3246,48 @@ pub fn persist_durable_function_invocation( () } - S32Type(payload471) => { + S32Type(payload473) => { mbt_ffi_store8(iter_base + 0, 4) - match payload471 { + match payload473 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload473) => { + Some(payload475) => { mbt_ffi_store8(iter_base + 8, 1) - match payload473.min { + match payload475.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload475) => { + Some(payload477) => { mbt_ffi_store8(iter_base + 16, 1) - match payload475 { - Signed(payload476) => { + match payload477 { + Signed(payload478) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload476) + mbt_ffi_store64(iter_base + 32, payload478) () } - Unsigned(payload477) => { + Unsigned(payload479) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload477.reinterpret_as_int64(), + payload479.reinterpret_as_int64(), ) () } - FloatBits(payload478) => { + FloatBits(payload480) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload478.reinterpret_as_int64(), + payload480.reinterpret_as_int64(), ) () @@ -3290,36 +3298,36 @@ pub fn persist_durable_function_invocation( } } - match payload473.max { + match payload475.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload480) => { + Some(payload482) => { mbt_ffi_store8(iter_base + 40, 1) - match payload480 { - Signed(payload481) => { + match payload482 { + Signed(payload483) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload481) + mbt_ffi_store64(iter_base + 56, payload483) () } - Unsigned(payload482) => { + Unsigned(payload484) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload482.reinterpret_as_int64(), + payload484.reinterpret_as_int64(), ) () } - FloatBits(payload483) => { + FloatBits(payload485) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload483.reinterpret_as_int64(), + payload485.reinterpret_as_int64(), ) () @@ -3330,19 +3338,19 @@ pub fn persist_durable_function_invocation( } } - match payload473.unit { + match payload475.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload485) => { + Some(payload487) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr486 = mbt_ffi_str2ptr(payload485) - mbt_ffi_store32(iter_base + 72, payload485.length()) - mbt_ffi_store32(iter_base + 68, ptr486) - cleanup_list.push(ptr486) + let ptr488 = mbt_ffi_str2ptr(payload487) + mbt_ffi_store32(iter_base + 72, payload487.length()) + mbt_ffi_store32(iter_base + 68, ptr488) + cleanup_list.push(ptr488) () } @@ -3354,48 +3362,48 @@ pub fn persist_durable_function_invocation( () } - S64Type(payload487) => { + S64Type(payload489) => { mbt_ffi_store8(iter_base + 0, 5) - match payload487 { + match payload489 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload489) => { + Some(payload491) => { mbt_ffi_store8(iter_base + 8, 1) - match payload489.min { + match payload491.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload491) => { + Some(payload493) => { mbt_ffi_store8(iter_base + 16, 1) - match payload491 { - Signed(payload492) => { + match payload493 { + Signed(payload494) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload492) + mbt_ffi_store64(iter_base + 32, payload494) () } - Unsigned(payload493) => { + Unsigned(payload495) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload493.reinterpret_as_int64(), + payload495.reinterpret_as_int64(), ) () } - FloatBits(payload494) => { + FloatBits(payload496) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload494.reinterpret_as_int64(), + payload496.reinterpret_as_int64(), ) () @@ -3406,36 +3414,36 @@ pub fn persist_durable_function_invocation( } } - match payload489.max { + match payload491.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload496) => { + Some(payload498) => { mbt_ffi_store8(iter_base + 40, 1) - match payload496 { - Signed(payload497) => { + match payload498 { + Signed(payload499) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload497) + mbt_ffi_store64(iter_base + 56, payload499) () } - Unsigned(payload498) => { + Unsigned(payload500) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload498.reinterpret_as_int64(), + payload500.reinterpret_as_int64(), ) () } - FloatBits(payload499) => { + FloatBits(payload501) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload499.reinterpret_as_int64(), + payload501.reinterpret_as_int64(), ) () @@ -3446,19 +3454,19 @@ pub fn persist_durable_function_invocation( } } - match payload489.unit { + match payload491.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload501) => { + Some(payload503) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr502 = mbt_ffi_str2ptr(payload501) - mbt_ffi_store32(iter_base + 72, payload501.length()) - mbt_ffi_store32(iter_base + 68, ptr502) - cleanup_list.push(ptr502) + let ptr504 = mbt_ffi_str2ptr(payload503) + mbt_ffi_store32(iter_base + 72, payload503.length()) + mbt_ffi_store32(iter_base + 68, ptr504) + cleanup_list.push(ptr504) () } @@ -3470,48 +3478,48 @@ pub fn persist_durable_function_invocation( () } - U8Type(payload503) => { + U8Type(payload505) => { mbt_ffi_store8(iter_base + 0, 6) - match payload503 { + match payload505 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload505) => { + Some(payload507) => { mbt_ffi_store8(iter_base + 8, 1) - match payload505.min { + match payload507.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload507) => { + Some(payload509) => { mbt_ffi_store8(iter_base + 16, 1) - match payload507 { - Signed(payload508) => { + match payload509 { + Signed(payload510) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload508) + mbt_ffi_store64(iter_base + 32, payload510) () } - Unsigned(payload509) => { + Unsigned(payload511) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload509.reinterpret_as_int64(), + payload511.reinterpret_as_int64(), ) () } - FloatBits(payload510) => { + FloatBits(payload512) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload510.reinterpret_as_int64(), + payload512.reinterpret_as_int64(), ) () @@ -3522,36 +3530,36 @@ pub fn persist_durable_function_invocation( } } - match payload505.max { + match payload507.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload512) => { + Some(payload514) => { mbt_ffi_store8(iter_base + 40, 1) - match payload512 { - Signed(payload513) => { + match payload514 { + Signed(payload515) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload513) + mbt_ffi_store64(iter_base + 56, payload515) () } - Unsigned(payload514) => { + Unsigned(payload516) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload514.reinterpret_as_int64(), + payload516.reinterpret_as_int64(), ) () } - FloatBits(payload515) => { + FloatBits(payload517) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload515.reinterpret_as_int64(), + payload517.reinterpret_as_int64(), ) () @@ -3562,19 +3570,19 @@ pub fn persist_durable_function_invocation( } } - match payload505.unit { + match payload507.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload517) => { + Some(payload519) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr518 = mbt_ffi_str2ptr(payload517) - mbt_ffi_store32(iter_base + 72, payload517.length()) - mbt_ffi_store32(iter_base + 68, ptr518) - cleanup_list.push(ptr518) + let ptr520 = mbt_ffi_str2ptr(payload519) + mbt_ffi_store32(iter_base + 72, payload519.length()) + mbt_ffi_store32(iter_base + 68, ptr520) + cleanup_list.push(ptr520) () } @@ -3586,48 +3594,48 @@ pub fn persist_durable_function_invocation( () } - U16Type(payload519) => { + U16Type(payload521) => { mbt_ffi_store8(iter_base + 0, 7) - match payload519 { + match payload521 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload521) => { + Some(payload523) => { mbt_ffi_store8(iter_base + 8, 1) - match payload521.min { + match payload523.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload523) => { + Some(payload525) => { mbt_ffi_store8(iter_base + 16, 1) - match payload523 { - Signed(payload524) => { + match payload525 { + Signed(payload526) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload524) + mbt_ffi_store64(iter_base + 32, payload526) () } - Unsigned(payload525) => { + Unsigned(payload527) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload525.reinterpret_as_int64(), + payload527.reinterpret_as_int64(), ) () } - FloatBits(payload526) => { + FloatBits(payload528) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload526.reinterpret_as_int64(), + payload528.reinterpret_as_int64(), ) () @@ -3638,36 +3646,36 @@ pub fn persist_durable_function_invocation( } } - match payload521.max { + match payload523.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload528) => { + Some(payload530) => { mbt_ffi_store8(iter_base + 40, 1) - match payload528 { - Signed(payload529) => { + match payload530 { + Signed(payload531) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload529) + mbt_ffi_store64(iter_base + 56, payload531) () } - Unsigned(payload530) => { + Unsigned(payload532) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload530.reinterpret_as_int64(), + payload532.reinterpret_as_int64(), ) () } - FloatBits(payload531) => { + FloatBits(payload533) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload531.reinterpret_as_int64(), + payload533.reinterpret_as_int64(), ) () @@ -3678,19 +3686,19 @@ pub fn persist_durable_function_invocation( } } - match payload521.unit { + match payload523.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload533) => { + Some(payload535) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr534 = mbt_ffi_str2ptr(payload533) - mbt_ffi_store32(iter_base + 72, payload533.length()) - mbt_ffi_store32(iter_base + 68, ptr534) - cleanup_list.push(ptr534) + let ptr536 = mbt_ffi_str2ptr(payload535) + mbt_ffi_store32(iter_base + 72, payload535.length()) + mbt_ffi_store32(iter_base + 68, ptr536) + cleanup_list.push(ptr536) () } @@ -3702,48 +3710,48 @@ pub fn persist_durable_function_invocation( () } - U32Type(payload535) => { + U32Type(payload537) => { mbt_ffi_store8(iter_base + 0, 8) - match payload535 { + match payload537 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload537) => { + Some(payload539) => { mbt_ffi_store8(iter_base + 8, 1) - match payload537.min { + match payload539.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload539) => { + Some(payload541) => { mbt_ffi_store8(iter_base + 16, 1) - match payload539 { - Signed(payload540) => { + match payload541 { + Signed(payload542) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload540) + mbt_ffi_store64(iter_base + 32, payload542) () } - Unsigned(payload541) => { + Unsigned(payload543) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload541.reinterpret_as_int64(), + payload543.reinterpret_as_int64(), ) () } - FloatBits(payload542) => { + FloatBits(payload544) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload542.reinterpret_as_int64(), + payload544.reinterpret_as_int64(), ) () @@ -3754,36 +3762,36 @@ pub fn persist_durable_function_invocation( } } - match payload537.max { + match payload539.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload544) => { + Some(payload546) => { mbt_ffi_store8(iter_base + 40, 1) - match payload544 { - Signed(payload545) => { + match payload546 { + Signed(payload547) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload545) + mbt_ffi_store64(iter_base + 56, payload547) () } - Unsigned(payload546) => { + Unsigned(payload548) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload546.reinterpret_as_int64(), + payload548.reinterpret_as_int64(), ) () } - FloatBits(payload547) => { + FloatBits(payload549) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload547.reinterpret_as_int64(), + payload549.reinterpret_as_int64(), ) () @@ -3794,19 +3802,19 @@ pub fn persist_durable_function_invocation( } } - match payload537.unit { + match payload539.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload549) => { + Some(payload551) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr550 = mbt_ffi_str2ptr(payload549) - mbt_ffi_store32(iter_base + 72, payload549.length()) - mbt_ffi_store32(iter_base + 68, ptr550) - cleanup_list.push(ptr550) + let ptr552 = mbt_ffi_str2ptr(payload551) + mbt_ffi_store32(iter_base + 72, payload551.length()) + mbt_ffi_store32(iter_base + 68, ptr552) + cleanup_list.push(ptr552) () } @@ -3818,48 +3826,48 @@ pub fn persist_durable_function_invocation( () } - U64Type(payload551) => { + U64Type(payload553) => { mbt_ffi_store8(iter_base + 0, 9) - match payload551 { + match payload553 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload553) => { + Some(payload555) => { mbt_ffi_store8(iter_base + 8, 1) - match payload553.min { + match payload555.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload555) => { + Some(payload557) => { mbt_ffi_store8(iter_base + 16, 1) - match payload555 { - Signed(payload556) => { + match payload557 { + Signed(payload558) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload556) + mbt_ffi_store64(iter_base + 32, payload558) () } - Unsigned(payload557) => { + Unsigned(payload559) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload557.reinterpret_as_int64(), + payload559.reinterpret_as_int64(), ) () } - FloatBits(payload558) => { + FloatBits(payload560) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload558.reinterpret_as_int64(), + payload560.reinterpret_as_int64(), ) () @@ -3870,36 +3878,36 @@ pub fn persist_durable_function_invocation( } } - match payload553.max { + match payload555.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload560) => { + Some(payload562) => { mbt_ffi_store8(iter_base + 40, 1) - match payload560 { - Signed(payload561) => { + match payload562 { + Signed(payload563) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload561) + mbt_ffi_store64(iter_base + 56, payload563) () } - Unsigned(payload562) => { + Unsigned(payload564) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload562.reinterpret_as_int64(), + payload564.reinterpret_as_int64(), ) () } - FloatBits(payload563) => { + FloatBits(payload565) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload563.reinterpret_as_int64(), + payload565.reinterpret_as_int64(), ) () @@ -3910,19 +3918,19 @@ pub fn persist_durable_function_invocation( } } - match payload553.unit { + match payload555.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload565) => { + Some(payload567) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr566 = mbt_ffi_str2ptr(payload565) - mbt_ffi_store32(iter_base + 72, payload565.length()) - mbt_ffi_store32(iter_base + 68, ptr566) - cleanup_list.push(ptr566) + let ptr568 = mbt_ffi_str2ptr(payload567) + mbt_ffi_store32(iter_base + 72, payload567.length()) + mbt_ffi_store32(iter_base + 68, ptr568) + cleanup_list.push(ptr568) () } @@ -3934,48 +3942,48 @@ pub fn persist_durable_function_invocation( () } - F32Type(payload567) => { + F32Type(payload569) => { mbt_ffi_store8(iter_base + 0, 10) - match payload567 { + match payload569 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload569) => { + Some(payload571) => { mbt_ffi_store8(iter_base + 8, 1) - match payload569.min { + match payload571.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload571) => { + Some(payload573) => { mbt_ffi_store8(iter_base + 16, 1) - match payload571 { - Signed(payload572) => { + match payload573 { + Signed(payload574) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload572) + mbt_ffi_store64(iter_base + 32, payload574) () } - Unsigned(payload573) => { + Unsigned(payload575) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload573.reinterpret_as_int64(), + payload575.reinterpret_as_int64(), ) () } - FloatBits(payload574) => { + FloatBits(payload576) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload574.reinterpret_as_int64(), + payload576.reinterpret_as_int64(), ) () @@ -3986,36 +3994,36 @@ pub fn persist_durable_function_invocation( } } - match payload569.max { + match payload571.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload576) => { + Some(payload578) => { mbt_ffi_store8(iter_base + 40, 1) - match payload576 { - Signed(payload577) => { + match payload578 { + Signed(payload579) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload577) + mbt_ffi_store64(iter_base + 56, payload579) () } - Unsigned(payload578) => { + Unsigned(payload580) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload578.reinterpret_as_int64(), + payload580.reinterpret_as_int64(), ) () } - FloatBits(payload579) => { + FloatBits(payload581) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload579.reinterpret_as_int64(), + payload581.reinterpret_as_int64(), ) () @@ -4026,19 +4034,19 @@ pub fn persist_durable_function_invocation( } } - match payload569.unit { + match payload571.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload581) => { + Some(payload583) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr582 = mbt_ffi_str2ptr(payload581) - mbt_ffi_store32(iter_base + 72, payload581.length()) - mbt_ffi_store32(iter_base + 68, ptr582) - cleanup_list.push(ptr582) + let ptr584 = mbt_ffi_str2ptr(payload583) + mbt_ffi_store32(iter_base + 72, payload583.length()) + mbt_ffi_store32(iter_base + 68, ptr584) + cleanup_list.push(ptr584) () } @@ -4050,48 +4058,48 @@ pub fn persist_durable_function_invocation( () } - F64Type(payload583) => { + F64Type(payload585) => { mbt_ffi_store8(iter_base + 0, 11) - match payload583 { + match payload585 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload585) => { + Some(payload587) => { mbt_ffi_store8(iter_base + 8, 1) - match payload585.min { + match payload587.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload587) => { + Some(payload589) => { mbt_ffi_store8(iter_base + 16, 1) - match payload587 { - Signed(payload588) => { + match payload589 { + Signed(payload590) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload588) + mbt_ffi_store64(iter_base + 32, payload590) () } - Unsigned(payload589) => { + Unsigned(payload591) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload589.reinterpret_as_int64(), + payload591.reinterpret_as_int64(), ) () } - FloatBits(payload590) => { + FloatBits(payload592) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload590.reinterpret_as_int64(), + payload592.reinterpret_as_int64(), ) () @@ -4102,36 +4110,36 @@ pub fn persist_durable_function_invocation( } } - match payload585.max { + match payload587.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload592) => { + Some(payload594) => { mbt_ffi_store8(iter_base + 40, 1) - match payload592 { - Signed(payload593) => { + match payload594 { + Signed(payload595) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload593) + mbt_ffi_store64(iter_base + 56, payload595) () } - Unsigned(payload594) => { + Unsigned(payload596) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload594.reinterpret_as_int64(), + payload596.reinterpret_as_int64(), ) () } - FloatBits(payload595) => { + FloatBits(payload597) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload595.reinterpret_as_int64(), + payload597.reinterpret_as_int64(), ) () @@ -4142,19 +4150,19 @@ pub fn persist_durable_function_invocation( } } - match payload585.unit { + match payload587.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload597) => { + Some(payload599) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr598 = mbt_ffi_str2ptr(payload597) - mbt_ffi_store32(iter_base + 72, payload597.length()) - mbt_ffi_store32(iter_base + 68, ptr598) - cleanup_list.push(ptr598) + let ptr600 = mbt_ffi_str2ptr(payload599) + mbt_ffi_store32(iter_base + 72, payload599.length()) + mbt_ffi_store32(iter_base + 68, ptr600) + cleanup_list.push(ptr600) () } @@ -4176,19 +4184,19 @@ pub fn persist_durable_function_invocation( () } - RecordType(payload601) => { + RecordType(payload603) => { mbt_ffi_store8(iter_base + 0, 14) - let address622 = mbt_ffi_malloc(payload601.length() * 68) - for index623 = 0 - index623 < payload601.length() - index623 = index623 + 1 { - let iter_elem : @types.NamedFieldType = payload601[index623] - let iter_base = address622 + index623 * 68 + let address624 = mbt_ffi_malloc(payload603.length() * 68) + for index625 = 0 + index625 < payload603.length() + index625 = index625 + 1 { + let iter_elem : @types.NamedFieldType = payload603[index625] + let iter_base = address624 + index625 * 68 - let ptr602 = mbt_ffi_str2ptr(iter_elem.name) + let ptr604 = mbt_ffi_str2ptr(iter_elem.name) mbt_ffi_store32(iter_base + 4, iter_elem.name.length()) - mbt_ffi_store32(iter_base + 0, ptr602) + mbt_ffi_store32(iter_base + 0, ptr604) mbt_ffi_store32(iter_base + 8, iter_elem.body) match iter_elem.metadata.doc { @@ -4197,51 +4205,51 @@ pub fn persist_durable_function_invocation( () } - Some(payload604) => { + Some(payload606) => { mbt_ffi_store8(iter_base + 12, 1) - let ptr605 = mbt_ffi_str2ptr(payload604) - mbt_ffi_store32(iter_base + 20, payload604.length()) - mbt_ffi_store32(iter_base + 16, ptr605) - cleanup_list.push(ptr605) + let ptr607 = mbt_ffi_str2ptr(payload606) + mbt_ffi_store32(iter_base + 20, payload606.length()) + mbt_ffi_store32(iter_base + 16, ptr607) + cleanup_list.push(ptr607) () } } - let address607 = mbt_ffi_malloc( + let address609 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index608 = 0 - index608 < iter_elem.metadata.aliases.length() - index608 = index608 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index608] - let iter_base = address607 + index608 * 8 + for index610 = 0 + index610 < iter_elem.metadata.aliases.length() + index610 = index610 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index610] + let iter_base = address609 + index610 * 8 - let ptr606 = mbt_ffi_str2ptr(iter_elem) + let ptr608 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr606) - cleanup_list.push(ptr606) + mbt_ffi_store32(iter_base + 0, ptr608) + cleanup_list.push(ptr608) } mbt_ffi_store32(iter_base + 28, iter_elem.metadata.aliases.length()) - mbt_ffi_store32(iter_base + 24, address607) + mbt_ffi_store32(iter_base + 24, address609) - let address610 = mbt_ffi_malloc( + let address612 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index611 = 0 - index611 < iter_elem.metadata.examples.length() - index611 = index611 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index611] - let iter_base = address610 + index611 * 8 + for index613 = 0 + index613 < iter_elem.metadata.examples.length() + index613 = index613 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index613] + let iter_base = address612 + index613 * 8 - let ptr609 = mbt_ffi_str2ptr(iter_elem) + let ptr611 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr609) - cleanup_list.push(ptr609) + mbt_ffi_store32(iter_base + 0, ptr611) + cleanup_list.push(ptr611) } mbt_ffi_store32(iter_base + 36, iter_elem.metadata.examples.length()) - mbt_ffi_store32(iter_base + 32, address610) + mbt_ffi_store32(iter_base + 32, address612) match iter_elem.metadata.deprecated { None => { @@ -4249,13 +4257,13 @@ pub fn persist_durable_function_invocation( () } - Some(payload613) => { + Some(payload615) => { mbt_ffi_store8(iter_base + 40, 1) - let ptr614 = mbt_ffi_str2ptr(payload613) - mbt_ffi_store32(iter_base + 48, payload613.length()) - mbt_ffi_store32(iter_base + 44, ptr614) - cleanup_list.push(ptr614) + let ptr616 = mbt_ffi_str2ptr(payload615) + mbt_ffi_store32(iter_base + 48, payload615.length()) + mbt_ffi_store32(iter_base + 44, ptr616) + cleanup_list.push(ptr616) () } @@ -4267,10 +4275,10 @@ pub fn persist_durable_function_invocation( () } - Some(payload616) => { + Some(payload618) => { mbt_ffi_store8(iter_base + 52, 1) - match payload616 { + match payload618 { Multimodal => { mbt_ffi_store8(iter_base + 56, 0) @@ -4286,13 +4294,13 @@ pub fn persist_durable_function_invocation( () } - Other(payload620) => { + Other(payload622) => { mbt_ffi_store8(iter_base + 56, 3) - let ptr621 = mbt_ffi_str2ptr(payload620) - mbt_ffi_store32(iter_base + 64, payload620.length()) - mbt_ffi_store32(iter_base + 60, ptr621) - cleanup_list.push(ptr621) + let ptr623 = mbt_ffi_str2ptr(payload622) + mbt_ffi_store32(iter_base + 64, payload622.length()) + mbt_ffi_store32(iter_base + 60, ptr623) + cleanup_list.push(ptr623) () } @@ -4301,29 +4309,29 @@ pub fn persist_durable_function_invocation( () } } - cleanup_list.push(ptr602) - cleanup_list.push(address607) - cleanup_list.push(address610) + cleanup_list.push(ptr604) + cleanup_list.push(address609) + cleanup_list.push(address612) } - mbt_ffi_store32(iter_base + 12, payload601.length()) - mbt_ffi_store32(iter_base + 8, address622) - cleanup_list.push(address622) + mbt_ffi_store32(iter_base + 12, payload603.length()) + mbt_ffi_store32(iter_base + 8, address624) + cleanup_list.push(address624) () } - VariantType(payload624) => { + VariantType(payload626) => { mbt_ffi_store8(iter_base + 0, 15) - let address647 = mbt_ffi_malloc(payload624.length() * 72) - for index648 = 0 - index648 < payload624.length() - index648 = index648 + 1 { - let iter_elem : @types.VariantCaseType = payload624[index648] - let iter_base = address647 + index648 * 72 + let address649 = mbt_ffi_malloc(payload626.length() * 72) + for index650 = 0 + index650 < payload626.length() + index650 = index650 + 1 { + let iter_elem : @types.VariantCaseType = payload626[index650] + let iter_base = address649 + index650 * 72 - let ptr625 = mbt_ffi_str2ptr(iter_elem.name) + let ptr627 = mbt_ffi_str2ptr(iter_elem.name) mbt_ffi_store32(iter_base + 4, iter_elem.name.length()) - mbt_ffi_store32(iter_base + 0, ptr625) + mbt_ffi_store32(iter_base + 0, ptr627) match iter_elem.payload { None => { @@ -4331,9 +4339,9 @@ pub fn persist_durable_function_invocation( () } - Some(payload627) => { + Some(payload629) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload627) + mbt_ffi_store32(iter_base + 12, payload629) () } @@ -4345,51 +4353,51 @@ pub fn persist_durable_function_invocation( () } - Some(payload629) => { + Some(payload631) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr630 = mbt_ffi_str2ptr(payload629) - mbt_ffi_store32(iter_base + 24, payload629.length()) - mbt_ffi_store32(iter_base + 20, ptr630) - cleanup_list.push(ptr630) + let ptr632 = mbt_ffi_str2ptr(payload631) + mbt_ffi_store32(iter_base + 24, payload631.length()) + mbt_ffi_store32(iter_base + 20, ptr632) + cleanup_list.push(ptr632) () } } - let address632 = mbt_ffi_malloc( + let address634 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index633 = 0 - index633 < iter_elem.metadata.aliases.length() - index633 = index633 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index633] - let iter_base = address632 + index633 * 8 + for index635 = 0 + index635 < iter_elem.metadata.aliases.length() + index635 = index635 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index635] + let iter_base = address634 + index635 * 8 - let ptr631 = mbt_ffi_str2ptr(iter_elem) + let ptr633 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr631) - cleanup_list.push(ptr631) + mbt_ffi_store32(iter_base + 0, ptr633) + cleanup_list.push(ptr633) } mbt_ffi_store32(iter_base + 32, iter_elem.metadata.aliases.length()) - mbt_ffi_store32(iter_base + 28, address632) + mbt_ffi_store32(iter_base + 28, address634) - let address635 = mbt_ffi_malloc( + let address637 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index636 = 0 - index636 < iter_elem.metadata.examples.length() - index636 = index636 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index636] - let iter_base = address635 + index636 * 8 + for index638 = 0 + index638 < iter_elem.metadata.examples.length() + index638 = index638 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index638] + let iter_base = address637 + index638 * 8 - let ptr634 = mbt_ffi_str2ptr(iter_elem) + let ptr636 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr634) - cleanup_list.push(ptr634) + mbt_ffi_store32(iter_base + 0, ptr636) + cleanup_list.push(ptr636) } mbt_ffi_store32(iter_base + 40, iter_elem.metadata.examples.length()) - mbt_ffi_store32(iter_base + 36, address635) + mbt_ffi_store32(iter_base + 36, address637) match iter_elem.metadata.deprecated { None => { @@ -4397,13 +4405,13 @@ pub fn persist_durable_function_invocation( () } - Some(payload638) => { + Some(payload640) => { mbt_ffi_store8(iter_base + 44, 1) - let ptr639 = mbt_ffi_str2ptr(payload638) - mbt_ffi_store32(iter_base + 52, payload638.length()) - mbt_ffi_store32(iter_base + 48, ptr639) - cleanup_list.push(ptr639) + let ptr641 = mbt_ffi_str2ptr(payload640) + mbt_ffi_store32(iter_base + 52, payload640.length()) + mbt_ffi_store32(iter_base + 48, ptr641) + cleanup_list.push(ptr641) () } @@ -4415,10 +4423,10 @@ pub fn persist_durable_function_invocation( () } - Some(payload641) => { + Some(payload643) => { mbt_ffi_store8(iter_base + 56, 1) - match payload641 { + match payload643 { Multimodal => { mbt_ffi_store8(iter_base + 60, 0) @@ -4434,13 +4442,13 @@ pub fn persist_durable_function_invocation( () } - Other(payload645) => { + Other(payload647) => { mbt_ffi_store8(iter_base + 60, 3) - let ptr646 = mbt_ffi_str2ptr(payload645) - mbt_ffi_store32(iter_base + 68, payload645.length()) - mbt_ffi_store32(iter_base + 64, ptr646) - cleanup_list.push(ptr646) + let ptr648 = mbt_ffi_str2ptr(payload647) + mbt_ffi_store32(iter_base + 68, payload647.length()) + mbt_ffi_store32(iter_base + 64, ptr648) + cleanup_list.push(ptr648) () } @@ -4449,127 +4457,127 @@ pub fn persist_durable_function_invocation( () } } - cleanup_list.push(ptr625) - cleanup_list.push(address632) - cleanup_list.push(address635) + cleanup_list.push(ptr627) + cleanup_list.push(address634) + cleanup_list.push(address637) } - mbt_ffi_store32(iter_base + 12, payload624.length()) - mbt_ffi_store32(iter_base + 8, address647) - cleanup_list.push(address647) + mbt_ffi_store32(iter_base + 12, payload626.length()) + mbt_ffi_store32(iter_base + 8, address649) + cleanup_list.push(address649) () } - EnumType(payload649) => { + EnumType(payload651) => { mbt_ffi_store8(iter_base + 0, 16) - let address651 = mbt_ffi_malloc(payload649.length() * 8) - for index652 = 0 - index652 < payload649.length() - index652 = index652 + 1 { - let iter_elem : String = payload649[index652] - let iter_base = address651 + index652 * 8 + let address653 = mbt_ffi_malloc(payload651.length() * 8) + for index654 = 0 + index654 < payload651.length() + index654 = index654 + 1 { + let iter_elem : String = payload651[index654] + let iter_base = address653 + index654 * 8 - let ptr650 = mbt_ffi_str2ptr(iter_elem) + let ptr652 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr650) - cleanup_list.push(ptr650) + mbt_ffi_store32(iter_base + 0, ptr652) + cleanup_list.push(ptr652) } - mbt_ffi_store32(iter_base + 12, payload649.length()) - mbt_ffi_store32(iter_base + 8, address651) - cleanup_list.push(address651) + mbt_ffi_store32(iter_base + 12, payload651.length()) + mbt_ffi_store32(iter_base + 8, address653) + cleanup_list.push(address653) () } - FlagsType(payload653) => { + FlagsType(payload655) => { mbt_ffi_store8(iter_base + 0, 17) - let address655 = mbt_ffi_malloc(payload653.length() * 8) - for index656 = 0 - index656 < payload653.length() - index656 = index656 + 1 { - let iter_elem : String = payload653[index656] - let iter_base = address655 + index656 * 8 + let address657 = mbt_ffi_malloc(payload655.length() * 8) + for index658 = 0 + index658 < payload655.length() + index658 = index658 + 1 { + let iter_elem : String = payload655[index658] + let iter_base = address657 + index658 * 8 - let ptr654 = mbt_ffi_str2ptr(iter_elem) + let ptr656 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr654) - cleanup_list.push(ptr654) + mbt_ffi_store32(iter_base + 0, ptr656) + cleanup_list.push(ptr656) } - mbt_ffi_store32(iter_base + 12, payload653.length()) - mbt_ffi_store32(iter_base + 8, address655) - cleanup_list.push(address655) + mbt_ffi_store32(iter_base + 12, payload655.length()) + mbt_ffi_store32(iter_base + 8, address657) + cleanup_list.push(address657) () } - TupleType(payload657) => { + TupleType(payload659) => { mbt_ffi_store8(iter_base + 0, 18) - let address658 = mbt_ffi_malloc(payload657.length() * 4) - for index659 = 0 - index659 < payload657.length() - index659 = index659 + 1 { - let iter_elem : Int = payload657[index659] - let iter_base = address658 + index659 * 4 + let address660 = mbt_ffi_malloc(payload659.length() * 4) + for index661 = 0 + index661 < payload659.length() + index661 = index661 + 1 { + let iter_elem : Int = payload659[index661] + let iter_base = address660 + index661 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload657.length()) - mbt_ffi_store32(iter_base + 8, address658) - cleanup_list.push(address658) + mbt_ffi_store32(iter_base + 12, payload659.length()) + mbt_ffi_store32(iter_base + 8, address660) + cleanup_list.push(address660) () } - ListType(payload660) => { + ListType(payload662) => { mbt_ffi_store8(iter_base + 0, 19) - mbt_ffi_store32(iter_base + 8, payload660) + mbt_ffi_store32(iter_base + 8, payload662) () } - FixedListType(payload661) => { + FixedListType(payload663) => { mbt_ffi_store8(iter_base + 0, 20) - mbt_ffi_store32(iter_base + 8, payload661.element) - mbt_ffi_store32(iter_base + 12, payload661.length.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 8, payload663.element) + mbt_ffi_store32(iter_base + 12, payload663.length.reinterpret_as_int()) () } - MapType(payload662) => { + MapType(payload664) => { mbt_ffi_store8(iter_base + 0, 21) - mbt_ffi_store32(iter_base + 8, payload662.key) - mbt_ffi_store32(iter_base + 12, payload662.value) + mbt_ffi_store32(iter_base + 8, payload664.key) + mbt_ffi_store32(iter_base + 12, payload664.value) () } - OptionType(payload663) => { + OptionType(payload665) => { mbt_ffi_store8(iter_base + 0, 22) - mbt_ffi_store32(iter_base + 8, payload663) + mbt_ffi_store32(iter_base + 8, payload665) () } - ResultType(payload664) => { + ResultType(payload666) => { mbt_ffi_store8(iter_base + 0, 23) - match payload664.ok { + match payload666.ok { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload666) => { + Some(payload668) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload666) + mbt_ffi_store32(iter_base + 12, payload668) () } } - match payload664.err { + match payload666.err { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload668) => { + Some(payload670) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store32(iter_base + 20, payload668) + mbt_ffi_store32(iter_base + 20, payload670) () } @@ -4577,79 +4585,79 @@ pub fn persist_durable_function_invocation( () } - TextType(payload669) => { + TextType(payload671) => { mbt_ffi_store8(iter_base + 0, 24) - match payload669.languages { + match payload671.languages { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload671) => { + Some(payload673) => { mbt_ffi_store8(iter_base + 8, 1) - let address673 = mbt_ffi_malloc(payload671.length() * 8) - for index674 = 0 - index674 < payload671.length() - index674 = index674 + 1 { - let iter_elem : String = payload671[index674] - let iter_base = address673 + index674 * 8 + let address675 = mbt_ffi_malloc(payload673.length() * 8) + for index676 = 0 + index676 < payload673.length() + index676 = index676 + 1 { + let iter_elem : String = payload673[index676] + let iter_base = address675 + index676 * 8 - let ptr672 = mbt_ffi_str2ptr(iter_elem) + let ptr674 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr672) - cleanup_list.push(ptr672) + mbt_ffi_store32(iter_base + 0, ptr674) + cleanup_list.push(ptr674) } - mbt_ffi_store32(iter_base + 16, payload671.length()) - mbt_ffi_store32(iter_base + 12, address673) - cleanup_list.push(address673) + mbt_ffi_store32(iter_base + 16, payload673.length()) + mbt_ffi_store32(iter_base + 12, address675) + cleanup_list.push(address675) () } } - match payload669.min_length { + match payload671.min_length { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload676) => { + Some(payload678) => { mbt_ffi_store8(iter_base + 20, 1) - mbt_ffi_store32(iter_base + 24, payload676.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 24, payload678.reinterpret_as_int()) () } } - match payload669.max_length { + match payload671.max_length { None => { mbt_ffi_store8(iter_base + 28, 0) () } - Some(payload678) => { + Some(payload680) => { mbt_ffi_store8(iter_base + 28, 1) - mbt_ffi_store32(iter_base + 32, payload678.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 32, payload680.reinterpret_as_int()) () } } - match payload669.regex { + match payload671.regex { None => { mbt_ffi_store8(iter_base + 36, 0) () } - Some(payload680) => { + Some(payload682) => { mbt_ffi_store8(iter_base + 36, 1) - let ptr681 = mbt_ffi_str2ptr(payload680) - mbt_ffi_store32(iter_base + 44, payload680.length()) - mbt_ffi_store32(iter_base + 40, ptr681) - cleanup_list.push(ptr681) + let ptr683 = mbt_ffi_str2ptr(payload682) + mbt_ffi_store32(iter_base + 44, payload682.length()) + mbt_ffi_store32(iter_base + 40, ptr683) + cleanup_list.push(ptr683) () } @@ -4657,61 +4665,61 @@ pub fn persist_durable_function_invocation( () } - BinaryType(payload682) => { + BinaryType(payload684) => { mbt_ffi_store8(iter_base + 0, 25) - match payload682.mime_types { + match payload684.mime_types { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload684) => { + Some(payload686) => { mbt_ffi_store8(iter_base + 8, 1) - let address686 = mbt_ffi_malloc(payload684.length() * 8) - for index687 = 0 - index687 < payload684.length() - index687 = index687 + 1 { - let iter_elem : String = payload684[index687] - let iter_base = address686 + index687 * 8 + let address688 = mbt_ffi_malloc(payload686.length() * 8) + for index689 = 0 + index689 < payload686.length() + index689 = index689 + 1 { + let iter_elem : String = payload686[index689] + let iter_base = address688 + index689 * 8 - let ptr685 = mbt_ffi_str2ptr(iter_elem) + let ptr687 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr685) - cleanup_list.push(ptr685) + mbt_ffi_store32(iter_base + 0, ptr687) + cleanup_list.push(ptr687) } - mbt_ffi_store32(iter_base + 16, payload684.length()) - mbt_ffi_store32(iter_base + 12, address686) - cleanup_list.push(address686) + mbt_ffi_store32(iter_base + 16, payload686.length()) + mbt_ffi_store32(iter_base + 12, address688) + cleanup_list.push(address688) () } } - match payload682.min_bytes { + match payload684.min_bytes { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload689) => { + Some(payload691) => { mbt_ffi_store8(iter_base + 20, 1) - mbt_ffi_store32(iter_base + 24, payload689.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 24, payload691.reinterpret_as_int()) () } } - match payload682.max_bytes { + match payload684.max_bytes { None => { mbt_ffi_store8(iter_base + 28, 0) () } - Some(payload691) => { + Some(payload693) => { mbt_ffi_store8(iter_base + 28, 1) - mbt_ffi_store32(iter_base + 32, payload691.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 32, payload693.reinterpret_as_int()) () } @@ -4719,64 +4727,64 @@ pub fn persist_durable_function_invocation( () } - PathType(payload692) => { + PathType(payload694) => { mbt_ffi_store8(iter_base + 0, 26) - mbt_ffi_store8(iter_base + 8, payload692.direction.ordinal()) - mbt_ffi_store8(iter_base + 9, payload692.kind.ordinal()) + mbt_ffi_store8(iter_base + 8, payload694.direction.ordinal()) + mbt_ffi_store8(iter_base + 9, payload694.kind.ordinal()) - match payload692.allowed_mime_types { + match payload694.allowed_mime_types { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload694) => { + Some(payload696) => { mbt_ffi_store8(iter_base + 12, 1) - let address696 = mbt_ffi_malloc(payload694.length() * 8) - for index697 = 0 - index697 < payload694.length() - index697 = index697 + 1 { - let iter_elem : String = payload694[index697] - let iter_base = address696 + index697 * 8 + let address698 = mbt_ffi_malloc(payload696.length() * 8) + for index699 = 0 + index699 < payload696.length() + index699 = index699 + 1 { + let iter_elem : String = payload696[index699] + let iter_base = address698 + index699 * 8 - let ptr695 = mbt_ffi_str2ptr(iter_elem) + let ptr697 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr695) - cleanup_list.push(ptr695) + mbt_ffi_store32(iter_base + 0, ptr697) + cleanup_list.push(ptr697) } - mbt_ffi_store32(iter_base + 20, payload694.length()) - mbt_ffi_store32(iter_base + 16, address696) - cleanup_list.push(address696) + mbt_ffi_store32(iter_base + 20, payload696.length()) + mbt_ffi_store32(iter_base + 16, address698) + cleanup_list.push(address698) () } } - match payload692.allowed_extensions { + match payload694.allowed_extensions { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload699) => { + Some(payload701) => { mbt_ffi_store8(iter_base + 24, 1) - let address701 = mbt_ffi_malloc(payload699.length() * 8) - for index702 = 0 - index702 < payload699.length() - index702 = index702 + 1 { - let iter_elem : String = payload699[index702] - let iter_base = address701 + index702 * 8 + let address703 = mbt_ffi_malloc(payload701.length() * 8) + for index704 = 0 + index704 < payload701.length() + index704 = index704 + 1 { + let iter_elem : String = payload701[index704] + let iter_base = address703 + index704 * 8 - let ptr700 = mbt_ffi_str2ptr(iter_elem) + let ptr702 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr700) - cleanup_list.push(ptr700) + mbt_ffi_store32(iter_base + 0, ptr702) + cleanup_list.push(ptr702) } - mbt_ffi_store32(iter_base + 32, payload699.length()) - mbt_ffi_store32(iter_base + 28, address701) - cleanup_list.push(address701) + mbt_ffi_store32(iter_base + 32, payload701.length()) + mbt_ffi_store32(iter_base + 28, address703) + cleanup_list.push(address703) () } @@ -4784,62 +4792,62 @@ pub fn persist_durable_function_invocation( () } - UrlType(payload703) => { + UrlType(payload705) => { mbt_ffi_store8(iter_base + 0, 27) - match payload703.allowed_schemes { + match payload705.allowed_schemes { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload705) => { + Some(payload707) => { mbt_ffi_store8(iter_base + 8, 1) - let address707 = mbt_ffi_malloc(payload705.length() * 8) - for index708 = 0 - index708 < payload705.length() - index708 = index708 + 1 { - let iter_elem : String = payload705[index708] - let iter_base = address707 + index708 * 8 + let address709 = mbt_ffi_malloc(payload707.length() * 8) + for index710 = 0 + index710 < payload707.length() + index710 = index710 + 1 { + let iter_elem : String = payload707[index710] + let iter_base = address709 + index710 * 8 - let ptr706 = mbt_ffi_str2ptr(iter_elem) + let ptr708 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr706) - cleanup_list.push(ptr706) + mbt_ffi_store32(iter_base + 0, ptr708) + cleanup_list.push(ptr708) } - mbt_ffi_store32(iter_base + 16, payload705.length()) - mbt_ffi_store32(iter_base + 12, address707) - cleanup_list.push(address707) + mbt_ffi_store32(iter_base + 16, payload707.length()) + mbt_ffi_store32(iter_base + 12, address709) + cleanup_list.push(address709) () } } - match payload703.allowed_hosts { + match payload705.allowed_hosts { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload710) => { + Some(payload712) => { mbt_ffi_store8(iter_base + 20, 1) - let address712 = mbt_ffi_malloc(payload710.length() * 8) - for index713 = 0 - index713 < payload710.length() - index713 = index713 + 1 { - let iter_elem : String = payload710[index713] - let iter_base = address712 + index713 * 8 + let address714 = mbt_ffi_malloc(payload712.length() * 8) + for index715 = 0 + index715 < payload712.length() + index715 = index715 + 1 { + let iter_elem : String = payload712[index715] + let iter_base = address714 + index715 * 8 - let ptr711 = mbt_ffi_str2ptr(iter_elem) + let ptr713 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr711) - cleanup_list.push(ptr711) + mbt_ffi_store32(iter_base + 0, ptr713) + cleanup_list.push(ptr713) } - mbt_ffi_store32(iter_base + 28, payload710.length()) - mbt_ffi_store32(iter_base + 24, address712) - cleanup_list.push(address712) + mbt_ffi_store32(iter_base + 28, payload712.length()) + mbt_ffi_store32(iter_base + 24, address714) + cleanup_list.push(address714) () } @@ -4857,103 +4865,93 @@ pub fn persist_durable_function_invocation( () } - QuantityType(payload716) => { + QuantityType(payload718) => { mbt_ffi_store8(iter_base + 0, 30) - let ptr717 = mbt_ffi_str2ptr(payload716.base_unit) - mbt_ffi_store32(iter_base + 12, payload716.base_unit.length()) - mbt_ffi_store32(iter_base + 8, ptr717) + let ptr719 = mbt_ffi_str2ptr(payload718.base_unit) + mbt_ffi_store32(iter_base + 12, payload718.base_unit.length()) + mbt_ffi_store32(iter_base + 8, ptr719) - let address719 = mbt_ffi_malloc( - payload716.allowed_suffixes.length() * 8, + let address721 = mbt_ffi_malloc( + payload718.allowed_suffixes.length() * 8, ) - for index720 = 0 - index720 < payload716.allowed_suffixes.length() - index720 = index720 + 1 { - let iter_elem : String = payload716.allowed_suffixes[index720] - let iter_base = address719 + index720 * 8 + for index722 = 0 + index722 < payload718.allowed_suffixes.length() + index722 = index722 + 1 { + let iter_elem : String = payload718.allowed_suffixes[index722] + let iter_base = address721 + index722 * 8 - let ptr718 = mbt_ffi_str2ptr(iter_elem) + let ptr720 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr718) - cleanup_list.push(ptr718) + mbt_ffi_store32(iter_base + 0, ptr720) + cleanup_list.push(ptr720) } - mbt_ffi_store32(iter_base + 20, payload716.allowed_suffixes.length()) - mbt_ffi_store32(iter_base + 16, address719) + mbt_ffi_store32(iter_base + 20, payload718.allowed_suffixes.length()) + mbt_ffi_store32(iter_base + 16, address721) - match payload716.min { + match payload718.min { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload722) => { + Some(payload724) => { mbt_ffi_store8(iter_base + 24, 1) - mbt_ffi_store64(iter_base + 32, payload722.mantissa) - mbt_ffi_store32(iter_base + 40, payload722.scale) + mbt_ffi_store64(iter_base + 32, payload724.mantissa) + mbt_ffi_store32(iter_base + 40, payload724.scale) - let ptr723 = mbt_ffi_str2ptr(payload722.unit) - mbt_ffi_store32(iter_base + 48, payload722.unit.length()) - mbt_ffi_store32(iter_base + 44, ptr723) - cleanup_list.push(ptr723) + let ptr725 = mbt_ffi_str2ptr(payload724.unit) + mbt_ffi_store32(iter_base + 48, payload724.unit.length()) + mbt_ffi_store32(iter_base + 44, ptr725) + cleanup_list.push(ptr725) () } } - match payload716.max { + match payload718.max { None => { mbt_ffi_store8(iter_base + 56, 0) () } - Some(payload725) => { + Some(payload727) => { mbt_ffi_store8(iter_base + 56, 1) - mbt_ffi_store64(iter_base + 64, payload725.mantissa) - mbt_ffi_store32(iter_base + 72, payload725.scale) + mbt_ffi_store64(iter_base + 64, payload727.mantissa) + mbt_ffi_store32(iter_base + 72, payload727.scale) - let ptr726 = mbt_ffi_str2ptr(payload725.unit) - mbt_ffi_store32(iter_base + 80, payload725.unit.length()) - mbt_ffi_store32(iter_base + 76, ptr726) - cleanup_list.push(ptr726) + let ptr728 = mbt_ffi_str2ptr(payload727.unit) + mbt_ffi_store32(iter_base + 80, payload727.unit.length()) + mbt_ffi_store32(iter_base + 76, ptr728) + cleanup_list.push(ptr728) () } } - cleanup_list.push(ptr717) - cleanup_list.push(address719) + cleanup_list.push(ptr719) + cleanup_list.push(address721) () } - UnionType(payload727) => { + UnionType(payload729) => { mbt_ffi_store8(iter_base + 0, 31) - let address763 = mbt_ffi_malloc(payload727.branches.length() * 92) - for index764 = 0 - index764 < payload727.branches.length() - index764 = index764 + 1 { - let iter_elem : @types.UnionBranch = payload727.branches[index764] - let iter_base = address763 + index764 * 92 + let address765 = mbt_ffi_malloc(payload729.branches.length() * 92) + for index766 = 0 + index766 < payload729.branches.length() + index766 = index766 + 1 { + let iter_elem : @types.UnionBranch = payload729.branches[index766] + let iter_base = address765 + index766 * 92 - let ptr728 = mbt_ffi_str2ptr(iter_elem.tag) + let ptr730 = mbt_ffi_str2ptr(iter_elem.tag) mbt_ffi_store32(iter_base + 4, iter_elem.tag.length()) - mbt_ffi_store32(iter_base + 0, ptr728) + mbt_ffi_store32(iter_base + 0, ptr730) mbt_ffi_store32(iter_base + 8, iter_elem.body) match iter_elem.discriminator { - Prefix(payload729) => { + Prefix(payload731) => { mbt_ffi_store8(iter_base + 12, 0) - let ptr730 = mbt_ffi_str2ptr(payload729) - mbt_ffi_store32(iter_base + 20, payload729.length()) - mbt_ffi_store32(iter_base + 16, ptr730) - cleanup_list.push(ptr730) - - () - } - Suffix(payload731) => { - mbt_ffi_store8(iter_base + 12, 1) - let ptr732 = mbt_ffi_str2ptr(payload731) mbt_ffi_store32(iter_base + 20, payload731.length()) mbt_ffi_store32(iter_base + 16, ptr732) @@ -4961,8 +4959,8 @@ pub fn persist_durable_function_invocation( () } - Contains(payload733) => { - mbt_ffi_store8(iter_base + 12, 2) + Suffix(payload733) => { + mbt_ffi_store8(iter_base + 12, 1) let ptr734 = mbt_ffi_str2ptr(payload733) mbt_ffi_store32(iter_base + 20, payload733.length()) @@ -4971,8 +4969,8 @@ pub fn persist_durable_function_invocation( () } - Regex(payload735) => { - mbt_ffi_store8(iter_base + 12, 3) + Contains(payload735) => { + mbt_ffi_store8(iter_base + 12, 2) let ptr736 = mbt_ffi_str2ptr(payload735) mbt_ffi_store32(iter_base + 20, payload735.length()) @@ -4981,41 +4979,51 @@ pub fn persist_durable_function_invocation( () } - FieldEquals(payload737) => { - mbt_ffi_store8(iter_base + 12, 4) + Regex(payload737) => { + mbt_ffi_store8(iter_base + 12, 3) - let ptr738 = mbt_ffi_str2ptr(payload737.field_name) - mbt_ffi_store32(iter_base + 20, payload737.field_name.length()) + let ptr738 = mbt_ffi_str2ptr(payload737) + mbt_ffi_store32(iter_base + 20, payload737.length()) mbt_ffi_store32(iter_base + 16, ptr738) + cleanup_list.push(ptr738) - match payload737.literal { + () + } + FieldEquals(payload739) => { + mbt_ffi_store8(iter_base + 12, 4) + + let ptr740 = mbt_ffi_str2ptr(payload739.field_name) + mbt_ffi_store32(iter_base + 20, payload739.field_name.length()) + mbt_ffi_store32(iter_base + 16, ptr740) + + match payload739.literal { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload740) => { + Some(payload742) => { mbt_ffi_store8(iter_base + 24, 1) - let ptr741 = mbt_ffi_str2ptr(payload740) - mbt_ffi_store32(iter_base + 32, payload740.length()) - mbt_ffi_store32(iter_base + 28, ptr741) - cleanup_list.push(ptr741) + let ptr743 = mbt_ffi_str2ptr(payload742) + mbt_ffi_store32(iter_base + 32, payload742.length()) + mbt_ffi_store32(iter_base + 28, ptr743) + cleanup_list.push(ptr743) () } } - cleanup_list.push(ptr738) + cleanup_list.push(ptr740) () } - FieldAbsent(payload742) => { + FieldAbsent(payload744) => { mbt_ffi_store8(iter_base + 12, 5) - let ptr743 = mbt_ffi_str2ptr(payload742) - mbt_ffi_store32(iter_base + 20, payload742.length()) - mbt_ffi_store32(iter_base + 16, ptr743) - cleanup_list.push(ptr743) + let ptr745 = mbt_ffi_str2ptr(payload744) + mbt_ffi_store32(iter_base + 20, payload744.length()) + mbt_ffi_store32(iter_base + 16, ptr745) + cleanup_list.push(ptr745) () } @@ -5027,51 +5035,51 @@ pub fn persist_durable_function_invocation( () } - Some(payload745) => { + Some(payload747) => { mbt_ffi_store8(iter_base + 36, 1) - let ptr746 = mbt_ffi_str2ptr(payload745) - mbt_ffi_store32(iter_base + 44, payload745.length()) - mbt_ffi_store32(iter_base + 40, ptr746) - cleanup_list.push(ptr746) + let ptr748 = mbt_ffi_str2ptr(payload747) + mbt_ffi_store32(iter_base + 44, payload747.length()) + mbt_ffi_store32(iter_base + 40, ptr748) + cleanup_list.push(ptr748) () } } - let address748 = mbt_ffi_malloc( + let address750 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index749 = 0 - index749 < iter_elem.metadata.aliases.length() - index749 = index749 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index749] - let iter_base = address748 + index749 * 8 + for index751 = 0 + index751 < iter_elem.metadata.aliases.length() + index751 = index751 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index751] + let iter_base = address750 + index751 * 8 - let ptr747 = mbt_ffi_str2ptr(iter_elem) + let ptr749 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr747) - cleanup_list.push(ptr747) + mbt_ffi_store32(iter_base + 0, ptr749) + cleanup_list.push(ptr749) } mbt_ffi_store32(iter_base + 52, iter_elem.metadata.aliases.length()) - mbt_ffi_store32(iter_base + 48, address748) + mbt_ffi_store32(iter_base + 48, address750) - let address751 = mbt_ffi_malloc( + let address753 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index752 = 0 - index752 < iter_elem.metadata.examples.length() - index752 = index752 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index752] - let iter_base = address751 + index752 * 8 + for index754 = 0 + index754 < iter_elem.metadata.examples.length() + index754 = index754 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index754] + let iter_base = address753 + index754 * 8 - let ptr750 = mbt_ffi_str2ptr(iter_elem) + let ptr752 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr750) - cleanup_list.push(ptr750) + mbt_ffi_store32(iter_base + 0, ptr752) + cleanup_list.push(ptr752) } mbt_ffi_store32(iter_base + 60, iter_elem.metadata.examples.length()) - mbt_ffi_store32(iter_base + 56, address751) + mbt_ffi_store32(iter_base + 56, address753) match iter_elem.metadata.deprecated { None => { @@ -5079,13 +5087,13 @@ pub fn persist_durable_function_invocation( () } - Some(payload754) => { + Some(payload756) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr755 = mbt_ffi_str2ptr(payload754) - mbt_ffi_store32(iter_base + 72, payload754.length()) - mbt_ffi_store32(iter_base + 68, ptr755) - cleanup_list.push(ptr755) + let ptr757 = mbt_ffi_str2ptr(payload756) + mbt_ffi_store32(iter_base + 72, payload756.length()) + mbt_ffi_store32(iter_base + 68, ptr757) + cleanup_list.push(ptr757) () } @@ -5097,10 +5105,10 @@ pub fn persist_durable_function_invocation( () } - Some(payload757) => { + Some(payload759) => { mbt_ffi_store8(iter_base + 76, 1) - match payload757 { + match payload759 { Multimodal => { mbt_ffi_store8(iter_base + 80, 0) @@ -5116,13 +5124,13 @@ pub fn persist_durable_function_invocation( () } - Other(payload761) => { + Other(payload763) => { mbt_ffi_store8(iter_base + 80, 3) - let ptr762 = mbt_ffi_str2ptr(payload761) - mbt_ffi_store32(iter_base + 88, payload761.length()) - mbt_ffi_store32(iter_base + 84, ptr762) - cleanup_list.push(ptr762) + let ptr764 = mbt_ffi_str2ptr(payload763) + mbt_ffi_store32(iter_base + 88, payload763.length()) + mbt_ffi_store32(iter_base + 84, ptr764) + cleanup_list.push(ptr764) () } @@ -5131,33 +5139,33 @@ pub fn persist_durable_function_invocation( () } } - cleanup_list.push(ptr728) - cleanup_list.push(address748) - cleanup_list.push(address751) + cleanup_list.push(ptr730) + cleanup_list.push(address750) + cleanup_list.push(address753) } - mbt_ffi_store32(iter_base + 12, payload727.branches.length()) - mbt_ffi_store32(iter_base + 8, address763) - cleanup_list.push(address763) + mbt_ffi_store32(iter_base + 12, payload729.branches.length()) + mbt_ffi_store32(iter_base + 8, address765) + cleanup_list.push(address765) () } - SecretType(payload765) => { + SecretType(payload767) => { mbt_ffi_store8(iter_base + 0, 32) - mbt_ffi_store32(iter_base + 8, payload765.inner) + mbt_ffi_store32(iter_base + 8, payload767.inner) - match payload765.category { + match payload767.category { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload767) => { + Some(payload769) => { mbt_ffi_store8(iter_base + 12, 1) - let ptr768 = mbt_ffi_str2ptr(payload767) - mbt_ffi_store32(iter_base + 20, payload767.length()) - mbt_ffi_store32(iter_base + 16, ptr768) - cleanup_list.push(ptr768) + let ptr770 = mbt_ffi_str2ptr(payload769) + mbt_ffi_store32(iter_base + 20, payload769.length()) + mbt_ffi_store32(iter_base + 16, ptr770) + cleanup_list.push(ptr770) () } @@ -5165,22 +5173,22 @@ pub fn persist_durable_function_invocation( () } - QuotaTokenType(payload769) => { + QuotaTokenType(payload771) => { mbt_ffi_store8(iter_base + 0, 33) - match payload769.resource_name { + match payload771.resource_name { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload771) => { + Some(payload773) => { mbt_ffi_store8(iter_base + 8, 1) - let ptr772 = mbt_ffi_str2ptr(payload771) - mbt_ffi_store32(iter_base + 16, payload771.length()) - mbt_ffi_store32(iter_base + 12, ptr772) - cleanup_list.push(ptr772) + let ptr774 = mbt_ffi_str2ptr(payload773) + mbt_ffi_store32(iter_base + 16, payload773.length()) + mbt_ffi_store32(iter_base + 12, ptr774) + cleanup_list.push(ptr774) () } @@ -5188,18 +5196,18 @@ pub fn persist_durable_function_invocation( () } - FutureType(payload773) => { + FutureType(payload775) => { mbt_ffi_store8(iter_base + 0, 34) - match payload773 { + match payload775 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload775) => { + Some(payload777) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload775) + mbt_ffi_store32(iter_base + 12, payload777) () } @@ -5207,18 +5215,18 @@ pub fn persist_durable_function_invocation( () } - StreamType(payload776) => { + StreamType(payload778) => { mbt_ffi_store8(iter_base + 0, 35) - match payload776 { + match payload778 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload778) => { + Some(payload780) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload778) + mbt_ffi_store32(iter_base + 12, payload780) () } @@ -5234,47 +5242,47 @@ pub fn persist_durable_function_invocation( () } - Some(payload780) => { + Some(payload782) => { mbt_ffi_store8(iter_base + 88, 1) - let ptr781 = mbt_ffi_str2ptr(payload780) - mbt_ffi_store32(iter_base + 96, payload780.length()) - mbt_ffi_store32(iter_base + 92, ptr781) - cleanup_list.push(ptr781) + let ptr783 = mbt_ffi_str2ptr(payload782) + mbt_ffi_store32(iter_base + 96, payload782.length()) + mbt_ffi_store32(iter_base + 92, ptr783) + cleanup_list.push(ptr783) () } } - let address783 = mbt_ffi_malloc(iter_elem.metadata.aliases.length() * 8) - for index784 = 0 - index784 < iter_elem.metadata.aliases.length() - index784 = index784 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index784] - let iter_base = address783 + index784 * 8 + let address785 = mbt_ffi_malloc(iter_elem.metadata.aliases.length() * 8) + for index786 = 0 + index786 < iter_elem.metadata.aliases.length() + index786 = index786 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index786] + let iter_base = address785 + index786 * 8 - let ptr782 = mbt_ffi_str2ptr(iter_elem) + let ptr784 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr782) - cleanup_list.push(ptr782) + mbt_ffi_store32(iter_base + 0, ptr784) + cleanup_list.push(ptr784) } mbt_ffi_store32(iter_base + 104, iter_elem.metadata.aliases.length()) - mbt_ffi_store32(iter_base + 100, address783) + mbt_ffi_store32(iter_base + 100, address785) - let address786 = mbt_ffi_malloc(iter_elem.metadata.examples.length() * 8) - for index787 = 0 - index787 < iter_elem.metadata.examples.length() - index787 = index787 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index787] - let iter_base = address786 + index787 * 8 + let address788 = mbt_ffi_malloc(iter_elem.metadata.examples.length() * 8) + for index789 = 0 + index789 < iter_elem.metadata.examples.length() + index789 = index789 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index789] + let iter_base = address788 + index789 * 8 - let ptr785 = mbt_ffi_str2ptr(iter_elem) + let ptr787 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr785) - cleanup_list.push(ptr785) + mbt_ffi_store32(iter_base + 0, ptr787) + cleanup_list.push(ptr787) } mbt_ffi_store32(iter_base + 112, iter_elem.metadata.examples.length()) - mbt_ffi_store32(iter_base + 108, address786) + mbt_ffi_store32(iter_base + 108, address788) match iter_elem.metadata.deprecated { None => { @@ -5282,13 +5290,13 @@ pub fn persist_durable_function_invocation( () } - Some(payload789) => { + Some(payload791) => { mbt_ffi_store8(iter_base + 116, 1) - let ptr790 = mbt_ffi_str2ptr(payload789) - mbt_ffi_store32(iter_base + 124, payload789.length()) - mbt_ffi_store32(iter_base + 120, ptr790) - cleanup_list.push(ptr790) + let ptr792 = mbt_ffi_str2ptr(payload791) + mbt_ffi_store32(iter_base + 124, payload791.length()) + mbt_ffi_store32(iter_base + 120, ptr792) + cleanup_list.push(ptr792) () } @@ -5300,10 +5308,10 @@ pub fn persist_durable_function_invocation( () } - Some(payload792) => { + Some(payload794) => { mbt_ffi_store8(iter_base + 128, 1) - match payload792 { + match payload794 { Multimodal => { mbt_ffi_store8(iter_base + 132, 0) @@ -5319,13 +5327,13 @@ pub fn persist_durable_function_invocation( () } - Other(payload796) => { + Other(payload798) => { mbt_ffi_store8(iter_base + 132, 3) - let ptr797 = mbt_ffi_str2ptr(payload796) - mbt_ffi_store32(iter_base + 140, payload796.length()) - mbt_ffi_store32(iter_base + 136, ptr797) - cleanup_list.push(ptr797) + let ptr799 = mbt_ffi_str2ptr(payload798) + mbt_ffi_store32(iter_base + 140, payload798.length()) + mbt_ffi_store32(iter_base + 136, ptr799) + cleanup_list.push(ptr799) () } @@ -5334,22 +5342,22 @@ pub fn persist_durable_function_invocation( () } } - cleanup_list.push(address783) - cleanup_list.push(address786) + cleanup_list.push(address785) + cleanup_list.push(address788) } mbt_ffi_store32(return_area + 44, response.graph.type_nodes.length()) - mbt_ffi_store32(return_area + 40, address798) + mbt_ffi_store32(return_area + 40, address800) - let address804 = mbt_ffi_malloc(response.graph.defs.length() * 24) - for index805 = 0 - index805 < response.graph.defs.length() - index805 = index805 + 1 { - let iter_elem : @types.SchemaTypeDef = response.graph.defs[index805] - let iter_base = address804 + index805 * 24 + let address806 = mbt_ffi_malloc(response.graph.defs.length() * 24) + for index807 = 0 + index807 < response.graph.defs.length() + index807 = index807 + 1 { + let iter_elem : @types.SchemaTypeDef = response.graph.defs[index807] + let iter_base = address806 + index807 * 24 - let ptr800 = mbt_ffi_str2ptr(iter_elem.id) + let ptr802 = mbt_ffi_str2ptr(iter_elem.id) mbt_ffi_store32(iter_base + 4, iter_elem.id.length()) - mbt_ffi_store32(iter_base + 0, ptr800) + mbt_ffi_store32(iter_base + 0, ptr802) match iter_elem.name { None => { @@ -5357,144 +5365,144 @@ pub fn persist_durable_function_invocation( () } - Some(payload802) => { + Some(payload804) => { mbt_ffi_store8(iter_base + 8, 1) - let ptr803 = mbt_ffi_str2ptr(payload802) - mbt_ffi_store32(iter_base + 16, payload802.length()) - mbt_ffi_store32(iter_base + 12, ptr803) - cleanup_list.push(ptr803) + let ptr805 = mbt_ffi_str2ptr(payload804) + mbt_ffi_store32(iter_base + 16, payload804.length()) + mbt_ffi_store32(iter_base + 12, ptr805) + cleanup_list.push(ptr805) () } } mbt_ffi_store32(iter_base + 20, iter_elem.body) - cleanup_list.push(ptr800) + cleanup_list.push(ptr802) } mbt_ffi_store32(return_area + 52, response.graph.defs.length()) - mbt_ffi_store32(return_area + 48, address804) + mbt_ffi_store32(return_area + 48, address806) mbt_ffi_store32(return_area + 56, response.graph.root) - let address876 = mbt_ffi_malloc(response.value.value_nodes.length() * 32) - for index877 = 0 - index877 < response.value.value_nodes.length() - index877 = index877 + 1 { - let iter_elem : @types.SchemaValueNode = response.value.value_nodes[index877] - let iter_base = address876 + index877 * 32 + let address880 = mbt_ffi_malloc(response.value.value_nodes.length() * 32) + for index881 = 0 + index881 < response.value.value_nodes.length() + index881 = index881 + 1 { + let iter_elem : @types.SchemaValueNode = response.value.value_nodes[index881] + let iter_base = address880 + index881 * 32 match iter_elem { - BoolValue(payload806) => { + BoolValue(payload808) => { mbt_ffi_store8(iter_base + 0, 0) - mbt_ffi_store8(iter_base + 8, if payload806 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 8, if payload808 { 1 } else { 0 }) () } - S8Value(payload807) => { + S8Value(payload809) => { mbt_ffi_store8(iter_base + 0, 1) - mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload807)) + mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload809)) () } - S16Value(payload808) => { + S16Value(payload810) => { mbt_ffi_store8(iter_base + 0, 2) - mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload808)) + mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload810)) () } - S32Value(payload809) => { + S32Value(payload811) => { mbt_ffi_store8(iter_base + 0, 3) - mbt_ffi_store32(iter_base + 8, payload809) + mbt_ffi_store32(iter_base + 8, payload811) () } - S64Value(payload810) => { + S64Value(payload812) => { mbt_ffi_store8(iter_base + 0, 4) - mbt_ffi_store64(iter_base + 8, payload810) + mbt_ffi_store64(iter_base + 8, payload812) () } - U8Value(payload811) => { + U8Value(payload813) => { mbt_ffi_store8(iter_base + 0, 5) - mbt_ffi_store8(iter_base + 8, payload811.to_int()) + mbt_ffi_store8(iter_base + 8, payload813.to_int()) () } - U16Value(payload812) => { + U16Value(payload814) => { mbt_ffi_store8(iter_base + 0, 6) - mbt_ffi_store16(iter_base + 8, payload812.reinterpret_as_int()) + mbt_ffi_store16(iter_base + 8, payload814.reinterpret_as_int()) () } - U32Value(payload813) => { + U32Value(payload815) => { mbt_ffi_store8(iter_base + 0, 7) - mbt_ffi_store32(iter_base + 8, payload813.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 8, payload815.reinterpret_as_int()) () } - U64Value(payload814) => { + U64Value(payload816) => { mbt_ffi_store8(iter_base + 0, 8) - mbt_ffi_store64(iter_base + 8, payload814.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 8, payload816.reinterpret_as_int64()) () } - F32Value(payload815) => { + F32Value(payload817) => { mbt_ffi_store8(iter_base + 0, 9) - mbt_ffi_storef32(iter_base + 8, payload815) + mbt_ffi_storef32(iter_base + 8, payload817) () } - F64Value(payload816) => { + F64Value(payload818) => { mbt_ffi_store8(iter_base + 0, 10) - mbt_ffi_storef64(iter_base + 8, payload816) + mbt_ffi_storef64(iter_base + 8, payload818) () } - CharValue(payload817) => { + CharValue(payload819) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload817.to_int()) + mbt_ffi_store32(iter_base + 8, payload819.to_int()) () } - StringValue(payload818) => { + StringValue(payload820) => { mbt_ffi_store8(iter_base + 0, 12) - let ptr819 = mbt_ffi_str2ptr(payload818) - mbt_ffi_store32(iter_base + 12, payload818.length()) - mbt_ffi_store32(iter_base + 8, ptr819) - cleanup_list.push(ptr819) + let ptr821 = mbt_ffi_str2ptr(payload820) + mbt_ffi_store32(iter_base + 12, payload820.length()) + mbt_ffi_store32(iter_base + 8, ptr821) + cleanup_list.push(ptr821) () } - RecordValue(payload820) => { + RecordValue(payload822) => { mbt_ffi_store8(iter_base + 0, 13) - let address821 = mbt_ffi_malloc(payload820.length() * 4) - for index822 = 0 - index822 < payload820.length() - index822 = index822 + 1 { - let iter_elem : Int = payload820[index822] - let iter_base = address821 + index822 * 4 + let address823 = mbt_ffi_malloc(payload822.length() * 4) + for index824 = 0 + index824 < payload822.length() + index824 = index824 + 1 { + let iter_elem : Int = payload822[index824] + let iter_base = address823 + index824 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload820.length()) - mbt_ffi_store32(iter_base + 8, address821) - cleanup_list.push(address821) + mbt_ffi_store32(iter_base + 12, payload822.length()) + mbt_ffi_store32(iter_base + 8, address823) + cleanup_list.push(address823) () } - VariantValue(payload823) => { + VariantValue(payload825) => { mbt_ffi_store8(iter_base + 0, 14) - mbt_ffi_store32(iter_base + 8, payload823.case.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 8, payload825.case.reinterpret_as_int()) - match payload823.payload { + match payload825.payload { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload825) => { + Some(payload827) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload825) + mbt_ffi_store32(iter_base + 16, payload827) () } @@ -5502,110 +5510,110 @@ pub fn persist_durable_function_invocation( () } - EnumValue(payload826) => { + EnumValue(payload828) => { mbt_ffi_store8(iter_base + 0, 15) - mbt_ffi_store32(iter_base + 8, payload826.reinterpret_as_int()) + mbt_ffi_store32(iter_base + 8, payload828.reinterpret_as_int()) () } - FlagsValue(payload827) => { + FlagsValue(payload829) => { mbt_ffi_store8(iter_base + 0, 16) - let address828 = mbt_ffi_malloc(payload827.length() * 1) - for index829 = 0 - index829 < payload827.length() - index829 = index829 + 1 { - let iter_elem : Bool = payload827[index829] - let iter_base = address828 + index829 * 1 + let address830 = mbt_ffi_malloc(payload829.length() * 1) + for index831 = 0 + index831 < payload829.length() + index831 = index831 + 1 { + let iter_elem : Bool = payload829[index831] + let iter_base = address830 + index831 * 1 mbt_ffi_store8(iter_base + 0, if iter_elem { 1 } else { 0 }) } - mbt_ffi_store32(iter_base + 12, payload827.length()) - mbt_ffi_store32(iter_base + 8, address828) - cleanup_list.push(address828) + mbt_ffi_store32(iter_base + 12, payload829.length()) + mbt_ffi_store32(iter_base + 8, address830) + cleanup_list.push(address830) () } - TupleValue(payload830) => { + TupleValue(payload832) => { mbt_ffi_store8(iter_base + 0, 17) - let address831 = mbt_ffi_malloc(payload830.length() * 4) - for index832 = 0 - index832 < payload830.length() - index832 = index832 + 1 { - let iter_elem : Int = payload830[index832] - let iter_base = address831 + index832 * 4 + let address833 = mbt_ffi_malloc(payload832.length() * 4) + for index834 = 0 + index834 < payload832.length() + index834 = index834 + 1 { + let iter_elem : Int = payload832[index834] + let iter_base = address833 + index834 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload830.length()) - mbt_ffi_store32(iter_base + 8, address831) - cleanup_list.push(address831) + mbt_ffi_store32(iter_base + 12, payload832.length()) + mbt_ffi_store32(iter_base + 8, address833) + cleanup_list.push(address833) () } - ListValue(payload833) => { + ListValue(payload835) => { mbt_ffi_store8(iter_base + 0, 18) - let address834 = mbt_ffi_malloc(payload833.length() * 4) - for index835 = 0 - index835 < payload833.length() - index835 = index835 + 1 { - let iter_elem : Int = payload833[index835] - let iter_base = address834 + index835 * 4 + let address836 = mbt_ffi_malloc(payload835.length() * 4) + for index837 = 0 + index837 < payload835.length() + index837 = index837 + 1 { + let iter_elem : Int = payload835[index837] + let iter_base = address836 + index837 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload833.length()) - mbt_ffi_store32(iter_base + 8, address834) - cleanup_list.push(address834) + mbt_ffi_store32(iter_base + 12, payload835.length()) + mbt_ffi_store32(iter_base + 8, address836) + cleanup_list.push(address836) () } - FixedListValue(payload836) => { + FixedListValue(payload838) => { mbt_ffi_store8(iter_base + 0, 19) - let address837 = mbt_ffi_malloc(payload836.length() * 4) - for index838 = 0 - index838 < payload836.length() - index838 = index838 + 1 { - let iter_elem : Int = payload836[index838] - let iter_base = address837 + index838 * 4 + let address839 = mbt_ffi_malloc(payload838.length() * 4) + for index840 = 0 + index840 < payload838.length() + index840 = index840 + 1 { + let iter_elem : Int = payload838[index840] + let iter_base = address839 + index840 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload836.length()) - mbt_ffi_store32(iter_base + 8, address837) - cleanup_list.push(address837) + mbt_ffi_store32(iter_base + 12, payload838.length()) + mbt_ffi_store32(iter_base + 8, address839) + cleanup_list.push(address839) () } - MapValue(payload839) => { + MapValue(payload841) => { mbt_ffi_store8(iter_base + 0, 20) - let address840 = mbt_ffi_malloc(payload839.length() * 8) - for index841 = 0 - index841 < payload839.length() - index841 = index841 + 1 { - let iter_elem : @types.MapEntry = payload839[index841] - let iter_base = address840 + index841 * 8 + let address842 = mbt_ffi_malloc(payload841.length() * 8) + for index843 = 0 + index843 < payload841.length() + index843 = index843 + 1 { + let iter_elem : @types.MapEntry = payload841[index843] + let iter_base = address842 + index843 * 8 mbt_ffi_store32(iter_base + 0, iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.value) } - mbt_ffi_store32(iter_base + 12, payload839.length()) - mbt_ffi_store32(iter_base + 8, address840) - cleanup_list.push(address840) + mbt_ffi_store32(iter_base + 12, payload841.length()) + mbt_ffi_store32(iter_base + 8, address842) + cleanup_list.push(address842) () } - OptionValue(payload842) => { + OptionValue(payload844) => { mbt_ffi_store8(iter_base + 0, 21) - match payload842 { + match payload844 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload844) => { + Some(payload846) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload844) + mbt_ffi_store32(iter_base + 12, payload846) () } @@ -5613,22 +5621,22 @@ pub fn persist_durable_function_invocation( () } - ResultValue(payload845) => { + ResultValue(payload847) => { mbt_ffi_store8(iter_base + 0, 22) - match payload845 { - OkValue(payload846) => { + match payload847 { + OkValue(payload848) => { mbt_ffi_store8(iter_base + 8, 0) - match payload846 { + match payload848 { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload848) => { + Some(payload850) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload848) + mbt_ffi_store32(iter_base + 16, payload850) () } @@ -5636,18 +5644,18 @@ pub fn persist_durable_function_invocation( () } - ErrValue(payload849) => { + ErrValue(payload851) => { mbt_ffi_store8(iter_base + 8, 1) - match payload849 { + match payload851 { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload851) => { + Some(payload853) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload851) + mbt_ffi_store32(iter_base + 16, payload853) () } @@ -5659,142 +5667,150 @@ pub fn persist_durable_function_invocation( () } - TextValue(payload852) => { + TextValue(payload854) => { mbt_ffi_store8(iter_base + 0, 23) - let ptr853 = mbt_ffi_str2ptr(payload852.text) - mbt_ffi_store32(iter_base + 12, payload852.text.length()) - mbt_ffi_store32(iter_base + 8, ptr853) + let ptr855 = mbt_ffi_str2ptr(payload854.text) + mbt_ffi_store32(iter_base + 12, payload854.text.length()) + mbt_ffi_store32(iter_base + 8, ptr855) - match payload852.language { + match payload854.language { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload855) => { + Some(payload857) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr856 = mbt_ffi_str2ptr(payload855) - mbt_ffi_store32(iter_base + 24, payload855.length()) - mbt_ffi_store32(iter_base + 20, ptr856) - cleanup_list.push(ptr856) + let ptr858 = mbt_ffi_str2ptr(payload857) + mbt_ffi_store32(iter_base + 24, payload857.length()) + mbt_ffi_store32(iter_base + 20, ptr858) + cleanup_list.push(ptr858) () } } - cleanup_list.push(ptr853) + cleanup_list.push(ptr855) () } - BinaryValue(payload857) => { + BinaryValue(payload859) => { mbt_ffi_store8(iter_base + 0, 24) - let ptr858 = mbt_ffi_bytes2ptr(payload857.bytes) + let ptr860 = mbt_ffi_bytes2ptr(payload859.bytes) - mbt_ffi_store32(iter_base + 12, payload857.bytes.length()) - mbt_ffi_store32(iter_base + 8, ptr858) + mbt_ffi_store32(iter_base + 12, payload859.bytes.length()) + mbt_ffi_store32(iter_base + 8, ptr860) - match payload857.mime_type { + match payload859.mime_type { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload860) => { + Some(payload862) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr861 = mbt_ffi_str2ptr(payload860) - mbt_ffi_store32(iter_base + 24, payload860.length()) - mbt_ffi_store32(iter_base + 20, ptr861) - cleanup_list.push(ptr861) + let ptr863 = mbt_ffi_str2ptr(payload862) + mbt_ffi_store32(iter_base + 24, payload862.length()) + mbt_ffi_store32(iter_base + 20, ptr863) + cleanup_list.push(ptr863) () } } - cleanup_list.push(ptr858) + cleanup_list.push(ptr860) () } - PathValue(payload862) => { + PathValue(payload864) => { mbt_ffi_store8(iter_base + 0, 25) - let ptr863 = mbt_ffi_str2ptr(payload862) - mbt_ffi_store32(iter_base + 12, payload862.length()) - mbt_ffi_store32(iter_base + 8, ptr863) - cleanup_list.push(ptr863) + let ptr865 = mbt_ffi_str2ptr(payload864) + mbt_ffi_store32(iter_base + 12, payload864.length()) + mbt_ffi_store32(iter_base + 8, ptr865) + cleanup_list.push(ptr865) () } - UrlValue(payload864) => { + UrlValue(payload866) => { mbt_ffi_store8(iter_base + 0, 26) - let ptr865 = mbt_ffi_str2ptr(payload864) - mbt_ffi_store32(iter_base + 12, payload864.length()) - mbt_ffi_store32(iter_base + 8, ptr865) - cleanup_list.push(ptr865) + let ptr867 = mbt_ffi_str2ptr(payload866) + mbt_ffi_store32(iter_base + 12, payload866.length()) + mbt_ffi_store32(iter_base + 8, ptr867) + cleanup_list.push(ptr867) () } - DatetimeValue(payload866) => { + DatetimeValue(payload868) => { mbt_ffi_store8(iter_base + 0, 27) - mbt_ffi_store64(iter_base + 8, payload866.seconds) + mbt_ffi_store64(iter_base + 8, payload868.seconds) mbt_ffi_store32( iter_base + 16, - payload866.nanoseconds.reinterpret_as_int(), + payload868.nanoseconds.reinterpret_as_int(), ) () } - DurationValue(payload867) => { + DurationValue(payload869) => { mbt_ffi_store8(iter_base + 0, 28) - mbt_ffi_store64(iter_base + 8, payload867.nanoseconds) + mbt_ffi_store64(iter_base + 8, payload869.nanoseconds) () } - QuantityValueNode(payload868) => { + QuantityValueNode(payload870) => { mbt_ffi_store8(iter_base + 0, 29) - mbt_ffi_store64(iter_base + 8, payload868.mantissa) - mbt_ffi_store32(iter_base + 16, payload868.scale) + mbt_ffi_store64(iter_base + 8, payload870.mantissa) + mbt_ffi_store32(iter_base + 16, payload870.scale) - let ptr869 = mbt_ffi_str2ptr(payload868.unit) - mbt_ffi_store32(iter_base + 24, payload868.unit.length()) - mbt_ffi_store32(iter_base + 20, ptr869) - cleanup_list.push(ptr869) + let ptr871 = mbt_ffi_str2ptr(payload870.unit) + mbt_ffi_store32(iter_base + 24, payload870.unit.length()) + mbt_ffi_store32(iter_base + 20, ptr871) + cleanup_list.push(ptr871) () } - UnionValue(payload870) => { + UnionValue(payload872) => { mbt_ffi_store8(iter_base + 0, 30) - let ptr871 = mbt_ffi_str2ptr(payload870.tag) - mbt_ffi_store32(iter_base + 12, payload870.tag.length()) - mbt_ffi_store32(iter_base + 8, ptr871) - mbt_ffi_store32(iter_base + 16, payload870.body) - cleanup_list.push(ptr871) + let ptr873 = mbt_ffi_str2ptr(payload872.tag) + mbt_ffi_store32(iter_base + 12, payload872.tag.length()) + mbt_ffi_store32(iter_base + 8, ptr873) + mbt_ffi_store32(iter_base + 16, payload872.body) + cleanup_list.push(ptr873) () } - SecretValue(payload872) => { + SecretValue(payload874) => { mbt_ffi_store8(iter_base + 0, 31) - let @types.Secret(handle873) = payload872 - mbt_ffi_store32(iter_base + 8, handle873) + let @types.Secret(handle875) = payload874 + mbt_ffi_store32(iter_base + 8, handle875) () } - QuotaTokenHandle(payload874) => { + QuotaTokenHandle(payload876) => { mbt_ffi_store8(iter_base + 0, 32) - let @types.QuotaToken(handle875) = payload874 - mbt_ffi_store32(iter_base + 8, handle875) + let @types.QuotaToken(handle877) = payload876 + mbt_ffi_store32(iter_base + 8, handle877) + + () + } + StreamValue(payload878) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle879) = payload878 + mbt_ffi_store32(iter_base + 8, handle879) () } } } mbt_ffi_store32(return_area + 64, response.value.value_nodes.length()) - mbt_ffi_store32(return_area + 60, address876) + mbt_ffi_store32(return_area + 60, address880) mbt_ffi_store32(return_area + 68, response.value.root) match function_type { @@ -5818,18 +5834,18 @@ pub fn persist_durable_function_invocation( () } - WriteRemoteBatched(payload882) => { + WriteRemoteBatched(payload886) => { mbt_ffi_store8(return_area + 72, 4) - match payload882 { + match payload886 { None => { mbt_ffi_store8(return_area + 80, 0) () } - Some(payload884) => { + Some(payload888) => { mbt_ffi_store8(return_area + 80, 1) - mbt_ffi_store64(return_area + 88, payload884.reinterpret_as_int64()) + mbt_ffi_store64(return_area + 88, payload888.reinterpret_as_int64()) () } @@ -5837,18 +5853,18 @@ pub fn persist_durable_function_invocation( () } - WriteRemoteTransaction(payload885) => { + WriteRemoteTransaction(payload889) => { mbt_ffi_store8(return_area + 72, 5) - match payload885 { + match payload889 { None => { mbt_ffi_store8(return_area + 80, 0) () } - Some(payload887) => { + Some(payload891) => { mbt_ffi_store8(return_area + 80, 1) - mbt_ffi_store64(return_area + 88, payload887.reinterpret_as_int64()) + mbt_ffi_store64(return_area + 88, payload891.reinterpret_as_int64()) () } @@ -5862,10 +5878,10 @@ pub fn persist_durable_function_invocation( mbt_ffi_free(ptr) mbt_ffi_free(address358) mbt_ffi_free(address364) - mbt_ffi_free(address435) - mbt_ffi_free(address798) - mbt_ffi_free(address804) - mbt_ffi_free(address876) + mbt_ffi_free(address437) + mbt_ffi_free(address800) + mbt_ffi_free(address806) + mbt_ffi_free(address880) cleanup_list.each(mbt_ffi_free) } @@ -7853,6 +7869,12 @@ pub fn read_persisted_durable_function_invocation() -> PersistedDurableFunctionI @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } diff --git a/sdks/moonbit/golem_sdk/interface/golem/quota/types/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/quota/types/ffi.mbt index 333d494cc8..f616140b2f 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/quota/types/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/quota/types/ffi.mbt @@ -18,30 +18,30 @@ fn wasmImportSplit(p0 : Int, p1 : Int64) -> Int = "golem:quota/types@1.5.0" "spl ///| fn wasmImportMerge(p0 : Int, p1 : Int) = "golem:quota/types@1.5.0" "merge" -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - -///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) - ///| #owned(str) extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) diff --git a/sdks/moonbit/golem_sdk/interface/golem/rdbms/ignite2/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/rdbms/ignite2/ffi.mbt index 0403439e57..924b42f463 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/rdbms/ignite2/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/rdbms/ignite2/ffi.mbt @@ -88,49 +88,72 @@ fn wasmImportMethodDbConnectionExecute( fn wasmImportMethodDbConnectionBeginTransaction(p0 : Int, p1 : Int) = "golem:rdbms/ignite2@1.5.0" "[method]db-connection.begin-transaction" ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = - #|(func (param i32) (result f32) local.get 0 f32.load) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) + +///| +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + +///| +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = @@ -144,44 +167,21 @@ extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) - -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| -extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = - #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) - -///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) ///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) ///| extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) - -///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) - -///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) - -///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/rdbms/mysql/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/rdbms/mysql/ffi.mbt index 0ff213dc98..6057c33619 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/rdbms/mysql/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/rdbms/mysql/ffi.mbt @@ -88,67 +88,65 @@ fn wasmImportMethodDbTransactionCommit(p0 : Int, p1 : Int) = "golem:rdbms/mysql@ fn wasmImportMethodDbTransactionRollback(p0 : Int, p1 : Int) = "golem:rdbms/mysql@1.5.0" "[method]db-transaction.rollback" ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) - -///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend8_s) +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = @@ -158,30 +156,32 @@ extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) - -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) ///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = - #|(func (param i32) (result f32) local.get 0 f32.load) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) ///| extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) + +///| +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/rdbms/postgres/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/rdbms/postgres/ffi.mbt index 88852c7335..5cc22c9574 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/rdbms/postgres/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/rdbms/postgres/ffi.mbt @@ -112,72 +112,82 @@ fn wasmImportMethodDbTransactionCommit(p0 : Int, p1 : Int) = "golem:rdbms/postgr fn wasmImportMethodDbTransactionRollback(p0 : Int, p1 : Int) = "golem:rdbms/postgres@1.5.0" "[method]db-transaction.rollback" ///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) +#owned(array) +extern "wasm" fn mbt_ffi_float_array2ptr(array : FixedArray[Float]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +#owned(array) +extern "wasm" fn mbt_ffi_int_array2ptr(array : FixedArray[Int]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = - #|(func (param i32) (result f32) local.get 0 f32.load) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| -#owned(array) -extern "wasm" fn mbt_ffi_float_array2ptr(array : FixedArray[Float]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + +///| +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| extern "wasm" fn mbt_ffi_ptr2float_array( @@ -197,42 +207,32 @@ extern "wasm" fn mbt_ffi_ptr2int_array(ptr : Int, len : Int) -> FixedArray[Int] #| local.get 0) ///| -extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = - #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) - -///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) #| local.get 0 - #| local.get 1 call $moonbit.init_array8 + #| local.get 1 call $moonbit.init_array16 #| local.get 0) ///| -#owned(array) -extern "wasm" fn mbt_ffi_int_array2ptr(array : FixedArray[Int]) -> Int = - #|(func (param i32) (result i32) local.get 0) - -///| -extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend8_s) - -///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) ///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) + +///| +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/secrets/reveal/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/secrets/reveal/ffi.mbt index bb54c724ae..58b1567ac0 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/secrets/reveal/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/secrets/reveal/ffi.mbt @@ -12,41 +12,22 @@ fn wasmImportReveal( ) = "golem:secrets/reveal@0.1.0" "reveal" ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load16_s) -///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) - -///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) - ///| extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load16_u) -///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) - -///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) - ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) @@ -56,16 +37,27 @@ extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) + +///| +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = @@ -82,5 +74,13 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = - #|(func (param i32) (result f32) local.get 0 f32.load) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) diff --git a/sdks/moonbit/golem_sdk/interface/golem/secrets/reveal/top.mbt b/sdks/moonbit/golem_sdk/interface/golem/secrets/reveal/top.mbt index b579e1596d..5d27a44feb 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/secrets/reveal/top.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/secrets/reveal/top.mbt @@ -2683,6 +2683,12 @@ pub fn reveal( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } diff --git a/sdks/moonbit/golem_sdk/interface/golem/secrets/types/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/secrets/types/ffi.mbt index 505300eb72..349ba8dede 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/secrets/types/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/secrets/types/ffi.mbt @@ -7,20 +7,28 @@ fn wasmImportId(p0 : Int, p1 : Int) = "golem:secrets/types@0.1.0" "id" fn wasmImportMetadata(p0 : Int, p1 : Int) = "golem:secrets/types@0.1.0" "metadata" ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + ///| extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #|(func (param i32) (param i32) (result i32) @@ -29,16 +37,8 @@ extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) - -///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) - -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) diff --git a/sdks/moonbit/golem_sdk/interface/golem/tool/host/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/tool/host/ffi.mbt index 6b4f0a9c84..22070979a1 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/tool/host/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/tool/host/ffi.mbt @@ -2117,91 +2117,91 @@ fn wasmGolemToolHost010MethodFutureInvokeResultGetStream0StreamLift( fn wasmImportMethodFutureInvokeResultCancel(p0 : Int) = "golem:tool/host@0.1.0" "[method]future-invoke-result.cancel" ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) - -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) -///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) - ///| extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = @@ -2212,5 +2212,5 @@ extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/tool/host/top.mbt b/sdks/moonbit/golem_sdk/interface/golem/tool/host/top.mbt index ac3c483bba..a968fc920b 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/tool/host/top.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/tool/host/top.mbt @@ -553,6 +553,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -1096,6 +1102,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -1672,6 +1684,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -2184,6 +2202,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -2550,6 +2574,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -2916,6 +2946,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -3299,6 +3335,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -3669,6 +3711,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -4032,6 +4080,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -4407,6 +4461,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -4770,6 +4830,12 @@ pub fn get_all_tools() -> Array[RegisteredTool] { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -7444,6 +7510,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -7992,6 +8064,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -8572,6 +8650,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -9096,6 +9180,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -9473,6 +9563,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -9850,6 +9946,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -10238,6 +10340,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -10619,6 +10727,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -10993,6 +11107,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -11379,6 +11499,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -11753,6 +11879,12 @@ pub fn get_tool(name : String) -> RegisteredTool? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -16278,12 +16410,12 @@ pub async fn ToolRpc::invoke_and_await( mbt_ffi_store32(lower_ptr + 12 + 8, address363) mbt_ffi_store32(lower_ptr + 12 + 16, input.graph.root) - let address434 = mbt_ffi_malloc(input.value.value_nodes.length() * 32) - for index435 = 0 - index435 < input.value.value_nodes.length() - index435 = index435 + 1 { - let iter_elem : @types.SchemaValueNode = input.value.value_nodes[index435] - let iter_base = address434 + index435 * 32 + let address436 = mbt_ffi_malloc(input.value.value_nodes.length() * 32) + for index437 = 0 + index437 < input.value.value_nodes.length() + index437 = index437 + 1 { + let iter_elem : @types.SchemaValueNode = input.value.value_nodes[index437] + let iter_base = address436 + index437 * 32 match iter_elem { BoolValue(payload365) => { @@ -16677,12 +16809,20 @@ pub async fn ToolRpc::invoke_and_await( let @types.QuotaToken(handle433) = payload432 mbt_ffi_store32(iter_base + 8, handle433) + () + } + StreamValue(payload434) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle435) = payload434 + mbt_ffi_store32(iter_base + 8, handle435) + () } } } mbt_ffi_store32(lower_ptr + 12 + 24, input.value.value_nodes.length()) - mbt_ffi_store32(lower_ptr + 12 + 20, address434) + mbt_ffi_store32(lower_ptr + 12 + 20, address436) mbt_ffi_store32(lower_ptr + 12 + 28, input.value.root) match stdin { @@ -17280,6 +17420,10 @@ pub async fn ToolRpc::invoke_and_await( 31 => @types.Secret::Secret(mbt_ffi_load32(iter_base + 8)).drop() 32 => @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)).drop() + 33 => + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ).drop() _ => panic() } } @@ -17861,6 +18005,7 @@ pub async fn ToolRpc::invoke_and_await( 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -18459,6 +18604,10 @@ pub async fn ToolRpc::invoke_and_await( @types.Secret::Secret(mbt_ffi_load32(iter_base + 8)).drop() 32 => @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)).drop() + 33 => + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ).drop() _ => panic() } } @@ -19091,6 +19240,10 @@ pub async fn ToolRpc::invoke_and_await( @types.QuotaToken::QuotaToken( mbt_ffi_load32(iter_base + 8), ).drop() + 33 => + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ).drop() _ => panic() } } @@ -21185,6 +21338,12 @@ pub async fn ToolRpc::invoke_and_await( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -23464,6 +23623,12 @@ pub async fn ToolRpc::invoke_and_await( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -25904,12 +26069,12 @@ pub fn ToolRpc::invoke( cleanup_list.push(ptr362) } - let address438 = mbt_ffi_malloc(input.value.value_nodes.length() * 32) - for index439 = 0 - index439 < input.value.value_nodes.length() - index439 = index439 + 1 { - let iter_elem : @types.SchemaValueNode = input.value.value_nodes[index439] - let iter_base = address438 + index439 * 32 + let address440 = mbt_ffi_malloc(input.value.value_nodes.length() * 32) + for index441 = 0 + index441 < input.value.value_nodes.length() + index441 = index441 + 1 { + let iter_elem : @types.SchemaValueNode = input.value.value_nodes[index441] + let iter_base = address440 + index441 * 32 match iter_elem { BoolValue(payload368) => { @@ -26318,39 +26483,47 @@ pub fn ToolRpc::invoke( let @types.QuotaToken(handle437) = payload436 mbt_ffi_store32(iter_base + 8, handle437) + () + } + StreamValue(payload438) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle439) = payload438 + mbt_ffi_store32(iter_base + 8, handle439) + () } } } - let (lowered, lowered442) = match stdin { + let (lowered, lowered444) = match stdin { None => (0, 0) - Some(payload441) => - (1, wasmGolemToolHost010MethodToolRpcInvokeStream0StreamLower(payload441)) + Some(payload443) => + (1, wasmGolemToolHost010MethodToolRpcInvokeStream0StreamLower(payload443)) } let return_area = mbt_ffi_malloc(44) let lower_arg = handle - let lower_arg443 = address - let lower_arg444 = command_path.length() - let lower_arg445 = address360 - let lower_arg446 = input.graph.type_nodes.length() - let lower_arg447 = address366 - let lower_arg448 = input.graph.defs.length() - let lower_arg449 = input.graph.root - let lower_arg450 = address438 - let lower_arg451 = input.value.value_nodes.length() - let lower_arg452 = input.value.root - let lower_arg453 = lowered - let lower_arg454 = lowered442 - let lower_arg455 = return_area + let lower_arg445 = address + let lower_arg446 = command_path.length() + let lower_arg447 = address360 + let lower_arg448 = input.graph.type_nodes.length() + let lower_arg449 = address366 + let lower_arg450 = input.graph.defs.length() + let lower_arg451 = input.graph.root + let lower_arg452 = address440 + let lower_arg453 = input.value.value_nodes.length() + let lower_arg454 = input.value.root + let lower_arg455 = lowered + let lower_arg456 = lowered444 + let lower_arg457 = return_area wasmImportMethodToolRpcInvoke( - lower_arg, lower_arg443, lower_arg444, lower_arg445, lower_arg446, lower_arg447, - lower_arg448, lower_arg449, lower_arg450, lower_arg451, lower_arg452, lower_arg453, - lower_arg454, lower_arg455, + lower_arg, lower_arg445, lower_arg446, lower_arg447, lower_arg448, lower_arg449, + lower_arg450, lower_arg451, lower_arg452, lower_arg453, lower_arg454, lower_arg455, + lower_arg456, lower_arg457, ) - for index459 = 0; index459 < lower_arg446; index459 = index459 + 1 { - let iter_base = lower_arg445 + index459 * 144 + for index461 = 0; index461 < lower_arg448; index461 = index461 + 1 { + let iter_base = lower_arg447 + index461 * 144 match mbt_ffi_load8_u(iter_base + 0) { 0 => () @@ -26468,10 +26641,10 @@ pub fn ToolRpc::invoke( 12 => () 13 => () 14 => - for index456 = 0 - index456 < mbt_ffi_load32(iter_base + 12) - index456 = index456 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index456 * 68 + for index458 = 0 + index458 < mbt_ffi_load32(iter_base + 12) + index458 = index458 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index458 * 68 match mbt_ffi_load8_u(iter_base + 12) { 0 => () @@ -26499,10 +26672,10 @@ pub fn ToolRpc::invoke( } } 15 => - for index457 = 0 - index457 < mbt_ffi_load32(iter_base + 12) - index457 = index457 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index457 * 72 + for index459 = 0 + index459 < mbt_ffi_load32(iter_base + 12) + index459 = index459 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index459 * 72 match mbt_ffi_load8_u(iter_base + 16) { 0 => () @@ -26598,10 +26771,10 @@ pub fn ToolRpc::invoke( } } 31 => - for index458 = 0 - index458 < mbt_ffi_load32(iter_base + 12) - index458 = index458 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index458 * 92 + for index460 = 0 + index460 < mbt_ffi_load32(iter_base + 12) + index460 = index460 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index460 * 92 match mbt_ffi_load8_u(iter_base + 12) { 0 => () @@ -26686,8 +26859,8 @@ pub fn ToolRpc::invoke( } } - for index460 = 0; index460 < lower_arg448; index460 = index460 + 1 { - let iter_base = lower_arg447 + index460 * 24 + for index462 = 0; index462 < lower_arg450; index462 = index462 + 1 { + let iter_base = lower_arg449 + index462 * 24 match mbt_ffi_load8_u(iter_base + 8) { 0 => () @@ -26696,8 +26869,8 @@ pub fn ToolRpc::invoke( } } - for index461 = 0; index461 < lower_arg451; index461 = index461 + 1 { - let iter_base = lower_arg450 + index461 * 32 + for index463 = 0; index463 < lower_arg453; index463 = index463 + 1 { + let iter_base = lower_arg452 + index463 * 32 match mbt_ffi_load8_u(iter_base + 0) { 0 => () @@ -26743,125 +26916,126 @@ pub fn ToolRpc::invoke( 30 => () 31 => () 32 => () + 33 => () _ => panic() } } - match lower_arg453 { + match lower_arg455 { 0 => () 1 => - wasmGolemToolHost010MethodToolRpcInvokeStream0StreamCommit(lower_arg454) + wasmGolemToolHost010MethodToolRpcInvokeStream0StreamCommit(lower_arg456) _ => panic() } - let lifted707 = match mbt_ffi_load8_u(return_area + 0) { + let lifted709 = match mbt_ffi_load8_u(return_area + 0) { 0 => Result::Ok(()) 1 => { - let lifted706 = match mbt_ffi_load8_u(return_area + 4) { + let lifted708 = match mbt_ffi_load8_u(return_area + 4) { 0 => { - let result462 = mbt_ffi_ptr2str( + let result464 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::ProtocolError(result462) + RpcError::ProtocolError(result464) } 1 => { - let result463 = mbt_ffi_ptr2str( + let result465 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::Denied(result463) + RpcError::Denied(result465) } 2 => { - let result464 = mbt_ffi_ptr2str( + let result466 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::NotFound(result464) + RpcError::NotFound(result466) } 3 => { - let result465 = mbt_ffi_ptr2str( + let result467 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 8), mbt_ffi_load32(return_area + 12), ) - RpcError::RemoteInternalError(result465) + RpcError::RemoteInternalError(result467) } 4 => { - let lifted705 = match mbt_ffi_load8_u(return_area + 8) { + let lifted707 = match mbt_ffi_load8_u(return_area + 8) { 0 => { - let result466 = mbt_ffi_ptr2str( + let result468 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.ToolError::InvalidToolName(result466) + @common.ToolError::InvalidToolName(result468) } 1 => { let array : Array[String] = [] - for index468 = 0 - index468 < mbt_ffi_load32(return_area + 16) - index468 = index468 + 1 { - let iter_base = mbt_ffi_load32(return_area + 12) + index468 * 8 + for index470 = 0 + index470 < mbt_ffi_load32(return_area + 16) + index470 = index470 + 1 { + let iter_base = mbt_ffi_load32(return_area + 12) + index470 * 8 - let result467 = mbt_ffi_ptr2str( + let result469 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array.push(result467) + array.push(result469) } mbt_ffi_free(mbt_ffi_load32(return_area + 12)) @common.ToolError::InvalidCommandPath(array) } 2 => { - let result469 = mbt_ffi_ptr2str( + let result471 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.ToolError::InvalidInput(result469) + @common.ToolError::InvalidInput(result471) } 3 => { - let result470 = mbt_ffi_ptr2str( + let result472 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.ToolError::ConstraintViolation(result470) + @common.ToolError::ConstraintViolation(result472) } 4 => { - let result471 = mbt_ffi_ptr2str( + let result473 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 12), mbt_ffi_load32(return_area + 16), ) - @common.ToolError::InvalidResult(result471) + @common.ToolError::InvalidResult(result473) } 5 => { - let array667 : Array[@types.SchemaTypeNode] = [] - for index668 = 0 - index668 < mbt_ffi_load32(return_area + 16) - index668 = index668 + 1 { + let array669 : Array[@types.SchemaTypeNode] = [] + for index670 = 0 + index670 < mbt_ffi_load32(return_area + 16) + index670 = index670 + 1 { let iter_base = mbt_ffi_load32(return_area + 12) + - index668 * 144 + index670 * 144 - let lifted653 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted655 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted477 : @types.NumericRestrictions? = match + let lifted479 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted472 : @types.NumericBound? = match + let lifted474 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { @@ -26886,11 +27060,11 @@ pub fn ToolRpc::invoke( _ => panic() } - let lifted474 : @types.NumericBound? = match + let lifted476 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted473 = match + let lifted475 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -26907,46 +27081,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted473) + Option::Some(lifted475) } _ => panic() } - let lifted476 : String? = match + let lifted478 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result475 = mbt_ffi_ptr2str( + let result477 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result475) + Option::Some(result477) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted472, - max: lifted474, - unit: lifted476, + min: lifted474, + max: lifted476, + unit: lifted478, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted477) + @types.SchemaTypeBody::S8Type(lifted479) } 3 => { - let lifted484 : @types.NumericRestrictions? = match + let lifted486 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted479 : @types.NumericBound? = match + let lifted481 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted478 = match + let lifted480 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -26963,16 +27137,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted478) + Option::Some(lifted480) } _ => panic() } - let lifted481 : @types.NumericBound? = match + let lifted483 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted480 = match + let lifted482 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -26989,46 +27163,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted480) + Option::Some(lifted482) } _ => panic() } - let lifted483 : String? = match + let lifted485 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result482 = mbt_ffi_ptr2str( + let result484 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result482) + Option::Some(result484) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted479, - max: lifted481, - unit: lifted483, + min: lifted481, + max: lifted483, + unit: lifted485, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted484) + @types.SchemaTypeBody::S16Type(lifted486) } 4 => { - let lifted491 : @types.NumericRestrictions? = match + let lifted493 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted486 : @types.NumericBound? = match + let lifted488 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted485 = match + let lifted487 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -27045,16 +27219,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted485) + Option::Some(lifted487) } _ => panic() } - let lifted488 : @types.NumericBound? = match + let lifted490 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted487 = match + let lifted489 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -27071,46 +27245,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted487) + Option::Some(lifted489) } _ => panic() } - let lifted490 : String? = match + let lifted492 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result489 = mbt_ffi_ptr2str( + let result491 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result489) + Option::Some(result491) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted486, - max: lifted488, - unit: lifted490, + min: lifted488, + max: lifted490, + unit: lifted492, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted491) + @types.SchemaTypeBody::S32Type(lifted493) } 5 => { - let lifted498 : @types.NumericRestrictions? = match + let lifted500 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted493 : @types.NumericBound? = match + let lifted495 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted492 = match + let lifted494 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -27127,16 +27301,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted492) + Option::Some(lifted494) } _ => panic() } - let lifted495 : @types.NumericBound? = match + let lifted497 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted494 = match + let lifted496 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -27153,46 +27327,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted494) + Option::Some(lifted496) } _ => panic() } - let lifted497 : String? = match + let lifted499 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result496 = mbt_ffi_ptr2str( + let result498 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result496) + Option::Some(result498) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted493, - max: lifted495, - unit: lifted497, + min: lifted495, + max: lifted497, + unit: lifted499, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted498) + @types.SchemaTypeBody::S64Type(lifted500) } 6 => { - let lifted505 : @types.NumericRestrictions? = match + let lifted507 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted500 : @types.NumericBound? = match + let lifted502 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted499 = match + let lifted501 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -27209,16 +27383,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted499) + Option::Some(lifted501) } _ => panic() } - let lifted502 : @types.NumericBound? = match + let lifted504 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted501 = match + let lifted503 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -27235,46 +27409,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted501) + Option::Some(lifted503) } _ => panic() } - let lifted504 : String? = match + let lifted506 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result503 = mbt_ffi_ptr2str( + let result505 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result503) + Option::Some(result505) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted500, - max: lifted502, - unit: lifted504, + min: lifted502, + max: lifted504, + unit: lifted506, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted505) + @types.SchemaTypeBody::U8Type(lifted507) } 7 => { - let lifted512 : @types.NumericRestrictions? = match + let lifted514 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted507 : @types.NumericBound? = match + let lifted509 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted506 = match + let lifted508 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -27291,16 +27465,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted506) + Option::Some(lifted508) } _ => panic() } - let lifted509 : @types.NumericBound? = match + let lifted511 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted508 = match + let lifted510 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -27317,46 +27491,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted508) + Option::Some(lifted510) } _ => panic() } - let lifted511 : String? = match + let lifted513 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result510 = mbt_ffi_ptr2str( + let result512 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result510) + Option::Some(result512) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted507, - max: lifted509, - unit: lifted511, + min: lifted509, + max: lifted511, + unit: lifted513, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted512) + @types.SchemaTypeBody::U16Type(lifted514) } 8 => { - let lifted519 : @types.NumericRestrictions? = match + let lifted521 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted514 : @types.NumericBound? = match + let lifted516 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted513 = match + let lifted515 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -27373,16 +27547,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted513) + Option::Some(lifted515) } _ => panic() } - let lifted516 : @types.NumericBound? = match + let lifted518 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted515 = match + let lifted517 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -27399,46 +27573,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted515) + Option::Some(lifted517) } _ => panic() } - let lifted518 : String? = match + let lifted520 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result517 = mbt_ffi_ptr2str( + let result519 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result517) + Option::Some(result519) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted514, - max: lifted516, - unit: lifted518, + min: lifted516, + max: lifted518, + unit: lifted520, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted519) + @types.SchemaTypeBody::U32Type(lifted521) } 9 => { - let lifted526 : @types.NumericRestrictions? = match + let lifted528 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted521 : @types.NumericBound? = match + let lifted523 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted520 = match + let lifted522 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -27455,16 +27629,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted520) + Option::Some(lifted522) } _ => panic() } - let lifted523 : @types.NumericBound? = match + let lifted525 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted522 = match + let lifted524 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -27481,46 +27655,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted522) + Option::Some(lifted524) } _ => panic() } - let lifted525 : String? = match + let lifted527 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result524 = mbt_ffi_ptr2str( + let result526 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result524) + Option::Some(result526) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted521, - max: lifted523, - unit: lifted525, + min: lifted523, + max: lifted525, + unit: lifted527, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted526) + @types.SchemaTypeBody::U64Type(lifted528) } 10 => { - let lifted533 : @types.NumericRestrictions? = match + let lifted535 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted528 : @types.NumericBound? = match + let lifted530 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted527 = match + let lifted529 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -27537,16 +27711,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted527) + Option::Some(lifted529) } _ => panic() } - let lifted530 : @types.NumericBound? = match + let lifted532 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted529 = match + let lifted531 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -27563,46 +27737,46 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted529) + Option::Some(lifted531) } _ => panic() } - let lifted532 : String? = match + let lifted534 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result531 = mbt_ffi_ptr2str( + let result533 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result531) + Option::Some(result533) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted528, - max: lifted530, - unit: lifted532, + min: lifted530, + max: lifted532, + unit: lifted534, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted533) + @types.SchemaTypeBody::F32Type(lifted535) } 11 => { - let lifted540 : @types.NumericRestrictions? = match + let lifted542 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted535 : @types.NumericBound? = match + let lifted537 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted534 = match + let lifted536 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -27619,16 +27793,16 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted534) + Option::Some(lifted536) } _ => panic() } - let lifted537 : @types.NumericBound? = match + let lifted539 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted536 = match + let lifted538 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -27645,324 +27819,324 @@ pub fn ToolRpc::invoke( _ => panic() } - Option::Some(lifted536) + Option::Some(lifted538) } _ => panic() } - let lifted539 : String? = match + let lifted541 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result538 = mbt_ffi_ptr2str( + let result540 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result538) + Option::Some(result540) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted535, - max: lifted537, - unit: lifted539, + min: lifted537, + max: lifted539, + unit: lifted541, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted540) + @types.SchemaTypeBody::F64Type(lifted542) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array555 : Array[@types.NamedFieldType] = [] - for index556 = 0 - index556 < mbt_ffi_load32(iter_base + 12) - index556 = index556 + 1 { + let array557 : Array[@types.NamedFieldType] = [] + for index558 = 0 + index558 < mbt_ffi_load32(iter_base + 12) + index558 = index558 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index556 * 68 + index558 * 68 - let result541 = mbt_ffi_ptr2str( + let result543 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted543 : String? = match + let lifted545 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result542 = mbt_ffi_ptr2str( + let result544 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result542) + Option::Some(result544) } _ => panic() } - let array545 : Array[String] = [] - for index546 = 0 - index546 < mbt_ffi_load32(iter_base + 28) - index546 = index546 + 1 { + let array547 : Array[String] = [] + for index548 = 0 + index548 < mbt_ffi_load32(iter_base + 28) + index548 = index548 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index546 * 8 + index548 * 8 - let result544 = mbt_ffi_ptr2str( + let result546 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array545.push(result544) + array547.push(result546) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array548 : Array[String] = [] - for index549 = 0 - index549 < mbt_ffi_load32(iter_base + 36) - index549 = index549 + 1 { + let array550 : Array[String] = [] + for index551 = 0 + index551 < mbt_ffi_load32(iter_base + 36) + index551 = index551 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index549 * 8 + index551 * 8 - let result547 = mbt_ffi_ptr2str( + let result549 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array548.push(result547) + array550.push(result549) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted551 : String? = match + let lifted553 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result550 = mbt_ffi_ptr2str( + let result552 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result550) + Option::Some(result552) } _ => panic() } - let lifted554 : @types.Role? = match + let lifted556 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted553 = match + let lifted555 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result552 = mbt_ffi_ptr2str( + let result554 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result552) + @types.Role::Other(result554) } _ => panic() } - Option::Some(lifted553) + Option::Some(lifted555) } _ => panic() } - array555.push(@types.NamedFieldType::{ - name: result541, + array557.push(@types.NamedFieldType::{ + name: result543, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted543, - aliases: array545, - examples: array548, - deprecated: lifted551, - role: lifted554, + doc: lifted545, + aliases: array547, + examples: array550, + deprecated: lifted553, + role: lifted556, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array555) + @types.SchemaTypeBody::RecordType(array557) } 15 => { - let array572 : Array[@types.VariantCaseType] = [] - for index573 = 0 - index573 < mbt_ffi_load32(iter_base + 12) - index573 = index573 + 1 { + let array574 : Array[@types.VariantCaseType] = [] + for index575 = 0 + index575 < mbt_ffi_load32(iter_base + 12) + index575 = index575 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index573 * 72 + index575 * 72 - let result557 = mbt_ffi_ptr2str( + let result559 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted558 : Int? = match + let lifted560 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted560 : String? = match + let lifted562 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result559 = mbt_ffi_ptr2str( + let result561 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result559) + Option::Some(result561) } _ => panic() } - let array562 : Array[String] = [] - for index563 = 0 - index563 < mbt_ffi_load32(iter_base + 32) - index563 = index563 + 1 { + let array564 : Array[String] = [] + for index565 = 0 + index565 < mbt_ffi_load32(iter_base + 32) + index565 = index565 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index563 * 8 + index565 * 8 - let result561 = mbt_ffi_ptr2str( + let result563 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array562.push(result561) + array564.push(result563) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array565 : Array[String] = [] - for index566 = 0 - index566 < mbt_ffi_load32(iter_base + 40) - index566 = index566 + 1 { + let array567 : Array[String] = [] + for index568 = 0 + index568 < mbt_ffi_load32(iter_base + 40) + index568 = index568 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index566 * 8 + index568 * 8 - let result564 = mbt_ffi_ptr2str( + let result566 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array565.push(result564) + array567.push(result566) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted568 : String? = match + let lifted570 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result567 = mbt_ffi_ptr2str( + let result569 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result567) + Option::Some(result569) } _ => panic() } - let lifted571 : @types.Role? = match + let lifted573 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted570 = match + let lifted572 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result569 = mbt_ffi_ptr2str( + let result571 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result569) + @types.Role::Other(result571) } _ => panic() } - Option::Some(lifted570) + Option::Some(lifted572) } _ => panic() } - array572.push(@types.VariantCaseType::{ - name: result557, - payload: lifted558, + array574.push(@types.VariantCaseType::{ + name: result559, + payload: lifted560, metadata: @types.MetadataEnvelope::{ - doc: lifted560, - aliases: array562, - examples: array565, - deprecated: lifted568, - role: lifted571, + doc: lifted562, + aliases: array564, + examples: array567, + deprecated: lifted570, + role: lifted573, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array572) + @types.SchemaTypeBody::VariantType(array574) } 16 => { - let array575 : Array[String] = [] - for index576 = 0 - index576 < mbt_ffi_load32(iter_base + 12) - index576 = index576 + 1 { + let array577 : Array[String] = [] + for index578 = 0 + index578 < mbt_ffi_load32(iter_base + 12) + index578 = index578 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index576 * 8 + index578 * 8 - let result574 = mbt_ffi_ptr2str( + let result576 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array575.push(result574) + array577.push(result576) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array575) + @types.SchemaTypeBody::EnumType(array577) } 17 => { - let array578 : Array[String] = [] - for index579 = 0 - index579 < mbt_ffi_load32(iter_base + 12) - index579 = index579 + 1 { + let array580 : Array[String] = [] + for index581 = 0 + index581 < mbt_ffi_load32(iter_base + 12) + index581 = index581 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index579 * 8 + index581 * 8 - let result577 = mbt_ffi_ptr2str( + let result579 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array578.push(result577) + array580.push(result579) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array578) + @types.SchemaTypeBody::FlagsType(array580) } 18 => { - let array580 : Array[Int] = [] - for index581 = 0 - index581 < mbt_ffi_load32(iter_base + 12) - index581 = index581 + 1 { + let array582 : Array[Int] = [] + for index583 = 0 + index583 < mbt_ffi_load32(iter_base + 12) + index583 = index583 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index581 * 4 + index583 * 4 - array580.push(mbt_ffi_load32(iter_base + 0)) + array582.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array580) + @types.SchemaTypeBody::TupleType(array582) } 19 => @types.SchemaTypeBody::ListType( @@ -27983,14 +28157,14 @@ pub fn ToolRpc::invoke( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted582 : Int? = match + let lifted584 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted583 : Int? = match + let lifted585 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -27998,37 +28172,37 @@ pub fn ToolRpc::invoke( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted582, - err: lifted583, + ok: lifted584, + err: lifted585, }) } 24 => { - let lifted587 : Array[String]? = match + let lifted589 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array585 : Array[String] = [] - for index586 = 0 - index586 < mbt_ffi_load32(iter_base + 16) - index586 = index586 + 1 { + let array587 : Array[String] = [] + for index588 = 0 + index588 < mbt_ffi_load32(iter_base + 16) + index588 = index588 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index586 * 8 + index588 * 8 - let result584 = mbt_ffi_ptr2str( + let result586 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array585.push(result584) + array587.push(result586) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array585) + Option::Some(array587) } _ => panic() } - let lifted588 : UInt? = match + let lifted590 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -28038,7 +28212,7 @@ pub fn ToolRpc::invoke( _ => panic() } - let lifted589 : UInt? = match + let lifted591 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -28048,54 +28222,54 @@ pub fn ToolRpc::invoke( _ => panic() } - let lifted591 : String? = match + let lifted593 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result590 = mbt_ffi_ptr2str( + let result592 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result590) + Option::Some(result592) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted587, - min_length: lifted588, - max_length: lifted589, - regex: lifted591, + languages: lifted589, + min_length: lifted590, + max_length: lifted591, + regex: lifted593, }) } 25 => { - let lifted595 : Array[String]? = match + let lifted597 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array593 : Array[String] = [] - for index594 = 0 - index594 < mbt_ffi_load32(iter_base + 16) - index594 = index594 + 1 { + let array595 : Array[String] = [] + for index596 = 0 + index596 < mbt_ffi_load32(iter_base + 16) + index596 = index596 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index594 * 8 + index596 * 8 - let result592 = mbt_ffi_ptr2str( + let result594 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array593.push(result592) + array595.push(result594) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array593) + Option::Some(array595) } _ => panic() } - let lifted596 : UInt? = match + let lifted598 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -28105,7 +28279,7 @@ pub fn ToolRpc::invoke( _ => panic() } - let lifted597 : UInt? = match + let lifted599 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -28116,58 +28290,58 @@ pub fn ToolRpc::invoke( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted595, - min_bytes: lifted596, - max_bytes: lifted597, + mime_types: lifted597, + min_bytes: lifted598, + max_bytes: lifted599, }) } 26 => { - let lifted601 : Array[String]? = match + let lifted603 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array599 : Array[String] = [] - for index600 = 0 - index600 < mbt_ffi_load32(iter_base + 20) - index600 = index600 + 1 { + let array601 : Array[String] = [] + for index602 = 0 + index602 < mbt_ffi_load32(iter_base + 20) + index602 = index602 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index600 * 8 + index602 * 8 - let result598 = mbt_ffi_ptr2str( + let result600 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array599.push(result598) + array601.push(result600) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array599) + Option::Some(array601) } _ => panic() } - let lifted605 : Array[String]? = match + let lifted607 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array603 : Array[String] = [] - for index604 = 0 - index604 < mbt_ffi_load32(iter_base + 32) - index604 = index604 + 1 { + let array605 : Array[String] = [] + for index606 = 0 + index606 < mbt_ffi_load32(iter_base + 32) + index606 = index606 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index604 * 8 + index606 * 8 - let result602 = mbt_ffi_ptr2str( + let result604 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array603.push(result602) + array605.push(result604) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array603) + Option::Some(array605) } _ => panic() } @@ -28179,95 +28353,95 @@ pub fn ToolRpc::invoke( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted601, - allowed_extensions: lifted605, + allowed_mime_types: lifted603, + allowed_extensions: lifted607, }) } 27 => { - let lifted609 : Array[String]? = match + let lifted611 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array607 : Array[String] = [] - for index608 = 0 - index608 < mbt_ffi_load32(iter_base + 16) - index608 = index608 + 1 { + let array609 : Array[String] = [] + for index610 = 0 + index610 < mbt_ffi_load32(iter_base + 16) + index610 = index610 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index608 * 8 + index610 * 8 - let result606 = mbt_ffi_ptr2str( + let result608 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array607.push(result606) + array609.push(result608) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array607) + Option::Some(array609) } _ => panic() } - let lifted613 : Array[String]? = match + let lifted615 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array611 : Array[String] = [] - for index612 = 0 - index612 < mbt_ffi_load32(iter_base + 28) - index612 = index612 + 1 { + let array613 : Array[String] = [] + for index614 = 0 + index614 < mbt_ffi_load32(iter_base + 28) + index614 = index614 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index612 * 8 + index614 * 8 - let result610 = mbt_ffi_ptr2str( + let result612 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array611.push(result610) + array613.push(result612) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array611) + Option::Some(array613) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted609, - allowed_hosts: lifted613, + allowed_schemes: lifted611, + allowed_hosts: lifted615, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result614 = mbt_ffi_ptr2str( + let result616 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array616 : Array[String] = [] - for index617 = 0 - index617 < mbt_ffi_load32(iter_base + 20) - index617 = index617 + 1 { + let array618 : Array[String] = [] + for index619 = 0 + index619 < mbt_ffi_load32(iter_base + 20) + index619 = index619 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index617 * 8 + index619 * 8 - let result615 = mbt_ffi_ptr2str( + let result617 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array616.push(result615) + array618.push(result617) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted619 : @types.QuantityValue? = match + let lifted621 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result618 = mbt_ffi_ptr2str( + let result620 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -28275,17 +28449,17 @@ pub fn ToolRpc::invoke( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result618, + unit: result620, }) } _ => panic() } - let lifted621 : @types.QuantityValue? = match + let lifted623 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result620 = mbt_ffi_ptr2str( + let result622 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -28293,401 +28467,401 @@ pub fn ToolRpc::invoke( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result620, + unit: result622, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result614, - allowed_suffixes: array616, - min: lifted619, - max: lifted621, + base_unit: result616, + allowed_suffixes: array618, + min: lifted621, + max: lifted623, }) } 31 => { - let array645 : Array[@types.UnionBranch] = [] - for index646 = 0 - index646 < mbt_ffi_load32(iter_base + 12) - index646 = index646 + 1 { + let array647 : Array[@types.UnionBranch] = [] + for index648 = 0 + index648 < mbt_ffi_load32(iter_base + 12) + index648 = index648 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index646 * 92 + index648 * 92 - let result622 = mbt_ffi_ptr2str( + let result624 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted631 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted633 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result623 = mbt_ffi_ptr2str( + let result625 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result623) + @types.DiscriminatorRule::Prefix(result625) } 1 => { - let result624 = mbt_ffi_ptr2str( + let result626 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result624) + @types.DiscriminatorRule::Suffix(result626) } 2 => { - let result625 = mbt_ffi_ptr2str( + let result627 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result625) + @types.DiscriminatorRule::Contains(result627) } 3 => { - let result626 = mbt_ffi_ptr2str( + let result628 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result626) + @types.DiscriminatorRule::Regex(result628) } 4 => { - let result627 = mbt_ffi_ptr2str( + let result629 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted629 : String? = match + let lifted631 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result628 = mbt_ffi_ptr2str( + let result630 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result628) + Option::Some(result630) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result627, - literal: lifted629, + field_name: result629, + literal: lifted631, }) } 5 => { - let result630 = mbt_ffi_ptr2str( + let result632 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result630) + @types.DiscriminatorRule::FieldAbsent(result632) } _ => panic() } - let lifted633 : String? = match + let lifted635 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result632 = mbt_ffi_ptr2str( + let result634 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result632) + Option::Some(result634) } _ => panic() } - let array635 : Array[String] = [] - for index636 = 0 - index636 < mbt_ffi_load32(iter_base + 52) - index636 = index636 + 1 { + let array637 : Array[String] = [] + for index638 = 0 + index638 < mbt_ffi_load32(iter_base + 52) + index638 = index638 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index636 * 8 + index638 * 8 - let result634 = mbt_ffi_ptr2str( + let result636 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array635.push(result634) + array637.push(result636) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array638 : Array[String] = [] - for index639 = 0 - index639 < mbt_ffi_load32(iter_base + 60) - index639 = index639 + 1 { + let array640 : Array[String] = [] + for index641 = 0 + index641 < mbt_ffi_load32(iter_base + 60) + index641 = index641 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index639 * 8 + index641 * 8 - let result637 = mbt_ffi_ptr2str( + let result639 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array638.push(result637) + array640.push(result639) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted641 : String? = match + let lifted643 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result640 = mbt_ffi_ptr2str( + let result642 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result640) + Option::Some(result642) } _ => panic() } - let lifted644 : @types.Role? = match + let lifted646 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted643 = match + let lifted645 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result642 = mbt_ffi_ptr2str( + let result644 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result642) + @types.Role::Other(result644) } _ => panic() } - Option::Some(lifted643) + Option::Some(lifted645) } _ => panic() } - array645.push(@types.UnionBranch::{ - tag: result622, + array647.push(@types.UnionBranch::{ + tag: result624, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted631, + discriminator: lifted633, metadata: @types.MetadataEnvelope::{ - doc: lifted633, - aliases: array635, - examples: array638, - deprecated: lifted641, - role: lifted644, + doc: lifted635, + aliases: array637, + examples: array640, + deprecated: lifted643, + role: lifted646, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array645, + branches: array647, }) } 32 => { - let lifted648 : String? = match + let lifted650 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result647 = mbt_ffi_ptr2str( + let result649 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result647) + Option::Some(result649) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted648, + category: lifted650, }) } 33 => { - let lifted650 : String? = match + let lifted652 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result649 = mbt_ffi_ptr2str( + let result651 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result649) + Option::Some(result651) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted650, + resource_name: lifted652, }) } 34 => { - let lifted651 : Int? = match + let lifted653 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted651) + @types.SchemaTypeBody::FutureType(lifted653) } 35 => { - let lifted652 : Int? = match + let lifted654 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted652) + @types.SchemaTypeBody::StreamType(lifted654) } _ => panic() } - let lifted655 : String? = match + let lifted657 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result654 = mbt_ffi_ptr2str( + let result656 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result654) + Option::Some(result656) } _ => panic() } - let array657 : Array[String] = [] - for index658 = 0 - index658 < mbt_ffi_load32(iter_base + 104) - index658 = index658 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index658 * 8 + let array659 : Array[String] = [] + for index660 = 0 + index660 < mbt_ffi_load32(iter_base + 104) + index660 = index660 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index660 * 8 - let result656 = mbt_ffi_ptr2str( + let result658 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array657.push(result656) + array659.push(result658) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array660 : Array[String] = [] - for index661 = 0 - index661 < mbt_ffi_load32(iter_base + 112) - index661 = index661 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index661 * 8 + let array662 : Array[String] = [] + for index663 = 0 + index663 < mbt_ffi_load32(iter_base + 112) + index663 = index663 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index663 * 8 - let result659 = mbt_ffi_ptr2str( + let result661 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array660.push(result659) + array662.push(result661) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted663 : String? = match + let lifted665 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result662 = mbt_ffi_ptr2str( + let result664 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result662) + Option::Some(result664) } _ => panic() } - let lifted666 : @types.Role? = match + let lifted668 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted665 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted667 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result664 = mbt_ffi_ptr2str( + let result666 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result664) + @types.Role::Other(result666) } _ => panic() } - Option::Some(lifted665) + Option::Some(lifted667) } _ => panic() } - array667.push(@types.SchemaTypeNode::{ - body: lifted653, + array669.push(@types.SchemaTypeNode::{ + body: lifted655, metadata: @types.MetadataEnvelope::{ - doc: lifted655, - aliases: array657, - examples: array660, - deprecated: lifted663, - role: lifted666, + doc: lifted657, + aliases: array659, + examples: array662, + deprecated: lifted665, + role: lifted668, }, }) } mbt_ffi_free(mbt_ffi_load32(return_area + 12)) - let array672 : Array[@types.SchemaTypeDef] = [] - for index673 = 0 - index673 < mbt_ffi_load32(return_area + 24) - index673 = index673 + 1 { - let iter_base = mbt_ffi_load32(return_area + 20) + index673 * 24 + let array674 : Array[@types.SchemaTypeDef] = [] + for index675 = 0 + index675 < mbt_ffi_load32(return_area + 24) + index675 = index675 + 1 { + let iter_base = mbt_ffi_load32(return_area + 20) + index675 * 24 - let result669 = mbt_ffi_ptr2str( + let result671 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted671 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted673 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result670 = mbt_ffi_ptr2str( + let result672 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result670) + Option::Some(result672) } _ => panic() } - array672.push(@types.SchemaTypeDef::{ - id: result669, - name: lifted671, + array674.push(@types.SchemaTypeDef::{ + id: result671, + name: lifted673, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(return_area + 20)) - let array703 : Array[@types.SchemaValueNode] = [] - for index704 = 0 - index704 < mbt_ffi_load32(return_area + 36) - index704 = index704 + 1 { - let iter_base = mbt_ffi_load32(return_area + 32) + index704 * 32 + let array705 : Array[@types.SchemaValueNode] = [] + for index706 = 0 + index706 < mbt_ffi_load32(return_area + 36) + index706 = index706 + 1 { + let iter_base = mbt_ffi_load32(return_area + 32) + index706 * 32 - let lifted702 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted704 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -28739,29 +28913,29 @@ pub fn ToolRpc::invoke( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result674 = mbt_ffi_ptr2str( + let result676 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result674) + @types.SchemaValueNode::StringValue(result676) } 13 => { - let array675 : Array[Int] = [] - for index676 = 0 - index676 < mbt_ffi_load32(iter_base + 12) - index676 = index676 + 1 { + let array677 : Array[Int] = [] + for index678 = 0 + index678 < mbt_ffi_load32(iter_base + 12) + index678 = index678 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index676 * 4 + index678 * 4 - array675.push(mbt_ffi_load32(iter_base + 0)) + array677.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array675) + @types.SchemaValueNode::RecordValue(array677) } 14 => { - let lifted677 : Int? = match + let lifted679 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -28770,7 +28944,7 @@ pub fn ToolRpc::invoke( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted677, + payload: lifted679, }) } 15 => @@ -28778,34 +28952,20 @@ pub fn ToolRpc::invoke( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array678 : Array[Bool] = [] - for index679 = 0 - index679 < mbt_ffi_load32(iter_base + 12) - index679 = index679 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index679 * 1 - - array678.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array678) - } - 17 => { - let array680 : Array[Int] = [] + let array680 : Array[Bool] = [] for index681 = 0 index681 < mbt_ffi_load32(iter_base + 12) index681 = index681 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index681 * 4 + index681 * 1 - array680.push(mbt_ffi_load32(iter_base + 0)) + array680.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array680) + @types.SchemaValueNode::FlagsValue(array680) } - 18 => { + 17 => { let array682 : Array[Int] = [] for index683 = 0 index683 < mbt_ffi_load32(iter_base + 12) @@ -28817,9 +28977,9 @@ pub fn ToolRpc::invoke( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array682) + @types.SchemaValueNode::TupleValue(array682) } - 19 => { + 18 => { let array684 : Array[Int] = [] for index685 = 0 index685 < mbt_ffi_load32(iter_base + 12) @@ -28831,127 +28991,141 @@ pub fn ToolRpc::invoke( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array684) + @types.SchemaValueNode::ListValue(array684) } - 20 => { - let array686 : Array[@types.MapEntry] = [] + 19 => { + let array686 : Array[Int] = [] for index687 = 0 index687 < mbt_ffi_load32(iter_base + 12) index687 = index687 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index687 * 8 + index687 * 4 + + array686.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array686) + } + 20 => { + let array688 : Array[@types.MapEntry] = [] + for index689 = 0 + index689 < mbt_ffi_load32(iter_base + 12) + index689 = index689 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index689 * 8 - array686.push(@types.MapEntry::{ + array688.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array686) + @types.SchemaValueNode::MapValue(array688) } 21 => { - let lifted688 : Int? = match + let lifted690 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted688) + @types.SchemaValueNode::OptionValue(lifted690) } 22 => { - let lifted691 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted693 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted689 : Int? = match + let lifted691 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted689) + @types.ResultValuePayload::OkValue(lifted691) } 1 => { - let lifted690 : Int? = match + let lifted692 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted690) + @types.ResultValuePayload::ErrValue(lifted692) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted691) + @types.SchemaValueNode::ResultValue(lifted693) } 23 => { - let result692 = mbt_ffi_ptr2str( + let result694 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted694 : String? = match + let lifted696 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result693 = mbt_ffi_ptr2str( + let result695 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result693) + Option::Some(result695) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result692, - language: lifted694, + text: result694, + language: lifted696, }) } 24 => { - let result695 = mbt_ffi_ptr2bytes( + let result697 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted697 : String? = match + let lifted699 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result696 = mbt_ffi_ptr2str( + let result698 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result696) + Option::Some(result698) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result695, - mime_type: lifted697, + bytes: result697, + mime_type: lifted699, }) } 25 => { - let result698 = mbt_ffi_ptr2str( + let result700 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result698) + @types.SchemaValueNode::PathValue(result700) } 26 => { - let result699 = mbt_ffi_ptr2str( + let result701 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result699) + @types.SchemaValueNode::UrlValue(result701) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -28963,7 +29137,7 @@ pub fn ToolRpc::invoke( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result700 = mbt_ffi_ptr2str( + let result702 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -28971,17 +29145,17 @@ pub fn ToolRpc::invoke( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result700, + unit: result702, }) } 30 => { - let result701 = mbt_ffi_ptr2str( + let result703 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result701, + tag: result703, body: mbt_ffi_load32(iter_base + 16), }) } @@ -28995,21 +29169,27 @@ pub fn ToolRpc::invoke( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array703.push(lifted702) + array705.push(lifted704) } mbt_ffi_free(mbt_ffi_load32(return_area + 32)) @common.ToolError::CustomError(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array667, - defs: array672, + type_nodes: array669, + defs: array674, root: mbt_ffi_load32(return_area + 28), }, value: @types.SchemaValueTree::{ - value_nodes: array703, + value_nodes: array705, root: mbt_ffi_load32(return_area + 40), }, }) @@ -29017,20 +29197,20 @@ pub fn ToolRpc::invoke( _ => panic() } - RpcError::RemoteToolError(lifted705) + RpcError::RemoteToolError(lifted707) } _ => panic() } - Result::Err(lifted706) + Result::Err(lifted708) } _ => panic() } - let ret = lifted707 + let ret = lifted709 mbt_ffi_free(address) mbt_ffi_free(address360) mbt_ffi_free(address366) - mbt_ffi_free(address438) + mbt_ffi_free(address440) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -31442,12 +31622,12 @@ pub fn ToolRpc::async_invoke_and_await( cleanup_list.push(ptr362) } - let address438 = mbt_ffi_malloc(input.value.value_nodes.length() * 32) - for index439 = 0 - index439 < input.value.value_nodes.length() - index439 = index439 + 1 { - let iter_elem : @types.SchemaValueNode = input.value.value_nodes[index439] - let iter_base = address438 + index439 * 32 + let address440 = mbt_ffi_malloc(input.value.value_nodes.length() * 32) + for index441 = 0 + index441 < input.value.value_nodes.length() + index441 = index441 + 1 { + let iter_elem : @types.SchemaValueNode = input.value.value_nodes[index441] + let iter_base = address440 + index441 * 32 match iter_elem { BoolValue(payload368) => { @@ -31856,42 +32036,50 @@ pub fn ToolRpc::async_invoke_and_await( let @types.QuotaToken(handle437) = payload436 mbt_ffi_store32(iter_base + 8, handle437) + () + } + StreamValue(payload438) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle439) = payload438 + mbt_ffi_store32(iter_base + 8, handle439) + () } } } - let (lowered, lowered442) = match stdin { + let (lowered, lowered444) = match stdin { None => (0, 0) - Some(payload441) => + Some(payload443) => ( 1, wasmGolemToolHost010MethodToolRpcAsyncInvokeAndAwaitStream0StreamLower( - payload441, + payload443, ), ) } let lower_arg = handle - let lower_arg443 = address - let lower_arg444 = command_path.length() - let lower_arg445 = address360 - let lower_arg446 = input.graph.type_nodes.length() - let lower_arg447 = address366 - let lower_arg448 = input.graph.defs.length() - let lower_arg449 = input.graph.root - let lower_arg450 = address438 - let lower_arg451 = input.value.value_nodes.length() - let lower_arg452 = input.value.root - let lower_arg453 = lowered - let lower_arg454 = lowered442 + let lower_arg445 = address + let lower_arg446 = command_path.length() + let lower_arg447 = address360 + let lower_arg448 = input.graph.type_nodes.length() + let lower_arg449 = address366 + let lower_arg450 = input.graph.defs.length() + let lower_arg451 = input.graph.root + let lower_arg452 = address440 + let lower_arg453 = input.value.value_nodes.length() + let lower_arg454 = input.value.root + let lower_arg455 = lowered + let lower_arg456 = lowered444 let result : Int = wasmImportMethodToolRpcAsyncInvokeAndAwait( - lower_arg, lower_arg443, lower_arg444, lower_arg445, lower_arg446, lower_arg447, - lower_arg448, lower_arg449, lower_arg450, lower_arg451, lower_arg452, lower_arg453, - lower_arg454, + lower_arg, lower_arg445, lower_arg446, lower_arg447, lower_arg448, lower_arg449, + lower_arg450, lower_arg451, lower_arg452, lower_arg453, lower_arg454, lower_arg455, + lower_arg456, ) - for index458 = 0; index458 < lower_arg446; index458 = index458 + 1 { - let iter_base = lower_arg445 + index458 * 144 + for index460 = 0; index460 < lower_arg448; index460 = index460 + 1 { + let iter_base = lower_arg447 + index460 * 144 match mbt_ffi_load8_u(iter_base + 0) { 0 => () @@ -32009,10 +32197,10 @@ pub fn ToolRpc::async_invoke_and_await( 12 => () 13 => () 14 => - for index455 = 0 - index455 < mbt_ffi_load32(iter_base + 12) - index455 = index455 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index455 * 68 + for index457 = 0 + index457 < mbt_ffi_load32(iter_base + 12) + index457 = index457 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index457 * 68 match mbt_ffi_load8_u(iter_base + 12) { 0 => () @@ -32040,10 +32228,10 @@ pub fn ToolRpc::async_invoke_and_await( } } 15 => - for index456 = 0 - index456 < mbt_ffi_load32(iter_base + 12) - index456 = index456 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index456 * 72 + for index458 = 0 + index458 < mbt_ffi_load32(iter_base + 12) + index458 = index458 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index458 * 72 match mbt_ffi_load8_u(iter_base + 16) { 0 => () @@ -32139,10 +32327,10 @@ pub fn ToolRpc::async_invoke_and_await( } } 31 => - for index457 = 0 - index457 < mbt_ffi_load32(iter_base + 12) - index457 = index457 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index457 * 92 + for index459 = 0 + index459 < mbt_ffi_load32(iter_base + 12) + index459 = index459 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index459 * 92 match mbt_ffi_load8_u(iter_base + 12) { 0 => () @@ -32227,8 +32415,8 @@ pub fn ToolRpc::async_invoke_and_await( } } - for index459 = 0; index459 < lower_arg448; index459 = index459 + 1 { - let iter_base = lower_arg447 + index459 * 24 + for index461 = 0; index461 < lower_arg450; index461 = index461 + 1 { + let iter_base = lower_arg449 + index461 * 24 match mbt_ffi_load8_u(iter_base + 8) { 0 => () @@ -32237,8 +32425,8 @@ pub fn ToolRpc::async_invoke_and_await( } } - for index460 = 0; index460 < lower_arg451; index460 = index460 + 1 { - let iter_base = lower_arg450 + index460 * 32 + for index462 = 0; index462 < lower_arg453; index462 = index462 + 1 { + let iter_base = lower_arg452 + index462 * 32 match mbt_ffi_load8_u(iter_base + 0) { 0 => () @@ -32284,15 +32472,16 @@ pub fn ToolRpc::async_invoke_and_await( 30 => () 31 => () 32 => () + 33 => () _ => panic() } } - match lower_arg453 { + match lower_arg455 { 0 => () 1 => wasmGolemToolHost010MethodToolRpcAsyncInvokeAndAwaitStream0StreamCommit( - lower_arg454, + lower_arg456, ) _ => panic() } @@ -32300,7 +32489,7 @@ pub fn ToolRpc::async_invoke_and_await( mbt_ffi_free(address) mbt_ffi_free(address360) mbt_ffi_free(address366) - mbt_ffi_free(address438) + mbt_ffi_free(address440) cleanup_list.each(mbt_ffi_free) return ret @@ -32905,6 +33094,10 @@ pub async fn FutureInvokeResult::get( @types.Secret::Secret(mbt_ffi_load32(iter_base + 8)).drop() 32 => @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)).drop() + 33 => + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ).drop() _ => panic() } } @@ -33537,6 +33730,10 @@ pub async fn FutureInvokeResult::get( @types.QuotaToken::QuotaToken( mbt_ffi_load32(iter_base + 8), ).drop() + 33 => + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ).drop() _ => panic() } } @@ -35631,6 +35828,12 @@ pub async fn FutureInvokeResult::get( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -37910,6 +38113,12 @@ pub async fn FutureInvokeResult::get( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } diff --git a/sdks/moonbit/golem_sdk/interface/golem/websocket/client/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/websocket/client/ffi.mbt index e3b5899e87..78ae54d231 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/websocket/client/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/websocket/client/ffi.mbt @@ -44,34 +44,30 @@ fn wasmImportMethodWebsocketConnectionClose( ) = "golem:websocket/client@1.5.0" "[method]websocket-connection.close" ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load16_u) -///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) - ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = @@ -81,15 +77,19 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.get 1) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #|(func (param i32) (param i32) (result i32) #| local.get 0 - #| local.get 1 call $moonbit.init_array16 + #| local.get 1 call $moonbit.init_array8 #| local.get 0) ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) #| local.get 0 - #| local.get 1 call $moonbit.init_array8 + #| local.get 1 call $moonbit.init_array16 #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/blobstore/blobstore/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/blobstore/blobstore/ffi.mbt index cc32af6106..eb67dcdca5 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/blobstore/blobstore/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/blobstore/blobstore/ffi.mbt @@ -51,6 +51,10 @@ extern "wasm" fn mbt_ffi_free(position : Int) = extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) + ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #|(func (param i32) (result i32) (local i32) @@ -64,7 +68,3 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0 #| local.get 1 call $moonbit.init_array16 #| local.get 0) - -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/blobstore/container/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/blobstore/container/ffi.mbt index d3b59f1569..d1b3465e4b 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/blobstore/container/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/blobstore/container/ffi.mbt @@ -322,29 +322,14 @@ fn wasmImportMethodContainerObjectInfo(p0 : Int, p1 : Int, p2 : Int, p3 : Int) = ///| fn wasmImportMethodContainerClear(p0 : Int, p1 : Int) = "wasi:blobstore/container" "[method]container.clear" -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) - -///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) - -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - ///| #owned(str) extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = @@ -354,9 +339,24 @@ extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = #|(func (param i32) (result i64) local.get 0 i64.load) +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) #| local.get 0 #| local.get 1 call $moonbit.init_array16 #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/blobstore/types/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/blobstore/types/ffi.mbt index 4215db43a1..c5b0a1fe83 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/blobstore/types/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/blobstore/types/ffi.mbt @@ -811,11 +811,8 @@ extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = @@ -828,17 +825,20 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.tee 1 i32.const 0 call $moonbit.init_array8 #| local.get 1) -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) - -///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) - ///| extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #|(func (param i32) (param i32) (result i32) #| local.get 0 #| local.get 1 call $moonbit.init_array8 #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/cli/environment/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/cli/environment/ffi.mbt index 39a8ec6d1e..874d5f2177 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/cli/environment/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/cli/environment/ffi.mbt @@ -9,24 +9,24 @@ fn wasmImportGetArguments(p0 : Int) = "wasi:cli/environment@0.3.0" "get-argument ///| fn wasmImportGetInitialCwd(p0 : Int) = "wasi:cli/environment@0.3.0" "get-initial-cwd" -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = diff --git a/sdks/moonbit/golem_sdk/interface/wasi/clocks/system-clock/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/clocks/system-clock/ffi.mbt index fcf6a7cda2..3b7e689717 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/clocks/system-clock/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/clocks/system-clock/ffi.mbt @@ -6,21 +6,21 @@ fn wasmImportNow(p0 : Int) = "wasi:clocks/system-clock@0.3.0" "now" ///| fn wasmImportGetResolution() -> Int64 = "wasi:clocks/system-clock@0.3.0" "get-resolution" -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + ///| extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/config/store/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/config/store/ffi.mbt index 9c44bd5d22..2f1983f8fe 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/config/store/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/config/store/ffi.mbt @@ -11,6 +11,14 @@ fn wasmImportGetAll(p0 : Int) = "wasi:config/store@0.2.0-draft" "get-all" extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = #|(func (param i32) (result i32) local.get 0) +///| +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) @@ -22,17 +30,9 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.tee 1 i32.const 0 call $moonbit.init_array8 #| local.get 1) -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) - ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) #| local.get 0 #| local.get 1 call $moonbit.init_array16 #| local.get 0) - -///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/filesystem/preopens/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/filesystem/preopens/ffi.mbt index 7f5194eed2..8699a1be5a 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/filesystem/preopens/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/filesystem/preopens/ffi.mbt @@ -3,6 +3,10 @@ ///| fn wasmImportGetDirectories(p0 : Int) = "wasi:filesystem/preopens@0.3.0" "get-directories" +///| +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) + ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) @@ -14,10 +18,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.tee 1 i32.const 0 call $moonbit.init_array8 #| local.get 1) -///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) - ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #|(func (param i32) (param i32) (result i32) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/filesystem/types/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/filesystem/types/ffi.mbt index fc23e7a6ba..6c4bb5ae11 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/filesystem/types/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/filesystem/types/ffi.mbt @@ -3142,33 +3142,40 @@ fn wasmImportMethodDescriptorMetadataHashAt( p4 : Int, ) -> Int = "wasi:filesystem/types@0.3.0" "[async-lower][method]descriptor.metadata-hash-at" +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) + ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) - -///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = @@ -3178,20 +3185,13 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/http/client/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/http/client/ffi.mbt index e8f5bbe8bb..b0c37d8cff 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/http/client/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/http/client/ffi.mbt @@ -8,31 +8,31 @@ extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - -///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/http/types/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/http/types/ffi.mbt index f8fa1be1f6..ef06d99642 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/http/types/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/http/types/ffi.mbt @@ -9918,11 +9918,18 @@ fn wasmWasiHttpTypes030StaticResponseConsumeBodyFuture2FutureLift( } ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = @@ -9937,8 +9944,8 @@ extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = @@ -9948,26 +9955,11 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.get 1) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) - -///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) - -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) - -///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) - -///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = @@ -9977,9 +9969,17 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/io/error/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/io/error/ffi.mbt index 2e572a5282..25c62349d8 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/io/error/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/io/error/ffi.mbt @@ -6,17 +6,14 @@ fn wasmImportResourceDropError_(resource : Int) = "wasi:io/error@0.2.6" "[resour ///| fn wasmImportMethodErrorToDebugString(p0 : Int, p1 : Int) = "wasi:io/error@0.2.6" "[method]error.to-debug-string" -///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) - ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #|(func (param i32) (result i32) (local i32) @@ -25,5 +22,8 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.get 1) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/io/error/pkg.generated.mbti b/sdks/moonbit/golem_sdk/interface/wasi/io/error/pkg.generated.mbti index 8fafbdfe38..980e73427f 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/io/error/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk/interface/wasi/io/error/pkg.generated.mbti @@ -4,9 +4,7 @@ package "golemcloud/golem_sdk/interface/wasi/io/error" // Values // Errors -pub(all) suberror Error_ { - Error_(Int) -} derive(Eq, Show) +pub(all) suberror Error_ Int derive(Eq, Show) pub fn Error_::drop(Self) -> Unit pub fn Error_::to_debug_string(Self) -> String diff --git a/sdks/moonbit/golem_sdk/interface/wasi/io/poll/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/io/poll/ffi.mbt index 5f56853eb6..18212beb4d 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/io/poll/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/io/poll/ffi.mbt @@ -16,10 +16,6 @@ fn wasmImportPoll(p0 : Int, p1 : Int, p2 : Int) = "wasi:io/poll@0.2.6" "poll" extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) -///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) - ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) @@ -40,3 +36,7 @@ extern "wasm" fn mbt_ffi_ptr2uint_array( #| local.get 0 #| local.get 1 call $moonbit.init_array32 #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/io/streams/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/io/streams/ffi.mbt index 0161fd9e7c..e9bd6ddaff 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/io/streams/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/io/streams/ffi.mbt @@ -66,36 +66,36 @@ fn wasmImportMethodOutputStreamBlockingSplice( ) = "wasi:io/streams@0.2.6" "[method]output-stream.blocking-splice" ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - -///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/cache/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/cache/ffi.mbt index 8f004a0f9f..be90edf566 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/cache/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/cache/ffi.mbt @@ -45,10 +45,6 @@ fn wasmImportMethodVacancyVacancyFill(p0 : Int, p1 : Int, p2 : Int) -> Int = "wa ///| fn wasmImportDelete(p0 : Int, p1 : Int) -> Int = "wasi:keyvalue/cache@0.1.0" "delete" -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) - ///| #owned(str) extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = @@ -62,6 +58,10 @@ extern "wasm" fn mbt_ffi_free(position : Int) = extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) + ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #|(func (param i32) (result i32) (local i32) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/eventual-batch/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/eventual-batch/ffi.mbt index fdae86e03e..6b087b3427 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/eventual-batch/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/eventual-batch/ffi.mbt @@ -12,15 +12,23 @@ fn wasmImportSetMany(p0 : Int, p1 : Int, p2 : Int, p3 : Int) = "wasi:keyvalue/ev ///| fn wasmImportDeleteMany(p0 : Int, p1 : Int, p2 : Int, p3 : Int) = "wasi:keyvalue/eventual-batch@0.1.0" "delete-many" -///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) - ///| #owned(str) extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = #|(func (param i32) (result i32) local.get 0) +///| +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) + ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #|(func (param i32) (result i32) (local i32) @@ -36,13 +44,5 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) - -///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) - -///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/eventual/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/eventual/ffi.mbt index 1916a11c2a..843069b736 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/eventual/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/eventual/ffi.mbt @@ -17,13 +17,6 @@ fn wasmImportExists(p0 : Int, p1 : Int, p2 : Int, p3 : Int) = "wasi:keyvalue/eve extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = #|(func (param i32) (result i32) local.get 0) -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) - ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) @@ -35,3 +28,10 @@ extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/types/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/types/ffi.mbt index 41af986568..e680be5eb3 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/types/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/types/ffi.mbt @@ -822,24 +822,38 @@ fn wasmWasiKeyvalueTypes010MethodIncomingValueIncomingValueConsumeAsyncStream0St fn wasmImportMethodIncomingValueIncomingValueSize(p0 : Int, p1 : Int) = "wasi:keyvalue/types@0.1.0" "[method]incoming-value.incoming-value-size" ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| extern "wasm" fn mbt_ffi_free(position : Int) = #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + ///| extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #|(func (param i32) (param i32) (result i32) @@ -848,19 +862,5 @@ extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) - -///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) - -///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) - -///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error/ffi.mbt b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error/ffi.mbt index f0fd8284f1..37006c8786 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error/ffi.mbt @@ -7,15 +7,12 @@ fn wasmImportResourceDropError_(resource : Int) = "wasi:keyvalue/wasi-keyvalue-e fn wasmImportMethodErrorTrace(p0 : Int, p1 : Int) = "wasi:keyvalue/wasi-keyvalue-error@0.1.0" "[method]error.trace" ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = @@ -25,5 +22,8 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = #| local.get 1) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) diff --git a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error/pkg.generated.mbti b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error/pkg.generated.mbti index 26c75b2900..b713d3b3bf 100644 --- a/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error/pkg.generated.mbti @@ -4,9 +4,7 @@ package "golemcloud/golem_sdk/interface/wasi/keyvalue/wasi-keyvalue-error" // Values // Errors -pub(all) suberror Error_ { - Error_(Int) -} derive(Eq, Show) +pub(all) suberror Error_ Int derive(Eq, Show) pub fn Error_::drop(Self) -> Unit pub fn Error_::trace(Self) -> String diff --git a/sdks/moonbit/golem_sdk/moon.mod b/sdks/moonbit/golem_sdk/moon.mod new file mode 100644 index 0000000000..e4da4a21b1 --- /dev/null +++ b/sdks/moonbit/golem_sdk/moon.mod @@ -0,0 +1,27 @@ +name = "golemcloud/golem_sdk" + +version = "0.5.1" + +readme = "README.mbt.md" + +repository = "https://github.com/golemcloud/moonbit-sdk" + +license = "Apache-2.0" + +keywords = [ + "golem", + "wasm", + "agent", + "sdk", + "webassembly", + "durable", + "component-model", +] + +description = "Golem SDK for MoonBit — build durable, fault-tolerant agents on the Golem platform" + +preferred_target = "wasm" + +options( + scripts: { "bindgen": "bash scripts/regen-bindings.sh" }, +) diff --git a/sdks/moonbit/golem_sdk/moon.mod.json b/sdks/moonbit/golem_sdk/moon.mod.json deleted file mode 100644 index 8951c04be6..0000000000 --- a/sdks/moonbit/golem_sdk/moon.mod.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "golemcloud/golem_sdk", - "version": "0.5.1", - "readme": "README.mbt.md", - "repository": "https://github.com/golemcloud/moonbit-sdk", - "license": "Apache-2.0", - "keywords": ["golem", "wasm", "agent", "sdk", "webassembly", "durable", "component-model"], - "description": "Golem SDK for MoonBit — build durable, fault-tolerant agents on the Golem platform", - "scripts": { - "bindgen": "bash scripts/regen-bindings.sh" - }, - "preferred-target": "wasm" -} diff --git a/sdks/moonbit/golem_sdk/quota/tests.mbt b/sdks/moonbit/golem_sdk/quota/tests.mbt index aa4974ba2d..d3aa458ab7 100644 --- a/sdks/moonbit/golem_sdk/quota/tests.mbt +++ b/sdks/moonbit/golem_sdk/quota/tests.mbt @@ -56,12 +56,51 @@ test "QuotaToken lowers to an opaque quota-token schema value" { } ///| -test "QuotaToken lifts back from an opaque quota-token schema value" { +test "QuotaToken lifting shares the take-once holder" { let handle = @model.GuestQuotaTokenHandle::new( @types.QuotaToken::QuotaToken(0), ) let sv : @model.SchemaValue = QuotaToken(handle) - let _ : QuotaToken = @schema.from_value_as(sv) + let token : QuotaToken = @schema.from_value_as(sv) + assert_true(handle.is_present()) + assert_true(token.handle.is_present()) + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { dropped[0] += 1 }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + } + @model.SchemaValue::QuotaToken(token.handle).release_resources(drops) + sv.release_resources(drops) + assert_eq(dropped[0], 1) +} + +///| +test "QuotaToken compound conversion rolls back through the source tree" { + let handle = @model.GuestQuotaTokenHandle::new( + @types.QuotaToken::QuotaToken(1), + ) + let source = @model.SchemaValue::List([ + @model.SchemaValue::QuotaToken(handle), + @model.SchemaValue::String("not a quota token"), + ]) + let result : Result[Array[QuotaToken], @schema.FromSchemaError] = try? @schema.from_value_as( + source, + ) + guard result is Err(_) else { + fail("the second array element must reject the conversion") + } + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { dropped[0] += 1 }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + } + source.release_resources(drops) + assert_false(handle.is_present()) + assert_eq(dropped[0], 1) } ///| diff --git a/sdks/moonbit/golem_sdk/schema/agent_stream.mbt b/sdks/moonbit/golem_sdk/schema/agent_stream.mbt new file mode 100644 index 0000000000..eae39dbe45 --- /dev/null +++ b/sdks/moonbit/golem_sdk/schema/agent_stream.mbt @@ -0,0 +1,90 @@ +///| +/// A demand-driven agent stream. The native component reader is retained in +/// the schema value and transferred affinely; no producer task or buffer is +/// introduced by this wrapper. +pub(all) struct AgentStream[T] { + priv handle : @model.GuestSchemaValueStreamHandle +} + +///| +pub fn[T] AgentStream::from_reader( + reader : @async-core.Stream[@types.SchemaValueTree], +) -> AgentStream[T] { + { handle: @model.GuestSchemaValueStreamHandle::from_native(reader) } +} + +///| +/// Close this stream without reading any remaining items. Dropping an already +/// consumed or closed stream has no effect. +pub fn[T] AgentStream::drop(self : AgentStream[T]) -> Unit { + @model.SchemaValue::Stream(self.handle).release_resources( + @model_host.resource_drops(), + ) +} + +///| +pub async fn[T : FromSchema] AgentStream::read( + self : AgentStream[T], +) -> T? raise FromSchemaError { + let reader = self.handle.take_or_unwrap_native() catch { + e => + raise FromSchemaError::custom("agent stream is no longer readable: \{e}") + } + let chunk = reader.read(1) catch { + e => { + self.handle.put_native(reader) + raise FromSchemaError::custom("failed reading agent stream: \{e}") + } + } + // Reassociate the exact same reader after each pull. + self.handle.put_native(reader) + match chunk { + None => { + self.drop() + None + } + Some(values) if values.length() == 0 => self.read() + Some(values) => { + let drops = @model_host.resource_drops() + let value = @model_host.schema_value_from_wit(values[0]) catch { + e => raise FromSchemaError::custom("invalid agent stream item: \{e}") + } + try Some(from_value_as(value)) catch { + e => { + value.release_resources(drops) + raise e + } + } noraise { + result => result + } + } + } +} + +///| +pub impl[T : IntoSchema] IntoSchema for AgentStream[T] with fn type_id() { + type_id_with_args("golem.AgentStream", [T::type_id()]) +} + +///| +pub impl[T : IntoSchema] IntoSchema for AgentStream[T] with fn register_in(b) { + @model.schema_type(@model.SchemaTypeBody::Stream(Some(T::register_in(b)))) +} + +///| +pub impl[T : IntoSchema] IntoSchema for AgentStream[T] with fn to_value(self) { + @model.SchemaValue::Stream(self.handle) +} + +///| +pub impl[T] FromSchema for AgentStream[T] with fn from_value(value) { + match value { + @model.SchemaValue::Stream(handle) => { handle, } + other => + raise FromSchemaError::shape_mismatch( + "stream", + value_kind(other), + "AgentStream", + ) + } +} diff --git a/sdks/moonbit/golem_sdk/schema/moon.pkg b/sdks/moonbit/golem_sdk/schema/moon.pkg index 55ba6f91a7..256fc559ff 100644 --- a/sdks/moonbit/golem_sdk/schema/moon.pkg +++ b/sdks/moonbit/golem_sdk/schema/moon.pkg @@ -1,9 +1,12 @@ import { + "golemcloud/golem_sdk/async-core", "golemcloud/golem_sdk/interface/golem/core/types", "golemcloud/golem_sdk/schema_model" @model, + "golemcloud/golem_sdk/schema_model_host" @model_host, } import { + "golemcloud/golem_sdk/async-core", "golemcloud/golem_sdk/interface/golem/core/types", "golemcloud/golem_sdk/schema_model" @model, } for "test" diff --git a/sdks/moonbit/golem_sdk/schema/pkg.generated.mbti b/sdks/moonbit/golem_sdk/schema/pkg.generated.mbti index e57179dac7..8fec7db037 100644 --- a/sdks/moonbit/golem_sdk/schema/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk/schema/pkg.generated.mbti @@ -2,6 +2,7 @@ package "golemcloud/golem_sdk/schema" import { + "golemcloud/golem_sdk/async-core", "golemcloud/golem_sdk/interface/golem/core/types", "golemcloud/golem_sdk/schema_model", } @@ -53,6 +54,15 @@ pub fn FromSchemaError::out_of_range(UInt, UInt, String) -> Self pub fn FromSchemaError::shape_mismatch(String, String, String) -> Self // Types and methods +pub(all) struct AgentStream[T] { + // private fields +} +pub fn[T] AgentStream::drop(Self[T]) -> Unit +pub fn[T] AgentStream::from_reader(@async-core.Stream[@types.SchemaValueTree]) -> Self[T] +pub async fn[T : FromSchema] AgentStream::read(Self[T]) -> T? raise FromSchemaError +pub impl[T] FromSchema for AgentStream[T] +pub impl[T : IntoSchema] IntoSchema for AgentStream[T] + pub(all) struct Duration { nanoseconds : Int64 } derive(Eq, Show) diff --git a/sdks/moonbit/golem_sdk/schema/records_test.mbt b/sdks/moonbit/golem_sdk/schema/records_test.mbt index d7c4c6879b..b3c3f0345f 100644 --- a/sdks/moonbit/golem_sdk/schema/records_test.mbt +++ b/sdks/moonbit/golem_sdk/schema/records_test.mbt @@ -18,7 +18,12 @@ fn[T : IntoSchema + FromSchema] rt(v : T) -> T raise { let typed = try_into_typed_schema_value(v) let wit = @model.typed_schema_value_to_wit(typed) - let back = @model.typed_schema_value_from_wit(wit) + let back = @model.typed_schema_value_from_wit(wit, { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + }) assert_eq(back.graph, typed.graph) T::from_value(back.value) } diff --git a/sdks/moonbit/golem_sdk/schema/rich_types_test.mbt b/sdks/moonbit/golem_sdk/schema/rich_types_test.mbt index 9c8560cea1..425f2da72f 100644 --- a/sdks/moonbit/golem_sdk/schema/rich_types_test.mbt +++ b/sdks/moonbit/golem_sdk/schema/rich_types_test.mbt @@ -20,7 +20,12 @@ impl QuantityUnit for TestBytesUnit with fn allowed_suffixes() { fn[T : IntoSchema + FromSchema] rich_roundtrip(v : T) -> T raise { let typed = try_into_typed_schema_value(v) let wit = @model.typed_schema_value_to_wit(typed) - let back = @model.typed_schema_value_from_wit(wit) + let back = @model.typed_schema_value_from_wit(wit, { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + }) assert_eq(back.graph, typed.graph) T::from_value(back.value) } diff --git a/sdks/moonbit/golem_sdk/schema/schema.mbt b/sdks/moonbit/golem_sdk/schema/schema.mbt index d9c11e129c..013f0f6670 100644 --- a/sdks/moonbit/golem_sdk/schema/schema.mbt +++ b/sdks/moonbit/golem_sdk/schema/schema.mbt @@ -115,6 +115,7 @@ pub fn value_kind(v : @model.SchemaValue) -> String { Union(_, _) => "union" Secret(_) => "secret" QuotaToken(_) => "quota-token" + Stream(_) => "stream" } } diff --git a/sdks/moonbit/golem_sdk/schema/schema_test.mbt b/sdks/moonbit/golem_sdk/schema/schema_test.mbt index 456c65dce3..08a9f05567 100644 --- a/sdks/moonbit/golem_sdk/schema/schema_test.mbt +++ b/sdks/moonbit/golem_sdk/schema/schema_test.mbt @@ -7,12 +7,33 @@ // <--FromSchema-- value // and asserts the decoded value (and the schema graph) survive unchanged. +///| +struct StreamThenInt { + stream : AgentStream[Int] + value : Int +} + +///| +impl FromSchema for StreamThenInt with fn from_value(value) { + let fields = expect_record(value, "StreamThenInt") + let stream : AgentStream[Int] = from_value_as( + record_field(fields, 0, "StreamThenInt"), + ) + let decoded : Int = from_value_as(record_field(fields, 1, "StreamThenInt")) + { stream, value: decoded } +} + ///| /// Full encode -> WIT -> decode round-trip of a value through the schema layer. fn[T : IntoSchema + FromSchema] roundtrip(v : T) -> T raise { let typed = try_into_typed_schema_value(v) let wit = @model.typed_schema_value_to_wit(typed) - let back = @model.typed_schema_value_from_wit(wit) + let back = @model.typed_schema_value_from_wit(wit, { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + }) // The schema graph must survive the WIT round-trip unchanged. assert_eq(back.graph, typed.graph) T::from_value(back.value) @@ -109,3 +130,85 @@ test "shape mismatch surfaces a FromSchemaError" { assert_eq(actual, "string") assert_eq(context, "Int") } + +///| +test "AgentStream decoding shares the take-once stream holder" { + let source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(30), + ) + let stream : AgentStream[Int] = from_value_as( + @model.SchemaValue::Stream(source), + ) + assert_true(source.is_present()) + guard to_value_as(stream) is @model.SchemaValue::Stream(destination) else { + fail("expected an AgentStream schema value") + } + assert_true(destination.is_present()) + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + @model.SchemaValue::Stream(destination).release_resources(drops) + @model.SchemaValue::Stream(source).release_resources(drops) + assert_eq(dropped[0], 1) +} + +///| +test "compound conversion rollback retains ownership in the source tree" { + let array_handle = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(31), + ) + let array_source = @model.SchemaValue::List([ + @model.SchemaValue::Stream(array_handle), + @model.SchemaValue::S32(1), + ]) + let array_result : Result[Array[AgentStream[Int]], FromSchemaError] = try? from_value_as( + array_source, + ) + guard array_result is Err(_) else { + fail("the second array element must reject the conversion") + } + let tuple_handle = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(32), + ) + let tuple_source = @model.SchemaValue::Tuple([ + @model.SchemaValue::Stream(tuple_handle), + @model.SchemaValue::String("not an int"), + ]) + let tuple_result : Result[(AgentStream[Int], Int), FromSchemaError] = try? from_value_as( + tuple_source, + ) + guard tuple_result is Err(_) else { + fail("the second tuple element must reject the conversion") + } + let record_handle = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(33), + ) + let record_source = @model.SchemaValue::Record([ + @model.SchemaValue::Stream(record_handle), + @model.SchemaValue::String("not an int"), + ]) + let record_result : Result[StreamThenInt, FromSchemaError] = try? from_value_as( + record_source, + ) + guard record_result is Err(_) else { + fail("the second record field must reject the conversion") + } + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + array_source.release_resources(drops) + tuple_source.release_resources(drops) + record_source.release_resources(drops) + assert_false(array_handle.is_present()) + assert_false(tuple_handle.is_present()) + assert_false(record_handle.is_present()) + assert_eq(dropped[0], 3) +} diff --git a/sdks/moonbit/golem_sdk/schema_model/model.mbt b/sdks/moonbit/golem_sdk/schema_model/model.mbt index 44b69d62ad..0997567c4e 100644 --- a/sdks/moonbit/golem_sdk/schema_model/model.mbt +++ b/sdks/moonbit/golem_sdk/schema_model/model.mbt @@ -72,7 +72,7 @@ pub(all) enum SchemaTypeBody { // Capability nodes Secret(SecretSpec) QuotaToken(@types.QuotaTokenSpec) - // WASI P3 stubs (parseable only; no semantics yet) + // WASI P3 asynchronous values Future(SchemaType?) Stream(SchemaType?) } derive(Show, Eq) @@ -185,6 +185,8 @@ pub(all) enum SchemaValue { Secret(GuestSecretHandle) // owned `quota-token` resource carried as an opaque, affine handle QuotaToken(GuestQuotaTokenHandle) + // native stream endpoint, retained without proxying or materialization + Stream(GuestSchemaValueStreamHandle) } derive(Show, Eq) ///| @@ -205,6 +207,59 @@ pub(all) struct TypedSchemaValue { value : SchemaValue } derive(Show, Eq) +///| +/// Host-provided cleanup for owned resources rejected at a schema-value +/// boundary. +pub(all) struct SchemaValueResourceDrops { + drop_secret : (@types.Secret) -> Unit + drop_quota_token : (@types.QuotaToken) -> Unit + drop_stream : (@types.SchemaValueStream) -> Unit + drop_native_stream : (@async-core.Stream[@types.SchemaValueTree]) -> Unit +} + +///| +/// Release every resource still owned by this value. Handles are take-once, so +/// resources already transferred out of the value are left alone and repeated +/// cleanup is harmless. +pub fn SchemaValue::release_resources( + self : SchemaValue, + drops : SchemaValueResourceDrops, +) -> Unit { + match self { + Record(values) | Tuple(values) | List(values) | FixedList(values) => + for value in values { + value.release_resources(drops) + } + Variant(_, payload) + | Option(payload) + | ResultOk(payload) + | ResultErr(payload) => + match payload { + Some(value) => value.release_resources(drops) + None => () + } + Map(entries) => + for entry in entries { + entry.key.release_resources(drops) + entry.value.release_resources(drops) + } + Union(_, body) => body.release_resources(drops) + Secret(handle) => + match handle.take() { + Some(value) => (drops.drop_secret)(value) + None => () + } + QuotaToken(handle) => + match handle.take() { + Some(value) => (drops.drop_quota_token)(value) + None => () + } + Stream(handle) => + handle.release(drops.drop_stream, drops.drop_native_stream) + _ => () + } +} + // ============================================================ // Constructors / helpers // ============================================================ diff --git a/sdks/moonbit/golem_sdk/schema_model/moon.pkg b/sdks/moonbit/golem_sdk/schema_model/moon.pkg index 599cc20c47..12d8abc77c 100644 --- a/sdks/moonbit/golem_sdk/schema_model/moon.pkg +++ b/sdks/moonbit/golem_sdk/schema_model/moon.pkg @@ -1,7 +1,9 @@ import { + "golemcloud/golem_sdk/async-core", "golemcloud/golem_sdk/interface/golem/core/types", } import { + "golemcloud/golem_sdk/async-core", "golemcloud/golem_sdk/interface/golem/core/types", } for "test" diff --git a/sdks/moonbit/golem_sdk/schema_model/pkg.generated.mbti b/sdks/moonbit/golem_sdk/schema_model/pkg.generated.mbti index 71cfb24b34..ea188e942b 100644 --- a/sdks/moonbit/golem_sdk/schema_model/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk/schema_model/pkg.generated.mbti @@ -2,6 +2,7 @@ package "golemcloud/golem_sdk/schema_model" import { + "golemcloud/golem_sdk/async-core", "golemcloud/golem_sdk/interface/golem/core/types", } @@ -22,14 +23,18 @@ pub fn schema_graph_to_wit(SchemaGraph) -> @types.SchemaGraph raise SchemaModelE pub fn schema_type(SchemaTypeBody, metadata? : @types.MetadataEnvelope) -> SchemaType -pub fn schema_value_from_wit(@types.SchemaValueTree) -> SchemaValue raise SchemaModelError +pub fn schema_value_from_wit(@types.SchemaValueTree, SchemaValueResourceDrops) -> SchemaValue raise SchemaModelError pub fn schema_value_to_wit(SchemaValue) -> @types.SchemaValueTree raise SchemaModelError -pub fn typed_schema_value_from_wit(@types.TypedSchemaValue) -> TypedSchemaValue raise SchemaModelError +pub async fn schema_value_to_wit_async(SchemaValue) -> @types.SchemaValueTree raise SchemaModelError + +pub fn typed_schema_value_from_wit(@types.TypedSchemaValue, SchemaValueResourceDrops) -> TypedSchemaValue raise SchemaModelError pub fn typed_schema_value_to_wit(TypedSchemaValue) -> @types.TypedSchemaValue raise SchemaModelError +pub async fn typed_schema_value_to_wit_async(TypedSchemaValue) -> @types.TypedSchemaValue raise SchemaModelError + pub fn validate_graph(SchemaGraph) -> Array[SchemaError] pub fn variant_case(String, payload? : SchemaType, metadata? : @types.MetadataEnvelope) -> VariantCaseType @@ -103,6 +108,15 @@ pub fn GuestQuotaTokenHandle::new(@types.QuotaToken) -> Self pub fn GuestQuotaTokenHandle::take(Self) -> @types.QuotaToken? pub fn[R] GuestQuotaTokenHandle::with_handle(Self, (@types.QuotaToken) -> R) -> R? +pub(all) struct GuestSchemaValueStreamHandle { + // private fields +} +pub fn GuestSchemaValueStreamHandle::from_native(@async-core.Stream[@types.SchemaValueTree]) -> Self +pub fn GuestSchemaValueStreamHandle::from_wrapped(@types.SchemaValueStream) -> Self +pub fn GuestSchemaValueStreamHandle::is_present(Self) -> Bool +pub fn GuestSchemaValueStreamHandle::put_native(Self, @async-core.Stream[@types.SchemaValueTree]) -> Unit +pub async fn GuestSchemaValueStreamHandle::take_or_unwrap_native(Self) -> @async-core.Stream[@types.SchemaValueTree] raise SchemaModelError + pub(all) struct GuestSecretHandle { // private fields } @@ -230,7 +244,16 @@ pub(all) enum SchemaValue { Union(String, SchemaValue) Secret(GuestSecretHandle) QuotaToken(GuestQuotaTokenHandle) + Stream(GuestSchemaValueStreamHandle) } derive(Eq, Show) +pub fn SchemaValue::release_resources(Self, SchemaValueResourceDrops) -> Unit + +pub(all) struct SchemaValueResourceDrops { + drop_secret : (@types.Secret) -> Unit + drop_quota_token : (@types.QuotaToken) -> Unit + drop_stream : (@types.SchemaValueStream) -> Unit + drop_native_stream : (@async-core.Stream[@types.SchemaValueTree]) -> Unit +} pub(all) struct SecretSpec { inner : SchemaType diff --git a/sdks/moonbit/golem_sdk/schema_model/resource_cleanup_wbtest.mbt b/sdks/moonbit/golem_sdk/schema_model/resource_cleanup_wbtest.mbt new file mode 100644 index 0000000000..346ed9a73d --- /dev/null +++ b/sdks/moonbit/golem_sdk/schema_model/resource_cleanup_wbtest.mbt @@ -0,0 +1,174 @@ +///| +fn decode_with_drop_counts( + tree : @types.SchemaValueTree, +) -> (Result[SchemaValue, SchemaModelError], Array[Int]) { + let counts = [0, 0, 0] + let drops : SchemaValueResourceDrops = { + drop_secret: fn(_) { counts[0] += 1 }, + drop_quota_token: fn(_) { counts[1] += 1 }, + drop_stream: fn(_) { counts[2] += 1 }, + drop_native_stream: fn(_) { }, + } + let result = try? schema_value_from_wit(tree, drops) + (result, counts) +} + +///| +test "malformed duplicate raw handle is dropped exactly once" { + let raw = @types.QuotaToken::QuotaToken(12) + let tree : @types.SchemaValueTree = { + value_nodes: [ + @types.QuotaTokenHandle(raw), + @types.QuotaTokenHandle(raw), + @types.TupleValue([0, 1]), + ], + root: 2, + } + let (result, drops) = decode_with_drop_counts(tree) + guard result is Err(DecodeError(message)) else { + fail("expected DecodeError, got \{result}") + } + assert_true(message.contains("more than one handle node")) + assert_eq(drops, [0, 1, 0]) +} + +///| +test "multiply referenced handle is dropped when preflight rejects the tree" { + let tree : @types.SchemaValueTree = { + value_nodes: [ + @types.QuotaTokenHandle(@types.QuotaToken::QuotaToken(3)), + @types.TupleValue([0, 0]), + ], + root: 1, + } + let (result, drops) = decode_with_drop_counts(tree) + guard result is Err(DecodeError(message)) else { + fail("expected DecodeError, got \{result}") + } + assert_true(message.contains("more than once")) + assert_eq(drops, [0, 1, 0]) +} + +///| +test "unreachable handle is dropped when the whole tree is rejected" { + let tree : @types.SchemaValueTree = { + value_nodes: [ + @types.TupleValue([]), + @types.QuotaTokenHandle(@types.QuotaToken::QuotaToken(4)), + ], + root: 0, + } + let (result, drops) = decode_with_drop_counts(tree) + guard result is Err(DecodeError(message)) else { + fail("expected DecodeError, got \{result}") + } + assert_true(message.contains("not referenced from the root")) + assert_eq(drops, [0, 1, 0]) +} + +///| +test "preflight drops a stream when a later node is malformed" { + let tree : @types.SchemaValueTree = { + value_nodes: [ + @types.StreamValue(@types.SchemaValueStream::SchemaValueStream(5)), + @types.S8Value(128), + @types.TupleValue([0, 1]), + ], + root: 2, + } + let (result, drops) = decode_with_drop_counts(tree) + guard result is Err(DecodeError(_)) else { + fail("expected DecodeError, got \{result}") + } + assert_eq(drops, [0, 0, 1]) +} + +///| +test "malformed tree drops each distinct owned resource exactly once" { + let secret = @types.Secret::Secret(6) + let quota_token = @types.QuotaToken::QuotaToken(7) + let stream = @types.SchemaValueStream::SchemaValueStream(8) + let tree : @types.SchemaValueTree = { + value_nodes: [ + @types.SecretValue(secret), + @types.SecretValue(secret), + @types.QuotaTokenHandle(quota_token), + @types.QuotaTokenHandle(quota_token), + @types.StreamValue(stream), + @types.StreamValue(stream), + ], + root: 99, + } + let (result, drops) = decode_with_drop_counts(tree) + guard result is Err(DecodeError(_)) else { + fail("expected DecodeError, got \{result}") + } + assert_eq(drops, [1, 1, 1]) +} + +///| +test "successful decode transfers resources without dropping them" { + let tree : @types.SchemaValueTree = { + value_nodes: [ + @types.SecretValue(@types.Secret::Secret(9)), + @types.QuotaTokenHandle(@types.QuotaToken::QuotaToken(10)), + @types.StreamValue(@types.SchemaValueStream::SchemaValueStream(11)), + @types.TupleValue([0, 1, 2]), + ], + root: 3, + } + let (result, drops) = decode_with_drop_counts(tree) + guard result is Ok(Tuple([Secret(_), QuotaToken(_), Stream(_)])) else { + fail("expected successful capability tuple decode, got \{result}") + } + assert_eq(drops, [0, 0, 0]) +} + +///| +test "decoded values release every resource still owned exactly once" { + let tree : @types.SchemaValueTree = { + value_nodes: [ + @types.SecretValue(@types.Secret::Secret(20)), + @types.QuotaTokenHandle(@types.QuotaToken::QuotaToken(21)), + @types.StreamValue(@types.SchemaValueStream::SchemaValueStream(22)), + @types.TupleValue([0, 1, 2]), + ], + root: 3, + } + let counts = [0, 0, 0] + let drops : SchemaValueResourceDrops = { + drop_secret: fn(_) { counts[0] += 1 }, + drop_quota_token: fn(_) { counts[1] += 1 }, + drop_stream: fn(_) { counts[2] += 1 }, + drop_native_stream: fn(_) { }, + } + let value = schema_value_from_wit(tree, drops) + value.release_resources(drops) + value.release_resources(drops) + assert_eq(counts, [1, 1, 1]) +} + +///| +test "typed decode drops value resources when its graph is malformed" { + let counts = [0, 0, 0] + let drops : SchemaValueResourceDrops = { + drop_secret: fn(_) { counts[0] += 1 }, + drop_quota_token: fn(_) { counts[1] += 1 }, + drop_stream: fn(_) { counts[2] += 1 }, + drop_native_stream: fn(_) { }, + } + let typed : @types.TypedSchemaValue = { + graph: { type_nodes: [], root: 0, defs: [] }, + value: { + value_nodes: [ + @types.StreamValue(@types.SchemaValueStream::SchemaValueStream(12)), + ], + root: 0, + }, + } + let result = try? typed_schema_value_from_wit(typed, drops) + guard result is Err(DecodeError(_)) else { + fail("expected DecodeError, got \{result}") + } + assert_eq(counts, [0, 0, 1]) +} diff --git a/sdks/moonbit/golem_sdk/schema_model/roundtrip_test.mbt b/sdks/moonbit/golem_sdk/schema_model/roundtrip_test.mbt index ecf9c742ef..600426723e 100644 --- a/sdks/moonbit/golem_sdk/schema_model/roundtrip_test.mbt +++ b/sdks/moonbit/golem_sdk/schema_model/roundtrip_test.mbt @@ -7,6 +7,23 @@ // * malformed flat carriers rejected (out-of-range index, duplicate def id, // uncommitted reservation, structural cycle). +///| +fn test_resource_drops() -> SchemaValueResourceDrops { + { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + } +} + +///| +fn decode_test_value( + value : @types.SchemaValueTree, +) -> SchemaValue raise SchemaModelError { + schema_value_from_wit(value, test_resource_drops()) +} + ///| /// Round-trip a standalone type by wrapping it in a defs-less graph. fn rt_type(st : SchemaType) -> SchemaType raise { @@ -15,7 +32,7 @@ fn rt_type(st : SchemaType) -> SchemaType raise { ///| fn rt_value(v : SchemaValue) -> SchemaValue raise { - schema_value_from_wit(schema_value_to_wit(v)) + decode_test_value(schema_value_to_wit(v)) } ///| @@ -373,7 +390,7 @@ test "decode rejects a structural cycle in type nodes" { ///| test "decode rejects out-of-range value node index" { let bad : @types.SchemaValueTree = { value_nodes: [], root: 3 } - let r = try? schema_value_from_wit(bad) + let r = try? decode_test_value(bad) guard r is Err(DecodeError(msg)) else { fail("expected DecodeError, got \{r}") } @@ -525,7 +542,7 @@ test "decode rejects out-of-range value child index" { value_nodes: [@types.RecordValue([5])], root: 0, } - let r = try? schema_value_from_wit(bad) + let r = try? decode_test_value(bad) guard r is Err(DecodeError(msg)) else { fail("expected DecodeError, got \{r}") } @@ -538,7 +555,7 @@ test "decode rejects a value structural cycle" { value_nodes: [@types.ListValue([0])], root: 0, } - let r = try? schema_value_from_wit(bad) + let r = try? decode_test_value(bad) guard r is Err(DecodeError(msg)) else { fail("expected DecodeError, got \{r}") } @@ -559,7 +576,7 @@ test "datetime nanoseconds must be < 1e9 (encode + decode)" { ], root: 0, } - let rd = try? schema_value_from_wit(bad) + let rd = try? decode_test_value(bad) guard rd is Err(DecodeError(dm)) else { fail("expected DecodeError, got \{rd}") } @@ -592,7 +609,7 @@ test "narrow integer values are range-checked on decode" { ] for node in bad { let tree : @types.SchemaValueTree = { value_nodes: [node], root: 0 } - let r = try? schema_value_from_wit(tree) + let r = try? decode_test_value(tree) guard r is Err(DecodeError(_)) else { fail("expected DecodeError for out-of-range value, got \{r}") } @@ -617,7 +634,7 @@ test "secret value encodes to a handle node and decodes to a fresh handle" { guard wit.value_nodes[wit.root] is @types.SecretValue(_) else { fail("expected a secret-value wire node") } - guard schema_value_from_wit(wit) is Secret(decoded) else { + guard decode_test_value(wit) is Secret(decoded) else { fail("expected a decoded secret value") } assert_true(decoded.is_present()) @@ -657,7 +674,7 @@ test "quota-token value encodes to a handle node and decodes to a fresh handle" fail("expected a quota-token-handle wire node") } // Decoding lifts the owned handle back into a present holder. - guard schema_value_from_wit(wit) is QuotaToken(decoded) else { + guard decode_test_value(wit) is QuotaToken(decoded) else { fail("expected a decoded quota-token value") } assert_true(decoded.is_present()) @@ -698,6 +715,33 @@ test "encode error after a quota-token does not consume the handle" { assert_true(handle.is_present()) } +///| +test "stream alias preflight does not transfer the earlier stream" { + let handle = GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(10), + ) + let result = try? schema_value_to_wit(Tuple([Stream(handle), Stream(handle)])) + guard result is Err(EncodeError(message)) else { + fail("expected aliased stream EncodeError") + } + assert_true(message.contains("more than once")) + assert_true(handle.is_present()) +} + +///| +test "encode rejects two holders wrapping the same stream endpoint" { + let raw = @types.SchemaValueStream::SchemaValueStream(13) + let first = GuestSchemaValueStreamHandle::from_wrapped(raw) + let second = GuestSchemaValueStreamHandle::from_wrapped(raw) + let result = try? schema_value_to_wit(Tuple([Stream(first), Stream(second)])) + guard result is Err(EncodeError(message)) else { + fail("expected duplicate stream endpoint EncodeError") + } + assert_true(message.contains("more than once")) + assert_true(first.is_present()) + assert_true(second.is_present()) +} + ///| test "encode rejects two distinct holders wrapping the same raw handle" { let raw = @types.QuotaToken::QuotaToken(11) @@ -712,58 +756,6 @@ test "encode rejects two distinct holders wrapping the same raw handle" { assert_true(a.is_present() && b.is_present()) } -///| -test "decode rejects the same raw handle in two different nodes" { - let raw = @types.QuotaToken::QuotaToken(12) - let tree : @types.SchemaValueTree = { - value_nodes: [ - @types.QuotaTokenHandle(raw), - @types.QuotaTokenHandle(raw), - @types.TupleValue([0, 1]), - ], - root: 2, - } - let r = try? schema_value_from_wit(tree) - guard r is Err(DecodeError(dm)) else { - fail("expected DecodeError, got \{r}") - } - assert_true(dm.contains("more than one handle node")) -} - -///| -test "decode rejects a handle node referenced from two places" { - // A tuple whose two elements both point at the single handle node 0. - let tree : @types.SchemaValueTree = { - value_nodes: [ - @types.QuotaTokenHandle(@types.QuotaToken::QuotaToken(3)), - @types.TupleValue([0, 0]), - ], - root: 1, - } - let r = try? schema_value_from_wit(tree) - guard r is Err(DecodeError(dm)) else { - fail("expected DecodeError, got \{r}") - } - assert_true(dm.contains("more than once")) -} - -///| -test "decode rejects a handle node unreachable from the root" { - // Root is a unit tuple; the handle node 1 is never referenced. - let tree : @types.SchemaValueTree = { - value_nodes: [ - @types.TupleValue([]), - @types.QuotaTokenHandle(@types.QuotaToken::QuotaToken(4)), - ], - root: 0, - } - let r = try? schema_value_from_wit(tree) - guard r is Err(DecodeError(dm)) else { - fail("expected DecodeError, got \{r}") - } - assert_true(dm.contains("not referenced from the root")) -} - ///| test "duplicate def id is rejected before a bad body is decoded" { // Both a duplicate def id AND an out-of-range body index exist; the duplicate diff --git a/sdks/moonbit/golem_sdk/schema_model/schema_value_stream_handle.mbt b/sdks/moonbit/golem_sdk/schema_model/schema_value_stream_handle.mbt new file mode 100644 index 0000000000..2487154894 --- /dev/null +++ b/sdks/moonbit/golem_sdk/schema_model/schema_value_stream_handle.mbt @@ -0,0 +1,129 @@ +///| +/// The two possible origins of a recursive schema value stream. A received WIT +/// resource remains wrapped until the boundary unwraps it; a native reader is +/// retained verbatim until the boundary wraps it. +priv enum SchemaValueStreamEndpoint { + Wrapped(@types.SchemaValueStream) + Native(@async-core.Stream[@types.SchemaValueTree]) +} + +///| +/// Affine, take-once holder for a recursive schema value stream endpoint. +pub(all) struct GuestSchemaValueStreamHandle { + priv mut cell : SchemaValueStreamEndpoint? +} + +///| +pub fn GuestSchemaValueStreamHandle::from_wrapped( + value : @types.SchemaValueStream, +) -> GuestSchemaValueStreamHandle { + { cell: Some(Wrapped(value)) } +} + +///| +pub fn GuestSchemaValueStreamHandle::from_native( + reader : @async-core.Stream[@types.SchemaValueTree], +) -> GuestSchemaValueStreamHandle { + { cell: Some(Native(reader)) } +} + +///| +pub fn GuestSchemaValueStreamHandle::is_present( + self : GuestSchemaValueStreamHandle, +) -> Bool { + self.cell is Some(_) +} + +///| +fn GuestSchemaValueStreamHandle::same_endpoint( + self : GuestSchemaValueStreamHandle, + other : GuestSchemaValueStreamHandle, +) -> Bool { + match (self.cell, other.cell) { + (Some(Wrapped(left)), Some(Wrapped(right))) => left == right + (Some(Native(left)), Some(Native(right))) => physical_equal(left, right) + _ => false + } +} + +///| +fn GuestSchemaValueStreamHandle::take( + self : GuestSchemaValueStreamHandle, +) -> SchemaValueStreamEndpoint? { + let value = self.cell + self.cell = None + value +} + +///| +fn GuestSchemaValueStreamHandle::release( + self : GuestSchemaValueStreamHandle, + drop_wrapped : (@types.SchemaValueStream) -> Unit, + drop_native : (@async-core.Stream[@types.SchemaValueTree]) -> Unit, +) -> Unit { + match self.take() { + Some(Wrapped(value)) => drop_wrapped(value) + Some(Native(reader)) => drop_native(reader) + None => () + } +} + +///| +async fn GuestSchemaValueStreamHandle::prepare_outgoing( + self : GuestSchemaValueStreamHandle, +) -> Unit raise SchemaModelError { + match self.take() { + None => + raise EncodeError( + "schema-value-stream handle was already transferred; an owned stream can only be sent once", + ) + Some(Wrapped(value)) => self.cell = Some(Wrapped(value)) + Some(Native(reader)) => { + let wrapped = @types.SchemaValueStream::wrap(reader) catch { + e => raise EncodeError("failed wrapping schema value stream: \{e}") + } + self.cell = Some(Wrapped(wrapped)) + } + } +} + +///| +pub async fn GuestSchemaValueStreamHandle::take_or_unwrap_native( + self : GuestSchemaValueStreamHandle, +) -> @async-core.Stream[@types.SchemaValueTree] raise SchemaModelError { + match self.take() { + None => + raise DecodeError( + "schema-value-stream handle was already transferred; an owned stream can only be received once", + ) + Some(Native(reader)) => reader + Some(Wrapped(value)) => + @types.SchemaValueStream::unwrap(value) catch { + e => raise DecodeError("failed unwrapping schema value stream: \{e}") + } + } +} + +///| +pub fn GuestSchemaValueStreamHandle::put_native( + self : GuestSchemaValueStreamHandle, + reader : @async-core.Stream[@types.SchemaValueTree], +) -> Unit { + self.cell = Some(Native(reader)) +} + +///| +impl Eq for GuestSchemaValueStreamHandle with fn equal(self, other) { + physical_equal(self, other) +} + +///| +impl Show for GuestSchemaValueStreamHandle with fn output(self, logger) { + logger.write_string( + if self.is_present() { + "GuestSchemaValueStreamHandle(present)" + } else { + "GuestSchemaValueStreamHandle(consumed)" + }, + ) +} diff --git a/sdks/moonbit/golem_sdk/schema_model/wit.mbt b/sdks/moonbit/golem_sdk/schema_model/wit.mbt index a3027352f9..4dbe7be3aa 100644 --- a/sdks/moonbit/golem_sdk/schema_model/wit.mbt +++ b/sdks/moonbit/golem_sdk/schema_model/wit.mbt @@ -622,6 +622,20 @@ fn ValueEncoder::emit_node( "quota-token handle was already transferred; an owned quota-token can only be sent once", ) } + Stream(handle) => + match handle.take() { + Some(Wrapped(raw)) => @types.StreamValue(raw) + Some(Native(reader)) => { + handle.cell = Some(Native(reader)) + raise EncodeError( + "native schema value stream was not prepared for transfer", + ) + } + None => + raise EncodeError( + "schema-value-stream handle was already transferred; an owned stream can only be sent once", + ) + } } } @@ -654,9 +668,84 @@ pub fn schema_value_to_wit( fn preflight_value(value : SchemaValue) -> Unit raise SchemaModelError { let seen_secrets : Array[@types.Secret] = [] let seen_quota_tokens : Array[@types.QuotaToken] = [] + preflight_streams(value, []) preflight_walk(value, seen_secrets, seen_quota_tokens) } +///| +fn preflight_streams( + value : SchemaValue, + seen : Array[GuestSchemaValueStreamHandle], +) -> Unit raise SchemaModelError { + match value { + Stream(handle) => { + guard handle.is_present() else { + raise EncodeError( + "schema-value-stream handle was already transferred; an owned stream can only be sent once", + ) + } + for previous in seen { + if previous.same_endpoint(handle) { + raise EncodeError( + "the same schema-value-stream endpoint appeared more than once in one value tree", + ) + } + } + seen.push(handle) + } + Record(xs) | Tuple(xs) | List(xs) | FixedList(xs) => + for x in xs { + preflight_streams(x, seen) + } + Variant(_, x) | Option(x) | ResultOk(x) | ResultErr(x) => + match x { + Some(x) => preflight_streams(x, seen) + None => () + } + Map(xs) => + for x in xs { + preflight_streams(x.key, seen) + preflight_streams(x.value, seen) + } + Union(_, x) => preflight_streams(x, seen) + _ => () + } +} + +///| +pub async fn schema_value_to_wit_async( + value : SchemaValue, +) -> @types.SchemaValueTree raise SchemaModelError { + preflight_value(value) + prepare_outgoing_streams(value) + schema_value_to_wit(value) +} + +///| +async fn prepare_outgoing_streams( + value : SchemaValue, +) -> Unit raise SchemaModelError { + match value { + Stream(handle) => handle.prepare_outgoing() + Record(xs) | Tuple(xs) | List(xs) | FixedList(xs) => + for x in xs { + prepare_outgoing_streams(x) + } + Variant(_, x) | Option(x) | ResultOk(x) | ResultErr(x) => + match x { + Some(x) => prepare_outgoing_streams(x) + None => () + } + Map(xs) => + for x in xs { + prepare_outgoing_streams(x.key) + prepare_outgoing_streams(x.value) + } + Union(_, x) => prepare_outgoing_streams(x) + _ => () + } +} + ///| fn preflight_walk( value : SchemaValue, @@ -719,6 +808,12 @@ fn preflight_walk( } seen_quota_tokens.push(raw) } + Stream(handle) => + if !handle.is_present() { + raise EncodeError( + "schema-value-stream handle was already transferred; an owned stream can only be sent once", + ) + } Record(fields) => for f in fields { preflight_walk(f, seen_secrets, seen_quota_tokens) @@ -769,6 +864,149 @@ fn preflight_walk( // Schema value — decode (flat -> recursive) // ============================================================ +///| +priv struct ValuePreflight { + nodes : Array[@types.SchemaValueNode] + on_path : Array[Bool] + referenced_handles : Array[Bool] + seen_secrets : Array[@types.Secret] + seen_quota_tokens : Array[@types.QuotaToken] + seen_streams : Array[@types.SchemaValueStream] +} + +///| +fn ValuePreflight::new(nodes : Array[@types.SchemaValueNode]) -> ValuePreflight { + { + nodes, + on_path: Array::make(nodes.length(), false), + referenced_handles: Array::make(nodes.length(), false), + seen_secrets: [], + seen_quota_tokens: [], + seen_streams: [], + } +} + +///| +fn ValuePreflight::visit_idx( + self : ValuePreflight, + idx : Int, +) -> Unit raise SchemaModelError { + if idx < 0 || idx >= self.nodes.length() { + raise DecodeError( + "value node index out of range: \{idx} (nodes: \{self.nodes.length()})", + ) + } + if self.on_path[idx] { + raise DecodeError("cyclic value node reference at index \{idx}") + } + self.on_path[idx] = true + self.visit_node(idx, self.nodes[idx]) + self.on_path[idx] = false +} + +///| +fn[R : Eq] ValuePreflight::claim_handle( + self : ValuePreflight, + idx : Int, + raw : R, + seen : Array[R], + name : String, +) -> Unit raise SchemaModelError { + if self.referenced_handles[idx] { + raise DecodeError( + "\{name} handle node referenced more than once at index \{idx}", + ) + } + if seen.contains(raw) { + raise DecodeError( + "the same owned \{name} resource appeared in more than one handle node", + ) + } + self.referenced_handles[idx] = true + seen.push(raw) +} + +///| +fn ValuePreflight::visit_opt( + self : ValuePreflight, + idx : Int?, +) -> Unit raise SchemaModelError { + match idx { + Some(idx) => self.visit_idx(idx) + None => () + } +} + +///| +fn ValuePreflight::visit_node( + self : ValuePreflight, + idx : Int, + node : @types.SchemaValueNode, +) -> Unit raise SchemaModelError { + match node { + @types.S8Value(value) => + if !s8_in_range(value) { + raise DecodeError("s8 value out of range: \{value}") + } + @types.S16Value(value) => + if !s16_in_range(value) { + raise DecodeError("s16 value out of range: \{value}") + } + @types.U16Value(value) => + if !u16_in_range(value) { + raise DecodeError("u16 value out of range: \{value}") + } + @types.DatetimeValue(value) => + if !datetime_valid(value) { + raise DecodeError( + "invalid datetime value: nanoseconds must be < 1_000_000_000, got \{value.nanoseconds}", + ) + } + @types.RecordValue(indices) + | @types.TupleValue(indices) + | @types.ListValue(indices) + | @types.FixedListValue(indices) => + for idx in indices { + self.visit_idx(idx) + } + @types.VariantValue(value) => self.visit_opt(value.payload) + @types.MapValue(entries) => + for entry in entries { + self.visit_idx(entry.key) + self.visit_idx(entry.value) + } + @types.OptionValue(value) => self.visit_opt(value) + @types.ResultValue(value) => + match value { + @types.OkValue(value) | @types.ErrValue(value) => self.visit_opt(value) + } + @types.UnionValue(value) => self.visit_idx(value.body) + @types.SecretValue(raw) => + self.claim_handle(idx, raw, self.seen_secrets, "secret") + @types.QuotaTokenHandle(raw) => + self.claim_handle(idx, raw, self.seen_quota_tokens, "quota-token") + @types.StreamValue(raw) => + self.claim_handle(idx, raw, self.seen_streams, "schema-value-stream") + _ => () + } +} + +///| +fn ValuePreflight::first_unreferenced_handle(self : ValuePreflight) -> Int? { + for i in 0.. + if !self.referenced_handles[i] { + return Some(i) + } + _ => () + } + } + None +} + ///| priv struct ValueDecoder { nodes : Array[@types.SchemaValueNode] @@ -779,10 +1017,12 @@ priv struct ValueDecoder { // resource in two handles. lifted_secrets : Array[Bool] lifted_quota_tokens : Array[Bool] + lifted_streams : Array[Bool] // Underlying owned resources already lifted, so a malformed tree that carries // the same raw resource in two *different* handle nodes is also rejected. lifted_secret_raws : Array[@types.Secret] lifted_quota_token_raws : Array[@types.QuotaToken] + lifted_stream_raws : Array[@types.SchemaValueStream] } ///| @@ -792,35 +1032,41 @@ fn ValueDecoder::new(nodes : Array[@types.SchemaValueNode]) -> ValueDecoder { on_path: Array::make(nodes.length(), false), lifted_secrets: Array::make(nodes.length(), false), lifted_quota_tokens: Array::make(nodes.length(), false), + lifted_streams: Array::make(nodes.length(), false), lifted_secret_raws: [], lifted_quota_token_raws: [], + lifted_stream_raws: [], } } ///| -/// Return the index of the first owned capability handle node that was never -/// lifted into the decoded value tree, or `None` if every handle node was -/// referenced exactly once from the root. Used after a successful decode to -/// reject a tree that carries handles unreachable from the root. -/// -/// This only inspects the node tags; it does not release the owned resources. -/// MoonBit has no resource finalizer, so an owned capability left in a -/// rejected or partially-decoded tree is released only when the guest instance -/// is torn down. (Other SDKs lean on host/runtime GC for the same cleanup; a -/// guest-side host `resource-drop` call here would pull the `golem:core/types` -/// host import into this otherwise host-free package.) -fn ValueDecoder::first_unreferenced_handle(self : ValueDecoder) -> Int? { - for i in 0.. if not(self.lifted_secrets[i]) { return Some(i) } - @types.QuotaTokenHandle(_) => - if not(self.lifted_quota_tokens[i]) { - return Some(i) +fn drop_unique_resources( + nodes : Array[@types.SchemaValueNode], + drops : SchemaValueResourceDrops, +) -> Unit { + let dropped_secrets : Array[@types.Secret] = [] + let dropped_quota_tokens : Array[@types.QuotaToken] = [] + let dropped_streams : Array[@types.SchemaValueStream] = [] + for node in nodes { + match node { + @types.SecretValue(raw) => + if !dropped_secrets.contains(raw) { + dropped_secrets.push(raw) + (drops.drop_secret)(raw) + } + @types.QuotaTokenHandle(raw) => + if !dropped_quota_tokens.contains(raw) { + dropped_quota_tokens.push(raw) + (drops.drop_quota_token)(raw) + } + @types.StreamValue(raw) => + if !dropped_streams.contains(raw) { + dropped_streams.push(raw) + (drops.drop_stream)(raw) } _ => () } } - None } ///| @@ -967,6 +1213,23 @@ fn ValueDecoder::from_node( self.lifted_quota_token_raws.push(raw) QuotaToken(GuestQuotaTokenHandle::new(raw)) } + @types.StreamValue(raw) => { + guard !self.lifted_streams[idx] else { + raise DecodeError( + "schema-value-stream handle node referenced more than once at index \{idx}", + ) + } + for previous in self.lifted_stream_raws { + if previous == raw { + raise DecodeError( + "the same owned schema-value-stream resource appeared in more than one handle node", + ) + } + } + self.lifted_streams[idx] = true + self.lifted_stream_raws.push(raw) + Stream(GuestSchemaValueStreamHandle::from_wrapped(raw)) + } } } @@ -978,21 +1241,30 @@ fn ValueDecoder::from_node( /// reference is rejected), and a valid tree must reference every handle node /// exactly once from the root. After a successful decode any handle node left /// unreferenced was unreachable and the tree is rejected as malformed. -/// -/// Owned resources in a rejected or partially-decoded tree are not explicitly -/// released here (see `first_unreferenced_handle`); MoonBit has no resource -/// finalizer, so they are reclaimed when the guest instance is torn down. +/// Resource drop callbacks are mandatory because rejecting a tree retains no +/// owner for any capability resources carried by it. pub fn schema_value_from_wit( wit : @types.SchemaValueTree, + drops : SchemaValueResourceDrops, ) -> SchemaValue raise SchemaModelError { - let decoder = ValueDecoder::new(wit.value_nodes) - let result = decoder.from_idx(wit.root) - match decoder.first_unreferenced_handle() { - Some(idx) => + let preflight = ValuePreflight::new(wit.value_nodes) + preflight.visit_idx(wit.root) catch { + error => { + drop_unique_resources(wit.value_nodes, drops) + raise error + } + } + match preflight.first_unreferenced_handle() { + Some(idx) => { + drop_unique_resources(wit.value_nodes, drops) raise DecodeError( "capability handle node at index \{idx} is not referenced from the root", ) - None => result + } + None => { + let decoder = ValueDecoder::new(wit.value_nodes) + decoder.from_idx(wit.root) + } } } @@ -1008,13 +1280,29 @@ pub fn typed_schema_value_to_wit( { graph: schema_graph_to_wit(tv.graph), value: schema_value_to_wit(tv.value) } } +///| +/// Asynchronously encode a recursive `TypedSchemaValue`, wrapping any native +/// streams nested in its value tree before transferring their handles. +pub async fn typed_schema_value_to_wit_async( + tv : TypedSchemaValue, +) -> @types.TypedSchemaValue raise SchemaModelError { + { + graph: schema_graph_to_wit(tv.graph), + value: schema_value_to_wit_async(tv.value), + } +} + ///| /// Decode a flat `@types.TypedSchemaValue` into the recursive form. pub fn typed_schema_value_from_wit( wit : @types.TypedSchemaValue, + drops : SchemaValueResourceDrops, ) -> TypedSchemaValue raise SchemaModelError { - { - graph: schema_graph_from_wit(wit.graph), - value: schema_value_from_wit(wit.value), + let graph = schema_graph_from_wit(wit.graph) catch { + error => { + drop_unique_resources(wit.value.value_nodes, drops) + raise error + } } + { graph, value: schema_value_from_wit(wit.value, drops) } } diff --git a/sdks/moonbit/golem_sdk/schema_model_host/decode.mbt b/sdks/moonbit/golem_sdk/schema_model_host/decode.mbt new file mode 100644 index 0000000000..f13ddd6094 --- /dev/null +++ b/sdks/moonbit/golem_sdk/schema_model_host/decode.mbt @@ -0,0 +1,23 @@ +///| +pub fn resource_drops() -> @model.SchemaValueResourceDrops { + { + drop_secret: fn(value) { value.drop() }, + drop_quota_token: fn(value) { value.drop() }, + drop_stream: fn(value) { value.drop() }, + drop_native_stream: fn(reader) { reader.drop_sync() }, + } +} + +///| +pub fn schema_value_from_wit( + wit : @types.SchemaValueTree, +) -> @model.SchemaValue raise @model.SchemaModelError { + @model.schema_value_from_wit(wit, resource_drops()) +} + +///| +pub fn typed_schema_value_from_wit( + wit : @types.TypedSchemaValue, +) -> @model.TypedSchemaValue raise @model.SchemaModelError { + @model.typed_schema_value_from_wit(wit, resource_drops()) +} diff --git a/sdks/moonbit/golem_sdk/schema_model_host/moon.pkg b/sdks/moonbit/golem_sdk/schema_model_host/moon.pkg new file mode 100644 index 0000000000..73ffde2387 --- /dev/null +++ b/sdks/moonbit/golem_sdk/schema_model_host/moon.pkg @@ -0,0 +1,4 @@ +import { + "golemcloud/golem_sdk/interface/golem/core/types", + "golemcloud/golem_sdk/schema_model" @model, +} diff --git a/sdks/moonbit/golem_sdk/schema_model_host/pkg.generated.mbti b/sdks/moonbit/golem_sdk/schema_model_host/pkg.generated.mbti new file mode 100644 index 0000000000..d7ec0bcf61 --- /dev/null +++ b/sdks/moonbit/golem_sdk/schema_model_host/pkg.generated.mbti @@ -0,0 +1,23 @@ +// Generated using `moon info`, DON'T EDIT IT +package "golemcloud/golem_sdk/schema_model_host" + +import { + "golemcloud/golem_sdk/interface/golem/core/types", + "golemcloud/golem_sdk/schema_model", +} + +// Values +pub fn resource_drops() -> @schema_model.SchemaValueResourceDrops + +pub fn schema_value_from_wit(@types.SchemaValueTree) -> @schema_model.SchemaValue raise @schema_model.SchemaModelError + +pub fn typed_schema_value_from_wit(@types.TypedSchemaValue) -> @schema_model.TypedSchemaValue raise @schema_model.SchemaModelError + +// Errors + +// Types and methods + +// Type aliases + +// Traits + diff --git a/sdks/moonbit/golem_sdk/scripts/regen-bindings.sh b/sdks/moonbit/golem_sdk/scripts/regen-bindings.sh index 0ce5e17c91..6fe75e5adf 100755 --- a/sdks/moonbit/golem_sdk/scripts/regen-bindings.sh +++ b/sdks/moonbit/golem_sdk/scripts/regen-bindings.sh @@ -24,7 +24,7 @@ set -euo pipefail cd "$(dirname "$0")/.." -readonly WIT_BINDGEN_COMMIT="4407232ead86d9bcbd06cbebd790a52120a4087a" +readonly WIT_BINDGEN_COMMIT="e759a320fdd1ecad92dc484af59cfc0c5fff38c6" readonly WIT_BINDGEN_SHORT_COMMIT="${WIT_BINDGEN_COMMIT:0:9}" wit_bindgen_version="$(wit-bindgen --version)" diff --git a/sdks/moonbit/golem_sdk/tool/canonical_input.mbt b/sdks/moonbit/golem_sdk/tool/canonical_input.mbt index 71557bdb06..6d8be27814 100644 --- a/sdks/moonbit/golem_sdk/tool/canonical_input.mbt +++ b/sdks/moonbit/golem_sdk/tool/canonical_input.mbt @@ -19,6 +19,16 @@ pub(all) struct CanonicalInputModel { record_graph : @model.SchemaGraph } derive(Eq) +///| +fn release_canonical_input_values( + fields : Array[CanonicalInputValue], + drops : @model.SchemaValueResourceDrops, +) -> Unit { + for field in fields { + field.value.release_resources(drops) + } +} + ///| pub fn ToolDef::command_index_by_path( self : ToolDef, @@ -310,6 +320,23 @@ pub fn decode_canonical_input( command_index : Int, input : @types.TypedSchemaValue, context : String, +) -> Array[CanonicalInputValue] raise @toolCommon.ToolError { + decode_canonical_input_with_resource_drops( + def, + command_index, + input, + context, + @model_host.resource_drops(), + ) +} + +///| +fn decode_canonical_input_with_resource_drops( + def : ToolDef, + command_index : Int, + input : @types.TypedSchemaValue, + context : String, + drops : @model.SchemaValueResourceDrops, ) -> Array[CanonicalInputValue] raise @toolCommon.ToolError { let model = def.canonical_input_model(command_index) catch { error => @@ -317,42 +344,51 @@ pub fn decode_canonical_input( "\{context}: invalid canonical input model: \{to_repr(error)}", ) } - let typed = @model.typed_schema_value_from_wit(input) catch { + let typed = @model.typed_schema_value_from_wit(input, drops) catch { error => raise @toolCommon.ToolError::InvalidInput( "\{context}: invalid typed schema value input: \{error}", ) } - if typed.graph != model.record_graph { - raise @toolCommon.ToolError::InvalidInput( - "\{context}: input schema does not match the canonical input schema", - ) - } - if !value_matches_type( - model.record_graph, - model.record_graph.root, - typed.value, - ) { - raise @toolCommon.ToolError::InvalidInput( - "\{context}: input value does not match the canonical input schema", - ) - } - guard typed.value is @model.SchemaValue::Record(values) else { - raise @toolCommon.ToolError::InvalidInput( - "\{context}: canonical input must be a record", - ) - } - let result : Array[CanonicalInputValue] = [] - for i = 0; i < model.fields.length(); i = i + 1 { - let field = model.fields[i] - result.push({ - name: field.name, - aliases: field.aliases, - type_: field.type_, - value: values[i], - }) + try { + if typed.graph != model.record_graph { + raise @toolCommon.ToolError::InvalidInput( + "\{context}: input schema does not match the canonical input schema", + ) + } + if !value_matches_type( + model.record_graph, + model.record_graph.root, + typed.value, + ) { + raise @toolCommon.ToolError::InvalidInput( + "\{context}: input value does not match the canonical input schema", + ) + } + guard typed.value is @model.SchemaValue::Record(values) else { + raise @toolCommon.ToolError::InvalidInput( + "\{context}: canonical input must be a record", + ) + } + let result : Array[CanonicalInputValue] = [] + for i = 0; i < model.fields.length(); i = i + 1 { + let field = model.fields[i] + result.push({ + name: field.name, + aliases: field.aliases, + type_: field.type_, + value: values[i], + }) + } + result + } catch { + error => { + typed.value.release_resources(drops) + raise error + } + } noraise { + result => result } - result } ///| @@ -360,30 +396,52 @@ pub fn[T : @schema.IntoSchema + @schema.FromSchema] decode_canonical_field( fields : Array[CanonicalInputValue], name : String, context : String, +) -> T raise @toolCommon.ToolError { + decode_canonical_field_with_resource_drops( + fields, + name, + context, + @model_host.resource_drops(), + ) +} + +///| +fn[T : @schema.IntoSchema + @schema.FromSchema] decode_canonical_field_with_resource_drops( + fields : Array[CanonicalInputValue], + name : String, + context : String, + drops : @model.SchemaValueResourceDrops, ) -> T raise @toolCommon.ToolError { for field in fields { if field.name == name || field.aliases.contains(name) { let tag : @schema.TypeTag[T] = @schema.type_tag() let expected = @schema.into_schema_graph(tag) catch { - error => + error => { + release_canonical_input_values(fields, drops) raise @toolCommon.ToolError::InvalidInput( "\{context}: failed building the SDK schema for canonical field `\{name}`: \{error}", ) + } } let value = canonical_value_for_sdk(expected, expected.root, field.value) catch { - error => + error => { + release_canonical_input_values(fields, drops) raise @toolCommon.ToolError::InvalidInput( "\{context}: failed adapting canonical field `\{name}` to its SDK type: \{to_repr(error)}", ) + } } return @schema.from_value_as(value) catch { - error => + error => { + release_canonical_input_values(fields, drops) raise @toolCommon.ToolError::InvalidInput( "\{context}: failed decoding canonical field `\{name}`: \{error}", ) + } } } } + release_canonical_input_values(fields, drops) raise @toolCommon.ToolError::InvalidInput( "\{context}: canonical field `\{name}` was not found", ) diff --git a/sdks/moonbit/golem_sdk/tool/client.mbt b/sdks/moonbit/golem_sdk/tool/client.mbt index 259dd72d72..3ceed12238 100644 --- a/sdks/moonbit/golem_sdk/tool/client.mbt +++ b/sdks/moonbit/golem_sdk/tool/client.mbt @@ -21,6 +21,17 @@ pub(all) struct InvocationResult { stdout : @async-core.Stream[Byte]? } +///| +fn release_optional_value( + value : @model.TypedSchemaValue?, + drops : @model.SchemaValueResourceDrops, +) -> Unit { + match value { + Some(value) => value.value.release_resources(drops) + None => () + } +} + ///| pub(all) struct ToolClient { rpc : @toolHost.ToolRpc @@ -85,8 +96,15 @@ pub async fn[E] invoke_and_await( stdin : @async-core.Stream[Byte]?, decode_error : (@model.TypedSchemaValue) -> Result[E, String], ) -> Result[InvocationResult, ToolError[E]] { - let wire_input = @model.typed_schema_value_to_wit(input) catch { - e => return Err(tool_protocol_error("failed to encode tool input: \{e}")) + let wire_input = @model.typed_schema_value_to_wit_async(input) catch { + e => { + input.value.release_resources(@model_host.resource_drops()) + match stdin { + Some(stdin) => stdin.drop_sync() + None => () + } + return Err(tool_protocol_error("failed to encode tool input: \{e}")) + } } let wire_result = match rpc.invoke_and_await(command_path, wire_input, stdin) { @@ -136,9 +154,14 @@ fn[E] decode_invocation_result( ) -> Result[InvocationResult, ToolError[E]] { let decoded = match result.result { Some(value) => { - let decoded_value = @model.typed_schema_value_from_wit(value) catch { - e => + let decoded_value = @model_host.typed_schema_value_from_wit(value) catch { + e => { + match result.stdout { + Some(stdout) => stdout.drop_sync() + None => () + } return Err(tool_protocol_error("failed to decode tool result: \{e}")) + } } Some(decoded_value) } @@ -151,22 +174,51 @@ fn[E] decode_invocation_result( pub fn[T : @schema.FromSchema, E] decode_result_with_stdout( result : InvocationResult, ) -> Result[(T, @async-core.Stream[Byte]), ToolError[E]] { - let stdout = expect_stdout(result.stdout) - let value = decode_expected_value(result.result) - match (stdout, value) { - (Ok(stdout), Ok(value)) => Ok((value, stdout)) - (Err(e), _) => Err(e) - (_, Err(e)) => Err(e) + decode_result_with_stdout_with_resource_drops( + result, + @model_host.resource_drops(), + ) +} + +///| +fn[T : @schema.FromSchema, E] decode_result_with_stdout_with_resource_drops( + result : InvocationResult, + drops : @model.SchemaValueResourceDrops, +) -> Result[(T, @async-core.Stream[Byte]), ToolError[E]] { + let stdout = match expect_stdout(result.stdout) { + Ok(stdout) => stdout + Err(e) => { + release_optional_value(result.result, drops) + return Err(e) + } + } + match decode_expected_value(result.result, drops) { + Ok(value) => Ok((value, stdout)) + Err(e) => { + stdout.drop_sync() + Err(e) + } } } ///| pub fn[T : @schema.FromSchema, E] decode_result_value( result : InvocationResult, +) -> Result[T, ToolError[E]] { + decode_result_value_with_resource_drops(result, @model_host.resource_drops()) +} + +///| +fn[T : @schema.FromSchema, E] decode_result_value_with_resource_drops( + result : InvocationResult, + drops : @model.SchemaValueResourceDrops, ) -> Result[T, ToolError[E]] { match expect_no_stdout(result.stdout) { - Err(e) => Err(e) - Ok(_) => decode_expected_value(result.result) + Err(e) => { + release_optional_value(result.result, drops) + Err(e) + } + Ok(_) => decode_expected_value(result.result, drops) } } @@ -174,11 +226,20 @@ pub fn[T : @schema.FromSchema, E] decode_result_value( pub fn[E] decode_result_stdout_only( result : InvocationResult, ) -> Result[@async-core.Stream[Byte], ToolError[E]] { - let stdout = expect_stdout(result.stdout) - match (stdout, expect_no_value(result.result)) { - (Ok(stdout), Ok(_)) => Ok(stdout) - (Err(e), _) => Err(e) - (_, Err(e)) => Err(e) + let drops = @model_host.resource_drops() + let stdout = match expect_stdout(result.stdout) { + Ok(stdout) => stdout + Err(e) => { + release_optional_value(result.result, drops) + return Err(e) + } + } + match expect_no_value_with_resource_drops(result.result, drops) { + Ok(_) => Ok(stdout) + Err(e) => { + stdout.drop_sync() + Err(e) + } } } @@ -186,9 +247,13 @@ pub fn[E] decode_result_stdout_only( pub fn[E] decode_result_empty( result : InvocationResult, ) -> Result[Unit, ToolError[E]] { + let drops = @model_host.resource_drops() match expect_no_stdout(result.stdout) { - Err(e) => Err(e) - Ok(_) => expect_no_value(result.result) + Err(e) => { + release_optional_value(result.result, drops) + Err(e) + } + Ok(_) => expect_no_value_with_resource_drops(result.result, drops) } } @@ -212,10 +277,12 @@ pub fn[E] expect_no_stdout( stdout : @async-core.Stream[Byte]?, ) -> Result[Unit, ToolError[E]] { match stdout { - Some(_) => + Some(stdout) => { + stdout.drop_sync() Err( tool_protocol_error("tool result unexpectedly contained stdout stream"), ) + } None => Ok(()) } } @@ -233,10 +300,20 @@ pub fn[E] expect_value( ///| pub fn[E] expect_no_value( value : @model.TypedSchemaValue?, +) -> Result[Unit, ToolError[E]] { + expect_no_value_with_resource_drops(value, @model_host.resource_drops()) +} + +///| +fn[E] expect_no_value_with_resource_drops( + value : @model.TypedSchemaValue?, + drops : @model.SchemaValueResourceDrops, ) -> Result[Unit, ToolError[E]] { match value { - Some(_) => + Some(value) => { + value.value.release_resources(drops) Err(tool_protocol_error("tool result unexpectedly contained a value")) + } None => Ok(()) } } @@ -249,13 +326,17 @@ pub fn[E] tool_protocol_error(message : String) -> ToolError[E] { ///| fn[T : @schema.FromSchema, E] decode_expected_value( value : @model.TypedSchemaValue?, + drops : @model.SchemaValueResourceDrops, ) -> Result[T, ToolError[E]] { let value = match expect_value(value) { Ok(value) => value Err(e) => return Err(e) } try @schema.from_value_as(value.value) catch { - e => Err(tool_protocol_error("failed to decode tool result: \{e}")) + e => { + value.value.release_resources(drops) + Err(tool_protocol_error("failed to decode tool result: \{e}")) + } } noraise { decoded => Ok(decoded) } @@ -298,13 +379,16 @@ fn[E] map_remote_tool_error( ) -> ToolError[E] { match error { @toolCommon.ToolError::CustomError(value) => { - let decoded = @model.typed_schema_value_from_wit(value) catch { + let decoded = @model_host.typed_schema_value_from_wit(value) catch { e => return tool_protocol_error("failed to decode remote tool error: \{e}") } match decode_error(decoded) { Ok(error) => ToolError::Tool(error) - Err(message) => ToolError::Rpc(RpcError::Protocol(message)) + Err(message) => { + decoded.value.release_resources(@model_host.resource_drops()) + ToolError::Rpc(RpcError::Protocol(message)) + } } } other => diff --git a/sdks/moonbit/golem_sdk/tool/dispatch.mbt b/sdks/moonbit/golem_sdk/tool/dispatch.mbt index 787760460f..ad4b188c63 100644 --- a/sdks/moonbit/golem_sdk/tool/dispatch.mbt +++ b/sdks/moonbit/golem_sdk/tool/dispatch.mbt @@ -4,30 +4,54 @@ pub fn decode_invocation_input( arity : Int, context : String, ) -> Array[@model.SchemaValue] raise @toolCommon.ToolError { - let typed = @model.typed_schema_value_from_wit(input) catch { + decode_invocation_input_with_resource_drops( + input, + arity, + context, + @model_host.resource_drops(), + ) +} + +///| +fn decode_invocation_input_with_resource_drops( + input : @types.TypedSchemaValue, + arity : Int, + context : String, + drops : @model.SchemaValueResourceDrops, +) -> Array[@model.SchemaValue] raise @toolCommon.ToolError { + let typed = @model.typed_schema_value_from_wit(input, drops) catch { e => raise @toolCommon.ToolError::InvalidInput( "\{context}: invalid typed schema value input: \{e}", ) } - validate_invocation_input_graph(typed.graph, arity, context) - if !value_matches_type(typed.graph, typed.graph.root, typed.value) { - raise @toolCommon.ToolError::InvalidInput( - "\{context}: input value does not match input schema graph", - ) - } - let fields = @schema.expect_record(typed.value, context) catch { - e => + try { + validate_invocation_input_graph(typed.graph, arity, context) + if !value_matches_type(typed.graph, typed.graph.root, typed.value) { raise @toolCommon.ToolError::InvalidInput( - "\{context}: expected a record input: \{e}", + "\{context}: input value does not match input schema graph", ) + } + let fields = @schema.expect_record(typed.value, context) catch { + e => + raise @toolCommon.ToolError::InvalidInput( + "\{context}: expected a record input: \{e}", + ) + } + guard fields.length() == arity else { + raise @toolCommon.ToolError::InvalidInput( + "\{context}: expected \{arity} parameter(s), got \{fields.length()}", + ) + } + fields + } catch { + error => { + typed.value.release_resources(drops) + raise error + } + } noraise { + fields => fields } - guard fields.length() == arity else { - raise @toolCommon.ToolError::InvalidInput( - "\{context}: expected \{arity} parameter(s), got \{fields.length()}", - ) - } - fields } ///| @@ -203,7 +227,7 @@ fn value_matches_type( @model.SchemaTypeBody::QuotaToken(_) => value is @model.SchemaValue::QuotaToken(_) @model.SchemaTypeBody::Future(_) => false - @model.SchemaTypeBody::Stream(_) => false + @model.SchemaTypeBody::Stream(_) => value is @model.SchemaValue::Stream(_) } } @@ -417,18 +441,37 @@ pub fn[T : @schema.FromSchema] decode_param( fields : Array[@model.SchemaValue], index : Int, context : String, +) -> T raise @toolCommon.ToolError { + decode_param_with_resource_drops( + fields, + index, + context, + @model_host.resource_drops(), + ) +} + +///| +fn[T : @schema.FromSchema] decode_param_with_resource_drops( + fields : Array[@model.SchemaValue], + index : Int, + context : String, + drops : @model.SchemaValueResourceDrops, ) -> T raise @toolCommon.ToolError { let field = @schema.record_field(fields, index, context) catch { - e => + e => { + @model.SchemaValue::Record(fields).release_resources(drops) raise @toolCommon.ToolError::InvalidInput( "\{context}: missing parameter \{index}: \{e}", ) + } } @schema.from_value_as(field) catch { - e => + e => { + @model.SchemaValue::Record(fields).release_resources(drops) raise @toolCommon.ToolError::InvalidInput( "\{context}: failed decoding parameter \{index}: \{e}", ) + } } } @@ -441,14 +484,22 @@ pub fn encode_invocation_input( } ///| -pub fn[T : @schema.IntoSchema] encode_result_value( +pub async fn[T : @schema.IntoSchema] encode_result_value( value : T, ) -> @types.TypedSchemaValue raise @toolCommon.ToolError { - @model.typed_schema_value_to_wit(@schema.try_into_typed_schema_value(value)) catch { - e => + let typed = @schema.try_into_typed_schema_value(value) catch { + error => + raise @toolCommon.ToolError::InvalidResult( + "failed building tool result schema: \{error}", + ) + } + @model.typed_schema_value_to_wit_async(typed) catch { + e => { + typed.value.release_resources(@model_host.resource_drops()) raise @toolCommon.ToolError::InvalidResult( "failed serializing tool result: \{e}", ) + } } } @@ -458,7 +509,7 @@ pub fn invocation_result_empty() -> @toolCommon.InvocationResult { } ///| -pub fn[T : @schema.IntoSchema] invocation_result_value( +pub async fn[T : @schema.IntoSchema] invocation_result_value( value : T, ) -> @toolCommon.InvocationResult raise @toolCommon.ToolError { { result: Some(encode_result_value(value)), stdout: None } @@ -472,9 +523,28 @@ pub fn invocation_result_stdout( } ///| -pub fn[T : @schema.IntoSchema] invocation_result_value_with_stdout( +pub async fn[T : @schema.IntoSchema] invocation_result_value_with_stdout( value : T, stdout : @async-core.Stream[Byte], ) -> @toolCommon.InvocationResult raise @toolCommon.ToolError { - { result: Some(encode_result_value(value)), stdout: Some(stdout) } + { result: Some(encode_result_value(value)), stdout: Some(stdout) } catch { + error => { + stdout.drop_sync() + raise error + } + } +} + +///| +pub async fn encode_error_payload( + payload : @model.TypedSchemaValue, +) -> @types.TypedSchemaValue raise @toolCommon.ToolError { + @model.typed_schema_value_to_wit_async(payload) catch { + error => { + payload.value.release_resources(@model_host.resource_drops()) + raise @toolCommon.ToolError::InvalidResult( + "failed serializing custom tool error: \{error}", + ) + } + } } diff --git a/sdks/moonbit/golem_sdk/tool/moon.pkg b/sdks/moonbit/golem_sdk/tool/moon.pkg index 482067d02b..687b8c6b8c 100644 --- a/sdks/moonbit/golem_sdk/tool/moon.pkg +++ b/sdks/moonbit/golem_sdk/tool/moon.pkg @@ -6,6 +6,7 @@ import { "golemcloud/golem_sdk/interface/golem/tool/host" @toolHost, "golemcloud/golem_sdk/schema", "golemcloud/golem_sdk/schema_model" @model, + "golemcloud/golem_sdk/schema_model_host" @model_host, "moonbitlang/core/strconv", } diff --git a/sdks/moonbit/golem_sdk/tool/pkg.generated.mbti b/sdks/moonbit/golem_sdk/tool/pkg.generated.mbti index fb5ee0294c..5708bb4292 100644 --- a/sdks/moonbit/golem_sdk/tool/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk/tool/pkg.generated.mbti @@ -31,9 +31,11 @@ pub fn[T : @schema.FromSchema, E] decode_result_with_stdout(InvocationResult) -> pub fn discover_tools() -> Array[@golemcloud/golem_sdk/interface/golem/tool/common.Tool] +pub async fn encode_error_payload(@schema_model.TypedSchemaValue) -> @types.TypedSchemaValue raise @golemcloud/golem_sdk/interface/golem/tool/common.ToolError + pub fn encode_invocation_input(@schema_model.SchemaGraph, Array[@schema_model.SchemaValue]) -> @schema_model.TypedSchemaValue -pub fn[T : @schema.IntoSchema] encode_result_value(T) -> @types.TypedSchemaValue raise @golemcloud/golem_sdk/interface/golem/tool/common.ToolError +pub async fn[T : @schema.IntoSchema] encode_result_value(T) -> @types.TypedSchemaValue raise @golemcloud/golem_sdk/interface/golem/tool/common.ToolError pub fn[E] expect_no_stdout(@async-core.Stream[Byte]?) -> Result[Unit, ToolError[E]] @@ -51,9 +53,9 @@ pub fn invocation_result_empty() -> @golemcloud/golem_sdk/interface/golem/tool/c pub fn invocation_result_stdout(@async-core.Stream[Byte]) -> @golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult -pub fn[T : @schema.IntoSchema] invocation_result_value(T) -> @golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult raise @golemcloud/golem_sdk/interface/golem/tool/common.ToolError +pub async fn[T : @schema.IntoSchema] invocation_result_value(T) -> @golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult raise @golemcloud/golem_sdk/interface/golem/tool/common.ToolError -pub fn[T : @schema.IntoSchema] invocation_result_value_with_stdout(T, @async-core.Stream[Byte]) -> @golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult raise @golemcloud/golem_sdk/interface/golem/tool/common.ToolError +pub async fn[T : @schema.IntoSchema] invocation_result_value_with_stdout(T, @async-core.Stream[Byte]) -> @golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult raise @golemcloud/golem_sdk/interface/golem/tool/common.ToolError pub async fn[E] invoke_and_await(@host.ToolRpc, Array[String], @schema_model.TypedSchemaValue, @async-core.Stream[Byte]?, (@schema_model.TypedSchemaValue) -> Result[E, String]) -> Result[InvocationResult, ToolError[E]] @@ -63,9 +65,9 @@ pub async fn[E : @schema.FromSchema] invoke_and_await_payload_error(@host.ToolRp pub async fn[E : ToolErrorSchema] invoke_and_await_tool_error(@host.ToolRpc, Array[String], @schema_model.TypedSchemaValue, @async-core.Stream[Byte]?) -> Result[InvocationResult, ToolError[E]] -pub fn invoke_registered_subtool(String, Array[String], Array[CanonicalInputValue], @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError] +pub async fn invoke_registered_subtool(String, Array[String], Array[CanonicalInputValue], @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError] -pub fn invoke_registered_tool(String, Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError] +pub async fn invoke_registered_tool(String, Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError] pub fn literal_to_schema_value(@schema_model.SchemaGraph, ToolLiteral) -> @schema_model.SchemaValue raise ToolBuildError @@ -79,15 +81,21 @@ pub fn refine_text(@schema_model.SchemaGraph, String?, UInt?, UInt?) -> @schema_ pub fn refine_url(@schema_model.SchemaGraph, Array[String]?) -> @schema_model.SchemaGraph raise ToolBuildError -pub fn register_subtool_def_invoker(ToolDef, (Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError]) -> Unit raise ToolBuildError +pub fn register_subtool_def_invoker(ToolDef, async (Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError]) -> Unit raise ToolBuildError pub fn register_tool_def(ToolDef) -> Unit raise ToolBuildError -pub fn register_tool_def_invoker(ToolDef, (Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError]) -> Unit raise ToolBuildError +pub fn register_tool_def_invoker(ToolDef, async (Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError]) -> Unit raise ToolBuildError pub fn register_wire_tool(@golemcloud/golem_sdk/interface/golem/tool/common.Tool) -> Unit raise ToolBuildError -pub fn register_wire_tool_invoker(@golemcloud/golem_sdk/interface/golem/tool/common.Tool, (Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError]) -> Unit raise ToolBuildError +pub fn register_wire_tool_invoker(@golemcloud/golem_sdk/interface/golem/tool/common.Tool, async (Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/agent/common.Principal) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError]) -> Unit raise ToolBuildError + +pub fn reject_decoded_invocation(Array[CanonicalInputValue], @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError] + +pub fn reject_undecoded_invocation(@async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError] + +pub fn reject_wire_invocation(@types.TypedSchemaValue, @async-core.Stream[Byte]?, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError) -> Result[@golemcloud/golem_sdk/interface/golem/tool/common.InvocationResult, @golemcloud/golem_sdk/interface/golem/tool/common.ToolError] pub fn render_argument_help(@golemcloud/golem_sdk/interface/golem/tool/common.Tool, Array[String], String) -> Result[String, ToolBuildError] diff --git a/sdks/moonbit/golem_sdk/tool/registry.mbt b/sdks/moonbit/golem_sdk/tool/registry.mbt index 1764250a4a..a730a37a77 100644 --- a/sdks/moonbit/golem_sdk/tool/registry.mbt +++ b/sdks/moonbit/golem_sdk/tool/registry.mbt @@ -7,7 +7,7 @@ pub fn new_stdout() -> (@async-core.Stream[Byte], @async-core.Sink[Byte]) { } ///| -type ToolInvoker = ( +type ToolInvoker = async ( Array[String], @types.TypedSchemaValue, @async-core.Stream[Byte]?, @@ -118,51 +118,201 @@ pub fn get_registered_tool( } ///| -pub fn invoke_registered_tool( +pub async fn invoke_registered_tool( tool_name : String, command_path : Array[String], input : @types.TypedSchemaValue, stdin : @async-core.Stream[Byte]?, principal : @agentCommon.Principal, +) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + invoke_registered_tool_with_resource_drops( + tool_name, + command_path, + input, + stdin, + principal, + @model_host.resource_drops(), + ) +} + +///| +async fn invoke_registered_tool_with_resource_drops( + tool_name : String, + command_path : Array[String], + input : @types.TypedSchemaValue, + stdin : @async-core.Stream[Byte]?, + principal : @agentCommon.Principal, + drops : @model.SchemaValueResourceDrops, ) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { if !state.tools.contains(tool_name) { - return Err(@toolCommon.ToolError::InvalidToolName(tool_name)) + return reject_wire_invocation_with_resource_drops( + input, + stdin, + @toolCommon.ToolError::InvalidToolName(tool_name), + drops, + ) } - invoke_registered_invoker(tool_name, command_path, input, stdin, principal) + match state.defs.get(tool_name) { + Some(def) if def.command_index_by_path(command_path) is None => + return reject_wire_invocation_with_resource_drops( + input, + stdin, + @toolCommon.ToolError::InvalidCommandPath(command_path), + drops, + ) + _ => () + } + invoke_registered_invoker( + tool_name, command_path, input, stdin, principal, drops, + ) } ///| -fn invoke_registered_invoker( +async fn invoke_registered_invoker( tool_name : String, command_path : Array[String], input : @types.TypedSchemaValue, stdin : @async-core.Stream[Byte]?, principal : @agentCommon.Principal, + drops : @model.SchemaValueResourceDrops, ) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { match state.invokers.get(tool_name) { Some(invoker) => invoker(command_path, input, stdin, principal) - None => Err(@toolCommon.ToolError::InvalidToolName(tool_name)) + None => + reject_wire_invocation_with_resource_drops( + input, + stdin, + @toolCommon.ToolError::InvalidToolName(tool_name), + drops, + ) } } ///| -pub fn invoke_registered_subtool( +pub async fn invoke_registered_subtool( + tool_name : String, + command_path : Array[String], + fields : Array[CanonicalInputValue], + stdin : @async-core.Stream[Byte]?, + principal : @agentCommon.Principal, +) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + invoke_registered_subtool_with_resource_drops( + tool_name, + command_path, + fields, + stdin, + principal, + @model_host.resource_drops(), + ) +} + +///| +async fn invoke_registered_subtool_with_resource_drops( tool_name : String, command_path : Array[String], fields : Array[CanonicalInputValue], stdin : @async-core.Stream[Byte]?, principal : @agentCommon.Principal, + drops : @model.SchemaValueResourceDrops, ) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { - let def = match state.defs.get(tool_name) { - Some(def) => def - None => return Err(@toolCommon.ToolError::InvalidToolName(tool_name)) + let route = match state.defs.get(tool_name) { + None => Err(@toolCommon.ToolError::InvalidToolName(tool_name)) + Some(def) => + match def.command_index_by_path(command_path) { + None => Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) + Some(index) if !state.invokers.contains(tool_name) => + Err(@toolCommon.ToolError::InvalidToolName(tool_name)) + Some(index) => Ok((def, index)) + } } - let index = match def.command_index_by_path(command_path) { - Some(index) => index - None => return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) + let (def, index) = match route { + Err(error) => + return reject_decoded_invocation_with_resource_drops( + fields, stdin, error, drops, + ) + Ok(route) => route } let input = forward_canonical_input(fields, def, index) catch { - error => return Err(error) + error => + return reject_decoded_invocation_with_resource_drops( + fields, stdin, error, drops, + ) + } + release_canonical_input_values(fields, drops) + invoke_registered_invoker( + tool_name, command_path, input, stdin, principal, drops, + ) +} + +///| +pub fn reject_wire_invocation( + input : @types.TypedSchemaValue, + stdin : @async-core.Stream[Byte]?, + error : @toolCommon.ToolError, +) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + reject_wire_invocation_with_resource_drops( + input, + stdin, + error, + @model_host.resource_drops(), + ) +} + +///| +fn reject_wire_invocation_with_resource_drops( + input : @types.TypedSchemaValue, + stdin : @async-core.Stream[Byte]?, + error : @toolCommon.ToolError, + drops : @model.SchemaValueResourceDrops, +) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + try @model.typed_schema_value_from_wit(input, drops) catch { + _ => () + } noraise { + decoded => decoded.value.release_resources(drops) + } + drop_optional_stdin(stdin) + Err(error) +} + +///| +pub fn reject_undecoded_invocation( + stdin : @async-core.Stream[Byte]?, + error : @toolCommon.ToolError, +) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + drop_optional_stdin(stdin) + Err(error) +} + +///| +pub fn reject_decoded_invocation( + fields : Array[CanonicalInputValue], + stdin : @async-core.Stream[Byte]?, + error : @toolCommon.ToolError, +) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + reject_decoded_invocation_with_resource_drops( + fields, + stdin, + error, + @model_host.resource_drops(), + ) +} + +///| +fn reject_decoded_invocation_with_resource_drops( + fields : Array[CanonicalInputValue], + stdin : @async-core.Stream[Byte]?, + error : @toolCommon.ToolError, + drops : @model.SchemaValueResourceDrops, +) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + release_canonical_input_values(fields, drops) + drop_optional_stdin(stdin) + Err(error) +} + +///| +fn drop_optional_stdin(stdin : @async-core.Stream[Byte]?) -> Unit { + match stdin { + Some(stdin) => stdin.drop_sync() + None => () } - invoke_registered_invoker(tool_name, command_path, input, stdin, principal) } diff --git a/sdks/moonbit/golem_sdk/tool/resource_cleanup_wbtest.mbt b/sdks/moonbit/golem_sdk/tool/resource_cleanup_wbtest.mbt new file mode 100644 index 0000000000..6182729b43 --- /dev/null +++ b/sdks/moonbit/golem_sdk/tool/resource_cleanup_wbtest.mbt @@ -0,0 +1,266 @@ +///| +fn cleanup_drops() -> @model.SchemaValueResourceDrops { + { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + } +} + +///| +fn cleanup_string_graph() -> @model.SchemaGraph raise { + @schema.schema_graph_of_tag((@schema.type_tag() : @schema.TypeTag[String])) +} + +///| +test "parameter failure rolls back an earlier decoded stream" { + let first_source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(1), + ) + let second_source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(2), + ) + let fields = [ + @model.SchemaValue::Stream(first_source), + @model.SchemaValue::Stream(second_source), + ] + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + let first : @schema.AgentStream[Int] = decode_param_with_resource_drops( + fields, 0, "partial transfer", drops, + ) + guard @schema.to_value_as(first) is @model.SchemaValue::Stream(first_owned) else { + fail("expected the first stream to decode") + } + assert_true(first_source.is_present()) + assert_true(first_owned.is_present()) + let result : Result[Int, _] = try? decode_param_with_resource_drops( + fields, 1, "partial transfer", drops, + ) + guard result is Err(@toolCommon.ToolError::InvalidInput(_)) else { + fail("decoding the second stream as Int must fail") + } + assert_false(first_owned.is_present()) + assert_false(first_source.is_present()) + assert_false(second_source.is_present()) + @model.SchemaValue::Stream(first_owned).release_resources(drops) + @model.SchemaValue::Record(fields).release_resources(drops) + assert_eq(dropped[0], 2) +} + +///| +test "canonical field rejection releases undecoded streams" { + let source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(3), + ) + let fields : Array[CanonicalInputValue] = [ + { + name: "stream", + aliases: [], + type_: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }, + ] + let result : Result[Int, _] = try? decode_canonical_field_with_resource_drops( + fields, + "missing", + "canonical cleanup", + cleanup_drops(), + ) + guard result is Err(@toolCommon.ToolError::InvalidInput(_)) else { + fail("a missing canonical field must fail") + } + assert_false(source.is_present()) +} + +///| +test "subtool routing rejection releases unforwarded streams" { + run_async_test(() => { + let source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(4), + ) + let result = invoke_registered_subtool_with_resource_drops( + "missing-cleanup-tool", + [], + [ + { + name: "stream", + aliases: [], + type_: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }, + ], + None, + @agentCommon.Principal::Anonymous, + cleanup_drops(), + ) + guard result is Err(@toolCommon.ToolError::InvalidToolName(_)) else { + fail("an unregistered subtool must fail") + } + assert_false(source.is_present()) + }) +} + +///| +test "top-level routing rejection drops wire stream resources" { + run_async_test(() => { + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + let input : @types.TypedSchemaValue = { + graph: @model.schema_graph_to_wit(cleanup_string_graph()), + value: { + value_nodes: [ + @types.StreamValue(@types.SchemaValueStream::SchemaValueStream(14)), + ], + root: 0, + }, + } + let result = invoke_registered_tool_with_resource_drops( + "missing-wire-cleanup-tool", + [], + input, + None, + @agentCommon.Principal::Anonymous, + drops, + ) + guard result is Err(@toolCommon.ToolError::InvalidToolName(_)) else { + fail("an unregistered top-level tool must fail") + } + assert_eq(dropped[0], 1) + }) +} + +///| +test "subtool with no invoker drops source before forwarding" { + run_async_test(() => { + let base = canonical_test_def() + let command = base.commands[0] + let def : ToolDef = { + version: base.version, + commands: [ + { + name: "cleanup-no-invoker", + aliases: command.aliases, + doc: command.doc, + globals: command.globals, + subcommands: [], + body: command.body, + }, + ], + } + register_tool_def(def) + let source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(15), + ) + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + let result = invoke_registered_subtool_with_resource_drops( + "cleanup-no-invoker", + [], + [ + { + name: "global", + aliases: [], + type_: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }, + ], + None, + @agentCommon.Principal::Anonymous, + drops, + ) + guard result is Err(@toolCommon.ToolError::InvalidToolName(_)) else { + fail("a subtool without an invoker must fail") + } + assert_false(source.is_present()) + assert_eq(dropped[0], 1) + }) +} + +///| +test "tool result conversion failure releases decoded streams" { + let source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(5), + ) + let result : Result[Int, ToolError[NoToolError]] = decode_result_value_with_resource_drops( + { + result: Some({ + graph: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }), + stdout: None, + }, + cleanup_drops(), + ) + guard result is Err(ToolError::Rpc(RpcError::Protocol(_))) else { + fail("decoding a stream result as Int must fail") + } + assert_false(source.is_present()) +} + +///| +test "tool result validates stdout before transferring its value" { + let source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(6), + ) + let result : Result[ + (@schema.AgentStream[Int], @async-core.Stream[Byte]), + ToolError[NoToolError], + ] = decode_result_with_stdout_with_resource_drops( + { + result: Some({ + graph: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }), + stdout: None, + }, + cleanup_drops(), + ) + guard result is Err(ToolError::Rpc(RpcError::Protocol(_))) else { + fail("a missing stdout stream must fail") + } + assert_false(source.is_present()) +} + +///| +test "tool input encoding failure drops value streams and stdin" { + run_async_test(() => { + let (value_reader, value_sink) = @async-core.Stream::new() + let value_source = @model.GuestSchemaValueStreamHandle::from_native( + value_reader, + ) + let (stdin, stdin_sink) = @async-core.Stream::new() + let invalid_graph : @model.SchemaGraph = { + defs: [], + root: @model.schema_type(@model.SchemaTypeBody::Ref("missing-type")), + } + let result = invoke_and_await_no_tool_error( + @toolHost.ToolRpc::ToolRpc(0), + [], + { graph: invalid_graph, value: @model.SchemaValue::Stream(value_source) }, + Some(stdin), + ) + guard result is Err(ToolError::Rpc(RpcError::Protocol(_))) else { + fail("an invalid input graph must fail before invoking the host") + } + assert_false(value_source.is_present()) + assert_false(value_sink.is_open()) + assert_false(stdin_sink.is_open()) + }) +} diff --git a/sdks/moonbit/golem_sdk/tool/tool_test.mbt b/sdks/moonbit/golem_sdk/tool/tool_wbtest.mbt similarity index 59% rename from sdks/moonbit/golem_sdk/tool/tool_test.mbt rename to sdks/moonbit/golem_sdk/tool/tool_wbtest.mbt index 5c3ef9dfc6..ee2dfb74ca 100644 --- a/sdks/moonbit/golem_sdk/tool/tool_test.mbt +++ b/sdks/moonbit/golem_sdk/tool/tool_wbtest.mbt @@ -1,3 +1,140 @@ +///| +fn run_async_test_noraise(block : async () -> Unit noraise) -> Unit = "%async.run" + +///| +fn run_async_test(block : async () -> Unit) -> Unit { + let failure : Array[String?] = [None] + run_async_test_noraise(() => { + try block() catch { + error => failure[0] = Some(repr(error)) + } noraise { + _ => () + } + }) + match failure[0] { + Some(message) => abort(message) + None => () + } +} + +///| +fn test_resource_drops() -> @model.SchemaValueResourceDrops { + { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { }, + drop_native_stream: fn(_) { }, + } +} + +///| +fn decode_canonical_input_for_test( + def : ToolDef, + command_index : Int, + input : @types.TypedSchemaValue, + context : String, +) -> Array[CanonicalInputValue] raise @toolCommon.ToolError { + decode_canonical_input_with_resource_drops( + def, + command_index, + input, + context, + test_resource_drops(), + ) +} + +///| +fn decode_invocation_input_for_test( + input : @types.TypedSchemaValue, + arity : Int, + context : String, +) -> Array[@model.SchemaValue] raise @toolCommon.ToolError { + decode_invocation_input_with_resource_drops( + input, + arity, + context, + test_resource_drops(), + ) +} + +///| +fn[T : @schema.IntoSchema + @schema.FromSchema] decode_canonical_field_for_test( + fields : Array[CanonicalInputValue], + name : String, + context : String, +) -> T raise @toolCommon.ToolError { + decode_canonical_field_with_resource_drops( + fields, + name, + context, + test_resource_drops(), + ) +} + +///| +fn[T : @schema.FromSchema] decode_param_for_test( + fields : Array[@model.SchemaValue], + index : Int, + context : String, +) -> T raise @toolCommon.ToolError { + decode_param_with_resource_drops( + fields, + index, + context, + test_resource_drops(), + ) +} + +///| +async fn invoke_registered_subtool_for_test( + tool_name : String, + command_path : Array[String], + fields : Array[CanonicalInputValue], + stdin : @async-core.Stream[Byte]?, + principal : @agentCommon.Principal, +) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + invoke_registered_subtool_with_resource_drops( + tool_name, + command_path, + fields, + stdin, + principal, + test_resource_drops(), + ) +} + +///| +test "rejected tool envelopes drop reached stream resources" { + let dropped = [0] + let input : @types.TypedSchemaValue = { + graph: @model.schema_graph_to_wit({ + defs: [], + root: @model.schema_type(@model.SchemaTypeBody::Record([])), + }), + value: { + value_nodes: [ + @types.StreamValue(@types.SchemaValueStream::SchemaValueStream(91)), + ], + root: 0, + }, + } + let result = try? decode_invocation_input_with_resource_drops( + input, + 0, + "tool cleanup", + { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + }, + ) + guard result is Err(@toolCommon.ToolError::InvalidInput(_)) else { + fail("expected the schema/value mismatch to be rejected") + } + assert_eq(dropped[0], 1) +} + ///| fn doc(summary : String) -> @toolCommon.Doc { { summary, description: "details for " + summary, examples: [] } @@ -95,401 +232,428 @@ fn[T] unwrap_tool_result(result : Result[T, ToolBuildError]) -> T { ///| test "subtree-only tool cannot be invoked as a top-level tool" { - let def = canonical_test_def() - register_subtool_def_invoker(def, fn(_, _, _, _) { - Ok(invocation_result_empty()) - }) - assert_true( - get_registered_tool("root") - is Err(@toolCommon.ToolError::InvalidToolName("root")), - ) - let input = @model.typed_schema_value_to_wit( - @schema.try_into_typed_schema_value(()), - ) - assert_true( - invoke_registered_tool( - "root", - [], - input, - None, - @agentCommon.Principal::Anonymous, + run_async_test(() => { + let def = canonical_test_def() + register_subtool_def_invoker(def, fn(_, _, _, _) { + Ok(invocation_result_empty()) + }) + assert_true( + get_registered_tool("root") + is Err(@toolCommon.ToolError::InvalidToolName("root")), ) - is Err(@toolCommon.ToolError::InvalidToolName("root")), - ) + let input = @model.typed_schema_value_to_wit( + @schema.try_into_typed_schema_value(()), + ) + assert_true( + invoke_registered_tool( + "root", + [], + input, + None, + @agentCommon.Principal::Anonymous, + ) + is Err(@toolCommon.ToolError::InvalidToolName("root")), + ) + }) } ///| test "grafted subtree forwards a global captured only by short name" { - let flag = fn(long : String) -> @toolCommon.FlagSpec { - { - long, - short: Some('v'), - aliases: [], - doc: doc(long), - shape: @toolCommon.FlagShape::BoolFlag({ - default: false, - negatable: false, - }), - env_var: None, - } - } - let child : ToolDef = { - version: "1", - commands: [ + run_async_test(() => { + let flag = fn(long : String) -> @toolCommon.FlagSpec { { - name: "short-forward-child", + long, + short: Some('v'), aliases: [], - doc: doc("short forward child"), - globals: { options: [], flags: [flag("child-verbose")] }, - subcommands: [], - body: Some({ - positionals: { fixed: [], tail: None }, - options: [], - flags: [], - constraints: [], - stdin: None, - stdout: None, - result: None, - errors: [], - annotations: None, + doc: doc(long), + shape: @toolCommon.FlagShape::BoolFlag({ + default: false, + negatable: false, }), - }, - ], - } - let parent_base : ToolDef = { - version: "1", - commands: [ - { - name: "short-forward-parent", - aliases: [], - doc: doc("short forward parent"), - globals: { options: [], flags: [] }, - subcommands: [], - body: None, - }, - ], - } - let parent = parent_base.graft_subtree( - child, - "short-forward-child", - { options: [], flags: [flag("parent-verbose")] }, - None, - None, - None, - ) - let parent_index = parent.command_index_by_path(["short-forward-child"]) - guard parent_index is Some(parent_index) else { - fail("expected grafted child command") - } - let parent_fields = parent.canonical_input_fields(parent_index) - inspect(parent_fields.map(field => field.name), content="[parent-verbose]") - assert_true(parent_fields[0].aliases.contains("v")) - register_subtool_def_invoker(child, fn(command_path, input, _, _) { - guard command_path.length() == 0 else { - return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) + env_var: None, + } } - let decoded = decode_canonical_input(child, 0, input, "short child") catch { - error => return Err(error) + let child : ToolDef = { + version: "1", + commands: [ + { + name: "short-forward-child", + aliases: [], + doc: doc("short forward child"), + globals: { options: [], flags: [flag("child-verbose")] }, + subcommands: [], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], } - let verbose : Bool = decode_canonical_field( - decoded, "child-verbose", "short child", - ) catch { - error => return Err(error) + let parent_base : ToolDef = { + version: "1", + commands: [ + { + name: "short-forward-parent", + aliases: [], + doc: doc("short forward parent"), + globals: { options: [], flags: [] }, + subcommands: [], + body: None, + }, + ], } - if verbose { - Ok(invocation_result_empty()) - } else { - Err(@toolCommon.ToolError::InvalidInput("short flag was not forwarded")) + let parent = parent_base.graft_subtree( + child, + "short-forward-child", + { options: [], flags: [flag("parent-verbose")] }, + None, + None, + None, + ) + let parent_index = parent.command_index_by_path(["short-forward-child"]) + guard parent_index is Some(parent_index) else { + fail("expected grafted child command") } - }) - register_tool_def_invoker(parent, fn(command_path, input, stdin, principal) { - let index = match parent.command_index_by_path(command_path) { - Some(index) => index - None => + let parent_fields = parent.canonical_input_fields(parent_index) + inspect(parent_fields.map(field => field.name), content="[parent-verbose]") + assert_true(parent_fields[0].aliases.contains("v")) + register_subtool_def_invoker(child, fn(command_path, input, _, _) { + guard command_path.length() == 0 else { return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) - } - let decoded = decode_canonical_input(parent, index, input, "short parent") catch { - error => return Err(error) - } - invoke_registered_subtool( - "short-forward-child", - command_path[1:].to_array(), - decoded, + } + let decoded = decode_canonical_input_for_test( + child, 0, input, "short child", + ) catch { + error => return Err(error) + } + let verbose : Bool = decode_canonical_field_for_test( + decoded, "child-verbose", "short child", + ) catch { + error => return Err(error) + } + if verbose { + Ok(invocation_result_empty()) + } else { + Err(@toolCommon.ToolError::InvalidInput("short flag was not forwarded")) + } + }) + register_tool_def_invoker(parent, fn( + command_path, + input, stdin, principal, + ) { + let index = match parent.command_index_by_path(command_path) { + Some(index) => index + None => + return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) + } + let decoded = decode_canonical_input_for_test( + parent, index, input, "short parent", + ) catch { + error => return Err(error) + } + invoke_registered_subtool_for_test( + "short-forward-child", + command_path[1:].to_array(), + decoded, + stdin, + principal, + ) + }) + let model = parent.canonical_input_model(parent_index) + let input = build_canonical_input(model, [ + ("parent-verbose", @model.SchemaValue::Bool(true)), + ]) + let wire = @model.typed_schema_value_to_wit(input) + assert_true( + invoke_registered_tool( + "short-forward-parent", + ["short-forward-child"], + wire, + None, + @agentCommon.Principal::Anonymous, + ) + is Ok(_), ) }) - let model = parent.canonical_input_model(parent_index) - let input = build_canonical_input(model, [ - ("parent-verbose", @model.SchemaValue::Bool(true)), - ]) - let wire = @model.typed_schema_value_to_wit(input) - assert_true( - invoke_registered_tool( - "short-forward-parent", - ["short-forward-child"], - wire, - None, - @agentCommon.Principal::Anonymous, - ) - is Ok(_), - ) } ///| test "deprojected child global does not consume a descendant local input" { - let string = string_graph() - let option = fn(long : String, short : Char?) -> OptionSpecDef { - { - long, - short, - aliases: [], - doc: doc(long), - value_name: None, - shape: OptionShapeDef::Scalar(string), - default: None, - required: true, - env_var: None, - } - } - let child_raw : ToolDef = { - version: "1", - commands: [ + run_async_test(() => { + let string = string_graph() + let option = fn(long : String, short : Char?) -> OptionSpecDef { { - name: "deproject-child", + long, + short, aliases: [], - doc: doc("deproject child"), - globals: { options: [option("format", Some('f'))], flags: [] }, - subcommands: [1], - body: Some({ - positionals: { fixed: [], tail: None }, - options: [], - flags: [], - constraints: [], - stdin: None, - stdout: None, - result: None, - errors: [], - annotations: None, - }), - }, - { - name: "run", - aliases: [], - doc: doc("run"), - globals: { options: [], flags: [] }, - subcommands: [], - body: Some({ - positionals: { fixed: [], tail: None }, - options: [option("format", None)], - flags: [], - constraints: [], - stdin: None, - stdout: None, - result: None, - errors: [], - annotations: None, - }), - }, - ], - } - let child = child_raw.normalize_inherited_globals() - let parent_base : ToolDef = { - version: "1", - commands: [ - { - name: "deproject-parent", - aliases: [], - doc: doc("deproject parent"), - globals: { options: [], flags: [] }, - subcommands: [], - body: None, - }, - ], - } - let parent = parent_base - .graft_subtree( - child_raw, - "deproject-child", - { options: [option("count", Some('f'))], flags: [] }, - None, - None, - None, - ) - .normalize_inherited_globals() - let parent_index = parent.command_index_by_path(["deproject-child", "run"]) - guard parent_index is Some(parent_index) else { - fail("expected grafted descendant command") - } - inspect( - parent.canonical_input_fields(parent_index).map(field => field.name), - content="[count, format]", - ) - register_subtool_def_invoker(child, fn(command_path, input, _, _) { - let index = match child.command_index_by_path(command_path) { - Some(index) => index - None => - return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } } - let decoded = decode_canonical_input(child, index, input, "deproject child") catch { - error => return Err(error) + let child_raw : ToolDef = { + version: "1", + commands: [ + { + name: "deproject-child", + aliases: [], + doc: doc("deproject child"), + globals: { options: [option("format", Some('f'))], flags: [] }, + subcommands: [1], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + { + name: "run", + aliases: [], + doc: doc("run"), + globals: { options: [], flags: [] }, + subcommands: [], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [option("format", None)], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], } - let format : String = decode_canonical_field( - decoded, "format", "deproject child", - ) catch { - error => return Err(error) + let child = child_raw.normalize_inherited_globals() + let parent_base : ToolDef = { + version: "1", + commands: [ + { + name: "deproject-parent", + aliases: [], + doc: doc("deproject parent"), + globals: { options: [], flags: [] }, + subcommands: [], + body: None, + }, + ], } - if format == "local" { - Ok(invocation_result_empty()) - } else { - Err(@toolCommon.ToolError::InvalidInput("descendant input was shadowed")) + let parent = parent_base + .graft_subtree( + child_raw, + "deproject-child", + { options: [option("count", Some('f'))], flags: [] }, + None, + None, + None, + ) + .normalize_inherited_globals() + let parent_index = parent.command_index_by_path(["deproject-child", "run"]) + guard parent_index is Some(parent_index) else { + fail("expected grafted descendant command") } - }) - let model = parent.canonical_input_model(parent_index) - let input = build_canonical_input(model, [ - ("count", @model.SchemaValue::String("inherited")), - ("format", @model.SchemaValue::String("local")), - ]) - let wire = @model.typed_schema_value_to_wit(input) - let fields = decode_canonical_input( - parent, parent_index, wire, "deproject parent", - ) - assert_true( - invoke_registered_subtool( - "deproject-child", - ["run"], - fields, - None, - @agentCommon.Principal::Anonymous, + inspect( + parent.canonical_input_fields(parent_index).map(field => field.name), + content="[count, format]", ) - is Ok(_), - ) + register_subtool_def_invoker(child, fn(command_path, input, _, _) { + let index = match child.command_index_by_path(command_path) { + Some(index) => index + None => + return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) + } + let decoded = decode_canonical_input_for_test( + child, index, input, "deproject child", + ) catch { + error => return Err(error) + } + let format : String = decode_canonical_field_for_test( + decoded, "format", "deproject child", + ) catch { + error => return Err(error) + } + if format == "local" { + Ok(invocation_result_empty()) + } else { + Err( + @toolCommon.ToolError::InvalidInput("descendant input was shadowed"), + ) + } + }) + let model = parent.canonical_input_model(parent_index) + let input = build_canonical_input(model, [ + ("count", @model.SchemaValue::String("inherited")), + ("format", @model.SchemaValue::String("local")), + ]) + let wire = @model.typed_schema_value_to_wit(input) + let fields = decode_canonical_input_for_test( + parent, parent_index, wire, "deproject parent", + ) + assert_true( + invoke_registered_subtool_for_test( + "deproject-child", + ["run"], + fields, + None, + @agentCommon.Principal::Anonymous, + ) + is Ok(_), + ) + }) } ///| test "bug finder forwarding prefers surviving descendant over ancestor alias" { - let string = string_graph() - let option = fn(long : String, aliases : Array[String]) -> OptionSpecDef { - { - long, - short: None, - aliases, - doc: doc(long), - value_name: None, - shape: OptionShapeDef::Scalar(string), - default: None, - required: true, - env_var: None, - } - } - let child_raw : ToolDef = { - version: "1", - commands: [ + run_async_test(() => { + let string = string_graph() + let option = fn(long : String, aliases : Array[String]) -> OptionSpecDef { { - name: "ranked-forward-child", - aliases: [], - doc: doc("ranked forward child"), - globals: { options: [option("format", ["leaf"])], flags: [] }, - subcommands: [1], - body: None, - }, - { - name: "run", - aliases: [], - doc: doc("run"), - globals: { options: [], flags: [] }, - subcommands: [], - body: Some({ - positionals: { fixed: [], tail: None }, - options: [option("leaf", [])], - flags: [], - constraints: [], - stdin: None, - stdout: None, - result: None, - errors: [], - annotations: None, - }), - }, - ], - } - let child = child_raw.normalize_inherited_globals() - inspect( - child.canonical_input_fields(1).map(field => field.name), - content="[format]", - ) - let parent_base : ToolDef = { - version: "1", - commands: [ - { - name: "ranked-forward-parent", - aliases: [], - doc: doc("ranked forward parent"), - globals: { options: [], flags: [] }, - subcommands: [], - body: None, - }, - ], - } - let parent = parent_base - .graft_subtree( - child_raw, - "ranked-forward-child", - { options: [option("parent-value", ["format"])], flags: [] }, - None, - None, - None, - ) - .normalize_inherited_globals() - let parent_index = parent.command_index_by_path([ - "ranked-forward-child", "run", - ]) - guard parent_index is Some(parent_index) else { - fail("expected grafted descendant command") - } - inspect( - parent.canonical_input_fields(parent_index).map(field => field.name), - content="[parent-value, leaf]", - ) - register_subtool_def_invoker(child, fn(command_path, input, _, _) { - let index = match child.command_index_by_path(command_path) { - Some(index) => index - None => - return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) + long, + short: None, + aliases, + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } } - let decoded = decode_canonical_input(child, index, input, "ranked child") catch { - error => return Err(error) + let child_raw : ToolDef = { + version: "1", + commands: [ + { + name: "ranked-forward-child", + aliases: [], + doc: doc("ranked forward child"), + globals: { options: [option("format", ["leaf"])], flags: [] }, + subcommands: [1], + body: None, + }, + { + name: "run", + aliases: [], + doc: doc("run"), + globals: { options: [], flags: [] }, + subcommands: [], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [option("leaf", [])], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], } - let leaf : String = decode_canonical_field( - decoded, "format", "ranked child", - ) catch { - error => return Err(error) + let child = child_raw.normalize_inherited_globals() + inspect( + child.canonical_input_fields(1).map(field => field.name), + content="[format]", + ) + let parent_base : ToolDef = { + version: "1", + commands: [ + { + name: "ranked-forward-parent", + aliases: [], + doc: doc("ranked forward parent"), + globals: { options: [], flags: [] }, + subcommands: [], + body: None, + }, + ], } - if leaf == "local" { - Ok(invocation_result_empty()) - } else { - Err(@toolCommon.ToolError::InvalidInput("ancestor alias won forwarding")) + let parent = parent_base + .graft_subtree( + child_raw, + "ranked-forward-child", + { options: [option("parent-value", ["format"])], flags: [] }, + None, + None, + None, + ) + .normalize_inherited_globals() + let parent_index = parent.command_index_by_path([ + "ranked-forward-child", "run", + ]) + guard parent_index is Some(parent_index) else { + fail("expected grafted descendant command") + } + inspect( + parent.canonical_input_fields(parent_index).map(field => field.name), + content="[parent-value, leaf]", + ) + register_subtool_def_invoker(child, fn(command_path, input, _, _) { + let index = match child.command_index_by_path(command_path) { + Some(index) => index + None => + return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) + } + let decoded = decode_canonical_input_for_test( + child, index, input, "ranked child", + ) catch { + error => return Err(error) + } + let leaf : String = decode_canonical_field_for_test( + decoded, "format", "ranked child", + ) catch { + error => return Err(error) + } + if leaf == "local" { + Ok(invocation_result_empty()) + } else { + Err( + @toolCommon.ToolError::InvalidInput("ancestor alias won forwarding"), + ) + } + }) + let model = parent.canonical_input_model(parent_index) + let input = build_canonical_input(model, [ + ("parent-value", @model.SchemaValue::String("ancestor")), + ("leaf", @model.SchemaValue::String("local")), + ]) + let fields = decode_canonical_input_for_test( + parent, + parent_index, + @model.typed_schema_value_to_wit(input), + "ranked parent", + ) + let result = invoke_registered_subtool_for_test( + "ranked-forward-child", + ["run"], + fields, + None, + @agentCommon.Principal::Anonymous, + ) + guard result is Ok(_) else { + fail("surviving descendant was not forwarded") } }) - let model = parent.canonical_input_model(parent_index) - let input = build_canonical_input(model, [ - ("parent-value", @model.SchemaValue::String("ancestor")), - ("leaf", @model.SchemaValue::String("local")), - ]) - let fields = decode_canonical_input( - parent, - parent_index, - @model.typed_schema_value_to_wit(input), - "ranked parent", - ) - let result = invoke_registered_subtool( - "ranked-forward-child", - ["run"], - fields, - None, - @agentCommon.Principal::Anonymous, - ) - guard result is Ok(_) else { fail("surviving descendant was not forwarded") } } ///| @@ -547,13 +711,13 @@ test "reverse-alias deprojection retains the surviving canonical value" { let input = build_canonical_input(def.canonical_input_model(1), [ ("format", @model.SchemaValue::String("7")), ]) - let decoded = decode_canonical_input( + let decoded = decode_canonical_input_for_test( def, 1, @model.typed_schema_value_to_wit(input), "reverse alias", ) - let format : String = decode_canonical_field( + let format : String = decode_canonical_field_for_test( decoded, "format", "reverse alias", ) catch { _ => fail("surviving canonical field was not decoded") @@ -615,7 +779,7 @@ test "decode invocation input rejects graph root that is not a record" { let graph = string_graph() let typed = encode_invocation_input(graph, [@model.SchemaValue::String("x")]) let wire = @model.typed_schema_value_to_wit(typed) - try decode_invocation_input(wire, 1, "tool command") catch { + try decode_invocation_input_for_test(wire, 1, "tool command") catch { @toolCommon.ToolError::InvalidInput(_) => () _ => abort("expected invalid input") } noraise { @@ -639,8 +803,8 @@ test "decode invocation input rejects value that does not match typed schema fie } let wire = @model.typed_schema_value_to_wit(typed) try { - let fields = decode_invocation_input(wire, 1, "tool command") - let _decoded : Int = decode_param(fields, 0, "tool command") + let fields = decode_invocation_input_for_test(wire, 1, "tool command") + let _decoded : Int = decode_param_for_test(fields, 0, "tool command") } catch { @toolCommon.ToolError::InvalidInput(_) => () _ => abort("expected invalid input") @@ -649,6 +813,38 @@ test "decode invocation input rejects value that does not match typed schema fie } } +///| +test "decode invocation input accepts a stream value" { + let graph : @model.SchemaGraph = { + defs: [], + root: @model.schema_type( + @model.SchemaTypeBody::Record([ + @model.field( + "stream", + @model.schema_type(@model.SchemaTypeBody::Stream(None)), + ), + ]), + ), + } + let handle = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(92), + ) + let typed : @model.TypedSchemaValue = { + graph, + value: @model.SchemaValue::Record([@model.SchemaValue::Stream(handle)]), + } + let decoded = decode_invocation_input_for_test( + @model.typed_schema_value_to_wit(typed), + 1, + "stream tool command", + ) + guard decoded[0] is @model.SchemaValue::Stream(decoded_handle) else { + fail("expected a decoded stream value") + } + assert_true(decoded_handle.is_present()) + @model.SchemaValue::Record(decoded).release_resources(test_resource_drops()) +} + ///| test "decode invocation input rejects union value whose discriminator does not match branch" { let tagged_record = @model.schema_type( @@ -689,7 +885,7 @@ test "decode invocation input rejects union value whose discriminator does not m ]), } let wire = @model.typed_schema_value_to_wit(typed) - try decode_invocation_input(wire, 1, "tool command") catch { + try decode_invocation_input_for_test(wire, 1, "tool command") catch { @toolCommon.ToolError::InvalidInput(_) => () _ => abort("expected invalid input") } noraise { @@ -1004,8 +1200,8 @@ test "canonical model builds and decodes the expected named record" { } inspect(values[0], content="String(new)") let wire = @model.typed_schema_value_to_wit(input) - let decoded = decode_canonical_input(def, 1, wire, "leaf") - let force : Bool = decode_canonical_field(decoded, "f", "leaf") + let decoded = decode_canonical_input_for_test(def, 1, wire, "leaf") + let force : Bool = decode_canonical_field_for_test(decoded, "f", "leaf") assert_true(force) } @@ -1024,7 +1220,7 @@ test "canonical input rejects missing fields and mismatching wire schema" { value: @model.SchemaValue::String("not a record"), } let wire = @model.typed_schema_value_to_wit(mismatching) - try decode_canonical_input(def, 1, wire, "leaf") catch { + try decode_canonical_input_for_test(def, 1, wire, "leaf") catch { @toolCommon.ToolError::InvalidInput(_) => () _ => fail("expected invalid canonical input") } noraise { @@ -1209,8 +1405,8 @@ test "text-refined string canonical input round-trips through typed values" { ("value", @schema.to_value_as("aaa")), ]) let wire = @model.typed_schema_value_to_wit(input) - let decoded = decode_canonical_input(def, 0, wire, "echo") - let value : String = decode_canonical_field(decoded, "value", "echo") + let decoded = decode_canonical_input_for_test(def, 0, wire, "echo") + let value : String = decode_canonical_field_for_test(decoded, "value", "echo") inspect(value, content="aaa") } diff --git a/sdks/moonbit/golem_sdk/wit/deps/golem-agent/guest.wit b/sdks/moonbit/golem_sdk/wit/deps/golem-agent/guest.wit index dbe97ff310..d72413c288 100644 --- a/sdks/moonbit/golem_sdk/wit/deps/golem-agent/guest.wit +++ b/sdks/moonbit/golem_sdk/wit/deps/golem-agent/guest.wit @@ -15,8 +15,9 @@ interface guest { /// Invokes an agent. If create was not called before, it fails. /// /// `input` is a value tree whose root encodes the method's parameter list. - /// The result is `none` when the method's `output-schema` is `unit`, and - /// `some(value)` for a `single` output. + /// Streams are represented recursively by `stream-value` nodes. The result + /// is `none` when the method's `output-schema` is `unit`, and `some(value)` + /// for a `single` output. invoke: async func(method-name: string, input: schema-value-tree, principal: principal) -> result, agent-error>; /// Gets the agent type. If create was not called before, it fails diff --git a/sdks/moonbit/golem_sdk/wit/deps/golem-core-v2/golem-core-v2.wit b/sdks/moonbit/golem_sdk/wit/deps/golem-core-v2/golem-core-v2.wit index bb7dda191e..8a8dd02254 100644 --- a/sdks/moonbit/golem_sdk/wit/deps/golem-core-v2/golem-core-v2.wit +++ b/sdks/moonbit/golem_sdk/wit/deps/golem-core-v2/golem-core-v2.wit @@ -125,6 +125,17 @@ interface types { /// and reveal it only through capability-gated host interfaces. resource secret; + /// An affine wrapper around a native Component Model stream of schema + /// values. The indirection lets a stream occur anywhere in a recursive + /// `schema-value-tree` while preserving the native stream endpoint. + resource schema-value-stream { + /// Wraps any native schema-value reader for placement in a value tree. + wrap: static async func(reader: stream) -> own; + + /// Consumes a schema-value-stream wrapper and returns its native reader. + unwrap: static async func(value: own) -> stream; + } + // ============================================================ // Schema graph (self-contained type carrier) // ============================================================ @@ -524,8 +535,7 @@ interface types { // Capability nodes secret-value(own), quota-token-handle(own), - - // WASI P3 stubs (parseable only in the schema; no constructible values). + stream-value(own), } record variant-value-payload { @@ -584,4 +594,5 @@ interface types { graph: schema-graph, value: schema-value-tree, } + } diff --git a/sdks/moonbit/golem_sdk_example1/golem.yaml b/sdks/moonbit/golem_sdk_example1/golem.yaml index d99649ba25..e50ce80b8e 100644 --- a/sdks/moonbit/golem_sdk_example1/golem.yaml +++ b/sdks/moonbit/golem_sdk_example1/golem.yaml @@ -28,9 +28,9 @@ componentTemplates: dir: ../golem_sdk_tools - command: moon run cmd -- agents ../golem_sdk_example1 dir: ../golem_sdk_tools - - command: moon build --target wasm --release + - command: moon build --target wasm --release --target-dir _build - command: mkdir -p _build/wasm/debug - - command: wasm-tools component embed wit _build/wasm/release/build/{{ component_name | to_snake_case }}/{{ component_name | to_snake_case }}.wasm --encoding utf16 --output _build/wasm/debug/{{ component_name | to_snake_case }}.embed.wasm + - command: wasm-tools component embed wit _build/wasm/release/build/golemcloud/golem_sdk_example1/{{ component_name | to_snake_case }}/{{ component_name | to_snake_case }}.wasm --encoding utf16 --output _build/wasm/debug/{{ component_name | to_snake_case }}.embed.wasm - command: wasm-tools component new _build/wasm/debug/{{ component_name | to_snake_case }}.embed.wasm --output _build/wasm/debug/{{ component_name | to_snake_case }}.agent.wasm componentWasm: _build/wasm/debug/{{ component_name | to_snake_case }}.agent.wasm release: @@ -39,8 +39,8 @@ componentTemplates: dir: ../golem_sdk_tools - command: moon run cmd -- agents ../golem_sdk_example1 dir: ../golem_sdk_tools - - command: moon build --target wasm --release - - command: wasm-tools component embed wit _build/wasm/release/build/{{ component_name | to_snake_case }}/{{ component_name | to_snake_case }}.wasm --encoding utf16 --output _build/wasm/release/{{ component_name | to_snake_case }}.embed.wasm + - command: moon build --target wasm --release --target-dir _build + - command: wasm-tools component embed wit _build/wasm/release/build/golemcloud/golem_sdk_example1/{{ component_name | to_snake_case }}/{{ component_name | to_snake_case }}.wasm --encoding utf16 --output _build/wasm/release/{{ component_name | to_snake_case }}.embed.wasm - command: wasm-tools component new _build/wasm/release/{{ component_name | to_snake_case }}.embed.wasm --output _build/wasm/release/{{ component_name | to_snake_case }}.agent.wasm componentWasm: _build/wasm/release/{{ component_name | to_snake_case }}.agent.wasm diff --git a/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt b/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt index ce0da9991b..fe7c4271b5 100644 --- a/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt +++ b/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt @@ -748,7 +748,7 @@ fn __golem_tool_def_CanonicalGrep() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalGrep( +async fn __golem_tool_invoke_CanonicalGrep( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -759,7 +759,9 @@ fn __golem_tool_invoke_CanonicalGrep( match __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => { - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } @@ -772,7 +774,9 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep invocation", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) + } } match __golem_index { 0 => { @@ -783,7 +787,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command canonical-grep", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let color :CanonicalGrepColorMode = try { @tool.decode_canonical_field( @@ -792,7 +802,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command canonical-grep", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let pattern :String = try { @tool.decode_canonical_field( @@ -801,7 +817,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command canonical-grep", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let extra_patterns :Array[String] = try { @tool.decode_canonical_field( @@ -810,7 +832,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command canonical-grep", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let max_count :UInt? = try { @tool.decode_canonical_field( @@ -819,7 +847,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command canonical-grep", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let files :Array[@schema.Path] = try { @tool.decode_canonical_field( @@ -828,12 +862,20 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command canonical-grep", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let stdin = match __golem_stdin { Some(__golem_stream) => __golem_stream None => { - return Err( + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, @toolCommon.ToolError::InvalidInput( "required stdin stream is missing", ), @@ -864,6 +906,7 @@ fn __golem_tool_invoke_CanonicalGrep( ) } Err(error) => { + __golem_stdout.drop_sync() let payload = match CanonicalGrepError::to_error_payload_value(error) { Ok(payload) => payload Err(encode_error) => { @@ -875,23 +918,24 @@ fn __golem_tool_invoke_CanonicalGrep( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 1 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let case_sensitive :Bool = try { @tool.decode_canonical_field( __golem_decoded, @@ -899,7 +943,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command replace", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let color :CanonicalGrepColorMode = try { @tool.decode_canonical_field( @@ -908,7 +958,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command replace", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let pattern :String = try { @tool.decode_canonical_field( @@ -917,7 +973,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command replace", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let replacement :String = try { @tool.decode_canonical_field( @@ -926,7 +988,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command replace", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let files :Array[@schema.Path] = try { @tool.decode_canonical_field( @@ -935,7 +1003,13 @@ fn __golem_tool_invoke_CanonicalGrep( "tool canonical-grep command replace", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalGrep::replace( case_sensitive, @@ -965,23 +1039,21 @@ fn __golem_tool_invoke_CanonicalGrep( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => { + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) + } } } @@ -1616,7 +1688,7 @@ fn __golem_tool_def_CanonicalGit() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalGit( +async fn __golem_tool_invoke_CanonicalGit( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -1627,7 +1699,9 @@ fn __golem_tool_invoke_CanonicalGit( match __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => { - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } @@ -1640,7 +1714,9 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git invocation", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) + } } if __golem_command_path.length() > 0 && ["remote", "rmt"].contains( __golem_command_path[0], @@ -1666,6 +1742,15 @@ fn __golem_tool_invoke_CanonicalGit( } match __golem_index { 1 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let verbose :UInt = try { @tool.decode_canonical_field( __golem_decoded, @@ -1673,7 +1758,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let git_dir :@schema.Path = try { @tool.decode_canonical_field( @@ -1682,7 +1773,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let paginate :Bool = try { @tool.decode_canonical_field( @@ -1691,7 +1788,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let config :Map[String, String] = try { @tool.decode_canonical_field( @@ -1700,7 +1803,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let message :String = try { @tool.decode_canonical_field( @@ -1709,7 +1818,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let author :String? = try { @tool.decode_canonical_field( @@ -1718,7 +1833,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let amend :Bool = try { @tool.decode_canonical_field( @@ -1727,7 +1848,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let signoff :Bool = try { @tool.decode_canonical_field( @@ -1736,7 +1863,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let reset_author :Bool = try { @tool.decode_canonical_field( @@ -1745,7 +1878,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let output :CanonicalGitOutputMode = try { @tool.decode_canonical_field( @@ -1754,7 +1893,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command commit", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalGit::commit( verbose, @@ -1790,23 +1935,24 @@ fn __golem_tool_invoke_CanonicalGit( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 2 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let max_count :Int64? = try { @tool.decode_canonical_field( __golem_decoded, @@ -1814,7 +1960,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let since :@types.Datetime? = try { @tool.decode_canonical_field( @@ -1823,7 +1975,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let until :@types.Datetime? = try { @tool.decode_canonical_field( @@ -1832,7 +1990,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let author :Array[String] = try { @tool.decode_canonical_field( @@ -1841,7 +2005,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let grep :Array[String] = try { @tool.decode_canonical_field( @@ -1850,7 +2020,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let all_match :Bool = try { @tool.decode_canonical_field( @@ -1859,7 +2035,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let invert_grep :Bool = try { @tool.decode_canonical_field( @@ -1868,7 +2050,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let oneline :Bool = try { @tool.decode_canonical_field( @@ -1877,7 +2065,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let graph :Bool = try { @tool.decode_canonical_field( @@ -1886,7 +2080,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let paths :Array[@schema.Path] = try { @tool.decode_canonical_field( @@ -1895,7 +2095,13 @@ fn __golem_tool_invoke_CanonicalGit( "tool canonical-git command log", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalGit::log( max_count, @@ -1930,23 +2136,21 @@ fn __golem_tool_invoke_CanonicalGit( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => { + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) + } } } @@ -2271,7 +2475,7 @@ fn __golem_tool_def_CanonicalRemote() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalRemote( +async fn __golem_tool_invoke_CanonicalRemote( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -2282,7 +2486,9 @@ fn __golem_tool_invoke_CanonicalRemote( match __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => { - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } @@ -2295,10 +2501,21 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote invocation", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) + } } match __golem_index { 1 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let verbose :UInt = try { @tool.decode_canonical_field( __golem_decoded, @@ -2306,7 +2523,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command add", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let name :String = try { @tool.decode_canonical_field( @@ -2315,7 +2538,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command add", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let url :@schema.Url = try { @tool.decode_canonical_field( @@ -2324,7 +2553,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command add", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let track :Array[String] = try { @tool.decode_canonical_field( @@ -2333,7 +2568,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command add", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let master :String? = try { @tool.decode_canonical_field( @@ -2342,7 +2583,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command add", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let tags :Bool = try { @tool.decode_canonical_field( @@ -2351,7 +2598,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command add", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let fetch :Bool = try { @tool.decode_canonical_field( @@ -2360,7 +2613,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command add", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalRemote::add(verbose, name, url, track, master, tags, fetch) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2377,23 +2636,24 @@ fn __golem_tool_invoke_CanonicalRemote( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 2 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let name :String = try { @tool.decode_canonical_field( __golem_decoded, @@ -2401,7 +2661,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command remove", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalRemote::remove(name) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2418,23 +2684,24 @@ fn __golem_tool_invoke_CanonicalRemote( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 3 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let name :String = try { @tool.decode_canonical_field( __golem_decoded, @@ -2442,7 +2709,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command set-url", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let newurl :@schema.Url = try { @tool.decode_canonical_field( @@ -2451,7 +2724,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command set-url", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let oldurl :@schema.Url? = try { @tool.decode_canonical_field( @@ -2460,7 +2739,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command set-url", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let push :Bool = try { @tool.decode_canonical_field( @@ -2469,7 +2754,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command set-url", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let add :Bool = try { @tool.decode_canonical_field( @@ -2478,7 +2769,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command set-url", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let delete :Bool = try { @tool.decode_canonical_field( @@ -2487,7 +2784,13 @@ fn __golem_tool_invoke_CanonicalRemote( "tool remote command set-url", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalRemote::set_url(name, newurl, oldurl, push, add, delete) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2504,23 +2807,21 @@ fn __golem_tool_invoke_CanonicalRemote( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => { + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) + } } } @@ -2740,7 +3041,7 @@ fn __golem_tool_def_CanonicalStash() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalStash( +async fn __golem_tool_invoke_CanonicalStash( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -2751,7 +3052,9 @@ fn __golem_tool_invoke_CanonicalStash( match __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => { - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } @@ -2764,10 +3067,21 @@ fn __golem_tool_invoke_CanonicalStash( "tool stash invocation", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) + } } match __golem_index { 0 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let verbose :UInt = try { @tool.decode_canonical_field( __golem_decoded, @@ -2775,7 +3089,13 @@ fn __golem_tool_invoke_CanonicalStash( "tool stash command stash", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let message :String = try { @tool.decode_canonical_field( @@ -2784,7 +3104,13 @@ fn __golem_tool_invoke_CanonicalStash( "tool stash command stash", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let keep_index :Bool = try { @tool.decode_canonical_field( @@ -2793,7 +3119,13 @@ fn __golem_tool_invoke_CanonicalStash( "tool stash command stash", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalStash::stash(verbose, message, keep_index) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2809,23 +3141,24 @@ fn __golem_tool_invoke_CanonicalStash( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 1 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let name :String? = try { @tool.decode_canonical_field( __golem_decoded, @@ -2833,7 +3166,13 @@ fn __golem_tool_invoke_CanonicalStash( "tool stash command pop", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let index :UInt? = try { @tool.decode_canonical_field( @@ -2842,7 +3181,13 @@ fn __golem_tool_invoke_CanonicalStash( "tool stash command pop", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalStash::pop(name, index) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2858,23 +3203,24 @@ fn __golem_tool_invoke_CanonicalStash( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 2 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let name :String? = try { @tool.decode_canonical_field( __golem_decoded, @@ -2882,7 +3228,13 @@ fn __golem_tool_invoke_CanonicalStash( "tool stash command apply", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } let index :UInt? = try { @tool.decode_canonical_field( @@ -2891,7 +3243,13 @@ fn __golem_tool_invoke_CanonicalStash( "tool stash command apply", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalStash::apply(name, index) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2907,23 +3265,21 @@ fn __golem_tool_invoke_CanonicalStash( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => { + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) + } } } @@ -3002,7 +3358,7 @@ fn __golem_tool_def_CanonicalBigBound() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalBigBound( +async fn __golem_tool_invoke_CanonicalBigBound( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -3013,7 +3369,9 @@ fn __golem_tool_invoke_CanonicalBigBound( match __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => { - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } @@ -3026,10 +3384,21 @@ fn __golem_tool_invoke_CanonicalBigBound( "tool canonical-big-bound invocation", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) + } } match __golem_index { 0 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let count :UInt64? = try { @tool.decode_canonical_field( __golem_decoded, @@ -3037,7 +3406,13 @@ fn __golem_tool_invoke_CanonicalBigBound( "tool canonical-big-bound command canonical-big-bound", ) } catch{ - __golem_error => return Err(__golem_error) + __golem_error => { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + __golem_error, + ) + } } match CanonicalBigBound::canonical_big_bound(count) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -3053,23 +3428,21 @@ fn __golem_tool_invoke_CanonicalBigBound( } } let payload = try { - @model.typed_schema_value_to_wit(payload) + @tool.encode_error_payload(payload) } catch{ - encode_error => { - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + encode_error.to_string( - - ), - ), - ) - } + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => { + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) + } } } diff --git a/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/pkg.generated.mbti b/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/pkg.generated.mbti index 5cce2b7267..7b54461630 100644 --- a/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/pkg.generated.mbti @@ -2,6 +2,7 @@ package "golemcloud/golem_sdk_example1/golem_moonbit_examples" import { + "golemcloud/golem_sdk/async-core", "golemcloud/golem_sdk/config", "golemcloud/golem_sdk/interface/golem/agent/common", "golemcloud/golem_sdk/interface/golem/agent/host", @@ -11,6 +12,7 @@ import { "golemcloud/golem_sdk/rpc", "golemcloud/golem_sdk/schema", "golemcloud/golem_sdk/schema_model", + "golemcloud/golem_sdk/tool", "moonbitlang/core/json", } @@ -23,7 +25,9 @@ pub fn collect_database_config_overrides(DatabaseConfigOverride, Array[String]) pub fn wasmExportAsyncInitialize(Int, Int, Int) -> Int -pub fn wasmExportAsyncInvoke(Int, Int, Int) -> Int +pub fn wasmExportAsyncInvokeGolemAgentGuest(Int, Int, Int) -> Int + +pub fn wasmExportAsyncInvokeGolemToolGuest(Int, Int, Int) -> Int pub fn wasmExportAsyncLoad(Int, Int, Int) -> Int @@ -33,13 +37,23 @@ pub fn wasmExportDiscoverAgentTypes() -> Int pub fn wasmExportDiscoverAgentTypesPostReturn(Int) -> Unit +pub fn wasmExportDiscoverTools() -> Int + +pub fn wasmExportDiscoverToolsPostReturn(Int) -> Unit + pub fn wasmExportGetDefinition() -> Int pub fn wasmExportGetDefinitionPostReturn(Int) -> Unit +pub fn wasmExportGetTool(Int, Int) -> Int + +pub fn wasmExportGetToolPostReturn(Int) -> Unit + pub fn wasmExportInitialize(Int) -> Int -pub fn wasmExportInvoke(Int) -> Int +pub fn wasmExportInvokeGolemAgentGuest(Int) -> Int + +pub fn wasmExportInvokeGolemToolGuest(Int) -> Int pub fn wasmExportLoad(Int, Int, Int, Int) -> Int @@ -92,6 +106,132 @@ pub fn AuditLogClient::trigger_add_entry(Self, String) -> Unit raise @common.Age pub fn AuditLogClient::trigger_get_creator(Self) -> Unit raise @common.AgentError pub fn AuditLogClient::trigger_get_entries(Self) -> Unit raise @common.AgentError +type CanonicalBigBound +pub fn CanonicalBigBound::canonical_big_bound(UInt64?) -> Result[Unit, CanonicalGrepError] + +pub(all) struct CanonicalBigBoundClient { + client : @tool.ToolClient +} +pub async fn CanonicalBigBoundClient::canonical_big_bound(Self, UInt64?) -> Result[Unit, @tool.ToolError[CanonicalGrepError]] +pub fn CanonicalBigBoundClient::drop(Self) -> Unit +pub fn CanonicalBigBoundClient::new() -> Self + +type CanonicalCommitError +pub impl @tool.ToolErrorSchema for CanonicalCommitError + +pub(all) struct CanonicalCommitResult { + hash : String + files_changed : UInt + insertions : UInt + deletions : UInt +} +pub impl @schema.FromSchema for CanonicalCommitResult +pub impl @schema.IntoSchema for CanonicalCommitResult + +type CanonicalGit +pub fn CanonicalGit::commit(UInt, @schema.Path, Bool, Map[String, String], String, String?, Bool, Bool, Bool, CanonicalGitOutputMode) -> Result[CanonicalCommitResult, CanonicalCommitError] +pub fn CanonicalGit::log(Int64?, @types.Datetime?, @types.Datetime?, Array[String], Array[String], Bool, Bool, Bool, Bool, Array[@schema.Path]) -> Result[Array[CanonicalLogEntry], CanonicalLogError] +pub fn CanonicalGit::remote(UInt, @schema.Path, Bool, Map[String, String]) -> Unit +pub fn CanonicalGit::stash(UInt, @schema.Path) -> Unit + +pub(all) struct CanonicalGitClient { + client : @tool.ToolClient +} +pub async fn CanonicalGitClient::commit(Self, UInt, @schema.Path, Bool, Map[String, String], String, String?, Bool, Bool, Bool, CanonicalGitOutputMode) -> Result[CanonicalCommitResult, @tool.ToolError[CanonicalCommitError]] +pub fn CanonicalGitClient::drop(Self) -> Unit +pub async fn CanonicalGitClient::log(Self, Int64?, @types.Datetime?, @types.Datetime?, Array[String], Array[String], Bool, Bool, Bool, Bool, Array[@schema.Path]) -> Result[Array[CanonicalLogEntry], @tool.ToolError[CanonicalLogError]] +pub fn CanonicalGitClient::new() -> Self +pub fn CanonicalGitClient::remote(Self, UInt, @schema.Path, Bool, Map[String, String]) -> CanonicalGitRemoteClient +pub fn CanonicalGitClient::stash(Self, UInt, @schema.Path) -> CanonicalGitStashClient + +pub(all) enum CanonicalGitOutputMode { + Human + Porcelain + Json +} derive(Eq) +pub impl @schema.FromSchema for CanonicalGitOutputMode +pub impl @schema.IntoSchema for CanonicalGitOutputMode + +pub(all) struct CanonicalGitRemoteClient { + client : @tool.ToolClient + prefix : Array[(String, @schema_model.SchemaValue)] +} +pub async fn CanonicalGitRemoteClient::add(Self, String, @schema.Url, Array[String], String?, Bool, Bool) -> Result[Unit, @tool.ToolError[CanonicalRemoteError]] +pub fn CanonicalGitRemoteClient::drop(Self) -> Unit +pub async fn CanonicalGitRemoteClient::remove(Self, String) -> Result[Unit, @tool.ToolError[CanonicalRemoteError]] +pub async fn CanonicalGitRemoteClient::set_url(Self, String, @schema.Url, @schema.Url?, Bool, Bool, Bool) -> Result[Unit, @tool.ToolError[CanonicalSetUrlError]] + +pub(all) struct CanonicalGitStashClient { + client : @tool.ToolClient + prefix : Array[(String, @schema_model.SchemaValue)] +} +pub async fn CanonicalGitStashClient::apply(Self, String?, UInt?) -> Result[Unit, @tool.ToolError[CanonicalStashError]] +pub fn CanonicalGitStashClient::drop(Self) -> Unit +pub async fn CanonicalGitStashClient::pop(Self, String?, UInt?) -> Result[Unit, @tool.ToolError[CanonicalStashError]] +pub async fn CanonicalGitStashClient::stash(Self, String, Bool) -> Result[Unit, @tool.ToolError[CanonicalStashError]] + +type CanonicalGrep +pub fn CanonicalGrep::canonical_grep(Bool, CanonicalGrepColorMode, String, Array[String], UInt?, Array[@schema.Path], @async-core.Stream[Byte], @async-core.Sink[Byte]) -> Result[Array[CanonicalGrepHit], CanonicalGrepError] +pub fn CanonicalGrep::replace(Bool, CanonicalGrepColorMode, String, String, Array[@schema.Path]) -> Result[UInt64, CanonicalGrepError] + +pub(all) struct CanonicalGrepClient { + client : @tool.ToolClient +} +pub async fn CanonicalGrepClient::canonical_grep(Self, Bool, CanonicalGrepColorMode, String, Array[String], UInt?, Array[@schema.Path], @async-core.Stream[Byte]) -> Result[(Array[CanonicalGrepHit], @async-core.Stream[Byte]), @tool.ToolError[CanonicalGrepError]] +pub fn CanonicalGrepClient::drop(Self) -> Unit +pub fn CanonicalGrepClient::new() -> Self +pub async fn CanonicalGrepClient::replace(Self, Bool, CanonicalGrepColorMode, String, String, Array[@schema.Path]) -> Result[UInt64, @tool.ToolError[CanonicalGrepError]] + +pub(all) enum CanonicalGrepColorMode { + Always + Never + Auto +} derive(Eq) +pub impl @schema.FromSchema for CanonicalGrepColorMode +pub impl @schema.IntoSchema for CanonicalGrepColorMode + +type CanonicalGrepError +pub impl @tool.ToolErrorSchema for CanonicalGrepError + +pub(all) struct CanonicalGrepHit { + file : @schema.Path + line : UInt + text : String +} +pub impl @schema.FromSchema for CanonicalGrepHit +pub impl @schema.IntoSchema for CanonicalGrepHit + +pub(all) struct CanonicalLogEntry { + hash : String + author : String + date : @types.Datetime + message : String +} +pub impl @schema.FromSchema for CanonicalLogEntry +pub impl @schema.IntoSchema for CanonicalLogEntry + +type CanonicalLogError +pub impl @tool.ToolErrorSchema for CanonicalLogError + +type CanonicalRemote +pub fn CanonicalRemote::add(UInt, String, @schema.Url, Array[String], String?, Bool, Bool) -> Result[Unit, CanonicalRemoteError] +pub fn CanonicalRemote::remove(String) -> Result[Unit, CanonicalRemoteError] +pub fn CanonicalRemote::set_url(String, @schema.Url, @schema.Url?, Bool, Bool, Bool) -> Result[Unit, CanonicalSetUrlError] + +type CanonicalRemoteError +pub impl @tool.ToolErrorSchema for CanonicalRemoteError + +type CanonicalSetUrlError +pub impl @tool.ToolErrorSchema for CanonicalSetUrlError + +type CanonicalStash +pub fn CanonicalStash::apply(String?, UInt?) -> Result[Unit, CanonicalStashError] +pub fn CanonicalStash::pop(String?, UInt?) -> Result[Unit, CanonicalStashError] +pub fn CanonicalStash::stash(UInt, String, Bool) -> Result[Unit, CanonicalStashError] + +type CanonicalStashError +pub impl @tool.ToolErrorSchema for CanonicalStashError + type ConfiguredAgent pub fn ConfiguredAgent::get_request_count(Self) -> UInt64 pub fn ConfiguredAgent::handle_request(Self) -> Unit diff --git a/sdks/moonbit/golem_sdk_example1/moon.mod b/sdks/moonbit/golem_sdk_example1/moon.mod new file mode 100644 index 0000000000..b5b2ad6001 --- /dev/null +++ b/sdks/moonbit/golem_sdk_example1/moon.mod @@ -0,0 +1,19 @@ +name = "golemcloud/golem_sdk_example1" + +version = "0.4.0" + +readme = "README.mbt.md" + +repository = "" + +license = "Apache-2.0" + +keywords = [ ] + +description = "" + +preferred_target = "wasm" + +import { + "golemcloud/golem_sdk@0.5.1", +} diff --git a/sdks/moonbit/golem_sdk_example1/moon.mod.json b/sdks/moonbit/golem_sdk_example1/moon.mod.json deleted file mode 100644 index b872f1c53c..0000000000 --- a/sdks/moonbit/golem_sdk_example1/moon.mod.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "golemcloud/golem_sdk_example1", - "version": "0.4.0", - "readme": "README.mbt.md", - "repository": "", - "license": "Apache-2.0", - "keywords": [], - "description": "", - "preferred-target": "wasm", - "deps": { - "golemcloud/golem_sdk": "0.5.1" - } -} diff --git a/sdks/moonbit/golem_sdk_tools/lib/agents_emit.mbt b/sdks/moonbit/golem_sdk_tools/lib/agents_emit.mbt index d11b364213..d9793cfc2f 100644 --- a/sdks/moonbit/golem_sdk_tools/lib/agents_emit.mbt +++ b/sdks/moonbit/golem_sdk_tools/lib/agents_emit.mbt @@ -219,7 +219,7 @@ fn emit_construct(buf : StringBuilder, agent : AgentInfo) -> Unit { let user_params = visible_params(agent.constructor_params) let arity = user_params.length() let ctx = escape_string_lit("\{agent.name}::new") - buf.write_string(" construct: fn(input, principal) {\n") + buf.write_string(" construct: async fn(input, principal) {\n") buf.write_string(" let _ = principal\n") buf.write_string(" try {\n") if arity > 0 { @@ -358,7 +358,7 @@ fn emit_raw_agent(buf : StringBuilder, agent : AgentInfo) -> Unit { emit_method_arm(buf, agent, m) } buf.write_string( - " other => Err(@common.AgentError::InvalidMethod(other))\n", + " other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n", ) buf.write_string(" }\n") buf.write_string(" } catch {\n") diff --git a/sdks/moonbit/golem_sdk_tools/lib/agents_test.mbt b/sdks/moonbit/golem_sdk_tools/lib/agents_test.mbt index c7b07b4806..80fa08d690 100644 --- a/sdks/moonbit/golem_sdk_tools/lib/agents_test.mbt +++ b/sdks/moonbit/golem_sdk_tools/lib/agents_test.mbt @@ -238,7 +238,8 @@ test "generate_agent_registration for simple agent" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -287,7 +288,8 @@ test "generate_agent_registration with methods" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"increment\",\n description: \"Increments the counter\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: None,\n read_only: None,\n },\n {\n name: \"add\",\n description: \"Adds a value\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"value\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"increment\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.increment\")\n self.increment()\n Ok(None)\n }\n \"add\" => {\n let params = @agents.decode_invocation_input(input, 1, \"Counter.add\")\n let value :UInt64 = @agents.decode_param(params, 0, \"Counter.add\")\n let result = self.add(value)\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"increment\",\n description: \"Increments the counter\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: None,\n read_only: None,\n },\n {\n name: \"add\",\n description: \"Adds a value\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"value\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"increment\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.increment\")\n self.increment()\n Ok(None)\n }\n \"add\" => {\n let params = @agents.decode_invocation_input(input, 1, \"Counter.add\")\n let value :UInt64 = @agents.decode_param(params, 0, \"Counter.add\")\n let result = self.add(value)\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -462,7 +464,8 @@ test "generate_agent_registration emits read_only with derived uses_principal" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A read-only agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new Counter\",\n prompt_hint: None,\n input: [],\n },\n methods: [\n {\n name: \"get_value\",\n description: \"Plain read-only without Principal\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: Some(\n (\n {\n cache_policy: @common.CachePolicy::Ttl(30000000000UL),\n uses_principal: false,\n }\n : @common.ReadOnlyConfig\n ),\n ),\n },\n {\n name: \"get_value_for\",\n description: \"Read-only with Principal parameter\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"caller\",\n source: @agents.InputParamSource::AutoInjected(\n @common.AutoInjectedKind::PRINCIPAL,\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: Some(\n (\n {\n cache_policy: @common.CachePolicy::UntilWrite,\n uses_principal: true,\n }\n : @common.ReadOnlyConfig\n ),\n ),\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter::new\")\n let agent = Counter::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"get_value\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.get_value\")\n let result = self.get_value()\n Ok(Some(@agents.encode_output(result)))\n }\n \"get_value_for\" => {\n let _ = \n @agents.decode_invocation_input(input, 0, \"Counter.get_value_for\")\n let result = self.get_value_for(principal)\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A read-only agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new Counter\",\n prompt_hint: None,\n input: [],\n },\n methods: [\n {\n name: \"get_value\",\n description: \"Plain read-only without Principal\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: Some(\n (\n {\n cache_policy: @common.CachePolicy::Ttl(30000000000UL),\n uses_principal: false,\n }\n : @common.ReadOnlyConfig\n ),\n ),\n },\n {\n name: \"get_value_for\",\n description: \"Read-only with Principal parameter\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"caller\",\n source: @agents.InputParamSource::AutoInjected(\n @common.AutoInjectedKind::PRINCIPAL,\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: Some(\n (\n {\n cache_policy: @common.CachePolicy::UntilWrite,\n uses_principal: true,\n }\n : @common.ReadOnlyConfig\n ),\n ),\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter::new\")\n let agent = Counter::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"get_value\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.get_value\")\n let result = self.get_value()\n Ok(Some(@agents.encode_output(result)))\n }\n \"get_value_for\" => {\n let _ = \n @agents.decode_invocation_input(input, 0, \"Counter.get_value_for\")\n let result = self.get_value_for(principal)\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -541,7 +544,8 @@ test "generate_agent_registration with prompt_hints" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: Some(\"Provide a unique name\"),\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"increment\",\n description: \"Increments the counter\",\n http_endpoint: [],\n prompt_hint: Some(\"Call to increase\"),\n input: [],\n output: None,\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"increment\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.increment\")\n self.increment()\n Ok(None)\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: Some(\"Provide a unique name\"),\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"increment\",\n description: \"Increments the counter\",\n http_endpoint: [],\n prompt_hint: Some(\"Call to increase\"),\n input: [],\n output: None,\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"increment\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.increment\")\n self.increment()\n Ok(None)\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -576,7 +580,8 @@ test "end-to-end: simple counter agent type" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -610,7 +615,8 @@ test "end-to-end: agent with methods" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"increment\",\n description: \"Increments the counter by one\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: None,\n read_only: None,\n },\n {\n name: \"add\",\n description: \"Adds a value to the counter\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"value\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"increment\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.increment\")\n self.increment()\n Ok(None)\n }\n \"add\" => {\n let params = @agents.decode_invocation_input(input, 1, \"Counter.add\")\n let value :UInt64 = @agents.decode_param(params, 0, \"Counter.add\")\n let result = self.add(value)\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"increment\",\n description: \"Increments the counter by one\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: None,\n read_only: None,\n },\n {\n name: \"add\",\n description: \"Adds a value to the counter\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"value\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"increment\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.increment\")\n self.increment()\n Ok(None)\n }\n \"add\" => {\n let params = @agents.decode_invocation_input(input, 1, \"Counter.add\")\n let value :UInt64 = @agents.decode_param(params, 0, \"Counter.add\")\n let result = self.add(value)\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -639,7 +645,8 @@ test "end-to-end: agent with prompt hints" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let smartAgent_type_def :@agents.AgentTypeDef = {\n type_name: \"SmartAgent\",\n description: \"A smart agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a smart agent\",\n prompt_hint: Some(\"Provide a JSON config string\"),\n input: [\n {\n name: \"config\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"process\",\n description: \"Processes input text\",\n http_endpoint: [],\n prompt_hint: Some(\"Pass natural language text\"),\n input: [\n {\n name: \"text\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"SmartAgent\",\n agent_type: smartAgent_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = \n @agents.decode_invocation_input(input, 1, \"SmartAgent::new\")\n let config :String = \n @agents.decode_param(params, 0, \"SmartAgent::new\")\n let agent = SmartAgent::new(config)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for SmartAgent with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"process\" => {\n let params = \n @agents.decode_invocation_input(input, 1, \"SmartAgent.process\")\n let text :String = @agents.decode_param(params, 0, \"SmartAgent.process\")\n let result = self.process(text)\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let smartAgent_type_def :@agents.AgentTypeDef = {\n type_name: \"SmartAgent\",\n description: \"A smart agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a smart agent\",\n prompt_hint: Some(\"Provide a JSON config string\"),\n input: [\n {\n name: \"config\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"process\",\n description: \"Processes input text\",\n http_endpoint: [],\n prompt_hint: Some(\"Pass natural language text\"),\n input: [\n {\n name: \"text\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"SmartAgent\",\n agent_type: smartAgent_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = \n @agents.decode_invocation_input(input, 1, \"SmartAgent::new\")\n let config :String = \n @agents.decode_param(params, 0, \"SmartAgent::new\")\n let agent = SmartAgent::new(config)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for SmartAgent with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"process\" => {\n let params = \n @agents.decode_invocation_input(input, 1, \"SmartAgent.process\")\n let text :String = @agents.decode_param(params, 0, \"SmartAgent.process\")\n let result = self.process(text)\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -665,7 +672,8 @@ test "end-to-end: agent with complex param types" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let processor_type_def :@agents.AgentTypeDef = {\n type_name: \"Processor\",\n description: \"A data processor\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new Processor\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"batch\",\n description: \"Processes a batch of items\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"items\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[Array[String]]),\n ),\n ),\n },\n {\n name: \"count\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64?]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[Array[String]]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Processor\",\n agent_type: processor_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = \n @agents.decode_invocation_input(input, 1, \"Processor::new\")\n let name :String = @agents.decode_param(params, 0, \"Processor::new\")\n let agent = Processor::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Processor with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"batch\" => {\n let params = \n @agents.decode_invocation_input(input, 2, \"Processor.batch\")\n let items :Array[String] = \n @agents.decode_param(params, 0, \"Processor.batch\")\n let count :UInt64? = @agents.decode_param(params, 1, \"Processor.batch\")\n let result = self.batch(items, count)\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let processor_type_def :@agents.AgentTypeDef = {\n type_name: \"Processor\",\n description: \"A data processor\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new Processor\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"batch\",\n description: \"Processes a batch of items\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"items\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[Array[String]]),\n ),\n ),\n },\n {\n name: \"count\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64?]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[Array[String]]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Processor\",\n agent_type: processor_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = \n @agents.decode_invocation_input(input, 1, \"Processor::new\")\n let name :String = @agents.decode_param(params, 0, \"Processor::new\")\n let agent = Processor::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Processor with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"batch\" => {\n let params = \n @agents.decode_invocation_input(input, 2, \"Processor.batch\")\n let items :Array[String] = \n @agents.decode_param(params, 0, \"Processor.batch\")\n let count :UInt64? = @agents.decode_param(params, 1, \"Processor.batch\")\n let result = self.batch(items, count)\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -693,7 +701,8 @@ test "end-to-end: agent with no constructor params" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"A simple worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a default worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [\n {\n name: \"run\",\n description: \"Does work\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[Int]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"run\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker.run\")\n let result = self.run()\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"A simple worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a default worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [\n {\n name: \"run\",\n description: \"Does work\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[Int]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"run\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker.run\")\n let result = self.run()\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -722,7 +731,8 @@ test "end-to-end: agent split across multiple files" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let multiAgent_type_def :@agents.AgentTypeDef = {\n type_name: \"MultiAgent\",\n description: \"A multi-file agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new MultiAgent\",\n prompt_hint: None,\n input: [\n {\n name: \"id\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"get_id\",\n description: \"Gets the ID\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"MultiAgent\",\n agent_type: multiAgent_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = \n @agents.decode_invocation_input(input, 1, \"MultiAgent::new\")\n let id :UInt64 = @agents.decode_param(params, 0, \"MultiAgent::new\")\n let agent = MultiAgent::new(id)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for MultiAgent with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"get_id\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"MultiAgent.get_id\")\n let result = self.get_id()\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let multiAgent_type_def :@agents.AgentTypeDef = {\n type_name: \"MultiAgent\",\n description: \"A multi-file agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new MultiAgent\",\n prompt_hint: None,\n input: [\n {\n name: \"id\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"get_id\",\n description: \"Gets the ID\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"MultiAgent\",\n agent_type: multiAgent_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = \n @agents.decode_invocation_input(input, 1, \"MultiAgent::new\")\n let id :UInt64 = @agents.decode_param(params, 0, \"MultiAgent::new\")\n let agent = MultiAgent::new(id)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for MultiAgent with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"get_id\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"MultiAgent.get_id\")\n let result = self.get_id()\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -777,7 +787,8 @@ test "build_raw_agent_impl for counter-like agent" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"increment\",\n description: \"Increments the counter\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: None,\n read_only: None,\n },\n {\n name: \"get_value\",\n description: \"Gets the current value\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n {\n name: \"add\",\n description: \"Adds a value\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"value\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"increment\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.increment\")\n self.increment()\n Ok(None)\n }\n \"get_value\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.get_value\")\n let result = self.get_value()\n Ok(Some(@agents.encode_output(result)))\n }\n \"add\" => {\n let params = @agents.decode_invocation_input(input, 1, \"Counter.add\")\n let value :UInt64 = @agents.decode_param(params, 0, \"Counter.add\")\n let result = self.add(value)\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let counter_type_def :@agents.AgentTypeDef = {\n type_name: \"Counter\",\n description: \"A counter agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a new counter\",\n prompt_hint: None,\n input: [\n {\n name: \"name\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[String]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"increment\",\n description: \"Increments the counter\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: None,\n read_only: None,\n },\n {\n name: \"get_value\",\n description: \"Gets the current value\",\n http_endpoint: [],\n prompt_hint: None,\n input: [],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n {\n name: \"add\",\n description: \"Adds a value\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"value\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[UInt64]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Counter\",\n agent_type: counter_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = @agents.decode_invocation_input(input, 1, \"Counter::new\")\n let name :String = @agents.decode_param(params, 0, \"Counter::new\")\n let agent = Counter::new(name)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Counter with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"increment\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.increment\")\n self.increment()\n Ok(None)\n }\n \"get_value\" => {\n let _ = @agents.decode_invocation_input(input, 0, \"Counter.get_value\")\n let result = self.get_value()\n Ok(Some(@agents.encode_output(result)))\n }\n \"add\" => {\n let params = @agents.decode_invocation_input(input, 1, \"Counter.add\")\n let value :UInt64 = @agents.decode_param(params, 0, \"Counter.add\")\n let result = self.add(value)\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -1003,7 +1014,8 @@ test "generate_agent_registration with cross-package types" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let orderAgent_type_def :@agents.AgentTypeDef = {\n type_name: \"OrderAgent\",\n description: \"An order agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates an order agent\",\n prompt_hint: None,\n input: [\n {\n name: \"config\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[@types.Config]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"process\",\n description: \"Processes an order\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"order\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[@types.Order]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[@types.Result]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"OrderAgent\",\n agent_type: orderAgent_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let params = \n @agents.decode_invocation_input(input, 1, \"OrderAgent::new\")\n let config :@types.Config = \n @agents.decode_param(params, 0, \"OrderAgent::new\")\n let agent = OrderAgent::new(config)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for OrderAgent with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"process\" => {\n let params = \n @agents.decode_invocation_input(input, 1, \"OrderAgent.process\")\n let order :@types.Order = \n @agents.decode_param(params, 0, \"OrderAgent.process\")\n let result = self.process(order)\n Ok(Some(@agents.encode_output(result)))\n }\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let orderAgent_type_def :@agents.AgentTypeDef = {\n type_name: \"OrderAgent\",\n description: \"An order agent\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates an order agent\",\n prompt_hint: None,\n input: [\n {\n name: \"config\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[@types.Config]),\n ),\n ),\n },\n ],\n },\n methods: [\n {\n name: \"process\",\n description: \"Processes an order\",\n http_endpoint: [],\n prompt_hint: None,\n input: [\n {\n name: \"order\",\n source: @agents.InputParamSource::UserSupplied(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[@types.Order]),\n ),\n ),\n },\n ],\n output: Some(\n @schema.into_schema_graph(\n (@schema.TypeTag::{ } : @schema.TypeTag[@types.Result]),\n ),\n ),\n read_only: None,\n },\n ],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"OrderAgent\",\n agent_type: orderAgent_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let params = \n @agents.decode_invocation_input(input, 1, \"OrderAgent::new\")\n let config :@types.Config = \n @agents.decode_param(params, 0, \"OrderAgent::new\")\n let agent = OrderAgent::new(config)\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for OrderAgent with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n \"process\" => {\n let params = \n @agents.decode_invocation_input(input, 1, \"OrderAgent.process\")\n let order :@types.Order = \n @agents.decode_param(params, 0, \"OrderAgent.process\")\n let result = self.process(order)\n Ok(Some(@agents.encode_output(result)))\n }\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -1162,7 +1174,8 @@ test "generate_agent_registration with ephemeral mode" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"An ephemeral worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::EPHEMERAL,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"An ephemeral worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::EPHEMERAL,\n http_mount: None,\n snapshotting: @common.Snapshotting::Disabled,\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -1485,7 +1498,8 @@ test "generate_agent_registration with snapshotting periodic" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"A worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Enabled(\n @common.SnapshottingConfig::Periodic(100UL),\n ),\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"A worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Enabled(\n @common.SnapshottingConfig::Periodic(100UL),\n ),\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -1515,7 +1529,8 @@ test "generate_agent_registration with snapshotting default" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"A worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Enabled(\n @common.SnapshottingConfig::Default,\n ),\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"A worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Enabled(\n @common.SnapshottingConfig::Default,\n ),\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } @@ -1545,7 +1560,8 @@ test "generate_agent_registration with snapshotting every_n" { debug_inspect( output, content=( - #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"A worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Enabled(\n @common.SnapshottingConfig::EveryNInvocation(5U),\n ),\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => Err(@common.AgentError::InvalidMethod(other))\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + #|"///|\nfn init {\n try {\n let worker_type_def :@agents.AgentTypeDef = {\n type_name: \"Worker\",\n description: \"A worker\",\n source_language: \"moonbit\",\n constructor_: {\n name: Some(\"new\"),\n description: \"Creates a worker\",\n prompt_hint: None,\n input: [],\n },\n methods: [],\n dependencies: [],\n mode: @common.AgentMode::DURABLE,\n http_mount: None,\n snapshotting: @common.Snapshotting::Enabled(\n @common.SnapshottingConfig::EveryNInvocation(5U),\n ),\n config: [],\n }\n @agents.register_agent({\n name: \"Worker\",\n agent_type: worker_type_def.to_agent_type(),\n construct: async fn(input, principal) {\n let _ = principal\n try {\n let _ = @agents.decode_invocation_input(input, 0, \"Worker::new\")\n let agent = Worker::new()\n let constructed = @agents.ConstructedAgent::{\n raw: agent,\n snapshottable: None,\n snapshot_format: None,\n }\n Ok(constructed)\n } catch{\n e => Err(e)\n }\n },\n })\n } catch{\n e => {\n @agents.panic_with_message(\n \"init\",\n \"Failed to register agents: \" + e.to_string(),\n )\n }\n }\n}\n\n///|\nimpl @agents.RawAgent for Worker with invoke(\n self,\n method_name,\n input,\n principal,\n) {\n let _ = principal\n try {\n match method_name {\n other => {\n @agents.discard_wire_value(input)\n Err(@common.AgentError::InvalidMethod(other))\n }\n }\n } catch{\n @common.AgentError::InvalidInput(message) => \n Err(@common.AgentError::InvalidInput(message))\n @common.AgentError::InvalidMethod(method_name) => \n Err(@common.AgentError::InvalidMethod(method_name))\n @common.AgentError::InvalidType(message) => \n Err(@common.AgentError::InvalidType(message))\n @common.AgentError::InvalidAgentId(message) => \n Err(@common.AgentError::InvalidAgentId(message))\n @common.AgentError::CustomError(value) => \n Err(@common.AgentError::CustomError(value))\n e => raise e\n }\n}\n\n" + ), ) } diff --git a/sdks/moonbit/golem_sdk_tools/lib/clients_emit.mbt b/sdks/moonbit/golem_sdk_tools/lib/clients_emit.mbt index 038d71b0a9..03d2b09ae8 100644 --- a/sdks/moonbit/golem_sdk_tools/lib/clients_emit.mbt +++ b/sdks/moonbit/golem_sdk_tools/lib/clients_emit.mbt @@ -2,11 +2,12 @@ // schema model (`golem:core/types@2.0.0`). // // Each agent gets a `Client` wrapping `@rpc.AgentClient`. Constructor and -// method arguments are encoded into a `@types.SchemaValueTree` input record via -// `@agents.encode_invocation_input`, and awaited results decoded via -// `@agents.decode_output`. Awaited methods are async so they can suspend on the -// P3 RPC result future; synchronous setup, trigger, and scheduling methods keep -// the SDK's `@common.AgentError` contract. +// method arguments are encoded into a `@types.SchemaValueTree` input record. +// Awaited methods use `@agents.encode_invocation_input_async` and decode results +// via `@agents.decode_output`, allowing native streams at any nesting depth. +// Synchronous setup, trigger, and scheduling methods use +// `@agents.encode_invocation_input` and keep the SDK's `@common.AgentError` +// contract. // // Built as a MoonBit-source string and parsed back via `parse_generated_impls` // (see `value_types_emit.mbt` / `agents_emit.mbt`). @@ -49,6 +50,13 @@ fn encode_input_expr(params : Array[(String, ParamType)]) -> String { "@agents.encode_invocation_input([\{parts}])" } +///| +/// Renders the async input encoder used only by awaited RPC methods. +fn encode_input_async_expr(params : Array[(String, ParamType)]) -> String { + let parts = params.map(fn(p) { "@schema.to_value_as(\{p.0})" }).join(", ") + "@agents.encode_invocation_input_async([\{parts}])" +} + ///| /// Generates typed RPC client stubs for all agents. pub fn generate_client_code( @@ -234,6 +242,7 @@ fn emit_client_method( let vis = visible_params(meth.params) let ctx = escape_string_lit("\{agent.name}.\{meth.name}") let input_expr = encode_input_expr(vis) + let awaited_input_expr = encode_input_async_expr(vis) let arg_sig = params_sig(vis) let self_args = if arg_sig.is_empty() { "self : \{client}" @@ -254,7 +263,7 @@ fn emit_client_method( buf.write_string( "pub async fn \{client}::\{meth.name}(\n \{self_args},\n) -> \{ret} {\n", ) - buf.write_string(" let input = \{input_expr}\n") + buf.write_string(" let input = \{awaited_input_expr}\n") buf.write_string( " let response = self.client.invoke_and_await(\"\{escape_string_lit(meth.name)}\", input)\n", ) @@ -262,9 +271,9 @@ fn emit_client_method( None => buf.write_string( if durable { - " let _ = response.value\n" + " @agents.discard_optional_wire_value(response.value)\n" } else { - " { metadata: response.metadata, value: () }\n" + " @agents.discard_optional_wire_value(response.value)\n { metadata: response.metadata, value: () }\n" }, ) Some(_) => { diff --git a/sdks/moonbit/golem_sdk_tools/lib/clients_emit_test.mbt b/sdks/moonbit/golem_sdk_tools/lib/clients_emit_test.mbt index dc708ffdf9..4e44a4d70b 100644 --- a/sdks/moonbit/golem_sdk_tools/lib/clients_emit_test.mbt +++ b/sdks/moonbit/golem_sdk_tools/lib/clients_emit_test.mbt @@ -40,7 +40,8 @@ test "generate_client_code - counter agent with no-arg methods" { debug_inspect( output, content=( - #|"///|\npub(all) struct CounterClient {\n client : @rpc.AgentClient\n}\n\n///|\npub fn CounterClient::get(name : String) -> CounterClient raise @common.AgentError {\n let constructor_input = \n @agents.encode_invocation_input([@schema.to_value_as(name)])\n let client = @rpc.AgentClient::get(\"Counter\", constructor_input)\n { client, }\n}\n\n///|\npub fn CounterClient::new_phantom(name : String) -> CounterClient raise @common.AgentError {\n let constructor_input = \n @agents.encode_invocation_input([@schema.to_value_as(name)])\n let client = @rpc.AgentClient::new_phantom(\"Counter\", constructor_input)\n { client, }\n}\n\n///|\npub fn CounterClient::get_phantom(name : String, phantom_id : @types.Uuid) -> CounterClient raise @common.AgentError {\n let constructor_input = \n @agents.encode_invocation_input([@schema.to_value_as(name)])\n let client = \n @rpc.AgentClient::get_phantom(\"Counter\", constructor_input, phantom_id)\n { client, }\n}\n\n///|\npub fn CounterClient::get_agent_id(self : CounterClient) -> String raise @common.AgentError {\n self.client.get_agent_id()\n}\n\n///|\npub fn CounterClient::phantom_id(self : CounterClient) -> @types.Uuid? {\n self.client.phantom_id()\n}\n\n///|\npub fn CounterClient::drop(self : CounterClient) -> Unit {\n self.client.drop()\n}\n\n///|\npub async fn[T] CounterClient::scoped(\n name : String,\n f : async (CounterClient) -> T,\n) -> T {\n let client = CounterClient::get(name)\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn[T] CounterClient::scoped_new_phantom(\n name : String,\n f : async (CounterClient) -> T,\n) -> T {\n let client = CounterClient::new_phantom(name)\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn[T] CounterClient::scoped_get_phantom(\n name : String,\n phantom_id : @types.Uuid,\n f : async (CounterClient) -> T,\n) -> T {\n let client = CounterClient::get_phantom(name, phantom_id)\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn CounterClient::increment(self : CounterClient) -> Unit {\n let input = @agents.encode_invocation_input([])\n let response = self.client.invoke_and_await(\"increment\", input)\n let _ = response.value\n \n}\n\n///|\npub fn CounterClient::trigger_increment(self : CounterClient) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n let _ = self.client.invoke(\"increment\", input)\n \n}\n\n///|\npub fn CounterClient::schedule_increment(\n self : CounterClient,\n scheduled_at : @systemClock.Instant,\n) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n let _ = self.client.schedule_invocation(scheduled_at, \"increment\", input)\n \n}\n\n///|\npub fn CounterClient::schedule_cancelable_increment(\n self : CounterClient,\n scheduled_at : @systemClock.Instant,\n) -> @agentHost.CancellationToken raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n self\n .client\n .schedule_cancelable_invocation(scheduled_at, \"increment\", input)\n .cancellation_token\n}\n\n///|\npub async fn CounterClient::get_value(self : CounterClient) -> UInt64 {\n let input = @agents.encode_invocation_input([])\n let response = self.client.invoke_and_await(\"get_value\", input)\n let result = response.value\n match result {\n Some(tree) => @agents.decode_output(tree, \"Counter.get_value\")\n None => {\n raise @common.AgentError::InvalidType(\n \"Counter.get_value: expected a return value, got none\",\n )\n }\n }\n}\n\n///|\npub fn CounterClient::trigger_get_value(self : CounterClient) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n let _ = self.client.invoke(\"get_value\", input)\n \n}\n\n///|\npub fn CounterClient::schedule_get_value(\n self : CounterClient,\n scheduled_at : @systemClock.Instant,\n) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n let _ = self.client.schedule_invocation(scheduled_at, \"get_value\", input)\n \n}\n\n///|\npub fn CounterClient::schedule_cancelable_get_value(\n self : CounterClient,\n scheduled_at : @systemClock.Instant,\n) -> @agentHost.CancellationToken raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n self\n .client\n .schedule_cancelable_invocation(scheduled_at, \"get_value\", input)\n .cancellation_token\n}\n\n" + #|"///|\npub(all) struct CounterClient {\n client : @rpc.AgentClient\n}\n\n///|\npub fn CounterClient::get(name : String) -> CounterClient raise @common.AgentError {\n let constructor_input = \n @agents.encode_invocation_input([@schema.to_value_as(name)])\n let client = @rpc.AgentClient::get(\"Counter\", constructor_input)\n { client, }\n}\n\n///|\npub fn CounterClient::new_phantom(name : String) -> CounterClient raise @common.AgentError {\n let constructor_input = \n @agents.encode_invocation_input([@schema.to_value_as(name)])\n let client = @rpc.AgentClient::new_phantom(\"Counter\", constructor_input)\n { client, }\n}\n\n///|\npub fn CounterClient::get_phantom(name : String, phantom_id : @types.Uuid) -> CounterClient raise @common.AgentError {\n let constructor_input = \n @agents.encode_invocation_input([@schema.to_value_as(name)])\n let client = \n @rpc.AgentClient::get_phantom(\"Counter\", constructor_input, phantom_id)\n { client, }\n}\n\n///|\npub fn CounterClient::get_agent_id(self : CounterClient) -> String raise @common.AgentError {\n self.client.get_agent_id()\n}\n\n///|\npub fn CounterClient::phantom_id(self : CounterClient) -> @types.Uuid? {\n self.client.phantom_id()\n}\n\n///|\npub fn CounterClient::drop(self : CounterClient) -> Unit {\n self.client.drop()\n}\n\n///|\npub async fn[T] CounterClient::scoped(\n name : String,\n f : async (CounterClient) -> T,\n) -> T {\n let client = CounterClient::get(name)\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn[T] CounterClient::scoped_new_phantom(\n name : String,\n f : async (CounterClient) -> T,\n) -> T {\n let client = CounterClient::new_phantom(name)\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn[T] CounterClient::scoped_get_phantom(\n name : String,\n phantom_id : @types.Uuid,\n f : async (CounterClient) -> T,\n) -> T {\n let client = CounterClient::get_phantom(name, phantom_id)\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn CounterClient::increment(self : CounterClient) -> Unit {\n let input = @agents.encode_invocation_input_async([])\n let response = self.client.invoke_and_await(\"increment\", input)\n @agents.discard_optional_wire_value(response.value)\n}\n\n///|\npub fn CounterClient::trigger_increment(self : CounterClient) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n let _ = self.client.invoke(\"increment\", input)\n \n}\n\n///|\npub fn CounterClient::schedule_increment(\n self : CounterClient,\n scheduled_at : @systemClock.Instant,\n) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n let _ = self.client.schedule_invocation(scheduled_at, \"increment\", input)\n \n}\n\n///|\npub fn CounterClient::schedule_cancelable_increment(\n self : CounterClient,\n scheduled_at : @systemClock.Instant,\n) -> @agentHost.CancellationToken raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n self\n .client\n .schedule_cancelable_invocation(scheduled_at, \"increment\", input)\n .cancellation_token\n}\n\n///|\npub async fn CounterClient::get_value(self : CounterClient) -> UInt64 {\n let input = @agents.encode_invocation_input_async([])\n let response = self.client.invoke_and_await(\"get_value\", input)\n let result = response.value\n match result {\n Some(tree) => @agents.decode_output(tree, \"Counter.get_value\")\n None => {\n raise @common.AgentError::InvalidType(\n \"Counter.get_value: expected a return value, got none\",\n )\n }\n }\n}\n\n///|\npub fn CounterClient::trigger_get_value(self : CounterClient) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n let _ = self.client.invoke(\"get_value\", input)\n \n}\n\n///|\npub fn CounterClient::schedule_get_value(\n self : CounterClient,\n scheduled_at : @systemClock.Instant,\n) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n let _ = self.client.schedule_invocation(scheduled_at, \"get_value\", input)\n \n}\n\n///|\npub fn CounterClient::schedule_cancelable_get_value(\n self : CounterClient,\n scheduled_at : @systemClock.Instant,\n) -> @agentHost.CancellationToken raise @common.AgentError {\n let input = @agents.encode_invocation_input([])\n self\n .client\n .schedule_cancelable_invocation(scheduled_at, \"get_value\", input)\n .cancellation_token\n}\n\n" + ), ) } @@ -80,7 +81,7 @@ test "generate_client_code - agent with params" { debug_inspect( output, content=( - #|"///|\npub(all) struct TaskManagerClient {\n client : @rpc.AgentClient\n}\n\n///|\npub fn TaskManagerClient::get() -> TaskManagerClient raise @common.AgentError {\n let constructor_input = @agents.encode_invocation_input([])\n let client = @rpc.AgentClient::get(\"TaskManager\", constructor_input)\n { client, }\n}\n\n///|\npub fn TaskManagerClient::new_phantom() -> TaskManagerClient raise @common.AgentError {\n let constructor_input = @agents.encode_invocation_input([])\n let client = @rpc.AgentClient::new_phantom(\"TaskManager\", constructor_input)\n { client, }\n}\n\n///|\npub fn TaskManagerClient::get_phantom(phantom_id : @types.Uuid) -> TaskManagerClient raise @common.AgentError {\n let constructor_input = @agents.encode_invocation_input([])\n let client = \n @rpc.AgentClient::get_phantom(\"TaskManager\", constructor_input, phantom_id)\n { client, }\n}\n\n///|\npub fn TaskManagerClient::get_agent_id(self : TaskManagerClient) -> String raise @common.AgentError {\n self.client.get_agent_id()\n}\n\n///|\npub fn TaskManagerClient::phantom_id(self : TaskManagerClient) -> @types.Uuid? {\n self.client.phantom_id()\n}\n\n///|\npub fn TaskManagerClient::drop(self : TaskManagerClient) -> Unit {\n self.client.drop()\n}\n\n///|\npub async fn[T] TaskManagerClient::scoped(f : async (TaskManagerClient) -> T) -> T {\n let client = TaskManagerClient::get()\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn[T] TaskManagerClient::scoped_new_phantom(\n f : async (TaskManagerClient) -> T,\n) -> T {\n let client = TaskManagerClient::new_phantom()\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn[T] TaskManagerClient::scoped_get_phantom(\n phantom_id : @types.Uuid,\n f : async (TaskManagerClient) -> T,\n) -> T {\n let client = TaskManagerClient::get_phantom(phantom_id)\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn TaskManagerClient::add_task(\n self : TaskManagerClient,\n task : TaskInfo,\n) -> UInt64 {\n let input = @agents.encode_invocation_input([@schema.to_value_as(task)])\n let response = self.client.invoke_and_await(\"add_task\", input)\n let result = response.value\n match result {\n Some(tree) => @agents.decode_output(tree, \"TaskManager.add_task\")\n None => {\n raise @common.AgentError::InvalidType(\n \"TaskManager.add_task: expected a return value, got none\",\n )\n }\n }\n}\n\n///|\npub fn TaskManagerClient::trigger_add_task(\n self : TaskManagerClient,\n task : TaskInfo,\n) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([@schema.to_value_as(task)])\n let _ = self.client.invoke(\"add_task\", input)\n \n}\n\n///|\npub fn TaskManagerClient::schedule_add_task(\n self : TaskManagerClient,\n scheduled_at : @systemClock.Instant,\n task : TaskInfo,\n) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([@schema.to_value_as(task)])\n let _ = self.client.schedule_invocation(scheduled_at, \"add_task\", input)\n \n}\n\n///|\npub fn TaskManagerClient::schedule_cancelable_add_task(\n self : TaskManagerClient,\n scheduled_at : @systemClock.Instant,\n task : TaskInfo,\n) -> @agentHost.CancellationToken raise @common.AgentError {\n let input = @agents.encode_invocation_input([@schema.to_value_as(task)])\n self\n .client\n .schedule_cancelable_invocation(scheduled_at, \"add_task\", input)\n .cancellation_token\n}\n\n" + #|"///|\npub(all) struct TaskManagerClient {\n client : @rpc.AgentClient\n}\n\n///|\npub fn TaskManagerClient::get() -> TaskManagerClient raise @common.AgentError {\n let constructor_input = @agents.encode_invocation_input([])\n let client = @rpc.AgentClient::get(\"TaskManager\", constructor_input)\n { client, }\n}\n\n///|\npub fn TaskManagerClient::new_phantom() -> TaskManagerClient raise @common.AgentError {\n let constructor_input = @agents.encode_invocation_input([])\n let client = @rpc.AgentClient::new_phantom(\"TaskManager\", constructor_input)\n { client, }\n}\n\n///|\npub fn TaskManagerClient::get_phantom(phantom_id : @types.Uuid) -> TaskManagerClient raise @common.AgentError {\n let constructor_input = @agents.encode_invocation_input([])\n let client = \n @rpc.AgentClient::get_phantom(\"TaskManager\", constructor_input, phantom_id)\n { client, }\n}\n\n///|\npub fn TaskManagerClient::get_agent_id(self : TaskManagerClient) -> String raise @common.AgentError {\n self.client.get_agent_id()\n}\n\n///|\npub fn TaskManagerClient::phantom_id(self : TaskManagerClient) -> @types.Uuid? {\n self.client.phantom_id()\n}\n\n///|\npub fn TaskManagerClient::drop(self : TaskManagerClient) -> Unit {\n self.client.drop()\n}\n\n///|\npub async fn[T] TaskManagerClient::scoped(f : async (TaskManagerClient) -> T) -> T {\n let client = TaskManagerClient::get()\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn[T] TaskManagerClient::scoped_new_phantom(\n f : async (TaskManagerClient) -> T,\n) -> T {\n let client = TaskManagerClient::new_phantom()\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn[T] TaskManagerClient::scoped_get_phantom(\n phantom_id : @types.Uuid,\n f : async (TaskManagerClient) -> T,\n) -> T {\n let client = TaskManagerClient::get_phantom(phantom_id)\n defer client.drop()\n f(client)\n}\n\n///|\npub async fn TaskManagerClient::add_task(\n self : TaskManagerClient,\n task : TaskInfo,\n) -> UInt64 {\n let input = @agents.encode_invocation_input_async([@schema.to_value_as(task)])\n let response = self.client.invoke_and_await(\"add_task\", input)\n let result = response.value\n match result {\n Some(tree) => @agents.decode_output(tree, \"TaskManager.add_task\")\n None => {\n raise @common.AgentError::InvalidType(\n \"TaskManager.add_task: expected a return value, got none\",\n )\n }\n }\n}\n\n///|\npub fn TaskManagerClient::trigger_add_task(\n self : TaskManagerClient,\n task : TaskInfo,\n) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([@schema.to_value_as(task)])\n let _ = self.client.invoke(\"add_task\", input)\n \n}\n\n///|\npub fn TaskManagerClient::schedule_add_task(\n self : TaskManagerClient,\n scheduled_at : @systemClock.Instant,\n task : TaskInfo,\n) -> Unit raise @common.AgentError {\n let input = @agents.encode_invocation_input([@schema.to_value_as(task)])\n let _ = self.client.schedule_invocation(scheduled_at, \"add_task\", input)\n \n}\n\n///|\npub fn TaskManagerClient::schedule_cancelable_add_task(\n self : TaskManagerClient,\n scheduled_at : @systemClock.Instant,\n task : TaskInfo,\n) -> @agentHost.CancellationToken raise @common.AgentError {\n let input = @agents.encode_invocation_input([@schema.to_value_as(task)])\n self\n .client\n .schedule_cancelable_invocation(scheduled_at, \"add_task\", input)\n .cancellation_token\n}\n\n" ), ) } diff --git a/sdks/moonbit/golem_sdk_tools/lib/tools.mbt b/sdks/moonbit/golem_sdk_tools/lib/tools.mbt index 08424838af..c716db74da 100644 --- a/sdks/moonbit/golem_sdk_tools/lib/tools.mbt +++ b/sdks/moonbit/golem_sdk_tools/lib/tools.mbt @@ -1079,13 +1079,6 @@ fn parse_command( .unwrap_or("") + "::" + decl.name.name - if decl.is_async is Some(_) { - tool_fail( - "Async tool command '" + - owner + - "' is unsupported: the MoonBit WIT export invoker is synchronous and no block_on is available", - ) - } let params : Array[(String, ToolParamType)] = [] for p in decl.decl_params.unwrap_or(@list.List::from_array([])) { match p { diff --git a/sdks/moonbit/golem_sdk_tools/lib/tools_emit.mbt b/sdks/moonbit/golem_sdk_tools/lib/tools_emit.mbt index 2b0587d636..6bf4dd3ffd 100644 --- a/sdks/moonbit/golem_sdk_tools/lib/tools_emit.mbt +++ b/sdks/moonbit/golem_sdk_tools/lib/tools_emit.mbt @@ -1686,6 +1686,16 @@ fn output_stream_source(command : ToolCommandInfo) -> String? { None } +///| +fn input_stream_source(command : ToolCommandInfo) -> String? { + for pair in command.params { + if pair.1 == Hidden(InputStream) || pair.1 == LabelledHidden(InputStream) { + return Some(pair.0) + } + } + None +} + ///| fn emit_invocation_value(command : ToolCommandInfo, value : String) -> String { match output_stream_source(command) { @@ -1712,11 +1722,17 @@ fn emit_empty_invocation(command : ToolCommandInfo) -> String { ///| fn emit_custom_error(command : ToolCommandInfo, error_value : String) -> String { let error_type = command.error_type.map(emit_type).unwrap() - "{\nlet payload = match " + + "{\n" + + (if output_stream_source(command) is Some(_) { + "__golem_stdout.drop_sync()\n" + } else { + "" + }) + + "let payload = match " + error_type + "::to_error_payload_value(" + error_value + - ") { Ok(payload) => payload\nErr(encode_error) => return Err(@toolCommon.ToolError::InvalidResult(\"failed serializing custom tool error: \" + encode_error)) }\nlet payload = @model.typed_schema_value_to_wit(payload) catch { encode_error => return Err(@toolCommon.ToolError::InvalidResult(\"failed serializing custom tool error: \" + encode_error.to_string())) }\nErr(@toolCommon.ToolError::CustomError(payload))\n}" + ") { Ok(payload) => payload\nErr(encode_error) => return Err(@toolCommon.ToolError::InvalidResult(\"failed serializing custom tool error: \" + encode_error)) }\nlet payload = @tool.encode_error_payload(payload) catch { encode_error => return Err(encode_error) }\nErr(@toolCommon.ToolError::CustomError(payload))\n}" } ///| @@ -1805,13 +1821,13 @@ fn emit_invoker( let name = "__golem_tool_invoke_" + tool.source_name let context = "tool " + tool.name + " invocation" buf.write_string( - "///|\nfn " + + "///|\nasync fn " + name + "(__golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, __golem_principal : @tool.Principal) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] {\n let __golem_def = " + descriptor_name(tool) + - "()\n let __golem_index = match __golem_def.command_index_by_path(__golem_command_path) {\n Some(__golem_index) => __golem_index\n None => return Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path))\n }\n let __golem_decoded = @tool.decode_canonical_input(__golem_def, __golem_index, __golem_input, \"" + + "()\n let __golem_index = match __golem_def.command_index_by_path(__golem_command_path) {\n Some(__golem_index) => __golem_index\n None => return @tool.reject_wire_invocation(__golem_input, __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path))\n }\n let __golem_decoded = @tool.decode_canonical_input(__golem_def, __golem_index, __golem_input, \"" + escape_string_lit(context) + - "\") catch { __golem_error => return Err(__golem_error) }\n", + "\") catch { __golem_error => return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) }\n", ) for command in tool.commands { if command.subtree is Some(target) { @@ -1851,6 +1867,11 @@ fn emit_invoker( } let command_context = "tool " + tool.name + " command " + command.name buf.write_string(" " + pair.0.to_string() + " => {\n") + if input_stream_source(command) is None { + buf.write_string( + " if __golem_stdin is Some(_) {\n return @tool.reject_decoded_invocation(__golem_decoded, __golem_stdin, @toolCommon.ToolError::InvalidInput(\"command does not accept a stdin stream\"))\n }\n", + ) + } let call_args : Array[String] = [] for arg in args { match arg.placement { @@ -1859,18 +1880,11 @@ fn emit_invoker( buf.write_string( " let " + arg.source + - " = match __golem_stdin {\n Some(__golem_stream) => __golem_stream\n None => return Err(@toolCommon.ToolError::InvalidInput(\"required stdin stream is missing\"))\n }\n", - ) - call_args.push(arg.source) - } - Hidden(OutputStream) => { - buf.write_string( - " let (__golem_stdout, " + - arg.source + - ") = @tool.new_stdout()\n", + " = match __golem_stdin {\n Some(__golem_stream) => __golem_stream\n None => return @tool.reject_decoded_invocation(__golem_decoded, __golem_stdin, @toolCommon.ToolError::InvalidInput(\"required stdin stream is missing\"))\n }\n", ) call_args.push(arg.source) } + Hidden(OutputStream) => call_args.push(arg.source) _ => { buf.write_string( " let " + @@ -1881,12 +1895,19 @@ fn emit_invoker( escape_string_lit(inherited_canonical_name(arg, inherited)) + "\", \"" + escape_string_lit(command_context) + - "\") catch { __golem_error => return Err(__golem_error) }\n", + "\") catch { __golem_error => return @tool.reject_decoded_invocation(__golem_decoded, __golem_stdin, __golem_error) }\n", ) call_args.push(arg.source) } } } + match output_stream_source(command) { + Some(source) => + buf.write_string( + " let (__golem_stdout, " + source + ") = @tool.new_stdout()\n", + ) + None => () + } let invocation = tool.source_name + "::" + command.source_name + @@ -1904,7 +1925,7 @@ fn emit_invoker( ) } buf.write_string( - " _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path))\n }\n}\n\n", + " _ => @tool.reject_decoded_invocation(__golem_decoded, __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path))\n }\n}\n\n", ) } diff --git a/sdks/moonbit/golem_sdk_tools/lib/tools_emit_test.mbt b/sdks/moonbit/golem_sdk_tools/lib/tools_emit_test.mbt index d88afccfe7..491a0b8249 100644 --- a/sdks/moonbit/golem_sdk_tools/lib/tools_emit_test.mbt +++ b/sdks/moonbit/golem_sdk_tools/lib/tools_emit_test.mbt @@ -175,6 +175,43 @@ test "tool generated internals use runtime facades instead of consumer aliases" assert_false(generated.contains("@stdout.get_stdout()")) } +///| +test "async tool commands use async ownership-aware invokers" { + let source = + #|#derive.tool + #|struct AsyncTool {} + #|pub async fn AsyncTool::run(value : String) -> String { value } + let generated = @formatter.impls_to_string( + @lib.generate_tool_registration(@lib.parse_tools([("async.mbt", source)])), + ) + assert_true(generated.contains("async fn __golem_tool_invoke_AsyncTool")) + assert_true(generated.contains("AsyncTool::run(value)")) + assert_true(generated.contains("@tool.reject_wire_invocation")) + assert_true(generated.contains("@tool.reject_undecoded_invocation")) + assert_true(generated.contains("@tool.reject_decoded_invocation")) +} + +///| +test "generated invokers create stdout only after fallible input decoding" { + let source = + #|#derive.tool + #|struct StreamAfterInput {} + #|pub fn StreamAfterInput::run( + #| output : @asyncCore.Sink[Byte], + #| value : String, + #|) -> String { + #| ignore(output) + #| value + #|} + let generated = @formatter.impls_to_string( + @lib.generate_tool_registration( + @lib.parse_tools([("stdout-after-input.mbt", source)]), + ), + ) + let before_stdout = generated.split("@tool.new_stdout()").collect()[0] + assert_true(before_stdout.contains("@tool.decode_canonical_field")) +} + ///| test "reexported tool Principal is injected as invocation context" { let source = diff --git a/sdks/moonbit/golem_sdk_tools/lib/tools_test.mbt b/sdks/moonbit/golem_sdk_tools/lib/tools_test.mbt index 7bff8e859a..80e617e67c 100644 --- a/sdks/moonbit/golem_sdk_tools/lib/tools_test.mbt +++ b/sdks/moonbit/golem_sdk_tools/lib/tools_test.mbt @@ -209,12 +209,6 @@ test "strict tool parser diagnostics" { ), content="Tool command 'Bad::run' must not have a self receiver", ) - inspect( - parse_error( - "#derive.tool\nstruct Bad {}\npub async fn Bad::run() -> Unit { ... }\n", - ), - content="Async tool command 'Bad::run' is unsupported: the MoonBit WIT export invoker is synchronous and no block_on is available", - ) inspect( parse_error( "#derive.tool\nstruct Bad {}\n#derive.arg(\"missing\", kind=\"flag\")\npub fn Bad::run(ok : Bool) -> Unit {}\n", diff --git a/sdks/moonbit/scripts/moon.mod b/sdks/moonbit/scripts/moon.mod new file mode 100644 index 0000000000..614c30f576 --- /dev/null +++ b/sdks/moonbit/scripts/moon.mod @@ -0,0 +1,7 @@ +name = "golemcloud/scripts" + +version = "0.0.0" + +import { + "moonbitlang/x@0.4.39", +} diff --git a/sdks/moonbit/scripts/moon.mod.json b/sdks/moonbit/scripts/moon.mod.json deleted file mode 100644 index 16abb1238e..0000000000 --- a/sdks/moonbit/scripts/moon.mod.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "golemcloud/scripts", - "version": "0.0.0", - "deps": { - "moonbitlang/x": "0.4.39" - } -} diff --git a/sdks/moonbit/scripts/release/main.mbt b/sdks/moonbit/scripts/release/main.mbt index b0176f42b7..92e3a20d24 100644 --- a/sdks/moonbit/scripts/release/main.mbt +++ b/sdks/moonbit/scripts/release/main.mbt @@ -94,8 +94,7 @@ fn prepare_release(sdk_version : String, tools_version : String) -> Unit raise { ///| fn revert_to_dev() -> Unit raise { println("==> Reverting to development mode...") - let workspace_dep = - "\"golemcloud/golem_sdk\": \"\{dev_sdk_version}\"" + let workspace_dep = "\"golemcloud/golem_sdk\": \"\{dev_sdk_version}\"" // 1. moon.mod.json — compute new content let mod_json = @fs.read_file_to_string(mod_json_path) let mut m = replace_sdk_dep(mod_json, workspace_dep) diff --git a/sdks/moonbit/scripts/release/pkg.generated.mbti b/sdks/moonbit/scripts/release/pkg.generated.mbti new file mode 100644 index 0000000000..353718873a --- /dev/null +++ b/sdks/moonbit/scripts/release/pkg.generated.mbti @@ -0,0 +1,13 @@ +// Generated using `moon info`, DON'T EDIT IT +package "golemcloud/scripts/release" + +// Values + +// Errors + +// Types and methods + +// Type aliases + +// Traits + diff --git a/sdks/rust/Cargo.lock b/sdks/rust/Cargo.lock index 18cf4ebcdd..a8950cc343 100644 --- a/sdks/rust/Cargo.lock +++ b/sdks/rust/Cargo.lock @@ -104,6 +104,12 @@ version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + [[package]] name = "arrayvec" version = "0.7.8" @@ -189,6 +195,21 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake3" +version = "1.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ae7bad254120e9e4c63bafc385310756f90c484eac0e36b8317cf09cb92a77" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "cpufeatures", + "rayon-core", +] + [[package]] name = "borsh" version = "1.8.0" @@ -402,6 +423,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "constant_time_eq" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -930,6 +957,7 @@ dependencies = [ "base64", "bigdecimal", "bit-vec 0.6.3", + "blake3", "bytes", "chrono", "combine", diff --git a/sdks/rust/golem-rust-macro/src/agentic/agent_definition_impl.rs b/sdks/rust/golem-rust-macro/src/agentic/agent_definition_impl.rs index f6141a7b68..e9d7beeb12 100644 --- a/sdks/rust/golem-rust-macro/src/agentic/agent_definition_impl.rs +++ b/sdks/rust/golem-rust-macro/src/agentic/agent_definition_impl.rs @@ -512,6 +512,10 @@ fn get_agent_type_with_remote_client( if !has_agent_config_attr(pat_type) { let ty = &pat_type.ty; constructor_parameters_with_schema.push(quote! { + assert!( + !<#ty as golem_rust::agentic::Schema>::contains_stream(), + "AgentStream cannot be used in an agent constructor parameter" + ); let schema: golem_rust::agentic::StructuredSchema = <#ty as golem_rust::agentic::Schema>::get_type(); match schema { golem_rust::agentic::StructuredSchema::Default(schema) => { diff --git a/sdks/rust/golem-rust-macro/src/agentic/agent_implementation_impl.rs b/sdks/rust/golem-rust-macro/src/agentic/agent_implementation_impl.rs index e23bdd325a..c24e38b21b 100644 --- a/sdks/rust/golem-rust-macro/src/agentic/agent_implementation_impl.rs +++ b/sdks/rust/golem-rust-macro/src/agentic/agent_implementation_impl.rs @@ -272,33 +272,32 @@ fn build_match_arms( let ident = &info.method.sig.ident; let fn_output_info = FunctionOutputInfo::from_signature(&info.method.sig); - let post_method_param_extraction_logic = match fn_output_info.async_ness { Asyncness::Future if !fn_output_info.is_unit => quote! { let result = self.#ident(#(#param_idents),*).await; - <_ as golem_rust::agentic::Schema>::to_schema_value(result).map_err(|e| { + golem_rust::agentic::Schema::into_agent_invocation_result(result).map_err(|e| { golem_rust::agentic::custom_error(format!( "Failed serializing return value for method {}: {}", #method_name, e )) - }).map(Some) + }) }, Asyncness::Future => quote! { let _ = self.#ident(#(#param_idents),*).await; - Ok(None) + Ok(golem_rust::agentic::AgentInvocationResult { value: None }) }, Asyncness::Immediate if !fn_output_info.is_unit => quote! { let result = self.#ident(#(#param_idents),*); - <_ as golem_rust::agentic::Schema>::to_schema_value(result).map_err(|e| { + golem_rust::agentic::Schema::into_agent_invocation_result(result).map_err(|e| { golem_rust::agentic::custom_error(format!( "Failed serializing return value for method {}: {}", #method_name, e )) - }).map(Some) + }) }, Asyncness::Immediate => quote! { let _ = self.#ident(#(#param_idents),*); - Ok(None) + Ok(golem_rust::agentic::AgentInvocationResult { value: None }) }, }; @@ -328,33 +327,40 @@ fn generate_method_param_extraction( sorted_method_index: usize, post_method_param_extraction_logic: proc_macro2::TokenStream, ) -> proc_macro2::TokenStream { + let input_param_index = fresh_method_local(params, "__golem_input_param_index"); + let agent_type_name_raw = fresh_method_local(params, "__golem_agent_type_name_raw"); + let agent_type_name_local = fresh_method_local(params, "__golem_agent_type_name"); + let param_schemas = fresh_method_local(params, "__golem_param_schemas"); + let input_variant = fresh_method_local(params, "__golem_input_variant"); + let invocation_principal = fresh_method_local(params, "__golem_invocation_principal"); let input_param_index_init = quote! { - let mut input_param_index: usize = 0; - let __agent_type_name_raw = #agent_type_name; - let __agent_type_name = golem_rust::agentic::AgentTypeName(__agent_type_name_raw.to_string()); - let __param_schemas = golem_rust::agentic::get_method_parameter_types_by_index( - &__agent_type_name, + let mut #input_param_index: usize = 0; + let #agent_type_name_raw = #agent_type_name; + let #agent_type_name_local = golem_rust::agentic::AgentTypeName(#agent_type_name_raw.to_string()); + let #param_schemas = golem_rust::agentic::get_method_parameter_types_by_index( + &#agent_type_name_local, #sorted_method_index ).ok_or_else(|| { golem_rust::agentic::custom_error(format!( "Internal Error: Parameter schemas not found for agent: {}, method index: {}", - __agent_type_name_raw, #sorted_method_index + #agent_type_name_raw, #sorted_method_index )) })?; + let #invocation_principal = &principal; }; let extraction: Vec = params.iter().enumerate().map(|(original_method_param_idx, (ident, pat_type))| { let ident_result = format_ident!("{}_result", ident); let ty = &pat_type.ty; quote! { - let #ident_result = match &mut __input_variant { + let #ident_result = match &mut #input_variant { __InputVariant::Tuple(values) => { - let enriched_schema = __param_schemas.get(#original_method_param_idx) + let enriched_schema = #param_schemas.get(#original_method_param_idx) .cloned() .ok_or_else(|| { golem_rust::agentic::custom_error(format!( "Internal Error: Parameter schema not found for agent: {}, method: {}, parameter index: {}", - __agent_type_name_raw, #method_name, #original_method_param_idx + #agent_type_name_raw, #method_name, #original_method_param_idx )) })?; @@ -362,7 +368,7 @@ fn generate_method_param_extraction( golem_rust::agentic::EnrichedParameterSchema::AutoInject(auto_injected_schema) => { match auto_injected_schema { golem_rust::agentic::AutoInjectedParamType::Principal => { - golem_rust::agentic::Schema::from_principal(principal.clone()).map_err(|e| { + golem_rust::agentic::Schema::from_principal((*#invocation_principal).clone()).map_err(|e| { golem_rust::agentic::invalid_input_error(format!("Failed parsing arg {} for method {}: {}", #original_method_param_idx, #method_name, e)) }) } @@ -370,8 +376,8 @@ fn generate_method_param_extraction( } golem_rust::agentic::EnrichedParameterSchema::Value(schema) => { - let schema_value = if input_param_index < values.len() { - values[input_param_index].take().ok_or_else(|| { + let schema_value = if #input_param_index < values.len() { + values[#input_param_index].take().ok_or_else(|| { golem_rust::agentic::invalid_input_error(format!("Argument already consumed in method {}", #method_name)) })? } else { @@ -379,7 +385,7 @@ fn generate_method_param_extraction( }; // only increment the input_param_index for non auto-injected parameters - input_param_index += 1; + #input_param_index += 1; <#ty as golem_rust::agentic::Schema>::from_schema_value( schema_value, @@ -403,7 +409,7 @@ fn generate_method_param_extraction( #input_param_index_init - let mut __input_variant = match input { + let mut #input_variant = match input { golem_rust::SchemaValue::Record { fields: values } => { __InputVariant::Tuple(values.into_iter().map(Some).collect()) }, @@ -413,24 +419,43 @@ fn generate_method_param_extraction( }; #(#extraction)* - if let __InputVariant::Tuple(values) = &__input_variant { - if input_param_index != values.len() { + if let __InputVariant::Tuple(values) = &#input_variant { + if #input_param_index != values.len() { return Err(golem_rust::agentic::invalid_input_error(format!( "Unexpected extra arguments in method {}: expected {}, got {}", #method_name, - input_param_index, + #input_param_index, values.len() ))); } } - drop(__input_variant); - drop(__param_schemas); - drop(__agent_type_name); + drop(#input_variant); + drop(#param_schemas); + drop(#agent_type_name_local); #post_method_param_extraction_logic } } +fn fresh_method_local(params: &[(syn::Ident, syn::PatType)], preferred: &str) -> syn::Ident { + let occupied = params + .iter() + .map(|(ident, _)| ident.to_string()) + .collect::>(); + if !occupied.contains(preferred) { + return format_ident!("{preferred}"); + } + + let mut suffix = 1usize; + loop { + let candidate = format!("{preferred}{suffix}"); + if !occupied.contains(&candidate) { + return format_ident!("{candidate}"); + } + suffix += 1; + } +} + fn generate_base_agent_impl( impl_block: &syn::ItemImpl, match_arms: &[proc_macro2::TokenStream], @@ -480,7 +505,7 @@ fn generate_base_agent_impl( } async fn invoke(&mut self, method_name: String, input: golem_rust::SchemaValue, principal: golem_rust::golem_agentic::golem::agent::common::Principal) - -> Result, golem_rust::golem_agentic::golem::agent::common::AgentError> { + -> Result { match method_name.as_str() { #(#match_arms,)* _ => Err(golem_rust::agentic::invalid_method_error(method_name)), diff --git a/sdks/rust/golem-rust-macro/src/agentic/client_generation.rs b/sdks/rust/golem-rust-macro/src/agentic/client_generation.rs index e219a25764..669bdd7cba 100644 --- a/sdks/rust/golem-rust-macro/src/agentic/client_generation.rs +++ b/sdks/rust/golem-rust-macro/src/agentic/client_generation.rs @@ -378,6 +378,34 @@ mod tests { assert!(!rendered.contains("fn get_agent_id (")); } + #[test] + fn awaited_streaming_methods_use_async_value_encoding_only() { + let item_trait = parse_quote! { + trait StreamingAgent { + fn new() -> Self; + fn forward( + &self, + stream: AgentStream, + ) -> AgentStream; + } + }; + + for durable in [true, false] { + let rendered = + get_remote_client(&item_trait, &[], &[], &[], &[], &[], durable).to_string(); + + assert_eq!(rendered.matches("encode_schema_value_async").count(), 1); + assert_eq!( + rendered + .matches( + "live streams cannot cross remote or scheduled agent invocation boundaries" + ) + .count(), + 3 + ); + } + } + #[test] fn ephemeral_clients_use_shared_non_colliding_result_type() { let first = render_client(false); @@ -899,6 +927,24 @@ fn generate_method_code( syn::ReturnType::Type(_, ty) => quote! { #ty }, syn::ReturnType::Default => quote! { () }, }; + let stream_types = sig + .inputs + .iter() + .filter_map(|arg| match arg { + syn::FnArg::Typed(param) => Some(param.ty.as_ref()), + syn::FnArg::Receiver(_) => None, + }) + .chain(match &sig.output { + syn::ReturnType::Type(_, ty) => Some(ty.as_ref()), + syn::ReturnType::Default => None, + }) + .collect::>(); + let reject_non_awaited_stream_invocation = quote! { + if false #(|| <#stream_types as golem_rust::agentic::Schema>::contains_stream())* { + let _ = (#(&#input_idents),*); + panic!("live streams cannot cross remote or scheduled agent invocation boundaries") + } + }; let process_invoke_result = match &sig.output { syn::ReturnType::Type(_, ty) if !fn_output_info.is_unit => decode_result_value( ty, @@ -908,13 +954,19 @@ fn generate_method_code( }; let input_record = positional_record_schema_value(input_idents, "Failed to encode parameter"); - let encoded_input = encode_value_only_carrier(input_record); + let encoded_input = encode_value_only_carrier(input_record.clone()); let encode_input = quote! { let input = #encoded_input; }; + let encode_input_async = quote! { + let input_value = #input_record; + let input = golem_rust::encode_schema_value_async(&input_value) + .await + .expect("Failed to encode parameters"); + }; let scheduled_time_param = fresh_param_ident(input_idents, "scheduled_time"); if agent_is_durable { return quote! { pub async fn #method_name(#(#input_defs),*) -> #return_type { - #encode_input + #encode_input_async let rpc_result_future = self.wasm_rpc.async_invoke_and_await( #remote_token, @@ -931,6 +983,7 @@ fn generate_method_code( } pub fn #trigger_name(#(#input_defs),*) { + #reject_non_awaited_stream_invocation #encode_input let rpc_result: Result<(), golem_rust::golem_agentic::golem::agent::host::RpcError> = @@ -940,6 +993,7 @@ fn generate_method_code( } pub fn #schedule_name(#(#input_defs,)* #scheduled_time_param: golem_rust::ScheduledTime) { + #reject_non_awaited_stream_invocation #encode_input self.wasm_rpc.schedule_invocation( @@ -950,6 +1004,7 @@ fn generate_method_code( } pub fn #schedule_cancelable_name(#(#input_defs,)* #scheduled_time_param: golem_rust::ScheduledTime) -> golem_rust::golem_agentic::golem::agent::host::CancellationToken { + #reject_non_awaited_stream_invocation #encode_input self.wasm_rpc.schedule_cancelable_invocation( @@ -963,7 +1018,7 @@ fn generate_method_code( quote! { pub async fn #method_name(#(#input_defs),*) -> golem_rust::agentic::EphemeralInvocationResult<#return_type> { - #encode_input + #encode_input_async let invocation = self.wasm_rpc.async_invoke_and_await(#remote_token, input); let metadata = invocation.metadata; let rpc_result: Result, golem_rust::golem_agentic::golem::agent::host::RpcError> = @@ -974,17 +1029,20 @@ fn generate_method_code( } pub fn #trigger_name(#(#input_defs),*) -> golem_rust::golem_agentic::golem::agent::host::InvocationMetadata { + #reject_non_awaited_stream_invocation #encode_input self.wasm_rpc.invoke(#remote_token, input) .unwrap_or_else(|e| panic!("rpc call to trigger {} failed: {:?}", #remote_token, e)) } pub fn #schedule_name(#(#input_defs,)* #scheduled_time_param: golem_rust::ScheduledTime) -> golem_rust::golem_agentic::golem::agent::host::InvocationMetadata { + #reject_non_awaited_stream_invocation #encode_input self.wasm_rpc.schedule_invocation(#scheduled_time_param, #remote_token, input).metadata } pub fn #schedule_cancelable_name(#(#input_defs,)* #scheduled_time_param: golem_rust::ScheduledTime) -> golem_rust::golem_agentic::golem::agent::host::CancelableScheduledInvocationReceipt { + #reject_non_awaited_stream_invocation #encode_input let receipt = self.wasm_rpc.schedule_cancelable_invocation(#scheduled_time_param, #remote_token, input); receipt diff --git a/sdks/rust/golem-rust/src/agentic/agent.rs b/sdks/rust/golem-rust/src/agentic/agent.rs index 21bcea4916..3fc2094e88 100644 --- a/sdks/rust/golem-rust/src/agentic/agent.rs +++ b/sdks/rust/golem-rust/src/agentic/agent.rs @@ -16,6 +16,10 @@ use crate::golem_agentic::exports::golem::agent::guest::{AgentError, AgentType, use crate::golem_agentic::golem::agent::host::parse_agent_id; use crate::schema::SchemaValue; +pub struct AgentInvocationResult { + pub value: Option, +} + #[derive(Debug)] pub struct SnapshotData { pub data: Vec, @@ -36,7 +40,7 @@ pub trait BaseAgent { method_name: String, input: SchemaValue, principal: Principal, - ) -> Result, AgentError>; + ) -> Result; /// Gets the agent type metadata of this agent fn get_definition(&self) -> AgentType; diff --git a/sdks/rust/golem-rust/src/agentic/agent_impl.rs b/sdks/rust/golem-rust/src/agentic/agent_impl.rs index 9c9975d54e..53d6b36f1d 100644 --- a/sdks/rust/golem-rust/src/agentic/agent_impl.rs +++ b/sdks/rust/golem-rust/src/agentic/agent_impl.rs @@ -17,7 +17,7 @@ use crate::golem_agentic::golem::agent::common::Principal; use crate::golem_agentic::golem::agent::host::parse_agent_id; use crate::load_snapshot::exports::golem::api::load_snapshot::Guest as LoadSnapshotGuest; use crate::save_snapshot::exports::golem::api::save_snapshot::Guest as SaveSnapshotGuest; -use crate::schema::wit::{decode_value, encode_value}; +use crate::schema::wit::{decode_value, encode_value_async}; use crate::{ agentic::{ AgentTypeName, with_agent_initiator, with_agent_instance, with_agent_instance_async, @@ -88,23 +88,18 @@ impl Guest for Component { .map_err(|e| AgentError::InvalidInput(format!("invalid schema value input: {e}")))?; with_agent_instance_async(|resolved_agent| async move { - resolved_agent + let result = resolved_agent .agent .borrow_mut() .as_mut() .invoke(method_name, input, principal) - .await - .and_then(|value| { - value - .map(|value| { - encode_value(&value).map_err(|e| { - AgentError::InvalidInput(format!( - "invalid schema value output: {e}" - )) - }) - }) - .transpose() - }) + .await?; + match result.value { + Some(value) => encode_value_async(&value).await.map(Some).map_err(|e| { + AgentError::InvalidInput(format!("invalid schema value output: {e}")) + }), + None => Ok(None), + } }) .await } diff --git a/sdks/rust/golem-rust/src/agentic/agent_stream.rs b/sdks/rust/golem-rust/src/agentic/agent_stream.rs new file mode 100644 index 0000000000..1e112c7227 --- /dev/null +++ b/sdks/rust/golem-rust/src/agentic/agent_stream.rs @@ -0,0 +1,129 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 + +use std::marker::PhantomData; + +use crate::schema::wit::wire::SchemaValueTree; +use crate::schema::{ + FromSchema, FromSchemaError, IntoSchema, MetadataEnvelope, SchemaBuilder, SchemaType, + SchemaValue, SchemaValueStream, TypeId, +}; + +type RawReader = wit_bindgen::StreamReader; +type RawWriter = wit_bindgen::StreamWriter; + +/// The readable end of a native component-model agent value stream. +pub struct AgentStream { + stream: SchemaValueStream, + marker: PhantomData, +} + +/// The writable end of an [`AgentStream`]. +pub struct AgentStreamWriter { + raw: RawWriter, + marker: PhantomData, +} + +impl AgentStream { + pub fn new() -> (AgentStreamWriter, Self) { + let (writer, reader) = crate::schema::wit::new_schema_value_stream(); + ( + AgentStreamWriter { + raw: writer, + marker: PhantomData, + }, + Self::from_raw(reader), + ) + } + + #[doc(hidden)] + pub fn from_raw(raw: RawReader) -> Self { + Self { + stream: SchemaValueStream::from_native(raw), + marker: PhantomData, + } + } + + #[doc(hidden)] + pub async fn into_raw(self) -> Result { + self.stream.take_native().await + } +} + +impl AgentStream { + pub async fn next(&mut self) -> Result, String> { + match self.stream.next_wire().await? { + Some(tree) => crate::schema::wit::decode_value(tree) + .map_err(|e| format!("failed to decode agent stream item: {e}")) + .and_then(|value| T::from_value(&value).map_err(|e| e.to_string())) + .map(Some), + None => Ok(None), + } + } + + pub async fn collect(mut self) -> Result, String> { + let mut result = Vec::new(); + while let Some(item) = self.next().await? { + result.push(item); + } + Ok(result) + } +} + +impl AgentStreamWriter { + pub async fn write_one(&mut self, value: T) -> Result<(), String> { + let value = crate::schema::wit::encode_value_async(&value.to_value()) + .await + .map_err(|e| format!("failed to encode agent stream item: {e}"))?; + if self.raw.write_one(value).await.is_none() { + Ok(()) + } else { + Err("agent stream reader was dropped".to_string()) + } + } + + pub async fn write_all(&mut self, values: impl IntoIterator) -> Result<(), String> { + for value in values { + self.write_one(value).await?; + } + Ok(()) + } +} + +impl IntoSchema for AgentStream { + fn type_id() -> TypeId { + TypeId::new(format!("golem.AgentStream<{}>", T::type_id())) + } + + fn register_in(builder: &mut SchemaBuilder) -> SchemaType { + SchemaType::Stream { + inner: Some(Box::new(T::register_in(builder))), + metadata: MetadataEnvelope::default(), + } + } + + fn to_value(&self) -> SchemaValue { + SchemaValue::Stream(self.stream.clone()) + } +} + +impl FromSchema for AgentStream { + fn from_value(value: &SchemaValue) -> Result { + match value { + SchemaValue::Stream(stream) => Ok(Self { + stream: stream.clone(), + marker: PhantomData, + }), + other => Err(FromSchemaError::shape_mismatch( + "stream", + crate::schema::conversion::value_kind(other), + "AgentStream", + )), + } + } +} diff --git a/sdks/rust/golem-rust/src/agentic/mod.rs b/sdks/rust/golem-rust/src/agentic/mod.rs index 7fba4a53cd..a44eca5c1b 100644 --- a/sdks/rust/golem-rust/src/agentic/mod.rs +++ b/sdks/rust/golem-rust/src/agentic/mod.rs @@ -18,6 +18,7 @@ pub use agent::*; pub use agent_config::*; pub use agent_initiator::*; pub use agent_registry::*; +pub use agent_stream::*; pub use async_utils::*; pub use errors::*; pub use extended_agent_type::*; @@ -50,6 +51,7 @@ mod agent_config; mod agent_impl; mod agent_initiator; mod agent_registry; +mod agent_stream; mod async_utils; mod errors; mod extended_agent_type; diff --git a/sdks/rust/golem-rust/src/agentic/schema.rs b/sdks/rust/golem-rust/src/agentic/schema.rs index eab40e4283..6bf3e0939c 100644 --- a/sdks/rust/golem-rust/src/agentic/schema.rs +++ b/sdks/rust/golem-rust/src/agentic/schema.rs @@ -21,6 +21,14 @@ use crate::schema::{ pub trait Schema { fn get_type() -> StructuredSchema; + + #[doc(hidden)] + fn contains_stream() -> bool { + match Self::get_type() { + StructuredSchema::Default(graph) => schema_contains_stream(&graph), + StructuredSchema::AutoInject(_) => false, + } + } fn to_schema_value(self) -> Result where Self: Sized; @@ -34,6 +42,75 @@ pub trait Schema { { Err("Principal can only be injected into Principal parameters".to_string()) } + + #[doc(hidden)] + fn into_agent_invocation_result(self) -> Result + where + Self: Sized, + { + self.to_schema_value() + .map(|value| super::AgentInvocationResult { value: Some(value) }) + } +} + +fn schema_contains_stream(graph: &SchemaGraph) -> bool { + fn visit( + ty: &SchemaType, + defs: &std::collections::HashMap<&str, &SchemaType>, + visiting: &mut std::collections::HashSet, + ) -> bool { + match ty { + SchemaType::Stream { .. } => true, + SchemaType::Ref { id, .. } => { + visiting.insert(id.0.clone()) + && defs + .get(id.as_str()) + .is_some_and(|body| visit(body, defs, visiting)) + } + SchemaType::Record { fields, .. } => fields + .iter() + .any(|field| visit(&field.body, defs, visiting)), + SchemaType::Variant { cases, .. } => cases + .iter() + .filter_map(|case| case.payload.as_ref()) + .any(|payload| visit(payload, defs, visiting)), + SchemaType::Tuple { elements, .. } => elements + .iter() + .any(|element| visit(element, defs, visiting)), + SchemaType::List { element, .. } | SchemaType::FixedList { element, .. } => { + visit(element, defs, visiting) + } + SchemaType::Map { key, value, .. } => { + visit(key, defs, visiting) || visit(value, defs, visiting) + } + SchemaType::Option { inner, .. } => visit(inner, defs, visiting), + SchemaType::Result { spec, .. } => { + spec.ok + .as_deref() + .is_some_and(|value| visit(value, defs, visiting)) + || spec + .err + .as_deref() + .is_some_and(|value| visit(value, defs, visiting)) + } + SchemaType::Union { spec, .. } => spec + .branches + .iter() + .any(|branch| visit(&branch.body, defs, visiting)), + SchemaType::Secret { spec, .. } => visit(&spec.inner, defs, visiting), + SchemaType::Future { inner, .. } => inner + .as_deref() + .is_some_and(|value| visit(value, defs, visiting)), + _ => false, + } + } + + let defs = graph + .defs + .iter() + .map(|definition| (definition.id.as_str(), &definition.body)) + .collect(); + visit(&graph.root, &defs, &mut std::collections::HashSet::new()) } #[allow(clippy::large_enum_variant)] diff --git a/sdks/rust/golem-rust/src/lib.rs b/sdks/rust/golem-rust/src/lib.rs index 357e7cffe5..4cbe3c4594 100644 --- a/sdks/rust/golem-rust/src/lib.rs +++ b/sdks/rust/golem-rust/src/lib.rs @@ -44,6 +44,12 @@ pub fn encode_schema_value( schema::wit::encode_value(value) } +pub async fn encode_schema_value_async( + value: &SchemaValue, +) -> Result { + schema::wit::encode_value_async(value).await +} + pub fn decode_schema_value( value: schema::wit::wire::SchemaValueTree, ) -> Result { diff --git a/sdks/rust/golem-rust/tests/agent.rs b/sdks/rust/golem-rust/tests/agent.rs index ebab0a9d94..6a15e3c468 100644 --- a/sdks/rust/golem-rust/tests/agent.rs +++ b/sdks/rust/golem-rust/tests/agent.rs @@ -20,7 +20,7 @@ test_r::enable!(); #[allow(clippy::disallowed_names)] mod tests { use golem_rust::agentic::{ - AgentTypeName, Multimodal, MultimodalAdvanced, MultimodalCustom, Schema, + AgentStream, AgentTypeName, Multimodal, MultimodalAdvanced, MultimodalCustom, Schema, UnstructuredBinary, UnstructuredText, }; use golem_rust::agentic::{Principal, create_webhook}; @@ -666,6 +666,7 @@ mod tests { ) .await .unwrap() + .value .unwrap(); let SchemaValue::List { elements } = output else { @@ -710,6 +711,178 @@ mod tests { assert!(result.is_err()); } + #[agent_definition] + trait StreamingAgent { + fn new() -> Self; + async fn combine( + &self, + prefix: String, + first: AgentStream, + second: AgentStream, + ) -> String; + fn forward(&self, stream: AgentStream) -> AgentStream; + } + + struct StreamingAgentImpl; + + #[agent_implementation] + impl StreamingAgent for StreamingAgentImpl { + fn new() -> Self { + Self + } + + async fn combine( + &self, + prefix: String, + first: AgentStream, + second: AgentStream, + ) -> String { + let first = first.into_raw().await.unwrap().take_handle(); + let second = second.into_raw().await.unwrap().take_handle(); + format!("{prefix}:{first}:{second}") + } + + fn forward(&self, stream: AgentStream) -> AgentStream { + stream + } + } + + #[test] + fn agent_stream_schema_retains_element_graph() { + #[derive(IntoSchema, FromSchema)] + struct Element { + value: String, + } + + let golem_rust::agentic::StructuredSchema::Default(graph) = + as Schema>::get_type() + else { + panic!("expected value schema") + }; + assert!(matches!( + graph.root, + SchemaType::Stream { inner: Some(_), .. } + )); + } + + #[test] + async fn agent_stream_dispatch_rejects_missing_streams() { + StreamingAgentImpl::__register_agent_type(); + let mut agent = StreamingAgentImpl::new(); + let scalar = SchemaValue::Record { + fields: vec![SchemaValue::String("p".to_string())], + }; + assert!( + agent + .invoke("combine".to_string(), scalar.clone(), Principal::Anonymous) + .await + .is_err() + ); + } + + #[test] + #[cfg(target_arch = "wasm32")] + async fn agent_stream_dispatch_preserves_forwarded_stream_identity() { + StreamingAgentImpl::__register_agent_type(); + let mut agent = StreamingAgentImpl::new(); + let (_writer, stream) = AgentStream::::new(); + let input_stream = stream.to_value(); + let invocation = agent + .invoke( + "forward".to_string(), + SchemaValue::Record { + fields: vec![input_stream.clone()], + }, + Principal::Anonymous, + ) + .await + .unwrap(); + assert_eq!(invocation.value, Some(input_stream)); + } + + type AliasedAgentStream = AgentStream; + + #[agent_definition] + trait AliasedStreamingAgent { + fn new() -> Self; + fn forward(&self, stream: AliasedAgentStream) -> AliasedAgentStream; + } + + struct AliasedStreamingAgentImpl; + + #[agent_implementation] + impl AliasedStreamingAgent for AliasedStreamingAgentImpl { + fn new() -> Self { + Self + } + + fn forward(&self, stream: AliasedAgentStream) -> AliasedAgentStream { + stream + } + } + + #[test] + #[cfg(target_arch = "wasm32")] + async fn agent_stream_alias_dispatches_through_recursive_value_tree() { + AliasedStreamingAgentImpl::__register_agent_type(); + let mut agent = AliasedStreamingAgentImpl::new(); + let (_writer, stream) = AgentStream::::new(); + let input_stream = stream.to_value(); + let invocation = agent + .invoke( + "forward".to_string(), + SchemaValue::Record { + fields: vec![input_stream.clone()], + }, + Principal::Anonymous, + ) + .await + .expect("a Rust type alias must not change AgentStream ABI dispatch"); + + assert_eq!(invocation.value, Some(input_stream)); + } + + #[agent_definition] + trait NativeStreamStateShadowAgent { + fn new() -> Self; + fn echo(&self, in_streams: String) -> String; + } + + struct NativeStreamStateShadowAgentImpl; + + #[agent_implementation] + impl NativeStreamStateShadowAgent for NativeStreamStateShadowAgentImpl { + fn new() -> Self { + Self + } + + fn echo(&self, in_streams: String) -> String { + in_streams + } + } + + #[test] + async fn method_parameter_named_in_streams_does_not_shadow_abi_state() { + NativeStreamStateShadowAgentImpl::__register_agent_type(); + let mut agent = NativeStreamStateShadowAgentImpl::new(); + + let invocation = agent + .invoke( + "echo".to_string(), + SchemaValue::Record { + fields: vec![SchemaValue::String("payload".to_string())], + }, + Principal::Anonymous, + ) + .await + .expect("a scalar parameter name must not affect native stream validation"); + + assert_eq!( + invocation.value, + Some(SchemaValue::String("payload".to_string())) + ); + } + #[agent_definition] #[description("a descriptive agent")] pub trait DescriptiveAgent { diff --git a/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.rs b/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.rs new file mode 100644 index 0000000000..3b3fbe8f03 --- /dev/null +++ b/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.rs @@ -0,0 +1,11 @@ +use golem_rust::agent_definition; +use golem_rust::agentic::AgentStream; + +type ConstructorInput = AgentStream; + +#[agent_definition] +trait AliasedStreamConstructorAgent { + fn new(input: ConstructorInput) -> Self; +} + +fn main() {} diff --git a/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.stderr b/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.stderr new file mode 100644 index 0000000000..34a3ccd39d --- /dev/null +++ b/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.stderr @@ -0,0 +1,5 @@ +error[E0080]: evaluation panicked: AgentStream cannot be used as an agent constructor parameter + --> tests/ui/fail/agent_stream_alias_constructor.rs:6:1 + | +6 | #[agent_definition] + | ^^^^^^^^^^^^^^^^^^^ evaluation of `AliasedStreamConstructorAgent::__register_agent_type::_` failed here diff --git a/sdks/rust/golem-rust/tests/ui/pass/scalar_named_agent_stream_constructor.rs b/sdks/rust/golem-rust/tests/ui/pass/scalar_named_agent_stream_constructor.rs new file mode 100644 index 0000000000..c5cb7e479f --- /dev/null +++ b/sdks/rust/golem-rust/tests/ui/pass/scalar_named_agent_stream_constructor.rs @@ -0,0 +1,13 @@ +use golem_rust::{FromSchema, IntoSchema, agent_definition}; + +#[derive(IntoSchema, FromSchema)] +struct AgentStream { + value: String, +} + +#[agent_definition] +trait ScalarNamedAgentStreamConstructorAgent { + fn new(input: AgentStream) -> Self; +} + +fn main() {} diff --git a/sdks/rust/golem-rust/wit/deps/golem-agent/guest.wit b/sdks/rust/golem-rust/wit/deps/golem-agent/guest.wit index dbe97ff310..d72413c288 100644 --- a/sdks/rust/golem-rust/wit/deps/golem-agent/guest.wit +++ b/sdks/rust/golem-rust/wit/deps/golem-agent/guest.wit @@ -15,8 +15,9 @@ interface guest { /// Invokes an agent. If create was not called before, it fails. /// /// `input` is a value tree whose root encodes the method's parameter list. - /// The result is `none` when the method's `output-schema` is `unit`, and - /// `some(value)` for a `single` output. + /// Streams are represented recursively by `stream-value` nodes. The result + /// is `none` when the method's `output-schema` is `unit`, and `some(value)` + /// for a `single` output. invoke: async func(method-name: string, input: schema-value-tree, principal: principal) -> result, agent-error>; /// Gets the agent type. If create was not called before, it fails diff --git a/sdks/rust/golem-rust/wit/deps/golem-core-v2/golem-core-v2.wit b/sdks/rust/golem-rust/wit/deps/golem-core-v2/golem-core-v2.wit index bb7dda191e..8a8dd02254 100644 --- a/sdks/rust/golem-rust/wit/deps/golem-core-v2/golem-core-v2.wit +++ b/sdks/rust/golem-rust/wit/deps/golem-core-v2/golem-core-v2.wit @@ -125,6 +125,17 @@ interface types { /// and reveal it only through capability-gated host interfaces. resource secret; + /// An affine wrapper around a native Component Model stream of schema + /// values. The indirection lets a stream occur anywhere in a recursive + /// `schema-value-tree` while preserving the native stream endpoint. + resource schema-value-stream { + /// Wraps any native schema-value reader for placement in a value tree. + wrap: static async func(reader: stream) -> own; + + /// Consumes a schema-value-stream wrapper and returns its native reader. + unwrap: static async func(value: own) -> stream; + } + // ============================================================ // Schema graph (self-contained type carrier) // ============================================================ @@ -524,8 +535,7 @@ interface types { // Capability nodes secret-value(own), quota-token-handle(own), - - // WASI P3 stubs (parseable only in the schema; no constructible values). + stream-value(own), } record variant-value-payload { @@ -584,4 +594,5 @@ interface types { graph: schema-graph, value: schema-value-tree, } + } diff --git a/sdks/scala/build.sbt b/sdks/scala/build.sbt index 2027db8130..c506dd47db 100644 --- a/sdks/scala/build.sbt +++ b/sdks/scala/build.sbt @@ -3,6 +3,8 @@ import sbt.Keys.* import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport.* import sbtcrossproject.CrossPlugin.autoImport.* import scalajscrossproject.ScalaJSCrossPlugin.autoImport.* +import org.scalajs.jsenv.nodejs.NodeJSEnv +import org.scalajs.linker.interface.ModuleKind // --------------------------------------------------------------------------- // Scala versions @@ -153,7 +155,12 @@ lazy val core = project "io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion % Test, "io.github.cquiroz" %%% "scala-java-locales" % "1.5.4" % Test, "io.github.cquiroz" %%% "locales-full-currencies-db" % "1.5.4" % Test - ) + ), + Test / scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)), + Test / jsEnv := { + val moduleLoader = (Test / sourceDirectory).value / "js" / "schema-value-stream-module-loader.cjs" + new NodeJSEnv(NodeJSEnv.Config().withArgs(List("--require", moduleLoader.getAbsolutePath))) + } ) // --- macros (JVM only) ----------------------------------------------------- diff --git a/sdks/scala/codegen/src/main/scala/golem/codegen/rpc/RpcCodegen.scala b/sdks/scala/codegen/src/main/scala/golem/codegen/rpc/RpcCodegen.scala index fdb7cf97cc..9cac095889 100644 --- a/sdks/scala/codegen/src/main/scala/golem/codegen/rpc/RpcCodegen.scala +++ b/sdks/scala/codegen/src/main/scala/golem/codegen/rpc/RpcCodegen.scala @@ -241,7 +241,7 @@ object RpcCodegen { if (ephemeral) { sb.append( - s" def cancelable($paramDecls): _root_.scala.Either[_root_.scala.Predef.String, _root_.golem.runtime.rpc.CancelableAsyncInvocation[$outputType]] =\n" + s" def cancelable($paramDecls): _root_.scala.concurrent.Future[_root_.golem.runtime.rpc.CancelableAsyncInvocation[$outputType]] =\n" ) sb.append(s" cancelableAwaitWithMetadata($packExpr)\n\n") } else { diff --git a/sdks/scala/core/js/src/main/scala/golem/host/SchemaWireInterop.scala b/sdks/scala/core/js/src/main/scala/golem/host/SchemaWireInterop.scala index 0542c768df..f54e45b7f9 100644 --- a/sdks/scala/core/js/src/main/scala/golem/host/SchemaWireInterop.scala +++ b/sdks/scala/core/js/src/main/scala/golem/host/SchemaWireInterop.scala @@ -24,6 +24,9 @@ import scala.collection.mutable import scala.scalajs.js import scala.scalajs.js.JSConverters._ import scala.scalajs.js.typedarray.Uint8Array +import scala.concurrent.Future +import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue +import golem.FutureInterop /** * Mechanical mapping between the host-agnostic flat carrier @@ -57,6 +60,15 @@ object SchemaWireInterop { def valueTreeFromJs(j: JsSchemaValueTree): WitSchemaValueTree = WitSchemaValueTree(j.valueNodes.toList.toVector.map(valueNodeFromJs), j.root) + /** + * Async stream-aware lowering. No reader is advanced while constructing the + * tree. + */ + def valueTreeToJsAsync(v: WitSchemaValueTree): Future[JsSchemaValueTree] = { + preflightValueTree(v) + Future.sequence(v.valueNodes.map(valueNodeToJsAsync)).map(nodes => JsSchemaValueTree(nodes.toJSArray, v.root)) + } + def typedToJs(t: WitTypedSchemaValue): JsTypedSchemaValue = JsTypedSchemaValue(graphToJs(t.graph), valueTreeToJs(t.value)) @@ -483,6 +495,7 @@ object SchemaWireInterop { import WitSchemaValueNode._ val seenRawSecret = mutable.Set.empty[Any] val seenRawQuota = mutable.Set.empty[Any] + val seenRawStream = mutable.Set.empty[Any] def checkRange(name: String, value: Long, min: Long, max: Long): Unit = if (value < min || value > max) @@ -523,6 +536,11 @@ object SchemaWireInterop { ) if (!seenRawQuota.add(raw)) throw SchemaEncodeError("the same quota-token handle appeared more than once in one value tree") + case StreamValue(h) => + val ownershipKey = h.ownershipKey + .getOrElse(throw SchemaEncodeError("schema value stream was already transferred")) + if (!seenRawStream.add(ownershipKey)) + throw SchemaEncodeError("the same schema value stream appeared more than once in one value tree") case _ => () } } @@ -582,9 +600,39 @@ object SchemaWireInterop { "quota-token handle was already transferred; an owned quota-token can only be sent once" ) } + case StreamValue(_) => + throw SchemaEncodeError("schema value streams require asynchronous encoding") } } + private def valueNodeToJsAsync(n: WitSchemaValueNode): Future[JsSchemaValueNode] = n match { + case WitSchemaValueNode.StreamValue(h) => + h.take() match { + case Some(GuestSchemaValueStream.Wrapped(raw, _)) => + Future.successful(JsSchemaValueNode.streamValue(raw.asInstanceOf[js.Any])) + case Some(GuestSchemaValueStream.Native(stream)) => + val iterator = new js.Object { + def next(): js.Promise[js.Object] = FutureInterop.toPromise( + stream.pull().flatMap { + case None => Future.successful(js.Dynamic.literal("done" -> true).asInstanceOf[js.Object]) + case Some(value) => + valueTreeToJsAsync(SchemaWire.schemaValueToWit(value)) + .map(tree => js.Dynamic.literal("done" -> false, "value" -> tree).asInstanceOf[js.Object]) + } + ) + } + val iterable = new js.Object { + @scala.scalajs.js.annotation.JSName(js.Symbol.asyncIterator) + def asyncIterator(): js.Object = iterator + } + FutureInterop + .fromPromise(JsSchemaValueStreamWrap.wrap(iterable.asInstanceOf[JsSchemaValueIterable])) + .map(raw => JsSchemaValueNode.streamValue(raw)) + case None => Future.failed(SchemaEncodeError("schema value stream was already transferred")) + } + case other => Future.successful(valueNodeToJs(other)) + } + private def valueNodeFromJs(j: JsSchemaValueNode): WitSchemaValueNode = { import WitSchemaValueNode._ j.tag match { @@ -637,6 +685,23 @@ object SchemaWireInterop { case "quota-token-handle" => // Wrap the owned `quota-token` resource in a fresh take-once handle. QuotaTokenHandle(GuestQuotaTokenHandle.fromRaw(valOf(j))) + case "stream-value" => + val raw = valOf(j).asInstanceOf[JsSchemaValueStream] + StreamValue( + GuestSchemaValueStreamHandle.wrapped( + raw, + () => + FutureInterop.fromPromise(JsSchemaValueStreamUnwrap.unwrap(raw)).map { iterable => + val iterator = iterable.iterator() + AgentStream.fromPull(() => + FutureInterop.fromPromise(iterator.next()).map { result => + if (result.done) None + else Some(SchemaWire.schemaValueFromWit(valueTreeFromJs(result.value))) + } + ) + } + ) + ) case other => throw new IllegalArgumentException(s"Unknown schema-value-node tag: $other") } } diff --git a/sdks/scala/core/js/src/main/scala/golem/host/js/schema/SchemaTypes.scala b/sdks/scala/core/js/src/main/scala/golem/host/js/schema/SchemaTypes.scala index 482045d05a..d12eaab777 100644 --- a/sdks/scala/core/js/src/main/scala/golem/host/js/schema/SchemaTypes.scala +++ b/sdks/scala/core/js/src/main/scala/golem/host/js/schema/SchemaTypes.scala @@ -641,8 +641,31 @@ object JsSchemaValueNode { */ def quotaTokenHandle(resource: js.Any): JsSchemaValueNode = JsShape.tagged[JsSchemaValueNode]("quota-token-handle", resource) + + def streamValue(resource: js.Any): JsSchemaValueNode = + JsShape.tagged[JsSchemaValueNode]("stream-value", resource) +} + +@js.native +trait JsAsyncIteratorResult[+A] extends js.Object { + def done: Boolean = js.native + def value: A = js.native +} + +@js.native +trait JsSchemaValueIterator extends js.Object { + def next(): js.Promise[JsAsyncIteratorResult[JsSchemaValueTree]] = js.native +} + +@js.native +trait JsSchemaValueIterable extends js.Object { + @scala.scalajs.js.annotation.JSName(js.Symbol.asyncIterator) + def iterator(): JsSchemaValueIterator = js.native } +@js.native +trait JsSchemaValueStream extends js.Object + @js.native sealed trait JsSchemaValueTree extends js.Object { def valueNodes: js.Array[JsSchemaValueNode] = js.native diff --git a/sdks/scala/core/js/src/main/scala/golem/host/js/schema/SchemaValueStreamApi.scala b/sdks/scala/core/js/src/main/scala/golem/host/js/schema/SchemaValueStreamApi.scala new file mode 100644 index 0000000000..fb2b9f810d --- /dev/null +++ b/sdks/scala/core/js/src/main/scala/golem/host/js/schema/SchemaValueStreamApi.scala @@ -0,0 +1,20 @@ +/* + * Copyright 2024-2026 Golem Cloud + * Licensed under the Golem Source License v1.1 (the "License"); + */ +package golem.host.js.schema + +import scala.scalajs.js +import scala.scalajs.js.annotation.JSImport + +@js.native +@JSImport("golem:core/types@2.0.0", "SchemaValueStream") +private[golem] object JsSchemaValueStreamUnwrap extends js.Object { + def unwrap(value: JsSchemaValueStream): js.Promise[JsSchemaValueIterable] = js.native +} + +@js.native +@JSImport("golem:core/types@2.0.0", "SchemaValueStream") +private[golem] object JsSchemaValueStreamWrap extends js.Object { + def wrap(value: JsSchemaValueIterable): js.Promise[JsSchemaValueStream] = js.native +} diff --git a/sdks/scala/core/js/src/main/scala/golem/runtime/autowire/MethodBinding.scala b/sdks/scala/core/js/src/main/scala/golem/runtime/autowire/MethodBinding.scala index d6fbb44f62..ac203cc200 100644 --- a/sdks/scala/core/js/src/main/scala/golem/runtime/autowire/MethodBinding.scala +++ b/sdks/scala/core/js/src/main/scala/golem/runtime/autowire/MethodBinding.scala @@ -72,10 +72,10 @@ object MethodBinding { Future .failed[Option[JsSchemaValueTree]](js.JavaScriptException(JsAgentError.invalidInput(err.toString))), value => - handler(instance, value, principal).map { out => + handler(instance, value, principal).flatMap { out => outputCodec.into match { - case None => None - case Some(into) => Some(SchemaPayload.encode(out)(into)) + case None => Future.successful(None) + case Some(into) => SchemaPayload.encodeAsync(out)(into).map(Some(_)) } } ) diff --git a/sdks/scala/core/js/src/main/scala/golem/runtime/autowire/SchemaPayload.scala b/sdks/scala/core/js/src/main/scala/golem/runtime/autowire/SchemaPayload.scala index 7ca36f9464..d5cb6d593a 100644 --- a/sdks/scala/core/js/src/main/scala/golem/runtime/autowire/SchemaPayload.scala +++ b/sdks/scala/core/js/src/main/scala/golem/runtime/autowire/SchemaPayload.scala @@ -20,6 +20,8 @@ import golem.host.SchemaWireInterop import golem.host.js.schema.{JsSchemaGraph, JsSchemaValueTree} import golem.schema.{FromSchema, FromSchemaError, IntoSchema, SchemaGraph} import golem.schema.wire.SchemaWire +import scala.concurrent.Future +import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue /** * The `golem:core/types@2.0.0` host-payload bridge: the single hub that turns @@ -51,4 +53,9 @@ object SchemaPayload { /** Decode a JS schema value tree into a value of `A`. */ def decode[A](tree: JsSchemaValueTree)(implicit ev: FromSchema[A]): Either[FromSchemaError, A] = ev.fromValue(SchemaWire.schemaValueFromWit(SchemaWireInterop.valueTreeFromJs(tree))) + + /** Stream-aware encoding used by invocation boundaries. */ + def encodeAsync[A](value: A)(implicit ev: IntoSchema[A]): Future[JsSchemaValueTree] = + SchemaWireInterop.valueTreeToJsAsync(SchemaWire.schemaValueToWit(ev.toValue(value))) + } diff --git a/sdks/scala/core/js/src/main/scala/golem/runtime/guest/Guest.scala b/sdks/scala/core/js/src/main/scala/golem/runtime/guest/Guest.scala index 979b34abd8..3a7121ba0b 100644 --- a/sdks/scala/core/js/src/main/scala/golem/runtime/guest/Guest.scala +++ b/sdks/scala/core/js/src/main/scala/golem/runtime/guest/Guest.scala @@ -120,7 +120,11 @@ object Guest { } } - private def invokeAgent(methodName: String, input: js.Dynamic, principal: js.Dynamic): js.Promise[js.Any] = + private def invokeAgent( + methodName: String, + input: js.Dynamic, + principal: js.Dynamic + ): js.Promise[js.Any] = if (js.isUndefined(resolved)) { js.Promise.reject(invalidAgentId("Agent is not initialized")).asInstanceOf[js.Promise[js.Any]] } else { @@ -139,16 +143,13 @@ object Guest { case other => js.JavaScriptException(other) }) } - // The host expects `option`: `Some(tree)` -> the tree, - // `None` (unit output) -> `js.undefined`. We bridge the Scala `Option` - // result to that union here, at the export boundary. val resultPromise: js.Promise[js.Any] = FutureInterop.toPromise( FutureInterop .fromPromise(r.defn.invokeAny(r.instance, mn, input.asInstanceOf[JsSchemaValueTree], scalaPrincipal)) .map { case Some(tree) => tree.asInstanceOf[js.Any] - case None => js.undefined.asInstanceOf[js.Any] + case None => js.undefined } ) resultPromise.`catch`[js.Any](onRejected) diff --git a/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AbstractRemoteMethod.scala b/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AbstractRemoteMethod.scala index 637faaf69b..bd26a6790f 100644 --- a/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AbstractRemoteMethod.scala +++ b/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AbstractRemoteMethod.scala @@ -55,7 +55,7 @@ abstract class AbstractRemoteMethod[Trait, In, Out] protected ( protected final def awaitWithMetadata(input: In): Future[InvocationResult[Out]] = resolved.awaitWithMetadata(method, input) - protected final def cancelableAwaitWithMetadata(input: In): Either[String, CancelableAsyncInvocation[Out]] = + protected final def cancelableAwaitWithMetadata(input: In): Future[CancelableAsyncInvocation[Out]] = resolved.cancelableAwaitWithMetadata(method, input) protected final def triggerWithMetadata(input: In): Future[InvocationReceipt] = diff --git a/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AgentClientRuntime.scala b/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AgentClientRuntime.scala index 2a5f33ca70..a2f791fc59 100644 --- a/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AgentClientRuntime.scala +++ b/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AgentClientRuntime.scala @@ -84,6 +84,25 @@ object AgentClientRuntime { case OutputMetadata.Single(_) => SchemaRpcCodec.decodeSingleResult[Out](result)(outputCodec.from.get) } + private def encodeInputAsync[In]( + inputCodec: golem.runtime.InputRecordCodec[In], + input: In + ): Future[JsSchemaValueTree] = + SchemaRpcCodec.encodeArgsAsync(input)(inputCodec) + + private def decodeOutputAsync[Out](outputCodec: OutputCodec[Out], result: Option[JsSchemaValueTree]): Future[Out] = + outputCodec.metadata match { + case OutputMetadata.Unit => Future.successful(().asInstanceOf[Out]) + case OutputMetadata.Single(_) => + Future.fromTry( + scala.util.Try( + SchemaRpcCodec + .decodeSingleResult[Out](result)(outputCodec.from.get) + .fold(err => throw js.JavaScriptException(err), identity) + ) + ) + } + private def resolveRemote( agentTypeName: String, payload: JsSchemaValueTree, @@ -132,31 +151,29 @@ object AgentClientRuntime { runScheduledCancelable(method, datetime, input) def awaitWithMetadata[In, Out](method: AgentMethod[Trait, In, Out], input: In): Future[InvocationResult[Out]] = { - val result = for { - params <- encodeInput(method.inputCodec, input) - raw <- client.rpc.invokeAndAwaitWithMetadata(method.functionName, params) - value <- decodeOutput(method.outputCodec, raw.value) - } yield InvocationResult(raw.metadata, value) - FutureInterop.fromEither(result) + implicit val ec = scala.scalajs.concurrent.JSExecutionContext.Implicits.queue + encodeInputAsync(method.inputCodec, input).flatMap { params => + FutureInterop.fromEither(client.rpc.asyncInvokeAndAwaitWithMetadata(method.functionName, params)).flatMap { raw => + raw.result.flatMap(decodeOutputAsync(method.outputCodec, _)).map(InvocationResult(raw.metadata, _)) + } + } } def cancelableAwaitWithMetadata[In, Out]( method: AgentMethod[Trait, In, Out], input: In - ): Either[String, CancelableAsyncInvocation[Out]] = - for { - params <- encodeInput(method.inputCodec, input) - raw <- client.rpc.asyncInvokeAndAwaitWithMetadata(method.functionName, params) - } yield CancelableAsyncInvocation( - raw.metadata, - raw.result.map(value => - decodeOutput(method.outputCodec, value).fold( - err => throw js.JavaScriptException(err), - identity + ): Future[CancelableAsyncInvocation[Out]] = { + implicit val ec = scala.scalajs.concurrent.JSExecutionContext.Implicits.queue + encodeInputAsync(method.inputCodec, input).flatMap { params => + FutureInterop.fromEither(client.rpc.asyncInvokeAndAwaitWithMetadata(method.functionName, params)).map { raw => + CancelableAsyncInvocation( + raw.metadata, + raw.result.flatMap(decodeOutputAsync(method.outputCodec, _)), + raw.cancellationToken ) - )(scala.scalajs.concurrent.JSExecutionContext.Implicits.queue), - raw.cancellationToken - ) + } + } + } def triggerWithMetadata[In](method: AgentMethod[Trait, In, _], input: In): Future[InvocationReceipt] = FutureInterop.fromEither(for { @@ -185,35 +202,31 @@ object AgentClientRuntime { } yield receipt) private def runAwaitable[In, Out](method: AgentMethod[Trait, In, Out], input: In): Future[Out] = { - // The default await path uses the synchronous host `invoke-and-await` - // import (fully wrapped in `Either`), matching the documented "always - // invoke via invoke-and-await" intent. The async `future-invoke-result` - // path is reserved for `cancelableAwait`, where cancellation is needed. - val result: Either[String, Out] = for { - params <- encodeInput(method.inputCodec, input) - raw <- client.rpc.invokeAndAwait(method.functionName, params) - value <- decodeOutput(method.outputCodec, raw) - } yield value - FutureInterop.fromEither(result) + implicit val ec = scala.scalajs.concurrent.JSExecutionContext.Implicits.queue + encodeInputAsync(method.inputCodec, input) + .flatMap(params => client.rpc.asyncInvokeAndAwait(method.functionName, params)) + .flatMap(decodeOutputAsync(method.outputCodec, _)) } private def runCancelableAwaitable[In, Out]( method: AgentMethod[Trait, In, Out], input: In - ): (Future[Out], CancellationToken) = - encodeInput(method.inputCodec, input) match { - case Left(err) => - (FutureInterop.failed(err), CancellationToken.fromFunction(() => ())) - case Right(params) => - val (rawFuture, token) = client.rpc.cancelableAsyncInvokeAndAwait(method.functionName, params) - val mappedFuture = rawFuture.map { raw => - decodeOutput(method.outputCodec, raw) match { - case Left(err) => throw scala.scalajs.js.JavaScriptException(err) - case Right(value) => value - } - }(scala.scalajs.concurrent.JSExecutionContext.Implicits.queue) - (mappedFuture, token) + ): (Future[Out], CancellationToken) = { + implicit val ec = scala.scalajs.concurrent.JSExecutionContext.Implicits.queue + var underlying = Option.empty[CancellationToken] + var cancelled = false + val token = CancellationToken.fromFunction { () => + cancelled = true + underlying.foreach(_.cancel()) } + val result = encodeInputAsync(method.inputCodec, input).flatMap { params => + val (rawFuture, rawToken) = client.rpc.cancelableAsyncInvokeAndAwait(method.functionName, params) + underlying = Some(rawToken) + if (cancelled) rawToken.cancel() + rawFuture.flatMap(decodeOutputAsync(method.outputCodec, _)) + } + (result, token) + } private def runFireAndForget[In, Out0](method: AgentMethod[Trait, In, Out0], input: In): Future[Unit] = { val result: Either[String, Unit] = for { diff --git a/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/SchemaRpcCodec.scala b/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/SchemaRpcCodec.scala index 5cc26a0487..7ec1cdbd59 100644 --- a/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/SchemaRpcCodec.scala +++ b/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/SchemaRpcCodec.scala @@ -24,8 +24,10 @@ import golem.schema.wire.SchemaWire import golem.{UByte, UInt, ULong, UShort, Uuid} import scala.collection.immutable.ListMap +import scala.concurrent.Future import scala.scalajs.js import scala.scalajs.js.JSConverters._ +import scala.scalajs.concurrent.JSExecutionContext.Implicits.queue /** * The `golem:agent/host@2.0.0` RPC-boundary codec: encodes the parameter-list @@ -257,6 +259,9 @@ private[golem] object SchemaRpcCodec { def decodeValue(tree: JsSchemaValueTree): SchemaValue = SchemaWire.schemaValueFromWit(SchemaWireInterop.valueTreeFromJs(tree)) + def encodeValueAsync(value: SchemaValue): Future[JsSchemaValueTree] = + SchemaWireInterop.valueTreeToJsAsync(SchemaWire.schemaValueToWit(value)) + def encodeUByte(v: UByte): SchemaValue = { val x = v.value if (x < 0 || x > 255) @@ -436,6 +441,9 @@ private[golem] object SchemaRpcCodec { def encodeArgs[In](input: In)(implicit into: IntoSchema[In]): JsSchemaValueTree = SchemaPayload.encode(input) + def encodeArgsAsync[In](input: In)(implicit into: IntoSchema[In]): Future[JsSchemaValueTree] = + SchemaPayload.encodeAsync(input) + /** Decode a parameter-list `schema-value-tree` back into `In`. */ def decodeArgs[In](tree: JsSchemaValueTree)(implicit from: FromSchema[In]): Either[String, In] = SchemaPayload.decode[In](tree).left.map(_.toString) diff --git a/sdks/scala/core/js/src/test/js/schema-value-stream-module-loader.cjs b/sdks/scala/core/js/src/test/js/schema-value-stream-module-loader.cjs new file mode 100644 index 0000000000..5ddf508ea6 --- /dev/null +++ b/sdks/scala/core/js/src/test/js/schema-value-stream-module-loader.cjs @@ -0,0 +1,14 @@ +const Module = require("node:module"); + +const load = Module._load; +Module._load = function (request) { + if (request === "golem:core/types@2.0.0") { + return { + SchemaValueStream: { + wrap: async (iterable) => ({ iterable }), + unwrap: async (stream) => stream.iterable, + }, + }; + } + return load.apply(this, arguments); +}; diff --git a/sdks/scala/core/js/src/test/scala/golem/host/SchemaWireInteropSpec.scala b/sdks/scala/core/js/src/test/scala/golem/host/SchemaWireInteropSpec.scala index 2d4ab1b5c3..2812b8cffd 100644 --- a/sdks/scala/core/js/src/test/scala/golem/host/SchemaWireInteropSpec.scala +++ b/sdks/scala/core/js/src/test/scala/golem/host/SchemaWireInteropSpec.scala @@ -21,10 +21,12 @@ import golem.schema.wire._ import golem.schema.wire.WitSchemaTypeBody._ import golem.schema.wire.WitSchemaValueNode._ import golem.host.js.schema.{JsSchemaTypeBody, JsSchemaValueNode, JsSchemaValueTree} +import zio.ZIO import zio.test._ import scala.scalajs.js import scala.scalajs.js.typedarray.Uint8Array +import scala.concurrent.Future /** * Exhaustive `Wit* -> Js* -> Wit*` round-trip for the v2 @@ -359,6 +361,40 @@ object SchemaWireInteropSpec extends ZIOSpecDefault { val result = scala.util.Try(SchemaWireInterop.valueTreeToJs(tree)) assertTrue(result.isFailure, handle.isPresent) }, + test("schema value stream: async host wrap and unwrap preserve demand-driven items") { + ZIO.fromFuture { implicit ec => + var item = Option(SchemaValue.StringValue("first")) + val source = AgentStream.fromPull { () => + val result = item + item = None + Future.successful(result) + } + val tree = WitSchemaValueTree( + Vector(StreamValue(GuestSchemaValueStreamHandle.native(source))), + 0 + ) + + for { + encoded <- SchemaWireInterop.valueTreeToJsAsync(tree) + decoded = SchemaWireInterop.valueTreeFromJs(encoded) + result <- decoded.valueNodes(0) match { + case StreamValue(handle) => + handle.take() match { + case Some(GuestSchemaValueStream.Wrapped(_, unwrap)) => + unwrap().flatMap { stream => + for { + first <- stream.pull() + end <- stream.pull() + } yield assertTrue(first.contains(SchemaValue.StringValue("first")), end.isEmpty) + } + case other => + Future.successful(assertTrue(false).label(s"expected wrapped stream, got $other")) + } + case other => Future.successful(assertTrue(false).label(s"expected StreamValue, got $other")) + } + } yield result + } + }, // The round-trip tests above only prove encode/decode self-consistency. These // smoke tests assert the *raw* emitted JS shape against the wasm-rquickjs d.ts // quirks directly, so a consistently-wrong tag/field on both sides cannot hide. diff --git a/sdks/scala/core/js/src/test/scala/golem/runtime/autowire/SchemaPayloadSpec.scala b/sdks/scala/core/js/src/test/scala/golem/runtime/autowire/SchemaPayloadSpec.scala index 4d22ec09d2..81d9ebe312 100644 --- a/sdks/scala/core/js/src/test/scala/golem/runtime/autowire/SchemaPayloadSpec.scala +++ b/sdks/scala/core/js/src/test/scala/golem/runtime/autowire/SchemaPayloadSpec.scala @@ -17,8 +17,11 @@ package golem.runtime.autowire import golem.host.SchemaWireInterop -import golem.schema.{IntoSchema, SchemaGraph} +import golem.schema.{AgentStream, IntoSchema, SchemaGraph} import golem.schema.wire.SchemaWire +import scala.concurrent.Future +import scala.scalajs.js +import zio.ZIO import zio.blocks.schema.Schema import zio.test._ @@ -75,6 +78,42 @@ object SchemaPayloadSpec extends ZIOSpecDefault { override def spec: Spec[TestEnvironment, Any] = suite("SchemaPayloadSpec")( suite("encode/decode round-trips through the JS boundary")( + test("stream decoding uses the standard path and unwraps on first pull") { + ZIO.fromFuture { implicit ec => + var item = Option("first") + val source = AgentStream.fromPull { () => + val result = item + item = None + Future.successful(result) + } + + SchemaPayload.encodeAsync(source).flatMap { encoded => + SchemaPayload.decode[AgentStream[String]](encoded) match { + case Left(error) => Future.failed(error) + case Right(stream) => + for { + first <- stream.pull() + end <- stream.pull() + } yield assertTrue(first.contains("first"), end.isEmpty) + } + } + } + }, + test("an unread received stream forwards its original endpoint") { + ZIO.fromFuture { implicit ec => + val source = AgentStream.fromPull(() => Future.successful(None: Option[String])) + + for { + encoded <- SchemaPayload.encodeAsync(source) + stream = SchemaPayload.decode[AgentStream[String]](encoded).fold(throw _, identity) + forwarded <- SchemaPayload.encodeAsync(stream) + } yield { + val originalEndpoint = encoded.valueNodes(0).asInstanceOf[js.Dynamic].selectDynamic("val") + val forwardedEndpoint = forwarded.valueNodes(0).asInstanceOf[js.Dynamic].selectDynamic("val") + assertTrue(originalEndpoint.asInstanceOf[AnyRef] eq forwardedEndpoint.asInstanceOf[AnyRef]) + } + } + }, test("primitive Int") { assertTrue(roundtrip(42) == Right(42)) }, diff --git a/sdks/scala/core/js/src/test/scala/golem/runtime/rpc/AgentClientRuntimeSpec.scala b/sdks/scala/core/js/src/test/scala/golem/runtime/rpc/AgentClientRuntimeSpec.scala index 3e6ed2cf76..b35c019144 100644 --- a/sdks/scala/core/js/src/test/scala/golem/runtime/rpc/AgentClientRuntimeSpec.scala +++ b/sdks/scala/core/js/src/test/scala/golem/runtime/rpc/AgentClientRuntimeSpec.scala @@ -21,13 +21,13 @@ import golem.runtime.annotations.{DurabilityMode, agentDefinition} import golem.BaseAgent import golem.runtime.{AgentMethod, AgentType} import golem.runtime.rpc.AgentClientRuntimeSpecFixtures._ -import golem.schema.IntoSchema +import golem.schema.{AgentStream, IntoSchema} import zio._ import zio.test._ import zio.blocks.schema.Schema import scala.collection.mutable -import scala.concurrent.Future +import scala.concurrent.{ExecutionContext, Future} import scala.scalajs.js object AgentClientRuntimeSpec extends ZIOSpecDefault { @@ -100,6 +100,24 @@ object AgentClientRuntimeSpec extends ZIOSpecDefault { invoker.scheduleCalls.head._2 == method.functionName ) } + }, + test("PROVISIONAL bug_finder reproducer — remove if the finding is rejected: trigger rejects streams without consuming them") { + val agentType = rpcAgentType + val invoker = new RecordingRpcInvoker + val resolved = resolvedAgent(invoker, agentType) + val method = findMethod[RpcParityAgent, AgentStream[String], Unit](agentType, "consumeStream") + val stream = AgentStream.fromPull(() => Future.successful(Some("still-owned"))) + + ZIO.fromFuture { implicit ec => + resolved.trigger(method, stream).failed.flatMap { _ => + stream.pull().map { remaining => + assertTrue( + remaining.contains("still-owned"), + invoker.triggerCalls.isEmpty + ) + } + } + } } ) @@ -197,6 +215,9 @@ object AgentClientRuntimeSpec extends ZIOSpecDefault { } private object AgentClientRuntimeSpecFixtures { + implicit val agentStreamExecutionContext: ExecutionContext = + scala.scalajs.concurrent.JSExecutionContext.Implicits.queue + @agentDefinition(mode = DurabilityMode.Durable) trait RpcParityAgent extends BaseAgent { class Id(val token: String) @@ -208,6 +229,8 @@ private object AgentClientRuntimeSpecFixtures { def multiArgs(message: String, count: Int): Future[Int] def fireAndForget(event: String): Unit + + def consumeStream(stream: AgentStream[String]): Unit } final case class RpcCtor(token: String) diff --git a/sdks/scala/model/src/main/scala/golem/schema/AgentStream.scala b/sdks/scala/model/src/main/scala/golem/schema/AgentStream.scala new file mode 100644 index 0000000000..8970b0bfe8 --- /dev/null +++ b/sdks/scala/model/src/main/scala/golem/schema/AgentStream.scala @@ -0,0 +1,145 @@ +/* + * Copyright 2024-2026 Golem Cloud + * + * Licensed under the Golem Source License v1.1 (the "License"); + * you may not use this file except in compliance with the License. + */ +package golem.schema + +import scala.concurrent.{ExecutionContext, Future} +import scala.util.control.NonFatal + +/** A demand-driven, single-reader stream used by schema-native agent calls. */ +final class AgentStream[+A] private[golem] ( + private[golem] val pullValue: () => Future[Option[A]], + private var directTransfer: Option[() => GuestSchemaValueStreamHandle] = None +) { + private val lock = new AnyRef + private var moved = false + private var pullActive = false + + def pull(): Future[Option[A]] = lock.synchronized { + if (moved) + Future.failed(new IllegalStateException("agent stream was already transferred")) + else if (pullActive) + Future.failed(new IllegalStateException("agent stream already has an active pull")) + else { + pullActive = true + directTransfer = None + val result = + try pullValue() + catch { + case NonFatal(error) => Future.failed(error) + } + result.andThen { case _ => lock.synchronized { pullActive = false } }(ExecutionContext.parasitic) + } + } + + /** + * Transfers this stream into a mapped stream. The original can no longer be + * pulled or transferred. + */ + def map[B](f: A => B)(implicit ec: ExecutionContext): AgentStream[B] = + lock.synchronized { + if (moved) + throw new IllegalStateException("agent stream was already transferred") + if (pullActive) + throw new IllegalStateException("agent stream cannot be transferred while a pull is active") + moved = true + directTransfer = None + AgentStream.fromPull(() => pullValue().map(_.map(f))) + } + + private[golem] def moveToSchemaValueStream( + encode: A => SchemaValue + )(implicit ec: ExecutionContext): GuestSchemaValueStreamHandle = + lock.synchronized { + if (moved) + throw new IllegalStateException("agent stream was already transferred") + if (pullActive) + throw new IllegalStateException("agent stream cannot be transferred while a pull is active") + moved = true + directTransfer match { + case Some(transfer) => transfer() + case None => GuestSchemaValueStreamHandle.native(AgentStream.fromPull(() => pullValue().map(_.map(encode)))) + } + } +} + +object AgentStream { + def fromPull[A](pull: () => Future[Option[A]]): AgentStream[A] = new AgentStream(pull) + + implicit def intoSchema[A](implicit element: IntoSchema[A], ec: ExecutionContext): IntoSchema[AgentStream[A]] = + new IntoSchema[AgentStream[A]] { + override lazy val graph: SchemaGraph = + SchemaGraph(element.graph.defs, SchemaType(SchemaTypeBody.StreamType(Some(element.graph.root)))) + override def toValue(value: AgentStream[A]): SchemaValue = + SchemaValue.StreamValue(value.moveToSchemaValueStream(element.toValue)) + } + + implicit def fromSchema[A](implicit element: FromSchema[A], ec: ExecutionContext): FromSchema[AgentStream[A]] = + new FromSchema[AgentStream[A]] { + private def decode(stream: AgentStream[SchemaValue]): AgentStream[A] = + new AgentStream(() => + stream.pull().flatMap { + case None => Future.successful(None) + case Some(value) => + element.fromValue(value).fold(e => Future.failed(e), a => Future.successful(Some(a))) + } + ) + + override def fromValue(value: SchemaValue): Either[FromSchemaError, AgentStream[A]] = value match { + case SchemaValue.StreamValue(handle) => + handle.take() match { + case Some(GuestSchemaValueStream.Native(stream)) => + Right(decode(stream)) + case Some(wrapped @ GuestSchemaValueStream.Wrapped(_, unwrap)) => + lazy val stream = unwrap() + Right( + new AgentStream( + () => stream.flatMap(decode(_).pull()), + Some(() => GuestSchemaValueStreamHandle.endpoint(wrapped)) + ) + ) + case None => Left(FromSchemaError("schema value stream was already transferred")) + } + case other => Left(FromSchemaError(s"Expected stream value, got $other")) + } + } +} + +private[golem] sealed trait GuestSchemaValueStream { + def ownershipKey: Any +} +private[golem] object GuestSchemaValueStream { + final case class Wrapped(raw: Any, unwrap: () => Future[AgentStream[SchemaValue]]) extends GuestSchemaValueStream { + override def ownershipKey: Any = raw + } + final case class Native(value: AgentStream[SchemaValue]) extends GuestSchemaValueStream { + override def ownershipKey: Any = value + } +} + +/** + * Affine holder for a schema value stream travelling in a schema value tree. + */ +final class GuestSchemaValueStreamHandle private (private var cell: Option[GuestSchemaValueStream]) { + def isPresent: Boolean = cell.isDefined + private[golem] def take(): Option[GuestSchemaValueStream] = { val result = cell; cell = None; result } + private[golem] def withHandle[A](f: GuestSchemaValueStream => A): Option[A] = cell.map(f) + private[golem] def ownershipKey: Option[Any] = cell.map(_.ownershipKey) +} + +object GuestSchemaValueStreamHandle { + private[golem] def wrapped( + raw: Any, + unwrap: () => Future[AgentStream[SchemaValue]] + ): GuestSchemaValueStreamHandle = + endpoint(GuestSchemaValueStream.Wrapped(raw, unwrap)) + + private[golem] def endpoint(value: GuestSchemaValueStream): GuestSchemaValueStreamHandle = + new GuestSchemaValueStreamHandle(Some(value)) + + private[golem] def native(stream: AgentStream[SchemaValue]): GuestSchemaValueStreamHandle = + new GuestSchemaValueStreamHandle(Some(GuestSchemaValueStream.Native(stream))) +} diff --git a/sdks/scala/model/src/main/scala/golem/schema/SchemaValue.scala b/sdks/scala/model/src/main/scala/golem/schema/SchemaValue.scala index a662cfe145..7fb9d39d1d 100644 --- a/sdks/scala/model/src/main/scala/golem/schema/SchemaValue.scala +++ b/sdks/scala/model/src/main/scala/golem/schema/SchemaValue.scala @@ -80,6 +80,9 @@ object SchemaValue { * moved to exactly one destination; it carries no readable content. */ final case class QuotaTokenHandle(handle: GuestQuotaTokenHandle) extends SchemaValue + + /** An owned native stream, which may occur at any depth in the value tree. */ + final case class StreamValue(handle: GuestSchemaValueStreamHandle) extends SchemaValue } /** An entry of a [[SchemaValue.MapValue]]. */ @@ -125,6 +128,7 @@ object v { def ok(value: Option[SchemaValue]): SchemaValue = ResultValue(SchemaResult.Ok(value)) def err(value: Option[SchemaValue]): SchemaValue = ResultValue(SchemaResult.Err(value)) - def secret(handle: GuestSecretHandle): SchemaValue = SecretValue(handle) - def quotaToken(handle: GuestQuotaTokenHandle): SchemaValue = QuotaTokenHandle(handle) + def secret(handle: GuestSecretHandle): SchemaValue = SecretValue(handle) + def quotaToken(handle: GuestQuotaTokenHandle): SchemaValue = QuotaTokenHandle(handle) + def stream(handle: GuestSchemaValueStreamHandle): SchemaValue = StreamValue(handle) } diff --git a/sdks/scala/model/src/main/scala/golem/schema/validation/ValueValidation.scala b/sdks/scala/model/src/main/scala/golem/schema/validation/ValueValidation.scala index aceb349118..4bb0ce958f 100644 --- a/sdks/scala/model/src/main/scala/golem/schema/validation/ValueValidation.scala +++ b/sdks/scala/model/src/main/scala/golem/schema/validation/ValueValidation.scala @@ -204,6 +204,7 @@ object ValueValidation { case (QuantityType(s), QuantityValueNode(q)) => checkQuantity(s, q, p, e) case (SecretType(_), SecretValue(_)) => () case (QuotaTokenType(_), QuotaTokenHandle(_)) => () + case (StreamType(_), StreamValue(_)) => () case (RecordType(fs), RecordValue(vs)) => if (fs.length != vs.length) e += RecordArityMismatch(path(p), fs.length, vs.length) else fs.zip(vs).foreach { case (f, x) => check(g, f.body, x, p :+ ValuePathSegment.Field(f.name), e) } diff --git a/sdks/scala/model/src/main/scala/golem/schema/wire/Wire.scala b/sdks/scala/model/src/main/scala/golem/schema/wire/Wire.scala index 5897d7bd1e..0c0692c720 100644 --- a/sdks/scala/model/src/main/scala/golem/schema/wire/Wire.scala +++ b/sdks/scala/model/src/main/scala/golem/schema/wire/Wire.scala @@ -166,7 +166,8 @@ object WitSchemaValueNode { * quota-token-handle(own)`). Carries the opaque affine handle * unchanged; the take-once transfer happens at the JS host boundary. */ - final case class QuotaTokenHandle(handle: GuestQuotaTokenHandle) extends WitSchemaValueNode + final case class QuotaTokenHandle(handle: GuestQuotaTokenHandle) extends WitSchemaValueNode + final case class StreamValue(handle: GuestSchemaValueStreamHandle) extends WitSchemaValueNode } final case class WitTypedSchemaValue(graph: WitSchemaGraph, value: WitSchemaValueTree) diff --git a/sdks/scala/model/src/main/scala/golem/schema/wire/WireCodec.scala b/sdks/scala/model/src/main/scala/golem/schema/wire/WireCodec.scala index 6f2e048317..45ec532894 100644 --- a/sdks/scala/model/src/main/scala/golem/schema/wire/WireCodec.scala +++ b/sdks/scala/model/src/main/scala/golem/schema/wire/WireCodec.scala @@ -240,6 +240,7 @@ object SchemaWire { private def preflightCapabilityHandles(value: SchemaValue): Unit = { val seenSecrets = mutable.Set.empty[GuestSecretHandle] val seenQuotaTokens = mutable.Set.empty[GuestQuotaTokenHandle] + val seenStreams = mutable.Set.empty[Any] def visit(v: SchemaValue): Unit = { import SchemaValue._ v match { @@ -255,6 +256,11 @@ object SchemaWire { ) if (!seenQuotaTokens.add(h)) throw SchemaEncodeError("the same quota-token handle appeared more than once in one value tree") + case StreamValue(h) => + val ownershipKey = + h.ownershipKey.getOrElse(throw SchemaEncodeError("schema value stream was already transferred")) + if (!seenStreams.add(ownershipKey)) + throw SchemaEncodeError("the same schema value stream appeared more than once in one value tree") case RecordValue(fields) => fields.foreach(visit) case VariantValue(_, p) => p.foreach(visit) case TupleValue(elements) => elements.foreach(visit) @@ -326,6 +332,7 @@ object SchemaWire { case UnionValue(unionTag, body) => W.UnionValue(WitUnionValuePayload(unionTag, emit(body))) case SecretValue(h) => W.SecretValue(h) case QuotaTokenHandle(h) => W.QuotaTokenHandle(h) + case StreamValue(h) => W.StreamValue(h) } } @@ -343,6 +350,7 @@ object SchemaWire { val liftedHandle = Array.fill(nodes.length)(false) val seenRawSecret = mutable.Set.empty[Any] val seenRawQuota = mutable.Set.empty[Any] + val seenRawStream = mutable.Set.empty[Any] def fromIdx(idx: Int): SchemaValue = { if (idx < 0 || idx >= nodes.length) @@ -367,6 +375,14 @@ object SchemaWire { if (!seenRawQuota.add(raw)) throw SchemaDecodeError(s"quota-token handle resource referenced more than once at index $idx") liftedHandle(idx) = true + case WitSchemaValueNode.StreamValue(h) => + if (liftedHandle(idx)) + throw SchemaDecodeError(s"schema value stream node referenced more than once at index $idx") + val ownershipKey = h.ownershipKey + .getOrElse(throw SchemaDecodeError(s"schema value stream node already consumed at index $idx")) + if (!seenRawStream.add(ownershipKey)) + throw SchemaDecodeError(s"schema value stream resource referenced more than once at index $idx") + liftedHandle(idx) = true case _ => () } onPath(idx) = true @@ -392,6 +408,9 @@ object SchemaWire { case WitSchemaValueNode.QuotaTokenHandle(h) if includeLifted || !liftedHandle(i) => h.take() if (leftover.isEmpty) leftover = Some(i) + case WitSchemaValueNode.StreamValue(h) if includeLifted || !liftedHandle(i) => + h.take() + if (leftover.isEmpty) leftover = Some(i) case _ => () } i += 1 @@ -441,6 +460,7 @@ object SchemaWire { case WitSchemaValueNode.UnionValue(p) => S.UnionValue(p.tag, fromIdx(p.body)) case WitSchemaValueNode.SecretValue(h) => S.SecretValue(h) case WitSchemaValueNode.QuotaTokenHandle(h) => S.QuotaTokenHandle(h) + case WitSchemaValueNode.StreamValue(h) => S.StreamValue(h) } } diff --git a/sdks/scala/model/src/test/scala/golem/schema/AgentStreamSpec.scala b/sdks/scala/model/src/test/scala/golem/schema/AgentStreamSpec.scala new file mode 100644 index 0000000000..c271a900be --- /dev/null +++ b/sdks/scala/model/src/test/scala/golem/schema/AgentStreamSpec.scala @@ -0,0 +1,47 @@ +/* + * Copyright 2024-2026 Golem Cloud + * + * Licensed under the Golem Source License v1.1 (the "License"); + * you may not use this file except in compliance with the License. + */ +package golem.schema + +import scala.concurrent.{Future, Promise} +import scala.util.Try +import zio.ZIO +import zio.test._ + +object AgentStreamSpec extends ZIOSpecDefault { + override def spec: Spec[TestEnvironment, Any] = + suite("AgentStreamSpec")( + test("encoding transfers the stream exactly once") { + ZIO.fromFuture { implicit ec => + val stream = AgentStream.fromPull(() => Future.successful(Some("value"))) + val codec = implicitly[IntoSchema[AgentStream[String]]] + val first = codec.toValue(stream) + val second = Try(codec.toValue(stream)) + + stream.pull().failed.map { pullFailure => + assertTrue( + first.isInstanceOf[SchemaValue.StreamValue], + second.isFailure, + pullFailure.getMessage.contains("transferred") + ) + } + } + }, + test("a second concurrent pull is rejected") { + ZIO.fromFuture { implicit ec => + val pending = Promise[Option[String]]() + val stream = AgentStream.fromPull(() => pending.future) + val first = stream.pull() + val second = stream.pull() + + second.failed.flatMap { failure => + pending.success(None) + first.map(result => assertTrue(failure.getMessage.contains("active pull"), result.isEmpty)) + } + } + } + ) +} diff --git a/sdks/scala/model/src/test/scala/golem/schema/SchemaModelSpec.scala b/sdks/scala/model/src/test/scala/golem/schema/SchemaModelSpec.scala index bd7b3c3879..1f51f0bcad 100644 --- a/sdks/scala/model/src/test/scala/golem/schema/SchemaModelSpec.scala +++ b/sdks/scala/model/src/test/scala/golem/schema/SchemaModelSpec.scala @@ -498,6 +498,24 @@ object SchemaModelSpec extends ZIOSpecDefault { assert(res)(isFailure(isSubtype[SchemaDecodeError](anything))) && assertTrue(!h.isPresent) } ), + suite("schema value stream affine semantics")( + test("decoding rejects distinct wrappers for the same owned stream resource") { + val raw = new Object + val first = GuestSchemaValueStreamHandle.wrapped(raw, () => throw new AssertionError("must not unwrap")) + val second = GuestSchemaValueStreamHandle.wrapped(raw, () => throw new AssertionError("must not unwrap")) + val bad = WitSchemaValueTree( + Vector( + WitSchemaValueNode.TupleValue(Vector(1, 2)), + WitSchemaValueNode.StreamValue(first), + WitSchemaValueNode.StreamValue(second) + ), + 0 + ) + val res = Try(SchemaWire.schemaValueFromWit(bad)) + assert(res)(isFailure(isSubtype[SchemaDecodeError](anything))) && + assertTrue(!first.isPresent, !second.isPresent) + } + ), suite("GraphEncoder multi-root (agent carrier use case)")( test("encodes several roots into one shared pool with a placeholder finish root") { val g1 = SchemaBuilder.graphOf(b => t.list(b.register("ns.p", () => t.record(List(t.field("x", t.s32)))))) diff --git a/sdks/scala/wit/deps/golem-agent/guest.wit b/sdks/scala/wit/deps/golem-agent/guest.wit index dbe97ff310..d72413c288 100644 --- a/sdks/scala/wit/deps/golem-agent/guest.wit +++ b/sdks/scala/wit/deps/golem-agent/guest.wit @@ -15,8 +15,9 @@ interface guest { /// Invokes an agent. If create was not called before, it fails. /// /// `input` is a value tree whose root encodes the method's parameter list. - /// The result is `none` when the method's `output-schema` is `unit`, and - /// `some(value)` for a `single` output. + /// Streams are represented recursively by `stream-value` nodes. The result + /// is `none` when the method's `output-schema` is `unit`, and `some(value)` + /// for a `single` output. invoke: async func(method-name: string, input: schema-value-tree, principal: principal) -> result, agent-error>; /// Gets the agent type. If create was not called before, it fails diff --git a/sdks/scala/wit/deps/golem-core-v2/golem-core-v2.wit b/sdks/scala/wit/deps/golem-core-v2/golem-core-v2.wit index bb7dda191e..8a8dd02254 100644 --- a/sdks/scala/wit/deps/golem-core-v2/golem-core-v2.wit +++ b/sdks/scala/wit/deps/golem-core-v2/golem-core-v2.wit @@ -125,6 +125,17 @@ interface types { /// and reveal it only through capability-gated host interfaces. resource secret; + /// An affine wrapper around a native Component Model stream of schema + /// values. The indirection lets a stream occur anywhere in a recursive + /// `schema-value-tree` while preserving the native stream endpoint. + resource schema-value-stream { + /// Wraps any native schema-value reader for placement in a value tree. + wrap: static async func(reader: stream) -> own; + + /// Consumes a schema-value-stream wrapper and returns its native reader. + unwrap: static async func(value: own) -> stream; + } + // ============================================================ // Schema graph (self-contained type carrier) // ============================================================ @@ -524,8 +535,7 @@ interface types { // Capability nodes secret-value(own), quota-token-handle(own), - - // WASI P3 stubs (parseable only in the schema; no constructible values). + stream-value(own), } record variant-value-payload { @@ -584,4 +594,5 @@ interface types { graph: schema-graph, value: schema-value-tree, } + } diff --git a/sdks/scala/wit/dts/exports.d.ts b/sdks/scala/wit/dts/exports.d.ts index 43a1fceb18..76acf1861f 100644 --- a/sdks/scala/wit/dts/exports.d.ts +++ b/sdks/scala/wit/dts/exports.d.ts @@ -89,8 +89,9 @@ declare module 'agent-guest' { /** * Invokes an agent. If create was not called before, it fails. * `input` is a value tree whose root encodes the method's parameter list. - * The result is `none` when the method's `output-schema` is `unit`, and - * `some(value)` for a `single` output. + * Streams are represented recursively by `stream-value` nodes. The result + * is `none` when the method's `output-schema` is `unit`, and `some(value)` + * for a `single` output. * @throws AgentError */ export function invoke(methodName: string, input: SchemaValueTree, principal: Principal): Promise; diff --git a/sdks/scala/wit/dts/golem_core_2_0_0_types.d.ts b/sdks/scala/wit/dts/golem_core_2_0_0_types.d.ts index 23592a9b00..b5bfd0518c 100644 --- a/sdks/scala/wit/dts/golem_core_2_0_0_types.d.ts +++ b/sdks/scala/wit/dts/golem_core_2_0_0_types.d.ts @@ -12,6 +12,16 @@ declare module 'golem:core/types@2.0.0' { } export class Secret { } + export class SchemaValueStream { + /** + * Wraps any native schema-value reader for placement in a value tree. + */ + static wrap(reader: AsyncIterable): Promise; + /** + * Consumes a schema-value-stream wrapper and returns its native reader. + */ + static unwrap(value: SchemaValueStream): Promise>; + } /** * ============================================================ * Carrier indices @@ -751,6 +761,10 @@ declare module 'golem:core/types@2.0.0' { { tag: 'quota-token-handle' val: QuotaToken + } | + { + tag: 'stream-value' + val: SchemaValueStream }; /** * ============================================================ diff --git a/sdks/ts/packages/golem-ts-sdk/src/bridge/agent.ts b/sdks/ts/packages/golem-ts-sdk/src/bridge/agent.ts index a1cb60163d..fb56a184b6 100644 --- a/sdks/ts/packages/golem-ts-sdk/src/bridge/agent.ts +++ b/sdks/ts/packages/golem-ts-sdk/src/bridge/agent.ts @@ -14,6 +14,7 @@ import { awaitAbortable, throwIfAborted } from '../internal/pollableUtils'; import { schemaValueFromWit, schemaValueToWit, + schemaValueToWitAsync, typedSchemaValueToWit, type SchemaValue, type TypedSchemaValue, @@ -100,7 +101,7 @@ export function resolveRemoteAgent( signal?: AbortSignal, ): Promise => { throwIfAborted(signal); - const invocation = rpc.asyncInvokeAndAwait(method, schemaValueToWit(params)); + const invocation = rpc.asyncInvokeAndAwait(method, await schemaValueToWitAsync(params)); const future = invocation.future; let result; try { diff --git a/sdks/ts/packages/golem-ts-sdk/src/httpTypes.ts b/sdks/ts/packages/golem-ts-sdk/src/httpTypes.ts index ff15196b54..65dcf0c3fe 100644 --- a/sdks/ts/packages/golem-ts-sdk/src/httpTypes.ts +++ b/sdks/ts/packages/golem-ts-sdk/src/httpTypes.ts @@ -334,7 +334,8 @@ type NonBindableKind = | 'unstructured-binary' | 'result' | 'typed-array' - | 'principal'; + | 'principal' + | 'stream'; // A value is bindable unless it is a marker tagged with a non-bindable kind. // Plain schemas (Zod / Valibot / ArkType / Effect Schema) and scalar markers diff --git a/sdks/ts/packages/golem-ts-sdk/src/index.ts b/sdks/ts/packages/golem-ts-sdk/src/index.ts index 8c023fb5d1..26ebb0dbb3 100644 --- a/sdks/ts/packages/golem-ts-sdk/src/index.ts +++ b/sdks/ts/packages/golem-ts-sdk/src/index.ts @@ -78,6 +78,7 @@ export type { MethodsRecord, } from './defineAgent'; export { Secret } from './secret'; +export { AgentStream } from './schema/agentStream'; export { method } from './method'; export type { InputRecord, MethodSpec } from './method'; export type { StandardSchemaV1 } from './schema/standardSchema'; @@ -233,7 +234,6 @@ async function invokeAgent( if (!resolvedAgent) { throw createCustomError(`Failed to invoke method ${methodName}: agent is not initialized`); } - const result = await resolvedAgent.invoke(methodName, input, principal); if (result.tag === 'ok') { diff --git a/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/index.ts b/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/index.ts index 2a0377a852..72bf92f6eb 100644 --- a/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/index.ts +++ b/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/index.ts @@ -19,6 +19,7 @@ export * from './errors'; export * from './secretHandle'; export * from './quotaTokenHandle'; +export * from './schemaValueStreamHandle'; export * from './model'; export * from './builder'; export * from './wit'; diff --git a/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/model.ts b/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/model.ts index c7c646a7c0..67a3935223 100644 --- a/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/model.ts +++ b/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/model.ts @@ -44,6 +44,7 @@ import type { } from 'golem:core/types@2.0.0'; import { GuestSecretHandle } from './secretHandle'; import { GuestQuotaTokenHandle } from './quotaTokenHandle'; +import { GuestSchemaValueStreamHandle } from './schemaValueStreamHandle'; export type { TypeId, @@ -432,7 +433,8 @@ export type SchemaValue = | { tag: 'secret'; handle: GuestSecretHandle } // An opaque, affine owned `quota-token` handle. Carried by ownership; never // inspectable or forgeable from a guest. See `GuestQuotaTokenHandle`. - | { tag: 'quota-token'; handle: GuestQuotaTokenHandle }; + | { tag: 'quota-token'; handle: GuestQuotaTokenHandle } + | { tag: 'stream'; handle: GuestSchemaValueStreamHandle }; export interface SchemaMapEntry { key: SchemaValue; @@ -501,6 +503,7 @@ export const t = { secret: (inner: SchemaType, spec: Omit = {}): SchemaType => schemaType({ tag: 'secret', spec, inner }), quotaToken: (spec: QuotaTokenSpec): SchemaType => schemaType({ tag: 'quota-token', spec }), + stream: (element?: SchemaType): SchemaType => schemaType({ tag: 'stream', element }), }; /** Compact constructors for schema field/case helpers. */ @@ -564,6 +567,7 @@ export const v = { union: (unionTag: string, body: SchemaValue): SchemaValue => ({ tag: 'union', unionTag, body }), secret: (handle: GuestSecretHandle): SchemaValue => ({ tag: 'secret', handle }), quotaToken: (handle: GuestQuotaTokenHandle): SchemaValue => ({ tag: 'quota-token', handle }), + stream: (handle: GuestSchemaValueStreamHandle): SchemaValue => ({ tag: 'stream', handle }), }; /** Clone a schema value without duplicating affine capability handles. */ @@ -644,6 +648,8 @@ export function deepEqual(a: unknown, b: unknown): boolean { // two distinct handles would compare equal (both expose no enumerable state). if (a instanceof GuestSecretHandle || b instanceof GuestSecretHandle) return false; if (a instanceof GuestQuotaTokenHandle || b instanceof GuestQuotaTokenHandle) return false; + if (a instanceof GuestSchemaValueStreamHandle || b instanceof GuestSchemaValueStreamHandle) + return false; if (typeof a === 'bigint' || typeof b === 'bigint') return a === b; diff --git a/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/schemaValueStreamHandle.ts b/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/schemaValueStreamHandle.ts new file mode 100644 index 0000000000..1669e62372 --- /dev/null +++ b/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/schemaValueStreamHandle.ts @@ -0,0 +1,23 @@ +import type { SchemaValueStream, SchemaValueTree } from 'golem:core/types@2.0.0'; + +export type GuestSchemaValueStream = + | { kind: 'wrapped'; value: SchemaValueStream } + | { kind: 'native'; value: AsyncIterable }; + +export class GuestSchemaValueStreamHandle { + #value: GuestSchemaValueStream | undefined; + + constructor(value: GuestSchemaValueStream) { + this.#value = value; + } + + peek(): GuestSchemaValueStream | undefined { + return this.#value; + } + + take(): GuestSchemaValueStream | undefined { + const value = this.#value; + this.#value = undefined; + return value; + } +} diff --git a/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/wit.ts b/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/wit.ts index b333b82bf5..3bf43a4d86 100644 --- a/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/wit.ts +++ b/sdks/ts/packages/golem-ts-sdk/src/internal/schema-model/wit.ts @@ -33,6 +33,7 @@ import type { DefIndex, TypedSchemaValue as WitTypedSchemaValue, } from 'golem:core/types@2.0.0'; +import { SchemaValueStream } from 'golem:core/types@2.0.0'; import { type SchemaGraph, @@ -50,6 +51,7 @@ import { GuestSecretHandle } from './secretHandle'; import { SECRET_INTERNAL } from './secretInternal'; import { GuestQuotaTokenHandle } from './quotaTokenHandle'; import { QUOTA_INTERNAL } from './quotaInternal'; +import { GuestSchemaValueStreamHandle } from './schemaValueStreamHandle'; import { SchemaDecodeError, SchemaEncodeError } from './errors'; // ============================================================ @@ -505,7 +507,10 @@ function assertDenseModelArray(value: unknown, name: string): asserts value is u * underlying owned resource (peeked without consuming), not merely by holder * identity, so two holders that somehow wrap the same resource are also rejected. */ -export function assertSchemaValueRepresentable(value: SchemaValue): void { +export function assertSchemaValueRepresentable( + value: SchemaValue, + allowNativeStreams = false, +): void { const seen = new Set(); const visit = (v: SchemaValue): void => { switch (v.tag) { @@ -625,6 +630,23 @@ export function assertSchemaValueRepresentable(value: SchemaValue): void { seen.add(raw); return; } + case 'stream': { + if (!(v.handle instanceof GuestSchemaValueStreamHandle)) { + throw new SchemaEncodeError('stream value contains an invalid stream handle'); + } + const stream = v.handle.peek(); + if (stream === undefined) { + throw new SchemaEncodeError('schema value stream was already transferred'); + } + if (stream.kind === 'native' && !allowNativeStreams) { + throw new SchemaEncodeError('native schema value streams require asynchronous encoding'); + } + if (seen.has(stream.value)) { + throw new SchemaEncodeError('the same schema value stream appeared more than once'); + } + seen.add(stream.value); + return; + } case 'record': assertDenseModelArray(v.fields, 'record fields'); v.fields.forEach(visit); @@ -824,6 +846,16 @@ export function schemaValueToWit(value: SchemaValue): WitSchemaValueTree { } return { tag: 'quota-token-handle', val: raw }; } + case 'stream': { + const stream = v.handle.take(); + if (stream === undefined) { + throw new SchemaEncodeError('schema value stream was already transferred'); + } + if (stream.kind !== 'wrapped') { + throw new SchemaEncodeError('native schema value streams require asynchronous encoding'); + } + return { tag: 'stream-value', val: stream.value }; + } default: throw new SchemaEncodeError(`unknown schema value tag '${(v as { tag: string }).tag}'`); } @@ -833,6 +865,91 @@ export function schemaValueToWit(value: SchemaValue): WitSchemaValueTree { return { valueNodes, root }; } +export async function schemaValueToWitAsync(value: SchemaValue): Promise { + // This walk is deliberately complete and side-effect free. In particular, + // do not start wrapping an earlier stream until malformed, consumed, or + // aliased capabilities anywhere else in the tree have been rejected. + assertSchemaValueRepresentable(value, true); + + const newlyWrapped: Array<{ handle: GuestSchemaValueStreamHandle; value: unknown }> = []; + + async function prepare(current: SchemaValue): Promise { + switch (current.tag) { + case 'stream': { + const stream = current.handle.peek(); + if (stream === undefined) { + throw new SchemaEncodeError('schema value stream was already transferred'); + } + if (stream.kind === 'wrapped') return; + + // Capability movement is intentionally serialized. Besides preserving + // deterministic ownership, this avoids starting sibling wraps after an + // earlier wrap has already failed. + current.handle.take(); + const wrapped = await SchemaValueStream.wrap(stream.value); + current.handle = new GuestSchemaValueStreamHandle({ + kind: 'wrapped', + value: wrapped, + }); + newlyWrapped.push({ handle: current.handle, value: wrapped }); + return; + } + case 'record': { + for (const field of current.fields) await prepare(field); + return; + } + case 'tuple': + case 'list': + case 'fixed-list': { + for (const element of current.elements) await prepare(element); + return; + } + case 'variant': + if (current.payload !== undefined) await prepare(current.payload); + return; + case 'map': + for (const entry of current.entries) { + await prepare(entry.key); + await prepare(entry.value); + } + return; + case 'option': + if (current.value !== undefined) await prepare(current.value); + return; + case 'result': + if (current.result.value !== undefined) await prepare(current.result.value); + return; + case 'union': + await prepare(current.body); + return; + default: + return; + } + } + + try { + await prepare(value); + return schemaValueToWit(value); + } catch (error) { + // A successful wrap creates an owned WIT resource. If a subsequent wrap or + // the final flattening fails, none of those resources can be returned to + // the caller, so explicitly destroy every one that this invocation made. + for (let i = newlyWrapped.length - 1; i >= 0; i--) { + const wrapped = newlyWrapped[i]!; + wrapped.handle.take(); + const dispose = (wrapped.value as { [Symbol.dispose]?: () => void })[Symbol.dispose]; + if (dispose !== undefined) { + try { + dispose.call(wrapped.value); + } catch { + // Preserve the conversion failure while still attempting all cleanup. + } + } + } + throw error; + } +} + /** * Validate a flat value tree by reference without lifting or mutating handles. * For reachable nodes, this checks dense carrier payloads and the cross-node @@ -900,6 +1017,7 @@ export function preflightWitValueTree(nodes: WitSchemaValueNode[], root: ValueNo // Indices of `quota-token-handle` nodes already reached. An owned handle is // affine, so reaching one twice (e.g. via an aliased node) is rejected. const quotaReached = new Set(); + const streamReached = new Set(); // Identities of the underlying owned resources already seen, so two *distinct* // handle nodes that somehow carry the same raw resource are rejected too, not // only the same node reached twice. @@ -1094,6 +1212,21 @@ export function preflightWitValueTree(nodes: WitSchemaValueNode[], root: ValueNo quotaReached.add(idx); return; } + case 'stream-value': { + if (streamReached.has(idx)) { + throw new SchemaDecodeError('schema value stream referenced more than once'); + } + const raw = n.val; + if (raw === undefined) { + throw new SchemaDecodeError('schema value stream was already transferred'); + } + if (seenRaw.has(raw)) { + throw new SchemaDecodeError('the same schema value stream appeared more than once'); + } + seenRaw.add(raw); + streamReached.add(idx); + return; + } default: throw new SchemaDecodeError( `unknown schema value node tag '${(n as { tag: string }).tag}'`, @@ -1116,6 +1249,9 @@ export function preflightWitValueTree(nodes: WitSchemaValueNode[], root: ValueNo if (node.tag === 'quota-token-handle' && !quotaReached.has(i)) { throw new SchemaDecodeError(`quota-token handle not referenced from the root: ${i}`); } + if (node.tag === 'stream-value' && !streamReached.has(i)) { + throw new SchemaDecodeError(`schema value stream not referenced from the root: ${i}`); + } } } @@ -1287,6 +1423,17 @@ export function schemaValueFromWit(wit: WitSchemaValueTree): SchemaValue { (n as { val: unknown }).val = undefined; return { tag: 'quota-token', handle: GuestQuotaTokenHandle.fromRaw(QUOTA_INTERNAL, raw) }; } + case 'stream-value': { + const raw = n.val as typeof n.val | undefined; + if (raw === undefined) { + throw new SchemaDecodeError('schema value stream referenced more than once'); + } + (n as { val: unknown }).val = undefined; + return { + tag: 'stream', + handle: new GuestSchemaValueStreamHandle({ kind: 'wrapped', value: raw }), + }; + } default: throw new SchemaDecodeError( `unknown schema value node tag '${(n as { tag: string }).tag}'`, @@ -1320,16 +1467,19 @@ export function schemaValueFromWit(wit: WitSchemaValueTree): SchemaValue { } /** - * Clear every owned `quota-token` handle still present in `nodes` (i.e. not - * moved out during decode) and return the index of the first one found, or - * `undefined` if none remained. + * Clear every owned quota-token or schema-value-stream handle still present in + * `nodes` (i.e. not moved out during decode) and return the index of the first + * one found, or `undefined` if none remained. */ export function drainUnconsumedQuotaHandles(nodes: WitSchemaValueNode[]): number | undefined { let first: number | undefined; for (let i = 0; i < nodes.length; i++) { const node = nodes[i]; if (typeof node !== 'object' || node === null || Array.isArray(node)) continue; - if (node.tag === 'quota-token-handle' && (node as { val: unknown }).val !== undefined) { + if ( + (node.tag === 'quota-token-handle' || node.tag === 'stream-value') && + (node as { val: unknown }).val !== undefined + ) { if (first === undefined) first = i; (node as { val: unknown }).val = undefined; } diff --git a/sdks/ts/packages/golem-ts-sdk/src/runtime.ts b/sdks/ts/packages/golem-ts-sdk/src/runtime.ts index 1161103124..26f2040b71 100644 --- a/sdks/ts/packages/golem-ts-sdk/src/runtime.ts +++ b/sdks/ts/packages/golem-ts-sdk/src/runtime.ts @@ -38,7 +38,7 @@ import { SchemaGraph, SchemaValue, schemaValueFromWit, - schemaValueToWit, + schemaValueToWitAsync, } from './internal/schema-model'; import { AgentClassName } from './agentClassName'; import { AgentTypeRegistry } from './internal/registry/agentTypeRegistry'; @@ -544,7 +544,7 @@ class ResolvedAgentImpl { if (mc.output.tag === 'unit') { return { tag: 'ok', val: undefined }; } - return { tag: 'ok', val: schemaValueToWit(mc.output.codec.toValue(result)) }; + return { tag: 'ok', val: await schemaValueToWitAsync(mc.output.codec.toValue(result)) }; } catch (e) { return { tag: 'err', diff --git a/sdks/ts/packages/golem-ts-sdk/src/schema/agentStream.ts b/sdks/ts/packages/golem-ts-sdk/src/schema/agentStream.ts new file mode 100644 index 0000000000..6a6ad9fb39 --- /dev/null +++ b/sdks/ts/packages/golem-ts-sdk/src/schema/agentStream.ts @@ -0,0 +1,235 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { SchemaValueStream, type SchemaValueTree } from 'golem:core/types@2.0.0'; +import { + GuestSchemaValueStreamHandle, + type GuestSchemaValueStream, + schemaValueFromWit, + schemaValueToWitAsync, +} from '../internal/schema-model'; +import type { SchemaCodec } from './codec'; + +interface TypedStreamState { + readonly kind: 'typed'; + readonly source: AsyncIterable; + iterator?: AsyncIterator; + busy: boolean; +} + +interface WireStreamState { + readonly kind: 'wire'; + endpoint?: GuestSchemaValueStream; + iterator?: AsyncIterator; + readonly itemCodec: SchemaCodec; + busy: boolean; +} + +type AgentStreamState = TypedStreamState | WireStreamState; + +const states = new WeakMap>(); + +/** + * A demand-driven, single-reader stream that can recursively inhabit an agent + * method input or output value. + */ +export class AgentStream implements AsyncIterable, AsyncIterator { + private constructor() {} + + /** Create a stream from a synchronous or asynchronous iterable. */ + static from(source: Iterable | AsyncIterable): AgentStream { + return createAgentStream({ + kind: 'typed', + source: asAsyncIterable(source), + busy: false, + }); + } + + [Symbol.asyncIterator](): AsyncIterator { + return this; + } + + async next(): Promise> { + const state = streamState(this); + if (state.busy) { + throw new Error('an AgentStream operation is already in progress'); + } + state.busy = true; + try { + if (state.kind === 'typed') { + state.iterator ??= state.source[Symbol.asyncIterator](); + return await state.iterator.next(); + } + + const iterator = await wireIterator(state); + const item = await iterator.next(); + return item.done + ? { done: true, value: undefined } + : { + done: false, + value: state.itemCodec.fromValue(schemaValueFromWit(item.value)) as T, + }; + } finally { + state.busy = false; + } + } + + async return(value?: unknown): Promise> { + const state = streamState(this); + if (state.busy) { + throw new Error('an AgentStream operation is already in progress'); + } + state.busy = true; + try { + const iterator = + state.kind === 'typed' + ? (state.iterator ??= state.source[Symbol.asyncIterator]()) + : await wireIterator(state); + if (iterator.return) { + await iterator.return(value); + } + states.delete(this); + return { done: true, value: value as T }; + } finally { + state.busy = false; + } + } + + async throw(error?: unknown): Promise> { + const state = streamState(this); + if (state.busy) { + throw new Error('an AgentStream operation is already in progress'); + } + state.busy = true; + try { + const iterator = + state.kind === 'typed' + ? (state.iterator ??= state.source[Symbol.asyncIterator]()) + : await wireIterator(state); + states.delete(this); + if (iterator.throw) { + return (await iterator.throw(error)) as IteratorResult; + } + if (iterator.return) { + await iterator.return(); + } + throw error; + } finally { + state.busy = false; + } + } +} + +/** @internal Move an AgentStream into a recursive schema value. */ +export function agentStreamToHandle( + stream: AgentStream, + itemCodec: SchemaCodec, +): GuestSchemaValueStreamHandle { + const state = streamState(stream); + if (state.busy) { + throw new Error('cannot transfer an AgentStream while an operation is in progress'); + } + states.delete(stream); + + if (state.kind === 'wire') { + if (state.endpoint !== undefined) { + return new GuestSchemaValueStreamHandle(state.endpoint); + } + if (state.iterator !== undefined) { + return new GuestSchemaValueStreamHandle({ + kind: 'native', + value: iterableFromIterator(state.iterator), + }); + } + throw new Error('AgentStream was already transferred'); + } + + const source = state.iterator === undefined ? state.source : iterableFromIterator(state.iterator); + return new GuestSchemaValueStreamHandle({ + kind: 'native', + value: encodeItems(source, itemCodec), + }); +} + +/** @internal Lift a recursive schema-value-stream handle into an AgentStream. */ +export function agentStreamFromHandle( + handle: GuestSchemaValueStreamHandle, + itemCodec: SchemaCodec, +): AgentStream { + const endpoint = handle.take(); + if (endpoint === undefined) { + throw new Error('schema value stream was already transferred'); + } + return createAgentStream({ + kind: 'wire', + endpoint, + itemCodec, + busy: false, + }); +} + +function createAgentStream(state: AgentStreamState): AgentStream { + const stream = Object.create(AgentStream.prototype) as AgentStream; + states.set(stream, state as AgentStreamState); + return stream; +} + +function streamState(stream: AgentStream): AgentStreamState { + const state = states.get(stream) as AgentStreamState | undefined; + if (state === undefined) { + throw new Error('AgentStream was already transferred or closed'); + } + return state; +} + +async function wireIterator(state: WireStreamState): Promise> { + if (state.iterator !== undefined) { + return state.iterator; + } + const endpoint = state.endpoint; + if (endpoint === undefined) { + throw new Error('AgentStream was already transferred'); + } + state.endpoint = undefined; + const source = + endpoint.kind === 'native' ? endpoint.value : await SchemaValueStream.unwrap(endpoint.value); + state.iterator = source[Symbol.asyncIterator](); + return state.iterator; +} + +function asAsyncIterable(source: Iterable | AsyncIterable): AsyncIterable { + if (Symbol.asyncIterator in Object(source)) { + return source as AsyncIterable; + } + return { + async *[Symbol.asyncIterator]() { + yield* source as Iterable; + }, + }; +} + +function iterableFromIterator(iterator: AsyncIterator): AsyncIterable { + return { + [Symbol.asyncIterator]: () => iterator, + }; +} + +async function* encodeItems( + source: AsyncIterable, + itemCodec: SchemaCodec, +): AsyncIterable { + for await (const item of source) { + yield await schemaValueToWitAsync(itemCodec.toValue(item)); + } +} diff --git a/sdks/ts/packages/golem-ts-sdk/src/schema/markers.ts b/sdks/ts/packages/golem-ts-sdk/src/schema/markers.ts index 44d3dff322..384e5db283 100644 --- a/sdks/ts/packages/golem-ts-sdk/src/schema/markers.ts +++ b/sdks/ts/packages/golem-ts-sdk/src/schema/markers.ts @@ -60,6 +60,7 @@ import { buildResultCodec } from './result'; import { StandardSchemaV1 } from './standardSchema'; import { Result } from '../host/result'; import { Principal, sdkPrincipalToHost, sdkPrincipalFromHost } from '../principal'; +import { AgentStream, agentStreamFromHandle, agentStreamToHandle } from './agentStream'; import type { Principal as HostPrincipal, OidcPrincipal as HostOidcPrincipal, @@ -97,7 +98,8 @@ export type MarkerKind = | 'secret' | 'result' | 'typed-array' - | 'principal'; + | 'principal' + | 'stream'; /** Pure phantom key carrying a marker's {@link MarkerKind} at the type level. */ declare const MARKER_KIND: unique symbol; @@ -723,6 +725,31 @@ function quotaTokenMarker(): MarkerSchema { return marker(validate, descriptor); } +// ============================================================ +// Capability node: stream +// ============================================================ + +function streamMarker( + inner: StandardSchemaV1, +): MarkerSchema, 'stream'> { + const validate: Validator> = (value) => + value instanceof AgentStream ? ok(value) : fail('Expected an AgentStream'); + const descriptor: MarkerDescriptor = (recurse) => { + const itemCodec = recurse(inner); + return { + graph: { defs: itemCodec.graph.defs, root: t.stream(itemCodec.graph.root) }, + toValue: (value) => v.stream(agentStreamToHandle(value as AgentStream, itemCodec)), + fromValue: (value) => { + if (value.tag !== 'stream') { + throw new TypeError(`Expected a stream schema value, got '${value.tag}'`); + } + return agentStreamFromHandle(value.handle, itemCodec); + }, + }; + }; + return marker, 'stream'>(validate, descriptor); +} + // ============================================================ // Rich nodes: unstructured text / binary // ============================================================ @@ -1127,7 +1154,8 @@ function principalMarker(): MarkerSchema { * its own: numeric pins, `char`, `datetime`, `duration`, `url`, `bytes`, plus * the capability / rich nodes (`secret`, `quota-token`, `multimodal`, * `unstructured*`). Each returns a {@link MarkerSchema} usable anywhere a - * Standard Schema is accepted (method params/returns, `id` fields). + * Standard Schema is accepted; `stream` is restricted to agent method inputs + * and outputs by the agent schema validator. */ export const s = { // Numeric pins (f64 is the default `number`, so it is intentionally absent). @@ -1174,6 +1202,7 @@ export const s = { // Capability wrappers / nodes. secret: (inner: StandardSchemaV1) => secretMarker(inner), quotaToken: () => quotaTokenMarker(), + stream: (inner: StandardSchemaV1) => streamMarker(inner), // Principal carried as a data value (WIT `principal` variant). principal: () => principalMarker(), diff --git a/sdks/ts/packages/golem-ts-sdk/tests/bridge.test.ts b/sdks/ts/packages/golem-ts-sdk/tests/bridge.test.ts index 0256487232..6eb8f39661 100644 --- a/sdks/ts/packages/golem-ts-sdk/tests/bridge.test.ts +++ b/sdks/ts/packages/golem-ts-sdk/tests/bridge.test.ts @@ -5,7 +5,7 @@ import { WasmRpc } from 'golem:agent/host@2.0.0'; import { ToolRpc, type RpcError } from 'golem:tool/host@0.1.0'; import { describe, expect, it, vi } from 'vitest'; import { bridge } from '../src'; -import { validateSchemaGraph } from '../src/internal/schema-model'; +import { GuestSchemaValueStreamHandle, validateSchemaGraph } from '../src/internal/schema-model'; const schemaGraphFromObject = (value: unknown) => bridge.schemaGraphFromJson(JSON.stringify(value)); @@ -719,6 +719,57 @@ describe('public bridge runtime', () => { await expect(remote.invokeAndAwait('ping', bridge.v.tuple([]))).resolves.toBeUndefined(); }); + it('passes a recursively nested native stream to an awaited agent invocation', async () => { + const remote = bridge.resolveRemoteAgent('Example', bridge.v.tuple([])); + const rpc = vi.mocked(WasmRpc).mock.results.at(-1)!.value as { + asyncInvokeAndAwait: ReturnType; + }; + rpc.asyncInvokeAndAwait.mockReturnValue({ + metadata: { agentId: 'example', idempotencyKey: 'key' }, + future: { + get: vi.fn().mockResolvedValue(undefined), + cancel: vi.fn(), + }, + }); + const source = (async function* () {})(); + const params = bridge.v.record([ + bridge.v.option( + bridge.v.list([ + bridge.v.stream(new GuestSchemaValueStreamHandle({ kind: 'native', value: source })), + ]), + ), + ]); + + await remote.invokeAndAwait('consume', params); + + const tree = rpc.asyncInvokeAndAwait.mock.calls[0][1]; + const streamNode = tree.valueNodes.find((node: { tag: string }) => node.tag === 'stream-value'); + expect(streamNode).toMatchObject({ tag: 'stream-value' }); + expect(streamNode.val).toMatchObject({ reader: source }); + }); + + it.each(['invoke', 'schedule'] as const)( + 'rejects native streams at the non-awaited %s boundary', + (boundary) => { + const remote = bridge.resolveRemoteAgent('Example', bridge.v.tuple([])); + const rpc = vi.mocked(WasmRpc).mock.results.at(-1)!.value as { + invoke: ReturnType; + scheduleInvocation: ReturnType; + }; + const source = (async function* () {})(); + const params = bridge.v.option( + bridge.v.stream(new GuestSchemaValueStreamHandle({ kind: 'native', value: source })), + ); + + expect(() => { + if (boundary === 'invoke') remote.invoke('consume', params); + else remote.schedule({ seconds: 1n, nanoseconds: 0 }, 'consume', params); + }).toThrow('native schema value streams require asynchronous encoding'); + expect(rpc.invoke).not.toHaveBeenCalled(); + expect(rpc.scheduleInvocation).not.toHaveBeenCalled(); + }, + ); + it('cancels an agent future when the caller aborts', async () => { const remote = bridge.resolveRemoteAgent('Example', bridge.v.tuple([])); const rpc = vi.mocked(WasmRpc).mock.results.at(-1)!.value as { @@ -736,6 +787,7 @@ describe('public bridge runtime', () => { }); const invocation = remote.invokeAndAwait('ping', bridge.v.tuple([]), controller.signal); + await vi.waitFor(() => expect(get).toHaveBeenCalledOnce()); controller.abort(new Error('cancelled by caller')); await expect(invocation).rejects.toThrow('cancelled by caller'); diff --git a/sdks/ts/packages/golem-ts-sdk/tests/schema-model/errors.test.ts b/sdks/ts/packages/golem-ts-sdk/tests/schema-model/errors.test.ts index 3db4c26663..ceb9fbe257 100644 --- a/sdks/ts/packages/golem-ts-sdk/tests/schema-model/errors.test.ts +++ b/sdks/ts/packages/golem-ts-sdk/tests/schema-model/errors.test.ts @@ -182,6 +182,9 @@ describe('schema value decode failures', () => { 'quota-token-handle': { valid: () => ({ tag: 'quota-token-handle', val: {} as never }), }, + 'stream-value': { + valid: () => ({ tag: 'stream-value', val: {} as never }), + }, } satisfies Record; for (const [tag, testCase] of Object.entries(cases)) { diff --git a/sdks/ts/packages/golem-ts-sdk/tests/schema-value-stream.test.ts b/sdks/ts/packages/golem-ts-sdk/tests/schema-value-stream.test.ts new file mode 100644 index 0000000000..f28be7bf2f --- /dev/null +++ b/sdks/ts/packages/golem-ts-sdk/tests/schema-value-stream.test.ts @@ -0,0 +1,197 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { describe, expect, it } from 'vitest'; +import type { SchemaValueStream, SchemaValueTree } from 'golem:core/types@2.0.0'; +import { AgentStream } from '../src/schema/agentStream'; +import { compileSchema } from '../src/schema/adapter'; +import { s } from '../src/schema/markers'; +import { Result } from '../src/host/result'; +import { + GuestSchemaValueStreamHandle, + schemaValueFromWit, + schemaValueToWitAsync, + v, +} from '../src/internal/schema-model'; + +function streamNode( + tree: SchemaValueTree, +): Extract { + return tree.valueNodes[tree.root] as Extract< + SchemaValueTree['valueNodes'][number], + { tag: 'stream-value' } + >; +} + +describe('schema-native AgentStream', () => { + it('compiles a stream marker with its recursive item schema', () => { + const codec = compileSchema(s.stream(s.u32())); + expect(codec.graph.root.body).toMatchObject({ + tag: 'stream', + element: { body: { tag: 'u32' } }, + }); + }); + + it('does not pull a producer while encoding the enclosing value', async () => { + let pulls = 0; + const source = AgentStream.from( + (async function* () { + pulls += 1; + yield 11; + })(), + ); + const codec = compileSchema(s.stream(s.u32())); + + const tree = await schemaValueToWitAsync(codec.toValue(source)); + expect(pulls).toBe(0); + + const decoded = codec.fromValue(schemaValueFromWit(tree)) as AgentStream; + expect(await decoded.next()).toEqual({ done: false, value: 11 }); + expect(pulls).toBe(1); + }); + + it('preflights invalid siblings before moving a stream', async () => { + const handle = nativeHandle(); + const value = v.tuple([v.stream(handle), v.u32(-1)]); + + await expect(schemaValueToWitAsync(value)).rejects.toThrow('u32 value out of range'); + expect(handle.peek()).toBeDefined(); + }); + + it('preflights invalid nested values before moving an outer sibling stream', async () => { + const handle = nativeHandle(); + const value = v.record([v.stream(handle), v.option(v.list([v.u32(0x1_0000_0000)]))]); + + await expect(schemaValueToWitAsync(value)).rejects.toThrow('u32 value out of range'); + expect(handle.peek()).toBeDefined(); + }); + + it('rejects aliased stream handles before moving either sibling', async () => { + const handle = nativeHandle(); + const value = v.tuple([v.stream(handle), v.stream(handle)]); + + await expect(schemaValueToWitAsync(value)).rejects.toThrow( + 'the same schema value stream appeared more than once', + ); + expect(handle.peek()).toBeDefined(); + }); + + it('rejects a consumed nested stream before moving its sibling', async () => { + const sibling = nativeHandle(); + const consumed = nativeHandle(); + consumed.take(); + const value = v.tuple([v.stream(sibling), v.option(v.stream(consumed))]); + + await expect(schemaValueToWitAsync(value)).rejects.toThrow( + 'schema value stream was already transferred', + ); + expect(sibling.peek()).toBeDefined(); + }); + + it('disposes resources wrapped before a later sequential wrap fails', async () => { + let disposed = 0; + const firstSource = Object.assign(emptyWireStream(), { + onDispose: () => { + disposed += 1; + }, + }); + const failingSource = Object.assign(emptyWireStream(), { failWrap: true }); + const first = new GuestSchemaValueStreamHandle({ kind: 'native', value: firstSource }); + const failing = new GuestSchemaValueStreamHandle({ kind: 'native', value: failingSource }); + + await expect( + schemaValueToWitAsync(v.tuple([v.stream(first), v.stream(failing)])), + ).rejects.toThrow('test schema value stream wrap failure'); + expect(disposed).toBe(1); + expect(first.peek()).toBeUndefined(); + }); + + it('passes an unread wrapped stream through without replacing it', async () => { + const raw = { reader: emptyWireStream() } as unknown as SchemaValueStream; + const codec = compileSchema(s.stream(s.u32())); + const received = codec.fromValue( + schemaValueFromWit({ valueNodes: [{ tag: 'stream-value', val: raw }], root: 0 }), + ) as AgentStream; + + const encoded = await schemaValueToWitAsync(codec.toValue(received)); + expect(streamNode(encoded).val).toBe(raw); + }); + + it('reassociates the same reader after partial consumption', async () => { + let pulls = 0; + const itemCodec = compileSchema(s.u32()); + const original = (async function* (): AsyncIterable { + for (const value of [1, 2, 3]) { + pulls += 1; + yield await schemaValueToWitAsync(itemCodec.toValue(value)); + } + })(); + const raw = { reader: original } as unknown as SchemaValueStream; + const streamCodec = compileSchema(s.stream(s.u32())); + const stream = streamCodec.fromValue( + schemaValueFromWit({ valueNodes: [{ tag: 'stream-value', val: raw }], root: 0 }), + ) as AgentStream; + + expect(await stream.next()).toEqual({ done: false, value: 1 }); + expect(pulls).toBe(1); + + const remainderTree = await schemaValueToWitAsync(streamCodec.toValue(stream)); + expect(pulls).toBe(1); + const remainder = streamCodec.fromValue( + schemaValueFromWit(remainderTree), + ) as AgentStream; + expect(await remainder.next()).toEqual({ done: false, value: 2 }); + expect(await remainder.next()).toEqual({ done: false, value: 3 }); + expect(pulls).toBe(3); + }); + + it('supports streams nested in another schema value', async () => { + const codec = compileSchema(s.result(s.stream(s.u32()), s.stream(s.u32()))); + const source = AgentStream.from([4, 5]); + const result = Result.ok(source); + const tree = await schemaValueToWitAsync(codec.toValue(result)); + const decoded = codec.fromValue(schemaValueFromWit(tree)) as { + readonly tag: 'ok'; + readonly val: AgentStream; + }; + expect(await decoded.val.next()).toEqual({ done: false, value: 4 }); + expect(await decoded.val.next()).toEqual({ done: false, value: 5 }); + }); + + it('forwards iterator return to cancel an active producer', async () => { + let pulls = 0; + let cancelled = false; + const stream = AgentStream.from( + (async function* () { + try { + pulls += 1; + yield 1; + } finally { + cancelled = true; + } + })(), + ); + + expect(await stream.next()).toEqual({ done: false, value: 1 }); + await stream.return(); + expect(pulls).toBe(1); + expect(cancelled).toBe(true); + }); +}); + +async function* emptyWireStream(): AsyncIterable {} + +function nativeHandle(): GuestSchemaValueStreamHandle { + return new GuestSchemaValueStreamHandle({ kind: 'native', value: emptyWireStream() }); +} diff --git a/sdks/ts/packages/golem-ts-sdk/tests/testSetup.ts b/sdks/ts/packages/golem-ts-sdk/tests/testSetup.ts index d1a5b584d2..579d234e7e 100644 --- a/sdks/ts/packages/golem-ts-sdk/tests/testSetup.ts +++ b/sdks/ts/packages/golem-ts-sdk/tests/testSetup.ts @@ -74,6 +74,15 @@ vi.mock('golem:tool/host@0.1.0', () => ({ })); vi.mock('golem:core/types@2.0.0', () => ({ + SchemaValueStream: { + unwrap: async (value: { reader: AsyncIterable }) => value.reader, + wrap: async ( + reader: AsyncIterable & { failWrap?: boolean; onDispose?: () => void }, + ) => { + if (reader.failWrap) throw new Error('test schema value stream wrap failure'); + return { reader, [Symbol.dispose]: () => reader.onDispose?.() }; + }, + }, parseUuid: (uuid: string) => { const parts = uuid.replace(/-/g, ''); return { diff --git a/sdks/ts/packages/golem-ts-sdk/types/exports.d.ts b/sdks/ts/packages/golem-ts-sdk/types/exports.d.ts index 43a1fceb18..76acf1861f 100644 --- a/sdks/ts/packages/golem-ts-sdk/types/exports.d.ts +++ b/sdks/ts/packages/golem-ts-sdk/types/exports.d.ts @@ -89,8 +89,9 @@ declare module 'agent-guest' { /** * Invokes an agent. If create was not called before, it fails. * `input` is a value tree whose root encodes the method's parameter list. - * The result is `none` when the method's `output-schema` is `unit`, and - * `some(value)` for a `single` output. + * Streams are represented recursively by `stream-value` nodes. The result + * is `none` when the method's `output-schema` is `unit`, and `some(value)` + * for a `single` output. * @throws AgentError */ export function invoke(methodName: string, input: SchemaValueTree, principal: Principal): Promise; diff --git a/sdks/ts/packages/golem-ts-sdk/types/golem_core_2_0_0_types.d.ts b/sdks/ts/packages/golem-ts-sdk/types/golem_core_2_0_0_types.d.ts index 23592a9b00..b5bfd0518c 100644 --- a/sdks/ts/packages/golem-ts-sdk/types/golem_core_2_0_0_types.d.ts +++ b/sdks/ts/packages/golem-ts-sdk/types/golem_core_2_0_0_types.d.ts @@ -12,6 +12,16 @@ declare module 'golem:core/types@2.0.0' { } export class Secret { } + export class SchemaValueStream { + /** + * Wraps any native schema-value reader for placement in a value tree. + */ + static wrap(reader: AsyncIterable): Promise; + /** + * Consumes a schema-value-stream wrapper and returns its native reader. + */ + static unwrap(value: SchemaValueStream): Promise>; + } /** * ============================================================ * Carrier indices @@ -751,6 +761,10 @@ declare module 'golem:core/types@2.0.0' { { tag: 'quota-token-handle' val: QuotaToken + } | + { + tag: 'stream-value' + val: SchemaValueStream }; /** * ============================================================ diff --git a/sdks/ts/wit/deps/golem-agent/guest.wit b/sdks/ts/wit/deps/golem-agent/guest.wit index dbe97ff310..d72413c288 100644 --- a/sdks/ts/wit/deps/golem-agent/guest.wit +++ b/sdks/ts/wit/deps/golem-agent/guest.wit @@ -15,8 +15,9 @@ interface guest { /// Invokes an agent. If create was not called before, it fails. /// /// `input` is a value tree whose root encodes the method's parameter list. - /// The result is `none` when the method's `output-schema` is `unit`, and - /// `some(value)` for a `single` output. + /// Streams are represented recursively by `stream-value` nodes. The result + /// is `none` when the method's `output-schema` is `unit`, and `some(value)` + /// for a `single` output. invoke: async func(method-name: string, input: schema-value-tree, principal: principal) -> result, agent-error>; /// Gets the agent type. If create was not called before, it fails diff --git a/sdks/ts/wit/deps/golem-core-v2/golem-core-v2.wit b/sdks/ts/wit/deps/golem-core-v2/golem-core-v2.wit index bb7dda191e..8a8dd02254 100644 --- a/sdks/ts/wit/deps/golem-core-v2/golem-core-v2.wit +++ b/sdks/ts/wit/deps/golem-core-v2/golem-core-v2.wit @@ -125,6 +125,17 @@ interface types { /// and reveal it only through capability-gated host interfaces. resource secret; + /// An affine wrapper around a native Component Model stream of schema + /// values. The indirection lets a stream occur anywhere in a recursive + /// `schema-value-tree` while preserving the native stream endpoint. + resource schema-value-stream { + /// Wraps any native schema-value reader for placement in a value tree. + wrap: static async func(reader: stream) -> own; + + /// Consumes a schema-value-stream wrapper and returns its native reader. + unwrap: static async func(value: own) -> stream; + } + // ============================================================ // Schema graph (self-contained type carrier) // ============================================================ @@ -524,8 +535,7 @@ interface types { // Capability nodes secret-value(own), quota-token-handle(own), - - // WASI P3 stubs (parseable only in the schema; no constructible values). + stream-value(own), } record variant-value-payload { @@ -584,4 +594,5 @@ interface types { graph: schema-graph, value: schema-value-tree, } + } diff --git a/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.lock b/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.lock index c53529fbf8..3f5c84ce71 100644 --- a/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.lock +++ b/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.lock @@ -26,6 +26,18 @@ version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + [[package]] name = "async-trait" version = "0.1.91" @@ -78,6 +90,21 @@ version = "2.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" +[[package]] +name = "blake3" +version = "1.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ae7bad254120e9e4c63bafc385310756f90c484eac0e36b8317cf09cb92a77" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "cpufeatures", + "rayon-core", +] + [[package]] name = "bumpalo" version = "3.20.3" @@ -130,12 +157,52 @@ dependencies = [ "memchr", ] +[[package]] +name = "constant_time_eq" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" + [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5181e0de7b61eb03a81e347d6dd8797bae9da5146707b51077e2d71a54ec0ceb" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d6914041f254d6e9176c01941b21115dcfb7089e55135a35411081bd106ef3f" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" + [[package]] name = "ctor" version = "0.4.3" @@ -395,6 +462,7 @@ dependencies = [ "base64", "bigdecimal", "bit-vec", + "blake3", "chrono", "combine", "golem-schema-derive", @@ -823,6 +891,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "regex" version = "1.13.1" diff --git a/test-components/agent-rpc/golem-it-agent-rpc-rust/src/lib.rs b/test-components/agent-rpc/golem-it-agent-rpc-rust/src/lib.rs index e559b77114..89aeb2a789 100644 --- a/test-components/agent-rpc/golem-it-agent-rpc-rust/src/lib.rs +++ b/test-components/agent-rpc/golem-it-agent-rpc-rust/src/lib.rs @@ -1,3 +1,4 @@ +use golem_rust::agentic::{AgentStream, spawn_local}; use golem_rust::bindings::golem::agent::host::{Datetime, RpcError, WasmRpc}; use golem_rust::{ FromSchema, IntoSchema, PromiseId, SchemaValue, Uuid, agent_definition, agent_implementation, @@ -223,6 +224,275 @@ impl ScheduledInvocationClient for ScheduledInvocationClientImpl { } } +fn agent_stream(values: Vec) -> AgentStream { + let (mut writer, stream) = AgentStream::new(); + spawn_local(async move { + let _ = writer.write_all(values).await; + }); + stream +} + +#[derive(IntoSchema, FromSchema)] +pub struct NestedStreamInput { + pub labels: AgentStream, + pub values: Option>, +} + +#[derive(IntoSchema, FromSchema)] +pub struct NestedStreamItem { + pub label: String, + pub values: AgentStream, +} + +#[derive(Debug, Clone, IntoSchema, FromSchema)] +pub struct StreamingRpcReport { + pub input_only: Vec, + pub output_only: Vec, + pub simultaneous: Vec, + pub nested_labels: Vec, + pub nested_values: Vec, + pub nested_item_labels: Vec, + pub nested_item_values: Vec>, + pub first_sibling: Vec, + pub second_sibling: Vec, + pub after_consumer_drop: u64, +} + +#[agent_definition] +pub trait StreamingRpcTarget { + fn new(name: String) -> Self; + + async fn consume(&self, input: AgentStream) -> Vec; + fn produce(&self, values: Vec) -> AgentStream; + fn transform(&self, input: AgentStream) -> AgentStream; + async fn consume_nested(&self, input: NestedStreamInput) -> (Vec, Vec); + fn produce_nested_items(&self) -> AgentStream; + fn produce_siblings(&self) -> (AgentStream, AgentStream); + fn produce_error(&self) -> AgentStream; + fn ping(&self) -> u64; + fn increment_scalar(&mut self) -> u64; +} + +struct StreamingRpcTargetImpl { + _name: String, + scalar: u64, +} + +#[agent_implementation] +impl StreamingRpcTarget for StreamingRpcTargetImpl { + fn new(name: String) -> Self { + Self { + _name: name, + scalar: 0, + } + } + + async fn consume(&self, input: AgentStream) -> Vec { + input + .collect() + .await + .expect("failed to consume input stream") + } + + fn produce(&self, values: Vec) -> AgentStream { + agent_stream(values) + } + + fn transform(&self, mut input: AgentStream) -> AgentStream { + let (mut writer, output) = AgentStream::new(); + spawn_local(async move { + while let Some(value) = input + .next() + .await + .expect("failed to consume transform input") + { + writer + .write_one(value * 10) + .await + .expect("failed to write transformed value"); + } + }); + output + } + + async fn consume_nested(&self, input: NestedStreamInput) -> (Vec, Vec) { + let labels = input + .labels + .collect() + .await + .expect("failed to consume nested labels"); + let values = match input.values { + Some(values) => values + .collect() + .await + .expect("failed to consume nested values"), + None => Vec::new(), + }; + (labels, values) + } + + fn produce_nested_items(&self) -> AgentStream { + let (mut writer, output) = AgentStream::new(); + spawn_local(async move { + writer + .write_one(NestedStreamItem { + label: "first".to_string(), + values: agent_stream(vec![1, 2]), + }) + .await + .expect("failed to write first nested stream item"); + writer + .write_one(NestedStreamItem { + label: "second".to_string(), + values: agent_stream(vec![3, 4, 5]), + }) + .await + .expect("failed to write second nested stream item"); + }); + output + } + + fn produce_siblings(&self) -> (AgentStream, AgentStream) { + ( + agent_stream(vec!["a".to_string(), "b".to_string()]), + agent_stream((0..64).collect()), + ) + } + + fn produce_error(&self) -> AgentStream { + let (mut writer, output) = golem_rust::schema::wit::new_schema_value_stream(); + spawn_local(async move { + let first = encode_schema_value(&SchemaValue::U32(1)) + .expect("failed to encode value before producer error"); + assert!(writer.write_one(first).await.is_none()); + assert!( + writer + .write_one(golem_rust::schema::wit::wire::SchemaValueTree { + value_nodes: Vec::new(), + root: 0, + }) + .await + .is_none() + ); + }); + AgentStream::from_raw(output) + } + + fn ping(&self) -> u64 { + 42 + } + + fn increment_scalar(&mut self) -> u64 { + self.scalar += 1; + self.scalar + } +} + +#[agent_definition] +pub trait StreamingRpcCaller { + fn new(name: String) -> Self; + + async fn run(&self) -> StreamingRpcReport; + async fn call_producer_error(&self) -> Vec; + async fn call_stream_free(&self) -> u64; +} + +struct StreamingRpcCallerImpl { + name: String, +} + +#[agent_implementation] +impl StreamingRpcCaller for StreamingRpcCallerImpl { + fn new(name: String) -> Self { + Self { name } + } + + async fn run(&self) -> StreamingRpcReport { + let mut target = StreamingRpcTargetClient::get(self.name.clone()); + + let input_only = target.consume(agent_stream(vec![1, 2, 3])).await; + let output_only = target + .produce(vec![4, 5, 6]) + .await + .collect() + .await + .expect("failed to consume output-only stream"); + let simultaneous = target + .transform(agent_stream(vec![7, 8, 9])) + .await + .collect() + .await + .expect("failed to consume simultaneous input/output stream"); + + let (nested_labels, nested_values) = target + .consume_nested(NestedStreamInput { + labels: agent_stream(vec!["left".to_string(), "right".to_string()]), + values: Some(agent_stream(vec![10, 11])), + }) + .await; + + let mut nested_items = target.produce_nested_items().await; + let mut nested_item_labels = Vec::new(); + let mut nested_item_values = Vec::new(); + while let Some(item) = nested_items + .next() + .await + .expect("failed to consume outer nested-item stream") + { + nested_item_labels.push(item.label); + nested_item_values.push( + item.values + .collect() + .await + .expect("failed to consume stream inside streamed item"), + ); + } + + let (first, second) = target.produce_siblings().await; + let first_sibling = first + .collect() + .await + .expect("failed to consume first sibling stream"); + let second_sibling = second + .collect() + .await + .expect("failed to consume second sibling stream"); + + let mut dropped = target.produce(vec![20, 21, 22]).await; + assert_eq!(dropped.next().await.unwrap(), Some(20)); + drop(dropped); + let after_consumer_drop = target.ping().await; + + StreamingRpcReport { + input_only, + output_only, + simultaneous, + nested_labels, + nested_values, + nested_item_labels, + nested_item_values, + first_sibling, + second_sibling, + after_consumer_drop, + } + } + + async fn call_producer_error(&self) -> Vec { + let mut target = StreamingRpcTargetClient::get(self.name.clone()); + target + .produce_error() + .await + .collect() + .await + .expect("producer stream must fail") + } + + async fn call_stream_free(&self) -> u64 { + let mut target = StreamingRpcTargetClient::get(self.name.clone()); + target.increment_scalar().await + } +} + // -- RPC test agents (replacing old caller/counters components) -- #[agent_definition] diff --git a/test-components/agent-rpc/golem.yaml b/test-components/agent-rpc/golem.yaml index 273c023d9f..8bfc33cb84 100644 --- a/test-components/agent-rpc/golem.yaml +++ b/test-components/agent-rpc/golem.yaml @@ -1,7 +1,7 @@ # Schema for IDEA: -# $schema: https://schema.golem.cloud/app/golem/1.6.0-dev.6/golem.schema.json +# $schema: https://schema.golem.cloud/app/golem/1.6.0-dev.7/golem.schema.json # Schema for vscode-yaml: -# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.6.0-dev.6/golem.schema.json +# yaml-language-server: $schema=https://schema.golem.cloud/app/golem/1.6.0-dev.7/golem.schema.json # See https://learn.golem.cloud/docs/app-manifest#field-reference for field reference # For creating APIs see https://learn.golem.cloud/invoke/making-custom-apis diff --git a/test-components/agent-rpc/package-lock.json b/test-components/agent-rpc/package-lock.json index 607ff390c4..74e91fe2f2 100644 --- a/test-components/agent-rpc/package-lock.json +++ b/test-components/agent-rpc/package-lock.json @@ -652,7 +652,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -687,7 +686,6 @@ "integrity": "sha512-MHngMYwGJVi6Fmnk6ISmnk7JAHRNF0UkuucA0CUW3N3a4KnONPEZz+vUanQP/ZC/iY1Qkf3bwPWzyY84wEks1g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -742,8 +740,7 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, - "license": "0BSD", - "peer": true + "license": "0BSD" }, "node_modules/typescript": { "version": "5.9.3", @@ -751,7 +748,6 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/wit/deps/golem-agent/guest.wit b/wit/deps/golem-agent/guest.wit index dbe97ff310..d72413c288 100644 --- a/wit/deps/golem-agent/guest.wit +++ b/wit/deps/golem-agent/guest.wit @@ -15,8 +15,9 @@ interface guest { /// Invokes an agent. If create was not called before, it fails. /// /// `input` is a value tree whose root encodes the method's parameter list. - /// The result is `none` when the method's `output-schema` is `unit`, and - /// `some(value)` for a `single` output. + /// Streams are represented recursively by `stream-value` nodes. The result + /// is `none` when the method's `output-schema` is `unit`, and `some(value)` + /// for a `single` output. invoke: async func(method-name: string, input: schema-value-tree, principal: principal) -> result, agent-error>; /// Gets the agent type. If create was not called before, it fails diff --git a/wit/deps/golem-core-v2/golem-core-v2.wit b/wit/deps/golem-core-v2/golem-core-v2.wit index bb7dda191e..8a8dd02254 100644 --- a/wit/deps/golem-core-v2/golem-core-v2.wit +++ b/wit/deps/golem-core-v2/golem-core-v2.wit @@ -125,6 +125,17 @@ interface types { /// and reveal it only through capability-gated host interfaces. resource secret; + /// An affine wrapper around a native Component Model stream of schema + /// values. The indirection lets a stream occur anywhere in a recursive + /// `schema-value-tree` while preserving the native stream endpoint. + resource schema-value-stream { + /// Wraps any native schema-value reader for placement in a value tree. + wrap: static async func(reader: stream) -> own; + + /// Consumes a schema-value-stream wrapper and returns its native reader. + unwrap: static async func(value: own) -> stream; + } + // ============================================================ // Schema graph (self-contained type carrier) // ============================================================ @@ -524,8 +535,7 @@ interface types { // Capability nodes secret-value(own), quota-token-handle(own), - - // WASI P3 stubs (parseable only in the schema; no constructible values). + stream-value(own), } record variant-value-payload { @@ -584,4 +594,5 @@ interface types { graph: schema-graph, value: schema-value-tree, } + } From b81b5910ce705c1c4e0d8684eae4ac3f57f56c22 Mon Sep 17 00:00:00 2001 From: Daniel Vigovszky Date: Wed, 19 Aug 2026 09:53:51 +0200 Subject: [PATCH 2/7] gol-91 --- Cargo.lock | 5 + Cargo.toml | 1 + cli/golem-cli/Cargo.toml | 5 +- .../command-output.schema.json | 77 + cli/golem-cli/src/bridge_gen/moonbit/mod.rs | 3 +- cli/golem-cli/src/command.rs | 23 +- .../worker/invocation_session.rs | 2540 ++++++++++++ .../src/command_handler/worker/mod.rs | 77 +- .../src/model/agent/invocation_session.rs | 79 + cli/golem-cli/src/model/agent/mod.rs | 1 + cli/golem-cli/src/model/cli_output.rs | 70 + cli/golem-cli/tests/app/agents.rs | 717 +++- cli/golem-cli/tests/app/mod.rs | 211 +- cli/golem-cli/tests/bridge_gen/moonbit.rs | 1 + cli/golem-cli/tests/bridge_gen/scala.rs | 2 +- cli/golem/src/router.rs | 4 + .../published-postgres/nginx.conf.template | 10 + .../moonbit/golem-invoke-agent-moonbit.mdx | 22 +- .../rust/golem-invoke-agent-rust.mdx | 22 +- .../scala/golem-invoke-agent-scala.mdx | 22 +- .../ts/golem-invoke-agent-ts.mdx | 22 +- docs/src/content/next/rest-api/agent.mdx | 13 + .../golem/worker/invocation_session.proto | 189 +- .../golem/worker/v1/worker_service.proto | 4 +- .../workerexecutor/v1/worker_executor.proto | 2 +- .../src/invocation_session_protocol.rs | 1531 ++++++++ golem-api-grpc/src/lib.rs | 270 +- golem-common/src/schema/agent/mod.rs | 23 + golem-common/src/schema/agent/tests.rs | 56 + .../config/debug-worker-executor.sample.env | 2 + .../config/debug-worker-executor.toml | 2 + golem-debugging-service/src/lib.rs | 16 +- .../src/rust/client_gen.rs | 13 +- .../golem-invoke-agent-moonbit/SKILL.md | 22 +- .../rust/golem-invoke-agent-rust/SKILL.md | 22 +- .../scala/golem-invoke-agent-scala/SKILL.md | 22 +- .../skills/ts/golem-invoke-agent-ts/SKILL.md | 22 +- golem-skills/tests/harness/src/executor.ts | 16 + .../tests/variables-integration.test.ts | 56 + .../src/dsl_impl.rs | 84 +- golem-worker-executor/Cargo.toml | 1 + .../config/worker-executor.sample.env | 3 + .../config/worker-executor.toml | 3 + golem-worker-executor/src/durable_host/mod.rs | 9 + .../src/durable_host/schema_value_stream.rs | 18 +- .../src/durable_host/stream_bus.rs | 593 +++ .../src/durable_host/stream_session.rs | 3426 ++++++++--------- .../src/durable_host/stream_transport.rs | 509 ++- .../src/durable_host/wasm_rpc/mod.rs | 62 +- .../src/grpc/invocation_session.rs | 750 ++-- golem-worker-executor/src/grpc/mod.rs | 4 +- golem-worker-executor/src/lib.rs | 12 +- .../src/services/golem_config.rs | 45 + golem-worker-executor/src/services/rpc.rs | 517 ++- .../src/services/worker_proxy.rs | 14 +- .../src/worker/invocation.rs | 173 +- .../src/worker/invocation_loop.rs | 15 +- golem-worker-executor/src/worker/mod.rs | 218 +- golem-worker-executor/tests/agent.rs | 220 +- golem-worker-executor/tests/rpc.rs | 918 ++++- golem-worker-service/src/api/agents.rs | 1568 +++++++- golem-worker-service/src/grpcapi/worker.rs | 552 ++- .../src/mcp/invoke/resource.rs | 34 +- .../src/mcp/invoke/test_support.rs | 29 +- golem-worker-service/src/mcp/invoke/tool.rs | 104 +- .../src/service/worker/client.rs | 735 +++- .../src/service/worker/service.rs | 1160 +++++- integration-tests/Cargo.toml | 1 + integration-tests/tests/api/streaming_rpc.rs | 628 ++- local-run/nginx.conf | 10 + openapi/golem-service.yaml | 66 + openapi/golem-worker-service.yaml | 66 + .../golem-it-agent-rpc-rust/Cargo.lock | 3 + .../golem-it-agent-rpc-rust/Cargo.toml | 3 +- .../golem-it-agent-rpc-rust/src/lib.rs | 159 +- 75 files changed, 15380 insertions(+), 3527 deletions(-) create mode 100644 cli/golem-cli/src/command_handler/worker/invocation_session.rs create mode 100644 cli/golem-cli/src/model/agent/invocation_session.rs create mode 100644 golem-api-grpc/src/invocation_session_protocol.rs create mode 100644 golem-worker-executor/src/durable_host/stream_bus.rs diff --git a/Cargo.lock b/Cargo.lock index 024ea77af3..907a8c4228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3667,6 +3667,7 @@ dependencies = [ "futures-util", "fuzzy-matcher", "goldenfile", + "golem-api-grpc", "golem-client", "golem-common", "heck", @@ -3692,6 +3693,7 @@ dependencies = [ "prettyplease", "proc-macro2", "proptest", + "prost 0.14.3", "quote", "regex", "reqwest 0.13.2", @@ -3717,6 +3719,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-tungstenite 0.25.0", + "tokio-util", "toml 0.9.12+spec-1.1.0", "toml_edit 0.23.10+spec-1.0.0", "tracing", @@ -4248,6 +4251,7 @@ dependencies = [ "applying", "arc-swap", "assert2", + "async-broadcast", "async-lock", "async-recursion", "async-scoped", @@ -5259,6 +5263,7 @@ dependencies = [ "opentelemetry 0.30.0", "opentelemetry_sdk 0.30.0", "pretty_assertions", + "prost 0.14.3", "rand 0.9.2", "redis", "reqwest 0.13.2", diff --git a/Cargo.toml b/Cargo.toml index 8b64b7c50d..19c7f8b395 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ applying = "1.0.1" arc-swap = "1.9.1" arbitrary = "1.4.1" assert2 = "0.3.15" +async-broadcast = "0.7.2" async-fs = "2.1.2" async-hash = "0.5.4" async-lock = "3.4.0" diff --git a/cli/golem-cli/Cargo.toml b/cli/golem-cli/Cargo.toml index 50391c18c5..adb0312f76 100644 --- a/cli/golem-cli/Cargo.toml +++ b/cli/golem-cli/Cargo.toml @@ -29,6 +29,7 @@ test = true harness = false [dependencies] +golem-api-grpc = { workspace = true } golem-client = { workspace = true } golem-common = { workspace = true, default-features = true } @@ -72,6 +73,7 @@ phf = { workspace = true } portable-pty = { workspace = true } prettyplease = { workspace = true } proc-macro2 = { workspace = true } +prost = { workspace = true } quote = { workspace = true } regex = { workspace = true } reqwest = { workspace = true } @@ -92,9 +94,10 @@ tempfile = { workspace = true } terminal_size = { workspace = true } textwrap = { workspace = true } thiserror = { workspace = true } -tokio = { workspace = true } +tokio = { workspace = true, features = ["io-util"] } tokio-stream = { workspace = true } tokio-tungstenite = { workspace = true } +tokio-util = { workspace = true } toml = { workspace = true } toml_edit = { workspace = true } tracing = { workspace = true } diff --git a/cli/golem-cli/command-output-schema/command-output.schema.json b/cli/golem-cli/command-output-schema/command-output.schema.json index 258565465f..77e611e4cf 100644 --- a/cli/golem-cli/command-output-schema/command-output.schema.json +++ b/cli/golem-cli/command-output-schema/command-output.schema.json @@ -75,6 +75,9 @@ { "$ref": "#/definitions/agent.invoke" }, + { + "$ref": "#/definitions/agent.invoke-session" + }, { "$ref": "#/definitions/agent.list" }, @@ -1530,6 +1533,63 @@ }, "additionalProperties": false }, + "agent.invoke-session": { + "type": "object", + "description": "One lifecycle document emitted per accepted, result, stream, or terminal event by `golem agent invoke` in structured formats. Parse stdout as a sequence of documents, not as one array or object.", + "x-golem-output-mode": "multi-document", + "x-golem-command": "agent invoke", + "required": [ + "$type", + "kind", + "idempotencyKey" + ], + "properties": { + "$type": { + "const": "agent.invoke-session" + }, + "kind": { + "$ref": "#/definitions/AgentInvocationSessionEventKind" + }, + "idempotencyKey": { + "type": "string" + }, + "agentId": { + "type": "string" + }, + "componentRevision": { + "type": "integer", + "minimum": 0 + }, + "outcome": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "error": { + "type": "string" + }, + "streamId": { + "type": "integer", + "minimum": 0 + }, + "parentStreamId": { + "type": "integer", + "minimum": 0 + }, + "path": { + "type": "string" + }, + "offset": { + "type": "integer", + "minimum": 0 + }, + "value": { + "$ref": "#/definitions/JsonValue" + } + }, + "additionalProperties": false + }, "agent.list": { "type": "object", "description": "Single structured output document emitted by `golem agent list`.", @@ -4332,6 +4392,19 @@ "missed-messages" ] }, + "AgentInvocationSessionEventKind": { + "type": "string", + "enum": [ + "accepted", + "rejected", + "result", + "item", + "end", + "stream-error", + "stream-cancel", + "finished" + ] + }, "WorkerUpdateAttempt": { "type": "object", "required": ["componentName", "targetRevision", "agentName"], @@ -6905,6 +6978,10 @@ "type": "agent.invoke", "rustType": "InvokeResultView" }, + { + "type": "agent.invoke-session", + "rustType": "AgentInvocationSessionEvent" + }, { "type": "agent.list", "rustType": "AgentsMetadataResponseView" diff --git a/cli/golem-cli/src/bridge_gen/moonbit/mod.rs b/cli/golem-cli/src/bridge_gen/moonbit/mod.rs index d44d180c85..9f887c6b4a 100644 --- a/cli/golem-cli/src/bridge_gen/moonbit/mod.rs +++ b/cli/golem-cli/src/bridge_gen/moonbit/mod.rs @@ -405,6 +405,7 @@ impl MoonBitBridgeGenerator { "golemcloud/golem_sdk/interface/wasi/clocks/system-clock" @systemClock, "golemcloud/golem_sdk/rpc", "golemcloud/golem_sdk/schema_model" @model, + "golemcloud/golem_sdk/schema_model_host" @model_host, }} "#}, }; @@ -1417,7 +1418,7 @@ fn guest_decode_unstructured_binary(value : @model.SchemaValue, allowed : Array[ writer.indent(); writer.line("Some(tree) => {"); writer.indent(); - writer.line("let value = @model.schema_value_from_wit(tree) catch {"); + writer.line("let value = @model_host.schema_value_from_wit(tree) catch {"); writer.indent(); writer.line(format!( "error => raise @common.AgentError::InvalidType({} + error.to_string())", diff --git a/cli/golem-cli/src/command.rs b/cli/golem-cli/src/command.rs index 7e08f1964b..d9c4c73ebb 100644 --- a/cli/golem-cli/src/command.rs +++ b/cli/golem-cli/src/command.rs @@ -1262,7 +1262,7 @@ pub mod worker { }; use crate::model::worker::{AgentListMode, AgentUpdateMode}; use chrono::{DateTime, Utc}; - use clap::Subcommand; + use clap::{Subcommand, ValueEnum}; use golem_client::model::ScanCursor; use golem_common::model::IdempotencyKey; use golem_common::model::agent::AgentTypeName; @@ -1270,6 +1270,18 @@ pub mod worker { use golem_common::model::worker::AgentConfigEntryDto; use uuid::Uuid; + #[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)] + pub enum InvocationStdinFormat { + Value, + Raw, + } + + #[derive(Clone, Copy, Debug, Eq, PartialEq, ValueEnum)] + pub enum InvocationStdoutFormat { + Value, + Raw, + } + #[derive(Debug, Subcommand)] pub enum AgentSubcommand { /// Create new agent @@ -1324,6 +1336,15 @@ pub mod worker { no_stream: bool, #[command(flatten)] stream_args: StreamArgs, + /// Framing used when `-` binds stdin to a direct stream parameter. + /// `value` parses one source-language value per line; `raw` accepts + /// only stream or stream. + #[arg(long, value_enum, default_value = "value")] + stdin_format: InvocationStdinFormat, + /// Rendering used for invocation result streams. `raw` writes only + /// bytes and requires one direct stream or stream result. + #[arg(long, value_enum, default_value = "value")] + stdout_format: InvocationStdoutFormat, #[command(flatten)] post_deploy_args: Option, /// Schedule the invocation at a specific time (ISO 8601 / RFC 3339 format, e.g. 2026-03-15T10:30:00Z) diff --git a/cli/golem-cli/src/command_handler/worker/invocation_session.rs b/cli/golem-cli/src/command_handler/worker/invocation_session.rs new file mode 100644 index 0000000000..dce2270dd1 --- /dev/null +++ b/cli/golem-cli/src/command_handler/worker/invocation_session.rs @@ -0,0 +1,2540 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::agent_id_display::{SourceLanguage, render_schema_value}; +use crate::command::worker::{InvocationStdinFormat, InvocationStdoutFormat}; +use crate::command_handler::log::render_command_output_document; +use crate::command_handler::worker::parse_method_argument_schema_value; +use crate::context::Context; +use crate::error::{NonSuccessfulExit, PipedExitCode}; +use crate::model::agent::invocation_session::{ + AgentInvocationSessionEvent, AgentInvocationSessionEventKind, +}; +use crate::model::format::Format; +use anyhow::{Context as _, anyhow, bail}; +use futures_util::{SinkExt, StreamExt}; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; +use golem_api_grpc::proto::golem::schema::{ + BinaryValue, RecordValue, SchemaValue as ProtoSchemaValue, SchemaValueStreamReference, + schema_value, +}; +use golem_api_grpc::proto::golem::worker::{ + InputStreamEnd, InputStreamItem, InvocationResponse, PublicInvocationRequest, + PublicInvocationStart, StreamCancel, StreamCancelReason, StreamCancelRole, input_stream_item, + invocation_response, invocation_session_completion, invocation_session_result, + public_invocation_request, +}; +use golem_common::model::IdempotencyKey; +use golem_common::model::worker::AgentConfigEntryDto; +use golem_common::schema::agent::{ + AgentMethodSchema, AgentTypeSchema, OutputSchema, ParsedAgentId, +}; +use golem_common::schema::{BinaryValuePayload, SchemaGraph, SchemaType, SchemaValue}; +use native_tls::TlsConnector; +use prost::Message as _; +use std::collections::HashMap; +use std::io::{BufRead, BufReader, ErrorKind, Read, Write}; +use std::sync::Arc; +use std::time::Duration; +use tokio::sync::{mpsc, oneshot}; +use tokio_tungstenite::tungstenite::client::IntoClientRequest; +use tokio_tungstenite::tungstenite::{self, Message}; +use tokio_tungstenite::{Connector, connect_async_tls_with_config}; +use tokio_util::sync::CancellationToken; + +const PIPELINE_CAPACITY: usize = 16; +const RAW_CHUNK_SIZE: usize = 64 * 1024; + +#[derive(Clone, Debug)] +struct InputBinding { + stream_id: u64, + parameter_name: String, + item_type: SchemaType, + raw_kind: Option, +} + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +enum RawStreamKind { + Binary, + U8, +} + +#[derive(Clone, Debug)] +struct OutputStream { + item_type: SchemaType, + parent_stream_id: Option, + path: String, + raw_kind: Option, + next_offset: u64, + terminal: bool, +} + +enum OutputJob { + Text(String), + Raw(Vec), + Event(AgentInvocationSessionEvent), +} + +struct OutputChannel { + tx: mpsc::Sender, + interrupt: CancellationToken, + input_failed: CancellationToken, +} + +struct InputFailure { + error: anyhow::Error, + reason: StreamCancelReason, +} + +#[derive(Debug, thiserror::Error)] +#[error("stdin input failed")] +struct InputFailureSignal; + +#[derive(Default)] +struct SessionIdentity { + agent_id: Option, + component_revision: Option, +} + +pub(super) struct InvocationSessionArgs { + pub application_name: String, + pub environment_name: String, + pub agent_type: AgentTypeSchema, + pub parsed_agent_id: ParsedAgentId, + pub method_name: String, + pub arguments: Vec, + pub config: Vec, + pub idempotency_key: IdempotencyKey, + pub stdin_format: InvocationStdinFormat, + pub stdout_format: InvocationStdoutFormat, +} + +pub(super) async fn invoke(ctx: Arc, args: InvocationSessionArgs) -> anyhow::Result<()> { + let method = args + .agent_type + .methods + .iter() + .find(|method| method.name == args.method_name) + .cloned() + .ok_or_else(|| anyhow!("Method '{}' not found in agent type", args.method_name))?; + let source_language = SourceLanguage::from(args.agent_type.source_language.clone()); + let (method_parameters, input_binding) = prepare_method_parameters( + &args.agent_type.schema, + &method, + args.arguments, + &source_language, + args.stdin_format, + )?; + if args.stdin_format == InvocationStdinFormat::Raw && input_binding.is_none() { + bail!("--stdin-format raw requires stdin bound to stream or stream with '-'"); + } + let input_stream_id = input_binding.as_ref().map(|binding| binding.stream_id); + validate_stdout_format( + &args.agent_type.schema, + &method.output_schema, + args.stdout_format, + )?; + + let constructor_parameters = args + .parsed_agent_id + .parameters + .value() + .clone() + .try_into() + .map_err(anyhow::Error::msg)?; + let idempotency_key_value = args.idempotency_key.value.clone(); + let start = PublicInvocationRequest { + request: Some(public_invocation_request::Request::Start( + PublicInvocationStart { + application_name: args.application_name, + environment_name: args.environment_name, + agent_type_name: args.parsed_agent_id.agent_type.to_string(), + constructor_parameters: Some(constructor_parameters), + phantom_id: args.parsed_agent_id.phantom_id.map(Into::into), + config: args.config.into_iter().map(Into::into).collect(), + method_name: args.method_name, + method_parameters: Some(method_parameters), + idempotency_key: Some(args.idempotency_key.into()), + }, + )), + }; + + let request = websocket_request(&ctx).await?; + let connector = if ctx.allow_insecure() { + Some(Connector::NativeTls( + TlsConnector::builder() + .danger_accept_invalid_certs(true) + .danger_accept_invalid_hostnames(true) + .build()?, + )) + } else { + None + }; + let (socket, _) = connect_async_tls_with_config(request, None, false, connector) + .await + .context("failed to connect to the agent invocation session")?; + let (mut socket_sink, mut socket_stream) = socket.split(); + + let (wire_tx, mut wire_rx) = mpsc::channel::(PIPELINE_CAPACITY); + let mut wire_writer = tokio::spawn(async move { + while let Some(message) = wire_rx.recv().await { + socket_sink.send(message).await?; + } + socket_sink.close().await + }); + + let interrupt = CancellationToken::new(); + let signal_interrupt = interrupt.clone(); + tokio::spawn(async move { + if tokio::signal::ctrl_c().await.is_ok() { + signal_interrupt.cancel(); + } + }); + + let (input_tx, mut input_rx) = mpsc::channel::(PIPELINE_CAPACITY); + let (input_failure_tx, mut input_failure_rx) = oneshot::channel::(); + let input_cancelled = CancellationToken::new(); + let input_failed = CancellationToken::new(); + let stdin_format = args.stdin_format; + let stdin_source_language = source_language.clone(); + let stdin_graph = args.agent_type.schema.clone(); + let has_input = input_binding.is_some(); + let mut input_failure_open = has_input; + if let Some(binding) = input_binding { + let reader_cancelled = input_cancelled.clone(); + let reader_failed = input_failed.clone(); + std::thread::spawn(move || { + if let Err(failure) = read_stdin( + binding, + stdin_format, + stdin_source_language, + stdin_graph, + &input_tx, + &reader_cancelled, + ) && input_failure_tx.send(failure).is_ok() + { + reader_failed.cancel(); + } + }); + } + + let format = ctx.format(); + let structured = format.is_structured() && args.stdout_format == InvocationStdoutFormat::Value; + let (output_job_tx, output_rx) = mpsc::channel::(PIPELINE_CAPACITY); + let output_tx = OutputChannel { + tx: output_job_tx, + interrupt: interrupt.clone(), + input_failed: input_failed.clone(), + }; + let (output_result_tx, mut output_result_rx) = oneshot::channel(); + let colorize = ctx.should_colorize(); + std::thread::spawn(move || { + let _ = output_result_tx.send(write_output(output_rx, format, colorize)); + }); + + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&start) + .map_err(anyhow::Error::msg)?; + send_request(&wire_tx, start, &interrupt).await?; + + let mut output_streams = HashMap::::new(); + let mut failed = false; + let mut accepted = false; + let mut stdin_open = has_input; + let mut input_terminal = !has_input; + let mut pending_input_items = 0_usize; + let mut acknowledged_input_offset = 0_u64; + let mut pending_input_request = None; + let mut fatal_input_failure = None; + let mut session_identity = SessionIdentity::default(); + + 'session: while !state.is_complete() { + tokio::select! { + biased; + _ = interrupt.cancelled() => { + input_cancelled.cancel(); + input_rx.close(); + cancel_open_streams( + &mut state, + &wire_tx, + if accepted && !input_terminal { + input_stream_id.map(|stream_id| (stream_id, acknowledged_input_offset)) + } else { + None + }, + &output_streams, + StreamCancelReason::Cancelled, + "invocation interrupted by the client", + ); + drop(wire_tx); + if tokio::time::timeout(Duration::from_secs(3), &mut wire_writer).await.is_err() { + wire_writer.abort(); + } + bail!(PipedExitCode(130)); + } + failure = &mut input_failure_rx, if input_failure_open => { + input_failure_open = false; + if let Ok(failure) = failure { + fatal_input_failure = Some(failure); + break 'session; + } + } + result = &mut wire_writer => { + match result { + Ok(Ok(())) => bail!("agent invocation session connection closed before completion"), + Ok(Err(error)) => return Err(error.into()), + Err(error) => return Err(error.into()), + } + } + result = &mut output_result_rx => { + match result { + Ok(Ok(())) => bail!("invocation output closed before completion"), + Ok(Err(error)) if error.downcast_ref::().is_some_and(|exit| exit.0 == 0) => { + input_cancelled.cancel(); + input_rx.close(); + cancel_open_streams( + &mut state, + &wire_tx, + if accepted && !input_terminal { + input_stream_id.map(|stream_id| (stream_id, acknowledged_input_offset)) + } else { + None + }, + &output_streams, + StreamCancelReason::Cancelled, + "invocation output was closed by the consumer", + ); + drop(wire_tx); + if tokio::time::timeout(Duration::from_secs(3), &mut wire_writer).await.is_err() { + wire_writer.abort(); + } + return Err(error); + } + Ok(Err(error)) => return Err(error), + Err(_) => bail!("invocation output writer stopped unexpectedly"), + } + } + request = input_rx.recv(), if accepted && stdin_open && pending_input_items < PIPELINE_CAPACITY && pending_input_request.is_none() => { + match request { + Some(request) => pending_input_request = Some(request), + None => stdin_open = false, + } + } + permit = wire_tx.clone().reserve_owned(), if pending_input_request.is_some() => { + let permit = permit.map_err(|_| anyhow!("agent invocation session connection closed"))?; + let request = pending_input_request + .take() + .expect("wire send selected without a pending input request"); + state.validate_public_request(&request).map_err(anyhow::Error::msg)?; + if matches!(request.request, Some(public_invocation_request::Request::InputItem(_))) { + pending_input_items += 1; + } + if matches!(request.request, Some(public_invocation_request::Request::InputEnd(_))) { + input_terminal = true; + } + permit.send(encode_request(request)?); + } + frame = socket_stream.next() => { + let response = match receive_response( + frame, + &wire_tx, + &interrupt, + &input_failed, + ).await { + Ok(Some(response)) => response, + Ok(None) => continue, + Err(error) if error.downcast_ref::().is_some() => { + input_failure_open = false; + fatal_input_failure = Some(take_input_failure(&mut input_failure_rx)?); + break 'session; + } + Err(error) => return Err(error), + }; + state.validate_response(&response).map_err(anyhow::Error::msg)?; + if matches!(response.response, Some(invocation_response::Response::Accepted(_))) { + accepted = true; + } + if let Some(invocation_response::Response::InputAck(ack)) = response.response.as_ref() { + pending_input_items = pending_input_items.checked_sub(1).ok_or_else(|| anyhow!("received an input acknowledgement without a pending item"))?; + acknowledged_input_offset = ack.sequence.checked_add(ack.logical_item_count).ok_or_else(|| anyhow!("input acknowledgement offset overflow"))?; + } + if response_cancels_input(&response, input_stream_id) { + input_cancelled.cancel(); + input_rx.close(); + while input_rx.try_recv().is_ok() {} + pending_input_request = None; + input_failure_open = false; + input_failure_rx.close(); + stdin_open = false; + input_terminal = true; + } + match handle_response( + response, + &args.agent_type.schema, + &method.output_schema, + &source_language, + args.stdout_format, + structured, + &idempotency_key_value, + &mut session_identity, + &mut output_streams, + &output_tx, + ).await { + Ok(response_failed) => failed |= response_failed, + Err(error) if error.downcast_ref::().is_some() => { + input_failure_open = false; + fatal_input_failure = Some(take_input_failure(&mut input_failure_rx)?); + break 'session; + } + Err(error) => return Err(error), + } + } + } + } + + if let Some(failure) = fatal_input_failure { + input_cancelled.cancel(); + input_rx.close(); + while input_rx.try_recv().is_ok() {} + cancel_open_streams( + &mut state, + &wire_tx, + if accepted && !input_terminal { + input_stream_id.map(|stream_id| (stream_id, acknowledged_input_offset)) + } else { + None + }, + &output_streams, + failure.reason, + &failure.error.to_string(), + ); + drop(wire_tx); + if tokio::time::timeout(Duration::from_secs(3), &mut wire_writer) + .await + .is_err() + { + wire_writer.abort(); + } + return Err(failure.error); + } + + if let Err(error) = await_clean_close( + &mut socket_stream, + &wire_tx, + &interrupt, + &mut output_result_rx, + ) + .await + { + input_cancelled.cancel(); + input_rx.close(); + cancel_open_streams( + &mut state, + &wire_tx, + if accepted && !input_terminal { + input_stream_id.map(|stream_id| (stream_id, acknowledged_input_offset)) + } else { + None + }, + &output_streams, + StreamCancelReason::Cancelled, + "invocation session stopped while waiting for the server to close", + ); + drop(wire_tx); + if tokio::time::timeout(Duration::from_secs(3), &mut wire_writer) + .await + .is_err() + { + wire_writer.abort(); + } + return Err(error); + } + + input_cancelled.cancel(); + drop(wire_tx); + drop(output_tx); + input_rx.close(); + + let mut wire_complete = false; + let mut output_complete = false; + while !wire_complete || !output_complete { + tokio::select! { + biased; + _ = interrupt.cancelled() => { + wire_writer.abort(); + bail!(PipedExitCode(130)); + } + result = &mut output_result_rx, if !output_complete => { + match result { + Ok(result) => result?, + Err(_) => bail!("invocation output writer stopped unexpectedly"), + } + output_complete = true; + } + result = &mut wire_writer, if !wire_complete => { + match result { + Ok(Ok(())) => {} + Ok(Err(error)) if state.is_complete() && is_connection_closed(&error) => {} + Ok(Err(error)) => return Err(error.into()), + Err(error) => return Err(error.into()), + } + wire_complete = true; + } + } + } + + if input_failure_open && let Ok(failure) = input_failure_rx.try_recv() { + return Err(failure.error); + } + if failed { + bail!(NonSuccessfulExit); + } + Ok(()) +} + +async fn websocket_request(ctx: &Context) -> anyhow::Result> { + let mut url = ctx.worker_service_url().clone(); + let websocket_scheme = match url.scheme() { + "http" => "ws", + "https" => "wss", + scheme => bail!("unsupported service URL scheme '{scheme}'"), + }; + url.set_scheme(websocket_scheme) + .map_err(|_| anyhow!("failed to derive WebSocket service URL"))?; + url.set_path("/v1/agents/invoke-agent-session"); + url.set_query(None); + url.set_fragment(None); + let mut request = url.as_str().into_client_request()?; + let token = ctx.auth_token().await?; + request.headers_mut().insert( + tungstenite::http::header::AUTHORIZATION, + format!("Bearer {}", token.secret()) + .parse() + .context("invalid authorization token")?, + ); + Ok(request) +} + +fn prepare_method_parameters( + graph: &SchemaGraph, + method: &AgentMethodSchema, + arguments: Vec, + source_language: &SourceLanguage, + stdin_format: InvocationStdinFormat, +) -> anyhow::Result<(ProtoSchemaValue, Option)> { + let fields = method.input_schema.fields(); + if fields.len() != arguments.len() { + bail!( + "wrong number of parameters: expected {}, got {}", + fields.len(), + arguments.len() + ); + } + + let mut values = Vec::with_capacity(fields.len()); + let mut input_binding = None; + let mut next_stream_id = 1_u64; + for (field, argument) in fields.iter().zip(arguments) { + let resolved = graph + .resolve_ref(&field.schema) + .map_err(|error| anyhow!(error.to_string()))?; + if argument == "-" { + let SchemaType::Stream { inner, .. } = resolved else { + bail!( + "stdin marker '-' can only be used for a direct stream parameter; '{}' is not a stream", + field.name + ); + }; + if input_binding.is_some() { + bail!("stdin can only be bound to one stream parameter"); + } + let item_type = inner + .as_deref() + .cloned() + .ok_or_else(|| anyhow!("untyped streams cannot be bound to stdin"))?; + if golem_common::schema::agent::contains_stream_in_graph(graph, &item_type) { + bail!( + "stdin stream parameter '{}' cannot contain nested streams", + field.name + ); + } + let raw_kind = match stdin_format { + InvocationStdinFormat::Value => None, + InvocationStdinFormat::Raw => { + Some(raw_stream_kind(graph, &item_type).ok_or_else(|| { + anyhow!("--stdin-format raw requires stream or stream") + })?) + } + }; + let stream_id = next_stream_id; + next_stream_id += 2; + values.push(ProtoSchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id }, + )), + }); + input_binding = Some(InputBinding { + stream_id, + parameter_name: field.name.clone(), + item_type, + raw_kind, + }); + } else { + if golem_common::schema::agent::contains_stream_in_graph(graph, &field.schema) { + bail!( + "stream parameter '{}' must be a direct stream bound to stdin with '-'", + field.name + ); + } + let parsed = parse_method_argument_schema_value( + &argument, + graph, + &field.schema, + source_language, + ) + .map_err(|error| anyhow!("invalid value for '{}': {}", field.name, error.message))?; + values.push(parsed.try_into().map_err(anyhow::Error::msg)?); + } + } + + Ok(( + ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: values, + })), + }, + input_binding, + )) +} + +fn validate_stdout_format( + graph: &SchemaGraph, + output: &OutputSchema, + format: InvocationStdoutFormat, +) -> anyhow::Result<()> { + if format == InvocationStdoutFormat::Value { + return Ok(()); + } + let ty = output + .schema() + .ok_or_else(|| anyhow!("--stdout-format raw requires a stream result"))?; + let resolved = graph + .resolve_ref(ty) + .map_err(|error| anyhow!(error.to_string()))?; + let SchemaType::Stream { + inner: Some(inner), .. + } = resolved + else { + bail!("--stdout-format raw requires one direct stream result"); + }; + if raw_stream_kind(graph, inner).is_none() { + bail!("--stdout-format raw requires stream or stream"); + } + Ok(()) +} + +fn raw_stream_kind(graph: &SchemaGraph, ty: &SchemaType) -> Option { + match graph.resolve_ref(ty).ok()? { + SchemaType::Binary { .. } => Some(RawStreamKind::Binary), + SchemaType::U8 { .. } => Some(RawStreamKind::U8), + _ => None, + } +} + +fn read_stdin( + binding: InputBinding, + format: InvocationStdinFormat, + source_language: SourceLanguage, + graph: SchemaGraph, + tx: &mpsc::Sender, + cancelled: &CancellationToken, +) -> Result<(), InputFailure> { + let mut offset = 0_u64; + match format { + InvocationStdinFormat::Value => { + let mut stdin = BufReader::new(std::io::stdin().lock()); + let mut line = String::new(); + loop { + if cancelled.is_cancelled() { + return Ok(()); + } + line.clear(); + match stdin.read_line(&mut line) { + Ok(0) => break, + Ok(_) => { + if line.ends_with('\n') { + line.pop(); + if line.ends_with('\r') { + line.pop(); + } + } + } + Err(error) => { + return Err(InputFailure { + error: anyhow!( + "failed to read stdin for parameter '{}' at line {}: {error}", + binding.parameter_name, + offset + 1 + ), + reason: StreamCancelReason::Transport, + }); + } + } + if cancelled.is_cancelled() { + return Ok(()); + } + let value = match parse_method_argument_schema_value( + &line, + &graph, + &binding.item_type, + &source_language, + ) { + Ok(value) => value, + Err(parse_error) => { + return Err(InputFailure { + error: anyhow!( + "invalid stdin value for parameter '{}' at line {}: {parse_error}", + binding.parameter_name, + offset + 1 + ), + reason: StreamCancelReason::Protocol, + }); + } + }; + let request = + input_value_request(binding.stream_id, offset, value).map_err(|error| { + InputFailure { + error, + reason: StreamCancelReason::Protocol, + } + })?; + if tx.blocking_send(request).is_err() { + if cancelled.is_cancelled() { + return Ok(()); + } + return Err(InputFailure { + error: anyhow!("invocation session ended while reading stdin"), + reason: StreamCancelReason::Transport, + }); + } + offset = offset.checked_add(1).ok_or_else(|| InputFailure { + error: anyhow!("stdin stream offset overflow"), + reason: StreamCancelReason::Protocol, + })?; + } + } + InvocationStdinFormat::Raw => { + let mut stdin = std::io::stdin().lock(); + let mut buffer = vec![0_u8; RAW_CHUNK_SIZE]; + loop { + if cancelled.is_cancelled() { + return Ok(()); + } + let mut count = 0; + let mut eof = false; + while count < RAW_CHUNK_SIZE { + if cancelled.is_cancelled() { + return Ok(()); + } + match stdin.read(&mut buffer[count..]) { + Ok(0) => { + eof = true; + break; + } + Ok(read) => { + count += read; + if cancelled.is_cancelled() { + return Ok(()); + } + } + Err(error) => { + return Err(InputFailure { + error: anyhow!( + "failed to read raw stdin for parameter '{}': {error}", + binding.parameter_name + ), + reason: StreamCancelReason::Transport, + }); + } + } + } + if count == 0 { + break; + } + let payload = match binding.raw_kind { + Some(RawStreamKind::Binary) => input_stream_item::Payload::Value( + SchemaValue::Binary(BinaryValuePayload { + bytes: buffer[..count].to_vec(), + mime_type: None, + }) + .try_into() + .map_err(|error| InputFailure { + error: anyhow::Error::msg(error), + reason: StreamCancelReason::Protocol, + })?, + ), + Some(RawStreamKind::U8) => { + input_stream_item::Payload::PackedU8(buffer[..count].to_vec()) + } + None => unreachable!("raw stdin was validated before reading"), + }; + if tx + .blocking_send(PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id: binding.stream_id, + sequence: offset, + payload: Some(payload), + }, + )), + }) + .is_err() + { + if cancelled.is_cancelled() { + return Ok(()); + } + return Err(InputFailure { + error: anyhow!("invocation session ended while reading stdin"), + reason: StreamCancelReason::Transport, + }); + } + let logical_item_count = if binding.raw_kind == Some(RawStreamKind::U8) { + count as u64 + } else { + 1 + }; + offset = offset + .checked_add(logical_item_count) + .ok_or_else(|| InputFailure { + error: anyhow!("stdin stream offset overflow"), + reason: StreamCancelReason::Protocol, + })?; + if eof { + break; + } + } + } + } + if cancelled.is_cancelled() { + return Ok(()); + } + if tx + .blocking_send(PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputEnd( + InputStreamEnd { + stream_id: binding.stream_id, + offset, + }, + )), + }) + .is_err() + { + if cancelled.is_cancelled() { + return Ok(()); + } + return Err(InputFailure { + error: anyhow!("invocation session ended before stdin reached EOF"), + reason: StreamCancelReason::Transport, + }); + } + Ok(()) +} + +fn input_cancel_request( + stream_id: u64, + offset: u64, + reason: StreamCancelReason, + details: String, +) -> PublicInvocationRequest { + PublicInvocationRequest { + request: Some(public_invocation_request::Request::StreamCancel( + StreamCancel { + stream_id, + offset, + role: StreamCancelRole::InputProducer as i32, + reason: reason as i32, + details: Some(details), + }, + )), + } +} + +fn output_cancel_request( + stream_id: u64, + offset: u64, + reason: StreamCancelReason, + details: String, +) -> PublicInvocationRequest { + PublicInvocationRequest { + request: Some(public_invocation_request::Request::StreamCancel( + StreamCancel { + stream_id, + offset, + role: StreamCancelRole::OutputConsumer as i32, + reason: reason as i32, + details: Some(details), + }, + )), + } +} + +fn cancel_open_streams( + state: &mut InvocationSessionState, + wire_tx: &mpsc::Sender, + input: Option<(u64, u64)>, + output_streams: &HashMap, + reason: StreamCancelReason, + details: &str, +) { + if let Some((stream_id, offset)) = input { + let request = input_cancel_request(stream_id, offset, reason, details.to_string()); + if state.validate_public_request(&request).is_ok() { + try_send_request(wire_tx, request); + } + } + + let mut open_outputs = output_streams + .iter() + .filter_map(|(stream_id, stream)| { + (!stream.terminal).then_some((*stream_id, stream.next_offset)) + }) + .collect::>(); + open_outputs.sort_unstable_by_key(|(stream_id, _)| *stream_id); + for (stream_id, offset) in open_outputs { + let request = output_cancel_request(stream_id, offset, reason, details.to_string()); + if state.validate_public_request(&request).is_ok() { + try_send_request(wire_tx, request); + } + } +} + +fn input_value_request( + stream_id: u64, + sequence: u64, + value: SchemaValue, +) -> anyhow::Result { + Ok(PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id, + sequence, + payload: Some(input_stream_item::Payload::Value( + value.try_into().map_err(anyhow::Error::msg)?, + )), + }, + )), + }) +} + +async fn send_request( + tx: &mpsc::Sender, + request: PublicInvocationRequest, + interrupt: &CancellationToken, +) -> anyhow::Result<()> { + send_message(tx, encode_request(request)?, interrupt).await +} + +fn try_send_request(tx: &mpsc::Sender, request: PublicInvocationRequest) { + if let Ok(message) = encode_request(request) { + let _ = tx.try_send(message); + } +} + +fn take_input_failure( + receiver: &mut oneshot::Receiver, +) -> anyhow::Result { + receiver.try_recv().map_err(|error| match error { + oneshot::error::TryRecvError::Empty => { + anyhow!("stdin failure signal arrived before its diagnostic") + } + oneshot::error::TryRecvError::Closed => { + anyhow!("stdin failure signal arrived without a diagnostic") + } + }) +} + +fn encode_request(request: PublicInvocationRequest) -> anyhow::Result { + let mut bytes = Vec::new(); + request.encode(&mut bytes)?; + Ok(Message::Binary(bytes.into())) +} + +async fn send_message( + tx: &mpsc::Sender, + message: Message, + interrupt: &CancellationToken, +) -> anyhow::Result<()> { + tokio::select! { + biased; + _ = interrupt.cancelled() => bail!(PipedExitCode(130)), + result = tx.send(message) => result.map_err(|_| anyhow!("agent invocation session connection closed")), + } +} + +async fn send_active_message( + tx: &mpsc::Sender, + message: Message, + interrupt: &CancellationToken, + input_failed: &CancellationToken, +) -> anyhow::Result<()> { + tokio::select! { + biased; + _ = input_failed.cancelled() => bail!(InputFailureSignal), + _ = interrupt.cancelled() => bail!(PipedExitCode(130)), + result = tx.send(message) => result.map_err(|_| anyhow!("agent invocation session connection closed")), + } +} + +async fn receive_response( + frame: Option>, + wire_tx: &mpsc::Sender, + interrupt: &CancellationToken, + input_failed: &CancellationToken, +) -> anyhow::Result> { + match frame { + Some(Ok(Message::Binary(bytes))) => Ok(Some(InvocationResponse::decode(bytes.as_slice())?)), + Some(Ok(Message::Ping(payload))) => { + send_active_message(wire_tx, Message::Pong(payload), interrupt, input_failed).await?; + Ok(None) + } + Some(Ok(Message::Pong(_))) => Ok(None), + Some(Ok(Message::Close(close))) => { + bail!("agent invocation session closed before completion: {close:?}"); + } + Some(Ok(message)) => { + bail!("unexpected WebSocket frame in invocation session: {message:?}"); + } + Some(Err(error)) => Err(error.into()), + None => bail!("agent invocation session ended before completion"), + } +} + +fn response_cancels_input(response: &InvocationResponse, input_stream_id: Option) -> bool { + let Some(input_stream_id) = input_stream_id else { + return false; + }; + matches!( + response.response.as_ref(), + Some(invocation_response::Response::StreamCancel(cancel)) + if cancel.stream_id == input_stream_id + && cancel.role() == StreamCancelRole::InputConsumer + ) +} + +async fn await_clean_close( + socket_stream: &mut S, + wire_tx: &mpsc::Sender, + interrupt: &CancellationToken, + output_result_rx: &mut oneshot::Receiver>, +) -> anyhow::Result<()> +where + S: futures_util::Stream> + Unpin, +{ + let close_timeout = tokio::time::sleep(Duration::from_secs(3)); + tokio::pin!(close_timeout); + loop { + tokio::select! { + biased; + _ = interrupt.cancelled() => bail!(PipedExitCode(130)), + result = &mut *output_result_rx => { + match result { + Ok(result) => return result, + Err(_) => bail!("invocation output writer stopped unexpectedly"), + } + } + _ = &mut close_timeout => { + bail!("invocation session did not close after completion"); + } + frame = socket_stream.next() => { + match frame { + Some(Ok(Message::Close(_))) | None => return Ok(()), + Some(Ok(Message::Ping(payload))) => { + send_message(wire_tx, Message::Pong(payload), interrupt).await?; + } + Some(Ok(Message::Pong(_))) => {} + Some(Ok(Message::Binary(_))) => { + bail!("invocation session sent an event after completion"); + } + Some(Ok(message)) => { + bail!("unexpected WebSocket frame after invocation completion: {message:?}"); + } + Some(Err(error)) if is_connection_closed(&error) => return Ok(()), + Some(Err(error)) => return Err(error.into()), + } + } + } + } +} + +#[allow(clippy::too_many_arguments)] +async fn handle_response( + response: InvocationResponse, + graph: &SchemaGraph, + output_schema: &OutputSchema, + source_language: &SourceLanguage, + stdout_format: InvocationStdoutFormat, + structured: bool, + idempotency_key: &str, + session_identity: &mut SessionIdentity, + output_streams: &mut HashMap, + output_tx: &OutputChannel, +) -> anyhow::Result { + let mut failed = false; + match response.response { + Some(invocation_response::Response::Accepted(accepted)) => { + session_identity.agent_id = accepted.agent_id.as_ref().map(|id| id.name.clone()); + session_identity.component_revision = accepted.component_revision; + if structured { + let mut event = event(AgentInvocationSessionEventKind::Accepted, idempotency_key); + event.agent_id = session_identity.agent_id.clone(); + event.component_revision = session_identity.component_revision; + emit(output_tx, OutputJob::Event(event)).await?; + } + } + Some(invocation_response::Response::Rejected(rejected)) => { + failed = true; + let reason = format!("{:?}", rejected.reason()); + if structured { + let mut event = event(AgentInvocationSessionEventKind::Rejected, idempotency_key); + event.agent_id = rejected.agent_id.map(|id| id.name); + event.component_revision = rejected.component_revision; + event.reason = Some(reason); + event.error = Some(rejected.error); + emit(output_tx, OutputJob::Event(event)).await?; + } else { + eprintln!("Invocation rejected ({reason}): {}", rejected.error); + } + } + Some(invocation_response::Response::Result(result)) => { + let result_agent_id = result + .agent_id + .map(|id| id.name) + .or_else(|| session_identity.agent_id.clone()); + let result_component_revision = result + .component_revision + .or(session_identity.component_revision); + match result.result { + Some(invocation_session_result::Result::MethodResult(value)) => { + let Some(output_type) = output_schema.schema() else { + if structured { + let mut event = + event(AgentInvocationSessionEventKind::Result, idempotency_key); + event.agent_id = result_agent_id; + event.component_revision = result_component_revision; + emit(output_tx, OutputJob::Event(event)).await?; + } else { + emit(output_tx, OutputJob::Text("void".to_string())).await?; + } + return Ok(failed); + }; + discover_streams( + graph, + output_type, + &value, + "$", + None, + stdout_format, + output_streams, + )?; + if structured { + let mut event = + event(AgentInvocationSessionEventKind::Result, idempotency_key); + event.agent_id = result_agent_id; + event.component_revision = result_component_revision; + event.value = Some(proto_value_to_json(graph, output_type, &value)?); + emit(output_tx, OutputJob::Event(event)).await?; + } else if stdout_format == InvocationStdoutFormat::Value { + for (path, rendered) in + render_text_fragments(graph, output_type, &value, "$", source_language)? + { + let rendered = if path == "$" { + rendered + } else { + format!("{path}: {rendered}") + }; + emit(output_tx, OutputJob::Text(rendered)).await?; + } + } + } + Some(invocation_session_result::Result::NoResult(_)) => { + if !matches!(output_schema, OutputSchema::Unit) { + bail!("session returned no result for a value-returning method"); + } + if structured { + let mut event = + event(AgentInvocationSessionEventKind::Result, idempotency_key); + event.agent_id = result_agent_id; + event.component_revision = result_component_revision; + emit(output_tx, OutputJob::Event(event)).await?; + } else { + emit(output_tx, OutputJob::Text("void".to_string())).await?; + } + } + None => bail!("invocation result has no value"), + } + } + Some(invocation_response::Response::OutputItem(item)) => { + let stream = output_streams + .get(&item.stream_id) + .cloned() + .ok_or_else(|| anyhow!("output stream {} has no schema", item.stream_id))?; + let value = item + .value + .ok_or_else(|| anyhow!("output stream item has no value"))?; + discover_streams( + graph, + &stream.item_type, + &value, + &format!("{}[{}]", stream.path, item.offset), + Some(item.stream_id), + InvocationStdoutFormat::Value, + output_streams, + )?; + output_streams + .get_mut(&item.stream_id) + .expect("output stream disappeared while processing an item") + .next_offset = item + .offset + .checked_add(1) + .ok_or_else(|| anyhow!("output stream offset overflow"))?; + if structured { + let mut event = event(AgentInvocationSessionEventKind::Item, idempotency_key); + event.stream_id = Some(item.stream_id); + event.parent_stream_id = stream.parent_stream_id; + event.path = Some(stream.path); + event.offset = Some(item.offset); + event.value = Some(proto_value_to_json(graph, &stream.item_type, &value)?); + emit(output_tx, OutputJob::Event(event)).await?; + } else if stdout_format == InvocationStdoutFormat::Raw { + emit(output_tx, OutputJob::Raw(raw_output_bytes(&stream, value)?)).await?; + } else { + for (path, rendered) in render_text_fragments( + graph, + &stream.item_type, + &value, + &stream.path, + source_language, + )? { + let rendered = + if path != stream.path || output_streams.len() > 1 || stream.path != "$" { + format!("{path}: {rendered}") + } else { + rendered + }; + emit(output_tx, OutputJob::Text(rendered)).await?; + } + } + } + Some(invocation_response::Response::OutputEnd(end)) => { + output_streams + .get_mut(&end.stream_id) + .ok_or_else(|| anyhow!("output stream {} has no schema", end.stream_id))? + .terminal = true; + if structured { + let stream = output_streams + .get(&end.stream_id) + .ok_or_else(|| anyhow!("output stream {} has no schema", end.stream_id))?; + let mut event = event(AgentInvocationSessionEventKind::End, idempotency_key); + event.stream_id = Some(end.stream_id); + event.parent_stream_id = stream.parent_stream_id; + event.path = Some(stream.path.clone()); + event.offset = Some(end.offset); + emit(output_tx, OutputJob::Event(event)).await?; + } + } + Some(invocation_response::Response::OutputError(error)) => { + failed = true; + output_streams + .get_mut(&error.stream_id) + .ok_or_else(|| anyhow!("output stream {} has no schema", error.stream_id))? + .terminal = true; + if structured { + let stream = output_streams + .get(&error.stream_id) + .ok_or_else(|| anyhow!("output stream {} has no schema", error.stream_id))?; + let mut event = event( + AgentInvocationSessionEventKind::StreamError, + idempotency_key, + ); + event.stream_id = Some(error.stream_id); + event.parent_stream_id = stream.parent_stream_id; + event.path = Some(stream.path.clone()); + event.offset = Some(error.offset); + event.error = Some(error.details); + emit(output_tx, OutputJob::Event(event)).await?; + } else { + eprintln!( + "Output stream {} failed: {}", + error.stream_id, error.details + ); + } + } + Some(invocation_response::Response::InputAck(_)) => {} + Some(invocation_response::Response::StreamCancel(cancel)) => { + failed |= cancel.reason() != StreamCancelReason::Cancelled; + let output_stream = if cancel.role() == StreamCancelRole::OutputProducer { + let stream = output_streams + .get_mut(&cancel.stream_id) + .ok_or_else(|| anyhow!("output stream {} has no schema", cancel.stream_id))?; + stream.terminal = true; + Some(stream.clone()) + } else { + None + }; + if structured { + let mut event = event( + AgentInvocationSessionEventKind::StreamCancel, + idempotency_key, + ); + event.stream_id = Some(cancel.stream_id); + if let Some(stream) = output_stream { + event.parent_stream_id = stream.parent_stream_id; + event.path = Some(stream.path); + } + event.offset = Some(cancel.offset); + event.reason = Some(format!("{:?}", cancel.reason())); + event.error = cancel.details; + emit(output_tx, OutputJob::Event(event)).await?; + } else { + eprintln!("Stream {} was cancelled", cancel.stream_id); + } + } + Some(invocation_response::Response::AttachmentRevoked(revoked)) => { + bail!("invocation attachment was revoked: {}", revoked.details); + } + Some(invocation_response::Response::Finished(finished)) => { + let (outcome, error) = match finished.outcome { + Some(invocation_session_completion::Outcome::Success(_)) => { + ("success".to_string(), None) + } + Some(invocation_session_completion::Outcome::Failure(failure)) => { + failed = true; + (format!("{:?}", failure.kind()), Some(failure.message)) + } + None => bail!("invocation completion has no outcome"), + }; + if structured { + let mut event = event(AgentInvocationSessionEventKind::Finished, idempotency_key); + event.agent_id = session_identity.agent_id.clone(); + event.component_revision = session_identity.component_revision; + event.outcome = Some(outcome); + event.error = error; + emit(output_tx, OutputJob::Event(event)).await?; + } else if let Some(error) = error { + eprintln!("Invocation failed: {error}"); + } + } + None => bail!("empty invocation response"), + } + Ok(failed) +} + +fn event( + kind: AgentInvocationSessionEventKind, + idempotency_key: &str, +) -> AgentInvocationSessionEvent { + AgentInvocationSessionEvent::new(kind, idempotency_key) +} + +async fn emit(output: &OutputChannel, job: OutputJob) -> anyhow::Result<()> { + tokio::select! { + biased; + _ = output.input_failed.cancelled() => bail!(InputFailureSignal), + _ = output.interrupt.cancelled() => bail!(PipedExitCode(130)), + result = output.tx.send(job) => result.map_err(|_| anyhow!("invocation output closed unexpectedly")), + } +} + +fn write_output( + mut rx: mpsc::Receiver, + format: Format, + colorize: bool, +) -> anyhow::Result<()> { + while let Some(job) = rx.blocking_recv() { + let bytes = render_output_job(job, format, colorize)?; + let stdout = std::io::stdout(); + write_and_flush(&mut stdout.lock(), &bytes)?; + } + Ok(()) +} + +#[cfg(test)] +fn write_output_to( + mut rx: mpsc::Receiver, + format: Format, + colorize: bool, + output: &mut W, +) -> anyhow::Result<()> { + while let Some(job) = rx.blocking_recv() { + let bytes = render_output_job(job, format, colorize)?; + write_and_flush(output, &bytes)?; + } + Ok(()) +} + +fn render_output_job(job: OutputJob, format: Format, colorize: bool) -> anyhow::Result> { + match job { + OutputJob::Text(mut text) => { + text.push('\n'); + Ok(text.into_bytes()) + } + OutputJob::Raw(bytes) => Ok(bytes), + OutputJob::Event(event) => { + let mut document = render_command_output_document(format, colorize, event)?; + document.push('\n'); + Ok(document.into_bytes()) + } + } +} + +fn write_and_flush(output: &mut impl Write, bytes: &[u8]) -> anyhow::Result<()> { + if let Err(error) = output.write_all(bytes).and_then(|()| output.flush()) { + if error.kind() == ErrorKind::BrokenPipe { + bail!(PipedExitCode(0)); + } + return Err(error.into()); + } + Ok(()) +} + +fn raw_output_bytes(stream: &OutputStream, value: ProtoSchemaValue) -> anyhow::Result> { + match (stream.raw_kind, value.value) { + ( + Some(RawStreamKind::Binary), + Some(schema_value::Value::BinaryValue(BinaryValue { bytes, .. })), + ) => Ok(bytes), + (Some(RawStreamKind::U8), Some(schema_value::Value::U8Value(value))) => Ok(vec![ + u8::try_from(value).map_err(|_| anyhow!("u8 stream item is out of range"))?, + ]), + _ => bail!("raw output stream item does not match its declared type"), + } +} + +fn render_value( + graph: &SchemaGraph, + ty: &SchemaType, + value: ProtoSchemaValue, + source_language: &SourceLanguage, +) -> anyhow::Result { + let value = SchemaValue::try_from(value).map_err(anyhow::Error::msg)?; + Ok(render_schema_value(graph, ty, &value, source_language)) +} + +fn render_text_fragments( + graph: &SchemaGraph, + ty: &SchemaType, + value: &ProtoSchemaValue, + path: &str, + source_language: &SourceLanguage, +) -> anyhow::Result> { + let mut fragments = Vec::new(); + collect_text_fragments(graph, ty, value, path, source_language, &mut fragments)?; + Ok(fragments) +} + +fn collect_text_fragments( + graph: &SchemaGraph, + ty: &SchemaType, + value: &ProtoSchemaValue, + path: &str, + source_language: &SourceLanguage, + fragments: &mut Vec<(String, String)>, +) -> anyhow::Result<()> { + let ty = graph + .resolve_ref(ty) + .map_err(|error| anyhow!(error.to_string()))?; + let value_body = value + .value + .as_ref() + .ok_or_else(|| anyhow!("schema value at {path} is empty"))?; + + if matches!(ty, SchemaType::Stream { .. }) { + if matches!(value_body, schema_value::Value::StreamReference(_)) { + return Ok(()); + } + bail!("stream value at {path} is not a stream reference"); + } + + if let Ok(rendered) = render_value(graph, ty, value.clone(), source_language) { + fragments.push((path.to_string(), rendered)); + return Ok(()); + } + + match (ty, value_body) { + (SchemaType::Record { fields, .. }, schema_value::Value::RecordValue(record)) => { + if fields.len() != record.fields.len() { + bail!("record value at {path} has the wrong number of fields"); + } + for (field, value) in fields.iter().zip(&record.fields) { + collect_text_fragments( + graph, + &field.body, + value, + &format!("{path}.{}", field.name), + source_language, + fragments, + )?; + } + } + (SchemaType::Tuple { elements, .. }, schema_value::Value::TupleValue(tuple)) => { + if elements.len() != tuple.elements.len() { + bail!("tuple value at {path} has the wrong number of elements"); + } + for (index, (ty, value)) in elements.iter().zip(&tuple.elements).enumerate() { + collect_text_fragments( + graph, + ty, + value, + &format!("{path}[{index}]"), + source_language, + fragments, + )?; + } + } + (SchemaType::List { element, .. }, schema_value::Value::ListValue(list)) => { + for (index, value) in list.elements.iter().enumerate() { + collect_text_fragments( + graph, + element, + value, + &format!("{path}[{index}]"), + source_language, + fragments, + )?; + } + } + (SchemaType::FixedList { element, .. }, schema_value::Value::FixedListValue(list)) => { + for (index, value) in list.elements.iter().enumerate() { + collect_text_fragments( + graph, + element, + value, + &format!("{path}[{index}]"), + source_language, + fragments, + )?; + } + } + ( + SchemaType::Map { + key, + value: value_type, + .. + }, + schema_value::Value::MapValue(map), + ) => { + for (index, entry) in map.entries.iter().enumerate() { + collect_text_fragments( + graph, + key, + entry + .key + .as_ref() + .ok_or_else(|| anyhow!("map entry at {path}[{index}] has no key"))?, + &format!("{path}[{index}].key"), + source_language, + fragments, + )?; + collect_text_fragments( + graph, + value_type, + entry + .value + .as_ref() + .ok_or_else(|| anyhow!("map entry at {path}[{index}] has no value"))?, + &format!("{path}[{index}].value"), + source_language, + fragments, + )?; + } + } + (SchemaType::Option { inner, .. }, schema_value::Value::OptionValue(option)) => { + if let Some(value) = option.inner.as_deref() { + collect_text_fragments( + graph, + inner, + value, + &format!("{path}.some"), + source_language, + fragments, + )?; + } + } + (SchemaType::Variant { cases, .. }, schema_value::Value::VariantValue(variant)) => { + let case = cases + .get(variant.case as usize) + .ok_or_else(|| anyhow!("variant case at {path} is out of range"))?; + if let (Some(ty), Some(value)) = (&case.payload, variant.payload.as_deref()) { + collect_text_fragments( + graph, + ty, + value, + &format!("{path}.{}", case.name), + source_language, + fragments, + )?; + } + } + (SchemaType::Result { spec, .. }, schema_value::Value::ResultValue(result)) => { + use golem_api_grpc::proto::golem::schema::result_value::Result; + match result.result.as_ref() { + Some(Result::Ok(value)) => collect_text_fragments( + graph, + spec.ok + .as_deref() + .ok_or_else(|| anyhow!("unexpected ok payload at {path}"))?, + value, + &format!("{path}.ok"), + source_language, + fragments, + )?, + Some(Result::Err(value)) => collect_text_fragments( + graph, + spec.err + .as_deref() + .ok_or_else(|| anyhow!("unexpected err payload at {path}"))?, + value, + &format!("{path}.err"), + source_language, + fragments, + )?, + Some(Result::OkUnit(_)) | Some(Result::ErrUnit(_)) => {} + None => bail!("result value at {path} has no case"), + } + } + (SchemaType::Union { spec, .. }, schema_value::Value::UnionValue(union)) => { + let branch = spec + .branches + .iter() + .find(|branch| branch.tag == union.tag) + .ok_or_else(|| anyhow!("unknown union branch '{}' at {path}", union.tag))?; + collect_text_fragments( + graph, + &branch.body, + union + .body + .as_deref() + .ok_or_else(|| anyhow!("union value at {path} has no body"))?, + &format!("{path}.{}", union.tag), + source_language, + fragments, + )?; + } + _ => bail!("invocation value at {path} does not match its declared schema"), + } + Ok(()) +} + +fn discover_streams( + graph: &SchemaGraph, + ty: &SchemaType, + value: &ProtoSchemaValue, + path: &str, + parent_stream_id: Option, + stdout_format: InvocationStdoutFormat, + output: &mut HashMap, +) -> anyhow::Result<()> { + let ty = graph + .resolve_ref(ty) + .map_err(|error| anyhow!(error.to_string()))?; + let Some(value) = value.value.as_ref() else { + bail!("schema value at {path} is empty"); + }; + match (ty, value) { + ( + SchemaType::Stream { + inner: Some(inner), .. + }, + schema_value::Value::StreamReference(reference), + ) => { + let raw_kind = if stdout_format == InvocationStdoutFormat::Raw { + raw_stream_kind(graph, inner) + } else { + None + }; + if output + .insert( + reference.stream_id, + OutputStream { + item_type: (**inner).clone(), + parent_stream_id, + path: path.to_string(), + raw_kind, + next_offset: 0, + terminal: false, + }, + ) + .is_some() + { + bail!( + "output stream {} was discovered more than once", + reference.stream_id + ); + } + } + (SchemaType::Record { fields, .. }, schema_value::Value::RecordValue(record)) => { + for (field, value) in fields.iter().zip(&record.fields) { + discover_streams( + graph, + &field.body, + value, + &format!("{path}.{}", field.name), + parent_stream_id, + stdout_format, + output, + )?; + } + } + (SchemaType::Tuple { elements, .. }, schema_value::Value::TupleValue(tuple)) => { + for (index, (ty, value)) in elements.iter().zip(&tuple.elements).enumerate() { + discover_streams( + graph, + ty, + value, + &format!("{path}[{index}]"), + parent_stream_id, + stdout_format, + output, + )?; + } + } + (SchemaType::List { element, .. }, schema_value::Value::ListValue(list)) => { + for (index, value) in list.elements.iter().enumerate() { + discover_streams( + graph, + element, + value, + &format!("{path}[{index}]"), + parent_stream_id, + stdout_format, + output, + )?; + } + } + (SchemaType::FixedList { element, .. }, schema_value::Value::FixedListValue(list)) => { + for (index, value) in list.elements.iter().enumerate() { + discover_streams( + graph, + element, + value, + &format!("{path}[{index}]"), + parent_stream_id, + stdout_format, + output, + )?; + } + } + ( + SchemaType::Map { + key, + value: value_type, + .. + }, + schema_value::Value::MapValue(map), + ) => { + for (index, entry) in map.entries.iter().enumerate() { + if let Some(value) = &entry.key { + discover_streams( + graph, + key, + value, + &format!("{path}[{index}].key"), + parent_stream_id, + stdout_format, + output, + )?; + } + if let Some(value) = &entry.value { + discover_streams( + graph, + value_type, + value, + &format!("{path}[{index}].value"), + parent_stream_id, + stdout_format, + output, + )?; + } + } + } + (SchemaType::Option { inner, .. }, schema_value::Value::OptionValue(option)) => { + if let Some(value) = &option.inner { + discover_streams( + graph, + inner, + value, + &format!("{path}.some"), + parent_stream_id, + stdout_format, + output, + )?; + } + } + (SchemaType::Variant { cases, .. }, schema_value::Value::VariantValue(variant)) => { + if let Some(case) = cases.get(variant.case as usize) + && let (Some(ty), Some(value)) = (&case.payload, &variant.payload) + { + discover_streams( + graph, + ty, + value, + &format!("{path}.{}", case.name), + parent_stream_id, + stdout_format, + output, + )?; + } + } + (SchemaType::Result { spec, .. }, schema_value::Value::ResultValue(result)) => { + use golem_api_grpc::proto::golem::schema::result_value::Result; + match result.result.as_ref() { + Some(Result::Ok(value)) if spec.ok.is_some() => discover_streams( + graph, + spec.ok.as_deref().unwrap(), + value, + &format!("{path}.ok"), + parent_stream_id, + stdout_format, + output, + )?, + Some(Result::Err(value)) if spec.err.is_some() => discover_streams( + graph, + spec.err.as_deref().unwrap(), + value, + &format!("{path}.err"), + parent_stream_id, + stdout_format, + output, + )?, + _ => {} + } + } + (SchemaType::Union { spec, .. }, schema_value::Value::UnionValue(union)) => { + if let Some(branch) = spec.branches.iter().find(|branch| branch.tag == union.tag) + && let Some(value) = &union.body + { + discover_streams( + graph, + &branch.body, + value, + &format!("{path}.{}", union.tag), + parent_stream_id, + stdout_format, + output, + )?; + } + } + _ if stdout_format == InvocationStdoutFormat::Raw => { + bail!("raw output value at {path} does not match its declared direct stream schema") + } + _ => {} + } + Ok(()) +} + +fn proto_value_to_json( + graph: &SchemaGraph, + ty: &SchemaType, + value: &ProtoSchemaValue, +) -> anyhow::Result { + if let Ok(value) = SchemaValue::try_from(value.clone()) { + return golem_common::schema::render::to_json_value(graph, ty, &value).map_err(Into::into); + } + + let ty = graph + .resolve_ref(ty) + .map_err(|error| anyhow!(error.to_string()))?; + let value = value + .value + .as_ref() + .ok_or_else(|| anyhow!("empty schema value"))?; + Ok(match (ty, value) { + (SchemaType::Stream { .. }, schema_value::Value::StreamReference(reference)) => { + serde_json::json!({ "$stream": reference.stream_id }) + } + (SchemaType::Record { fields, .. }, schema_value::Value::RecordValue(record)) => { + if fields.len() != record.fields.len() { + bail!("record result has the wrong number of fields"); + } + let mut result = serde_json::Map::new(); + for (field, value) in fields.iter().zip(&record.fields) { + result.insert( + field.name.clone(), + proto_value_to_json(graph, &field.body, value)?, + ); + } + serde_json::Value::Object(result) + } + (SchemaType::Tuple { elements, .. }, schema_value::Value::TupleValue(tuple)) => { + if elements.len() != tuple.elements.len() { + bail!("tuple result has the wrong number of elements"); + } + serde_json::Value::Array( + elements + .iter() + .zip(&tuple.elements) + .map(|(ty, value)| proto_value_to_json(graph, ty, value)) + .collect::>()?, + ) + } + (SchemaType::List { element, .. }, schema_value::Value::ListValue(list)) => { + serde_json::Value::Array( + list.elements + .iter() + .map(|value| proto_value_to_json(graph, element, value)) + .collect::>()?, + ) + } + (SchemaType::FixedList { element, .. }, schema_value::Value::FixedListValue(list)) => { + serde_json::Value::Array( + list.elements + .iter() + .map(|value| proto_value_to_json(graph, element, value)) + .collect::>()?, + ) + } + ( + SchemaType::Map { + key, + value: value_type, + .. + }, + schema_value::Value::MapValue(map), + ) => serde_json::Value::Array( + map.entries + .iter() + .map(|entry| { + Ok(serde_json::Value::Array(vec![ + proto_value_to_json( + graph, + key, + entry + .key + .as_ref() + .ok_or_else(|| anyhow!("map entry has no key"))?, + )?, + proto_value_to_json( + graph, + value_type, + entry + .value + .as_ref() + .ok_or_else(|| anyhow!("map entry has no value"))?, + )?, + ])) + }) + .collect::>()?, + ), + (SchemaType::Option { inner, .. }, schema_value::Value::OptionValue(option)) => option + .inner + .as_deref() + .map(|value| proto_value_to_json(graph, inner, value)) + .transpose()? + .unwrap_or(serde_json::Value::Null), + (SchemaType::Variant { cases, .. }, schema_value::Value::VariantValue(variant)) => { + let case = cases + .get(variant.case as usize) + .ok_or_else(|| anyhow!("variant case is out of range"))?; + match (&case.payload, variant.payload.as_deref()) { + (None, None) => case.name.clone().into(), + (Some(ty), Some(value)) => serde_json::json!({ + case.name.clone(): proto_value_to_json(graph, ty, value)? + }), + _ => bail!("variant payload does not match its declared case"), + } + } + (SchemaType::Result { spec, .. }, schema_value::Value::ResultValue(result)) => { + use golem_api_grpc::proto::golem::schema::result_value::Result; + match result.result.as_ref() { + Some(Result::Ok(value)) => serde_json::json!({ + "ok": proto_value_to_json( + graph, + spec.ok.as_deref().ok_or_else(|| anyhow!("unexpected ok payload"))?, + value, + )? + }), + Some(Result::Err(value)) => serde_json::json!({ + "err": proto_value_to_json( + graph, + spec.err.as_deref().ok_or_else(|| anyhow!("unexpected err payload"))?, + value, + )? + }), + Some(Result::OkUnit(_)) => serde_json::json!({ "ok": null }), + Some(Result::ErrUnit(_)) => serde_json::json!({ "err": null }), + None => bail!("result has no case"), + } + } + (SchemaType::Union { spec, .. }, schema_value::Value::UnionValue(union)) => { + let branch = spec + .branches + .iter() + .find(|branch| branch.tag == union.tag) + .ok_or_else(|| anyhow!("unknown union branch '{}'", union.tag))?; + proto_value_to_json( + graph, + &branch.body, + union + .body + .as_deref() + .ok_or_else(|| anyhow!("union has no body"))?, + )? + } + _ => bail!("invocation result does not match its declared schema"), + }) +} + +fn is_connection_closed(error: &tungstenite::Error) -> bool { + matches!( + error, + tungstenite::Error::ConnectionClosed | tungstenite::Error::AlreadyClosed + ) +} + +#[cfg(test)] +mod tests { + use super::*; + use golem_common::schema::agent::{InputSchema, NamedField}; + use golem_common::schema::metadata::MetadataEnvelope; + use golem_common::schema::schema_type::{BinaryRestrictions, NamedFieldType}; + use test_r::test; + + fn method(parameters: Vec, output_schema: OutputSchema) -> AgentMethodSchema { + AgentMethodSchema { + name: "test".to_string(), + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::parameters(parameters), + output_schema, + http_endpoint: Vec::new(), + read_only: None, + } + } + + #[test] + fn raw_stream_kind_resolves_refs() { + let graph = SchemaGraph::empty(); + assert_eq!( + raw_stream_kind(&graph, &SchemaType::u8()), + Some(RawStreamKind::U8) + ); + assert_eq!(raw_stream_kind(&graph, &SchemaType::string()), None); + } + + #[test] + fn value_stdin_parser_preserves_blank_strings() { + let value = parse_method_argument_schema_value( + "", + &SchemaGraph::empty(), + &SchemaType::string(), + &SourceLanguage::Rust, + ) + .unwrap(); + assert_eq!(value, SchemaValue::String(String::new())); + } + + #[test] + fn input_failure_uses_producer_cancellation() { + let request = input_cancel_request( + 1, + 4, + StreamCancelReason::Protocol, + "invalid input".to_string(), + ); + let Some(public_invocation_request::Request::StreamCancel(cancel)) = request.request else { + panic!("expected stream cancellation"); + }; + assert_eq!(cancel.stream_id, 1); + assert_eq!(cancel.offset, 4); + assert_eq!(cancel.role(), StreamCancelRole::InputProducer); + assert_eq!(cancel.reason(), StreamCancelReason::Protocol); + } + + #[test] + fn discovers_nested_output_streams() { + let graph = SchemaGraph::empty(); + let ty = SchemaType::Record { + fields: vec![NamedFieldType { + name: "items".to_string(), + body: SchemaType::stream(Some(SchemaType::u32())), + metadata: MetadataEnvelope::default(), + }], + metadata: MetadataEnvelope::default(), + }; + let value = ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![ProtoSchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: 3 }, + )), + }], + })), + }; + let mut streams = HashMap::new(); + discover_streams( + &graph, + &ty, + &value, + "$", + None, + InvocationStdoutFormat::Value, + &mut streams, + ) + .unwrap(); + assert_eq!(streams.get(&3).unwrap().path, "$.items"); + } + + #[test] + async fn raw_output_rejects_result_that_does_not_match_stream_schema() { + let graph = SchemaGraph::empty(); + let output_schema = + OutputSchema::Single(Box::new(SchemaType::stream(Some(SchemaType::u8())))); + let response = InvocationResponse { + response: Some(invocation_response::Response::Result( + golem_api_grpc::proto::golem::worker::InvocationSessionResult { + result: Some(invocation_session_result::Result::MethodResult( + SchemaValue::U8(1).try_into().unwrap(), + )), + ..Default::default() + }, + )), + }; + let (tx, _rx) = mpsc::channel(1); + let output = OutputChannel { + tx, + interrupt: CancellationToken::new(), + input_failed: CancellationToken::new(), + }; + + let result = handle_response( + response, + &graph, + &output_schema, + &SourceLanguage::Rust, + InvocationStdoutFormat::Raw, + false, + "session-key", + &mut SessionIdentity::default(), + &mut HashMap::new(), + &output, + ) + .await; + + assert!( + result.is_err(), + "raw output must reject a scalar result for a declared stream schema" + ); + } + + #[test] + fn text_rendering_preserves_scalar_fragments_around_streams() { + let graph = SchemaGraph::empty(); + let ty = SchemaType::Tuple { + elements: vec![ + SchemaType::string(), + SchemaType::stream(Some(SchemaType::u32())), + ], + metadata: MetadataEnvelope::default(), + }; + let value = ProtoSchemaValue { + value: Some(schema_value::Value::TupleValue( + golem_api_grpc::proto::golem::schema::TupleValue { + elements: vec![ + SchemaValue::String("metadata".to_string()) + .try_into() + .unwrap(), + ProtoSchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: 3 }, + )), + }, + ], + }, + )), + }; + + assert_eq!( + render_text_fragments(&graph, &ty, &value, "$", &SourceLanguage::Rust).unwrap(), + vec![("$[0]".to_string(), "\"metadata\"".to_string())] + ); + } + + #[test] + fn direct_stream_parameter_binds_stdin_with_odd_client_id() { + let graph = SchemaGraph::empty(); + let method = method( + vec![NamedField::user_supplied( + "values", + SchemaType::stream(Some(SchemaType::u32())), + )], + OutputSchema::Unit, + ); + let (parameters, binding) = prepare_method_parameters( + &graph, + &method, + vec!["-".to_string()], + &SourceLanguage::Rust, + InvocationStdinFormat::Value, + ) + .unwrap(); + + let binding = binding.unwrap(); + assert_eq!(binding.stream_id, 1); + assert_eq!(binding.parameter_name, "values"); + let Some(schema_value::Value::RecordValue(record)) = parameters.value else { + panic!("expected parameter record"); + }; + assert!(matches!( + record.fields[0].value, + Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: 1 } + )) + )); + } + + #[test] + fn multiple_and_nested_input_streams_are_rejected() { + let graph = SchemaGraph::empty(); + let direct = method( + vec![ + NamedField::user_supplied("left", SchemaType::stream(Some(SchemaType::u32()))), + NamedField::user_supplied("right", SchemaType::stream(Some(SchemaType::u32()))), + ], + OutputSchema::Unit, + ); + assert!( + prepare_method_parameters( + &graph, + &direct, + vec!["-".to_string(), "-".to_string()], + &SourceLanguage::Rust, + InvocationStdinFormat::Value, + ) + .unwrap_err() + .to_string() + .contains("one stream parameter") + ); + + let nested = method( + vec![NamedField::user_supplied( + "nested", + SchemaType::record(vec![NamedFieldType { + name: "values".to_string(), + body: SchemaType::stream(Some(SchemaType::u32())), + metadata: MetadataEnvelope::default(), + }]), + )], + OutputSchema::Unit, + ); + assert!( + prepare_method_parameters( + &graph, + &nested, + vec!["-".to_string()], + &SourceLanguage::Rust, + InvocationStdinFormat::Value, + ) + .unwrap_err() + .to_string() + .contains("direct stream") + ); + + let nested_item = method( + vec![NamedField::user_supplied( + "nested-item", + SchemaType::stream(Some(SchemaType::record(vec![NamedFieldType { + name: "values".to_string(), + body: SchemaType::stream(Some(SchemaType::u32())), + metadata: MetadataEnvelope::default(), + }]))), + )], + OutputSchema::Unit, + ); + assert!( + prepare_method_parameters( + &graph, + &nested_item, + vec!["-".to_string()], + &SourceLanguage::Rust, + InvocationStdinFormat::Value, + ) + .unwrap_err() + .to_string() + .contains("cannot contain nested streams") + ); + } + + #[test] + fn raw_formats_accept_only_direct_byte_streams() { + let graph = SchemaGraph::empty(); + let invalid_input = method( + vec![NamedField::user_supplied( + "values", + SchemaType::stream(Some(SchemaType::u32())), + )], + OutputSchema::Unit, + ); + assert!( + prepare_method_parameters( + &graph, + &invalid_input, + vec!["-".to_string()], + &SourceLanguage::Rust, + InvocationStdinFormat::Raw, + ) + .unwrap_err() + .to_string() + .contains("stream or stream") + ); + + validate_stdout_format( + &graph, + &OutputSchema::Single(Box::new(SchemaType::stream(Some(SchemaType::binary( + BinaryRestrictions::default(), + ))))), + InvocationStdoutFormat::Raw, + ) + .unwrap(); + assert!( + validate_stdout_format( + &graph, + &OutputSchema::Single(Box::new(SchemaType::record(vec![NamedFieldType { + name: "bytes".to_string(), + body: SchemaType::stream(Some(SchemaType::u8())), + metadata: MetadataEnvelope::default(), + }]))), + InvocationStdoutFormat::Raw, + ) + .unwrap_err() + .to_string() + .contains("one direct stream") + ); + } + + #[test] + fn structured_values_preserve_field_names_and_stream_references() { + let graph = SchemaGraph::empty(); + let ty = SchemaType::record(vec![ + NamedFieldType { + name: "count".to_string(), + body: SchemaType::u32(), + metadata: MetadataEnvelope::default(), + }, + NamedFieldType { + name: "items".to_string(), + body: SchemaType::stream(Some(SchemaType::string())), + metadata: MetadataEnvelope::default(), + }, + ]); + let value = ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![ + SchemaValue::U32(2).try_into().unwrap(), + ProtoSchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: 9 }, + )), + }, + ], + })), + }; + + assert_eq!( + proto_value_to_json(&graph, &ty, &value).unwrap(), + serde_json::json!({ "count": 2, "items": { "$stream": 9 } }) + ); + } + + #[test] + fn input_cancellation_is_detected_for_the_bound_stream_only() { + let response = InvocationResponse { + response: Some(invocation_response::Response::StreamCancel( + golem_api_grpc::proto::golem::worker::StreamCancel { + stream_id: 1, + offset: 0, + role: StreamCancelRole::InputConsumer as i32, + reason: StreamCancelReason::Cancelled as i32, + details: None, + }, + )), + }; + assert!(response_cancels_input(&response, Some(1))); + assert!(!response_cancels_input(&response, Some(3))); + } + + #[test] + async fn connection_truncation_before_finish_is_an_error() { + let (wire_tx, _wire_rx) = mpsc::channel(1); + let error = receive_response( + None, + &wire_tx, + &CancellationToken::new(), + &CancellationToken::new(), + ) + .await + .unwrap_err(); + assert!(error.to_string().contains("ended before completion")); + } + + #[test] + async fn event_after_finish_is_an_error() { + let (wire_tx, _wire_rx) = mpsc::channel(1); + let (_output_tx, mut output_rx) = oneshot::channel(); + let mut frames = futures_util::stream::iter([Ok(Message::Binary(Vec::new().into()))]); + let error = await_clean_close( + &mut frames, + &wire_tx, + &CancellationToken::new(), + &mut output_rx, + ) + .await + .unwrap_err(); + assert!(error.to_string().contains("event after completion")); + } + + #[test] + async fn clean_close_wait_is_interrupted() { + let (wire_tx, _wire_rx) = mpsc::channel(1); + let (_output_tx, mut output_rx) = oneshot::channel(); + let mut frames = futures_util::stream::pending(); + let interrupt = CancellationToken::new(); + interrupt.cancel(); + + let error = await_clean_close(&mut frames, &wire_tx, &interrupt, &mut output_rx) + .await + .unwrap_err(); + assert_eq!(error.downcast_ref::().unwrap().0, 130); + } + + #[test] + async fn clean_close_wait_reports_broken_pipe() { + let (wire_tx, _wire_rx) = mpsc::channel(1); + let (output_tx, mut output_rx) = oneshot::channel(); + let mut frames = futures_util::stream::pending(); + output_tx + .send(Err(anyhow!(PipedExitCode(0)))) + .expect("failed to send output error"); + + let error = await_clean_close( + &mut frames, + &wire_tx, + &CancellationToken::new(), + &mut output_rx, + ) + .await + .unwrap_err(); + assert_eq!(error.downcast_ref::().unwrap().0, 0); + } + + #[test] + async fn saturated_wire_send_is_interrupted() { + let (wire_tx, _wire_rx) = mpsc::channel(1); + wire_tx.try_send(Message::Ping(Vec::new().into())).unwrap(); + let interrupt = CancellationToken::new(); + let cancel = interrupt.clone(); + tokio::spawn(async move { + tokio::time::sleep(Duration::from_millis(10)).await; + cancel.cancel(); + }); + + let error = tokio::time::timeout( + Duration::from_secs(1), + send_message(&wire_tx, Message::Pong(Vec::new().into()), &interrupt), + ) + .await + .expect("saturated send did not observe cancellation") + .unwrap_err(); + assert_eq!(error.downcast_ref::().unwrap().0, 130); + } + + #[test] + async fn saturated_pong_send_observes_input_failure() { + let (wire_tx, _wire_rx) = mpsc::channel(1); + wire_tx.try_send(Message::Ping(Vec::new().into())).unwrap(); + let input_failed = CancellationToken::new(); + let cancel = input_failed.clone(); + tokio::spawn(async move { + tokio::time::sleep(Duration::from_millis(10)).await; + cancel.cancel(); + }); + + let error = tokio::time::timeout( + Duration::from_secs(1), + receive_response( + Some(Ok(Message::Ping(Vec::new().into()))), + &wire_tx, + &CancellationToken::new(), + &input_failed, + ), + ) + .await + .expect("saturated Pong send did not observe input failure") + .unwrap_err(); + assert!(error.downcast_ref::().is_some()); + } + + #[test] + async fn saturated_output_send_observes_input_failure() { + let (tx, _rx) = mpsc::channel(1); + tx.try_send(OutputJob::Text("first".to_string())).unwrap(); + let input_failed = CancellationToken::new(); + let cancel = input_failed.clone(); + tokio::spawn(async move { + tokio::time::sleep(Duration::from_millis(10)).await; + cancel.cancel(); + }); + let output = OutputChannel { + tx, + interrupt: CancellationToken::new(), + input_failed, + }; + + let error = tokio::time::timeout( + Duration::from_secs(1), + emit(&output, OutputJob::Text("second".to_string())), + ) + .await + .expect("saturated output send did not observe input failure") + .unwrap_err(); + assert!(error.downcast_ref::().is_some()); + } + + struct BrokenOnFlush { + bytes: Vec, + } + + impl Write for BrokenOnFlush { + fn write(&mut self, buffer: &[u8]) -> std::io::Result { + self.bytes.extend_from_slice(buffer); + Ok(buffer.len()) + } + + fn flush(&mut self) -> std::io::Result<()> { + Err(std::io::Error::new(ErrorKind::BrokenPipe, "closed")) + } + } + + #[test] + fn output_flush_detects_broken_pipe_after_one_raw_item() { + let (output_tx, output_rx) = mpsc::channel(1); + assert!(output_tx.try_send(OutputJob::Raw(vec![1])).is_ok()); + drop(output_tx); + let mut output = BrokenOnFlush { bytes: Vec::new() }; + + let error = write_output_to(output_rx, Format::Text, false, &mut output).unwrap_err(); + assert_eq!(output.bytes, vec![1]); + assert_eq!(error.downcast_ref::().unwrap().0, 0); + } +} diff --git a/cli/golem-cli/src/command_handler/worker/mod.rs b/cli/golem-cli/src/command_handler/worker/mod.rs index 3924faf518..d1ad104d87 100644 --- a/cli/golem-cli/src/command_handler/worker/mod.rs +++ b/cli/golem-cli/src/command_handler/worker/mod.rs @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +mod invocation_session; mod stream; mod stream_output; use crate::command::shared_args::{ AgentFunctionArgument, AgentFunctionName, AgentIdArgs, PostDeployArgs, StreamArgs, }; -use crate::command::worker::AgentSubcommand; +use crate::command::worker::{AgentSubcommand, InvocationStdinFormat, InvocationStdoutFormat}; use crate::command_handler::Handlers; use crate::command_handler::worker::stream::WorkerConnection; use crate::context::Context; @@ -26,8 +27,8 @@ use crate::error::NonSuccessfulExit; use crate::error::service::{MapServiceError, ServiceError}; use crate::fuzzy::{Error, FuzzySearch}; use crate::log::{ - LogColorize, LogIndent, log_action, log_error, log_error_action, log_failed_to, log_warn, - log_warn_action, logln, + LogColorize, LogIndent, LogOutput, Output as LogOutputTarget, log_action, log_error, + log_error_action, log_failed_to, log_warn, log_warn_action, logln, }; use crate::model::component::ComponentNameMatchKind; use crate::model::deploy::{TryUpdateAllWorkersResult, WorkerUpdateAttempt}; @@ -125,6 +126,8 @@ impl WorkerCommandHandler { idempotency_key, no_stream, stream_args, + stdin_format, + stdout_format, post_deploy_args, schedule_at, } => { @@ -136,6 +139,8 @@ impl WorkerCommandHandler { idempotency_key, no_stream, stream_args, + stdin_format, + stdout_format, post_deploy_args, schedule_at, ) @@ -340,9 +345,13 @@ impl WorkerCommandHandler { idempotency_key: Option, no_stream: bool, stream_args: StreamArgs, + stdin_format: InvocationStdinFormat, + stdout_format: InvocationStdoutFormat, post_deploy_args: Option, schedule_at: Option>, ) -> anyhow::Result<()> { + let _raw_output_guard = (stdout_format == InvocationStdoutFormat::Raw) + .then(|| LogOutput::new(LogOutputTarget::None)); self.ctx.silence_app_context_init().await; fn new_idempotency_key() -> IdempotencyKey { @@ -484,6 +493,66 @@ impl WorkerCommandHandler { AgentInvocationMode::Await }; + let method_uses_streams = agent_type + .methods + .iter() + .find(|method| method.name == method_name) + .is_some_and(|method| method.uses_streams(&agent_type.schema)); + if !method_uses_streams && stdin_format == InvocationStdinFormat::Raw { + bail!("--stdin-format raw requires a direct stream or stream parameter"); + } + if !method_uses_streams && stdout_format == InvocationStdoutFormat::Raw { + bail!("--stdout-format raw requires a direct stream or stream result"); + } + + if trigger && method_uses_streams { + bail!("Streaming agent methods require an attached invocation session"); + } + + if method_uses_streams { + let mut connect_handle = if !no_stream && stdout_format == InvocationStdoutFormat::Value + { + let connection = WorkerConnection::new( + self.ctx.worker_service_url().clone(), + self.ctx.auth_token().await?, + &component.id, + stream_agent_id.to_string(), + stream_args.into(), + self.ctx.allow_insecure(), + self.ctx.format(), + Some(idempotency_key.clone()), + ) + .await?; + Some(tokio::spawn(async move { connection.run_forever().await })) + } else { + None + }; + + let result = invocation_session::invoke( + self.ctx.clone(), + invocation_session::InvocationSessionArgs { + application_name: agent_name_match.environment.application_name.to_string(), + environment_name: agent_name_match.environment.environment_name.to_string(), + agent_type, + parsed_agent_id: stream_agent_id, + method_name, + arguments, + config: Vec::new(), + idempotency_key, + stdin_format, + stdout_format, + }, + ) + .await; + + if let Some(mut handle) = connect_handle.take() + && timeout(Duration::from_secs(3), &mut handle).await.is_err() + { + handle.abort(); + } + return result; + } + let source_language = SourceLanguage::from(agent_type.source_language.as_str()); let method_parameters = parse_method_parameters_with_error_table( &agent_type, @@ -2923,7 +2992,7 @@ fn parse_method_parameters_with_error_table( Ok(SchemaValue::Record { fields: values }) } -fn parse_method_argument_schema_value( +pub(super) fn parse_method_argument_schema_value( value: &str, graph: &SchemaGraph, schema: &SchemaType, diff --git a/cli/golem-cli/src/model/agent/invocation_session.rs b/cli/golem-cli/src/model/agent/invocation_session.rs new file mode 100644 index 0000000000..7ce6abc586 --- /dev/null +++ b/cli/golem-cli/src/model/agent/invocation_session.rs @@ -0,0 +1,79 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::model::cli_output::StructuredOutput; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct AgentInvocationSessionEvent { + pub kind: AgentInvocationSessionEventKind, + pub idempotency_key: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub component_revision: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub outcome: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub stream_id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub parent_stream_id: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub offset: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, +} + +impl StructuredOutput for AgentInvocationSessionEvent { + const KIND: &'static str = "agent.invoke-session"; +} + +#[derive(Clone, Copy, Debug, Serialize, Deserialize)] +#[serde(rename_all = "kebab-case")] +pub enum AgentInvocationSessionEventKind { + Accepted, + Rejected, + Result, + Item, + End, + StreamError, + StreamCancel, + Finished, +} + +impl AgentInvocationSessionEvent { + pub fn new(kind: AgentInvocationSessionEventKind, idempotency_key: impl Into) -> Self { + Self { + kind, + idempotency_key: idempotency_key.into(), + agent_id: None, + component_revision: None, + outcome: None, + reason: None, + error: None, + stream_id: None, + parent_stream_id: None, + path: None, + offset: None, + value: None, + } + } +} diff --git a/cli/golem-cli/src/model/agent/mod.rs b/cli/golem-cli/src/model/agent/mod.rs index d11839aacc..3f7a889c00 100644 --- a/cli/golem-cli/src/model/agent/mod.rs +++ b/cli/golem-cli/src/model/agent/mod.rs @@ -13,5 +13,6 @@ // limitations under the License. pub mod extraction; +pub mod invocation_session; pub mod stream; pub mod view; diff --git a/cli/golem-cli/src/model/cli_output.rs b/cli/golem-cli/src/model/cli_output.rs index 30d852afc6..17865849eb 100644 --- a/cli/golem-cli/src/model/cli_output.rs +++ b/cli/golem-cli/src/model/cli_output.rs @@ -378,6 +378,11 @@ mod tests { arb_agent_interrupt_result ), registry_entry!("InvokeResultView", "agent.invoke", arb_agent_invoke_result), + registry_entry!( + "AgentInvocationSessionEvent", + "agent.invoke-session", + arb_agent_invocation_session_event + ), registry_entry!( "AgentsMetadataResponseView", "agent.list", @@ -3021,6 +3026,71 @@ mod tests { ) } + fn arb_agent_invocation_session_event() -> OutputDocumentStrategy { + serialized_output( + ( + arb_agent_invocation_session_event_kind(), + arb_small_string(), + proptest::option::of(arb_small_string()), + proptest::option::of(arb_small_u64()), + ( + proptest::option::of(arb_small_string()), + proptest::option::of(arb_small_string()), + proptest::option::of(arb_small_string()), + proptest::option::of(arb_small_u64()), + ), + ( + proptest::option::of(arb_small_u64()), + proptest::option::of(arb_small_string()), + proptest::option::of(arb_small_u64()), + proptest::option::of(arb_json_value(1)), + ), + ) + .prop_map( + |( + kind, + idempotency_key, + agent_id, + component_revision, + (outcome, reason, error, stream_id), + (parent_stream_id, path, offset, value), + )| { + crate::model::agent::invocation_session::AgentInvocationSessionEvent { + kind, + idempotency_key, + agent_id, + component_revision, + outcome, + reason, + error, + stream_id, + parent_stream_id, + path, + offset, + value, + } + }, + ), + ) + } + + fn arb_agent_invocation_session_event_kind() + -> BoxedStrategy { + use crate::model::agent::invocation_session::AgentInvocationSessionEventKind; + + prop_oneof![ + Just(AgentInvocationSessionEventKind::Accepted), + Just(AgentInvocationSessionEventKind::Rejected), + Just(AgentInvocationSessionEventKind::Result), + Just(AgentInvocationSessionEventKind::Item), + Just(AgentInvocationSessionEventKind::End), + Just(AgentInvocationSessionEventKind::StreamError), + Just(AgentInvocationSessionEventKind::StreamCancel), + Just(AgentInvocationSessionEventKind::Finished), + ] + .boxed() + } + fn arb_agent_stream_event_kind() -> BoxedStrategy { prop_oneof![ diff --git a/cli/golem-cli/tests/app/agents.rs b/cli/golem-cli/tests/app/agents.rs index 5b0ab23cd7..14a4eafad3 100644 --- a/cli/golem-cli/tests/app/agents.rs +++ b/cli/golem-cli/tests/app/agents.rs @@ -1,5 +1,5 @@ use crate::app::{TestContext, cmd, flag, merge_into_manifest}; -use crate::crate_path; +use crate::{crate_path, workspace_path}; use std::path::PathBuf; fn test_data_path() -> PathBuf { @@ -21,6 +21,721 @@ use uuid::Uuid; inherit_test_dep!(Tracing); +async fn streaming_invocation_context() -> TestContext { + let mut ctx = TestContext::new(); + let component_dir = ctx.cwd_path_join("component"); + fs::create_dir_all(component_dir.join("src")).unwrap(); + + let fixture = workspace_path().join("test-components/agent-rpc/golem-it-agent-rpc-rust"); + fs::copy(fixture.join("src/lib.rs"), component_dir.join("src/lib.rs")).unwrap(); + + let sdk_path = workspace_path().join("sdks/rust/golem-rust"); + fs::write_str( + component_dir.join("Cargo.toml"), + formatdoc! {r#" + [package] + name = "golem_it_agent_rpc_rust" + version = "0.0.1" + edition = "2024" + + [profile.release] + opt-level = "s" + lto = true + + [lib] + crate-type = ["cdylib"] + path = "src/lib.rs" + + [dependencies] + bytes = "1.11.0" + log = {{ version = "0.4.29", features = ["kv"] }} + golem-rust = {{ path = "{sdk_path}", features = ["bytes", "export_golem_agentic"] }} + serde = {{ version = "1", features = ["derive"] }} + serde_json = "1" + wasi-fetch = "=0.2.0" + "#, sdk_path = sdk_path.display()}, + ) + .unwrap(); + + fs::write_str( + ctx.cwd_path_join("golem.yaml"), + formatdoc! {r#" + manifestVersion: {MANIFEST_VERSION} + + app: streaming-invocation + + componentTemplates: + rust-streaming-test: + build: + - command: cargo build --target wasm32-wasip2 --release + sources: + - "{{{{ componentDir }}}}/src" + - "{{{{ componentDir }}}}/Cargo.toml" + targets: + - "{{{{ cargoTarget }}}}/wasm32-wasip2/release/golem_it_agent_rpc_rust.wasm" + componentWasm: "{{{{ cargoTarget }}}}/wasm32-wasip2/release/golem_it_agent_rpc_rust.wasm" + outputWasm: "{{{{ golemTempDir }}}}/agents/golem_it_agent_rpc_rust.wasm" + + components: + golem-it:agent-rpc-rust: + dir: component + templates: rust-streaming-test + + environments: + local: + server: local + componentPresets: release + "#, MANIFEST_VERSION = versions::sdk::MANIFEST}, + ) + .unwrap(); + + ctx.start_server().await; + let outputs = ctx.cli([cmd::DEPLOY, flag::YES]).await; + assert!(outputs.success_or_dump()); + ctx +} + +fn streaming_agent(name: &str) -> String { + format!(r#"StreamingRpcTarget("{name}")"#) +} + +#[test] +#[timeout("15 minutes")] +async fn test_streaming_invocation_cli_end_to_end() { + let ctx = streaming_invocation_context().await; + let agent = streaming_agent(&Uuid::new_v4().to_string()); + + let scalar = ctx + .cli([cmd::AGENT, cmd::INVOKE, &agent, "increment_scalar"]) + .await; + assert!(scalar.success_or_dump()); + assert!(scalar.stdout_contains("Invocation result in Rust syntax:")); + assert!(scalar.stdout_contains("1")); + + let unit = ctx.cli([cmd::AGENT, cmd::INVOKE, &agent, "noop"]).await; + assert!(unit.success_or_dump()); + assert!(unit.stdout_contains("void")); + + let trigger_stream = ctx + .cli([ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce", + "[1]", + "--trigger", + ]) + .await; + assert!(!trigger_stream.success()); + assert!( + trigger_stream + .stderr_contains("Streaming agent methods require an attached invocation session") + ); + + let scheduled_stream = ctx + .cli([ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce", + "[1]", + "--trigger", + "--schedule-at", + "2030-01-01T00:00:00Z", + ]) + .await; + assert!(!scheduled_stream.success()); + assert!( + scheduled_stream + .stderr_contains("Streaming agent methods require an attached invocation session") + ); + + let value_input = ctx + .cli_with_input( + [cmd::AGENT, cmd::INVOKE, &agent, "consume", "-"], + b"1\n2\n3\n", + ) + .await; + assert!( + value_input.success(), + "value stdin failed: {}", + value_input.stderr_text() + ); + assert!(value_input.stdout_text().contains("[1, 2, 3]")); + + let string_input = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "consume_strings", + "-", + "--no-stream", + ], + b"first\n\nthird\n", + ) + .await; + assert!( + string_input.success(), + "string stdin failed: {}", + string_input.stderr_text() + ); + assert!( + string_input + .stdout_text() + .contains("[\"first\", \"\", \"third\"]\n") + ); + + let value_output = ctx + .cli_with_input( + [cmd::AGENT, cmd::INVOKE, &agent, "produce", "[4, 5, 6]"], + b"", + ) + .await; + assert!( + value_output.success(), + "value stdout failed: {}", + value_output.stderr_text() + ); + assert!(value_output.stdout_text().contains("4\n5\n6\n")); + + let bidirectional = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "transform", + "-", + "--no-stream", + ], + b"7\n8\n", + ) + .await; + assert!( + bidirectional.success(), + "bidirectional invocation failed: {}", + bidirectional.stderr_text() + ); + assert!(bidirectional.stdout_text().contains("70\n80\n")); + + let raw_output = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce_bytes", + "[0, 1, 2, 255]", + "--stdout-format", + "raw", + ], + b"", + ) + .await; + assert!( + raw_output.success(), + "raw stdout failed: {}", + raw_output.stderr_text() + ); + assert_eq!(raw_output.stdout(), &[0, 1, 2, 255]); + + let raw_input = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "consume_bytes", + "-", + "--stdin-format", + "raw", + "--no-stream", + ], + b"raw input", + ) + .await; + assert!( + raw_input.success(), + "raw stdin failed: {}", + raw_input.stderr_text() + ); + assert!( + raw_input + .stdout_text() + .contains("[114, 97, 119, 32, 105, 110, 112, 117, 116]") + ); + + let raw_bidirectional = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "transform_bytes", + "-", + "--stdin-format", + "raw", + "--stdout-format", + "raw", + ], + &[0, 9, 10, 255], + ) + .await; + assert!( + raw_bidirectional.success(), + "raw bidirectional invocation failed: {}", + raw_bidirectional.stderr_text() + ); + assert_eq!(raw_bidirectional.stdout(), &[0, 9, 10, 255]); + + let binary_input = (0..(64 * 1024 + 17)) + .map(|index| (index % 251) as u8) + .collect::>(); + let raw_binary = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "transform_binary", + "-", + "--stdin-format", + "raw", + "--stdout-format", + "raw", + ], + &binary_input, + ) + .await; + assert!( + raw_binary.success(), + "raw binary invocation failed: {}", + raw_binary.stderr_text() + ); + assert_eq!(raw_binary.stdout(), binary_input); + + let binary_chunks = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "consume_binary_chunks", + "-", + "--stdin-format", + "raw", + "--no-stream", + ], + &binary_input, + ) + .await; + assert!( + binary_chunks.success(), + "raw binary chunk check failed: {}", + binary_chunks.stderr_text() + ); + assert!(binary_chunks.stdout_text().contains("[65536, 17]\n")); + + let siblings = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce_siblings", + "--no-stream", + ], + b"", + ) + .await; + assert!( + siblings.success(), + "sibling output failed: {}", + siblings.stderr_text() + ); + let sibling_stdout = siblings.stdout_text(); + assert!(sibling_stdout.contains("$[0]: \"a\"")); + assert!(sibling_stdout.contains("$[0]: \"b\"")); + assert!(sibling_stdout.contains("$[1]: 63")); + + let nested = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce_nested_items", + "--no-stream", + ], + b"", + ) + .await; + assert!( + nested.success(), + "nested output failed: {}", + nested.stderr_text() + ); + let nested_stdout = nested.stdout_text(); + assert!(nested_stdout.contains("first")); + assert!(nested_stdout.contains("second")); + assert!(nested_stdout.contains("$[0].values")); + assert!(nested_stdout.contains("$[1].values")); + assert!(nested_stdout.contains("5")); + + let structured = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce", + "[9, 10]", + flag::FORMAT, + "json", + "--no-stream", + ], + b"", + ) + .await; + assert!( + structured.success(), + "structured invocation failed: {}", + structured.stderr_text() + ); + let events = structured + .stdout_text() + .lines() + .map(|line| serde_json::from_str::(line).unwrap()) + .collect::>(); + assert!( + events + .iter() + .all(|event| event["$type"] == "agent.invoke-session") + ); + let kinds = events + .iter() + .map(|event| event["kind"].as_str().unwrap()) + .collect::>(); + assert_eq!( + kinds, + ["accepted", "result", "item", "item", "end", "finished"] + ); + assert_eq!(events.last().unwrap()["outcome"], "success"); + + let scalar_and_stream = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce_scalar_and_stream", + flag::FORMAT, + "json", + "--no-stream", + ], + b"", + ) + .await; + assert!( + scalar_and_stream.success(), + "scalar-plus-stream invocation failed: {}", + scalar_and_stream.stderr_text() + ); + let scalar_and_stream_events = scalar_and_stream + .stdout_text() + .lines() + .map(|line| serde_json::from_str::(line).unwrap()) + .collect::>(); + assert_eq!(scalar_and_stream_events[1]["value"][0], "metadata"); + assert_eq!(scalar_and_stream_events[2]["value"], 11); + assert_eq!(scalar_and_stream_events[3]["value"], 12); + assert_eq!( + scalar_and_stream_events.last().unwrap()["outcome"], + "success" + ); + + let yaml = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce", + "[]", + flag::FORMAT, + "yaml", + "--no-stream", + ], + b"", + ) + .await; + assert!( + yaml.success(), + "YAML invocation failed: {}", + yaml.stderr_text() + ); + assert_eq!(yaml.stdout_text().matches("---\n").count(), 4); + + let toon = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce", + "[]", + flag::FORMAT, + "toon", + "--no-stream", + ], + b"", + ) + .await; + assert!( + toon.success(), + "TOON invocation failed: {}", + toon.stderr_text() + ); + assert_eq!(toon.stdout_text().matches("@toon\n").count(), 4); + assert_eq!(toon.stdout_text().matches("@end\n").count(), 4); + + let malformed_input = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "consume", + "-", + "--no-stream", + ], + b"1\nnot-a-u32\n3\n", + ) + .await; + assert!(!malformed_input.success()); + assert!( + malformed_input + .stderr_text() + .contains("parameter 'input' at line 2") + ); + + let drop_input_agent = streaming_agent(&Uuid::new_v4().to_string()); + let saturated_malformed_input = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &drop_input_agent, + "drop_input", + "-", + "--no-stream", + ], + format!("{}not-a-u32\n", "1\n".repeat(16)).as_bytes(), + ) + .await; + assert!(!saturated_malformed_input.success()); + assert!( + saturated_malformed_input + .stderr_text() + .contains("parameter 'input' at line 17") + ); + + let cancelled_valid_input_agent = streaming_agent(&Uuid::new_v4().to_string()); + let cancelled_valid_input = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &cancelled_valid_input_agent, + "drop_input", + "-", + "--no-stream", + ], + "1\n".repeat(64).as_bytes(), + ) + .await; + assert!( + cancelled_valid_input.success(), + "guest input cancellation failed with queued valid input: {}", + cancelled_valid_input.stderr_text() + ); + assert!(cancelled_valid_input.stdout_text().contains("42")); + + let cancelled_late_malformed_agent = streaming_agent(&Uuid::new_v4().to_string()); + let cancelled_late_malformed_input = format!("{}not-a-u32\n", "1\n".repeat(64)); + let cancelled_late_malformed = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &cancelled_late_malformed_agent, + "drop_input", + "-", + "--no-stream", + ], + cancelled_late_malformed_input.as_bytes(), + ) + .await; + assert!(!cancelled_late_malformed.success()); + assert!( + cancelled_late_malformed + .stderr_text() + .contains("parameter 'input' at line 65") + ); + + let held_input_agent = streaming_agent(&Uuid::new_v4().to_string()); + let held_input = format!("{}not-a-u32\n", "1\n".repeat(32)); + let held_malformed_input = tokio::time::timeout( + Duration::from_secs(10), + ctx.cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &held_input_agent, + "hold_input", + "-", + "--no-stream", + ], + held_input.as_bytes(), + ), + ) + .await + .expect("stdin parse failure remained blocked behind unacknowledged input"); + assert!(!held_malformed_input.success()); + assert!( + held_malformed_input + .stderr_text() + .contains("parameter 'input' at line 33") + ); + + let producer_error = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce_error", + "--no-stream", + ], + b"", + ) + .await; + assert!(!producer_error.success()); + assert!(producer_error.stdout_text().lines().any(|line| line == "1")); + assert!(producer_error.stderr_text().contains("Output stream")); + + let sibling_error = ctx + .cli_with_input( + [ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce_sibling_error", + "--no-stream", + ], + b"", + ) + .await; + assert!(!sibling_error.success()); + assert!(sibling_error.stderr_text().contains("Output stream")); + assert!(sibling_error.stdout_text().contains("$[1]: 63")); + + let broken_pipe = ctx + .cli_with_broken_stdout([ + cmd::AGENT, + cmd::INVOKE, + &agent, + "produce_byte_then_wait", + "--stdout-format", + "raw", + ]) + .await; + assert!( + broken_pipe.success(), + "broken stdout pipe was treated as failure (exit {:?}): {}", + broken_pipe.exit_code(), + broken_pipe.stderr_text() + ); + assert!(!broken_pipe.stderr_text().contains("Broken pipe")); + + let interrupted_agent = streaming_agent(&Uuid::new_v4().to_string()); + #[cfg(unix)] + { + let exit_code = ctx + .cli_ctrl_c_after( + [ + cmd::AGENT, + cmd::INVOKE, + &interrupted_agent, + "transform", + "-", + flag::FORMAT, + "json", + "--no-stream", + ], + "\"kind\":\"accepted\"", + Duration::ZERO, + ) + .await; + assert_eq!(exit_code, 130); + + let backpressured_agent = streaming_agent(&Uuid::new_v4().to_string()); + let exit_code = ctx + .cli_ctrl_c_after( + [ + cmd::AGENT, + cmd::INVOKE, + &backpressured_agent, + "produce_many_bytes", + "200000", + flag::FORMAT, + "json", + "--no-stream", + ], + "\"kind\":\"accepted\"", + Duration::from_secs(1), + ) + .await; + assert_eq!(exit_code, 130); + } + #[cfg(not(unix))] + { + let interactive_agent = interrupted_agent.clone(); + ctx.cli_interactive( + [ + cmd::AGENT, + cmd::INVOKE, + &interactive_agent, + "transform", + "-", + flag::FORMAT, + "json", + "--no-stream", + ], + |session| { + session.set_expect_timeout(Some(Duration::from_secs(30))); + session.expect_str("\"kind\":\"accepted\"")?; + session.send("\u{3}")?; + session.expect_eof() + }, + ) + .await; + } + + let after_interrupt = ctx + .cli([ + cmd::AGENT, + cmd::INVOKE, + &interrupted_agent, + "increment_scalar", + ]) + .await; + assert!(after_interrupt.success_or_dump()); + assert!(after_interrupt.stdout_contains("1")); +} + #[test] async fn test_rust_counter() { let mut ctx = TestContext::new(); diff --git a/cli/golem-cli/tests/app/mod.rs b/cli/golem-cli/tests/app/mod.rs index 1b1bd5fdbb..ac81275950 100644 --- a/cli/golem-cli/tests/app/mod.rs +++ b/cli/golem-cli/tests/app/mod.rs @@ -27,6 +27,8 @@ inherit_test_dep!(Tracing); use crate::{Tracing, crate_path, workspace_path}; use anyhow::Context; use colored::Colorize; +#[cfg(unix)] +use expectrl::process::unix::{Signal, WaitStatus}; use expectrl::{Eof, Expect}; use golem_cli::app::build::task_result_marker::{ ExtractComponentMetadataMarkerHash, TaskResultMarker, @@ -51,7 +53,7 @@ use std::thread::sleep; use std::time::Duration; use tempfile::TempDir; use test_r::inherit_test_dep; -use tokio::io::{AsyncBufReadExt, BufReader}; +use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader}; use tokio::process::{Child, Command}; use tokio::sync::mpsc; use tokio::time::Instant; @@ -123,6 +125,34 @@ pub struct Output { output: Vec, } +struct RawOutput { + status: ExitStatus, + stdout: Vec, + stderr: Vec, +} + +impl RawOutput { + fn success(&self) -> bool { + self.status.success() + } + + fn exit_code(&self) -> Option { + self.status.code() + } + + fn stdout(&self) -> &[u8] { + &self.stdout + } + + fn stdout_text(&self) -> String { + String::from_utf8_lossy(&self.stdout).into_owned() + } + + fn stderr_text(&self) -> String { + String::from_utf8_lossy(&self.stderr).into_owned() + } +} + impl Output { pub async fn stream_and_collect( quiet: bool, @@ -487,6 +517,121 @@ impl TestContext { .unwrap() } + async fn cli_with_input(&self, command_args: I, input: &[u8]) -> RawOutput + where + I: IntoIterator, + S: AsRef, + { + self.rewrite_local_http_domain_ports(); + + let mut args = vec![ + "--config-dir".to_string(), + self.config_dir.path().to_str().unwrap().to_string(), + ]; + args.extend( + command_args + .into_iter() + .map(|arg| arg.as_ref().to_str().unwrap().to_string()), + ); + + let working_dir = fs::absolute_lexical_path(&self.working_dir).unwrap(); + println!( + "{} {}", + "> working directory:".bold(), + working_dir.display() + ); + println!("{} {}", "> golem-cli".bold(), args.iter().join(" ").blue()); + + let mut child = Command::new(&self.golem_cli_path) + .args(args) + .env_remove("GOLEM_BUILTIN_LOCAL_URL") + .envs(&self.env) + .current_dir(&working_dir) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .unwrap(); + + let mut stdin = child.stdin.take().unwrap(); + let mut stdout = child.stdout.take().unwrap(); + let mut stderr = child.stderr.take().unwrap(); + let input = input.to_vec(); + + let write_input = async move { + stdin.write_all(&input).await?; + stdin.shutdown().await + }; + let read_stdout = async move { + let mut bytes = Vec::new(); + stdout.read_to_end(&mut bytes).await?; + Ok::<_, std::io::Error>(bytes) + }; + let read_stderr = async move { + let mut bytes = Vec::new(); + stderr.read_to_end(&mut bytes).await?; + Ok::<_, std::io::Error>(bytes) + }; + + let (input_result, stdout, stderr) = tokio::join!(write_input, read_stdout, read_stderr); + input_result.unwrap(); + + RawOutput { + status: child.wait().await.unwrap(), + stdout: stdout.unwrap(), + stderr: stderr.unwrap(), + } + } + + async fn cli_with_broken_stdout(&self, command_args: I) -> RawOutput + where + I: IntoIterator, + S: AsRef, + { + self.rewrite_local_http_domain_ports(); + + let mut args = vec![ + "--config-dir".to_string(), + self.config_dir.path().to_str().unwrap().to_string(), + ]; + args.extend( + command_args + .into_iter() + .map(|arg| arg.as_ref().to_str().unwrap().to_string()), + ); + + let working_dir = fs::absolute_lexical_path(&self.working_dir).unwrap(); + println!( + "{} {}", + "> working directory:".bold(), + working_dir.display() + ); + println!("{} {}", "> golem-cli".bold(), args.iter().join(" ").blue()); + + let mut child = Command::new(&self.golem_cli_path) + .args(args) + .env_remove("GOLEM_BUILTIN_LOCAL_URL") + .envs(&self.env) + .current_dir(&working_dir) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .unwrap(); + + drop(child.stdout.take()); + let mut stderr = child.stderr.take().unwrap(); + + let mut stderr_bytes = Vec::new(); + stderr.read_to_end(&mut stderr_bytes).await.unwrap(); + + RawOutput { + status: child.wait().await.unwrap(), + stdout: Vec::new(), + stderr: stderr_bytes, + } + } + async fn cli_interactive(&self, args: I, session_fn: F) where I: IntoIterator, @@ -547,6 +692,70 @@ impl TestContext { .unwrap() } + #[cfg(unix)] + async fn cli_ctrl_c_after( + &self, + command_args: I, + expected: &str, + pause_after_match: Duration, + ) -> i32 + where + I: IntoIterator, + S: AsRef, + { + self.rewrite_local_http_domain_ports(); + + let mut args = vec![ + "--config-dir".to_string(), + self.config_dir.path().to_str().unwrap().to_string(), + ]; + args.extend( + command_args + .into_iter() + .map(|arg| arg.as_ref().to_str().unwrap().to_string()), + ); + + let working_dir = fs::absolute_lexical_path(&self.working_dir).unwrap(); + let golem_cli_path = self.golem_cli_path.clone(); + let env = self.env.clone(); + let expected = expected.to_string(); + + tokio::task::spawn_blocking(move || { + let mut command = std::process::Command::new(golem_cli_path); + command + .current_dir(working_dir) + .env_remove("GOLEM_BUILTIN_LOCAL_URL") + .envs(env) + .env("TERM", "xterm-256color") + .args(args); + let mut session = expectrl::Session::spawn(command) + .expect("failed to spawn interactive golem-cli session"); + session.set_expect_timeout(Some(Duration::from_secs(30))); + session + .expect(expected.as_str()) + .expect("failed to observe invocation acceptance before Ctrl-C"); + std::thread::sleep(pause_after_match); + session + .get_process_mut() + .signal(Signal::SIGINT) + .expect("failed to send Ctrl-C"); + session + .expect(Eof) + .expect("failed to observe EOF after Ctrl-C"); + + match session + .get_process() + .wait() + .expect("failed to wait for golem-cli exit status") + { + WaitStatus::Exited(_, code) => code, + status => panic!("golem-cli did not exit normally after Ctrl-C: {status:?}"), + } + }) + .await + .expect("failed to run Ctrl-C CLI session") + } + async fn cli_interactive_repl_test(&mut self, args: I, session_fn: F) where I: IntoIterator, diff --git a/cli/golem-cli/tests/bridge_gen/moonbit.rs b/cli/golem-cli/tests/bridge_gen/moonbit.rs index b5f8524dec..6b3d9bbf52 100644 --- a/cli/golem-cli/tests/bridge_gen/moonbit.rs +++ b/cli/golem-cli/tests/bridge_gen/moonbit.rs @@ -445,6 +445,7 @@ fn guest_mode_generates_wasm_rpc_project_layout() { assert!(moon_pkg.contains(r#""golemcloud/golem_sdk/agents""#)); assert!(moon_pkg.contains(r#""golemcloud/golem_sdk/rpc""#)); assert!(moon_pkg.contains(r#""golemcloud/golem_sdk/schema_model" @model"#)); + assert!(moon_pkg.contains(r#""golemcloud/golem_sdk/schema_model_host" @model_host"#)); assert!(moon_pkg.contains(r#""golemcloud/golem_sdk/interface/golem/agent/common" @common"#)); assert!(moon_pkg.contains(r#""golemcloud/golem_sdk/interface/golem/core/types" @types"#)); assert!( diff --git a/cli/golem-cli/tests/bridge_gen/scala.rs b/cli/golem-cli/tests/bridge_gen/scala.rs index a190bb7daf..4a0e90fecf 100644 --- a/cli/golem-cli/tests/bridge_gen/scala.rs +++ b/cli/golem-cli/tests/bridge_gen/scala.rs @@ -419,7 +419,7 @@ fn guest_agent_client_surface_targets_scala_sdk_rpc() { assert!(client_source.contains("resolved.cancelableAsyncInvokeAndAwait")); assert!(client_source.contains("_root_.golem.runtime.rpc.CancellationToken")); assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.encodeValue")); - assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.decodeValue")); + assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.decodeResultAsync")); assert!(!client_source.contains("Bridge.createAgent")); assert!(!client_source.contains("golem.bridge.runtime")); diff --git a/cli/golem/src/router.rs b/cli/golem/src/router.rs index 633925158e..77d3165d2d 100644 --- a/cli/golem/src/router.rs +++ b/cli/golem/src/router.rs @@ -68,6 +68,10 @@ pub async fn start_router( // Worker endpoints .at("/v1/agents/create-agent", worker_service_api.clone()) .at("/v1/agents/invoke-agent", worker_service_api.clone()) + .at( + "/v1/agents/invoke-agent-session", + worker_service_api.clone(), + ) .at( "/v1/components/:component_id/workers", worker_service_api.clone(), diff --git a/docker-examples/published-postgres/nginx.conf.template b/docker-examples/published-postgres/nginx.conf.template index 1aee639480..54d41a6cda 100644 --- a/docker-examples/published-postgres/nginx.conf.template +++ b/docker-examples/published-postgres/nginx.conf.template @@ -39,6 +39,16 @@ server { proxy_pass http://worker-service; } + location = /v1/agents/invoke-agent-session { + proxy_pass http://worker-service; + proxy_http_version 1.1; + proxy_set_header Upgrade "websocket"; + proxy_set_header Connection "upgrade"; + + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + } + location /v1/agents { proxy_pass http://worker-service; } diff --git a/docs/src/content/next/how-to-guides/moonbit/golem-invoke-agent-moonbit.mdx b/docs/src/content/next/how-to-guides/moonbit/golem-invoke-agent-moonbit.mdx index 2a9909eaca..da7e0581d9 100644 --- a/docs/src/content/next/how-to-guides/moonbit/golem-invoke-agent-moonbit.mdx +++ b/docs/src/content/next/how-to-guides/moonbit/golem-invoke-agent-moonbit.mdx @@ -14,7 +14,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using MoonBit syntax. Multiple return values are rendered as a MoonBit tuple, for example `(1, "ok")`. Methods returning `Unit` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `Unit` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one MoonBit value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf 'Some(1)\nNone\n' | golem agent invoke 'MyAgent()' consume_values - +cat input.bin | golem agent invoke 'MyAgent()' consume_bytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as MoonBit values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produce_values --stdout-format value +golem agent invoke 'MyAgent()' produce_bytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -73,6 +91,8 @@ golem agent invoke 'staging/MyAgent("user-123")' get_status | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/docs/src/content/next/how-to-guides/rust/golem-invoke-agent-rust.mdx b/docs/src/content/next/how-to-guides/rust/golem-invoke-agent-rust.mdx index d1b01f7e0c..95bc1d0258 100644 --- a/docs/src/content/next/how-to-guides/rust/golem-invoke-agent-rust.mdx +++ b/docs/src/content/next/how-to-guides/rust/golem-invoke-agent-rust.mdx @@ -14,7 +14,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using Rust syntax. Multiple return values are rendered as a Rust tuple, for example `(1, "ok")`. Methods returning `()` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `()` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one Rust value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf 'Some(1)\nNone\n' | golem agent invoke 'MyAgent()' consume_values - +cat input.bin | golem agent invoke 'MyAgent()' consume_bytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as Rust values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produce_values --stdout-format value +golem agent invoke 'MyAgent()' produce_bytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -68,6 +86,8 @@ golem agent invoke 'staging/MyAgent("user-123")' get_status | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/docs/src/content/next/how-to-guides/scala/golem-invoke-agent-scala.mdx b/docs/src/content/next/how-to-guides/scala/golem-invoke-agent-scala.mdx index efecb3a8da..99f9a7a019 100644 --- a/docs/src/content/next/how-to-guides/scala/golem-invoke-agent-scala.mdx +++ b/docs/src/content/next/how-to-guides/scala/golem-invoke-agent-scala.mdx @@ -14,7 +14,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using Scala syntax. Multiple return values are rendered as a Scala tuple, for example `(1, "ok")`. Methods returning `Unit` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `Unit` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one Scala value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf 'Some(1)\nNone\n' | golem agent invoke 'MyAgent()' consumeValues - +cat input.bin | golem agent invoke 'MyAgent()' consumeBytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as Scala values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produceValues --stdout-format value +golem agent invoke 'MyAgent()' produceBytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -68,6 +86,8 @@ golem agent invoke 'staging/MyAgent("user-123")' getStatus | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/docs/src/content/next/how-to-guides/ts/golem-invoke-agent-ts.mdx b/docs/src/content/next/how-to-guides/ts/golem-invoke-agent-ts.mdx index afaec4b93d..e80ec44406 100644 --- a/docs/src/content/next/how-to-guides/ts/golem-invoke-agent-ts.mdx +++ b/docs/src/content/next/how-to-guides/ts/golem-invoke-agent-ts.mdx @@ -14,7 +14,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using TypeScript syntax. Multiple return values are rendered as a TypeScript tuple, for example `[1, "ok"]`. Methods returning `void` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `void` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one TypeScript value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf '{ value: 1 }\n{ value: 2 }\n' | golem agent invoke 'MyAgent()' consumeValues - +cat input.bin | golem agent invoke 'MyAgent()' consumeBytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as TypeScript values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produceValues --stdout-format value +golem agent invoke 'MyAgent()' produceBytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -68,6 +86,8 @@ golem agent invoke 'staging/MyAgent("user-123")' getStatus | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/docs/src/content/next/rest-api/agent.mdx b/docs/src/content/next/rest-api/agent.mdx index e22a7f87dc..e62ff6bd2f 100644 --- a/docs/src/content/next/rest-api/agent.mdx +++ b/docs/src/content/next/rest-api/agent.mdx @@ -99,6 +99,19 @@ Path|Method|Protected } ``` +## Invoke an agent through an attached live streaming session +Path|Method|Protected +---|---|--- +`/v1/agents/invoke-agent-session`|GET|Yes + + + + + + + + + ## undefined Path|Method|Protected ---|---|--- diff --git a/golem-api-grpc/proto/golem/worker/invocation_session.proto b/golem-api-grpc/proto/golem/worker/invocation_session.proto index 681436f852..88c128f3b5 100644 --- a/golem-api-grpc/proto/golem/worker/invocation_session.proto +++ b/golem-api-grpc/proto/golem/worker/invocation_session.proto @@ -33,91 +33,182 @@ message InvocationStart { InvocationFreshnessDisposition freshness_disposition = 13; } +message PublicInvocationStart { + string application_name = 1; + string environment_name = 2; + string agent_type_name = 3; + golem.schema.SchemaValue constructor_parameters = 4; + optional golem.common.UUID phantom_id = 5; + repeated golem.worker.AgentConfigEntryDto config = 6; + string method_name = 7; + golem.schema.SchemaValue method_parameters = 8; + golem.worker.IdempotencyKey idempotency_key = 9; +} + +message ResumeAttach { + golem.worker.IdempotencyKey idempotency_key = 1; +} + enum InvocationFreshnessDisposition { INVOCATION_FRESHNESS_DISPOSITION_MAY_EXIST = 0; INVOCATION_FRESHNESS_DISPOSITION_KNOWN_FRESH = 1; } -message InvocationResult { - oneof result { - golem.schema.SchemaValue method_result = 1; - golem.common.Empty no_result = 2; +message InputStreamItem { + uint64 stream_id = 1; + uint64 sequence = 2; + oneof payload { + golem.schema.SchemaValue value = 3; + bytes packed_u8 = 4; } - optional uint64 fuel_consumed = 3; - optional uint64 component_revision = 4; - optional golem.worker.InvocationStatus status = 5; - optional uint64 oplog_index = 6; - optional golem.common.UUID agent_fingerprint = 7; - optional golem.worker.AgentId agent_id = 8; - optional golem.worker.IdempotencyKey idempotency_key = 9; } -message StreamDemand { +message InputStreamEnd { uint64 stream_id = 1; + uint64 offset = 2; } -message StreamItem { +message OutputStreamItem { uint64 stream_id = 1; - golem.schema.SchemaValue value = 2; + uint64 offset = 2; + golem.schema.SchemaValue value = 3; } -message StreamEnd { +message OutputStreamEnd { uint64 stream_id = 1; + uint64 offset = 2; } -message StreamError { +message OutputStreamError { uint64 stream_id = 1; - string details = 2; + uint64 offset = 2; + string details = 3; } -message StreamDetach { +enum StreamCancelRole { + STREAM_CANCEL_ROLE_UNSPECIFIED = 0; + STREAM_CANCEL_ROLE_INPUT_PRODUCER = 1; + STREAM_CANCEL_ROLE_INPUT_CONSUMER = 2; + STREAM_CANCEL_ROLE_OUTPUT_PRODUCER = 3; + STREAM_CANCEL_ROLE_OUTPUT_CONSUMER = 4; +} + +enum StreamCancelReason { + STREAM_CANCEL_REASON_UNSPECIFIED = 0; + STREAM_CANCEL_REASON_CANCELLED = 1; + STREAM_CANCEL_REASON_TRANSPORT = 2; + STREAM_CANCEL_REASON_PROTOCOL = 3; +} + +message StreamCancel { uint64 stream_id = 1; + uint64 offset = 2; + StreamCancelRole role = 3; + StreamCancelReason reason = 4; + optional string details = 5; } -message InvocationProtocolFailure { - enum Kind { - PROTOCOL = 0; - DENIED = 1; - NOT_FOUND = 2; - REMOTE_INTERNAL = 3; - TRANSPORT = 4; - } +message InputStreamAck { + uint64 stream_id = 1; + uint64 sequence = 2; + uint64 logical_item_count = 3; +} - Kind kind = 1; - string details = 2; +message InvocationAccepted { + golem.worker.AgentId agent_id = 1; + golem.worker.IdempotencyKey idempotency_key = 2; + optional uint64 component_revision = 3; } -message InvocationCancel { - enum Kind { - SEMANTIC = 0; - TRANSPORT = 1; - PROTOCOL = 2; +message InvocationSessionResult { + oneof result { + golem.schema.SchemaValue method_result = 1; + golem.common.Empty no_result = 2; } + optional uint64 component_revision = 3; + golem.worker.AgentId agent_id = 4; + golem.worker.IdempotencyKey idempotency_key = 5; + optional uint64 fuel_consumed = 6; + optional golem.worker.InvocationStatus status = 7; + optional uint64 oplog_index = 8; + optional golem.common.UUID agent_fingerprint = 9; +} + +enum InvocationRejectionReason { + INVOCATION_REJECTION_REASON_UNSPECIFIED = 0; + INVOCATION_REJECTION_REASON_VALIDATION = 1; + INVOCATION_REJECTION_REASON_UNAUTHORIZED = 2; + INVOCATION_REJECTION_REASON_NOT_FOUND = 3; + INVOCATION_REJECTION_REASON_RESUME_UNSUPPORTED = 4; + INVOCATION_REJECTION_REASON_PROTOCOL = 5; + INVOCATION_REJECTION_REASON_INTERNAL = 6; +} + +message InvocationRejected { + InvocationRejectionReason reason = 1; + string error = 2; + golem.worker.IdempotencyKey idempotency_key = 3; + golem.worker.AgentId agent_id = 4; + optional uint64 component_revision = 5; +} + +message AttachmentRevoked { + string details = 1; +} + +enum InvocationFailureKind { + INVOCATION_FAILURE_KIND_UNSPECIFIED = 0; + INVOCATION_FAILURE_KIND_EXECUTION = 1; + INVOCATION_FAILURE_KIND_PROTOCOL = 2; + INVOCATION_FAILURE_KIND_INTERNAL = 3; + INVOCATION_FAILURE_KIND_TRANSPORT = 4; +} - Kind kind = 1; - optional string details = 2; +message InvocationFailure { + InvocationFailureKind kind = 1; + string code = 2; + string message = 3; + optional golem.worker.v1.WorkerExecutionError worker_error = 4; } -message InvocationSessionFinished { +message InvocationSessionCompletion { oneof outcome { golem.common.Empty success = 1; - golem.worker.v1.WorkerExecutionError failure = 2; - InvocationProtocolFailure protocol_failure = 3; + InvocationFailure failure = 2; } } -message InvocationFrame { - reserved 2 to 4; +message PublicInvocationRequest { + oneof request { + PublicInvocationStart start = 1; + ResumeAttach resume_attach = 2; + InputStreamItem input_item = 3; + InputStreamEnd input_end = 4; + StreamCancel stream_cancel = 5; + } +} - oneof frame { +message InvocationRequest { + oneof request { InvocationStart start = 1; - InvocationResult result = 5; - StreamDemand demand = 6; - StreamItem item = 7; - StreamEnd end = 8; - StreamError stream_error = 9; - StreamDetach detach = 10; - InvocationCancel cancel = 11; - InvocationSessionFinished finished = 12; + ResumeAttach resume_attach = 2; + InputStreamItem input_item = 3; + InputStreamEnd input_end = 4; + StreamCancel stream_cancel = 5; + } +} + +message InvocationResponse { + oneof response { + InvocationAccepted accepted = 1; + InvocationRejected rejected = 2; + InvocationSessionResult result = 3; + OutputStreamItem output_item = 4; + OutputStreamEnd output_end = 5; + OutputStreamError output_error = 6; + InputStreamAck input_ack = 7; + StreamCancel stream_cancel = 8; + AttachmentRevoked attachment_revoked = 9; + InvocationSessionCompletion finished = 10; } } diff --git a/golem-api-grpc/proto/golem/worker/v1/worker_service.proto b/golem-api-grpc/proto/golem/worker/v1/worker_service.proto index f22cefea2b..3d11f922bc 100644 --- a/golem-api-grpc/proto/golem/worker/v1/worker_service.proto +++ b/golem-api-grpc/proto/golem/worker/v1/worker_service.proto @@ -38,7 +38,9 @@ service WorkerService { rpc RevertWorker(RevertWorkerRequest) returns (RevertWorkerResponse); rpc CompletePromise (CompletePromiseRequest) returns (CompletePromiseResponse); rpc InvokeAgent (InvokeAgentRequest) returns (InvokeAgentResponse); - rpc InvokeAgentSession (stream golem.worker.InvocationFrame) returns (stream golem.worker.InvocationFrame); + // Internal executor-routing endpoint. Public clients use the authenticated + // agent-session WebSocket and its PublicInvocationRequest envelope. + rpc InvokeAgentSession (stream golem.worker.InvocationRequest) returns (stream golem.worker.InvocationResponse); rpc CancelInvocation (CancelInvocationRequest) returns (CancelInvocationResponse); rpc ProcessOplogEntries (ProcessOplogEntriesRequest) returns (ProcessOplogEntriesResponse); } diff --git a/golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto b/golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto index 606cccd014..624e6863d0 100644 --- a/golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto +++ b/golem-api-grpc/proto/golem/workerexecutor/v1/worker_executor.proto @@ -57,7 +57,7 @@ service WorkerExecutor { rpc ActivatePlugin(ActivatePluginRequest) returns (ActivatePluginResponse); rpc DeactivatePlugin(DeactivatePluginRequest) returns (DeactivatePluginResponse); - rpc InvokeAgentSession(stream golem.worker.InvocationFrame) returns (stream golem.worker.InvocationFrame); + rpc InvokeAgentSession(stream golem.worker.InvocationRequest) returns (stream golem.worker.InvocationResponse); rpc ProcessOplogEntries(ProcessOplogEntriesRequest) returns (ProcessOplogEntriesResponse); } diff --git a/golem-api-grpc/src/invocation_session_protocol.rs b/golem-api-grpc/src/invocation_session_protocol.rs new file mode 100644 index 0000000000..7437a98f55 --- /dev/null +++ b/golem-api-grpc/src/invocation_session_protocol.rs @@ -0,0 +1,1531 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::proto::golem::schema::{SchemaValue, result_value, schema_value}; +use crate::proto::golem::worker::input_stream_item::Payload; +use crate::proto::golem::worker::{ + AgentId, IdempotencyKey, InputStreamAck, InputStreamEnd, InputStreamItem, InvocationAccepted, + InvocationFailureKind, InvocationRejectionReason, InvocationRequest, InvocationResponse, + InvocationSessionCompletion, InvocationSessionResult, PublicInvocationRequest, StreamCancel, + StreamCancelReason, StreamCancelRole, invocation_request, invocation_response, + invocation_session_completion, invocation_session_result, public_invocation_request, +}; +use std::collections::{HashMap, HashSet, VecDeque}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum SessionPhase { + Initial, + AwaitDecision { resume: bool }, + Active, + Complete, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +struct PendingAck { + sequence: u64, + logical_item_count: u64, +} + +#[derive(Debug, Default)] +struct InputState { + next_offset: u64, + terminal: bool, + discard_next_offset: Option, + pending_acks: VecDeque, +} + +#[derive(Debug, Default)] +struct OutputState { + next_offset: u64, + terminal: bool, + cancellation_requested: Option, +} + +#[derive(Debug)] +pub struct InvocationSessionState { + phase: SessionPhase, + idempotency_key: Option, + accepted_agent_id: Option, + accepted_revision: Option, + has_result: bool, + inputs: HashMap, + outputs: HashMap, +} + +impl Default for InvocationSessionState { + fn default() -> Self { + Self { + phase: SessionPhase::Initial, + idempotency_key: None, + accepted_agent_id: None, + accepted_revision: None, + has_result: false, + inputs: HashMap::new(), + outputs: HashMap::new(), + } + } +} + +enum RequestMessage<'a> { + Start { + idempotency_key: &'a Option, + input: Option<&'a SchemaValue>, + }, + ResumeAttach { + idempotency_key: &'a Option, + }, + InputItem(&'a InputStreamItem), + InputEnd(&'a InputStreamEnd), + StreamCancel(&'a StreamCancel), +} + +impl InvocationSessionState { + pub fn validate_public_request( + &mut self, + request: &PublicInvocationRequest, + ) -> Result<(), String> { + let message = + match request.request.as_ref() { + Some(public_invocation_request::Request::Start(start)) => { + if start.application_name.is_empty() + || start.environment_name.is_empty() + || start.agent_type_name.is_empty() + || start.method_name.is_empty() + { + return Err("public invocation selectors must not be empty".to_string()); + } + if start.constructor_parameters.is_none() { + return Err("public invocation has no constructor parameters".to_string()); + } + RequestMessage::Start { + idempotency_key: &start.idempotency_key, + input: Some(start.method_parameters.as_ref().ok_or_else(|| { + "public invocation has no method parameters".to_string() + })?), + } + } + Some(public_invocation_request::Request::ResumeAttach(resume)) => { + RequestMessage::ResumeAttach { + idempotency_key: &resume.idempotency_key, + } + } + Some(public_invocation_request::Request::InputItem(item)) => { + RequestMessage::InputItem(item) + } + Some(public_invocation_request::Request::InputEnd(end)) => { + RequestMessage::InputEnd(end) + } + Some(public_invocation_request::Request::StreamCancel(cancel)) => { + RequestMessage::StreamCancel(cancel) + } + None => return Err("invocation request has no payload".to_string()), + }; + self.validate_request(message) + } + + pub fn validate_trusted_request(&mut self, request: &InvocationRequest) -> Result<(), String> { + let message = match request.request.as_ref() { + Some(invocation_request::Request::Start(start)) => RequestMessage::Start { + idempotency_key: &start.idempotency_key, + input: start.input.as_ref(), + }, + Some(invocation_request::Request::ResumeAttach(resume)) => { + RequestMessage::ResumeAttach { + idempotency_key: &resume.idempotency_key, + } + } + Some(invocation_request::Request::InputItem(item)) => RequestMessage::InputItem(item), + Some(invocation_request::Request::InputEnd(end)) => RequestMessage::InputEnd(end), + Some(invocation_request::Request::StreamCancel(cancel)) => { + RequestMessage::StreamCancel(cancel) + } + None => return Err("invocation request has no payload".to_string()), + }; + self.validate_request(message) + } + + pub fn validate_response(&mut self, response: &InvocationResponse) -> Result<(), String> { + if self.phase == SessionPhase::Complete { + return Err("invocation response received after completion".to_string()); + } + let response = response + .response + .as_ref() + .ok_or_else(|| "invocation response has no payload".to_string())?; + + match (self.phase, response) { + ( + SessionPhase::AwaitDecision { resume: false }, + invocation_response::Response::Accepted(accepted), + ) => self.accept(accepted), + ( + SessionPhase::AwaitDecision { resume }, + invocation_response::Response::Rejected(rejected), + ) => { + let reason = + InvocationRejectionReason::try_from(rejected.reason).map_err(|_| { + format!("invalid invocation rejection reason {}", rejected.reason) + })?; + if reason == InvocationRejectionReason::Unspecified { + return Err("invocation rejection reason is unspecified".to_string()); + } + if resume && reason != InvocationRejectionReason::ResumeUnsupported { + return Err("resume-attach must be rejected as resume-unsupported".to_string()); + } + self.validate_idempotency_key(&rejected.idempotency_key)?; + self.phase = SessionPhase::Complete; + Ok(()) + } + (SessionPhase::AwaitDecision { resume: true }, _) => { + Err("resume-attach must receive invocation-rejected".to_string()) + } + (SessionPhase::AwaitDecision { resume: false }, _) => { + Err("invocation must be accepted or rejected before other responses".to_string()) + } + (SessionPhase::Active, invocation_response::Response::Accepted(_)) => { + Err("invocation response contains more than one acceptance".to_string()) + } + (SessionPhase::Active, invocation_response::Response::Rejected(_)) => { + Err("invocation rejection may only appear before acceptance".to_string()) + } + (SessionPhase::Active, invocation_response::Response::Result(result)) => { + self.validate_result(result) + } + (SessionPhase::Active, invocation_response::Response::OutputItem(item)) => { + let value = item + .value + .as_ref() + .ok_or_else(|| "output stream item has no value".to_string())?; + let state = self + .outputs + .get(&item.stream_id) + .ok_or_else(|| format!("output stream {} is unknown", item.stream_id))?; + ensure_open(state.terminal, item.stream_id)?; + if item.offset != state.next_offset { + return Err(format!( + "output stream {} expected offset {}, got {}", + item.stream_id, state.next_offset, item.offset + )); + } + let discovered = stream_references(value)?; + self.ensure_new_output_streams(&discovered)?; + let state = self.outputs.get_mut(&item.stream_id).unwrap(); + state.next_offset = state + .next_offset + .checked_add(1) + .ok_or_else(|| format!("output stream {} offset overflow", item.stream_id))?; + self.insert_output_streams(discovered); + Ok(()) + } + (SessionPhase::Active, invocation_response::Response::OutputEnd(end)) => { + self.terminate_output(end.stream_id, end.offset) + } + (SessionPhase::Active, invocation_response::Response::OutputError(error)) => { + self.terminate_output(error.stream_id, error.offset) + } + (SessionPhase::Active, invocation_response::Response::InputAck(ack)) => { + self.validate_ack(ack) + } + (SessionPhase::Active, invocation_response::Response::StreamCancel(cancel)) => { + validate_cancel(cancel)?; + match cancel.role() { + StreamCancelRole::InputConsumer => { + self.cancel_input(cancel.stream_id, cancel.offset, true) + } + StreamCancelRole::OutputProducer => { + self.confirm_output_cancellation(cancel.stream_id, cancel.offset) + } + _ => Err( + "server response may only cancel an input consumer or output producer" + .to_string(), + ), + } + } + (SessionPhase::Active, invocation_response::Response::AttachmentRevoked(_)) => { + Err("attachment-revoked is not supported by GOL-91".to_string()) + } + (SessionPhase::Active, invocation_response::Response::Finished(finished)) => { + self.finish(finished) + } + (SessionPhase::Initial, _) => { + Err("invocation response received before the first request".to_string()) + } + (SessionPhase::Complete, _) => unreachable!(), + } + } + + pub fn is_complete(&self) -> bool { + self.phase == SessionPhase::Complete + } + + fn validate_request(&mut self, message: RequestMessage<'_>) -> Result<(), String> { + match (self.phase, message) { + ( + SessionPhase::Initial, + RequestMessage::Start { + idempotency_key, + input, + }, + ) => self.start(idempotency_key, input, false), + (SessionPhase::Initial, RequestMessage::ResumeAttach { idempotency_key }) => { + self.start(idempotency_key, None, true) + } + (SessionPhase::Initial, _) => { + Err("the first invocation request must be start or resume-attach".to_string()) + } + (SessionPhase::AwaitDecision { .. }, _) => { + Err("invocation input may only be sent after acceptance".to_string()) + } + ( + SessionPhase::Active, + RequestMessage::Start { .. } | RequestMessage::ResumeAttach { .. }, + ) => Err( + "invocation start or resume-attach may only appear as the first request" + .to_string(), + ), + (SessionPhase::Active, RequestMessage::InputItem(item)) => { + self.validate_input_item(item) + } + (SessionPhase::Active, RequestMessage::InputEnd(end)) => { + self.terminate_input(end.stream_id, end.offset) + } + (SessionPhase::Active, RequestMessage::StreamCancel(cancel)) => { + validate_cancel(cancel)?; + match cancel.role() { + StreamCancelRole::InputProducer => { + self.cancel_input(cancel.stream_id, cancel.offset, false) + } + StreamCancelRole::OutputConsumer => { + self.request_output_cancellation(cancel.stream_id, cancel.offset) + } + _ => Err( + "client request may only cancel an input producer or output consumer" + .to_string(), + ), + } + } + (SessionPhase::Complete, _) => { + Err("invocation request received after completion".to_string()) + } + } + } + + fn start( + &mut self, + idempotency_key: &Option, + input: Option<&SchemaValue>, + resume: bool, + ) -> Result<(), String> { + let key = required_idempotency_key(idempotency_key)?; + let stream_ids = input + .map(stream_references) + .transpose()? + .unwrap_or_default(); + self.inputs = stream_ids + .into_iter() + .map(|stream_id| (stream_id, InputState::default())) + .collect(); + self.idempotency_key = Some(key.to_string()); + self.phase = SessionPhase::AwaitDecision { resume }; + Ok(()) + } + + fn accept(&mut self, accepted: &InvocationAccepted) -> Result<(), String> { + self.validate_idempotency_key(&accepted.idempotency_key)?; + let agent_id = accepted + .agent_id + .as_ref() + .ok_or_else(|| "invocation acceptance has no agent identity".to_string())?; + self.accepted_agent_id = Some(agent_id.clone()); + self.accepted_revision = accepted.component_revision; + self.phase = SessionPhase::Active; + Ok(()) + } + + fn validate_result(&mut self, result: &InvocationSessionResult) -> Result<(), String> { + if self.has_result { + return Err("invocation response contains more than one result".to_string()); + } + self.validate_identity(&result.agent_id, &result.idempotency_key)?; + if let (Some(accepted), Some(result)) = (self.accepted_revision, result.component_revision) + && accepted != result + { + return Err(format!( + "invocation result revision {result} differs from accepted revision {accepted}" + )); + } + let discovered = match result.result.as_ref() { + Some(invocation_session_result::Result::MethodResult(value)) => { + stream_references(value)? + } + Some(invocation_session_result::Result::NoResult(_)) => Vec::new(), + None => return Err("invocation result has no value".to_string()), + }; + self.ensure_new_output_streams(&discovered)?; + self.insert_output_streams(discovered); + self.has_result = true; + Ok(()) + } + + fn validate_input_item(&mut self, item: &InputStreamItem) -> Result<(), String> { + let (logical_item_count, discovered) = match item.payload.as_ref() { + Some(Payload::Value(value)) => (1, stream_references(value)?), + Some(Payload::PackedU8(bytes)) if !bytes.is_empty() => (bytes.len() as u64, Vec::new()), + Some(Payload::PackedU8(_)) => { + return Err("packed-u8 input item must not be empty".to_string()); + } + None => return Err("input stream item has no payload".to_string()), + }; + self.ensure_new_input_streams(&discovered)?; + let state = self + .inputs + .get_mut(&item.stream_id) + .ok_or_else(|| format!("input stream {} is unknown", item.stream_id))?; + if let Some(discard_next_offset) = state.discard_next_offset.as_mut() { + if item.sequence != *discard_next_offset { + return Err(format!( + "cancelled input stream {} expected discarded sequence {}, got {}", + item.stream_id, *discard_next_offset, item.sequence + )); + } + *discard_next_offset = discard_next_offset + .checked_add(logical_item_count) + .ok_or_else(|| format!("input stream {} offset overflow", item.stream_id))?; + self.insert_input_streams(discovered); + return Ok(()); + } + ensure_open(state.terminal, item.stream_id)?; + if item.sequence != state.next_offset { + return Err(format!( + "input stream {} expected sequence {}, got {}", + item.stream_id, state.next_offset, item.sequence + )); + } + let next_offset = state + .next_offset + .checked_add(logical_item_count) + .ok_or_else(|| format!("input stream {} offset overflow", item.stream_id))?; + state.pending_acks.push_back(PendingAck { + sequence: item.sequence, + logical_item_count, + }); + state.next_offset = next_offset; + self.insert_input_streams(discovered); + Ok(()) + } + + fn validate_ack(&mut self, ack: &InputStreamAck) -> Result<(), String> { + let state = self + .inputs + .get_mut(&ack.stream_id) + .ok_or_else(|| format!("input stream {} is unknown", ack.stream_id))?; + let expected = state.pending_acks.front().ok_or_else(|| { + format!( + "input stream {} has no item awaiting acknowledgement", + ack.stream_id + ) + })?; + if ack.sequence != expected.sequence + || ack.logical_item_count != expected.logical_item_count + { + return Err(format!( + "input stream {} expected acknowledgement ({}, {}), got ({}, {})", + ack.stream_id, + expected.sequence, + expected.logical_item_count, + ack.sequence, + ack.logical_item_count + )); + } + state.pending_acks.pop_front(); + Ok(()) + } + + fn terminate_input(&mut self, stream_id: u64, offset: u64) -> Result<(), String> { + let state = self + .inputs + .get_mut(&stream_id) + .ok_or_else(|| format!("input stream {stream_id} is unknown"))?; + if let Some(discard_next_offset) = state.discard_next_offset { + if offset != discard_next_offset { + return Err(format!( + "cancelled input stream {stream_id} expected discarded terminal offset {discard_next_offset}, got {offset}" + )); + } + state.discard_next_offset = None; + return Ok(()); + } + ensure_open(state.terminal, stream_id)?; + if offset != state.next_offset { + return Err(format!( + "input stream {stream_id} expected terminal offset {}, got {offset}", + state.next_offset + )); + } + state.terminal = true; + Ok(()) + } + + fn cancel_input( + &mut self, + stream_id: u64, + offset: u64, + discard_in_flight: bool, + ) -> Result<(), String> { + let state = self + .inputs + .get_mut(&stream_id) + .ok_or_else(|| format!("input stream {stream_id} is unknown"))?; + ensure_open(state.terminal, stream_id)?; + let accepted_offset = state + .pending_acks + .front() + .map(|pending| pending.sequence) + .unwrap_or(state.next_offset); + if offset != accepted_offset { + return Err(format!( + "input stream {stream_id} expected cancellation offset {accepted_offset}, got {offset}" + )); + } + if discard_in_flight { + state.discard_next_offset = Some(state.next_offset); + } + state.next_offset = offset; + state.pending_acks.clear(); + state.terminal = true; + Ok(()) + } + + fn terminate_output(&mut self, stream_id: u64, offset: u64) -> Result<(), String> { + let state = self + .outputs + .get_mut(&stream_id) + .ok_or_else(|| format!("output stream {stream_id} is unknown"))?; + ensure_open(state.terminal, stream_id)?; + if offset != state.next_offset { + return Err(format!( + "output stream {stream_id} expected terminal offset {}, got {offset}", + state.next_offset + )); + } + state.terminal = true; + Ok(()) + } + + fn request_output_cancellation(&mut self, stream_id: u64, offset: u64) -> Result<(), String> { + let state = self + .outputs + .get_mut(&stream_id) + .ok_or_else(|| format!("output stream {stream_id} is unknown"))?; + ensure_open(state.terminal, stream_id)?; + if state.cancellation_requested.is_some() { + return Err(format!( + "output stream {stream_id} already has a pending consumer cancellation" + )); + } + if offset > state.next_offset { + return Err(format!( + "output stream {stream_id} cannot cancel at future offset {offset}; latest observed offset is {}", + state.next_offset + )); + } + state.cancellation_requested = Some(offset); + Ok(()) + } + + fn confirm_output_cancellation(&mut self, stream_id: u64, offset: u64) -> Result<(), String> { + let requested = { + let state = self + .outputs + .get(&stream_id) + .ok_or_else(|| format!("output stream {stream_id} is unknown"))?; + ensure_open(state.terminal, stream_id)?; + state.cancellation_requested + }; + match requested { + Some(requested_offset) if offset != requested_offset => Err(format!( + "output stream {stream_id} expected cancellation confirmation at offset {requested_offset}, got {offset}" + )), + Some(_) => { + self.outputs + .get_mut(&stream_id) + .expect("output stream disappeared while confirming cancellation") + .terminal = true; + Ok(()) + } + None => self.terminate_output(stream_id, offset), + } + } + + fn finish(&mut self, finished: &InvocationSessionCompletion) -> Result<(), String> { + match finished.outcome.as_ref() { + Some(invocation_session_completion::Outcome::Success(_)) if !self.has_result => { + return Err( + "invocation completed successfully before publishing a result".to_string(), + ); + } + Some(invocation_session_completion::Outcome::Failure(failure)) => { + let kind = InvocationFailureKind::try_from(failure.kind) + .map_err(|_| format!("invalid invocation failure kind {}", failure.kind))?; + if kind == InvocationFailureKind::Unspecified { + return Err("invocation failure kind is unspecified".to_string()); + } + if failure.worker_error.is_some() && kind != InvocationFailureKind::Execution { + return Err( + "worker execution details require an execution failure kind".to_string() + ); + } + } + Some(invocation_session_completion::Outcome::Success(_)) => {} + None => return Err("invocation completion has no outcome".to_string()), + } + let unterminated_inputs = self + .inputs + .iter() + .filter_map(|(stream_id, state)| (!state.terminal).then_some(*stream_id)) + .collect::>(); + if !unterminated_inputs.is_empty() { + return Err(format!( + "invocation completed before input streams terminated: {unterminated_inputs:?}" + )); + } + let unacknowledged_inputs = self + .inputs + .iter() + .filter_map(|(stream_id, state)| (!state.pending_acks.is_empty()).then_some(*stream_id)) + .collect::>(); + if !unacknowledged_inputs.is_empty() { + return Err(format!( + "invocation completed with unacknowledged input streams: {unacknowledged_inputs:?}" + )); + } + let unterminated_outputs = self + .outputs + .iter() + .filter_map(|(stream_id, state)| (!state.terminal).then_some(*stream_id)) + .collect::>(); + if !unterminated_outputs.is_empty() { + return Err(format!( + "invocation completed before output streams terminated: {unterminated_outputs:?}" + )); + } + self.phase = SessionPhase::Complete; + Ok(()) + } + + fn validate_idempotency_key(&self, key: &Option) -> Result<(), String> { + let actual = required_idempotency_key(key)?; + let expected = self + .idempotency_key + .as_deref() + .ok_or_else(|| "invocation has no idempotency key".to_string())?; + if actual != expected { + return Err(format!( + "invocation idempotency key mismatch: expected {expected}, got {actual}" + )); + } + Ok(()) + } + + fn validate_identity( + &self, + agent_id: &Option, + idempotency_key: &Option, + ) -> Result<(), String> { + self.validate_idempotency_key(idempotency_key)?; + let actual = agent_id + .as_ref() + .ok_or_else(|| "invocation result has no agent identity".to_string())?; + let expected = self + .accepted_agent_id + .as_ref() + .ok_or_else(|| "invocation has no accepted agent identity".to_string())?; + if actual != expected { + return Err("invocation result agent identity differs from acceptance".to_string()); + } + Ok(()) + } + + fn ensure_new_input_streams(&self, stream_ids: &[u64]) -> Result<(), String> { + for stream_id in stream_ids { + if self.inputs.contains_key(stream_id) || self.outputs.contains_key(stream_id) { + return Err(format!("stream {stream_id} is already registered")); + } + } + Ok(()) + } + + fn insert_input_streams(&mut self, stream_ids: Vec) { + for stream_id in stream_ids { + self.inputs.insert(stream_id, InputState::default()); + } + } + + fn ensure_new_output_streams(&self, stream_ids: &[u64]) -> Result<(), String> { + for stream_id in stream_ids { + if self.inputs.contains_key(stream_id) || self.outputs.contains_key(stream_id) { + return Err(format!("stream {stream_id} is already registered")); + } + } + Ok(()) + } + + fn insert_output_streams(&mut self, stream_ids: Vec) { + for stream_id in stream_ids { + self.outputs.insert(stream_id, OutputState::default()); + } + } +} + +fn required_idempotency_key(key: &Option) -> Result<&str, String> { + let value = key + .as_ref() + .ok_or_else(|| "invocation has no idempotency key".to_string())? + .value + .as_str(); + if value.is_empty() { + Err("invocation idempotency key is empty".to_string()) + } else { + Ok(value) + } +} + +fn validate_cancel(cancel: &StreamCancel) -> Result<(), String> { + let role = StreamCancelRole::try_from(cancel.role) + .map_err(|_| format!("invalid stream cancellation role {}", cancel.role))?; + if role == StreamCancelRole::Unspecified { + return Err("stream cancellation role is unspecified".to_string()); + } + let reason = StreamCancelReason::try_from(cancel.reason) + .map_err(|_| format!("invalid stream cancellation reason {}", cancel.reason))?; + if reason == StreamCancelReason::Unspecified { + return Err("stream cancellation reason is unspecified".to_string()); + } + Ok(()) +} + +fn ensure_open(terminal: bool, stream_id: u64) -> Result<(), String> { + if terminal { + Err(format!( + "stream {stream_id} received an event after its terminal" + )) + } else { + Ok(()) + } +} + +fn stream_references(value: &SchemaValue) -> Result, String> { + fn visit( + value: &SchemaValue, + stream_ids: &mut Vec, + unique: &mut HashSet, + ) -> Result<(), String> { + match value + .value + .as_ref() + .ok_or_else(|| "schema value has no payload".to_string())? + { + schema_value::Value::RecordValue(record) => { + for field in &record.fields { + visit(field, stream_ids, unique)?; + } + } + schema_value::Value::VariantValue(variant) => { + if let Some(payload) = variant.payload.as_deref() { + visit(payload, stream_ids, unique)?; + } + } + schema_value::Value::TupleValue(tuple) => { + for element in &tuple.elements { + visit(element, stream_ids, unique)?; + } + } + schema_value::Value::ListValue(list) => { + for element in &list.elements { + visit(element, stream_ids, unique)?; + } + } + schema_value::Value::FixedListValue(list) => { + for element in &list.elements { + visit(element, stream_ids, unique)?; + } + } + schema_value::Value::MapValue(map) => { + for entry in &map.entries { + if let Some(key) = entry.key.as_ref() { + visit(key, stream_ids, unique)?; + } + if let Some(value) = entry.value.as_ref() { + visit(value, stream_ids, unique)?; + } + } + } + schema_value::Value::OptionValue(option) => { + if let Some(inner) = option.inner.as_deref() { + visit(inner, stream_ids, unique)?; + } + } + schema_value::Value::ResultValue(result) => match result.result.as_ref() { + Some(result_value::Result::Ok(value) | result_value::Result::Err(value)) => { + visit(value, stream_ids, unique)?; + } + Some(result_value::Result::OkUnit(_) | result_value::Result::ErrUnit(_)) => {} + None => return Err("result schema value has no payload".to_string()), + }, + schema_value::Value::UnionValue(union) => { + if let Some(body) = union.body.as_deref() { + visit(body, stream_ids, unique)?; + } + } + schema_value::Value::StreamReference(reference) => { + if !unique.insert(reference.stream_id) { + return Err(format!( + "stream {} is referenced more than once", + reference.stream_id + )); + } + stream_ids.push(reference.stream_id); + } + _ => {} + } + Ok(()) + } + + let mut stream_ids = Vec::new(); + visit(value, &mut stream_ids, &mut HashSet::new())?; + Ok(stream_ids) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::proto::golem::common::Empty; + use crate::proto::golem::schema::{RecordValue, SchemaValueStreamReference}; + use crate::proto::golem::worker::{ + InvocationFailure, InvocationRejected, InvocationStart, OutputStreamEnd, OutputStreamError, + OutputStreamItem, PublicInvocationStart, ResumeAttach, + }; + use prost::Message; + use test_r::test; + + const KEY: &str = "session-key"; + + fn key() -> Option { + Some(IdempotencyKey { + value: KEY.to_string(), + }) + } + + fn scalar(value: u32) -> SchemaValue { + SchemaValue { + value: Some(schema_value::Value::U8Value(value)), + } + } + + fn stream(stream_id: u64) -> SchemaValue { + SchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id }, + )), + } + } + + fn record(fields: Vec) -> SchemaValue { + SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { fields })), + } + } + + fn public_request(request: public_invocation_request::Request) -> PublicInvocationRequest { + PublicInvocationRequest { + request: Some(request), + } + } + + fn trusted_request(request: invocation_request::Request) -> InvocationRequest { + InvocationRequest { + request: Some(request), + } + } + + fn response(response: invocation_response::Response) -> InvocationResponse { + InvocationResponse { + response: Some(response), + } + } + + fn public_start(input: SchemaValue) -> PublicInvocationRequest { + public_request(public_invocation_request::Request::Start( + PublicInvocationStart { + application_name: "app".to_string(), + environment_name: "env".to_string(), + agent_type_name: "agent-type".to_string(), + constructor_parameters: Some(record(Vec::new())), + method_name: "run".to_string(), + method_parameters: Some(input), + idempotency_key: key(), + ..Default::default() + }, + )) + } + + fn trusted_start(input: SchemaValue) -> InvocationRequest { + trusted_request(invocation_request::Request::Start(InvocationStart { + input: Some(input), + idempotency_key: key(), + ..Default::default() + })) + } + + fn agent_id() -> AgentId { + AgentId { + component_id: None, + name: "agent".to_string(), + } + } + + fn accepted() -> InvocationResponse { + response(invocation_response::Response::Accepted( + InvocationAccepted { + agent_id: Some(agent_id()), + idempotency_key: key(), + component_revision: Some(12), + }, + )) + } + + fn result(value: SchemaValue) -> InvocationResponse { + response(invocation_response::Response::Result( + InvocationSessionResult { + result: Some(invocation_session_result::Result::MethodResult(value)), + component_revision: Some(12), + agent_id: Some(agent_id()), + idempotency_key: key(), + ..Default::default() + }, + )) + } + + fn success() -> InvocationResponse { + response(invocation_response::Response::Finished( + InvocationSessionCompletion { + outcome: Some(invocation_session_completion::Outcome::Success(Empty {})), + }, + )) + } + + fn failure(kind: InvocationFailureKind) -> InvocationResponse { + response(invocation_response::Response::Finished( + InvocationSessionCompletion { + outcome: Some(invocation_session_completion::Outcome::Failure( + InvocationFailure { + kind: kind as i32, + code: "failed".to_string(), + message: "invocation failed".to_string(), + worker_error: (kind == InvocationFailureKind::Execution) + .then(Default::default), + }, + )), + }, + )) + } + + fn input_item(sequence: u64, payload: Payload) -> PublicInvocationRequest { + public_request(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id: 7, + sequence, + payload: Some(payload), + }, + )) + } + + fn cancel(stream_id: u64, role: StreamCancelRole, offset: u64) -> StreamCancel { + StreamCancel { + stream_id, + offset, + role: role as i32, + reason: StreamCancelReason::Cancelled as i32, + details: None, + } + } + + #[test] + fn legal_public_session_tracks_recursive_streams_acks_and_finish() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(record(vec![stream(7)]))) + .unwrap(); + assert!( + state + .validate_public_request(&input_item(0, Payload::PackedU8(vec![1, 2]))) + .is_err() + ); + state.validate_response(&accepted()).unwrap(); + state + .validate_public_request(&input_item(0, Payload::PackedU8(vec![1, 2]))) + .unwrap(); + state + .validate_response(&response(invocation_response::Response::InputAck( + InputStreamAck { + stream_id: 7, + sequence: 0, + logical_item_count: 2, + }, + ))) + .unwrap(); + state + .validate_public_request(&public_request( + public_invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 7, + offset: 2, + }), + )) + .unwrap(); + state + .validate_response(&result(record(vec![stream(9), stream(10)]))) + .unwrap(); + state + .validate_response(&response(invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: 9, + offset: 0, + value: Some(record(vec![stream(11)])), + }, + ))) + .unwrap(); + for (stream_id, offset) in [(9, 1), (10, 0), (11, 0)] { + state + .validate_response(&response(invocation_response::Response::OutputEnd( + OutputStreamEnd { stream_id, offset }, + ))) + .unwrap(); + } + state.validate_response(&success()).unwrap(); + assert!(state.is_complete()); + assert!(state.validate_response(&result(scalar(1))).is_err()); + } + + #[test] + fn legal_trusted_stream_free_session_is_accepted_result_finished() { + let mut state = InvocationSessionState::default(); + state + .validate_trusted_request(&trusted_start(record(Vec::new()))) + .unwrap(); + state.validate_response(&accepted()).unwrap(); + state.validate_response(&result(scalar(1))).unwrap(); + state.validate_response(&success()).unwrap(); + } + + #[test] + fn resume_attach_requires_terminal_resume_unsupported_rejection() { + let resume = public_request(public_invocation_request::Request::ResumeAttach( + ResumeAttach { + idempotency_key: key(), + }, + )); + let mut state = InvocationSessionState::default(); + state.validate_public_request(&resume).unwrap(); + assert!(state.validate_response(&accepted()).is_err()); + assert!( + state + .validate_response(&response(invocation_response::Response::Rejected( + InvocationRejected { + reason: InvocationRejectionReason::Validation as i32, + idempotency_key: key(), + ..Default::default() + }, + ))) + .is_err() + ); + state + .validate_response(&response(invocation_response::Response::Rejected( + InvocationRejected { + reason: InvocationRejectionReason::ResumeUnsupported as i32, + idempotency_key: key(), + ..Default::default() + }, + ))) + .unwrap(); + assert!(state.is_complete()); + assert!(state.validate_public_request(&resume).is_err()); + } + + #[test] + fn rejection_is_terminal_for_both_directions() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(record(Vec::new()))) + .unwrap(); + state + .validate_response(&response(invocation_response::Response::Rejected( + InvocationRejected { + reason: InvocationRejectionReason::Validation as i32, + idempotency_key: key(), + ..Default::default() + }, + ))) + .unwrap(); + assert!(state.validate_response(&accepted()).is_err()); + assert!( + state + .validate_public_request(&public_request( + public_invocation_request::Request::InputEnd(InputStreamEnd::default()), + )) + .is_err() + ); + } + + #[test] + fn unknown_streams_ack_mismatch_and_post_terminal_events_are_rejected() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(stream(7))) + .unwrap(); + state.validate_response(&accepted()).unwrap(); + assert!( + state + .validate_public_request(&public_request( + public_invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 8, + offset: 0, + }), + )) + .is_err() + ); + state + .validate_public_request(&input_item(0, Payload::PackedU8(vec![1, 2, 3]))) + .unwrap(); + assert!( + state + .validate_response(&response(invocation_response::Response::InputAck( + InputStreamAck { + stream_id: 7, + sequence: 0, + logical_item_count: 2, + }, + ))) + .is_err() + ); + state + .validate_response(&response(invocation_response::Response::InputAck( + InputStreamAck { + stream_id: 7, + sequence: 0, + logical_item_count: 3, + }, + ))) + .unwrap(); + state + .validate_public_request(&public_request( + public_invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 7, + offset: 3, + }), + )) + .unwrap(); + assert!( + state + .validate_public_request(&input_item(3, Payload::Value(scalar(1)))) + .is_err() + ); + } + + #[test] + fn output_consumer_cancellation_after_stream_terminal_is_rejected() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(record(Vec::new()))) + .unwrap(); + state.validate_response(&accepted()).unwrap(); + state.validate_response(&result(stream(9))).unwrap(); + state + .validate_response(&response(invocation_response::Response::OutputEnd( + OutputStreamEnd { + stream_id: 9, + offset: 0, + }, + ))) + .unwrap(); + + assert!( + state + .validate_public_request(&public_request( + public_invocation_request::Request::StreamCancel(cancel( + 9, + StreamCancelRole::OutputConsumer, + 0, + )), + )) + .is_err(), + "an output-consumer cancellation must not be accepted after the stream terminal" + ); + } + + #[test] + fn input_items_register_recursively_nested_streams() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(stream(7))) + .unwrap(); + state.validate_response(&accepted()).unwrap(); + state + .validate_public_request(&input_item(0, Payload::Value(record(vec![stream(8)])))) + .unwrap(); + state + .validate_response(&response(invocation_response::Response::InputAck( + InputStreamAck { + stream_id: 7, + sequence: 0, + logical_item_count: 1, + }, + ))) + .unwrap(); + state + .validate_public_request(&public_request( + public_invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 7, + offset: 1, + }), + )) + .unwrap(); + state + .validate_public_request(&public_request( + public_invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 8, + offset: 0, + }), + )) + .unwrap(); + state.validate_response(&result(scalar(1))).unwrap(); + state.validate_response(&success()).unwrap(); + } + + #[test] + fn all_role_appropriate_cancellations_are_unique_terminals() { + let mut input = InvocationSessionState::default(); + input + .validate_public_request(&public_start(stream(7))) + .unwrap(); + input.validate_response(&accepted()).unwrap(); + let input_cancel = public_request(public_invocation_request::Request::StreamCancel( + cancel(7, StreamCancelRole::InputProducer, 0), + )); + input.validate_public_request(&input_cancel).unwrap(); + assert!(input.validate_public_request(&input_cancel).is_err()); + + let mut input_consumer = InvocationSessionState::default(); + input_consumer + .validate_public_request(&public_start(stream(7))) + .unwrap(); + input_consumer.validate_response(&accepted()).unwrap(); + input_consumer + .validate_response(&response(invocation_response::Response::StreamCancel( + cancel(7, StreamCancelRole::InputConsumer, 0), + ))) + .unwrap(); + + let mut output = InvocationSessionState::default(); + output + .validate_public_request(&public_start(record(Vec::new()))) + .unwrap(); + output.validate_response(&accepted()).unwrap(); + output.validate_response(&result(stream(9))).unwrap(); + output + .validate_public_request(&public_request( + public_invocation_request::Request::StreamCancel(cancel( + 9, + StreamCancelRole::OutputConsumer, + 0, + )), + )) + .unwrap(); + assert!( + output + .validate_public_request(&public_request( + public_invocation_request::Request::StreamCancel(cancel( + 9, + StreamCancelRole::OutputConsumer, + 0, + )), + )) + .is_err() + ); + output + .validate_response(&response(invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: 9, + offset: 0, + value: Some(scalar(1)), + }, + ))) + .unwrap(); + output + .validate_response(&response(invocation_response::Response::StreamCancel( + cancel(9, StreamCancelRole::OutputProducer, 0), + ))) + .unwrap(); + output.validate_response(&success()).unwrap(); + + let mut output_producer = InvocationSessionState::default(); + output_producer + .validate_public_request(&public_start(record(Vec::new()))) + .unwrap(); + output_producer.validate_response(&accepted()).unwrap(); + output_producer + .validate_response(&result(stream(9))) + .unwrap(); + output_producer + .validate_response(&response(invocation_response::Response::StreamCancel( + cancel(9, StreamCancelRole::OutputProducer, 0), + ))) + .unwrap(); + } + + #[test] + fn input_consumer_cancellation_abandons_an_unacknowledged_item() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(stream(7))) + .unwrap(); + state.validate_response(&accepted()).unwrap(); + state + .validate_public_request(&input_item(0, Payload::Value(scalar(1)))) + .unwrap(); + state + .validate_response(&response(invocation_response::Response::StreamCancel( + cancel(7, StreamCancelRole::InputConsumer, 0), + ))) + .unwrap(); + state + .validate_public_request(&input_item(1, Payload::Value(scalar(2)))) + .unwrap(); + state + .validate_public_request(&public_request( + public_invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 7, + offset: 2, + }), + )) + .unwrap(); + state.validate_response(&result(scalar(2))).unwrap(); + state.validate_response(&success()).unwrap(); + } + + #[test] + fn duplicate_input_end_after_consumer_cancellation_is_rejected() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(stream(7))) + .unwrap(); + state.validate_response(&accepted()).unwrap(); + state + .validate_response(&response(invocation_response::Response::StreamCancel( + cancel(7, StreamCancelRole::InputConsumer, 0), + ))) + .unwrap(); + let end = public_request(public_invocation_request::Request::InputEnd( + InputStreamEnd { + stream_id: 7, + offset: 0, + }, + )); + state.validate_public_request(&end).unwrap(); + + assert!( + state.validate_public_request(&end).is_err(), + "an input stream must not accept the producer terminal more than once" + ); + } + + #[test] + fn recursive_registration_is_transactional_and_attachment_revocation_is_illegal() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(record(Vec::new()))) + .unwrap(); + state.validate_response(&accepted()).unwrap(); + assert!( + state + .validate_response(&result(record(vec![stream(9), stream(9)]))) + .is_err() + ); + state.validate_response(&result(stream(9))).unwrap(); + assert!( + state + .validate_response(&response(invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: 9, + offset: 0, + value: Some(stream(9)), + }, + ))) + .is_err() + ); + state + .validate_response(&response(invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: 9, + offset: 0, + value: Some(scalar(1)), + }, + ))) + .unwrap(); + assert!( + state + .validate_response(&response(invocation_response::Response::AttachmentRevoked( + Default::default() + ),)) + .is_err() + ); + } + + #[test] + fn stream_ids_are_unique_across_input_and_output_directions() { + let mut input_first = InvocationSessionState::default(); + input_first + .validate_public_request(&public_start(stream(7))) + .unwrap(); + input_first.validate_response(&accepted()).unwrap(); + assert!(input_first.validate_response(&result(stream(7))).is_err()); + + let mut output_first = InvocationSessionState::default(); + output_first + .validate_public_request(&public_start(stream(7))) + .unwrap(); + output_first.validate_response(&accepted()).unwrap(); + output_first.validate_response(&result(stream(9))).unwrap(); + assert!( + output_first + .validate_public_request(&input_item(0, Payload::Value(stream(9)))) + .is_err() + ); + } + + #[test] + fn finish_requires_result_terminals_and_safe_failure_kind() { + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&public_start(record(Vec::new()))) + .unwrap(); + state.validate_response(&accepted()).unwrap(); + assert!(state.validate_response(&success()).is_err()); + assert!( + state + .validate_response(&failure(InvocationFailureKind::Unspecified)) + .is_err() + ); + let mut protocol_with_worker_error = failure(InvocationFailureKind::Protocol); + let Some(invocation_response::Response::Finished(InvocationSessionCompletion { + outcome: Some(invocation_session_completion::Outcome::Failure(protocol_failure)), + })) = protocol_with_worker_error.response.as_mut() + else { + unreachable!("failure helper returned the wrong response") + }; + protocol_failure.worker_error = Some(Default::default()); + assert!( + state + .validate_response(&protocol_with_worker_error) + .is_err() + ); + state + .validate_response(&failure(InvocationFailureKind::Execution)) + .unwrap(); + } + + fn round_trip(message: M) + where + M: Message + Default + PartialEq + std::fmt::Debug, + { + let encoded = message.encode_to_vec(); + assert_eq!(M::decode(encoded.as_slice()).unwrap(), message); + } + + #[test] + fn public_and_internal_envelopes_round_trip_all_gol_91_variants() { + round_trip(public_start(record(Vec::new()))); + round_trip(trusted_start(record(Vec::new()))); + round_trip(public_request( + public_invocation_request::Request::ResumeAttach(ResumeAttach { + idempotency_key: key(), + }), + )); + round_trip(input_item(4, Payload::PackedU8(vec![1, 2, 3]))); + round_trip(public_request( + public_invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 7, + offset: 4, + }), + )); + for role in [ + StreamCancelRole::InputProducer, + StreamCancelRole::InputConsumer, + StreamCancelRole::OutputProducer, + StreamCancelRole::OutputConsumer, + ] { + round_trip(StreamCancel { + stream_id: 7, + offset: 8, + role: role as i32, + reason: StreamCancelReason::Protocol as i32, + details: Some("cancelled".to_string()), + }); + } + round_trip(accepted()); + round_trip(response(invocation_response::Response::Rejected( + InvocationRejected { + reason: InvocationRejectionReason::ResumeUnsupported as i32, + idempotency_key: key(), + ..Default::default() + }, + ))); + round_trip(result(stream(9))); + round_trip(response(invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: 9, + offset: 0, + value: Some(scalar(1)), + }, + ))); + round_trip(response(invocation_response::Response::OutputEnd( + OutputStreamEnd { + stream_id: 9, + offset: 1, + }, + ))); + round_trip(response(invocation_response::Response::OutputError( + OutputStreamError { + stream_id: 9, + offset: 1, + details: "failed".to_string(), + }, + ))); + round_trip(response(invocation_response::Response::InputAck( + InputStreamAck { + stream_id: 7, + sequence: 0, + logical_item_count: 3, + }, + ))); + round_trip(response(invocation_response::Response::StreamCancel( + cancel(9, StreamCancelRole::OutputProducer, 1), + ))); + round_trip(response(invocation_response::Response::AttachmentRevoked( + Default::default(), + ))); + round_trip(success()); + round_trip(failure(InvocationFailureKind::Protocol)); + round_trip(failure(InvocationFailureKind::Execution)); + } +} diff --git a/golem-api-grpc/src/lib.rs b/golem-api-grpc/src/lib.rs index d4675144fd..87f36c5607 100644 --- a/golem-api-grpc/src/lib.rs +++ b/golem-api-grpc/src/lib.rs @@ -15,6 +15,8 @@ #[cfg(test)] test_r::enable!(); +pub mod invocation_session_protocol; + #[allow(clippy::large_enum_variant)] pub mod proto { use crate::proto::golem::worker::UpdateMode; @@ -72,271 +74,3 @@ pub mod proto { } } } - -use proto::golem::worker::{ - InvocationCancel, InvocationFrame, InvocationStart, invocation_cancel, invocation_frame, -}; - -pub fn expect_invocation_start(frame: InvocationFrame) -> Result { - match frame.frame { - Some(invocation_frame::Frame::Start(start)) => Ok(start), - Some(_) => Err("the first invocation frame must be start".to_string()), - None => Err("invocation frame has no payload".to_string()), - } -} - -pub fn validate_invocation_request_tail(frame: InvocationFrame) -> Result { - match frame.frame.as_ref() { - Some( - invocation_frame::Frame::Demand(_) - | invocation_frame::Frame::Item(_) - | invocation_frame::Frame::End(_) - | invocation_frame::Frame::StreamError(_) - | invocation_frame::Frame::Detach(_), - ) => Ok(frame), - Some(invocation_frame::Frame::Cancel(cancel)) => { - let kind = cancel.kind; - invocation_cancel::Kind::try_from(kind) - .map(|_| frame) - .map_err(|_| format!("invalid invocation cancellation kind {kind}")) - } - Some(invocation_frame::Frame::Start(_)) => { - Err("invocation start may only appear as the first frame".to_string()) - } - Some(invocation_frame::Frame::Result(_) | invocation_frame::Frame::Finished(_)) => { - Err("response frame received on invocation request stream".to_string()) - } - None => Err("invocation frame has no payload".to_string()), - } -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -enum InvocationResponsePhase { - BeforeResult, - AfterResult, - Complete, -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub struct InvocationResponseState { - phase: InvocationResponsePhase, -} - -impl Default for InvocationResponseState { - fn default() -> Self { - Self { - phase: InvocationResponsePhase::BeforeResult, - } - } -} - -impl InvocationResponseState { - pub fn validate(&mut self, frame: &InvocationFrame) -> Result<(), String> { - if self.phase == InvocationResponsePhase::Complete { - return Err("invocation response frame received after completion".to_string()); - } - - match frame.frame.as_ref() { - Some(invocation_frame::Frame::Start(_)) | Some(invocation_frame::Frame::Cancel(_)) => { - Err("request frame received on invocation response stream".to_string()) - } - Some(invocation_frame::Frame::Result(_)) => match self.phase { - InvocationResponsePhase::BeforeResult => { - self.phase = InvocationResponsePhase::AfterResult; - Ok(()) - } - InvocationResponsePhase::AfterResult => { - Err("invocation response contains more than one result".to_string()) - } - InvocationResponsePhase::Complete => unreachable!(), - }, - Some(invocation_frame::Frame::Finished(finished)) => { - use proto::golem::worker::invocation_session_finished::Outcome; - - match finished.outcome.as_ref() { - Some(Outcome::Success(_)) - if self.phase == InvocationResponsePhase::BeforeResult => - { - return Err( - "invocation completed successfully before publishing a result" - .to_string(), - ); - } - Some(Outcome::ProtocolFailure(failure)) => { - if proto::golem::worker::invocation_protocol_failure::Kind::try_from( - failure.kind, - ) - .is_err() - { - return Err(format!( - "invalid invocation protocol failure kind {}", - failure.kind - )); - } - } - Some(Outcome::Success(_) | Outcome::Failure(_)) => {} - None => return Err("invocation completion has no outcome".to_string()), - } - self.phase = InvocationResponsePhase::Complete; - Ok(()) - } - Some( - invocation_frame::Frame::Demand(_) - | invocation_frame::Frame::Item(_) - | invocation_frame::Frame::End(_) - | invocation_frame::Frame::StreamError(_) - | invocation_frame::Frame::Detach(_), - ) => Ok(()), - None => Err("invocation frame has no payload".to_string()), - } - } - - pub fn is_complete(&self) -> bool { - self.phase == InvocationResponsePhase::Complete - } -} - -pub fn invocation_cancel_frame( - kind: invocation_cancel::Kind, - details: Option, -) -> InvocationFrame { - InvocationFrame { - frame: Some(invocation_frame::Frame::Cancel(InvocationCancel { - kind: kind as i32, - details, - })), - } -} - -#[cfg(test)] -mod protocol_tests { - use super::*; - use proto::golem::common::Empty; - use proto::golem::worker::invocation_session_finished::Outcome; - use proto::golem::worker::{InvocationResult, InvocationSessionFinished, StreamDemand}; - use test_r::test; - - fn response_frame(frame: invocation_frame::Frame) -> InvocationFrame { - InvocationFrame { frame: Some(frame) } - } - - fn successful_completion() -> invocation_frame::Frame { - invocation_frame::Frame::Finished(InvocationSessionFinished { - outcome: Some(Outcome::Success(Empty {})), - }) - } - - #[test] - fn request_start_rules() { - assert!(expect_invocation_start(InvocationFrame::default()).is_err()); - assert!( - expect_invocation_start(response_frame(invocation_frame::Frame::Result( - InvocationResult::default(), - ))) - .is_err() - ); - assert!( - expect_invocation_start(response_frame(invocation_frame::Frame::Start( - InvocationStart::default(), - ))) - .is_ok() - ); - } - - #[test] - fn request_tail_rules() { - assert!( - validate_invocation_request_tail(response_frame(invocation_frame::Frame::Demand( - StreamDemand { stream_id: 1 }, - ))) - .is_ok() - ); - assert!( - validate_invocation_request_tail(invocation_cancel_frame( - invocation_cancel::Kind::Semantic, - None, - )) - .is_ok() - ); - - let invalid = [ - InvocationFrame::default(), - response_frame(invocation_frame::Frame::Start(InvocationStart::default())), - response_frame(invocation_frame::Frame::Result(InvocationResult::default())), - response_frame(successful_completion()), - ]; - for frame in invalid { - assert!(validate_invocation_request_tail(frame).is_err()); - } - } - - #[test] - fn response_requires_one_result_before_successful_completion() { - let mut state = InvocationResponseState::default(); - assert!( - state - .validate(&response_frame(invocation_frame::Frame::Demand( - StreamDemand { stream_id: 1 }, - ))) - .is_ok() - ); - assert!( - state - .validate(&response_frame(successful_completion())) - .is_err() - ); - assert!( - state - .validate(&response_frame(invocation_frame::Frame::Result( - InvocationResult::default(), - ))) - .is_ok() - ); - assert!( - state - .validate(&response_frame(invocation_frame::Frame::Result( - InvocationResult::default(), - ))) - .is_err() - ); - assert!( - state - .validate(&response_frame(successful_completion())) - .is_ok() - ); - assert!(state.is_complete()); - } - - #[test] - fn response_failure_is_a_single_completion() { - let mut state = InvocationResponseState::default(); - let failure = || { - response_frame(invocation_frame::Frame::Finished( - InvocationSessionFinished { - outcome: Some(Outcome::ProtocolFailure( - proto::golem::worker::InvocationProtocolFailure { - kind: proto::golem::worker::invocation_protocol_failure::Kind::Protocol - as i32, - details: "failed".to_string(), - }, - )), - }, - )) - }; - assert!(state.validate(&failure()).is_ok()); - assert!(state.is_complete()); - assert!(state.validate(&failure()).is_err()); - } - - #[test] - fn response_rejects_request_and_empty_frames() { - let invalid = [ - InvocationFrame::default(), - response_frame(invocation_frame::Frame::Start(InvocationStart::default())), - invocation_cancel_frame(invocation_cancel::Kind::Semantic, None), - ]; - for frame in invalid { - assert!(InvocationResponseState::default().validate(&frame).is_err()); - } - } -} diff --git a/golem-common/src/schema/agent/mod.rs b/golem-common/src/schema/agent/mod.rs index 6685eadf18..ed5eb45653 100644 --- a/golem-common/src/schema/agent/mod.rs +++ b/golem-common/src/schema/agent/mod.rs @@ -375,6 +375,29 @@ pub struct AgentMethodSchema { pub read_only: Option, } +impl AgentMethodSchema { + /// Validates the caller-supplied parameter record against this method's + /// input schema and the owning agent's graph. + pub fn validate_input(&self, graph: &SchemaGraph, input: &SchemaValue) -> Result<(), String> { + json_input_schema_value_to_typed_schema_value(input.clone(), graph, &self.input_schema) + .map(|_| ()) + } + + /// Returns whether a caller-supplied input or the output of this method can + /// contain a stream, following references through the owning agent's graph. + pub fn uses_streams(&self, graph: &SchemaGraph) -> bool { + self.input_schema + .fields() + .iter() + .filter(|field| matches!(field.source, FieldSource::UserSupplied)) + .any(|field| contains_stream_in_graph(graph, &field.schema)) + || self + .output_schema + .schema() + .is_some_and(|output| contains_stream_in_graph(graph, output)) + } +} + /// Dependent agent type, schema-layer form. /// /// Owns its own [`SchemaGraph`] — a dependent agent is independently diff --git a/golem-common/src/schema/agent/tests.rs b/golem-common/src/schema/agent/tests.rs index 5648be45c8..1111a5e96c 100644 --- a/golem-common/src/schema/agent/tests.rs +++ b/golem-common/src/schema/agent/tests.rs @@ -24,6 +24,7 @@ use crate::schema::graph::{SchemaGraph, SchemaTypeDef, TypedSchemaValue}; use crate::schema::metadata::{MetadataEnvelope, TypeId}; use crate::schema::schema_type::{NamedFieldType, SchemaType, SecretSpec, VariantCaseType}; use crate::schema::schema_value::{SchemaValue, SecretValuePayload, VariantValuePayload}; +use crate::schema::stream::SchemaValueStream; use proptest::prelude::*; use serde_json::json; use test_r::test; @@ -728,6 +729,61 @@ fn stream_classification_ignores_definitions_unreachable_from_the_method() { &graph, &SchemaType::ref_to(TypeId::new("UnrelatedStream")) )); + assert!(!method.uses_streams(&graph)); +} + +#[test] +fn method_stream_classification_follows_input_and_output_refs() { + let graph = registry(vec![ + proj_def( + "Input", + SchemaType::record(vec![proj_field( + "items", + SchemaType::stream(Some(SchemaType::string())), + )]), + ), + proj_def( + "Output", + SchemaType::option(SchemaType::stream(Some(SchemaType::u8()))), + ), + ]); + let input_method = method( + "input", + vec![NamedField::user_supplied( + "input", + SchemaType::ref_to(TypeId::new("Input")), + )], + OutputSchema::Unit, + ); + let output_method = method( + "output", + vec![], + OutputSchema::Single(Box::new(SchemaType::ref_to(TypeId::new("Output")))), + ); + + assert!(input_method.uses_streams(&graph)); + assert!(output_method.uses_streams(&graph)); +} + +#[test] +fn method_input_validation_accepts_a_live_stream_handle() { + let method = method( + "consume", + vec![NamedField::user_supplied( + "input", + SchemaType::stream(Some(SchemaType::u32())), + )], + OutputSchema::Unit, + ); + let input = SchemaValue::Record { + fields: vec![SchemaValue::Stream(SchemaValueStream::from_host_endpoint( + (), + ))], + }; + + method + .validate_input(&SchemaGraph::empty(), &input) + .unwrap(); } #[test] diff --git a/golem-debugging-service/config/debug-worker-executor.sample.env b/golem-debugging-service/config/debug-worker-executor.sample.env index 6755e9bbe0..2acb396b8b 100644 --- a/golem-debugging-service/config/debug-worker-executor.sample.env +++ b/golem-debugging-service/config/debug-worker-executor.sample.env @@ -61,6 +61,7 @@ GOLEM__LIMITS__EVENT_BROADCAST_CAPACITY=1024 GOLEM__LIMITS__EVENT_HISTORY_SIZE=128 GOLEM__LIMITS__FUEL_TO_BORROW=10000 GOLEM__LIMITS__INVOCATION_RESULT_BROADCAST_CAPACITY=100000 +GOLEM__LIMITS__LIVE_STREAM_EVENT_BROADCAST_CAPACITY=32 GOLEM__LIMITS__MAX_ACTIVE_WORKERS=1024 GOLEM__LIMITS__MAX_CONCURRENT_STREAMS=1024 GOLEM__LIMITS__MAX_INVOCATION_CONTEXT_STACK_DEPTH=1024 @@ -251,6 +252,7 @@ GOLEM__LIMITS__EVENT_BROADCAST_CAPACITY=1024 GOLEM__LIMITS__EVENT_HISTORY_SIZE=128 GOLEM__LIMITS__FUEL_TO_BORROW=10000 GOLEM__LIMITS__INVOCATION_RESULT_BROADCAST_CAPACITY=100000 +GOLEM__LIMITS__LIVE_STREAM_EVENT_BROADCAST_CAPACITY=32 GOLEM__LIMITS__MAX_ACTIVE_WORKERS=1024 GOLEM__LIMITS__MAX_CONCURRENT_STREAMS=1024 GOLEM__LIMITS__MAX_INVOCATION_CONTEXT_STACK_DEPTH=1024 diff --git a/golem-debugging-service/config/debug-worker-executor.toml b/golem-debugging-service/config/debug-worker-executor.toml index e1109502e8..5b778e83d0 100644 --- a/golem-debugging-service/config/debug-worker-executor.toml +++ b/golem-debugging-service/config/debug-worker-executor.toml @@ -104,6 +104,7 @@ event_broadcast_capacity = 1024 event_history_size = 128 fuel_to_borrow = 10000 invocation_result_broadcast_capacity = 100000 +live_stream_event_broadcast_capacity = 32 max_active_workers = 1024 max_concurrent_streams = 1024 max_invocation_context_stack_depth = 1024 @@ -392,6 +393,7 @@ without_time = false # event_history_size = 128 # fuel_to_borrow = 10000 # invocation_result_broadcast_capacity = 100000 +# live_stream_event_broadcast_capacity = 32 # max_active_workers = 1024 # max_concurrent_streams = 1024 # max_invocation_context_stack_depth = 1024 diff --git a/golem-debugging-service/src/lib.rs b/golem-debugging-service/src/lib.rs index ef2c848dc9..d4e03d81af 100644 --- a/golem-debugging-service/src/lib.rs +++ b/golem-debugging-service/src/lib.rs @@ -33,7 +33,7 @@ use async_trait::async_trait; use golem_service_base::clients::registry::RegistryService; use golem_service_base::storage::blob::BlobStorage; pub use golem_worker_executor::RunDetails; -use golem_worker_executor::durable_host::DurableWorkerCtx; +use golem_worker_executor::durable_host::{CoreTypesHost, DurableWorkerCtx}; use golem_worker_executor::preview2::{golem_api_1_x, golem_durability}; use golem_worker_executor::services::active_workers::ActiveWorkers; use golem_worker_executor::services::agent_types::AgentTypesService; @@ -251,9 +251,13 @@ pub async fn create_debugging_service_services( // When it comes to fork, we need the original oplog service let worker_fork = Arc::new(DefaultWorkerFork::new( - Arc::new(RemoteInvocationRpc::new( + Arc::new(RemoteInvocationRpc::new_with_stream_capacity( worker_proxy.clone(), shard_service.clone(), + golem_config + .limits + .live_stream_event_broadcast_capacity + .get(), )), active_workers.clone(), engine.clone(), @@ -293,9 +297,13 @@ pub async fn create_debugging_service_services( )); let rpc = Arc::new(DirectWorkerInvocationRpc::new( - Arc::new(RemoteInvocationRpc::new( + Arc::new(RemoteInvocationRpc::new_with_stream_capacity( worker_proxy.clone(), shard_service.clone(), + golem_config + .limits + .live_stream_event_broadcast_capacity + .get(), )), direct_invocation_auth_service, active_workers.clone(), @@ -487,7 +495,7 @@ pub fn create_debug_wasmtime_linker(engine: &Engine) -> anyhow::Result>, >(&mut linker, get_durable_ctx)?; - golem_schema::schema::wit::wire::add_to_linker::<_, HasSelf>>( + golem_schema::schema::wit::wire::add_to_linker::<_, CoreTypesHost>( &mut linker, get_durable_ctx, )?; diff --git a/golem-openapi-client-generator/src/rust/client_gen.rs b/golem-openapi-client-generator/src/rust/client_gen.rs index 8a2928de08..242a1c6dfd 100644 --- a/golem-openapi-client-generator/src/rust/client_gen.rs +++ b/golem-openapi-client-generator/src/rust/client_gen.rs @@ -260,7 +260,9 @@ fn tag_operations( if let Some(item) = path_item.as_item() { if let Some(tag) = tag { item.iter() - .filter(|(_, op)| op.tags.contains(&tag.name)) + .filter(|(_, op)| { + op.tags.contains(&tag.name) && !is_websocket_upgrade_operation(op) + }) .map(|(method, op)| PathOperation { path: Path::from_string(path), original_path: path.to_string(), @@ -270,7 +272,7 @@ fn tag_operations( .collect() } else { item.iter() - .filter(|(_, op)| op.tags.is_empty()) + .filter(|(_, op)| op.tags.is_empty() && !is_websocket_upgrade_operation(op)) .map(|(method, op)| PathOperation { path: Path::from_string(path), original_path: path.to_string(), @@ -284,6 +286,13 @@ fn tag_operations( } } +fn is_websocket_upgrade_operation(operation: &Operation) -> bool { + operation + .responses + .responses + .contains_key(&StatusCode::Code(101)) +} + fn match_tag(tag: &Option, path_item: &ReferenceOr) -> bool { if let Some(item) = path_item.as_item() { if let Some(tag) = tag { diff --git a/golem-skills/skills/moonbit/golem-invoke-agent-moonbit/SKILL.md b/golem-skills/skills/moonbit/golem-invoke-agent-moonbit/SKILL.md index 1719e624ad..1de8da540a 100644 --- a/golem-skills/skills/moonbit/golem-invoke-agent-moonbit/SKILL.md +++ b/golem-skills/skills/moonbit/golem-invoke-agent-moonbit/SKILL.md @@ -19,7 +19,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using MoonBit syntax. Multiple return values are rendered as a MoonBit tuple, for example `(1, "ok")`. Methods returning `Unit` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `Unit` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one MoonBit value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf 'Some(1)\nNone\n' | golem agent invoke 'MyAgent()' consume_values - +cat input.bin | golem agent invoke 'MyAgent()' consume_bytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as MoonBit values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produce_values --stdout-format value +golem agent invoke 'MyAgent()' produce_bytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -78,6 +96,8 @@ golem agent invoke 'staging/MyAgent("user-123")' get_status | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/golem-skills/skills/rust/golem-invoke-agent-rust/SKILL.md b/golem-skills/skills/rust/golem-invoke-agent-rust/SKILL.md index d811a2a1e2..52e4f2ad47 100644 --- a/golem-skills/skills/rust/golem-invoke-agent-rust/SKILL.md +++ b/golem-skills/skills/rust/golem-invoke-agent-rust/SKILL.md @@ -19,7 +19,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using Rust syntax. Multiple return values are rendered as a Rust tuple, for example `(1, "ok")`. Methods returning `()` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `()` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one Rust value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf 'Some(1)\nNone\n' | golem agent invoke 'MyAgent()' consume_values - +cat input.bin | golem agent invoke 'MyAgent()' consume_bytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as Rust values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produce_values --stdout-format value +golem agent invoke 'MyAgent()' produce_bytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -73,6 +91,8 @@ golem agent invoke 'staging/MyAgent("user-123")' get_status | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/golem-skills/skills/scala/golem-invoke-agent-scala/SKILL.md b/golem-skills/skills/scala/golem-invoke-agent-scala/SKILL.md index 4fc9745094..8379c31dcc 100644 --- a/golem-skills/skills/scala/golem-invoke-agent-scala/SKILL.md +++ b/golem-skills/skills/scala/golem-invoke-agent-scala/SKILL.md @@ -19,7 +19,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using Scala syntax. Multiple return values are rendered as a Scala tuple, for example `(1, "ok")`. Methods returning `Unit` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `Unit` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one Scala value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf 'Some(1)\nNone\n' | golem agent invoke 'MyAgent()' consumeValues - +cat input.bin | golem agent invoke 'MyAgent()' consumeBytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as Scala values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produceValues --stdout-format value +golem agent invoke 'MyAgent()' produceBytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -73,6 +91,8 @@ golem agent invoke 'staging/MyAgent("user-123")' getStatus | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/golem-skills/skills/ts/golem-invoke-agent-ts/SKILL.md b/golem-skills/skills/ts/golem-invoke-agent-ts/SKILL.md index 96e1eca84b..42a575ad32 100644 --- a/golem-skills/skills/ts/golem-invoke-agent-ts/SKILL.md +++ b/golem-skills/skills/ts/golem-invoke-agent-ts/SKILL.md @@ -19,7 +19,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using TypeScript syntax. Multiple return values are rendered as a TypeScript tuple, for example `[1, "ok"]`. Methods returning `void` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `void` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one TypeScript value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf '{ value: 1 }\n{ value: 2 }\n' | golem agent invoke 'MyAgent()' consumeValues - +cat input.bin | golem agent invoke 'MyAgent()' consumeBytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as TypeScript values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produceValues --stdout-format value +golem agent invoke 'MyAgent()' produceBytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -73,6 +91,8 @@ golem agent invoke 'staging/MyAgent("user-123")' getStatus | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/golem-skills/tests/harness/src/executor.ts b/golem-skills/tests/harness/src/executor.ts index 7dfa844bcb..54afa62c6e 100644 --- a/golem-skills/tests/harness/src/executor.ts +++ b/golem-skills/tests/harness/src/executor.ts @@ -83,6 +83,22 @@ function parseJsonCommandOutput(output: string): T | undefined { } function extractInvokeJsonResult(output: string): unknown { + const lifecycleResult = output + .trim() + .split(/\r?\n/) + .map((line) => tryParseJson(line.trim())) + .find( + (document) => + document !== undefined && + typeof document === "object" && + document !== null && + (document as Record).$type === "agent.invoke-session" && + (document as Record).kind === "result", + ); + if (lifecycleResult && typeof lifecycleResult === "object") { + return (lifecycleResult as Record).value; + } + const parsed = parseJsonCommandOutput(output); if (!parsed || typeof parsed !== "object") { return parsed; diff --git a/golem-skills/tests/harness/tests/variables-integration.test.ts b/golem-skills/tests/harness/tests/variables-integration.test.ts index bc1ff6eefb..b66f9074fd 100644 --- a/golem-skills/tests/harness/tests/variables-integration.test.ts +++ b/golem-skills/tests/harness/tests/variables-integration.test.ts @@ -309,6 +309,62 @@ describe("Variable substitution integration", () => { assert.equal(result.status, "pass", result.stepResults[0]?.error); }); + it("extracts invoke_json results from invocation-session lifecycle documents", async () => { + const driver = new StubDriver(); + const watcher = new SkillWatcher(workspace); + const opts: ScenarioExecutorOptions = { agent: "amp", language: "ts" }; + const executor = createExecutor(driver, watcher, workspace, bootstrapSkillSourceDirs, opts); + + (executor as unknown as Record)["findGolemProjectDir"] = async () => workspace; + (executor as unknown as Record)["runLocalCommand"] = async () => ({ + success: true, + stdout: [ + { $type: "agent.invoke-session", kind: "accepted", idempotencyKey: "abc-123" }, + { + $type: "agent.invoke-session", + kind: "result", + idempotencyKey: "abc-123", + value: { count: 2, active: true }, + }, + { + $type: "agent.invoke-session", + kind: "finished", + idempotencyKey: "abc-123", + outcome: "success", + }, + ] + .map((document) => JSON.stringify(document)) + .join("\n"), + stderr: "", + output: "", + exitCode: 0, + }); + + const spec: ScenarioSpec = { + name: "invoke-json-session-output", + settings: { cleanup: false }, + steps: [ + { + id: "invoke-json", + tag: "invoke_json" as const, + invoke_json: { + agent: 'CounterAgent("test")', + method: "get", + }, + expect: { + result_json: [ + { path: "$.count", equals: 2 }, + { path: "$.active", equals: true }, + ], + }, + }, + ], + }; + + const result = await executor.execute(spec); + assert.equal(result.status, "pass", result.stepResults[0]?.error); + }); + it("resolves language-conditional invoke_json method names before execution", async () => { const driver = new StubDriver(); const watcher = new SkillWatcher(workspace); diff --git a/golem-worker-executor-test-utils/src/dsl_impl.rs b/golem-worker-executor-test-utils/src/dsl_impl.rs index b5db0caa04..6c4eb77fa7 100644 --- a/golem-worker-executor-test-utils/src/dsl_impl.rs +++ b/golem-worker-executor-test-utils/src/dsl_impl.rs @@ -17,10 +17,11 @@ use crate::component_writer::CachedAnalysis; use anyhow::anyhow; use applying::Apply; use bytes::Bytes; -use golem_api_grpc::InvocationResponseState; -use golem_api_grpc::proto::golem::worker::invocation_session_finished::Outcome; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; +use golem_api_grpc::proto::golem::worker::invocation_session_completion::Outcome; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame, InvocationResult, InvocationStart, LogEvent, UpdateMode, invocation_frame, + InvocationRequest, InvocationSessionResult, InvocationStart, LogEvent, UpdateMode, + invocation_request, invocation_response, }; use golem_api_grpc::proto::golem::workerexecutor; use golem_api_grpc::proto::golem::workerexecutor::v1::{ @@ -94,12 +95,17 @@ impl TestWorkerExecutor { pub async fn invoke_agent_session( &self, start: InvocationStart, - ) -> anyhow::Result { + ) -> anyhow::Result { let (requests, receiver) = mpsc::channel(1); + let request = InvocationRequest { + request: Some(invocation_request::Request::Start(start)), + }; + let mut state = InvocationSessionState::default(); + state + .validate_trusted_request(&request) + .map_err(anyhow::Error::msg)?; requests - .send(InvocationFrame { - frame: Some(invocation_frame::Frame::Start(start)), - }) + .send(request) .await .map_err(|_| anyhow!("invocation session request ended before start"))?; let mut responses = self @@ -108,50 +114,58 @@ impl TestWorkerExecutor { .invoke_agent_session(ReceiverStream::new(receiver)) .await? .into_inner(); - let mut state = InvocationResponseState::default(); let mut result = None; - - while let Some(frame) = responses.message().await? { - state.validate(&frame).map_err(anyhow::Error::msg)?; - match frame.frame { - Some(invocation_frame::Frame::Result(invocation_result)) => { + let mut terminal = None; + + while let Some(response) = responses.message().await? { + state + .validate_response(&response) + .map_err(anyhow::Error::msg)?; + match response.response { + Some(invocation_response::Response::Accepted(_)) => {} + Some(invocation_response::Response::Rejected(rejected)) => { + terminal = Some(Err(anyhow!( + "Agent invocation rejected: {}", + rejected.error + ))); + } + Some(invocation_response::Response::Result(invocation_result)) => { result = Some(invocation_result); } - Some(invocation_frame::Frame::Finished(finished)) => { - return match finished.outcome { - Some(Outcome::Success(_)) => { - result.ok_or_else(|| anyhow!("invocation completed without a result")) - } + Some(invocation_response::Response::Finished(finished)) => { + terminal = Some(match finished.outcome { + Some(Outcome::Success(_)) => result + .take() + .ok_or_else(|| anyhow!("invocation completed without a result")), Some(Outcome::Failure(failure)) => { Err(anyhow!("Agent invocation failed: {failure:?}")) } - Some(Outcome::ProtocolFailure(failure)) => { - Err(anyhow!("Invocation protocol failed: {}", failure.details)) - } None => Err(anyhow!("invocation completion has no outcome")), - }; + }); } Some( - invocation_frame::Frame::Demand(_) - | invocation_frame::Frame::Item(_) - | invocation_frame::Frame::End(_) - | invocation_frame::Frame::StreamError(_) - | invocation_frame::Frame::Detach(_), + invocation_response::Response::OutputItem(_) + | invocation_response::Response::OutputEnd(_) + | invocation_response::Response::OutputError(_) + | invocation_response::Response::InputAck(_) + | invocation_response::Response::StreamCancel(_), ) => { return Err(anyhow!( "non-streaming test invocation received a stream frame" )); } - Some(invocation_frame::Frame::Start(_) | invocation_frame::Frame::Cancel(_)) => { - unreachable!("response validation rejects request frames") + Some(invocation_response::Response::AttachmentRevoked(_)) => { + unreachable!("response validation rejects attachment revocation") } None => unreachable!("response validation rejects empty frames"), } } - Err(anyhow!( - "invocation session response ended before completion" - )) + terminal.unwrap_or_else(|| { + Err(anyhow!( + "invocation session response ended before completion" + )) + }) } } @@ -581,14 +595,12 @@ impl TestDsl for TestWorkerExecutor { let value = match result.result { Some( - golem_api_grpc::proto::golem::worker::invocation_result::Result::MethodResult( - proto_value, - ), + golem_api_grpc::proto::golem::worker::invocation_session_result::Result::MethodResult(proto_value), ) => Some( SchemaValue::try_from(proto_value) .map_err(|err| anyhow!("SchemaValue conversion error: {err}"))?, ), - Some(golem_api_grpc::proto::golem::worker::invocation_result::Result::NoResult(_)) + Some(golem_api_grpc::proto::golem::worker::invocation_session_result::Result::NoResult(_)) | None => None, }; Ok(AgentResult::new(value)) diff --git a/golem-worker-executor/Cargo.toml b/golem-worker-executor/Cargo.toml index 42e71c2eb4..4d9f73a471 100644 --- a/golem-worker-executor/Cargo.toml +++ b/golem-worker-executor/Cargo.toml @@ -36,6 +36,7 @@ golem-service-base = { workspace = true, features = ["worker-executor"] } anyhow = { workspace = true } applying = { workspace = true } arc-swap = { workspace = true } +async-broadcast = { workspace = true } async-lock = { workspace = true } async-recursion = { workspace = true } async-scoped = { workspace = true, features = ["use-tokio"] } diff --git a/golem-worker-executor/config/worker-executor.sample.env b/golem-worker-executor/config/worker-executor.sample.env index 85aee455f5..3f65cc49a6 100644 --- a/golem-worker-executor/config/worker-executor.sample.env +++ b/golem-worker-executor/config/worker-executor.sample.env @@ -84,6 +84,7 @@ GOLEM__LIMITS__EVENT_BROADCAST_CAPACITY=1024 GOLEM__LIMITS__EVENT_HISTORY_SIZE=128 GOLEM__LIMITS__FUEL_TO_BORROW=10000 GOLEM__LIMITS__INVOCATION_RESULT_BROADCAST_CAPACITY=100000 +GOLEM__LIMITS__LIVE_STREAM_EVENT_BROADCAST_CAPACITY=32 GOLEM__LIMITS__MAX_ACTIVE_WORKERS=1024 GOLEM__LIMITS__MAX_CONCURRENT_STREAMS=1024 GOLEM__LIMITS__MAX_INVOCATION_CONTEXT_STACK_DEPTH=1024 @@ -329,6 +330,7 @@ GOLEM__LIMITS__EVENT_BROADCAST_CAPACITY=1024 GOLEM__LIMITS__EVENT_HISTORY_SIZE=128 GOLEM__LIMITS__FUEL_TO_BORROW=10000 GOLEM__LIMITS__INVOCATION_RESULT_BROADCAST_CAPACITY=100000 +GOLEM__LIMITS__LIVE_STREAM_EVENT_BROADCAST_CAPACITY=32 GOLEM__LIMITS__MAX_ACTIVE_WORKERS=1024 GOLEM__LIMITS__MAX_CONCURRENT_STREAMS=1024 GOLEM__LIMITS__MAX_INVOCATION_CONTEXT_STACK_DEPTH=1024 @@ -544,6 +546,7 @@ GOLEM__LIMITS__EVENT_BROADCAST_CAPACITY=1024 GOLEM__LIMITS__EVENT_HISTORY_SIZE=128 GOLEM__LIMITS__FUEL_TO_BORROW=10000 GOLEM__LIMITS__INVOCATION_RESULT_BROADCAST_CAPACITY=100000 +GOLEM__LIMITS__LIVE_STREAM_EVENT_BROADCAST_CAPACITY=32 GOLEM__LIMITS__MAX_ACTIVE_WORKERS=1024 GOLEM__LIMITS__MAX_CONCURRENT_STREAMS=1024 GOLEM__LIMITS__MAX_INVOCATION_CONTEXT_STACK_DEPTH=1024 diff --git a/golem-worker-executor/config/worker-executor.toml b/golem-worker-executor/config/worker-executor.toml index 2d58be938b..6c2fdf8d17 100644 --- a/golem-worker-executor/config/worker-executor.toml +++ b/golem-worker-executor/config/worker-executor.toml @@ -143,6 +143,7 @@ event_broadcast_capacity = 1024 event_history_size = 128 fuel_to_borrow = 10000 invocation_result_broadcast_capacity = 100000 +live_stream_event_broadcast_capacity = 32 max_active_workers = 1024 max_concurrent_streams = 1024 max_invocation_context_stack_depth = 1024 @@ -509,6 +510,7 @@ without_time = false # event_history_size = 128 # fuel_to_borrow = 10000 # invocation_result_broadcast_capacity = 100000 +# live_stream_event_broadcast_capacity = 32 # max_active_workers = 1024 # max_concurrent_streams = 1024 # max_invocation_context_stack_depth = 1024 @@ -845,6 +847,7 @@ without_time = false # event_history_size = 128 # fuel_to_borrow = 10000 # invocation_result_broadcast_capacity = 100000 +# live_stream_event_broadcast_capacity = 32 # max_active_workers = 1024 # max_concurrent_streams = 1024 # max_invocation_context_stack_depth = 1024 diff --git a/golem-worker-executor/src/durable_host/mod.rs b/golem-worker-executor/src/durable_host/mod.rs index 155e4cc56c..00653e0565 100644 --- a/golem-worker-executor/src/durable_host/mod.rs +++ b/golem-worker-executor/src/durable_host/mod.rs @@ -36,6 +36,7 @@ pub(crate) mod schema_value_stream; mod secrets; pub use schema_value_stream::CoreTypesHost; mod sockets; +pub(crate) mod stream_bus; pub(crate) mod stream_session; pub(crate) mod stream_transport; mod suspendable_wait; @@ -3331,6 +3332,14 @@ impl DurableWorkerCtx { self.live_stream_tracker.clone() } + pub(crate) fn live_stream_event_capacity(&self) -> usize { + self.state + .config + .limits + .live_stream_event_broadcast_capacity + .get() + } + pub(crate) fn is_live_streaming_invocation(&self) -> bool { self.live_stream_tracker.is_some() } diff --git a/golem-worker-executor/src/durable_host/schema_value_stream.rs b/golem-worker-executor/src/durable_host/schema_value_stream.rs index 1fd1e0a483..72c8fa22f7 100644 --- a/golem-worker-executor/src/durable_host/schema_value_stream.rs +++ b/golem-worker-executor/src/durable_host/schema_value_stream.rs @@ -13,7 +13,9 @@ // limitations under the License. use crate::durable_host::DurableWorkerCtx; -use crate::durable_host::stream_transport::{RelayProducer, RelayReceiver, relay_pair}; +use crate::durable_host::stream_transport::{ + LiveInputProducer, LiveStreamEndpoint, output_stream_pair, +}; use crate::workerctx::WorkerCtx; use golem_schema::schema::schema_value::{QuotaTokenValuePayload, SecretValuePayload}; use golem_schema::schema::wit::wire::{ @@ -131,7 +133,7 @@ impl SchemaValueStreamResolver for StoreValueResolver<'_, '_, Ct ) -> Result, Self::Error> { if let Some(tracker) = self.store.data().durable_ctx().live_stream_tracker() { stream - .with_host_endpoint::(|receiver| receiver.attach(tracker)) + .with_host_endpoint::(|endpoint| endpoint.attach(tracker)) .map_err(WorkerExecutorError::runtime)?; } self.store @@ -182,7 +184,7 @@ impl SchemaValueStreamResolver for DurableWorkerCtx { ) -> Result, Self::Error> { if let Some(tracker) = self.live_stream_tracker() { stream - .with_host_endpoint::(|receiver| receiver.attach(tracker)) + .with_host_endpoint::(|endpoint| endpoint.attach(tracker)) .map_err(WorkerExecutorError::runtime)?; } self.table() @@ -229,7 +231,9 @@ impl HostSchemaValueStreamWithStore for CoreTyp accessor .with(|mut access| -> wasmtime::Result<_> { let tracker = access.get().live_stream_tracker(); - let (consumer, stream) = relay_pair(tracker); + let capacity = access.get().live_stream_event_capacity(); + let (consumer, stream) = + output_stream_pair(tracker, capacity).map_err(wasmtime::Error::msg)?; reader.pipe(&mut access, consumer)?; access .get() @@ -252,10 +256,10 @@ impl HostSchemaValueStreamWithStore for CoreTyp .delete(value) .map_err(|error| wasmtime::Error::msg(error.to_string())) .map(SchemaValueStreamHandleRep::into_stream)?; - let receiver = stream - .take_host_endpoint::() + let endpoint = stream + .take_host_endpoint::() .map_err(wasmtime::Error::msg)?; - StreamReader::new(&mut access, RelayProducer::new(receiver)) + StreamReader::new(&mut access, LiveInputProducer::new(endpoint)) }) .map_err(|error| anyhow::anyhow!(error.to_string())) } diff --git a/golem-worker-executor/src/durable_host/stream_bus.rs b/golem-worker-executor/src/durable_host/stream_bus.rs new file mode 100644 index 0000000000..d9fbad135b --- /dev/null +++ b/golem-worker-executor/src/durable_host/stream_bus.rs @@ -0,0 +1,593 @@ +// Copyright 2024-2026 Golem Cloud +// +// Licensed under the Golem Source License v1.1 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use async_broadcast::{Receiver, RecvError, Sender, TrySendError, broadcast}; +use std::sync::Arc; +use std::sync::atomic::{AtomicBool, Ordering}; +use tokio::sync::{Mutex, Notify}; +use tokio_util::sync::CancellationToken; + +#[derive(Clone, Debug, PartialEq)] +pub(crate) struct LiveStreamEvent { + pub(crate) offset: u64, + pub(crate) payload: LiveStreamEventPayload, +} + +#[derive(Clone, Debug, PartialEq)] +pub(crate) enum LiveStreamEventPayload { + Item(T), + End, + Error(String), + Cancel(String), +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) enum LiveStreamBusCreateError { + ZeroCapacity, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) enum LiveStreamPublishError { + Closed, + Terminated, + OffsetOverflow, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) enum LiveStreamReceiveError { + Closed, + Lagged(u64), +} + +struct PublishState { + next_offset: u64, + terminated: bool, +} + +pub(crate) struct LiveStreamPublisher { + sender: Sender>, + state: Arc>, + primary_activated: Arc, + primary_changed: Arc, +} + +impl Clone for LiveStreamPublisher { + fn clone(&self) -> Self { + Self { + sender: self.sender.clone(), + state: self.state.clone(), + primary_activated: self.primary_activated.clone(), + primary_changed: self.primary_changed.clone(), + } + } +} + +impl LiveStreamPublisher { + pub(crate) async fn publish_item(&self, value: T) -> Result { + let mut state = self.state.lock().await; + if state.terminated { + return Err(LiveStreamPublishError::Terminated); + } + let following_offset = state + .next_offset + .checked_add(1) + .ok_or(LiveStreamPublishError::OffsetOverflow)?; + let offset = state.next_offset; + self.send_event(LiveStreamEvent { + offset, + payload: LiveStreamEventPayload::Item(value), + }) + .await?; + state.next_offset = following_offset; + Ok(offset) + } + + pub(crate) async fn publish_end(&self) -> Result { + self.publish_terminal(LiveStreamEventPayload::End).await + } + + pub(crate) async fn publish_error(&self, error: String) -> Result { + self.publish_terminal(LiveStreamEventPayload::Error(error)) + .await + } + + pub(crate) async fn publish_cancel( + &self, + reason: String, + ) -> Result { + self.publish_terminal(LiveStreamEventPayload::Cancel(reason)) + .await + } + + async fn publish_terminal( + &self, + payload: LiveStreamEventPayload, + ) -> Result { + let mut state = self.state.lock().await; + if state.terminated { + return Err(LiveStreamPublishError::Terminated); + } + let offset = state.next_offset; + self.send_event(LiveStreamEvent { offset, payload }).await?; + state.terminated = true; + Ok(offset) + } + + async fn send_event(&self, event: LiveStreamEvent) -> Result<(), LiveStreamPublishError> { + if self.primary_activated.load(Ordering::Acquire) { + self.sender + .broadcast(event) + .await + .map_err(|_| LiveStreamPublishError::Closed)?; + return Ok(()); + } + + match self.sender.try_broadcast(event) { + Ok(_) => Ok(()), + Err(TrySendError::Closed(_)) | Err(TrySendError::Inactive(_)) => { + Err(LiveStreamPublishError::Closed) + } + Err(TrySendError::Full(event)) => loop { + let changed = self.primary_changed.notified(); + if self.primary_activated.load(Ordering::Acquire) { + self.sender + .broadcast(event) + .await + .map_err(|_| LiveStreamPublishError::Closed)?; + return Ok(()); + } + if self.sender.is_closed() { + return Err(LiveStreamPublishError::Closed); + } + changed.await; + }, + } + } + + pub(crate) fn subscribe_tail(&self) -> AuxiliaryLiveStreamSubscriber { + AuxiliaryLiveStreamSubscriber { + receiver: self.sender.new_receiver(), + } + } + + pub(crate) fn close(&self) { + self.sender.close(); + } +} + +struct PrimaryDropGuard { + sender: Sender>, + on_drop: Arc, + primary_changed: Arc, + armed: bool, +} + +impl Drop for PrimaryDropGuard { + fn drop(&mut self) { + self.sender.close(); + self.primary_changed.notify_waiters(); + if self.armed { + (self.on_drop)(); + } + } +} + +pub(crate) struct ReservedPrimaryLiveStreamSubscriber { + receiver: Option>>, + drop_guard: Option>, + primary_activated: Arc, + primary_changed: Arc, +} + +impl ReservedPrimaryLiveStreamSubscriber { + pub(crate) fn activate(mut self) -> PrimaryLiveStreamSubscriber { + self.primary_activated.store(true, Ordering::Release); + self.primary_changed.notify_waiters(); + PrimaryLiveStreamSubscriber { + receiver: self + .receiver + .take() + .expect("reserved primary stream subscriber already activated"), + drop_guard: self + .drop_guard + .take() + .expect("reserved primary stream subscriber already activated"), + } + } +} + +pub(crate) struct PrimaryLiveStreamSubscriber { + receiver: Receiver>, + drop_guard: PrimaryDropGuard, +} + +impl PrimaryLiveStreamSubscriber { + pub(crate) async fn recv(&mut self) -> Result, LiveStreamReceiveError> { + let event = receive(&mut self.receiver).await?; + if !matches!(&event.payload, LiveStreamEventPayload::Item(_)) { + self.drop_guard.armed = false; + } + Ok(event) + } +} + +pub(crate) struct AuxiliaryLiveStreamSubscriber { + receiver: Receiver>, +} + +impl AuxiliaryLiveStreamSubscriber { + pub(crate) async fn recv(&mut self) -> Result, LiveStreamReceiveError> { + receive(&mut self.receiver).await + } +} + +async fn receive( + receiver: &mut Receiver>, +) -> Result, LiveStreamReceiveError> { + receiver.recv().await.map_err(|error| match error { + RecvError::Closed => LiveStreamReceiveError::Closed, + RecvError::Overflowed(missed) => LiveStreamReceiveError::Lagged(missed), + }) +} + +pub(crate) fn live_stream_bus( + capacity: usize, + on_primary_drop: impl Fn() + Send + Sync + 'static, +) -> Result< + ( + LiveStreamPublisher, + ReservedPrimaryLiveStreamSubscriber, + ), + LiveStreamBusCreateError, +> { + if capacity == 0 { + return Err(LiveStreamBusCreateError::ZeroCapacity); + } + let (mut sender, receiver) = broadcast(capacity); + sender.set_overflow(false); + let primary_activated = Arc::new(AtomicBool::new(false)); + let primary_changed = Arc::new(Notify::new()); + Ok(( + LiveStreamPublisher { + sender: sender.clone(), + state: Arc::new(Mutex::new(PublishState { + next_offset: 0, + terminated: false, + })), + primary_activated: primary_activated.clone(), + primary_changed: primary_changed.clone(), + }, + ReservedPrimaryLiveStreamSubscriber { + receiver: Some(receiver), + drop_guard: Some(PrimaryDropGuard { + sender, + on_drop: Arc::new(on_primary_drop), + primary_changed: primary_changed.clone(), + armed: true, + }), + primary_activated, + primary_changed, + }, + )) +} + +pub(crate) fn live_output_stream_bus( + capacity: usize, + invocation_cancellation: CancellationToken, +) -> Result< + ( + LiveStreamPublisher, + ReservedPrimaryLiveStreamSubscriber, + ), + LiveStreamBusCreateError, +> { + live_stream_bus(capacity, move || invocation_cancellation.cancel()) +} + +pub(crate) fn live_input_stream_bus( + capacity: usize, + stream_cancellation: CancellationToken, + producer_notification: Arc, +) -> Result< + ( + LiveStreamPublisher, + ReservedPrimaryLiveStreamSubscriber, + ), + LiveStreamBusCreateError, +> { + live_stream_bus(capacity, move || { + stream_cancellation.cancel(); + producer_notification.notify_one(); + }) +} + +#[cfg(test)] +mod tests { + use super::{ + LiveStreamBusCreateError, LiveStreamEvent, LiveStreamEventPayload, LiveStreamPublishError, + live_input_stream_bus, live_output_stream_bus, live_stream_bus, + }; + use std::sync::Arc; + use std::sync::atomic::{AtomicBool, Ordering}; + use std::time::Duration; + use test_r::test; + use tokio::sync::Notify; + use tokio_util::sync::CancellationToken; + + #[test] + fn rejects_zero_capacity() { + let result = live_stream_bus::(0, || {}); + + assert!(matches!( + result, + Err(LiveStreamBusCreateError::ZeroCapacity) + )); + } + + #[test] + async fn fans_out_ordered_events_with_identical_offsets() { + let (publisher, primary) = live_stream_bus(4, || {}).unwrap(); + let mut primary = primary.activate(); + let mut auxiliary = publisher.subscribe_tail(); + + assert_eq!(publisher.publish_item("first").await, Ok(0)); + assert_eq!(publisher.publish_item("second").await, Ok(1)); + assert_eq!(publisher.publish_end().await, Ok(2)); + + let expected = vec![ + LiveStreamEvent { + offset: 0, + payload: LiveStreamEventPayload::Item("first"), + }, + LiveStreamEvent { + offset: 1, + payload: LiveStreamEventPayload::Item("second"), + }, + LiveStreamEvent { + offset: 2, + payload: LiveStreamEventPayload::End, + }, + ]; + let mut primary_events = Vec::new(); + let mut auxiliary_events = Vec::new(); + for _ in 0..3 { + primary_events.push(primary.recv().await.unwrap()); + auxiliary_events.push(auxiliary.recv().await.unwrap()); + } + assert_eq!(primary_events, expected); + assert_eq!(auxiliary_events, expected); + } + + #[test] + async fn slowest_subscriber_applies_bounded_backpressure() { + let (publisher, primary) = live_stream_bus(1, || {}).unwrap(); + let mut primary = primary.activate(); + let mut auxiliary = publisher.subscribe_tail(); + + publisher.publish_item(1).await.unwrap(); + let blocked = tokio::spawn({ + let publisher = publisher.clone(); + async move { publisher.publish_item(2).await } + }); + tokio::time::sleep(Duration::from_millis(20)).await; + assert!(!blocked.is_finished()); + + assert_eq!(primary.recv().await.unwrap().offset, 0); + tokio::time::sleep(Duration::from_millis(20)).await; + assert!(!blocked.is_finished()); + assert_eq!(auxiliary.recv().await.unwrap().offset, 0); + assert_eq!(blocked.await.unwrap(), Ok(1)); + } + + #[test] + async fn late_subscriber_starts_at_the_current_tail() { + let (publisher, primary) = live_stream_bus(4, || {}).unwrap(); + let mut primary = primary.activate(); + publisher.publish_item(1).await.unwrap(); + let mut late = publisher.subscribe_tail(); + publisher.publish_item(2).await.unwrap(); + + assert_eq!(primary.recv().await.unwrap().offset, 0); + assert_eq!(primary.recv().await.unwrap().offset, 1); + assert_eq!(late.recv().await.unwrap().offset, 1); + } + + #[test] + async fn reserved_primary_buffers_one_item_and_backpressures_until_activation() { + let (publisher, primary) = live_stream_bus(1, || {}).unwrap(); + + assert_eq!(publisher.publish_item(1).await, Ok(0)); + let blocked = tokio::spawn({ + let publisher = publisher.clone(); + async move { publisher.publish_item(2).await } + }); + tokio::task::yield_now().await; + assert!(!blocked.is_finished()); + + let mut primary = primary.activate(); + assert_eq!(primary.recv().await.unwrap().offset, 0); + assert_eq!(blocked.await.unwrap(), Ok(1)); + assert_eq!(primary.recv().await.unwrap().offset, 1); + } + + #[test] + async fn reserved_primary_buffers_to_configured_capacity() { + let (publisher, primary) = live_stream_bus(3, || {}).unwrap(); + + for value in 1..=3 { + assert_eq!(publisher.publish_item(value).await, Ok(value - 1)); + } + let blocked = tokio::spawn({ + let publisher = publisher.clone(); + async move { publisher.publish_item(4).await } + }); + tokio::task::yield_now().await; + assert!(!blocked.is_finished()); + + let mut primary = primary.activate(); + for offset in 0..3 { + assert_eq!(primary.recv().await.unwrap().offset, offset); + } + assert_eq!(blocked.await.unwrap(), Ok(3)); + assert_eq!(primary.recv().await.unwrap().offset, 3); + } + + #[test] + async fn dropping_auxiliary_removes_only_its_backpressure() { + let (publisher, primary) = live_stream_bus(1, || {}).unwrap(); + let mut primary = primary.activate(); + let auxiliary = publisher.subscribe_tail(); + publisher.publish_item(1).await.unwrap(); + drop(auxiliary); + assert_eq!(primary.recv().await.unwrap().offset, 0); + + assert_eq!(publisher.publish_item(2).await, Ok(1)); + assert_eq!(primary.recv().await.unwrap().offset, 1); + } + + #[test] + async fn primary_loss_closes_the_bus_and_runs_its_scope_guard() { + let cancelled = Arc::new(AtomicBool::new(false)); + let (publisher, primary) = live_stream_bus(1, { + let cancelled = cancelled.clone(); + move || cancelled.store(true, Ordering::Release) + }) + .unwrap(); + drop(primary); + + assert!(cancelled.load(Ordering::Acquire)); + assert_eq!( + publisher.publish_item(1).await, + Err(LiveStreamPublishError::Closed) + ); + } + + #[test] + fn output_primary_loss_cancels_the_invocation() { + let invocation_cancellation = CancellationToken::new(); + let (_publisher, primary) = + live_output_stream_bus::(1, invocation_cancellation.clone()).unwrap(); + + drop(primary); + + assert!(invocation_cancellation.is_cancelled()); + } + + #[test] + async fn input_primary_loss_is_stream_scoped_and_notifies_the_producer() { + let invocation_cancellation = CancellationToken::new(); + let first_stream_cancellation = invocation_cancellation.child_token(); + let second_stream_cancellation = invocation_cancellation.child_token(); + let producer_notification = Arc::new(Notify::new()); + let (_first_publisher, first_primary) = live_input_stream_bus::( + 1, + first_stream_cancellation.clone(), + producer_notification.clone(), + ) + .unwrap(); + let (second_publisher, second_primary) = live_input_stream_bus( + 1, + second_stream_cancellation.clone(), + Arc::new(Notify::new()), + ) + .unwrap(); + let mut second_primary = second_primary.activate(); + let notification = producer_notification.notified(); + + drop(first_primary); + + notification.await; + assert!(first_stream_cancellation.is_cancelled()); + assert!(!second_stream_cancellation.is_cancelled()); + assert!(!invocation_cancellation.is_cancelled()); + assert_eq!(second_publisher.publish_item(1).await, Ok(0)); + assert_eq!(second_primary.recv().await.unwrap().offset, 0); + } + + #[test] + async fn stream_scoped_primary_loss_does_not_cancel_a_sibling_bus() { + let first_cancelled = Arc::new(AtomicBool::new(false)); + let second_cancelled = Arc::new(AtomicBool::new(false)); + let (_first_publisher, first_primary) = live_stream_bus::(1, { + let first_cancelled = first_cancelled.clone(); + move || first_cancelled.store(true, Ordering::Release) + }) + .unwrap(); + let (second_publisher, second_primary) = live_stream_bus(1, { + let second_cancelled = second_cancelled.clone(); + move || second_cancelled.store(true, Ordering::Release) + }) + .unwrap(); + let mut second_primary = second_primary.activate(); + + drop(first_primary); + assert!(first_cancelled.load(Ordering::Acquire)); + assert!(!second_cancelled.load(Ordering::Acquire)); + assert_eq!(second_publisher.publish_item(1).await, Ok(0)); + assert_eq!(second_primary.recv().await.unwrap().offset, 0); + } + + #[test] + async fn terminal_is_unique_and_rejects_every_later_publish() { + let cancelled = Arc::new(AtomicBool::new(false)); + let (publisher, primary) = live_stream_bus(4, { + let cancelled = cancelled.clone(); + move || cancelled.store(true, Ordering::Release) + }) + .unwrap(); + let mut primary = primary.activate(); + publisher.publish_item(1).await.unwrap(); + assert_eq!(publisher.publish_error("failed".to_string()).await, Ok(1)); + assert_eq!( + publisher.publish_end().await, + Err(LiveStreamPublishError::Terminated) + ); + assert_eq!( + publisher.publish_cancel("cancelled".to_string()).await, + Err(LiveStreamPublishError::Terminated) + ); + assert_eq!( + publisher.publish_item(2).await, + Err(LiveStreamPublishError::Terminated) + ); + + assert!(matches!( + primary.recv().await.unwrap().payload, + LiveStreamEventPayload::Item(1) + )); + assert!(matches!( + primary.recv().await.unwrap().payload, + LiveStreamEventPayload::Error(error) if error == "failed" + )); + drop(primary); + assert!(!cancelled.load(Ordering::Acquire)); + } + + #[test] + async fn checked_offset_overflow_does_not_publish() { + let (publisher, primary) = live_stream_bus(1, || {}).unwrap(); + let mut primary = primary.activate(); + publisher.state.lock().await.next_offset = u64::MAX; + + assert_eq!( + publisher.publish_item(1).await, + Err(LiveStreamPublishError::OffsetOverflow) + ); + assert!( + tokio::time::timeout(Duration::from_millis(20), primary.recv()) + .await + .is_err() + ); + } +} diff --git a/golem-worker-executor/src/durable_host/stream_session.rs b/golem-worker-executor/src/durable_host/stream_session.rs index ea937cb95e..84e1ed81af 100644 --- a/golem-worker-executor/src/durable_host/stream_session.rs +++ b/golem-worker-executor/src/durable_host/stream_session.rs @@ -13,10 +13,14 @@ // limitations under the License. use crate::durable_host::schema_value_stream::contains_stream; +use crate::durable_host::stream_bus::{ + AuxiliaryLiveStreamSubscriber, LiveStreamEventPayload, LiveStreamPublishError, + LiveStreamPublisher, PrimaryLiveStreamSubscriber, +}; #[cfg(test)] use crate::durable_host::stream_transport::LiveStreamTracker; use crate::durable_host::stream_transport::{ - RelayPeer, RelayReceiver, SourceLifecycle, relay_endpoint_pair, + LiveStreamEndpoint, LiveStreamPeer, SourceLifecycle, input_stream_pair, }; use golem_api_grpc::proto::golem::common::Empty; use golem_api_grpc::proto::golem::schema::{ @@ -25,29 +29,16 @@ use golem_api_grpc::proto::golem::schema::{ VariantValue, result_value as proto_result_value, schema_value as proto_schema_value, }; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame as LiveInvocationFrame, StreamDemand as LiveStreamDemand, - StreamDetach as LiveStreamDetach, StreamEnd as LiveStreamEnd, StreamError as LiveStreamError, - StreamItem as LiveStreamItem, invocation_frame as live_invocation_frame, + InputStreamAck, InputStreamEnd, InputStreamItem, InvocationRequest, InvocationResponse, + OutputStreamEnd, OutputStreamError, OutputStreamItem, StreamCancel, StreamCancelReason, + StreamCancelRole, input_stream_item, invocation_request, invocation_response, }; use golem_schema::schema::SchemaValue; -#[cfg(test)] -use golem_schema::schema::SchemaValueStreamHandleRep; use std::collections::{HashMap, HashSet}; -use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; +use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use tokio::sync::mpsc; -enum ImportedStreamEvent { - Item(ImportedStreamItem), - End, - Error(String), -} - -struct ImportedStreamItem { - value: SchemaValue, - registrations: ImportedRegistrationBatch, -} - #[must_use = "imported stream registrations must be committed or rolled back"] #[derive(Default)] struct ImportedRegistrationBatch { @@ -55,8 +46,6 @@ struct ImportedRegistrationBatch { } impl ImportedRegistrationBatch { - fn discharge_by_session_cancellation(self) {} - fn is_empty(&self) -> bool { self.stream_ids.is_empty() } @@ -64,26 +53,68 @@ impl ImportedRegistrationBatch { #[derive(Clone)] struct ImportedStreamRoute { - events: mpsc::Sender, - demand_outstanding: Arc, lifecycle: Arc, + publisher: LiveStreamPublisher, + next_sequence: Arc>, + acknowledgements: Arc>, + completed: tokio_util::sync::CancellationToken, +} + +#[derive(Default)] +struct InputAcknowledgementState { + next_offset: u64, + consumer_closed: bool, } enum ImportedStreamState { Registering(ImportedStreamRoute), Active(ImportedStreamRoute), - DetachPending { response_outstanding: bool }, - DetachedAwaitingResponse, +} + +enum ImportedTerminal { + End, + Error(String), + Cancel(String), +} + +#[derive(Debug, PartialEq, Eq)] +pub(crate) enum InputItemAdmission { + Acknowledged(InputStreamAck), + ConsumerClosed, } #[derive(Default)] struct ImportedStreams { states: HashMap, + cancelled: HashMap, +} + +struct ExportedStreamRoute { + lifecycle: Arc, + publisher: LiveStreamPublisher, + cancelled: tokio_util::sync::CancellationToken, + activated: tokio_util::sync::CancellationToken, + acknowledgements: Option>, + announced: Arc, + next_sent_offset: Arc, + terminal_sent: Arc, +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum SessionSide { + Client, + Server, } -enum ExportedStreamCommand { - Demand, - Detach, +#[derive(Clone)] +enum SessionFrames { + Requests(mpsc::Sender), + Responses(mpsc::Sender), +} + +enum OutboundStreamMessage { + Request(invocation_request::Request), + Response(invocation_response::Response), } #[derive(Default)] @@ -102,6 +133,16 @@ impl SessionActivity { fn is_idle(&self) -> bool { self.active.load(Ordering::Acquire) == 0 } + + async fn wait_until(&self, remaining: usize) { + loop { + let changed = self.changed.notified(); + if self.active.load(Ordering::Acquire) <= remaining { + return; + } + changed.await; + } + } } struct SessionActivityGuard(Arc); @@ -117,35 +158,73 @@ impl Drop for SessionActivityGuard { struct LiveValueSessionInner { next_stream_id: std::sync::atomic::AtomicU64, expected_remote_parity: u64, - frames: mpsc::Sender, - exported: Mutex>>, + side: SessionSide, + frames: SessionFrames, + exported: Mutex>, imported: Mutex, imported_changed: tokio::sync::Notify, seen_remote_stream_ids: Mutex>, activity: Arc, cancelled: tokio_util::sync::CancellationToken, failure: Mutex>, + stream_capacity: usize, } -/// Converts recursive live values to and from the session protocol and drives -/// one demand/item exchange per stream. The two peers allocate disjoint odd -/// and even stream IDs, so sibling streams cannot alias even when nested -/// streams are discovered in later items. +/// Converts recursive live values to and from the session protocol. The two +/// peers allocate disjoint odd and even stream IDs, so sibling streams cannot +/// alias even when nested streams are discovered in later items. #[derive(Clone)] pub(crate) struct LiveValueSession { inner: Arc, } impl LiveValueSession { - pub(crate) fn new( - first_local_stream_id: u64, - frames: mpsc::Sender, + #[cfg(test)] + pub(crate) fn new_client(frames: mpsc::Sender) -> Self { + Self::new_client_with_capacity(frames, 32) + } + + #[cfg(test)] + pub(crate) fn new_server(frames: mpsc::Sender) -> Self { + Self::new_server_with_capacity(frames, 32) + } + + pub(crate) fn new_client_with_capacity( + frames: mpsc::Sender, + stream_capacity: usize, + ) -> Self { + Self::new_with_capacity( + SessionSide::Client, + SessionFrames::Requests(frames), + stream_capacity, + ) + } + + pub(crate) fn new_server_with_capacity( + frames: mpsc::Sender, + stream_capacity: usize, ) -> Self { - debug_assert!(first_local_stream_id == 1 || first_local_stream_id == 2); + Self::new_with_capacity( + SessionSide::Server, + SessionFrames::Responses(frames), + stream_capacity, + ) + } + + fn new_with_capacity(side: SessionSide, frames: SessionFrames, stream_capacity: usize) -> Self { + assert!( + stream_capacity > 0, + "live stream bus capacity must be non-zero" + ); + let first_local_stream_id = match side { + SessionSide::Client => 1, + SessionSide::Server => 2, + }; Self { inner: Arc::new(LiveValueSessionInner { next_stream_id: std::sync::atomic::AtomicU64::new(first_local_stream_id), expected_remote_parity: 1 - (first_local_stream_id & 1), + side, frames, exported: Mutex::new(HashMap::new()), imported: Mutex::new(ImportedStreams::default()), @@ -154,13 +233,36 @@ impl LiveValueSession { activity: Arc::new(SessionActivity::default()), cancelled: tokio_util::sync::CancellationToken::new(), failure: Mutex::new(None), + stream_capacity, }), } } pub(crate) fn encode(&self, value: &SchemaValue) -> Result { + let (value, stream_ids) = self.encode_with_registered_streams(value)?; + self.activate_exported_streams(&stream_ids); + Ok(value) + } + + pub(crate) fn encode_pending( + &self, + value: &SchemaValue, + ) -> Result<(ProtoSchemaValue, Vec), String> { self.encode_with_registered_streams(value) - .map(|(value, _)| value) + } + + pub(crate) fn activate_exported_streams(&self, stream_ids: &[u64]) { + let exported = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned"); + for stream_id in stream_ids { + if let Some(route) = exported.get(stream_id) { + route.announced.store(true, Ordering::Release); + route.activated.cancel(); + } + } } fn encode_with_registered_streams( @@ -184,7 +286,9 @@ impl LiveValueSession { .lock() .expect("live stream map mutex poisoned"); for id in stream_ids { - exported.remove(id); + if let Some(route) = exported.remove(id) { + route.cancelled.cancel(); + } } } @@ -200,8 +304,10 @@ impl LiveValueSession { let value = match value { SchemaValue::Stream(stream) => { let id = self.allocate_local_stream_id()?; - let receiver = stream.take_host_endpoint::()?; - self.spawn_exported(id, receiver)?; + let endpoint = stream.take_host_endpoint::()?; + let lifecycle = endpoint.lifecycle(); + let publisher = endpoint.publisher(); + self.spawn_exported(id, endpoint.activate(), lifecycle, publisher)?; registered_stream_ids.push(id); proto_schema_value::Value::StreamReference(SchemaValueStreamReference { stream_id: id, @@ -305,6 +411,21 @@ impl LiveValueSession { } pub(crate) async fn decode(&self, value: ProtoSchemaValue) -> Result { + self.decode_with_rollback(value, true).await + } + + pub(crate) async fn decode_start( + &self, + value: ProtoSchemaValue, + ) -> Result { + self.decode_with_rollback(value, false).await + } + + async fn decode_with_rollback( + &self, + value: ProtoSchemaValue, + notify_remote_on_rollback: bool, + ) -> Result { let _activity = self.inner.activity.start(); let (value, registrations) = self.decode_with_registered_streams(value); match value { @@ -313,7 +434,11 @@ impl LiveValueSession { Ok(value) } Err(error) => { - self.rollback_imported_streams(registrations).await; + if notify_remote_on_rollback { + self.rollback_imported_streams(registrations).await; + } else { + self.rollback_imported_streams_silently(registrations); + } Err(error) } } @@ -339,7 +464,8 @@ impl LiveValueSession { { proto_schema_value::Value::StreamReference(reference) => { self.validate_remote_id(reference.stream_id)?; - let (peer, stream) = relay_endpoint_pair(None); + let (peer, stream) = + input_stream_pair(self.inner.stream_capacity, &self.inner.cancelled)?; self.spawn_imported(reference.stream_id, peer)?; registrations.stream_ids.push(reference.stream_id); Ok(SchemaValue::Stream(stream)) @@ -450,93 +576,325 @@ impl LiveValueSession { } } - pub(crate) async fn route_stream_frame( + pub(crate) async fn route_request( &self, - frame: live_invocation_frame::Frame, + request: invocation_request::Request, ) -> Result { let _activity = self.inner.activity.start(); - match frame { - live_invocation_frame::Frame::Demand(demand) => { - let sender = self - .inner - .exported - .lock() - .expect("live stream map mutex poisoned") - .get(&demand.stream_id) - .cloned() - .ok_or_else(|| format!("demand for unknown stream {}", demand.stream_id))?; - let result = tokio::select! { - result = sender.send(ExportedStreamCommand::Demand) => result, - _ = self.inner.cancelled.cancelled() => return Ok(true), - }; - result.map_err(|_| format!("stream {} is no longer readable", demand.stream_id))?; + match request { + invocation_request::Request::InputItem(item) => { + if let InputItemAdmission::Acknowledged(ack) = self.admit_input_item(item).await? { + let route = self.imported_route(ack.stream_id)?; + let mut acknowledgements = route.acknowledgements.lock().await; + if acknowledgements.consumer_closed { + return Ok(true); + } + let next_offset = ack + .sequence + .checked_add(ack.logical_item_count) + .ok_or_else(|| { + format!("input stream {} ACK offset overflow", ack.stream_id) + })?; + if !self + .send_outbound(OutboundStreamMessage::Response( + invocation_response::Response::InputAck(ack), + )) + .await + { + return Err( + "invocation response stream closed before input ACK".to_string() + ); + } + acknowledgements.next_offset = next_offset; + } + Ok(true) + } + invocation_request::Request::InputEnd(end) => { + self.terminate_imported(end.stream_id, end.offset, ImportedTerminal::End) + .await?; + Ok(true) + } + invocation_request::Request::StreamCancel(cancel) => { + self.route_stream_cancel(cancel).await?; + Ok(true) + } + invocation_request::Request::Start(_) + | invocation_request::Request::ResumeAttach(_) => Ok(false), + } + } + + pub(crate) async fn route_response( + &self, + response: invocation_response::Response, + ) -> Result { + let _activity = self.inner.activity.start(); + match response { + invocation_response::Response::OutputItem(item) => { + let value = item + .value + .ok_or_else(|| format!("output stream {} item has no value", item.stream_id))?; + self.admit_imported_value(item.stream_id, item.offset, value) + .await?; + Ok(true) + } + invocation_response::Response::OutputEnd(end) => { + self.terminate_imported(end.stream_id, end.offset, ImportedTerminal::End) + .await?; + Ok(true) + } + invocation_response::Response::OutputError(error) => { + self.terminate_imported( + error.stream_id, + error.offset, + ImportedTerminal::Error(error.details), + ) + .await?; Ok(true) } - live_invocation_frame::Frame::Detach(detach) => { + invocation_response::Response::InputAck(ack) => { let sender = self .inner .exported .lock() .expect("live stream map mutex poisoned") - .get(&detach.stream_id) - .cloned() - .ok_or_else(|| format!("detach for unknown stream {}", detach.stream_id))?; - tokio::select! { - _ = sender.send(ExportedStreamCommand::Detach) => {} - _ = self.inner.cancelled.cancelled() => {} - } - self.inner - .exported - .lock() - .expect("live stream map mutex poisoned") - .remove(&detach.stream_id); + .get(&ack.stream_id) + .and_then(|route| route.acknowledgements.clone()) + .ok_or_else(|| { + format!("acknowledgement for unknown input stream {}", ack.stream_id) + })?; + sender + .send(ack) + .await + .map_err(|_| "input stream is no longer awaiting an ACK".to_string())?; Ok(true) } - live_invocation_frame::Frame::Item(item) => { - let stream_id = item.stream_id; - let value = item - .value - .ok_or_else(|| format!("stream {stream_id} item has no value"))?; - let route = self.take_imported_route(stream_id, false)?; + invocation_response::Response::StreamCancel(cancel) => { + self.route_stream_cancel(cancel).await?; + Ok(true) + } + invocation_response::Response::Accepted(_) + | invocation_response::Response::Rejected(_) + | invocation_response::Response::Result(_) + | invocation_response::Response::AttachmentRevoked(_) + | invocation_response::Response::Finished(_) => Ok(false), + } + } + + async fn admit_imported_value( + &self, + stream_id: u64, + offset: u64, + value: ProtoSchemaValue, + ) -> Result<(), String> { + let route = self.imported_route(stream_id)?; + let mut next_sequence = route.next_sequence.lock().await; + if offset != *next_sequence { + return Err(format!( + "output stream {stream_id} expected offset {}, got {offset}", + *next_sequence + )); + } + let following_offset = offset + .checked_add(1) + .ok_or_else(|| format!("output stream {stream_id} offset overflow"))?; + let (value, registrations) = self.decode_with_registered_streams(value); + let value = match value { + Ok(value) => value, + Err(error) => { + self.rollback_imported_streams(registrations).await; + return Err(error); + } + }; + match route.publisher.publish_item(value).await { + Ok(published_offset) if published_offset == offset => { + self.commit_imported_streams(registrations); + *next_sequence = following_offset; + Ok(()) + } + Ok(published_offset) => { + self.rollback_imported_streams(registrations).await; + Err(format!( + "output stream {stream_id} published offset {published_offset}, expected {offset}" + )) + } + Err(error) => { + self.rollback_imported_streams(registrations).await; + Err(format!( + "failed to admit output stream {stream_id} item: {error:?}" + )) + } + } + } + + async fn terminate_imported( + &self, + stream_id: u64, + offset: u64, + terminal: ImportedTerminal, + ) -> Result<(), String> { + let route = self.imported_route(stream_id)?; + let next_sequence = *route.next_sequence.lock().await; + if offset != next_sequence { + return Err(format!( + "stream {stream_id} expected terminal offset {next_sequence}, got {offset}" + )); + } + if self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .cancelled + .contains_key(&stream_id) + { + self.remove_cancelled_imported(stream_id); + return Ok(()); + } + let result = match terminal { + ImportedTerminal::End => route.publisher.publish_end().await, + ImportedTerminal::Error(error) => route.publisher.publish_error(error).await, + ImportedTerminal::Cancel(details) => route.publisher.publish_cancel(details).await, + }; + if let Err(error) = result { + if error == LiveStreamPublishError::Closed + && self.remove_cancelled_imported(stream_id).is_some() + { + return Ok(()); + } + return Err(format!( + "failed to publish terminal for stream {stream_id}: {error:?}" + )); + } + route.lifecycle.finish(); + if self.remove_imported(stream_id).is_none() { + self.remove_cancelled_imported(stream_id); + } + Ok(()) + } + + async fn route_stream_cancel(&self, cancel: StreamCancel) -> Result<(), String> { + let role = StreamCancelRole::try_from(cancel.role) + .map_err(|_| format!("invalid stream cancellation role {}", cancel.role))?; + match (self.inner.side, role) { + (SessionSide::Server, StreamCancelRole::InputProducer) + | (SessionSide::Client, StreamCancelRole::OutputProducer) => { + self.terminate_imported( + cancel.stream_id, + cancel.offset, + ImportedTerminal::Cancel( + cancel + .details + .unwrap_or_else(|| "stream producer cancelled".to_string()), + ), + ) + .await + } + (SessionSide::Server, StreamCancelRole::OutputConsumer) => { + self.cancel_for_output_consumer(cancel).await + } + (SessionSide::Client, StreamCancelRole::InputConsumer) => { + self.cancel_exported(cancel.stream_id) + } + _ => Err(format!( + "unexpected {:?} stream cancellation for {:?} session", + role, self.inner.side + )), + } + } + + pub(crate) async fn admit_input_item( + &self, + item: InputStreamItem, + ) -> Result { + let stream_id = item.stream_id; + let route = self.imported_route(stream_id)?; + let mut next_sequence = route.next_sequence.lock().await; + if item.sequence != *next_sequence { + return Err(format!( + "input stream {stream_id} expected sequence {}, got {}", + *next_sequence, item.sequence + )); + } + + let logical_item_count = match item.payload.as_ref() { + Some(input_stream_item::Payload::Value(_)) => 1, + Some(input_stream_item::Payload::PackedU8(bytes)) if !bytes.is_empty() => { + u64::try_from(bytes.len()) + .map_err(|_| format!("input stream {stream_id} logical item count overflow"))? + } + Some(input_stream_item::Payload::PackedU8(_)) => { + return Err("packed-u8 input item must not be empty".to_string()); + } + None => return Err("input stream item has no payload".to_string()), + }; + let following_sequence = item + .sequence + .checked_add(logical_item_count) + .ok_or_else(|| format!("input stream {stream_id} sequence overflow"))?; + + let mut values = Vec::new(); + match item.payload { + Some(input_stream_item::Payload::Value(value)) => { let (value, registrations) = self.decode_with_registered_streams(value); - let value = match value { - Ok(value) => value, + match value { + Ok(value) => values.push((value, registrations)), Err(error) => { self.rollback_imported_streams(registrations).await; return Err(error); } - }; - let item = ImportedStreamItem { - value, - registrations, - }; - if let Some(route) = route { - if let Err(item) = self.send_imported_item(route, item).await { - self.rollback_imported_item(item).await; - self.ensure_imported_detached(stream_id).await; - } - } else { - self.rollback_imported_item(item).await; } - Ok(true) } - live_invocation_frame::Frame::End(end) => { - let route = self.take_imported_route(end.stream_id, true)?; - if let Some(route) = route { - self.send_imported(route, ImportedStreamEvent::End).await; - } - Ok(true) + Some(input_stream_item::Payload::PackedU8(bytes)) if !bytes.is_empty() => { + values.extend( + bytes.into_iter().map(|value| { + (SchemaValue::U8(value), ImportedRegistrationBatch::default()) + }), + ); } - live_invocation_frame::Frame::StreamError(error) => { - let route = self.take_imported_route(error.stream_id, true)?; - if let Some(route) = route { - self.send_imported(route, ImportedStreamEvent::Error(error.details)) - .await; + Some(input_stream_item::Payload::PackedU8(_)) => { + return Err("packed-u8 input item must not be empty".to_string()); + } + None => return Err("input stream item has no payload".to_string()), + } + + let mut values = values.into_iter().enumerate(); + while let Some((index, (value, registrations))) = values.next() { + let expected_offset = item.sequence + index as u64; + match route.publisher.publish_item(value).await { + Ok(offset) if offset == expected_offset => { + self.commit_imported_streams(registrations); + } + Ok(offset) => { + self.rollback_imported_streams(registrations).await; + self.fail(format!( + "input stream {stream_id} published offset {offset}, expected {expected_offset}" + )); + return Err(format!( + "input stream {stream_id} published offset {offset}, expected {expected_offset}" + )); + } + Err(LiveStreamPublishError::Closed) => { + self.rollback_imported_streams(registrations).await; + for (_, (_, registrations)) in values { + self.rollback_imported_streams(registrations).await; + } + *next_sequence = following_sequence; + return Ok(InputItemAdmission::ConsumerClosed); + } + Err(error) => { + self.rollback_imported_streams(registrations).await; + return Err(format!( + "failed to admit input stream {stream_id} item: {error:?}" + )); } - Ok(true) } - _ => Ok(false), } + *next_sequence = following_sequence; + Ok(InputItemAdmission::Acknowledged(InputStreamAck { + stream_id, + sequence: item.sequence, + logical_item_count, + })) } pub(crate) async fn wait_idle(&self) { @@ -563,207 +921,397 @@ impl LiveValueSession { pub(crate) fn cancel(&self) { self.inner.cancelled.cancel(); - self.inner - .imported - .lock() - .expect("live stream map mutex poisoned") - .states - .retain(|_, state| matches!(state, ImportedStreamState::Active(_))); - self.inner.imported_changed.notify_waiters(); - } - - pub(crate) fn is_cancelled(&self) -> bool { - self.inner.cancelled.is_cancelled() - } - - pub(crate) async fn finish_invocation(&self) -> Result<(), String> { - loop { - let activity_changed = self.inner.activity.changed.notified(); - let imported_changed = self.inner.imported_changed.notified(); - let (imported, imported_settling) = { - let imported = self - .inner - .imported - .lock() - .expect("live stream map mutex poisoned"); - let mut active = Vec::new(); - let mut settling = false; - for (id, state) in &imported.states { - match state { - ImportedStreamState::Active(route) - if route.lifecycle.finished.load(Ordering::Acquire) => - { - settling = true; - } - ImportedStreamState::Registering(_) - | ImportedStreamState::DetachPending { .. } - | ImportedStreamState::DetachedAwaitingResponse => settling = true, - ImportedStreamState::Active(_) => active.push(*id), - } + let (imported, cancelled_imported) = { + let mut imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + ( + std::mem::take(&mut imported.states), + std::mem::take(&mut imported.cancelled), + ) + }; + for state in imported.into_values() { + let route = match state { + ImportedStreamState::Registering(route) | ImportedStreamState::Active(route) => { + route } - (active, settling) }; - let exported = self + route.publisher.close(); + route.lifecycle.finish(); + route.completed.cancel(); + } + for route in cancelled_imported.into_values() { + route.completed.cancel(); + } + let exported = std::mem::take( + &mut *self .inner .exported .lock() + .expect("live stream map mutex poisoned"), + ); + for route in exported.into_values() { + route.cancelled.cancel(); + } + self.inner.imported_changed.notify_waiters(); + } + + async fn cancel_for_output_consumer(&self, cancel: StreamCancel) -> Result<(), String> { + let imported = std::mem::take( + &mut self + .inner + .imported + .lock() .expect("live stream map mutex poisoned") - .keys() - .copied() - .collect::>(); - if imported.is_empty() && exported.is_empty() { - if !self.inner.activity.is_idle() || imported_settling { - tokio::select! { - _ = activity_changed => continue, - _ = imported_changed => continue, - _ = self.inner.cancelled.cancelled() => return Ok(()), - } + .states, + ); + let mut imported_terminals = Vec::with_capacity(imported.len()); + for (stream_id, state) in imported { + let route = match state { + ImportedStreamState::Registering(route) | ImportedStreamState::Active(route) => { + route } - self.cancel(); - return Ok(()); - } - - let details = format!( - "live invocation terminated with open imported streams {imported:?} and open exported streams {exported:?}" - ); - self.fail(details.clone()); - return Err(details); + }; + imported_terminals.push((stream_id, route.next_sequence.clone())); + route.publisher.close(); + route.lifecycle.finish(); + route.completed.cancel(); } - } - pub(crate) fn fail(&self, error: String) { - *self - .inner - .failure - .lock() - .expect("live invocation failure mutex poisoned") = Some(error); - self.cancel(); - } + let exported = std::mem::take( + &mut *self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned"), + ); + self.inner.cancelled.cancel(); + let mut exported_terminals = Vec::with_capacity(exported.len()); + for (stream_id, route) in exported { + exported_terminals.push(( + stream_id, + route.announced, + route.next_sent_offset, + route.terminal_sent, + )); + route.cancelled.cancel(); + } + self.inner.imported_changed.notify_waiters(); - async fn send_frame(&self, frame: live_invocation_frame::Frame) -> bool { - tokio::select! { - result = self.inner.frames.send(LiveInvocationFrame { frame: Some(frame) }) => { - result.is_ok() + let frames = match &self.inner.frames { + SessionFrames::Responses(frames) => frames.clone(), + SessionFrames::Requests(_) => { + return Err( + "output-consumer cancellation is only valid for server sessions".into(), + ); + } + }; + self.inner.activity.wait_until(1).await; + imported_terminals.sort_unstable_by_key(|(stream_id, _)| *stream_id); + for (stream_id, next_sequence) in imported_terminals { + let offset = *next_sequence.lock().await; + if frames + .send(InvocationResponse { + response: Some(invocation_response::Response::StreamCancel(StreamCancel { + stream_id, + offset, + role: StreamCancelRole::InputConsumer as i32, + reason: cancel.reason, + details: cancel.details.clone(), + })), + }) + .await + .is_err() + { + return Ok(()); } - _ = self.inner.cancelled.cancelled() => false, } - } - async fn rollback_imported_item(&self, item: ImportedStreamItem) { - let ImportedStreamItem { - value, - registrations, - } = item; - self.rollback_imported_streams(registrations).await; - drop(value); + exported_terminals.sort_unstable_by_key(|(stream_id, _, _, _)| *stream_id); + for (stream_id, announced, next_sent_offset, terminal_sent) in exported_terminals { + if !announced.load(Ordering::Acquire) || terminal_sent.load(Ordering::Acquire) { + continue; + } + let offset = if stream_id == cancel.stream_id { + cancel.offset + } else { + next_sent_offset.load(Ordering::Acquire) + }; + if frames + .send(InvocationResponse { + response: Some(invocation_response::Response::StreamCancel(StreamCancel { + stream_id, + offset, + role: StreamCancelRole::OutputProducer as i32, + reason: cancel.reason, + details: cancel.details.clone(), + })), + }) + .await + .is_err() + { + return Ok(()); + } + } + Ok(()) } - async fn rollback_imported_streams(&self, registrations: ImportedRegistrationBatch) { - if registrations.is_empty() { - return; - } - for id in registrations.stream_ids { - self.ensure_imported_detached(id).await; - } + pub(crate) fn is_cancelled(&self) -> bool { + self.inner.cancelled.is_cancelled() } - async fn ensure_imported_detached(&self, id: u64) { - enum DetachStep { - Send, - Wait, - Done, - } + #[allow(dead_code)] + pub(crate) fn subscribe_output_tail( + &self, + stream_id: u64, + ) -> Result, String> { + self.inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .get(&stream_id) + .map(|route| route.publisher.subscribe_tail()) + .ok_or_else(|| format!("subscription for unknown output stream {stream_id}")) + } + pub(crate) async fn finish_invocation(&self) -> Result<(), String> { loop { + let activity_changed = self.inner.activity.changed.notified(); let imported_changed = self.inner.imported_changed.notified(); - let step = { - let mut imported = self + let (imported, imported_settling) = { + let imported = self .inner .imported .lock() .expect("live stream map mutex poisoned"); - match imported.states.get(&id) { - Some( - ImportedStreamState::Registering(route) - | ImportedStreamState::Active(route), - ) => { - let response_outstanding = - route.demand_outstanding.swap(false, Ordering::AcqRel); - imported.states.insert( - id, - ImportedStreamState::DetachPending { - response_outstanding, - }, - ); - DetachStep::Send + let mut active = Vec::new(); + let mut settling = false; + for (id, state) in &imported.states { + match state { + ImportedStreamState::Active(route) + if route.lifecycle.finished.load(Ordering::Acquire) => + { + settling = true; + } + ImportedStreamState::Registering(_) => settling = true, + ImportedStreamState::Active(_) => active.push(*id), } - Some(ImportedStreamState::DetachPending { .. }) => DetachStep::Wait, - Some(ImportedStreamState::DetachedAwaitingResponse) | None => DetachStep::Done, } + (active, settling) }; - match step { - DetachStep::Send => { - self.inner.imported_changed.notify_waiters(); - let sent = self - .send_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: id, - })) - .await; - let mut imported = self - .inner - .imported - .lock() - .expect("live stream map mutex poisoned"); - let response_outstanding = match imported.states.get(&id) { - Some(ImportedStreamState::DetachPending { - response_outstanding, - }) => Some(*response_outstanding), - _ => None, - }; - match response_outstanding { - Some(true) if sent && !self.is_cancelled() => { - imported - .states - .insert(id, ImportedStreamState::DetachedAwaitingResponse); - } - Some(_) => { - imported.states.remove(&id); - } - None => {} - } - drop(imported); - self.inner.imported_changed.notify_waiters(); - if !sent && !self.is_cancelled() { - self.cancel(); + let (exported, exported_settling) = { + let exported = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned"); + let mut active = Vec::new(); + let mut settling = false; + for (id, route) in exported.iter() { + if route.lifecycle.finished.load(Ordering::Acquire) { + settling = true; + } else { + active.push(*id); } - return; } - DetachStep::Wait => { + (active, settling) + }; + if imported.is_empty() && exported.is_empty() { + if !self.inner.activity.is_idle() || imported_settling || exported_settling { tokio::select! { - _ = imported_changed => {} - _ = self.inner.cancelled.cancelled() => { - let mut imported = self - .inner - .imported - .lock() - .expect("live stream map mutex poisoned"); - if matches!( - imported.states.get(&id), - Some(ImportedStreamState::DetachPending { .. }) - ) { - imported.states.remove(&id); - } - drop(imported); - self.inner.imported_changed.notify_waiters(); - return; - } + _ = activity_changed => continue, + _ = imported_changed => continue, } } - DetachStep::Done => return, + return Ok(()); + } + + let details = format!( + "live invocation terminated with open imported streams {imported:?} and open exported streams {exported:?}" + ); + self.terminate_for_failure(&details).await; + return Err(details); + } + } + + pub(crate) async fn terminate_for_failure(&self, details: &str) { + let exported = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .values() + .map(|route| route.publisher.clone()) + .collect::>(); + for publisher in exported { + let _ = publisher.publish_error(details.to_string()).await; + } + + let imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .states + .keys() + .copied() + .collect::>(); + for id in imported { + self.cancel_imported(id, details).await; + } + + self.wait_idle().await; + *self + .inner + .failure + .lock() + .expect("live invocation failure mutex poisoned") = Some(details.to_string()); + self.cancel(); + } + + pub(crate) fn fail(&self, error: String) { + *self + .inner + .failure + .lock() + .expect("live invocation failure mutex poisoned") = Some(error); + self.cancel(); + } + + async fn send_outbound(&self, message: OutboundStreamMessage) -> bool { + match (&self.inner.frames, message) { + (SessionFrames::Requests(frames), OutboundStreamMessage::Request(request)) => { + tokio::select! { + result = frames.send(InvocationRequest { request: Some(request) }) => result.is_ok(), + _ = self.inner.cancelled.cancelled() => false, + } + } + (SessionFrames::Responses(frames), OutboundStreamMessage::Response(response)) => { + tokio::select! { + result = frames.send(InvocationResponse { response: Some(response) }) => result.is_ok(), + _ = self.inner.cancelled.cancelled() => false, + } } + (SessionFrames::Requests(_), OutboundStreamMessage::Response(_)) + | (SessionFrames::Responses(_), OutboundStreamMessage::Request(_)) => { + self.fail( + "live session attempted to send a message in the wrong direction".to_string(), + ); + false + } + } + } + + async fn rollback_imported_streams(&self, registrations: ImportedRegistrationBatch) { + for id in registrations.stream_ids { + self.cancel_imported(id, "recursive stream registration was rolled back") + .await; + } + } + + fn rollback_imported_streams_silently(&self, registrations: ImportedRegistrationBatch) { + for id in registrations.stream_ids { + if let Some(route) = self.remove_imported(id) { + route.publisher.close(); + route.lifecycle.finish(); + } + } + } + + async fn cancel_imported(&self, id: u64, details: &str) { + let Some(route) = self.retain_cancelled_imported(id) else { + return; + }; + let mut acknowledgements = route.acknowledgements.lock().await; + acknowledgements.consumer_closed = true; + let offset = acknowledgements.next_offset; + let role = match self.inner.side { + SessionSide::Client => StreamCancelRole::OutputConsumer, + SessionSide::Server => StreamCancelRole::InputConsumer, + }; + let cancel = StreamCancel { + stream_id: id, + offset, + role: role as i32, + reason: StreamCancelReason::Cancelled as i32, + details: Some(details.to_string()), + }; + let message = match self.inner.side { + SessionSide::Client => { + OutboundStreamMessage::Request(invocation_request::Request::StreamCancel(cancel)) + } + SessionSide::Server => { + OutboundStreamMessage::Response(invocation_response::Response::StreamCancel(cancel)) + } + }; + let _ = self.send_outbound(message).await; + if self.inner.side == SessionSide::Client { + self.cancel(); } } + fn remove_imported(&self, id: u64) -> Option { + let state = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .states + .remove(&id); + self.inner.imported_changed.notify_waiters(); + state.map(|state| match state { + ImportedStreamState::Registering(route) | ImportedStreamState::Active(route) => { + route.completed.cancel(); + route + } + }) + } + + fn retain_cancelled_imported(&self, id: u64) -> Option { + let mut imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + let state = imported.states.remove(&id)?; + let route = match state { + ImportedStreamState::Registering(route) | ImportedStreamState::Active(route) => route, + }; + route.completed.cancel(); + route.publisher.close(); + route.lifecycle.finish(); + imported.cancelled.insert(id, route.clone()); + drop(imported); + self.inner.imported_changed.notify_waiters(); + Some(route) + } + + fn remove_cancelled_imported(&self, id: u64) -> Option { + let route = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .cancelled + .remove(&id); + self.inner.imported_changed.notify_waiters(); + route + } + + fn cancel_exported(&self, id: u64) -> Result<(), String> { + let route = self + .inner + .exported + .lock() + .expect("live stream map mutex poisoned") + .remove(&id) + .ok_or_else(|| format!("cancellation for unknown local stream {id}"))?; + route.cancelled.cancel(); + Ok(()) + } + fn commit_imported_streams(&self, registrations: ImportedRegistrationBatch) { if registrations.is_empty() { return; @@ -788,37 +1336,6 @@ impl LiveValueSession { self.inner.imported_changed.notify_waiters(); } - async fn send_exported_terminal( - &self, - id: u64, - frame: live_invocation_frame::Frame, - command_rx: &mut mpsc::Receiver, - ) -> bool { - loop { - tokio::select! { - biased; - command = command_rx.recv() => match command { - Some(ExportedStreamCommand::Demand) => {} - Some(ExportedStreamCommand::Detach) => { - return self.send_detached_response(id).await; - } - None => return false, - }, - result = self.inner.frames.send(LiveInvocationFrame { - frame: Some(frame.clone()), - }) => return result.is_ok(), - _ = self.inner.cancelled.cancelled() => return false, - } - } - } - - async fn send_detached_response(&self, id: u64) -> bool { - self.send_frame(live_invocation_frame::Frame::End(LiveStreamEnd { - stream_id: id, - })) - .await - } - fn validate_remote_id(&self, id: u64) -> Result<(), String> { if id == 0 || id & 1 != self.inner.expected_remote_parity { Err(format!("invalid remote stream id {id}")) @@ -827,6 +1344,25 @@ impl LiveValueSession { } } + fn imported_route(&self, id: u64) -> Result { + self.validate_remote_id(id)?; + let imported = self + .inner + .imported + .lock() + .expect("live stream map mutex poisoned"); + imported + .states + .get(&id) + .map(|state| match state { + ImportedStreamState::Registering(route) | ImportedStreamState::Active(route) => { + route.clone() + } + }) + .or_else(|| imported.cancelled.get(&id).cloned()) + .ok_or_else(|| format!("item for unknown remote stream {id}")) + } + fn allocate_local_stream_id(&self) -> Result { loop { let current = self.inner.next_stream_id.load(Ordering::Acquire); @@ -845,8 +1381,61 @@ impl LiveValueSession { } } - fn spawn_exported(&self, id: u64, mut receiver: RelayReceiver) -> Result<(), String> { - let (commands, mut command_rx) = mpsc::channel(1); + fn exported_end(&self, stream_id: u64, offset: u64) -> OutboundStreamMessage { + match self.inner.side { + SessionSide::Client => OutboundStreamMessage::Request( + invocation_request::Request::InputEnd(InputStreamEnd { stream_id, offset }), + ), + SessionSide::Server => OutboundStreamMessage::Response( + invocation_response::Response::OutputEnd(OutputStreamEnd { stream_id, offset }), + ), + } + } + + fn exported_error( + &self, + stream_id: u64, + offset: u64, + details: String, + ) -> OutboundStreamMessage { + match self.inner.side { + SessionSide::Client => OutboundStreamMessage::Request( + invocation_request::Request::StreamCancel(StreamCancel { + stream_id, + offset, + role: StreamCancelRole::InputProducer as i32, + reason: StreamCancelReason::Cancelled as i32, + details: Some(details), + }), + ), + SessionSide::Server => OutboundStreamMessage::Response( + invocation_response::Response::OutputError(OutputStreamError { + stream_id, + offset, + details, + }), + ), + } + } + + fn spawn_exported( + &self, + id: u64, + mut receiver: PrimaryLiveStreamSubscriber, + lifecycle: Arc, + publisher: LiveStreamPublisher, + ) -> Result<(), String> { + let cancelled = self.inner.cancelled.child_token(); + let activated = tokio_util::sync::CancellationToken::new(); + let announced = Arc::new(AtomicBool::new(false)); + let next_sent_offset = Arc::new(AtomicU64::new(0)); + let terminal_sent = Arc::new(AtomicBool::new(false)); + let (acknowledgements, mut acknowledgement_rx) = if self.inner.side == SessionSide::Client { + let (sender, receiver) = mpsc::channel(1); + (Some(sender), Some(receiver)) + } else { + (None, None) + }; let mut exported = self .inner .exported @@ -854,7 +1443,16 @@ impl LiveValueSession { .expect("live stream map mutex poisoned"); match exported.entry(id) { std::collections::hash_map::Entry::Vacant(entry) => { - entry.insert(commands); + entry.insert(ExportedStreamRoute { + lifecycle, + publisher, + cancelled: cancelled.clone(), + activated: activated.clone(), + acknowledgements, + announced: announced.clone(), + next_sent_offset: next_sent_offset.clone(), + terminal_sent: terminal_sent.clone(), + }); } std::collections::hash_map::Entry::Occupied(_) => { return Err(format!("duplicate local stream id {id}")); @@ -865,113 +1463,131 @@ impl LiveValueSession { let activity = self.inner.activity.start(); tokio::spawn(async move { let _activity = activity; + tokio::select! { + _ = activated.cancelled() => {} + _ = cancelled.cancelled() => return, + _ = session.inner.cancelled.cancelled() => return, + } loop { - let command = tokio::select! { - command = command_rx.recv() => command, - _ = session.inner.cancelled.cancelled() => None, + let event = tokio::select! { + event = receiver.recv() => event, + _ = cancelled.cancelled() => break, + _ = session.inner.cancelled.cancelled() => break, }; - let Some(command) = command else { - break; - }; - match command { - ExportedStreamCommand::Demand => { - let next = tokio::select! { - biased; - command = command_rx.recv() => match command { - Some(ExportedStreamCommand::Detach) => { - session.send_detached_response(id).await; - None - } - None => None, - Some(ExportedStreamCommand::Demand) => { - session.send_exported_terminal( - id, - live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: id, - details: "stream received overlapping demand".to_string(), - }), - &mut command_rx, - ).await; - None + let (message, registered_stream_ids, terminal, expected_ack, sent_offset) = + match event { + Ok(event) => { + match event.payload { + LiveStreamEventPayload::Item(value) => { + match session.encode_with_registered_streams(&value) { + Ok((value, registered_stream_ids)) => { + let message = match session.inner.side { + SessionSide::Client => OutboundStreamMessage::Request( + invocation_request::Request::InputItem( + InputStreamItem { + stream_id: id, + sequence: event.offset, + payload: Some( + input_stream_item::Payload::Value(value), + ), + }, + ), + ), + SessionSide::Server => OutboundStreamMessage::Response( + invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: id, + offset: event.offset, + value: Some(value), + }, + ), + ), + }; + ( + message, + registered_stream_ids, + false, + (session.inner.side == SessionSide::Client) + .then_some((event.offset, 1)), + Some(event.offset + 1), + ) + } + Err(error) => ( + session.exported_error(id, event.offset, error), + Vec::new(), + true, + None, + None, + ), + } } - }, - next = receiver.next() => Some(next), - _ = session.inner.cancelled.cancelled() => break, - }; - let Some(next) = next else { - break; - }; - let (frame, registered_stream_ids) = match next { - Ok(Some(value)) => match session.encode_with_registered_streams(&value) - { - Ok((value, registered_stream_ids)) => ( - live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: id, - value: Some(value), - }), - registered_stream_ids, + LiveStreamEventPayload::End => ( + session.exported_end(id, event.offset), + Vec::new(), + true, + None, + None, ), - Err(error) => ( - live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: id, - details: error, - }), + LiveStreamEventPayload::Error(error) + | LiveStreamEventPayload::Cancel(error) => ( + session.exported_error(id, event.offset, error), Vec::new(), + true, + None, + None, ), - }, - Ok(None) => ( - live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: id }), - Vec::new(), - ), - Err(error) => ( - live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: id, - details: error, - }), - Vec::new(), - ), - }; - let terminal = matches!( - frame, - live_invocation_frame::Frame::End(_) - | live_invocation_frame::Frame::StreamError(_) - ); - let sent = tokio::select! { - biased; - command = command_rx.recv() => { - match command { - Some(ExportedStreamCommand::Demand) => { - session.discard_exported_streams(®istered_stream_ids); - session.send_exported_terminal( - id, - live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: id, - details: "stream received overlapping demand".to_string(), - }), - &mut command_rx, - ).await; - } - Some(ExportedStreamCommand::Detach) => { - session.discard_exported_streams(®istered_stream_ids); - session.send_detached_response(id).await; - } - None => {} - } - false - }, - result = session.inner.frames.send(LiveInvocationFrame { - frame: Some(frame), - }) => result.is_ok(), - _ = session.inner.cancelled.cancelled() => false, - }; - if !sent { - session.discard_exported_streams(®istered_stream_ids); - } - if !sent || terminal { - break; + } } + Err(error) => ( + session.exported_error( + id, + 0, + format!("failed to receive live stream event: {error:?}"), + ), + Vec::new(), + true, + None, + None, + ), + }; + if !session.send_outbound(message).await { + session.discard_exported_streams(®istered_stream_ids); + break; + } + if let Some(sent_offset) = sent_offset { + next_sent_offset.store(sent_offset, Ordering::Release); + } + if terminal { + terminal_sent.store(true, Ordering::Release); + } + session.activate_exported_streams(®istered_stream_ids); + if let Some((sequence, logical_item_count)) = expected_ack { + let ack = tokio::select! { + ack = acknowledgement_rx + .as_mut() + .expect("client stream has no acknowledgement receiver") + .recv() => ack, + _ = cancelled.cancelled() => None, + _ = session.inner.cancelled.cancelled() => None, + }; + let Some(ack) = ack else { + session.discard_exported_streams(®istered_stream_ids); + break; + }; + if ack.stream_id != id + || ack.sequence != sequence + || ack.logical_item_count != logical_item_count + { + session.discard_exported_streams(®istered_stream_ids); + session.fail(format!( + "input stream {id} received invalid acknowledgement ({}, {})", + ack.sequence, ack.logical_item_count + )); + break; } - ExportedStreamCommand::Detach => break, + } + if terminal { + break; } } session @@ -984,7 +1600,7 @@ impl LiveValueSession { Ok(()) } - fn spawn_imported(&self, id: u64, mut peer: RelayPeer) -> Result<(), String> { + fn spawn_imported(&self, id: u64, peer: LiveStreamPeer) -> Result<(), String> { if !self .inner .seen_remote_stream_ids @@ -994,8 +1610,7 @@ impl LiveValueSession { { return Err(format!("duplicate remote stream id {id}")); } - let (events, mut event_rx) = mpsc::channel(1); - let demand_outstanding = Arc::new(AtomicBool::new(false)); + let completed = tokio_util::sync::CancellationToken::new(); let previous = self .inner .imported @@ -1005,9 +1620,13 @@ impl LiveValueSession { .insert( id, ImportedStreamState::Registering(ImportedStreamRoute { - events, - demand_outstanding: demand_outstanding.clone(), lifecycle: peer.lifecycle.clone(), + publisher: peer.publisher.clone(), + next_sequence: Arc::new(tokio::sync::Mutex::new(0)), + acknowledgements: Arc::new(tokio::sync::Mutex::new( + InputAcknowledgementState::default(), + )), + completed: completed.clone(), }), ); debug_assert!(previous.is_none(), "new remote stream ID already imported"); @@ -1016,163 +1635,32 @@ impl LiveValueSession { let activity = self.inner.activity.start(); tokio::spawn(async move { let _activity = activity; - loop { - tokio::select! { - biased; - event = event_rx.recv() => match event { - Some(ImportedStreamEvent::Item(item)) => { - let permit = tokio::select! { - result = peer.item_tx.reserve() => result.ok(), - _ = session.inner.cancelled.cancelled() => None, - }; - if let Some(permit) = permit.filter(|_| !session.is_cancelled()) { - let ImportedStreamItem { - value, - registrations, - } = item; - session.commit_imported_streams(registrations); - permit.send(Ok(value)); - } else { - session.rollback_imported_item(item).await; - break; - } - } - Some(ImportedStreamEvent::Error(error)) => { - tokio::select! { - _ = peer.item_tx.send(Err(error)) => {} - _ = session.inner.cancelled.cancelled() => {} - } - break; - } - Some(ImportedStreamEvent::End) | None => break, - }, - _ = session.inner.cancelled.cancelled() => { - let error = session - .inner - .failure - .lock() - .expect("live invocation failure mutex poisoned") - .clone() - .unwrap_or_else(|| "live streaming invocation was cancelled".to_string()); - let _ = peer.item_tx.try_send(Err(error)); - break; - }, - demand = peer.demand_rx.recv() => match demand { - Some(()) => { - if demand_outstanding.swap(true, Ordering::AcqRel) { - let error = format!( - "remote stream {id} received overlapping local demand" - ); - session.fail(error.clone()); - let _ = peer.item_tx.try_send(Err(error)); - break; - } - if !session.send_frame( - live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: id, - }), - ).await { - demand_outstanding.store(false, Ordering::Release); - break; - } - } - None => break, - }, + tokio::select! { + _ = completed.cancelled() => {} + _ = session.inner.cancelled.cancelled() => { + peer.publisher.close(); + peer.lifecycle.finish(); } - } - event_rx.close(); - while let Ok(event) = event_rx.try_recv() { - if let ImportedStreamEvent::Item(item) = event { - if session.is_cancelled() { - let ImportedStreamItem { - value, - registrations, - } = item; - registrations.discharge_by_session_cancellation(); - drop(value); - } else { - session.rollback_imported_item(item).await; - } + _ = peer.primary_dropped.notified() => { + session.cancel_imported(id, "stream consumer dropped its primary reader").await; } } - session.ensure_imported_detached(id).await; }); Ok(()) } - - fn take_imported_route( - &self, - id: u64, - terminal: bool, - ) -> Result, String> { - self.validate_remote_id(id)?; - let mut imported = self - .inner - .imported - .lock() - .expect("live stream map mutex poisoned"); - let result = match imported.states.get_mut(&id) { - Some(ImportedStreamState::Registering(route) | ImportedStreamState::Active(route)) => { - if !route.demand_outstanding.swap(false, Ordering::AcqRel) { - return Err(format!( - "frame for remote stream {id} received without outstanding demand" - )); - } - let detached = route.lifecycle.finished.load(Ordering::Acquire); - let route = (!detached).then(|| route.clone()); - if terminal { - imported.states.remove(&id); - } - Ok(route) - } - Some(ImportedStreamState::DetachPending { - response_outstanding, - }) if *response_outstanding => { - *response_outstanding = false; - Ok(None) - } - Some(ImportedStreamState::DetachedAwaitingResponse) => { - imported.states.remove(&id); - Ok(None) - } - Some(ImportedStreamState::DetachPending { .. }) | None => { - Err(format!("frame for unknown remote stream {id}")) - } - }; - drop(imported); - self.inner.imported_changed.notify_waiters(); - result - } - - async fn send_imported_item( - &self, - route: ImportedStreamRoute, - item: ImportedStreamItem, - ) -> Result<(), ImportedStreamItem> { - let permit = tokio::select! { - result = route.events.reserve() => result.ok(), - _ = self.inner.cancelled.cancelled() => None, - }; - if let Some(permit) = permit { - permit.send(ImportedStreamEvent::Item(item)); - Ok(()) - } else { - Err(item) - } - } - - async fn send_imported(&self, route: ImportedStreamRoute, event: ImportedStreamEvent) { - tokio::select! { - _ = route.events.send(event) => {} - _ = self.inner.cancelled.cancelled() => {} - } - } } #[cfg(test)] -mod tests { +mod bus_tests { use super::*; - use test_r::{test, timeout}; + use crate::durable_host::stream_transport::{ + LiveStreamEndpoint, LiveStreamPeer, input_stream_pair, + }; + use golem_schema::schema::schema_value::{ + ResultValuePayload, UnionValuePayload, VariantValuePayload, + }; + use test_r::test; + use tokio_util::sync::CancellationToken; fn stream_id(value: &ProtoSchemaValue) -> u64 { match value.value.as_ref() { @@ -1189,9 +1677,22 @@ mod tests { } } - fn stream_value() -> SchemaValue { - let (_source, stream) = relay_endpoint_pair(None); - SchemaValue::Stream(stream) + fn stream_source(capacity: usize) -> (LiveStreamPeer, SchemaValue) { + let cancellation = CancellationToken::new(); + let (peer, stream) = input_stream_pair(capacity, &cancellation).unwrap(); + (peer, SchemaValue::Stream(stream)) + } + + fn take_primary( + value: SchemaValue, + ) -> crate::durable_host::stream_bus::PrimaryLiveStreamSubscriber { + let SchemaValue::Stream(stream) = value else { + panic!("expected stream"); + }; + stream + .take_host_endpoint::() + .unwrap() + .activate() } fn count_streams(value: &SchemaValue) -> usize { @@ -1214,8 +1715,7 @@ mod tests { inner.as_deref().map(count_streams).unwrap_or_default() } SchemaValue::Result(value) => match value { - golem_schema::schema::schema_value::ResultValuePayload::Ok { value } - | golem_schema::schema::schema_value::ResultValuePayload::Err { value } => { + ResultValuePayload::Ok { value } | ResultValuePayload::Err { value } => { value.as_deref().map(count_streams).unwrap_or_default() } }, @@ -1225,62 +1725,64 @@ mod tests { } #[test] - async fn recursive_composites_preserve_live_streams() { - use golem_schema::schema::schema_value::{ - ResultValuePayload, UnionValuePayload, VariantValuePayload, + async fn recursive_composites_preserve_independent_streams() { + let mut sources = Vec::new(); + let mut next_stream = || { + let (source, stream) = stream_source(4); + sources.push(source); + stream }; - let value = SchemaValue::Record { fields: vec![ SchemaValue::Variant(VariantValuePayload { case: 1, - payload: Some(Box::new(stream_value())), + payload: Some(Box::new(next_stream())), }), SchemaValue::Tuple { - elements: vec![stream_value()], + elements: vec![next_stream()], }, SchemaValue::List { - elements: vec![stream_value()], + elements: vec![next_stream()], }, SchemaValue::FixedList { - elements: vec![stream_value()], + elements: vec![next_stream()], }, SchemaValue::Map { - entries: vec![(stream_value(), stream_value())], + entries: vec![(next_stream(), next_stream())], }, SchemaValue::Option { - inner: Some(Box::new(stream_value())), + inner: Some(Box::new(next_stream())), }, SchemaValue::Result(ResultValuePayload::Ok { - value: Some(Box::new(stream_value())), + value: Some(Box::new(next_stream())), }), SchemaValue::Result(ResultValuePayload::Err { - value: Some(Box::new(stream_value())), + value: Some(Box::new(next_stream())), }), SchemaValue::Union(UnionValuePayload { tag: "stream".to_string(), - body: Box::new(stream_value()), + body: Box::new(next_stream()), }), ], }; let (sender_frames, _sender_frame_rx) = mpsc::channel(32); - let sender = LiveValueSession::new(1, sender_frames); + let sender = LiveValueSession::new_client(sender_frames); let encoded = sender.encode(&value).unwrap(); let (receiver_frames, _receiver_frame_rx) = mpsc::channel(32); - let receiver = LiveValueSession::new(2, receiver_frames); + let receiver = LiveValueSession::new_server(receiver_frames); let decoded = receiver.decode(encoded).await.unwrap(); assert_eq!(count_streams(&decoded), 10); + assert_eq!(sources.len(), 10); sender.cancel(); receiver.cancel(); } #[test] - async fn stream_ids_are_affine_and_validated_per_session() { + async fn stream_ids_are_affine_checked_and_session_local() { let (frames, _frame_rx) = mpsc::channel(8); - let receiver = LiveValueSession::new(1, frames); - + let receiver = LiveValueSession::new_client(frames); assert_eq!( receiver.decode(stream_reference(0)).await.unwrap_err(), "invalid remote stream id 0" @@ -1298,10 +1800,13 @@ mod tests { "duplicate remote stream id 2" ); - let (_source, stream) = relay_endpoint_pair(None); + let (_source, stream) = stream_source(4); + let SchemaValue::Stream(stream) = stream else { + unreachable!() + }; let alias = stream.clone(); let (frames, _frame_rx) = mpsc::channel(8); - let sender = LiveValueSession::new(1, frames); + let sender = LiveValueSession::new_client(frames); sender.encode(&SchemaValue::Stream(stream)).unwrap(); assert_eq!( sender.encode(&SchemaValue::Stream(alias)).unwrap_err(), @@ -1312,1377 +1817,788 @@ mod tests { } #[test] - fn local_stream_id_exhaustion_must_not_reuse_an_active_id() { - let (frames, _frame_rx) = mpsc::channel(8); - let session = LiveValueSession::new(1, frames); - - let first_id = stream_id(&session.encode(&stream_value()).unwrap()); - session - .inner - .next_stream_id - .store(u64::MAX, Ordering::Release); - let last_id = stream_id(&session.encode(&stream_value()).unwrap()); - let error = session.encode(&stream_value()).unwrap_err(); - - session.cancel(); - assert_ne!(first_id, last_id); - assert_eq!(error, "live stream ID space is exhausted"); - } - - #[test] - async fn failed_recursive_encode_releases_streams_registered_before_the_error() { - let (_source, stream) = relay_endpoint_pair(None); + async fn recursive_registration_failures_roll_back_streams() { + let (_source, stream) = stream_source(4); + let SchemaValue::Stream(stream) = stream else { + unreachable!() + }; let alias = stream.clone(); let (frames, _frame_rx) = mpsc::channel(8); - let session = LiveValueSession::new(1, frames); - - let result = session.encode(&SchemaValue::Tuple { - elements: vec![SchemaValue::Stream(stream), SchemaValue::Stream(alias)], - }); - - assert!(result.is_err(), "aliasing a stream must be rejected"); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("a failed encode must not leave an exported stream active"); - } + let sender = LiveValueSession::new_client(frames); + assert!( + sender + .encode(&SchemaValue::Tuple { + elements: vec![SchemaValue::Stream(stream), SchemaValue::Stream(alias)], + }) + .is_err() + ); + sender.wait_idle().await; - #[test] - async fn failed_recursive_decode_releases_streams_registered_before_the_error() { let (frames, mut frame_rx) = mpsc::channel(8); - let session = LiveValueSession::new(1, frames); - let value = ProtoSchemaValue { - value: Some(proto_schema_value::Value::TupleValue(TupleValue { - elements: vec![stream_reference(2), stream_reference(2)], - })), - }; - - let error = session.decode(value).await.unwrap_err(); - + let receiver = LiveValueSession::new_client(frames); + let error = receiver + .decode(ProtoSchemaValue { + value: Some(proto_schema_value::Value::TupleValue(TupleValue { + elements: vec![stream_reference(2), stream_reference(2)], + })), + }) + .await + .unwrap_err(); assert_eq!(error, "duplicate remote stream id 2"); + let cancel = frame_rx.recv().await.unwrap().request; assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: 2 - })) + cancel, + Some(invocation_request::Request::StreamCancel(StreamCancel { + stream_id: 2, + role, + .. + })) if role == StreamCancelRole::OutputConsumer as i32 )); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("a failed decode must not leave an imported stream active"); + receiver.wait_idle().await; } #[test] - async fn equal_stream_ids_in_different_sessions_do_not_alias() { - let (first_frames, mut first_frame_rx) = mpsc::channel(8); - let first = LiveValueSession::new(1, first_frames); - let (second_frames, mut second_frame_rx) = mpsc::channel(8); - let second = LiveValueSession::new(1, second_frames); - let SchemaValue::Stream(first_stream) = first.decode(stream_reference(2)).await.unwrap() - else { - panic!("expected first stream"); - }; - let SchemaValue::Stream(second_stream) = second.decode(stream_reference(2)).await.unwrap() - else { - panic!("expected second stream"); - }; - let mut first_reader = first_stream.take_host_endpoint::().unwrap(); - let mut second_reader = second_stream.take_host_endpoint::().unwrap(); - let first_next = tokio::spawn(async move { first_reader.next().await }); - let second_next = tokio::spawn(async move { second_reader.next().await }); - assert!(matches!( - first_frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); - assert!(matches!( - second_frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); + async fn rejected_start_rolls_back_streams_without_pre_accept_events() { + let (frames, mut frame_rx) = mpsc::channel(8); + let receiver = LiveValueSession::new_server(frames); - first - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(SchemaValue::String("first".to_string()).try_into().unwrap()), - })) - .await - .unwrap(); - second - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some( - SchemaValue::String("second".to_string()) - .try_into() - .unwrap(), - ), - })) + let error = receiver + .decode_start(ProtoSchemaValue { + value: Some(proto_schema_value::Value::TupleValue(TupleValue { + elements: vec![stream_reference(1), stream_reference(1)], + })), + }) .await - .unwrap(); + .unwrap_err(); - assert_eq!( - first_next.await.unwrap().unwrap(), - Some(SchemaValue::String("first".to_string())) - ); - assert_eq!( - second_next.await.unwrap().unwrap(), - Some(SchemaValue::String("second".to_string())) + assert_eq!(error, "duplicate remote stream id 1"); + assert!(frame_rx.try_recv().is_err()); + assert!( + receiver + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .states + .is_empty() ); + receiver.cancel(); } #[test] - async fn frames_for_unknown_remote_streams_are_rejected() { - let (frames, _frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - - let error = session - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(SchemaValue::Bool(true).try_into().unwrap()), - })) - .await - .unwrap_err(); - - assert_eq!(error, "frame for unknown remote stream 2"); + fn local_stream_ids_are_not_reused_at_exhaustion() { + let (frames, _frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new_client(frames); + let first_id = stream_id(&session.encode(&stream_source(1).1).unwrap()); + session + .inner + .next_stream_id + .store(u64::MAX, Ordering::Release); + let last_id = stream_id(&session.encode(&stream_source(1).1).unwrap()); - for frame in [ - live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: 2 }), - live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: 2, - details: "unknown".to_string(), - }), - ] { - assert_eq!( - session.route_stream_frame(frame).await.unwrap_err(), - "frame for unknown remote stream 2" - ); - } + assert_ne!(first_id, last_id); + assert_eq!( + session.encode(&stream_source(1).1).unwrap_err(), + "live stream ID space is exhausted" + ); + session.cancel(); } #[test] - async fn exported_streams_do_not_read_before_demand() { - let (mut source, stream) = relay_endpoint_pair(None); + async fn first_output_can_arrive_before_the_session_registers_its_reader() { + let (source, stream) = stream_source(1); + assert_eq!( + source.publisher.publish_item(SchemaValue::U32(7)).await, + Ok(0) + ); let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let encoded = session.encode(&SchemaValue::Stream(stream)).unwrap(); - let id = stream_id(&encoded); + let session = LiveValueSession::new_server_with_capacity(frames, 1); + let id = stream_id(&session.encode(&stream).unwrap()); - tokio::task::yield_now().await; - assert!(source.demand_rx.try_recv().is_err()); - assert!(frame_rx.try_recv().is_err()); + let Some(invocation_response::Response::OutputItem(item)) = + frame_rx.recv().await.unwrap().response + else { + panic!("expected output item"); + }; + assert_eq!(item.stream_id, id); + assert_eq!(item.offset, 0); + assert_eq!( + SchemaValue::try_from(item.value.unwrap()).unwrap(), + SchemaValue::U32(7) + ); + session.cancel(); + } - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: id, - })) + #[test] + async fn exported_stream_applies_bus_backpressure_and_preserves_order() { + let (source, stream) = stream_source(1); + let (frames, mut frame_rx) = mpsc::channel(1); + let session = LiveValueSession::new_server_with_capacity(frames, 1); + let id = stream_id(&session.encode(&stream).unwrap()); + source + .publisher + .publish_item(SchemaValue::String("first".to_string())) + .await + .unwrap(); + source + .publisher + .publish_item(SchemaValue::String("second".to_string())) .await .unwrap(); - assert_eq!(source.demand_rx.recv().await, Some(())); source - .item_tx - .send(Ok(SchemaValue::Bool(true))) + .publisher + .publish_item(SchemaValue::String("third".to_string())) .await .unwrap(); + let fourth = tokio::spawn({ + let publisher = source.publisher.clone(); + async move { + publisher + .publish_item(SchemaValue::String("fourth".to_string())) + .await + } + }); + tokio::task::yield_now().await; + assert!(!fourth.is_finished()); - let frame = frame_rx.recv().await.unwrap().frame.unwrap(); - let live_invocation_frame::Frame::Item(item) = frame else { - panic!("expected item frame"); - }; - assert_eq!(item.stream_id, id); - assert_eq!( - session.decode(item.value.unwrap()).await.unwrap(), - SchemaValue::Bool(true) - ); + for (offset, expected) in ["first", "second", "third", "fourth"] + .into_iter() + .enumerate() + { + let Some(invocation_response::Response::OutputItem(item)) = + frame_rx.recv().await.unwrap().response + else { + panic!("expected output item"); + }; + assert_eq!(item.stream_id, id); + assert_eq!(item.offset, offset as u64); + assert_eq!( + SchemaValue::try_from(item.value.unwrap()).unwrap(), + SchemaValue::String(expected.to_string()) + ); + } + assert_eq!(fourth.await.unwrap(), Ok(3)); + session.cancel(); } #[test] - async fn sibling_stream_demands_are_isolated() { - let (mut first, first_stream) = relay_endpoint_pair(None); - let (mut second, second_stream) = relay_endpoint_pair(None); - let (frames, _frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); + async fn output_consumer_cancellation_confirms_all_open_output_terminals() { + let (first_source, first_stream) = stream_source(4); + let (second_source, second_stream) = stream_source(4); + let (frames, mut frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new_server(frames); let encoded = session .encode(&SchemaValue::Tuple { - elements: vec![ - SchemaValue::Stream(first_stream), - SchemaValue::Stream(second_stream), - ], + elements: vec![first_stream, second_stream], }) .unwrap(); let proto_schema_value::Value::TupleValue(tuple) = encoded.value.unwrap() else { - panic!("expected tuple"); + panic!("expected output stream tuple"); }; let first_id = stream_id(&tuple.elements[0]); let second_id = stream_id(&tuple.elements[1]); - assert_ne!(first_id, second_id); - - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: second_id, - })) - .await - .unwrap(); - assert_eq!(second.demand_rx.recv().await, Some(())); - assert!(first.demand_rx.try_recv().is_err()); - - session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: first_id, - })) - .await - .unwrap(); - session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: second_id, - })) + first_source + .publisher + .publish_item(SchemaValue::U32(1)) .await .unwrap(); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + second_source + .publisher + .publish_item(SchemaValue::U32(2)) .await .unwrap(); - } - - #[test] - async fn imported_stream_preserves_demand_and_items() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let value = session.decode(stream_reference(2)).await.unwrap(); - let SchemaValue::Stream(stream) = value else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - let next = tokio::spawn(async move { receiver.next().await }); + let mut item_streams = HashSet::new(); + while item_streams.len() < 2 { + let frame = frame_rx.recv().await.unwrap(); + if let Some(invocation_response::Response::OutputItem(item)) = frame.response { + item_streams.insert(item.stream_id); + } + } - let frame = frame_rx.recv().await.unwrap().frame.unwrap(); - assert!(matches!( - frame, - live_invocation_frame::Frame::Demand(LiveStreamDemand { stream_id: 2 }) - )); session - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(SchemaValue::U32(42).try_into().unwrap()), + .route_request(invocation_request::Request::StreamCancel(StreamCancel { + stream_id: first_id, + offset: 0, + role: StreamCancelRole::OutputConsumer as i32, + reason: StreamCancelReason::Cancelled as i32, + details: Some("consumer stopped".to_string()), })) .await .unwrap(); - assert_eq!(next.await.unwrap().unwrap(), Some(SchemaValue::U32(42))); + let mut terminals = HashMap::new(); + while terminals.len() < 2 { + let frame = frame_rx.recv().await.unwrap(); + if let Some(invocation_response::Response::StreamCancel(cancel)) = frame.response { + assert_eq!(cancel.role(), StreamCancelRole::OutputProducer); + terminals.insert(cancel.stream_id, cancel.offset); + } + } + assert_eq!(terminals.get(&first_id), Some(&0)); + assert_eq!(terminals.get(&second_id), Some(&1)); + session.wait_idle().await; } #[test] - async fn imported_stream_rejects_item_before_demand() { + async fn auxiliary_output_subscription_starts_at_the_current_tail() { + let (source, stream) = stream_source(4); let (frames, _frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(_stream) = session.decode(stream_reference(2)).await.unwrap() - else { - panic!("expected stream"); - }; - - let result = session - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(SchemaValue::U32(42).try_into().unwrap()), - })) - .await; - - assert!( - result.is_err(), - "an item without outstanding demand must be rejected" - ); - } - - #[test] - async fn producer_errors_are_terminal_and_scoped_to_the_stream() { - let (mut source, stream) = relay_endpoint_pair(None); - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let encoded = session.encode(&SchemaValue::Stream(stream)).unwrap(); - let id = stream_id(&encoded); - - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: id, - })) + let session = LiveValueSession::new_server_with_capacity(frames, 4); + let id = stream_id(&session.encode(&stream).unwrap()); + source + .publisher + .publish_item(SchemaValue::String("before".to_string())) .await .unwrap(); - assert_eq!(source.demand_rx.recv().await, Some(())); + let mut auxiliary = session.subscribe_output_tail(id).unwrap(); source - .item_tx - .send(Err("producer failed".to_string())) + .publisher + .publish_item(SchemaValue::String("after".to_string())) .await .unwrap(); - let frame = frame_rx.recv().await.unwrap().frame.unwrap(); - assert!(matches!( - frame, - live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id, - details, - }) if stream_id == id && details == "producer failed" - )); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .unwrap(); + let event = auxiliary.recv().await.unwrap(); + + assert_eq!(event.offset, 1); + assert_eq!( + event.payload, + LiveStreamEventPayload::Item(SchemaValue::String("after".to_string())) + ); + session.cancel(); } #[test] - async fn overlapping_exported_demand_is_terminal_for_that_stream() { - let (mut source, stream) = relay_endpoint_pair(None); - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); + async fn imported_stream_prefetches_into_the_bus_and_terminates_once() { + let (frames, _frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new_client_with_capacity(frames, 2); + let value = session.decode(stream_reference(2)).await.unwrap(); + let mut primary = take_primary(value); session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: id, - })) + .route_response(invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: 2, + offset: 0, + value: Some(SchemaValue::U32(42).try_into().unwrap()), + }, + )) .await .unwrap(); - assert_eq!(source.demand_rx.recv().await, Some(())); + let item = primary.recv().await.unwrap(); + assert_eq!(item.offset, 0); + assert_eq!( + item.payload, + LiveStreamEventPayload::Item(SchemaValue::U32(42)) + ); + session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: id, + .route_response(invocation_response::Response::OutputEnd(OutputStreamEnd { + stream_id: 2, + offset: 1, })) .await .unwrap(); - - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id, - details, - })) if stream_id == id && details == "stream received overlapping demand" - )); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("overlapping demand must terminate the exported relay"); + let end = primary.recv().await.unwrap(); + assert_eq!(end.offset, 1); + assert_eq!(end.payload, LiveStreamEventPayload::End); + assert_eq!( + session + .route_response(invocation_response::Response::OutputEnd(OutputStreamEnd { + stream_id: 2, + offset: 1, + })) + .await + .unwrap_err(), + "item for unknown remote stream 2" + ); } #[test] - async fn overlapping_imported_demand_fails_the_session() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - - receiver.demand_tx.send(()).await.unwrap(); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); - receiver.demand_tx.send(()).await.unwrap(); + async fn packed_u8_admission_expands_offsets_and_acks_after_bus_acceptance() { + let (frames, _frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new_server_with_capacity(frames, 1); + let value = session.decode(stream_reference(1)).await.unwrap(); + let mut primary = take_primary(value); + + let admission = tokio::spawn({ + let session = session.clone(); + async move { + session + .admit_input_item(InputStreamItem { + stream_id: 1, + sequence: 0, + payload: Some(input_stream_item::Payload::PackedU8(vec![7, 8, 9])), + }) + .await + } + }); + tokio::task::yield_now().await; + assert!(!admission.is_finished()); + for (offset, value) in [(0, 7), (1, 8), (2, 9)] { + let event = primary.recv().await.unwrap(); + assert_eq!(event.offset, offset); + assert_eq!( + event.payload, + LiveStreamEventPayload::Item(SchemaValue::U8(value)) + ); + } assert_eq!( - receiver.item_rx.recv().await.unwrap().unwrap_err(), - "remote stream 2 received overlapping local demand" + admission.await.unwrap().unwrap(), + InputItemAdmission::Acknowledged(InputStreamAck { + stream_id: 1, + sequence: 0, + logical_item_count: 3, + }) ); - assert!(session.is_cancelled()); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("overlapping imported demand must terminate the session relay"); - } - - #[test] - async fn invocation_terminal_requires_all_imported_streams_to_finish() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - let next = tokio::spawn(async move { receiver.next().await }); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); - - let error = session.finish_invocation().await.unwrap_err(); - - assert!(error.contains("open imported streams [2]")); - assert_eq!(next.await.unwrap().unwrap_err(), error); - } - - #[test] - async fn premature_invocation_terminal_reaches_reader_before_first_demand() { - let (frames, _frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - - let error = session.finish_invocation().await.unwrap_err(); - session.wait_idle().await; - receiver.demand_tx.closed().await; - - assert_eq!(receiver.next().await.unwrap_err(), error); - } - - #[test] - async fn imported_stream_reports_session_cancellation_instead_of_eof() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - let next = tokio::spawn(async move { receiver.next().await }); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); - - session.cancel(); - - let result = next.await.unwrap(); - assert!( - result.is_err(), - "semantic invocation cancellation must not be reported as clean EOF" + assert_eq!( + session + .admit_input_item(InputStreamItem { + stream_id: 1, + sequence: 2, + payload: Some(input_stream_item::Payload::Value( + SchemaValue::U8(10).try_into().unwrap(), + )), + }) + .await + .unwrap_err(), + "input stream 1 expected sequence 3, got 2" ); + session.cancel(); } #[test] - async fn imported_stream_terminal_is_monotonic() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - let next = tokio::spawn(async move { receiver.next().await }); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); + async fn input_sequence_overflow_is_rejected_before_recursive_registration() { + let (frames, _frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new_server_with_capacity(frames, 1); + let value = session.decode(stream_reference(1)).await.unwrap(); + let _primary = take_primary(value); + let route = session.imported_route(1).unwrap(); + *route.next_sequence.lock().await = u64::MAX; - session - .route_stream_frame(live_invocation_frame::Frame::End(LiveStreamEnd { - stream_id: 2, - })) - .await - .unwrap(); assert_eq!( session - .route_stream_frame(live_invocation_frame::Frame::End(LiveStreamEnd { - stream_id: 2, - })) + .admit_input_item(InputStreamItem { + stream_id: 1, + sequence: u64::MAX, + payload: Some(input_stream_item::Payload::Value(stream_reference(3))), + }) .await .unwrap_err(), - "frame for unknown remote stream 2" + "input stream 1 sequence overflow" ); - session.finish_invocation().await.unwrap(); - assert_eq!(next.await.unwrap().unwrap(), None); - assert_eq!( - session.decode(stream_reference(2)).await.unwrap_err(), - "duplicate remote stream id 2" + assert!( + !session + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .states + .contains_key(&3) ); + assert!( + !session + .inner + .seen_remote_stream_ids + .lock() + .expect("live stream ID set mutex poisoned") + .contains(&3) + ); + session.cancel(); } #[test] - async fn imported_error_terminal_cannot_be_repeated_or_replaced() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - let next = tokio::spawn(async move { receiver.next().await }); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); + async fn imported_stream_error_is_scoped_and_terminal() { + let (frames, _frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new_client(frames); + let value = session.decode(stream_reference(2)).await.unwrap(); + let mut primary = take_primary(value); session - .route_stream_frame(live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: 2, - details: "failed".to_string(), - })) + .route_response(invocation_response::Response::OutputError( + OutputStreamError { + stream_id: 2, + offset: 0, + details: "failed".to_string(), + }, + )) .await .unwrap(); - assert_eq!(next.await.unwrap().unwrap_err(), "failed"); - for frame in [ - live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: 2, - details: "duplicate".to_string(), - }), - live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: 2 }), - ] { - assert_eq!( - session.route_stream_frame(frame).await.unwrap_err(), - "frame for unknown remote stream 2" - ); - } + assert_eq!( + primary.recv().await.unwrap().payload, + LiveStreamEventPayload::Error("failed".to_string()) + ); + assert!(!session.is_cancelled()); } +} - #[test] - async fn streams_discovered_in_items_get_independent_ids() { - let (mut outer_source, outer_stream) = relay_endpoint_pair(None); - let (mut nested_source, nested_stream) = relay_endpoint_pair(None); - let (frames, mut frame_rx) = mpsc::channel(8); - let session = LiveValueSession::new(1, frames); - let outer_id = stream_id(&session.encode(&SchemaValue::Stream(outer_stream)).unwrap()); - - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: outer_id, - })) - .await - .unwrap(); - assert_eq!(outer_source.demand_rx.recv().await, Some(())); - outer_source - .item_tx - .send(Ok(SchemaValue::Option { - inner: Some(Box::new(SchemaValue::Stream(nested_stream))), - })) - .await - .unwrap(); - - let live_invocation_frame::Frame::Item(item) = - frame_rx.recv().await.unwrap().frame.unwrap() - else { - panic!("expected item frame"); - }; - let proto_schema_value::Value::OptionValue(option) = item.value.unwrap().value.unwrap() - else { - panic!("expected option item"); - }; - let nested_id = stream_id(option.inner.as_deref().unwrap()); - assert_ne!(outer_id, nested_id); - - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: nested_id, - })) - .await - .unwrap(); - assert_eq!(nested_source.demand_rx.recv().await, Some(())); +#[cfg(test)] +mod bus_lifecycle_tests { + use super::*; + use crate::durable_host::stream_transport::{ + LiveStreamEndpoint, input_stream_pair, output_stream_pair, + }; + use std::time::Duration; + use test_r::{test, timeout}; + use tokio_util::sync::CancellationToken; - for id in [outer_id, nested_id] { - session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: id, - })) - .await - .unwrap(); + fn stream_id(value: &ProtoSchemaValue) -> u64 { + match value.value.as_ref() { + Some(proto_schema_value::Value::StreamReference(reference)) => reference.stream_id, + other => panic!("expected stream id, got {other:?}"), } - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .unwrap(); } - #[test] - async fn nested_stream_remains_live_after_its_outer_stream_ends() { - let (mut outer_source, outer_stream) = relay_endpoint_pair(None); - let (mut nested_source, nested_stream) = relay_endpoint_pair(None); - let (frames, mut frame_rx) = mpsc::channel(8); - let session = LiveValueSession::new(1, frames); - let outer_id = stream_id(&session.encode(&SchemaValue::Stream(outer_stream)).unwrap()); - - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: outer_id, - })) - .await - .unwrap(); - assert_eq!(outer_source.demand_rx.recv().await, Some(())); - outer_source - .item_tx - .send(Ok(SchemaValue::Stream(nested_stream))) - .await - .unwrap(); - let Some(live_invocation_frame::Frame::Item(item)) = frame_rx.recv().await.unwrap().frame - else { - panic!("expected outer item"); - }; - let nested_id = stream_id(item.value.as_ref().unwrap()); - - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: outer_id, - })) - .await - .unwrap(); - assert_eq!(outer_source.demand_rx.recv().await, Some(())); - drop(outer_source.item_tx); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::End(LiveStreamEnd { stream_id })) - if stream_id == outer_id - )); - - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: nested_id, - })) - .await - .unwrap(); - assert_eq!(nested_source.demand_rx.recv().await, Some(())); - session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: nested_id, - })) - .await - .unwrap(); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("the nested stream should be independent of its terminated outer stream"); + fn stream_reference(id: u64) -> ProtoSchemaValue { + ProtoSchemaValue { + value: Some(proto_schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: id }, + )), + } } - #[test] - async fn detaching_one_source_does_not_finish_its_sibling() { - let cancellation = tokio_util::sync::CancellationToken::new(); - let tracker = Arc::new(LiveStreamTracker::new(cancellation)); - let (_first_source, first_stream) = relay_endpoint_pair(Some(tracker.clone())); - let (_second_source, second_stream) = relay_endpoint_pair(Some(tracker.clone())); - let (frames, _frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let encoded = session - .encode(&SchemaValue::Tuple { - elements: vec![ - SchemaValue::Stream(first_stream), - SchemaValue::Stream(second_stream), - ], - }) - .unwrap(); - let proto_schema_value::Value::TupleValue(tuple) = encoded.value.unwrap() else { - panic!("expected tuple"); - }; - let first_id = stream_id(&tuple.elements[0]); - let second_id = stream_id(&tuple.elements[1]); - - session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: first_id, - })) - .await - .unwrap(); - tokio::time::timeout(std::time::Duration::from_secs(1), async { - while tracker.active.load(Ordering::Acquire) != 1 { - tokio::task::yield_now().await; - } - }) - .await - .unwrap(); - - session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: second_id, - })) - .await - .unwrap(); - tokio::time::timeout( - std::time::Duration::from_secs(1), - tracker.wait_for_sources(), - ) - .await - .unwrap(); + fn stream_source(capacity: usize) -> (LiveStreamPeer, SchemaValue) { + let cancellation = CancellationToken::new(); + let (peer, stream) = input_stream_pair(capacity, &cancellation).unwrap(); + (peer, SchemaValue::Stream(stream)) } - #[test] - async fn dropping_an_imported_handle_detaches_its_remote_stream() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { + fn take_primary( + value: SchemaValue, + ) -> crate::durable_host::stream_bus::PrimaryLiveStreamSubscriber { + let SchemaValue::Stream(stream) = value else { panic!("expected stream"); }; - - drop(stream); - - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: 2 - })) - )); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("dropping an imported handle must release its relay task"); - session.finish_invocation().await.unwrap(); - } - - #[test] - async fn detached_imported_stream_accepts_one_racing_response() { - for response in 0..3 { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() - else { - panic!("expected stream"); - }; - let receiver = stream.take_host_endpoint::().unwrap(); - receiver.demand_tx.send(()).await.unwrap(); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); - - drop(receiver); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: 2 - })) - )); - let idle_session = session.clone(); - let idle = tokio::spawn(async move { idle_session.wait_idle().await }); - tokio::task::yield_now().await; - assert!( - !idle.is_finished(), - "the detached imported relay must await its outstanding response" - ); - - let frame = match response { - 0 => live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(SchemaValue::U32(42).try_into().unwrap()), - }), - 1 => live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: 2 }), - _ => live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: 2, - details: "racing failure".to_string(), - }), - }; - session.route_stream_frame(frame.clone()).await.unwrap(); - idle.await.unwrap(); - assert_eq!( - session.route_stream_frame(frame).await.unwrap_err(), - "frame for unknown remote stream 2" - ); - assert_eq!( - session.decode(stream_reference(2)).await.unwrap_err(), - "duplicate remote stream id 2" - ); - session.finish_invocation().await.unwrap(); - } + stream + .take_host_endpoint::() + .unwrap() + .activate() } #[test] #[timeout("2s")] - async fn server_idle_must_wait_for_detached_response_with_nested_stream() { - let cancellation = tokio_util::sync::CancellationToken::new(); - let tracker = Arc::new(LiveStreamTracker::new(cancellation)); - let (mut outer_source, outer_stream) = relay_endpoint_pair(Some(tracker.clone())); - let (_nested_source, nested_stream) = relay_endpoint_pair(Some(tracker.clone())); - - let (client_frames, mut client_frame_rx) = mpsc::channel(8); - let client = LiveValueSession::new(1, client_frames); - let encoded_outer = client.encode(&SchemaValue::Stream(outer_stream)).unwrap(); - - let (server_frames, mut server_frame_rx) = mpsc::channel(8); - let server = LiveValueSession::new(2, server_frames); - let SchemaValue::Stream(imported_outer) = server.decode(encoded_outer).await.unwrap() - else { - panic!("expected imported outer stream"); - }; - let receiver = imported_outer - .take_host_endpoint::() - .unwrap(); - receiver.demand_tx.send(()).await.unwrap(); - let Some(live_invocation_frame::Frame::Demand(demand)) = - server_frame_rx.recv().await.unwrap().frame - else { - panic!("expected outer demand"); - }; - client - .route_stream_frame(live_invocation_frame::Frame::Demand(demand)) - .await - .unwrap(); - assert_eq!(outer_source.demand_rx.recv().await, Some(())); - - outer_source - .item_tx - .send(Ok(SchemaValue::Stream(nested_stream))) - .await - .unwrap(); - let racing_item = client_frame_rx.recv().await.unwrap(); - - drop(receiver); - let Some(live_invocation_frame::Frame::Detach(detach)) = - server_frame_rx.recv().await.unwrap().frame - else { - panic!("expected outer detach"); - }; - assert!( - tokio::time::timeout(std::time::Duration::from_millis(50), server.wait_idle()) - .await - .is_err(), - "server idle must wait for the response already outstanding when detach was sent" - ); - client - .route_stream_frame(live_invocation_frame::Frame::Detach(detach)) - .await - .unwrap(); - - server - .route_stream_frame(racing_item.frame.unwrap()) + async fn dropping_one_imported_input_reader_cancels_only_that_stream() { + let (frames, mut frame_rx) = mpsc::channel(16); + let session = LiveValueSession::new_server(frames); + let decoded = session + .decode(ProtoSchemaValue { + value: Some(proto_schema_value::Value::TupleValue(TupleValue { + elements: vec![stream_reference(1), stream_reference(3)], + })), + }) .await .unwrap(); - let Some(live_invocation_frame::Frame::Detach(nested_detach)) = - server_frame_rx.recv().await.unwrap().frame - else { - panic!("expected nested detach"); + let SchemaValue::Tuple { mut elements } = decoded else { + panic!("expected tuple"); }; - client - .route_stream_frame(live_invocation_frame::Frame::Detach(nested_detach)) - .await - .unwrap(); - server.wait_idle().await; - - let result = client.finish_invocation().await; - assert!( - result.is_ok(), - "the detached racing item must not leave its nested source attached: {result:?}" - ); - tracker.wait_for_sources().await; - } - - #[test] - #[timeout("2s")] - async fn detached_imported_item_must_rollback_undelivered_nested_streams() { - let (frames, mut frame_rx) = mpsc::channel(1); - let session = LiveValueSession::new(1, frames.clone()); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); + let second = elements.pop().unwrap(); + let first = elements.pop().unwrap(); + let first_endpoint = match first { + SchemaValue::Stream(stream) => { + stream.take_host_endpoint::().unwrap() + } + _ => unreachable!(), }; - let receiver = stream.take_host_endpoint::().unwrap(); - receiver.demand_tx.send(()).await.unwrap(); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); - - frames - .send(LiveInvocationFrame { frame: None }) - .await - .unwrap(); - drop(receiver); - tokio::task::yield_now().await; + let mut second_primary = take_primary(second); - let route_session = session.clone(); - let routing = tokio::spawn(async move { - route_session - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(stream_reference(4)), - })) - .await - }); - let finish_session = session.clone(); - let finishing = tokio::spawn(async move { finish_session.finish_invocation().await }); - tokio::task::yield_now().await; - assert!( - !finishing.is_finished(), - "invocation completion must wait for accepted detach frames" - ); + drop(first_endpoint); + let Some(invocation_response::Response::StreamCancel(cancel)) = + frame_rx.recv().await.unwrap().response + else { + panic!("expected first stream cancellation"); + }; + assert_eq!(cancel.stream_id, 1); + assert_eq!(cancel.offset, 0); + assert_eq!(cancel.role(), StreamCancelRole::InputConsumer); + assert!(!session.is_cancelled()); - frame_rx.recv().await.unwrap(); - let mut detached = HashSet::new(); - for _ in 0..2 { - let frame = frame_rx - .recv() + for sequence in 0..2 { + session + .route_request(invocation_request::Request::InputItem(InputStreamItem { + stream_id: 1, + sequence, + payload: Some(input_stream_item::Payload::Value( + SchemaValue::Bool(false).try_into().unwrap(), + )), + })) .await - .expect("both outer and nested detach frames must be sent") - .frame - .expect("detach frame must have a payload"); - let live_invocation_frame::Frame::Detach(detach) = frame else { - panic!("expected detach frame, got {frame:?}"); - }; - detached.insert(detach.stream_id); + .unwrap(); } - routing + session + .route_request(invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 1, + offset: 2, + })) .await - .unwrap() - .expect("one response racing a valid detach should be accepted"); - assert_eq!(detached, HashSet::from([2, 4])); - - let result = finishing.await.unwrap(); + .unwrap(); assert!( - result.is_ok(), - "a nested stream in an item that could not be delivered to the detached reader must be rolled back: {result:?}" + !session + .inner + .imported + .lock() + .expect("live stream map mutex poisoned") + .cancelled + .contains_key(&1) ); - } + assert!(frame_rx.try_recv().is_err()); - #[test] - #[timeout("2s")] - async fn failed_imported_item_delivery_rolls_back_nested_and_detaches_outer() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - receiver.demand_tx.send(()).await.unwrap(); + session + .route_request(invocation_request::Request::InputItem(InputStreamItem { + stream_id: 3, + sequence: 0, + payload: Some(input_stream_item::Payload::Value( + SchemaValue::Bool(true).try_into().unwrap(), + )), + })) + .await + .unwrap(); + assert_eq!( + second_primary.recv().await.unwrap().payload, + LiveStreamEventPayload::Item(SchemaValue::Bool(true)) + ); assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 + frame_rx.recv().await.unwrap().response, + Some(invocation_response::Response::InputAck(InputStreamAck { + stream_id: 3, + sequence: 0, + logical_item_count: 1, })) )); - receiver.item_rx.close(); - session - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(stream_reference(4)), + .route_request(invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 3, + offset: 1, })) .await .unwrap(); - - let mut detached = HashSet::new(); - for _ in 0..2 { - let frame = frame_rx.recv().await.unwrap().frame.unwrap(); - let live_invocation_frame::Frame::Detach(detach) = frame else { - panic!("expected detach frame, got {frame:?}"); - }; - detached.insert(detach.stream_id); - } - assert_eq!(detached, HashSet::from([2, 4])); + assert_eq!( + second_primary.recv().await.unwrap().payload, + LiveStreamEventPayload::End + ); session.wait_idle().await; - session.finish_invocation().await.unwrap(); } #[test] - #[timeout("2s")] - async fn cancellation_discharges_a_blocked_nested_rollback() { - let (frames, mut frame_rx) = mpsc::channel(1); - let session = LiveValueSession::new(1, frames.clone()); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let receiver = stream.take_host_endpoint::().unwrap(); - receiver.demand_tx.send(()).await.unwrap(); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); - frames - .send(LiveInvocationFrame { frame: None }) + async fn equal_remote_ids_in_independent_sessions_do_not_alias() { + let (first_frames, _first_frame_rx) = mpsc::channel(8); + let first = LiveValueSession::new_client(first_frames); + let (second_frames, _second_frame_rx) = mpsc::channel(8); + let second = LiveValueSession::new_client(second_frames); + let mut first_primary = take_primary(first.decode(stream_reference(2)).await.unwrap()); + let mut second_primary = take_primary(second.decode(stream_reference(2)).await.unwrap()); + + first + .route_response(invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: 2, + offset: 0, + value: Some(SchemaValue::String("first".to_string()).try_into().unwrap()), + }, + )) .await .unwrap(); - drop(receiver); - tokio::task::yield_now().await; - - let route_session = session.clone(); - let routing = tokio::spawn(async move { - route_session - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { + second + .route_response(invocation_response::Response::OutputItem( + OutputStreamItem { stream_id: 2, - value: Some(stream_reference(4)), - })) - .await - }); - tokio::time::timeout(std::time::Duration::from_secs(1), async { - loop { - if session - .inner - .seen_remote_stream_ids - .lock() - .expect("live stream ID set mutex poisoned") - .contains(&4) - { - break; - } - tokio::task::yield_now().await; - } - }) - .await - .expect("the nested rollback should block on its detach frame"); - session.cancel(); + offset: 0, + value: Some( + SchemaValue::String("second".to_string()) + .try_into() + .unwrap(), + ), + }, + )) + .await + .unwrap(); - routing.await.unwrap().unwrap(); - session.wait_idle().await; + assert_eq!( + first_primary.recv().await.unwrap().payload, + LiveStreamEventPayload::Item(SchemaValue::String("first".to_string())) + ); + assert_eq!( + second_primary.recv().await.unwrap().payload, + LiveStreamEventPayload::Item(SchemaValue::String("second".to_string())) + ); + first.cancel(); + second.cancel(); } #[test] - async fn detached_imported_item_still_validates_nested_stream_ids() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let receiver = stream.take_host_endpoint::().unwrap(); - receiver.demand_tx.send(()).await.unwrap(); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: 2 - })) - )); - - drop(receiver); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: 2 - })) - )); + async fn invocation_finish_rejects_open_streams_and_releases_readers() { + let (frames, _frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new_client(frames); + let mut primary = take_primary(session.decode(stream_reference(2)).await.unwrap()); - let result = session - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(stream_reference(3)), - })) - .await; + let error = session.finish_invocation().await.unwrap_err(); - assert!( - result.is_err(), - "wrong-parity nested stream IDs must remain invalid when an item races detach" + assert!(error.contains("open imported streams [2]")); + assert_eq!( + primary.recv().await.unwrap_err(), + crate::durable_host::stream_bus::LiveStreamReceiveError::Closed ); session.wait_idle().await; } #[test] - async fn dropping_an_untransferred_stream_releases_its_tracker() { - let cancellation = tokio_util::sync::CancellationToken::new(); - let tracker = Arc::new(LiveStreamTracker::new(cancellation)); - let (_source, stream) = relay_endpoint_pair(Some(tracker.clone())); - assert_eq!(tracker.active.load(Ordering::Acquire), 1); - - drop(stream); - - tokio::time::timeout( - std::time::Duration::from_secs(1), - tracker.wait_for_sources(), - ) - .await - .expect("dropping an untransferred stream must release its source tracker"); - } - - #[test] - async fn dropping_a_store_resource_table_releases_its_stream_handle() { - let cancellation = tokio_util::sync::CancellationToken::new(); - let tracker = Arc::new(LiveStreamTracker::new(cancellation)); - let (_source, stream) = relay_endpoint_pair(Some(tracker.clone())); - let mut table = wasmtime::component::ResourceTable::new(); - table - .push(SchemaValueStreamHandleRep::new(stream)) - .expect("the stream handle should fit in a new resource table"); - assert_eq!(tracker.active.load(Ordering::Acquire), 1); - - drop(table); + async fn streams_discovered_in_items_get_independent_buses() { + let (outer_source, outer_stream) = stream_source(4); + let (nested_source, nested_stream) = stream_source(4); + let (frames, mut frame_rx) = mpsc::channel(8); + let session = LiveValueSession::new_server(frames); + let outer_id = stream_id(&session.encode(&outer_stream).unwrap()); + outer_source + .publisher + .publish_item(SchemaValue::Option { + inner: Some(Box::new(nested_stream)), + }) + .await + .unwrap(); + let Some(invocation_response::Response::OutputItem(item)) = + frame_rx.recv().await.unwrap().response + else { + panic!("expected outer item"); + }; + let proto_schema_value::Value::OptionValue(option) = item.value.unwrap().value.unwrap() + else { + panic!("expected nested option"); + }; + let nested_id = stream_id(option.inner.as_deref().unwrap()); + assert_ne!(outer_id, nested_id); - tokio::time::timeout( - std::time::Duration::from_secs(1), - tracker.wait_for_sources(), - ) - .await - .expect("discarding a Store must release stream handles still in its resource table"); + nested_source + .publisher + .publish_item(SchemaValue::String("nested".to_string())) + .await + .unwrap(); + let Some(invocation_response::Response::OutputItem(item)) = + frame_rx.recv().await.unwrap().response + else { + panic!("expected nested item"); + }; + assert_eq!(item.stream_id, nested_id); + assert_eq!( + SchemaValue::try_from(item.value.unwrap()).unwrap(), + SchemaValue::String("nested".to_string()) + ); + session.cancel(); } #[test] - async fn dropping_an_exported_source_after_demand_sends_end() { - let (mut source, stream) = relay_endpoint_pair(None); + async fn output_bus_error_becomes_one_stream_error_frame() { + let (source, stream) = stream_source(4); let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: id, - })) + let session = LiveValueSession::new_server(frames); + let id = stream_id(&session.encode(&stream).unwrap()); + source + .publisher + .publish_error("failed".to_string()) .await .unwrap(); - assert_eq!(source.demand_rx.recv().await, Some(())); - - drop(source.item_tx); assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::End(LiveStreamEnd { stream_id })) - if stream_id == id + frame_rx.recv().await.unwrap().response, + Some(invocation_response::Response::OutputError(OutputStreamError { + stream_id, + offset: 0, + details, + })) if stream_id == id && details == "failed" )); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("dropping an exported source must terminate its relay"); + session.wait_idle().await; } #[test] - async fn invocation_cancellation_releases_all_attached_sources() { - let cancellation = tokio_util::sync::CancellationToken::new(); - let tracker = Arc::new(LiveStreamTracker::new(cancellation.clone())); - let (_source, stream) = relay_endpoint_pair(Some(tracker.clone())); + async fn output_primary_loss_cancels_the_invocation_tracker() { + let cancellation = CancellationToken::new(); + let tracker = Arc::new(LiveStreamTracker::new(cancellation.clone(), 4)); + let (consumer, stream) = output_stream_pair(Some(tracker.clone()), 4).unwrap(); assert_eq!(tracker.active.load(Ordering::Acquire), 1); - cancellation.cancel(); - tokio::time::timeout( - std::time::Duration::from_secs(1), - tracker.wait_for_sources(), - ) - .await - .unwrap(); - assert_eq!(tracker.active.load(Ordering::Acquire), 0); - drop(stream); - assert_eq!(tracker.active.load(Ordering::Acquire), 0); - } - #[test] - async fn cancellation_releases_exported_stream_blocked_on_an_item() { - let (mut source, stream) = relay_endpoint_pair(None); - let (frames, _frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let stream_id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id, - })) + assert!(cancellation.is_cancelled()); + tokio::time::timeout(Duration::from_secs(1), tracker.wait_for_sources()) .await .unwrap(); - assert_eq!(source.demand_rx.recv().await, Some(())); - - session.cancel(); - - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("cancellation must release a producer blocked waiting for its next item"); + drop(consumer); } #[test] - async fn cancellation_releases_exported_stream_blocked_sending_an_item() { - let (mut source, stream) = relay_endpoint_pair(None); - let (frames, _frame_rx) = mpsc::channel(1); - frames - .send(LiveInvocationFrame { frame: None }) - .await - .unwrap(); - let session = LiveValueSession::new(1, frames); + async fn normal_output_drop_finishes_after_sending_stream_end() { + let tracker = Arc::new(LiveStreamTracker::new(CancellationToken::new(), 4)); + let (consumer, stream) = output_stream_pair(Some(tracker.clone()), 4).unwrap(); + let (frames, mut frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new_server(frames); let stream_id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id, - })) - .await - .unwrap(); - assert_eq!(source.demand_rx.recv().await, Some(())); - source.item_tx.send(Ok(SchemaValue::U32(42))).await.unwrap(); - tokio::time::timeout(std::time::Duration::from_secs(1), async { - while source.item_tx.capacity() == 0 { - tokio::task::yield_now().await; - } - }) - .await - .expect("the exported relay should consume the item before blocking on the frame channel"); - session.cancel(); - - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("cancellation must release an exported stream blocked sending an item"); - } - - #[test] - async fn detach_discards_nested_streams_from_an_undelivered_item() { - let (mut outer_source, outer_stream) = relay_endpoint_pair(None); - let (mut nested_source, nested_stream) = relay_endpoint_pair(None); - let (frames, mut frame_rx) = mpsc::channel(1); - frames - .send(LiveInvocationFrame { frame: None }) - .await - .unwrap(); - let session = LiveValueSession::new(1, frames); - let outer_id = stream_id(&session.encode(&SchemaValue::Stream(outer_stream)).unwrap()); - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id: outer_id, - })) - .await - .unwrap(); - assert_eq!(outer_source.demand_rx.recv().await, Some(())); - outer_source - .item_tx - .send(Ok(SchemaValue::Stream(nested_stream))) - .await - .unwrap(); - tokio::time::timeout(std::time::Duration::from_secs(1), async { - while outer_source.item_tx.capacity() == 0 { - tokio::task::yield_now().await; - } - }) - .await - .expect("the outer relay should consume the nested item before blocking"); + drop(consumer); + tracker.wait_for_sources().await; session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id: outer_id, - })) + .finish_invocation() .await - .unwrap(); - - frame_rx.recv().await.unwrap(); + .expect("a normal guest stream drop must wait for its end event"); assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::End(LiveStreamEnd { - stream_id - })) if stream_id == outer_id + frame_rx.recv().await.unwrap().response, + Some(invocation_response::Response::OutputEnd(OutputStreamEnd { + stream_id: actual_stream_id, + offset: 0, + })) if actual_stream_id == stream_id )); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("detach must release the blocked outer and undisclosed nested relays"); - assert_eq!(nested_source.demand_rx.recv().await, None); } #[test] - async fn detach_racing_a_blocked_terminal_frame_is_accepted() { - let (mut source, stream) = relay_endpoint_pair(None); - let (frames, mut frame_rx) = mpsc::channel(1); - frames - .send(LiveInvocationFrame { frame: None }) - .await - .unwrap(); - let session = LiveValueSession::new(1, frames); - let stream_id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id, - })) - .await - .unwrap(); - assert_eq!(source.demand_rx.recv().await, Some(())); - - drop(source.item_tx); - tokio::task::yield_now().await; - assert!( - session - .inner - .exported - .lock() - .expect("live stream map mutex poisoned") - .contains_key(&stream_id), - "the exported route must remain addressable while its terminal frame is blocked" - ); + async fn cancellation_releases_an_exported_bus_waiter() { + let (_source, stream) = stream_source(4); + let (frames, _frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new_server(frames); + session.encode(&stream).unwrap(); - let result = session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id, - })) - .await; + session.cancel(); - assert!( - result.is_ok(), - "detach is valid until the peer can observe the terminal frame: {result:?}" - ); - frame_rx.recv().await.unwrap(); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::End(LiveStreamEnd { - stream_id: id - })) if id == stream_id - )); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + tokio::time::timeout(Duration::from_secs(1), session.wait_idle()) .await - .expect("detach must interrupt a blocked terminal frame send"); + .unwrap(); } #[test] - async fn detach_must_interrupt_blocked_overlapping_demand_error() { - let (mut source, stream) = relay_endpoint_pair(None); - let (frames, mut frame_rx) = mpsc::channel(1); + async fn cancellation_releases_an_exported_stream_blocked_on_a_frame() { + let (source, stream) = stream_source(1); + let (frames, _frame_rx) = mpsc::channel(1); frames - .send(LiveInvocationFrame { frame: None }) + .send(InvocationResponse { response: None }) .await .unwrap(); - let session = LiveValueSession::new(1, frames); - let stream_id = stream_id(&session.encode(&SchemaValue::Stream(stream)).unwrap()); - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id, - })) + let session = LiveValueSession::new_server_with_capacity(frames, 1); + stream_id(&session.encode(&stream).unwrap()); + source + .publisher + .publish_item(SchemaValue::U32(42)) .await .unwrap(); - assert_eq!(source.demand_rx.recv().await, Some(())); - source.item_tx.send(Ok(SchemaValue::U32(42))).await.unwrap(); - tokio::time::timeout(std::time::Duration::from_secs(1), async { - while source.item_tx.capacity() == 0 { - tokio::task::yield_now().await; - } - }) - .await - .expect("the exported relay should block while sending the item frame"); + tokio::task::yield_now().await; - session - .route_stream_frame(live_invocation_frame::Frame::Demand(LiveStreamDemand { - stream_id, - })) - .await - .unwrap(); - session - .route_stream_frame(live_invocation_frame::Frame::Detach(LiveStreamDetach { - stream_id, - })) - .await - .unwrap(); + session.cancel(); - frame_rx.recv().await.unwrap(); - assert!(matches!( - frame_rx.recv().await.unwrap().frame, - Some(live_invocation_frame::Frame::End(LiveStreamEnd { stream_id: id })) - | Some(live_invocation_frame::Frame::StreamError(LiveStreamError { - stream_id: id, - .. - })) if id == stream_id - )); - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) + tokio::time::timeout(Duration::from_secs(1), session.wait_idle()) .await - .expect("detach must interrupt the blocked overlapping-demand error frame"); + .unwrap(); } #[test] - async fn cancellation_releases_imported_stream_with_buffered_item() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames); - let SchemaValue::Stream(stream) = session.decode(stream_reference(2)).await.unwrap() else { - panic!("expected stream"); - }; - let mut receiver = stream.take_host_endpoint::().unwrap(); - let mut next = Box::pin(receiver.next()); - - let frame = tokio::select! { - frame = frame_rx.recv() => frame.unwrap().frame.unwrap(), - result = &mut next => panic!("read completed before receiving an item: {result:?}"), - }; - assert!(matches!( - frame, - live_invocation_frame::Frame::Demand(LiveStreamDemand { stream_id: 2 }) - )); - drop(next); - - session - .route_stream_frame(live_invocation_frame::Frame::Item(LiveStreamItem { - stream_id: 2, - value: Some(SchemaValue::U32(42).try_into().unwrap()), - })) - .await - .unwrap(); - tokio::time::timeout(std::time::Duration::from_secs(1), async { - while receiver.item_rx.len() != 1 { - tokio::task::yield_now().await; - } - }) - .await - .expect("the delivered item should become buffered"); - - session.cancel(); - - tokio::time::timeout(std::time::Duration::from_secs(1), session.wait_idle()) - .await - .expect("cancellation must release an imported stream with a buffered item"); + async fn unknown_stream_frames_are_rejected() { + let (frames, _frame_rx) = mpsc::channel(4); + let session = LiveValueSession::new_client(frames); + assert_eq!( + session + .route_response(invocation_response::Response::OutputEnd(OutputStreamEnd { + stream_id: 2, + offset: 0, + })) + .await + .unwrap_err(), + "item for unknown remote stream 2" + ); } } diff --git a/golem-worker-executor/src/durable_host/stream_transport.rs b/golem-worker-executor/src/durable_host/stream_transport.rs index 253cd4725a..931fca7c03 100644 --- a/golem-worker-executor/src/durable_host/stream_transport.rs +++ b/golem-worker-executor/src/durable_host/stream_transport.rs @@ -13,34 +13,44 @@ // limitations under the License. use crate::durable_host::schema_value_stream::StoreValueResolver; +use crate::durable_host::stream_bus::{ + LiveStreamEventPayload, LiveStreamPublishError, LiveStreamPublisher, LiveStreamReceiveError, + PrimaryLiveStreamSubscriber, ReservedPrimaryLiveStreamSubscriber, live_input_stream_bus, + live_output_stream_bus, +}; use crate::workerctx::WorkerCtx; use golem_schema::schema::wit::wire::SchemaValueTree; use golem_schema::schema::wit::{decode_value_with, encode_value_with_streams}; use golem_schema::schema::{SchemaValue, SchemaValueStream}; +use std::future::Future; use std::pin::Pin; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; -use tokio::sync::mpsc; +use tokio::sync::Notify; +use tokio_util::sync::CancellationToken; use wasmtime::StoreContextMut; use wasmtime::component::{Destination, Source, StreamConsumer, StreamProducer, StreamResult}; /// Tracks source endpoints created by one live streaming invocation. The /// invocation keeps its Store event loop running until every source has -/// reached end-of-stream or the downstream reader has detached. +/// published its terminal or its primary reader has been lost. #[derive(Debug)] pub(crate) struct LiveStreamTracker { pub(super) active: AtomicUsize, - changed: tokio::sync::Notify, - cancelled: tokio_util::sync::CancellationToken, + changed: Notify, + cancelled: CancellationToken, + capacity: usize, } impl LiveStreamTracker { - pub(crate) fn new(cancelled: tokio_util::sync::CancellationToken) -> Self { + pub(crate) fn new(cancelled: CancellationToken, capacity: usize) -> Self { + assert!(capacity > 0, "live stream bus capacity must be non-zero"); Self { active: AtomicUsize::new(0), - changed: tokio::sync::Notify::new(), + changed: Notify::new(), cancelled, + capacity, } } @@ -69,20 +79,33 @@ impl LiveStreamTracker { self.cancelled.cancelled().await; } - pub(crate) fn cancellation_token(&self) -> tokio_util::sync::CancellationToken { + pub(crate) fn cancellation_token(&self) -> CancellationToken { self.cancelled.clone() } + + pub(crate) fn capacity(&self) -> usize { + self.capacity + } } -#[derive(Debug, Default)] +#[derive(Debug)] pub(super) struct SourceLifecycle { pub(super) finished: AtomicBool, - finished_notify: tokio::sync::Notify, + finished_notify: Notify, trackers: Mutex>>, - cancelled: tokio_util::sync::CancellationToken, + cancelled: CancellationToken, } impl SourceLifecycle { + fn new(cancelled: CancellationToken) -> Self { + Self { + finished: AtomicBool::new(false), + finished_notify: Notify::new(), + trackers: Mutex::new(Vec::new()), + cancelled, + } + } + fn attach(self: &Arc, tracker: Arc) { let mut trackers = self .trackers @@ -119,7 +142,7 @@ impl SourceLifecycle { } } - fn finish(&self) { + pub(super) fn finish(&self) { if self.finished.swap(true, Ordering::AcqRel) { return; } @@ -136,112 +159,177 @@ impl SourceLifecycle { } } -pub(super) struct RelayReceiver { - pub(super) demand_tx: mpsc::Sender<()>, - pub(super) item_rx: mpsc::Receiver>, +pub(super) struct LiveStreamEndpoint { + primary: Option>, + publisher: LiveStreamPublisher, lifecycle: Arc, } -impl RelayReceiver { +impl LiveStreamEndpoint { pub(super) fn attach(&self, tracker: Arc) { self.lifecycle.attach(tracker); } - pub(super) async fn next(&mut self) -> Result, String> { - tokio::select! { - result = self.demand_tx.send(()) => { - if result.is_err() { - return match self.item_rx.recv().await { - Some(Ok(value)) => Ok(Some(value)), - Some(Err(error)) => Err(error), - None => Ok(None), - }; - } - } - _ = self.lifecycle.cancelled.cancelled() => { - self.lifecycle.finish(); - return Err("live streaming invocation was cancelled".to_string()); - } - } - tokio::select! { - item = self.item_rx.recv() => match item { - Some(Ok(value)) => Ok(Some(value)), - Some(Err(error)) => Err(error), - None => Ok(None), - }, - _ = self.lifecycle.cancelled.cancelled() => { - self.lifecycle.finish(); - Err("live streaming invocation was cancelled".to_string()) - } - } + pub(super) fn lifecycle(&self) -> Arc { + self.lifecycle.clone() } -} -impl Drop for RelayReceiver { - fn drop(&mut self) { - self.lifecycle.finish(); + pub(super) fn publisher(&self) -> LiveStreamPublisher { + self.publisher.clone() } -} - -pub(super) struct RelayConsumer { - demand_rx: mpsc::Receiver<()>, - item_tx: mpsc::Sender>, - lifecycle: Arc, - has_demand: bool, -} -pub(super) struct RelayPeer { - pub(super) demand_rx: mpsc::Receiver<()>, - pub(super) item_tx: mpsc::Sender>, - pub(super) lifecycle: Arc, + pub(super) fn activate(mut self) -> PrimaryLiveStreamSubscriber { + self.primary + .take() + .expect("live stream primary subscriber already activated") + .activate() + } } -impl Drop for RelayConsumer { +impl Drop for LiveStreamEndpoint { fn drop(&mut self) { - self.lifecycle.finish(); + if self.primary.is_some() { + self.lifecycle.finish(); + } } } -pub(super) fn relay_pair( - tracker: Option>, -) -> (RelayConsumer, SchemaValueStream) { - let (peer, stream) = relay_endpoint_pair(tracker); - ( - RelayConsumer { - demand_rx: peer.demand_rx, - item_tx: peer.item_tx, - lifecycle: peer.lifecycle, - has_demand: false, +#[derive(Clone)] +pub(super) struct LiveStreamPeer { + pub(super) publisher: LiveStreamPublisher, + pub(super) primary_dropped: Arc, + pub(super) lifecycle: Arc, +} + +pub(super) fn input_stream_pair( + capacity: usize, + invocation_cancellation: &CancellationToken, +) -> Result<(LiveStreamPeer, SchemaValueStream), String> { + let stream_cancellation = invocation_cancellation.child_token(); + let primary_dropped = Arc::new(Notify::new()); + let lifecycle = Arc::new(SourceLifecycle::new(stream_cancellation.clone())); + let (publisher, primary) = + live_input_stream_bus(capacity, stream_cancellation, primary_dropped.clone()) + .map_err(|error| format!("failed to create live input stream bus: {error:?}"))?; + let endpoint = LiveStreamEndpoint { + primary: Some(primary), + publisher: publisher.clone(), + lifecycle: lifecycle.clone(), + }; + Ok(( + LiveStreamPeer { + publisher, + primary_dropped, + lifecycle, }, - stream, - ) + SchemaValueStream::from_host_endpoint(endpoint), + )) } -pub(super) fn relay_endpoint_pair( +pub(super) fn output_stream_pair( tracker: Option>, -) -> (RelayPeer, SchemaValueStream) { - let (demand_tx, demand_rx) = mpsc::channel(1); - let (item_tx, item_rx) = mpsc::channel(1); - let lifecycle = Arc::new(SourceLifecycle::default()); + capacity: usize, +) -> Result<(LiveOutputConsumer, SchemaValueStream), String> { + let cancellation = tracker + .as_ref() + .map(|tracker| tracker.cancellation_token()) + .unwrap_or_default(); + let lifecycle = Arc::new(SourceLifecycle::new(cancellation.clone())); if let Some(tracker) = tracker { + debug_assert_eq!(capacity, tracker.capacity()); lifecycle.attach(tracker); } - let receiver = RelayReceiver { - demand_tx, - item_rx, + let (publisher, primary) = live_output_stream_bus(capacity, cancellation) + .map_err(|error| format!("failed to create live output stream bus: {error:?}"))?; + let endpoint = LiveStreamEndpoint { + primary: Some(primary), + publisher: publisher.clone(), lifecycle: lifecycle.clone(), }; - ( - RelayPeer { - demand_rx, - item_tx, - lifecycle: lifecycle.clone(), + Ok(( + LiveOutputConsumer { + publisher, + lifecycle, + pending: None, + pending_failure: None, + terminal_requested: false, }, - SchemaValueStream::from_host_endpoint(receiver), - ) + SchemaValueStream::from_host_endpoint(endpoint), + )) +} + +type PublicationFuture = + Pin> + Send + 'static>>; + +pub(super) struct LiveOutputConsumer { + publisher: LiveStreamPublisher, + lifecycle: Arc, + pending: Option, + pending_failure: Option, + terminal_requested: bool, +} + +impl LiveOutputConsumer { + fn begin_terminal_publication(&mut self) { + self.terminal_requested = true; + let publisher = self.publisher.clone(); + self.pending = Some(Box::pin(async move { publisher.publish_end().await })); + } + + fn poll_pending(&mut self, cx: &mut Context<'_>) -> Poll> { + let result = match self.pending.as_mut() { + Some(pending) => match pending.as_mut().poll(cx) { + Poll::Pending => return Poll::Pending, + Poll::Ready(result) => result, + }, + None => return Poll::Ready(Ok(StreamResult::Completed)), + }; + self.pending = None; + match result { + Ok(_) => match self.pending_failure.take() { + Some(_) => { + self.lifecycle.finish(); + Poll::Ready(Ok(StreamResult::Dropped)) + } + None if self.terminal_requested => { + self.lifecycle.finish(); + Poll::Ready(Ok(StreamResult::Cancelled)) + } + None => Poll::Ready(Ok(StreamResult::Completed)), + }, + Err(LiveStreamPublishError::Closed) => { + self.lifecycle.finish(); + Poll::Ready(Ok(StreamResult::Dropped)) + } + Err(error) => { + self.lifecycle.finish(); + Poll::Ready(Err(wasmtime::Error::msg(format!( + "failed to publish live output stream event: {error:?}" + )))) + } + } + } +} + +impl Drop for LiveOutputConsumer { + fn drop(&mut self) { + let pending = self.pending.take(); + let terminal_requested = self.terminal_requested; + let publisher = self.publisher.clone(); + let lifecycle = self.lifecycle.clone(); + tokio::spawn(async move { + if let Some(pending) = pending { + let _ = pending.await; + } + if !terminal_requested { + let _ = publisher.publish_end().await; + } + lifecycle.finish(); + }); + } } -impl StreamConsumer for RelayConsumer { +impl StreamConsumer for LiveOutputConsumer { type Item = SchemaValueTree; fn poll_consume( @@ -251,24 +339,12 @@ impl StreamConsumer for RelayConsumer { mut source: Source<'_, Self::Item>, finish: bool, ) -> Poll> { - if finish || self.item_tx.is_closed() { - self.lifecycle.finish(); - return Poll::Ready(Ok(if finish { - StreamResult::Cancelled - } else { - StreamResult::Dropped - })); + if self.pending.is_some() { + return self.poll_pending(cx); } - - if !self.has_demand { - match self.demand_rx.poll_recv(cx) { - Poll::Pending => return Poll::Pending, - Poll::Ready(Some(())) => self.has_demand = true, - Poll::Ready(None) => { - self.lifecycle.finish(); - return Poll::Ready(Ok(StreamResult::Dropped)); - } - } + if finish { + self.begin_terminal_publication(); + return self.poll_pending(cx); } let mut item = None; @@ -281,37 +357,85 @@ impl StreamConsumer for RelayConsumer { let mut resolver = StoreValueResolver::new(&mut store); decode_value_with(item, &mut resolver).map_err(|error| error.to_string()) }; - self.has_demand = false; - match self.item_tx.try_send(decoded) { - Ok(()) => Poll::Ready(Ok(StreamResult::Completed)), - Err(mpsc::error::TrySendError::Closed(_)) => { - self.lifecycle.finish(); - Poll::Ready(Ok(StreamResult::Dropped)) + let publisher = self.publisher.clone(); + match decoded { + Ok(value) => { + self.pending = Some(Box::pin(async move { publisher.publish_item(value).await })); + } + Err(error) => { + self.pending_failure = Some(error.clone()); + self.terminal_requested = true; + self.pending = Some(Box::pin( + async move { publisher.publish_error(error).await }, + )); } - Err(mpsc::error::TrySendError::Full(_)) => Poll::Ready(Err(wasmtime::Error::msg( - "schema value stream relay accepted an item without matching demand", - ))), } + self.poll_pending(cx) } } -pub(super) struct RelayProducer { - receiver: RelayReceiver, - demand_pending: bool, +type ReceiveFuture = Pin< + Box< + dyn Future< + Output = ( + PrimaryLiveStreamSubscriber, + Option< + Result< + crate::durable_host::stream_bus::LiveStreamEvent, + LiveStreamReceiveError, + >, + >, + ), + > + Send + + 'static, + >, +>; + +async fn receive_input_event( + mut subscriber: PrimaryLiveStreamSubscriber, + cancelled: CancellationToken, +) -> ( + PrimaryLiveStreamSubscriber, + Option< + Result< + crate::durable_host::stream_bus::LiveStreamEvent, + LiveStreamReceiveError, + >, + >, +) { + let event = tokio::select! { + event = subscriber.recv() => Some(event), + _ = cancelled.cancelled() => None, + }; + (subscriber, event) +} + +pub(super) struct LiveInputProducer { + subscriber: Option>, + pending: Option, + lifecycle: Arc, finished: bool, } -impl RelayProducer { - pub(super) fn new(receiver: RelayReceiver) -> Self { +impl LiveInputProducer { + pub(super) fn new(endpoint: LiveStreamEndpoint) -> Self { + let lifecycle = endpoint.lifecycle.clone(); Self { - receiver, - demand_pending: false, + subscriber: Some(endpoint.activate()), + pending: None, + lifecycle, finished: false, } } } -impl StreamProducer for RelayProducer { +impl Drop for LiveInputProducer { + fn drop(&mut self) { + self.lifecycle.finish(); + } +} + +impl StreamProducer for LiveInputProducer { type Item = SchemaValueTree; type Buffer = Option; @@ -327,44 +451,129 @@ impl StreamProducer for RelayProducer { } if finish { self.finished = true; - self.receiver.lifecycle.finish(); + self.pending = None; + self.subscriber = None; + self.lifecycle.finish(); return Poll::Ready(Ok(StreamResult::Cancelled)); } - if !self.demand_pending { - match self.receiver.demand_tx.try_send(()) { - Ok(()) => self.demand_pending = true, - Err(mpsc::error::TrySendError::Closed(_)) => { + if self.pending.is_none() { + let subscriber = self + .subscriber + .take() + .expect("live input stream subscriber is missing"); + let cancelled = self.lifecycle.cancelled.clone(); + self.pending = Some(Box::pin(receive_input_event(subscriber, cancelled))); + } + let (subscriber, event) = match self.pending.as_mut().unwrap().as_mut().poll(cx) { + Poll::Pending => return Poll::Pending, + Poll::Ready(result) => result, + }; + self.pending = None; + self.subscriber = Some(subscriber); + + match event { + Some(Ok(event)) => match event.payload { + LiveStreamEventPayload::Item(value) => { + let encoded = { + let mut resolver = StoreValueResolver::new(&mut store); + encode_value_with_streams(&value, &mut resolver) + .map_err(|error| wasmtime::Error::msg(error.to_string()))? + }; + destination.set_buffer(Some(encoded)); + Poll::Ready(Ok(StreamResult::Completed)) + } + LiveStreamEventPayload::End | LiveStreamEventPayload::Cancel(_) => { self.finished = true; - self.receiver.lifecycle.finish(); - return Poll::Ready(Ok(StreamResult::Dropped)); + self.lifecycle.finish(); + Poll::Ready(Ok(StreamResult::Dropped)) } - Err(mpsc::error::TrySendError::Full(_)) => self.demand_pending = true, - } - } - - match self.receiver.item_rx.poll_recv(cx) { - Poll::Pending => Poll::Pending, - Poll::Ready(None) => { + LiveStreamEventPayload::Error(error) => { + self.finished = true; + self.lifecycle.finish(); + Poll::Ready(Err(wasmtime::Error::msg(error))) + } + }, + Some(Err(LiveStreamReceiveError::Closed)) => { self.finished = true; - self.receiver.lifecycle.finish(); - Poll::Ready(Ok(StreamResult::Dropped)) + self.lifecycle.finish(); + Poll::Ready(Err(wasmtime::Error::msg( + "live input stream closed without a terminal event", + ))) } - Poll::Ready(Some(Err(error))) => { + Some(Err(LiveStreamReceiveError::Lagged(missed))) => { self.finished = true; - self.receiver.lifecycle.finish(); - Poll::Ready(Err(wasmtime::Error::msg(error))) + self.lifecycle.finish(); + Poll::Ready(Err(wasmtime::Error::msg(format!( + "live input stream lost {missed} events" + )))) } - Poll::Ready(Some(Ok(value))) => { - self.demand_pending = false; - let encoded = { - let mut resolver = StoreValueResolver::new(&mut store); - encode_value_with_streams(&value, &mut resolver) - .map_err(|error| wasmtime::Error::msg(error.to_string()))? - }; - destination.set_buffer(Some(encoded)); - Poll::Ready(Ok(StreamResult::Completed)) + None => { + self.finished = true; + self.subscriber = None; + self.lifecycle.finish(); + Poll::Ready(Err(wasmtime::Error::msg( + "live streaming invocation was cancelled", + ))) } } } } + +#[cfg(test)] +mod tests { + use super::*; + use test_r::{test, timeout}; + + #[test] + #[timeout("2s")] + async fn normal_output_finish_publishes_end_before_finishing_lifecycle() { + let tracker = Arc::new(LiveStreamTracker::new(CancellationToken::new(), 4)); + let (mut consumer, stream) = output_stream_pair(Some(tracker.clone()), 4).unwrap(); + let endpoint = stream.take_host_endpoint::().unwrap(); + let mut primary = endpoint.activate(); + + consumer.begin_terminal_publication(); + let result = std::future::poll_fn(|cx| consumer.poll_pending(cx)) + .await + .unwrap(); + + assert!(matches!(result, StreamResult::Cancelled)); + assert!(consumer.lifecycle.finished.load(Ordering::Acquire)); + assert!(matches!( + primary.recv().await.unwrap(), + crate::durable_host::stream_bus::LiveStreamEvent { + offset: 0, + payload: LiveStreamEventPayload::End, + } + )); + tracker.wait_for_sources().await; + } + + #[test] + #[timeout("2s")] + async fn invocation_cancellation_wakes_a_guest_blocked_on_input() { + let invocation_cancellation = CancellationToken::new(); + let session_cancellation = CancellationToken::new(); + let tracker = Arc::new(LiveStreamTracker::new(invocation_cancellation.clone(), 4)); + let (peer, stream) = input_stream_pair(4, &session_cancellation).unwrap(); + let endpoint = stream.take_host_endpoint::().unwrap(); + endpoint.attach(tracker.clone()); + let primary = endpoint.activate(); + let blocked = tokio::spawn(receive_input_event( + primary, + peer.lifecycle.cancelled.clone(), + )); + tokio::task::yield_now().await; + assert!(!blocked.is_finished()); + + invocation_cancellation.cancel(); + + let (primary, event) = blocked.await.unwrap(); + assert_eq!(event, None); + drop(primary); + peer.primary_dropped.notified().await; + tracker.wait_for_sources().await; + assert!(!session_cancellation.is_cancelled()); + } +} diff --git a/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs b/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs index c0809de002..36fd1827ef 100644 --- a/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs +++ b/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs @@ -399,6 +399,7 @@ impl HostWasmRpc for DurableWorkerCtx { "golem::rpc::wasm-rpc::invoke-and-await", method_name, input, + true, )? { Ok(prepared) => prepared, Err(err) => return Ok(Err(err)), @@ -507,17 +508,12 @@ impl HostWasmRpc for DurableWorkerCtx { "golem::rpc::wasm-rpc::invoke", method_name, input, + false, )? { Ok(prepared) => prepared, Err(err) => return Ok(Err(err)), }; - if prepared.is_streaming() { - return Ok(Err(RpcError::ProtocolError( - "live streams require invoke-and-await".to_string(), - ))); - } - let begun = CallHandle::::begin( self, DurableFunctionType::WriteRemote, @@ -607,15 +603,6 @@ impl HostWasmRpc for DurableWorkerCtx { )); } - // Check the per-invocation RPC call limit before initiating the call. - self.state - .check_and_increment_rpc_call_count() - .map_err(wasmtime::Error::from)?; - - // Returns Err(WorkerMonthlyRpcCallBudgetExhausted) when exhausted, - // which maps to RetryDecision::TryStop — suspending the worker. - self.record_monthly_rpc_call()?; - // Resolve the method and lift the input before opening any durability. Failures here are // deterministic functions of the cached remote agent type and the guest payload, so they // are baked into the future's result and surfaced on the first `get` — without opening a @@ -658,7 +645,16 @@ impl HostWasmRpc for DurableWorkerCtx { } }; let method = find_agent_method(&remote_agent_type, &method_name)?; - if method_uses_streams(&remote_agent_type, method, &input_value) { + let streaming = method_uses_streams(&remote_agent_type, method, &input_value); + + // Account for the call only after deterministic schema and mode classification has + // succeeded. Rejected calls must not consume per-invocation or monthly RPC budget. + self.state + .check_and_increment_rpc_call_count() + .map_err(wasmtime::Error::from)?; + self.record_monthly_rpc_call()?; + + if streaming { if !self.state.is_live() { let oplog_index = self.state.oplog.current_oplog_index().await; let idempotency_key = self.derive_idempotency_key(oplog_index); @@ -963,6 +959,9 @@ impl DurableWorkerCtx { let input_value = decode_value_with(input, self) .map_err(|err| anyhow::anyhow!("Invalid RPC input: {err}"))?; let method = find_agent_method(&remote_agent_type, &method_name)?; + method + .validate_input(&remote_agent_type.schema, &input_value) + .map_err(|error| anyhow::anyhow!("Invalid RPC input: {error}"))?; if method_uses_streams(&remote_agent_type, method, &input_value) { return Err(anyhow::anyhow!( "live streams cannot be used in scheduled invocations" @@ -1164,6 +1163,7 @@ fn prepare_rpc_invocation( host_function_name: &str, method_name: String, input: core_wire::SchemaValueTree, + streaming_allowed: bool, ) -> anyhow::Result> { ctx.check_read_only_allows(host_function_name) .map_err(wasmtime::Error::from)?; @@ -1190,11 +1190,6 @@ fn prepare_rpc_invocation( ) }; - ctx.state - .check_and_increment_rpc_call_count() - .map_err(wasmtime::Error::from)?; - ctx.record_monthly_rpc_call()?; - let input_value = match resolve_method_and_lift_input(&remote_agent_type, &method_name, input, ctx) { Ok(input_value) => input_value, @@ -1207,12 +1202,25 @@ fn prepare_rpc_invocation( .expect("method existence was checked while decoding RPC input"); let streaming = method_uses_streams(&remote_agent_type, method, &input_value); + if streaming && !streaming_allowed { + return Ok(Err(RpcError::ProtocolError( + "live streams require invoke-and-await".to_string(), + ))); + } + if ephemeral_logical_agent_id.is_none() && logical_remote_agent_id == own_agent_id { return Err(anyhow::anyhow!( "RPC calls to the same agent are not supported" )); } + // Account for the call only after deterministic method, input, and stream + // classification has succeeded and before any remote or durable work. + ctx.state + .check_and_increment_rpc_call_count() + .map_err(wasmtime::Error::from)?; + ctx.record_monthly_rpc_call()?; + Ok(Ok(PreparedRpcInvocation { logical_remote_agent_id, ephemeral_logical_agent_id, @@ -2931,7 +2939,7 @@ fn find_agent_method<'a>( agent_type: &'a AgentTypeSchema, method_name: &str, ) -> anyhow::Result<&'a AgentMethodSchema> { - agent_type + let method = agent_type .methods .iter() .find(|m| m.name == method_name) @@ -2940,7 +2948,8 @@ fn find_agent_method<'a>( "Method '{method_name}' not found on agent type '{}'", agent_type.type_name ) - }) + })?; + Ok(method) } /// Resolve and lift the guest-side input value tree into the schema-native @@ -2975,7 +2984,7 @@ fn resolve_method_and_lift_input( decode_value_with(input, resolver).map_err(|err| InternalRpcError::ProtocolError { details: format!("Invalid RPC input for method '{method_name}': {err}"), })?; - agent_type + let method = agent_type .methods .iter() .find(|m| m.name == method_name) @@ -2985,6 +2994,11 @@ fn resolve_method_and_lift_input( agent_type.type_name ), })?; + method + .validate_input(&agent_type.schema, &input_value) + .map_err(|error| InternalRpcError::ProtocolError { + details: format!("Invalid RPC input for method '{method_name}': {error}"), + })?; Ok(input_value) } diff --git a/golem-worker-executor/src/grpc/invocation_session.rs b/golem-worker-executor/src/grpc/invocation_session.rs index 50f9efc2da..25e1b58ac7 100644 --- a/golem-worker-executor/src/grpc/invocation_session.rs +++ b/golem-worker-executor/src/grpc/invocation_session.rs @@ -17,21 +17,24 @@ use crate::durable_host::stream_session::LiveValueSession; use crate::grpc::invocation::{CanStartWorker, from_proto_invocation_context}; use crate::services::{HasAll, HasComponentService, HasSchedulerService, UsesAllDeps}; use crate::worker::Worker; -use crate::worker::invocation::agent_method_uses_streams; +use crate::worker::invocation::validate_agent_method_invocation; use crate::workerctx::WorkerCtx; use chrono::{DateTime, Utc}; use futures::{Stream, StreamExt}; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; use golem_api_grpc::proto::golem; +use golem_api_grpc::proto::golem::worker::v1::WorkerExecutionError; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame, InvocationProtocolFailure, InvocationResult, InvocationSessionFinished, - InvocationStart, invocation_cancel, invocation_frame, invocation_protocol_failure, - invocation_result, invocation_session_finished, + InvocationAccepted, InvocationFailure, InvocationFailureKind, InvocationRejected, + InvocationRejectionReason, InvocationRequest, InvocationResponse, InvocationSessionCompletion, + InvocationSessionResult, InvocationStart, invocation_request, invocation_response, + invocation_session_completion, invocation_session_result, }; -use golem_api_grpc::{expect_invocation_start, validate_invocation_request_tail}; use golem_common::model::account::AccountId; use golem_common::model::agent::{ AgentMode, InvocationFreshnessDisposition, ParsedAgentId, Principal, }; +use golem_common::model::component::ComponentRevision; use golem_common::model::{ AgentId, AgentInvocation, AgentInvocationOutput, AgentInvocationResult, IdempotencyKey, InvocationStatus, ScheduledAction, @@ -39,25 +42,26 @@ use golem_common::model::{ use golem_common::schema::SchemaValue; use golem_service_base::error::worker_executor::WorkerExecutorError; use std::pin::Pin; +use std::sync::Arc; use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; use tonic::{Request, Response, Status}; pub(super) type InvocationSessionStream = - Pin> + Send + 'static>>; + Pin> + Send + 'static>>; pub(super) async fn invoke_agent_session< Ctx: WorkerCtx, Svcs: HasAll + UsesAllDeps + Send + Sync + 'static, >( executor: &WorkerExecutorImpl, - request: Request>, + request: Request>, ) -> Result, Status> { let inbound = request.into_inner(); - let (frames, receiver) = mpsc::channel(32); + let (responses, receiver) = mpsc::channel(32); let executor = (*executor).clone(); tokio::spawn(async move { - executor.run_agent_session(inbound, frames).await; + executor.run_agent_session(inbound, responses).await; }); Ok(Response::new(Box::pin( ReceiverStream::new(receiver).map(Ok), @@ -72,6 +76,15 @@ fn decode_invocation_freshness_disposition(value: i32) -> InvocationFreshnessDis } } +fn publish_acceptance( + accepted: tokio::sync::oneshot::Sender>, + component_revision: Option, +) -> Result<(), WorkerExecutorError> { + accepted + .send(component_revision) + .map_err(|_| WorkerExecutorError::runtime("invocation session ended before acceptance")) +} + impl + UsesAllDeps + Send + Sync + 'static> WorkerExecutorImpl { @@ -80,6 +93,7 @@ impl + UsesAllDeps + Send + Sync + request: &InvocationStart, method_parameters: Option, cancellation: tokio_util::sync::CancellationToken, + accepted: tokio::sync::oneshot::Sender>, ) -> Result { Self::validate_auth_ctx(&request.auth_ctx)?; @@ -127,6 +141,7 @@ impl + UsesAllDeps + Send + Sync + }, None => InvocationStatus::Unknown, }; + publish_acceptance(accepted, None)?; return Ok(AgentInvocationOutput { result: AgentInvocationResult::AgentInitialization, consumed_fuel: None, @@ -167,6 +182,39 @@ impl + UsesAllDeps + Send + Sync + let owned_agent_id = extract_owned_agent_id(request, |r| &r.agent_id, |r| &r.environment_id)?; + let existing_metadata = + if freshness_disposition == InvocationFreshnessDisposition::KnownFresh { + None + } else { + Worker::::get_latest_metadata(self, &owned_agent_id).await + }; + let component_revision = existing_metadata + .as_ref() + .map(|metadata| metadata.last_known_status.component_revision); + let component = self + .component_service() + .get_metadata(owned_agent_id.component_id(), component_revision) + .await?; + let parsed_agent_id = + ParsedAgentId::parse(&owned_agent_id.agent_id.agent_id, &component.metadata) + .map_err(WorkerExecutorError::invalid_request)?; + let streaming = validate_agent_method_invocation( + &component.metadata, + Some(&parsed_agent_id), + &method_name, + &method_parameters, + )?; + if streaming + && matches!( + mode, + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule + ) + { + return Err(WorkerExecutorError::invalid_request( + "live streams require an attached Await invocation session", + )); + } + Worker::::validate_invocation_freshness( self, &owned_agent_id, @@ -202,28 +250,16 @@ impl + UsesAllDeps + Send + Sync + let worker = self .get_or_create_pending_with_freshness(request, freshness_disposition) .await?; - let component_revision = worker.get_last_known_status().await.component_revision; - let component = self - .component_service() - .get_metadata(owned_agent_id.component_id(), Some(component_revision)) - .await?; - let parsed_agent_id = - ParsedAgentId::parse(&owned_agent_id.agent_id.agent_id, &component.metadata) - .map_err(WorkerExecutorError::invalid_request)?; - let streaming = agent_method_uses_streams( - &component.metadata, - Some(&parsed_agent_id), - &method_name, - &method_parameters, - )?; let mut invocation_output = if streaming { let fingerprint = worker.get_initial_worker_metadata().fingerprint; + let invocation = worker + .clone() + .enqueue_live_streaming(invocation, cancellation) + .await?; + publish_acceptance(accepted, Some(component.revision))?; AgentInvocationOutput { result: AgentInvocationResult::AgentMethod { - output: worker - .clone() - .invoke_live_streaming(invocation, cancellation) - .await?, + output: invocation.result().await?, }, consumed_fuel: None, invocation_status: None, @@ -234,7 +270,12 @@ impl + UsesAllDeps + Send + Sync + agent_fingerprint: Some(fingerprint), } } else { - worker.invoke_and_await(invocation).await? + let result = worker.clone().invoke(invocation).await?; + if let crate::worker::ResultOrSubscription::Finished(Err(error)) = &result { + return Err(error.clone()); + } + publish_acceptance(accepted, Some(component.revision))?; + worker.await_invocation_result(ik.clone(), result).await? }; invocation_output.agent_id = Some(final_agent_id); invocation_output.idempotency_key = Some(ik); @@ -243,15 +284,6 @@ impl + UsesAllDeps + Send + Sync + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule => { match schedule_at { Some(scheduled_time) => { - let component = self - .component_service() - .get_metadata(owned_agent_id.component_id(), None) - .await?; - let parsed_agent_id = ParsedAgentId::parse( - &owned_agent_id.agent_id.agent_id, - &component.metadata, - ) - .map_err(WorkerExecutorError::invalid_request)?; let agent_mode = component .metadata .find_agent_type_by_name_ref(&parsed_agent_id.agent_type) @@ -291,6 +323,7 @@ impl + UsesAllDeps + Send + Sync + self.scheduler_service() .schedule(scheduled_time, action) .await; + publish_acceptance(accepted, Some(component.revision))?; Ok(AgentInvocationOutput { result: AgentInvocationResult::AgentInitialization, consumed_fuel: None, @@ -306,9 +339,16 @@ impl + UsesAllDeps + Send + Sync + let worker = self .get_or_create_pending_with_freshness(request, freshness_disposition) .await?; - match worker.clone().invoke(invocation).await? { + let result = worker.clone().invoke(invocation).await?; + if let crate::worker::ResultOrSubscription::Finished(Err(err)) = &result { + return Err(err.clone()); + } + publish_acceptance(accepted, Some(component.revision))?; + match result { crate::worker::ResultOrSubscription::Finished(Err(err)) => { - return Err(err); + unreachable!( + "finished errors are handled before acceptance: {err}" + ); } crate::worker::ResultOrSubscription::Finished(Ok(_)) => {} crate::worker::ResultOrSubscription::Pending(_) => { @@ -336,132 +376,286 @@ impl + UsesAllDeps + Send + Sync + async fn run_agent_session( &self, - mut inbound: tonic::Streaming, - frames: mpsc::Sender, + mut inbound: tonic::Streaming, + outward: mpsc::Sender, ) { - let start = match inbound.message().await { - Ok(Some(frame)) => match expect_invocation_start(frame) { - Ok(start) => start, - Err(error) => { - send_protocol_failure( - &frames, - invocation_protocol_failure::Kind::Protocol, - error, - ) - .await; - return; - } - }, + let mut state = InvocationSessionState::default(); + let first = match inbound.message().await { + Ok(Some(request)) => request, Ok(None) => { - send_protocol_failure( - &frames, - invocation_protocol_failure::Kind::Transport, + send_unvalidated_rejection( + &outward, + InvocationRejectionReason::Protocol, "invocation request transport closed before start".to_string(), + None, + None, ) .await; return; } Err(error) => { - send_protocol_failure( - &frames, - invocation_protocol_failure::Kind::Transport, + send_unvalidated_rejection( + &outward, + InvocationRejectionReason::Protocol, error.to_string(), + None, + None, ) .await; return; } }; + if let Err(error) = state.validate_trusted_request(&first) { + send_unvalidated_rejection( + &outward, + InvocationRejectionReason::Protocol, + error, + request_idempotency_key(&first), + request_agent_id(&first), + ) + .await; + return; + } + let first = first.request.expect("validated request has a payload"); + let start = match first { + invocation_request::Request::Start(start) => start, + invocation_request::Request::ResumeAttach(resume) => { + let rejection = InvocationResponse { + response: Some(invocation_response::Response::Rejected( + InvocationRejected { + reason: InvocationRejectionReason::ResumeUnsupported as i32, + error: "resume-attach is not supported by live sessions".to_string(), + idempotency_key: resume.idempotency_key, + agent_id: None, + component_revision: None, + }, + )), + }; + if state.validate_response(&rejection).is_ok() { + let _ = outward.send(rejection).await; + } + return; + } + _ => unreachable!("the session validator requires start or resume-attach first"), + }; - let session = LiveValueSession::new(2, frames.clone()); + let state = Arc::new(tokio::sync::Mutex::new(state)); + let (responses, mut response_rx) = mpsc::channel(32); + let response_state = state.clone(); + let outward_forwarder = outward.clone(); + let forwarder = tokio::spawn(async move { + while let Some(response) = response_rx.recv().await { + if response_state + .lock() + .await + .validate_response(&response) + .is_err() + { + return; + } + if outward_forwarder.send(response).await.is_err() { + return; + } + } + }); + + let session = LiveValueSession::new_server_with_capacity( + responses.clone(), + self.services + .config() + .limits + .live_stream_event_broadcast_capacity + .get(), + ); let input = if start.mode() == golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup { Ok(None) } else { match start.input.clone() { - Some(input) => session.decode(input).await.map(Some), + Some(input) => session.decode_start(input).await.map(Some), None => Err("invocation start has no input".to_string()), } }; let input = match input { Ok(input) => input, Err(error) => { - send_protocol_failure(&frames, invocation_protocol_failure::Kind::Protocol, error) - .await; + send_rejection( + &responses, + InvocationRejectionReason::Protocol, + error, + &start, + ) + .await; session.cancel(); + drop(session); + drop(responses); + let _ = forwarder.await; return; } }; let cancellation = tokio_util::sync::CancellationToken::new(); let _cancel_on_drop = cancellation.clone().drop_guard(); - let invocation = self.invoke_agent_internal(&start, input, cancellation); + let (accepted_tx, mut accepted_rx) = tokio::sync::oneshot::channel(); + let invocation = self.invoke_agent_internal(&start, input, cancellation, accepted_tx); tokio::pin!(invocation); - let output = loop { + let mut early_output = None; + let accepted_revision = loop { tokio::select! { - result = &mut invocation => break result, - frame = inbound.message() => match frame { - Ok(Some(frame)) => { - if !route_live_request_frame(&session, &frames, frame).await { - return; - } - } - Ok(None) => { - fail_session_transport( - &session, - &frames, - "invocation request transport closed before the result".to_string(), - ) - .await; + biased; + accepted = &mut accepted_rx => match accepted { + Ok(revision) => break revision, + Err(_) => { + send_rejection( + &responses, + InvocationRejectionReason::Internal, + "invocation ended without reaching acceptance".to_string(), + &start, + ).await; + session.cancel(); return; } - Err(error) => { - fail_session_transport(&session, &frames, error.to_string()).await; - return; + }, + result = &mut invocation => { + if let Ok(revision) = accepted_rx.try_recv() { + early_output = Some(result); + break revision; } + let (reason, error) = match result { + Ok(_) => ( + InvocationRejectionReason::Internal, + "invocation completed before acceptance".to_string(), + ), + Err(error) => ( + pre_acceptance_rejection_reason(&error), + error.to_string(), + ), + }; + send_rejection(&responses, reason, error, &start).await; + session.cancel(); + return; + } + request = inbound.message() => { + let error = match request { + Ok(Some(request)) => state + .lock() + .await + .validate_trusted_request(&request) + .unwrap_err(), + Ok(None) => "invocation request transport closed before acceptance".to_string(), + Err(error) => error.to_string(), + }; + send_rejection( + &responses, + InvocationRejectionReason::Protocol, + error, + &start, + ).await; + session.cancel(); + return; } } }; + if responses + .send(InvocationResponse { + response: Some(invocation_response::Response::Accepted( + InvocationAccepted { + agent_id: start.agent_id.clone(), + idempotency_key: start.idempotency_key.clone(), + component_revision: accepted_revision.map(|revision| revision.get()), + }, + )), + }) + .await + .is_err() + { + session.cancel(); + return; + } + + let output = match early_output { + Some(output) => output, + None => loop { + tokio::select! { + result = &mut invocation => break result, + request = inbound.message() => match request { + Ok(Some(request)) => { + if !route_live_request( + &session, + &responses, + &state, + request, + ).await { + return; + } + } + Ok(None) => { + fail_session_transport( + &session, + &responses, + "invocation request transport closed before the result".to_string(), + ) + .await; + return; + } + Err(error) => { + fail_session_transport(&session, &responses, error.to_string()).await; + return; + } + } + } + }, + }; + let output = match output { Ok(output) => output, Err(error) => { - send_worker_failure(&frames, error).await; - session.cancel(); + session.terminate_for_failure(&error.to_string()).await; + send_worker_failure(&responses, error).await; return; } }; - let result = match &output.result { - AgentInvocationResult::AgentMethod { output } => match session.encode(output) { - Ok(output) => Some(invocation_result::Result::MethodResult(output)), + let (result, output_stream_ids) = match &output.result { + AgentInvocationResult::AgentMethod { output } => match session.encode_pending(output) { + Ok((output, stream_ids)) => ( + Some(invocation_session_result::Result::MethodResult(output)), + stream_ids, + ), Err(error) => { - send_protocol_failure( - &frames, - invocation_protocol_failure::Kind::Protocol, - error, - ) - .await; - session.cancel(); + session.terminate_for_failure(&error).await; + send_protocol_failure(&responses, error).await; return; } }, - _ => Some(invocation_result::Result::NoResult(golem::common::Empty {})), + _ => ( + Some(invocation_session_result::Result::NoResult( + golem::common::Empty {}, + )), + Vec::new(), + ), }; - if frames - .send(InvocationFrame { - frame: Some(invocation_frame::Frame::Result(InvocationResult { - result, - fuel_consumed: output.consumed_fuel, - component_revision: output.component_revision.map(|revision| revision.get()), - status: output.invocation_status.map(|status| { - golem_api_grpc::proto::golem::worker::InvocationStatus::from(status) as i32 - }), - oplog_index: output.oplog_index.map(u64::from), - agent_fingerprint: output - .agent_fingerprint - .map(|fingerprint| fingerprint.0.into()), - agent_id: output.agent_id.map(Into::into), - idempotency_key: output.idempotency_key.map(Into::into), - })), + if responses + .send(InvocationResponse { + response: Some(invocation_response::Response::Result( + InvocationSessionResult { + result, + component_revision: output + .component_revision + .map(|revision| revision.get()), + agent_id: output.agent_id.map(Into::into), + idempotency_key: output.idempotency_key.map(Into::into), + fuel_consumed: output.consumed_fuel, + status: output.invocation_status.map(|status| { + golem_api_grpc::proto::golem::worker::InvocationStatus::from(status) + as i32 + }), + oplog_index: output.oplog_index.map(u64::from), + agent_fingerprint: output + .agent_fingerprint + .map(|fingerprint| fingerprint.0.into()), + }, + )), }) .await .is_err() @@ -469,16 +663,21 @@ impl + UsesAllDeps + Send + Sync + session.cancel(); return; } + session.activate_exported_streams(&output_stream_ids); let idle = session.wait_idle(); tokio::pin!(idle); loop { tokio::select! { () = &mut idle => { - let _ = frames.send(InvocationFrame { - frame: Some(invocation_frame::Frame::Finished( - InvocationSessionFinished { - outcome: Some(invocation_session_finished::Outcome::Success( + if let Err(details) = session.finish_invocation().await { + send_protocol_failure(&responses, details).await; + return; + } + let _ = responses.send(InvocationResponse { + response: Some(invocation_response::Response::Finished( + InvocationSessionCompletion { + outcome: Some(invocation_session_completion::Outcome::Success( golem::common::Empty {}, )), }, @@ -486,23 +685,28 @@ impl + UsesAllDeps + Send + Sync + }).await; return; } - frame = inbound.message() => match frame { - Ok(Some(frame)) => { - if !route_live_request_frame(&session, &frames, frame).await { + request = inbound.message() => match request { + Ok(Some(request)) => { + if !route_live_request( + &session, + &responses, + &state, + request, + ).await { return; } } Ok(None) => { fail_session_transport( &session, - &frames, + &responses, "invocation request transport closed before completion".to_string(), ) .await; return; } Err(error) => { - fail_session_transport(&session, &frames, error.to_string()).await; + fail_session_transport(&session, &responses, error.to_string()).await; return; } } @@ -511,122 +715,173 @@ impl + UsesAllDeps + Send + Sync + } } -async fn send_protocol_failure( - frames: &mpsc::Sender, - kind: invocation_protocol_failure::Kind, - details: String, +fn request_idempotency_key( + request: &InvocationRequest, +) -> Option { + match request.request.as_ref() { + Some(invocation_request::Request::Start(start)) => start.idempotency_key.clone(), + Some(invocation_request::Request::ResumeAttach(resume)) => resume.idempotency_key.clone(), + _ => None, + } +} + +fn request_agent_id( + request: &InvocationRequest, +) -> Option { + match request.request.as_ref() { + Some(invocation_request::Request::Start(start)) => start.agent_id.clone(), + _ => None, + } +} + +fn pre_acceptance_rejection_reason(error: &WorkerExecutorError) -> InvocationRejectionReason { + match error { + WorkerExecutorError::InvalidRequest { .. } + | WorkerExecutorError::ParamTypeMismatch { .. } + | WorkerExecutorError::NoValueInMessage + | WorkerExecutorError::ValueMismatch { .. } => InvocationRejectionReason::Validation, + WorkerExecutorError::AgentNotFound { .. } + | WorkerExecutorError::ComponentNotFound { .. } + | WorkerExecutorError::PromiseNotFound { .. } => InvocationRejectionReason::NotFound, + WorkerExecutorError::InvalidAccount => InvocationRejectionReason::Unauthorized, + _ => InvocationRejectionReason::Internal, + } +} + +async fn send_unvalidated_rejection( + responses: &mpsc::Sender, + reason: InvocationRejectionReason, + error: String, + idempotency_key: Option, + agent_id: Option, ) { - let _ = frames - .send(InvocationFrame { - frame: Some(invocation_frame::Frame::Finished( - InvocationSessionFinished { - outcome: Some(invocation_session_finished::Outcome::ProtocolFailure( - InvocationProtocolFailure { - kind: kind as i32, - details, - }, - )), + let _ = responses + .send(InvocationResponse { + response: Some(invocation_response::Response::Rejected( + InvocationRejected { + reason: reason as i32, + error, + idempotency_key, + agent_id, + component_revision: None, }, )), }) .await; } -async fn send_worker_failure(frames: &mpsc::Sender, error: WorkerExecutorError) { - let _ = frames - .send(InvocationFrame { - frame: Some(invocation_frame::Frame::Finished( - InvocationSessionFinished { - outcome: Some(invocation_session_finished::Outcome::Failure(error.into())), +async fn send_rejection( + responses: &mpsc::Sender, + reason: InvocationRejectionReason, + error: String, + start: &InvocationStart, +) { + send_unvalidated_rejection( + responses, + reason, + error, + start.idempotency_key.clone(), + start.agent_id.clone(), + ) + .await; +} + +async fn send_failure( + responses: &mpsc::Sender, + kind: InvocationFailureKind, + code: &str, + message: String, + worker_error: Option, +) { + let _ = responses + .send(InvocationResponse { + response: Some(invocation_response::Response::Finished( + InvocationSessionCompletion { + outcome: Some(invocation_session_completion::Outcome::Failure( + InvocationFailure { + kind: kind as i32, + code: code.to_string(), + message, + worker_error, + }, + )), }, )), }) .await; } +async fn send_protocol_failure(responses: &mpsc::Sender, details: String) { + send_failure( + responses, + InvocationFailureKind::Protocol, + "protocol", + details, + None, + ) + .await; +} + +async fn send_worker_failure( + responses: &mpsc::Sender, + error: WorkerExecutorError, +) { + let message = error.to_string(); + send_failure( + responses, + InvocationFailureKind::Execution, + "worker-execution", + message, + Some(error.into()), + ) + .await; +} + async fn fail_session_transport( session: &LiveValueSession, - frames: &mpsc::Sender, + responses: &mpsc::Sender, details: String, ) { - session.fail(details.clone()); - send_protocol_failure( - frames, - invocation_protocol_failure::Kind::Transport, + session.terminate_for_failure(&details).await; + send_failure( + responses, + InvocationFailureKind::Transport, + "transport", details, + None, ) .await; } -async fn route_live_request_frame( +async fn route_live_request( session: &LiveValueSession, - frames: &mpsc::Sender, - frame: InvocationFrame, + responses: &mpsc::Sender, + state: &Arc>, + request: InvocationRequest, ) -> bool { - let frame = match validate_invocation_request_tail(frame) { - Ok(frame) => frame.frame.expect("validated request frame has a payload"), + let request = match state.lock().await.validate_trusted_request(&request) { + Ok(()) => request + .request + .expect("validated invocation request has a payload"), Err(details) => { - session.fail(details.clone()); - send_protocol_failure(frames, invocation_protocol_failure::Kind::Protocol, details) - .await; + session.terminate_for_failure(&details).await; + send_protocol_failure(responses, details).await; return false; } }; - match frame { - invocation_frame::Frame::Cancel(cancel) => { - let kind = match invocation_cancel::Kind::try_from(cancel.kind) { - Ok(kind) => kind, - Err(_) => { - let details = format!("invalid invocation cancellation kind {}", cancel.kind); - session.fail(details.clone()); - send_protocol_failure( - frames, - invocation_protocol_failure::Kind::Protocol, - details, - ) - .await; - return false; - } - }; - match kind { - invocation_cancel::Kind::Semantic => session.cancel(), - invocation_cancel::Kind::Transport => { - let details = cancel - .details - .unwrap_or_else(|| "invocation request transport failed".to_string()); - fail_session_transport(session, frames, details).await; - } - invocation_cancel::Kind::Protocol => { - let details = cancel - .details - .unwrap_or_else(|| "invalid invocation request frame".to_string()); - session.fail(details.clone()); - send_protocol_failure( - frames, - invocation_protocol_failure::Kind::Protocol, - details, - ) - .await; - } - } + match session.route_request(request).await { + Ok(true) => true, + Ok(false) => { + let details = "unexpected message on invocation request stream".to_string(); + session.terminate_for_failure(&details).await; + send_protocol_failure(responses, details).await; + false + } + Err(details) => { + session.terminate_for_failure(&details).await; + send_protocol_failure(responses, details).await; false } - frame => match session.route_stream_frame(frame).await { - Ok(true) => true, - Ok(false) => { - let details = "unexpected frame on invocation request stream".to_string(); - session.fail(details.clone()); - send_protocol_failure(frames, invocation_protocol_failure::Kind::Protocol, details) - .await; - false - } - Err(details) => { - session.fail(details.clone()); - send_protocol_failure(frames, invocation_protocol_failure::Kind::Protocol, details) - .await; - false - } - }, } } @@ -659,84 +914,3 @@ mod freshness_tests { ); } } - -#[cfg(test)] -mod protocol_tests { - use super::route_live_request_frame; - use crate::durable_host::stream_session::LiveValueSession; - use golem_api_grpc::invocation_cancel_frame; - use golem_api_grpc::proto::golem::worker::invocation_session_finished::Outcome; - use golem_api_grpc::proto::golem::worker::{ - InvocationSessionFinished, invocation_cancel, invocation_frame, invocation_protocol_failure, - }; - use test_r::test; - use tokio::sync::mpsc; - - #[test] - async fn semantic_cancellation_does_not_report_transport_failure() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(2, frames.clone()); - - assert!( - !route_live_request_frame( - &session, - &frames, - invocation_cancel_frame(invocation_cancel::Kind::Semantic, None), - ) - .await - ); - assert!(frame_rx.try_recv().is_err()); - } - - #[test] - async fn transport_cancellation_reports_typed_failure() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(2, frames.clone()); - - assert!( - !route_live_request_frame( - &session, - &frames, - invocation_cancel_frame( - invocation_cancel::Kind::Transport, - Some("connection lost".to_string()), - ), - ) - .await - ); - let frame = frame_rx.recv().await.unwrap().frame.unwrap(); - assert!(matches!( - frame, - invocation_frame::Frame::Finished(InvocationSessionFinished { - outcome: Some(Outcome::ProtocolFailure(failure)), - }) if failure.kind == invocation_protocol_failure::Kind::Transport as i32 - && failure.details == "connection lost" - )); - } - - #[test] - async fn protocol_cancellation_reports_typed_failure() { - let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(2, frames.clone()); - - assert!( - !route_live_request_frame( - &session, - &frames, - invocation_cancel_frame( - invocation_cancel::Kind::Protocol, - Some("duplicate start".to_string()), - ), - ) - .await - ); - let frame = frame_rx.recv().await.unwrap().frame.unwrap(); - assert!(matches!( - frame, - invocation_frame::Frame::Finished(InvocationSessionFinished { - outcome: Some(Outcome::ProtocolFailure(failure)), - }) if failure.kind == invocation_protocol_failure::Kind::Protocol as i32 - && failure.details == "duplicate start" - )); - } -} diff --git a/golem-worker-executor/src/grpc/mod.rs b/golem-worker-executor/src/grpc/mod.rs index 56ef7c7d01..26c6164972 100644 --- a/golem-worker-executor/src/grpc/mod.rs +++ b/golem-worker-executor/src/grpc/mod.rs @@ -36,7 +36,7 @@ use crate::workerctx::WorkerCtx; use futures::Stream; use futures::StreamExt; use golem_api_grpc::proto::golem; -use golem_api_grpc::proto::golem::worker::{Cursor, InvocationFrame, UpdateMode}; +use golem_api_grpc::proto::golem::worker::{Cursor, InvocationRequest, UpdateMode}; use golem_api_grpc::proto::golem::workerexecutor::v1::worker_executor_server::WorkerExecutor; use golem_api_grpc::proto::golem::workerexecutor::v1::{ ActivatePluginRequest, ActivatePluginResponse, CancelInvocationRequest, @@ -2921,7 +2921,7 @@ impl + UsesAllDeps + Send + Sync + async fn invoke_agent_session( &self, - request: Request>, + request: Request>, ) -> ResponseResult { invocation_session::invoke_agent_session(self, request).await } diff --git a/golem-worker-executor/src/lib.rs b/golem-worker-executor/src/lib.rs index bd5cac39bf..7230c19a79 100644 --- a/golem-worker-executor/src/lib.rs +++ b/golem-worker-executor/src/lib.rs @@ -343,9 +343,13 @@ pub trait Bootstrap { leak_sentinel: Arc<()>, ) -> anyhow::Result> { let worker_fork = Arc::new(DefaultWorkerFork::new( - Arc::new(RemoteInvocationRpc::new( + Arc::new(RemoteInvocationRpc::new_with_stream_capacity( worker_proxy.clone(), shard_service.clone(), + golem_config + .limits + .live_stream_event_broadcast_capacity + .get(), )), active_workers.clone(), engine.clone(), @@ -383,9 +387,13 @@ pub trait Bootstrap { )); let rpc = Arc::new(DirectWorkerInvocationRpc::new( - Arc::new(RemoteInvocationRpc::new( + Arc::new(RemoteInvocationRpc::new_with_stream_capacity( worker_proxy.clone(), shard_service.clone(), + golem_config + .limits + .live_stream_event_broadcast_capacity + .get(), )), direct_invocation_auth_service, active_workers.clone(), diff --git a/golem-worker-executor/src/services/golem_config.rs b/golem-worker-executor/src/services/golem_config.rs index 5e7e147013..94d58ce57d 100644 --- a/golem-worker-executor/src/services/golem_config.rs +++ b/golem-worker-executor/src/services/golem_config.rs @@ -32,6 +32,7 @@ use http::Uri; use serde::{Deserialize, Serialize}; use std::fmt::Write; use std::net::{Ipv4Addr, SocketAddrV4}; +use std::num::NonZeroUsize; use std::path::{Path, PathBuf}; use std::time::Duration; use tracing::warn; @@ -375,6 +376,7 @@ impl Default for GolemConfig { pub struct Limits { pub max_active_workers: usize, pub invocation_result_broadcast_capacity: usize, + pub live_stream_event_broadcast_capacity: NonZeroUsize, pub max_concurrent_streams: u32, pub event_broadcast_capacity: usize, pub event_history_size: usize, @@ -409,6 +411,11 @@ impl SafeDisplay for Limits { "invocation result broadcast capacity: {}", self.invocation_result_broadcast_capacity ); + let _ = writeln!( + &mut result, + "live stream event broadcast capacity: {}", + self.live_stream_event_broadcast_capacity + ); let _ = writeln!( &mut result, "max concurrent streams: {}", @@ -1662,6 +1669,7 @@ impl Default for Limits { Self { max_active_workers: 1024, invocation_result_broadcast_capacity: 100000, + live_stream_event_broadcast_capacity: NonZeroUsize::new(32).unwrap(), max_concurrent_streams: 1024, event_broadcast_capacity: 1024, event_history_size: 128, @@ -2066,3 +2074,40 @@ impl Default for QuotaServiceConfig { pub fn make_config_loader() -> ConfigLoader { ConfigLoader::new_with_examples(Path::new("config/worker-executor.toml")) } + +#[cfg(test)] +mod tests { + use super::Limits; + use golem_common::SafeDisplay; + use serde_json::Value; + use test_r::test; + + #[test] + fn live_stream_event_broadcast_capacity_defaults_to_32() { + let limits = Limits::default(); + + assert_eq!(limits.live_stream_event_broadcast_capacity.get(), 32); + let decoded: Limits = + serde_json::from_value(serde_json::to_value(&limits).unwrap()).unwrap(); + assert_eq!(decoded.live_stream_event_broadcast_capacity.get(), 32); + assert!( + limits + .to_safe_string() + .contains("live stream event broadcast capacity: 32") + ); + } + + #[test] + fn live_stream_event_broadcast_capacity_rejects_zero() { + let mut serialized = serde_json::to_value(Limits::default()).unwrap(); + let Value::Object(fields) = &mut serialized else { + panic!("limits must serialize as an object"); + }; + fields.insert( + "live_stream_event_broadcast_capacity".to_string(), + Value::from(0), + ); + + assert!(serde_json::from_value::(serialized).is_err()); + } +} diff --git a/golem-worker-executor/src/services/rpc.rs b/golem-worker-executor/src/services/rpc.rs index b913954592..386fe96e20 100644 --- a/golem-worker-executor/src/services/rpc.rs +++ b/golem-worker-executor/src/services/rpc.rs @@ -37,25 +37,22 @@ use crate::services::{ worker_fork, }; use crate::worker::Worker; +use crate::worker::invocation::validate_agent_method_invocation; use crate::workerctx::WorkerCtx; use async_trait::async_trait; use futures::StreamExt; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame as LiveInvocationFrame, InvocationProtocolFailure as LiveInvocationFailure, - InvocationSessionFinished, InvocationStart as LiveInvocationStart, - invocation_cancel as live_invocation_cancel, invocation_frame as live_invocation_frame, - invocation_protocol_failure as live_invocation_failure, invocation_result, - invocation_session_finished, -}; -use golem_api_grpc::{ - InvocationResponseState as LiveInvocationResponseState, - invocation_cancel_frame as live_invocation_cancel_frame, + InvocationFailure, InvocationFailureKind, InvocationRejected, InvocationRejectionReason, + InvocationRequest, InvocationStart, invocation_request, invocation_response, + invocation_session_completion, invocation_session_result, }; use golem_common::model::account::AccountId; use golem_common::model::agent::{ - AgentInvocationMode, AgentPrincipal, InvocationFreshnessDisposition, Principal, + AgentInvocationMode, AgentPrincipal, InvocationFreshnessDisposition, ParsedAgentId, Principal, }; use golem_common::model::card::{AgentMethodName, AgentResourcePattern, AgentVerb}; +use golem_common::model::component::ComponentRevision; use golem_common::model::invocation_context::InvocationContextStack; use golem_common::model::oplog::types::SerializableRpcError; use golem_common::model::worker::AgentConfigEntryDto; @@ -67,6 +64,7 @@ use golem_service_base::error::worker_executor::WorkerExecutorError; use golem_service_base::model::auth::AuthCtx; use std::collections::HashMap; use std::fmt::{Display, Formatter}; +use std::future::Future; use std::sync::Arc; use tokio::runtime::Handle; use tokio::sync::mpsc; @@ -74,6 +72,21 @@ use tokio_stream::wrappers::ReceiverStream; use tracing::debug; use wasmtime_wasi_http::HttpConnectionPool; +async fn method_validation_revision( + freshness_disposition: InvocationFreshnessDisposition, + load_existing_revision: F, +) -> Option +where + F: FnOnce() -> Fut, + Fut: Future>, +{ + if freshness_disposition == InvocationFreshnessDisposition::KnownFresh { + None + } else { + load_existing_revision().await + } +} + #[async_trait] pub trait Rpc: Send + Sync { async fn create_demand( @@ -142,40 +155,32 @@ pub trait Rpc: Send + Sync { struct RemoteLiveRequestGuard { session: LiveValueSession, - frames: Option>, + requests: Option>, } impl RemoteLiveRequestGuard { - fn new(session: LiveValueSession, frames: mpsc::Sender) -> Self { + fn new(session: LiveValueSession, requests: mpsc::Sender) -> Self { Self { session, - frames: Some(frames), + requests: Some(requests), } } fn disarm(&mut self) { - self.frames = None; + self.requests = None; } } impl Drop for RemoteLiveRequestGuard { fn drop(&mut self) { - let Some(frames) = self.frames.take() else { + let Some(requests) = self.requests.take() else { return; }; if self.session.is_cancelled() { return; } self.session.cancel(); - let frame = live_invocation_cancel_frame(live_invocation_cancel::Kind::Semantic, None); - match frames.try_send(frame) { - Ok(()) | Err(mpsc::error::TrySendError::Closed(_)) => {} - Err(mpsc::error::TrySendError::Full(frame)) => { - tokio::spawn(async move { - let _ = frames.send(frame).await; - }); - } - } + drop(requests); } } @@ -316,13 +321,27 @@ pub trait RpcDemand: Send + Sync { pub struct RemoteInvocationRpc { worker_proxy: Arc, _shard_service: Arc, + stream_capacity: usize, } impl RemoteInvocationRpc { pub fn new(worker_proxy: Arc, shard_service: Arc) -> Self { + Self::new_with_stream_capacity(worker_proxy, shard_service, 32) + } + + pub fn new_with_stream_capacity( + worker_proxy: Arc, + shard_service: Arc, + stream_capacity: usize, + ) -> Self { + assert!( + stream_capacity > 0, + "live stream bus capacity must be non-zero" + ); Self { worker_proxy, _shard_service: shard_service, + stream_capacity, } } } @@ -465,14 +484,33 @@ impl Rpc for RemoteInvocationRpc { config: Vec, auth_ctx: &AuthCtx, ) -> Result { - let (frames, receiver) = mpsc::channel(32); - let session = LiveValueSession::new(1, frames.clone()); - let input = session - .encode(&method_parameters) + let state = Arc::new(tokio::sync::Mutex::new(InvocationSessionState::default())); + let (requests, mut request_rx) = mpsc::channel(32); + let (wire_requests, receiver) = mpsc::channel(32); + let request_state = state.clone(); + tokio::spawn(async move { + while let Some(request) = request_rx.recv().await { + if request_state + .lock() + .await + .validate_trusted_request(&request) + .is_err() + { + return; + } + if wire_requests.send(request).await.is_err() { + return; + } + } + }); + let session = + LiveValueSession::new_client_with_capacity(requests.clone(), self.stream_capacity); + let (input, input_stream_ids) = session + .encode_pending(&method_parameters) .map_err(|details| RpcError::ProtocolError { details })?; - frames - .send(LiveInvocationFrame { - frame: Some(live_invocation_frame::Frame::Start(LiveInvocationStart { + requests + .send(InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { agent_id: Some(owned_agent_id.agent_id().into()), method_name: Some(method_name), input: Some(input), @@ -497,7 +535,7 @@ impl Rpc for RemoteInvocationRpc { .map_err(|_| RpcError::ProtocolError { details: "live invocation request ended before start".to_string(), })?; - let mut cancel_on_drop = RemoteLiveRequestGuard::new(session.clone(), frames.clone()); + let mut cancel_on_drop = RemoteLiveRequestGuard::new(session.clone(), requests.clone()); let mut inbound = match self .worker_proxy .invoke_agent_session(Box::pin(ReceiverStream::new(receiver))) @@ -509,94 +547,78 @@ impl Rpc for RemoteInvocationRpc { return Err(error.into()); } }; - let mut response_state = LiveInvocationResponseState::default(); - while let Some(frame) = inbound.next().await { - let frame = match frame { - Ok(frame) => frame, + while let Some(response) = inbound.next().await { + let response = match response { + Ok(response) => response, Err(error) => { let details = error.to_string(); - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Transport, - details, - ) - .await; + fail_live_response_transport(&session, details).await; return Err(error.into()); } }; - if let Err(details) = response_state.validate(&frame) { - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Protocol, - details.clone(), - ) - .await; + if let Err(details) = state.lock().await.validate_response(&response) { + fail_live_response_transport(&session, details.clone()).await; return Err(RpcError::ProtocolError { details }); } - match frame.frame { - Some(live_invocation_frame::Frame::Result(result)) => { + match response.response { + Some(invocation_response::Response::Accepted(_)) => { + session.activate_exported_streams(&input_stream_ids); + } + Some(invocation_response::Response::Rejected(rejected)) => { + if let Err(error) = + confirm_terminal_response_is_last(&mut inbound, &state).await + { + session.fail(error.to_string()); + return Err(error); + } + let error = rpc_error_from_rejection(rejected); + session.fail(error.to_string()); + return Err(error); + } + Some(invocation_response::Response::Result(result)) => { let output = match result.result { - Some(invocation_result::Result::MethodResult(output)) => { + Some(invocation_session_result::Result::MethodResult(output)) => { match session.decode(output).await { Ok(output) => output, Err(details) => { - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Protocol, - details.clone(), - ) - .await; + fail_live_response_transport(&session, details.clone()).await; return Err(RpcError::ProtocolError { details }); } } } - Some(invocation_result::Result::NoResult(_)) | None => { + Some(invocation_session_result::Result::NoResult(_)) | None => { let details = "streaming agent invocation returned no method result".to_string(); - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Protocol, - details.clone(), - ) - .await; + fail_live_response_transport(&session, details.clone()).await; return Err(RpcError::ProtocolError { details }); } }; - spawn_live_response_router(session, inbound, frames, response_state); + spawn_live_response_router(session, inbound, requests, state); cancel_on_drop.disarm(); return Ok(output); } - Some(live_invocation_frame::Frame::Finished(finished)) => { + Some(invocation_response::Response::Finished(finished)) => { + if let Err(error) = + confirm_terminal_response_is_last(&mut inbound, &state).await + { + session.fail(error.to_string()); + return Err(error); + } let error = rpc_error_from_invocation_finished(finished); session.fail(error.to_string()); return Err(error); } - Some(frame) => match session.route_stream_frame(frame).await { + Some(response) => match session.route_response(response).await { Ok(true) => {} Ok(false) => { - let details = "unexpected frame before the invocation result".to_string(); - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Protocol, - details.clone(), - ) - .await; + let details = + "unexpected response before the invocation result".to_string(); + fail_live_response_transport(&session, details.clone()).await; return Err(RpcError::ProtocolError { details }); } Err(details) => { - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Protocol, - details.clone(), - ) - .await; + fail_live_response_transport(&session, details.clone()).await; return Err(RpcError::ProtocolError { details }); } }, @@ -604,13 +626,7 @@ impl Rpc for RemoteInvocationRpc { } } let details = "invocation response ended before publishing a result".to_string(); - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Transport, - details.clone(), - ) - .await; + fail_live_response_transport(&session, details.clone()).await; Err(RpcError::ProtocolError { details }) } @@ -656,89 +672,62 @@ impl Rpc for RemoteInvocationRpc { fn spawn_live_response_router( session: LiveValueSession, mut inbound: InvocationResponseStream, - frames: mpsc::Sender, - mut response_state: LiveInvocationResponseState, + requests: mpsc::Sender, + state: Arc>, ) { tokio::spawn(async move { - while let Some(frame) = inbound.next().await { - let frame = match frame { - Ok(frame) => frame, + let _requests = requests; + while let Some(response) = inbound.next().await { + let response = match response { + Ok(response) => response, Err(error) => { - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Transport, - error.to_string(), - ) - .await; + fail_live_response_transport(&session, error.to_string()).await; return; } }; - if let Err(details) = response_state.validate(&frame) { - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Protocol, - details, - ) - .await; + if let Err(details) = state.lock().await.validate_response(&response) { + fail_live_response_transport(&session, details).await; return; } - match frame.frame { - Some(live_invocation_frame::Frame::Finished(finished)) => { + match response.response { + Some(invocation_response::Response::Finished(finished)) => { + if let Err(error) = + confirm_terminal_response_is_last(&mut inbound, &state).await + { + session.fail(error.to_string()); + return; + } match finished.outcome { - Some(invocation_session_finished::Outcome::Success(_)) => { + Some(invocation_session_completion::Outcome::Success(_)) => { if let Err(details) = session.finish_invocation().await { - let _ = frames - .send(live_invocation_cancel_frame( - live_invocation_cancel::Kind::Protocol, - Some(details), - )) - .await; + session.fail(details); } } - Some(invocation_session_finished::Outcome::Failure(failure)) => { - session.fail(worker_failure_details(failure)); - } - Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { - session.fail(failure.details); + Some(invocation_session_completion::Outcome::Failure(failure)) => { + session.fail(rpc_error_from_failure(failure).to_string()); } None => session.fail("invocation completion has no outcome".to_string()), } return; } - Some(frame) => match session.route_stream_frame(frame).await { + Some(response) => match session.route_response(response).await { Ok(true) => {} Ok(false) => { - let details = "unexpected frame after the invocation result".to_string(); - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Protocol, - details, - ) - .await; + let details = "unexpected response after the invocation result".to_string(); + fail_live_response_transport(&session, details).await; return; } Err(details) => { - fail_live_response_transport( - &session, - &frames, - live_invocation_cancel::Kind::Protocol, - details, - ) - .await; + fail_live_response_transport(&session, details).await; return; } }, None => unreachable!("response state validation rejects empty frames"), } } - if !response_state.is_complete() { + if !state.lock().await.is_complete() { fail_live_response_transport( &session, - &frames, - live_invocation_cancel::Kind::Transport, "invocation response ended before completion".to_string(), ) .await; @@ -746,63 +735,76 @@ fn spawn_live_response_router( }); } -async fn fail_live_response_transport( - session: &LiveValueSession, - frames: &mpsc::Sender, - kind: live_invocation_cancel::Kind, - details: String, -) { - let _ = frames - .send(live_invocation_cancel_frame(kind, Some(details.clone()))) - .await; +async fn confirm_terminal_response_is_last( + inbound: &mut InvocationResponseStream, + state: &Arc>, +) -> Result<(), RpcError> { + match inbound.next().await { + None => Ok(()), + Some(Err(error)) => Err(error.into()), + Some(Ok(response)) => { + let details = state.lock().await.validate_response(&response).unwrap_err(); + Err(RpcError::ProtocolError { details }) + } + } +} + +async fn fail_live_response_transport(session: &LiveValueSession, details: String) { session.fail(details); } -fn rpc_error_from_live_failure(failure: LiveInvocationFailure) -> RpcError { - match live_invocation_failure::Kind::try_from(failure.kind) - .unwrap_or(live_invocation_failure::Kind::RemoteInternal) +fn rpc_error_from_rejection(rejected: InvocationRejected) -> RpcError { + match InvocationRejectionReason::try_from(rejected.reason) + .unwrap_or(InvocationRejectionReason::Internal) { - live_invocation_failure::Kind::Protocol => RpcError::ProtocolError { - details: failure.details, - }, - live_invocation_failure::Kind::Denied => RpcError::Denied { - details: failure.details, + InvocationRejectionReason::Unauthorized => RpcError::Denied { + details: rejected.error, }, - live_invocation_failure::Kind::NotFound => RpcError::NotFound { - details: failure.details, + InvocationRejectionReason::NotFound => RpcError::NotFound { + details: rejected.error, }, - live_invocation_failure::Kind::RemoteInternal => RpcError::RemoteInternalError { - details: failure.details, + InvocationRejectionReason::Internal => RpcError::RemoteInternalError { + details: rejected.error, }, - live_invocation_failure::Kind::Transport => RpcError::ProtocolError { - details: format!("live invocation transport failed: {}", failure.details), + _ => RpcError::ProtocolError { + details: rejected.error, }, } } -fn worker_failure_details( - failure: golem_api_grpc::proto::golem::worker::v1::WorkerExecutionError, -) -> String { - let result: Result = failure.try_into(); - result - .map(|error| error.to_string()) - .unwrap_or_else(|error| format!("failed to decode worker execution error: {error}")) +fn rpc_error_from_failure(failure: InvocationFailure) -> RpcError { + if let Some(worker_error) = failure.worker_error { + return WorkerExecutorError::try_from(worker_error) + .map(Into::into) + .unwrap_or_else(|error| RpcError::RemoteInternalError { + details: format!("failed to decode worker execution error: {error}"), + }); + } + match InvocationFailureKind::try_from(failure.kind).unwrap_or(InvocationFailureKind::Internal) { + InvocationFailureKind::Protocol | InvocationFailureKind::Transport => { + RpcError::ProtocolError { + details: failure.message, + } + } + InvocationFailureKind::Execution | InvocationFailureKind::Internal => { + RpcError::RemoteInternalError { + details: failure.message, + } + } + InvocationFailureKind::Unspecified => RpcError::ProtocolError { + details: failure.message, + }, + } } -fn rpc_error_from_invocation_finished(finished: InvocationSessionFinished) -> RpcError { +fn rpc_error_from_invocation_finished( + finished: golem_api_grpc::proto::golem::worker::InvocationSessionCompletion, +) -> RpcError { match finished.outcome { - Some(invocation_session_finished::Outcome::Failure(failure)) => { - let result: Result = failure.try_into(); - result - .map(Into::into) - .unwrap_or_else(|error| RpcError::RemoteInternalError { - details: format!("failed to decode worker execution error: {error}"), - }) + Some(invocation_session_completion::Outcome::Failure(failure)) => { + rpc_error_from_failure(failure) } - Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { - rpc_error_from_live_failure(failure) - } - Some(invocation_session_finished::Outcome::Success(_)) => RpcError::ProtocolError { + Some(invocation_session_completion::Outcome::Success(_)) => RpcError::ProtocolError { details: "invocation completed successfully before publishing a result".to_string(), }, None => RpcError::ProtocolError { @@ -1206,6 +1208,35 @@ impl DirectWorkerInvocationRpc { &owned_agent_id.agent_id, )) } + + async fn validate_method_invocation( + &self, + owned_agent_id: &OwnedAgentId, + method_name: &str, + method_parameters: &SchemaValue, + freshness_disposition: InvocationFreshnessDisposition, + ) -> Result { + let component_revision = method_validation_revision(freshness_disposition, || async { + Worker::::get_latest_metadata(self, owned_agent_id) + .await + .map(|metadata| metadata.last_known_status.component_revision) + }) + .await; + let component = self + .component_service() + .get_metadata(owned_agent_id.component_id(), component_revision) + .await?; + let parsed_agent_id = + ParsedAgentId::parse(&owned_agent_id.agent_id.agent_id, &component.metadata) + .map_err(|details| RpcError::ProtocolError { details })?; + validate_agent_method_invocation( + &component.metadata, + Some(&parsed_agent_id), + method_name, + method_parameters, + ) + .map_err(Into::into) + } } #[async_trait] @@ -1314,6 +1345,20 @@ impl Rpc for DirectWorkerInvocationRpc { ) .await?; + if self + .validate_method_invocation( + owned_agent_id, + &method_name, + &method_parameters, + freshness_disposition, + ) + .await? + { + return Err(RpcError::ProtocolError { + details: "live streams require the attached streaming RPC".to_string(), + }); + } + let principal = caller_agent_principal(self_agent_id); let idempotency_key = idempotency_key.unwrap_or(IdempotencyKey::fresh()); Worker::::validate_invocation_freshness( @@ -1418,6 +1463,13 @@ impl Rpc for DirectWorkerInvocationRpc { auth_ctx, ) .await?; + self.validate_method_invocation( + owned_agent_id, + &method_name, + &method_parameters, + InvocationFreshnessDisposition::MayExist, + ) + .await?; let principal = caller_agent_principal(self_agent_id); let worker = Worker::get_or_create_suspended( self, @@ -1485,6 +1537,21 @@ impl Rpc for DirectWorkerInvocationRpc { ) .await?; + if self + .validate_method_invocation( + owned_agent_id, + &method_name, + &method_parameters, + freshness_disposition, + ) + .await? + { + return Err(RpcError::ProtocolError { + details: "live streams cannot be used in fire-and-forget invocations" + .to_string(), + }); + } + let principal = caller_agent_principal(self_agent_id); let idempotency_key = idempotency_key.unwrap_or(IdempotencyKey::fresh()); Worker::::validate_invocation_freshness( @@ -1545,25 +1612,75 @@ impl Rpc for DirectWorkerInvocationRpc { #[cfg(test)] mod protocol_tests { - use super::RemoteLiveRequestGuard; + use super::{ + RemoteLiveRequestGuard, RpcError, method_validation_revision, rpc_error_from_failure, + }; use crate::durable_host::stream_session::LiveValueSession; - use golem_api_grpc::proto::golem::worker::{invocation_cancel, invocation_frame}; + use golem_api_grpc::proto::golem::worker::{InvocationFailure, InvocationFailureKind}; + use golem_common::model::agent::InvocationFreshnessDisposition; + use golem_common::model::component::ComponentRevision; + use golem_service_base::error::worker_executor::WorkerExecutorError; + use std::cell::Cell; use test_r::test; use tokio::sync::mpsc; #[test] - async fn dropped_remote_request_sends_semantic_cancellation() { + async fn known_fresh_method_validation_uses_selected_revision_without_metadata_probe() { + let probed_existing_worker = Cell::new(false); + let revision = + method_validation_revision(InvocationFreshnessDisposition::KnownFresh, || async { + probed_existing_worker.set(true); + Some(ComponentRevision::INITIAL) + }) + .await; + + assert_eq!(revision, None); + assert!(!probed_existing_worker.get()); + } + + #[test] + async fn may_exist_method_validation_uses_existing_worker_revision() { + let probed_existing_worker = Cell::new(false); + let existing_revision = ComponentRevision::new(7).unwrap(); + let revision = + method_validation_revision(InvocationFreshnessDisposition::MayExist, || async { + probed_existing_worker.set(true); + Some(existing_revision) + }) + .await; + + assert_eq!(revision, Some(existing_revision)); + assert!(probed_existing_worker.get()); + } + + #[test] + fn typed_worker_failure_preserves_rpc_error_category() { + let worker_error = WorkerExecutorError::invalid_request("bad invocation"); + let error = rpc_error_from_failure(InvocationFailure { + kind: InvocationFailureKind::Execution as i32, + code: "worker-execution".to_string(), + message: worker_error.to_string(), + worker_error: Some(worker_error.into()), + }); + + assert_eq!( + error, + RpcError::ProtocolError { + details: "bad invocation".to_string(), + } + ); + } + + #[test] + async fn dropped_remote_request_cancels_the_session_and_closes_requests() { let (frames, mut frame_rx) = mpsc::channel(4); - let session = LiveValueSession::new(1, frames.clone()); - let guard = RemoteLiveRequestGuard::new(session, frames); + let session = LiveValueSession::new_client(frames.clone()); + let guard = RemoteLiveRequestGuard::new(session.clone(), frames); drop(guard); - let frame = frame_rx.recv().await.unwrap().frame.unwrap(); - assert!(matches!( - frame, - invocation_frame::Frame::Cancel(cancel) - if cancel.kind == invocation_cancel::Kind::Semantic as i32 - )); + assert!(session.is_cancelled()); + drop(session); + assert!(frame_rx.recv().await.is_none()); } } diff --git a/golem-worker-executor/src/services/worker_proxy.rs b/golem-worker-executor/src/services/worker_proxy.rs index 68ac712dd2..1857f92f60 100644 --- a/golem-worker-executor/src/services/worker_proxy.rs +++ b/golem-worker-executor/src/services/worker_proxy.rs @@ -28,7 +28,9 @@ use golem_api_grpc::proto::golem::worker::v1::{ invoke_agent_response, launch_new_worker_response, process_oplog_entries_response, resume_worker_response, revert_worker_response, update_worker_response, }; -use golem_api_grpc::proto::golem::worker::{CompleteParameters, InvocationFrame, UpdateMode}; +use golem_api_grpc::proto::golem::worker::{ + CompleteParameters, InvocationRequest, InvocationResponse, UpdateMode, +}; use golem_common::model::account::AccountId; use golem_common::model::agent::{AgentInvocationMode, InvocationFreshnessDisposition, Principal}; use golem_common::model::component::ComponentRevision; @@ -57,16 +59,16 @@ use tonic::transport::Channel; use tonic_tracing_opentelemetry::middleware::client::OtelGrpcService; use tracing::debug; -pub type InvocationRequestStream = Pin + Send + 'static>>; +pub type InvocationRequestStream = Pin + Send + 'static>>; pub type InvocationResponseStream = - Pin> + Send + 'static>>; + Pin> + Send + 'static>>; fn invoke_agent_session_once<'a>( client: &'a mut WorkerServiceClient>, request: Option, ) -> Pin< Box< - dyn Future>, Status>> + dyn Future>, Status>> + Send + 'a, >, @@ -835,7 +837,7 @@ mod tests { #[tonic::async_trait] impl WorkerService for FlakyWorkerService { type InvokeAgentSessionStream = - Pin> + Send + 'static>>; + Pin> + Send + 'static>>; unimplemented_rpc!( launch_new_worker, @@ -864,7 +866,7 @@ mod tests { async fn invoke_agent_session( &self, - _request: Request>, + _request: Request>, ) -> Result, Status> { Err(Status::unimplemented("invoke_agent_session")) } diff --git a/golem-worker-executor/src/worker/invocation.rs b/golem-worker-executor/src/worker/invocation.rs index 2710c7f335..3c11efca33 100644 --- a/golem-worker-executor/src/worker/invocation.rs +++ b/golem-worker-executor/src/worker/invocation.rs @@ -29,13 +29,13 @@ use golem_common::model::component_metadata::ComponentMetadata; use golem_common::model::oplog::AgentError as OplogAgentError; use golem_common::model::{AgentInvocation, AgentInvocationResult, OplogIndex}; use golem_common::schema::SchemaValue; +#[cfg(test)] +use golem_common::schema::agent::InputSchema; use golem_common::schema::agent::wit::decode_agent_error_rejecting_quota_with; -use golem_common::schema::agent::{ - AgentMethodSchema, AgentTypeSchema, FieldSource, InputSchema, contains_stream_in_graph, -}; +use golem_common::schema::agent::{AgentMethodSchema, AgentTypeSchema}; use golem_common::schema::graph::SchemaGraph; use golem_common::schema::schema_type::SchemaType; -use golem_common::schema::validation::value::{validate_record_fields, validate_value}; +use golem_common::schema::validation::value::validate_value; use golem_schema::schema::wit::wire as core_wire; use golem_schema::schema::wit::{decode_value_with, encode_value_with, encode_value_with_streams}; use golem_service_base::error::worker_executor::{InterruptKind, WorkerExecutorError}; @@ -183,7 +183,8 @@ pub async fn invoke_live_streaming_rpc( publish_live_streaming_response(&response, Err(error.clone())); return Err(error); }; - let tracker = Arc::new(LiveStreamTracker::new(cancellation)); + let stream_capacity = store.data().durable_ctx().live_stream_event_capacity(); + let tracker = Arc::new(LiveStreamTracker::new(cancellation, stream_capacity)); let mut tracker_installed = false; let mut unpersisted_execution_active = false; let mut read_only_active = false; @@ -758,17 +759,23 @@ fn decode_invoke_output( "Failed to decode agent method output: {e}" )) })?; - if contains_stream(&output) { - Err(WorkerExecutorError::runtime( - "Agent method output contains a live stream at a materializing invocation boundary", - )) - } else { - Ok(output) - } + reject_stream_at_materializing_boundary(output) } } } +fn reject_stream_at_materializing_boundary( + output: SchemaValue, +) -> Result { + if contains_stream(&output) { + Err(WorkerExecutorError::runtime( + "Agent method output contains a live stream at a materializing invocation boundary", + )) + } else { + Ok(output) + } +} + /// Declared output shape of an agent method, carried from [`lower_invocation`] /// (where the agent type and method are resolved) to [`dispatch_call`] (where /// the guest's returned value is validated against it). @@ -1219,12 +1226,7 @@ pub fn lower_invocation( })?; let read_only_method = method.read_only.is_some().then(|| method_name.clone()); - validate_schema_input_against_method_schema( - &input, - agent_type, - &method.input_schema, - &method_name, - )?; + validate_method_invocation(agent_type, method, &input, &method_name)?; let expected_output = Box::new(ExpectedInvokeOutput { graph: agent_type.schema.clone(), @@ -1301,7 +1303,7 @@ pub fn lower_invocation( } } -pub fn agent_method_uses_streams( +pub fn validate_agent_method_invocation( component_metadata: &ComponentMetadata, agent_id: Option<&ParsedAgentId>, method_name: &str, @@ -1319,7 +1321,7 @@ pub fn agent_method_uses_streams( )) })?; - Ok(method_uses_streams(agent_type, method, input)) + validate_method_invocation(agent_type, method, input, method_name) } pub fn method_uses_streams( @@ -1327,64 +1329,23 @@ pub fn method_uses_streams( method: &AgentMethodSchema, input: &SchemaValue, ) -> bool { - contains_stream(input) - || method - .input_schema - .fields() - .iter() - .filter(|field| matches!(field.source, FieldSource::UserSupplied)) - .any(|field| contains_stream_in_graph(&agent_type.schema, &field.schema)) - || method - .output_schema - .schema() - .is_some_and(|output| contains_stream_in_graph(&agent_type.schema, output)) + contains_stream(input) || method.uses_streams(&agent_type.schema) } -fn validate_schema_input_against_method_schema( - input: &SchemaValue, +pub fn validate_method_invocation( agent_type: &AgentTypeSchema, - input_schema: &InputSchema, + method: &AgentMethodSchema, + input: &SchemaValue, method_name: &str, -) -> Result<(), WorkerExecutorError> { - let SchemaValue::Record { fields } = input else { - return Err(WorkerExecutorError::invalid_request(format!( - "Method '{method_name}': expected input parameter record" - ))); - }; - - // Auto-injected fields (e.g. the principal) are supplied by the host to the - // guest export separately from the caller-provided input record, so they - // are excluded from both the parameter count and the value validation here. - let user_fields: Vec<_> = input_schema - .fields() - .iter() - .filter(|field| matches!(field.source, FieldSource::UserSupplied)) - .collect(); - if fields.len() != user_fields.len() { - return Err(WorkerExecutorError::invalid_request(format!( - "Method '{method_name}': expected {} parameters, got {}", - user_fields.len(), - fields.len() - ))); - } - - validate_record_fields( - &agent_type.schema, - user_fields - .iter() - .map(|field| (field.name.as_str(), &field.schema)), - fields, - ) - .map_err(|errors| { - WorkerExecutorError::invalid_request(format!( - "Method '{method_name}': invalid input parameter value: {}", - errors - .into_iter() - .map(|error| error.to_string()) - .collect::>() - .join("; ") - )) - }) +) -> Result { + method + .validate_input(&agent_type.schema, input) + .map_err(|error| { + WorkerExecutorError::invalid_request(format!( + "Method '{method_name}': invalid input parameter value: {error}" + )) + })?; + Ok(method_uses_streams(agent_type, method, input)) } /// Resolves the [`AgentTypeSchema`] an invocation targets: by name when an agent id @@ -1564,7 +1525,7 @@ mod tests { panic!("non-record input must be rejected"); }; assert!( - err.to_string().contains("expected input parameter record"), + err.to_string().contains("expected record, found u32"), "unexpected error: {err}" ); } @@ -1582,7 +1543,7 @@ mod tests { panic!("arity mismatch must be rejected"); }; assert!( - err.to_string().contains("expected 2 parameters, got 1"), + err.to_string().contains("has 1 field(s), expected 2"), "unexpected error: {err}" ); } @@ -1628,6 +1589,66 @@ mod tests { } } + #[test] + fn streaming_method_is_classified_while_stream_free_method_is_not() { + let streaming = metadata_with_method(AgentMethodSchema { + name: METHOD_NAME.to_string(), + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(Vec::new()), + output_schema: OutputSchema::Single(Box::new(SchemaType::stream(Some( + SchemaType::u32(), + )))), + http_endpoint: Vec::new(), + read_only: None, + }); + let empty_input = SchemaValue::Record { fields: Vec::new() }; + + assert!( + validate_agent_method_invocation( + &streaming, + Some(&agent_id()), + METHOD_NAME, + &empty_input, + ) + .unwrap() + ); + assert!( + !validate_agent_method_invocation( + &metadata_with_method(AgentMethodSchema { + name: METHOD_NAME.to_string(), + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(Vec::new()), + output_schema: OutputSchema::Unit, + http_endpoint: Vec::new(), + read_only: None, + }), + Some(&agent_id()), + METHOD_NAME, + &empty_input, + ) + .unwrap() + ); + } + + #[test] + fn materializing_boundary_rejects_a_real_stream_handle() { + let stream = golem_common::schema::stream::SchemaValueStream::from_host_endpoint(()); + let output = SchemaValue::Record { + fields: vec![SchemaValue::Stream(stream)], + }; + + let error = reject_stream_at_materializing_boundary(output) + .expect_err("a live stream reaching materialization is a contract violation"); + assert!( + error + .to_string() + .contains("live stream at a materializing invocation boundary"), + "unexpected error: {error}" + ); + } + // --- validate_invoke_output --- fn unit_expected_output() -> ExpectedInvokeOutput { diff --git a/golem-worker-executor/src/worker/invocation_loop.rs b/golem-worker-executor/src/worker/invocation_loop.rs index f5ac2b1471..0c7ae52a17 100644 --- a/golem-worker-executor/src/worker/invocation_loop.rs +++ b/golem-worker-executor/src/worker/invocation_loop.rs @@ -24,8 +24,9 @@ use crate::worker::invocation::{ }; use crate::worker::status_checkpointer; use crate::worker::{ - FinalWorkerState, PendingWorkerInterrupt, QueuedWorkerInvocation, RetryDecision, RunningWorker, - Worker, WorkerCommand, WorkerInterruptState, WorkerTrace, + FinalWorkerState, PendingLiveInvocationDisposition, PendingWorkerInterrupt, + QueuedWorkerInvocation, RetryDecision, RunningWorker, Worker, WorkerCommand, + WorkerInterruptState, WorkerTrace, }; use crate::workerctx::{PublicWorkerIo, UpdateManagement, WorkerCtx}; use anyhow::anyhow; @@ -364,7 +365,12 @@ impl InvocationLoop { async fn stop_unloaded(&self, startup_failure: Option) { self.parent - .stop_internal(true, None, FinalWorkerState::Unloaded { startup_failure }) + .stop_internal( + true, + None, + FinalWorkerState::Unloaded { startup_failure }, + PendingLiveInvocationDisposition::Fail, + ) .await; } @@ -438,6 +444,7 @@ impl InvocationLoop { FinalWorkerState::Unloaded { startup_failure: Some(err), }, + PendingLiveInvocationDisposition::Fail, ) .await; CreateInstanceResult::Failed @@ -489,6 +496,7 @@ impl InvocationLoop { FinalWorkerState::Unloaded { startup_failure: Some(err), }, + PendingLiveInvocationDisposition::Fail, ) .await; Some(RetryDecision::None) // early return, we can't retry this @@ -979,6 +987,7 @@ impl InnerInvocationLoop<'_, Ctx> { FinalWorkerState::Unloaded { startup_failure: Some(err), }, + PendingLiveInvocationDisposition::Fail, ) .await; CommandOutcome::BreakOuterLoop diff --git a/golem-worker-executor/src/worker/mod.rs b/golem-worker-executor/src/worker/mod.rs index 1581644bf2..bd719359c2 100644 --- a/golem-worker-executor/src/worker/mod.rs +++ b/golem-worker-executor/src/worker/mod.rs @@ -896,6 +896,7 @@ impl Worker { FinalWorkerState::Unloaded { startup_failure: None, }, + PendingLiveInvocationDisposition::Fail, ) .await; @@ -930,8 +931,13 @@ impl Worker { self.status_flusher.begin_delete().await; self.status_checkpointer.begin_delete().await; let error = WorkerExecutorError::invalid_request("Worker is being deleted"); - self.stop_internal(false, Some(error), FinalWorkerState::Deleting) - .await; + self.stop_internal( + false, + Some(error), + FinalWorkerState::Deleting, + PendingLiveInvocationDisposition::Fail, + ) + .await; Ok(()) } @@ -1498,7 +1504,16 @@ impl Worker { invocation: AgentInvocation, idempotency_key: IdempotencyKey, ) -> Result { - match self.clone().invoke(invocation).await? { + let result = self.clone().invoke(invocation).await?; + self.await_invocation_result(idempotency_key, result).await + } + + pub(crate) async fn await_invocation_result( + self: Arc, + idempotency_key: IdempotencyKey, + result: ResultOrSubscription, + ) -> Result { + match result { ResultOrSubscription::Finished(Ok(output)) => Ok(output), ResultOrSubscription::Finished(Err(err)) => Err(err), ResultOrSubscription::Pending(subscription) => { @@ -2033,6 +2048,7 @@ impl Worker { FinalWorkerState::Unloaded { startup_failure: None, }, + PendingLiveInvocationDisposition::Fail, ) .await; drop(instance_guard); @@ -2630,7 +2646,17 @@ impl Worker { invocation: AgentInvocation, cancellation: tokio_util::sync::CancellationToken, ) -> Result { - let mut cancel_on_drop = CancelLiveInvocationOnDrop(Some(cancellation.clone())); + self.enqueue_live_streaming(invocation, cancellation) + .await? + .result() + .await + } + + pub async fn enqueue_live_streaming( + self: Arc, + invocation: AgentInvocation, + cancellation: tokio_util::sync::CancellationToken, + ) -> Result { let instance_guard = self.lock_non_stopping_worker().await; if instance_guard.is_deleting() { return Err(WorkerExecutorError::invalid_request( @@ -2648,20 +2674,21 @@ impl Worker { .push_back(QueuedWorkerInvocation::LiveStreamingInvocation { invocation, sender, - cancellation, + cancellation: cancellation.clone(), }); if let WorkerInstance::Running(running) = &*instance_guard { running.sender.send(WorkerCommand::WorkAvailable).unwrap(); } drop(instance_guard); - Worker::start_if_needed(self).await?; - let result = receiver.await.map_err(|_| { - WorkerExecutorError::runtime( - "live streaming invocation ended before publishing a result", - ) - })?; - cancel_on_drop.0 = None; - result + tokio::spawn(async move { + if let Err(error) = Worker::start_if_needed(self).await { + tracing::debug!(%error, "Failed to start worker for live streaming invocation"); + } + }); + Ok(LiveStreamingInvocationHandle { + receiver, + cancellation: Some(cancellation), + }) } /// Appends an oplog entry without forcing a durable commit. Callers that @@ -2994,6 +3021,7 @@ impl Worker { called_from_invocation_loop: bool, fail_pending_invocations: Option, final_state: FinalWorkerState, + pending_live_invocations: PendingLiveInvocationDisposition, ) { let mut instance_guard = self.instance.lock().await; @@ -3003,6 +3031,7 @@ impl Worker { called_from_invocation_loop, fail_pending_invocations, final_state, + pending_live_invocations, ) .await; @@ -3019,6 +3048,7 @@ impl Worker { // Only respected when this is the call that triggered the stop fail_pending_invocations: Option, final_state: FinalWorkerState, + pending_live_invocations: PendingLiveInvocationDisposition, ) -> StopResult { // Temporarily set the instance to unloaded so we can work with the old value. // This is not visible to anyone as long as we are holding the lock. @@ -3035,6 +3065,13 @@ impl Worker { self.fail_pending_invocations(error.clone()).await; } **instance_guard = final_state.into_instance(); + if let WorkerInstance::Unloaded { startup_failure } = &**instance_guard { + self.resolve_pending_queue_on_unload( + startup_failure.as_ref(), + pending_live_invocations, + ) + .await; + } StopResult::Stopped } WorkerInstance::WaitingForPermit(_) => { @@ -3044,8 +3081,11 @@ impl Worker { crate::metrics::workers::dec_worker_waiting_for_memory(); **instance_guard = final_state.into_instance(); if let WorkerInstance::Unloaded { startup_failure } = &**instance_guard { - self.resolve_pending_readiness_awaiters_on_stop(startup_failure.as_ref()) - .await; + self.resolve_pending_queue_on_unload( + startup_failure.as_ref(), + pending_live_invocations, + ) + .await; } StopResult::Stopped } @@ -3059,6 +3099,9 @@ impl Worker { StopResult::Stopped } WorkerInstance::Stopping(mut stopping) => { + if pending_live_invocations == PendingLiveInvocationDisposition::Fail { + stopping.pending_live_invocations = PendingLiveInvocationDisposition::Fail; + } // If we're stopping for deletion, upgrade the final state if matches!(final_state, FinalWorkerState::Deleting) { stopping.final_state = FinalWorkerState::Deleting; @@ -3108,8 +3151,11 @@ impl Worker { self.release_linear_memory_grant(); **instance_guard = final_state.into_instance(); if let WorkerInstance::Unloaded { startup_failure } = &**instance_guard { - self.resolve_pending_readiness_awaiters_on_stop(startup_failure.as_ref()) - .await; + self.resolve_pending_queue_on_unload( + startup_failure.as_ref(), + pending_live_invocations, + ) + .await; } StopResult::Stopped } else { @@ -3122,6 +3168,7 @@ impl Worker { **instance_guard = WorkerInstance::Stopping(StoppingWorker { notify: notify.clone(), final_state, + pending_live_invocations, }); StopResult::NeedsWaitForLoopExit { run_loop_handle, @@ -3163,20 +3210,25 @@ impl Worker { instance_guard = self.instance.lock().await; } - match std::mem::replace( + let pending_live_invocations = match std::mem::replace( &mut *instance_guard, WorkerInstance::Unloaded { startup_failure: None, }, ) { WorkerInstance::Stopping(stopping) => { + let pending_live_invocations = stopping.pending_live_invocations; *instance_guard = stopping.final_state.into_instance(); + pending_live_invocations } other => panic!("expected Stopping, got {other:?}"), - } + }; if let WorkerInstance::Unloaded { startup_failure } = &*instance_guard { - self.resolve_pending_readiness_awaiters_on_stop(startup_failure.as_ref()) - .await; + self.resolve_pending_queue_on_unload( + startup_failure.as_ref(), + pending_live_invocations, + ) + .await; } drop(instance_guard); @@ -3190,6 +3242,19 @@ impl Worker { /// worker suspends itself mid-invocation, as debugging workers do as soon as their replay /// goes live. Waiters observe the startup failure if there is one, otherwise a successful /// stop. All other queued items are kept for the next start. + async fn resolve_pending_queue_on_unload( + &self, + startup_failure: Option<&WorkerExecutorError>, + pending_live_invocations: PendingLiveInvocationDisposition, + ) { + self.resolve_pending_readiness_awaiters_on_stop(startup_failure) + .await; + if pending_live_invocations == PendingLiveInvocationDisposition::Fail { + self.fail_pending_live_streaming_invocations_on_stop(startup_failure) + .await; + } + } + async fn resolve_pending_readiness_awaiters_on_stop( &self, startup_failure: Option<&WorkerExecutorError>, @@ -3209,6 +3274,19 @@ impl Worker { } } + async fn fail_pending_live_streaming_invocations_on_stop( + &self, + startup_failure: Option<&WorkerExecutorError>, + ) { + let error = startup_failure.cloned().unwrap_or_else(|| { + WorkerExecutorError::runtime( + "worker stopped before processing the live streaming invocation", + ) + }); + let mut queue = self.queue.write().await; + fail_live_streaming_queue_entries(&mut queue, &error); + } + async fn fail_pending_invocations(&self, error: WorkerExecutorError) { let queued_items = self.queue.write().await.drain(..).collect::>(); let mut origins = self.external_invocation_origins.write().await; @@ -3290,6 +3368,7 @@ impl Worker { FinalWorkerState::Unloaded { startup_failure: None, }, + PendingLiveInvocationDisposition::Fail, ) .await; let instance_guard = self.instance.lock().await; @@ -3312,6 +3391,7 @@ impl Worker { FinalWorkerState::Unloaded { startup_failure: None, }, + PendingLiveInvocationDisposition::Preserve, ) .await; if let Some(delay) = delay { @@ -4662,10 +4742,17 @@ impl FinalWorkerState { } } +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub(crate) enum PendingLiveInvocationDisposition { + Fail, + Preserve, +} + #[derive(Debug)] struct StoppingWorker { notify: OneShotEvent, final_state: FinalWorkerState, + pending_live_invocations: PendingLiveInvocationDisposition, } #[derive(Debug, Clone)] @@ -5117,6 +5204,57 @@ mod tests { assert!(terminal(InterruptKind::Interrupt(Timestamp::now_utc()))); assert!(terminal(InterruptKind::Suspend(Timestamp::now_utc()))); } + + #[test] + async fn terminal_stop_fails_queued_live_invocations_without_dropping_other_work() { + let (sender, receiver) = oneshot::channel(); + let mut queue = VecDeque::from([ + QueuedWorkerInvocation::LiveStreamingInvocation { + invocation: AgentInvocation::AgentInitialization { + idempotency_key: IdempotencyKey::fresh(), + input: golem_common::schema::SchemaValue::Record { fields: Vec::new() }, + invocation_context: InvocationContextStack::fresh(), + principal: Principal::anonymous(), + }, + sender, + cancellation: tokio_util::sync::CancellationToken::new(), + }, + QueuedWorkerInvocation::SaveSnapshot, + ]); + let error = WorkerExecutorError::runtime("worker generation stopped"); + + fail_live_streaming_queue_entries(&mut queue, &error); + + assert!(matches!( + receiver.await, + Ok(Err(WorkerExecutorError::Runtime { details, .. })) + if details == "worker generation stopped" + )); + assert!(matches!( + queue.pop_front(), + Some(QueuedWorkerInvocation::SaveSnapshot) + )); + assert!(queue.is_empty()); + } + + #[test] + async fn completed_live_result_is_not_overridden_by_later_worker_state() { + let (sender, receiver) = oneshot::channel(); + let cancellation = tokio_util::sync::CancellationToken::new(); + sender + .send(Ok(golem_common::schema::SchemaValue::U64(42))) + .unwrap(); + let handle = LiveStreamingInvocationHandle { + receiver, + cancellation: Some(cancellation.clone()), + }; + + assert_eq!( + handle.result().await.unwrap(), + golem_common::schema::SchemaValue::U64(42) + ); + assert!(!cancellation.is_cancelled()); + } } #[derive(Clone, Debug, Eq, PartialEq, Hash)] @@ -5272,11 +5410,43 @@ pub enum QueuedWorkerInvocation { SaveSnapshot, } -struct CancelLiveInvocationOnDrop(Option); +fn fail_live_streaming_queue_entries( + queue: &mut VecDeque, + error: &WorkerExecutorError, +) { + let items = queue.drain(..).collect::>(); + for item in items { + match item { + QueuedWorkerInvocation::LiveStreamingInvocation { sender, .. } => { + let _ = sender.send(Err(error.clone())); + } + other => queue.push_back(other), + } + } +} + +pub struct LiveStreamingInvocationHandle { + receiver: oneshot::Receiver>, + cancellation: Option, +} + +impl LiveStreamingInvocationHandle { + pub async fn result( + mut self, + ) -> Result { + let result = (&mut self.receiver).await.map_err(|_| { + WorkerExecutorError::runtime( + "live streaming invocation ended before publishing a result", + ) + })?; + self.cancellation = None; + result + } +} -impl Drop for CancelLiveInvocationOnDrop { +impl Drop for LiveStreamingInvocationHandle { fn drop(&mut self) { - if let Some(cancellation) = self.0.take() { + if let Some(cancellation) = self.cancellation.take() { cancellation.cancel(); } } diff --git a/golem-worker-executor/tests/agent.rs b/golem-worker-executor/tests/agent.rs index cc0d484681..d5ec6e849c 100644 --- a/golem-worker-executor/tests/agent.rs +++ b/golem-worker-executor/tests/agent.rs @@ -16,17 +16,22 @@ use crate::Tracing; use golem_api_grpc::proto::golem::worker::InvocationStart; use golem_common::model::agent::AgentMode; +use golem_common::model::component::ComponentRevision; use golem_common::model::oplog::{OplogIndex, PublicOplogEntry}; use golem_common::model::worker::AgentConfigEntryDto; -use golem_common::model::{AgentId, IdempotencyKey, InvocationStatus}; +use golem_common::model::{AgentId, IdempotencyKey}; use golem_common::schema::SchemaValue; use golem_common::{agent_id, data_value}; use golem_test_framework::dsl::TestDsl; +use golem_worker_executor::storage::scheduler::SchedulerStorage; +use golem_worker_executor::storage::scheduler::sqlite::SqliteSchedulerStorage; use golem_worker_executor_test_utils::{ - LastUniqueId, PrecompiledComponent, TestContext, WorkerExecutorTestDependencies, start, + LastUniqueId, PrecompiledComponent, TestContext, WorkerExecutorTestDependencies, + scheduler_sqlite_storage_config, start, }; use pretty_assertions::assert_eq; -use std::collections::{BTreeMap, HashMap}; +use std::collections::{BTreeMap, HashMap, HashSet}; +use std::path::{Path, PathBuf}; use test_r::{inherit_test_dep, test, timeout}; inherit_test_dep!(WorkerExecutorTestDependencies); @@ -35,6 +40,10 @@ inherit_test_dep!( #[tagged_as("agent_rpc")] PrecompiledComponent ); +inherit_test_dep!( + #[tagged_as("agent_rpc_rust")] + PrecompiledComponent +); inherit_test_dep!( #[tagged_as("constructor_parameter_echo_unnamed")] PrecompiledComponent @@ -98,6 +107,202 @@ async fn agent_self_rpc_is_not_allowed( Ok(()) } +#[test] +#[timeout("60s")] +#[tracing::instrument] +async fn streaming_schedule_is_rejected_without_creating_or_queueing_a_worker( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let scheduler = + SqliteSchedulerStorage::configured(&scheduler_sqlite_storage_config(deps, &context)) + .await + .map_err(anyhow::Error::msg)?; + let agent_id = agent_id!("StreamingRpcTarget", "rejected-schedule"); + let worker_id = AgentId::from_agent_id(component.id, &agent_id).map_err(anyhow::Error::msg)?; + let (_, input) = data_value!(vec![1_u32, 2, 3]).into_parts(); + let input: golem_api_grpc::proto::golem::schema::SchemaValue = + input.try_into().map_err(anyhow::Error::msg)?; + let blobs_before = files_below(&deps.blob_storage_root())?; + + for schedule_at in [ + None, + Some(prost_types::Timestamp { + seconds: chrono::Utc::now().timestamp() + 1, + nanos: 0, + }), + ] { + let error = executor + .invoke_agent_session(InvocationStart { + agent_id: Some(worker_id.clone().into()), + method_name: Some("produce".to_string()), + input: Some(input.clone()), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule as i32, + schedule_at, + idempotency_key: Some(IdempotencyKey::fresh().into()), + component_owner_account_id: Some(component.account_id.into()), + environment_id: Some(component.environment_id.into()), + auth_ctx: Some(executor.auth_ctx().into()), + context: None, + principal: None, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + config: Vec::new(), + }) + .await + .expect_err("scheduled streaming invocation must be rejected"); + assert!( + error + .to_string() + .contains("require an attached Await invocation session"), + "unexpected error: {error}" + ); + } + + tokio::time::sleep(std::time::Duration::from_secs(2)).await; + assert_eq!(executor.get_worker_metadata_opt(&worker_id).await?, None); + let assignment = golem_common::model::ShardAssignment { + number_of_shards: 1, + shard_ids: HashSet::from([golem_common::model::ShardId::new(0)]), + }; + assert_eq!( + scheduler + .count_due(chrono::Utc::now() + chrono::Duration::days(1), &assignment) + .await?, + 0, + "rejection must not create an immediate or delayed scheduled action" + ); + assert_eq!( + files_below(&deps.blob_storage_root())?, + blobs_before, + "rejection must not upload an invocation or result payload" + ); + Ok(()) +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn invocation_classification_uses_the_existing_workers_component_revision( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc")] agent_rpc: &PrecompiledComponent, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + + let streaming_component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let streaming_agent_id = agent_id!("StreamingRpcTarget", "pinned-streaming-revision"); + let streaming_worker_id = executor + .start_agent(&streaming_component.id, streaming_agent_id.clone()) + .await?; + executor + .update_component(&streaming_component.id, &agent_rpc.wasm_name) + .await?; + + let (_, input) = data_value!(vec![1_u32, 2, 3]).into_parts(); + let error = executor + .invoke_agent_session(InvocationStart { + agent_id: Some(streaming_worker_id.clone().into()), + method_name: Some("produce".to_string()), + input: Some(input.try_into().map_err(anyhow::Error::msg)?), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule as i32, + schedule_at: None, + idempotency_key: Some(IdempotencyKey::fresh().into()), + component_owner_account_id: Some(streaming_component.account_id.into()), + environment_id: Some(streaming_component.environment_id.into()), + auth_ctx: Some(executor.auth_ctx().into()), + context: None, + principal: None, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + config: Vec::new(), + }) + .await + .expect_err("the old streaming schema must still reject scheduling"); + assert!( + error + .to_string() + .contains("require an attached Await invocation session"), + "unexpected error: {error}" + ); + let streaming_metadata = executor.get_worker_metadata(&streaming_worker_id).await?; + assert_eq!( + streaming_metadata.component_revision, + ComponentRevision::INITIAL + ); + assert_eq!(streaming_metadata.pending_invocation_count, 0); + + let stream_free_component = executor + .component_dep(&context.default_environment_id, agent_rpc) + .store() + .await?; + let stream_free_agent_id = agent_id!("TestAgent", "pinned-stream-free-revision"); + let stream_free_worker_id = executor + .start_agent(&stream_free_component.id, stream_free_agent_id.clone()) + .await?; + executor + .update_component(&stream_free_component.id, &agent_rpc_rust.wasm_name) + .await?; + + let output = executor + .invoke_and_await_agent( + &stream_free_component, + &stream_free_agent_id, + "run", + data_value!(0_f64), + ) + .await?; + assert_eq!( + output.into_return_value(), + Some(SchemaValue::List { + elements: Vec::new() + }) + ); + let stream_free_metadata = executor.get_worker_metadata(&stream_free_worker_id).await?; + assert_eq!( + stream_free_metadata.component_revision, + ComponentRevision::INITIAL + ); + Ok(()) +} + +fn files_below(root: &Path) -> anyhow::Result> { + fn visit(root: &Path, current: &Path, files: &mut HashSet) -> anyhow::Result<()> { + if !current.exists() { + return Ok(()); + } + for entry in std::fs::read_dir(current)? { + let path = entry?.path(); + if path.is_dir() { + visit(root, &path, files)?; + } else { + files.insert(path.strip_prefix(root)?.to_path_buf()); + } + } + Ok(()) + } + + let mut files = HashSet::new(); + visit(root, root, &mut files)?; + Ok(files) +} + #[test] #[tracing::instrument] async fn agent_await_parallel_rpc_calls( @@ -440,7 +645,7 @@ async fn ephemeral_invocation_lookup_does_not_create_unknown_agent( let worker_id = AgentId::from_agent_id(component.id, &final_agent_id).map_err(anyhow::Error::msg)?; - let response = executor + executor .invoke_agent_session(InvocationStart { agent_id: Some(worker_id.clone().into()), method_name: None, @@ -459,13 +664,6 @@ async fn ephemeral_invocation_lookup_does_not_create_unknown_agent( config: Vec::new(), }) .await?; - assert_eq!( - response.status, - Some( - golem_api_grpc::proto::golem::worker::InvocationStatus::from(InvocationStatus::Unknown,) - as i32 - ) - ); assert_eq!(executor.get_worker_metadata_opt(&worker_id).await?, None); Ok(()) diff --git a/golem-worker-executor/tests/rpc.rs b/golem-worker-executor/tests/rpc.rs index e21214a80d..ff47763c93 100644 --- a/golem-worker-executor/tests/rpc.rs +++ b/golem-worker-executor/tests/rpc.rs @@ -13,23 +13,37 @@ // limitations under the License. use crate::Tracing; +use async_trait::async_trait; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; +use golem_api_grpc::proto::golem::schema::{RecordValue, SchemaValueStreamReference, schema_value}; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame, InvocationStart, invocation_frame, invocation_result, - invocation_session_finished, + InvocationFailureKind, InvocationRejectionReason, InvocationRequest, InvocationResponse, + InvocationStart, ResumeAttach, StreamCancel, StreamCancelReason, StreamCancelRole, + invocation_request, invocation_response, invocation_session_completion, + invocation_session_result, }; +use golem_common::model::account::AccountId; use golem_common::model::agent::ParsedAgentId; +use golem_common::model::card::{AgentResourcePattern, AgentVerb}; use golem_common::model::component::ComponentDto; -use golem_common::model::oplog::OplogIndex; -use golem_common::model::{AgentId, AgentStatus, IdempotencyKey, PromiseId}; +use golem_common::model::oplog::{OplogIndex, PublicAgentInvocation, PublicOplogEntry}; +use golem_common::model::{AgentId, AgentStatus, IdempotencyKey, OwnedAgentId, PromiseId}; use golem_common::schema::schema_value::ResultValuePayload; use golem_common::schema::{FromSchema, SchemaValue, TypedSchemaValue}; use golem_common::{agent_id, data_value}; +use golem_service_base::model::auth::AuthCtx; use golem_test_framework::dsl::TestDsl; +use golem_worker_executor::services::direct_invocation_auth::{ + DirectInvocationAuthService, EnvironmentOwnerAccountId, +}; +use golem_worker_executor::services::rpc::RpcError; +use golem_worker_executor::worker::EvictionClass; use golem_worker_executor_test_utils::{ - LastUniqueId, PrecompiledComponent, TestContext, TestWorkerExecutor, - WorkerExecutorTestDependencies, start, + LastUniqueId, PrecompiledComponent, TestContext, TestExecutorOverrides, TestWorkerExecutor, + WorkerExecutorTestDependencies, start, start_with_overrides, }; use pretty_assertions::assert_eq; +use std::sync::Arc; use std::time::Duration; use test_r::{inherit_test_dep, test, timeout}; use tokio::sync::mpsc; @@ -50,8 +64,589 @@ inherit_test_dep!( #[tagged_as("agent_counters")] PrecompiledComponent ); +inherit_test_dep!( + #[tagged_as("large_dynamic_memory")] + PrecompiledComponent +); inherit_test_dep!(Tracing); +struct DenyDirectInvocationAuth; + +#[async_trait] +impl DirectInvocationAuthService for DenyDirectInvocationAuth { + async fn check( + &self, + _caller_account_id: AccountId, + _owned_agent_id: &OwnedAgentId, + _verb: AgentVerb, + _resource: AgentResourcePattern, + _auth_ctx: &AuthCtx, + ) -> Result { + Err(RpcError::Denied { + details: "direct invocation denied before schema lookup".to_string(), + }) + } +} + +#[test] +#[timeout("60s")] +#[tracing::instrument] +async fn resume_attach_is_terminally_rejected_without_finish( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let idempotency_key = Some(IdempotencyKey::fresh().into()); + let (requests, receiver) = mpsc::channel(1); + requests + .send(InvocationRequest { + request: Some(invocation_request::Request::ResumeAttach(ResumeAttach { + idempotency_key: idempotency_key.clone(), + })), + }) + .await?; + + let mut responses = executor + .client + .clone() + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + let response = responses + .message() + .await? + .ok_or_else(|| anyhow::anyhow!("resume-attach returned no rejection"))?; + assert!(matches!( + response.response, + Some(invocation_response::Response::Rejected(rejected)) + if rejected.reason == InvocationRejectionReason::ResumeUnsupported as i32 + && rejected.idempotency_key == idempotency_key + )); + assert!(responses.message().await?.is_none()); + Ok(()) +} + +#[test] +#[timeout("60s")] +#[tracing::instrument] +async fn invalid_start_is_rejected_before_acceptance( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let (requests, receiver) = mpsc::channel(1); + requests + .send(InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { + agent_id: Some(golem_api_grpc::proto::golem::worker::AgentId { + component_id: None, + name: "agent".to_string(), + }), + method_name: Some("run".to_string()), + input: Some(golem_api_grpc::proto::golem::schema::SchemaValue { + value: Some( + golem_api_grpc::proto::golem::schema::schema_value::Value::U8Value(1), + ), + }), + idempotency_key: Some(IdempotencyKey::fresh().into()), + auth_ctx: None, + ..Default::default() + })), + }) + .await?; + + let mut responses = executor + .client + .clone() + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + let response = responses + .message() + .await? + .ok_or_else(|| anyhow::anyhow!("invalid invocation start returned no rejection"))?; + + match response.response { + Some(invocation_response::Response::Rejected(_)) => {} + other => { + panic!("invalid invocation start must be rejected before acceptance, got {other:?}") + } + } + assert!(responses.message().await?.is_none()); + Ok(()) +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn output_consumer_cancel_after_result_remains_a_valid_terminal_session( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let agent_id = agent_id!("StreamingRpcTarget", "cancel-sibling-output"); + let worker_agent_id = AgentId::from_agent_id(component.id, &agent_id) + .map_err(|error| anyhow::anyhow!("invalid agent id: {error}"))?; + let (_, input) = data_value!().into_parts(); + let key = Some(IdempotencyKey::fresh().into()); + let start = InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { + agent_id: Some(worker_agent_id.into()), + method_name: Some("produce_siblings".to_string()), + input: Some(input.try_into().map_err(anyhow::Error::msg)?), + idempotency_key: key, + auth_ctx: Some(executor.auth_ctx().into()), + environment_id: Some(component.environment_id.into()), + component_owner_account_id: Some(component.account_id.into()), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + ..Default::default() + })), + }; + let mut state = InvocationSessionState::default(); + state + .validate_trusted_request(&start) + .map_err(anyhow::Error::msg)?; + let (requests, receiver) = mpsc::channel(8); + requests.send(start).await?; + let mut responses = executor + .client + .clone() + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + let mut cancellation_sent = false; + + while let Some(response) = responses.message().await? { + state + .validate_response(&response) + .map_err(anyhow::Error::msg)?; + match response.response { + Some(invocation_response::Response::Result(result)) => { + let value = match result.result { + Some(invocation_session_result::Result::MethodResult(value)) => value, + other => anyhow::bail!("expected a method result, got {other:?}"), + }; + let stream_id = match value.value { + Some(schema_value::Value::TupleValue(tuple)) => match tuple.elements.first() { + Some(golem_api_grpc::proto::golem::schema::SchemaValue { + value: Some(schema_value::Value::StreamReference(reference)), + }) => reference.stream_id, + other => anyhow::bail!("expected first sibling stream, got {other:?}"), + }, + other => anyhow::bail!("expected sibling tuple result, got {other:?}"), + }; + let cancel = InvocationRequest { + request: Some(invocation_request::Request::StreamCancel(StreamCancel { + stream_id, + offset: 0, + role: StreamCancelRole::OutputConsumer as i32, + reason: StreamCancelReason::Cancelled as i32, + details: Some("consumer stopped reading".to_string()), + })), + }; + state + .validate_trusted_request(&cancel) + .map_err(anyhow::Error::msg)?; + requests.send(cancel).await?; + cancellation_sent = true; + } + Some(invocation_response::Response::Finished(finished)) => { + assert!(cancellation_sent, "session finished before cancellation"); + if let Some(invocation_session_completion::Outcome::Failure(failure)) = + finished.outcome + { + assert_ne!( + failure.kind, + InvocationFailureKind::Protocol as i32, + "a validator-approved output-consumer cancellation is not a protocol error: {}", + failure.message + ); + } + assert!(state.is_complete()); + assert!(responses.message().await?.is_none()); + return Ok(()); + } + Some(invocation_response::Response::Rejected(rejected)) => { + anyhow::bail!("invocation rejected: {}", rejected.error) + } + _ => {} + } + } + + anyhow::bail!("invocation response closed without InvocationFinished") +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn malformed_request_after_streaming_result_terminalizes_open_streams( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let agent_id = agent_id!("StreamingRpcTarget", "malformed-after-result"); + let worker_agent_id = AgentId::from_agent_id(component.id, &agent_id) + .map_err(|error| anyhow::anyhow!("invalid agent id: {error}"))?; + let input = golem_api_grpc::proto::golem::schema::SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![golem_api_grpc::proto::golem::schema::SchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: 1 }, + )), + }], + })), + }; + let start = InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { + agent_id: Some(worker_agent_id.clone().into()), + method_name: Some("transform".to_string()), + input: Some(input), + idempotency_key: Some(IdempotencyKey::fresh().into()), + auth_ctx: Some(executor.auth_ctx().into()), + environment_id: Some(component.environment_id.into()), + component_owner_account_id: Some(component.account_id.into()), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + ..Default::default() + })), + }; + let mut state = InvocationSessionState::default(); + state + .validate_trusted_request(&start) + .map_err(anyhow::Error::msg)?; + let (requests, receiver) = mpsc::channel(8); + requests.send(start.clone()).await?; + let mut responses = executor + .client + .clone() + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + let mut expected_stream_ids = Vec::new(); + let mut terminal_stream_ids = Vec::new(); + let mut accepted = false; + let mut result_received = false; + + while let Some(response) = responses.message().await? { + state + .validate_response(&response) + .map_err(anyhow::Error::msg)?; + match response.response { + Some(invocation_response::Response::Accepted(_)) => { + assert!(!accepted, "invocation was accepted more than once"); + accepted = true; + } + Some(invocation_response::Response::Result(result)) => { + assert!(accepted, "streaming result preceded volatile acceptance"); + result_received = true; + let value = match result.result { + Some(invocation_session_result::Result::MethodResult(value)) => value, + other => anyhow::bail!("expected a method result, got {other:?}"), + }; + expected_stream_ids = match value.value { + Some(schema_value::Value::StreamReference(reference)) => { + vec![reference.stream_id] + } + other => anyhow::bail!("expected transform stream, got {other:?}"), + }; + requests.send(start.clone()).await?; + } + Some(invocation_response::Response::OutputEnd(end)) => { + terminal_stream_ids.push(end.stream_id); + } + Some(invocation_response::Response::OutputError(error)) => { + terminal_stream_ids.push(error.stream_id); + } + Some(invocation_response::Response::Finished(finished)) => { + assert!(accepted, "post-enqueue failure preceded acceptance"); + assert!( + result_received, + "protocol failure preceded the streaming result" + ); + let failure = match finished.outcome { + Some(invocation_session_completion::Outcome::Failure(failure)) => failure, + other => anyhow::bail!("expected protocol failure, got {other:?}"), + }; + assert_eq!(failure.kind, InvocationFailureKind::Protocol as i32); + expected_stream_ids.sort_unstable(); + terminal_stream_ids.sort_unstable(); + assert_eq!(terminal_stream_ids, expected_stream_ids); + assert!(state.is_complete()); + assert!(responses.message().await?.is_none()); + let oplog = executor + .get_oplog(&worker_agent_id, OplogIndex::INITIAL) + .await?; + assert!( + !oplog.iter().any(|entry| matches!( + &entry.entry, + PublicOplogEntry::AgentInvocationStarted(started) + if matches!( + &started.invocation, + PublicAgentInvocation::AgentMethodInvocation(method) + if method.method_name == "transform" + ) + )), + "volatile streaming invocation leaked into the oplog" + ); + return Ok(()); + } + Some(invocation_response::Response::Rejected(rejected)) => { + anyhow::bail!("invocation rejected: {}", rejected.error) + } + _ => {} + } + } + + anyhow::bail!("invocation response closed without InvocationFinished") +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn disconnect_immediately_after_acceptance_cancels_volatile_invocation( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let agent_id = agent_id!("StreamingRpcTarget", "disconnect-after-acceptance"); + let worker_agent_id = executor + .start_agent(&component.id, agent_id.clone()) + .await?; + let input = golem_api_grpc::proto::golem::schema::SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![golem_api_grpc::proto::golem::schema::SchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: 1 }, + )), + }], + })), + }; + let start = InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { + agent_id: Some(worker_agent_id.clone().into()), + method_name: Some("transform".to_string()), + input: Some(input), + idempotency_key: Some(IdempotencyKey::fresh().into()), + auth_ctx: Some(executor.auth_ctx().into()), + environment_id: Some(component.environment_id.into()), + component_owner_account_id: Some(component.account_id.into()), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + ..Default::default() + })), + }; + let (requests, receiver) = mpsc::channel(8); + requests.send(start).await?; + let mut responses = executor + .client + .clone() + .invoke_agent_session(ReceiverStream::new(receiver)) + .await? + .into_inner(); + let first = responses + .message() + .await? + .ok_or_else(|| anyhow::anyhow!("streaming invocation ended before acceptance"))?; + assert!(matches!( + first.response, + Some(invocation_response::Response::Accepted(_)) + )); + + drop(requests); + drop(responses); + + let ping = tokio::time::timeout( + Duration::from_secs(30), + invoke_agent_session(&executor, &component, &agent_id, "ping", data_value!()), + ) + .await + .map_err(|_| anyhow::anyhow!("cancelled live invocation blocked the next invocation"))?? + .map_err(anyhow::Error::msg)?; + assert_eq!(ping, SchemaValue::U64(42)); + + let oplog = executor + .get_oplog(&worker_agent_id, OplogIndex::INITIAL) + .await?; + assert!( + !oplog.iter().any(|entry| matches!( + &entry.entry, + PublicOplogEntry::AgentInvocationStarted(started) + if matches!( + &started.invocation, + PublicAgentInvocation::AgentMethodInvocation(method) + if method.method_name == "transform" + ) + )), + "disconnected live invocation leaked into the oplog" + ); + Ok(()) +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn reacquire_permits_restart_preserves_accepted_queued_live_invocation( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("large_dynamic_memory")] large_dynamic_memory: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + const EXECUTOR_MEMORY_BYTES: u64 = 32 * 1024 * 1024; + const GROWTH_MIB: u64 = 30; + const QUEUE_GATE_MILLIS: u64 = 5_000; + + let context = TestContext::new(last_unique_id); + let executor = start_with_overrides( + deps, + &context, + TestExecutorOverrides { + configure: Some(Arc::new(|config| { + config.memory.system_memory_override = Some(EXECUTOR_MEMORY_BYTES); + config.memory.worker_memory_ratio = 1.0; + config.memory.component_size_coefficient = 0.0; + })), + ..Default::default() + }, + ) + .await?; + let component = executor + .component_dep(&context.default_environment_id, large_dynamic_memory) + .store() + .await?; + + let victim_agent = agent_id!("LargeDynamicMemoryAgent", "live-queue-reacquire-victim"); + let victim_worker = executor + .start_agent(&component.id, victim_agent.clone()) + .await?; + let victim_owned = OwnedAgentId::new(context.default_environment_id, &victim_worker); + tokio::time::timeout(Duration::from_secs(10), async { + while executor.worker_eviction_class(&victim_owned).await != Some(EvictionClass::LoadedIdle) + { + tokio::task::yield_now().await; + } + }) + .await + .expect("the co-resident worker must become idle and evictable"); + + let target_agent = agent_id!("LargeDynamicMemoryAgent", "live-queue-reacquire-target"); + let target_worker = executor + .start_agent(&component.id, target_agent.clone()) + .await?; + let target_owned = OwnedAgentId::new(context.default_environment_id, &target_worker); + let victim_bytes = executor.worker_memory_requirement(&victim_owned).await?; + let target_bytes = executor.worker_memory_requirement(&target_owned).await?; + let growth_bytes = GROWTH_MIB * 1024 * 1024; + assert!(victim_bytes + target_bytes <= EXECUTOR_MEMORY_BYTES); + assert!(target_bytes + growth_bytes <= EXECUTOR_MEMORY_BYTES); + assert!(victim_bytes + target_bytes + growth_bytes > EXECUTOR_MEMORY_BYTES); + + let blocker_executor = executor.clone(); + let blocker_component = component.clone(); + let blocker_agent = target_agent.clone(); + let blocker = tokio::spawn(async move { + blocker_executor + .invoke_and_await_agent( + &blocker_component, + &blocker_agent, + "run_with_memory_and_work", + data_value!(0u64, QUEUE_GATE_MILLIS), + ) + .await + }); + executor + .wait_for_status( + &target_worker, + AgentStatus::Running, + Duration::from_secs(10), + ) + .await?; + + executor + .invoke_agent( + &component, + &target_agent, + "run_with_memory_and_work", + data_value!(GROWTH_MIB, 0u64), + ) + .await?; + + let (mut state, _frames, mut inbound) = open_invocation_session( + &executor, + &component, + &target_agent, + "run_with_memory_and_work", + data_value!(0u64, 0u64), + ) + .await?; + let accepted = tokio::time::timeout(Duration::from_secs(3), inbound.message()) + .await + .map_err(|_| anyhow::anyhow!("live invocation was not accepted while durable work ran"))?? + .ok_or_else(|| anyhow::anyhow!("live invocation ended before acceptance"))?; + state + .validate_response(&accepted) + .map_err(anyhow::Error::msg)?; + assert!(matches!( + accepted.response, + Some(invocation_response::Response::Accepted(_)) + )); + assert!( + !blocker.is_finished(), + "the queue gate ended before the live invocation was accepted" + ); + + let blocker_result = blocker.await??; + assert_eq!(blocker_result.into_typed::()?, 0); + + let live_result = tokio::time::timeout( + Duration::from_secs(60), + receive_invocation_session(&mut state, &mut inbound), + ) + .await + .map_err(|_| { + anyhow::anyhow!("accepted live invocation was stranded by permit reacquisition restart") + })?? + .map_err(anyhow::Error::msg)?; + assert_eq!(live_result, SchemaValue::U64(0)); + assert!( + !executor.worker_is_loaded(&victim_owned).await, + "the durable growth must force permit reacquisition and evict the idle worker" + ); + + Ok(()) +} + async fn invoke_agent_session( executor: &TestWorkerExecutor, component: &ComponentDto, @@ -59,75 +654,108 @@ async fn invoke_agent_session( method_name: &str, params: TypedSchemaValue, ) -> anyhow::Result> { + let (mut state, _frames, mut inbound) = + open_invocation_session(executor, component, agent_id, method_name, params).await?; + receive_invocation_session(&mut state, &mut inbound).await +} + +async fn open_invocation_session( + executor: &TestWorkerExecutor, + component: &ComponentDto, + agent_id: &ParsedAgentId, + method_name: &str, + params: TypedSchemaValue, +) -> anyhow::Result<( + InvocationSessionState, + mpsc::Sender, + tonic::Streaming, +)> { let worker_agent_id = AgentId::from_agent_id(component.id, agent_id) .map_err(|error| anyhow::anyhow!("invalid agent id: {error}"))?; let (_, input) = params.into_parts(); let input = input.try_into().map_err(anyhow::Error::msg)?; let (frames, receiver) = mpsc::channel(8); - frames - .send(InvocationFrame { - frame: Some(invocation_frame::Frame::Start(InvocationStart { - agent_id: Some(worker_agent_id.into()), - method_name: Some(method_name.to_string()), - input: Some(input), - idempotency_key: Some(IdempotencyKey::fresh().into()), - context: None, - auth_ctx: Some(executor.auth_ctx().into()), - principal: None, - environment_id: Some(component.environment_id.into()), - config: Vec::new(), - component_owner_account_id: Some(component.account_id.into()), - mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, - schedule_at: None, - freshness_disposition: - golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist - as i32, - })), - }) - .await?; - let mut inbound = executor + let request = InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { + agent_id: Some(worker_agent_id.into()), + method_name: Some(method_name.to_string()), + input: Some(input), + idempotency_key: Some(IdempotencyKey::fresh().into()), + context: None, + auth_ctx: Some(executor.auth_ctx().into()), + principal: None, + environment_id: Some(component.environment_id.into()), + config: Vec::new(), + component_owner_account_id: Some(component.account_id.into()), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + schedule_at: None, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + })), + }; + let mut state = InvocationSessionState::default(); + state + .validate_trusted_request(&request) + .map_err(anyhow::Error::msg)?; + frames.send(request).await?; + let inbound = executor .client .clone() .invoke_agent_session(ReceiverStream::new(receiver)) .await? .into_inner(); + Ok((state, frames, inbound)) +} + +async fn receive_invocation_session( + state: &mut InvocationSessionState, + inbound: &mut tonic::Streaming, +) -> anyhow::Result> { let mut result = None; - while let Some(frame) = inbound.message().await? { - match frame.frame { - Some(invocation_frame::Frame::Result(value)) => { + let mut terminal = None; + while let Some(response) = inbound.message().await? { + state + .validate_response(&response) + .map_err(anyhow::Error::msg)?; + match response.response { + Some(invocation_response::Response::Accepted(_)) => {} + Some(invocation_response::Response::Rejected(rejected)) => { + terminal = Some(Err(rejected.error)); + } + Some(invocation_response::Response::Result(value)) => { if result.is_some() { anyhow::bail!("invocation session returned more than one result"); } result = match value.result { - Some(invocation_result::Result::MethodResult(value)) => { + Some(invocation_session_result::Result::MethodResult(value)) => { Some(value.try_into().map_err(anyhow::Error::msg)?) } - Some(invocation_result::Result::NoResult(_)) | None => { + Some(invocation_session_result::Result::NoResult(_)) | None => { anyhow::bail!("invocation session returned no method result") } }; } - Some(invocation_frame::Frame::Finished(finished)) => match finished.outcome { - Some(invocation_session_finished::Outcome::Success(_)) => { - return result.map(Ok).ok_or_else(|| { - anyhow::anyhow!("invocation session ended without a result") - }); - } - Some(invocation_session_finished::Outcome::Failure(failure)) => { - return Ok(Err(format!("{failure:?}"))); - } - Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { - return Ok(Err(failure.details)); - } - None => anyhow::bail!("invocation session completion has no outcome"), - }, + Some(invocation_response::Response::Finished(finished)) => { + terminal = Some(match finished.outcome { + Some(invocation_session_completion::Outcome::Success(_)) => { + result.take().map(Ok).ok_or_else(|| { + anyhow::anyhow!("invocation session ended without a result") + })? + } + Some(invocation_session_completion::Outcome::Failure(failure)) => { + Err(failure.message) + } + None => anyhow::bail!("invocation session completion has no outcome"), + }); + } Some(other) => { anyhow::bail!("unexpected outer invocation session frame: {other:?}") } None => anyhow::bail!("empty outer invocation session frame"), } } - anyhow::bail!("invocation session response ended before completion") + terminal.ok_or_else(|| anyhow::anyhow!("invocation session response ended before completion")) } #[test] @@ -261,14 +889,18 @@ async fn generated_rust_client_streaming_rpc_e2e( .await? .expect_err("producer stream error must fail the invocation session"); assert!( - producer_error.contains("value-node index out of range: 0"), + producer_error.contains("Component trapped"), "unexpected producer error: {producer_error}" ); + let stream_free_caller_id = agent_id!("StreamingRpcCaller", "stream_free_after_stream_error"); + executor + .start_agent(&component.id, stream_free_caller_id.clone()) + .await?; let first = executor .invoke_and_await_agent( &component, - &caller_agent_id, + &stream_free_caller_id, "call_stream_free", data_value!(), ) @@ -277,7 +909,7 @@ async fn generated_rust_client_streaming_rpc_e2e( let second = executor .invoke_and_await_agent( &component, - &caller_agent_id, + &stream_free_caller_id, "call_stream_free", data_value!(), ) @@ -288,6 +920,190 @@ async fn generated_rust_client_streaming_rpc_e2e( Ok(()) } +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn output_drop_cancels_target_blocked_on_stream_input( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let caller_agent_id = agent_id!("StreamingRpcCaller", "blocked-stream-input-cancellation"); + executor + .start_agent(&component.id, caller_agent_id.clone()) + .await?; + + let result = invoke_agent_session( + &executor, + &component, + &caller_agent_id, + "cancel_transform_blocked_on_input", + data_value!(), + ) + .await? + .map_err(anyhow::Error::msg)?; + assert_eq!( + result, + SchemaValue::U64(42), + "dropping output must cancel a target invocation blocked on its input before ping can run" + ); + Ok(()) +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn durable_agent_live_await_streaming_is_allowed( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + let component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let caller_agent_id = agent_id!("StreamingRpcCaller", "durable-live-await"); + + let result = invoke_agent_session( + &executor, + &component, + &caller_agent_id, + "run", + data_value!(), + ) + .await? + .map_err(anyhow::Error::msg)?; + + let SchemaValue::Record { fields } = result else { + panic!("expected streaming RPC report record"); + }; + assert_eq!(fields.len(), 10); + assert_eq!(fields[9], SchemaValue::U64(42)); + Ok(()) +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn direct_rpc_classification_uses_the_existing_target_revision( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc")] agent_rpc: &PrecompiledComponent, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start(deps, &context).await?; + + let ts_component = executor + .component_dep(&context.default_environment_id, agent_rpc) + .store() + .await?; + let ts_caller_id = agent_id!("TestAgent", "pinned-ts-rpc-caller"); + let ts_target_id = agent_id!("ChildAgent", 0_f64); + executor + .start_agent(&ts_component.id, ts_caller_id.clone()) + .await?; + executor.start_agent(&ts_component.id, ts_target_id).await?; + executor + .update_component(&ts_component.id, &agent_rpc_rust.wasm_name) + .await?; + + let ts_result = executor + .invoke_and_await_agent(&ts_component, &ts_caller_id, "run", data_value!(1_f64)) + .await?; + assert_eq!( + ts_result.into_return_value(), + Some(SchemaValue::List { + elements: vec![SchemaValue::F64(0.0)] + }) + ); + + let rust_component = executor + .component_dep(&context.default_environment_id, agent_rpc_rust) + .store() + .await?; + let rust_name = "pinned-rust-rpc-target"; + let rust_caller_id = agent_id!("StreamingRpcCaller", rust_name); + let rust_target_id = agent_id!("StreamingRpcTarget", rust_name); + executor + .start_agent(&rust_component.id, rust_caller_id.clone()) + .await?; + executor + .start_agent(&rust_component.id, rust_target_id) + .await?; + executor + .update_component(&rust_component.id, &agent_rpc.wasm_name) + .await?; + + let rust_result = executor + .invoke_and_await_agent( + &rust_component, + &rust_caller_id, + "call_stream_free", + data_value!(), + ) + .await? + .into_typed::()?; + assert_eq!(rust_result, 1); + Ok(()) +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn direct_rpc_authorizes_before_execution_revision_lookup( + last_unique_id: &LastUniqueId, + deps: &WorkerExecutorTestDependencies, + #[tagged_as("agent_rpc")] agent_rpc: &PrecompiledComponent, + #[tagged_as("agent_rpc_rust")] agent_rpc_rust: &PrecompiledComponent, + _tracing: &Tracing, +) -> anyhow::Result<()> { + let context = TestContext::new(last_unique_id); + let executor = start_with_overrides( + deps, + &context, + TestExecutorOverrides { + create_direct_invocation_auth: Some(Arc::new(|| Arc::new(DenyDirectInvocationAuth))), + ..Default::default() + }, + ) + .await?; + let component = executor + .component_dep(&context.default_environment_id, agent_rpc) + .store() + .await?; + let caller_id = agent_id!("TestAgent", "denied-rpc-caller"); + executor + .start_agent(&component.id, caller_id.clone()) + .await?; + executor + .update_component(&component.id, &agent_rpc_rust.wasm_name) + .await?; + + let error = executor + .invoke_and_await_agent(&component, &caller_id, "run", data_value!(1_f64)) + .await + .expect_err("direct RPC must be denied"); + assert!( + error + .to_string() + .contains("direct invocation denied before schema lookup"), + "unexpected error: {error}" + ); + Ok(()) +} + #[test] #[tracing::instrument] async fn rust_rpc_with_payload( diff --git a/golem-worker-service/src/api/agents.rs b/golem-worker-service/src/api/agents.rs index 5ba653c76b..e76a974f57 100644 --- a/golem-worker-service/src/api/agents.rs +++ b/golem-worker-service/src/api/agents.rs @@ -1,7 +1,16 @@ use crate::api::common::ApiEndpointError; -use crate::service::auth::AuthService; -use crate::service::worker::WorkerService; +use crate::service::auth::{AuthService, AuthServiceError}; +use crate::service::worker::{ + WorkerService, WorkerServiceError, validate_public_session_schema_value, +}; use chrono::{DateTime, Utc}; +use futures::{SinkExt, StreamExt}; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; +use golem_api_grpc::proto::golem::worker::{ + InvocationRejected, InvocationRejectionReason, InvocationRequest, InvocationResponse, + PublicInvocationRequest, PublicInvocationStart, input_stream_item, invocation_request, + invocation_response, public_invocation_request, +}; use golem_common::base_model::api; use golem_common::model::agent::AgentTypeName; use golem_common::model::application::ApplicationName; @@ -9,13 +18,18 @@ use golem_common::model::component::ComponentRevision; use golem_common::model::environment::EnvironmentName; use golem_common::model::worker::AgentConfigEntryDto; use golem_common::model::{AgentId, IdempotencyKey}; -use golem_common::recorded_http_api_request; use golem_common::schema::{SchemaValue, TypedSchemaValue}; +use golem_common::{SafeDisplay, recorded_http_api_request}; use golem_service_base::api_tags::ApiTags; -use golem_service_base::model::auth::GolemSecurityScheme; +use golem_service_base::clients::registry::RegistryServiceError; +use golem_service_base::model::auth::{AuthCtx, GolemSecurityScheme}; +use poem::web::websocket::{ + BoxWebSocketUpgraded, CloseCode, Message, WebSocket, WebSocketConfig, WebSocketStream, +}; use poem_openapi::param::Header; use poem_openapi::payload::Json; use poem_openapi_derive::{Enum, Object, OpenApi}; +use prost::Message as ProstMessage; use serde::{Deserialize, Serialize}; use std::sync::Arc; use tracing::Instrument; @@ -23,6 +37,13 @@ use uuid::Uuid; type Result = std::result::Result; +const INVOCATION_SESSION_CHANNEL_CAPACITY: usize = 16; +const INVOCATION_SESSION_MAX_MESSAGE_SIZE: usize = 32 * 1024 * 1024; +const INVOCATION_SESSION_STAGING_ADMISSION_TIMEOUT: std::time::Duration = + std::time::Duration::from_secs(30); +const INVOCATION_SESSION_WRITE_PROGRESS_TIMEOUT: std::time::Duration = + std::time::Duration::from_secs(30); + pub struct AgentsApi { worker_service: Arc, auth_service: Arc, @@ -80,6 +101,31 @@ impl AgentsApi { record.result(response).map(Json) } + /// Invoke an agent through an attached live streaming session + #[oai( + path = "/invoke-agent-session", + method = "get", + operation_id = "invoke_agent_session" + )] + async fn invoke_agent_session( + &self, + websocket: WebSocket, + token: GolemSecurityScheme, + ) -> Result { + let auth = self.auth_service.authenticate_token(token.secret()).await?; + let worker_service = self.worker_service.clone(); + + Ok(websocket + .config(invocation_session_websocket_config()) + .on_upgrade(Box::new(move |socket| { + Box::pin(proxy_public_invocation_session( + socket, + worker_service, + auth, + )) + }))) + } + #[oai(path = "/create-agent", method = "post", operation_id = "create_agent")] async fn create_agent( &self, @@ -106,6 +152,565 @@ impl AgentsApi { } } +fn invocation_session_websocket_config() -> WebSocketConfig { + WebSocketConfig::default() + .max_message_size(Some(INVOCATION_SESSION_MAX_MESSAGE_SIZE)) + .max_frame_size(Some(INVOCATION_SESSION_MAX_MESSAGE_SIZE)) + .max_write_buffer_size(2 * INVOCATION_SESSION_MAX_MESSAGE_SIZE) +} + +#[derive(Debug)] +enum PublicSessionMessage { + Request(PublicInvocationRequest), + Ping(Vec), + Pong, + Close, +} + +enum InitialPublicInvocation { + Start( + PublicInvocationStart, + Option, + ), + Closed, + WriterStopped, +} + +#[derive(Debug)] +struct PublicSessionFrameError { + close_code: CloseCode, + reason: String, +} + +fn decode_public_session_message( + message: Message, +) -> std::result::Result { + match message { + Message::Binary(bytes) => PublicInvocationRequest::decode(bytes.as_slice()) + .map(PublicSessionMessage::Request) + .map_err(|error| PublicSessionFrameError { + close_code: CloseCode::Protocol, + reason: format!("malformed invocation request: {error}"), + }), + Message::Text(_) => Err(PublicSessionFrameError { + close_code: CloseCode::Unsupported, + reason: "invocation sessions accept binary protobuf messages only".to_string(), + }), + Message::Ping(payload) => Ok(PublicSessionMessage::Ping(payload)), + Message::Pong(_) => Ok(PublicSessionMessage::Pong), + Message::Close(_) => Ok(PublicSessionMessage::Close), + } +} + +async fn proxy_public_invocation_session( + socket: WebSocketStream, + worker_service: Arc, + auth: AuthCtx, +) { + let (websocket_sink, mut websocket_stream) = socket.split(); + let (websocket_sender, websocket_receiver) = + tokio::sync::mpsc::channel(INVOCATION_SESSION_CHANNEL_CAPACITY); + let mut writer = tokio::spawn(forward_websocket_messages( + websocket_sink, + websocket_receiver, + INVOCATION_SESSION_WRITE_PROGRESS_TIMEOUT, + )); + let mut state = InvocationSessionState::default(); + + let (start, idempotency_key) = match receive_public_invocation_start_while_writing( + &mut websocket_stream, + &websocket_sender, + &mut state, + &mut writer, + ) + .await + { + InitialPublicInvocation::Start(start, idempotency_key) => (start, idempotency_key), + InitialPublicInvocation::Closed => { + drop(websocket_sender); + let _ = writer.await; + return; + } + InitialPublicInvocation::WriterStopped => return, + }; + + let (request_sender, request_receiver) = + tokio::sync::mpsc::channel(INVOCATION_SESSION_CHANNEL_CAPACITY); + let tail = tokio_stream::wrappers::ReceiverStream::new(request_receiver); + let responses = match worker_service + .invoke_public_agent_session(start, Box::pin(tail), auth) + .await + { + Ok(responses) => responses, + Err(error) => { + let response = rejection_response( + rejection_reason(&error), + error.to_safe_string(), + idempotency_key, + ); + if state.validate_response(&response).is_ok() + && queue_invocation_response(&websocket_sender, response).await + { + queue_websocket_close(&websocket_sender, CloseCode::Normal, "session rejected") + .await; + } + drop(websocket_sender); + let _ = writer.await; + return; + } + }; + + let state = Arc::new(tokio::sync::Mutex::new(state)); + let requests = tokio::spawn(forward_public_requests( + websocket_stream, + request_sender, + websocket_sender.clone(), + state.clone(), + )); + let responses = tokio::spawn(forward_internal_responses( + responses, + websocket_sender.clone(), + state, + )); + drop(websocket_sender); + + supervise_public_invocation_session(requests, responses, writer).await; +} + +async fn receive_public_invocation_start_while_writing( + websocket_stream: &mut S, + websocket_sender: &tokio::sync::mpsc::Sender, + state: &mut InvocationSessionState, + writer: &mut tokio::task::JoinHandle<()>, +) -> InitialPublicInvocation +where + S: futures::Stream> + Unpin, +{ + let receive = receive_public_invocation_start(websocket_stream, websocket_sender, state); + tokio::pin!(receive); + tokio::select! { + result = &mut receive => match result { + Some((start, idempotency_key)) => { + InitialPublicInvocation::Start(start, idempotency_key) + } + None => InitialPublicInvocation::Closed, + }, + _ = writer => InitialPublicInvocation::WriterStopped, + } +} + +async fn receive_public_invocation_start( + websocket_stream: &mut S, + websocket_sender: &tokio::sync::mpsc::Sender, + state: &mut InvocationSessionState, +) -> Option<( + PublicInvocationStart, + Option, +)> +where + S: futures::Stream> + Unpin, +{ + let first_request = loop { + match websocket_stream.next().await { + Some(Ok(message)) => match decode_public_session_message(message) { + Ok(PublicSessionMessage::Request(request)) => break request, + Ok(PublicSessionMessage::Ping(payload)) => { + if matches!( + websocket_sender.try_send(Message::pong(payload)), + Err(tokio::sync::mpsc::error::TrySendError::Closed(_)) + ) { + return None; + } + } + Ok(PublicSessionMessage::Pong) => {} + Ok(PublicSessionMessage::Close) => return None, + Err(error) => { + queue_websocket_close(websocket_sender, error.close_code, error.reason).await; + return None; + } + }, + None | Some(Err(_)) => return None, + } + }; + + if let Err(error) = state.validate_public_request(&first_request) { + queue_websocket_close(websocket_sender, CloseCode::Protocol, error).await; + return None; + } + + match first_request.request { + Some(public_invocation_request::Request::Start(start)) => { + let idempotency_key = start.idempotency_key.clone(); + Some((start, idempotency_key)) + } + Some(public_invocation_request::Request::ResumeAttach(resume)) => { + let response = rejection_response( + InvocationRejectionReason::ResumeUnsupported, + "resume-attach is not supported by provisional live sessions".to_string(), + resume.idempotency_key, + ); + if state.validate_response(&response).is_ok() + && queue_invocation_response(websocket_sender, response).await + { + queue_websocket_close(websocket_sender, CloseCode::Normal, "session rejected") + .await; + } + None + } + _ => { + queue_websocket_close( + websocket_sender, + CloseCode::Protocol, + "the first invocation request must be start or resume-attach", + ) + .await; + None + } + } +} + +async fn forward_websocket_messages( + mut websocket_sink: S, + mut websocket_receiver: tokio::sync::mpsc::Receiver, + write_progress_timeout: std::time::Duration, +) where + S: futures::Sink + Unpin, +{ + while let Some(message) = websocket_receiver.recv().await { + let close = matches!(message, Message::Close(_)); + if !matches!( + tokio::time::timeout(write_progress_timeout, websocket_sink.send(message)).await, + Ok(Ok(())) + ) { + return; + } + if close { + return; + } + } +} + +async fn supervise_public_invocation_session( + mut requests: tokio::task::JoinHandle<()>, + mut responses: tokio::task::JoinHandle<()>, + mut writer: tokio::task::JoinHandle<()>, +) { + enum CompletedPump { + Requests, + Responses, + Writer, + } + let completed = tokio::select! { + _ = &mut requests => CompletedPump::Requests, + _ = &mut responses => CompletedPump::Responses, + _ = &mut writer => CompletedPump::Writer, + }; + match completed { + CompletedPump::Requests => { + responses.abort(); + let _ = responses.await; + let _ = writer.await; + } + CompletedPump::Responses => { + requests.abort(); + let _ = requests.await; + let _ = writer.await; + } + CompletedPump::Writer => { + requests.abort(); + responses.abort(); + let _ = requests.await; + let _ = responses.await; + } + } +} + +async fn forward_public_requests( + websocket_stream: S, + request_sender: tokio::sync::mpsc::Sender, + websocket_sender: tokio::sync::mpsc::Sender, + state: Arc>, +) where + S: futures::Stream> + Unpin, +{ + forward_public_requests_with_timeout( + websocket_stream, + request_sender, + websocket_sender, + state, + INVOCATION_SESSION_STAGING_ADMISSION_TIMEOUT, + ) + .await; +} + +async fn forward_public_requests_with_timeout( + websocket_stream: S, + request_sender: tokio::sync::mpsc::Sender, + websocket_sender: tokio::sync::mpsc::Sender, + state: Arc>, + staging_admission_timeout: std::time::Duration, +) where + S: futures::Stream> + Unpin, +{ + let (staging_sender, mut staging_receiver) = + tokio::sync::mpsc::channel(INVOCATION_SESSION_CHANNEL_CAPACITY); + let read_requests = read_public_requests( + websocket_stream, + staging_sender, + websocket_sender.clone(), + state, + staging_admission_timeout, + ); + let forward_requests = async move { + while let Some(request) = staging_receiver.recv().await { + if request_sender.send(request).await.is_err() { + try_queue_websocket_close( + &websocket_sender, + CloseCode::Error, + "internal invocation request stream closed", + ); + return; + } + } + }; + tokio::pin!(read_requests, forward_requests); + tokio::select! { + _ = &mut read_requests => {} + _ = &mut forward_requests => {} + } +} + +async fn read_public_requests( + mut websocket_stream: S, + staging_sender: tokio::sync::mpsc::Sender, + websocket_sender: tokio::sync::mpsc::Sender, + state: Arc>, + staging_admission_timeout: std::time::Duration, +) where + S: futures::Stream> + Unpin, +{ + let mut pending_message = None; + loop { + let message = match pending_message.take() { + Some(message) => message, + None => match websocket_stream.next().await { + Some(message) => message, + None => return, + }, + }; + let message = match message { + Ok(message) => message, + Err(_) => return, + }; + let request = match decode_public_session_message(message) { + Ok(PublicSessionMessage::Request(request)) => request, + Ok(PublicSessionMessage::Ping(payload)) => { + if matches!( + websocket_sender.try_send(Message::pong(payload)), + Err(tokio::sync::mpsc::error::TrySendError::Closed(_)) + ) { + return; + } + continue; + } + Ok(PublicSessionMessage::Pong) => continue, + Ok(PublicSessionMessage::Close) => return, + Err(error) => { + try_queue_websocket_close(&websocket_sender, error.close_code, error.reason); + return; + } + }; + let validation = { + let mut state = state.lock().await; + state.validate_public_request(&request) + }; + if let Err(error) = validation { + try_queue_websocket_close(&websocket_sender, CloseCode::Protocol, error); + return; + } + let request = match trusted_tail_request(request) { + Ok(request) => request, + Err(error) => { + try_queue_websocket_close(&websocket_sender, CloseCode::Protocol, error); + return; + } + }; + let admission = + tokio::time::timeout(staging_admission_timeout, staging_sender.send(request)); + tokio::pin!(admission); + tokio::select! { + result = &mut admission => { + if !matches!(result, Ok(Ok(()))) { + return; + } + } + next = websocket_stream.next() => { + match next { + None | Some(Err(_)) | Some(Ok(Message::Close(_))) => return, + Some(message) => pending_message = Some(message), + } + if !matches!(admission.await, Ok(Ok(()))) { + return; + } + } + } + } +} + +async fn forward_internal_responses( + mut responses: S, + websocket_sender: tokio::sync::mpsc::Sender, + state: Arc>, +) where + S: futures::Stream> + Unpin, +{ + while let Some(response) = responses.next().await { + let response = match response { + Ok(response) => response, + Err(_) => break, + }; + let validation = { + let mut state = state.lock().await; + state + .validate_response(&response) + .map(|()| state.is_complete()) + }; + let complete = match validation { + Ok(complete) => complete, + Err(error) => { + queue_websocket_close(&websocket_sender, CloseCode::Protocol, error).await; + return; + } + }; + if websocket_sender + .send(Message::binary(response.encode_to_vec())) + .await + .is_err() + { + return; + } + if complete { + queue_websocket_close(&websocket_sender, CloseCode::Normal, "session complete").await; + return; + } + } + + queue_websocket_close( + &websocket_sender, + CloseCode::Error, + "internal invocation response stream ended before session completion", + ) + .await; +} + +async fn queue_websocket_close( + sender: &tokio::sync::mpsc::Sender, + code: CloseCode, + reason: impl AsRef, +) { + let reason = bounded_close_reason(reason.as_ref()); + let _ = sender.send(Message::close_with(code, reason)).await; +} + +fn try_queue_websocket_close( + sender: &tokio::sync::mpsc::Sender, + code: CloseCode, + reason: impl AsRef, +) { + let reason = bounded_close_reason(reason.as_ref()); + let _ = sender.try_send(Message::close_with(code, reason)); +} + +fn trusted_tail_request( + request: PublicInvocationRequest, +) -> std::result::Result { + let request = match request.request { + Some(public_invocation_request::Request::InputItem(item)) => { + if let Some(input_stream_item::Payload::Value(value)) = &item.payload { + validate_public_session_schema_value(value)?; + } + invocation_request::Request::InputItem(item) + } + Some(public_invocation_request::Request::InputEnd(end)) => { + invocation_request::Request::InputEnd(end) + } + Some(public_invocation_request::Request::StreamCancel(cancel)) => { + invocation_request::Request::StreamCancel(cancel) + } + Some(public_invocation_request::Request::Start(_)) + | Some(public_invocation_request::Request::ResumeAttach(_)) => { + return Err( + "invocation start or resume-attach may only appear as the first request" + .to_string(), + ); + } + None => return Err("invocation request has no payload".to_string()), + }; + Ok(InvocationRequest { + request: Some(request), + }) +} + +fn rejection_reason(error: &WorkerServiceError) -> InvocationRejectionReason { + match error { + WorkerServiceError::TypeChecker(_) + | WorkerServiceError::RegistryServiceError(RegistryServiceError::BadRequest(_)) => { + InvocationRejectionReason::Validation + } + WorkerServiceError::AuthError(AuthServiceError::Unauthorized(_)) + | WorkerServiceError::RegistryServiceError(RegistryServiceError::Unauthorized(_)) + | WorkerServiceError::RegistryServiceError(RegistryServiceError::CouldNotAuthenticate(_)) => { + InvocationRejectionReason::Unauthorized + } + WorkerServiceError::ComponentNotFound(_) + | WorkerServiceError::AgentNotFound(_) + | WorkerServiceError::RegistryServiceError(RegistryServiceError::NotFound(_)) => { + InvocationRejectionReason::NotFound + } + _ => InvocationRejectionReason::Internal, + } +} + +fn rejection_response( + reason: InvocationRejectionReason, + error: String, + idempotency_key: Option, +) -> InvocationResponse { + InvocationResponse { + response: Some(invocation_response::Response::Rejected( + InvocationRejected { + reason: reason as i32, + error, + idempotency_key, + agent_id: None, + component_revision: None, + }, + )), + } +} + +async fn queue_invocation_response( + sender: &tokio::sync::mpsc::Sender, + response: InvocationResponse, +) -> bool { + sender + .send(Message::binary(response.encode_to_vec())) + .await + .is_ok() +} + +fn bounded_close_reason(reason: &str) -> String { + const MAX_CLOSE_REASON_BYTES: usize = 123; + if reason.len() <= MAX_CLOSE_REASON_BYTES { + return reason.to_string(); + } + let mut end = MAX_CLOSE_REASON_BYTES; + while !reason.is_char_boundary(end) { + end -= 1; + } + reason[..end].to_string() +} + #[derive(Debug, Clone, Serialize, Deserialize, Enum)] #[oai(rename_all = "camelCase")] #[serde(rename_all = "camelCase")] @@ -169,15 +774,52 @@ pub struct CreateAgentResponse { #[cfg(test)] mod tests { - use super::{AgentInvocationRequest, CreateAgentRequest}; + use super::{ + AgentInvocationRequest, CreateAgentRequest, INVOCATION_SESSION_MAX_MESSAGE_SIZE, + InitialPublicInvocation, PublicSessionMessage, bounded_close_reason, + decode_public_session_message, forward_internal_responses, forward_public_requests, + forward_public_requests_with_timeout, forward_websocket_messages, + invocation_session_websocket_config, queue_invocation_response, + receive_public_invocation_start, receive_public_invocation_start_while_writing, + rejection_reason, supervise_public_invocation_session, trusted_tail_request, + }; + use crate::service::worker::WorkerServiceError; + use futures::StreamExt; + use golem_api_grpc::invocation_session_protocol::InvocationSessionState; + use golem_api_grpc::proto::golem::worker::{ + AgentId, IdempotencyKey, InputStreamEnd, InputStreamItem, InvocationAccepted, + InvocationRejectionReason, InvocationRequest, InvocationResponse, + InvocationSessionCompletion, InvocationSessionResult, OutputStreamItem, + PublicInvocationRequest, PublicInvocationStart, ResumeAttach, StreamCancel, + StreamCancelReason, StreamCancelRole, input_stream_item, invocation_request, + invocation_response, invocation_session_result, public_invocation_request, + }; + use golem_service_base::clients::registry::RegistryServiceError; + use poem::web::websocket::{CloseCode, Message}; use poem_openapi::types::{ParseFromJSON, ToJSON}; + use prost::Message as ProstMessage; use serde_json::{Value, json}; + use std::sync::Arc; use test_r::test; fn empty_parameter_record() -> Value { json!({ "kind": "record", "value": { "fields": [] } }) } + fn gated_websocket_sink( + permits: tokio::sync::mpsc::Receiver<()>, + delivered: Arc>>, + ) -> impl futures::Sink { + futures::sink::unfold( + (permits, delivered), + |(mut permits, delivered), message| async move { + permits.recv().await.ok_or(())?; + delivered.lock().await.push(message); + Ok((permits, delivered)) + }, + ) + } + #[test] fn create_agent_request_preserves_canonical_schema_value_json() { let parameters = empty_parameter_record(); @@ -232,4 +874,920 @@ mod tests { assert!(CreateAgentRequest::parse_from_json(Some(request_json)).is_err()); } + + #[test] + fn invocation_session_frame_decoder_accepts_one_binary_protobuf_message() { + let request = PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputEnd( + InputStreamEnd { + stream_id: 7, + offset: 3, + }, + )), + }; + + let decoded = decode_public_session_message(Message::binary(request.encode_to_vec())) + .expect("binary protobuf frame must decode"); + + assert!(matches!( + decoded, + PublicSessionMessage::Request(PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputEnd( + InputStreamEnd { + stream_id: 7, + offset: 3, + } + )), + }) + )); + } + + #[test] + fn invocation_session_frame_decoder_rejects_text_and_malformed_protobuf() { + let text = decode_public_session_message(Message::text("not protobuf")) + .expect_err("text frames must be rejected"); + assert_eq!(text.close_code, CloseCode::Unsupported); + + let malformed = decode_public_session_message(Message::binary([0xff, 0xff])) + .expect_err("malformed protobuf must be rejected"); + assert_eq!(malformed.close_code, CloseCode::Protocol); + } + + #[test] + fn invocation_session_websocket_config_bounds_frames_messages_and_writes() { + let config = invocation_session_websocket_config(); + + assert_eq!( + config.max_message_size, + Some(INVOCATION_SESSION_MAX_MESSAGE_SIZE) + ); + assert_eq!( + config.max_frame_size, + Some(INVOCATION_SESSION_MAX_MESSAGE_SIZE) + ); + assert_eq!( + config.max_write_buffer_size, + 2 * INVOCATION_SESSION_MAX_MESSAGE_SIZE + ); + } + + #[test] + fn public_tail_translation_cannot_construct_a_trusted_start() { + let translated = trusted_tail_request(PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputEnd( + InputStreamEnd { + stream_id: 4, + offset: 9, + }, + )), + }) + .unwrap(); + assert!(matches!( + translated.request, + Some(invocation_request::Request::InputEnd(InputStreamEnd { + stream_id: 4, + offset: 9, + })) + )); + + let repeated_start = PublicInvocationRequest { + request: Some(public_invocation_request::Request::Start(Default::default())), + }; + assert!(trusted_tail_request(repeated_start).is_err()); + } + + #[test] + fn public_tail_translation_rejects_recursive_host_capabilities() { + use golem_api_grpc::proto::golem::schema::{ + RecordValue, SchemaValue, SecretValue, schema_value, + }; + + let request = PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id: 7, + sequence: 0, + payload: Some(input_stream_item::Payload::Value(SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![SchemaValue { + value: Some(schema_value::Value::SecretValue( + SecretValue::default(), + )), + }], + })), + })), + }, + )), + }; + + assert!( + trusted_tail_request(request) + .unwrap_err() + .contains("host-managed capability") + ); + } + + #[test] + async fn saturated_websocket_output_does_not_hide_disconnect_after_ping() { + let (websocket_client, websocket_stream) = + futures::channel::mpsc::unbounded::>(); + let (internal_sender, _internal_receiver) = tokio::sync::mpsc::channel(1); + let (websocket_sender, _websocket_receiver) = tokio::sync::mpsc::channel(1); + websocket_sender + .send(Message::Ping(Vec::new())) + .await + .unwrap(); + + let requests = tokio::spawn(forward_public_requests( + websocket_stream, + internal_sender, + websocket_sender, + Arc::new(tokio::sync::Mutex::new(InvocationSessionState::default())), + )); + websocket_client + .unbounded_send(Ok(Message::Ping(Vec::new()))) + .unwrap(); + tokio::task::yield_now().await; + drop(websocket_client); + + tokio::time::timeout(std::time::Duration::from_millis(100), requests) + .await + .expect("saturated WebSocket output hid the client disconnect") + .unwrap(); + } + + #[test] + async fn saturated_input_forwarding_does_not_block_responses_or_tail_cancellation() { + use golem_api_grpc::proto::golem::schema::{ + RecordValue, SchemaValue, SchemaValueStreamReference, schema_value, + }; + + let idempotency_key = IdempotencyKey { + value: "input-backpressure".to_string(), + }; + let stream_id = 7; + let start = PublicInvocationRequest { + request: Some(public_invocation_request::Request::Start( + PublicInvocationStart { + application_name: "app".to_string(), + environment_name: "env".to_string(), + agent_type_name: "agent".to_string(), + constructor_parameters: Some(SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue::default())), + }), + method_name: "run".to_string(), + method_parameters: Some(SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![SchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id }, + )), + }], + })), + }), + idempotency_key: Some(idempotency_key.clone()), + ..Default::default() + }, + )), + }; + let accepted = InvocationResponse { + response: Some(invocation_response::Response::Accepted( + InvocationAccepted { + agent_id: Some(AgentId { + component_id: None, + name: "agent".to_string(), + }), + idempotency_key: Some(idempotency_key), + component_revision: Some(1), + }, + )), + }; + let mut state = InvocationSessionState::default(); + state.validate_public_request(&start).unwrap(); + state.validate_response(&accepted).unwrap(); + let state = Arc::new(tokio::sync::Mutex::new(state)); + + let (websocket_client, websocket_stream) = + futures::channel::mpsc::unbounded::>(); + let (internal_sender, mut internal_receiver) = tokio::sync::mpsc::channel(1); + internal_sender + .send(InvocationRequest { request: None }) + .await + .unwrap(); + let (websocket_sender, mut websocket_receiver) = tokio::sync::mpsc::channel(2); + let requests = tokio::spawn(forward_public_requests( + websocket_stream, + internal_sender, + websocket_sender.clone(), + state.clone(), + )); + let input = PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id, + sequence: 0, + payload: Some(input_stream_item::Payload::Value( + golem_common::schema::SchemaValue::U32(1) + .try_into() + .unwrap(), + )), + }, + )), + }; + websocket_client + .unbounded_send(Ok(Message::binary(input.encode_to_vec()))) + .unwrap(); + tokio::task::yield_now().await; + + let result = InvocationResponse { + response: Some(invocation_response::Response::Result( + InvocationSessionResult { + result: Some(invocation_session_result::Result::NoResult( + golem_api_grpc::proto::golem::common::Empty {}, + )), + component_revision: Some(1), + agent_id: Some(AgentId { + component_id: None, + name: "agent".to_string(), + }), + idempotency_key: Some(IdempotencyKey { + value: "input-backpressure".to_string(), + }), + ..Default::default() + }, + )), + }; + let responses = tokio::spawn(forward_internal_responses( + tokio_stream::iter([Ok(result.clone())]), + websocket_sender, + state, + )); + let forwarded = + tokio::time::timeout(std::time::Duration::from_secs(1), websocket_receiver.recv()) + .await + .expect("response forwarding blocked behind saturated input") + .expect("response pump closed unexpectedly"); + let Message::Binary(forwarded) = forwarded else { + panic!("response pump did not forward a binary invocation response") + }; + assert_eq!( + InvocationResponse::decode(forwarded.as_slice()).unwrap(), + result + ); + + drop(websocket_client); + tokio::time::timeout(std::time::Duration::from_secs(1), requests) + .await + .expect("disconnect did not terminate the saturated request pump") + .unwrap(); + let _ = responses.await; + assert!(internal_receiver.recv().await.is_some()); + assert!(internal_receiver.recv().await.is_none()); + } + + #[test] + async fn valid_input_burst_applies_backpressure_without_closing_the_session() { + use golem_api_grpc::proto::golem::schema::{ + RecordValue, SchemaValue, SchemaValueStreamReference, schema_value, + }; + + let idempotency_key = IdempotencyKey { + value: "lossless-input-backpressure".to_string(), + }; + let stream_id = 7; + let start = PublicInvocationRequest { + request: Some(public_invocation_request::Request::Start( + PublicInvocationStart { + application_name: "app".to_string(), + environment_name: "env".to_string(), + agent_type_name: "agent".to_string(), + constructor_parameters: Some(SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue::default())), + }), + method_name: "run".to_string(), + method_parameters: Some(SchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id }, + )), + }), + idempotency_key: Some(idempotency_key.clone()), + ..Default::default() + }, + )), + }; + let accepted = InvocationResponse { + response: Some(invocation_response::Response::Accepted( + InvocationAccepted { + agent_id: Some(AgentId { + component_id: None, + name: "agent".to_string(), + }), + idempotency_key: Some(idempotency_key), + component_revision: Some(1), + }, + )), + }; + let mut state = InvocationSessionState::default(); + state.validate_public_request(&start).unwrap(); + state.validate_response(&accepted).unwrap(); + + let (websocket_client, websocket_stream) = + futures::channel::mpsc::unbounded::>(); + let (internal_sender, mut internal_receiver) = tokio::sync::mpsc::channel(1); + internal_sender + .send(InvocationRequest { request: None }) + .await + .unwrap(); + let (websocket_sender, mut websocket_receiver) = tokio::sync::mpsc::channel(1); + let requests = tokio::spawn(forward_public_requests( + websocket_stream, + internal_sender, + websocket_sender, + Arc::new(tokio::sync::Mutex::new(state)), + )); + + for sequence in 0..18 { + let input = PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id, + sequence, + payload: Some(input_stream_item::Payload::Value(SchemaValue { + value: Some(schema_value::Value::U8Value(sequence as u32)), + })), + }, + )), + }; + websocket_client + .unbounded_send(Ok(Message::binary(input.encode_to_vec()))) + .unwrap(); + } + + let outbound = tokio::time::timeout( + std::time::Duration::from_millis(100), + websocket_receiver.recv(), + ) + .await; + assert!( + outbound.is_err(), + "a valid input burst must be backpressured, not close the live session; got {outbound:?}" + ); + assert!(!requests.is_finished()); + + assert!(internal_receiver.recv().await.is_some()); + for expected_sequence in 0..18 { + let request = tokio::time::timeout( + std::time::Duration::from_secs(1), + internal_receiver.recv(), + ) + .await + .expect("lossless input forwarding remained blocked after downstream capacity returned") + .expect("internal invocation request stream closed during a valid input burst"); + assert!(matches!( + request.request, + Some(invocation_request::Request::InputItem(InputStreamItem { + stream_id: actual_stream_id, + sequence: actual_sequence, + .. + })) if actual_stream_id == stream_id && actual_sequence == expected_sequence + )); + } + drop(websocket_client); + tokio::time::timeout(std::time::Duration::from_secs(1), requests) + .await + .expect("disconnect did not terminate the drained request pump") + .unwrap(); + assert!(internal_receiver.recv().await.is_none()); + } + + #[test] + async fn saturated_staging_does_not_hide_websocket_disconnect() { + use golem_api_grpc::proto::golem::schema::{ + RecordValue, SchemaValue, SchemaValueStreamReference, schema_value, + }; + + let idempotency_key = IdempotencyKey { + value: "saturated-staging-disconnect".to_string(), + }; + let stream_id = 7; + let start = PublicInvocationRequest { + request: Some(public_invocation_request::Request::Start( + PublicInvocationStart { + application_name: "app".to_string(), + environment_name: "env".to_string(), + agent_type_name: "agent".to_string(), + constructor_parameters: Some(SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue::default())), + }), + method_name: "run".to_string(), + method_parameters: Some(SchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id }, + )), + }), + idempotency_key: Some(idempotency_key.clone()), + ..Default::default() + }, + )), + }; + let accepted = InvocationResponse { + response: Some(invocation_response::Response::Accepted( + InvocationAccepted { + agent_id: Some(AgentId { + component_id: None, + name: "agent".to_string(), + }), + idempotency_key: Some(idempotency_key), + component_revision: Some(1), + }, + )), + }; + let mut state = InvocationSessionState::default(); + state.validate_public_request(&start).unwrap(); + state.validate_response(&accepted).unwrap(); + + let (websocket_client, websocket_stream) = + futures::channel::mpsc::unbounded::>(); + let (internal_sender, mut internal_receiver) = tokio::sync::mpsc::channel(1); + internal_sender + .send(InvocationRequest { request: None }) + .await + .unwrap(); + let (websocket_sender, _websocket_receiver) = tokio::sync::mpsc::channel(1); + let requests = tokio::spawn(forward_public_requests_with_timeout( + websocket_stream, + internal_sender, + websocket_sender, + Arc::new(tokio::sync::Mutex::new(state)), + std::time::Duration::from_millis(50), + )); + + for sequence in 0..19 { + let input = PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id, + sequence, + payload: Some(input_stream_item::Payload::Value(SchemaValue { + value: Some(schema_value::Value::U8Value(sequence as u32)), + })), + }, + )), + }; + websocket_client + .unbounded_send(Ok(Message::binary(input.encode_to_vec()))) + .unwrap(); + } + + tokio::time::sleep(std::time::Duration::from_millis(20)).await; + assert!(!requests.is_finished()); + drop(websocket_client); + + tokio::time::timeout(std::time::Duration::from_millis(200), requests) + .await + .expect("saturated staging exceeded its bounded disconnect-detection deadline") + .unwrap(); + assert!(internal_receiver.recv().await.is_some()); + assert!(internal_receiver.recv().await.is_none()); + } + + #[test] + async fn saturated_output_forwarding_does_not_block_output_cancellation() { + use golem_api_grpc::proto::golem::schema::{ + RecordValue, SchemaValue, SchemaValueStreamReference, schema_value, + }; + + let idempotency_key = IdempotencyKey { + value: "output-backpressure".to_string(), + }; + let start = PublicInvocationRequest { + request: Some(public_invocation_request::Request::Start( + PublicInvocationStart { + application_name: "app".to_string(), + environment_name: "env".to_string(), + agent_type_name: "agent".to_string(), + constructor_parameters: Some(SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue::default())), + }), + method_name: "run".to_string(), + method_parameters: Some(SchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue::default())), + }), + idempotency_key: Some(idempotency_key.clone()), + ..Default::default() + }, + )), + }; + let agent_id = AgentId { + component_id: None, + name: "agent".to_string(), + }; + let accepted = InvocationResponse { + response: Some(invocation_response::Response::Accepted( + InvocationAccepted { + agent_id: Some(agent_id.clone()), + idempotency_key: Some(idempotency_key.clone()), + component_revision: Some(1), + }, + )), + }; + let mut initial_state = InvocationSessionState::default(); + initial_state.validate_public_request(&start).unwrap(); + initial_state.validate_response(&accepted).unwrap(); + + let output_stream_id = 2; + let result = InvocationResponse { + response: Some(invocation_response::Response::Result( + InvocationSessionResult { + result: Some(invocation_session_result::Result::MethodResult( + SchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { + stream_id: output_stream_id, + }, + )), + }, + )), + component_revision: Some(1), + agent_id: Some(agent_id), + idempotency_key: Some(idempotency_key), + ..Default::default() + }, + )), + }; + initial_state.validate_response(&result).unwrap(); + let state = Arc::new(tokio::sync::Mutex::new(initial_state)); + + let output_item = InvocationResponse { + response: Some(invocation_response::Response::OutputItem( + OutputStreamItem { + stream_id: output_stream_id, + offset: 0, + value: Some(SchemaValue { + value: Some(schema_value::Value::U8Value(42)), + }), + }, + )), + }; + + let (websocket_sender, mut websocket_receiver) = tokio::sync::mpsc::channel(1); + websocket_sender + .send(Message::Ping(Vec::new())) + .await + .unwrap(); + let responses = tokio::spawn(forward_internal_responses( + tokio_stream::iter([Ok(output_item)]), + websocket_sender.clone(), + state.clone(), + )); + tokio::time::sleep(std::time::Duration::from_millis(20)).await; + assert!( + !responses.is_finished(), + "response forwarding did not saturate the bounded WebSocket queue" + ); + assert!( + state.try_lock().is_ok(), + "response forwarding retained protocol state while blocked by output backpressure" + ); + + let (websocket_client, websocket_stream) = + futures::channel::mpsc::unbounded::>(); + let (internal_sender, mut internal_receiver) = tokio::sync::mpsc::channel(1); + let requests = tokio::spawn(forward_public_requests( + websocket_stream, + internal_sender, + websocket_sender, + state, + )); + let cancel = PublicInvocationRequest { + request: Some(public_invocation_request::Request::StreamCancel( + StreamCancel { + stream_id: output_stream_id, + offset: 0, + role: StreamCancelRole::OutputConsumer as i32, + reason: StreamCancelReason::Cancelled as i32, + details: Some("stop output".to_string()), + }, + )), + }; + websocket_client + .unbounded_send(Ok(Message::binary(cancel.encode_to_vec()))) + .unwrap(); + + let forwarded = tokio::time::timeout( + std::time::Duration::from_millis(100), + internal_receiver.recv(), + ) + .await + .expect("output cancellation was blocked behind saturated response forwarding") + .expect("internal invocation request stream closed unexpectedly"); + assert!(matches!( + forwarded.request, + Some(invocation_request::Request::StreamCancel(StreamCancel { + stream_id, + role, + .. + })) if stream_id == output_stream_id && role == StreamCancelRole::OutputConsumer as i32 + )); + + drop(websocket_client); + drop(websocket_receiver.recv().await); + requests.abort(); + responses.abort(); + } + + #[test] + async fn pre_start_rejection_waits_for_temporarily_backpressured_writer() { + let request = PublicInvocationRequest { + request: Some(public_invocation_request::Request::ResumeAttach( + ResumeAttach { + idempotency_key: Some(IdempotencyKey { + value: "temporary-pre-start-stall".to_string(), + }), + }, + )), + }; + let mut websocket_stream = + tokio_stream::iter([Ok(Message::binary(request.encode_to_vec()))]); + let delivered = Arc::new(tokio::sync::Mutex::new(Vec::new())); + let (permit_sender, permit_receiver) = tokio::sync::mpsc::channel(2); + let sink = Box::pin(gated_websocket_sink(permit_receiver, delivered.clone())); + let (websocket_sender, websocket_receiver) = tokio::sync::mpsc::channel(2); + let writer = tokio::spawn(forward_websocket_messages( + sink, + websocket_receiver, + std::time::Duration::from_secs(5), + )); + + assert!( + receive_public_invocation_start( + &mut websocket_stream, + &websocket_sender, + &mut InvocationSessionState::default(), + ) + .await + .is_none() + ); + drop(websocket_sender); + tokio::time::sleep(std::time::Duration::from_millis(1100)).await; + assert!( + !writer.is_finished(), + "temporary pre-start backpressure truncated the rejection" + ); + + permit_sender.send(()).await.unwrap(); + permit_sender.send(()).await.unwrap(); + tokio::time::timeout(std::time::Duration::from_secs(2), writer) + .await + .expect("pre-start writer did not drain after output progress resumed") + .unwrap(); + + let delivered = delivered.lock().await; + assert_eq!(delivered.len(), 2); + let Message::Binary(rejected) = &delivered[0] else { + panic!("rejection was not delivered first") + }; + assert!(matches!( + InvocationResponse::decode(rejected.as_slice()) + .unwrap() + .response, + Some(invocation_response::Response::Rejected(_)) + )); + assert!(matches!(delivered[1], Message::Close(_))); + } + + #[test] + async fn pre_start_ping_stall_terminates_when_the_writer_stops() { + let messages = (0..18) + .map(|_| Ok(Message::Ping(Vec::new()))) + .collect::>>(); + let mut websocket_stream = tokio_stream::iter(messages).chain(futures::stream::pending()); + let delivered = Arc::new(tokio::sync::Mutex::new(Vec::new())); + let (permit_sender, permit_receiver) = tokio::sync::mpsc::channel(1); + let sink = Box::pin(gated_websocket_sink(permit_receiver, delivered.clone())); + let (websocket_sender, websocket_receiver) = tokio::sync::mpsc::channel(1); + let mut writer = tokio::spawn(forward_websocket_messages( + sink, + websocket_receiver, + std::time::Duration::from_millis(50), + )); + + let result = tokio::time::timeout( + std::time::Duration::from_millis(500), + receive_public_invocation_start_while_writing( + &mut websocket_stream, + &websocket_sender, + &mut InvocationSessionState::default(), + &mut writer, + ), + ) + .await + .expect("pre-start Ping stall outlived the writer progress deadline"); + assert!(matches!(result, InitialPublicInvocation::WriterStopped)); + assert!(delivered.lock().await.is_empty()); + drop(websocket_sender); + drop(permit_sender); + } + + #[test] + async fn pre_start_rejection_terminates_at_writer_progress_deadline() { + let request = PublicInvocationRequest { + request: Some(public_invocation_request::Request::ResumeAttach( + ResumeAttach { + idempotency_key: Some(IdempotencyKey { + value: "permanent-pre-start-stall".to_string(), + }), + }, + )), + }; + let mut websocket_stream = + tokio_stream::iter([Ok(Message::binary(request.encode_to_vec()))]); + let delivered = Arc::new(tokio::sync::Mutex::new(Vec::new())); + let (permit_sender, permit_receiver) = tokio::sync::mpsc::channel(1); + let sink = Box::pin(gated_websocket_sink(permit_receiver, delivered.clone())); + let (websocket_sender, websocket_receiver) = tokio::sync::mpsc::channel(2); + let writer = tokio::spawn(forward_websocket_messages( + sink, + websocket_receiver, + std::time::Duration::from_millis(50), + )); + + assert!( + receive_public_invocation_start( + &mut websocket_stream, + &websocket_sender, + &mut InvocationSessionState::default(), + ) + .await + .is_none() + ); + drop(websocket_sender); + tokio::time::timeout(std::time::Duration::from_millis(500), writer) + .await + .expect("pre-start writer exceeded its progress deadline") + .unwrap(); + assert!(delivered.lock().await.is_empty()); + drop(permit_sender); + } + + #[test] + async fn response_completion_waits_for_temporarily_backpressured_writer() { + let delivered = Arc::new(tokio::sync::Mutex::new(Vec::new())); + let (permit_sender, permit_receiver) = tokio::sync::mpsc::channel(3); + let sink = Box::pin(gated_websocket_sink(permit_receiver, delivered.clone())); + let (websocket_sender, websocket_receiver) = tokio::sync::mpsc::channel(3); + let writer = tokio::spawn(forward_websocket_messages( + sink, + websocket_receiver, + std::time::Duration::from_secs(5), + )); + let requests = tokio::spawn(futures::future::pending()); + let responses = tokio::spawn(async move { + let accepted = InvocationResponse { + response: Some(invocation_response::Response::Accepted(Default::default())), + }; + let finished = InvocationResponse { + response: Some(invocation_response::Response::Finished( + InvocationSessionCompletion::default(), + )), + }; + websocket_sender + .send(Message::binary(accepted.encode_to_vec())) + .await + .unwrap(); + websocket_sender + .send(Message::binary(finished.encode_to_vec())) + .await + .unwrap(); + websocket_sender + .send(Message::close_with(CloseCode::Normal, "session complete")) + .await + .unwrap(); + }); + + let supervisor = tokio::spawn(supervise_public_invocation_session( + requests, responses, writer, + )); + tokio::time::sleep(std::time::Duration::from_millis(1100)).await; + assert!( + !supervisor.is_finished(), + "temporary output backpressure truncated queued semantic responses" + ); + + for _ in 0..3 { + permit_sender.send(()).await.unwrap(); + } + tokio::time::timeout(std::time::Duration::from_secs(2), supervisor) + .await + .expect("writer did not drain after output progress resumed") + .unwrap(); + + let delivered = delivered.lock().await; + assert_eq!(delivered.len(), 3); + let Message::Binary(accepted) = &delivered[0] else { + panic!("accepted response was not delivered first") + }; + assert!(matches!( + InvocationResponse::decode(accepted.as_slice()) + .unwrap() + .response, + Some(invocation_response::Response::Accepted(_)) + )); + let Message::Binary(finished) = &delivered[1] else { + panic!("finished response was not delivered second") + }; + assert!(matches!( + InvocationResponse::decode(finished.as_slice()) + .unwrap() + .response, + Some(invocation_response::Response::Finished(_)) + )); + assert!(matches!(delivered[2], Message::Close(_))); + } + + #[test] + async fn permanently_stalled_writer_terminates_at_progress_deadline() { + let delivered = Arc::new(tokio::sync::Mutex::new(Vec::new())); + let (permit_sender, permit_receiver) = tokio::sync::mpsc::channel(1); + let sink = Box::pin(gated_websocket_sink(permit_receiver, delivered.clone())); + let (websocket_sender, websocket_receiver) = tokio::sync::mpsc::channel(2); + let writer = tokio::spawn(forward_websocket_messages( + sink, + websocket_receiver, + std::time::Duration::from_millis(50), + )); + let requests = tokio::spawn(futures::future::pending()); + let responses = tokio::spawn(async move { + websocket_sender + .send(Message::binary( + InvocationResponse { + response: Some(invocation_response::Response::Finished( + InvocationSessionCompletion::default(), + )), + } + .encode_to_vec(), + )) + .await + .unwrap(); + websocket_sender + .send(Message::close_with(CloseCode::Normal, "session complete")) + .await + .unwrap(); + }); + + tokio::time::timeout( + std::time::Duration::from_millis(500), + supervise_public_invocation_session(requests, responses, writer), + ) + .await + .expect("permanently stalled writer exceeded its progress deadline"); + assert!(delivered.lock().await.is_empty()); + drop(permit_sender); + } + + #[test] + async fn invocation_responses_are_forwarded_as_binary_protobuf_messages() { + let response = InvocationResponse { response: None }; + let (sender, mut receiver) = tokio::sync::mpsc::channel(1); + + assert!(queue_invocation_response(&sender, response.clone()).await); + let message = receiver.recv().await.unwrap(); + let Message::Binary(bytes) = message else { + panic!("invocation response must use a binary WebSocket message") + }; + + assert_eq!( + InvocationResponse::decode(bytes.as_slice()).unwrap(), + response + ); + } + + #[test] + fn websocket_close_reasons_are_utf8_safe_and_protocol_sized() { + let reason = "é".repeat(100); + let bounded = bounded_close_reason(&reason); + + assert!(bounded.len() <= 123); + assert!(reason.starts_with(&bounded)); + } + + #[test] + fn public_resolution_errors_map_to_protocol_rejections() { + assert_eq!( + rejection_reason(&WorkerServiceError::TypeChecker("invalid".to_string())), + InvocationRejectionReason::Validation + ); + assert_eq!( + rejection_reason(&WorkerServiceError::RegistryServiceError( + RegistryServiceError::Unauthorized("forbidden".to_string()) + )), + InvocationRejectionReason::Unauthorized + ); + assert_eq!( + rejection_reason(&WorkerServiceError::RegistryServiceError( + RegistryServiceError::NotFound("missing".to_string()) + )), + InvocationRejectionReason::NotFound + ); + } } diff --git a/golem-worker-service/src/grpcapi/worker.rs b/golem-worker-service/src/grpcapi/worker.rs index b7497e1e34..19ac97a132 100644 --- a/golem-worker-service/src/grpcapi/worker.rs +++ b/golem-worker-service/src/grpcapi/worker.rs @@ -17,8 +17,8 @@ use super::{bad_request_error, validate_protobuf_agent_id}; use crate::service::worker::{ InvocationRequestStream, InvocationResponseStream, WorkerService, WorkerServiceError, }; -use futures::{Stream, StreamExt, stream}; -use golem_api_grpc::InvocationResponseState; +use futures::{FutureExt, Stream, StreamExt, stream}; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; use golem_api_grpc::proto::golem::common::Empty; use golem_api_grpc::proto::golem::worker::v1::worker_service_server::WorkerService as GrpcWorkerService; use golem_api_grpc::proto::golem::worker::v1::{ @@ -33,11 +33,8 @@ use golem_api_grpc::proto::golem::worker::v1::{ revert_worker_response, update_worker_response, }; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame, InvocationProtocolFailure, InvocationSessionFinished, invocation_cancel, - invocation_frame, invocation_protocol_failure, invocation_session_finished, -}; -use golem_api_grpc::{ - expect_invocation_start, invocation_cancel_frame, validate_invocation_request_tail, + InvocationRejected, InvocationRejectionReason, InvocationRequest, InvocationResponse, + invocation_request, invocation_response, }; use golem_common::model::agent::InvocationFreshnessDisposition; use golem_common::model::component::{ComponentId, ComponentRevision}; @@ -53,84 +50,89 @@ use tonic::{Request, Response, Status}; use tracing::Instrument; fn service_failure_stream( - kind: invocation_protocol_failure::Kind, - details: String, + reason: InvocationRejectionReason, + error: String, + idempotency_key: Option, + agent_id: Option, ) -> InvocationResponseStream { Box::pin(stream::once(async move { - Ok(protocol_failure_frame(kind, details)) + Ok(InvocationResponse { + response: Some(invocation_response::Response::Rejected( + InvocationRejected { + reason: reason as i32, + error, + idempotency_key, + agent_id, + component_revision: None, + }, + )), + }) })) } -fn protocol_failure_frame( - kind: invocation_protocol_failure::Kind, - details: String, -) -> InvocationFrame { - InvocationFrame { - frame: Some(invocation_frame::Frame::Finished( - InvocationSessionFinished { - outcome: Some(invocation_session_finished::Outcome::ProtocolFailure( - InvocationProtocolFailure { - kind: kind as i32, - details, - }, - )), - }, - )), +fn request_identity( + request: &InvocationRequest, +) -> ( + Option, + Option, +) { + match request.request.as_ref() { + Some(invocation_request::Request::Start(start)) => { + (start.idempotency_key.clone(), start.agent_id.clone()) + } + Some(invocation_request::Request::ResumeAttach(resume)) => { + (resume.idempotency_key.clone(), None) + } + _ => (None, None), } } -fn validated_response_stream(inbound: S) -> InvocationResponseStream +fn validated_response_stream( + inbound: S, + state: Arc>, + initial_requests_checked: Option>, +) -> InvocationResponseStream where - S: Stream> + Send + Unpin + 'static, + S: Stream> + Send + Unpin + 'static, { Box::pin(stream::unfold( - Some((inbound, InvocationResponseState::default())), + Some((inbound, state, initial_requests_checked)), |state| async move { - let (mut inbound, mut response_state) = state?; + let (mut inbound, response_state, initial_requests_checked) = state?; + if let Some(initial_requests_checked) = initial_requests_checked { + let _ = initial_requests_checked.await; + } match inbound.next().await { - Some(Ok(frame)) => match response_state.validate(&frame) { - Ok(()) if response_state.is_complete() => match inbound.next().await { - None => Some((Ok(frame), None)), - Some(Ok(frame_after_terminal)) => { - let details = - response_state.validate(&frame_after_terminal).unwrap_err(); - Some(( - Ok(protocol_failure_frame( - invocation_protocol_failure::Kind::Protocol, - details, - )), - None, - )) + Some(Ok(response)) => { + let mut state = response_state.lock().await; + match state.validate_response(&response) { + Ok(()) if state.is_complete() => { + drop(state); + match inbound.next().await { + None => Some((Ok(response), None)), + Some(Ok(response_after_terminal)) => { + let details = response_state + .lock() + .await + .validate_response(&response_after_terminal) + .unwrap_err(); + Some((Err(Status::internal(details)), None)) + } + Some(Err(error)) => Some((Err(error), None)), + } } - Some(Err(error)) => Some(( - Ok(protocol_failure_frame( - invocation_protocol_failure::Kind::Transport, - error.to_string(), - )), - None, - )), - }, - Ok(()) => Some((Ok(frame), Some((inbound, response_state)))), - Err(details) => Some(( - Ok(protocol_failure_frame( - invocation_protocol_failure::Kind::Protocol, - details, - )), - None, - )), - }, - Some(Err(error)) => Some(( - Ok(protocol_failure_frame( - invocation_protocol_failure::Kind::Transport, - error.to_string(), - )), - None, - )), - None if response_state.is_complete() => None, + Ok(()) => { + drop(state); + Some((Ok(response), Some((inbound, response_state, None)))) + } + Err(details) => Some((Err(Status::internal(details)), None)), + } + } + Some(Err(error)) => Some((Err(error), None)), + None if response_state.lock().await.is_complete() => None, None => Some(( - Ok(protocol_failure_frame( - invocation_protocol_failure::Kind::Transport, - "invocation response transport closed before completion".to_string(), + Err(Status::unavailable( + "invocation response transport closed before completion", )), None, )), @@ -139,30 +141,73 @@ where )) } -fn validated_request_tail(inbound: S) -> InvocationRequestStream +fn validated_request_tail( + inbound: S, + state: Arc>, +) -> (InvocationRequestStream, tokio::sync::oneshot::Receiver<()>) where - S: Stream> + Send + Unpin + 'static, + S: Stream> + Send + Unpin + 'static, { - Box::pin(stream::unfold(Some(inbound), |state| async move { - let mut inbound = state?; - match inbound.next().await { - Some(Ok(frame)) => match validate_invocation_request_tail(frame) { - Ok(frame) => Some((frame, Some(inbound))), - Err(details) => Some(( - invocation_cancel_frame(invocation_cancel::Kind::Protocol, Some(details)), - None, - )), - }, - Some(Err(error)) => Some(( - invocation_cancel_frame( - invocation_cancel::Kind::Transport, - Some(error.to_string()), - ), - None, - )), - None => None, + let (validated_tx, validated_rx) = tokio::sync::mpsc::channel(32); + let (initial_requests_checked_tx, initial_requests_checked_rx) = + tokio::sync::oneshot::channel(); + tokio::spawn(async move { + let mut inbound = inbound; + let mut initial_requests_checked_tx = Some(initial_requests_checked_tx); + loop { + let Some(next) = inbound.next().now_or_never() else { + let _ = initial_requests_checked_tx.take().unwrap().send(()); + break; + }; + let Some(next) = next else { + let _ = initial_requests_checked_tx.take().unwrap().send(()); + return; + }; + let request = match next { + Ok(request) => request, + Err(_) => { + let _ = initial_requests_checked_tx.take().unwrap().send(()); + return; + } + }; + let invalid = state + .lock() + .await + .validate_trusted_request(&request) + .is_err(); + if validated_tx.send(request).await.is_err() { + let _ = initial_requests_checked_tx.take().unwrap().send(()); + return; + } + if invalid { + let _ = initial_requests_checked_tx.take().unwrap().send(()); + return; + } } - })) + while let Some(next) = inbound.next().await { + let request = match next { + Ok(request) => request, + Err(_) => return, + }; + let invalid = state + .lock() + .await + .validate_trusted_request(&request) + .is_err(); + if validated_tx.send(request).await.is_err() { + return; + } + if invalid { + return; + } + } + }); + ( + Box::pin(stream::unfold(validated_rx, |mut receiver| async move { + receiver.recv().await.map(|request| (request, receiver)) + })), + initial_requests_checked_rx, + ) } /// The only way to turn a wire-level freshness disposition into the internal @@ -398,46 +443,66 @@ impl GrpcWorkerService for WorkerGrpcApi { async fn invoke_agent_session( &self, - request: Request>, + request: Request>, ) -> Result, Status> { let mut inbound = request.into_inner(); - let mut start = match inbound.message().await { - Ok(Some(frame)) => match expect_invocation_start(frame) { - Ok(start) => start, - Err(error) => { - return Ok(Response::new(service_failure_stream( - invocation_protocol_failure::Kind::Protocol, - error, - ))); - } - }, + let first = match inbound.message().await { + Ok(Some(request)) => request, Ok(None) => { return Ok(Response::new(service_failure_stream( - invocation_protocol_failure::Kind::Protocol, + InvocationRejectionReason::Protocol, "invocation request ended before start".to_string(), + None, + None, ))); } Err(error) => { + return Err(error); + } + }; + let (idempotency_key, agent_id) = request_identity(&first); + let mut state = InvocationSessionState::default(); + if let Err(error) = state.validate_trusted_request(&first) { + return Ok(Response::new(service_failure_stream( + InvocationRejectionReason::Protocol, + error, + idempotency_key, + agent_id, + ))); + } + let mut start = match first + .request + .expect("validated invocation request has a payload") + { + invocation_request::Request::Start(start) => start, + invocation_request::Request::ResumeAttach(_) => { return Ok(Response::new(service_failure_stream( - invocation_protocol_failure::Kind::Transport, - error.to_string(), + InvocationRejectionReason::ResumeUnsupported, + "resume-attach is not supported by live sessions".to_string(), + idempotency_key, + None, ))); } + _ => unreachable!("the session validator requires start or resume-attach first"), }; let auth = match start.auth_ctx.clone() { Some(auth) => match auth.try_into() { Ok(auth) => auth, Err(error) => { return Ok(Response::new(service_failure_stream( - invocation_protocol_failure::Kind::Protocol, + InvocationRejectionReason::Validation, format!("failed converting auth_ctx: {error}"), + idempotency_key, + agent_id, ))); } }, None => { return Ok(Response::new(service_failure_stream( - invocation_protocol_failure::Kind::Protocol, + InvocationRejectionReason::Validation, "auth_ctx not found".to_string(), + idempotency_key, + agent_id, ))); } }; @@ -455,34 +520,37 @@ impl GrpcWorkerService for WorkerGrpcApi { as i32 } }; - let tail = validated_request_tail(inbound); + let state = Arc::new(tokio::sync::Mutex::new(state)); + let (tail, initial_requests_checked) = validated_request_tail(inbound, state.clone()); match self .worker_service .invoke_agent_session(start, tail, trusted_internal_caller, auth) .await { - Ok(response) => Ok(Response::new(validated_response_stream(response))), + Ok(response) => Ok(Response::new(validated_response_stream( + response, + state, + Some(initial_requests_checked), + ))), Err(error) => { - let kind = match &error { + let reason = match &error { WorkerServiceError::AuthError(_) | WorkerServiceError::LimitError(_) => { - invocation_protocol_failure::Kind::Denied + InvocationRejectionReason::Unauthorized } WorkerServiceError::ComponentNotFound(_) | WorkerServiceError::AgentNotFound(_) | WorkerServiceError::AccountIdNotFound(_) => { - invocation_protocol_failure::Kind::NotFound + InvocationRejectionReason::NotFound } - WorkerServiceError::TypeChecker(_) => { - invocation_protocol_failure::Kind::Protocol - } - WorkerServiceError::InternalCallError(_) => { - invocation_protocol_failure::Kind::Transport - } - _ => invocation_protocol_failure::Kind::RemoteInternal, + WorkerServiceError::TypeChecker(_) => InvocationRejectionReason::Validation, + WorkerServiceError::InternalCallError(_) => InvocationRejectionReason::Internal, + _ => InvocationRejectionReason::Internal, }; Ok(Response::new(service_failure_stream( - kind, + reason, error.to_string(), + idempotency_key, + agent_id, ))) } } @@ -905,128 +973,202 @@ mod freshness_tests { #[cfg(test)] mod protocol_tests { use super::{validated_request_tail, validated_response_stream}; - use futures::{StreamExt, stream}; + use futures::{FutureExt, StreamExt, stream}; + use golem_api_grpc::invocation_session_protocol::InvocationSessionState; use golem_api_grpc::proto::golem::common::Empty; - use golem_api_grpc::proto::golem::worker::invocation_session_finished::Outcome; + use golem_api_grpc::proto::golem::schema::{SchemaValue, schema_value}; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame, InvocationResult, InvocationSessionFinished, InvocationStart, - invocation_cancel, invocation_frame, invocation_protocol_failure, + AgentId, IdempotencyKey, InvocationAccepted, InvocationRequest, InvocationResponse, + InvocationSessionCompletion, InvocationSessionResult, InvocationStart, invocation_request, + invocation_response, invocation_session_completion, invocation_session_result, }; + use std::sync::Arc; use test_r::test; use tonic::Status; - fn successful_completion() -> invocation_frame::Frame { - invocation_frame::Frame::Finished(InvocationSessionFinished { - outcome: Some(Outcome::Success(Empty {})), + fn key() -> Option { + Some(IdempotencyKey { + value: "session-key".to_string(), + }) + } + + fn agent_id() -> Option { + Some(AgentId { + component_id: None, + name: "agent".to_string(), }) } + fn start() -> InvocationRequest { + InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { + input: Some(SchemaValue { + value: Some(schema_value::Value::U8Value(1)), + }), + idempotency_key: key(), + ..Default::default() + })), + } + } + + fn state_after_start() -> Arc> { + let mut state = InvocationSessionState::default(); + state.validate_trusted_request(&start()).unwrap(); + Arc::new(tokio::sync::Mutex::new(state)) + } + + fn response(response: invocation_response::Response) -> InvocationResponse { + InvocationResponse { + response: Some(response), + } + } + + fn accepted() -> InvocationResponse { + response(invocation_response::Response::Accepted( + InvocationAccepted { + agent_id: agent_id(), + idempotency_key: key(), + component_revision: Some(1), + }, + )) + } + + fn result() -> InvocationResponse { + response(invocation_response::Response::Result( + InvocationSessionResult { + result: Some(invocation_session_result::Result::NoResult(Empty {})), + component_revision: Some(1), + agent_id: agent_id(), + idempotency_key: key(), + ..Default::default() + }, + )) + } + + fn successful_completion() -> InvocationResponse { + response(invocation_response::Response::Finished( + InvocationSessionCompletion { + outcome: Some(invocation_session_completion::Outcome::Success(Empty {})), + }, + )) + } + #[test] - async fn request_transport_error_becomes_typed_cancellation() { + async fn request_transport_error_closes_the_internal_request_stream() { let inbound = stream::iter([Err(Status::unavailable("request transport failed"))]); - let mut tail = validated_request_tail(inbound); + let (mut tail, initial_requests_checked) = + validated_request_tail(inbound, state_after_start()); - let frame = tail.next().await.unwrap().frame.unwrap(); - let invocation_frame::Frame::Cancel(cancel) = frame else { - panic!("expected cancellation frame"); - }; - assert_eq!( - invocation_cancel::Kind::try_from(cancel.kind).unwrap(), - invocation_cancel::Kind::Transport - ); - assert!(cancel.details.unwrap().contains("request transport failed")); + initial_requests_checked.await.unwrap(); assert!(tail.next().await.is_none()); } #[test] - async fn malformed_request_tail_becomes_protocol_cancellation() { - let inbound = stream::iter([Ok::<_, Status>(InvocationFrame { - frame: Some(invocation_frame::Frame::Start(InvocationStart::default())), - })]); - let mut tail = validated_request_tail(inbound); - - let frame = tail.next().await.unwrap().frame.unwrap(); - let invocation_frame::Frame::Cancel(cancel) = frame else { - panic!("expected cancellation frame"); - }; - assert_eq!( - invocation_cancel::Kind::try_from(cancel.kind).unwrap(), - invocation_cancel::Kind::Protocol - ); - assert!(cancel.details.unwrap().contains("first frame")); + async fn malformed_request_tail_is_forwarded_for_semantic_terminalization() { + let malformed = start(); + let inbound = stream::iter([Ok::<_, Status>(malformed.clone())]); + let (mut tail, initial_requests_checked) = + validated_request_tail(inbound, state_after_start()); + + initial_requests_checked.await.unwrap(); + assert_eq!(tail.next().await, Some(malformed)); assert!(tail.next().await.is_none()); } #[test] - async fn response_transport_error_becomes_typed_failure() { + async fn response_transport_error_is_preserved() { let inbound = stream::iter([Err(Status::unavailable("response transport failed"))]); - let mut response = validated_response_stream(inbound); + let mut responses = validated_response_stream(inbound, state_after_start(), None); - let frame = response.next().await.unwrap().unwrap().frame.unwrap(); - assert!(matches!( - frame, - invocation_frame::Frame::Finished(InvocationSessionFinished { - outcome: Some(Outcome::ProtocolFailure(failure)), - }) if failure.kind == invocation_protocol_failure::Kind::Transport as i32 - && failure.details.contains("response transport failed") - )); - assert!(response.next().await.is_none()); + let error = responses.next().await.unwrap().unwrap_err(); + assert_eq!(error.code(), tonic::Code::Unavailable); + assert!(error.message().contains("response transport failed")); + assert!(responses.next().await.is_none()); } #[test] - async fn valid_response_preserves_terminal_outcome() { + async fn valid_response_preserves_stream_free_lifecycle() { let inbound = stream::iter([ - Ok::<_, Status>(InvocationFrame { - frame: Some(invocation_frame::Frame::Result(InvocationResult::default())), - }), - Ok(InvocationFrame { - frame: Some(successful_completion()), - }), + Ok::<_, Status>(accepted()), + Ok(result()), + Ok(successful_completion()), ]); - let mut response = validated_response_stream(inbound); + let mut responses = validated_response_stream(inbound, state_after_start(), None); assert!(matches!( - response.next().await.unwrap().unwrap().frame, - Some(invocation_frame::Frame::Result(_)) + responses.next().await.unwrap().unwrap().response, + Some(invocation_response::Response::Accepted(_)) )); assert!(matches!( - response.next().await.unwrap().unwrap().frame, - Some(invocation_frame::Frame::Finished( - InvocationSessionFinished { - outcome: Some(Outcome::Success(_)), - } - )) + responses.next().await.unwrap().unwrap().response, + Some(invocation_response::Response::Result(_)) + )); + assert!(matches!( + responses.next().await.unwrap().unwrap().response, + Some(invocation_response::Response::Finished(_)) )); - assert!(response.next().await.is_none()); + assert!(responses.next().await.is_none()); } #[test] - async fn repeated_response_terminal_becomes_protocol_failure() { - let inbound = stream::iter([ - Ok::<_, Status>(InvocationFrame { - frame: Some(invocation_frame::Frame::Result(InvocationResult::default())), - }), - Ok(InvocationFrame { - frame: Some(successful_completion()), - }), - Ok(InvocationFrame { - frame: Some(successful_completion()), - }), - ]); - let mut response = validated_response_stream(inbound); + async fn terminal_response_is_withheld_until_the_upstream_closes_cleanly() { + let (sender, receiver) = tokio::sync::mpsc::channel(4); + sender.send(Ok::<_, Status>(accepted())).await.unwrap(); + sender.send(Ok(result())).await.unwrap(); + sender.send(Ok(successful_completion())).await.unwrap(); + let mut responses = validated_response_stream( + tokio_stream::wrappers::ReceiverStream::new(receiver), + state_after_start(), + None, + ); + assert!(responses.next().await.unwrap().is_ok()); + assert!(responses.next().await.unwrap().is_ok()); + assert!(responses.next().now_or_never().is_none()); + + drop(sender); assert!(matches!( - response.next().await.unwrap().unwrap().frame, - Some(invocation_frame::Frame::Result(_)) - )); - let frame = response.next().await.unwrap().unwrap().frame.unwrap(); - assert!(matches!( - frame, - invocation_frame::Frame::Finished(InvocationSessionFinished { - outcome: Some(Outcome::ProtocolFailure(failure)), - }) if failure.kind == invocation_protocol_failure::Kind::Protocol as i32 - && failure.details.contains("after completion") + responses.next().await.unwrap().unwrap().response, + Some(invocation_response::Response::Finished(_)) )); - assert!(response.next().await.is_none()); + assert!(responses.next().await.is_none()); + } + + #[test] + async fn response_error_after_terminal_suppresses_the_terminal() { + let inbound = stream::iter([ + Ok::<_, Status>(accepted()), + Ok(result()), + Ok(successful_completion()), + Err(Status::unavailable( + "response transport failed after terminal", + )), + ]); + let mut responses = validated_response_stream(inbound, state_after_start(), None); + + assert!(responses.next().await.unwrap().is_ok()); + assert!(responses.next().await.unwrap().is_ok()); + let error = responses.next().await.unwrap().unwrap_err(); + assert_eq!(error.code(), tonic::Code::Unavailable); + assert!(error.message().contains("after terminal")); + assert!(responses.next().await.is_none()); + } + + #[test] + async fn repeated_response_terminal_is_a_protocol_status() { + let inbound = stream::iter([ + Ok::<_, Status>(accepted()), + Ok(result()), + Ok(successful_completion()), + Ok(successful_completion()), + ]); + let mut responses = validated_response_stream(inbound, state_after_start(), None); + + assert!(responses.next().await.unwrap().is_ok()); + assert!(responses.next().await.unwrap().is_ok()); + let error = responses.next().await.unwrap().unwrap_err(); + assert_eq!(error.code(), tonic::Code::Internal); + assert!(error.message().contains("after completion")); + assert!(responses.next().await.is_none()); } } diff --git a/golem-worker-service/src/mcp/invoke/resource.rs b/golem-worker-service/src/mcp/invoke/resource.rs index 6e597bb42a..033afa73e3 100644 --- a/golem-worker-service/src/mcp/invoke/resource.rs +++ b/golem-worker-service/src/mcp/invoke/resource.rs @@ -572,6 +572,21 @@ mod tests { #[test] async fn invoke_resource_auto_generates_phantom_for_ephemeral_agents() { + let constructor = AgentConstructorSchema { + name: None, + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(vec![]), + }; + let method = AgentMethodSchema { + name: "read".to_string(), + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(vec![]), + output_schema: OutputSchema::Unit, + http_endpoint: vec![], + read_only: None, + }; let harness = InvocationHarness::new_with_agent_mode( AgentInvocationOutput { result: golem_common::model::AgentInvocationResult::AgentInitialization, @@ -584,6 +599,8 @@ mod tests { agent_fingerprint: None, }, AgentMode::Ephemeral, + constructor.clone(), + vec![method.clone()], ); let resource = AgentMcpResource { kind: AgentMcpResourceKind::Static(Annotated::new( @@ -603,21 +620,8 @@ mod tests { account_id: harness.account_id, schema_graph: Arc::new(SchemaGraph::empty()), account_email: golem_common::model::account::AccountEmail::new("mcp@golem"), - constructor: AgentConstructorSchema { - name: None, - description: String::new(), - prompt_hint: None, - input_schema: InputSchema::Parameters(vec![]), - }, - method: AgentMethodSchema { - name: "read".to_string(), - description: String::new(), - prompt_hint: None, - input_schema: InputSchema::Parameters(vec![]), - output_schema: OutputSchema::Unit, - http_endpoint: vec![], - read_only: None, - }, + constructor, + method, component_id: harness.component_id, agent_type_name: AgentTypeName("mcp-agent".to_string()), agent_mode: AgentMode::Ephemeral, diff --git a/golem-worker-service/src/mcp/invoke/test_support.rs b/golem-worker-service/src/mcp/invoke/test_support.rs index 0809bb3f58..c3e6f4759d 100644 --- a/golem-worker-service/src/mcp/invoke/test_support.rs +++ b/golem-worker-service/src/mcp/invoke/test_support.rs @@ -16,7 +16,9 @@ use crate::service::agent_resolution_cache::AgentResolutionCache; use crate::service::auth::{AuthService, AuthServiceError}; use crate::service::component::{ComponentService, ComponentServiceError}; use crate::service::limit::{LimitService, LimitServiceError}; -use crate::service::worker::{WorkerClient, WorkerResult, WorkerService, WorkerStream}; +use crate::service::worker::{ + WorkerClient, WorkerResult, WorkerService, WorkerServiceError, WorkerStream, +}; use async_trait::async_trait; use bytes::Bytes; use chrono::Utc; @@ -37,7 +39,7 @@ use golem_common::model::environment::{EnvironmentId, EnvironmentName}; use golem_common::model::oplog::{OplogCursor, OplogIndex}; use golem_common::model::worker::{AgentConfigEntryDto, AgentMetadataDto, RevertWorkerTarget}; use golem_common::model::{AgentFilter, AgentFingerprint, AgentId, IdempotencyKey, ScanCursor}; -use golem_common::schema::{AgentConstructorSchema, AgentTypeSchema, InputSchema, SchemaGraph}; +use golem_common::schema::{AgentConstructorSchema, AgentTypeSchema, SchemaGraph}; use golem_service_base::clients::registry::{RegistryService, RegistryServiceError}; use golem_service_base::model::auth::AuthCtx; use golem_service_base::model::component::Component; @@ -351,11 +353,11 @@ impl WorkerClient for RecordingWorkerClient { async fn get_metadata( &self, - _: &AgentId, + agent_id: &AgentId, _: EnvironmentId, _: AuthCtx, ) -> WorkerResult { - unimplemented!() + Err(WorkerServiceError::AgentNotFound(agent_id.clone())) } async fn find_metadata( @@ -545,13 +547,19 @@ pub(crate) struct InvocationHarness { } impl InvocationHarness { - pub(crate) fn new(invocation_output: AgentInvocationOutput) -> Self { - Self::new_with_agent_mode(invocation_output, AgentMode::Durable) + pub(crate) fn new( + invocation_output: AgentInvocationOutput, + constructor: AgentConstructorSchema, + methods: Vec, + ) -> Self { + Self::new_with_agent_mode(invocation_output, AgentMode::Durable, constructor, methods) } pub(crate) fn new_with_agent_mode( invocation_output: AgentInvocationOutput, agent_mode: AgentMode, + constructor: AgentConstructorSchema, + methods: Vec, ) -> Self { let component_id = ComponentId(Uuid::new_v4()); let environment_id = EnvironmentId(Uuid::new_v4()); @@ -579,13 +587,8 @@ impl InvocationHarness { description: String::new(), source_language: String::new(), schema: SchemaGraph::empty(), - constructor: AgentConstructorSchema { - name: None, - description: String::new(), - prompt_hint: None, - input_schema: InputSchema::Parameters(vec![]), - }, - methods: vec![], + constructor, + methods, dependencies: vec![], mode: agent_mode, http_mount: None, diff --git a/golem-worker-service/src/mcp/invoke/tool.rs b/golem-worker-service/src/mcp/invoke/tool.rs index 860bd19f90..d5844e982e 100644 --- a/golem-worker-service/src/mcp/invoke/tool.rs +++ b/golem-worker-service/src/mcp/invoke/tool.rs @@ -697,6 +697,21 @@ mod tests { #[test] async fn invoke_tool_auto_generates_phantom_for_ephemeral_agents() { + let constructor = AgentConstructorSchema { + name: None, + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(vec![]), + }; + let method = AgentMethodSchema { + name: "run".to_string(), + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(vec![]), + output_schema: OutputSchema::Unit, + http_endpoint: vec![], + read_only: None, + }; let harness = InvocationHarness::new_with_agent_mode( AgentInvocationOutput { result: golem_common::model::AgentInvocationResult::AgentInitialization, @@ -709,6 +724,8 @@ mod tests { agent_fingerprint: None, }, AgentMode::Ephemeral, + constructor.clone(), + vec![method.clone()], ); let tool = AgentMcpTool { tool: Tool { @@ -726,21 +743,8 @@ mod tests { account_id: harness.account_id, schema_graph: Arc::new(SchemaGraph::empty()), account_email: golem_common::model::account::AccountEmail::new("mcp@golem"), - constructor: AgentConstructorSchema { - name: None, - description: String::new(), - prompt_hint: None, - input_schema: InputSchema::Parameters(vec![]), - }, - method: AgentMethodSchema { - name: "run".to_string(), - description: String::new(), - prompt_hint: None, - input_schema: InputSchema::Parameters(vec![]), - output_schema: OutputSchema::Unit, - http_endpoint: vec![], - read_only: None, - }, + constructor, + method, component_id: harness.component_id, agent_type_name: AgentTypeName("mcp-agent".to_string()), agent_mode: AgentMode::Ephemeral, @@ -761,18 +765,43 @@ mod tests { // `method_id`. The invoke path must translate those advertised names // back and route each value to the correct side (different types make // a swap observable: constructor = string, method = u32). - let harness = InvocationHarness::new(AgentInvocationOutput { - result: golem_common::model::AgentInvocationResult::AgentMethod { - output: SchemaValue::Tuple { elements: vec![] }, + let constructor = AgentConstructorSchema { + name: None, + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(vec![NamedField::user_supplied( + "id", + SchemaType::string(), + )]), + }; + let method = AgentMethodSchema { + name: "run".to_string(), + description: String::new(), + prompt_hint: None, + input_schema: InputSchema::Parameters(vec![NamedField::user_supplied( + "id", + SchemaType::u32(), + )]), + output_schema: OutputSchema::Unit, + http_endpoint: vec![], + read_only: None, + }; + let harness = InvocationHarness::new( + AgentInvocationOutput { + result: golem_common::model::AgentInvocationResult::AgentMethod { + output: SchemaValue::Tuple { elements: vec![] }, + }, + consumed_fuel: None, + invocation_status: None, + component_revision: None, + agent_id: None, + idempotency_key: None, + oplog_index: None, + agent_fingerprint: None, }, - consumed_fuel: None, - invocation_status: None, - component_revision: None, - agent_id: None, - idempotency_key: None, - oplog_index: None, - agent_fingerprint: None, - }); + constructor.clone(), + vec![method.clone()], + ); let tool = AgentMcpTool { tool: Tool { name: Cow::Borrowed("mcp-agent-run"), @@ -789,27 +818,8 @@ mod tests { account_id: harness.account_id, account_email: harness.account_email.clone(), schema_graph: Arc::new(SchemaGraph::empty()), - constructor: AgentConstructorSchema { - name: None, - description: String::new(), - prompt_hint: None, - input_schema: InputSchema::Parameters(vec![NamedField::user_supplied( - "id", - SchemaType::string(), - )]), - }, - method: AgentMethodSchema { - name: "run".to_string(), - description: String::new(), - prompt_hint: None, - input_schema: InputSchema::Parameters(vec![NamedField::user_supplied( - "id", - SchemaType::u32(), - )]), - output_schema: OutputSchema::Unit, - http_endpoint: vec![], - read_only: None, - }, + constructor, + method, component_id: harness.component_id, agent_type_name: AgentTypeName("mcp-agent".to_string()), agent_mode: AgentMode::Ephemeral, diff --git a/golem-worker-service/src/service/worker/client.rs b/golem-worker-service/src/service/worker/client.rs index cded1d27ef..d85a24e64f 100644 --- a/golem-worker-service/src/service/worker/client.rs +++ b/golem-worker-service/src/service/worker/client.rs @@ -17,15 +17,19 @@ use super::{ AllExecutors, CallWorkerExecutorError, HasWorkerExecutorClients, RandomExecutor, ResponseMapResult, RoutingLogic, WorkerServiceError, WorkerStream, }; +use crate::service::auth::AuthServiceError; use async_trait::async_trait; use bytes::Bytes; use futures::stream::TryStreamExt; use futures::{Stream, StreamExt}; -use golem_api_grpc::proto::golem::worker::invocation_frame; -use golem_api_grpc::proto::golem::worker::invocation_result; -use golem_api_grpc::proto::golem::worker::invocation_session_finished; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; +use golem_api_grpc::proto::golem::worker::invocation_request; +use golem_api_grpc::proto::golem::worker::invocation_response; +use golem_api_grpc::proto::golem::worker::invocation_session_completion; +use golem_api_grpc::proto::golem::worker::invocation_session_result; use golem_api_grpc::proto::golem::worker::{ - InvocationContext, InvocationFrame, InvocationProtocolFailure, InvocationResult, + InvocationContext, InvocationFailure, InvocationFailureKind, InvocationRejected, + InvocationRejectionReason, InvocationRequest, InvocationResponse, InvocationSessionResult, InvocationStart, LogEvent, }; use golem_api_grpc::proto::golem::workerexecutor; @@ -82,16 +86,16 @@ fn freshness_disposition_for_dispatch( } } -pub type InvocationRequestStream = Pin + Send + 'static>>; +pub type InvocationRequestStream = Pin + Send + 'static>>; pub type InvocationResponseStream = - Pin> + Send + 'static>>; + Pin> + Send + 'static>>; fn invoke_agent_session_once<'a>( client: &'a mut WorkerExecutorClient>, request: Option, ) -> Pin< Box< - dyn Future>, Status>> + dyn Future>, Status>> + Send + 'a, >, @@ -107,26 +111,70 @@ fn invoke_agent_session_once<'a>( #[derive(Debug)] enum OneShotInvocationSessionResult { Success(AgentInvocationOutput), - Failure(golem_api_grpc::proto::golem::worker::v1::WorkerExecutionError), - ProtocolFailure(InvocationProtocolFailure), + Rejected(InvocationRejected), + Failure(InvocationFailure), + ProtocolFailure(String), } fn protocol_failure(details: impl Into) -> OneShotInvocationSessionResult { - OneShotInvocationSessionResult::ProtocolFailure(InvocationProtocolFailure { - kind: golem_api_grpc::proto::golem::worker::invocation_protocol_failure::Kind::Protocol - as i32, - details: details.into(), - }) + OneShotInvocationSessionResult::ProtocolFailure(details.into()) +} + +fn decode_invocation_rejection(rejected: InvocationRejected) -> WorkerServiceError { + match InvocationRejectionReason::try_from(rejected.reason) { + Ok(InvocationRejectionReason::NotFound) => rejected + .agent_id + .map(TryInto::try_into) + .transpose() + .map_err(WorkerServiceError::TypeChecker) + .and_then(|agent_id| { + agent_id + .map(WorkerServiceError::AgentNotFound) + .ok_or_else(|| WorkerServiceError::Internal(rejected.error.clone())) + }) + .unwrap_or_else(|error| error), + Ok(InvocationRejectionReason::Unauthorized) => { + WorkerServiceError::AuthError(AuthServiceError::CouldNotAuthenticate) + } + Ok(InvocationRejectionReason::Internal) => WorkerServiceError::Internal(rejected.error), + _ => WorkerServiceError::TypeChecker(rejected.error), + } +} + +fn decode_invocation_failure(failure: InvocationFailure) -> WorkerExecutorError { + if failure.kind == InvocationFailureKind::Protocol as i32 { + WorkerExecutorError::invalid_request(failure.message) + } else if let Some(worker_error) = failure.worker_error { + worker_error + .try_into() + .unwrap_or_else(|error| WorkerExecutorError::Unknown { + details: format!("failed to decode worker execution error: {error}"), + }) + } else { + WorkerExecutorError::Unknown { + details: failure.message, + } + } } -fn decode_invocation_result(wire: InvocationResult) -> Result { +fn decode_invocation_result( + wire: InvocationSessionResult, +) -> Result { let result = match wire.result.ok_or("invocation result has no payload")? { - invocation_result::Result::MethodResult(value) => AgentInvocationResult::AgentMethod { - output: value.try_into()?, - }, - invocation_result::Result::NoResult(_) => AgentInvocationResult::AgentInitialization, + invocation_session_result::Result::MethodResult(value) => { + AgentInvocationResult::AgentMethod { + output: value.try_into()?, + } + } + invocation_session_result::Result::NoResult(_) => { + AgentInvocationResult::AgentInitialization + } }; - let invocation_status = result_status(wire.status); + let invocation_status = wire.status.and_then(|status| { + golem_api_grpc::proto::golem::worker::InvocationStatus::try_from(status) + .ok() + .map(InvocationStatus::from) + }); Ok(AgentInvocationOutput { result, consumed_fuel: wire.fuel_consumed, @@ -145,88 +193,83 @@ fn decode_invocation_result(wire: InvocationResult) -> Result) -> Option { - status.and_then(|status| { - golem_api_grpc::proto::golem::worker::InvocationStatus::try_from(status) - .ok() - .map(InvocationStatus::from) - }) -} - async fn run_one_shot_invocation_session( client: &mut WorkerExecutorClient>, start: InvocationStart, ) -> Result { let (requests, receiver) = mpsc::channel(1); + let request = InvocationRequest { + request: Some(invocation_request::Request::Start(start)), + }; + let mut state = InvocationSessionState::default(); + state + .validate_trusted_request(&request) + .map_err(Status::invalid_argument)?; requests - .send(InvocationFrame { - frame: Some(invocation_frame::Frame::Start(start)), - }) + .send(request) .await .map_err(|_| Status::unavailable("invocation session request ended before start"))?; let responses = client .invoke_agent_session(ReceiverStream::new(receiver)) .await? .into_inner(); - collect_one_shot_invocation_session(responses).await + collect_one_shot_invocation_session(responses, state).await } async fn collect_one_shot_invocation_session( mut responses: S, + mut state: InvocationSessionState, ) -> Result where - S: Stream> + Unpin, + S: Stream> + Unpin, { - let mut state = golem_api_grpc::InvocationResponseState::default(); let mut result = None; let mut terminal_outcome = None; - while let Some(frame) = responses.next().await.transpose()? { - if let Err(details) = state.validate(&frame) { + while let Some(response) = responses.next().await.transpose()? { + if let Err(details) = state.validate_response(&response) { return Ok(protocol_failure(details)); } - match frame.frame { - Some(invocation_frame::Frame::Result(invocation_result)) => { + match response.response { + Some(invocation_response::Response::Accepted(_)) => {} + Some(invocation_response::Response::Rejected(rejected)) => { + terminal_outcome = Some(Ok(OneShotInvocationSessionResult::Rejected(rejected))); + } + Some(invocation_response::Response::Result(invocation_result)) => { result = match decode_invocation_result(invocation_result) { Ok(result) => Some(result), Err(details) => return Ok(protocol_failure(details)), }; } - Some(invocation_frame::Frame::Finished(finished)) => { + Some(invocation_response::Response::Finished(finished)) => { terminal_outcome = Some(match finished.outcome { - Some(invocation_session_finished::Outcome::Success(_)) => result + Some(invocation_session_completion::Outcome::Success(_)) => result .take() .map(OneShotInvocationSessionResult::Success) .ok_or_else(|| Status::internal("invocation completed without a result")), - Some(invocation_session_finished::Outcome::Failure(failure)) => { - Ok(OneShotInvocationSessionResult::Failure(failure)) - } - Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { - if failure.kind - == golem_api_grpc::proto::golem::worker::invocation_protocol_failure::Kind::Transport - as i32 - { - Err(Status::unavailable(failure.details)) + Some(invocation_session_completion::Outcome::Failure(failure)) => { + if failure.kind == InvocationFailureKind::Transport as i32 { + Err(Status::unavailable(failure.message)) } else { - Ok(OneShotInvocationSessionResult::ProtocolFailure(failure)) + Ok(OneShotInvocationSessionResult::Failure(failure)) } } None => Ok(protocol_failure("invocation completion has no outcome")), }); } Some( - invocation_frame::Frame::Demand(_) - | invocation_frame::Frame::Item(_) - | invocation_frame::Frame::End(_) - | invocation_frame::Frame::StreamError(_) - | invocation_frame::Frame::Detach(_), + invocation_response::Response::OutputItem(_) + | invocation_response::Response::OutputEnd(_) + | invocation_response::Response::OutputError(_) + | invocation_response::Response::InputAck(_) + | invocation_response::Response::StreamCancel(_), ) => { return Ok(protocol_failure( "a non-streaming invocation received a stream frame", )); } - Some(invocation_frame::Frame::Start(_) | invocation_frame::Frame::Cancel(_)) => { - unreachable!("response validation rejects request frames") + Some(invocation_response::Response::AttachmentRevoked(_)) => { + unreachable!("response validation rejects attachment revocation") } None => unreachable!("response validation rejects empty frames"), } @@ -1602,9 +1645,14 @@ impl WorkerClient for WorkerExecutorWorkerClient { }, |outcome| match outcome { OneShotInvocationSessionResult::Success(output) => Ok(output), - OneShotInvocationSessionResult::Failure(error) => Err(error.into()), - OneShotInvocationSessionResult::ProtocolFailure(failure) => { - Err(WorkerExecutorError::invalid_request(failure.details).into()) + OneShotInvocationSessionResult::Rejected(rejected) => { + Err(decode_invocation_rejection(rejected).into()) + } + OneShotInvocationSessionResult::Failure(failure) => { + Err(decode_invocation_failure(failure).into()) + } + OneShotInvocationSessionResult::ProtocolFailure(details) => { + Err(WorkerExecutorError::invalid_request(details).into()) } }, WorkerServiceError::InternalCallError, @@ -1777,124 +1825,211 @@ mod freshness_tests { #[cfg(test)] mod one_shot_session_tests { - use super::{OneShotInvocationSessionResult, collect_one_shot_invocation_session}; + use super::{ + OneShotInvocationSessionResult, collect_one_shot_invocation_session, + decode_invocation_failure, + }; use futures::stream; + use golem_api_grpc::invocation_session_protocol::InvocationSessionState; use golem_api_grpc::proto::golem::common::Empty; - use golem_api_grpc::proto::golem::worker::invocation_result; - use golem_api_grpc::proto::golem::worker::invocation_session_finished::Outcome; - use golem_api_grpc::proto::golem::worker::v1::WorkerExecutionError; + use golem_api_grpc::proto::golem::schema::{SchemaValue, schema_value}; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame, InvocationProtocolFailure, InvocationResult, InvocationSessionFinished, - InvocationStatus, invocation_frame, invocation_protocol_failure, + AgentId, IdempotencyKey, InvocationAccepted, InvocationFailure, InvocationFailureKind, + InvocationRequest, InvocationResponse, InvocationSessionCompletion, + InvocationSessionResult, InvocationStart, invocation_request, invocation_response, + invocation_session_completion, invocation_session_result, }; - use golem_common::model::InvocationStatus as ModelInvocationStatus; + use golem_common::model::AgentFingerprint; + use golem_common::model::oplog::{AgentError, OplogIndex}; + use golem_service_base::error::worker_executor::WorkerExecutorError; use test_r::test; use tonic::Status; - fn frame(frame: invocation_frame::Frame) -> Result { - Ok(InvocationFrame { frame: Some(frame) }) + fn key() -> Option { + Some(IdempotencyKey { + value: "session-key".to_string(), + }) } - fn finished(outcome: Outcome) -> invocation_frame::Frame { - invocation_frame::Frame::Finished(InvocationSessionFinished { - outcome: Some(outcome), + fn agent_id() -> Option { + Some( + golem_common::model::AgentId { + component_id: golem_common::model::component::ComponentId(uuid::Uuid::nil()), + agent_id: "agent".to_string(), + } + .into(), + ) + } + + fn state_after_start() -> InvocationSessionState { + let mut state = InvocationSessionState::default(); + state + .validate_trusted_request(&InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { + input: Some(SchemaValue { + value: Some(schema_value::Value::U8Value(1)), + }), + idempotency_key: key(), + ..Default::default() + })), + }) + .unwrap(); + state + } + + fn frame(response: invocation_response::Response) -> Result { + Ok(InvocationResponse { + response: Some(response), + }) + } + + fn accepted() -> invocation_response::Response { + invocation_response::Response::Accepted(InvocationAccepted { + agent_id: agent_id(), + idempotency_key: key(), + component_revision: Some(3), }) } - fn no_result() -> invocation_frame::Frame { - invocation_frame::Frame::Result(InvocationResult { - result: Some(invocation_result::Result::NoResult(Empty {})), + fn no_result() -> invocation_response::Response { + invocation_response::Response::Result(InvocationSessionResult { + result: Some(invocation_session_result::Result::NoResult(Empty {})), + component_revision: Some(3), + agent_id: agent_id(), + idempotency_key: key(), ..Default::default() }) } + fn finished(outcome: invocation_session_completion::Outcome) -> invocation_response::Response { + invocation_response::Response::Finished(InvocationSessionCompletion { + outcome: Some(outcome), + }) + } + #[test] async fn successful_session_preserves_unary_result_metadata() { let responses = stream::iter([ - frame(invocation_frame::Frame::Result(InvocationResult { - result: Some(invocation_result::Result::NoResult(Empty {})), - fuel_consumed: Some(17), - component_revision: Some(3), - status: Some(InvocationStatus::Complete as i32), - oplog_index: Some(29), - agent_fingerprint: None, - agent_id: None, - idempotency_key: None, - })), - frame(finished(Outcome::Success(Empty {}))), + frame(accepted()), + frame(invocation_response::Response::Result( + InvocationSessionResult { + result: Some(invocation_session_result::Result::NoResult(Empty {})), + component_revision: Some(3), + agent_id: agent_id(), + idempotency_key: key(), + fuel_consumed: Some(17), + status: Some( + golem_api_grpc::proto::golem::worker::InvocationStatus::Complete as i32, + ), + oplog_index: Some(29), + agent_fingerprint: Some(uuid::Uuid::nil().into()), + }, + )), + frame(finished(invocation_session_completion::Outcome::Success( + Empty {}, + ))), ]); - let result = collect_one_shot_invocation_session(responses) + let result = collect_one_shot_invocation_session(responses, state_after_start()) .await .unwrap(); let OneShotInvocationSessionResult::Success(output) = result else { panic!("expected a successful invocation session"); }; - assert_eq!(output.consumed_fuel, Some(17)); + assert_eq!(output.agent_id.unwrap().agent_id, "agent"); + assert_eq!(output.idempotency_key.unwrap().value, "session-key"); assert_eq!(output.component_revision.unwrap().get(), 3); + assert_eq!(output.consumed_fuel, Some(17)); assert_eq!( output.invocation_status, - Some(ModelInvocationStatus::Complete) + Some(golem_common::model::InvocationStatus::Complete) + ); + assert_eq!(output.oplog_index, Some(OplogIndex::from_u64(29))); + assert_eq!( + output.agent_fingerprint, + Some(AgentFingerprint(uuid::Uuid::nil())) ); - assert_eq!(u64::from(output.oplog_index.unwrap()), 29); } #[test] - async fn structured_executor_failure_survives_the_session_adapter() { - let responses = stream::iter([frame(finished(Outcome::Failure( - WorkerExecutionError::default(), - )))]); + async fn typed_executor_failure_survives_the_session_adapter() { + let expected = WorkerExecutorError::InvocationFailed { + error: AgentError::Unknown("failed".to_string()), + stderr: "guest stderr".to_string(), + }; + let responses = stream::iter([ + frame(accepted()), + frame(finished(invocation_session_completion::Outcome::Failure( + InvocationFailure { + kind: InvocationFailureKind::Execution as i32, + code: "execution".to_string(), + message: "failed".to_string(), + worker_error: Some(expected.clone().into()), + }, + ))), + ]); - let result = collect_one_shot_invocation_session(responses) + let result = collect_one_shot_invocation_session(responses, state_after_start()) .await .unwrap(); - assert!(matches!( - result, - OneShotInvocationSessionResult::Failure(WorkerExecutionError { error: None }) - )); + let OneShotInvocationSessionResult::Failure(failure) = result else { + panic!("expected an invocation failure"); + }; + assert_eq!(decode_invocation_failure(failure), expected); } #[test] async fn successful_completion_before_result_is_a_protocol_failure() { - let responses = stream::iter([frame(finished(Outcome::Success(Empty {})))]); + let responses = stream::iter([ + frame(accepted()), + frame(finished(invocation_session_completion::Outcome::Success( + Empty {}, + ))), + ]); - let result = collect_one_shot_invocation_session(responses) + let result = collect_one_shot_invocation_session(responses, state_after_start()) .await .unwrap(); assert!(matches!( result, - OneShotInvocationSessionResult::ProtocolFailure(failure) - if failure.details.contains("before publishing a result") + OneShotInvocationSessionResult::ProtocolFailure(details) + if details.contains("before publishing a result") )); } #[test] async fn session_is_drained_and_rejects_frames_after_completion() { let responses = stream::iter([ + frame(accepted()), frame(no_result()), - frame(finished(Outcome::Success(Empty {}))), + frame(finished(invocation_session_completion::Outcome::Success( + Empty {}, + ))), frame(no_result()), ]); - let result = collect_one_shot_invocation_session(responses) + let result = collect_one_shot_invocation_session(responses, state_after_start()) .await .unwrap(); assert!(matches!( result, - OneShotInvocationSessionResult::ProtocolFailure(failure) - if failure.details.contains("after completion") + OneShotInvocationSessionResult::ProtocolFailure(details) + if details.contains("after completion") )); } #[test] async fn response_transport_error_after_completion_is_retriable() { let responses = stream::iter([ + frame(accepted()), frame(no_result()), - frame(finished(Outcome::Success(Empty {}))), + frame(finished(invocation_session_completion::Outcome::Success( + Empty {}, + ))), Err(Status::unavailable("response did not close cleanly")), ]); - let error = collect_one_shot_invocation_session(responses) + let error = collect_one_shot_invocation_session(responses, state_after_start()) .await .unwrap_err(); assert_eq!(error.code(), tonic::Code::Unavailable); @@ -1902,17 +2037,385 @@ mod one_shot_session_tests { #[test] async fn typed_transport_failure_is_retriable() { - let responses = stream::iter([frame(finished(Outcome::ProtocolFailure( - InvocationProtocolFailure { - kind: invocation_protocol_failure::Kind::Transport as i32, - details: "request transport failed".to_string(), - }, - )))]); + let responses = stream::iter([ + frame(accepted()), + frame(finished(invocation_session_completion::Outcome::Failure( + InvocationFailure { + kind: InvocationFailureKind::Transport as i32, + code: "transport".to_string(), + message: "request transport failed".to_string(), + worker_error: None, + }, + ))), + ]); - let error = collect_one_shot_invocation_session(responses) + let error = collect_one_shot_invocation_session(responses, state_after_start()) .await .unwrap_err(); assert_eq!(error.code(), tonic::Code::Unavailable); assert!(error.message().contains("request transport failed")); } } + +#[cfg(test)] +mod rejection_mapping_tests { + use super::{WorkerClient, WorkerExecutorWorkerClient, decode_invocation_rejection}; + use futures::{Stream, stream}; + use golem_api_grpc::proto::golem::schema::{SchemaValue, schema_value}; + use golem_api_grpc::proto::golem::shardmanager::{ + IpAddress, Pod as GrpcPod, RoutingTable as GrpcRoutingTable, RoutingTableEntry, ShardId, + ip_address, + }; + use golem_api_grpc::proto::golem::worker::v1::{AgentError, agent_error}; + use golem_api_grpc::proto::golem::worker::{ + InvocationRejected, InvocationRejectionReason, InvocationRequest, InvocationResponse, + invocation_response, + }; + use golem_api_grpc::proto::golem::workerexecutor::v1::worker_executor_server::{ + WorkerExecutor, WorkerExecutorServer, + }; + use golem_api_grpc::proto::golem::workerexecutor::v1::*; + use golem_common::model::account::AccountId; + use golem_common::model::agent::{InvocationFreshnessDisposition, Principal}; + use golem_common::model::component::ComponentId; + use golem_common::model::environment::EnvironmentId; + use golem_common::model::quota::{ResourceDefinitionId, ResourceName}; + use golem_common::model::{AgentId, RetryConfig, RoutingTable}; + use golem_service_base::clients::shard_manager::{ + BatchRenewalEntry, QuotaError, ShardManager, ShardManagerError, + }; + use golem_service_base::grpc::client::{GrpcClientConfig, MultiTargetGrpcClient}; + use golem_service_base::model::auth::AuthCtx; + use golem_service_base::model::quota_lease::{PendingReservation, QuotaLease}; + use golem_service_base::service::routing_table::{RoutingTableConfig, RoutingTableService}; + use std::net::Ipv4Addr; + use std::pin::Pin; + use std::sync::Arc; + use test_r::test; + use tokio::net::TcpListener; + use tokio_stream::wrappers::TcpListenerStream; + use tonic::codec::CompressionEncoding; + use tonic::{Request, Response, Status}; + use tonic_tracing_opentelemetry::middleware::client::OtelGrpcService; + + fn public_error_for_rejection(reason: InvocationRejectionReason) -> agent_error::Error { + let rejection = InvocationRejected { + reason: reason as i32, + error: "rejected".to_string(), + ..Default::default() + }; + let error: AgentError = decode_invocation_rejection(rejection).into(); + error.error.expect("missing public error") + } + + #[test] + fn validation_rejection_remains_a_bad_request() { + assert!(matches!( + public_error_for_rejection(InvocationRejectionReason::Validation), + agent_error::Error::BadRequest(_) + )); + } + + #[test] + fn unauthorized_rejection_remains_unauthorized() { + assert!(matches!( + public_error_for_rejection(InvocationRejectionReason::Unauthorized), + agent_error::Error::Unauthorized(_) + )); + } + + #[test] + fn internal_rejection_remains_internal() { + assert!(matches!( + public_error_for_rejection(InvocationRejectionReason::Internal), + agent_error::Error::InternalError(_) + )); + } + + #[derive(Clone)] + struct StaticShardManager(RoutingTable); + + #[async_trait::async_trait] + impl ShardManager for StaticShardManager { + async fn get_routing_table(&self) -> Result { + Ok(self.0.clone()) + } + + async fn register( + &self, + _port: u16, + _pod_name: Option, + ) -> Result { + unreachable!() + } + + async fn acquire_quota_lease( + &self, + _environment_id: EnvironmentId, + _resource_name: ResourceName, + _port: u16, + ) -> Result { + unreachable!() + } + + async fn renew_quota_lease( + &self, + _resource_definition_id: ResourceDefinitionId, + _port: u16, + _epoch: u64, + _unused: u64, + _pending_reservations: Vec, + ) -> Result { + unreachable!() + } + + async fn batch_renew_quota_leases( + &self, + _port: u16, + _renewals: Vec, + ) -> Result>, ShardManagerError> { + unreachable!() + } + + async fn release_quota_lease( + &self, + _resource_definition_id: ResourceDefinitionId, + _port: u16, + _epoch: u64, + _unused: u64, + ) -> Result<(), QuotaError> { + unreachable!() + } + } + + #[derive(Clone)] + struct RejectingExecutor; + + macro_rules! unimplemented_unary { + ($name:ident, $request:ty, $response:ty) => { + fn $name<'life0, 'async_trait>( + &'life0 self, + _request: Request<$request>, + ) -> Pin< + Box< + dyn std::future::Future, Status>> + + Send + + 'async_trait, + >, + > + where + 'life0: 'async_trait, + Self: 'async_trait, + { + Box::pin(async { Err(Status::unimplemented(stringify!($name))) }) + } + }; + } + + #[tonic::async_trait] + impl WorkerExecutor for RejectingExecutor { + type ConnectWorkerStream = Pin< + Box< + dyn Stream> + + Send, + >, + >; + type GetFileContentsStream = + Pin> + Send>>; + type InvokeAgentSessionStream = + Pin> + Send>>; + + unimplemented_unary!(create_worker, CreateWorkerRequest, CreateWorkerResponse); + unimplemented_unary!(delete_worker, DeleteWorkerRequest, DeleteWorkerResponse); + unimplemented_unary!( + complete_promise, + CompletePromiseRequest, + CompletePromiseResponse + ); + unimplemented_unary!( + interrupt_worker, + InterruptWorkerRequest, + InterruptWorkerResponse + ); + unimplemented_unary!(revoke_shards, RevokeShardsRequest, RevokeShardsResponse); + unimplemented_unary!(assign_shards, AssignShardsRequest, AssignShardsResponse); + unimplemented_unary!( + set_shard_assignment, + SetShardAssignmentRequest, + SetShardAssignmentResponse + ); + unimplemented_unary!( + get_agent_metadata, + GetAgentMetadataRequest, + GetAgentMetadataResponse + ); + unimplemented_unary!(resume_worker, ResumeWorkerRequest, ResumeWorkerResponse); + unimplemented_unary!( + get_running_workers_metadata, + GetRunningWorkersMetadataRequest, + GetRunningWorkersMetadataResponse + ); + unimplemented_unary!( + get_workers_metadata, + GetWorkersMetadataRequest, + GetWorkersMetadataResponse + ); + unimplemented_unary!(update_worker, UpdateWorkerRequest, UpdateWorkerResponse); + unimplemented_unary!(get_oplog, GetOplogRequest, GetOplogResponse); + unimplemented_unary!(search_oplog, SearchOplogRequest, SearchOplogResponse); + unimplemented_unary!(fork_worker, ForkWorkerRequest, ForkWorkerResponse); + unimplemented_unary!(revert_worker, RevertWorkerRequest, RevertWorkerResponse); + unimplemented_unary!( + cancel_invocation, + CancelInvocationRequest, + CancelInvocationResponse + ); + unimplemented_unary!( + get_file_system_node, + GetFileSystemNodeRequest, + GetFileSystemNodeResponse + ); + unimplemented_unary!( + get_agent_wallet, + GetAgentWalletRequest, + GetAgentWalletResponse + ); + unimplemented_unary!( + activate_plugin, + ActivatePluginRequest, + ActivatePluginResponse + ); + unimplemented_unary!( + deactivate_plugin, + DeactivatePluginRequest, + DeactivatePluginResponse + ); + unimplemented_unary!( + process_oplog_entries, + ProcessOplogEntriesRequest, + ProcessOplogEntriesResponse + ); + + async fn connect_worker( + &self, + _request: Request, + ) -> Result, Status> { + Err(Status::unimplemented("connect_worker")) + } + + async fn get_file_contents( + &self, + _request: Request, + ) -> Result, Status> { + Err(Status::unimplemented("get_file_contents")) + } + + async fn invoke_agent_session( + &self, + request: Request>, + ) -> Result, Status> { + let mut requests = request.into_inner(); + let start = requests.message().await?.expect("missing invocation start"); + let (idempotency_key, agent_id) = match start.request { + Some(golem_api_grpc::proto::golem::worker::invocation_request::Request::Start( + start, + )) => (start.idempotency_key, start.agent_id), + other => panic!("expected invocation start, got {other:?}"), + }; + Ok(Response::new(Box::pin(stream::iter([Ok( + InvocationResponse { + response: Some(invocation_response::Response::Rejected( + InvocationRejected { + reason: InvocationRejectionReason::NotFound as i32, + error: "agent not found".to_string(), + idempotency_key, + agent_id, + component_revision: None, + }, + )), + }, + )])))) + } + } + + #[test] + async fn unary_not_found_rejection_preserves_the_public_error_category() { + let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); + let port = listener.local_addr().unwrap().port(); + tokio::spawn(async move { + tonic::transport::Server::builder() + .add_service( + WorkerExecutorServer::new(RejectingExecutor) + .accept_compressed(CompressionEncoding::Gzip) + .send_compressed(CompressionEncoding::Gzip), + ) + .serve_with_incoming(TcpListenerStream::new(listener)) + .await + .unwrap(); + }); + + let routing_table: RoutingTable = GrpcRoutingTable { + number_of_shards: 1, + shard_assignments: vec![RoutingTableEntry { + shard_id: Some(ShardId { value: 0 }), + pod: Some(GrpcPod { + ip: Some(IpAddress { + kind: Some(ip_address::Kind::Ipv4(u32::from(Ipv4Addr::LOCALHOST))), + }), + port: port.into(), + }), + }], + } + .try_into() + .unwrap(); + let routing = Arc::new(RoutingTableService::new( + RoutingTableConfig::default(), + Arc::new(StaticShardManager(routing_table)), + )); + let clients = MultiTargetGrpcClient::new( + "provisional-rejecting-executor", + |channel: OtelGrpcService<_>, max_message_size| { + golem_api_grpc::proto::golem::workerexecutor::v1::worker_executor_client::WorkerExecutorClient::new(channel) + .send_compressed(CompressionEncoding::Gzip) + .accept_compressed(CompressionEncoding::Gzip) + .max_decoding_message_size(max_message_size) + .max_encoding_message_size(max_message_size) + }, + GrpcClientConfig::default(), + ); + let client = WorkerExecutorWorkerClient::new(clients, RetryConfig::default(), routing); + let agent_id = AgentId { + component_id: ComponentId::new(), + agent_id: "missing".to_string(), + }; + + let error = client + .invoke_agent( + &agent_id, + Some("run".to_string()), + Some(SchemaValue { + value: Some(schema_value::Value::TupleValue(Default::default())), + }), + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + None, + Some(golem_common::model::IdempotencyKey::new( + "session-key".to_string(), + )), + None, + InvocationFreshnessDisposition::MayExist, + vec![], + EnvironmentId::new(), + AccountId::new(), + AuthCtx::System, + Principal::anonymous().into(), + ) + .await + .unwrap_err(); + + let public_error: AgentError = error.into(); + assert!( + matches!(public_error.error, Some(agent_error::Error::NotFound(_))), + "InvocationRejected(NotFound) must remain a public not-found error, got {public_error:?}" + ); + } +} diff --git a/golem-worker-service/src/service/worker/service.rs b/golem-worker-service/src/service/worker/service.rs index 0413b7dea6..cbab762aea 100644 --- a/golem-worker-service/src/service/worker/service.rs +++ b/golem-worker-service/src/service/worker/service.rs @@ -28,7 +28,8 @@ use crate::service::limit::LimitService; use bytes::Bytes; use futures::{Stream, StreamExt, stream}; use golem_api_grpc::proto::golem::worker::{ - InvocationContext, InvocationFrame, InvocationStart, invocation_frame, + InvocationContext, InvocationRequest, InvocationStart, PublicInvocationStart, + invocation_request, }; use golem_common::model::AgentInvocationOutput; use golem_common::model::account::AccountId; @@ -36,6 +37,7 @@ use golem_common::model::agent::{ AgentMode, AgentTypeName, GolemUserPrincipal, InvocationFreshnessDisposition, ParsedAgentId, Principal, ephemeral_invocation_phantom_id, }; +use golem_common::model::application::ApplicationName; use golem_common::model::card::owner::{AgentOwnerLeafPattern, AgentOwnerPattern}; use golem_common::model::card::{ AgentMethodName, AgentResourcePattern, AgentVerb, ClassPermissionTarget, PermissionTarget, @@ -45,7 +47,7 @@ use golem_common::model::component::{ CanonicalFilePath, ComponentId, ComponentName, ComponentRevision, PluginPriority, }; use golem_common::model::deployment::DeploymentRevision; -use golem_common::model::environment::EnvironmentId; +use golem_common::model::environment::{EnvironmentId, EnvironmentName}; use golem_common::model::oplog::OplogCursor; use golem_common::model::oplog::OplogIndex; use golem_common::model::worker::AgentConfigEntryDto; @@ -53,7 +55,12 @@ use golem_common::model::worker::AgentUpdateMode; use golem_common::model::worker::{AgentMetadataDto, RevertWorkerTarget}; use golem_common::model::{AgentFilter, AgentFingerprint, AgentId, IdempotencyKey, ScanCursor}; use golem_common::schema::json_input_schema_value_to_typed_schema_value; -use golem_common::schema::{SchemaType, TypedSchemaValue}; +use golem_common::schema::stream::SchemaValueStream; +use golem_common::schema::{ + ResultValuePayload, SchemaType, SchemaValue, TypedSchemaValue, UnionValuePayload, + VariantValuePayload, +}; +use golem_service_base::error::worker_executor::WorkerExecutorError; use golem_service_base::model::auth::AuthCtx; use golem_service_base::model::component::Component; use golem_service_base::model::{ComponentFileSystemNode, GetOplogResponse}; @@ -98,6 +105,188 @@ fn build_public_invocation_agent_id( }) } +fn validate_one_shot_invocation_is_stream_free( + component: &Component, + agent_id: &AgentId, + method_name: &str, + method_parameters: &golem_api_grpc::proto::golem::schema::SchemaValue, +) -> WorkerResult<()> { + let parsed_agent_id = ParsedAgentId::parse(&agent_id.agent_id, &component.metadata) + .map_err(WorkerServiceError::TypeChecker)?; + let agent_type = component + .metadata + .find_agent_type_by_name_ref(&parsed_agent_id.agent_type) + .ok_or_else(|| { + WorkerServiceError::TypeChecker(format!( + "Agent type '{}' not found", + parsed_agent_id.agent_type + )) + })?; + let method = agent_type + .methods + .iter() + .find(|method| method.name == method_name) + .ok_or_else(|| { + WorkerServiceError::TypeChecker(format!( + "Agent method '{method_name}' not found in agent type '{}'", + agent_type.type_name + )) + })?; + let input = SchemaValue::try_from(method_parameters.clone()) + .map_err(WorkerServiceError::TypeChecker)?; + method + .validate_input(&agent_type.schema, &input) + .map_err(|error| { + WorkerServiceError::TypeChecker(format!( + "Invalid input for agent method '{method_name}': {error}" + )) + })?; + if method.uses_streams(&agent_type.schema) { + Err(WorkerServiceError::TypeChecker( + "Streaming agent methods require an attached invocation session".to_string(), + )) + } else { + Ok(()) + } +} + +fn decode_public_session_schema_value( + value: golem_api_grpc::proto::golem::schema::SchemaValue, +) -> Result { + decode_public_schema_value(value, true) +} + +pub(crate) fn validate_public_session_schema_value( + value: &golem_api_grpc::proto::golem::schema::SchemaValue, +) -> Result<(), String> { + decode_public_session_schema_value(value.clone()).map(|_| ()) +} + +fn decode_public_schema_value( + value: golem_api_grpc::proto::golem::schema::SchemaValue, + allow_stream_references: bool, +) -> Result { + use golem_api_grpc::proto::golem::schema::{result_value, schema_value}; + + let value = value + .value + .ok_or_else(|| "Missing field: SchemaValue.value".to_string())?; + match value { + schema_value::Value::RecordValue(record) => Ok(SchemaValue::Record { + fields: record + .fields + .into_iter() + .map(|value| decode_public_schema_value(value, allow_stream_references)) + .collect::>()?, + }), + schema_value::Value::VariantValue(variant) => { + Ok(SchemaValue::Variant(VariantValuePayload { + case: variant.case, + payload: variant + .payload + .map(|payload| { + decode_public_schema_value(*payload, allow_stream_references).map(Box::new) + }) + .transpose()?, + })) + } + schema_value::Value::TupleValue(tuple) => Ok(SchemaValue::Tuple { + elements: tuple + .elements + .into_iter() + .map(|value| decode_public_schema_value(value, allow_stream_references)) + .collect::>()?, + }), + schema_value::Value::ListValue(list) => Ok(SchemaValue::List { + elements: list + .elements + .into_iter() + .map(|value| decode_public_schema_value(value, allow_stream_references)) + .collect::>()?, + }), + schema_value::Value::FixedListValue(list) => Ok(SchemaValue::FixedList { + elements: list + .elements + .into_iter() + .map(|value| decode_public_schema_value(value, allow_stream_references)) + .collect::>()?, + }), + schema_value::Value::MapValue(map) => Ok(SchemaValue::Map { + entries: map + .entries + .into_iter() + .map(|entry| { + let key = entry + .key + .ok_or_else(|| "Missing field: MapEntry.key".to_string())?; + let value = entry + .value + .ok_or_else(|| "Missing field: MapEntry.value".to_string())?; + Ok(( + decode_public_schema_value(key, allow_stream_references)?, + decode_public_schema_value(value, allow_stream_references)?, + )) + }) + .collect::>()?, + }), + schema_value::Value::OptionValue(option) => Ok(SchemaValue::Option { + inner: option + .inner + .map(|inner| { + decode_public_schema_value(*inner, allow_stream_references).map(Box::new) + }) + .transpose()?, + }), + schema_value::Value::ResultValue(result) => match result.result { + Some(result_value::Result::Ok(value)) => { + Ok(SchemaValue::Result(ResultValuePayload::Ok { + value: Some(Box::new(decode_public_schema_value( + *value, + allow_stream_references, + )?)), + })) + } + Some(result_value::Result::OkUnit(_)) => { + Ok(SchemaValue::Result(ResultValuePayload::Ok { value: None })) + } + Some(result_value::Result::Err(value)) => { + Ok(SchemaValue::Result(ResultValuePayload::Err { + value: Some(Box::new(decode_public_schema_value( + *value, + allow_stream_references, + )?)), + })) + } + Some(result_value::Result::ErrUnit(_)) => { + Ok(SchemaValue::Result(ResultValuePayload::Err { value: None })) + } + None => Err("Missing field: ResultValue.result".to_string()), + }, + schema_value::Value::UnionValue(union) => { + let body = union + .body + .ok_or_else(|| "Missing field: UnionValue.body".to_string())?; + Ok(SchemaValue::Union(UnionValuePayload { + tag: union.tag, + body: Box::new(decode_public_schema_value(*body, allow_stream_references)?), + })) + } + schema_value::Value::SecretValue(_) | schema_value::Value::QuotaTokenValue(_) => { + Err("host-managed capability values cannot cross the public boundary".to_string()) + } + schema_value::Value::StreamReference(reference) if allow_stream_references => Ok( + SchemaValue::Stream(SchemaValueStream::from_host_endpoint(reference.stream_id)), + ), + schema_value::Value::StreamReference(reference) => Err(format!( + "stream reference {} is not valid in constructor parameters", + reference.stream_id + )), + value => { + golem_api_grpc::proto::golem::schema::SchemaValue { value: Some(value) }.try_into() + } + } +} + fn normalize_agent_invocation_identity( component: &Component, agent_id: &AgentId, @@ -1047,8 +1236,208 @@ impl WorkerService { } }; let request = stream::once(async move { - InvocationFrame { - frame: Some(invocation_frame::Frame::Start(start)), + InvocationRequest { + request: Some(invocation_request::Request::Start(start)), + } + }) + .chain(tail); + self.worker_client + .invoke_agent_session(&agent_id, Box::pin(request)) + .await + } + + pub async fn invoke_public_agent_session( + &self, + start: PublicInvocationStart, + tail: InvocationRequestStream, + auth: AuthCtx, + ) -> WorkerResult { + let app_name = ApplicationName::try_from(start.application_name) + .map_err(WorkerServiceError::TypeChecker)?; + let env_name = EnvironmentName::try_from(start.environment_name) + .map_err(WorkerServiceError::TypeChecker)?; + let agent_type_name = AgentTypeName(start.agent_type_name); + let method_name = start.method_name; + let constructor_parameters = decode_public_schema_value( + start.constructor_parameters.ok_or_else(|| { + WorkerServiceError::TypeChecker( + "public invocation has no constructor parameters".to_string(), + ) + })?, + false, + ) + .map_err(|error| { + WorkerServiceError::TypeChecker(format!( + "Agent constructor parameters cannot cross the public boundary: {error}" + )) + })?; + let proto_method_parameters = start.method_parameters.ok_or_else(|| { + WorkerServiceError::TypeChecker( + "public invocation has no method parameters".to_string(), + ) + })?; + let method_parameters = decode_public_session_schema_value(proto_method_parameters.clone()) + .map_err(|error| { + WorkerServiceError::TypeChecker(format!( + "Agent method parameters cannot cross the public boundary: {error}" + )) + })?; + let phantom_id = start + .phantom_id + .map(TryInto::try_into) + .transpose() + .map_err(|error| { + WorkerServiceError::TypeChecker(format!("Invalid phantom id: {error}")) + })?; + let idempotency_key: IdempotencyKey = start + .idempotency_key + .ok_or_else(|| { + WorkerServiceError::TypeChecker( + "public invocation requires an idempotency key".to_string(), + ) + })? + .into(); + let config = start + .config + .into_iter() + .map(AgentConfigEntryDto::try_from) + .collect::, _>>() + .map_err(|error| { + WorkerServiceError::TypeChecker(format!( + "Agent configuration cannot cross the public boundary: {error}" + )) + })?; + + let resolved = self + .agent_resolution_cache + .resolve(&app_name, &env_name, &agent_type_name, None, &auth) + .await?; + let registered_agent_type = &resolved.registered_agent_type; + let environment_id = resolved.environment_id; + let component_id = registered_agent_type.implemented_by.component_id; + let agent_type = ®istered_agent_type.agent_type; + + let constructor_parameters = json_input_schema_value_to_typed_schema_value( + constructor_parameters, + &agent_type.schema, + &agent_type.constructor.input_schema, + ) + .map_err(|error| { + WorkerServiceError::TypeChecker(format!( + "Agent constructor parameters type error: {error}" + )) + })?; + let agent_id = build_public_invocation_agent_id( + component_id, + agent_type_name.clone(), + constructor_parameters, + phantom_id, + )?; + let component = self + .component_service + .get_revision( + component_id, + registered_agent_type.implemented_by.component_revision, + ) + .await?; + let component_owner_account_id = registered_agent_type.implemented_by.account_id; + let component_name = registered_agent_type.implemented_by.component_name.clone(); + let component_owner_account_email = + registered_agent_type.implemented_by.account_email.clone(); + let (agent_id, idempotency_key, freshness_disposition, observation_only) = self + .prepare_agent_invocation_identity( + &component, + &agent_id, + Some(idempotency_key), + false, + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + InvocationFreshnessDisposition::MayExist, + |final_agent_id| { + auth.authorize_permission(&PermissionTarget::Agent(ClassPermissionTarget { + owner: AgentOwnerPattern::Agent { + account: component_owner_account_email, + application: app_name, + environment: env_name, + component: ComponentName(component_name), + agent: AgentOwnerLeafPattern::Agent(final_agent_id.agent_id.clone()), + }, + verb: Some(AgentVerb::Invoke), + resource: AgentResourcePattern::Method(AgentMethodName( + method_name.clone(), + )), + })) + .map_err(AuthServiceError::from) + .map_err(WorkerServiceError::from) + }, + )?; + debug_assert!(!observation_only); + let invocation_component = self + .component_for_invocation( + &component, + &agent_id, + environment_id, + &auth, + freshness_disposition, + ) + .await?; + let invocation_agent_type = invocation_component + .metadata + .find_agent_type_by_name_ref(&agent_type_name) + .ok_or_else(|| { + WorkerServiceError::Internal(format!( + "Agent type {agent_type_name} not found in component metadata at revision {}", + invocation_component.revision + )) + })?; + let method = invocation_agent_type + .methods + .iter() + .find(|method| method.name == method_name) + .ok_or_else(|| { + WorkerServiceError::Internal(format!( + "Agent method {method_name} not found in agent type {agent_type_name}" + )) + })?; + let _validated_method_parameters = json_input_schema_value_to_typed_schema_value( + method_parameters, + &invocation_agent_type.schema, + &method.input_schema, + ) + .map_err(|error| { + WorkerServiceError::TypeChecker(format!("Agent method parameters type error: {error}")) + })?; + let principal: golem_api_grpc::proto::golem::component::Principal = + Principal::GolemUser(GolemUserPrincipal { + account_id: auth.account_id(), + }) + .into(); + let trusted_start = InvocationStart { + agent_id: Some(agent_id.clone().into()), + method_name: Some(method_name), + input: Some(proto_method_parameters), + idempotency_key: Some(idempotency_key.into()), + context: None, + auth_ctx: Some(auth.into()), + principal: Some(principal), + environment_id: Some(environment_id.into()), + config: config.into_iter().map(Into::into).collect(), + component_owner_account_id: Some(component_owner_account_id.into()), + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + schedule_at: None, + freshness_disposition: match freshness_disposition { + InvocationFreshnessDisposition::MayExist => { + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32 + } + InvocationFreshnessDisposition::KnownFresh => { + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::KnownFresh + as i32 + } + }, + }; + let request = stream::once(async move { + InvocationRequest { + request: Some(invocation_request::Request::Start(trusted_start)), } }) .chain(tail); @@ -1080,6 +1469,67 @@ impl WorkerService { principal: golem_api_grpc::proto::golem::component::Principal, authorize: impl FnOnce(&AgentId) -> WorkerResult<()>, ) -> WorkerResult { + let (agent_id, idempotency_key, freshness_disposition, observation_only) = self + .prepare_agent_invocation_identity( + component, + agent_id, + idempotency_key, + allow_derived_ephemeral_phantom, + mode, + freshness_disposition, + authorize, + )?; + + let validation_component = if observation_only { + None + } else { + Some( + self.component_for_invocation( + component, + &agent_id, + environment_id, + &auth_ctx, + freshness_disposition, + ) + .await?, + ) + }; + + self.dispatch_prepared_agent_invocation( + validation_component.as_ref(), + agent_id, + method_name, + method_parameters, + mode, + schedule_at, + idempotency_key, + invocation_context, + freshness_disposition, + config, + environment_id, + account_id, + auth_ctx, + principal, + ) + .await + } + + #[allow(clippy::too_many_arguments)] + fn prepare_agent_invocation_identity( + &self, + component: &Component, + agent_id: &AgentId, + idempotency_key: Option, + allow_derived_ephemeral_phantom: bool, + mode: i32, + freshness_disposition: InvocationFreshnessDisposition, + authorize: impl FnOnce(&AgentId) -> WorkerResult<()>, + ) -> WorkerResult<( + AgentId, + IdempotencyKey, + InvocationFreshnessDisposition, + bool, + )> { let observation_only = mode == golem_api_grpc::proto::golem::worker::AgentInvocationMode::Lookup as i32; let (agent_id, idempotency_key, mut freshness_disposition) = @@ -1095,6 +1545,50 @@ impl WorkerService { freshness_disposition = InvocationFreshnessDisposition::MayExist; } authorize(&agent_id)?; + Ok(( + agent_id, + idempotency_key, + freshness_disposition, + observation_only, + )) + } + + #[allow(clippy::too_many_arguments)] + async fn dispatch_prepared_agent_invocation( + &self, + validation_component: Option<&Component>, + agent_id: AgentId, + method_name: Option, + method_parameters: Option, + mode: i32, + schedule_at: Option<::prost_types::Timestamp>, + idempotency_key: IdempotencyKey, + invocation_context: Option, + freshness_disposition: InvocationFreshnessDisposition, + config: Vec, + environment_id: EnvironmentId, + account_id: AccountId, + auth_ctx: AuthCtx, + principal: golem_api_grpc::proto::golem::component::Principal, + ) -> WorkerResult { + if let Some(validation_component) = validation_component { + let method_name = method_name.as_deref().ok_or_else(|| { + WorkerServiceError::TypeChecker( + "method_name is required for non-lookup invocations".to_string(), + ) + })?; + let method_parameters = method_parameters.as_ref().ok_or_else(|| { + WorkerServiceError::TypeChecker( + "method_parameters are required for non-lookup invocations".to_string(), + ) + })?; + validate_one_shot_invocation_is_stream_free( + validation_component, + &agent_id, + method_name, + method_parameters, + )?; + } let mut output = self .worker_client @@ -1119,6 +1613,41 @@ impl WorkerService { Ok(output) } + async fn component_for_invocation( + &self, + fallback: &Component, + agent_id: &AgentId, + environment_id: EnvironmentId, + auth_ctx: &AuthCtx, + freshness_disposition: InvocationFreshnessDisposition, + ) -> WorkerResult { + if freshness_disposition == InvocationFreshnessDisposition::KnownFresh { + return Ok(fallback.clone()); + } + + let component_revision = match self + .worker_client + .get_metadata(agent_id, environment_id, auth_ctx.clone()) + .await + { + Ok(metadata) => metadata.component_revision, + Err(WorkerServiceError::AgentNotFound(_)) + | Err(WorkerServiceError::GolemError(WorkerExecutorError::AgentNotFound { .. })) => { + return Ok(fallback.clone()); + } + Err(error) => return Err(error), + }; + + if component_revision == fallback.revision { + Ok(fallback.clone()) + } else { + Ok(self + .component_service + .get_revision(fallback.id, component_revision) + .await?) + } + } + /// REST path: resolves the agent via the registry, validates its parameters, then creates it. pub async fn create_agent_rest( &self, @@ -1262,27 +1791,81 @@ impl WorkerService { registered_agent_type.implemented_by.component_revision, ) .await?; - let component_name = registered_agent_type.implemented_by.component_name.clone(); let component_owner_account_id = registered_agent_type.implemented_by.account_id; let component_owner_account_email = registered_agent_type.implemented_by.account_email.clone(); - - let method = agent_type - .methods - .iter() - .find(|m| m.name == request.method_name) - .ok_or_else(|| { - WorkerServiceError::Internal(format!( - "Agent method {} not found in agent type {}", - request.method_name, request.agent_type_name - )) - })?; - - let method_parameters = json_input_schema_value_to_typed_schema_value( - request.method_parameters, - &agent_type.schema, - &method.input_schema, + let method_name = request.method_name.clone(); + let agent_type_name = request.agent_type_name.clone(); + let proto_mode = match request.mode { + AgentInvocationMode::Await => { + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32 + } + AgentInvocationMode::Schedule => { + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule as i32 + } + }; + let (agent_id, idempotency_key, freshness_disposition, observation_only) = self + .prepare_agent_invocation_identity( + &component, + &agent_id, + request.idempotency_key.clone(), + false, + proto_mode, + InvocationFreshnessDisposition::MayExist, + |final_agent_id| { + auth.authorize_permission(&PermissionTarget::Agent(ClassPermissionTarget { + owner: AgentOwnerPattern::Agent { + account: component_owner_account_email, + application: request.app_name, + environment: request.env_name, + component: ComponentName(component_name), + agent: AgentOwnerLeafPattern::Agent(final_agent_id.agent_id.clone()), + }, + verb: Some(AgentVerb::Invoke), + resource: AgentResourcePattern::Method(AgentMethodName( + method_name.clone(), + )), + })) + .map_err(AuthServiceError::from) + .map_err(WorkerServiceError::from) + }, + )?; + debug_assert!(!observation_only); + let invocation_component = self + .component_for_invocation( + &component, + &agent_id, + environment_id, + &auth, + freshness_disposition, + ) + .await?; + + let invocation_agent_type = invocation_component + .metadata + .find_agent_type_by_name_ref(&request.agent_type_name) + .ok_or_else(|| { + WorkerServiceError::Internal(format!( + "Agent type {} not found in component metadata at revision {}", + request.agent_type_name, invocation_component.revision + )) + })?; + let method = invocation_agent_type + .methods + .iter() + .find(|m| m.name == request.method_name) + .ok_or_else(|| { + WorkerServiceError::Internal(format!( + "Agent method {} not found in agent type {}", + request.method_name, request.agent_type_name + )) + })?; + + let method_parameters = json_input_schema_value_to_typed_schema_value( + request.method_parameters, + &invocation_agent_type.schema, + &method.input_schema, ) .map_err(|err| { WorkerServiceError::TypeChecker(format!("Agent method parameters type error: {err}")) @@ -1297,15 +1880,6 @@ impl WorkerService { )) })?; - let proto_mode = match request.mode { - AgentInvocationMode::Await => { - golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32 - } - AgentInvocationMode::Schedule => { - golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule as i32 - } - }; - let proto_schedule_at = request.schedule_at.map(|dt| ::prost_types::Timestamp { seconds: dt.timestamp(), nanos: dt.timestamp_subsec_nanos() as i32, @@ -1317,43 +1891,22 @@ impl WorkerService { }) .into(); - let method_name = request.method_name.clone(); - let agent_type_name = request.agent_type_name.clone(); - let output = self - .dispatch_agent_invocation( - &component, - &agent_id, + .dispatch_prepared_agent_invocation( + Some(&invocation_component), + agent_id.clone(), Some(method_name.clone()), Some(proto_method_parameters), proto_mode, proto_schedule_at, - request.idempotency_key.clone(), + idempotency_key, None, - false, - InvocationFreshnessDisposition::MayExist, + freshness_disposition, request.config, environment_id, component_owner_account_id, auth.clone(), principal, - |final_agent_id| { - auth.authorize_permission(&PermissionTarget::Agent(ClassPermissionTarget { - owner: AgentOwnerPattern::Agent { - account: component_owner_account_email, - application: request.app_name, - environment: request.env_name, - component: ComponentName(component_name), - agent: AgentOwnerLeafPattern::Agent(final_agent_id.agent_id.clone()), - }, - verb: Some(AgentVerb::Invoke), - resource: AgentResourcePattern::Method(AgentMethodName( - method_name.clone(), - )), - })) - .map_err(AuthServiceError::from) - .map_err(WorkerServiceError::from) - }, ) .await?; @@ -1419,7 +1972,8 @@ impl WorkerService { mod tests { use super::{ WorkerService, agent_verb_for_invocation_mode, build_public_agent_id, - build_public_invocation_agent_id, normalize_agent_invocation_identity, + build_public_invocation_agent_id, decode_public_schema_value, + normalize_agent_invocation_identity, }; use crate::api::agents::{AgentInvocationMode, AgentInvocationRequest, CreateAgentRequest}; use crate::service::agent_resolution_cache::AgentResolutionCache; @@ -1430,8 +1984,10 @@ mod tests { use async_trait::async_trait; use bytes::Bytes; use chrono::Utc; - use futures::Stream; - use golem_api_grpc::proto::golem::worker::{InvocationContext, LogEvent}; + use futures::{Stream, StreamExt, stream}; + use golem_api_grpc::proto::golem::worker::{ + InvocationContext, InvocationStart, LogEvent, PublicInvocationStart, invocation_request, + }; use golem_common::base_model::component_metadata::KnownExports; use golem_common::model::AgentInvocationOutput; use golem_common::model::Empty; @@ -1442,7 +1998,7 @@ mod tests { ResolvedAgentType, Snapshotting, ephemeral_invocation_phantom_id, }; use golem_common::model::application::{ApplicationId, ApplicationName}; - use golem_common::model::card::{AgentVerb, StoredCard}; + use golem_common::model::card::{AgentVerb, EffectiveSurface, StoredCard}; use golem_common::model::component::{ CanonicalFilePath, ComponentId, ComponentName, ComponentRevision, PluginPriority, }; @@ -1452,16 +2008,18 @@ mod tests { use golem_common::model::environment::{EnvironmentId, EnvironmentName}; use golem_common::model::oplog::{OplogCursor, OplogIndex}; use golem_common::model::worker::{AgentConfigEntryDto, AgentMetadataDto, RevertWorkerTarget}; - use golem_common::model::{AgentFilter, AgentFingerprint, AgentId, IdempotencyKey, ScanCursor}; + use golem_common::model::{ + AgentFilter, AgentFingerprint, AgentId, AgentStatus, IdempotencyKey, ScanCursor, Timestamp, + }; use golem_common::schema::{ - AgentConstructorSchema, AgentMethodSchema, AgentTypeSchema, InputSchema, OutputSchema, - SchemaGraph, SchemaValue, + AgentConstructorSchema, AgentMethodSchema, AgentTypeSchema, InputSchema, NamedField, + OutputSchema, SchemaGraph, SchemaType, SchemaValue, }; use golem_service_base::clients::registry::{RegistryService, RegistryServiceError}; use golem_service_base::model::auth::AuthCtx; use golem_service_base::model::component::Component; use golem_service_base::model::{ComponentFileSystemNode, GetOplogResponse}; - use std::collections::{BTreeMap, HashMap}; + use std::collections::{BTreeMap, HashMap, HashSet}; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::time::Duration; @@ -1855,24 +2413,26 @@ mod tests { } struct StaticComponentService { - component: Component, + components: Vec, } #[async_trait] impl ComponentService for StaticComponentService { async fn get_current_by_id_in_cache(&self, component_id: ComponentId) -> Option { - (self.component.id == component_id).then(|| self.component.clone()) + self.components + .iter() + .filter(|component| component.id == component_id) + .max_by_key(|component| component.revision) + .cloned() } async fn get_current_by_id_uncached( &self, component_id: ComponentId, ) -> Result { - if self.component.id == component_id { - Ok(self.component.clone()) - } else { - Err(ComponentServiceError::ComponentNotFound) - } + self.get_current_by_id_in_cache(component_id) + .await + .ok_or(ComponentServiceError::ComponentNotFound) } async fn get_revision( @@ -1880,21 +2440,29 @@ mod tests { component_id: ComponentId, component_revision: ComponentRevision, ) -> Result { - if self.component.id == component_id && self.component.revision == component_revision { - Ok(self.component.clone()) - } else { - Err(ComponentServiceError::ComponentNotFound) - } + self.components + .iter() + .find(|component| { + component.id == component_id && component.revision == component_revision + }) + .cloned() + .ok_or(ComponentServiceError::ComponentNotFound) } async fn get_all_revisions( &self, component_id: ComponentId, ) -> Result, ComponentServiceError> { - if self.component.id == component_id { - Ok(vec![self.component.clone()]) - } else { + let components = self + .components + .iter() + .filter(|component| component.id == component_id) + .cloned() + .collect::>(); + if components.is_empty() { Err(ComponentServiceError::ComponentNotFound) + } else { + Ok(components) } } } @@ -1929,7 +2497,9 @@ mod tests { created_agent_ids: Mutex>, invocations: Mutex>, invocation_environments: Mutex>, + invocation_session_starts: Mutex>, invocation_output: AgentInvocationOutput, + metadata_component_revision: Option, } impl RecordingWorkerClient { @@ -1938,7 +2508,23 @@ mod tests { created_agent_ids: Mutex::new(Vec::new()), invocations: Mutex::new(Vec::new()), invocation_environments: Mutex::new(Vec::new()), + invocation_session_starts: Mutex::new(Vec::new()), + invocation_output, + metadata_component_revision: None, + } + } + + fn with_metadata_component_revision( + invocation_output: AgentInvocationOutput, + component_revision: ComponentRevision, + ) -> Self { + Self { + created_agent_ids: Mutex::new(Vec::new()), + invocations: Mutex::new(Vec::new()), + invocation_environments: Mutex::new(Vec::new()), + invocation_session_starts: Mutex::new(Vec::new()), invocation_output, + metadata_component_revision: Some(component_revision), } } @@ -1957,6 +2543,14 @@ mod tests { fn invocation_environment(&self) -> EnvironmentId { self.invocation_environments.lock().unwrap()[0] } + + fn invocation_session_start(&self) -> (AgentId, InvocationStart) { + self.invocation_session_starts.lock().unwrap()[0].clone() + } + + fn invocation_session_start_count(&self) -> usize { + self.invocation_session_starts.lock().unwrap().len() + } } #[async_trait] @@ -2017,11 +2611,35 @@ mod tests { async fn get_metadata( &self, - _: &AgentId, - _: EnvironmentId, + agent_id: &AgentId, + environment_id: EnvironmentId, _: AuthCtx, ) -> WorkerResult { - unimplemented!() + match self.metadata_component_revision { + Some(component_revision) => Ok(AgentMetadataDto { + agent_id: agent_id.clone(), + environment_id, + created_by: AccountId(Uuid::new_v4()), + env: HashMap::new(), + config: Vec::new(), + status: AgentStatus::Idle, + component_revision, + retry_count: 0, + pending_invocation_count: 0, + updates: Vec::new(), + created_at: Timestamp::now_utc(), + last_error: None, + component_size: 0, + total_linear_memory_size: 0, + exported_resource_instances: Vec::new(), + active_plugins: HashSet::new(), + skipped_regions: Vec::new(), + deleted_regions: Vec::new(), + last_oplog_index: OplogIndex::INITIAL, + fingerprint: AgentFingerprint(Uuid::new_v4()), + }), + None => Err(WorkerServiceError::AgentNotFound(agent_id.clone())), + } } async fn find_metadata( @@ -2197,6 +2815,26 @@ mod tests { Ok(self.invocation_output.clone()) } + async fn invoke_agent_session( + &self, + agent_id: &AgentId, + mut request: super::InvocationRequestStream, + ) -> WorkerResult { + let start = request + .next() + .await + .expect("worker service should send an invocation start"); + let start = match start.request { + Some(invocation_request::Request::Start(start)) => start, + other => panic!("expected invocation start, got {other:?}"), + }; + self.invocation_session_starts + .lock() + .unwrap() + .push((agent_id.clone(), start)); + Ok(Box::pin(stream::empty())) + } + async fn process_oplog_entries( &self, _: &AgentId, @@ -2225,12 +2863,30 @@ mod tests { impl RestHarness { fn new(mode: AgentMode) -> Self { + Self::new_with_method_schema(mode, InputSchema::Parameters(vec![]), OutputSchema::Unit) + } + + fn new_with_output(mode: AgentMode, output_schema: OutputSchema) -> Self { + Self::new_with_method_schema(mode, InputSchema::Parameters(vec![]), output_schema) + } + + fn new_with_input(mode: AgentMode, input_schema: InputSchema) -> Self { + Self::new_with_method_schema(mode, input_schema, OutputSchema::Unit) + } + + fn new_with_method_schema( + mode: AgentMode, + input_schema: InputSchema, + output_schema: OutputSchema, + ) -> Self { let component_id = ComponentId(Uuid::new_v4()); let environment_id = EnvironmentId(Uuid::new_v4()); let account_id = AccountId(Uuid::new_v4()); let component_revision = ComponentRevision::INITIAL; let agent_type_name = AgentTypeName("weather-agent".to_string()); - let agent_type = test_agent_type(agent_type_name.clone(), mode); + let mut agent_type = test_agent_type(agent_type_name.clone(), mode); + agent_type.methods[0].input_schema = input_schema; + agent_type.methods[0].output_schema = output_schema; let component = test_component( component_id, environment_id, @@ -2274,7 +2930,9 @@ mod tests { Self { worker_service: WorkerService::new( - Arc::new(StaticComponentService { component }), + Arc::new(StaticComponentService { + components: vec![component], + }), Arc::new(AllowAllAuthService), Arc::new(NoopLimitService), worker_client.clone(), @@ -2288,6 +2946,91 @@ mod tests { } } + fn new_with_pinned_and_latest_output( + pinned_output_schema: OutputSchema, + latest_output_schema: OutputSchema, + ) -> Self { + let component_id = ComponentId(Uuid::new_v4()); + let environment_id = EnvironmentId(Uuid::new_v4()); + let account_id = AccountId(Uuid::new_v4()); + let pinned_revision = ComponentRevision::INITIAL; + let latest_revision = ComponentRevision::new(1).unwrap(); + let agent_type_name = AgentTypeName("weather-agent".to_string()); + let mut pinned_agent_type = + test_agent_type(agent_type_name.clone(), AgentMode::Durable); + pinned_agent_type.methods[0].output_schema = pinned_output_schema; + let mut latest_agent_type = + test_agent_type(agent_type_name.clone(), AgentMode::Durable); + latest_agent_type.methods[0].output_schema = latest_output_schema; + let pinned_component = test_component( + component_id, + environment_id, + account_id, + pinned_revision, + pinned_agent_type, + ); + let latest_component = test_component( + component_id, + environment_id, + account_id, + latest_revision, + latest_agent_type.clone(), + ); + let worker_client = Arc::new(RecordingWorkerClient::with_metadata_component_revision( + AgentInvocationOutput { + result: golem_common::model::AgentInvocationResult::AgentInitialization, + consumed_fuel: None, + invocation_status: None, + component_revision: Some(pinned_revision), + agent_id: None, + idempotency_key: None, + oplog_index: None, + agent_fingerprint: None, + }, + pinned_revision, + )); + let registry = Arc::new(TestRegistryService { + resolved: ResolvedAgentType { + registered_agent_type: RegisteredAgentType { + agent_type: latest_agent_type, + implemented_by: RegisteredAgentTypeImplementer { + component_id, + component_revision: latest_revision, + component_name: latest_component.component_name.0.clone(), + account_id: latest_component.account_id, + account_email: latest_component.account_email.clone(), + }, + }, + environment_id, + deployment_revision: DeploymentRevision::INITIAL, + current_deployment_revision: Some(CurrentDeploymentRevision::INITIAL), + }, + }); + let agent_resolution_cache = Arc::new(AgentResolutionCache::new( + registry, + 1, + Duration::from_secs(60), + Duration::from_secs(60), + )); + + Self { + worker_service: WorkerService::new( + Arc::new(StaticComponentService { + components: vec![pinned_component, latest_component], + }), + Arc::new(AllowAllAuthService), + Arc::new(NoopLimitService), + worker_client.clone(), + agent_resolution_cache, + ), + worker_client, + agent_type_name, + component_id, + component_revision: latest_revision, + environment_id, + } + } + fn create_request(&self) -> CreateAgentRequest { CreateAgentRequest { app_name: ApplicationName::try_from("weather-app".to_string()).unwrap(), @@ -2316,6 +3059,23 @@ mod tests { owner_account_email: None, } } + + fn public_invocation_start( + &self, + idempotency_key: IdempotencyKey, + ) -> PublicInvocationStart { + PublicInvocationStart { + application_name: "weather-app".to_string(), + environment_name: "prod".to_string(), + agent_type_name: self.agent_type_name.0.clone(), + constructor_parameters: Some(empty_json_tuple().try_into().unwrap()), + phantom_id: None, + config: vec![], + method_name: "run".to_string(), + method_parameters: Some(empty_json_tuple().try_into().unwrap()), + idempotency_key: Some(idempotency_key.into()), + } + } } fn test_agent_type(agent_type_name: AgentTypeName, mode: AgentMode) -> AgentTypeSchema { @@ -2468,6 +3228,236 @@ mod tests { ); } + #[test] + async fn public_invocation_session_resolves_normalizes_and_builds_trusted_start() { + let harness = RestHarness::new(AgentMode::Ephemeral); + let idempotency_key = IdempotencyKey::new("public-session-key".to_string()); + + let _responses = harness + .worker_service + .invoke_public_agent_session( + harness.public_invocation_start(idempotency_key.clone()), + Box::pin(stream::empty()), + AuthCtx::system(), + ) + .await + .unwrap(); + + let (routed_agent_id, start) = harness.worker_client.invocation_session_start(); + let trusted_agent_id: AgentId = start.agent_id.clone().unwrap().try_into().unwrap(); + let trusted_idempotency_key: IdempotencyKey = start.idempotency_key.clone().unwrap().into(); + + assert_eq!(routed_agent_id, trusted_agent_id); + assert_eq!(trusted_agent_id.component_id, harness.component_id); + assert_eq!(trusted_idempotency_key, idempotency_key); + assert_eq!( + phantom_id(&trusted_agent_id), + Some(ephemeral_invocation_phantom_id(&idempotency_key)) + ); + assert_eq!(start.method_name.as_deref(), Some("run")); + assert!(start.input.is_some()); + assert!(start.auth_ctx.is_some()); + assert!(start.principal.is_some()); + assert_eq!( + EnvironmentId::try_from(start.environment_id.unwrap()).unwrap(), + harness.environment_id + ); + assert!(start.component_owner_account_id.is_some()); + assert_eq!( + start.mode(), + golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await + ); + assert!(start.schedule_at.is_none()); + assert_eq!( + start.freshness_disposition(), + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + ); + } + + #[test] + async fn public_invocation_session_validates_and_preserves_live_stream_references() { + use golem_api_grpc::proto::golem::schema::{ + RecordValue, SchemaValue as ProtoSchemaValue, SchemaValueStreamReference, schema_value, + }; + + let harness = RestHarness::new_with_input( + AgentMode::Durable, + InputSchema::Parameters(vec![NamedField::user_supplied( + "input", + SchemaType::stream(Some(SchemaType::u32())), + )]), + ); + let method_parameters = ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![ProtoSchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: 1 }, + )), + }], + })), + }; + let mut start = harness.public_invocation_start(IdempotencyKey::fresh()); + start.method_parameters = Some(method_parameters.clone()); + + let _responses = harness + .worker_service + .invoke_public_agent_session(start, Box::pin(stream::empty()), AuthCtx::system()) + .await + .unwrap(); + + let (_, trusted_start) = harness.worker_client.invocation_session_start(); + assert_eq!(trusted_start.input, Some(method_parameters)); + } + + #[test] + fn public_invocation_values_reject_capabilities_and_constructor_streams_recursively() { + use golem_api_grpc::proto::golem::schema::{ + RecordValue, SchemaValue as ProtoSchemaValue, SchemaValueStreamReference, SecretValue, + schema_value, + }; + + let nested = |value| ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![ProtoSchemaValue { value: Some(value) }], + })), + }; + + let secret = nested(schema_value::Value::SecretValue(SecretValue::default())); + assert!( + decode_public_schema_value(secret, true) + .unwrap_err() + .contains("host-managed capability") + ); + + let constructor_stream = nested(schema_value::Value::StreamReference( + SchemaValueStreamReference { stream_id: 7 }, + )); + assert!( + decode_public_schema_value(constructor_stream, false) + .unwrap_err() + .contains("not valid in constructor parameters") + ); + } + + #[test] + async fn unauthorized_public_invocation_session_never_reaches_worker_dispatch() { + let harness = RestHarness::new(AgentMode::Durable); + let idempotency_key = IdempotencyKey::fresh(); + let auth = AuthCtx::agent_with_effective_surface( + AccountId(Uuid::new_v4()), + AccountEmail::new("unauthorized@golem"), + EffectiveSurface { + source_card_ids: vec![], + lower: vec![], + upper: vec![], + }, + ); + + let error = match harness + .worker_service + .invoke_public_agent_session( + harness.public_invocation_start(idempotency_key), + Box::pin(stream::empty()), + auth, + ) + .await + { + Err(error) => error, + Ok(_) => panic!("an empty permission surface must reject the resolved agent selector"), + }; + + assert!(matches!(error, WorkerServiceError::AuthError(_))); + assert_eq!(harness.worker_client.invocation_session_start_count(), 0); + } + + #[test] + async fn non_attached_streaming_modes_are_rejected_before_worker_dispatch() { + let harness = RestHarness::new_with_output( + AgentMode::Durable, + OutputSchema::Single(Box::new(SchemaType::stream(Some(SchemaType::u8())))), + ); + + for (mode, schedule_at) in [ + (AgentInvocationMode::Await, None), + (AgentInvocationMode::Schedule, None), + (AgentInvocationMode::Schedule, Some(Utc::now())), + ] { + let mut request = harness.invoke_request(); + request.mode = mode; + request.schedule_at = schedule_at; + let error = harness + .worker_service + .invoke_agent_rest(request, AuthCtx::system()) + .await + .expect_err("non-attached invocation must reject streaming methods"); + + assert!( + error + .to_string() + .contains("require an attached invocation session"), + "unexpected error: {error}" + ); + } + assert!( + harness.worker_client.invocations().is_empty(), + "rejection must happen before scheduling, executor dispatch, enqueue, or result storage" + ); + } + + #[test] + async fn non_attached_stream_free_modes_still_dispatch() { + let harness = RestHarness::new(AgentMode::Durable); + + for (mode, schedule_at) in [ + (AgentInvocationMode::Await, None), + (AgentInvocationMode::Schedule, None), + (AgentInvocationMode::Schedule, Some(Utc::now())), + ] { + let mut request = harness.invoke_request(); + request.mode = mode; + request.schedule_at = schedule_at; + harness + .worker_service + .invoke_agent_rest(request, AuthCtx::system()) + .await + .expect("stream-free one-shot invocation must still dispatch"); + } + + assert_eq!(harness.worker_client.invocations().len(), 3); + } + + #[test] + async fn non_attached_classification_uses_the_existing_workers_component_revision() { + let stream_output = + OutputSchema::Single(Box::new(SchemaType::stream(Some(SchemaType::u8())))); + let pinned_streaming = RestHarness::new_with_pinned_and_latest_output( + stream_output.clone(), + OutputSchema::Unit, + ); + + let error = pinned_streaming + .worker_service + .invoke_agent_rest(pinned_streaming.invoke_request(), AuthCtx::system()) + .await + .expect_err("the pinned streaming revision must be rejected"); + assert!( + error + .to_string() + .contains("require an attached invocation session"), + "unexpected error: {error}" + ); + assert!(pinned_streaming.worker_client.invocations().is_empty()); + + let pinned_stream_free = + RestHarness::new_with_pinned_and_latest_output(OutputSchema::Unit, stream_output); + pinned_stream_free + .worker_service + .invoke_agent_rest(pinned_stream_free.invoke_request(), AuthCtx::system()) + .await + .expect("the pinned stream-free revision must remain dispatchable"); + assert_eq!(pinned_stream_free.worker_client.invocations().len(), 1); + } + #[test] async fn ephemeral_rest_invocations_get_fresh_identities_per_request() { let harness = RestHarness::new(AgentMode::Ephemeral); diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index acc64ba4c7..eaebd721c9 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -31,6 +31,7 @@ futures-concurrency = { workspace = true } headers = { workspace = true } indoc = { workspace = true } pretty_assertions = { workspace = true, features = [ "unstable" ] } +prost = { workspace = true } rand = { workspace = true } reqwest = { workspace = true } rlimit = { workspace = true } diff --git a/integration-tests/tests/api/streaming_rpc.rs b/integration-tests/tests/api/streaming_rpc.rs index d31072dc91..07d6939cd6 100644 --- a/integration-tests/tests/api/streaming_rpc.rs +++ b/integration-tests/tests/api/streaming_rpc.rs @@ -12,25 +12,156 @@ // See the License for the specific language governing permissions and // limitations under the License. +use futures::{SinkExt, StreamExt}; +use golem_api_grpc::invocation_session_protocol::InvocationSessionState; +use golem_api_grpc::proto::golem::schema::{ + RecordValue, SchemaValue as ProtoSchemaValue, SchemaValueStreamReference, SecretValue, + schema_value, +}; use golem_api_grpc::proto::golem::worker::v1::worker_service_client::WorkerServiceClient; use golem_api_grpc::proto::golem::worker::{ - InvocationFrame, InvocationStart, invocation_frame, invocation_result, - invocation_session_finished, + InputStreamEnd, InputStreamItem, InvocationRejectionReason, InvocationRequest, + InvocationResponse, InvocationStart, PublicInvocationRequest, PublicInvocationStart, + input_stream_item, invocation_request, invocation_response, invocation_session_completion, + invocation_session_result, public_invocation_request, }; use golem_client::model::ComponentDto; use golem_common::model::agent::ParsedAgentId; +use golem_common::model::auth::TokenSecret; use golem_common::model::{AgentId, IdempotencyKey, RoutingTable}; use golem_common::schema::{SchemaValue, TypedSchemaValue}; use golem_common::{agent_id, data_value}; use golem_service_base::model::auth::AuthCtx; use golem_test_framework::config::{EnvBasedTestDependencies, TestDependencies}; use golem_test_framework::dsl::{TestDsl, TestDslExtended}; +use prost::Message as ProstMessage; use test_r::{inherit_test_dep, test, timeout}; use tokio::sync::mpsc; use tokio_stream::wrappers::ReceiverStream; +use tokio_tungstenite::tungstenite::client::IntoClientRequest; +use tokio_tungstenite::tungstenite::http::header::AUTHORIZATION; +use tokio_tungstenite::tungstenite::{Error as WebSocketError, Message}; +use tokio_tungstenite::{MaybeTlsStream, WebSocketStream}; inherit_test_dep!(EnvBasedTestDependencies); +type PublicInvocationSocket = WebSocketStream>; + +async fn connect_public_invocation_socket( + deps: &EnvBasedTestDependencies, + token: Option<&TokenSecret>, +) -> Result { + let worker_service = deps.worker_service(); + let url = format!( + "ws://{}:{}/v1/agents/invoke-agent-session", + worker_service.http_host(), + worker_service.http_port() + ); + let mut request = url.into_client_request()?; + if let Some(token) = token { + request.headers_mut().insert( + AUTHORIZATION, + format!("Bearer {}", token.secret()).parse().unwrap(), + ); + } + tokio_tungstenite::connect_async(request) + .await + .map(|(socket, _)| socket) +} + +async fn send_public_request( + socket: &mut PublicInvocationSocket, + request: &PublicInvocationRequest, +) -> anyhow::Result<()> { + socket + .send(Message::Binary(request.encode_to_vec().into())) + .await?; + Ok(()) +} + +async fn receive_public_response( + socket: &mut PublicInvocationSocket, +) -> anyhow::Result { + loop { + match socket.next().await { + Some(Ok(Message::Binary(payload))) => { + return InvocationResponse::decode(payload.as_slice()).map_err(Into::into); + } + Some(Ok(Message::Ping(payload))) => socket.send(Message::Pong(payload)).await?, + Some(Ok(Message::Pong(_))) | Some(Ok(Message::Frame(_))) => {} + Some(Ok(Message::Text(text))) => { + anyhow::bail!("public invocation returned unexpected text frame: {text}") + } + Some(Ok(Message::Close(close))) => { + anyhow::bail!("public invocation closed before its next response: {close:?}") + } + Some(Err(error)) => return Err(error.into()), + None => anyhow::bail!("public invocation connection ended before its next response"), + } + } +} + +fn public_start( + application_name: &str, + environment_name: &str, + agent_name: &str, + method_name: &str, + method_parameters: ProtoSchemaValue, +) -> PublicInvocationRequest { + let constructor_parameters = SchemaValue::Record { + fields: vec![SchemaValue::String(agent_name.to_string())], + } + .try_into() + .unwrap(); + + PublicInvocationRequest { + request: Some(public_invocation_request::Request::Start( + PublicInvocationStart { + application_name: application_name.to_string(), + environment_name: environment_name.to_string(), + agent_type_name: "StreamingRpcTarget".to_string(), + constructor_parameters: Some(constructor_parameters), + phantom_id: None, + config: Vec::new(), + method_name: method_name.to_string(), + method_parameters: Some(method_parameters), + idempotency_key: Some(IdempotencyKey::fresh().into()), + }, + )), + } +} + +fn proto_record(fields: Vec) -> ProtoSchemaValue { + SchemaValue::Record { fields }.try_into().unwrap() +} + +async fn run_public_session( + deps: &EnvBasedTestDependencies, + token: &TokenSecret, + start: PublicInvocationRequest, +) -> anyhow::Result> { + let mut socket = connect_public_invocation_socket(deps, Some(token)).await?; + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&start) + .map_err(anyhow::Error::msg)?; + send_public_request(&mut socket, &start).await?; + + let mut responses = Vec::new(); + while !state.is_complete() { + let response = receive_public_response(&mut socket).await?; + state + .validate_response(&response) + .map_err(anyhow::Error::msg)?; + responses.push(response); + } + match socket.next().await { + Some(Ok(Message::Close(_))) => {} + other => anyhow::bail!("completed public invocation must close cleanly, got {other:?}"), + } + Ok(responses) +} + fn cross_executor_agent_name( component: &ComponentDto, routing_table: &RoutingTable, @@ -69,27 +200,30 @@ async fn invoke_agent_session( let (_, input) = params.into_parts(); let input = input.try_into().map_err(anyhow::Error::msg)?; let (frames, receiver) = mpsc::channel(8); - frames - .send(InvocationFrame { - frame: Some(invocation_frame::Frame::Start(InvocationStart { - agent_id: Some(agent_id.into()), - method_name: Some(method_name.to_string()), - input: Some(input), - idempotency_key: Some(IdempotencyKey::fresh().into()), - context: None, - auth_ctx: Some(AuthCtx::System.into()), - principal: None, - environment_id: None, - config: Vec::new(), - component_owner_account_id: None, - mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, - schedule_at: None, - freshness_disposition: - golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist - as i32, - })), - }) - .await?; + let request = InvocationRequest { + request: Some(invocation_request::Request::Start(InvocationStart { + agent_id: Some(agent_id.into()), + method_name: Some(method_name.to_string()), + input: Some(input), + idempotency_key: Some(IdempotencyKey::fresh().into()), + context: None, + auth_ctx: Some(AuthCtx::System.into()), + principal: None, + environment_id: None, + config: Vec::new(), + component_owner_account_id: None, + mode: golem_api_grpc::proto::golem::worker::AgentInvocationMode::Await as i32, + schedule_at: None, + freshness_disposition: + golem_api_grpc::proto::golem::worker::InvocationFreshnessDisposition::MayExist + as i32, + })), + }; + let mut state = InvocationSessionState::default(); + state + .validate_trusted_request(&request) + .map_err(anyhow::Error::msg)?; + frames.send(request).await?; let worker_service = deps.worker_service(); let mut client = WorkerServiceClient::connect(format!( @@ -103,42 +237,49 @@ async fn invoke_agent_session( .await? .into_inner(); let mut result = None; - while let Some(frame) = inbound.message().await? { - match frame.frame { - Some(invocation_frame::Frame::Result(value)) => { + let mut terminal = None; + while let Some(response) = inbound.message().await? { + state + .validate_response(&response) + .map_err(anyhow::Error::msg)?; + match response.response { + Some(invocation_response::Response::Accepted(_)) => {} + Some(invocation_response::Response::Rejected(rejected)) => { + terminal = Some(Err(rejected.error)); + } + Some(invocation_response::Response::Result(value)) => { if result.is_some() { anyhow::bail!("invocation session returned more than one result"); } result = match value.result { - Some(invocation_result::Result::MethodResult(value)) => { + Some(invocation_session_result::Result::MethodResult(value)) => { Some(value.try_into().map_err(anyhow::Error::msg)?) } - Some(invocation_result::Result::NoResult(_)) | None => { + Some(invocation_session_result::Result::NoResult(_)) | None => { anyhow::bail!("invocation session returned no method result") } }; } - Some(invocation_frame::Frame::Finished(finished)) => match finished.outcome { - Some(invocation_session_finished::Outcome::Success(_)) => { - return result.map(Ok).ok_or_else(|| { - anyhow::anyhow!("invocation session ended without a result") - }); - } - Some(invocation_session_finished::Outcome::Failure(failure)) => { - return Ok(Err(format!("{failure:?}"))); - } - Some(invocation_session_finished::Outcome::ProtocolFailure(failure)) => { - return Ok(Err(failure.details)); - } - None => anyhow::bail!("invocation session completion has no outcome"), - }, + Some(invocation_response::Response::Finished(finished)) => { + terminal = Some(match finished.outcome { + Some(invocation_session_completion::Outcome::Success(_)) => { + result.take().map(Ok).ok_or_else(|| { + anyhow::anyhow!("invocation session ended without a result") + })? + } + Some(invocation_session_completion::Outcome::Failure(failure)) => { + Err(failure.message) + } + None => anyhow::bail!("invocation session completion has no outcome"), + }); + } Some(other) => { anyhow::bail!("unexpected outer invocation session frame: {other:?}") } None => anyhow::bail!("empty outer invocation session frame"), } } - anyhow::bail!("invocation session response ended before completion") + terminal.ok_or_else(|| anyhow::anyhow!("invocation session response ended before completion")) } fn assert_streaming_report(value: SchemaValue) { @@ -244,14 +385,16 @@ async fn generated_rust_client_streaming_rpc_cross_executor( .await? .expect_err("producer stream error must fail the invocation session"); assert!( - producer_error.contains("value-node index out of range: 0"), + producer_error.contains("Component trapped") + || producer_error.contains("value-node index out of range: 0"), "unexpected producer error: {producer_error}" ); + let stream_free_caller_id = agent_id!("StreamingRpcCaller", "stream-free-after-stream-error"); let first = user .invoke_and_await_agent( &component, - &caller_agent_id, + &stream_free_caller_id, "call_stream_free", data_value!(), ) @@ -260,7 +403,7 @@ async fn generated_rust_client_streaming_rpc_cross_executor( let second = user .invoke_and_await_agent( &component, - &caller_agent_id, + &stream_free_caller_id, "call_stream_free", data_value!(), ) @@ -269,3 +412,396 @@ async fn generated_rust_client_streaming_rpc_cross_executor( assert_eq!((first, second), (1, 2)); Ok(()) } + +#[test] +#[timeout("4 minutes")] +#[tracing::instrument] +async fn public_websocket_invocation_forwards_scalar_and_streaming_sessions( + deps: &EnvBasedTestDependencies, +) -> anyhow::Result<()> { + let user = deps.user().await?; + let (application, environment) = user.app_and_env().await?; + user.component(&environment.id, "golem_it_agent_rpc_rust_release") + .name("golem-it:agent-rpc-rust") + .unique() + .store() + .await?; + let application_name = &application.name.0; + let environment_name = &environment.name.0; + let agent_name = format!("public-streaming-{}", uuid::Uuid::new_v4()); + + let scalar = run_public_session( + deps, + &user.token, + public_start( + application_name, + environment_name, + &agent_name, + "ping", + proto_record(Vec::new()), + ), + ) + .await?; + assert_eq!(scalar.len(), 3); + assert!(matches!( + scalar[0].response, + Some(invocation_response::Response::Accepted(_)) + )); + let Some(invocation_response::Response::Result(result)) = &scalar[1].response else { + anyhow::bail!("scalar public invocation did not return a result") + }; + let Some(invocation_session_result::Result::MethodResult(value)) = &result.result else { + anyhow::bail!("scalar public invocation returned no method value") + }; + assert_eq!( + SchemaValue::try_from(value.clone()).map_err(anyhow::Error::msg)?, + SchemaValue::U64(42) + ); + assert!(matches!( + scalar[2].response, + Some(invocation_response::Response::Finished(_)) + )); + + let produced = run_public_session( + deps, + &user.token, + public_start( + application_name, + environment_name, + &agent_name, + "produce", + proto_record(vec![SchemaValue::List { + elements: vec![ + SchemaValue::U32(3), + SchemaValue::U32(5), + SchemaValue::U32(8), + ], + }]), + ), + ) + .await?; + assert_eq!(produced.len(), 7); + let Some(invocation_response::Response::Result(result)) = &produced[1].response else { + anyhow::bail!("streaming public invocation did not return an initial result") + }; + let Some(invocation_session_result::Result::MethodResult(result_value)) = &result.result else { + anyhow::bail!("streaming public invocation returned no method value") + }; + let Some(schema_value::Value::StreamReference(stream)) = &result_value.value else { + anyhow::bail!("streaming public invocation did not return a stream reference") + }; + let items = produced[2..5] + .iter() + .map(|response| match &response.response { + Some(invocation_response::Response::OutputItem(item)) => { + assert_eq!(item.stream_id, stream.stream_id); + SchemaValue::try_from(item.value.clone().unwrap()).unwrap() + } + other => panic!("expected output item, got {other:?}"), + }) + .collect::>(); + assert_eq!( + items, + vec![ + SchemaValue::U32(3), + SchemaValue::U32(5), + SchemaValue::U32(8) + ] + ); + assert!(matches!( + produced[5].response, + Some(invocation_response::Response::OutputEnd(_)) + )); + assert!(matches!( + produced[6].response, + Some(invocation_response::Response::Finished(_)) + )); + + let input_stream_id = 71; + let stream_input = ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![ProtoSchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { + stream_id: input_stream_id, + }, + )), + }], + })), + }; + let start = public_start( + application_name, + environment_name, + &agent_name, + "consume", + stream_input, + ); + let mut socket = connect_public_invocation_socket(deps, Some(&user.token)).await?; + let mut state = InvocationSessionState::default(); + state + .validate_public_request(&start) + .map_err(anyhow::Error::msg)?; + send_public_request(&mut socket, &start).await?; + let accepted = receive_public_response(&mut socket).await?; + state + .validate_response(&accepted) + .map_err(anyhow::Error::msg)?; + + for (sequence, value) in [13_u32, 21].into_iter().enumerate() { + let request = PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id: input_stream_id, + sequence: sequence as u64, + payload: Some(input_stream_item::Payload::Value( + SchemaValue::U32(value) + .try_into() + .map_err(anyhow::Error::msg)?, + )), + }, + )), + }; + state + .validate_public_request(&request) + .map_err(anyhow::Error::msg)?; + send_public_request(&mut socket, &request).await?; + let ack = receive_public_response(&mut socket).await?; + state.validate_response(&ack).map_err(anyhow::Error::msg)?; + assert!(matches!( + ack.response, + Some(invocation_response::Response::InputAck(_)) + )); + } + let end = PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputEnd( + InputStreamEnd { + stream_id: input_stream_id, + offset: 2, + }, + )), + }; + state + .validate_public_request(&end) + .map_err(anyhow::Error::msg)?; + send_public_request(&mut socket, &end).await?; + let mut consumed = None; + while !state.is_complete() { + let response = receive_public_response(&mut socket).await?; + state + .validate_response(&response) + .map_err(anyhow::Error::msg)?; + if let Some(invocation_response::Response::Result(result)) = response.response + && let Some(invocation_session_result::Result::MethodResult(value)) = result.result + { + consumed = Some(SchemaValue::try_from(value).map_err(anyhow::Error::msg)?); + } + } + assert_eq!( + consumed, + Some(SchemaValue::List { + elements: vec![SchemaValue::U32(13), SchemaValue::U32(21)], + }) + ); + + let blocked_stream_id = 73; + let blocked = public_start( + application_name, + environment_name, + &agent_name, + "consume", + ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![ProtoSchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { + stream_id: blocked_stream_id, + }, + )), + }], + })), + }, + ); + let mut blocked_socket = connect_public_invocation_socket(deps, Some(&user.token)).await?; + send_public_request(&mut blocked_socket, &blocked).await?; + let accepted = receive_public_response(&mut blocked_socket).await?; + assert!( + matches!( + accepted.response, + Some(invocation_response::Response::Accepted(_)) + ), + "blocked public invocation was not accepted: {accepted:?}" + ); + blocked_socket.send(Message::Close(None)).await?; + drop(blocked_socket); + + let subsequent = tokio::time::timeout( + std::time::Duration::from_secs(30), + run_public_session( + deps, + &user.token, + public_start( + application_name, + environment_name, + &agent_name, + "ping", + proto_record(Vec::new()), + ), + ), + ) + .await + .map_err(|_| anyhow::anyhow!("public disconnect did not cancel the blocked invocation"))??; + assert!(subsequent.iter().any(|response| matches!( + response.response, + Some(invocation_response::Response::Finished(_)) + ))); + + let capability_stream_id = 75; + let mut capability_socket = connect_public_invocation_socket(deps, Some(&user.token)).await?; + send_public_request( + &mut capability_socket, + &public_start( + application_name, + environment_name, + &agent_name, + "consume", + ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![ProtoSchemaValue { + value: Some(schema_value::Value::StreamReference( + SchemaValueStreamReference { + stream_id: capability_stream_id, + }, + )), + }], + })), + }, + ), + ) + .await?; + let accepted = receive_public_response(&mut capability_socket).await?; + assert!(matches!( + accepted.response, + Some(invocation_response::Response::Accepted(_)) + )); + send_public_request( + &mut capability_socket, + &PublicInvocationRequest { + request: Some(public_invocation_request::Request::InputItem( + InputStreamItem { + stream_id: capability_stream_id, + sequence: 0, + payload: Some(input_stream_item::Payload::Value(ProtoSchemaValue { + value: Some(schema_value::Value::RecordValue(RecordValue { + fields: vec![ProtoSchemaValue { + value: Some(schema_value::Value::SecretValue( + SecretValue::default(), + )), + }], + })), + })), + }, + )), + }, + ) + .await?; + let close = tokio::time::timeout(std::time::Duration::from_secs(10), async { + loop { + match capability_socket.next().await { + Some(Ok(Message::Close(close))) => break Ok(close), + Some(Ok(_)) => {} + Some(Err(error)) => break Err(anyhow::Error::from(error)), + None => anyhow::bail!("capability injection ended without a protocol close"), + } + } + }) + .await + .map_err(|_| anyhow::anyhow!("capability injection did not close the public session"))??; + assert!(matches!( + close.map(|frame| frame.code), + Some(tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode::Protocol) + )); + drop(capability_socket); + + tokio::time::timeout( + std::time::Duration::from_secs(30), + run_public_session( + deps, + &user.token, + public_start( + application_name, + environment_name, + &agent_name, + "ping", + proto_record(Vec::new()), + ), + ), + ) + .await + .map_err(|_| anyhow::anyhow!("capability rejection did not cancel the live invocation"))??; + Ok(()) +} + +#[test] +#[timeout("2 minutes")] +#[tracing::instrument] +async fn public_websocket_invocation_enforces_auth_frames_and_rejections( + deps: &EnvBasedTestDependencies, +) -> anyhow::Result<()> { + let missing_auth = connect_public_invocation_socket(deps, None) + .await + .expect_err("missing authentication must reject the WebSocket upgrade"); + assert!(matches!( + missing_auth, + WebSocketError::Http(response) if response.status().as_u16() == 401 + )); + + let invalid_token = TokenSecret::trusted("not-a-valid-token".to_string()); + let invalid_auth = connect_public_invocation_socket(deps, Some(&invalid_token)) + .await + .expect_err("invalid authentication must reject the WebSocket upgrade"); + assert!(matches!( + invalid_auth, + WebSocketError::Http(response) if response.status().as_u16() == 401 + )); + + let user = deps.user().await?; + for invalid_message in [ + Message::Text("not protobuf".into()), + Message::Binary(vec![0xff, 0xff].into()), + ] { + let mut socket = connect_public_invocation_socket(deps, Some(&user.token)).await?; + socket.send(invalid_message).await?; + let Some(Ok(Message::Close(Some(close)))) = socket.next().await else { + anyhow::bail!("invalid public frame did not receive a close response") + }; + assert!(matches!( + close.code, + tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode::Unsupported + | tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode::Protocol + )); + } + + let rejected = run_public_session( + deps, + &user.token, + public_start( + "application-that-does-not-exist", + "environment-that-does-not-exist", + "missing-agent", + "ping", + proto_record(Vec::new()), + ), + ) + .await?; + assert_eq!(rejected.len(), 1); + let Some(invocation_response::Response::Rejected(rejected)) = &rejected[0].response else { + anyhow::bail!("unresolved public selector did not produce invocation-rejected") + }; + assert_eq!( + rejected.reason(), + InvocationRejectionReason::NotFound, + "unexpected public rejection: {}", + rejected.error + ); + Ok(()) +} diff --git a/local-run/nginx.conf b/local-run/nginx.conf index b293516379..b27c2d9466 100644 --- a/local-run/nginx.conf +++ b/local-run/nginx.conf @@ -45,6 +45,16 @@ http { proxy_pass http://worker-service; } + location = /v1/agents/invoke-agent-session { + proxy_pass http://worker-service; + proxy_http_version 1.1; + proxy_set_header Upgrade "websocket"; + proxy_set_header Connection "upgrade"; + + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + } + location /v1/agents { proxy_pass http://worker-service; } diff --git a/openapi/golem-service.yaml b/openapi/golem-service.yaml index 13460ad4ec..3accd576d6 100644 --- a/openapi/golem-service.yaml +++ b/openapi/golem-service.yaml @@ -1989,6 +1989,72 @@ paths: security: - Cookie: [] - Token: [] + /v1/agents/invoke-agent-session: + get: + tags: + - Agent + summary: Invoke an agent through an attached live streaming session + operationId: invoke_agent_session + responses: + '101': + description: A websocket response + '400': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorsBody' + '401': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '403': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '404': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '409': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '413': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '415': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '422': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '500': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBodyWithOptionalWorkerError' + security: + - Cookie: [] + - Token: [] /v1/agents/create-agent: post: tags: diff --git a/openapi/golem-worker-service.yaml b/openapi/golem-worker-service.yaml index 7289adef6e..68141a218d 100644 --- a/openapi/golem-worker-service.yaml +++ b/openapi/golem-worker-service.yaml @@ -1982,6 +1982,72 @@ paths: - Cookie: [] - Token: [] operationId: invoke_agent + /v1/agents/invoke-agent-session: + get: + tags: + - Agent + summary: Invoke an agent through an attached live streaming session + responses: + '101': + description: A websocket response + '400': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorsBody' + '401': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '403': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '404': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '409': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '413': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '415': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '422': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBody' + '500': + description: '' + content: + application/json; charset=utf-8: + schema: + $ref: '#/components/schemas/ErrorBodyWithOptionalWorkerError' + security: + - Cookie: [] + - Token: [] + operationId: invoke_agent_session /v1/agents/create-agent: post: tags: diff --git a/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.lock b/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.lock index 3f5c84ce71..6f8990f4ab 100644 --- a/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.lock +++ b/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.lock @@ -429,6 +429,7 @@ name = "golem-rust" version = "0.0.0" dependencies = [ "async-trait", + "bytes", "ctor", "golem-rust-macro", "golem-schema", @@ -463,6 +464,7 @@ dependencies = [ "bigdecimal", "bit-vec", "blake3", + "bytes", "chrono", "combine", "golem-schema-derive", @@ -494,6 +496,7 @@ dependencies = [ name = "golem_it_agent_rpc_rust" version = "0.0.1" dependencies = [ + "bytes", "golem-rust", "log", "serde", diff --git a/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.toml b/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.toml index 0451bee748..f52159444f 100644 --- a/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.toml +++ b/test-components/agent-rpc/golem-it-agent-rpc-rust/Cargo.toml @@ -15,8 +15,9 @@ path = "src/lib.rs" # To use common shared agent definitions, place them in common_lib and uncomment the line below # common-lib = { path = "../../common-rust/common-lib" } +bytes = "1.11.0" log = { version = "0.4.29", features = ["kv"] } -golem-rust = { path = "../../../sdks/rust/golem-rust", features = ["export_golem_agentic"] } +golem-rust = { path = "../../../sdks/rust/golem-rust", features = ["bytes", "export_golem_agentic"] } serde = { version = "1", features = ["derive"] } serde_json = "1" wasi-fetch = "=0.2.0" diff --git a/test-components/agent-rpc/golem-it-agent-rpc-rust/src/lib.rs b/test-components/agent-rpc/golem-it-agent-rpc-rust/src/lib.rs index 89aeb2a789..29a877e63f 100644 --- a/test-components/agent-rpc/golem-it-agent-rpc-rust/src/lib.rs +++ b/test-components/agent-rpc/golem-it-agent-rpc-rust/src/lib.rs @@ -1,3 +1,4 @@ +use bytes::Bytes; use golem_rust::agentic::{AgentStream, spawn_local}; use golem_rust::bindings::golem::agent::host::{Datetime, RpcError, WasmRpc}; use golem_rust::{ @@ -232,6 +233,25 @@ fn agent_stream(values: Vec) -> AgentStream { stream } +fn agent_error_stream() -> AgentStream { + let (mut writer, output) = golem_rust::schema::wit::new_schema_value_stream(); + spawn_local(async move { + let first = encode_schema_value(&SchemaValue::U32(1)) + .expect("failed to encode value before producer error"); + assert!(writer.write_one(first).await.is_none()); + assert!( + writer + .write_one(golem_rust::schema::wit::wire::SchemaValueTree { + value_nodes: Vec::new(), + root: 0, + }) + .await + .is_none() + ); + }); + AgentStream::from_raw(output) +} + #[derive(IntoSchema, FromSchema)] pub struct NestedStreamInput { pub labels: AgentStream, @@ -263,14 +283,27 @@ pub trait StreamingRpcTarget { fn new(name: String) -> Self; async fn consume(&self, input: AgentStream) -> Vec; + async fn consume_strings(&self, input: AgentStream) -> Vec; + async fn drop_input(&self, input: AgentStream) -> u64; + async fn hold_input(&self, input: AgentStream) -> u64; fn produce(&self, values: Vec) -> AgentStream; fn transform(&self, input: AgentStream) -> AgentStream; + async fn consume_bytes(&self, input: AgentStream) -> Vec; + fn produce_bytes(&self, values: Vec) -> AgentStream; + fn produce_byte_then_wait(&self) -> AgentStream; + fn produce_many_bytes(&self, count: u32) -> AgentStream; + fn transform_bytes(&self, input: AgentStream) -> AgentStream; + fn transform_binary(&self, input: AgentStream) -> AgentStream; + async fn consume_binary_chunks(&self, input: AgentStream) -> Vec; async fn consume_nested(&self, input: NestedStreamInput) -> (Vec, Vec); + fn produce_scalar_and_stream(&self) -> (String, AgentStream); fn produce_nested_items(&self) -> AgentStream; fn produce_siblings(&self) -> (AgentStream, AgentStream); + fn produce_sibling_error(&self) -> (AgentStream, AgentStream); fn produce_error(&self) -> AgentStream; fn ping(&self) -> u64; fn increment_scalar(&mut self) -> u64; + fn noop(&self); } struct StreamingRpcTargetImpl { @@ -294,6 +327,23 @@ impl StreamingRpcTarget for StreamingRpcTargetImpl { .expect("failed to consume input stream") } + async fn consume_strings(&self, input: AgentStream) -> Vec { + input + .collect() + .await + .expect("failed to consume string input stream") + } + + async fn drop_input(&self, input: AgentStream) -> u64 { + drop(input); + 42 + } + + async fn hold_input(&self, input: AgentStream) -> u64 { + let _input = input; + std::future::pending().await + } + fn produce(&self, values: Vec) -> AgentStream { agent_stream(values) } @@ -315,6 +365,77 @@ impl StreamingRpcTarget for StreamingRpcTargetImpl { output } + async fn consume_bytes(&self, input: AgentStream) -> Vec { + input + .collect() + .await + .expect("failed to consume byte input stream") + } + + fn produce_bytes(&self, values: Vec) -> AgentStream { + agent_stream(values) + } + + fn produce_byte_then_wait(&self) -> AgentStream { + let (mut writer, output) = AgentStream::new(); + spawn_local(async move { + writer + .write_one(1) + .await + .expect("failed to write byte before waiting"); + std::future::pending::<()>().await; + }); + output + } + + fn produce_many_bytes(&self, count: u32) -> AgentStream { + agent_stream((0..count).map(|value| value as u8).collect()) + } + + fn transform_bytes(&self, mut input: AgentStream) -> AgentStream { + let (mut writer, output) = AgentStream::new(); + spawn_local(async move { + while let Some(value) = input + .next() + .await + .expect("failed to consume byte transform input") + { + writer + .write_one(value) + .await + .expect("failed to write transformed byte"); + } + }); + output + } + + fn transform_binary(&self, mut input: AgentStream) -> AgentStream { + let (mut writer, output) = AgentStream::new(); + spawn_local(async move { + while let Some(value) = input + .next() + .await + .expect("failed to consume binary transform input") + { + writer + .write_one(value) + .await + .expect("failed to write transformed binary value"); + } + }); + output + } + + async fn consume_binary_chunks(&self, input: AgentStream) -> Vec { + input + .collect() + .await + .expect("failed to consume binary input") + .into_iter() + .map(|chunk| chunk.len() as u64) + .collect() + } + async fn consume_nested(&self, input: NestedStreamInput) -> (Vec, Vec) { let labels = input .labels @@ -331,6 +452,10 @@ impl StreamingRpcTarget for StreamingRpcTargetImpl { (labels, values) } + fn produce_scalar_and_stream(&self) -> (String, AgentStream) { + ("metadata".to_string(), agent_stream(vec![11, 12])) + } + fn produce_nested_items(&self) -> AgentStream { let (mut writer, output) = AgentStream::new(); spawn_local(async move { @@ -359,23 +484,12 @@ impl StreamingRpcTarget for StreamingRpcTargetImpl { ) } + fn produce_sibling_error(&self) -> (AgentStream, AgentStream) { + (agent_error_stream(), agent_stream((0..64).collect())) + } + fn produce_error(&self) -> AgentStream { - let (mut writer, output) = golem_rust::schema::wit::new_schema_value_stream(); - spawn_local(async move { - let first = encode_schema_value(&SchemaValue::U32(1)) - .expect("failed to encode value before producer error"); - assert!(writer.write_one(first).await.is_none()); - assert!( - writer - .write_one(golem_rust::schema::wit::wire::SchemaValueTree { - value_nodes: Vec::new(), - root: 0, - }) - .await - .is_none() - ); - }); - AgentStream::from_raw(output) + agent_error_stream() } fn ping(&self) -> u64 { @@ -386,6 +500,8 @@ impl StreamingRpcTarget for StreamingRpcTargetImpl { self.scalar += 1; self.scalar } + + fn noop(&self) {} } #[agent_definition] @@ -393,6 +509,7 @@ pub trait StreamingRpcCaller { fn new(name: String) -> Self; async fn run(&self) -> StreamingRpcReport; + async fn cancel_transform_blocked_on_input(&self) -> u64; async fn call_producer_error(&self) -> Vec; async fn call_stream_free(&self) -> u64; } @@ -477,6 +594,16 @@ impl StreamingRpcCaller for StreamingRpcCallerImpl { } } + async fn cancel_transform_blocked_on_input(&self) -> u64 { + let target = StreamingRpcTargetClient::get(self.name.clone()); + let (input_writer, input) = AgentStream::new(); + let output = target.transform(input).await; + drop(output); + let result = target.ping().await; + drop(input_writer); + result + } + async fn call_producer_error(&self) -> Vec { let mut target = StreamingRpcTargetClient::get(self.name.clone()); target From 3de212f8e8278df7631cdf2817072017e31a6739 Mon Sep 17 00:00:00 2001 From: Daniel Vigovszky Date: Wed, 19 Aug 2026 18:34:59 +0200 Subject: [PATCH 3/7] Fixes --- golem-common/src/model/component_metadata.rs | 2 +- golem-schema/src/schema/wit/encode.rs | 7 +- sdks/moonbit/golem_sdk/api/durability.mbt | 2 +- sdks/moonbit/golem_sdk/api/moon.pkg | 1 + .../gen/interface/golem/agent/guest/ffi.mbt | 2389 +-- .../gen/interface/golem/tool/guest/ffi.mbt | 486 +- .../interface/golem/api/oplog/top.mbt | 15436 ++++++++-------- .../interface/golem/core/types/ffi.mbt | 2033 +- .../golem/durability/durability/top.mbt | 1146 +- .../golem_moonbit_examples/golem_tools.mbt | 550 +- .../ui/fail/agent_stream_alias_constructor.rs | 11 - .../agent_stream_alias_constructor.stderr | 5 - .../runtime/rpc/AgentClientRuntime.scala | 17 +- .../runtime/rpc/AgentClientRuntimeSpec.scala | 2 +- .../main/scala/golem/schema/SchemaGraph.scala | 27 +- 15 files changed, 12338 insertions(+), 9776 deletions(-) delete mode 100644 sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.rs delete mode 100644 sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.stderr diff --git a/golem-common/src/model/component_metadata.rs b/golem-common/src/model/component_metadata.rs index 6f3f7b9b0e..b8dcc01b59 100644 --- a/golem-common/src/model/component_metadata.rs +++ b/golem-common/src/model/component_metadata.rs @@ -1557,7 +1557,7 @@ mod tests { fn component_metadata_grpc_roundtrip_preserves_tool_envelope() { let metadata = metadata_with_tool(); let proto: golem_api_grpc::proto::golem::component::ComponentMetadata = - metadata.clone().into(); + metadata.clone().try_into().unwrap(); let decoded = ComponentMetadata::try_from(proto).unwrap(); assert_eq!(decoded, metadata); diff --git a/golem-schema/src/schema/wit/encode.rs b/golem-schema/src/schema/wit/encode.rs index 492c75038b..471894273a 100644 --- a/golem-schema/src/schema/wit/encode.rs +++ b/golem-schema/src/schema/wit/encode.rs @@ -564,11 +564,8 @@ fn preflight_host_streams(value: &SchemaValue) -> Result<(), EncodeError> { walk(value, seen)?; } } - SchemaValue::Option { inner } => { - if let Some(value) = inner { - walk(value, seen)?; - } - } + SchemaValue::Option { inner: Some(value) } => walk(value, seen)?, + SchemaValue::Option { inner: None } => {} SchemaValue::Result(payload) => { let value = match payload { ResultValuePayload::Ok { value } | ResultValuePayload::Err { value } => value, diff --git a/sdks/moonbit/golem_sdk/api/durability.mbt b/sdks/moonbit/golem_sdk/api/durability.mbt index d48da3fca0..9e5d220dc3 100644 --- a/sdks/moonbit/golem_sdk/api/durability.mbt +++ b/sdks/moonbit/golem_sdk/api/durability.mbt @@ -143,6 +143,6 @@ fn[Response : @schema.FromSchema] decode_durable_replay( "function type differs for '\{function_name}'", ) } - let response = @model.typed_schema_value_from_wit(invocation.response) + let response = @model_host.typed_schema_value_from_wit(invocation.response) @schema.from_value_as(response.value) } diff --git a/sdks/moonbit/golem_sdk/api/moon.pkg b/sdks/moonbit/golem_sdk/api/moon.pkg index 0b87275f5a..1607a4f0b5 100644 --- a/sdks/moonbit/golem_sdk/api/moon.pkg +++ b/sdks/moonbit/golem_sdk/api/moon.pkg @@ -6,5 +6,6 @@ import { "golemcloud/golem_sdk/interface/golem/durability/durability" @raw_durability, "golemcloud/golem_sdk/schema", "golemcloud/golem_sdk/schema_model" @model, + "golemcloud/golem_sdk/schema_model_host" @model_host, "moonbitlang/core/debug", } diff --git a/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/ffi.mbt b/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/ffi.mbt index 12a85e6411..2c4f4407ab 100644 --- a/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/ffi.mbt +++ b/sdks/moonbit/golem_sdk/gen/interface/golem/agent/guest/ffi.mbt @@ -288,6 +288,12 @@ pub fn wasmExportInitialize(p0 : Int) -> Int { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -480,8 +486,6 @@ fn initialize_task_return( let cleanup_list : Array[Int] = [] let ( - lowered502, - lowered503, lowered504, lowered505, lowered506, @@ -490,19 +494,21 @@ fn initialize_task_return( lowered509, lowered510, lowered511, + lowered512, + lowered513, ) = match return_value { Ok(_payload) => (0, 0, 0, 0, 0, 0, 0, 0, 0, 0) Err(payload46) => { let ( lowered, - lowered494, - lowered495, lowered496, lowered497, lowered498, lowered499, lowered500, lowered501, + lowered502, + lowered503, ) = match payload46 { InvalidInput(payload47) => { let ptr = mbt_ffi_str2ptr(payload47) @@ -2994,14 +3000,14 @@ fn initialize_task_return( cleanup_list.push(ptr417) } - let address492 = mbt_ffi_malloc( + let address494 = mbt_ffi_malloc( payload54.value.value_nodes.length() * 32, ) - for index493 = 0 - index493 < payload54.value.value_nodes.length() - index493 = index493 + 1 { - let iter_elem : @types.SchemaValueNode = payload54.value.value_nodes[index493] - let iter_base = address492 + index493 * 32 + for index495 = 0 + index495 < payload54.value.value_nodes.length() + index495 = index495 + 1 { + let iter_elem : @types.SchemaValueNode = payload54.value.value_nodes[index495] + let iter_base = address494 + index495 * 32 match iter_elem { BoolValue(payload423) => { @@ -3439,13 +3445,21 @@ fn initialize_task_return( let @types.QuotaToken(handle491) = payload490 mbt_ffi_store32(iter_base + 8, handle491) + () + } + StreamValue(payload492) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle493) = payload492 + mbt_ffi_store32(iter_base + 8, handle493) + () } } } cleanup_list.push(address415) cleanup_list.push(address421) - cleanup_list.push(address492) + cleanup_list.push(address494) ( 4, @@ -3454,7 +3468,7 @@ fn initialize_task_return( address421, payload54.graph.defs.length(), payload54.graph.root, - address492, + address494, payload54.value.value_nodes.length(), payload54.value.root, ) @@ -3462,15 +3476,15 @@ fn initialize_task_return( } ( - 1, lowered, lowered494, lowered495, lowered496, lowered497, lowered498, - lowered499, lowered500, lowered501, + 1, lowered, lowered496, lowered497, lowered498, lowered499, lowered500, + lowered501, lowered502, lowered503, ) } } wasmExportAsyncInitializeTaskReturn( - lowered502, lowered503, lowered504, lowered505, lowered506, lowered507, lowered508, - lowered509, lowered510, lowered511, + lowered504, lowered505, lowered506, lowered507, lowered508, lowered509, lowered510, + lowered511, lowered512, lowered513, ) cleanup_list.each(mbt_ffi_free) @@ -3779,6 +3793,12 @@ pub fn wasmExportInvokeGolemAgentGuest(p0 : Int) -> Int { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -3973,29 +3993,29 @@ fn invoke_task_return( let cleanup_list : Array[Int] = [] let ( - lowered580, - lowered581, - lowered582, - lowered583, lowered584, lowered585, lowered586, lowered587, lowered588, lowered589, + lowered590, + lowered591, + lowered592, + lowered593, ) = match return_value { Ok(payload) => { - let (lowered, lowered117, lowered118, lowered119) = match payload { + let (lowered, lowered119, lowered120, lowered121) = match payload { None => (0, 0, 0, 0) Some(payload47) => { - let address115 = mbt_ffi_malloc( + let address117 = mbt_ffi_malloc( payload47.value_nodes.length() * 32, ) - for index116 = 0 - index116 < payload47.value_nodes.length() - index116 = index116 + 1 { - let iter_elem : @types.SchemaValueNode = payload47.value_nodes[index116] - let iter_base = address115 + index116 * 32 + for index118 = 0 + index118 < payload47.value_nodes.length() + index118 = index118 + 1 { + let iter_elem : @types.SchemaValueNode = payload47.value_nodes[index118] + let iter_base = address117 + index118 * 32 match iter_elem { BoolValue(payload48) => { @@ -4426,68 +4446,76 @@ fn invoke_task_return( let @types.QuotaToken(handle114) = payload113 mbt_ffi_store32(iter_base + 8, handle114) + () + } + StreamValue(payload115) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle116) = payload115 + mbt_ffi_store32(iter_base + 8, handle116) + () } } } - cleanup_list.push(address115) + cleanup_list.push(address117) - (1, address115, payload47.value_nodes.length(), payload47.root) + (1, address117, payload47.value_nodes.length(), payload47.root) } } - (0, lowered, lowered117, lowered118, lowered119, 0, 0, 0, 0, 0) + (0, lowered, lowered119, lowered120, lowered121, 0, 0, 0, 0, 0) } - Err(payload120) => { + Err(payload122) => { let ( - lowered571, - lowered572, - lowered573, - lowered574, lowered575, lowered576, lowered577, lowered578, lowered579, - ) = match payload120 { - InvalidInput(payload121) => { - let ptr122 = mbt_ffi_str2ptr(payload121) - cleanup_list.push(ptr122) - - (0, ptr122, payload121.length(), 0, 0, 0, 0, 0, 0) - } - InvalidMethod(payload123) => { + lowered580, + lowered581, + lowered582, + lowered583, + ) = match payload122 { + InvalidInput(payload123) => { let ptr124 = mbt_ffi_str2ptr(payload123) cleanup_list.push(ptr124) - (1, ptr124, payload123.length(), 0, 0, 0, 0, 0, 0) + (0, ptr124, payload123.length(), 0, 0, 0, 0, 0, 0) } - InvalidType(payload125) => { + InvalidMethod(payload125) => { let ptr126 = mbt_ffi_str2ptr(payload125) cleanup_list.push(ptr126) - (2, ptr126, payload125.length(), 0, 0, 0, 0, 0, 0) + (1, ptr126, payload125.length(), 0, 0, 0, 0, 0, 0) } - InvalidAgentId(payload127) => { + InvalidType(payload127) => { let ptr128 = mbt_ffi_str2ptr(payload127) cleanup_list.push(ptr128) - (3, ptr128, payload127.length(), 0, 0, 0, 0, 0, 0) + (2, ptr128, payload127.length(), 0, 0, 0, 0, 0, 0) } - CustomError(payload129) => { - let address491 = mbt_ffi_malloc( - payload129.graph.type_nodes.length() * 144, + InvalidAgentId(payload129) => { + let ptr130 = mbt_ffi_str2ptr(payload129) + cleanup_list.push(ptr130) + + (3, ptr130, payload129.length(), 0, 0, 0, 0, 0, 0) + } + CustomError(payload131) => { + let address493 = mbt_ffi_malloc( + payload131.graph.type_nodes.length() * 144, ) - for index492 = 0 - index492 < payload129.graph.type_nodes.length() - index492 = index492 + 1 { - let iter_elem : @types.SchemaTypeNode = payload129.graph.type_nodes[index492] - let iter_base = address491 + index492 * 144 + for index494 = 0 + index494 < payload131.graph.type_nodes.length() + index494 = index494 + 1 { + let iter_elem : @types.SchemaTypeNode = payload131.graph.type_nodes[index494] + let iter_base = address493 + index494 * 144 match iter_elem.body { - RefType(payload130) => { + RefType(payload132) => { mbt_ffi_store8(iter_base + 0, 0) - mbt_ffi_store32(iter_base + 8, payload130) + mbt_ffi_store32(iter_base + 8, payload132) () } @@ -4496,48 +4524,48 @@ fn invoke_task_return( () } - S8Type(payload132) => { + S8Type(payload134) => { mbt_ffi_store8(iter_base + 0, 2) - match payload132 { + match payload134 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload134) => { + Some(payload136) => { mbt_ffi_store8(iter_base + 8, 1) - match payload134.min { + match payload136.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload136) => { + Some(payload138) => { mbt_ffi_store8(iter_base + 16, 1) - match payload136 { - Signed(payload137) => { + match payload138 { + Signed(payload139) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload137) + mbt_ffi_store64(iter_base + 32, payload139) () } - Unsigned(payload138) => { + Unsigned(payload140) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload138.reinterpret_as_int64(), + payload140.reinterpret_as_int64(), ) () } - FloatBits(payload139) => { + FloatBits(payload141) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload139.reinterpret_as_int64(), + payload141.reinterpret_as_int64(), ) () @@ -4548,36 +4576,36 @@ fn invoke_task_return( } } - match payload134.max { + match payload136.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload141) => { + Some(payload143) => { mbt_ffi_store8(iter_base + 40, 1) - match payload141 { - Signed(payload142) => { + match payload143 { + Signed(payload144) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload142) + mbt_ffi_store64(iter_base + 56, payload144) () } - Unsigned(payload143) => { + Unsigned(payload145) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload143.reinterpret_as_int64(), + payload145.reinterpret_as_int64(), ) () } - FloatBits(payload144) => { + FloatBits(payload146) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload144.reinterpret_as_int64(), + payload146.reinterpret_as_int64(), ) () @@ -4588,19 +4616,19 @@ fn invoke_task_return( } } - match payload134.unit { + match payload136.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload146) => { + Some(payload148) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr147 = mbt_ffi_str2ptr(payload146) - mbt_ffi_store32(iter_base + 72, payload146.length()) - mbt_ffi_store32(iter_base + 68, ptr147) - cleanup_list.push(ptr147) + let ptr149 = mbt_ffi_str2ptr(payload148) + mbt_ffi_store32(iter_base + 72, payload148.length()) + mbt_ffi_store32(iter_base + 68, ptr149) + cleanup_list.push(ptr149) () } @@ -4612,48 +4640,48 @@ fn invoke_task_return( () } - S16Type(payload148) => { + S16Type(payload150) => { mbt_ffi_store8(iter_base + 0, 3) - match payload148 { + match payload150 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload150) => { + Some(payload152) => { mbt_ffi_store8(iter_base + 8, 1) - match payload150.min { + match payload152.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload152) => { + Some(payload154) => { mbt_ffi_store8(iter_base + 16, 1) - match payload152 { - Signed(payload153) => { + match payload154 { + Signed(payload155) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload153) + mbt_ffi_store64(iter_base + 32, payload155) () } - Unsigned(payload154) => { + Unsigned(payload156) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload154.reinterpret_as_int64(), + payload156.reinterpret_as_int64(), ) () } - FloatBits(payload155) => { + FloatBits(payload157) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload155.reinterpret_as_int64(), + payload157.reinterpret_as_int64(), ) () @@ -4664,36 +4692,36 @@ fn invoke_task_return( } } - match payload150.max { + match payload152.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload157) => { + Some(payload159) => { mbt_ffi_store8(iter_base + 40, 1) - match payload157 { - Signed(payload158) => { + match payload159 { + Signed(payload160) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload158) + mbt_ffi_store64(iter_base + 56, payload160) () } - Unsigned(payload159) => { + Unsigned(payload161) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload159.reinterpret_as_int64(), + payload161.reinterpret_as_int64(), ) () } - FloatBits(payload160) => { + FloatBits(payload162) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload160.reinterpret_as_int64(), + payload162.reinterpret_as_int64(), ) () @@ -4704,19 +4732,19 @@ fn invoke_task_return( } } - match payload150.unit { + match payload152.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload162) => { + Some(payload164) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr163 = mbt_ffi_str2ptr(payload162) - mbt_ffi_store32(iter_base + 72, payload162.length()) - mbt_ffi_store32(iter_base + 68, ptr163) - cleanup_list.push(ptr163) + let ptr165 = mbt_ffi_str2ptr(payload164) + mbt_ffi_store32(iter_base + 72, payload164.length()) + mbt_ffi_store32(iter_base + 68, ptr165) + cleanup_list.push(ptr165) () } @@ -4728,48 +4756,48 @@ fn invoke_task_return( () } - S32Type(payload164) => { + S32Type(payload166) => { mbt_ffi_store8(iter_base + 0, 4) - match payload164 { + match payload166 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload166) => { + Some(payload168) => { mbt_ffi_store8(iter_base + 8, 1) - match payload166.min { + match payload168.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload168) => { + Some(payload170) => { mbt_ffi_store8(iter_base + 16, 1) - match payload168 { - Signed(payload169) => { + match payload170 { + Signed(payload171) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload169) + mbt_ffi_store64(iter_base + 32, payload171) () } - Unsigned(payload170) => { + Unsigned(payload172) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload170.reinterpret_as_int64(), + payload172.reinterpret_as_int64(), ) () } - FloatBits(payload171) => { + FloatBits(payload173) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload171.reinterpret_as_int64(), + payload173.reinterpret_as_int64(), ) () @@ -4780,36 +4808,36 @@ fn invoke_task_return( } } - match payload166.max { + match payload168.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload173) => { + Some(payload175) => { mbt_ffi_store8(iter_base + 40, 1) - match payload173 { - Signed(payload174) => { + match payload175 { + Signed(payload176) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload174) + mbt_ffi_store64(iter_base + 56, payload176) () } - Unsigned(payload175) => { + Unsigned(payload177) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload175.reinterpret_as_int64(), + payload177.reinterpret_as_int64(), ) () } - FloatBits(payload176) => { + FloatBits(payload178) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload176.reinterpret_as_int64(), + payload178.reinterpret_as_int64(), ) () @@ -4820,19 +4848,19 @@ fn invoke_task_return( } } - match payload166.unit { + match payload168.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload178) => { + Some(payload180) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr179 = mbt_ffi_str2ptr(payload178) - mbt_ffi_store32(iter_base + 72, payload178.length()) - mbt_ffi_store32(iter_base + 68, ptr179) - cleanup_list.push(ptr179) + let ptr181 = mbt_ffi_str2ptr(payload180) + mbt_ffi_store32(iter_base + 72, payload180.length()) + mbt_ffi_store32(iter_base + 68, ptr181) + cleanup_list.push(ptr181) () } @@ -4844,48 +4872,48 @@ fn invoke_task_return( () } - S64Type(payload180) => { + S64Type(payload182) => { mbt_ffi_store8(iter_base + 0, 5) - match payload180 { + match payload182 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload182) => { + Some(payload184) => { mbt_ffi_store8(iter_base + 8, 1) - match payload182.min { + match payload184.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload184) => { + Some(payload186) => { mbt_ffi_store8(iter_base + 16, 1) - match payload184 { - Signed(payload185) => { + match payload186 { + Signed(payload187) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload185) + mbt_ffi_store64(iter_base + 32, payload187) () } - Unsigned(payload186) => { + Unsigned(payload188) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload186.reinterpret_as_int64(), + payload188.reinterpret_as_int64(), ) () } - FloatBits(payload187) => { + FloatBits(payload189) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload187.reinterpret_as_int64(), + payload189.reinterpret_as_int64(), ) () @@ -4896,36 +4924,36 @@ fn invoke_task_return( } } - match payload182.max { + match payload184.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload189) => { + Some(payload191) => { mbt_ffi_store8(iter_base + 40, 1) - match payload189 { - Signed(payload190) => { + match payload191 { + Signed(payload192) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload190) + mbt_ffi_store64(iter_base + 56, payload192) () } - Unsigned(payload191) => { + Unsigned(payload193) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload191.reinterpret_as_int64(), + payload193.reinterpret_as_int64(), ) () } - FloatBits(payload192) => { + FloatBits(payload194) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload192.reinterpret_as_int64(), + payload194.reinterpret_as_int64(), ) () @@ -4936,19 +4964,19 @@ fn invoke_task_return( } } - match payload182.unit { + match payload184.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload194) => { + Some(payload196) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr195 = mbt_ffi_str2ptr(payload194) - mbt_ffi_store32(iter_base + 72, payload194.length()) - mbt_ffi_store32(iter_base + 68, ptr195) - cleanup_list.push(ptr195) + let ptr197 = mbt_ffi_str2ptr(payload196) + mbt_ffi_store32(iter_base + 72, payload196.length()) + mbt_ffi_store32(iter_base + 68, ptr197) + cleanup_list.push(ptr197) () } @@ -4960,48 +4988,48 @@ fn invoke_task_return( () } - U8Type(payload196) => { + U8Type(payload198) => { mbt_ffi_store8(iter_base + 0, 6) - match payload196 { + match payload198 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload198) => { + Some(payload200) => { mbt_ffi_store8(iter_base + 8, 1) - match payload198.min { + match payload200.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload200) => { + Some(payload202) => { mbt_ffi_store8(iter_base + 16, 1) - match payload200 { - Signed(payload201) => { + match payload202 { + Signed(payload203) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload201) + mbt_ffi_store64(iter_base + 32, payload203) () } - Unsigned(payload202) => { + Unsigned(payload204) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload202.reinterpret_as_int64(), + payload204.reinterpret_as_int64(), ) () } - FloatBits(payload203) => { + FloatBits(payload205) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload203.reinterpret_as_int64(), + payload205.reinterpret_as_int64(), ) () @@ -5012,36 +5040,36 @@ fn invoke_task_return( } } - match payload198.max { + match payload200.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload205) => { + Some(payload207) => { mbt_ffi_store8(iter_base + 40, 1) - match payload205 { - Signed(payload206) => { + match payload207 { + Signed(payload208) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload206) + mbt_ffi_store64(iter_base + 56, payload208) () } - Unsigned(payload207) => { + Unsigned(payload209) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload207.reinterpret_as_int64(), + payload209.reinterpret_as_int64(), ) () } - FloatBits(payload208) => { + FloatBits(payload210) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload208.reinterpret_as_int64(), + payload210.reinterpret_as_int64(), ) () @@ -5052,19 +5080,19 @@ fn invoke_task_return( } } - match payload198.unit { + match payload200.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload210) => { + Some(payload212) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr211 = mbt_ffi_str2ptr(payload210) - mbt_ffi_store32(iter_base + 72, payload210.length()) - mbt_ffi_store32(iter_base + 68, ptr211) - cleanup_list.push(ptr211) + let ptr213 = mbt_ffi_str2ptr(payload212) + mbt_ffi_store32(iter_base + 72, payload212.length()) + mbt_ffi_store32(iter_base + 68, ptr213) + cleanup_list.push(ptr213) () } @@ -5076,48 +5104,48 @@ fn invoke_task_return( () } - U16Type(payload212) => { + U16Type(payload214) => { mbt_ffi_store8(iter_base + 0, 7) - match payload212 { + match payload214 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload214) => { + Some(payload216) => { mbt_ffi_store8(iter_base + 8, 1) - match payload214.min { + match payload216.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload216) => { + Some(payload218) => { mbt_ffi_store8(iter_base + 16, 1) - match payload216 { - Signed(payload217) => { + match payload218 { + Signed(payload219) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload217) + mbt_ffi_store64(iter_base + 32, payload219) () } - Unsigned(payload218) => { + Unsigned(payload220) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload218.reinterpret_as_int64(), + payload220.reinterpret_as_int64(), ) () } - FloatBits(payload219) => { + FloatBits(payload221) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload219.reinterpret_as_int64(), + payload221.reinterpret_as_int64(), ) () @@ -5128,36 +5156,36 @@ fn invoke_task_return( } } - match payload214.max { + match payload216.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload221) => { + Some(payload223) => { mbt_ffi_store8(iter_base + 40, 1) - match payload221 { - Signed(payload222) => { + match payload223 { + Signed(payload224) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload222) + mbt_ffi_store64(iter_base + 56, payload224) () } - Unsigned(payload223) => { + Unsigned(payload225) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload223.reinterpret_as_int64(), + payload225.reinterpret_as_int64(), ) () } - FloatBits(payload224) => { + FloatBits(payload226) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload224.reinterpret_as_int64(), + payload226.reinterpret_as_int64(), ) () @@ -5168,19 +5196,19 @@ fn invoke_task_return( } } - match payload214.unit { + match payload216.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload226) => { + Some(payload228) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr227 = mbt_ffi_str2ptr(payload226) - mbt_ffi_store32(iter_base + 72, payload226.length()) - mbt_ffi_store32(iter_base + 68, ptr227) - cleanup_list.push(ptr227) + let ptr229 = mbt_ffi_str2ptr(payload228) + mbt_ffi_store32(iter_base + 72, payload228.length()) + mbt_ffi_store32(iter_base + 68, ptr229) + cleanup_list.push(ptr229) () } @@ -5192,48 +5220,48 @@ fn invoke_task_return( () } - U32Type(payload228) => { + U32Type(payload230) => { mbt_ffi_store8(iter_base + 0, 8) - match payload228 { + match payload230 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload230) => { + Some(payload232) => { mbt_ffi_store8(iter_base + 8, 1) - match payload230.min { + match payload232.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload232) => { + Some(payload234) => { mbt_ffi_store8(iter_base + 16, 1) - match payload232 { - Signed(payload233) => { + match payload234 { + Signed(payload235) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload233) + mbt_ffi_store64(iter_base + 32, payload235) () } - Unsigned(payload234) => { + Unsigned(payload236) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload234.reinterpret_as_int64(), + payload236.reinterpret_as_int64(), ) () } - FloatBits(payload235) => { + FloatBits(payload237) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload235.reinterpret_as_int64(), + payload237.reinterpret_as_int64(), ) () @@ -5244,36 +5272,36 @@ fn invoke_task_return( } } - match payload230.max { + match payload232.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload237) => { + Some(payload239) => { mbt_ffi_store8(iter_base + 40, 1) - match payload237 { - Signed(payload238) => { + match payload239 { + Signed(payload240) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload238) + mbt_ffi_store64(iter_base + 56, payload240) () } - Unsigned(payload239) => { + Unsigned(payload241) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload239.reinterpret_as_int64(), + payload241.reinterpret_as_int64(), ) () } - FloatBits(payload240) => { + FloatBits(payload242) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload240.reinterpret_as_int64(), + payload242.reinterpret_as_int64(), ) () @@ -5284,19 +5312,19 @@ fn invoke_task_return( } } - match payload230.unit { + match payload232.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload242) => { + Some(payload244) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr243 = mbt_ffi_str2ptr(payload242) - mbt_ffi_store32(iter_base + 72, payload242.length()) - mbt_ffi_store32(iter_base + 68, ptr243) - cleanup_list.push(ptr243) + let ptr245 = mbt_ffi_str2ptr(payload244) + mbt_ffi_store32(iter_base + 72, payload244.length()) + mbt_ffi_store32(iter_base + 68, ptr245) + cleanup_list.push(ptr245) () } @@ -5308,48 +5336,48 @@ fn invoke_task_return( () } - U64Type(payload244) => { + U64Type(payload246) => { mbt_ffi_store8(iter_base + 0, 9) - match payload244 { + match payload246 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload246) => { + Some(payload248) => { mbt_ffi_store8(iter_base + 8, 1) - match payload246.min { + match payload248.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload248) => { + Some(payload250) => { mbt_ffi_store8(iter_base + 16, 1) - match payload248 { - Signed(payload249) => { + match payload250 { + Signed(payload251) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload249) + mbt_ffi_store64(iter_base + 32, payload251) () } - Unsigned(payload250) => { + Unsigned(payload252) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload250.reinterpret_as_int64(), + payload252.reinterpret_as_int64(), ) () } - FloatBits(payload251) => { + FloatBits(payload253) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload251.reinterpret_as_int64(), + payload253.reinterpret_as_int64(), ) () @@ -5360,36 +5388,36 @@ fn invoke_task_return( } } - match payload246.max { + match payload248.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload253) => { + Some(payload255) => { mbt_ffi_store8(iter_base + 40, 1) - match payload253 { - Signed(payload254) => { + match payload255 { + Signed(payload256) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload254) + mbt_ffi_store64(iter_base + 56, payload256) () } - Unsigned(payload255) => { + Unsigned(payload257) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload255.reinterpret_as_int64(), + payload257.reinterpret_as_int64(), ) () } - FloatBits(payload256) => { + FloatBits(payload258) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload256.reinterpret_as_int64(), + payload258.reinterpret_as_int64(), ) () @@ -5400,19 +5428,19 @@ fn invoke_task_return( } } - match payload246.unit { + match payload248.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload258) => { + Some(payload260) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr259 = mbt_ffi_str2ptr(payload258) - mbt_ffi_store32(iter_base + 72, payload258.length()) - mbt_ffi_store32(iter_base + 68, ptr259) - cleanup_list.push(ptr259) + let ptr261 = mbt_ffi_str2ptr(payload260) + mbt_ffi_store32(iter_base + 72, payload260.length()) + mbt_ffi_store32(iter_base + 68, ptr261) + cleanup_list.push(ptr261) () } @@ -5424,48 +5452,48 @@ fn invoke_task_return( () } - F32Type(payload260) => { + F32Type(payload262) => { mbt_ffi_store8(iter_base + 0, 10) - match payload260 { + match payload262 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload262) => { + Some(payload264) => { mbt_ffi_store8(iter_base + 8, 1) - match payload262.min { + match payload264.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload264) => { + Some(payload266) => { mbt_ffi_store8(iter_base + 16, 1) - match payload264 { - Signed(payload265) => { + match payload266 { + Signed(payload267) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload265) + mbt_ffi_store64(iter_base + 32, payload267) () } - Unsigned(payload266) => { + Unsigned(payload268) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload266.reinterpret_as_int64(), + payload268.reinterpret_as_int64(), ) () } - FloatBits(payload267) => { + FloatBits(payload269) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload267.reinterpret_as_int64(), + payload269.reinterpret_as_int64(), ) () @@ -5476,36 +5504,36 @@ fn invoke_task_return( } } - match payload262.max { + match payload264.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload269) => { + Some(payload271) => { mbt_ffi_store8(iter_base + 40, 1) - match payload269 { - Signed(payload270) => { + match payload271 { + Signed(payload272) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload270) + mbt_ffi_store64(iter_base + 56, payload272) () } - Unsigned(payload271) => { + Unsigned(payload273) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload271.reinterpret_as_int64(), + payload273.reinterpret_as_int64(), ) () } - FloatBits(payload272) => { + FloatBits(payload274) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload272.reinterpret_as_int64(), + payload274.reinterpret_as_int64(), ) () @@ -5516,19 +5544,19 @@ fn invoke_task_return( } } - match payload262.unit { + match payload264.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload274) => { + Some(payload276) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr275 = mbt_ffi_str2ptr(payload274) - mbt_ffi_store32(iter_base + 72, payload274.length()) - mbt_ffi_store32(iter_base + 68, ptr275) - cleanup_list.push(ptr275) + let ptr277 = mbt_ffi_str2ptr(payload276) + mbt_ffi_store32(iter_base + 72, payload276.length()) + mbt_ffi_store32(iter_base + 68, ptr277) + cleanup_list.push(ptr277) () } @@ -5540,48 +5568,48 @@ fn invoke_task_return( () } - F64Type(payload276) => { + F64Type(payload278) => { mbt_ffi_store8(iter_base + 0, 11) - match payload276 { + match payload278 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload278) => { + Some(payload280) => { mbt_ffi_store8(iter_base + 8, 1) - match payload278.min { + match payload280.min { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload280) => { + Some(payload282) => { mbt_ffi_store8(iter_base + 16, 1) - match payload280 { - Signed(payload281) => { + match payload282 { + Signed(payload283) => { mbt_ffi_store8(iter_base + 24, 0) - mbt_ffi_store64(iter_base + 32, payload281) + mbt_ffi_store64(iter_base + 32, payload283) () } - Unsigned(payload282) => { + Unsigned(payload284) => { mbt_ffi_store8(iter_base + 24, 1) mbt_ffi_store64( iter_base + 32, - payload282.reinterpret_as_int64(), + payload284.reinterpret_as_int64(), ) () } - FloatBits(payload283) => { + FloatBits(payload285) => { mbt_ffi_store8(iter_base + 24, 2) mbt_ffi_store64( iter_base + 32, - payload283.reinterpret_as_int64(), + payload285.reinterpret_as_int64(), ) () @@ -5592,36 +5620,36 @@ fn invoke_task_return( } } - match payload278.max { + match payload280.max { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload285) => { + Some(payload287) => { mbt_ffi_store8(iter_base + 40, 1) - match payload285 { - Signed(payload286) => { + match payload287 { + Signed(payload288) => { mbt_ffi_store8(iter_base + 48, 0) - mbt_ffi_store64(iter_base + 56, payload286) + mbt_ffi_store64(iter_base + 56, payload288) () } - Unsigned(payload287) => { + Unsigned(payload289) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload287.reinterpret_as_int64(), + payload289.reinterpret_as_int64(), ) () } - FloatBits(payload288) => { + FloatBits(payload290) => { mbt_ffi_store8(iter_base + 48, 2) mbt_ffi_store64( iter_base + 56, - payload288.reinterpret_as_int64(), + payload290.reinterpret_as_int64(), ) () @@ -5632,19 +5660,19 @@ fn invoke_task_return( } } - match payload278.unit { + match payload280.unit { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload290) => { + Some(payload292) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr291 = mbt_ffi_str2ptr(payload290) - mbt_ffi_store32(iter_base + 72, payload290.length()) - mbt_ffi_store32(iter_base + 68, ptr291) - cleanup_list.push(ptr291) + let ptr293 = mbt_ffi_str2ptr(payload292) + mbt_ffi_store32(iter_base + 72, payload292.length()) + mbt_ffi_store32(iter_base + 68, ptr293) + cleanup_list.push(ptr293) () } @@ -5666,19 +5694,19 @@ fn invoke_task_return( () } - RecordType(payload294) => { + RecordType(payload296) => { mbt_ffi_store8(iter_base + 0, 14) - let address315 = mbt_ffi_malloc(payload294.length() * 68) - for index316 = 0 - index316 < payload294.length() - index316 = index316 + 1 { - let iter_elem : @types.NamedFieldType = payload294[index316] - let iter_base = address315 + index316 * 68 + let address317 = mbt_ffi_malloc(payload296.length() * 68) + for index318 = 0 + index318 < payload296.length() + index318 = index318 + 1 { + let iter_elem : @types.NamedFieldType = payload296[index318] + let iter_base = address317 + index318 * 68 - let ptr295 = mbt_ffi_str2ptr(iter_elem.name) + let ptr297 = mbt_ffi_str2ptr(iter_elem.name) mbt_ffi_store32(iter_base + 4, iter_elem.name.length()) - mbt_ffi_store32(iter_base + 0, ptr295) + mbt_ffi_store32(iter_base + 0, ptr297) mbt_ffi_store32(iter_base + 8, iter_elem.body) match iter_elem.metadata.doc { @@ -5687,57 +5715,57 @@ fn invoke_task_return( () } - Some(payload297) => { + Some(payload299) => { mbt_ffi_store8(iter_base + 12, 1) - let ptr298 = mbt_ffi_str2ptr(payload297) - mbt_ffi_store32(iter_base + 20, payload297.length()) - mbt_ffi_store32(iter_base + 16, ptr298) - cleanup_list.push(ptr298) + let ptr300 = mbt_ffi_str2ptr(payload299) + mbt_ffi_store32(iter_base + 20, payload299.length()) + mbt_ffi_store32(iter_base + 16, ptr300) + cleanup_list.push(ptr300) () } } - let address300 = mbt_ffi_malloc( + let address302 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index301 = 0 - index301 < iter_elem.metadata.aliases.length() - index301 = index301 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index301] - let iter_base = address300 + index301 * 8 + for index303 = 0 + index303 < iter_elem.metadata.aliases.length() + index303 = index303 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index303] + let iter_base = address302 + index303 * 8 - let ptr299 = mbt_ffi_str2ptr(iter_elem) + let ptr301 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr299) - cleanup_list.push(ptr299) + mbt_ffi_store32(iter_base + 0, ptr301) + cleanup_list.push(ptr301) } mbt_ffi_store32( iter_base + 28, iter_elem.metadata.aliases.length(), ) - mbt_ffi_store32(iter_base + 24, address300) + mbt_ffi_store32(iter_base + 24, address302) - let address303 = mbt_ffi_malloc( + let address305 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index304 = 0 - index304 < iter_elem.metadata.examples.length() - index304 = index304 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index304] - let iter_base = address303 + index304 * 8 + for index306 = 0 + index306 < iter_elem.metadata.examples.length() + index306 = index306 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index306] + let iter_base = address305 + index306 * 8 - let ptr302 = mbt_ffi_str2ptr(iter_elem) + let ptr304 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr302) - cleanup_list.push(ptr302) + mbt_ffi_store32(iter_base + 0, ptr304) + cleanup_list.push(ptr304) } mbt_ffi_store32( iter_base + 36, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 32, address303) + mbt_ffi_store32(iter_base + 32, address305) match iter_elem.metadata.deprecated { None => { @@ -5745,13 +5773,13 @@ fn invoke_task_return( () } - Some(payload306) => { + Some(payload308) => { mbt_ffi_store8(iter_base + 40, 1) - let ptr307 = mbt_ffi_str2ptr(payload306) - mbt_ffi_store32(iter_base + 48, payload306.length()) - mbt_ffi_store32(iter_base + 44, ptr307) - cleanup_list.push(ptr307) + let ptr309 = mbt_ffi_str2ptr(payload308) + mbt_ffi_store32(iter_base + 48, payload308.length()) + mbt_ffi_store32(iter_base + 44, ptr309) + cleanup_list.push(ptr309) () } @@ -5763,10 +5791,10 @@ fn invoke_task_return( () } - Some(payload309) => { + Some(payload311) => { mbt_ffi_store8(iter_base + 52, 1) - match payload309 { + match payload311 { Multimodal => { mbt_ffi_store8(iter_base + 56, 0) @@ -5782,16 +5810,16 @@ fn invoke_task_return( () } - Other(payload313) => { + Other(payload315) => { mbt_ffi_store8(iter_base + 56, 3) - let ptr314 = mbt_ffi_str2ptr(payload313) + let ptr316 = mbt_ffi_str2ptr(payload315) mbt_ffi_store32( iter_base + 64, - payload313.length(), + payload315.length(), ) - mbt_ffi_store32(iter_base + 60, ptr314) - cleanup_list.push(ptr314) + mbt_ffi_store32(iter_base + 60, ptr316) + cleanup_list.push(ptr316) () } @@ -5800,29 +5828,29 @@ fn invoke_task_return( () } } - cleanup_list.push(ptr295) - cleanup_list.push(address300) - cleanup_list.push(address303) + cleanup_list.push(ptr297) + cleanup_list.push(address302) + cleanup_list.push(address305) } - mbt_ffi_store32(iter_base + 12, payload294.length()) - mbt_ffi_store32(iter_base + 8, address315) - cleanup_list.push(address315) + mbt_ffi_store32(iter_base + 12, payload296.length()) + mbt_ffi_store32(iter_base + 8, address317) + cleanup_list.push(address317) () } - VariantType(payload317) => { + VariantType(payload319) => { mbt_ffi_store8(iter_base + 0, 15) - let address340 = mbt_ffi_malloc(payload317.length() * 72) - for index341 = 0 - index341 < payload317.length() - index341 = index341 + 1 { - let iter_elem : @types.VariantCaseType = payload317[index341] - let iter_base = address340 + index341 * 72 + let address342 = mbt_ffi_malloc(payload319.length() * 72) + for index343 = 0 + index343 < payload319.length() + index343 = index343 + 1 { + let iter_elem : @types.VariantCaseType = payload319[index343] + let iter_base = address342 + index343 * 72 - let ptr318 = mbt_ffi_str2ptr(iter_elem.name) + let ptr320 = mbt_ffi_str2ptr(iter_elem.name) mbt_ffi_store32(iter_base + 4, iter_elem.name.length()) - mbt_ffi_store32(iter_base + 0, ptr318) + mbt_ffi_store32(iter_base + 0, ptr320) match iter_elem.payload { None => { @@ -5830,9 +5858,9 @@ fn invoke_task_return( () } - Some(payload320) => { + Some(payload322) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload320) + mbt_ffi_store32(iter_base + 12, payload322) () } @@ -5844,57 +5872,57 @@ fn invoke_task_return( () } - Some(payload322) => { + Some(payload324) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr323 = mbt_ffi_str2ptr(payload322) - mbt_ffi_store32(iter_base + 24, payload322.length()) - mbt_ffi_store32(iter_base + 20, ptr323) - cleanup_list.push(ptr323) + let ptr325 = mbt_ffi_str2ptr(payload324) + mbt_ffi_store32(iter_base + 24, payload324.length()) + mbt_ffi_store32(iter_base + 20, ptr325) + cleanup_list.push(ptr325) () } } - let address325 = mbt_ffi_malloc( + let address327 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index326 = 0 - index326 < iter_elem.metadata.aliases.length() - index326 = index326 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index326] - let iter_base = address325 + index326 * 8 + for index328 = 0 + index328 < iter_elem.metadata.aliases.length() + index328 = index328 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index328] + let iter_base = address327 + index328 * 8 - let ptr324 = mbt_ffi_str2ptr(iter_elem) + let ptr326 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr324) - cleanup_list.push(ptr324) + mbt_ffi_store32(iter_base + 0, ptr326) + cleanup_list.push(ptr326) } mbt_ffi_store32( iter_base + 32, iter_elem.metadata.aliases.length(), ) - mbt_ffi_store32(iter_base + 28, address325) + mbt_ffi_store32(iter_base + 28, address327) - let address328 = mbt_ffi_malloc( + let address330 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index329 = 0 - index329 < iter_elem.metadata.examples.length() - index329 = index329 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index329] - let iter_base = address328 + index329 * 8 + for index331 = 0 + index331 < iter_elem.metadata.examples.length() + index331 = index331 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index331] + let iter_base = address330 + index331 * 8 - let ptr327 = mbt_ffi_str2ptr(iter_elem) + let ptr329 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr327) - cleanup_list.push(ptr327) + mbt_ffi_store32(iter_base + 0, ptr329) + cleanup_list.push(ptr329) } mbt_ffi_store32( iter_base + 40, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 36, address328) + mbt_ffi_store32(iter_base + 36, address330) match iter_elem.metadata.deprecated { None => { @@ -5902,13 +5930,13 @@ fn invoke_task_return( () } - Some(payload331) => { + Some(payload333) => { mbt_ffi_store8(iter_base + 44, 1) - let ptr332 = mbt_ffi_str2ptr(payload331) - mbt_ffi_store32(iter_base + 52, payload331.length()) - mbt_ffi_store32(iter_base + 48, ptr332) - cleanup_list.push(ptr332) + let ptr334 = mbt_ffi_str2ptr(payload333) + mbt_ffi_store32(iter_base + 52, payload333.length()) + mbt_ffi_store32(iter_base + 48, ptr334) + cleanup_list.push(ptr334) () } @@ -5920,10 +5948,10 @@ fn invoke_task_return( () } - Some(payload334) => { + Some(payload336) => { mbt_ffi_store8(iter_base + 56, 1) - match payload334 { + match payload336 { Multimodal => { mbt_ffi_store8(iter_base + 60, 0) @@ -5939,16 +5967,16 @@ fn invoke_task_return( () } - Other(payload338) => { + Other(payload340) => { mbt_ffi_store8(iter_base + 60, 3) - let ptr339 = mbt_ffi_str2ptr(payload338) + let ptr341 = mbt_ffi_str2ptr(payload340) mbt_ffi_store32( iter_base + 68, - payload338.length(), + payload340.length(), ) - mbt_ffi_store32(iter_base + 64, ptr339) - cleanup_list.push(ptr339) + mbt_ffi_store32(iter_base + 64, ptr341) + cleanup_list.push(ptr341) () } @@ -5957,130 +5985,130 @@ fn invoke_task_return( () } } - cleanup_list.push(ptr318) - cleanup_list.push(address325) - cleanup_list.push(address328) + cleanup_list.push(ptr320) + cleanup_list.push(address327) + cleanup_list.push(address330) } - mbt_ffi_store32(iter_base + 12, payload317.length()) - mbt_ffi_store32(iter_base + 8, address340) - cleanup_list.push(address340) + mbt_ffi_store32(iter_base + 12, payload319.length()) + mbt_ffi_store32(iter_base + 8, address342) + cleanup_list.push(address342) () } - EnumType(payload342) => { + EnumType(payload344) => { mbt_ffi_store8(iter_base + 0, 16) - let address344 = mbt_ffi_malloc(payload342.length() * 8) - for index345 = 0 - index345 < payload342.length() - index345 = index345 + 1 { - let iter_elem : String = payload342[index345] - let iter_base = address344 + index345 * 8 + let address346 = mbt_ffi_malloc(payload344.length() * 8) + for index347 = 0 + index347 < payload344.length() + index347 = index347 + 1 { + let iter_elem : String = payload344[index347] + let iter_base = address346 + index347 * 8 - let ptr343 = mbt_ffi_str2ptr(iter_elem) + let ptr345 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr343) - cleanup_list.push(ptr343) + mbt_ffi_store32(iter_base + 0, ptr345) + cleanup_list.push(ptr345) } - mbt_ffi_store32(iter_base + 12, payload342.length()) - mbt_ffi_store32(iter_base + 8, address344) - cleanup_list.push(address344) + mbt_ffi_store32(iter_base + 12, payload344.length()) + mbt_ffi_store32(iter_base + 8, address346) + cleanup_list.push(address346) () } - FlagsType(payload346) => { + FlagsType(payload348) => { mbt_ffi_store8(iter_base + 0, 17) - let address348 = mbt_ffi_malloc(payload346.length() * 8) - for index349 = 0 - index349 < payload346.length() - index349 = index349 + 1 { - let iter_elem : String = payload346[index349] - let iter_base = address348 + index349 * 8 + let address350 = mbt_ffi_malloc(payload348.length() * 8) + for index351 = 0 + index351 < payload348.length() + index351 = index351 + 1 { + let iter_elem : String = payload348[index351] + let iter_base = address350 + index351 * 8 - let ptr347 = mbt_ffi_str2ptr(iter_elem) + let ptr349 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr347) - cleanup_list.push(ptr347) + mbt_ffi_store32(iter_base + 0, ptr349) + cleanup_list.push(ptr349) } - mbt_ffi_store32(iter_base + 12, payload346.length()) - mbt_ffi_store32(iter_base + 8, address348) - cleanup_list.push(address348) + mbt_ffi_store32(iter_base + 12, payload348.length()) + mbt_ffi_store32(iter_base + 8, address350) + cleanup_list.push(address350) () } - TupleType(payload350) => { + TupleType(payload352) => { mbt_ffi_store8(iter_base + 0, 18) - let address351 = mbt_ffi_malloc(payload350.length() * 4) - for index352 = 0 - index352 < payload350.length() - index352 = index352 + 1 { - let iter_elem : Int = payload350[index352] - let iter_base = address351 + index352 * 4 + let address353 = mbt_ffi_malloc(payload352.length() * 4) + for index354 = 0 + index354 < payload352.length() + index354 = index354 + 1 { + let iter_elem : Int = payload352[index354] + let iter_base = address353 + index354 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload350.length()) - mbt_ffi_store32(iter_base + 8, address351) - cleanup_list.push(address351) + mbt_ffi_store32(iter_base + 12, payload352.length()) + mbt_ffi_store32(iter_base + 8, address353) + cleanup_list.push(address353) () } - ListType(payload353) => { + ListType(payload355) => { mbt_ffi_store8(iter_base + 0, 19) - mbt_ffi_store32(iter_base + 8, payload353) + mbt_ffi_store32(iter_base + 8, payload355) () } - FixedListType(payload354) => { + FixedListType(payload356) => { mbt_ffi_store8(iter_base + 0, 20) - mbt_ffi_store32(iter_base + 8, payload354.element) + mbt_ffi_store32(iter_base + 8, payload356.element) mbt_ffi_store32( iter_base + 12, - payload354.length.reinterpret_as_int(), + payload356.length.reinterpret_as_int(), ) () } - MapType(payload355) => { + MapType(payload357) => { mbt_ffi_store8(iter_base + 0, 21) - mbt_ffi_store32(iter_base + 8, payload355.key) - mbt_ffi_store32(iter_base + 12, payload355.value) + mbt_ffi_store32(iter_base + 8, payload357.key) + mbt_ffi_store32(iter_base + 12, payload357.value) () } - OptionType(payload356) => { + OptionType(payload358) => { mbt_ffi_store8(iter_base + 0, 22) - mbt_ffi_store32(iter_base + 8, payload356) + mbt_ffi_store32(iter_base + 8, payload358) () } - ResultType(payload357) => { + ResultType(payload359) => { mbt_ffi_store8(iter_base + 0, 23) - match payload357.ok { + match payload359.ok { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload359) => { + Some(payload361) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload359) + mbt_ffi_store32(iter_base + 12, payload361) () } } - match payload357.err { + match payload359.err { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload361) => { + Some(payload363) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store32(iter_base + 20, payload361) + mbt_ffi_store32(iter_base + 20, payload363) () } @@ -6088,85 +6116,85 @@ fn invoke_task_return( () } - TextType(payload362) => { + TextType(payload364) => { mbt_ffi_store8(iter_base + 0, 24) - match payload362.languages { + match payload364.languages { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload364) => { + Some(payload366) => { mbt_ffi_store8(iter_base + 8, 1) - let address366 = mbt_ffi_malloc(payload364.length() * 8) - for index367 = 0 - index367 < payload364.length() - index367 = index367 + 1 { - let iter_elem : String = payload364[index367] - let iter_base = address366 + index367 * 8 + let address368 = mbt_ffi_malloc(payload366.length() * 8) + for index369 = 0 + index369 < payload366.length() + index369 = index369 + 1 { + let iter_elem : String = payload366[index369] + let iter_base = address368 + index369 * 8 - let ptr365 = mbt_ffi_str2ptr(iter_elem) + let ptr367 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr365) - cleanup_list.push(ptr365) + mbt_ffi_store32(iter_base + 0, ptr367) + cleanup_list.push(ptr367) } - mbt_ffi_store32(iter_base + 16, payload364.length()) - mbt_ffi_store32(iter_base + 12, address366) - cleanup_list.push(address366) + mbt_ffi_store32(iter_base + 16, payload366.length()) + mbt_ffi_store32(iter_base + 12, address368) + cleanup_list.push(address368) () } } - match payload362.min_length { + match payload364.min_length { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload369) => { + Some(payload371) => { mbt_ffi_store8(iter_base + 20, 1) mbt_ffi_store32( iter_base + 24, - payload369.reinterpret_as_int(), + payload371.reinterpret_as_int(), ) () } } - match payload362.max_length { + match payload364.max_length { None => { mbt_ffi_store8(iter_base + 28, 0) () } - Some(payload371) => { + Some(payload373) => { mbt_ffi_store8(iter_base + 28, 1) mbt_ffi_store32( iter_base + 32, - payload371.reinterpret_as_int(), + payload373.reinterpret_as_int(), ) () } } - match payload362.regex { + match payload364.regex { None => { mbt_ffi_store8(iter_base + 36, 0) () } - Some(payload373) => { + Some(payload375) => { mbt_ffi_store8(iter_base + 36, 1) - let ptr374 = mbt_ffi_str2ptr(payload373) - mbt_ffi_store32(iter_base + 44, payload373.length()) - mbt_ffi_store32(iter_base + 40, ptr374) - cleanup_list.push(ptr374) + let ptr376 = mbt_ffi_str2ptr(payload375) + mbt_ffi_store32(iter_base + 44, payload375.length()) + mbt_ffi_store32(iter_base + 40, ptr376) + cleanup_list.push(ptr376) () } @@ -6174,66 +6202,66 @@ fn invoke_task_return( () } - BinaryType(payload375) => { + BinaryType(payload377) => { mbt_ffi_store8(iter_base + 0, 25) - match payload375.mime_types { + match payload377.mime_types { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload377) => { + Some(payload379) => { mbt_ffi_store8(iter_base + 8, 1) - let address379 = mbt_ffi_malloc(payload377.length() * 8) - for index380 = 0 - index380 < payload377.length() - index380 = index380 + 1 { - let iter_elem : String = payload377[index380] - let iter_base = address379 + index380 * 8 + let address381 = mbt_ffi_malloc(payload379.length() * 8) + for index382 = 0 + index382 < payload379.length() + index382 = index382 + 1 { + let iter_elem : String = payload379[index382] + let iter_base = address381 + index382 * 8 - let ptr378 = mbt_ffi_str2ptr(iter_elem) + let ptr380 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr378) - cleanup_list.push(ptr378) + mbt_ffi_store32(iter_base + 0, ptr380) + cleanup_list.push(ptr380) } - mbt_ffi_store32(iter_base + 16, payload377.length()) - mbt_ffi_store32(iter_base + 12, address379) - cleanup_list.push(address379) + mbt_ffi_store32(iter_base + 16, payload379.length()) + mbt_ffi_store32(iter_base + 12, address381) + cleanup_list.push(address381) () } } - match payload375.min_bytes { + match payload377.min_bytes { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload382) => { + Some(payload384) => { mbt_ffi_store8(iter_base + 20, 1) mbt_ffi_store32( iter_base + 24, - payload382.reinterpret_as_int(), + payload384.reinterpret_as_int(), ) () } } - match payload375.max_bytes { + match payload377.max_bytes { None => { mbt_ffi_store8(iter_base + 28, 0) () } - Some(payload384) => { + Some(payload386) => { mbt_ffi_store8(iter_base + 28, 1) mbt_ffi_store32( iter_base + 32, - payload384.reinterpret_as_int(), + payload386.reinterpret_as_int(), ) () @@ -6242,67 +6270,67 @@ fn invoke_task_return( () } - PathType(payload385) => { + PathType(payload387) => { mbt_ffi_store8(iter_base + 0, 26) mbt_ffi_store8( iter_base + 8, - payload385.direction.ordinal(), + payload387.direction.ordinal(), ) - mbt_ffi_store8(iter_base + 9, payload385.kind.ordinal()) + mbt_ffi_store8(iter_base + 9, payload387.kind.ordinal()) - match payload385.allowed_mime_types { + match payload387.allowed_mime_types { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload387) => { + Some(payload389) => { mbt_ffi_store8(iter_base + 12, 1) - let address389 = mbt_ffi_malloc(payload387.length() * 8) - for index390 = 0 - index390 < payload387.length() - index390 = index390 + 1 { - let iter_elem : String = payload387[index390] - let iter_base = address389 + index390 * 8 + let address391 = mbt_ffi_malloc(payload389.length() * 8) + for index392 = 0 + index392 < payload389.length() + index392 = index392 + 1 { + let iter_elem : String = payload389[index392] + let iter_base = address391 + index392 * 8 - let ptr388 = mbt_ffi_str2ptr(iter_elem) + let ptr390 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr388) - cleanup_list.push(ptr388) + mbt_ffi_store32(iter_base + 0, ptr390) + cleanup_list.push(ptr390) } - mbt_ffi_store32(iter_base + 20, payload387.length()) - mbt_ffi_store32(iter_base + 16, address389) - cleanup_list.push(address389) + mbt_ffi_store32(iter_base + 20, payload389.length()) + mbt_ffi_store32(iter_base + 16, address391) + cleanup_list.push(address391) () } } - match payload385.allowed_extensions { + match payload387.allowed_extensions { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload392) => { + Some(payload394) => { mbt_ffi_store8(iter_base + 24, 1) - let address394 = mbt_ffi_malloc(payload392.length() * 8) - for index395 = 0 - index395 < payload392.length() - index395 = index395 + 1 { - let iter_elem : String = payload392[index395] - let iter_base = address394 + index395 * 8 + let address396 = mbt_ffi_malloc(payload394.length() * 8) + for index397 = 0 + index397 < payload394.length() + index397 = index397 + 1 { + let iter_elem : String = payload394[index397] + let iter_base = address396 + index397 * 8 - let ptr393 = mbt_ffi_str2ptr(iter_elem) + let ptr395 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr393) - cleanup_list.push(ptr393) + mbt_ffi_store32(iter_base + 0, ptr395) + cleanup_list.push(ptr395) } - mbt_ffi_store32(iter_base + 32, payload392.length()) - mbt_ffi_store32(iter_base + 28, address394) - cleanup_list.push(address394) + mbt_ffi_store32(iter_base + 32, payload394.length()) + mbt_ffi_store32(iter_base + 28, address396) + cleanup_list.push(address396) () } @@ -6310,62 +6338,62 @@ fn invoke_task_return( () } - UrlType(payload396) => { + UrlType(payload398) => { mbt_ffi_store8(iter_base + 0, 27) - match payload396.allowed_schemes { + match payload398.allowed_schemes { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload398) => { + Some(payload400) => { mbt_ffi_store8(iter_base + 8, 1) - let address400 = mbt_ffi_malloc(payload398.length() * 8) - for index401 = 0 - index401 < payload398.length() - index401 = index401 + 1 { - let iter_elem : String = payload398[index401] - let iter_base = address400 + index401 * 8 + let address402 = mbt_ffi_malloc(payload400.length() * 8) + for index403 = 0 + index403 < payload400.length() + index403 = index403 + 1 { + let iter_elem : String = payload400[index403] + let iter_base = address402 + index403 * 8 - let ptr399 = mbt_ffi_str2ptr(iter_elem) + let ptr401 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr399) - cleanup_list.push(ptr399) + mbt_ffi_store32(iter_base + 0, ptr401) + cleanup_list.push(ptr401) } - mbt_ffi_store32(iter_base + 16, payload398.length()) - mbt_ffi_store32(iter_base + 12, address400) - cleanup_list.push(address400) + mbt_ffi_store32(iter_base + 16, payload400.length()) + mbt_ffi_store32(iter_base + 12, address402) + cleanup_list.push(address402) () } } - match payload396.allowed_hosts { + match payload398.allowed_hosts { None => { mbt_ffi_store8(iter_base + 20, 0) () } - Some(payload403) => { + Some(payload405) => { mbt_ffi_store8(iter_base + 20, 1) - let address405 = mbt_ffi_malloc(payload403.length() * 8) - for index406 = 0 - index406 < payload403.length() - index406 = index406 + 1 { - let iter_elem : String = payload403[index406] - let iter_base = address405 + index406 * 8 + let address407 = mbt_ffi_malloc(payload405.length() * 8) + for index408 = 0 + index408 < payload405.length() + index408 = index408 + 1 { + let iter_elem : String = payload405[index408] + let iter_base = address407 + index408 * 8 - let ptr404 = mbt_ffi_str2ptr(iter_elem) + let ptr406 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr404) - cleanup_list.push(ptr404) + mbt_ffi_store32(iter_base + 0, ptr406) + cleanup_list.push(ptr406) } - mbt_ffi_store32(iter_base + 28, payload403.length()) - mbt_ffi_store32(iter_base + 24, address405) - cleanup_list.push(address405) + mbt_ffi_store32(iter_base + 28, payload405.length()) + mbt_ffi_store32(iter_base + 24, address407) + cleanup_list.push(address407) () } @@ -6383,117 +6411,107 @@ fn invoke_task_return( () } - QuantityType(payload409) => { + QuantityType(payload411) => { mbt_ffi_store8(iter_base + 0, 30) - let ptr410 = mbt_ffi_str2ptr(payload409.base_unit) + let ptr412 = mbt_ffi_str2ptr(payload411.base_unit) mbt_ffi_store32( iter_base + 12, - payload409.base_unit.length(), + payload411.base_unit.length(), ) - mbt_ffi_store32(iter_base + 8, ptr410) + mbt_ffi_store32(iter_base + 8, ptr412) - let address412 = mbt_ffi_malloc( - payload409.allowed_suffixes.length() * 8, + let address414 = mbt_ffi_malloc( + payload411.allowed_suffixes.length() * 8, ) - for index413 = 0 - index413 < payload409.allowed_suffixes.length() - index413 = index413 + 1 { - let iter_elem : String = payload409.allowed_suffixes[index413] - let iter_base = address412 + index413 * 8 + for index415 = 0 + index415 < payload411.allowed_suffixes.length() + index415 = index415 + 1 { + let iter_elem : String = payload411.allowed_suffixes[index415] + let iter_base = address414 + index415 * 8 - let ptr411 = mbt_ffi_str2ptr(iter_elem) + let ptr413 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr411) - cleanup_list.push(ptr411) + mbt_ffi_store32(iter_base + 0, ptr413) + cleanup_list.push(ptr413) } mbt_ffi_store32( iter_base + 20, - payload409.allowed_suffixes.length(), + payload411.allowed_suffixes.length(), ) - mbt_ffi_store32(iter_base + 16, address412) + mbt_ffi_store32(iter_base + 16, address414) - match payload409.min { + match payload411.min { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload415) => { + Some(payload417) => { mbt_ffi_store8(iter_base + 24, 1) - mbt_ffi_store64(iter_base + 32, payload415.mantissa) - mbt_ffi_store32(iter_base + 40, payload415.scale) + mbt_ffi_store64(iter_base + 32, payload417.mantissa) + mbt_ffi_store32(iter_base + 40, payload417.scale) - let ptr416 = mbt_ffi_str2ptr(payload415.unit) + let ptr418 = mbt_ffi_str2ptr(payload417.unit) mbt_ffi_store32( iter_base + 48, - payload415.unit.length(), + payload417.unit.length(), ) - mbt_ffi_store32(iter_base + 44, ptr416) - cleanup_list.push(ptr416) + mbt_ffi_store32(iter_base + 44, ptr418) + cleanup_list.push(ptr418) () } } - match payload409.max { + match payload411.max { None => { mbt_ffi_store8(iter_base + 56, 0) () } - Some(payload418) => { + Some(payload420) => { mbt_ffi_store8(iter_base + 56, 1) - mbt_ffi_store64(iter_base + 64, payload418.mantissa) - mbt_ffi_store32(iter_base + 72, payload418.scale) + mbt_ffi_store64(iter_base + 64, payload420.mantissa) + mbt_ffi_store32(iter_base + 72, payload420.scale) - let ptr419 = mbt_ffi_str2ptr(payload418.unit) + let ptr421 = mbt_ffi_str2ptr(payload420.unit) mbt_ffi_store32( iter_base + 80, - payload418.unit.length(), + payload420.unit.length(), ) - mbt_ffi_store32(iter_base + 76, ptr419) - cleanup_list.push(ptr419) + mbt_ffi_store32(iter_base + 76, ptr421) + cleanup_list.push(ptr421) () } } - cleanup_list.push(ptr410) - cleanup_list.push(address412) + cleanup_list.push(ptr412) + cleanup_list.push(address414) () } - UnionType(payload420) => { + UnionType(payload422) => { mbt_ffi_store8(iter_base + 0, 31) - let address456 = mbt_ffi_malloc( - payload420.branches.length() * 92, + let address458 = mbt_ffi_malloc( + payload422.branches.length() * 92, ) - for index457 = 0 - index457 < payload420.branches.length() - index457 = index457 + 1 { - let iter_elem : @types.UnionBranch = payload420.branches[index457] - let iter_base = address456 + index457 * 92 + for index459 = 0 + index459 < payload422.branches.length() + index459 = index459 + 1 { + let iter_elem : @types.UnionBranch = payload422.branches[index459] + let iter_base = address458 + index459 * 92 - let ptr421 = mbt_ffi_str2ptr(iter_elem.tag) + let ptr423 = mbt_ffi_str2ptr(iter_elem.tag) mbt_ffi_store32(iter_base + 4, iter_elem.tag.length()) - mbt_ffi_store32(iter_base + 0, ptr421) + mbt_ffi_store32(iter_base + 0, ptr423) mbt_ffi_store32(iter_base + 8, iter_elem.body) match iter_elem.discriminator { - Prefix(payload422) => { + Prefix(payload424) => { mbt_ffi_store8(iter_base + 12, 0) - let ptr423 = mbt_ffi_str2ptr(payload422) - mbt_ffi_store32(iter_base + 20, payload422.length()) - mbt_ffi_store32(iter_base + 16, ptr423) - cleanup_list.push(ptr423) - - () - } - Suffix(payload424) => { - mbt_ffi_store8(iter_base + 12, 1) - let ptr425 = mbt_ffi_str2ptr(payload424) mbt_ffi_store32(iter_base + 20, payload424.length()) mbt_ffi_store32(iter_base + 16, ptr425) @@ -6501,8 +6519,8 @@ fn invoke_task_return( () } - Contains(payload426) => { - mbt_ffi_store8(iter_base + 12, 2) + Suffix(payload426) => { + mbt_ffi_store8(iter_base + 12, 1) let ptr427 = mbt_ffi_str2ptr(payload426) mbt_ffi_store32(iter_base + 20, payload426.length()) @@ -6511,8 +6529,8 @@ fn invoke_task_return( () } - Regex(payload428) => { - mbt_ffi_store8(iter_base + 12, 3) + Contains(payload428) => { + mbt_ffi_store8(iter_base + 12, 2) let ptr429 = mbt_ffi_str2ptr(payload428) mbt_ffi_store32(iter_base + 20, payload428.length()) @@ -6521,47 +6539,57 @@ fn invoke_task_return( () } - FieldEquals(payload430) => { + Regex(payload430) => { + mbt_ffi_store8(iter_base + 12, 3) + + let ptr431 = mbt_ffi_str2ptr(payload430) + mbt_ffi_store32(iter_base + 20, payload430.length()) + mbt_ffi_store32(iter_base + 16, ptr431) + cleanup_list.push(ptr431) + + () + } + FieldEquals(payload432) => { mbt_ffi_store8(iter_base + 12, 4) - let ptr431 = mbt_ffi_str2ptr(payload430.field_name) + let ptr433 = mbt_ffi_str2ptr(payload432.field_name) mbt_ffi_store32( iter_base + 20, - payload430.field_name.length(), + payload432.field_name.length(), ) - mbt_ffi_store32(iter_base + 16, ptr431) + mbt_ffi_store32(iter_base + 16, ptr433) - match payload430.literal { + match payload432.literal { None => { mbt_ffi_store8(iter_base + 24, 0) () } - Some(payload433) => { + Some(payload435) => { mbt_ffi_store8(iter_base + 24, 1) - let ptr434 = mbt_ffi_str2ptr(payload433) + let ptr436 = mbt_ffi_str2ptr(payload435) mbt_ffi_store32( iter_base + 32, - payload433.length(), + payload435.length(), ) - mbt_ffi_store32(iter_base + 28, ptr434) - cleanup_list.push(ptr434) + mbt_ffi_store32(iter_base + 28, ptr436) + cleanup_list.push(ptr436) () } } - cleanup_list.push(ptr431) + cleanup_list.push(ptr433) () } - FieldAbsent(payload435) => { + FieldAbsent(payload437) => { mbt_ffi_store8(iter_base + 12, 5) - let ptr436 = mbt_ffi_str2ptr(payload435) - mbt_ffi_store32(iter_base + 20, payload435.length()) - mbt_ffi_store32(iter_base + 16, ptr436) - cleanup_list.push(ptr436) + let ptr438 = mbt_ffi_str2ptr(payload437) + mbt_ffi_store32(iter_base + 20, payload437.length()) + mbt_ffi_store32(iter_base + 16, ptr438) + cleanup_list.push(ptr438) () } @@ -6573,57 +6601,57 @@ fn invoke_task_return( () } - Some(payload438) => { + Some(payload440) => { mbt_ffi_store8(iter_base + 36, 1) - let ptr439 = mbt_ffi_str2ptr(payload438) - mbt_ffi_store32(iter_base + 44, payload438.length()) - mbt_ffi_store32(iter_base + 40, ptr439) - cleanup_list.push(ptr439) + let ptr441 = mbt_ffi_str2ptr(payload440) + mbt_ffi_store32(iter_base + 44, payload440.length()) + mbt_ffi_store32(iter_base + 40, ptr441) + cleanup_list.push(ptr441) () } } - let address441 = mbt_ffi_malloc( + let address443 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index442 = 0 - index442 < iter_elem.metadata.aliases.length() - index442 = index442 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index442] - let iter_base = address441 + index442 * 8 + for index444 = 0 + index444 < iter_elem.metadata.aliases.length() + index444 = index444 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index444] + let iter_base = address443 + index444 * 8 - let ptr440 = mbt_ffi_str2ptr(iter_elem) + let ptr442 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr440) - cleanup_list.push(ptr440) + mbt_ffi_store32(iter_base + 0, ptr442) + cleanup_list.push(ptr442) } mbt_ffi_store32( iter_base + 52, iter_elem.metadata.aliases.length(), ) - mbt_ffi_store32(iter_base + 48, address441) + mbt_ffi_store32(iter_base + 48, address443) - let address444 = mbt_ffi_malloc( + let address446 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index445 = 0 - index445 < iter_elem.metadata.examples.length() - index445 = index445 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index445] - let iter_base = address444 + index445 * 8 + for index447 = 0 + index447 < iter_elem.metadata.examples.length() + index447 = index447 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index447] + let iter_base = address446 + index447 * 8 - let ptr443 = mbt_ffi_str2ptr(iter_elem) + let ptr445 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr443) - cleanup_list.push(ptr443) + mbt_ffi_store32(iter_base + 0, ptr445) + cleanup_list.push(ptr445) } mbt_ffi_store32( iter_base + 60, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 56, address444) + mbt_ffi_store32(iter_base + 56, address446) match iter_elem.metadata.deprecated { None => { @@ -6631,13 +6659,13 @@ fn invoke_task_return( () } - Some(payload447) => { + Some(payload449) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr448 = mbt_ffi_str2ptr(payload447) - mbt_ffi_store32(iter_base + 72, payload447.length()) - mbt_ffi_store32(iter_base + 68, ptr448) - cleanup_list.push(ptr448) + let ptr450 = mbt_ffi_str2ptr(payload449) + mbt_ffi_store32(iter_base + 72, payload449.length()) + mbt_ffi_store32(iter_base + 68, ptr450) + cleanup_list.push(ptr450) () } @@ -6649,10 +6677,10 @@ fn invoke_task_return( () } - Some(payload450) => { + Some(payload452) => { mbt_ffi_store8(iter_base + 76, 1) - match payload450 { + match payload452 { Multimodal => { mbt_ffi_store8(iter_base + 80, 0) @@ -6668,16 +6696,16 @@ fn invoke_task_return( () } - Other(payload454) => { + Other(payload456) => { mbt_ffi_store8(iter_base + 80, 3) - let ptr455 = mbt_ffi_str2ptr(payload454) + let ptr457 = mbt_ffi_str2ptr(payload456) mbt_ffi_store32( iter_base + 88, - payload454.length(), + payload456.length(), ) - mbt_ffi_store32(iter_base + 84, ptr455) - cleanup_list.push(ptr455) + mbt_ffi_store32(iter_base + 84, ptr457) + cleanup_list.push(ptr457) () } @@ -6686,36 +6714,36 @@ fn invoke_task_return( () } } - cleanup_list.push(ptr421) - cleanup_list.push(address441) - cleanup_list.push(address444) + cleanup_list.push(ptr423) + cleanup_list.push(address443) + cleanup_list.push(address446) } mbt_ffi_store32( iter_base + 12, - payload420.branches.length(), + payload422.branches.length(), ) - mbt_ffi_store32(iter_base + 8, address456) - cleanup_list.push(address456) + mbt_ffi_store32(iter_base + 8, address458) + cleanup_list.push(address458) () } - SecretType(payload458) => { + SecretType(payload460) => { mbt_ffi_store8(iter_base + 0, 32) - mbt_ffi_store32(iter_base + 8, payload458.inner) + mbt_ffi_store32(iter_base + 8, payload460.inner) - match payload458.category { + match payload460.category { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload460) => { + Some(payload462) => { mbt_ffi_store8(iter_base + 12, 1) - let ptr461 = mbt_ffi_str2ptr(payload460) - mbt_ffi_store32(iter_base + 20, payload460.length()) - mbt_ffi_store32(iter_base + 16, ptr461) - cleanup_list.push(ptr461) + let ptr463 = mbt_ffi_str2ptr(payload462) + mbt_ffi_store32(iter_base + 20, payload462.length()) + mbt_ffi_store32(iter_base + 16, ptr463) + cleanup_list.push(ptr463) () } @@ -6723,22 +6751,22 @@ fn invoke_task_return( () } - QuotaTokenType(payload462) => { + QuotaTokenType(payload464) => { mbt_ffi_store8(iter_base + 0, 33) - match payload462.resource_name { + match payload464.resource_name { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload464) => { + Some(payload466) => { mbt_ffi_store8(iter_base + 8, 1) - let ptr465 = mbt_ffi_str2ptr(payload464) - mbt_ffi_store32(iter_base + 16, payload464.length()) - mbt_ffi_store32(iter_base + 12, ptr465) - cleanup_list.push(ptr465) + let ptr467 = mbt_ffi_str2ptr(payload466) + mbt_ffi_store32(iter_base + 16, payload466.length()) + mbt_ffi_store32(iter_base + 12, ptr467) + cleanup_list.push(ptr467) () } @@ -6746,18 +6774,18 @@ fn invoke_task_return( () } - FutureType(payload466) => { + FutureType(payload468) => { mbt_ffi_store8(iter_base + 0, 34) - match payload466 { + match payload468 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload468) => { + Some(payload470) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload468) + mbt_ffi_store32(iter_base + 12, payload470) () } @@ -6765,18 +6793,18 @@ fn invoke_task_return( () } - StreamType(payload469) => { + StreamType(payload471) => { mbt_ffi_store8(iter_base + 0, 35) - match payload469 { + match payload471 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload471) => { + Some(payload473) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload471) + mbt_ffi_store32(iter_base + 12, payload473) () } @@ -6792,57 +6820,57 @@ fn invoke_task_return( () } - Some(payload473) => { + Some(payload475) => { mbt_ffi_store8(iter_base + 88, 1) - let ptr474 = mbt_ffi_str2ptr(payload473) - mbt_ffi_store32(iter_base + 96, payload473.length()) - mbt_ffi_store32(iter_base + 92, ptr474) - cleanup_list.push(ptr474) + let ptr476 = mbt_ffi_str2ptr(payload475) + mbt_ffi_store32(iter_base + 96, payload475.length()) + mbt_ffi_store32(iter_base + 92, ptr476) + cleanup_list.push(ptr476) () } } - let address476 = mbt_ffi_malloc( + let address478 = mbt_ffi_malloc( iter_elem.metadata.aliases.length() * 8, ) - for index477 = 0 - index477 < iter_elem.metadata.aliases.length() - index477 = index477 + 1 { - let iter_elem : String = iter_elem.metadata.aliases[index477] - let iter_base = address476 + index477 * 8 + for index479 = 0 + index479 < iter_elem.metadata.aliases.length() + index479 = index479 + 1 { + let iter_elem : String = iter_elem.metadata.aliases[index479] + let iter_base = address478 + index479 * 8 - let ptr475 = mbt_ffi_str2ptr(iter_elem) + let ptr477 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr475) - cleanup_list.push(ptr475) + mbt_ffi_store32(iter_base + 0, ptr477) + cleanup_list.push(ptr477) } mbt_ffi_store32( iter_base + 104, iter_elem.metadata.aliases.length(), ) - mbt_ffi_store32(iter_base + 100, address476) + mbt_ffi_store32(iter_base + 100, address478) - let address479 = mbt_ffi_malloc( + let address481 = mbt_ffi_malloc( iter_elem.metadata.examples.length() * 8, ) - for index480 = 0 - index480 < iter_elem.metadata.examples.length() - index480 = index480 + 1 { - let iter_elem : String = iter_elem.metadata.examples[index480] - let iter_base = address479 + index480 * 8 + for index482 = 0 + index482 < iter_elem.metadata.examples.length() + index482 = index482 + 1 { + let iter_elem : String = iter_elem.metadata.examples[index482] + let iter_base = address481 + index482 * 8 - let ptr478 = mbt_ffi_str2ptr(iter_elem) + let ptr480 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr478) - cleanup_list.push(ptr478) + mbt_ffi_store32(iter_base + 0, ptr480) + cleanup_list.push(ptr480) } mbt_ffi_store32( iter_base + 112, iter_elem.metadata.examples.length(), ) - mbt_ffi_store32(iter_base + 108, address479) + mbt_ffi_store32(iter_base + 108, address481) match iter_elem.metadata.deprecated { None => { @@ -6850,13 +6878,13 @@ fn invoke_task_return( () } - Some(payload482) => { + Some(payload484) => { mbt_ffi_store8(iter_base + 116, 1) - let ptr483 = mbt_ffi_str2ptr(payload482) - mbt_ffi_store32(iter_base + 124, payload482.length()) - mbt_ffi_store32(iter_base + 120, ptr483) - cleanup_list.push(ptr483) + let ptr485 = mbt_ffi_str2ptr(payload484) + mbt_ffi_store32(iter_base + 124, payload484.length()) + mbt_ffi_store32(iter_base + 120, ptr485) + cleanup_list.push(ptr485) () } @@ -6868,10 +6896,10 @@ fn invoke_task_return( () } - Some(payload485) => { + Some(payload487) => { mbt_ffi_store8(iter_base + 128, 1) - match payload485 { + match payload487 { Multimodal => { mbt_ffi_store8(iter_base + 132, 0) @@ -6887,13 +6915,13 @@ fn invoke_task_return( () } - Other(payload489) => { + Other(payload491) => { mbt_ffi_store8(iter_base + 132, 3) - let ptr490 = mbt_ffi_str2ptr(payload489) - mbt_ffi_store32(iter_base + 140, payload489.length()) - mbt_ffi_store32(iter_base + 136, ptr490) - cleanup_list.push(ptr490) + let ptr492 = mbt_ffi_str2ptr(payload491) + mbt_ffi_store32(iter_base + 140, payload491.length()) + mbt_ffi_store32(iter_base + 136, ptr492) + cleanup_list.push(ptr492) () } @@ -6902,22 +6930,22 @@ fn invoke_task_return( () } } - cleanup_list.push(address476) - cleanup_list.push(address479) + cleanup_list.push(address478) + cleanup_list.push(address481) } - let address497 = mbt_ffi_malloc( - payload129.graph.defs.length() * 24, + let address499 = mbt_ffi_malloc( + payload131.graph.defs.length() * 24, ) - for index498 = 0 - index498 < payload129.graph.defs.length() - index498 = index498 + 1 { - let iter_elem : @types.SchemaTypeDef = payload129.graph.defs[index498] - let iter_base = address497 + index498 * 24 + for index500 = 0 + index500 < payload131.graph.defs.length() + index500 = index500 + 1 { + let iter_elem : @types.SchemaTypeDef = payload131.graph.defs[index500] + let iter_base = address499 + index500 * 24 - let ptr493 = mbt_ffi_str2ptr(iter_elem.id) + let ptr495 = mbt_ffi_str2ptr(iter_elem.id) mbt_ffi_store32(iter_base + 4, iter_elem.id.length()) - mbt_ffi_store32(iter_base + 0, ptr493) + mbt_ffi_store32(iter_base + 0, ptr495) match iter_elem.name { None => { @@ -6925,36 +6953,36 @@ fn invoke_task_return( () } - Some(payload495) => { + Some(payload497) => { mbt_ffi_store8(iter_base + 8, 1) - let ptr496 = mbt_ffi_str2ptr(payload495) - mbt_ffi_store32(iter_base + 16, payload495.length()) - mbt_ffi_store32(iter_base + 12, ptr496) - cleanup_list.push(ptr496) + let ptr498 = mbt_ffi_str2ptr(payload497) + mbt_ffi_store32(iter_base + 16, payload497.length()) + mbt_ffi_store32(iter_base + 12, ptr498) + cleanup_list.push(ptr498) () } } mbt_ffi_store32(iter_base + 20, iter_elem.body) - cleanup_list.push(ptr493) + cleanup_list.push(ptr495) } - let address569 = mbt_ffi_malloc( - payload129.value.value_nodes.length() * 32, + let address573 = mbt_ffi_malloc( + payload131.value.value_nodes.length() * 32, ) - for index570 = 0 - index570 < payload129.value.value_nodes.length() - index570 = index570 + 1 { - let iter_elem : @types.SchemaValueNode = payload129.value.value_nodes[index570] - let iter_base = address569 + index570 * 32 + for index574 = 0 + index574 < payload131.value.value_nodes.length() + index574 = index574 + 1 { + let iter_elem : @types.SchemaValueNode = payload131.value.value_nodes[index574] + let iter_base = address573 + index574 * 32 match iter_elem { - BoolValue(payload499) => { + BoolValue(payload501) => { mbt_ffi_store8(iter_base + 0, 0) mbt_ffi_store8( iter_base + 8, - if payload499 { + if payload501 { 1 } else { 0 @@ -6963,124 +6991,124 @@ fn invoke_task_return( () } - S8Value(payload500) => { + S8Value(payload502) => { mbt_ffi_store8(iter_base + 0, 1) - mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload500)) + mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload502)) () } - S16Value(payload501) => { + S16Value(payload503) => { mbt_ffi_store8(iter_base + 0, 2) - mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload501)) + mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload503)) () } - S32Value(payload502) => { + S32Value(payload504) => { mbt_ffi_store8(iter_base + 0, 3) - mbt_ffi_store32(iter_base + 8, payload502) + mbt_ffi_store32(iter_base + 8, payload504) () } - S64Value(payload503) => { + S64Value(payload505) => { mbt_ffi_store8(iter_base + 0, 4) - mbt_ffi_store64(iter_base + 8, payload503) + mbt_ffi_store64(iter_base + 8, payload505) () } - U8Value(payload504) => { + U8Value(payload506) => { mbt_ffi_store8(iter_base + 0, 5) - mbt_ffi_store8(iter_base + 8, payload504.to_int()) + mbt_ffi_store8(iter_base + 8, payload506.to_int()) () } - U16Value(payload505) => { + U16Value(payload507) => { mbt_ffi_store8(iter_base + 0, 6) mbt_ffi_store16( iter_base + 8, - payload505.reinterpret_as_int(), + payload507.reinterpret_as_int(), ) () } - U32Value(payload506) => { + U32Value(payload508) => { mbt_ffi_store8(iter_base + 0, 7) mbt_ffi_store32( iter_base + 8, - payload506.reinterpret_as_int(), + payload508.reinterpret_as_int(), ) () } - U64Value(payload507) => { + U64Value(payload509) => { mbt_ffi_store8(iter_base + 0, 8) mbt_ffi_store64( iter_base + 8, - payload507.reinterpret_as_int64(), + payload509.reinterpret_as_int64(), ) () } - F32Value(payload508) => { + F32Value(payload510) => { mbt_ffi_store8(iter_base + 0, 9) - mbt_ffi_storef32(iter_base + 8, payload508) + mbt_ffi_storef32(iter_base + 8, payload510) () } - F64Value(payload509) => { + F64Value(payload511) => { mbt_ffi_store8(iter_base + 0, 10) - mbt_ffi_storef64(iter_base + 8, payload509) + mbt_ffi_storef64(iter_base + 8, payload511) () } - CharValue(payload510) => { + CharValue(payload512) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload510.to_int()) + mbt_ffi_store32(iter_base + 8, payload512.to_int()) () } - StringValue(payload511) => { + StringValue(payload513) => { mbt_ffi_store8(iter_base + 0, 12) - let ptr512 = mbt_ffi_str2ptr(payload511) - mbt_ffi_store32(iter_base + 12, payload511.length()) - mbt_ffi_store32(iter_base + 8, ptr512) - cleanup_list.push(ptr512) + let ptr514 = mbt_ffi_str2ptr(payload513) + mbt_ffi_store32(iter_base + 12, payload513.length()) + mbt_ffi_store32(iter_base + 8, ptr514) + cleanup_list.push(ptr514) () } - RecordValue(payload513) => { + RecordValue(payload515) => { mbt_ffi_store8(iter_base + 0, 13) - let address514 = mbt_ffi_malloc(payload513.length() * 4) - for index515 = 0 - index515 < payload513.length() - index515 = index515 + 1 { - let iter_elem : Int = payload513[index515] - let iter_base = address514 + index515 * 4 + let address516 = mbt_ffi_malloc(payload515.length() * 4) + for index517 = 0 + index517 < payload515.length() + index517 = index517 + 1 { + let iter_elem : Int = payload515[index517] + let iter_base = address516 + index517 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload513.length()) - mbt_ffi_store32(iter_base + 8, address514) - cleanup_list.push(address514) + mbt_ffi_store32(iter_base + 12, payload515.length()) + mbt_ffi_store32(iter_base + 8, address516) + cleanup_list.push(address516) () } - VariantValue(payload516) => { + VariantValue(payload518) => { mbt_ffi_store8(iter_base + 0, 14) mbt_ffi_store32( iter_base + 8, - payload516.case.reinterpret_as_int(), + payload518.case.reinterpret_as_int(), ) - match payload516.payload { + match payload518.payload { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload518) => { + Some(payload520) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload518) + mbt_ffi_store32(iter_base + 16, payload520) () } @@ -7088,24 +7116,24 @@ fn invoke_task_return( () } - EnumValue(payload519) => { + EnumValue(payload521) => { mbt_ffi_store8(iter_base + 0, 15) mbt_ffi_store32( iter_base + 8, - payload519.reinterpret_as_int(), + payload521.reinterpret_as_int(), ) () } - FlagsValue(payload520) => { + FlagsValue(payload522) => { mbt_ffi_store8(iter_base + 0, 16) - let address521 = mbt_ffi_malloc(payload520.length() * 1) - for index522 = 0 - index522 < payload520.length() - index522 = index522 + 1 { - let iter_elem : Bool = payload520[index522] - let iter_base = address521 + index522 * 1 + let address523 = mbt_ffi_malloc(payload522.length() * 1) + for index524 = 0 + index524 < payload522.length() + index524 = index524 + 1 { + let iter_elem : Bool = payload522[index524] + let iter_base = address523 + index524 * 1 mbt_ffi_store8( iter_base + 0, if iter_elem { @@ -7115,93 +7143,93 @@ fn invoke_task_return( }, ) } - mbt_ffi_store32(iter_base + 12, payload520.length()) - mbt_ffi_store32(iter_base + 8, address521) - cleanup_list.push(address521) + mbt_ffi_store32(iter_base + 12, payload522.length()) + mbt_ffi_store32(iter_base + 8, address523) + cleanup_list.push(address523) () } - TupleValue(payload523) => { + TupleValue(payload525) => { mbt_ffi_store8(iter_base + 0, 17) - let address524 = mbt_ffi_malloc(payload523.length() * 4) - for index525 = 0 - index525 < payload523.length() - index525 = index525 + 1 { - let iter_elem : Int = payload523[index525] - let iter_base = address524 + index525 * 4 + let address526 = mbt_ffi_malloc(payload525.length() * 4) + for index527 = 0 + index527 < payload525.length() + index527 = index527 + 1 { + let iter_elem : Int = payload525[index527] + let iter_base = address526 + index527 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload523.length()) - mbt_ffi_store32(iter_base + 8, address524) - cleanup_list.push(address524) + mbt_ffi_store32(iter_base + 12, payload525.length()) + mbt_ffi_store32(iter_base + 8, address526) + cleanup_list.push(address526) () } - ListValue(payload526) => { + ListValue(payload528) => { mbt_ffi_store8(iter_base + 0, 18) - let address527 = mbt_ffi_malloc(payload526.length() * 4) - for index528 = 0 - index528 < payload526.length() - index528 = index528 + 1 { - let iter_elem : Int = payload526[index528] - let iter_base = address527 + index528 * 4 + let address529 = mbt_ffi_malloc(payload528.length() * 4) + for index530 = 0 + index530 < payload528.length() + index530 = index530 + 1 { + let iter_elem : Int = payload528[index530] + let iter_base = address529 + index530 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload526.length()) - mbt_ffi_store32(iter_base + 8, address527) - cleanup_list.push(address527) + mbt_ffi_store32(iter_base + 12, payload528.length()) + mbt_ffi_store32(iter_base + 8, address529) + cleanup_list.push(address529) () } - FixedListValue(payload529) => { + FixedListValue(payload531) => { mbt_ffi_store8(iter_base + 0, 19) - let address530 = mbt_ffi_malloc(payload529.length() * 4) - for index531 = 0 - index531 < payload529.length() - index531 = index531 + 1 { - let iter_elem : Int = payload529[index531] - let iter_base = address530 + index531 * 4 + let address532 = mbt_ffi_malloc(payload531.length() * 4) + for index533 = 0 + index533 < payload531.length() + index533 = index533 + 1 { + let iter_elem : Int = payload531[index533] + let iter_base = address532 + index533 * 4 mbt_ffi_store32(iter_base + 0, iter_elem) } - mbt_ffi_store32(iter_base + 12, payload529.length()) - mbt_ffi_store32(iter_base + 8, address530) - cleanup_list.push(address530) + mbt_ffi_store32(iter_base + 12, payload531.length()) + mbt_ffi_store32(iter_base + 8, address532) + cleanup_list.push(address532) () } - MapValue(payload532) => { + MapValue(payload534) => { mbt_ffi_store8(iter_base + 0, 20) - let address533 = mbt_ffi_malloc(payload532.length() * 8) - for index534 = 0 - index534 < payload532.length() - index534 = index534 + 1 { - let iter_elem : @types.MapEntry = payload532[index534] - let iter_base = address533 + index534 * 8 + let address535 = mbt_ffi_malloc(payload534.length() * 8) + for index536 = 0 + index536 < payload534.length() + index536 = index536 + 1 { + let iter_elem : @types.MapEntry = payload534[index536] + let iter_base = address535 + index536 * 8 mbt_ffi_store32(iter_base + 0, iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.value) } - mbt_ffi_store32(iter_base + 12, payload532.length()) - mbt_ffi_store32(iter_base + 8, address533) - cleanup_list.push(address533) + mbt_ffi_store32(iter_base + 12, payload534.length()) + mbt_ffi_store32(iter_base + 8, address535) + cleanup_list.push(address535) () } - OptionValue(payload535) => { + OptionValue(payload537) => { mbt_ffi_store8(iter_base + 0, 21) - match payload535 { + match payload537 { None => { mbt_ffi_store8(iter_base + 8, 0) () } - Some(payload537) => { + Some(payload539) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store32(iter_base + 12, payload537) + mbt_ffi_store32(iter_base + 12, payload539) () } @@ -7209,22 +7237,22 @@ fn invoke_task_return( () } - ResultValue(payload538) => { + ResultValue(payload540) => { mbt_ffi_store8(iter_base + 0, 22) - match payload538 { - OkValue(payload539) => { + match payload540 { + OkValue(payload541) => { mbt_ffi_store8(iter_base + 8, 0) - match payload539 { + match payload541 { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload541) => { + Some(payload543) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload541) + mbt_ffi_store32(iter_base + 16, payload543) () } @@ -7232,18 +7260,18 @@ fn invoke_task_return( () } - ErrValue(payload542) => { + ErrValue(payload544) => { mbt_ffi_store8(iter_base + 8, 1) - match payload542 { + match payload544 { None => { mbt_ffi_store8(iter_base + 12, 0) () } - Some(payload544) => { + Some(payload546) => { mbt_ffi_store8(iter_base + 12, 1) - mbt_ffi_store32(iter_base + 16, payload544) + mbt_ffi_store32(iter_base + 16, payload546) () } @@ -7255,168 +7283,176 @@ fn invoke_task_return( () } - TextValue(payload545) => { + TextValue(payload547) => { mbt_ffi_store8(iter_base + 0, 23) - let ptr546 = mbt_ffi_str2ptr(payload545.text) - mbt_ffi_store32(iter_base + 12, payload545.text.length()) - mbt_ffi_store32(iter_base + 8, ptr546) + let ptr548 = mbt_ffi_str2ptr(payload547.text) + mbt_ffi_store32(iter_base + 12, payload547.text.length()) + mbt_ffi_store32(iter_base + 8, ptr548) - match payload545.language { + match payload547.language { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload548) => { + Some(payload550) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr549 = mbt_ffi_str2ptr(payload548) - mbt_ffi_store32(iter_base + 24, payload548.length()) - mbt_ffi_store32(iter_base + 20, ptr549) - cleanup_list.push(ptr549) + let ptr551 = mbt_ffi_str2ptr(payload550) + mbt_ffi_store32(iter_base + 24, payload550.length()) + mbt_ffi_store32(iter_base + 20, ptr551) + cleanup_list.push(ptr551) () } } - cleanup_list.push(ptr546) + cleanup_list.push(ptr548) () } - BinaryValue(payload550) => { + BinaryValue(payload552) => { mbt_ffi_store8(iter_base + 0, 24) - let ptr551 = mbt_ffi_bytes2ptr(payload550.bytes) + let ptr553 = mbt_ffi_bytes2ptr(payload552.bytes) - mbt_ffi_store32(iter_base + 12, payload550.bytes.length()) - mbt_ffi_store32(iter_base + 8, ptr551) + mbt_ffi_store32(iter_base + 12, payload552.bytes.length()) + mbt_ffi_store32(iter_base + 8, ptr553) - match payload550.mime_type { + match payload552.mime_type { None => { mbt_ffi_store8(iter_base + 16, 0) () } - Some(payload553) => { + Some(payload555) => { mbt_ffi_store8(iter_base + 16, 1) - let ptr554 = mbt_ffi_str2ptr(payload553) - mbt_ffi_store32(iter_base + 24, payload553.length()) - mbt_ffi_store32(iter_base + 20, ptr554) - cleanup_list.push(ptr554) + let ptr556 = mbt_ffi_str2ptr(payload555) + mbt_ffi_store32(iter_base + 24, payload555.length()) + mbt_ffi_store32(iter_base + 20, ptr556) + cleanup_list.push(ptr556) () } } - cleanup_list.push(ptr551) + cleanup_list.push(ptr553) () } - PathValue(payload555) => { + PathValue(payload557) => { mbt_ffi_store8(iter_base + 0, 25) - let ptr556 = mbt_ffi_str2ptr(payload555) - mbt_ffi_store32(iter_base + 12, payload555.length()) - mbt_ffi_store32(iter_base + 8, ptr556) - cleanup_list.push(ptr556) + let ptr558 = mbt_ffi_str2ptr(payload557) + mbt_ffi_store32(iter_base + 12, payload557.length()) + mbt_ffi_store32(iter_base + 8, ptr558) + cleanup_list.push(ptr558) () } - UrlValue(payload557) => { + UrlValue(payload559) => { mbt_ffi_store8(iter_base + 0, 26) - let ptr558 = mbt_ffi_str2ptr(payload557) - mbt_ffi_store32(iter_base + 12, payload557.length()) - mbt_ffi_store32(iter_base + 8, ptr558) - cleanup_list.push(ptr558) + let ptr560 = mbt_ffi_str2ptr(payload559) + mbt_ffi_store32(iter_base + 12, payload559.length()) + mbt_ffi_store32(iter_base + 8, ptr560) + cleanup_list.push(ptr560) () } - DatetimeValue(payload559) => { + DatetimeValue(payload561) => { mbt_ffi_store8(iter_base + 0, 27) - mbt_ffi_store64(iter_base + 8, payload559.seconds) + mbt_ffi_store64(iter_base + 8, payload561.seconds) mbt_ffi_store32( iter_base + 16, - payload559.nanoseconds.reinterpret_as_int(), + payload561.nanoseconds.reinterpret_as_int(), ) () } - DurationValue(payload560) => { + DurationValue(payload562) => { mbt_ffi_store8(iter_base + 0, 28) - mbt_ffi_store64(iter_base + 8, payload560.nanoseconds) + mbt_ffi_store64(iter_base + 8, payload562.nanoseconds) () } - QuantityValueNode(payload561) => { + QuantityValueNode(payload563) => { mbt_ffi_store8(iter_base + 0, 29) - mbt_ffi_store64(iter_base + 8, payload561.mantissa) - mbt_ffi_store32(iter_base + 16, payload561.scale) + mbt_ffi_store64(iter_base + 8, payload563.mantissa) + mbt_ffi_store32(iter_base + 16, payload563.scale) - let ptr562 = mbt_ffi_str2ptr(payload561.unit) - mbt_ffi_store32(iter_base + 24, payload561.unit.length()) - mbt_ffi_store32(iter_base + 20, ptr562) - cleanup_list.push(ptr562) + let ptr564 = mbt_ffi_str2ptr(payload563.unit) + mbt_ffi_store32(iter_base + 24, payload563.unit.length()) + mbt_ffi_store32(iter_base + 20, ptr564) + cleanup_list.push(ptr564) () } - UnionValue(payload563) => { + UnionValue(payload565) => { mbt_ffi_store8(iter_base + 0, 30) - let ptr564 = mbt_ffi_str2ptr(payload563.tag) - mbt_ffi_store32(iter_base + 12, payload563.tag.length()) - mbt_ffi_store32(iter_base + 8, ptr564) - mbt_ffi_store32(iter_base + 16, payload563.body) - cleanup_list.push(ptr564) + let ptr566 = mbt_ffi_str2ptr(payload565.tag) + mbt_ffi_store32(iter_base + 12, payload565.tag.length()) + mbt_ffi_store32(iter_base + 8, ptr566) + mbt_ffi_store32(iter_base + 16, payload565.body) + cleanup_list.push(ptr566) () } - SecretValue(payload565) => { + SecretValue(payload567) => { mbt_ffi_store8(iter_base + 0, 31) - let @types.Secret(handle566) = payload565 - mbt_ffi_store32(iter_base + 8, handle566) + let @types.Secret(handle568) = payload567 + mbt_ffi_store32(iter_base + 8, handle568) () } - QuotaTokenHandle(payload567) => { + QuotaTokenHandle(payload569) => { mbt_ffi_store8(iter_base + 0, 32) - let @types.QuotaToken(handle568) = payload567 - mbt_ffi_store32(iter_base + 8, handle568) + let @types.QuotaToken(handle570) = payload569 + mbt_ffi_store32(iter_base + 8, handle570) + + () + } + StreamValue(payload571) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle572) = payload571 + mbt_ffi_store32(iter_base + 8, handle572) () } } } - cleanup_list.push(address491) - cleanup_list.push(address497) - cleanup_list.push(address569) + cleanup_list.push(address493) + cleanup_list.push(address499) + cleanup_list.push(address573) ( 4, - address491, - payload129.graph.type_nodes.length(), - address497, - payload129.graph.defs.length(), - payload129.graph.root, - address569, - payload129.value.value_nodes.length(), - payload129.value.root, + address493, + payload131.graph.type_nodes.length(), + address499, + payload131.graph.defs.length(), + payload131.graph.root, + address573, + payload131.value.value_nodes.length(), + payload131.value.root, ) } } ( - 1, lowered571, lowered572, lowered573, lowered574, lowered575, lowered576, - lowered577, lowered578, lowered579, + 1, lowered575, lowered576, lowered577, lowered578, lowered579, lowered580, + lowered581, lowered582, lowered583, ) } } wasmExportAsyncInvokeGolemAgentGuestTaskReturn( - lowered580, lowered581, lowered582, lowered583, lowered584, lowered585, lowered586, - lowered587, lowered588, lowered589, + lowered584, lowered585, lowered586, lowered587, lowered588, lowered589, lowered590, + lowered591, lowered592, lowered593, ) cleanup_list.each(mbt_ffi_free) @@ -7442,7 +7478,7 @@ pub fn wasmExportAsyncInvokeGolemAgentGuest( pub fn wasmExportGetDefinition() -> Int { let result : @common.AgentType = get_definition() let return_area = mbt_ffi_malloc(176) - __wit_bindgen_lower_t399(return_area + 0, result) + __wit_bindgen_lower_t402(return_area + 0, result) let ret = return_area return ret } @@ -8928,7 +8964,7 @@ pub fn wasmExportDiscoverAgentTypes() -> Int { for index = 0; index < payload.length(); index = index + 1 { let iter_elem : @common.AgentType = payload[index] let iter_base = address + index * 176 - __wit_bindgen_lower_t399(iter_base + 0, iter_elem) + __wit_bindgen_lower_t402(iter_base + 0, iter_elem) } mbt_ffi_store32(return_area + 8, payload.length()) mbt_ffi_store32(return_area + 4, address) @@ -8937,7 +8973,7 @@ pub fn wasmExportDiscoverAgentTypes() -> Int { } Err(payload0) => { mbt_ffi_store8(return_area + 0, 1) - __wit_bindgen_lower_t402(return_area + 4, payload0) + __wit_bindgen_lower_t405(return_area + 4, payload0) () } @@ -11014,6 +11050,7 @@ pub fn wasmExportDiscoverAgentTypesPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -11034,7 +11071,7 @@ fn __wit_bindgen_lower_t5(ptr : Int, value : @types.Datetime) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t16(ptr : Int, value : @types.SchemaTypeDef) -> Unit { +fn __wit_bindgen_lower_t17(ptr : Int, value : @types.SchemaTypeDef) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.id) mbt_ffi_store32(ptr + 4, value.id.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -11060,7 +11097,7 @@ fn __wit_bindgen_lower_t16(ptr : Int, value : @types.SchemaTypeDef) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t17(ptr : Int, value : @types.Role) -> Unit { +fn __wit_bindgen_lower_t18(ptr : Int, value : @types.Role) -> Unit { match value { Multimodal => { mbt_ffi_store8(ptr + 0, 0) @@ -11091,7 +11128,7 @@ fn __wit_bindgen_lower_t17(ptr : Int, value : @types.Role) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { +fn __wit_bindgen_lower_t21(ptr : Int, value : @types.MetadataEnvelope) -> Unit { match value.doc { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11158,7 +11195,7 @@ fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { } Some(payload10) => { mbt_ffi_store8(ptr + 40, 1) - __wit_bindgen_lower_t17(ptr + 44, payload10) + __wit_bindgen_lower_t18(ptr + 44, payload10) () } @@ -11167,17 +11204,17 @@ fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t21(ptr : Int, value : @types.NamedFieldType) -> Unit { +fn __wit_bindgen_lower_t22(ptr : Int, value : @types.NamedFieldType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) mbt_ffi_store32(ptr + 8, value.body) - __wit_bindgen_lower_t20(ptr + 12, value.metadata) + __wit_bindgen_lower_t21(ptr + 12, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t23(ptr : Int, value : @types.VariantCaseType) -> Unit { +fn __wit_bindgen_lower_t24(ptr : Int, value : @types.VariantCaseType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -11195,26 +11232,26 @@ fn __wit_bindgen_lower_t23(ptr : Int, value : @types.VariantCaseType) -> Unit { () } } - __wit_bindgen_lower_t20(ptr + 16, value.metadata) + __wit_bindgen_lower_t21(ptr + 16, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t24(ptr : Int, value : @types.FixedListSpec) -> Unit { +fn __wit_bindgen_lower_t25(ptr : Int, value : @types.FixedListSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.element) mbt_ffi_store32(ptr + 4, value.length.reinterpret_as_int()) } ///| #doc(hidden) -fn __wit_bindgen_lower_t25(ptr : Int, value : @types.MapSpec) -> Unit { +fn __wit_bindgen_lower_t26(ptr : Int, value : @types.MapSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.key) mbt_ffi_store32(ptr + 4, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t26(ptr : Int, value : @types.ResultSpec) -> Unit { +fn __wit_bindgen_lower_t27(ptr : Int, value : @types.ResultSpec) -> Unit { match value.ok { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11246,7 +11283,7 @@ fn __wit_bindgen_lower_t26(ptr : Int, value : @types.ResultSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t27(ptr : Int, value : @types.NumericBound) -> Unit { +fn __wit_bindgen_lower_t28(ptr : Int, value : @types.NumericBound) -> Unit { match value { Signed(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -11271,7 +11308,7 @@ fn __wit_bindgen_lower_t27(ptr : Int, value : @types.NumericBound) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t29( +fn __wit_bindgen_lower_t30( ptr : Int, value : @types.NumericRestrictions, ) -> Unit { @@ -11283,7 +11320,7 @@ fn __wit_bindgen_lower_t29( } Some(payload0) => { mbt_ffi_store8(ptr + 0, 1) - __wit_bindgen_lower_t27(ptr + 8, payload0) + __wit_bindgen_lower_t28(ptr + 8, payload0) () } @@ -11297,7 +11334,7 @@ fn __wit_bindgen_lower_t29( } Some(payload2) => { mbt_ffi_store8(ptr + 24, 1) - __wit_bindgen_lower_t27(ptr + 32, payload2) + __wit_bindgen_lower_t28(ptr + 32, payload2) () } @@ -11323,7 +11360,7 @@ fn __wit_bindgen_lower_t29( ///| #doc(hidden) -fn __wit_bindgen_lower_t32(ptr : Int, value : @types.TextRestrictions) -> Unit { +fn __wit_bindgen_lower_t33(ptr : Int, value : @types.TextRestrictions) -> Unit { match value.languages { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11397,7 +11434,7 @@ fn __wit_bindgen_lower_t32(ptr : Int, value : @types.TextRestrictions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t33( +fn __wit_bindgen_lower_t34( ptr : Int, value : @types.BinaryRestrictions, ) -> Unit { @@ -11457,7 +11494,7 @@ fn __wit_bindgen_lower_t33( ///| #doc(hidden) -fn __wit_bindgen_lower_t36(ptr : Int, value : @types.PathSpec) -> Unit { +fn __wit_bindgen_lower_t37(ptr : Int, value : @types.PathSpec) -> Unit { mbt_ffi_store8(ptr + 0, value.direction.ordinal()) mbt_ffi_store8(ptr + 1, value.kind.ordinal()) @@ -11514,7 +11551,7 @@ fn __wit_bindgen_lower_t36(ptr : Int, value : @types.PathSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t37(ptr : Int, value : @types.UrlRestrictions) -> Unit { +fn __wit_bindgen_lower_t38(ptr : Int, value : @types.UrlRestrictions) -> Unit { match value.allowed_schemes { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11568,7 +11605,7 @@ fn __wit_bindgen_lower_t37(ptr : Int, value : @types.UrlRestrictions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t38(ptr : Int, value : @types.QuantityValue) -> Unit { +fn __wit_bindgen_lower_t39(ptr : Int, value : @types.QuantityValue) -> Unit { mbt_ffi_store64(ptr + 0, value.mantissa) mbt_ffi_store32(ptr + 8, value.scale) @@ -11579,7 +11616,7 @@ fn __wit_bindgen_lower_t38(ptr : Int, value : @types.QuantityValue) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { +fn __wit_bindgen_lower_t41(ptr : Int, value : @types.QuantitySpec) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.base_unit) mbt_ffi_store32(ptr + 4, value.base_unit.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -11604,7 +11641,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { } Some(payload2) => { mbt_ffi_store8(ptr + 16, 1) - __wit_bindgen_lower_t38(ptr + 24, payload2) + __wit_bindgen_lower_t39(ptr + 24, payload2) () } @@ -11618,7 +11655,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 48, 1) - __wit_bindgen_lower_t38(ptr + 56, payload4) + __wit_bindgen_lower_t39(ptr + 56, payload4) () } @@ -11627,7 +11664,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t41( +fn __wit_bindgen_lower_t42( ptr : Int, value : @types.FieldDiscriminator, ) -> Unit { @@ -11655,7 +11692,7 @@ fn __wit_bindgen_lower_t41( ///| #doc(hidden) -fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit { +fn __wit_bindgen_lower_t43(ptr : Int, value : @types.DiscriminatorRule) -> Unit { match value { Prefix(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -11695,7 +11732,7 @@ fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit } FieldEquals(payload7) => { mbt_ffi_store8(ptr + 0, 4) - __wit_bindgen_lower_t41(ptr + 4, payload7) + __wit_bindgen_lower_t42(ptr + 4, payload7) () } @@ -11713,23 +11750,23 @@ fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t43(ptr : Int, value : @types.UnionBranch) -> Unit { +fn __wit_bindgen_lower_t44(ptr : Int, value : @types.UnionBranch) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.tag) mbt_ffi_store32(ptr + 4, value.tag.length()) mbt_ffi_store32(ptr + 0, ptr0) mbt_ffi_store32(ptr + 8, value.body) - __wit_bindgen_lower_t42(ptr + 12, value.discriminator) - __wit_bindgen_lower_t20(ptr + 36, value.metadata) + __wit_bindgen_lower_t43(ptr + 12, value.discriminator) + __wit_bindgen_lower_t21(ptr + 36, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t45(ptr : Int, value : @types.UnionSpec) -> Unit { +fn __wit_bindgen_lower_t46(ptr : Int, value : @types.UnionSpec) -> Unit { let address = mbt_ffi_malloc(value.branches.length() * 92) for index = 0; index < value.branches.length(); index = index + 1 { let iter_elem : @types.UnionBranch = value.branches[index] let iter_base = address + index * 92 - __wit_bindgen_lower_t43(iter_base + 0, iter_elem) + __wit_bindgen_lower_t44(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.branches.length()) mbt_ffi_store32(ptr + 0, address) @@ -11737,7 +11774,7 @@ fn __wit_bindgen_lower_t45(ptr : Int, value : @types.UnionSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t46(ptr : Int, value : @types.SecretSpec) -> Unit { +fn __wit_bindgen_lower_t47(ptr : Int, value : @types.SecretSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.inner) match value.category { @@ -11760,7 +11797,7 @@ fn __wit_bindgen_lower_t46(ptr : Int, value : @types.SecretSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t47(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { +fn __wit_bindgen_lower_t48(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { match value.resource_name { None => { mbt_ffi_store8(ptr + 0, 0) @@ -11781,7 +11818,7 @@ fn __wit_bindgen_lower_t47(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { +fn __wit_bindgen_lower_t53(ptr : Int, value : @types.SchemaTypeBody) -> Unit { match value { RefType(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -11805,7 +11842,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload3) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload3) + __wit_bindgen_lower_t30(ptr + 16, payload3) () } @@ -11824,7 +11861,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload6) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload6) + __wit_bindgen_lower_t30(ptr + 16, payload6) () } @@ -11843,7 +11880,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload9) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload9) + __wit_bindgen_lower_t30(ptr + 16, payload9) () } @@ -11862,7 +11899,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload12) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload12) + __wit_bindgen_lower_t30(ptr + 16, payload12) () } @@ -11881,7 +11918,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload15) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload15) + __wit_bindgen_lower_t30(ptr + 16, payload15) () } @@ -11900,7 +11937,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload18) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload18) + __wit_bindgen_lower_t30(ptr + 16, payload18) () } @@ -11919,7 +11956,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload21) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload21) + __wit_bindgen_lower_t30(ptr + 16, payload21) () } @@ -11938,7 +11975,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload24) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload24) + __wit_bindgen_lower_t30(ptr + 16, payload24) () } @@ -11957,7 +11994,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload27) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload27) + __wit_bindgen_lower_t30(ptr + 16, payload27) () } @@ -11976,7 +12013,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload30) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload30) + __wit_bindgen_lower_t30(ptr + 16, payload30) () } @@ -12001,7 +12038,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { for index = 0; index < payload33.length(); index = index + 1 { let iter_elem : @types.NamedFieldType = payload33[index] let iter_base = address + index * 68 - __wit_bindgen_lower_t21(iter_base + 0, iter_elem) + __wit_bindgen_lower_t22(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload33.length()) mbt_ffi_store32(ptr + 8, address) @@ -12015,7 +12052,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { for index36 = 0; index36 < payload34.length(); index36 = index36 + 1 { let iter_elem : @types.VariantCaseType = payload34[index36] let iter_base = address35 + index36 * 72 - __wit_bindgen_lower_t23(iter_base + 0, iter_elem) + __wit_bindgen_lower_t24(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload34.length()) mbt_ffi_store32(ptr + 8, address35) @@ -12078,13 +12115,13 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } FixedListType(payload49) => { mbt_ffi_store8(ptr + 0, 20) - __wit_bindgen_lower_t24(ptr + 8, payload49) + __wit_bindgen_lower_t25(ptr + 8, payload49) () } MapType(payload50) => { mbt_ffi_store8(ptr + 0, 21) - __wit_bindgen_lower_t25(ptr + 8, payload50) + __wit_bindgen_lower_t26(ptr + 8, payload50) () } @@ -12096,31 +12133,31 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } ResultType(payload52) => { mbt_ffi_store8(ptr + 0, 23) - __wit_bindgen_lower_t26(ptr + 8, payload52) + __wit_bindgen_lower_t27(ptr + 8, payload52) () } TextType(payload53) => { mbt_ffi_store8(ptr + 0, 24) - __wit_bindgen_lower_t32(ptr + 8, payload53) + __wit_bindgen_lower_t33(ptr + 8, payload53) () } BinaryType(payload54) => { mbt_ffi_store8(ptr + 0, 25) - __wit_bindgen_lower_t33(ptr + 8, payload54) + __wit_bindgen_lower_t34(ptr + 8, payload54) () } PathType(payload55) => { mbt_ffi_store8(ptr + 0, 26) - __wit_bindgen_lower_t36(ptr + 8, payload55) + __wit_bindgen_lower_t37(ptr + 8, payload55) () } UrlType(payload56) => { mbt_ffi_store8(ptr + 0, 27) - __wit_bindgen_lower_t37(ptr + 8, payload56) + __wit_bindgen_lower_t38(ptr + 8, payload56) () } @@ -12136,25 +12173,25 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } QuantityType(payload59) => { mbt_ffi_store8(ptr + 0, 30) - __wit_bindgen_lower_t40(ptr + 8, payload59) + __wit_bindgen_lower_t41(ptr + 8, payload59) () } UnionType(payload60) => { mbt_ffi_store8(ptr + 0, 31) - __wit_bindgen_lower_t45(ptr + 8, payload60) + __wit_bindgen_lower_t46(ptr + 8, payload60) () } SecretType(payload61) => { mbt_ffi_store8(ptr + 0, 32) - __wit_bindgen_lower_t46(ptr + 8, payload61) + __wit_bindgen_lower_t47(ptr + 8, payload61) () } QuotaTokenType(payload62) => { mbt_ffi_store8(ptr + 0, 33) - __wit_bindgen_lower_t47(ptr + 8, payload62) + __wit_bindgen_lower_t48(ptr + 8, payload62) () } @@ -12201,19 +12238,19 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t53(ptr : Int, value : @types.SchemaTypeNode) -> Unit { - __wit_bindgen_lower_t52(ptr + 0, value.body) - __wit_bindgen_lower_t20(ptr + 88, value.metadata) +fn __wit_bindgen_lower_t54(ptr : Int, value : @types.SchemaTypeNode) -> Unit { + __wit_bindgen_lower_t53(ptr + 0, value.body) + __wit_bindgen_lower_t21(ptr + 88, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { +fn __wit_bindgen_lower_t57(ptr : Int, value : @types.SchemaGraph) -> Unit { let address = mbt_ffi_malloc(value.type_nodes.length() * 144) for index = 0; index < value.type_nodes.length(); index = index + 1 { let iter_elem : @types.SchemaTypeNode = value.type_nodes[index] let iter_base = address + index * 144 - __wit_bindgen_lower_t53(iter_base + 0, iter_elem) + __wit_bindgen_lower_t54(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.type_nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -12222,7 +12259,7 @@ fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { for index1 = 0; index1 < value.defs.length(); index1 = index1 + 1 { let iter_elem : @types.SchemaTypeDef = value.defs[index1] let iter_base = address0 + index1 * 24 - __wit_bindgen_lower_t16(iter_base + 0, iter_elem) + __wit_bindgen_lower_t17(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, value.defs.length()) mbt_ffi_store32(ptr + 8, address0) @@ -12231,7 +12268,7 @@ fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t58( +fn __wit_bindgen_lower_t59( ptr : Int, value : @types.VariantValuePayload, ) -> Unit { @@ -12254,14 +12291,14 @@ fn __wit_bindgen_lower_t58( ///| #doc(hidden) -fn __wit_bindgen_lower_t59(ptr : Int, value : @types.MapEntry) -> Unit { +fn __wit_bindgen_lower_t60(ptr : Int, value : @types.MapEntry) -> Unit { mbt_ffi_store32(ptr + 0, value.key) mbt_ffi_store32(ptr + 4, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t60( +fn __wit_bindgen_lower_t61( ptr : Int, value : @types.ResultValuePayload, ) -> Unit { @@ -12309,7 +12346,7 @@ fn __wit_bindgen_lower_t60( ///| #doc(hidden) -fn __wit_bindgen_lower_t61(ptr : Int, value : @types.TextValuePayload) -> Unit { +fn __wit_bindgen_lower_t62(ptr : Int, value : @types.TextValuePayload) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.text) mbt_ffi_store32(ptr + 4, value.text.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12334,7 +12371,7 @@ fn __wit_bindgen_lower_t61(ptr : Int, value : @types.TextValuePayload) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t63( +fn __wit_bindgen_lower_t64( ptr : Int, value : @types.BinaryValuePayload, ) -> Unit { @@ -12363,7 +12400,7 @@ fn __wit_bindgen_lower_t63( ///| #doc(hidden) -fn __wit_bindgen_lower_t64( +fn __wit_bindgen_lower_t65( ptr : Int, value : @types.DurationValuePayload, ) -> Unit { @@ -12372,7 +12409,7 @@ fn __wit_bindgen_lower_t64( ///| #doc(hidden) -fn __wit_bindgen_lower_t65(ptr : Int, value : @types.UnionValuePayload) -> Unit { +fn __wit_bindgen_lower_t66(ptr : Int, value : @types.UnionValuePayload) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.tag) mbt_ffi_store32(ptr + 4, value.tag.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12381,7 +12418,7 @@ fn __wit_bindgen_lower_t65(ptr : Int, value : @types.UnionValuePayload) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { +fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueNode) -> Unit { match value { BoolValue(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -12480,7 +12517,7 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } VariantValue(payload14) => { mbt_ffi_store8(ptr + 0, 14) - __wit_bindgen_lower_t58(ptr + 8, payload14) + __wit_bindgen_lower_t59(ptr + 8, payload14) () } @@ -12553,7 +12590,7 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { for index30 = 0; index30 < payload28.length(); index30 = index30 + 1 { let iter_elem : @types.MapEntry = payload28[index30] let iter_base = address29 + index30 * 8 - __wit_bindgen_lower_t59(iter_base + 0, iter_elem) + __wit_bindgen_lower_t60(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload28.length()) mbt_ffi_store32(ptr + 8, address29) @@ -12581,19 +12618,19 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } ResultValue(payload34) => { mbt_ffi_store8(ptr + 0, 22) - __wit_bindgen_lower_t60(ptr + 8, payload34) + __wit_bindgen_lower_t61(ptr + 8, payload34) () } TextValue(payload35) => { mbt_ffi_store8(ptr + 0, 23) - __wit_bindgen_lower_t61(ptr + 8, payload35) + __wit_bindgen_lower_t62(ptr + 8, payload35) () } BinaryValue(payload36) => { mbt_ffi_store8(ptr + 0, 24) - __wit_bindgen_lower_t63(ptr + 8, payload36) + __wit_bindgen_lower_t64(ptr + 8, payload36) () } @@ -12623,19 +12660,19 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } DurationValue(payload42) => { mbt_ffi_store8(ptr + 0, 28) - __wit_bindgen_lower_t64(ptr + 8, payload42) + __wit_bindgen_lower_t65(ptr + 8, payload42) () } QuantityValueNode(payload43) => { mbt_ffi_store8(ptr + 0, 29) - __wit_bindgen_lower_t38(ptr + 8, payload43) + __wit_bindgen_lower_t39(ptr + 8, payload43) () } UnionValue(payload44) => { mbt_ffi_store8(ptr + 0, 30) - __wit_bindgen_lower_t65(ptr + 8, payload44) + __wit_bindgen_lower_t66(ptr + 8, payload44) () } @@ -12653,6 +12690,14 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { let @types.QuotaToken(handle47) = payload46 mbt_ffi_store32(ptr + 8, handle47) + () + } + StreamValue(payload48) => { + mbt_ffi_store8(ptr + 0, 33) + + let @types.SchemaValueStream(handle49) = payload48 + mbt_ffi_store32(ptr + 8, handle49) + () } } @@ -12660,12 +12705,12 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueTree) -> Unit { +fn __wit_bindgen_lower_t75(ptr : Int, value : @types.SchemaValueTree) -> Unit { let address = mbt_ffi_malloc(value.value_nodes.length() * 32) for index = 0; index < value.value_nodes.length(); index = index + 1 { let iter_elem : @types.SchemaValueNode = value.value_nodes[index] let iter_base = address + index * 32 - __wit_bindgen_lower_t71(iter_base + 0, iter_elem) + __wit_bindgen_lower_t73(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.value_nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -12674,14 +12719,14 @@ fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueTree) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t74(ptr : Int, value : @types.TypedSchemaValue) -> Unit { - __wit_bindgen_lower_t56(ptr + 0, value.graph) - __wit_bindgen_lower_t73(ptr + 20, value.value) +fn __wit_bindgen_lower_t76(ptr : Int, value : @types.TypedSchemaValue) -> Unit { + __wit_bindgen_lower_t57(ptr + 0, value.graph) + __wit_bindgen_lower_t75(ptr + 20, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t358(ptr : Int, value : @common.FieldSource) -> Unit { +fn __wit_bindgen_lower_t361(ptr : Int, value : @common.FieldSource) -> Unit { match value { UserSupplied => { mbt_ffi_store8(ptr + 0, 0) @@ -12699,18 +12744,18 @@ fn __wit_bindgen_lower_t358(ptr : Int, value : @common.FieldSource) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t359(ptr : Int, value : @common.NamedField) -> Unit { +fn __wit_bindgen_lower_t362(ptr : Int, value : @common.NamedField) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t358(ptr + 8, value.source) + __wit_bindgen_lower_t361(ptr + 8, value.source) mbt_ffi_store32(ptr + 12, value.schema) - __wit_bindgen_lower_t20(ptr + 16, value.metadata) + __wit_bindgen_lower_t21(ptr + 16, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t361(ptr : Int, value : @common.InputSchema) -> Unit { +fn __wit_bindgen_lower_t364(ptr : Int, value : @common.InputSchema) -> Unit { match value { Parameters(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -12719,7 +12764,7 @@ fn __wit_bindgen_lower_t361(ptr : Int, value : @common.InputSchema) -> Unit { for index = 0; index < payload.length(); index = index + 1 { let iter_elem : @common.NamedField = payload[index] let iter_base = address + index * 72 - __wit_bindgen_lower_t359(iter_base + 0, iter_elem) + __wit_bindgen_lower_t362(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload.length()) mbt_ffi_store32(ptr + 4, address) @@ -12731,7 +12776,7 @@ fn __wit_bindgen_lower_t361(ptr : Int, value : @common.InputSchema) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t362(ptr : Int, value : @common.OutputSchema) -> Unit { +fn __wit_bindgen_lower_t365(ptr : Int, value : @common.OutputSchema) -> Unit { match value { Unit => { mbt_ffi_store8(ptr + 0, 0) @@ -12749,7 +12794,7 @@ fn __wit_bindgen_lower_t362(ptr : Int, value : @common.OutputSchema) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t363(ptr : Int, value : @common.CachePolicy) -> Unit { +fn __wit_bindgen_lower_t366(ptr : Int, value : @common.CachePolicy) -> Unit { match value { NoCache => { mbt_ffi_store8(ptr + 0, 0) @@ -12772,14 +12817,14 @@ fn __wit_bindgen_lower_t363(ptr : Int, value : @common.CachePolicy) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t364(ptr : Int, value : @common.ReadOnlyConfig) -> Unit { - __wit_bindgen_lower_t363(ptr + 0, value.cache_policy) +fn __wit_bindgen_lower_t367(ptr : Int, value : @common.ReadOnlyConfig) -> Unit { + __wit_bindgen_lower_t366(ptr + 0, value.cache_policy) mbt_ffi_store8(ptr + 16, if value.uses_principal { 1 } else { 0 }) } ///| #doc(hidden) -fn __wit_bindgen_lower_t366(ptr : Int, value : @common.CorsOptions) -> Unit { +fn __wit_bindgen_lower_t369(ptr : Int, value : @common.CorsOptions) -> Unit { let address = mbt_ffi_malloc(value.allowed_patterns.length() * 8) for index = 0; index < value.allowed_patterns.length(); index = index + 1 { let iter_elem : String = value.allowed_patterns[index] @@ -12795,7 +12840,7 @@ fn __wit_bindgen_lower_t366(ptr : Int, value : @common.CorsOptions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t367(ptr : Int, value : @common.HttpMethod) -> Unit { +fn __wit_bindgen_lower_t370(ptr : Int, value : @common.HttpMethod) -> Unit { match value { Get => { mbt_ffi_store8(ptr + 0, 0) @@ -12856,7 +12901,7 @@ fn __wit_bindgen_lower_t367(ptr : Int, value : @common.HttpMethod) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t369(ptr : Int, value : @common.PathVariable) -> Unit { +fn __wit_bindgen_lower_t372(ptr : Int, value : @common.PathVariable) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.variable_name) mbt_ffi_store32(ptr + 4, value.variable_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12864,7 +12909,7 @@ fn __wit_bindgen_lower_t369(ptr : Int, value : @common.PathVariable) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t370(ptr : Int, value : @common.PathSegment) -> Unit { +fn __wit_bindgen_lower_t373(ptr : Int, value : @common.PathSegment) -> Unit { match value { Literal(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -12883,13 +12928,13 @@ fn __wit_bindgen_lower_t370(ptr : Int, value : @common.PathSegment) -> Unit { } PathVariable(payload2) => { mbt_ffi_store8(ptr + 0, 2) - __wit_bindgen_lower_t369(ptr + 4, payload2) + __wit_bindgen_lower_t372(ptr + 4, payload2) () } RemainingPathVariable(payload3) => { mbt_ffi_store8(ptr + 0, 3) - __wit_bindgen_lower_t369(ptr + 4, payload3) + __wit_bindgen_lower_t372(ptr + 4, payload3) () } @@ -12898,7 +12943,7 @@ fn __wit_bindgen_lower_t370(ptr : Int, value : @common.PathSegment) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t371(ptr : Int, value : @common.HeaderVariable) -> Unit { +fn __wit_bindgen_lower_t374(ptr : Int, value : @common.HeaderVariable) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.header_name) mbt_ffi_store32(ptr + 4, value.header_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12910,7 +12955,7 @@ fn __wit_bindgen_lower_t371(ptr : Int, value : @common.HeaderVariable) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t372(ptr : Int, value : @common.QueryVariable) -> Unit { +fn __wit_bindgen_lower_t375(ptr : Int, value : @common.QueryVariable) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.query_param_name) mbt_ffi_store32(ptr + 4, value.query_param_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -12922,13 +12967,13 @@ fn __wit_bindgen_lower_t372(ptr : Int, value : @common.QueryVariable) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t373(ptr : Int, value : @common.AuthDetails) -> Unit { +fn __wit_bindgen_lower_t376(ptr : Int, value : @common.AuthDetails) -> Unit { mbt_ffi_store8(ptr + 0, if value.required { 1 } else { 0 }) } ///| #doc(hidden) -fn __wit_bindgen_lower_t376( +fn __wit_bindgen_lower_t379( ptr : Int, value : @common.HttpMountDetails, ) -> Unit { @@ -12936,7 +12981,7 @@ fn __wit_bindgen_lower_t376( for index = 0; index < value.path_prefix.length(); index = index + 1 { let iter_elem : @common.PathSegment = value.path_prefix[index] let iter_base = address + index * 12 - __wit_bindgen_lower_t370(iter_base + 0, iter_elem) + __wit_bindgen_lower_t373(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.path_prefix.length()) mbt_ffi_store32(ptr + 0, address) @@ -12949,19 +12994,19 @@ fn __wit_bindgen_lower_t376( } Some(payload0) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t373(ptr + 9, payload0) + __wit_bindgen_lower_t376(ptr + 9, payload0) () } } mbt_ffi_store8(ptr + 10, if value.phantom_agent { 1 } else { 0 }) - __wit_bindgen_lower_t366(ptr + 12, value.cors_options) + __wit_bindgen_lower_t369(ptr + 12, value.cors_options) let address1 = mbt_ffi_malloc(value.webhook_suffix.length() * 12) for index2 = 0; index2 < value.webhook_suffix.length(); index2 = index2 + 1 { let iter_elem : @common.PathSegment = value.webhook_suffix[index2] let iter_base = address1 + index2 * 12 - __wit_bindgen_lower_t370(iter_base + 0, iter_elem) + __wit_bindgen_lower_t373(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 24, value.webhook_suffix.length()) mbt_ffi_store32(ptr + 20, address1) @@ -12969,17 +13014,17 @@ fn __wit_bindgen_lower_t376( ///| #doc(hidden) -fn __wit_bindgen_lower_t379( +fn __wit_bindgen_lower_t382( ptr : Int, value : @common.HttpEndpointDetails, ) -> Unit { - __wit_bindgen_lower_t367(ptr + 0, value.http_method) + __wit_bindgen_lower_t370(ptr + 0, value.http_method) let address = mbt_ffi_malloc(value.path_suffix.length() * 12) for index = 0; index < value.path_suffix.length(); index = index + 1 { let iter_elem : @common.PathSegment = value.path_suffix[index] let iter_base = address + index * 12 - __wit_bindgen_lower_t370(iter_base + 0, iter_elem) + __wit_bindgen_lower_t373(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 16, value.path_suffix.length()) mbt_ffi_store32(ptr + 12, address) @@ -12988,7 +13033,7 @@ fn __wit_bindgen_lower_t379( for index1 = 0; index1 < value.header_vars.length(); index1 = index1 + 1 { let iter_elem : @common.HeaderVariable = value.header_vars[index1] let iter_base = address0 + index1 * 16 - __wit_bindgen_lower_t371(iter_base + 0, iter_elem) + __wit_bindgen_lower_t374(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 24, value.header_vars.length()) mbt_ffi_store32(ptr + 20, address0) @@ -12997,7 +13042,7 @@ fn __wit_bindgen_lower_t379( for index3 = 0; index3 < value.query_vars.length(); index3 = index3 + 1 { let iter_elem : @common.QueryVariable = value.query_vars[index3] let iter_base = address2 + index3 * 16 - __wit_bindgen_lower_t372(iter_base + 0, iter_elem) + __wit_bindgen_lower_t375(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 32, value.query_vars.length()) mbt_ffi_store32(ptr + 28, address2) @@ -13010,17 +13055,17 @@ fn __wit_bindgen_lower_t379( } Some(payload4) => { mbt_ffi_store8(ptr + 36, 1) - __wit_bindgen_lower_t373(ptr + 37, payload4) + __wit_bindgen_lower_t376(ptr + 37, payload4) () } } - __wit_bindgen_lower_t366(ptr + 40, value.cors_options) + __wit_bindgen_lower_t369(ptr + 40, value.cors_options) } ///| #doc(hidden) -fn __wit_bindgen_lower_t383(ptr : Int, value : @common.AgentMethod) -> Unit { +fn __wit_bindgen_lower_t386(ptr : Int, value : @common.AgentMethod) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -13033,7 +13078,7 @@ fn __wit_bindgen_lower_t383(ptr : Int, value : @common.AgentMethod) -> Unit { for index = 0; index < value.http_endpoint.length(); index = index + 1 { let iter_elem : @common.HttpEndpointDetails = value.http_endpoint[index] let iter_base = address + index * 48 - __wit_bindgen_lower_t379(iter_base + 0, iter_elem) + __wit_bindgen_lower_t382(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 20, value.http_endpoint.length()) mbt_ffi_store32(ptr + 16, address) @@ -13054,8 +13099,8 @@ fn __wit_bindgen_lower_t383(ptr : Int, value : @common.AgentMethod) -> Unit { () } } - __wit_bindgen_lower_t361(ptr + 36, value.input_schema) - __wit_bindgen_lower_t362(ptr + 48, value.output_schema) + __wit_bindgen_lower_t364(ptr + 36, value.input_schema) + __wit_bindgen_lower_t365(ptr + 48, value.output_schema) match value.read_only { None => { @@ -13065,7 +13110,7 @@ fn __wit_bindgen_lower_t383(ptr : Int, value : @common.AgentMethod) -> Unit { } Some(payload5) => { mbt_ffi_store8(ptr + 56, 1) - __wit_bindgen_lower_t364(ptr + 64, payload5) + __wit_bindgen_lower_t367(ptr + 64, payload5) () } @@ -13074,7 +13119,7 @@ fn __wit_bindgen_lower_t383(ptr : Int, value : @common.AgentMethod) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t389( +fn __wit_bindgen_lower_t392( ptr : Int, value : @common.AgentConstructor, ) -> Unit { @@ -13115,12 +13160,12 @@ fn __wit_bindgen_lower_t389( () } } - __wit_bindgen_lower_t361(ptr + 32, value.input_schema) + __wit_bindgen_lower_t364(ptr + 32, value.input_schema) } ///| #doc(hidden) -fn __wit_bindgen_lower_t391(ptr : Int, value : @common.AgentDependency) -> Unit { +fn __wit_bindgen_lower_t394(ptr : Int, value : @common.AgentDependency) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.type_name) mbt_ffi_store32(ptr + 4, value.type_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -13141,14 +13186,14 @@ fn __wit_bindgen_lower_t391(ptr : Int, value : @common.AgentDependency) -> Unit () } } - __wit_bindgen_lower_t56(ptr + 20, value.schema) - __wit_bindgen_lower_t389(ptr + 40, value.constructor_) + __wit_bindgen_lower_t57(ptr + 20, value.schema) + __wit_bindgen_lower_t392(ptr + 40, value.constructor_) let address = mbt_ffi_malloc(value.methods.length() * 88) for index = 0; index < value.methods.length(); index = index + 1 { let iter_elem : @common.AgentMethod = value.methods[index] let iter_base = address + index * 88 - __wit_bindgen_lower_t383(iter_base + 0, iter_elem) + __wit_bindgen_lower_t386(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 88, value.methods.length()) mbt_ffi_store32(ptr + 84, address) @@ -13156,7 +13201,7 @@ fn __wit_bindgen_lower_t391(ptr : Int, value : @common.AgentDependency) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t392( +fn __wit_bindgen_lower_t395( ptr : Int, value : @common.SnapshottingConfig, ) -> Unit { @@ -13183,7 +13228,7 @@ fn __wit_bindgen_lower_t392( ///| #doc(hidden) -fn __wit_bindgen_lower_t393(ptr : Int, value : @common.Snapshotting) -> Unit { +fn __wit_bindgen_lower_t396(ptr : Int, value : @common.Snapshotting) -> Unit { match value { Disabled => { mbt_ffi_store8(ptr + 0, 0) @@ -13192,7 +13237,7 @@ fn __wit_bindgen_lower_t393(ptr : Int, value : @common.Snapshotting) -> Unit { } Enabled(payload0) => { mbt_ffi_store8(ptr + 0, 1) - __wit_bindgen_lower_t392(ptr + 8, payload0) + __wit_bindgen_lower_t395(ptr + 8, payload0) () } @@ -13201,7 +13246,7 @@ fn __wit_bindgen_lower_t393(ptr : Int, value : @common.Snapshotting) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t395( +fn __wit_bindgen_lower_t398( ptr : Int, value : @common.AgentConfigDeclaration, ) -> Unit { @@ -13223,7 +13268,7 @@ fn __wit_bindgen_lower_t395( ///| #doc(hidden) -fn __wit_bindgen_lower_t399(ptr : Int, value : @common.AgentType) -> Unit { +fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.type_name) mbt_ffi_store32(ptr + 4, value.type_name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -13235,14 +13280,14 @@ fn __wit_bindgen_lower_t399(ptr : Int, value : @common.AgentType) -> Unit { let ptr2 = mbt_ffi_str2ptr(value.source_language) mbt_ffi_store32(ptr + 20, value.source_language.length()) mbt_ffi_store32(ptr + 16, ptr2) - __wit_bindgen_lower_t56(ptr + 24, value.schema) - __wit_bindgen_lower_t389(ptr + 44, value.constructor_) + __wit_bindgen_lower_t57(ptr + 24, value.schema) + __wit_bindgen_lower_t392(ptr + 44, value.constructor_) let address = mbt_ffi_malloc(value.methods.length() * 88) for index = 0; index < value.methods.length(); index = index + 1 { let iter_elem : @common.AgentMethod = value.methods[index] let iter_base = address + index * 88 - __wit_bindgen_lower_t383(iter_base + 0, iter_elem) + __wit_bindgen_lower_t386(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 92, value.methods.length()) mbt_ffi_store32(ptr + 88, address) @@ -13251,7 +13296,7 @@ fn __wit_bindgen_lower_t399(ptr : Int, value : @common.AgentType) -> Unit { for index4 = 0; index4 < value.dependencies.length(); index4 = index4 + 1 { let iter_elem : @common.AgentDependency = value.dependencies[index4] let iter_base = address3 + index4 * 92 - __wit_bindgen_lower_t391(iter_base + 0, iter_elem) + __wit_bindgen_lower_t394(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 100, value.dependencies.length()) mbt_ffi_store32(ptr + 96, address3) @@ -13265,18 +13310,18 @@ fn __wit_bindgen_lower_t399(ptr : Int, value : @common.AgentType) -> Unit { } Some(payload5) => { mbt_ffi_store8(ptr + 108, 1) - __wit_bindgen_lower_t376(ptr + 112, payload5) + __wit_bindgen_lower_t379(ptr + 112, payload5) () } } - __wit_bindgen_lower_t393(ptr + 144, value.snapshotting) + __wit_bindgen_lower_t396(ptr + 144, value.snapshotting) let address6 = mbt_ffi_malloc(value.config.length() * 16) for index7 = 0; index7 < value.config.length(); index7 = index7 + 1 { let iter_elem : @common.AgentConfigDeclaration = value.config[index7] let iter_base = address6 + index7 * 16 - __wit_bindgen_lower_t395(iter_base + 0, iter_elem) + __wit_bindgen_lower_t398(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 172, value.config.length()) mbt_ffi_store32(ptr + 168, address6) @@ -13284,7 +13329,7 @@ fn __wit_bindgen_lower_t399(ptr : Int, value : @common.AgentType) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentError) -> Unit { +fn __wit_bindgen_lower_t405(ptr : Int, value : @common.AgentError) -> Unit { match value { InvalidInput(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -13324,7 +13369,7 @@ fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentError) -> Unit { } CustomError(payload7) => { mbt_ffi_store8(ptr + 0, 4) - __wit_bindgen_lower_t74(ptr + 4, payload7) + __wit_bindgen_lower_t76(ptr + 4, payload7) () } @@ -13332,100 +13377,100 @@ fn __wit_bindgen_lower_t402(ptr : Int, value : @common.AgentError) -> Unit { } ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = - #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| -extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array16 - #| local.get 0) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| -extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = - #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array16 + #| local.get 0) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend8_s) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) ///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/gen/interface/golem/tool/guest/ffi.mbt b/sdks/moonbit/golem_sdk/gen/interface/golem/tool/guest/ffi.mbt index 211f55c3ae..5c3cf202ae 100644 --- a/sdks/moonbit/golem_sdk/gen/interface/golem/tool/guest/ffi.mbt +++ b/sdks/moonbit/golem_sdk/gen/interface/golem/tool/guest/ffi.mbt @@ -14,7 +14,7 @@ pub fn wasmExportDiscoverTools() -> Int { for index = 0; index < payload.length(); index = index + 1 { let iter_elem : @common.Tool = payload[index] let iter_base = address + index * 36 - __wit_bindgen_lower_t507(iter_base + 0, iter_elem) + __wit_bindgen_lower_t510(iter_base + 0, iter_elem) } mbt_ffi_store32(return_area + 8, payload.length()) mbt_ffi_store32(return_area + 4, address) @@ -23,7 +23,7 @@ pub fn wasmExportDiscoverTools() -> Int { } Err(payload0) => { mbt_ffi_store8(return_area + 0, 1) - __wit_bindgen_lower_t508(return_area + 4, payload0) + __wit_bindgen_lower_t511(return_area + 4, payload0) () } @@ -155,6 +155,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -290,6 +291,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -422,6 +424,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -547,6 +550,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -627,6 +631,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -707,6 +712,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -808,6 +814,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -890,6 +897,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -969,6 +977,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -1049,6 +1058,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -1128,6 +1138,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2351,6 +2362,7 @@ pub fn wasmExportDiscoverToolsPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2373,13 +2385,13 @@ pub fn wasmExportGetTool(p0 : Int, p1 : Int) -> Int { match result0 { Ok(payload) => { mbt_ffi_store8(return_area + 0, 0) - __wit_bindgen_lower_t507(return_area + 4, payload) + __wit_bindgen_lower_t510(return_area + 4, payload) () } Err(payload1) => { mbt_ffi_store8(return_area + 0, 1) - __wit_bindgen_lower_t508(return_area + 4, payload1) + __wit_bindgen_lower_t511(return_area + 4, payload1) () } @@ -2505,6 +2517,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2639,6 +2652,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2770,6 +2784,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2894,6 +2909,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -2973,6 +2989,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3052,6 +3069,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3137,6 +3155,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3218,6 +3237,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3297,6 +3317,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3376,6 +3397,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -3455,6 +3477,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -4666,6 +4689,7 @@ pub fn wasmExportGetToolPostReturn(p0 : Int) -> Unit { 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) 31 => () 32 => () + 33 => () _ => panic() } } @@ -7204,6 +7228,12 @@ pub fn wasmExportInvokeGolemToolGuest(p0 : Int) -> Int { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -7457,7 +7487,7 @@ fn invoke_task_return( index256 = index256 + 1 { let iter_elem : @types.SchemaTypeNode = payload255.graph.type_nodes[index256] let iter_base = address + index256 * 144 - __wit_bindgen_lower_t53(iter_base + 0, iter_elem) + __wit_bindgen_lower_t54(iter_base + 0, iter_elem) } let address257 = mbt_ffi_malloc( @@ -7468,7 +7498,7 @@ fn invoke_task_return( index258 = index258 + 1 { let iter_elem : @types.SchemaTypeDef = payload255.graph.defs[index258] let iter_base = address257 + index258 * 24 - __wit_bindgen_lower_t16(iter_base + 0, iter_elem) + __wit_bindgen_lower_t17(iter_base + 0, iter_elem) } let address259 = mbt_ffi_malloc( @@ -7479,7 +7509,7 @@ fn invoke_task_return( index260 = index260 + 1 { let iter_elem : @types.SchemaValueNode = payload255.value.value_nodes[index260] let iter_base = address259 + index260 * 32 - __wit_bindgen_lower_t71(iter_base + 0, iter_elem) + __wit_bindgen_lower_t73(iter_base + 0, iter_elem) } cleanup_list.push(address) cleanup_list.push(address257) @@ -7577,7 +7607,7 @@ fn invoke_task_return( index287 = index287 + 1 { let iter_elem : @types.SchemaTypeNode = payload285.graph.type_nodes[index287] let iter_base = address286 + index287 * 144 - __wit_bindgen_lower_t53(iter_base + 0, iter_elem) + __wit_bindgen_lower_t54(iter_base + 0, iter_elem) } let address288 = mbt_ffi_malloc( @@ -7588,7 +7618,7 @@ fn invoke_task_return( index289 = index289 + 1 { let iter_elem : @types.SchemaTypeDef = payload285.graph.defs[index289] let iter_base = address288 + index289 * 24 - __wit_bindgen_lower_t16(iter_base + 0, iter_elem) + __wit_bindgen_lower_t17(iter_base + 0, iter_elem) } let address290 = mbt_ffi_malloc( @@ -7599,7 +7629,7 @@ fn invoke_task_return( index291 = index291 + 1 { let iter_elem : @types.SchemaValueNode = payload285.value.value_nodes[index291] let iter_base = address290 + index291 * 32 - __wit_bindgen_lower_t71(iter_base + 0, iter_elem) + __wit_bindgen_lower_t73(iter_base + 0, iter_elem) } cleanup_list.push(address286) cleanup_list.push(address288) @@ -7658,7 +7688,7 @@ fn __wit_bindgen_lower_t5(ptr : Int, value : @types.Datetime) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t16(ptr : Int, value : @types.SchemaTypeDef) -> Unit { +fn __wit_bindgen_lower_t17(ptr : Int, value : @types.SchemaTypeDef) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.id) mbt_ffi_store32(ptr + 4, value.id.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -7684,7 +7714,7 @@ fn __wit_bindgen_lower_t16(ptr : Int, value : @types.SchemaTypeDef) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t17(ptr : Int, value : @types.Role) -> Unit { +fn __wit_bindgen_lower_t18(ptr : Int, value : @types.Role) -> Unit { match value { Multimodal => { mbt_ffi_store8(ptr + 0, 0) @@ -7715,7 +7745,7 @@ fn __wit_bindgen_lower_t17(ptr : Int, value : @types.Role) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { +fn __wit_bindgen_lower_t21(ptr : Int, value : @types.MetadataEnvelope) -> Unit { match value.doc { None => { mbt_ffi_store8(ptr + 0, 0) @@ -7782,7 +7812,7 @@ fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { } Some(payload10) => { mbt_ffi_store8(ptr + 40, 1) - __wit_bindgen_lower_t17(ptr + 44, payload10) + __wit_bindgen_lower_t18(ptr + 44, payload10) () } @@ -7791,17 +7821,17 @@ fn __wit_bindgen_lower_t20(ptr : Int, value : @types.MetadataEnvelope) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t21(ptr : Int, value : @types.NamedFieldType) -> Unit { +fn __wit_bindgen_lower_t22(ptr : Int, value : @types.NamedFieldType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) mbt_ffi_store32(ptr + 8, value.body) - __wit_bindgen_lower_t20(ptr + 12, value.metadata) + __wit_bindgen_lower_t21(ptr + 12, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t23(ptr : Int, value : @types.VariantCaseType) -> Unit { +fn __wit_bindgen_lower_t24(ptr : Int, value : @types.VariantCaseType) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -7819,26 +7849,26 @@ fn __wit_bindgen_lower_t23(ptr : Int, value : @types.VariantCaseType) -> Unit { () } } - __wit_bindgen_lower_t20(ptr + 16, value.metadata) + __wit_bindgen_lower_t21(ptr + 16, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t24(ptr : Int, value : @types.FixedListSpec) -> Unit { +fn __wit_bindgen_lower_t25(ptr : Int, value : @types.FixedListSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.element) mbt_ffi_store32(ptr + 4, value.length.reinterpret_as_int()) } ///| #doc(hidden) -fn __wit_bindgen_lower_t25(ptr : Int, value : @types.MapSpec) -> Unit { +fn __wit_bindgen_lower_t26(ptr : Int, value : @types.MapSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.key) mbt_ffi_store32(ptr + 4, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t26(ptr : Int, value : @types.ResultSpec) -> Unit { +fn __wit_bindgen_lower_t27(ptr : Int, value : @types.ResultSpec) -> Unit { match value.ok { None => { mbt_ffi_store8(ptr + 0, 0) @@ -7870,7 +7900,7 @@ fn __wit_bindgen_lower_t26(ptr : Int, value : @types.ResultSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t27(ptr : Int, value : @types.NumericBound) -> Unit { +fn __wit_bindgen_lower_t28(ptr : Int, value : @types.NumericBound) -> Unit { match value { Signed(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -7895,7 +7925,7 @@ fn __wit_bindgen_lower_t27(ptr : Int, value : @types.NumericBound) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t29( +fn __wit_bindgen_lower_t30( ptr : Int, value : @types.NumericRestrictions, ) -> Unit { @@ -7907,7 +7937,7 @@ fn __wit_bindgen_lower_t29( } Some(payload0) => { mbt_ffi_store8(ptr + 0, 1) - __wit_bindgen_lower_t27(ptr + 8, payload0) + __wit_bindgen_lower_t28(ptr + 8, payload0) () } @@ -7921,7 +7951,7 @@ fn __wit_bindgen_lower_t29( } Some(payload2) => { mbt_ffi_store8(ptr + 24, 1) - __wit_bindgen_lower_t27(ptr + 32, payload2) + __wit_bindgen_lower_t28(ptr + 32, payload2) () } @@ -7947,7 +7977,7 @@ fn __wit_bindgen_lower_t29( ///| #doc(hidden) -fn __wit_bindgen_lower_t32(ptr : Int, value : @types.TextRestrictions) -> Unit { +fn __wit_bindgen_lower_t33(ptr : Int, value : @types.TextRestrictions) -> Unit { match value.languages { None => { mbt_ffi_store8(ptr + 0, 0) @@ -8021,7 +8051,7 @@ fn __wit_bindgen_lower_t32(ptr : Int, value : @types.TextRestrictions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t33( +fn __wit_bindgen_lower_t34( ptr : Int, value : @types.BinaryRestrictions, ) -> Unit { @@ -8081,7 +8111,7 @@ fn __wit_bindgen_lower_t33( ///| #doc(hidden) -fn __wit_bindgen_lower_t36(ptr : Int, value : @types.PathSpec) -> Unit { +fn __wit_bindgen_lower_t37(ptr : Int, value : @types.PathSpec) -> Unit { mbt_ffi_store8(ptr + 0, value.direction.ordinal()) mbt_ffi_store8(ptr + 1, value.kind.ordinal()) @@ -8138,7 +8168,7 @@ fn __wit_bindgen_lower_t36(ptr : Int, value : @types.PathSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t37(ptr : Int, value : @types.UrlRestrictions) -> Unit { +fn __wit_bindgen_lower_t38(ptr : Int, value : @types.UrlRestrictions) -> Unit { match value.allowed_schemes { None => { mbt_ffi_store8(ptr + 0, 0) @@ -8192,7 +8222,7 @@ fn __wit_bindgen_lower_t37(ptr : Int, value : @types.UrlRestrictions) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t38(ptr : Int, value : @types.QuantityValue) -> Unit { +fn __wit_bindgen_lower_t39(ptr : Int, value : @types.QuantityValue) -> Unit { mbt_ffi_store64(ptr + 0, value.mantissa) mbt_ffi_store32(ptr + 8, value.scale) @@ -8203,7 +8233,7 @@ fn __wit_bindgen_lower_t38(ptr : Int, value : @types.QuantityValue) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { +fn __wit_bindgen_lower_t41(ptr : Int, value : @types.QuantitySpec) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.base_unit) mbt_ffi_store32(ptr + 4, value.base_unit.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -8228,7 +8258,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { } Some(payload2) => { mbt_ffi_store8(ptr + 16, 1) - __wit_bindgen_lower_t38(ptr + 24, payload2) + __wit_bindgen_lower_t39(ptr + 24, payload2) () } @@ -8242,7 +8272,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 48, 1) - __wit_bindgen_lower_t38(ptr + 56, payload4) + __wit_bindgen_lower_t39(ptr + 56, payload4) () } @@ -8251,7 +8281,7 @@ fn __wit_bindgen_lower_t40(ptr : Int, value : @types.QuantitySpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t41( +fn __wit_bindgen_lower_t42( ptr : Int, value : @types.FieldDiscriminator, ) -> Unit { @@ -8279,7 +8309,7 @@ fn __wit_bindgen_lower_t41( ///| #doc(hidden) -fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit { +fn __wit_bindgen_lower_t43(ptr : Int, value : @types.DiscriminatorRule) -> Unit { match value { Prefix(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -8319,7 +8349,7 @@ fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit } FieldEquals(payload7) => { mbt_ffi_store8(ptr + 0, 4) - __wit_bindgen_lower_t41(ptr + 4, payload7) + __wit_bindgen_lower_t42(ptr + 4, payload7) () } @@ -8337,23 +8367,23 @@ fn __wit_bindgen_lower_t42(ptr : Int, value : @types.DiscriminatorRule) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t43(ptr : Int, value : @types.UnionBranch) -> Unit { +fn __wit_bindgen_lower_t44(ptr : Int, value : @types.UnionBranch) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.tag) mbt_ffi_store32(ptr + 4, value.tag.length()) mbt_ffi_store32(ptr + 0, ptr0) mbt_ffi_store32(ptr + 8, value.body) - __wit_bindgen_lower_t42(ptr + 12, value.discriminator) - __wit_bindgen_lower_t20(ptr + 36, value.metadata) + __wit_bindgen_lower_t43(ptr + 12, value.discriminator) + __wit_bindgen_lower_t21(ptr + 36, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t45(ptr : Int, value : @types.UnionSpec) -> Unit { +fn __wit_bindgen_lower_t46(ptr : Int, value : @types.UnionSpec) -> Unit { let address = mbt_ffi_malloc(value.branches.length() * 92) for index = 0; index < value.branches.length(); index = index + 1 { let iter_elem : @types.UnionBranch = value.branches[index] let iter_base = address + index * 92 - __wit_bindgen_lower_t43(iter_base + 0, iter_elem) + __wit_bindgen_lower_t44(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.branches.length()) mbt_ffi_store32(ptr + 0, address) @@ -8361,7 +8391,7 @@ fn __wit_bindgen_lower_t45(ptr : Int, value : @types.UnionSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t46(ptr : Int, value : @types.SecretSpec) -> Unit { +fn __wit_bindgen_lower_t47(ptr : Int, value : @types.SecretSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.inner) match value.category { @@ -8384,7 +8414,7 @@ fn __wit_bindgen_lower_t46(ptr : Int, value : @types.SecretSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t47(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { +fn __wit_bindgen_lower_t48(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { match value.resource_name { None => { mbt_ffi_store8(ptr + 0, 0) @@ -8405,7 +8435,7 @@ fn __wit_bindgen_lower_t47(ptr : Int, value : @types.QuotaTokenSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { +fn __wit_bindgen_lower_t53(ptr : Int, value : @types.SchemaTypeBody) -> Unit { match value { RefType(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -8429,7 +8459,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload3) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload3) + __wit_bindgen_lower_t30(ptr + 16, payload3) () } @@ -8448,7 +8478,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload6) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload6) + __wit_bindgen_lower_t30(ptr + 16, payload6) () } @@ -8467,7 +8497,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload9) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload9) + __wit_bindgen_lower_t30(ptr + 16, payload9) () } @@ -8486,7 +8516,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload12) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload12) + __wit_bindgen_lower_t30(ptr + 16, payload12) () } @@ -8505,7 +8535,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload15) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload15) + __wit_bindgen_lower_t30(ptr + 16, payload15) () } @@ -8524,7 +8554,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload18) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload18) + __wit_bindgen_lower_t30(ptr + 16, payload18) () } @@ -8543,7 +8573,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload21) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload21) + __wit_bindgen_lower_t30(ptr + 16, payload21) () } @@ -8562,7 +8592,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload24) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload24) + __wit_bindgen_lower_t30(ptr + 16, payload24) () } @@ -8581,7 +8611,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload27) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload27) + __wit_bindgen_lower_t30(ptr + 16, payload27) () } @@ -8600,7 +8630,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } Some(payload30) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t29(ptr + 16, payload30) + __wit_bindgen_lower_t30(ptr + 16, payload30) () } @@ -8625,7 +8655,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { for index = 0; index < payload33.length(); index = index + 1 { let iter_elem : @types.NamedFieldType = payload33[index] let iter_base = address + index * 68 - __wit_bindgen_lower_t21(iter_base + 0, iter_elem) + __wit_bindgen_lower_t22(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload33.length()) mbt_ffi_store32(ptr + 8, address) @@ -8639,7 +8669,7 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { for index36 = 0; index36 < payload34.length(); index36 = index36 + 1 { let iter_elem : @types.VariantCaseType = payload34[index36] let iter_base = address35 + index36 * 72 - __wit_bindgen_lower_t23(iter_base + 0, iter_elem) + __wit_bindgen_lower_t24(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload34.length()) mbt_ffi_store32(ptr + 8, address35) @@ -8702,13 +8732,13 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } FixedListType(payload49) => { mbt_ffi_store8(ptr + 0, 20) - __wit_bindgen_lower_t24(ptr + 8, payload49) + __wit_bindgen_lower_t25(ptr + 8, payload49) () } MapType(payload50) => { mbt_ffi_store8(ptr + 0, 21) - __wit_bindgen_lower_t25(ptr + 8, payload50) + __wit_bindgen_lower_t26(ptr + 8, payload50) () } @@ -8720,31 +8750,31 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } ResultType(payload52) => { mbt_ffi_store8(ptr + 0, 23) - __wit_bindgen_lower_t26(ptr + 8, payload52) + __wit_bindgen_lower_t27(ptr + 8, payload52) () } TextType(payload53) => { mbt_ffi_store8(ptr + 0, 24) - __wit_bindgen_lower_t32(ptr + 8, payload53) + __wit_bindgen_lower_t33(ptr + 8, payload53) () } BinaryType(payload54) => { mbt_ffi_store8(ptr + 0, 25) - __wit_bindgen_lower_t33(ptr + 8, payload54) + __wit_bindgen_lower_t34(ptr + 8, payload54) () } PathType(payload55) => { mbt_ffi_store8(ptr + 0, 26) - __wit_bindgen_lower_t36(ptr + 8, payload55) + __wit_bindgen_lower_t37(ptr + 8, payload55) () } UrlType(payload56) => { mbt_ffi_store8(ptr + 0, 27) - __wit_bindgen_lower_t37(ptr + 8, payload56) + __wit_bindgen_lower_t38(ptr + 8, payload56) () } @@ -8760,25 +8790,25 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { } QuantityType(payload59) => { mbt_ffi_store8(ptr + 0, 30) - __wit_bindgen_lower_t40(ptr + 8, payload59) + __wit_bindgen_lower_t41(ptr + 8, payload59) () } UnionType(payload60) => { mbt_ffi_store8(ptr + 0, 31) - __wit_bindgen_lower_t45(ptr + 8, payload60) + __wit_bindgen_lower_t46(ptr + 8, payload60) () } SecretType(payload61) => { mbt_ffi_store8(ptr + 0, 32) - __wit_bindgen_lower_t46(ptr + 8, payload61) + __wit_bindgen_lower_t47(ptr + 8, payload61) () } QuotaTokenType(payload62) => { mbt_ffi_store8(ptr + 0, 33) - __wit_bindgen_lower_t47(ptr + 8, payload62) + __wit_bindgen_lower_t48(ptr + 8, payload62) () } @@ -8825,19 +8855,19 @@ fn __wit_bindgen_lower_t52(ptr : Int, value : @types.SchemaTypeBody) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t53(ptr : Int, value : @types.SchemaTypeNode) -> Unit { - __wit_bindgen_lower_t52(ptr + 0, value.body) - __wit_bindgen_lower_t20(ptr + 88, value.metadata) +fn __wit_bindgen_lower_t54(ptr : Int, value : @types.SchemaTypeNode) -> Unit { + __wit_bindgen_lower_t53(ptr + 0, value.body) + __wit_bindgen_lower_t21(ptr + 88, value.metadata) } ///| #doc(hidden) -fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { +fn __wit_bindgen_lower_t57(ptr : Int, value : @types.SchemaGraph) -> Unit { let address = mbt_ffi_malloc(value.type_nodes.length() * 144) for index = 0; index < value.type_nodes.length(); index = index + 1 { let iter_elem : @types.SchemaTypeNode = value.type_nodes[index] let iter_base = address + index * 144 - __wit_bindgen_lower_t53(iter_base + 0, iter_elem) + __wit_bindgen_lower_t54(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.type_nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -8846,7 +8876,7 @@ fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { for index1 = 0; index1 < value.defs.length(); index1 = index1 + 1 { let iter_elem : @types.SchemaTypeDef = value.defs[index1] let iter_base = address0 + index1 * 24 - __wit_bindgen_lower_t16(iter_base + 0, iter_elem) + __wit_bindgen_lower_t17(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, value.defs.length()) mbt_ffi_store32(ptr + 8, address0) @@ -8855,7 +8885,7 @@ fn __wit_bindgen_lower_t56(ptr : Int, value : @types.SchemaGraph) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t58( +fn __wit_bindgen_lower_t59( ptr : Int, value : @types.VariantValuePayload, ) -> Unit { @@ -8878,14 +8908,14 @@ fn __wit_bindgen_lower_t58( ///| #doc(hidden) -fn __wit_bindgen_lower_t59(ptr : Int, value : @types.MapEntry) -> Unit { +fn __wit_bindgen_lower_t60(ptr : Int, value : @types.MapEntry) -> Unit { mbt_ffi_store32(ptr + 0, value.key) mbt_ffi_store32(ptr + 4, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t60( +fn __wit_bindgen_lower_t61( ptr : Int, value : @types.ResultValuePayload, ) -> Unit { @@ -8933,7 +8963,7 @@ fn __wit_bindgen_lower_t60( ///| #doc(hidden) -fn __wit_bindgen_lower_t61(ptr : Int, value : @types.TextValuePayload) -> Unit { +fn __wit_bindgen_lower_t62(ptr : Int, value : @types.TextValuePayload) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.text) mbt_ffi_store32(ptr + 4, value.text.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -8958,7 +8988,7 @@ fn __wit_bindgen_lower_t61(ptr : Int, value : @types.TextValuePayload) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t63( +fn __wit_bindgen_lower_t64( ptr : Int, value : @types.BinaryValuePayload, ) -> Unit { @@ -8987,7 +9017,7 @@ fn __wit_bindgen_lower_t63( ///| #doc(hidden) -fn __wit_bindgen_lower_t64( +fn __wit_bindgen_lower_t65( ptr : Int, value : @types.DurationValuePayload, ) -> Unit { @@ -8996,7 +9026,7 @@ fn __wit_bindgen_lower_t64( ///| #doc(hidden) -fn __wit_bindgen_lower_t65(ptr : Int, value : @types.UnionValuePayload) -> Unit { +fn __wit_bindgen_lower_t66(ptr : Int, value : @types.UnionValuePayload) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.tag) mbt_ffi_store32(ptr + 4, value.tag.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9005,7 +9035,7 @@ fn __wit_bindgen_lower_t65(ptr : Int, value : @types.UnionValuePayload) -> Unit ///| #doc(hidden) -fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { +fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueNode) -> Unit { match value { BoolValue(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -9104,7 +9134,7 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } VariantValue(payload14) => { mbt_ffi_store8(ptr + 0, 14) - __wit_bindgen_lower_t58(ptr + 8, payload14) + __wit_bindgen_lower_t59(ptr + 8, payload14) () } @@ -9177,7 +9207,7 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { for index30 = 0; index30 < payload28.length(); index30 = index30 + 1 { let iter_elem : @types.MapEntry = payload28[index30] let iter_base = address29 + index30 * 8 - __wit_bindgen_lower_t59(iter_base + 0, iter_elem) + __wit_bindgen_lower_t60(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, payload28.length()) mbt_ffi_store32(ptr + 8, address29) @@ -9205,19 +9235,19 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } ResultValue(payload34) => { mbt_ffi_store8(ptr + 0, 22) - __wit_bindgen_lower_t60(ptr + 8, payload34) + __wit_bindgen_lower_t61(ptr + 8, payload34) () } TextValue(payload35) => { mbt_ffi_store8(ptr + 0, 23) - __wit_bindgen_lower_t61(ptr + 8, payload35) + __wit_bindgen_lower_t62(ptr + 8, payload35) () } BinaryValue(payload36) => { mbt_ffi_store8(ptr + 0, 24) - __wit_bindgen_lower_t63(ptr + 8, payload36) + __wit_bindgen_lower_t64(ptr + 8, payload36) () } @@ -9247,19 +9277,19 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { } DurationValue(payload42) => { mbt_ffi_store8(ptr + 0, 28) - __wit_bindgen_lower_t64(ptr + 8, payload42) + __wit_bindgen_lower_t65(ptr + 8, payload42) () } QuantityValueNode(payload43) => { mbt_ffi_store8(ptr + 0, 29) - __wit_bindgen_lower_t38(ptr + 8, payload43) + __wit_bindgen_lower_t39(ptr + 8, payload43) () } UnionValue(payload44) => { mbt_ffi_store8(ptr + 0, 30) - __wit_bindgen_lower_t65(ptr + 8, payload44) + __wit_bindgen_lower_t66(ptr + 8, payload44) () } @@ -9277,6 +9307,14 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { let @types.QuotaToken(handle47) = payload46 mbt_ffi_store32(ptr + 8, handle47) + () + } + StreamValue(payload48) => { + mbt_ffi_store8(ptr + 0, 33) + + let @types.SchemaValueStream(handle49) = payload48 + mbt_ffi_store32(ptr + 8, handle49) + () } } @@ -9284,12 +9322,12 @@ fn __wit_bindgen_lower_t71(ptr : Int, value : @types.SchemaValueNode) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueTree) -> Unit { +fn __wit_bindgen_lower_t75(ptr : Int, value : @types.SchemaValueTree) -> Unit { let address = mbt_ffi_malloc(value.value_nodes.length() * 32) for index = 0; index < value.value_nodes.length(); index = index + 1 { let iter_elem : @types.SchemaValueNode = value.value_nodes[index] let iter_base = address + index * 32 - __wit_bindgen_lower_t71(iter_base + 0, iter_elem) + __wit_bindgen_lower_t73(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.value_nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -9298,14 +9336,14 @@ fn __wit_bindgen_lower_t73(ptr : Int, value : @types.SchemaValueTree) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t74(ptr : Int, value : @types.TypedSchemaValue) -> Unit { - __wit_bindgen_lower_t56(ptr + 0, value.graph) - __wit_bindgen_lower_t73(ptr + 20, value.value) +fn __wit_bindgen_lower_t76(ptr : Int, value : @types.TypedSchemaValue) -> Unit { + __wit_bindgen_lower_t57(ptr + 0, value.graph) + __wit_bindgen_lower_t75(ptr + 20, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t454( +fn __wit_bindgen_lower_t457( ptr : Int, value : @common.CommandAnnotations, ) -> Unit { @@ -9317,7 +9355,7 @@ fn __wit_bindgen_lower_t454( ///| #doc(hidden) -fn __wit_bindgen_lower_t456(ptr : Int, value : @common.Repetition) -> Unit { +fn __wit_bindgen_lower_t459(ptr : Int, value : @common.Repetition) -> Unit { match value { Repeated => { mbt_ffi_store8(ptr + 0, 0) @@ -9341,28 +9379,28 @@ fn __wit_bindgen_lower_t456(ptr : Int, value : @common.Repetition) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t457( +fn __wit_bindgen_lower_t460( ptr : Int, value : @common.RepeatableListShape, ) -> Unit { - __wit_bindgen_lower_t456(ptr + 0, value.repetition) + __wit_bindgen_lower_t459(ptr + 0, value.repetition) mbt_ffi_store32(ptr + 8, value.item_type) } ///| #doc(hidden) -fn __wit_bindgen_lower_t458( +fn __wit_bindgen_lower_t461( ptr : Int, value : @common.RepeatableMapShape, ) -> Unit { - __wit_bindgen_lower_t456(ptr + 0, value.repetition) + __wit_bindgen_lower_t459(ptr + 0, value.repetition) mbt_ffi_store32(ptr + 8, value.map_type) mbt_ffi_store8(ptr + 12, value.duplicate_key_policy.ordinal()) } ///| #doc(hidden) -fn __wit_bindgen_lower_t459(ptr : Int, value : @common.OptionShape) -> Unit { +fn __wit_bindgen_lower_t462(ptr : Int, value : @common.OptionShape) -> Unit { match value { Scalar(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -9378,13 +9416,13 @@ fn __wit_bindgen_lower_t459(ptr : Int, value : @common.OptionShape) -> Unit { } RepeatableList(payload1) => { mbt_ffi_store8(ptr + 0, 2) - __wit_bindgen_lower_t457(ptr + 4, payload1) + __wit_bindgen_lower_t460(ptr + 4, payload1) () } RepeatableMap(payload2) => { mbt_ffi_store8(ptr + 0, 3) - __wit_bindgen_lower_t458(ptr + 4, payload2) + __wit_bindgen_lower_t461(ptr + 4, payload2) () } @@ -9393,18 +9431,18 @@ fn __wit_bindgen_lower_t459(ptr : Int, value : @common.OptionShape) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t460(ptr : Int, value : @common.BoolFlagShape) -> Unit { +fn __wit_bindgen_lower_t463(ptr : Int, value : @common.BoolFlagShape) -> Unit { mbt_ffi_store8(ptr + 0, if value.default { 1 } else { 0 }) mbt_ffi_store8(ptr + 1, if value.negatable { 1 } else { 0 }) } ///| #doc(hidden) -fn __wit_bindgen_lower_t462(ptr : Int, value : @common.FlagShape) -> Unit { +fn __wit_bindgen_lower_t465(ptr : Int, value : @common.FlagShape) -> Unit { match value { BoolFlag(payload) => { mbt_ffi_store8(ptr + 0, 0) - __wit_bindgen_lower_t460(ptr + 4, payload) + __wit_bindgen_lower_t463(ptr + 4, payload) () } @@ -9432,16 +9470,16 @@ fn __wit_bindgen_lower_t462(ptr : Int, value : @common.FlagShape) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t463(ptr : Int, value : @common.ValueIsRef) -> Unit { +fn __wit_bindgen_lower_t466(ptr : Int, value : @common.ValueIsRef) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t73(ptr + 8, value.value) + __wit_bindgen_lower_t75(ptr + 8, value.value) } ///| #doc(hidden) -fn __wit_bindgen_lower_t464(ptr : Int, value : @common.Ref) -> Unit { +fn __wit_bindgen_lower_t467(ptr : Int, value : @common.Ref) -> Unit { match value { Present(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -9454,7 +9492,7 @@ fn __wit_bindgen_lower_t464(ptr : Int, value : @common.Ref) -> Unit { } ValueIs(payload1) => { mbt_ffi_store8(ptr + 0, 1) - __wit_bindgen_lower_t463(ptr + 4, payload1) + __wit_bindgen_lower_t466(ptr + 4, payload1) () } @@ -9463,12 +9501,12 @@ fn __wit_bindgen_lower_t464(ptr : Int, value : @common.Ref) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t466(ptr : Int, value : @common.RefGroup) -> Unit { +fn __wit_bindgen_lower_t469(ptr : Int, value : @common.RefGroup) -> Unit { let address = mbt_ffi_malloc(value.refs.length() * 24) for index = 0; index < value.refs.length(); index = index + 1 { let iter_elem : @common.Ref = value.refs[index] let iter_base = address + index * 24 - __wit_bindgen_lower_t464(iter_base + 0, iter_elem) + __wit_bindgen_lower_t467(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.refs.length()) mbt_ffi_store32(ptr + 0, address) @@ -9476,14 +9514,14 @@ fn __wit_bindgen_lower_t466(ptr : Int, value : @common.RefGroup) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t468(ptr : Int, value : @common.ImpliesC) -> Unit { +fn __wit_bindgen_lower_t471(ptr : Int, value : @common.ImpliesC) -> Unit { mbt_ffi_store8(ptr + 0, value.lhs_quant.ordinal()) let address = mbt_ffi_malloc(value.lhs.length() * 24) for index = 0; index < value.lhs.length(); index = index + 1 { let iter_elem : @common.Ref = value.lhs[index] let iter_base = address + index * 24 - __wit_bindgen_lower_t464(iter_base + 0, iter_elem) + __wit_bindgen_lower_t467(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, value.lhs.length()) mbt_ffi_store32(ptr + 4, address) @@ -9493,7 +9531,7 @@ fn __wit_bindgen_lower_t468(ptr : Int, value : @common.ImpliesC) -> Unit { for index1 = 0; index1 < value.rhs.length(); index1 = index1 + 1 { let iter_elem : @common.Ref = value.rhs[index1] let iter_base = address0 + index1 * 24 - __wit_bindgen_lower_t464(iter_base + 0, iter_elem) + __wit_bindgen_lower_t467(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 20, value.rhs.length()) mbt_ffi_store32(ptr + 16, address0) @@ -9501,14 +9539,14 @@ fn __wit_bindgen_lower_t468(ptr : Int, value : @common.ImpliesC) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t469(ptr : Int, value : @common.ForbidsC) -> Unit { +fn __wit_bindgen_lower_t472(ptr : Int, value : @common.ForbidsC) -> Unit { mbt_ffi_store8(ptr + 0, value.lhs_quant.ordinal()) let address = mbt_ffi_malloc(value.lhs.length() * 24) for index = 0; index < value.lhs.length(); index = index + 1 { let iter_elem : @common.Ref = value.lhs[index] let iter_base = address + index * 24 - __wit_bindgen_lower_t464(iter_base + 0, iter_elem) + __wit_bindgen_lower_t467(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, value.lhs.length()) mbt_ffi_store32(ptr + 4, address) @@ -9517,7 +9555,7 @@ fn __wit_bindgen_lower_t469(ptr : Int, value : @common.ForbidsC) -> Unit { for index1 = 0; index1 < value.rhs.length(); index1 = index1 + 1 { let iter_elem : @common.Ref = value.rhs[index1] let iter_base = address0 + index1 * 24 - __wit_bindgen_lower_t464(iter_base + 0, iter_elem) + __wit_bindgen_lower_t467(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 16, value.rhs.length()) mbt_ffi_store32(ptr + 12, address0) @@ -9525,7 +9563,7 @@ fn __wit_bindgen_lower_t469(ptr : Int, value : @common.ForbidsC) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t471(ptr : Int, value : @common.Constraint) -> Unit { +fn __wit_bindgen_lower_t474(ptr : Int, value : @common.Constraint) -> Unit { match value { RequiresAll(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -9534,7 +9572,7 @@ fn __wit_bindgen_lower_t471(ptr : Int, value : @common.Constraint) -> Unit { for index = 0; index < payload.length(); index = index + 1 { let iter_elem : @common.Ref = payload[index] let iter_base = address + index * 24 - __wit_bindgen_lower_t464(iter_base + 0, iter_elem) + __wit_bindgen_lower_t467(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload.length()) mbt_ffi_store32(ptr + 4, address) @@ -9548,7 +9586,7 @@ fn __wit_bindgen_lower_t471(ptr : Int, value : @common.Constraint) -> Unit { for index2 = 0; index2 < payload0.length(); index2 = index2 + 1 { let iter_elem : @common.Ref = payload0[index2] let iter_base = address1 + index2 * 24 - __wit_bindgen_lower_t464(iter_base + 0, iter_elem) + __wit_bindgen_lower_t467(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload0.length()) mbt_ffi_store32(ptr + 4, address1) @@ -9562,7 +9600,7 @@ fn __wit_bindgen_lower_t471(ptr : Int, value : @common.Constraint) -> Unit { for index5 = 0; index5 < payload3.length(); index5 = index5 + 1 { let iter_elem : @common.Ref = payload3[index5] let iter_base = address4 + index5 * 24 - __wit_bindgen_lower_t464(iter_base + 0, iter_elem) + __wit_bindgen_lower_t467(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload3.length()) mbt_ffi_store32(ptr + 4, address4) @@ -9576,7 +9614,7 @@ fn __wit_bindgen_lower_t471(ptr : Int, value : @common.Constraint) -> Unit { for index8 = 0; index8 < payload6.length(); index8 = index8 + 1 { let iter_elem : @common.RefGroup = payload6[index8] let iter_base = address7 + index8 * 8 - __wit_bindgen_lower_t466(iter_base + 0, iter_elem) + __wit_bindgen_lower_t469(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 8, payload6.length()) mbt_ffi_store32(ptr + 4, address7) @@ -9585,13 +9623,13 @@ fn __wit_bindgen_lower_t471(ptr : Int, value : @common.Constraint) -> Unit { } Implies(payload9) => { mbt_ffi_store8(ptr + 0, 4) - __wit_bindgen_lower_t468(ptr + 4, payload9) + __wit_bindgen_lower_t471(ptr + 4, payload9) () } Forbids(payload10) => { mbt_ffi_store8(ptr + 0, 5) - __wit_bindgen_lower_t469(ptr + 4, payload10) + __wit_bindgen_lower_t472(ptr + 4, payload10) () } @@ -9600,7 +9638,7 @@ fn __wit_bindgen_lower_t471(ptr : Int, value : @common.Constraint) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t473(ptr : Int, value : @common.Example) -> Unit { +fn __wit_bindgen_lower_t476(ptr : Int, value : @common.Example) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.title) mbt_ffi_store32(ptr + 4, value.title.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9612,7 +9650,7 @@ fn __wit_bindgen_lower_t473(ptr : Int, value : @common.Example) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t475(ptr : Int, value : @common.Doc) -> Unit { +fn __wit_bindgen_lower_t478(ptr : Int, value : @common.Doc) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.summary) mbt_ffi_store32(ptr + 4, value.summary.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9625,7 +9663,7 @@ fn __wit_bindgen_lower_t475(ptr : Int, value : @common.Doc) -> Unit { for index = 0; index < value.examples.length(); index = index + 1 { let iter_elem : @common.Example = value.examples[index] let iter_base = address + index * 16 - __wit_bindgen_lower_t473(iter_base + 0, iter_elem) + __wit_bindgen_lower_t476(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 20, value.examples.length()) mbt_ffi_store32(ptr + 16, address) @@ -9633,11 +9671,11 @@ fn __wit_bindgen_lower_t475(ptr : Int, value : @common.Doc) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t478(ptr : Int, value : @common.Positional) -> Unit { +fn __wit_bindgen_lower_t481(ptr : Int, value : @common.Positional) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t475(ptr + 8, value.doc) + __wit_bindgen_lower_t478(ptr + 8, value.doc) match value.value_name { None => { @@ -9665,7 +9703,7 @@ fn __wit_bindgen_lower_t478(ptr : Int, value : @common.Positional) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 48, 1) - __wit_bindgen_lower_t73(ptr + 52, payload4) + __wit_bindgen_lower_t75(ptr + 52, payload4) () } @@ -9676,11 +9714,11 @@ fn __wit_bindgen_lower_t478(ptr : Int, value : @common.Positional) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t479(ptr : Int, value : @common.TailPositional) -> Unit { +fn __wit_bindgen_lower_t482(ptr : Int, value : @common.TailPositional) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t475(ptr + 8, value.doc) + __wit_bindgen_lower_t478(ptr + 8, value.doc) match value.value_name { None => { @@ -9737,12 +9775,12 @@ fn __wit_bindgen_lower_t479(ptr : Int, value : @common.TailPositional) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t482(ptr : Int, value : @common.Positionals) -> Unit { +fn __wit_bindgen_lower_t485(ptr : Int, value : @common.Positionals) -> Unit { let address = mbt_ffi_malloc(value.fixed.length() * 68) for index = 0; index < value.fixed.length(); index = index + 1 { let iter_elem : @common.Positional = value.fixed[index] let iter_base = address + index * 68 - __wit_bindgen_lower_t478(iter_base + 0, iter_elem) + __wit_bindgen_lower_t481(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.fixed.length()) mbt_ffi_store32(ptr + 0, address) @@ -9755,7 +9793,7 @@ fn __wit_bindgen_lower_t482(ptr : Int, value : @common.Positionals) -> Unit { } Some(payload0) => { mbt_ffi_store8(ptr + 8, 1) - __wit_bindgen_lower_t479(ptr + 12, payload0) + __wit_bindgen_lower_t482(ptr + 12, payload0) () } @@ -9764,7 +9802,7 @@ fn __wit_bindgen_lower_t482(ptr : Int, value : @common.Positionals) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t485(ptr : Int, value : @common.OptionSpec) -> Unit { +fn __wit_bindgen_lower_t488(ptr : Int, value : @common.OptionSpec) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.long) mbt_ffi_store32(ptr + 4, value.long.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9794,7 +9832,7 @@ fn __wit_bindgen_lower_t485(ptr : Int, value : @common.OptionSpec) -> Unit { } mbt_ffi_store32(ptr + 20, value.aliases.length()) mbt_ffi_store32(ptr + 16, address) - __wit_bindgen_lower_t475(ptr + 24, value.doc) + __wit_bindgen_lower_t478(ptr + 24, value.doc) match value.value_name { None => { @@ -9812,7 +9850,7 @@ fn __wit_bindgen_lower_t485(ptr : Int, value : @common.OptionSpec) -> Unit { () } } - __wit_bindgen_lower_t459(ptr + 60, value.shape) + __wit_bindgen_lower_t462(ptr + 60, value.shape) match value.default { None => { @@ -9822,7 +9860,7 @@ fn __wit_bindgen_lower_t485(ptr : Int, value : @common.OptionSpec) -> Unit { } Some(payload7) => { mbt_ffi_store8(ptr + 80, 1) - __wit_bindgen_lower_t73(ptr + 84, payload7) + __wit_bindgen_lower_t75(ptr + 84, payload7) () } @@ -9849,7 +9887,7 @@ fn __wit_bindgen_lower_t485(ptr : Int, value : @common.OptionSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t486(ptr : Int, value : @common.FlagSpec) -> Unit { +fn __wit_bindgen_lower_t489(ptr : Int, value : @common.FlagSpec) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.long) mbt_ffi_store32(ptr + 4, value.long.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -9879,8 +9917,8 @@ fn __wit_bindgen_lower_t486(ptr : Int, value : @common.FlagSpec) -> Unit { } mbt_ffi_store32(ptr + 20, value.aliases.length()) mbt_ffi_store32(ptr + 16, address) - __wit_bindgen_lower_t475(ptr + 24, value.doc) - __wit_bindgen_lower_t462(ptr + 48, value.shape) + __wit_bindgen_lower_t478(ptr + 24, value.doc) + __wit_bindgen_lower_t465(ptr + 48, value.shape) match value.env_var { None => { @@ -9902,12 +9940,12 @@ fn __wit_bindgen_lower_t486(ptr : Int, value : @common.FlagSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t489(ptr : Int, value : @common.Globals) -> Unit { +fn __wit_bindgen_lower_t492(ptr : Int, value : @common.Globals) -> Unit { let address = mbt_ffi_malloc(value.options.length() * 112) for index = 0; index < value.options.length(); index = index + 1 { let iter_elem : @common.OptionSpec = value.options[index] let iter_base = address + index * 112 - __wit_bindgen_lower_t485(iter_base + 0, iter_elem) + __wit_bindgen_lower_t488(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.options.length()) mbt_ffi_store32(ptr + 0, address) @@ -9916,7 +9954,7 @@ fn __wit_bindgen_lower_t489(ptr : Int, value : @common.Globals) -> Unit { for index1 = 0; index1 < value.flags.length(); index1 = index1 + 1 { let iter_elem : @common.FlagSpec = value.flags[index1] let iter_base = address0 + index1 * 72 - __wit_bindgen_lower_t486(iter_base + 0, iter_elem) + __wit_bindgen_lower_t489(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 12, value.flags.length()) mbt_ffi_store32(ptr + 8, address0) @@ -9924,8 +9962,8 @@ fn __wit_bindgen_lower_t489(ptr : Int, value : @common.Globals) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t490(ptr : Int, value : @common.StreamSpec) -> Unit { - __wit_bindgen_lower_t475(ptr + 0, value.doc) +fn __wit_bindgen_lower_t493(ptr : Int, value : @common.StreamSpec) -> Unit { + __wit_bindgen_lower_t478(ptr + 0, value.doc) let address = mbt_ffi_malloc(value.mime.length() * 8) for index = 0; index < value.mime.length(); index = index + 1 { @@ -9943,24 +9981,24 @@ fn __wit_bindgen_lower_t490(ptr : Int, value : @common.StreamSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t491(ptr : Int, value : @common.Formatter) -> Unit { +fn __wit_bindgen_lower_t494(ptr : Int, value : @common.Formatter) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t475(ptr + 8, value.doc) + __wit_bindgen_lower_t478(ptr + 8, value.doc) } ///| #doc(hidden) -fn __wit_bindgen_lower_t493(ptr : Int, value : @common.ResultSpec) -> Unit { +fn __wit_bindgen_lower_t496(ptr : Int, value : @common.ResultSpec) -> Unit { mbt_ffi_store32(ptr + 0, value.type_) - __wit_bindgen_lower_t475(ptr + 4, value.doc) + __wit_bindgen_lower_t478(ptr + 4, value.doc) let address = mbt_ffi_malloc(value.formatters.length() * 32) for index = 0; index < value.formatters.length(); index = index + 1 { let iter_elem : @common.Formatter = value.formatters[index] let iter_base = address + index * 32 - __wit_bindgen_lower_t491(iter_base + 0, iter_elem) + __wit_bindgen_lower_t494(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 32, value.formatters.length()) mbt_ffi_store32(ptr + 28, address) @@ -9972,11 +10010,11 @@ fn __wit_bindgen_lower_t493(ptr : Int, value : @common.ResultSpec) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t495(ptr : Int, value : @common.ErrorCase) -> Unit { +fn __wit_bindgen_lower_t498(ptr : Int, value : @common.ErrorCase) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t475(ptr + 8, value.doc) + __wit_bindgen_lower_t478(ptr + 8, value.doc) mbt_ffi_store8(ptr + 32, value.kind.ordinal()) mbt_ffi_store8(ptr + 33, value.exit_code.to_int()) @@ -9997,14 +10035,14 @@ fn __wit_bindgen_lower_t495(ptr : Int, value : @common.ErrorCase) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { - __wit_bindgen_lower_t482(ptr + 0, value.positionals) +fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandBody) -> Unit { + __wit_bindgen_lower_t485(ptr + 0, value.positionals) let address = mbt_ffi_malloc(value.options.length() * 112) for index = 0; index < value.options.length(); index = index + 1 { let iter_elem : @common.OptionSpec = value.options[index] let iter_base = address + index * 112 - __wit_bindgen_lower_t485(iter_base + 0, iter_elem) + __wit_bindgen_lower_t488(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 92, value.options.length()) mbt_ffi_store32(ptr + 88, address) @@ -10013,7 +10051,7 @@ fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { for index1 = 0; index1 < value.flags.length(); index1 = index1 + 1 { let iter_elem : @common.FlagSpec = value.flags[index1] let iter_base = address0 + index1 * 72 - __wit_bindgen_lower_t486(iter_base + 0, iter_elem) + __wit_bindgen_lower_t489(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 100, value.flags.length()) mbt_ffi_store32(ptr + 96, address0) @@ -10022,7 +10060,7 @@ fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { for index3 = 0; index3 < value.constraints.length(); index3 = index3 + 1 { let iter_elem : @common.Constraint = value.constraints[index3] let iter_base = address2 + index3 * 28 - __wit_bindgen_lower_t471(iter_base + 0, iter_elem) + __wit_bindgen_lower_t474(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 108, value.constraints.length()) mbt_ffi_store32(ptr + 104, address2) @@ -10035,7 +10073,7 @@ fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 112, 1) - __wit_bindgen_lower_t490(ptr + 116, payload4) + __wit_bindgen_lower_t493(ptr + 116, payload4) () } @@ -10049,7 +10087,7 @@ fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { } Some(payload6) => { mbt_ffi_store8(ptr + 152, 1) - __wit_bindgen_lower_t490(ptr + 156, payload6) + __wit_bindgen_lower_t493(ptr + 156, payload6) () } @@ -10063,7 +10101,7 @@ fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { } Some(payload8) => { mbt_ffi_store8(ptr + 192, 1) - __wit_bindgen_lower_t493(ptr + 196, payload8) + __wit_bindgen_lower_t496(ptr + 196, payload8) () } @@ -10073,7 +10111,7 @@ fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { for index10 = 0; index10 < value.errors.length(); index10 = index10 + 1 { let iter_elem : @common.ErrorCase = value.errors[index10] let iter_base = address9 + index10 * 44 - __wit_bindgen_lower_t495(iter_base + 0, iter_elem) + __wit_bindgen_lower_t498(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 244, value.errors.length()) mbt_ffi_store32(ptr + 240, address9) @@ -10086,7 +10124,7 @@ fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { } Some(payload12) => { mbt_ffi_store8(ptr + 248, 1) - __wit_bindgen_lower_t454(ptr + 249, payload12) + __wit_bindgen_lower_t457(ptr + 249, payload12) () } @@ -10095,7 +10133,7 @@ fn __wit_bindgen_lower_t501(ptr : Int, value : @common.CommandBody) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandNode) -> Unit { +fn __wit_bindgen_lower_t507(ptr : Int, value : @common.CommandNode) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.name) mbt_ffi_store32(ptr + 4, value.name.length()) mbt_ffi_store32(ptr + 0, ptr0) @@ -10111,8 +10149,8 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandNode) -> Unit { } mbt_ffi_store32(ptr + 12, value.aliases.length()) mbt_ffi_store32(ptr + 8, address) - __wit_bindgen_lower_t475(ptr + 16, value.doc) - __wit_bindgen_lower_t489(ptr + 40, value.globals) + __wit_bindgen_lower_t478(ptr + 16, value.doc) + __wit_bindgen_lower_t492(ptr + 40, value.globals) let address2 = mbt_ffi_malloc(value.subcommands.length() * 4) for index3 = 0; index3 < value.subcommands.length(); index3 = index3 + 1 { @@ -10131,7 +10169,7 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandNode) -> Unit { } Some(payload4) => { mbt_ffi_store8(ptr + 64, 1) - __wit_bindgen_lower_t501(ptr + 68, payload4) + __wit_bindgen_lower_t504(ptr + 68, payload4) () } @@ -10140,12 +10178,12 @@ fn __wit_bindgen_lower_t504(ptr : Int, value : @common.CommandNode) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t506(ptr : Int, value : @common.CommandTree) -> Unit { +fn __wit_bindgen_lower_t509(ptr : Int, value : @common.CommandTree) -> Unit { let address = mbt_ffi_malloc(value.nodes.length() * 324) for index = 0; index < value.nodes.length(); index = index + 1 { let iter_elem : @common.CommandNode = value.nodes[index] let iter_base = address + index * 324 - __wit_bindgen_lower_t504(iter_base + 0, iter_elem) + __wit_bindgen_lower_t507(iter_base + 0, iter_elem) } mbt_ffi_store32(ptr + 4, value.nodes.length()) mbt_ffi_store32(ptr + 0, address) @@ -10153,17 +10191,17 @@ fn __wit_bindgen_lower_t506(ptr : Int, value : @common.CommandTree) -> Unit { ///| #doc(hidden) -fn __wit_bindgen_lower_t507(ptr : Int, value : @common.Tool) -> Unit { +fn __wit_bindgen_lower_t510(ptr : Int, value : @common.Tool) -> Unit { let ptr0 = mbt_ffi_str2ptr(value.version) mbt_ffi_store32(ptr + 4, value.version.length()) mbt_ffi_store32(ptr + 0, ptr0) - __wit_bindgen_lower_t506(ptr + 8, value.commands) - __wit_bindgen_lower_t56(ptr + 16, value.schema) + __wit_bindgen_lower_t509(ptr + 8, value.commands) + __wit_bindgen_lower_t57(ptr + 16, value.schema) } ///| #doc(hidden) -fn __wit_bindgen_lower_t508(ptr : Int, value : @common.ToolError) -> Unit { +fn __wit_bindgen_lower_t511(ptr : Int, value : @common.ToolError) -> Unit { match value { InvalidToolName(payload) => { mbt_ffi_store8(ptr + 0, 0) @@ -10220,7 +10258,7 @@ fn __wit_bindgen_lower_t508(ptr : Int, value : @common.ToolError) -> Unit { } CustomError(payload9) => { mbt_ffi_store8(ptr + 0, 5) - __wit_bindgen_lower_t74(ptr + 4, payload9) + __wit_bindgen_lower_t76(ptr + 4, payload9) () } @@ -10228,76 +10266,72 @@ fn __wit_bindgen_lower_t508(ptr : Int, value : @common.ToolError) -> Unit { } ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) - -///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_u) +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| -extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = - #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) ///| extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.extend8_s) ///| -extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) ///| -extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = - #|(func (param i32) (result f64) local.get 0 f64.load) +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) ///| -#owned(str) -extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) ///| -extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load) ///| -#owned(bytes) -extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = - #|(func (param i32) (result i32) local.get 0) +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) ///| -extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_u) +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) ///| -extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = - #|(func (param i32) (param i32) (result i32) - #| local.get 0 - #| local.get 1 call $moonbit.init_array8 - #| local.get 0) +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load16_s) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = - #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) ///| -extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.extend16_s) +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = @@ -10307,20 +10341,24 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0) ///| -extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = - #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) ///| -extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load8_s) +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) ///| -extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = - #|(func (param i32) (result i32) local.get 0 i32.load) +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) ///| -extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = - #|(func (param i32) (result f32) local.get 0 f32.load) +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) ///| extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = diff --git a/sdks/moonbit/golem_sdk/interface/golem/api/oplog/top.mbt b/sdks/moonbit/golem_sdk/interface/golem/api/oplog/top.mbt index 4133b31122..5ee4c23618 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/api/oplog/top.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/api/oplog/top.mbt @@ -1015,10 +1015,10 @@ pub fn enrich_oplog_entries( let ptr = mbt_ffi_str2ptr(agent_id.agent_id) - let address459 = mbt_ffi_malloc(entries.length() * 216) - for index460 = 0; index460 < entries.length(); index460 = index460 + 1 { - let iter_elem : (UInt64, OplogEntry) = entries[index460] - let iter_base = address459 + index460 * 216 + let address461 = mbt_ffi_malloc(entries.length() * 216) + for index462 = 0; index462 < entries.length(); index462 = index462 + 1 { + let iter_elem : (UInt64, OplogEntry) = entries[index462] + let iter_base = address461 + index462 * 216 mbt_ffi_store64(iter_base + 0, iter_elem.0.reinterpret_as_int64()) match iter_elem.1 { @@ -1138,12 +1138,12 @@ pub fn enrich_oplog_entries( ) mbt_ffi_store32(iter_base + 160, address6) - let address82 = mbt_ffi_malloc(payload.local_agent_config.length() * 20) - for index83 = 0 - index83 < payload.local_agent_config.length() - index83 = index83 + 1 { - let iter_elem : RawLocalAgentConfigEntry = payload.local_agent_config[index83] - let iter_base = address82 + index83 * 20 + let address84 = mbt_ffi_malloc(payload.local_agent_config.length() * 20) + for index85 = 0 + index85 < payload.local_agent_config.length() + index85 = index85 + 1 { + let iter_elem : RawLocalAgentConfigEntry = payload.local_agent_config[index85] + let iter_base = address84 + index85 * 20 let address9 = mbt_ffi_malloc(iter_elem.path.length() * 8) for index10 = 0 @@ -1160,14 +1160,14 @@ pub fn enrich_oplog_entries( mbt_ffi_store32(iter_base + 4, iter_elem.path.length()) mbt_ffi_store32(iter_base + 0, address9) - let address80 = mbt_ffi_malloc( + let address82 = mbt_ffi_malloc( iter_elem.value.value_nodes.length() * 32, ) - for index81 = 0 - index81 < iter_elem.value.value_nodes.length() - index81 = index81 + 1 { - let iter_elem : @types.SchemaValueNode = iter_elem.value.value_nodes[index81] - let iter_base = address80 + index81 * 32 + for index83 = 0 + index83 < iter_elem.value.value_nodes.length() + index83 = index83 + 1 { + let iter_elem : @types.SchemaValueNode = iter_elem.value.value_nodes[index83] + let iter_base = address82 + index83 * 32 match iter_elem { BoolValue(payload11) => { @@ -1579,18 +1579,26 @@ pub fn enrich_oplog_entries( let @types.QuotaToken(handle79) = payload78 mbt_ffi_store32(iter_base + 8, handle79) + () + } + StreamValue(payload80) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle81) = payload80 + mbt_ffi_store32(iter_base + 8, handle81) + () } } } mbt_ffi_store32(iter_base + 12, iter_elem.value.value_nodes.length()) - mbt_ffi_store32(iter_base + 8, address80) + mbt_ffi_store32(iter_base + 8, address82) mbt_ffi_store32(iter_base + 16, iter_elem.value.root) cleanup_list.push(address9) - cleanup_list.push(address80) + cleanup_list.push(address82) } mbt_ffi_store32(iter_base + 172, payload.local_agent_config.length()) - mbt_ffi_store32(iter_base + 168, address82) + mbt_ffi_store32(iter_base + 168, address84) match payload.original_phantom_id { None => { @@ -1598,15 +1606,15 @@ pub fn enrich_oplog_entries( () } - Some(payload85) => { + Some(payload87) => { mbt_ffi_store8(iter_base + 176, 1) mbt_ffi_store64( iter_base + 184, - payload85.high_bits.reinterpret_as_int64(), + payload87.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 192, - payload85.low_bits.reinterpret_as_int64(), + payload87.low_bits.reinterpret_as_int64(), ) () @@ -1623,108 +1631,108 @@ pub fn enrich_oplog_entries( cleanup_list.push(ptr0) cleanup_list.push(address) cleanup_list.push(address6) - cleanup_list.push(address82) + cleanup_list.push(address84) () } - Start(payload86) => { + Start(payload88) => { mbt_ffi_store8(iter_base + 8, 1) - mbt_ffi_store64(iter_base + 16, payload86.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload88.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload86.timestamp.nanoseconds.reinterpret_as_int(), + payload88.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload86.parent_start_index { + match payload88.parent_start_index { None => { mbt_ffi_store8(iter_base + 32, 0) () } - Some(payload88) => { + Some(payload90) => { mbt_ffi_store8(iter_base + 32, 1) - mbt_ffi_store64(iter_base + 40, payload88.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 40, payload90.reinterpret_as_int64()) () } } - let ptr89 = mbt_ffi_str2ptr(payload86.function_name) - mbt_ffi_store32(iter_base + 52, payload86.function_name.length()) - mbt_ffi_store32(iter_base + 48, ptr89) + let ptr91 = mbt_ffi_str2ptr(payload88.function_name) + mbt_ffi_store32(iter_base + 52, payload88.function_name.length()) + mbt_ffi_store32(iter_base + 48, ptr91) - match payload86.invocation_id { + match payload88.invocation_id { None => { mbt_ffi_store8(iter_base + 56, 0) () } - Some(payload91) => { + Some(payload93) => { mbt_ffi_store8(iter_base + 56, 1) mbt_ffi_store64( iter_base + 64, - payload91.high_bits.reinterpret_as_int64(), + payload93.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 72, - payload91.low_bits.reinterpret_as_int64(), + payload93.low_bits.reinterpret_as_int64(), ) () } } - match payload86.observational_owner { + match payload88.observational_owner { None => { mbt_ffi_store8(iter_base + 80, 0) () } - Some(payload93) => { + Some(payload95) => { mbt_ffi_store8(iter_base + 80, 1) - mbt_ffi_store64(iter_base + 88, payload93.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 88, payload95.reinterpret_as_int64()) () } } - match payload86.request { + match payload88.request { None => { mbt_ffi_store8(iter_base + 96, 0) () } - Some(payload95) => { + Some(payload97) => { mbt_ffi_store8(iter_base + 96, 1) - match payload95 { - Inline(payload96) => { + match payload97 { + Inline(payload98) => { mbt_ffi_store8(iter_base + 104, 0) - let ptr97 = mbt_ffi_bytes2ptr(payload96) + let ptr99 = mbt_ffi_bytes2ptr(payload98) - mbt_ffi_store32(iter_base + 116, payload96.length()) - mbt_ffi_store32(iter_base + 112, ptr97) - cleanup_list.push(ptr97) + mbt_ffi_store32(iter_base + 116, payload98.length()) + mbt_ffi_store32(iter_base + 112, ptr99) + cleanup_list.push(ptr99) () } - External(payload98) => { + External(payload100) => { mbt_ffi_store8(iter_base + 104, 1) mbt_ffi_store64( iter_base + 112, - payload98.payload_id.high_bits.reinterpret_as_int64(), + payload100.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 120, - payload98.payload_id.low_bits.reinterpret_as_int64(), + payload100.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr99 = mbt_ffi_bytes2ptr(payload98.md5_hash) + let ptr101 = mbt_ffi_bytes2ptr(payload100.md5_hash) - mbt_ffi_store32(iter_base + 132, payload98.md5_hash.length()) - mbt_ffi_store32(iter_base + 128, ptr99) - cleanup_list.push(ptr99) + mbt_ffi_store32(iter_base + 132, payload100.md5_hash.length()) + mbt_ffi_store32(iter_base + 128, ptr101) + cleanup_list.push(ptr101) () } @@ -1734,7 +1742,7 @@ pub fn enrich_oplog_entries( } } - match payload86.durable_function_type { + match payload88.durable_function_type { ReadLocal => { mbt_ffi_store8(iter_base + 136, 0) @@ -1755,20 +1763,20 @@ pub fn enrich_oplog_entries( () } - WriteRemoteBatched(payload104) => { + WriteRemoteBatched(payload106) => { mbt_ffi_store8(iter_base + 136, 4) - match payload104 { + match payload106 { None => { mbt_ffi_store8(iter_base + 144, 0) () } - Some(payload106) => { + Some(payload108) => { mbt_ffi_store8(iter_base + 144, 1) mbt_ffi_store64( iter_base + 152, - payload106.reinterpret_as_int64(), + payload108.reinterpret_as_int64(), ) () @@ -1777,20 +1785,20 @@ pub fn enrich_oplog_entries( () } - WriteRemoteTransaction(payload107) => { + WriteRemoteTransaction(payload109) => { mbt_ffi_store8(iter_base + 136, 5) - match payload107 { + match payload109 { None => { mbt_ffi_store8(iter_base + 144, 0) () } - Some(payload109) => { + Some(payload111) => { mbt_ffi_store8(iter_base + 144, 1) mbt_ffi_store64( iter_base + 152, - payload109.reinterpret_as_int64(), + payload111.reinterpret_as_int64(), ) () @@ -1800,59 +1808,59 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr89) + cleanup_list.push(ptr91) () } - End(payload110) => { + End(payload112) => { mbt_ffi_store8(iter_base + 8, 2) - mbt_ffi_store64(iter_base + 16, payload110.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload112.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload110.timestamp.nanoseconds.reinterpret_as_int(), + payload112.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload110.start_index.reinterpret_as_int64(), + payload112.start_index.reinterpret_as_int64(), ) - match payload110.response { + match payload112.response { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload112) => { + Some(payload114) => { mbt_ffi_store8(iter_base + 40, 1) - match payload112 { - Inline(payload113) => { + match payload114 { + Inline(payload115) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr114 = mbt_ffi_bytes2ptr(payload113) + let ptr116 = mbt_ffi_bytes2ptr(payload115) - mbt_ffi_store32(iter_base + 60, payload113.length()) - mbt_ffi_store32(iter_base + 56, ptr114) - cleanup_list.push(ptr114) + mbt_ffi_store32(iter_base + 60, payload115.length()) + mbt_ffi_store32(iter_base + 56, ptr116) + cleanup_list.push(ptr116) () } - External(payload115) => { + External(payload117) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload115.payload_id.high_bits.reinterpret_as_int64(), + payload117.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 64, - payload115.payload_id.low_bits.reinterpret_as_int64(), + payload117.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr116 = mbt_ffi_bytes2ptr(payload115.md5_hash) + let ptr118 = mbt_ffi_bytes2ptr(payload117.md5_hash) - mbt_ffi_store32(iter_base + 76, payload115.md5_hash.length()) - mbt_ffi_store32(iter_base + 72, ptr116) - cleanup_list.push(ptr116) + mbt_ffi_store32(iter_base + 76, payload117.md5_hash.length()) + mbt_ffi_store32(iter_base + 72, ptr118) + cleanup_list.push(ptr118) () } @@ -1863,7 +1871,7 @@ pub fn enrich_oplog_entries( } mbt_ffi_store8( iter_base + 80, - if payload110.forced_commit { + if payload112.forced_commit { 1 } else { 0 @@ -1872,55 +1880,55 @@ pub fn enrich_oplog_entries( () } - Cancelled(payload117) => { + Cancelled(payload119) => { mbt_ffi_store8(iter_base + 8, 3) - mbt_ffi_store64(iter_base + 16, payload117.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload119.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload117.timestamp.nanoseconds.reinterpret_as_int(), + payload119.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload117.start_index.reinterpret_as_int64(), + payload119.start_index.reinterpret_as_int64(), ) - match payload117.partial { + match payload119.partial { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload119) => { + Some(payload121) => { mbt_ffi_store8(iter_base + 40, 1) - match payload119 { - Inline(payload120) => { + match payload121 { + Inline(payload122) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr121 = mbt_ffi_bytes2ptr(payload120) + let ptr123 = mbt_ffi_bytes2ptr(payload122) - mbt_ffi_store32(iter_base + 60, payload120.length()) - mbt_ffi_store32(iter_base + 56, ptr121) - cleanup_list.push(ptr121) + mbt_ffi_store32(iter_base + 60, payload122.length()) + mbt_ffi_store32(iter_base + 56, ptr123) + cleanup_list.push(ptr123) () } - External(payload122) => { + External(payload124) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload122.payload_id.high_bits.reinterpret_as_int64(), + payload124.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 64, - payload122.payload_id.low_bits.reinterpret_as_int64(), + payload124.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr123 = mbt_ffi_bytes2ptr(payload122.md5_hash) + let ptr125 = mbt_ffi_bytes2ptr(payload124.md5_hash) - mbt_ffi_store32(iter_base + 76, payload122.md5_hash.length()) - mbt_ffi_store32(iter_base + 72, ptr123) - cleanup_list.push(ptr123) + mbt_ffi_store32(iter_base + 76, payload124.md5_hash.length()) + mbt_ffi_store32(iter_base + 72, ptr125) + cleanup_list.push(ptr125) () } @@ -1932,292 +1940,292 @@ pub fn enrich_oplog_entries( () } - AgentInvocationStarted(payload124) => { + AgentInvocationStarted(payload126) => { mbt_ffi_store8(iter_base + 8, 4) - mbt_ffi_store64(iter_base + 16, payload124.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload126.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload124.timestamp.nanoseconds.reinterpret_as_int(), + payload126.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr125 = mbt_ffi_str2ptr(payload124.idempotency_key) - mbt_ffi_store32(iter_base + 36, payload124.idempotency_key.length()) - mbt_ffi_store32(iter_base + 32, ptr125) + let ptr127 = mbt_ffi_str2ptr(payload126.idempotency_key) + mbt_ffi_store32(iter_base + 36, payload126.idempotency_key.length()) + mbt_ffi_store32(iter_base + 32, ptr127) - match payload124.payload { - Inline(payload126) => { + match payload126.payload { + Inline(payload128) => { mbt_ffi_store8(iter_base + 40, 0) - let ptr127 = mbt_ffi_bytes2ptr(payload126) + let ptr129 = mbt_ffi_bytes2ptr(payload128) - mbt_ffi_store32(iter_base + 52, payload126.length()) - mbt_ffi_store32(iter_base + 48, ptr127) - cleanup_list.push(ptr127) + mbt_ffi_store32(iter_base + 52, payload128.length()) + mbt_ffi_store32(iter_base + 48, ptr129) + cleanup_list.push(ptr129) () } - External(payload128) => { + External(payload130) => { mbt_ffi_store8(iter_base + 40, 1) mbt_ffi_store64( iter_base + 48, - payload128.payload_id.high_bits.reinterpret_as_int64(), + payload130.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 56, - payload128.payload_id.low_bits.reinterpret_as_int64(), + payload130.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr129 = mbt_ffi_bytes2ptr(payload128.md5_hash) + let ptr131 = mbt_ffi_bytes2ptr(payload130.md5_hash) - mbt_ffi_store32(iter_base + 68, payload128.md5_hash.length()) - mbt_ffi_store32(iter_base + 64, ptr129) - cleanup_list.push(ptr129) + mbt_ffi_store32(iter_base + 68, payload130.md5_hash.length()) + mbt_ffi_store32(iter_base + 64, ptr131) + cleanup_list.push(ptr131) () } } - let ptr130 = mbt_ffi_str2ptr(payload124.trace_id) - mbt_ffi_store32(iter_base + 76, payload124.trace_id.length()) - mbt_ffi_store32(iter_base + 72, ptr130) + let ptr132 = mbt_ffi_str2ptr(payload126.trace_id) + mbt_ffi_store32(iter_base + 76, payload126.trace_id.length()) + mbt_ffi_store32(iter_base + 72, ptr132) - let address132 = mbt_ffi_malloc(payload124.trace_states.length() * 8) - for index133 = 0 - index133 < payload124.trace_states.length() - index133 = index133 + 1 { - let iter_elem : String = payload124.trace_states[index133] - let iter_base = address132 + index133 * 8 + let address134 = mbt_ffi_malloc(payload126.trace_states.length() * 8) + for index135 = 0 + index135 < payload126.trace_states.length() + index135 = index135 + 1 { + let iter_elem : String = payload126.trace_states[index135] + let iter_base = address134 + index135 * 8 - let ptr131 = mbt_ffi_str2ptr(iter_elem) + let ptr133 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr131) - cleanup_list.push(ptr131) + mbt_ffi_store32(iter_base + 0, ptr133) + cleanup_list.push(ptr133) } - mbt_ffi_store32(iter_base + 84, payload124.trace_states.length()) - mbt_ffi_store32(iter_base + 80, address132) + mbt_ffi_store32(iter_base + 84, payload126.trace_states.length()) + mbt_ffi_store32(iter_base + 80, address134) - let address148 = mbt_ffi_malloc( - payload124.invocation_context.length() * 80, + let address150 = mbt_ffi_malloc( + payload126.invocation_context.length() * 80, ) - for index149 = 0 - index149 < payload124.invocation_context.length() - index149 = index149 + 1 { - let iter_elem : SpanData = payload124.invocation_context[index149] - let iter_base = address148 + index149 * 80 + for index151 = 0 + index151 < payload126.invocation_context.length() + index151 = index151 + 1 { + let iter_elem : SpanData = payload126.invocation_context[index151] + let iter_base = address150 + index151 * 80 match iter_elem { - LocalSpan(payload134) => { + LocalSpan(payload136) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr135 = mbt_ffi_str2ptr(payload134.span_id) - mbt_ffi_store32(iter_base + 12, payload134.span_id.length()) - mbt_ffi_store32(iter_base + 8, ptr135) - mbt_ffi_store64(iter_base + 16, payload134.start.seconds) + let ptr137 = mbt_ffi_str2ptr(payload136.span_id) + mbt_ffi_store32(iter_base + 12, payload136.span_id.length()) + mbt_ffi_store32(iter_base + 8, ptr137) + mbt_ffi_store64(iter_base + 16, payload136.start.seconds) mbt_ffi_store32( iter_base + 24, - payload134.start.nanoseconds.reinterpret_as_int(), + payload136.start.nanoseconds.reinterpret_as_int(), ) - match payload134.parent { + match payload136.parent { None => { mbt_ffi_store8(iter_base + 32, 0) () } - Some(payload137) => { + Some(payload139) => { mbt_ffi_store8(iter_base + 32, 1) - let ptr138 = mbt_ffi_str2ptr(payload137) - mbt_ffi_store32(iter_base + 40, payload137.length()) - mbt_ffi_store32(iter_base + 36, ptr138) - cleanup_list.push(ptr138) + let ptr140 = mbt_ffi_str2ptr(payload139) + mbt_ffi_store32(iter_base + 40, payload139.length()) + mbt_ffi_store32(iter_base + 36, ptr140) + cleanup_list.push(ptr140) () } } - match payload134.linked_context { + match payload136.linked_context { None => { mbt_ffi_store8(iter_base + 48, 0) () } - Some(payload140) => { + Some(payload142) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload140.reinterpret_as_int64(), + payload142.reinterpret_as_int64(), ) () } } - let address144 = mbt_ffi_malloc( - payload134.attributes.length() * 20, + let address146 = mbt_ffi_malloc( + payload136.attributes.length() * 20, ) - for index145 = 0 - index145 < payload134.attributes.length() - index145 = index145 + 1 { - let iter_elem : @context.Attribute = payload134.attributes[index145] - let iter_base = address144 + index145 * 20 + for index147 = 0 + index147 < payload136.attributes.length() + index147 = index147 + 1 { + let iter_elem : @context.Attribute = payload136.attributes[index147] + let iter_base = address146 + index147 * 20 - let ptr141 = mbt_ffi_str2ptr(iter_elem.key) + let ptr143 = mbt_ffi_str2ptr(iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.key.length()) - mbt_ffi_store32(iter_base + 0, ptr141) + mbt_ffi_store32(iter_base + 0, ptr143) match iter_elem.value { - String(payload142) => { + String(payload144) => { mbt_ffi_store8(iter_base + 8, 0) - let ptr143 = mbt_ffi_str2ptr(payload142) - mbt_ffi_store32(iter_base + 16, payload142.length()) - mbt_ffi_store32(iter_base + 12, ptr143) - cleanup_list.push(ptr143) + let ptr145 = mbt_ffi_str2ptr(payload144) + mbt_ffi_store32(iter_base + 16, payload144.length()) + mbt_ffi_store32(iter_base + 12, ptr145) + cleanup_list.push(ptr145) () } } - cleanup_list.push(ptr141) + cleanup_list.push(ptr143) } - mbt_ffi_store32(iter_base + 68, payload134.attributes.length()) - mbt_ffi_store32(iter_base + 64, address144) + mbt_ffi_store32(iter_base + 68, payload136.attributes.length()) + mbt_ffi_store32(iter_base + 64, address146) mbt_ffi_store8( iter_base + 72, - if payload134.inherited { + if payload136.inherited { 1 } else { 0 }, ) - cleanup_list.push(ptr135) - cleanup_list.push(address144) + cleanup_list.push(ptr137) + cleanup_list.push(address146) () } - ExternalSpan(payload146) => { + ExternalSpan(payload148) => { mbt_ffi_store8(iter_base + 0, 1) - let ptr147 = mbt_ffi_str2ptr(payload146.span_id) - mbt_ffi_store32(iter_base + 12, payload146.span_id.length()) - mbt_ffi_store32(iter_base + 8, ptr147) - cleanup_list.push(ptr147) + let ptr149 = mbt_ffi_str2ptr(payload148.span_id) + mbt_ffi_store32(iter_base + 12, payload148.span_id.length()) + mbt_ffi_store32(iter_base + 8, ptr149) + cleanup_list.push(ptr149) () } } } - mbt_ffi_store32(iter_base + 92, payload124.invocation_context.length()) - mbt_ffi_store32(iter_base + 88, address148) - cleanup_list.push(ptr125) - cleanup_list.push(ptr130) - cleanup_list.push(address132) - cleanup_list.push(address148) + mbt_ffi_store32(iter_base + 92, payload126.invocation_context.length()) + mbt_ffi_store32(iter_base + 88, address150) + cleanup_list.push(ptr127) + cleanup_list.push(ptr132) + cleanup_list.push(address134) + cleanup_list.push(address150) () } - AgentInvocationFinished(payload150) => { + AgentInvocationFinished(payload152) => { mbt_ffi_store8(iter_base + 8, 5) - mbt_ffi_store64(iter_base + 16, payload150.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload152.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload150.timestamp.nanoseconds.reinterpret_as_int(), + payload152.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload150.result { - Inline(payload151) => { + match payload152.result { + Inline(payload153) => { mbt_ffi_store8(iter_base + 32, 0) - let ptr152 = mbt_ffi_bytes2ptr(payload151) + let ptr154 = mbt_ffi_bytes2ptr(payload153) - mbt_ffi_store32(iter_base + 44, payload151.length()) - mbt_ffi_store32(iter_base + 40, ptr152) - cleanup_list.push(ptr152) + mbt_ffi_store32(iter_base + 44, payload153.length()) + mbt_ffi_store32(iter_base + 40, ptr154) + cleanup_list.push(ptr154) () } - External(payload153) => { + External(payload155) => { mbt_ffi_store8(iter_base + 32, 1) mbt_ffi_store64( iter_base + 40, - payload153.payload_id.high_bits.reinterpret_as_int64(), + payload155.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload153.payload_id.low_bits.reinterpret_as_int64(), + payload155.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr154 = mbt_ffi_bytes2ptr(payload153.md5_hash) + let ptr156 = mbt_ffi_bytes2ptr(payload155.md5_hash) - mbt_ffi_store32(iter_base + 60, payload153.md5_hash.length()) - mbt_ffi_store32(iter_base + 56, ptr154) - cleanup_list.push(ptr154) + mbt_ffi_store32(iter_base + 60, payload155.md5_hash.length()) + mbt_ffi_store32(iter_base + 56, ptr156) + cleanup_list.push(ptr156) () } } - match payload150.method_name { + match payload152.method_name { None => { mbt_ffi_store8(iter_base + 64, 0) () } - Some(payload156) => { + Some(payload158) => { mbt_ffi_store8(iter_base + 64, 1) - let ptr157 = mbt_ffi_str2ptr(payload156) - mbt_ffi_store32(iter_base + 72, payload156.length()) - mbt_ffi_store32(iter_base + 68, ptr157) - cleanup_list.push(ptr157) + let ptr159 = mbt_ffi_str2ptr(payload158) + mbt_ffi_store32(iter_base + 72, payload158.length()) + mbt_ffi_store32(iter_base + 68, ptr159) + cleanup_list.push(ptr159) () } } - mbt_ffi_store64(iter_base + 80, payload150.consumed_fuel) + mbt_ffi_store64(iter_base + 80, payload152.consumed_fuel) mbt_ffi_store64( iter_base + 88, - payload150.component_revision.reinterpret_as_int64(), + payload152.component_revision.reinterpret_as_int64(), ) () } - Suspend(payload158) => { + Suspend(payload160) => { mbt_ffi_store8(iter_base + 8, 6) - mbt_ffi_store64(iter_base + 16, payload158.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload160.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload158.timestamp.nanoseconds.reinterpret_as_int(), + payload160.timestamp.nanoseconds.reinterpret_as_int(), ) () } - Error(payload159) => { + Error(payload161) => { mbt_ffi_store8(iter_base + 8, 7) - mbt_ffi_store64(iter_base + 16, payload159.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload161.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload159.timestamp.nanoseconds.reinterpret_as_int(), + payload161.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload159.error { - Unknown(payload160) => { + match payload161.error { + Unknown(payload162) => { mbt_ffi_store8(iter_base + 32, 0) - let ptr161 = mbt_ffi_str2ptr(payload160) - mbt_ffi_store32(iter_base + 44, payload160.length()) - mbt_ffi_store32(iter_base + 40, ptr161) - cleanup_list.push(ptr161) + let ptr163 = mbt_ffi_str2ptr(payload162) + mbt_ffi_store32(iter_base + 44, payload162.length()) + mbt_ffi_store32(iter_base + 40, ptr163) + cleanup_list.push(ptr163) () } - InvalidRequest(payload162) => { + InvalidRequest(payload164) => { mbt_ffi_store8(iter_base + 32, 1) - let ptr163 = mbt_ffi_str2ptr(payload162) - mbt_ffi_store32(iter_base + 44, payload162.length()) - mbt_ffi_store32(iter_base + 40, ptr163) - cleanup_list.push(ptr163) + let ptr165 = mbt_ffi_str2ptr(payload164) + mbt_ffi_store32(iter_base + 44, payload164.length()) + mbt_ffi_store32(iter_base + 40, ptr165) + cleanup_list.push(ptr165) () } @@ -2236,19 +2244,9 @@ pub fn enrich_oplog_entries( () } - InternalError(payload167) => { + InternalError(payload169) => { mbt_ffi_store8(iter_base + 32, 5) - let ptr168 = mbt_ffi_str2ptr(payload167) - mbt_ffi_store32(iter_base + 44, payload167.length()) - mbt_ffi_store32(iter_base + 40, ptr168) - cleanup_list.push(ptr168) - - () - } - DeterministicTrap(payload169) => { - mbt_ffi_store8(iter_base + 32, 6) - let ptr170 = mbt_ffi_str2ptr(payload169) mbt_ffi_store32(iter_base + 44, payload169.length()) mbt_ffi_store32(iter_base + 40, ptr170) @@ -2256,8 +2254,8 @@ pub fn enrich_oplog_entries( () } - TransientError(payload171) => { - mbt_ffi_store8(iter_base + 32, 7) + DeterministicTrap(payload171) => { + mbt_ffi_store8(iter_base + 32, 6) let ptr172 = mbt_ffi_str2ptr(payload171) mbt_ffi_store32(iter_base + 44, payload171.length()) @@ -2266,8 +2264,8 @@ pub fn enrich_oplog_entries( () } - PermanentError(payload173) => { - mbt_ffi_store8(iter_base + 32, 8) + TransientError(payload173) => { + mbt_ffi_store8(iter_base + 32, 7) let ptr174 = mbt_ffi_str2ptr(payload173) mbt_ffi_store32(iter_base + 44, payload173.length()) @@ -2276,6 +2274,16 @@ pub fn enrich_oplog_entries( () } + PermanentError(payload175) => { + mbt_ffi_store8(iter_base + 32, 8) + + let ptr176 = mbt_ffi_str2ptr(payload175) + mbt_ffi_store32(iter_base + 44, payload175.length()) + mbt_ffi_store32(iter_base + 40, ptr176) + cleanup_list.push(ptr176) + + () + } ExceededTableLimit => { mbt_ffi_store8(iter_base + 32, 9) @@ -2301,107 +2309,107 @@ pub fn enrich_oplog_entries( () } - AgentTerminatedByQuota(payload180) => { + AgentTerminatedByQuota(payload182) => { mbt_ffi_store8(iter_base + 32, 14) mbt_ffi_store64( iter_base + 40, - payload180.environment_id.uuid.high_bits.reinterpret_as_int64(), + payload182.environment_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload180.environment_id.uuid.low_bits.reinterpret_as_int64(), + payload182.environment_id.uuid.low_bits.reinterpret_as_int64(), ) - let ptr181 = mbt_ffi_str2ptr(payload180.resource_name) - mbt_ffi_store32(iter_base + 60, payload180.resource_name.length()) - mbt_ffi_store32(iter_base + 56, ptr181) - cleanup_list.push(ptr181) + let ptr183 = mbt_ffi_str2ptr(payload182.resource_name) + mbt_ffi_store32(iter_base + 60, payload182.resource_name.length()) + mbt_ffi_store32(iter_base + 56, ptr183) + cleanup_list.push(ptr183) () } - EphemeralSleepTooLong(payload182) => { + EphemeralSleepTooLong(payload184) => { mbt_ffi_store8(iter_base + 32, 15) mbt_ffi_store64( iter_base + 40, - payload182.requested_nanos.reinterpret_as_int64(), + payload184.requested_nanos.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload182.max_nanos.reinterpret_as_int64(), + payload184.max_nanos.reinterpret_as_int64(), ) () } - EphemeralFuelExhausted(payload183) => { + EphemeralFuelExhausted(payload185) => { mbt_ffi_store8(iter_base + 32, 16) mbt_ffi_store64( iter_base + 40, - payload183.overdraft_limit.reinterpret_as_int64(), + payload185.overdraft_limit.reinterpret_as_int64(), ) () } - EphemeralCannotSuspend(payload184) => { + EphemeralCannotSuspend(payload186) => { mbt_ffi_store8(iter_base + 32, 17) - let ptr185 = mbt_ffi_str2ptr(payload184.reason) - mbt_ffi_store32(iter_base + 44, payload184.reason.length()) - mbt_ffi_store32(iter_base + 40, ptr185) - cleanup_list.push(ptr185) + let ptr187 = mbt_ffi_str2ptr(payload186.reason) + mbt_ffi_store32(iter_base + 44, payload186.reason.length()) + mbt_ffi_store32(iter_base + 40, ptr187) + cleanup_list.push(ptr187) () } - ReadOnlyViolation(payload186) => { + ReadOnlyViolation(payload188) => { mbt_ffi_store8(iter_base + 32, 18) - let ptr187 = mbt_ffi_str2ptr(payload186.method_) - mbt_ffi_store32(iter_base + 44, payload186.method_.length()) - mbt_ffi_store32(iter_base + 40, ptr187) + let ptr189 = mbt_ffi_str2ptr(payload188.method_) + mbt_ffi_store32(iter_base + 44, payload188.method_.length()) + mbt_ffi_store32(iter_base + 40, ptr189) - let ptr188 = mbt_ffi_str2ptr(payload186.host_function) - mbt_ffi_store32(iter_base + 52, payload186.host_function.length()) - mbt_ffi_store32(iter_base + 48, ptr188) - cleanup_list.push(ptr187) - cleanup_list.push(ptr188) + let ptr190 = mbt_ffi_str2ptr(payload188.host_function) + mbt_ffi_store32(iter_base + 52, payload188.host_function.length()) + mbt_ffi_store32(iter_base + 48, ptr190) + cleanup_list.push(ptr189) + cleanup_list.push(ptr190) () } } mbt_ffi_store64( iter_base + 64, - payload159.retry_from.reinterpret_as_int64(), + payload161.retry_from.reinterpret_as_int64(), ) mbt_ffi_store8( iter_base + 72, - if payload159.inside_atomic_region { + if payload161.inside_atomic_region { 1 } else { 0 }, ) - match payload159.retry_policy_state { + match payload161.retry_policy_state { None => { mbt_ffi_store8(iter_base + 76, 0) () } - Some(payload190) => { + Some(payload192) => { mbt_ffi_store8(iter_base + 76, 1) - let address197 = mbt_ffi_malloc(payload190.nodes.length() * 16) - for index198 = 0 - index198 < payload190.nodes.length() - index198 = index198 + 1 { - let iter_elem : StateNode = payload190.nodes[index198] - let iter_base = address197 + index198 * 16 + let address199 = mbt_ffi_malloc(payload192.nodes.length() * 16) + for index200 = 0 + index200 < payload192.nodes.length() + index200 = index200 + 1 { + let iter_elem : StateNode = payload192.nodes[index200] + let iter_base = address199 + index200 * 16 match iter_elem { - Counter(payload191) => { + Counter(payload193) => { mbt_ffi_store8(iter_base + 0, 0) mbt_ffi_store32( iter_base + 4, - payload191.reinterpret_as_int(), + payload193.reinterpret_as_int(), ) () @@ -2411,29 +2419,29 @@ pub fn enrich_oplog_entries( () } - Wrapper(payload193) => { + Wrapper(payload195) => { mbt_ffi_store8(iter_base + 0, 2) - mbt_ffi_store32(iter_base + 4, payload193) + mbt_ffi_store32(iter_base + 4, payload195) () } - CountBox(payload194) => { + CountBox(payload196) => { mbt_ffi_store8(iter_base + 0, 3) mbt_ffi_store32( iter_base + 4, - payload194.attempts.reinterpret_as_int(), + payload196.attempts.reinterpret_as_int(), ) - mbt_ffi_store32(iter_base + 8, payload194.inner) + mbt_ffi_store32(iter_base + 8, payload196.inner) () } - AndThen(payload195) => { + AndThen(payload197) => { mbt_ffi_store8(iter_base + 0, 4) - mbt_ffi_store32(iter_base + 4, payload195.left) - mbt_ffi_store32(iter_base + 8, payload195.right) + mbt_ffi_store32(iter_base + 4, payload197.left) + mbt_ffi_store32(iter_base + 8, payload197.right) mbt_ffi_store8( iter_base + 12, - if payload195.on_right { + if payload197.on_right { 1 } else { 0 @@ -2442,18 +2450,18 @@ pub fn enrich_oplog_entries( () } - Pair(payload196) => { + Pair(payload198) => { mbt_ffi_store8(iter_base + 0, 5) - mbt_ffi_store32(iter_base + 4, payload196.left) - mbt_ffi_store32(iter_base + 8, payload196.right) + mbt_ffi_store32(iter_base + 4, payload198.left) + mbt_ffi_store32(iter_base + 8, payload198.right) () } } } - mbt_ffi_store32(iter_base + 84, payload190.nodes.length()) - mbt_ffi_store32(iter_base + 80, address197) - cleanup_list.push(address197) + mbt_ffi_store32(iter_base + 84, payload192.nodes.length()) + mbt_ffi_store32(iter_base + 80, address199) + cleanup_list.push(address199) () } @@ -2461,321 +2469,321 @@ pub fn enrich_oplog_entries( () } - NoOp(payload199) => { + NoOp(payload201) => { mbt_ffi_store8(iter_base + 8, 8) - mbt_ffi_store64(iter_base + 16, payload199.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload201.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload199.timestamp.nanoseconds.reinterpret_as_int(), + payload201.timestamp.nanoseconds.reinterpret_as_int(), ) () } - Jump(payload200) => { + Jump(payload202) => { mbt_ffi_store8(iter_base + 8, 9) - mbt_ffi_store64(iter_base + 16, payload200.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload202.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload200.timestamp.nanoseconds.reinterpret_as_int(), + payload202.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload200.jump.start.reinterpret_as_int64(), + payload202.jump.start.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload200.jump.end.reinterpret_as_int64(), + payload202.jump.end.reinterpret_as_int64(), ) () } - Interrupted(payload201) => { + Interrupted(payload203) => { mbt_ffi_store8(iter_base + 8, 10) - mbt_ffi_store64(iter_base + 16, payload201.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload203.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload201.timestamp.nanoseconds.reinterpret_as_int(), + payload203.timestamp.nanoseconds.reinterpret_as_int(), ) () } - Exited(payload202) => { + Exited(payload204) => { mbt_ffi_store8(iter_base + 8, 11) - mbt_ffi_store64(iter_base + 16, payload202.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload204.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload202.timestamp.nanoseconds.reinterpret_as_int(), + payload204.timestamp.nanoseconds.reinterpret_as_int(), ) () } - BeginAtomicRegion(payload203) => { + BeginAtomicRegion(payload205) => { mbt_ffi_store8(iter_base + 8, 12) - mbt_ffi_store64(iter_base + 16, payload203.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload205.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload203.timestamp.nanoseconds.reinterpret_as_int(), + payload205.timestamp.nanoseconds.reinterpret_as_int(), ) () } - EndAtomicRegion(payload204) => { + EndAtomicRegion(payload206) => { mbt_ffi_store8(iter_base + 8, 13) - mbt_ffi_store64(iter_base + 16, payload204.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload206.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload204.timestamp.nanoseconds.reinterpret_as_int(), + payload206.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload204.begin_index.reinterpret_as_int64(), + payload206.begin_index.reinterpret_as_int64(), ) () } - PendingAgentInvocation(payload205) => { + PendingAgentInvocation(payload207) => { mbt_ffi_store8(iter_base + 8, 14) - mbt_ffi_store64(iter_base + 16, payload205.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload207.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload205.timestamp.nanoseconds.reinterpret_as_int(), + payload207.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr206 = mbt_ffi_str2ptr(payload205.idempotency_key) - mbt_ffi_store32(iter_base + 36, payload205.idempotency_key.length()) - mbt_ffi_store32(iter_base + 32, ptr206) + let ptr208 = mbt_ffi_str2ptr(payload207.idempotency_key) + mbt_ffi_store32(iter_base + 36, payload207.idempotency_key.length()) + mbt_ffi_store32(iter_base + 32, ptr208) - match payload205.payload { - Inline(payload207) => { + match payload207.payload { + Inline(payload209) => { mbt_ffi_store8(iter_base + 40, 0) - let ptr208 = mbt_ffi_bytes2ptr(payload207) + let ptr210 = mbt_ffi_bytes2ptr(payload209) - mbt_ffi_store32(iter_base + 52, payload207.length()) - mbt_ffi_store32(iter_base + 48, ptr208) - cleanup_list.push(ptr208) + mbt_ffi_store32(iter_base + 52, payload209.length()) + mbt_ffi_store32(iter_base + 48, ptr210) + cleanup_list.push(ptr210) () } - External(payload209) => { + External(payload211) => { mbt_ffi_store8(iter_base + 40, 1) mbt_ffi_store64( iter_base + 48, - payload209.payload_id.high_bits.reinterpret_as_int64(), + payload211.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 56, - payload209.payload_id.low_bits.reinterpret_as_int64(), + payload211.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr210 = mbt_ffi_bytes2ptr(payload209.md5_hash) + let ptr212 = mbt_ffi_bytes2ptr(payload211.md5_hash) - mbt_ffi_store32(iter_base + 68, payload209.md5_hash.length()) - mbt_ffi_store32(iter_base + 64, ptr210) - cleanup_list.push(ptr210) + mbt_ffi_store32(iter_base + 68, payload211.md5_hash.length()) + mbt_ffi_store32(iter_base + 64, ptr212) + cleanup_list.push(ptr212) () } } - let ptr211 = mbt_ffi_str2ptr(payload205.trace_id) - mbt_ffi_store32(iter_base + 76, payload205.trace_id.length()) - mbt_ffi_store32(iter_base + 72, ptr211) + let ptr213 = mbt_ffi_str2ptr(payload207.trace_id) + mbt_ffi_store32(iter_base + 76, payload207.trace_id.length()) + mbt_ffi_store32(iter_base + 72, ptr213) - let address213 = mbt_ffi_malloc(payload205.trace_states.length() * 8) - for index214 = 0 - index214 < payload205.trace_states.length() - index214 = index214 + 1 { - let iter_elem : String = payload205.trace_states[index214] - let iter_base = address213 + index214 * 8 + let address215 = mbt_ffi_malloc(payload207.trace_states.length() * 8) + for index216 = 0 + index216 < payload207.trace_states.length() + index216 = index216 + 1 { + let iter_elem : String = payload207.trace_states[index216] + let iter_base = address215 + index216 * 8 - let ptr212 = mbt_ffi_str2ptr(iter_elem) + let ptr214 = mbt_ffi_str2ptr(iter_elem) mbt_ffi_store32(iter_base + 4, iter_elem.length()) - mbt_ffi_store32(iter_base + 0, ptr212) - cleanup_list.push(ptr212) + mbt_ffi_store32(iter_base + 0, ptr214) + cleanup_list.push(ptr214) } - mbt_ffi_store32(iter_base + 84, payload205.trace_states.length()) - mbt_ffi_store32(iter_base + 80, address213) + mbt_ffi_store32(iter_base + 84, payload207.trace_states.length()) + mbt_ffi_store32(iter_base + 80, address215) - let address229 = mbt_ffi_malloc( - payload205.invocation_context.length() * 80, + let address231 = mbt_ffi_malloc( + payload207.invocation_context.length() * 80, ) - for index230 = 0 - index230 < payload205.invocation_context.length() - index230 = index230 + 1 { - let iter_elem : SpanData = payload205.invocation_context[index230] - let iter_base = address229 + index230 * 80 + for index232 = 0 + index232 < payload207.invocation_context.length() + index232 = index232 + 1 { + let iter_elem : SpanData = payload207.invocation_context[index232] + let iter_base = address231 + index232 * 80 match iter_elem { - LocalSpan(payload215) => { + LocalSpan(payload217) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr216 = mbt_ffi_str2ptr(payload215.span_id) - mbt_ffi_store32(iter_base + 12, payload215.span_id.length()) - mbt_ffi_store32(iter_base + 8, ptr216) - mbt_ffi_store64(iter_base + 16, payload215.start.seconds) + let ptr218 = mbt_ffi_str2ptr(payload217.span_id) + mbt_ffi_store32(iter_base + 12, payload217.span_id.length()) + mbt_ffi_store32(iter_base + 8, ptr218) + mbt_ffi_store64(iter_base + 16, payload217.start.seconds) mbt_ffi_store32( iter_base + 24, - payload215.start.nanoseconds.reinterpret_as_int(), + payload217.start.nanoseconds.reinterpret_as_int(), ) - match payload215.parent { + match payload217.parent { None => { mbt_ffi_store8(iter_base + 32, 0) () } - Some(payload218) => { + Some(payload220) => { mbt_ffi_store8(iter_base + 32, 1) - let ptr219 = mbt_ffi_str2ptr(payload218) - mbt_ffi_store32(iter_base + 40, payload218.length()) - mbt_ffi_store32(iter_base + 36, ptr219) - cleanup_list.push(ptr219) + let ptr221 = mbt_ffi_str2ptr(payload220) + mbt_ffi_store32(iter_base + 40, payload220.length()) + mbt_ffi_store32(iter_base + 36, ptr221) + cleanup_list.push(ptr221) () } } - match payload215.linked_context { + match payload217.linked_context { None => { mbt_ffi_store8(iter_base + 48, 0) () } - Some(payload221) => { + Some(payload223) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload221.reinterpret_as_int64(), + payload223.reinterpret_as_int64(), ) () } } - let address225 = mbt_ffi_malloc( - payload215.attributes.length() * 20, + let address227 = mbt_ffi_malloc( + payload217.attributes.length() * 20, ) - for index226 = 0 - index226 < payload215.attributes.length() - index226 = index226 + 1 { - let iter_elem : @context.Attribute = payload215.attributes[index226] - let iter_base = address225 + index226 * 20 + for index228 = 0 + index228 < payload217.attributes.length() + index228 = index228 + 1 { + let iter_elem : @context.Attribute = payload217.attributes[index228] + let iter_base = address227 + index228 * 20 - let ptr222 = mbt_ffi_str2ptr(iter_elem.key) + let ptr224 = mbt_ffi_str2ptr(iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.key.length()) - mbt_ffi_store32(iter_base + 0, ptr222) + mbt_ffi_store32(iter_base + 0, ptr224) match iter_elem.value { - String(payload223) => { + String(payload225) => { mbt_ffi_store8(iter_base + 8, 0) - let ptr224 = mbt_ffi_str2ptr(payload223) - mbt_ffi_store32(iter_base + 16, payload223.length()) - mbt_ffi_store32(iter_base + 12, ptr224) - cleanup_list.push(ptr224) + let ptr226 = mbt_ffi_str2ptr(payload225) + mbt_ffi_store32(iter_base + 16, payload225.length()) + mbt_ffi_store32(iter_base + 12, ptr226) + cleanup_list.push(ptr226) () } } - cleanup_list.push(ptr222) + cleanup_list.push(ptr224) } - mbt_ffi_store32(iter_base + 68, payload215.attributes.length()) - mbt_ffi_store32(iter_base + 64, address225) + mbt_ffi_store32(iter_base + 68, payload217.attributes.length()) + mbt_ffi_store32(iter_base + 64, address227) mbt_ffi_store8( iter_base + 72, - if payload215.inherited { + if payload217.inherited { 1 } else { 0 }, ) - cleanup_list.push(ptr216) - cleanup_list.push(address225) + cleanup_list.push(ptr218) + cleanup_list.push(address227) () } - ExternalSpan(payload227) => { + ExternalSpan(payload229) => { mbt_ffi_store8(iter_base + 0, 1) - let ptr228 = mbt_ffi_str2ptr(payload227.span_id) - mbt_ffi_store32(iter_base + 12, payload227.span_id.length()) - mbt_ffi_store32(iter_base + 8, ptr228) - cleanup_list.push(ptr228) + let ptr230 = mbt_ffi_str2ptr(payload229.span_id) + mbt_ffi_store32(iter_base + 12, payload229.span_id.length()) + mbt_ffi_store32(iter_base + 8, ptr230) + cleanup_list.push(ptr230) () } } } - mbt_ffi_store32(iter_base + 92, payload205.invocation_context.length()) - mbt_ffi_store32(iter_base + 88, address229) - cleanup_list.push(ptr206) - cleanup_list.push(ptr211) - cleanup_list.push(address213) - cleanup_list.push(address229) + mbt_ffi_store32(iter_base + 92, payload207.invocation_context.length()) + mbt_ffi_store32(iter_base + 88, address231) + cleanup_list.push(ptr208) + cleanup_list.push(ptr213) + cleanup_list.push(address215) + cleanup_list.push(address231) () } - PendingUpdate(payload231) => { + PendingUpdate(payload233) => { mbt_ffi_store8(iter_base + 8, 15) - mbt_ffi_store64(iter_base + 16, payload231.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload233.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload231.timestamp.nanoseconds.reinterpret_as_int(), + payload233.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload231.description { - Automatic(payload232) => { + match payload233.description { + Automatic(payload234) => { mbt_ffi_store8(iter_base + 32, 0) - mbt_ffi_store64(iter_base + 40, payload232.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 40, payload234.reinterpret_as_int64()) () } - SnapshotBased(payload233) => { + SnapshotBased(payload235) => { mbt_ffi_store8(iter_base + 32, 1) mbt_ffi_store64( iter_base + 40, - payload233.target_revision.reinterpret_as_int64(), + payload235.target_revision.reinterpret_as_int64(), ) - match payload233.payload { - Inline(payload234) => { + match payload235.payload { + Inline(payload236) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr235 = mbt_ffi_bytes2ptr(payload234) + let ptr237 = mbt_ffi_bytes2ptr(payload236) - mbt_ffi_store32(iter_base + 60, payload234.length()) - mbt_ffi_store32(iter_base + 56, ptr235) - cleanup_list.push(ptr235) + mbt_ffi_store32(iter_base + 60, payload236.length()) + mbt_ffi_store32(iter_base + 56, ptr237) + cleanup_list.push(ptr237) () } - External(payload236) => { + External(payload238) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload236.payload_id.high_bits.reinterpret_as_int64(), + payload238.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 64, - payload236.payload_id.low_bits.reinterpret_as_int64(), + payload238.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr237 = mbt_ffi_bytes2ptr(payload236.md5_hash) + let ptr239 = mbt_ffi_bytes2ptr(payload238.md5_hash) - mbt_ffi_store32(iter_base + 76, payload236.md5_hash.length()) - mbt_ffi_store32(iter_base + 72, ptr237) - cleanup_list.push(ptr237) + mbt_ffi_store32(iter_base + 76, payload238.md5_hash.length()) + mbt_ffi_store32(iter_base + 72, ptr239) + cleanup_list.push(ptr239) () } } - let ptr238 = mbt_ffi_str2ptr(payload233.mime_type) - mbt_ffi_store32(iter_base + 84, payload233.mime_type.length()) - mbt_ffi_store32(iter_base + 80, ptr238) - cleanup_list.push(ptr238) + let ptr240 = mbt_ffi_str2ptr(payload235.mime_type) + mbt_ffi_store32(iter_base + 84, payload235.mime_type.length()) + mbt_ffi_store32(iter_base + 80, ptr240) + cleanup_list.push(ptr240) () } @@ -2783,30 +2791,30 @@ pub fn enrich_oplog_entries( () } - SuccessfulUpdate(payload239) => { + SuccessfulUpdate(payload241) => { mbt_ffi_store8(iter_base + 8, 16) - mbt_ffi_store64(iter_base + 16, payload239.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload241.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload239.timestamp.nanoseconds.reinterpret_as_int(), + payload241.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload239.target_revision.reinterpret_as_int64(), + payload241.target_revision.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload239.new_component_size.reinterpret_as_int64(), + payload241.new_component_size.reinterpret_as_int64(), ) - let address240 = mbt_ffi_malloc( - payload239.new_active_plugins.length() * 16, + let address242 = mbt_ffi_malloc( + payload241.new_active_plugins.length() * 16, ) - for index241 = 0 - index241 < payload239.new_active_plugins.length() - index241 = index241 + 1 { - let iter_elem : EnvironmentPluginGrantId = payload239.new_active_plugins[index241] - let iter_base = address240 + index241 * 16 + for index243 = 0 + index243 < payload241.new_active_plugins.length() + index243 = index243 + 1 { + let iter_elem : EnvironmentPluginGrantId = payload241.new_active_plugins[index243] + let iter_base = address242 + index243 * 16 mbt_ffi_store64( iter_base + 0, iter_elem.uuid.high_bits.reinterpret_as_int64(), @@ -2816,37 +2824,37 @@ pub fn enrich_oplog_entries( iter_elem.uuid.low_bits.reinterpret_as_int64(), ) } - mbt_ffi_store32(iter_base + 52, payload239.new_active_plugins.length()) - mbt_ffi_store32(iter_base + 48, address240) - cleanup_list.push(address240) + mbt_ffi_store32(iter_base + 52, payload241.new_active_plugins.length()) + mbt_ffi_store32(iter_base + 48, address242) + cleanup_list.push(address242) () } - FailedUpdate(payload242) => { + FailedUpdate(payload244) => { mbt_ffi_store8(iter_base + 8, 17) - mbt_ffi_store64(iter_base + 16, payload242.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload244.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload242.timestamp.nanoseconds.reinterpret_as_int(), + payload244.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload242.target_revision.reinterpret_as_int64(), + payload244.target_revision.reinterpret_as_int64(), ) - match payload242.details { + match payload244.details { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload244) => { + Some(payload246) => { mbt_ffi_store8(iter_base + 40, 1) - let ptr245 = mbt_ffi_str2ptr(payload244) - mbt_ffi_store32(iter_base + 48, payload244.length()) - mbt_ffi_store32(iter_base + 44, ptr245) - cleanup_list.push(ptr245) + let ptr247 = mbt_ffi_str2ptr(payload246) + mbt_ffi_store32(iter_base + 48, payload246.length()) + mbt_ffi_store32(iter_base + 44, ptr247) + cleanup_list.push(ptr247) () } @@ -2854,771 +2862,771 @@ pub fn enrich_oplog_entries( () } - GrowMemory(payload246) => { + GrowMemory(payload248) => { mbt_ffi_store8(iter_base + 8, 18) - mbt_ffi_store64(iter_base + 16, payload246.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload248.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload246.timestamp.nanoseconds.reinterpret_as_int(), + payload248.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store64(iter_base + 32, payload246.delta.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 32, payload248.delta.reinterpret_as_int64()) () } - FilesystemStorageUsageUpdate(payload247) => { + FilesystemStorageUsageUpdate(payload249) => { mbt_ffi_store8(iter_base + 8, 19) - mbt_ffi_store64(iter_base + 16, payload247.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload249.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload247.timestamp.nanoseconds.reinterpret_as_int(), + payload249.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store64(iter_base + 32, payload247.delta) + mbt_ffi_store64(iter_base + 32, payload249.delta) () } - CreateResource(payload248) => { + CreateResource(payload250) => { mbt_ffi_store8(iter_base + 8, 20) - mbt_ffi_store64(iter_base + 16, payload248.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload250.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload248.timestamp.nanoseconds.reinterpret_as_int(), + payload250.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store64(iter_base + 32, payload248.id.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 32, payload250.id.reinterpret_as_int64()) - let ptr249 = mbt_ffi_str2ptr(payload248.resource_type_id.name) + let ptr251 = mbt_ffi_str2ptr(payload250.resource_type_id.name) mbt_ffi_store32( iter_base + 44, - payload248.resource_type_id.name.length(), + payload250.resource_type_id.name.length(), ) - mbt_ffi_store32(iter_base + 40, ptr249) + mbt_ffi_store32(iter_base + 40, ptr251) - let ptr250 = mbt_ffi_str2ptr(payload248.resource_type_id.owner) + let ptr252 = mbt_ffi_str2ptr(payload250.resource_type_id.owner) mbt_ffi_store32( iter_base + 52, - payload248.resource_type_id.owner.length(), + payload250.resource_type_id.owner.length(), ) - mbt_ffi_store32(iter_base + 48, ptr250) - cleanup_list.push(ptr249) - cleanup_list.push(ptr250) + mbt_ffi_store32(iter_base + 48, ptr252) + cleanup_list.push(ptr251) + cleanup_list.push(ptr252) () } - DropResource(payload251) => { + DropResource(payload253) => { mbt_ffi_store8(iter_base + 8, 21) - mbt_ffi_store64(iter_base + 16, payload251.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload253.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload251.timestamp.nanoseconds.reinterpret_as_int(), + payload253.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store64(iter_base + 32, payload251.id.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 32, payload253.id.reinterpret_as_int64()) - let ptr252 = mbt_ffi_str2ptr(payload251.resource_type_id.name) + let ptr254 = mbt_ffi_str2ptr(payload253.resource_type_id.name) mbt_ffi_store32( iter_base + 44, - payload251.resource_type_id.name.length(), + payload253.resource_type_id.name.length(), ) - mbt_ffi_store32(iter_base + 40, ptr252) + mbt_ffi_store32(iter_base + 40, ptr254) - let ptr253 = mbt_ffi_str2ptr(payload251.resource_type_id.owner) + let ptr255 = mbt_ffi_str2ptr(payload253.resource_type_id.owner) mbt_ffi_store32( iter_base + 52, - payload251.resource_type_id.owner.length(), + payload253.resource_type_id.owner.length(), ) - mbt_ffi_store32(iter_base + 48, ptr253) - cleanup_list.push(ptr252) - cleanup_list.push(ptr253) + mbt_ffi_store32(iter_base + 48, ptr255) + cleanup_list.push(ptr254) + cleanup_list.push(ptr255) () } - Log(payload254) => { + Log(payload256) => { mbt_ffi_store8(iter_base + 8, 22) - mbt_ffi_store64(iter_base + 16, payload254.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload256.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload254.timestamp.nanoseconds.reinterpret_as_int(), + payload256.timestamp.nanoseconds.reinterpret_as_int(), ) - mbt_ffi_store8(iter_base + 32, payload254.level.ordinal()) + mbt_ffi_store8(iter_base + 32, payload256.level.ordinal()) - let ptr255 = mbt_ffi_str2ptr(payload254.context) - mbt_ffi_store32(iter_base + 40, payload254.context.length()) - mbt_ffi_store32(iter_base + 36, ptr255) + let ptr257 = mbt_ffi_str2ptr(payload256.context) + mbt_ffi_store32(iter_base + 40, payload256.context.length()) + mbt_ffi_store32(iter_base + 36, ptr257) - let ptr256 = mbt_ffi_str2ptr(payload254.message) - mbt_ffi_store32(iter_base + 48, payload254.message.length()) - mbt_ffi_store32(iter_base + 44, ptr256) - cleanup_list.push(ptr255) - cleanup_list.push(ptr256) + let ptr258 = mbt_ffi_str2ptr(payload256.message) + mbt_ffi_store32(iter_base + 48, payload256.message.length()) + mbt_ffi_store32(iter_base + 44, ptr258) + cleanup_list.push(ptr257) + cleanup_list.push(ptr258) () } - Restart(payload257) => { + Restart(payload259) => { mbt_ffi_store8(iter_base + 8, 23) - mbt_ffi_store64(iter_base + 16, payload257.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload259.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload257.timestamp.nanoseconds.reinterpret_as_int(), + payload259.timestamp.nanoseconds.reinterpret_as_int(), ) () } - ActivatePlugin(payload258) => { + ActivatePlugin(payload260) => { mbt_ffi_store8(iter_base + 8, 24) - mbt_ffi_store64(iter_base + 16, payload258.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload260.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload258.timestamp.nanoseconds.reinterpret_as_int(), + payload260.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload258.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), + payload260.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload258.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), + payload260.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), ) () } - DeactivatePlugin(payload259) => { + DeactivatePlugin(payload261) => { mbt_ffi_store8(iter_base + 8, 25) - mbt_ffi_store64(iter_base + 16, payload259.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload261.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload259.timestamp.nanoseconds.reinterpret_as_int(), + payload261.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload259.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), + payload261.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload259.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), + payload261.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), ) () } - Revert(payload260) => { + Revert(payload262) => { mbt_ffi_store8(iter_base + 8, 26) - mbt_ffi_store64(iter_base + 16, payload260.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload262.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload260.timestamp.nanoseconds.reinterpret_as_int(), + payload262.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload260.dropped_region.start.reinterpret_as_int64(), + payload262.dropped_region.start.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload260.dropped_region.end.reinterpret_as_int64(), + payload262.dropped_region.end.reinterpret_as_int64(), ) () } - CancelPendingInvocation(payload261) => { + CancelPendingInvocation(payload263) => { mbt_ffi_store8(iter_base + 8, 27) - mbt_ffi_store64(iter_base + 16, payload261.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload263.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload261.timestamp.nanoseconds.reinterpret_as_int(), + payload263.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr262 = mbt_ffi_str2ptr(payload261.idempotency_key) - mbt_ffi_store32(iter_base + 36, payload261.idempotency_key.length()) - mbt_ffi_store32(iter_base + 32, ptr262) - cleanup_list.push(ptr262) + let ptr264 = mbt_ffi_str2ptr(payload263.idempotency_key) + mbt_ffi_store32(iter_base + 36, payload263.idempotency_key.length()) + mbt_ffi_store32(iter_base + 32, ptr264) + cleanup_list.push(ptr264) () } - StartSpan(payload263) => { + StartSpan(payload265) => { mbt_ffi_store8(iter_base + 8, 28) - mbt_ffi_store64(iter_base + 16, payload263.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload265.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload263.timestamp.nanoseconds.reinterpret_as_int(), + payload265.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr264 = mbt_ffi_str2ptr(payload263.span_id) - mbt_ffi_store32(iter_base + 36, payload263.span_id.length()) - mbt_ffi_store32(iter_base + 32, ptr264) + let ptr266 = mbt_ffi_str2ptr(payload265.span_id) + mbt_ffi_store32(iter_base + 36, payload265.span_id.length()) + mbt_ffi_store32(iter_base + 32, ptr266) - match payload263.parent { + match payload265.parent { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload266) => { + Some(payload268) => { mbt_ffi_store8(iter_base + 40, 1) - let ptr267 = mbt_ffi_str2ptr(payload266) - mbt_ffi_store32(iter_base + 48, payload266.length()) - mbt_ffi_store32(iter_base + 44, ptr267) - cleanup_list.push(ptr267) + let ptr269 = mbt_ffi_str2ptr(payload268) + mbt_ffi_store32(iter_base + 48, payload268.length()) + mbt_ffi_store32(iter_base + 44, ptr269) + cleanup_list.push(ptr269) () } } - match payload263.linked_context_id { + match payload265.linked_context_id { None => { mbt_ffi_store8(iter_base + 52, 0) () } - Some(payload269) => { + Some(payload271) => { mbt_ffi_store8(iter_base + 52, 1) - let ptr270 = mbt_ffi_str2ptr(payload269) - mbt_ffi_store32(iter_base + 60, payload269.length()) - mbt_ffi_store32(iter_base + 56, ptr270) - cleanup_list.push(ptr270) + let ptr272 = mbt_ffi_str2ptr(payload271) + mbt_ffi_store32(iter_base + 60, payload271.length()) + mbt_ffi_store32(iter_base + 56, ptr272) + cleanup_list.push(ptr272) () } } - let address274 = mbt_ffi_malloc(payload263.attributes.length() * 20) - for index275 = 0 - index275 < payload263.attributes.length() - index275 = index275 + 1 { - let iter_elem : @context.Attribute = payload263.attributes[index275] - let iter_base = address274 + index275 * 20 + let address276 = mbt_ffi_malloc(payload265.attributes.length() * 20) + for index277 = 0 + index277 < payload265.attributes.length() + index277 = index277 + 1 { + let iter_elem : @context.Attribute = payload265.attributes[index277] + let iter_base = address276 + index277 * 20 - let ptr271 = mbt_ffi_str2ptr(iter_elem.key) + let ptr273 = mbt_ffi_str2ptr(iter_elem.key) mbt_ffi_store32(iter_base + 4, iter_elem.key.length()) - mbt_ffi_store32(iter_base + 0, ptr271) + mbt_ffi_store32(iter_base + 0, ptr273) match iter_elem.value { - String(payload272) => { + String(payload274) => { mbt_ffi_store8(iter_base + 8, 0) - let ptr273 = mbt_ffi_str2ptr(payload272) - mbt_ffi_store32(iter_base + 16, payload272.length()) - mbt_ffi_store32(iter_base + 12, ptr273) - cleanup_list.push(ptr273) + let ptr275 = mbt_ffi_str2ptr(payload274) + mbt_ffi_store32(iter_base + 16, payload274.length()) + mbt_ffi_store32(iter_base + 12, ptr275) + cleanup_list.push(ptr275) () } } - cleanup_list.push(ptr271) + cleanup_list.push(ptr273) } - mbt_ffi_store32(iter_base + 68, payload263.attributes.length()) - mbt_ffi_store32(iter_base + 64, address274) - cleanup_list.push(ptr264) - cleanup_list.push(address274) + mbt_ffi_store32(iter_base + 68, payload265.attributes.length()) + mbt_ffi_store32(iter_base + 64, address276) + cleanup_list.push(ptr266) + cleanup_list.push(address276) () } - FinishSpan(payload276) => { + FinishSpan(payload278) => { mbt_ffi_store8(iter_base + 8, 29) - mbt_ffi_store64(iter_base + 16, payload276.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload278.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload276.timestamp.nanoseconds.reinterpret_as_int(), + payload278.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr277 = mbt_ffi_str2ptr(payload276.span_id) - mbt_ffi_store32(iter_base + 36, payload276.span_id.length()) - mbt_ffi_store32(iter_base + 32, ptr277) - cleanup_list.push(ptr277) + let ptr279 = mbt_ffi_str2ptr(payload278.span_id) + mbt_ffi_store32(iter_base + 36, payload278.span_id.length()) + mbt_ffi_store32(iter_base + 32, ptr279) + cleanup_list.push(ptr279) () } - SetSpanAttribute(payload278) => { + SetSpanAttribute(payload280) => { mbt_ffi_store8(iter_base + 8, 30) - mbt_ffi_store64(iter_base + 16, payload278.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload280.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload278.timestamp.nanoseconds.reinterpret_as_int(), + payload280.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr279 = mbt_ffi_str2ptr(payload278.span_id) - mbt_ffi_store32(iter_base + 36, payload278.span_id.length()) - mbt_ffi_store32(iter_base + 32, ptr279) + let ptr281 = mbt_ffi_str2ptr(payload280.span_id) + mbt_ffi_store32(iter_base + 36, payload280.span_id.length()) + mbt_ffi_store32(iter_base + 32, ptr281) - let ptr280 = mbt_ffi_str2ptr(payload278.key) - mbt_ffi_store32(iter_base + 44, payload278.key.length()) - mbt_ffi_store32(iter_base + 40, ptr280) + let ptr282 = mbt_ffi_str2ptr(payload280.key) + mbt_ffi_store32(iter_base + 44, payload280.key.length()) + mbt_ffi_store32(iter_base + 40, ptr282) - match payload278.value { - String(payload281) => { + match payload280.value { + String(payload283) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr282 = mbt_ffi_str2ptr(payload281) - mbt_ffi_store32(iter_base + 56, payload281.length()) - mbt_ffi_store32(iter_base + 52, ptr282) - cleanup_list.push(ptr282) + let ptr284 = mbt_ffi_str2ptr(payload283) + mbt_ffi_store32(iter_base + 56, payload283.length()) + mbt_ffi_store32(iter_base + 52, ptr284) + cleanup_list.push(ptr284) () } } - cleanup_list.push(ptr279) - cleanup_list.push(ptr280) + cleanup_list.push(ptr281) + cleanup_list.push(ptr282) () } - BeginRemoteTransaction(payload283) => { + BeginRemoteTransaction(payload285) => { mbt_ffi_store8(iter_base + 8, 31) - mbt_ffi_store64(iter_base + 16, payload283.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload285.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload283.timestamp.nanoseconds.reinterpret_as_int(), + payload285.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr284 = mbt_ffi_str2ptr(payload283.transaction_id) - mbt_ffi_store32(iter_base + 36, payload283.transaction_id.length()) - mbt_ffi_store32(iter_base + 32, ptr284) + let ptr286 = mbt_ffi_str2ptr(payload285.transaction_id) + mbt_ffi_store32(iter_base + 36, payload285.transaction_id.length()) + mbt_ffi_store32(iter_base + 32, ptr286) - match payload283.original_begin_index { + match payload285.original_begin_index { None => { mbt_ffi_store8(iter_base + 40, 0) () } - Some(payload286) => { + Some(payload288) => { mbt_ffi_store8(iter_base + 40, 1) - mbt_ffi_store64(iter_base + 48, payload286.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 48, payload288.reinterpret_as_int64()) () } } - cleanup_list.push(ptr284) + cleanup_list.push(ptr286) () } - PreCommitRemoteTransaction(payload287) => { + PreCommitRemoteTransaction(payload289) => { mbt_ffi_store8(iter_base + 8, 32) - mbt_ffi_store64(iter_base + 16, payload287.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload289.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload287.timestamp.nanoseconds.reinterpret_as_int(), + payload289.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload287.begin_index.reinterpret_as_int64(), + payload289.begin_index.reinterpret_as_int64(), ) () } - PreRollbackRemoteTransaction(payload288) => { + PreRollbackRemoteTransaction(payload290) => { mbt_ffi_store8(iter_base + 8, 33) - mbt_ffi_store64(iter_base + 16, payload288.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload290.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload288.timestamp.nanoseconds.reinterpret_as_int(), + payload290.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload288.begin_index.reinterpret_as_int64(), + payload290.begin_index.reinterpret_as_int64(), ) () } - CommittedRemoteTransaction(payload289) => { + CommittedRemoteTransaction(payload291) => { mbt_ffi_store8(iter_base + 8, 34) - mbt_ffi_store64(iter_base + 16, payload289.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload291.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload289.timestamp.nanoseconds.reinterpret_as_int(), + payload291.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload289.begin_index.reinterpret_as_int64(), + payload291.begin_index.reinterpret_as_int64(), ) () } - RolledBackRemoteTransaction(payload290) => { + RolledBackRemoteTransaction(payload292) => { mbt_ffi_store8(iter_base + 8, 35) - mbt_ffi_store64(iter_base + 16, payload290.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload292.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload290.timestamp.nanoseconds.reinterpret_as_int(), + payload292.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload290.begin_index.reinterpret_as_int64(), + payload292.begin_index.reinterpret_as_int64(), ) () } - Snapshot(payload291) => { + Snapshot(payload293) => { mbt_ffi_store8(iter_base + 8, 36) - mbt_ffi_store64(iter_base + 16, payload291.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload293.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload291.timestamp.nanoseconds.reinterpret_as_int(), + payload293.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload291.data { - Inline(payload292) => { + match payload293.data { + Inline(payload294) => { mbt_ffi_store8(iter_base + 32, 0) - let ptr293 = mbt_ffi_bytes2ptr(payload292) + let ptr295 = mbt_ffi_bytes2ptr(payload294) - mbt_ffi_store32(iter_base + 44, payload292.length()) - mbt_ffi_store32(iter_base + 40, ptr293) - cleanup_list.push(ptr293) + mbt_ffi_store32(iter_base + 44, payload294.length()) + mbt_ffi_store32(iter_base + 40, ptr295) + cleanup_list.push(ptr295) () } - External(payload294) => { + External(payload296) => { mbt_ffi_store8(iter_base + 32, 1) mbt_ffi_store64( iter_base + 40, - payload294.payload_id.high_bits.reinterpret_as_int64(), + payload296.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload294.payload_id.low_bits.reinterpret_as_int64(), + payload296.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr295 = mbt_ffi_bytes2ptr(payload294.md5_hash) + let ptr297 = mbt_ffi_bytes2ptr(payload296.md5_hash) - mbt_ffi_store32(iter_base + 60, payload294.md5_hash.length()) - mbt_ffi_store32(iter_base + 56, ptr295) - cleanup_list.push(ptr295) + mbt_ffi_store32(iter_base + 60, payload296.md5_hash.length()) + mbt_ffi_store32(iter_base + 56, ptr297) + cleanup_list.push(ptr297) () } } - let ptr296 = mbt_ffi_str2ptr(payload291.mime_type) - mbt_ffi_store32(iter_base + 68, payload291.mime_type.length()) - mbt_ffi_store32(iter_base + 64, ptr296) - cleanup_list.push(ptr296) + let ptr298 = mbt_ffi_str2ptr(payload293.mime_type) + mbt_ffi_store32(iter_base + 68, payload293.mime_type.length()) + mbt_ffi_store32(iter_base + 64, ptr298) + cleanup_list.push(ptr298) () } - OplogProcessorCheckpoint(payload297) => { + OplogProcessorCheckpoint(payload299) => { mbt_ffi_store8(iter_base + 8, 37) - mbt_ffi_store64(iter_base + 16, payload297.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload299.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload297.timestamp.nanoseconds.reinterpret_as_int(), + payload299.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload297.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), + payload299.plugin_grant_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload297.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), + payload299.plugin_grant_id.uuid.low_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload297.target_agent_id.component_id.uuid.high_bits.reinterpret_as_int64(), + payload299.target_agent_id.component_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 56, - payload297.target_agent_id.component_id.uuid.low_bits.reinterpret_as_int64(), + payload299.target_agent_id.component_id.uuid.low_bits.reinterpret_as_int64(), ) - let ptr298 = mbt_ffi_str2ptr(payload297.target_agent_id.agent_id) + let ptr300 = mbt_ffi_str2ptr(payload299.target_agent_id.agent_id) mbt_ffi_store32( iter_base + 68, - payload297.target_agent_id.agent_id.length(), + payload299.target_agent_id.agent_id.length(), ) - mbt_ffi_store32(iter_base + 64, ptr298) + mbt_ffi_store32(iter_base + 64, ptr300) mbt_ffi_store64( iter_base + 72, - payload297.confirmed_up_to.reinterpret_as_int64(), + payload299.confirmed_up_to.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 80, - payload297.sending_up_to.reinterpret_as_int64(), + payload299.sending_up_to.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 88, - payload297.last_batch_start.reinterpret_as_int64(), + payload299.last_batch_start.reinterpret_as_int64(), ) - cleanup_list.push(ptr298) + cleanup_list.push(ptr300) () } - SetRetryPolicy(payload299) => { + SetRetryPolicy(payload301) => { mbt_ffi_store8(iter_base + 8, 38) - mbt_ffi_store64(iter_base + 16, payload299.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload301.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload299.timestamp.nanoseconds.reinterpret_as_int(), + payload301.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr300 = mbt_ffi_str2ptr(payload299.policy.name) - mbt_ffi_store32(iter_base + 36, payload299.policy.name.length()) - mbt_ffi_store32(iter_base + 32, ptr300) + let ptr302 = mbt_ffi_str2ptr(payload301.policy.name) + mbt_ffi_store32(iter_base + 36, payload301.policy.name.length()) + mbt_ffi_store32(iter_base + 32, ptr302) mbt_ffi_store32( iter_base + 40, - payload299.policy.priority.reinterpret_as_int(), + payload301.policy.priority.reinterpret_as_int(), ) - let address361 = mbt_ffi_malloc( - payload299.policy.predicate.nodes.length() * 32, + let address363 = mbt_ffi_malloc( + payload301.policy.predicate.nodes.length() * 32, ) - for index362 = 0 - index362 < payload299.policy.predicate.nodes.length() - index362 = index362 + 1 { - let iter_elem : @retry.PredicateNode = payload299.policy.predicate.nodes[index362] - let iter_base = address361 + index362 * 32 + for index364 = 0 + index364 < payload301.policy.predicate.nodes.length() + index364 = index364 + 1 { + let iter_elem : @retry.PredicateNode = payload301.policy.predicate.nodes[index364] + let iter_base = address363 + index364 * 32 match iter_elem { - PropEq(payload301) => { + PropEq(payload303) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr302 = mbt_ffi_str2ptr(payload301.property_name) - mbt_ffi_store32(iter_base + 12, payload301.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr302) + let ptr304 = mbt_ffi_str2ptr(payload303.property_name) + mbt_ffi_store32(iter_base + 12, payload303.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr304) - match payload301.value { - Text(payload303) => { + match payload303.value { + Text(payload305) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr304 = mbt_ffi_str2ptr(payload303) - mbt_ffi_store32(iter_base + 28, payload303.length()) - mbt_ffi_store32(iter_base + 24, ptr304) - cleanup_list.push(ptr304) + let ptr306 = mbt_ffi_str2ptr(payload305) + mbt_ffi_store32(iter_base + 28, payload305.length()) + mbt_ffi_store32(iter_base + 24, ptr306) + cleanup_list.push(ptr306) () } - Integer(payload305) => { + Integer(payload307) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload305) + mbt_ffi_store64(iter_base + 24, payload307) () } - Boolean(payload306) => { + Boolean(payload308) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload306 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload308 { 1 } else { 0 }) () } } - cleanup_list.push(ptr302) + cleanup_list.push(ptr304) () } - PropNeq(payload307) => { + PropNeq(payload309) => { mbt_ffi_store8(iter_base + 0, 1) - let ptr308 = mbt_ffi_str2ptr(payload307.property_name) - mbt_ffi_store32(iter_base + 12, payload307.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr308) + let ptr310 = mbt_ffi_str2ptr(payload309.property_name) + mbt_ffi_store32(iter_base + 12, payload309.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr310) - match payload307.value { - Text(payload309) => { + match payload309.value { + Text(payload311) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr310 = mbt_ffi_str2ptr(payload309) - mbt_ffi_store32(iter_base + 28, payload309.length()) - mbt_ffi_store32(iter_base + 24, ptr310) - cleanup_list.push(ptr310) + let ptr312 = mbt_ffi_str2ptr(payload311) + mbt_ffi_store32(iter_base + 28, payload311.length()) + mbt_ffi_store32(iter_base + 24, ptr312) + cleanup_list.push(ptr312) () } - Integer(payload311) => { + Integer(payload313) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload311) + mbt_ffi_store64(iter_base + 24, payload313) () } - Boolean(payload312) => { + Boolean(payload314) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload312 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload314 { 1 } else { 0 }) () } } - cleanup_list.push(ptr308) + cleanup_list.push(ptr310) () } - PropGt(payload313) => { + PropGt(payload315) => { mbt_ffi_store8(iter_base + 0, 2) - let ptr314 = mbt_ffi_str2ptr(payload313.property_name) - mbt_ffi_store32(iter_base + 12, payload313.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr314) + let ptr316 = mbt_ffi_str2ptr(payload315.property_name) + mbt_ffi_store32(iter_base + 12, payload315.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr316) - match payload313.value { - Text(payload315) => { + match payload315.value { + Text(payload317) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr316 = mbt_ffi_str2ptr(payload315) - mbt_ffi_store32(iter_base + 28, payload315.length()) - mbt_ffi_store32(iter_base + 24, ptr316) - cleanup_list.push(ptr316) + let ptr318 = mbt_ffi_str2ptr(payload317) + mbt_ffi_store32(iter_base + 28, payload317.length()) + mbt_ffi_store32(iter_base + 24, ptr318) + cleanup_list.push(ptr318) () } - Integer(payload317) => { + Integer(payload319) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload317) + mbt_ffi_store64(iter_base + 24, payload319) () } - Boolean(payload318) => { + Boolean(payload320) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload318 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload320 { 1 } else { 0 }) () } } - cleanup_list.push(ptr314) + cleanup_list.push(ptr316) () } - PropGte(payload319) => { + PropGte(payload321) => { mbt_ffi_store8(iter_base + 0, 3) - let ptr320 = mbt_ffi_str2ptr(payload319.property_name) - mbt_ffi_store32(iter_base + 12, payload319.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr320) + let ptr322 = mbt_ffi_str2ptr(payload321.property_name) + mbt_ffi_store32(iter_base + 12, payload321.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr322) - match payload319.value { - Text(payload321) => { + match payload321.value { + Text(payload323) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr322 = mbt_ffi_str2ptr(payload321) - mbt_ffi_store32(iter_base + 28, payload321.length()) - mbt_ffi_store32(iter_base + 24, ptr322) - cleanup_list.push(ptr322) + let ptr324 = mbt_ffi_str2ptr(payload323) + mbt_ffi_store32(iter_base + 28, payload323.length()) + mbt_ffi_store32(iter_base + 24, ptr324) + cleanup_list.push(ptr324) () } - Integer(payload323) => { + Integer(payload325) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload323) + mbt_ffi_store64(iter_base + 24, payload325) () } - Boolean(payload324) => { + Boolean(payload326) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload324 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload326 { 1 } else { 0 }) () } } - cleanup_list.push(ptr320) + cleanup_list.push(ptr322) () } - PropLt(payload325) => { + PropLt(payload327) => { mbt_ffi_store8(iter_base + 0, 4) - let ptr326 = mbt_ffi_str2ptr(payload325.property_name) - mbt_ffi_store32(iter_base + 12, payload325.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr326) + let ptr328 = mbt_ffi_str2ptr(payload327.property_name) + mbt_ffi_store32(iter_base + 12, payload327.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr328) - match payload325.value { - Text(payload327) => { + match payload327.value { + Text(payload329) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr328 = mbt_ffi_str2ptr(payload327) - mbt_ffi_store32(iter_base + 28, payload327.length()) - mbt_ffi_store32(iter_base + 24, ptr328) - cleanup_list.push(ptr328) + let ptr330 = mbt_ffi_str2ptr(payload329) + mbt_ffi_store32(iter_base + 28, payload329.length()) + mbt_ffi_store32(iter_base + 24, ptr330) + cleanup_list.push(ptr330) () } - Integer(payload329) => { + Integer(payload331) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload329) + mbt_ffi_store64(iter_base + 24, payload331) () } - Boolean(payload330) => { + Boolean(payload332) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload330 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload332 { 1 } else { 0 }) () } } - cleanup_list.push(ptr326) + cleanup_list.push(ptr328) () } - PropLte(payload331) => { + PropLte(payload333) => { mbt_ffi_store8(iter_base + 0, 5) - let ptr332 = mbt_ffi_str2ptr(payload331.property_name) - mbt_ffi_store32(iter_base + 12, payload331.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr332) + let ptr334 = mbt_ffi_str2ptr(payload333.property_name) + mbt_ffi_store32(iter_base + 12, payload333.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr334) - match payload331.value { - Text(payload333) => { + match payload333.value { + Text(payload335) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr334 = mbt_ffi_str2ptr(payload333) - mbt_ffi_store32(iter_base + 28, payload333.length()) - mbt_ffi_store32(iter_base + 24, ptr334) - cleanup_list.push(ptr334) + let ptr336 = mbt_ffi_str2ptr(payload335) + mbt_ffi_store32(iter_base + 28, payload335.length()) + mbt_ffi_store32(iter_base + 24, ptr336) + cleanup_list.push(ptr336) () } - Integer(payload335) => { + Integer(payload337) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload335) + mbt_ffi_store64(iter_base + 24, payload337) () } - Boolean(payload336) => { + Boolean(payload338) => { mbt_ffi_store8(iter_base + 16, 2) - mbt_ffi_store8(iter_base + 24, if payload336 { 1 } else { 0 }) + mbt_ffi_store8(iter_base + 24, if payload338 { 1 } else { 0 }) () } } - cleanup_list.push(ptr332) + cleanup_list.push(ptr334) () } - PropExists(payload337) => { + PropExists(payload339) => { mbt_ffi_store8(iter_base + 0, 6) - let ptr338 = mbt_ffi_str2ptr(payload337) - mbt_ffi_store32(iter_base + 12, payload337.length()) - mbt_ffi_store32(iter_base + 8, ptr338) - cleanup_list.push(ptr338) + let ptr340 = mbt_ffi_str2ptr(payload339) + mbt_ffi_store32(iter_base + 12, payload339.length()) + mbt_ffi_store32(iter_base + 8, ptr340) + cleanup_list.push(ptr340) () } - PropIn(payload339) => { + PropIn(payload341) => { mbt_ffi_store8(iter_base + 0, 7) - let ptr340 = mbt_ffi_str2ptr(payload339.property_name) - mbt_ffi_store32(iter_base + 12, payload339.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr340) + let ptr342 = mbt_ffi_str2ptr(payload341.property_name) + mbt_ffi_store32(iter_base + 12, payload341.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr342) - let address345 = mbt_ffi_malloc(payload339.values.length() * 16) - for index346 = 0 - index346 < payload339.values.length() - index346 = index346 + 1 { - let iter_elem : @retry.PredicateValue = payload339.values[index346] - let iter_base = address345 + index346 * 16 + let address347 = mbt_ffi_malloc(payload341.values.length() * 16) + for index348 = 0 + index348 < payload341.values.length() + index348 = index348 + 1 { + let iter_elem : @retry.PredicateValue = payload341.values[index348] + let iter_base = address347 + index348 * 16 match iter_elem { - Text(payload341) => { + Text(payload343) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr342 = mbt_ffi_str2ptr(payload341) - mbt_ffi_store32(iter_base + 12, payload341.length()) - mbt_ffi_store32(iter_base + 8, ptr342) - cleanup_list.push(ptr342) + let ptr344 = mbt_ffi_str2ptr(payload343) + mbt_ffi_store32(iter_base + 12, payload343.length()) + mbt_ffi_store32(iter_base + 8, ptr344) + cleanup_list.push(ptr344) () } - Integer(payload343) => { + Integer(payload345) => { mbt_ffi_store8(iter_base + 0, 1) - mbt_ffi_store64(iter_base + 8, payload343) + mbt_ffi_store64(iter_base + 8, payload345) () } - Boolean(payload344) => { + Boolean(payload346) => { mbt_ffi_store8(iter_base + 0, 2) mbt_ffi_store8( iter_base + 8, - if payload344 { + if payload346 { 1 } else { 0 @@ -3629,75 +3637,75 @@ pub fn enrich_oplog_entries( } } } - mbt_ffi_store32(iter_base + 20, payload339.values.length()) - mbt_ffi_store32(iter_base + 16, address345) - cleanup_list.push(ptr340) - cleanup_list.push(address345) + mbt_ffi_store32(iter_base + 20, payload341.values.length()) + mbt_ffi_store32(iter_base + 16, address347) + cleanup_list.push(ptr342) + cleanup_list.push(address347) () } - PropMatches(payload347) => { + PropMatches(payload349) => { mbt_ffi_store8(iter_base + 0, 8) - let ptr348 = mbt_ffi_str2ptr(payload347.property_name) - mbt_ffi_store32(iter_base + 12, payload347.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr348) + let ptr350 = mbt_ffi_str2ptr(payload349.property_name) + mbt_ffi_store32(iter_base + 12, payload349.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr350) - let ptr349 = mbt_ffi_str2ptr(payload347.pattern) - mbt_ffi_store32(iter_base + 20, payload347.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr349) - cleanup_list.push(ptr348) - cleanup_list.push(ptr349) + let ptr351 = mbt_ffi_str2ptr(payload349.pattern) + mbt_ffi_store32(iter_base + 20, payload349.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr351) + cleanup_list.push(ptr350) + cleanup_list.push(ptr351) () } - PropStartsWith(payload350) => { + PropStartsWith(payload352) => { mbt_ffi_store8(iter_base + 0, 9) - let ptr351 = mbt_ffi_str2ptr(payload350.property_name) - mbt_ffi_store32(iter_base + 12, payload350.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr351) + let ptr353 = mbt_ffi_str2ptr(payload352.property_name) + mbt_ffi_store32(iter_base + 12, payload352.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr353) - let ptr352 = mbt_ffi_str2ptr(payload350.pattern) - mbt_ffi_store32(iter_base + 20, payload350.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr352) - cleanup_list.push(ptr351) - cleanup_list.push(ptr352) + let ptr354 = mbt_ffi_str2ptr(payload352.pattern) + mbt_ffi_store32(iter_base + 20, payload352.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr354) + cleanup_list.push(ptr353) + cleanup_list.push(ptr354) () } - PropContains(payload353) => { + PropContains(payload355) => { mbt_ffi_store8(iter_base + 0, 10) - let ptr354 = mbt_ffi_str2ptr(payload353.property_name) - mbt_ffi_store32(iter_base + 12, payload353.property_name.length()) - mbt_ffi_store32(iter_base + 8, ptr354) + let ptr356 = mbt_ffi_str2ptr(payload355.property_name) + mbt_ffi_store32(iter_base + 12, payload355.property_name.length()) + mbt_ffi_store32(iter_base + 8, ptr356) - let ptr355 = mbt_ffi_str2ptr(payload353.pattern) - mbt_ffi_store32(iter_base + 20, payload353.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr355) - cleanup_list.push(ptr354) - cleanup_list.push(ptr355) + let ptr357 = mbt_ffi_str2ptr(payload355.pattern) + mbt_ffi_store32(iter_base + 20, payload355.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr357) + cleanup_list.push(ptr356) + cleanup_list.push(ptr357) () } - PredAnd(payload356) => { + PredAnd(payload358) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload356.0) - mbt_ffi_store32(iter_base + 12, payload356.1) + mbt_ffi_store32(iter_base + 8, payload358.0) + mbt_ffi_store32(iter_base + 12, payload358.1) () } - PredOr(payload357) => { + PredOr(payload359) => { mbt_ffi_store8(iter_base + 0, 12) - mbt_ffi_store32(iter_base + 8, payload357.0) - mbt_ffi_store32(iter_base + 12, payload357.1) + mbt_ffi_store32(iter_base + 8, payload359.0) + mbt_ffi_store32(iter_base + 12, payload359.1) () } - PredNot(payload358) => { + PredNot(payload360) => { mbt_ffi_store8(iter_base + 0, 13) - mbt_ffi_store32(iter_base + 8, payload358) + mbt_ffi_store32(iter_base + 8, payload360) () } @@ -3715,45 +3723,45 @@ pub fn enrich_oplog_entries( } mbt_ffi_store32( iter_base + 48, - payload299.policy.predicate.nodes.length(), + payload301.policy.predicate.nodes.length(), ) - mbt_ffi_store32(iter_base + 44, address361) + mbt_ffi_store32(iter_base + 44, address363) - let address439 = mbt_ffi_malloc( - payload299.policy.policy.nodes.length() * 32, + let address441 = mbt_ffi_malloc( + payload301.policy.policy.nodes.length() * 32, ) - for index440 = 0 - index440 < payload299.policy.policy.nodes.length() - index440 = index440 + 1 { - let iter_elem : @retry.PolicyNode = payload299.policy.policy.nodes[index440] - let iter_base = address439 + index440 * 32 + for index442 = 0 + index442 < payload301.policy.policy.nodes.length() + index442 = index442 + 1 { + let iter_elem : @retry.PolicyNode = payload301.policy.policy.nodes[index442] + let iter_base = address441 + index442 * 32 match iter_elem { - Periodic(payload363) => { + Periodic(payload365) => { mbt_ffi_store8(iter_base + 0, 0) - mbt_ffi_store64(iter_base + 8, payload363.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 8, payload365.reinterpret_as_int64()) () } - Exponential(payload364) => { + Exponential(payload366) => { mbt_ffi_store8(iter_base + 0, 1) mbt_ffi_store64( iter_base + 8, - payload364.base_delay.reinterpret_as_int64(), + payload366.base_delay.reinterpret_as_int64(), ) - mbt_ffi_storef64(iter_base + 16, payload364.factor) + mbt_ffi_storef64(iter_base + 16, payload366.factor) () } - Fibonacci(payload365) => { + Fibonacci(payload367) => { mbt_ffi_store8(iter_base + 0, 2) mbt_ffi_store64( iter_base + 8, - payload365.first.reinterpret_as_int64(), + payload367.first.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 16, - payload365.second.reinterpret_as_int64(), + payload367.second.reinterpret_as_int64(), ) () @@ -3768,102 +3776,102 @@ pub fn enrich_oplog_entries( () } - CountBox(payload368) => { + CountBox(payload370) => { mbt_ffi_store8(iter_base + 0, 5) mbt_ffi_store32( iter_base + 8, - payload368.max_retries.reinterpret_as_int(), + payload370.max_retries.reinterpret_as_int(), ) - mbt_ffi_store32(iter_base + 12, payload368.inner) + mbt_ffi_store32(iter_base + 12, payload370.inner) () } - TimeBox(payload369) => { + TimeBox(payload371) => { mbt_ffi_store8(iter_base + 0, 6) mbt_ffi_store64( iter_base + 8, - payload369.limit.reinterpret_as_int64(), + payload371.limit.reinterpret_as_int64(), ) - mbt_ffi_store32(iter_base + 16, payload369.inner) + mbt_ffi_store32(iter_base + 16, payload371.inner) () } - ClampDelay(payload370) => { + ClampDelay(payload372) => { mbt_ffi_store8(iter_base + 0, 7) mbt_ffi_store64( iter_base + 8, - payload370.min_delay.reinterpret_as_int64(), + payload372.min_delay.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 16, - payload370.max_delay.reinterpret_as_int64(), + payload372.max_delay.reinterpret_as_int64(), ) - mbt_ffi_store32(iter_base + 24, payload370.inner) + mbt_ffi_store32(iter_base + 24, payload372.inner) () } - AddDelay(payload371) => { + AddDelay(payload373) => { mbt_ffi_store8(iter_base + 0, 8) mbt_ffi_store64( iter_base + 8, - payload371.delay.reinterpret_as_int64(), + payload373.delay.reinterpret_as_int64(), ) - mbt_ffi_store32(iter_base + 16, payload371.inner) + mbt_ffi_store32(iter_base + 16, payload373.inner) () } - Jitter(payload372) => { + Jitter(payload374) => { mbt_ffi_store8(iter_base + 0, 9) - mbt_ffi_storef64(iter_base + 8, payload372.factor) - mbt_ffi_store32(iter_base + 16, payload372.inner) + mbt_ffi_storef64(iter_base + 8, payload374.factor) + mbt_ffi_store32(iter_base + 16, payload374.inner) () } - FilteredOn(payload373) => { + FilteredOn(payload375) => { mbt_ffi_store8(iter_base + 0, 10) - let address434 = mbt_ffi_malloc( - payload373.predicate.nodes.length() * 32, + let address436 = mbt_ffi_malloc( + payload375.predicate.nodes.length() * 32, ) - for index435 = 0 - index435 < payload373.predicate.nodes.length() - index435 = index435 + 1 { - let iter_elem : @retry.PredicateNode = payload373.predicate.nodes[index435] - let iter_base = address434 + index435 * 32 + for index437 = 0 + index437 < payload375.predicate.nodes.length() + index437 = index437 + 1 { + let iter_elem : @retry.PredicateNode = payload375.predicate.nodes[index437] + let iter_base = address436 + index437 * 32 match iter_elem { - PropEq(payload374) => { + PropEq(payload376) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr375 = mbt_ffi_str2ptr(payload374.property_name) + let ptr377 = mbt_ffi_str2ptr(payload376.property_name) mbt_ffi_store32( iter_base + 12, - payload374.property_name.length(), + payload376.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr375) + mbt_ffi_store32(iter_base + 8, ptr377) - match payload374.value { - Text(payload376) => { + match payload376.value { + Text(payload378) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr377 = mbt_ffi_str2ptr(payload376) - mbt_ffi_store32(iter_base + 28, payload376.length()) - mbt_ffi_store32(iter_base + 24, ptr377) - cleanup_list.push(ptr377) + let ptr379 = mbt_ffi_str2ptr(payload378) + mbt_ffi_store32(iter_base + 28, payload378.length()) + mbt_ffi_store32(iter_base + 24, ptr379) + cleanup_list.push(ptr379) () } - Integer(payload378) => { + Integer(payload380) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload378) + mbt_ffi_store64(iter_base + 24, payload380) () } - Boolean(payload379) => { + Boolean(payload381) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload379 { + if payload381 { 1 } else { 0 @@ -3873,42 +3881,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr375) + cleanup_list.push(ptr377) () } - PropNeq(payload380) => { + PropNeq(payload382) => { mbt_ffi_store8(iter_base + 0, 1) - let ptr381 = mbt_ffi_str2ptr(payload380.property_name) + let ptr383 = mbt_ffi_str2ptr(payload382.property_name) mbt_ffi_store32( iter_base + 12, - payload380.property_name.length(), + payload382.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr381) + mbt_ffi_store32(iter_base + 8, ptr383) - match payload380.value { - Text(payload382) => { + match payload382.value { + Text(payload384) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr383 = mbt_ffi_str2ptr(payload382) - mbt_ffi_store32(iter_base + 28, payload382.length()) - mbt_ffi_store32(iter_base + 24, ptr383) - cleanup_list.push(ptr383) + let ptr385 = mbt_ffi_str2ptr(payload384) + mbt_ffi_store32(iter_base + 28, payload384.length()) + mbt_ffi_store32(iter_base + 24, ptr385) + cleanup_list.push(ptr385) () } - Integer(payload384) => { + Integer(payload386) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload384) + mbt_ffi_store64(iter_base + 24, payload386) () } - Boolean(payload385) => { + Boolean(payload387) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload385 { + if payload387 { 1 } else { 0 @@ -3918,42 +3926,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr381) + cleanup_list.push(ptr383) () } - PropGt(payload386) => { + PropGt(payload388) => { mbt_ffi_store8(iter_base + 0, 2) - let ptr387 = mbt_ffi_str2ptr(payload386.property_name) + let ptr389 = mbt_ffi_str2ptr(payload388.property_name) mbt_ffi_store32( iter_base + 12, - payload386.property_name.length(), + payload388.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr387) + mbt_ffi_store32(iter_base + 8, ptr389) - match payload386.value { - Text(payload388) => { + match payload388.value { + Text(payload390) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr389 = mbt_ffi_str2ptr(payload388) - mbt_ffi_store32(iter_base + 28, payload388.length()) - mbt_ffi_store32(iter_base + 24, ptr389) - cleanup_list.push(ptr389) + let ptr391 = mbt_ffi_str2ptr(payload390) + mbt_ffi_store32(iter_base + 28, payload390.length()) + mbt_ffi_store32(iter_base + 24, ptr391) + cleanup_list.push(ptr391) () } - Integer(payload390) => { + Integer(payload392) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload390) + mbt_ffi_store64(iter_base + 24, payload392) () } - Boolean(payload391) => { + Boolean(payload393) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload391 { + if payload393 { 1 } else { 0 @@ -3963,42 +3971,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr387) + cleanup_list.push(ptr389) () } - PropGte(payload392) => { + PropGte(payload394) => { mbt_ffi_store8(iter_base + 0, 3) - let ptr393 = mbt_ffi_str2ptr(payload392.property_name) + let ptr395 = mbt_ffi_str2ptr(payload394.property_name) mbt_ffi_store32( iter_base + 12, - payload392.property_name.length(), + payload394.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr393) + mbt_ffi_store32(iter_base + 8, ptr395) - match payload392.value { - Text(payload394) => { + match payload394.value { + Text(payload396) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr395 = mbt_ffi_str2ptr(payload394) - mbt_ffi_store32(iter_base + 28, payload394.length()) - mbt_ffi_store32(iter_base + 24, ptr395) - cleanup_list.push(ptr395) + let ptr397 = mbt_ffi_str2ptr(payload396) + mbt_ffi_store32(iter_base + 28, payload396.length()) + mbt_ffi_store32(iter_base + 24, ptr397) + cleanup_list.push(ptr397) () } - Integer(payload396) => { + Integer(payload398) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload396) + mbt_ffi_store64(iter_base + 24, payload398) () } - Boolean(payload397) => { + Boolean(payload399) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload397 { + if payload399 { 1 } else { 0 @@ -4008,42 +4016,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr393) + cleanup_list.push(ptr395) () } - PropLt(payload398) => { + PropLt(payload400) => { mbt_ffi_store8(iter_base + 0, 4) - let ptr399 = mbt_ffi_str2ptr(payload398.property_name) + let ptr401 = mbt_ffi_str2ptr(payload400.property_name) mbt_ffi_store32( iter_base + 12, - payload398.property_name.length(), + payload400.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr399) + mbt_ffi_store32(iter_base + 8, ptr401) - match payload398.value { - Text(payload400) => { + match payload400.value { + Text(payload402) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr401 = mbt_ffi_str2ptr(payload400) - mbt_ffi_store32(iter_base + 28, payload400.length()) - mbt_ffi_store32(iter_base + 24, ptr401) - cleanup_list.push(ptr401) + let ptr403 = mbt_ffi_str2ptr(payload402) + mbt_ffi_store32(iter_base + 28, payload402.length()) + mbt_ffi_store32(iter_base + 24, ptr403) + cleanup_list.push(ptr403) () } - Integer(payload402) => { + Integer(payload404) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload402) + mbt_ffi_store64(iter_base + 24, payload404) () } - Boolean(payload403) => { + Boolean(payload405) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload403 { + if payload405 { 1 } else { 0 @@ -4053,42 +4061,42 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr399) + cleanup_list.push(ptr401) () } - PropLte(payload404) => { + PropLte(payload406) => { mbt_ffi_store8(iter_base + 0, 5) - let ptr405 = mbt_ffi_str2ptr(payload404.property_name) + let ptr407 = mbt_ffi_str2ptr(payload406.property_name) mbt_ffi_store32( iter_base + 12, - payload404.property_name.length(), + payload406.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr405) + mbt_ffi_store32(iter_base + 8, ptr407) - match payload404.value { - Text(payload406) => { + match payload406.value { + Text(payload408) => { mbt_ffi_store8(iter_base + 16, 0) - let ptr407 = mbt_ffi_str2ptr(payload406) - mbt_ffi_store32(iter_base + 28, payload406.length()) - mbt_ffi_store32(iter_base + 24, ptr407) - cleanup_list.push(ptr407) + let ptr409 = mbt_ffi_str2ptr(payload408) + mbt_ffi_store32(iter_base + 28, payload408.length()) + mbt_ffi_store32(iter_base + 24, ptr409) + cleanup_list.push(ptr409) () } - Integer(payload408) => { + Integer(payload410) => { mbt_ffi_store8(iter_base + 16, 1) - mbt_ffi_store64(iter_base + 24, payload408) + mbt_ffi_store64(iter_base + 24, payload410) () } - Boolean(payload409) => { + Boolean(payload411) => { mbt_ffi_store8(iter_base + 16, 2) mbt_ffi_store8( iter_base + 24, - if payload409 { + if payload411 { 1 } else { 0 @@ -4098,61 +4106,61 @@ pub fn enrich_oplog_entries( () } } - cleanup_list.push(ptr405) + cleanup_list.push(ptr407) () } - PropExists(payload410) => { + PropExists(payload412) => { mbt_ffi_store8(iter_base + 0, 6) - let ptr411 = mbt_ffi_str2ptr(payload410) - mbt_ffi_store32(iter_base + 12, payload410.length()) - mbt_ffi_store32(iter_base + 8, ptr411) - cleanup_list.push(ptr411) + let ptr413 = mbt_ffi_str2ptr(payload412) + mbt_ffi_store32(iter_base + 12, payload412.length()) + mbt_ffi_store32(iter_base + 8, ptr413) + cleanup_list.push(ptr413) () } - PropIn(payload412) => { + PropIn(payload414) => { mbt_ffi_store8(iter_base + 0, 7) - let ptr413 = mbt_ffi_str2ptr(payload412.property_name) + let ptr415 = mbt_ffi_str2ptr(payload414.property_name) mbt_ffi_store32( iter_base + 12, - payload412.property_name.length(), + payload414.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr413) + mbt_ffi_store32(iter_base + 8, ptr415) - let address418 = mbt_ffi_malloc( - payload412.values.length() * 16, + let address420 = mbt_ffi_malloc( + payload414.values.length() * 16, ) - for index419 = 0 - index419 < payload412.values.length() - index419 = index419 + 1 { - let iter_elem : @retry.PredicateValue = payload412.values[index419] - let iter_base = address418 + index419 * 16 + for index421 = 0 + index421 < payload414.values.length() + index421 = index421 + 1 { + let iter_elem : @retry.PredicateValue = payload414.values[index421] + let iter_base = address420 + index421 * 16 match iter_elem { - Text(payload414) => { + Text(payload416) => { mbt_ffi_store8(iter_base + 0, 0) - let ptr415 = mbt_ffi_str2ptr(payload414) - mbt_ffi_store32(iter_base + 12, payload414.length()) - mbt_ffi_store32(iter_base + 8, ptr415) - cleanup_list.push(ptr415) + let ptr417 = mbt_ffi_str2ptr(payload416) + mbt_ffi_store32(iter_base + 12, payload416.length()) + mbt_ffi_store32(iter_base + 8, ptr417) + cleanup_list.push(ptr417) () } - Integer(payload416) => { + Integer(payload418) => { mbt_ffi_store8(iter_base + 0, 1) - mbt_ffi_store64(iter_base + 8, payload416) + mbt_ffi_store64(iter_base + 8, payload418) () } - Boolean(payload417) => { + Boolean(payload419) => { mbt_ffi_store8(iter_base + 0, 2) mbt_ffi_store8( iter_base + 8, - if payload417 { + if payload419 { 1 } else { 0 @@ -4163,84 +4171,84 @@ pub fn enrich_oplog_entries( } } } - mbt_ffi_store32(iter_base + 20, payload412.values.length()) - mbt_ffi_store32(iter_base + 16, address418) - cleanup_list.push(ptr413) - cleanup_list.push(address418) + mbt_ffi_store32(iter_base + 20, payload414.values.length()) + mbt_ffi_store32(iter_base + 16, address420) + cleanup_list.push(ptr415) + cleanup_list.push(address420) () } - PropMatches(payload420) => { + PropMatches(payload422) => { mbt_ffi_store8(iter_base + 0, 8) - let ptr421 = mbt_ffi_str2ptr(payload420.property_name) + let ptr423 = mbt_ffi_str2ptr(payload422.property_name) mbt_ffi_store32( iter_base + 12, - payload420.property_name.length(), + payload422.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr421) + mbt_ffi_store32(iter_base + 8, ptr423) - let ptr422 = mbt_ffi_str2ptr(payload420.pattern) - mbt_ffi_store32(iter_base + 20, payload420.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr422) - cleanup_list.push(ptr421) - cleanup_list.push(ptr422) + let ptr424 = mbt_ffi_str2ptr(payload422.pattern) + mbt_ffi_store32(iter_base + 20, payload422.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr424) + cleanup_list.push(ptr423) + cleanup_list.push(ptr424) () } - PropStartsWith(payload423) => { + PropStartsWith(payload425) => { mbt_ffi_store8(iter_base + 0, 9) - let ptr424 = mbt_ffi_str2ptr(payload423.property_name) + let ptr426 = mbt_ffi_str2ptr(payload425.property_name) mbt_ffi_store32( iter_base + 12, - payload423.property_name.length(), + payload425.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr424) + mbt_ffi_store32(iter_base + 8, ptr426) - let ptr425 = mbt_ffi_str2ptr(payload423.pattern) - mbt_ffi_store32(iter_base + 20, payload423.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr425) - cleanup_list.push(ptr424) - cleanup_list.push(ptr425) + let ptr427 = mbt_ffi_str2ptr(payload425.pattern) + mbt_ffi_store32(iter_base + 20, payload425.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr427) + cleanup_list.push(ptr426) + cleanup_list.push(ptr427) () } - PropContains(payload426) => { + PropContains(payload428) => { mbt_ffi_store8(iter_base + 0, 10) - let ptr427 = mbt_ffi_str2ptr(payload426.property_name) + let ptr429 = mbt_ffi_str2ptr(payload428.property_name) mbt_ffi_store32( iter_base + 12, - payload426.property_name.length(), + payload428.property_name.length(), ) - mbt_ffi_store32(iter_base + 8, ptr427) + mbt_ffi_store32(iter_base + 8, ptr429) - let ptr428 = mbt_ffi_str2ptr(payload426.pattern) - mbt_ffi_store32(iter_base + 20, payload426.pattern.length()) - mbt_ffi_store32(iter_base + 16, ptr428) - cleanup_list.push(ptr427) - cleanup_list.push(ptr428) + let ptr430 = mbt_ffi_str2ptr(payload428.pattern) + mbt_ffi_store32(iter_base + 20, payload428.pattern.length()) + mbt_ffi_store32(iter_base + 16, ptr430) + cleanup_list.push(ptr429) + cleanup_list.push(ptr430) () } - PredAnd(payload429) => { + PredAnd(payload431) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload429.0) - mbt_ffi_store32(iter_base + 12, payload429.1) + mbt_ffi_store32(iter_base + 8, payload431.0) + mbt_ffi_store32(iter_base + 12, payload431.1) () } - PredOr(payload430) => { + PredOr(payload432) => { mbt_ffi_store8(iter_base + 0, 12) - mbt_ffi_store32(iter_base + 8, payload430.0) - mbt_ffi_store32(iter_base + 12, payload430.1) + mbt_ffi_store32(iter_base + 8, payload432.0) + mbt_ffi_store32(iter_base + 12, payload432.1) () } - PredNot(payload431) => { + PredNot(payload433) => { mbt_ffi_store8(iter_base + 0, 13) - mbt_ffi_store32(iter_base + 8, payload431) + mbt_ffi_store32(iter_base + 8, payload433) () } @@ -4258,91 +4266,91 @@ pub fn enrich_oplog_entries( } mbt_ffi_store32( iter_base + 12, - payload373.predicate.nodes.length(), + payload375.predicate.nodes.length(), ) - mbt_ffi_store32(iter_base + 8, address434) - mbt_ffi_store32(iter_base + 16, payload373.inner) - cleanup_list.push(address434) + mbt_ffi_store32(iter_base + 8, address436) + mbt_ffi_store32(iter_base + 16, payload375.inner) + cleanup_list.push(address436) () } - AndThen(payload436) => { + AndThen(payload438) => { mbt_ffi_store8(iter_base + 0, 11) - mbt_ffi_store32(iter_base + 8, payload436.0) - mbt_ffi_store32(iter_base + 12, payload436.1) + mbt_ffi_store32(iter_base + 8, payload438.0) + mbt_ffi_store32(iter_base + 12, payload438.1) () } - PolicyUnion(payload437) => { + PolicyUnion(payload439) => { mbt_ffi_store8(iter_base + 0, 12) - mbt_ffi_store32(iter_base + 8, payload437.0) - mbt_ffi_store32(iter_base + 12, payload437.1) + mbt_ffi_store32(iter_base + 8, payload439.0) + mbt_ffi_store32(iter_base + 12, payload439.1) () } - PolicyIntersect(payload438) => { + PolicyIntersect(payload440) => { mbt_ffi_store8(iter_base + 0, 13) - mbt_ffi_store32(iter_base + 8, payload438.0) - mbt_ffi_store32(iter_base + 12, payload438.1) + mbt_ffi_store32(iter_base + 8, payload440.0) + mbt_ffi_store32(iter_base + 12, payload440.1) () } } } - mbt_ffi_store32(iter_base + 56, payload299.policy.policy.nodes.length()) - mbt_ffi_store32(iter_base + 52, address439) - cleanup_list.push(ptr300) - cleanup_list.push(address361) - cleanup_list.push(address439) + mbt_ffi_store32(iter_base + 56, payload301.policy.policy.nodes.length()) + mbt_ffi_store32(iter_base + 52, address441) + cleanup_list.push(ptr302) + cleanup_list.push(address363) + cleanup_list.push(address441) () } - RemoveRetryPolicy(payload441) => { + RemoveRetryPolicy(payload443) => { mbt_ffi_store8(iter_base + 8, 39) - mbt_ffi_store64(iter_base + 16, payload441.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload443.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload441.timestamp.nanoseconds.reinterpret_as_int(), + payload443.timestamp.nanoseconds.reinterpret_as_int(), ) - let ptr442 = mbt_ffi_str2ptr(payload441.name) - mbt_ffi_store32(iter_base + 36, payload441.name.length()) - mbt_ffi_store32(iter_base + 32, ptr442) - cleanup_list.push(ptr442) + let ptr444 = mbt_ffi_str2ptr(payload443.name) + mbt_ffi_store32(iter_base + 36, payload443.name.length()) + mbt_ffi_store32(iter_base + 32, ptr444) + cleanup_list.push(ptr444) () } - CardEventQueued(payload443) => { + CardEventQueued(payload445) => { mbt_ffi_store8(iter_base + 8, 40) - mbt_ffi_store64(iter_base + 16, payload443.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload445.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload443.timestamp.nanoseconds.reinterpret_as_int(), + payload445.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload443.event { - Install(payload444) => { + match payload445.event { + Install(payload446) => { mbt_ffi_store8(iter_base + 32, 0) mbt_ffi_store64( iter_base + 40, - payload444.card_id.uuid.high_bits.reinterpret_as_int64(), + payload446.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload444.card_id.uuid.low_bits.reinterpret_as_int64(), + payload446.card_id.uuid.low_bits.reinterpret_as_int64(), ) () } - Revoke(payload445) => { + Revoke(payload447) => { mbt_ffi_store8(iter_base + 32, 1) mbt_ffi_store64( iter_base + 40, - payload445.card_id.uuid.high_bits.reinterpret_as_int64(), + payload447.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload445.card_id.uuid.low_bits.reinterpret_as_int64(), + payload447.card_id.uuid.low_bits.reinterpret_as_int64(), ) () @@ -4351,140 +4359,140 @@ pub fn enrich_oplog_entries( () } - CardInstalled(payload446) => { + CardInstalled(payload448) => { mbt_ffi_store8(iter_base + 8, 41) - mbt_ffi_store64(iter_base + 16, payload446.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload448.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload446.timestamp.nanoseconds.reinterpret_as_int(), + payload448.timestamp.nanoseconds.reinterpret_as_int(), ) - match payload446.queued_event_index { + match payload448.queued_event_index { None => { mbt_ffi_store8(iter_base + 32, 0) () } - Some(payload448) => { + Some(payload450) => { mbt_ffi_store8(iter_base + 32, 1) - mbt_ffi_store64(iter_base + 40, payload448.reinterpret_as_int64()) + mbt_ffi_store64(iter_base + 40, payload450.reinterpret_as_int64()) () } } - let ptr449 = mbt_ffi_bytes2ptr(payload446.card) + let ptr451 = mbt_ffi_bytes2ptr(payload448.card) - mbt_ffi_store32(iter_base + 52, payload446.card.length()) - mbt_ffi_store32(iter_base + 48, ptr449) - cleanup_list.push(ptr449) + mbt_ffi_store32(iter_base + 52, payload448.card.length()) + mbt_ffi_store32(iter_base + 48, ptr451) + cleanup_list.push(ptr451) () } - CardInstallFailed(payload450) => { + CardInstallFailed(payload452) => { mbt_ffi_store8(iter_base + 8, 42) - mbt_ffi_store64(iter_base + 16, payload450.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload452.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload450.timestamp.nanoseconds.reinterpret_as_int(), + payload452.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload450.queued_event_index.reinterpret_as_int64(), + payload452.queued_event_index.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload450.card_id.uuid.high_bits.reinterpret_as_int64(), + payload452.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload450.card_id.uuid.low_bits.reinterpret_as_int64(), + payload452.card_id.uuid.low_bits.reinterpret_as_int64(), ) - mbt_ffi_store8(iter_base + 56, payload450.reason.ordinal()) + mbt_ffi_store8(iter_base + 56, payload452.reason.ordinal()) () } - CardRevoked(payload451) => { + CardRevoked(payload453) => { mbt_ffi_store8(iter_base + 8, 43) - mbt_ffi_store64(iter_base + 16, payload451.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload453.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload451.timestamp.nanoseconds.reinterpret_as_int(), + payload453.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload451.queued_event_index.reinterpret_as_int64(), + payload453.queued_event_index.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload451.card_id.uuid.high_bits.reinterpret_as_int64(), + payload453.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 48, - payload451.card_id.uuid.low_bits.reinterpret_as_int64(), + payload453.card_id.uuid.low_bits.reinterpret_as_int64(), ) () } - CardExpired(payload452) => { + CardExpired(payload454) => { mbt_ffi_store8(iter_base + 8, 44) - mbt_ffi_store64(iter_base + 16, payload452.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload454.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload452.timestamp.nanoseconds.reinterpret_as_int(), + payload454.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload452.card_id.uuid.high_bits.reinterpret_as_int64(), + payload454.card_id.uuid.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 40, - payload452.card_id.uuid.low_bits.reinterpret_as_int64(), + payload454.card_id.uuid.low_bits.reinterpret_as_int64(), ) () } - HostStreamFrame(payload453) => { + HostStreamFrame(payload455) => { mbt_ffi_store8(iter_base + 8, 45) - mbt_ffi_store64(iter_base + 16, payload453.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload455.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload453.timestamp.nanoseconds.reinterpret_as_int(), + payload455.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload453.parent_start_index.reinterpret_as_int64(), + payload455.parent_start_index.reinterpret_as_int64(), ) - mbt_ffi_store8(iter_base + 40, payload453.kind.ordinal()) + mbt_ffi_store8(iter_base + 40, payload455.kind.ordinal()) - match payload453.payload { - Inline(payload454) => { + match payload455.payload { + Inline(payload456) => { mbt_ffi_store8(iter_base + 48, 0) - let ptr455 = mbt_ffi_bytes2ptr(payload454) + let ptr457 = mbt_ffi_bytes2ptr(payload456) - mbt_ffi_store32(iter_base + 60, payload454.length()) - mbt_ffi_store32(iter_base + 56, ptr455) - cleanup_list.push(ptr455) + mbt_ffi_store32(iter_base + 60, payload456.length()) + mbt_ffi_store32(iter_base + 56, ptr457) + cleanup_list.push(ptr457) () } - External(payload456) => { + External(payload458) => { mbt_ffi_store8(iter_base + 48, 1) mbt_ffi_store64( iter_base + 56, - payload456.payload_id.high_bits.reinterpret_as_int64(), + payload458.payload_id.high_bits.reinterpret_as_int64(), ) mbt_ffi_store64( iter_base + 64, - payload456.payload_id.low_bits.reinterpret_as_int64(), + payload458.payload_id.low_bits.reinterpret_as_int64(), ) - let ptr457 = mbt_ffi_bytes2ptr(payload456.md5_hash) + let ptr459 = mbt_ffi_bytes2ptr(payload458.md5_hash) - mbt_ffi_store32(iter_base + 76, payload456.md5_hash.length()) - mbt_ffi_store32(iter_base + 72, ptr457) - cleanup_list.push(ptr457) + mbt_ffi_store32(iter_base + 76, payload458.md5_hash.length()) + mbt_ffi_store32(iter_base + 72, ptr459) + cleanup_list.push(ptr459) () } @@ -4492,16 +4500,16 @@ pub fn enrich_oplog_entries( () } - CompletionDiscarded(payload458) => { + CompletionDiscarded(payload460) => { mbt_ffi_store8(iter_base + 8, 46) - mbt_ffi_store64(iter_base + 16, payload458.timestamp.seconds) + mbt_ffi_store64(iter_base + 16, payload460.timestamp.seconds) mbt_ffi_store32( iter_base + 24, - payload458.timestamp.nanoseconds.reinterpret_as_int(), + payload460.timestamp.nanoseconds.reinterpret_as_int(), ) mbt_ffi_store64( iter_base + 32, - payload458.start_index.reinterpret_as_int64(), + payload460.start_index.reinterpret_as_int64(), ) () @@ -4516,21 +4524,21 @@ pub fn enrich_oplog_entries( agent_id.component_id.uuid.low_bits.reinterpret_as_int64(), ptr, agent_id.agent_id.length(), - address459, + address461, entries.length(), component_revision.reinterpret_as_int64(), return_area, ) - let lifted3301 = match mbt_ffi_load8_u(return_area + 0) { + let lifted3303 = match mbt_ffi_load8_u(return_area + 0) { 0 => { - let array3298 : Array[PublicOplogEntry] = [] - for index3299 = 0 - index3299 < mbt_ffi_load32(return_area + 8) - index3299 = index3299 + 1 { - let iter_base = mbt_ffi_load32(return_area + 4) + index3299 * 208 + let array3300 : Array[PublicOplogEntry] = [] + for index3301 = 0 + index3301 < mbt_ffi_load32(return_area + 8) + index3301 = index3301 + 1 { + let iter_base = mbt_ffi_load32(return_area + 4) + index3301 * 208 - let lifted3297 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3299 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { let result = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), @@ -4538,22 +4546,22 @@ pub fn enrich_oplog_entries( ) let array : Array[(String, String)] = [] - for index463 = 0 - index463 < mbt_ffi_load32(iter_base + 68) - index463 = index463 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 64) + index463 * 16 + for index465 = 0 + index465 < mbt_ffi_load32(iter_base + 68) + index465 = index465 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 64) + index465 * 16 - let result461 = mbt_ffi_ptr2str( + let result463 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result462 = mbt_ffi_ptr2str( + let result464 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array.push((result461, result462)) + array.push((result463, result464)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) @@ -4561,7 +4569,7 @@ pub fn enrich_oplog_entries( mbt_ffi_load8_u(iter_base + 104) { 0 => Option::None 1 => { - let result464 = mbt_ffi_ptr2str( + let result466 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 128), mbt_ffi_load32(iter_base + 132), ) @@ -4573,49 +4581,49 @@ pub fn enrich_oplog_entries( low_bits: mbt_ffi_load64(iter_base + 120).reinterpret_as_uint64(), }, }, - agent_id: result464, + agent_id: result466, }) } _ => panic() } - let array471 : Array[PluginInstallationDescription] = [] - for index472 = 0 - index472 < mbt_ffi_load32(iter_base + 156) - index472 = index472 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 152) + index472 * 48 + let array473 : Array[PluginInstallationDescription] = [] + for index474 = 0 + index474 < mbt_ffi_load32(iter_base + 156) + index474 = index474 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 152) + index474 * 48 - let result465 = mbt_ffi_ptr2str( + let result467 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - let result466 = mbt_ffi_ptr2str( + let result468 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - let array469 : Array[(String, String)] = [] - for index470 = 0 - index470 < mbt_ffi_load32(iter_base + 40) - index470 = index470 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index470 * 16 + let array471 : Array[(String, String)] = [] + for index472 = 0 + index472 < mbt_ffi_load32(iter_base + 40) + index472 = index472 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index472 * 16 - let result467 = mbt_ffi_ptr2str( + let result469 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result468 = mbt_ffi_ptr2str( + let result470 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array469.push((result467, result468)) + array471.push((result469, result470)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - array471.push(PluginInstallationDescription::{ + array473.push(PluginInstallationDescription::{ environment_plugin_grant_id: EnvironmentPluginGrantId::{ uuid: @types.Uuid::{ high_bits: mbt_ffi_load64(iter_base + 0).reinterpret_as_uint64(), @@ -4623,56 +4631,56 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 16), - plugin_name: result465, - plugin_version: result466, - parameters: array469, + plugin_name: result467, + plugin_version: result468, + parameters: array471, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 152)) - let array710 : Array[LocalAgentConfigEntry] = [] - for index711 = 0 - index711 < mbt_ffi_load32(iter_base + 164) - index711 = index711 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 160) + index711 * 40 + let array712 : Array[LocalAgentConfigEntry] = [] + for index713 = 0 + index713 < mbt_ffi_load32(iter_base + 164) + index713 = index713 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 160) + index713 * 40 - let array474 : Array[String] = [] - for index475 = 0 - index475 < mbt_ffi_load32(iter_base + 4) - index475 = index475 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 0) + index475 * 8 + let array476 : Array[String] = [] + for index477 = 0 + index477 < mbt_ffi_load32(iter_base + 4) + index477 = index477 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 0) + index477 * 8 - let result473 = mbt_ffi_ptr2str( + let result475 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array474.push(result473) + array476.push(result475) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - let array672 : Array[@types.SchemaTypeNode] = [] - for index673 = 0 - index673 < mbt_ffi_load32(iter_base + 12) - index673 = index673 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index673 * 144 + let array674 : Array[@types.SchemaTypeNode] = [] + for index675 = 0 + index675 < mbt_ffi_load32(iter_base + 12) + index675 = index675 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index675 * 144 - let lifted658 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted660 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted482 : @types.NumericRestrictions? = match + let lifted484 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted477 : @types.NumericBound? = match + let lifted479 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted476 = match + let lifted478 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -4689,16 +4697,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted476) + Option::Some(lifted478) } _ => panic() } - let lifted479 : @types.NumericBound? = match + let lifted481 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted478 = match + let lifted480 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -4715,128 +4723,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted478) + Option::Some(lifted480) } _ => panic() } - let lifted481 : String? = match + let lifted483 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result480 = mbt_ffi_ptr2str( + let result482 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result480) + Option::Some(result482) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted477, - max: lifted479, - unit: lifted481, + min: lifted479, + max: lifted481, + unit: lifted483, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted482) + @types.SchemaTypeBody::S8Type(lifted484) } 3 => { - let lifted489 : @types.NumericRestrictions? = match + let lifted491 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted484 : @types.NumericBound? = match - mbt_ffi_load8_u(iter_base + 16) { - 0 => Option::None - 1 => { - let lifted483 = match - mbt_ffi_load8_u(iter_base + 24) { - 0 => - @types.NumericBound::Signed( - mbt_ffi_load64(iter_base + 32), - ) - 1 => - @types.NumericBound::Unsigned( - mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), - ) - 2 => - @types.NumericBound::FloatBits( - mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), - ) - _ => panic() - } - - Option::Some(lifted483) - } - _ => panic() - } - let lifted486 : @types.NumericBound? = match - mbt_ffi_load8_u(iter_base + 40) { - 0 => Option::None - 1 => { - let lifted485 = match - mbt_ffi_load8_u(iter_base + 48) { - 0 => - @types.NumericBound::Signed( - mbt_ffi_load64(iter_base + 56), - ) - 1 => - @types.NumericBound::Unsigned( - mbt_ffi_load64(iter_base + 56).reinterpret_as_uint64(), - ) - 2 => - @types.NumericBound::FloatBits( - mbt_ffi_load64(iter_base + 56).reinterpret_as_uint64(), - ) - _ => panic() - } - - Option::Some(lifted485) - } - _ => panic() - } - - let lifted488 : String? = match - mbt_ffi_load8_u(iter_base + 64) { - 0 => Option::None - 1 => { - let result487 = mbt_ffi_ptr2str( - mbt_ffi_load32(iter_base + 68), - mbt_ffi_load32(iter_base + 72), - ) - - Option::Some(result487) - } - _ => panic() - } - - Option::Some(@types.NumericRestrictions::{ - min: lifted484, - max: lifted486, - unit: lifted488, - }) - } - _ => panic() - } - - @types.SchemaTypeBody::S16Type(lifted489) - } - 4 => { - let lifted496 : @types.NumericRestrictions? = match - mbt_ffi_load8_u(iter_base + 8) { - 0 => Option::None - 1 => { - let lifted491 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted490 = match + let lifted485 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -4853,16 +4779,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted490) + Option::Some(lifted485) } _ => panic() } - let lifted493 : @types.NumericBound? = match + let lifted488 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted492 = match + let lifted487 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -4879,46 +4805,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted492) + Option::Some(lifted487) } _ => panic() } - let lifted495 : String? = match + let lifted490 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result494 = mbt_ffi_ptr2str( + let result489 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result494) + Option::Some(result489) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted491, - max: lifted493, - unit: lifted495, + min: lifted486, + max: lifted488, + unit: lifted490, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted496) + @types.SchemaTypeBody::S16Type(lifted491) } - 5 => { - let lifted503 : @types.NumericRestrictions? = match + 4 => { + let lifted498 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted498 : @types.NumericBound? = match + let lifted493 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted497 = match + let lifted492 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -4935,16 +4861,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted497) + Option::Some(lifted492) } _ => panic() } - let lifted500 : @types.NumericBound? = match + let lifted495 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted499 = match + let lifted494 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -4961,46 +4887,128 @@ pub fn enrich_oplog_entries( _ => panic() } + Option::Some(lifted494) + } + _ => panic() + } + + let lifted497 : String? = match + mbt_ffi_load8_u(iter_base + 64) { + 0 => Option::None + 1 => { + let result496 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 68), + mbt_ffi_load32(iter_base + 72), + ) + + Option::Some(result496) + } + _ => panic() + } + + Option::Some(@types.NumericRestrictions::{ + min: lifted493, + max: lifted495, + unit: lifted497, + }) + } + _ => panic() + } + + @types.SchemaTypeBody::S32Type(lifted498) + } + 5 => { + let lifted505 : @types.NumericRestrictions? = match + mbt_ffi_load8_u(iter_base + 8) { + 0 => Option::None + 1 => { + let lifted500 : @types.NumericBound? = match + mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let lifted499 = match + mbt_ffi_load8_u(iter_base + 24) { + 0 => + @types.NumericBound::Signed( + mbt_ffi_load64(iter_base + 32), + ) + 1 => + @types.NumericBound::Unsigned( + mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), + ) + 2 => + @types.NumericBound::FloatBits( + mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), + ) + _ => panic() + } + Option::Some(lifted499) } _ => panic() } - let lifted502 : String? = match + let lifted502 : @types.NumericBound? = match + mbt_ffi_load8_u(iter_base + 40) { + 0 => Option::None + 1 => { + let lifted501 = match + mbt_ffi_load8_u(iter_base + 48) { + 0 => + @types.NumericBound::Signed( + mbt_ffi_load64(iter_base + 56), + ) + 1 => + @types.NumericBound::Unsigned( + mbt_ffi_load64(iter_base + 56).reinterpret_as_uint64(), + ) + 2 => + @types.NumericBound::FloatBits( + mbt_ffi_load64(iter_base + 56).reinterpret_as_uint64(), + ) + _ => panic() + } + + Option::Some(lifted501) + } + _ => panic() + } + + let lifted504 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result501 = mbt_ffi_ptr2str( + let result503 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result501) + Option::Some(result503) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted498, - max: lifted500, - unit: lifted502, + min: lifted500, + max: lifted502, + unit: lifted504, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted503) + @types.SchemaTypeBody::S64Type(lifted505) } 6 => { - let lifted510 : @types.NumericRestrictions? = match + let lifted512 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted505 : @types.NumericBound? = match + let lifted507 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted504 = match + let lifted506 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5017,16 +5025,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted504) + Option::Some(lifted506) } _ => panic() } - let lifted507 : @types.NumericBound? = match + let lifted509 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted506 = match + let lifted508 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5043,46 +5051,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted506) + Option::Some(lifted508) } _ => panic() } - let lifted509 : String? = match + let lifted511 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result508 = mbt_ffi_ptr2str( + let result510 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result508) + Option::Some(result510) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted505, - max: lifted507, - unit: lifted509, + min: lifted507, + max: lifted509, + unit: lifted511, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted510) + @types.SchemaTypeBody::U8Type(lifted512) } 7 => { - let lifted517 : @types.NumericRestrictions? = match + let lifted519 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted512 : @types.NumericBound? = match + let lifted514 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted511 = match + let lifted513 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5099,16 +5107,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted511) + Option::Some(lifted513) } _ => panic() } - let lifted514 : @types.NumericBound? = match + let lifted516 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted513 = match + let lifted515 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5125,46 +5133,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted513) + Option::Some(lifted515) } _ => panic() } - let lifted516 : String? = match + let lifted518 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result515 = mbt_ffi_ptr2str( + let result517 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result515) + Option::Some(result517) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted512, - max: lifted514, - unit: lifted516, + min: lifted514, + max: lifted516, + unit: lifted518, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted517) + @types.SchemaTypeBody::U16Type(lifted519) } 8 => { - let lifted524 : @types.NumericRestrictions? = match + let lifted526 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted519 : @types.NumericBound? = match + let lifted521 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted518 = match + let lifted520 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5181,16 +5189,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted518) + Option::Some(lifted520) } _ => panic() } - let lifted521 : @types.NumericBound? = match + let lifted523 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted520 = match + let lifted522 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5207,46 +5215,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted520) + Option::Some(lifted522) } _ => panic() } - let lifted523 : String? = match + let lifted525 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result522 = mbt_ffi_ptr2str( + let result524 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result522) + Option::Some(result524) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted519, - max: lifted521, - unit: lifted523, + min: lifted521, + max: lifted523, + unit: lifted525, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted524) + @types.SchemaTypeBody::U32Type(lifted526) } 9 => { - let lifted531 : @types.NumericRestrictions? = match + let lifted533 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted526 : @types.NumericBound? = match + let lifted528 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted525 = match + let lifted527 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5263,16 +5271,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted525) + Option::Some(lifted527) } _ => panic() } - let lifted528 : @types.NumericBound? = match + let lifted530 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted527 = match + let lifted529 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5289,46 +5297,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted527) + Option::Some(lifted529) } _ => panic() } - let lifted530 : String? = match + let lifted532 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result529 = mbt_ffi_ptr2str( + let result531 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result529) + Option::Some(result531) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted526, - max: lifted528, - unit: lifted530, + min: lifted528, + max: lifted530, + unit: lifted532, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted531) + @types.SchemaTypeBody::U64Type(lifted533) } 10 => { - let lifted538 : @types.NumericRestrictions? = match + let lifted540 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted533 : @types.NumericBound? = match + let lifted535 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted532 = match + let lifted534 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5345,16 +5353,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted532) + Option::Some(lifted534) } _ => panic() } - let lifted535 : @types.NumericBound? = match + let lifted537 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted534 = match + let lifted536 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5371,46 +5379,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted534) + Option::Some(lifted536) } _ => panic() } - let lifted537 : String? = match + let lifted539 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result536 = mbt_ffi_ptr2str( + let result538 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result536) + Option::Some(result538) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted533, - max: lifted535, - unit: lifted537, + min: lifted535, + max: lifted537, + unit: lifted539, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted538) + @types.SchemaTypeBody::F32Type(lifted540) } 11 => { - let lifted545 : @types.NumericRestrictions? = match + let lifted547 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted540 : @types.NumericBound? = match + let lifted542 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted539 = match + let lifted541 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -5427,16 +5435,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted539) + Option::Some(lifted541) } _ => panic() } - let lifted542 : @types.NumericBound? = match + let lifted544 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted541 = match + let lifted543 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -5453,324 +5461,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted541) + Option::Some(lifted543) } _ => panic() } - let lifted544 : String? = match + let lifted546 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result543 = mbt_ffi_ptr2str( + let result545 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result543) + Option::Some(result545) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted540, - max: lifted542, - unit: lifted544, + min: lifted542, + max: lifted544, + unit: lifted546, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted545) + @types.SchemaTypeBody::F64Type(lifted547) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array560 : Array[@types.NamedFieldType] = [] - for index561 = 0 - index561 < mbt_ffi_load32(iter_base + 12) - index561 = index561 + 1 { + let array562 : Array[@types.NamedFieldType] = [] + for index563 = 0 + index563 < mbt_ffi_load32(iter_base + 12) + index563 = index563 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index561 * 68 + index563 * 68 - let result546 = mbt_ffi_ptr2str( + let result548 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted548 : String? = match + let lifted550 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result547 = mbt_ffi_ptr2str( + let result549 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result547) + Option::Some(result549) } _ => panic() } - let array550 : Array[String] = [] - for index551 = 0 - index551 < mbt_ffi_load32(iter_base + 28) - index551 = index551 + 1 { + let array552 : Array[String] = [] + for index553 = 0 + index553 < mbt_ffi_load32(iter_base + 28) + index553 = index553 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index551 * 8 + index553 * 8 - let result549 = mbt_ffi_ptr2str( + let result551 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array550.push(result549) + array552.push(result551) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array553 : Array[String] = [] - for index554 = 0 - index554 < mbt_ffi_load32(iter_base + 36) - index554 = index554 + 1 { + let array555 : Array[String] = [] + for index556 = 0 + index556 < mbt_ffi_load32(iter_base + 36) + index556 = index556 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index554 * 8 + index556 * 8 - let result552 = mbt_ffi_ptr2str( + let result554 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array553.push(result552) + array555.push(result554) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted556 : String? = match + let lifted558 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result555 = mbt_ffi_ptr2str( + let result557 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result555) + Option::Some(result557) } _ => panic() } - let lifted559 : @types.Role? = match + let lifted561 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted558 = match + let lifted560 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result557 = mbt_ffi_ptr2str( + let result559 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result557) + @types.Role::Other(result559) } _ => panic() } - Option::Some(lifted558) + Option::Some(lifted560) } _ => panic() } - array560.push(@types.NamedFieldType::{ - name: result546, + array562.push(@types.NamedFieldType::{ + name: result548, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted548, - aliases: array550, - examples: array553, - deprecated: lifted556, - role: lifted559, + doc: lifted550, + aliases: array552, + examples: array555, + deprecated: lifted558, + role: lifted561, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array560) + @types.SchemaTypeBody::RecordType(array562) } 15 => { - let array577 : Array[@types.VariantCaseType] = [] - for index578 = 0 - index578 < mbt_ffi_load32(iter_base + 12) - index578 = index578 + 1 { + let array579 : Array[@types.VariantCaseType] = [] + for index580 = 0 + index580 < mbt_ffi_load32(iter_base + 12) + index580 = index580 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index578 * 72 + index580 * 72 - let result562 = mbt_ffi_ptr2str( + let result564 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted563 : Int? = match + let lifted565 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted565 : String? = match + let lifted567 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result564 = mbt_ffi_ptr2str( + let result566 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result564) + Option::Some(result566) } _ => panic() } - let array567 : Array[String] = [] - for index568 = 0 - index568 < mbt_ffi_load32(iter_base + 32) - index568 = index568 + 1 { + let array569 : Array[String] = [] + for index570 = 0 + index570 < mbt_ffi_load32(iter_base + 32) + index570 = index570 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index568 * 8 + index570 * 8 - let result566 = mbt_ffi_ptr2str( + let result568 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array567.push(result566) + array569.push(result568) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array570 : Array[String] = [] - for index571 = 0 - index571 < mbt_ffi_load32(iter_base + 40) - index571 = index571 + 1 { + let array572 : Array[String] = [] + for index573 = 0 + index573 < mbt_ffi_load32(iter_base + 40) + index573 = index573 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index571 * 8 + index573 * 8 - let result569 = mbt_ffi_ptr2str( + let result571 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array570.push(result569) + array572.push(result571) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted573 : String? = match + let lifted575 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result572 = mbt_ffi_ptr2str( + let result574 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result572) + Option::Some(result574) } _ => panic() } - let lifted576 : @types.Role? = match + let lifted578 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted575 = match + let lifted577 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result574 = mbt_ffi_ptr2str( + let result576 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result574) + @types.Role::Other(result576) } _ => panic() } - Option::Some(lifted575) + Option::Some(lifted577) } _ => panic() } - array577.push(@types.VariantCaseType::{ - name: result562, - payload: lifted563, + array579.push(@types.VariantCaseType::{ + name: result564, + payload: lifted565, metadata: @types.MetadataEnvelope::{ - doc: lifted565, - aliases: array567, - examples: array570, - deprecated: lifted573, - role: lifted576, + doc: lifted567, + aliases: array569, + examples: array572, + deprecated: lifted575, + role: lifted578, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array577) + @types.SchemaTypeBody::VariantType(array579) } 16 => { - let array580 : Array[String] = [] - for index581 = 0 - index581 < mbt_ffi_load32(iter_base + 12) - index581 = index581 + 1 { + let array582 : Array[String] = [] + for index583 = 0 + index583 < mbt_ffi_load32(iter_base + 12) + index583 = index583 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index581 * 8 + index583 * 8 - let result579 = mbt_ffi_ptr2str( + let result581 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array580.push(result579) + array582.push(result581) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array580) + @types.SchemaTypeBody::EnumType(array582) } 17 => { - let array583 : Array[String] = [] - for index584 = 0 - index584 < mbt_ffi_load32(iter_base + 12) - index584 = index584 + 1 { + let array585 : Array[String] = [] + for index586 = 0 + index586 < mbt_ffi_load32(iter_base + 12) + index586 = index586 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index584 * 8 + index586 * 8 - let result582 = mbt_ffi_ptr2str( + let result584 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array583.push(result582) + array585.push(result584) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array583) + @types.SchemaTypeBody::FlagsType(array585) } 18 => { - let array585 : Array[Int] = [] - for index586 = 0 - index586 < mbt_ffi_load32(iter_base + 12) - index586 = index586 + 1 { + let array587 : Array[Int] = [] + for index588 = 0 + index588 < mbt_ffi_load32(iter_base + 12) + index588 = index588 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index586 * 4 + index588 * 4 - array585.push(mbt_ffi_load32(iter_base + 0)) + array587.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array585) + @types.SchemaTypeBody::TupleType(array587) } 19 => @types.SchemaTypeBody::ListType( @@ -5791,14 +5799,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted587 : Int? = match + let lifted589 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted588 : Int? = match + let lifted590 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -5806,37 +5814,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted587, - err: lifted588, + ok: lifted589, + err: lifted590, }) } 24 => { - let lifted592 : Array[String]? = match + let lifted594 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array590 : Array[String] = [] - for index591 = 0 - index591 < mbt_ffi_load32(iter_base + 16) - index591 = index591 + 1 { + let array592 : Array[String] = [] + for index593 = 0 + index593 < mbt_ffi_load32(iter_base + 16) + index593 = index593 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index591 * 8 + index593 * 8 - let result589 = mbt_ffi_ptr2str( + let result591 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array590.push(result589) + array592.push(result591) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array590) + Option::Some(array592) } _ => panic() } - let lifted593 : UInt? = match + let lifted595 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -5846,7 +5854,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted594 : UInt? = match + let lifted596 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -5856,54 +5864,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted596 : String? = match + let lifted598 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result595 = mbt_ffi_ptr2str( + let result597 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result595) + Option::Some(result597) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted592, - min_length: lifted593, - max_length: lifted594, - regex: lifted596, + languages: lifted594, + min_length: lifted595, + max_length: lifted596, + regex: lifted598, }) } 25 => { - let lifted600 : Array[String]? = match + let lifted602 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array598 : Array[String] = [] - for index599 = 0 - index599 < mbt_ffi_load32(iter_base + 16) - index599 = index599 + 1 { + let array600 : Array[String] = [] + for index601 = 0 + index601 < mbt_ffi_load32(iter_base + 16) + index601 = index601 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index599 * 8 + index601 * 8 - let result597 = mbt_ffi_ptr2str( + let result599 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array598.push(result597) + array600.push(result599) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array598) + Option::Some(array600) } _ => panic() } - let lifted601 : UInt? = match + let lifted603 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -5913,7 +5921,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted602 : UInt? = match + let lifted604 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -5924,58 +5932,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted600, - min_bytes: lifted601, - max_bytes: lifted602, + mime_types: lifted602, + min_bytes: lifted603, + max_bytes: lifted604, }) } 26 => { - let lifted606 : Array[String]? = match + let lifted608 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array604 : Array[String] = [] - for index605 = 0 - index605 < mbt_ffi_load32(iter_base + 20) - index605 = index605 + 1 { + let array606 : Array[String] = [] + for index607 = 0 + index607 < mbt_ffi_load32(iter_base + 20) + index607 = index607 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index605 * 8 + index607 * 8 - let result603 = mbt_ffi_ptr2str( + let result605 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array604.push(result603) + array606.push(result605) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array604) + Option::Some(array606) } _ => panic() } - let lifted610 : Array[String]? = match + let lifted612 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array608 : Array[String] = [] - for index609 = 0 - index609 < mbt_ffi_load32(iter_base + 32) - index609 = index609 + 1 { + let array610 : Array[String] = [] + for index611 = 0 + index611 < mbt_ffi_load32(iter_base + 32) + index611 = index611 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index609 * 8 + index611 * 8 - let result607 = mbt_ffi_ptr2str( + let result609 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array608.push(result607) + array610.push(result609) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array608) + Option::Some(array610) } _ => panic() } @@ -5987,95 +5995,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted606, - allowed_extensions: lifted610, + allowed_mime_types: lifted608, + allowed_extensions: lifted612, }) } 27 => { - let lifted614 : Array[String]? = match + let lifted616 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array612 : Array[String] = [] - for index613 = 0 - index613 < mbt_ffi_load32(iter_base + 16) - index613 = index613 + 1 { + let array614 : Array[String] = [] + for index615 = 0 + index615 < mbt_ffi_load32(iter_base + 16) + index615 = index615 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index613 * 8 + index615 * 8 - let result611 = mbt_ffi_ptr2str( + let result613 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array612.push(result611) + array614.push(result613) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array612) + Option::Some(array614) } _ => panic() } - let lifted618 : Array[String]? = match + let lifted620 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array616 : Array[String] = [] - for index617 = 0 - index617 < mbt_ffi_load32(iter_base + 28) - index617 = index617 + 1 { + let array618 : Array[String] = [] + for index619 = 0 + index619 < mbt_ffi_load32(iter_base + 28) + index619 = index619 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index617 * 8 + index619 * 8 - let result615 = mbt_ffi_ptr2str( + let result617 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array616.push(result615) + array618.push(result617) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array616) + Option::Some(array618) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted614, - allowed_hosts: lifted618, + allowed_schemes: lifted616, + allowed_hosts: lifted620, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result619 = mbt_ffi_ptr2str( + let result621 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array621 : Array[String] = [] - for index622 = 0 - index622 < mbt_ffi_load32(iter_base + 20) - index622 = index622 + 1 { + let array623 : Array[String] = [] + for index624 = 0 + index624 < mbt_ffi_load32(iter_base + 20) + index624 = index624 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index622 * 8 + index624 * 8 - let result620 = mbt_ffi_ptr2str( + let result622 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array621.push(result620) + array623.push(result622) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted624 : @types.QuantityValue? = match + let lifted626 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result623 = mbt_ffi_ptr2str( + let result625 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -6083,17 +6091,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result623, + unit: result625, }) } _ => panic() } - let lifted626 : @types.QuantityValue? = match + let lifted628 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result625 = mbt_ffi_ptr2str( + let result627 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -6101,401 +6109,401 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result625, + unit: result627, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result619, - allowed_suffixes: array621, - min: lifted624, - max: lifted626, + base_unit: result621, + allowed_suffixes: array623, + min: lifted626, + max: lifted628, }) } 31 => { - let array650 : Array[@types.UnionBranch] = [] - for index651 = 0 - index651 < mbt_ffi_load32(iter_base + 12) - index651 = index651 + 1 { + let array652 : Array[@types.UnionBranch] = [] + for index653 = 0 + index653 < mbt_ffi_load32(iter_base + 12) + index653 = index653 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index651 * 92 + index653 * 92 - let result627 = mbt_ffi_ptr2str( + let result629 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted636 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted638 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result628 = mbt_ffi_ptr2str( + let result630 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result628) + @types.DiscriminatorRule::Prefix(result630) } 1 => { - let result629 = mbt_ffi_ptr2str( + let result631 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result629) + @types.DiscriminatorRule::Suffix(result631) } 2 => { - let result630 = mbt_ffi_ptr2str( + let result632 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result630) + @types.DiscriminatorRule::Contains(result632) } 3 => { - let result631 = mbt_ffi_ptr2str( + let result633 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result631) + @types.DiscriminatorRule::Regex(result633) } 4 => { - let result632 = mbt_ffi_ptr2str( + let result634 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted634 : String? = match + let lifted636 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result633 = mbt_ffi_ptr2str( + let result635 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result633) + Option::Some(result635) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result632, - literal: lifted634, + field_name: result634, + literal: lifted636, }) } 5 => { - let result635 = mbt_ffi_ptr2str( + let result637 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result635) + @types.DiscriminatorRule::FieldAbsent(result637) } _ => panic() } - let lifted638 : String? = match + let lifted640 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result637 = mbt_ffi_ptr2str( + let result639 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result637) + Option::Some(result639) } _ => panic() } - let array640 : Array[String] = [] - for index641 = 0 - index641 < mbt_ffi_load32(iter_base + 52) - index641 = index641 + 1 { + let array642 : Array[String] = [] + for index643 = 0 + index643 < mbt_ffi_load32(iter_base + 52) + index643 = index643 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index641 * 8 + index643 * 8 - let result639 = mbt_ffi_ptr2str( + let result641 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array640.push(result639) + array642.push(result641) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array643 : Array[String] = [] - for index644 = 0 - index644 < mbt_ffi_load32(iter_base + 60) - index644 = index644 + 1 { + let array645 : Array[String] = [] + for index646 = 0 + index646 < mbt_ffi_load32(iter_base + 60) + index646 = index646 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index644 * 8 + index646 * 8 - let result642 = mbt_ffi_ptr2str( + let result644 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array643.push(result642) + array645.push(result644) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted646 : String? = match + let lifted648 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result645 = mbt_ffi_ptr2str( + let result647 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result645) + Option::Some(result647) } _ => panic() } - let lifted649 : @types.Role? = match + let lifted651 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted648 = match + let lifted650 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result647 = mbt_ffi_ptr2str( + let result649 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result647) + @types.Role::Other(result649) } _ => panic() } - Option::Some(lifted648) + Option::Some(lifted650) } _ => panic() } - array650.push(@types.UnionBranch::{ - tag: result627, + array652.push(@types.UnionBranch::{ + tag: result629, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted636, + discriminator: lifted638, metadata: @types.MetadataEnvelope::{ - doc: lifted638, - aliases: array640, - examples: array643, - deprecated: lifted646, - role: lifted649, + doc: lifted640, + aliases: array642, + examples: array645, + deprecated: lifted648, + role: lifted651, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array650, + branches: array652, }) } 32 => { - let lifted653 : String? = match + let lifted655 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result652 = mbt_ffi_ptr2str( + let result654 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result652) + Option::Some(result654) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted653, + category: lifted655, }) } 33 => { - let lifted655 : String? = match + let lifted657 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result654 = mbt_ffi_ptr2str( + let result656 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result654) + Option::Some(result656) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted655, + resource_name: lifted657, }) } 34 => { - let lifted656 : Int? = match + let lifted658 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted656) + @types.SchemaTypeBody::FutureType(lifted658) } 35 => { - let lifted657 : Int? = match + let lifted659 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted657) + @types.SchemaTypeBody::StreamType(lifted659) } _ => panic() } - let lifted660 : String? = match + let lifted662 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result659 = mbt_ffi_ptr2str( + let result661 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result659) + Option::Some(result661) } _ => panic() } - let array662 : Array[String] = [] - for index663 = 0 - index663 < mbt_ffi_load32(iter_base + 104) - index663 = index663 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index663 * 8 + let array664 : Array[String] = [] + for index665 = 0 + index665 < mbt_ffi_load32(iter_base + 104) + index665 = index665 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index665 * 8 - let result661 = mbt_ffi_ptr2str( + let result663 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array662.push(result661) + array664.push(result663) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array665 : Array[String] = [] - for index666 = 0 - index666 < mbt_ffi_load32(iter_base + 112) - index666 = index666 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index666 * 8 + let array667 : Array[String] = [] + for index668 = 0 + index668 < mbt_ffi_load32(iter_base + 112) + index668 = index668 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index668 * 8 - let result664 = mbt_ffi_ptr2str( + let result666 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array665.push(result664) + array667.push(result666) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted668 : String? = match + let lifted670 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result667 = mbt_ffi_ptr2str( + let result669 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result667) + Option::Some(result669) } _ => panic() } - let lifted671 : @types.Role? = match + let lifted673 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted670 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted672 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result669 = mbt_ffi_ptr2str( + let result671 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result669) + @types.Role::Other(result671) } _ => panic() } - Option::Some(lifted670) + Option::Some(lifted672) } _ => panic() } - array672.push(@types.SchemaTypeNode::{ - body: lifted658, + array674.push(@types.SchemaTypeNode::{ + body: lifted660, metadata: @types.MetadataEnvelope::{ - doc: lifted660, - aliases: array662, - examples: array665, - deprecated: lifted668, - role: lifted671, + doc: lifted662, + aliases: array664, + examples: array667, + deprecated: lifted670, + role: lifted673, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - let array677 : Array[@types.SchemaTypeDef] = [] - for index678 = 0 - index678 < mbt_ffi_load32(iter_base + 20) - index678 = index678 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 16) + index678 * 24 + let array679 : Array[@types.SchemaTypeDef] = [] + for index680 = 0 + index680 < mbt_ffi_load32(iter_base + 20) + index680 = index680 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 16) + index680 * 24 - let result674 = mbt_ffi_ptr2str( + let result676 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted676 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted678 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result675 = mbt_ffi_ptr2str( + let result677 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result675) + Option::Some(result677) } _ => panic() } - array677.push(@types.SchemaTypeDef::{ - id: result674, - name: lifted676, + array679.push(@types.SchemaTypeDef::{ + id: result676, + name: lifted678, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let array708 : Array[@types.SchemaValueNode] = [] - for index709 = 0 - index709 < mbt_ffi_load32(iter_base + 32) - index709 = index709 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 28) + index709 * 32 + let array710 : Array[@types.SchemaValueNode] = [] + for index711 = 0 + index711 < mbt_ffi_load32(iter_base + 32) + index711 = index711 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 28) + index711 * 32 - let lifted707 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted709 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -6547,29 +6555,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result679 = mbt_ffi_ptr2str( + let result681 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result679) + @types.SchemaValueNode::StringValue(result681) } 13 => { - let array680 : Array[Int] = [] - for index681 = 0 - index681 < mbt_ffi_load32(iter_base + 12) - index681 = index681 + 1 { + let array682 : Array[Int] = [] + for index683 = 0 + index683 < mbt_ffi_load32(iter_base + 12) + index683 = index683 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index681 * 4 + index683 * 4 - array680.push(mbt_ffi_load32(iter_base + 0)) + array682.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array680) + @types.SchemaValueNode::RecordValue(array682) } 14 => { - let lifted682 : Int? = match + let lifted684 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -6578,7 +6586,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted682, + payload: lifted684, }) } 15 => @@ -6586,34 +6594,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array683 : Array[Bool] = [] - for index684 = 0 - index684 < mbt_ffi_load32(iter_base + 12) - index684 = index684 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index684 * 1 - - array683.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array683) - } - 17 => { - let array685 : Array[Int] = [] + let array685 : Array[Bool] = [] for index686 = 0 index686 < mbt_ffi_load32(iter_base + 12) index686 = index686 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index686 * 4 + index686 * 1 - array685.push(mbt_ffi_load32(iter_base + 0)) + array685.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array685) + @types.SchemaValueNode::FlagsValue(array685) } - 18 => { + 17 => { let array687 : Array[Int] = [] for index688 = 0 index688 < mbt_ffi_load32(iter_base + 12) @@ -6625,9 +6619,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array687) + @types.SchemaValueNode::TupleValue(array687) } - 19 => { + 18 => { let array689 : Array[Int] = [] for index690 = 0 index690 < mbt_ffi_load32(iter_base + 12) @@ -6639,127 +6633,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array689) + @types.SchemaValueNode::ListValue(array689) } - 20 => { - let array691 : Array[@types.MapEntry] = [] + 19 => { + let array691 : Array[Int] = [] for index692 = 0 index692 < mbt_ffi_load32(iter_base + 12) index692 = index692 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index692 * 8 + index692 * 4 - array691.push(@types.MapEntry::{ + array691.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array691) + } + 20 => { + let array693 : Array[@types.MapEntry] = [] + for index694 = 0 + index694 < mbt_ffi_load32(iter_base + 12) + index694 = index694 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index694 * 8 + + array693.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array691) + @types.SchemaValueNode::MapValue(array693) } 21 => { - let lifted693 : Int? = match + let lifted695 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted693) + @types.SchemaValueNode::OptionValue(lifted695) } 22 => { - let lifted696 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted698 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted694 : Int? = match + let lifted696 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted694) + @types.ResultValuePayload::OkValue(lifted696) } 1 => { - let lifted695 : Int? = match + let lifted697 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted695) + @types.ResultValuePayload::ErrValue(lifted697) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted696) + @types.SchemaValueNode::ResultValue(lifted698) } 23 => { - let result697 = mbt_ffi_ptr2str( + let result699 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted699 : String? = match + let lifted701 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result698 = mbt_ffi_ptr2str( + let result700 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result698) + Option::Some(result700) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result697, - language: lifted699, + text: result699, + language: lifted701, }) } 24 => { - let result700 = mbt_ffi_ptr2bytes( + let result702 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted702 : String? = match + let lifted704 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result701 = mbt_ffi_ptr2str( + let result703 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result701) + Option::Some(result703) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result700, - mime_type: lifted702, + bytes: result702, + mime_type: lifted704, }) } 25 => { - let result703 = mbt_ffi_ptr2str( + let result705 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result703) + @types.SchemaValueNode::PathValue(result705) } 26 => { - let result704 = mbt_ffi_ptr2str( + let result706 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result704) + @types.SchemaValueNode::UrlValue(result706) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -6771,7 +6779,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result705 = mbt_ffi_ptr2str( + let result707 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -6779,17 +6787,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result705, + unit: result707, }) } 30 => { - let result706 = mbt_ffi_ptr2str( + let result708 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result706, + tag: result708, body: mbt_ffi_load32(iter_base + 16), }) } @@ -6803,23 +6811,29 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array708.push(lifted707) + array710.push(lifted709) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - array710.push(LocalAgentConfigEntry::{ - path: array474, + array712.push(LocalAgentConfigEntry::{ + path: array476, value: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array672, - defs: array677, + type_nodes: array674, + defs: array679, root: mbt_ffi_load32(iter_base + 24), }, value: @types.SchemaValueTree::{ - value_nodes: array708, + value_nodes: array710, root: mbt_ffi_load32(iter_base + 36), }, }, @@ -6827,7 +6841,7 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 160)) - let lifted712 : @types.Uuid? = match + let lifted714 : @types.Uuid? = match mbt_ffi_load8_u(iter_base + 168) { 0 => Option::None 1 => @@ -6870,9 +6884,9 @@ pub fn enrich_oplog_entries( parent: lifted, component_size: mbt_ffi_load64(iter_base + 136).reinterpret_as_uint64(), initial_total_linear_memory_size: mbt_ffi_load64(iter_base + 144).reinterpret_as_uint64(), - initial_active_plugins: array471, - local_agent_config: array710, - original_phantom_id: lifted712, + initial_active_plugins: array473, + local_agent_config: array712, + original_phantom_id: lifted714, instance_id: @types.Uuid::{ high_bits: mbt_ffi_load64(iter_base + 192).reinterpret_as_uint64(), low_bits: mbt_ffi_load64(iter_base + 200).reinterpret_as_uint64(), @@ -6880,7 +6894,7 @@ pub fn enrich_oplog_entries( }) } 1 => { - let lifted713 : UInt64? = match mbt_ffi_load8_u(iter_base + 24) { + let lifted715 : UInt64? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => Option::Some( @@ -6889,12 +6903,12 @@ pub fn enrich_oplog_entries( _ => panic() } - let result714 = mbt_ffi_ptr2str( + let result716 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - let lifted715 : @types.Uuid? = match + let lifted717 : @types.Uuid? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -6905,7 +6919,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted716 : UInt64? = match mbt_ffi_load8_u(iter_base + 72) { + let lifted718 : UInt64? = match mbt_ffi_load8_u(iter_base + 72) { 0 => Option::None 1 => Option::Some( @@ -6914,33 +6928,33 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted951 : @types.TypedSchemaValue? = match + let lifted953 : @types.TypedSchemaValue? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let array913 : Array[@types.SchemaTypeNode] = [] - for index914 = 0 - index914 < mbt_ffi_load32(iter_base + 96) - index914 = index914 + 1 { + let array915 : Array[@types.SchemaTypeNode] = [] + for index916 = 0 + index916 < mbt_ffi_load32(iter_base + 96) + index916 = index916 + 1 { let iter_base = mbt_ffi_load32(iter_base + 92) + - index914 * 144 + index916 * 144 - let lifted899 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted901 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted723 : @types.NumericRestrictions? = match + let lifted725 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted718 : @types.NumericBound? = match + let lifted720 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted717 = match + let lifted719 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -6957,16 +6971,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted717) + Option::Some(lifted719) } _ => panic() } - let lifted720 : @types.NumericBound? = match + let lifted722 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted719 = match + let lifted721 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -6983,46 +6997,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted719) + Option::Some(lifted721) } _ => panic() } - let lifted722 : String? = match + let lifted724 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result721 = mbt_ffi_ptr2str( + let result723 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result721) + Option::Some(result723) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted718, - max: lifted720, - unit: lifted722, + min: lifted720, + max: lifted722, + unit: lifted724, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted723) + @types.SchemaTypeBody::S8Type(lifted725) } 3 => { - let lifted730 : @types.NumericRestrictions? = match + let lifted732 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted725 : @types.NumericBound? = match + let lifted727 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted724 = match + let lifted726 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7039,16 +7053,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted724) + Option::Some(lifted726) } _ => panic() } - let lifted727 : @types.NumericBound? = match + let lifted729 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted726 = match + let lifted728 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7065,46 +7079,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted726) + Option::Some(lifted728) } _ => panic() } - let lifted729 : String? = match + let lifted731 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result728 = mbt_ffi_ptr2str( + let result730 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result728) + Option::Some(result730) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted725, - max: lifted727, - unit: lifted729, + min: lifted727, + max: lifted729, + unit: lifted731, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted730) + @types.SchemaTypeBody::S16Type(lifted732) } 4 => { - let lifted737 : @types.NumericRestrictions? = match + let lifted739 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted732 : @types.NumericBound? = match + let lifted734 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted731 = match + let lifted733 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7121,16 +7135,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted731) + Option::Some(lifted733) } _ => panic() } - let lifted734 : @types.NumericBound? = match + let lifted736 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted733 = match + let lifted735 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7147,46 +7161,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted733) + Option::Some(lifted735) } _ => panic() } - let lifted736 : String? = match + let lifted738 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result735 = mbt_ffi_ptr2str( + let result737 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result735) + Option::Some(result737) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted732, - max: lifted734, - unit: lifted736, + min: lifted734, + max: lifted736, + unit: lifted738, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted737) + @types.SchemaTypeBody::S32Type(lifted739) } 5 => { - let lifted744 : @types.NumericRestrictions? = match + let lifted746 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted739 : @types.NumericBound? = match + let lifted741 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted738 = match + let lifted740 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7203,16 +7217,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted738) + Option::Some(lifted740) } _ => panic() } - let lifted741 : @types.NumericBound? = match + let lifted743 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted740 = match + let lifted742 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7229,46 +7243,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted740) + Option::Some(lifted742) } _ => panic() } - let lifted743 : String? = match + let lifted745 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result742 = mbt_ffi_ptr2str( + let result744 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result742) + Option::Some(result744) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted739, - max: lifted741, - unit: lifted743, + min: lifted741, + max: lifted743, + unit: lifted745, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted744) + @types.SchemaTypeBody::S64Type(lifted746) } 6 => { - let lifted751 : @types.NumericRestrictions? = match + let lifted753 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted746 : @types.NumericBound? = match + let lifted748 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted745 = match + let lifted747 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7285,16 +7299,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted745) + Option::Some(lifted747) } _ => panic() } - let lifted748 : @types.NumericBound? = match + let lifted750 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted747 = match + let lifted749 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7311,46 +7325,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted747) + Option::Some(lifted749) } _ => panic() } - let lifted750 : String? = match + let lifted752 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result749 = mbt_ffi_ptr2str( + let result751 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result749) + Option::Some(result751) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted746, - max: lifted748, - unit: lifted750, + min: lifted748, + max: lifted750, + unit: lifted752, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted751) + @types.SchemaTypeBody::U8Type(lifted753) } 7 => { - let lifted758 : @types.NumericRestrictions? = match + let lifted760 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted753 : @types.NumericBound? = match + let lifted755 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted752 = match + let lifted754 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7367,16 +7381,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted752) + Option::Some(lifted754) } _ => panic() } - let lifted755 : @types.NumericBound? = match + let lifted757 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted754 = match + let lifted756 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7393,46 +7407,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted754) + Option::Some(lifted756) } _ => panic() } - let lifted757 : String? = match + let lifted759 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result756 = mbt_ffi_ptr2str( + let result758 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result756) + Option::Some(result758) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted753, - max: lifted755, - unit: lifted757, + min: lifted755, + max: lifted757, + unit: lifted759, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted758) + @types.SchemaTypeBody::U16Type(lifted760) } 8 => { - let lifted765 : @types.NumericRestrictions? = match + let lifted767 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted760 : @types.NumericBound? = match + let lifted762 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted759 = match + let lifted761 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7449,16 +7463,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted759) + Option::Some(lifted761) } _ => panic() } - let lifted762 : @types.NumericBound? = match + let lifted764 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted761 = match + let lifted763 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7475,46 +7489,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted761) + Option::Some(lifted763) } _ => panic() } - let lifted764 : String? = match + let lifted766 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result763 = mbt_ffi_ptr2str( + let result765 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result763) + Option::Some(result765) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted760, - max: lifted762, - unit: lifted764, + min: lifted762, + max: lifted764, + unit: lifted766, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted765) + @types.SchemaTypeBody::U32Type(lifted767) } 9 => { - let lifted772 : @types.NumericRestrictions? = match + let lifted774 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted767 : @types.NumericBound? = match + let lifted769 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted766 = match + let lifted768 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7531,16 +7545,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted766) + Option::Some(lifted768) } _ => panic() } - let lifted769 : @types.NumericBound? = match + let lifted771 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted768 = match + let lifted770 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7557,46 +7571,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted768) + Option::Some(lifted770) } _ => panic() } - let lifted771 : String? = match + let lifted773 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result770 = mbt_ffi_ptr2str( + let result772 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result770) + Option::Some(result772) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted767, - max: lifted769, - unit: lifted771, + min: lifted769, + max: lifted771, + unit: lifted773, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted772) + @types.SchemaTypeBody::U64Type(lifted774) } 10 => { - let lifted779 : @types.NumericRestrictions? = match + let lifted781 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted774 : @types.NumericBound? = match + let lifted776 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted773 = match + let lifted775 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7613,16 +7627,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted773) + Option::Some(lifted775) } _ => panic() } - let lifted776 : @types.NumericBound? = match + let lifted778 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted775 = match + let lifted777 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7639,46 +7653,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted775) + Option::Some(lifted777) } _ => panic() } - let lifted778 : String? = match + let lifted780 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result777 = mbt_ffi_ptr2str( + let result779 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result777) + Option::Some(result779) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted774, - max: lifted776, - unit: lifted778, + min: lifted776, + max: lifted778, + unit: lifted780, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted779) + @types.SchemaTypeBody::F32Type(lifted781) } 11 => { - let lifted786 : @types.NumericRestrictions? = match + let lifted788 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted781 : @types.NumericBound? = match + let lifted783 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted780 = match + let lifted782 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -7695,16 +7709,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted780) + Option::Some(lifted782) } _ => panic() } - let lifted783 : @types.NumericBound? = match + let lifted785 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted782 = match + let lifted784 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -7721,324 +7735,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted782) + Option::Some(lifted784) } _ => panic() } - let lifted785 : String? = match + let lifted787 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result784 = mbt_ffi_ptr2str( + let result786 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result784) + Option::Some(result786) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted781, - max: lifted783, - unit: lifted785, + min: lifted783, + max: lifted785, + unit: lifted787, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted786) + @types.SchemaTypeBody::F64Type(lifted788) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array801 : Array[@types.NamedFieldType] = [] - for index802 = 0 - index802 < mbt_ffi_load32(iter_base + 12) - index802 = index802 + 1 { + let array803 : Array[@types.NamedFieldType] = [] + for index804 = 0 + index804 < mbt_ffi_load32(iter_base + 12) + index804 = index804 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index802 * 68 + index804 * 68 - let result787 = mbt_ffi_ptr2str( + let result789 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted789 : String? = match + let lifted791 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result788 = mbt_ffi_ptr2str( + let result790 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result788) + Option::Some(result790) } _ => panic() } - let array791 : Array[String] = [] - for index792 = 0 - index792 < mbt_ffi_load32(iter_base + 28) - index792 = index792 + 1 { + let array793 : Array[String] = [] + for index794 = 0 + index794 < mbt_ffi_load32(iter_base + 28) + index794 = index794 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index792 * 8 + index794 * 8 - let result790 = mbt_ffi_ptr2str( + let result792 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array791.push(result790) + array793.push(result792) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array794 : Array[String] = [] - for index795 = 0 - index795 < mbt_ffi_load32(iter_base + 36) - index795 = index795 + 1 { + let array796 : Array[String] = [] + for index797 = 0 + index797 < mbt_ffi_load32(iter_base + 36) + index797 = index797 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index795 * 8 + index797 * 8 - let result793 = mbt_ffi_ptr2str( + let result795 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array794.push(result793) + array796.push(result795) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted797 : String? = match + let lifted799 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result796 = mbt_ffi_ptr2str( + let result798 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result796) + Option::Some(result798) } _ => panic() } - let lifted800 : @types.Role? = match + let lifted802 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted799 = match + let lifted801 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result798 = mbt_ffi_ptr2str( + let result800 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result798) + @types.Role::Other(result800) } _ => panic() } - Option::Some(lifted799) + Option::Some(lifted801) } _ => panic() } - array801.push(@types.NamedFieldType::{ - name: result787, + array803.push(@types.NamedFieldType::{ + name: result789, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted789, - aliases: array791, - examples: array794, - deprecated: lifted797, - role: lifted800, + doc: lifted791, + aliases: array793, + examples: array796, + deprecated: lifted799, + role: lifted802, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array801) + @types.SchemaTypeBody::RecordType(array803) } 15 => { - let array818 : Array[@types.VariantCaseType] = [] - for index819 = 0 - index819 < mbt_ffi_load32(iter_base + 12) - index819 = index819 + 1 { + let array820 : Array[@types.VariantCaseType] = [] + for index821 = 0 + index821 < mbt_ffi_load32(iter_base + 12) + index821 = index821 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index819 * 72 + index821 * 72 - let result803 = mbt_ffi_ptr2str( + let result805 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted804 : Int? = match + let lifted806 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted806 : String? = match + let lifted808 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result805 = mbt_ffi_ptr2str( + let result807 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result805) + Option::Some(result807) } _ => panic() } - let array808 : Array[String] = [] - for index809 = 0 - index809 < mbt_ffi_load32(iter_base + 32) - index809 = index809 + 1 { + let array810 : Array[String] = [] + for index811 = 0 + index811 < mbt_ffi_load32(iter_base + 32) + index811 = index811 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index809 * 8 + index811 * 8 - let result807 = mbt_ffi_ptr2str( + let result809 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array808.push(result807) + array810.push(result809) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array811 : Array[String] = [] - for index812 = 0 - index812 < mbt_ffi_load32(iter_base + 40) - index812 = index812 + 1 { + let array813 : Array[String] = [] + for index814 = 0 + index814 < mbt_ffi_load32(iter_base + 40) + index814 = index814 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index812 * 8 + index814 * 8 - let result810 = mbt_ffi_ptr2str( + let result812 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array811.push(result810) + array813.push(result812) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted814 : String? = match + let lifted816 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result813 = mbt_ffi_ptr2str( + let result815 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result813) + Option::Some(result815) } _ => panic() } - let lifted817 : @types.Role? = match + let lifted819 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted816 = match + let lifted818 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result815 = mbt_ffi_ptr2str( + let result817 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result815) + @types.Role::Other(result817) } _ => panic() } - Option::Some(lifted816) + Option::Some(lifted818) } _ => panic() } - array818.push(@types.VariantCaseType::{ - name: result803, - payload: lifted804, + array820.push(@types.VariantCaseType::{ + name: result805, + payload: lifted806, metadata: @types.MetadataEnvelope::{ - doc: lifted806, - aliases: array808, - examples: array811, - deprecated: lifted814, - role: lifted817, + doc: lifted808, + aliases: array810, + examples: array813, + deprecated: lifted816, + role: lifted819, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array818) + @types.SchemaTypeBody::VariantType(array820) } 16 => { - let array821 : Array[String] = [] - for index822 = 0 - index822 < mbt_ffi_load32(iter_base + 12) - index822 = index822 + 1 { + let array823 : Array[String] = [] + for index824 = 0 + index824 < mbt_ffi_load32(iter_base + 12) + index824 = index824 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index822 * 8 + index824 * 8 - let result820 = mbt_ffi_ptr2str( + let result822 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array821.push(result820) + array823.push(result822) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array821) + @types.SchemaTypeBody::EnumType(array823) } 17 => { - let array824 : Array[String] = [] - for index825 = 0 - index825 < mbt_ffi_load32(iter_base + 12) - index825 = index825 + 1 { + let array826 : Array[String] = [] + for index827 = 0 + index827 < mbt_ffi_load32(iter_base + 12) + index827 = index827 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index825 * 8 + index827 * 8 - let result823 = mbt_ffi_ptr2str( + let result825 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array824.push(result823) + array826.push(result825) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array824) + @types.SchemaTypeBody::FlagsType(array826) } 18 => { - let array826 : Array[Int] = [] - for index827 = 0 - index827 < mbt_ffi_load32(iter_base + 12) - index827 = index827 + 1 { + let array828 : Array[Int] = [] + for index829 = 0 + index829 < mbt_ffi_load32(iter_base + 12) + index829 = index829 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index827 * 4 + index829 * 4 - array826.push(mbt_ffi_load32(iter_base + 0)) + array828.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array826) + @types.SchemaTypeBody::TupleType(array828) } 19 => @types.SchemaTypeBody::ListType( @@ -8059,14 +8073,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted828 : Int? = match + let lifted830 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted829 : Int? = match + let lifted831 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -8074,37 +8088,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted828, - err: lifted829, + ok: lifted830, + err: lifted831, }) } 24 => { - let lifted833 : Array[String]? = match + let lifted835 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array831 : Array[String] = [] - for index832 = 0 - index832 < mbt_ffi_load32(iter_base + 16) - index832 = index832 + 1 { + let array833 : Array[String] = [] + for index834 = 0 + index834 < mbt_ffi_load32(iter_base + 16) + index834 = index834 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index832 * 8 + index834 * 8 - let result830 = mbt_ffi_ptr2str( + let result832 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array831.push(result830) + array833.push(result832) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array831) + Option::Some(array833) } _ => panic() } - let lifted834 : UInt? = match + let lifted836 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -8114,7 +8128,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted835 : UInt? = match + let lifted837 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -8124,54 +8138,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted837 : String? = match + let lifted839 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result836 = mbt_ffi_ptr2str( + let result838 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result836) + Option::Some(result838) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted833, - min_length: lifted834, - max_length: lifted835, - regex: lifted837, + languages: lifted835, + min_length: lifted836, + max_length: lifted837, + regex: lifted839, }) } 25 => { - let lifted841 : Array[String]? = match + let lifted843 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array839 : Array[String] = [] - for index840 = 0 - index840 < mbt_ffi_load32(iter_base + 16) - index840 = index840 + 1 { + let array841 : Array[String] = [] + for index842 = 0 + index842 < mbt_ffi_load32(iter_base + 16) + index842 = index842 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index840 * 8 + index842 * 8 - let result838 = mbt_ffi_ptr2str( + let result840 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array839.push(result838) + array841.push(result840) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array839) + Option::Some(array841) } _ => panic() } - let lifted842 : UInt? = match + let lifted844 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -8181,7 +8195,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted843 : UInt? = match + let lifted845 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -8192,58 +8206,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted841, - min_bytes: lifted842, - max_bytes: lifted843, + mime_types: lifted843, + min_bytes: lifted844, + max_bytes: lifted845, }) } 26 => { - let lifted847 : Array[String]? = match + let lifted849 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array845 : Array[String] = [] - for index846 = 0 - index846 < mbt_ffi_load32(iter_base + 20) - index846 = index846 + 1 { + let array847 : Array[String] = [] + for index848 = 0 + index848 < mbt_ffi_load32(iter_base + 20) + index848 = index848 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index846 * 8 + index848 * 8 - let result844 = mbt_ffi_ptr2str( + let result846 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array845.push(result844) + array847.push(result846) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array845) + Option::Some(array847) } _ => panic() } - let lifted851 : Array[String]? = match + let lifted853 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array849 : Array[String] = [] - for index850 = 0 - index850 < mbt_ffi_load32(iter_base + 32) - index850 = index850 + 1 { + let array851 : Array[String] = [] + for index852 = 0 + index852 < mbt_ffi_load32(iter_base + 32) + index852 = index852 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index850 * 8 + index852 * 8 - let result848 = mbt_ffi_ptr2str( + let result850 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array849.push(result848) + array851.push(result850) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array849) + Option::Some(array851) } _ => panic() } @@ -8255,95 +8269,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted847, - allowed_extensions: lifted851, + allowed_mime_types: lifted849, + allowed_extensions: lifted853, }) } 27 => { - let lifted855 : Array[String]? = match + let lifted857 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array853 : Array[String] = [] - for index854 = 0 - index854 < mbt_ffi_load32(iter_base + 16) - index854 = index854 + 1 { + let array855 : Array[String] = [] + for index856 = 0 + index856 < mbt_ffi_load32(iter_base + 16) + index856 = index856 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index854 * 8 + index856 * 8 - let result852 = mbt_ffi_ptr2str( + let result854 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array853.push(result852) + array855.push(result854) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array853) + Option::Some(array855) } _ => panic() } - let lifted859 : Array[String]? = match + let lifted861 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array857 : Array[String] = [] - for index858 = 0 - index858 < mbt_ffi_load32(iter_base + 28) - index858 = index858 + 1 { + let array859 : Array[String] = [] + for index860 = 0 + index860 < mbt_ffi_load32(iter_base + 28) + index860 = index860 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index858 * 8 + index860 * 8 - let result856 = mbt_ffi_ptr2str( + let result858 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array857.push(result856) + array859.push(result858) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array857) + Option::Some(array859) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted855, - allowed_hosts: lifted859, + allowed_schemes: lifted857, + allowed_hosts: lifted861, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result860 = mbt_ffi_ptr2str( + let result862 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array862 : Array[String] = [] - for index863 = 0 - index863 < mbt_ffi_load32(iter_base + 20) - index863 = index863 + 1 { + let array864 : Array[String] = [] + for index865 = 0 + index865 < mbt_ffi_load32(iter_base + 20) + index865 = index865 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index863 * 8 + index865 * 8 - let result861 = mbt_ffi_ptr2str( + let result863 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array862.push(result861) + array864.push(result863) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted865 : @types.QuantityValue? = match + let lifted867 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result864 = mbt_ffi_ptr2str( + let result866 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -8351,17 +8365,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result864, + unit: result866, }) } _ => panic() } - let lifted867 : @types.QuantityValue? = match + let lifted869 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result866 = mbt_ffi_ptr2str( + let result868 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -8369,406 +8383,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result866, + unit: result868, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result860, - allowed_suffixes: array862, - min: lifted865, - max: lifted867, + base_unit: result862, + allowed_suffixes: array864, + min: lifted867, + max: lifted869, }) } 31 => { - let array891 : Array[@types.UnionBranch] = [] - for index892 = 0 - index892 < mbt_ffi_load32(iter_base + 12) - index892 = index892 + 1 { + let array893 : Array[@types.UnionBranch] = [] + for index894 = 0 + index894 < mbt_ffi_load32(iter_base + 12) + index894 = index894 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index892 * 92 + index894 * 92 - let result868 = mbt_ffi_ptr2str( + let result870 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted877 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted879 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result869 = mbt_ffi_ptr2str( + let result871 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result869) + @types.DiscriminatorRule::Prefix(result871) } 1 => { - let result870 = mbt_ffi_ptr2str( + let result872 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result870) + @types.DiscriminatorRule::Suffix(result872) } 2 => { - let result871 = mbt_ffi_ptr2str( + let result873 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result871) + @types.DiscriminatorRule::Contains(result873) } 3 => { - let result872 = mbt_ffi_ptr2str( + let result874 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result872) + @types.DiscriminatorRule::Regex(result874) } 4 => { - let result873 = mbt_ffi_ptr2str( + let result875 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted875 : String? = match + let lifted877 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result874 = mbt_ffi_ptr2str( + let result876 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result874) + Option::Some(result876) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result873, - literal: lifted875, + field_name: result875, + literal: lifted877, }) } 5 => { - let result876 = mbt_ffi_ptr2str( + let result878 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result876) + @types.DiscriminatorRule::FieldAbsent(result878) } _ => panic() } - let lifted879 : String? = match + let lifted881 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result878 = mbt_ffi_ptr2str( + let result880 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result878) + Option::Some(result880) } _ => panic() } - let array881 : Array[String] = [] - for index882 = 0 - index882 < mbt_ffi_load32(iter_base + 52) - index882 = index882 + 1 { + let array883 : Array[String] = [] + for index884 = 0 + index884 < mbt_ffi_load32(iter_base + 52) + index884 = index884 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index882 * 8 + index884 * 8 - let result880 = mbt_ffi_ptr2str( + let result882 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array881.push(result880) + array883.push(result882) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array884 : Array[String] = [] - for index885 = 0 - index885 < mbt_ffi_load32(iter_base + 60) - index885 = index885 + 1 { + let array886 : Array[String] = [] + for index887 = 0 + index887 < mbt_ffi_load32(iter_base + 60) + index887 = index887 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index885 * 8 + index887 * 8 - let result883 = mbt_ffi_ptr2str( + let result885 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array884.push(result883) + array886.push(result885) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted887 : String? = match + let lifted889 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result886 = mbt_ffi_ptr2str( + let result888 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result886) + Option::Some(result888) } _ => panic() } - let lifted890 : @types.Role? = match + let lifted892 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted889 = match + let lifted891 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result888 = mbt_ffi_ptr2str( + let result890 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result888) + @types.Role::Other(result890) } _ => panic() } - Option::Some(lifted889) + Option::Some(lifted891) } _ => panic() } - array891.push(@types.UnionBranch::{ - tag: result868, + array893.push(@types.UnionBranch::{ + tag: result870, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted877, + discriminator: lifted879, metadata: @types.MetadataEnvelope::{ - doc: lifted879, - aliases: array881, - examples: array884, - deprecated: lifted887, - role: lifted890, + doc: lifted881, + aliases: array883, + examples: array886, + deprecated: lifted889, + role: lifted892, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array891, + branches: array893, }) } 32 => { - let lifted894 : String? = match + let lifted896 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result893 = mbt_ffi_ptr2str( + let result895 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result893) + Option::Some(result895) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted894, + category: lifted896, }) } 33 => { - let lifted896 : String? = match + let lifted898 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result895 = mbt_ffi_ptr2str( + let result897 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result895) + Option::Some(result897) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted896, + resource_name: lifted898, }) } 34 => { - let lifted897 : Int? = match + let lifted899 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted897) + @types.SchemaTypeBody::FutureType(lifted899) } 35 => { - let lifted898 : Int? = match + let lifted900 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted898) + @types.SchemaTypeBody::StreamType(lifted900) } _ => panic() } - let lifted901 : String? = match + let lifted903 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result900 = mbt_ffi_ptr2str( + let result902 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result900) + Option::Some(result902) } _ => panic() } - let array903 : Array[String] = [] - for index904 = 0 - index904 < mbt_ffi_load32(iter_base + 104) - index904 = index904 + 1 { + let array905 : Array[String] = [] + for index906 = 0 + index906 < mbt_ffi_load32(iter_base + 104) + index906 = index906 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index904 * 8 + index906 * 8 - let result902 = mbt_ffi_ptr2str( + let result904 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array903.push(result902) + array905.push(result904) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array906 : Array[String] = [] - for index907 = 0 - index907 < mbt_ffi_load32(iter_base + 112) - index907 = index907 + 1 { + let array908 : Array[String] = [] + for index909 = 0 + index909 < mbt_ffi_load32(iter_base + 112) + index909 = index909 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index907 * 8 + index909 * 8 - let result905 = mbt_ffi_ptr2str( + let result907 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array906.push(result905) + array908.push(result907) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted909 : String? = match + let lifted911 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result908 = mbt_ffi_ptr2str( + let result910 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result908) + Option::Some(result910) } _ => panic() } - let lifted912 : @types.Role? = match + let lifted914 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted911 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted913 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result910 = mbt_ffi_ptr2str( + let result912 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result910) + @types.Role::Other(result912) } _ => panic() } - Option::Some(lifted911) + Option::Some(lifted913) } _ => panic() } - array913.push(@types.SchemaTypeNode::{ - body: lifted899, + array915.push(@types.SchemaTypeNode::{ + body: lifted901, metadata: @types.MetadataEnvelope::{ - doc: lifted901, - aliases: array903, - examples: array906, - deprecated: lifted909, - role: lifted912, + doc: lifted903, + aliases: array905, + examples: array908, + deprecated: lifted911, + role: lifted914, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 92)) - let array918 : Array[@types.SchemaTypeDef] = [] - for index919 = 0 - index919 < mbt_ffi_load32(iter_base + 104) - index919 = index919 + 1 { + let array920 : Array[@types.SchemaTypeDef] = [] + for index921 = 0 + index921 < mbt_ffi_load32(iter_base + 104) + index921 = index921 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index919 * 24 + index921 * 24 - let result915 = mbt_ffi_ptr2str( + let result917 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted917 : String? = match + let lifted919 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result916 = mbt_ffi_ptr2str( + let result918 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result916) + Option::Some(result918) } _ => panic() } - array918.push(@types.SchemaTypeDef::{ - id: result915, - name: lifted917, + array920.push(@types.SchemaTypeDef::{ + id: result917, + name: lifted919, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array949 : Array[@types.SchemaValueNode] = [] - for index950 = 0 - index950 < mbt_ffi_load32(iter_base + 116) - index950 = index950 + 1 { + let array951 : Array[@types.SchemaValueNode] = [] + for index952 = 0 + index952 < mbt_ffi_load32(iter_base + 116) + index952 = index952 + 1 { let iter_base = mbt_ffi_load32(iter_base + 112) + - index950 * 32 + index952 * 32 - let lifted948 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted950 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -8820,29 +8834,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result920 = mbt_ffi_ptr2str( + let result922 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result920) + @types.SchemaValueNode::StringValue(result922) } 13 => { - let array921 : Array[Int] = [] - for index922 = 0 - index922 < mbt_ffi_load32(iter_base + 12) - index922 = index922 + 1 { + let array923 : Array[Int] = [] + for index924 = 0 + index924 < mbt_ffi_load32(iter_base + 12) + index924 = index924 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index922 * 4 + index924 * 4 - array921.push(mbt_ffi_load32(iter_base + 0)) + array923.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array921) + @types.SchemaValueNode::RecordValue(array923) } 14 => { - let lifted923 : Int? = match + let lifted925 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -8851,7 +8865,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted923, + payload: lifted925, }) } 15 => @@ -8859,34 +8873,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array924 : Array[Bool] = [] - for index925 = 0 - index925 < mbt_ffi_load32(iter_base + 12) - index925 = index925 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index925 * 1 - - array924.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array924) - } - 17 => { - let array926 : Array[Int] = [] + let array926 : Array[Bool] = [] for index927 = 0 index927 < mbt_ffi_load32(iter_base + 12) index927 = index927 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index927 * 4 + index927 * 1 - array926.push(mbt_ffi_load32(iter_base + 0)) + array926.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array926) + @types.SchemaValueNode::FlagsValue(array926) } - 18 => { + 17 => { let array928 : Array[Int] = [] for index929 = 0 index929 < mbt_ffi_load32(iter_base + 12) @@ -8898,9 +8898,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array928) + @types.SchemaValueNode::TupleValue(array928) } - 19 => { + 18 => { let array930 : Array[Int] = [] for index931 = 0 index931 < mbt_ffi_load32(iter_base + 12) @@ -8912,127 +8912,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array930) + @types.SchemaValueNode::ListValue(array930) } - 20 => { - let array932 : Array[@types.MapEntry] = [] + 19 => { + let array932 : Array[Int] = [] for index933 = 0 index933 < mbt_ffi_load32(iter_base + 12) index933 = index933 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index933 * 8 + index933 * 4 + + array932.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - array932.push(@types.MapEntry::{ + @types.SchemaValueNode::FixedListValue(array932) + } + 20 => { + let array934 : Array[@types.MapEntry] = [] + for index935 = 0 + index935 < mbt_ffi_load32(iter_base + 12) + index935 = index935 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index935 * 8 + + array934.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array932) + @types.SchemaValueNode::MapValue(array934) } 21 => { - let lifted934 : Int? = match + let lifted936 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted934) + @types.SchemaValueNode::OptionValue(lifted936) } 22 => { - let lifted937 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted939 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted935 : Int? = match + let lifted937 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted935) + @types.ResultValuePayload::OkValue(lifted937) } 1 => { - let lifted936 : Int? = match + let lifted938 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted936) + @types.ResultValuePayload::ErrValue(lifted938) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted937) + @types.SchemaValueNode::ResultValue(lifted939) } 23 => { - let result938 = mbt_ffi_ptr2str( + let result940 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted940 : String? = match + let lifted942 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result939 = mbt_ffi_ptr2str( + let result941 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result939) + Option::Some(result941) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result938, - language: lifted940, + text: result940, + language: lifted942, }) } 24 => { - let result941 = mbt_ffi_ptr2bytes( + let result943 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted943 : String? = match + let lifted945 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result942 = mbt_ffi_ptr2str( + let result944 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result942) + Option::Some(result944) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result941, - mime_type: lifted943, + bytes: result943, + mime_type: lifted945, }) } 25 => { - let result944 = mbt_ffi_ptr2str( + let result946 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result944) + @types.SchemaValueNode::PathValue(result946) } 26 => { - let result945 = mbt_ffi_ptr2str( + let result947 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result945) + @types.SchemaValueNode::UrlValue(result947) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -9044,7 +9058,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result946 = mbt_ffi_ptr2str( + let result948 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -9052,17 +9066,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result946, + unit: result948, }) } 30 => { - let result947 = mbt_ffi_ptr2str( + let result949 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result947, + tag: result949, body: mbt_ffi_load32(iter_base + 16), }) } @@ -9076,21 +9090,27 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array949.push(lifted948) + array951.push(lifted950) } mbt_ffi_free(mbt_ffi_load32(iter_base + 112)) Option::Some(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array913, - defs: array918, + type_nodes: array915, + defs: array920, root: mbt_ffi_load32(iter_base + 108), }, value: @types.SchemaValueTree::{ - value_nodes: array949, + value_nodes: array951, root: mbt_ffi_load32(iter_base + 120), }, }) @@ -9098,13 +9118,13 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted954 = match mbt_ffi_load8_u(iter_base + 128) { + let lifted956 = match mbt_ffi_load8_u(iter_base + 128) { 0 => WrappedFunctionType::ReadLocal 1 => WrappedFunctionType::WriteLocal 2 => WrappedFunctionType::ReadRemote 3 => WrappedFunctionType::WriteRemote 4 => { - let lifted952 : UInt64? = match + let lifted954 : UInt64? = match mbt_ffi_load8_u(iter_base + 136) { 0 => Option::None 1 => @@ -9114,10 +9134,10 @@ pub fn enrich_oplog_entries( _ => panic() } - WrappedFunctionType::WriteRemoteBatched(lifted952) + WrappedFunctionType::WriteRemoteBatched(lifted954) } 5 => { - let lifted953 : UInt64? = match + let lifted955 : UInt64? = match mbt_ffi_load8_u(iter_base + 136) { 0 => Option::None 1 => @@ -9127,7 +9147,7 @@ pub fn enrich_oplog_entries( _ => panic() } - WrappedFunctionType::WriteRemoteTransaction(lifted953) + WrappedFunctionType::WriteRemoteTransaction(lifted955) } _ => panic() } @@ -9137,42 +9157,42 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - parent_start_index: lifted713, - function_name: result714, - invocation_id: lifted715, - observational_owner: lifted716, - request: lifted951, - durable_function_type: lifted954, + parent_start_index: lifted715, + function_name: result716, + invocation_id: lifted717, + observational_owner: lifted718, + request: lifted953, + durable_function_type: lifted956, }) } 2 => { - let lifted1189 : @types.TypedSchemaValue? = match + let lifted1191 : @types.TypedSchemaValue? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let array1151 : Array[@types.SchemaTypeNode] = [] - for index1152 = 0 - index1152 < mbt_ffi_load32(iter_base + 40) - index1152 = index1152 + 1 { + let array1153 : Array[@types.SchemaTypeNode] = [] + for index1154 = 0 + index1154 < mbt_ffi_load32(iter_base + 40) + index1154 = index1154 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1152 * 144 + index1154 * 144 - let lifted1137 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1139 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted961 : @types.NumericRestrictions? = match + let lifted963 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted956 : @types.NumericBound? = match + let lifted958 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted955 = match + let lifted957 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9189,16 +9209,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted955) + Option::Some(lifted957) } _ => panic() } - let lifted958 : @types.NumericBound? = match + let lifted960 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted957 = match + let lifted959 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9215,46 +9235,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted957) + Option::Some(lifted959) } _ => panic() } - let lifted960 : String? = match + let lifted962 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result959 = mbt_ffi_ptr2str( + let result961 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result959) + Option::Some(result961) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted956, - max: lifted958, - unit: lifted960, + min: lifted958, + max: lifted960, + unit: lifted962, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted961) + @types.SchemaTypeBody::S8Type(lifted963) } 3 => { - let lifted968 : @types.NumericRestrictions? = match + let lifted970 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted963 : @types.NumericBound? = match + let lifted965 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted962 = match + let lifted964 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9271,16 +9291,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted962) + Option::Some(lifted964) } _ => panic() } - let lifted965 : @types.NumericBound? = match + let lifted967 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted964 = match + let lifted966 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9297,46 +9317,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted964) + Option::Some(lifted966) } _ => panic() } - let lifted967 : String? = match + let lifted969 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result966 = mbt_ffi_ptr2str( + let result968 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result966) + Option::Some(result968) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted963, - max: lifted965, - unit: lifted967, + min: lifted965, + max: lifted967, + unit: lifted969, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted968) + @types.SchemaTypeBody::S16Type(lifted970) } 4 => { - let lifted975 : @types.NumericRestrictions? = match + let lifted977 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted970 : @types.NumericBound? = match + let lifted972 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted969 = match + let lifted971 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9353,16 +9373,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted969) + Option::Some(lifted971) } _ => panic() } - let lifted972 : @types.NumericBound? = match + let lifted974 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted971 = match + let lifted973 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9379,46 +9399,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted971) + Option::Some(lifted973) } _ => panic() } - let lifted974 : String? = match + let lifted976 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result973 = mbt_ffi_ptr2str( + let result975 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result973) + Option::Some(result975) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted970, - max: lifted972, - unit: lifted974, + min: lifted972, + max: lifted974, + unit: lifted976, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted975) + @types.SchemaTypeBody::S32Type(lifted977) } 5 => { - let lifted982 : @types.NumericRestrictions? = match + let lifted984 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted977 : @types.NumericBound? = match + let lifted979 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted976 = match + let lifted978 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9435,16 +9455,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted976) + Option::Some(lifted978) } _ => panic() } - let lifted979 : @types.NumericBound? = match + let lifted981 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted978 = match + let lifted980 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9461,46 +9481,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted978) + Option::Some(lifted980) } _ => panic() } - let lifted981 : String? = match + let lifted983 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result980 = mbt_ffi_ptr2str( + let result982 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result980) + Option::Some(result982) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted977, - max: lifted979, - unit: lifted981, + min: lifted979, + max: lifted981, + unit: lifted983, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted982) + @types.SchemaTypeBody::S64Type(lifted984) } 6 => { - let lifted989 : @types.NumericRestrictions? = match + let lifted991 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted984 : @types.NumericBound? = match + let lifted986 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted983 = match + let lifted985 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9517,16 +9537,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted983) + Option::Some(lifted985) } _ => panic() } - let lifted986 : @types.NumericBound? = match + let lifted988 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted985 = match + let lifted987 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9543,46 +9563,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted985) + Option::Some(lifted987) } _ => panic() } - let lifted988 : String? = match + let lifted990 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result987 = mbt_ffi_ptr2str( + let result989 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result987) + Option::Some(result989) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted984, - max: lifted986, - unit: lifted988, + min: lifted986, + max: lifted988, + unit: lifted990, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted989) + @types.SchemaTypeBody::U8Type(lifted991) } 7 => { - let lifted996 : @types.NumericRestrictions? = match + let lifted998 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted991 : @types.NumericBound? = match + let lifted993 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted990 = match + let lifted992 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9599,16 +9619,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted990) + Option::Some(lifted992) } _ => panic() } - let lifted993 : @types.NumericBound? = match + let lifted995 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted992 = match + let lifted994 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9625,46 +9645,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted992) + Option::Some(lifted994) } _ => panic() } - let lifted995 : String? = match + let lifted997 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result994 = mbt_ffi_ptr2str( + let result996 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result994) + Option::Some(result996) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted991, - max: lifted993, - unit: lifted995, + min: lifted993, + max: lifted995, + unit: lifted997, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted996) + @types.SchemaTypeBody::U16Type(lifted998) } 8 => { - let lifted1003 : @types.NumericRestrictions? = match + let lifted1005 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted998 : @types.NumericBound? = match + let lifted1000 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted997 = match + let lifted999 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9681,16 +9701,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted997) + Option::Some(lifted999) } _ => panic() } - let lifted1000 : @types.NumericBound? = match + let lifted1002 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted999 = match + let lifted1001 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9707,46 +9727,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted999) + Option::Some(lifted1001) } _ => panic() } - let lifted1002 : String? = match + let lifted1004 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1001 = mbt_ffi_ptr2str( + let result1003 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1001) + Option::Some(result1003) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted998, - max: lifted1000, - unit: lifted1002, + min: lifted1000, + max: lifted1002, + unit: lifted1004, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1003) + @types.SchemaTypeBody::U32Type(lifted1005) } 9 => { - let lifted1010 : @types.NumericRestrictions? = match + let lifted1012 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1005 : @types.NumericBound? = match + let lifted1007 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1004 = match + let lifted1006 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9763,16 +9783,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1004) + Option::Some(lifted1006) } _ => panic() } - let lifted1007 : @types.NumericBound? = match + let lifted1009 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1006 = match + let lifted1008 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9789,46 +9809,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1006) + Option::Some(lifted1008) } _ => panic() } - let lifted1009 : String? = match + let lifted1011 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1008 = mbt_ffi_ptr2str( + let result1010 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1008) + Option::Some(result1010) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1005, - max: lifted1007, - unit: lifted1009, + min: lifted1007, + max: lifted1009, + unit: lifted1011, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1010) + @types.SchemaTypeBody::U64Type(lifted1012) } 10 => { - let lifted1017 : @types.NumericRestrictions? = match + let lifted1019 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1012 : @types.NumericBound? = match + let lifted1014 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1011 = match + let lifted1013 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9845,16 +9865,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1011) + Option::Some(lifted1013) } _ => panic() } - let lifted1014 : @types.NumericBound? = match + let lifted1016 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1013 = match + let lifted1015 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9871,46 +9891,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1013) + Option::Some(lifted1015) } _ => panic() } - let lifted1016 : String? = match + let lifted1018 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1015 = mbt_ffi_ptr2str( + let result1017 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1015) + Option::Some(result1017) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1012, - max: lifted1014, - unit: lifted1016, + min: lifted1014, + max: lifted1016, + unit: lifted1018, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1017) + @types.SchemaTypeBody::F32Type(lifted1019) } 11 => { - let lifted1024 : @types.NumericRestrictions? = match + let lifted1026 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1019 : @types.NumericBound? = match + let lifted1021 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1018 = match + let lifted1020 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -9927,16 +9947,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1018) + Option::Some(lifted1020) } _ => panic() } - let lifted1021 : @types.NumericBound? = match + let lifted1023 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1020 = match + let lifted1022 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -9953,324 +9973,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1020) + Option::Some(lifted1022) } _ => panic() } - let lifted1023 : String? = match + let lifted1025 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1022 = mbt_ffi_ptr2str( + let result1024 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1022) + Option::Some(result1024) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1019, - max: lifted1021, - unit: lifted1023, + min: lifted1021, + max: lifted1023, + unit: lifted1025, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted1024) + @types.SchemaTypeBody::F64Type(lifted1026) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array1039 : Array[@types.NamedFieldType] = [] - for index1040 = 0 - index1040 < mbt_ffi_load32(iter_base + 12) - index1040 = index1040 + 1 { + let array1041 : Array[@types.NamedFieldType] = [] + for index1042 = 0 + index1042 < mbt_ffi_load32(iter_base + 12) + index1042 = index1042 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1040 * 68 + index1042 * 68 - let result1025 = mbt_ffi_ptr2str( + let result1027 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1027 : String? = match + let lifted1029 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1026 = mbt_ffi_ptr2str( + let result1028 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1026) + Option::Some(result1028) } _ => panic() } - let array1029 : Array[String] = [] - for index1030 = 0 - index1030 < mbt_ffi_load32(iter_base + 28) - index1030 = index1030 + 1 { + let array1031 : Array[String] = [] + for index1032 = 0 + index1032 < mbt_ffi_load32(iter_base + 28) + index1032 = index1032 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1030 * 8 + index1032 * 8 - let result1028 = mbt_ffi_ptr2str( + let result1030 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1029.push(result1028) + array1031.push(result1030) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array1032 : Array[String] = [] - for index1033 = 0 - index1033 < mbt_ffi_load32(iter_base + 36) - index1033 = index1033 + 1 { + let array1034 : Array[String] = [] + for index1035 = 0 + index1035 < mbt_ffi_load32(iter_base + 36) + index1035 = index1035 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index1033 * 8 + index1035 * 8 - let result1031 = mbt_ffi_ptr2str( + let result1033 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1032.push(result1031) + array1034.push(result1033) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted1035 : String? = match + let lifted1037 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result1034 = mbt_ffi_ptr2str( + let result1036 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result1034) + Option::Some(result1036) } _ => panic() } - let lifted1038 : @types.Role? = match + let lifted1040 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted1037 = match + let lifted1039 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1036 = mbt_ffi_ptr2str( + let result1038 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result1036) + @types.Role::Other(result1038) } _ => panic() } - Option::Some(lifted1037) + Option::Some(lifted1039) } _ => panic() } - array1039.push(@types.NamedFieldType::{ - name: result1025, + array1041.push(@types.NamedFieldType::{ + name: result1027, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted1027, - aliases: array1029, - examples: array1032, - deprecated: lifted1035, - role: lifted1038, + doc: lifted1029, + aliases: array1031, + examples: array1034, + deprecated: lifted1037, + role: lifted1040, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array1039) + @types.SchemaTypeBody::RecordType(array1041) } 15 => { - let array1056 : Array[@types.VariantCaseType] = [] - for index1057 = 0 - index1057 < mbt_ffi_load32(iter_base + 12) - index1057 = index1057 + 1 { + let array1058 : Array[@types.VariantCaseType] = [] + for index1059 = 0 + index1059 < mbt_ffi_load32(iter_base + 12) + index1059 = index1059 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1057 * 72 + index1059 * 72 - let result1041 = mbt_ffi_ptr2str( + let result1043 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1042 : Int? = match + let lifted1044 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1044 : String? = match + let lifted1046 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1043 = mbt_ffi_ptr2str( + let result1045 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1043) + Option::Some(result1045) } _ => panic() } - let array1046 : Array[String] = [] - for index1047 = 0 - index1047 < mbt_ffi_load32(iter_base + 32) - index1047 = index1047 + 1 { + let array1048 : Array[String] = [] + for index1049 = 0 + index1049 < mbt_ffi_load32(iter_base + 32) + index1049 = index1049 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1047 * 8 + index1049 * 8 - let result1045 = mbt_ffi_ptr2str( + let result1047 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1046.push(result1045) + array1048.push(result1047) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array1049 : Array[String] = [] - for index1050 = 0 - index1050 < mbt_ffi_load32(iter_base + 40) - index1050 = index1050 + 1 { + let array1051 : Array[String] = [] + for index1052 = 0 + index1052 < mbt_ffi_load32(iter_base + 40) + index1052 = index1052 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1050 * 8 + index1052 * 8 - let result1048 = mbt_ffi_ptr2str( + let result1050 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1049.push(result1048) + array1051.push(result1050) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted1052 : String? = match + let lifted1054 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result1051 = mbt_ffi_ptr2str( + let result1053 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result1051) + Option::Some(result1053) } _ => panic() } - let lifted1055 : @types.Role? = match + let lifted1057 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted1054 = match + let lifted1056 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1053 = mbt_ffi_ptr2str( + let result1055 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result1053) + @types.Role::Other(result1055) } _ => panic() } - Option::Some(lifted1054) + Option::Some(lifted1056) } _ => panic() } - array1056.push(@types.VariantCaseType::{ - name: result1041, - payload: lifted1042, + array1058.push(@types.VariantCaseType::{ + name: result1043, + payload: lifted1044, metadata: @types.MetadataEnvelope::{ - doc: lifted1044, - aliases: array1046, - examples: array1049, - deprecated: lifted1052, - role: lifted1055, + doc: lifted1046, + aliases: array1048, + examples: array1051, + deprecated: lifted1054, + role: lifted1057, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array1056) + @types.SchemaTypeBody::VariantType(array1058) } 16 => { - let array1059 : Array[String] = [] - for index1060 = 0 - index1060 < mbt_ffi_load32(iter_base + 12) - index1060 = index1060 + 1 { + let array1061 : Array[String] = [] + for index1062 = 0 + index1062 < mbt_ffi_load32(iter_base + 12) + index1062 = index1062 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1060 * 8 + index1062 * 8 - let result1058 = mbt_ffi_ptr2str( + let result1060 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1059.push(result1058) + array1061.push(result1060) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array1059) + @types.SchemaTypeBody::EnumType(array1061) } 17 => { - let array1062 : Array[String] = [] - for index1063 = 0 - index1063 < mbt_ffi_load32(iter_base + 12) - index1063 = index1063 + 1 { + let array1064 : Array[String] = [] + for index1065 = 0 + index1065 < mbt_ffi_load32(iter_base + 12) + index1065 = index1065 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1063 * 8 + index1065 * 8 - let result1061 = mbt_ffi_ptr2str( + let result1063 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1062.push(result1061) + array1064.push(result1063) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array1062) + @types.SchemaTypeBody::FlagsType(array1064) } 18 => { - let array1064 : Array[Int] = [] - for index1065 = 0 - index1065 < mbt_ffi_load32(iter_base + 12) - index1065 = index1065 + 1 { + let array1066 : Array[Int] = [] + for index1067 = 0 + index1067 < mbt_ffi_load32(iter_base + 12) + index1067 = index1067 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1065 * 4 + index1067 * 4 - array1064.push(mbt_ffi_load32(iter_base + 0)) + array1066.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array1064) + @types.SchemaTypeBody::TupleType(array1066) } 19 => @types.SchemaTypeBody::ListType( @@ -10291,14 +10311,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted1066 : Int? = match + let lifted1068 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1067 : Int? = match + let lifted1069 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -10306,37 +10326,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted1066, - err: lifted1067, + ok: lifted1068, + err: lifted1069, }) } 24 => { - let lifted1071 : Array[String]? = match + let lifted1073 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1069 : Array[String] = [] - for index1070 = 0 - index1070 < mbt_ffi_load32(iter_base + 16) - index1070 = index1070 + 1 { + let array1071 : Array[String] = [] + for index1072 = 0 + index1072 < mbt_ffi_load32(iter_base + 16) + index1072 = index1072 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1070 * 8 + index1072 * 8 - let result1068 = mbt_ffi_ptr2str( + let result1070 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1069.push(result1068) + array1071.push(result1070) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1069) + Option::Some(array1071) } _ => panic() } - let lifted1072 : UInt? = match + let lifted1074 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -10346,7 +10366,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1073 : UInt? = match + let lifted1075 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -10356,54 +10376,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1075 : String? = match + let lifted1077 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1074 = mbt_ffi_ptr2str( + let result1076 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1074) + Option::Some(result1076) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted1071, - min_length: lifted1072, - max_length: lifted1073, - regex: lifted1075, + languages: lifted1073, + min_length: lifted1074, + max_length: lifted1075, + regex: lifted1077, }) } 25 => { - let lifted1079 : Array[String]? = match + let lifted1081 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1077 : Array[String] = [] - for index1078 = 0 - index1078 < mbt_ffi_load32(iter_base + 16) - index1078 = index1078 + 1 { + let array1079 : Array[String] = [] + for index1080 = 0 + index1080 < mbt_ffi_load32(iter_base + 16) + index1080 = index1080 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1078 * 8 + index1080 * 8 - let result1076 = mbt_ffi_ptr2str( + let result1078 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1077.push(result1076) + array1079.push(result1078) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1077) + Option::Some(array1079) } _ => panic() } - let lifted1080 : UInt? = match + let lifted1082 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -10413,7 +10433,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1081 : UInt? = match + let lifted1083 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -10424,58 +10444,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted1079, - min_bytes: lifted1080, - max_bytes: lifted1081, + mime_types: lifted1081, + min_bytes: lifted1082, + max_bytes: lifted1083, }) } 26 => { - let lifted1085 : Array[String]? = match + let lifted1087 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array1083 : Array[String] = [] - for index1084 = 0 - index1084 < mbt_ffi_load32(iter_base + 20) - index1084 = index1084 + 1 { + let array1085 : Array[String] = [] + for index1086 = 0 + index1086 < mbt_ffi_load32(iter_base + 20) + index1086 = index1086 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1084 * 8 + index1086 * 8 - let result1082 = mbt_ffi_ptr2str( + let result1084 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1083.push(result1082) + array1085.push(result1084) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array1083) + Option::Some(array1085) } _ => panic() } - let lifted1089 : Array[String]? = match + let lifted1091 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array1087 : Array[String] = [] - for index1088 = 0 - index1088 < mbt_ffi_load32(iter_base + 32) - index1088 = index1088 + 1 { + let array1089 : Array[String] = [] + for index1090 = 0 + index1090 < mbt_ffi_load32(iter_base + 32) + index1090 = index1090 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1088 * 8 + index1090 * 8 - let result1086 = mbt_ffi_ptr2str( + let result1088 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1087.push(result1086) + array1089.push(result1088) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array1087) + Option::Some(array1089) } _ => panic() } @@ -10487,95 +10507,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted1085, - allowed_extensions: lifted1089, + allowed_mime_types: lifted1087, + allowed_extensions: lifted1091, }) } 27 => { - let lifted1093 : Array[String]? = match + let lifted1095 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1091 : Array[String] = [] - for index1092 = 0 - index1092 < mbt_ffi_load32(iter_base + 16) - index1092 = index1092 + 1 { + let array1093 : Array[String] = [] + for index1094 = 0 + index1094 < mbt_ffi_load32(iter_base + 16) + index1094 = index1094 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1092 * 8 + index1094 * 8 - let result1090 = mbt_ffi_ptr2str( + let result1092 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1091.push(result1090) + array1093.push(result1092) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1091) + Option::Some(array1093) } _ => panic() } - let lifted1097 : Array[String]? = match + let lifted1099 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array1095 : Array[String] = [] - for index1096 = 0 - index1096 < mbt_ffi_load32(iter_base + 28) - index1096 = index1096 + 1 { + let array1097 : Array[String] = [] + for index1098 = 0 + index1098 < mbt_ffi_load32(iter_base + 28) + index1098 = index1098 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1096 * 8 + index1098 * 8 - let result1094 = mbt_ffi_ptr2str( + let result1096 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1095.push(result1094) + array1097.push(result1096) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array1095) + Option::Some(array1097) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted1093, - allowed_hosts: lifted1097, + allowed_schemes: lifted1095, + allowed_hosts: lifted1099, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result1098 = mbt_ffi_ptr2str( + let result1100 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array1100 : Array[String] = [] - for index1101 = 0 - index1101 < mbt_ffi_load32(iter_base + 20) - index1101 = index1101 + 1 { + let array1102 : Array[String] = [] + for index1103 = 0 + index1103 < mbt_ffi_load32(iter_base + 20) + index1103 = index1103 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1101 * 8 + index1103 * 8 - let result1099 = mbt_ffi_ptr2str( + let result1101 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1100.push(result1099) + array1102.push(result1101) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted1103 : @types.QuantityValue? = match + let lifted1105 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1102 = mbt_ffi_ptr2str( + let result1104 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -10583,17 +10603,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result1102, + unit: result1104, }) } _ => panic() } - let lifted1105 : @types.QuantityValue? = match + let lifted1107 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result1104 = mbt_ffi_ptr2str( + let result1106 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -10601,406 +10621,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result1104, + unit: result1106, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result1098, - allowed_suffixes: array1100, - min: lifted1103, - max: lifted1105, + base_unit: result1100, + allowed_suffixes: array1102, + min: lifted1105, + max: lifted1107, }) } 31 => { - let array1129 : Array[@types.UnionBranch] = [] - for index1130 = 0 - index1130 < mbt_ffi_load32(iter_base + 12) - index1130 = index1130 + 1 { + let array1131 : Array[@types.UnionBranch] = [] + for index1132 = 0 + index1132 < mbt_ffi_load32(iter_base + 12) + index1132 = index1132 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1130 * 92 + index1132 * 92 - let result1106 = mbt_ffi_ptr2str( + let result1108 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1115 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted1117 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result1107 = mbt_ffi_ptr2str( + let result1109 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result1107) + @types.DiscriminatorRule::Prefix(result1109) } 1 => { - let result1108 = mbt_ffi_ptr2str( + let result1110 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result1108) + @types.DiscriminatorRule::Suffix(result1110) } 2 => { - let result1109 = mbt_ffi_ptr2str( + let result1111 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result1109) + @types.DiscriminatorRule::Contains(result1111) } 3 => { - let result1110 = mbt_ffi_ptr2str( + let result1112 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result1110) + @types.DiscriminatorRule::Regex(result1112) } 4 => { - let result1111 = mbt_ffi_ptr2str( + let result1113 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted1113 : String? = match + let lifted1115 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1112 = mbt_ffi_ptr2str( + let result1114 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result1112) + Option::Some(result1114) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result1111, - literal: lifted1113, + field_name: result1113, + literal: lifted1115, }) } 5 => { - let result1114 = mbt_ffi_ptr2str( + let result1116 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result1114) + @types.DiscriminatorRule::FieldAbsent(result1116) } _ => panic() } - let lifted1117 : String? = match + let lifted1119 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1116 = mbt_ffi_ptr2str( + let result1118 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1116) + Option::Some(result1118) } _ => panic() } - let array1119 : Array[String] = [] - for index1120 = 0 - index1120 < mbt_ffi_load32(iter_base + 52) - index1120 = index1120 + 1 { + let array1121 : Array[String] = [] + for index1122 = 0 + index1122 < mbt_ffi_load32(iter_base + 52) + index1122 = index1122 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1120 * 8 + index1122 * 8 - let result1118 = mbt_ffi_ptr2str( + let result1120 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1119.push(result1118) + array1121.push(result1120) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1122 : Array[String] = [] - for index1123 = 0 - index1123 < mbt_ffi_load32(iter_base + 60) - index1123 = index1123 + 1 { + let array1124 : Array[String] = [] + for index1125 = 0 + index1125 < mbt_ffi_load32(iter_base + 60) + index1125 = index1125 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1123 * 8 + index1125 * 8 - let result1121 = mbt_ffi_ptr2str( + let result1123 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1122.push(result1121) + array1124.push(result1123) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted1125 : String? = match + let lifted1127 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1124 = mbt_ffi_ptr2str( + let result1126 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1124) + Option::Some(result1126) } _ => panic() } - let lifted1128 : @types.Role? = match + let lifted1130 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted1127 = match + let lifted1129 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1126 = mbt_ffi_ptr2str( + let result1128 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result1126) + @types.Role::Other(result1128) } _ => panic() } - Option::Some(lifted1127) + Option::Some(lifted1129) } _ => panic() } - array1129.push(@types.UnionBranch::{ - tag: result1106, + array1131.push(@types.UnionBranch::{ + tag: result1108, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted1115, + discriminator: lifted1117, metadata: @types.MetadataEnvelope::{ - doc: lifted1117, - aliases: array1119, - examples: array1122, - deprecated: lifted1125, - role: lifted1128, + doc: lifted1119, + aliases: array1121, + examples: array1124, + deprecated: lifted1127, + role: lifted1130, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array1129, + branches: array1131, }) } 32 => { - let lifted1132 : String? = match + let lifted1134 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1131 = mbt_ffi_ptr2str( + let result1133 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1131) + Option::Some(result1133) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted1132, + category: lifted1134, }) } 33 => { - let lifted1134 : String? = match + let lifted1136 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1133 = mbt_ffi_ptr2str( + let result1135 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1133) + Option::Some(result1135) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted1134, + resource_name: lifted1136, }) } 34 => { - let lifted1135 : Int? = match + let lifted1137 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted1135) + @types.SchemaTypeBody::FutureType(lifted1137) } 35 => { - let lifted1136 : Int? = match + let lifted1138 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted1136) + @types.SchemaTypeBody::StreamType(lifted1138) } _ => panic() } - let lifted1139 : String? = match + let lifted1141 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result1138 = mbt_ffi_ptr2str( + let result1140 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result1138) + Option::Some(result1140) } _ => panic() } - let array1141 : Array[String] = [] - for index1142 = 0 - index1142 < mbt_ffi_load32(iter_base + 104) - index1142 = index1142 + 1 { + let array1143 : Array[String] = [] + for index1144 = 0 + index1144 < mbt_ffi_load32(iter_base + 104) + index1144 = index1144 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index1142 * 8 + index1144 * 8 - let result1140 = mbt_ffi_ptr2str( + let result1142 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1141.push(result1140) + array1143.push(result1142) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array1144 : Array[String] = [] - for index1145 = 0 - index1145 < mbt_ffi_load32(iter_base + 112) - index1145 = index1145 + 1 { + let array1146 : Array[String] = [] + for index1147 = 0 + index1147 < mbt_ffi_load32(iter_base + 112) + index1147 = index1147 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index1145 * 8 + index1147 * 8 - let result1143 = mbt_ffi_ptr2str( + let result1145 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1144.push(result1143) + array1146.push(result1145) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted1147 : String? = match + let lifted1149 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result1146 = mbt_ffi_ptr2str( + let result1148 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result1146) + Option::Some(result1148) } _ => panic() } - let lifted1150 : @types.Role? = match + let lifted1152 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted1149 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted1151 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1148 = mbt_ffi_ptr2str( + let result1150 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result1148) + @types.Role::Other(result1150) } _ => panic() } - Option::Some(lifted1149) + Option::Some(lifted1151) } _ => panic() } - array1151.push(@types.SchemaTypeNode::{ - body: lifted1137, + array1153.push(@types.SchemaTypeNode::{ + body: lifted1139, metadata: @types.MetadataEnvelope::{ - doc: lifted1139, - aliases: array1141, - examples: array1144, - deprecated: lifted1147, - role: lifted1150, + doc: lifted1141, + aliases: array1143, + examples: array1146, + deprecated: lifted1149, + role: lifted1152, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array1156 : Array[@types.SchemaTypeDef] = [] - for index1157 = 0 - index1157 < mbt_ffi_load32(iter_base + 48) - index1157 = index1157 + 1 { + let array1158 : Array[@types.SchemaTypeDef] = [] + for index1159 = 0 + index1159 < mbt_ffi_load32(iter_base + 48) + index1159 = index1159 + 1 { let iter_base = mbt_ffi_load32(iter_base + 44) + - index1157 * 24 + index1159 * 24 - let result1153 = mbt_ffi_ptr2str( + let result1155 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1155 : String? = match + let lifted1157 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1154 = mbt_ffi_ptr2str( + let result1156 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1154) + Option::Some(result1156) } _ => panic() } - array1156.push(@types.SchemaTypeDef::{ - id: result1153, - name: lifted1155, + array1158.push(@types.SchemaTypeDef::{ + id: result1155, + name: lifted1157, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 44)) - let array1187 : Array[@types.SchemaValueNode] = [] - for index1188 = 0 - index1188 < mbt_ffi_load32(iter_base + 60) - index1188 = index1188 + 1 { + let array1189 : Array[@types.SchemaValueNode] = [] + for index1190 = 0 + index1190 < mbt_ffi_load32(iter_base + 60) + index1190 = index1190 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1188 * 32 + index1190 * 32 - let lifted1186 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1188 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -11052,29 +11072,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result1158 = mbt_ffi_ptr2str( + let result1160 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result1158) + @types.SchemaValueNode::StringValue(result1160) } 13 => { - let array1159 : Array[Int] = [] - for index1160 = 0 - index1160 < mbt_ffi_load32(iter_base + 12) - index1160 = index1160 + 1 { + let array1161 : Array[Int] = [] + for index1162 = 0 + index1162 < mbt_ffi_load32(iter_base + 12) + index1162 = index1162 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1160 * 4 + index1162 * 4 - array1159.push(mbt_ffi_load32(iter_base + 0)) + array1161.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array1159) + @types.SchemaValueNode::RecordValue(array1161) } 14 => { - let lifted1161 : Int? = match + let lifted1163 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -11083,7 +11103,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted1161, + payload: lifted1163, }) } 15 => @@ -11091,34 +11111,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array1162 : Array[Bool] = [] - for index1163 = 0 - index1163 < mbt_ffi_load32(iter_base + 12) - index1163 = index1163 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index1163 * 1 - - array1162.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array1162) - } - 17 => { - let array1164 : Array[Int] = [] + let array1164 : Array[Bool] = [] for index1165 = 0 index1165 < mbt_ffi_load32(iter_base + 12) index1165 = index1165 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1165 * 4 + index1165 * 1 - array1164.push(mbt_ffi_load32(iter_base + 0)) + array1164.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array1164) + @types.SchemaValueNode::FlagsValue(array1164) } - 18 => { + 17 => { let array1166 : Array[Int] = [] for index1167 = 0 index1167 < mbt_ffi_load32(iter_base + 12) @@ -11130,9 +11136,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array1166) + @types.SchemaValueNode::TupleValue(array1166) } - 19 => { + 18 => { let array1168 : Array[Int] = [] for index1169 = 0 index1169 < mbt_ffi_load32(iter_base + 12) @@ -11144,127 +11150,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array1168) + @types.SchemaValueNode::ListValue(array1168) } - 20 => { - let array1170 : Array[@types.MapEntry] = [] + 19 => { + let array1170 : Array[Int] = [] for index1171 = 0 index1171 < mbt_ffi_load32(iter_base + 12) index1171 = index1171 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1171 * 8 + index1171 * 4 + + array1170.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array1170) + } + 20 => { + let array1172 : Array[@types.MapEntry] = [] + for index1173 = 0 + index1173 < mbt_ffi_load32(iter_base + 12) + index1173 = index1173 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index1173 * 8 - array1170.push(@types.MapEntry::{ + array1172.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array1170) + @types.SchemaValueNode::MapValue(array1172) } 21 => { - let lifted1172 : Int? = match + let lifted1174 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted1172) + @types.SchemaValueNode::OptionValue(lifted1174) } 22 => { - let lifted1175 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted1177 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted1173 : Int? = match + let lifted1175 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted1173) + @types.ResultValuePayload::OkValue(lifted1175) } 1 => { - let lifted1174 : Int? = match + let lifted1176 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted1174) + @types.ResultValuePayload::ErrValue(lifted1176) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted1175) + @types.SchemaValueNode::ResultValue(lifted1177) } 23 => { - let result1176 = mbt_ffi_ptr2str( + let result1178 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1178 : String? = match + let lifted1180 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1177 = mbt_ffi_ptr2str( + let result1179 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1177) + Option::Some(result1179) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result1176, - language: lifted1178, + text: result1178, + language: lifted1180, }) } 24 => { - let result1179 = mbt_ffi_ptr2bytes( + let result1181 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1181 : String? = match + let lifted1183 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1180 = mbt_ffi_ptr2str( + let result1182 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1180) + Option::Some(result1182) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result1179, - mime_type: lifted1181, + bytes: result1181, + mime_type: lifted1183, }) } 25 => { - let result1182 = mbt_ffi_ptr2str( + let result1184 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result1182) + @types.SchemaValueNode::PathValue(result1184) } 26 => { - let result1183 = mbt_ffi_ptr2str( + let result1185 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result1183) + @types.SchemaValueNode::UrlValue(result1185) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -11276,7 +11296,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result1184 = mbt_ffi_ptr2str( + let result1186 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -11284,17 +11304,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result1184, + unit: result1186, }) } 30 => { - let result1185 = mbt_ffi_ptr2str( + let result1187 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result1185, + tag: result1187, body: mbt_ffi_load32(iter_base + 16), }) } @@ -11308,21 +11328,27 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array1187.push(lifted1186) + array1189.push(lifted1188) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) Option::Some(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array1151, - defs: array1156, + type_nodes: array1153, + defs: array1158, root: mbt_ffi_load32(iter_base + 52), }, value: @types.SchemaValueTree::{ - value_nodes: array1187, + value_nodes: array1189, root: mbt_ffi_load32(iter_base + 64), }, }) @@ -11336,38 +11362,38 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, start_index: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - response: lifted1189, + response: lifted1191, forced_commit: mbt_ffi_load8_u(iter_base + 68) != 0, }) } 3 => { - let lifted1424 : @types.TypedSchemaValue? = match + let lifted1426 : @types.TypedSchemaValue? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let array1386 : Array[@types.SchemaTypeNode] = [] - for index1387 = 0 - index1387 < mbt_ffi_load32(iter_base + 40) - index1387 = index1387 + 1 { + let array1388 : Array[@types.SchemaTypeNode] = [] + for index1389 = 0 + index1389 < mbt_ffi_load32(iter_base + 40) + index1389 = index1389 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1387 * 144 + index1389 * 144 - let lifted1372 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1374 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted1196 : @types.NumericRestrictions? = match + let lifted1198 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1191 : @types.NumericBound? = match + let lifted1193 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1190 = match + let lifted1192 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11384,16 +11410,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1190) + Option::Some(lifted1192) } _ => panic() } - let lifted1193 : @types.NumericBound? = match + let lifted1195 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1192 = match + let lifted1194 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11410,46 +11436,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1192) + Option::Some(lifted1194) } _ => panic() } - let lifted1195 : String? = match + let lifted1197 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1194 = mbt_ffi_ptr2str( + let result1196 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1194) + Option::Some(result1196) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1191, - max: lifted1193, - unit: lifted1195, + min: lifted1193, + max: lifted1195, + unit: lifted1197, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted1196) + @types.SchemaTypeBody::S8Type(lifted1198) } 3 => { - let lifted1203 : @types.NumericRestrictions? = match + let lifted1205 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1198 : @types.NumericBound? = match + let lifted1200 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1197 = match + let lifted1199 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11466,16 +11492,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1197) + Option::Some(lifted1199) } _ => panic() } - let lifted1200 : @types.NumericBound? = match + let lifted1202 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1199 = match + let lifted1201 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11492,46 +11518,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1199) + Option::Some(lifted1201) } _ => panic() } - let lifted1202 : String? = match + let lifted1204 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1201 = mbt_ffi_ptr2str( + let result1203 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1201) + Option::Some(result1203) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1198, - max: lifted1200, - unit: lifted1202, + min: lifted1200, + max: lifted1202, + unit: lifted1204, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted1203) + @types.SchemaTypeBody::S16Type(lifted1205) } 4 => { - let lifted1210 : @types.NumericRestrictions? = match + let lifted1212 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1205 : @types.NumericBound? = match + let lifted1207 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1204 = match + let lifted1206 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11548,16 +11574,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1204) + Option::Some(lifted1206) } _ => panic() } - let lifted1207 : @types.NumericBound? = match + let lifted1209 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1206 = match + let lifted1208 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11574,46 +11600,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1206) + Option::Some(lifted1208) } _ => panic() } - let lifted1209 : String? = match + let lifted1211 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1208 = mbt_ffi_ptr2str( + let result1210 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1208) + Option::Some(result1210) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1205, - max: lifted1207, - unit: lifted1209, + min: lifted1207, + max: lifted1209, + unit: lifted1211, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted1210) + @types.SchemaTypeBody::S32Type(lifted1212) } 5 => { - let lifted1217 : @types.NumericRestrictions? = match + let lifted1219 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1212 : @types.NumericBound? = match + let lifted1214 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1211 = match + let lifted1213 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11630,16 +11656,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1211) + Option::Some(lifted1213) } _ => panic() } - let lifted1214 : @types.NumericBound? = match + let lifted1216 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1213 = match + let lifted1215 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11656,46 +11682,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1213) + Option::Some(lifted1215) } _ => panic() } - let lifted1216 : String? = match + let lifted1218 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1215 = mbt_ffi_ptr2str( + let result1217 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1215) + Option::Some(result1217) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1212, - max: lifted1214, - unit: lifted1216, + min: lifted1214, + max: lifted1216, + unit: lifted1218, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted1217) + @types.SchemaTypeBody::S64Type(lifted1219) } 6 => { - let lifted1224 : @types.NumericRestrictions? = match + let lifted1226 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1219 : @types.NumericBound? = match + let lifted1221 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1218 = match + let lifted1220 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11712,16 +11738,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1218) + Option::Some(lifted1220) } _ => panic() } - let lifted1221 : @types.NumericBound? = match + let lifted1223 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1220 = match + let lifted1222 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11738,46 +11764,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1220) + Option::Some(lifted1222) } _ => panic() } - let lifted1223 : String? = match + let lifted1225 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1222 = mbt_ffi_ptr2str( + let result1224 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1222) + Option::Some(result1224) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1219, - max: lifted1221, - unit: lifted1223, + min: lifted1221, + max: lifted1223, + unit: lifted1225, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted1224) + @types.SchemaTypeBody::U8Type(lifted1226) } 7 => { - let lifted1231 : @types.NumericRestrictions? = match + let lifted1233 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1226 : @types.NumericBound? = match + let lifted1228 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1225 = match + let lifted1227 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11794,16 +11820,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1225) + Option::Some(lifted1227) } _ => panic() } - let lifted1228 : @types.NumericBound? = match + let lifted1230 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1227 = match + let lifted1229 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11820,46 +11846,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1227) + Option::Some(lifted1229) } _ => panic() } - let lifted1230 : String? = match + let lifted1232 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1229 = mbt_ffi_ptr2str( + let result1231 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1229) + Option::Some(result1231) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1226, - max: lifted1228, - unit: lifted1230, + min: lifted1228, + max: lifted1230, + unit: lifted1232, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted1231) + @types.SchemaTypeBody::U16Type(lifted1233) } 8 => { - let lifted1238 : @types.NumericRestrictions? = match + let lifted1240 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1233 : @types.NumericBound? = match + let lifted1235 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1232 = match + let lifted1234 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11876,16 +11902,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1232) + Option::Some(lifted1234) } _ => panic() } - let lifted1235 : @types.NumericBound? = match + let lifted1237 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1234 = match + let lifted1236 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11902,46 +11928,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1234) + Option::Some(lifted1236) } _ => panic() } - let lifted1237 : String? = match + let lifted1239 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1236 = mbt_ffi_ptr2str( + let result1238 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1236) + Option::Some(result1238) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1233, - max: lifted1235, - unit: lifted1237, + min: lifted1235, + max: lifted1237, + unit: lifted1239, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1238) + @types.SchemaTypeBody::U32Type(lifted1240) } 9 => { - let lifted1245 : @types.NumericRestrictions? = match + let lifted1247 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1240 : @types.NumericBound? = match + let lifted1242 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1239 = match + let lifted1241 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -11958,16 +11984,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1239) + Option::Some(lifted1241) } _ => panic() } - let lifted1242 : @types.NumericBound? = match + let lifted1244 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1241 = match + let lifted1243 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -11984,46 +12010,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1241) + Option::Some(lifted1243) } _ => panic() } - let lifted1244 : String? = match + let lifted1246 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1243 = mbt_ffi_ptr2str( + let result1245 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1243) + Option::Some(result1245) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1240, - max: lifted1242, - unit: lifted1244, + min: lifted1242, + max: lifted1244, + unit: lifted1246, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1245) + @types.SchemaTypeBody::U64Type(lifted1247) } 10 => { - let lifted1252 : @types.NumericRestrictions? = match + let lifted1254 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1247 : @types.NumericBound? = match + let lifted1249 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1246 = match + let lifted1248 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -12040,16 +12066,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1246) + Option::Some(lifted1248) } _ => panic() } - let lifted1249 : @types.NumericBound? = match + let lifted1251 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1248 = match + let lifted1250 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -12066,46 +12092,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1248) + Option::Some(lifted1250) } _ => panic() } - let lifted1251 : String? = match + let lifted1253 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1250 = mbt_ffi_ptr2str( + let result1252 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1250) + Option::Some(result1252) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1247, - max: lifted1249, - unit: lifted1251, + min: lifted1249, + max: lifted1251, + unit: lifted1253, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1252) + @types.SchemaTypeBody::F32Type(lifted1254) } 11 => { - let lifted1259 : @types.NumericRestrictions? = match + let lifted1261 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1254 : @types.NumericBound? = match + let lifted1256 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1253 = match + let lifted1255 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -12122,16 +12148,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1253) + Option::Some(lifted1255) } _ => panic() } - let lifted1256 : @types.NumericBound? = match + let lifted1258 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1255 = match + let lifted1257 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -12148,324 +12174,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1255) + Option::Some(lifted1257) } _ => panic() } - let lifted1258 : String? = match + let lifted1260 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1257 = mbt_ffi_ptr2str( + let result1259 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1257) + Option::Some(result1259) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1254, - max: lifted1256, - unit: lifted1258, + min: lifted1256, + max: lifted1258, + unit: lifted1260, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted1259) + @types.SchemaTypeBody::F64Type(lifted1261) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array1274 : Array[@types.NamedFieldType] = [] - for index1275 = 0 - index1275 < mbt_ffi_load32(iter_base + 12) - index1275 = index1275 + 1 { + let array1276 : Array[@types.NamedFieldType] = [] + for index1277 = 0 + index1277 < mbt_ffi_load32(iter_base + 12) + index1277 = index1277 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1275 * 68 + index1277 * 68 - let result1260 = mbt_ffi_ptr2str( + let result1262 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1262 : String? = match + let lifted1264 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1261 = mbt_ffi_ptr2str( + let result1263 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1261) + Option::Some(result1263) } _ => panic() } - let array1264 : Array[String] = [] - for index1265 = 0 - index1265 < mbt_ffi_load32(iter_base + 28) - index1265 = index1265 + 1 { + let array1266 : Array[String] = [] + for index1267 = 0 + index1267 < mbt_ffi_load32(iter_base + 28) + index1267 = index1267 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1265 * 8 + index1267 * 8 - let result1263 = mbt_ffi_ptr2str( + let result1265 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1264.push(result1263) + array1266.push(result1265) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array1267 : Array[String] = [] - for index1268 = 0 - index1268 < mbt_ffi_load32(iter_base + 36) - index1268 = index1268 + 1 { + let array1269 : Array[String] = [] + for index1270 = 0 + index1270 < mbt_ffi_load32(iter_base + 36) + index1270 = index1270 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index1268 * 8 + index1270 * 8 - let result1266 = mbt_ffi_ptr2str( + let result1268 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1267.push(result1266) + array1269.push(result1268) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted1270 : String? = match + let lifted1272 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result1269 = mbt_ffi_ptr2str( + let result1271 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result1269) + Option::Some(result1271) } _ => panic() } - let lifted1273 : @types.Role? = match + let lifted1275 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted1272 = match + let lifted1274 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1271 = mbt_ffi_ptr2str( + let result1273 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result1271) + @types.Role::Other(result1273) } _ => panic() } - Option::Some(lifted1272) + Option::Some(lifted1274) } _ => panic() } - array1274.push(@types.NamedFieldType::{ - name: result1260, + array1276.push(@types.NamedFieldType::{ + name: result1262, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted1262, - aliases: array1264, - examples: array1267, - deprecated: lifted1270, - role: lifted1273, + doc: lifted1264, + aliases: array1266, + examples: array1269, + deprecated: lifted1272, + role: lifted1275, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array1274) + @types.SchemaTypeBody::RecordType(array1276) } 15 => { - let array1291 : Array[@types.VariantCaseType] = [] - for index1292 = 0 - index1292 < mbt_ffi_load32(iter_base + 12) - index1292 = index1292 + 1 { + let array1293 : Array[@types.VariantCaseType] = [] + for index1294 = 0 + index1294 < mbt_ffi_load32(iter_base + 12) + index1294 = index1294 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1292 * 72 + index1294 * 72 - let result1276 = mbt_ffi_ptr2str( + let result1278 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1277 : Int? = match + let lifted1279 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1279 : String? = match + let lifted1281 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1278 = mbt_ffi_ptr2str( + let result1280 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1278) + Option::Some(result1280) } _ => panic() } - let array1281 : Array[String] = [] - for index1282 = 0 - index1282 < mbt_ffi_load32(iter_base + 32) - index1282 = index1282 + 1 { + let array1283 : Array[String] = [] + for index1284 = 0 + index1284 < mbt_ffi_load32(iter_base + 32) + index1284 = index1284 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1282 * 8 + index1284 * 8 - let result1280 = mbt_ffi_ptr2str( + let result1282 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1281.push(result1280) + array1283.push(result1282) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array1284 : Array[String] = [] - for index1285 = 0 - index1285 < mbt_ffi_load32(iter_base + 40) - index1285 = index1285 + 1 { + let array1286 : Array[String] = [] + for index1287 = 0 + index1287 < mbt_ffi_load32(iter_base + 40) + index1287 = index1287 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1285 * 8 + index1287 * 8 - let result1283 = mbt_ffi_ptr2str( + let result1285 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1284.push(result1283) + array1286.push(result1285) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted1287 : String? = match + let lifted1289 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result1286 = mbt_ffi_ptr2str( + let result1288 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result1286) + Option::Some(result1288) } _ => panic() } - let lifted1290 : @types.Role? = match + let lifted1292 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted1289 = match + let lifted1291 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1288 = mbt_ffi_ptr2str( + let result1290 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result1288) + @types.Role::Other(result1290) } _ => panic() } - Option::Some(lifted1289) + Option::Some(lifted1291) } _ => panic() } - array1291.push(@types.VariantCaseType::{ - name: result1276, - payload: lifted1277, + array1293.push(@types.VariantCaseType::{ + name: result1278, + payload: lifted1279, metadata: @types.MetadataEnvelope::{ - doc: lifted1279, - aliases: array1281, - examples: array1284, - deprecated: lifted1287, - role: lifted1290, + doc: lifted1281, + aliases: array1283, + examples: array1286, + deprecated: lifted1289, + role: lifted1292, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array1291) + @types.SchemaTypeBody::VariantType(array1293) } 16 => { - let array1294 : Array[String] = [] - for index1295 = 0 - index1295 < mbt_ffi_load32(iter_base + 12) - index1295 = index1295 + 1 { + let array1296 : Array[String] = [] + for index1297 = 0 + index1297 < mbt_ffi_load32(iter_base + 12) + index1297 = index1297 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1295 * 8 + index1297 * 8 - let result1293 = mbt_ffi_ptr2str( + let result1295 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1294.push(result1293) + array1296.push(result1295) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array1294) + @types.SchemaTypeBody::EnumType(array1296) } 17 => { - let array1297 : Array[String] = [] - for index1298 = 0 - index1298 < mbt_ffi_load32(iter_base + 12) - index1298 = index1298 + 1 { + let array1299 : Array[String] = [] + for index1300 = 0 + index1300 < mbt_ffi_load32(iter_base + 12) + index1300 = index1300 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1298 * 8 + index1300 * 8 - let result1296 = mbt_ffi_ptr2str( + let result1298 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1297.push(result1296) + array1299.push(result1298) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array1297) + @types.SchemaTypeBody::FlagsType(array1299) } 18 => { - let array1299 : Array[Int] = [] - for index1300 = 0 - index1300 < mbt_ffi_load32(iter_base + 12) - index1300 = index1300 + 1 { + let array1301 : Array[Int] = [] + for index1302 = 0 + index1302 < mbt_ffi_load32(iter_base + 12) + index1302 = index1302 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1300 * 4 + index1302 * 4 - array1299.push(mbt_ffi_load32(iter_base + 0)) + array1301.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array1299) + @types.SchemaTypeBody::TupleType(array1301) } 19 => @types.SchemaTypeBody::ListType( @@ -12486,14 +12512,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted1301 : Int? = match + let lifted1303 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1302 : Int? = match + let lifted1304 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -12501,37 +12527,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted1301, - err: lifted1302, + ok: lifted1303, + err: lifted1304, }) } 24 => { - let lifted1306 : Array[String]? = match + let lifted1308 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1304 : Array[String] = [] - for index1305 = 0 - index1305 < mbt_ffi_load32(iter_base + 16) - index1305 = index1305 + 1 { + let array1306 : Array[String] = [] + for index1307 = 0 + index1307 < mbt_ffi_load32(iter_base + 16) + index1307 = index1307 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1305 * 8 + index1307 * 8 - let result1303 = mbt_ffi_ptr2str( + let result1305 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1304.push(result1303) + array1306.push(result1305) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1304) + Option::Some(array1306) } _ => panic() } - let lifted1307 : UInt? = match + let lifted1309 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -12541,7 +12567,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1308 : UInt? = match + let lifted1310 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -12551,54 +12577,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1310 : String? = match + let lifted1312 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1309 = mbt_ffi_ptr2str( + let result1311 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1309) + Option::Some(result1311) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted1306, - min_length: lifted1307, - max_length: lifted1308, - regex: lifted1310, + languages: lifted1308, + min_length: lifted1309, + max_length: lifted1310, + regex: lifted1312, }) } 25 => { - let lifted1314 : Array[String]? = match + let lifted1316 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1312 : Array[String] = [] - for index1313 = 0 - index1313 < mbt_ffi_load32(iter_base + 16) - index1313 = index1313 + 1 { + let array1314 : Array[String] = [] + for index1315 = 0 + index1315 < mbt_ffi_load32(iter_base + 16) + index1315 = index1315 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1313 * 8 + index1315 * 8 - let result1311 = mbt_ffi_ptr2str( + let result1313 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1312.push(result1311) + array1314.push(result1313) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1312) + Option::Some(array1314) } _ => panic() } - let lifted1315 : UInt? = match + let lifted1317 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -12608,7 +12634,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1316 : UInt? = match + let lifted1318 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -12619,58 +12645,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted1314, - min_bytes: lifted1315, - max_bytes: lifted1316, + mime_types: lifted1316, + min_bytes: lifted1317, + max_bytes: lifted1318, }) } 26 => { - let lifted1320 : Array[String]? = match + let lifted1322 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array1318 : Array[String] = [] - for index1319 = 0 - index1319 < mbt_ffi_load32(iter_base + 20) - index1319 = index1319 + 1 { + let array1320 : Array[String] = [] + for index1321 = 0 + index1321 < mbt_ffi_load32(iter_base + 20) + index1321 = index1321 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1319 * 8 + index1321 * 8 - let result1317 = mbt_ffi_ptr2str( + let result1319 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1318.push(result1317) + array1320.push(result1319) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array1318) + Option::Some(array1320) } _ => panic() } - let lifted1324 : Array[String]? = match + let lifted1326 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array1322 : Array[String] = [] - for index1323 = 0 - index1323 < mbt_ffi_load32(iter_base + 32) - index1323 = index1323 + 1 { + let array1324 : Array[String] = [] + for index1325 = 0 + index1325 < mbt_ffi_load32(iter_base + 32) + index1325 = index1325 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1323 * 8 + index1325 * 8 - let result1321 = mbt_ffi_ptr2str( + let result1323 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1322.push(result1321) + array1324.push(result1323) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array1322) + Option::Some(array1324) } _ => panic() } @@ -12682,95 +12708,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted1320, - allowed_extensions: lifted1324, + allowed_mime_types: lifted1322, + allowed_extensions: lifted1326, }) } 27 => { - let lifted1328 : Array[String]? = match + let lifted1330 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1326 : Array[String] = [] - for index1327 = 0 - index1327 < mbt_ffi_load32(iter_base + 16) - index1327 = index1327 + 1 { + let array1328 : Array[String] = [] + for index1329 = 0 + index1329 < mbt_ffi_load32(iter_base + 16) + index1329 = index1329 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1327 * 8 + index1329 * 8 - let result1325 = mbt_ffi_ptr2str( + let result1327 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1326.push(result1325) + array1328.push(result1327) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1326) + Option::Some(array1328) } _ => panic() } - let lifted1332 : Array[String]? = match + let lifted1334 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array1330 : Array[String] = [] - for index1331 = 0 - index1331 < mbt_ffi_load32(iter_base + 28) - index1331 = index1331 + 1 { + let array1332 : Array[String] = [] + for index1333 = 0 + index1333 < mbt_ffi_load32(iter_base + 28) + index1333 = index1333 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1331 * 8 + index1333 * 8 - let result1329 = mbt_ffi_ptr2str( + let result1331 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1330.push(result1329) + array1332.push(result1331) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array1330) + Option::Some(array1332) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted1328, - allowed_hosts: lifted1332, + allowed_schemes: lifted1330, + allowed_hosts: lifted1334, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result1333 = mbt_ffi_ptr2str( + let result1335 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array1335 : Array[String] = [] - for index1336 = 0 - index1336 < mbt_ffi_load32(iter_base + 20) - index1336 = index1336 + 1 { + let array1337 : Array[String] = [] + for index1338 = 0 + index1338 < mbt_ffi_load32(iter_base + 20) + index1338 = index1338 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1336 * 8 + index1338 * 8 - let result1334 = mbt_ffi_ptr2str( + let result1336 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1335.push(result1334) + array1337.push(result1336) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted1338 : @types.QuantityValue? = match + let lifted1340 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1337 = mbt_ffi_ptr2str( + let result1339 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -12778,17 +12804,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result1337, + unit: result1339, }) } _ => panic() } - let lifted1340 : @types.QuantityValue? = match + let lifted1342 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result1339 = mbt_ffi_ptr2str( + let result1341 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -12796,406 +12822,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result1339, + unit: result1341, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result1333, - allowed_suffixes: array1335, - min: lifted1338, - max: lifted1340, + base_unit: result1335, + allowed_suffixes: array1337, + min: lifted1340, + max: lifted1342, }) } 31 => { - let array1364 : Array[@types.UnionBranch] = [] - for index1365 = 0 - index1365 < mbt_ffi_load32(iter_base + 12) - index1365 = index1365 + 1 { + let array1366 : Array[@types.UnionBranch] = [] + for index1367 = 0 + index1367 < mbt_ffi_load32(iter_base + 12) + index1367 = index1367 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1365 * 92 + index1367 * 92 - let result1341 = mbt_ffi_ptr2str( + let result1343 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1350 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted1352 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result1342 = mbt_ffi_ptr2str( + let result1344 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result1342) + @types.DiscriminatorRule::Prefix(result1344) } 1 => { - let result1343 = mbt_ffi_ptr2str( + let result1345 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result1343) + @types.DiscriminatorRule::Suffix(result1345) } 2 => { - let result1344 = mbt_ffi_ptr2str( + let result1346 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result1344) + @types.DiscriminatorRule::Contains(result1346) } 3 => { - let result1345 = mbt_ffi_ptr2str( + let result1347 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result1345) + @types.DiscriminatorRule::Regex(result1347) } 4 => { - let result1346 = mbt_ffi_ptr2str( + let result1348 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted1348 : String? = match + let lifted1350 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1347 = mbt_ffi_ptr2str( + let result1349 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result1347) + Option::Some(result1349) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result1346, - literal: lifted1348, + field_name: result1348, + literal: lifted1350, }) } 5 => { - let result1349 = mbt_ffi_ptr2str( + let result1351 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result1349) + @types.DiscriminatorRule::FieldAbsent(result1351) } _ => panic() } - let lifted1352 : String? = match + let lifted1354 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1351 = mbt_ffi_ptr2str( + let result1353 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1351) + Option::Some(result1353) } _ => panic() } - let array1354 : Array[String] = [] - for index1355 = 0 - index1355 < mbt_ffi_load32(iter_base + 52) - index1355 = index1355 + 1 { + let array1356 : Array[String] = [] + for index1357 = 0 + index1357 < mbt_ffi_load32(iter_base + 52) + index1357 = index1357 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1355 * 8 + index1357 * 8 - let result1353 = mbt_ffi_ptr2str( + let result1355 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1354.push(result1353) + array1356.push(result1355) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1357 : Array[String] = [] - for index1358 = 0 - index1358 < mbt_ffi_load32(iter_base + 60) - index1358 = index1358 + 1 { + let array1359 : Array[String] = [] + for index1360 = 0 + index1360 < mbt_ffi_load32(iter_base + 60) + index1360 = index1360 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1358 * 8 + index1360 * 8 - let result1356 = mbt_ffi_ptr2str( + let result1358 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1357.push(result1356) + array1359.push(result1358) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted1360 : String? = match + let lifted1362 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1359 = mbt_ffi_ptr2str( + let result1361 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1359) + Option::Some(result1361) } _ => panic() } - let lifted1363 : @types.Role? = match + let lifted1365 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted1362 = match + let lifted1364 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1361 = mbt_ffi_ptr2str( + let result1363 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result1361) + @types.Role::Other(result1363) } _ => panic() } - Option::Some(lifted1362) + Option::Some(lifted1364) } _ => panic() } - array1364.push(@types.UnionBranch::{ - tag: result1341, + array1366.push(@types.UnionBranch::{ + tag: result1343, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted1350, + discriminator: lifted1352, metadata: @types.MetadataEnvelope::{ - doc: lifted1352, - aliases: array1354, - examples: array1357, - deprecated: lifted1360, - role: lifted1363, + doc: lifted1354, + aliases: array1356, + examples: array1359, + deprecated: lifted1362, + role: lifted1365, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array1364, + branches: array1366, }) } 32 => { - let lifted1367 : String? = match + let lifted1369 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1366 = mbt_ffi_ptr2str( + let result1368 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1366) + Option::Some(result1368) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted1367, + category: lifted1369, }) } 33 => { - let lifted1369 : String? = match + let lifted1371 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1368 = mbt_ffi_ptr2str( + let result1370 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1368) + Option::Some(result1370) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted1369, + resource_name: lifted1371, }) } 34 => { - let lifted1370 : Int? = match + let lifted1372 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted1370) + @types.SchemaTypeBody::FutureType(lifted1372) } 35 => { - let lifted1371 : Int? = match + let lifted1373 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted1371) + @types.SchemaTypeBody::StreamType(lifted1373) } _ => panic() } - let lifted1374 : String? = match + let lifted1376 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result1373 = mbt_ffi_ptr2str( + let result1375 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result1373) + Option::Some(result1375) } _ => panic() } - let array1376 : Array[String] = [] - for index1377 = 0 - index1377 < mbt_ffi_load32(iter_base + 104) - index1377 = index1377 + 1 { + let array1378 : Array[String] = [] + for index1379 = 0 + index1379 < mbt_ffi_load32(iter_base + 104) + index1379 = index1379 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index1377 * 8 + index1379 * 8 - let result1375 = mbt_ffi_ptr2str( + let result1377 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1376.push(result1375) + array1378.push(result1377) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array1379 : Array[String] = [] - for index1380 = 0 - index1380 < mbt_ffi_load32(iter_base + 112) - index1380 = index1380 + 1 { + let array1381 : Array[String] = [] + for index1382 = 0 + index1382 < mbt_ffi_load32(iter_base + 112) + index1382 = index1382 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index1380 * 8 + index1382 * 8 - let result1378 = mbt_ffi_ptr2str( + let result1380 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1379.push(result1378) + array1381.push(result1380) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted1382 : String? = match + let lifted1384 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result1381 = mbt_ffi_ptr2str( + let result1383 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result1381) + Option::Some(result1383) } _ => panic() } - let lifted1385 : @types.Role? = match + let lifted1387 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted1384 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted1386 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1383 = mbt_ffi_ptr2str( + let result1385 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result1383) + @types.Role::Other(result1385) } _ => panic() } - Option::Some(lifted1384) + Option::Some(lifted1386) } _ => panic() } - array1386.push(@types.SchemaTypeNode::{ - body: lifted1372, + array1388.push(@types.SchemaTypeNode::{ + body: lifted1374, metadata: @types.MetadataEnvelope::{ - doc: lifted1374, - aliases: array1376, - examples: array1379, - deprecated: lifted1382, - role: lifted1385, + doc: lifted1376, + aliases: array1378, + examples: array1381, + deprecated: lifted1384, + role: lifted1387, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array1391 : Array[@types.SchemaTypeDef] = [] - for index1392 = 0 - index1392 < mbt_ffi_load32(iter_base + 48) - index1392 = index1392 + 1 { + let array1393 : Array[@types.SchemaTypeDef] = [] + for index1394 = 0 + index1394 < mbt_ffi_load32(iter_base + 48) + index1394 = index1394 + 1 { let iter_base = mbt_ffi_load32(iter_base + 44) + - index1392 * 24 + index1394 * 24 - let result1388 = mbt_ffi_ptr2str( + let result1390 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1390 : String? = match + let lifted1392 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1389 = mbt_ffi_ptr2str( + let result1391 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1389) + Option::Some(result1391) } _ => panic() } - array1391.push(@types.SchemaTypeDef::{ - id: result1388, - name: lifted1390, + array1393.push(@types.SchemaTypeDef::{ + id: result1390, + name: lifted1392, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 44)) - let array1422 : Array[@types.SchemaValueNode] = [] - for index1423 = 0 - index1423 < mbt_ffi_load32(iter_base + 60) - index1423 = index1423 + 1 { + let array1424 : Array[@types.SchemaValueNode] = [] + for index1425 = 0 + index1425 < mbt_ffi_load32(iter_base + 60) + index1425 = index1425 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1423 * 32 + index1425 * 32 - let lifted1421 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1423 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -13247,29 +13273,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result1393 = mbt_ffi_ptr2str( + let result1395 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result1393) + @types.SchemaValueNode::StringValue(result1395) } 13 => { - let array1394 : Array[Int] = [] - for index1395 = 0 - index1395 < mbt_ffi_load32(iter_base + 12) - index1395 = index1395 + 1 { + let array1396 : Array[Int] = [] + for index1397 = 0 + index1397 < mbt_ffi_load32(iter_base + 12) + index1397 = index1397 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1395 * 4 + index1397 * 4 - array1394.push(mbt_ffi_load32(iter_base + 0)) + array1396.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array1394) + @types.SchemaValueNode::RecordValue(array1396) } 14 => { - let lifted1396 : Int? = match + let lifted1398 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -13278,7 +13304,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted1396, + payload: lifted1398, }) } 15 => @@ -13286,34 +13312,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array1397 : Array[Bool] = [] - for index1398 = 0 - index1398 < mbt_ffi_load32(iter_base + 12) - index1398 = index1398 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index1398 * 1 - - array1397.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array1397) - } - 17 => { - let array1399 : Array[Int] = [] + let array1399 : Array[Bool] = [] for index1400 = 0 index1400 < mbt_ffi_load32(iter_base + 12) index1400 = index1400 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1400 * 4 + index1400 * 1 - array1399.push(mbt_ffi_load32(iter_base + 0)) + array1399.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array1399) + @types.SchemaValueNode::FlagsValue(array1399) } - 18 => { + 17 => { let array1401 : Array[Int] = [] for index1402 = 0 index1402 < mbt_ffi_load32(iter_base + 12) @@ -13325,9 +13337,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array1401) + @types.SchemaValueNode::TupleValue(array1401) } - 19 => { + 18 => { let array1403 : Array[Int] = [] for index1404 = 0 index1404 < mbt_ffi_load32(iter_base + 12) @@ -13339,127 +13351,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array1403) + @types.SchemaValueNode::ListValue(array1403) } - 20 => { - let array1405 : Array[@types.MapEntry] = [] + 19 => { + let array1405 : Array[Int] = [] for index1406 = 0 index1406 < mbt_ffi_load32(iter_base + 12) index1406 = index1406 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1406 * 8 + index1406 * 4 + + array1405.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array1405) + } + 20 => { + let array1407 : Array[@types.MapEntry] = [] + for index1408 = 0 + index1408 < mbt_ffi_load32(iter_base + 12) + index1408 = index1408 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index1408 * 8 - array1405.push(@types.MapEntry::{ + array1407.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array1405) + @types.SchemaValueNode::MapValue(array1407) } 21 => { - let lifted1407 : Int? = match + let lifted1409 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted1407) + @types.SchemaValueNode::OptionValue(lifted1409) } 22 => { - let lifted1410 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted1412 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted1408 : Int? = match + let lifted1410 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted1408) + @types.ResultValuePayload::OkValue(lifted1410) } 1 => { - let lifted1409 : Int? = match + let lifted1411 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted1409) + @types.ResultValuePayload::ErrValue(lifted1411) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted1410) + @types.SchemaValueNode::ResultValue(lifted1412) } 23 => { - let result1411 = mbt_ffi_ptr2str( + let result1413 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1413 : String? = match + let lifted1415 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1412 = mbt_ffi_ptr2str( + let result1414 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1412) + Option::Some(result1414) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result1411, - language: lifted1413, + text: result1413, + language: lifted1415, }) } 24 => { - let result1414 = mbt_ffi_ptr2bytes( + let result1416 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1416 : String? = match + let lifted1418 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1415 = mbt_ffi_ptr2str( + let result1417 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1415) + Option::Some(result1417) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result1414, - mime_type: lifted1416, + bytes: result1416, + mime_type: lifted1418, }) } 25 => { - let result1417 = mbt_ffi_ptr2str( + let result1419 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result1417) + @types.SchemaValueNode::PathValue(result1419) } 26 => { - let result1418 = mbt_ffi_ptr2str( + let result1420 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result1418) + @types.SchemaValueNode::UrlValue(result1420) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -13471,7 +13497,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result1419 = mbt_ffi_ptr2str( + let result1421 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -13479,17 +13505,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result1419, + unit: result1421, }) } 30 => { - let result1420 = mbt_ffi_ptr2str( + let result1422 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result1420, + tag: result1422, body: mbt_ffi_load32(iter_base + 16), }) } @@ -13503,21 +13529,27 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array1422.push(lifted1421) + array1424.push(lifted1423) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) Option::Some(@types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array1386, - defs: array1391, + type_nodes: array1388, + defs: array1393, root: mbt_ffi_load32(iter_base + 52), }, value: @types.SchemaValueTree::{ - value_nodes: array1422, + value_nodes: array1424, root: mbt_ffi_load32(iter_base + 64), }, }) @@ -13531,40 +13563,40 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, start_index: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - partial: lifted1424, + partial: lifted1426, }) } 4 => { - let lifted1937 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted1939 = match mbt_ffi_load8_u(iter_base + 24) { 0 => { - let result1425 = mbt_ffi_ptr2str( + let result1427 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let array1622 : Array[@types.SchemaTypeNode] = [] - for index1623 = 0 - index1623 < mbt_ffi_load32(iter_base + 44) - index1623 = index1623 + 1 { + let array1624 : Array[@types.SchemaTypeNode] = [] + for index1625 = 0 + index1625 < mbt_ffi_load32(iter_base + 44) + index1625 = index1625 + 1 { let iter_base = mbt_ffi_load32(iter_base + 40) + - index1623 * 144 + index1625 * 144 - let lifted1608 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1610 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted1432 : @types.NumericRestrictions? = match + let lifted1434 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1427 : @types.NumericBound? = match + let lifted1429 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1426 = match + let lifted1428 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13581,16 +13613,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1426) + Option::Some(lifted1428) } _ => panic() } - let lifted1429 : @types.NumericBound? = match + let lifted1431 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1428 = match + let lifted1430 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13607,46 +13639,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1428) + Option::Some(lifted1430) } _ => panic() } - let lifted1431 : String? = match + let lifted1433 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1430 = mbt_ffi_ptr2str( + let result1432 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1430) + Option::Some(result1432) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1427, - max: lifted1429, - unit: lifted1431, + min: lifted1429, + max: lifted1431, + unit: lifted1433, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted1432) + @types.SchemaTypeBody::S8Type(lifted1434) } 3 => { - let lifted1439 : @types.NumericRestrictions? = match + let lifted1441 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1434 : @types.NumericBound? = match + let lifted1436 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1433 = match + let lifted1435 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13663,16 +13695,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1433) + Option::Some(lifted1435) } _ => panic() } - let lifted1436 : @types.NumericBound? = match + let lifted1438 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1435 = match + let lifted1437 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13689,46 +13721,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1435) + Option::Some(lifted1437) } _ => panic() } - let lifted1438 : String? = match + let lifted1440 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1437 = mbt_ffi_ptr2str( + let result1439 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1437) + Option::Some(result1439) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1434, - max: lifted1436, - unit: lifted1438, + min: lifted1436, + max: lifted1438, + unit: lifted1440, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted1439) + @types.SchemaTypeBody::S16Type(lifted1441) } 4 => { - let lifted1446 : @types.NumericRestrictions? = match + let lifted1448 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1441 : @types.NumericBound? = match + let lifted1443 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1440 = match + let lifted1442 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13745,16 +13777,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1440) + Option::Some(lifted1442) } _ => panic() } - let lifted1443 : @types.NumericBound? = match + let lifted1445 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1442 = match + let lifted1444 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13771,46 +13803,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1442) + Option::Some(lifted1444) } _ => panic() } - let lifted1445 : String? = match + let lifted1447 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1444 = mbt_ffi_ptr2str( + let result1446 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1444) + Option::Some(result1446) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1441, - max: lifted1443, - unit: lifted1445, + min: lifted1443, + max: lifted1445, + unit: lifted1447, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted1446) + @types.SchemaTypeBody::S32Type(lifted1448) } 5 => { - let lifted1453 : @types.NumericRestrictions? = match + let lifted1455 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1448 : @types.NumericBound? = match + let lifted1450 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1447 = match + let lifted1449 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13827,16 +13859,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1447) + Option::Some(lifted1449) } _ => panic() } - let lifted1450 : @types.NumericBound? = match + let lifted1452 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1449 = match + let lifted1451 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13853,46 +13885,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1449) + Option::Some(lifted1451) } _ => panic() } - let lifted1452 : String? = match + let lifted1454 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1451 = mbt_ffi_ptr2str( + let result1453 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1451) + Option::Some(result1453) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1448, - max: lifted1450, - unit: lifted1452, + min: lifted1450, + max: lifted1452, + unit: lifted1454, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted1453) + @types.SchemaTypeBody::S64Type(lifted1455) } 6 => { - let lifted1460 : @types.NumericRestrictions? = match + let lifted1462 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1455 : @types.NumericBound? = match + let lifted1457 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1454 = match + let lifted1456 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13909,16 +13941,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1454) + Option::Some(lifted1456) } _ => panic() } - let lifted1457 : @types.NumericBound? = match + let lifted1459 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1456 = match + let lifted1458 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -13935,46 +13967,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1456) + Option::Some(lifted1458) } _ => panic() } - let lifted1459 : String? = match + let lifted1461 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1458 = mbt_ffi_ptr2str( + let result1460 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1458) + Option::Some(result1460) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1455, - max: lifted1457, - unit: lifted1459, + min: lifted1457, + max: lifted1459, + unit: lifted1461, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted1460) + @types.SchemaTypeBody::U8Type(lifted1462) } 7 => { - let lifted1467 : @types.NumericRestrictions? = match + let lifted1469 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1462 : @types.NumericBound? = match + let lifted1464 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1461 = match + let lifted1463 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -13991,16 +14023,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1461) + Option::Some(lifted1463) } _ => panic() } - let lifted1464 : @types.NumericBound? = match + let lifted1466 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1463 = match + let lifted1465 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14017,46 +14049,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1463) + Option::Some(lifted1465) } _ => panic() } - let lifted1466 : String? = match + let lifted1468 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1465 = mbt_ffi_ptr2str( + let result1467 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1465) + Option::Some(result1467) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1462, - max: lifted1464, - unit: lifted1466, + min: lifted1464, + max: lifted1466, + unit: lifted1468, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted1467) + @types.SchemaTypeBody::U16Type(lifted1469) } 8 => { - let lifted1474 : @types.NumericRestrictions? = match + let lifted1476 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1469 : @types.NumericBound? = match + let lifted1471 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1468 = match + let lifted1470 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -14073,16 +14105,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1468) + Option::Some(lifted1470) } _ => panic() } - let lifted1471 : @types.NumericBound? = match + let lifted1473 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1470 = match + let lifted1472 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14099,46 +14131,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1470) + Option::Some(lifted1472) } _ => panic() } - let lifted1473 : String? = match + let lifted1475 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1472 = mbt_ffi_ptr2str( + let result1474 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1472) + Option::Some(result1474) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1469, - max: lifted1471, - unit: lifted1473, + min: lifted1471, + max: lifted1473, + unit: lifted1475, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1474) + @types.SchemaTypeBody::U32Type(lifted1476) } 9 => { - let lifted1481 : @types.NumericRestrictions? = match + let lifted1483 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1476 : @types.NumericBound? = match + let lifted1478 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1475 = match + let lifted1477 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -14155,16 +14187,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1475) + Option::Some(lifted1477) } _ => panic() } - let lifted1478 : @types.NumericBound? = match + let lifted1480 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1477 = match + let lifted1479 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14181,46 +14213,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1477) + Option::Some(lifted1479) } _ => panic() } - let lifted1480 : String? = match + let lifted1482 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1479 = mbt_ffi_ptr2str( + let result1481 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1479) + Option::Some(result1481) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1476, - max: lifted1478, - unit: lifted1480, + min: lifted1478, + max: lifted1480, + unit: lifted1482, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1481) + @types.SchemaTypeBody::U64Type(lifted1483) } 10 => { - let lifted1488 : @types.NumericRestrictions? = match + let lifted1490 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1483 : @types.NumericBound? = match + let lifted1485 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1482 = match + let lifted1484 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -14237,16 +14269,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1482) + Option::Some(lifted1484) } _ => panic() } - let lifted1485 : @types.NumericBound? = match + let lifted1487 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1484 = match + let lifted1486 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14263,46 +14295,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1484) + Option::Some(lifted1486) } _ => panic() } - let lifted1487 : String? = match + let lifted1489 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1486 = mbt_ffi_ptr2str( + let result1488 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1486) + Option::Some(result1488) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1483, - max: lifted1485, - unit: lifted1487, + min: lifted1485, + max: lifted1487, + unit: lifted1489, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1488) + @types.SchemaTypeBody::F32Type(lifted1490) } 11 => { - let lifted1495 : @types.NumericRestrictions? = match + let lifted1497 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1490 : @types.NumericBound? = match + let lifted1492 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1489 = match + let lifted1491 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -14319,16 +14351,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1489) + Option::Some(lifted1491) } _ => panic() } - let lifted1492 : @types.NumericBound? = match + let lifted1494 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1491 = match + let lifted1493 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -14345,324 +14377,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1491) + Option::Some(lifted1493) } _ => panic() } - let lifted1494 : String? = match + let lifted1496 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1493 = mbt_ffi_ptr2str( + let result1495 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1493) + Option::Some(result1495) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1490, - max: lifted1492, - unit: lifted1494, + min: lifted1492, + max: lifted1494, + unit: lifted1496, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted1495) + @types.SchemaTypeBody::F64Type(lifted1497) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array1510 : Array[@types.NamedFieldType] = [] - for index1511 = 0 - index1511 < mbt_ffi_load32(iter_base + 12) - index1511 = index1511 + 1 { + let array1512 : Array[@types.NamedFieldType] = [] + for index1513 = 0 + index1513 < mbt_ffi_load32(iter_base + 12) + index1513 = index1513 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1511 * 68 + index1513 * 68 - let result1496 = mbt_ffi_ptr2str( + let result1498 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1498 : String? = match + let lifted1500 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1497 = mbt_ffi_ptr2str( + let result1499 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1497) + Option::Some(result1499) } _ => panic() } - let array1500 : Array[String] = [] - for index1501 = 0 - index1501 < mbt_ffi_load32(iter_base + 28) - index1501 = index1501 + 1 { + let array1502 : Array[String] = [] + for index1503 = 0 + index1503 < mbt_ffi_load32(iter_base + 28) + index1503 = index1503 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1501 * 8 + index1503 * 8 - let result1499 = mbt_ffi_ptr2str( + let result1501 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1500.push(result1499) + array1502.push(result1501) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array1503 : Array[String] = [] - for index1504 = 0 - index1504 < mbt_ffi_load32(iter_base + 36) - index1504 = index1504 + 1 { + let array1505 : Array[String] = [] + for index1506 = 0 + index1506 < mbt_ffi_load32(iter_base + 36) + index1506 = index1506 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index1504 * 8 + index1506 * 8 - let result1502 = mbt_ffi_ptr2str( + let result1504 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1503.push(result1502) + array1505.push(result1504) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted1506 : String? = match + let lifted1508 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result1505 = mbt_ffi_ptr2str( + let result1507 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result1505) + Option::Some(result1507) } _ => panic() } - let lifted1509 : @types.Role? = match + let lifted1511 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted1508 = match + let lifted1510 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1507 = mbt_ffi_ptr2str( + let result1509 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result1507) + @types.Role::Other(result1509) } _ => panic() } - Option::Some(lifted1508) + Option::Some(lifted1510) } _ => panic() } - array1510.push(@types.NamedFieldType::{ - name: result1496, + array1512.push(@types.NamedFieldType::{ + name: result1498, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted1498, - aliases: array1500, - examples: array1503, - deprecated: lifted1506, - role: lifted1509, + doc: lifted1500, + aliases: array1502, + examples: array1505, + deprecated: lifted1508, + role: lifted1511, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array1510) + @types.SchemaTypeBody::RecordType(array1512) } 15 => { - let array1527 : Array[@types.VariantCaseType] = [] - for index1528 = 0 - index1528 < mbt_ffi_load32(iter_base + 12) - index1528 = index1528 + 1 { + let array1529 : Array[@types.VariantCaseType] = [] + for index1530 = 0 + index1530 < mbt_ffi_load32(iter_base + 12) + index1530 = index1530 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1528 * 72 + index1530 * 72 - let result1512 = mbt_ffi_ptr2str( + let result1514 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1513 : Int? = match + let lifted1515 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1515 : String? = match + let lifted1517 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1514 = mbt_ffi_ptr2str( + let result1516 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1514) + Option::Some(result1516) } _ => panic() } - let array1517 : Array[String] = [] - for index1518 = 0 - index1518 < mbt_ffi_load32(iter_base + 32) - index1518 = index1518 + 1 { + let array1519 : Array[String] = [] + for index1520 = 0 + index1520 < mbt_ffi_load32(iter_base + 32) + index1520 = index1520 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1518 * 8 + index1520 * 8 - let result1516 = mbt_ffi_ptr2str( + let result1518 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1517.push(result1516) + array1519.push(result1518) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array1520 : Array[String] = [] - for index1521 = 0 - index1521 < mbt_ffi_load32(iter_base + 40) - index1521 = index1521 + 1 { + let array1522 : Array[String] = [] + for index1523 = 0 + index1523 < mbt_ffi_load32(iter_base + 40) + index1523 = index1523 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1521 * 8 + index1523 * 8 - let result1519 = mbt_ffi_ptr2str( + let result1521 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1520.push(result1519) + array1522.push(result1521) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted1523 : String? = match + let lifted1525 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result1522 = mbt_ffi_ptr2str( + let result1524 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result1522) + Option::Some(result1524) } _ => panic() } - let lifted1526 : @types.Role? = match + let lifted1528 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted1525 = match + let lifted1527 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1524 = mbt_ffi_ptr2str( + let result1526 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result1524) + @types.Role::Other(result1526) } _ => panic() } - Option::Some(lifted1525) + Option::Some(lifted1527) } _ => panic() } - array1527.push(@types.VariantCaseType::{ - name: result1512, - payload: lifted1513, + array1529.push(@types.VariantCaseType::{ + name: result1514, + payload: lifted1515, metadata: @types.MetadataEnvelope::{ - doc: lifted1515, - aliases: array1517, - examples: array1520, - deprecated: lifted1523, - role: lifted1526, + doc: lifted1517, + aliases: array1519, + examples: array1522, + deprecated: lifted1525, + role: lifted1528, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array1527) + @types.SchemaTypeBody::VariantType(array1529) } 16 => { - let array1530 : Array[String] = [] - for index1531 = 0 - index1531 < mbt_ffi_load32(iter_base + 12) - index1531 = index1531 + 1 { + let array1532 : Array[String] = [] + for index1533 = 0 + index1533 < mbt_ffi_load32(iter_base + 12) + index1533 = index1533 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1531 * 8 + index1533 * 8 - let result1529 = mbt_ffi_ptr2str( + let result1531 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1530.push(result1529) + array1532.push(result1531) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array1530) + @types.SchemaTypeBody::EnumType(array1532) } 17 => { - let array1533 : Array[String] = [] - for index1534 = 0 - index1534 < mbt_ffi_load32(iter_base + 12) - index1534 = index1534 + 1 { + let array1535 : Array[String] = [] + for index1536 = 0 + index1536 < mbt_ffi_load32(iter_base + 12) + index1536 = index1536 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1534 * 8 + index1536 * 8 - let result1532 = mbt_ffi_ptr2str( + let result1534 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1533.push(result1532) + array1535.push(result1534) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array1533) + @types.SchemaTypeBody::FlagsType(array1535) } 18 => { - let array1535 : Array[Int] = [] - for index1536 = 0 - index1536 < mbt_ffi_load32(iter_base + 12) - index1536 = index1536 + 1 { + let array1537 : Array[Int] = [] + for index1538 = 0 + index1538 < mbt_ffi_load32(iter_base + 12) + index1538 = index1538 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1536 * 4 + index1538 * 4 - array1535.push(mbt_ffi_load32(iter_base + 0)) + array1537.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array1535) + @types.SchemaTypeBody::TupleType(array1537) } 19 => @types.SchemaTypeBody::ListType( @@ -14683,14 +14715,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted1537 : Int? = match + let lifted1539 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1538 : Int? = match + let lifted1540 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -14698,37 +14730,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted1537, - err: lifted1538, + ok: lifted1539, + err: lifted1540, }) } 24 => { - let lifted1542 : Array[String]? = match + let lifted1544 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1540 : Array[String] = [] - for index1541 = 0 - index1541 < mbt_ffi_load32(iter_base + 16) - index1541 = index1541 + 1 { + let array1542 : Array[String] = [] + for index1543 = 0 + index1543 < mbt_ffi_load32(iter_base + 16) + index1543 = index1543 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1541 * 8 + index1543 * 8 - let result1539 = mbt_ffi_ptr2str( + let result1541 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1540.push(result1539) + array1542.push(result1541) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1540) + Option::Some(array1542) } _ => panic() } - let lifted1543 : UInt? = match + let lifted1545 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -14738,7 +14770,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1544 : UInt? = match + let lifted1546 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -14748,54 +14780,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1546 : String? = match + let lifted1548 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1545 = mbt_ffi_ptr2str( + let result1547 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1545) + Option::Some(result1547) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted1542, - min_length: lifted1543, - max_length: lifted1544, - regex: lifted1546, + languages: lifted1544, + min_length: lifted1545, + max_length: lifted1546, + regex: lifted1548, }) } 25 => { - let lifted1550 : Array[String]? = match + let lifted1552 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1548 : Array[String] = [] - for index1549 = 0 - index1549 < mbt_ffi_load32(iter_base + 16) - index1549 = index1549 + 1 { + let array1550 : Array[String] = [] + for index1551 = 0 + index1551 < mbt_ffi_load32(iter_base + 16) + index1551 = index1551 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1549 * 8 + index1551 * 8 - let result1547 = mbt_ffi_ptr2str( + let result1549 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1548.push(result1547) + array1550.push(result1549) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1548) + Option::Some(array1550) } _ => panic() } - let lifted1551 : UInt? = match + let lifted1553 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -14805,7 +14837,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1552 : UInt? = match + let lifted1554 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -14816,58 +14848,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted1550, - min_bytes: lifted1551, - max_bytes: lifted1552, + mime_types: lifted1552, + min_bytes: lifted1553, + max_bytes: lifted1554, }) } 26 => { - let lifted1556 : Array[String]? = match + let lifted1558 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array1554 : Array[String] = [] - for index1555 = 0 - index1555 < mbt_ffi_load32(iter_base + 20) - index1555 = index1555 + 1 { + let array1556 : Array[String] = [] + for index1557 = 0 + index1557 < mbt_ffi_load32(iter_base + 20) + index1557 = index1557 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1555 * 8 + index1557 * 8 - let result1553 = mbt_ffi_ptr2str( + let result1555 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1554.push(result1553) + array1556.push(result1555) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array1554) + Option::Some(array1556) } _ => panic() } - let lifted1560 : Array[String]? = match + let lifted1562 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array1558 : Array[String] = [] - for index1559 = 0 - index1559 < mbt_ffi_load32(iter_base + 32) - index1559 = index1559 + 1 { + let array1560 : Array[String] = [] + for index1561 = 0 + index1561 < mbt_ffi_load32(iter_base + 32) + index1561 = index1561 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1559 * 8 + index1561 * 8 - let result1557 = mbt_ffi_ptr2str( + let result1559 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1558.push(result1557) + array1560.push(result1559) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array1558) + Option::Some(array1560) } _ => panic() } @@ -14879,95 +14911,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted1556, - allowed_extensions: lifted1560, + allowed_mime_types: lifted1558, + allowed_extensions: lifted1562, }) } 27 => { - let lifted1564 : Array[String]? = match + let lifted1566 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1562 : Array[String] = [] - for index1563 = 0 - index1563 < mbt_ffi_load32(iter_base + 16) - index1563 = index1563 + 1 { + let array1564 : Array[String] = [] + for index1565 = 0 + index1565 < mbt_ffi_load32(iter_base + 16) + index1565 = index1565 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1563 * 8 + index1565 * 8 - let result1561 = mbt_ffi_ptr2str( + let result1563 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1562.push(result1561) + array1564.push(result1563) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1562) + Option::Some(array1564) } _ => panic() } - let lifted1568 : Array[String]? = match + let lifted1570 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array1566 : Array[String] = [] - for index1567 = 0 - index1567 < mbt_ffi_load32(iter_base + 28) - index1567 = index1567 + 1 { + let array1568 : Array[String] = [] + for index1569 = 0 + index1569 < mbt_ffi_load32(iter_base + 28) + index1569 = index1569 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1567 * 8 + index1569 * 8 - let result1565 = mbt_ffi_ptr2str( + let result1567 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1566.push(result1565) + array1568.push(result1567) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array1566) + Option::Some(array1568) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted1564, - allowed_hosts: lifted1568, + allowed_schemes: lifted1566, + allowed_hosts: lifted1570, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result1569 = mbt_ffi_ptr2str( + let result1571 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array1571 : Array[String] = [] - for index1572 = 0 - index1572 < mbt_ffi_load32(iter_base + 20) - index1572 = index1572 + 1 { + let array1573 : Array[String] = [] + for index1574 = 0 + index1574 < mbt_ffi_load32(iter_base + 20) + index1574 = index1574 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1572 * 8 + index1574 * 8 - let result1570 = mbt_ffi_ptr2str( + let result1572 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1571.push(result1570) + array1573.push(result1572) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted1574 : @types.QuantityValue? = match + let lifted1576 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1573 = mbt_ffi_ptr2str( + let result1575 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -14975,17 +15007,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result1573, + unit: result1575, }) } _ => panic() } - let lifted1576 : @types.QuantityValue? = match + let lifted1578 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result1575 = mbt_ffi_ptr2str( + let result1577 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -14993,406 +15025,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result1575, + unit: result1577, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result1569, - allowed_suffixes: array1571, - min: lifted1574, - max: lifted1576, + base_unit: result1571, + allowed_suffixes: array1573, + min: lifted1576, + max: lifted1578, }) } 31 => { - let array1600 : Array[@types.UnionBranch] = [] - for index1601 = 0 - index1601 < mbt_ffi_load32(iter_base + 12) - index1601 = index1601 + 1 { + let array1602 : Array[@types.UnionBranch] = [] + for index1603 = 0 + index1603 < mbt_ffi_load32(iter_base + 12) + index1603 = index1603 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1601 * 92 + index1603 * 92 - let result1577 = mbt_ffi_ptr2str( + let result1579 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1586 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted1588 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result1578 = mbt_ffi_ptr2str( + let result1580 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result1578) + @types.DiscriminatorRule::Prefix(result1580) } 1 => { - let result1579 = mbt_ffi_ptr2str( + let result1581 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result1579) + @types.DiscriminatorRule::Suffix(result1581) } 2 => { - let result1580 = mbt_ffi_ptr2str( + let result1582 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result1580) + @types.DiscriminatorRule::Contains(result1582) } 3 => { - let result1581 = mbt_ffi_ptr2str( + let result1583 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result1581) + @types.DiscriminatorRule::Regex(result1583) } 4 => { - let result1582 = mbt_ffi_ptr2str( + let result1584 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted1584 : String? = match + let lifted1586 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1583 = mbt_ffi_ptr2str( + let result1585 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result1583) + Option::Some(result1585) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result1582, - literal: lifted1584, + field_name: result1584, + literal: lifted1586, }) } 5 => { - let result1585 = mbt_ffi_ptr2str( + let result1587 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result1585) + @types.DiscriminatorRule::FieldAbsent(result1587) } _ => panic() } - let lifted1588 : String? = match + let lifted1590 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1587 = mbt_ffi_ptr2str( + let result1589 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1587) + Option::Some(result1589) } _ => panic() } - let array1590 : Array[String] = [] - for index1591 = 0 - index1591 < mbt_ffi_load32(iter_base + 52) - index1591 = index1591 + 1 { + let array1592 : Array[String] = [] + for index1593 = 0 + index1593 < mbt_ffi_load32(iter_base + 52) + index1593 = index1593 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1591 * 8 + index1593 * 8 - let result1589 = mbt_ffi_ptr2str( + let result1591 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1590.push(result1589) + array1592.push(result1591) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1593 : Array[String] = [] - for index1594 = 0 - index1594 < mbt_ffi_load32(iter_base + 60) - index1594 = index1594 + 1 { + let array1595 : Array[String] = [] + for index1596 = 0 + index1596 < mbt_ffi_load32(iter_base + 60) + index1596 = index1596 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1594 * 8 + index1596 * 8 - let result1592 = mbt_ffi_ptr2str( + let result1594 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1593.push(result1592) + array1595.push(result1594) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted1596 : String? = match + let lifted1598 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1595 = mbt_ffi_ptr2str( + let result1597 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1595) + Option::Some(result1597) } _ => panic() } - let lifted1599 : @types.Role? = match + let lifted1601 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted1598 = match + let lifted1600 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1597 = mbt_ffi_ptr2str( + let result1599 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result1597) + @types.Role::Other(result1599) } _ => panic() } - Option::Some(lifted1598) + Option::Some(lifted1600) } _ => panic() } - array1600.push(@types.UnionBranch::{ - tag: result1577, + array1602.push(@types.UnionBranch::{ + tag: result1579, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted1586, + discriminator: lifted1588, metadata: @types.MetadataEnvelope::{ - doc: lifted1588, - aliases: array1590, - examples: array1593, - deprecated: lifted1596, - role: lifted1599, + doc: lifted1590, + aliases: array1592, + examples: array1595, + deprecated: lifted1598, + role: lifted1601, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array1600, + branches: array1602, }) } 32 => { - let lifted1603 : String? = match + let lifted1605 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1602 = mbt_ffi_ptr2str( + let result1604 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1602) + Option::Some(result1604) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted1603, + category: lifted1605, }) } 33 => { - let lifted1605 : String? = match + let lifted1607 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1604 = mbt_ffi_ptr2str( + let result1606 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1604) + Option::Some(result1606) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted1605, + resource_name: lifted1607, }) } 34 => { - let lifted1606 : Int? = match + let lifted1608 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted1606) + @types.SchemaTypeBody::FutureType(lifted1608) } 35 => { - let lifted1607 : Int? = match + let lifted1609 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted1607) + @types.SchemaTypeBody::StreamType(lifted1609) } _ => panic() } - let lifted1610 : String? = match + let lifted1612 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result1609 = mbt_ffi_ptr2str( + let result1611 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result1609) + Option::Some(result1611) } _ => panic() } - let array1612 : Array[String] = [] - for index1613 = 0 - index1613 < mbt_ffi_load32(iter_base + 104) - index1613 = index1613 + 1 { + let array1614 : Array[String] = [] + for index1615 = 0 + index1615 < mbt_ffi_load32(iter_base + 104) + index1615 = index1615 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index1613 * 8 + index1615 * 8 - let result1611 = mbt_ffi_ptr2str( + let result1613 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1612.push(result1611) + array1614.push(result1613) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array1615 : Array[String] = [] - for index1616 = 0 - index1616 < mbt_ffi_load32(iter_base + 112) - index1616 = index1616 + 1 { + let array1617 : Array[String] = [] + for index1618 = 0 + index1618 < mbt_ffi_load32(iter_base + 112) + index1618 = index1618 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index1616 * 8 + index1618 * 8 - let result1614 = mbt_ffi_ptr2str( + let result1616 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1615.push(result1614) + array1617.push(result1616) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted1618 : String? = match + let lifted1620 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result1617 = mbt_ffi_ptr2str( + let result1619 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result1617) + Option::Some(result1619) } _ => panic() } - let lifted1621 : @types.Role? = match + let lifted1623 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted1620 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted1622 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1619 = mbt_ffi_ptr2str( + let result1621 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result1619) + @types.Role::Other(result1621) } _ => panic() } - Option::Some(lifted1620) + Option::Some(lifted1622) } _ => panic() } - array1622.push(@types.SchemaTypeNode::{ - body: lifted1608, + array1624.push(@types.SchemaTypeNode::{ + body: lifted1610, metadata: @types.MetadataEnvelope::{ - doc: lifted1610, - aliases: array1612, - examples: array1615, - deprecated: lifted1618, - role: lifted1621, + doc: lifted1612, + aliases: array1614, + examples: array1617, + deprecated: lifted1620, + role: lifted1623, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 40)) - let array1627 : Array[@types.SchemaTypeDef] = [] - for index1628 = 0 - index1628 < mbt_ffi_load32(iter_base + 52) - index1628 = index1628 + 1 { + let array1629 : Array[@types.SchemaTypeDef] = [] + for index1630 = 0 + index1630 < mbt_ffi_load32(iter_base + 52) + index1630 = index1630 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1628 * 24 + index1630 * 24 - let result1624 = mbt_ffi_ptr2str( + let result1626 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1626 : String? = match + let lifted1628 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1625 = mbt_ffi_ptr2str( + let result1627 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1625) + Option::Some(result1627) } _ => panic() } - array1627.push(@types.SchemaTypeDef::{ - id: result1624, - name: lifted1626, + array1629.push(@types.SchemaTypeDef::{ + id: result1626, + name: lifted1628, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1658 : Array[@types.SchemaValueNode] = [] - for index1659 = 0 - index1659 < mbt_ffi_load32(iter_base + 64) - index1659 = index1659 + 1 { + let array1660 : Array[@types.SchemaValueNode] = [] + for index1661 = 0 + index1661 < mbt_ffi_load32(iter_base + 64) + index1661 = index1661 + 1 { let iter_base = mbt_ffi_load32(iter_base + 60) + - index1659 * 32 + index1661 * 32 - let lifted1657 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1659 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -15444,29 +15476,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result1629 = mbt_ffi_ptr2str( + let result1631 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result1629) + @types.SchemaValueNode::StringValue(result1631) } 13 => { - let array1630 : Array[Int] = [] - for index1631 = 0 - index1631 < mbt_ffi_load32(iter_base + 12) - index1631 = index1631 + 1 { + let array1632 : Array[Int] = [] + for index1633 = 0 + index1633 < mbt_ffi_load32(iter_base + 12) + index1633 = index1633 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1631 * 4 + index1633 * 4 - array1630.push(mbt_ffi_load32(iter_base + 0)) + array1632.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array1630) + @types.SchemaValueNode::RecordValue(array1632) } 14 => { - let lifted1632 : Int? = match + let lifted1634 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -15475,7 +15507,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted1632, + payload: lifted1634, }) } 15 => @@ -15483,34 +15515,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array1633 : Array[Bool] = [] - for index1634 = 0 - index1634 < mbt_ffi_load32(iter_base + 12) - index1634 = index1634 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index1634 * 1 - - array1633.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array1633) - } - 17 => { - let array1635 : Array[Int] = [] + let array1635 : Array[Bool] = [] for index1636 = 0 index1636 < mbt_ffi_load32(iter_base + 12) index1636 = index1636 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1636 * 4 + index1636 * 1 - array1635.push(mbt_ffi_load32(iter_base + 0)) + array1635.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array1635) + @types.SchemaValueNode::FlagsValue(array1635) } - 18 => { + 17 => { let array1637 : Array[Int] = [] for index1638 = 0 index1638 < mbt_ffi_load32(iter_base + 12) @@ -15522,9 +15540,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array1637) + @types.SchemaValueNode::TupleValue(array1637) } - 19 => { + 18 => { let array1639 : Array[Int] = [] for index1640 = 0 index1640 < mbt_ffi_load32(iter_base + 12) @@ -15536,127 +15554,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array1639) + @types.SchemaValueNode::ListValue(array1639) } - 20 => { - let array1641 : Array[@types.MapEntry] = [] + 19 => { + let array1641 : Array[Int] = [] for index1642 = 0 index1642 < mbt_ffi_load32(iter_base + 12) index1642 = index1642 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1642 * 8 + index1642 * 4 + + array1641.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array1641) + } + 20 => { + let array1643 : Array[@types.MapEntry] = [] + for index1644 = 0 + index1644 < mbt_ffi_load32(iter_base + 12) + index1644 = index1644 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index1644 * 8 - array1641.push(@types.MapEntry::{ + array1643.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array1641) + @types.SchemaValueNode::MapValue(array1643) } 21 => { - let lifted1643 : Int? = match + let lifted1645 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted1643) + @types.SchemaValueNode::OptionValue(lifted1645) } 22 => { - let lifted1646 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted1648 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted1644 : Int? = match + let lifted1646 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted1644) + @types.ResultValuePayload::OkValue(lifted1646) } 1 => { - let lifted1645 : Int? = match + let lifted1647 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted1645) + @types.ResultValuePayload::ErrValue(lifted1647) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted1646) + @types.SchemaValueNode::ResultValue(lifted1648) } 23 => { - let result1647 = mbt_ffi_ptr2str( + let result1649 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1649 : String? = match + let lifted1651 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1648 = mbt_ffi_ptr2str( + let result1650 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1648) + Option::Some(result1650) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result1647, - language: lifted1649, + text: result1649, + language: lifted1651, }) } 24 => { - let result1650 = mbt_ffi_ptr2bytes( + let result1652 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1652 : String? = match + let lifted1654 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1651 = mbt_ffi_ptr2str( + let result1653 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1651) + Option::Some(result1653) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result1650, - mime_type: lifted1652, + bytes: result1652, + mime_type: lifted1654, }) } 25 => { - let result1653 = mbt_ffi_ptr2str( + let result1655 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result1653) + @types.SchemaValueNode::PathValue(result1655) } 26 => { - let result1654 = mbt_ffi_ptr2str( + let result1656 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result1654) + @types.SchemaValueNode::UrlValue(result1656) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -15668,7 +15700,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result1655 = mbt_ffi_ptr2str( + let result1657 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -15676,17 +15708,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result1655, + unit: result1657, }) } 30 => { - let result1656 = mbt_ffi_ptr2str( + let result1658 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result1656, + tag: result1658, body: mbt_ffi_load32(iter_base + 16), }) } @@ -15700,68 +15732,74 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array1658.push(lifted1657) + array1660.push(lifted1659) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) - let result1660 = mbt_ffi_ptr2str( + let result1662 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 72), mbt_ffi_load32(iter_base + 76), ) - let array1662 : Array[String] = [] - for index1663 = 0 - index1663 < mbt_ffi_load32(iter_base + 84) - index1663 = index1663 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 80) + index1663 * 8 + let array1664 : Array[String] = [] + for index1665 = 0 + index1665 < mbt_ffi_load32(iter_base + 84) + index1665 = index1665 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 80) + index1665 * 8 - let result1661 = mbt_ffi_ptr2str( + let result1663 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1662.push(result1661) + array1664.push(result1663) } mbt_ffi_free(mbt_ffi_load32(iter_base + 80)) - let array1677 : Array[Array[SpanData]] = [] - for index1678 = 0 - index1678 < mbt_ffi_load32(iter_base + 92) - index1678 = index1678 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 88) + index1678 * 8 + let array1679 : Array[Array[SpanData]] = [] + for index1680 = 0 + index1680 < mbt_ffi_load32(iter_base + 92) + index1680 = index1680 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 88) + index1680 * 8 - let array1675 : Array[SpanData] = [] - for index1676 = 0 - index1676 < mbt_ffi_load32(iter_base + 4) - index1676 = index1676 + 1 { + let array1677 : Array[SpanData] = [] + for index1678 = 0 + index1678 < mbt_ffi_load32(iter_base + 4) + index1678 = index1678 + 1 { let iter_base = mbt_ffi_load32(iter_base + 0) + - index1676 * 80 + index1678 * 80 - let lifted1674 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1676 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result1664 = mbt_ffi_ptr2str( + let result1666 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1666 : String? = match + let lifted1668 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result1665 = mbt_ffi_ptr2str( + let result1667 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result1665) + Option::Some(result1667) } _ => panic() } - let lifted1667 : UInt64? = match + let lifted1669 : UInt64? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -15771,123 +15809,123 @@ pub fn enrich_oplog_entries( _ => panic() } - let array1671 : Array[@context.Attribute] = [] - for index1672 = 0 - index1672 < mbt_ffi_load32(iter_base + 68) - index1672 = index1672 + 1 { + let array1673 : Array[@context.Attribute] = [] + for index1674 = 0 + index1674 < mbt_ffi_load32(iter_base + 68) + index1674 = index1674 + 1 { let iter_base = mbt_ffi_load32(iter_base + 64) + - index1672 * 20 + index1674 * 20 - let result1668 = mbt_ffi_ptr2str( + let result1670 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1670 = match + let lifted1672 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result1669 = mbt_ffi_ptr2str( + let result1671 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result1669) + @context.AttributeValue::String(result1671) } _ => panic() } - array1671.push(@context.Attribute::{ - key: result1668, - value: lifted1670, + array1673.push(@context.Attribute::{ + key: result1670, + value: lifted1672, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) SpanData::LocalSpan(LocalSpanData::{ - span_id: result1664, + span_id: result1666, start: @system-clock.Instant::{ seconds: mbt_ffi_load64(iter_base + 16), nanoseconds: mbt_ffi_load32(iter_base + 24).reinterpret_as_uint(), }, - parent: lifted1666, - linked_context: lifted1667, - attributes: array1671, + parent: lifted1668, + linked_context: lifted1669, + attributes: array1673, inherited: mbt_ffi_load8_u(iter_base + 72) != 0, }) } 1 => { - let result1673 = mbt_ffi_ptr2str( + let result1675 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) SpanData::ExternalSpan(ExternalSpanData::{ - span_id: result1673, + span_id: result1675, }) } _ => panic() } - array1675.push(lifted1674) + array1677.push(lifted1676) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - array1677.push(array1675) + array1679.push(array1677) } mbt_ffi_free(mbt_ffi_load32(iter_base + 88)) AgentInvocation::AgentInitialization(AgentInitializationParameters::{ - idempotency_key: result1425, + idempotency_key: result1427, constructor_parameters: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array1622, - defs: array1627, + type_nodes: array1624, + defs: array1629, root: mbt_ffi_load32(iter_base + 56), }, value: @types.SchemaValueTree::{ - value_nodes: array1658, + value_nodes: array1660, root: mbt_ffi_load32(iter_base + 68), }, }, - trace_id: result1660, - trace_states: array1662, - invocation_context: array1677, + trace_id: result1662, + trace_states: array1664, + invocation_context: array1679, }) } 1 => { - let result1679 = mbt_ffi_ptr2str( + let result1681 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result1680 = mbt_ffi_ptr2str( + let result1682 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - let array1877 : Array[@types.SchemaTypeNode] = [] - for index1878 = 0 - index1878 < mbt_ffi_load32(iter_base + 52) - index1878 = index1878 + 1 { + let array1879 : Array[@types.SchemaTypeNode] = [] + for index1880 = 0 + index1880 < mbt_ffi_load32(iter_base + 52) + index1880 = index1880 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1878 * 144 + index1880 * 144 - let lifted1863 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1865 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted1687 : @types.NumericRestrictions? = match + let lifted1689 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1682 : @types.NumericBound? = match + let lifted1684 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1681 = match + let lifted1683 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -15904,16 +15942,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1681) + Option::Some(lifted1683) } _ => panic() } - let lifted1684 : @types.NumericBound? = match + let lifted1686 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1683 = match + let lifted1685 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -15930,46 +15968,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1683) + Option::Some(lifted1685) } _ => panic() } - let lifted1686 : String? = match + let lifted1688 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1685 = mbt_ffi_ptr2str( + let result1687 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1685) + Option::Some(result1687) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1682, - max: lifted1684, - unit: lifted1686, + min: lifted1684, + max: lifted1686, + unit: lifted1688, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted1687) + @types.SchemaTypeBody::S8Type(lifted1689) } 3 => { - let lifted1694 : @types.NumericRestrictions? = match + let lifted1696 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1689 : @types.NumericBound? = match + let lifted1691 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1688 = match + let lifted1690 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -15986,16 +16024,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1688) + Option::Some(lifted1690) } _ => panic() } - let lifted1691 : @types.NumericBound? = match + let lifted1693 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1690 = match + let lifted1692 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16012,46 +16050,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1690) + Option::Some(lifted1692) } _ => panic() } - let lifted1693 : String? = match + let lifted1695 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1692 = mbt_ffi_ptr2str( + let result1694 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1692) + Option::Some(result1694) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1689, - max: lifted1691, - unit: lifted1693, + min: lifted1691, + max: lifted1693, + unit: lifted1695, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted1694) + @types.SchemaTypeBody::S16Type(lifted1696) } 4 => { - let lifted1701 : @types.NumericRestrictions? = match + let lifted1703 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1696 : @types.NumericBound? = match + let lifted1698 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1695 = match + let lifted1697 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16068,16 +16106,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1695) + Option::Some(lifted1697) } _ => panic() } - let lifted1698 : @types.NumericBound? = match + let lifted1700 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1697 = match + let lifted1699 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16094,46 +16132,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1697) + Option::Some(lifted1699) } _ => panic() } - let lifted1700 : String? = match + let lifted1702 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1699 = mbt_ffi_ptr2str( + let result1701 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1699) + Option::Some(result1701) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1696, - max: lifted1698, - unit: lifted1700, + min: lifted1698, + max: lifted1700, + unit: lifted1702, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted1701) + @types.SchemaTypeBody::S32Type(lifted1703) } 5 => { - let lifted1708 : @types.NumericRestrictions? = match + let lifted1710 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1703 : @types.NumericBound? = match + let lifted1705 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1702 = match + let lifted1704 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16150,16 +16188,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1702) + Option::Some(lifted1704) } _ => panic() } - let lifted1705 : @types.NumericBound? = match + let lifted1707 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1704 = match + let lifted1706 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16176,46 +16214,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1704) + Option::Some(lifted1706) } _ => panic() } - let lifted1707 : String? = match + let lifted1709 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1706 = mbt_ffi_ptr2str( + let result1708 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1706) + Option::Some(result1708) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1703, - max: lifted1705, - unit: lifted1707, + min: lifted1705, + max: lifted1707, + unit: lifted1709, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted1708) + @types.SchemaTypeBody::S64Type(lifted1710) } 6 => { - let lifted1715 : @types.NumericRestrictions? = match + let lifted1717 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1710 : @types.NumericBound? = match + let lifted1712 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1709 = match + let lifted1711 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16232,16 +16270,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1709) + Option::Some(lifted1711) } _ => panic() } - let lifted1712 : @types.NumericBound? = match + let lifted1714 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1711 = match + let lifted1713 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16258,46 +16296,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1711) + Option::Some(lifted1713) } _ => panic() } - let lifted1714 : String? = match + let lifted1716 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1713 = mbt_ffi_ptr2str( + let result1715 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1713) + Option::Some(result1715) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1710, - max: lifted1712, - unit: lifted1714, + min: lifted1712, + max: lifted1714, + unit: lifted1716, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted1715) + @types.SchemaTypeBody::U8Type(lifted1717) } 7 => { - let lifted1722 : @types.NumericRestrictions? = match + let lifted1724 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1717 : @types.NumericBound? = match + let lifted1719 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1716 = match + let lifted1718 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16314,16 +16352,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1716) + Option::Some(lifted1718) } _ => panic() } - let lifted1719 : @types.NumericBound? = match + let lifted1721 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1718 = match + let lifted1720 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16340,46 +16378,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1718) + Option::Some(lifted1720) } _ => panic() } - let lifted1721 : String? = match + let lifted1723 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1720 = mbt_ffi_ptr2str( + let result1722 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1720) + Option::Some(result1722) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1717, - max: lifted1719, - unit: lifted1721, + min: lifted1719, + max: lifted1721, + unit: lifted1723, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted1722) + @types.SchemaTypeBody::U16Type(lifted1724) } 8 => { - let lifted1729 : @types.NumericRestrictions? = match + let lifted1731 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1724 : @types.NumericBound? = match + let lifted1726 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1723 = match + let lifted1725 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16396,16 +16434,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1723) + Option::Some(lifted1725) } _ => panic() } - let lifted1726 : @types.NumericBound? = match + let lifted1728 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1725 = match + let lifted1727 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16422,46 +16460,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1725) + Option::Some(lifted1727) } _ => panic() } - let lifted1728 : String? = match + let lifted1730 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1727 = mbt_ffi_ptr2str( + let result1729 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1727) + Option::Some(result1729) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1724, - max: lifted1726, - unit: lifted1728, + min: lifted1726, + max: lifted1728, + unit: lifted1730, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1729) + @types.SchemaTypeBody::U32Type(lifted1731) } 9 => { - let lifted1736 : @types.NumericRestrictions? = match + let lifted1738 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1731 : @types.NumericBound? = match + let lifted1733 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1730 = match + let lifted1732 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16478,16 +16516,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1730) + Option::Some(lifted1732) } _ => panic() } - let lifted1733 : @types.NumericBound? = match + let lifted1735 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1732 = match + let lifted1734 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16504,46 +16542,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1732) + Option::Some(lifted1734) } _ => panic() } - let lifted1735 : String? = match + let lifted1737 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1734 = mbt_ffi_ptr2str( + let result1736 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1734) + Option::Some(result1736) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1731, - max: lifted1733, - unit: lifted1735, + min: lifted1733, + max: lifted1735, + unit: lifted1737, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1736) + @types.SchemaTypeBody::U64Type(lifted1738) } 10 => { - let lifted1743 : @types.NumericRestrictions? = match + let lifted1745 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1738 : @types.NumericBound? = match + let lifted1740 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1737 = match + let lifted1739 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16560,16 +16598,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1737) + Option::Some(lifted1739) } _ => panic() } - let lifted1740 : @types.NumericBound? = match + let lifted1742 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1739 = match + let lifted1741 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16586,46 +16624,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1739) + Option::Some(lifted1741) } _ => panic() } - let lifted1742 : String? = match + let lifted1744 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1741 = mbt_ffi_ptr2str( + let result1743 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1741) + Option::Some(result1743) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1738, - max: lifted1740, - unit: lifted1742, + min: lifted1740, + max: lifted1742, + unit: lifted1744, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted1743) + @types.SchemaTypeBody::F32Type(lifted1745) } 11 => { - let lifted1750 : @types.NumericRestrictions? = match + let lifted1752 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1745 : @types.NumericBound? = match + let lifted1747 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1744 = match + let lifted1746 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -16642,16 +16680,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1744) + Option::Some(lifted1746) } _ => panic() } - let lifted1747 : @types.NumericBound? = match + let lifted1749 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1746 = match + let lifted1748 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -16668,324 +16706,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1746) + Option::Some(lifted1748) } _ => panic() } - let lifted1749 : String? = match + let lifted1751 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1748 = mbt_ffi_ptr2str( + let result1750 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1748) + Option::Some(result1750) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1745, - max: lifted1747, - unit: lifted1749, + min: lifted1747, + max: lifted1749, + unit: lifted1751, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted1750) + @types.SchemaTypeBody::F64Type(lifted1752) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array1765 : Array[@types.NamedFieldType] = [] - for index1766 = 0 - index1766 < mbt_ffi_load32(iter_base + 12) - index1766 = index1766 + 1 { + let array1767 : Array[@types.NamedFieldType] = [] + for index1768 = 0 + index1768 < mbt_ffi_load32(iter_base + 12) + index1768 = index1768 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1766 * 68 + index1768 * 68 - let result1751 = mbt_ffi_ptr2str( + let result1753 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1753 : String? = match + let lifted1755 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1752 = mbt_ffi_ptr2str( + let result1754 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1752) + Option::Some(result1754) } _ => panic() } - let array1755 : Array[String] = [] - for index1756 = 0 - index1756 < mbt_ffi_load32(iter_base + 28) - index1756 = index1756 + 1 { + let array1757 : Array[String] = [] + for index1758 = 0 + index1758 < mbt_ffi_load32(iter_base + 28) + index1758 = index1758 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1756 * 8 + index1758 * 8 - let result1754 = mbt_ffi_ptr2str( + let result1756 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1755.push(result1754) + array1757.push(result1756) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array1758 : Array[String] = [] - for index1759 = 0 - index1759 < mbt_ffi_load32(iter_base + 36) - index1759 = index1759 + 1 { + let array1760 : Array[String] = [] + for index1761 = 0 + index1761 < mbt_ffi_load32(iter_base + 36) + index1761 = index1761 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index1759 * 8 + index1761 * 8 - let result1757 = mbt_ffi_ptr2str( + let result1759 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1758.push(result1757) + array1760.push(result1759) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted1761 : String? = match + let lifted1763 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result1760 = mbt_ffi_ptr2str( + let result1762 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result1760) + Option::Some(result1762) } _ => panic() } - let lifted1764 : @types.Role? = match + let lifted1766 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted1763 = match + let lifted1765 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1762 = mbt_ffi_ptr2str( + let result1764 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result1762) + @types.Role::Other(result1764) } _ => panic() } - Option::Some(lifted1763) + Option::Some(lifted1765) } _ => panic() } - array1765.push(@types.NamedFieldType::{ - name: result1751, + array1767.push(@types.NamedFieldType::{ + name: result1753, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted1753, - aliases: array1755, - examples: array1758, - deprecated: lifted1761, - role: lifted1764, + doc: lifted1755, + aliases: array1757, + examples: array1760, + deprecated: lifted1763, + role: lifted1766, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array1765) + @types.SchemaTypeBody::RecordType(array1767) } 15 => { - let array1782 : Array[@types.VariantCaseType] = [] - for index1783 = 0 - index1783 < mbt_ffi_load32(iter_base + 12) - index1783 = index1783 + 1 { + let array1784 : Array[@types.VariantCaseType] = [] + for index1785 = 0 + index1785 < mbt_ffi_load32(iter_base + 12) + index1785 = index1785 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1783 * 72 + index1785 * 72 - let result1767 = mbt_ffi_ptr2str( + let result1769 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1768 : Int? = match + let lifted1770 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1770 : String? = match + let lifted1772 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1769 = mbt_ffi_ptr2str( + let result1771 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1769) + Option::Some(result1771) } _ => panic() } - let array1772 : Array[String] = [] - for index1773 = 0 - index1773 < mbt_ffi_load32(iter_base + 32) - index1773 = index1773 + 1 { + let array1774 : Array[String] = [] + for index1775 = 0 + index1775 < mbt_ffi_load32(iter_base + 32) + index1775 = index1775 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1773 * 8 + index1775 * 8 - let result1771 = mbt_ffi_ptr2str( + let result1773 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1772.push(result1771) + array1774.push(result1773) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array1775 : Array[String] = [] - for index1776 = 0 - index1776 < mbt_ffi_load32(iter_base + 40) - index1776 = index1776 + 1 { + let array1777 : Array[String] = [] + for index1778 = 0 + index1778 < mbt_ffi_load32(iter_base + 40) + index1778 = index1778 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index1776 * 8 + index1778 * 8 - let result1774 = mbt_ffi_ptr2str( + let result1776 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1775.push(result1774) + array1777.push(result1776) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted1778 : String? = match + let lifted1780 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result1777 = mbt_ffi_ptr2str( + let result1779 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result1777) + Option::Some(result1779) } _ => panic() } - let lifted1781 : @types.Role? = match + let lifted1783 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted1780 = match + let lifted1782 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1779 = mbt_ffi_ptr2str( + let result1781 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result1779) + @types.Role::Other(result1781) } _ => panic() } - Option::Some(lifted1780) + Option::Some(lifted1782) } _ => panic() } - array1782.push(@types.VariantCaseType::{ - name: result1767, - payload: lifted1768, + array1784.push(@types.VariantCaseType::{ + name: result1769, + payload: lifted1770, metadata: @types.MetadataEnvelope::{ - doc: lifted1770, - aliases: array1772, - examples: array1775, - deprecated: lifted1778, - role: lifted1781, + doc: lifted1772, + aliases: array1774, + examples: array1777, + deprecated: lifted1780, + role: lifted1783, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array1782) + @types.SchemaTypeBody::VariantType(array1784) } 16 => { - let array1785 : Array[String] = [] - for index1786 = 0 - index1786 < mbt_ffi_load32(iter_base + 12) - index1786 = index1786 + 1 { + let array1787 : Array[String] = [] + for index1788 = 0 + index1788 < mbt_ffi_load32(iter_base + 12) + index1788 = index1788 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1786 * 8 + index1788 * 8 - let result1784 = mbt_ffi_ptr2str( + let result1786 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1785.push(result1784) + array1787.push(result1786) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array1785) + @types.SchemaTypeBody::EnumType(array1787) } 17 => { - let array1788 : Array[String] = [] - for index1789 = 0 - index1789 < mbt_ffi_load32(iter_base + 12) - index1789 = index1789 + 1 { + let array1790 : Array[String] = [] + for index1791 = 0 + index1791 < mbt_ffi_load32(iter_base + 12) + index1791 = index1791 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1789 * 8 + index1791 * 8 - let result1787 = mbt_ffi_ptr2str( + let result1789 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1788.push(result1787) + array1790.push(result1789) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array1788) + @types.SchemaTypeBody::FlagsType(array1790) } 18 => { - let array1790 : Array[Int] = [] - for index1791 = 0 - index1791 < mbt_ffi_load32(iter_base + 12) - index1791 = index1791 + 1 { + let array1792 : Array[Int] = [] + for index1793 = 0 + index1793 < mbt_ffi_load32(iter_base + 12) + index1793 = index1793 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1791 * 4 + index1793 * 4 - array1790.push(mbt_ffi_load32(iter_base + 0)) + array1792.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array1790) + @types.SchemaTypeBody::TupleType(array1792) } 19 => @types.SchemaTypeBody::ListType( @@ -17006,14 +17044,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted1792 : Int? = match + let lifted1794 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted1793 : Int? = match + let lifted1795 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -17021,37 +17059,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted1792, - err: lifted1793, + ok: lifted1794, + err: lifted1795, }) } 24 => { - let lifted1797 : Array[String]? = match + let lifted1799 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1795 : Array[String] = [] - for index1796 = 0 - index1796 < mbt_ffi_load32(iter_base + 16) - index1796 = index1796 + 1 { + let array1797 : Array[String] = [] + for index1798 = 0 + index1798 < mbt_ffi_load32(iter_base + 16) + index1798 = index1798 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1796 * 8 + index1798 * 8 - let result1794 = mbt_ffi_ptr2str( + let result1796 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1795.push(result1794) + array1797.push(result1796) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1795) + Option::Some(array1797) } _ => panic() } - let lifted1798 : UInt? = match + let lifted1800 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -17061,7 +17099,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1799 : UInt? = match + let lifted1801 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -17071,54 +17109,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1801 : String? = match + let lifted1803 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1800 = mbt_ffi_ptr2str( + let result1802 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1800) + Option::Some(result1802) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted1797, - min_length: lifted1798, - max_length: lifted1799, - regex: lifted1801, + languages: lifted1799, + min_length: lifted1800, + max_length: lifted1801, + regex: lifted1803, }) } 25 => { - let lifted1805 : Array[String]? = match + let lifted1807 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1803 : Array[String] = [] - for index1804 = 0 - index1804 < mbt_ffi_load32(iter_base + 16) - index1804 = index1804 + 1 { + let array1805 : Array[String] = [] + for index1806 = 0 + index1806 < mbt_ffi_load32(iter_base + 16) + index1806 = index1806 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1804 * 8 + index1806 * 8 - let result1802 = mbt_ffi_ptr2str( + let result1804 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1803.push(result1802) + array1805.push(result1804) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1803) + Option::Some(array1805) } _ => panic() } - let lifted1806 : UInt? = match + let lifted1808 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -17128,7 +17166,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted1807 : UInt? = match + let lifted1809 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -17139,58 +17177,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted1805, - min_bytes: lifted1806, - max_bytes: lifted1807, + mime_types: lifted1807, + min_bytes: lifted1808, + max_bytes: lifted1809, }) } 26 => { - let lifted1811 : Array[String]? = match + let lifted1813 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array1809 : Array[String] = [] - for index1810 = 0 - index1810 < mbt_ffi_load32(iter_base + 20) - index1810 = index1810 + 1 { + let array1811 : Array[String] = [] + for index1812 = 0 + index1812 < mbt_ffi_load32(iter_base + 20) + index1812 = index1812 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1810 * 8 + index1812 * 8 - let result1808 = mbt_ffi_ptr2str( + let result1810 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1809.push(result1808) + array1811.push(result1810) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array1809) + Option::Some(array1811) } _ => panic() } - let lifted1815 : Array[String]? = match + let lifted1817 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array1813 : Array[String] = [] - for index1814 = 0 - index1814 < mbt_ffi_load32(iter_base + 32) - index1814 = index1814 + 1 { + let array1815 : Array[String] = [] + for index1816 = 0 + index1816 < mbt_ffi_load32(iter_base + 32) + index1816 = index1816 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index1814 * 8 + index1816 * 8 - let result1812 = mbt_ffi_ptr2str( + let result1814 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1813.push(result1812) + array1815.push(result1814) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array1813) + Option::Some(array1815) } _ => panic() } @@ -17202,95 +17240,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted1811, - allowed_extensions: lifted1815, + allowed_mime_types: lifted1813, + allowed_extensions: lifted1817, }) } 27 => { - let lifted1819 : Array[String]? = match + let lifted1821 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array1817 : Array[String] = [] - for index1818 = 0 - index1818 < mbt_ffi_load32(iter_base + 16) - index1818 = index1818 + 1 { + let array1819 : Array[String] = [] + for index1820 = 0 + index1820 < mbt_ffi_load32(iter_base + 16) + index1820 = index1820 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index1818 * 8 + index1820 * 8 - let result1816 = mbt_ffi_ptr2str( + let result1818 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1817.push(result1816) + array1819.push(result1818) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array1817) + Option::Some(array1819) } _ => panic() } - let lifted1823 : Array[String]? = match + let lifted1825 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array1821 : Array[String] = [] - for index1822 = 0 - index1822 < mbt_ffi_load32(iter_base + 28) - index1822 = index1822 + 1 { + let array1823 : Array[String] = [] + for index1824 = 0 + index1824 < mbt_ffi_load32(iter_base + 28) + index1824 = index1824 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index1822 * 8 + index1824 * 8 - let result1820 = mbt_ffi_ptr2str( + let result1822 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1821.push(result1820) + array1823.push(result1822) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array1821) + Option::Some(array1823) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted1819, - allowed_hosts: lifted1823, + allowed_schemes: lifted1821, + allowed_hosts: lifted1825, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result1824 = mbt_ffi_ptr2str( + let result1826 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array1826 : Array[String] = [] - for index1827 = 0 - index1827 < mbt_ffi_load32(iter_base + 20) - index1827 = index1827 + 1 { + let array1828 : Array[String] = [] + for index1829 = 0 + index1829 < mbt_ffi_load32(iter_base + 20) + index1829 = index1829 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index1827 * 8 + index1829 * 8 - let result1825 = mbt_ffi_ptr2str( + let result1827 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1826.push(result1825) + array1828.push(result1827) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted1829 : @types.QuantityValue? = match + let lifted1831 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1828 = mbt_ffi_ptr2str( + let result1830 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -17298,17 +17336,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result1828, + unit: result1830, }) } _ => panic() } - let lifted1831 : @types.QuantityValue? = match + let lifted1833 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result1830 = mbt_ffi_ptr2str( + let result1832 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -17316,406 +17354,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result1830, + unit: result1832, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result1824, - allowed_suffixes: array1826, - min: lifted1829, - max: lifted1831, + base_unit: result1826, + allowed_suffixes: array1828, + min: lifted1831, + max: lifted1833, }) } 31 => { - let array1855 : Array[@types.UnionBranch] = [] - for index1856 = 0 - index1856 < mbt_ffi_load32(iter_base + 12) - index1856 = index1856 + 1 { + let array1857 : Array[@types.UnionBranch] = [] + for index1858 = 0 + index1858 < mbt_ffi_load32(iter_base + 12) + index1858 = index1858 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1856 * 92 + index1858 * 92 - let result1832 = mbt_ffi_ptr2str( + let result1834 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1841 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted1843 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result1833 = mbt_ffi_ptr2str( + let result1835 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result1833) + @types.DiscriminatorRule::Prefix(result1835) } 1 => { - let result1834 = mbt_ffi_ptr2str( + let result1836 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result1834) + @types.DiscriminatorRule::Suffix(result1836) } 2 => { - let result1835 = mbt_ffi_ptr2str( + let result1837 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result1835) + @types.DiscriminatorRule::Contains(result1837) } 3 => { - let result1836 = mbt_ffi_ptr2str( + let result1838 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result1836) + @types.DiscriminatorRule::Regex(result1838) } 4 => { - let result1837 = mbt_ffi_ptr2str( + let result1839 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted1839 : String? = match + let lifted1841 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result1838 = mbt_ffi_ptr2str( + let result1840 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result1838) + Option::Some(result1840) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result1837, - literal: lifted1839, + field_name: result1839, + literal: lifted1841, }) } 5 => { - let result1840 = mbt_ffi_ptr2str( + let result1842 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result1840) + @types.DiscriminatorRule::FieldAbsent(result1842) } _ => panic() } - let lifted1843 : String? = match + let lifted1845 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result1842 = mbt_ffi_ptr2str( + let result1844 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result1842) + Option::Some(result1844) } _ => panic() } - let array1845 : Array[String] = [] - for index1846 = 0 - index1846 < mbt_ffi_load32(iter_base + 52) - index1846 = index1846 + 1 { + let array1847 : Array[String] = [] + for index1848 = 0 + index1848 < mbt_ffi_load32(iter_base + 52) + index1848 = index1848 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index1846 * 8 + index1848 * 8 - let result1844 = mbt_ffi_ptr2str( + let result1846 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1845.push(result1844) + array1847.push(result1846) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1848 : Array[String] = [] - for index1849 = 0 - index1849 < mbt_ffi_load32(iter_base + 60) - index1849 = index1849 + 1 { + let array1850 : Array[String] = [] + for index1851 = 0 + index1851 < mbt_ffi_load32(iter_base + 60) + index1851 = index1851 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1849 * 8 + index1851 * 8 - let result1847 = mbt_ffi_ptr2str( + let result1849 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1848.push(result1847) + array1850.push(result1849) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted1851 : String? = match + let lifted1853 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1850 = mbt_ffi_ptr2str( + let result1852 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1850) + Option::Some(result1852) } _ => panic() } - let lifted1854 : @types.Role? = match + let lifted1856 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted1853 = match + let lifted1855 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1852 = mbt_ffi_ptr2str( + let result1854 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result1852) + @types.Role::Other(result1854) } _ => panic() } - Option::Some(lifted1853) + Option::Some(lifted1855) } _ => panic() } - array1855.push(@types.UnionBranch::{ - tag: result1832, + array1857.push(@types.UnionBranch::{ + tag: result1834, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted1841, + discriminator: lifted1843, metadata: @types.MetadataEnvelope::{ - doc: lifted1843, - aliases: array1845, - examples: array1848, - deprecated: lifted1851, - role: lifted1854, + doc: lifted1845, + aliases: array1847, + examples: array1850, + deprecated: lifted1853, + role: lifted1856, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array1855, + branches: array1857, }) } 32 => { - let lifted1858 : String? = match + let lifted1860 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result1857 = mbt_ffi_ptr2str( + let result1859 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result1857) + Option::Some(result1859) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted1858, + category: lifted1860, }) } 33 => { - let lifted1860 : String? = match + let lifted1862 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1859 = mbt_ffi_ptr2str( + let result1861 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1859) + Option::Some(result1861) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted1860, + resource_name: lifted1862, }) } 34 => { - let lifted1861 : Int? = match + let lifted1863 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted1861) + @types.SchemaTypeBody::FutureType(lifted1863) } 35 => { - let lifted1862 : Int? = match + let lifted1864 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted1862) + @types.SchemaTypeBody::StreamType(lifted1864) } _ => panic() } - let lifted1865 : String? = match + let lifted1867 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result1864 = mbt_ffi_ptr2str( + let result1866 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result1864) + Option::Some(result1866) } _ => panic() } - let array1867 : Array[String] = [] - for index1868 = 0 - index1868 < mbt_ffi_load32(iter_base + 104) - index1868 = index1868 + 1 { + let array1869 : Array[String] = [] + for index1870 = 0 + index1870 < mbt_ffi_load32(iter_base + 104) + index1870 = index1870 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index1868 * 8 + index1870 * 8 - let result1866 = mbt_ffi_ptr2str( + let result1868 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1867.push(result1866) + array1869.push(result1868) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array1870 : Array[String] = [] - for index1871 = 0 - index1871 < mbt_ffi_load32(iter_base + 112) - index1871 = index1871 + 1 { + let array1872 : Array[String] = [] + for index1873 = 0 + index1873 < mbt_ffi_load32(iter_base + 112) + index1873 = index1873 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index1871 * 8 + index1873 * 8 - let result1869 = mbt_ffi_ptr2str( + let result1871 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1870.push(result1869) + array1872.push(result1871) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted1873 : String? = match + let lifted1875 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result1872 = mbt_ffi_ptr2str( + let result1874 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result1872) + Option::Some(result1874) } _ => panic() } - let lifted1876 : @types.Role? = match + let lifted1878 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted1875 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted1877 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result1874 = mbt_ffi_ptr2str( + let result1876 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result1874) + @types.Role::Other(result1876) } _ => panic() } - Option::Some(lifted1875) + Option::Some(lifted1877) } _ => panic() } - array1877.push(@types.SchemaTypeNode::{ - body: lifted1863, + array1879.push(@types.SchemaTypeNode::{ + body: lifted1865, metadata: @types.MetadataEnvelope::{ - doc: lifted1865, - aliases: array1867, - examples: array1870, - deprecated: lifted1873, - role: lifted1876, + doc: lifted1867, + aliases: array1869, + examples: array1872, + deprecated: lifted1875, + role: lifted1878, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array1882 : Array[@types.SchemaTypeDef] = [] - for index1883 = 0 - index1883 < mbt_ffi_load32(iter_base + 60) - index1883 = index1883 + 1 { + let array1884 : Array[@types.SchemaTypeDef] = [] + for index1885 = 0 + index1885 < mbt_ffi_load32(iter_base + 60) + index1885 = index1885 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index1883 * 24 + index1885 * 24 - let result1879 = mbt_ffi_ptr2str( + let result1881 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1881 : String? = match + let lifted1883 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result1880 = mbt_ffi_ptr2str( + let result1882 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result1880) + Option::Some(result1882) } _ => panic() } - array1882.push(@types.SchemaTypeDef::{ - id: result1879, - name: lifted1881, + array1884.push(@types.SchemaTypeDef::{ + id: result1881, + name: lifted1883, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let array1913 : Array[@types.SchemaValueNode] = [] - for index1914 = 0 - index1914 < mbt_ffi_load32(iter_base + 72) - index1914 = index1914 + 1 { + let array1915 : Array[@types.SchemaValueNode] = [] + for index1916 = 0 + index1916 < mbt_ffi_load32(iter_base + 72) + index1916 = index1916 + 1 { let iter_base = mbt_ffi_load32(iter_base + 68) + - index1914 * 32 + index1916 * 32 - let lifted1912 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1914 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -17767,29 +17805,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result1884 = mbt_ffi_ptr2str( + let result1886 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result1884) + @types.SchemaValueNode::StringValue(result1886) } 13 => { - let array1885 : Array[Int] = [] - for index1886 = 0 - index1886 < mbt_ffi_load32(iter_base + 12) - index1886 = index1886 + 1 { + let array1887 : Array[Int] = [] + for index1888 = 0 + index1888 < mbt_ffi_load32(iter_base + 12) + index1888 = index1888 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1886 * 4 + index1888 * 4 - array1885.push(mbt_ffi_load32(iter_base + 0)) + array1887.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array1885) + @types.SchemaValueNode::RecordValue(array1887) } 14 => { - let lifted1887 : Int? = match + let lifted1889 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -17798,7 +17836,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted1887, + payload: lifted1889, }) } 15 => @@ -17806,34 +17844,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array1888 : Array[Bool] = [] - for index1889 = 0 - index1889 < mbt_ffi_load32(iter_base + 12) - index1889 = index1889 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index1889 * 1 - - array1888.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array1888) - } - 17 => { - let array1890 : Array[Int] = [] + let array1890 : Array[Bool] = [] for index1891 = 0 index1891 < mbt_ffi_load32(iter_base + 12) index1891 = index1891 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1891 * 4 + index1891 * 1 - array1890.push(mbt_ffi_load32(iter_base + 0)) + array1890.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array1890) + @types.SchemaValueNode::FlagsValue(array1890) } - 18 => { + 17 => { let array1892 : Array[Int] = [] for index1893 = 0 index1893 < mbt_ffi_load32(iter_base + 12) @@ -17845,9 +17869,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array1892) + @types.SchemaValueNode::TupleValue(array1892) } - 19 => { + 18 => { let array1894 : Array[Int] = [] for index1895 = 0 index1895 < mbt_ffi_load32(iter_base + 12) @@ -17859,127 +17883,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array1894) + @types.SchemaValueNode::ListValue(array1894) } - 20 => { - let array1896 : Array[@types.MapEntry] = [] + 19 => { + let array1896 : Array[Int] = [] for index1897 = 0 index1897 < mbt_ffi_load32(iter_base + 12) index1897 = index1897 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index1897 * 8 + index1897 * 4 + + array1896.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array1896) + } + 20 => { + let array1898 : Array[@types.MapEntry] = [] + for index1899 = 0 + index1899 < mbt_ffi_load32(iter_base + 12) + index1899 = index1899 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index1899 * 8 - array1896.push(@types.MapEntry::{ + array1898.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array1896) + @types.SchemaValueNode::MapValue(array1898) } 21 => { - let lifted1898 : Int? = match + let lifted1900 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted1898) + @types.SchemaValueNode::OptionValue(lifted1900) } 22 => { - let lifted1901 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted1903 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted1899 : Int? = match + let lifted1901 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted1899) + @types.ResultValuePayload::OkValue(lifted1901) } 1 => { - let lifted1900 : Int? = match + let lifted1902 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted1900) + @types.ResultValuePayload::ErrValue(lifted1902) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted1901) + @types.SchemaValueNode::ResultValue(lifted1903) } 23 => { - let result1902 = mbt_ffi_ptr2str( + let result1904 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1904 : String? = match + let lifted1906 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1903 = mbt_ffi_ptr2str( + let result1905 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1903) + Option::Some(result1905) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result1902, - language: lifted1904, + text: result1904, + language: lifted1906, }) } 24 => { - let result1905 = mbt_ffi_ptr2bytes( + let result1907 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1907 : String? = match + let lifted1909 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result1906 = mbt_ffi_ptr2str( + let result1908 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result1906) + Option::Some(result1908) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result1905, - mime_type: lifted1907, + bytes: result1907, + mime_type: lifted1909, }) } 25 => { - let result1908 = mbt_ffi_ptr2str( + let result1910 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result1908) + @types.SchemaValueNode::PathValue(result1910) } 26 => { - let result1909 = mbt_ffi_ptr2str( + let result1911 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result1909) + @types.SchemaValueNode::UrlValue(result1911) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -17991,7 +18029,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result1910 = mbt_ffi_ptr2str( + let result1912 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -17999,17 +18037,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result1910, + unit: result1912, }) } 30 => { - let result1911 = mbt_ffi_ptr2str( + let result1913 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result1911, + tag: result1913, body: mbt_ffi_load32(iter_base + 16), }) } @@ -18023,68 +18061,74 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array1913.push(lifted1912) + array1915.push(lifted1914) } mbt_ffi_free(mbt_ffi_load32(iter_base + 68)) - let result1915 = mbt_ffi_ptr2str( + let result1917 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 80), mbt_ffi_load32(iter_base + 84), ) - let array1917 : Array[String] = [] - for index1918 = 0 - index1918 < mbt_ffi_load32(iter_base + 92) - index1918 = index1918 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 88) + index1918 * 8 + let array1919 : Array[String] = [] + for index1920 = 0 + index1920 < mbt_ffi_load32(iter_base + 92) + index1920 = index1920 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 88) + index1920 * 8 - let result1916 = mbt_ffi_ptr2str( + let result1918 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array1917.push(result1916) + array1919.push(result1918) } mbt_ffi_free(mbt_ffi_load32(iter_base + 88)) - let array1932 : Array[Array[SpanData]] = [] - for index1933 = 0 - index1933 < mbt_ffi_load32(iter_base + 100) - index1933 = index1933 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 96) + index1933 * 8 + let array1934 : Array[Array[SpanData]] = [] + for index1935 = 0 + index1935 < mbt_ffi_load32(iter_base + 100) + index1935 = index1935 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 96) + index1935 * 8 - let array1930 : Array[SpanData] = [] - for index1931 = 0 - index1931 < mbt_ffi_load32(iter_base + 4) - index1931 = index1931 + 1 { + let array1932 : Array[SpanData] = [] + for index1933 = 0 + index1933 < mbt_ffi_load32(iter_base + 4) + index1933 = index1933 + 1 { let iter_base = mbt_ffi_load32(iter_base + 0) + - index1931 * 80 + index1933 * 80 - let lifted1929 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted1931 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result1919 = mbt_ffi_ptr2str( + let result1921 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted1921 : String? = match + let lifted1923 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result1920 = mbt_ffi_ptr2str( + let result1922 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result1920) + Option::Some(result1922) } _ => panic() } - let lifted1922 : UInt64? = match + let lifted1924 : UInt64? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -18094,117 +18138,117 @@ pub fn enrich_oplog_entries( _ => panic() } - let array1926 : Array[@context.Attribute] = [] - for index1927 = 0 - index1927 < mbt_ffi_load32(iter_base + 68) - index1927 = index1927 + 1 { + let array1928 : Array[@context.Attribute] = [] + for index1929 = 0 + index1929 < mbt_ffi_load32(iter_base + 68) + index1929 = index1929 + 1 { let iter_base = mbt_ffi_load32(iter_base + 64) + - index1927 * 20 + index1929 * 20 - let result1923 = mbt_ffi_ptr2str( + let result1925 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted1925 = match + let lifted1927 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result1924 = mbt_ffi_ptr2str( + let result1926 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result1924) + @context.AttributeValue::String(result1926) } _ => panic() } - array1926.push(@context.Attribute::{ - key: result1923, - value: lifted1925, + array1928.push(@context.Attribute::{ + key: result1925, + value: lifted1927, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) SpanData::LocalSpan(LocalSpanData::{ - span_id: result1919, + span_id: result1921, start: @system-clock.Instant::{ seconds: mbt_ffi_load64(iter_base + 16), nanoseconds: mbt_ffi_load32(iter_base + 24).reinterpret_as_uint(), }, - parent: lifted1921, - linked_context: lifted1922, - attributes: array1926, + parent: lifted1923, + linked_context: lifted1924, + attributes: array1928, inherited: mbt_ffi_load8_u(iter_base + 72) != 0, }) } 1 => { - let result1928 = mbt_ffi_ptr2str( + let result1930 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) SpanData::ExternalSpan(ExternalSpanData::{ - span_id: result1928, + span_id: result1930, }) } _ => panic() } - array1930.push(lifted1929) + array1932.push(lifted1931) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - array1932.push(array1930) + array1934.push(array1932) } mbt_ffi_free(mbt_ffi_load32(iter_base + 96)) AgentInvocation::AgentMethodInvocation(AgentMethodInvocationParameters::{ - idempotency_key: result1679, - method_name: result1680, + idempotency_key: result1681, + method_name: result1682, function_input: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array1877, - defs: array1882, + type_nodes: array1879, + defs: array1884, root: mbt_ffi_load32(iter_base + 64), }, value: @types.SchemaValueTree::{ - value_nodes: array1913, + value_nodes: array1915, root: mbt_ffi_load32(iter_base + 76), }, }, - trace_id: result1915, - trace_states: array1917, - invocation_context: array1932, + trace_id: result1917, + trace_states: array1919, + invocation_context: array1934, }) } 2 => AgentInvocation::SaveSnapshot 3 => { - let result1934 = mbt_ffi_ptr2bytes( + let result1936 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result1935 = mbt_ffi_ptr2str( + let result1937 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) AgentInvocation::LoadSnapshot(LoadSnapshotParameters::{ snapshot: SnapshotData::{ - data: result1934, - mime_type: result1935, + data: result1936, + mime_type: result1937, }, }) } 4 => { - let result1936 = mbt_ffi_ptr2str( + let result1938 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) AgentInvocation::ProcessOplogEntries(ProcessOplogEntriesParameters::{ - idempotency_key: result1936, + idempotency_key: result1938, }) } 5 => @@ -18219,35 +18263,35 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - invocation: lifted1937, + invocation: lifted1939, }) } 5 => { - let lifted2412 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted2414 = match mbt_ffi_load8_u(iter_base + 24) { 0 => { - let array2134 : Array[@types.SchemaTypeNode] = [] - for index2135 = 0 - index2135 < mbt_ffi_load32(iter_base + 32) - index2135 = index2135 + 1 { + let array2136 : Array[@types.SchemaTypeNode] = [] + for index2137 = 0 + index2137 < mbt_ffi_load32(iter_base + 32) + index2137 = index2137 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2135 * 144 + index2137 * 144 - let lifted2120 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2122 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted1944 : @types.NumericRestrictions? = match + let lifted1946 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1939 : @types.NumericBound? = match + let lifted1941 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1938 = match + let lifted1940 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18264,16 +18308,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1938) + Option::Some(lifted1940) } _ => panic() } - let lifted1941 : @types.NumericBound? = match + let lifted1943 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1940 = match + let lifted1942 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18290,46 +18334,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1940) + Option::Some(lifted1942) } _ => panic() } - let lifted1943 : String? = match + let lifted1945 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1942 = mbt_ffi_ptr2str( + let result1944 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1942) + Option::Some(result1944) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1939, - max: lifted1941, - unit: lifted1943, + min: lifted1941, + max: lifted1943, + unit: lifted1945, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted1944) + @types.SchemaTypeBody::S8Type(lifted1946) } 3 => { - let lifted1951 : @types.NumericRestrictions? = match + let lifted1953 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1946 : @types.NumericBound? = match + let lifted1948 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1945 = match + let lifted1947 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18346,16 +18390,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1945) + Option::Some(lifted1947) } _ => panic() } - let lifted1948 : @types.NumericBound? = match + let lifted1950 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1947 = match + let lifted1949 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18372,46 +18416,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1947) + Option::Some(lifted1949) } _ => panic() } - let lifted1950 : String? = match + let lifted1952 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1949 = mbt_ffi_ptr2str( + let result1951 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1949) + Option::Some(result1951) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1946, - max: lifted1948, - unit: lifted1950, + min: lifted1948, + max: lifted1950, + unit: lifted1952, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted1951) + @types.SchemaTypeBody::S16Type(lifted1953) } 4 => { - let lifted1958 : @types.NumericRestrictions? = match + let lifted1960 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1953 : @types.NumericBound? = match + let lifted1955 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1952 = match + let lifted1954 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18428,16 +18472,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1952) + Option::Some(lifted1954) } _ => panic() } - let lifted1955 : @types.NumericBound? = match + let lifted1957 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1954 = match + let lifted1956 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18454,46 +18498,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1954) + Option::Some(lifted1956) } _ => panic() } - let lifted1957 : String? = match + let lifted1959 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1956 = mbt_ffi_ptr2str( + let result1958 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1956) + Option::Some(result1958) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1953, - max: lifted1955, - unit: lifted1957, + min: lifted1955, + max: lifted1957, + unit: lifted1959, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted1958) + @types.SchemaTypeBody::S32Type(lifted1960) } 5 => { - let lifted1965 : @types.NumericRestrictions? = match + let lifted1967 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1960 : @types.NumericBound? = match + let lifted1962 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1959 = match + let lifted1961 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18510,16 +18554,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1959) + Option::Some(lifted1961) } _ => panic() } - let lifted1962 : @types.NumericBound? = match + let lifted1964 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1961 = match + let lifted1963 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18536,46 +18580,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1961) + Option::Some(lifted1963) } _ => panic() } - let lifted1964 : String? = match + let lifted1966 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1963 = mbt_ffi_ptr2str( + let result1965 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1963) + Option::Some(result1965) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1960, - max: lifted1962, - unit: lifted1964, + min: lifted1962, + max: lifted1964, + unit: lifted1966, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted1965) + @types.SchemaTypeBody::S64Type(lifted1967) } 6 => { - let lifted1972 : @types.NumericRestrictions? = match + let lifted1974 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1967 : @types.NumericBound? = match + let lifted1969 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1966 = match + let lifted1968 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18592,16 +18636,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1966) + Option::Some(lifted1968) } _ => panic() } - let lifted1969 : @types.NumericBound? = match + let lifted1971 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1968 = match + let lifted1970 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18618,46 +18662,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1968) + Option::Some(lifted1970) } _ => panic() } - let lifted1971 : String? = match + let lifted1973 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1970 = mbt_ffi_ptr2str( + let result1972 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1970) + Option::Some(result1972) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1967, - max: lifted1969, - unit: lifted1971, + min: lifted1969, + max: lifted1971, + unit: lifted1973, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted1972) + @types.SchemaTypeBody::U8Type(lifted1974) } 7 => { - let lifted1979 : @types.NumericRestrictions? = match + let lifted1981 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1974 : @types.NumericBound? = match + let lifted1976 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1973 = match + let lifted1975 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18674,16 +18718,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1973) + Option::Some(lifted1975) } _ => panic() } - let lifted1976 : @types.NumericBound? = match + let lifted1978 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1975 = match + let lifted1977 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18700,46 +18744,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1975) + Option::Some(lifted1977) } _ => panic() } - let lifted1978 : String? = match + let lifted1980 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1977 = mbt_ffi_ptr2str( + let result1979 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1977) + Option::Some(result1979) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1974, - max: lifted1976, - unit: lifted1978, + min: lifted1976, + max: lifted1978, + unit: lifted1980, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted1979) + @types.SchemaTypeBody::U16Type(lifted1981) } 8 => { - let lifted1986 : @types.NumericRestrictions? = match + let lifted1988 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1981 : @types.NumericBound? = match + let lifted1983 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1980 = match + let lifted1982 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18756,16 +18800,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1980) + Option::Some(lifted1982) } _ => panic() } - let lifted1983 : @types.NumericBound? = match + let lifted1985 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1982 = match + let lifted1984 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18782,46 +18826,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1982) + Option::Some(lifted1984) } _ => panic() } - let lifted1985 : String? = match + let lifted1987 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1984 = mbt_ffi_ptr2str( + let result1986 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1984) + Option::Some(result1986) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1981, - max: lifted1983, - unit: lifted1985, + min: lifted1983, + max: lifted1985, + unit: lifted1987, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted1986) + @types.SchemaTypeBody::U32Type(lifted1988) } 9 => { - let lifted1993 : @types.NumericRestrictions? = match + let lifted1995 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1988 : @types.NumericBound? = match + let lifted1990 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1987 = match + let lifted1989 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18838,16 +18882,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1987) + Option::Some(lifted1989) } _ => panic() } - let lifted1990 : @types.NumericBound? = match + let lifted1992 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1989 = match + let lifted1991 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18864,46 +18908,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1989) + Option::Some(lifted1991) } _ => panic() } - let lifted1992 : String? = match + let lifted1994 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1991 = mbt_ffi_ptr2str( + let result1993 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1991) + Option::Some(result1993) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1988, - max: lifted1990, - unit: lifted1992, + min: lifted1990, + max: lifted1992, + unit: lifted1994, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted1993) + @types.SchemaTypeBody::U64Type(lifted1995) } 10 => { - let lifted2000 : @types.NumericRestrictions? = match + let lifted2002 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted1995 : @types.NumericBound? = match + let lifted1997 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted1994 = match + let lifted1996 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -18920,16 +18964,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1994) + Option::Some(lifted1996) } _ => panic() } - let lifted1997 : @types.NumericBound? = match + let lifted1999 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted1996 = match + let lifted1998 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -18946,46 +18990,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted1996) + Option::Some(lifted1998) } _ => panic() } - let lifted1999 : String? = match + let lifted2001 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result1998 = mbt_ffi_ptr2str( + let result2000 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result1998) + Option::Some(result2000) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted1995, - max: lifted1997, - unit: lifted1999, + min: lifted1997, + max: lifted1999, + unit: lifted2001, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted2000) + @types.SchemaTypeBody::F32Type(lifted2002) } 11 => { - let lifted2007 : @types.NumericRestrictions? = match + let lifted2009 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2002 : @types.NumericBound? = match + let lifted2004 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2001 = match + let lifted2003 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -19002,16 +19046,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2001) + Option::Some(lifted2003) } _ => panic() } - let lifted2004 : @types.NumericBound? = match + let lifted2006 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2003 = match + let lifted2005 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -19028,324 +19072,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2003) + Option::Some(lifted2005) } _ => panic() } - let lifted2006 : String? = match + let lifted2008 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2005 = mbt_ffi_ptr2str( + let result2007 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2005) + Option::Some(result2007) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2002, - max: lifted2004, - unit: lifted2006, + min: lifted2004, + max: lifted2006, + unit: lifted2008, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted2007) + @types.SchemaTypeBody::F64Type(lifted2009) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array2022 : Array[@types.NamedFieldType] = [] - for index2023 = 0 - index2023 < mbt_ffi_load32(iter_base + 12) - index2023 = index2023 + 1 { + let array2024 : Array[@types.NamedFieldType] = [] + for index2025 = 0 + index2025 < mbt_ffi_load32(iter_base + 12) + index2025 = index2025 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2023 * 68 + index2025 * 68 - let result2008 = mbt_ffi_ptr2str( + let result2010 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2010 : String? = match + let lifted2012 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2009 = mbt_ffi_ptr2str( + let result2011 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2009) + Option::Some(result2011) } _ => panic() } - let array2012 : Array[String] = [] - for index2013 = 0 - index2013 < mbt_ffi_load32(iter_base + 28) - index2013 = index2013 + 1 { + let array2014 : Array[String] = [] + for index2015 = 0 + index2015 < mbt_ffi_load32(iter_base + 28) + index2015 = index2015 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2013 * 8 + index2015 * 8 - let result2011 = mbt_ffi_ptr2str( + let result2013 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2012.push(result2011) + array2014.push(result2013) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array2015 : Array[String] = [] - for index2016 = 0 - index2016 < mbt_ffi_load32(iter_base + 36) - index2016 = index2016 + 1 { + let array2017 : Array[String] = [] + for index2018 = 0 + index2018 < mbt_ffi_load32(iter_base + 36) + index2018 = index2018 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index2016 * 8 + index2018 * 8 - let result2014 = mbt_ffi_ptr2str( + let result2016 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2015.push(result2014) + array2017.push(result2016) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted2018 : String? = match + let lifted2020 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result2017 = mbt_ffi_ptr2str( + let result2019 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result2017) + Option::Some(result2019) } _ => panic() } - let lifted2021 : @types.Role? = match + let lifted2023 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted2020 = match + let lifted2022 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2019 = mbt_ffi_ptr2str( + let result2021 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result2019) + @types.Role::Other(result2021) } _ => panic() } - Option::Some(lifted2020) + Option::Some(lifted2022) } _ => panic() } - array2022.push(@types.NamedFieldType::{ - name: result2008, + array2024.push(@types.NamedFieldType::{ + name: result2010, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted2010, - aliases: array2012, - examples: array2015, - deprecated: lifted2018, - role: lifted2021, + doc: lifted2012, + aliases: array2014, + examples: array2017, + deprecated: lifted2020, + role: lifted2023, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array2022) + @types.SchemaTypeBody::RecordType(array2024) } 15 => { - let array2039 : Array[@types.VariantCaseType] = [] - for index2040 = 0 - index2040 < mbt_ffi_load32(iter_base + 12) - index2040 = index2040 + 1 { + let array2041 : Array[@types.VariantCaseType] = [] + for index2042 = 0 + index2042 < mbt_ffi_load32(iter_base + 12) + index2042 = index2042 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2040 * 72 + index2042 * 72 - let result2024 = mbt_ffi_ptr2str( + let result2026 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2025 : Int? = match + let lifted2027 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2027 : String? = match + let lifted2029 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2026 = mbt_ffi_ptr2str( + let result2028 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2026) + Option::Some(result2028) } _ => panic() } - let array2029 : Array[String] = [] - for index2030 = 0 - index2030 < mbt_ffi_load32(iter_base + 32) - index2030 = index2030 + 1 { + let array2031 : Array[String] = [] + for index2032 = 0 + index2032 < mbt_ffi_load32(iter_base + 32) + index2032 = index2032 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2030 * 8 + index2032 * 8 - let result2028 = mbt_ffi_ptr2str( + let result2030 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2029.push(result2028) + array2031.push(result2030) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2032 : Array[String] = [] - for index2033 = 0 - index2033 < mbt_ffi_load32(iter_base + 40) - index2033 = index2033 + 1 { + let array2034 : Array[String] = [] + for index2035 = 0 + index2035 < mbt_ffi_load32(iter_base + 40) + index2035 = index2035 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2033 * 8 + index2035 * 8 - let result2031 = mbt_ffi_ptr2str( + let result2033 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2032.push(result2031) + array2034.push(result2033) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted2035 : String? = match + let lifted2037 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2034 = mbt_ffi_ptr2str( + let result2036 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2034) + Option::Some(result2036) } _ => panic() } - let lifted2038 : @types.Role? = match + let lifted2040 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted2037 = match + let lifted2039 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2036 = mbt_ffi_ptr2str( + let result2038 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result2036) + @types.Role::Other(result2038) } _ => panic() } - Option::Some(lifted2037) + Option::Some(lifted2039) } _ => panic() } - array2039.push(@types.VariantCaseType::{ - name: result2024, - payload: lifted2025, + array2041.push(@types.VariantCaseType::{ + name: result2026, + payload: lifted2027, metadata: @types.MetadataEnvelope::{ - doc: lifted2027, - aliases: array2029, - examples: array2032, - deprecated: lifted2035, - role: lifted2038, + doc: lifted2029, + aliases: array2031, + examples: array2034, + deprecated: lifted2037, + role: lifted2040, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array2039) + @types.SchemaTypeBody::VariantType(array2041) } 16 => { - let array2042 : Array[String] = [] - for index2043 = 0 - index2043 < mbt_ffi_load32(iter_base + 12) - index2043 = index2043 + 1 { + let array2044 : Array[String] = [] + for index2045 = 0 + index2045 < mbt_ffi_load32(iter_base + 12) + index2045 = index2045 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2043 * 8 + index2045 * 8 - let result2041 = mbt_ffi_ptr2str( + let result2043 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2042.push(result2041) + array2044.push(result2043) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array2042) + @types.SchemaTypeBody::EnumType(array2044) } 17 => { - let array2045 : Array[String] = [] - for index2046 = 0 - index2046 < mbt_ffi_load32(iter_base + 12) - index2046 = index2046 + 1 { + let array2047 : Array[String] = [] + for index2048 = 0 + index2048 < mbt_ffi_load32(iter_base + 12) + index2048 = index2048 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2046 * 8 + index2048 * 8 - let result2044 = mbt_ffi_ptr2str( + let result2046 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2045.push(result2044) + array2047.push(result2046) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array2045) + @types.SchemaTypeBody::FlagsType(array2047) } 18 => { - let array2047 : Array[Int] = [] - for index2048 = 0 - index2048 < mbt_ffi_load32(iter_base + 12) - index2048 = index2048 + 1 { + let array2049 : Array[Int] = [] + for index2050 = 0 + index2050 < mbt_ffi_load32(iter_base + 12) + index2050 = index2050 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2048 * 4 + index2050 * 4 - array2047.push(mbt_ffi_load32(iter_base + 0)) + array2049.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array2047) + @types.SchemaTypeBody::TupleType(array2049) } 19 => @types.SchemaTypeBody::ListType( @@ -19366,14 +19410,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted2049 : Int? = match + let lifted2051 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2050 : Int? = match + let lifted2052 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -19381,37 +19425,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted2049, - err: lifted2050, + ok: lifted2051, + err: lifted2052, }) } 24 => { - let lifted2054 : Array[String]? = match + let lifted2056 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2052 : Array[String] = [] - for index2053 = 0 - index2053 < mbt_ffi_load32(iter_base + 16) - index2053 = index2053 + 1 { + let array2054 : Array[String] = [] + for index2055 = 0 + index2055 < mbt_ffi_load32(iter_base + 16) + index2055 = index2055 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2053 * 8 + index2055 * 8 - let result2051 = mbt_ffi_ptr2str( + let result2053 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2052.push(result2051) + array2054.push(result2053) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2052) + Option::Some(array2054) } _ => panic() } - let lifted2055 : UInt? = match + let lifted2057 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -19421,7 +19465,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2056 : UInt? = match + let lifted2058 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -19431,54 +19475,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2058 : String? = match + let lifted2060 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2057 = mbt_ffi_ptr2str( + let result2059 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2057) + Option::Some(result2059) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted2054, - min_length: lifted2055, - max_length: lifted2056, - regex: lifted2058, + languages: lifted2056, + min_length: lifted2057, + max_length: lifted2058, + regex: lifted2060, }) } 25 => { - let lifted2062 : Array[String]? = match + let lifted2064 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2060 : Array[String] = [] - for index2061 = 0 - index2061 < mbt_ffi_load32(iter_base + 16) - index2061 = index2061 + 1 { + let array2062 : Array[String] = [] + for index2063 = 0 + index2063 < mbt_ffi_load32(iter_base + 16) + index2063 = index2063 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2061 * 8 + index2063 * 8 - let result2059 = mbt_ffi_ptr2str( + let result2061 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2060.push(result2059) + array2062.push(result2061) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2060) + Option::Some(array2062) } _ => panic() } - let lifted2063 : UInt? = match + let lifted2065 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -19488,7 +19532,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2064 : UInt? = match + let lifted2066 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -19499,58 +19543,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted2062, - min_bytes: lifted2063, - max_bytes: lifted2064, + mime_types: lifted2064, + min_bytes: lifted2065, + max_bytes: lifted2066, }) } 26 => { - let lifted2068 : Array[String]? = match + let lifted2070 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array2066 : Array[String] = [] - for index2067 = 0 - index2067 < mbt_ffi_load32(iter_base + 20) - index2067 = index2067 + 1 { + let array2068 : Array[String] = [] + for index2069 = 0 + index2069 < mbt_ffi_load32(iter_base + 20) + index2069 = index2069 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2067 * 8 + index2069 * 8 - let result2065 = mbt_ffi_ptr2str( + let result2067 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2066.push(result2065) + array2068.push(result2067) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array2066) + Option::Some(array2068) } _ => panic() } - let lifted2072 : Array[String]? = match + let lifted2074 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array2070 : Array[String] = [] - for index2071 = 0 - index2071 < mbt_ffi_load32(iter_base + 32) - index2071 = index2071 + 1 { + let array2072 : Array[String] = [] + for index2073 = 0 + index2073 < mbt_ffi_load32(iter_base + 32) + index2073 = index2073 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2071 * 8 + index2073 * 8 - let result2069 = mbt_ffi_ptr2str( + let result2071 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2070.push(result2069) + array2072.push(result2071) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array2070) + Option::Some(array2072) } _ => panic() } @@ -19562,95 +19606,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted2068, - allowed_extensions: lifted2072, + allowed_mime_types: lifted2070, + allowed_extensions: lifted2074, }) } 27 => { - let lifted2076 : Array[String]? = match + let lifted2078 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2074 : Array[String] = [] - for index2075 = 0 - index2075 < mbt_ffi_load32(iter_base + 16) - index2075 = index2075 + 1 { + let array2076 : Array[String] = [] + for index2077 = 0 + index2077 < mbt_ffi_load32(iter_base + 16) + index2077 = index2077 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2075 * 8 + index2077 * 8 - let result2073 = mbt_ffi_ptr2str( + let result2075 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2074.push(result2073) + array2076.push(result2075) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2074) + Option::Some(array2076) } _ => panic() } - let lifted2080 : Array[String]? = match + let lifted2082 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array2078 : Array[String] = [] - for index2079 = 0 - index2079 < mbt_ffi_load32(iter_base + 28) - index2079 = index2079 + 1 { + let array2080 : Array[String] = [] + for index2081 = 0 + index2081 < mbt_ffi_load32(iter_base + 28) + index2081 = index2081 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2079 * 8 + index2081 * 8 - let result2077 = mbt_ffi_ptr2str( + let result2079 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2078.push(result2077) + array2080.push(result2079) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array2078) + Option::Some(array2080) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted2076, - allowed_hosts: lifted2080, + allowed_schemes: lifted2078, + allowed_hosts: lifted2082, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result2081 = mbt_ffi_ptr2str( + let result2083 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array2083 : Array[String] = [] - for index2084 = 0 - index2084 < mbt_ffi_load32(iter_base + 20) - index2084 = index2084 + 1 { + let array2085 : Array[String] = [] + for index2086 = 0 + index2086 < mbt_ffi_load32(iter_base + 20) + index2086 = index2086 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2084 * 8 + index2086 * 8 - let result2082 = mbt_ffi_ptr2str( + let result2084 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2083.push(result2082) + array2085.push(result2084) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted2086 : @types.QuantityValue? = match + let lifted2088 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2085 = mbt_ffi_ptr2str( + let result2087 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -19658,17 +19702,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result2085, + unit: result2087, }) } _ => panic() } - let lifted2088 : @types.QuantityValue? = match + let lifted2090 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result2087 = mbt_ffi_ptr2str( + let result2089 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -19676,406 +19720,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result2087, + unit: result2089, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result2081, - allowed_suffixes: array2083, - min: lifted2086, - max: lifted2088, + base_unit: result2083, + allowed_suffixes: array2085, + min: lifted2088, + max: lifted2090, }) } 31 => { - let array2112 : Array[@types.UnionBranch] = [] - for index2113 = 0 - index2113 < mbt_ffi_load32(iter_base + 12) - index2113 = index2113 + 1 { + let array2114 : Array[@types.UnionBranch] = [] + for index2115 = 0 + index2115 < mbt_ffi_load32(iter_base + 12) + index2115 = index2115 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2113 * 92 + index2115 * 92 - let result2089 = mbt_ffi_ptr2str( + let result2091 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2098 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted2100 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result2090 = mbt_ffi_ptr2str( + let result2092 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result2090) + @types.DiscriminatorRule::Prefix(result2092) } 1 => { - let result2091 = mbt_ffi_ptr2str( + let result2093 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result2091) + @types.DiscriminatorRule::Suffix(result2093) } 2 => { - let result2092 = mbt_ffi_ptr2str( + let result2094 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result2092) + @types.DiscriminatorRule::Contains(result2094) } 3 => { - let result2093 = mbt_ffi_ptr2str( + let result2095 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result2093) + @types.DiscriminatorRule::Regex(result2095) } 4 => { - let result2094 = mbt_ffi_ptr2str( + let result2096 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted2096 : String? = match + let lifted2098 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2095 = mbt_ffi_ptr2str( + let result2097 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result2095) + Option::Some(result2097) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result2094, - literal: lifted2096, + field_name: result2096, + literal: lifted2098, }) } 5 => { - let result2097 = mbt_ffi_ptr2str( + let result2099 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result2097) + @types.DiscriminatorRule::FieldAbsent(result2099) } _ => panic() } - let lifted2100 : String? = match + let lifted2102 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2099 = mbt_ffi_ptr2str( + let result2101 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2099) + Option::Some(result2101) } _ => panic() } - let array2102 : Array[String] = [] - for index2103 = 0 - index2103 < mbt_ffi_load32(iter_base + 52) - index2103 = index2103 + 1 { + let array2104 : Array[String] = [] + for index2105 = 0 + index2105 < mbt_ffi_load32(iter_base + 52) + index2105 = index2105 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2103 * 8 + index2105 * 8 - let result2101 = mbt_ffi_ptr2str( + let result2103 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2102.push(result2101) + array2104.push(result2103) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2105 : Array[String] = [] - for index2106 = 0 - index2106 < mbt_ffi_load32(iter_base + 60) - index2106 = index2106 + 1 { + let array2107 : Array[String] = [] + for index2108 = 0 + index2108 < mbt_ffi_load32(iter_base + 60) + index2108 = index2108 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2106 * 8 + index2108 * 8 - let result2104 = mbt_ffi_ptr2str( + let result2106 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2105.push(result2104) + array2107.push(result2106) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted2108 : String? = match + let lifted2110 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2107 = mbt_ffi_ptr2str( + let result2109 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2107) + Option::Some(result2109) } _ => panic() } - let lifted2111 : @types.Role? = match + let lifted2113 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted2110 = match + let lifted2112 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2109 = mbt_ffi_ptr2str( + let result2111 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result2109) + @types.Role::Other(result2111) } _ => panic() } - Option::Some(lifted2110) + Option::Some(lifted2112) } _ => panic() } - array2112.push(@types.UnionBranch::{ - tag: result2089, + array2114.push(@types.UnionBranch::{ + tag: result2091, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted2098, + discriminator: lifted2100, metadata: @types.MetadataEnvelope::{ - doc: lifted2100, - aliases: array2102, - examples: array2105, - deprecated: lifted2108, - role: lifted2111, + doc: lifted2102, + aliases: array2104, + examples: array2107, + deprecated: lifted2110, + role: lifted2113, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array2112, + branches: array2114, }) } 32 => { - let lifted2115 : String? = match + let lifted2117 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2114 = mbt_ffi_ptr2str( + let result2116 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2114) + Option::Some(result2116) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted2115, + category: lifted2117, }) } 33 => { - let lifted2117 : String? = match + let lifted2119 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2116 = mbt_ffi_ptr2str( + let result2118 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2116) + Option::Some(result2118) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted2117, + resource_name: lifted2119, }) } 34 => { - let lifted2118 : Int? = match + let lifted2120 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted2118) + @types.SchemaTypeBody::FutureType(lifted2120) } 35 => { - let lifted2119 : Int? = match + let lifted2121 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted2119) + @types.SchemaTypeBody::StreamType(lifted2121) } _ => panic() } - let lifted2122 : String? = match + let lifted2124 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result2121 = mbt_ffi_ptr2str( + let result2123 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result2121) + Option::Some(result2123) } _ => panic() } - let array2124 : Array[String] = [] - for index2125 = 0 - index2125 < mbt_ffi_load32(iter_base + 104) - index2125 = index2125 + 1 { + let array2126 : Array[String] = [] + for index2127 = 0 + index2127 < mbt_ffi_load32(iter_base + 104) + index2127 = index2127 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index2125 * 8 + index2127 * 8 - let result2123 = mbt_ffi_ptr2str( + let result2125 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2124.push(result2123) + array2126.push(result2125) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array2127 : Array[String] = [] - for index2128 = 0 - index2128 < mbt_ffi_load32(iter_base + 112) - index2128 = index2128 + 1 { + let array2129 : Array[String] = [] + for index2130 = 0 + index2130 < mbt_ffi_load32(iter_base + 112) + index2130 = index2130 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index2128 * 8 + index2130 * 8 - let result2126 = mbt_ffi_ptr2str( + let result2128 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2127.push(result2126) + array2129.push(result2128) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted2130 : String? = match + let lifted2132 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result2129 = mbt_ffi_ptr2str( + let result2131 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result2129) + Option::Some(result2131) } _ => panic() } - let lifted2133 : @types.Role? = match + let lifted2135 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted2132 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted2134 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2131 = mbt_ffi_ptr2str( + let result2133 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result2131) + @types.Role::Other(result2133) } _ => panic() } - Option::Some(lifted2132) + Option::Some(lifted2134) } _ => panic() } - array2134.push(@types.SchemaTypeNode::{ - body: lifted2120, + array2136.push(@types.SchemaTypeNode::{ + body: lifted2122, metadata: @types.MetadataEnvelope::{ - doc: lifted2122, - aliases: array2124, - examples: array2127, - deprecated: lifted2130, - role: lifted2133, + doc: lifted2124, + aliases: array2126, + examples: array2129, + deprecated: lifted2132, + role: lifted2135, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2139 : Array[@types.SchemaTypeDef] = [] - for index2140 = 0 - index2140 < mbt_ffi_load32(iter_base + 40) - index2140 = index2140 + 1 { + let array2141 : Array[@types.SchemaTypeDef] = [] + for index2142 = 0 + index2142 < mbt_ffi_load32(iter_base + 40) + index2142 = index2142 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2140 * 24 + index2142 * 24 - let result2136 = mbt_ffi_ptr2str( + let result2138 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2138 : String? = match + let lifted2140 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2137 = mbt_ffi_ptr2str( + let result2139 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2137) + Option::Some(result2139) } _ => panic() } - array2139.push(@types.SchemaTypeDef::{ - id: result2136, - name: lifted2138, + array2141.push(@types.SchemaTypeDef::{ + id: result2138, + name: lifted2140, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array2170 : Array[@types.SchemaValueNode] = [] - for index2171 = 0 - index2171 < mbt_ffi_load32(iter_base + 52) - index2171 = index2171 + 1 { + let array2172 : Array[@types.SchemaValueNode] = [] + for index2173 = 0 + index2173 < mbt_ffi_load32(iter_base + 52) + index2173 = index2173 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2171 * 32 + index2173 * 32 - let lifted2169 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2171 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -20127,29 +20171,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result2141 = mbt_ffi_ptr2str( + let result2143 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result2141) + @types.SchemaValueNode::StringValue(result2143) } 13 => { - let array2142 : Array[Int] = [] - for index2143 = 0 - index2143 < mbt_ffi_load32(iter_base + 12) - index2143 = index2143 + 1 { + let array2144 : Array[Int] = [] + for index2145 = 0 + index2145 < mbt_ffi_load32(iter_base + 12) + index2145 = index2145 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2143 * 4 + index2145 * 4 - array2142.push(mbt_ffi_load32(iter_base + 0)) + array2144.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array2142) + @types.SchemaValueNode::RecordValue(array2144) } 14 => { - let lifted2144 : Int? = match + let lifted2146 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -20158,7 +20202,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted2144, + payload: lifted2146, }) } 15 => @@ -20166,34 +20210,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array2145 : Array[Bool] = [] - for index2146 = 0 - index2146 < mbt_ffi_load32(iter_base + 12) - index2146 = index2146 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index2146 * 1 - - array2145.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array2145) - } - 17 => { - let array2147 : Array[Int] = [] + let array2147 : Array[Bool] = [] for index2148 = 0 index2148 < mbt_ffi_load32(iter_base + 12) index2148 = index2148 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2148 * 4 + index2148 * 1 - array2147.push(mbt_ffi_load32(iter_base + 0)) + array2147.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array2147) + @types.SchemaValueNode::FlagsValue(array2147) } - 18 => { + 17 => { let array2149 : Array[Int] = [] for index2150 = 0 index2150 < mbt_ffi_load32(iter_base + 12) @@ -20205,9 +20235,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array2149) + @types.SchemaValueNode::TupleValue(array2149) } - 19 => { + 18 => { let array2151 : Array[Int] = [] for index2152 = 0 index2152 < mbt_ffi_load32(iter_base + 12) @@ -20219,127 +20249,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array2151) + @types.SchemaValueNode::ListValue(array2151) } - 20 => { - let array2153 : Array[@types.MapEntry] = [] + 19 => { + let array2153 : Array[Int] = [] for index2154 = 0 index2154 < mbt_ffi_load32(iter_base + 12) index2154 = index2154 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2154 * 8 + index2154 * 4 + + array2153.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array2153) + } + 20 => { + let array2155 : Array[@types.MapEntry] = [] + for index2156 = 0 + index2156 < mbt_ffi_load32(iter_base + 12) + index2156 = index2156 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index2156 * 8 - array2153.push(@types.MapEntry::{ + array2155.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array2153) + @types.SchemaValueNode::MapValue(array2155) } 21 => { - let lifted2155 : Int? = match + let lifted2157 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted2155) + @types.SchemaValueNode::OptionValue(lifted2157) } 22 => { - let lifted2158 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2160 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted2156 : Int? = match + let lifted2158 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted2156) + @types.ResultValuePayload::OkValue(lifted2158) } 1 => { - let lifted2157 : Int? = match + let lifted2159 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted2157) + @types.ResultValuePayload::ErrValue(lifted2159) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted2158) + @types.SchemaValueNode::ResultValue(lifted2160) } 23 => { - let result2159 = mbt_ffi_ptr2str( + let result2161 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2161 : String? = match + let lifted2163 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2160 = mbt_ffi_ptr2str( + let result2162 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2160) + Option::Some(result2162) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result2159, - language: lifted2161, + text: result2161, + language: lifted2163, }) } 24 => { - let result2162 = mbt_ffi_ptr2bytes( + let result2164 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2164 : String? = match + let lifted2166 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2163 = mbt_ffi_ptr2str( + let result2165 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2163) + Option::Some(result2165) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result2162, - mime_type: lifted2164, + bytes: result2164, + mime_type: lifted2166, }) } 25 => { - let result2165 = mbt_ffi_ptr2str( + let result2167 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result2165) + @types.SchemaValueNode::PathValue(result2167) } 26 => { - let result2166 = mbt_ffi_ptr2str( + let result2168 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result2166) + @types.SchemaValueNode::UrlValue(result2168) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -20351,7 +20395,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result2167 = mbt_ffi_ptr2str( + let result2169 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -20359,17 +20403,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result2167, + unit: result2169, }) } 30 => { - let result2168 = mbt_ffi_ptr2str( + let result2170 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result2168, + tag: result2170, body: mbt_ffi_load32(iter_base + 16), }) } @@ -20383,51 +20427,57 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array2170.push(lifted2169) + array2172.push(lifted2171) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) AgentInvocationResult::AgentInitialization(AgentInvocationOutputParameters::{ output: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array2134, - defs: array2139, + type_nodes: array2136, + defs: array2141, root: mbt_ffi_load32(iter_base + 44), }, value: @types.SchemaValueTree::{ - value_nodes: array2170, + value_nodes: array2172, root: mbt_ffi_load32(iter_base + 56), }, }, }) } 1 => { - let array2368 : Array[@types.SchemaTypeNode] = [] - for index2369 = 0 - index2369 < mbt_ffi_load32(iter_base + 32) - index2369 = index2369 + 1 { + let array2370 : Array[@types.SchemaTypeNode] = [] + for index2371 = 0 + index2371 < mbt_ffi_load32(iter_base + 32) + index2371 = index2371 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2369 * 144 + index2371 * 144 - let lifted2354 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2356 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted2178 : @types.NumericRestrictions? = match + let lifted2180 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2173 : @types.NumericBound? = match + let lifted2175 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2172 = match + let lifted2174 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20444,16 +20494,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2172) + Option::Some(lifted2174) } _ => panic() } - let lifted2175 : @types.NumericBound? = match + let lifted2177 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2174 = match + let lifted2176 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20470,46 +20520,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2174) + Option::Some(lifted2176) } _ => panic() } - let lifted2177 : String? = match + let lifted2179 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2176 = mbt_ffi_ptr2str( + let result2178 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2176) + Option::Some(result2178) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2173, - max: lifted2175, - unit: lifted2177, + min: lifted2175, + max: lifted2177, + unit: lifted2179, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted2178) + @types.SchemaTypeBody::S8Type(lifted2180) } 3 => { - let lifted2185 : @types.NumericRestrictions? = match + let lifted2187 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2180 : @types.NumericBound? = match + let lifted2182 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2179 = match + let lifted2181 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20526,16 +20576,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2179) + Option::Some(lifted2181) } _ => panic() } - let lifted2182 : @types.NumericBound? = match + let lifted2184 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2181 = match + let lifted2183 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20552,46 +20602,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2181) + Option::Some(lifted2183) } _ => panic() } - let lifted2184 : String? = match + let lifted2186 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2183 = mbt_ffi_ptr2str( + let result2185 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2183) + Option::Some(result2185) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2180, - max: lifted2182, - unit: lifted2184, + min: lifted2182, + max: lifted2184, + unit: lifted2186, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted2185) + @types.SchemaTypeBody::S16Type(lifted2187) } 4 => { - let lifted2192 : @types.NumericRestrictions? = match + let lifted2194 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2187 : @types.NumericBound? = match + let lifted2189 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2186 = match + let lifted2188 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20608,16 +20658,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2186) + Option::Some(lifted2188) } _ => panic() } - let lifted2189 : @types.NumericBound? = match + let lifted2191 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2188 = match + let lifted2190 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20634,46 +20684,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2188) + Option::Some(lifted2190) } _ => panic() } - let lifted2191 : String? = match + let lifted2193 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2190 = mbt_ffi_ptr2str( + let result2192 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2190) + Option::Some(result2192) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2187, - max: lifted2189, - unit: lifted2191, + min: lifted2189, + max: lifted2191, + unit: lifted2193, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted2192) + @types.SchemaTypeBody::S32Type(lifted2194) } 5 => { - let lifted2199 : @types.NumericRestrictions? = match + let lifted2201 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2194 : @types.NumericBound? = match + let lifted2196 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2193 = match + let lifted2195 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20690,16 +20740,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2193) + Option::Some(lifted2195) } _ => panic() } - let lifted2196 : @types.NumericBound? = match + let lifted2198 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2195 = match + let lifted2197 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20716,46 +20766,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2195) + Option::Some(lifted2197) } _ => panic() } - let lifted2198 : String? = match + let lifted2200 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2197 = mbt_ffi_ptr2str( + let result2199 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2197) + Option::Some(result2199) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2194, - max: lifted2196, - unit: lifted2198, + min: lifted2196, + max: lifted2198, + unit: lifted2200, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted2199) + @types.SchemaTypeBody::S64Type(lifted2201) } 6 => { - let lifted2206 : @types.NumericRestrictions? = match + let lifted2208 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2201 : @types.NumericBound? = match + let lifted2203 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2200 = match + let lifted2202 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20772,16 +20822,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2200) + Option::Some(lifted2202) } _ => panic() } - let lifted2203 : @types.NumericBound? = match + let lifted2205 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2202 = match + let lifted2204 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20798,46 +20848,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2202) + Option::Some(lifted2204) } _ => panic() } - let lifted2205 : String? = match + let lifted2207 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2204 = mbt_ffi_ptr2str( + let result2206 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2204) + Option::Some(result2206) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2201, - max: lifted2203, - unit: lifted2205, + min: lifted2203, + max: lifted2205, + unit: lifted2207, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted2206) + @types.SchemaTypeBody::U8Type(lifted2208) } 7 => { - let lifted2213 : @types.NumericRestrictions? = match + let lifted2215 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2208 : @types.NumericBound? = match + let lifted2210 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2207 = match + let lifted2209 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20854,16 +20904,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2207) + Option::Some(lifted2209) } _ => panic() } - let lifted2210 : @types.NumericBound? = match + let lifted2212 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2209 = match + let lifted2211 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20880,46 +20930,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2209) + Option::Some(lifted2211) } _ => panic() } - let lifted2212 : String? = match + let lifted2214 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2211 = mbt_ffi_ptr2str( + let result2213 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2211) + Option::Some(result2213) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2208, - max: lifted2210, - unit: lifted2212, + min: lifted2210, + max: lifted2212, + unit: lifted2214, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted2213) + @types.SchemaTypeBody::U16Type(lifted2215) } 8 => { - let lifted2220 : @types.NumericRestrictions? = match + let lifted2222 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2215 : @types.NumericBound? = match + let lifted2217 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2214 = match + let lifted2216 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -20936,16 +20986,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2214) + Option::Some(lifted2216) } _ => panic() } - let lifted2217 : @types.NumericBound? = match + let lifted2219 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2216 = match + let lifted2218 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -20962,46 +21012,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2216) + Option::Some(lifted2218) } _ => panic() } - let lifted2219 : String? = match + let lifted2221 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2218 = mbt_ffi_ptr2str( + let result2220 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2218) + Option::Some(result2220) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2215, - max: lifted2217, - unit: lifted2219, + min: lifted2217, + max: lifted2219, + unit: lifted2221, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted2220) + @types.SchemaTypeBody::U32Type(lifted2222) } 9 => { - let lifted2227 : @types.NumericRestrictions? = match + let lifted2229 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2222 : @types.NumericBound? = match + let lifted2224 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2221 = match + let lifted2223 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21018,16 +21068,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2221) + Option::Some(lifted2223) } _ => panic() } - let lifted2224 : @types.NumericBound? = match + let lifted2226 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2223 = match + let lifted2225 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21044,46 +21094,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2223) + Option::Some(lifted2225) } _ => panic() } - let lifted2226 : String? = match + let lifted2228 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2225 = mbt_ffi_ptr2str( + let result2227 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2225) + Option::Some(result2227) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2222, - max: lifted2224, - unit: lifted2226, + min: lifted2224, + max: lifted2226, + unit: lifted2228, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted2227) + @types.SchemaTypeBody::U64Type(lifted2229) } 10 => { - let lifted2234 : @types.NumericRestrictions? = match + let lifted2236 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2229 : @types.NumericBound? = match + let lifted2231 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2228 = match + let lifted2230 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21100,16 +21150,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2228) + Option::Some(lifted2230) } _ => panic() } - let lifted2231 : @types.NumericBound? = match + let lifted2233 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2230 = match + let lifted2232 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21126,46 +21176,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2230) + Option::Some(lifted2232) } _ => panic() } - let lifted2233 : String? = match + let lifted2235 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2232 = mbt_ffi_ptr2str( + let result2234 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2232) + Option::Some(result2234) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2229, - max: lifted2231, - unit: lifted2233, + min: lifted2231, + max: lifted2233, + unit: lifted2235, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted2234) + @types.SchemaTypeBody::F32Type(lifted2236) } 11 => { - let lifted2241 : @types.NumericRestrictions? = match + let lifted2243 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2236 : @types.NumericBound? = match + let lifted2238 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2235 = match + let lifted2237 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -21182,16 +21232,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2235) + Option::Some(lifted2237) } _ => panic() } - let lifted2238 : @types.NumericBound? = match + let lifted2240 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2237 = match + let lifted2239 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -21208,324 +21258,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2237) + Option::Some(lifted2239) } _ => panic() } - let lifted2240 : String? = match + let lifted2242 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2239 = mbt_ffi_ptr2str( + let result2241 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2239) + Option::Some(result2241) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2236, - max: lifted2238, - unit: lifted2240, + min: lifted2238, + max: lifted2240, + unit: lifted2242, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted2241) + @types.SchemaTypeBody::F64Type(lifted2243) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array2256 : Array[@types.NamedFieldType] = [] - for index2257 = 0 - index2257 < mbt_ffi_load32(iter_base + 12) - index2257 = index2257 + 1 { + let array2258 : Array[@types.NamedFieldType] = [] + for index2259 = 0 + index2259 < mbt_ffi_load32(iter_base + 12) + index2259 = index2259 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2257 * 68 + index2259 * 68 - let result2242 = mbt_ffi_ptr2str( + let result2244 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2244 : String? = match + let lifted2246 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2243 = mbt_ffi_ptr2str( + let result2245 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2243) + Option::Some(result2245) } _ => panic() } - let array2246 : Array[String] = [] - for index2247 = 0 - index2247 < mbt_ffi_load32(iter_base + 28) - index2247 = index2247 + 1 { + let array2248 : Array[String] = [] + for index2249 = 0 + index2249 < mbt_ffi_load32(iter_base + 28) + index2249 = index2249 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2247 * 8 + index2249 * 8 - let result2245 = mbt_ffi_ptr2str( + let result2247 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2246.push(result2245) + array2248.push(result2247) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array2249 : Array[String] = [] - for index2250 = 0 - index2250 < mbt_ffi_load32(iter_base + 36) - index2250 = index2250 + 1 { + let array2251 : Array[String] = [] + for index2252 = 0 + index2252 < mbt_ffi_load32(iter_base + 36) + index2252 = index2252 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index2250 * 8 + index2252 * 8 - let result2248 = mbt_ffi_ptr2str( + let result2250 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2249.push(result2248) + array2251.push(result2250) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted2252 : String? = match + let lifted2254 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result2251 = mbt_ffi_ptr2str( + let result2253 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result2251) + Option::Some(result2253) } _ => panic() } - let lifted2255 : @types.Role? = match + let lifted2257 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted2254 = match + let lifted2256 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2253 = mbt_ffi_ptr2str( + let result2255 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result2253) + @types.Role::Other(result2255) } _ => panic() } - Option::Some(lifted2254) + Option::Some(lifted2256) } _ => panic() } - array2256.push(@types.NamedFieldType::{ - name: result2242, + array2258.push(@types.NamedFieldType::{ + name: result2244, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted2244, - aliases: array2246, - examples: array2249, - deprecated: lifted2252, - role: lifted2255, + doc: lifted2246, + aliases: array2248, + examples: array2251, + deprecated: lifted2254, + role: lifted2257, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array2256) + @types.SchemaTypeBody::RecordType(array2258) } 15 => { - let array2273 : Array[@types.VariantCaseType] = [] - for index2274 = 0 - index2274 < mbt_ffi_load32(iter_base + 12) - index2274 = index2274 + 1 { + let array2275 : Array[@types.VariantCaseType] = [] + for index2276 = 0 + index2276 < mbt_ffi_load32(iter_base + 12) + index2276 = index2276 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2274 * 72 + index2276 * 72 - let result2258 = mbt_ffi_ptr2str( + let result2260 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2259 : Int? = match + let lifted2261 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2261 : String? = match + let lifted2263 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2260 = mbt_ffi_ptr2str( + let result2262 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2260) + Option::Some(result2262) } _ => panic() } - let array2263 : Array[String] = [] - for index2264 = 0 - index2264 < mbt_ffi_load32(iter_base + 32) - index2264 = index2264 + 1 { + let array2265 : Array[String] = [] + for index2266 = 0 + index2266 < mbt_ffi_load32(iter_base + 32) + index2266 = index2266 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2264 * 8 + index2266 * 8 - let result2262 = mbt_ffi_ptr2str( + let result2264 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2263.push(result2262) + array2265.push(result2264) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2266 : Array[String] = [] - for index2267 = 0 - index2267 < mbt_ffi_load32(iter_base + 40) - index2267 = index2267 + 1 { + let array2268 : Array[String] = [] + for index2269 = 0 + index2269 < mbt_ffi_load32(iter_base + 40) + index2269 = index2269 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2267 * 8 + index2269 * 8 - let result2265 = mbt_ffi_ptr2str( + let result2267 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2266.push(result2265) + array2268.push(result2267) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted2269 : String? = match + let lifted2271 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2268 = mbt_ffi_ptr2str( + let result2270 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2268) + Option::Some(result2270) } _ => panic() } - let lifted2272 : @types.Role? = match + let lifted2274 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted2271 = match + let lifted2273 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2270 = mbt_ffi_ptr2str( + let result2272 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result2270) + @types.Role::Other(result2272) } _ => panic() } - Option::Some(lifted2271) + Option::Some(lifted2273) } _ => panic() } - array2273.push(@types.VariantCaseType::{ - name: result2258, - payload: lifted2259, + array2275.push(@types.VariantCaseType::{ + name: result2260, + payload: lifted2261, metadata: @types.MetadataEnvelope::{ - doc: lifted2261, - aliases: array2263, - examples: array2266, - deprecated: lifted2269, - role: lifted2272, + doc: lifted2263, + aliases: array2265, + examples: array2268, + deprecated: lifted2271, + role: lifted2274, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array2273) + @types.SchemaTypeBody::VariantType(array2275) } 16 => { - let array2276 : Array[String] = [] - for index2277 = 0 - index2277 < mbt_ffi_load32(iter_base + 12) - index2277 = index2277 + 1 { + let array2278 : Array[String] = [] + for index2279 = 0 + index2279 < mbt_ffi_load32(iter_base + 12) + index2279 = index2279 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2277 * 8 + index2279 * 8 - let result2275 = mbt_ffi_ptr2str( + let result2277 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2276.push(result2275) + array2278.push(result2277) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array2276) + @types.SchemaTypeBody::EnumType(array2278) } 17 => { - let array2279 : Array[String] = [] - for index2280 = 0 - index2280 < mbt_ffi_load32(iter_base + 12) - index2280 = index2280 + 1 { + let array2281 : Array[String] = [] + for index2282 = 0 + index2282 < mbt_ffi_load32(iter_base + 12) + index2282 = index2282 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2280 * 8 + index2282 * 8 - let result2278 = mbt_ffi_ptr2str( + let result2280 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2279.push(result2278) + array2281.push(result2280) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array2279) + @types.SchemaTypeBody::FlagsType(array2281) } 18 => { - let array2281 : Array[Int] = [] - for index2282 = 0 - index2282 < mbt_ffi_load32(iter_base + 12) - index2282 = index2282 + 1 { + let array2283 : Array[Int] = [] + for index2284 = 0 + index2284 < mbt_ffi_load32(iter_base + 12) + index2284 = index2284 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2282 * 4 + index2284 * 4 - array2281.push(mbt_ffi_load32(iter_base + 0)) + array2283.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array2281) + @types.SchemaTypeBody::TupleType(array2283) } 19 => @types.SchemaTypeBody::ListType( @@ -21546,14 +21596,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted2283 : Int? = match + let lifted2285 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2284 : Int? = match + let lifted2286 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -21561,37 +21611,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted2283, - err: lifted2284, + ok: lifted2285, + err: lifted2286, }) } 24 => { - let lifted2288 : Array[String]? = match + let lifted2290 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2286 : Array[String] = [] - for index2287 = 0 - index2287 < mbt_ffi_load32(iter_base + 16) - index2287 = index2287 + 1 { + let array2288 : Array[String] = [] + for index2289 = 0 + index2289 < mbt_ffi_load32(iter_base + 16) + index2289 = index2289 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2287 * 8 + index2289 * 8 - let result2285 = mbt_ffi_ptr2str( + let result2287 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2286.push(result2285) + array2288.push(result2287) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2286) + Option::Some(array2288) } _ => panic() } - let lifted2289 : UInt? = match + let lifted2291 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -21601,7 +21651,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2290 : UInt? = match + let lifted2292 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -21611,54 +21661,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2292 : String? = match + let lifted2294 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2291 = mbt_ffi_ptr2str( + let result2293 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2291) + Option::Some(result2293) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted2288, - min_length: lifted2289, - max_length: lifted2290, - regex: lifted2292, + languages: lifted2290, + min_length: lifted2291, + max_length: lifted2292, + regex: lifted2294, }) } 25 => { - let lifted2296 : Array[String]? = match + let lifted2298 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2294 : Array[String] = [] - for index2295 = 0 - index2295 < mbt_ffi_load32(iter_base + 16) - index2295 = index2295 + 1 { + let array2296 : Array[String] = [] + for index2297 = 0 + index2297 < mbt_ffi_load32(iter_base + 16) + index2297 = index2297 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2295 * 8 + index2297 * 8 - let result2293 = mbt_ffi_ptr2str( + let result2295 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2294.push(result2293) + array2296.push(result2295) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2294) + Option::Some(array2296) } _ => panic() } - let lifted2297 : UInt? = match + let lifted2299 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -21668,7 +21718,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2298 : UInt? = match + let lifted2300 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -21679,58 +21729,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted2296, - min_bytes: lifted2297, - max_bytes: lifted2298, + mime_types: lifted2298, + min_bytes: lifted2299, + max_bytes: lifted2300, }) } 26 => { - let lifted2302 : Array[String]? = match + let lifted2304 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array2300 : Array[String] = [] - for index2301 = 0 - index2301 < mbt_ffi_load32(iter_base + 20) - index2301 = index2301 + 1 { + let array2302 : Array[String] = [] + for index2303 = 0 + index2303 < mbt_ffi_load32(iter_base + 20) + index2303 = index2303 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2301 * 8 + index2303 * 8 - let result2299 = mbt_ffi_ptr2str( + let result2301 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2300.push(result2299) + array2302.push(result2301) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array2300) + Option::Some(array2302) } _ => panic() } - let lifted2306 : Array[String]? = match + let lifted2308 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array2304 : Array[String] = [] - for index2305 = 0 - index2305 < mbt_ffi_load32(iter_base + 32) - index2305 = index2305 + 1 { + let array2306 : Array[String] = [] + for index2307 = 0 + index2307 < mbt_ffi_load32(iter_base + 32) + index2307 = index2307 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2305 * 8 + index2307 * 8 - let result2303 = mbt_ffi_ptr2str( + let result2305 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2304.push(result2303) + array2306.push(result2305) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array2304) + Option::Some(array2306) } _ => panic() } @@ -21742,95 +21792,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted2302, - allowed_extensions: lifted2306, + allowed_mime_types: lifted2304, + allowed_extensions: lifted2308, }) } 27 => { - let lifted2310 : Array[String]? = match + let lifted2312 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2308 : Array[String] = [] - for index2309 = 0 - index2309 < mbt_ffi_load32(iter_base + 16) - index2309 = index2309 + 1 { + let array2310 : Array[String] = [] + for index2311 = 0 + index2311 < mbt_ffi_load32(iter_base + 16) + index2311 = index2311 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2309 * 8 + index2311 * 8 - let result2307 = mbt_ffi_ptr2str( + let result2309 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2308.push(result2307) + array2310.push(result2309) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2308) + Option::Some(array2310) } _ => panic() } - let lifted2314 : Array[String]? = match + let lifted2316 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array2312 : Array[String] = [] - for index2313 = 0 - index2313 < mbt_ffi_load32(iter_base + 28) - index2313 = index2313 + 1 { + let array2314 : Array[String] = [] + for index2315 = 0 + index2315 < mbt_ffi_load32(iter_base + 28) + index2315 = index2315 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2313 * 8 + index2315 * 8 - let result2311 = mbt_ffi_ptr2str( + let result2313 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2312.push(result2311) + array2314.push(result2313) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array2312) + Option::Some(array2314) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted2310, - allowed_hosts: lifted2314, + allowed_schemes: lifted2312, + allowed_hosts: lifted2316, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result2315 = mbt_ffi_ptr2str( + let result2317 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array2317 : Array[String] = [] - for index2318 = 0 - index2318 < mbt_ffi_load32(iter_base + 20) - index2318 = index2318 + 1 { + let array2319 : Array[String] = [] + for index2320 = 0 + index2320 < mbt_ffi_load32(iter_base + 20) + index2320 = index2320 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2318 * 8 + index2320 * 8 - let result2316 = mbt_ffi_ptr2str( + let result2318 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2317.push(result2316) + array2319.push(result2318) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted2320 : @types.QuantityValue? = match + let lifted2322 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2319 = mbt_ffi_ptr2str( + let result2321 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -21838,17 +21888,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result2319, + unit: result2321, }) } _ => panic() } - let lifted2322 : @types.QuantityValue? = match + let lifted2324 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result2321 = mbt_ffi_ptr2str( + let result2323 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -21856,406 +21906,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result2321, + unit: result2323, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result2315, - allowed_suffixes: array2317, - min: lifted2320, - max: lifted2322, + base_unit: result2317, + allowed_suffixes: array2319, + min: lifted2322, + max: lifted2324, }) } 31 => { - let array2346 : Array[@types.UnionBranch] = [] - for index2347 = 0 - index2347 < mbt_ffi_load32(iter_base + 12) - index2347 = index2347 + 1 { + let array2348 : Array[@types.UnionBranch] = [] + for index2349 = 0 + index2349 < mbt_ffi_load32(iter_base + 12) + index2349 = index2349 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2347 * 92 + index2349 * 92 - let result2323 = mbt_ffi_ptr2str( + let result2325 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2332 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted2334 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result2324 = mbt_ffi_ptr2str( + let result2326 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result2324) + @types.DiscriminatorRule::Prefix(result2326) } 1 => { - let result2325 = mbt_ffi_ptr2str( + let result2327 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result2325) + @types.DiscriminatorRule::Suffix(result2327) } 2 => { - let result2326 = mbt_ffi_ptr2str( + let result2328 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result2326) + @types.DiscriminatorRule::Contains(result2328) } 3 => { - let result2327 = mbt_ffi_ptr2str( + let result2329 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result2327) + @types.DiscriminatorRule::Regex(result2329) } 4 => { - let result2328 = mbt_ffi_ptr2str( + let result2330 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted2330 : String? = match + let lifted2332 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2329 = mbt_ffi_ptr2str( + let result2331 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result2329) + Option::Some(result2331) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result2328, - literal: lifted2330, + field_name: result2330, + literal: lifted2332, }) } 5 => { - let result2331 = mbt_ffi_ptr2str( + let result2333 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result2331) + @types.DiscriminatorRule::FieldAbsent(result2333) } _ => panic() } - let lifted2334 : String? = match + let lifted2336 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2333 = mbt_ffi_ptr2str( + let result2335 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2333) + Option::Some(result2335) } _ => panic() } - let array2336 : Array[String] = [] - for index2337 = 0 - index2337 < mbt_ffi_load32(iter_base + 52) - index2337 = index2337 + 1 { + let array2338 : Array[String] = [] + for index2339 = 0 + index2339 < mbt_ffi_load32(iter_base + 52) + index2339 = index2339 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2337 * 8 + index2339 * 8 - let result2335 = mbt_ffi_ptr2str( + let result2337 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2336.push(result2335) + array2338.push(result2337) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2339 : Array[String] = [] - for index2340 = 0 - index2340 < mbt_ffi_load32(iter_base + 60) - index2340 = index2340 + 1 { + let array2341 : Array[String] = [] + for index2342 = 0 + index2342 < mbt_ffi_load32(iter_base + 60) + index2342 = index2342 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2340 * 8 + index2342 * 8 - let result2338 = mbt_ffi_ptr2str( + let result2340 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2339.push(result2338) + array2341.push(result2340) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted2342 : String? = match + let lifted2344 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2341 = mbt_ffi_ptr2str( + let result2343 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2341) + Option::Some(result2343) } _ => panic() } - let lifted2345 : @types.Role? = match + let lifted2347 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted2344 = match + let lifted2346 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2343 = mbt_ffi_ptr2str( + let result2345 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result2343) + @types.Role::Other(result2345) } _ => panic() } - Option::Some(lifted2344) + Option::Some(lifted2346) } _ => panic() } - array2346.push(@types.UnionBranch::{ - tag: result2323, + array2348.push(@types.UnionBranch::{ + tag: result2325, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted2332, + discriminator: lifted2334, metadata: @types.MetadataEnvelope::{ - doc: lifted2334, - aliases: array2336, - examples: array2339, - deprecated: lifted2342, - role: lifted2345, + doc: lifted2336, + aliases: array2338, + examples: array2341, + deprecated: lifted2344, + role: lifted2347, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array2346, + branches: array2348, }) } 32 => { - let lifted2349 : String? = match + let lifted2351 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2348 = mbt_ffi_ptr2str( + let result2350 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2348) + Option::Some(result2350) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted2349, + category: lifted2351, }) } 33 => { - let lifted2351 : String? = match + let lifted2353 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2350 = mbt_ffi_ptr2str( + let result2352 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2350) + Option::Some(result2352) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted2351, + resource_name: lifted2353, }) } 34 => { - let lifted2352 : Int? = match + let lifted2354 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted2352) + @types.SchemaTypeBody::FutureType(lifted2354) } 35 => { - let lifted2353 : Int? = match + let lifted2355 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted2353) + @types.SchemaTypeBody::StreamType(lifted2355) } _ => panic() } - let lifted2356 : String? = match + let lifted2358 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result2355 = mbt_ffi_ptr2str( + let result2357 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result2355) + Option::Some(result2357) } _ => panic() } - let array2358 : Array[String] = [] - for index2359 = 0 - index2359 < mbt_ffi_load32(iter_base + 104) - index2359 = index2359 + 1 { + let array2360 : Array[String] = [] + for index2361 = 0 + index2361 < mbt_ffi_load32(iter_base + 104) + index2361 = index2361 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index2359 * 8 + index2361 * 8 - let result2357 = mbt_ffi_ptr2str( + let result2359 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2358.push(result2357) + array2360.push(result2359) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array2361 : Array[String] = [] - for index2362 = 0 - index2362 < mbt_ffi_load32(iter_base + 112) - index2362 = index2362 + 1 { + let array2363 : Array[String] = [] + for index2364 = 0 + index2364 < mbt_ffi_load32(iter_base + 112) + index2364 = index2364 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index2362 * 8 + index2364 * 8 - let result2360 = mbt_ffi_ptr2str( + let result2362 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2361.push(result2360) + array2363.push(result2362) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted2364 : String? = match + let lifted2366 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result2363 = mbt_ffi_ptr2str( + let result2365 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result2363) + Option::Some(result2365) } _ => panic() } - let lifted2367 : @types.Role? = match + let lifted2369 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted2366 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted2368 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2365 = mbt_ffi_ptr2str( + let result2367 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result2365) + @types.Role::Other(result2367) } _ => panic() } - Option::Some(lifted2366) + Option::Some(lifted2368) } _ => panic() } - array2368.push(@types.SchemaTypeNode::{ - body: lifted2354, + array2370.push(@types.SchemaTypeNode::{ + body: lifted2356, metadata: @types.MetadataEnvelope::{ - doc: lifted2356, - aliases: array2358, - examples: array2361, - deprecated: lifted2364, - role: lifted2367, + doc: lifted2358, + aliases: array2360, + examples: array2363, + deprecated: lifted2366, + role: lifted2369, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2373 : Array[@types.SchemaTypeDef] = [] - for index2374 = 0 - index2374 < mbt_ffi_load32(iter_base + 40) - index2374 = index2374 + 1 { + let array2375 : Array[@types.SchemaTypeDef] = [] + for index2376 = 0 + index2376 < mbt_ffi_load32(iter_base + 40) + index2376 = index2376 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2374 * 24 + index2376 * 24 - let result2370 = mbt_ffi_ptr2str( + let result2372 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2372 : String? = match + let lifted2374 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2371 = mbt_ffi_ptr2str( + let result2373 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2371) + Option::Some(result2373) } _ => panic() } - array2373.push(@types.SchemaTypeDef::{ - id: result2370, - name: lifted2372, + array2375.push(@types.SchemaTypeDef::{ + id: result2372, + name: lifted2374, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array2404 : Array[@types.SchemaValueNode] = [] - for index2405 = 0 - index2405 < mbt_ffi_load32(iter_base + 52) - index2405 = index2405 + 1 { + let array2406 : Array[@types.SchemaValueNode] = [] + for index2407 = 0 + index2407 < mbt_ffi_load32(iter_base + 52) + index2407 = index2407 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2405 * 32 + index2407 * 32 - let lifted2403 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2405 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -22307,29 +22357,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result2375 = mbt_ffi_ptr2str( + let result2377 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result2375) + @types.SchemaValueNode::StringValue(result2377) } 13 => { - let array2376 : Array[Int] = [] - for index2377 = 0 - index2377 < mbt_ffi_load32(iter_base + 12) - index2377 = index2377 + 1 { + let array2378 : Array[Int] = [] + for index2379 = 0 + index2379 < mbt_ffi_load32(iter_base + 12) + index2379 = index2379 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2377 * 4 + index2379 * 4 - array2376.push(mbt_ffi_load32(iter_base + 0)) + array2378.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array2376) + @types.SchemaValueNode::RecordValue(array2378) } 14 => { - let lifted2378 : Int? = match + let lifted2380 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -22338,7 +22388,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted2378, + payload: lifted2380, }) } 15 => @@ -22346,34 +22396,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array2379 : Array[Bool] = [] - for index2380 = 0 - index2380 < mbt_ffi_load32(iter_base + 12) - index2380 = index2380 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index2380 * 1 - - array2379.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array2379) - } - 17 => { - let array2381 : Array[Int] = [] + let array2381 : Array[Bool] = [] for index2382 = 0 index2382 < mbt_ffi_load32(iter_base + 12) index2382 = index2382 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2382 * 4 + index2382 * 1 - array2381.push(mbt_ffi_load32(iter_base + 0)) + array2381.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array2381) + @types.SchemaValueNode::FlagsValue(array2381) } - 18 => { + 17 => { let array2383 : Array[Int] = [] for index2384 = 0 index2384 < mbt_ffi_load32(iter_base + 12) @@ -22385,9 +22421,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array2383) + @types.SchemaValueNode::TupleValue(array2383) } - 19 => { + 18 => { let array2385 : Array[Int] = [] for index2386 = 0 index2386 < mbt_ffi_load32(iter_base + 12) @@ -22399,127 +22435,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array2385) + @types.SchemaValueNode::ListValue(array2385) } - 20 => { - let array2387 : Array[@types.MapEntry] = [] + 19 => { + let array2387 : Array[Int] = [] for index2388 = 0 index2388 < mbt_ffi_load32(iter_base + 12) index2388 = index2388 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2388 * 8 + index2388 * 4 - array2387.push(@types.MapEntry::{ + array2387.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array2387) + } + 20 => { + let array2389 : Array[@types.MapEntry] = [] + for index2390 = 0 + index2390 < mbt_ffi_load32(iter_base + 12) + index2390 = index2390 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index2390 * 8 + + array2389.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array2387) + @types.SchemaValueNode::MapValue(array2389) } 21 => { - let lifted2389 : Int? = match + let lifted2391 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted2389) + @types.SchemaValueNode::OptionValue(lifted2391) } 22 => { - let lifted2392 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2394 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted2390 : Int? = match + let lifted2392 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted2390) + @types.ResultValuePayload::OkValue(lifted2392) } 1 => { - let lifted2391 : Int? = match + let lifted2393 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted2391) + @types.ResultValuePayload::ErrValue(lifted2393) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted2392) + @types.SchemaValueNode::ResultValue(lifted2394) } 23 => { - let result2393 = mbt_ffi_ptr2str( + let result2395 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2395 : String? = match + let lifted2397 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2394 = mbt_ffi_ptr2str( + let result2396 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2394) + Option::Some(result2396) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result2393, - language: lifted2395, + text: result2395, + language: lifted2397, }) } 24 => { - let result2396 = mbt_ffi_ptr2bytes( + let result2398 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2398 : String? = match + let lifted2400 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2397 = mbt_ffi_ptr2str( + let result2399 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2397) + Option::Some(result2399) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result2396, - mime_type: lifted2398, + bytes: result2398, + mime_type: lifted2400, }) } 25 => { - let result2399 = mbt_ffi_ptr2str( + let result2401 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result2399) + @types.SchemaValueNode::PathValue(result2401) } 26 => { - let result2400 = mbt_ffi_ptr2str( + let result2402 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result2400) + @types.SchemaValueNode::UrlValue(result2402) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -22531,7 +22581,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result2401 = mbt_ffi_ptr2str( + let result2403 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -22539,17 +22589,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result2401, + unit: result2403, }) } 30 => { - let result2402 = mbt_ffi_ptr2str( + let result2404 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result2402, + tag: result2404, body: mbt_ffi_load32(iter_base + 16), }) } @@ -22563,22 +22613,28 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array2404.push(lifted2403) + array2406.push(lifted2405) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) AgentInvocationResult::AgentMethod(AgentInvocationOutputParameters::{ output: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array2368, - defs: array2373, + type_nodes: array2370, + defs: array2375, root: mbt_ffi_load32(iter_base + 44), }, value: @types.SchemaValueTree::{ - value_nodes: array2404, + value_nodes: array2406, root: mbt_ffi_load32(iter_base + 56), }, }, @@ -22586,73 +22642,73 @@ pub fn enrich_oplog_entries( } 2 => AgentInvocationResult::ManualUpdate 3 => { - let lifted2407 : String? = match + let lifted2409 : String? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => { - let result2406 = mbt_ffi_ptr2str( + let result2408 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - Option::Some(result2406) + Option::Some(result2408) } _ => panic() } AgentInvocationResult::LoadSnapshot(FallibleResultParameters::{ - error: lifted2407, + error: lifted2409, }) } 4 => { - let result2408 = mbt_ffi_ptr2bytes( + let result2410 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - let result2409 = mbt_ffi_ptr2str( + let result2411 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) AgentInvocationResult::SaveSnapshot(SaveSnapshotResultParameters::{ snapshot: SnapshotData::{ - data: result2408, - mime_type: result2409, + data: result2410, + mime_type: result2411, }, }) } 5 => { - let lifted2411 : String? = match + let lifted2413 : String? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => { - let result2410 = mbt_ffi_ptr2str( + let result2412 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - Option::Some(result2410) + Option::Some(result2412) } _ => panic() } AgentInvocationResult::ProcessOplogEntries(FallibleResultParameters::{ - error: lifted2411, + error: lifted2413, }) } _ => panic() } - let lifted2414 : String? = match mbt_ffi_load8_u(iter_base + 60) { + let lifted2416 : String? = match mbt_ffi_load8_u(iter_base + 60) { 0 => Option::None 1 => { - let result2413 = mbt_ffi_ptr2str( + let result2415 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - Option::Some(result2413) + Option::Some(result2415) } _ => panic() } @@ -22662,8 +22718,8 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - result: lifted2412, - method_name: lifted2414, + result: lifted2414, + method_name: lifted2416, consumed_fuel: mbt_ffi_load64(iter_base + 72), component_revision: mbt_ffi_load64(iter_base + 80).reinterpret_as_uint64(), }) @@ -22676,23 +22732,23 @@ pub fn enrich_oplog_entries( }, }) 7 => { - let result2415 = mbt_ffi_ptr2str( + let result2417 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let lifted2419 : RetryPolicyState? = match + let lifted2421 : RetryPolicyState? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let array2417 : Array[StateNode] = [] - for index2418 = 0 - index2418 < mbt_ffi_load32(iter_base + 52) - index2418 = index2418 + 1 { + let array2419 : Array[StateNode] = [] + for index2420 = 0 + index2420 < mbt_ffi_load32(iter_base + 52) + index2420 = index2420 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2418 * 16 + index2420 * 16 - let lifted2416 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2418 = match mbt_ffi_load8_u(iter_base + 0) { 0 => StateNode::Counter( mbt_ffi_load32(iter_base + 4).reinterpret_as_uint(), @@ -22718,11 +22774,11 @@ pub fn enrich_oplog_entries( _ => panic() } - array2417.push(lifted2416) + array2419.push(lifted2418) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - Option::Some(RetryPolicyState::{ nodes: array2417 }) + Option::Some(RetryPolicyState::{ nodes: array2419 }) } _ => panic() } @@ -22732,10 +22788,10 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - error: result2415, + error: result2417, retry_from: mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), inside_atomic_region: mbt_ffi_load8_u(iter_base + 40) != 0, - retry_policy_state: lifted2419, + retry_policy_state: lifted2421, }) } 8 => @@ -22786,36 +22842,36 @@ pub fn enrich_oplog_entries( begin_index: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), }) 14 => { - let lifted2932 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted2934 = match mbt_ffi_load8_u(iter_base + 24) { 0 => { - let result2420 = mbt_ffi_ptr2str( + let result2422 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let array2617 : Array[@types.SchemaTypeNode] = [] - for index2618 = 0 - index2618 < mbt_ffi_load32(iter_base + 44) - index2618 = index2618 + 1 { + let array2619 : Array[@types.SchemaTypeNode] = [] + for index2620 = 0 + index2620 < mbt_ffi_load32(iter_base + 44) + index2620 = index2620 + 1 { let iter_base = mbt_ffi_load32(iter_base + 40) + - index2618 * 144 + index2620 * 144 - let lifted2603 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2605 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted2427 : @types.NumericRestrictions? = match + let lifted2429 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2422 : @types.NumericBound? = match + let lifted2424 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2421 = match + let lifted2423 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -22832,16 +22888,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2421) + Option::Some(lifted2423) } _ => panic() } - let lifted2424 : @types.NumericBound? = match + let lifted2426 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2423 = match + let lifted2425 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -22858,46 +22914,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2423) + Option::Some(lifted2425) } _ => panic() } - let lifted2426 : String? = match + let lifted2428 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2425 = mbt_ffi_ptr2str( + let result2427 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2425) + Option::Some(result2427) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2422, - max: lifted2424, - unit: lifted2426, + min: lifted2424, + max: lifted2426, + unit: lifted2428, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted2427) + @types.SchemaTypeBody::S8Type(lifted2429) } 3 => { - let lifted2434 : @types.NumericRestrictions? = match + let lifted2436 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2429 : @types.NumericBound? = match + let lifted2431 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2428 = match + let lifted2430 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -22914,16 +22970,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2428) + Option::Some(lifted2430) } _ => panic() } - let lifted2431 : @types.NumericBound? = match + let lifted2433 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2430 = match + let lifted2432 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -22940,46 +22996,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2430) + Option::Some(lifted2432) } _ => panic() } - let lifted2433 : String? = match + let lifted2435 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2432 = mbt_ffi_ptr2str( + let result2434 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2432) + Option::Some(result2434) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2429, - max: lifted2431, - unit: lifted2433, + min: lifted2431, + max: lifted2433, + unit: lifted2435, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted2434) + @types.SchemaTypeBody::S16Type(lifted2436) } 4 => { - let lifted2441 : @types.NumericRestrictions? = match + let lifted2443 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2436 : @types.NumericBound? = match + let lifted2438 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2435 = match + let lifted2437 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -22996,16 +23052,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2435) + Option::Some(lifted2437) } _ => panic() } - let lifted2438 : @types.NumericBound? = match + let lifted2440 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2437 = match + let lifted2439 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23022,46 +23078,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2437) + Option::Some(lifted2439) } _ => panic() } - let lifted2440 : String? = match + let lifted2442 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2439 = mbt_ffi_ptr2str( + let result2441 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2439) + Option::Some(result2441) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2436, - max: lifted2438, - unit: lifted2440, + min: lifted2438, + max: lifted2440, + unit: lifted2442, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted2441) + @types.SchemaTypeBody::S32Type(lifted2443) } 5 => { - let lifted2448 : @types.NumericRestrictions? = match + let lifted2450 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2443 : @types.NumericBound? = match + let lifted2445 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2442 = match + let lifted2444 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23078,16 +23134,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2442) + Option::Some(lifted2444) } _ => panic() } - let lifted2445 : @types.NumericBound? = match + let lifted2447 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2444 = match + let lifted2446 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23104,46 +23160,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2444) + Option::Some(lifted2446) } _ => panic() } - let lifted2447 : String? = match + let lifted2449 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2446 = mbt_ffi_ptr2str( + let result2448 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2446) + Option::Some(result2448) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2443, - max: lifted2445, - unit: lifted2447, + min: lifted2445, + max: lifted2447, + unit: lifted2449, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted2448) + @types.SchemaTypeBody::S64Type(lifted2450) } 6 => { - let lifted2455 : @types.NumericRestrictions? = match + let lifted2457 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2450 : @types.NumericBound? = match + let lifted2452 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2449 = match + let lifted2451 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23160,16 +23216,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2449) + Option::Some(lifted2451) } _ => panic() } - let lifted2452 : @types.NumericBound? = match + let lifted2454 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2451 = match + let lifted2453 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23186,46 +23242,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2451) + Option::Some(lifted2453) } _ => panic() } - let lifted2454 : String? = match + let lifted2456 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2453 = mbt_ffi_ptr2str( + let result2455 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2453) + Option::Some(result2455) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2450, - max: lifted2452, - unit: lifted2454, + min: lifted2452, + max: lifted2454, + unit: lifted2456, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted2455) + @types.SchemaTypeBody::U8Type(lifted2457) } 7 => { - let lifted2462 : @types.NumericRestrictions? = match + let lifted2464 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2457 : @types.NumericBound? = match + let lifted2459 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2456 = match + let lifted2458 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23242,16 +23298,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2456) + Option::Some(lifted2458) } _ => panic() } - let lifted2459 : @types.NumericBound? = match + let lifted2461 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2458 = match + let lifted2460 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23268,46 +23324,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2458) + Option::Some(lifted2460) } _ => panic() } - let lifted2461 : String? = match + let lifted2463 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2460 = mbt_ffi_ptr2str( + let result2462 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2460) + Option::Some(result2462) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2457, - max: lifted2459, - unit: lifted2461, + min: lifted2459, + max: lifted2461, + unit: lifted2463, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted2462) + @types.SchemaTypeBody::U16Type(lifted2464) } 8 => { - let lifted2469 : @types.NumericRestrictions? = match + let lifted2471 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2464 : @types.NumericBound? = match + let lifted2466 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2463 = match + let lifted2465 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23324,16 +23380,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2463) + Option::Some(lifted2465) } _ => panic() } - let lifted2466 : @types.NumericBound? = match + let lifted2468 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2465 = match + let lifted2467 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23350,46 +23406,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2465) + Option::Some(lifted2467) } _ => panic() } - let lifted2468 : String? = match + let lifted2470 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2467 = mbt_ffi_ptr2str( + let result2469 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2467) + Option::Some(result2469) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2464, - max: lifted2466, - unit: lifted2468, + min: lifted2466, + max: lifted2468, + unit: lifted2470, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted2469) + @types.SchemaTypeBody::U32Type(lifted2471) } 9 => { - let lifted2476 : @types.NumericRestrictions? = match + let lifted2478 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2471 : @types.NumericBound? = match + let lifted2473 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2470 = match + let lifted2472 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23406,16 +23462,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2470) + Option::Some(lifted2472) } _ => panic() } - let lifted2473 : @types.NumericBound? = match + let lifted2475 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2472 = match + let lifted2474 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23432,46 +23488,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2472) + Option::Some(lifted2474) } _ => panic() } - let lifted2475 : String? = match + let lifted2477 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2474 = mbt_ffi_ptr2str( + let result2476 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2474) + Option::Some(result2476) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2471, - max: lifted2473, - unit: lifted2475, + min: lifted2473, + max: lifted2475, + unit: lifted2477, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted2476) + @types.SchemaTypeBody::U64Type(lifted2478) } 10 => { - let lifted2483 : @types.NumericRestrictions? = match + let lifted2485 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2478 : @types.NumericBound? = match + let lifted2480 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2477 = match + let lifted2479 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23488,16 +23544,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2477) + Option::Some(lifted2479) } _ => panic() } - let lifted2480 : @types.NumericBound? = match + let lifted2482 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2479 = match + let lifted2481 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23514,46 +23570,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2479) + Option::Some(lifted2481) } _ => panic() } - let lifted2482 : String? = match + let lifted2484 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2481 = mbt_ffi_ptr2str( + let result2483 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2481) + Option::Some(result2483) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2478, - max: lifted2480, - unit: lifted2482, + min: lifted2480, + max: lifted2482, + unit: lifted2484, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted2483) + @types.SchemaTypeBody::F32Type(lifted2485) } 11 => { - let lifted2490 : @types.NumericRestrictions? = match + let lifted2492 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2485 : @types.NumericBound? = match + let lifted2487 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2484 = match + let lifted2486 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -23570,16 +23626,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2484) + Option::Some(lifted2486) } _ => panic() } - let lifted2487 : @types.NumericBound? = match + let lifted2489 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2486 = match + let lifted2488 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -23596,324 +23652,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2486) + Option::Some(lifted2488) } _ => panic() } - let lifted2489 : String? = match + let lifted2491 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2488 = mbt_ffi_ptr2str( + let result2490 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2488) + Option::Some(result2490) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2485, - max: lifted2487, - unit: lifted2489, + min: lifted2487, + max: lifted2489, + unit: lifted2491, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted2490) + @types.SchemaTypeBody::F64Type(lifted2492) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array2505 : Array[@types.NamedFieldType] = [] - for index2506 = 0 - index2506 < mbt_ffi_load32(iter_base + 12) - index2506 = index2506 + 1 { + let array2507 : Array[@types.NamedFieldType] = [] + for index2508 = 0 + index2508 < mbt_ffi_load32(iter_base + 12) + index2508 = index2508 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2506 * 68 + index2508 * 68 - let result2491 = mbt_ffi_ptr2str( + let result2493 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2493 : String? = match + let lifted2495 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2492 = mbt_ffi_ptr2str( + let result2494 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2492) + Option::Some(result2494) } _ => panic() } - let array2495 : Array[String] = [] - for index2496 = 0 - index2496 < mbt_ffi_load32(iter_base + 28) - index2496 = index2496 + 1 { + let array2497 : Array[String] = [] + for index2498 = 0 + index2498 < mbt_ffi_load32(iter_base + 28) + index2498 = index2498 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2496 * 8 + index2498 * 8 - let result2494 = mbt_ffi_ptr2str( + let result2496 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2495.push(result2494) + array2497.push(result2496) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array2498 : Array[String] = [] - for index2499 = 0 - index2499 < mbt_ffi_load32(iter_base + 36) - index2499 = index2499 + 1 { + let array2500 : Array[String] = [] + for index2501 = 0 + index2501 < mbt_ffi_load32(iter_base + 36) + index2501 = index2501 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index2499 * 8 + index2501 * 8 - let result2497 = mbt_ffi_ptr2str( + let result2499 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2498.push(result2497) + array2500.push(result2499) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted2501 : String? = match + let lifted2503 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result2500 = mbt_ffi_ptr2str( + let result2502 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result2500) + Option::Some(result2502) } _ => panic() } - let lifted2504 : @types.Role? = match + let lifted2506 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted2503 = match + let lifted2505 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2502 = mbt_ffi_ptr2str( + let result2504 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result2502) + @types.Role::Other(result2504) } _ => panic() } - Option::Some(lifted2503) + Option::Some(lifted2505) } _ => panic() } - array2505.push(@types.NamedFieldType::{ - name: result2491, + array2507.push(@types.NamedFieldType::{ + name: result2493, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted2493, - aliases: array2495, - examples: array2498, - deprecated: lifted2501, - role: lifted2504, + doc: lifted2495, + aliases: array2497, + examples: array2500, + deprecated: lifted2503, + role: lifted2506, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array2505) + @types.SchemaTypeBody::RecordType(array2507) } 15 => { - let array2522 : Array[@types.VariantCaseType] = [] - for index2523 = 0 - index2523 < mbt_ffi_load32(iter_base + 12) - index2523 = index2523 + 1 { + let array2524 : Array[@types.VariantCaseType] = [] + for index2525 = 0 + index2525 < mbt_ffi_load32(iter_base + 12) + index2525 = index2525 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2523 * 72 + index2525 * 72 - let result2507 = mbt_ffi_ptr2str( + let result2509 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2508 : Int? = match + let lifted2510 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2510 : String? = match + let lifted2512 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2509 = mbt_ffi_ptr2str( + let result2511 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2509) + Option::Some(result2511) } _ => panic() } - let array2512 : Array[String] = [] - for index2513 = 0 - index2513 < mbt_ffi_load32(iter_base + 32) - index2513 = index2513 + 1 { + let array2514 : Array[String] = [] + for index2515 = 0 + index2515 < mbt_ffi_load32(iter_base + 32) + index2515 = index2515 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2513 * 8 + index2515 * 8 - let result2511 = mbt_ffi_ptr2str( + let result2513 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2512.push(result2511) + array2514.push(result2513) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2515 : Array[String] = [] - for index2516 = 0 - index2516 < mbt_ffi_load32(iter_base + 40) - index2516 = index2516 + 1 { + let array2517 : Array[String] = [] + for index2518 = 0 + index2518 < mbt_ffi_load32(iter_base + 40) + index2518 = index2518 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2516 * 8 + index2518 * 8 - let result2514 = mbt_ffi_ptr2str( + let result2516 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2515.push(result2514) + array2517.push(result2516) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted2518 : String? = match + let lifted2520 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2517 = mbt_ffi_ptr2str( + let result2519 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2517) + Option::Some(result2519) } _ => panic() } - let lifted2521 : @types.Role? = match + let lifted2523 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted2520 = match + let lifted2522 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2519 = mbt_ffi_ptr2str( + let result2521 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result2519) + @types.Role::Other(result2521) } _ => panic() } - Option::Some(lifted2520) + Option::Some(lifted2522) } _ => panic() } - array2522.push(@types.VariantCaseType::{ - name: result2507, - payload: lifted2508, + array2524.push(@types.VariantCaseType::{ + name: result2509, + payload: lifted2510, metadata: @types.MetadataEnvelope::{ - doc: lifted2510, - aliases: array2512, - examples: array2515, - deprecated: lifted2518, - role: lifted2521, + doc: lifted2512, + aliases: array2514, + examples: array2517, + deprecated: lifted2520, + role: lifted2523, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array2522) + @types.SchemaTypeBody::VariantType(array2524) } 16 => { - let array2525 : Array[String] = [] - for index2526 = 0 - index2526 < mbt_ffi_load32(iter_base + 12) - index2526 = index2526 + 1 { + let array2527 : Array[String] = [] + for index2528 = 0 + index2528 < mbt_ffi_load32(iter_base + 12) + index2528 = index2528 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2526 * 8 + index2528 * 8 - let result2524 = mbt_ffi_ptr2str( + let result2526 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2525.push(result2524) + array2527.push(result2526) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array2525) + @types.SchemaTypeBody::EnumType(array2527) } 17 => { - let array2528 : Array[String] = [] - for index2529 = 0 - index2529 < mbt_ffi_load32(iter_base + 12) - index2529 = index2529 + 1 { + let array2530 : Array[String] = [] + for index2531 = 0 + index2531 < mbt_ffi_load32(iter_base + 12) + index2531 = index2531 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2529 * 8 + index2531 * 8 - let result2527 = mbt_ffi_ptr2str( + let result2529 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2528.push(result2527) + array2530.push(result2529) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array2528) + @types.SchemaTypeBody::FlagsType(array2530) } 18 => { - let array2530 : Array[Int] = [] - for index2531 = 0 - index2531 < mbt_ffi_load32(iter_base + 12) - index2531 = index2531 + 1 { + let array2532 : Array[Int] = [] + for index2533 = 0 + index2533 < mbt_ffi_load32(iter_base + 12) + index2533 = index2533 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2531 * 4 + index2533 * 4 - array2530.push(mbt_ffi_load32(iter_base + 0)) + array2532.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array2530) + @types.SchemaTypeBody::TupleType(array2532) } 19 => @types.SchemaTypeBody::ListType( @@ -23934,14 +23990,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted2532 : Int? = match + let lifted2534 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2533 : Int? = match + let lifted2535 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -23949,37 +24005,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted2532, - err: lifted2533, + ok: lifted2534, + err: lifted2535, }) } 24 => { - let lifted2537 : Array[String]? = match + let lifted2539 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2535 : Array[String] = [] - for index2536 = 0 - index2536 < mbt_ffi_load32(iter_base + 16) - index2536 = index2536 + 1 { + let array2537 : Array[String] = [] + for index2538 = 0 + index2538 < mbt_ffi_load32(iter_base + 16) + index2538 = index2538 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2536 * 8 + index2538 * 8 - let result2534 = mbt_ffi_ptr2str( + let result2536 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2535.push(result2534) + array2537.push(result2536) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2535) + Option::Some(array2537) } _ => panic() } - let lifted2538 : UInt? = match + let lifted2540 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -23989,7 +24045,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2539 : UInt? = match + let lifted2541 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -23999,54 +24055,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2541 : String? = match + let lifted2543 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2540 = mbt_ffi_ptr2str( + let result2542 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2540) + Option::Some(result2542) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted2537, - min_length: lifted2538, - max_length: lifted2539, - regex: lifted2541, + languages: lifted2539, + min_length: lifted2540, + max_length: lifted2541, + regex: lifted2543, }) } 25 => { - let lifted2545 : Array[String]? = match + let lifted2547 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2543 : Array[String] = [] - for index2544 = 0 - index2544 < mbt_ffi_load32(iter_base + 16) - index2544 = index2544 + 1 { + let array2545 : Array[String] = [] + for index2546 = 0 + index2546 < mbt_ffi_load32(iter_base + 16) + index2546 = index2546 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2544 * 8 + index2546 * 8 - let result2542 = mbt_ffi_ptr2str( + let result2544 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2543.push(result2542) + array2545.push(result2544) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2543) + Option::Some(array2545) } _ => panic() } - let lifted2546 : UInt? = match + let lifted2548 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -24056,7 +24112,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2547 : UInt? = match + let lifted2549 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -24067,58 +24123,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted2545, - min_bytes: lifted2546, - max_bytes: lifted2547, + mime_types: lifted2547, + min_bytes: lifted2548, + max_bytes: lifted2549, }) } 26 => { - let lifted2551 : Array[String]? = match + let lifted2553 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array2549 : Array[String] = [] - for index2550 = 0 - index2550 < mbt_ffi_load32(iter_base + 20) - index2550 = index2550 + 1 { + let array2551 : Array[String] = [] + for index2552 = 0 + index2552 < mbt_ffi_load32(iter_base + 20) + index2552 = index2552 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2550 * 8 + index2552 * 8 - let result2548 = mbt_ffi_ptr2str( + let result2550 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2549.push(result2548) + array2551.push(result2550) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array2549) + Option::Some(array2551) } _ => panic() } - let lifted2555 : Array[String]? = match + let lifted2557 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array2553 : Array[String] = [] - for index2554 = 0 - index2554 < mbt_ffi_load32(iter_base + 32) - index2554 = index2554 + 1 { + let array2555 : Array[String] = [] + for index2556 = 0 + index2556 < mbt_ffi_load32(iter_base + 32) + index2556 = index2556 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2554 * 8 + index2556 * 8 - let result2552 = mbt_ffi_ptr2str( + let result2554 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2553.push(result2552) + array2555.push(result2554) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array2553) + Option::Some(array2555) } _ => panic() } @@ -24130,95 +24186,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted2551, - allowed_extensions: lifted2555, + allowed_mime_types: lifted2553, + allowed_extensions: lifted2557, }) } 27 => { - let lifted2559 : Array[String]? = match + let lifted2561 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2557 : Array[String] = [] - for index2558 = 0 - index2558 < mbt_ffi_load32(iter_base + 16) - index2558 = index2558 + 1 { + let array2559 : Array[String] = [] + for index2560 = 0 + index2560 < mbt_ffi_load32(iter_base + 16) + index2560 = index2560 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2558 * 8 + index2560 * 8 - let result2556 = mbt_ffi_ptr2str( + let result2558 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2557.push(result2556) + array2559.push(result2558) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2557) + Option::Some(array2559) } _ => panic() } - let lifted2563 : Array[String]? = match + let lifted2565 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array2561 : Array[String] = [] - for index2562 = 0 - index2562 < mbt_ffi_load32(iter_base + 28) - index2562 = index2562 + 1 { + let array2563 : Array[String] = [] + for index2564 = 0 + index2564 < mbt_ffi_load32(iter_base + 28) + index2564 = index2564 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2562 * 8 + index2564 * 8 - let result2560 = mbt_ffi_ptr2str( + let result2562 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2561.push(result2560) + array2563.push(result2562) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array2561) + Option::Some(array2563) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted2559, - allowed_hosts: lifted2563, + allowed_schemes: lifted2561, + allowed_hosts: lifted2565, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result2564 = mbt_ffi_ptr2str( + let result2566 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array2566 : Array[String] = [] - for index2567 = 0 - index2567 < mbt_ffi_load32(iter_base + 20) - index2567 = index2567 + 1 { + let array2568 : Array[String] = [] + for index2569 = 0 + index2569 < mbt_ffi_load32(iter_base + 20) + index2569 = index2569 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2567 * 8 + index2569 * 8 - let result2565 = mbt_ffi_ptr2str( + let result2567 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2566.push(result2565) + array2568.push(result2567) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted2569 : @types.QuantityValue? = match + let lifted2571 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2568 = mbt_ffi_ptr2str( + let result2570 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -24226,17 +24282,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result2568, + unit: result2570, }) } _ => panic() } - let lifted2571 : @types.QuantityValue? = match + let lifted2573 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result2570 = mbt_ffi_ptr2str( + let result2572 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -24244,406 +24300,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result2570, + unit: result2572, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result2564, - allowed_suffixes: array2566, - min: lifted2569, - max: lifted2571, + base_unit: result2566, + allowed_suffixes: array2568, + min: lifted2571, + max: lifted2573, }) } 31 => { - let array2595 : Array[@types.UnionBranch] = [] - for index2596 = 0 - index2596 < mbt_ffi_load32(iter_base + 12) - index2596 = index2596 + 1 { + let array2597 : Array[@types.UnionBranch] = [] + for index2598 = 0 + index2598 < mbt_ffi_load32(iter_base + 12) + index2598 = index2598 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2596 * 92 + index2598 * 92 - let result2572 = mbt_ffi_ptr2str( + let result2574 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2581 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted2583 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result2573 = mbt_ffi_ptr2str( + let result2575 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result2573) + @types.DiscriminatorRule::Prefix(result2575) } 1 => { - let result2574 = mbt_ffi_ptr2str( + let result2576 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result2574) + @types.DiscriminatorRule::Suffix(result2576) } 2 => { - let result2575 = mbt_ffi_ptr2str( + let result2577 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result2575) + @types.DiscriminatorRule::Contains(result2577) } 3 => { - let result2576 = mbt_ffi_ptr2str( + let result2578 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result2576) + @types.DiscriminatorRule::Regex(result2578) } 4 => { - let result2577 = mbt_ffi_ptr2str( + let result2579 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted2579 : String? = match + let lifted2581 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2578 = mbt_ffi_ptr2str( + let result2580 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result2578) + Option::Some(result2580) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result2577, - literal: lifted2579, + field_name: result2579, + literal: lifted2581, }) } 5 => { - let result2580 = mbt_ffi_ptr2str( + let result2582 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result2580) + @types.DiscriminatorRule::FieldAbsent(result2582) } _ => panic() } - let lifted2583 : String? = match + let lifted2585 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2582 = mbt_ffi_ptr2str( + let result2584 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2582) + Option::Some(result2584) } _ => panic() } - let array2585 : Array[String] = [] - for index2586 = 0 - index2586 < mbt_ffi_load32(iter_base + 52) - index2586 = index2586 + 1 { + let array2587 : Array[String] = [] + for index2588 = 0 + index2588 < mbt_ffi_load32(iter_base + 52) + index2588 = index2588 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2586 * 8 + index2588 * 8 - let result2584 = mbt_ffi_ptr2str( + let result2586 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2585.push(result2584) + array2587.push(result2586) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2588 : Array[String] = [] - for index2589 = 0 - index2589 < mbt_ffi_load32(iter_base + 60) - index2589 = index2589 + 1 { + let array2590 : Array[String] = [] + for index2591 = 0 + index2591 < mbt_ffi_load32(iter_base + 60) + index2591 = index2591 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2589 * 8 + index2591 * 8 - let result2587 = mbt_ffi_ptr2str( + let result2589 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2588.push(result2587) + array2590.push(result2589) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted2591 : String? = match + let lifted2593 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2590 = mbt_ffi_ptr2str( + let result2592 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2590) + Option::Some(result2592) } _ => panic() } - let lifted2594 : @types.Role? = match + let lifted2596 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted2593 = match + let lifted2595 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2592 = mbt_ffi_ptr2str( + let result2594 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result2592) + @types.Role::Other(result2594) } _ => panic() } - Option::Some(lifted2593) + Option::Some(lifted2595) } _ => panic() } - array2595.push(@types.UnionBranch::{ - tag: result2572, + array2597.push(@types.UnionBranch::{ + tag: result2574, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted2581, + discriminator: lifted2583, metadata: @types.MetadataEnvelope::{ - doc: lifted2583, - aliases: array2585, - examples: array2588, - deprecated: lifted2591, - role: lifted2594, + doc: lifted2585, + aliases: array2587, + examples: array2590, + deprecated: lifted2593, + role: lifted2596, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array2595, + branches: array2597, }) } 32 => { - let lifted2598 : String? = match + let lifted2600 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2597 = mbt_ffi_ptr2str( + let result2599 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2597) + Option::Some(result2599) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted2598, + category: lifted2600, }) } 33 => { - let lifted2600 : String? = match + let lifted2602 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2599 = mbt_ffi_ptr2str( + let result2601 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2599) + Option::Some(result2601) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted2600, + resource_name: lifted2602, }) } 34 => { - let lifted2601 : Int? = match + let lifted2603 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted2601) + @types.SchemaTypeBody::FutureType(lifted2603) } 35 => { - let lifted2602 : Int? = match + let lifted2604 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted2602) + @types.SchemaTypeBody::StreamType(lifted2604) } _ => panic() } - let lifted2605 : String? = match + let lifted2607 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result2604 = mbt_ffi_ptr2str( + let result2606 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result2604) + Option::Some(result2606) } _ => panic() } - let array2607 : Array[String] = [] - for index2608 = 0 - index2608 < mbt_ffi_load32(iter_base + 104) - index2608 = index2608 + 1 { + let array2609 : Array[String] = [] + for index2610 = 0 + index2610 < mbt_ffi_load32(iter_base + 104) + index2610 = index2610 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index2608 * 8 + index2610 * 8 - let result2606 = mbt_ffi_ptr2str( + let result2608 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2607.push(result2606) + array2609.push(result2608) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array2610 : Array[String] = [] - for index2611 = 0 - index2611 < mbt_ffi_load32(iter_base + 112) - index2611 = index2611 + 1 { + let array2612 : Array[String] = [] + for index2613 = 0 + index2613 < mbt_ffi_load32(iter_base + 112) + index2613 = index2613 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index2611 * 8 + index2613 * 8 - let result2609 = mbt_ffi_ptr2str( + let result2611 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2610.push(result2609) + array2612.push(result2611) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted2613 : String? = match + let lifted2615 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result2612 = mbt_ffi_ptr2str( + let result2614 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result2612) + Option::Some(result2614) } _ => panic() } - let lifted2616 : @types.Role? = match + let lifted2618 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted2615 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted2617 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2614 = mbt_ffi_ptr2str( + let result2616 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result2614) + @types.Role::Other(result2616) } _ => panic() } - Option::Some(lifted2615) + Option::Some(lifted2617) } _ => panic() } - array2617.push(@types.SchemaTypeNode::{ - body: lifted2603, + array2619.push(@types.SchemaTypeNode::{ + body: lifted2605, metadata: @types.MetadataEnvelope::{ - doc: lifted2605, - aliases: array2607, - examples: array2610, - deprecated: lifted2613, - role: lifted2616, + doc: lifted2607, + aliases: array2609, + examples: array2612, + deprecated: lifted2615, + role: lifted2618, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 40)) - let array2622 : Array[@types.SchemaTypeDef] = [] - for index2623 = 0 - index2623 < mbt_ffi_load32(iter_base + 52) - index2623 = index2623 + 1 { + let array2624 : Array[@types.SchemaTypeDef] = [] + for index2625 = 0 + index2625 < mbt_ffi_load32(iter_base + 52) + index2625 = index2625 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2623 * 24 + index2625 * 24 - let result2619 = mbt_ffi_ptr2str( + let result2621 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2621 : String? = match + let lifted2623 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2620 = mbt_ffi_ptr2str( + let result2622 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2620) + Option::Some(result2622) } _ => panic() } - array2622.push(@types.SchemaTypeDef::{ - id: result2619, - name: lifted2621, + array2624.push(@types.SchemaTypeDef::{ + id: result2621, + name: lifted2623, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2653 : Array[@types.SchemaValueNode] = [] - for index2654 = 0 - index2654 < mbt_ffi_load32(iter_base + 64) - index2654 = index2654 + 1 { + let array2655 : Array[@types.SchemaValueNode] = [] + for index2656 = 0 + index2656 < mbt_ffi_load32(iter_base + 64) + index2656 = index2656 + 1 { let iter_base = mbt_ffi_load32(iter_base + 60) + - index2654 * 32 + index2656 * 32 - let lifted2652 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2654 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -24695,29 +24751,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result2624 = mbt_ffi_ptr2str( + let result2626 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result2624) + @types.SchemaValueNode::StringValue(result2626) } 13 => { - let array2625 : Array[Int] = [] - for index2626 = 0 - index2626 < mbt_ffi_load32(iter_base + 12) - index2626 = index2626 + 1 { + let array2627 : Array[Int] = [] + for index2628 = 0 + index2628 < mbt_ffi_load32(iter_base + 12) + index2628 = index2628 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2626 * 4 + index2628 * 4 - array2625.push(mbt_ffi_load32(iter_base + 0)) + array2627.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array2625) + @types.SchemaValueNode::RecordValue(array2627) } 14 => { - let lifted2627 : Int? = match + let lifted2629 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -24726,7 +24782,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted2627, + payload: lifted2629, }) } 15 => @@ -24734,34 +24790,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array2628 : Array[Bool] = [] - for index2629 = 0 - index2629 < mbt_ffi_load32(iter_base + 12) - index2629 = index2629 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index2629 * 1 - - array2628.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array2628) - } - 17 => { - let array2630 : Array[Int] = [] + let array2630 : Array[Bool] = [] for index2631 = 0 index2631 < mbt_ffi_load32(iter_base + 12) index2631 = index2631 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2631 * 4 + index2631 * 1 - array2630.push(mbt_ffi_load32(iter_base + 0)) + array2630.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array2630) + @types.SchemaValueNode::FlagsValue(array2630) } - 18 => { + 17 => { let array2632 : Array[Int] = [] for index2633 = 0 index2633 < mbt_ffi_load32(iter_base + 12) @@ -24773,9 +24815,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array2632) + @types.SchemaValueNode::TupleValue(array2632) } - 19 => { + 18 => { let array2634 : Array[Int] = [] for index2635 = 0 index2635 < mbt_ffi_load32(iter_base + 12) @@ -24787,127 +24829,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array2634) + @types.SchemaValueNode::ListValue(array2634) } - 20 => { - let array2636 : Array[@types.MapEntry] = [] + 19 => { + let array2636 : Array[Int] = [] for index2637 = 0 index2637 < mbt_ffi_load32(iter_base + 12) index2637 = index2637 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2637 * 8 + index2637 * 4 + + array2636.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - array2636.push(@types.MapEntry::{ + @types.SchemaValueNode::FixedListValue(array2636) + } + 20 => { + let array2638 : Array[@types.MapEntry] = [] + for index2639 = 0 + index2639 < mbt_ffi_load32(iter_base + 12) + index2639 = index2639 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index2639 * 8 + + array2638.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array2636) + @types.SchemaValueNode::MapValue(array2638) } 21 => { - let lifted2638 : Int? = match + let lifted2640 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted2638) + @types.SchemaValueNode::OptionValue(lifted2640) } 22 => { - let lifted2641 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2643 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted2639 : Int? = match + let lifted2641 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted2639) + @types.ResultValuePayload::OkValue(lifted2641) } 1 => { - let lifted2640 : Int? = match + let lifted2642 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted2640) + @types.ResultValuePayload::ErrValue(lifted2642) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted2641) + @types.SchemaValueNode::ResultValue(lifted2643) } 23 => { - let result2642 = mbt_ffi_ptr2str( + let result2644 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2644 : String? = match + let lifted2646 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2643 = mbt_ffi_ptr2str( + let result2645 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2643) + Option::Some(result2645) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result2642, - language: lifted2644, + text: result2644, + language: lifted2646, }) } 24 => { - let result2645 = mbt_ffi_ptr2bytes( + let result2647 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2647 : String? = match + let lifted2649 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2646 = mbt_ffi_ptr2str( + let result2648 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2646) + Option::Some(result2648) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result2645, - mime_type: lifted2647, + bytes: result2647, + mime_type: lifted2649, }) } 25 => { - let result2648 = mbt_ffi_ptr2str( + let result2650 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result2648) + @types.SchemaValueNode::PathValue(result2650) } 26 => { - let result2649 = mbt_ffi_ptr2str( + let result2651 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result2649) + @types.SchemaValueNode::UrlValue(result2651) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -24919,7 +24975,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result2650 = mbt_ffi_ptr2str( + let result2652 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -24927,17 +24983,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result2650, + unit: result2652, }) } 30 => { - let result2651 = mbt_ffi_ptr2str( + let result2653 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result2651, + tag: result2653, body: mbt_ffi_load32(iter_base + 16), }) } @@ -24951,68 +25007,74 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array2653.push(lifted2652) + array2655.push(lifted2654) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) - let result2655 = mbt_ffi_ptr2str( + let result2657 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 72), mbt_ffi_load32(iter_base + 76), ) - let array2657 : Array[String] = [] - for index2658 = 0 - index2658 < mbt_ffi_load32(iter_base + 84) - index2658 = index2658 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 80) + index2658 * 8 + let array2659 : Array[String] = [] + for index2660 = 0 + index2660 < mbt_ffi_load32(iter_base + 84) + index2660 = index2660 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 80) + index2660 * 8 - let result2656 = mbt_ffi_ptr2str( + let result2658 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2657.push(result2656) + array2659.push(result2658) } mbt_ffi_free(mbt_ffi_load32(iter_base + 80)) - let array2672 : Array[Array[SpanData]] = [] - for index2673 = 0 - index2673 < mbt_ffi_load32(iter_base + 92) - index2673 = index2673 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 88) + index2673 * 8 + let array2674 : Array[Array[SpanData]] = [] + for index2675 = 0 + index2675 < mbt_ffi_load32(iter_base + 92) + index2675 = index2675 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 88) + index2675 * 8 - let array2670 : Array[SpanData] = [] - for index2671 = 0 - index2671 < mbt_ffi_load32(iter_base + 4) - index2671 = index2671 + 1 { + let array2672 : Array[SpanData] = [] + for index2673 = 0 + index2673 < mbt_ffi_load32(iter_base + 4) + index2673 = index2673 + 1 { let iter_base = mbt_ffi_load32(iter_base + 0) + - index2671 * 80 + index2673 * 80 - let lifted2669 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2671 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result2659 = mbt_ffi_ptr2str( + let result2661 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2661 : String? = match + let lifted2663 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result2660 = mbt_ffi_ptr2str( + let result2662 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result2660) + Option::Some(result2662) } _ => panic() } - let lifted2662 : UInt64? = match + let lifted2664 : UInt64? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -25022,123 +25084,123 @@ pub fn enrich_oplog_entries( _ => panic() } - let array2666 : Array[@context.Attribute] = [] - for index2667 = 0 - index2667 < mbt_ffi_load32(iter_base + 68) - index2667 = index2667 + 1 { + let array2668 : Array[@context.Attribute] = [] + for index2669 = 0 + index2669 < mbt_ffi_load32(iter_base + 68) + index2669 = index2669 + 1 { let iter_base = mbt_ffi_load32(iter_base + 64) + - index2667 * 20 + index2669 * 20 - let result2663 = mbt_ffi_ptr2str( + let result2665 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2665 = match + let lifted2667 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result2664 = mbt_ffi_ptr2str( + let result2666 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result2664) + @context.AttributeValue::String(result2666) } _ => panic() } - array2666.push(@context.Attribute::{ - key: result2663, - value: lifted2665, + array2668.push(@context.Attribute::{ + key: result2665, + value: lifted2667, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) SpanData::LocalSpan(LocalSpanData::{ - span_id: result2659, + span_id: result2661, start: @system-clock.Instant::{ seconds: mbt_ffi_load64(iter_base + 16), nanoseconds: mbt_ffi_load32(iter_base + 24).reinterpret_as_uint(), }, - parent: lifted2661, - linked_context: lifted2662, - attributes: array2666, + parent: lifted2663, + linked_context: lifted2664, + attributes: array2668, inherited: mbt_ffi_load8_u(iter_base + 72) != 0, }) } 1 => { - let result2668 = mbt_ffi_ptr2str( + let result2670 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) SpanData::ExternalSpan(ExternalSpanData::{ - span_id: result2668, + span_id: result2670, }) } _ => panic() } - array2670.push(lifted2669) + array2672.push(lifted2671) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - array2672.push(array2670) + array2674.push(array2672) } mbt_ffi_free(mbt_ffi_load32(iter_base + 88)) AgentInvocation::AgentInitialization(AgentInitializationParameters::{ - idempotency_key: result2420, + idempotency_key: result2422, constructor_parameters: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array2617, - defs: array2622, + type_nodes: array2619, + defs: array2624, root: mbt_ffi_load32(iter_base + 56), }, value: @types.SchemaValueTree::{ - value_nodes: array2653, + value_nodes: array2655, root: mbt_ffi_load32(iter_base + 68), }, }, - trace_id: result2655, - trace_states: array2657, - invocation_context: array2672, + trace_id: result2657, + trace_states: array2659, + invocation_context: array2674, }) } 1 => { - let result2674 = mbt_ffi_ptr2str( + let result2676 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result2675 = mbt_ffi_ptr2str( + let result2677 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - let array2872 : Array[@types.SchemaTypeNode] = [] - for index2873 = 0 - index2873 < mbt_ffi_load32(iter_base + 52) - index2873 = index2873 + 1 { + let array2874 : Array[@types.SchemaTypeNode] = [] + for index2875 = 0 + index2875 < mbt_ffi_load32(iter_base + 52) + index2875 = index2875 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2873 * 144 + index2875 * 144 - let lifted2858 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2860 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType( mbt_ffi_load32(iter_base + 8), ) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted2682 : @types.NumericRestrictions? = match + let lifted2684 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2677 : @types.NumericBound? = match + let lifted2679 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2676 = match + let lifted2678 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25155,16 +25217,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2676) + Option::Some(lifted2678) } _ => panic() } - let lifted2679 : @types.NumericBound? = match + let lifted2681 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2678 = match + let lifted2680 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25181,46 +25243,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2678) + Option::Some(lifted2680) } _ => panic() } - let lifted2681 : String? = match + let lifted2683 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2680 = mbt_ffi_ptr2str( + let result2682 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2680) + Option::Some(result2682) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2677, - max: lifted2679, - unit: lifted2681, + min: lifted2679, + max: lifted2681, + unit: lifted2683, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted2682) + @types.SchemaTypeBody::S8Type(lifted2684) } 3 => { - let lifted2689 : @types.NumericRestrictions? = match + let lifted2691 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2684 : @types.NumericBound? = match + let lifted2686 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2683 = match + let lifted2685 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25237,16 +25299,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2683) + Option::Some(lifted2685) } _ => panic() } - let lifted2686 : @types.NumericBound? = match + let lifted2688 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2685 = match + let lifted2687 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25263,46 +25325,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2685) + Option::Some(lifted2687) } _ => panic() } - let lifted2688 : String? = match + let lifted2690 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2687 = mbt_ffi_ptr2str( + let result2689 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2687) + Option::Some(result2689) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2684, - max: lifted2686, - unit: lifted2688, + min: lifted2686, + max: lifted2688, + unit: lifted2690, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted2689) + @types.SchemaTypeBody::S16Type(lifted2691) } 4 => { - let lifted2696 : @types.NumericRestrictions? = match + let lifted2698 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2691 : @types.NumericBound? = match + let lifted2693 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2690 = match + let lifted2692 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25319,16 +25381,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2690) + Option::Some(lifted2692) } _ => panic() } - let lifted2693 : @types.NumericBound? = match + let lifted2695 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2692 = match + let lifted2694 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25345,46 +25407,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2692) + Option::Some(lifted2694) } _ => panic() } - let lifted2695 : String? = match + let lifted2697 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2694 = mbt_ffi_ptr2str( + let result2696 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2694) + Option::Some(result2696) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2691, - max: lifted2693, - unit: lifted2695, + min: lifted2693, + max: lifted2695, + unit: lifted2697, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted2696) + @types.SchemaTypeBody::S32Type(lifted2698) } 5 => { - let lifted2703 : @types.NumericRestrictions? = match + let lifted2705 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2698 : @types.NumericBound? = match + let lifted2700 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2697 = match + let lifted2699 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25401,16 +25463,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2697) + Option::Some(lifted2699) } _ => panic() } - let lifted2700 : @types.NumericBound? = match + let lifted2702 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2699 = match + let lifted2701 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25427,46 +25489,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2699) + Option::Some(lifted2701) } _ => panic() } - let lifted2702 : String? = match + let lifted2704 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2701 = mbt_ffi_ptr2str( + let result2703 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2701) + Option::Some(result2703) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2698, - max: lifted2700, - unit: lifted2702, + min: lifted2700, + max: lifted2702, + unit: lifted2704, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted2703) + @types.SchemaTypeBody::S64Type(lifted2705) } 6 => { - let lifted2710 : @types.NumericRestrictions? = match + let lifted2712 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2705 : @types.NumericBound? = match + let lifted2707 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2704 = match + let lifted2706 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25483,16 +25545,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2704) + Option::Some(lifted2706) } _ => panic() } - let lifted2707 : @types.NumericBound? = match + let lifted2709 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2706 = match + let lifted2708 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25509,46 +25571,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2706) + Option::Some(lifted2708) } _ => panic() } - let lifted2709 : String? = match + let lifted2711 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2708 = mbt_ffi_ptr2str( + let result2710 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2708) + Option::Some(result2710) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2705, - max: lifted2707, - unit: lifted2709, + min: lifted2707, + max: lifted2709, + unit: lifted2711, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted2710) + @types.SchemaTypeBody::U8Type(lifted2712) } 7 => { - let lifted2717 : @types.NumericRestrictions? = match + let lifted2719 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2712 : @types.NumericBound? = match + let lifted2714 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2711 = match + let lifted2713 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25565,16 +25627,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2711) + Option::Some(lifted2713) } _ => panic() } - let lifted2714 : @types.NumericBound? = match + let lifted2716 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2713 = match + let lifted2715 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25591,46 +25653,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2713) + Option::Some(lifted2715) } _ => panic() } - let lifted2716 : String? = match + let lifted2718 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2715 = mbt_ffi_ptr2str( + let result2717 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2715) + Option::Some(result2717) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2712, - max: lifted2714, - unit: lifted2716, + min: lifted2714, + max: lifted2716, + unit: lifted2718, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted2717) + @types.SchemaTypeBody::U16Type(lifted2719) } 8 => { - let lifted2724 : @types.NumericRestrictions? = match + let lifted2726 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2719 : @types.NumericBound? = match + let lifted2721 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2718 = match + let lifted2720 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25647,16 +25709,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2718) + Option::Some(lifted2720) } _ => panic() } - let lifted2721 : @types.NumericBound? = match + let lifted2723 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2720 = match + let lifted2722 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25673,46 +25735,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2720) + Option::Some(lifted2722) } _ => panic() } - let lifted2723 : String? = match + let lifted2725 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2722 = mbt_ffi_ptr2str( + let result2724 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2722) + Option::Some(result2724) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2719, - max: lifted2721, - unit: lifted2723, + min: lifted2721, + max: lifted2723, + unit: lifted2725, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted2724) + @types.SchemaTypeBody::U32Type(lifted2726) } 9 => { - let lifted2731 : @types.NumericRestrictions? = match + let lifted2733 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2726 : @types.NumericBound? = match + let lifted2728 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2725 = match + let lifted2727 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25729,16 +25791,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2725) + Option::Some(lifted2727) } _ => panic() } - let lifted2728 : @types.NumericBound? = match + let lifted2730 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2727 = match + let lifted2729 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25755,46 +25817,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2727) + Option::Some(lifted2729) } _ => panic() } - let lifted2730 : String? = match + let lifted2732 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2729 = mbt_ffi_ptr2str( + let result2731 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2729) + Option::Some(result2731) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2726, - max: lifted2728, - unit: lifted2730, + min: lifted2728, + max: lifted2730, + unit: lifted2732, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted2731) + @types.SchemaTypeBody::U64Type(lifted2733) } 10 => { - let lifted2738 : @types.NumericRestrictions? = match + let lifted2740 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2733 : @types.NumericBound? = match + let lifted2735 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2732 = match + let lifted2734 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25811,16 +25873,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2732) + Option::Some(lifted2734) } _ => panic() } - let lifted2735 : @types.NumericBound? = match + let lifted2737 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2734 = match + let lifted2736 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25837,46 +25899,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2734) + Option::Some(lifted2736) } _ => panic() } - let lifted2737 : String? = match + let lifted2739 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2736 = mbt_ffi_ptr2str( + let result2738 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2736) + Option::Some(result2738) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2733, - max: lifted2735, - unit: lifted2737, + min: lifted2735, + max: lifted2737, + unit: lifted2739, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted2738) + @types.SchemaTypeBody::F32Type(lifted2740) } 11 => { - let lifted2745 : @types.NumericRestrictions? = match + let lifted2747 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted2740 : @types.NumericBound? = match + let lifted2742 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted2739 = match + let lifted2741 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -25893,16 +25955,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2739) + Option::Some(lifted2741) } _ => panic() } - let lifted2742 : @types.NumericBound? = match + let lifted2744 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted2741 = match + let lifted2743 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -25919,324 +25981,324 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted2741) + Option::Some(lifted2743) } _ => panic() } - let lifted2744 : String? = match + let lifted2746 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2743 = mbt_ffi_ptr2str( + let result2745 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2743) + Option::Some(result2745) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted2740, - max: lifted2742, - unit: lifted2744, + min: lifted2742, + max: lifted2744, + unit: lifted2746, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted2745) + @types.SchemaTypeBody::F64Type(lifted2747) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array2760 : Array[@types.NamedFieldType] = [] - for index2761 = 0 - index2761 < mbt_ffi_load32(iter_base + 12) - index2761 = index2761 + 1 { + let array2762 : Array[@types.NamedFieldType] = [] + for index2763 = 0 + index2763 < mbt_ffi_load32(iter_base + 12) + index2763 = index2763 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2761 * 68 + index2763 * 68 - let result2746 = mbt_ffi_ptr2str( + let result2748 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2748 : String? = match + let lifted2750 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2747 = mbt_ffi_ptr2str( + let result2749 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2747) + Option::Some(result2749) } _ => panic() } - let array2750 : Array[String] = [] - for index2751 = 0 - index2751 < mbt_ffi_load32(iter_base + 28) - index2751 = index2751 + 1 { + let array2752 : Array[String] = [] + for index2753 = 0 + index2753 < mbt_ffi_load32(iter_base + 28) + index2753 = index2753 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2751 * 8 + index2753 * 8 - let result2749 = mbt_ffi_ptr2str( + let result2751 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2750.push(result2749) + array2752.push(result2751) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array2753 : Array[String] = [] - for index2754 = 0 - index2754 < mbt_ffi_load32(iter_base + 36) - index2754 = index2754 + 1 { + let array2755 : Array[String] = [] + for index2756 = 0 + index2756 < mbt_ffi_load32(iter_base + 36) + index2756 = index2756 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index2754 * 8 + index2756 * 8 - let result2752 = mbt_ffi_ptr2str( + let result2754 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2753.push(result2752) + array2755.push(result2754) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted2756 : String? = match + let lifted2758 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result2755 = mbt_ffi_ptr2str( + let result2757 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result2755) + Option::Some(result2757) } _ => panic() } - let lifted2759 : @types.Role? = match + let lifted2761 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted2758 = match + let lifted2760 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2757 = mbt_ffi_ptr2str( + let result2759 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result2757) + @types.Role::Other(result2759) } _ => panic() } - Option::Some(lifted2758) + Option::Some(lifted2760) } _ => panic() } - array2760.push(@types.NamedFieldType::{ - name: result2746, + array2762.push(@types.NamedFieldType::{ + name: result2748, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted2748, - aliases: array2750, - examples: array2753, - deprecated: lifted2756, - role: lifted2759, + doc: lifted2750, + aliases: array2752, + examples: array2755, + deprecated: lifted2758, + role: lifted2761, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array2760) + @types.SchemaTypeBody::RecordType(array2762) } 15 => { - let array2777 : Array[@types.VariantCaseType] = [] - for index2778 = 0 - index2778 < mbt_ffi_load32(iter_base + 12) - index2778 = index2778 + 1 { + let array2779 : Array[@types.VariantCaseType] = [] + for index2780 = 0 + index2780 < mbt_ffi_load32(iter_base + 12) + index2780 = index2780 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2778 * 72 + index2780 * 72 - let result2762 = mbt_ffi_ptr2str( + let result2764 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2763 : Int? = match + let lifted2765 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2765 : String? = match + let lifted2767 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2764 = mbt_ffi_ptr2str( + let result2766 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2764) + Option::Some(result2766) } _ => panic() } - let array2767 : Array[String] = [] - for index2768 = 0 - index2768 < mbt_ffi_load32(iter_base + 32) - index2768 = index2768 + 1 { + let array2769 : Array[String] = [] + for index2770 = 0 + index2770 < mbt_ffi_load32(iter_base + 32) + index2770 = index2770 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2768 * 8 + index2770 * 8 - let result2766 = mbt_ffi_ptr2str( + let result2768 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2767.push(result2766) + array2769.push(result2768) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array2770 : Array[String] = [] - for index2771 = 0 - index2771 < mbt_ffi_load32(iter_base + 40) - index2771 = index2771 + 1 { + let array2772 : Array[String] = [] + for index2773 = 0 + index2773 < mbt_ffi_load32(iter_base + 40) + index2773 = index2773 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index2771 * 8 + index2773 * 8 - let result2769 = mbt_ffi_ptr2str( + let result2771 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2770.push(result2769) + array2772.push(result2771) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted2773 : String? = match + let lifted2775 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2772 = mbt_ffi_ptr2str( + let result2774 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2772) + Option::Some(result2774) } _ => panic() } - let lifted2776 : @types.Role? = match + let lifted2778 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted2775 = match + let lifted2777 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2774 = mbt_ffi_ptr2str( + let result2776 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result2774) + @types.Role::Other(result2776) } _ => panic() } - Option::Some(lifted2775) + Option::Some(lifted2777) } _ => panic() } - array2777.push(@types.VariantCaseType::{ - name: result2762, - payload: lifted2763, + array2779.push(@types.VariantCaseType::{ + name: result2764, + payload: lifted2765, metadata: @types.MetadataEnvelope::{ - doc: lifted2765, - aliases: array2767, - examples: array2770, - deprecated: lifted2773, - role: lifted2776, + doc: lifted2767, + aliases: array2769, + examples: array2772, + deprecated: lifted2775, + role: lifted2778, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array2777) + @types.SchemaTypeBody::VariantType(array2779) } 16 => { - let array2780 : Array[String] = [] - for index2781 = 0 - index2781 < mbt_ffi_load32(iter_base + 12) - index2781 = index2781 + 1 { + let array2782 : Array[String] = [] + for index2783 = 0 + index2783 < mbt_ffi_load32(iter_base + 12) + index2783 = index2783 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2781 * 8 + index2783 * 8 - let result2779 = mbt_ffi_ptr2str( + let result2781 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2780.push(result2779) + array2782.push(result2781) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array2780) + @types.SchemaTypeBody::EnumType(array2782) } 17 => { - let array2783 : Array[String] = [] - for index2784 = 0 - index2784 < mbt_ffi_load32(iter_base + 12) - index2784 = index2784 + 1 { + let array2785 : Array[String] = [] + for index2786 = 0 + index2786 < mbt_ffi_load32(iter_base + 12) + index2786 = index2786 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2784 * 8 + index2786 * 8 - let result2782 = mbt_ffi_ptr2str( + let result2784 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2783.push(result2782) + array2785.push(result2784) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array2783) + @types.SchemaTypeBody::FlagsType(array2785) } 18 => { - let array2785 : Array[Int] = [] - for index2786 = 0 - index2786 < mbt_ffi_load32(iter_base + 12) - index2786 = index2786 + 1 { + let array2787 : Array[Int] = [] + for index2788 = 0 + index2788 < mbt_ffi_load32(iter_base + 12) + index2788 = index2788 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2786 * 4 + index2788 * 4 - array2785.push(mbt_ffi_load32(iter_base + 0)) + array2787.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array2785) + @types.SchemaTypeBody::TupleType(array2787) } 19 => @types.SchemaTypeBody::ListType( @@ -26257,14 +26319,14 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted2787 : Int? = match + let lifted2789 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted2788 : Int? = match + let lifted2790 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -26272,37 +26334,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted2787, - err: lifted2788, + ok: lifted2789, + err: lifted2790, }) } 24 => { - let lifted2792 : Array[String]? = match + let lifted2794 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2790 : Array[String] = [] - for index2791 = 0 - index2791 < mbt_ffi_load32(iter_base + 16) - index2791 = index2791 + 1 { + let array2792 : Array[String] = [] + for index2793 = 0 + index2793 < mbt_ffi_load32(iter_base + 16) + index2793 = index2793 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2791 * 8 + index2793 * 8 - let result2789 = mbt_ffi_ptr2str( + let result2791 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2790.push(result2789) + array2792.push(result2791) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2790) + Option::Some(array2792) } _ => panic() } - let lifted2793 : UInt? = match + let lifted2795 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -26312,7 +26374,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2794 : UInt? = match + let lifted2796 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -26322,54 +26384,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2796 : String? = match + let lifted2798 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2795 = mbt_ffi_ptr2str( + let result2797 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2795) + Option::Some(result2797) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted2792, - min_length: lifted2793, - max_length: lifted2794, - regex: lifted2796, + languages: lifted2794, + min_length: lifted2795, + max_length: lifted2796, + regex: lifted2798, }) } 25 => { - let lifted2800 : Array[String]? = match + let lifted2802 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2798 : Array[String] = [] - for index2799 = 0 - index2799 < mbt_ffi_load32(iter_base + 16) - index2799 = index2799 + 1 { + let array2800 : Array[String] = [] + for index2801 = 0 + index2801 < mbt_ffi_load32(iter_base + 16) + index2801 = index2801 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2799 * 8 + index2801 * 8 - let result2797 = mbt_ffi_ptr2str( + let result2799 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2798.push(result2797) + array2800.push(result2799) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2798) + Option::Some(array2800) } _ => panic() } - let lifted2801 : UInt? = match + let lifted2803 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -26379,7 +26441,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted2802 : UInt? = match + let lifted2804 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -26390,58 +26452,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted2800, - min_bytes: lifted2801, - max_bytes: lifted2802, + mime_types: lifted2802, + min_bytes: lifted2803, + max_bytes: lifted2804, }) } 26 => { - let lifted2806 : Array[String]? = match + let lifted2808 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array2804 : Array[String] = [] - for index2805 = 0 - index2805 < mbt_ffi_load32(iter_base + 20) - index2805 = index2805 + 1 { + let array2806 : Array[String] = [] + for index2807 = 0 + index2807 < mbt_ffi_load32(iter_base + 20) + index2807 = index2807 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2805 * 8 + index2807 * 8 - let result2803 = mbt_ffi_ptr2str( + let result2805 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2804.push(result2803) + array2806.push(result2805) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array2804) + Option::Some(array2806) } _ => panic() } - let lifted2810 : Array[String]? = match + let lifted2812 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array2808 : Array[String] = [] - for index2809 = 0 - index2809 < mbt_ffi_load32(iter_base + 32) - index2809 = index2809 + 1 { + let array2810 : Array[String] = [] + for index2811 = 0 + index2811 < mbt_ffi_load32(iter_base + 32) + index2811 = index2811 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index2809 * 8 + index2811 * 8 - let result2807 = mbt_ffi_ptr2str( + let result2809 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2808.push(result2807) + array2810.push(result2809) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array2808) + Option::Some(array2810) } _ => panic() } @@ -26453,95 +26515,95 @@ pub fn enrich_oplog_entries( kind: @types.PathKind::from( mbt_ffi_load8_u(iter_base + 9), ), - allowed_mime_types: lifted2806, - allowed_extensions: lifted2810, + allowed_mime_types: lifted2808, + allowed_extensions: lifted2812, }) } 27 => { - let lifted2814 : Array[String]? = match + let lifted2816 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array2812 : Array[String] = [] - for index2813 = 0 - index2813 < mbt_ffi_load32(iter_base + 16) - index2813 = index2813 + 1 { + let array2814 : Array[String] = [] + for index2815 = 0 + index2815 < mbt_ffi_load32(iter_base + 16) + index2815 = index2815 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index2813 * 8 + index2815 * 8 - let result2811 = mbt_ffi_ptr2str( + let result2813 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2812.push(result2811) + array2814.push(result2813) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array2812) + Option::Some(array2814) } _ => panic() } - let lifted2818 : Array[String]? = match + let lifted2820 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array2816 : Array[String] = [] - for index2817 = 0 - index2817 < mbt_ffi_load32(iter_base + 28) - index2817 = index2817 + 1 { + let array2818 : Array[String] = [] + for index2819 = 0 + index2819 < mbt_ffi_load32(iter_base + 28) + index2819 = index2819 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index2817 * 8 + index2819 * 8 - let result2815 = mbt_ffi_ptr2str( + let result2817 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2816.push(result2815) + array2818.push(result2817) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array2816) + Option::Some(array2818) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted2814, - allowed_hosts: lifted2818, + allowed_schemes: lifted2816, + allowed_hosts: lifted2820, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result2819 = mbt_ffi_ptr2str( + let result2821 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array2821 : Array[String] = [] - for index2822 = 0 - index2822 < mbt_ffi_load32(iter_base + 20) - index2822 = index2822 + 1 { + let array2823 : Array[String] = [] + for index2824 = 0 + index2824 < mbt_ffi_load32(iter_base + 20) + index2824 = index2824 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index2822 * 8 + index2824 * 8 - let result2820 = mbt_ffi_ptr2str( + let result2822 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2821.push(result2820) + array2823.push(result2822) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted2824 : @types.QuantityValue? = match + let lifted2826 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2823 = mbt_ffi_ptr2str( + let result2825 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -26549,17 +26611,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result2823, + unit: result2825, }) } _ => panic() } - let lifted2826 : @types.QuantityValue? = match + let lifted2828 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result2825 = mbt_ffi_ptr2str( + let result2827 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -26567,406 +26629,406 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result2825, + unit: result2827, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result2819, - allowed_suffixes: array2821, - min: lifted2824, - max: lifted2826, + base_unit: result2821, + allowed_suffixes: array2823, + min: lifted2826, + max: lifted2828, }) } 31 => { - let array2850 : Array[@types.UnionBranch] = [] - for index2851 = 0 - index2851 < mbt_ffi_load32(iter_base + 12) - index2851 = index2851 + 1 { + let array2852 : Array[@types.UnionBranch] = [] + for index2853 = 0 + index2853 < mbt_ffi_load32(iter_base + 12) + index2853 = index2853 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2851 * 92 + index2853 * 92 - let result2827 = mbt_ffi_ptr2str( + let result2829 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2836 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted2838 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result2828 = mbt_ffi_ptr2str( + let result2830 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result2828) + @types.DiscriminatorRule::Prefix(result2830) } 1 => { - let result2829 = mbt_ffi_ptr2str( + let result2831 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result2829) + @types.DiscriminatorRule::Suffix(result2831) } 2 => { - let result2830 = mbt_ffi_ptr2str( + let result2832 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result2830) + @types.DiscriminatorRule::Contains(result2832) } 3 => { - let result2831 = mbt_ffi_ptr2str( + let result2833 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result2831) + @types.DiscriminatorRule::Regex(result2833) } 4 => { - let result2832 = mbt_ffi_ptr2str( + let result2834 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted2834 : String? = match + let lifted2836 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result2833 = mbt_ffi_ptr2str( + let result2835 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result2833) + Option::Some(result2835) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result2832, - literal: lifted2834, + field_name: result2834, + literal: lifted2836, }) } 5 => { - let result2835 = mbt_ffi_ptr2str( + let result2837 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result2835) + @types.DiscriminatorRule::FieldAbsent(result2837) } _ => panic() } - let lifted2838 : String? = match + let lifted2840 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result2837 = mbt_ffi_ptr2str( + let result2839 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result2837) + Option::Some(result2839) } _ => panic() } - let array2840 : Array[String] = [] - for index2841 = 0 - index2841 < mbt_ffi_load32(iter_base + 52) - index2841 = index2841 + 1 { + let array2842 : Array[String] = [] + for index2843 = 0 + index2843 < mbt_ffi_load32(iter_base + 52) + index2843 = index2843 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index2841 * 8 + index2843 * 8 - let result2839 = mbt_ffi_ptr2str( + let result2841 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2840.push(result2839) + array2842.push(result2841) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2843 : Array[String] = [] - for index2844 = 0 - index2844 < mbt_ffi_load32(iter_base + 60) - index2844 = index2844 + 1 { + let array2845 : Array[String] = [] + for index2846 = 0 + index2846 < mbt_ffi_load32(iter_base + 60) + index2846 = index2846 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2844 * 8 + index2846 * 8 - let result2842 = mbt_ffi_ptr2str( + let result2844 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2843.push(result2842) + array2845.push(result2844) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted2846 : String? = match + let lifted2848 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result2845 = mbt_ffi_ptr2str( + let result2847 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result2845) + Option::Some(result2847) } _ => panic() } - let lifted2849 : @types.Role? = match + let lifted2851 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted2848 = match + let lifted2850 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2847 = mbt_ffi_ptr2str( + let result2849 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result2847) + @types.Role::Other(result2849) } _ => panic() } - Option::Some(lifted2848) + Option::Some(lifted2850) } _ => panic() } - array2850.push(@types.UnionBranch::{ - tag: result2827, + array2852.push(@types.UnionBranch::{ + tag: result2829, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted2836, + discriminator: lifted2838, metadata: @types.MetadataEnvelope::{ - doc: lifted2838, - aliases: array2840, - examples: array2843, - deprecated: lifted2846, - role: lifted2849, + doc: lifted2840, + aliases: array2842, + examples: array2845, + deprecated: lifted2848, + role: lifted2851, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array2850, + branches: array2852, }) } 32 => { - let lifted2853 : String? = match + let lifted2855 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result2852 = mbt_ffi_ptr2str( + let result2854 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result2852) + Option::Some(result2854) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted2853, + category: lifted2855, }) } 33 => { - let lifted2855 : String? = match + let lifted2857 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2854 = mbt_ffi_ptr2str( + let result2856 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2854) + Option::Some(result2856) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted2855, + resource_name: lifted2857, }) } 34 => { - let lifted2856 : Int? = match + let lifted2858 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted2856) + @types.SchemaTypeBody::FutureType(lifted2858) } 35 => { - let lifted2857 : Int? = match + let lifted2859 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted2857) + @types.SchemaTypeBody::StreamType(lifted2859) } _ => panic() } - let lifted2860 : String? = match + let lifted2862 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result2859 = mbt_ffi_ptr2str( + let result2861 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result2859) + Option::Some(result2861) } _ => panic() } - let array2862 : Array[String] = [] - for index2863 = 0 - index2863 < mbt_ffi_load32(iter_base + 104) - index2863 = index2863 + 1 { + let array2864 : Array[String] = [] + for index2865 = 0 + index2865 < mbt_ffi_load32(iter_base + 104) + index2865 = index2865 + 1 { let iter_base = mbt_ffi_load32(iter_base + 100) + - index2863 * 8 + index2865 * 8 - let result2861 = mbt_ffi_ptr2str( + let result2863 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2862.push(result2861) + array2864.push(result2863) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array2865 : Array[String] = [] - for index2866 = 0 - index2866 < mbt_ffi_load32(iter_base + 112) - index2866 = index2866 + 1 { + let array2867 : Array[String] = [] + for index2868 = 0 + index2868 < mbt_ffi_load32(iter_base + 112) + index2868 = index2868 + 1 { let iter_base = mbt_ffi_load32(iter_base + 108) + - index2866 * 8 + index2868 * 8 - let result2864 = mbt_ffi_ptr2str( + let result2866 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2865.push(result2864) + array2867.push(result2866) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted2868 : String? = match + let lifted2870 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result2867 = mbt_ffi_ptr2str( + let result2869 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result2867) + Option::Some(result2869) } _ => panic() } - let lifted2871 : @types.Role? = match + let lifted2873 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted2870 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted2872 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result2869 = mbt_ffi_ptr2str( + let result2871 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result2869) + @types.Role::Other(result2871) } _ => panic() } - Option::Some(lifted2870) + Option::Some(lifted2872) } _ => panic() } - array2872.push(@types.SchemaTypeNode::{ - body: lifted2858, + array2874.push(@types.SchemaTypeNode::{ + body: lifted2860, metadata: @types.MetadataEnvelope::{ - doc: lifted2860, - aliases: array2862, - examples: array2865, - deprecated: lifted2868, - role: lifted2871, + doc: lifted2862, + aliases: array2864, + examples: array2867, + deprecated: lifted2870, + role: lifted2873, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array2877 : Array[@types.SchemaTypeDef] = [] - for index2878 = 0 - index2878 < mbt_ffi_load32(iter_base + 60) - index2878 = index2878 + 1 { + let array2879 : Array[@types.SchemaTypeDef] = [] + for index2880 = 0 + index2880 < mbt_ffi_load32(iter_base + 60) + index2880 = index2880 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index2878 * 24 + index2880 * 24 - let result2874 = mbt_ffi_ptr2str( + let result2876 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2876 : String? = match + let lifted2878 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result2875 = mbt_ffi_ptr2str( + let result2877 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result2875) + Option::Some(result2877) } _ => panic() } - array2877.push(@types.SchemaTypeDef::{ - id: result2874, - name: lifted2876, + array2879.push(@types.SchemaTypeDef::{ + id: result2876, + name: lifted2878, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let array2908 : Array[@types.SchemaValueNode] = [] - for index2909 = 0 - index2909 < mbt_ffi_load32(iter_base + 72) - index2909 = index2909 + 1 { + let array2910 : Array[@types.SchemaValueNode] = [] + for index2911 = 0 + index2911 < mbt_ffi_load32(iter_base + 72) + index2911 = index2911 + 1 { let iter_base = mbt_ffi_load32(iter_base + 68) + - index2909 * 32 + index2911 * 32 - let lifted2907 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2909 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -27018,29 +27080,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result2879 = mbt_ffi_ptr2str( + let result2881 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result2879) + @types.SchemaValueNode::StringValue(result2881) } 13 => { - let array2880 : Array[Int] = [] - for index2881 = 0 - index2881 < mbt_ffi_load32(iter_base + 12) - index2881 = index2881 + 1 { + let array2882 : Array[Int] = [] + for index2883 = 0 + index2883 < mbt_ffi_load32(iter_base + 12) + index2883 = index2883 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2881 * 4 + index2883 * 4 - array2880.push(mbt_ffi_load32(iter_base + 0)) + array2882.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array2880) + @types.SchemaValueNode::RecordValue(array2882) } 14 => { - let lifted2882 : Int? = match + let lifted2884 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -27049,7 +27111,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted2882, + payload: lifted2884, }) } 15 => @@ -27057,34 +27119,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array2883 : Array[Bool] = [] - for index2884 = 0 - index2884 < mbt_ffi_load32(iter_base + 12) - index2884 = index2884 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index2884 * 1 - - array2883.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array2883) - } - 17 => { - let array2885 : Array[Int] = [] + let array2885 : Array[Bool] = [] for index2886 = 0 index2886 < mbt_ffi_load32(iter_base + 12) index2886 = index2886 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2886 * 4 + index2886 * 1 - array2885.push(mbt_ffi_load32(iter_base + 0)) + array2885.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array2885) + @types.SchemaValueNode::FlagsValue(array2885) } - 18 => { + 17 => { let array2887 : Array[Int] = [] for index2888 = 0 index2888 < mbt_ffi_load32(iter_base + 12) @@ -27096,9 +27144,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array2887) + @types.SchemaValueNode::TupleValue(array2887) } - 19 => { + 18 => { let array2889 : Array[Int] = [] for index2890 = 0 index2890 < mbt_ffi_load32(iter_base + 12) @@ -27110,127 +27158,141 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array2889) + @types.SchemaValueNode::ListValue(array2889) } - 20 => { - let array2891 : Array[@types.MapEntry] = [] + 19 => { + let array2891 : Array[Int] = [] for index2892 = 0 index2892 < mbt_ffi_load32(iter_base + 12) index2892 = index2892 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index2892 * 8 + index2892 * 4 - array2891.push(@types.MapEntry::{ + array2891.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array2891) + } + 20 => { + let array2893 : Array[@types.MapEntry] = [] + for index2894 = 0 + index2894 < mbt_ffi_load32(iter_base + 12) + index2894 = index2894 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index2894 * 8 + + array2893.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array2891) + @types.SchemaValueNode::MapValue(array2893) } 21 => { - let lifted2893 : Int? = match + let lifted2895 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted2893) + @types.SchemaValueNode::OptionValue(lifted2895) } 22 => { - let lifted2896 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2898 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted2894 : Int? = match + let lifted2896 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted2894) + @types.ResultValuePayload::OkValue(lifted2896) } 1 => { - let lifted2895 : Int? = match + let lifted2897 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted2895) + @types.ResultValuePayload::ErrValue(lifted2897) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted2896) + @types.SchemaValueNode::ResultValue(lifted2898) } 23 => { - let result2897 = mbt_ffi_ptr2str( + let result2899 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2899 : String? = match + let lifted2901 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2898 = mbt_ffi_ptr2str( + let result2900 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2898) + Option::Some(result2900) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result2897, - language: lifted2899, + text: result2899, + language: lifted2901, }) } 24 => { - let result2900 = mbt_ffi_ptr2bytes( + let result2902 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2902 : String? = match + let lifted2904 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result2901 = mbt_ffi_ptr2str( + let result2903 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result2901) + Option::Some(result2903) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result2900, - mime_type: lifted2902, + bytes: result2902, + mime_type: lifted2904, }) } 25 => { - let result2903 = mbt_ffi_ptr2str( + let result2905 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result2903) + @types.SchemaValueNode::PathValue(result2905) } 26 => { - let result2904 = mbt_ffi_ptr2str( + let result2906 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result2904) + @types.SchemaValueNode::UrlValue(result2906) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -27242,7 +27304,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result2905 = mbt_ffi_ptr2str( + let result2907 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -27250,17 +27312,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result2905, + unit: result2907, }) } 30 => { - let result2906 = mbt_ffi_ptr2str( + let result2908 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result2906, + tag: result2908, body: mbt_ffi_load32(iter_base + 16), }) } @@ -27274,68 +27336,74 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array2908.push(lifted2907) + array2910.push(lifted2909) } mbt_ffi_free(mbt_ffi_load32(iter_base + 68)) - let result2910 = mbt_ffi_ptr2str( + let result2912 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 80), mbt_ffi_load32(iter_base + 84), ) - let array2912 : Array[String] = [] - for index2913 = 0 - index2913 < mbt_ffi_load32(iter_base + 92) - index2913 = index2913 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 88) + index2913 * 8 + let array2914 : Array[String] = [] + for index2915 = 0 + index2915 < mbt_ffi_load32(iter_base + 92) + index2915 = index2915 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 88) + index2915 * 8 - let result2911 = mbt_ffi_ptr2str( + let result2913 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array2912.push(result2911) + array2914.push(result2913) } mbt_ffi_free(mbt_ffi_load32(iter_base + 88)) - let array2927 : Array[Array[SpanData]] = [] - for index2928 = 0 - index2928 < mbt_ffi_load32(iter_base + 100) - index2928 = index2928 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 96) + index2928 * 8 + let array2929 : Array[Array[SpanData]] = [] + for index2930 = 0 + index2930 < mbt_ffi_load32(iter_base + 100) + index2930 = index2930 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 96) + index2930 * 8 - let array2925 : Array[SpanData] = [] - for index2926 = 0 - index2926 < mbt_ffi_load32(iter_base + 4) - index2926 = index2926 + 1 { + let array2927 : Array[SpanData] = [] + for index2928 = 0 + index2928 < mbt_ffi_load32(iter_base + 4) + index2928 = index2928 + 1 { let iter_base = mbt_ffi_load32(iter_base + 0) + - index2926 * 80 + index2928 * 80 - let lifted2924 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted2926 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result2914 = mbt_ffi_ptr2str( + let result2916 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2916 : String? = match + let lifted2918 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result2915 = mbt_ffi_ptr2str( + let result2917 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result2915) + Option::Some(result2917) } _ => panic() } - let lifted2917 : UInt64? = match + let lifted2919 : UInt64? = match mbt_ffi_load8_u(iter_base + 48) { 0 => Option::None 1 => @@ -27345,117 +27413,117 @@ pub fn enrich_oplog_entries( _ => panic() } - let array2921 : Array[@context.Attribute] = [] - for index2922 = 0 - index2922 < mbt_ffi_load32(iter_base + 68) - index2922 = index2922 + 1 { + let array2923 : Array[@context.Attribute] = [] + for index2924 = 0 + index2924 < mbt_ffi_load32(iter_base + 68) + index2924 = index2924 + 1 { let iter_base = mbt_ffi_load32(iter_base + 64) + - index2922 * 20 + index2924 * 20 - let result2918 = mbt_ffi_ptr2str( + let result2920 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2920 = match + let lifted2922 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result2919 = mbt_ffi_ptr2str( + let result2921 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result2919) + @context.AttributeValue::String(result2921) } _ => panic() } - array2921.push(@context.Attribute::{ - key: result2918, - value: lifted2920, + array2923.push(@context.Attribute::{ + key: result2920, + value: lifted2922, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 64)) SpanData::LocalSpan(LocalSpanData::{ - span_id: result2914, + span_id: result2916, start: @system-clock.Instant::{ seconds: mbt_ffi_load64(iter_base + 16), nanoseconds: mbt_ffi_load32(iter_base + 24).reinterpret_as_uint(), }, - parent: lifted2916, - linked_context: lifted2917, - attributes: array2921, + parent: lifted2918, + linked_context: lifted2919, + attributes: array2923, inherited: mbt_ffi_load8_u(iter_base + 72) != 0, }) } 1 => { - let result2923 = mbt_ffi_ptr2str( + let result2925 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) SpanData::ExternalSpan(ExternalSpanData::{ - span_id: result2923, + span_id: result2925, }) } _ => panic() } - array2925.push(lifted2924) + array2927.push(lifted2926) } mbt_ffi_free(mbt_ffi_load32(iter_base + 0)) - array2927.push(array2925) + array2929.push(array2927) } mbt_ffi_free(mbt_ffi_load32(iter_base + 96)) AgentInvocation::AgentMethodInvocation(AgentMethodInvocationParameters::{ - idempotency_key: result2674, - method_name: result2675, + idempotency_key: result2676, + method_name: result2677, function_input: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array2872, - defs: array2877, + type_nodes: array2874, + defs: array2879, root: mbt_ffi_load32(iter_base + 64), }, value: @types.SchemaValueTree::{ - value_nodes: array2908, + value_nodes: array2910, root: mbt_ffi_load32(iter_base + 76), }, }, - trace_id: result2910, - trace_states: array2912, - invocation_context: array2927, + trace_id: result2912, + trace_states: array2914, + invocation_context: array2929, }) } 2 => AgentInvocation::SaveSnapshot 3 => { - let result2929 = mbt_ffi_ptr2bytes( + let result2931 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result2930 = mbt_ffi_ptr2str( + let result2932 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) AgentInvocation::LoadSnapshot(LoadSnapshotParameters::{ snapshot: SnapshotData::{ - data: result2929, - mime_type: result2930, + data: result2931, + mime_type: result2932, }, }) } 4 => { - let result2931 = mbt_ffi_ptr2str( + let result2933 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) AgentInvocation::ProcessOplogEntries(ProcessOplogEntriesParameters::{ - idempotency_key: result2931, + idempotency_key: result2933, }) } 5 => @@ -27470,26 +27538,26 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - invocation: lifted2932, + invocation: lifted2934, }) } 15 => { - let lifted2935 = match mbt_ffi_load8_u(iter_base + 32) { + let lifted2937 = match mbt_ffi_load8_u(iter_base + 32) { 0 => UpdateDescription::AutoUpdate 1 => { - let result2933 = mbt_ffi_ptr2bytes( + let result2935 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - let result2934 = mbt_ffi_ptr2str( + let result2936 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) UpdateDescription::SnapshotBased(@host.Snapshot::{ - payload: result2933, - mime_type: result2934, + payload: result2935, + mime_type: result2936, }) } _ => panic() @@ -27501,47 +27569,47 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, target_revision: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - description: lifted2935, + description: lifted2937, }) } 16 => { - let array2942 : Array[PluginInstallationDescription] = [] - for index2943 = 0 - index2943 < mbt_ffi_load32(iter_base + 44) - index2943 = index2943 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 40) + index2943 * 48 + let array2944 : Array[PluginInstallationDescription] = [] + for index2945 = 0 + index2945 < mbt_ffi_load32(iter_base + 44) + index2945 = index2945 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 40) + index2945 * 48 - let result2936 = mbt_ffi_ptr2str( + let result2938 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - let result2937 = mbt_ffi_ptr2str( + let result2939 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - let array2940 : Array[(String, String)] = [] - for index2941 = 0 - index2941 < mbt_ffi_load32(iter_base + 40) - index2941 = index2941 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index2941 * 16 + let array2942 : Array[(String, String)] = [] + for index2943 = 0 + index2943 < mbt_ffi_load32(iter_base + 40) + index2943 = index2943 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index2943 * 16 - let result2938 = mbt_ffi_ptr2str( + let result2940 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result2939 = mbt_ffi_ptr2str( + let result2941 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array2940.push((result2938, result2939)) + array2942.push((result2940, result2941)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - array2942.push(PluginInstallationDescription::{ + array2944.push(PluginInstallationDescription::{ environment_plugin_grant_id: EnvironmentPluginGrantId::{ uuid: @types.Uuid::{ high_bits: mbt_ffi_load64(iter_base + 0).reinterpret_as_uint64(), @@ -27549,9 +27617,9 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 16), - plugin_name: result2936, - plugin_version: result2937, - parameters: array2940, + plugin_name: result2938, + plugin_version: result2939, + parameters: array2942, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 40)) @@ -27563,19 +27631,19 @@ pub fn enrich_oplog_entries( }, target_revision: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), new_component_size: mbt_ffi_load64(iter_base + 32).reinterpret_as_uint64(), - new_active_plugins: array2942, + new_active_plugins: array2944, }) } 17 => { - let lifted2945 : String? = match mbt_ffi_load8_u(iter_base + 32) { + let lifted2947 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result2944 = mbt_ffi_ptr2str( + let result2946 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result2944) + Option::Some(result2946) } _ => panic() } @@ -27586,7 +27654,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, target_revision: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - details: lifted2945, + details: lifted2947, }) } 18 => @@ -27606,12 +27674,12 @@ pub fn enrich_oplog_entries( delta: mbt_ffi_load64(iter_base + 24), }) 20 => { - let result2946 = mbt_ffi_ptr2str( + let result2948 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result2947 = mbt_ffi_ptr2str( + let result2949 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) @@ -27622,17 +27690,17 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, id: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - name: result2946, - owner: result2947, + name: result2948, + owner: result2949, }) } 21 => { - let result2948 = mbt_ffi_ptr2str( + let result2950 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let result2949 = mbt_ffi_ptr2str( + let result2951 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) @@ -27643,17 +27711,17 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, id: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), - name: result2948, - owner: result2949, + name: result2950, + owner: result2951, }) } 22 => { - let result2950 = mbt_ffi_ptr2str( + let result2952 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - let result2951 = mbt_ffi_ptr2str( + let result2953 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) @@ -27664,8 +27732,8 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, level: LogLevel::from(mbt_ffi_load8_u(iter_base + 24)), - context: result2950, - message: result2951, + context: result2952, + message: result2953, }) } 23 => @@ -27676,33 +27744,33 @@ pub fn enrich_oplog_entries( }, }) 24 => { - let result2952 = mbt_ffi_ptr2str( + let result2954 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - let result2953 = mbt_ffi_ptr2str( + let result2955 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 52), mbt_ffi_load32(iter_base + 56), ) - let array2956 : Array[(String, String)] = [] - for index2957 = 0 - index2957 < mbt_ffi_load32(iter_base + 64) - index2957 = index2957 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 60) + index2957 * 16 + let array2958 : Array[(String, String)] = [] + for index2959 = 0 + index2959 < mbt_ffi_load32(iter_base + 64) + index2959 = index2959 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 60) + index2959 * 16 - let result2954 = mbt_ffi_ptr2str( + let result2956 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result2955 = mbt_ffi_ptr2str( + let result2957 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array2956.push((result2954, result2955)) + array2958.push((result2956, result2957)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) @@ -27719,40 +27787,40 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 40), - plugin_name: result2952, - plugin_version: result2953, - parameters: array2956, + plugin_name: result2954, + plugin_version: result2955, + parameters: array2958, }, }) } 25 => { - let result2958 = mbt_ffi_ptr2str( + let result2960 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - let result2959 = mbt_ffi_ptr2str( + let result2961 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 52), mbt_ffi_load32(iter_base + 56), ) - let array2962 : Array[(String, String)] = [] - for index2963 = 0 - index2963 < mbt_ffi_load32(iter_base + 64) - index2963 = index2963 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 60) + index2963 * 16 + let array2964 : Array[(String, String)] = [] + for index2965 = 0 + index2965 < mbt_ffi_load32(iter_base + 64) + index2965 = index2965 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 60) + index2965 * 16 - let result2960 = mbt_ffi_ptr2str( + let result2962 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result2961 = mbt_ffi_ptr2str( + let result2963 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array2962.push((result2960, result2961)) + array2964.push((result2962, result2963)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) @@ -27769,9 +27837,9 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 40), - plugin_name: result2958, - plugin_version: result2959, - parameters: array2962, + plugin_name: result2960, + plugin_version: result2961, + parameters: array2964, }, }) } @@ -27787,7 +27855,7 @@ pub fn enrich_oplog_entries( }, }) 27 => { - let result2964 = mbt_ffi_ptr2str( + let result2966 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) @@ -27797,67 +27865,67 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - idempotency_key: result2964, + idempotency_key: result2966, }) } 28 => { - let result2965 = mbt_ffi_ptr2str( + let result2967 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let lifted2967 : String? = match mbt_ffi_load8_u(iter_base + 32) { + let lifted2969 : String? = match mbt_ffi_load8_u(iter_base + 32) { 0 => Option::None 1 => { - let result2966 = mbt_ffi_ptr2str( + let result2968 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 36), mbt_ffi_load32(iter_base + 40), ) - Option::Some(result2966) + Option::Some(result2968) } _ => panic() } - let lifted2969 : String? = match mbt_ffi_load8_u(iter_base + 44) { + let lifted2971 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result2968 = mbt_ffi_ptr2str( + let result2970 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result2968) + Option::Some(result2970) } _ => panic() } - let array2973 : Array[@context.Attribute] = [] - for index2974 = 0 - index2974 < mbt_ffi_load32(iter_base + 60) - index2974 = index2974 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 56) + index2974 * 20 + let array2975 : Array[@context.Attribute] = [] + for index2976 = 0 + index2976 < mbt_ffi_load32(iter_base + 60) + index2976 = index2976 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 56) + index2976 * 20 - let result2970 = mbt_ffi_ptr2str( + let result2972 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted2972 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted2974 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let result2971 = mbt_ffi_ptr2str( + let result2973 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - @context.AttributeValue::String(result2971) + @context.AttributeValue::String(result2973) } _ => panic() } - array2973.push(@context.Attribute::{ - key: result2970, - value: lifted2972, + array2975.push(@context.Attribute::{ + key: result2972, + value: lifted2974, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) @@ -27867,14 +27935,14 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - span_id: result2965, - parent: lifted2967, - linked_context_id: lifted2969, - attributes: array2973, + span_id: result2967, + parent: lifted2969, + linked_context_id: lifted2971, + attributes: array2975, }) } 29 => { - let result2975 = mbt_ffi_ptr2str( + let result2977 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) @@ -27884,28 +27952,28 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - span_id: result2975, + span_id: result2977, }) } 30 => { - let result2976 = mbt_ffi_ptr2str( + let result2978 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let result2977 = mbt_ffi_ptr2str( + let result2979 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) - let lifted2979 = match mbt_ffi_load8_u(iter_base + 40) { + let lifted2981 = match mbt_ffi_load8_u(iter_base + 40) { 0 => { - let result2978 = mbt_ffi_ptr2str( + let result2980 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - @context.AttributeValue::String(result2978) + @context.AttributeValue::String(result2980) } _ => panic() } @@ -27915,13 +27983,13 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - span_id: result2976, - key: result2977, - value: lifted2979, + span_id: result2978, + key: result2979, + value: lifted2981, }) } 31 => { - let result2980 = mbt_ffi_ptr2str( + let result2982 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) @@ -27931,7 +27999,7 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - transaction_id: result2980, + transaction_id: result2982, }) } 32 => @@ -27967,12 +28035,12 @@ pub fn enrich_oplog_entries( begin_index: mbt_ffi_load64(iter_base + 24).reinterpret_as_uint64(), }) 36 => { - let result2981 = mbt_ffi_ptr2bytes( + let result2983 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let result2982 = mbt_ffi_ptr2str( + let result2984 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 32), mbt_ffi_load32(iter_base + 36), ) @@ -27982,41 +28050,41 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - data: SnapshotData::{ data: result2981, mime_type: result2982 }, + data: SnapshotData::{ data: result2983, mime_type: result2984 }, }) } 37 => { - let result2983 = mbt_ffi_ptr2str( + let result2985 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - let result2984 = mbt_ffi_ptr2str( + let result2986 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 52), mbt_ffi_load32(iter_base + 56), ) - let array2987 : Array[(String, String)] = [] - for index2988 = 0 - index2988 < mbt_ffi_load32(iter_base + 64) - index2988 = index2988 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 60) + index2988 * 16 + let array2989 : Array[(String, String)] = [] + for index2990 = 0 + index2990 < mbt_ffi_load32(iter_base + 64) + index2990 = index2990 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 60) + index2990 * 16 - let result2985 = mbt_ffi_ptr2str( + let result2987 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let result2986 = mbt_ffi_ptr2str( + let result2988 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - array2987.push((result2985, result2986)) + array2989.push((result2987, result2988)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 60)) - let result2989 = mbt_ffi_ptr2str( + let result2991 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 88), mbt_ffi_load32(iter_base + 92), ) @@ -28034,9 +28102,9 @@ pub fn enrich_oplog_entries( }, }, plugin_priority: mbt_ffi_load32(iter_base + 40), - plugin_name: result2983, - plugin_version: result2984, - parameters: array2987, + plugin_name: result2985, + plugin_version: result2986, + parameters: array2989, }, target_agent_id: @types.AgentId::{ component_id: @types.ComponentId::{ @@ -28045,7 +28113,7 @@ pub fn enrich_oplog_entries( low_bits: mbt_ffi_load64(iter_base + 80).reinterpret_as_uint64(), }, }, - agent_id: result2989, + agent_id: result2991, }, confirmed_up_to: mbt_ffi_load64(iter_base + 96).reinterpret_as_uint64(), sending_up_to: mbt_ffi_load64(iter_base + 104).reinterpret_as_uint64(), @@ -28053,32 +28121,32 @@ pub fn enrich_oplog_entries( }) } 38 => { - let result2990 = mbt_ffi_ptr2str( + let result2992 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - let array3022 : Array[@retry.PredicateNode] = [] - for index3023 = 0 - index3023 < mbt_ffi_load32(iter_base + 40) - index3023 = index3023 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index3023 * 32 + let array3024 : Array[@retry.PredicateNode] = [] + for index3025 = 0 + index3025 < mbt_ffi_load32(iter_base + 40) + index3025 = index3025 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index3025 * 32 - let lifted3021 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3023 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result2991 = mbt_ffi_ptr2str( + let result2993 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2993 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted2995 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result2992 = mbt_ffi_ptr2str( + let result2994 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result2992) + @retry.PredicateValue::Text(result2994) } 1 => @retry.PredicateValue::Integer( @@ -28092,24 +28160,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropEq(@retry.PropertyComparison::{ - property_name: result2991, - value: lifted2993, + property_name: result2993, + value: lifted2995, }) } 1 => { - let result2994 = mbt_ffi_ptr2str( + let result2996 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2996 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted2998 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result2995 = mbt_ffi_ptr2str( + let result2997 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result2995) + @retry.PredicateValue::Text(result2997) } 1 => @retry.PredicateValue::Integer( @@ -28123,24 +28191,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropNeq(@retry.PropertyComparison::{ - property_name: result2994, - value: lifted2996, + property_name: result2996, + value: lifted2998, }) } 2 => { - let result2997 = mbt_ffi_ptr2str( + let result2999 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted2999 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3001 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result2998 = mbt_ffi_ptr2str( + let result3000 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result2998) + @retry.PredicateValue::Text(result3000) } 1 => @retry.PredicateValue::Integer( @@ -28154,24 +28222,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropGt(@retry.PropertyComparison::{ - property_name: result2997, - value: lifted2999, + property_name: result2999, + value: lifted3001, }) } 3 => { - let result3000 = mbt_ffi_ptr2str( + let result3002 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3002 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3004 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3001 = mbt_ffi_ptr2str( + let result3003 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3001) + @retry.PredicateValue::Text(result3003) } 1 => @retry.PredicateValue::Integer( @@ -28185,24 +28253,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropGte(@retry.PropertyComparison::{ - property_name: result3000, - value: lifted3002, + property_name: result3002, + value: lifted3004, }) } 4 => { - let result3003 = mbt_ffi_ptr2str( + let result3005 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3005 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3007 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3004 = mbt_ffi_ptr2str( + let result3006 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3004) + @retry.PredicateValue::Text(result3006) } 1 => @retry.PredicateValue::Integer( @@ -28216,24 +28284,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropLt(@retry.PropertyComparison::{ - property_name: result3003, - value: lifted3005, + property_name: result3005, + value: lifted3007, }) } 5 => { - let result3006 = mbt_ffi_ptr2str( + let result3008 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3008 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3010 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3007 = mbt_ffi_ptr2str( + let result3009 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3007) + @retry.PredicateValue::Text(result3009) } 1 => @retry.PredicateValue::Integer( @@ -28247,39 +28315,39 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropLte(@retry.PropertyComparison::{ - property_name: result3006, - value: lifted3008, + property_name: result3008, + value: lifted3010, }) } 6 => { - let result3009 = mbt_ffi_ptr2str( + let result3011 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @retry.PredicateNode::PropExists(result3009) + @retry.PredicateNode::PropExists(result3011) } 7 => { - let result3010 = mbt_ffi_ptr2str( + let result3012 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array3013 : Array[@retry.PredicateValue] = [] - for index3014 = 0 - index3014 < mbt_ffi_load32(iter_base + 20) - index3014 = index3014 + 1 { + let array3015 : Array[@retry.PredicateValue] = [] + for index3016 = 0 + index3016 < mbt_ffi_load32(iter_base + 20) + index3016 = index3016 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index3014 * 16 + index3016 * 16 - let lifted3012 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3014 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result3011 = mbt_ffi_ptr2str( + let result3013 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @retry.PredicateValue::Text(result3011) + @retry.PredicateValue::Text(result3013) } 1 => @retry.PredicateValue::Integer( @@ -28292,61 +28360,61 @@ pub fn enrich_oplog_entries( _ => panic() } - array3013.push(lifted3012) + array3015.push(lifted3014) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) @retry.PredicateNode::PropIn(@retry.PropertySetCheck::{ - property_name: result3010, - values: array3013, + property_name: result3012, + values: array3015, }) } 8 => { - let result3015 = mbt_ffi_ptr2str( + let result3017 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3016 = mbt_ffi_ptr2str( + let result3018 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropMatches(@retry.PropertyPattern::{ - property_name: result3015, - pattern: result3016, + property_name: result3017, + pattern: result3018, }) } 9 => { - let result3017 = mbt_ffi_ptr2str( + let result3019 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3018 = mbt_ffi_ptr2str( + let result3020 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropStartsWith(@retry.PropertyPattern::{ - property_name: result3017, - pattern: result3018, + property_name: result3019, + pattern: result3020, }) } 10 => { - let result3019 = mbt_ffi_ptr2str( + let result3021 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3020 = mbt_ffi_ptr2str( + let result3022 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropContains(@retry.PropertyPattern::{ - property_name: result3019, - pattern: result3020, + property_name: result3021, + pattern: result3022, }) } 11 => @@ -28370,17 +28438,17 @@ pub fn enrich_oplog_entries( _ => panic() } - array3022.push(lifted3021) + array3024.push(lifted3023) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array3058 : Array[@retry.PolicyNode] = [] - for index3059 = 0 - index3059 < mbt_ffi_load32(iter_base + 48) - index3059 = index3059 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 44) + index3059 * 32 + let array3060 : Array[@retry.PolicyNode] = [] + for index3061 = 0 + index3061 < mbt_ffi_load32(iter_base + 48) + index3061 = index3061 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 44) + index3061 * 32 - let lifted3057 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3059 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @retry.PolicyNode::Periodic( mbt_ffi_load64(iter_base + 8).reinterpret_as_uint64(), @@ -28424,28 +28492,28 @@ pub fn enrich_oplog_entries( inner: mbt_ffi_load32(iter_base + 16), }) 10 => { - let array3055 : Array[@retry.PredicateNode] = [] - for index3056 = 0 - index3056 < mbt_ffi_load32(iter_base + 12) - index3056 = index3056 + 1 { + let array3057 : Array[@retry.PredicateNode] = [] + for index3058 = 0 + index3058 < mbt_ffi_load32(iter_base + 12) + index3058 = index3058 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3056 * 32 + index3058 * 32 - let lifted3054 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3056 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result3024 = mbt_ffi_ptr2str( + let result3026 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3026 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3028 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3025 = mbt_ffi_ptr2str( + let result3027 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3025) + @retry.PredicateValue::Text(result3027) } 1 => @retry.PredicateValue::Integer( @@ -28459,24 +28527,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropEq(@retry.PropertyComparison::{ - property_name: result3024, - value: lifted3026, + property_name: result3026, + value: lifted3028, }) } 1 => { - let result3027 = mbt_ffi_ptr2str( + let result3029 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3029 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3031 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3028 = mbt_ffi_ptr2str( + let result3030 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3028) + @retry.PredicateValue::Text(result3030) } 1 => @retry.PredicateValue::Integer( @@ -28490,24 +28558,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropNeq(@retry.PropertyComparison::{ - property_name: result3027, - value: lifted3029, + property_name: result3029, + value: lifted3031, }) } 2 => { - let result3030 = mbt_ffi_ptr2str( + let result3032 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3032 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3034 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3031 = mbt_ffi_ptr2str( + let result3033 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3031) + @retry.PredicateValue::Text(result3033) } 1 => @retry.PredicateValue::Integer( @@ -28521,24 +28589,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropGt(@retry.PropertyComparison::{ - property_name: result3030, - value: lifted3032, + property_name: result3032, + value: lifted3034, }) } 3 => { - let result3033 = mbt_ffi_ptr2str( + let result3035 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3035 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3037 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3034 = mbt_ffi_ptr2str( + let result3036 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3034) + @retry.PredicateValue::Text(result3036) } 1 => @retry.PredicateValue::Integer( @@ -28552,24 +28620,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropGte(@retry.PropertyComparison::{ - property_name: result3033, - value: lifted3035, + property_name: result3035, + value: lifted3037, }) } 4 => { - let result3036 = mbt_ffi_ptr2str( + let result3038 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3038 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3040 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3037 = mbt_ffi_ptr2str( + let result3039 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3037) + @retry.PredicateValue::Text(result3039) } 1 => @retry.PredicateValue::Integer( @@ -28583,24 +28651,24 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropLt(@retry.PropertyComparison::{ - property_name: result3036, - value: lifted3038, + property_name: result3038, + value: lifted3040, }) } 5 => { - let result3039 = mbt_ffi_ptr2str( + let result3041 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3041 = match mbt_ffi_load8_u(iter_base + 16) { + let lifted3043 = match mbt_ffi_load8_u(iter_base + 16) { 0 => { - let result3040 = mbt_ffi_ptr2str( + let result3042 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) - @retry.PredicateValue::Text(result3040) + @retry.PredicateValue::Text(result3042) } 1 => @retry.PredicateValue::Integer( @@ -28614,40 +28682,40 @@ pub fn enrich_oplog_entries( } @retry.PredicateNode::PropLte(@retry.PropertyComparison::{ - property_name: result3039, - value: lifted3041, + property_name: result3041, + value: lifted3043, }) } 6 => { - let result3042 = mbt_ffi_ptr2str( + let result3044 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @retry.PredicateNode::PropExists(result3042) + @retry.PredicateNode::PropExists(result3044) } 7 => { - let result3043 = mbt_ffi_ptr2str( + let result3045 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array3046 : Array[@retry.PredicateValue] = [] - for index3047 = 0 - index3047 < mbt_ffi_load32(iter_base + 20) - index3047 = index3047 + 1 { + let array3048 : Array[@retry.PredicateValue] = [] + for index3049 = 0 + index3049 < mbt_ffi_load32(iter_base + 20) + index3049 = index3049 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index3047 * 16 + index3049 * 16 - let lifted3045 = match + let lifted3047 = match mbt_ffi_load8_u(iter_base + 0) { 0 => { - let result3044 = mbt_ffi_ptr2str( + let result3046 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @retry.PredicateValue::Text(result3044) + @retry.PredicateValue::Text(result3046) } 1 => @retry.PredicateValue::Integer( @@ -28660,61 +28728,61 @@ pub fn enrich_oplog_entries( _ => panic() } - array3046.push(lifted3045) + array3048.push(lifted3047) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) @retry.PredicateNode::PropIn(@retry.PropertySetCheck::{ - property_name: result3043, - values: array3046, + property_name: result3045, + values: array3048, }) } 8 => { - let result3048 = mbt_ffi_ptr2str( + let result3050 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3049 = mbt_ffi_ptr2str( + let result3051 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropMatches(@retry.PropertyPattern::{ - property_name: result3048, - pattern: result3049, + property_name: result3050, + pattern: result3051, }) } 9 => { - let result3050 = mbt_ffi_ptr2str( + let result3052 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3051 = mbt_ffi_ptr2str( + let result3053 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropStartsWith(@retry.PropertyPattern::{ - property_name: result3050, - pattern: result3051, + property_name: result3052, + pattern: result3053, }) } 10 => { - let result3052 = mbt_ffi_ptr2str( + let result3054 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let result3053 = mbt_ffi_ptr2str( + let result3055 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) @retry.PredicateNode::PropContains(@retry.PropertyPattern::{ - property_name: result3052, - pattern: result3053, + property_name: result3054, + pattern: result3055, }) } 11 => @@ -28740,12 +28808,12 @@ pub fn enrich_oplog_entries( _ => panic() } - array3055.push(lifted3054) + array3057.push(lifted3056) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @retry.PolicyNode::FilteredOn(@retry.FilteredConfig::{ - predicate: @retry.RetryPredicate::{ nodes: array3055 }, + predicate: @retry.RetryPredicate::{ nodes: array3057 }, inner: mbt_ffi_load32(iter_base + 16), }) } @@ -28773,7 +28841,7 @@ pub fn enrich_oplog_entries( _ => panic() } - array3058.push(lifted3057) + array3060.push(lifted3059) } mbt_ffi_free(mbt_ffi_load32(iter_base + 44)) @@ -28783,15 +28851,15 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, policy: @retry.NamedRetryPolicy::{ - name: result2990, + name: result2992, priority: mbt_ffi_load32(iter_base + 32).reinterpret_as_uint(), - predicate: @retry.RetryPredicate::{ nodes: array3022 }, - policy: @retry.RetryPolicy::{ nodes: array3058 }, + predicate: @retry.RetryPredicate::{ nodes: array3024 }, + policy: @retry.RetryPolicy::{ nodes: array3060 }, }, }) } 39 => { - let result3060 = mbt_ffi_ptr2str( + let result3062 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 24), mbt_ffi_load32(iter_base + 28), ) @@ -28801,11 +28869,11 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - name: result3060, + name: result3062, }) } 40 => { - let lifted3061 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted3063 = match mbt_ffi_load8_u(iter_base + 24) { 0 => QueuedCardEvent::Install(QueuedCardEventInstall::{ card_id: @types.CardId::{ @@ -28832,11 +28900,11 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - event: lifted3061, + event: lifted3063, }) } 41 => { - let lifted3062 : UInt64? = match mbt_ffi_load8_u(iter_base + 24) { + let lifted3064 : UInt64? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => Option::Some( @@ -28850,7 +28918,7 @@ pub fn enrich_oplog_entries( seconds: mbt_ffi_load64(iter_base + 8), nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), }, - queued_event_index: lifted3062, + queued_event_index: lifted3064, card_id: @types.CardId::{ uuid: @types.Uuid::{ high_bits: mbt_ffi_load64(iter_base + 40).reinterpret_as_uint64(), @@ -28902,26 +28970,26 @@ pub fn enrich_oplog_entries( }, }) 45 => { - let array3259 : Array[@types.SchemaTypeNode] = [] - for index3260 = 0 - index3260 < mbt_ffi_load32(iter_base + 40) - index3260 = index3260 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index3260 * 144 + let array3261 : Array[@types.SchemaTypeNode] = [] + for index3262 = 0 + index3262 < mbt_ffi_load32(iter_base + 40) + index3262 = index3262 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index3262 * 144 - let lifted3245 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3247 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType(mbt_ffi_load32(iter_base + 8)) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted3069 : @types.NumericRestrictions? = match + let lifted3071 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3064 : @types.NumericBound? = match + let lifted3066 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3063 = match + let lifted3065 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -28938,16 +29006,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3063) + Option::Some(lifted3065) } _ => panic() } - let lifted3066 : @types.NumericBound? = match + let lifted3068 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3065 = match + let lifted3067 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -28964,46 +29032,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3065) + Option::Some(lifted3067) } _ => panic() } - let lifted3068 : String? = match + let lifted3070 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3067 = mbt_ffi_ptr2str( + let result3069 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3067) + Option::Some(result3069) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3064, - max: lifted3066, - unit: lifted3068, + min: lifted3066, + max: lifted3068, + unit: lifted3070, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted3069) + @types.SchemaTypeBody::S8Type(lifted3071) } 3 => { - let lifted3076 : @types.NumericRestrictions? = match + let lifted3078 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3071 : @types.NumericBound? = match + let lifted3073 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3070 = match + let lifted3072 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29020,16 +29088,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3070) + Option::Some(lifted3072) } _ => panic() } - let lifted3073 : @types.NumericBound? = match + let lifted3075 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3072 = match + let lifted3074 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29046,46 +29114,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3072) + Option::Some(lifted3074) } _ => panic() } - let lifted3075 : String? = match + let lifted3077 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3074 = mbt_ffi_ptr2str( + let result3076 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3074) + Option::Some(result3076) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3071, - max: lifted3073, - unit: lifted3075, + min: lifted3073, + max: lifted3075, + unit: lifted3077, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted3076) + @types.SchemaTypeBody::S16Type(lifted3078) } 4 => { - let lifted3083 : @types.NumericRestrictions? = match + let lifted3085 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3078 : @types.NumericBound? = match + let lifted3080 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3077 = match + let lifted3079 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29102,16 +29170,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3077) + Option::Some(lifted3079) } _ => panic() } - let lifted3080 : @types.NumericBound? = match + let lifted3082 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3079 = match + let lifted3081 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29128,46 +29196,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3079) + Option::Some(lifted3081) } _ => panic() } - let lifted3082 : String? = match + let lifted3084 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3081 = mbt_ffi_ptr2str( + let result3083 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3081) + Option::Some(result3083) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3078, - max: lifted3080, - unit: lifted3082, + min: lifted3080, + max: lifted3082, + unit: lifted3084, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted3083) + @types.SchemaTypeBody::S32Type(lifted3085) } 5 => { - let lifted3090 : @types.NumericRestrictions? = match + let lifted3092 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3085 : @types.NumericBound? = match + let lifted3087 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3084 = match + let lifted3086 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29184,16 +29252,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3084) + Option::Some(lifted3086) } _ => panic() } - let lifted3087 : @types.NumericBound? = match + let lifted3089 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3086 = match + let lifted3088 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29210,46 +29278,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3086) + Option::Some(lifted3088) } _ => panic() } - let lifted3089 : String? = match + let lifted3091 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3088 = mbt_ffi_ptr2str( + let result3090 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3088) + Option::Some(result3090) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3085, - max: lifted3087, - unit: lifted3089, + min: lifted3087, + max: lifted3089, + unit: lifted3091, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted3090) + @types.SchemaTypeBody::S64Type(lifted3092) } 6 => { - let lifted3097 : @types.NumericRestrictions? = match + let lifted3099 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3092 : @types.NumericBound? = match + let lifted3094 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3091 = match + let lifted3093 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29266,16 +29334,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3091) + Option::Some(lifted3093) } _ => panic() } - let lifted3094 : @types.NumericBound? = match + let lifted3096 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3093 = match + let lifted3095 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29292,46 +29360,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3093) + Option::Some(lifted3095) } _ => panic() } - let lifted3096 : String? = match + let lifted3098 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3095 = mbt_ffi_ptr2str( + let result3097 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3095) + Option::Some(result3097) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3092, - max: lifted3094, - unit: lifted3096, + min: lifted3094, + max: lifted3096, + unit: lifted3098, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted3097) + @types.SchemaTypeBody::U8Type(lifted3099) } 7 => { - let lifted3104 : @types.NumericRestrictions? = match + let lifted3106 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3099 : @types.NumericBound? = match + let lifted3101 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3098 = match + let lifted3100 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29348,16 +29416,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3098) + Option::Some(lifted3100) } _ => panic() } - let lifted3101 : @types.NumericBound? = match + let lifted3103 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3100 = match + let lifted3102 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29374,46 +29442,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3100) + Option::Some(lifted3102) } _ => panic() } - let lifted3103 : String? = match + let lifted3105 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3102 = mbt_ffi_ptr2str( + let result3104 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3102) + Option::Some(result3104) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3099, - max: lifted3101, - unit: lifted3103, + min: lifted3101, + max: lifted3103, + unit: lifted3105, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted3104) + @types.SchemaTypeBody::U16Type(lifted3106) } 8 => { - let lifted3111 : @types.NumericRestrictions? = match + let lifted3113 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3106 : @types.NumericBound? = match + let lifted3108 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3105 = match + let lifted3107 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29430,16 +29498,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3105) + Option::Some(lifted3107) } _ => panic() } - let lifted3108 : @types.NumericBound? = match + let lifted3110 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3107 = match + let lifted3109 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29456,46 +29524,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3107) + Option::Some(lifted3109) } _ => panic() } - let lifted3110 : String? = match + let lifted3112 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3109 = mbt_ffi_ptr2str( + let result3111 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3109) + Option::Some(result3111) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3106, - max: lifted3108, - unit: lifted3110, + min: lifted3108, + max: lifted3110, + unit: lifted3112, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted3111) + @types.SchemaTypeBody::U32Type(lifted3113) } 9 => { - let lifted3118 : @types.NumericRestrictions? = match + let lifted3120 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3113 : @types.NumericBound? = match + let lifted3115 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3112 = match + let lifted3114 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29512,16 +29580,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3112) + Option::Some(lifted3114) } _ => panic() } - let lifted3115 : @types.NumericBound? = match + let lifted3117 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3114 = match + let lifted3116 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29538,46 +29606,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3114) + Option::Some(lifted3116) } _ => panic() } - let lifted3117 : String? = match + let lifted3119 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3116 = mbt_ffi_ptr2str( + let result3118 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3116) + Option::Some(result3118) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3113, - max: lifted3115, - unit: lifted3117, + min: lifted3115, + max: lifted3117, + unit: lifted3119, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted3118) + @types.SchemaTypeBody::U64Type(lifted3120) } 10 => { - let lifted3125 : @types.NumericRestrictions? = match + let lifted3127 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3120 : @types.NumericBound? = match + let lifted3122 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3119 = match + let lifted3121 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29594,16 +29662,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3119) + Option::Some(lifted3121) } _ => panic() } - let lifted3122 : @types.NumericBound? = match + let lifted3124 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3121 = match + let lifted3123 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29620,46 +29688,46 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3121) + Option::Some(lifted3123) } _ => panic() } - let lifted3124 : String? = match + let lifted3126 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3123 = mbt_ffi_ptr2str( + let result3125 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3123) + Option::Some(result3125) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3120, - max: lifted3122, - unit: lifted3124, + min: lifted3122, + max: lifted3124, + unit: lifted3126, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted3125) + @types.SchemaTypeBody::F32Type(lifted3127) } 11 => { - let lifted3132 : @types.NumericRestrictions? = match + let lifted3134 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted3127 : @types.NumericBound? = match + let lifted3129 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted3126 = match + let lifted3128 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( @@ -29676,16 +29744,16 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3126) + Option::Some(lifted3128) } _ => panic() } - let lifted3129 : @types.NumericBound? = match + let lifted3131 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted3128 = match + let lifted3130 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( @@ -29702,322 +29770,322 @@ pub fn enrich_oplog_entries( _ => panic() } - Option::Some(lifted3128) + Option::Some(lifted3130) } _ => panic() } - let lifted3131 : String? = match + let lifted3133 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3130 = mbt_ffi_ptr2str( + let result3132 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3130) + Option::Some(result3132) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted3127, - max: lifted3129, - unit: lifted3131, + min: lifted3129, + max: lifted3131, + unit: lifted3133, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted3132) + @types.SchemaTypeBody::F64Type(lifted3134) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array3147 : Array[@types.NamedFieldType] = [] - for index3148 = 0 - index3148 < mbt_ffi_load32(iter_base + 12) - index3148 = index3148 + 1 { + let array3149 : Array[@types.NamedFieldType] = [] + for index3150 = 0 + index3150 < mbt_ffi_load32(iter_base + 12) + index3150 = index3150 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3148 * 68 + index3150 * 68 - let result3133 = mbt_ffi_ptr2str( + let result3135 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted3135 : String? = match + let lifted3137 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result3134 = mbt_ffi_ptr2str( + let result3136 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result3134) + Option::Some(result3136) } _ => panic() } - let array3137 : Array[String] = [] - for index3138 = 0 - index3138 < mbt_ffi_load32(iter_base + 28) - index3138 = index3138 + 1 { + let array3139 : Array[String] = [] + for index3140 = 0 + index3140 < mbt_ffi_load32(iter_base + 28) + index3140 = index3140 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index3138 * 8 + index3140 * 8 - let result3136 = mbt_ffi_ptr2str( + let result3138 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3137.push(result3136) + array3139.push(result3138) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array3140 : Array[String] = [] - for index3141 = 0 - index3141 < mbt_ffi_load32(iter_base + 36) - index3141 = index3141 + 1 { + let array3142 : Array[String] = [] + for index3143 = 0 + index3143 < mbt_ffi_load32(iter_base + 36) + index3143 = index3143 + 1 { let iter_base = mbt_ffi_load32(iter_base + 32) + - index3141 * 8 + index3143 * 8 - let result3139 = mbt_ffi_ptr2str( + let result3141 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3140.push(result3139) + array3142.push(result3141) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted3143 : String? = match + let lifted3145 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result3142 = mbt_ffi_ptr2str( + let result3144 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result3142) + Option::Some(result3144) } _ => panic() } - let lifted3146 : @types.Role? = match + let lifted3148 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted3145 = match mbt_ffi_load8_u(iter_base + 56) { + let lifted3147 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result3144 = mbt_ffi_ptr2str( + let result3146 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result3144) + @types.Role::Other(result3146) } _ => panic() } - Option::Some(lifted3145) + Option::Some(lifted3147) } _ => panic() } - array3147.push(@types.NamedFieldType::{ - name: result3133, + array3149.push(@types.NamedFieldType::{ + name: result3135, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted3135, - aliases: array3137, - examples: array3140, - deprecated: lifted3143, - role: lifted3146, + doc: lifted3137, + aliases: array3139, + examples: array3142, + deprecated: lifted3145, + role: lifted3148, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array3147) + @types.SchemaTypeBody::RecordType(array3149) } 15 => { - let array3164 : Array[@types.VariantCaseType] = [] - for index3165 = 0 - index3165 < mbt_ffi_load32(iter_base + 12) - index3165 = index3165 + 1 { + let array3166 : Array[@types.VariantCaseType] = [] + for index3167 = 0 + index3167 < mbt_ffi_load32(iter_base + 12) + index3167 = index3167 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3165 * 72 + index3167 * 72 - let result3149 = mbt_ffi_ptr2str( + let result3151 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted3150 : Int? = match + let lifted3152 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted3152 : String? = match + let lifted3154 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result3151 = mbt_ffi_ptr2str( + let result3153 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result3151) + Option::Some(result3153) } _ => panic() } - let array3154 : Array[String] = [] - for index3155 = 0 - index3155 < mbt_ffi_load32(iter_base + 32) - index3155 = index3155 + 1 { + let array3156 : Array[String] = [] + for index3157 = 0 + index3157 < mbt_ffi_load32(iter_base + 32) + index3157 = index3157 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index3155 * 8 + index3157 * 8 - let result3153 = mbt_ffi_ptr2str( + let result3155 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3154.push(result3153) + array3156.push(result3155) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array3157 : Array[String] = [] - for index3158 = 0 - index3158 < mbt_ffi_load32(iter_base + 40) - index3158 = index3158 + 1 { + let array3159 : Array[String] = [] + for index3160 = 0 + index3160 < mbt_ffi_load32(iter_base + 40) + index3160 = index3160 + 1 { let iter_base = mbt_ffi_load32(iter_base + 36) + - index3158 * 8 + index3160 * 8 - let result3156 = mbt_ffi_ptr2str( + let result3158 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3157.push(result3156) + array3159.push(result3158) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted3160 : String? = match + let lifted3162 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result3159 = mbt_ffi_ptr2str( + let result3161 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result3159) + Option::Some(result3161) } _ => panic() } - let lifted3163 : @types.Role? = match + let lifted3165 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted3162 = match mbt_ffi_load8_u(iter_base + 60) { + let lifted3164 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result3161 = mbt_ffi_ptr2str( + let result3163 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result3161) + @types.Role::Other(result3163) } _ => panic() } - Option::Some(lifted3162) + Option::Some(lifted3164) } _ => panic() } - array3164.push(@types.VariantCaseType::{ - name: result3149, - payload: lifted3150, + array3166.push(@types.VariantCaseType::{ + name: result3151, + payload: lifted3152, metadata: @types.MetadataEnvelope::{ - doc: lifted3152, - aliases: array3154, - examples: array3157, - deprecated: lifted3160, - role: lifted3163, + doc: lifted3154, + aliases: array3156, + examples: array3159, + deprecated: lifted3162, + role: lifted3165, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array3164) + @types.SchemaTypeBody::VariantType(array3166) } 16 => { - let array3167 : Array[String] = [] - for index3168 = 0 - index3168 < mbt_ffi_load32(iter_base + 12) - index3168 = index3168 + 1 { + let array3169 : Array[String] = [] + for index3170 = 0 + index3170 < mbt_ffi_load32(iter_base + 12) + index3170 = index3170 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3168 * 8 + index3170 * 8 - let result3166 = mbt_ffi_ptr2str( + let result3168 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3167.push(result3166) + array3169.push(result3168) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array3167) + @types.SchemaTypeBody::EnumType(array3169) } 17 => { - let array3170 : Array[String] = [] - for index3171 = 0 - index3171 < mbt_ffi_load32(iter_base + 12) - index3171 = index3171 + 1 { + let array3172 : Array[String] = [] + for index3173 = 0 + index3173 < mbt_ffi_load32(iter_base + 12) + index3173 = index3173 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3171 * 8 + index3173 * 8 - let result3169 = mbt_ffi_ptr2str( + let result3171 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3170.push(result3169) + array3172.push(result3171) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array3170) + @types.SchemaTypeBody::FlagsType(array3172) } 18 => { - let array3172 : Array[Int] = [] - for index3173 = 0 - index3173 < mbt_ffi_load32(iter_base + 12) - index3173 = index3173 + 1 { + let array3174 : Array[Int] = [] + for index3175 = 0 + index3175 < mbt_ffi_load32(iter_base + 12) + index3175 = index3175 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3173 * 4 + index3175 * 4 - array3172.push(mbt_ffi_load32(iter_base + 0)) + array3174.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array3172) + @types.SchemaTypeBody::TupleType(array3174) } 19 => @types.SchemaTypeBody::ListType(mbt_ffi_load32(iter_base + 8)) @@ -30036,13 +30104,13 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8), ) 23 => { - let lifted3174 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3176 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted3175 : Int? = match + let lifted3177 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) @@ -30050,37 +30118,37 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted3174, - err: lifted3175, + ok: lifted3176, + err: lifted3177, }) } 24 => { - let lifted3179 : Array[String]? = match + let lifted3181 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array3177 : Array[String] = [] - for index3178 = 0 - index3178 < mbt_ffi_load32(iter_base + 16) - index3178 = index3178 + 1 { + let array3179 : Array[String] = [] + for index3180 = 0 + index3180 < mbt_ffi_load32(iter_base + 16) + index3180 = index3180 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index3178 * 8 + index3180 * 8 - let result3176 = mbt_ffi_ptr2str( + let result3178 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3177.push(result3176) + array3179.push(result3178) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array3177) + Option::Some(array3179) } _ => panic() } - let lifted3180 : UInt? = match + let lifted3182 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -30090,7 +30158,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted3181 : UInt? = match + let lifted3183 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -30100,54 +30168,54 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted3183 : String? = match + let lifted3185 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result3182 = mbt_ffi_ptr2str( + let result3184 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result3182) + Option::Some(result3184) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted3179, - min_length: lifted3180, - max_length: lifted3181, - regex: lifted3183, + languages: lifted3181, + min_length: lifted3182, + max_length: lifted3183, + regex: lifted3185, }) } 25 => { - let lifted3187 : Array[String]? = match + let lifted3189 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array3185 : Array[String] = [] - for index3186 = 0 - index3186 < mbt_ffi_load32(iter_base + 16) - index3186 = index3186 + 1 { + let array3187 : Array[String] = [] + for index3188 = 0 + index3188 < mbt_ffi_load32(iter_base + 16) + index3188 = index3188 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index3186 * 8 + index3188 * 8 - let result3184 = mbt_ffi_ptr2str( + let result3186 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3185.push(result3184) + array3187.push(result3186) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array3185) + Option::Some(array3187) } _ => panic() } - let lifted3188 : UInt? = match + let lifted3190 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => @@ -30157,7 +30225,7 @@ pub fn enrich_oplog_entries( _ => panic() } - let lifted3189 : UInt? = match + let lifted3191 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => @@ -30168,58 +30236,58 @@ pub fn enrich_oplog_entries( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted3187, - min_bytes: lifted3188, - max_bytes: lifted3189, + mime_types: lifted3189, + min_bytes: lifted3190, + max_bytes: lifted3191, }) } 26 => { - let lifted3193 : Array[String]? = match + let lifted3195 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array3191 : Array[String] = [] - for index3192 = 0 - index3192 < mbt_ffi_load32(iter_base + 20) - index3192 = index3192 + 1 { + let array3193 : Array[String] = [] + for index3194 = 0 + index3194 < mbt_ffi_load32(iter_base + 20) + index3194 = index3194 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index3192 * 8 + index3194 * 8 - let result3190 = mbt_ffi_ptr2str( + let result3192 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3191.push(result3190) + array3193.push(result3192) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array3191) + Option::Some(array3193) } _ => panic() } - let lifted3197 : Array[String]? = match + let lifted3199 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array3195 : Array[String] = [] - for index3196 = 0 - index3196 < mbt_ffi_load32(iter_base + 32) - index3196 = index3196 + 1 { + let array3197 : Array[String] = [] + for index3198 = 0 + index3198 < mbt_ffi_load32(iter_base + 32) + index3198 = index3198 + 1 { let iter_base = mbt_ffi_load32(iter_base + 28) + - index3196 * 8 + index3198 * 8 - let result3194 = mbt_ffi_ptr2str( + let result3196 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3195.push(result3194) + array3197.push(result3196) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array3195) + Option::Some(array3197) } _ => panic() } @@ -30229,95 +30297,95 @@ pub fn enrich_oplog_entries( mbt_ffi_load8_u(iter_base + 8), ), kind: @types.PathKind::from(mbt_ffi_load8_u(iter_base + 9)), - allowed_mime_types: lifted3193, - allowed_extensions: lifted3197, + allowed_mime_types: lifted3195, + allowed_extensions: lifted3199, }) } 27 => { - let lifted3201 : Array[String]? = match + let lifted3203 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array3199 : Array[String] = [] - for index3200 = 0 - index3200 < mbt_ffi_load32(iter_base + 16) - index3200 = index3200 + 1 { + let array3201 : Array[String] = [] + for index3202 = 0 + index3202 < mbt_ffi_load32(iter_base + 16) + index3202 = index3202 + 1 { let iter_base = mbt_ffi_load32(iter_base + 12) + - index3200 * 8 + index3202 * 8 - let result3198 = mbt_ffi_ptr2str( + let result3200 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3199.push(result3198) + array3201.push(result3200) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array3199) + Option::Some(array3201) } _ => panic() } - let lifted3205 : Array[String]? = match + let lifted3207 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array3203 : Array[String] = [] - for index3204 = 0 - index3204 < mbt_ffi_load32(iter_base + 28) - index3204 = index3204 + 1 { + let array3205 : Array[String] = [] + for index3206 = 0 + index3206 < mbt_ffi_load32(iter_base + 28) + index3206 = index3206 + 1 { let iter_base = mbt_ffi_load32(iter_base + 24) + - index3204 * 8 + index3206 * 8 - let result3202 = mbt_ffi_ptr2str( + let result3204 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3203.push(result3202) + array3205.push(result3204) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array3203) + Option::Some(array3205) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted3201, - allowed_hosts: lifted3205, + allowed_schemes: lifted3203, + allowed_hosts: lifted3207, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result3206 = mbt_ffi_ptr2str( + let result3208 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array3208 : Array[String] = [] - for index3209 = 0 - index3209 < mbt_ffi_load32(iter_base + 20) - index3209 = index3209 + 1 { + let array3210 : Array[String] = [] + for index3211 = 0 + index3211 < mbt_ffi_load32(iter_base + 20) + index3211 = index3211 + 1 { let iter_base = mbt_ffi_load32(iter_base + 16) + - index3209 * 8 + index3211 * 8 - let result3207 = mbt_ffi_ptr2str( + let result3209 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3208.push(result3207) + array3210.push(result3209) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted3211 : @types.QuantityValue? = match + let lifted3213 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result3210 = mbt_ffi_ptr2str( + let result3212 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -30325,17 +30393,17 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result3210, + unit: result3212, }) } _ => panic() } - let lifted3213 : @types.QuantityValue? = match + let lifted3215 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result3212 = mbt_ffi_ptr2str( + let result3214 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -30343,397 +30411,397 @@ pub fn enrich_oplog_entries( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result3212, + unit: result3214, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result3206, - allowed_suffixes: array3208, - min: lifted3211, - max: lifted3213, + base_unit: result3208, + allowed_suffixes: array3210, + min: lifted3213, + max: lifted3215, }) } 31 => { - let array3237 : Array[@types.UnionBranch] = [] - for index3238 = 0 - index3238 < mbt_ffi_load32(iter_base + 12) - index3238 = index3238 + 1 { + let array3239 : Array[@types.UnionBranch] = [] + for index3240 = 0 + index3240 < mbt_ffi_load32(iter_base + 12) + index3240 = index3240 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3238 * 92 + index3240 * 92 - let result3214 = mbt_ffi_ptr2str( + let result3216 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted3223 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted3225 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result3215 = mbt_ffi_ptr2str( + let result3217 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result3215) + @types.DiscriminatorRule::Prefix(result3217) } 1 => { - let result3216 = mbt_ffi_ptr2str( + let result3218 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result3216) + @types.DiscriminatorRule::Suffix(result3218) } 2 => { - let result3217 = mbt_ffi_ptr2str( + let result3219 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result3217) + @types.DiscriminatorRule::Contains(result3219) } 3 => { - let result3218 = mbt_ffi_ptr2str( + let result3220 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result3218) + @types.DiscriminatorRule::Regex(result3220) } 4 => { - let result3219 = mbt_ffi_ptr2str( + let result3221 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted3221 : String? = match + let lifted3223 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result3220 = mbt_ffi_ptr2str( + let result3222 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result3220) + Option::Some(result3222) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result3219, - literal: lifted3221, + field_name: result3221, + literal: lifted3223, }) } 5 => { - let result3222 = mbt_ffi_ptr2str( + let result3224 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result3222) + @types.DiscriminatorRule::FieldAbsent(result3224) } _ => panic() } - let lifted3225 : String? = match + let lifted3227 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result3224 = mbt_ffi_ptr2str( + let result3226 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result3224) + Option::Some(result3226) } _ => panic() } - let array3227 : Array[String] = [] - for index3228 = 0 - index3228 < mbt_ffi_load32(iter_base + 52) - index3228 = index3228 + 1 { + let array3229 : Array[String] = [] + for index3230 = 0 + index3230 < mbt_ffi_load32(iter_base + 52) + index3230 = index3230 + 1 { let iter_base = mbt_ffi_load32(iter_base + 48) + - index3228 * 8 + index3230 * 8 - let result3226 = mbt_ffi_ptr2str( + let result3228 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3227.push(result3226) + array3229.push(result3228) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array3230 : Array[String] = [] - for index3231 = 0 - index3231 < mbt_ffi_load32(iter_base + 60) - index3231 = index3231 + 1 { + let array3232 : Array[String] = [] + for index3233 = 0 + index3233 < mbt_ffi_load32(iter_base + 60) + index3233 = index3233 + 1 { let iter_base = mbt_ffi_load32(iter_base + 56) + - index3231 * 8 + index3233 * 8 - let result3229 = mbt_ffi_ptr2str( + let result3231 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3230.push(result3229) + array3232.push(result3231) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted3233 : String? = match + let lifted3235 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result3232 = mbt_ffi_ptr2str( + let result3234 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result3232) + Option::Some(result3234) } _ => panic() } - let lifted3236 : @types.Role? = match + let lifted3238 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted3235 = match mbt_ffi_load8_u(iter_base + 80) { + let lifted3237 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result3234 = mbt_ffi_ptr2str( + let result3236 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result3234) + @types.Role::Other(result3236) } _ => panic() } - Option::Some(lifted3235) + Option::Some(lifted3237) } _ => panic() } - array3237.push(@types.UnionBranch::{ - tag: result3214, + array3239.push(@types.UnionBranch::{ + tag: result3216, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted3223, + discriminator: lifted3225, metadata: @types.MetadataEnvelope::{ - doc: lifted3225, - aliases: array3227, - examples: array3230, - deprecated: lifted3233, - role: lifted3236, + doc: lifted3227, + aliases: array3229, + examples: array3232, + deprecated: lifted3235, + role: lifted3238, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array3237, + branches: array3239, }) } 32 => { - let lifted3240 : String? = match + let lifted3242 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result3239 = mbt_ffi_ptr2str( + let result3241 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result3239) + Option::Some(result3241) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted3240, + category: lifted3242, }) } 33 => { - let lifted3242 : String? = match + let lifted3244 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result3241 = mbt_ffi_ptr2str( + let result3243 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result3241) + Option::Some(result3243) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted3242, + resource_name: lifted3244, }) } 34 => { - let lifted3243 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3245 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted3243) + @types.SchemaTypeBody::FutureType(lifted3245) } 35 => { - let lifted3244 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3246 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted3244) + @types.SchemaTypeBody::StreamType(lifted3246) } _ => panic() } - let lifted3247 : String? = match mbt_ffi_load8_u(iter_base + 88) { + let lifted3249 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result3246 = mbt_ffi_ptr2str( + let result3248 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result3246) + Option::Some(result3248) } _ => panic() } - let array3249 : Array[String] = [] - for index3250 = 0 - index3250 < mbt_ffi_load32(iter_base + 104) - index3250 = index3250 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index3250 * 8 + let array3251 : Array[String] = [] + for index3252 = 0 + index3252 < mbt_ffi_load32(iter_base + 104) + index3252 = index3252 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index3252 * 8 - let result3248 = mbt_ffi_ptr2str( + let result3250 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3249.push(result3248) + array3251.push(result3250) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array3252 : Array[String] = [] - for index3253 = 0 - index3253 < mbt_ffi_load32(iter_base + 112) - index3253 = index3253 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index3253 * 8 + let array3254 : Array[String] = [] + for index3255 = 0 + index3255 < mbt_ffi_load32(iter_base + 112) + index3255 = index3255 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index3255 * 8 - let result3251 = mbt_ffi_ptr2str( + let result3253 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array3252.push(result3251) + array3254.push(result3253) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted3255 : String? = match + let lifted3257 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result3254 = mbt_ffi_ptr2str( + let result3256 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result3254) + Option::Some(result3256) } _ => panic() } - let lifted3258 : @types.Role? = match + let lifted3260 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted3257 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted3259 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result3256 = mbt_ffi_ptr2str( + let result3258 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result3256) + @types.Role::Other(result3258) } _ => panic() } - Option::Some(lifted3257) + Option::Some(lifted3259) } _ => panic() } - array3259.push(@types.SchemaTypeNode::{ - body: lifted3245, + array3261.push(@types.SchemaTypeNode::{ + body: lifted3247, metadata: @types.MetadataEnvelope::{ - doc: lifted3247, - aliases: array3249, - examples: array3252, - deprecated: lifted3255, - role: lifted3258, + doc: lifted3249, + aliases: array3251, + examples: array3254, + deprecated: lifted3257, + role: lifted3260, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let array3264 : Array[@types.SchemaTypeDef] = [] - for index3265 = 0 - index3265 < mbt_ffi_load32(iter_base + 48) - index3265 = index3265 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 44) + index3265 * 24 + let array3266 : Array[@types.SchemaTypeDef] = [] + for index3267 = 0 + index3267 < mbt_ffi_load32(iter_base + 48) + index3267 = index3267 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 44) + index3267 * 24 - let result3261 = mbt_ffi_ptr2str( + let result3263 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted3263 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3265 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result3262 = mbt_ffi_ptr2str( + let result3264 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result3262) + Option::Some(result3264) } _ => panic() } - array3264.push(@types.SchemaTypeDef::{ - id: result3261, - name: lifted3263, + array3266.push(@types.SchemaTypeDef::{ + id: result3263, + name: lifted3265, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 44)) - let array3295 : Array[@types.SchemaValueNode] = [] - for index3296 = 0 - index3296 < mbt_ffi_load32(iter_base + 60) - index3296 = index3296 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 56) + index3296 * 32 + let array3297 : Array[@types.SchemaValueNode] = [] + for index3298 = 0 + index3298 < mbt_ffi_load32(iter_base + 60) + index3298 = index3298 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 56) + index3298 * 32 - let lifted3294 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted3296 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -30783,29 +30851,29 @@ pub fn enrich_oplog_entries( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result3266 = mbt_ffi_ptr2str( + let result3268 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result3266) + @types.SchemaValueNode::StringValue(result3268) } 13 => { - let array3267 : Array[Int] = [] - for index3268 = 0 - index3268 < mbt_ffi_load32(iter_base + 12) - index3268 = index3268 + 1 { + let array3269 : Array[Int] = [] + for index3270 = 0 + index3270 < mbt_ffi_load32(iter_base + 12) + index3270 = index3270 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3268 * 4 + index3270 * 4 - array3267.push(mbt_ffi_load32(iter_base + 0)) + array3269.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array3267) + @types.SchemaValueNode::RecordValue(array3269) } 14 => { - let lifted3269 : Int? = match + let lifted3271 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) @@ -30814,7 +30882,7 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted3269, + payload: lifted3271, }) } 15 => @@ -30822,34 +30890,20 @@ pub fn enrich_oplog_entries( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array3270 : Array[Bool] = [] - for index3271 = 0 - index3271 < mbt_ffi_load32(iter_base + 12) - index3271 = index3271 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + - index3271 * 1 - - array3270.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array3270) - } - 17 => { - let array3272 : Array[Int] = [] + let array3272 : Array[Bool] = [] for index3273 = 0 index3273 < mbt_ffi_load32(iter_base + 12) index3273 = index3273 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3273 * 4 + index3273 * 1 - array3272.push(mbt_ffi_load32(iter_base + 0)) + array3272.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array3272) + @types.SchemaValueNode::FlagsValue(array3272) } - 18 => { + 17 => { let array3274 : Array[Int] = [] for index3275 = 0 index3275 < mbt_ffi_load32(iter_base + 12) @@ -30861,9 +30915,9 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array3274) + @types.SchemaValueNode::TupleValue(array3274) } - 19 => { + 18 => { let array3276 : Array[Int] = [] for index3277 = 0 index3277 < mbt_ffi_load32(iter_base + 12) @@ -30875,126 +30929,140 @@ pub fn enrich_oplog_entries( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array3276) + @types.SchemaValueNode::ListValue(array3276) } - 20 => { - let array3278 : Array[@types.MapEntry] = [] + 19 => { + let array3278 : Array[Int] = [] for index3279 = 0 index3279 < mbt_ffi_load32(iter_base + 12) index3279 = index3279 + 1 { let iter_base = mbt_ffi_load32(iter_base + 8) + - index3279 * 8 + index3279 * 4 + + array3278.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array3278) + } + 20 => { + let array3280 : Array[@types.MapEntry] = [] + for index3281 = 0 + index3281 < mbt_ffi_load32(iter_base + 12) + index3281 = index3281 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + + index3281 * 8 - array3278.push(@types.MapEntry::{ + array3280.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array3278) + @types.SchemaValueNode::MapValue(array3280) } 21 => { - let lifted3280 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3282 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted3280) + @types.SchemaValueNode::OptionValue(lifted3282) } 22 => { - let lifted3283 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted3285 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted3281 : Int? = match + let lifted3283 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted3281) + @types.ResultValuePayload::OkValue(lifted3283) } 1 => { - let lifted3282 : Int? = match + let lifted3284 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted3282) + @types.ResultValuePayload::ErrValue(lifted3284) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted3283) + @types.SchemaValueNode::ResultValue(lifted3285) } 23 => { - let result3284 = mbt_ffi_ptr2str( + let result3286 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3286 : String? = match + let lifted3288 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result3285 = mbt_ffi_ptr2str( + let result3287 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result3285) + Option::Some(result3287) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result3284, - language: lifted3286, + text: result3286, + language: lifted3288, }) } 24 => { - let result3287 = mbt_ffi_ptr2bytes( + let result3289 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted3289 : String? = match + let lifted3291 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result3288 = mbt_ffi_ptr2str( + let result3290 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result3288) + Option::Some(result3290) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result3287, - mime_type: lifted3289, + bytes: result3289, + mime_type: lifted3291, }) } 25 => { - let result3290 = mbt_ffi_ptr2str( + let result3292 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result3290) + @types.SchemaValueNode::PathValue(result3292) } 26 => { - let result3291 = mbt_ffi_ptr2str( + let result3293 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result3291) + @types.SchemaValueNode::UrlValue(result3293) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -31006,7 +31074,7 @@ pub fn enrich_oplog_entries( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result3292 = mbt_ffi_ptr2str( + let result3294 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -31014,17 +31082,17 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result3292, + unit: result3294, }) } 30 => { - let result3293 = mbt_ffi_ptr2str( + let result3295 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result3293, + tag: result3295, body: mbt_ffi_load32(iter_base + 16), }) } @@ -31036,10 +31104,16 @@ pub fn enrich_oplog_entries( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array3295.push(lifted3294) + array3297.push(lifted3296) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) @@ -31052,12 +31126,12 @@ pub fn enrich_oplog_entries( kind: HostStreamKind::from(mbt_ffi_load8_u(iter_base + 32)), payload: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array3259, - defs: array3264, + type_nodes: array3261, + defs: array3266, root: mbt_ffi_load32(iter_base + 52), }, value: @types.SchemaValueTree::{ - value_nodes: array3295, + value_nodes: array3297, root: mbt_ffi_load32(iter_base + 64), }, }, @@ -31074,25 +31148,25 @@ pub fn enrich_oplog_entries( _ => panic() } - array3298.push(lifted3297) + array3300.push(lifted3299) } mbt_ffi_free(mbt_ffi_load32(return_area + 4)) - Result::Ok(array3298) + Result::Ok(array3300) } 1 => { - let result3300 = mbt_ffi_ptr2str( + let result3302 = mbt_ffi_ptr2str( mbt_ffi_load32(return_area + 4), mbt_ffi_load32(return_area + 8), ) - Result::Err(result3300) + Result::Err(result3302) } _ => panic() } - let ret = lifted3301 + let ret = lifted3303 mbt_ffi_free(ptr) - mbt_ffi_free(address459) + mbt_ffi_free(address461) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) @@ -33405,6 +33479,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -35678,6 +35758,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -37908,6 +37994,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -40101,6 +40193,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -42298,6 +42396,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -44621,6 +44725,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -46981,6 +47091,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -49161,6 +49277,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -51549,6 +51671,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -53872,6 +54000,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -57634,6 +57768,12 @@ pub fn GetOplog::get_next(self : GetOplog) -> Array[PublicOplogEntry]? { @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -59997,6 +60137,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -62270,6 +62416,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -64500,6 +64652,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -66693,6 +66851,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -68890,6 +69054,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -71213,6 +71383,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -73574,6 +73750,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -75754,6 +75936,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -78142,6 +78330,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -80465,6 +80659,12 @@ pub fn SearchOplog::get_next( mbt_ffi_load32(iter_base + 8), ), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } @@ -84228,6 +84428,12 @@ pub fn SearchOplog::get_next( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } diff --git a/sdks/moonbit/golem_sdk/interface/golem/core/types/ffi.mbt b/sdks/moonbit/golem_sdk/interface/golem/core/types/ffi.mbt index c2bf754893..3656948d65 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/core/types/ffi.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/core/types/ffi.mbt @@ -6,6 +6,9 @@ fn wasmImportResourceDropQuotaToken(resource : Int) = "golem:core/types@2.0.0" " ///| fn wasmImportResourceDropSecret(resource : Int) = "golem:core/types@2.0.0" "[resource-drop]secret" +///| +fn wasmImportResourceDropSchemaValueStream(resource : Int) = "golem:core/types@2.0.0" "[resource-drop]schema-value-stream" + ///| fn wasmImportParseUuid(p0 : Int, p1 : Int, p2 : Int) = "golem:core/types@2.0.0" "parse-uuid" @@ -13,32 +16,2020 @@ fn wasmImportParseUuid(p0 : Int, p1 : Int, p2 : Int) = "golem:core/types@2.0.0" fn wasmImportUuidToString(p0 : Int64, p1 : Int64, p2 : Int) = "golem:core/types@2.0.0" "uuid-to-string" ///| -extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = - #|(func (param i32) (result i32) (local i32) - #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc - #| local.tee 1 i32.const 0 call $moonbit.init_array8 - #| local.get 1) +fn wasmImportStaticSchemaValueStreamWrap(p0 : Int, p1 : Int) -> Int = "golem:core/types@2.0.0" "[async-lower][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0Read( + handle : Int, + buffer_ptr : Int, + length : Int, +) -> Int = "golem:core/types@2.0.0" "[async-lower][stream-read-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0CancelRead( + handle : Int, +) -> Int = "golem:core/types@2.0.0" "[stream-cancel-read-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + handle : Int, +) = "golem:core/types@2.0.0" "[stream-drop-readable-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0New() -> UInt64 = "golem:core/types@2.0.0" "[stream-new-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0Write( + handle : Int, + buffer_ptr : Int, + length : Int, +) -> Int = "golem:core/types@2.0.0" "[async-lower][stream-write-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0CancelWrite( + handle : Int, +) -> Int = "golem:core/types@2.0.0" "[stream-cancel-write-0][static]schema-value-stream.wrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropWritable( + handle : Int, +) = "golem:core/types@2.0.0" "[stream-drop-writable-0][static]schema-value-stream.wrap" + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc( + length : Int, +) -> Int { + let ptr = mbt_ffi_malloc(12 * length) + ptr +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Commit( + ptr : Int, + start : Int, + length : Int, +) -> Unit { + for i in start..<(start + length) { + let elem_ptr = ptr + i * 12 + + for index = 0; index < mbt_ffi_load32(elem_ptr + 4); index = index + 1 { + let iter_base = mbt_ffi_load32(elem_ptr + 0) + index * 32 + + match mbt_ffi_load8_u(iter_base + 0) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => () + 5 => () + 6 => () + 7 => () + 8 => () + 9 => () + 10 => () + 11 => () + 12 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 13 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 14 => () + 15 => () + 16 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 17 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 18 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 19 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 20 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 21 => () + 22 => () + 23 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 24 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 25 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 26 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 27 => () + 28 => () + 29 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 31 => () + 32 => () + 33 => () + _ => panic() + } + } + mbt_ffi_free(mbt_ffi_load32(elem_ptr + 0)) + } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject( + ptr : Int, + start : Int, + length : Int, +) -> Unit { + for i in start..<(start + length) { + let elem_ptr = ptr + i * 12 + + for index = 0; index < mbt_ffi_load32(elem_ptr + 4); index = index + 1 { + let iter_base = mbt_ffi_load32(elem_ptr + 0) + index * 32 + + match mbt_ffi_load8_u(iter_base + 0) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => () + 5 => () + 6 => () + 7 => () + 8 => () + 9 => () + 10 => () + 11 => () + 12 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 13 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 14 => () + 15 => () + 16 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 17 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 18 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 19 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 20 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 21 => () + 22 => () + 23 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 24 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 25 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 26 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 27 => () + 28 => () + 29 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 31 => Secret::Secret(mbt_ffi_load32(iter_base + 8)).drop() + 32 => QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)).drop() + 33 => + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(iter_base + 8)).drop() + _ => panic() + } + } + mbt_ffi_free(mbt_ffi_load32(elem_ptr + 0)) + } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lift( + ptr : Int, +) -> SchemaValueTree { + let array25 : Array[SchemaValueNode] = [] + for index26 = 0; index26 < mbt_ffi_load32(ptr + 4); index26 = index26 + 1 { + let iter_base = mbt_ffi_load32(ptr + 0) + index26 * 32 + + let lifted24 = match mbt_ffi_load8_u(iter_base + 0) { + 0 => SchemaValueNode::BoolValue(mbt_ffi_load8_u(iter_base + 8) != 0) + 1 => SchemaValueNode::S8Value(mbt_ffi_load8(iter_base + 8)) + 2 => SchemaValueNode::S16Value(mbt_ffi_load16(iter_base + 8)) + 3 => SchemaValueNode::S32Value(mbt_ffi_load32(iter_base + 8)) + 4 => SchemaValueNode::S64Value(mbt_ffi_load64(iter_base + 8)) + 5 => SchemaValueNode::U8Value(mbt_ffi_load8_u(iter_base + 8).to_byte()) + 6 => + SchemaValueNode::U16Value( + mbt_ffi_load16_u(iter_base + 8).land(0xFFFF).reinterpret_as_uint(), + ) + 7 => + SchemaValueNode::U32Value( + mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + ) + 8 => + SchemaValueNode::U64Value( + mbt_ffi_load64(iter_base + 8).reinterpret_as_uint64(), + ) + 9 => SchemaValueNode::F32Value(mbt_ffi_loadf32(iter_base + 8)) + 10 => SchemaValueNode::F64Value(mbt_ffi_loadf64(iter_base + 8)) + 11 => + SchemaValueNode::CharValue( + Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), + ) + 12 => { + let result = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::StringValue(result) + } + 13 => { + let array : Array[Int] = [] + for index = 0; index < mbt_ffi_load32(iter_base + 12); index = index + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index * 4 + + array.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::RecordValue(array) + } + 14 => { + let lifted : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + SchemaValueNode::VariantValue(VariantValuePayload::{ + case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + payload: lifted, + }) + } + 15 => + SchemaValueNode::EnumValue( + mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + ) + 16 => { + let array0 : Array[Bool] = [] + for index1 = 0 + index1 < mbt_ffi_load32(iter_base + 12) + index1 = index1 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index1 * 1 + + array0.push(mbt_ffi_load8_u(iter_base + 0) != 0) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::FlagsValue(array0) + } + 17 => { + let array2 : Array[Int] = [] + for index3 = 0 + index3 < mbt_ffi_load32(iter_base + 12) + index3 = index3 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index3 * 4 + + array2.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::TupleValue(array2) + } + 18 => { + let array4 : Array[Int] = [] + for index5 = 0 + index5 < mbt_ffi_load32(iter_base + 12) + index5 = index5 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index5 * 4 + + array4.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::ListValue(array4) + } + 19 => { + let array6 : Array[Int] = [] + for index7 = 0 + index7 < mbt_ffi_load32(iter_base + 12) + index7 = index7 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index7 * 4 + + array6.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::FixedListValue(array6) + } + 20 => { + let array8 : Array[MapEntry] = [] + for index9 = 0 + index9 < mbt_ffi_load32(iter_base + 12) + index9 = index9 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index9 * 8 + + array8.push(MapEntry::{ + key: mbt_ffi_load32(iter_base + 0), + value: mbt_ffi_load32(iter_base + 4), + }) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::MapValue(array8) + } + 21 => { + let lifted10 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) + _ => panic() + } + + SchemaValueNode::OptionValue(lifted10) + } + 22 => { + let lifted13 = match mbt_ffi_load8_u(iter_base + 8) { + 0 => { + let lifted11 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + ResultValuePayload::OkValue(lifted11) + } + 1 => { + let lifted12 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + ResultValuePayload::ErrValue(lifted12) + } + _ => panic() + } + + SchemaValueNode::ResultValue(lifted13) + } + 23 => { + let result14 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + let lifted16 : String? = match mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let result15 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + Option::Some(result15) + } + _ => panic() + } + + SchemaValueNode::TextValue(TextValuePayload::{ + text: result14, + language: lifted16, + }) + } + 24 => { + let result17 = mbt_ffi_ptr2bytes( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + let lifted19 : String? = match mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let result18 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + Option::Some(result18) + } + _ => panic() + } + + SchemaValueNode::BinaryValue(BinaryValuePayload::{ + bytes: result17, + mime_type: lifted19, + }) + } + 25 => { + let result20 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::PathValue(result20) + } + 26 => { + let result21 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::UrlValue(result21) + } + 27 => + SchemaValueNode::DatetimeValue(Datetime::{ + seconds: mbt_ffi_load64(iter_base + 8), + nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), + }) + 28 => + SchemaValueNode::DurationValue(DurationValuePayload::{ + nanoseconds: mbt_ffi_load64(iter_base + 8), + }) + 29 => { + let result22 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + SchemaValueNode::QuantityValueNode(QuantityValue::{ + mantissa: mbt_ffi_load64(iter_base + 8), + scale: mbt_ffi_load32(iter_base + 16), + unit: result22, + }) + } + 30 => { + let result23 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::UnionValue(UnionValuePayload::{ + tag: result23, + body: mbt_ffi_load32(iter_base + 16), + }) + } + 31 => + SchemaValueNode::SecretValue( + Secret::Secret(mbt_ffi_load32(iter_base + 8)), + ) + 32 => + SchemaValueNode::QuotaTokenHandle( + QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), + ) + 33 => + SchemaValueNode::StreamValue( + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(iter_base + 8)), + ) + _ => panic() + } + + array25.push(lifted24) + } + mbt_ffi_free(mbt_ffi_load32(ptr + 0)) + + SchemaValueTree::{ value_nodes: array25, root: mbt_ffi_load32(ptr + 8) } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lower( + value : SchemaValueTree, + ptr : Int, +) -> Unit { + let address68 = mbt_ffi_malloc(value.value_nodes.length() * 32) + for index69 = 0; index69 < value.value_nodes.length(); index69 = index69 + 1 { + let iter_elem : SchemaValueNode = value.value_nodes[index69] + let iter_base = address68 + index69 * 32 + + match iter_elem { + BoolValue(payload) => { + mbt_ffi_store8(iter_base + 0, 0) + mbt_ffi_store8(iter_base + 8, if payload { 1 } else { 0 }) + + () + } + S8Value(payload0) => { + mbt_ffi_store8(iter_base + 0, 1) + mbt_ffi_store8(iter_base + 8, mbt_ffi_extend8(payload0)) + + () + } + S16Value(payload1) => { + mbt_ffi_store8(iter_base + 0, 2) + mbt_ffi_store16(iter_base + 8, mbt_ffi_extend16(payload1)) + + () + } + S32Value(payload2) => { + mbt_ffi_store8(iter_base + 0, 3) + mbt_ffi_store32(iter_base + 8, payload2) + + () + } + S64Value(payload3) => { + mbt_ffi_store8(iter_base + 0, 4) + mbt_ffi_store64(iter_base + 8, payload3) + + () + } + U8Value(payload4) => { + mbt_ffi_store8(iter_base + 0, 5) + mbt_ffi_store8(iter_base + 8, payload4.to_int()) + + () + } + U16Value(payload5) => { + mbt_ffi_store8(iter_base + 0, 6) + mbt_ffi_store16(iter_base + 8, payload5.reinterpret_as_int()) + + () + } + U32Value(payload6) => { + mbt_ffi_store8(iter_base + 0, 7) + mbt_ffi_store32(iter_base + 8, payload6.reinterpret_as_int()) + + () + } + U64Value(payload7) => { + mbt_ffi_store8(iter_base + 0, 8) + mbt_ffi_store64(iter_base + 8, payload7.reinterpret_as_int64()) + + () + } + F32Value(payload8) => { + mbt_ffi_store8(iter_base + 0, 9) + mbt_ffi_storef32(iter_base + 8, payload8) + + () + } + F64Value(payload9) => { + mbt_ffi_store8(iter_base + 0, 10) + mbt_ffi_storef64(iter_base + 8, payload9) + + () + } + CharValue(payload10) => { + mbt_ffi_store8(iter_base + 0, 11) + mbt_ffi_store32(iter_base + 8, payload10.to_int()) + + () + } + StringValue(payload11) => { + mbt_ffi_store8(iter_base + 0, 12) + + let ptr12 = mbt_ffi_str2ptr(payload11) + mbt_ffi_store32(iter_base + 12, payload11.length()) + mbt_ffi_store32(iter_base + 8, ptr12) + + () + } + RecordValue(payload13) => { + mbt_ffi_store8(iter_base + 0, 13) + + let address = mbt_ffi_malloc(payload13.length() * 4) + for index = 0; index < payload13.length(); index = index + 1 { + let iter_elem : Int = payload13[index] + let iter_base = address + index * 4 + mbt_ffi_store32(iter_base + 0, iter_elem) + } + mbt_ffi_store32(iter_base + 12, payload13.length()) + mbt_ffi_store32(iter_base + 8, address) + + () + } + VariantValue(payload14) => { + mbt_ffi_store8(iter_base + 0, 14) + mbt_ffi_store32(iter_base + 8, payload14.case.reinterpret_as_int()) + + match payload14.payload { + None => { + mbt_ffi_store8(iter_base + 12, 0) + + () + } + Some(payload16) => { + mbt_ffi_store8(iter_base + 12, 1) + mbt_ffi_store32(iter_base + 16, payload16) + + () + } + } + + () + } + EnumValue(payload17) => { + mbt_ffi_store8(iter_base + 0, 15) + mbt_ffi_store32(iter_base + 8, payload17.reinterpret_as_int()) + + () + } + FlagsValue(payload18) => { + mbt_ffi_store8(iter_base + 0, 16) + + let address19 = mbt_ffi_malloc(payload18.length() * 1) + for index20 = 0; index20 < payload18.length(); index20 = index20 + 1 { + let iter_elem : Bool = payload18[index20] + let iter_base = address19 + index20 * 1 + mbt_ffi_store8(iter_base + 0, if iter_elem { 1 } else { 0 }) + } + mbt_ffi_store32(iter_base + 12, payload18.length()) + mbt_ffi_store32(iter_base + 8, address19) + + () + } + TupleValue(payload21) => { + mbt_ffi_store8(iter_base + 0, 17) + + let address22 = mbt_ffi_malloc(payload21.length() * 4) + for index23 = 0; index23 < payload21.length(); index23 = index23 + 1 { + let iter_elem : Int = payload21[index23] + let iter_base = address22 + index23 * 4 + mbt_ffi_store32(iter_base + 0, iter_elem) + } + mbt_ffi_store32(iter_base + 12, payload21.length()) + mbt_ffi_store32(iter_base + 8, address22) + + () + } + ListValue(payload24) => { + mbt_ffi_store8(iter_base + 0, 18) + + let address25 = mbt_ffi_malloc(payload24.length() * 4) + for index26 = 0; index26 < payload24.length(); index26 = index26 + 1 { + let iter_elem : Int = payload24[index26] + let iter_base = address25 + index26 * 4 + mbt_ffi_store32(iter_base + 0, iter_elem) + } + mbt_ffi_store32(iter_base + 12, payload24.length()) + mbt_ffi_store32(iter_base + 8, address25) + + () + } + FixedListValue(payload27) => { + mbt_ffi_store8(iter_base + 0, 19) + + let address28 = mbt_ffi_malloc(payload27.length() * 4) + for index29 = 0; index29 < payload27.length(); index29 = index29 + 1 { + let iter_elem : Int = payload27[index29] + let iter_base = address28 + index29 * 4 + mbt_ffi_store32(iter_base + 0, iter_elem) + } + mbt_ffi_store32(iter_base + 12, payload27.length()) + mbt_ffi_store32(iter_base + 8, address28) + + () + } + MapValue(payload30) => { + mbt_ffi_store8(iter_base + 0, 20) + + let address31 = mbt_ffi_malloc(payload30.length() * 8) + for index32 = 0; index32 < payload30.length(); index32 = index32 + 1 { + let iter_elem : MapEntry = payload30[index32] + let iter_base = address31 + index32 * 8 + mbt_ffi_store32(iter_base + 0, iter_elem.key) + mbt_ffi_store32(iter_base + 4, iter_elem.value) + } + mbt_ffi_store32(iter_base + 12, payload30.length()) + mbt_ffi_store32(iter_base + 8, address31) + + () + } + OptionValue(payload33) => { + mbt_ffi_store8(iter_base + 0, 21) + + match payload33 { + None => { + mbt_ffi_store8(iter_base + 8, 0) + + () + } + Some(payload35) => { + mbt_ffi_store8(iter_base + 8, 1) + mbt_ffi_store32(iter_base + 12, payload35) + + () + } + } + + () + } + ResultValue(payload36) => { + mbt_ffi_store8(iter_base + 0, 22) + + match payload36 { + OkValue(payload37) => { + mbt_ffi_store8(iter_base + 8, 0) + + match payload37 { + None => { + mbt_ffi_store8(iter_base + 12, 0) + + () + } + Some(payload39) => { + mbt_ffi_store8(iter_base + 12, 1) + mbt_ffi_store32(iter_base + 16, payload39) + + () + } + } + + () + } + ErrValue(payload40) => { + mbt_ffi_store8(iter_base + 8, 1) + + match payload40 { + None => { + mbt_ffi_store8(iter_base + 12, 0) + + () + } + Some(payload42) => { + mbt_ffi_store8(iter_base + 12, 1) + mbt_ffi_store32(iter_base + 16, payload42) + + () + } + } + + () + } + } + + () + } + TextValue(payload43) => { + mbt_ffi_store8(iter_base + 0, 23) + + let ptr44 = mbt_ffi_str2ptr(payload43.text) + mbt_ffi_store32(iter_base + 12, payload43.text.length()) + mbt_ffi_store32(iter_base + 8, ptr44) + + match payload43.language { + None => { + mbt_ffi_store8(iter_base + 16, 0) + + () + } + Some(payload46) => { + mbt_ffi_store8(iter_base + 16, 1) + + let ptr47 = mbt_ffi_str2ptr(payload46) + mbt_ffi_store32(iter_base + 24, payload46.length()) + mbt_ffi_store32(iter_base + 20, ptr47) + + () + } + } + + () + } + BinaryValue(payload48) => { + mbt_ffi_store8(iter_base + 0, 24) + + let ptr49 = mbt_ffi_bytes2ptr(payload48.bytes) + + mbt_ffi_store32(iter_base + 12, payload48.bytes.length()) + mbt_ffi_store32(iter_base + 8, ptr49) + + match payload48.mime_type { + None => { + mbt_ffi_store8(iter_base + 16, 0) + + () + } + Some(payload51) => { + mbt_ffi_store8(iter_base + 16, 1) + + let ptr52 = mbt_ffi_str2ptr(payload51) + mbt_ffi_store32(iter_base + 24, payload51.length()) + mbt_ffi_store32(iter_base + 20, ptr52) + + () + } + } + + () + } + PathValue(payload53) => { + mbt_ffi_store8(iter_base + 0, 25) + + let ptr54 = mbt_ffi_str2ptr(payload53) + mbt_ffi_store32(iter_base + 12, payload53.length()) + mbt_ffi_store32(iter_base + 8, ptr54) + + () + } + UrlValue(payload55) => { + mbt_ffi_store8(iter_base + 0, 26) + + let ptr56 = mbt_ffi_str2ptr(payload55) + mbt_ffi_store32(iter_base + 12, payload55.length()) + mbt_ffi_store32(iter_base + 8, ptr56) + + () + } + DatetimeValue(payload57) => { + mbt_ffi_store8(iter_base + 0, 27) + mbt_ffi_store64(iter_base + 8, payload57.seconds) + mbt_ffi_store32( + iter_base + 16, + payload57.nanoseconds.reinterpret_as_int(), + ) + + () + } + DurationValue(payload58) => { + mbt_ffi_store8(iter_base + 0, 28) + mbt_ffi_store64(iter_base + 8, payload58.nanoseconds) + + () + } + QuantityValueNode(payload59) => { + mbt_ffi_store8(iter_base + 0, 29) + mbt_ffi_store64(iter_base + 8, payload59.mantissa) + mbt_ffi_store32(iter_base + 16, payload59.scale) + + let ptr60 = mbt_ffi_str2ptr(payload59.unit) + mbt_ffi_store32(iter_base + 24, payload59.unit.length()) + mbt_ffi_store32(iter_base + 20, ptr60) + + () + } + UnionValue(payload61) => { + mbt_ffi_store8(iter_base + 0, 30) + + let ptr62 = mbt_ffi_str2ptr(payload61.tag) + mbt_ffi_store32(iter_base + 12, payload61.tag.length()) + mbt_ffi_store32(iter_base + 8, ptr62) + mbt_ffi_store32(iter_base + 16, payload61.body) + + () + } + SecretValue(payload63) => { + mbt_ffi_store8(iter_base + 0, 31) + + let Secret(handle) = payload63 + mbt_ffi_store32(iter_base + 8, handle) + + () + } + QuotaTokenHandle(payload64) => { + mbt_ffi_store8(iter_base + 0, 32) + + let QuotaToken(handle65) = payload64 + mbt_ffi_store32(iter_base + 8, handle65) + + () + } + StreamValue(payload66) => { + mbt_ffi_store8(iter_base + 0, 33) + + let SchemaValueStream(handle67) = payload66 + mbt_ffi_store32(iter_base + 8, handle67) + + () + } + } + } + mbt_ffi_store32(ptr + 4, value.value_nodes.length()) + mbt_ffi_store32(ptr + 0, address68) + mbt_ffi_store32(ptr + 8, value.root) +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0ListLift( + ptr : Int, + length : Int, +) -> FixedArray[SchemaValueTree] { + FixedArray::makei(length, index => { + let ptr = ptr + index * 12 + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lift(ptr) + }) +} + +///| +priv struct WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource { + handle : Int + mut closed : Bool + mut reading : Bool + mut read_task : Int + mut read_buffer : Int + mut read_discarding : Bool + mut read_cleanup_done : Bool + read_cleanup : @async-core.CondVar +} + +///| +fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::finish_read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit { + self.reading = false + self.read_task = 0 + self.read_buffer = 0 + self.read_discarding = false + // Keep completion latched until a later read starts so every waiter woken + // by the broadcast can observe it. +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::wait_for_read_cleanup( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit noraise { + @async-core.protect_from_cancel( + () => { + while !self.read_cleanup_done { + self.read_cleanup.wait() + } + }, + resume_on_cancel=true, + ) catch { + _ => () + } +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::cancel_active_read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit noraise { + if !self.reading { + return + } + if self.read_discarding { + self.wait_for_read_cleanup() + return + } + self.read_discarding = true + let progress_ref = Ref(0) + @async-core.protect_from_cancel( + () => { + progress_ref.val = @async-core.cancel_stream_read( + self.read_task, + self.handle, + () => { + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0CancelRead( + self.handle, + ) + }, + ) + }, + resume_on_cancel=true, + ) catch { + _ => () + } + let progress = progress_ref.val + if progress > 0 && self.read_buffer != 0 { + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject( + self.read_buffer, + 0, + progress, + ) + } + self.read_cleanup_done = true + self.read_cleanup.broadcast() +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::close( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit noraise { + if self.closed { + return + } + if self.reading { + self.cancel_active_read() + } + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + self.handle, + ) +} + +///| +fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::close_sync( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, +) -> Unit { + if self.closed || self.reading { + return + } + + if wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamRejectPrepared( + self.handle, + ) { + self.closed = true + return + } + + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + self.handle, + ) +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource, + count : Int, +) -> FixedArray[SchemaValueTree]? { + if self.closed { + return None + } + if count <= 0 { + return Some([]) + } + if self.reading { + raise @async-core.EndpointBusy::Read + } + // `Stream.read` promises at most `count`; bound one canonical allocation. + let read_count = if count < 64 { count } else { 64 } + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc( + read_count, + ) + let mut owns_buffer = false + defer (if !owns_buffer { mbt_ffi_free(ptr) }) + self.reading = true + self.read_task = @async-core.current_component_task_token() + self.read_buffer = ptr + self.read_discarding = false + self.read_cleanup_done = false + let (progress, end) = @async-core.suspend_for_stream_read( + self.handle, + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0Read( + self.handle, + ptr, + read_count, + ), + ) catch { + err => { + if self.read_discarding { + self.wait_for_read_cleanup() + self.finish_read() + return None + } + if err is @async-core.Cancelled::Cancelled { + self.cancel_active_read() + if !self.closed { + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + self.handle, + ) + } + } + self.finish_read() + raise err + } + } + if self.read_discarding { + self.wait_for_read_cleanup() + self.finish_read() + return None + } + if progress == 0 { + self.finish_read() + if end { + self.close() + return None + } + return Some([]) + } + let values = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0ListLift( + ptr, progress, + ) + owns_buffer = false + self.finish_read() + if end { + self.close() + } + Some(values) +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamLift( + handle : Int, +) -> @async-core.Stream[SchemaValueTree] { + let source = WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamSource::{ + handle, + closed: false, + reading: false, + read_task: 0, + read_buffer: 0, + read_discarding: false, + read_cleanup_done: false, + read_cleanup: CondVar(), + } + @async-core.Stream::from_source( + count => source.read(count), + () => source.close(), + () => source.close_sync(), + ) +} + +///| +priv struct WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducer { + stream : @async-core.Stream[SchemaValueTree] + writer : Int +} + +///| +let wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers : Map[ + Int, + WasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducer, +] = Map([]) + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamRejectPrepared( + handle : Int, +) -> Bool { + guard wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.get( + handle, + ) + is Some(prepared) else { + return false + } + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.remove( + handle, + ) + let writer = prepared.writer + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropReadable( + handle, + ) + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropWritable( + writer, + ) + @async-core.spawn_component_task_current(async fn() { + @async-core.protect_from_cancel( + () => { + prepared.stream.reject((value : SchemaValueTree) => { + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc( + 1, + ) + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lower( + value, ptr, + ) + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject( + ptr, 0, 1, + ) + mbt_ffi_free(ptr) + }) + }, + resume_on_cancel=true, + ) catch { + _ => () + } + }) + true +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamCommit( + handle : Int, +) -> Unit { + guard wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.get( + handle, + ) + is Some(prepared) else { + return + } + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.remove( + handle, + ) + let stream = prepared.stream + let writer = prepared.writer + if !@async-core.has_component_task_scope() { + abort("component stream producer requires an async task scope") + } + let producer = stream.take_producer() + @async-core.spawn_component_task_current(async fn() { + let writer_closed = Ref(false) + let writer_lock = @async-core.Mutex() + let close_writer = fn() -> Unit { + if !writer_closed.val { + writer_closed.val = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0DropWritable( + writer, + ) + } + } + let close_writer_serialized = async fn() -> Unit { + writer_lock.acquire() + defer writer_lock.release() + close_writer() + } + let cleanup_value = fn(value : SchemaValueTree) -> Unit { + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc(1) + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Lower(value, ptr) + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject(ptr, 0, 1) + mbt_ffi_free(ptr) + } + let sink = @async-core.Sink::from_callbacks( + (data : ArrayView[SchemaValueTree]) => { + writer_lock.acquire() + defer writer_lock.release() + if writer_closed.val || data.length() == 0 { + return 0 + } + let data_len = if data.length() < 64 { data.length() } else { 64 } + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Malloc( + data_len, + ) + for i in 0.. Unit { + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Commit( + ptr, 0, transferred, + ) + if transferred < data_len { + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0Reject( + ptr, + transferred, + data_len - transferred, + ) + } + mbt_ffi_free(ptr) + } + let mut total = 0 + let mut dropped = false + while total < data_len { + let (progress, end) = @async-core.suspend_for_stream_write( + writer, + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0Write( + writer, + ptr + total * 12, + data_len - total, + ), + ) catch { + _ => { + total = total + + @async-core.cancel_stream_write(writer, () => { + wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0CancelWrite( + writer, + ) + }) + settle_staging(total) + close_writer() + return data_len + } + } + total = total + progress + if end { + dropped = true + break + } + } + settle_staging(total) + if dropped { + close_writer() + } + // The canonical writer accepted `total`; generated cleanup + // consumed the rest of this staging window. + data_len + }, + () => close_writer_serialized(), + () => !writer_closed.val, + Some(cleanup_value), + ) + let relay_source = producer is None + let run_producer = async fn() -> Unit { + match producer { + Some(producer) => { + producer(sink) + sink.close() + } + None => + for ;; { + match stream.read(64) { + Some(data) => + if !sink.write_all(data[:]) { + stream.reject(cleanup_value) + return + } + None => { + sink.close() + return + } + } + } + } + } + run_producer() catch { + _ => + if relay_source { + @async-core.protect_from_cancel( + () => stream.reject(cleanup_value), + resume_on_cancel=true, + ) catch { + _ => () + } + } + } + // A retained Sink may still own an in-flight canonical write after its + // producer returns. Do not drop the writable endpoint until that write + // has reached a terminal event and released its staging buffer. + @async-core.protect_from_cancel( + () => close_writer_serialized(), + resume_on_cancel=true, + ) + }) +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamLower( + stream : @async-core.Stream[SchemaValueTree], +) -> Int { + if !@async-core.has_component_task_scope() { + abort("component stream producer requires an async task scope") + } + let pair = wasmImportGolemCoreTypes200StaticSchemaValueStreamWrapStream0New() + let reader = pair.to_int() + let writer = (pair >> 32).to_int() + wasmGolemCoreTypes200StaticSchemaValueStreamWrapStream0StreamProducers.set( + reader, + { stream, writer }, + ) + reader +} + +///| +fn wasmImportStaticSchemaValueStreamUnwrap(p0 : Int, p1 : Int) -> Int = "golem:core/types@2.0.0" "[async-lower][static]schema-value-stream.unwrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Read( + handle : Int, + buffer_ptr : Int, + length : Int, +) -> Int = "golem:core/types@2.0.0" "[async-lower][stream-read-0][static]schema-value-stream.unwrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0CancelRead( + handle : Int, +) -> Int = "golem:core/types@2.0.0" "[stream-cancel-read-0][static]schema-value-stream.unwrap" + +///| +fn wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0DropReadable( + handle : Int, +) = "golem:core/types@2.0.0" "[stream-drop-readable-0][static]schema-value-stream.unwrap" + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Malloc( + length : Int, +) -> Int { + let ptr = mbt_ffi_malloc(12 * length) + ptr +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Reject( + ptr : Int, + start : Int, + length : Int, +) -> Unit { + for i in start..<(start + length) { + let elem_ptr = ptr + i * 12 + + for index = 0; index < mbt_ffi_load32(elem_ptr + 4); index = index + 1 { + let iter_base = mbt_ffi_load32(elem_ptr + 0) + index * 32 + + match mbt_ffi_load8_u(iter_base + 0) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => () + 5 => () + 6 => () + 7 => () + 8 => () + 9 => () + 10 => () + 11 => () + 12 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 13 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 14 => () + 15 => () + 16 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 17 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 18 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 19 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 20 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 21 => () + 22 => () + 23 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 24 => { + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + match mbt_ffi_load8_u(iter_base + 16) { + 0 => () + 1 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + _ => panic() + } + } + 25 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 26 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 27 => () + 28 => () + 29 => mbt_ffi_free(mbt_ffi_load32(iter_base + 20)) + 30 => mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + 31 => Secret::Secret(mbt_ffi_load32(iter_base + 8)).drop() + 32 => QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)).drop() + 33 => + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(iter_base + 8)).drop() + _ => panic() + } + } + mbt_ffi_free(mbt_ffi_load32(elem_ptr + 0)) + } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Lift( + ptr : Int, +) -> SchemaValueTree { + let array25 : Array[SchemaValueNode] = [] + for index26 = 0; index26 < mbt_ffi_load32(ptr + 4); index26 = index26 + 1 { + let iter_base = mbt_ffi_load32(ptr + 0) + index26 * 32 + + let lifted24 = match mbt_ffi_load8_u(iter_base + 0) { + 0 => SchemaValueNode::BoolValue(mbt_ffi_load8_u(iter_base + 8) != 0) + 1 => SchemaValueNode::S8Value(mbt_ffi_load8(iter_base + 8)) + 2 => SchemaValueNode::S16Value(mbt_ffi_load16(iter_base + 8)) + 3 => SchemaValueNode::S32Value(mbt_ffi_load32(iter_base + 8)) + 4 => SchemaValueNode::S64Value(mbt_ffi_load64(iter_base + 8)) + 5 => SchemaValueNode::U8Value(mbt_ffi_load8_u(iter_base + 8).to_byte()) + 6 => + SchemaValueNode::U16Value( + mbt_ffi_load16_u(iter_base + 8).land(0xFFFF).reinterpret_as_uint(), + ) + 7 => + SchemaValueNode::U32Value( + mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + ) + 8 => + SchemaValueNode::U64Value( + mbt_ffi_load64(iter_base + 8).reinterpret_as_uint64(), + ) + 9 => SchemaValueNode::F32Value(mbt_ffi_loadf32(iter_base + 8)) + 10 => SchemaValueNode::F64Value(mbt_ffi_loadf64(iter_base + 8)) + 11 => + SchemaValueNode::CharValue( + Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), + ) + 12 => { + let result = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::StringValue(result) + } + 13 => { + let array : Array[Int] = [] + for index = 0; index < mbt_ffi_load32(iter_base + 12); index = index + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index * 4 + + array.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::RecordValue(array) + } + 14 => { + let lifted : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + SchemaValueNode::VariantValue(VariantValuePayload::{ + case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + payload: lifted, + }) + } + 15 => + SchemaValueNode::EnumValue( + mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), + ) + 16 => { + let array0 : Array[Bool] = [] + for index1 = 0 + index1 < mbt_ffi_load32(iter_base + 12) + index1 = index1 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index1 * 1 + + array0.push(mbt_ffi_load8_u(iter_base + 0) != 0) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::FlagsValue(array0) + } + 17 => { + let array2 : Array[Int] = [] + for index3 = 0 + index3 < mbt_ffi_load32(iter_base + 12) + index3 = index3 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index3 * 4 + + array2.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::TupleValue(array2) + } + 18 => { + let array4 : Array[Int] = [] + for index5 = 0 + index5 < mbt_ffi_load32(iter_base + 12) + index5 = index5 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index5 * 4 + + array4.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::ListValue(array4) + } + 19 => { + let array6 : Array[Int] = [] + for index7 = 0 + index7 < mbt_ffi_load32(iter_base + 12) + index7 = index7 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index7 * 4 + + array6.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::FixedListValue(array6) + } + 20 => { + let array8 : Array[MapEntry] = [] + for index9 = 0 + index9 < mbt_ffi_load32(iter_base + 12) + index9 = index9 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index9 * 8 + + array8.push(MapEntry::{ + key: mbt_ffi_load32(iter_base + 0), + value: mbt_ffi_load32(iter_base + 4), + }) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + SchemaValueNode::MapValue(array8) + } + 21 => { + let lifted10 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) + _ => panic() + } + + SchemaValueNode::OptionValue(lifted10) + } + 22 => { + let lifted13 = match mbt_ffi_load8_u(iter_base + 8) { + 0 => { + let lifted11 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + ResultValuePayload::OkValue(lifted11) + } + 1 => { + let lifted12 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + 0 => Option::None + 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) + _ => panic() + } + + ResultValuePayload::ErrValue(lifted12) + } + _ => panic() + } + + SchemaValueNode::ResultValue(lifted13) + } + 23 => { + let result14 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + let lifted16 : String? = match mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let result15 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + Option::Some(result15) + } + _ => panic() + } + + SchemaValueNode::TextValue(TextValuePayload::{ + text: result14, + language: lifted16, + }) + } + 24 => { + let result17 = mbt_ffi_ptr2bytes( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + let lifted19 : String? = match mbt_ffi_load8_u(iter_base + 16) { + 0 => Option::None + 1 => { + let result18 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + Option::Some(result18) + } + _ => panic() + } + + SchemaValueNode::BinaryValue(BinaryValuePayload::{ + bytes: result17, + mime_type: lifted19, + }) + } + 25 => { + let result20 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::PathValue(result20) + } + 26 => { + let result21 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::UrlValue(result21) + } + 27 => + SchemaValueNode::DatetimeValue(Datetime::{ + seconds: mbt_ffi_load64(iter_base + 8), + nanoseconds: mbt_ffi_load32(iter_base + 16).reinterpret_as_uint(), + }) + 28 => + SchemaValueNode::DurationValue(DurationValuePayload::{ + nanoseconds: mbt_ffi_load64(iter_base + 8), + }) + 29 => { + let result22 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 20), + mbt_ffi_load32(iter_base + 24), + ) + + SchemaValueNode::QuantityValueNode(QuantityValue::{ + mantissa: mbt_ffi_load64(iter_base + 8), + scale: mbt_ffi_load32(iter_base + 16), + unit: result22, + }) + } + 30 => { + let result23 = mbt_ffi_ptr2str( + mbt_ffi_load32(iter_base + 8), + mbt_ffi_load32(iter_base + 12), + ) + + SchemaValueNode::UnionValue(UnionValuePayload::{ + tag: result23, + body: mbt_ffi_load32(iter_base + 16), + }) + } + 31 => + SchemaValueNode::SecretValue( + Secret::Secret(mbt_ffi_load32(iter_base + 8)), + ) + 32 => + SchemaValueNode::QuotaTokenHandle( + QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), + ) + 33 => + SchemaValueNode::StreamValue( + SchemaValueStream::SchemaValueStream(mbt_ffi_load32(iter_base + 8)), + ) + _ => panic() + } + + array25.push(lifted24) + } + mbt_ffi_free(mbt_ffi_load32(ptr + 0)) + + SchemaValueTree::{ value_nodes: array25, root: mbt_ffi_load32(ptr + 8) } +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0ListLift( + ptr : Int, + length : Int, +) -> FixedArray[SchemaValueTree] { + FixedArray::makei(length, index => { + let ptr = ptr + index * 12 + wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Lift(ptr) + }) +} + +///| +priv struct WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource { + handle : Int + mut closed : Bool + mut reading : Bool + mut read_task : Int + mut read_buffer : Int + mut read_discarding : Bool + mut read_cleanup_done : Bool + read_cleanup : @async-core.CondVar +} + +///| +fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::finish_read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit { + self.reading = false + self.read_task = 0 + self.read_buffer = 0 + self.read_discarding = false + // Keep completion latched until a later read starts so every waiter woken + // by the broadcast can observe it. +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::wait_for_read_cleanup( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit noraise { + @async-core.protect_from_cancel( + () => { + while !self.read_cleanup_done { + self.read_cleanup.wait() + } + }, + resume_on_cancel=true, + ) catch { + _ => () + } +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::cancel_active_read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit noraise { + if !self.reading { + return + } + if self.read_discarding { + self.wait_for_read_cleanup() + return + } + self.read_discarding = true + let progress_ref = Ref(0) + @async-core.protect_from_cancel( + () => { + progress_ref.val = @async-core.cancel_stream_read( + self.read_task, + self.handle, + () => { + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0CancelRead( + self.handle, + ) + }, + ) + }, + resume_on_cancel=true, + ) catch { + _ => () + } + let progress = progress_ref.val + if progress > 0 && self.read_buffer != 0 { + wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Reject( + self.read_buffer, + 0, + progress, + ) + } + self.read_cleanup_done = true + self.read_cleanup.broadcast() +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::close( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit noraise { + if self.closed { + return + } + if self.reading { + self.cancel_active_read() + } + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0DropReadable( + self.handle, + ) +} + +///| +fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::close_sync( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, +) -> Unit { + if self.closed || self.reading { + return + } + + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0DropReadable( + self.handle, + ) +} + +///| +async fn WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::read( + self : WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource, + count : Int, +) -> FixedArray[SchemaValueTree]? { + if self.closed { + return None + } + if count <= 0 { + return Some([]) + } + if self.reading { + raise @async-core.EndpointBusy::Read + } + // `Stream.read` promises at most `count`; bound one canonical allocation. + let read_count = if count < 64 { count } else { 64 } + let ptr = wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Malloc( + read_count, + ) + let mut owns_buffer = false + defer (if !owns_buffer { mbt_ffi_free(ptr) }) + self.reading = true + self.read_task = @async-core.current_component_task_token() + self.read_buffer = ptr + self.read_discarding = false + self.read_cleanup_done = false + let (progress, end) = @async-core.suspend_for_stream_read( + self.handle, + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0Read( + self.handle, + ptr, + read_count, + ), + ) catch { + err => { + if self.read_discarding { + self.wait_for_read_cleanup() + self.finish_read() + return None + } + if err is @async-core.Cancelled::Cancelled { + self.cancel_active_read() + if !self.closed { + self.closed = true + wasmImportGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0DropReadable( + self.handle, + ) + } + } + self.finish_read() + raise err + } + } + if self.read_discarding { + self.wait_for_read_cleanup() + self.finish_read() + return None + } + if progress == 0 { + self.finish_read() + if end { + self.close() + return None + } + return Some([]) + } + let values = wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0ListLift( + ptr, progress, + ) + owns_buffer = false + self.finish_read() + if end { + self.close() + } + Some(values) +} + +///| +fn wasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamLift( + handle : Int, +) -> @async-core.Stream[SchemaValueTree] { + let source = WasmGolemCoreTypes200StaticSchemaValueStreamUnwrapStream0StreamSource::{ + handle, + closed: false, + reading: false, + read_task: 0, + read_buffer: 0, + read_discarding: false, + read_cleanup_done: false, + read_cleanup: CondVar(), + } + @async-core.Stream::from_source( + count => source.read(count), + () => source.close(), + () => source.close_sync(), + ) +} + +///| +#owned(bytes) +extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int = + #|(func (param i32) (result i32) local.get 0) ///| #owned(str) extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = #|(func (param i32) (result i32) local.get 0) +///| +extern "wasm" fn mbt_ffi_extend16(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend16_s) + +///| +extern "wasm" fn mbt_ffi_extend8(value : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.extend8_s) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = + #|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load16(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_s) + +///| +extern "wasm" fn mbt_ffi_load16_u(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load16_u) + ///| extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load) +///| +extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = + #|(func (param i32) (result i64) local.get 0 i64.load) + +///| +extern "wasm" fn mbt_ffi_load8(offset : Int) -> Int = + #|(func (param i32) (result i32) local.get 0 i32.load8_s) + ///| extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = #|(func (param i32) (result i32) local.get 0 i32.load8_u) ///| -extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 = - #|(func (param i32) (result i64) local.get 0 i64.load) +extern "wasm" fn mbt_ffi_loadf32(offset : Int) -> Float = + #|(func (param i32) (result f32) local.get 0 f32.load) ///| -extern "wasm" fn mbt_ffi_free(position : Int) = - #|(func (param i32) local.get 0 call $moonbit.decref) +extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double = + #|(func (param i32) (result f64) local.get 0 f64.load) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = + #|(func (param i32) (result i32) (local i32) + #| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc + #| local.tee 1 i32.const 0 call $moonbit.init_array8 + #| local.get 1) + +///| +extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] = + #|(func (param i32) (param i32) (result i32) + #| local.get 0 + #| local.get 1 call $moonbit.init_array8 + #| local.get 0) ///| extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = @@ -46,3 +2037,27 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = #| local.get 0 #| local.get 1 call $moonbit.init_array16 #| local.get 0) + +///| +extern "wasm" fn mbt_ffi_store16(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store16) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) = + #|(func (param i32) (param i64) local.get 0 local.get 1 i64.store) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = + #|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_storef32(offset : Int, value : Float) = + #|(func (param i32) (param f32) local.get 0 local.get 1 f32.store) + +///| +extern "wasm" fn mbt_ffi_storef64(offset : Int, value : Double) = + #|(func (param i32) (param f64) local.get 0 local.get 1 f64.store) diff --git a/sdks/moonbit/golem_sdk/interface/golem/durability/durability/top.mbt b/sdks/moonbit/golem_sdk/interface/golem/durability/durability/top.mbt index b97a92d81b..6989cb5d07 100644 --- a/sdks/moonbit/golem_sdk/interface/golem/durability/durability/top.mbt +++ b/sdks/moonbit/golem_sdk/interface/golem/durability/durability/top.mbt @@ -2453,12 +2453,12 @@ pub fn LiveCustomDurableInvocation::finish( cleanup_list.push(ptr359) } - let address435 = mbt_ffi_malloc(response.value.value_nodes.length() * 32) - for index436 = 0 - index436 < response.value.value_nodes.length() - index436 = index436 + 1 { - let iter_elem : @types.SchemaValueNode = response.value.value_nodes[index436] - let iter_base = address435 + index436 * 32 + let address437 = mbt_ffi_malloc(response.value.value_nodes.length() * 32) + for index438 = 0 + index438 < response.value.value_nodes.length() + index438 = index438 + 1 { + let iter_elem : @types.SchemaValueNode = response.value.value_nodes[index438] + let iter_base = address437 + index438 * 32 match iter_elem { BoolValue(payload365) => { @@ -2867,6 +2867,14 @@ pub fn LiveCustomDurableInvocation::finish( let @types.QuotaToken(handle434) = payload433 mbt_ffi_store32(iter_base + 8, handle434) + () + } + StreamValue(payload435) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle436) = payload435 + mbt_ffi_store32(iter_base + 8, handle436) + () } } @@ -2878,7 +2886,7 @@ pub fn LiveCustomDurableInvocation::finish( address363, response.graph.defs.length(), response.graph.root, - address435, + address437, response.value.value_nodes.length(), response.value.root, if forced_commit { @@ -2889,7 +2897,7 @@ pub fn LiveCustomDurableInvocation::finish( ) mbt_ffi_free(address357) mbt_ffi_free(address363) - mbt_ffi_free(address435) + mbt_ffi_free(address437) cleanup_list.each(mbt_ffi_free) } @@ -5301,12 +5309,12 @@ pub fn begin_custom_durable_invocation( cleanup_list.push(ptr360) } - let address435 = mbt_ffi_malloc(request.value.value_nodes.length() * 32) - for index436 = 0 - index436 < request.value.value_nodes.length() - index436 = index436 + 1 { - let iter_elem : @types.SchemaValueNode = request.value.value_nodes[index436] - let iter_base = address435 + index436 * 32 + let address437 = mbt_ffi_malloc(request.value.value_nodes.length() * 32) + for index438 = 0 + index438 < request.value.value_nodes.length() + index438 = index438 + 1 { + let iter_elem : @types.SchemaValueNode = request.value.value_nodes[index438] + let iter_base = address437 + index438 * 32 match iter_elem { BoolValue(payload366) => { @@ -5715,31 +5723,39 @@ pub fn begin_custom_durable_invocation( let @types.QuotaToken(handle434) = payload433 mbt_ffi_store32(iter_base + 8, handle434) + () + } + StreamValue(payload435) => { + mbt_ffi_store8(iter_base + 0, 33) + + let @types.SchemaValueStream(handle436) = payload435 + mbt_ffi_store32(iter_base + 8, handle436) + () } } } - let (lowered450, lowered451, lowered452) = match function_type { + let (lowered452, lowered453, lowered454) = match function_type { ReadLocal => (0, 0, 0L) WriteLocal => (1, 0, 0L) ReadRemote => (2, 0, 0L) WriteRemote => (3, 0, 0L) - WriteRemoteBatched(payload441) => { - let (lowered, lowered444) = match payload441 { + WriteRemoteBatched(payload443) => { + let (lowered, lowered446) = match payload443 { None => (0, 0L) - Some(payload443) => (1, payload443.reinterpret_as_int64()) + Some(payload445) => (1, payload445.reinterpret_as_int64()) } - (4, lowered, lowered444) + (4, lowered, lowered446) } - WriteRemoteTransaction(payload445) => { - let (lowered448, lowered449) = match payload445 { + WriteRemoteTransaction(payload447) => { + let (lowered450, lowered451) = match payload447 { None => (0, 0L) - Some(payload447) => (1, payload447.reinterpret_as_int64()) + Some(payload449) => (1, payload449.reinterpret_as_int64()) } - (5, lowered448, lowered449) + (5, lowered450, lowered451) } } let return_area = mbt_ffi_malloc(96) @@ -5751,16 +5767,16 @@ pub fn begin_custom_durable_invocation( address364, request.graph.defs.length(), request.graph.root, - address435, + address437, request.value.value_nodes.length(), request.value.root, - lowered450, - lowered451, lowered452, + lowered453, + lowered454, return_area, ) - let lifted688 = match mbt_ffi_load8_u(return_area + 0) { + let lifted690 = match mbt_ffi_load8_u(return_area + 0) { 0 => CustomDurableInvocation::Live( LiveCustomDurableInvocation::LiveCustomDurableInvocation( @@ -5773,21 +5789,21 @@ pub fn begin_custom_durable_invocation( mbt_ffi_load32(return_area + 28), ) - let array647 : Array[@types.SchemaTypeNode] = [] - for index648 = 0 - index648 < mbt_ffi_load32(return_area + 36) - index648 = index648 + 1 { - let iter_base = mbt_ffi_load32(return_area + 32) + index648 * 144 + let array649 : Array[@types.SchemaTypeNode] = [] + for index650 = 0 + index650 < mbt_ffi_load32(return_area + 36) + index650 = index650 + 1 { + let iter_base = mbt_ffi_load32(return_area + 32) + index650 * 144 - let lifted633 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted635 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaTypeBody::RefType(mbt_ffi_load32(iter_base + 8)) 1 => @types.SchemaTypeBody::BoolType 2 => { - let lifted458 : @types.NumericRestrictions? = match + let lifted460 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted453 : @types.NumericBound? = match + let lifted455 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { @@ -5812,11 +5828,11 @@ pub fn begin_custom_durable_invocation( _ => panic() } - let lifted455 : @types.NumericBound? = match + let lifted457 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted454 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted456 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -5832,46 +5848,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted454) + Option::Some(lifted456) } _ => panic() } - let lifted457 : String? = match + let lifted459 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result456 = mbt_ffi_ptr2str( + let result458 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result456) + Option::Some(result458) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted453, - max: lifted455, - unit: lifted457, + min: lifted455, + max: lifted457, + unit: lifted459, }) } _ => panic() } - @types.SchemaTypeBody::S8Type(lifted458) + @types.SchemaTypeBody::S8Type(lifted460) } 3 => { - let lifted465 : @types.NumericRestrictions? = match + let lifted467 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted460 : @types.NumericBound? = match + let lifted462 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted459 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted461 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -5887,16 +5903,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted459) + Option::Some(lifted461) } _ => panic() } - let lifted462 : @types.NumericBound? = match + let lifted464 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted461 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted463 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -5912,46 +5928,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted461) + Option::Some(lifted463) } _ => panic() } - let lifted464 : String? = match + let lifted466 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result463 = mbt_ffi_ptr2str( + let result465 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result463) + Option::Some(result465) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted460, - max: lifted462, - unit: lifted464, + min: lifted462, + max: lifted464, + unit: lifted466, }) } _ => panic() } - @types.SchemaTypeBody::S16Type(lifted465) + @types.SchemaTypeBody::S16Type(lifted467) } 4 => { - let lifted472 : @types.NumericRestrictions? = match + let lifted474 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted467 : @types.NumericBound? = match + let lifted469 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted466 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted468 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -5967,16 +5983,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted466) + Option::Some(lifted468) } _ => panic() } - let lifted469 : @types.NumericBound? = match + let lifted471 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted468 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted470 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -5992,46 +6008,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted468) + Option::Some(lifted470) } _ => panic() } - let lifted471 : String? = match + let lifted473 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result470 = mbt_ffi_ptr2str( + let result472 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result470) + Option::Some(result472) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted467, - max: lifted469, - unit: lifted471, + min: lifted469, + max: lifted471, + unit: lifted473, }) } _ => panic() } - @types.SchemaTypeBody::S32Type(lifted472) + @types.SchemaTypeBody::S32Type(lifted474) } 5 => { - let lifted479 : @types.NumericRestrictions? = match + let lifted481 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted474 : @types.NumericBound? = match + let lifted476 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted473 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted475 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -6047,16 +6063,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted473) + Option::Some(lifted475) } _ => panic() } - let lifted476 : @types.NumericBound? = match + let lifted478 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted475 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted477 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -6072,46 +6088,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted475) + Option::Some(lifted477) } _ => panic() } - let lifted478 : String? = match + let lifted480 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result477 = mbt_ffi_ptr2str( + let result479 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result477) + Option::Some(result479) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted474, - max: lifted476, - unit: lifted478, + min: lifted476, + max: lifted478, + unit: lifted480, }) } _ => panic() } - @types.SchemaTypeBody::S64Type(lifted479) + @types.SchemaTypeBody::S64Type(lifted481) } 6 => { - let lifted486 : @types.NumericRestrictions? = match + let lifted488 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted481 : @types.NumericBound? = match + let lifted483 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted480 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted482 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -6127,16 +6143,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted480) + Option::Some(lifted482) } _ => panic() } - let lifted483 : @types.NumericBound? = match + let lifted485 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted482 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted484 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -6152,46 +6168,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted482) + Option::Some(lifted484) } _ => panic() } - let lifted485 : String? = match + let lifted487 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result484 = mbt_ffi_ptr2str( + let result486 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result484) + Option::Some(result486) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted481, - max: lifted483, - unit: lifted485, + min: lifted483, + max: lifted485, + unit: lifted487, }) } _ => panic() } - @types.SchemaTypeBody::U8Type(lifted486) + @types.SchemaTypeBody::U8Type(lifted488) } 7 => { - let lifted493 : @types.NumericRestrictions? = match + let lifted495 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted488 : @types.NumericBound? = match + let lifted490 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted487 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted489 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -6207,16 +6223,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted487) + Option::Some(lifted489) } _ => panic() } - let lifted490 : @types.NumericBound? = match + let lifted492 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted489 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted491 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -6232,46 +6248,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted489) + Option::Some(lifted491) } _ => panic() } - let lifted492 : String? = match + let lifted494 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result491 = mbt_ffi_ptr2str( + let result493 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result491) + Option::Some(result493) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted488, - max: lifted490, - unit: lifted492, + min: lifted490, + max: lifted492, + unit: lifted494, }) } _ => panic() } - @types.SchemaTypeBody::U16Type(lifted493) + @types.SchemaTypeBody::U16Type(lifted495) } 8 => { - let lifted500 : @types.NumericRestrictions? = match + let lifted502 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted495 : @types.NumericBound? = match + let lifted497 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted494 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted496 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -6287,16 +6303,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted494) + Option::Some(lifted496) } _ => panic() } - let lifted497 : @types.NumericBound? = match + let lifted499 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted496 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted498 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -6312,46 +6328,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted496) + Option::Some(lifted498) } _ => panic() } - let lifted499 : String? = match + let lifted501 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result498 = mbt_ffi_ptr2str( + let result500 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result498) + Option::Some(result500) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted495, - max: lifted497, - unit: lifted499, + min: lifted497, + max: lifted499, + unit: lifted501, }) } _ => panic() } - @types.SchemaTypeBody::U32Type(lifted500) + @types.SchemaTypeBody::U32Type(lifted502) } 9 => { - let lifted507 : @types.NumericRestrictions? = match + let lifted509 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted502 : @types.NumericBound? = match + let lifted504 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted501 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted503 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -6367,16 +6383,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted501) + Option::Some(lifted503) } _ => panic() } - let lifted504 : @types.NumericBound? = match + let lifted506 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted503 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted505 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -6392,46 +6408,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted503) + Option::Some(lifted505) } _ => panic() } - let lifted506 : String? = match + let lifted508 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result505 = mbt_ffi_ptr2str( + let result507 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result505) + Option::Some(result507) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted502, - max: lifted504, - unit: lifted506, + min: lifted504, + max: lifted506, + unit: lifted508, }) } _ => panic() } - @types.SchemaTypeBody::U64Type(lifted507) + @types.SchemaTypeBody::U64Type(lifted509) } 10 => { - let lifted514 : @types.NumericRestrictions? = match + let lifted516 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted509 : @types.NumericBound? = match + let lifted511 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted508 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted510 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -6447,16 +6463,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted508) + Option::Some(lifted510) } _ => panic() } - let lifted511 : @types.NumericBound? = match + let lifted513 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted510 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted512 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -6472,46 +6488,46 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted510) + Option::Some(lifted512) } _ => panic() } - let lifted513 : String? = match + let lifted515 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result512 = mbt_ffi_ptr2str( + let result514 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result512) + Option::Some(result514) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted509, - max: lifted511, - unit: lifted513, + min: lifted511, + max: lifted513, + unit: lifted515, }) } _ => panic() } - @types.SchemaTypeBody::F32Type(lifted514) + @types.SchemaTypeBody::F32Type(lifted516) } 11 => { - let lifted521 : @types.NumericRestrictions? = match + let lifted523 : @types.NumericRestrictions? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let lifted516 : @types.NumericBound? = match + let lifted518 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let lifted515 = match mbt_ffi_load8_u(iter_base + 24) { + let lifted517 = match mbt_ffi_load8_u(iter_base + 24) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 32), @@ -6527,16 +6543,16 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted515) + Option::Some(lifted517) } _ => panic() } - let lifted518 : @types.NumericBound? = match + let lifted520 : @types.NumericBound? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let lifted517 = match mbt_ffi_load8_u(iter_base + 48) { + let lifted519 = match mbt_ffi_load8_u(iter_base + 48) { 0 => @types.NumericBound::Signed( mbt_ffi_load64(iter_base + 56), @@ -6552,308 +6568,308 @@ pub fn begin_custom_durable_invocation( _ => panic() } - Option::Some(lifted517) + Option::Some(lifted519) } _ => panic() } - let lifted520 : String? = match + let lifted522 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result519 = mbt_ffi_ptr2str( + let result521 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result519) + Option::Some(result521) } _ => panic() } Option::Some(@types.NumericRestrictions::{ - min: lifted516, - max: lifted518, - unit: lifted520, + min: lifted518, + max: lifted520, + unit: lifted522, }) } _ => panic() } - @types.SchemaTypeBody::F64Type(lifted521) + @types.SchemaTypeBody::F64Type(lifted523) } 12 => @types.SchemaTypeBody::CharType 13 => @types.SchemaTypeBody::StringType 14 => { - let array535 : Array[@types.NamedFieldType] = [] - for index536 = 0 - index536 < mbt_ffi_load32(iter_base + 12) - index536 = index536 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index536 * 68 + let array537 : Array[@types.NamedFieldType] = [] + for index538 = 0 + index538 < mbt_ffi_load32(iter_base + 12) + index538 = index538 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index538 * 68 - let result522 = mbt_ffi_ptr2str( + let result524 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted524 : String? = match mbt_ffi_load8_u(iter_base + 12) { + let lifted526 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result523 = mbt_ffi_ptr2str( + let result525 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result523) + Option::Some(result525) } _ => panic() } let array : Array[String] = [] - for index526 = 0 - index526 < mbt_ffi_load32(iter_base + 28) - index526 = index526 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 24) + index526 * 8 + for index528 = 0 + index528 < mbt_ffi_load32(iter_base + 28) + index528 = index528 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 24) + index528 * 8 - let result525 = mbt_ffi_ptr2str( + let result527 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array.push(result525) + array.push(result527) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - let array528 : Array[String] = [] - for index529 = 0 - index529 < mbt_ffi_load32(iter_base + 36) - index529 = index529 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 32) + index529 * 8 + let array530 : Array[String] = [] + for index531 = 0 + index531 < mbt_ffi_load32(iter_base + 36) + index531 = index531 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 32) + index531 * 8 - let result527 = mbt_ffi_ptr2str( + let result529 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array528.push(result527) + array530.push(result529) } mbt_ffi_free(mbt_ffi_load32(iter_base + 32)) - let lifted531 : String? = match mbt_ffi_load8_u(iter_base + 40) { + let lifted533 : String? = match mbt_ffi_load8_u(iter_base + 40) { 0 => Option::None 1 => { - let result530 = mbt_ffi_ptr2str( + let result532 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) - Option::Some(result530) + Option::Some(result532) } _ => panic() } - let lifted534 : @types.Role? = match + let lifted536 : @types.Role? = match mbt_ffi_load8_u(iter_base + 52) { 0 => Option::None 1 => { - let lifted533 = match mbt_ffi_load8_u(iter_base + 56) { + let lifted535 = match mbt_ffi_load8_u(iter_base + 56) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result532 = mbt_ffi_ptr2str( + let result534 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 60), mbt_ffi_load32(iter_base + 64), ) - @types.Role::Other(result532) + @types.Role::Other(result534) } _ => panic() } - Option::Some(lifted533) + Option::Some(lifted535) } _ => panic() } - array535.push(@types.NamedFieldType::{ - name: result522, + array537.push(@types.NamedFieldType::{ + name: result524, body: mbt_ffi_load32(iter_base + 8), metadata: @types.MetadataEnvelope::{ - doc: lifted524, + doc: lifted526, aliases: array, - examples: array528, - deprecated: lifted531, - role: lifted534, + examples: array530, + deprecated: lifted533, + role: lifted536, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::RecordType(array535) + @types.SchemaTypeBody::RecordType(array537) } 15 => { - let array552 : Array[@types.VariantCaseType] = [] - for index553 = 0 - index553 < mbt_ffi_load32(iter_base + 12) - index553 = index553 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index553 * 72 + let array554 : Array[@types.VariantCaseType] = [] + for index555 = 0 + index555 < mbt_ffi_load32(iter_base + 12) + index555 = index555 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index555 * 72 - let result537 = mbt_ffi_ptr2str( + let result539 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted538 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted540 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted540 : String? = match mbt_ffi_load8_u(iter_base + 16) { + let lifted542 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result539 = mbt_ffi_ptr2str( + let result541 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result539) + Option::Some(result541) } _ => panic() } - let array542 : Array[String] = [] - for index543 = 0 - index543 < mbt_ffi_load32(iter_base + 32) - index543 = index543 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 28) + index543 * 8 + let array544 : Array[String] = [] + for index545 = 0 + index545 < mbt_ffi_load32(iter_base + 32) + index545 = index545 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 28) + index545 * 8 - let result541 = mbt_ffi_ptr2str( + let result543 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array542.push(result541) + array544.push(result543) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - let array545 : Array[String] = [] - for index546 = 0 - index546 < mbt_ffi_load32(iter_base + 40) - index546 = index546 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 36) + index546 * 8 + let array547 : Array[String] = [] + for index548 = 0 + index548 < mbt_ffi_load32(iter_base + 40) + index548 = index548 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 36) + index548 * 8 - let result544 = mbt_ffi_ptr2str( + let result546 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array545.push(result544) + array547.push(result546) } mbt_ffi_free(mbt_ffi_load32(iter_base + 36)) - let lifted548 : String? = match mbt_ffi_load8_u(iter_base + 44) { + let lifted550 : String? = match mbt_ffi_load8_u(iter_base + 44) { 0 => Option::None 1 => { - let result547 = mbt_ffi_ptr2str( + let result549 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 48), mbt_ffi_load32(iter_base + 52), ) - Option::Some(result547) + Option::Some(result549) } _ => panic() } - let lifted551 : @types.Role? = match + let lifted553 : @types.Role? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let lifted550 = match mbt_ffi_load8_u(iter_base + 60) { + let lifted552 = match mbt_ffi_load8_u(iter_base + 60) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result549 = mbt_ffi_ptr2str( + let result551 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 64), mbt_ffi_load32(iter_base + 68), ) - @types.Role::Other(result549) + @types.Role::Other(result551) } _ => panic() } - Option::Some(lifted550) + Option::Some(lifted552) } _ => panic() } - array552.push(@types.VariantCaseType::{ - name: result537, - payload: lifted538, + array554.push(@types.VariantCaseType::{ + name: result539, + payload: lifted540, metadata: @types.MetadataEnvelope::{ - doc: lifted540, - aliases: array542, - examples: array545, - deprecated: lifted548, - role: lifted551, + doc: lifted542, + aliases: array544, + examples: array547, + deprecated: lifted550, + role: lifted553, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::VariantType(array552) + @types.SchemaTypeBody::VariantType(array554) } 16 => { - let array555 : Array[String] = [] - for index556 = 0 - index556 < mbt_ffi_load32(iter_base + 12) - index556 = index556 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index556 * 8 + let array557 : Array[String] = [] + for index558 = 0 + index558 < mbt_ffi_load32(iter_base + 12) + index558 = index558 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index558 * 8 - let result554 = mbt_ffi_ptr2str( + let result556 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array555.push(result554) + array557.push(result556) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::EnumType(array555) + @types.SchemaTypeBody::EnumType(array557) } 17 => { - let array558 : Array[String] = [] - for index559 = 0 - index559 < mbt_ffi_load32(iter_base + 12) - index559 = index559 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index559 * 8 + let array560 : Array[String] = [] + for index561 = 0 + index561 < mbt_ffi_load32(iter_base + 12) + index561 = index561 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index561 * 8 - let result557 = mbt_ffi_ptr2str( + let result559 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array558.push(result557) + array560.push(result559) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::FlagsType(array558) + @types.SchemaTypeBody::FlagsType(array560) } 18 => { - let array560 : Array[Int] = [] - for index561 = 0 - index561 < mbt_ffi_load32(iter_base + 12) - index561 = index561 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index561 * 4 + let array562 : Array[Int] = [] + for index563 = 0 + index563 < mbt_ffi_load32(iter_base + 12) + index563 = index563 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index563 * 4 - array560.push(mbt_ffi_load32(iter_base + 0)) + array562.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaTypeBody::TupleType(array560) + @types.SchemaTypeBody::TupleType(array562) } 19 => @types.SchemaTypeBody::ListType(mbt_ffi_load32(iter_base + 8)) 20 => @@ -6868,49 +6884,49 @@ pub fn begin_custom_durable_invocation( }) 22 => @types.SchemaTypeBody::OptionType(mbt_ffi_load32(iter_base + 8)) 23 => { - let lifted562 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted564 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - let lifted563 : Int? = match mbt_ffi_load8_u(iter_base + 16) { + let lifted565 : Int? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 20)) _ => panic() } @types.SchemaTypeBody::ResultType(@types.ResultSpec::{ - ok: lifted562, - err: lifted563, + ok: lifted564, + err: lifted565, }) } 24 => { - let lifted567 : Array[String]? = match + let lifted569 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array565 : Array[String] = [] - for index566 = 0 - index566 < mbt_ffi_load32(iter_base + 16) - index566 = index566 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 12) + index566 * 8 + let array567 : Array[String] = [] + for index568 = 0 + index568 < mbt_ffi_load32(iter_base + 16) + index568 = index568 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 12) + index568 * 8 - let result564 = mbt_ffi_ptr2str( + let result566 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array565.push(result564) + array567.push(result566) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array565) + Option::Some(array567) } _ => panic() } - let lifted568 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { + let lifted570 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => Option::Some( @@ -6919,7 +6935,7 @@ pub fn begin_custom_durable_invocation( _ => panic() } - let lifted569 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { + let lifted571 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => Option::Some( @@ -6928,52 +6944,52 @@ pub fn begin_custom_durable_invocation( _ => panic() } - let lifted571 : String? = match mbt_ffi_load8_u(iter_base + 36) { + let lifted573 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result570 = mbt_ffi_ptr2str( + let result572 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result570) + Option::Some(result572) } _ => panic() } @types.SchemaTypeBody::TextType(@types.TextRestrictions::{ - languages: lifted567, - min_length: lifted568, - max_length: lifted569, - regex: lifted571, + languages: lifted569, + min_length: lifted570, + max_length: lifted571, + regex: lifted573, }) } 25 => { - let lifted575 : Array[String]? = match + let lifted577 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array573 : Array[String] = [] - for index574 = 0 - index574 < mbt_ffi_load32(iter_base + 16) - index574 = index574 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 12) + index574 * 8 + let array575 : Array[String] = [] + for index576 = 0 + index576 < mbt_ffi_load32(iter_base + 16) + index576 = index576 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 12) + index576 * 8 - let result572 = mbt_ffi_ptr2str( + let result574 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array573.push(result572) + array575.push(result574) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array573) + Option::Some(array575) } _ => panic() } - let lifted576 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { + let lifted578 : UInt? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => Option::Some( @@ -6982,7 +6998,7 @@ pub fn begin_custom_durable_invocation( _ => panic() } - let lifted577 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { + let lifted579 : UInt? = match mbt_ffi_load8_u(iter_base + 28) { 0 => Option::None 1 => Option::Some( @@ -6992,56 +7008,56 @@ pub fn begin_custom_durable_invocation( } @types.SchemaTypeBody::BinaryType(@types.BinaryRestrictions::{ - mime_types: lifted575, - min_bytes: lifted576, - max_bytes: lifted577, + mime_types: lifted577, + min_bytes: lifted578, + max_bytes: lifted579, }) } 26 => { - let lifted581 : Array[String]? = match + let lifted583 : Array[String]? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let array579 : Array[String] = [] - for index580 = 0 - index580 < mbt_ffi_load32(iter_base + 20) - index580 = index580 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 16) + index580 * 8 + let array581 : Array[String] = [] + for index582 = 0 + index582 < mbt_ffi_load32(iter_base + 20) + index582 = index582 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 16) + index582 * 8 - let result578 = mbt_ffi_ptr2str( + let result580 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array579.push(result578) + array581.push(result580) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - Option::Some(array579) + Option::Some(array581) } _ => panic() } - let lifted585 : Array[String]? = match + let lifted587 : Array[String]? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let array583 : Array[String] = [] - for index584 = 0 - index584 < mbt_ffi_load32(iter_base + 32) - index584 = index584 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 28) + index584 * 8 + let array585 : Array[String] = [] + for index586 = 0 + index586 < mbt_ffi_load32(iter_base + 32) + index586 = index586 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 28) + index586 * 8 - let result582 = mbt_ffi_ptr2str( + let result584 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array583.push(result582) + array585.push(result584) } mbt_ffi_free(mbt_ffi_load32(iter_base + 28)) - Option::Some(array583) + Option::Some(array585) } _ => panic() } @@ -7051,92 +7067,92 @@ pub fn begin_custom_durable_invocation( mbt_ffi_load8_u(iter_base + 8), ), kind: @types.PathKind::from(mbt_ffi_load8_u(iter_base + 9)), - allowed_mime_types: lifted581, - allowed_extensions: lifted585, + allowed_mime_types: lifted583, + allowed_extensions: lifted587, }) } 27 => { - let lifted589 : Array[String]? = match + let lifted591 : Array[String]? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let array587 : Array[String] = [] - for index588 = 0 - index588 < mbt_ffi_load32(iter_base + 16) - index588 = index588 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 12) + index588 * 8 + let array589 : Array[String] = [] + for index590 = 0 + index590 < mbt_ffi_load32(iter_base + 16) + index590 = index590 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 12) + index590 * 8 - let result586 = mbt_ffi_ptr2str( + let result588 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array587.push(result586) + array589.push(result588) } mbt_ffi_free(mbt_ffi_load32(iter_base + 12)) - Option::Some(array587) + Option::Some(array589) } _ => panic() } - let lifted593 : Array[String]? = match + let lifted595 : Array[String]? = match mbt_ffi_load8_u(iter_base + 20) { 0 => Option::None 1 => { - let array591 : Array[String] = [] - for index592 = 0 - index592 < mbt_ffi_load32(iter_base + 28) - index592 = index592 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 24) + index592 * 8 + let array593 : Array[String] = [] + for index594 = 0 + index594 < mbt_ffi_load32(iter_base + 28) + index594 = index594 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 24) + index594 * 8 - let result590 = mbt_ffi_ptr2str( + let result592 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array591.push(result590) + array593.push(result592) } mbt_ffi_free(mbt_ffi_load32(iter_base + 24)) - Option::Some(array591) + Option::Some(array593) } _ => panic() } @types.SchemaTypeBody::UrlType(@types.UrlRestrictions::{ - allowed_schemes: lifted589, - allowed_hosts: lifted593, + allowed_schemes: lifted591, + allowed_hosts: lifted595, }) } 28 => @types.SchemaTypeBody::DatetimeType 29 => @types.SchemaTypeBody::DurationType 30 => { - let result594 = mbt_ffi_ptr2str( + let result596 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let array596 : Array[String] = [] - for index597 = 0 - index597 < mbt_ffi_load32(iter_base + 20) - index597 = index597 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 16) + index597 * 8 + let array598 : Array[String] = [] + for index599 = 0 + index599 < mbt_ffi_load32(iter_base + 20) + index599 = index599 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 16) + index599 * 8 - let result595 = mbt_ffi_ptr2str( + let result597 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array596.push(result595) + array598.push(result597) } mbt_ffi_free(mbt_ffi_load32(iter_base + 16)) - let lifted599 : @types.QuantityValue? = match + let lifted601 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result598 = mbt_ffi_ptr2str( + let result600 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 44), mbt_ffi_load32(iter_base + 48), ) @@ -7144,17 +7160,17 @@ pub fn begin_custom_durable_invocation( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 32), scale: mbt_ffi_load32(iter_base + 40), - unit: result598, + unit: result600, }) } _ => panic() } - let lifted601 : @types.QuantityValue? = match + let lifted603 : @types.QuantityValue? = match mbt_ffi_load8_u(iter_base + 56) { 0 => Option::None 1 => { - let result600 = mbt_ffi_ptr2str( + let result602 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 76), mbt_ffi_load32(iter_base + 80), ) @@ -7162,388 +7178,388 @@ pub fn begin_custom_durable_invocation( Option::Some(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 64), scale: mbt_ffi_load32(iter_base + 72), - unit: result600, + unit: result602, }) } _ => panic() } @types.SchemaTypeBody::QuantityType(@types.QuantitySpec::{ - base_unit: result594, - allowed_suffixes: array596, - min: lifted599, - max: lifted601, + base_unit: result596, + allowed_suffixes: array598, + min: lifted601, + max: lifted603, }) } 31 => { - let array625 : Array[@types.UnionBranch] = [] - for index626 = 0 - index626 < mbt_ffi_load32(iter_base + 12) - index626 = index626 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index626 * 92 + let array627 : Array[@types.UnionBranch] = [] + for index628 = 0 + index628 < mbt_ffi_load32(iter_base + 12) + index628 = index628 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index628 * 92 - let result602 = mbt_ffi_ptr2str( + let result604 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted611 = match mbt_ffi_load8_u(iter_base + 12) { + let lifted613 = match mbt_ffi_load8_u(iter_base + 12) { 0 => { - let result603 = mbt_ffi_ptr2str( + let result605 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Prefix(result603) + @types.DiscriminatorRule::Prefix(result605) } 1 => { - let result604 = mbt_ffi_ptr2str( + let result606 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Suffix(result604) + @types.DiscriminatorRule::Suffix(result606) } 2 => { - let result605 = mbt_ffi_ptr2str( + let result607 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Contains(result605) + @types.DiscriminatorRule::Contains(result607) } 3 => { - let result606 = mbt_ffi_ptr2str( + let result608 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::Regex(result606) + @types.DiscriminatorRule::Regex(result608) } 4 => { - let result607 = mbt_ffi_ptr2str( + let result609 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - let lifted609 : String? = match + let lifted611 : String? = match mbt_ffi_load8_u(iter_base + 24) { 0 => Option::None 1 => { - let result608 = mbt_ffi_ptr2str( + let result610 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 28), mbt_ffi_load32(iter_base + 32), ) - Option::Some(result608) + Option::Some(result610) } _ => panic() } @types.DiscriminatorRule::FieldEquals(@types.FieldDiscriminator::{ - field_name: result607, - literal: lifted609, + field_name: result609, + literal: lifted611, }) } 5 => { - let result610 = mbt_ffi_ptr2str( + let result612 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - @types.DiscriminatorRule::FieldAbsent(result610) + @types.DiscriminatorRule::FieldAbsent(result612) } _ => panic() } - let lifted613 : String? = match mbt_ffi_load8_u(iter_base + 36) { + let lifted615 : String? = match mbt_ffi_load8_u(iter_base + 36) { 0 => Option::None 1 => { - let result612 = mbt_ffi_ptr2str( + let result614 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 40), mbt_ffi_load32(iter_base + 44), ) - Option::Some(result612) + Option::Some(result614) } _ => panic() } - let array615 : Array[String] = [] - for index616 = 0 - index616 < mbt_ffi_load32(iter_base + 52) - index616 = index616 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 48) + index616 * 8 + let array617 : Array[String] = [] + for index618 = 0 + index618 < mbt_ffi_load32(iter_base + 52) + index618 = index618 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 48) + index618 * 8 - let result614 = mbt_ffi_ptr2str( + let result616 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array615.push(result614) + array617.push(result616) } mbt_ffi_free(mbt_ffi_load32(iter_base + 48)) - let array618 : Array[String] = [] - for index619 = 0 - index619 < mbt_ffi_load32(iter_base + 60) - index619 = index619 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 56) + index619 * 8 + let array620 : Array[String] = [] + for index621 = 0 + index621 < mbt_ffi_load32(iter_base + 60) + index621 = index621 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 56) + index621 * 8 - let result617 = mbt_ffi_ptr2str( + let result619 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array618.push(result617) + array620.push(result619) } mbt_ffi_free(mbt_ffi_load32(iter_base + 56)) - let lifted621 : String? = match mbt_ffi_load8_u(iter_base + 64) { + let lifted623 : String? = match mbt_ffi_load8_u(iter_base + 64) { 0 => Option::None 1 => { - let result620 = mbt_ffi_ptr2str( + let result622 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 68), mbt_ffi_load32(iter_base + 72), ) - Option::Some(result620) + Option::Some(result622) } _ => panic() } - let lifted624 : @types.Role? = match + let lifted626 : @types.Role? = match mbt_ffi_load8_u(iter_base + 76) { 0 => Option::None 1 => { - let lifted623 = match mbt_ffi_load8_u(iter_base + 80) { + let lifted625 = match mbt_ffi_load8_u(iter_base + 80) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result622 = mbt_ffi_ptr2str( + let result624 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 84), mbt_ffi_load32(iter_base + 88), ) - @types.Role::Other(result622) + @types.Role::Other(result624) } _ => panic() } - Option::Some(lifted623) + Option::Some(lifted625) } _ => panic() } - array625.push(@types.UnionBranch::{ - tag: result602, + array627.push(@types.UnionBranch::{ + tag: result604, body: mbt_ffi_load32(iter_base + 8), - discriminator: lifted611, + discriminator: lifted613, metadata: @types.MetadataEnvelope::{ - doc: lifted613, - aliases: array615, - examples: array618, - deprecated: lifted621, - role: lifted624, + doc: lifted615, + aliases: array617, + examples: array620, + deprecated: lifted623, + role: lifted626, }, }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) @types.SchemaTypeBody::UnionType(@types.UnionSpec::{ - branches: array625, + branches: array627, }) } 32 => { - let lifted628 : String? = match mbt_ffi_load8_u(iter_base + 12) { + let lifted630 : String? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => { - let result627 = mbt_ffi_ptr2str( + let result629 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 16), mbt_ffi_load32(iter_base + 20), ) - Option::Some(result627) + Option::Some(result629) } _ => panic() } @types.SchemaTypeBody::SecretType(@types.SecretSpec::{ inner: mbt_ffi_load32(iter_base + 8), - category: lifted628, + category: lifted630, }) } 33 => { - let lifted630 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted632 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result629 = mbt_ffi_ptr2str( + let result631 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result629) + Option::Some(result631) } _ => panic() } @types.SchemaTypeBody::QuotaTokenType(@types.QuotaTokenSpec::{ - resource_name: lifted630, + resource_name: lifted632, }) } 34 => { - let lifted631 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted633 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::FutureType(lifted631) + @types.SchemaTypeBody::FutureType(lifted633) } 35 => { - let lifted632 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted634 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaTypeBody::StreamType(lifted632) + @types.SchemaTypeBody::StreamType(lifted634) } _ => panic() } - let lifted635 : String? = match mbt_ffi_load8_u(iter_base + 88) { + let lifted637 : String? = match mbt_ffi_load8_u(iter_base + 88) { 0 => Option::None 1 => { - let result634 = mbt_ffi_ptr2str( + let result636 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 92), mbt_ffi_load32(iter_base + 96), ) - Option::Some(result634) + Option::Some(result636) } _ => panic() } - let array637 : Array[String] = [] - for index638 = 0 - index638 < mbt_ffi_load32(iter_base + 104) - index638 = index638 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 100) + index638 * 8 + let array639 : Array[String] = [] + for index640 = 0 + index640 < mbt_ffi_load32(iter_base + 104) + index640 = index640 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 100) + index640 * 8 - let result636 = mbt_ffi_ptr2str( + let result638 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array637.push(result636) + array639.push(result638) } mbt_ffi_free(mbt_ffi_load32(iter_base + 100)) - let array640 : Array[String] = [] - for index641 = 0 - index641 < mbt_ffi_load32(iter_base + 112) - index641 = index641 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 108) + index641 * 8 + let array642 : Array[String] = [] + for index643 = 0 + index643 < mbt_ffi_load32(iter_base + 112) + index643 = index643 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 108) + index643 * 8 - let result639 = mbt_ffi_ptr2str( + let result641 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - array640.push(result639) + array642.push(result641) } mbt_ffi_free(mbt_ffi_load32(iter_base + 108)) - let lifted643 : String? = match mbt_ffi_load8_u(iter_base + 116) { + let lifted645 : String? = match mbt_ffi_load8_u(iter_base + 116) { 0 => Option::None 1 => { - let result642 = mbt_ffi_ptr2str( + let result644 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 120), mbt_ffi_load32(iter_base + 124), ) - Option::Some(result642) + Option::Some(result644) } _ => panic() } - let lifted646 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { + let lifted648 : @types.Role? = match mbt_ffi_load8_u(iter_base + 128) { 0 => Option::None 1 => { - let lifted645 = match mbt_ffi_load8_u(iter_base + 132) { + let lifted647 = match mbt_ffi_load8_u(iter_base + 132) { 0 => @types.Role::Multimodal 1 => @types.Role::UnstructuredText 2 => @types.Role::UnstructuredBinary 3 => { - let result644 = mbt_ffi_ptr2str( + let result646 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 136), mbt_ffi_load32(iter_base + 140), ) - @types.Role::Other(result644) + @types.Role::Other(result646) } _ => panic() } - Option::Some(lifted645) + Option::Some(lifted647) } _ => panic() } - array647.push(@types.SchemaTypeNode::{ - body: lifted633, + array649.push(@types.SchemaTypeNode::{ + body: lifted635, metadata: @types.MetadataEnvelope::{ - doc: lifted635, - aliases: array637, - examples: array640, - deprecated: lifted643, - role: lifted646, + doc: lifted637, + aliases: array639, + examples: array642, + deprecated: lifted645, + role: lifted648, }, }) } mbt_ffi_free(mbt_ffi_load32(return_area + 32)) - let array652 : Array[@types.SchemaTypeDef] = [] - for index653 = 0 - index653 < mbt_ffi_load32(return_area + 44) - index653 = index653 + 1 { - let iter_base = mbt_ffi_load32(return_area + 40) + index653 * 24 + let array654 : Array[@types.SchemaTypeDef] = [] + for index655 = 0 + index655 < mbt_ffi_load32(return_area + 44) + index655 = index655 + 1 { + let iter_base = mbt_ffi_load32(return_area + 40) + index655 * 24 - let result649 = mbt_ffi_ptr2str( + let result651 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 0), mbt_ffi_load32(iter_base + 4), ) - let lifted651 : String? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted653 : String? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => { - let result650 = mbt_ffi_ptr2str( + let result652 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 12), mbt_ffi_load32(iter_base + 16), ) - Option::Some(result650) + Option::Some(result652) } _ => panic() } - array652.push(@types.SchemaTypeDef::{ - id: result649, - name: lifted651, + array654.push(@types.SchemaTypeDef::{ + id: result651, + name: lifted653, body: mbt_ffi_load32(iter_base + 20), }) } mbt_ffi_free(mbt_ffi_load32(return_area + 40)) - let array683 : Array[@types.SchemaValueNode] = [] - for index684 = 0 - index684 < mbt_ffi_load32(return_area + 56) - index684 = index684 + 1 { - let iter_base = mbt_ffi_load32(return_area + 52) + index684 * 32 + let array685 : Array[@types.SchemaValueNode] = [] + for index686 = 0 + index686 < mbt_ffi_load32(return_area + 56) + index686 = index686 + 1 { + let iter_base = mbt_ffi_load32(return_area + 52) + index686 * 32 - let lifted682 = match mbt_ffi_load8_u(iter_base + 0) { + let lifted684 = match mbt_ffi_load8_u(iter_base + 0) { 0 => @types.SchemaValueNode::BoolValue( mbt_ffi_load8_u(iter_base + 8) != 0, @@ -7575,28 +7591,28 @@ pub fn begin_custom_durable_invocation( Int::unsafe_to_char(mbt_ffi_load32(iter_base + 8)), ) 12 => { - let result654 = mbt_ffi_ptr2str( + let result656 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::StringValue(result654) + @types.SchemaValueNode::StringValue(result656) } 13 => { - let array655 : Array[Int] = [] - for index656 = 0 - index656 < mbt_ffi_load32(iter_base + 12) - index656 = index656 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index656 * 4 + let array657 : Array[Int] = [] + for index658 = 0 + index658 < mbt_ffi_load32(iter_base + 12) + index658 = index658 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index658 * 4 - array655.push(mbt_ffi_load32(iter_base + 0)) + array657.push(mbt_ffi_load32(iter_base + 0)) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::RecordValue(array655) + @types.SchemaValueNode::RecordValue(array657) } 14 => { - let lifted657 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + let lifted659 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() @@ -7604,7 +7620,7 @@ pub fn begin_custom_durable_invocation( @types.SchemaValueNode::VariantValue(@types.VariantValuePayload::{ case: mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), - payload: lifted657, + payload: lifted659, }) } 15 => @@ -7612,32 +7628,19 @@ pub fn begin_custom_durable_invocation( mbt_ffi_load32(iter_base + 8).reinterpret_as_uint(), ) 16 => { - let array658 : Array[Bool] = [] - for index659 = 0 - index659 < mbt_ffi_load32(iter_base + 12) - index659 = index659 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index659 * 1 - - array658.push(mbt_ffi_load8_u(iter_base + 0) != 0) - } - mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - - @types.SchemaValueNode::FlagsValue(array658) - } - 17 => { - let array660 : Array[Int] = [] + let array660 : Array[Bool] = [] for index661 = 0 index661 < mbt_ffi_load32(iter_base + 12) index661 = index661 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index661 * 4 + let iter_base = mbt_ffi_load32(iter_base + 8) + index661 * 1 - array660.push(mbt_ffi_load32(iter_base + 0)) + array660.push(mbt_ffi_load8_u(iter_base + 0) != 0) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::TupleValue(array660) + @types.SchemaValueNode::FlagsValue(array660) } - 18 => { + 17 => { let array662 : Array[Int] = [] for index663 = 0 index663 < mbt_ffi_load32(iter_base + 12) @@ -7648,9 +7651,9 @@ pub fn begin_custom_durable_invocation( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::ListValue(array662) + @types.SchemaValueNode::TupleValue(array662) } - 19 => { + 18 => { let array664 : Array[Int] = [] for index665 = 0 index665 < mbt_ffi_load32(iter_base + 12) @@ -7661,121 +7664,134 @@ pub fn begin_custom_durable_invocation( } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::FixedListValue(array664) + @types.SchemaValueNode::ListValue(array664) } - 20 => { - let array666 : Array[@types.MapEntry] = [] + 19 => { + let array666 : Array[Int] = [] for index667 = 0 index667 < mbt_ffi_load32(iter_base + 12) index667 = index667 + 1 { - let iter_base = mbt_ffi_load32(iter_base + 8) + index667 * 8 + let iter_base = mbt_ffi_load32(iter_base + 8) + index667 * 4 - array666.push(@types.MapEntry::{ + array666.push(mbt_ffi_load32(iter_base + 0)) + } + mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) + + @types.SchemaValueNode::FixedListValue(array666) + } + 20 => { + let array668 : Array[@types.MapEntry] = [] + for index669 = 0 + index669 < mbt_ffi_load32(iter_base + 12) + index669 = index669 + 1 { + let iter_base = mbt_ffi_load32(iter_base + 8) + index669 * 8 + + array668.push(@types.MapEntry::{ key: mbt_ffi_load32(iter_base + 0), value: mbt_ffi_load32(iter_base + 4), }) } mbt_ffi_free(mbt_ffi_load32(iter_base + 8)) - @types.SchemaValueNode::MapValue(array666) + @types.SchemaValueNode::MapValue(array668) } 21 => { - let lifted668 : Int? = match mbt_ffi_load8_u(iter_base + 8) { + let lifted670 : Int? = match mbt_ffi_load8_u(iter_base + 8) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 12)) _ => panic() } - @types.SchemaValueNode::OptionValue(lifted668) + @types.SchemaValueNode::OptionValue(lifted670) } 22 => { - let lifted671 = match mbt_ffi_load8_u(iter_base + 8) { + let lifted673 = match mbt_ffi_load8_u(iter_base + 8) { 0 => { - let lifted669 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + let lifted671 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::OkValue(lifted669) + @types.ResultValuePayload::OkValue(lifted671) } 1 => { - let lifted670 : Int? = match mbt_ffi_load8_u(iter_base + 12) { + let lifted672 : Int? = match mbt_ffi_load8_u(iter_base + 12) { 0 => Option::None 1 => Option::Some(mbt_ffi_load32(iter_base + 16)) _ => panic() } - @types.ResultValuePayload::ErrValue(lifted670) + @types.ResultValuePayload::ErrValue(lifted672) } _ => panic() } - @types.SchemaValueNode::ResultValue(lifted671) + @types.SchemaValueNode::ResultValue(lifted673) } 23 => { - let result672 = mbt_ffi_ptr2str( + let result674 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted674 : String? = match mbt_ffi_load8_u(iter_base + 16) { + let lifted676 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result673 = mbt_ffi_ptr2str( + let result675 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result673) + Option::Some(result675) } _ => panic() } @types.SchemaValueNode::TextValue(@types.TextValuePayload::{ - text: result672, - language: lifted674, + text: result674, + language: lifted676, }) } 24 => { - let result675 = mbt_ffi_ptr2bytes( + let result677 = mbt_ffi_ptr2bytes( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - let lifted677 : String? = match mbt_ffi_load8_u(iter_base + 16) { + let lifted679 : String? = match mbt_ffi_load8_u(iter_base + 16) { 0 => Option::None 1 => { - let result676 = mbt_ffi_ptr2str( + let result678 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) - Option::Some(result676) + Option::Some(result678) } _ => panic() } @types.SchemaValueNode::BinaryValue(@types.BinaryValuePayload::{ - bytes: result675, - mime_type: lifted677, + bytes: result677, + mime_type: lifted679, }) } 25 => { - let result678 = mbt_ffi_ptr2str( + let result680 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::PathValue(result678) + @types.SchemaValueNode::PathValue(result680) } 26 => { - let result679 = mbt_ffi_ptr2str( + let result681 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) - @types.SchemaValueNode::UrlValue(result679) + @types.SchemaValueNode::UrlValue(result681) } 27 => @types.SchemaValueNode::DatetimeValue(@types.Datetime::{ @@ -7787,7 +7803,7 @@ pub fn begin_custom_durable_invocation( nanoseconds: mbt_ffi_load64(iter_base + 8), }) 29 => { - let result680 = mbt_ffi_ptr2str( + let result682 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 20), mbt_ffi_load32(iter_base + 24), ) @@ -7795,17 +7811,17 @@ pub fn begin_custom_durable_invocation( @types.SchemaValueNode::QuantityValueNode(@types.QuantityValue::{ mantissa: mbt_ffi_load64(iter_base + 8), scale: mbt_ffi_load32(iter_base + 16), - unit: result680, + unit: result682, }) } 30 => { - let result681 = mbt_ffi_ptr2str( + let result683 = mbt_ffi_ptr2str( mbt_ffi_load32(iter_base + 8), mbt_ffi_load32(iter_base + 12), ) @types.SchemaValueNode::UnionValue(@types.UnionValuePayload::{ - tag: result681, + tag: result683, body: mbt_ffi_load32(iter_base + 16), }) } @@ -7817,20 +7833,26 @@ pub fn begin_custom_durable_invocation( @types.SchemaValueNode::QuotaTokenHandle( @types.QuotaToken::QuotaToken(mbt_ffi_load32(iter_base + 8)), ) + 33 => + @types.SchemaValueNode::StreamValue( + @types.SchemaValueStream::SchemaValueStream( + mbt_ffi_load32(iter_base + 8), + ), + ) _ => panic() } - array683.push(lifted682) + array685.push(lifted684) } mbt_ffi_free(mbt_ffi_load32(return_area + 52)) - let lifted687 = match mbt_ffi_load8_u(return_area + 64) { + let lifted689 = match mbt_ffi_load8_u(return_area + 64) { 0 => @oplog.WrappedFunctionType::ReadLocal 1 => @oplog.WrappedFunctionType::WriteLocal 2 => @oplog.WrappedFunctionType::ReadRemote 3 => @oplog.WrappedFunctionType::WriteRemote 4 => { - let lifted685 : UInt64? = match mbt_ffi_load8_u(return_area + 72) { + let lifted687 : UInt64? = match mbt_ffi_load8_u(return_area + 72) { 0 => Option::None 1 => Option::Some( @@ -7839,10 +7861,10 @@ pub fn begin_custom_durable_invocation( _ => panic() } - @oplog.WrappedFunctionType::WriteRemoteBatched(lifted685) + @oplog.WrappedFunctionType::WriteRemoteBatched(lifted687) } 5 => { - let lifted686 : UInt64? = match mbt_ffi_load8_u(return_area + 72) { + let lifted688 : UInt64? = match mbt_ffi_load8_u(return_area + 72) { 0 => Option::None 1 => Option::Some( @@ -7851,7 +7873,7 @@ pub fn begin_custom_durable_invocation( _ => panic() } - @oplog.WrappedFunctionType::WriteRemoteTransaction(lifted686) + @oplog.WrappedFunctionType::WriteRemoteTransaction(lifted688) } _ => panic() } @@ -7864,16 +7886,16 @@ pub fn begin_custom_durable_invocation( function_name: result, response: @types.TypedSchemaValue::{ graph: @types.SchemaGraph::{ - type_nodes: array647, - defs: array652, + type_nodes: array649, + defs: array654, root: mbt_ffi_load32(return_area + 48), }, value: @types.SchemaValueTree::{ - value_nodes: array683, + value_nodes: array685, root: mbt_ffi_load32(return_area + 60), }, }, - function_type: lifted687, + function_type: lifted689, entry_version: OplogEntryVersion::from( mbt_ffi_load8_u(return_area + 88), ), @@ -7881,11 +7903,11 @@ pub fn begin_custom_durable_invocation( } _ => panic() } - let ret = lifted688 + let ret = lifted690 mbt_ffi_free(ptr) mbt_ffi_free(address358) mbt_ffi_free(address364) - mbt_ffi_free(address435) + mbt_ffi_free(address437) mbt_ffi_free(return_area) cleanup_list.each(mbt_ffi_free) diff --git a/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt b/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt index 3b44dea46b..ebf767194f 100644 --- a/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt +++ b/sdks/moonbit/golem_sdk_example1/golem_moonbit_examples/golem_tools.mbt @@ -799,7 +799,7 @@ fn __golem_tool_def_CanonicalGrep() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalGrep( +async fn __golem_tool_invoke_CanonicalGrep( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -810,51 +810,74 @@ fn __golem_tool_invoke_CanonicalGrep( __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } let __golem_decoded = @tool.decode_canonical_input( __golem_def, __golem_index, __golem_input, "tool canonical-grep invocation", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) } match __golem_index { 0 => { let case_sensitive : Bool = @tool.decode_canonical_field( __golem_decoded, "case-sensitive", "tool canonical-grep command canonical-grep", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let color : CanonicalGrepColorMode = @tool.decode_canonical_field( __golem_decoded, "color", "tool canonical-grep command canonical-grep", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let pattern : String = @tool.decode_canonical_field( __golem_decoded, "pattern", "tool canonical-grep command canonical-grep", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let extra_patterns : Array[String] = @tool.decode_canonical_field( __golem_decoded, "extra-patterns", "tool canonical-grep command canonical-grep", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let max_count : UInt? = @tool.decode_canonical_field( __golem_decoded, "max-count", "tool canonical-grep command canonical-grep", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let files : Array[@schema.Path] = @tool.decode_canonical_field( __golem_decoded, "files", "tool canonical-grep command canonical-grep", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let stdin = match __golem_stdin { Some(__golem_stream) => __golem_stream None => - return Err( + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, @toolCommon.ToolError::InvalidInput( "required stdin stream is missing", ), @@ -875,6 +898,7 @@ fn __golem_tool_invoke_CanonicalGrep( }, ) Err(error) => { + __golem_stdout.drop_sync() let payload = match CanonicalGrepError::to_error_payload_value(error) { Ok(payload) => payload @@ -885,44 +909,62 @@ fn __golem_tool_invoke_CanonicalGrep( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 1 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let case_sensitive : Bool = @tool.decode_canonical_field( __golem_decoded, "case-sensitive", "tool canonical-grep command replace", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let color : CanonicalGrepColorMode = @tool.decode_canonical_field( __golem_decoded, "color", "tool canonical-grep command replace", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let pattern : String = @tool.decode_canonical_field( __golem_decoded, "pattern", "tool canonical-grep command replace", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let replacement : String = @tool.decode_canonical_field( __golem_decoded, "replacement", "tool canonical-grep command replace", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let files : Array[@schema.Path] = @tool.decode_canonical_field( __golem_decoded, "files", "tool canonical-grep command replace", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalGrep::replace( @@ -945,20 +987,19 @@ fn __golem_tool_invoke_CanonicalGrep( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) } } @@ -1636,7 +1677,7 @@ fn __golem_tool_def_CanonicalGit() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalGit( +async fn __golem_tool_invoke_CanonicalGit( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -1647,14 +1688,17 @@ fn __golem_tool_invoke_CanonicalGit( __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } let __golem_decoded = @tool.decode_canonical_input( __golem_def, __golem_index, __golem_input, "tool canonical-git invocation", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) } if __golem_command_path.length() > 0 && ["remote", "rmt"].contains(__golem_command_path[0]) { @@ -1678,55 +1722,94 @@ fn __golem_tool_invoke_CanonicalGit( } match __golem_index { 1 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let verbose : UInt = @tool.decode_canonical_field( __golem_decoded, "verbose", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let git_dir : @schema.Path = @tool.decode_canonical_field( __golem_decoded, "git-dir", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let paginate : Bool = @tool.decode_canonical_field( __golem_decoded, "paginate", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let config : Map[String, String] = @tool.decode_canonical_field( __golem_decoded, "config", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let message : String = @tool.decode_canonical_field( __golem_decoded, "message", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let author : String? = @tool.decode_canonical_field( __golem_decoded, "author", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let amend : Bool = @tool.decode_canonical_field( __golem_decoded, "amend", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let signoff : Bool = @tool.decode_canonical_field( __golem_decoded, "signoff", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let reset_author : Bool = @tool.decode_canonical_field( __golem_decoded, "reset-author", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let output : CanonicalGitOutputMode = @tool.decode_canonical_field( __golem_decoded, "output", "tool canonical-git command commit", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalGit::commit( @@ -1750,69 +1833,102 @@ fn __golem_tool_invoke_CanonicalGit( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 2 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let max_count : Int64? = @tool.decode_canonical_field( __golem_decoded, "max-count", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let since : @types.Datetime? = @tool.decode_canonical_field( __golem_decoded, "since", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let until : @types.Datetime? = @tool.decode_canonical_field( __golem_decoded, "until", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let author : Array[String] = @tool.decode_canonical_field( __golem_decoded, "author", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let grep : Array[String] = @tool.decode_canonical_field( __golem_decoded, "grep", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let all_match : Bool = @tool.decode_canonical_field( __golem_decoded, "all-match", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let invert_grep : Bool = @tool.decode_canonical_field( __golem_decoded, "invert-grep", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let oneline : Bool = @tool.decode_canonical_field( __golem_decoded, "oneline", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let graph : Bool = @tool.decode_canonical_field( __golem_decoded, "graph", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let paths : Array[@schema.Path] = @tool.decode_canonical_field( __golem_decoded, "paths", "tool canonical-git command log", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalGit::log( @@ -1835,20 +1951,19 @@ fn __golem_tool_invoke_CanonicalGit( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) } } @@ -2216,7 +2331,7 @@ fn __golem_tool_def_CanonicalRemote() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalRemote( +async fn __golem_tool_invoke_CanonicalRemote( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -2227,51 +2342,84 @@ fn __golem_tool_invoke_CanonicalRemote( __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } let __golem_decoded = @tool.decode_canonical_input( __golem_def, __golem_index, __golem_input, "tool remote invocation", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) } match __golem_index { 1 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let verbose : UInt = @tool.decode_canonical_field( __golem_decoded, "verbose", "tool remote command add", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let name : String = @tool.decode_canonical_field( __golem_decoded, "name", "tool remote command add", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let url : @schema.Url = @tool.decode_canonical_field( __golem_decoded, "url", "tool remote command add", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let track : Array[String] = @tool.decode_canonical_field( __golem_decoded, "track", "tool remote command add", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let master : String? = @tool.decode_canonical_field( __golem_decoded, "master", "tool remote command add", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let tags : Bool = @tool.decode_canonical_field( __golem_decoded, "tags", "tool remote command add", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let fetch : Bool = @tool.decode_canonical_field( __golem_decoded, "fetch", "tool remote command add", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalRemote::add(verbose, name, url, track, master, tags, fetch) { @@ -2287,24 +2435,30 @@ fn __golem_tool_invoke_CanonicalRemote( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 2 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let name : String = @tool.decode_canonical_field( __golem_decoded, "name", "tool remote command remove", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalRemote::remove(name) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2319,49 +2473,70 @@ fn __golem_tool_invoke_CanonicalRemote( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 3 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let name : String = @tool.decode_canonical_field( __golem_decoded, "name", "tool remote command set-url", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let newurl : @schema.Url = @tool.decode_canonical_field( __golem_decoded, "newurl", "tool remote command set-url", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let oldurl : @schema.Url? = @tool.decode_canonical_field( __golem_decoded, "oldurl", "tool remote command set-url", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let push : Bool = @tool.decode_canonical_field( __golem_decoded, "push", "tool remote command set-url", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let add : Bool = @tool.decode_canonical_field( __golem_decoded, "add", "tool remote command set-url", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let delete : Bool = @tool.decode_canonical_field( __golem_decoded, "delete", "tool remote command set-url", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalRemote::set_url(name, newurl, oldurl, push, add, delete) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2376,20 +2551,19 @@ fn __golem_tool_invoke_CanonicalRemote( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) } } @@ -2652,7 +2826,7 @@ fn __golem_tool_def_CanonicalStash() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalStash( +async fn __golem_tool_invoke_CanonicalStash( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -2663,31 +2837,52 @@ fn __golem_tool_invoke_CanonicalStash( __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } let __golem_decoded = @tool.decode_canonical_input( __golem_def, __golem_index, __golem_input, "tool stash invocation", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) } match __golem_index { 0 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let verbose : UInt = @tool.decode_canonical_field( __golem_decoded, "verbose", "tool stash command stash", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let message : String = @tool.decode_canonical_field( __golem_decoded, "message", "tool stash command stash", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let keep_index : Bool = @tool.decode_canonical_field( __golem_decoded, "keep-index", "tool stash command stash", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalStash::stash(verbose, message, keep_index) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2702,29 +2897,38 @@ fn __golem_tool_invoke_CanonicalStash( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 1 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let name : String? = @tool.decode_canonical_field( __golem_decoded, "name", "tool stash command pop", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let index : UInt? = @tool.decode_canonical_field( __golem_decoded, "index", "tool stash command pop", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalStash::pop(name, index) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2739,29 +2943,38 @@ fn __golem_tool_invoke_CanonicalStash( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } 2 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let name : String? = @tool.decode_canonical_field( __golem_decoded, "name", "tool stash command apply", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } let index : UInt? = @tool.decode_canonical_field( __golem_decoded, "index", "tool stash command apply", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalStash::apply(name, index) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2776,20 +2989,19 @@ fn __golem_tool_invoke_CanonicalStash( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) } } @@ -2911,7 +3123,7 @@ fn __golem_tool_def_CanonicalBigBound() -> @tool.ToolDef { } ///| -fn __golem_tool_invoke_CanonicalBigBound( +async fn __golem_tool_invoke_CanonicalBigBound( __golem_command_path : Array[String], __golem_input : @types.TypedSchemaValue, __golem_stdin : @asyncCore.Stream[Byte]?, @@ -2922,21 +3134,36 @@ fn __golem_tool_invoke_CanonicalBigBound( __golem_def.command_index_by_path(__golem_command_path) { Some(__golem_index) => __golem_index None => - return Err( + return @tool.reject_wire_invocation( + __golem_input, + __golem_stdin, @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), ) } let __golem_decoded = @tool.decode_canonical_input( __golem_def, __golem_index, __golem_input, "tool canonical-big-bound invocation", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_undecoded_invocation(__golem_stdin, __golem_error) } match __golem_index { 0 => { + if __golem_stdin is Some(_) { + return @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidInput( + "command does not accept a stdin stream", + ), + ) + } let count : UInt64? = @tool.decode_canonical_field( __golem_decoded, "count", "tool canonical-big-bound command canonical-big-bound", ) catch { - __golem_error => return Err(__golem_error) + __golem_error => + return @tool.reject_decoded_invocation( + __golem_decoded, __golem_stdin, __golem_error, + ) } match CanonicalBigBound::canonical_big_bound(count) { Ok(__golem_value) => Ok(@tool.invocation_result_empty()) @@ -2951,20 +3178,19 @@ fn __golem_tool_invoke_CanonicalBigBound( ), ) } - let payload = @model.typed_schema_value_to_wit(payload) catch { - encode_error => - return Err( - @toolCommon.ToolError::InvalidResult( - "failed serializing custom tool error: " + - encode_error.to_string(), - ), - ) + let payload = @tool.encode_error_payload(payload) catch { + encode_error => return Err(encode_error) } Err(@toolCommon.ToolError::CustomError(payload)) } } } - _ => Err(@toolCommon.ToolError::InvalidCommandPath(__golem_command_path)) + _ => + @tool.reject_decoded_invocation( + __golem_decoded, + __golem_stdin, + @toolCommon.ToolError::InvalidCommandPath(__golem_command_path), + ) } } diff --git a/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.rs b/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.rs deleted file mode 100644 index 3b3fbe8f03..0000000000 --- a/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.rs +++ /dev/null @@ -1,11 +0,0 @@ -use golem_rust::agent_definition; -use golem_rust::agentic::AgentStream; - -type ConstructorInput = AgentStream; - -#[agent_definition] -trait AliasedStreamConstructorAgent { - fn new(input: ConstructorInput) -> Self; -} - -fn main() {} diff --git a/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.stderr b/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.stderr deleted file mode 100644 index 34a3ccd39d..0000000000 --- a/sdks/rust/golem-rust/tests/ui/fail/agent_stream_alias_constructor.stderr +++ /dev/null @@ -1,5 +0,0 @@ -error[E0080]: evaluation panicked: AgentStream cannot be used as an agent constructor parameter - --> tests/ui/fail/agent_stream_alias_constructor.rs:6:1 - | -6 | #[agent_definition] - | ^^^^^^^^^^^^^^^^^^^ evaluation of `AliasedStreamConstructorAgent::__register_agent_type::_` failed here diff --git a/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AgentClientRuntime.scala b/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AgentClientRuntime.scala index a2f791fc59..161fe8fa03 100644 --- a/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AgentClientRuntime.scala +++ b/sdks/scala/core/js/src/main/scala/golem/runtime/rpc/AgentClientRuntime.scala @@ -67,13 +67,16 @@ object AgentClientRuntime { inputCodec: golem.runtime.InputRecordCodec[In], input: In ): Either[String, JsSchemaValueTree] = - // `SchemaRpcCodec.encodeArgs` throws on a malformed positional record; keep - // local encode errors as `Left` rather than throwing synchronously. - try Right(SchemaRpcCodec.encodeArgs(input)(inputCodec)) - catch { - case js.JavaScriptException(err) => Left(err.toString) - case NonFatal(err) => Left(err.getMessage) - } + if (inputCodec.graph.containsStream) + Left("live streams cannot cross fire-and-forget or scheduled agent invocation boundaries") + else + // `SchemaRpcCodec.encodeArgs` throws on a malformed positional record; keep + // local encode errors as `Left` rather than throwing synchronously. + try Right(SchemaRpcCodec.encodeArgs(input)(inputCodec)) + catch { + case js.JavaScriptException(err) => Left(err.toString) + case NonFatal(err) => Left(err.getMessage) + } private def decodeOutput[Out]( outputCodec: OutputCodec[Out], diff --git a/sdks/scala/core/js/src/test/scala/golem/runtime/rpc/AgentClientRuntimeSpec.scala b/sdks/scala/core/js/src/test/scala/golem/runtime/rpc/AgentClientRuntimeSpec.scala index b35c019144..22b4669c7d 100644 --- a/sdks/scala/core/js/src/test/scala/golem/runtime/rpc/AgentClientRuntimeSpec.scala +++ b/sdks/scala/core/js/src/test/scala/golem/runtime/rpc/AgentClientRuntimeSpec.scala @@ -101,7 +101,7 @@ object AgentClientRuntimeSpec extends ZIOSpecDefault { ) } }, - test("PROVISIONAL bug_finder reproducer — remove if the finding is rejected: trigger rejects streams without consuming them") { + test("trigger rejects streams without consuming them") { val agentType = rpcAgentType val invoker = new RecordingRpcInvoker val resolved = resolvedAgent(invoker, agentType) diff --git a/sdks/scala/model/src/main/scala/golem/schema/SchemaGraph.scala b/sdks/scala/model/src/main/scala/golem/schema/SchemaGraph.scala index 49010639dc..bcc5437a0a 100644 --- a/sdks/scala/model/src/main/scala/golem/schema/SchemaGraph.scala +++ b/sdks/scala/model/src/main/scala/golem/schema/SchemaGraph.scala @@ -31,7 +31,32 @@ final case class SchemaTypeDef(body: SchemaType, name: Option[String] = None) * `defs` is a [[ListMap]] so iteration order is deterministic; the WIT codecs * additionally sort by id when flattening. */ -final case class SchemaGraph(defs: ListMap[String, SchemaTypeDef], root: SchemaType) +final case class SchemaGraph(defs: ListMap[String, SchemaTypeDef], root: SchemaType) { + def containsStream: Boolean = { + import SchemaTypeBody._ + + def visit(schemaType: SchemaType, visiting: Set[String]): Boolean = + schemaType.body match { + case StreamType(_) => true + case RefType(id) if !visiting(id) => + defs.get(id).exists(definition => visit(definition.body, visiting + id)) + case RecordType(fields) => fields.exists(field => visit(field.body, visiting)) + case VariantType(cases) => cases.exists(_.payload.exists(visit(_, visiting))) + case TupleType(elements) => elements.exists(visit(_, visiting)) + case ListType(element) => visit(element, visiting) + case FixedListType(element, _) => visit(element, visiting) + case MapType(key, value) => visit(key, visiting) || visit(value, visiting) + case OptionType(element) => visit(element, visiting) + case ResultType(ok, err) => ok.exists(visit(_, visiting)) || err.exists(visit(_, visiting)) + case UnionType(branches) => branches.exists(branch => visit(branch.body, visiting)) + case SecretType(spec) => visit(spec.inner, visiting) + case FutureType(element) => element.exists(visit(_, visiting)) + case _ => false + } + + visit(root, Set.empty) + } +} /** A typed value: a self-contained schema graph paired with a value tree. */ final case class TypedSchemaValue(graph: SchemaGraph, value: SchemaValue) From abe0bf151aa3dc99c10a0c4db8c807459d3b4373 Mon Sep 17 00:00:00 2001 From: Daniel Vigovszky Date: Thu, 20 Aug 2026 11:23:39 +0200 Subject: [PATCH 4/7] Fix remaining CI failures Amp-Thread-ID: https://ampcode.com/threads/T-01a01a7e-c6ec-77c0-9e1d-b36941cb2dff Co-authored-by: Amp --- golem-service-base/src/model/environment.rs | 3 +- sdks/moonbit/golem_sdk/errors/tests.mbt | 75 +- .../golem_sdk/tool/canonical_input.mbt | 41 +- sdks/moonbit/golem_sdk/tool/client.mbt | 10 +- .../moonbit/golem_sdk/tool/pkg.generated.mbti | 2 + sdks/moonbit/golem_sdk/tool/registry.mbt | 12 +- .../tool/resource_cleanup_wbtest.mbt | 246 ++-- sdks/moonbit/golem_sdk/tool/tool_wbtest.mbt | 1312 ++++++++++------- 8 files changed, 957 insertions(+), 744 deletions(-) diff --git a/golem-service-base/src/model/environment.rs b/golem-service-base/src/model/environment.rs index 4eb3120eda..0608b0062e 100644 --- a/golem-service-base/src/model/environment.rs +++ b/golem-service-base/src/model/environment.rs @@ -103,7 +103,8 @@ mod tests { tool_deployment: Some(tool_deployment.clone()), }; - let proto: golem_api_grpc::proto::golem::registry::EnvironmentState = state.into(); + let proto: golem_api_grpc::proto::golem::registry::EnvironmentState = + state.try_into().unwrap(); let decoded = EnvironmentState::try_from(proto).unwrap(); assert_eq!(decoded.tool_deployment, Some(tool_deployment)); diff --git a/sdks/moonbit/golem_sdk/errors/tests.mbt b/sdks/moonbit/golem_sdk/errors/tests.mbt index b1133a58cf..9ed68bbe58 100644 --- a/sdks/moonbit/golem_sdk/errors/tests.mbt +++ b/sdks/moonbit/golem_sdk/errors/tests.mbt @@ -22,22 +22,11 @@ fn[T : @schema.FromSchema] decode_custom_error_for_test( } ///| -fn run_async_test_noraise(block : async () -> Unit noraise) -> Unit = "%async.run" - -///| -fn run_async_test(block : async () -> Unit) -> Unit { - let failure : Array[String?] = [None] - run_async_test_noraise(() => { - try block() catch { - error => failure[0] = Some(repr(error)) - } noraise { - _ => () - } - }) - match failure[0] { - Some(message) => abort(message) - None => () - } +fn[T : @schema.IntoSchema] custom_error_of_for_test( + value : T, +) -> @common.AgentError raise { + let typed = @schema.try_into_typed_schema_value(value) + @common.AgentError::CustomError(@model.typed_schema_value_to_wit(typed)) } ///| @@ -62,39 +51,35 @@ test "internal_error prefixes and round-trips" { ///| test "custom_error_of round-trips a typed (non-string) value" { - run_async_test(async fn() { - let err = custom_error_of((42 : Int)) - guard err is CustomError(_) else { fail("expected CustomError") } - let decoded : Int? = decode_custom_error_for_test(err) - inspect(decoded, content="Some(42)") - }) + let err = custom_error_of_for_test((42 : Int)) + guard err is CustomError(_) else { fail("expected CustomError") } + let decoded : Int? = decode_custom_error_for_test(err) + inspect(decoded, content="Some(42)") } ///| test "failed custom error conversion drops its decoded stream" { - run_async_test(async fn() { - let handle = @model.GuestSchemaValueStreamHandle::from_wrapped( - @types.SchemaValueStream::SchemaValueStream(90), - ) - let stream : @schema.AgentStream[Int] = @schema.from_value_as( - @model.SchemaValue::Stream(handle), - ) - let error = custom_error_of(stream) - let dropped = [0] - let result : Result[Int?, _] = try? decode_custom_error_with_resource_drops( - error, - { - drop_secret: fn(_) { }, - drop_quota_token: fn(_) { }, - drop_stream: fn(_) { dropped[0] += 1 }, - drop_native_stream: fn(_) { }, - }, - ) - guard result is Err(_) else { - fail("decoding a stream custom error as Int must fail") - } - assert_eq(dropped[0], 1) - }) + let handle = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(90), + ) + let stream : @schema.AgentStream[Int] = @schema.from_value_as( + @model.SchemaValue::Stream(handle), + ) + let error = custom_error_of_for_test(stream) + let dropped = [0] + let result : Result[Int?, _] = try? decode_custom_error_with_resource_drops( + error, + { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + }, + ) + guard result is Err(_) else { + fail("decoding a stream custom error as Int must fail") + } + assert_eq(dropped[0], 1) } ///| diff --git a/sdks/moonbit/golem_sdk/tool/canonical_input.mbt b/sdks/moonbit/golem_sdk/tool/canonical_input.mbt index 6c45fe4a22..30104465bc 100644 --- a/sdks/moonbit/golem_sdk/tool/canonical_input.mbt +++ b/sdks/moonbit/golem_sdk/tool/canonical_input.mbt @@ -2,6 +2,7 @@ pub(all) struct CanonicalInputField { name : String aliases : Array[String] + short : Char? type_ : @model.SchemaGraph } derive(Eq) @@ -9,6 +10,7 @@ pub(all) struct CanonicalInputField { pub(all) struct CanonicalInputValue { name : String aliases : Array[String] + short : Char? type_ : @model.SchemaGraph value : @model.SchemaValue } derive(Eq) @@ -186,6 +188,7 @@ pub fn ToolDef::canonical_input_fields( fields.push({ name: positional.name, aliases: [], + short: None, type_: positional.type_, }) } @@ -193,6 +196,7 @@ pub fn ToolDef::canonical_input_fields( fields.push({ name: tail.name, aliases: [], + short: None, type_: list_graph(tail.item_type), }) } @@ -237,7 +241,7 @@ fn OptionSpecDef::canonical_field(self : OptionSpecDef) -> CanonicalInputField { RepeatableList(shape) => list_graph(shape.item_type) RepeatableMap(shape) => shape.map_type } - { name: self.long, aliases: self.aliases, type_ } + { name: self.long, aliases: self.aliases, short: self.short, type_ } } ///| @@ -250,7 +254,12 @@ fn @toolCommon.FlagSpec::canonical_field( @toolCommon.FlagShape::CountFlag(_) => @model.schema_type(@model.SchemaTypeBody::U32(None)) } - { name: self.long, aliases: self.aliases, type_: { defs: [], root } } + { + name: self.long, + aliases: self.aliases, + short: self.short, + type_: { defs: [], root }, + } } ///| @@ -346,6 +355,7 @@ fn decode_canonical_input_with_resource_drops( result.push({ name: field.name, aliases: field.aliases, + short: field.short, type_: field.type_, value: values[i], }) @@ -515,14 +525,33 @@ pub fn forward_canonical_input( let params : Array[(String, @model.SchemaValue)] = [] for target in model.fields { let mut found : CanonicalInputValue? = None + let mut found_rank = 0 for candidate in fields { - if candidate.name == target.name || - candidate.aliases.contains(target.name) || - target.aliases.contains(candidate.name) || - target.aliases.any(surface_alias => { + let rank = if candidate.name == target.name { + 4 + } else if target.aliases.contains(candidate.name) { + 3 + } else if candidate.aliases.contains(target.name) { + 2 + } else if target.aliases.any(surface_alias => { candidate.aliases.contains(surface_alias) }) { + 1 + } else { + 0 + } + if rank > found_rank { found = Some(candidate) + found_rank = rank + } + } + if found is None { + for candidate in fields { + if candidate.short is Some(candidate_short) && + target.short == Some(candidate_short) { + found = Some(candidate) + break + } } } guard found is Some(found) else { diff --git a/sdks/moonbit/golem_sdk/tool/client.mbt b/sdks/moonbit/golem_sdk/tool/client.mbt index 3ceed12238..951827c13d 100644 --- a/sdks/moonbit/golem_sdk/tool/client.mbt +++ b/sdks/moonbit/golem_sdk/tool/client.mbt @@ -98,7 +98,7 @@ pub async fn[E] invoke_and_await( ) -> Result[InvocationResult, ToolError[E]] { let wire_input = @model.typed_schema_value_to_wit_async(input) catch { e => { - input.value.release_resources(@model_host.resource_drops()) + release_failed_tool_input(input, @model_host.resource_drops()) match stdin { Some(stdin) => stdin.drop_sync() None => () @@ -114,6 +114,14 @@ pub async fn[E] invoke_and_await( decode_invocation_result(wire_result) } +///| +fn release_failed_tool_input( + input : @model.TypedSchemaValue, + drops : @model.SchemaValueResourceDrops, +) -> Unit { + input.value.release_resources(drops) +} + ///| pub async fn[E : @schema.FromSchema] invoke_and_await_payload_error( rpc : @toolHost.ToolRpc, diff --git a/sdks/moonbit/golem_sdk/tool/pkg.generated.mbti b/sdks/moonbit/golem_sdk/tool/pkg.generated.mbti index c197e41f4d..70e0d5899a 100644 --- a/sdks/moonbit/golem_sdk/tool/pkg.generated.mbti +++ b/sdks/moonbit/golem_sdk/tool/pkg.generated.mbti @@ -131,6 +131,7 @@ pub fn ToolBuildError::schema_model(String) -> Self pub(all) struct CanonicalInputField { name : String aliases : Array[String] + short : Char? type_ : @schema_model.SchemaGraph } derive(Eq) @@ -142,6 +143,7 @@ pub(all) struct CanonicalInputModel { pub(all) struct CanonicalInputValue { name : String aliases : Array[String] + short : Char? type_ : @schema_model.SchemaGraph value : @schema_model.SchemaValue } derive(Eq) diff --git a/sdks/moonbit/golem_sdk/tool/registry.mbt b/sdks/moonbit/golem_sdk/tool/registry.mbt index d55a789d9a..408d3f1550 100644 --- a/sdks/moonbit/golem_sdk/tool/registry.mbt +++ b/sdks/moonbit/golem_sdk/tool/registry.mbt @@ -264,13 +264,21 @@ fn reject_wire_invocation_with_resource_drops( error : @toolCommon.ToolError, drops : @model.SchemaValueResourceDrops, ) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { + release_wire_invocation_input(input, drops) + drop_optional_stdin(stdin) + Err(error) +} + +///| +fn release_wire_invocation_input( + input : @types.TypedSchemaValue, + drops : @model.SchemaValueResourceDrops, +) -> Unit { try @model.typed_schema_value_from_wit(input, drops) catch { _ => () } noraise { decoded => decoded.value.release_resources(drops) } - drop_optional_stdin(stdin) - Err(error) } ///| diff --git a/sdks/moonbit/golem_sdk/tool/resource_cleanup_wbtest.mbt b/sdks/moonbit/golem_sdk/tool/resource_cleanup_wbtest.mbt index 6182729b43..883b40f6bb 100644 --- a/sdks/moonbit/golem_sdk/tool/resource_cleanup_wbtest.mbt +++ b/sdks/moonbit/golem_sdk/tool/resource_cleanup_wbtest.mbt @@ -63,6 +63,7 @@ test "canonical field rejection releases undecoded streams" { { name: "stream", aliases: [], + short: None, type_: cleanup_string_graph(), value: @model.SchemaValue::Stream(source), }, @@ -80,117 +81,73 @@ test "canonical field rejection releases undecoded streams" { } ///| -test "subtool routing rejection releases unforwarded streams" { - run_async_test(() => { - let source = @model.GuestSchemaValueStreamHandle::from_wrapped( - @types.SchemaValueStream::SchemaValueStream(4), - ) - let result = invoke_registered_subtool_with_resource_drops( - "missing-cleanup-tool", - [], - [ - { - name: "stream", - aliases: [], - type_: cleanup_string_graph(), - value: @model.SchemaValue::Stream(source), - }, - ], - None, - @agentCommon.Principal::Anonymous, - cleanup_drops(), - ) - guard result is Err(@toolCommon.ToolError::InvalidToolName(_)) else { - fail("an unregistered subtool must fail") - } - assert_false(source.is_present()) - }) +test "decoded invocation rejection releases unforwarded streams" { + let source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(4), + ) + release_canonical_input_values( + [ + { + name: "stream", + aliases: [], + short: None, + type_: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }, + ], + cleanup_drops(), + ) + assert_false(source.is_present()) } ///| -test "top-level routing rejection drops wire stream resources" { - run_async_test(() => { - let dropped = [0] - let drops : @model.SchemaValueResourceDrops = { - drop_secret: fn(_) { }, - drop_quota_token: fn(_) { }, - drop_stream: fn(_) { dropped[0] += 1 }, - drop_native_stream: fn(_) { }, - } - let input : @types.TypedSchemaValue = { - graph: @model.schema_graph_to_wit(cleanup_string_graph()), - value: { - value_nodes: [ - @types.StreamValue(@types.SchemaValueStream::SchemaValueStream(14)), - ], - root: 0, - }, - } - let result = invoke_registered_tool_with_resource_drops( - "missing-wire-cleanup-tool", - [], - input, - None, - @agentCommon.Principal::Anonymous, - drops, - ) - guard result is Err(@toolCommon.ToolError::InvalidToolName(_)) else { - fail("an unregistered top-level tool must fail") - } - assert_eq(dropped[0], 1) - }) +test "wire invocation rejection drops stream resources" { + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + let input : @types.TypedSchemaValue = { + graph: @model.schema_graph_to_wit(cleanup_string_graph()), + value: { + value_nodes: [ + @types.StreamValue(@types.SchemaValueStream::SchemaValueStream(14)), + ], + root: 0, + }, + } + release_wire_invocation_input(input, drops) + assert_eq(dropped[0], 1) } ///| -test "subtool with no invoker drops source before forwarding" { - run_async_test(() => { - let base = canonical_test_def() - let command = base.commands[0] - let def : ToolDef = { - version: base.version, - commands: [ - { - name: "cleanup-no-invoker", - aliases: command.aliases, - doc: command.doc, - globals: command.globals, - subcommands: [], - body: command.body, - }, - ], - } - register_tool_def(def) - let source = @model.GuestSchemaValueStreamHandle::from_wrapped( - @types.SchemaValueStream::SchemaValueStream(15), - ) - let dropped = [0] - let drops : @model.SchemaValueResourceDrops = { - drop_secret: fn(_) { }, - drop_quota_token: fn(_) { }, - drop_stream: fn(_) { dropped[0] += 1 }, - drop_native_stream: fn(_) { }, - } - let result = invoke_registered_subtool_with_resource_drops( - "cleanup-no-invoker", - [], - [ - { - name: "global", - aliases: [], - type_: cleanup_string_graph(), - value: @model.SchemaValue::Stream(source), - }, - ], - None, - @agentCommon.Principal::Anonymous, - drops, - ) - guard result is Err(@toolCommon.ToolError::InvalidToolName(_)) else { - fail("a subtool without an invoker must fail") - } - assert_false(source.is_present()) - assert_eq(dropped[0], 1) - }) +test "decoded invocation rejection calls configured stream drop" { + let source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(15), + ) + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + release_canonical_input_values( + [ + { + name: "global", + aliases: [], + short: None, + type_: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }, + ], + drops, + ) + assert_false(source.is_present()) + assert_eq(dropped[0], 1) } ///| @@ -198,14 +155,11 @@ test "tool result conversion failure releases decoded streams" { let source = @model.GuestSchemaValueStreamHandle::from_wrapped( @types.SchemaValueStream::SchemaValueStream(5), ) - let result : Result[Int, ToolError[NoToolError]] = decode_result_value_with_resource_drops( - { - result: Some({ - graph: cleanup_string_graph(), - value: @model.SchemaValue::Stream(source), - }), - stdout: None, - }, + let result : Result[Int, ToolError[NoToolError]] = decode_expected_value( + Some({ + graph: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }), cleanup_drops(), ) guard result is Err(ToolError::Rpc(RpcError::Protocol(_))) else { @@ -219,48 +173,44 @@ test "tool result validates stdout before transferring its value" { let source = @model.GuestSchemaValueStreamHandle::from_wrapped( @types.SchemaValueStream::SchemaValueStream(6), ) - let result : Result[ - (@schema.AgentStream[Int], @async-core.Stream[Byte]), - ToolError[NoToolError], - ] = decode_result_with_stdout_with_resource_drops( - { - result: Some({ - graph: cleanup_string_graph(), - value: @model.SchemaValue::Stream(source), - }), - stdout: None, - }, - cleanup_drops(), + let value : @model.TypedSchemaValue? = Some({ + graph: cleanup_string_graph(), + value: @model.SchemaValue::Stream(source), + }) + let stdout : @async-core.Stream[Byte]? = None + let stdout_result : Result[@async-core.Stream[Byte], ToolError[NoToolError]] = expect_stdout( + stdout, ) - guard result is Err(ToolError::Rpc(RpcError::Protocol(_))) else { + guard stdout_result is Err(ToolError::Rpc(RpcError::Protocol(_))) else { fail("a missing stdout stream must fail") } + release_optional_value(value, cleanup_drops()) assert_false(source.is_present()) } ///| -test "tool input encoding failure drops value streams and stdin" { - run_async_test(() => { - let (value_reader, value_sink) = @async-core.Stream::new() - let value_source = @model.GuestSchemaValueStreamHandle::from_native( - value_reader, - ) - let (stdin, stdin_sink) = @async-core.Stream::new() - let invalid_graph : @model.SchemaGraph = { +test "tool input encoding failure drops value streams" { + let value_source = @model.GuestSchemaValueStreamHandle::from_wrapped( + @types.SchemaValueStream::SchemaValueStream(16), + ) + let dropped = [0] + let drops : @model.SchemaValueResourceDrops = { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + } + let input : @model.TypedSchemaValue = { + graph: { defs: [], root: @model.schema_type(@model.SchemaTypeBody::Ref("missing-type")), - } - let result = invoke_and_await_no_tool_error( - @toolHost.ToolRpc::ToolRpc(0), - [], - { graph: invalid_graph, value: @model.SchemaValue::Stream(value_source) }, - Some(stdin), - ) - guard result is Err(ToolError::Rpc(RpcError::Protocol(_))) else { - fail("an invalid input graph must fail before invoking the host") - } - assert_false(value_source.is_present()) - assert_false(value_sink.is_open()) - assert_false(stdin_sink.is_open()) - }) + }, + value: @model.SchemaValue::Stream(value_source), + } + guard (try? @model.typed_schema_value_to_wit(input)) is Err(_) else { + fail("an invalid input graph must fail encoding") + } + release_failed_tool_input(input, drops) + assert_false(value_source.is_present()) + assert_eq(dropped[0], 1) } diff --git a/sdks/moonbit/golem_sdk/tool/tool_wbtest.mbt b/sdks/moonbit/golem_sdk/tool/tool_wbtest.mbt index ee2dfb74ca..6b2fb44d82 100644 --- a/sdks/moonbit/golem_sdk/tool/tool_wbtest.mbt +++ b/sdks/moonbit/golem_sdk/tool/tool_wbtest.mbt @@ -1,22 +1,3 @@ -///| -fn run_async_test_noraise(block : async () -> Unit noraise) -> Unit = "%async.run" - -///| -fn run_async_test(block : async () -> Unit) -> Unit { - let failure : Array[String?] = [None] - run_async_test_noraise(() => { - try block() catch { - error => failure[0] = Some(repr(error)) - } noraise { - _ => () - } - }) - match failure[0] { - Some(message) => abort(message) - None => () - } -} - ///| fn test_resource_drops() -> @model.SchemaValueResourceDrops { { @@ -27,6 +8,16 @@ fn test_resource_drops() -> @model.SchemaValueResourceDrops { } } +///| +fn register_subtool_def_for_test(tool : ToolDef) -> Unit raise ToolBuildError { + let name = match tool.tool_name() { + Ok(name) => name + Err(error) => raise error + } + ensure_tool_name_available(name) + state.defs[name] = tool +} + ///| fn decode_canonical_input_for_test( def : ToolDef, @@ -85,24 +76,6 @@ fn[T : @schema.FromSchema] decode_param_for_test( ) } -///| -async fn invoke_registered_subtool_for_test( - tool_name : String, - command_path : Array[String], - fields : Array[CanonicalInputValue], - stdin : @async-core.Stream[Byte]?, - principal : @agentCommon.Principal, -) -> Result[@toolCommon.InvocationResult, @toolCommon.ToolError] { - invoke_registered_subtool_with_resource_drops( - tool_name, - command_path, - fields, - stdin, - principal, - test_resource_drops(), - ) -} - ///| test "rejected tool envelopes drop reached stream resources" { let dropped = [0] @@ -118,96 +91,675 @@ test "rejected tool envelopes drop reached stream resources" { root: 0, }, } - let result = try? decode_invocation_input_with_resource_drops( - input, - 0, - "tool cleanup", - { - drop_secret: fn(_) { }, - drop_quota_token: fn(_) { }, - drop_stream: fn(_) { dropped[0] += 1 }, - drop_native_stream: fn(_) { }, - }, + let result = try? decode_invocation_input_with_resource_drops( + input, + 0, + "tool cleanup", + { + drop_secret: fn(_) { }, + drop_quota_token: fn(_) { }, + drop_stream: fn(_) { dropped[0] += 1 }, + drop_native_stream: fn(_) { }, + }, + ) + guard result is Err(@toolCommon.ToolError::InvalidInput(_)) else { + fail("expected the schema/value mismatch to be rejected") + } + assert_eq(dropped[0], 1) +} + +///| +fn doc(summary : String) -> @toolCommon.Doc { + { summary, description: "details for " + summary, examples: [] } +} + +///| +fn string_graph() -> @model.SchemaGraph raise { + @schema.schema_graph_of_tag((@schema.type_tag() : @schema.TypeTag[String])) +} + +///| +fn sample_tool() -> @toolCommon.Tool raise { + let string = string_graph() + let def : ToolDef = { + version: "1.0.0", + commands: [ + { + name: "grep", + aliases: [], + doc: doc("search files"), + globals: { + options: [], + flags: [ + { + long: "verbose", + short: Some('v'), + aliases: ["chatty"], + doc: doc("show verbose output"), + shape: @toolCommon.FlagShape::BoolFlag({ + default: false, + negatable: false, + }), + env_var: None, + }, + ], + }, + subcommands: [1], + body: None, + }, + { + name: "run", + aliases: [], + doc: doc("run grep"), + globals: { options: [], flags: [] }, + subcommands: [], + body: Some({ + positionals: { + fixed: [ + { + name: "pattern", + doc: doc("pattern to search"), + value_name: None, + type_: string, + default: None, + required: true, + accepts_stdio: false, + }, + ], + tail: None, + }, + options: [ + { + long: "config", + short: None, + aliases: [], + doc: doc("config file"), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: false, + env_var: None, + }, + ], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], + } + def.to_tool() +} + +///| +fn[T] unwrap_tool_result(result : Result[T, ToolBuildError]) -> T { + match result { + Ok(value) => value + Err(_) => abort("unexpected tool result error") + } +} + +///| +test "subtree-only tool cannot be invoked as a top-level tool" { + let def = canonical_test_def() + register_subtool_def_for_test(def) + assert_true( + get_registered_tool("root") + is Err(@toolCommon.ToolError::InvalidToolName("root")), + ) +} + +///| +test "forwarding matches short forms in their separate namespace" { + let flag = fn(long : String) -> @toolCommon.FlagSpec { + { + long, + short: Some('v'), + aliases: [], + doc: doc(long), + shape: @toolCommon.FlagShape::BoolFlag({ + default: false, + negatable: false, + }), + env_var: None, + } + } + let child : ToolDef = { + version: "1", + commands: [ + { + name: "short-forward-child", + aliases: [], + doc: doc("short forward child"), + globals: { options: [], flags: [flag("child-verbose")] }, + subcommands: [], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], + } + let parent : ToolDef = { + version: "1", + commands: [ + { + name: "short-forward-parent", + aliases: [], + doc: doc("short forward parent"), + globals: { options: [], flags: [flag("parent-verbose")] }, + subcommands: [], + body: None, + }, + ], + } + let parent_fields = parent.canonical_input_fields(0) + inspect(parent_fields.map(field => field.name), content="[parent-verbose]") + assert_eq(parent_fields[0].short, Some('v')) + let model = parent.canonical_input_model(0) + let input = build_canonical_input(model, [ + ("parent-verbose", @model.SchemaValue::Bool(true)), + ]) + let wire = @model.typed_schema_value_to_wit(input) + let decoded = decode_canonical_input_for_test(parent, 0, wire, "short parent") + let forwarded = forward_canonical_input(decoded, child, 0) + let child_input = decode_canonical_input_for_test( + child, 0, forwarded, "short child", + ) + let verbose : Bool = decode_canonical_field_for_test( + child_input, "child-verbose", "short child", + ) + assert_true(verbose) +} + +///| +test "forwarding keeps authored aliases separate from short forms" { + let string = string_graph() + let option = fn( + long : String, + aliases : Array[String], + short : Char?, + ) -> OptionSpecDef { + { + long, + short, + aliases, + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } + } + let def : ToolDef = { + version: "1", + commands: [ + { + name: "root", + aliases: [], + doc: doc("root"), + globals: { options: [option("format", ["f"], None)], flags: [] }, + subcommands: [1], + body: None, + }, + { + name: "run", + aliases: [], + doc: doc("run"), + globals: { options: [], flags: [] }, + subcommands: [], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [option("file", [], Some('f'))], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], + } + let normalized = def.normalize_inherited_globals() + let model = normalized.canonical_input_model(1) + let input = build_canonical_input(model, [ + ("format", @model.SchemaValue::String("json")), + ("file", @model.SchemaValue::String("input.txt")), + ]) + let decoded = decode_canonical_input_for_test( + normalized, + 1, + @model.typed_schema_value_to_wit(input), + "source", + ) + let forwarded = forward_canonical_input(decoded, normalized, 1) + let forwarded = decode_canonical_input_for_test( + normalized, 1, forwarded, "forwarded", + ) + let format : String = decode_canonical_field_for_test( + forwarded, "format", "forwarded", + ) + let file : String = decode_canonical_field_for_test( + forwarded, "file", "forwarded", + ) + assert_eq(format, "json") + assert_eq(file, "input.txt") +} + +///| +test "forwarding prefers an exact name over an unrelated short form" { + let string = string_graph() + let option = fn(long : String, short : Char?) -> OptionSpecDef { + { + long, + short, + aliases: [], + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } + } + let source : ToolDef = { + version: "1", + commands: [ + { + name: "source", + aliases: [], + doc: doc("source"), + globals: { options: [option("format", None)], flags: [] }, + subcommands: [], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [option("file", Some('f'))], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], + } + let target : ToolDef = { + version: "1", + commands: [ + { + name: "target", + aliases: [], + doc: doc("target"), + globals: { options: [option("format", Some('f'))], flags: [] }, + subcommands: [], + body: None, + }, + ], + } + let input = build_canonical_input(source.canonical_input_model(0), [ + ("format", @model.SchemaValue::String("json")), + ("file", @model.SchemaValue::String("input.txt")), + ]) + let decoded = decode_canonical_input_for_test( + source, + 0, + @model.typed_schema_value_to_wit(input), + "source", + ) + let forwarded = forward_canonical_input(decoded, target, 0) + let forwarded = decode_canonical_input_for_test( + target, 0, forwarded, "target", + ) + let format : String = decode_canonical_field_for_test( + forwarded, "format", "target", + ) + assert_eq(format, "json") +} + +///| +test "grafting rejects child short collision with strict ancestor" { + let flag = fn(long : String) -> @toolCommon.FlagSpec { + { + long, + short: Some('v'), + aliases: [], + doc: doc(long), + shape: @toolCommon.FlagShape::BoolFlag({ + default: false, + negatable: false, + }), + env_var: None, + } + } + let child : ToolDef = { + version: "1", + commands: [ + { + name: "child", + aliases: [], + doc: doc("child"), + globals: { options: [], flags: [flag("child-verbose")] }, + subcommands: [], + body: None, + }, + ], + } + let parent : ToolDef = { + version: "1", + commands: [ + { + name: "parent", + aliases: [], + doc: doc("parent"), + globals: { options: [], flags: [flag("ancestor-verbose")] }, + subcommands: [], + body: None, + }, + ], + } + try + parent.graft_subtree( + child, + "child", + { options: [], flags: [] }, + None, + None, + None, + ) + catch { + InheritedGlobalConflict(_, _) => () + _ => fail("unexpected graft error") + } noraise { + _ => fail("expected strict-ancestor short-form conflict") + } +} + +///| +test "grafting rejects distinct parent and child globals sharing only a short form" { + let string = string_graph() + let option = fn(long : String) -> OptionSpecDef { + { + long, + short: Some('f'), + aliases: [], + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } + } + let parent : ToolDef = { + version: "1", + commands: [ + { + name: "parent", + aliases: [], + doc: doc("parent"), + globals: { options: [], flags: [] }, + subcommands: [], + body: None, + }, + ], + } + let child : ToolDef = { + version: "1", + commands: [ + { + name: "child", + aliases: [], + doc: doc("child"), + globals: { options: [option("format")], flags: [] }, + subcommands: [], + body: None, + }, + ], + } + try + parent.graft_subtree( + child, + "child", + { options: [option("count")], flags: [] }, + None, + None, + None, + ) + catch { + InheritedGlobalConflict(_, _) => () + _ => fail("unexpected graft error") + } noraise { + _ => fail("expected distinct short-form collision to be rejected") + } +} + +///| +test "grafting rejects a child global matching two inherited identities" { + let string = string_graph() + let option = fn(long : String, aliases : Array[String]) -> OptionSpecDef { + { + long, + short: None, + aliases, + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } + } + let parent : ToolDef = { + version: "1", + commands: [ + { + name: "parent", + aliases: [], + doc: doc("parent"), + globals: { options: [option("alpha", [])], flags: [] }, + subcommands: [], + body: None, + }, + ], + } + let child : ToolDef = { + version: "1", + commands: [ + { + name: "child", + aliases: [], + doc: doc("child"), + globals: { options: [option("alpha", ["beta"])], flags: [] }, + subcommands: [], + body: None, + }, + ], + } + try + parent.graft_subtree( + child, + "child", + { options: [option("beta", [])], flags: [] }, + None, + None, + None, + ) + catch { + InheritedGlobalConflict(_, _) => () + _ => fail("unexpected graft error") + } noraise { + _ => fail("expected ambiguous inherited identity conflict") + } +} + +///| +test "deprojected child global does not consume a descendant local input" { + let string = string_graph() + let option = fn( + long : String, + aliases : Array[String], + short : Char?, + ) -> OptionSpecDef { + { + long, + short, + aliases, + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } + } + let child_raw : ToolDef = { + version: "1", + commands: [ + { + name: "deproject-child", + aliases: [], + doc: doc("deproject child"), + globals: { options: [option("child-global", [], Some('f'))], flags: [] }, + subcommands: [1], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + { + name: "run", + aliases: [], + doc: doc("run"), + globals: { options: [], flags: [] }, + subcommands: [], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [option("format", [], None)], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], + } + let child = child_raw.normalize_inherited_globals() + let parent_base : ToolDef = { + version: "1", + commands: [ + { + name: "deproject-parent", + aliases: [], + doc: doc("deproject parent"), + globals: { options: [], flags: [] }, + subcommands: [], + body: None, + }, + ], + } + let parent = parent_base + .graft_subtree( + child_raw, + "deproject-child", + { options: [option("count", ["child-global"], Some('f'))], flags: [] }, + None, + None, + None, + ) + .normalize_inherited_globals() + let parent_index = parent.command_index_by_path(["deproject-child", "run"]) + guard parent_index is Some(parent_index) else { + fail("expected grafted descendant command") + } + inspect( + parent.canonical_input_fields(parent_index).map(field => field.name), + content="[count, format]", ) - guard result is Err(@toolCommon.ToolError::InvalidInput(_)) else { - fail("expected the schema/value mismatch to be rejected") + let model = parent.canonical_input_model(parent_index) + let input = build_canonical_input(model, [ + ("count", @model.SchemaValue::String("inherited")), + ("format", @model.SchemaValue::String("local")), + ]) + let wire = @model.typed_schema_value_to_wit(input) + let fields = decode_canonical_input_for_test( + parent, parent_index, wire, "deproject parent", + ) + let child_index = child.command_index_by_path(["run"]) + guard child_index is Some(child_index) else { + fail("expected child descendant command") } - assert_eq(dropped[0], 1) -} - -///| -fn doc(summary : String) -> @toolCommon.Doc { - { summary, description: "details for " + summary, examples: [] } -} - -///| -fn string_graph() -> @model.SchemaGraph raise { - @schema.schema_graph_of_tag((@schema.type_tag() : @schema.TypeTag[String])) + let forwarded = forward_canonical_input(fields, child, child_index) + let child_input = decode_canonical_input_for_test( + child, child_index, forwarded, "deproject child", + ) + let format : String = decode_canonical_field_for_test( + child_input, "format", "deproject child", + ) + assert_eq(format, "local") } ///| -fn sample_tool() -> @toolCommon.Tool raise { +test "bug finder forwarding prefers surviving descendant over ancestor alias" { let string = string_graph() - let def : ToolDef = { - version: "1.0.0", + let option = fn(long : String, aliases : Array[String]) -> OptionSpecDef { + { + long, + short: None, + aliases, + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } + } + let child_raw : ToolDef = { + version: "1", commands: [ { - name: "grep", + name: "ranked-forward-child", aliases: [], - doc: doc("search files"), - globals: { - options: [], - flags: [ - { - long: "verbose", - short: Some('v'), - aliases: ["chatty"], - doc: doc("show verbose output"), - shape: @toolCommon.FlagShape::BoolFlag({ - default: false, - negatable: false, - }), - env_var: None, - }, - ], - }, + doc: doc("ranked forward child"), + globals: { options: [option("format", ["leaf"])], flags: [] }, subcommands: [1], body: None, }, { name: "run", aliases: [], - doc: doc("run grep"), + doc: doc("run"), globals: { options: [], flags: [] }, subcommands: [], body: Some({ - positionals: { - fixed: [ - { - name: "pattern", - doc: doc("pattern to search"), - value_name: None, - type_: string, - default: None, - required: true, - accepts_stdio: false, - }, - ], - tail: None, - }, - options: [ - { - long: "config", - short: None, - aliases: [], - doc: doc("config file"), - value_name: None, - shape: OptionShapeDef::Scalar(string), - default: None, - required: false, - env_var: None, - }, - ], + positionals: { fixed: [], tail: None }, + options: [option("leaf", [])], flags: [], constraints: [], stdin: None, @@ -219,441 +771,67 @@ fn sample_tool() -> @toolCommon.Tool raise { }, ], } - def.to_tool() -} - -///| -fn[T] unwrap_tool_result(result : Result[T, ToolBuildError]) -> T { - match result { - Ok(value) => value - Err(_) => abort("unexpected tool result error") - } -} - -///| -test "subtree-only tool cannot be invoked as a top-level tool" { - run_async_test(() => { - let def = canonical_test_def() - register_subtool_def_invoker(def, fn(_, _, _, _) { - Ok(invocation_result_empty()) - }) - assert_true( - get_registered_tool("root") - is Err(@toolCommon.ToolError::InvalidToolName("root")), - ) - let input = @model.typed_schema_value_to_wit( - @schema.try_into_typed_schema_value(()), - ) - assert_true( - invoke_registered_tool( - "root", - [], - input, - None, - @agentCommon.Principal::Anonymous, - ) - is Err(@toolCommon.ToolError::InvalidToolName("root")), - ) - }) -} - -///| -test "grafted subtree forwards a global captured only by short name" { - run_async_test(() => { - let flag = fn(long : String) -> @toolCommon.FlagSpec { + let child = child_raw.normalize_inherited_globals() + inspect( + child.canonical_input_fields(1).map(field => field.name), + content="[format]", + ) + let parent_base : ToolDef = { + version: "1", + commands: [ { - long, - short: Some('v'), + name: "ranked-forward-parent", aliases: [], - doc: doc(long), - shape: @toolCommon.FlagShape::BoolFlag({ - default: false, - negatable: false, - }), - env_var: None, - } - } - let child : ToolDef = { - version: "1", - commands: [ - { - name: "short-forward-child", - aliases: [], - doc: doc("short forward child"), - globals: { options: [], flags: [flag("child-verbose")] }, - subcommands: [], - body: Some({ - positionals: { fixed: [], tail: None }, - options: [], - flags: [], - constraints: [], - stdin: None, - stdout: None, - result: None, - errors: [], - annotations: None, - }), - }, - ], - } - let parent_base : ToolDef = { - version: "1", - commands: [ - { - name: "short-forward-parent", - aliases: [], - doc: doc("short forward parent"), - globals: { options: [], flags: [] }, - subcommands: [], - body: None, - }, - ], - } - let parent = parent_base.graft_subtree( - child, - "short-forward-child", - { options: [], flags: [flag("parent-verbose")] }, - None, + doc: doc("ranked forward parent"), + globals: { options: [], flags: [] }, + subcommands: [], + body: None, + }, + ], + } + let parent = parent_base + .graft_subtree( + child_raw, + "ranked-forward-child", + { options: [option("parent-value", ["format"])], flags: [] }, None, None, - ) - let parent_index = parent.command_index_by_path(["short-forward-child"]) - guard parent_index is Some(parent_index) else { - fail("expected grafted child command") - } - let parent_fields = parent.canonical_input_fields(parent_index) - inspect(parent_fields.map(field => field.name), content="[parent-verbose]") - assert_true(parent_fields[0].aliases.contains("v")) - register_subtool_def_invoker(child, fn(command_path, input, _, _) { - guard command_path.length() == 0 else { - return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) - } - let decoded = decode_canonical_input_for_test( - child, 0, input, "short child", - ) catch { - error => return Err(error) - } - let verbose : Bool = decode_canonical_field_for_test( - decoded, "child-verbose", "short child", - ) catch { - error => return Err(error) - } - if verbose { - Ok(invocation_result_empty()) - } else { - Err(@toolCommon.ToolError::InvalidInput("short flag was not forwarded")) - } - }) - register_tool_def_invoker(parent, fn( - command_path, - input, - stdin, - principal, - ) { - let index = match parent.command_index_by_path(command_path) { - Some(index) => index - None => - return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) - } - let decoded = decode_canonical_input_for_test( - parent, index, input, "short parent", - ) catch { - error => return Err(error) - } - invoke_registered_subtool_for_test( - "short-forward-child", - command_path[1:].to_array(), - decoded, - stdin, - principal, - ) - }) - let model = parent.canonical_input_model(parent_index) - let input = build_canonical_input(model, [ - ("parent-verbose", @model.SchemaValue::Bool(true)), - ]) - let wire = @model.typed_schema_value_to_wit(input) - assert_true( - invoke_registered_tool( - "short-forward-parent", - ["short-forward-child"], - wire, - None, - @agentCommon.Principal::Anonymous, - ) - is Ok(_), - ) - }) -} - -///| -test "deprojected child global does not consume a descendant local input" { - run_async_test(() => { - let string = string_graph() - let option = fn(long : String, short : Char?) -> OptionSpecDef { - { - long, - short, - aliases: [], - doc: doc(long), - value_name: None, - shape: OptionShapeDef::Scalar(string), - default: None, - required: true, - env_var: None, - } - } - let child_raw : ToolDef = { - version: "1", - commands: [ - { - name: "deproject-child", - aliases: [], - doc: doc("deproject child"), - globals: { options: [option("format", Some('f'))], flags: [] }, - subcommands: [1], - body: Some({ - positionals: { fixed: [], tail: None }, - options: [], - flags: [], - constraints: [], - stdin: None, - stdout: None, - result: None, - errors: [], - annotations: None, - }), - }, - { - name: "run", - aliases: [], - doc: doc("run"), - globals: { options: [], flags: [] }, - subcommands: [], - body: Some({ - positionals: { fixed: [], tail: None }, - options: [option("format", None)], - flags: [], - constraints: [], - stdin: None, - stdout: None, - result: None, - errors: [], - annotations: None, - }), - }, - ], - } - let child = child_raw.normalize_inherited_globals() - let parent_base : ToolDef = { - version: "1", - commands: [ - { - name: "deproject-parent", - aliases: [], - doc: doc("deproject parent"), - globals: { options: [], flags: [] }, - subcommands: [], - body: None, - }, - ], - } - let parent = parent_base - .graft_subtree( - child_raw, - "deproject-child", - { options: [option("count", Some('f'))], flags: [] }, - None, - None, - None, - ) - .normalize_inherited_globals() - let parent_index = parent.command_index_by_path(["deproject-child", "run"]) - guard parent_index is Some(parent_index) else { - fail("expected grafted descendant command") - } - inspect( - parent.canonical_input_fields(parent_index).map(field => field.name), - content="[count, format]", - ) - register_subtool_def_invoker(child, fn(command_path, input, _, _) { - let index = match child.command_index_by_path(command_path) { - Some(index) => index - None => - return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) - } - let decoded = decode_canonical_input_for_test( - child, index, input, "deproject child", - ) catch { - error => return Err(error) - } - let format : String = decode_canonical_field_for_test( - decoded, "format", "deproject child", - ) catch { - error => return Err(error) - } - if format == "local" { - Ok(invocation_result_empty()) - } else { - Err( - @toolCommon.ToolError::InvalidInput("descendant input was shadowed"), - ) - } - }) - let model = parent.canonical_input_model(parent_index) - let input = build_canonical_input(model, [ - ("count", @model.SchemaValue::String("inherited")), - ("format", @model.SchemaValue::String("local")), - ]) - let wire = @model.typed_schema_value_to_wit(input) - let fields = decode_canonical_input_for_test( - parent, parent_index, wire, "deproject parent", - ) - assert_true( - invoke_registered_subtool_for_test( - "deproject-child", - ["run"], - fields, - None, - @agentCommon.Principal::Anonymous, - ) - is Ok(_), - ) - }) -} - -///| -test "bug finder forwarding prefers surviving descendant over ancestor alias" { - run_async_test(() => { - let string = string_graph() - let option = fn(long : String, aliases : Array[String]) -> OptionSpecDef { - { - long, - short: None, - aliases, - doc: doc(long), - value_name: None, - shape: OptionShapeDef::Scalar(string), - default: None, - required: true, - env_var: None, - } - } - let child_raw : ToolDef = { - version: "1", - commands: [ - { - name: "ranked-forward-child", - aliases: [], - doc: doc("ranked forward child"), - globals: { options: [option("format", ["leaf"])], flags: [] }, - subcommands: [1], - body: None, - }, - { - name: "run", - aliases: [], - doc: doc("run"), - globals: { options: [], flags: [] }, - subcommands: [], - body: Some({ - positionals: { fixed: [], tail: None }, - options: [option("leaf", [])], - flags: [], - constraints: [], - stdin: None, - stdout: None, - result: None, - errors: [], - annotations: None, - }), - }, - ], - } - let child = child_raw.normalize_inherited_globals() - inspect( - child.canonical_input_fields(1).map(field => field.name), - content="[format]", - ) - let parent_base : ToolDef = { - version: "1", - commands: [ - { - name: "ranked-forward-parent", - aliases: [], - doc: doc("ranked forward parent"), - globals: { options: [], flags: [] }, - subcommands: [], - body: None, - }, - ], - } - let parent = parent_base - .graft_subtree( - child_raw, - "ranked-forward-child", - { options: [option("parent-value", ["format"])], flags: [] }, - None, - None, - None, - ) - .normalize_inherited_globals() - let parent_index = parent.command_index_by_path([ - "ranked-forward-child", "run", - ]) - guard parent_index is Some(parent_index) else { - fail("expected grafted descendant command") - } - inspect( - parent.canonical_input_fields(parent_index).map(field => field.name), - content="[parent-value, leaf]", - ) - register_subtool_def_invoker(child, fn(command_path, input, _, _) { - let index = match child.command_index_by_path(command_path) { - Some(index) => index - None => - return Err(@toolCommon.ToolError::InvalidCommandPath(command_path)) - } - let decoded = decode_canonical_input_for_test( - child, index, input, "ranked child", - ) catch { - error => return Err(error) - } - let leaf : String = decode_canonical_field_for_test( - decoded, "format", "ranked child", - ) catch { - error => return Err(error) - } - if leaf == "local" { - Ok(invocation_result_empty()) - } else { - Err( - @toolCommon.ToolError::InvalidInput("ancestor alias won forwarding"), - ) - } - }) - let model = parent.canonical_input_model(parent_index) - let input = build_canonical_input(model, [ - ("parent-value", @model.SchemaValue::String("ancestor")), - ("leaf", @model.SchemaValue::String("local")), - ]) - let fields = decode_canonical_input_for_test( - parent, - parent_index, - @model.typed_schema_value_to_wit(input), - "ranked parent", - ) - let result = invoke_registered_subtool_for_test( - "ranked-forward-child", - ["run"], - fields, None, - @agentCommon.Principal::Anonymous, ) - guard result is Ok(_) else { - fail("surviving descendant was not forwarded") - } - }) + .normalize_inherited_globals() + let parent_index = parent.command_index_by_path([ + "ranked-forward-child", "run", + ]) + guard parent_index is Some(parent_index) else { + fail("expected grafted descendant command") + } + inspect( + parent.canonical_input_fields(parent_index).map(field => field.name), + content="[parent-value, leaf]", + ) + let model = parent.canonical_input_model(parent_index) + let input = build_canonical_input(model, [ + ("parent-value", @model.SchemaValue::String("ancestor")), + ("leaf", @model.SchemaValue::String("local")), + ]) + let fields = decode_canonical_input_for_test( + parent, + parent_index, + @model.typed_schema_value_to_wit(input), + "ranked parent", + ) + let child_index = child.command_index_by_path(["run"]) + guard child_index is Some(child_index) else { + fail("expected child descendant command") + } + let forwarded = forward_canonical_input(fields, child, child_index) + let child_input = decode_canonical_input_for_test( + child, child_index, forwarded, "ranked child", + ) + let leaf : String = decode_canonical_field_for_test( + child_input, "format", "ranked child", + ) + assert_eq(leaf, "local") } ///| @@ -740,9 +918,7 @@ test "panic top-level registration rejects an existing private subtool name" { }, ], } - register_subtool_def_invoker(def, fn(_, _, _, _) { - Ok(invocation_result_empty()) - }) + register_subtool_def_for_test(def) register_tool_def(def) } @@ -956,6 +1132,60 @@ test "normalization rejects a local field overlapping two inherited globals" { } } +///| +test "normalization rejects distinct options sharing an inherited short form" { + let string = string_graph() + let option = fn(long : String) -> OptionSpecDef { + { + long, + short: Some('f'), + aliases: [], + doc: doc(long), + value_name: None, + shape: OptionShapeDef::Scalar(string), + default: None, + required: true, + env_var: None, + } + } + let def : ToolDef = { + version: "1", + commands: [ + { + name: "root", + aliases: [], + doc: doc("root"), + globals: { options: [option("format")], flags: [] }, + subcommands: [1], + body: None, + }, + { + name: "child", + aliases: [], + doc: doc("child"), + globals: { options: [], flags: [] }, + subcommands: [], + body: Some({ + positionals: { fixed: [], tail: None }, + options: [option("file")], + flags: [], + constraints: [], + stdin: None, + stdout: None, + result: None, + errors: [], + annotations: None, + }), + }, + ], + } + try def.normalize_inherited_globals() catch { + _ => () + } noraise { + _ => fail("expected inherited short-form conflict") + } +} + ///| test "normalization resolves value-is literals against inherited globals" { let string = string_graph() From 825a374d0f5232dbcb9ab1eb218de4822d0a4d97 Mon Sep 17 00:00:00 2001 From: Daniel Vigovszky Date: Thu, 20 Aug 2026 17:36:15 +0200 Subject: [PATCH 5/7] Fix streaming invocation CI regressions Restore snapshot and unpersisted durability suppression after the main merge, validate invocations against the effective component revision, and fix interruption handling. Align generated tool metadata, bridge expectations, lint findings, and rebuilt OTLP exporter assets with the current schema. Amp-Thread-ID: https://ampcode.com/threads/T-01a01eb5-db34-75a5-967c-584232291ae5 Co-authored-by: Amp --- cli/golem-cli/src/bridge_gen/moonbit/mod.rs | 6 + cli/golem-cli/src/bridge_gen/moonbit/tool.rs | 6 +- .../agent/invocation_session.rs | 8 +- cli/golem-cli/tests/app/agents.rs | 2 + cli/golem-cli/tests/bridge_gen/scala.rs | 6 +- golem-schema/src/schema/tool/canonical.rs | 26 ++ .../src/durable_host/concurrent/call.rs | 36 +-- .../src/durable_host/durability.rs | 6 +- .../src/durable_host/golem/retry_api.rs | 4 +- .../src/durable_host/golem/v1x.rs | 8 +- .../src/durable_host/http/types.rs | 2 +- golem-worker-executor/src/durable_host/mod.rs | 31 ++- .../src/durable_host/p3/http/send.rs | 2 +- .../src/durable_host/quota/mod.rs | 18 +- .../src/durable_host/schema_value_stream.rs | 22 +- .../src/durable_host/secrets/mod.rs | 18 +- .../src/durable_host/stream_bus.rs | 2 + .../src/durable_host/stream_session.rs | 49 ++-- .../src/durable_host/wasm_rpc/mod.rs | 26 ++ .../src/grpc/invocation_session.rs | 222 +++++++++++------- .../src/services/worker_proxy.rs | 13 +- .../src/worker/invocation_loop.rs | 2 +- golem-worker-executor/src/worker/mod.rs | 8 +- golem-worker-executor/tests/agent.rs | 15 +- golem-worker-executor/tests/api.rs | 4 +- golem-worker-service/src/api/agents.rs | 15 +- .../src/service/worker/client.rs | 13 +- plugins/otlp-exporter.wasm | Bin 368153 -> 368712 bytes .../.agents/skills/golem-build/SKILL.md | 2 +- .../skills/golem-cloud-account-setup/SKILL.md | 14 +- .../golem-configure-mcp-server/SKILL.md | 13 +- .../golem-integration-test-setup/SKILL.md | 4 +- .../skills/golem-invoke-agent-rust/SKILL.md | 22 +- .../skills/golem-local-dev-server/SKILL.md | 10 +- .../golem-profiles-and-environments/SKILL.md | 11 +- .../skills/golem-troubleshoot-build/SKILL.md | 2 +- plugins/otlp-exporter/Cargo.lock | 71 ++++++ plugins/otlp-exporter/golem.yaml | 2 +- sdks/rust/golem-rust-macro/src/tool/client.rs | 48 ++++ .../golem-rust/benches/tool_client_bench.rs | 5 + .../src/agentic/extended_tool_type.rs | 13 + sdks/rust/golem-rust/tests/tool_canonical.rs | 5 + 42 files changed, 551 insertions(+), 241 deletions(-) diff --git a/cli/golem-cli/src/bridge_gen/moonbit/mod.rs b/cli/golem-cli/src/bridge_gen/moonbit/mod.rs index 1e431f669c..5b09f908f7 100644 --- a/cli/golem-cli/src/bridge_gen/moonbit/mod.rs +++ b/cli/golem-cli/src/bridge_gen/moonbit/mod.rs @@ -2925,6 +2925,12 @@ fn moonbit_string_literal(value: &str) -> String { escaped } +fn moonbit_char_option_literal(value: Option) -> String { + value + .map(|value| format!("Some('\\u{{{:x}}}')", value as u32)) + .unwrap_or_else(|| "None".to_string()) +} + /// Whether a (ref-resolved) schema type becomes a generated MoonBit definition /// (struct / enum). Other named defs are inlined at their use sites. fn is_named_composite(resolved: &SchemaType) -> bool { diff --git a/cli/golem-cli/src/bridge_gen/moonbit/tool.rs b/cli/golem-cli/src/bridge_gen/moonbit/tool.rs index e3e7c709d3..015bcf4c51 100644 --- a/cli/golem-cli/src/bridge_gen/moonbit/tool.rs +++ b/cli/golem-cli/src/bridge_gen/moonbit/tool.rs @@ -17,7 +17,8 @@ use super::moonbit::{ to_moonbit_constructor_ident, to_moonbit_term_ident, unique_idents_with_reserved, }; use super::{ - MoonBitBridgeGenerator, emit_schema_graph_literal, guest_codec_source, moonbit_string_literal, + MoonBitBridgeGenerator, emit_schema_graph_literal, guest_codec_source, + moonbit_char_option_literal, moonbit_string_literal, }; use crate::bridge_gen::tool_bridge_client_directory_name; use crate::bridge_gen::tool_common::{ @@ -581,9 +582,10 @@ impl MoonBitToolBridgeGenerator { .zip(&field_graphs) .map(|(field, field_graph)| { format!( - "@tool.CanonicalInputField::{{ name: {}, aliases: {}, type_: {} }}", + "@tool.CanonicalInputField::{{ name: {}, aliases: {}, short: {}, type_: {} }}", moonbit_string_literal(&field.name), moonbit_string_array(&field.aliases), + moonbit_char_option_literal(field.short), emit_schema_graph_literal(&field_graph.graph) ) }) diff --git a/cli/golem-cli/src/command_handler/agent/invocation_session.rs b/cli/golem-cli/src/command_handler/agent/invocation_session.rs index edc855693e..38ff2b46f1 100644 --- a/cli/golem-cli/src/command_handler/agent/invocation_session.rs +++ b/cli/golem-cli/src/command_handler/agent/invocation_session.rs @@ -83,7 +83,7 @@ struct OutputStream { enum OutputJob { Text(String), Raw(Vec), - Event(AgentInvocationSessionEvent), + Event(Box), } struct OutputChannel { @@ -1344,8 +1344,8 @@ async fn handle_response( fn event( kind: AgentInvocationSessionEventKind, idempotency_key: &str, -) -> AgentInvocationSessionEvent { - AgentInvocationSessionEvent::new(kind, idempotency_key) +) -> Box { + Box::new(AgentInvocationSessionEvent::new(kind, idempotency_key)) } async fn emit(output: &OutputChannel, job: OutputJob) -> anyhow::Result<()> { @@ -1392,7 +1392,7 @@ fn render_output_job(job: OutputJob, format: Format, colorize: bool) -> anyhow:: } OutputJob::Raw(bytes) => Ok(bytes), OutputJob::Event(event) => { - let mut document = render_command_output_document(format, colorize, event)?; + let mut document = render_command_output_document(format, colorize, *event)?; document.push('\n'); Ok(document.into_bytes()) } diff --git a/cli/golem-cli/tests/app/agents.rs b/cli/golem-cli/tests/app/agents.rs index c91cc002e9..07a87faf66 100644 --- a/cli/golem-cli/tests/app/agents.rs +++ b/cli/golem-cli/tests/app/agents.rs @@ -80,6 +80,8 @@ async fn streaming_invocation_context() -> TestContext { golem-it:agent-rpc-rust: dir: component templates: rust-streaming-test + presets: + release: {{}} environments: local: diff --git a/cli/golem-cli/tests/bridge_gen/scala.rs b/cli/golem-cli/tests/bridge_gen/scala.rs index fa91f9e2f7..1633fd4a61 100644 --- a/cli/golem-cli/tests/bridge_gen/scala.rs +++ b/cli/golem-cli/tests/bridge_gen/scala.rs @@ -429,7 +429,7 @@ fn guest_wasm_rpc_does_not_emit_external_rest_runtime_references() { /// Guest agent bridges expose the Scala SDK RPC surface: constructors resolve /// remote agents through `RemoteAgentClient`, methods invoke Wasm RPC via -/// `invokeAndAwait`, and the generated Scala.js build is ready for a real +/// `asyncInvokeAndAwait`, and the generated Scala.js build is ready for a real /// compile once the in-tree Scala SDK has been published locally. #[test] fn guest_agent_client_surface_targets_scala_sdk_rpc() { @@ -459,11 +459,11 @@ fn guest_agent_client_surface_targets_scala_sdk_rpc() { assert!(client_source.contains("_root_.scala.Either")); assert!(client_source.contains("CounterAgentRemote")); assert!(client_source.contains("_root_.golem.runtime.rpc.RemoteAgentClient.resolve")); - assert!(client_source.contains("resolved.invokeAndAwait")); + assert!(client_source.contains("resolved.asyncInvokeAndAwait")); assert!(client_source.contains("resolved.cancelableAsyncInvokeAndAwait")); assert!(client_source.contains("_root_.golem.runtime.rpc.CancellationToken")); assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.encodeValue")); - assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.decodeResultAsync")); + assert!(client_source.contains("_root_.golem.runtime.rpc.SchemaRpcCodec.decodeValue")); assert!(!client_source.contains("Bridge.createAgent")); assert!(!client_source.contains("golem.bridge.runtime")); diff --git a/golem-schema/src/schema/tool/canonical.rs b/golem-schema/src/schema/tool/canonical.rs index 225234b79d..9870f95f49 100644 --- a/golem-schema/src/schema/tool/canonical.rs +++ b/golem-schema/src/schema/tool/canonical.rs @@ -53,6 +53,7 @@ use std::collections::BTreeSet; pub struct CanonicalInputField { pub name: String, pub aliases: Vec, + pub short: Option, pub type_: SchemaType, } @@ -70,6 +71,7 @@ pub struct CanonicalInputModel { pub struct CanonicalInputValue { pub name: String, pub aliases: Vec, + pub short: Option, pub type_: SchemaType, pub value: SchemaValue, } @@ -156,6 +158,7 @@ impl CanonicalInputModel { .map(|(field, value)| CanonicalInputValue { name: field.name, aliases: field.aliases, + short: field.short, type_: field.type_, value, }) @@ -324,6 +327,7 @@ impl Tool { Some(CanonicalInputField { name: option.long.clone(), aliases: option.aliases.clone(), + short: option.short, type_: option_collected_type(&option.shape), }) } @@ -332,6 +336,7 @@ impl Tool { Some(CanonicalInputField { name: flag.long.clone(), aliases: flag.aliases.clone(), + short: flag.short, type_: flag_type(flag), }) } @@ -340,6 +345,7 @@ impl Tool { Some(CanonicalInputField { name: positional.name.clone(), aliases: Vec::new(), + short: None, type_: positional.type_.clone(), }) } @@ -348,6 +354,7 @@ impl Tool { Some(CanonicalInputField { name: tail.name.clone(), aliases: Vec::new(), + short: None, type_: tail_collected_type(tail), }) } @@ -356,6 +363,7 @@ impl Tool { Some(CanonicalInputField { name: option.long.clone(), aliases: option.aliases.clone(), + short: option.short, type_: option_collected_type(&option.shape), }) } @@ -364,6 +372,7 @@ impl Tool { Some(CanonicalInputField { name: flag.long.clone(), aliases: flag.aliases.clone(), + short: flag.short, type_: flag_type(flag), }) } @@ -868,6 +877,23 @@ mod tests { ); } + #[test] + fn canonical_input_fields_preserve_short_options() { + let mut tool = grep_tool(); + tool.commands.nodes[0].globals.options[0].short = Some('c'); + tool.commands.nodes[0].globals.flags[0].short = Some('i'); + tool.commands.nodes[0].body.as_mut().unwrap().options[1].short = Some('n'); + tool.commands.nodes[0].body.as_mut().unwrap().flags[0].short = Some('v'); + + let fields = tool.canonical_input_fields(0); + let shorts: Vec> = fields.iter().map(|field| field.short).collect(); + + assert_eq!( + shorts, + vec![Some('c'), Some('i'), None, None, None, Some('n'), Some('v'),] + ); + } + #[test] fn globals_are_effective_on_subcommand() { let tool = grep_tool(); diff --git a/golem-worker-executor/src/durable_host/concurrent/call.rs b/golem-worker-executor/src/durable_host/concurrent/call.rs index adacf6290e..2a69804c48 100644 --- a/golem-worker-executor/src/durable_host/concurrent/call.rs +++ b/golem-worker-executor/src/durable_host/concurrent/call.rs @@ -849,7 +849,8 @@ impl CallHandle { observational_owner, }; let is_live = durable_execution_state.is_live; - let unpersisted = durable_execution_state.is_unpersisted_execution; + let unpersisted = durable_execution_state.snapshotting_mode + || durable_execution_state.is_unpersisted_execution; let retry = InFunctionRetryController::new(function_type, durable_execution_state, Pair::FQFN); // A live persisted call initiated inside an open atomic region joins the region's member @@ -2733,7 +2734,7 @@ where ( opens_scope, is_live, - ctx.is_unpersisted_execution(), + ctx.state.durability_is_suppressed(), replay_handle, ctx.state.replay_state.clone(), ctx.state.oplog.clone(), @@ -2890,22 +2891,24 @@ where D: HasData + ?Sized, Ctx: WorkerCtx, { - let (is_live, is_unpersisted_execution, worker, replay_state) = store.with(|mut access| { + let (is_live, durability_is_suppressed, worker, replay_state) = store.with(|mut access| { let ctx = get_ctx(access.data_mut()); ( ctx.state.is_live(), - ctx.is_unpersisted_execution(), + ctx.state.durability_is_suppressed(), ctx.public_state.worker(), ctx.state.replay_state.clone(), ) }); - if is_live && !is_unpersisted_execution { - worker - .add_to_oplog(OplogEntry::finish_span(span_id.clone())) - .await; - } else if !is_live { - crate::get_oplog_entry_owned!(replay_state, OplogEntry::FinishSpan)?; + if !durability_is_suppressed { + if is_live { + worker + .add_to_oplog(OplogEntry::finish_span(span_id.clone())) + .await; + } else { + crate::get_oplog_entry_owned!(replay_state, OplogEntry::FinishSpan)?; + } } store.with(|mut access| { @@ -3382,23 +3385,22 @@ impl BegunCall { } /// Second phase on the live path: upload the request and append the eager host-call `Start` - /// (or, during an unpersisted execution, persist nothing). + /// (or, while durability is suppressed, persist nothing). pub async fn start_live( self, ctx: &mut DurableWorkerCtx, request: Pair::Req, ) -> Result, WorkerExecutorError> { debug_assert!(self.is_live(), "start_live() called on a replay handle"); - let is_unpersisted_execution = self - .retry - .durable_execution_state() - .is_unpersisted_execution; + let durable_execution_state = self.retry.durable_execution_state(); + let durability_is_suppressed = durable_execution_state.snapshotting_mode + || durable_execution_state.is_unpersisted_execution; // The host-call `Start` nests inside the enclosing durable scope captured at initiation // (its own opened scope, or the scope encoded in the function type), derived explicitly — // never from the set of temporally-open sibling scopes. `None` for a top-level unscoped call. let parent_start_index = self.execution_scope.parent_start_index; - let (start_idx, persisted, request_upload) = if is_unpersisted_execution { - // Unpersisted execution writes no durable call records. + let (start_idx, persisted, request_upload) = if durability_is_suppressed { + // Snapshot and unpersisted execution write no durable call records. let oplog = ctx.state.oplog.clone(); ( oplog.current_oplog_index().await, diff --git a/golem-worker-executor/src/durable_host/durability.rs b/golem-worker-executor/src/durable_host/durability.rs index 5b05416e4e..cf6f31c8e9 100644 --- a/golem-worker-executor/src/durable_host/durability.rs +++ b/golem-worker-executor/src/durable_host/durability.rs @@ -1844,7 +1844,7 @@ impl InFunctionRetryHost for DurableWorkerCtx { fn durable_execution_state(&self) -> DurableExecutionState { let is_unpersisted_execution = self.is_unpersisted_execution(); DurableExecutionState { - is_live: self.state.is_live() || is_unpersisted_execution, + is_live: self.state.is_live() || self.state.durability_is_suppressed(), snapshotting_mode: self.state.snapshotting_mode, is_unpersisted_execution, assume_idempotence: self.state.assume_idempotence, @@ -1868,7 +1868,7 @@ impl InFunctionRetryHost for DurableWorkerCtx { inside_atomic_region: bool, retry_policy_state: Option, ) { - if self.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { return; } @@ -1930,7 +1930,7 @@ impl DurabilityHost for DurableWorkerCtx { forced_commit: bool, ) -> Result<(), WorkerExecutorError> { self.end_function(function_type, begin_index).await?; - if !self.is_unpersisted_execution() + if !self.state.durability_is_suppressed() && (function_type == &DurableFunctionType::WriteRemote || matches!(function_type, DurableFunctionType::WriteRemoteBatched(_)) || matches!( diff --git a/golem-worker-executor/src/durable_host/golem/retry_api.rs b/golem-worker-executor/src/durable_host/golem/retry_api.rs index 0c09bc967d..f5270be020 100644 --- a/golem-worker-executor/src/durable_host/golem/retry_api.rs +++ b/golem-worker-executor/src/durable_host/golem/retry_api.rs @@ -128,7 +128,7 @@ impl Host for DurableWorkerCtx { let named_policy: NamedRetryPolicy = policy.into(); - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { // Apply the in-memory change without creating durable history. } else if self.state.is_live() { self.public_state @@ -146,7 +146,7 @@ impl Host for DurableWorkerCtx { async fn remove_retry_policy(&mut self, name: String) -> anyhow::Result<()> { self.observe_function_call("golem::api::retry", "remove_retry_policy"); - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { // Apply the in-memory change without creating durable history. } else if self.state.is_live() { self.public_state diff --git a/golem-worker-executor/src/durable_host/golem/v1x.rs b/golem-worker-executor/src/durable_host/golem/v1x.rs index dd87346f4d..c5229d17c5 100644 --- a/golem-worker-executor/src/durable_host/golem/v1x.rs +++ b/golem-worker-executor/src/durable_host/golem/v1x.rs @@ -322,7 +322,7 @@ impl Host for DurableWorkerCtx { async fn get_oplog_index(&mut self) -> anyhow::Result { self.observe_function_call("golem::api", "get_oplog_index"); - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { Ok(self.state.current_oplog_index().await.into()) } else if self.state.is_live() { // Use the index returned by `add` — a concurrently running host task (a durable @@ -362,7 +362,7 @@ impl Host for DurableWorkerCtx { oplog_idx: golem_api_1_x::oplog::OplogIndex, ) -> anyhow::Result<()> { self.observe_function_call("golem::api", "set_oplog_index"); - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { return Ok(()); } if self.state.is_live() { @@ -445,7 +445,7 @@ impl Host for DurableWorkerCtx { async fn mark_begin_operation(&mut self) -> anyhow::Result { self.observe_function_call("golem::api", "mark_begin_operation"); - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { Ok(self.state.current_oplog_index().await.into()) } else if self.state.is_live() { let next_idempotency_key_oplog_index = self @@ -532,7 +532,7 @@ impl Host for DurableWorkerCtx { begin: golem_api_1_x::oplog::OplogIndex, ) -> anyhow::Result<()> { self.observe_function_call("golem::api", "mark_end_operation"); - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { return Ok(()); } let begin_index = OplogIndex::from_u64(begin); diff --git a/golem-worker-executor/src/durable_host/http/types.rs b/golem-worker-executor/src/durable_host/http/types.rs index 7998adebea..d7309e4466 100644 --- a/golem-worker-executor/src/durable_host/http/types.rs +++ b/golem-worker-executor/src/durable_host/http/types.rs @@ -1530,7 +1530,7 @@ async fn persist_http_response( serializable_response: &SerializableHttpResponse, begin_index: golem_common::model::oplog::OplogIndex, ) { - if !ctx.is_unpersisted_execution() { + if !ctx.state.durability_is_suppressed() { ctx.append_completed_child_call( HttpTypesFutureIncomingResponseGet::HOST_FUNCTION_NAME, &HostRequest::HttpRequest(request), diff --git a/golem-worker-executor/src/durable_host/mod.rs b/golem-worker-executor/src/durable_host/mod.rs index 3cadf78844..59ed5413d8 100644 --- a/golem-worker-executor/src/durable_host/mod.rs +++ b/golem-worker-executor/src/durable_host/mod.rs @@ -266,6 +266,8 @@ struct UnpersistedExecution { kind: UnpersistedExecutionKind, } +type PreparedFilesystemStorageReservation = (Arc>, u64, bool); + impl Drop for WorkerDir { fn drop(&mut self) { if let WorkerDir::Deterministic(p) = self @@ -1673,7 +1675,7 @@ impl DurableWorkerCtx { pub(crate) fn prepare_filesystem_storage_reservation( &mut self, new_bytes: u64, - ) -> anyhow::Result>, u64, bool)>> { + ) -> anyhow::Result>> { if new_bytes == 0 || self.state.is_replay() { return Ok(None); } @@ -2132,7 +2134,7 @@ impl DurableWorkerCtx { &mut self, function_type: &DurableFunctionType, ) -> Result { - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { let begin_index = self.state.current_oplog_index().await; self.state.current_retry_point = begin_index; return Ok(begin_index); @@ -2318,7 +2320,7 @@ impl DurableWorkerCtx { function_type: &DurableFunctionType, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { return Ok(()); } @@ -2493,7 +2495,7 @@ impl DurableWorkerCtx { where Err: From, { - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { let (_, tx) = handler.create_new().await?; let begin_index = self.state.current_oplog_index().await; Ok((begin_index, tx)) @@ -2722,7 +2724,7 @@ impl DurableWorkerCtx { &mut self, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { Ok(()) } else if self.is_live() { // There is some logic in the test code that intercepts oplogs adds for _just_ the oplog the is provided to the worker. @@ -2751,7 +2753,7 @@ impl DurableWorkerCtx { &mut self, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { Ok(()) } else if self.is_live() { // There is some logic in the test code that intercepts oplogs adds for _just_ the oplog the is provided to the worker. @@ -2780,7 +2782,7 @@ impl DurableWorkerCtx { &mut self, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { return Ok(()); } else if self.is_live() { // There is some logic in the test code that intercepts oplogs adds for _just_ the oplog the is provided to the worker. @@ -2831,7 +2833,7 @@ impl DurableWorkerCtx { &mut self, begin_index: OplogIndex, ) -> Result<(), WorkerExecutorError> { - if self.state.is_unpersisted_execution() { + if self.state.durability_is_suppressed() { return Ok(()); } else if self.is_live() { // There is some logic in the test code that intercepts oplogs adds for _just_ the oplog the is provided to the worker. @@ -3955,7 +3957,7 @@ impl InvocationHooks for DurableWorkerCtx { &mut self, mut invocation: AgentInvocation, ) -> Result<(), WorkerExecutorError> { - if !self.is_unpersisted_execution() { + if !self.state.durability_is_suppressed() { let stack = self.get_current_invocation_context().await; match &mut invocation { @@ -4001,6 +4003,7 @@ impl InvocationHooks for DurableWorkerCtx { let current_idempotency_key = self.get_current_idempotency_key().await; if self.state.is_live() + && !self.state.snapshotting_mode && !is_unpersisted_execution && let Err(err) = concurrent::drain_queued_dropped_call_events(self).await { @@ -4157,7 +4160,7 @@ impl InvocationHooks for DurableWorkerCtx { } if is_live { - if !self.is_unpersisted_execution() { + if !self.state.durability_is_suppressed() { let component_revision = output.component_revision.ok_or_else(|| { WorkerExecutorError::runtime( "component_revision missing in AgentInvocationOutput during replay", @@ -7212,7 +7215,7 @@ impl PrivateDurableWorkerState { /// An unpersisted execution never straddles a single scope's begin/end, so guarding both ends /// with the same predicate keeps the durable-scope stack balanced. fn opens_durable_scope(&self, function_type: &DurableFunctionType) -> bool { - !self.is_unpersisted_execution() + !self.durability_is_suppressed() && ((*function_type == DurableFunctionType::WriteRemote && !self.assume_idempotence) || matches!( *function_type, @@ -7563,6 +7566,10 @@ impl PrivateDurableWorkerState { self.unpersisted_execution.is_some() } + fn durability_is_suppressed(&self) -> bool { + self.snapshotting_mode || self.is_unpersisted_execution() + } + /// Whether the current oplog tip is a structurally clean boundary at which a mid-invocation /// status checkpoint may be taken: we are live, no rollback-capable region is open (so no later /// trap/replay can append a jump that deletes the tip), and snapshotting is not active. The @@ -7573,7 +7580,7 @@ impl PrivateDurableWorkerState { !self.is_live(), !self.active_atomic_regions.is_empty(), !self.active_durable_scopes.is_empty(), - self.snapshotting_mode || self.is_unpersisted_execution(), + self.durability_is_suppressed(), ) } diff --git a/golem-worker-executor/src/durable_host/p3/http/send.rs b/golem-worker-executor/src/durable_host/p3/http/send.rs index ea0574f69f..3e1a8b1d16 100644 --- a/golem-worker-executor/src/durable_host/p3/http/send.rs +++ b/golem-worker-executor/src/durable_host/p3/http/send.rs @@ -398,7 +398,7 @@ where let recording_enabled = store.with(|mut access| { !durable_worker_ctx::(access.data_mut()) .state - .snapshotting_mode + .durability_is_suppressed() }); let converted = match convert_physical_send_request::( store, diff --git a/golem-worker-executor/src/durable_host/quota/mod.rs b/golem-worker-executor/src/durable_host/quota/mod.rs index ecdf8bf8fd..b6449323d4 100644 --- a/golem-worker-executor/src/durable_host/quota/mod.rs +++ b/golem-worker-executor/src/durable_host/quota/mod.rs @@ -449,18 +449,16 @@ impl Host for DurableWorkerCtx { /// interface declares for it is `drop`, which releases the underlying lease /// state back to the executor pool. impl HostQuotaTokenWithStore for CoreTypesHost { - fn drop( + async fn drop( accessor: &Accessor, rep: Resource, - ) -> impl Future> + Send { - async move { - accessor.with(|mut access| { - let ctx = access.get(); - DurabilityHost::observe_function_call(ctx, "golem::core::quota-token", "drop"); - ctx.table().delete(rep)?; - Ok(()) - }) - } + ) -> anyhow::Result<()> { + accessor.with(|mut access| { + let ctx = access.get(); + DurabilityHost::observe_function_call(ctx, "golem::core::quota-token", "drop"); + ctx.table().delete(rep)?; + Ok(()) + }) } } diff --git a/golem-worker-executor/src/durable_host/schema_value_stream.rs b/golem-worker-executor/src/durable_host/schema_value_stream.rs index 72c8fa22f7..2e7b6b75ad 100644 --- a/golem-worker-executor/src/durable_host/schema_value_stream.rs +++ b/golem-worker-executor/src/durable_host/schema_value_stream.rs @@ -264,20 +264,18 @@ impl HostSchemaValueStreamWithStore for CoreTyp .map_err(|error| anyhow::anyhow!(error.to_string())) } - fn drop( + async fn drop( accessor: &Accessor, rep: Resource, - ) -> impl Future> + Send { - async move { - accessor.with(|mut access| { - access - .get() - .table() - .delete(rep) - .map_err(|error| anyhow::anyhow!(error.to_string())) - })?; - Ok(()) - } + ) -> anyhow::Result<()> { + accessor.with(|mut access| { + access + .get() + .table() + .delete(rep) + .map_err(|error| anyhow::anyhow!(error.to_string())) + })?; + Ok(()) } } diff --git a/golem-worker-executor/src/durable_host/secrets/mod.rs b/golem-worker-executor/src/durable_host/secrets/mod.rs index 4a8ed7f840..fc027baf8f 100644 --- a/golem-worker-executor/src/durable_host/secrets/mod.rs +++ b/golem-worker-executor/src/durable_host/secrets/mod.rs @@ -174,18 +174,16 @@ fn reveal_error_to_wit(error: SecretRevealError) -> SecretError { } impl HostSecretWithStore for CoreTypesHost { - fn drop( + async fn drop( accessor: &Accessor, rep: Resource, - ) -> impl Future> + Send { - async move { - accessor.with(|mut access| { - let ctx = access.get(); - DurabilityHost::observe_function_call(ctx, "golem::core::secret", "drop"); - ctx.table().delete(rep)?; - Ok(()) - }) - } + ) -> anyhow::Result<()> { + accessor.with(|mut access| { + let ctx = access.get(); + DurabilityHost::observe_function_call(ctx, "golem::core::secret", "drop"); + ctx.table().delete(rep)?; + Ok(()) + }) } } diff --git a/golem-worker-executor/src/durable_host/stream_bus.rs b/golem-worker-executor/src/durable_host/stream_bus.rs index d9fbad135b..8f833b1634 100644 --- a/golem-worker-executor/src/durable_host/stream_bus.rs +++ b/golem-worker-executor/src/durable_host/stream_bus.rs @@ -222,10 +222,12 @@ impl PrimaryLiveStreamSubscriber { } } +#[allow(dead_code)] pub(crate) struct AuxiliaryLiveStreamSubscriber { receiver: Receiver>, } +#[allow(dead_code)] impl AuxiliaryLiveStreamSubscriber { pub(crate) async fn recv(&mut self) -> Result, LiveStreamReceiveError> { receive(&mut self.receiver).await diff --git a/golem-worker-executor/src/durable_host/stream_session.rs b/golem-worker-executor/src/durable_host/stream_session.rs index 84e1ed81af..a63edc7f05 100644 --- a/golem-worker-executor/src/durable_host/stream_session.rs +++ b/golem-worker-executor/src/durable_host/stream_session.rs @@ -113,8 +113,8 @@ enum SessionFrames { } enum OutboundStreamMessage { - Request(invocation_request::Request), - Response(invocation_response::Response), + Request(Box), + Response(Box), } #[derive(Default)] @@ -238,6 +238,7 @@ impl LiveValueSession { } } + #[cfg(test)] pub(crate) fn encode(&self, value: &SchemaValue) -> Result { let (value, stream_ids) = self.encode_with_registered_streams(value)?; self.activate_exported_streams(&stream_ids); @@ -596,9 +597,9 @@ impl LiveValueSession { format!("input stream {} ACK offset overflow", ack.stream_id) })?; if !self - .send_outbound(OutboundStreamMessage::Response( + .send_outbound(OutboundStreamMessage::Response(Box::new( invocation_response::Response::InputAck(ack), - )) + ))) .await { return Err( @@ -1184,13 +1185,13 @@ impl LiveValueSession { match (&self.inner.frames, message) { (SessionFrames::Requests(frames), OutboundStreamMessage::Request(request)) => { tokio::select! { - result = frames.send(InvocationRequest { request: Some(request) }) => result.is_ok(), + result = frames.send(InvocationRequest { request: Some(*request) }) => result.is_ok(), _ = self.inner.cancelled.cancelled() => false, } } (SessionFrames::Responses(frames), OutboundStreamMessage::Response(response)) => { tokio::select! { - result = frames.send(InvocationResponse { response: Some(response) }) => result.is_ok(), + result = frames.send(InvocationResponse { response: Some(*response) }) => result.is_ok(), _ = self.inner.cancelled.cancelled() => false, } } @@ -1239,12 +1240,12 @@ impl LiveValueSession { details: Some(details.to_string()), }; let message = match self.inner.side { - SessionSide::Client => { - OutboundStreamMessage::Request(invocation_request::Request::StreamCancel(cancel)) - } - SessionSide::Server => { - OutboundStreamMessage::Response(invocation_response::Response::StreamCancel(cancel)) - } + SessionSide::Client => OutboundStreamMessage::Request(Box::new( + invocation_request::Request::StreamCancel(cancel), + )), + SessionSide::Server => OutboundStreamMessage::Response(Box::new( + invocation_response::Response::StreamCancel(cancel), + )), }; let _ = self.send_outbound(message).await; if self.inner.side == SessionSide::Client { @@ -1383,12 +1384,12 @@ impl LiveValueSession { fn exported_end(&self, stream_id: u64, offset: u64) -> OutboundStreamMessage { match self.inner.side { - SessionSide::Client => OutboundStreamMessage::Request( + SessionSide::Client => OutboundStreamMessage::Request(Box::new( invocation_request::Request::InputEnd(InputStreamEnd { stream_id, offset }), - ), - SessionSide::Server => OutboundStreamMessage::Response( + )), + SessionSide::Server => OutboundStreamMessage::Response(Box::new( invocation_response::Response::OutputEnd(OutputStreamEnd { stream_id, offset }), - ), + )), } } @@ -1399,7 +1400,7 @@ impl LiveValueSession { details: String, ) -> OutboundStreamMessage { match self.inner.side { - SessionSide::Client => OutboundStreamMessage::Request( + SessionSide::Client => OutboundStreamMessage::Request(Box::new( invocation_request::Request::StreamCancel(StreamCancel { stream_id, offset, @@ -1407,14 +1408,14 @@ impl LiveValueSession { reason: StreamCancelReason::Cancelled as i32, details: Some(details), }), - ), - SessionSide::Server => OutboundStreamMessage::Response( + )), + SessionSide::Server => OutboundStreamMessage::Response(Box::new( invocation_response::Response::OutputError(OutputStreamError { stream_id, offset, details, }), - ), + )), } } @@ -1482,7 +1483,7 @@ impl LiveValueSession { match session.encode_with_registered_streams(&value) { Ok((value, registered_stream_ids)) => { let message = match session.inner.side { - SessionSide::Client => OutboundStreamMessage::Request( + SessionSide::Client => OutboundStreamMessage::Request(Box::new( invocation_request::Request::InputItem( InputStreamItem { stream_id: id, @@ -1492,8 +1493,8 @@ impl LiveValueSession { ), }, ), - ), - SessionSide::Server => OutboundStreamMessage::Response( + )), + SessionSide::Server => OutboundStreamMessage::Response(Box::new( invocation_response::Response::OutputItem( OutputStreamItem { stream_id: id, @@ -1501,7 +1502,7 @@ impl LiveValueSession { value: Some(value), }, ), - ), + )), }; ( message, diff --git a/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs b/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs index 560371d28f..20e8fcea65 100644 --- a/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs +++ b/golem-worker-executor/src/durable_host/wasm_rpc/mod.rs @@ -1751,11 +1751,20 @@ impl HostFutureInvokeResultWithStore span_id, cancel_token, } => { + let interrupt_signal = accessor.with(|mut access| { + let ctx = access.get(); + ctx.create_interrupt_signal() + }); let task_result = { let mut guard = task.lock().await; tokio::select! { biased; _ = cancel_token.cancelled() => None, + interrupt_kind = interrupt_signal => { + drop(guard); + drop(task); + return Err(interrupt_kind.into()); + } result = &mut *guard => Some(result), } }; @@ -1809,11 +1818,20 @@ impl HostFutureInvokeResultWithStore let (response, delivery) = if handle.is_live() { let task = task.expect("a live future-invoke-result must own its background task"); + let interrupt_signal = accessor.with(|mut access| { + let ctx = access.get(); + ctx.create_interrupt_signal() + }); let task_result = { let mut guard = task.lock().await; tokio::select! { biased; _ = cancel_token.cancelled() => None, + interrupt_kind = interrupt_signal => { + drop(guard); + drop(task); + return Err(handle.trap(interrupt_kind)); + } result = &mut *guard => Some(result), } }; @@ -1882,9 +1900,17 @@ impl HostFutureInvokeResultWithStore InvocationFreshnessDisposition::MayExist, ) }); + let interrupt_signal = accessor.with(|mut access| { + let ctx = access.get(); + ctx.create_interrupt_signal() + }); let task_result = tokio::select! { biased; _ = cancel_token.cancelled() => None, + interrupt_kind = interrupt_signal => { + drop(task); + return Err(live.trap(interrupt_kind)); + } result = &mut task => Some(result), }; match task_result { diff --git a/golem-worker-executor/src/grpc/invocation_session.rs b/golem-worker-executor/src/grpc/invocation_session.rs index 25e1b58ac7..d250c8a327 100644 --- a/golem-worker-executor/src/grpc/invocation_session.rs +++ b/golem-worker-executor/src/grpc/invocation_session.rs @@ -182,39 +182,6 @@ impl + UsesAllDeps + Send + Sync + let owned_agent_id = extract_owned_agent_id(request, |r| &r.agent_id, |r| &r.environment_id)?; - let existing_metadata = - if freshness_disposition == InvocationFreshnessDisposition::KnownFresh { - None - } else { - Worker::::get_latest_metadata(self, &owned_agent_id).await - }; - let component_revision = existing_metadata - .as_ref() - .map(|metadata| metadata.last_known_status.component_revision); - let component = self - .component_service() - .get_metadata(owned_agent_id.component_id(), component_revision) - .await?; - let parsed_agent_id = - ParsedAgentId::parse(&owned_agent_id.agent_id.agent_id, &component.metadata) - .map_err(WorkerExecutorError::invalid_request)?; - let streaming = validate_agent_method_invocation( - &component.metadata, - Some(&parsed_agent_id), - &method_name, - &method_parameters, - )?; - if streaming - && matches!( - mode, - golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule - ) - { - return Err(WorkerExecutorError::invalid_request( - "live streams require an attached Await invocation session", - )); - } - Worker::::validate_invocation_freshness( self, &owned_agent_id, @@ -250,13 +217,65 @@ impl + UsesAllDeps + Send + Sync + let worker = self .get_or_create_pending_with_freshness(request, freshness_disposition) .await?; + let status = worker.get_last_known_status().await; + let queued_manual_update_revision = status + .pending_invocations + .iter() + .rev() + .find_map(|invocation| invocation.manual_update_target_revision); + let pending_update_revision = queued_manual_update_revision.or_else(|| { + status + .pending_updates + .back() + .map(|update| update.target_revision) + }); + let current_component = self + .component_service() + .get_metadata( + owned_agent_id.component_id(), + Some(status.component_revision), + ) + .await?; + let (component, streaming) = if let Some(pending_revision) = pending_update_revision + && pending_revision != status.component_revision + && let Ok(pending_component) = self + .component_service() + .get_metadata(owned_agent_id.component_id(), Some(pending_revision)) + .await + && let Ok(parsed_agent_id) = ParsedAgentId::parse( + &owned_agent_id.agent_id.agent_id, + &pending_component.metadata, + ) + && let Ok(streaming) = validate_agent_method_invocation( + &pending_component.metadata, + Some(&parsed_agent_id), + &method_name, + &method_parameters, + ) { + (pending_component, streaming) + } else { + let parsed_agent_id = ParsedAgentId::parse( + &owned_agent_id.agent_id.agent_id, + ¤t_component.metadata, + ) + .map_err(WorkerExecutorError::invalid_request)?; + let streaming = validate_agent_method_invocation( + ¤t_component.metadata, + Some(&parsed_agent_id), + &method_name, + &method_parameters, + )?; + (current_component, streaming) + }; + let accepted_revision = + (worker.agent_mode() == AgentMode::Ephemeral).then_some(component.revision); let mut invocation_output = if streaming { let fingerprint = worker.get_initial_worker_metadata().fingerprint; let invocation = worker .clone() .enqueue_live_streaming(invocation, cancellation) .await?; - publish_acceptance(accepted, Some(component.revision))?; + publish_acceptance(accepted, accepted_revision)?; AgentInvocationOutput { result: AgentInvocationResult::AgentMethod { output: invocation.result().await?, @@ -270,18 +289,54 @@ impl + UsesAllDeps + Send + Sync + agent_fingerprint: Some(fingerprint), } } else { - let result = worker.clone().invoke(invocation).await?; - if let crate::worker::ResultOrSubscription::Finished(Err(error)) = &result { - return Err(error.clone()); - } - publish_acceptance(accepted, Some(component.revision))?; - worker.await_invocation_result(ik.clone(), result).await? + publish_acceptance(accepted, accepted_revision)?; + worker.invoke_and_await(invocation).await? }; invocation_output.agent_id = Some(final_agent_id); invocation_output.idempotency_key = Some(ik); Ok(invocation_output) } golem_api_grpc::proto::golem::worker::AgentInvocationMode::Schedule => { + let existing_metadata = + if freshness_disposition == InvocationFreshnessDisposition::KnownFresh { + None + } else { + Worker::::get_latest_metadata(self, &owned_agent_id).await + }; + let component_revision = existing_metadata.as_ref().map(|metadata| { + let status = &metadata.last_known_status; + status + .pending_invocations + .iter() + .rev() + .find_map(|invocation| invocation.manual_update_target_revision) + .or_else(|| { + status + .pending_updates + .back() + .map(|update| update.target_revision) + }) + .unwrap_or(status.component_revision) + }); + let component = self + .component_service() + .get_metadata(owned_agent_id.component_id(), component_revision) + .await?; + let parsed_agent_id = + ParsedAgentId::parse(&owned_agent_id.agent_id.agent_id, &component.metadata) + .map_err(WorkerExecutorError::invalid_request)?; + let streaming = validate_agent_method_invocation( + &component.metadata, + Some(&parsed_agent_id), + &method_name, + &method_parameters, + )?; + if streaming { + return Err(WorkerExecutorError::invalid_request( + "live streams require an attached Await invocation session", + )); + } + match schedule_at { Some(scheduled_time) => { let agent_mode = component @@ -445,12 +500,8 @@ impl + UsesAllDeps + Send + Sync + let outward_forwarder = outward.clone(); let forwarder = tokio::spawn(async move { while let Some(response) = response_rx.recv().await { - if response_state - .lock() - .await - .validate_response(&response) - .is_err() - { + if let Err(error) = response_state.lock().await.validate_response(&response) { + tracing::error!(error, ?response, "Invalid invocation session response"); return; } if outward_forwarder.send(response).await.is_err() { @@ -500,27 +551,26 @@ impl + UsesAllDeps + Send + Sync + let invocation = self.invoke_agent_internal(&start, input, cancellation, accepted_tx); tokio::pin!(invocation); let mut early_output = None; - let accepted_revision = loop { - tokio::select! { - biased; - accepted = &mut accepted_rx => match accepted { - Ok(revision) => break revision, - Err(_) => { - send_rejection( - &responses, - InvocationRejectionReason::Internal, - "invocation ended without reaching acceptance".to_string(), - &start, - ).await; - session.cancel(); - return; - } - }, - result = &mut invocation => { - if let Ok(revision) = accepted_rx.try_recv() { - early_output = Some(result); - break revision; - } + let accepted_revision = tokio::select! { + biased; + accepted = &mut accepted_rx => match accepted { + Ok(revision) => revision, + Err(_) => { + send_rejection( + &responses, + InvocationRejectionReason::Internal, + "invocation ended without reaching acceptance".to_string(), + &start, + ).await; + session.cancel(); + return; + } + }, + result = &mut invocation => { + if let Ok(revision) = accepted_rx.try_recv() { + early_output = Some(result); + revision + } else { let (reason, error) = match result { Ok(_) => ( InvocationRejectionReason::Internal, @@ -535,25 +585,25 @@ impl + UsesAllDeps + Send + Sync + session.cancel(); return; } - request = inbound.message() => { - let error = match request { - Ok(Some(request)) => state - .lock() - .await - .validate_trusted_request(&request) - .unwrap_err(), - Ok(None) => "invocation request transport closed before acceptance".to_string(), - Err(error) => error.to_string(), - }; - send_rejection( - &responses, - InvocationRejectionReason::Protocol, - error, - &start, - ).await; - session.cancel(); - return; - } + } + request = inbound.message() => { + let error = match request { + Ok(Some(request)) => state + .lock() + .await + .validate_trusted_request(&request) + .unwrap_err(), + Ok(None) => "invocation request transport closed before acceptance".to_string(), + Err(error) => error.to_string(), + }; + send_rejection( + &responses, + InvocationRejectionReason::Protocol, + error, + &start, + ).await; + session.cancel(); + return; } }; diff --git a/golem-worker-executor/src/services/worker_proxy.rs b/golem-worker-executor/src/services/worker_proxy.rs index 1857f92f60..a00a6fa948 100644 --- a/golem-worker-executor/src/services/worker_proxy.rs +++ b/golem-worker-executor/src/services/worker_proxy.rs @@ -62,17 +62,18 @@ use tracing::debug; pub type InvocationRequestStream = Pin + Send + 'static>>; pub type InvocationResponseStream = Pin> + Send + 'static>>; - -fn invoke_agent_session_once<'a>( - client: &'a mut WorkerServiceClient>, - request: Option, -) -> Pin< +type InvocationSessionCall<'a> = Pin< Box< dyn Future>, Status>> + Send + 'a, >, -> { +>; + +fn invoke_agent_session_once<'a>( + client: &'a mut WorkerServiceClient>, + request: Option, +) -> InvocationSessionCall<'a> { match request { Some(request) => Box::pin(client.invoke_agent_session(request)), None => Box::pin(std::future::ready(Err(Status::aborted( diff --git a/golem-worker-executor/src/worker/invocation_loop.rs b/golem-worker-executor/src/worker/invocation_loop.rs index cf158fe55b..a771d6659e 100644 --- a/golem-worker-executor/src/worker/invocation_loop.rs +++ b/golem-worker-executor/src/worker/invocation_loop.rs @@ -1070,7 +1070,7 @@ impl Invocation<'_, Ctx> { sender, cancellation, } => { - self.invoke_live_streaming(invocation, sender, cancellation) + self.invoke_live_streaming(*invocation, sender, cancellation) .await } QueuedWorkerInvocation::SaveSnapshot => self.save_snapshot().await, diff --git a/golem-worker-executor/src/worker/mod.rs b/golem-worker-executor/src/worker/mod.rs index bd719359c2..9e31a84a29 100644 --- a/golem-worker-executor/src/worker/mod.rs +++ b/golem-worker-executor/src/worker/mod.rs @@ -2672,7 +2672,7 @@ impl Worker { .write() .await .push_back(QueuedWorkerInvocation::LiveStreamingInvocation { - invocation, + invocation: Box::new(invocation), sender, cancellation: cancellation.clone(), }); @@ -5210,12 +5210,12 @@ mod tests { let (sender, receiver) = oneshot::channel(); let mut queue = VecDeque::from([ QueuedWorkerInvocation::LiveStreamingInvocation { - invocation: AgentInvocation::AgentInitialization { + invocation: Box::new(AgentInvocation::AgentInitialization { idempotency_key: IdempotencyKey::fresh(), input: golem_common::schema::SchemaValue::Record { fields: Vec::new() }, invocation_context: InvocationContextStack::fresh(), principal: Principal::anonymous(), - }, + }), sender, cancellation: tokio_util::sync::CancellationToken::new(), }, @@ -5403,7 +5403,7 @@ pub enum QueuedWorkerInvocation { sender: oneshot::Sender>, }, LiveStreamingInvocation { - invocation: AgentInvocation, + invocation: Box, sender: oneshot::Sender>, cancellation: tokio_util::sync::CancellationToken, }, diff --git a/golem-worker-executor/tests/agent.rs b/golem-worker-executor/tests/agent.rs index d5ec6e849c..3f5a1f41be 100644 --- a/golem-worker-executor/tests/agent.rs +++ b/golem-worker-executor/tests/agent.rs @@ -131,7 +131,11 @@ async fn streaming_schedule_is_rejected_without_creating_or_queueing_a_worker( let (_, input) = data_value!(vec![1_u32, 2, 3]).into_parts(); let input: golem_api_grpc::proto::golem::schema::SchemaValue = input.try_into().map_err(anyhow::Error::msg)?; - let blobs_before = files_below(&deps.blob_storage_root())?; + let component_id = component.id.to_string(); + let blobs_before = files_below(&deps.blob_storage_root())? + .into_iter() + .filter(|path| path.to_string_lossy().contains(&component_id)) + .collect::>(); for schedule_at in [ None, @@ -182,7 +186,10 @@ async fn streaming_schedule_is_rejected_without_creating_or_queueing_a_worker( "rejection must not create an immediate or delayed scheduled action" ); assert_eq!( - files_below(&deps.blob_storage_root())?, + files_below(&deps.blob_storage_root())? + .into_iter() + .filter(|path| path.to_string_lossy().contains(&component_id)) + .collect::>(), blobs_before, "rejection must not upload an invocation or result payload" ); @@ -597,7 +604,7 @@ async fn immediate_scheduled_ephemeral_invocation_reuses_completed_result( agent_id: Some(worker_id.into()), method_name: Some("changeAndGet".to_string()), input: Some( - SchemaValue::Tuple { elements: vec![] } + SchemaValue::Record { fields: vec![] } .try_into() .map_err(anyhow::Error::msg)?, ), @@ -700,7 +707,7 @@ async fn scheduled_ephemeral_invocation_uses_schedule_time_component_revision( agent_id: Some(worker_id.clone().into()), method_name: Some("changeAndGet".to_string()), input: Some( - SchemaValue::Tuple { elements: vec![] } + SchemaValue::Record { fields: vec![] } .try_into() .map_err(anyhow::Error::msg)?, ), diff --git a/golem-worker-executor/tests/api.rs b/golem-worker-executor/tests/api.rs index 6d8964fbf1..a30650102b 100644 --- a/golem-worker-executor/tests/api.rs +++ b/golem-worker-executor/tests/api.rs @@ -263,7 +263,7 @@ async fn delete_interrupts_long_rpc_call( .invoke_agent( &component, &agent_id, - "long-rpc-call", + "longRpcCall", data_value!(600000f64), // 10 minutes ) .await?; @@ -1931,7 +1931,7 @@ async fn trying_to_use_a_wasm_that_wasmtime_cannot_load_provides_good_error_mess // trying to invoke the previously created worker let result = executor - .invoke_and_await_agent(&component, &agent_id, "run", data_value!()) + .invoke_and_await_agent(&component, &agent_id, "sleep_for", data_value!(0.0f64)) .await; let err = result.expect_err("Expected ComponentParseFailed error"); diff --git a/golem-worker-service/src/api/agents.rs b/golem-worker-service/src/api/agents.rs index e76a974f57..417d6186d6 100644 --- a/golem-worker-service/src/api/agents.rs +++ b/golem-worker-service/src/api/agents.rs @@ -161,7 +161,7 @@ fn invocation_session_websocket_config() -> WebSocketConfig { #[derive(Debug)] enum PublicSessionMessage { - Request(PublicInvocationRequest), + Request(Box), Ping(Vec), Pong, Close, @@ -169,7 +169,7 @@ enum PublicSessionMessage { enum InitialPublicInvocation { Start( - PublicInvocationStart, + Box, Option, ), Closed, @@ -187,6 +187,7 @@ fn decode_public_session_message( ) -> std::result::Result { match message { Message::Binary(bytes) => PublicInvocationRequest::decode(bytes.as_slice()) + .map(Box::new) .map(PublicSessionMessage::Request) .map_err(|error| PublicSessionFrameError { close_code: CloseCode::Protocol, @@ -225,7 +226,7 @@ async fn proxy_public_invocation_session( ) .await { - InitialPublicInvocation::Start(start, idempotency_key) => (start, idempotency_key), + InitialPublicInvocation::Start(start, idempotency_key) => (*start, idempotency_key), InitialPublicInvocation::Closed => { drop(websocket_sender); let _ = writer.await; @@ -291,7 +292,7 @@ where tokio::select! { result = &mut receive => match result { Some((start, idempotency_key)) => { - InitialPublicInvocation::Start(start, idempotency_key) + InitialPublicInvocation::Start(Box::new(start), idempotency_key) } None => InitialPublicInvocation::Closed, }, @@ -313,7 +314,7 @@ where let first_request = loop { match websocket_stream.next().await { Some(Ok(message)) => match decode_public_session_message(message) { - Ok(PublicSessionMessage::Request(request)) => break request, + Ok(PublicSessionMessage::Request(request)) => break *request, Ok(PublicSessionMessage::Ping(payload)) => { if matches!( websocket_sender.try_send(Message::pong(payload)), @@ -503,7 +504,7 @@ async fn read_public_requests( Err(_) => return, }; let request = match decode_public_session_message(message) { - Ok(PublicSessionMessage::Request(request)) => request, + Ok(PublicSessionMessage::Request(request)) => *request, Ok(PublicSessionMessage::Ping(payload)) => { if matches!( websocket_sender.try_send(Message::pong(payload)), @@ -891,7 +892,7 @@ mod tests { assert!(matches!( decoded, - PublicSessionMessage::Request(PublicInvocationRequest { + PublicSessionMessage::Request(request) if matches!(*request, PublicInvocationRequest { request: Some(public_invocation_request::Request::InputEnd( InputStreamEnd { stream_id: 7, diff --git a/golem-worker-service/src/service/worker/client.rs b/golem-worker-service/src/service/worker/client.rs index d85a24e64f..78e76d2ea3 100644 --- a/golem-worker-service/src/service/worker/client.rs +++ b/golem-worker-service/src/service/worker/client.rs @@ -89,17 +89,18 @@ fn freshness_disposition_for_dispatch( pub type InvocationRequestStream = Pin + Send + 'static>>; pub type InvocationResponseStream = Pin> + Send + 'static>>; - -fn invoke_agent_session_once<'a>( - client: &'a mut WorkerExecutorClient>, - request: Option, -) -> Pin< +type InvocationSessionCall<'a> = Pin< Box< dyn Future>, Status>> + Send + 'a, >, -> { +>; + +fn invoke_agent_session_once<'a>( + client: &'a mut WorkerExecutorClient>, + request: Option, +) -> InvocationSessionCall<'a> { match request { Some(request) => Box::pin(client.invoke_agent_session(request)), None => Box::pin(std::future::ready(Err(Status::aborted( diff --git a/plugins/otlp-exporter.wasm b/plugins/otlp-exporter.wasm index bda3fdf87d21b9f0c2d236206bd05aab21b68afe..6fba45c92cd9553503de80524d82e3f9acc2b333 100644 GIT binary patch delta 50731 zcmcG%2Y6J)7dN~!_oi+VHjt1C+)aQaKp>%aSbFbWAOr{{KoTGzSV$-;P1*$xRY9YG z1%e1ml_DZaR}_#cAjK$xqEhAi&D^`24I=;d{hsfW$GvyjnKNh3oH=vOnVY3MOCH=) zvXLcq?5IEsv-n)}V@;A(ONp_AhNX>4O&p&(a$H*C*z7TBsiPF8TD-@m4H}b{Encmo z$7N=xCT3@jNXwWX7u!N%W0*Q_-0;DwYVl7UG$?aiMt0)x!HUJpqaa{V=BTX9j5M>z zhmGMyvV7;y3v1%XUIh5etdW^R6NhIEPMe@utn4M#Vl%MG$Q+#J$`52Cf&fDulsYzT zqEA-p#F3e)gNv!uDBdfgt_>y1h_s18Ub113YVjMDnw5yo$4pc##o1`?n>oT5A}eO` zOB*xBmC)<6$gmJLVyu9joi-tRtnbLwjG^OFho+U(N3pPoFqZWy%De_n%uX8{;Wujd zsI@D^ld!KD!JJ>EZi_hd&`A_@~`;Fx*Ke74z z96!lFQZ_1ElugQQHl5Gl-}3MHH_B0EE?=zNeU$e992D{0AW(DjQc8;BA7uZF1iT%O;WPh>0*;eI8 zc9~sar`T0?jD5pSveWD+|B`>fKj%;QUH%vUo8RO2`7&j>vO;-VS*5I29`J|!5ud5d zQf4b}Dsz;%$~@&Y<#pu^WxCS-F<+qk!)GY(DDNq2l(kB!(q%MzjPE+-10}X>x$<#A z@gFJ)6)ILLmgsX*`CQqn>{9kAJCq~JLFEhOoRX_fR;Q>_)oJQ$s{bRscB>`q3;jf^ z4(x!gwN7PU>Qh?3#PapWt=qGWdfPS;EKkqsRhlYk%wK=AO$a-$TRTPQJK9viTLFqc z(Y@L>@P3k;n`^P?TJLDoZ_wM0-#6NpMwR#5Cgc5dTf5I#`U~p6ybh_90OmpjZL%G%6gHNiLF? z+({;qdo1ZO%yvYSYs_|3Z_qUhfYx`diqZYpwT71jq~~`jt=H)m@EO!GKVeQc1Z8sqYf&~>JiJf>l=EM!|!)J#rj}k7IOJN2SslI@o^84QSx@4}rs(b3gkw^(dI<(u)vHz1`KhQC8K8W-U;s6XzLSg&W6S$2uJ)Qe`6|r({0CftxrEN%cMT{ zK*|?iXj1ZVk*T}knz~~zl#RY`6ge!Ks(G1no4;Mo?PI-I-*EP=9^bb~jq{SYAZD(l zuEn7`!fmHqnKsZe#FN5~c|6^AL4Uh%MAM6|O0&(DzK+w(Xj)9L!CJ3$+euL;Kr)F) zo|Q?-BqDiQf7rKF3HNl~Rm7y;Q!pzP`z4mVrX3Rm3~PNRZ;t6#aWE3UHJ?y~)&@c@;D>W%vQ^tozOa9HYE=6MN}4yzc> zakU5?P&gljj(j!U_ETYl1tKq30gYU}3_!+Ji_unJ)jy)7o8n8{{e$BAvHs=Rclryd zF`?hPnu2A)+{TRPi78cLC8;EF=dpC#*Jih3H6AqHZTt0{6g&GtU!4+C(mjjEIdC}1 zO&kuT)C;{Nt1E!6sfAsP9#kpJm<`ntAZlwW773o1k^Te1^h1L}RY7Nc&VU4VO5Zvl z3+pr?HQB`bjDdq_=Ye;^plbi`x{EL-3j8Qh@iFieQ)TuaG`JE(Q|D2k;&*VEeqx|z zVsh^PTTJxo14C8GKgPg|b{vQ9Cl0QN--=n0`tHHLE!~9g6eC%>o6SAv?KGw63hQfB z8BkcIm#c~%l=fkgF&~QKQ(4jEX@o_KaBk zHqWTx#$bMika|Z)Ymx3g>Y$*M zl{ZGy+6EB8ju*Cd^R(L*gR&t;mVsX1dq*e zTrBF`tmqbQH1}Y)x+!W|YcZB1wpXAmv{Qpa@M?>Z`f5m_NDP23B=r*ga#mKv(rKbK zR7>;4V!kxhgU3X()%x_&Ww0-;9bFD6gF^nUu5It?_eR%XtMtlaqJ53F)@7TzjM>Ln zfgYMYmi?m7$R35Je`ha3&YR;>*suDp<2oXz!T1iynLQqL7Q85`WV|RccD*PXB~K7J zZ%@c!1)IuD+$*5{_)-oEQeVzsOE(>V`G$h5Z8=l*tQi4%tK2kXuFqY?QN80-(fOw0 zuk}~iZ~EvNL#?+3X)wA9wx#-&8I9Q;z3j}f5w6@It%=R`9-vjR-PZGG9!2Llvw8!} znOQdkw0&<%ps&rHEr1qZIKmAy3qYqY6hOaPIM$up7`ZJMO=Q38dl#j;bF0~wZc1D{ zNud7G(lMY!nPpwj)0ky#k@MNIukbs4`5SUbQ7eX^WXg&S?6zKYWpnn2K4Imua2K9| z+B?jRbSpru@YXA0>}ysPW9+W(T>XN(&#EXb_0AlW>L2BK^!c9b^F7(;`$hU(Bl}z{ z`&{eU=NCo#)GMr8rf>NmLO;K*Sn;@N_HV(RHF#1J?R5>QIQ^e>)mfZg?SrO%aZR-8 zYwXEdyq@zxq<7pJdsQud)7u}^6mHO0@Vo zEG_L4Lxp%Gt1w^tPt3uQj4N!eAXy&C1jRQdUgCT$hiUO^?ANhWP*%GNvdH7Ytt%*$Zp>A*nsPray|xh?-VoU{<6{>!mhEM3pkz1EoMQ zOze#@*BAyL5UqFKSh7?wMt_}YH<eDvX9$3Q6Y$>RrB{-O^K&+3L zn=CL`OR(R>QNl;NSvb{_xacmpXm{a-h!ihc5~i2_BtkFsiM3Kl(SlH`BUI#wsbMVw z1A*!lrv1!-a6pLu+9z6&D6<6?bL7|ySb$Am@kvBfaA7}@MZwwh*GH-~(di$25 z(s%nt^eqBP3qh%|!C;Tvs$#$LF}D|_KUJ|;xzD`;wX7~v$Tm3u!`@>BT3R}~vDqH$ zD?WGiABFzC>|kD-7KQ!`K2L_=FSUOdNd5Z$SjHaeAAC_z>X9)nC>=3M^FR(zwscJq z8+|mOeRAL!o4jetmv&J-?_g~vj+|)4#5X_uXGF zVz24l4?QY%-z3-vquJK0nC*!07R^NdZ`w|={e&Cti6 z>Ir9B zvf29RGa9=}w;3zn>Z*&#FlE4qAW~MWPVayum?MOaaY?PoS9!s{Vc_7^9Ev=52-0Et zZEp&LiKDD-@q!;>F#cB8O5xY>!w={>`s^S!N6$SQ&F1PGFGR3;y7O#2axR@Mh2MY9 zHpTC#8)fl3^jrltUte&pEL)&E&$U5L!@r{S(&ugNmaWgnA$RooX#CDO-vqxW&c|wV zMCTgU{A==$Kr=@!ugTYnm$ksIm`&G1E(nlyE(nktevb7&e0oo=CEej=b76GoLR@JB ziZ@iMm_Ur_V_65ht~g*Wn4{Y+wm|Ei7dztjctL6Xi;EF#p?>jVZTyB`N@k1nHkWGQ zUHh@5{^XL6{`RHf7`!WW?2@Q$q%`@Kz({ZNqiFZakFjitzUs$jfc(>s3Ba`2WkH~e zx9Z_H`*IEZcK)rre*AJM-mYD)jo&g?qVT)-ak$>~N-ylCA6-ez`A$q)K(N)e%&=Y= zt6F4Y=kyRkSgl~C zFnbb0!quw^UU9uMM{eOJ1dcD{dws|4_C6~`^FXE-yA#E(>GhsOmUP>Aw#qZ3>+s&@ zr!wrMp8iuqpSMMm0H$AhQV|;K*`G>dCLa70fuK+K7_gM`k2D>KQ@MKrb8Ym2_`0=&P*LQ)57wDI7xEQzf%|gb_z9|@Y#ZAGu z+inWReRMMxzuM2GnXWhbS+pGdv%#O0-0c3>&!Sc70@12of#AO>1?};Byg+c8?=OP) z9KTcn_M?BPiTAa?bVunwzZ61f{;Pm6>etHnUGZxq6ny8e75qqyEygP_K-Vsn4mfSB z1|Kcjwnz`TRTV7R@|Ix6*|!8UZn;&+j8VTC%qST1&EJYL;)CA=BX+%=SkGWYFRR=Z zT(kUtKI3eq?svzIxvqF8GE!Qjpp;2l5a!#%Sd((6Bs;5*ztga~oNvgfM9WObr9eYq z-76}vAT(8+(O`O!46N=Sg`#ToA7b#!{t%*S>mOq7 zAN?UjmHn;|RqgJIc^iFK%-hbpg;ZDm6jZPHr+mzr?Hu|J@kBUH%rcKJ#xe>!1HE=KI0l?T~-#L9G9|ANB}| zrnn{AoO=R=E%(I4|8%b$ey#Tfqtv@E1lX+mPj_q68$1m6_0fC`Y4_lM5~@{v5XIin zTRw1vOW|njR*{tI^09(xDB*Lh0cg4W!Pzb){}

Kg7R)~j%+Cb8=k+W%3Fgw$wt9$Yy>h?kMg3UNf8Yh@K^Z#CSx^xVf{C}wgHW!B z_rNR^)?Z3gSYi?Pfw_{U`(U)fBH2$gTVc)rUqOd&B8=*(z|GS^VRr9wP{cvknXa;U zc8E5rEF?&J9s;~zyK&fUi|JdHHLdK@>TxtORop1ekYmzzBUweL7V*$DY=@|s7wf|w z(%W7PW+K|_#p1)NE3n&ZQ2dL%FT zu)1s^jrIlcZxd2Ay@Z+Doip2)X@REvwtXSi3f=Z$eNV=vM&geyQYAex&X@IC#h?$p_#j$)!v@(qqPzNik5oXR)2)reN;UU?@9=y-F z%*sl^j6+)kST*(){Sv^EU8~#}0km4CskYnBs)6vivzb((7^}k`I|mnI{gtSFVvyEI zi>bi;yl;1RVu-H1xi&Neof$IyG`>;Af(_fg@mw?><#DS z5SGI*A*>{WwUNR~vf6lbD#;QIqd3?qH^*fMv^qwLQ%8&ix$+!h+5)YPVWz>;um+0B z=Z#TG9#Uc~hN)4snjlXthTe|jwf|JRKXO;02Wc;aT+d05@d>oxJWTgWVi7DQdl(xB zvQikEAH7uCdsW91@Kr~6u6)z+a|~mLq0reZoULPl`KGXBFl`plg9z4?EvJT&i0OEZ zHbx?x;XcicVqti!i9*1G?i?4*4ybH3)wi=sJa-DE+gV-n;8_oHiredngJ(TZZmXSj zWgpXzZCGixp7wNOq0~5rHT-v0SvnPiIv-P(LstFq1yrpN%OV4f^Qq#v?UQcXK%HYH z(TB#e)<9rmEK3jwoQriMP#*}y+v{UJYxRLZg|e(Ymdk{)tX8O@6I5&-7^YQpB-gcA zpyV#5{bgD0M((3e1ok2Hq}A8rZSo)oIvItL%>yH~NTXenna7(4MmYijq+U6O0~-x5 z2bL?KcgrE(V?DiIo=vS|PF$Q8tHokcV|bKSUW?IqlyMXb=mo1g?7`_;l9tq@(Hl*2 z7Z#jTnpkYBsYx8`AO^P}&ONvW@>t!#3SbQ|xJz*?1@l};-3s2aAgmIzM@(zcAcR$^?0w3r%o5l~w5&1~-XYpt8DLk_fGVth=qHk0nO0q^3LiZjd~k?w zqK#Eps366`Dy+82XbmN!H58225Tpo6lJh(;i8;cI`HF5HSW1g_+`7i7tT~=4wKj7ng`moID==(pr}eU*2FBrjKpeQ!r)Bnkp zD%#aRwv@|G$FZw>pW|^%_s@B;&iu|4%J|-z=I(*<)a_eNV8?2 zY#DU+4bPU;s1|F79d0%r0R|j@t0M$(uGV5*0H;=M`Iu=u&evvrky*D6tB=Qvb!6&f z9a$x=u6(>?JdV_512Dyv>oIsJsZBkw(`uShk5#JVIk&+CYx|nlwTp;`p z^;ms#svAqLZ!DH{W3i;`GcCxNMy$Uo4u9a>t3Ip2w$PmVECUPTDH&2SIt~q8a%9QV zJq>EW8k;>iWKRy!lLI|D8?efP39dI_wQCdz5gpS+GC>oo7GLOdz#2#p>#GTxB^ZGz z3HDM}oSGL?w}vdyL^i&8U{#6i+=kd_w$SGdS!2y9#&0a5gI+PwVlnOUYAILK9YP{csX%WT@#x@VE4#9Y8%2&UuHL*^EF_?=@So8l)m}X58-M4yiGi*$Y zDZH5+|LA7_WBm7?9{*R(+~aQ{$KOJXzXgztX#Vv0BU`wc==RfaE;e_QqopKAOF@p7 zfK#o7L5@K!+~jB_$7Q7Sg0E>Xmaox9Jrvd^}n z&$j5ZSG%W%kr>j}?4-6(mO5#*wVL41@b)YggQ(x0)fIG^(B2KOodnoU0Bi?<2ir3o zo9SMA_l^NxtN~u!_q*INgedIPfz__>-Z5%HI*A>koyU#=DO@Cd1EUiW0H7#@=}g++ zfi*CNOMCR6U~g~LqP6zuKeVIVKh}0+c}2R|tJ3}q?)B=Pia<8*n;lUq`%F{@RCXHBaNB&T~#3Q=%h=*MqRQeUX}%jx~Ttg+S5 zUJ|r8Ovs(SI1heE)_x3e7!=NtT_rJR1u9=yZca)q`Qsa3Mwr;YtsRbX_r zAA5yOqtyN^1P9IW{h^i3blOv}omVym1rEo)#>vFc$2SU4R;@;pC-|>e=fE~vO|2HN z*f4;#0HnVLND!-2q4WWp!vk4QbW?T^Yr}R@<{*$`7i}Gc@q9+72I0hdh>8zpHA76J zAGX3J{$fL1;SZ2~2eWjj6<-d0%=Y{MGd3Fay@ZVQyI6B&==% zRyV+EJN#)_N;ly0U^pxSt0_0#X#Z)tyM1@rzPo7O9qrW-xEryUl18{i9hBn+P>xMe zCr&WaN3hBz-BO{EDeAh56-S3hfSYF0%@J-{)&m{H+It9HxCc6@JCet@nn?T1+@&f_6#H&0!evND-RUMXRsI( zMJRqacnBR>>xm=HeM0m>3{X6g;YP8SL=nfUD6JR3$7D(rp;(uoFEiP|9EoQ@GhtH< zb-6e2?sixd@qrle&Bi&oNF~*g#4k2c!OTQIORn;U=Gg)(Vl}S@9x29L5;@3x>Z0u# z|6fNta_NsmzG;cD#>6{bZHogGLKfrsLM!B?`VyOly=BHrECI%`O)ueu zeUpB93AcC-(MK<{e%Ma^Uy<8s?kgVKX(=>4^a_h;^kE_RtJatVV*^YO;BNrD;5EoF zgkah^q}8zWm}qH?i__vIBcGz!S6S0&*RHzboCJrIdVyKrxn5;ISJOfLzF)W!t)TFn8d=vjVfM7yrUNHwl5RRmf@%rnZsg| zjDST+bkmMlNvmjdq}A0bYn9QvuvOL35~Zz*M&?KZ&Y~Pv#gpD^{fp51Be7Lq&S3{j zZV*HZK!_2@w8}^P=J}v(PcF2dL-Z(@HNd0pWY(ah!A3^Z^l@)d^CY5D=*`Kjl6eaP zS?6TIB~fsAGUo9R{WY0YY-me6|vJ1IR1>B!s;3^;sS@$viUhPJ|@5>2eLWi-$O+MS zr@-^}6c%FaG9v3E*)-n;&j@>7B{TEP%x6?HLZ9iUQqz2;v*ORizX>WsnCFP7b=%;${6@=R@X=p?_yXa$z z2E-pl*!IYBBcAz&1pEtdiIY%`aOQtg!QIai%ACeR`?#msJ#Kdx^HvFRrsK^xp`t3Dns)s1(br#XeK!_J!7~qZ~ z7Y5L{$b|tpS}X?SBLtW`W*fH)4pHXoQt$oXbr_Bh(N#R6-0K0AYoo4=el{pdduB=A zx6fcDP<{LxP=*iD`){yBb3wy-3lFNi5y2hi{TgFM09cVb1*A-8Nu_090;^U=2!9D^ zj2M*}a!#G6<7jn=-kvUPc{`@V?rSV0ESdj*vD-I;xo#hzqsBnWb^CyVXX1!+iYm@z zrCS=b!Zia_@)bX>YX*1?5owQW2G6NN^JcQp3T|SQMR!kKD-fWNYeufqG1NDL_XTbu zfKA?jut@TmmBgHj@NpEE^(^*)EcOj-2(Ae;hj>Y}6wN$uBT(mAEVQdJUaY&K__!K8 zg}A7dgf7gOdQmF?3l+KX$ThDc(6(7D$&^zld5YuUMHTfsq5jhs5s(d%7rBTac0t!* z3@R8G5m43hB7%V~Zi=|-#+cXVcXASj{u({M-B^>ac+2qt%lItQl%G({Xip zrn5kYeH^*97qL-Lh2CGp>PHwSZ68hCk`x|YW?lolPY)Nt@_d`p7vn^^hgL3zr+*G{ zVh!|TqoVqPxqX91X6bqyCOCS&C(w!w(8S}`xl*L6Gp%vm9n`UvWJi7-@ z12`cqG6;k^zr!NDAct&3BbTy90Q1pOR;5gyalnCj;@Mq3Sjt{Bx(uZ^mcbD>msT#5 zT{@S+kvoSjF2fmo4n0`LD*G%Hz+w~{{T_tJ0&2S)a&{qQFNeM|hqf+<ida3+g4^a&{}r->2`gA!6=O_=H5B-J=ZbC|7CV-n2ugl}sARk% z{@XT>j;?^=C2#RcsCaXz|4J5BM%KofR152>vaWz)x6qxHI39kuk_Dl`_LUgZT)MoH zB^5KK1N>&xCi`2M(mZPM7Rxq4NBk#f`t2=29B0_uXoE)eSF!NOCkCk1F>105!>ma{YY z6t@34^cEhzZdUktHA5H^CB6f@#vH*I)iF!2zr*a9v$gNAw#dBu4(vB`sm!}rJ@cs6 zyDToymp67gUBJkr@I2NVDPRa@$t%Jvc@mwAc~~oRsQ7yf zK}>>YqKdtDM)0Xa-T*}yEDd}QJujd)-(wnEMC;#U2r;7H-V^YhW#7lu`%2Pt1y;e{ zUb`kg&Bbd1PpZX_Ll&89#vif8BC3{3ua#cfc5B&3I6B;4%Nm-dS%26H{Oq_VX4P=o zq_*o=OZE%t>sTgx*QtEKim}e-+At?;UXdVfsVBL@;fjV`+FU0qF)@(F!cU~&vXkuq z4f+s<^M|zaLyZ5B^YVx61rguS@MHEZTjMOgUL2p+Qsf4f7iNZ9n|(jpZ7@nMwcp0d z(A^Ep7H9@1;UtCwqBA%j_8!tcVR1BQBl{p^onSWEEq;UxsF>{ovVQ_qVllP-1ar5B zW_|+m$U2JN1b_Wn%G$(|eLobf0=%tMWdkcqM>esSio3?B+C|Jh`ufn>`%{Dj_JAy=)kQUpDUr?0b}OfZ;0(9T{^ee>waK^9{-X9kkgKR|@Y$j&j2J=hNYA-uLxldo7EKjX6u{!cKZ4& zkoW*SMj=wQz6SXZ(V(x{tx)5BIg?*|Fz%N#+kP5y2(scKeSe6R58Ns6F^Bmj`5lI9 z`b%nb7$WcqbwA8<|D)a!Sl=Jg>ql65SjRs;!g^KwK`KfJ+c?KHKleG_m5KZ7%zb~I zl8#~~iwcT+t{r92Q8t4eqhF7*Mveb3V2X|~11!-p8!@&*w-txTk;mB7VkXNVlOcra zApLU;HvN2ReH`|pt2F*N%VJ+SuOEl&0C7{TzQG2(()s>3(0{Fq3~!!AWLkvnlX9>2J*b4q;gN^!Il-GR>i?-(zoBNd3N- z`pe4i*;r&^x2cG&s=+B1Uh>o2`Kn(ghgE7selrxYnb7oyG}UT4 zau#Nm)pYGFEMBXr-#N(F)wJTAjDt9N4m!YUx_^#si(D-fIu+;Fd60Vn2BjOHk}jSPRpr-%qR?9*?7V6df_Le6F$mh!s104WGbyjhxpJR`e%byABWaG-v%A ztc=P&puWGr-u90(`d7r0v3%!)ThL!HnFDXbU9*(d-G=&16n+Ov`4Xyi2iPyAm+wGA z@1y&7P~~@O{5yo^0h<3iVv9CX@IO!s^Qh||Y$2fB_=7EiN-*gzo1-E(@IGcdkE-0q z=5m0h--j1&BYkln4bRi42iRxN(^n5LA9=(cvJmktnvGatEN_vOi*|h;veGv5Yccbg zypC)8f~G%&G&?}29zx7+qGpc}pmTr@K4P2LS$gF$(Aexks^UK^DfEC?J#fI_FynZ& zWuTZM+h)r82j1TE6#7IWG5QG`7*UL)$5 zm>|sC=|y4-bj0KJ+#b0b=20WYPqX6`&Uq(xf`)URP~o__pb=4t;0|FU#p1;Y#+1d7 zGswYSi$%VZ^Uk5Ji^Ld$SpF6vUB&lfs!?}^_W{}S72Z4Q@Nv$n73x~~kYXmb z=IRJHAnY?LJhDm%odft1FhoW;e*=#Jk-QZ;-VrFvY(XB-OBk(lgCzLvL3{~S3gstI zyR6NFF!ODN1rLM&g+q`5WomH=WmoaS%5fncP!@(f1FL^R3u_Mx^Qiq@7;1lPjNxO~ z7#c-9BXeD(9N0g2xXES;jf^OX5`;z+eQvx%a&+U3mrDkyc!?Vo5bm}WbPn1L1`(XVtH40u zNZ{2V&752WZs&6Pq%CGa`bUBuZ8Y@O6JXstZ-^ll~(}hQB`>?J45rU z@-}FCt}5ikVyaY)w?mA>#A2Fi5I=n1Wee3W(B}{jv3R{PjTdbI#+w@f(ejco~rY;|Vhi^Sz zx8zr{dsp6MEJ>C+mdb%FZ6na^Gp2_b{rr-`ri1SE&jE&u+Y7KdB zJl<@`*Rp%gnvJ-x0#<6&gwJKSoX46#?z6kj3e7NG?2)rWbKZ=z$CTZQSD}3^`9|Y? z8x-Bjt@*p`iSwJ*ytD%3?zF>N%cr;7^ODrRyMjL1gfa z>jPqsckU7UFSq^a{HPZ{qQas0Qa}EH=TD~8fxM;pEJf$~a~%JiY6>6BN|;g#Qi5sT z;78T=y7T1$a2u3zm8dpTpEv6WbJy!MU?4V=d|Ee?3(ad15x~hj4bJ{X z4ow3OB@N*{eNEiHCR?x)N?Aj>N^6Jkl>pOlIB!C825}#nJCrvClYBdrrwjET1+(!u zG@Q@F15&sF(`i{c?}|~}O6OVZ5~YmbQ%A@{9i*c8+zJ+p;ZTDe92p)i5Md}xa(~ms zuxwuviVgCmMO&DJ%?no|TMA;>6vgthxQx}*ek6}jzx8H**dRh^(n#JA$Gcr4Aw*Bn z^^x4sA9#2tS}Z|!o5z2Q+idbv7B-vsn1#(IK4$?X4~{a4v5bu>ror?mdxnj~EWuM^ zVEV;^s8a?H@l#EIRUoYz#aomJ5SaTm4-9|}N=mkXfTH!RGO3^$*)n)EP)*F>k==Yv zFz^aIvpeKUYjuo7&qwn`Mu@=I#0DOLf3>6B3@)5qZ)foEA;xJNj(~qvlf#4)&+OqT z!1$ohvs-{O%>n}_29nLEdYL=|hn4P`*bz=qZYFONZg>wcn{xW(#0ulZDY~4=M*_W$ zSv<=8>Xz}5Cy%ce(PR`>GjRXcSDYlnV80c6y`@#4uO{vv1{g#UUwASs3}Qz%YxsE9 zAbi+1)Bx>K#oM!rqzwF@fZ&N!>(M;Q@bC-A3JOKPo~&VbL_Kn8{%DBqL-f^XULoCZ zz8N2Cl2^w(g4ApRT!=ZRV(m-d7=V!_(nYEW&EmhSIQxy^FXHPi&hN(I=;1p}2#+-} z!IbnO4|N8=2>ppIUDIy@hg-$je;qY`$U&^`F4wsp4#Y37rPK$pb{ECgNzn7rmir zHGvYE)nuMcKBk5`il!0TU3K{dY!ec;7wv_KLy+$5jAYKK4cyWtNsVSXl;%?bH&MQmB z(AUxZl@RYUiQeL^=<#ws>-jgz@>bv|P^8sV5NXwFEbZmO@rHXrPWar$3C~*B)zI(E z!j&F{br>ywm)A#))9>=SwF|^rit)n;F;)crSzr=|5-2ZPV9z!DVzBWu&EE`YgcD7u z%x&_(x{GP!8hk=^Ql3<$-p#}K3+O-|RQ8$ldmeQ10*ZN$U+ZA%S4Cs;u;IG$JwvJR zjS`O_v%+^R09vJNK%e=u^4=<()`eFeSH90qEmHLy|zY@$Zstk(81U8Qy!sm9zkROm$U(4-HmHYn~Lyn16lKCjxpM# zBBM2}!jO~}EQ>eRL36lIaUTKO`}ET~EUul-zz=ZPh}>nK-r(-^jWIsnDNa?Y?K7(X zA@AOFpIMH(lEOXcBMx@)hFp{;nsAX3ZDaruaqNrnHtOQ@8W5Zy`^gWXle@cb`4ME( zPUrBCV9NlbHeJvAvA3M7*YiapSu39lH*k7Ba^I(e`PfU}r|bFrPXs)l-^jxe@ch?C zo)YiEtGLlu@&Ce$Uj2key1r@W<;Yjk%YsA1xej9iE7HbK&>^mFeZni@5xfZs_Dt%s ziB|>|lQ;4Hfi5U@72i3*&v+*diS*E%fj~SbxAuXnZ zM(VMVs=q~68Erh?-y*C0WIW0`WonQU%IaeJ$O-wln7%VIL$=DYuEt}5@i?)SclKbk z{|aICjDIYQD#e$y+zS<-x$=1TgyZ?{`3V$vq;4NDX<+~;b3}RoiuHK+j0JT!MqAH( z&vzh154V9|3n+FwZ|qe>MBom+`#$xC?Yu{KDIy#;JN9sBzxZghP+hT}3sp7|RU%eS zk;T#sD?Y$b1+CV7j4ARff=Qwx))DpD!7CJQKdzNWi*`T~;)44Q9#hUOQ+gSqsjnGK z2MFDOfDuPWzB@6cA5iC=u!*drSv&dLMi@l|HQU8|VTG*Rg}oB%Wfxxoi_GZHz-k5b z-e=&jtg^C;+R99at}?Q5J=3TWHc z`1TNPd)&bj$@oJ&NhJFm!on+{HxFUkE1=7V_^tNlQqzL*O)S^D(CG``-2um1sOFAJ zhFf@`_ZUs=hMvEWK)c)`qFVdAvsRvhM z4)x!`%NO#5n^kuBvjlH>E#1wSm5;)TbBHD!#kZK`1R?SUBKe)8JdU5rrJ%k_e2M*n znpW$14y^>L48F{Ll)R7evoJ_qKE}(Vx!-X>SxQ}xgBK1^?r}Z`Hyewc;F%@w3;ojV zPrT=HK`uN2{>Y;(CwMZN-#7uL*-w7o@T6ebz-qBVnp>dVz%kh78%U!=l=BTXghRCG z8?cFqse*%HjEsa4{zq}}xkSgl;rI$DUHb-V!6~wS%in>OWBs@M6?9ker0li*NyP6Q zqMuH}X0n|UzY|D1`+UcPgr+zAdu)$~Y4-QfWDii%DcMyi!P7y&xw9ar$fPMY!c_m{|syc$0_p+kFEKiUwD_(ZGJt>5Cs8-fj&SG;@}y+ z3ORj0_BHMK0h_{c`VFP*YpQvccYdZD!G-ucXZdSDEB>5B zeA>CE5ZCgIi8J7P;pFbJ8yEo2Q;G9@6zDbiyx{^k4@EGK3eJO==PCRGM9Fzdy@1Rk z^zsEL_<7XuqNM(Si`eGRQ|?75f=6iAMcMI9qs)4VKZ*S>!y1fi^Cc%P<>Kr4C8_C; z{AHX1cK^t0<8jY;BwyxDqMrwX=3Ykq&*|W0=!kF8y~_|Iiz)gFZvuWvxdK(>G_AY> zo6}<2c7;2_7777{4-s+OBJt*s|6oZBzRIH_-Ek8R^NTg$Tq9_NT3qG!5R;1Qh1BMa zd1IV$7t_mEaqwGAo38R+A%y@m*L9P(Xq6SAHPwHD5c1Px^JEDU*|K0P)xoFW7pTD-^6muqc3h^ZR~XZ zd=nFa#o=FoJ^Tq(D*z{)rnv>O&fWqTkXKNXUm%LVrBT1|L8x-#7deBCf8)}(=J<`5 zKyImDfnh#1{*{MREb6D8{)Jp6MKhO}nUwRZgtq!uo*ruaAp!8Qq_MDY;bShO-Qq(^ z$|6L8DIy}^loaf$?K@g=i$__FW(eLw#=cwFhxgOZw;)TFlJz$TjXV;l)+^fojs4F+ z>Ryq|Agn_TClSo@+~4?e46fpB=!j2f(rum+ddpZDFw|ZY*hrJ@uk`zEz8>ALz5|vo zpdEMkfDprETU;(`*UF|Uzw>8^^Ih7PI`uum^ zn*TI~HvWktdh8#(iyE^)SU81&1AOV2jlen%u`GXVx+t>!L-aS~0Zv4J^I72%6VMQb zmf0{w$uBX^^Mx6G_&rFaeRTAmG~$-K&+B_c90^Nw#(jPy_`1MJgyBgIx|!_;wR-^I zv+3mrd`Ss+>2c{-IjN$&{6n7d%z`Bk!AU>Uqlf$^HtlPV_=|!C`~L$`oKNrn!#lbn z2jF<1C;#xq2-j--gtzz1rYF3)XZjk_?E0cgif64wQeU&J9I{wq=)r@BNDSdEz z_Nt#!zP$X34;BP7$@QM`fjf9O#A36Os(9tFNfcZg;R;RtmGTgu>HbPNSeWPeEAi|O zZSzNWI(_G_RBU35P8G_uw@@PtqpO1<;z6q348!&|9B~k>M#@yapzG(tG(b(P$}ktz z1SfuK1v!>dl>lXcD_hLZ(g3Bvl?HL0a{`s4%#|V94JoG7!1S&trZfO$e<-HB1ERia zQ--@LskWtSZrc>b9?+d&r2^_k7gyT0ED&3bm_`@M(yz5&5F>^MG8~o+X4AM-lrZs= z4G&@oj2EdXA_ewZUtD>;oH2hq(E?#1%!W5aTU&wnHTZ@%w*5@KODNGbjg^3^Hc>Ui zs4A$&G5h!_Q@C6_D$$1}lo)fpcxGQHp|p#CX72)^>#xjMtzwR*QI`;9B)dktLzMb> zJPJ`FLGiFqr8|f+DpVPa$2Xx$N-@uP=>Y78jY}$Tq3mKwWf{LSg{maNlY{5ZM1DNr zu3UDSVDqo&YPjMk(%KiTt4ApP{c;WBea&g(K-iQvL?{_-GL?>0O5@QWQaSoRy?qs; zlmSpeW<@Czqn{_;NsCrOAaQF%D{a9MlcSYi!4a9Iu>6VgODVIB1-KTO*Gelpd@cyg zV!SDo8RVyYY87ZHJ8i5&rInuKvR~1Y8mlLUl)gg4V|fW1 z7ol0LD=3WvW_!{oCRPz1+A*<8Kdj#4u?n_!=O3}kcm~AM%PDIR#Z$bz(h}JADX&y; zVFO`@t6(NJw>O&DtSYbAqg_rf*k;^*H8;NJ%PX}2Dl`tFV+l2nQBj6X!D zREC1~?6JJ{tg*BO8!W1zq+;X$yMnTzlw2?PATAT4KoJ4mpWssD-C=A0NpOd13ku4>H5kjyrbJ_T3cVq!aMqo zrlAeti>s8Rgi!wmp!xd*RLtCMBDbJ{l7d`dCUd*s9q5&#iwz+ZC647Nv5|ZSqVdj2 zjgZqhrqn1itykBasG^gDy6$eaQ ztd%kr&Bx*4_Amd_O2NVVA-&i}*~VUXCbtFWu-9pBJLU6O2^-{II8|_jLwx3wIo1l< zmToK3?~L|J52LSr?nXO|M*gzV$IobVrh{w*WS6_}4DO`p2;zFL6D~n*qRO3>?;%*d zx+tT94KJzTH53BU^o~;(1+Izhw6ZIxz8%hC2LIz6qRO3tw(cGAT@N*q|v=LIp? z&nU33k^o(`R$pa)tg%^&2wDgVp;3sn0((NZsYKY8=1M#l_mgNA@29kYBHX(l!~~-I z`YHAh*~;wt@IkrspU{PV%3!|(0x|0Z#;LOpu3z-;uT=8-QshzR>O7p*^jAt?C_DNq zy+cf;+H>RwjFIoBRw-bqrSyIZ)RU!Dkb<%7q!I&^m357+03Lgsxpp$w0ZOx2V?aTi zwr0D&@n%#((mZcz6m^EzpfagSxA0|huf=D(gvZ3ICdZ9X+*YwIcg{*x4l?>}u;NF3 z2Psv>o7K5=5SR|e*Z5&nyMlxOr6>#hm+;DtNDz~Q-QA!kbti^+$Zzk9`0i1rB{3a@`*%j(K zQ5gp_=T{S<66kbeB9`Qv^uhzoH}} zX7D7u1h9C^MWXx1W~w@f^(GEa6>*Ap;YU|sxe+SP`ex@ z+S@3lNq8@*Vvt7RCx!Jk(W)Fp!^McbIZ906W>H{P+CsN;p!_;1DpwI7B*X_=G+EK;(qv^g`Aoq%U@!eRSt(ykhJ5XF)mlZp zreLiur<^HD)8ao$QsDs2ASQ%!U^$(fqO^EcKI(^2)2T`l`;oHoXnjqzHN_eMEVeFa&cqS_6y}tQ>Jx%AWDR!fMX%R_Nz!iDUnt}82Ry0L8F|Ba$nmm zcR4g7;f1h0GRiR;NE+KMn);g3A?CKoL@11fH#TMbr6WRkfqxx2@Wt7t(;u&4?tY`v zuY*L(spIQdkc(-_>ymGFybgi0l)igi8HW1<4c|~I#9fsgAF$Y77u$`+x|}gJ$M%Lu zI4t;^GL1Ehqk(M}&3yw~>q5HlhO(dO&UdFPAM?_)MXgB9VofqV#)mml#bI2TjK zENseiiDoHjk@G}V>nOPq2$;6{A|pnz>CTd~v6Tj1G)5-5gq&sOD7XA@IUr~WH0VXN zZi!MBkE2VJ!DSXn)TD#aTeGIyq2uAtl=$M0*=W`gFuiqNs`R$XN_HP%i*s&Xs!a7} zOPqC9DUW^GGH0!IN_!uuxv%9*ZFg6`as<~VW^Gi4DaBR_;2MlUz>(qFCf}?yMw6zS zmCwAw{NmcEj{@r^`oJ&ARK=-5t~)z#>rWCJ--Ev>NLKlT7lI-psX6sYSQ+aYC>eKu#}V+@i)*@hU3qZgN%Z}@~1XE zuBq1Ib&}|xnrcNKIfA-%WP*)Rd86Zu~k!ObTd%w zc3rg&Z}|po+@RK=0rk|{r96P7Bv;GK9+{PrHbD$LZA`1@cGkbX>aVok&1q6obtrvP zU)}XQSZ$sM%R07tN>cOYO_JNCw50(J)w$1u)b3M3f@S5NgLwP*xiReOG+?XRib^zA zcb0xm{SH^nQFL>tm!Ai?;~EoivH|$rChD%}=K$_RuQXMUK5sOgaRFwZT8CCOQ#(Je zUY9ds&MHvt=Bn*!`Pa7yCpfyQ2|mr6R2`qv^;_8{xG6ZG=~xdmsay-SZV@QyE!1wj z+aMZ!N=={+EmfZ)Ai-SW#goRSWeiRko0Xa|HmP}&Rw>=n|GRb-)`RA?RI3+(lH6L2 zqMuu;4Ovf0Xr-p|UTOagA)GF@Qj7E6OK5&ewc68gUf_LnQIJUO+G2s9Xsy=LecAu2wq@kH3(?+F?88pb1CBE8&O4W#|;)XGsFllSy0rB&_GsYe9@p(E+z5vo6p zZm(8hskFNNzo#OS9<*2Muz~+EPjfn`4f!BR} zF^-WVX=8V6XR!61C`LS2dWrbW_XljBJ_n6qyPq>TEY`Yncluzq{J_X+9`V zeY#_B%c57iW2~cTLwD8j?>e)VsG&i%hmOg7F(or2tx3<6G5CVVGohU)wRn-5V`n|H zW<_e-Q!UA}Xa7g(nVxDGAJ<2YJ7HjRci%;{td!)c#tIoL^{nw*o(ZfH#SwV+d@t4d zyoK`O+GnD|JY_$(wP)qZiD)eKP8bSHG z>PPkas)0%_8!yUZDWk92Rhi5x(4_7LI)Q4n2gpTwYMQK71JC>BCTdRgEgf{4oNYoUo6MHKKA3r!Fe6lrz= z3)aud_sqR18-e^u?wy%C^_1tFIWt>Z;JH#j^UZXmluyLwNoyw}rniv8$t~KWfctv6 z+0Szm?Q`YQb~3 zZqGbH7u>uJ+eV>fd|KLnaJj84I2NP6#klEk8SjP5OF})oA42`|JbXa#Qw-uq%8|SU zJcagocr1byPkMNchU-?OQp}*PUf$aLEW6w2MsMoXig#J>`nE@qLl*(AIR7SvuKxp6o4p#in? z$yLt%+H>%C0IC*H@iab{?_mp6iY^E8ziT?5S0BMX58s;(T^r5dTk9j(7uXAWm5b=& zKIqM5_woj`WF~jl_sxs!C6#);&I{>*d-==F>lt??dq-cTG2ZqPyLY0}o;-pcy^j~v zr#N1s^!xdy#`V;j(ILBi$CoQVxu0jS`lewoHc2s=8T864{NDPSe1)#g;$G|sOsYVY zuhPm2ko;?OvVwPq*Ew=FpM-r9_iVmeJIL;#=-K=ZT5*Y+xYy@-ovd?sC&Yqnn8Vw{ z%hZP%RRi0HUBMoW-cF$t$`d_JegwV@lx)b}i&#p-7M>y5s$ul`bvE9UQf#W6dA3fd&`lOMZ)|#}|Tu zPs`rq;A)MIM!l^U@i^>i^;*QUwU6O3&>LH~2;PIU^xs8%to8{U4Kgt@E8AOa_1LOL zac=!m!2B@}!hdpJe_Vn`Y`j&~@bZJ0@r&Ruy}s`rgyO#x(CK(`FXlNMF#&+gdyOV-s`j2zm%2mm{30uQE$B|Io1=PtJ!_PT9Gd$8?S zG-(MK`s=E`(*7kN^y^D_JK4l#^e;=hQr)#tOVPEf)m>Y>6kYok&YhLVcw%H{x5rgr z^Ljg4C&L}^9jYj*T5P%c|P~c8m{Ru6EPQ z)dDE`$WDMBUAiP*Yp~qT3ubL zJfPGSRE>j>*VpplnqR#mV3Eq#K|!xo3u*gYI5*C(<88Ec>XWxJbJz1O+Isb+n`Y~# z!65jG%ZTURX!gLE=?!p_zTsw>u!(LrKcr4GCbhlM^J^P;_j<7LM)d-<+X$=inTL3B zJ)rPmvTWo>>y!AK)bobK@AoiYU!M}&tS(b2b0eQ%SgNx&@zVP0eMJ3R@8L~gsBRK( z+RRI|E%g?vvK=-(!X3DbAY==FyuJpvs`#CTE!=a927}?a%gcXET`Wi2iXMBETk7CM z*(q7Zp8vS|G(9pB<1E<9+t;V8pFr%Xv1om1_kWQlIgO?iylZs@Y%T6mHUKF&*S%pCs&@EY!)dxCGPukNQPYa3qgI@Yj)z=_ZD zhVhlEw1RH72B~Cw7W(id_1;@91blCi^v$z?5HG8nZqdVn?L48rvF%m2-{MPc2X9&5 z*j`cdZqfA=ny~|psD1SC4n8sdRWYkd`-Qz(+j>wb9jx%s83%0e%iT{ zcmB70A6(xM52#yiI>fegXctea@5_TX@0k=-bvpGrmF?#J|IPe)rmW2T|EY5|n)n;f zsl4MkK#BUq`y1+Y9Ps#!TPlz3;hkB1%zdb`(F^zul=_OiS^4CP+*)sgZ>hhlvTtoG z?|g}8*IV1$wDo0vN1YMst_;|~4YhZ0<8bxnM1Oi=FOR8jQV*+-*OqSC*;+VFZsFDI zc{rlJRcjM9tw*H6$m-njsQOW@eOOuFj2~0a)mnv-)ao_*+Jf|zS1YueR6P<$h{Y+_3}a9xxPM}r0%ctm+KqUd+L#Y4eEL7_685B zuhvs!eS_!n?3|qU>CrcMnf8G?LW1&+H0TgE9Y0iY!-41kJ80t}{+)J4y-J%7@nbaR zE#AoVk=jG@H=Vo=hvKfcu%-F2e@FkGFophj3%>PFX!zUwUhN$81xA@%i_LMJC7-ID zS2GP;;K6r*xG$*EOWwjH4T+1YRieUv6n&VdAOt1jF!yPns#W^{uqK<(&xd(hQ0JVE zpQ(9<2{H6Md;!Cbp#0}F^$3^YJjagk@#0IhJzTh}KY^_{{3wrNUs3*1K1%yqbx15~ zk+ya;{d|;XXy2$)3{UI8WBhg;*jRpychs(^7IHdaSe!V)BZ4|OTm>apWevk4u;B{J z_*+AY52MwSP{@9qH${B^isQT$qC;Lf4p+_(^v`jg3;U<*yL^%MqdM9cS;z@#|KJ*e zx>gJ2o#1iW&uTwoP|Hq0nEpaLPvFyE)p>FnEmU-pkJf%uR}j0%d#!(ukH8g2Bj4kz za9s7$dwd0=Ki#MJ8tqS%i2j`SrZewj7ytTaP_KXCuJG!lq1xYSIW51))2QMMsBh#4 zaEbmyn?KbWI@;K8R%>oMOORJAT zqfYw}W16ewNZT-pp7@Zb2hG!*H+&5-mo#+yme zXW@Toat1TEi1N?yMIjGr6-J)SYEKWJ;eAXpPGYe(g|>WvQ7rz557L$(h_}Yy5h|Sw zow7T1UaA$y)QQ3JEoYflES(Kw=(mqS4+v>H%jHerv(NGc=9St5Ml0BBKMRCE@*|!Y zx(ZJCf2YQpJ6XN?XkfM0!Wb_`A7Ngj-C>mMVptM)o#UC{tqy)#e2(V^W#@EUtKDO) z?YHM((yT+Ev2Fo_eB~7duJimJp4}yj=-u<&p>5FIbn-mV@WU5iMmOI(w1lAQmt3bDk%kTS;F}IAUcs$$xN&KK&^^+9E$1g}XF)C+$(=%NaUR z;9@C!xhUi@ZK&)y9DbQ!@Hl$@bNB!r*Cy0hXVH}X1whFY+Bk!Nm!p)nP3tYgEOP1M z7d%M&k2Z=f`~`foYk>4Rd+o=sS3g7H_i zN{u({k+h+ouk!TJ-2rPReWG;NW!_7BuDX(UF2k1Iqs=rHD_eJ)QqC2WJ9&k7plw&s z#tYSj#Z|n$sQJnHHHdQRRX$OxtZx6itGt=%CC%_hSX+WavcH8weVJ_E^2gcU%8>7P z2gY8Z9^do7_&#_ZbTv;UKkyT9+#z)|`LFS9>^180Bmal**ESeHK$hr98-C`o^vX|s zL&yPbjviMqjI6)%ZZhM5c2N5Rr~R<1JAZ*m@VW-4MepzVowWT|z8xOE@xSqT2zkEn z8=u1tk@f%h{LnYGSydy>H-z>?CgQ2{@4TJ%mX=pn7PZyh)@JG$fxh`2zKnOYUkuS7 z^e3d-VaoiIU(=3gFVgwH;9s2f7q=lA_>;dl?$D;yf1|PE+7#K?FfW|rx`sew2~_+K zPr&`Xv;X0rhMmwptG32QllxnEJ~v%Q*H5k+EY5_!r`d1#JQD{qS2AH`@6$CVCgA?M z5vp(@7=6DgjzUK*)5H#TrZSg{c&2@%JxePzv4O4%5ywAT% z{h)=|X4riQ{jvM5X$|#eOKrYlS7A-F`IDu7{80<3>FiH5$t+rHKWn$q?#?_lNT1SQ zXqQ=7v|rI85}W7#rbT*vg?4AYoGkt6|FmfQca{69lkoVvo`!j;PQ&9L)H_r((f-7F zl9@TY3H*CYLq#+8H|-7;O`**`3>70Pu4{1ta}W2N(THm{H_OIc`qa$famI_WU{-{& z=%Iddd313EluUO0_u^|nf+frL;L8*Hw56zb?7ZiJ(<&I@M zSiZRn+%uQ+Aero*xk7&^EQg0v6qc8k&RoSq^79=9J`ciiR&(ib*NJM49JcY8@A2y& zIc(0g+=NsoT3W|>g?F;2WIdYJ)j#pzLWl9Vfrq<2Hn)uO(X$@nT+-D>9#rU%4-fMo z8Hna8*u+g$;9)ZlFSL8zF0U=Wpt#&w@(7Q>i+x5u#$|Qbr#QFpXuA`kWKOH2I!$%r zC)~qD8{Ao#5+TlqS0pk`QDThv0LwHPh-r~yu$JONM{Q70sLT%X+6p{2pG+AX6eUwa z%gS9otHtLku{mY(5Zqvcqp0IOHm|GPQ(&`5E}C$YT9wvubqe`cb`4=|{KLAYV87&^ z6p_}z5@bdTAwr)~S@%#{mLihlGJ?X9ZVIkuM42^=_N9oSUE0NuH`rxDb!LXnE=nes z2})K_G(I(l*`4lkU%>E&Q}0xf$VSk(RAGZt{y?foQ`-rzVbM0t;X zZz7tbe50nKLvY`q=BUtYjFlc}Djq~mP&4sB#qBIh>Bq8_{;a(+fOSv?vX06i)=3%6 zIx9n1jxv;WQE(S$rZQa3%2GzCS=q`+HLJanr)G6f?ohKjDtD?`os>~(R%hidH7iHC zTg~dCj8?NVl`(2|mNHh&&Q`{$+3l6_iprD*i6$F&sa~)9l;Y0qYa+F|h=USJY%Y56 z4-|BJTyrrm@*ZIf$~58bpk;|mDz7%jeM_-7qua{pR^mj6`K3t;!brmvrqK1yBBj#Q zUc7?C%Uq$sMWQi%nIqb(N;);p6-f;Zg4dV{tm!Fw(cCWAIEvm>q!&YdilNM5HbypQQpwP&!;<=22iqar}c`U_N zXQ9K!URM-|G|6{W<^QKB<|YhLq9QrP=_<5o%I&6xs{4@QQ9}(jm8sr0>F!+7MjN1{ z=|iE-xxy4P&=k!)DtB9b#W6xJjB_)&A~Srj=^6`i$Cf0yo4AkA&$*%pfJOUmqN#dJ z@h^!O)b_a203rsIY@K3r`YZ)5XOVr%yGo49W1pf^xEuZTxk@ee!V`47o9LwFDM_@d zKqOLncQLT>C{sgRdKhGPI_ypx%T$7GGYt8|u$1O>EXJ}aBH5(eZStulr|9YKA`iDj z{M8+J;S4495UoSTnjTO~PAeW0y*eJ;ct-K(MWyyQfi6r25SV85*HP!v0`qHMvqPrx2eiKbft$#2|J|(Lrl3{02XH{ zrl;r_G||+Yc{KW=he!xLrI_4^-?m#FXUW}Dw8hry=AP)tWE?Xq7V)Z5Kp*rJSq*Ha zD9o`|Vw>qTrua)r>?KmwDGF^Z7K#0pV$*P5^0`tn-TjT?2{OshP0ZToiqJ!_6NAtS zruecFfvGA1;b5+Pn5`>{85+%FpIq*Z+ zQ6JIRKcb0=_O}+{Nj}p6<`E%2dnu;ZTIx;=!lacue5dJhZ{a}X)aX8#oEbE~kGPxN zOK1Ctp$Ok<*;n+Anq>+_cTwKz#Uz{CP_MosDHbv1P8XzaxmPMVO_|M14gG1c4QYR0 z(Ok@BrlZ=PyjUC=`_unyTnhhNQ4)zw6^RgvZn5g8Y*r9Gefs}W?G6ouF_MA-=5Hl z`RTC%qGjw_rZciZF{cy_^LC2P4}bz$PuB-v#6OM&1zmFJSyunlW z@$W$*3%69p4;F*iahfz(bTB=^Of4n*qzo1*REZR_48g#)A)+<*XflR~yRZW@e+X3D zv$SJ~=tMn-in!SAEUE@9NKOTB?4RZfuQ5{}tOr>~ zh?vaJl^TAGuFH?;*X24ashC@0wst#3lVIflGbMta^g7@iiyVO=zfN68fHaHfo)IE3 z=5r-LM7+VwnfNxvCEBRUA$op<=mfEcrHQ9;E(l@eEqx(_PAPi1*(jH!yu(b5FuegQ z!V9fF>uFjs5}zNTLnB4srl*u}86a+VPO+4`0n1J)Q4TAV(`2i!pcse;673YV%@gv6 z6{hBi{xB1F=ZR#*@*T?)ElekwDNS{s@E$ zr)Ze}0aL>CT1sWlZC-YoDN%ZYJ_xU6y4_bS6M>e|t`wS9n20h3twW50UD?NaBY1In z+x$?l4Rjo1r ziW$|<)n%vNB^t$lTUC$IyPA3)y-PGr{@%z7DzeH`Eag?-F>@o(A~+zqk#dch63~kf zIfM2BtIu|!x(0n_D9s~MbCjQ$>0P<-U$d`SSwt{mUhFOuXP+`9RGwOKLZ3lzvdK;)?9hfgM&(-=jL7Rk}S>I?r{ z&BFg5<&MTO|4#SdU(^L)BfYvmn0c@Y0lsTAtanZM6DRFO(}sUlO;UhLG>ZRCS4N9= zu!)n$h=DS`#Wn_FW-cuqBa-6gsfO|{uzCt1OXjQQwwU(bUeO|2S@5qsx;93%OH6!I$7oP{1_`b1lytX54HdUmX692Hp7+!_TY`b4u7#jolTEGsXi(5><{DO&gq2c!}LvxIqPon(1&^3r|ZO5l`oQA~jffNR^sd)qxhY zRj+$Q=j?}7(>@a`YZn9y6NJa!Q>qXWJE!Oxk6loplJx^=4qG9+r1-lvN#?&Oz@3?W zMAAg|8|<7aRKb47*Sg_|ANoOyg6_OWo`t5R*<9o^rPjRUsotx?GIMn8`Lk zT#FUx)?Q%o-~|-*yZ>a9IQ}qG68)2#SpZR!#4IfQ=+})1u|BvsN4bZ ztEX;*getPy(c|irC(*h*AYg%Y?()oJPci?VT$H( zO<|P~W=NDGT=qB;Ol$`XwprYca&(xz>_6BvF6kzKMqENBM+UGz{TJKcHN)WJfY1TRf*O~4xIst0y;0p{4P_K2!jv}qDImR z)jz3ueAhLqf*ld?hC$+mY;AP{M2a13&(@>HVi%NIm3>s?v6kA{M%BNod4g$^s+e5G_TS^{LO~sn~NmUxeeNADIO*+i8JBwUf z)gZ&tc?`QVE*w0Rk_^oHxEgHOLH5EY)L^(6tWxuCQ=@fxZ$Tl99^`JD@gLPB-|RN; ze^uov+HJ)-!l&t|Rk$i1Q59(_Fmp|dh0m&?F_2v~3Fw0M9Ewfl?pXKkoAq!{bq}Af z+r#a(J={^-!(9PA%&hL>&YCX1peiq_p;3k=mUPP$#wt~D7^af4hAvMQZ8Jtk83!`C#H_aplcr6MrE4}>X#tL!O@alc71FMb zpjca)Y&M?4JHf-E6{Xj_nbj%Dv>$D>&(w+&0$Zu=bf#u+5SXL4pQTN0AwNu{RGWyx z;i4U#U>P`Qm<{Nsl*(-Ay^|(%7Pm1MZR!l#a?>#z-pc3)ndhNlIgrF&vJ}Cf_3565 z`0_gK7@jn38qFyZN$PaN0iin(t)jd1O7DUEIZQWvp^3hq0?wXC(Z!-g;(QhpIPfaF zR9iqJi$#LA5I?}weS}EXv_*_kdtp!y(xb(|D~oAwF(zXPeN-$Or{G7XZ>U7_29Af+ zH6+8-<>*Zx(W&8zx}Vf&QEeq{vWpCL6xR$Nog0XKiv#l0fo+xxr5Mb1`nyzE*bZvr6z$ZVjKYSa&RulBQ?zHhX_pg={~Ueb zM7Q=Z>NWxk^*klJL|gR*?EH-o9odUiAzv#QLI6?fB}Q3!KnpKZm>U>pFMc3)q+7({ zC!Rzow$z5ZK`;Br?M5rF(keGL0$yVcDZ&kQ+jXZ9+J2BpHChf~2k4p`+$zZ zy|dl}Ry$0o9*_XGp`u2Et&TG4HCi;py$ID9?l_~JqeWvChjM-xEn2B37^f*4Q9B=&>|>hX167}8ls6t!@d-WSL$A-#5g!oadHT}_gZBbuKxe_&7*sB< zuy3j3G|^aWNK%xEmE)(0CL%Jt8Wd#c5P@dhCpve|sGHiZ?rY{PT;f@@1)z>Jd9nJ*uAp+IrHm2SitRytC$tbV}bWg6X>l;0x|86T0D8zI1+@`&RFM z+)fi`!Hdz4j!%Otw|^IUcbaHK6Q@JnT%QGXGoVjR%5Cbv!0cHS$R5+M)?z4G!H-B7Ok>9neqo*uZ;Gj2u`Go$P5=t-P%Z`~vbQ|_xt3e~q0W!n8I z^iHlwY5qW*$2#3&n0n~CMDm~s@2tRetca%(-9>zZ*(}^x>Z&0E&Sb6u{+kPh-%7+K z%wr8?Ww6EqYMRgdnbAoV3u?UO3u~ShvB(sgc}Xq!dOyFnquB5R!0(#z+w zZD0}A{t+YLA!e3NYvW}jlO|zR6%S+n0_-=V#3mN2Pby*_D6y>wYqFVz8LMDe#E-B@ zX-fyp_!dTk+lo}6q!x6%1bYixng3E^L+vpjuM7v)3jpb8TY!uwpdRNqpfS#jYo+1 z*ynE`qZgR}WNI29Rw{{BS|w1;B$r4{eu*W>sjN1g1L}GizuhF-#O`I0H4Zm}AYWm$ zs-1{!y^l4J?oC+pGo@Owz!O?f@+#9Ep?V^=_P{sJ*BG5_C*mshvxwT7BzYWQkyUG3 z?a@2Pg5?gG+!=el_VIs`u4_DZRT%3HhP})x_gz)eAr@^|`2ocDCX1>fz6#fjs&a3! z$bSL0w^^9s=`$?scUV-7qp#|l!z|qJ_Eo(fVUaa1KjWjLEHt3?V=OF?ZjZADt(=e} z(t}Xzjd+(exG@o^FFgzP541e?5BV^_u0(nKS2{IdkT`CMOOB zFWw&Vb>{Q9O3$w(iXVib9jy_!dO8`b2UJiwXf&E7&k=^1J1 z11b(0+An3aV)A8URg+~@a@xq0ibK=;r8x8b*kFG)oU474N2HAL%19oQmY&?N&;l0L zDFE5Z;FK}`9d3?HMI3bSF{JAH6PS;h*Pd{TxFcfF{lz~Lz)My6%z zITa1Cim9lU&Vtk+)l`J+H9Z0&f?39RbmP%yOlHc65T7A~hNM)?9FviP8i6#irbjRf z)y}fAEL{7Om1o7tzm`XsR)-f2C@GN3Odc>o?UUYbjK9{4hZME341bo9#WISpL5vMD zv0*lCHvhOtDU<)GEoDy1`8a&WyGLIaZ4?NQ3r!$GsysW8+8xvI=m^`#!S_+FYsiwjs`VLGP zlC0O06Rnt{Sw;-VWtND`yb+3V zdU*7W=MQ&jsR>^yJHi@hwz|PPJ612PXt!z=rybKhifOxQh3u#u=*Pd|6dvtSFUxe9 z`}IxkGbm|zN^)9SdSBCX?z59KlbxB@vN7YcCb8vg9b3<~u#ee(_AZ~vZ}HpwA-m7E zD!17@{w@ESf2eFzb}KuS2W&c@!N20?`IpLRWiHQF?()Cc?|gxxDGQa&%16o;WxMh{ z->K|T+7J4S-Q_>K&{lxOvJ@zfT%C52R*md?R`@Y3r9ax)RYAS%}x1P*2ZXR!aP`x(K3Zs(e`($%D&Vdb=ne^J6WP5%Fam4 zfhx0GQZ2dKzRopK>9@|M*gmaTmooUR+hr8X)^>I23XJ``hOi}C*{%eP4|LThzl8Q@ z*TNvEcQ--q_T56+Ic;#an));sH|S|)=pZ`PAnX3alB`#?TixoSw(ZRro&2HR%RZAO zYqcS7hOx8Sj5m8?vhTe47=2&w-XQo{f!Vq1oSo`DO0&mWj~-!RMuifRfE7)veC$e7 zK?ciL+PoeO+Fq6P1HC3n0-EfqJ;ZXsnQ4(kb|a#F9#6Gg(~Ir%RLmp_QE8znN&TH> z>lxHXHV+VUy}={Z^0lO=3p<{JJ^dTT#a*gqKljVXI)~gJ=sU`Lb zLbDYrE2a(URjBIs&dLv6m5-vbL=z)2)iS;3A=28WIU;=s=DwwE?G=$_aGt0!UzBW9 zQ!Tf3U?OjU$eXCRs29z9BjdKooki`-@+rDX$K5qQIWBaJ`7xV&GL~gurPvrxu=HgDi?zE z5+9u7!1X-Wan-8yt{rq;)>p*rtFG$W<-QdlzuS5Th3eE$?GdSwUa}HI3#sLX_FeB{ zz^zrk82nn3Ga%#hlj9A{FBzE6?_1@6^?-gN`c+WH+!(;F_Ys|^4++9=WZ&ur$Z!9j zKpyX1LA~^9ko)>Y0r1U!Fh<=k%u8Qm3Km z30Knyoss=Q%vR*jVCZMIUO89$vVSdr^czqUzfI)t!~ueoiw0B-GVqJ$jnLwR!L!<> z0kJ6e9#}EliNp=)b_0KdvlnXZ20|>gl!0+2Tu_=tdf2m?_!qT$0Ng1jxSa!A0~{L^ zj^E;gY-m(}(EslcD4kj>)`dVK`aS9I7NjtZQ}FwHjgoYeh^T;77O*8*3G^-7&Wei39QNLn`7|S1{9tRB=6@9THhdj!P_g z(&j+w1`uzh#b}TkQ>2v~8WgURLN|!GUhJGFt?kfY@PGfIk?3UR&{FvQXlOOP!(z^M zFZHAaq+3xVE>+89uqjjRNpgTz(_s6+R0EiK#?Ft2 zf5upzHa>F%yQe+M90G_*BeRk7$H*l1v({-;TjZ=C)do4gj}mnTz9s5hcuVAz87*=a zj}|#zW3pJ@&go+g3vkWf&O*T#Zx3ZTJ8O))t02oZaSHoITR#zN;?Cent2inIu=@`)HWy6r4w`?nWpeQE(OUmaRavyQbW_8a=mypq zAK2opQ8M+imX)b$ZTW$%ob_w=fi1!s{ei8rHEO5VhY5l-^|nmH@1ZS2L7>>Jf(X&?=WER7m;7$U$7)R zA4DO2Y<_mu#NUFE{>ZF%ne7hq3(Kz)fNnws8MNQFSB)uR6f_m1x5n6+B~OS(yk*tuQu15sM z>9391S)KW5+jrW8HQ?lglG-mjliBZD+g;V5B&O|Z!623AcE9D4k$A{zhdtfcAKK#{VJ;DLfA+L`xboeejXmqREpli2msV>3 zaQ2tBXn!hx*{6ZlzjPI4RC{PtGxSz*pi=GAjU3z4>j&2aJ`vegZl93A4{^T)vpv$1 zy)*kzBx6sty@%)Hx5a1S?3vd8v)Y0B{CfIBI&Ge2m^_}C+})ooMy0k#23IQp${L7L zeFeeVwO54!?q#eWc;BUB&DR%@2SgPc`}<#)y|%LhUZhK!ts0eRAc;BI$ecL)B2p=&z5T?&vZe~ zTW8ARcg2|~-*(X_KxQHRcrRn&W>MQV{E!s`TVDB zhW7CM8$hVhH@3jXVyu1;4sJgLCrYT*+aihswK?C^FK3W2njccFAk$G}5jMkzW62h) zY^2iI-^=c2$=3e-rXrjmr7wuz4j0@z+`)XWX?4u2x5`MIq5n%3<` z4S!7xB+|n_1XfnKcJ5}F-w!$vKWm_6p>|YOe0C!ip-WEILBbP;wptF;;dfd(D>9u#= zdD^N~_{rC2o&W;I^3>Y>83BIi@srNq5rwgi2hi@yA~(MM%8-#HLK&Um~p`w^JUL zRa*T0au9?b_k|$LyhwlqP@O&TyA?`uGAY?z#1wjaf*F$$95I(5W4=YCL0^nhm zD}$4}UdL%{nKtE-tssxd9k+|ezSRyr3JEE|V}iqA<6xD!qCI?6kFC&Re=Q#D(yl5P z6z;;=9#X^g`SlmjsNHY>Vhp$g75k1Wk}(2Y(|GT<=#mBpMe`gr(i4?Fk~#(JpJImx zaE?~_cfl~Deiuq`>F+`b9>?>1?cVQVViW$zpMvp!IGMt1FvVwo2&VA(Q!qu$pMoix z{VCcG`O{!9?fjn>7gN0WGoL9M{Uw-U)?bPEJ@uE+fa>EK_^ta`On>I%R>(j6IKS_$ zPet3fzboN4>F+Z5o%Xk2m)(C09qREUzh5a$3Di`@`(Gd%wWj>7X#gB1qXKh0N|@cn-vs($aR3ctVM zXcfL?x~H%(cAGp^*7*Mj4o3-P3V<_umf)_aEDBZ+_h8YwZ(giT|2i_jfgw+{+br4C z+JiN$7!R>j|(&^Yeg^ zRV)9^(}!7o3=M8MO0hnyQhp(-)=;b#SJSgTtagFY1P>L9t*c!0=7Bx-OF1~($jKinC>gwlUA+c zD%JJFsdye$_GeYt3F`09;)4wNv>X+UOi&J1)$+ix*`NKz*i2d%z-qE*j_(3kFNGbZ zx-n zV^;lG0S2MfcZ$sy9K8yy?oyv(fR{r{i?NZQVBrupA8*#>JdEWy4ur6c%zvvsDA18x z@+dQmHDpU@Zy2H{rc(KEb}dwHa;$#VLiW+J+d}qn64}ROi$EB{0>^_0c3fqvXpfCm z;4dc8Z5yj)>@RC$zsGI0#s0E3C{a0*y}>q9_m->#`-nnHv6}Qj0B=rCDp1O~00A)q`|%p?qWiV%GBZ_*y0tEa_~jSBBN7@7gnkV(~-A z);iW`izEnGST77~>>p+g)7!-vdAzZIxZNK>c9&t;)6uOmV5U4OUKZgPA1#VvQ*?i| z*&1ang#lzWiR9tdverl|562)@M6u!+#QrGOMhwC)+BJx}a{FA@j8=6qh&Q8I5@yvP zXRS`GoTn_wC7&2JE=1bX;sCNjq=z^R#uL2umQ}PohP}SE zcspH=RY#IBnFUjLc_vPQ<$(ez*?Rt`yCB^DF$q4PZ9oG(sa#*26a zSn1LHye|k58;h=1(Un+Mr^0sKy=<*&tqdK9(>w#o*pWQB2bLc-JJ=M~^YK`ev|Xee@VvnJoab??&P$Sr}^BUIM)FMipi^crU84 zzs(w@^H50?ZLGo?7)6-5QdSQ{Pv{*ks>*C0JH@!E@DNstA~INEK<{3aO<}tn*Q+vr zI7{f4YOIx?R6>4*&Dcj~Q{x2I42(EePc9~~g{YQRowY);4~dsv+e`!8!oWc0EyR%C{~xSr26Hs>$jgd8EI!sU^!+>&fqW(zG_~U0hNT zJY$9ui{#?)5{s7L&K!nGKUy0MxQd?DW)(c-q|=K;7F0yBZ+m%`JJw-!j9E^Uf{`es zJ5fk?9XJd18H6at+I@lfS9Mr5wwt``vZ0Wfmo!XRh*P`dyxhyRx-8M?#V&iXi(c&L zCB7c3B<4Q3o{QTW$hmJ|wnmGy1Nx{QR)B0eQ;$_N(1~vBUs%YS~=`X$VBPt)XE1 zhCt+9yVMlCQ0Iehy_XK-7b-4ipkpphKty+$t&^zq9G zHf-z~XcIZmCSssX(7o39UjuF88tB89;dE=_8fa5F(57ObO#$blCi+0HHE|8JnH*>{ zG0YQJrB)4QyW;{bVrPjRi}y40qX z4t;Vf7xb1AdP@PlC7^%R>ZLKn7T00b5W?QhTEm*41NUnu#_*7m8?g{jXHRQZOHk+6 z)-K4cB;-~Caw|Y?(1u~-O2gZ@)Hi5f4YdF4SE;^*ipp)nYSeM5@9OA4sOwg4>Km&> zf%m&0qBwB}ZK335QoXjUt|9WR(SMAswb>eBZH@llYb%v`WIF_U79d!u;=oT1(yy%; z(>x^=3sU8R^HR0FPPu{YUE^yb$Ja)TuMObuZ4VpKeMPV6tB)k6v43?M)`?ZhUomPp zSBy{$`alQP0EB^gRkX0aN_oJ+V`VYQK+8@l^9EKuxk^OPdvCCQ74_+e6$ftCN(SCQ z0{rwUysaH|ygPPu;oVl^jiGv2+XC-(9oeXYcmtV%om|Eh7P#8(=mAn9QPk8x`|=e8f~jx>ha zK}CB!^A)GR9<~Ux@F`9eZLnU{h4VC<&UL|}mPZx4vUdxt7v-@OodA_|gTv6gf!$n` zX)il%FFI`x%Jf4CXtBB*i)X*k*WIuTKXydC3FQEW@7i4_?CkEY<{czqA=@6-4rqS0 z`%9u!QR#q1a#jzl7w^!f9x&^dkhLdEH0!e-V~s-b;GQhB;U=LabkhvRRgAvQ#yE{D zK_K9W5DOc(Mq@`28SQVv;aGXhg*?m=73ho6tTO%Gli3P??6kEYOJUXumd8}S7psgh z^yTmV2ET@OPV8G3Ezy|Ei^r#Ne{bp|+7b$R-Z33{_TCKqg{1?#P zzlAlyS{-AENoGyh6v{}JAj12=X2dGkq%Z4&PFM70E!ZdYQ(xB1x<7xM`#mDL=wX+K z2+P!s#80VxKWt}nX?8!B5H4+EFglD4U-7#PcBUAqUvo1Rs>Ztdp_Q;;^*pl+tn zuoQ*^Cjt)f)VM#hM@Z6&<{+#zV6fPVS827b=?}zb(og+a%aXbYj*=O&x7kK-=tMBi z0eWKqt8D)lG+_=I(DZ4-%S0J3HPsoEi<}&pvkWDg$ zE{?8ZCAWA@0U@ExrPA)3=2F_7(NQT|XJLVNMn}8SudO%k07s~?GheKJU;dzD*Nz^g3 zcEN`0F-51dNU%i9bQg+UC5m0m)^KZAfM1p_QLL1~MjF9ejfA%{$f>pPobR}FKk4yC zWSZOIO@1ZS9_N)l9Zc51JNsTRTHRap8{x%JfgB^k-BZ$;Pl{jx8gZ7h@Y}&nWgDWVH2Y z7E2@FVoj0t>08dMHc?Xh_=%88`wgE|>;a-J8^ywdMH5*Yuw;m=$Mo4~IMtR>+8Fj3 zd>pZ3vFv|H$zxdrR-g%E*;FLT+bjlNxQcJXHFuZ#zs(LJv+Ow56D#`EadJg}GL9vd zajxja^#P!p+b~?^(t%%L#1^t_qNMQ>_PFs-P#0+Vc=+!=rkms8Rl_EFJT{q!C~g9q zshfNtScJa#Mp(miuwt(oW6=*FqCif$_|u&UfRjt*vY54np))<~aWE2u<58GrNR37w z`l*mr6zQ$yf(qxehg}{HBQ*k0X<-(NET;Q4B^~u(MQa6Xd8|UGv#<-ur8`;DOB65> z6VYotGgI@4tO)XZOk^j5b;q9`a=pq+tdi@z(6rVh7*x45Y7(o9WEYZPeOX5+66&18 z*&SAA1hJ6UWLBZ5EE8E*Wx)+m&}1@ZMLNF97d0@9=8t9hGf&Gx+5(SQq%80YG+RS0 zyTt5^prugDUipX^s!+>5x-*&8s^IG2k_2$o2%j-RqYufZELoSoDH;awrlVpswwMze?tPh&yl z^-0#_nO!jS`O%}9^AV)>(_kUy(xho@Z=60Uh^=vcJ-`cocz}bM0v{gGpm$gar*xrk zKdeYQoH0U9x9Y44Vv4ySW2^+KW_H~2vq z(541J){*j?OIxNh=LZQWX@nBz2MP3Wx*VBx20YjosLc!(8oW@9dKicF?(1kMJ)93zQ=gTj(%-ULkiV_7*?RPZIDLDBj&ZN%&t?Abp|%VCM&{*O3G( zjXZgVZuAEM{8vqrkU-?dp{^18Pf4?2pXSo|S=jF7(z01_1nKgHdawHKpde7XIg14~ za?$1`Bwp%E>JJDYKtuxr{iI)~j;EQ1&15k{T#(#YNH&95qFFmMJMaD>2m}+^psG{< z8w~CI0KrKoT|QCO{R0F#H=7k}rhjjMBAi_4a$(K?-T>JJiER>*Ey#U&09ZuC06@ZS zb3o7wj<@FE(^+=Vk@Oz>n}zDTS1&LRcCX&pIWnvKUU3Btn=f~t5ewi8KV7F*Id!-V_c)$lWy zu(x#hLBy7_pzyf@I!_dmg{WNn3xw^0rDGI}@zMma%Sl+rNy3yLIUyBDD1` zJz^AZbouKt78NAPB+Uz}r|4I~(d}HSw45PGk(w=s&9#=sE@wUUC>C)R&uf`*z6*Oq zvJobjqe1(Xn5y^4Zv{it3sn`#Tme0$X!d$Uj?AGQ>mi!ibag#gdOmr*59wP-(eLA6WDX5_ zAER08Sn)nSVaHL`kPWQ3agyTO*dKZY8}FPA@{INP2DTY;H)12JXZUV?vB&nYL8+Rp z*s9U7jiB*8^54YL*&4_AO)P-5H^yYl%Dk;|R*aBqX}35d*9t~vTAbSwNCg-_PMoeP zFpu#q^tBJ+OMgNMn=!OpM~}^{JH8U3y&vK8`}ZBQw}`#Q2efc2TNi8uN*jGYJ7{o3 zn{6!4--u1Xh6Vd7$E-%cd)W_Z9Cf(xIqY|>=HlX94NrDQ4|Y09@~Mbd!N*u za4Bq{MLXdW{($m!LMS#-#4fhJh;vM;4Xa`y^sveC^)8&`W23Tq52~%CulKONq58QW z%pe~F#brMU*|vO0Z5^`KB!?X86$dUPctY>*WhLPgKfafhH*9b00DP?eB18f|-j>be zwU3qa`bePe=S?T~vC?#4AM@fXCsEsNtR!VPm=8VpSI(>J0L#DjvHE()s#3>G;HP_+ysB;lPdhlvOBSFqr=C9{1@s203G|o=Fovg+kg!6A!b{B5MWC zVxt$$Gi_$rj@hIf01I!UgabI>+D_vRKu&hh?gL=&t#s`GYsYp{rGwa%?4;C#aNZnu zY(5Aj%+}D)hv327MU4)laF+xR#j@luW_ULpKgl`=krsIR4|pRvL0 z7(M(9=L5$bJ&&Ltz?ycH9mlq})iE5kI%wrF)}@G(d4+|mPc-?dym+t?=3$J|dGi3( zKF(}>t1$uNk26cS!FtY$dW={>WR4wY8_@00&siJ2+YtKZb2hD+et&?N3e1Q2nA^yZ z-!n$@s=DzbsF)#1slV$oG)|YHXJ~bd)|_CS^dlp&pnJhdZE;Ap0ZVz=t$3rrFR-Gn zr7>TyNF>X?0Q2po{a>(}KBuIW;cGcf&%eOr?4w4xn5tv+Rxa$}eY8Cnq|T*lx$J(B z{s}jemn`U?a5Kvhx^WU3;t91o#mf4BVhEZT&2gG?id8FiT$()I&M3OaE>(VtP5h5$ zr`b66WYHPi`SJ-xoq^O`rio`*V6eW=gwcU-!kO!vaN2Z+6@N)RxO%yEhRtMWXuw%; z)9aypc^1(d*iN5iQ=GFeO&gQtbDf=A(4;d6lFB{@{kfHnoP!JH7Ck)2GS~@6@|Tbv z1T7sJzys;RS1?qTIq*$Za|ZTIJrC8ql|DSr+V~n@2`ZKxQodmw3*8r61V{=Ov-B&a ze8X&P7ES*~9yi|q27yppY1jqqPv+3(3()r(UA!QTlVTUy2xQ7NZ_Py(SSsJ{z=HLd z8CC#RtjElvTRbMG#go4rMtBR;O@!uBol9~78Gi}7Y7T7`iAFasffY0gyo^<4AvM1& zEw9a&G4i=|`7*XKbIA7!oIa~)$ractIFh^qU(qW1Gmu#1`Ya>2brR6}TVVY~bmEpYqx^0|`Ol|> z+j4>JbsON;(!$#yM;`6I%_|TkcMq_WIlj3gK59|5a%K}RO%5MYF#9)AlAfO0_X?}4uOkJg;j>w9u{sP z+WrWm%Ar3VvGKloR9{nAtQ6ax7bERg2+||^_*ZDzV`Tn~eZaR(BI{Kif+3&&4WTVt zsSiGxf!*-Kvm6|FE6x3jO&HTgZ30a9{tN#RVM`q=D}YTORxPrvAd?VA(}^&vD{>mEL6KYiS?jm)KcazQJ*8pW`T5G-)O;O1`y}HgwjLzYWG~>BakdO%{Z-OrgDATri`* zw@muzi9=8Pd}L;_p6t;Rv#-qTttY$n#Mdk{lk{Yl*{uVcpDY@sCnx=Q4q1xvFVSbU zLbBvtJ-MzYRRa*Gw37-K z^7pVg{w?hvL$-)kWtT&nWfY@hF1lCvrr6xpTzJg>^MD$;o*2Qm*ZV6N5nb^r3R}) zk;e#EeUwJ}{@-Mo=Qvo7AK*|z6DmR|jtNv|^J9}}Wr%XF$c$}5+J(lloDfjVLn$_a zziAUEx0bUaC%|kur?0bTg)ZQUJW*~}v{*h7Km+4=)uM(@c2@K;S$?MOaTxzsG%Ai~ zLUrGZF}f&+VrbyY#s<}F%tjVeVGi}F#`{3Y9IM7_ z7Wqm7v&hv*674)$5}?5^QA`3K=;I4T z^YSH^8|2a#7RwI>U+>W0)%jSbX)~h+AL)E9Qj_E3cj{FW+VTNyugOc}?LtldW>JH( zs>zP)l}u*L(*tT)i(dnG*=qCNNG8|jwQM>kIAhY~%BC7I=`}c_z9-P6s!(+gYeVx+ zCf_=|sjtMw*OAFGLkW$^J!N_4x+& zmt$Lf?yW!?_ceep{o-iekiQApa;$5Fxn)lsCmQocoIRua&3G);X~wtf&->tJ*wCD> zWzQY0TJRDIhA_A_#BeKprYE6ocw>laQX3vG3g@@yL)ofD9UwfbC<00GRniPn@kI^3 z-)mrMaN*(U8Bf<={;H<5ggSQMV_?Xf>A(kzK$lt_d6*ITr&>M#ReK1EQENs=OvWn5 z^Nu{30l(gzVHH1jOzO;MaabAt-M}8dJIZ$Br&XMk{oWJH_*Qz*3kp~!C8%=}$M(xH zA&K{6MU4%Quy(AT;4sxP&GAQXc+5*UOH_-o1vlylFVeKh2wLGy%|@MfJeWe3c1kcc z?8_seYx?))qcI=X`$9T@qmKRf0A%j($J6mvAw?$3Qg|=y1D>Yvh4^q_UVlvXVcOK6 zcX0yEWlW`WgJ60`4&ckt5JvWFJqdIq55z3!FAeC)AV{WRgm+8j?fe*mb%*m`{P(-!l!w!;xbe&%eS%`gDbV)HtW3Ehu${qML;4-v(;g zvv3ochy^n5p_^&E6QEQd0)=vcl8116cdKVb6E0W?aQlz(fB;4H@bn4@@b>XF2L$-} z7lH|clON$?kCfp)g{sHyv?b#d8f$$VwponxH(p7g^dm?_?g^8!t8yyF_dH-?1^h%77>(~Ow`YGQlu1zvp`24HIzpgW)7Q=YB zaisLGTa9R3exZJx=hhc($u9)afv0=n4HW9f)Z&gu6bjtk8ALzmbIYaZ;aJvksrPVR zE>&k7{n$=^nB^8LWf9;44L%blwFEA_QZ9-Ws3I(a|E_||ivk_qBY0n2O5#Wx1rr;) zpV@Cg7x0{^i!>fh#mDfA$opdqKkxd&#_o-nxFxjhJ(xmUok`d@{u!IM{n&dO4n&|HrxGCarr+oBuYnz) zBnWH)!AD?=)_ww8qhXCjd?P03`$f>ox#UZHGh0m#;xUDFqGNq-C3b%Z(4a@e!~A8o z@Ydt5$Tbv_!#_5@lk&7@N_O|uKS4tMpK@T^(sQnr)zH-3<(Ppx)=3k)uyw$wbYuYS(xebm$*6})Mn7)qJg2l0E9WP-7 zmcz%*tiDD-oH$ZJsLRcD;5S72uIDvSxz>7&HII6(hb26dX0C^+n@9WB^E)kG8AgOD zbmkWbs8OtL!Abeg`05Lnnb5Y=TwV_7`XI0B2Rt&$HHo|6hY<6)m*rn7g@bP6Rw)|) z0S`0oSrfJP%ese{+YvW%PZ==I;j=2SxQUuL+!ip5d-lxO$a_dLTA0%MKPwj`5qd4s z8=Fy%Gb*ts^|mrAm$AJlmIr7>B7FoYePpo$S2!<><>xFpg$Qok!w#JQ@LPwDFqd8g>Zf^r~&mmcEdC7cM+x`vYug%FV;K9g&= z8TJ;!gg3*|b#?XKX6Tqt_I$)Ii$l#TTX;{l+)-mI&lay|wsCQe$+jbRJtb}DC6G+m z&i^Qgl&8GF(uvfZ9XzR_6R9FPQbqm?DKU${9T@sWn)JGeG{S{tz&Ca$Ouq-zY$uS& zrnh(U3P?8WANQdL)}B>B$~Fxu+-AJ-i;ulJ>|d3-!0J^*3*a%&hB>RmSPbCwlV40h2VF8t#QA z$)>cuvdV{glBXvz`()<8eZ0L}yx)I?N4m$> zI+s5FgqPHBcQBiArDs)j0^B!*S$6{t16Dk(wQXzSv4l56NYD&>^ha8yve2@e523@B`{i}2?NE)T_sc76t{ZiC~y&p0k;+u*o=gr|xl&ThxhVYXw=G3YiN+?_p+ zecT6*-;P5a!rIt>0{aiJd$nBt2E2DObFm>?OY3t%$UJ%`GV`e2NuD6Wz-J)E>%o&e zPP{%k3F*nB(x>3%$)ho+`2FSv`&bL(0uAT0pExWP*usMM!>-@?9AtIHsY1cJIKWy$ zC_}MC#KL)#tbaiM^fWJNbFB{%Vh*i_rG>|6@m>KGsC|aV=Fh2Xs;~O67*F|WvkTy{ zGjL_(Qovd6x_6MnM5uWd{DpnVSsqjLh){lJ^ED0$hY8`GiUXkKXZg4A+>ALV&4X3v z03?U<&S5H#QL!)iTpSs_|0Pckek^v~u4}m;?={@M<-fx8uBFyr@pyEe^%ds)2(9{x z#}$?h%qBCmuL(8@9H2M9;#Cc6#ki3a#;aA|WKe~#tv6B-}%IDiR4)b|17-|@ELCq*Yv6PL0DVeQd) ze0JEN@#OD7)vL7iJMOxLUc@#bqzko7b`VK8$WKv`>#*k6(l^&7-~4qQOUzX&b_3Sk zDe8Cwnrbagydlfh+~6-F{>xDX*WNt(^d?-dQ>pX!u=A$Udr0`y$uy}s;x4Xz&nv#Z zaoJmF^%*7If>bW2_ijOl;2wxuya5>O&s)51@r(Ls1>)8OZn0trF-k~v#any`MeS~L zdn-*S0e=-LV4--zIPuSNNi>vhg1FSu$Op~f>a<(z+pxLO#RxW=akB~}M317NYqz;A z&|sl0Lb(eAP9CHe`2kzFY-;fX@9LiqzzW-X>kn{fWIL>Pz{JjL3IGo0+SK+(UbT=! zFj5820I!8K|3?gVEgk+5hYnY%#9hqrSB|=O`MW}2p7;qqr7x&l9z=O9^~i&$ed3su zhY5nLt-gnq`Z?v^1IJvXvOmi@U4Mq3b}3!{8Cv=)Qh(unQDxvS+*aNgMk$OIWI1tM z*B0W%r9zyUwCfihS>A9a84WfZdqsm8MkcZQJP;iP-8M5B9zc5@p-B&*oN{Q* z177w2GPJu#b@Yinqv#i zDB<+uuRJ7Twg8LJ7GPwV<9x1Y60h%3_;2{T8@DIZ;Xing*8<_t zwERPr9z(ZaOZAw~3X%PRzVMmN#tuUf5A(b&Ig9>=i}5g}{4HIk`~T*3+(LGQci7_z zKVA5aoDjsYNwc<*wmitv*LxyOVuHaj%0j zLM5ig&oARG-o>PN;A?p=ZR?*+eiA!LmA@)Ar7!Qc`7{%NiPe=Y!_VpfDU;o+3Z*9 z?4>kf*J!DivJHr~@>co;>Elx14$#%1I32h~N4%A?e#RICr%$2TF_?P&7>YlFmpKMo zu-BYJt-#l!Z~H1`!{o6SxS1L1WBsK=VtvBF0)66(DTFJ)tdxP{H_EI;vxn5q3?eR| zG_z8^fj$UTgztL_Q$@dr+0Jk`5M~nsfzf&D$6!#g`kP_z!Lpwy47-^T+xGJi>S$3SK+a(n zWevy~SXde4Y@%9nKA2uuVeD_3QA8<+`QKSY5vMaRiYP(xQcpy3e}8$~$HBsX`bl7B%7f`%$#D^iAd0STSUBy zs)2e{K{Squ#!tz70dT8C4FZ)&Ljc^fM+PdbqF>p&9w}pRj#*666#6MpNn<}y=OCp{ z#1H!L!hoREd3M%JOr%hJIkY86=>*EC!Ad_QgMyW$0QYcVKP;3NgOwF18&ynM0^TSb zqRd9JB1E~0%(p`odw~YtXmB!A>BV16rt)FROzT9^I~JFX&kqTn!$~jv&fuE&#bTFg znMmiulr#VHyzOwf(%VZ9AYnAVjS@?P!j%B(AE8u>f1R!totvGfX{s1BZg|3xH2B~e zg%nqQ0nd1rP!bUY)3gKzCgn1Ld`l|BQ8K=y@`=|qG5wLAwAxE4ODR@m6jt=BRwWGO ze_272970%e4=2-sPaT6}6j;tVG`3uRzKCwRQBFyuk4h&50VCR2R%r^v9+d_2E~SVl*=O}A#TH>`1q9l9SUn7(K5;-Us?R7h zN~w-!o1>Ii0J$2aM9X*BOXV-N8*(3$S4`F z;Llvq(RgJjlJ@nLGSsy)bkBO4R9R__p)plY}{UWdThanrD&YB(%5@%F&6 zql$un*c`{lRh7D4XbA)&D6oz)9?!s{6z#5~48e1$x=vICMnE8fp4S6LL+dFcknw#z zCn}u82;uNhz6R7ivbhn98!b>u_WfJ)}RR+M) zF5FCMOn&Xq!-b|wEj{BMwx4pEp{w7>uenGZIFOwqcI$;&D*MINBYp+~@ zMqJiG8DhylDb^L8enwpB4Fv}W`>1M1B?HO&j>>f~^R!N2(Y3UplX4P==b4?s0vG5) zXQezs2zeK!GEUvAb-@f?re0kXalZah7o|3;{L}?iE>cier4p(%>Z?`84G!PzF=c~|2tn-Ta~4=6C3166MU2hla!L?PlQC8&8Io;XgfF;2dg8x zK^YyOc5f=}od=}TI8!xSr$9RNrcxBf`}sGOI_S7?cdY62sa$uZCI4g!-RuemnB83| z4E|Zs9mD3IPN8vKF^nU0riU^=QeXYh8P)+EQC*3K7>hrodQwj%3S-&WQ)vS8^kGlP zbq*!=Qfz^;fgzozP8cTd$X-f6uVZoqqxC3=KYA$@5LFVHq{Mm~g56D&l%=dBr9z-# z>$=n7n4|-6yq*M}$)UQvVN&GKB|~z=`KwuChQ-S!uJ`)Azq0G4FxO>HN*@@Y*qmY4zcR%O!4oXYa*`emP`(d0 zRN*OwnX|+W7Pof9;+75@Zn}2d9|$!ZVbrjjaGdI7&e^$!j-8mQz^&t0ld2$6VhQ~- zSc!7GwOsftz%Y9$Aq^UQ2~N;4G4KJX)&*B4@>mJ`%w2xR5}jUA%k z@BTRk4OP52L~mGz=#w-g#vdc2vl-BRYaJIelmHQB^y6@-{Izs>KAe}i18dLA@9+XOCyzL2rRUXg2Y~-cB7Q`Vx*&#AkoF%(QaLk?--@Z z>%9ow#y~7?(yB2^bM`&ujZsFz1=@S8g1c%dYpha|&8C%Om3okz@5U;VvCJjEt^AF* z?&Fm8FqYYPh|_P>e!Nl<;Tu`wm6pZ+5JXDQw{C%$IC1s7r{xa5S5`u?CO;jIW%3RM zPf$wwJQ7uLN9PYzZ-Uai@sHxwo@MhCe@MsE@=(0$fm`tO$wC;kI4!U$cB=?Kk4D&; zsN)ZJmj1bG1_5`H`ZXv~UClF;?7Ib3{ZOBqeW$9YN>v} zvZ=Sp@`>|dzw_Z!`Cu2mx=@bWNIsqny|rR8_R-ZQD}(69WW~exu(R??dVpdGMDP@) zVUZhhIuK#N;KmUL2uo=26s5_l@{de`9Ni%ER3$F>2hmJyN5oXgjTuDk2Wmf62`qWn zt<2k5mM1eY9XT`=00RCL?~(9t3;!F8^&?Z2&XpdEOc)y6TnbO1Wi7CnJqr}x+Fwyc< zFNdlSw)ig;_6`=#2l%8{v9js(?mIC1?$hpflsHiA&N~pwY>J((M21TilOSwR%_7#u zL*Bb1Y|OOj%0PtRe=}Vv7j;Yac-&-}HWjFu%u8YSWm(=4FLsmoD|J?ry{_e5Dmw%H zYBX|&a+ED_)S9V$#7oQ)wZg!yaqxwUn);p>aq*E@Imlx+)<}FVH(N;wdrwp~50UGN ztT|6)L@JgAj*n(5&zS#r0uO@=7diIKRqp#Ba(;adjOT@j)>ld+Nm+~y$U@3ptQ1Fb zcd^pVyikC#c?rjyqty~+iYFt-xmC(P-fXes%tocP7mVD9?b6omxLrBTmN_DKCqYuQX&U=-Pf|0p2n`RldYs3k?n^y#QeK0i{kc zR>kq%H_E0&W^>F8R%Zu9zWcSJ4ox1CVk%lBJu@vMDP?p<`tZz@;g#OPUod9Vzf@K` zs+U#kaC2I-rm2lntG|^zsxwW9RtK;+$DL^PqJj}Utf+?jHmy=KtK$vSQVy_&VwHShYXC?yD51 z4q_n`8?QF?>^D3;BeXfi#jA}ystiqeD@GtZ3lw6ut3)c&qoi{7fH7Q$Z* zE?ik{#!EEU^Rg?e0lcJ9;YMXtu+p#!s*NmF)N;(`dXA(CRa9>tDQng)6dyk#GkJJs z(p$p^Wu}y(FRK7#X$i76b*`!w;$>VF`z88iPxaBWkE2yn2EFRG#*macy*sIQil!=~I(d)=+El zT2*D9?}(9oM)Vy%s8335veZ;dusRf56S28a5p|y8UH+`qG=Ig>g%e2D~s_?i)ed}8t-2a zr!UjgFtRmQ>$A?3++0oOT~huV5`yt_{u9WQ7OI_h(?oein%W8y@6%FEcpdfLO#bh# ziqV#q(3RbBhwXnLU96Q_kN244>aTg2+tQE}A2%R9EoDg3@R1`jdoIcsvH~RjvYT3l zTD4Y-y$;J>M@1JkUv5~Q9<)|#zpi1@y#K(xG;M67#`50(RUS@N+Nw2p@_$cQ@D|lV z-?RmgK9bgvo&)z70rlcawA{-aj)_G)zzS;515nQ>{W? zop51t8reIk1No3lkyriSQd8Q$#(?4JZzZJP+VILYQat>lT{J47bzWZ9-fBmQ^VM)V^h7n2r8`Wa(Nw#; z+MSQ-N?We0UD;TA)Ll(rZ&P#+wdw1y88?h(_fWfraQZ#(sm7@B@zo~b`b@Qs*JO4CYf^Kv z+)#_ttX}HoSBjE94M+ zVnuven&xf#ALQ^->qGKVRRb%pf%! z+c5he^<;_H=$3`}J1+mEso#>vU^S@ZYbs{5vwDZ6hBSUHi!U-pvzWbHK=`ObWUp)Ygc*=cSEkY;8su{2AYd1Vq z?T@ONqV}fO(P9tH8>eo69ViF9T~2bO*lw8$ z{eOL3cVHAn``+1|xl1mj_Ye|7RpcNECG;wSv=9)G8jj=wM=p1ly9-67gd)Af1747B zSEO0Ks93;`)F=W90w14ZLyG<^Sn&7EZW0p2{FCg?&d$6u^UnJ|&pR`F;qPI@!r$O| zbxHXewV1)Qu^$}0w4Y1bdo{#x@03rLM4}%72frtv27sC{trXGtyywBi+U(iF( zV&0k;mH5xfSDMiE#pud&m{NMtEth~Wo|oda4zW+QyK?iK0A2s3T}yZthxixdRVM`G zq*yU}4jH5Ql65xf9i2;Q52Lq-jK@^Da+XK(%ywB{k!>mOf*|&0`R{8fP1Ci@UTmP z-^sm-cVmCh&Q*LELWUg;%#~V(pvYg;t&F$TZZLejUV0E6h^;RJ_xzjD&NATfIdry+ z-=mePedv4{?-ta)z~OTECeNj!M|dA?o_aUAAK_gsmC5tf0kmx{Pp6gvUSC^)BdsVl ziSh$bl84ny<8Ez$Cm;s9D*#a!tzFIASQe{;jUn^O2^L4gR`U$Y5_N!)SZpLdv6{Ei zmKsG?0=S=7^YEZ$Y8O2pW!#IZ_AP}Mv##NBAOs*Obma;vT?5p@&awO`t-jL z##adwY>oQLZ6Du5v)7@Y*V3+ayz@Wl0SG`8S=aN{8mT*OTR<~9u%6$oty8B{#G`yH zoqLKWYwOjsagD! zveKt{-@4v?PJL0Q6V&q=-mR_%Y^M#+@V7JS@b%BDUF8J54ZCT9Rg!7{!oQOU@r}^% zYJv$8zEj0lC#s^Uw@x8o-RF2hU2^PFyZ?(E4al^ehikiWq_P?r-rDQU*DxScn&yr_qHW#bBqz*;{p$2QuU}W+zC^{(^Q?ci^z8He z&bnIqvfBT)(rgEx9KM4m#r;Q>gyVKY(tsY@0oqlrKJc&Og5XrL_KLc(&av3Z7Q*ASJVUv}{xaj&a7V7OHeb&i$4 z8;<@B_1}U)_36ZJxVAUdC;naPmNa?~PpPZXZ>d}AdR={iC)V})zT1l@Emo~q)qdLf z0>9^0{cS>syIIW{>A7#Kb2Zv_om|1Rb1gZnso zorjdK{|`J}^Eynzd+PP7HGo`NwT}-f@A3){uCx62%Wbc6Tb)@xptG;>p|u*W)7asA z!B9V>;=O!zU9;@~rM=FV)-?hjsUOGzY(=%%NRv8R3Zj$M_MrON?fBWrx}-T&e)UZ- z;JUILE=QLa*2$la7;e2)4eAME*ogAq=AG(l=~4A{qots%nY3dsICS%OcvfAn98)W3 zOCK<9u;5VI_#jV}wKO8_U7lW7D=Nyf-^KD^U0FV+&F}HfJiSBKC-lX8yci##$$lR= z_*2^UK5wU;P`@YlpZqXA^#M=SPO6uTyEPwTL;oqY8&+ekwnEtVhYzt@iGiqphvOIn^e~USAyX zL-6H16&~b%Y|uG>kh@LoI<&o@<`{T>@i~CHB?yaI{-;hb%zp+&PDbqE)FCX4eo20$7yikjl_Oj)EP1g={7g)=LBiv#BR%WdtA737UT7S3p zDCXMt@|F9$OSAFfb`zlpS>0>5DFLkkz;%V=9Z;}4qKOtSkIX_M&82?+Q8=lotoUL#KP38wV+?U!hI zlDX%a+o!kBTB=Q!jQxH(ZbOGIqdsT2{FL(>XZQkbg*KD+o#8X|(pGA7a6FDbKu1q- zvw4-){N~uoR#-a7#jRYoyQqwc&+?qG^bTzv(F_vgyOs1tnbJG74QOMHA!>0BOk_1S z(CPyQHI(P*pFhXP^7M}BYpLFO?$k*0P}q4u_*3UWmDbUv^BA-B8VK8QemBkh68f|1 zzX&Wpsy$piMxCk4R~X9;lyiYEWE;yry8!CWHqqDr!@HYnynDB{rN(Pf_@W^e!S#2y z%6D^QLVJ9M;`mqKT90YtJFM>Nisoh7(HvnIbt>Zy7 z;A^amJ*8D|r%0i_Ut^oY)0F)Ug8AufosI(kGxEhQK^g6wlHxrpANAtT$$i{vWNIw7ScZj&}qI2JI zH@;k${XL(DD4(9sbP4gv7ql624Da`48o|esOIT@oQD(@+M`pu+z`vKt{R3aC{imwL zyDp=|a>}{PhtzvT+iC=42l*US#zZSReVI=Qc~#pZS0`jp(@33lh5yN3qX)0@Klxtm zFQ&U_dgdBGhIkiJN7At$`I88GP5p`A;BSI6R_EwWpZ<)%#c%(|*Ri+C%YNpZY5TO_ zY35aaA6@!|Kh5{!7a?iZRX&Wq`<3s|-iDHHy$+xE;cu{)?@;n}UdrC3&DZ&S%X`|a zs^*?=ju`!BRYa5jcaYfkwVZ1Ek)?g0&5(ejC9Qgu3%ctM-cS2b``NJ4z5m3fj{{Wn zC%=Z{v$=oqSG9xM93x!lUPT2 zLd0k%wE#r~iRY+^Nld{e>y;+43lXmFW^sglULF=Cl9_fIpGJfhw4;f^BJrLxS~&Kx zI6Q4~{Wf1=E_M}tp$UD5%2`d=CSq^PIn4x{kvA>>ycVBtm%CIv*kOX~6P@;4hs$U8 z`u|J&gGExz1ua6~h~jWMCgvI2fc{5Uf<^QCUuy9Vcdp&*#f!#Y8T-n0Pjh`m85WU{ za8ZkqyOMHIpYTrG>b@Km*^LZ zxC34yHAJ+~E@RW-8(F-5_!TXxrh=rh2)aXrle44WicJ;!f%oDw=e=p~cqdNQAJA+T4F@ z7Fnx1x4>(+&*8DgjTA<1gn~r)S5!({Lq)=fxjdvYFSbhg=W!{gd^6AGcS^wuob!1- zBhBHn`Ta8%aFN>w+n65ai8U&>yL=^Hd#>Fz)!}u!7E)N4NS(ciOO-&{Vs0w37v&Xs zmhg~VS%2PSudBqlln2Q>Po8JSGH#N|o*B#ai~JJL3NG?Xii&2eode1w{l4y$A3CK5YPnril8n zR#Pa_%|TW3K|UHtT~owBgkCo-5%Har)?7YR(oK=bX{qOMc}o0N*@LzsnR}2aN~VWG zFKa&-Os7+X9lP6lregkN(u7peSZ!0E%4UiBs?s(P*}IwAE;VrNjyO7>Dl7=@exE85 zP1*88fGn`3XDZ7IxLU>$4q$Tg5S)N!EG4kDXF`xslhT0-8{)H)9cfuZ(SUWL=NgLU ztTTPwP~3^I@}KfwS8A3f8e=`Mf0}55g$1|#*MnB4iB7C%`O!47S!KP*)kJ*TxR+vz z@2jDgO>up>rf}S+DT-OJDGKui#cIJy1wGJIG(-MvO+{OCFH2UKwEKMs3SBQ+er+MFwfy8PgBoqPYXw9N0;KXz%unU^yIeA!rHx? z65=oMIPKP{HfM>QbyX}*htFSq7g6AtZqK*YN((Nsc`7q>r?4*K1*|6R?;_$%`xV8~ zm{IGlqJFZ=op0BaUgjj#^N!+GL-gXUGS&AkHSLO-0F2gEG)lO~9Lc;Y_t^ZCqlKR9 z1I5ycDRgOW~a?*wN0|S z{MJ0TtH3eouoCU|Iwmi?yW!6oWzP% zlf&h7xa=%l39?T&rY`zCr@LrmzR&De3oDesk?!o^L+LW^4p0GDI;o={*uic9Q1|7S{Ueu-DQDr-TBD^F&! z`e%6Tr>Lw4{LyH7t%pdiSD^%9_IuoLmY?CLw?#YCSaUPx)#$ArB0i)-F?+CY)?stP zQ}+}tvAXB%DN>RqC^5$FQoTg056iV^cepBO%WmfzH+n?K6BvUw^4suvI;l zu6aZ(G|H~T>6iWRN`ZMWFT9`>PV;=NcunTYvMwk>-$$EZf&l37ZJ?}@~ zeXCgD8n7?5#BcX~NBO-(tMEc|DD$%FB4}GL(X45axd}SnVho-von2Ct(5l|oWycQo zOT9#j$!#8`dahDLZ_!-+R0+(Cil-sHMU45HV(G|~Hq^6Fq|uO;B8GWsTW=8$r1NTT z;beYlb~id_Dh<0^jL@c=Qv-XVQ|aK{(7p%g*Skf}u!qbckjwYciId53z&d>_54l9QnJ zquhS5vP)=IKhd=10;UA#xl5qn6W!CTOoVfx%P6rw`W;6y8E=e;oDtLf;yX!#nt zcrUE=TC((qL9d`Y`ipe2j+sX=itH_#)f`K9jrQ~xopD&d2ypE_NPE=-bEf1|%N&sq zeL<;VFWxpfIigs0@;fv?2fcGbj$9lKE*4Ex<-Mx0jvWen^8qtAM90?{F`jSp+dif7 zL-FDPS~FDiZc?Fy`k*=v*CcC+2Vkf|iE!HBgC^Sid6T7{di@pj=TOm=A7tjVzzTC3 zjUOf&vBOk4Ow

+B8fwHy>r@6xDNt4h|EE=88&HPxFe{wfBh-aHD$niJl0b4Zcsb z9C?D7FEZ7QPh_5C#Svx?(3RC*%#LAN>DMmf#&|HvfAhg4zg^xK51cg~IOPMXxKAYI ze!`S`dMQOxe!CBQjg$yIL2ruBI?dsqEE54dQLi+cHgF=Dg4$t7F|*kzy%OBGz4F?4 z;BxzM7`Fd#(Ix&feQtkVJ-1IYOCzS#mvcLsb`J;mIzxMhV&aHsd@6j}Wcm|I5scIBU^!6QVIkpIc~@PO321~~01;)AUY zSH69^rhG-4MuUX~yDH>;8W6%x^_eFM*6^8|R>|Tc(8QFQJgvjGKF8DFHQg#7Gw!kqFPCGBpfgok~ z`$by8H|Tw78Fj<^9p1=u!bBSKvrBlxmY-jFcbO@sDGop21G|ch1rBJ198kB5{fJVk zE%r}RL)=bB-VAGr3zm!h!~%OlqRmLRq+t4G_(fur@_+ge|6D!9zfj014Ct@a68|E; z04map_>EcmtFY>GMu`-l-Rm@SlxULldu5m0wCR=E|De62L~C%!??;J#>J3KiMuSq$ zp)sRHVqB?eIO;r`Hy77@omJFt}AU0Jr2%Jv~=POmSl^z-+(j*+J%1tN6io5EUsk&jSVRvq3 zNFFEd;sIm`6gNtsym9a^YiQv((Il!u;e}A}wJN~X45!&UZuaRbHrmBMpHEML!1@9PN(L)ZqUgvpu=V+&hsXWN((=_|?0v-^An zB~F-NJ@s+ervjS;QdgxsiR$IXa4Tr8+dG3j&6L!@w%F*vswScAS**8<=+3+FmgK6a z-(aq64^uR!dlG)FMFL>m0!qQdF^wHS$abs8SpvBc2>ct8)_WCG2&#hs5%#e)oFE!x zy@5%gzh)r9xAci6cjy@R`@xtHfij?OHSlEb25e1}aW1}Wf=FW@2DUbBjCHV+6EJ^1 zq~9ipMv)(4Li$`bk8d)J>PJjTq94*lQfqby##)wVARl9jvA>uS?M17n+H0r(9k4Zv zjbEZFVTSq{`j7EgrYg~tF;zr&Wvf&L(R<7%V@Bk&N2(HFdK@qh_yravagQHrInG(_y0ndA6t~gC1?gf`S{T(4^tRJm01U8RW^4|Ckz7WcS;olYU%{ z)SZGAnE(QH%m0LGmUj-j?Z&VdYE|{gd#{B2hkZ72?>I5m~ zZe*LnJu#kLx07&Bm4q+UmT>z`37@|y;m#TordNr$qguolRpli$B*JjlQoWhNuwPU> z)r=`h8NHSd0L#VNoV@g(@b4uB!WGLV=G;j6J7ZTjdmh37GSiiFUD{+ zqwo7-@YXQ0_7lks*0Q*o)kqFk$;t>)OA^PmbH!*r<)sO3VZ}sW;f8O0ws!BpxLcjD*iP(8r^}Mp zY^Q57`}36QK?OS~+k>KZlE)+3sJj?#9fAhzrUM?}jy-e*dI4 zf)qo+(O;&m#pv1p!1E0gS*(1m7vuK|rFumpeDo%TD$%_~dyOUQHz9~3$>5E)7srpM z0Qb^XuQ20_-{csM4tWC#QU#EMlisYYMlvQNV=>xWjLr_n4A@6;J}An5>fjTp+S@qs zToVGn!|3%95a(T5@59)>$Ef>Ak<{pYmRxg8tFd8aTuS=@x-b%Y{~@;Zvx?~jMo=51UUsyAb)}9fSphr7ayD62)=~@LepbESN zYaiqHF6CWdcEcd`6Gn(3rmDvo4H_d_sGl-=b`1Lb1pQqi8fzz6HP8yfqEOCMfVj`( zzi3*DKiEaEWhw^lG`%$yV|<3LOcj~!%-XkYsP!zcy0%n2OLSJ-^``V$ zq8+6#6Jcum>Ns?8YF6#HI@G@HNEx$5+ZLU;#8RDuu}Xot27uJXQhAB!bl0kDfU|D2 za<=HCcJEB9W{Z?S!@Gkibw1p54OUdPY?*16ixot5?-3LT|Fo5gpXK zGwJ9Y(U3Mz7iRiyI;d(NIx+{*?0YCJTgl>36c!oD5(9AeKD873+W0Y9=P|P<=?*FnzSxea3hUH^yT`jqzY3^zIf5hKW(UeT)ttM*v)6xTsrA5Su4aJU|{Eg)oUMv zYOQSyuDzm>9R^bYT8ap*z5+5Ny!zf)j~HPP8kc`0mtOn+8pvkU>{RZeu{CeTRp%LBuO>do)eD~xR=HeOWI!@on31Onj7F>8t#Q)+J4IYpkskinF`+94 z6S>4$xmsYYBu(xp83r~M2&&RNF<8nJF>Q*go8gVCnh~{g`ofA!5U+RmXBg@JzyviW zyQFf2r`8cAjpc@L{d#L81 z&5Waz?jkN?R;V$ol}(&YxvNDS;7Xt(A~vCvMah!Ds%jK7mnBe6PmwTtUUl4ie)ZJ? z7G6zN4Cx1Rtd`&v#44zay@Yg3)az*%&?R-m*N+v}utB6(~Wr6+iv5hyd zdPX-J>~$jxm%O(|r*2|_o(T=q%`8x!a0j-;hY~>0Ru&kX7_Z@%%c-9WVCXRxxSE)T z6L|?Zl_L^>X#&Mb@%SKAi%PaykN$2YLRvhYl|gXv&$2*i z{RR!6W5LysXFCg%*Ef~td1UUMjX=x}01zv1Py9|6Y4F(^xpu)3rw>;*ZB*eV%4>bWonvf1zfRIYl#U0wqXmn{Y8jT+=JfD&P7QK7DxNGPuEWA1v zX6VCs9(YbBm~odqTY#m;_%h21Px zPPaE%cqLD+ioCtWf~w~AzMGf(rOsBz*($Nn+YF0~mBF^kq<2_kWn4^_ZYbEhETU4u zX1k|X=6jEYOH(LAa+N9XvwB8c&LFrSu!vis*M}_Bh|N{Lae#$a2k4BKK4Kv?YCp*8 z)r # Delete a t `golem api-token new` prints the token secret once, including when using structured output such as `--format json`. Store that value securely; it cannot be retrieved later. -Use a static token in a profile for non-interactive environments: +Use a static token in a profile: ```shell -golem profile new ci-cloud --url https://release.api.golem.cloud --static-token "" --set-active +golem profile new token-cloud --url https://release.api.golem.cloud --static-token "" --set-active +``` + +`--auth static` without `--static-token` prompts for the token (masked) instead of putting it on the command line: + +```shell +golem profile new my-cloud --url https://release.api.golem.cloud --auth static --set-active ``` ## Step 5: Configure Your Application for Cloud Deployment diff --git a/plugins/otlp-exporter/.agents/skills/golem-configure-mcp-server/SKILL.md b/plugins/otlp-exporter/.agents/skills/golem-configure-mcp-server/SKILL.md index 62d3c6bb2a..a545a221af 100644 --- a/plugins/otlp-exporter/.agents/skills/golem-configure-mcp-server/SKILL.md +++ b/plugins/otlp-exporter/.agents/skills/golem-configure-mcp-server/SKILL.md @@ -188,7 +188,7 @@ Constructor parameters (which identify the agent instance) are automatically inc ### Agent and Method Metadata -Add `description` and `prompt` annotations to improve MCP discoverability: +Add `description` and prompt metadata to improve MCP discoverability: **Rust:** ```rust @@ -199,9 +199,12 @@ fn increment_by(&mut self, n: u32) -> u32; **TypeScript:** ```typescript -@description("Increments the counter by n") -@prompt("Increment by a given number") -async incrementBy(n: number): Promise { ... } +incrementBy: method({ + input: { n: z.number() }, + returns: z.number(), + description: "Increments the counter by n", + promptHint: "Increment by a given number", +}), ``` **Scala:** @@ -211,7 +214,7 @@ async incrementBy(n: number): Promise { ... } def incrementBy(n: Int): Future[Int] ``` -Both annotations are optional and are included in the MCP metadata sent to clients. +Both are optional and are included in the MCP metadata sent to clients. ## Special Data Types for MCP diff --git a/plugins/otlp-exporter/.agents/skills/golem-integration-test-setup/SKILL.md b/plugins/otlp-exporter/.agents/skills/golem-integration-test-setup/SKILL.md index 45a878f9c1..a7a873cd54 100644 --- a/plugins/otlp-exporter/.agents/skills/golem-integration-test-setup/SKILL.md +++ b/plugins/otlp-exporter/.agents/skills/golem-integration-test-setup/SKILL.md @@ -236,10 +236,10 @@ secretDefaults: After the suite finishes: 1. Send `SIGINT` / `SIGTERM` to the `golem server run` process. -2. Optionally run `golem server clean --data-dir ./tests/fixtures/data` to wipe state, or just delete the directory. +2. Optionally define `localServer.dataDir: ./tests/fixtures/data` in the test manifest and run `golem server clean` to wipe state, or just delete the directory. The CLI shows the resolved path and asks for confirmation; in non-interactive teardown, use `--yes` only after confirming that the manifest points to the isolated test directory. 3. Remove `tests/fixtures/ports.json`. -Do **not** rely on `golem server clean` with the *default* data directory from a test — that would delete the developer's local development state. Always pass `--data-dir` explicitly. +Do **not** run `golem server clean -X` from a test — that would delete the developer's default local development state. Keep test data isolated with manifest `localServer.dataDir`. ## End-to-End Skeleton diff --git a/plugins/otlp-exporter/.agents/skills/golem-invoke-agent-rust/SKILL.md b/plugins/otlp-exporter/.agents/skills/golem-invoke-agent-rust/SKILL.md index d811a2a1e2..52e4f2ad47 100644 --- a/plugins/otlp-exporter/.agents/skills/golem-invoke-agent-rust/SKILL.md +++ b/plugins/otlp-exporter/.agents/skills/golem-invoke-agent-rust/SKILL.md @@ -19,7 +19,25 @@ This invokes a method on a deployed agent and **waits for the result**. The agen Text output renders return values using Rust syntax. Multiple return values are rendered as a Rust tuple, for example `(1, "ok")`. Methods returning `()` or no value print `void` in text mode. -For machine-readable output, use `--format json` or `--format yaml`. A single return value includes `result` plus `resultJson`; multiple return values include `result` plus `resultsJson`; methods returning `()` or no value omit result fields. +For machine-readable output, use `--format json`, `--format yaml`, or `--format toon`. Streaming methods emit invocation lifecycle documents in order: `accepted`, `result`, any stream `item`/terminal events, and `finished`. Scalar fields accompanying streams are in the `result` event's `value`. + +## Streaming Parameters and Results + +Use `-` as the argument for exactly one direct stream parameter to bind it to stdin. By default, `--stdin-format value` reads one Rust value per line, strips only the line terminator, preserves blank lines as values, and does not accept multiline values. `--stdin-format raw` is available only for a direct `stream` or `stream` parameter. For `stream`, each logical item is a fixed 64 KiB chunk except the final shorter chunk. For `stream`, each byte is one logical item. + +```shell +printf 'Some(1)\nNone\n' | golem agent invoke 'MyAgent()' consume_values - +cat input.bin | golem agent invoke 'MyAgent()' consume_bytes - --stdin-format raw +``` + +`--stdout-format value` is the default and renders stream items as Rust values. `--stdout-format raw` writes only bytes and requires exactly one direct `stream` or `stream` result. + +```shell +golem agent invoke 'MyAgent()' produce_values --stdout-format value +golem agent invoke 'MyAgent()' produce_bytes --stdout-format raw > output.bin +``` + +In structured CLI formats, invocation output is a sequence of lifecycle documents rather than one object or array. Streaming invocation is provisionally live-only: disconnecting or pressing Ctrl-C cancels it, and the CLI does not retry or resume the session. ## Agent ID Format @@ -73,6 +91,8 @@ golem agent invoke 'staging/MyAgent("user-123")' get_status | `-t, --trigger` | Only trigger the invocation without waiting for the result (fire-and-forget) | | `-i, --idempotency-key ` | Set a specific idempotency key; use `"-"` for auto-generated | | `--no-stream` | Disable live streaming of agent stdout/stderr/log | +| `--stdin-format value\|raw` | Select stdin stream framing; defaults to `value` | +| `--stdout-format value\|raw` | Select stream result rendering; defaults to `value` | | `--schedule-at ` | Schedule the invocation at a specific time (requires `--trigger`; ISO 8601 format) | ## Idempotency diff --git a/plugins/otlp-exporter/.agents/skills/golem-local-dev-server/SKILL.md b/plugins/otlp-exporter/.agents/skills/golem-local-dev-server/SKILL.md index 699f356e20..f1767666b8 100644 --- a/plugins/otlp-exporter/.agents/skills/golem-local-dev-server/SKILL.md +++ b/plugins/otlp-exporter/.agents/skills/golem-local-dev-server/SKILL.md @@ -86,7 +86,7 @@ When `--ports-file` is specified, the server writes a JSON file with the actual } ``` -The application manifest can mirror stable local ports with `localServer.customRequestPort` and `localServer.mcpPort`. Those fields control how deployment `subdomain` values expand: HTTP API domains resolve to `