@wukazis/euphony 0.1.45
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/NOTICE +13 -0
- package/README.md +266 -0
- package/bin/euphony.js +4 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/harmony-render-5ErAOXX9.js +3285 -0
- package/dist/assets/local-data-worker-CHLGzNeW.js +2 -0
- package/dist/assets/main-CmldcHcT.js +4047 -0
- package/dist/examples/euphony-convo-100.jsonl +8 -0
- package/dist/examples/simple-harmony-convos.jsonl +8 -0
- package/dist/favicon-48x48.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/favicon.svg +3 -0
- package/dist/global.css +38 -0
- package/dist/index.html +22 -0
- package/dist/web-app-manifest-192x192.png +0 -0
- package/dist/web-app-manifest-512x512.png +0 -0
- package/lib/chunks/conversation.js +612 -0
- package/lib/chunks/css/codex.js +1 -0
- package/lib/chunks/css/confirm-dialog.js +1 -0
- package/lib/chunks/css/conversation.js +1 -0
- package/lib/chunks/css/floating-toolbar.js +1 -0
- package/lib/chunks/css/input-dialog.js +1 -0
- package/lib/chunks/css/json-viewer.js +1 -0
- package/lib/chunks/css/menu.js +1 -0
- package/lib/chunks/css/message-code.js +1 -0
- package/lib/chunks/css/message-developer-content.js +1 -0
- package/lib/chunks/css/message-editor-popover.js +1 -0
- package/lib/chunks/css/message-hidden.js +1 -0
- package/lib/chunks/css/message-system-content.js +1 -0
- package/lib/chunks/css/message-text.js +1 -0
- package/lib/chunks/css/message-unsupported.js +1 -0
- package/lib/chunks/css/pagination.js +1 -0
- package/lib/chunks/css/preference-window.js +1 -0
- package/lib/chunks/css/search-window.js +1 -0
- package/lib/chunks/css/toast.js +1 -0
- package/lib/chunks/css/token-window.js +1 -0
- package/lib/chunks/css-inline.js +1 -0
- package/lib/chunks/dompurify.js +1 -0
- package/lib/chunks/harmony-types.js +1 -0
- package/lib/chunks/icon-cross.js +1 -0
- package/lib/chunks/icon-play.js +1 -0
- package/lib/chunks/marked.js +1 -0
- package/lib/chunks/prismjs.js +1 -0
- package/lib/chunks/shoelace.js +1131 -0
- package/lib/chunks/third-party.js +1 -0
- package/lib/chunks/utils.js +16 -0
- package/lib/components/app/app.d.ts +192 -0
- package/lib/components/app/local-data-worker.d.ts +35 -0
- package/lib/components/app/request-worker.d.ts +45 -0
- package/lib/components/app/url-manager.d.ts +25 -0
- package/lib/components/codex/codex.d.ts +50 -0
- package/lib/components/codex/codex.js +36 -0
- package/lib/components/confirm-dialog/confirm-dialog.d.ts +42 -0
- package/lib/components/confirm-dialog/confirm-dialog.js +41 -0
- package/lib/components/conversation/conversation.d.ts +259 -0
- package/lib/components/conversation/conversation.js +1 -0
- package/lib/components/floating-toolbar/floating-toolbar.d.ts +47 -0
- package/lib/components/floating-toolbar/floating-toolbar.js +32 -0
- package/lib/components/input-dialog/input-dialog.d.ts +43 -0
- package/lib/components/input-dialog/input-dialog.js +51 -0
- package/lib/components/json-viewer/json-viewer.d.ts +33 -0
- package/lib/components/json-viewer/json-viewer.js +8 -0
- package/lib/components/menu/menu.d.ts +38 -0
- package/lib/components/menu/menu.js +9 -0
- package/lib/components/message-code/message-code.d.ts +20 -0
- package/lib/components/message-code/message-code.js +10 -0
- package/lib/components/message-developer-content/message-developer-content.d.ts +45 -0
- package/lib/components/message-developer-content/message-developer-content.js +72 -0
- package/lib/components/message-editor-popover/message-editor-popover.d.ts +36 -0
- package/lib/components/message-editor-popover/message-editor-popover.js +85 -0
- package/lib/components/message-hidden/message-hidden.d.ts +38 -0
- package/lib/components/message-hidden/message-hidden.js +10 -0
- package/lib/components/message-system-content/message-system-content.d.ts +52 -0
- package/lib/components/message-system-content/message-system-content.js +74 -0
- package/lib/components/message-text/message-text.d.ts +36 -0
- package/lib/components/message-text/message-text.js +14 -0
- package/lib/components/message-unsupported/message-unsupported.d.ts +19 -0
- package/lib/components/message-unsupported/message-unsupported.js +26 -0
- package/lib/components/pagination/pagination.d.ts +29 -0
- package/lib/components/pagination/pagination.js +35 -0
- package/lib/components/preference-window/preference-window.d.ts +107 -0
- package/lib/components/preference-window/preference-window.js +319 -0
- package/lib/components/search-window/search-window.d.ts +44 -0
- package/lib/components/search-window/search-window.js +71 -0
- package/lib/components/toast/toast.d.ts +34 -0
- package/lib/components/toast/toast.js +77 -0
- package/lib/components/token-window/token-window.d.ts +96 -0
- package/lib/components/token-window/token-window.js +1 -0
- package/lib/config/config.d.ts +273 -0
- package/lib/euphony.d.ts +11 -0
- package/lib/euphony.js +1 -0
- package/lib/types/common-types.d.ts +176 -0
- package/lib/types/harmony-types.d.ts +72 -0
- package/lib/utils/api-manager.d.ts +42 -0
- package/lib/utils/codex-session.d.ts +7 -0
- package/lib/utils/dompurify-configs.d.ts +2 -0
- package/lib/utils/harmony-render.d.ts +4 -0
- package/lib/utils/marked-katex-extension.d.ts +22 -0
- package/lib/utils/patch-preview.d.ts +2 -0
- package/lib/utils/utils.d.ts +80 -0
- package/package.json +84 -0
- package/server-dist/node-main.js +1273 -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 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 [yyyy] [name of copyright owner]
|
|
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/NOTICE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2026 OpenAI
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Euphony: Harmony Chat and Codex Session Viewer
|
|
2
|
+
|
|
3
|
+
[](https://github.com/openai/euphony/actions/workflows/build.yml)
|
|
4
|
+
[](https://github.com/openai/euphony/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
Visualize harmony chat conversations and Codex sessions in your browser 🎵
|
|
7
|
+
|
|
8
|
+
<table>
|
|
9
|
+
<tr>
|
|
10
|
+
<td colspan="3"><a href="https://openai.github.io/euphony/"><img src='https://github.com/user-attachments/assets/cfdccb43-a63f-4495-8718-63efde8a1a11' width="100%"></a></td>
|
|
11
|
+
</tr>
|
|
12
|
+
<tr></tr>
|
|
13
|
+
<tr>
|
|
14
|
+
<td><a href="https://openai.github.io/euphony/">🎵 Euphony Demo</a></td>
|
|
15
|
+
<td><a href="https://openai.github.io/euphony/?path=https://huggingface.co/datasets/xiaohk/x-datasets/resolve/main/health-bench-hard-20250508.jsonl">💬 Harmony Chat Example</a></td>
|
|
16
|
+
<td><a href="https://openai.github.io/euphony/?path=https://huggingface.co/datasets/victor/codex-sample-session/resolve/main/codex-session-hi-2026-03-16.jsonl">🤖 Codex Session Example</a></td>
|
|
17
|
+
</tr>
|
|
18
|
+
</table>
|
|
19
|
+
|
|
20
|
+
[Harmony](https://github.com/openai/harmony) conversations and [Codex session
|
|
21
|
+
logs](https://developers.openai.com/codex/cli/features) are useful across
|
|
22
|
+
training, evaluation, and agent workflows, but they are often difficult to
|
|
23
|
+
inspect. Euphony addresses that gap by providing **portable**, **customizable**,
|
|
24
|
+
and **modular** _Web Components_ for visualizing
|
|
25
|
+
structured chat data and Codex sessions in the browser.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
| Feature | What it does |
|
|
30
|
+
| :-------------------------- | :------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| Harmony conversation viewer | Renders Harmony conversations with support for different message types and metadata. |
|
|
32
|
+
| Codex session viewer | Detects Codex session JSONL files, converts them into a conversation, and renders them in the same viewer. |
|
|
33
|
+
| Flexible loading | Loads data from the clipboard, local `.json` or `.jsonl` files, or public HTTP(S) JSON/JSONL URLs. |
|
|
34
|
+
| Markdown and HTML rendering | Renders markdown in message content, including formulas and optional HTML blocks. |
|
|
35
|
+
| Translation | Translates non-English text into English in normal mode or frontend-only mode with a user-provided OpenAI API key. |
|
|
36
|
+
| Metadata inspection | Exposes conversation-level and message-level metadata directly in the UI. |
|
|
37
|
+
| Filtering and focus mode | Filters datasets with JMESPath and narrows visible messages by role, recipient, or content type. |
|
|
38
|
+
| Grid and editor modes | Supports dataset skimming in grid view and direct JSONL editing in editor mode. |
|
|
39
|
+
| Harmony token rendering | Shows Harmony renderer output, token IDs, decoded tokens, and rendered display strings. |
|
|
40
|
+
| Local Codex sessions index | Scans local Codex history under `~/.codex/sessions`, shows a lightweight session list, and opens full sessions on demand. |
|
|
41
|
+
| Embeddable web components | Ships reusable custom elements for integrating the viewer into other web apps in any framework (e.g., React, Svelte, Vue). |
|
|
42
|
+
|
|
43
|
+
## Get Started
|
|
44
|
+
|
|
45
|
+
There are two ways you can use Euphony.
|
|
46
|
+
|
|
47
|
+
1. Use the [standalone app](https://openai.github.io/euphony/) to view Harmony JSON/JSONL data and Codex session JSONL files.
|
|
48
|
+
2. Use the Euphony JavaScript library to render Harmony data in your own web app.
|
|
49
|
+
|
|
50
|
+
### Use [Euphony](https://openai.github.io/euphony/) to View My Data
|
|
51
|
+
|
|
52
|
+
1. Load data from one of the supported sources:
|
|
53
|
+
1. Paste JSON or JSONL from the clipboard
|
|
54
|
+
2. Choose a local `.json` or `.jsonl` file
|
|
55
|
+
3. Provide a public HTTP(S) URL that serves JSON or JSONL (e.g., Hugging Face)
|
|
56
|
+
2. Euphony automatically detects and renders the input:
|
|
57
|
+
1. If the JSONL is a list of conversations → Euphony renders all conversations
|
|
58
|
+
2. If the JSONL is a Codex session file → Euphony renders a structured Codex session timeline
|
|
59
|
+
3. If the conversation is stored at some top-level field → Euphony renders all conversations and treat other top-level fields as each conversation’s metadata
|
|
60
|
+
4. Else → Euphony renders the data as raw JSON objects
|
|
61
|
+
|
|
62
|
+
### Integrate Euphony into My Web App
|
|
63
|
+
|
|
64
|
+
#### Web Component API
|
|
65
|
+
|
|
66
|
+
To use Euphony web components, first build the Euphony library:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
pnpm install
|
|
70
|
+
pnpm run build:library
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The main library entrypoint is built at: `./lib/euphony.js`.
|
|
74
|
+
|
|
75
|
+
Then, you can import the JS file. To show a viewer of Harmony data, you can add the web component to your HTML file (or React, Svelte, Vue components):
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<euphony-conversation conversation-string="HARMONY_CONVERSATION_JSON_STRING">
|
|
79
|
+
</euphony-conversation>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Alternatively, you can pass parsed JSON object directly into the `euphony-conversation` `HTMLElement` from Javascript.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
const harmonyConversation: Conversation;
|
|
86
|
+
const myEuphonyConvoElement = document.querySelector('euphony-conversation');
|
|
87
|
+
myEuphonyConvoElement.conversationJSON = harmonyConversation;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Euphony web components are customizable. For example, to style these components, you can override CSS variables in your stylesheets.
|
|
91
|
+
|
|
92
|
+
```css
|
|
93
|
+
--euphony-padding-v: 10px;
|
|
94
|
+
--euphony-padding-h: 15px;
|
|
95
|
+
--euphony-font-color: hsl(0, 0%, 12.94%);
|
|
96
|
+
--euphony-font-color-secondary: hsl(0, 0%, 61.96%);
|
|
97
|
+
--euphony-user-color: hsl(122, 43.43%, 38.82%);
|
|
98
|
+
--euphony-assistant-color: hsl(282, 67.88%, 37.84%);
|
|
99
|
+
--euphony-conv-background-color: hsl(0, 0%, 96.08%);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Frontend-only and Backend-assisted Modes
|
|
103
|
+
|
|
104
|
+
Euphony can run in two modes:
|
|
105
|
+
|
|
106
|
+
| Mode | What it is for |
|
|
107
|
+
| :-------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
108
|
+
| Frontend-only mode | Recommended for static or external hosting. URL loading happens in the browser, and translation uses a user-provided OpenAI API key when needed. |
|
|
109
|
+
| Backend-assisted mode | Optional for local development. The Node.js server supports remote JSON/JSONL loading, backend translation, Harmony rendering, and the local Codex sessions index. Useful to load large datasets. |
|
|
110
|
+
|
|
111
|
+
The backend server is optional. It should only be used locally. Frontend-only mode is controlled with the Vite env variable `VITE_EUPHONY_FRONTEND_ONLY`.
|
|
112
|
+
|
|
113
|
+
- Set `VITE_EUPHONY_FRONTEND_ONLY=true` to force frontend-only mode.
|
|
114
|
+
- Set `VITE_EUPHONY_FRONTEND_ONLY=false` to use the local backend-assisted mode.
|
|
115
|
+
|
|
116
|
+
The current backend includes a remote URL fetch path for loading JSON and JSONL data. If you host that backend on an external server, it can introduce SSRF risk because the server may be tricked into fetching attacker-controlled URLs. Therefore, only use the backend-assisted mode for local development.
|
|
117
|
+
|
|
118
|
+
## Local Deployment
|
|
119
|
+
|
|
120
|
+
This fork includes a local Codex session browser. It is intended to run on your own machine so the Node backend can read your local Codex history from `~/.codex/sessions`.
|
|
121
|
+
|
|
122
|
+
### Requirements
|
|
123
|
+
|
|
124
|
+
- Node.js 20+
|
|
125
|
+
- npm or [pnpm](https://pnpm.io/)
|
|
126
|
+
- Optional: an OpenAI API key only if you use backend translation
|
|
127
|
+
|
|
128
|
+
### Install
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
git clone https://github.com/wukazis/euphony.git
|
|
132
|
+
cd euphony
|
|
133
|
+
|
|
134
|
+
pnpm install
|
|
135
|
+
# or: npm install
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Run the Production Build Locally
|
|
139
|
+
|
|
140
|
+
Build the frontend and Node backend, then start the local server:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pnpm run build
|
|
144
|
+
pnpm start
|
|
145
|
+
|
|
146
|
+
# npm users:
|
|
147
|
+
# npm run build
|
|
148
|
+
# npm start
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Open:
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
http://127.0.0.1:8020/
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
To open the local Codex sessions index directly:
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
http://127.0.0.1:8020/?path=codex%3Asessions
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The `codex:sessions` path scans:
|
|
164
|
+
|
|
165
|
+
```text
|
|
166
|
+
~/.codex/sessions/**/*.jsonl
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Each session is shown as a lightweight row with its session path, first user message, relative time, and event count. Click a row to load the full session. On a full session page, use the `Sessions` button in the toolbar to return to the index.
|
|
170
|
+
|
|
171
|
+
To read Codex sessions from another directory:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
CODEX_SESSIONS_DIR=/path/to/sessions pnpm start
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
If you want backend translation, set either `OPENAI_API_KEY` or `OPEN_AI_API_KEY` before starting the backend.
|
|
178
|
+
|
|
179
|
+
To use another host or port:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
EUPHONY_HOST=127.0.0.1 PORT=8030 pnpm start
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Global Install Flow
|
|
186
|
+
|
|
187
|
+
After publishing this package to npm, a machine can install and run it with:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm install -g @wukazis/euphony
|
|
191
|
+
euphony
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
That global command serves the bundled frontend from `dist/` and starts the Node backend from `server-dist/`.
|
|
195
|
+
|
|
196
|
+
### Run in Development Mode
|
|
197
|
+
|
|
198
|
+
Build and start the Node backend:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
pnpm run build:app
|
|
202
|
+
pnpm start
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Start the Vite frontend in another terminal:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
VITE_EUPHONY_FRONTEND_ONLY=false pnpm run dev
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Open:
|
|
212
|
+
|
|
213
|
+
```text
|
|
214
|
+
http://127.0.0.1:3000/?path=codex%3Asessions
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Development
|
|
218
|
+
|
|
219
|
+
To develop Euphony locally, install Node.js and a package manager such as
|
|
220
|
+
[pnpm](https://pnpm.io/).
|
|
221
|
+
|
|
222
|
+
Start the backend server:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
pnpm install
|
|
226
|
+
pnpm run build:app
|
|
227
|
+
pnpm start
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Start the frontend development server:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
pnpm run dev
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
To force frontend-only mode with Vite:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
VITE_EUPHONY_FRONTEND_ONLY=true pnpm run dev
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Visit [http://localhost:3000/](http://localhost:3000/), you should see Euphony running in your browser!
|
|
243
|
+
|
|
244
|
+
To build the static frontend:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
pnpm run build:frontend
|
|
248
|
+
python -m http.server -d ./dist
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
To build a frontend-only static bundle:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
pnpm run build:frontend-only
|
|
255
|
+
python -m http.server -d ./dist
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
The older FastAPI backend is still available under `server/fastapi-main.py` for compatibility, but the packaged local app uses the Node backend.
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
Euphony is released under the Apache 2.0 license. See [`LICENSE`](./LICENSE).
|
|
263
|
+
|
|
264
|
+
The file [`src/css/prism-coldark-auto.css`](./src/css/prism-coldark-auto.css) is derived
|
|
265
|
+
from an upstream Prism theme ([GitHub](https://github.com/ArmandPhilippot/coldark-prism))
|
|
266
|
+
and remains subject to the MIT license terms of that upstream work.
|
package/bin/euphony.js
ADDED
|
Binary file
|