@ycodium-ai/plugin-tool-display 0.2.4194 → 0.2.4250

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 CHANGED
@@ -222,7 +222,7 @@ ${f.patch}`).join(`
222
222
  `);return!Array.isArray(r)||!r.every(c=>typeof c=="string"&&c.length>0)||!p&&!r.every(c=>/[/\\]|\.[a-z0-9]{1,12}$/i.test(c))?null:{kind:"search",resultKind:"paths",pattern:i,paths:r.map(c=>P(c,e.workspaceRoot)),copyText:t}}let s=typeof u?.content=="string"?u.content:t;if(u&&!Array.isArray(u.files)&&typeof u.content!="string"||!u&&f)return null;let n=new Map,I=(p,r,c)=>{let m=n.get(p)??[];m.push({line:r,text:c,key:`${r}:${m.length}`}),n.set(p,m)};if(Array.isArray(u?.files))for(let p of u.files){let r=C(p);if(typeof r?.path!="string"||!r.path||!Array.isArray(r.matches))return null;for(let c of r.matches){let m=C(c);if(typeof m?.lineNumber!="number"||!Number.isSafeInteger(m.lineNumber)||m.lineNumber<1||typeof m?.line!="string")return null;I(r.path,m.lineNumber,m.line)}}else for(let p of s.trimEnd().split(`
223
223
  `)){let r=/^(.+?):([1-9]\d*):(.*)$/u.exec(p);if(!r||!Number.isSafeInteger(Number(r[2])))return null;I(r[1],Number(r[2]),r[3])}return{kind:"search",resultKind:"matches",pattern:i,files:[...n].map(([p,r])=>({key:p,path:P(p,e.workspaceRoot),matches:r})),copyText:t}}function _(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 Te(e){if(!J(e))return null;let a=Q(e);if(e.entry.itemType!=="web_search"&&a!=="websearch"&&a!=="webfetch"||a==="grep"||a==="glob")return null;let t=e.details.output?.text,o=A(t);if(!t)return null;let l=C(o);if(l?.isError===!0||typeof l?.error=="string")return null;let u=l?.sources??l?.results??(Array.isArray(o)?o:void 0),f=C(A(e.details.input?.text??e.entry.toolIo?.input)),i=typeof f?.query=="string"?f.query:e.entry.toolLabel?.detail??e.entry.label;if(Array.isArray(u)){let p=[];for(let r of u){let c=C(r),m=_(c?.url);if(!m||c?.title!==void 0&&typeof c.title!="string"||c?.snippet!==void 0&&typeof c.snippet!="string")return null;p.push({key:`${m}:${p.length}`,url:m,title:typeof c?.title=="string"?c.title:m,...typeof c?.snippet=="string"?{snippet:c.snippet}:{}})}return l?.answer!==void 0&&typeof l.answer!="string"?null:{kind:"web",query:i,sources:p,copyText:t,...typeof l?.answer=="string"?{answer:l.answer}:{}}}let s=_(l?.url),n=l?.statusCode;if(!s||typeof n!="number"||!Number.isInteger(n)||n<100||n>599)return null;let I=typeof l?.title=="string"?l.title:s;return{kind:"web",query:I,sources:[{key:s,url:s,title:I}],copyText:t,statusCode:n,...typeof l?.text=="string"?{answer:l.text}:{}}}var Fe=[Pe,Ae,De,Be,Te];function $(e){for(let a of Fe){let t=a(e);if(t)return t}return null}function j(e){return[e.input,e.output,e.raw].filter(a=>a!==void 0).map(a=>a.text).join(`
224
224
 
225
- `)}function D(...e){return e.filter(a=>typeof a=="string"&&a.length>0).join(" ")}var v=(...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 G=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=R(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:f,...i},s)=>g("svg",{ref:s,...ae,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:v("lucide",l),...!u&&!te(i)&&{"aria-hidden":"true"},...i},[...f.map(([n,I])=>g(n,I)),...Array.isArray(u)?u:[u]]));var x=(e,a)=>{let t=R(({className:o,...l},u)=>g(oe,{ref:u,iconNode:a,className:v(`lucide-${Y(G(e))}`,`lucide-${e}`,o),...l}));return t.displayName=G(e),t};var Me=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],B=x("check",Me);var be=[["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"}]],T=x("copy",be);var Re=[["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"}]],F=x("globe",Re);var ve=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],M=x("search",ve);var qe=[["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"}]],h=x("square-terminal",qe);function k(e){return(a=>g(w().ui[e],{...a,className:`ycodium-tool-display-ui ${typeof a.className=="string"?a.className:""}`}))}var q=k("Button"),ue=k("Tooltip"),le=k("TooltipPopup"),de=k("TooltipTrigger"),re=k("Markdown"),se=k("DetailViewport");function S(){return{t:w().i18n.usePluginTranslation()}}var{jsx:d,jsxs:L,Fragment:Ct}=window.__ycodiumPluginHost.jsxRuntime;function fe({text:e}){let{t:a}=S(),t=w(),[o,l]=U(null),[u,f]=U(!1),i=o===e;return L("span",{className:"inline-flex items-center gap-1",children:[d(q,{type:"button",variant:"ghost-muted",size:"icon-xs","aria-label":a(i?"copied":"copy"),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&s.stopPropagation()},onClick:()=>{Promise.resolve(t.writeClipboard(e)).then(()=>{l(e),f(!1)},()=>f(!0))},children:i?d(B,{"aria-hidden":!0,className:"size-icon-1"}):d(T,{"aria-hidden":!0,className:"size-icon-1"})}),u?d("span",{role:"status",className:"tool-meta text-destructive-foreground",children:a("copyFailed")}):null]})}var ie=new Map;function y(e){ie.set(e.kind,e)}function ne(e){return ie.get(e.kind)}function b({text:e}){return L(ue,{children:[d(de,{render:d("code",{className:"min-w-0 truncate text-foreground"}),children:e}),d(le,{className:"max-w-lg whitespace-pre-wrap break-words",children:e})]})}function Ue({model:e}){let{t:a}=S();if(e.resultKind==="paths")return e.paths.length===0?d("p",{className:"px-2 pb-2 text-muted-foreground",children:a("noSearchResults")}):d("pre",{className:"tool-body whitespace-pre-wrap break-words px-2 pb-2 text-foreground",children:e.paths.slice(0,16).join(`
225
+ `)}function D(...e){return e.filter(a=>typeof a=="string"&&a.length>0).join(" ")}var v=(...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 G=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=R(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:f,...i},s)=>g("svg",{ref:s,...ae,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:v("lucide",l),...!u&&!te(i)&&{"aria-hidden":"true"},...i},[...f.map(([n,I])=>g(n,I)),...Array.isArray(u)?u:[u]]));var x=(e,a)=>{let t=R(({className:o,...l},u)=>g(oe,{ref:u,iconNode:a,className:v(`lucide-${Y(G(e))}`,`lucide-${e}`,o),...l}));return t.displayName=G(e),t};var Me=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],B=x("check",Me);var be=[["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"}]],T=x("copy",be);var Re=[["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"}]],F=x("globe",Re);var ve=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],M=x("search",ve);var qe=[["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"}]],h=x("square-terminal",qe);function k(e){return(a=>g(w().ui[e],{...a,className:`ycodium-tool-display-ui ${typeof a.className=="string"?a.className:""}`}))}var q=k("Button"),ue=k("Tooltip"),le=k("TooltipPopup"),de=k("TooltipTrigger"),re=k("Markdown"),se=k("DetailViewport");function S(){return{t:w().i18n.usePluginTranslation()}}var{jsx:d,jsxs:L,Fragment:Ct}=window.__ycodiumPluginHost.jsxRuntime;function fe({text:e}){let{t:a}=S(),t=w(),[o,l]=U(null),[u,f]=U(!1),i=o===e;return L("span",{className:"inline-flex items-center gap-1",children:[d(q,{type:"button",variant:"ghost-muted",size:"icon-xs","aria-label":a(i?"copied":"copy"),onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&s.stopPropagation()},onClick:()=>{Promise.resolve(t.writeClipboard(e)).then(()=>{l(e),f(!1)},()=>{f(!0),t.notify(a("copyFailed"),"error")})},children:i?d(B,{"aria-hidden":!0,className:"size-icon-1"}):d(T,{"aria-hidden":!0,className:"size-icon-1"})}),u?d("span",{role:"status",className:"tool-meta text-destructive-foreground",children:a("copyFailed")}):null]})}var ie=new Map;function y(e){ie.set(e.kind,e)}function ne(e){return ie.get(e.kind)}function b({text:e}){return L(ue,{children:[d(de,{render:d("code",{className:"min-w-0 truncate text-foreground"}),children:e}),d(le,{className:"max-w-lg whitespace-pre-wrap break-words",children:e})]})}function Ue({model:e}){let{t:a}=S();if(e.resultKind==="paths")return e.paths.length===0?d("p",{className:"px-2 pb-2 text-muted-foreground",children:a("noSearchResults")}):d("pre",{className:"tool-body whitespace-pre-wrap break-words px-2 pb-2 text-foreground",children:e.paths.slice(0,16).join(`
226
226
  `)});let t=16;return d("div",{className:"tool-body px-2 pb-2",children:e.files.length===0?d("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:L("div",{"data-search-file":o.path,className:"mb-2 last:mb-0",children:[d("p",{className:"break-all font-medium text-foreground",children:o.path}),l.map(u=>L("div",{"data-search-line":u.line,className:"grid grid-cols-[3.5em_minmax(0,1fr)]",children:[d("span",{"aria-hidden":!0,className:"pe-3 text-end text-muted-foreground tabular-nums select-none",children:u.line}),d("span",{className:"whitespace-pre-wrap break-words text-foreground [overflow-wrap:anywhere]",children:u.text||`
227
227
  `})]},u.key))]},o.key)})})}function Oe({model:e,context:a}){let{t}=S();return L("div",{className:"space-y-2 px-2 pb-2 text-foreground",children:[e.statusCode!==void 0?d("p",{className:D("tool-meta",e.statusCode>=400&&"text-destructive-foreground"),children:t("httpStatus",{status:e.statusCode})}):null,e.answer?d("p",{className:"tool-process-text line-clamp-3 whitespace-pre-wrap",children:e.answer}):null,e.sources.length===0?d("p",{className:"tool-process-text text-muted-foreground",children:t("noWebSources")}):e.sources.slice(0,8).map(o=>L("div",{"data-web-source":o.url,className:"space-y-0.5",children:[o.title!==e.query?d("p",{className:"tool-process-text font-medium",children:o.title}):null,d(re,{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?d("p",{className:"tool-meta line-clamp-3 whitespace-pre-wrap text-muted-foreground",children:o.snippet}):null]},o.key))]})}y({kind:"terminal",heading:e=>L("span",{className:"flex min-w-0 items-center gap-2 text-foreground",children:[d(h,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),d(b,{text:e.command})]}),body:e=>d("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})});y({kind:"read",hiddenLines:e=>Math.max(0,e.lines.length-16),heading:e=>d(b,{text:e.path}),body:e=>d("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?d("div",{"aria-hidden":!0,className:"ps-[3.5em] text-muted-foreground",children:"\u2026"},"gap"):L("div",{"data-source-line":a.number,className:"grid grid-cols-[3.5em_minmax(0,1fr)]",children:[d("span",{"aria-hidden":!0,className:"pe-3 text-end text-muted-foreground select-none tabular-nums",children:a.number}),d("span",{className:"whitespace-pre-wrap break-words pe-2 [overflow-wrap:anywhere]",children:a.text||`
228
228
  `})]},a.number))})});y({kind:"change",heading:e=>d(b,{text:e.files.map(a=>a.path).join(", ")}),body:e=>d("div",{className:"tool-body cursor-text pb-2 select-text",children:e.files.map(a=>L("div",{children:[e.files.length>1?d("p",{className:"px-2 py-1 text-foreground",children:a.path}):null,a.parts.length>64?d("pre",{className:"whitespace-pre-wrap break-words px-2 text-foreground [overflow-wrap:anywhere]",children:a.patch}):a.parts.map(t=>d("pre",{"data-change-line":t.kind,className:D("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(`
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 = 99;
5
+ var PLUGIN_API_VERSION = 103;
6
6
 
7
7
  // src/index.ts
8
8
  import { TOOL_DISPLAY_PLUGIN_ID } from "@ycodium-ai/plugin-api/tool-display";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-tool-display",
3
- "version": "0.2.4194",
3
+ "version": "0.2.4250",
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.4194",
38
+ "@ycodium-ai/plugin-api": "0.2.4250",
39
39
  "ycodium-workspace-path": "0.0.0"
40
40
  },
41
41
  "ycodium": {