@lumencast/runtime-vue 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +46 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/_internal/client.d.ts +42 -0
- package/dist/_internal/client.d.ts.map +1 -0
- package/dist/_internal/client.js +190 -0
- package/dist/_internal/client.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
- package/src/_internal/client.ts +246 -0
- package/src/index.ts +95 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may accept and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 The Lumencast Authors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @lumencast/runtime-vue
|
|
2
|
+
|
|
3
|
+
> Headless Vue 3 adapter for Lumencast — live LSDP/1 leaf state exposed as Vue refs.
|
|
4
|
+
|
|
5
|
+
This package gives Vue 3 apps reactive bindings into a Lumencast scene's leaf state. It does not render — bring your own Vue components and use the refs wherever you need live values.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @lumencast/runtime-vue @lumencast/protocol
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createLumencastClient, useLeaf } from "@lumencast/runtime-vue";
|
|
17
|
+
|
|
18
|
+
const client = createLumencastClient({
|
|
19
|
+
serverUrl: "wss://example.com/lsdp/v1",
|
|
20
|
+
token: "<jwt>",
|
|
21
|
+
sceneId: "scoreboard",
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { useLeaf } from "@lumencast/runtime-vue";
|
|
28
|
+
import { client } from "./client";
|
|
29
|
+
|
|
30
|
+
const homeScore = useLeaf<number>(client, "score.home");
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<h1>Home : {{ homeScore ?? 0 }}</h1>
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The ref updates on every LSDP/1 delta that touches `score.home` — Vue's reactivity handles the rest.
|
|
39
|
+
|
|
40
|
+
## Repository
|
|
41
|
+
|
|
42
|
+
[github.com/Lumencast/lumencast-js](https://github.com/Lumencast/lumencast-js/tree/main/packages/runtime-vue)
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
Apache-2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/@vue+shared@3.5.33/node_modules/@vue/shared/dist/shared.d.ts","../../../node_modules/.pnpm/@babel+types@7.29.0/node_modules/@babel/types/lib/index.d.ts","../../../node_modules/.pnpm/@babel+parser@7.29.3/node_modules/@babel/parser/typings/babel-parser.d.ts","../../../node_modules/.pnpm/@vue+compiler-core@3.5.33/node_modules/@vue/compiler-core/dist/compiler-core.d.ts","../../../node_modules/.pnpm/@vue+compiler-dom@3.5.33/node_modules/@vue/compiler-dom/dist/compiler-dom.d.ts","../../../node_modules/.pnpm/@vue+reactivity@3.5.33/node_modules/@vue/reactivity/dist/reactivity.d.ts","../../../node_modules/.pnpm/@vue+runtime-core@3.5.33/node_modules/@vue/runtime-core/dist/runtime-core.d.ts","../../../node_modules/.pnpm/csstype@3.2.3/node_modules/csstype/index.d.ts","../../../node_modules/.pnpm/@vue+runtime-dom@3.5.33/node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts","../../../node_modules/.pnpm/vue@3.5.33_typescript@5.9.3/node_modules/vue/dist/vue.d.mts","../../protocol/dist/types.d.ts","../../protocol/dist/errors.d.ts","../../protocol/dist/codec.d.ts","../../protocol/dist/sequence.d.ts","../../protocol/dist/leaf-path.d.ts","../../protocol/dist/envelope.d.ts","../../protocol/dist/index.d.ts","../src/_internal/client.ts","../src/index.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/compatibility/disposable.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/compatibility/indexable.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/compatibility/index.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/globals.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/header.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/readable.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/file.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/fetch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/formdata.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/connector.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-origin.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool-stats.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/handlers.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-handler.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/api.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/interceptors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/util.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cookies.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/patch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/websocket.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/eventsource.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/filereader.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/content-type.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cache.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/index.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/assert.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/assert/strict.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/async_hooks.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/buffer.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/child_process.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/cluster.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/console.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/constants.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/crypto.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/dgram.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/dns.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/dns/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/domain.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/events.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/fs.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/fs/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/http.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/http2.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/https.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/inspector.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/module.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/net.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/os.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/path.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/process.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/punycode.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/querystring.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/readline.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/readline/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/repl.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/sea.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/sqlite.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/stream.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/stream/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/stream/web.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/string_decoder.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/test.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/timers.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/timers/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/tls.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/trace_events.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/tty.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/url.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/util.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/v8.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/vm.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/wasi.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/worker_threads.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/zlib.d.ts","../../../node_modules/.pnpm/@types+node@22.19.17/node_modules/@types/node/index.d.ts"],"fileIdsList":[[60,83,131,148,149],[83,131,148,149],[83,128,129,131,148,149],[83,130,131,148,149],[131,148,149],[83,131,136,148,149,166],[83,131,132,137,142,148,149,151,163,174],[83,131,132,133,142,148,149,151],[78,79,80,83,131,148,149],[83,131,134,148,149,175],[83,131,135,136,143,148,149,152],[83,131,136,148,149,163,171],[83,131,137,139,142,148,149,151],[83,130,131,138,148,149],[83,131,139,140,148,149],[83,131,141,142,148,149],[83,130,131,142,148,149],[83,131,142,143,144,148,149,163,174],[83,131,142,143,144,148,149,158,163,166],[83,124,131,139,142,145,148,149,151,163,174],[83,131,142,143,145,146,148,149,151,163,171,174],[83,131,145,147,148,149,163,171,174],[81,82,83,84,85,86,87,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180],[83,131,142,148,149],[83,131,148,149,150,174],[83,131,139,142,148,149,151,163],[83,131,148,149,152],[83,131,148,149,153],[83,130,131,148,149,154],[83,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180],[83,131,148,149,156],[83,131,148,149,157],[83,131,142,148,149,158,159],[83,131,148,149,158,160,175,177],[83,131,143,148,149],[83,131,142,148,149,163,164,166],[83,131,148,149,165,166],[83,131,148,149,163,164],[83,131,148,149,166],[83,131,148,149,167],[83,128,131,148,149,163,168,174],[83,131,142,148,149,169,170],[83,131,148,149,169,170],[83,131,136,148,149,151,163,171],[83,131,148,149,172],[83,131,148,149,151,173],[83,131,145,148,149,157,174],[83,131,136,148,149,175],[83,131,148,149,163,176],[83,131,148,149,150,177],[83,131,148,149,178],[83,124,131,148,149],[83,124,131,142,144,148,149,154,163,166,174,176,177,179],[83,131,148,149,163,180],[59,60,61,83,131,148,149],[62,83,131,148,149],[59,83,131,148,149],[59,64,65,67,83,131,148,149],[64,65,66,67,83,131,148,149],[83,96,100,131,148,149,174],[83,96,131,148,149,163,174],[83,91,131,148,149],[83,93,96,131,148,149,171,174],[83,131,148,149,151,171],[83,131,148,149,181],[83,91,131,148,149,181],[83,93,96,131,148,149,151,174],[83,88,89,92,95,131,142,148,149,163,174],[83,96,103,131,148,149],[83,88,94,131,148,149],[83,96,117,118,131,148,149],[83,92,96,131,148,149,166,174,181],[83,117,131,148,149,181],[83,90,91,131,148,149,181],[83,96,131,148,149],[83,90,91,92,93,94,95,96,97,98,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,118,119,120,121,122,123,131,148,149],[83,96,111,131,148,149],[83,96,103,104,131,148,149],[83,94,96,104,105,131,148,149],[83,95,131,148,149],[83,88,91,96,131,148,149],[83,96,100,104,105,131,148,149],[83,100,131,148,149],[83,94,96,99,131,148,149,174],[83,88,93,96,103,131,148,149],[83,131,148,149,163],[83,91,96,117,131,148,149,179,181],[63,67,83,131,148,149],[69,83,131,148,149],[69,70,71,72,73,74,83,131,148,149],[75,83,131,148,149],[68,75,76,83,131,148,149]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"f468b74459f1ad4473b36a36d49f2b255f3c6b5d536c81239c2b2971df089eaf","impliedFormat":1},{"version":"556ccd493ec36c7d7cb130d51be66e147b91cc1415be383d71da0f1e49f742a9","impliedFormat":1},{"version":"95aba78013d782537cc5e23868e736bec5d377b918990e28ed56110e3ae8b958","impliedFormat":1},{"version":"524a409ad72186b7f6cb16898c349465cfa876f641d6cb6137b3123d5cfca619","impliedFormat":1},{"version":"ebe84ad8344962b7117a3b95065f47383215020eaf1b626463863b45b4d16e62","impliedFormat":1},{"version":"dc0c80f91a4d46c5c4f625a35601ff3c815e2395e6680bacfa12970fc6d49c93","impliedFormat":1},{"version":"3e74c6f34a28b7c948bfdaf19172000d589093660b3605f8c21c1b30173c729b","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"88ad1af02cacc61bf79683b021d326eeafc91231660a06495c5046d4649ec3a2","impliedFormat":1},{"version":"c0191592be8eb7906f99ac4b8798d80a585b94001ea1a5f50d6ce5b0d13a5c62","impliedFormat":99},"c0a08675fcbb8bdcfcf38cb20d771284cbb10c11e81609f06f76786bcd59f329","ed06feb0167110ba63d81e5743ef32d1889261b6851b3642d995b7dd5dc03e24","01186342d21eea3336e2c550b35f65eb9681ee5ad8f229a1ab3ecc6429686436","842ee3d720618d2e4ccead2787a63dabe3e34f14a24b3edfa1dcc5c8e635d8b7","e83b15573fe4d229c6f3e85de99ef60fb14f9e4432a8575232576961b97751c5","c5b41b0e043f7b1da9d7059e582205bea1fce722ee04d46f6da1758ff152620f","8711f5590ea1151ba3edc89810c21020f42f5fcbe9472b1f5702078da4a72455",{"version":"4ae3ef8fcb070eb5f89d0d604fa239aa205ffcef5ac66343844f5d9399533ca5","signature":"8528cbb015deb04f7b69276e066648ebc5037a3c657b355a14229c67497e5400"},{"version":"5e9702565368580956e3061e908ef9b6f51ecbc553aa5645b90db070aff4a6c4","signature":"252926541dc013265ee5181cb683cead3a8c55b1e61b032792629e2296b34f5e"},{"version":"6c7176368037af28cb72f2392010fa1cef295d6d6744bca8cfb54985f3a18c3e","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"437e20f2ba32abaeb7985e0afe0002de1917bc74e949ba585e49feba65da6ca1","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"98cffbf06d6bab333473c70a893770dbe990783904002c4f1a960447b4b53dca","affectsGlobalScope":true,"impliedFormat":1},{"version":"3af97acf03cc97de58a3a4bc91f8f616408099bc4233f6d0852e72a8ffb91ac9","affectsGlobalScope":true,"impliedFormat":1},{"version":"808069bba06b6768b62fd22429b53362e7af342da4a236ed2d2e1c89fcca3b4a","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"b52476feb4a0cbcb25e5931b930fc73cb6643fb1a5060bf8a3dda0eeae5b4b68","affectsGlobalScope":true,"impliedFormat":1},{"version":"f9501cc13ce624c72b61f12b3963e84fad210fbdf0ffbc4590e08460a3f04eba","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0fa06ada475b910e2106c98c68b10483dc8811d0c14a8a8dd36efb2672485b29","impliedFormat":1},{"version":"33e5e9aba62c3193d10d1d33ae1fa75c46a1171cf76fef750777377d53b0303f","impliedFormat":1},{"version":"2b06b93fd01bcd49d1a6bd1f9b65ddcae6480b9a86e9061634d6f8e354c1468f","impliedFormat":1},{"version":"6a0cd27e5dc2cfbe039e731cf879d12b0e2dded06d1b1dedad07f7712de0d7f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"13f5c844119c43e51ce777c509267f14d6aaf31eafb2c2b002ca35584cd13b29","impliedFormat":1},{"version":"e60477649d6ad21542bd2dc7e3d9ff6853d0797ba9f689ba2f6653818999c264","impliedFormat":1},{"version":"c2510f124c0293ab80b1777c44d80f812b75612f297b9857406468c0f4dafe29","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"4c829ab315f57c5442c6667b53769975acbf92003a66aef19bce151987675bd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"b2ade7657e2db96d18315694789eff2ddd3d8aea7215b181f8a0b303277cc579","impliedFormat":1},{"version":"9855e02d837744303391e5623a531734443a5f8e6e8755e018c41d63ad797db2","impliedFormat":1},{"version":"4d631b81fa2f07a0e63a9a143d6a82c25c5f051298651a9b69176ba28930756d","impliedFormat":1},{"version":"836a356aae992ff3c28a0212e3eabcb76dd4b0cc06bcb9607aeef560661b860d","impliedFormat":1},{"version":"1e0d1f8b0adfa0b0330e028c7941b5a98c08b600efe7f14d2d2a00854fb2f393","impliedFormat":1},{"version":"41670ee38943d9cbb4924e436f56fc19ee94232bc96108562de1a734af20dc2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c906fb15bd2aabc9ed1e3f44eb6a8661199d6c320b3aa196b826121552cb3695","impliedFormat":1},{"version":"22295e8103f1d6d8ea4b5d6211e43421fe4564e34d0dd8e09e520e452d89e659","impliedFormat":1},{"version":"58647d85d0f722a1ce9de50955df60a7489f0593bf1a7015521efe901c06d770","impliedFormat":1},{"version":"6b4e081d55ac24fc8a4631d5dd77fe249fa25900abd7d046abb87d90e3b45645","impliedFormat":1},{"version":"a10f0e1854f3316d7ee437b79649e5a6ae3ae14ffe6322b02d4987071a95362e","impliedFormat":1},{"version":"e208f73ef6a980104304b0d2ca5f6bf1b85de6009d2c7e404028b875020fa8f2","impliedFormat":1},{"version":"d163b6bc2372b4f07260747cbc6c0a6405ab3fbcea3852305e98ac43ca59f5bc","impliedFormat":1},{"version":"e6fa9ad47c5f71ff733744a029d1dc472c618de53804eae08ffc243b936f87ff","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6f137d651076822d4fe884287e68fd61785a0d3d1fdb250a5059b691fa897db","impliedFormat":1},{"version":"24826ed94a78d5c64bd857570fdbd96229ad41b5cb654c08d75a9845e3ab7dde","impliedFormat":1},{"version":"8b479a130ccb62e98f11f136d3ac80f2984fdc07616516d29881f3061f2dd472","impliedFormat":1},{"version":"928af3d90454bf656a52a48679f199f64c1435247d6189d1caf4c68f2eaf921f","affectsGlobalScope":true,"impliedFormat":1},{"version":"bceb58df66ab8fb00170df20cd813978c5ab84be1d285710c4eb005d8e9d8efb","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f16a7e4deafa527ed9995a772bb380eb7d3c2c0fd4ae178c5263ed18394db2c","impliedFormat":1},{"version":"933921f0bb0ec12ef45d1062a1fc0f27635318f4d294e4d99de9a5493e618ca2","impliedFormat":1},{"version":"71a0f3ad612c123b57239a7749770017ecfe6b66411488000aba83e4546fde25","impliedFormat":1},{"version":"77fbe5eecb6fac4b6242bbf6eebfc43e98ce5ccba8fa44e0ef6a95c945ff4d98","impliedFormat":1},{"version":"4f9d8ca0c417b67b69eeb54c7ca1bedd7b56034bb9bfd27c5d4f3bc4692daca7","impliedFormat":1},{"version":"814118df420c4e38fe5ae1b9a3bafb6e9c2aa40838e528cde908381867be6466","impliedFormat":1},{"version":"a3fc63c0d7b031693f665f5494412ba4b551fe644ededccc0ab5922401079c95","impliedFormat":1},{"version":"80523c00b8544a2000ae0143e4a90a00b47f99823eb7926c1e03c494216fc363","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"746911b62b329587939560deb5c036aca48aece03147b021fa680223255d5183","affectsGlobalScope":true,"impliedFormat":1},{"version":"18fd40412d102c5564136f29735e5d1c3b455b8a37f920da79561f1fde068208","impliedFormat":1},{"version":"c8d3e5a18ba35629954e48c4cc8f11dc88224650067a172685c736b27a34a4dc","impliedFormat":1},{"version":"f0be1b8078cd549d91f37c30c222c2a187ac1cf981d994fb476a1adc61387b14","affectsGlobalScope":true,"impliedFormat":1},{"version":"0aaed1d72199b01234152f7a60046bc947f1f37d78d182e9ae09c4289e06a592","impliedFormat":1},{"version":"2b55d426ff2b9087485e52ac4bc7cfafe1dc420fc76dad926cd46526567c501a","impliedFormat":1},{"version":"66ba1b2c3e3a3644a1011cd530fb444a96b1b2dfe2f5e837a002d41a1a799e60","impliedFormat":1},{"version":"7e514f5b852fdbc166b539fdd1f4e9114f29911592a5eb10a94bb3a13ccac3c4","impliedFormat":1},{"version":"5b7aa3c4c1a5d81b411e8cb302b45507fea9358d3569196b27eb1a27ae3a90ef","affectsGlobalScope":true,"impliedFormat":1},{"version":"5987a903da92c7462e0b35704ce7da94d7fdc4b89a984871c0e2b87a8aae9e69","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea08a0345023ade2b47fbff5a76d0d0ed8bff10bc9d22b83f40858a8e941501c","impliedFormat":1},{"version":"47613031a5a31510831304405af561b0ffaedb734437c595256bb61a90f9311b","impliedFormat":1},{"version":"ae062ce7d9510060c5d7e7952ae379224fb3f8f2dd74e88959878af2057c143b","impliedFormat":1},{"version":"8a1a0d0a4a06a8d278947fcb66bf684f117bf147f89b06e50662d79a53be3e9f","affectsGlobalScope":true,"impliedFormat":1},{"version":"358765d5ea8afd285d4fd1532e78b88273f18cb3f87403a9b16fef61ac9fdcfe","impliedFormat":1},{"version":"9f55299850d4f0921e79b6bf344b47c420ce0f507b9dcf593e532b09ea7eeea1","impliedFormat":1}],"root":[76,77],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"exactOptionalPropertyTypes":false,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noPropertyAccessFromIndexSignature":false,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"tsBuildInfoFile":"./.tsbuildinfo","useDefineForClassFields":true,"verbatimModuleSyntax":false},"referencedMap":[[61,1],[60,2],[128,3],[129,3],[130,4],[83,5],[131,6],[132,7],[133,8],[78,2],[81,9],[79,2],[80,2],[134,10],[135,11],[136,12],[137,13],[138,14],[139,15],[140,15],[141,16],[142,17],[143,18],[144,19],[84,2],[82,2],[145,20],[146,21],[147,22],[181,23],[148,24],[149,2],[150,25],[151,26],[152,27],[153,28],[154,29],[155,30],[156,31],[157,32],[158,33],[159,33],[160,34],[161,2],[162,35],[163,36],[165,37],[164,38],[166,39],[167,40],[168,41],[169,42],[170,43],[171,44],[172,45],[173,46],[174,47],[175,48],[176,49],[177,50],[178,51],[85,2],[86,2],[87,2],[125,52],[126,2],[127,2],[179,53],[180,54],[62,55],[63,56],[64,57],[65,58],[67,59],[59,2],[66,2],[57,2],[58,2],[10,2],[12,2],[11,2],[2,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[20,2],[3,2],[21,2],[22,2],[4,2],[23,2],[27,2],[24,2],[25,2],[26,2],[28,2],[29,2],[30,2],[5,2],[31,2],[32,2],[33,2],[34,2],[6,2],[38,2],[35,2],[36,2],[37,2],[39,2],[7,2],[40,2],[45,2],[46,2],[41,2],[42,2],[43,2],[44,2],[8,2],[50,2],[47,2],[48,2],[49,2],[51,2],[9,2],[52,2],[53,2],[54,2],[56,2],[55,2],[1,2],[103,60],[113,61],[102,60],[123,62],[94,63],[93,64],[122,65],[116,66],[121,67],[96,68],[110,69],[95,70],[119,71],[91,72],[90,65],[120,73],[92,74],[97,75],[98,2],[101,75],[88,2],[124,76],[114,77],[105,78],[106,79],[108,80],[104,81],[107,82],[117,65],[99,83],[100,84],[109,85],[89,86],[112,77],[111,75],[115,2],[118,87],[68,88],[71,89],[74,89],[70,89],[75,90],[73,89],[72,2],[69,2],[76,91],[77,92]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Patch } from "@lumencast/protocol";
|
|
2
|
+
/** Connection status reported to the host. */
|
|
3
|
+
export type Status = "disconnected" | "connecting" | "live";
|
|
4
|
+
/** A single bag of named values keyed by leaf path. */
|
|
5
|
+
export type LeafState = Record<string, unknown>;
|
|
6
|
+
export interface ClientOptions {
|
|
7
|
+
/** WebSocket URL (must be ws:// or wss:// and end at the LSDP endpoint). */
|
|
8
|
+
url: string;
|
|
9
|
+
/** Authentication token, async-resolvable. */
|
|
10
|
+
token: string | (() => Promise<string>);
|
|
11
|
+
/** Optional scene name (test mode). */
|
|
12
|
+
scene?: string;
|
|
13
|
+
/** Optional session identifier (test-mode harness). */
|
|
14
|
+
session?: string;
|
|
15
|
+
/** Override WebSocket constructor (for tests / non-browser hosts). */
|
|
16
|
+
webSocketImpl?: typeof WebSocket;
|
|
17
|
+
/** Initial reconnect delay in ms. Doubled per attempt up to 30 s. */
|
|
18
|
+
reconnectInitialMs?: number;
|
|
19
|
+
/** Cap on the reconnect delay. */
|
|
20
|
+
reconnectMaxMs?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ClientCallbacks {
|
|
23
|
+
onStatus: (status: Status) => void;
|
|
24
|
+
/** Called whenever the leaf state changes — receives a fresh defensive copy. */
|
|
25
|
+
onState: (state: LeafState) => void;
|
|
26
|
+
/** Called on every error frame from the server. */
|
|
27
|
+
onError?: (code: string, message: string, recoverable: boolean) => void;
|
|
28
|
+
}
|
|
29
|
+
/** Headless client handle — used by framework adapters to drive reactivity. */
|
|
30
|
+
export interface Client {
|
|
31
|
+
/** Send an `input` frame. Patches are forwarded as-is. */
|
|
32
|
+
send(patches: Patch[]): void;
|
|
33
|
+
/** Cleanly close the connection — no further callbacks fire. */
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Open a long-lived LSDP/1 subscription. Returns a `Client` handle.
|
|
38
|
+
* Status callbacks fire synchronously on every transition ; state
|
|
39
|
+
* callbacks fire after every snapshot / delta.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createClient(opts: ClientOptions, cb: ClientCallbacks): Client;
|
|
42
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/_internal/client.ts"],"names":[],"mappings":"AAYA,OAAO,EAQL,KAAK,KAAK,EAEX,MAAM,qBAAqB,CAAC;AAE7B,8CAA8C;AAC9C,MAAM,MAAM,MAAM,GAAG,cAAc,GAAG,YAAY,GAAG,MAAM,CAAC;AAE5D,uDAAuD;AACvD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAC;IACZ,8CAA8C;IAC9C,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IACxC,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,aAAa,CAAC,EAAE,OAAO,SAAS,CAAC;IACjC,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kCAAkC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gFAAgF;IAChF,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACpC,mDAAmD;IACnD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;CACzE;AAED,+EAA+E;AAC/E,MAAM,WAAW,MAAM;IACrB,0DAA0D;IAC1D,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC7B,gEAAgE;IAChE,OAAO,IAAI,IAAI,CAAC;CACjB;AAKD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,eAAe,GAAG,MAAM,CA8K7E"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// Minimal LSDP/1 client used by the Svelte adapter.
|
|
2
|
+
//
|
|
3
|
+
// Headless — no DOM, no rendering. Exposes a small surface :
|
|
4
|
+
// - subscribe via the lsdp.v1 WebSocket subprotocol
|
|
5
|
+
// - apply incoming snapshot/delta frames into a leaf-state map
|
|
6
|
+
// - reconnect with exponential backoff on close
|
|
7
|
+
// - send input frames
|
|
8
|
+
//
|
|
9
|
+
// Sibling of @lumencast/runtime's transport layer, but stripped to the
|
|
10
|
+
// pieces a framework adapter needs. Reuses @lumencast/protocol for
|
|
11
|
+
// codec + sequence tracking ; we just orchestrate.
|
|
12
|
+
import { WS_SUBPROTOCOL, decodeServerFrame, encodeFrame, SequenceTracker, input as inputFrame, subscribe as subscribeFrame, } from "@lumencast/protocol";
|
|
13
|
+
const DEFAULT_INITIAL_MS = 500;
|
|
14
|
+
const DEFAULT_MAX_MS = 30_000;
|
|
15
|
+
/**
|
|
16
|
+
* Open a long-lived LSDP/1 subscription. Returns a `Client` handle.
|
|
17
|
+
* Status callbacks fire synchronously on every transition ; state
|
|
18
|
+
* callbacks fire after every snapshot / delta.
|
|
19
|
+
*/
|
|
20
|
+
export function createClient(opts, cb) {
|
|
21
|
+
const Ws = opts.webSocketImpl ?? globalThis.WebSocket;
|
|
22
|
+
if (!Ws) {
|
|
23
|
+
throw new Error("@lumencast/runtime-*: no WebSocket implementation available. Pass `webSocketImpl` for non-browser hosts.");
|
|
24
|
+
}
|
|
25
|
+
const initialMs = opts.reconnectInitialMs ?? DEFAULT_INITIAL_MS;
|
|
26
|
+
const maxMs = opts.reconnectMaxMs ?? DEFAULT_MAX_MS;
|
|
27
|
+
let ws = null;
|
|
28
|
+
let active = true;
|
|
29
|
+
let backoffMs = initialMs;
|
|
30
|
+
let reconnectTimer = null;
|
|
31
|
+
const tracker = new SequenceTracker();
|
|
32
|
+
let state = {};
|
|
33
|
+
const setStatus = (status) => {
|
|
34
|
+
cb.onStatus(status);
|
|
35
|
+
};
|
|
36
|
+
const emitState = () => {
|
|
37
|
+
// Hand out a defensive shallow copy ; framework reactivity layers
|
|
38
|
+
// typically react on identity changes, not deep diffing.
|
|
39
|
+
cb.onState({ ...state });
|
|
40
|
+
};
|
|
41
|
+
const open = async () => {
|
|
42
|
+
if (!active)
|
|
43
|
+
return;
|
|
44
|
+
setStatus("connecting");
|
|
45
|
+
let token;
|
|
46
|
+
try {
|
|
47
|
+
token = typeof opts.token === "function" ? await opts.token() : opts.token;
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
cb.onError?.("auth-token-resolve", err.message, false);
|
|
51
|
+
scheduleReconnect();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!active)
|
|
55
|
+
return;
|
|
56
|
+
try {
|
|
57
|
+
ws = new Ws(opts.url, [WS_SUBPROTOCOL]);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
cb.onError?.("ws-open", err.message, false);
|
|
61
|
+
scheduleReconnect();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
ws.addEventListener("open", () => {
|
|
65
|
+
if (!ws)
|
|
66
|
+
return;
|
|
67
|
+
const frame = subscribeFrame({
|
|
68
|
+
token,
|
|
69
|
+
...(opts.scene !== undefined ? { scene: opts.scene } : {}),
|
|
70
|
+
...(opts.session !== undefined ? { session: opts.session } : {}),
|
|
71
|
+
});
|
|
72
|
+
ws.send(encodeFrame(frame));
|
|
73
|
+
});
|
|
74
|
+
ws.addEventListener("message", (event) => {
|
|
75
|
+
if (!active)
|
|
76
|
+
return;
|
|
77
|
+
let frame;
|
|
78
|
+
try {
|
|
79
|
+
const raw = typeof event.data === "string" ? event.data : "";
|
|
80
|
+
frame = decodeServerFrame(raw);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
cb.onError?.("decode", err.message, true);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (frame === null) {
|
|
87
|
+
cb.onError?.("decode", "unrecognised server frame", true);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
handleServerFrame(frame);
|
|
91
|
+
});
|
|
92
|
+
ws.addEventListener("close", () => {
|
|
93
|
+
ws = null;
|
|
94
|
+
if (!active)
|
|
95
|
+
return;
|
|
96
|
+
setStatus("disconnected");
|
|
97
|
+
scheduleReconnect();
|
|
98
|
+
});
|
|
99
|
+
ws.addEventListener("error", () => {
|
|
100
|
+
// The WS will close right after — let the close handler drive
|
|
101
|
+
// reconnect to avoid double-scheduling.
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
const handleServerFrame = (frame) => {
|
|
105
|
+
switch (frame.type) {
|
|
106
|
+
case "snapshot": {
|
|
107
|
+
// Snapshots reset the seq window — accept whatever seq.
|
|
108
|
+
tracker.reset();
|
|
109
|
+
tracker.observe(frame.seq);
|
|
110
|
+
state = { ...frame.state };
|
|
111
|
+
emitState();
|
|
112
|
+
backoffMs = initialMs;
|
|
113
|
+
setStatus("live");
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case "delta": {
|
|
117
|
+
const obs = tracker.observe(frame.seq);
|
|
118
|
+
if (obs.kind === "gap") {
|
|
119
|
+
// Sequence gap → close and let reconnect grab a fresh
|
|
120
|
+
// snapshot. Per LSDP/1 §6.
|
|
121
|
+
ws?.close(1000, "seq-gap");
|
|
122
|
+
tracker.reset();
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (obs.kind === "duplicate") {
|
|
126
|
+
// Replay — drop silently.
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
for (const p of frame.patches) {
|
|
130
|
+
state[p.path] = p.value;
|
|
131
|
+
}
|
|
132
|
+
emitState();
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case "scene_changed": {
|
|
136
|
+
// The fresh snapshot that follows is the source of truth ;
|
|
137
|
+
// we just reset our local sequence tracker.
|
|
138
|
+
tracker.reset();
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "error": {
|
|
142
|
+
cb.onError?.(frame.code, frame.message, frame.recoverable);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
case "pong":
|
|
146
|
+
default:
|
|
147
|
+
// Forward-compat : ignore unknown / housekeeping frames.
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const scheduleReconnect = () => {
|
|
152
|
+
if (!active)
|
|
153
|
+
return;
|
|
154
|
+
if (reconnectTimer)
|
|
155
|
+
return;
|
|
156
|
+
const delay = backoffMs;
|
|
157
|
+
backoffMs = Math.min(maxMs, backoffMs * 2);
|
|
158
|
+
reconnectTimer = setTimeout(() => {
|
|
159
|
+
reconnectTimer = null;
|
|
160
|
+
void open();
|
|
161
|
+
}, delay);
|
|
162
|
+
};
|
|
163
|
+
const send = (patches) => {
|
|
164
|
+
if (!active || !ws || ws.readyState !== ws.OPEN)
|
|
165
|
+
return;
|
|
166
|
+
if (patches.length === 0)
|
|
167
|
+
return;
|
|
168
|
+
const frame = inputFrame(patches);
|
|
169
|
+
ws.send(encodeFrame(frame));
|
|
170
|
+
};
|
|
171
|
+
const dispose = () => {
|
|
172
|
+
active = false;
|
|
173
|
+
if (reconnectTimer) {
|
|
174
|
+
clearTimeout(reconnectTimer);
|
|
175
|
+
reconnectTimer = null;
|
|
176
|
+
}
|
|
177
|
+
if (ws) {
|
|
178
|
+
try {
|
|
179
|
+
ws.close(1000, "dispose");
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
// ignore
|
|
183
|
+
}
|
|
184
|
+
ws = null;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
void open();
|
|
188
|
+
return { send, dispose };
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/_internal/client.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Ref, type ComputedRef } from "vue";
|
|
2
|
+
import { type ClientOptions, type LeafState, type Status } from "./_internal/client.js";
|
|
3
|
+
import type { Patch } from "@lumencast/protocol";
|
|
4
|
+
export type { LeafState, Status, ClientOptions };
|
|
5
|
+
export type { Patch } from "@lumencast/protocol";
|
|
6
|
+
/**
|
|
7
|
+
* Live Lumencast handle returned by `useLumencast()`. The two refs
|
|
8
|
+
* are reactive ; consumers read them directly in `<script setup>` or
|
|
9
|
+
* `<template>`.
|
|
10
|
+
*/
|
|
11
|
+
export interface LumencastVue {
|
|
12
|
+
/** Live leaf-state map. Keyed by canonical leaf path. */
|
|
13
|
+
readonly state: Ref<LeafState>;
|
|
14
|
+
/** Connection status — `"disconnected" | "connecting" | "live"`. */
|
|
15
|
+
readonly status: Ref<Status>;
|
|
16
|
+
/** Send one or more input patches to the server. No-op when offline. */
|
|
17
|
+
send(patches: Patch[]): void;
|
|
18
|
+
/** Tear down the connection. Idempotent. Auto-called via `onScopeDispose`. */
|
|
19
|
+
dispose(): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Composition API hook : open a long-lived Lumencast subscription.
|
|
23
|
+
*
|
|
24
|
+
* The connection auto-reconnects on close with exponential backoff.
|
|
25
|
+
* Disposal is wired to `onScopeDispose` so a component unmount cleans
|
|
26
|
+
* up automatically — but you can also call `dispose()` manually if
|
|
27
|
+
* the lifecycle is non-component (Pinia store, plugin, etc.).
|
|
28
|
+
*/
|
|
29
|
+
export declare function useLumencast(opts: ClientOptions): LumencastVue;
|
|
30
|
+
/**
|
|
31
|
+
* Convenience helper : derive a single leaf path as a `ComputedRef<T | undefined>`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useLeaf<T = unknown>(handle: LumencastVue, path: string): ComputedRef<T | undefined>;
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,OAAO,EAA6C,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAC5F,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,MAAM,EACZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AACjD,YAAY,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,wEAAwE;IACxE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAC7B,8EAA8E;IAC9E,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,CAyB9D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,EACjC,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,GACX,WAAW,CAAC,CAAC,GAAG,SAAS,CAAC,CAE5B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Public surface of @lumencast/runtime-vue.
|
|
2
|
+
//
|
|
3
|
+
// Headless Lumencast client for Vue 3 apps : connect to an LSDP/1
|
|
4
|
+
// server, expose live leaf state through Vue refs, send input
|
|
5
|
+
// patches. No DOM rendering — that's the consumer's job (you bring
|
|
6
|
+
// your own components, this brings the data).
|
|
7
|
+
//
|
|
8
|
+
// Quickstart:
|
|
9
|
+
//
|
|
10
|
+
// import { useLumencast } from "@lumencast/runtime-vue";
|
|
11
|
+
//
|
|
12
|
+
// <script setup lang="ts">
|
|
13
|
+
// const { state, status, send } = useLumencast({
|
|
14
|
+
// url: "wss://api.example.com/lsdp.v1",
|
|
15
|
+
// token: "operator-token",
|
|
16
|
+
// });
|
|
17
|
+
// </script>
|
|
18
|
+
//
|
|
19
|
+
// <template>
|
|
20
|
+
// <div>Status: {{ status }}</div>
|
|
21
|
+
// <div>Count: {{ state["count"] ?? 0 }}</div>
|
|
22
|
+
// </template>
|
|
23
|
+
import { ref, shallowRef, onScopeDispose, computed } from "vue";
|
|
24
|
+
import { createClient, } from "./_internal/client.js";
|
|
25
|
+
/**
|
|
26
|
+
* Composition API hook : open a long-lived Lumencast subscription.
|
|
27
|
+
*
|
|
28
|
+
* The connection auto-reconnects on close with exponential backoff.
|
|
29
|
+
* Disposal is wired to `onScopeDispose` so a component unmount cleans
|
|
30
|
+
* up automatically — but you can also call `dispose()` manually if
|
|
31
|
+
* the lifecycle is non-component (Pinia store, plugin, etc.).
|
|
32
|
+
*/
|
|
33
|
+
export function useLumencast(opts) {
|
|
34
|
+
const state = shallowRef({});
|
|
35
|
+
const status = ref("disconnected");
|
|
36
|
+
const client = createClient(opts, {
|
|
37
|
+
onStatus: (s) => {
|
|
38
|
+
status.value = s;
|
|
39
|
+
},
|
|
40
|
+
onState: (s) => {
|
|
41
|
+
state.value = s;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
const dispose = () => {
|
|
45
|
+
client.dispose();
|
|
46
|
+
};
|
|
47
|
+
onScopeDispose(dispose);
|
|
48
|
+
return {
|
|
49
|
+
state,
|
|
50
|
+
status,
|
|
51
|
+
send: client.send,
|
|
52
|
+
dispose,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Convenience helper : derive a single leaf path as a `ComputedRef<T | undefined>`.
|
|
57
|
+
*/
|
|
58
|
+
export function useLeaf(handle, path) {
|
|
59
|
+
return computed(() => handle.state.value[path]);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,kEAAkE;AAClE,8DAA8D;AAC9D,mEAAmE;AACnE,8CAA8C;AAC9C,EAAE;AACF,cAAc;AACd,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,6BAA6B;AAC7B,mDAAmD;AACnD,4CAA4C;AAC5C,+BAA+B;AAC/B,QAAQ;AACR,cAAc;AACd,EAAE;AACF,eAAe;AACf,sCAAsC;AACtC,kDAAkD;AAClD,gBAAgB;AAEhB,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAA8B,MAAM,KAAK,CAAC;AAC5F,OAAO,EACL,YAAY,GAIb,MAAM,uBAAuB,CAAC;AAsB/B;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,IAAmB;IAC9C,MAAM,KAAK,GAAG,UAAU,CAAY,EAAE,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,GAAG,CAAS,cAAc,CAAC,CAAC;IAE3C,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE;QAChC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;QACnB,CAAC;QACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;QAClB,CAAC;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC,CAAC;IAEF,cAAc,CAAC,OAAO,CAAC,CAAC;IAExB,OAAO;QACL,KAAK;QACL,MAAM;QACN,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO;KACR,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CACrB,MAAoB,EACpB,IAAY;IAEZ,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAkB,CAAC,CAAC;AACnE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lumencast/runtime-vue",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Headless Vue 3 adapter for Lumencast — live LSDP/1 leaf state as Vue refs.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://github.com/Lumencast/lumencast-js/tree/main/packages/runtime-vue",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/Lumencast/lumencast-js.git",
|
|
24
|
+
"directory": "packages/runtime-vue"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=22"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"registry": "https://registry.npmjs.org/"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@lumencast/protocol": "0.1.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"vue": ">=3.4.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^22.10.0",
|
|
41
|
+
"vue": "^3.5.0",
|
|
42
|
+
"typescript": "^5.7.0",
|
|
43
|
+
"vitest": "^4.0.0"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc -b",
|
|
47
|
+
"typecheck": "tsc -b --pretty",
|
|
48
|
+
"test": "vitest run"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// Minimal LSDP/1 client used by the Svelte adapter.
|
|
2
|
+
//
|
|
3
|
+
// Headless — no DOM, no rendering. Exposes a small surface :
|
|
4
|
+
// - subscribe via the lsdp.v1 WebSocket subprotocol
|
|
5
|
+
// - apply incoming snapshot/delta frames into a leaf-state map
|
|
6
|
+
// - reconnect with exponential backoff on close
|
|
7
|
+
// - send input frames
|
|
8
|
+
//
|
|
9
|
+
// Sibling of @lumencast/runtime's transport layer, but stripped to the
|
|
10
|
+
// pieces a framework adapter needs. Reuses @lumencast/protocol for
|
|
11
|
+
// codec + sequence tracking ; we just orchestrate.
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
WS_SUBPROTOCOL,
|
|
15
|
+
decodeServerFrame,
|
|
16
|
+
encodeFrame,
|
|
17
|
+
SequenceTracker,
|
|
18
|
+
input as inputFrame,
|
|
19
|
+
subscribe as subscribeFrame,
|
|
20
|
+
type ClientFrame,
|
|
21
|
+
type Patch,
|
|
22
|
+
type ServerFrame,
|
|
23
|
+
} from "@lumencast/protocol";
|
|
24
|
+
|
|
25
|
+
/** Connection status reported to the host. */
|
|
26
|
+
export type Status = "disconnected" | "connecting" | "live";
|
|
27
|
+
|
|
28
|
+
/** A single bag of named values keyed by leaf path. */
|
|
29
|
+
export type LeafState = Record<string, unknown>;
|
|
30
|
+
|
|
31
|
+
export interface ClientOptions {
|
|
32
|
+
/** WebSocket URL (must be ws:// or wss:// and end at the LSDP endpoint). */
|
|
33
|
+
url: string;
|
|
34
|
+
/** Authentication token, async-resolvable. */
|
|
35
|
+
token: string | (() => Promise<string>);
|
|
36
|
+
/** Optional scene name (test mode). */
|
|
37
|
+
scene?: string;
|
|
38
|
+
/** Optional session identifier (test-mode harness). */
|
|
39
|
+
session?: string;
|
|
40
|
+
/** Override WebSocket constructor (for tests / non-browser hosts). */
|
|
41
|
+
webSocketImpl?: typeof WebSocket;
|
|
42
|
+
/** Initial reconnect delay in ms. Doubled per attempt up to 30 s. */
|
|
43
|
+
reconnectInitialMs?: number;
|
|
44
|
+
/** Cap on the reconnect delay. */
|
|
45
|
+
reconnectMaxMs?: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ClientCallbacks {
|
|
49
|
+
onStatus: (status: Status) => void;
|
|
50
|
+
/** Called whenever the leaf state changes — receives a fresh defensive copy. */
|
|
51
|
+
onState: (state: LeafState) => void;
|
|
52
|
+
/** Called on every error frame from the server. */
|
|
53
|
+
onError?: (code: string, message: string, recoverable: boolean) => void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Headless client handle — used by framework adapters to drive reactivity. */
|
|
57
|
+
export interface Client {
|
|
58
|
+
/** Send an `input` frame. Patches are forwarded as-is. */
|
|
59
|
+
send(patches: Patch[]): void;
|
|
60
|
+
/** Cleanly close the connection — no further callbacks fire. */
|
|
61
|
+
dispose(): void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const DEFAULT_INITIAL_MS = 500;
|
|
65
|
+
const DEFAULT_MAX_MS = 30_000;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Open a long-lived LSDP/1 subscription. Returns a `Client` handle.
|
|
69
|
+
* Status callbacks fire synchronously on every transition ; state
|
|
70
|
+
* callbacks fire after every snapshot / delta.
|
|
71
|
+
*/
|
|
72
|
+
export function createClient(opts: ClientOptions, cb: ClientCallbacks): Client {
|
|
73
|
+
const Ws = opts.webSocketImpl ?? globalThis.WebSocket;
|
|
74
|
+
if (!Ws) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
"@lumencast/runtime-*: no WebSocket implementation available. Pass `webSocketImpl` for non-browser hosts.",
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
const initialMs = opts.reconnectInitialMs ?? DEFAULT_INITIAL_MS;
|
|
80
|
+
const maxMs = opts.reconnectMaxMs ?? DEFAULT_MAX_MS;
|
|
81
|
+
|
|
82
|
+
let ws: WebSocket | null = null;
|
|
83
|
+
let active = true;
|
|
84
|
+
let backoffMs = initialMs;
|
|
85
|
+
let reconnectTimer: ReturnType<typeof setTimeout> | null = null;
|
|
86
|
+
|
|
87
|
+
const tracker = new SequenceTracker();
|
|
88
|
+
let state: LeafState = {};
|
|
89
|
+
|
|
90
|
+
const setStatus = (status: Status): void => {
|
|
91
|
+
cb.onStatus(status);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const emitState = (): void => {
|
|
95
|
+
// Hand out a defensive shallow copy ; framework reactivity layers
|
|
96
|
+
// typically react on identity changes, not deep diffing.
|
|
97
|
+
cb.onState({ ...state });
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const open = async (): Promise<void> => {
|
|
101
|
+
if (!active) return;
|
|
102
|
+
setStatus("connecting");
|
|
103
|
+
|
|
104
|
+
let token: string;
|
|
105
|
+
try {
|
|
106
|
+
token = typeof opts.token === "function" ? await opts.token() : opts.token;
|
|
107
|
+
} catch (err) {
|
|
108
|
+
cb.onError?.("auth-token-resolve", (err as Error).message, false);
|
|
109
|
+
scheduleReconnect();
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (!active) return;
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
ws = new Ws(opts.url, [WS_SUBPROTOCOL]);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
cb.onError?.("ws-open", (err as Error).message, false);
|
|
118
|
+
scheduleReconnect();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
ws.addEventListener("open", () => {
|
|
123
|
+
if (!ws) return;
|
|
124
|
+
const frame: ClientFrame = subscribeFrame({
|
|
125
|
+
token,
|
|
126
|
+
...(opts.scene !== undefined ? { scene: opts.scene } : {}),
|
|
127
|
+
...(opts.session !== undefined ? { session: opts.session } : {}),
|
|
128
|
+
});
|
|
129
|
+
ws.send(encodeFrame(frame));
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
ws.addEventListener("message", (event: MessageEvent) => {
|
|
133
|
+
if (!active) return;
|
|
134
|
+
let frame: ServerFrame | null;
|
|
135
|
+
try {
|
|
136
|
+
const raw = typeof event.data === "string" ? event.data : "";
|
|
137
|
+
frame = decodeServerFrame(raw);
|
|
138
|
+
} catch (err) {
|
|
139
|
+
cb.onError?.("decode", (err as Error).message, true);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (frame === null) {
|
|
143
|
+
cb.onError?.("decode", "unrecognised server frame", true);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
handleServerFrame(frame);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
ws.addEventListener("close", () => {
|
|
150
|
+
ws = null;
|
|
151
|
+
if (!active) return;
|
|
152
|
+
setStatus("disconnected");
|
|
153
|
+
scheduleReconnect();
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
ws.addEventListener("error", () => {
|
|
157
|
+
// The WS will close right after — let the close handler drive
|
|
158
|
+
// reconnect to avoid double-scheduling.
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const handleServerFrame = (frame: ServerFrame): void => {
|
|
163
|
+
switch (frame.type) {
|
|
164
|
+
case "snapshot": {
|
|
165
|
+
// Snapshots reset the seq window — accept whatever seq.
|
|
166
|
+
tracker.reset();
|
|
167
|
+
tracker.observe(frame.seq);
|
|
168
|
+
state = { ...frame.state };
|
|
169
|
+
emitState();
|
|
170
|
+
backoffMs = initialMs;
|
|
171
|
+
setStatus("live");
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case "delta": {
|
|
175
|
+
const obs = tracker.observe(frame.seq);
|
|
176
|
+
if (obs.kind === "gap") {
|
|
177
|
+
// Sequence gap → close and let reconnect grab a fresh
|
|
178
|
+
// snapshot. Per LSDP/1 §6.
|
|
179
|
+
ws?.close(1000, "seq-gap");
|
|
180
|
+
tracker.reset();
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (obs.kind === "duplicate") {
|
|
184
|
+
// Replay — drop silently.
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
for (const p of frame.patches) {
|
|
188
|
+
state[p.path] = p.value;
|
|
189
|
+
}
|
|
190
|
+
emitState();
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
case "scene_changed": {
|
|
194
|
+
// The fresh snapshot that follows is the source of truth ;
|
|
195
|
+
// we just reset our local sequence tracker.
|
|
196
|
+
tracker.reset();
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case "error": {
|
|
200
|
+
cb.onError?.(frame.code, frame.message, frame.recoverable);
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
case "pong":
|
|
204
|
+
default:
|
|
205
|
+
// Forward-compat : ignore unknown / housekeeping frames.
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const scheduleReconnect = (): void => {
|
|
211
|
+
if (!active) return;
|
|
212
|
+
if (reconnectTimer) return;
|
|
213
|
+
const delay = backoffMs;
|
|
214
|
+
backoffMs = Math.min(maxMs, backoffMs * 2);
|
|
215
|
+
reconnectTimer = setTimeout(() => {
|
|
216
|
+
reconnectTimer = null;
|
|
217
|
+
void open();
|
|
218
|
+
}, delay);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const send = (patches: Patch[]): void => {
|
|
222
|
+
if (!active || !ws || ws.readyState !== ws.OPEN) return;
|
|
223
|
+
if (patches.length === 0) return;
|
|
224
|
+
const frame: ClientFrame = inputFrame(patches);
|
|
225
|
+
ws.send(encodeFrame(frame));
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const dispose = (): void => {
|
|
229
|
+
active = false;
|
|
230
|
+
if (reconnectTimer) {
|
|
231
|
+
clearTimeout(reconnectTimer);
|
|
232
|
+
reconnectTimer = null;
|
|
233
|
+
}
|
|
234
|
+
if (ws) {
|
|
235
|
+
try {
|
|
236
|
+
ws.close(1000, "dispose");
|
|
237
|
+
} catch {
|
|
238
|
+
// ignore
|
|
239
|
+
}
|
|
240
|
+
ws = null;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
void open();
|
|
245
|
+
return { send, dispose };
|
|
246
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Public surface of @lumencast/runtime-vue.
|
|
2
|
+
//
|
|
3
|
+
// Headless Lumencast client for Vue 3 apps : connect to an LSDP/1
|
|
4
|
+
// server, expose live leaf state through Vue refs, send input
|
|
5
|
+
// patches. No DOM rendering — that's the consumer's job (you bring
|
|
6
|
+
// your own components, this brings the data).
|
|
7
|
+
//
|
|
8
|
+
// Quickstart:
|
|
9
|
+
//
|
|
10
|
+
// import { useLumencast } from "@lumencast/runtime-vue";
|
|
11
|
+
//
|
|
12
|
+
// <script setup lang="ts">
|
|
13
|
+
// const { state, status, send } = useLumencast({
|
|
14
|
+
// url: "wss://api.example.com/lsdp.v1",
|
|
15
|
+
// token: "operator-token",
|
|
16
|
+
// });
|
|
17
|
+
// </script>
|
|
18
|
+
//
|
|
19
|
+
// <template>
|
|
20
|
+
// <div>Status: {{ status }}</div>
|
|
21
|
+
// <div>Count: {{ state["count"] ?? 0 }}</div>
|
|
22
|
+
// </template>
|
|
23
|
+
|
|
24
|
+
import { ref, shallowRef, onScopeDispose, computed, type Ref, type ComputedRef } from "vue";
|
|
25
|
+
import {
|
|
26
|
+
createClient,
|
|
27
|
+
type ClientOptions,
|
|
28
|
+
type LeafState,
|
|
29
|
+
type Status,
|
|
30
|
+
} from "./_internal/client.js";
|
|
31
|
+
import type { Patch } from "@lumencast/protocol";
|
|
32
|
+
|
|
33
|
+
export type { LeafState, Status, ClientOptions };
|
|
34
|
+
export type { Patch } from "@lumencast/protocol";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Live Lumencast handle returned by `useLumencast()`. The two refs
|
|
38
|
+
* are reactive ; consumers read them directly in `<script setup>` or
|
|
39
|
+
* `<template>`.
|
|
40
|
+
*/
|
|
41
|
+
export interface LumencastVue {
|
|
42
|
+
/** Live leaf-state map. Keyed by canonical leaf path. */
|
|
43
|
+
readonly state: Ref<LeafState>;
|
|
44
|
+
/** Connection status — `"disconnected" | "connecting" | "live"`. */
|
|
45
|
+
readonly status: Ref<Status>;
|
|
46
|
+
/** Send one or more input patches to the server. No-op when offline. */
|
|
47
|
+
send(patches: Patch[]): void;
|
|
48
|
+
/** Tear down the connection. Idempotent. Auto-called via `onScopeDispose`. */
|
|
49
|
+
dispose(): void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Composition API hook : open a long-lived Lumencast subscription.
|
|
54
|
+
*
|
|
55
|
+
* The connection auto-reconnects on close with exponential backoff.
|
|
56
|
+
* Disposal is wired to `onScopeDispose` so a component unmount cleans
|
|
57
|
+
* up automatically — but you can also call `dispose()` manually if
|
|
58
|
+
* the lifecycle is non-component (Pinia store, plugin, etc.).
|
|
59
|
+
*/
|
|
60
|
+
export function useLumencast(opts: ClientOptions): LumencastVue {
|
|
61
|
+
const state = shallowRef<LeafState>({});
|
|
62
|
+
const status = ref<Status>("disconnected");
|
|
63
|
+
|
|
64
|
+
const client = createClient(opts, {
|
|
65
|
+
onStatus: (s) => {
|
|
66
|
+
status.value = s;
|
|
67
|
+
},
|
|
68
|
+
onState: (s) => {
|
|
69
|
+
state.value = s;
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const dispose = (): void => {
|
|
74
|
+
client.dispose();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
onScopeDispose(dispose);
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
state,
|
|
81
|
+
status,
|
|
82
|
+
send: client.send,
|
|
83
|
+
dispose,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Convenience helper : derive a single leaf path as a `ComputedRef<T | undefined>`.
|
|
89
|
+
*/
|
|
90
|
+
export function useLeaf<T = unknown>(
|
|
91
|
+
handle: LumencastVue,
|
|
92
|
+
path: string,
|
|
93
|
+
): ComputedRef<T | undefined> {
|
|
94
|
+
return computed(() => handle.state.value[path] as T | undefined);
|
|
95
|
+
}
|