@vxnus/siduri 0.1.8 → 0.1.11
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/README.md +3 -4
- package/dist/builtin-manifests.d.ts +2 -0
- package/dist/builtin-manifests.js +492 -0
- package/dist/clean-machine-e2e.test.d.ts +1 -0
- package/dist/clean-machine-e2e.test.js +236 -0
- package/dist/configurators/behavior.d.ts +2 -0
- package/dist/configurators/behavior.js +36 -0
- package/dist/configurators/body.d.ts +2 -0
- package/dist/configurators/body.js +60 -0
- package/dist/configurators/brain.d.ts +6 -0
- package/dist/configurators/brain.js +80 -0
- package/dist/configurators/ear.d.ts +2 -0
- package/dist/configurators/ear.js +28 -0
- package/dist/configurators/hands.d.ts +2 -0
- package/dist/configurators/hands.js +27 -0
- package/dist/configurators/index.d.ts +24 -0
- package/dist/configurators/index.js +78 -0
- package/dist/configurators/knowledge.d.ts +6 -0
- package/dist/configurators/knowledge.js +100 -0
- package/dist/configurators/memory.d.ts +2 -0
- package/dist/configurators/memory.js +44 -0
- package/dist/configurators/mouth.d.ts +2 -0
- package/dist/configurators/mouth.js +15 -0
- package/dist/configurators/observation.d.ts +2 -0
- package/dist/configurators/observation.js +12 -0
- package/dist/configurators/types.d.ts +12 -0
- package/dist/configurators/types.js +2 -0
- package/dist/configurators/vision.d.ts +2 -0
- package/dist/configurators/vision.js +39 -0
- package/dist/configurators/voice.d.ts +2 -0
- package/dist/configurators/voice.js +477 -0
- package/dist/configurators.test.d.ts +1 -0
- package/dist/configurators.test.js +331 -0
- package/dist/db.d.ts +25 -0
- package/dist/db.js +152 -0
- package/dist/discovery.d.ts +13 -0
- package/dist/discovery.js +87 -0
- package/dist/discovery.test.d.ts +1 -0
- package/dist/discovery.test.js +69 -0
- package/dist/doctor-db.test.d.ts +1 -0
- package/dist/doctor-db.test.js +141 -0
- package/dist/doctor.d.ts +19 -0
- package/dist/doctor.js +249 -0
- package/dist/generator.d.ts +20 -0
- package/dist/generator.js +615 -0
- package/dist/generator.test.d.ts +1 -0
- package/dist/generator.test.js +197 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +395 -0
- package/dist/manifest.d.ts +33 -0
- package/dist/manifest.js +40 -0
- package/dist/providers/knowledge-hub.d.ts +37 -0
- package/dist/providers/knowledge-hub.js +141 -0
- package/dist/providers/openrouter.d.ts +32 -0
- package/dist/providers/openrouter.js +201 -0
- package/dist/release-check.d.ts +9 -0
- package/dist/release-check.js +133 -0
- package/dist/runtime-parity.test.d.ts +1 -0
- package/dist/runtime-parity.test.js +141 -0
- package/dist/schema-validator.d.ts +9 -0
- package/dist/schema-validator.js +107 -0
- package/dist/web-dist/404/index.html +1 -0
- package/dist/web-dist/404.html +1 -0
- package/dist/web-dist/__next.__PAGE__.txt +35 -0
- package/dist/web-dist/__next._full.txt +32 -0
- package/dist/web-dist/__next._tree.txt +4 -0
- package/dist/web-dist/_next/static/chunks/09y7khbmco_v4.js +1 -0
- package/dist/web-dist/_next/static/chunks/0cz1d0mv5g_q7.js +1 -0
- package/dist/web-dist/_next/static/chunks/0uwih7sydv413.js +1 -0
- package/dist/web-dist/_next/static/chunks/0xhe1hasjan-9.css +1 -0
- package/dist/web-dist/_next/static/chunks/1_yae15ffa5f6.js +1 -0
- package/dist/web-dist/_next/static/chunks/2_duynll0m51m.js +30 -0
- package/dist/web-dist/_next/static/chunks/2kcqevsmv6kh2.js +31 -0
- package/dist/web-dist/_next/static/chunks/2s3d1bfr0l4b0.js +1 -0
- package/dist/web-dist/_next/static/chunks/32z87id9k6i2z.js +22 -0
- package/dist/web-dist/_next/static/chunks/3bx2gs3idjmo1.js +1 -0
- package/dist/web-dist/_next/static/chunks/turbopack-3eipe4c-imn5l.js +1 -0
- package/dist/web-dist/_next/static/media/apple-icon.2g7-yefdphkmy.png +0 -0
- package/dist/web-dist/_next/static/media/favicon.3rlors1ui1gw9.ico +0 -0
- package/dist/web-dist/_next/static/media/icon.0580nb9h-ugue.svg +4 -0
- package/dist/web-dist/_next/static/pWHUixFDDvANZeAf-shqT/_buildManifest.js +11 -0
- package/dist/web-dist/_next/static/pWHUixFDDvANZeAf-shqT/_clientMiddlewareManifest.js +1 -0
- package/dist/web-dist/_next/static/pWHUixFDDvANZeAf-shqT/_ssgManifest.js +1 -0
- package/dist/web-dist/_not-found/__next._full.txt +17 -0
- package/dist/web-dist/_not-found/__next._not-found.__PAGE__.txt +23 -0
- package/dist/web-dist/_not-found/__next._tree.txt +3 -0
- package/dist/web-dist/_not-found/index.html +1 -0
- package/dist/web-dist/_not-found/index.txt +17 -0
- package/dist/web-dist/apple-icon.png +0 -0
- package/dist/web-dist/apple-touch-icon.png +0 -0
- package/dist/web-dist/chat/__next._full.txt +18 -0
- package/dist/web-dist/chat/__next._tree.txt +3 -0
- package/dist/web-dist/chat/__next.chat.__PAGE__.txt +24 -0
- package/dist/web-dist/chat/index.html +1 -0
- package/dist/web-dist/chat/index.txt +18 -0
- package/dist/web-dist/favicon.ico +0 -0
- package/dist/web-dist/favicon.svg +4 -0
- package/dist/web-dist/icon.svg +4 -0
- package/dist/web-dist/index.html +1 -0
- package/dist/web-dist/index.txt +32 -0
- package/dist/web-dist/live2d/live2dcubismcore.min.js +9 -0
- package/dist/web-dist/logo-circle.png +0 -0
- package/dist/web-dist/logo-circle.svg +4 -0
- package/dist/web-dist/logo-white.svg +3 -0
- package/dist/web-dist/logo.png +0 -0
- package/dist/web-dist/logo.svg +3 -0
- package/dist/web-dist/operator/__next._full.txt +18 -0
- package/dist/web-dist/operator/__next._tree.txt +3 -0
- package/dist/web-dist/operator/__next.operator.__PAGE__.txt +24 -0
- package/dist/web-dist/operator/index.html +1 -0
- package/dist/web-dist/operator/index.txt +18 -0
- package/dist/web-template.d.ts +2 -0
- package/dist/web-template.js +557 -0
- package/package.json +1 -1
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateWebHtml = generateWebHtml;
|
|
4
|
+
function generateWebHtml(instanceName, manifests) {
|
|
5
|
+
const hasBody = manifests.some((m) => m.organType === 'body');
|
|
6
|
+
const hasVoice = manifests.some((m) => m.organType === 'voice');
|
|
7
|
+
const hasMemory = manifests.some((m) => m.organType === 'memory');
|
|
8
|
+
const hasKnowledge = manifests.some((m) => m.organType === 'knowledge');
|
|
9
|
+
const organBadges = manifests.map((m) => {
|
|
10
|
+
const icon = m.organType === 'brain' ? '🧠'
|
|
11
|
+
: m.organType === 'memory' ? '💾'
|
|
12
|
+
: m.organType === 'voice' ? '🗣️'
|
|
13
|
+
: m.organType === 'body' ? '💃'
|
|
14
|
+
: m.organType === 'knowledge' ? '📚'
|
|
15
|
+
: m.organType === 'hands' ? '🛠️'
|
|
16
|
+
: m.organType === 'vision' ? '👁️'
|
|
17
|
+
: m.organType === 'behavior' ? '⚡'
|
|
18
|
+
: m.organType === 'mouth' ? '👄'
|
|
19
|
+
: '📦';
|
|
20
|
+
return `<span class="badge">${icon} ${m.displayName.split(' ')[0]}</span>`;
|
|
21
|
+
}).join(' ');
|
|
22
|
+
return `<!DOCTYPE html>
|
|
23
|
+
<html lang="en">
|
|
24
|
+
<head>
|
|
25
|
+
<meta charset="UTF-8" />
|
|
26
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
27
|
+
<title>${instanceName} · Siduri Companion</title>
|
|
28
|
+
<style>
|
|
29
|
+
:root {
|
|
30
|
+
--bg: #0b0f19;
|
|
31
|
+
--card-bg: #111827;
|
|
32
|
+
--card-border: #1f2937;
|
|
33
|
+
--text: #f3f4f6;
|
|
34
|
+
--text-dim: #9ca3af;
|
|
35
|
+
--cyan: #06b6d4;
|
|
36
|
+
--cyan-dim: rgba(6, 182, 212, 0.15);
|
|
37
|
+
--green: #10b981;
|
|
38
|
+
--purple: #8b5cf6;
|
|
39
|
+
--accent: #0ea5e9;
|
|
40
|
+
--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
41
|
+
}
|
|
42
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
43
|
+
body {
|
|
44
|
+
background: var(--bg);
|
|
45
|
+
color: var(--text);
|
|
46
|
+
font-family: var(--font);
|
|
47
|
+
height: 100vh;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
header {
|
|
53
|
+
background: var(--card-bg);
|
|
54
|
+
border-bottom: 1px solid var(--card-border);
|
|
55
|
+
padding: 12px 24px;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
}
|
|
60
|
+
.brand {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: 12px;
|
|
64
|
+
}
|
|
65
|
+
.brand h1 {
|
|
66
|
+
font-size: 1.25rem;
|
|
67
|
+
font-weight: 700;
|
|
68
|
+
color: var(--cyan);
|
|
69
|
+
letter-spacing: -0.5px;
|
|
70
|
+
}
|
|
71
|
+
.badges {
|
|
72
|
+
display: flex;
|
|
73
|
+
gap: 6px;
|
|
74
|
+
flex-wrap: wrap;
|
|
75
|
+
}
|
|
76
|
+
.badge {
|
|
77
|
+
background: var(--cyan-dim);
|
|
78
|
+
color: var(--cyan);
|
|
79
|
+
border: 1px solid rgba(6, 182, 212, 0.3);
|
|
80
|
+
padding: 3px 8px;
|
|
81
|
+
border-radius: 9999px;
|
|
82
|
+
font-size: 0.75rem;
|
|
83
|
+
font-weight: 500;
|
|
84
|
+
}
|
|
85
|
+
.tabs {
|
|
86
|
+
display: flex;
|
|
87
|
+
gap: 8px;
|
|
88
|
+
}
|
|
89
|
+
.tab-btn {
|
|
90
|
+
background: transparent;
|
|
91
|
+
border: 1px solid transparent;
|
|
92
|
+
color: var(--text-dim);
|
|
93
|
+
padding: 6px 14px;
|
|
94
|
+
border-radius: 6px;
|
|
95
|
+
font-size: 0.875rem;
|
|
96
|
+
font-weight: 500;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
transition: all 0.2s;
|
|
99
|
+
}
|
|
100
|
+
.tab-btn:hover {
|
|
101
|
+
color: var(--text);
|
|
102
|
+
background: rgba(255, 255, 255, 0.05);
|
|
103
|
+
}
|
|
104
|
+
.tab-btn.active {
|
|
105
|
+
color: var(--cyan);
|
|
106
|
+
background: var(--cyan-dim);
|
|
107
|
+
border-color: rgba(6, 182, 212, 0.4);
|
|
108
|
+
}
|
|
109
|
+
main {
|
|
110
|
+
flex: 1;
|
|
111
|
+
display: flex;
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
}
|
|
114
|
+
.tab-content {
|
|
115
|
+
display: none;
|
|
116
|
+
width: 100%;
|
|
117
|
+
height: 100%;
|
|
118
|
+
}
|
|
119
|
+
.tab-content.active {
|
|
120
|
+
display: flex;
|
|
121
|
+
}
|
|
122
|
+
/* Chat & Avatar Layout */
|
|
123
|
+
.chat-layout {
|
|
124
|
+
width: 100%;
|
|
125
|
+
height: 100%;
|
|
126
|
+
display: grid;
|
|
127
|
+
grid-template-columns: 420px 1fr;
|
|
128
|
+
}
|
|
129
|
+
@media (max-width: 860px) {
|
|
130
|
+
.chat-layout { grid-template-columns: 1fr; grid-template-rows: 240px 1fr; }
|
|
131
|
+
}
|
|
132
|
+
.avatar-pane {
|
|
133
|
+
background: radial-gradient(circle at center, #1a2234 0%, #0b0f19 70%);
|
|
134
|
+
border-right: 1px solid var(--card-border);
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: center;
|
|
139
|
+
position: relative;
|
|
140
|
+
padding: 20px;
|
|
141
|
+
}
|
|
142
|
+
.avatar-stage {
|
|
143
|
+
width: 100%;
|
|
144
|
+
height: 100%;
|
|
145
|
+
display: flex;
|
|
146
|
+
flex-direction: column;
|
|
147
|
+
align-items: center;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
position: relative;
|
|
150
|
+
}
|
|
151
|
+
.avatar-canvas {
|
|
152
|
+
width: 100%;
|
|
153
|
+
max-height: 480px;
|
|
154
|
+
border-radius: 12px;
|
|
155
|
+
object-fit: contain;
|
|
156
|
+
}
|
|
157
|
+
.avatar-portrait {
|
|
158
|
+
width: 160px;
|
|
159
|
+
height: 160px;
|
|
160
|
+
border-radius: 50%;
|
|
161
|
+
background: linear-gradient(135deg, var(--cyan), var(--purple));
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
font-size: 4rem;
|
|
166
|
+
box-shadow: 0 0 30px rgba(6, 182, 212, 0.3);
|
|
167
|
+
animation: float 4s ease-in-out infinite;
|
|
168
|
+
}
|
|
169
|
+
@keyframes float {
|
|
170
|
+
0%, 100% { transform: translateY(0px); }
|
|
171
|
+
50% { transform: translateY(-10px); }
|
|
172
|
+
}
|
|
173
|
+
.expression-badge {
|
|
174
|
+
margin-top: 16px;
|
|
175
|
+
background: rgba(0, 0, 0, 0.4);
|
|
176
|
+
border: 1px solid var(--card-border);
|
|
177
|
+
padding: 6px 14px;
|
|
178
|
+
border-radius: 20px;
|
|
179
|
+
font-size: 0.8rem;
|
|
180
|
+
color: var(--text-dim);
|
|
181
|
+
}
|
|
182
|
+
.chat-pane {
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
height: 100%;
|
|
186
|
+
background: var(--bg);
|
|
187
|
+
}
|
|
188
|
+
.messages-container {
|
|
189
|
+
flex: 1;
|
|
190
|
+
overflow-y: auto;
|
|
191
|
+
padding: 24px;
|
|
192
|
+
display: flex;
|
|
193
|
+
flex-direction: column;
|
|
194
|
+
gap: 16px;
|
|
195
|
+
}
|
|
196
|
+
.message {
|
|
197
|
+
max-width: 80%;
|
|
198
|
+
padding: 12px 16px;
|
|
199
|
+
border-radius: 12px;
|
|
200
|
+
line-height: 1.5;
|
|
201
|
+
font-size: 0.95rem;
|
|
202
|
+
}
|
|
203
|
+
.message.user {
|
|
204
|
+
align-self: flex-end;
|
|
205
|
+
background: var(--cyan);
|
|
206
|
+
color: #000;
|
|
207
|
+
font-weight: 500;
|
|
208
|
+
border-bottom-right-radius: 2px;
|
|
209
|
+
}
|
|
210
|
+
.message.companion {
|
|
211
|
+
align-self: flex-start;
|
|
212
|
+
background: var(--card-bg);
|
|
213
|
+
border: 1px solid var(--card-border);
|
|
214
|
+
color: var(--text);
|
|
215
|
+
border-bottom-left-radius: 2px;
|
|
216
|
+
}
|
|
217
|
+
.message .meta {
|
|
218
|
+
font-size: 0.7rem;
|
|
219
|
+
margin-bottom: 4px;
|
|
220
|
+
color: var(--text-dim);
|
|
221
|
+
}
|
|
222
|
+
.message.user .meta { color: rgba(0, 0, 0, 0.6); }
|
|
223
|
+
.input-area {
|
|
224
|
+
padding: 16px 24px;
|
|
225
|
+
background: var(--card-bg);
|
|
226
|
+
border-top: 1px solid var(--card-border);
|
|
227
|
+
display: flex;
|
|
228
|
+
gap: 12px;
|
|
229
|
+
}
|
|
230
|
+
.input-area input {
|
|
231
|
+
flex: 1;
|
|
232
|
+
background: rgba(0, 0, 0, 0.3);
|
|
233
|
+
border: 1px solid var(--card-border);
|
|
234
|
+
border-radius: 8px;
|
|
235
|
+
padding: 12px 16px;
|
|
236
|
+
color: #fff;
|
|
237
|
+
font-size: 0.95rem;
|
|
238
|
+
outline: none;
|
|
239
|
+
transition: border-color 0.2s;
|
|
240
|
+
}
|
|
241
|
+
.input-area input:focus {
|
|
242
|
+
border-color: var(--cyan);
|
|
243
|
+
}
|
|
244
|
+
.send-btn {
|
|
245
|
+
background: var(--cyan);
|
|
246
|
+
color: #000;
|
|
247
|
+
font-weight: 600;
|
|
248
|
+
border: none;
|
|
249
|
+
padding: 0 20px;
|
|
250
|
+
border-radius: 8px;
|
|
251
|
+
cursor: pointer;
|
|
252
|
+
transition: transform 0.1s, opacity 0.2s;
|
|
253
|
+
}
|
|
254
|
+
.send-btn:hover { opacity: 0.9; }
|
|
255
|
+
.send-btn:active { transform: scale(0.98); }
|
|
256
|
+
|
|
257
|
+
/* Console / Operator Layout */
|
|
258
|
+
.operator-layout {
|
|
259
|
+
width: 100%;
|
|
260
|
+
height: 100%;
|
|
261
|
+
overflow-y: auto;
|
|
262
|
+
padding: 28px;
|
|
263
|
+
display: flex;
|
|
264
|
+
flex-direction: column;
|
|
265
|
+
gap: 24px;
|
|
266
|
+
}
|
|
267
|
+
.card {
|
|
268
|
+
background: var(--card-bg);
|
|
269
|
+
border: 1px solid var(--card-border);
|
|
270
|
+
border-radius: 12px;
|
|
271
|
+
padding: 20px;
|
|
272
|
+
}
|
|
273
|
+
.card-header {
|
|
274
|
+
display: flex;
|
|
275
|
+
justify-content: space-between;
|
|
276
|
+
align-items: center;
|
|
277
|
+
margin-bottom: 16px;
|
|
278
|
+
}
|
|
279
|
+
.card-title {
|
|
280
|
+
font-size: 1.1rem;
|
|
281
|
+
font-weight: 600;
|
|
282
|
+
color: var(--cyan);
|
|
283
|
+
display: flex;
|
|
284
|
+
align-items: center;
|
|
285
|
+
gap: 8px;
|
|
286
|
+
}
|
|
287
|
+
table {
|
|
288
|
+
width: 100%;
|
|
289
|
+
border-collapse: collapse;
|
|
290
|
+
font-size: 0.875rem;
|
|
291
|
+
}
|
|
292
|
+
th {
|
|
293
|
+
text-align: left;
|
|
294
|
+
padding: 10px 12px;
|
|
295
|
+
border-bottom: 1px solid var(--card-border);
|
|
296
|
+
color: var(--text-dim);
|
|
297
|
+
font-weight: 500;
|
|
298
|
+
}
|
|
299
|
+
td {
|
|
300
|
+
padding: 12px;
|
|
301
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
302
|
+
}
|
|
303
|
+
.btn-action {
|
|
304
|
+
background: var(--cyan-dim);
|
|
305
|
+
color: var(--cyan);
|
|
306
|
+
border: 1px solid rgba(6, 182, 212, 0.3);
|
|
307
|
+
padding: 6px 12px;
|
|
308
|
+
border-radius: 6px;
|
|
309
|
+
font-size: 0.8rem;
|
|
310
|
+
cursor: pointer;
|
|
311
|
+
}
|
|
312
|
+
.search-input {
|
|
313
|
+
background: rgba(0, 0, 0, 0.3);
|
|
314
|
+
border: 1px solid var(--card-border);
|
|
315
|
+
border-radius: 6px;
|
|
316
|
+
padding: 6px 12px;
|
|
317
|
+
color: #fff;
|
|
318
|
+
font-size: 0.875rem;
|
|
319
|
+
outline: none;
|
|
320
|
+
}
|
|
321
|
+
</style>
|
|
322
|
+
</head>
|
|
323
|
+
<body>
|
|
324
|
+
<header>
|
|
325
|
+
<div class="brand">
|
|
326
|
+
<h1>◈ SIDURI</h1>
|
|
327
|
+
<span style="font-weight: 600; color: #fff;">${instanceName}</span>
|
|
328
|
+
<div class="badges">
|
|
329
|
+
${organBadges}
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
<div class="tabs">
|
|
333
|
+
<button class="tab-btn active" onclick="switchTab('chat')">💬 Companion Chat</button>
|
|
334
|
+
<button class="tab-btn" onclick="switchTab('operator')">🧠 Memory Console</button>
|
|
335
|
+
<button class="tab-btn" onclick="switchTab('diagnostics')">⚙️ Diagnostics</button>
|
|
336
|
+
</div>
|
|
337
|
+
</header>
|
|
338
|
+
|
|
339
|
+
<main>
|
|
340
|
+
<!-- TAB 1: Chat & Avatar -->
|
|
341
|
+
<div id="tab-chat" class="tab-content active">
|
|
342
|
+
<div class="chat-layout">
|
|
343
|
+
<div class="avatar-pane">
|
|
344
|
+
<div class="avatar-stage">
|
|
345
|
+
<canvas id="live2d-canvas" class="avatar-canvas" style="display: none;"></canvas>
|
|
346
|
+
<div id="avatar-fallback" class="avatar-portrait">✨</div>
|
|
347
|
+
<div id="expression-tag" class="expression-badge">State: Neutral</div>
|
|
348
|
+
</div>
|
|
349
|
+
</div>
|
|
350
|
+
<div class="chat-pane">
|
|
351
|
+
<div id="messages" class="messages-container">
|
|
352
|
+
<div class="message companion">
|
|
353
|
+
<div class="meta">${instanceName}</div>
|
|
354
|
+
Hello! I am your Siduri companion. How can I help you today?
|
|
355
|
+
</div>
|
|
356
|
+
</div>
|
|
357
|
+
<div class="input-area">
|
|
358
|
+
<input id="user-input" type="text" placeholder="Type your message..." autocomplete="off" onkeydown="if(event.key==='Enter') sendMessage()" />
|
|
359
|
+
<button class="send-btn" onclick="sendMessage()">Send ➤</button>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
|
|
365
|
+
<!-- TAB 2: Memory & Claims Console -->
|
|
366
|
+
<div id="tab-operator" class="tab-content">
|
|
367
|
+
<div class="operator-layout">
|
|
368
|
+
<div class="card">
|
|
369
|
+
<div class="card-header">
|
|
370
|
+
<div class="card-title">💾 Authoritative Memory Claims (PostgreSQL FTS)</div>
|
|
371
|
+
<input type="text" class="search-input" placeholder="⌕ Filter claims..." oninput="filterClaims(this.value)" />
|
|
372
|
+
</div>
|
|
373
|
+
<table id="claims-table">
|
|
374
|
+
<thead>
|
|
375
|
+
<tr>
|
|
376
|
+
<th>Subject</th>
|
|
377
|
+
<th>Predicate</th>
|
|
378
|
+
<th>Value</th>
|
|
379
|
+
<th>Type</th>
|
|
380
|
+
<th>Provenance</th>
|
|
381
|
+
<th>Asserted</th>
|
|
382
|
+
</tr>
|
|
383
|
+
</thead>
|
|
384
|
+
<tbody id="claims-body">
|
|
385
|
+
<tr>
|
|
386
|
+
<td colspan="6" style="text-align: center; color: var(--text-dim);">Loading memory claims...</td>
|
|
387
|
+
</tr>
|
|
388
|
+
</tbody>
|
|
389
|
+
</table>
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
<div class="card">
|
|
393
|
+
<div class="card-header">
|
|
394
|
+
<div class="card-title">⚡ Active Behavioral Directives</div>
|
|
395
|
+
</div>
|
|
396
|
+
<div id="directives-list" style="display: flex; flex-direction: column; gap: 10px; font-size: 0.9rem;">
|
|
397
|
+
<div style="color: var(--text-dim);">Loading directives...</div>
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
|
|
403
|
+
<!-- TAB 3: Diagnostics -->
|
|
404
|
+
<div id="tab-diagnostics" class="tab-content">
|
|
405
|
+
<div class="operator-layout">
|
|
406
|
+
<div class="card">
|
|
407
|
+
<div class="card-title" style="margin-bottom: 16px;">⚙️ Organ Probes & Diagnostics</div>
|
|
408
|
+
<div id="diagnostics-content" style="display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px;">
|
|
409
|
+
<div style="color: var(--text-dim);">Probing runtime state...</div>
|
|
410
|
+
</div>
|
|
411
|
+
</div>
|
|
412
|
+
</div>
|
|
413
|
+
</div>
|
|
414
|
+
</main>
|
|
415
|
+
|
|
416
|
+
<script>
|
|
417
|
+
let currentClaims = [];
|
|
418
|
+
|
|
419
|
+
function switchTab(tabId) {
|
|
420
|
+
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
|
|
421
|
+
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
|
|
422
|
+
|
|
423
|
+
const btn = Array.from(document.querySelectorAll('.tab-btn')).find(b => b.getAttribute('onclick').includes(tabId));
|
|
424
|
+
if (btn) btn.classList.add('active');
|
|
425
|
+
|
|
426
|
+
const tab = document.getElementById('tab-' + tabId);
|
|
427
|
+
if (tab) tab.classList.add('active');
|
|
428
|
+
|
|
429
|
+
if (tabId === 'operator') loadClaims();
|
|
430
|
+
if (tabId === 'diagnostics') loadDiagnostics();
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
async function sendMessage() {
|
|
434
|
+
const input = document.getElementById('user-input');
|
|
435
|
+
const text = input.value.trim();
|
|
436
|
+
if (!text) return;
|
|
437
|
+
|
|
438
|
+
input.value = '';
|
|
439
|
+
appendMessage('user', 'You', text);
|
|
440
|
+
|
|
441
|
+
try {
|
|
442
|
+
const res = await fetch('/api/chat', {
|
|
443
|
+
method: 'POST',
|
|
444
|
+
headers: { 'Content-Type': 'application/json' },
|
|
445
|
+
body: JSON.stringify({ message: text })
|
|
446
|
+
});
|
|
447
|
+
const data = await res.json();
|
|
448
|
+
|
|
449
|
+
const replyText =
|
|
450
|
+
data.response?.subtitle_en ||
|
|
451
|
+
data.response?.subtitle_ja ||
|
|
452
|
+
data.reply ||
|
|
453
|
+
data.text ||
|
|
454
|
+
'(No response)';
|
|
455
|
+
|
|
456
|
+
appendMessage('companion', '${instanceName}', replyText);
|
|
457
|
+
|
|
458
|
+
const expression = data.expression || data.metadata?.events?.find(e => e.kind === 'avatar')?.expression;
|
|
459
|
+
if (expression) {
|
|
460
|
+
document.getElementById('expression-tag').textContent = 'State: ' + expression;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const audio = data.response?.audio_url || data.audioUrl;
|
|
464
|
+
if (audio) {
|
|
465
|
+
const audioEl = new Audio(audio);
|
|
466
|
+
audioEl.play().catch(e => console.warn('Audio autoplay blocked:', e));
|
|
467
|
+
}
|
|
468
|
+
} catch (err) {
|
|
469
|
+
appendMessage('companion', '${instanceName}', '⚠️ Error connecting to companion: ' + err.message);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function appendMessage(role, name, text) {
|
|
474
|
+
const container = document.getElementById('messages');
|
|
475
|
+
const div = document.createElement('div');
|
|
476
|
+
div.className = 'message ' + role;
|
|
477
|
+
div.innerHTML = '<div class="meta">' + name + '</div>' + text.replace(/\\n/g, '<br>');
|
|
478
|
+
container.appendChild(div);
|
|
479
|
+
container.scrollTop = container.scrollHeight;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
async function loadClaims() {
|
|
483
|
+
try {
|
|
484
|
+
const res = await fetch('/api/memory/claims');
|
|
485
|
+
const data = await res.json();
|
|
486
|
+
currentClaims = data.claims || [];
|
|
487
|
+
renderClaims(currentClaims);
|
|
488
|
+
|
|
489
|
+
const dirRes = await fetch('/api/memory/directives');
|
|
490
|
+
const dirData = await dirRes.json();
|
|
491
|
+
renderDirectives(dirData.directives || []);
|
|
492
|
+
} catch (err) {
|
|
493
|
+
document.getElementById('claims-body').innerHTML = '<tr><td colspan="6" style="color: #ef4444;">Failed to load claims: ' + err.message + '</td></tr>';
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function renderClaims(claims) {
|
|
498
|
+
const tbody = document.getElementById('claims-body');
|
|
499
|
+
if (!claims || claims.length === 0) {
|
|
500
|
+
tbody.innerHTML = '<tr><td colspan="6" style="text-align: center; color: var(--text-dim);">No authoritative claims stored yet. Chat with your companion to build memory.</td></tr>';
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
tbody.innerHTML = claims.map(c => \`
|
|
504
|
+
<tr>
|
|
505
|
+
<td style="color: var(--cyan); font-weight: 500;">\${c.subject || '-'}</td>
|
|
506
|
+
<td>\${c.predicate || '-'}</td>
|
|
507
|
+
<td>\${c.value || '-'}</td>
|
|
508
|
+
<td><span class="badge">\${c.claim_type || c.claimType || 'semantic'}</span></td>
|
|
509
|
+
<td style="color: var(--text-dim); font-size: 0.8rem;">\${c.provenance || 'direct'}</td>
|
|
510
|
+
<td style="color: var(--text-dim); font-size: 0.8rem;">\${c.asserted_at || c.assertedAt || 'recent'}</td>
|
|
511
|
+
</tr>
|
|
512
|
+
\`).join('');
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
function filterClaims(query) {
|
|
516
|
+
const q = query.toLowerCase();
|
|
517
|
+
const filtered = currentClaims.filter(c =>
|
|
518
|
+
(c.subject || '').toLowerCase().includes(q) ||
|
|
519
|
+
(c.predicate || '').toLowerCase().includes(q) ||
|
|
520
|
+
(c.value || '').toLowerCase().includes(q)
|
|
521
|
+
);
|
|
522
|
+
renderClaims(filtered);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function renderDirectives(directives) {
|
|
526
|
+
const container = document.getElementById('directives-list');
|
|
527
|
+
if (!directives || directives.length === 0) {
|
|
528
|
+
container.innerHTML = '<div style="color: var(--text-dim);">No custom directives set. Using default Active Self compiler.</div>';
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
container.innerHTML = directives.map(d => \`
|
|
532
|
+
<div style="background: rgba(0,0,0,0.2); border: 1px solid var(--card-border); padding: 12px; border-radius: 8px;">
|
|
533
|
+
<div style="font-weight: 600; color: var(--cyan);">\${d.domain || 'core'}: \${d.name || d.directive_id || 'Directive'}</div>
|
|
534
|
+
<div style="color: var(--text-dim); font-size: 0.85rem; margin-top: 4px;">\${d.content || d.value || JSON.stringify(d)}</div>
|
|
535
|
+
</div>
|
|
536
|
+
\`).join('');
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
async function loadDiagnostics() {
|
|
540
|
+
try {
|
|
541
|
+
const res = await fetch('/api/status');
|
|
542
|
+
const data = await res.json();
|
|
543
|
+
const container = document.getElementById('diagnostics-content');
|
|
544
|
+
container.innerHTML = Object.entries(data.organs || {}).map(([key, val]) => \`
|
|
545
|
+
<div style="background: rgba(0,0,0,0.2); border: 1px solid var(--card-border); padding: 16px; border-radius: 8px;">
|
|
546
|
+
<div style="font-weight: 600; color: var(--cyan); font-size: 1rem; margin-bottom: 8px;">\${key.toUpperCase()}</div>
|
|
547
|
+
<pre style="font-size: 0.8rem; color: var(--text-dim); overflow-x: auto;">\${JSON.stringify(val, null, 2)}</pre>
|
|
548
|
+
</div>
|
|
549
|
+
\`).join('');
|
|
550
|
+
} catch (err) {
|
|
551
|
+
document.getElementById('diagnostics-content').innerHTML = '<div style="color: #ef4444;">Failed to fetch diagnostics: ' + err.message + '</div>';
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
</script>
|
|
555
|
+
</body>
|
|
556
|
+
</html>`;
|
|
557
|
+
}
|