PageSourceSearch

https://platform.truestate.io/_next/static/chunks/8155-fe333a9ab290c9ea.js

js truestate.io collected 2026-10-09 22:59:44 UTC 12,409 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8155],{88155:(e,l,i)=>{i.d(l,{A:()=>H});var s=i(37876),t=i(14232),a=i(70496),n=i(73249),r=i(87035),o=i(25601),d=i(72311),c=i(31e3),u=i(96192),h=i(73162),x=i(41792),p=i(31548),m=i(80508),b=i(24588),g=i(55055),v=i(41182),_=i(22457),j=i(2857),k=i(38730),A=i(99343),f=i(25143),w=i(29112),y=i(99124),C=i(71441),S=i(2341),W=i(18384),N=i(71097),D=i(49768),z=i(46329),R=i(6537);function I(e){let{instructions:l,loading:i,error:t,onRefresh:r}=e;return(0,s.jsxs)(n.A,{spacing:1.25,"aria-label":"Skill instructions",children:[(0,s.jsxs)(c.A,{children:[(0,s.jsxs)(n.A,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[(0,s.jsx)(u.A,{variant:"body2",sx:{fontWeight:700},children:"Skill instructions"}),(0,s.jsx)(a.A,{variant:"secondary",size:"small",onClick:r,disabled:i,children:t?"Retry":"Refresh"})]}),(0,s.jsx)(u.A,{variant:"body2",color:"text.secondary",children:"These instructions are attached to this skill. Ask Dawn in chat to change them, then refresh to see updates."})]}),i?(0,s.jsxs)(n.A,{direction:"row",spacing:1,alignItems:"center",role:"status",children:[(0,s.jsx)(R.A,{size:18,"aria-label":"Loading skill instructions"}),(0,s.jsx)(u.A,{variant:"body2",color:"text.secondary",children:"Loading skill instructions"})]}):t?(0,s.jsx)(n.A,{direction:"row",spacing:1,alignItems:"center",children:(0,s.jsx)(u.A,{variant:"body2",color:"text.secondary",children:"Skill instructions are unavailable."})}):0===l.length?(0,s.jsx)(u.A,{variant:"body2",color:"text.secondary",children:"No skill instructions attached."}):(0,s.jsx)(n.A,{spacing:1.5,children:l.map(e=>(0,s.jsxs)(c.A,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:1.5,minWidth:0},children:[(0,s.jsxs)(n.A,{direction:"row",justifyContent:"space-between",alignItems:"baseline",gap:1,children:[(0,s.jsx)(u.A,{variant:"body2",sx:{fontWeight:700,overflowWrap:"anywhere"},children:e.name}),(0,s.jsxs)(u.A,{variant:"caption",color:"text.secondary",sx:{flexShrink:0},children:["Version ",e.version_number]})]}),(0,s.jsx)(u.A,{variant:"body2",component:"div",sx:{mt:1,whiteSpace:"pre-wrap",overflowWrap:"anywhere",maxHeight:240,overflow:"auto"},children:e.content})]},e.id))})]})}let E=["define_work_order","update_work_order","record_experiment","quality_review","review_conventions","web_search"],T={name:"",description:"",when_to_use:"",allowed_tools:E,body:"",source_type:"user",source_title:"",source_url:"",is_published:!0},P=e=>e.is_builtin?"Default":"arxiv"===e.source_type?"arXiv":"Published";function L(){for(var e=arguments.length,l=Array(e),i=0;i<e;i++)l[i]=arguments[i];let s=l.map(e=>e?new Date(e.endsWith("Z")?e:"".concat(e,"Z")).getTime():NaN).filter(Number.isFinite).sort((e,l)=>l-e)[0];return s?(0,S.M)(new Date(s)):""}function H(){var e,l,i;let{embedded:S=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},R=(0,C.vN)(),H=(0,y.d)(),{agentToolPermissions:M,featurePermissions:O,localStorageCurrentOrgId:G}=(0,w.QN)(),B=(null==O?void 0:O.includes("skills"))===!0&&(null==M?void 0:M.includes("skill_instruction"))===!0,[F,J]=(0,t.useState)([]),[U,Z]=(0,t.useState)(null),[q,Q]=(0,t.useState)([]),[V,X]=(0,t.useState)(null),[Y,K]=(0,t.useState)(!1),[$,ee]=(0,t.useState)(!1),[el,ei]=(0,t.useState)(0),[es,et]=(0,t.useState)([]),[ea,en]=(0,t.useState)(!0),[er,eo]=(0,t.useState)(0),[ed,ec]=(0,t.useState)(""),[eu,eh]=(0,t.useState)(!1),[ex,ep]=(0,t.useState)(null),[em,eb]=(0,t.useState)(T),[eg,ev]=(0,t.useState)(!1),[e_,ej]=(0,t.useState)(!1);(0,t.useEffect)(()=>{if(!G)return;let e=!0;return J([]),Z(null),ep(null),eh(!1),en(!0),R("/api/backend/skills/").then(l=>{e&&(J(l),Z(G))}).catch(l=>{e&&H({title:"Failed to fetch skills: ".concat(l.message),status:"error"})}).finally(()=>{e&&en(!1)}),()=>{e=!1}},[G,R,H]),(0,t.useEffect)(()=>{R("/api/backend/skills/available-tools").then(et).catch(()=>et(E))},[]),(0,t.useEffect)(()=>{let e=!0;return(Q([]),X(null),ee(!1),B&&G)?(K(!0),R("/api/backend/skill-instructions/").then(l=>{e&&(Q(l),X(G))}).catch(()=>{e&&ee(!0)}).finally(()=>{e&&K(!1)}),()=>{e=!1}):(K(!1),()=>{e=!1})},[B,G,el,R]);let ek=(0,t.useMemo)(()=>{let e=new Map;if(V!==G)return e;for(let i of q)for(let s of i.skill_ids){var l;let t=null!=(l=e.get(s))?l:[];t.push(i),e.set(s,t)}return e},[G,q,V]),eA=(0,t.useMemo)(()=>{let e=ed.trim().toLowerCase();return U!==G?[]:F.filter(l=>{var i,s;return(1!==er||!!l.is_builtin)&&(2!==er||!l.is_builtin)&&(!e||[l.name,l.description,l.when_to_use,l.skill_id,null!=(i=l.s
1ource_title)?i:"",...(null!=(s=ek.get(l.skill_id))?s:[]).map(e=>e.name)].join(" ").toLowerCase().includes(e))})},[ek,G,F,U,ed,er]),ef=()=>{ep(null),eb(T),eh(!0)},ew=e=>{var l,i;ep(e),eb({name:e.name,description:e.description,when_to_use:e.when_to_use,allowed_tools:e.allowed_tools,body:e.body,source_type:"builtin"===e.source_type?"user":e.source_type,source_title:null!=(l=e.source_title)?l:"",source_url:null!=(i=e.source_url)?i:"",is_published:e.is_published}),eh(!0)},ey=(e,l)=>{eb(i=>({...i,[e]:l}))},eC=[{...N.zf},{field:"name",headerName:"Name",flex:1.1,minWidth:180,...N.EP},{field:"source_type",headerName:"Source",width:120,valueGetter:(e,l)=>P(l)},...B?[{field:"skill_instructions",headerName:"Instructions",width:130,valueGetter:(e,l)=>{var i,s;return null!=(s=null==(i=ek.get(l.skill_id))?void 0:i.length)?s:0}}]:[],{field:"last_updated",headerName:"Last updated",width:170,valueGetter:(e,l)=>L(l.created_at,l.updated_at)},{field:"open",headerName:"",...N.Us,renderCell:e=>(0,s.jsx)(a.A,{size:"small",variant:"secondary",onClick:l=>{l.stopPropagation(),ew(e.row)},sx:N.hY,children:"Open"})}],eS=!!(null==ex?void 0:ex.is_builtin);return(0,s.jsxs)(n.A,{direction:"column",padding:3*!S,gap:2,sx:{width:"100%",height:"100%",minHeight:0,boxSizing:"border-box",overflow:"hidden"},children:[S?(0,s.jsx)(z.cQ,{description:"Reusable playbooks for how agents should approach specialised or recurring work.",actions:(0,s.jsx)(D.JZ,{entityName:"skill",verb:"Add",onClick:ef})}):(0,s.jsx)(D.Bb,{title:"Skills",createAction:{entityName:"skill",verb:"Add",onClick:ef}}),S?(0,s.jsx)(z.nC,{children:(0,s.jsxs)(n.A,{direction:{xs:"column",md:"row"},gap:1.5,alignItems:{xs:"stretch",md:"center"},children:[(0,s.jsxs)(r.A,{value:er,onChange:(e,l)=>eo(l),sx:{minHeight:40},children:[(0,s.jsx)(o.A,{label:"All",value:0}),(0,s.jsx)(o.A,{label:"Default",value:1}),(0,s.jsx)(o.A,{label:"Organisation",value:2})]}),(0,s.jsx)(d.A,{size:"small",placeholder:"Search skills",value:ed,onChange:e=>ec(e.target.value),sx:{width:{xs:"100%",md:320}}})]})}):(0,s.jsxs)(n.A,{direction:{xs:"column",md:"row"},gap:1.5,alignItems:{xs:"stretch",md:"center"},children:[(0,s.jsxs)(r.A,{value:er,onChange:(e,l)=>eo(l),sx:{minHeight:40},children:[(0,s.jsx)(o.A,{label:"All",value:0}),(0,s.jsx)(o.A,{label:"Default",value:1}),(0,s.jsx)(o.A,{label:"Organisation",value:2})]}),(0,s.jsx)(d.A,{size:"small",placeholder:"Search skills",value:ed,onChange:e=>ec(e.target.value),sx:{width:{xs:"100%",md:320}}})]}),(0,s.jsx)(c.A,{sx:N.I2,children:(0,s.jsx)(k.C,{rows:eA,columns:eC,loading:ea,...N.Gn,initialState:N.x3,disableRowSelectionOnClick:!0,sx:{...W.b,...N.dS,"& .MuiDataGrid-row":{cursor:"pointer"}},getRowId:e=>e.skill_id,getDetailPanelContent:e=>(0,s.jsx)(c.A,{sx:{px:{xs:2,sm:8},py:2.5,backgroundColor:"background.paper",borderBottom:"1px solid",borderColor:"divider"},children:(0,s.jsxs)(n.A,{spacing:2.25,sx:{maxWidth:920},children:[(0,s.jsx)(u.A,{variant:"body1",sx:{color:e.row.description?"text.primary":"text.disabled",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:e.row.description||"No description yet."}),(0,s.jsx)(c.A,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",lg:"repeat(3, minmax(0, 1fr))"},gap:1.5},children:[{label:"When to use",value:e.row.when_to_use},{label:"Source",value:P(e.row)},{label:"Last updated",value:L(e.row.created_at,e.row.updated_at)}].filter(e=>e.value).map(e=>(0,s.jsxs)(c.A,{sx:{minWidth:0},children:[(0,s.jsx)(u.A,{variant:"caption",sx:{display:"block",color:"text.secondary",fontWeight:700},children:e.label}),(0,s.jsx)(u.A,{variant:"body2",sx:{color:"text.primary",wordBreak:"break-word"},children:e.value})]},e.label))})]})}),getDetailPanelHeight:N.S3,onRowClick:(e,l)=>{(0,N.D9)(l)||ew(e.row)},slots:{...N.MT,footer:()=>(0,s.jsx)(A.J,{children:(0,s.jsx)(f.h,{})})}})}),(0,s.jsxs)(h.A,{open:eu&&(!ex||U===G),onClose:()=>!eg&&eh(!1),maxWidth:"md",fullWidth:!0,children:[(0,s.jsx)(x.A,{children:eS?"Skill":ex?"Edit Skill":"Add Skill"}),(0,s.jsx)(p.A,{children:(0,s.jsxs)(n.A,{gap:2,sx:{pt:1},children:[(0,s.jsx)(d.A,{label:"Name",size:"small",value:em.name,onChange:e=>ey("name",e.target.value),disabled:eS,fullWidth:!0}),(0,s.jsx)(d.A,{label:"Description",size:"small",value:em.description,onChange:e=>ey("description",e.target.value),disabled:eS,multiline:!0,minRows:2,fullWidth:!0}),(0,s.jsx)(d.A,{label:"When to use",size:"small",value:em.when_to_use,onCh
1ange:e=>ey("when_to_use",e.target.value),disabled:eS,multiline:!0,minRows:2,fullWidth:!0}),(0,s.jsx)(d.A,{label:"Method",size:"small",value:em.body,onChange:e=>ey("body",e.target.value),disabled:eS,multiline:!0,minRows:8,fullWidth:!0}),B&&ex&&(0,s.jsx)(I,{instructions:null!=(e=ek.get(ex.skill_id))?e:[],loading:Y,error:$,onRefresh:()=>ei(e=>e+1)}),(0,s.jsxs)(c.A,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"1fr 1fr"},gap:2},children:[(0,s.jsx)(d.A,{label:"Source title",size:"small",value:null!=(l=em.source_title)?l:"",onChange:e=>ey("source_title",e.target.value),disabled:eS,fullWidth:!0}),(0,s.jsx)(d.A,{label:"Source URL",size:"small",value:null!=(i=em.source_url)?i:"",onChange:e=>ey("source_url",e.target.value),disabled:eS,fullWidth:!0,InputProps:{endAdornment:em.source_url?(0,s.jsx)(a.A,{variant:"text",size:"small",endIcon:(0,s.jsx)(j.A,{fontSize:"small"}),onClick:()=>{var e;return window.open(null!=(e=em.source_url)?e:"","_blank")},children:"Open"}):null}})]}),!eS&&(0,s.jsx)(m.A,{control:(0,s.jsx)(b.A,{checked:!!em.is_published,onChange:e=>ey("is_published",e.target.checked)}),label:"Published"}),(0,s.jsxs)(c.A,{children:[(0,s.jsx)(u.A,{variant:"body2",sx:{fontWeight:700,mb:1},children:"Allowed tools"}),(0,s.jsx)(g.A,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr",md:"1fr 1fr 1fr"},maxHeight:220,overflow:"auto",border:"1px solid",borderColor:"divider",borderRadius:1,p:1},children:es.map(e=>(0,s.jsx)(m.A,{control:(0,s.jsx)(b.A,{checked:em.allowed_tools.includes(e),onChange:()=>{eb(l=>({...l,allowed_tools:l.allowed_tools.includes(e)?l.allowed_tools.filter(l=>l!==e):[...l.allowed_tools,e]}))},disabled:eS}),label:(0,s.jsx)(u.A,{variant:"body2",children:e})},e))})]})]})}),(0,s.jsxs)(v.A,{children:[ex&&!ex.is_builtin&&(0,s.jsx)(a.A,{variant:"secondary",color:"error",startIcon:(0,s.jsx)(_.A,{}),onClick:()=>ej(!0),disabled:eg,children:"Delete"}),(0,s.jsx)(c.A,{sx:{flex:1}}),(0,s.jsx)(a.A,{variant:"secondary",onClick:()=>eh(!1),disabled:eg,children:eS?"Close":"Cancel"}),!eS&&(0,s.jsx)(a.A,{variant:"primary",onClick:()=>{if(!em.name.trim())return void H({title:"Skill name is required",status:"warning"});ev(!0),R(ex&&!ex.is_builtin?"/api/backend/skills/".concat(ex.skill_id):"/api/backend/skills/",{method:ex&&!ex.is_builtin?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(em)}).then(e=>{J(l=>l.some(l=>l.skill_id===e.skill_id)?l.map(l=>l.skill_id===e.skill_id?e:l):[...l,e]),eh(!1),H({title:ex?"Skill updated":"Skill added",status:"success"})}).catch(e=>H({title:"Failed to save skill: ".concat(e.message),status:"error"})).finally(()=>ev(!1))},disabled:eg,children:eg?"Saving...":"Save"})]})]}),(0,s.jsxs)(h.A,{open:e_,onClose:()=>!eg&&ej(!1),maxWidth:"xs",fullWidth:!0,children:[(0,s.jsx)(x.A,{children:"Delete skill"}),(0,s.jsx)(p.A,{children:(0,s.jsxs)(u.A,{children:["Delete ",(0,s.jsx)("strong",{children:null==ex?void 0:ex.name})," from the organisation library?"]})}),(0,s.jsxs)(v.A,{children:[(0,s.jsx)(a.A,{variant:"secondary",onClick:()=>ej(!1),disabled:eg,children:"Cancel"}),(0,s.jsx)(a.A,{variant:"primary",onClick:()=>{ex&&!ex.is_builtin&&(ev(!0),R("/api/backend/skills/".concat(ex.skill_id),{method:"DELETE"}).then(()=>{J(e=>e.filter(e=>e.skill_id!==ex.skill_id)),ej(!1),eh(!1),H({title:"Skill deleted",status:"success"})}).catch(e=>H({title:"Failed to delete skill: ".concat(e.message),status:"error"})).finally(()=>ev(!1)))},disabled:eg,children:"Delete"})]})]})]})}}}]);

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.