@starlight-ai/discord-waifus 1.0.2 → 1.0.4

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.
@@ -22,7 +22,7 @@ You must call the orchestrator_decision tool exactly once with your final decisi
22
22
  3. Mentions, quotes, relationships, reactions, timestamps, and recent momentum are all useful signals, but none of them are hard rules.
23
23
  4. Always pay special attention to the latest 10 messages. They are the strongest signal for what the room is currently doing, who may have been overlooked, and whether a loop is starting to form.
24
24
  5. The same waifu may speak again, a different waifu may jump in, or multiple waifus may chain if it feels right.
25
- 6. If follow-ups are starting to restate the same beat, do not stall the room — keep the chain going, but you must attach a sceneDirection to the next waifu that explicitly forces a new beat (topic shift, escalation, interruption, callback, joke, reaction, emotional pivot, or callout). Never continue a repetitive thread without a sceneDirection that changes something.
25
+ 6. Avoid repetitive follow-ups that merely restate the same beat. Continue only when the next message adds something new.
26
26
  7. If a recent user message or direct ping went unnoticed while the room moved on, prefer steering someone to acknowledge it so the chat stays socially inclusive unless silence is clearly more natural.
27
27
  8. Use message timestamps and pacing. Slow gaps matter.
28
28
  9. For stage_manager and no_reply, retriggerAfterSeconds must be between 100 and 28800 seconds. Pick a natural delay for what should happen next.
@@ -64,4 +64,4 @@ merge_memories(memoryIds[])
64
64
  no_change(reason)`})]}),(0,M.jsxs)(`section`,{className:`section`,children:[(0,M.jsx)(`div`,{className:`section-header`,children:(0,M.jsx)(`h3`,{className:`section-title`,children:`Memory edit history`})}),(i.data?.edits.length??0)===0?(0,M.jsx)(at,{title:`No edits yet`,icon:(0,M.jsx)(we,{className:`icon-lg`}),children:`Trigger the stage manager or let the runtime pipeline run to record memory tool calls.`}):(0,M.jsxs)(`div`,{className:`table`,children:[(0,M.jsxs)(`div`,{className:`tr head`,children:[(0,M.jsx)(`span`,{children:`Time`}),(0,M.jsx)(`span`,{children:`Tool`}),(0,M.jsx)(`span`,{children:`Memory IDs`}),(0,M.jsx)(`span`,{children:`Summary`})]}),i.data?.edits.map(e=>(0,M.jsxs)(`div`,{className:`tr`,children:[(0,M.jsx)(`span`,{children:new Date(e.createdAt).toLocaleTimeString()}),(0,M.jsx)(`span`,{children:e.tool}),(0,M.jsx)(`span`,{children:e.affectedMemoryIds.join(`, `)||`—`}),(0,M.jsx)(`span`,{children:e.summary})]},e.id))]})]}),(0,M.jsxs)(`section`,{className:`section`,children:[(0,M.jsx)(`div`,{className:`section-header`,children:(0,M.jsx)(`h3`,{className:`section-title`,children:`Background status`})}),(0,M.jsxs)(`div`,{className:`kv`,children:[(0,M.jsx)(`span`,{className:`k`,children:`Last run`}),(0,M.jsx)(`span`,{className:`v`,children:i.data?.edits[0]?.createdAt?new Date(i.data.edits[0].createdAt).toLocaleString():`—`}),(0,M.jsx)(`span`,{className:`k`,children:`Active per channel`}),(0,M.jsx)(`span`,{className:`v`,children:`0`}),(0,M.jsx)(`span`,{className:`k`,children:`Pending`}),(0,M.jsx)(`span`,{className:`v`,children:`0`})]})]})]})}function ln(e){return(e?.servers??[]).flatMap(e=>Object.values(e.channels??{}).map(t=>({value:`${e.guildId}:${t.channelId}`,label:`${e.name||e.guildId} / ${t.name||`#${t.channelId}`}`,enabled:(t.enabledWaifuIds?.length??0)>0})))}function un(e){return ln(e).find(e=>e.enabled)}function dn(e){let t=e.indexOf(`:`);if(!(!e||t<=0))return{guildId:e.slice(0,t),channelId:e.slice(t+1)}}var fn=[`global`,`guild`,`channel`,`user`],pn=[`active`,`archived`],mn=[1,2,3,4,5];function hn(){let e=P(e=>j.memories(e),[]),t=P(e=>j.waifus(e),[]),[n,r]=(0,S.useState)(``),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(`active`),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(``),[f,p]=(0,S.useState)(void 0),[m,h]=(0,S.useState)(!1),[g,_]=(0,S.useState)(void 0),v=(0,S.useMemo)(()=>(e.data?.memories??[]).filter(e=>!(n&&e.waifuId!==n||i&&e.scope!==i||o&&e.status!==o||c&&String(e.importance)!==c||u&&!e.content.toLowerCase().includes(u.toLowerCase()))),[e.data,n,i,o,c,u]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`view-header`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`view-title`,children:`Memories`}),(0,M.jsx)(`p`,{className:`view-subtitle`,children:`Per-waifu memory store. Shared with the stage manager; writes use the same revision lock.`})]}),(0,M.jsxs)(`div`,{className:`view-actions`,children:[(0,M.jsx)(`button`,{className:`btn`,onClick:e.reload,children:`Refresh`}),(0,M.jsxs)(`button`,{className:`btn primary`,onClick:()=>h(!0),children:[(0,M.jsx)(Ae,{className:`icon`}),` New memory`]})]})]}),g&&(0,M.jsxs)(F,{tone:`warn`,title:`Memory store changed during your edit`,children:[`The server returned 409 with the latest snapshot.`,` `,(0,M.jsx)(`button`,{className:`btn sm`,onClick:()=>{e.setData(g),_(void 0)},children:`Apply latest`})]}),(0,M.jsxs)(`div`,{className:`toolbar`,children:[(0,M.jsxs)(`select`,{className:`select`,value:n,onChange:e=>r(e.target.value),style:{maxWidth:200},children:[(0,M.jsx)(`option`,{value:``,children:`All waifus`}),(t.data?.waifus??[]).map(e=>(0,M.jsx)(`option`,{value:e.id,children:e.displayName},e.id))]}),(0,M.jsxs)(`select`,{className:`select`,value:i,onChange:e=>a(e.target.value),style:{maxWidth:140},children:[(0,M.jsx)(`option`,{value:``,children:`All scopes`}),fn.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))]}),(0,M.jsxs)(`select`,{className:`select`,value:o,onChange:e=>s(e.target.value),style:{maxWidth:140},children:[(0,M.jsx)(`option`,{value:``,children:`All statuses`}),pn.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))]}),(0,M.jsxs)(`select`,{className:`select`,value:c,onChange:e=>l(e.target.value),style:{maxWidth:140},children:[(0,M.jsx)(`option`,{value:``,children:`Any importance`}),mn.map(e=>(0,M.jsxs)(`option`,{value:String(e),children:[`★ `,e]},e))]}),(0,M.jsx)(`input`,{className:`input`,placeholder:`Search content…`,value:u,onChange:e=>d(e.target.value),style:{flex:1,minWidth:200}})]}),e.loading&&(0,M.jsx)(st,{rows:6}),e.error&&(0,M.jsx)(F,{tone:`err`,children:e.error.message}),e.data&&v.length===0&&(0,M.jsx)(at,{title:`No memories match`,icon:(0,M.jsx)(se,{className:`icon-lg`}),children:`Adjust filters, or add a memory manually. Stage-manager edits will land here as well.`}),v.length>0&&(0,M.jsx)(`div`,{className:`table-wrap`,children:(0,M.jsxs)(`table`,{className:`data-table`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`th`,{children:`Waifu`}),(0,M.jsx)(`th`,{children:`Scope`}),(0,M.jsx)(`th`,{children:`Importance`}),(0,M.jsx)(`th`,{children:`Status`}),(0,M.jsx)(`th`,{children:`Content`}),(0,M.jsx)(`th`,{children:`Source msgs`}),(0,M.jsx)(`th`,{children:`Updated`}),(0,M.jsx)(`th`,{})]})}),(0,M.jsx)(`tbody`,{children:v.map(n=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`td`,{children:t.data?.waifus.find(e=>e.id===n.waifuId)?.displayName||n.waifuId}),(0,M.jsx)(`td`,{children:(0,M.jsx)(N,{children:n.scope})}),(0,M.jsxs)(`td`,{children:[`★ `,n.importance]}),(0,M.jsx)(`td`,{children:n.status===`active`?(0,M.jsx)(N,{tone:`ok`,dot:!0,children:`active`}):(0,M.jsx)(N,{tone:`neutral`,dot:!0,children:`archived`})}),(0,M.jsx)(`td`,{className:`wrap`,style:{maxWidth:480},children:(0,M.jsx)(`div`,{style:{whiteSpace:`normal`,overflow:`hidden`},children:n.content})}),(0,M.jsx)(`td`,{children:n.sourceMessageIds.length===0?(0,M.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`—`}):(0,M.jsxs)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`var(--fs-xs)`},children:[n.sourceMessageIds.length,` id`,n.sourceMessageIds.length===1?``:`s`]})}),(0,M.jsx)(`td`,{children:ct(n.updatedAt)}),(0,M.jsx)(`td`,{className:`right`,children:(0,M.jsxs)(`div`,{className:`cell-actions`,children:[(0,M.jsxs)(`button`,{className:`btn sm`,onClick:()=>p(n),children:[(0,M.jsx)(Oe,{className:`icon`}),` Edit`]}),(0,M.jsx)(`button`,{className:`btn sm`,onClick:async()=>{if(e.data)try{let t=await j.updateMemory(n.id,{revision:e.data.revision,status:n.status===`active`?`archived`:`active`});e.setData(t)}catch(e){e instanceof Qe&&_(e.latest)}},children:(0,M.jsx)(re,{className:`icon`})}),(0,M.jsx)(`button`,{className:`btn sm danger`,onClick:async()=>{if(e.data&&window.confirm(`Delete this memory?`))try{let t=await j.deleteMemory(n.id,e.data.revision);e.setData(t)}catch(e){e instanceof Qe&&_(e.latest)}},children:(0,M.jsx)(Be,{className:`icon`})})]})})]},n.id))})]})}),m&&(0,M.jsx)(gn,{mode:`create`,waifus:t.data?.waifus??[],revision:e.data?.revision??0,onClose:()=>h(!1),onSaved:(t,n)=>{n&&_(n),t&&e.setData(t),h(!1)}}),f&&(0,M.jsx)(gn,{mode:`edit`,waifus:t.data?.waifus??[],revision:e.data?.revision??0,memory:f,onClose:()=>p(void 0),onSaved:(t,n)=>{n&&_(n),t&&e.setData(t),p(void 0)}})]})}function gn({mode:e,waifus:t,revision:n,memory:r,onClose:i,onSaved:a}){let[o,s]=(0,S.useState)(r?.waifuId??t[0]?.id??``),[c,l]=(0,S.useState)(r?.scope??`global`),[u,d]=(0,S.useState)(r?.content??``),[f,p]=(0,S.useState)(r?.importance??3),[m,h]=(0,S.useState)(r?.status??`active`),[g,_]=(0,S.useState)((r?.sourceMessageIds??[]).join(`
65
65
  `)),[v,y]=(0,S.useState)(!1),[b,x]=(0,S.useState)(void 0);return(0,M.jsxs)(At,{open:!0,onClose:()=>!v&&i(),wide:!0,title:e===`create`?`New memory`:`Edit memory`,footer:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{className:`btn`,onClick:i,disabled:v,children:`Cancel`}),(0,M.jsx)(`button`,{className:`btn primary`,onClick:async()=>{if(!o||!u.trim()){x(`Waifu and content are required.`);return}y(!0),x(void 0);let t=g.split(/[,\n\s]+/).map(e=>e.trim()).filter(Boolean);try{e===`create`?a(await j.createMemory({revision:n,waifuId:o,scope:c,content:u.trim(),importance:f,sourceMessageIds:t}),void 0):r&&a(await j.updateMemory(r.id,{revision:n,waifuId:o,scope:c,content:u.trim(),importance:f,sourceMessageIds:t,status:m}),void 0)}catch(e){e instanceof Qe?a(void 0,e.latest):x(e.message)}finally{y(!1)}},disabled:v,children:v?`Saving…`:e===`create`?`Create`:`Save`})]}),children:[(0,M.jsxs)(`div`,{className:`grid grid-2`,children:[(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Waifu`}),(0,M.jsxs)(`select`,{className:`select`,value:o,onChange:e=>s(e.target.value),children:[(0,M.jsx)(`option`,{value:``,children:`— Select —`}),t.map(e=>(0,M.jsx)(`option`,{value:e.id,children:e.displayName},e.id))]})]}),(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Scope`}),(0,M.jsx)(`select`,{className:`select`,value:c,onChange:e=>l(e.target.value),children:fn.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))})]}),(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Importance`}),(0,M.jsx)(`select`,{className:`select`,value:String(f),onChange:e=>p(Number(e.target.value)),children:mn.map(e=>(0,M.jsxs)(`option`,{value:String(e),children:[`★ `,e]},e))})]}),e===`edit`&&(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Status`}),(0,M.jsx)(`select`,{className:`select`,value:m,onChange:e=>h(e.target.value),children:pn.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Content`}),(0,M.jsx)(`textarea`,{className:`textarea`,value:u,onChange:e=>d(e.target.value),rows:6})]}),(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Source message ids`}),(0,M.jsx)(`textarea`,{className:`textarea`,value:g,onChange:e=>_(e.target.value),rows:3,placeholder:`Comma- or newline-separated Discord message ids`}),(0,M.jsx)(`span`,{className:`field-hint`,children:`Optional but useful when the stage manager surfaces a memory based on real messages.`})]}),b&&(0,M.jsx)(F,{tone:`err`,children:b})]})}var _n=0;function vn(){let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(``),c=(0,S.useRef)(n);c.current=n;let l=P(e=>j.runtime(e),[]);(0,S.useEffect)(()=>{let e;try{e=et()}catch{return}let n=e=>{c.current||t(t=>[{id:++_n,...e},...t].slice(0,500))};return e.addEventListener(`runtime`,e=>{let t=e.data;try{let e=JSON.parse(t);n({ts:new Date().toISOString(),level:e?.discord?.warnings?.length?`warn`:`ok`,source:`runtime`,message:bn(e)})}catch{n({ts:new Date().toISOString(),level:`info`,source:`runtime`,message:t})}}),e.addEventListener(`log`,e=>{try{let t=JSON.parse(e.data);n({ts:t.time??new Date().toISOString(),level:yn(t.level),source:`backend`,message:t.context===void 0?t.message:`${t.message} ${ft(t.context)}`})}catch{n({ts:new Date().toISOString(),level:`info`,source:`backend`,message:e.data})}}),e.onerror=()=>{n({ts:new Date().toISOString(),level:`err`,source:`sse`,message:`Event stream disconnected; will retry.`})},()=>e?.close()},[]);let u=(0,S.useMemo)(()=>e.filter(e=>!(o&&e.level!==o||i&&!`${e.source} ${e.message}`.toLowerCase().includes(i.toLowerCase()))),[e,i,o]);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`view-header`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`view-title`,children:`Logs & diagnostics`}),(0,M.jsxs)(`p`,{className:`view-subtitle`,children:[`Live SSE events from `,(0,M.jsx)(`code`,{children:`/api/events`}),`. Provider, Discord, queue, and runtime events appear here as the backend emits them.`]})]}),(0,M.jsxs)(`div`,{className:`view-actions`,children:[(0,M.jsx)(`button`,{className:`btn`,onClick:()=>r(e=>!e),children:n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ke,{className:`icon`}),` Resume stream`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(De,{className:`icon`}),` Pause stream`]})}),(0,M.jsxs)(`button`,{className:`btn`,onClick:()=>t([]),children:[(0,M.jsx)(Be,{className:`icon`}),` Clear`]}),(0,M.jsxs)(`button`,{className:`btn primary`,onClick:async()=>{try{let e={...await j.diagnosticsBundle(),clientEntries:u.slice(0,200)};await navigator.clipboard.writeText(ft(e)),alert(`Diagnostic bundle copied to clipboard.`)}catch(e){alert(`Copy failed: `+e.message)}},children:[(0,M.jsx)(O,{className:`icon`}),` Copy diagnostic bundle`]})]})]}),(0,M.jsxs)(`div`,{className:`toolbar`,children:[(0,M.jsxs)(`select`,{className:`select`,value:o,onChange:e=>s(e.target.value),style:{maxWidth:140},children:[(0,M.jsx)(`option`,{value:``,children:`All levels`}),(0,M.jsx)(`option`,{value:`info`,children:`info`}),(0,M.jsx)(`option`,{value:`ok`,children:`ok`}),(0,M.jsx)(`option`,{value:`warn`,children:`warn`}),(0,M.jsx)(`option`,{value:`err`,children:`err`})]}),(0,M.jsx)(`input`,{className:`input`,placeholder:`Search source/message…`,value:i,onChange:e=>a(e.target.value),style:{flex:1,minWidth:200}}),(0,M.jsx)(N,{tone:n?`warn`:`ok`,dot:!0,children:n?`paused`:`live`})]}),u.length===0?(0,M.jsx)(at,{title:`No log lines`,icon:(0,M.jsx)(T,{className:`icon-lg`}),children:`Backend, provider, Discord, and queue events will appear here as the orchestrator pipeline runs.`}):(0,M.jsx)(`div`,{className:`log-list`,children:u.map(e=>(0,M.jsxs)(`div`,{className:`log-line`,children:[(0,M.jsx)(`span`,{className:`ts`,children:lt(e.ts)}),(0,M.jsx)(`span`,{className:`lvl `+e.level,children:e.level}),(0,M.jsx)(`span`,{className:`src`,children:e.source}),(0,M.jsx)(`span`,{className:`msg`,children:e.message})]},e.id))}),(0,M.jsxs)(`section`,{className:`section`,style:{marginTop:32},children:[(0,M.jsxs)(`div`,{className:`section-header`,children:[(0,M.jsx)(`h3`,{className:`section-title`,children:`Doctor`}),(0,M.jsx)(`span`,{className:`section-description`,children:`Snapshot of runtime + intent / credential status.`})]}),l.loading&&(0,M.jsx)(ot,{height:80}),l.error&&(0,M.jsx)(F,{tone:`err`,children:l.error.message}),l.data&&(0,M.jsxs)(`div`,{className:`kv`,children:[(0,M.jsx)(`span`,{className:`k`,children:`Node version`}),(0,M.jsx)(`span`,{className:`v`,children:`requires >= 20`}),(0,M.jsx)(`span`,{className:`k`,children:`Package version`}),(0,M.jsx)(`span`,{className:`v`,children:l.data.packageVersion}),(0,M.jsx)(`span`,{className:`k`,children:`PID`}),(0,M.jsx)(`span`,{className:`v`,children:l.data.pid}),(0,M.jsx)(`span`,{className:`k`,children:`Mode`}),(0,M.jsx)(`span`,{className:`v`,children:l.data.mode}),(0,M.jsx)(`span`,{className:`k`,children:`Data root`}),(0,M.jsx)(`span`,{className:`v`,style:{fontFamily:`var(--font-mono)`,fontSize:`var(--fs-xs)`},children:l.data.dataRoot}),(0,M.jsx)(`span`,{className:`k`,children:`Discord`}),(0,M.jsxs)(`span`,{className:`v`,children:[l.data.discord.connected?(0,M.jsx)(N,{tone:`ok`,dot:!0,children:`connected`}):(0,M.jsx)(N,{tone:`warn`,dot:!0,children:`offline`}),` `,l.data.discord.waifuBotCount,` waifu bots`]}),(0,M.jsx)(`span`,{className:`k`,children:`Required intents`}),(0,M.jsx)(`span`,{className:`v`,children:`GUILDS, GUILD_MESSAGES, GUILD_MESSAGE_REACTIONS, MESSAGE_CONTENT`}),(0,M.jsx)(`span`,{className:`k`,children:`Optional intents`}),(0,M.jsx)(`span`,{className:`v`,children:`GUILD_MEMBERS (for full member refresh)`}),l.data.discord.warnings.length>0&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`k`,children:`Warnings`}),(0,M.jsx)(`span`,{className:`v`,style:{color:`var(--warn)`},children:l.data.discord.warnings.join(`; `)})]})]})]})]})}function yn(e){return e===`error`?`err`:e===`warn`?`warn`:`info`}function bn(e){let t=e;return t?[t.paused?`paused`:`running`,t.discord?.connected?`discord-online`:`discord-offline`,`${t.queues?.active??0} queues`].join(` · `):`runtime snapshot`}var xn={orchestrator:`orchestrator`,waifu:`waifu`,stage_manager:`stage manager`,reviewer:`reviewer`},Sn={orchestrator:`info`,waifu:`ok`,stage_manager:`warn`,reviewer:`warn`};function Cn(){let[e,t]=(0,S.useState)([]),[n,r]=(0,S.useState)(!1),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(new Set),c=(0,S.useRef)(n);c.current=n,(0,S.useEffect)(()=>{let e;try{e=et()}catch{return}let n=e=>{c.current||t(t=>[e,...t].slice(0,200))};return e.addEventListener(`query`,e=>{try{n(JSON.parse(e.data))}catch{}}),()=>e?.close()},[]);let l=(0,S.useMemo)(()=>i?e.filter(e=>e.role===i):e,[e,i]),u=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},d=async e=>{try{await navigator.clipboard.writeText(ft(e.payload)),alert(`Query payload copied.`)}catch(e){alert(`Copy failed: `+e.message)}};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`view-header`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`view-title`,children:`Provider queries`}),(0,M.jsx)(`p`,{className:`view-subtitle`,children:`Conversational payloads sent to LLM providers — system prompt and messages only. Model, sampling params, and other settings are omitted by design.`})]}),(0,M.jsxs)(`div`,{className:`view-actions`,children:[(0,M.jsx)(`button`,{className:`btn`,onClick:()=>r(e=>!e),children:n?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ke,{className:`icon`}),` Resume stream`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(De,{className:`icon`}),` Pause stream`]})}),(0,M.jsxs)(`button`,{className:`btn`,onClick:()=>t([]),children:[(0,M.jsx)(Be,{className:`icon`}),` Clear`]})]})]}),(0,M.jsxs)(`div`,{className:`toolbar`,children:[(0,M.jsxs)(`select`,{className:`select`,value:i,onChange:e=>a(e.target.value),style:{maxWidth:180},children:[(0,M.jsx)(`option`,{value:``,children:`All roles`}),(0,M.jsx)(`option`,{value:`orchestrator`,children:`Orchestrator`}),(0,M.jsx)(`option`,{value:`waifu`,children:`Waifu`}),(0,M.jsx)(`option`,{value:`stage_manager`,children:`Stage manager`}),(0,M.jsx)(`option`,{value:`reviewer`,children:`Reviewer`})]}),(0,M.jsx)(N,{tone:n?`warn`:`ok`,dot:!0,children:n?`paused`:`live`})]}),l.length===0?(0,M.jsx)(at,{title:`No provider queries yet`,icon:(0,M.jsx)(ve,{className:`icon-lg`}),children:`Each call to an LLM provider will appear here. Trigger orchestration in a connected Discord channel to see a query.`}):(0,M.jsx)(`div`,{className:`log-list`,children:l.map(e=>{let t=o.has(e.id);return(0,M.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,M.jsxs)(`button`,{className:`log-line`,onClick:()=>u(e.id),style:{background:`transparent`,border:`none`,textAlign:`left`,cursor:`pointer`,width:`100%`},children:[(0,M.jsx)(`span`,{className:`ts`,children:lt(e.time)}),(0,M.jsx)(`span`,{className:`lvl info`,style:{minWidth:92,textAlign:`center`},children:xn[e.role]}),(0,M.jsx)(`span`,{className:`src`,children:(0,M.jsx)(N,{tone:Sn[e.role],dot:!0,children:e.role})}),(0,M.jsx)(`span`,{className:`msg`,children:Tn(e.payload)}),(0,M.jsx)(`span`,{style:{marginLeft:`auto`},children:t?(0,M.jsx)(le,{className:`icon`}):(0,M.jsx)(E,{className:`icon`})})]}),t&&(0,M.jsxs)(`div`,{style:{margin:`4px 8px 12px 8px`,padding:12,background:`var(--surface-2, rgba(255,255,255,0.02))`,border:`1px solid var(--border, rgba(255,255,255,0.06))`,borderRadius:8},children:[(0,M.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginBottom:8},children:(0,M.jsxs)(`button`,{className:`btn sm`,onClick:()=>d(e),children:[(0,M.jsx)(O,{className:`icon`}),` Copy JSON`]})}),(0,M.jsx)(`pre`,{style:{margin:0,fontFamily:`var(--font-mono)`,fontSize:`var(--fs-xs)`,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:wn(e.payload)})]})]},e.id)})})]})}function wn(e){let t=JSON.stringify(e,null,2);return t.replace(/"((?:\\.|[^"\\])*)"/g,(e,n,r)=>{let i=t.lastIndexOf(`
66
66
  `,r-1)+1,a=` `.repeat(r-i+1);return`"${n.replace(/(?<!\\)((?:\\\\)*)\\n/g,`$1\n${a}`).replace(/(?<!\\)((?:\\\\)*)\\t/g,`$1 `)}"`})}function Tn(e){let t=[];return Array.isArray(e.messages)&&t.push(`${e.messages.length} messages`),Array.isArray(e.input)&&t.push(`${e.input.length} input items`),Array.isArray(e.tools)&&t.push(`${e.tools.length} tools`),typeof e.system==`string`&&t.push(`system ${e.system.length}ch`),typeof e.instructions==`string`&&t.push(`instructions ${e.instructions.length}ch`),t.length?t.join(` · `):`empty payload`}function En(){let e=P(e=>j.getConfig(e),[]),[t,n]=(0,S.useState)(void 0),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(void 0),[s,c]=(0,S.useState)(void 0);return(0,S.useEffect)(()=>{e.data&&!t&&n(e.data)},[e.data,t]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`view-header`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`view-title`,children:`Settings`}),(0,M.jsxs)(`p`,{className:`view-subtitle`,children:[`App-wide configuration backed by `,(0,M.jsx)(`code`,{children:`config.toml`}),` under the data root.`]})]}),(0,M.jsx)(`div`,{className:`view-actions`,children:(0,M.jsxs)(`button`,{className:`btn primary`,onClick:async()=>{if(t){i(!0),o(void 0);try{let r=await j.putConfig(t);n(r),e.setData(r),c(new Date().toISOString())}catch(e){o(e.message)}finally{i(!1)}}},disabled:!t||r,children:[(0,M.jsx)(Me,{className:`icon`}),r?`Saving…`:`Save all`]})})]}),e.loading&&(0,M.jsx)(ot,{height:120}),e.error&&(0,M.jsx)(F,{tone:`err`,children:e.error.message}),a&&(0,M.jsx)(F,{tone:`err`,children:a}),s&&!a&&(0,M.jsxs)(F,{tone:`ok`,children:[`Saved at `,new Date(s).toLocaleTimeString(),`.`]}),t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`section`,{className:`section`,children:[(0,M.jsxs)(`div`,{className:`section-header`,children:[(0,M.jsx)(`h3`,{className:`section-title`,children:`HTTP`}),(0,M.jsx)(`span`,{className:`section-description`,children:`Host and port apply on the next process start. Discord/runtime changes apply immediately.`})]}),(0,M.jsxs)(`div`,{className:`grid grid-2`,children:[(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Host`}),(0,M.jsx)(`input`,{className:`input`,value:t.http.host,onChange:e=>n({...t,http:{...t.http,host:e.target.value}})})]}),(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Port`}),(0,M.jsx)(`input`,{className:`input`,type:`number`,min:1,max:65535,value:t.http.port,onChange:e=>n({...t,http:{...t.http,port:Number(e.target.value)||t.http.port}})})]})]})]}),(0,M.jsxs)(`section`,{className:`section`,children:[(0,M.jsx)(`div`,{className:`section-header`,children:(0,M.jsx)(`h3`,{className:`section-title`,children:`Runtime`})}),(0,M.jsxs)(`div`,{className:`grid grid-2`,children:[(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Auto-connect Discord on start`}),(0,M.jsx)(It,{checked:t.runtime.autoConnectDiscord,onChange:e=>n({...t,runtime:{...t.runtime,autoConnectDiscord:e}}),label:t.runtime.autoConnectDiscord?`Enabled`:`Disabled`})]}),(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Start paused`}),(0,M.jsx)(It,{checked:t.runtime.paused,onChange:e=>n({...t,runtime:{...t.runtime,paused:e}}),label:t.runtime.paused?`Paused`:`Active`})]})]})]}),(0,M.jsxs)(`section`,{className:`section`,children:[(0,M.jsx)(`div`,{className:`section-header`,children:(0,M.jsx)(`h3`,{className:`section-title`,children:`Frontend`})}),(0,M.jsxs)(`div`,{className:`field`,children:[(0,M.jsx)(`label`,{className:`field-label`,children:`Static dir override`}),(0,M.jsx)(`input`,{className:`input code`,value:t.frontend.staticDir??``,onChange:e=>n({...t,frontend:{...t.frontend,staticDir:e.target.value||void 0}}),placeholder:`Defaults to bundled frontend build`})]})]}),(0,M.jsxs)(`section`,{className:`section`,children:[(0,M.jsxs)(`div`,{className:`section-header`,children:[(0,M.jsx)(`h3`,{className:`section-title`,children:`Raw config`}),(0,M.jsxs)(`span`,{className:`section-description`,children:[`Schema version `,t.schemaVersion,`.`]})]}),(0,M.jsx)(`pre`,{className:`code-block`,children:JSON.stringify(t,null,2)})]})]})]})}function Dn(){let[e,t]=Xe(),[n,r]=(0,S.useState)(!1),i=nt(),a=e=>{t(e),r(!1)};return(0,M.jsxs)(`div`,{className:`app-shell`,children:[(0,M.jsxs)(`aside`,{className:`sidebar`+(n?` open`:``),children:[(0,M.jsxs)(`div`,{className:`brand`,children:[(0,M.jsx)(`span`,{className:`brand-mark`,children:`W`}),(0,M.jsx)(`span`,{children:`Discord Waifus`}),(0,M.jsx)(`span`,{style:{flex:1}}),(0,M.jsx)(`button`,{className:`btn ghost sm`,style:{display:n?`inline-flex`:`none`},onClick:()=>r(!1),"aria-label":`Close menu`,children:(0,M.jsx)(Ue,{className:`icon`})})]}),(0,M.jsx)(`nav`,{className:`nav`,children:Ke.map(t=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{className:`nav-section-label`,children:t.label}),Ge.filter(e=>e.group===t.id).map(t=>{let n=t.icon;return(0,M.jsxs)(`button`,{className:`nav-item`+(e===t.id?` active`:``),onClick:()=>a(t.id),children:[(0,M.jsx)(n,{className:`icon`}),(0,M.jsx)(`span`,{children:t.label})]},t.id)})]},t.id))}),(0,M.jsxs)(`div`,{className:`sidebar-footer`,children:[(0,M.jsx)(`div`,{children:i?(0,M.jsx)(N,{tone:i.paused?`warn`:`ok`,dot:!0,children:i.paused?`Paused`:`Running`}):(0,M.jsx)(N,{tone:`neutral`,dot:!0,children:`Offline`})}),(0,M.jsx)(`div`,{children:i?.discord.connected?`Discord connected`:`Discord offline`}),(0,M.jsx)(`div`,{children:i?`${i.queues.active} active queues`:``})]})]}),(0,M.jsx)(`div`,{className:`menu-backdrop`+(n?` open`:``),onClick:()=>r(!1)}),(0,M.jsxs)(`header`,{className:`topbar`,children:[(0,M.jsx)(`button`,{className:`btn ghost sm menu-btn`,onClick:()=>r(!0),"aria-label":`Open menu`,children:(0,M.jsx)(Te,{className:`icon`})}),(0,M.jsx)(`h1`,{children:Ge.find(t=>t.id===e)?.label??`Dashboard`}),(0,M.jsx)(`div`,{className:`topbar-spacer`}),(0,M.jsxs)(`div`,{className:`topbar-status`,children:[i?.discord.connected?(0,M.jsx)(N,{tone:`ok`,dot:!0,children:`Discord`}):(0,M.jsx)(N,{tone:`warn`,dot:!0,children:`Discord offline`}),i&&(0,M.jsxs)(N,{tone:`info`,dot:!0,children:[i.queues.active,` queues`]}),i?(0,M.jsx)(N,{tone:i.paused?`warn`:`ok`,dot:!0,children:i.paused?`Paused`:`Running`}):(0,M.jsx)(N,{tone:`neutral`,dot:!0,children:`Connecting…`})]})]}),(0,M.jsx)(`main`,{className:`main`,children:(0,M.jsx)(On,{route:e,navigate:a})})]})}function On({route:e,navigate:t}){switch(e){case`dashboard`:return(0,M.jsx)(ht,{});case`setup`:return(0,M.jsx)(kt,{onNavigate:e=>t(e)});case`providers`:return(0,M.jsx)(jt,{});case`waifus`:return(0,M.jsx)(Vt,{});case`servers`:return(0,M.jsx)(qt,{});case`orchestrator`:return(0,M.jsx)(en,{});case`reviewer`:return(0,M.jsx)(on,{});case`stage-manager`:return(0,M.jsx)(cn,{});case`memories`:return(0,M.jsx)(hn,{});case`logs`:return(0,M.jsx)(vn,{});case`queries`:return(0,M.jsx)(Cn,{});case`settings`:return(0,M.jsx)(En,{});default:return(0,M.jsx)(ht,{})}}var kn=document.getElementById(`root`);if(!kn)throw Error(`Root container not found`);(0,We.createRoot)(kn).render((0,M.jsx)(S.StrictMode,{children:(0,M.jsx)(Dn,{})}));
67
- //# sourceMappingURL=index-BV8l-6Yl.js.map
67
+ //# sourceMappingURL=index-B7T7Pt30.js.map