@ycodium-ai/plugin-tool-display 0.2.6182 → 0.2.6253
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/ui.js +16 -16
- package/dist/index.js +1 -1
- package/dist/models.js +11 -5
- package/package.json +2 -2
package/assets/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties, theme, base, components, utilities;
|
|
3
3
|
@layer properties;
|
|
4
4
|
@layer utilities {
|
|
@@ -365,22 +365,22 @@ var K=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
`;var
|
|
368
|
+
`;var Ce=window.__ycodiumPluginHost.react;var{Activity:ea,Children:aa,Component:he,Fragment:Se,Profiler:ta,PureComponent:oa,StrictMode:ra,Suspense:la,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:ua,__COMPILER_RUNTIME:da,act:sa,cache:fa,cacheSignal:ia,captureOwnerStack:na,cloneElement:ca,createContext:q,createElement:S,createRef:pa,forwardRef:U,isValidElement:ma,lazy:La,memo:we,startTransition:xa,unstable_useCacheRefresh:Ia,use:ye,useActionState:ga,useCallback:Z,useContext:Q,useDebugValue:Ca,useDeferredValue:ha,useEffect:ke,useEffectEvent:Sa,useId:wa,useImperativeHandle:ya,useInsertionEffect:N,useLayoutEffect:ka,useMemo:Pe,useOptimistic:Pa,useReducer:Ta,useRef:Te,useState:O,useSyncExternalStore:be,useTransition:ba,version:Aa}=Ce;var J=q(null),j=J.Provider;function k(){let e=Q(J);if(e===null)throw new Error("Tool display UI has not been registered.");return e}function Ae(e){return`__ycodium${e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}Scope`}function De(e){let a=globalThis,t=Ae(e),o=(a[t]??0)+1;return a[t]=o,`ycodium-${e}-ui-${o}`}function G(e,a){let t=De(a),o=e.replaceAll(`.ycodium-${a}-ui`,`.${t}`),l=0,u=null;return{scopeClass:t,retain(){if(typeof document>"u")return()=>{};l===0&&(u=document.createElement("style"),u.setAttribute("data-ycodium-plugin-css",a),u.textContent=o,document.head.appendChild(u)),l+=1;let s=!1;return()=>{s||(s=!0,l=Math.max(0,l-1),l===0&&u!==null&&(u.remove(),u=null))}}}}var{jsx:r,jsxs:p,Fragment:W}=window.__ycodiumPluginHost.jsxRuntime;var Wa=q(null);var H=(...e)=>e.filter((a,t,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===t).join(" ").trim();var Y=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var ee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,t,o)=>o?o.toUpperCase():t.toLowerCase());var V=e=>{let a=ee(e);return a.charAt(0).toUpperCase()+a.slice(1)};var ae={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var te=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};var oe=U(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:s,...d},f)=>S("svg",{ref:f,...ae,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:H("lucide",l),...!u&&!te(d)&&{"aria-hidden":"true"},...d},[...s.map(([c,m])=>S(c,m)),...Array.isArray(u)?u:[u]]));var C=(e,a)=>{let t=U(({className:o,...l},u)=>S(oe,{ref:u,iconNode:a,className:H(`lucide-${Y(V(e))}`,`lucide-${e}`,o),...l}));return t.displayName=V(e),t};var Be=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],A=C("check",Be);var ve=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],D=C("copy",ve);var Fe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],B=C("globe",Fe);var Me=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],v=C("search",Me);var Re=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],w=C("square-terminal",Re);var z="[a-zA-Z][a-zA-Z0-9:_-]*";var qe="ycodium",qt=`${qe}:`,Ut=new RegExp(String.raw`(^|\s)([$/])(${z})(?=\s|$)`,"g");var Ot=new RegExp(String.raw`([$/])(${z})(?=\s|$)`,"y");var Ht=new RegExp(String.raw`^/(${z})$`);function Ue(e){let a=e.match(/:(\d+)$/);if(!a?.[1])return{path:e,line:void 0,column:void 0};let t=e.slice(0,-a[0].length),o=t.match(/:(\d+)$/);return o?.[1]?{path:t.slice(0,-o[0].length),line:o[1],column:a[1]}:{path:t,line:a[1],column:void 0}}function X(e){return e.replaceAll("\\","/")}function K(e){return/^\/[A-Za-z]:\//.test(e)?e.slice(1):e}function Oe(e){return K(X(e.replace(/[\\/]+$/,"")))}function He(e){return e.slice(e.lastIndexOf("/")+1)}function Ee(e){return e.startsWith("/")||/^[A-Za-z]:\//.test(e)}function Ne(e){return e.startsWith("\\\\")||/^[A-Za-z]:([/\\]|$)/.test(K(X(e)))}function P(e,a){let{path:t,line:o,column:l}=Ue(e),u=K(X(t)),s=u;if(a){let d=Oe(a),f=He(d),c=Ne(a)?I=>I.toLowerCase():I=>I,m=c(u),L=c(d);if(m===L)s=f;else if(m.startsWith(`${L}/`))s=`${f}/${u.slice(d.length+1)}`;else if(!Ee(u)){let I=u.replace(/^\.\/+/,"").replace(/^\/+/,"");s=m.startsWith(`${c(f)}/`)?u:`${f}/${I}`}}return o?`${s}:${o}${l?`:${l}`:""}`:s}function h(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function F(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Ge({entry:e,details:a}){let t=a.input?.text??e.toolIo?.input;if(!t)return null;let o=F(t);return h(o)}function _(e){let a=h(e.entry.toolData),t=e.entry.toolLabel?.name??a?.tool??e.entry.toolTitle??e.entry.label;return typeof t=="string"?t.toLowerCase().replace(/[ _-]/g,""):""}function le(e){return e.entry.toolLifecycleStatus==="completed"&&!e.entry.displayFailed&&(e.details.exitCode===void 0||e.details.exitCode===0)}function We(e,a){let t=e.entry.toolLabel?.path??a?.file_path??a?.Path??a?.filePath??a?.target_file??a?.path;return typeof t=="string"&&t.trim()?P(t,e.workspaceRoot):null}function Ve(e){let{entry:a,details:t}=e;if(a.requestKind!=="command"&&a.itemType!=="command_execution")return null;let o=t.input?.text;return!o||t.raw?null:{kind:"terminal",command:o,output:t.output?.text??"",copyText:[o,t.output?.text].filter(l=>l!==void 0).join(`
|
|
369
369
|
|
|
370
|
-
`)}}function
|
|
371
|
-
`)?
|
|
372
|
-
`)){let
|
|
373
|
-
`)}}function
|
|
374
|
-
`);for(let[
|
|
370
|
+
`)}}function ze(e){let{entry:a,details:t}=e,o=_(e),l=a.toolTitle?.toLowerCase().replace(/[ _-]/g,"");if(a.requestKind!=="file-read"&&l!=="readfile"&&o!=="read"&&o!=="readfile"&&o!=="viewfile"||a.displayFailed||t.raw||t.exitCode!==void 0&&t.exitCode!==0)return null;let u=We(e,Ge(e)),s=t.output?.text;if(!u||!s)return null;let d=[];for(let f of(s.endsWith(`
|
|
371
|
+
`)?s.slice(0,-1):s).split(`
|
|
372
|
+
`)){let c=/^\s*(\d+)→(.*)$/u.exec(f);if(!c)return null;let m=Number(c[1]);if(!Number.isSafeInteger(m)||m<1)return null;let L=d.at(-1);if(L&&m<=L.number)return null;d.push({number:m,text:c[2]})}return{kind:"read",path:u,lines:d,copyText:d.map(f=>f.text).join(`
|
|
373
|
+
`)}}function Xe(e){let{entry:a,details:t}=e;if(a.requestKind!=="file-change"&&a.itemType!=="file_change"||a.toolLifecycleStatus!=="completed"||a.displayFailed||t.exitCode!==void 0&&t.exitCode!==0)return null;let o=a.toolData;if(typeof o!="object"||o===null||Array.isArray(o))return null;let l=o.changes;if(!Array.isArray(l)||l.length===0)return null;let u=[];for(let[s,d]of l.entries()){if(typeof d!="object"||d===null||Array.isArray(d))return null;let{path:f,diff:c}=d;if(typeof f!="string"||!f.trim()||typeof c!="string"||!c)return null;let m=[],L=c.split(`
|
|
374
|
+
`);for(let[I,i]of L.entries()){let n=i.startsWith("+++")||i.startsWith("---")?"context":i.startsWith("+")?"added":i.startsWith("-")?"removed":"context",x=m.at(-1);x?.kind===n?x.lines.push(i):m.push({line:I,kind:n,lines:[i]})}u.push({key:`${f}:${s}`,path:P(f,e.workspaceRoot),patch:c,parts:m})}return{kind:"change",files:u,copyText:u.map(s=>`${s.path}
|
|
375
375
|
${s.patch}`).join(`
|
|
376
376
|
|
|
377
|
-
`)}}function
|
|
378
|
-
`);return!Array.isArray(
|
|
379
|
-
`)){let
|
|
377
|
+
`)}}function Ke(e){if(!le(e))return null;let a=_(e),t=a==="glob"||a==="findbyname"||a==="filesearch";if(!(a==="grep"||a==="grepsearch"||a==="ripgrep")&&!t)return null;let l=e.details.output?.text;if(!l)return null;let u=h(F(e.details.input?.text??e.entry.toolIo?.input)),s=F(l),d=h(s),f=l.trimStart().startsWith("{")||l.trimStart().startsWith("[");if(d?.isError===!0||typeof d?.error=="string")return null;let c=typeof u?.pattern=="string"?u.pattern:typeof u?.Pattern=="string"?u.Pattern:typeof u?.Query=="string"?u.Query:e.entry.toolLabel?.detail??e.entry.label;if(t){let i=d!==null||Array.isArray(s);if(!i&&f)return null;let n=d?d.filenames??d.paths:Array.isArray(s)?s:l.trim().split(`
|
|
378
|
+
`);return!Array.isArray(n)||!n.every(x=>typeof x=="string"&&x.length>0)||!i&&!n.every(x=>/[/\\]|\.[a-z0-9]{1,12}$/i.test(x))?null:{kind:"search",resultKind:"paths",pattern:c,paths:n.map(x=>P(x,e.workspaceRoot)),copyText:l}}let m=typeof d?.content=="string"?d.content:l;if(d&&!Array.isArray(d.files)&&typeof d.content!="string"||!d&&f)return null;let L=new Map,I=(i,n,x)=>{let g=L.get(i)??[];g.push({line:n,text:x,key:`${n}:${g.length}`}),L.set(i,g)};if(Array.isArray(d?.files))for(let i of d.files){let n=h(i);if(typeof n?.path!="string"||!n.path||!Array.isArray(n.matches))return null;for(let x of n.matches){let g=h(x);if(typeof g?.lineNumber!="number"||!Number.isSafeInteger(g.lineNumber)||g.lineNumber<1||typeof g?.line!="string")return null;I(n.path,g.lineNumber,g.line)}}else for(let i of m.trimEnd().split(`
|
|
379
|
+
`)){let n=/^(.+?):([1-9]\d*):(.*)$/u.exec(i);if(!n||!Number.isSafeInteger(Number(n[2])))return null;I(n[1],Number(n[2]),n[3])}return{kind:"search",resultKind:"matches",pattern:c,files:[...L].map(([i,n])=>({key:i,path:P(i,e.workspaceRoot),matches:n})),copyText:l}}function re(e){if(typeof e!="string")return null;try{let a=new URL(e);return(a.protocol==="http:"||a.protocol==="https:")&&!a.username&&!a.password?a.href:null}catch{return null}}function _e(e){if(!le(e))return null;let a=_(e);if(e.entry.itemType!=="web_search"&&a!=="websearch"&&a!=="webfetch"||a==="grep"||a==="glob")return null;let t=e.details.output?.text,o=F(t);if(!t)return null;let l=h(o);if(l?.isError===!0||typeof l?.error=="string")return null;let u=l?.sources??l?.results??(Array.isArray(o)?o:void 0),s=h(F(e.details.input?.text??e.entry.toolIo?.input)),d=typeof s?.query=="string"?s.query:e.entry.toolLabel?.detail??e.entry.label;if(Array.isArray(u)){let L=[];for(let I of u){let i=h(I),n=re(i?.url);if(!n||i?.title!==void 0&&typeof i.title!="string"||i?.snippet!==void 0&&typeof i.snippet!="string")return null;L.push({key:`${n}:${L.length}`,url:n,title:typeof i?.title=="string"?i.title:n,...typeof i?.snippet=="string"?{snippet:i.snippet}:{}})}return l?.answer!==void 0&&typeof l.answer!="string"?null:{kind:"web",query:d,sources:L,copyText:t,...typeof l?.answer=="string"?{answer:l.answer}:{}}}let f=re(l?.url),c=l?.statusCode;if(!f||typeof c!="number"||!Number.isInteger(c)||c<100||c>599)return null;let m=typeof l?.title=="string"?l.title:f;return{kind:"web",query:m,sources:[{key:f,url:f,title:m}],copyText:t,statusCode:c,...typeof l?.text=="string"?{answer:l.text}:{}}}var $e=[Ve,ze,Xe,Ke,_e];function ue(e){for(let a of $e){let t=a(e);if(t)return t}return null}function de(e){return[e.input,e.output,e.raw].filter(a=>a!==void 0).map(a=>a.text).join(`
|
|
380
380
|
|
|
381
|
-
`)}function
|
|
382
|
-
`)});let t=16;return
|
|
383
|
-
`})]},
|
|
384
|
-
`})]},a.number))})});
|
|
385
|
-
`)},t.line))]},a.key))})});
|
|
386
|
-
`)})}):null]})}function
|
|
381
|
+
`)}function M(...e){return e.filter(a=>typeof a=="string"&&a.length>0).join(" ")}function T(e){return(a=>S(k().ui[e],{...a,className:`ycodium-tool-display-ui ${typeof a.className=="string"?a.className:""}`}))}var E=T("Button"),se=T("Tooltip"),fe=T("TooltipPopup"),ie=T("TooltipTrigger"),ne=T("Markdown"),ce=T("DetailViewport");function y(){return{t:k().i18n.usePluginTranslation()}}function pe({text:e}){let{t:a}=y(),t=k(),[o,l]=O(null),[u,s]=O(!1),d=o===e;return p("span",{className:"inline-flex items-center gap-1",children:[r(E,{type:"button",variant:"ghost-muted",size:"icon-xs","aria-label":a(d?"copied":"copy"),onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&f.stopPropagation()},onClick:()=>{Promise.resolve(t.writeClipboard(e)).then(()=>{l(e),s(!1)},()=>{s(!0),t.notify(a("copyFailed"),"error")})},children:d?r(A,{"aria-hidden":!0,className:"size-icon-1"}):r(D,{"aria-hidden":!0,className:"size-icon-1"})}),u?r("span",{role:"status",className:"tool-meta text-destructive-foreground",children:a("copyFailed")}):null]})}var me=new Map;function b(e){me.set(e.kind,e)}function Le(e){return me.get(e.kind)}function R({text:e}){return p(se,{children:[r(ie,{render:r("code",{className:"min-w-0 truncate text-foreground"}),children:e}),r(fe,{className:"max-w-lg whitespace-pre-wrap break-words",children:e})]})}function Ze({model:e}){let{t:a}=y();if(e.resultKind==="paths")return e.paths.length===0?r("p",{className:"px-2 pb-2 text-muted-foreground",children:a("noSearchResults")}):r("pre",{className:"tool-body whitespace-pre-wrap break-words px-2 pb-2 text-foreground",children:e.paths.slice(0,16).join(`
|
|
382
|
+
`)});let t=16;return r("div",{className:"tool-body px-2 pb-2",children:e.files.length===0?r("p",{className:"text-muted-foreground",children:a("noSearchResults")}):e.files.map(o=>{let l=o.matches.slice(0,t);return t-=l.length,l.length===0?null:p("div",{"data-search-file":o.path,className:"mb-2 last:mb-0",children:[r("p",{className:"break-all font-medium text-foreground",children:o.path}),l.map(u=>p("div",{"data-search-line":u.line,className:"grid grid-cols-[3.5em_minmax(0,1fr)]",children:[r("span",{"aria-hidden":!0,className:"pe-3 text-end text-muted-foreground tabular-nums select-none",children:u.line}),r("span",{className:"whitespace-pre-wrap break-words text-foreground [overflow-wrap:anywhere]",children:u.text||`
|
|
383
|
+
`})]},u.key))]},o.key)})})}function Qe({model:e,context:a}){let{t}=y();return p("div",{className:"space-y-2 px-2 pb-2 text-foreground",children:[e.statusCode!==void 0?r("p",{className:M("tool-meta",e.statusCode>=400&&"text-destructive-foreground"),children:t("httpStatus",{status:e.statusCode})}):null,e.answer?r("p",{className:"tool-process-text line-clamp-3 whitespace-pre-wrap",children:e.answer}):null,e.sources.length===0?r("p",{className:"tool-process-text text-muted-foreground",children:t("noWebSources")}):e.sources.slice(0,8).map(o=>p("div",{"data-web-source":o.url,className:"space-y-0.5",children:[o.title!==e.query?r("p",{className:"tool-process-text font-medium",children:o.title}):null,r(ne,{text:`<${o.url}>`,className:"tool-meta [&_p]:my-0",...a.threadRef===void 0?{}:{threadRef:a.threadRef},...a.workspaceRoot===void 0?{}:{cwd:a.workspaceRoot}}),o.snippet?r("p",{className:"tool-meta line-clamp-3 whitespace-pre-wrap text-muted-foreground",children:o.snippet}):null]},o.key))]})}b({kind:"terminal",heading:e=>p("span",{className:"flex min-w-0 items-center gap-2 text-foreground",children:[r(w,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),r(R,{text:e.command})]}),body:e=>r("pre",{className:"tool-body cursor-text whitespace-pre-wrap break-words px-2 pb-2 text-foreground select-text [overflow-wrap:anywhere]",children:e.output})});b({kind:"read",hiddenLines:e=>Math.max(0,e.lines.length-16),heading:e=>r(R,{text:e.path}),body:e=>r("div",{className:"tool-body cursor-text pb-2 text-foreground select-text",children:(e.lines.length>16?[...e.lines.slice(0,8),null,...e.lines.slice(-8)]:e.lines).map(a=>a===null?r("div",{"aria-hidden":!0,className:"ps-[3.5em] text-muted-foreground",children:"\u2026"},"gap"):p("div",{"data-source-line":a.number,className:"grid grid-cols-[3.5em_minmax(0,1fr)]",children:[r("span",{"aria-hidden":!0,className:"pe-3 text-end text-muted-foreground select-none tabular-nums",children:a.number}),r("span",{className:"whitespace-pre-wrap break-words pe-2 [overflow-wrap:anywhere]",children:a.text||`
|
|
384
|
+
`})]},a.number))})});b({kind:"change",heading:e=>r(R,{text:e.files.map(a=>a.path).join(", ")}),body:e=>r("div",{className:"tool-body cursor-text pb-2 select-text",children:e.files.map(a=>p("div",{children:[e.files.length>1?r("p",{className:"px-2 py-1 text-foreground",children:a.path}):null,a.parts.length>64?r("pre",{className:"whitespace-pre-wrap break-words px-2 text-foreground [overflow-wrap:anywhere]",children:a.patch}):a.parts.map(t=>r("pre",{"data-change-line":t.kind,className:M("whitespace-pre-wrap break-words px-2 [overflow-wrap:anywhere]",t.kind==="removed"?"bg-destructive/5 text-destructive-foreground":t.kind==="added"?"bg-success/5 text-success-foreground":"text-muted-foreground"),children:t.lines.join(`
|
|
385
|
+
`)},t.line))]},a.key))})});b({kind:"search",hasMoreResults:e=>e.resultKind==="paths"?e.paths.length>16:e.files.reduce((a,t)=>a+t.matches.length,0)>16,heading:e=>p("span",{className:"flex min-w-0 items-center gap-2",children:[r(v,{"aria-hidden":!0,className:"size-4 shrink-0"}),r(R,{text:e.pattern})]}),body:e=>r(Ze,{model:e})});b({kind:"web",hasMoreResults:e=>e.sources.length>8,heading:e=>p("span",{className:"flex min-w-0 items-center gap-2",children:[r(B,{"aria-hidden":!0,className:"size-4 shrink-0"}),r(R,{text:e.query})]}),body:(e,a)=>r(Qe,{model:e,context:a})});function Je({text:e}){return r("pre",{className:"tool-body cursor-text whitespace-pre-wrap break-words px-2 pb-2 text-foreground select-text [overflow-wrap:anywhere]",children:e})}function xe({retain:e}){return N(()=>e(),[e]),null}function Ie(e){let{t:a}=y(),t=ue(e),o=t?Le(t):void 0,l=t&&o?.hiddenLines?o.hiddenLines(t):0,u=t&&o?.hasMoreResults?o.hasMoreResults(t):!1,s=[e.details.input,e.details.output,e.details.raw].filter(c=>c!==void 0),d=t?.copyText??de(e.details);if(!d&&!t)return null;let f=e.details.files.length>0&&t?.kind!=="change"&&t?.kind!=="search";return p("div",{className:M("ycodium-tool-display-ui",e.scopeClass,"min-w-0 rounded-md bg-background/60"),"data-tool-overview":!0,"data-tool-overview-kind":t?.kind??"generic",children:[p("div",{className:"tool-meta flex min-h-8 items-center gap-2 px-2 text-muted-foreground",children:[r("span",{className:"min-w-0 flex-1",children:t&&o?o.heading(t):null}),e.summary?r("span",{children:a("summary")}):null,s.some(c=>c.truncated)?r("span",{children:a("truncated")}):null,r(pe,{text:d})]}),r(ce,{threadKey:e.threadKey??"unscoped",stateKey:`${e.stateKey??e.entry.id}:overview`,maxHeight:"8lh",className:"tool-body",followTail:e.followOutputTail===!0,...e.onDisclosureChange===void 0?{}:{onDisclosureChange:e.onDisclosureChange},children:t&&o?o.body(t,e):r(Je,{text:d})}),l||u?r(E,{size:"xs",variant:"ghost-muted",className:"m-1",disabled:e.onShowOutput===void 0,onClick:e.onShowOutput,children:l?a("showMoreLines",{count:l}):a("showAllResults")}):null,f?r("div",{className:"min-w-0 px-2 pb-2",children:r("pre",{className:"tool-body whitespace-pre-wrap break-words text-foreground select-text",children:e.details.files.join(`
|
|
386
|
+
`)})}):null]})}function je(e){if(["Button","Tooltip","TooltipTrigger","TooltipPopup","Markdown","DetailViewport"].some(l=>e.ui[l]===void 0)){let l=function(){let u=e.i18n.usePluginTranslation();return r("p",{role:"status",className:"p-3 text-sm text-muted-foreground",children:u("hostUpgradeRequired")})};var o=l;return{pages:{},panels:{},views:{toolCall:l}}}let t=G($,"tool-display");return{pages:{},panels:{},views:{toolCall:function(u){return p(j,{value:e,children:[r(xe,{retain:t.retain}),r(Ie,{...u,scopeClass:t.scopeClass})]})}}}}export{je as default};
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
3
3
|
|
|
4
4
|
// ../../packages/plugin-api/src/version.ts
|
|
5
|
-
var PLUGIN_API_VERSION =
|
|
5
|
+
var PLUGIN_API_VERSION = 202;
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
import { TOOL_DISPLAY_PLUGIN_ID } from "@ycodium-ai/plugin-api/tool-display";
|
package/dist/models.js
CHANGED
|
@@ -83,7 +83,7 @@ function completed(context) {
|
|
|
83
83
|
return context.entry.toolLifecycleStatus === "completed" && !context.entry.displayFailed && (context.details.exitCode === void 0 || context.details.exitCode === 0);
|
|
84
84
|
}
|
|
85
85
|
function reportedPath(context, input) {
|
|
86
|
-
const value = context.entry.toolLabel?.path ?? input?.file_path;
|
|
86
|
+
const value = context.entry.toolLabel?.path ?? input?.file_path ?? input?.Path ?? input?.filePath ?? input?.target_file ?? input?.path;
|
|
87
87
|
return typeof value === "string" && value.trim() ? formatWorkspaceRelativePath(value, context.workspaceRoot) : null;
|
|
88
88
|
}
|
|
89
89
|
function commandOverviewModel(context) {
|
|
@@ -100,7 +100,11 @@ function commandOverviewModel(context) {
|
|
|
100
100
|
}
|
|
101
101
|
function readOverviewModel(context) {
|
|
102
102
|
const { entry, details } = context;
|
|
103
|
-
|
|
103
|
+
const tool = toolName(context);
|
|
104
|
+
const titleId = entry.toolTitle?.toLowerCase().replace(/[ _-]/g, "");
|
|
105
|
+
if (entry.requestKind !== "file-read" && titleId !== "readfile" && tool !== "read" && tool !== "readfile" && tool !== "viewfile") {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
104
108
|
if (entry.displayFailed || details.raw || details.exitCode !== void 0 && details.exitCode !== 0) {
|
|
105
109
|
return null;
|
|
106
110
|
}
|
|
@@ -158,7 +162,9 @@ ${file.patch}`).join("\n\n")
|
|
|
158
162
|
function searchOverviewModel(context) {
|
|
159
163
|
if (!completed(context)) return null;
|
|
160
164
|
const tool = toolName(context);
|
|
161
|
-
|
|
165
|
+
const isGlobLike = tool === "glob" || tool === "findbyname" || tool === "filesearch";
|
|
166
|
+
const isGrepLike = tool === "grep" || tool === "grepsearch" || tool === "ripgrep";
|
|
167
|
+
if (!isGrepLike && !isGlobLike) return null;
|
|
162
168
|
const output = context.details.output?.text;
|
|
163
169
|
if (!output) return null;
|
|
164
170
|
const input = record(parseJson(context.details.input?.text ?? context.entry.toolIo?.input));
|
|
@@ -166,8 +172,8 @@ function searchOverviewModel(context) {
|
|
|
166
172
|
const result = record(decoded);
|
|
167
173
|
const jsonShape = output.trimStart().startsWith("{") || output.trimStart().startsWith("[");
|
|
168
174
|
if (result?.isError === true || typeof result?.error === "string") return null;
|
|
169
|
-
const pattern = typeof input?.pattern === "string" ? input.pattern : context.entry.toolLabel?.detail ?? context.entry.label;
|
|
170
|
-
if (
|
|
175
|
+
const pattern = typeof input?.pattern === "string" ? input.pattern : typeof input?.Pattern === "string" ? input.Pattern : typeof input?.Query === "string" ? input.Query : context.entry.toolLabel?.detail ?? context.entry.label;
|
|
176
|
+
if (isGlobLike) {
|
|
171
177
|
const structured = result !== null || Array.isArray(decoded);
|
|
172
178
|
if (!structured && jsonShape) return null;
|
|
173
179
|
const paths = result ? result.filenames ?? result.paths : Array.isArray(decoded) ? decoded : output.trim().split("\n");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/plugin-tool-display",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6253",
|
|
4
4
|
"description": "Renders command, read, change, search, and web tool calls from recorded facts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"tailwindcss": "^4.0.0",
|
|
36
36
|
"typescript": "~6.0.3",
|
|
37
37
|
"vite-plus": "0.2.2",
|
|
38
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
38
|
+
"@ycodium-ai/plugin-api": "0.2.6253",
|
|
39
39
|
"ycodium-plugin-testing": "0.0.0"
|
|
40
40
|
},
|
|
41
41
|
"ycodium": {
|