PageSourceSearch

https://phasoric.com/assets/AIWorkbench-CCrGjqPr.js

js phasoric.com collected 2026-09-24 14:53:06 UTC 8,541 bytes, 1 lines download raw bytes

1import{o as W}from"./rolldown-runtime-BNNRdYrd.js";import{b as G,r as K,s as U}from"./react-vendor-BqQF_9sx.js";import{t as X}from"./check--u4h0CxO.js";import{t as H}from"./clipboard-VclNVCB0.js";import{t as J}from"./file-plus-corner-DwBFRnKu.js";import{t as B}from"./sparkles-HKQN2J4g.js";import{s as Q}from"./plan-entitlements-D-LMrELD.js";import{Ft as V,S as Y,zt as Z}from"./index-BQuIkJiK.js";import{n as P}from"./settings-DI3JjUJK.js";import{a as ee,i as te,t as se}from"./workspace-8Uv6qSui.js";import{a as re}from"./prompt-recipes-qR0MIx95.js";import{n as ae}from"./prompt-recipe-runner-DIPkxt7x.js";var o=W(G(),1),e=K();function ge({activeNote:l,notes:j,user:m,initialRecipeId:n="",initialSelectedText:u="",onClose:w,onAppend:F,onReplace:A,onCreate:I}){const b=Q(m?.tier),[i,T]=(0,o.useState)("summarize"),[y,E]=(0,o.useState)([]),[N,h]=(0,o.useState)(n),[g,q]=(0,o.useState)(""),[s,d]=(0,o.useState)(null),[k,p]=(0,o.useState)(""),[S,C]=(0,o.useState)(""),[D,R]=(0,o.useState)(!1),[x,$]=(0,o.useState)(!1),f=ee(i),r=y.find(t=>t.id===N),v=r?"recipe":"task",z=Y(P());(0,o.useEffect)(()=>{if(!b.promptRecipes)return;const t=()=>re({enabledOnly:!0}).then(c=>{E(c),n&&c.some(a=>a.id===n)&&h(n)});return t(),window.addEventListener("prompt-recipes-updated",t),()=>window.removeEventListener("prompt-recipes-updated",t)},[b.promptRecipes,n]);const L=r&&(r.inputScope==="empty-note"||r.inputScope==="vault"||r.inputScope==="collection")||!!l,O=async()=>{const t=P();$(!0),C(""),d(null),p("Finding relevant notes…");const c=a=>p(a.phase==="authorization"?`Reviewing the ${a.provider} processing boundary…`:a.phase==="provider"?`Using ${a.provider}…`:a.phase==="download"?`Preparing local model · ${Math.round((a.progress||0)*100)}%`:"Generating…");try{const a=r?await ae({recipe:r,request:g,selectedText:u,activeNote:l,notes:j,settings:t,vault:m?.vaultName||"",onProgress:c}):await se({taskId:i,request:g,activeNote:l,notes:j,user:m,settings:t,onProgress:c});d(a),p(a.forgeDraft?"Forge draft created for explicit review.":"")}catch(a){C(a.message),p("")}finally{$(!1)}},_=r?.name||f.label,M=r?.description||f.description;return(0,e.jsx)("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-black/75 p-3 sm:p-6",role:"presentation",onMouseDown:t=>{t.target===t.currentTarget&&!x&&w()},children:(0,e.jsxs)("div",{className:"flex max-h-[92vh] w-full max-w-5xl flex-col overflow-hidden rounded-2xl border border-violet-300/20 bg-basalt-950 shadow-2xl",role:"dialog","aria-modal":"true","aria-labelledby":"ai-workbench-title",children:[(0,e.jsxs)("header",{className:"flex items-start justify-between border-b border-basalt-800 p-4 sm:p-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(B,{size:16,className:"text-violet-300"}),(0,e.jsx)("h2",{id:"ai-workbench-title",className:"font-outfit text-lg font-semibold",children:"Phasoric Intelligence"})]}),(0,e.jsx)("p",{className:"mt-1 text-[10px] text-basalt-500",children:z.connected?z.message:"Local processing · note content stays on this device."})]}),(0,e.jsx)("button",{type:"button",onClick:w,disabled:x,"aria-label":"Close intelligence workbench",className:"text-basalt-500 hover:text-white",children:(0,e.jsx)(V,{size:16})})]}),(0,e.jsxs)("div",{className:"grid min-h-0 flex-1 md:grid-cols-[280px_1fr]",children:[(0,e.jsxs)("aside",{className:"overflow-y-auto border-b border-basalt-800 p-3 md:border-b-0 md:border-r",children:[(0,e.jsx)("div",{className:"mb-2 text-[8px] font-bold uppercase tracking-wider text-basalt-700",children:"Built-in tools"}),(0,e.jsx)("div",{className:"grid grid-cols-2 gap-1 md:grid-cols-1",children:te.map(t=>(0,e.jsxs)("button",{type:"button",onClick:()=>{T(t.id),h(""),d(null)},className:`rounded-lg px-3 py-2 text-left ${v==="task"&&i===t.id?"bg-violet-300/10 text-violet-200":"text-basalt-500 hover:bg-white/[.03] hover:text-white"}`,children:[(0,e.jsx)("strong",{className:"block text-[10px]",children:t.label}),(0,e.jsx)("span",{className:"mt-0.5 hidden text-[8px] leading-3 text-basalt-600 md:block",children:t.description})]},t.id))}),b.promptRecipes?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mb-2 mt-5 text-[8px] font-bold uppercase tracking-wider text-basalt-700",children:"Prompt Recipes"}),(0,e.jsx)("div",{className:"space-y-1",children:y.map(t=>(0,e.jsxs)("button",{type:"button",onClick:()=>
1{h(t.id),d(null)},className:`w-full rounded-lg px-3 py-2 text-left ${N===t.id?"bg-cyan-300/[.08] text-cyan-200":"text-basalt-500 hover:bg-white/[.03] hover:text-white"}`,children:[(0,e.jsx)("strong",{className:"block text-[10px]",children:t.name}),(0,e.jsxs)("span",{className:"mt-0.5 block text-[8px] text-basalt-600",children:[t.inputScope," → ",t.outputBehavior]})]},t.id))})]}):null]}),(0,e.jsxs)("main",{className:"min-h-0 overflow-y-auto p-4 sm:p-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:_}),(0,e.jsxs)("p",{className:"mt-1 text-[10px] text-basalt-500",children:[M," ",r?`Scope: ${r.inputScope}. Default output: ${r.outputBehavior}.`:f.scope==="vault"?"Phasoric retrieves a small relevant source set instead of sending the full vault.":l?`Working from “${l.title}”.`:"Open a note to provide source material."]})]}),u&&r?.inputScope==="selected-text"?(0,e.jsxs)("div",{className:"mt-3 max-h-24 overflow-auto rounded-lg border border-cyan-300/10 bg-cyan-300/[.025] p-3 text-[9px] leading-4 text-basalt-400",children:["Selected text: ",u]}):null,(0,e.jsx)("textarea",{value:g,onChange:t=>q(t.target.value),rows:3,className:"mt-4 w-full rounded-xl border border-basalt-800 bg-black/20 p-3 text-xs leading-5 text-white outline-none focus:border-violet-300/40",placeholder:v==="recipe"?"Optional focus for this recipe…":i==="ask"?"Ask a question about your notes…":i==="translate"?"Target language…":"Optional instructions or focus…"}),(0,e.jsxs)("button",{type:"button",onClick:O,disabled:x||!L,className:"mt-3 flex items-center gap-2 rounded-lg bg-violet-200 px-4 py-2 text-xs font-bold text-basalt-950 disabled:opacity-40",children:[x?(0,e.jsx)(Z,{className:"animate-spin",size:13}):(0,e.jsx)(B,{size:13}),"Run ",v==="recipe"?"recipe":"intelligence"]}),k&&(0,e.jsx)("span",{className:"ml-3 text-[10px] text-violet-300",children:k}),S&&(0,e.jsxs)("div",{className:"mt-4 rounded-xl border border-red-300/20 bg-red-300/[.04] p-3 text-xs leading-5 text-red-200",children:[S,(0,e.jsx)("div",{className:"mt-1 text-[9px] text-basalt-500",children:"Check Settings → Intelligence to configure local or connected providers."})]}),s&&(0,e.jsxs)("section",{className:"mt-5 rounded-xl border border-basalt-800 bg-black/20",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-basalt-800 px-3 py-2",children:[(0,e.jsxs)("div",{className:"text-[9px] uppercase text-basalt-500",children:[s.provider," · ",s.model," · ",s.sources.length," source",s.sources.length===1?"":"s",s.recipe?` · ${s.recipe.name}`:""]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)("button",{type:"button",onClick:async()=>{await navigator.clipboard.writeText(s.text),R(!0),setTimeout(()=>R(!1),1200)},className:"rounded border border-white/10 p-1.5 text-basalt-400",title:"Copy result",children:D?(0,e.jsx)(X,{size:12}):(0,e.jsx)(H,{size:12})}),s.forgeDraft?(0,e.jsx)(U,{to:"/app/forge",className:"rounded border border-cyan-300/20 px-2 py-1 text-[9px] text-cyan-200",children:"Review in Forge"}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button",onClick:()=>F(s.text),className:`rounded border px-2 py-1 text-[9px] ${s.outputBehavior==="append"?"border-violet-300/40 text-violet-200":"border-white/10"}`,children:"Append"}),(0,e.jsx)("button",{type:"button",onClick:()=>A(s.text),className:`rounded border px-2 py-1 text-[9px] text-amber-200 ${s.outputBehavior==="replace"?"border-amber-300/50":"border-amber-300/20"}`,children:"Replace"}),(0,e.jsxs)("button",{type:"button",onClick:()=>I(s.text,_),className:"flex items-center gap-1 rounded bg-white px-2 py-1 text-[9px] font-bold text-black",children:[(0,e.jsx)(J,{size:10}),"New note"]})]})]})]}),(0,e.jsx)("pre",{className:"max-h-[42vh] overflow-auto whitespace-pre-wrap p-4 font-sans text-xs leading-6 text-basalt-200",children:s.text}),(0,e.jsxs)("div",{className:"border-t border-basalt-800 px-3 py-2 text-[9px] text-basalt-600",children:["Sources: ",s.sources.map(t=>`[[${t.title}]]`).join(" · ")]})]})]})]})]})})}export{ge as AIWorkbench};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.