epi-recorder 1.0.0__py3-none-any.whl
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.
- epi_cli/__init__.py +5 -0
- epi_cli/keys.py +272 -0
- epi_cli/main.py +106 -0
- epi_cli/record.py +192 -0
- epi_cli/verify.py +219 -0
- epi_cli/view.py +74 -0
- epi_core/__init__.py +14 -0
- epi_core/container.py +336 -0
- epi_core/redactor.py +266 -0
- epi_core/schemas.py +112 -0
- epi_core/serialize.py +131 -0
- epi_core/trust.py +236 -0
- epi_recorder/__init__.py +21 -0
- epi_recorder/api.py +389 -0
- epi_recorder/bootstrap.py +58 -0
- epi_recorder/environment.py +216 -0
- epi_recorder/patcher.py +356 -0
- epi_recorder-1.0.0.dist-info/METADATA +503 -0
- epi_recorder-1.0.0.dist-info/RECORD +25 -0
- epi_recorder-1.0.0.dist-info/WHEEL +5 -0
- epi_recorder-1.0.0.dist-info/entry_points.txt +2 -0
- epi_recorder-1.0.0.dist-info/licenses/LICENSE +201 -0
- epi_recorder-1.0.0.dist-info/top_level.txt +4 -0
- epi_viewer_static/app.js +267 -0
- epi_viewer_static/index.html +77 -0
|
@@ -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 Support. 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 2024 EPI Project
|
|
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.
|
epi_viewer_static/app.js
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EPI Viewer - Static JavaScript Application
|
|
3
|
+
*
|
|
4
|
+
* Renders .epi workflow timeline with zero code execution.
|
|
5
|
+
* All data is loaded from embedded JSON.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Load embedded data
|
|
9
|
+
function loadEPIData() {
|
|
10
|
+
const dataScript = document.getElementById('epi-data');
|
|
11
|
+
if (!dataScript) {
|
|
12
|
+
console.error('EPI data not found');
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(dataScript.textContent);
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.error('Failed to parse EPI data:', e);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Render trust badge
|
|
24
|
+
function renderTrustBadge(manifest) {
|
|
25
|
+
const badge = document.getElementById('trust-badge');
|
|
26
|
+
if (!badge) return;
|
|
27
|
+
|
|
28
|
+
const hasSig = manifest.signature != null;
|
|
29
|
+
|
|
30
|
+
let badgeHTML;
|
|
31
|
+
if (hasSig) {
|
|
32
|
+
badgeHTML = `
|
|
33
|
+
<div class="trust-badge inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-green-100 text-green-800">
|
|
34
|
+
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
|
|
35
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
|
|
36
|
+
</svg>
|
|
37
|
+
Signed
|
|
38
|
+
</div>
|
|
39
|
+
`;
|
|
40
|
+
} else {
|
|
41
|
+
badgeHTML = `
|
|
42
|
+
<div class="trust-badge inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-yellow-100 text-yellow-800">
|
|
43
|
+
<svg class="w-4 h-4 mr-1" fill="currentColor" viewBox="0 0 20 20">
|
|
44
|
+
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/>
|
|
45
|
+
</svg>
|
|
46
|
+
Unsigned
|
|
47
|
+
</div>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
badge.innerHTML = badgeHTML;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Render manifest summary
|
|
55
|
+
function renderManifest(manifest) {
|
|
56
|
+
const summary = document.getElementById('manifest-summary');
|
|
57
|
+
if (!summary) return;
|
|
58
|
+
|
|
59
|
+
const created = new Date(manifest.created_at).toLocaleString();
|
|
60
|
+
const filesCount = Object.keys(manifest.file_manifest || {}).length;
|
|
61
|
+
|
|
62
|
+
summary.innerHTML = `
|
|
63
|
+
<div>
|
|
64
|
+
<div class="text-gray-500 text-xs uppercase tracking-wide">Workflow ID</div>
|
|
65
|
+
<div class="font-mono text-xs mt-1 break-all">${manifest.workflow_id}</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div>
|
|
68
|
+
<div class="text-gray-500 text-xs uppercase tracking-wide">Created</div>
|
|
69
|
+
<div class="mt-1">${created}</div>
|
|
70
|
+
</div>
|
|
71
|
+
<div>
|
|
72
|
+
<div class="text-gray-500 text-xs uppercase tracking-wide">Command</div>
|
|
73
|
+
<div class="font-mono text-xs mt-1 break-all bg-gray-50 p-2 rounded">${manifest.cli_command || 'N/A'}</div>
|
|
74
|
+
</div>
|
|
75
|
+
<div>
|
|
76
|
+
<div class="text-gray-500 text-xs uppercase tracking-wide">Files</div>
|
|
77
|
+
<div class="mt-1">${filesCount} captured</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div>
|
|
80
|
+
<div class="text-gray-500 text-xs uppercase tracking-wide">Spec Version</div>
|
|
81
|
+
<div class="mt-1 font-mono text-xs">${manifest.spec_version}</div>
|
|
82
|
+
</div>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Render a single step based on its kind
|
|
87
|
+
function renderStep(step) {
|
|
88
|
+
const { index, timestamp, kind, content } = step;
|
|
89
|
+
const time = new Date(timestamp).toLocaleTimeString();
|
|
90
|
+
|
|
91
|
+
// Common wrapper
|
|
92
|
+
const wrapper = document.createElement('div');
|
|
93
|
+
wrapper.className = 'step-card px-6 py-4';
|
|
94
|
+
|
|
95
|
+
// Header
|
|
96
|
+
const header = document.createElement('div');
|
|
97
|
+
header.className = 'flex items-center justify-between mb-2';
|
|
98
|
+
header.innerHTML = `
|
|
99
|
+
<div class="flex items-center space-x-2">
|
|
100
|
+
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">
|
|
101
|
+
#${index}
|
|
102
|
+
</span>
|
|
103
|
+
<span class="text-sm font-medium text-gray-900">${kind}</span>
|
|
104
|
+
</div>
|
|
105
|
+
<span class="text-xs text-gray-500">${time}</span>
|
|
106
|
+
`;
|
|
107
|
+
wrapper.appendChild(header);
|
|
108
|
+
|
|
109
|
+
// Content based on kind
|
|
110
|
+
const contentDiv = document.createElement('div');
|
|
111
|
+
contentDiv.className = 'mt-3';
|
|
112
|
+
|
|
113
|
+
if (kind === 'llm.request') {
|
|
114
|
+
contentDiv.innerHTML = renderLLMRequest(content);
|
|
115
|
+
} else if (kind === 'llm.response') {
|
|
116
|
+
contentDiv.innerHTML = renderLLMResponse(content);
|
|
117
|
+
} else if (kind === 'security.redaction') {
|
|
118
|
+
contentDiv.innerHTML = renderRedaction(content);
|
|
119
|
+
} else {
|
|
120
|
+
// Generic JSON display
|
|
121
|
+
contentDiv.innerHTML = `<pre class="text-xs bg-gray-50 p-3 rounded overflow-auto">${JSON.stringify(content, null, 2)}</pre>`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
wrapper.appendChild(contentDiv);
|
|
125
|
+
return wrapper;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Render LLM request
|
|
129
|
+
function renderLLMRequest(content) {
|
|
130
|
+
const messages = content.messages || [];
|
|
131
|
+
let html = `
|
|
132
|
+
<div class="text-xs text-gray-600 mb-2">
|
|
133
|
+
<span class="font-medium">${content.provider}</span> •
|
|
134
|
+
<span class="font-mono">${content.model}</span>
|
|
135
|
+
</div>
|
|
136
|
+
`;
|
|
137
|
+
|
|
138
|
+
// Render messages as chat bubbles
|
|
139
|
+
if (messages.length > 0) {
|
|
140
|
+
html += '<div class="space-y-2">';
|
|
141
|
+
for (const msg of messages) {
|
|
142
|
+
const isUser = msg.role === 'user';
|
|
143
|
+
const bgColor = isUser ? 'bg-blue-100' : 'bg-gray-100';
|
|
144
|
+
const textColor = isUser ? 'text-blue-900' : 'text-gray-900';
|
|
145
|
+
const align = isUser ? 'ml-auto' : 'mr-auto';
|
|
146
|
+
|
|
147
|
+
html += `
|
|
148
|
+
<div class="chat-bubble ${align} ${bgColor} ${textColor} rounded-lg px-4 py-2 text-sm">
|
|
149
|
+
<div class="text-xs font-medium mb-1 uppercase">${msg.role}</div>
|
|
150
|
+
<div class="whitespace-pre-wrap">${escapeHTML(msg.content)}</div>
|
|
151
|
+
</div>
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
html += '</div>';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return html;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Render LLM response
|
|
161
|
+
function renderLLMResponse(content) {
|
|
162
|
+
const choices = content.choices || [];
|
|
163
|
+
let html = `
|
|
164
|
+
<div class="text-xs text-gray-600 mb-2">
|
|
165
|
+
<span class="font-medium">${content.provider}</span> •
|
|
166
|
+
<span class="font-mono">${content.model}</span>
|
|
167
|
+
</div>
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
// Render response messages
|
|
171
|
+
if (choices.length > 0) {
|
|
172
|
+
html += '<div class="space-y-2">';
|
|
173
|
+
for (const choice of choices) {
|
|
174
|
+
html += `
|
|
175
|
+
<div class="chat-bubble mr-auto bg-green-100 text-green-900 rounded-lg px-4 py-2 text-sm">
|
|
176
|
+
<div class="text-xs font-medium mb-1 uppercase">Assistant</div>
|
|
177
|
+
<div class="whitespace-pre-wrap">${escapeHTML(choice.message.content)}</div>
|
|
178
|
+
${choice.finish_reason ? `<div class="text-xs text-green-700 mt-2">• ${choice.finish_reason}</div>` : ''}
|
|
179
|
+
</div>
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
182
|
+
html += '</div>';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Usage stats
|
|
186
|
+
if (content.usage) {
|
|
187
|
+
html += `
|
|
188
|
+
<div class="mt-3 text-xs text-gray-600 flex items-center space-x-4">
|
|
189
|
+
<span>📊 ${content.usage.total_tokens} tokens</span>
|
|
190
|
+
<span>⚡ ${content.latency_seconds}s</span>
|
|
191
|
+
</div>
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return html;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Render redaction event
|
|
199
|
+
function renderRedaction(content) {
|
|
200
|
+
return `
|
|
201
|
+
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-3 text-sm">
|
|
202
|
+
<div class="flex items-center text-yellow-800">
|
|
203
|
+
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
|
204
|
+
<path fill-rule="evenodd" d="M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z" clip-rule="evenodd"/>
|
|
205
|
+
</svg>
|
|
206
|
+
<span class="font-medium">Secrets Redacted</span>
|
|
207
|
+
</div>
|
|
208
|
+
<div class="mt-2 text-yellow-700">
|
|
209
|
+
${content.count} sensitive value(s) removed from <span class="font-mono text-xs">${content.target_step}</span>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
`;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Escape HTML to prevent XSS
|
|
216
|
+
function escapeHTML(str) {
|
|
217
|
+
const div = document.createElement('div');
|
|
218
|
+
div.textContent = str;
|
|
219
|
+
return div.innerHTML;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Render timeline
|
|
223
|
+
function renderTimeline(steps) {
|
|
224
|
+
const timeline = document.getElementById('timeline');
|
|
225
|
+
if (!timeline) return;
|
|
226
|
+
|
|
227
|
+
if (steps.length === 0) {
|
|
228
|
+
timeline.innerHTML = `
|
|
229
|
+
<div class="px-6 py-12 text-center text-gray-500">
|
|
230
|
+
No steps recorded
|
|
231
|
+
</div>
|
|
232
|
+
`;
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
timeline.innerHTML = '';
|
|
237
|
+
for (const step of steps) {
|
|
238
|
+
timeline.appendChild(renderStep(step));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Initialize viewer
|
|
243
|
+
function init() {
|
|
244
|
+
const data = loadEPIData();
|
|
245
|
+
if (!data) {
|
|
246
|
+
document.body.innerHTML = `
|
|
247
|
+
<div class="min-h-screen flex items-center justify-center">
|
|
248
|
+
<div class="text-center">
|
|
249
|
+
<h1 class="text-2xl font-bold text-red-600 mb-2">Failed to load EPI data</h1>
|
|
250
|
+
<p class="text-gray-600">The embedded data could not be parsed.</p>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
`;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
renderTrustBadge(data.manifest);
|
|
258
|
+
renderManifest(data.manifest);
|
|
259
|
+
renderTimeline(data.steps);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Run on load
|
|
263
|
+
if (document.readyState === 'loading') {
|
|
264
|
+
document.addEventListener('DOMContentLoaded', init);
|
|
265
|
+
} else {
|
|
266
|
+
init();
|
|
267
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>EPI Viewer</title>
|
|
7
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
8
|
+
<style>
|
|
9
|
+
body { font-family: system-ui, -apple-system, sans-serif; }
|
|
10
|
+
.chat-bubble { max-width: 80%; }
|
|
11
|
+
.step-card { transition: all 0.2s; }
|
|
12
|
+
.step-card:hover { transform: translateX(4px); }
|
|
13
|
+
pre { white-space: pre-wrap; word-wrap: break-word; }
|
|
14
|
+
.trust-badge { animation: fadeIn 0.3s; }
|
|
15
|
+
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
<body class="bg-gray-50">
|
|
19
|
+
<!-- EPI Data (injected at pack time) -->
|
|
20
|
+
<script id="epi-data" type="application/json">
|
|
21
|
+
{
|
|
22
|
+
"manifest": {},
|
|
23
|
+
"steps": []
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<div class="min-h-screen">
|
|
28
|
+
<!-- Header -->
|
|
29
|
+
<header class="bg-white shadow-sm border-b border-gray-200">
|
|
30
|
+
<div class="max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8">
|
|
31
|
+
<div class="flex items-center justify-between">
|
|
32
|
+
<div>
|
|
33
|
+
<h1 class="text-2xl font-bold text-gray-900">EPI Viewer</h1>
|
|
34
|
+
<p class="text-sm text-gray-500">Evidence Packaged Infrastructure for AI Workflows</p>
|
|
35
|
+
</div>
|
|
36
|
+
<div id="trust-badge"></div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</header>
|
|
40
|
+
|
|
41
|
+
<!-- Main Content -->
|
|
42
|
+
<main class="max-w-7xl mx-auto px-4 py-6 sm:px-6 lg:px-8">
|
|
43
|
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
44
|
+
<!-- Sidebar: Manifest Summary -->
|
|
45
|
+
<div class="lg:col-span-1">
|
|
46
|
+
<div class="bg-white rounded-lg shadow p-6 sticky top-6">
|
|
47
|
+
<h2 class="text-lg font-semibold text-gray-900 mb-4">Manifest</h2>
|
|
48
|
+
<div id="manifest-summary" class="space-y-3 text-sm"></div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<!-- Main: Timeline -->
|
|
53
|
+
<div class="lg:col-span-2">
|
|
54
|
+
<div class="bg-white rounded-lg shadow">
|
|
55
|
+
<div class="border-b border-gray-200 px-6 py-4">
|
|
56
|
+
<h2 class="text-lg font-semibold text-gray-900">Timeline</h2>
|
|
57
|
+
<p class="text-sm text-gray-500 mt-1">Captured workflow steps</p>
|
|
58
|
+
</div>
|
|
59
|
+
<div id="timeline" class="divide-y divide-gray-200"></div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</main>
|
|
64
|
+
|
|
65
|
+
<!-- Footer -->
|
|
66
|
+
<footer class="mt-12 bg-white border-t border-gray-200">
|
|
67
|
+
<div class="max-w-7xl mx-auto px-4 py-6 sm:px-6 lg:px-8">
|
|
68
|
+
<p class="text-center text-sm text-gray-500">
|
|
69
|
+
EPI v1.0-keystone | <span class="font-mono">application/epi+zip</span>
|
|
70
|
+
</p>
|
|
71
|
+
</div>
|
|
72
|
+
</footer>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<script src="app.js"></script>
|
|
76
|
+
</body>
|
|
77
|
+
</html>
|