dsh-live-voice-debugger 0.0.0-stage → 0.3.2
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/ARCHITECTURE.md +9 -0
- package/LICENSE +201 -0
- package/cordis.patch.yml +3 -0
- package/lib/client.js +500 -0
- package/lib/server.js +8 -0
- package/package.json +43 -4
- package/README.md +0 -3
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Live Voice Debugger
|
|
2
|
+
|
|
3
|
+
This public, optional client plugin builds separately from Live Voice. It contributes an optional Developer tab inside the existing Live Voice Settings and opens a separate browser window containing the React inspector only after explicit activation. Its runtime boundary is the versioned read-only diagnostic source published by the main plugin, not coordinator imports. It supports either plugin load order and source replacement/removal.
|
|
4
|
+
|
|
5
|
+
The panel samples current state at a selectable 1, 2, 5, 10 or 20 Hz (default 10). State and event panes scroll independently. Event recording can be paused independently from live state sampling and the entire event history can be cleared. Resuming recording starts from the current baseline without replaying changes that occurred while paused. Changing the sampling rate preserves the history. While connected, coordinator notifications produce a bounded 200-entry state-difference history filterable by module. This is an initial inspector, not a complete semantic event logger: changes hidden inside an adapter can only be sampled, and native recognition internals remain unavailable. No audio is retained. Free-form text is hidden by default and can be inspected explicitly in memory, never persisted. Closing the panel releases subscriptions and timers.
|
|
6
|
+
|
|
7
|
+
Build from the repository root with `pnpm build`, or build this package with `pnpm --filter dsh-live-voice-debugger build`. The generated client/server entries land in lib, not in the main client bundle. For local installation, add the packages/live-voice-debugger directory as a separate DSH plugin using the supported plugin manager; both the main plugin's diagnostic bridge and this plugin must be loaded. Then open Settings → Live Voice → Developer and open the separate inspector window (allow site popups if blocked). Publication is explicit through the npm workflow. Configure npm Trusted Publishing for this package with workflow publish.yml and environment npm. Select the debugger-only target when the aligned main version already exists. Publishing both packages is sequential, not atomic.
|
|
8
|
+
|
|
9
|
+
Tests deliver simulated activity, processing and final results through the real coordinator callback boundary; PCM chunks are supplied through the HTTP adapter's fake Web Audio input. They assert the same diagnostic projection that the panel reads. The panel itself never injects test events into live capture or playback.
|
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 reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and 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 choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your 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 wads.dev
|
|
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/cordis.patch.yml
ADDED
package/lib/client.js
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({id:"dsh-live-voice-debugger",factory:(require)=>{var module={exports:{}};var exports=module.exports;
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/apply.tsx
|
|
31
|
+
var apply_exports = {};
|
|
32
|
+
__export(apply_exports, {
|
|
33
|
+
apply: () => apply,
|
|
34
|
+
inject: () => inject
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(apply_exports);
|
|
37
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
38
|
+
var import_client = require("react-dom/client");
|
|
39
|
+
|
|
40
|
+
// src/DebuggerPanel.tsx
|
|
41
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
42
|
+
|
|
43
|
+
// ../live-voice/src/modules/core/diagnostics.ts
|
|
44
|
+
var DIAGNOSTIC_KEY = /* @__PURE__ */ Symbol.for("dsh-live-voice.diagnostics.v1");
|
|
45
|
+
var DIAGNOSTIC_CHANGED = "dsh-live-voice:diagnostics-changed";
|
|
46
|
+
|
|
47
|
+
// src/inspector.ts
|
|
48
|
+
function createInspector(source, now = Date.now, limit = 200) {
|
|
49
|
+
let previous = null;
|
|
50
|
+
let sequence = 0;
|
|
51
|
+
let paused = false;
|
|
52
|
+
let entries = [];
|
|
53
|
+
function record() {
|
|
54
|
+
const next = source.read();
|
|
55
|
+
if (paused) {
|
|
56
|
+
previous = next;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
for (const [sessionId, session] of Object.entries(next?.sessions ?? {})) {
|
|
60
|
+
for (const [module2, value] of Object.entries(session)) {
|
|
61
|
+
const normalized = module2 === "capture" ? { ...value, level: null } : value;
|
|
62
|
+
const old = previous?.sessions?.[sessionId]?.[module2];
|
|
63
|
+
const before = module2 === "capture" && old ? { ...old, level: null } : old;
|
|
64
|
+
if (previous && JSON.stringify(before) !== JSON.stringify(normalized)) {
|
|
65
|
+
entries.push({
|
|
66
|
+
sequence: ++sequence,
|
|
67
|
+
timeMs: now(),
|
|
68
|
+
sessionId,
|
|
69
|
+
module: module2,
|
|
70
|
+
level: module2 === "error" && value?.present ? "error" : "debug",
|
|
71
|
+
before: before ?? null,
|
|
72
|
+
after: normalized
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
entries = entries.slice(-Math.max(1, limit));
|
|
78
|
+
previous = next;
|
|
79
|
+
}
|
|
80
|
+
record();
|
|
81
|
+
const unsubscribe = source.subscribe(() => {
|
|
82
|
+
try {
|
|
83
|
+
record();
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
read(includeContent = false) {
|
|
89
|
+
record();
|
|
90
|
+
return { state: source.read({ includeContent }), transitions: [...entries] };
|
|
91
|
+
},
|
|
92
|
+
setPaused(value) {
|
|
93
|
+
previous = source.read();
|
|
94
|
+
paused = value;
|
|
95
|
+
},
|
|
96
|
+
clear() {
|
|
97
|
+
previous = source.read();
|
|
98
|
+
entries = [];
|
|
99
|
+
},
|
|
100
|
+
dispose() {
|
|
101
|
+
unsubscribe();
|
|
102
|
+
previous = null;
|
|
103
|
+
entries = [];
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/StateTree.tsx
|
|
109
|
+
var import_react = __toESM(require("react"), 1);
|
|
110
|
+
function StateTree({
|
|
111
|
+
name,
|
|
112
|
+
value,
|
|
113
|
+
omitted,
|
|
114
|
+
depth = 0
|
|
115
|
+
}) {
|
|
116
|
+
if (value === null || typeof value !== "object")
|
|
117
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "dlvd-leaf" }, /* @__PURE__ */ import_react.default.createElement("code", null, name), /* @__PURE__ */ import_react.default.createElement("span", { "data-kind": typeof value }, String(value)));
|
|
118
|
+
const entries = Object.entries(value);
|
|
119
|
+
return /* @__PURE__ */ import_react.default.createElement("details", { className: "dlvd-branch", open: depth < 3 }, /* @__PURE__ */ import_react.default.createElement("summary", null, /* @__PURE__ */ import_react.default.createElement("code", null, name), /* @__PURE__ */ import_react.default.createElement("small", null, Array.isArray(value) ? "[" + entries.length + "]" : "{" + entries.length + "}")), entries.slice(0, 100).map(([key, child]) => /* @__PURE__ */ import_react.default.createElement(StateTree, { key, name: key, value: child, omitted, depth: depth + 1 })), entries.length > 100 && /* @__PURE__ */ import_react.default.createElement("p", null, omitted));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/DebuggerPanel.tsx
|
|
123
|
+
function DebuggerPanel({
|
|
124
|
+
copy,
|
|
125
|
+
onClose,
|
|
126
|
+
target = window
|
|
127
|
+
}) {
|
|
128
|
+
const [frozen, setFrozen] = import_react2.default.useState(false);
|
|
129
|
+
const [refreshHz, setRefreshHz] = import_react2.default.useState(10);
|
|
130
|
+
const updateRef = import_react2.default.useRef(null);
|
|
131
|
+
const [content, setContent] = import_react2.default.useState(false);
|
|
132
|
+
const [module2, setModule] = import_react2.default.useState("");
|
|
133
|
+
const [view, setView] = import_react2.default.useState(null);
|
|
134
|
+
const [failed, setFailed] = import_react2.default.useState(false);
|
|
135
|
+
const [eventsPaused, setEventsPaused] = import_react2.default.useState(false);
|
|
136
|
+
const pausedRef = import_react2.default.useRef(false);
|
|
137
|
+
const inspectorRef = import_react2.default.useRef(null);
|
|
138
|
+
import_react2.default.useEffect(() => {
|
|
139
|
+
if (frozen) return;
|
|
140
|
+
let inspector = null;
|
|
141
|
+
let source = null;
|
|
142
|
+
const update = () => {
|
|
143
|
+
try {
|
|
144
|
+
const next = target[DIAGNOSTIC_KEY];
|
|
145
|
+
if (next !== source) {
|
|
146
|
+
inspector?.dispose();
|
|
147
|
+
inspector = null;
|
|
148
|
+
source = next?.version === 1 ? next : null;
|
|
149
|
+
if (source) {
|
|
150
|
+
inspector = createInspector(source);
|
|
151
|
+
inspector.setPaused(pausedRef.current);
|
|
152
|
+
}
|
|
153
|
+
inspectorRef.current = inspector;
|
|
154
|
+
}
|
|
155
|
+
setView(inspector?.read(content) ?? null);
|
|
156
|
+
setFailed(false);
|
|
157
|
+
} catch {
|
|
158
|
+
setFailed(true);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
update();
|
|
162
|
+
updateRef.current = update;
|
|
163
|
+
target.addEventListener(DIAGNOSTIC_CHANGED, update);
|
|
164
|
+
return () => {
|
|
165
|
+
updateRef.current = null;
|
|
166
|
+
target.removeEventListener(DIAGNOSTIC_CHANGED, update);
|
|
167
|
+
inspector?.dispose();
|
|
168
|
+
inspectorRef.current = null;
|
|
169
|
+
};
|
|
170
|
+
}, [frozen, content, target]);
|
|
171
|
+
import_react2.default.useEffect(() => {
|
|
172
|
+
if (frozen) return;
|
|
173
|
+
const timer = setInterval(() => updateRef.current?.(), 1e3 / refreshHz);
|
|
174
|
+
return () => clearInterval(timer);
|
|
175
|
+
}, [frozen, refreshHz]);
|
|
176
|
+
const modules = [...new Set(view?.transitions.map((entry) => entry.module) ?? [])].sort();
|
|
177
|
+
return /* @__PURE__ */ import_react2.default.createElement("aside", { className: "dlvd-panel", "aria-label": copy.title }, /* @__PURE__ */ import_react2.default.createElement("header", null, /* @__PURE__ */ import_react2.default.createElement("strong", null, copy.title), /* @__PURE__ */ import_react2.default.createElement("span", null, refreshHz, " Hz"), /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", onClick: onClose, "aria-label": copy.close }, "\xD7")), /* @__PURE__ */ import_react2.default.createElement("p", null, copy.help), /* @__PURE__ */ import_react2.default.createElement("div", { className: "dlvd-toolbar" }, /* @__PURE__ */ import_react2.default.createElement("label", null, copy.refreshRate, /* @__PURE__ */ import_react2.default.createElement("select", { value: refreshHz, onChange: (event) => setRefreshHz(Number(event.target.value)) }, [1, 2, 5, 10, 20].map((hz) => /* @__PURE__ */ import_react2.default.createElement("option", { key: hz, value: hz }, hz, " Hz")))), /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", onClick: () => setFrozen(!frozen) }, frozen ? copy.resume : copy.freeze), /* @__PURE__ */ import_react2.default.createElement("label", null, /* @__PURE__ */ import_react2.default.createElement(
|
|
178
|
+
"input",
|
|
179
|
+
{
|
|
180
|
+
type: "checkbox",
|
|
181
|
+
checked: content,
|
|
182
|
+
onChange: (event) => {
|
|
183
|
+
setView(null);
|
|
184
|
+
setFrozen(false);
|
|
185
|
+
setContent(event.target.checked);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
), copy.content)), failed ? /* @__PURE__ */ import_react2.default.createElement("p", { role: "alert" }, copy.error) : !view ? /* @__PURE__ */ import_react2.default.createElement("p", { role: "status" }, copy.waiting) : /* @__PURE__ */ import_react2.default.createElement("div", { className: "dlvd-columns" }, /* @__PURE__ */ import_react2.default.createElement("section", { className: "dlvd-state-pane", "aria-label": copy.states }, /* @__PURE__ */ import_react2.default.createElement("h3", null, copy.states), /* @__PURE__ */ import_react2.default.createElement("div", { className: "dlvd-scroll", tabIndex: 0 }, /* @__PURE__ */ import_react2.default.createElement(StateTree, { name: "context", value: view.state, omitted: copy.omitted }))), /* @__PURE__ */ import_react2.default.createElement("section", { className: "dlvd-event-pane", "aria-label": copy.transitions }, /* @__PURE__ */ import_react2.default.createElement("h3", null, copy.transitions), /* @__PURE__ */ import_react2.default.createElement("div", { className: "dlvd-toolbar" }, /* @__PURE__ */ import_react2.default.createElement(
|
|
189
|
+
"button",
|
|
190
|
+
{
|
|
191
|
+
type: "button",
|
|
192
|
+
"aria-pressed": eventsPaused,
|
|
193
|
+
onClick: () => {
|
|
194
|
+
const paused = !eventsPaused;
|
|
195
|
+
inspectorRef.current?.setPaused(paused);
|
|
196
|
+
pausedRef.current = paused;
|
|
197
|
+
setEventsPaused(paused);
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
eventsPaused ? copy.eventsResume : copy.eventsPause
|
|
201
|
+
), /* @__PURE__ */ import_react2.default.createElement(
|
|
202
|
+
"button",
|
|
203
|
+
{
|
|
204
|
+
type: "button",
|
|
205
|
+
onClick: () => {
|
|
206
|
+
inspectorRef.current?.clear();
|
|
207
|
+
setView((current) => current ? { ...current, transitions: [] } : current);
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
copy.eventsClear
|
|
211
|
+
)), /* @__PURE__ */ import_react2.default.createElement("label", null, copy.filter, /* @__PURE__ */ import_react2.default.createElement("select", { value: module2, onChange: (event) => setModule(event.target.value) }, /* @__PURE__ */ import_react2.default.createElement("option", { value: "" }, copy.all), modules.map((name) => /* @__PURE__ */ import_react2.default.createElement("option", { key: name }, name)))), /* @__PURE__ */ import_react2.default.createElement("div", { className: "dlvd-history dlvd-scroll", tabIndex: 0 }, view.transitions.filter((entry) => !module2 || entry.module === module2).slice().reverse().map((entry) => /* @__PURE__ */ import_react2.default.createElement("details", { key: entry.sequence, "data-level": entry.level }, /* @__PURE__ */ import_react2.default.createElement("summary", null, /* @__PURE__ */ import_react2.default.createElement("small", null, new Date(entry.timeMs).toLocaleTimeString()), " ", /* @__PURE__ */ import_react2.default.createElement("code", null, entry.sessionId, " / ", entry.module)), /* @__PURE__ */ import_react2.default.createElement(StateTree, { name: "before", value: entry.before, omitted: copy.omitted }), /* @__PURE__ */ import_react2.default.createElement(StateTree, { name: "after", value: entry.after, omitted: copy.omitted }))), !view.transitions.length && /* @__PURE__ */ import_react2.default.createElement("p", null, copy.empty)))));
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/locales.ts
|
|
215
|
+
var namespace = "dsh-live-voice-debugger";
|
|
216
|
+
var dictionaries = {
|
|
217
|
+
en: {
|
|
218
|
+
activate: "Open debugger in a separate window",
|
|
219
|
+
all: "All modules",
|
|
220
|
+
close: "Close debugger",
|
|
221
|
+
content: "Inspect text content (sensitive)",
|
|
222
|
+
developer: "Developer",
|
|
223
|
+
empty: "No transitions recorded yet.",
|
|
224
|
+
error: "Diagnostic source failed.",
|
|
225
|
+
eventsClear: "Clear events",
|
|
226
|
+
eventsPause: "Pause events",
|
|
227
|
+
eventsResume: "Resume events",
|
|
228
|
+
filter: "Filter modules",
|
|
229
|
+
freeze: "Freeze view",
|
|
230
|
+
help: "Read-only state tree updated at 10 Hz. Text is hidden by default. This panel does not control voice.",
|
|
231
|
+
omitted: "Additional items omitted",
|
|
232
|
+
popupBlocked: "The browser blocked the debugger window. Allow popups for this site and try again.",
|
|
233
|
+
refreshRate: "Refresh rate",
|
|
234
|
+
resume: "Resume updates",
|
|
235
|
+
states: "Current states",
|
|
236
|
+
title: "Live Voice Debugger",
|
|
237
|
+
transitions: "Recent state transitions",
|
|
238
|
+
waiting: "Waiting for a compatible Live Voice runtime."
|
|
239
|
+
},
|
|
240
|
+
"pt-BR": {
|
|
241
|
+
activate: "Abrir debugger em janela separada",
|
|
242
|
+
all: "Todos os m\xF3dulos",
|
|
243
|
+
close: "Fechar debugger",
|
|
244
|
+
content: "Inspecionar conte\xFAdo de texto (sens\xEDvel)",
|
|
245
|
+
developer: "Desenvolvedor",
|
|
246
|
+
empty: "Nenhuma transi\xE7\xE3o registrada ainda.",
|
|
247
|
+
error: "A fonte de diagn\xF3stico falhou.",
|
|
248
|
+
eventsClear: "Limpar eventos",
|
|
249
|
+
eventsPause: "Pausar eventos",
|
|
250
|
+
eventsResume: "Retomar eventos",
|
|
251
|
+
filter: "Filtrar m\xF3dulos",
|
|
252
|
+
freeze: "Congelar visualiza\xE7\xE3o",
|
|
253
|
+
help: "\xC1rvore de estados somente leitura atualizada a 10 Hz. Texto oculto por padr\xE3o. Este painel n\xE3o controla a voz.",
|
|
254
|
+
omitted: "Itens adicionais omitidos",
|
|
255
|
+
popupBlocked: "O navegador bloqueou a janela do debugger. Permita pop-ups neste site e tente novamente.",
|
|
256
|
+
refreshRate: "Frequ\xEAncia de atualiza\xE7\xE3o",
|
|
257
|
+
resume: "Retomar atualiza\xE7\xF5es",
|
|
258
|
+
states: "Estados atuais",
|
|
259
|
+
title: "Depurador Live Voice",
|
|
260
|
+
transitions: "Transi\xE7\xF5es de estado recentes",
|
|
261
|
+
waiting: "Aguardando um runtime Live Voice compat\xEDvel."
|
|
262
|
+
},
|
|
263
|
+
es: {
|
|
264
|
+
activate: "Abrir depurador en una ventana separada",
|
|
265
|
+
all: "Todos los m\xF3dulos",
|
|
266
|
+
close: "Cerrar depurador",
|
|
267
|
+
content: "Inspeccionar contenido de texto (sensible)",
|
|
268
|
+
developer: "Desarrollador",
|
|
269
|
+
empty: "Todav\xEDa no hay transiciones registradas.",
|
|
270
|
+
error: "La fuente de diagn\xF3stico fall\xF3.",
|
|
271
|
+
eventsClear: "Borrar eventos",
|
|
272
|
+
eventsPause: "Pausar eventos",
|
|
273
|
+
eventsResume: "Reanudar eventos",
|
|
274
|
+
filter: "Filtrar m\xF3dulos",
|
|
275
|
+
freeze: "Congelar vista",
|
|
276
|
+
help: "\xC1rbol de estados de solo lectura actualizado a 10 Hz. Texto oculto por defecto. Este panel no controla la voz.",
|
|
277
|
+
omitted: "Elementos adicionales omitidos",
|
|
278
|
+
popupBlocked: "El navegador bloque\xF3 la ventana del depurador. Permita ventanas emergentes en este sitio e int\xE9ntelo de nuevo.",
|
|
279
|
+
refreshRate: "Frecuencia de actualizaci\xF3n",
|
|
280
|
+
resume: "Reanudar actualizaciones",
|
|
281
|
+
states: "Estados actuales",
|
|
282
|
+
title: "Depurador Live Voice",
|
|
283
|
+
transitions: "Transiciones de estado recientes",
|
|
284
|
+
waiting: "Esperando un runtime Live Voice compatible."
|
|
285
|
+
},
|
|
286
|
+
fr: {
|
|
287
|
+
activate: "Ouvrir le d\xE9bogueur dans une fen\xEAtre s\xE9par\xE9e",
|
|
288
|
+
all: "Tous les modules",
|
|
289
|
+
close: "Fermer le d\xE9bogueur",
|
|
290
|
+
content: "Inspecter le texte (sensible)",
|
|
291
|
+
developer: "D\xE9veloppeur",
|
|
292
|
+
empty: "Aucune transition enregistr\xE9e.",
|
|
293
|
+
error: "La source de diagnostic a \xE9chou\xE9.",
|
|
294
|
+
eventsClear: "Effacer les \xE9v\xE9nements",
|
|
295
|
+
eventsPause: "Suspendre les \xE9v\xE9nements",
|
|
296
|
+
eventsResume: "Reprendre les \xE9v\xE9nements",
|
|
297
|
+
filter: "Filtrer les modules",
|
|
298
|
+
freeze: "Figer la vue",
|
|
299
|
+
help: "Arbre des \xE9tats en lecture seule actualis\xE9 \xE0 10 Hz. Texte masqu\xE9 par d\xE9faut. Ce panneau ne contr\xF4le pas la voix.",
|
|
300
|
+
omitted: "\xC9l\xE9ments suppl\xE9mentaires masqu\xE9s",
|
|
301
|
+
popupBlocked: "Le navigateur a bloqu\xE9 la fen\xEAtre du d\xE9bogueur. Autorisez les fen\xEAtres contextuelles pour ce site et r\xE9essayez.",
|
|
302
|
+
refreshRate: "Fr\xE9quence de mise \xE0 jour",
|
|
303
|
+
resume: "Reprendre les mises \xE0 jour",
|
|
304
|
+
states: "\xC9tats actuels",
|
|
305
|
+
title: "D\xE9bogueur Live Voice",
|
|
306
|
+
transitions: "Transitions r\xE9centes des \xE9tats",
|
|
307
|
+
waiting: "En attente d\u2019un runtime Live Voice compatible."
|
|
308
|
+
},
|
|
309
|
+
hi: {
|
|
310
|
+
activate: "\u0921\u0940\u092C\u0917\u0930 \u0905\u0932\u0917 \u0935\u093F\u0902\u0921\u094B \u092E\u0947\u0902 \u0916\u094B\u0932\u0947\u0902",
|
|
311
|
+
all: "\u0938\u092D\u0940 \u092E\u0949\u0921\u094D\u092F\u0942\u0932",
|
|
312
|
+
close: "\u0921\u0940\u092C\u0917\u0930 \u092C\u0902\u0926 \u0915\u0930\u0947\u0902",
|
|
313
|
+
content: "\u091F\u0947\u0915\u094D\u0938\u094D\u091F \u0938\u093E\u092E\u0917\u094D\u0930\u0940 \u0926\u0947\u0916\u0947\u0902 (\u0938\u0902\u0935\u0947\u0926\u0928\u0936\u0940\u0932)",
|
|
314
|
+
developer: "\u0921\u0947\u0935\u0932\u092A\u0930",
|
|
315
|
+
empty: "\u0905\u092D\u0940 \u0915\u094B\u0908 \u091F\u094D\u0930\u093E\u0902\u091C\u093C\u093F\u0936\u0928 \u0926\u0930\u094D\u091C \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",
|
|
316
|
+
error: "\u0921\u093E\u092F\u0917\u094D\u0928\u094B\u0938\u094D\u091F\u093F\u0915 \u0938\u094D\u0930\u094B\u0924 \u0935\u093F\u092B\u0932 \u0939\u0941\u0906\u0964",
|
|
317
|
+
eventsClear: "\u0907\u0935\u0947\u0902\u091F \u0938\u093E\u092B\u093C \u0915\u0930\u0947\u0902",
|
|
318
|
+
eventsPause: "\u0907\u0935\u0947\u0902\u091F \u0930\u094B\u0915\u0947\u0902",
|
|
319
|
+
eventsResume: "\u0907\u0935\u0947\u0902\u091F \u092B\u093F\u0930 \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902",
|
|
320
|
+
filter: "\u092E\u0949\u0921\u094D\u092F\u0942\u0932 \u092B\u093C\u093F\u0932\u094D\u091F\u0930 \u0915\u0930\u0947\u0902",
|
|
321
|
+
freeze: "\u0926\u0943\u0936\u094D\u092F \u0930\u094B\u0915\u0947\u0902",
|
|
322
|
+
help: "\u0915\u0947\u0935\u0932 \u092A\u0922\u093C\u0928\u0947 \u0935\u093E\u0932\u093E \u0938\u094D\u091F\u0947\u091F \u091F\u094D\u0930\u0940 10 Hz \u092A\u0930 \u0905\u092A\u0921\u0947\u091F \u0939\u094B\u0924\u093E \u0939\u0948\u0964 \u091F\u0947\u0915\u094D\u0938\u094D\u091F \u0921\u093F\u092B\u093C\u0949\u0932\u094D\u091F \u0930\u0942\u092A \u0938\u0947 \u091B\u093F\u092A\u093E \u0939\u0948\u0964 \u092F\u0939 \u092A\u0948\u0928\u0932 \u0935\u0949\u0907\u0938 \u0915\u094B \u0928\u093F\u092F\u0902\u0924\u094D\u0930\u093F\u0924 \u0928\u0939\u0940\u0902 \u0915\u0930\u0924\u093E\u0964",
|
|
323
|
+
omitted: "\u0905\u0924\u093F\u0930\u093F\u0915\u094D\u0924 \u0906\u0907\u091F\u092E \u091B\u093F\u092A\u093E\u090F \u0917\u090F",
|
|
324
|
+
popupBlocked: "\u092C\u094D\u0930\u093E\u0909\u091C\u093C\u0930 \u0928\u0947 \u0921\u0940\u092C\u0917\u0930 \u0935\u093F\u0902\u0921\u094B \u092C\u094D\u0932\u0949\u0915 \u0915\u0930 \u0926\u0940\u0964 \u0907\u0938 \u0938\u093E\u0907\u091F \u0915\u0947 \u0932\u093F\u090F \u092A\u0949\u092A-\u0905\u092A \u0915\u0940 \u0905\u0928\u0941\u092E\u0924\u093F \u0926\u0947\u0902 \u0914\u0930 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",
|
|
325
|
+
refreshRate: "\u0905\u092A\u0921\u0947\u091F \u0906\u0935\u0943\u0924\u094D\u0924\u093F",
|
|
326
|
+
resume: "\u0905\u092A\u0921\u0947\u091F \u092B\u093F\u0930 \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902",
|
|
327
|
+
states: "\u0935\u0930\u094D\u0924\u092E\u093E\u0928 \u0938\u094D\u0925\u093F\u0924\u093F\u092F\u093E\u0901",
|
|
328
|
+
title: "Live Voice \u0921\u0940\u092C\u0917\u0930",
|
|
329
|
+
transitions: "\u0939\u093E\u0932 \u0915\u0947 \u0938\u094D\u091F\u0947\u091F \u091F\u094D\u0930\u093E\u0902\u091C\u093C\u093F\u0936\u0928",
|
|
330
|
+
waiting: "\u0938\u0902\u0917\u0924 Live Voice \u0930\u0928\u091F\u093E\u0907\u092E \u0915\u0940 \u092A\u094D\u0930\u0924\u0940\u0915\u094D\u0937\u093E \u0939\u0948\u0964"
|
|
331
|
+
},
|
|
332
|
+
zh: {
|
|
333
|
+
activate: "\u5728\u72EC\u7ACB\u7A97\u53E3\u4E2D\u6253\u5F00\u8C03\u8BD5\u5668",
|
|
334
|
+
all: "\u6240\u6709\u6A21\u5757",
|
|
335
|
+
close: "\u5173\u95ED\u8C03\u8BD5\u5668",
|
|
336
|
+
content: "\u67E5\u770B\u6587\u672C\u5185\u5BB9\uFF08\u654F\u611F\uFF09",
|
|
337
|
+
developer: "\u5F00\u53D1\u8005",
|
|
338
|
+
empty: "\u5C1A\u672A\u8BB0\u5F55\u72B6\u6001\u8F6C\u6362\u3002",
|
|
339
|
+
error: "\u8BCA\u65AD\u6570\u636E\u6E90\u5931\u8D25\u3002",
|
|
340
|
+
eventsClear: "\u6E05\u9664\u4E8B\u4EF6",
|
|
341
|
+
eventsPause: "\u6682\u505C\u4E8B\u4EF6",
|
|
342
|
+
eventsResume: "\u6062\u590D\u4E8B\u4EF6",
|
|
343
|
+
filter: "\u7B5B\u9009\u6A21\u5757",
|
|
344
|
+
freeze: "\u51BB\u7ED3\u89C6\u56FE",
|
|
345
|
+
help: "\u53EA\u8BFB\u72B6\u6001\u6811\u4EE5 10 Hz \u66F4\u65B0\u3002\u9ED8\u8BA4\u9690\u85CF\u6587\u672C\u3002\u6B64\u9762\u677F\u4E0D\u63A7\u5236\u8BED\u97F3\u3002",
|
|
346
|
+
omitted: "\u5DF2\u7701\u7565\u5176\u4ED6\u9879\u76EE",
|
|
347
|
+
popupBlocked: "\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u8C03\u8BD5\u5668\u7A97\u53E3\u3002\u8BF7\u5141\u8BB8\u6B64\u7F51\u7AD9\u7684\u5F39\u51FA\u7A97\u53E3\uFF0C\u7136\u540E\u91CD\u8BD5\u3002",
|
|
348
|
+
refreshRate: "\u66F4\u65B0\u9891\u7387",
|
|
349
|
+
resume: "\u6062\u590D\u66F4\u65B0",
|
|
350
|
+
states: "\u5F53\u524D\u72B6\u6001",
|
|
351
|
+
title: "Live Voice \u8C03\u8BD5\u5668",
|
|
352
|
+
transitions: "\u6700\u8FD1\u7684\u72B6\u6001\u8F6C\u6362",
|
|
353
|
+
waiting: "\u6B63\u5728\u7B49\u5F85\u517C\u5BB9\u7684 Live Voice \u8FD0\u884C\u65F6\u3002"
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
// src/styles.ts
|
|
358
|
+
var styles = `
|
|
359
|
+
.dlvd-columns{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;flex:1;min-height:0;overflow:hidden}.dlvd-state-pane,.dlvd-event-pane{display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}.dlvd-event-pane{border-left:1px solid #344154;padding-left:16px}.dlvd-columns h3{margin:0 0 10px}.dlvd-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding-right:8px}.dlvd-scroll:focus-visible{outline:2px solid #8db9ff;outline-offset:-2px}.dlvd-history summary{overflow-wrap:anywhere}.dlvd-panel>header,.dlvd-panel>p,.dlvd-panel>.dlvd-toolbar{flex-shrink:0}
|
|
360
|
+
|
|
361
|
+
.dlvd-window{margin:0;background:#101722;color:#e6edf5;color-scheme:dark}.dlvd-window .dlvd-panel{position:static;width:100%;height:100dvh;max-height:none;min-width:0;resize:none;border:0;border-radius:0;box-shadow:none}
|
|
362
|
+
.dlvd-panel{position:fixed;right:16px;top:16px;width:min(520px,calc(100vw - 32px));height:80vh;max-height:80vh;overflow:hidden;display:flex;flex-direction:column;z-index:1000;padding:16px;border:1px solid #526177;border-radius:14px;background:#101722;color:#e6edf5;box-shadow:0 12px 40px #0008;font:13px/1.6 system-ui;resize:both;min-width:280px;box-sizing:border-box;color-scheme:dark}
|
|
363
|
+
.dlvd-panel header{display:flex;align-items:center;gap:12px;position:sticky;top:-16px;background:#101722;padding:8px 0;z-index:1}.dlvd-panel header strong{flex:1}.dlvd-panel button,.dlvd-panel select{background:#243247;color:#e6edf5;border:1px solid #526177;border-radius:6px;padding:5px 9px;cursor:pointer}.dlvd-panel button:focus-visible,.dlvd-panel summary:focus-visible{outline:2px solid #8db9ff}.dlvd-toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:12px}.dlvd-panel p{color:#aebed1}.dlvd-branch{margin-left:10px;border-left:1px solid #344154;padding-left:9px}.dlvd-branch summary{cursor:pointer;padding:3px 0}.dlvd-panel small{color:#aebed1;margin-left:8px}.dlvd-leaf{display:flex;gap:12px;justify-content:space-between;padding:2px 0;overflow-wrap:anywhere}.dlvd-leaf code{color:#b4c9e4}.dlvd-leaf span{white-space:pre-wrap;text-align:right;max-width:65%}.dlvd-leaf [data-kind=boolean]{color:#c8a5ff}.dlvd-leaf [data-kind=number]{color:#7cdbb6}.dlvd-history{margin-top:12px}.dlvd-history>details{border-top:1px solid #344154;padding:6px 0}.dlvd-history [data-level=error]{border-left:3px solid #ff8a8a;padding-left:8px}
|
|
364
|
+
`;
|
|
365
|
+
|
|
366
|
+
// ../live-voice/src/modules/core/developerExtension.ts
|
|
367
|
+
var DEVELOPER_KEY = /* @__PURE__ */ Symbol.for("dsh-live-voice.developer.v1");
|
|
368
|
+
var DEVELOPER_CHANGED = "dsh-live-voice:developer-changed";
|
|
369
|
+
function publishDeveloperExtension(target, extension) {
|
|
370
|
+
const ChangedEvent = target.Event ?? Event;
|
|
371
|
+
target[DEVELOPER_KEY] = extension;
|
|
372
|
+
target.dispatchEvent(new ChangedEvent(DEVELOPER_CHANGED));
|
|
373
|
+
return () => {
|
|
374
|
+
if (target[DEVELOPER_KEY] !== extension) return;
|
|
375
|
+
delete target[DEVELOPER_KEY];
|
|
376
|
+
target.dispatchEvent(new ChangedEvent(DEVELOPER_CHANGED));
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// src/apply.tsx
|
|
381
|
+
var inject = ["locale"];
|
|
382
|
+
function apply(ctx) {
|
|
383
|
+
let enabled = false;
|
|
384
|
+
let blocked = false;
|
|
385
|
+
let popup = null;
|
|
386
|
+
let root = null;
|
|
387
|
+
let closedTimer = null;
|
|
388
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
389
|
+
const subscribe = (listener) => {
|
|
390
|
+
listeners.add(listener);
|
|
391
|
+
return () => {
|
|
392
|
+
listeners.delete(listener);
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
const notify = () => {
|
|
396
|
+
for (const listener of listeners) listener();
|
|
397
|
+
};
|
|
398
|
+
for (const [locale, dictionary] of Object.entries(dictionaries)) {
|
|
399
|
+
ctx.effect(() => ctx.locale.register(namespace, locale, dictionary), namespace + ": " + locale);
|
|
400
|
+
}
|
|
401
|
+
const t = ctx.locale.bind(namespace);
|
|
402
|
+
const copy = () => Object.fromEntries(Object.keys(dictionaries.en).map((key) => [key, t(key)]));
|
|
403
|
+
const localeSubscribe = (listener) => ctx.locale.subscribe(listener);
|
|
404
|
+
const localeSnapshot = () => ctx.locale.getSnapshot();
|
|
405
|
+
const close = () => {
|
|
406
|
+
if (closedTimer !== null) clearInterval(closedTimer);
|
|
407
|
+
closedTimer = null;
|
|
408
|
+
const oldRoot = root;
|
|
409
|
+
const oldPopup = popup;
|
|
410
|
+
root = null;
|
|
411
|
+
popup = null;
|
|
412
|
+
enabled = false;
|
|
413
|
+
oldRoot?.unmount();
|
|
414
|
+
if (oldPopup && !oldPopup.closed) oldPopup.close();
|
|
415
|
+
notify();
|
|
416
|
+
};
|
|
417
|
+
function Host() {
|
|
418
|
+
import_react3.default.useSyncExternalStore(localeSubscribe, localeSnapshot);
|
|
419
|
+
const labels = copy();
|
|
420
|
+
import_react3.default.useEffect(() => {
|
|
421
|
+
if (popup && !popup.closed) popup.document.title = labels.title;
|
|
422
|
+
}, [labels.title]);
|
|
423
|
+
return /* @__PURE__ */ import_react3.default.createElement(DebuggerPanel, { copy: labels, target: window, onClose: () => queueMicrotask(close) });
|
|
424
|
+
}
|
|
425
|
+
const open = () => {
|
|
426
|
+
if (popup && !popup.closed) {
|
|
427
|
+
popup.focus();
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
close();
|
|
431
|
+
blocked = false;
|
|
432
|
+
let candidate = null;
|
|
433
|
+
try {
|
|
434
|
+
candidate = window.open(
|
|
435
|
+
"",
|
|
436
|
+
"",
|
|
437
|
+
"popup=yes,width=720,height=850,resizable=yes,scrollbars=yes"
|
|
438
|
+
);
|
|
439
|
+
if (!candidate) {
|
|
440
|
+
blocked = true;
|
|
441
|
+
notify();
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
popup = candidate;
|
|
445
|
+
const doc = candidate.document;
|
|
446
|
+
doc.title = copy().title;
|
|
447
|
+
doc.body.replaceChildren();
|
|
448
|
+
doc.body.className = "dlvd-window";
|
|
449
|
+
const style = doc.createElement("style");
|
|
450
|
+
style.textContent = styles;
|
|
451
|
+
doc.head.appendChild(style);
|
|
452
|
+
const container = doc.createElement("div");
|
|
453
|
+
container.dataset.plugin = namespace;
|
|
454
|
+
doc.body.appendChild(container);
|
|
455
|
+
root = (0, import_client.createRoot)(container);
|
|
456
|
+
root.render(/* @__PURE__ */ import_react3.default.createElement(Host, null));
|
|
457
|
+
enabled = true;
|
|
458
|
+
closedTimer = setInterval(() => {
|
|
459
|
+
if (popup?.closed) close();
|
|
460
|
+
}, 250);
|
|
461
|
+
notify();
|
|
462
|
+
} catch {
|
|
463
|
+
close();
|
|
464
|
+
if (candidate && !candidate.closed) candidate.close();
|
|
465
|
+
blocked = true;
|
|
466
|
+
notify();
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
function Settings() {
|
|
470
|
+
const active = import_react3.default.useSyncExternalStore(subscribe, () => enabled);
|
|
471
|
+
const failed = import_react3.default.useSyncExternalStore(subscribe, () => blocked);
|
|
472
|
+
import_react3.default.useSyncExternalStore(localeSubscribe, localeSnapshot);
|
|
473
|
+
const labels = copy();
|
|
474
|
+
return /* @__PURE__ */ import_react3.default.createElement("section", null, /* @__PURE__ */ import_react3.default.createElement("h2", null, labels.title), /* @__PURE__ */ import_react3.default.createElement("p", null, labels.help), /* @__PURE__ */ import_react3.default.createElement("label", null, /* @__PURE__ */ import_react3.default.createElement(
|
|
475
|
+
"input",
|
|
476
|
+
{
|
|
477
|
+
type: "checkbox",
|
|
478
|
+
checked: active,
|
|
479
|
+
onChange: (event) => event.target.checked ? open() : close()
|
|
480
|
+
}
|
|
481
|
+
), labels.activate), failed && /* @__PURE__ */ import_react3.default.createElement("p", { role: "alert" }, labels.popupBlocked));
|
|
482
|
+
}
|
|
483
|
+
ctx.effect(
|
|
484
|
+
() => publishDeveloperExtension(window, {
|
|
485
|
+
version: 1,
|
|
486
|
+
label: () => t("developer"),
|
|
487
|
+
component: Settings
|
|
488
|
+
}),
|
|
489
|
+
namespace + ": Developer tab"
|
|
490
|
+
);
|
|
491
|
+
ctx.effect(() => {
|
|
492
|
+
window.addEventListener("pagehide", close);
|
|
493
|
+
return () => {
|
|
494
|
+
window.removeEventListener("pagehide", close);
|
|
495
|
+
close();
|
|
496
|
+
listeners.clear();
|
|
497
|
+
};
|
|
498
|
+
}, namespace + ": separate window");
|
|
499
|
+
}
|
|
500
|
+
return module.exports;}});
|
package/lib/server.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-live-voice-debugger",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Optional read-only state inspector for DSH Live Voice.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"main": "./lib/server.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./lib/server.js",
|
|
10
|
+
"./client": "./lib/client.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"lib/",
|
|
15
|
+
"cordis.patch.yml",
|
|
16
|
+
"ARCHITECTURE.md"
|
|
17
|
+
],
|
|
18
|
+
"dsh": {
|
|
19
|
+
"bundle": {
|
|
20
|
+
"patch": "./cordis.patch.yml"
|
|
21
|
+
},
|
|
22
|
+
"client": {
|
|
23
|
+
"platform": "web",
|
|
24
|
+
"inject": [
|
|
25
|
+
"@deepseek-ai/dsh-client-locale"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "node --experimental-strip-types ../../scripts/build.ts --package live-voice-debugger",
|
|
31
|
+
"test": "npm run build && node --test .test-dist/*.test.js",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"dev": "node --experimental-strip-types ../../scripts/build.ts --package live-voice-debugger --watch",
|
|
34
|
+
"prepack": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public",
|
|
38
|
+
"tag": "latest"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/victorwads/dsh-live-voice.git",
|
|
43
|
+
"directory": "packages/live-voice-debugger"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/README.md
DELETED