@vxnus/siduri 2.0.10 → 2.0.12

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.
Files changed (35) hide show
  1. package/dist/builtin-manifests.js +1 -1
  2. package/dist/configurators/knowledge.js +2 -0
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/providers/knowledge-hub.js +1 -1
  6. package/dist/web-dist/404/index.html +1 -1
  7. package/dist/web-dist/404.html +1 -1
  8. package/dist/web-dist/__next.__PAGE__.txt +23 -23
  9. package/dist/web-dist/__next._full.txt +28 -26
  10. package/dist/web-dist/__next._tree.txt +2 -2
  11. package/dist/web-dist/_next/static/chunks/{360luxuz2x8y_.js → 15q-egfwp0gfo.js} +1 -1
  12. package/dist/web-dist/_next/static/chunks/{1vumcan23qv3j.js → 27vro44ly8dtc.js} +3 -3
  13. package/dist/web-dist/_next/static/chunks/2evcd3-u5ivvc.css +1 -0
  14. package/dist/web-dist/_not-found/__next._full.txt +3 -3
  15. package/dist/web-dist/_not-found/__next._not-found.__PAGE__.txt +2 -2
  16. package/dist/web-dist/_not-found/__next._tree.txt +2 -2
  17. package/dist/web-dist/_not-found/index.html +1 -1
  18. package/dist/web-dist/_not-found/index.txt +3 -3
  19. package/dist/web-dist/chat/__next._full.txt +4 -4
  20. package/dist/web-dist/chat/__next._tree.txt +2 -2
  21. package/dist/web-dist/chat/__next.chat.__PAGE__.txt +3 -3
  22. package/dist/web-dist/chat/index.html +1 -1
  23. package/dist/web-dist/chat/index.txt +4 -4
  24. package/dist/web-dist/index.html +1 -1
  25. package/dist/web-dist/index.txt +28 -26
  26. package/dist/web-dist/operator/__next._full.txt +4 -4
  27. package/dist/web-dist/operator/__next._tree.txt +2 -2
  28. package/dist/web-dist/operator/__next.operator.__PAGE__.txt +3 -3
  29. package/dist/web-dist/operator/index.html +1 -1
  30. package/dist/web-dist/operator/index.txt +4 -4
  31. package/package.json +7 -7
  32. package/dist/web-dist/_next/static/chunks/0e0_fwxai4qpl.css +0 -1
  33. /package/dist/web-dist/_next/static/{AZPivdC8Bi_P27SqlyGnq → NgACehmLOdq_GfPnqeF6o}/_buildManifest.js +0 -0
  34. /package/dist/web-dist/_next/static/{AZPivdC8Bi_P27SqlyGnq → NgACehmLOdq_GfPnqeF6o}/_clientMiddlewareManifest.js +0 -0
  35. /package/dist/web-dist/_next/static/{AZPivdC8Bi_P27SqlyGnq → NgACehmLOdq_GfPnqeF6o}/_ssgManifest.js +0 -0
@@ -2,31 +2,33 @@
2
2
  2:I[31790,["/_next/static/chunks/30a48dk5bjyhj.js"],"default"]
3
3
  3:I[65729,["/_next/static/chunks/30a48dk5bjyhj.js"],"default"]
4
4
  4:I[61842,["/_next/static/chunks/30a48dk5bjyhj.js","/_next/static/chunks/2dsfgoa225hpl.js"],""]
5
- f:I[58484,["/_next/static/chunks/30a48dk5bjyhj.js"],"default",1]
6
- :HL["/_next/static/chunks/0e0_fwxai4qpl.css","style"]
5
+ 11:I[58484,["/_next/static/chunks/30a48dk5bjyhj.js"],"default",1]
6
+ :HL["/_next/static/chunks/2evcd3-u5ivvc.css","style"]
7
7
  :HL["https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Noto+Sans+JP:wght@400;500;700&family=Noto+Serif+JP:wght@400;500;700&display=swap","style"]
8
8
  :HL["/logo-circle.svg","image"]
9
- 0:{"P":null,"c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{},"$undefined","$undefined",4608]},"$undefined","$undefined",4624],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/0e0_fwxai4qpl.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/30a48dk5bjyhj.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","className":"h-full antialiased dark","children":[["$","head",null,{"children":[["$","link",null,{"rel":"preconnect","href":"https://fonts.googleapis.com"}],["$","link",null,{"rel":"preconnect","href":"https://fonts.gstatic.com","crossOrigin":"anonymous"}],["$","link",null,{"href":"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Noto+Sans+JP:wght@400;500;700&family=Noto+Serif+JP:wght@400;500;700&display=swap","rel":"stylesheet"}]]}],["$","body",null,{"className":"min-h-full flex flex-col bg-[#0b0b0e] text-[#eee8df] selection:bg-[#d99a68]/30 selection:text-[#f4c28d]","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[["$","div",null,{"className":"home-page bg-[#09090c] min-h-screen text-[var(--siduri-text-primary)] font-sans","children":[["$","header",null,{"className":"home-nav","children":["$","div",null,{"className":"home-container home-nav-inner flex items-center justify-between py-4","children":[["$","$L4",null,{"href":"/","className":"brand-link flex items-center gap-2","aria-label":"Siduri Home","children":[["$","img",null,{"src":"/logo-circle.svg","alt":"Siduri-X Logo","className":"w-6 h-6 rounded-full shrink-0","width":24,"height":24}],["$","span",null,{"className":"font-bold tracking-widest text-sm","children":"SIDURI-X"}]]}],["$","nav",null,{"className":"nav-links flex gap-6 text-sm text-[var(--siduri-text-muted)]","aria-label":"Main Navigation","children":[["$","$L4",null,{"href":"/chat","className":"hover:text-[var(--siduri-text-primary)] transition-colors","children":"Chat"}],["$","$L4",null,{"href":"/operator","className":"hover:text-[var(--siduri-text-primary)] transition-colors","children":"Operator Console"}]]}],["$","div",null,{"children":["$","$L4",null,{"href":"/chat","className":"nav-cta inline-flex items-center gap-2 text-xs font-mono border border-[var(--siduri-border-subtle)] px-4 py-2 rounded-full hover:bg-[var(--siduri-surface)] transition-all","children":["Open Chat ",["$","span",null,{"children":"→"}]]}]}]]}]}],["$","main",null,{"children":[["$","section",null,{"className":"py-24 md:py-32 border-b border-[var(--siduri-border-subtle)] relative overflow-hidden","children":["$","div",null,{"className":"home-container relative z-10 text-center flex flex-col items-center","children":[["$","div",null,{"className":"inline-flex items-center gap-2 px-3 py-1 rounded-full border border-[var(--siduri-border-ember)] bg-[var(--siduri-tint-low)] text-[var(--siduri-ember-light)] text-[10px] font-mono tracking-widest uppercase mb-8","children":[["$","span",null,{"className":"w-1.5 h-1.5 rounded-full bg-[var(--siduri-online)] shadow-[0_0_8px_rgba(127,199,154,0.6)]"}],"Standalone Companion Framework · Version 1.0"]}],"$L5","$L6","$L7"]}]}],"$L8","$L9","$La"]}],"$Lb"]}],["$Lc"],"$Ld"]}],{},null,false,null]},null,false,null],"$Le",false]],"m":"$undefined","G":["$f",["$L10"]],"S":true,"h":null,"r":"$undefined","s":"$undefined","a":"$undefined","l":"$undefined","p":"$undefined","d":"$undefined","b":"AZPivdC8Bi_P27SqlyGnq"}
10
- 15:I[34860,["/_next/static/chunks/30a48dk5bjyhj.js"],"OutletBoundary"]
11
- 16:"$Sreact.suspense"
12
- 18:I[34860,["/_next/static/chunks/30a48dk5bjyhj.js"],"ViewportBoundary"]
13
- 1a:I[34860,["/_next/static/chunks/30a48dk5bjyhj.js"],"MetadataBoundary"]
14
- 5:["$","h1",null,{"className":"text-4xl sm:text-5xl md:text-6xl font-normal font-serif text-[var(--siduri-text-primary)] tracking-tight leading-[1.15] mb-6 max-w-4xl","children":"A companion grown from memory, powered by modular cognition."}]
15
- 6:["$","p",null,{"className":"text-base sm:text-lg text-[var(--siduri-text-secondary)] font-sans leading-relaxed mb-10 max-w-2xl font-light","children":"Siduri-X is an intelligent companion designed with authoritative memory, atomic behavioral gating, and a strict 10-organ architecture. She starts as a blank slate and forms her identity entirely through your interactions."}]
16
- 7:["$","div",null,{"className":"flex flex-wrap justify-center items-center gap-4","children":[["$","$L4",null,{"href":"/chat","className":"inline-flex items-center gap-3 px-6 py-3.5 rounded-xl bg-[var(--siduri-ember)] text-[#1b1619] font-sans font-semibold text-sm tracking-wide transition-all hover:brightness-110 shadow-[0_4px_20px_rgba(217,154,104,0.2)]","children":["Launch Companion",["$","span",null,{"className":"font-mono text-base","children":"→"}]]}],["$","$L4",null,{"href":"/operator","className":"inline-flex items-center gap-2.5 px-6 py-3.5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] text-[var(--siduri-text-primary)] font-sans font-medium text-sm transition-all hover:border-[var(--siduri-border-ember)] hover:bg-[var(--siduri-tint-low)]","children":[["$","span",null,{"children":"⌘"}],"Operator Console"]}]]}]
17
- 8:["$","section",null,{"className":"py-20 md:py-28 border-b border-[var(--siduri-border-subtle)] bg-[#0e0e12]","children":["$","div",null,{"className":"home-container","children":[["$","div",null,{"className":"mb-14 text-center max-w-3xl mx-auto","children":[["$","p",null,{"className":"text-[10px] font-mono uppercase tracking-widest text-[var(--siduri-ember)] mb-2","children":"Decoupled Philosophy"}],["$","h2",null,{"className":"text-2xl sm:text-3xl font-serif font-normal text-[var(--siduri-text-primary)] mb-4","children":"The 10-Organ Architecture"}],["$","p",null,{"className":"text-sm text-[var(--siduri-text-secondary)] leading-relaxed","children":"Siduri is not a chatbot. She is a cognition runtime composed of independent organs. Every decision originates from the Brain, while other organs perceive, remember, act, and embody."}]]}],["$","div",null,{"className":"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4","children":[["$","div","Brain",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Brain"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Cognition, planning, and authoritative decision making."}]]}],["$","div","Memory",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Memory"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"SQLite FTS5 authoritative storage of verified claims and episodic memory."}]]}],["$","div","Behavior",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Behavior"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Atomic directive state machine and personality projection."}]]}],["$","div","Knowledge",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Knowledge"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"External factual context and verifiable E-compatible packs."}]]}],["$","div","Hands",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Hands"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Tool execution and strict cryptographic action policy capabilities."}]]}],["$","div","Ear",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Ear"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Audio transcription, perception, and sensory input ingestion."}]]}],"$L11","$L12","$L13","$L14"]}]]}]}]
18
- 9:["$","section",null,{"className":"py-20 md:py-28 border-b border-[var(--siduri-border-subtle)]","children":["$","div",null,{"className":"home-container grid grid-cols-1 lg:grid-cols-2 gap-16 items-center","children":[["$","div",null,{"children":[["$","p",null,{"className":"text-[10px] font-mono uppercase tracking-widest text-[var(--siduri-ember)] mb-2","children":"Authoritative State"}],["$","h2",null,{"className":"text-3xl font-serif font-normal text-[var(--siduri-text-primary)] mb-5","children":"Blank Slate Identity"}],["$","p",null,{"className":"text-sm text-[var(--siduri-text-secondary)] leading-relaxed mb-6","children":"Unlike standard conversational agents, Siduri starts with no pre-baked persona. She learns, remembers, and adapts over time. When you share preferences, they are staged as structured candidates. You decide what enters her long-term memory with explicit single-click approval."}],["$","ul",null,{"className":"space-y-3 text-xs text-[var(--siduri-text-muted)] font-mono","children":[["$","li",null,{"className":"flex items-center gap-2.5","children":[["$","span",null,{"className":"text-[var(--siduri-online)]","children":""}],"No hidden relationship assumptions"]}],["$","li",null,{"className":"flex items-center gap-2.5","children":[["$","span",null,{"className":"text-[var(--siduri-online)]","children":"✓"}],"Structured episodic and semantic memory"]}],["$","li",null,{"className":"flex items-center gap-2.5","children":[["$","span",null,{"className":"text-[var(--siduri-online)]","children":"✓"}],"Full revocation and override controls"]}]]}]]}],["$","div",null,{"className":"p-8 rounded-2xl border border-[var(--siduri-border-ember)] bg-[var(--siduri-surface)] shadow-[0_10px_35px_rgba(0,0,0,0.4)] relative","children":[["$","div",null,{"className":"absolute top-0 right-8 -translate-y-1/2 bg-[var(--siduri-bg)] px-3 text-[10px] font-mono text-[var(--siduri-ember)] tracking-widest uppercase","children":"Operator View"}],["$","div",null,{"className":"space-y-4 font-mono text-xs","children":["$","div",null,{"className":"p-3 border border-[var(--siduri-border-subtle)] rounded bg-[#13131a]","children":[["$","div",null,{"className":"text-[var(--siduri-text-muted)] mb-1","children":"Incoming Claim"}],["$","div",null,{"className":"text-[var(--siduri-online)] font-bold","children":"\"User prefers concise, technical explanations.\""}],["$","div",null,{"className":"flex gap-2 mt-3","children":[["$","span",null,{"className":"bg-[var(--siduri-online)] text-black px-2 py-0.5 rounded font-bold cursor-pointer","children":"APPROVE"}],["$","span",null,{"className":"border border-[var(--siduri-border-subtle)] text-[var(--siduri-text-muted)] px-2 py-0.5 rounded cursor-pointer","children":"REJECT"}]]}]]}]}]]}]]}]}]
19
- a:["$","section",null,{"className":"py-20 md:py-28 bg-[#09090c]","children":["$","div",null,{"className":"home-container text-center max-w-2xl mx-auto","children":[["$","h2",null,{"className":"text-3xl sm:text-4xl font-serif font-normal text-[var(--siduri-text-primary)] mb-5","children":"Private, local, and yours."}],["$","p",null,{"className":"text-sm text-[var(--siduri-text-secondary)] leading-relaxed mb-8","children":"Siduri is designed for local-first operations and explicit consent. The CLI dynamically generates a standalone companion instance leveraging only the organ packages you need. Run it completely on your own machine."}],["$","div",null,{"className":"bg-[#13131a] p-4 rounded-xl border border-[var(--siduri-border-subtle)] inline-block text-left text-sm font-mono text-[var(--siduri-text-primary)] shadow-lg mx-auto","children":[["$","span",null,{"className":"text-emerald-400","children":"$$"}]," npx @vxnus/siduri create my-companion"]}]]}]}]
20
- b:["$","footer",null,{"className":"py-14 border-t border-[var(--siduri-border-subtle)] bg-[#0e0e12]","children":["$","div",null,{"className":"home-container flex flex-col sm:flex-row items-center justify-between gap-6","children":[["$","div",null,{"className":"flex items-center gap-3","children":[["$","img",null,{"src":"/logo-circle.svg","alt":"Siduri-X Logo","className":"w-5 h-5 rounded-full shrink-0","width":20,"height":20}],["$","span",null,{"className":"font-bold tracking-widest text-xs text-[var(--siduri-text-primary)]","children":"SIDURI-X"}]]}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-dim)] font-sans text-center sm:text-left","children":"Local-first AI companion framework."}],["$","div",null,{"className":"flex items-center gap-5 text-xs text-[var(--siduri-text-muted)]","children":[["$","$L4",null,{"href":"/chat","className":"hover:text-[var(--siduri-text-primary)]","children":"Chat"}],["$","$L4",null,{"href":"/operator","className":"hover:text-[var(--siduri-text-primary)]","children":"Operator"}]]}]]}]}]
21
- c:["$","script","script-0",{"src":"/_next/static/chunks/2dsfgoa225hpl.js","async":true,"nonce":"$undefined"}]
22
- d:["$","$L15",null,{"children":["$","$16",null,{"name":"Next.MetadataOutlet","children":"$@17"}]}]
23
- e:["$","$1","h",{"children":[null,["$","$L18",null,{"children":"$L19"}],["$","div",null,{"hidden":true,"children":["$","$L1a",null,{"children":["$","$16",null,{"name":"Next.Metadata","children":"$L1b"}]}]}],null]}]
24
- 10:["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/0e0_fwxai4qpl.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]
25
- 11:["$","div","Vision",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Vision"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Visual observation, cropping, and OCR interpretation."}]]}]
26
- 12:["$","div","Voice",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Voice"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Queued speech synthesis (Edge-TTS, Kokoro, Piper, VOICEVOX) and auditory expression."}]]}]
27
- 13:["$","div","Body",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Body"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Renderer-agnostic avatar expression (Live2D) and embodiment."}]]}]
28
- 14:["$","div","Observation",{"className":"p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Observation"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Event frame deduplication and real-time evidence extraction."}]]}]
29
- 19:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
30
- 1c:I[71375,["/_next/static/chunks/30a48dk5bjyhj.js"],"IconMark"]
31
- 17:null
32
- 1b:[["$","title","0",{"children":"Siduri — Local-First Companion"}],["$","meta","1",{"name":"description","content":"Siduri — a local-first companion with explicit memory, grounded knowledge, and optional presence."}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.3rlors1ui1gw9.ico","sizes":"256x256","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"/favicon.ico"}],["$","link","4",{"rel":"icon","href":"/favicon.svg","type":"image/svg+xml"}],["$","link","5",{"rel":"apple-touch-icon","href":"/apple-touch-icon.png"}],["$","$L1c","6",{}]]
9
+ 0:{"P":null,"c":["",""],"q":"","i":false,"f":[[["",{"children":["__PAGE__",{},"$undefined","$undefined",4608]},"$undefined","$undefined",4624],[["$","$1","c",{"children":[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/2evcd3-u5ivvc.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}],["$","script","script-0",{"src":"/_next/static/chunks/30a48dk5bjyhj.js","async":true,"nonce":"$undefined"}]],["$","html",null,{"lang":"en","className":"h-full antialiased dark","children":[["$","head",null,{"children":[["$","link",null,{"rel":"preconnect","href":"https://fonts.googleapis.com"}],["$","link",null,{"rel":"preconnect","href":"https://fonts.gstatic.com","crossOrigin":"anonymous"}],["$","link",null,{"href":"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Noto+Sans+JP:wght@400;500;700&family=Noto+Serif+JP:wght@400;500;700&display=swap","rel":"stylesheet"}]]}],["$","body",null,{"className":"min-h-full flex flex-col bg-[#0b0b0e] text-[#eee8df] selection:bg-[#d99a68]/30 selection:text-[#f4c28d]","children":["$","$L2",null,{"parallelRouterKey":"children","error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L3",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":404}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],[]],"forbidden":"$undefined","unauthorized":"$undefined"}]}]]}]]}],{"children":[["$","$1","c",{"children":[["$","div",null,{"className":"home-page bg-[#09090c] min-h-screen text-[var(--siduri-text-primary)] font-sans","children":[["$","header",null,{"className":"home-nav","children":["$","div",null,{"className":"home-container home-nav-inner flex items-center justify-between py-3 sm:py-4","children":[["$","$L4",null,{"href":"/","className":"brand-link flex items-center gap-2","aria-label":"Siduri Home","children":[["$","img",null,{"src":"/logo-circle.svg","alt":"Siduri-X Logo","className":"w-6 h-6 rounded-full shrink-0","width":24,"height":24}],["$","span",null,{"className":"font-bold tracking-widest text-sm","children":"SIDURI-X"}]]}],["$","nav",null,{"className":"nav-links hidden sm:flex gap-6 text-sm text-[var(--siduri-text-muted)]","aria-label":"Main Navigation","children":[["$","$L4",null,{"href":"/chat","className":"hover:text-[var(--siduri-text-primary)] transition-colors","children":"Chat"}],["$","$L4",null,{"href":"/operator","className":"hover:text-[var(--siduri-text-primary)] transition-colors","children":"Operator Console"}]]}],["$","div",null,{"className":"flex items-center gap-3","children":["$","$L4",null,{"href":"/chat","className":"nav-cta inline-flex items-center gap-2 text-xs font-mono border border-[var(--siduri-border-subtle)] px-3 sm:px-4 py-2 rounded-full hover:bg-[var(--siduri-surface)] transition-all","children":[["$","span",null,{"children":"Chat"}]," ",["$","span",null,{"aria-hidden":"true","children":"→"}]]}]}]]}]}],["$","main",null,{"children":[["$","section",null,{"className":"py-16 sm:py-24 md:py-32 border-b border-[var(--siduri-border-subtle)] relative overflow-hidden","children":["$","div",null,{"className":"home-container relative z-10 text-center flex flex-col items-center","children":[["$","div",null,{"className":"inline-flex items-center gap-2 px-3 py-1 rounded-full border border-[var(--siduri-border-ember)] bg-[var(--siduri-tint-low)] text-[var(--siduri-ember-light)] text-[10px] font-mono tracking-widest uppercase mb-6 sm:mb-8 text-center max-w-full","children":["$L5","$L6"]}],"$L7","$L8","$L9"]}]}],"$La","$Lb","$Lc"]}],"$Ld"]}],["$Le"],"$Lf"]}],{},null,false,null]},null,false,null],"$L10",false]],"m":"$undefined","G":["$11",["$L12"]],"S":true,"h":null,"r":"$undefined","s":"$undefined","a":"$undefined","l":"$undefined","p":"$undefined","d":"$undefined","b":"NgACehmLOdq_GfPnqeF6o"}
10
+ 17:I[34860,["/_next/static/chunks/30a48dk5bjyhj.js"],"OutletBoundary"]
11
+ 18:"$Sreact.suspense"
12
+ 1a:I[34860,["/_next/static/chunks/30a48dk5bjyhj.js"],"ViewportBoundary"]
13
+ 1c:I[34860,["/_next/static/chunks/30a48dk5bjyhj.js"],"MetadataBoundary"]
14
+ 5:["$","span",null,{"className":"w-1.5 h-1.5 rounded-full bg-[var(--siduri-online)] shadow-[0_0_8px_rgba(127,199,154,0.6)] shrink-0"}]
15
+ 6:["$","span",null,{"className":"truncate","children":"Standalone Companion · Version 1.0"}]
16
+ 7:["$","h1",null,{"className":"text-3xl sm:text-5xl md:text-6xl font-normal font-serif text-[var(--siduri-text-primary)] tracking-tight leading-[1.2] sm:leading-[1.15] mb-6 max-w-4xl px-2","children":"A companion grown from memory, powered by modular cognition."}]
17
+ 8:["$","p",null,{"className":"text-sm sm:text-lg text-[var(--siduri-text-secondary)] font-sans leading-relaxed mb-8 sm:mb-10 max-w-2xl font-light px-2","children":"Siduri-X is an intelligent companion designed with authoritative memory, atomic behavioral gating, and a strict 10-organ architecture. She starts as a blank slate and forms her identity entirely through your interactions."}]
18
+ 9:["$","div",null,{"className":"flex flex-col sm:flex-row justify-center items-stretch sm:items-center gap-3 sm:gap-4 w-full max-w-md sm:max-w-none px-4","children":[["$","$L4",null,{"href":"/chat","className":"inline-flex justify-center items-center gap-3 px-6 py-3.5 rounded-xl bg-[var(--siduri-ember)] text-[#1b1619] font-sans font-semibold text-sm tracking-wide transition-all hover:brightness-110 shadow-[0_4px_20px_rgba(217,154,104,0.2)]","children":["Launch Companion",["$","span",null,{"className":"font-mono text-base","children":""}]]}],["$","$L4",null,{"href":"/operator","className":"inline-flex justify-center items-center gap-2.5 px-6 py-3.5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] text-[var(--siduri-text-primary)] font-sans font-medium text-sm transition-all hover:border-[var(--siduri-border-ember)] hover:bg-[var(--siduri-tint-low)]","children":[["$","span",null,{"children":""}],"Operator Console"]}]]}]
19
+ a:["$","section",null,{"className":"py-20 md:py-28 border-b border-[var(--siduri-border-subtle)] bg-[#0e0e12]","children":["$","div",null,{"className":"home-container","children":[["$","div",null,{"className":"mb-14 text-center max-w-3xl mx-auto","children":[["$","p",null,{"className":"text-[10px] font-mono uppercase tracking-widest text-[var(--siduri-ember)] mb-2","children":"Decoupled Philosophy"}],["$","h2",null,{"className":"text-2xl sm:text-3xl font-serif font-normal text-[var(--siduri-text-primary)] mb-4","children":"The 10-Organ Architecture"}],["$","p",null,{"className":"text-sm text-[var(--siduri-text-secondary)] leading-relaxed","children":"Siduri is not a chatbot. She is a cognition runtime composed of independent organs. Every decision originates from the Brain, while other organs perceive, remember, act, and embody."}]]}],["$","div",null,{"className":"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4","children":[["$","div","Brain",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Brain"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Cognition, planning, and authoritative decision making."}]]}],["$","div","Memory",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Memory"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"SQLite FTS5 authoritative storage of verified claims and episodic memory."}]]}],["$","div","Behavior",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Behavior"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Atomic directive state machine and personality projection."}]]}],["$","div","Knowledge",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Knowledge"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"External factual context and verifiable E-compatible packs."}]]}],["$","div","Hands",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Hands"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Tool execution and strict cryptographic action policy capabilities."}]]}],["$","div","Ear",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Ear"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Audio transcription, perception, and sensory input ingestion."}]]}],"$L13","$L14","$L15","$L16"]}]]}]}]
20
+ b:["$","section",null,{"className":"py-16 sm:py-20 md:py-28 border-b border-[var(--siduri-border-subtle)]","children":["$","div",null,{"className":"home-container grid grid-cols-1 lg:grid-cols-2 gap-10 sm:gap-16 items-center","children":[["$","div",null,{"children":[["$","p",null,{"className":"text-[10px] font-mono uppercase tracking-widest text-[var(--siduri-ember)] mb-2","children":"Authoritative State"}],["$","h2",null,{"className":"text-2xl sm:text-3xl font-serif font-normal text-[var(--siduri-text-primary)] mb-5","children":"Blank Slate Identity"}],["$","p",null,{"className":"text-sm text-[var(--siduri-text-secondary)] leading-relaxed mb-6","children":"Unlike standard conversational agents, Siduri starts with no pre-baked persona. She learns, remembers, and adapts over time. When you share preferences, they are staged as structured candidates. You decide what enters her long-term memory with explicit single-click approval."}],["$","ul",null,{"className":"space-y-3 text-xs text-[var(--siduri-text-muted)] font-mono","children":[["$","li",null,{"className":"flex items-center gap-2.5","children":[["$","span",null,{"className":"text-[var(--siduri-online)]","children":"✓"}],"No hidden relationship assumptions"]}],["$","li",null,{"className":"flex items-center gap-2.5","children":[["$","span",null,{"className":"text-[var(--siduri-online)]","children":"✓"}],"Structured episodic and semantic memory"]}],["$","li",null,{"className":"flex items-center gap-2.5","children":[["$","span",null,{"className":"text-[var(--siduri-online)]","children":"✓"}],"Full revocation and override controls"]}]]}]]}],["$","div",null,{"className":"p-5 sm:p-8 rounded-2xl border border-[var(--siduri-border-ember)] bg-[var(--siduri-surface)] shadow-[0_10px_35px_rgba(0,0,0,0.4)] relative","children":[["$","div",null,{"className":"absolute top-0 right-6 sm:right-8 -translate-y-1/2 bg-[var(--siduri-bg)] px-3 text-[10px] font-mono text-[var(--siduri-ember)] tracking-widest uppercase","children":"Operator View"}],["$","div",null,{"className":"space-y-4 font-mono text-xs","children":["$","div",null,{"className":"p-3 border border-[var(--siduri-border-subtle)] rounded bg-[#13131a]","children":[["$","div",null,{"className":"text-[var(--siduri-text-muted)] mb-1","children":"Incoming Claim"}],["$","div",null,{"className":"text-[var(--siduri-online)] font-bold break-words","children":"“User prefers concise, technical explanations.”"}],["$","div",null,{"className":"flex flex-wrap gap-2 mt-3","children":[["$","span",null,{"className":"bg-[var(--siduri-online)] text-black px-2.5 py-1 rounded font-bold cursor-pointer text-xs","children":"APPROVE"}],["$","span",null,{"className":"border border-[var(--siduri-border-subtle)] text-[var(--siduri-text-muted)] px-2.5 py-1 rounded cursor-pointer text-xs","children":"REJECT"}]]}]]}]}]]}]]}]}]
21
+ c:["$","section",null,{"className":"py-16 sm:py-20 md:py-28 bg-[#09090c]","children":["$","div",null,{"className":"home-container text-center max-w-2xl mx-auto px-4","children":[["$","h2",null,{"className":"text-2xl sm:text-4xl font-serif font-normal text-[var(--siduri-text-primary)] mb-5","children":"Private, local, and yours."}],["$","p",null,{"className":"text-sm text-[var(--siduri-text-secondary)] leading-relaxed mb-8","children":"Siduri is designed for local-first operations and explicit consent. The CLI dynamically generates a standalone companion instance leveraging only the organ packages you need. Run it completely on your own machine."}],["$","div",null,{"className":"bg-[#13131a] p-3.5 sm:p-4 rounded-xl border border-[var(--siduri-border-subtle)] inline-block text-left text-xs sm:text-sm font-mono text-[var(--siduri-text-primary)] shadow-lg mx-auto max-w-full overflow-x-auto","children":[["$","span",null,{"className":"text-emerald-400","children":"$$"}]," npx @vxnus/siduri create my-companion"]}]]}]}]
22
+ d:["$","footer",null,{"className":"py-14 border-t border-[var(--siduri-border-subtle)] bg-[#0e0e12]","children":["$","div",null,{"className":"home-container flex flex-col sm:flex-row items-center justify-between gap-6","children":[["$","div",null,{"className":"flex items-center gap-3","children":[["$","img",null,{"src":"/logo-circle.svg","alt":"Siduri-X Logo","className":"w-5 h-5 rounded-full shrink-0","width":20,"height":20}],["$","span",null,{"className":"font-bold tracking-widest text-xs text-[var(--siduri-text-primary)]","children":"SIDURI-X"}]]}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-dim)] font-sans text-center sm:text-left","children":"Local-first AI companion framework."}],["$","div",null,{"className":"flex items-center gap-5 text-xs text-[var(--siduri-text-muted)]","children":[["$","$L4",null,{"href":"/chat","className":"hover:text-[var(--siduri-text-primary)]","children":"Chat"}],["$","$L4",null,{"href":"/operator","className":"hover:text-[var(--siduri-text-primary)]","children":"Operator"}]]}]]}]}]
23
+ e:["$","script","script-0",{"src":"/_next/static/chunks/2dsfgoa225hpl.js","async":true,"nonce":"$undefined"}]
24
+ f:["$","$L17",null,{"children":["$","$18",null,{"name":"Next.MetadataOutlet","children":"$@19"}]}]
25
+ 10:["$","$1","h",{"children":[null,["$","$L1a",null,{"children":"$L1b"}],["$","div",null,{"hidden":true,"children":["$","$L1c",null,{"children":["$","$18",null,{"name":"Next.Metadata","children":"$L1d"}]}]}],null]}]
26
+ 12:["$","link","0",{"rel":"stylesheet","href":"/_next/static/chunks/2evcd3-u5ivvc.css","precedence":"next","crossOrigin":"$undefined","nonce":"$undefined"}]
27
+ 13:["$","div","Vision",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Vision"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Visual observation, cropping, and OCR interpretation."}]]}]
28
+ 14:["$","div","Voice",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Voice"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Queued speech synthesis (Edge-TTS, Kokoro, Piper, VOICEVOX) and auditory expression."}]]}]
29
+ 15:["$","div","Body",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Body"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Renderer-agnostic avatar expression (Live2D) and embodiment."}]]}]
30
+ 16:["$","div","Observation",{"className":"p-4 sm:p-5 rounded-xl border border-[var(--siduri-border-subtle)] bg-[var(--siduri-surface)] transition-all hover:border-[var(--siduri-border-ember)]","children":[["$","h3",null,{"className":"text-sm font-bold font-mono text-[var(--siduri-ember-light)] mb-2","children":"Observation"}],["$","p",null,{"className":"text-xs text-[var(--siduri-text-secondary)] leading-relaxed","children":"Event frame deduplication and real-time evidence extraction."}]]}]
31
+ 1b:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content"}],["$","meta","2",{"name":"theme-color","content":"#0b0b0e"}]]
32
+ 1e:I[71375,["/_next/static/chunks/30a48dk5bjyhj.js"],"IconMark"]
33
+ 19:null
34
+ 1d:[["$","title","0",{"children":"Siduri — Local-First Companion"}],["$","meta","1",{"name":"description","content":"Siduri — a local-first companion with explicit memory, grounded knowledge, and optional presence."}],["$","link","2",{"rel":"icon","href":"/favicon.ico?favicon.3rlors1ui1gw9.ico","sizes":"256x256","type":"image/x-icon"}],["$","link","3",{"rel":"icon","href":"/favicon.ico"}],["$","link","4",{"rel":"icon","href":"/favicon.svg","type":"image/svg+xml"}],["$","link","5",{"rel":"apple-touch-icon","href":"/apple-touch-icon.png"}],["$","$L1e","6",{}]]
@@ -1,4 +1,4 @@
1
- :HL["/_next/static/chunks/0e0_fwxai4qpl.css","style"]
1
+ :HL["/_next/static/chunks/2evcd3-u5ivvc.css","style"]
2
2
  :HL["https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Noto+Sans+JP:wght@400;500;700&family=Noto+Serif+JP:wght@400;500;700&display=swap","style"]
3
3
  :HL["/logo-circle.svg","image"]
4
- 0:{"tree":{"name":"","param":null,"prefetchHints":4176,"slots":{"children":{"name":"__PAGE__","param":null,"prefetchHints":4256,"slots":null}}},"staleTime":300,"buildId":"AZPivdC8Bi_P27SqlyGnq"}
4
+ 0:{"tree":{"name":"","param":null,"prefetchHints":4176,"slots":{"children":{"name":"__PAGE__","param":null,"prefetchHints":4256,"slots":null}}},"staleTime":300,"buildId":"NgACehmLOdq_GfPnqeF6o"}
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,80951,e=>{"use strict";var s=e.i(30696),t=e.i(64249);function a({title:e,detail:t}){return(0,s.jsxs)("div",{className:"empty-state",children:[(0,s.jsx)("span",{children:"◌"}),(0,s.jsx)("strong",{children:e}),(0,s.jsx)("p",{children:t})]})}var n=e.i(94108),i=e.i(51523);function r(e){return e.length>19?`${e.slice(0,9)}…${e.slice(-7)}`:e}function l(e){if(!e)return"—";let s=new Date(e);return Number.isNaN(s.valueOf())?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}function o({status:e}){return(0,s.jsxs)("article",{className:"status-card",children:[(0,s.jsxs)("div",{className:"status-card-top",children:[(0,s.jsx)("span",{children:e.label}),(0,s.jsx)("i",{className:`status-dot ${e.tone??"warn"}`})]}),(0,s.jsx)("strong",{children:e.value}),(0,s.jsx)("small",{children:e.detail??"—"})]})}function c({title:e,action:t,onClick:a}){return(0,s.jsxs)("div",{className:"panel-header",children:[(0,s.jsx)("h2",{children:e}),t&&(0,s.jsxs)("button",{onClick:a,children:[t," →"]})]})}function d({label:e,count:t,tone:a}){return(0,s.jsxs)("div",{className:"queue-row",children:[(0,s.jsx)("span",{children:e}),(0,s.jsx)("b",{className:`queue-count ${a}`,children:t})]})}function h({proposals:e,claims:t,items:o,directives:c,onAction:d,onRefresh:p}){async function u(e,s){await (0,n.postJson)(e,{id:s,companionId:"default"}),await p()}return(0,s.jsxs)("div",{className:"console-view",children:[(0,s.jsxs)("div",{className:"view-intro",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"console-eyebrow",children:"COMPANION MEMORY"}),(0,s.jsx)("h2",{children:"Review candidates before they become facts."}),(0,s.jsx)("p",{children:"Every candidate stays isolated until you explicitly approve it."})]}),(0,s.jsxs)("span",{className:"count-badge",children:[e.length," pending"]})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Pending memory"}),(0,s.jsx)("span",{children:"Local approval queue"})]}),e.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Candidate"}),(0,s.jsx)("th",{children:"Provenance"}),(0,s.jsx)("th",{children:"Sensitivity"}),(0,s.jsx)("th",{children:"Action"})]})}),(0,s.jsx)("tbody",{children:e.map(e=>(0,s.jsx)(m,{item:e,onAction:d},e.proposal_id))})]})}):(0,s.jsx)(a,{title:"No pending candidates",detail:"Siduri memory suggestions will appear here for review."})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Behavioral Directives"}),(0,s.jsx)("span",{children:"Active behaviors and learned relationships"})]}),c.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Directive"}),(0,s.jsx)("th",{children:"Scope & Activation"}),(0,s.jsx)("th",{children:"Class"}),(0,s.jsx)("th",{children:"Status"}),(0,s.jsx)("th",{children:"Actions"})]})}),(0,s.jsx)("tbody",{children:c.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:(0,i.formatRuntimeEffect)(e)}),(0,s.jsxs)("details",{className:"row-details",children:[(0,s.jsx)("summary",{children:r(e.directive_id)}),(0,s.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.activation})}),(0,s.jsx)("td",{children:(0,s.jsxs)("span",{className:"tag",children:[e.domain," / ",e.memory_class]})}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:`tag status-${e.status}`,children:e.status})}),(0,s.jsx)("td",{children:(0,s.jsxs)("div",{className:"table-actions",children:["pending"===e.status&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{className:"tiny-button approve-button",onClick:()=>void u("/memory/behavioral/approve",e.directive_id),children:"Approve"}),(0,s.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void u("/memory/behavioral/reject",e.directive_id),children:"Reject"})]}),"confirmed"===e.status&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void u("/memory/behavioral/revoke",e.directive_id),children:"Revoke"}),"disabled"!==e.activation&&(0,s.jsx)("button",{className:"tiny-button",onClick:()=>void u("/memory/behavioral/disable",e.directive_id),children:"Disable"})]})]})})]},e.directive_id))})]})}):(0,s.jsx)(a,{title:"No behavioral directives",detail:"Behavioral rules taught in private chat will appear here."})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Structured Claims"}),(0,s.jsx)("span",{children:"Queryable personal and game knowledge"})]}),t.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Subject"}),(0,s.jsx)("th",{children:"Predicate"}),(0,s.jsx)("th",{children:"Value"}),(0,s.jsx)("th",{children:"Status"})]})}),(0,s.jsx)("tbody",{children:t.slice().reverse().map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:e.subject}),(0,s.jsxs)("details",{className:"row-details",children:[(0,s.jsx)("summary",{children:r(e.claim_id)}),(0,s.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.predicate})}),(0,s.jsx)("td",{children:e.value}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:`tag status-${e.status}`,children:e.status})})]},e.claim_id))})]})}):(0,s.jsx)(a,{title:"No structured claims",detail:"Approved teachings will become queryable claims here."})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Compatibility Memory Items"}),(0,s.jsx)("span",{children:"Legacy text projection"})]}),o.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Fact"}),(0,s.jsx)("th",{children:"Provenance"}),(0,s.jsx)("th",{children:"Sensitivity"}),(0,s.jsx)("th",{children:"Created"})]})}),(0,s.jsx)("tbody",{children:o.slice().reverse().map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:e.content}),(0,s.jsxs)("details",{className:"row-details",children:[(0,s.jsx)("summary",{children:r(e.memory_id)}),(0,s.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.provenance})}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.sensitivity})}),(0,s.jsx)("td",{children:l(e.created_at)})]},e.memory_id))})]})}):(0,s.jsx)(a,{title:"No compatibility items",detail:"Legacy approved memory text will appear here."})]})]})}function m({item:e,onAction:a}){let[n,l]=(0,t.useState)(e.content);return(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:(0,i.formatClaimReceipt)(e)}),(0,s.jsxs)("details",{className:"row-details",children:[(0,s.jsxs)("summary",{children:["Edit raw record · ",r(e.proposal_id)]}),(0,s.jsx)("textarea",{className:"table-editor",value:n,onChange:e=>l(e.target.value),"aria-label":`Memory candidate ${e.proposal_id}`}),(0,s.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,s.jsx)("td",{children:e.provenance}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.sensitivity})}),(0,s.jsx)("td",{children:(0,s.jsxs)("div",{className:"table-actions",children:[(0,s.jsx)("button",{className:"tiny-button",onClick:()=>void a("/memory/proposals/update",e,n),children:"Save"}),(0,s.jsx)("button",{className:"tiny-button approve-button",onClick:()=>void a("/memory/proposals/approve",e),children:"Approve"}),(0,s.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void a("/memory/proposals/reject",e),children:"Reject"})]})})]})}function p({results:e,observations:t,onCreate:n,onRefresh:i}){return(0,s.jsxs)("div",{className:"console-view",children:[(0,s.jsxs)("div",{className:"view-intro",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"console-eyebrow",children:"GROUNDING"}),(0,s.jsx)("h2",{children:"Evidence, with uncertainty intact."}),(0,s.jsx)("p",{children:"Inspect bounded citations and short-lived observations without exposing raw captures."})]}),(0,s.jsxs)("div",{className:"button-row",children:[(0,s.jsx)("button",{onClick:()=>void n(),children:"Create fixture"}),(0,s.jsx)("button",{className:"soft-button",onClick:()=>void i(),children:"Refresh"})]})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Knowledge Base Citations"}),(0,s.jsxs)("span",{children:[e.length," results"]})]}),e.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Source"}),(0,s.jsx)("th",{children:"Revision"}),(0,s.jsx)("th",{children:"Preview"}),(0,s.jsx)("th",{children:"Link"})]})}),(0,s.jsx)("tbody",{children:e.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:e.title}),(0,s.jsx)("small",{children:e.endpoint})]}),(0,s.jsx)("td",{children:e.revision||"—"}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.preview?"Preview":"Published"})}),(0,s.jsx)("td",{children:(0,s.jsx)("a",{className:"table-link",href:e.url,target:"_blank",rel:"noreferrer",children:"Open ↗"})})]},e.url))})]})}):(0,s.jsx)(a,{title:"No evidence loaded",detail:"Create a fixture observation or refresh the source."})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Current observations"}),(0,s.jsx)("span",{children:"Raw frames are never shown here"})]}),t.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Observation"}),(0,s.jsx)("th",{children:"Captured"}),(0,s.jsx)("th",{children:"Expires"}),(0,s.jsx)("th",{children:"Readings"})]})}),(0,s.jsx)("tbody",{children:t.map((e,t)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:r(e.observation_id??"observation")}),(0,s.jsx)("td",{children:l(e.observed_at)}),(0,s.jsx)("td",{children:l(e.expires_at)}),(0,s.jsx)("td",{children:Array.isArray(e.readings)?e.readings.length:0})]},e.observation_id??t))})]})}):(0,s.jsx)(a,{title:"No active observations",detail:"Observations are bounded and expire automatically."})]})]})}function u({health:e,voice:t,obs:a,proposals:n,responseJson:i,pendingCorrelationId:r,busy:l,onTrigger:h,onObserve:m,onApprove:p,onNavigate:x}){return(0,s.jsxs)("div",{className:"console-view",children:[(0,s.jsxs)("div",{className:"status-grid",children:[(0,s.jsx)(o,{status:e}),(0,s.jsx)(o,{status:t}),(0,s.jsx)(o,{status:a})]}),(0,s.jsxs)("div",{className:"console-columns",children:[(0,s.jsxs)("section",{className:"console-panel approval-panel",children:[(0,s.jsx)(c,{title:"Response gate",action:"Review policy",onClick:()=>x("settings")}),(0,s.jsxs)("div",{className:"gate-row",children:[(0,s.jsx)("span",{className:`gate-icon ${r?"pending":"ready"}`,children:r?"!":"✓"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:r?"Grounded response awaiting approval":"No response awaiting approval"}),(0,s.jsx)("p",{children:r?"Public output is held until you approve it.":"Local mock responses remain private."})]})]}),(0,s.jsxs)("div",{className:"button-row",children:[(0,s.jsx)("button",{onClick:()=>void h(),disabled:l,children:"Trigger mock response"}),(0,s.jsx)("button",{className:"soft-button",onClick:()=>void m(),disabled:l,children:"Observe and respond"}),r&&(0,s.jsx)("button",{className:"approve-button",onClick:()=>void p(),children:"Approve response"})]}),null!==i&&(0,s.jsxs)("details",{className:"technical-details",children:[(0,s.jsx)("summary",{children:"Technical details"}),(0,s.jsx)("pre",{children:JSON.stringify(i,null,2)})]})]}),(0,s.jsxs)("section",{className:"console-panel queue-panel",children:[(0,s.jsx)(c,{title:"Needs attention",action:"View memory",onClick:()=>x("memory")}),(0,s.jsx)(d,{label:"Memory proposals",count:n.length,tone:n.length?"warn":"quiet"})]})]}),(0,s.jsxs)("section",{className:"console-panel quick-panel",children:[(0,s.jsx)(c,{title:"Quick actions"}),(0,s.jsxs)("div",{className:"quick-actions",children:[(0,s.jsxs)("button",{onClick:()=>x("memory"),children:["Review memory ",(0,s.jsx)("span",{children:"→"})]}),(0,s.jsxs)("button",{onClick:()=>x("evidence"),children:["Inspect evidence ",(0,s.jsx)("span",{children:"→"})]}),(0,s.jsxs)("button",{onClick:()=>x("settings"),children:["Identity & Directives ",(0,s.jsx)("span",{children:"→"})]})]})]})]})}function x({onResetMemory:e,disabled:t}){return(0,s.jsxs)("div",{className:"console-view",children:[(0,s.jsx)("div",{className:"view-intro",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"console-eyebrow",children:"RUNTIME IDENTITY"}),(0,s.jsx)("h2",{children:"Companion Identity & Directives"}),(0,s.jsx)("p",{children:"Identity and behavioral preferences are governed dynamically through conversational teaching and reviewed in the Memory tab."})]})}),(0,s.jsxs)("section",{className:"console-panel profile-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Identity Directives"}),(0,s.jsx)("span",{children:"Governed Memory Model"})]}),(0,s.jsx)(a,{title:"Dynamic identity active",detail:"Siduri establishes preferences and boundaries dynamically through conversation. Use the Private Chat to teach preferences, and the Memory tab to approve or revoke directives."})]}),(0,s.jsxs)("section",{className:"console-panel profile-panel mt-6",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Danger Zone"}),(0,s.jsx)("span",{children:"Irreversible actions"})]}),(0,s.jsxs)("div",{className:"p-6 bg-red-900/20 border border-red-500/20 rounded-lg",children:[(0,s.jsx)("h3",{className:"text-red-400 font-medium mb-2",children:"Reset All Memory"}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"This will permanently delete all memory items, proposals, revisions, and claims from the database. The companion will forget all approved claims, directives, and proposals."}),(0,s.jsx)("button",{className:"bg-red-500/10 text-red-400 border border-red-500/50 hover:bg-red-500/20 px-4 py-2 rounded-md font-medium transition-colors",onClick:()=>void e(),disabled:t,children:"Reset Memory"})]})]})]})}e.s(["default",0,function(){let[e,a]=(0,t.useState)("overview"),[i,r]=(0,t.useState)({label:"Orchestrator",value:"Checking",tone:"warn"}),[l,o]=(0,t.useState)({label:"Voice",value:"Checking",tone:"warn"}),[c,d]=(0,t.useState)({label:"OBS capture",value:"Checking",tone:"warn"}),[m,j]=(0,t.useState)(""),[v,b]=(0,t.useState)([]),[y,g]=(0,t.useState)([]),[N,f]=(0,t.useState)([]),[w,S]=(0,t.useState)([]),[C,k]=(0,t.useState)([]),[_,$]=(0,t.useState)([]),[O,R]=(0,t.useState)("{}"),[J,T]=(0,t.useState)(""),[I,A]=(0,t.useState)(null),[P,E]=(0,t.useState)(null),[U,D]=(0,t.useState)(!1);async function M(){try{let[e,s,t]=await Promise.all([(0,n.getJson)("/health"),(0,n.getJson)("/version"),(0,n.getJson)("/ready")]);r({label:"Orchestrator",value:"ok"===e.status?"Online":e.status,detail:`v${s.version}`,tone:"ok"===e.status?"good":"warn"}),j(s.version),t.dependencies?.model_provider?.ready===!1&&r(e=>({...e,detail:"Model provider degraded",tone:"warn"}))}catch{r({label:"Orchestrator",value:"Offline",detail:"Start the Python API",tone:"bad"})}try{let e=await (0,n.getJson)("/voice/health");o({label:"Voice",value:e.healthy?"Ready":"Fallback",detail:e.provider,tone:e.healthy?"good":"warn"})}catch{o({label:"Voice",value:"Unavailable",detail:"Subtitle fallback",tone:"warn"})}try{let e=await (0,n.getJson)("/obs/health");d({label:"OBS capture",value:e.connected?"Connected":e.configured?"Disconnected":"Disabled",detail:e.source_name?`Source: ${e.source_name}`:"No source configured",tone:e.connected?"good":"warn"})}catch{d({label:"OBS capture",value:"Unavailable",tone:"bad"})}}async function L(){try{let[e,s,t,a]=await Promise.all([(0,n.getJson)("/memory/proposals"),(0,n.getJson)("/memory"),(0,n.getJson)("/memory/claims"),(0,n.getJson)("/memory/behavioral")]);b((e.proposals??[]).filter(e=>"pending"===e.status)),f(s.items??[]),g(t.claims??[]),S(a.directives??[])}catch{b([]),f([]),g([]),S([])}}async function B(){try{let[e,s]=await Promise.all([(0,n.getJson)("/evidence"),(0,n.getJson)("/observations")]);k(e.results??[]),$(s.observations??[])}catch{k([]),$([])}}async function q(){try{R(JSON.stringify(await (0,n.getJson)("/me"),null,2))}catch{R("Unable to load profile.")}}async function W(){D(!0);try{A(await (0,n.postJson)("/dev/mock-response"))}finally{D(!1)}}async function F(){D(!0);try{let e=await (0,n.postJson)("/dev/observe-and-respond");A(e);let s="string"==typeof e?.metadata?.correlation_id?e.metadata.correlation_id:null;E(s)}finally{D(!1)}}async function V(){if(P){D(!0);try{A(await (0,n.postJson)("/dev/approve-response",{correlation_id:P})),E(null)}finally{D(!1)}}}async function G(e,s,t){await (0,n.postAction)(e,{id:s.proposal_id,companionId:"default",...void 0===t?{}:{content:t}}),await L()}async function K(){await (0,n.postAction)("/dev/mock-observation"),await B()}async function Q(){if(window.confirm("Are you sure you want to completely reset all memory? This action cannot be undone.")){D(!0);try{await (0,n.postJson)("/dev/memory/reset"),await L(),T("Memory has been completely reset.")}catch(e){T(String(e))}finally{D(!1)}}}return(0,t.useEffect)(()=>{M(),L(),B(),q()},[]),(0,s.jsxs)("main",{className:"console-app",children:[(0,s.jsxs)("aside",{className:"console-sidebar",children:[(0,s.jsxs)("a",{className:"console-brand",href:"/chat",children:[(0,s.jsx)("span",{className:"console-brand-mark",children:"S"}),(0,s.jsx)("span",{children:"SIDURI"})]}),(0,s.jsxs)("div",{className:"console-context",children:[(0,s.jsx)("span",{className:"console-context-dot"}),"Operator workspace"]}),(0,s.jsx)("nav",{className:"console-nav","aria-label":"Console sections",children:["overview","memory","evidence","settings"].map(t=>(0,s.jsxs)("button",{className:e===t?"active":"",onClick:()=>a(t),children:[(0,s.jsx)("span",{className:`nav-glyph nav-${t}`}),t[0].toUpperCase()+t.slice(1)]},t))}),(0,s.jsxs)("div",{className:"console-sidebar-bottom",children:[(0,s.jsx)("a",{href:"/chat",children:"← Private chat"}),(0,s.jsx)("span",{children:"Local operator surface"})]})]}),(0,s.jsxs)("section",{className:"console-main",children:[(0,s.jsxs)("header",{className:"console-topbar",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"console-eyebrow",children:"SIDURI / OPERATOR"}),(0,s.jsx)("h1",{children:"overview"===e?"Control room":e[0].toUpperCase()+e.slice(1)})]}),(0,s.jsxs)("div",{className:"console-top-actions",children:[(0,s.jsxs)("span",{className:"console-version",children:["v",m||"—"]}),(0,s.jsx)("button",{className:"console-refresh",onClick:()=>{M(),L(),B()},"aria-label":"Refresh dashboard",children:"↻"})]})]}),J&&(0,s.jsx)("div",{className:"console-notice",children:J}),"overview"===e&&(0,s.jsx)(u,{health:i,voice:l,obs:c,proposals:v,responseJson:I,pendingCorrelationId:P,busy:U,onTrigger:W,onObserve:F,onApprove:V,onNavigate:a}),"memory"===e&&(0,s.jsx)(h,{proposals:v,claims:y,items:N,directives:w,onAction:G,onRefresh:L}),"evidence"===e&&(0,s.jsx)(p,{results:C,observations:_,onCreate:K,onRefresh:B}),"settings"===e&&(0,s.jsx)(x,{onResetMemory:Q,disabled:U})]})]})}],80951)},94108,e=>{"use strict";var s=e.i(28152);let t=s.default.env.NEXT_PUBLIC_API_URL??"";async function a(e,s){return fetch(`${t}${e}`,s)}async function n(e,s){let t=await a(e,s);if(!t.ok)throw Error(`${e} returned ${t.status}`);return t.json()}async function i(e,s){let t=await a(e,{method:"POST",headers:s?{"Content-Type":"application/json"}:void 0,body:s?"string"==typeof s?s:JSON.stringify(s):void 0});if(!t.ok)throw Error(await t.text().catch(()=>t.statusText));return t.json().catch(()=>({}))}async function r(e,s){let t=await a(e,{method:"POST",headers:s?{"Content-Type":"application/json"}:void 0,body:s?"string"==typeof s?s:JSON.stringify(s):void 0});if(!t.ok)throw Error(await t.text().catch(()=>t.statusText))}async function l(e,s,t,n){let i=await a(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:n});if(!i.ok)throw Error(await i.text().catch(()=>i.statusText)||`HTTP ${i.status}`);if(!i.body)throw Error("ReadableStream not supported in response");let r=i.body.getReader(),l=new TextDecoder,o="";try{for(;;){let{done:e,value:s}=await r.read();if(e)break;let a=(o+=l.decode(s,{stream:!0})).split("\n");o=a.pop()||"";let n="message";for(let e of a){let s=e.trim();if(s){if(s.startsWith("event:"))n=s.slice(6).trim();else if(s.startsWith("data:")){let e=s.slice(5).trim();try{let s=JSON.parse(e);switch(n){case"staged":t.onStaged?.(s);break;case"chunk":t.onChunk?.(s);break;case"avatar":t.onAvatar?.(s);break;case"done":t.onDone?.(s);break;case"interrupted":t.onInterrupted?.(s);break;case"error":t.onError?.(Error(s.error||"Stream error"))}}catch{}}}}}}catch(e){if(n?.aborted)t.onInterrupted?.({reason:n.reason});else throw t.onError?.(e),e}finally{r.releaseLock()}}async function o(e="default",s="user_barge_in"){await i("/chat/interrupt",{companionId:e,reason:s}).catch(()=>{})}s.default.env.NEXT_PUBLIC_WS_URL||(window.location.protocol,window.location.host),e.s(["fetchApi",0,a,"getJson",0,n,"interruptChat",0,o,"postAction",0,r,"postJson",0,i,"postStream",0,l])},51523,e=>{"use strict";let s=new Set(["siduri","self","companion"]),t=new Set(["user","actor","owner","primary_user"]);function a(e){return e.replace(/[._]+/g," ").replace(/\s+/g," ").trim()}function n(e){let s=e.trim();return s&&!/[.!?]$/.test(s)?`${s}.`:s}function i(e){let i=e.subject?.trim()??"",r=i.toLowerCase(),l=e.predicate?.trim()??"",o=l.toLowerCase(),c=e.value?.trim()??"";if(!i||!l||!c)return n(e.content??c);if(s.has(r))return"name"===o?n(`Companion name is ${c}`):n(`Companion ${a(l)} is ${c}`);if(t.has(r))return"name"===o?n(`User name is ${c}`):"preferred_address"===o?n(`User preferred address is ${c}`):"relationship_to_siduri"===o||"relationship"===o?n(`User relationship configured as ${c}`):n(`User ${a(l)} is ${c}`);if(r.startsWith("primary_user.")||r.startsWith("user.")){let e=r.startsWith("primary_user.")?"primary_user.":"user.",s=a(i.slice(e.length)),t="uid"===o||"id"===o?"ID":a(l);return n(`User ${s} ${t} is ${c}`)}let d=a(i);return n(`${/s$/i.test(d)?`${d}'`:`${d}'s`} ${a(l)} is ${c}`)}e.s(["formatClaimReceipt",0,i,"formatRuntimeEffect",0,function(e){let r=e.subject?.trim().toLowerCase()??"",l=e.predicate?.trim().toLowerCase()??"",o=e.value?.trim()??"",c=e.behavior?.instruction?.trim()??"";return"behavioral"===e.memory_class&&c?n(c):s.has(r)&&"name"===l?n(`Set companion identity/name to ${o}`):s.has(r)?n(`Set companion ${a(l)} to ${o}`):t.has(r)&&("relationship_to_siduri"===l||"relationship"===l)?n(`Set user relationship to ${o}`):t.has(r)&&"name"===l?n(`Set user name to ${o}`):i(e)}])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,80951,e=>{"use strict";var s=e.i(30696),t=e.i(64249);function a({title:e,detail:t}){return(0,s.jsxs)("div",{className:"empty-state",children:[(0,s.jsx)("span",{children:"◌"}),(0,s.jsx)("strong",{children:e}),(0,s.jsx)("p",{children:t})]})}var n=e.i(94108),i=e.i(51523);function r(e){return e.length>19?`${e.slice(0,9)}…${e.slice(-7)}`:e}function l(e){if(!e)return"—";let s=new Date(e);return Number.isNaN(s.valueOf())?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(s)}function o({status:e}){return(0,s.jsxs)("article",{className:"status-card",children:[(0,s.jsxs)("div",{className:"status-card-top",children:[(0,s.jsx)("span",{children:e.label}),(0,s.jsx)("i",{className:`status-dot ${e.tone??"warn"}`})]}),(0,s.jsx)("strong",{children:e.value}),(0,s.jsx)("small",{children:e.detail??"—"})]})}function c({title:e,action:t,onClick:a}){return(0,s.jsxs)("div",{className:"panel-header",children:[(0,s.jsx)("h2",{children:e}),t&&(0,s.jsxs)("button",{onClick:a,children:[t," →"]})]})}function d({label:e,count:t,tone:a}){return(0,s.jsxs)("div",{className:"queue-row",children:[(0,s.jsx)("span",{children:e}),(0,s.jsx)("b",{className:`queue-count ${a}`,children:t})]})}function h({proposals:e,claims:t,items:o,directives:c,onAction:d,onRefresh:u}){async function p(e,s){await (0,n.postJson)(e,{id:s,companionId:"default"}),await u()}return(0,s.jsxs)("div",{className:"console-view",children:[(0,s.jsxs)("div",{className:"view-intro",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"console-eyebrow",children:"COMPANION MEMORY"}),(0,s.jsx)("h2",{children:"Review candidates before they become facts."}),(0,s.jsx)("p",{children:"Every candidate stays isolated until you explicitly approve it."})]}),(0,s.jsxs)("span",{className:"count-badge",children:[e.length," pending"]})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Pending memory"}),(0,s.jsx)("span",{children:"Local approval queue"})]}),e.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Candidate"}),(0,s.jsx)("th",{children:"Provenance"}),(0,s.jsx)("th",{children:"Sensitivity"}),(0,s.jsx)("th",{children:"Action"})]})}),(0,s.jsx)("tbody",{children:e.map(e=>(0,s.jsx)(m,{item:e,onAction:d},e.proposal_id))})]})}):(0,s.jsx)(a,{title:"No pending candidates",detail:"Siduri memory suggestions will appear here for review."})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Behavioral Directives"}),(0,s.jsx)("span",{children:"Active behaviors and learned relationships"})]}),c.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Directive"}),(0,s.jsx)("th",{children:"Scope & Activation"}),(0,s.jsx)("th",{children:"Class"}),(0,s.jsx)("th",{children:"Status"}),(0,s.jsx)("th",{children:"Actions"})]})}),(0,s.jsx)("tbody",{children:c.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:(0,i.formatRuntimeEffect)(e)}),(0,s.jsxs)("details",{className:"row-details",children:[(0,s.jsx)("summary",{children:r(e.directive_id)}),(0,s.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.activation})}),(0,s.jsx)("td",{children:(0,s.jsxs)("span",{className:"tag",children:[e.domain," / ",e.memory_class]})}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:`tag status-${e.status}`,children:e.status})}),(0,s.jsx)("td",{children:(0,s.jsxs)("div",{className:"table-actions",children:["pending"===e.status&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{className:"tiny-button approve-button",onClick:()=>void p("/memory/behavioral/approve",e.directive_id),children:"Approve"}),(0,s.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void p("/memory/behavioral/reject",e.directive_id),children:"Reject"})]}),"confirmed"===e.status&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void p("/memory/behavioral/revoke",e.directive_id),children:"Revoke"}),"disabled"!==e.activation&&(0,s.jsx)("button",{className:"tiny-button",onClick:()=>void p("/memory/behavioral/disable",e.directive_id),children:"Disable"})]})]})})]},e.directive_id))})]})}):(0,s.jsx)(a,{title:"No behavioral directives",detail:"Behavioral rules taught in private chat will appear here."})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Structured Claims"}),(0,s.jsx)("span",{children:"Queryable personal and game knowledge"})]}),t.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Subject"}),(0,s.jsx)("th",{children:"Predicate"}),(0,s.jsx)("th",{children:"Value"}),(0,s.jsx)("th",{children:"Status"})]})}),(0,s.jsx)("tbody",{children:t.slice().reverse().map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:e.subject}),(0,s.jsxs)("details",{className:"row-details",children:[(0,s.jsx)("summary",{children:r(e.claim_id)}),(0,s.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.predicate})}),(0,s.jsx)("td",{children:e.value}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:`tag status-${e.status}`,children:e.status})})]},e.claim_id))})]})}):(0,s.jsx)(a,{title:"No structured claims",detail:"Approved teachings will become queryable claims here."})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Compatibility Memory Items"}),(0,s.jsx)("span",{children:"Legacy text projection"})]}),o.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Fact"}),(0,s.jsx)("th",{children:"Provenance"}),(0,s.jsx)("th",{children:"Sensitivity"}),(0,s.jsx)("th",{children:"Created"})]})}),(0,s.jsx)("tbody",{children:o.slice().reverse().map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:e.content}),(0,s.jsxs)("details",{className:"row-details",children:[(0,s.jsx)("summary",{children:r(e.memory_id)}),(0,s.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.provenance})}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.sensitivity})}),(0,s.jsx)("td",{children:l(e.created_at)})]},e.memory_id))})]})}):(0,s.jsx)(a,{title:"No compatibility items",detail:"Legacy approved memory text will appear here."})]})]})}function m({item:e,onAction:a}){let[n,l]=(0,t.useState)(e.content);return(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:(0,i.formatClaimReceipt)(e)}),(0,s.jsxs)("details",{className:"row-details",children:[(0,s.jsxs)("summary",{children:["Edit raw record · ",r(e.proposal_id)]}),(0,s.jsx)("textarea",{className:"table-editor",value:n,onChange:e=>l(e.target.value),"aria-label":`Memory candidate ${e.proposal_id}`}),(0,s.jsx)("pre",{children:JSON.stringify(e,null,2)})]})]}),(0,s.jsx)("td",{children:e.provenance}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.sensitivity})}),(0,s.jsx)("td",{children:(0,s.jsxs)("div",{className:"table-actions",children:[(0,s.jsx)("button",{className:"tiny-button",onClick:()=>void a("/memory/proposals/update",e,n),children:"Save"}),(0,s.jsx)("button",{className:"tiny-button approve-button",onClick:()=>void a("/memory/proposals/approve",e),children:"Approve"}),(0,s.jsx)("button",{className:"tiny-button danger-button",onClick:()=>void a("/memory/proposals/reject",e),children:"Reject"})]})})]})}function u({results:e,observations:t,onCreate:n,onRefresh:i}){return(0,s.jsxs)("div",{className:"console-view",children:[(0,s.jsxs)("div",{className:"view-intro",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"console-eyebrow",children:"GROUNDING"}),(0,s.jsx)("h2",{children:"Evidence, with uncertainty intact."}),(0,s.jsx)("p",{children:"Inspect bounded citations and short-lived observations without exposing raw captures."})]}),(0,s.jsxs)("div",{className:"button-row",children:[(0,s.jsx)("button",{onClick:()=>void n(),children:"Create fixture"}),(0,s.jsx)("button",{className:"soft-button",onClick:()=>void i(),children:"Refresh"})]})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Knowledge Base Citations"}),(0,s.jsxs)("span",{children:[e.length," results"]})]}),e.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Source"}),(0,s.jsx)("th",{children:"Revision"}),(0,s.jsx)("th",{children:"Preview"}),(0,s.jsx)("th",{children:"Link"})]})}),(0,s.jsx)("tbody",{children:e.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:[(0,s.jsx)("strong",{children:e.title}),(0,s.jsx)("small",{children:e.endpoint})]}),(0,s.jsx)("td",{children:e.revision||"—"}),(0,s.jsx)("td",{children:(0,s.jsx)("span",{className:"tag",children:e.preview?"Preview":"Published"})}),(0,s.jsx)("td",{children:(0,s.jsx)("a",{className:"table-link",href:e.url,target:"_blank",rel:"noreferrer",children:"Open ↗"})})]},e.url))})]})}):(0,s.jsx)(a,{title:"No evidence loaded",detail:"Create a fixture observation or refresh the source."})]}),(0,s.jsxs)("section",{className:"console-panel table-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Current observations"}),(0,s.jsx)("span",{children:"Raw frames are never shown here"})]}),t.length?(0,s.jsx)("div",{className:"data-table-wrap",children:(0,s.jsxs)("table",{className:"data-table",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"Observation"}),(0,s.jsx)("th",{children:"Captured"}),(0,s.jsx)("th",{children:"Expires"}),(0,s.jsx)("th",{children:"Readings"})]})}),(0,s.jsx)("tbody",{children:t.map((e,t)=>(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{children:r(e.observation_id??"observation")}),(0,s.jsx)("td",{children:l(e.observed_at)}),(0,s.jsx)("td",{children:l(e.expires_at)}),(0,s.jsx)("td",{children:Array.isArray(e.readings)?e.readings.length:0})]},e.observation_id??t))})]})}):(0,s.jsx)(a,{title:"No active observations",detail:"Observations are bounded and expire automatically."})]})]})}function p({health:e,voice:t,obs:a,proposals:n,responseJson:i,pendingCorrelationId:r,busy:l,onTrigger:h,onObserve:m,onApprove:u,onNavigate:x}){return(0,s.jsxs)("div",{className:"console-view",children:[(0,s.jsxs)("div",{className:"status-grid",children:[(0,s.jsx)(o,{status:e}),(0,s.jsx)(o,{status:t}),(0,s.jsx)(o,{status:a})]}),(0,s.jsxs)("div",{className:"console-columns",children:[(0,s.jsxs)("section",{className:"console-panel approval-panel",children:[(0,s.jsx)(c,{title:"Response gate",action:"Review policy",onClick:()=>x("settings")}),(0,s.jsxs)("div",{className:"gate-row",children:[(0,s.jsx)("span",{className:`gate-icon ${r?"pending":"ready"}`,children:r?"!":"✓"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{children:r?"Grounded response awaiting approval":"No response awaiting approval"}),(0,s.jsx)("p",{children:r?"Public output is held until you approve it.":"Local mock responses remain private."})]})]}),(0,s.jsxs)("div",{className:"button-row",children:[(0,s.jsx)("button",{onClick:()=>void h(),disabled:l,children:"Trigger mock response"}),(0,s.jsx)("button",{className:"soft-button",onClick:()=>void m(),disabled:l,children:"Observe and respond"}),r&&(0,s.jsx)("button",{className:"approve-button",onClick:()=>void u(),children:"Approve response"})]}),null!==i&&(0,s.jsxs)("details",{className:"technical-details",children:[(0,s.jsx)("summary",{children:"Technical details"}),(0,s.jsx)("pre",{children:JSON.stringify(i,null,2)})]})]}),(0,s.jsxs)("section",{className:"console-panel queue-panel",children:[(0,s.jsx)(c,{title:"Needs attention",action:"View memory",onClick:()=>x("memory")}),(0,s.jsx)(d,{label:"Memory proposals",count:n.length,tone:n.length?"warn":"quiet"})]})]}),(0,s.jsxs)("section",{className:"console-panel quick-panel",children:[(0,s.jsx)(c,{title:"Quick actions"}),(0,s.jsxs)("div",{className:"quick-actions",children:[(0,s.jsxs)("button",{onClick:()=>x("memory"),children:["Review memory ",(0,s.jsx)("span",{children:"→"})]}),(0,s.jsxs)("button",{onClick:()=>x("evidence"),children:["Inspect evidence ",(0,s.jsx)("span",{children:"→"})]}),(0,s.jsxs)("button",{onClick:()=>x("settings"),children:["Identity & Directives ",(0,s.jsx)("span",{children:"→"})]})]})]})]})}function x({onResetMemory:e,disabled:t}){return(0,s.jsxs)("div",{className:"console-view",children:[(0,s.jsx)("div",{className:"view-intro",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"console-eyebrow",children:"RUNTIME IDENTITY"}),(0,s.jsx)("h2",{children:"Companion Identity & Directives"}),(0,s.jsx)("p",{children:"Identity and behavioral preferences are governed dynamically through conversational teaching and reviewed in the Memory tab."})]})}),(0,s.jsxs)("section",{className:"console-panel profile-panel",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Identity Directives"}),(0,s.jsx)("span",{children:"Governed Memory Model"})]}),(0,s.jsx)(a,{title:"Dynamic identity active",detail:"Siduri establishes preferences and boundaries dynamically through conversation. Use the Private Chat to teach preferences, and the Memory tab to approve or revoke directives."})]}),(0,s.jsxs)("section",{className:"console-panel profile-panel mt-6",children:[(0,s.jsxs)("div",{className:"table-toolbar",children:[(0,s.jsx)("strong",{children:"Danger Zone"}),(0,s.jsx)("span",{children:"Irreversible actions"})]}),(0,s.jsxs)("div",{className:"p-6 bg-red-900/20 border border-red-500/20 rounded-lg",children:[(0,s.jsx)("h3",{className:"text-red-400 font-medium mb-2",children:"Reset All Memory"}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mb-4",children:"This will permanently delete all memory items, proposals, revisions, and claims from the database. The companion will forget all approved claims, directives, and proposals."}),(0,s.jsx)("button",{className:"bg-red-500/10 text-red-400 border border-red-500/50 hover:bg-red-500/20 px-4 py-2 rounded-md font-medium transition-colors",onClick:()=>void e(),disabled:t,children:"Reset Memory"})]})]})]})}e.s(["default",0,function(){let[e,a]=(0,t.useState)("overview"),[i,r]=(0,t.useState)({label:"Orchestrator",value:"Checking",tone:"warn"}),[l,o]=(0,t.useState)({label:"Voice",value:"Checking",tone:"warn"}),[c,d]=(0,t.useState)({label:"OBS capture",value:"Checking",tone:"warn"}),[m,j]=(0,t.useState)(""),[v,b]=(0,t.useState)([]),[y,g]=(0,t.useState)([]),[N,f]=(0,t.useState)([]),[w,C]=(0,t.useState)([]),[S,k]=(0,t.useState)([]),[_,$]=(0,t.useState)([]),[O,R]=(0,t.useState)("{}"),[J,T]=(0,t.useState)(""),[I,P]=(0,t.useState)(null),[A,E]=(0,t.useState)(null),[U,D]=(0,t.useState)(!1);async function M(){try{let[e,s,t]=await Promise.all([(0,n.getJson)("/health"),(0,n.getJson)("/version"),(0,n.getJson)("/ready")]);r({label:"Orchestrator",value:"ok"===e.status?"Online":e.status,detail:`v${s.version}`,tone:"ok"===e.status?"good":"warn"}),j(s.version),t.dependencies?.model_provider?.ready===!1&&r(e=>({...e,detail:"Model provider degraded",tone:"warn"}))}catch{r({label:"Orchestrator",value:"Offline",detail:"Start the Python API",tone:"bad"})}try{let e=await (0,n.getJson)("/voice/health");o({label:"Voice",value:e.healthy?"Ready":"Fallback",detail:e.provider,tone:e.healthy?"good":"warn"})}catch{o({label:"Voice",value:"Unavailable",detail:"Subtitle fallback",tone:"warn"})}try{let e=await (0,n.getJson)("/obs/health");d({label:"OBS capture",value:e.connected?"Connected":e.configured?"Disconnected":"Disabled",detail:e.source_name?`Source: ${e.source_name}`:"No source configured",tone:e.connected?"good":"warn"})}catch{d({label:"OBS capture",value:"Unavailable",tone:"bad"})}}async function L(){try{let[e,s,t,a]=await Promise.all([(0,n.getJson)("/memory/proposals"),(0,n.getJson)("/memory"),(0,n.getJson)("/memory/claims"),(0,n.getJson)("/memory/behavioral")]);b((e.proposals??[]).filter(e=>"pending"===e.status)),f(s.items??[]),g(t.claims??[]),C(a.directives??[])}catch{b([]),f([]),g([]),C([])}}async function B(){try{let[e,s]=await Promise.all([(0,n.getJson)("/evidence"),(0,n.getJson)("/observations")]);k(e.results??[]),$(s.observations??[])}catch{k([]),$([])}}async function q(){try{R(JSON.stringify(await (0,n.getJson)("/me"),null,2))}catch{R("Unable to load profile.")}}async function W(){D(!0);try{P(await (0,n.postJson)("/dev/mock-response"))}finally{D(!1)}}async function F(){D(!0);try{let e=await (0,n.postJson)("/dev/observe-and-respond");P(e);let s="string"==typeof e?.metadata?.correlation_id?e.metadata.correlation_id:null;E(s)}finally{D(!1)}}async function V(){if(A){D(!0);try{P(await (0,n.postJson)("/dev/approve-response",{correlation_id:A})),E(null)}finally{D(!1)}}}async function G(e,s,t){await (0,n.postAction)(e,{id:s.proposal_id,companionId:"default",...void 0===t?{}:{content:t}}),await L()}async function K(){await (0,n.postAction)("/dev/mock-observation"),await B()}async function Q(){if(window.confirm("Are you sure you want to completely reset all memory? This action cannot be undone.")){D(!0);try{await (0,n.postJson)("/dev/memory/reset"),await L(),T("Memory has been completely reset.")}catch(e){T(String(e))}finally{D(!1)}}}return(0,t.useEffect)(()=>{M(),L(),B(),q()},[]),(0,s.jsxs)("main",{className:"console-app",children:[(0,s.jsxs)("aside",{className:"console-sidebar",children:[(0,s.jsxs)("div",{className:"console-sidebar-header flex items-center justify-between w-full",children:[(0,s.jsxs)("a",{className:"console-brand",href:"/chat",children:[(0,s.jsx)("span",{className:"console-brand-mark",children:"S"}),(0,s.jsx)("span",{children:"SIDURI"})]}),(0,s.jsx)("a",{href:"/chat",className:"console-mobile-back","aria-label":"Back to chat",children:"← Chat"})]}),(0,s.jsxs)("div",{className:"console-context",children:[(0,s.jsx)("span",{className:"console-context-dot"}),"Operator workspace"]}),(0,s.jsx)("nav",{className:"console-nav","aria-label":"Console sections",children:["overview","memory","evidence","settings"].map(t=>(0,s.jsxs)("button",{className:e===t?"active":"",onClick:()=>a(t),children:[(0,s.jsx)("span",{className:`nav-glyph nav-${t}`}),t[0].toUpperCase()+t.slice(1)]},t))}),(0,s.jsxs)("div",{className:"console-sidebar-bottom",children:[(0,s.jsx)("a",{href:"/chat",children:"← Private chat"}),(0,s.jsx)("span",{children:"Local operator surface"})]})]}),(0,s.jsxs)("section",{className:"console-main",children:[(0,s.jsxs)("header",{className:"console-topbar",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"console-eyebrow",children:"SIDURI / OPERATOR"}),(0,s.jsx)("h1",{children:"overview"===e?"Control room":e[0].toUpperCase()+e.slice(1)})]}),(0,s.jsxs)("div",{className:"console-top-actions",children:[(0,s.jsx)("a",{href:"/chat",className:"console-back-link",title:"Return to Private Chat",children:"← Chat"}),(0,s.jsxs)("span",{className:"console-version",children:["v",m||"—"]}),(0,s.jsx)("button",{className:"console-refresh",onClick:()=>{M(),L(),B()},"aria-label":"Refresh dashboard",children:"↻"})]})]}),J&&(0,s.jsx)("div",{className:"console-notice",children:J}),"overview"===e&&(0,s.jsx)(p,{health:i,voice:l,obs:c,proposals:v,responseJson:I,pendingCorrelationId:A,busy:U,onTrigger:W,onObserve:F,onApprove:V,onNavigate:a}),"memory"===e&&(0,s.jsx)(h,{proposals:v,claims:y,items:N,directives:w,onAction:G,onRefresh:L}),"evidence"===e&&(0,s.jsx)(u,{results:S,observations:_,onCreate:K,onRefresh:B}),"settings"===e&&(0,s.jsx)(x,{onResetMemory:Q,disabled:U})]})]})}],80951)},94108,e=>{"use strict";var s=e.i(28152);let t=s.default.env.NEXT_PUBLIC_API_URL??"";async function a(e,s){return fetch(`${t}${e}`,s)}async function n(e,s){let t=await a(e,s);if(!t.ok)throw Error(`${e} returned ${t.status}`);return t.json()}async function i(e,s){let t=await a(e,{method:"POST",headers:s?{"Content-Type":"application/json"}:void 0,body:s?"string"==typeof s?s:JSON.stringify(s):void 0});if(!t.ok)throw Error(await t.text().catch(()=>t.statusText));return t.json().catch(()=>({}))}async function r(e,s){let t=await a(e,{method:"POST",headers:s?{"Content-Type":"application/json"}:void 0,body:s?"string"==typeof s?s:JSON.stringify(s):void 0});if(!t.ok)throw Error(await t.text().catch(()=>t.statusText))}async function l(e,s,t,n){let i=await a(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:n});if(!i.ok)throw Error(await i.text().catch(()=>i.statusText)||`HTTP ${i.status}`);if(!i.body)throw Error("ReadableStream not supported in response");let r=i.body.getReader(),l=new TextDecoder,o="";try{for(;;){let{done:e,value:s}=await r.read();if(e)break;let a=(o+=l.decode(s,{stream:!0})).split("\n");o=a.pop()||"";let n="message";for(let e of a){let s=e.trim();if(s){if(s.startsWith("event:"))n=s.slice(6).trim();else if(s.startsWith("data:")){let e=s.slice(5).trim();try{let s=JSON.parse(e);switch(n){case"staged":t.onStaged?.(s);break;case"chunk":t.onChunk?.(s);break;case"avatar":t.onAvatar?.(s);break;case"done":t.onDone?.(s);break;case"interrupted":t.onInterrupted?.(s);break;case"error":t.onError?.(Error(s.error||"Stream error"))}}catch{}}}}}}catch(e){if(n?.aborted)t.onInterrupted?.({reason:n.reason});else throw t.onError?.(e),e}finally{r.releaseLock()}}async function o(e="default",s="user_barge_in"){await i("/chat/interrupt",{companionId:e,reason:s}).catch(()=>{})}s.default.env.NEXT_PUBLIC_WS_URL||(window.location.protocol,window.location.host),e.s(["fetchApi",0,a,"getJson",0,n,"interruptChat",0,o,"postAction",0,r,"postJson",0,i,"postStream",0,l])},51523,e=>{"use strict";let s=new Set(["siduri","self","companion"]),t=new Set(["user","actor","owner","primary_user"]);function a(e){return e.replace(/[._]+/g," ").replace(/\s+/g," ").trim()}function n(e){let s=e.trim();return s&&!/[.!?]$/.test(s)?`${s}.`:s}function i(e){let i=e.subject?.trim()??"",r=i.toLowerCase(),l=e.predicate?.trim()??"",o=l.toLowerCase(),c=e.value?.trim()??"";if(!i||!l||!c)return n(e.content??c);if(s.has(r))return"name"===o?n(`Companion name is ${c}`):n(`Companion ${a(l)} is ${c}`);if(t.has(r))return"name"===o?n(`User name is ${c}`):"preferred_address"===o?n(`User preferred address is ${c}`):"relationship_to_siduri"===o||"relationship"===o?n(`User relationship configured as ${c}`):n(`User ${a(l)} is ${c}`);if(r.startsWith("primary_user.")||r.startsWith("user.")){let e=r.startsWith("primary_user.")?"primary_user.":"user.",s=a(i.slice(e.length)),t="uid"===o||"id"===o?"ID":a(l);return n(`User ${s} ${t} is ${c}`)}let d=a(i);return n(`${/s$/i.test(d)?`${d}'`:`${d}'s`} ${a(l)} is ${c}`)}e.s(["formatClaimReceipt",0,i,"formatRuntimeEffect",0,function(e){let r=e.subject?.trim().toLowerCase()??"",l=e.predicate?.trim().toLowerCase()??"",o=e.value?.trim()??"",c=e.behavior?.instruction?.trim()??"";return"behavioral"===e.memory_class&&c?n(c):s.has(r)&&"name"===l?n(`Set companion identity/name to ${o}`):s.has(r)?n(`Set companion ${a(l)} to ${o}`):t.has(r)&&("relationship_to_siduri"===l||"relationship"===l)?n(`Set user relationship to ${o}`):t.has(r)&&"name"===l?n(`Set user name to ${o}`):i(e)}])}]);
@@ -1,4 +1,4 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12650,e=>{"use strict";var t=e.i(30696),a=e.i(64249),r=e.i(51523);function i({onSelectPrompt:e,className:a=""}){return(0,t.jsxs)("div",{className:`chat-empty-state ${a}`,"data-testid":"preferences-starter",children:[(0,t.jsx)("div",{className:"siduri-orb",children:"✦"}),(0,t.jsx)("h2",{children:"Teach Siduri your preferences."}),(0,t.jsx)("p",{children:"Choose a starting point, replace the blanks, and send it. Nothing becomes memory until you approve the receipt."}),(0,t.jsxs)("div",{className:"starter-prompts onboarding-prompts",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>e("Call me [preferred name]."),children:[(0,t.jsx)("span",{children:"Identity"}),"Preferred name or title"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>e("My timezone is [timezone] and my preferred language is [language]."),children:[(0,t.jsx)("span",{children:"Localization"}),"Timezone and language"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>e("My preferred response style is [concise / detailed / technical]."),children:[(0,t.jsx)("span",{children:"Response style"}),"Tone and verbosity"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>e("I am interested in [topics or domains of interest]."),children:[(0,t.jsx)("span",{children:"Knowledge"}),"Topics of interest"]})]}),(0,t.jsx)("p",{className:"onboarding-privacy",children:"Teach Siduri preferences explicitly. Information is stored in private memory only after you approve the receipt."})]})}function s(e){return"number"!=typeof e||isNaN(e)||e<0?0:e>1?1:e}class n{expression="neutral";action="idle";state="idle";speechId;lipSyncValue=0;reducedMotion=!1;actionStartTime=0;stateStartTime=0;lastUpdateTime=Date.now();constructor(e){e&&this.updateConfig(e)}updateConfig(e){e.expression&&e.expression!==this.expression&&(this.expression=e.expression),e.action&&e.action!==this.action&&(this.action=e.action,this.actionStartTime=Date.now()),e.state&&e.state!==this.state&&(this.state=e.state,this.stateStartTime=Date.now()),void 0!==e.speechId&&(this.speechId=e.speechId),void 0!==e.lipSyncValue&&(this.lipSyncValue=s(e.lipSyncValue)),void 0!==e.reducedMotion&&(this.reducedMotion=e.reducedMotion)}setReducedMotion(e){this.reducedMotion=e}setExpression(e){this.expression=e}setAction(e){this.action=e,this.actionStartTime=Date.now()}setState(e){this.state=e,this.stateStartTime=Date.now()}setLipSync(e){this.lipSyncValue=s(e)}calculateFrameParameters(e=Date.now()){this.lastUpdateTime,this.lastUpdateTime=e;let t=this.reducedMotion?.2:(Math.sin(e/1800)+1)*.5,a=this.reducedMotion?0:2.5*Math.sin(e/2400),r=this.reducedMotion?0:1.8*Math.cos(e/3200),i=this.reducedMotion?0:1.2*Math.sin(e/4e3),n=function(e){if(!e)return{angleX:0,angleY:0,angleZ:0,bodyAngleX:0,eyeBallX:0,eyeBallY:0,speed:1};switch(e.toLowerCase().trim()){case"nod":return{angleX:0,angleY:-12,angleZ:2,bodyAngleX:0,eyeBallX:0,eyeBallY:-.2,speed:2.5};case"wave":return{angleX:8,angleY:4,angleZ:-5,bodyAngleX:5,eyeBallX:.2,eyeBallY:.1,speed:1.8};case"listen":return{angleX:-5,angleY:2,angleZ:4,bodyAngleX:-2,eyeBallX:.1,eyeBallY:.1,speed:1};case"talk":return{angleX:2,angleY:-2,angleZ:0,bodyAngleX:0,eyeBallX:0,eyeBallY:0,speed:1.5};default:return{angleX:0,angleY:0,angleZ:0,bodyAngleX:0,eyeBallX:0,eyeBallY:0,speed:1}}}(this.action),o=(e-this.actionStartTime)/1e3,l=0,c=0,d=0,u=0;this.reducedMotion?"nod"===this.action?c=.5*n.angleY:"wave"===this.action?(l=.5*n.angleX,u=.5*n.bodyAngleX):"listen"===this.action&&(d=.5*n.angleZ,l=.5*n.angleX):"nod"===this.action?c=Math.sin(o*Math.PI*3)*n.angleY:"wave"===this.action?(d=Math.sin(o*Math.PI*2.4)*n.angleZ,l=n.angleX,u=n.bodyAngleX):"listen"===this.action?(d=n.angleZ,l=n.angleX):"talk"===this.action&&(c=2*Math.sin(4*o));let m=0;if("speaking"===this.state){let t=function(e,t){if("number"==typeof t&&!isNaN(t)&&t>0)return s(t);let a=e/1e3;return s(Math.max(0,.45*Math.sin(14*a)+.25*Math.sin(22*a)+.2*Math.sin(8*a)+.1))}(e,this.lipSyncValue);m=this.reducedMotion?.6*t:t}let h=e%4e3/4e3,p=1;return h>.95&&(p=Math.abs(Math.sin((h-.95)/.05*Math.PI-Math.PI/2))),{mouthOpenY:m,angleX:a+l,angleY:r+c,angleZ:i+d,bodyAngleX:u,breath:t,eyeOpenL:p,eyeOpenR:p}}reset(){this.expression="neutral",this.action="idle",this.state="idle",this.lipSyncValue=0,this.speechId=void 0}}async function o(e="/live2d/live2dcubismcore.min.js"){return window.Live2DCubismCore?window.Live2DCubismCore:new Promise((t,a)=>{let r=document.querySelector(`script[src="${e}"]`);if(r)return window.Live2DCubismCore?t(window.Live2DCubismCore):(r.addEventListener("load",()=>t(window.Live2DCubismCore)),void r.addEventListener("error",t=>a(Error(`Failed to load Cubism Core from ${e}: ${t}`))));let i=document.createElement("script");i.src=e,i.async=!0,i.onload=()=>{window.Live2DCubismCore?t(window.Live2DCubismCore):a(Error("Live2DCubismCore global not found after script load"))},i.onerror=()=>{let e="https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js";console.warn(`[Live2D] Failed to load local Cubism Core, attempting fallback: ${e}`);let r=document.createElement("script");r.src=e,r.async=!0,r.onload=()=>{window.Live2DCubismCore?t(window.Live2DCubismCore):a(Error("Live2DCubismCore global not found after fallback load"))},r.onerror=e=>a(Error(`Failed to load Cubism Core from both local and remote sources: ${e}`)),document.head.appendChild(r)},document.head.appendChild(i)})}async function l(e){let t=e.lastIndexOf("/"),a=-1!==t?e.slice(0,t+1):"",r=await fetch(e);if(!r.ok)throw Error(`Failed to fetch model manifest from ${e} (${r.status})`);let i=await r.json();if(!i.FileReferences||!i.FileReferences.Moc)throw Error(`Invalid model3.json: missing Moc file reference in ${e}`);let s=a+i.FileReferences.Moc,n=await fetch(s);if(!n.ok)throw Error(`Failed to fetch .moc3 file from ${s} (${n.status})`);let o=await n.arrayBuffer(),l=(i.FileReferences.Textures||[]).map(e=>a+e),c=await Promise.all(l.map(e=>new Promise((t,a)=>{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>t(r),r.onerror=t=>a(Error(`Failed to load texture from ${e}`)),r.src=e}))),d=new Map;return i.FileReferences.Expressions&&i.FileReferences.Expressions.length>0&&await Promise.all(i.FileReferences.Expressions.map(async e=>{try{let t=a+e.File,r=await fetch(t);if(r.ok){let t=await r.json();d.set(e.File,t),e.Name&&d.set(e.Name,t)}}catch{}})),{model3:i,mocBuffer:o,textures:c,expressions:d,basePath:a}}let c=`
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12650,e=>{"use strict";var t=e.i(30696),a=e.i(64249),r=e.i(51523);function i({onSelectPrompt:e,className:a=""}){return(0,t.jsxs)("div",{className:`chat-empty-state ${a}`,"data-testid":"preferences-starter",children:[(0,t.jsx)("div",{className:"siduri-orb",children:"✦"}),(0,t.jsx)("h2",{children:"Teach Siduri your preferences."}),(0,t.jsx)("p",{children:"Choose a starting point, replace the blanks, and send it. Nothing becomes memory until you approve the receipt."}),(0,t.jsxs)("div",{className:"starter-prompts onboarding-prompts",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>e("Call me [preferred name]."),children:[(0,t.jsx)("span",{children:"Identity"}),"Preferred name or title"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>e("My timezone is [timezone] and my preferred language is [language]."),children:[(0,t.jsx)("span",{children:"Localization"}),"Timezone and language"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>e("My preferred response style is [concise / detailed / technical]."),children:[(0,t.jsx)("span",{children:"Response style"}),"Tone and verbosity"]}),(0,t.jsxs)("button",{type:"button",onClick:()=>e("I am interested in [topics or domains of interest]."),children:[(0,t.jsx)("span",{children:"Knowledge"}),"Topics of interest"]})]}),(0,t.jsx)("p",{className:"onboarding-privacy",children:"Teach Siduri preferences explicitly. Information is stored in private memory only after you approve the receipt."})]})}function s(e){return"number"!=typeof e||isNaN(e)||e<0?0:e>1?1:e}class n{expression="neutral";action="idle";state="idle";speechId;lipSyncValue=0;reducedMotion=!1;actionStartTime=0;stateStartTime=0;lastUpdateTime=Date.now();constructor(e){e&&this.updateConfig(e)}updateConfig(e){e.expression&&e.expression!==this.expression&&(this.expression=e.expression),e.action&&e.action!==this.action&&(this.action=e.action,this.actionStartTime=Date.now()),e.state&&e.state!==this.state&&(this.state=e.state,this.stateStartTime=Date.now()),void 0!==e.speechId&&(this.speechId=e.speechId),void 0!==e.lipSyncValue&&(this.lipSyncValue=s(e.lipSyncValue)),void 0!==e.reducedMotion&&(this.reducedMotion=e.reducedMotion)}setReducedMotion(e){this.reducedMotion=e}setExpression(e){this.expression=e}setAction(e){this.action=e,this.actionStartTime=Date.now()}setState(e){this.state=e,this.stateStartTime=Date.now()}setLipSync(e){this.lipSyncValue=s(e)}calculateFrameParameters(e=Date.now()){this.lastUpdateTime,this.lastUpdateTime=e;let t=this.reducedMotion?.2:(Math.sin(e/1800)+1)*.5,a=this.reducedMotion?0:2.5*Math.sin(e/2400),r=this.reducedMotion?0:1.8*Math.cos(e/3200),i=this.reducedMotion?0:1.2*Math.sin(e/4e3),n=function(e){if(!e)return{angleX:0,angleY:0,angleZ:0,bodyAngleX:0,eyeBallX:0,eyeBallY:0,speed:1};switch(e.toLowerCase().trim()){case"nod":return{angleX:0,angleY:-12,angleZ:2,bodyAngleX:0,eyeBallX:0,eyeBallY:-.2,speed:2.5};case"wave":return{angleX:8,angleY:4,angleZ:-5,bodyAngleX:5,eyeBallX:.2,eyeBallY:.1,speed:1.8};case"listen":return{angleX:-5,angleY:2,angleZ:4,bodyAngleX:-2,eyeBallX:.1,eyeBallY:.1,speed:1};case"talk":return{angleX:2,angleY:-2,angleZ:0,bodyAngleX:0,eyeBallX:0,eyeBallY:0,speed:1.5};default:return{angleX:0,angleY:0,angleZ:0,bodyAngleX:0,eyeBallX:0,eyeBallY:0,speed:1}}}(this.action),o=(e-this.actionStartTime)/1e3,l=0,c=0,d=0,m=0;this.reducedMotion?"nod"===this.action?c=.5*n.angleY:"wave"===this.action?(l=.5*n.angleX,m=.5*n.bodyAngleX):"listen"===this.action&&(d=.5*n.angleZ,l=.5*n.angleX):"nod"===this.action?c=Math.sin(o*Math.PI*3)*n.angleY:"wave"===this.action?(d=Math.sin(o*Math.PI*2.4)*n.angleZ,l=n.angleX,m=n.bodyAngleX):"listen"===this.action?(d=n.angleZ,l=n.angleX):"talk"===this.action&&(c=2*Math.sin(4*o));let u=0;if("speaking"===this.state){let t=function(e,t){if("number"==typeof t&&!isNaN(t)&&t>0)return s(t);let a=e/1e3;return s(Math.max(0,.45*Math.sin(14*a)+.25*Math.sin(22*a)+.2*Math.sin(8*a)+.1))}(e,this.lipSyncValue);u=this.reducedMotion?.6*t:t}let h=e%4e3/4e3,p=1;return h>.95&&(p=Math.abs(Math.sin((h-.95)/.05*Math.PI-Math.PI/2))),{mouthOpenY:u,angleX:a+l,angleY:r+c,angleZ:i+d,bodyAngleX:m,breath:t,eyeOpenL:p,eyeOpenR:p}}reset(){this.expression="neutral",this.action="idle",this.state="idle",this.lipSyncValue=0,this.speechId=void 0}}async function o(e="/live2d/live2dcubismcore.min.js"){return window.Live2DCubismCore?window.Live2DCubismCore:new Promise((t,a)=>{let r=document.querySelector(`script[src="${e}"]`);if(r)return window.Live2DCubismCore?t(window.Live2DCubismCore):(r.addEventListener("load",()=>t(window.Live2DCubismCore)),void r.addEventListener("error",t=>a(Error(`Failed to load Cubism Core from ${e}: ${t}`))));let i=document.createElement("script");i.src=e,i.async=!0,i.onload=()=>{window.Live2DCubismCore?t(window.Live2DCubismCore):a(Error("Live2DCubismCore global not found after script load"))},i.onerror=()=>{let e="https://cubism.live2d.com/sdk-web/cubismcore/live2dcubismcore.min.js";console.warn(`[Live2D] Failed to load local Cubism Core, attempting fallback: ${e}`);let r=document.createElement("script");r.src=e,r.async=!0,r.onload=()=>{window.Live2DCubismCore?t(window.Live2DCubismCore):a(Error("Live2DCubismCore global not found after fallback load"))},r.onerror=e=>a(Error(`Failed to load Cubism Core from both local and remote sources: ${e}`)),document.head.appendChild(r)},document.head.appendChild(i)})}async function l(e){let t=e.lastIndexOf("/"),a=-1!==t?e.slice(0,t+1):"",r=await fetch(e);if(!r.ok)throw Error(`Failed to fetch model manifest from ${e} (${r.status})`);let i=await r.json();if(!i.FileReferences||!i.FileReferences.Moc)throw Error(`Invalid model3.json: missing Moc file reference in ${e}`);let s=a+i.FileReferences.Moc,n=await fetch(s);if(!n.ok)throw Error(`Failed to fetch .moc3 file from ${s} (${n.status})`);let o=await n.arrayBuffer(),l=(i.FileReferences.Textures||[]).map(e=>a+e),c=await Promise.all(l.map(e=>new Promise((t,a)=>{let r=new Image;r.crossOrigin="anonymous",r.onload=()=>t(r),r.onerror=t=>a(Error(`Failed to load texture from ${e}`)),r.src=e}))),d=new Map;return i.FileReferences.Expressions&&i.FileReferences.Expressions.length>0&&await Promise.all(i.FileReferences.Expressions.map(async e=>{try{let t=a+e.File,r=await fetch(t);if(r.ok){let t=await r.json();d.set(e.File,t),e.Name&&d.set(e.Name,t)}}catch{}})),{model3:i,mocBuffer:o,textures:c,expressions:d,basePath:a}}let c=`
2
2
  attribute vec2 a_position;
3
3
  attribute vec2 a_texCoord;
4
4
  uniform mat4 u_matrix;
@@ -16,7 +16,7 @@ void main() {
16
16
  vec4 color = texture2D(u_texture, v_texCoord);
17
17
  gl_FragColor = color * u_opacity;
18
18
  }
19
- `,u=`
19
+ `,m=`
20
20
  precision mediump float;
21
21
  uniform sampler2D u_texture;
22
22
  varying vec2 v_texCoord;
@@ -27,4 +27,4 @@ void main() {
27
27
  }
28
28
  gl_FragColor = vec4(1.0);
29
29
  }
30
- `;function m(e,t,a){let r=e.createShader(t);if(!r)throw Error("Failed to create shader");if(e.shaderSource(r,a),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){let t=e.getShaderInfoLog(r);throw e.deleteShader(r),Error(`Shader compilation error: ${t}`)}return r}class h{canvas;gl=null;program=null;maskProgram=null;vertexBuffer=null;uvBuffer=null;indexBuffer=null;aPositionLocation=-1;aTexCoordLocation=-1;uMatrixLocation=null;uTextureLocation=null;uOpacityLocation=null;maskAPositionLocation=-1;maskATexCoordLocation=-1;maskUMatrixLocation=null;maskUTextureLocation=null;textures=[];moc=null;model=null;core=null;paramIndices=new Map;isDisposed=!1;constructor(e){this.canvas=e}modelBounds={minX:-.39,maxX:.4,minY:-.98,maxY:.18,width:.79,height:1.16,centerX:.006,centerY:-.4};initialize(e,t){this.core=e;let a={alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,antialias:!0,stencil:!0},r=this.canvas.getContext("webgl",a)||this.canvas.getContext("experimental-webgl",a)||this.canvas.getContext("webgl2",a);if(!r)throw Error("WebGL is not supported in this browser environment");this.gl=r;let i=m(r,r.VERTEX_SHADER,c),s=m(r,r.FRAGMENT_SHADER,d),n=r.createProgram();if(!n)throw Error("Failed to create WebGL program");if(r.attachShader(n,i),r.attachShader(n,s),r.linkProgram(n),!r.getProgramParameter(n,r.LINK_STATUS))throw Error(`Program link error: ${r.getProgramInfoLog(n)}`);this.program=n,this.aPositionLocation=r.getAttribLocation(n,"a_position"),this.aTexCoordLocation=r.getAttribLocation(n,"a_texCoord"),this.uMatrixLocation=r.getUniformLocation(n,"u_matrix"),this.uTextureLocation=r.getUniformLocation(n,"u_texture"),this.uOpacityLocation=r.getUniformLocation(n,"u_opacity");let o=m(r,r.FRAGMENT_SHADER,u),l=r.createProgram();if(!l)throw Error("Failed to create Mask WebGL program");if(r.attachShader(l,i),r.attachShader(l,o),r.linkProgram(l),!r.getProgramParameter(l,r.LINK_STATUS))throw Error(`Mask Program link error: ${r.getProgramInfoLog(l)}`);if(this.maskProgram=l,this.maskAPositionLocation=r.getAttribLocation(l,"a_position"),this.maskATexCoordLocation=r.getAttribLocation(l,"a_texCoord"),this.maskUMatrixLocation=r.getUniformLocation(l,"u_matrix"),this.maskUTextureLocation=r.getUniformLocation(l,"u_texture"),this.vertexBuffer=r.createBuffer(),this.uvBuffer=r.createBuffer(),this.indexBuffer=r.createBuffer(),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),this.textures=t.textures.map(e=>{let t=r.createTexture();if(!t)throw Error("Failed to create WebGL texture");return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),r.generateMipmap(r.TEXTURE_2D),t}),this.moc=e.Moc.fromArrayBuffer(t.mocBuffer),!this.moc)throw Error("Failed to create Live2D Moc from ArrayBuffer");if(this.model=e.Model.fromMoc(this.moc),!this.model)throw Error("Failed to create Live2D Model from Moc");let h=this.model.parameters.ids;for(let e=0;e<h.length;e++)this.paramIndices.set(h[e],e);this.initializeNeutralMouth(),this.model.update(),this.calculateModelBounds()}initializeNeutralMouth(){this.model&&(this.setParamDirect("ParamMouthOpenY",0),this.setParamDirect("ParamMouthForm",0))}setParamDirect(e,t){let a=this.paramIndices.get(e);if(void 0!==a&&this.model){let e=this.model.parameters.minimumValues[a],r=this.model.parameters.maximumValues[a];this.model.parameters.values[a]=Math.max(e,Math.min(r,t))}}calculateModelBounds(){if(!this.model)return;let e=this.model.drawables,t=e.count,a=1/0,r=-1/0,i=1/0,s=-1/0;for(let n=0;n<t;n++){let t=e.vertexPositions[n];if(t&&0!==t.length)for(let e=0;e<t.length;e+=2){let n=t[e],o=t[e+1];n<a&&(a=n),n>r&&(r=n),o<i&&(i=o),o>s&&(s=o)}}a!==1/0&&r!==-1/0&&i!==1/0&&s!==-1/0&&(this.modelBounds={minX:a,maxX:r,minY:i,maxY:s,width:r-a,height:s-i,centerX:(a+r)/2,centerY:(i+s)/2})}getModelBounds(){return{...this.modelBounds}}setParam(e,t,a=1){let r=this.paramIndices.get(e);if(void 0!==r&&this.model){let e=this.model.parameters.values[r],i=Math.max(this.model.parameters.minimumValues[r],Math.min(this.model.parameters.maximumValues[r],t));this.model.parameters.values[r]=e+(i-e)*a}}render(e,t=Date.now()){let a;if(this.isDisposed||!this.gl||!this.model||!this.program)return;let r=this.gl,i=this.canvas.width,s=this.canvas.height;if(0===i||0===s)return;let n=e.calculateFrameParameters(t);this.setParam("ParamAngleX",n.angleX,.2),this.setParam("ParamAngleY",n.angleY,.2),this.setParam("ParamAngleZ",n.angleZ,.2),this.setParam("ParamBodyAngleX",n.bodyAngleX,.15),this.setParam("ParamBreath",n.breath,.3),this.setParam("ParamEyeLOpen",n.eyeOpenL,.4),this.setParam("ParamEyeROpen",n.eyeOpenR,.4),this.setParam("ParamMouthOpenY",n.mouthOpenY,.35);let o=function(e){if(!e)return"neutral";switch(e.toLowerCase().trim()){case"surprised":return"face_aozame.exp3.json";case"concerned":case"thinking":return"eyes_zetubou.exp3.json";case"happy":return"hair_open.exp3.json";default:return"neutral"}}(e.expression);"face_aozame.exp3.json"===o?(this.setParam("Param10",1,.2),this.setParam("Param9",0,.15),this.setParam("Param11",0,.15),this.setParam("Param12",0,.15)):"eyes_zetubou.exp3.json"===o?(this.setParam("Param9",1,.2),this.setParam("Param10",0,.15),this.setParam("Param11",0,.15),this.setParam("Param12",0,.15)):"hair_open.exp3.json"===o?(this.setParam("Param11",1,.2),this.setParam("Param10",0,.15),this.setParam("Param9",0,.15),this.setParam("Param12",0,.15)):"eye_color.exp3.json"===o?(this.setParam("Param12",1,.2),this.setParam("Param10",0,.15),this.setParam("Param9",0,.15),this.setParam("Param11",0,.15)):(this.setParam("Param10",0,.15),this.setParam("Param9",0,.15),this.setParam("Param11",0,.15),this.setParam("Param12",0,.15)),this.model.update(),r.viewport(0,0,i,s),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.useProgram(this.program);let l=i/s,c=this.modelBounds.width,d=this.modelBounds.height,u=this.modelBounds.centerX,m=this.modelBounds.centerY,h=(a=l>=c/d?1.84/d:1.84/c*l)/l,p=new Float32Array([h,0,0,0,0,a,0,0,0,0,1,0,-u*h,-m*a,0,1]);r.uniformMatrix4fv(this.uMatrixLocation,!1,p),r.uniform1i(this.uTextureLocation,0);let f=this.model.drawables,x=f.count,g=f.renderOrders,v=[];for(let e=0;e<x;e++)v.push(e);v.sort((e,t)=>g[e]-g[t]),r.enableVertexAttribArray(this.aPositionLocation),r.enableVertexAttribArray(this.aTexCoordLocation);let b=(e,t)=>{let a=void 0!==t?t:f.opacities[e];if(a<=.001)return;let i=f.textureIndices[e],s=this.textures[i];if(!s)return;r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s),r.uniform1f(this.uOpacityLocation,a);let n=f.vertexPositions[e];r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bufferData(r.ARRAY_BUFFER,n,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.aPositionLocation,2,r.FLOAT,!1,0,0);let o=f.vertexUvs[e];r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.bufferData(r.ARRAY_BUFFER,o,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.aTexCoordLocation,2,r.FLOAT,!1,0,0);let l=f.indices[e];r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.DYNAMIC_DRAW),r.drawElements(r.TRIANGLES,l.length,r.UNSIGNED_SHORT,0)},y=e=>{if(!this.maskProgram)return;r.useProgram(this.maskProgram),r.uniformMatrix4fv(this.maskUMatrixLocation,!1,p),r.uniform1i(this.maskUTextureLocation,0),r.enableVertexAttribArray(this.maskAPositionLocation),r.enableVertexAttribArray(this.maskATexCoordLocation);let t=f.textureIndices[e],a=this.textures[t];if(!a)return;r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,a);let i=f.vertexPositions[e];r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bufferData(r.ARRAY_BUFFER,i,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.maskAPositionLocation,2,r.FLOAT,!1,0,0);let s=f.vertexUvs[e];r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.bufferData(r.ARRAY_BUFFER,s,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.maskATexCoordLocation,2,r.FLOAT,!1,0,0);let n=f.indices[e];r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,n,r.DYNAMIC_DRAW),r.drawElements(r.TRIANGLES,n.length,r.UNSIGNED_SHORT,0),r.useProgram(this.program),r.enableVertexAttribArray(this.aPositionLocation),r.enableVertexAttribArray(this.aTexCoordLocation)},P=-1;for(let e of v)if(!(f.opacities[e]<=.001))if(f.maskCounts[e]>0){let t=f.masks[e][0];t!==P&&(P=t,r.enable(r.STENCIL_TEST),r.stencilMask(255),r.clear(r.STENCIL_BUFFER_BIT),r.stencilFunc(r.ALWAYS,1,255),r.stencilOp(r.KEEP,r.KEEP,r.REPLACE),r.colorMask(!1,!1,!1,!1),y(t),r.colorMask(!0,!0,!0,!0)),r.stencilFunc(r.EQUAL,1,255),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),b(e)}else -1!==P&&(r.disable(r.STENCIL_TEST),P=-1),b(e);-1!==P&&r.disable(r.STENCIL_TEST)}dispose(){if(this.isDisposed=!0,this.gl){for(let e of this.textures)this.gl.deleteTexture(e);this.textures=[],this.vertexBuffer&&this.gl.deleteBuffer(this.vertexBuffer),this.uvBuffer&&this.gl.deleteBuffer(this.uvBuffer),this.indexBuffer&&this.gl.deleteBuffer(this.indexBuffer),this.program&&this.gl.deleteProgram(this.program)}this.model&&"function"==typeof this.model.release&&this.model.release(),this.moc&&"function"==typeof this.moc.release&&this.moc.release(),this.model=null,this.moc=null,this.gl=null}}function p({modelUrl:e,expression:r="neutral",action:i="idle",state:s="idle",speechId:c,lipSyncValue:d,durationMs:u,className:m="",onStatusChange:f}){let x=(0,a.useRef)(null),g=(0,a.useRef)(null),v=(0,a.useRef)(new n({expression:r,action:i,state:s,speechId:c,lipSyncValue:d,durationMs:u})),b=(0,a.useRef)(null),y=(0,a.useRef)(null),[P,E]=(0,a.useState)("loading"),[A,w]=(0,a.useState)(null),[j,_]=(0,a.useState)(0);return(0,a.useEffect)(()=>{if(!window.matchMedia)return;let e=window.matchMedia("(prefers-reduced-motion: reduce)"),t=()=>{v.current.setReducedMotion(e.matches)};return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,a.useEffect)(()=>{v.current.updateConfig({expression:r,action:i,state:s,speechId:c,lipSyncValue:d,durationMs:u})},[r,i,s,c,d,u]),(0,a.useEffect)(()=>{let t=!1,a=null;async function r(){if(g.current&&x.current){if(!e){E("error"),w("No Live2D model configured. Place model in assets/body/<name>/"),f?.("error","No Live2D model URL specified");return}E("loading"),f?.("loading"),w(null);try{let r=await o();if(t)return;let i=await l(e);if(t)return;let s=g.current;if(!s)return;let n=new h(s);n.initialize(r,i),b.current=n;let c=()=>{if(!x.current||!g.current)return;let e=x.current.getBoundingClientRect();if(e.width<=0||e.height<=0)return;let t=Math.min(window.devicePixelRatio||1,2),a=Math.max(1,Math.floor(e.width*t)),r=Math.max(1,Math.floor(e.height*t));(g.current.width!==a||g.current.height!==r)&&(g.current.width=a,g.current.height=r)};c(),(a=new ResizeObserver(c)).observe(x.current);let d=()=>{t||(b.current&&b.current.render(v.current,performance.now()),y.current=requestAnimationFrame(d))};y.current=requestAnimationFrame(d),E("ready"),f?.("ready")}catch(a){if(t)return;let e=a?.message||"Failed to initialize Live2D avatar";console.warn("[AvatarCanvas] Initialization error:",a),E("error"),w("Avatar model unavailable or failed to load."),f?.("error",e)}}}r();let i=g.current,s=e=>{e.preventDefault(),console.warn("[AvatarCanvas] WebGL context lost"),y.current&&cancelAnimationFrame(y.current),E("error"),w("WebGL context lost.")},n=()=>{console.log("[AvatarCanvas] WebGL context restored, re-initializing..."),r()};return i&&(i.addEventListener("webglcontextlost",s,!1),i.addEventListener("webglcontextrestored",n,!1)),()=>{t=!0,y.current&&(cancelAnimationFrame(y.current),y.current=null),a&&a.disconnect(),i&&(i.removeEventListener("webglcontextlost",s),i.removeEventListener("webglcontextrestored",n)),b.current&&(b.current.dispose(),b.current=null)}},[e,j,f]),(0,t.jsxs)("div",{ref:x,"data-testid":"avatar-canvas-container",className:`relative w-full h-full min-h-0 flex items-center justify-center overflow-hidden bg-transparent ${m}`,"aria-label":"Live2D Companion Presence",children:[(0,t.jsx)("canvas",{ref:g,role:"img","data-testid":"avatar-webgl-canvas","aria-label":"Live2D companion presence",style:{width:"100%",height:"100%",display:"block"},className:`absolute inset-0 w-full h-full block transition-opacity duration-500 ${"ready"===P?"opacity-100":"opacity-0"}`}),"loading"===P&&(0,t.jsxs)("div",{role:"status","aria-live":"polite",className:"absolute inset-0 flex flex-col items-center justify-center gap-3 bg-[#0b0b0e]/90 text-[var(--siduri-text-muted)]",children:[(0,t.jsx)("div",{className:"siduri-glyph w-10 h-10 text-base animate-pulse motion-reduce:animate-none",children:"✦"}),(0,t.jsx)("span",{className:"text-[11px] font-mono tracking-widest uppercase text-[var(--siduri-ember-light)]",children:"Initializing Presence..."})]}),"error"===P&&(0,t.jsxs)("div",{role:"alert","aria-live":"polite",className:"absolute inset-0 flex flex-col items-center justify-center p-6 text-center bg-[#0b0b0e]/95 text-[var(--siduri-text-muted)]",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full border border-[var(--siduri-border-subtle)] grid place-items-center text-xs text-[var(--siduri-text-dim)] mb-2 font-mono",children:"!"}),(0,t.jsx)("p",{className:"text-xs font-sans text-[var(--siduri-text-secondary)] mb-1",children:A||"Avatar unavailable in this browser."}),(0,t.jsx)("span",{className:"text-[10px] font-mono text-[var(--siduri-text-dim)] mb-3",children:"Conversational text mode remains active"}),(0,t.jsx)("button",{type:"button",onClick:()=>_(e=>e+1),className:"px-3 py-1 text-[11px] font-mono tracking-wider uppercase rounded border border-[var(--siduri-border-subtle)] hover:border-[var(--siduri-border-ember)] text-[var(--siduri-text-secondary)] hover:text-[var(--siduri-text-primary)] transition-colors focus-visible:ring-1 focus-visible:ring-[var(--siduri-border-ember)] outline-none","aria-label":"Retry avatar initialization",children:"Retry"})]})]})}var f=e.i(94108);let x="siduri.chat.conversations.v1";function g(){return"u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random()}`}function v(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e)}e.s(["default",0,function(){let[e,s]=(0,a.useState)([]),[n,o]=(0,a.useState)(null),[l,c]=(0,a.useState)(""),[d,u]=(0,a.useState)("connecting"),[m,h]=(0,a.useState)(!1),[b,y]=(0,a.useState)(!1),[P,E]=(0,a.useState)(!1),[A,w]=(0,a.useState)(!1),[j,_]=(0,a.useState)(null),[T,L]=(0,a.useState)(void 0),[N,R]=(0,a.useState)("auto"),[C,M]=(0,a.useState)("hybrid"),S=(0,a.useRef)(null),D=(0,a.useRef)(null),B=(0,a.useRef)(null),k=(0,a.useMemo)(()=>e.find(e=>e.id===n)??null,[n,e]);function I(){return{id:g(),title:"New conversation",messages:[],updatedAt:Date.now()}}function F(e,t){s(a=>a.map(a=>a.id===e?t(a):a))}async function U(e){e.preventDefault();let t=l.trim();if(!t)return;if(/\[[^\]]+\]/.test(t))return void u("replace the blanks first");m&&B.current&&(B.current.abort("user_barge_in"),B.current=null,(0,f.interruptChat)("default","user_barge_in"));let a=k;a||(a=I(),s(e=>[a,...e]),o(a.id));let r={id:g(),role:"user",content:t,createdAt:Date.now()},i=g(),n={id:i,role:"assistant",content:"",createdAt:Date.now()},d=[...a.messages,r,n],p=0===a.messages.length?t.slice(0,42):a.title;F(a.id,e=>({...e,title:p,messages:d,updatedAt:Date.now()})),c(""),h(!0),u("streaming");let x=new AbortController;B.current=x;try{await (0,f.postStream)("/chat/stream",{id:"default",message:t,medium:"web",mode:"auto"!==N?N:void 0,history:a.messages.slice(-20).map(e=>({role:e.role,content:e.content}))},{onStaged:e=>{e?.mode&&("casual"===e.mode||"teach"===e.mode||"hybrid"===e.mode)&&M(e.mode)},onAvatar:e=>{let t=e.speech_id;D.current&&clearTimeout(D.current),_({eventId:e.event_id,expression:e.expression||"neutral",action:e.action||"talk",state:"speaking",speechId:t,durationMs:e.durationMs});let a=e.durationMs||4500;D.current=setTimeout(()=>{_(e=>e?{...e,state:"idle",action:"idle"}:null)},a)},onChunk:e=>{e.deltaText&&F(a.id,t=>({...t,messages:t.messages.map(t=>t.id===i?{...t,content:t.content+e.deltaText}:t)})),(e.expression||e.action)&&_(t=>t?{...t,expression:e.expression||t.expression,action:e.action||t.action}:null)},onDone:e=>{e?.metadata?.mode&&("casual"===e.metadata.mode||"teach"===e.metadata.mode||"hybrid"===e.metadata.mode)&&M(e.metadata.mode);let t=e.response||{},r=e.metadata?.memory_proposals,s=e.metadata?.behavioral_proposals;F(a.id,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:e.content||t.subtitle_en||"",spokenJa:t.spoken_ja,evidenceIds:t.evidence_ids,memoryProposals:r,behavioralProposals:s}:e),updatedAt:Date.now()})),u("online")},onInterrupted:()=>{F(a.id,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:e.content?`${e.content} [interrupted]`:"[interrupted]"}:e),updatedAt:Date.now()})),u("online")},onError:e=>{F(a.id,t=>({...t,messages:t.messages.map(t=>t.id===i?{...t,content:`I couldn’t reach the orchestrator. ${String(e)}`}:t),updatedAt:Date.now()})),u("offline")}},x.signal)}catch(e){x.signal.aborted||(F(a.id,t=>({...t,messages:t.messages.map(t=>t.id===i?{...t,content:`I couldn’t reach the orchestrator. ${String(e)}`}:t),updatedAt:Date.now()})),u("offline"))}finally{B.current=null,h(!1)}}(0,a.useEffect)(()=>()=>{D.current&&clearTimeout(D.current),B.current&&B.current.abort("unmounted")},[]),(0,a.useEffect)(()=>{let e=function(){try{let e=JSON.parse(window.localStorage.getItem(x)??"[]");return Array.isArray(e)?e:[]}catch{return[]}}();s(e),o(e[0]?.id??null),y(!0),(0,f.fetchApi)("/health").then(async e=>{if(e.ok){let t=await e.json().catch(()=>({}));u("online"),t.organs?.body?.modelUrl?L(t.organs.body.modelUrl):(0,f.fetchApi)("/api/models/body").then(async e=>{if(e.ok){let t=(await e.json().catch(()=>({}))).models||[],a=t.find(e=>"default"!==e);a?L(`/assets/body/${a}/model.model3.json`):t.length>0&&"default"!==t[0]&&L(`/assets/body/${t[0]}/model.model3.json`)}}).catch(()=>{})}else u("online")}).catch(()=>u("offline"))},[]),(0,a.useEffect)(()=>{b&&window.localStorage.setItem(x,JSON.stringify(e))},[e,b]),(0,a.useEffect)(()=>{S.current?.scrollTo({top:S.current.scrollHeight,behavior:"smooth"})},[n,k?.messages.length,m]);let X=k?.messages??[],Y=X.at(-1)?.evidenceIds?.length??0;async function $(e,t,a){if(k)try{await (0,f.postJson)(`/memory/proposals/${a}`,{id:t,companionId:"default"});let r="approve"===a?"approved":"rejected";F(k.id,a=>({...a,messages:a.messages.map(a=>a.id===e&&a.memoryProposals?{...a,memoryProposals:a.memoryProposals.map(e=>e.proposal_id===t?{...e,status:r}:e)}:a)}))}catch(e){console.error(e)}}async function O(e,t,a){if(k)try{await (0,f.postJson)(`/memory/behavioral/${a}`,{id:t,companionId:"default"});let r="approve"===a?"confirmed":"rejected";F(k.id,a=>({...a,messages:a.messages.map(a=>a.id===e&&a.behavioralProposals?{...a,behavioralProposals:a.behavioralProposals.map(e=>e.directive_id===t?{...e,status:r}:e)}:a)}))}catch(e){console.error(e)}}return(0,t.jsxs)("div",{className:`chat-app ${P?"sidebar-collapsed":""}`,children:[(0,t.jsxs)("aside",{className:"chat-sidebar","aria-label":"Conversation history",children:[(0,t.jsxs)("div",{className:"chat-sidebar-top",children:[(0,t.jsxs)("a",{className:"chat-brand",href:"/chat",children:[(0,t.jsx)("span",{className:"chat-brand-mark",children:"S"}),(0,t.jsx)("span",{children:"SIDURI"})]}),(0,t.jsx)("button",{className:"sidebar-collapse",type:"button",onClick:()=>E(e=>!e),"aria-label":P?"Expand sidebar":"Collapse sidebar",children:P?"→":"←"})]}),(0,t.jsxs)("button",{className:"new-chat-button",type:"button",onClick:function(){let e=I();s(t=>[e,...t]),o(e.id),c(""),u("online")},children:[(0,t.jsx)("span",{children:"+"})," New conversation"]}),(0,t.jsxs)("div",{className:"history-heading",children:[(0,t.jsx)("span",{children:"Recent conversations"}),(0,t.jsx)("span",{children:e.length})]}),(0,t.jsx)("div",{className:"conversation-list",children:b?0===e.length?(0,t.jsx)("p",{className:"history-empty",children:"Your private conversations will appear here."}):e.slice().sort((e,t)=>t.updatedAt-e.updatedAt).map(a=>(0,t.jsxs)("div",{className:`conversation-row ${a.id===n?"selected":""}`,children:[(0,t.jsxs)("button",{type:"button",className:"conversation-select",onClick:()=>o(a.id),children:[(0,t.jsx)("span",{className:"conversation-title",children:a.title}),(0,t.jsx)("span",{className:"conversation-date",children:v(a.updatedAt)})]}),(0,t.jsx)("button",{type:"button",className:"conversation-delete",onClick:()=>(function(t){if(s(e=>e.filter(e=>e.id!==t)),n===t){let a=e.find(e=>e.id!==t);o(a?.id??null)}})(a.id),"aria-label":`Delete ${a.title}`,children:"×"})]},a.id)):(0,t.jsx)("p",{className:"history-empty",children:"Loading history…"})}),(0,t.jsx)("div",{className:"sidebar-footer",children:(0,t.jsxs)("a",{className:"sidebar-console",href:"/operator",children:[(0,t.jsx)("span",{children:"⌘"}),(0,t.jsx)("span",{children:"Operator console"}),(0,t.jsx)("b",{children:"↗"})]})})]}),(0,t.jsxs)("main",{className:"chat-workspace",children:[(0,t.jsxs)("div",{className:"chat-top-status flex items-center gap-2.5",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>w(e=>!e),className:`connection-pill cursor-pointer transition-all focus-visible:ring-1 focus-visible:ring-[var(--siduri-border-ember)] outline-none ${A?"border-[var(--siduri-border-ember)] bg-[var(--siduri-tint-med)] text-[var(--siduri-ember-highlight)]":"hover:border-[var(--siduri-border-ember)] text-[var(--siduri-text-secondary)]"}`,"aria-label":"Toggle avatar presence","aria-expanded":A,title:A?"Disable Avatar Presence":"Enable Avatar Presence",children:[(0,t.jsx)("span",{className:`status-light ${A?"online":""}`}),(0,t.jsx)("span",{children:"Presence"})]}),(0,t.jsxs)("span",{className:"connection-pill",children:[(0,t.jsx)("span",{className:`status-light ${"online"===d?"online":""}`}),d]}),(0,t.jsxs)("div",{className:"connection-pill flex items-center gap-1.5",title:"Operating interaction mode: Auto (inferred), Casual (zero drift), Teach (strict human-in-the-loop), or Hybrid (default)",children:[(0,t.jsx)("span",{className:"text-[10px] uppercase font-mono tracking-wider opacity-60",children:"Mode:"}),(0,t.jsxs)("select",{value:N,onChange:e=>R(e.target.value),className:"bg-transparent text-xs text-[var(--siduri-text-primary)] font-medium outline-none cursor-pointer border-none p-0","aria-label":"Select interaction mode",children:[(0,t.jsxs)("option",{value:"auto",className:"bg-[#121214] text-white",children:["Auto (",C,")"]}),(0,t.jsx)("option",{value:"casual",className:"bg-[#121214] text-white",children:"Casual (Zero Drift)"}),(0,t.jsx)("option",{value:"teach",className:"bg-[#121214] text-white",children:"Teach (Human-in-Loop)"}),(0,t.jsx)("option",{value:"hybrid",className:"bg-[#121214] text-white",children:"Hybrid (Default)"})]})]})]}),(0,t.jsx)("div",{className:"flex flex-col flex-1 min-h-0 w-full overflow-hidden relative",children:(0,t.jsxs)("section",{className:"conversation-surface","aria-label":"Private chat",children:[(0,t.jsxs)("div",{ref:S,className:`conversation-scroll ${A?"presence-active":""}`,"aria-live":"polite",children:[A?(0,t.jsx)("div",{className:"avatar-presence-area","data-testid":"avatar-presence-area",children:(0,t.jsx)(p,{modelUrl:T,expression:j?.expression||"neutral",action:j?.action||"idle",state:j?.state||"idle",speechId:j?.speechId,lipSyncValue:j?.lipSyncValue,durationMs:j?.durationMs,className:"w-full h-full"})}):0===X.length?(0,t.jsx)(i,{onSelectPrompt:e=>c(e)}):X.map(e=>(0,t.jsxs)("article",{className:`platform-message ${e.role}`,children:[(0,t.jsx)("div",{className:"message-avatar",children:"user"===e.role?"U":"S"}),(0,t.jsxs)("div",{className:"message-body",children:[(0,t.jsxs)("div",{className:"message-meta",children:[(0,t.jsx)("span",{children:"user"===e.role?"You":"Siduri"}),(0,t.jsx)("time",{children:v(e.createdAt)})]}),(0,t.jsx)("p",{className:"message-primary",children:"assistant"===e.role?e.spokenJa??e.content:e.content}),"assistant"===e.role&&e.spokenJa&&(0,t.jsx)("p",{className:"message-translation",children:e.content}),e.evidenceIds&&e.evidenceIds.length>0&&(0,t.jsxs)("span",{className:"evidence-chip",children:[e.evidenceIds.length," evidence link",1===e.evidenceIds.length?"":"s"]}),e.memoryProposals&&e.memoryProposals.length>0&&(0,t.jsx)("div",{className:"memory-receipts",children:e.memoryProposals.map(a=>(0,t.jsxs)("div",{className:`memory-receipt status-${a.status}`,children:[(0,t.jsxs)("strong",{children:["Remember",a.claim_type?` (${a.claim_type})`:"",":"]})," ",(0,r.formatClaimReceipt)(a),(0,t.jsx)("div",{className:"receipt-actions",children:"pending"===a.status?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:()=>$(e.id,a.proposal_id,"approve"),children:"Approve"}),(0,t.jsx)("button",{type:"button",onClick:()=>$(e.id,a.proposal_id,"reject"),children:"Reject"})]}):(0,t.jsx)("span",{children:a.status.toUpperCase()})})]},a.proposal_id))}),e.behavioralProposals&&e.behavioralProposals.length>0&&(0,t.jsx)("div",{className:"memory-receipts",children:e.behavioralProposals.map(a=>(0,t.jsxs)("div",{className:`memory-receipt status-${a.status}`,children:[(0,t.jsxs)("strong",{children:["Runtime effect [",a.knowledge_domain??a.domain," ","→ ",a.runtime_effect??a.memory_class,"]:"]})," ",(0,r.formatRuntimeEffect)(a),(0,t.jsx)("div",{className:"receipt-actions",children:"pending"===a.status?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:()=>O(e.id,a.directive_id,"approve"),children:"Approve"}),(0,t.jsx)("button",{type:"button",onClick:()=>O(e.id,a.directive_id,"reject"),children:"Reject"})]}):(0,t.jsx)("span",{children:a.status.toUpperCase()})})]},a.directive_id))})]})]},e.id)),m&&!A&&(0,t.jsxs)("div",{className:"platform-message assistant thinking-message",children:[(0,t.jsx)("div",{className:"message-avatar",children:"S"}),(0,t.jsxs)("div",{className:"message-body",children:[(0,t.jsxs)("div",{className:"message-meta",children:[(0,t.jsx)("span",{children:"Siduri"}),(0,t.jsx)("span",{className:"thinking-label",children:"thinking"})]}),(0,t.jsxs)("div",{className:"thinking-dots",children:[(0,t.jsx)("i",{}),(0,t.jsx)("i",{}),(0,t.jsx)("i",{})]})]})]})]}),(0,t.jsxs)("form",{className:"platform-composer",onSubmit:U,children:[(0,t.jsx)("textarea",{value:l,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:"Message Siduri…",rows:1,maxLength:4e3,"aria-label":"Message Siduri"}),(0,t.jsxs)("div",{className:"composer-bottom",children:[(0,t.jsxs)("span",{children:["Private local session ·"," ",Y?`${Y} evidence link${1===Y?"":"s"}`:"No evidence attached"]}),m&&!l.trim()?(0,t.jsx)("button",{type:"button",onClick:function(){B.current&&(B.current.abort("user_stop"),B.current=null),(0,f.interruptChat)("default","user_stop"),h(!1),u("online")},"aria-label":"Stop generation",title:"Stop generation",children:"■"}):(0,t.jsx)("button",{type:"submit",disabled:!l.trim(),"aria-label":"Send message",children:"↑"})]})]})]})}),(0,t.jsx)("p",{className:"chat-disclaimer",children:"Siduri can be uncertain. Verify important details against the evidence."})]})]})}],12650)}]);
30
+ `;function u(e,t,a){let r=e.createShader(t);if(!r)throw Error("Failed to create shader");if(e.shaderSource(r,a),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){let t=e.getShaderInfoLog(r);throw e.deleteShader(r),Error(`Shader compilation error: ${t}`)}return r}class h{canvas;gl=null;program=null;maskProgram=null;vertexBuffer=null;uvBuffer=null;indexBuffer=null;aPositionLocation=-1;aTexCoordLocation=-1;uMatrixLocation=null;uTextureLocation=null;uOpacityLocation=null;maskAPositionLocation=-1;maskATexCoordLocation=-1;maskUMatrixLocation=null;maskUTextureLocation=null;textures=[];moc=null;model=null;core=null;paramIndices=new Map;isDisposed=!1;constructor(e){this.canvas=e}modelBounds={minX:-.39,maxX:.4,minY:-.98,maxY:.18,width:.79,height:1.16,centerX:.006,centerY:-.4};initialize(e,t){this.core=e;let a={alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,antialias:!0,stencil:!0},r=this.canvas.getContext("webgl",a)||this.canvas.getContext("experimental-webgl",a)||this.canvas.getContext("webgl2",a);if(!r)throw Error("WebGL is not supported in this browser environment");this.gl=r;let i=u(r,r.VERTEX_SHADER,c),s=u(r,r.FRAGMENT_SHADER,d),n=r.createProgram();if(!n)throw Error("Failed to create WebGL program");if(r.attachShader(n,i),r.attachShader(n,s),r.linkProgram(n),!r.getProgramParameter(n,r.LINK_STATUS))throw Error(`Program link error: ${r.getProgramInfoLog(n)}`);this.program=n,this.aPositionLocation=r.getAttribLocation(n,"a_position"),this.aTexCoordLocation=r.getAttribLocation(n,"a_texCoord"),this.uMatrixLocation=r.getUniformLocation(n,"u_matrix"),this.uTextureLocation=r.getUniformLocation(n,"u_texture"),this.uOpacityLocation=r.getUniformLocation(n,"u_opacity");let o=u(r,r.FRAGMENT_SHADER,m),l=r.createProgram();if(!l)throw Error("Failed to create Mask WebGL program");if(r.attachShader(l,i),r.attachShader(l,o),r.linkProgram(l),!r.getProgramParameter(l,r.LINK_STATUS))throw Error(`Mask Program link error: ${r.getProgramInfoLog(l)}`);if(this.maskProgram=l,this.maskAPositionLocation=r.getAttribLocation(l,"a_position"),this.maskATexCoordLocation=r.getAttribLocation(l,"a_texCoord"),this.maskUMatrixLocation=r.getUniformLocation(l,"u_matrix"),this.maskUTextureLocation=r.getUniformLocation(l,"u_texture"),this.vertexBuffer=r.createBuffer(),this.uvBuffer=r.createBuffer(),this.indexBuffer=r.createBuffer(),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),this.textures=t.textures.map(e=>{let t=r.createTexture();if(!t)throw Error("Failed to create WebGL texture");return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),r.generateMipmap(r.TEXTURE_2D),t}),this.moc=e.Moc.fromArrayBuffer(t.mocBuffer),!this.moc)throw Error("Failed to create Live2D Moc from ArrayBuffer");if(this.model=e.Model.fromMoc(this.moc),!this.model)throw Error("Failed to create Live2D Model from Moc");let h=this.model.parameters.ids;for(let e=0;e<h.length;e++)this.paramIndices.set(h[e],e);this.initializeNeutralMouth(),this.model.update(),this.calculateModelBounds()}initializeNeutralMouth(){this.model&&(this.setParamDirect("ParamMouthOpenY",0),this.setParamDirect("ParamMouthForm",0))}setParamDirect(e,t){let a=this.paramIndices.get(e);if(void 0!==a&&this.model){let e=this.model.parameters.minimumValues[a],r=this.model.parameters.maximumValues[a];this.model.parameters.values[a]=Math.max(e,Math.min(r,t))}}calculateModelBounds(){if(!this.model)return;let e=this.model.drawables,t=e.count,a=1/0,r=-1/0,i=1/0,s=-1/0;for(let n=0;n<t;n++){let t=e.vertexPositions[n];if(t&&0!==t.length)for(let e=0;e<t.length;e+=2){let n=t[e],o=t[e+1];n<a&&(a=n),n>r&&(r=n),o<i&&(i=o),o>s&&(s=o)}}a!==1/0&&r!==-1/0&&i!==1/0&&s!==-1/0&&(this.modelBounds={minX:a,maxX:r,minY:i,maxY:s,width:r-a,height:s-i,centerX:(a+r)/2,centerY:(i+s)/2})}getModelBounds(){return{...this.modelBounds}}setParam(e,t,a=1){let r=this.paramIndices.get(e);if(void 0!==r&&this.model){let e=this.model.parameters.values[r],i=Math.max(this.model.parameters.minimumValues[r],Math.min(this.model.parameters.maximumValues[r],t));this.model.parameters.values[r]=e+(i-e)*a}}render(e,t=Date.now()){let a;if(this.isDisposed||!this.gl||!this.model||!this.program)return;let r=this.gl,i=this.canvas.width,s=this.canvas.height;if(0===i||0===s)return;let n=e.calculateFrameParameters(t);this.setParam("ParamAngleX",n.angleX,.2),this.setParam("ParamAngleY",n.angleY,.2),this.setParam("ParamAngleZ",n.angleZ,.2),this.setParam("ParamBodyAngleX",n.bodyAngleX,.15),this.setParam("ParamBreath",n.breath,.3),this.setParam("ParamEyeLOpen",n.eyeOpenL,.4),this.setParam("ParamEyeROpen",n.eyeOpenR,.4),this.setParam("ParamMouthOpenY",n.mouthOpenY,.35);let o=function(e){if(!e)return"neutral";switch(e.toLowerCase().trim()){case"surprised":return"face_aozame.exp3.json";case"concerned":case"thinking":return"eyes_zetubou.exp3.json";case"happy":return"hair_open.exp3.json";default:return"neutral"}}(e.expression);"face_aozame.exp3.json"===o?(this.setParam("Param10",1,.2),this.setParam("Param9",0,.15),this.setParam("Param11",0,.15),this.setParam("Param12",0,.15)):"eyes_zetubou.exp3.json"===o?(this.setParam("Param9",1,.2),this.setParam("Param10",0,.15),this.setParam("Param11",0,.15),this.setParam("Param12",0,.15)):"hair_open.exp3.json"===o?(this.setParam("Param11",1,.2),this.setParam("Param10",0,.15),this.setParam("Param9",0,.15),this.setParam("Param12",0,.15)):"eye_color.exp3.json"===o?(this.setParam("Param12",1,.2),this.setParam("Param10",0,.15),this.setParam("Param9",0,.15),this.setParam("Param11",0,.15)):(this.setParam("Param10",0,.15),this.setParam("Param9",0,.15),this.setParam("Param11",0,.15),this.setParam("Param12",0,.15)),this.model.update(),r.viewport(0,0,i,s),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.useProgram(this.program);let l=i/s,c=this.modelBounds.width,d=this.modelBounds.height,m=this.modelBounds.centerX,u=this.modelBounds.centerY,h=(a=l>=c/d?1.84/d:1.84/c*l)/l,p=new Float32Array([h,0,0,0,0,a,0,0,0,0,1,0,-m*h,-u*a,0,1]);r.uniformMatrix4fv(this.uMatrixLocation,!1,p),r.uniform1i(this.uTextureLocation,0);let f=this.model.drawables,x=f.count,g=f.renderOrders,v=[];for(let e=0;e<x;e++)v.push(e);v.sort((e,t)=>g[e]-g[t]),r.enableVertexAttribArray(this.aPositionLocation),r.enableVertexAttribArray(this.aTexCoordLocation);let b=(e,t)=>{let a=void 0!==t?t:f.opacities[e];if(a<=.001)return;let i=f.textureIndices[e],s=this.textures[i];if(!s)return;r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s),r.uniform1f(this.uOpacityLocation,a);let n=f.vertexPositions[e];r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bufferData(r.ARRAY_BUFFER,n,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.aPositionLocation,2,r.FLOAT,!1,0,0);let o=f.vertexUvs[e];r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.bufferData(r.ARRAY_BUFFER,o,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.aTexCoordLocation,2,r.FLOAT,!1,0,0);let l=f.indices[e];r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.DYNAMIC_DRAW),r.drawElements(r.TRIANGLES,l.length,r.UNSIGNED_SHORT,0)},y=e=>{if(!this.maskProgram)return;r.useProgram(this.maskProgram),r.uniformMatrix4fv(this.maskUMatrixLocation,!1,p),r.uniform1i(this.maskUTextureLocation,0),r.enableVertexAttribArray(this.maskAPositionLocation),r.enableVertexAttribArray(this.maskATexCoordLocation);let t=f.textureIndices[e],a=this.textures[t];if(!a)return;r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,a);let i=f.vertexPositions[e];r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bufferData(r.ARRAY_BUFFER,i,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.maskAPositionLocation,2,r.FLOAT,!1,0,0);let s=f.vertexUvs[e];r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.bufferData(r.ARRAY_BUFFER,s,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.maskATexCoordLocation,2,r.FLOAT,!1,0,0);let n=f.indices[e];r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,n,r.DYNAMIC_DRAW),r.drawElements(r.TRIANGLES,n.length,r.UNSIGNED_SHORT,0),r.useProgram(this.program),r.enableVertexAttribArray(this.aPositionLocation),r.enableVertexAttribArray(this.aTexCoordLocation)},P=-1;for(let e of v)if(!(f.opacities[e]<=.001))if(f.maskCounts[e]>0){let t=f.masks[e][0];t!==P&&(P=t,r.enable(r.STENCIL_TEST),r.stencilMask(255),r.clear(r.STENCIL_BUFFER_BIT),r.stencilFunc(r.ALWAYS,1,255),r.stencilOp(r.KEEP,r.KEEP,r.REPLACE),r.colorMask(!1,!1,!1,!1),y(t),r.colorMask(!0,!0,!0,!0)),r.stencilFunc(r.EQUAL,1,255),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),b(e)}else -1!==P&&(r.disable(r.STENCIL_TEST),P=-1),b(e);-1!==P&&r.disable(r.STENCIL_TEST)}dispose(){if(this.isDisposed=!0,this.gl){for(let e of this.textures)this.gl.deleteTexture(e);this.textures=[],this.vertexBuffer&&this.gl.deleteBuffer(this.vertexBuffer),this.uvBuffer&&this.gl.deleteBuffer(this.uvBuffer),this.indexBuffer&&this.gl.deleteBuffer(this.indexBuffer),this.program&&this.gl.deleteProgram(this.program)}this.model&&"function"==typeof this.model.release&&this.model.release(),this.moc&&"function"==typeof this.moc.release&&this.moc.release(),this.model=null,this.moc=null,this.gl=null}}function p({modelUrl:e,expression:r="neutral",action:i="idle",state:s="idle",speechId:c,lipSyncValue:d,durationMs:m,className:u="",onStatusChange:f}){let x=(0,a.useRef)(null),g=(0,a.useRef)(null),v=(0,a.useRef)(new n({expression:r,action:i,state:s,speechId:c,lipSyncValue:d,durationMs:m})),b=(0,a.useRef)(null),y=(0,a.useRef)(null),[P,E]=(0,a.useState)("loading"),[w,A]=(0,a.useState)(null),[j,N]=(0,a.useState)(0);return(0,a.useEffect)(()=>{if(!window.matchMedia)return;let e=window.matchMedia("(prefers-reduced-motion: reduce)"),t=()=>{v.current.setReducedMotion(e.matches)};return t(),e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[]),(0,a.useEffect)(()=>{v.current.updateConfig({expression:r,action:i,state:s,speechId:c,lipSyncValue:d,durationMs:m})},[r,i,s,c,d,m]),(0,a.useEffect)(()=>{let t=!1,a=null;async function r(){if(g.current&&x.current){if(!e){E("error"),A("No Live2D model configured. Place model in assets/body/<name>/"),f?.("error","No Live2D model URL specified");return}E("loading"),f?.("loading"),A(null);try{let r=await o();if(t)return;let i=await l(e);if(t)return;let s=g.current;if(!s)return;let n=new h(s);n.initialize(r,i),b.current=n;let c=()=>{if(!x.current||!g.current)return;let e=x.current.getBoundingClientRect();if(e.width<=0||e.height<=0)return;let t=Math.min(window.devicePixelRatio||1,2),a=Math.max(1,Math.floor(e.width*t)),r=Math.max(1,Math.floor(e.height*t));(g.current.width!==a||g.current.height!==r)&&(g.current.width=a,g.current.height=r)};c(),(a=new ResizeObserver(c)).observe(x.current);let d=()=>{t||(b.current&&b.current.render(v.current,performance.now()),y.current=requestAnimationFrame(d))};y.current=requestAnimationFrame(d),E("ready"),f?.("ready")}catch(a){if(t)return;let e=a?.message||"Failed to initialize Live2D avatar";console.warn("[AvatarCanvas] Initialization error:",a),E("error"),A("Avatar model unavailable or failed to load."),f?.("error",e)}}}r();let i=g.current,s=e=>{e.preventDefault(),console.warn("[AvatarCanvas] WebGL context lost"),y.current&&cancelAnimationFrame(y.current),E("error"),A("WebGL context lost.")},n=()=>{console.log("[AvatarCanvas] WebGL context restored, re-initializing..."),r()};return i&&(i.addEventListener("webglcontextlost",s,!1),i.addEventListener("webglcontextrestored",n,!1)),()=>{t=!0,y.current&&(cancelAnimationFrame(y.current),y.current=null),a&&a.disconnect(),i&&(i.removeEventListener("webglcontextlost",s),i.removeEventListener("webglcontextrestored",n)),b.current&&(b.current.dispose(),b.current=null)}},[e,j,f]),(0,t.jsxs)("div",{ref:x,"data-testid":"avatar-canvas-container",className:`relative w-full h-full min-h-0 flex items-center justify-center overflow-hidden bg-transparent ${u}`,"aria-label":"Live2D Companion Presence",children:[(0,t.jsx)("canvas",{ref:g,role:"img","data-testid":"avatar-webgl-canvas","aria-label":"Live2D companion presence",style:{width:"100%",height:"100%",display:"block"},className:`absolute inset-0 w-full h-full block transition-opacity duration-500 ${"ready"===P?"opacity-100":"opacity-0"}`}),"loading"===P&&(0,t.jsxs)("div",{role:"status","aria-live":"polite",className:"absolute inset-0 flex flex-col items-center justify-center gap-3 bg-[#0b0b0e]/90 text-[var(--siduri-text-muted)]",children:[(0,t.jsx)("div",{className:"siduri-glyph w-10 h-10 text-base animate-pulse motion-reduce:animate-none",children:"✦"}),(0,t.jsx)("span",{className:"text-[11px] font-mono tracking-widest uppercase text-[var(--siduri-ember-light)]",children:"Initializing Presence..."})]}),"error"===P&&(0,t.jsxs)("div",{role:"alert","aria-live":"polite",className:"absolute inset-0 flex flex-col items-center justify-center p-6 text-center bg-[#0b0b0e]/95 text-[var(--siduri-text-muted)]",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-full border border-[var(--siduri-border-subtle)] grid place-items-center text-xs text-[var(--siduri-text-dim)] mb-2 font-mono",children:"!"}),(0,t.jsx)("p",{className:"text-xs font-sans text-[var(--siduri-text-secondary)] mb-1",children:w||"Avatar unavailable in this browser."}),(0,t.jsx)("span",{className:"text-[10px] font-mono text-[var(--siduri-text-dim)] mb-3",children:"Conversational text mode remains active"}),(0,t.jsx)("button",{type:"button",onClick:()=>N(e=>e+1),className:"px-3 py-1 text-[11px] font-mono tracking-wider uppercase rounded border border-[var(--siduri-border-subtle)] hover:border-[var(--siduri-border-ember)] text-[var(--siduri-text-secondary)] hover:text-[var(--siduri-text-primary)] transition-colors focus-visible:ring-1 focus-visible:ring-[var(--siduri-border-ember)] outline-none","aria-label":"Retry avatar initialization",children:"Retry"})]})]})}var f=e.i(94108);let x="siduri.chat.conversations.v1";function g(){return"u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random()}`}function v(e){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(e)}e.s(["default",0,function(){let[e,s]=(0,a.useState)([]),[n,o]=(0,a.useState)(null),[l,c]=(0,a.useState)(""),[d,m]=(0,a.useState)("connecting"),[u,h]=(0,a.useState)(!1),[b,y]=(0,a.useState)(!1),[P,E]=(0,a.useState)(!1),[w,A]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[_,T]=(0,a.useState)(null),[L,C]=(0,a.useState)(void 0),[R,M]=(0,a.useState)("auto"),[S,D]=(0,a.useState)("hybrid"),k=(0,a.useRef)(null),B=(0,a.useRef)(null),I=(0,a.useRef)(null),F=(0,a.useMemo)(()=>e.find(e=>e.id===n)??null,[n,e]);function U(){return{id:g(),title:"New conversation",messages:[],updatedAt:Date.now()}}function X(e,t){s(a=>a.map(a=>a.id===e?t(a):a))}async function Y(e){e.preventDefault();let t=l.trim();if(!t)return;if(/\[[^\]]+\]/.test(t))return void m("replace the blanks first");u&&I.current&&(I.current.abort("user_barge_in"),I.current=null,(0,f.interruptChat)("default","user_barge_in"));let a=F;a||(a=U(),s(e=>[a,...e]),o(a.id));let r={id:g(),role:"user",content:t,createdAt:Date.now()},i=g(),n={id:i,role:"assistant",content:"",createdAt:Date.now()},d=[...a.messages,r,n],p=0===a.messages.length?t.slice(0,42):a.title;X(a.id,e=>({...e,title:p,messages:d,updatedAt:Date.now()})),c(""),h(!0),m("streaming");let x=new AbortController;I.current=x;try{await (0,f.postStream)("/chat/stream",{id:"default",message:t,medium:"web",mode:"auto"!==R?R:void 0,history:a.messages.slice(-20).map(e=>({role:e.role,content:e.content}))},{onStaged:e=>{e?.mode&&("casual"===e.mode||"teach"===e.mode||"hybrid"===e.mode)&&D(e.mode)},onAvatar:e=>{let t=e.speech_id;B.current&&clearTimeout(B.current),T({eventId:e.event_id,expression:e.expression||"neutral",action:e.action||"talk",state:"speaking",speechId:t,durationMs:e.durationMs});let a=e.durationMs||4500;B.current=setTimeout(()=>{T(e=>e?{...e,state:"idle",action:"idle"}:null)},a)},onChunk:e=>{e.deltaText&&X(a.id,t=>({...t,messages:t.messages.map(t=>t.id===i?{...t,content:t.content+e.deltaText}:t)})),(e.expression||e.action)&&T(t=>t?{...t,expression:e.expression||t.expression,action:e.action||t.action}:null)},onDone:e=>{e?.metadata?.mode&&("casual"===e.metadata.mode||"teach"===e.metadata.mode||"hybrid"===e.metadata.mode)&&D(e.metadata.mode);let t=e.response||{},r=e.metadata?.memory_proposals,s=e.metadata?.behavioral_proposals;X(a.id,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:e.content||t.subtitle_en||"",spokenJa:t.spoken_ja,evidenceIds:t.evidence_ids,memoryProposals:r,behavioralProposals:s}:e),updatedAt:Date.now()})),m("online")},onInterrupted:()=>{X(a.id,e=>({...e,messages:e.messages.map(e=>e.id===i?{...e,content:e.content?`${e.content} [interrupted]`:"[interrupted]"}:e),updatedAt:Date.now()})),m("online")},onError:e=>{X(a.id,t=>({...t,messages:t.messages.map(t=>t.id===i?{...t,content:`I couldn’t reach the orchestrator. ${String(e)}`}:t),updatedAt:Date.now()})),m("offline")}},x.signal)}catch(e){x.signal.aborted||(X(a.id,t=>({...t,messages:t.messages.map(t=>t.id===i?{...t,content:`I couldn’t reach the orchestrator. ${String(e)}`}:t),updatedAt:Date.now()})),m("offline"))}finally{I.current=null,h(!1)}}(0,a.useEffect)(()=>()=>{B.current&&clearTimeout(B.current),I.current&&I.current.abort("unmounted")},[]),(0,a.useEffect)(()=>{let e=function(){try{let e=JSON.parse(window.localStorage.getItem(x)??"[]");return Array.isArray(e)?e:[]}catch{return[]}}();s(e),o(e[0]?.id??null),y(!0),(0,f.fetchApi)("/health").then(async e=>{if(e.ok){let t=await e.json().catch(()=>({}));m("online"),t.organs?.body?.modelUrl?C(t.organs.body.modelUrl):(0,f.fetchApi)("/api/models/body").then(async e=>{if(e.ok){let t=(await e.json().catch(()=>({}))).models||[],a=t.find(e=>"default"!==e);a?C(`/assets/body/${a}/model.model3.json`):t.length>0&&"default"!==t[0]&&C(`/assets/body/${t[0]}/model.model3.json`)}}).catch(()=>{})}else m("online")}).catch(()=>m("offline"))},[]),(0,a.useEffect)(()=>{b&&window.localStorage.setItem(x,JSON.stringify(e))},[e,b]),(0,a.useEffect)(()=>{k.current?.scrollTo({top:k.current.scrollHeight,behavior:"smooth"})},[n,F?.messages.length,u]);let $=F?.messages??[],O=$.at(-1)?.evidenceIds?.length??0;async function V(e,t,a){if(F)try{await (0,f.postJson)(`/memory/proposals/${a}`,{id:t,companionId:"default"});let r="approve"===a?"approved":"rejected";X(F.id,a=>({...a,messages:a.messages.map(a=>a.id===e&&a.memoryProposals?{...a,memoryProposals:a.memoryProposals.map(e=>e.proposal_id===t?{...e,status:r}:e)}:a)}))}catch(e){console.error(e)}}async function G(e,t,a){if(F)try{await (0,f.postJson)(`/memory/behavioral/${a}`,{id:t,companionId:"default"});let r="approve"===a?"confirmed":"rejected";X(F.id,a=>({...a,messages:a.messages.map(a=>a.id===e&&a.behavioralProposals?{...a,behavioralProposals:a.behavioralProposals.map(e=>e.directive_id===t?{...e,status:r}:e)}:a)}))}catch(e){console.error(e)}}return(0,t.jsxs)("div",{className:`chat-app ${P?"sidebar-collapsed":""} ${w?"mobile-drawer-open":""}`,children:[w&&(0,t.jsx)("div",{className:"chat-backdrop",onClick:()=>A(!1),"aria-hidden":"true"}),(0,t.jsxs)("aside",{className:"chat-sidebar","aria-label":"Conversation history",children:[(0,t.jsxs)("div",{className:"chat-sidebar-top",children:[(0,t.jsxs)("a",{className:"chat-brand",href:"/chat",children:[(0,t.jsx)("span",{className:"chat-brand-mark",children:"S"}),(0,t.jsx)("span",{children:"SIDURI"})]}),(0,t.jsx)("button",{className:"sidebar-collapse",type:"button",onClick:()=>E(e=>!e),"aria-label":P?"Expand sidebar":"Collapse sidebar",children:P?"→":"←"}),(0,t.jsx)("button",{className:"mobile-drawer-close",type:"button",onClick:()=>A(!1),"aria-label":"Close conversation drawer",children:"✕"})]}),(0,t.jsxs)("button",{className:"new-chat-button",type:"button",onClick:()=>{let e;e=U(),s(t=>[e,...t]),o(e.id),c(""),m("online"),A(!1)},children:[(0,t.jsx)("span",{children:"+"})," New conversation"]}),(0,t.jsxs)("div",{className:"history-heading",children:[(0,t.jsx)("span",{children:"Recent conversations"}),(0,t.jsx)("span",{children:e.length})]}),(0,t.jsx)("div",{className:"conversation-list",children:b?0===e.length?(0,t.jsx)("p",{className:"history-empty",children:"Your private conversations will appear here."}):e.slice().sort((e,t)=>t.updatedAt-e.updatedAt).map(a=>(0,t.jsxs)("div",{className:`conversation-row ${a.id===n?"selected":""}`,children:[(0,t.jsxs)("button",{type:"button",className:"conversation-select",onClick:()=>{o(a.id),A(!1)},children:[(0,t.jsx)("span",{className:"conversation-title",children:a.title}),(0,t.jsx)("span",{className:"conversation-date",children:v(a.updatedAt)})]}),(0,t.jsx)("button",{type:"button",className:"conversation-delete",onClick:t=>{t.stopPropagation();var r=a.id;if(s(e=>e.filter(e=>e.id!==r)),n===r){let t=e.find(e=>e.id!==r);o(t?.id??null)}},"aria-label":`Delete ${a.title}`,children:"×"})]},a.id)):(0,t.jsx)("p",{className:"history-empty",children:"Loading history…"})}),(0,t.jsx)("div",{className:"sidebar-footer",children:(0,t.jsxs)("a",{className:"sidebar-console",href:"/operator",children:[(0,t.jsx)("span",{children:"⌘"}),(0,t.jsx)("span",{children:"Operator console"}),(0,t.jsx)("b",{children:"↗"})]})})]}),(0,t.jsxs)("main",{className:"chat-workspace",children:[(0,t.jsxs)("header",{className:"chat-header",children:[(0,t.jsxs)("div",{className:"chat-header-brand-group",children:[(0,t.jsx)("button",{type:"button",className:"mobile-menu-toggle",onClick:()=>A(!0),"aria-label":"Open conversation menu",children:(0,t.jsx)("span",{className:"hamburger-icon",children:"☰"})}),(0,t.jsxs)("a",{href:"/chat",className:"chat-header-title",children:[(0,t.jsx)("span",{className:"chat-brand-mark",children:"S"}),(0,t.jsx)("span",{className:"font-bold tracking-widest text-xs hidden xs:inline",children:"SIDURI"})]})]}),(0,t.jsxs)("div",{className:"chat-header-actions flex items-center gap-1.5 sm:gap-2.5",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>N(e=>!e),className:`connection-pill cursor-pointer transition-all focus-visible:ring-1 focus-visible:ring-[var(--siduri-border-ember)] outline-none ${j?"border-[var(--siduri-border-ember)] bg-[var(--siduri-tint-med)] text-[var(--siduri-ember-highlight)]":"hover:border-[var(--siduri-border-ember)] text-[var(--siduri-text-secondary)]"}`,"aria-label":"Toggle avatar presence","aria-expanded":j,title:j?"Disable Avatar Presence":"Enable Avatar Presence",children:[(0,t.jsx)("span",{className:`status-light ${j?"online":""}`}),(0,t.jsx)("span",{className:"text-xs",children:"Presence"})]}),(0,t.jsxs)("span",{className:"connection-pill hidden sm:inline-flex",title:`Status: ${d}`,children:[(0,t.jsx)("span",{className:`status-light ${"online"===d?"online":""}`}),(0,t.jsx)("span",{className:"text-xs",children:d})]}),(0,t.jsxs)("div",{className:"connection-pill flex items-center gap-1 sm:gap-1.5",title:"Operating interaction mode",children:[(0,t.jsx)("span",{className:"text-[10px] uppercase font-mono tracking-wider opacity-60 hidden md:inline",children:"Mode:"}),(0,t.jsxs)("select",{value:R,onChange:e=>M(e.target.value),className:"bg-transparent text-xs text-[var(--siduri-text-primary)] font-medium outline-none cursor-pointer border-none p-0 max-w-[84px] xs:max-w-[100px] sm:max-w-none","aria-label":"Select interaction mode",children:[(0,t.jsx)("option",{value:"auto",className:"bg-[#121214] text-white",children:"Auto"}),(0,t.jsx)("option",{value:"casual",className:"bg-[#121214] text-white",children:"Casual"}),(0,t.jsx)("option",{value:"teach",className:"bg-[#121214] text-white",children:"Teach"}),(0,t.jsx)("option",{value:"hybrid",className:"bg-[#121214] text-white",children:"Hybrid"})]})]})]})]}),(0,t.jsx)("div",{className:"flex flex-col flex-1 min-h-0 w-full overflow-hidden relative",children:(0,t.jsxs)("section",{className:"conversation-surface","aria-label":"Private chat",children:[(0,t.jsxs)("div",{ref:k,className:`conversation-scroll ${j?"presence-active":""}`,"aria-live":"polite",children:[j?(0,t.jsx)("div",{className:"avatar-presence-area","data-testid":"avatar-presence-area",children:(0,t.jsx)(p,{modelUrl:L,expression:_?.expression||"neutral",action:_?.action||"idle",state:_?.state||"idle",speechId:_?.speechId,lipSyncValue:_?.lipSyncValue,durationMs:_?.durationMs,className:"w-full h-full"})}):0===$.length?(0,t.jsx)(i,{onSelectPrompt:e=>c(e)}):$.map(e=>(0,t.jsxs)("article",{className:`platform-message ${e.role}`,children:[(0,t.jsx)("div",{className:"message-avatar",children:"user"===e.role?"U":"S"}),(0,t.jsxs)("div",{className:"message-body",children:[(0,t.jsxs)("div",{className:"message-meta",children:[(0,t.jsx)("span",{children:"user"===e.role?"You":"Siduri"}),(0,t.jsx)("time",{children:v(e.createdAt)})]}),(0,t.jsx)("p",{className:"message-primary",children:"assistant"===e.role?e.spokenJa??e.content:e.content}),"assistant"===e.role&&e.spokenJa&&(0,t.jsx)("p",{className:"message-translation",children:e.content}),e.evidenceIds&&e.evidenceIds.length>0&&(0,t.jsxs)("span",{className:"evidence-chip",children:[e.evidenceIds.length," evidence link",1===e.evidenceIds.length?"":"s"]}),e.memoryProposals&&e.memoryProposals.length>0&&(0,t.jsx)("div",{className:"memory-receipts",children:e.memoryProposals.map(a=>(0,t.jsxs)("div",{className:`memory-receipt status-${a.status}`,children:[(0,t.jsxs)("strong",{children:["Remember",a.claim_type?` (${a.claim_type})`:"",":"]})," ",(0,r.formatClaimReceipt)(a),(0,t.jsx)("div",{className:"receipt-actions",children:"pending"===a.status?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:()=>V(e.id,a.proposal_id,"approve"),children:"Approve"}),(0,t.jsx)("button",{type:"button",onClick:()=>V(e.id,a.proposal_id,"reject"),children:"Reject"})]}):(0,t.jsx)("span",{children:a.status.toUpperCase()})})]},a.proposal_id))}),e.behavioralProposals&&e.behavioralProposals.length>0&&(0,t.jsx)("div",{className:"memory-receipts",children:e.behavioralProposals.map(a=>(0,t.jsxs)("div",{className:`memory-receipt status-${a.status}`,children:[(0,t.jsxs)("strong",{children:["Runtime effect [",a.knowledge_domain??a.domain," ","→ ",a.runtime_effect??a.memory_class,"]:"]})," ",(0,r.formatRuntimeEffect)(a),(0,t.jsx)("div",{className:"receipt-actions",children:"pending"===a.status?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:()=>G(e.id,a.directive_id,"approve"),children:"Approve"}),(0,t.jsx)("button",{type:"button",onClick:()=>G(e.id,a.directive_id,"reject"),children:"Reject"})]}):(0,t.jsx)("span",{children:a.status.toUpperCase()})})]},a.directive_id))})]})]},e.id)),u&&!j&&(0,t.jsxs)("div",{className:"platform-message assistant thinking-message",children:[(0,t.jsx)("div",{className:"message-avatar",children:"S"}),(0,t.jsxs)("div",{className:"message-body",children:[(0,t.jsxs)("div",{className:"message-meta",children:[(0,t.jsx)("span",{children:"Siduri"}),(0,t.jsx)("span",{className:"thinking-label",children:"thinking"})]}),(0,t.jsxs)("div",{className:"thinking-dots",children:[(0,t.jsx)("i",{}),(0,t.jsx)("i",{}),(0,t.jsx)("i",{})]})]})]})]}),(0,t.jsxs)("form",{className:"platform-composer",onSubmit:Y,children:[(0,t.jsx)("textarea",{value:l,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:"Message Siduri…",rows:1,maxLength:4e3,"aria-label":"Message Siduri"}),(0,t.jsxs)("div",{className:"composer-bottom",children:[(0,t.jsxs)("span",{children:["Private local session ·"," ",O?`${O} evidence link${1===O?"":"s"}`:"No evidence attached"]}),u&&!l.trim()?(0,t.jsx)("button",{type:"button",onClick:function(){I.current&&(I.current.abort("user_stop"),I.current=null),(0,f.interruptChat)("default","user_stop"),h(!1),m("online")},"aria-label":"Stop generation",title:"Stop generation",children:"■"}):(0,t.jsx)("button",{type:"submit",disabled:!l.trim(),"aria-label":"Send message",children:"↑"})]})]})]})}),(0,t.jsx)("p",{className:"chat-disclaimer",children:"Siduri can be uncertain. Verify important details against the evidence."})]})]})}],12650)}]);