oculon 0.1.1 → 0.1.3
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 +33 -20
- package/dist/agent.d.ts +25 -1
- package/dist/agent.js +14 -4
- package/dist/analyst.d.ts +99 -0
- package/dist/analyst.js +335 -0
- package/dist/cli/main.js +1 -1
- package/dist/core/llm.d.ts +2 -0
- package/dist/core/llm.js +29 -0
- package/dist/mcp.js +1 -1
- package/dist/modules/personal.js +1 -1
- package/dist/web/ask.html +410 -0
- package/dist/web/assets/favicon-32.png +0 -0
- package/dist/web/assets/fx.js +49 -0
- package/dist/web/assets/icon-192.png +0 -0
- package/dist/web/assets/icon-512.png +0 -0
- package/dist/web/assets/icon-maskable-512.png +0 -0
- package/dist/web/assets/logo.svg +1 -0
- package/dist/web/assets/og.png +0 -0
- package/dist/web/docs.html +31 -8
- package/dist/web/index.html +16 -9
- package/dist/web/landing.html +12 -6
- package/dist/web/legal.html +9 -5
- package/dist/web/manifest.webmanifest +31 -7
- package/dist/web/mcp.html +7 -3
- package/dist/web/server.js +87 -4
- package/dist/web/share.js +1 -1
- package/package.json +10 -10
|
@@ -0,0 +1,410 @@
|
|
|
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, viewport-fit=cover">
|
|
6
|
+
<meta name="theme-color" content="#000000">
|
|
7
|
+
<link rel="icon" type="image/png" href="/favicon.ico">
|
|
8
|
+
<link rel="apple-touch-icon" href="/assets/icon-192.png">
|
|
9
|
+
<title>Oculon Analyst</title>
|
|
10
|
+
<meta name="description" content="Ask a question; Oculon checks live public data, then answers with a brief: bottom line, confidence, cited findings, and a cross-examination by other models.">
|
|
11
|
+
<meta property="og:type" content="website"><meta property="og:site_name" content="Oculon"><meta property="og:title" content="Oculon Analyst"><meta property="og:description" content="Ask anything. It checks live public data first, then answers with a cited brief you can cross-examine."><meta property="og:image" content="https://oculon.live/assets/og.png"><meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta name="twitter:card" content="summary_large_image"><meta name="twitter:image" content="https://oculon.live/assets/og.png">
|
|
12
|
+
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
13
|
+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap" rel="stylesheet">
|
|
14
|
+
<style>
|
|
15
|
+
/* no sideways scrolling on phones: wide tables and code scroll inside their own boxes */
|
|
16
|
+
html,body{overflow-x:clip;max-width:100%}
|
|
17
|
+
.lm{display:inline-block;width:22px;height:22px;vertical-align:-4px;margin-right:12px}
|
|
18
|
+
:root{--bg:#000;--panel:rgba(5,9,10,.86);--line:#1c2629;--line2:#263438;--text:#f2f6f7;--soft:#c9d3d5;--mut:#8b9a9e;--dim:#56666a;--y:#00f0ff;--ok:#3ddc97;--warn:#ffc857;--bad:#ff5d6c;--sans:'Space Grotesk',system-ui,sans-serif;--mono:'Space Mono',ui-monospace,Consolas,monospace}
|
|
19
|
+
*{box-sizing:border-box}
|
|
20
|
+
body{margin:0;background:var(--bg);color:var(--text);font-family:var(--sans);-webkit-font-smoothing:antialiased;min-height:100vh}
|
|
21
|
+
a{color:inherit}
|
|
22
|
+
button{font:inherit;color:inherit}
|
|
23
|
+
#liquidbg{position:fixed;inset:0;width:100%;height:100%;z-index:0;pointer-events:none;opacity:.34}
|
|
24
|
+
header,main,.dock{position:relative;z-index:1}
|
|
25
|
+
header{position:sticky;top:0;z-index:20;background:#000;border-bottom:1px solid var(--line)}
|
|
26
|
+
header .in{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px clamp(16px,3vw,36px);max-width:1180px;margin:0 auto}
|
|
27
|
+
.logo{font-size:17px;font-weight:600;letter-spacing:.4em;text-decoration:none}
|
|
28
|
+
.logo span{color:var(--y);letter-spacing:.22em;font-weight:400;margin-left:8px}
|
|
29
|
+
header nav{display:flex;gap:20px;align-items:center;font-size:14px}
|
|
30
|
+
header nav a{text-decoration:none;color:var(--soft)}
|
|
31
|
+
header nav .btn{background:var(--y);color:#001418;padding:8px 13px;font-weight:600}
|
|
32
|
+
@media (max-width:560px){header nav .opt{display:none}}
|
|
33
|
+
.lbl{font:11.5px var(--mono);letter-spacing:.14em;text-transform:uppercase;color:var(--mut)}
|
|
34
|
+
main{max-width:880px;margin:0 auto;padding:40px clamp(16px,3vw,28px) 260px}
|
|
35
|
+
|
|
36
|
+
/* intro */
|
|
37
|
+
.intro h1{margin:14px 0 14px;font-size:clamp(36px,6.4vw,64px);font-weight:300;letter-spacing:-.04em;line-height:1.02}
|
|
38
|
+
.intro h1 em{font-style:normal;color:var(--y)}
|
|
39
|
+
.intro p{font-size:clamp(16px,2vw,19px);line-height:1.6;color:var(--soft);font-weight:300;max-width:660px;margin:0}
|
|
40
|
+
.how{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:30px 0 8px}
|
|
41
|
+
.how div{border:1px solid var(--line);background:var(--panel);padding:14px}
|
|
42
|
+
.how b{display:block;font:11px var(--mono);color:var(--y);letter-spacing:.12em;margin-bottom:6px}
|
|
43
|
+
.how span{font-size:14px;line-height:1.45;color:var(--soft)}
|
|
44
|
+
@media (max-width:720px){.how{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
|
45
|
+
.examples{display:flex;flex-wrap:wrap;gap:8px;margin-top:22px}
|
|
46
|
+
.chip{border:1px solid var(--line2);background:rgba(0,0,0,.55);padding:9px 12px;font-size:14px;color:var(--soft);cursor:pointer;text-align:left;line-height:1.35}
|
|
47
|
+
.chip:hover{border-color:var(--y);color:#fff}
|
|
48
|
+
|
|
49
|
+
/* thread */
|
|
50
|
+
.turn{margin-top:46px}
|
|
51
|
+
.q{display:flex;gap:12px;align-items:baseline;font-size:clamp(19px,2.6vw,24px);font-weight:400;line-height:1.35;letter-spacing:-.01em}
|
|
52
|
+
.q .lbl{flex:none;color:var(--y)}
|
|
53
|
+
.trace{margin-top:16px;border:1px solid var(--line);background:var(--panel);display:grid;grid-template-columns:118px minmax(0,1fr);gap:0}
|
|
54
|
+
.radar{border-right:1px solid var(--line);display:grid;place-items:center;padding:14px}
|
|
55
|
+
.radar svg{width:86px;height:86px}
|
|
56
|
+
.sweep{transform-origin:50px 50px;animation:sweep 2.4s linear infinite}
|
|
57
|
+
.trace.done .sweep{animation:none;opacity:0}
|
|
58
|
+
@keyframes sweep{to{transform:rotate(360deg)}}
|
|
59
|
+
.blip{fill:var(--y);opacity:0;animation:blip 1.6s ease-out forwards}
|
|
60
|
+
@keyframes blip{0%{opacity:1;r:4}100%{opacity:.55;r:2.2}}
|
|
61
|
+
.steps{list-style:none;margin:0;padding:10px 14px;min-width:0}
|
|
62
|
+
.steps li{display:grid;grid-template-columns:16px minmax(0,1fr) auto;gap:10px;align-items:baseline;padding:7px 0;border-bottom:1px dashed #152023;font-size:14px}
|
|
63
|
+
.steps li:last-child{border-bottom:0}
|
|
64
|
+
.steps .st{font:12px var(--mono);color:var(--mut)}
|
|
65
|
+
.steps .st.ok{color:var(--ok)}.steps .st.err{color:var(--bad)}
|
|
66
|
+
.steps .nm{color:#fff;overflow-wrap:anywhere}.steps .nm small{display:block;color:var(--dim);font:11.5px var(--mono);margin-top:2px;overflow-wrap:anywhere}
|
|
67
|
+
.steps .meta{font:11.5px var(--mono);color:var(--mut);white-space:nowrap}
|
|
68
|
+
.spin{display:inline-block;width:10px;height:10px;border:1.5px solid var(--y);border-right-color:transparent;border-radius:50%;animation:sp .8s linear infinite}
|
|
69
|
+
@keyframes sp{to{transform:rotate(360deg)}}
|
|
70
|
+
.thinking{padding:10px 14px;font:12px var(--mono);color:var(--mut)}
|
|
71
|
+
.thinking i{color:var(--y);font-style:normal}
|
|
72
|
+
@media (max-width:560px){.trace{grid-template-columns:1fr}.radar{border-right:0;border-bottom:1px solid var(--line);padding:10px}.radar svg{width:64px;height:64px}}
|
|
73
|
+
|
|
74
|
+
/* brief */
|
|
75
|
+
.brief{margin-top:14px;border:1px solid var(--line2);background:rgba(3,7,8,.92);position:relative}
|
|
76
|
+
.brief::before{content:'';position:absolute;left:-1px;top:-1px;width:56px;height:2px;background:var(--y)}
|
|
77
|
+
.bhead{display:flex;flex-wrap:wrap;gap:8px 16px;justify-content:space-between;padding:14px 20px;border-bottom:1px solid var(--line)}
|
|
78
|
+
.bbody{padding:20px}
|
|
79
|
+
.brief h2{margin:0 0 10px;font-size:clamp(22px,3.4vw,30px);font-weight:500;letter-spacing:-.02em;line-height:1.2}
|
|
80
|
+
.bl{font-size:clamp(17px,2.2vw,19px);line-height:1.6;color:var(--soft);margin:0}
|
|
81
|
+
.conf{display:grid;grid-template-columns:auto minmax(0,1fr);gap:6px 16px;align-items:center;margin:20px 0 4px;padding:14px 16px;border:1px solid var(--line);background:rgba(0,0,0,.5)}
|
|
82
|
+
.conf .num{font:700 30px var(--mono);line-height:1}
|
|
83
|
+
.conf .bar{height:6px;background:#11191b;position:relative;overflow:hidden}
|
|
84
|
+
.conf .bar i{position:absolute;inset:0 auto 0 0;width:0;transition:width 1s cubic-bezier(.2,.8,.2,1)}
|
|
85
|
+
.conf .why{grid-column:1/-1;font-size:14px;line-height:1.5;color:var(--mut);margin:4px 0 0}
|
|
86
|
+
.conf .lv{font:11.5px var(--mono);letter-spacing:.12em;text-transform:uppercase;margin-bottom:6px}
|
|
87
|
+
.sec{margin-top:22px}
|
|
88
|
+
.sec h3{font:11.5px var(--mono);letter-spacing:.14em;text-transform:uppercase;color:var(--mut);margin:0 0 10px;font-weight:400}
|
|
89
|
+
.findings{list-style:none;margin:0;padding:0;counter-reset:f}
|
|
90
|
+
.findings li{display:grid;grid-template-columns:30px minmax(0,1fr);gap:10px;padding:11px 0;border-top:1px solid #121b1d}
|
|
91
|
+
.findings li:first-child{border-top:0}
|
|
92
|
+
.findings .ix{font:12px var(--mono);color:var(--y);padding-top:3px}
|
|
93
|
+
.findings p{margin:0;font-size:16px;line-height:1.6;color:#e7eeef}
|
|
94
|
+
.cite{display:inline-block;font:11px var(--mono);color:var(--y);border:1px solid #0f3c40;background:#031416;padding:0 5px;margin-left:4px;cursor:pointer;vertical-align:1px;text-decoration:none}
|
|
95
|
+
.cite:hover{background:var(--y);color:#001418}
|
|
96
|
+
.verdicts{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
|
|
97
|
+
.vd{font:11px var(--mono);padding:2px 7px;border:1px solid}
|
|
98
|
+
.vd.supported{color:var(--ok);border-color:#1d5a42}.vd.partly{color:var(--warn);border-color:#5d4a1c}.vd.unsupported{color:var(--bad);border-color:#5e2128}
|
|
99
|
+
.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}
|
|
100
|
+
.two>div{border:1px solid var(--line);padding:14px;background:rgba(0,0,0,.4)}
|
|
101
|
+
.two ul{margin:0;padding-left:18px}.two li,.two p{font-size:14.5px;line-height:1.55;color:var(--soft);margin:0 0 4px}
|
|
102
|
+
@media (max-width:640px){.two{grid-template-columns:1fr}}
|
|
103
|
+
.srcs{list-style:none;margin:0;padding:0}
|
|
104
|
+
.srcs li{display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:10px;align-items:baseline;padding:7px 6px;border-top:1px solid #121b1d;font-size:14px}
|
|
105
|
+
.srcs li.hl{background:#04262a;outline:1px solid var(--y)}
|
|
106
|
+
.srcs .n{font:12px var(--mono);color:var(--y)}
|
|
107
|
+
.srcs .t{overflow-wrap:anywhere;color:var(--soft)}.srcs .t a{color:#fff;text-decoration-color:var(--y);text-underline-offset:3px}
|
|
108
|
+
.srcs .t small{color:var(--dim);font:11.5px var(--mono);margin-left:6px}
|
|
109
|
+
.pill{font:10.5px var(--mono);letter-spacing:.08em;padding:1px 6px;border:1px solid var(--line2);color:var(--mut);white-space:nowrap}
|
|
110
|
+
.pill.LIVE{color:var(--ok);border-color:#1d5a42}.pill.CACHED{color:var(--y);border-color:#0f3c40}.pill.ERROR,.pill.UNAVAILABLE{color:var(--bad);border-color:#5e2128}
|
|
111
|
+
.more{background:none;border:0;color:var(--mut);font:12px var(--mono);cursor:pointer;padding:8px 6px}
|
|
112
|
+
.actions{display:flex;flex-wrap:wrap;gap:8px;padding:16px 20px;border-top:1px solid var(--line)}
|
|
113
|
+
.act{border:1px solid var(--line2);background:#000;padding:10px 14px;font-size:14px;cursor:pointer;color:#fff}
|
|
114
|
+
.act:hover{border-color:var(--y)}
|
|
115
|
+
.act.primary{background:var(--y);color:#001418;border-color:var(--y);font-weight:600}
|
|
116
|
+
.act[disabled]{opacity:.55;cursor:default}
|
|
117
|
+
.review{margin:0 20px 18px;border:1px solid var(--line);padding:14px 16px;background:rgba(0,0,0,.45)}
|
|
118
|
+
.review p{margin:4px 0;font-size:14.5px;line-height:1.55;color:var(--soft)}
|
|
119
|
+
.review b{color:#fff;font-weight:500}
|
|
120
|
+
.follow{display:flex;flex-wrap:wrap;gap:8px;padding:0 20px 20px}
|
|
121
|
+
.plan{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:12px 14px 4px}
|
|
122
|
+
.plan .lbl{color:var(--y);margin-right:4px}
|
|
123
|
+
.plan .part{display:inline-flex;align-items:baseline;gap:6px;border:1px solid var(--line2);padding:3px 8px;font-size:13px;color:var(--soft);line-height:1.35}
|
|
124
|
+
.plan .part b{font:11px var(--mono);color:var(--y)}
|
|
125
|
+
.details{margin-top:16px;padding:14px 16px;border-left:2px solid var(--y);background:rgba(0,240,255,.03)}
|
|
126
|
+
.details p,.details li{font-size:15.5px;line-height:1.65;color:#dfe8e9;margin:0 0 8px}
|
|
127
|
+
.details ul{margin:0 0 8px;padding-left:20px}
|
|
128
|
+
.details p:last-child,.details ul:last-child{margin-bottom:0}
|
|
129
|
+
.err{margin-top:14px;border:1px solid #5e2128;background:#140507;padding:14px 16px;color:#ffc9ce;font-size:15px;line-height:1.5}
|
|
130
|
+
|
|
131
|
+
/* dock */
|
|
132
|
+
.dock{position:fixed;left:0;right:0;bottom:0;z-index:30;background:linear-gradient(180deg,transparent,#000 22%);padding:26px clamp(12px,3vw,28px) calc(14px + env(safe-area-inset-bottom))}
|
|
133
|
+
.dock .in{max-width:880px;margin:0 auto}
|
|
134
|
+
.models{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-bottom:8px;max-width:560px}
|
|
135
|
+
.model{border:1px solid var(--line2);background:rgba(0,0,0,.8);padding:7px 10px;cursor:pointer;text-align:left;line-height:1.2;min-width:0}
|
|
136
|
+
.model b{display:block;font-size:13.5px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
137
|
+
@media (max-width:480px){.model{padding:6px 8px}.model b{font-size:12.5px}.model small{font-size:9.5px}.dock{padding-top:18px}}
|
|
138
|
+
.model small{font:10.5px var(--mono);color:var(--mut);letter-spacing:.06em;text-transform:uppercase}
|
|
139
|
+
.model[aria-pressed="true"]{border-color:var(--y);background:#021a1d}
|
|
140
|
+
.model[aria-pressed="true"] small{color:var(--y)}
|
|
141
|
+
.box{display:flex;align-items:flex-end;gap:8px;border:1px solid var(--y);background:#020b0c;padding:8px 8px 8px 14px;box-shadow:0 0 0 4px rgba(0,240,255,.06)}
|
|
142
|
+
.box .pr{font:13px var(--mono);color:var(--y);padding-bottom:9px}
|
|
143
|
+
.box textarea{flex:1;min-width:0;resize:none;border:0;outline:0;background:transparent;color:#fff;font:16px/1.5 var(--sans);max-height:160px;padding:6px 0}
|
|
144
|
+
.box textarea::placeholder{color:var(--dim)}
|
|
145
|
+
.send{background:var(--y);color:#001418;border:0;padding:10px 16px;font-weight:600;cursor:pointer}
|
|
146
|
+
.send[disabled]{opacity:.5;cursor:default}
|
|
147
|
+
.dockfoot{display:flex;justify-content:space-between;gap:10px;margin-top:7px;font:11px var(--mono);color:var(--dim)}
|
|
148
|
+
.dockfoot button{background:none;border:0;color:var(--mut);font:11px var(--mono);cursor:pointer;padding:0}
|
|
149
|
+
</style>
|
|
150
|
+
</head>
|
|
151
|
+
<body>
|
|
152
|
+
<canvas id="liquidbg" aria-hidden="true"></canvas>
|
|
153
|
+
<header><div class="in"><a class="logo" href="/"><img class="lm" src="/assets/logo.svg" alt="" width="22" height="22">OCULON<span>ANALYST</span></a><nav><a class="opt" href="/docs">Docs</a><a class="opt" href="/mcp">MCP</a><a class="btn" href="/app">Open app</a></nav></div></header>
|
|
154
|
+
<main>
|
|
155
|
+
<section class="intro" id="intro">
|
|
156
|
+
<div class="lbl"><span style="color:var(--y)">●</span> Analyst desk · checks live public data before it answers</div>
|
|
157
|
+
<h1>Ask anything.<br>Get a <em>brief</em>, not a guess.</h1>
|
|
158
|
+
<p>About Oculon, about the world, or anything else. It splits your question into parts, checks each one against live sources (outages, vulnerabilities, quakes, flights, scams, papers, news) or searches and reads the web, then writes a brief: the bottom line, how sure it is, each finding with its source, and what it could not see. Then let other models cross-examine it.</p>
|
|
159
|
+
<div class="how">
|
|
160
|
+
<div><b>01 · CHECK</b><span>Live tools run first; you watch every source it touches.</span></div>
|
|
161
|
+
<div><b>02 · BRIEF</b><span>Bottom line, confidence 0-100 and numbered citations.</span></div>
|
|
162
|
+
<div><b>03 · CROSS-EXAMINE</b><span>Two other models judge each finding against the same evidence.</span></div>
|
|
163
|
+
<div><b>04 · WATCH</b><span>Turn any answer into a monitor that tells you when it changes.</span></div>
|
|
164
|
+
</div>
|
|
165
|
+
<div class="examples" id="examples">
|
|
166
|
+
<button class="chip" type="button">Is there an internet outage in Iran right now?</button>
|
|
167
|
+
<button class="chip" type="button">Is paypa1-secure-login.top safe to open?</button>
|
|
168
|
+
<button class="chip" type="button">Any critical CVEs for nginx this month?</button>
|
|
169
|
+
<button class="chip" type="button">What is the travel risk for Bangkok this week?</button>
|
|
170
|
+
<button class="chip" type="button">Is this a scam: "Your package is on hold, pay the $1.99 customs fee today"</button>
|
|
171
|
+
<button class="chip" type="button">Were there strong earthquakes near Japan in the last 48 hours?</button>
|
|
172
|
+
<button class="chip" type="button">How do I connect Oculon to Claude, and what can it do there?</button>
|
|
173
|
+
<button class="chip" type="button">What caused the 2003 Northeast blackout, and could it happen again?</button>
|
|
174
|
+
</div>
|
|
175
|
+
</section>
|
|
176
|
+
<div id="thread"></div>
|
|
177
|
+
</main>
|
|
178
|
+
<div class="dock">
|
|
179
|
+
<div class="in">
|
|
180
|
+
<div class="models" id="models" role="group" aria-label="Model">
|
|
181
|
+
<button class="model" type="button" data-m="haiku" aria-pressed="true"><b>Haiku 5.5</b><small>fast</small></button>
|
|
182
|
+
<button class="model" type="button" data-m="opus" aria-pressed="false"><b>Opus 5.5</b><small>thorough</small></button>
|
|
183
|
+
<button class="model" type="button" data-m="gpt" aria-pressed="false"><b>GPT-6.2 Astra</b><small>second view</small></button>
|
|
184
|
+
</div>
|
|
185
|
+
<form class="box" id="form"><span class="pr">></span><textarea id="q" rows="1" maxlength="600" placeholder="Ask about an event, a link, a place, a vulnerability, a message…" aria-label="Your question"></textarea><button class="send" id="send" type="submit">Ask</button></form>
|
|
186
|
+
<div class="dockfoot"><span id="hint">Enter to ask · Shift+Enter for a new line</span><button type="button" id="clear">New session</button></div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
<script src="/assets/fx.js"></script>
|
|
190
|
+
<script>
|
|
191
|
+
if (window.OculonFX) { try { OculonFX.liquid(document.getElementById('liquidbg'), { base: '#000000', mid: '#001a26', hi: '#00c8e0', intensity: 0.8, scale: 0.3 }); } catch {} }
|
|
192
|
+
const $ = (id) => document.getElementById(id);
|
|
193
|
+
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
194
|
+
const MODELS = { haiku: 'Claude Haiku 5.5', opus: 'Claude Opus 5.5', gpt: 'GPT-6.2 Astra' };
|
|
195
|
+
const store = { get(k, d) { try { const v = localStorage.getItem(k); return v ? JSON.parse(v) : d; } catch { return d; } }, set(k, v) { try { localStorage.setItem(k, JSON.stringify(v)); } catch {} } };
|
|
196
|
+
let model = store.get('oculon.analyst.model', 'haiku');
|
|
197
|
+
let turns = store.get('oculon.analyst.turns', []);
|
|
198
|
+
let busy = false;
|
|
199
|
+
|
|
200
|
+
/* model picker */
|
|
201
|
+
const pick = (m) => { model = MODELS[m] ? m : 'haiku'; store.set('oculon.analyst.model', model); document.querySelectorAll('.model').forEach((b) => b.setAttribute('aria-pressed', String(b.dataset.m === model))); };
|
|
202
|
+
document.querySelectorAll('.model').forEach((b) => b.addEventListener('click', () => pick(b.dataset.m)));
|
|
203
|
+
pick(model);
|
|
204
|
+
|
|
205
|
+
/* composer */
|
|
206
|
+
const q = $('q');
|
|
207
|
+
const grow = () => { q.style.height = 'auto'; q.style.height = Math.min(160, q.scrollHeight) + 'px'; };
|
|
208
|
+
q.addEventListener('input', grow);
|
|
209
|
+
q.addEventListener('keydown', (e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); $('form').requestSubmit(); } });
|
|
210
|
+
$('form').addEventListener('submit', (e) => { e.preventDefault(); const text = q.value.trim(); if (text.length >= 3 && !busy) { q.value = ''; grow(); askQuestion(text); } });
|
|
211
|
+
$('examples').addEventListener('click', (e) => { const c = e.target.closest('.chip'); if (c && !busy) askQuestion(c.textContent.trim()); });
|
|
212
|
+
$('clear').addEventListener('click', () => { if (busy) return; turns = []; store.set('oculon.analyst.turns', turns); $('thread').innerHTML = ''; $('intro').hidden = false; scrollTo({ top: 0, behavior: 'smooth' }); });
|
|
213
|
+
|
|
214
|
+
/* radar: a sweep, and a blip for every source found */
|
|
215
|
+
const radarSvg = () => `<svg viewBox="0 0 100 100" aria-hidden="true"><defs><linearGradient id="sw" x1="0" x2="1"><stop offset="0" stop-color="#00f0ff" stop-opacity="0"/><stop offset="1" stop-color="#00f0ff" stop-opacity=".55"/></linearGradient></defs>
|
|
216
|
+
<circle cx="50" cy="50" r="46" fill="none" stroke="#1c2629"/><circle cx="50" cy="50" r="30" fill="none" stroke="#162023"/><circle cx="50" cy="50" r="14" fill="none" stroke="#162023"/>
|
|
217
|
+
<line x1="4" y1="50" x2="96" y2="50" stroke="#121a1c"/><line x1="50" y1="4" x2="50" y2="96" stroke="#121a1c"/>
|
|
218
|
+
<path class="sweep" d="M50 50 L50 4 A46 46 0 0 1 89.8 27 Z" fill="url(#sw)"/><g class="blips"></g><circle cx="50" cy="50" r="2" fill="#00f0ff"/></svg>`;
|
|
219
|
+
const addBlip = (svg, i) => { const a = (i * 137.5) * Math.PI / 180, r = 12 + ((i * 29) % 32); const c = document.createElementNS('http://www.w3.org/2000/svg', 'circle'); c.setAttribute('cx', (50 + r * Math.cos(a)).toFixed(1)); c.setAttribute('cy', (50 + r * Math.sin(a)).toFixed(1)); c.setAttribute('r', '3'); c.setAttribute('class', 'blip'); svg.querySelector('.blips').appendChild(c); };
|
|
220
|
+
|
|
221
|
+
const level = (c) => c >= 75 ? ['High', 'var(--ok)'] : c >= 45 ? ['Moderate', 'var(--warn)'] : ['Low', 'var(--bad)'];
|
|
222
|
+
/* the analyst's plan: the parts it split the question into */
|
|
223
|
+
const planHtml = (parts) => parts && parts.length ? `<div class="plan"><span class="lbl">Plan</span>${parts.map((p, i) => `<span class="part"><b>${i + 1}</b>${esc(p)}</span>`).join('')}</div>` : '';
|
|
224
|
+
/* details: short paragraphs and "- " bullets, with [n] citations made clickable */
|
|
225
|
+
function detailsHtml(text) {
|
|
226
|
+
const cite = (s) => esc(s).replace(/\[(\d{1,3})\]/g, (_, n) => `<a class="cite" data-n="${n}" href="#">${n}</a>`);
|
|
227
|
+
const out = []; let list = [];
|
|
228
|
+
const flush = () => { if (list.length) { out.push(`<ul>${list.map((l) => `<li>${cite(l)}</li>`).join('')}</ul>`); list = []; } };
|
|
229
|
+
for (const line of String(text).split(/\n+/)) {
|
|
230
|
+
const l = line.trim(); if (!l) continue;
|
|
231
|
+
if (/^[-*•]\s+/.test(l) || /^\d+[.)]\s+/.test(l)) list.push(l.replace(/^([-*•]|\d+[.)])\s+/, ''));
|
|
232
|
+
else { flush(); out.push(`<p>${cite(l)}</p>`); }
|
|
233
|
+
}
|
|
234
|
+
flush();
|
|
235
|
+
return out.join('');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* one brief */
|
|
239
|
+
function renderBrief(t) {
|
|
240
|
+
const b = t.brief, src = t.sources || [];
|
|
241
|
+
const [lv, color] = level(b.confidence);
|
|
242
|
+
const live = src.filter((s) => s.status === 'LIVE').length;
|
|
243
|
+
const cites = (ns) => (ns || []).map((n) => `<a class="cite" data-n="${n}" href="#">${n}</a>`).join('');
|
|
244
|
+
const srcRow = (s) => `<li data-n="${s.n}"><span class="n">[${s.n}]</span><span class="t">${s.url ? `<a href="${esc(s.url)}" target="_blank" rel="noopener">${esc(s.label)}</a>` : esc(s.label)}<small>${esc(s.kind === 'feed' ? 'data feed' : s.host || '')}</small></span>${s.status ? `<span class="pill ${esc(s.status)}">${esc(s.status)}</span>` : '<span></span>'}</li>`;
|
|
245
|
+
const cited = new Set(b.findings.flatMap((f) => f.sources));
|
|
246
|
+
const first = src.filter((s) => cited.has(s.n)), rest = src.filter((s) => !cited.has(s.n));
|
|
247
|
+
const others = Object.keys(MODELS).filter((m) => m !== t.model).map((m) => MODELS[m]).join(' + ');
|
|
248
|
+
return `<article class="brief" data-id="${esc(t.id)}">
|
|
249
|
+
<div class="bhead"><span class="lbl">Brief · ${esc(MODELS[t.model] || t.model)}</span><span class="lbl">${src.length} sources · ${live} live · ${Math.round((t.ms || 0) / 1000)}s</span></div>
|
|
250
|
+
<div class="bbody">
|
|
251
|
+
${b.headline ? `<h2>${esc(b.headline)}</h2>` : ''}
|
|
252
|
+
<p class="bl">${esc(b.bottomLine)}</p>
|
|
253
|
+
${b.details ? `<div class="details">${detailsHtml(b.details)}</div>` : ''}
|
|
254
|
+
<div class="conf"><div class="num" style="color:${color}">${b.confidence}</div><div><div class="lv" style="color:${color}">${lv} confidence</div><div class="bar"><i style="background:${color}" data-w="${b.confidence}"></i></div></div>${b.confidenceWhy ? `<p class="why">${esc(b.confidenceWhy)}</p>` : ''}</div>
|
|
255
|
+
${b.findings.length ? `<div class="sec"><h3>Findings</h3><ol class="findings">${b.findings.map((f, i) => `<li data-i="${i}"><span class="ix">${String(i + 1).padStart(2, '0')}</span><div><p>${esc(f.text)}${cites(f.sources)}</p><div class="verdicts"></div></div></li>`).join('')}</ol></div>` : ''}
|
|
256
|
+
${b.unknowns.length || b.changeMyMind ? `<div class="sec two">${b.unknowns.length ? `<div><h3 class="lbl" style="margin:0 0 8px">Not known yet</h3><ul>${b.unknowns.map((u) => `<li>${esc(u)}</li>`).join('')}</ul></div>` : ''}${b.changeMyMind ? `<div><h3 class="lbl" style="margin:0 0 8px">Would change this</h3><p>${esc(b.changeMyMind)}</p></div>` : ''}</div>` : ''}
|
|
257
|
+
${src.length ? `<div class="sec"><h3>Sources</h3><ol class="srcs">${first.map(srcRow).join('')}${rest.length ? `<li class="restwrap" style="display:block;border:0;padding:0"><button class="more" type="button">+ ${rest.length} more checked</button><ol class="srcs rest" hidden>${rest.map(srcRow).join('')}</ol></li>` : ''}</ol></div>` : ''}
|
|
258
|
+
</div>
|
|
259
|
+
<div class="actions">
|
|
260
|
+
${b.findings.length ? `<button class="act primary" type="button" data-act="review">Cross-examine with ${esc(others)}</button>` : ''}
|
|
261
|
+
${b.watch ? `<button class="act" type="button" data-act="watch" data-text="${esc(b.watch)}">Watch: ${esc(b.watch)}</button>` : ''}
|
|
262
|
+
<button class="act" type="button" data-act="copy">Copy brief</button>
|
|
263
|
+
</div>
|
|
264
|
+
<div class="reviewbox"></div>
|
|
265
|
+
${b.followUps.length ? `<div class="follow">${b.followUps.map((f) => `<button class="chip" type="button" data-follow>${esc(f)}</button>`).join('')}</div>` : ''}
|
|
266
|
+
</article>`;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function renderReview(card, data) {
|
|
270
|
+
const lines = [];
|
|
271
|
+
for (const r of data.reviews) {
|
|
272
|
+
if (r.error) { lines.push(`<p><b>${esc(r.label)}</b>: could not review (${esc(r.error)})</p>`); continue; }
|
|
273
|
+
lines.push(`<p><b>${esc(r.label)}</b> ${r.bottomLine === 'agree' ? 'agrees with the bottom line' : r.bottomLine === 'disagree' ? 'disagrees with the bottom line' : 'partly agrees with the bottom line'}${r.missed ? `. Missed: ${esc(r.missed)}` : '.'}</p>`);
|
|
274
|
+
for (const f of r.findings) {
|
|
275
|
+
const box = card.querySelector(`.findings li[data-i="${f.i}"] .verdicts`);
|
|
276
|
+
if (box) box.insertAdjacentHTML('beforeend', `<span class="vd ${esc(f.verdict)}" title="${esc(f.note)}">${esc(r.label.replace(/^Claude /, ''))}: ${esc(f.verdict)}</span>`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const all = data.reviews.flatMap((r) => r.findings);
|
|
280
|
+
const ok = all.filter((f) => f.verdict === 'supported').length;
|
|
281
|
+
card.querySelector('.reviewbox').innerHTML = `<div class="review"><div class="lbl" style="margin-bottom:6px">Cross-examination · ${ok}/${all.length} finding checks supported</div>${lines.join('')}</div>`;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function wireCard(card, t) {
|
|
285
|
+
card.querySelectorAll('.bar i').forEach((i) => requestAnimationFrame(() => { i.style.width = i.dataset.w + '%'; }));
|
|
286
|
+
card.addEventListener('click', async (e) => {
|
|
287
|
+
const c = e.target.closest('.cite');
|
|
288
|
+
if (c) {
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
const rest = card.querySelector('.rest'); const row = card.querySelector(`.srcs li[data-n="${c.dataset.n}"]`);
|
|
291
|
+
if (row && rest && rest.contains(row)) { rest.hidden = false; card.querySelector('.more')?.remove(); }
|
|
292
|
+
card.querySelectorAll('.srcs li.hl').forEach((x) => x.classList.remove('hl'));
|
|
293
|
+
if (row) { row.classList.add('hl'); row.scrollIntoView({ behavior: 'smooth', block: 'center' }); setTimeout(() => row.classList.remove('hl'), 2400); }
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (e.target.closest('.more')) { card.querySelector('.rest').hidden = false; e.target.closest('.more').remove(); return; }
|
|
297
|
+
const f = e.target.closest('[data-follow]');
|
|
298
|
+
if (f && !busy) { askQuestion(f.textContent.trim()); return; }
|
|
299
|
+
const a = e.target.closest('[data-act]');
|
|
300
|
+
if (!a || a.disabled) return;
|
|
301
|
+
if (a.dataset.act === 'copy') {
|
|
302
|
+
const b = t.brief;
|
|
303
|
+
const text = [b.headline, '', b.bottomLine, ...(b.details ? ['', b.details] : []), '', `Confidence: ${b.confidence}/100 (${b.confidenceWhy})`, '', ...b.findings.map((f, i) => `${i + 1}. ${f.text} [${f.sources.join(', ')}]`), '', 'Sources:', ...(t.sources || []).map((s) => `[${s.n}] ${s.label}${s.url ? ' ' + s.url : ''}`), '', 'Oculon Analyst'].join('\n');
|
|
304
|
+
try { await navigator.clipboard.writeText(text); a.textContent = 'Copied'; } catch { a.textContent = 'Copy failed'; }
|
|
305
|
+
setTimeout(() => { a.textContent = 'Copy brief'; }, 1600);
|
|
306
|
+
}
|
|
307
|
+
if (a.dataset.act === 'review') {
|
|
308
|
+
a.disabled = true; a.innerHTML = '<span class="spin"></span> Cross-examining…';
|
|
309
|
+
try {
|
|
310
|
+
const r = await fetch('/api/analyst/review', { method: 'POST', headers: { 'content-type': 'application/json', 'x-oculon': '1' }, body: JSON.stringify({ id: t.id }) });
|
|
311
|
+
const j = await r.json();
|
|
312
|
+
if (!r.ok) throw new Error(j.error || `HTTP ${r.status}`);
|
|
313
|
+
t.review = j; save(); renderReview(card, j); a.remove();
|
|
314
|
+
} catch (err) { a.disabled = false; a.textContent = 'Cross-examine again'; card.querySelector('.reviewbox').innerHTML = `<div class="review"><p>${esc(err.message)}</p></div>`; }
|
|
315
|
+
}
|
|
316
|
+
if (a.dataset.act === 'watch') {
|
|
317
|
+
a.disabled = true;
|
|
318
|
+
try {
|
|
319
|
+
const r = await fetch('/api/my/monitors', { method: 'POST', headers: { 'content-type': 'application/json', 'x-oculon': '1' }, body: JSON.stringify({ text: a.dataset.text }) });
|
|
320
|
+
const j = await r.json();
|
|
321
|
+
if (!r.ok) throw new Error(j.error || `HTTP ${r.status}`);
|
|
322
|
+
a.outerHTML = `<a class="act" href="/app#watch">Watching. Open your monitors →</a>`;
|
|
323
|
+
} catch (err) { a.disabled = false; a.textContent = `Could not watch: ${err.message}`; }
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function save() { store.set('oculon.analyst.turns', turns.slice(-20)); }
|
|
329
|
+
|
|
330
|
+
function renderTurn(t) {
|
|
331
|
+
const el = document.createElement('section');
|
|
332
|
+
el.className = 'turn';
|
|
333
|
+
el.innerHTML = `<div class="q"><span class="lbl">Q</span><span>${esc(t.question)}</span></div>
|
|
334
|
+
<div class="trace done"><div class="radar">${radarSvg()}</div><div>${planHtml(t.plan)}<ul class="steps">${(t.steps || []).map((s) => `<li><span class="st ${s.ok ? 'ok' : 'err'}">${s.ok ? '✓' : '✕'}</span><span class="nm">${esc(s.label)}</span><span class="meta">${(s.ms / 1000).toFixed(1)}s</span></li>`).join('') || '<li><span class="st">·</span><span class="nm">No tools were needed</span><span></span></li>'}</ul></div></div>
|
|
335
|
+
${renderBrief(t)}`;
|
|
336
|
+
$('thread').appendChild(el);
|
|
337
|
+
el.querySelectorAll('.radar svg').forEach((svg) => (t.sources || []).forEach((_, i) => i < 24 && addBlip(svg, i)));
|
|
338
|
+
const card = el.querySelector('.brief');
|
|
339
|
+
wireCard(card, t);
|
|
340
|
+
if (t.review) renderReview(card, t.review);
|
|
341
|
+
return el;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
async function askQuestion(question) {
|
|
345
|
+
busy = true; $('send').disabled = true; $('intro').hidden = true;
|
|
346
|
+
const el = document.createElement('section');
|
|
347
|
+
el.className = 'turn';
|
|
348
|
+
el.innerHTML = `<div class="q"><span class="lbl">Q</span><span>${esc(question)}</span></div><div class="trace"><div class="radar">${radarSvg()}</div><div><div class="planbox"></div><ul class="steps"></ul><div class="thinking"><span class="spin"></span> <i>${esc(MODELS[model])}</i> is reading the question and choosing sources…</div></div></div>`;
|
|
349
|
+
$('thread').appendChild(el);
|
|
350
|
+
el.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
351
|
+
const steps = el.querySelector('.steps'), svg = el.querySelector('.radar svg'), thinking = el.querySelector('.thinking');
|
|
352
|
+
let blips = 0;
|
|
353
|
+
let plan = null;
|
|
354
|
+
const history = turns.slice(-4).map((t) => ({ q: t.question, a: t.brief?.bottomLine || '' }));
|
|
355
|
+
const fail = (msg) => { el.querySelector('.trace').classList.add('done'); thinking.remove(); el.insertAdjacentHTML('beforeend', `<div class="err">${esc(msg)}</div>`); };
|
|
356
|
+
try {
|
|
357
|
+
const res = await fetch('/api/analyst', { method: 'POST', headers: { 'content-type': 'application/json', 'x-oculon': '1' }, body: JSON.stringify({ q: question, model, history }) });
|
|
358
|
+
if (!res.ok || !res.body) { let m = `HTTP ${res.status}`; try { m = (await res.json()).error || m; } catch {} throw new Error(m); }
|
|
359
|
+
const reader = res.body.getReader(); const dec = new TextDecoder(); let buf = ''; let done = false;
|
|
360
|
+
while (!done) {
|
|
361
|
+
const { value, done: end } = await reader.read();
|
|
362
|
+
if (end) break;
|
|
363
|
+
buf += dec.decode(value, { stream: true });
|
|
364
|
+
let k;
|
|
365
|
+
while ((k = buf.indexOf('\n\n')) >= 0) {
|
|
366
|
+
const chunk = buf.slice(0, k); buf = buf.slice(k + 2);
|
|
367
|
+
const line = chunk.split('\n').find((l) => l.startsWith('data: '));
|
|
368
|
+
if (!line) continue;
|
|
369
|
+
let ev; try { ev = JSON.parse(line.slice(6)); } catch { continue; }
|
|
370
|
+
if (ev.type === 'plan') {
|
|
371
|
+
plan = ev.parts;
|
|
372
|
+
el.querySelector('.planbox').innerHTML = planHtml(plan);
|
|
373
|
+
} else if (ev.type === 'step') {
|
|
374
|
+
thinking.innerHTML = `<span class="spin"></span> checking sources…`;
|
|
375
|
+
steps.insertAdjacentHTML('beforeend', `<li data-id="${esc(ev.id)}"><span class="st"><span class="spin"></span></span><span class="nm">${esc(ev.label)}<small>${esc(ev.args)}</small></span><span class="meta">…</span></li>`);
|
|
376
|
+
} else if (ev.type === 'stepdone') {
|
|
377
|
+
const li = steps.querySelector(`li[data-id="${CSS.escape(ev.id)}"]`);
|
|
378
|
+
if (li) {
|
|
379
|
+
const live = ev.sources.filter((s) => s.status === 'LIVE').length;
|
|
380
|
+
li.querySelector('.st').outerHTML = `<span class="st ${ev.ok ? 'ok' : 'err'}">${ev.ok ? '✓' : '✕'}</span>`;
|
|
381
|
+
li.querySelector('.meta').textContent = `${(ev.ms / 1000).toFixed(1)}s · ${ev.sources.length} src${live ? ` · ${live} live` : ''}`;
|
|
382
|
+
}
|
|
383
|
+
for (const _ of ev.sources) if (blips < 24) addBlip(svg, blips++);
|
|
384
|
+
thinking.innerHTML = `<span class="spin"></span> <i>${esc(MODELS[model])}</i> is weighing the evidence…`;
|
|
385
|
+
} else if (ev.type === 'brief') {
|
|
386
|
+
const t = { id: ev.id, question, model: ev.model, brief: ev.brief, sources: ev.sources, steps: ev.steps, ms: ev.ms, plan };
|
|
387
|
+
turns.push(t); save();
|
|
388
|
+
el.remove();
|
|
389
|
+
renderTurn(t).scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
390
|
+
done = true;
|
|
391
|
+
} else if (ev.type === 'error') {
|
|
392
|
+
fail(`The analyst could not finish: ${ev.message}`); done = true;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (!done) fail('The connection closed before the brief was ready. Try again.');
|
|
397
|
+
} catch (e) {
|
|
398
|
+
fail(e.message || 'Something went wrong.');
|
|
399
|
+
} finally {
|
|
400
|
+
busy = false; $('send').disabled = false; q.focus({ preventScroll: true });
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* restore this viewer's session */
|
|
405
|
+
if (turns.length) { $('intro').hidden = true; turns.forEach(renderTurn); }
|
|
406
|
+
const pre = new URLSearchParams(location.search).get('q');
|
|
407
|
+
if (pre) { history.replaceState(null, '', location.pathname); askQuestion(pre.slice(0, 600)); }
|
|
408
|
+
</script>
|
|
409
|
+
</body>
|
|
410
|
+
</html>
|
|
Binary file
|
package/dist/web/assets/fx.js
CHANGED
|
@@ -176,3 +176,52 @@ void main(){
|
|
|
176
176
|
|
|
177
177
|
window.OculonFX = { liquid, stream, reduce: REDUCE };
|
|
178
178
|
})();
|
|
179
|
+
|
|
180
|
+
/*
|
|
181
|
+
* Clean addresses: links to a part of the same page scroll there without adding "#section" to the
|
|
182
|
+
* address bar, and a "#section" that arrives from another page is removed once the page has used it.
|
|
183
|
+
* A page with its own views (the app) sets window.onOculonHash(name) to handle names that are not elements.
|
|
184
|
+
*/
|
|
185
|
+
(function () {
|
|
186
|
+
if (window.__oculonCleanUrl) return;
|
|
187
|
+
window.__oculonCleanUrl = true;
|
|
188
|
+
// A section asked for by a link on another Oculon page travels in window.name, so the address never shows it.
|
|
189
|
+
let carried = '';
|
|
190
|
+
try { if (window.name.startsWith('oculon-goto:')) { carried = window.name.slice(12); window.name = ''; } } catch {}
|
|
191
|
+
window.oculonInitialHash = carried || decodeURIComponent(location.hash.slice(1));
|
|
192
|
+
if (location.hash) history.replaceState(history.state, '', location.pathname + location.search);
|
|
193
|
+
// Same site: this host, or another subdomain of the same domain (oculon.live, app., docs., mcp.).
|
|
194
|
+
const site = (h) => h.split('.').slice(-2).join('.');
|
|
195
|
+
const sameSite = (u) => u.protocol === location.protocol && (u.host === location.host || (location.hostname.includes('.') && site(u.hostname) === site(location.hostname)));
|
|
196
|
+
document.addEventListener('click', (e) => {
|
|
197
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
198
|
+
const a = e.target.closest && e.target.closest('a[href]');
|
|
199
|
+
if (!a || (a.target && a.target !== '_self') || a.hasAttribute('download')) return;
|
|
200
|
+
const raw = a.getAttribute('href');
|
|
201
|
+
if (raw === '#') { e.preventDefault(); return; }
|
|
202
|
+
const u = new URL(a.href, location.href);
|
|
203
|
+
if (!u.hash) return;
|
|
204
|
+
if (u.origin !== location.origin || u.pathname !== location.pathname || u.search !== location.search) {
|
|
205
|
+
// Another page: open it at its plain address and hand over the section name.
|
|
206
|
+
if (!sameSite(u)) return;
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
try { window.name = 'oculon-goto:' + decodeURIComponent(u.hash.slice(1)); } catch {}
|
|
209
|
+
location.href = u.origin + u.pathname + u.search;
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const name = decodeURIComponent(u.hash.slice(1));
|
|
213
|
+
const el = document.getElementById(name);
|
|
214
|
+
if (el) { e.preventDefault(); el.scrollIntoView({ behavior: 'smooth', block: 'start' }); if (typeof window.onOculonSection === 'function') window.onOculonSection(name); return; }
|
|
215
|
+
if (typeof window.onOculonHash === 'function') { e.preventDefault(); window.onOculonHash(name); }
|
|
216
|
+
});
|
|
217
|
+
const clear = () => { if (location.hash) history.replaceState(history.state, '', location.pathname + location.search); };
|
|
218
|
+
window.oculonClearHash = clear;
|
|
219
|
+
addEventListener('load', () => setTimeout(clear, 2500));
|
|
220
|
+
// Pages whose sections are in the HTML from the start (landing, legal) jump to the handed-over section here;
|
|
221
|
+
// the docs and the app handle it themselves once their content is in place.
|
|
222
|
+
addEventListener('DOMContentLoaded', () => {
|
|
223
|
+
const name = window.oculonInitialHash;
|
|
224
|
+
const el = name && document.getElementById(name);
|
|
225
|
+
if (el) setTimeout(() => el.scrollIntoView({ behavior: 'instant', block: 'start' }), 60);
|
|
226
|
+
});
|
|
227
|
+
})();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="212 212 600 600"><path fill="#00f0ff" d="M512 212 H348 Q212 212 212 348 V676 Q212 812 348 812 H676 Q812 812 812 676 V512 H680 V630 Q680 680 630 680 H394 Q344 680 344 630 V394 Q344 344 394 344 H512 Z"/><path fill="#00f0ff" d="M586 212 H676 Q812 212 812 348 V438 Q812 472 778 472 H586 Q552 472 552 438 V246 Q552 212 586 212 Z"/></svg>
|
package/dist/web/assets/og.png
CHANGED
|
Binary file
|