homura-runtime 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/homura/runtime/version.rb +1 -1
- data/lib/homura/runtime.rb +21 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d20bdc2e926b60f96a8a50afbb7274cfa38d700d08d036bce728fc07e46797a
|
|
4
|
+
data.tar.gz: e624fd81ebd4062d2def3d14232963d818d9e638f8aae83f33e6266f12962f4d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97805f4a9a5de8192b3732ab8fef5786e8cf60cdd4931e82c91aae417b9ce6def91982a4fe9100cd785c4e23b933c1971b9e7b6c8057dbfaf34fa133a2dafcf0
|
|
7
|
+
data.tar.gz: 73023936543efd1172a3c4154b59531374e4babc5990980e3303c233335318c0047080a0c88dcb297d2e60ba2d6f57be0c2c353a087ba1055a096ea2fa4fc49b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.8 (2026-05-06)
|
|
4
|
+
|
|
5
|
+
- Discover and attach arbitrary Durable Object bindings from `env`, not just
|
|
6
|
+
the built-in `COUNTER` demo binding. This lets app code use
|
|
7
|
+
`durable_object(:voice_limit, ...)` and other custom DO names without
|
|
8
|
+
gem-side shims.
|
|
9
|
+
- `examples/ai-voice-chat` now uses that generic DO binding path for its
|
|
10
|
+
daily request cap.
|
|
11
|
+
|
|
3
12
|
## 0.3.7 (2026-05-06)
|
|
4
13
|
|
|
5
14
|
- Add Ruby-shaped Workers AI helpers for the staged voice examples:
|
data/lib/homura/runtime.rb
CHANGED
|
@@ -1071,6 +1071,7 @@ module Cloudflare
|
|
|
1071
1071
|
env["cloudflare.BUCKET"] = R2Bucket.new(js_r2) if `#{js_r2} != null`
|
|
1072
1072
|
env["cloudflare.AI"] = js_ai if `#{js_ai} != null`
|
|
1073
1073
|
|
|
1074
|
+
attach_all_durable_objects!(env, js_env)
|
|
1074
1075
|
attach_durable_object!(env, :counter, `#{js_env} && #{js_env}.COUNTER`)
|
|
1075
1076
|
attach_queue!(
|
|
1076
1077
|
env,
|
|
@@ -1100,6 +1101,26 @@ module Cloudflare
|
|
|
1100
1101
|
env
|
|
1101
1102
|
end
|
|
1102
1103
|
|
|
1104
|
+
def attach_all_durable_objects!(env, js_env)
|
|
1105
|
+
return env unless defined?(::Cloudflare::DurableObjectNamespace)
|
|
1106
|
+
if `(#{js_env} == null || #{js_env} === undefined || #{js_env} === Opal.nil)`
|
|
1107
|
+
return env
|
|
1108
|
+
end
|
|
1109
|
+
|
|
1110
|
+
keys = `Object.keys(#{js_env})`
|
|
1111
|
+
i = 0
|
|
1112
|
+
len = `#{keys}.length`
|
|
1113
|
+
while i < len
|
|
1114
|
+
key = `#{keys}[#{i}]`
|
|
1115
|
+
js_binding = `#{js_env}[#{key}]`
|
|
1116
|
+
is_do =
|
|
1117
|
+
`#{js_binding} != null && typeof #{js_binding}.idFromName === 'function' && typeof #{js_binding}.get === 'function'`
|
|
1118
|
+
attach_durable_object!(env, key, js_binding) if is_do
|
|
1119
|
+
i += 1
|
|
1120
|
+
end
|
|
1121
|
+
env
|
|
1122
|
+
end
|
|
1123
|
+
|
|
1103
1124
|
def attach_queue!(env, name, js_binding, binding_name)
|
|
1104
1125
|
if `(#{js_binding} == null || #{js_binding} === undefined || #{js_binding} === Opal.nil)`
|
|
1105
1126
|
return env
|