@pickaxeproject/react 6.23.11 → 6.24.1
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/dist/cjs/common/chatMessages.js +1 -1
- package/dist/cjs/common/embedAccessRequest.js +1 -0
- package/dist/cjs/common/formatUserMessage.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/History/Message.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRender.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRenderCatalog.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMessageParts/VisualizationPart.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMessageParts/index.js +1 -1
- package/dist/cjs/components/Pickaxe/index.js +1 -1
- package/dist/cjs/hooks/pickaxe/useConversation.js +1 -1
- package/dist/cjs/node_modules/.pnpm/@modelcontextprotocol_sdk@1.20.2/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +1 -1
- package/dist/cjs/node_modules/.pnpm/@modelcontextprotocol_sdk@1.20.2/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1 -1
- package/dist/cjs/src/common/embedAccessRequest.d.ts +1 -0
- package/dist/cjs/src/common/formatUserMessage.d.ts +1 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRender.d.ts +20 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRenderCatalog.d.ts +116 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMessageParts/VisualizationPart.d.ts +15 -0
- package/dist/cjs/src/types/history.d.ts +30 -2
- package/dist/esm/common/chatMessages.js +1 -1
- package/dist/esm/common/embedAccessRequest.js +1 -0
- package/dist/esm/common/formatUserMessage.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/History/Message.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRender.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRenderCatalog.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMessageParts/VisualizationPart.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMessageParts/index.js +1 -1
- package/dist/esm/components/Pickaxe/index.js +1 -1
- package/dist/esm/hooks/pickaxe/useConversation.js +1 -1
- package/dist/esm/node_modules/.pnpm/@modelcontextprotocol_sdk@1.20.2/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +1 -1
- package/dist/esm/node_modules/.pnpm/@modelcontextprotocol_sdk@1.20.2/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1 -1
- package/dist/esm/src/common/embedAccessRequest.d.ts +1 -0
- package/dist/esm/src/common/formatUserMessage.d.ts +1 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRender.d.ts +20 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRenderCatalog.d.ts +116 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeMessageParts/VisualizationPart.d.ts +15 -0
- package/dist/esm/src/types/history.d.ts +30 -2
- package/package.json +4 -2
- package/dist/cjs/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +0 -1
- package/dist/cjs/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +0 -1
- package/dist/cjs/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +0 -1
- package/dist/cjs/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +0 -1
- package/dist/cjs/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +0 -1
- package/dist/cjs/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +0 -1
- package/dist/cjs/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js +0 -1
- package/dist/esm/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +0 -1
- package/dist/esm/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +0 -1
- package/dist/esm/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +0 -1
- package/dist/esm/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +0 -1
- package/dist/esm/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +0 -1
- package/dist/esm/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +0 -1
- package/dist/esm/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import{setByPath as r,getByPath as n}from"@json-render/core";import{useState as a}from"react";import{PICKAXE_JSON_RENDER_CATALOG as l}from"./PickaxeJsonRenderCatalog.js";const o=e=>{const t=Number(e);return Number.isFinite(t)?t:0},s=e=>{switch(e){case"positive":return"#16a34a";case"warning":return"#d97706";case"negative":return"#dc2626";case"neutral":case"muted":return"var(--pickaxe-viz-muted)";default:return"var(--pickaxe-viz-accent)"}},c={add:({left:e,right:t})=>o(e)+o(t),subtract:({left:e,right:t})=>o(e)-o(t),multiply:({left:e,right:t})=>o(e)*o(t),divide:({left:e,right:t})=>{const i=o(t);return 0===i?0:o(e)/i},percentage:({value:e,total:t})=>{const i=o(t);return 0===i?0:o(e)/i*100},round:({value:e,digits:t})=>{const i=Math.min(6,Math.max(0,Math.trunc(o(t))));return Number(o(e).toFixed(i))},formatCurrency:({value:e,currency:t})=>new Intl.NumberFormat(void 0,{style:"currency",currency:"string"==typeof t&&/^[A-Z]{3}$/.test(t)?t:"USD",maximumFractionDigits:2}).format(o(e)),formatPercent:({value:e,digits:t})=>`${o(e).toFixed(Math.min(4,Math.max(0,Math.trunc(o(t)))))}%`},d=e=>JSON.parse(JSON.stringify(e)),u=(e,t)=>{if(Array.isArray(e))return e.map((e=>u(e,t)));if(!e||"object"!=typeof e)return e;const i=e;if("string"==typeof i.$state)return n(t,i.$state);if("string"==typeof i.$bindState)return n(t,i.$bindState);if("string"==typeof i.$computed){const e=c[i.$computed];if(!e)return;const r=u(i.args||{},t);return e(r&&"object"==typeof r?r:{})}if("string"==typeof i.$template)return i.$template.replace(/\$\{(\/[^}]+)\}/g,((e,i)=>{const r=n(t,i);return null==r?"":String(r)}));if("$cond"in i){const e=i.$cond,r=e&&"object"==typeof e?(()=>{const i=e,r="string"==typeof i.$state?n(t,i.$state):u(e,t);return"eq"in i?r===u(i.eq,t):!0===i.not?!r:Boolean(r)})():Boolean(u(e,t));return u(r?i.$then:i.$else,t)}return Object.fromEntries(Object.entries(i).map((([e,i])=>[e,u(i,t)])))},p=e=>{if("string"==typeof e)try{const t=new URL(e);return["http:","https:"].includes(t.protocol)?t.href:void 0}catch(e){return}},g=e=>{switch(e){case"small":return 8;case"large":return 20;default:return 12}},h={margin:0,width:"100%",boxSizing:"border-box",padding:"16px clamp(12px, 3vw, 20px)",border:"1px solid var(--pickaxe-viz-border)",borderRadius:"var(--pickaxe-viz-radius)",background:"var(--pickaxe-viz-surface)",boxShadow:"0 10px 30px rgba(0, 0, 0, 0.06)"},b={marginBottom:14,fontSize:16,fontWeight:650,letterSpacing:"-0.01em"},v={display:"block",width:"100%",height:"auto",overflow:"visible"},x={marginTop:12,paddingTop:12,borderTop:"1px solid var(--pickaxe-viz-border)",color:"var(--pickaxe-viz-muted)",fontSize:13,lineHeight:1.5},f=({props:i})=>{const r=Array.isArray(i.points)?i.points:[],n="string"==typeof i.title?i.title:void 0,a="string"==typeof i.description?i.description:void 0,l=i.type;if(!r.length)return null;if("bar"===l){const i=640,l=58,c=Math.max(130,r.length*l+8),d=r.map((e=>o(e.value))),u=Math.max(1,...d.map(Math.abs));return t("figure",Object.assign({style:h,"aria-label":n||"Bar chart"},{children:[n?e("figcaption",Object.assign({style:b},{children:n})):null,t("svg",Object.assign({style:v,viewBox:`0 0 ${i} ${c}`,role:"img"},{children:[a?e("desc",{children:a}):null,r.map(((i,r)=>{const n=d[r],a=r*l;return t("g",{children:[e("title",{children:`${i.label}: ${n}`}),e("text",Object.assign({x:"0",y:a+16,fill:"currentColor",fontSize:"14",fontWeight:"600"},{children:i.label})),e("text",Object.assign({x:"640",y:a+16,fill:"currentColor",fontSize:"13",textAnchor:"end",opacity:"0.72"},{children:n.toLocaleString()})),e("rect",{x:"0",y:a+26,width:"640",height:"16",rx:"8",fill:"var(--pickaxe-viz-track)"}),e("rect",{x:"0",y:a+26,width:Math.abs(n)/u*640,height:"16",rx:"8",fill:s(i.tone)})]},`${i.label}-${r}`)}))]})),a?e("div",Object.assign({style:x},{children:a})):null]}))}if("line"===l||"area"===l){const i=640,c=320,d=42,u=r.map((e=>o(e.value))),p=Math.min(0,...u),g=Math.max(1,...u),f=e=>d+e/Math.max(1,r.length-1)*(i-2*d),y=e=>c-d-(e-p)/(g-p||1)*(c-2*d),m=r.map(((e,t)=>`${t?"L":"M"} ${f(t)} ${y(o(e.value))}`)).join(" "),j=`${m} L ${f(r.length-1)} ${c-d} L ${f(0)} ${c-d} Z`;return t("figure",Object.assign({style:h,"aria-label":n||`${l} chart`},{children:[n?e("figcaption",Object.assign({style:b},{children:n})):null,t("svg",Object.assign({style:v,viewBox:`0 0 ${i} ${c}`,role:"img"},{children:[a?e("desc",{children:a}):null,[0,1,2,3,4].map((t=>{const r=d+t/4*(c-2*d);return e("line",{x1:d,y1:r,x2:i-d,y2:r,stroke:"currentColor",opacity:"0.1"},t)})),"area"===l?e("path",{d:j,fill:"var(--pickaxe-viz-accent)",opacity:"0.14"}):null,e("path",{d:m,fill:"none",stroke:"var(--pickaxe-viz-accent)",strokeWidth:"3",strokeLinejoin:"round",strokeLinecap:"round"}),r.map(((i,r)=>t("g",{children:[e("title",{children:`${i.label}: ${u[r]}`}),e("circle",{cx:f(r),cy:y(u[r]),r:"5",fill:s(i.tone)}),e("text",Object.assign({x:f(r),y:c-14,textAnchor:"middle",fill:"currentColor",fontSize:"11",opacity:"0.72"},{children:i.label}))]},`${i.label}-${r}`)))]})),a?e("div",Object.assign({style:x},{children:a})):null]}))}if("pie"===l){const i=r.reduce(((e,t)=>e+Math.max(0,o(t.value))),0)||1;let l=-Math.PI/2;const c=["accent","positive","warning","negative","neutral"];return t("figure",Object.assign({style:h,"aria-label":n||"Pie chart"},{children:[n?e("figcaption",Object.assign({style:b},{children:n})):null,t("div",Object.assign({style:{display:"grid",gridTemplateColumns:"minmax(160px, 0.8fr) minmax(150px, 1fr)",alignItems:"center",gap:18}},{children:[e("svg",Object.assign({style:v,viewBox:"0 0 240 240",role:"img"},{children:r.map(((t,r)=>{const n=Math.max(0,o(t.value)),a=l,d=n/i*Math.PI*2;l+=d;const u=d>Math.PI?1:0,p=120+92*Math.cos(a),g=120+92*Math.sin(a),h=120+92*Math.cos(l),b=120+92*Math.sin(l),v=d>=1.999*Math.PI?"M 120 28 A 92 92 0 1 1 119.99 28 Z":`M 120 120 L ${p} ${g} A 92 92 0 ${u} 1 ${h} ${b} Z`;return e("path",Object.assign({d:v,fill:s(t.tone||c[r%c.length]),stroke:"var(--pickaxe-viz-surface)",strokeWidth:"2"},{children:e("title",{children:`${t.label}: ${n}`})}),`${t.label}-${r}`)}))})),e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:8}},{children:r.map(((i,r)=>t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,fontSize:13}},{children:[t("span",Object.assign({style:{display:"flex",alignItems:"center",gap:7}},{children:[e("span",{style:{width:9,height:9,borderRadius:999,background:s(i.tone||c[r%c.length])}}),i.label]})),e("strong",{children:o(i.value).toLocaleString()})]}),`${i.label}-${r}`)))}))]})),a?e("div",Object.assign({style:x},{children:a})):null]}))}if("ternary"===l){const l=i.corners&&"object"==typeof i.corners?i.corners:{},c=(e,t,r)=>{const n=l[e]&&"object"==typeof l[e]?l[e]:{};return{label:"string"==typeof n.label?n.label:"string"==typeof i[t]?i[t]:r,description:"string"==typeof n.description?n.description:""}},d=c("top","aLabel","A"),u=c("left","bLabel","B"),p=c("right","cLabel","C"),g={a:{x:360,y:94},b:{x:84,y:414},c:{x:636,y:414}},f=(e,t)=>{switch(e){case"left":return{dx:-t-7,dy:5,anchor:"end"};case"top":return{dx:0,dy:-t-7,anchor:"middle"};case"bottom":return{dx:0,dy:t+16,anchor:"middle"};default:return{dx:t+7,dy:5,anchor:"start"}}};return t("figure",Object.assign({style:h,"aria-label":n||"Ternary chart"},{children:[n?e("figcaption",Object.assign({style:b},{children:n})):null,t("svg",Object.assign({style:v,viewBox:"0 0 720 500",role:"img"},{children:[a?e("desc",{children:a}):null,e("path",{d:`M ${g.a.x} ${g.a.y} L ${g.b.x} ${g.b.y} L ${g.c.x} ${g.c.y} Z`,fill:"var(--pickaxe-viz-accent)",fillOpacity:"0.04",stroke:"currentColor",strokeOpacity:"0.45",strokeWidth:"2"}),r.map(((i,r)=>{const n=Math.max(0,o(i.a)),a=Math.max(0,o(i.b)),l=Math.max(0,o(i.c)),c=n+a+l||1,h=(n*g.a.x+a*g.b.x+l*g.c.x)/c,b=(n*g.a.y+a*g.b.y+l*g.c.y)/c,v=Math.min(18,Math.max(5,o(i.size)||7)),x=f(i.labelPosition,v);return t("g",{children:[e("title",{children:`${i.label}: ${n} ${d.label}, ${a} ${u.label}, ${l} ${p.label}`}),e("circle",{cx:h,cy:b,r:v,fill:s(i.tone)}),e("text",Object.assign({x:h+x.dx,y:b+x.dy,fill:"currentColor",fontSize:"14",fontWeight:"600",textAnchor:x.anchor},{children:i.label}))]},`${i.label}-${r}`)})),e("text",Object.assign({x:g.a.x,y:"28",textAnchor:"middle",fill:"currentColor",fontSize:"17",fontWeight:"700"},{children:d.label})),d.description?e("text",Object.assign({x:g.a.x,y:"51",textAnchor:"middle",fill:"currentColor",fontSize:"13",opacity:"0.72"},{children:d.description})):null,e("text",Object.assign({x:g.b.x,y:"449",textAnchor:"start",fill:"currentColor",fontSize:"17",fontWeight:"700"},{children:u.label})),u.description?e("text",Object.assign({x:g.b.x,y:"472",textAnchor:"start",fill:"currentColor",fontSize:"13",opacity:"0.72"},{children:u.description})):null,e("text",Object.assign({x:g.c.x,y:"449",textAnchor:"end",fill:"currentColor",fontSize:"17",fontWeight:"700"},{children:p.label})),p.description?e("text",Object.assign({x:g.c.x,y:"472",textAnchor:"end",fill:"currentColor",fontSize:"13",opacity:"0.72"},{children:p.description})):null]})),a?e("div",Object.assign({style:x},{children:a})):null]}))}const c=52,d=r.map((e=>o(e.x))),u=r.map((e=>o(e.y))),p=Math.min(...d),g=Math.max(...d),f=Math.min(...u),y=Math.max(...u),m=e=>c+(e-p)/(g-p||1)*536,j=e=>288-(e-f)/(y-f||1)*236;return t("figure",Object.assign({style:h,"aria-label":n||"Scatter chart"},{children:[n?e("figcaption",Object.assign({style:b},{children:n})):null,t("svg",Object.assign({style:v,viewBox:"0 0 640 340",role:"img"},{children:[a?e("desc",{children:a}):null,e("line",{x1:c,y1:288,x2:588,y2:288,stroke:"currentColor",opacity:"0.4"}),e("line",{x1:c,y1:c,x2:c,y2:288,stroke:"currentColor",opacity:"0.4"}),r.map(((i,r)=>{const n=d[r],a=u[r],l=Math.min(15,Math.max(5,o(i.size)||7));return t("g",{children:[e("title",{children:`${i.label}: ${n}, ${a}`}),e("circle",{cx:m(n),cy:j(a),r:l,fill:s(i.tone)}),e("text",Object.assign({x:m(n)+l+5,y:j(a)+5,fill:"currentColor",fontSize:"13"},{children:i.label}))]},`${i.label}-${r}`)})),i.xLabel?e("text",Object.assign({x:320,y:330,textAnchor:"middle",fill:"currentColor",fontSize:"13"},{children:String(i.xLabel)})):null,i.yLabel?e("text",Object.assign({x:"16",y:170,textAnchor:"middle",fill:"currentColor",fontSize:"13",transform:"rotate(-90 16 170)"},{children:String(i.yLabel)})):null]})),a?e("div",Object.assign({style:x},{children:a})):null]}))},y=Object.fromEntries(Object.keys(l).map((i=>[i,r=>((i,r,n,a,l,c)=>{var d,u,h,b,v,x,y,m,j,S,O,k,z,$,w,M,A,C,W,T,L,B,N;const R={width:"100%",boxSizing:"border-box",border:"1px solid var(--pickaxe-viz-border)",borderRadius:"var(--pickaxe-viz-radius)",background:"var(--pickaxe-viz-surface)",color:"inherit",padding:"11px 13px",font:"inherit",fontVariantNumeric:"tabular-nums",boxShadow:"inset 0 1px 2px rgba(0, 0, 0, 0.04)"};if("Column"===i)return e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:g(r.gap),minWidth:0}},{children:n}));if("Row"===i)return e("div",Object.assign({style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:g(r.gap),minWidth:0}},{children:n}));if("Grid"===i)return e("div",Object.assign({style:{display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(min(100%, ${Number(r.columns)>2?150:210}px), 1fr))`,gap:g(r.gap),minWidth:0}},{children:n}));if("Card"===i)return e("div",Object.assign({style:{border:"1px solid var(--pickaxe-viz-border)",borderRadius:"var(--pickaxe-viz-radius)",padding:"clamp(14px, 3vw, 20px)",background:"var(--pickaxe-viz-surface)",boxShadow:"0 10px 30px rgba(0, 0, 0, 0.06)"}},{children:n}));if("Section"===i)return t("section",Object.assign({style:{display:"flex",flexDirection:"column",gap:12}},{children:[e("div",Object.assign({style:{fontSize:18,fontWeight:700,letterSpacing:"-0.02em"}},{children:String(null!==(d=r.title)&&void 0!==d?d:"")})),r.description?e("div",Object.assign({style:{color:"var(--pickaxe-viz-muted)",fontSize:14}},{children:String(r.description)})):null,n]}));if("Accordion"===i)return t("details",Object.assign({open:Boolean(r.defaultOpen),style:{border:"1px solid var(--pickaxe-viz-border)",borderRadius:"var(--pickaxe-viz-radius)",background:"var(--pickaxe-viz-surface)",padding:"12px 14px"}},{children:[e("summary",Object.assign({style:{cursor:"pointer",fontWeight:650}},{children:String(null!==(u=r.title)&&void 0!==u?u:"Details")})),e("div",Object.assign({style:{marginTop:12}},{children:n}))]}));if("Divider"===i)return e("hr",{style:{width:"100%",border:0,borderTop:"1px solid var(--pickaxe-viz-border)",margin:"4px 0"}});if("Spacer"===i)return e("div",{"aria-hidden":"true",style:{height:Math.max(4,o(r.size)||16)}});if("Badge"===i)return e("span",Object.assign({style:{display:"inline-flex",width:"fit-content",alignItems:"center",borderRadius:999,padding:"4px 9px",background:"var(--pickaxe-viz-track)",color:s(r.tone),fontSize:12,fontWeight:700}},{children:String(null!==(h=r.text)&&void 0!==h?h:"")}));if("Alert"===i)return t("div",Object.assign({role:"note",style:{borderLeft:`4px solid ${s(r.tone)}`,borderRadius:"var(--pickaxe-viz-radius)",padding:"12px 14px",background:"var(--pickaxe-viz-surface)",lineHeight:1.5}},{children:[r.title?e("strong",{children:String(r.title)}):null,e("div",{children:String(null!==(b=r.message)&&void 0!==b?b:"")})]}));if("Image"===i){const t=p(r.src);return t?e("img",{src:t,alt:String(null!==(v=r.alt)&&void 0!==v?v:""),style:{display:"block",width:"100%",maxHeight:o(r.maxHeight)||420,objectFit:"contain"===r.fit?"contain":"cover",borderRadius:"var(--pickaxe-viz-radius)"}}):null}if("Link"===i){const t=p(r.href);return t?e("a",Object.assign({href:t,target:"_blank",rel:"noreferrer",style:{color:"var(--pickaxe-viz-accent)"}},{children:String(null!==(x=r.text)&&void 0!==x?x:t)})):null}if("List"===i){const t=Array.isArray(r.items)?r.items:[],i=r.ordered?"ol":"ul";return e(i,Object.assign({style:{margin:0,paddingLeft:22,lineHeight:1.6}},{children:t.map(((t,i)=>e("li",{children:String(t)},`${String(t)}-${i}`)))}))}if("Table"===i){const i=Array.isArray(r.columns)?r.columns:[],n=Array.isArray(r.rows)?r.rows:[];return e("div",Object.assign({style:{width:"100%",overflowX:"auto"}},{children:t("table",Object.assign({style:{width:"100%",borderCollapse:"collapse",fontSize:14}},{children:[e("thead",{children:e("tr",{children:i.map(((t,i)=>{var r,n;return e("th",Object.assign({style:{padding:"9px 10px",borderBottom:"1px solid var(--pickaxe-viz-border)",textAlign:"left",color:"var(--pickaxe-viz-muted)",fontWeight:650}},{children:String(null!==(n=null!==(r=t.label)&&void 0!==r?r:t.key)&&void 0!==n?n:"")}),`${String(t.key)}-${i}`)}))})}),e("tbody",{children:n.map(((t,r)=>e("tr",{children:i.map(((i,r)=>{var n;return e("td",Object.assign({style:{padding:"10px",borderBottom:"1px solid var(--pickaxe-viz-border)"}},{children:String(null!==(n=t[String(i.key)])&&void 0!==n?n:"")}),r)}))},r)))})]}))}))}if("Text"===i)return e("div",Object.assign({style:{fontSize:"caption"===r.variant?13:15,opacity:"caption"===r.variant?.7:1,lineHeight:1.55,color:"muted"===r.tone||"neutral"===r.tone?"var(--pickaxe-viz-muted)":void 0}},{children:String(null!==(y=r.text)&&void 0!==y?y:"")}));if("Heading"===i){const t=Math.min(4,Math.max(1,o(r.level)||2));return e(`h${t}`,Object.assign({style:{margin:0,fontSize:`${Math.max(18,30-3*t)}px`,lineHeight:1.2,letterSpacing:"-0.025em"}},{children:String(null!==(m=r.text)&&void 0!==m?m:"")}))}if("NumberInput"===i)return t("label",Object.assign({style:{display:"flex",flexDirection:"column",gap:6,minWidth:0}},{children:[e("span",Object.assign({style:{fontSize:14,fontWeight:500}},{children:String(null!==(j=r.label)&&void 0!==j?j:"Value")})),e("input",{"aria-label":String(null!==(S=r.label)&&void 0!==S?S:"Value"),type:"number",value:o(r.value),min:"number"==typeof r.min?r.min:void 0,max:"number"==typeof r.max?r.max:void 0,step:"number"==typeof r.step?r.step:"any",style:R,onChange:e=>(null==a?void 0:a.value)&&Number.isFinite(e.currentTarget.valueAsNumber)&&l.set(a.value,e.currentTarget.valueAsNumber)})]}));if("TextInput"===i||"TextArea"===i){const n=String(null!==(O=r.label)&&void 0!==O?O:"Value"),s={"aria-label":n,value:String(null!==(k=r.value)&&void 0!==k?k:""),placeholder:"string"==typeof r.placeholder?r.placeholder:void 0,style:Object.assign(Object.assign({},R),{resize:"TextArea"===i?"vertical":void 0}),onChange:e=>(null==a?void 0:a.value)&&l.set(a.value,e.currentTarget.value)};return t("label",Object.assign({style:{display:"flex",flexDirection:"column",gap:6,minWidth:0}},{children:[e("span",Object.assign({style:{fontSize:14,fontWeight:500}},{children:n})),"TextArea"===i?e("textarea",Object.assign({},s,{rows:Math.max(2,o(r.rows)||4)})):e("input",Object.assign({},s,{type:"text"}))]}))}if("Select"===i){const i=Array.isArray(r.options)?r.options:[];return t("label",Object.assign({style:{display:"flex",flexDirection:"column",gap:6,minWidth:0}},{children:[e("span",Object.assign({style:{fontSize:14,fontWeight:500}},{children:String(null!==(z=r.label)&&void 0!==z?z:"Select")})),e("select",Object.assign({value:String(null!==($=r.value)&&void 0!==$?$:""),style:R,onChange:e=>(null==a?void 0:a.value)&&l.set(a.value,e.currentTarget.value)},{children:i.map(((t,i)=>{var r,n,a;return e("option",Object.assign({value:String(null!==(r=t.value)&&void 0!==r?r:"")},{children:String(null!==(a=null!==(n=t.label)&&void 0!==n?n:t.value)&&void 0!==a?a:"")}),`${String(t.value)}-${i}`)}))}))]}))}if("Checkbox"===i||"Toggle"===i)return t("label",Object.assign({style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:14,fontWeight:500}},{children:[e("input",{type:"checkbox",role:"Toggle"===i?"switch":void 0,checked:Boolean(r.value),style:{width:18,height:18,accentColor:"var(--pickaxe-viz-accent)"},onChange:e=>(null==a?void 0:a.value)&&l.set(a.value,e.currentTarget.checked)}),String(null!==(w=r.label)&&void 0!==w?w:"Option")]}));if("Tabs"===i){const t=Array.isArray(r.options)?r.options:[];return e("div",Object.assign({role:"tablist","aria-label":String(null!==(M=r.label)&&void 0!==M?M:"Tabs"),style:{display:"flex",flexWrap:"wrap",gap:6}},{children:t.map(((t,i)=>{var n,o,s;const c=String(null!==(n=t.value)&&void 0!==n?n:i),d=String(null!==(o=r.value)&&void 0!==o?o:"")===c;return e("button",Object.assign({type:"button",role:"tab","aria-selected":d,style:{border:"1px solid "+(d?"var(--pickaxe-viz-accent)":"var(--pickaxe-viz-border)"),borderRadius:999,padding:"7px 12px",background:d?"var(--pickaxe-viz-accent)":"var(--pickaxe-viz-surface)",color:d?"var(--pickaxe-viz-accent-text, #fff)":"inherit",cursor:"pointer"},onClick:()=>(null==a?void 0:a.value)&&l.set(a.value,c)},{children:String(null!==(s=t.label)&&void 0!==s?s:c)}),c)}))}))}if("Button"===i)return e("button",Object.assign({type:"button",style:{width:r.fullWidth?"100%":"fit-content",border:"outline"===r.variant?"1px solid var(--pickaxe-viz-border)":0,borderRadius:"var(--pickaxe-viz-radius)",padding:"9px 14px",background:"outline"===r.variant?"transparent":"var(--pickaxe-viz-accent)",color:"outline"===r.variant?"inherit":"var(--pickaxe-viz-accent-text, #fff)",font:"inherit",fontWeight:650,cursor:"pointer"},onClick:()=>c("press")},{children:String(null!==(A=r.text)&&void 0!==A?A:"Continue")}));if("Slider"===i){const i=o(r.value);return t("label",Object.assign({style:{display:"flex",flexDirection:"column",gap:10}},{children:[t("span",Object.assign({style:{display:"flex",justifyContent:"space-between",gap:12,fontSize:14,fontWeight:500}},{children:[e("span",{children:String(null!==(C=r.label)&&void 0!==C?C:"Value")}),e("span",Object.assign({style:{fontVariantNumeric:"tabular-nums"}},{children:i}))]})),e("input",{"aria-label":String(null!==(W=r.label)&&void 0!==W?W:"Value"),type:"range",value:i,min:o(r.min),max:o(r.max),step:o(r.step)||1,style:{width:"100%",accentColor:"var(--pickaxe-viz-accent)"},onChange:e=>(null==a?void 0:a.value)&&Number.isFinite(e.currentTarget.valueAsNumber)&&l.set(a.value,e.currentTarget.valueAsNumber)})]}))}if("Metric"===i)return t("div",Object.assign({style:{minWidth:0,border:"1px solid var(--pickaxe-viz-border)",borderRadius:"var(--pickaxe-viz-radius)",padding:16,background:"var(--pickaxe-viz-surface)",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.05)"}},{children:[e("div",Object.assign({style:{fontSize:12,fontWeight:650,letterSpacing:"0.045em",textTransform:"uppercase",color:"var(--pickaxe-viz-muted)"}},{children:String(null!==(T=r.label)&&void 0!==T?T:"")})),e("div",Object.assign({style:{marginTop:4,overflowWrap:"anywhere",fontSize:"clamp(24px, 5vw, 32px)",fontWeight:700,letterSpacing:"-0.035em",fontVariantNumeric:"tabular-nums",color:s(r.tone)}},{children:String(null!==(L=r.value)&&void 0!==L?L:"")}))]}));if("ProgressBar"===i){const i=o(r.value),n=Math.max(0,o(r.max)),a=n>0?Math.min(100,Math.max(0,i/n*100)):0;return t("div",Object.assign({style:{width:"100%",boxSizing:"border-box",padding:"4px 0"}},{children:[t("div",Object.assign({style:{display:"flex",justifyContent:"space-between",gap:12,marginBottom:8,fontSize:14}},{children:[e("span",{children:String(null!==(B=r.label)&&void 0!==B?B:"")}),t("span",Object.assign({style:{opacity:.75,fontVariantNumeric:"tabular-nums"}},{children:[i,"/",n]}))]})),e("div",Object.assign({role:"progressbar","aria-label":String(null!==(N=r.label)&&void 0!==N?N:"Progress"),"aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":i,style:{width:"100%",height:12,overflow:"hidden",borderRadius:999,background:"var(--pickaxe-viz-track)"}},{children:e("div",{style:{width:`${a}%`,height:"100%",borderRadius:999,background:s(r.tone),transition:"width 150ms ease"}})}))]}))}return"Chart"===i?e(f,{props:r}):null})(i,r.props,r.children,r.bindings,r.store,r.emit)]))),m=({spec:t,elementKey:r,state:a,store:l,ancestors:s})=>{if(s.has(r))return null;const c=t.elements[r];if(!c||!((e,t)=>{if(void 0===e)return!0;if(e&&"object"==typeof e){const i=e;if("string"==typeof i.$state){const e=n(t,i.$state);if("eq"in i)return e===u(i.eq,t);if(!0===i.not)return!e}}return Boolean(u(e,t))})(c.visible,a))return null;const d=(e=>Object.fromEntries(Object.entries(e).flatMap((([e,t])=>t&&"object"==typeof t&&"string"==typeof t.$bindState?[[e,t.$bindState]]:[]))))(c.props),p=((e,t)=>u(e,t))(c.props,a),g=y[c.type];if(!g)return null;const h=new Set(s).add(r),b=c.children.map((i=>e(m,{spec:t,elementKey:i,state:a,store:l,ancestors:h},i)));return e(i,{children:g({props:p,children:b,bindings:d,store:l,emit:e=>{var t;return((e,t,i)=>{if(!e||!e.params)return;const r=e.params.statePath;if("string"!=typeof r||!r.startsWith("/"))return;const a=u(e.params.value,t);if("setState"===e.action)return void i.set(r,a);const l=n(t,r);if("pushState"!==e.action){if("removeState"===e.action&&Array.isArray(l)){const n=o(u(e.params.index,t));i.set(r,l.filter(((e,t)=>t!==n)))}}else i.set(r,[...Array.isArray(l)?l:[],a])})(null===(t=c.on)||void 0===t?void 0:t[e],a,l)}})})},j=({spec:t})=>{const[i,n]=a((()=>d(t.state||{}))),l={set(e,t){n((i=>{const n=d(i);return r(n,e,t),n}))}};return e("div",Object.assign({style:{width:"100%",minWidth:0,color:"inherit",fontFamily:"inherit"}},{children:e(m,{spec:t,elementKey:t.root,state:i,store:l,ancestors:new Set})}))};export{j as PickaxeJsonRender};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={Column:{container:!0,description:"Vertical stack layout"},Row:{container:!0,description:"Wrapping horizontal layout"},Grid:{container:!0,description:"Responsive grid layout"},Card:{container:!0,description:"Elevated content group"},Section:{container:!0,description:"Titled content section"},Accordion:{container:!0,description:"Collapsible content section"},Text:{container:!1,description:"Body or caption text"},Heading:{container:!1,description:"Semantic heading"},Divider:{container:!1,description:"Visual separator"},Spacer:{container:!1,description:"Responsive empty space"},Badge:{container:!1,description:"Compact status label"},Alert:{container:!1,description:"Highlighted message"},Image:{container:!1,description:"Remote image with alt text"},Link:{container:!1,description:"Safe external link"},List:{container:!1,description:"Ordered or unordered text list"},Table:{container:!1,description:"Tabular records with columns"},NumberInput:{container:!1,description:"Bound numeric input"},Slider:{container:!1,description:"Bound numeric range input"},TextInput:{container:!1,description:"Bound single-line text input"},TextArea:{container:!1,description:"Bound multiline text input"},Select:{container:!1,description:"Bound option selector"},Checkbox:{container:!1,description:"Bound boolean checkbox"},Toggle:{container:!1,description:"Bound boolean switch"},Button:{container:!1,description:"Local state action button"},Tabs:{container:!1,description:"Bound tab selector"},Metric:{container:!1,description:"Key performance indicator"},ProgressBar:{container:!1,description:"Progress toward a maximum"},Chart:{container:!1,description:"Bar, line, area, scatter, pie, or labeled ternary positioning chart"}},n=new Set(Object.keys(e));export{e as PICKAXE_JSON_RENDER_CATALOG,n as PICKAXE_JSON_RENDER_COMPONENT_TYPES};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{usePickaxeContext as r}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useMemo as a,useState as i,useEffect as n,Component as o}from"react";import{PICKAXE_JSON_RENDER_COMPONENT_TYPES as s}from"./PickaxeJsonRenderCatalog.js";const l=e=>"string"==typeof e?e.trim():"",c=e=>{if(!e||e.length>1e6)return{error:"This visualization is unavailable.",fallbackText:"The visualization could not be displayed."};let t;try{t=JSON.parse(e)}catch(t){return{error:"This visualization is unavailable.",fallbackText:e}}if(!t||"object"!=typeof t)return{error:"This visualization is unavailable.",fallbackText:"The visualization could not be displayed."};const r=t,a=l(r.title)||"Visualization",i=l(r.fallbackText)||"The visualization could not be displayed.";return"ready"!==r.status?{error:"This visualization is unavailable.",fallbackText:i,title:a}:"json-render"===r.protocol&&"0.21"===r.protocolVersion&&l(r.surfaceId)&&(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.root||!t.root)return!1;if(!t.elements||"object"!=typeof t.elements||Array.isArray(t.elements))return!1;if(void 0!==t.state&&(!t.state||"object"!=typeof t.state||Array.isArray(t.state)))return!1;const r=t.elements,a=Object.keys(r);if(!a.length||a.length>500||!r[t.root])return!1;for(const e of Object.values(r)){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;if(!s.has(l(t.type)))return!1;if(!t.props||"object"!=typeof t.props||Array.isArray(t.props))return!1;if(!Array.isArray(t.children)||t.children.length>200||t.children.some((e=>"string"!=typeof e||!r[e])))return!1}const i=new Set,n=new Set,o=new Map,c=(e,t)=>{var a;if(t>40)return!1;if(i.has(e))return!1;if((null!==(a=o.get(e))&&void 0!==a?a:0)>=t)return!0;o.set(e,t),i.add(e);const s=r[e];for(const e of s.children)if(!c(e,t+1))return!1;return i.delete(e),n.add(e),!0};return c(t.root,1)&&n.size===a.length})(r.spec)?{data:r}:{error:"This visualization format is unsupported.",fallbackText:i,title:a}},d=({title:a,text:i,embedded:n=!1})=>{const{colors:o,styles:s}=r(),l=n?o.secondaryText:o.text;return t("div",Object.assign({role:"note",style:{display:"flex",alignItems:"flex-start",gap:14,width:"100%",boxSizing:"border-box",margin:n?0:"12px 0",border:`1px solid ${l}2b`,borderRadius:Math.max(s.cornerRadius,14),padding:"clamp(14px, 3vw, 18px)",background:n?o.secondary:o.primary,color:l,boxShadow:n?"none":"0 12px 32px rgba(0, 0, 0, 0.07)"}},{children:[e("div",Object.assign({"aria-hidden":"true",style:{display:"grid",placeItems:"center",width:36,height:36,flex:"0 0 auto",borderRadius:10,background:o.accent,color:o.accentText}},{children:e("svg",Object.assign({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:e("path",{d:"M3 15.5V11m5 4.5V7m5 8.5V4.5m4 11H2",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"})}))})),t("div",Object.assign({style:{minWidth:0,flex:1}},{children:[e("div",Object.assign({style:{marginBottom:a?4:6,fontSize:11,fontWeight:700,letterSpacing:"0.075em",textTransform:"uppercase",opacity:.58}},{children:"Visualization summary"})),a?e("div",Object.assign({style:{marginBottom:6,fontSize:16,fontWeight:700,letterSpacing:"-0.015em"}},{children:a})):null,e("div",Object.assign({style:{fontSize:14,lineHeight:1.55,overflowWrap:"anywhere",opacity:.78}},{children:i}))]}))]}))};class u extends o{constructor(){super(...arguments),Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:{failed:!1}})}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e,t){console.warn("[pickaxe] failed to render json-render visualization",e,t)}render(){return this.state.failed?this.props.fallback:this.props.children}}const p=({content:o})=>{const{colors:s,styles:l}=r(),p=a((()=>c(o)),[o]),[f,x]=i({status:"loading"});if(n((()=>{if(!p.data)return void x({status:"error"});let e=!1;return x({status:"loading"}),import("./PickaxeJsonRender.js").then((({PickaxeJsonRender:t})=>{e||x({status:"ready",Renderer:t})})).catch((t=>{e||(console.warn("[pickaxe] rejected invalid json-render visualization",t),x({status:"error"}))})),()=>{e=!0}}),[p]),!p.data||"error"===f.status){const t=p.data?p.data.title:p.title,r=p.data?p.data.fallbackText:p.fallbackText;return e(d,{title:t,text:r})}const b={"--pickaxe-viz-surface":s.secondary,"--pickaxe-viz-muted":s.secondaryText,"--pickaxe-viz-accent":s.accent,"--pickaxe-viz-accent-text":s.accentText,"--pickaxe-viz-border":`${s.text}33`,"--pickaxe-viz-track":`${s.text}20`,"--pickaxe-viz-radius":`${Math.max(l.cornerRadius,12)}px`},h=e(d,{title:p.data.title,text:p.data.fallbackText,embedded:!0}),g="ready"===f.status?f.Renderer:null;return t("section",Object.assign({"aria-label":p.data.title,style:Object.assign(Object.assign({},b),{width:"100%",boxSizing:"border-box",overflow:"hidden",margin:"12px 0",border:`1px solid ${s.text}33`,borderRadius:Math.max(l.cornerRadius,16),padding:"clamp(16px, 4vw, 24px)",background:s.primary,boxShadow:"0 16px 42px rgba(0, 0, 0, 0.08)"})},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",gap:10,marginBottom:18,fontSize:16,fontWeight:700,letterSpacing:"-0.015em"}},{children:[e("span",{"aria-hidden":"true",style:{width:4,height:20,flex:"0 0 auto",borderRadius:999,background:s.accent}}),e("span",{children:p.data.title})]})),g?e(u,Object.assign({fallback:h},{children:e(g,{spec:p.data.spec},p.data.visualizationId)})):e("div",Object.assign({"aria-live":"polite",style:{opacity:.6}},{children:"Loading visualization…"}))]}))};export{p as default,c as parseVisualizationPart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{ActionApprovalPart as t}from"./ActionApprovalPart.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useRef as i,Suspense as o,lazy as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{ActionApprovalPart as t}from"./ActionApprovalPart.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useRef as i,Suspense as o,lazy as r}from"react";import{PickaxeMarkdownRenderer as s}from"../PickaxeMarkdown/Renderer.js";import a,{isGeneratedFileUrl as l,normalizeMarkdownUrl as c,getFilePreviewInfo as p,shouldSuppressRichPreviewForUrl as u,shouldRenderFilePreview as m}from"../PickaxeMarkdown/Components/A/FilePreview.js";import{safeJSONParse as d}from"../../../../common/utils.js";import f from"../../../../common/cn.js";const v=r((()=>import("./TextPart/index.js"))),g=r((()=>import("./ReasoningPart/index.js"))),w=r((()=>import("./ActionToolCaptionPart/index.js"))),y=r((()=>import("./ReasoningCaptionPart/index.js"))),h=r((()=>import("./VisualizationPart.js"))),j=/(!?)\[([^\]\n]+)\]\((https?:\/\/[^\s)]+|www\.[^\s)]+)\)/g,x=e=>{const t=new Set;for(const n of e){if("data-tool-assets"!==n.type)continue;const e=d(n.content);if(null==e?void 0:e.assets)for(const n of e.assets)n.value&&!l(n.value)&&t.add(c(n.value))}return t},k=({className:r,parts:l,isStreaming:k=!1,actionApproval:P})=>{const{actionApproval:b}=n(),R=null!=P?P:b,A=i(new Set);A.current=new Set;const N=x(l),S=l.reduce(((e,t,n)=>t.isVisible?n:e),-1);return e("div",Object.assign({className:f("flex flex-col gap-2",r)},{children:e(o,Object.assign({fallback:e("div",{})},{children:l.map(((n,i)=>{if(!n.isVisible)return null;if("data-action-approval"===n.type)return e(t,{content:n.content,isStreaming:k,approval:R},i);if("data-visualization"===n.type)return e(h,{content:n.content},i);if("text"===n.type){const t=((e,t,n)=>{var i,o;const r=[];let s=0;for(const a of e.matchAll(j)){const l=null!==(i=a.index)&&void 0!==i?i:0,d=a[0],f="!"===a[1],v=null===(o=a[2])||void 0===o?void 0:o.trim(),g=a[3],w=p(g);if(!w)continue;if(u(w.url,n))continue;l>s&&r.push({type:"markdown",value:e.slice(s,l)});const y=v&&c(v)!==w.url?v:void 0;m(w,t)?r.push({type:"preview",key:`${w.url}-${l}`,fileInfo:w,displayName:y}):r.push({type:"markdown",value:f?d:`[${v||w.fileName}](${w.url})`}),s=l+d.length}return s<e.length&&r.push({type:"markdown",value:e.slice(s)}),r.length?r:[{type:"markdown",value:e}]})(n.content,A,N);return e(v,{children:t.map(((t,n)=>"preview"===t.type?e(a,{fileInfo:t.fileInfo,displayName:t.displayName},t.key):t.value?e(s,{value:t.value,filePreviewSeenRef:A,suppressedRichPreviewUrls:N},n):null))},i)}if("reasoning"===n.type)return e(g,Object.assign({isReasoning:i===l.length-1},{children:e(s,{value:n.content,suppressedRichPreviewUrls:N})}),i);if("data-action-tool-caption"===n.type){const t=d(n.content),o=i===S;return e(w,Object.assign({},t&&t,{isLoading:k&&o,isVisible:o}),i)}if("data-reasoning-caption"===n.type){const t=d(n.content),o=i===S;return e(y,Object.assign({},t&&t,{isLoading:k&&o,isVisible:o}),i)}return null}))}))}))};export{k as default,x as getSuppressedRichPreviewUrls};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as s,jsxs as t,Fragment as o}from"react/jsx-runtime";import{usePickaxe as i}from"../../hooks/pickaxe/usePickaxe.js";import{useState as a,useMemo as r,useEffect as n,useCallback as l}from"react";import{usePickaxeContext as c}from"../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as d}from"./Addons/Auth/hooks/useAuthContext.js";import{useAuthBootstrap as u}from"./Addons/Auth/hooks/useAuthBootstrap.js";import{useResponseContext as m}from"../../hooks/pickaxe/useResponseContext.js";import{useDocumentContext as p}from"./Addons/Document/hooks/useDocumentContext.js";import{useArtifactContext as f}from"./Addons/Artifact/hooks/useArtifactContext.js";import{v4 as g}from"uuid";import{ScrollProvider as h}from"./Addons/Scroll/Provider.js";import x from"./common/PickaxeSkeleton.js";import v from"./Chat/index.js";import b from"./Form/index.js";import j from"./Addons/Auth/index.js";import k from"../../common/cn.js";import{pickaxeApi2 as y}from"../../common/api/pickaxe.js";import w from"../../common/error.js";import{getValidationFailure as N}from"../../common/validation.js";import O from"./common/AccessGroupCardPreview.js";import I from"./common/HorizontalScrollCue.js";import C from"./common/PickaxeButton.js";import{Avatar as A,AvatarImage as S,AvatarFallback as _}from"./common/PickaxeAvatar.js";import q from"../Icons/lock.svg.js";import{EmbeddedCheckoutProvider as U,EmbeddedCheckout as L}from"../../node_modules/.pnpm/@stripe_react-stripe-js@4.0.2_@stripe_stripe-js@7.9.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@stripe/react-stripe-js/dist/react-stripe.esm.mjs.js";import{loadStripe as P}from"../../node_modules/.pnpm/@stripe_stripe-js@7.9.0/node_modules/@stripe/stripe-js/dist/index.mjs.js";import{clearAuthenticatedEmbedSession as T,writeAuthenticatedEmbedSession as G,readAuthenticatedEmbedSession as R}from"../../common/embedSession.js";import{emitPendingEmbedCheckout as E,emitEmbedCheckout as B}from"../../common/embedAuthEvents.js";const D=({className:e})=>s("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e},{children:s("polyline",{points:"15 18 9 12 15 6"})})),M=({pickaxeId:M,className:V,embedView:$})=>{var F,z,H,W,J;const{sessionId:K,styles:X,colors:Y,responsiveBy:Q,deploymentType:Z,isNewChat:ee,isEmbed:se,opacity:te,deploymentId:oe,pickaxeId:ie,sender:ae,portalId:re,validationStatus:ne,validationUpgradeGroups:le,validationUpgradeUrl:ce,accessGroup:de,stripeAccountId:ue,clientSecret:me,translations:pe,preventInitialSessionId:fe,persistActiveConversation:ge,setClientSecret:he,setStripeAccountId:xe,setValidationStatus:ve,setValidationUpgradeGroups:be,setValidationUpgradeUrl:je,setContextId:ke,setPickaxeId:ye,setSessionId:we,setLastSessionId:Ne,setIsNewChat:Oe,setPickaxe:Ie,setAccessGroup:Ce}=c(),{emailInput:Ae,isSent:Se,token:_e,isAuthBootstrapComplete:qe}=d(),{setMessages:Ue,setResponse:Le,setError:Pe,setLimitData:Te,setIsSwitchedToChat:Ge}=m(),{setDocumentError:Re}=p(),{setCurrentArtifact:Ee}=f(),[Be,De]=a(!1),Me=i();u();const Ve=r((()=>{var e;return{deploymentId:oe,pickaxeId:ie,studioId:(null===(e=Me.data)||void 0===e?void 0:e.studioid)||""}}),[oe,null===(F=Me.data)||void 0===F?void 0:F.studioid,ie]);n((()=>{se&&Ve.pickaxeId&&Ve.studioId&&E(Ve,_e)}),[Ve,se,_e]);const $e=l((()=>{se&&Ve.pickaxeId&&Ve.studioId&&B(Ve,me||void 0)}),[Ve,me,se]),Fe=Boolean(se&&oe&&ge&&!fe&&(null===(z=Me.data)||void 0===z?void 0:z.chatflag)&&!Me.data.enablechatresponses),ze=Fe?_e:null,He=!Fe||qe,We="chat-input"===Z&&ee&&!Se,Je=r((()=>ue?P(process.env.NEXT_PUBLIC_STRIPE_KEY,{stripeAccount:ue}):null),[ue]);n((()=>{ye(M)}),[M]);n((()=>{if(!oe&&!re||!Me.data)return;if(!qe)return;if("stripe_checkout"===ne)return;e(void 0,void 0,void 0,(function*(){var e;ve("loading");try{const s=yield y.post("/access/validate",{data:{deploymentId:oe,sender:ae||void 0,studioSessionToken:_e,portalId:re,studioId:null===(e=Me.data)||void 0===e?void 0:e.studioid}});if(s.data.success)ve("success"),be([]),je(null),Ce(((e,s)=>e&&s?Object.assign(Object.assign({},e),{hideUpgradeOptions:!0}):e)(s.data.accessGroup,s.data.hideUpgradeOptions));else{const e=N(s.data);if(!e)return ve("login_required"),be([]),void je(null);ve(e.status),Ce(e.accessGroup),be(e.upgradeGroups),je(e.upgradeUrl),De(!0)}}catch(e){console.error("Failed to validate deployment:",e),ve("success")}}))}),[oe,qe,ae,_e,re,Me.data]),n((()=>{if(!Me.data)return;const s=Me.data;Ie(s);const t=s.chatflag;if(!He)return void De(!1);let o=!1;return e(void 0,void 0,void 0,(function*(){let e="";if(ze&&oe){const t={deploymentId:oe,pickaxeId:s.formid,authToken:ze},o=R(t);if(null==o?void 0:o.sessionId)try{const t=new URLSearchParams({pickaxeId:s.formid,sessionId:o.sessionId,deploymentId:oe,studioSessionToken:ze,resume:"true"});yield y.get(`/conversation?${t.toString()}`),e=o.sessionId}catch(e){T(t)}}o||(fe||(we(e||(t?g():"")),Ne(e),Oe(!e)),ke(g()),t?Ue([]):Le(null),Pe(""),Re(""),Te(null),Ee(null),Ge(!1),De(!0))})),()=>{o=!0}}),[Fe,oe,se,He,ze,ge,Me.data,fe]),n((()=>{var e;if(!se||!oe||!_e||!(null===(e=Me.data)||void 0===e?void 0:e.formid)||fe)return;const s={deploymentId:oe,pickaxeId:Me.data.formid,authToken:_e};ge&&Me.data.chatflag&&!Me.data.enablechatresponses&&!ee&&K?G(Object.assign(Object.assign({},s),{sessionId:K})):T(s)}),[oe,se,ee,ge,null===(H=Me.data)||void 0===H?void 0:H.chatflag,null===(W=Me.data)||void 0===W?void 0:W.enablechatresponses,null===(J=Me.data)||void 0===J?void 0:J.formid,fe,K,_e]),n((()=>{Pe(""),Re(""),Te(null),Ue([]),Le(null),Ee(null)}),[K]);const Ke=r((()=>{const e=null!=te?te:1;if(!Y.primary||!Y.primary.startsWith("#")||e<0||e>1)return Y.primary;const s=Math.round(255*e).toString(16).padStart(2,"0");return`${Y.primary}${s}`}),[Y.primary,te]);if(!Me.data)return null;const Xe=()=>{var o,i,a,r,n;if("stripe_checkout"===ne&&me&&Je)return t("div",Object.assign({className:"absolute inset-0 z-[999] flex flex-col w-full h-full overflow-hidden",style:{backgroundColor:Y.secondary||"#ffffff",color:Y.secondaryText||"#000000"}},{children:[s("div",Object.assign({className:"flex items-center p-4 border-b border-gray-100 shrink-0"},{children:t("button",Object.assign({onClick:()=>{he&&he(null),xe&&xe(null),ve("success")},className:"flex items-center gap-2 text-sm font-semibold opacity-70 hover:opacity-100 transition-opacity",style:{color:Y.text}},{children:[s(D,{className:"w-5 h-5"}),s("span",{children:(null==pe?void 0:pe.back)||"Back"})]}))})),s("div",Object.assign({className:"flex-1 w-full h-full overflow-y-auto [&>div]:h-full"},{children:s(U,Object.assign({stripe:Je,options:{clientSecret:me,onComplete:$e}},{children:s(L,{})}))}))]}));if(Me.isLoading||!Be||"loading"===ne)return s("div",Object.assign({className:k("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===Q?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:t("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[s(x,{className:"w-[72px] h-[72px]"}),s(x,{className:"h-[20px] mt-6 w-full"}),s(x,{className:"h-[20px] mt-2 w-full"}),s(x,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),s("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:s(x,{className:k("w-full min-h-[48px]","viewport"===Q?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))}));if("upgrade_required"===ne){const e=null==de?void 0:de.hideUpgradeOptions,r=!e&&le.length>0,n=!e&&(null===(o=null==de?void 0:de.upgrade)||void 0===o?void 0:o.isLinkToCustomURL)&&"string"==typeof de.upgrade.limitLink&&de.upgrade.limitLink.trim().length>0?de.upgrade.limitLink.trim():null,l="string"==typeof(null===(i=null==de?void 0:de.upgrade)||void 0===i?void 0:i.limitMessage)&&de.upgrade.limitMessage.trim().length>0?de.upgrade.limitMessage:(null==pe?void 0:pe["please-upgrade-to-continue-using-this-tool"])||"Please upgrade to continue using this tool.",c="string"==typeof(null===(a=null==de?void 0:de.upgrade)||void 0===a?void 0:a.limitCTA)&&de.upgrade.limitCTA.trim().length>0?de.upgrade.limitCTA:(null==pe?void 0:pe["pricing.upgrade"])||(null==pe?void 0:pe.upgrade)||"Upgrade";return s("div",Object.assign({className:"flex h-full min-h-0 w-full items-start justify-center overflow-y-auto p-4"},{children:t("div",n?Object.assign({className:"m-auto flex max-w-[640px] flex-col items-center gap-4 text-center"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==pe?void 0:pe["upgrade-required"])||"Upgrade Required"})),s("p",Object.assign({className:"opacity-80"},{children:l})),s(C,Object.assign({variant:"primary",className:"min-h-[40px] px-5 text-sm",onClick:()=>{window.open(n,"_blank","noopener,noreferrer")}},{children:c}))]}):r?Object.assign({className:"flex w-full max-w-4xl flex-col items-center gap-6 py-6"},{children:[t("div",Object.assign({className:"max-w-[640px] text-center"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2 break-words"},{children:(null==pe?void 0:pe["upgrade-required"])||"Upgrade Required"})),s("p",Object.assign({className:"break-words opacity-80"},{children:(null==pe?void 0:pe["please-upgrade-to-continue-using-this-tool"])||"Please upgrade to continue using this tool."}))]})),s(I,Object.assign({className:"w-full",contentClassName:k("gap-4 pb-4",le.length<=3&&("viewport"===Q?"min-[767px]:justify-center":"@[767px]/pickaxe-root:justify-center"))},{children:le.map(((e,t)=>s(O,{data:e,upgradeUrl:ce},e.accessGroupId||e.id||t)))}))]}):e?Object.assign({className:"m-auto flex max-w-[640px] flex-col items-center gap-4 text-center"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==pe?void 0:pe["upgrade-required"])||"Upgrade Required"})),s("p",Object.assign({className:"opacity-80"},{children:l}))]}):Object.assign({className:"m-auto flex max-w-[640px] flex-col items-center gap-4 text-center"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==pe?void 0:pe["access-locked"])||"Access Locked"})),s("p",Object.assign({className:"opacity-80"},{children:(null==pe?void 0:pe["this-tool-is-locked-contact-owner"])||"This tool is locked to use. Contact owner for more information."}))]}))}))}return"login_required"===ne&&se?s(j,{}):"login_required"!==ne||se?"access_denied"===ne?t("div",Object.assign({className:"flex flex-col items-center justify-center w-full h-full p-4 overflow-y-auto"},{children:[t(A,Object.assign({className:"h-[68px] w-[68px] mb-4"},{children:[s(S,{src:null===(r=Me.data)||void 0===r?void 0:r.coverphoto,alt:`${null===(n=Me.data)||void 0===n?void 0:n.formtitle} Logo`}),s(_,{})]})),t("div",Object.assign({className:"text-center mb-6"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==pe?void 0:pe["access-denied"])||"Access Denied"})),t("div",Object.assign({className:"w-[400px] text-xl flex justify-center items-start"},{children:[s(q,{className:"h-6 w-6 mr-[-20px] shrink-0"}),s("p",Object.assign({className:"ml-1"},{children:(null==pe?void 0:pe["no-access-request-access"])||"It looks like you don't have access to these resources. Please request access to continue."}))]}))]})),s("button",Object.assign({className:"px-6 py-2 font-medium rounded-md transition-colors",style:{backgroundColor:Y.accent,color:Y.accentText,borderRadius:X.cornerRadius},onClick:()=>{e(void 0,void 0,void 0,(function*(){var e,s;const t=(null==de?void 0:de.accessGroupId)?[de.accessGroupId]:[],o=Ae.trim().toLowerCase();if(o)try{const i=yield y.post("/access/request",{data:{email:o,studioId:null===(e=Me.data)||void 0===e?void 0:e.studioid,message:JSON.stringify({toolId:null===(s=Me.data)||void 0===s?void 0:s.formid,deploymentId:oe,accessGroupIds:t})}});i.data.success?alert((null==pe?void 0:pe["access-requested-successfully"])||"Successfully requested access!"):alert(i.data.error)}catch(e){const s=w(e);alert(((null==pe?void 0:pe["request-access-error"])||"Couldn't request access. Error: {error}").replace("{error}",s||String(e)))}else alert((null==pe?void 0:pe["email-address-cannot-be-empty"])||"Email address cannot be empty.")}))}},{children:(null==pe?void 0:pe["request-access"])||"Request Access"})),s("span",Object.assign({className:"mt-4 mb-2"},{children:(null==pe?void 0:pe.or)||"or"})),s("span",Object.assign({className:"font-medium text-lg"},{children:(null==pe?void 0:pe["sign-in-with-different-account"])||"Sign in with a different account"}))]})):s(h,K?{children:s(v,{})}:{children:s(b,{})}):s("div",Object.assign({className:"flex flex-col items-center justify-center w-full h-full p-4 overflow-y-auto"},{children:t("div",Object.assign({className:"text-center mb-8"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==pe?void 0:pe["access-denied"])||"Access Denied"})),s("p",Object.assign({className:"opacity-80"},{children:(null==pe?void 0:pe["login-is-required"])||"Login is required."}))]}))}))};return s("div",Object.assign({className:k("relative @container/pickaxe-root flex flex-col flex-grow w-full h-full","dark"===X.theme&&"dark",V),style:Object.assign({backgroundColor:We?"transparent":Ke,color:Y.text},X.font&&"Real Head Pro"!==X.font&&{fontFamily:X.font})},{children:se?t(o,{children:[s("div",Object.assign({style:{display:$?"none":"contents"},"aria-hidden":!!$||void 0},{children:Xe()})),$]}):Xe()}))};export{M as Pickaxe};
|
|
1
|
+
import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as s,jsxs as t,Fragment as o}from"react/jsx-runtime";import{usePickaxe as i}from"../../hooks/pickaxe/usePickaxe.js";import{useState as a,useMemo as r,useEffect as n,useCallback as l}from"react";import{usePickaxeContext as c}from"../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as d}from"./Addons/Auth/hooks/useAuthContext.js";import{useAuthBootstrap as m}from"./Addons/Auth/hooks/useAuthBootstrap.js";import{useResponseContext as u}from"../../hooks/pickaxe/useResponseContext.js";import{useDocumentContext as p}from"./Addons/Document/hooks/useDocumentContext.js";import{useArtifactContext as f}from"./Addons/Artifact/hooks/useArtifactContext.js";import{v4 as g}from"uuid";import{ScrollProvider as h}from"./Addons/Scroll/Provider.js";import x from"./common/PickaxeSkeleton.js";import v from"./Chat/index.js";import b from"./Form/index.js";import j from"./Addons/Auth/index.js";import k from"../../common/cn.js";import{pickaxeApi2 as y}from"../../common/api/pickaxe.js";import w from"../../common/error.js";import{getValidationFailure as N}from"../../common/validation.js";import O from"./common/AccessGroupCardPreview.js";import I from"./common/HorizontalScrollCue.js";import C from"./common/PickaxeButton.js";import{Avatar as A,AvatarImage as S,AvatarFallback as _}from"./common/PickaxeAvatar.js";import q from"../Icons/lock.svg.js";import{EmbeddedCheckoutProvider as U,EmbeddedCheckout as L}from"../../node_modules/.pnpm/@stripe_react-stripe-js@4.0.2_@stripe_stripe-js@7.9.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@stripe/react-stripe-js/dist/react-stripe.esm.mjs.js";import{loadStripe as P}from"../../node_modules/.pnpm/@stripe_stripe-js@7.9.0/node_modules/@stripe/stripe-js/dist/index.mjs.js";import{clearAuthenticatedEmbedSession as T,writeAuthenticatedEmbedSession as R,readAuthenticatedEmbedSession as G}from"../../common/embedSession.js";import{emitPendingEmbedCheckout as E,emitEmbedCheckout as B}from"../../common/embedAuthEvents.js";import{getEmbedAccessRequestReturnUrl as D}from"../../common/embedAccessRequest.js";const M=({className:e})=>s("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e},{children:s("polyline",{points:"15 18 9 12 15 6"})})),V=({pickaxeId:V,className:$,embedView:F})=>{var z,H,W,J,K;const{sessionId:X,styles:Y,colors:Q,responsiveBy:Z,deploymentType:ee,isNewChat:se,isEmbed:te,opacity:oe,deploymentId:ie,pickaxeId:ae,sender:re,portalId:ne,validationStatus:le,validationUpgradeGroups:ce,validationUpgradeUrl:de,accessGroup:me,stripeAccountId:ue,clientSecret:pe,translations:fe,preventInitialSessionId:ge,persistActiveConversation:he,setClientSecret:xe,setStripeAccountId:ve,setValidationStatus:be,setValidationUpgradeGroups:je,setValidationUpgradeUrl:ke,setContextId:ye,setPickaxeId:we,setSessionId:Ne,setLastSessionId:Oe,setIsNewChat:Ie,setPickaxe:Ce,setAccessGroup:Ae}=c(),{emailInput:Se,isSent:_e,token:qe,isAuthBootstrapComplete:Ue}=d(),{setMessages:Le,setResponse:Pe,setError:Te,setLimitData:Re,setIsSwitchedToChat:Ge}=u(),{setDocumentError:Ee}=p(),{setCurrentArtifact:Be}=f(),[De,Me]=a(!1),Ve=i();m();const $e=r((()=>{var e;return{deploymentId:ie,pickaxeId:ae,studioId:(null===(e=Ve.data)||void 0===e?void 0:e.studioid)||""}}),[ie,null===(z=Ve.data)||void 0===z?void 0:z.studioid,ae]);n((()=>{te&&$e.pickaxeId&&$e.studioId&&E($e,qe)}),[$e,te,qe]);const Fe=l((()=>{te&&$e.pickaxeId&&$e.studioId&&B($e,pe||void 0)}),[$e,pe,te]),ze=Boolean(te&&ie&&he&&!ge&&(null===(H=Ve.data)||void 0===H?void 0:H.chatflag)&&!Ve.data.enablechatresponses),He=ze?qe:null,We=!ze||Ue,Je="chat-input"===ee&&se&&!_e,Ke=r((()=>ue?P(process.env.NEXT_PUBLIC_STRIPE_KEY,{stripeAccount:ue}):null),[ue]);n((()=>{we(V)}),[V]);n((()=>{if(!ie&&!ne||!Ve.data)return;if(!Ue)return;if("stripe_checkout"===le)return;e(void 0,void 0,void 0,(function*(){var e;be("loading");try{const s=yield y.post("/access/validate",{data:{deploymentId:ie,sender:re||void 0,studioSessionToken:qe,portalId:ne,studioId:null===(e=Ve.data)||void 0===e?void 0:e.studioid}});if(s.data.success)be("success"),je([]),ke(null),Ae(((e,s)=>e&&s?Object.assign(Object.assign({},e),{hideUpgradeOptions:!0}):e)(s.data.accessGroup,s.data.hideUpgradeOptions));else{const e=N(s.data);if(!e)return be("login_required"),je([]),void ke(null);be(e.status),Ae(e.accessGroup),je(e.upgradeGroups),ke(e.upgradeUrl),Me(!0)}}catch(e){console.error("Failed to validate deployment:",e),be("success")}}))}),[ie,Ue,re,qe,ne,Ve.data]),n((()=>{if(!Ve.data)return;const s=Ve.data;Ce(s);const t=s.chatflag;if(!We)return void Me(!1);let o=!1;return e(void 0,void 0,void 0,(function*(){let e="";if(He&&ie){const t={deploymentId:ie,pickaxeId:s.formid,authToken:He},o=G(t);if(null==o?void 0:o.sessionId)try{const t=new URLSearchParams({pickaxeId:s.formid,sessionId:o.sessionId,deploymentId:ie,studioSessionToken:He,resume:"true"});yield y.get(`/conversation?${t.toString()}`),e=o.sessionId}catch(e){T(t)}}o||(ge||(Ne(e||(t?g():"")),Oe(e),Ie(!e)),ye(g()),t?Le([]):Pe(null),Te(""),Ee(""),Re(null),Be(null),Ge(!1),Me(!0))})),()=>{o=!0}}),[ze,ie,te,We,He,he,Ve.data,ge]),n((()=>{var e;if(!te||!ie||!qe||!(null===(e=Ve.data)||void 0===e?void 0:e.formid)||ge)return;const s={deploymentId:ie,pickaxeId:Ve.data.formid,authToken:qe};he&&Ve.data.chatflag&&!Ve.data.enablechatresponses&&!se&&X?R(Object.assign(Object.assign({},s),{sessionId:X})):T(s)}),[ie,te,se,he,null===(W=Ve.data)||void 0===W?void 0:W.chatflag,null===(J=Ve.data)||void 0===J?void 0:J.enablechatresponses,null===(K=Ve.data)||void 0===K?void 0:K.formid,ge,X,qe]),n((()=>{Te(""),Ee(""),Re(null),Le([]),Pe(null),Be(null)}),[X]);const Xe=r((()=>{const e=null!=oe?oe:1;if(!Q.primary||!Q.primary.startsWith("#")||e<0||e>1)return Q.primary;const s=Math.round(255*e).toString(16).padStart(2,"0");return`${Q.primary}${s}`}),[Q.primary,oe]);if(!Ve.data)return null;const Ye=()=>{var o,i,a,r,n;if("stripe_checkout"===le&&pe&&Ke)return t("div",Object.assign({className:"absolute inset-0 z-[999] flex flex-col w-full h-full overflow-hidden",style:{backgroundColor:Q.secondary||"#ffffff",color:Q.secondaryText||"#000000"}},{children:[s("div",Object.assign({className:"flex items-center p-4 border-b border-gray-100 shrink-0"},{children:t("button",Object.assign({onClick:()=>{xe&&xe(null),ve&&ve(null),be("success")},className:"flex items-center gap-2 text-sm font-semibold opacity-70 hover:opacity-100 transition-opacity",style:{color:Q.text}},{children:[s(M,{className:"w-5 h-5"}),s("span",{children:(null==fe?void 0:fe.back)||"Back"})]}))})),s("div",Object.assign({className:"flex-1 w-full h-full overflow-y-auto [&>div]:h-full"},{children:s(U,Object.assign({stripe:Ke,options:{clientSecret:pe,onComplete:Fe}},{children:s(L,{})}))}))]}));if(Ve.isLoading||!De||"loading"===le)return s("div",Object.assign({className:k("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===Z?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:t("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[s(x,{className:"w-[72px] h-[72px]"}),s(x,{className:"h-[20px] mt-6 w-full"}),s(x,{className:"h-[20px] mt-2 w-full"}),s(x,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),s("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:s(x,{className:k("w-full min-h-[48px]","viewport"===Z?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))}));if("upgrade_required"===le){const e=null==me?void 0:me.hideUpgradeOptions,r=!e&&ce.length>0,n=!e&&(null===(o=null==me?void 0:me.upgrade)||void 0===o?void 0:o.isLinkToCustomURL)&&"string"==typeof me.upgrade.limitLink&&me.upgrade.limitLink.trim().length>0?me.upgrade.limitLink.trim():null,l="string"==typeof(null===(i=null==me?void 0:me.upgrade)||void 0===i?void 0:i.limitMessage)&&me.upgrade.limitMessage.trim().length>0?me.upgrade.limitMessage:(null==fe?void 0:fe["please-upgrade-to-continue-using-this-tool"])||"Please upgrade to continue using this tool.",c="string"==typeof(null===(a=null==me?void 0:me.upgrade)||void 0===a?void 0:a.limitCTA)&&me.upgrade.limitCTA.trim().length>0?me.upgrade.limitCTA:(null==fe?void 0:fe["pricing.upgrade"])||(null==fe?void 0:fe.upgrade)||"Upgrade";return s("div",Object.assign({className:"flex h-full min-h-0 w-full items-start justify-center overflow-y-auto p-4"},{children:t("div",n?Object.assign({className:"m-auto flex max-w-[640px] flex-col items-center gap-4 text-center"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==fe?void 0:fe["upgrade-required"])||"Upgrade Required"})),s("p",Object.assign({className:"opacity-80"},{children:l})),s(C,Object.assign({variant:"primary",className:"min-h-[40px] px-5 text-sm",onClick:()=>{window.open(n,"_blank","noopener,noreferrer")}},{children:c}))]}):r?Object.assign({className:"flex w-full max-w-4xl flex-col items-center gap-6 py-6"},{children:[t("div",Object.assign({className:"max-w-[640px] text-center"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2 break-words"},{children:(null==fe?void 0:fe["upgrade-required"])||"Upgrade Required"})),s("p",Object.assign({className:"break-words opacity-80"},{children:(null==fe?void 0:fe["please-upgrade-to-continue-using-this-tool"])||"Please upgrade to continue using this tool."}))]})),s(I,Object.assign({className:"w-full",contentClassName:k("gap-4 pb-4",ce.length<=3&&("viewport"===Z?"min-[767px]:justify-center":"@[767px]/pickaxe-root:justify-center"))},{children:ce.map(((e,t)=>s(O,{data:e,upgradeUrl:de},e.accessGroupId||e.id||t)))}))]}):e?Object.assign({className:"m-auto flex max-w-[640px] flex-col items-center gap-4 text-center"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==fe?void 0:fe["upgrade-required"])||"Upgrade Required"})),s("p",Object.assign({className:"opacity-80"},{children:l}))]}):Object.assign({className:"m-auto flex max-w-[640px] flex-col items-center gap-4 text-center"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==fe?void 0:fe["access-locked"])||"Access Locked"})),s("p",Object.assign({className:"opacity-80"},{children:(null==fe?void 0:fe["this-tool-is-locked-contact-owner"])||"This tool is locked to use. Contact owner for more information."}))]}))}))}return"login_required"===le&&te?s(j,{}):"login_required"!==le||te?"access_denied"===le?t("div",Object.assign({className:"flex flex-col items-center justify-center w-full h-full p-4 overflow-y-auto"},{children:[t(A,Object.assign({className:"h-[68px] w-[68px] mb-4"},{children:[s(S,{src:null===(r=Ve.data)||void 0===r?void 0:r.coverphoto,alt:`${null===(n=Ve.data)||void 0===n?void 0:n.formtitle} Logo`}),s(_,{})]})),t("div",Object.assign({className:"text-center mb-6"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==fe?void 0:fe["access-denied"])||"Access Denied"})),t("div",Object.assign({className:"w-[400px] text-xl flex justify-center items-start"},{children:[s(q,{className:"h-6 w-6 mr-[-20px] shrink-0"}),s("p",Object.assign({className:"ml-1"},{children:(null==fe?void 0:fe["no-access-request-access"])||"It looks like you don't have access to these resources. Please request access to continue."}))]}))]})),s("button",Object.assign({className:"px-6 py-2 font-medium rounded-md transition-colors",style:{backgroundColor:Q.accent,color:Q.accentText,borderRadius:Y.cornerRadius},onClick:()=>{e(void 0,void 0,void 0,(function*(){var e,s;const t=(null==me?void 0:me.accessGroupId)?[me.accessGroupId]:[],o=Se.trim().toLowerCase();if(o)try{const i=yield y.post("/access/request",{data:{email:o,studioId:null===(e=Ve.data)||void 0===e?void 0:e.studioid,message:JSON.stringify(Object.assign(Object.assign({},te&&{type:"embed",returnUrl:D()}),{toolId:null===(s=Ve.data)||void 0===s?void 0:s.formid,deploymentId:ie,accessGroupIds:t}))}});i.data.success?alert((null==fe?void 0:fe["access-requested-successfully"])||"Successfully requested access!"):alert(i.data.error)}catch(e){const s=w(e);alert(((null==fe?void 0:fe["request-access-error"])||"Couldn't request access. Error: {error}").replace("{error}",s||String(e)))}else alert((null==fe?void 0:fe["email-address-cannot-be-empty"])||"Email address cannot be empty.")}))}},{children:(null==fe?void 0:fe["request-access"])||"Request Access"})),s("span",Object.assign({className:"mt-4 mb-2"},{children:(null==fe?void 0:fe.or)||"or"})),s("span",Object.assign({className:"font-medium text-lg"},{children:(null==fe?void 0:fe["sign-in-with-different-account"])||"Sign in with a different account"}))]})):s(h,X?{children:s(v,{})}:{children:s(b,{})}):s("div",Object.assign({className:"flex flex-col items-center justify-center w-full h-full p-4 overflow-y-auto"},{children:t("div",Object.assign({className:"text-center mb-8"},{children:[s("h2",Object.assign({className:"text-2xl font-bold mb-2"},{children:(null==fe?void 0:fe["access-denied"])||"Access Denied"})),s("p",Object.assign({className:"opacity-80"},{children:(null==fe?void 0:fe["login-is-required"])||"Login is required."}))]}))}))};return s("div",Object.assign({className:k("relative @container/pickaxe-root flex flex-col flex-grow w-full h-full","dark"===Y.theme&&"dark",$),style:Object.assign({backgroundColor:Je?"transparent":Xe,color:Q.text},Y.font&&"Real Head Pro"!==Y.font&&{fontFamily:Y.font})},{children:te?t(o,{children:[s("div",Object.assign({style:{display:F?"none":"contents"},"aria-hidden":!!F||void 0},{children:Ye()})),F]}):Ye()}))};export{V as Pickaxe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../_virtual/_tslib.js";import{useQuery as s}from"@tanstack/react-query";import{usePickaxeContext as t}from"./usePickaxeContext.js";import{useResponseContext as
|
|
1
|
+
import{__awaiter as e}from"../../_virtual/_tslib.js";import{useQuery as s}from"@tanstack/react-query";import{usePickaxeContext as t}from"./usePickaxeContext.js";import{useResponseContext as n}from"./useResponseContext.js";import{pickaxeApi2 as o}from"../../common/api/pickaxe.js";import{normalizeHistoryMessages as r}from"../../common/chatMessages.js";import{useAuthContext as i}from"../../components/Pickaxe/Addons/Auth/hooks/useAuthContext.js";const a=()=>{var a;const{pickaxeId:c,sessionId:d,deploymentId:m,sender:u,pickaxe:l,renderResponseAction:p}=t(),{token:g}=i(),{isGenerating:f,isSwitchedToChat:v}=n(),h="string"==typeof(null==l?void 0:l.intromessage)&&0===l.intromessage.trim().length,j=p?!f:!v,k=s({queryKey:["form",c,"chat",d,m,null!==(a=null!=g?g:u)&&void 0!==a?a:null,...p?["response-references"]:[]],queryFn:()=>e(void 0,void 0,void 0,(function*(){return((s,t,n,r,i,a=!1)=>e(void 0,void 0,void 0,(function*(){const e=new URLSearchParams(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({pickaxeId:s},a&&{includeResponseReferences:"true"}),{sessionId:t}),n&&{deploymentId:n}),r&&{sender:r}),i&&{studioSessionToken:i})),c=yield o.get(`/conversation?${e.toString()}`),d=c.data;if(200!==c.status)throw new Error("[_getChat] Failed to fetch chat conversation "+d);return d})))(c,d,m,g?void 0:u,null!=g?g:void 0,!!p)})),select:e=>{const s=r(e.messages),t=h?s.filter((e=>"intromessage"!==e.area)):s;return Object.assign(Object.assign({},e),{messages:t})},enabled:!!c&&!!d&&j,refetchInterval:!!(!!c&&!!d&&j&&!f)&&15e3,refetchIntervalInBackground:!1});return k};export{a as useConversation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{z as o}from"zod";const t=o.string().url().superRefine(((t,r)=>{if(!URL.canParse(t))return r.addIssue({code:o.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),o.NEVER})).refine((o=>{const t=new URL(o);return"javascript:"!==t.protocol&&"data:"!==t.protocol&&"vbscript:"!==t.protocol}),{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),r=o.object({resource:o.string().url(),authorization_servers:o.array(t).optional(),jwks_uri:o.string().url().optional(),scopes_supported:o.array(o.string()).optional(),bearer_methods_supported:o.array(o.string()).optional(),resource_signing_alg_values_supported:o.array(o.string()).optional(),resource_name:o.string().optional(),resource_documentation:o.string().optional(),resource_policy_uri:o.string().url().optional(),resource_tos_uri:o.string().url().optional(),tls_client_certificate_bound_access_tokens:o.boolean().optional(),authorization_details_types_supported:o.array(o.string()).optional(),dpop_signing_alg_values_supported:o.array(o.string()).optional(),dpop_bound_access_tokens_required:o.boolean().optional()}).passthrough(),n=o.object({issuer:o.string(),authorization_endpoint:t,token_endpoint:t,registration_endpoint:t.optional(),scopes_supported:o.array(o.string()).optional(),response_types_supported:o.array(o.string()),response_modes_supported:o.array(o.string()).optional(),grant_types_supported:o.array(o.string()).optional(),token_endpoint_auth_methods_supported:o.array(o.string()).optional(),token_endpoint_auth_signing_alg_values_supported:o.array(o.string()).optional(),service_documentation:t.optional(),revocation_endpoint:t.optional(),revocation_endpoint_auth_methods_supported:o.array(o.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:o.array(o.string()).optional(),introspection_endpoint:o.string().optional(),introspection_endpoint_auth_methods_supported:o.array(o.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:o.array(o.string()).optional(),code_challenge_methods_supported:o.array(o.string()).optional()}).passthrough(),e=o.object({issuer:o.string(),authorization_endpoint:t,token_endpoint:t,userinfo_endpoint:t.optional(),jwks_uri:t,registration_endpoint:t.optional(),scopes_supported:o.array(o.string()).optional(),response_types_supported:o.array(o.string()),response_modes_supported:o.array(o.string()).optional(),grant_types_supported:o.array(o.string()).optional(),acr_values_supported:o.array(o.string()).optional(),subject_types_supported:o.array(o.string()),id_token_signing_alg_values_supported:o.array(o.string()),id_token_encryption_alg_values_supported:o.array(o.string()).optional(),id_token_encryption_enc_values_supported:o.array(o.string()).optional(),userinfo_signing_alg_values_supported:o.array(o.string()).optional(),userinfo_encryption_alg_values_supported:o.array(o.string()).optional(),userinfo_encryption_enc_values_supported:o.array(o.string()).optional(),request_object_signing_alg_values_supported:o.array(o.string()).optional(),request_object_encryption_alg_values_supported:o.array(o.string()).optional(),request_object_encryption_enc_values_supported:o.array(o.string()).optional(),token_endpoint_auth_methods_supported:o.array(o.string()).optional(),token_endpoint_auth_signing_alg_values_supported:o.array(o.string()).optional(),display_values_supported:o.array(o.string()).optional(),claim_types_supported:o.array(o.string()).optional(),claims_supported:o.array(o.string()).optional(),service_documentation:o.string().optional(),claims_locales_supported:o.array(o.string()).optional(),ui_locales_supported:o.array(o.string()).optional(),claims_parameter_supported:o.boolean().optional(),request_parameter_supported:o.boolean().optional(),request_uri_parameter_supported:o.boolean().optional(),require_request_uri_registration:o.boolean().optional(),op_policy_uri:t.optional(),op_tos_uri:t.optional()}).passthrough(),i=e.merge(n.pick({code_challenge_methods_supported:!0})),a=o.object({access_token:o.string(),id_token:o.string().optional(),token_type:o.string(),expires_in:o.number().optional(),scope:o.string().optional(),refresh_token:o.string().optional()}).strip(),s=o.object({error:o.string(),error_description:o.string().optional(),error_uri:o.string().optional()}),p=t.optional().or(o.literal("").transform((()=>{}))),_=o.object({redirect_uris:o.array(t),token_endpoint_auth_method:o.string().optional(),grant_types:o.array(o.string()).optional(),response_types:o.array(o.string()).optional(),client_name:o.string().optional(),client_uri:t.optional(),logo_uri:p,scope:o.string().optional(),contacts:o.array(o.string()).optional(),tos_uri:p,policy_uri:o.string().optional(),jwks_uri:t.optional(),jwks:o.any().optional(),software_id:o.string().optional(),software_version:o.string().optional(),software_statement:o.string().optional()}).strip(),l=o.object({client_id:o.string(),client_secret:o.string().optional(),client_id_issued_at:o.number().optional(),client_secret_expires_at:o.number().optional()}).strip(),u=_.merge(l);o.object({error:o.string(),error_description:o.string().optional()}).strip(),o.object({token:o.string(),token_type_hint:o.string().optional()}).strip();export{u as OAuthClientInformationFullSchema,l as OAuthClientInformationSchema,_ as OAuthClientMetadataSchema,s as OAuthErrorResponseSchema,n as OAuthMetadataSchema,r as OAuthProtectedResourceMetadataSchema,a as OAuthTokensSchema,i as OpenIdProviderDiscoveryMetadataSchema,e as OpenIdProviderMetadataSchema,p as OptionalSafeUrlSchema,t as SafeUrlSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{union as e,string as t,number as s,object as r,optional as o,literal as a,unknown as n,array as i,boolean as p,record as h,enum as d,discriminatedUnion as m}from"../../../../../../zod@3.25.76/node_modules/zod/v3/types.js";const u="2025-06-18",c=[u,"2025-03-26","2024-11-05","2024-10-07"],g="2.0",l=e([t(),s().int()]),x=t(),y=r({progressToken:o(l)}).passthrough(),f=r({_meta:o(y)}).passthrough(),b=r({method:t(),params:o(f)}),_=r({_meta:o(r({}).passthrough())}).passthrough(),v=r({method:t(),params:o(_)}),P=r({_meta:o(r({}).passthrough())}).passthrough(),T=e([t(),s().int()]),q=r({jsonrpc:a(g),id:T}).merge(b).strict(),C=e=>q.safeParse(e).success,I=r({jsonrpc:a(g)}).merge(v).strict(),j=e=>I.safeParse(e).success,E=r({jsonrpc:a(g),id:T,result:P}).strict(),S=e=>E.safeParse(e).success;var k;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(k||(k={}));const M=r({jsonrpc:a(g),id:T,error:r({code:s().int(),message:t(),data:o(n())})}).strict(),R=e=>M.safeParse(e).success,z=e([q,I,E,M]),H=P.strict(),w=v.extend({method:a("notifications/cancelled"),params:_.extend({requestId:T,reason:t().optional()})}),L=r({src:t(),mimeType:o(t()),sizes:o(i(t()))}).passthrough(),N=r({icons:i(L).optional()}).passthrough(),F=r({name:t(),title:o(t())}).passthrough(),U=F.extend({version:t(),websiteUrl:o(t())}).merge(N),V=r({experimental:o(r({}).passthrough()),sampling:o(r({}).passthrough()),elicitation:o(r({}).passthrough()),roots:o(r({listChanged:o(p())}).passthrough())}).passthrough(),W=b.extend({method:a("initialize"),params:f.extend({protocolVersion:t(),capabilities:V,clientInfo:U})}),$=r({experimental:o(r({}).passthrough()),logging:o(r({}).passthrough()),completions:o(r({}).passthrough()),prompts:o(r({listChanged:o(p())}).passthrough()),resources:o(r({subscribe:o(p()),listChanged:o(p())}).passthrough()),tools:o(r({listChanged:o(p())}).passthrough())}).passthrough(),B=P.extend({protocolVersion:t(),capabilities:$,serverInfo:U,instructions:o(t())}),O=v.extend({method:a("notifications/initialized")}),A=e=>O.safeParse(e).success,D=b.extend({method:a("ping")}),G=r({progress:s(),total:o(s()),message:o(t())}).passthrough(),J=v.extend({method:a("notifications/progress"),params:_.merge(G).extend({progressToken:l})}),K=b.extend({params:f.extend({cursor:o(x)}).optional()}),Q=P.extend({nextCursor:o(x)}),X=r({uri:t(),mimeType:o(t()),_meta:o(r({}).passthrough())}).passthrough(),Y=X.extend({text:t()}),Z=t().refine((e=>{try{return atob(e),!0}catch(e){return!1}}),{message:"Invalid Base64 string"}),ee=X.extend({blob:Z}),te=F.extend({uri:t(),description:o(t()),mimeType:o(t()),_meta:o(r({}).passthrough())}).merge(N),se=F.extend({uriTemplate:t(),description:o(t()),mimeType:o(t()),_meta:o(r({}).passthrough())}).merge(N),re=K.extend({method:a("resources/list")}),oe=Q.extend({resources:i(te)}),ae=K.extend({method:a("resources/templates/list")}),ne=Q.extend({resourceTemplates:i(se)}),ie=b.extend({method:a("resources/read"),params:f.extend({uri:t()})}),pe=P.extend({contents:i(e([Y,ee]))}),he=v.extend({method:a("notifications/resources/list_changed")}),de=b.extend({method:a("resources/subscribe"),params:f.extend({uri:t()})}),me=b.extend({method:a("resources/unsubscribe"),params:f.extend({uri:t()})}),ue=v.extend({method:a("notifications/resources/updated"),params:_.extend({uri:t()})}),ce=r({name:t(),description:o(t()),required:o(p())}).passthrough(),ge=F.extend({description:o(t()),arguments:o(i(ce)),_meta:o(r({}).passthrough())}).merge(N),le=K.extend({method:a("prompts/list")}),xe=Q.extend({prompts:i(ge)}),ye=b.extend({method:a("prompts/get"),params:f.extend({name:t(),arguments:o(h(t()))})}),fe=r({type:a("text"),text:t(),_meta:o(r({}).passthrough())}).passthrough(),be=r({type:a("image"),data:Z,mimeType:t(),_meta:o(r({}).passthrough())}).passthrough(),_e=r({type:a("audio"),data:Z,mimeType:t(),_meta:o(r({}).passthrough())}).passthrough(),ve=r({type:a("resource"),resource:e([Y,ee]),_meta:o(r({}).passthrough())}).passthrough(),Pe=te.extend({type:a("resource_link")}),Te=e([fe,be,_e,Pe,ve]),qe=r({role:d(["user","assistant"]),content:Te}).passthrough(),Ce=P.extend({description:o(t()),messages:i(qe)}),Ie=v.extend({method:a("notifications/prompts/list_changed")}),je=r({title:o(t()),readOnlyHint:o(p()),destructiveHint:o(p()),idempotentHint:o(p()),openWorldHint:o(p())}).passthrough(),Ee=F.extend({description:o(t()),inputSchema:r({type:a("object"),properties:o(r({}).passthrough()),required:o(i(t()))}).passthrough(),outputSchema:o(r({type:a("object"),properties:o(r({}).passthrough()),required:o(i(t()))}).passthrough()),annotations:o(je),_meta:o(r({}).passthrough())}).merge(N),Se=K.extend({method:a("tools/list")}),ke=Q.extend({tools:i(Ee)}),Me=P.extend({content:i(Te).default([]),structuredContent:r({}).passthrough().optional(),isError:o(p())});Me.or(P.extend({toolResult:n()}));const Re=b.extend({method:a("tools/call"),params:f.extend({name:t(),arguments:o(h(n()))})}),ze=v.extend({method:a("notifications/tools/list_changed")}),He=d(["debug","info","notice","warning","error","critical","alert","emergency"]),we=b.extend({method:a("logging/setLevel"),params:f.extend({level:He})}),Le=v.extend({method:a("notifications/message"),params:_.extend({level:He,logger:o(t()),data:n()})}),Ne=r({name:t().optional()}).passthrough(),Fe=r({hints:o(i(Ne)),costPriority:o(s().min(0).max(1)),speedPriority:o(s().min(0).max(1)),intelligencePriority:o(s().min(0).max(1))}).passthrough(),Ue=r({role:d(["user","assistant"]),content:e([fe,be,_e])}).passthrough(),Ve=b.extend({method:a("sampling/createMessage"),params:f.extend({messages:i(Ue),systemPrompt:o(t()),includeContext:o(d(["none","thisServer","allServers"])),temperature:o(s()),maxTokens:s().int(),stopSequences:o(i(t())),metadata:o(r({}).passthrough()),modelPreferences:o(Fe)})}),We=P.extend({model:t(),stopReason:o(d(["endTurn","stopSequence","maxTokens"]).or(t())),role:d(["user","assistant"]),content:m("type",[fe,be,_e])}),$e=r({type:a("boolean"),title:o(t()),description:o(t()),default:o(p())}).passthrough(),Be=r({type:a("string"),title:o(t()),description:o(t()),minLength:o(s()),maxLength:o(s()),format:o(d(["email","uri","date","date-time"]))}).passthrough(),Oe=r({type:d(["number","integer"]),title:o(t()),description:o(t()),minimum:o(s()),maximum:o(s())}).passthrough(),Ae=r({type:a("string"),title:o(t()),description:o(t()),enum:i(t()),enumNames:o(i(t()))}).passthrough(),De=e([$e,Be,Oe,Ae]),Ge=b.extend({method:a("elicitation/create"),params:f.extend({message:t(),requestedSchema:r({type:a("object"),properties:h(t(),De),required:o(i(t()))}).passthrough()})}),Je=P.extend({action:d(["accept","decline","cancel"]),content:o(h(t(),n()))}),Ke=r({type:a("ref/resource"),uri:t()}).passthrough(),Qe=r({type:a("ref/prompt"),name:t()}).passthrough(),Xe=b.extend({method:a("completion/complete"),params:f.extend({ref:e([Qe,Ke]),argument:r({name:t(),value:t()}).passthrough(),context:o(r({arguments:o(h(t(),t()))}))})}),Ye=P.extend({completion:r({values:i(t()).max(100),total:o(s().int()),hasMore:o(p())}).passthrough()}),Ze=r({uri:t().startsWith("file://"),name:o(t()),_meta:o(r({}).passthrough())}).passthrough(),et=b.extend({method:a("roots/list")}),tt=P.extend({roots:i(Ze)}),st=v.extend({method:a("notifications/roots/list_changed")});e([D,W,Xe,we,ye,le,re,ae,ie,de,me,Re,Se]),e([w,J,O,st]),e([H,We,Je,tt]),e([D,Ve,Ge,et]),e([w,J,Le,ue,he,ze,Ie]),e([H,B,Ye,Ce,xe,oe,ne,pe,Me,ke]);class rt extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}}export{_e as AudioContentSchema,F as BaseMetadataSchema,ee as BlobResourceContentsSchema,$e as BooleanSchemaSchema,Re as CallToolRequestSchema,Me as CallToolResultSchema,w as CancelledNotificationSchema,V as ClientCapabilitiesSchema,Xe as CompleteRequestSchema,Ye as CompleteResultSchema,Te as ContentBlockSchema,Ve as CreateMessageRequestSchema,We as CreateMessageResultSchema,x as CursorSchema,Ge as ElicitRequestSchema,Je as ElicitResultSchema,ve as EmbeddedResourceSchema,H as EmptyResultSchema,Ae as EnumSchemaSchema,k as ErrorCode,ye as GetPromptRequestSchema,Ce as GetPromptResultSchema,L as IconSchema,N as IconsSchema,be as ImageContentSchema,U as ImplementationSchema,W as InitializeRequestSchema,B as InitializeResultSchema,O as InitializedNotificationSchema,M as JSONRPCErrorSchema,z as JSONRPCMessageSchema,I as JSONRPCNotificationSchema,q as JSONRPCRequestSchema,E as JSONRPCResponseSchema,g as JSONRPC_VERSION,u as LATEST_PROTOCOL_VERSION,le as ListPromptsRequestSchema,xe as ListPromptsResultSchema,ae as ListResourceTemplatesRequestSchema,ne as ListResourceTemplatesResultSchema,re as ListResourcesRequestSchema,oe as ListResourcesResultSchema,et as ListRootsRequestSchema,tt as ListRootsResultSchema,Se as ListToolsRequestSchema,ke as ListToolsResultSchema,He as LoggingLevelSchema,Le as LoggingMessageNotificationSchema,rt as McpError,Ne as ModelHintSchema,Fe as ModelPreferencesSchema,v as NotificationSchema,Oe as NumberSchemaSchema,K as PaginatedRequestSchema,Q as PaginatedResultSchema,D as PingRequestSchema,De as PrimitiveSchemaDefinitionSchema,J as ProgressNotificationSchema,G as ProgressSchema,l as ProgressTokenSchema,ce as PromptArgumentSchema,Ie as PromptListChangedNotificationSchema,qe as PromptMessageSchema,Qe as PromptReferenceSchema,ge as PromptSchema,ie as ReadResourceRequestSchema,pe as ReadResourceResultSchema,T as RequestIdSchema,b as RequestSchema,X as ResourceContentsSchema,Pe as ResourceLinkSchema,he as ResourceListChangedNotificationSchema,te as ResourceSchema,Ke as ResourceTemplateReferenceSchema,se as ResourceTemplateSchema,ue as ResourceUpdatedNotificationSchema,P as ResultSchema,Ze as RootSchema,st as RootsListChangedNotificationSchema,c as SUPPORTED_PROTOCOL_VERSIONS,Ue as SamplingMessageSchema,$ as ServerCapabilitiesSchema,we as SetLevelRequestSchema,Be as StringSchemaSchema,de as SubscribeRequestSchema,fe as TextContentSchema,Y as TextResourceContentsSchema,je as ToolAnnotationsSchema,ze as ToolListChangedNotificationSchema,Ee as ToolSchema,me as UnsubscribeRequestSchema,A as isInitializedNotification,R as isJSONRPCError,j as isJSONRPCNotification,C as isJSONRPCRequest,S as isJSONRPCResponse};
|
|
1
|
+
import{z as t}from"zod";const e="2025-06-18",o=[e,"2025-03-26","2024-11-05","2024-10-07"],n="2.0",r=t.union([t.string(),t.number().int()]),a=t.string(),i=t.object({progressToken:t.optional(r)}).passthrough(),s=t.object({_meta:t.optional(i)}).passthrough(),l=t.object({method:t.string(),params:t.optional(s)}),p=t.object({_meta:t.optional(t.object({}).passthrough())}).passthrough(),c=t.object({method:t.string(),params:t.optional(p)}),u=t.object({_meta:t.optional(t.object({}).passthrough())}).passthrough(),g=t.union([t.string(),t.number().int()]),m=t.object({jsonrpc:t.literal(n),id:g}).merge(l).strict(),h=t=>m.safeParse(t).success,d=t.object({jsonrpc:t.literal(n)}).merge(c).strict(),b=t=>d.safeParse(t).success,x=t.object({jsonrpc:t.literal(n),id:g,result:u}).strict(),j=t=>x.safeParse(t).success;var y;!function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"}(y||(y={}));const f=t.object({jsonrpc:t.literal(n),id:g,error:t.object({code:t.number().int(),message:t.string(),data:t.optional(t.unknown())})}).strict(),_=t=>f.safeParse(t).success,v=t.union([m,d,x,f]),P=u.strict(),T=c.extend({method:t.literal("notifications/cancelled"),params:p.extend({requestId:g,reason:t.string().optional()})}),q=t.object({src:t.string(),mimeType:t.optional(t.string()),sizes:t.optional(t.array(t.string()))}).passthrough(),C=t.object({icons:t.array(q).optional()}).passthrough(),k=t.object({name:t.string(),title:t.optional(t.string())}).passthrough(),I=k.extend({version:t.string(),websiteUrl:t.optional(t.string())}).merge(C),w=t.object({experimental:t.optional(t.object({}).passthrough()),sampling:t.optional(t.object({}).passthrough()),elicitation:t.optional(t.object({}).passthrough()),roots:t.optional(t.object({listChanged:t.optional(t.boolean())}).passthrough())}).passthrough(),E=l.extend({method:t.literal("initialize"),params:s.extend({protocolVersion:t.string(),capabilities:w,clientInfo:I})}),S=t.object({experimental:t.optional(t.object({}).passthrough()),logging:t.optional(t.object({}).passthrough()),completions:t.optional(t.object({}).passthrough()),prompts:t.optional(t.object({listChanged:t.optional(t.boolean())}).passthrough()),resources:t.optional(t.object({subscribe:t.optional(t.boolean()),listChanged:t.optional(t.boolean())}).passthrough()),tools:t.optional(t.object({listChanged:t.optional(t.boolean())}).passthrough())}).passthrough(),M=u.extend({protocolVersion:t.string(),capabilities:S,serverInfo:I,instructions:t.optional(t.string())}),R=c.extend({method:t.literal("notifications/initialized")}),z=t=>R.safeParse(t).success,H=l.extend({method:t.literal("ping")}),L=t.object({progress:t.number(),total:t.optional(t.number()),message:t.optional(t.string())}).passthrough(),N=c.extend({method:t.literal("notifications/progress"),params:p.merge(L).extend({progressToken:r})}),F=l.extend({params:s.extend({cursor:t.optional(a)}).optional()}),U=u.extend({nextCursor:t.optional(a)}),V=t.object({uri:t.string(),mimeType:t.optional(t.string()),_meta:t.optional(t.object({}).passthrough())}).passthrough(),W=V.extend({text:t.string()}),$=t.string().refine((t=>{try{return atob(t),!0}catch(t){return!1}}),{message:"Invalid Base64 string"}),B=V.extend({blob:$}),O=k.extend({uri:t.string(),description:t.optional(t.string()),mimeType:t.optional(t.string()),_meta:t.optional(t.object({}).passthrough())}).merge(C),A=k.extend({uriTemplate:t.string(),description:t.optional(t.string()),mimeType:t.optional(t.string()),_meta:t.optional(t.object({}).passthrough())}).merge(C),D=F.extend({method:t.literal("resources/list")}),G=U.extend({resources:t.array(O)}),J=F.extend({method:t.literal("resources/templates/list")}),K=U.extend({resourceTemplates:t.array(A)}),Q=l.extend({method:t.literal("resources/read"),params:s.extend({uri:t.string()})}),X=u.extend({contents:t.array(t.union([W,B]))}),Y=c.extend({method:t.literal("notifications/resources/list_changed")}),Z=l.extend({method:t.literal("resources/subscribe"),params:s.extend({uri:t.string()})}),tt=l.extend({method:t.literal("resources/unsubscribe"),params:s.extend({uri:t.string()})}),et=c.extend({method:t.literal("notifications/resources/updated"),params:p.extend({uri:t.string()})}),ot=t.object({name:t.string(),description:t.optional(t.string()),required:t.optional(t.boolean())}).passthrough(),nt=k.extend({description:t.optional(t.string()),arguments:t.optional(t.array(ot)),_meta:t.optional(t.object({}).passthrough())}).merge(C),rt=F.extend({method:t.literal("prompts/list")}),at=U.extend({prompts:t.array(nt)}),it=l.extend({method:t.literal("prompts/get"),params:s.extend({name:t.string(),arguments:t.optional(t.record(t.string()))})}),st=t.object({type:t.literal("text"),text:t.string(),_meta:t.optional(t.object({}).passthrough())}).passthrough(),lt=t.object({type:t.literal("image"),data:$,mimeType:t.string(),_meta:t.optional(t.object({}).passthrough())}).passthrough(),pt=t.object({type:t.literal("audio"),data:$,mimeType:t.string(),_meta:t.optional(t.object({}).passthrough())}).passthrough(),ct=t.object({type:t.literal("resource"),resource:t.union([W,B]),_meta:t.optional(t.object({}).passthrough())}).passthrough(),ut=O.extend({type:t.literal("resource_link")}),gt=t.union([st,lt,pt,ut,ct]),mt=t.object({role:t.enum(["user","assistant"]),content:gt}).passthrough(),ht=u.extend({description:t.optional(t.string()),messages:t.array(mt)}),dt=c.extend({method:t.literal("notifications/prompts/list_changed")}),bt=t.object({title:t.optional(t.string()),readOnlyHint:t.optional(t.boolean()),destructiveHint:t.optional(t.boolean()),idempotentHint:t.optional(t.boolean()),openWorldHint:t.optional(t.boolean())}).passthrough(),xt=k.extend({description:t.optional(t.string()),inputSchema:t.object({type:t.literal("object"),properties:t.optional(t.object({}).passthrough()),required:t.optional(t.array(t.string()))}).passthrough(),outputSchema:t.optional(t.object({type:t.literal("object"),properties:t.optional(t.object({}).passthrough()),required:t.optional(t.array(t.string()))}).passthrough()),annotations:t.optional(bt),_meta:t.optional(t.object({}).passthrough())}).merge(C),jt=F.extend({method:t.literal("tools/list")}),yt=U.extend({tools:t.array(xt)}),ft=u.extend({content:t.array(gt).default([]),structuredContent:t.object({}).passthrough().optional(),isError:t.optional(t.boolean())});ft.or(u.extend({toolResult:t.unknown()}));const _t=l.extend({method:t.literal("tools/call"),params:s.extend({name:t.string(),arguments:t.optional(t.record(t.unknown()))})}),vt=c.extend({method:t.literal("notifications/tools/list_changed")}),Pt=t.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Tt=l.extend({method:t.literal("logging/setLevel"),params:s.extend({level:Pt})}),qt=c.extend({method:t.literal("notifications/message"),params:p.extend({level:Pt,logger:t.optional(t.string()),data:t.unknown()})}),Ct=t.object({name:t.string().optional()}).passthrough(),kt=t.object({hints:t.optional(t.array(Ct)),costPriority:t.optional(t.number().min(0).max(1)),speedPriority:t.optional(t.number().min(0).max(1)),intelligencePriority:t.optional(t.number().min(0).max(1))}).passthrough(),It=t.object({role:t.enum(["user","assistant"]),content:t.union([st,lt,pt])}).passthrough(),wt=l.extend({method:t.literal("sampling/createMessage"),params:s.extend({messages:t.array(It),systemPrompt:t.optional(t.string()),includeContext:t.optional(t.enum(["none","thisServer","allServers"])),temperature:t.optional(t.number()),maxTokens:t.number().int(),stopSequences:t.optional(t.array(t.string())),metadata:t.optional(t.object({}).passthrough()),modelPreferences:t.optional(kt)})}),Et=u.extend({model:t.string(),stopReason:t.optional(t.enum(["endTurn","stopSequence","maxTokens"]).or(t.string())),role:t.enum(["user","assistant"]),content:t.discriminatedUnion("type",[st,lt,pt])}),St=t.object({type:t.literal("boolean"),title:t.optional(t.string()),description:t.optional(t.string()),default:t.optional(t.boolean())}).passthrough(),Mt=t.object({type:t.literal("string"),title:t.optional(t.string()),description:t.optional(t.string()),minLength:t.optional(t.number()),maxLength:t.optional(t.number()),format:t.optional(t.enum(["email","uri","date","date-time"]))}).passthrough(),Rt=t.object({type:t.enum(["number","integer"]),title:t.optional(t.string()),description:t.optional(t.string()),minimum:t.optional(t.number()),maximum:t.optional(t.number())}).passthrough(),zt=t.object({type:t.literal("string"),title:t.optional(t.string()),description:t.optional(t.string()),enum:t.array(t.string()),enumNames:t.optional(t.array(t.string()))}).passthrough(),Ht=t.union([St,Mt,Rt,zt]),Lt=l.extend({method:t.literal("elicitation/create"),params:s.extend({message:t.string(),requestedSchema:t.object({type:t.literal("object"),properties:t.record(t.string(),Ht),required:t.optional(t.array(t.string()))}).passthrough()})}),Nt=u.extend({action:t.enum(["accept","decline","cancel"]),content:t.optional(t.record(t.string(),t.unknown()))}),Ft=t.object({type:t.literal("ref/resource"),uri:t.string()}).passthrough(),Ut=t.object({type:t.literal("ref/prompt"),name:t.string()}).passthrough(),Vt=l.extend({method:t.literal("completion/complete"),params:s.extend({ref:t.union([Ut,Ft]),argument:t.object({name:t.string(),value:t.string()}).passthrough(),context:t.optional(t.object({arguments:t.optional(t.record(t.string(),t.string()))}))})}),Wt=u.extend({completion:t.object({values:t.array(t.string()).max(100),total:t.optional(t.number().int()),hasMore:t.optional(t.boolean())}).passthrough()}),$t=t.object({uri:t.string().startsWith("file://"),name:t.optional(t.string()),_meta:t.optional(t.object({}).passthrough())}).passthrough(),Bt=l.extend({method:t.literal("roots/list")}),Ot=u.extend({roots:t.array($t)}),At=c.extend({method:t.literal("notifications/roots/list_changed")});t.union([H,E,Vt,Tt,it,rt,D,J,Q,Z,tt,_t,jt]),t.union([T,N,R,At]),t.union([P,Et,Nt,Ot]),t.union([H,wt,Lt,Bt]),t.union([T,N,qt,et,Y,vt,dt]),t.union([P,M,Wt,ht,at,G,K,X,ft,yt]);class Dt extends Error{constructor(t,e,o){super(`MCP error ${t}: ${e}`),this.code=t,this.data=o,this.name="McpError"}}export{pt as AudioContentSchema,k as BaseMetadataSchema,B as BlobResourceContentsSchema,St as BooleanSchemaSchema,_t as CallToolRequestSchema,ft as CallToolResultSchema,T as CancelledNotificationSchema,w as ClientCapabilitiesSchema,Vt as CompleteRequestSchema,Wt as CompleteResultSchema,gt as ContentBlockSchema,wt as CreateMessageRequestSchema,Et as CreateMessageResultSchema,a as CursorSchema,Lt as ElicitRequestSchema,Nt as ElicitResultSchema,ct as EmbeddedResourceSchema,P as EmptyResultSchema,zt as EnumSchemaSchema,y as ErrorCode,it as GetPromptRequestSchema,ht as GetPromptResultSchema,q as IconSchema,C as IconsSchema,lt as ImageContentSchema,I as ImplementationSchema,E as InitializeRequestSchema,M as InitializeResultSchema,R as InitializedNotificationSchema,f as JSONRPCErrorSchema,v as JSONRPCMessageSchema,d as JSONRPCNotificationSchema,m as JSONRPCRequestSchema,x as JSONRPCResponseSchema,n as JSONRPC_VERSION,e as LATEST_PROTOCOL_VERSION,rt as ListPromptsRequestSchema,at as ListPromptsResultSchema,J as ListResourceTemplatesRequestSchema,K as ListResourceTemplatesResultSchema,D as ListResourcesRequestSchema,G as ListResourcesResultSchema,Bt as ListRootsRequestSchema,Ot as ListRootsResultSchema,jt as ListToolsRequestSchema,yt as ListToolsResultSchema,Pt as LoggingLevelSchema,qt as LoggingMessageNotificationSchema,Dt as McpError,Ct as ModelHintSchema,kt as ModelPreferencesSchema,c as NotificationSchema,Rt as NumberSchemaSchema,F as PaginatedRequestSchema,U as PaginatedResultSchema,H as PingRequestSchema,Ht as PrimitiveSchemaDefinitionSchema,N as ProgressNotificationSchema,L as ProgressSchema,r as ProgressTokenSchema,ot as PromptArgumentSchema,dt as PromptListChangedNotificationSchema,mt as PromptMessageSchema,Ut as PromptReferenceSchema,nt as PromptSchema,Q as ReadResourceRequestSchema,X as ReadResourceResultSchema,g as RequestIdSchema,l as RequestSchema,V as ResourceContentsSchema,ut as ResourceLinkSchema,Y as ResourceListChangedNotificationSchema,O as ResourceSchema,Ft as ResourceTemplateReferenceSchema,A as ResourceTemplateSchema,et as ResourceUpdatedNotificationSchema,u as ResultSchema,$t as RootSchema,At as RootsListChangedNotificationSchema,o as SUPPORTED_PROTOCOL_VERSIONS,It as SamplingMessageSchema,S as ServerCapabilitiesSchema,Tt as SetLevelRequestSchema,Mt as StringSchemaSchema,Z as SubscribeRequestSchema,st as TextContentSchema,W as TextResourceContentsSchema,bt as ToolAnnotationsSchema,vt as ToolListChangedNotificationSchema,xt as ToolSchema,tt as UnsubscribeRequestSchema,z as isInitializedNotification,_ as isJSONRPCError,b as isJSONRPCNotification,h as isJSONRPCRequest,j as isJSONRPCResponse};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getEmbedAccessRequestReturnUrl: () => string | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type JsonRenderElement = {
|
|
2
|
+
type: string;
|
|
3
|
+
props: Record<string, unknown>;
|
|
4
|
+
children: string[];
|
|
5
|
+
visible?: unknown;
|
|
6
|
+
on?: Record<string, JsonRenderActionBinding>;
|
|
7
|
+
};
|
|
8
|
+
type JsonRenderActionBinding = {
|
|
9
|
+
action: "setState" | "pushState" | "removeState";
|
|
10
|
+
params: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
export type JsonRenderSpec = {
|
|
13
|
+
root: string;
|
|
14
|
+
elements: Record<string, JsonRenderElement>;
|
|
15
|
+
state?: Record<string, unknown>;
|
|
16
|
+
};
|
|
17
|
+
export declare const PickaxeJsonRender: ({ spec }: {
|
|
18
|
+
spec: JsonRenderSpec;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
package/dist/esm/src/components/Pickaxe/common/PickaxeMessageParts/PickaxeJsonRenderCatalog.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export declare const PICKAXE_JSON_RENDER_CATALOG: {
|
|
2
|
+
readonly Column: {
|
|
3
|
+
readonly container: true;
|
|
4
|
+
readonly description: "Vertical stack layout";
|
|
5
|
+
};
|
|
6
|
+
readonly Row: {
|
|
7
|
+
readonly container: true;
|
|
8
|
+
readonly description: "Wrapping horizontal layout";
|
|
9
|
+
};
|
|
10
|
+
readonly Grid: {
|
|
11
|
+
readonly container: true;
|
|
12
|
+
readonly description: "Responsive grid layout";
|
|
13
|
+
};
|
|
14
|
+
readonly Card: {
|
|
15
|
+
readonly container: true;
|
|
16
|
+
readonly description: "Elevated content group";
|
|
17
|
+
};
|
|
18
|
+
readonly Section: {
|
|
19
|
+
readonly container: true;
|
|
20
|
+
readonly description: "Titled content section";
|
|
21
|
+
};
|
|
22
|
+
readonly Accordion: {
|
|
23
|
+
readonly container: true;
|
|
24
|
+
readonly description: "Collapsible content section";
|
|
25
|
+
};
|
|
26
|
+
readonly Text: {
|
|
27
|
+
readonly container: false;
|
|
28
|
+
readonly description: "Body or caption text";
|
|
29
|
+
};
|
|
30
|
+
readonly Heading: {
|
|
31
|
+
readonly container: false;
|
|
32
|
+
readonly description: "Semantic heading";
|
|
33
|
+
};
|
|
34
|
+
readonly Divider: {
|
|
35
|
+
readonly container: false;
|
|
36
|
+
readonly description: "Visual separator";
|
|
37
|
+
};
|
|
38
|
+
readonly Spacer: {
|
|
39
|
+
readonly container: false;
|
|
40
|
+
readonly description: "Responsive empty space";
|
|
41
|
+
};
|
|
42
|
+
readonly Badge: {
|
|
43
|
+
readonly container: false;
|
|
44
|
+
readonly description: "Compact status label";
|
|
45
|
+
};
|
|
46
|
+
readonly Alert: {
|
|
47
|
+
readonly container: false;
|
|
48
|
+
readonly description: "Highlighted message";
|
|
49
|
+
};
|
|
50
|
+
readonly Image: {
|
|
51
|
+
readonly container: false;
|
|
52
|
+
readonly description: "Remote image with alt text";
|
|
53
|
+
};
|
|
54
|
+
readonly Link: {
|
|
55
|
+
readonly container: false;
|
|
56
|
+
readonly description: "Safe external link";
|
|
57
|
+
};
|
|
58
|
+
readonly List: {
|
|
59
|
+
readonly container: false;
|
|
60
|
+
readonly description: "Ordered or unordered text list";
|
|
61
|
+
};
|
|
62
|
+
readonly Table: {
|
|
63
|
+
readonly container: false;
|
|
64
|
+
readonly description: "Tabular records with columns";
|
|
65
|
+
};
|
|
66
|
+
readonly NumberInput: {
|
|
67
|
+
readonly container: false;
|
|
68
|
+
readonly description: "Bound numeric input";
|
|
69
|
+
};
|
|
70
|
+
readonly Slider: {
|
|
71
|
+
readonly container: false;
|
|
72
|
+
readonly description: "Bound numeric range input";
|
|
73
|
+
};
|
|
74
|
+
readonly TextInput: {
|
|
75
|
+
readonly container: false;
|
|
76
|
+
readonly description: "Bound single-line text input";
|
|
77
|
+
};
|
|
78
|
+
readonly TextArea: {
|
|
79
|
+
readonly container: false;
|
|
80
|
+
readonly description: "Bound multiline text input";
|
|
81
|
+
};
|
|
82
|
+
readonly Select: {
|
|
83
|
+
readonly container: false;
|
|
84
|
+
readonly description: "Bound option selector";
|
|
85
|
+
};
|
|
86
|
+
readonly Checkbox: {
|
|
87
|
+
readonly container: false;
|
|
88
|
+
readonly description: "Bound boolean checkbox";
|
|
89
|
+
};
|
|
90
|
+
readonly Toggle: {
|
|
91
|
+
readonly container: false;
|
|
92
|
+
readonly description: "Bound boolean switch";
|
|
93
|
+
};
|
|
94
|
+
readonly Button: {
|
|
95
|
+
readonly container: false;
|
|
96
|
+
readonly description: "Local state action button";
|
|
97
|
+
};
|
|
98
|
+
readonly Tabs: {
|
|
99
|
+
readonly container: false;
|
|
100
|
+
readonly description: "Bound tab selector";
|
|
101
|
+
};
|
|
102
|
+
readonly Metric: {
|
|
103
|
+
readonly container: false;
|
|
104
|
+
readonly description: "Key performance indicator";
|
|
105
|
+
};
|
|
106
|
+
readonly ProgressBar: {
|
|
107
|
+
readonly container: false;
|
|
108
|
+
readonly description: "Progress toward a maximum";
|
|
109
|
+
};
|
|
110
|
+
readonly Chart: {
|
|
111
|
+
readonly container: false;
|
|
112
|
+
readonly description: "Bar, line, area, scatter, pie, or labeled ternary positioning chart";
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export type PickaxeJsonRenderComponentType = keyof typeof PICKAXE_JSON_RENDER_CATALOG;
|
|
116
|
+
export declare const PICKAXE_JSON_RENDER_COMPONENT_TYPES: Set<string>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PickaxeVisualizationData } from "../../../../types/history";
|
|
2
|
+
type VisualizationResult = {
|
|
3
|
+
data: PickaxeVisualizationData;
|
|
4
|
+
error?: never;
|
|
5
|
+
} | {
|
|
6
|
+
data?: never;
|
|
7
|
+
error: string;
|
|
8
|
+
fallbackText: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const parseVisualizationPart: (content: string) => VisualizationResult;
|
|
12
|
+
declare const VisualizationPart: ({ content }: {
|
|
13
|
+
content: string;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default VisualizationPart;
|
|
@@ -40,7 +40,7 @@ export type PickaxeHistoryMessage = {
|
|
|
40
40
|
createdAt: string;
|
|
41
41
|
area?: PickaxeHistoryMessageArea;
|
|
42
42
|
};
|
|
43
|
-
export type PickaxeHistoryMessagePartsType = "text" | "reasoning" | "data-action-tool-caption" | "data-reasoning-caption" | "data-tool-assets" | "data-action-approval";
|
|
43
|
+
export type PickaxeHistoryMessagePartsType = "text" | "reasoning" | "data-action-tool-caption" | "data-reasoning-caption" | "data-tool-assets" | "data-visualization" | "data-action-approval";
|
|
44
44
|
export type PickaxeHistoryMessagePart = {
|
|
45
45
|
type: PickaxeHistoryMessagePartsType;
|
|
46
46
|
content: string;
|
|
@@ -73,10 +73,38 @@ export type PickaxeHistoryStreamDataReasoningCaption = {
|
|
|
73
73
|
caption: string;
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
+
export type PickaxeVisualizationData = {
|
|
77
|
+
visualizationId: string;
|
|
78
|
+
title: string;
|
|
79
|
+
fallbackText: string;
|
|
80
|
+
protocol: "json-render";
|
|
81
|
+
protocolVersion: "0.21";
|
|
82
|
+
surfaceId: string;
|
|
83
|
+
status: "ready" | "error";
|
|
84
|
+
spec: {
|
|
85
|
+
root: string;
|
|
86
|
+
elements: Record<string, {
|
|
87
|
+
type: string;
|
|
88
|
+
props: Record<string, unknown>;
|
|
89
|
+
children: string[];
|
|
90
|
+
visible?: unknown;
|
|
91
|
+
}>;
|
|
92
|
+
state?: Record<string, unknown>;
|
|
93
|
+
};
|
|
94
|
+
errors?: Array<{
|
|
95
|
+
code: string;
|
|
96
|
+
path: string;
|
|
97
|
+
message: string;
|
|
98
|
+
}>;
|
|
99
|
+
};
|
|
100
|
+
export type PickaxeHistoryStreamDataVisualization = {
|
|
101
|
+
type: "data-visualization";
|
|
102
|
+
data: PickaxeVisualizationData;
|
|
103
|
+
};
|
|
76
104
|
export type PickaxeHistoryStreamDataActionApproval = {
|
|
77
105
|
type: "data-action-approval";
|
|
78
106
|
data: ActionApprovalData;
|
|
79
107
|
};
|
|
80
|
-
export type PickaxeHistoryStreamData = PickaxeHistoryStreamDataActionApproval | PickaxeHistoryStreamDataActionToolCaption | PickaxeHistoryStreamDataReasoningCaption;
|
|
108
|
+
export type PickaxeHistoryStreamData = PickaxeHistoryStreamDataActionApproval | PickaxeHistoryStreamDataActionToolCaption | PickaxeHistoryStreamDataReasoningCaption | PickaxeHistoryStreamDataVisualization;
|
|
81
109
|
export type PickaxeHistoryStream = PickaxeHistoryStreamPartStartEnd | PickaxeHistoryStreamPartDelta | PickaxeHistoryStreamFinish | PickaxeHistoryStreamData;
|
|
82
110
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pickaxeproject/react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.24.1",
|
|
4
4
|
"description": "Client utility library for Pickaxe",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/runtime": "^7.20.7",
|
|
39
|
+
"@json-render/core": "0.1.0",
|
|
39
40
|
"@modelcontextprotocol/sdk": "1.20.2",
|
|
40
41
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
41
42
|
"franc-min": "^6.2.0",
|
|
@@ -43,7 +44,8 @@
|
|
|
43
44
|
"lucide-react": "^0.563.0",
|
|
44
45
|
"pkce-challenge": "3.0.0",
|
|
45
46
|
"remove-markdown": "^0.6.3",
|
|
46
|
-
"tldts": "^7.0.23"
|
|
47
|
+
"tldts": "^7.0.23",
|
|
48
|
+
"zod": "3.25.76"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
51
|
"@babel/core": "^7.20.12",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("./helpers/util.js");const e=s.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class t extends Error{get errors(){return this.issues}constructor(s){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=s}format(s){const e=s||function(s){return s.message},t={_errors:[]},r=s=>{for(const i of s.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)t._errors.push(e(i));else{let s=t,r=0;for(;r<i.path.length;){const t=i.path[r];r===i.path.length-1?(s[t]=s[t]||{_errors:[]},s[t]._errors.push(e(i))):s[t]=s[t]||{_errors:[]},s=s[t],r++}}};return r(this),t}static assert(s){if(!(s instanceof t))throw new Error(`Not a ZodError: ${s}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,s.util.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(s=s=>s.message){const e={},t=[];for(const r of this.issues)if(r.path.length>0){const t=r.path[0];e[t]=e[t]||[],e[t].push(s(r))}else t.push(s(r));return{formErrors:t,fieldErrors:e}}get formErrors(){return this.flatten()}}t.create=s=>new t(s),exports.ZodError=t,exports.ZodIssueCode=e;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./locales/en.js");let r=e.default;exports.defaultErrorMap=e.default,exports.getErrorMap=function(){return r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.errorUtil=void 0,(e=exports.errorUtil||(exports.errorUtil={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../errors.js"),e=require("../locales/en.js");const s=t=>{const{data:e,path:s,errorMaps:a,issueData:r}=t,o=[...s,...r.path||[]],u={...r,path:o};if(void 0!==r.message)return{...r,path:o,message:r.message};let i="";const n=a.filter((t=>!!t)).slice().reverse();for(const t of n)i=t(u,{data:e,defaultError:i}).message;return{...r,path:o,message:i}};class a{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(t,e){const s=[];for(const a of e){if("aborted"===a.status)return r;"dirty"===a.status&&t.dirty(),s.push(a.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,e){const s=[];for(const t of e){const e=await t.key,a=await t.value;s.push({key:e,value:a})}return a.mergeObjectSync(t,s)}static mergeObjectSync(t,e){const s={};for(const a of e){const{key:e,value:o}=a;if("aborted"===e.status)return r;if("aborted"===o.status)return r;"dirty"===e.status&&t.dirty(),"dirty"===o.status&&t.dirty(),"__proto__"===e.value||void 0===o.value&&!a.alwaysSet||(s[e.value]=o.value)}return{status:t.value,value:s}}}const r=Object.freeze({status:"aborted"});exports.DIRTY=t=>({status:"dirty",value:t}),exports.INVALID=r,exports.OK=t=>({status:"valid",value:t}),exports.ParseStatus=a,exports.addIssueToContext=function(a,r){const o=t.getErrorMap(),u=s({issueData:r,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,o,o===e.default?void 0:e.default].filter((t=>!!t))});a.common.issues.push(u)},exports.isAborted=t=>"aborted"===t.status,exports.isAsync=t=>"undefined"!=typeof Promise&&t instanceof Promise,exports.isDirty=t=>"dirty"===t.status,exports.isValid=t=>"valid"===t.status,exports.makeIssue=s;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.util=void 0,(e=exports.util||(exports.util={})).assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,exports.objectUtil=void 0,(exports.objectUtil||(exports.objectUtil={})).mergeShapes=(e,t)=>({...e,...t});const t=exports.util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);exports.ZodParsedType=t,exports.getParsedType=e=>{switch(typeof e){case"undefined":return t.undefined;case"string":return t.string;case"number":return Number.isNaN(e)?t.nan:t.number;case"boolean":return t.boolean;case"function":return t.function;case"bigint":return t.bigint;case"symbol":return t.symbol;case"object":return Array.isArray(e)?t.array:null===e?t.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?t.promise:"undefined"!=typeof Map&&e instanceof Map?t.map:"undefined"!=typeof Set&&e instanceof Set?t.set:"undefined"!=typeof Date&&e instanceof Date?t.date:t.object;default:return t.unknown}};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../ZodError.js"),t=require("../helpers/util.js");var a=(a,i)=>{let n;switch(a.code){case e.ZodIssueCode.invalid_type:n=a.received===t.ZodParsedType.undefined?"Required":`Expected ${a.expected}, received ${a.received}`;break;case e.ZodIssueCode.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(a.expected,t.util.jsonStringifyReplacer)}`;break;case e.ZodIssueCode.unrecognized_keys:n=`Unrecognized key(s) in object: ${t.util.joinValues(a.keys,", ")}`;break;case e.ZodIssueCode.invalid_union:n="Invalid input";break;case e.ZodIssueCode.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${t.util.joinValues(a.options)}`;break;case e.ZodIssueCode.invalid_enum_value:n=`Invalid enum value. Expected ${t.util.joinValues(a.options)}, received '${a.received}'`;break;case e.ZodIssueCode.invalid_arguments:n="Invalid function arguments";break;case e.ZodIssueCode.invalid_return_type:n="Invalid function return type";break;case e.ZodIssueCode.invalid_date:n="Invalid date";break;case e.ZodIssueCode.invalid_string:"object"==typeof a.validation?"includes"in a.validation?(n=`Invalid input: must include "${a.validation.includes}"`,"number"==typeof a.validation.position&&(n=`${n} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?n=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?n=`Invalid input: must end with "${a.validation.endsWith}"`:t.util.assertNever(a.validation):n="regex"!==a.validation?`Invalid ${a.validation}`:"Invalid";break;case e.ZodIssueCode.too_small:n="array"===a.type?`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:"string"===a.type?`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:"number"===a.type||"bigint"===a.type?`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:"date"===a.type?`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:"Invalid input";break;case e.ZodIssueCode.too_big:n="array"===a.type?`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:"string"===a.type?`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:"number"===a.type?`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:"bigint"===a.type?`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:"date"===a.type?`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:"Invalid input";break;case e.ZodIssueCode.custom:n="Invalid input";break;case e.ZodIssueCode.invalid_intersection_types:n="Intersection results could not be merged";break;case e.ZodIssueCode.not_multiple_of:n=`Number must be a multiple of ${a.multipleOf}`;break;case e.ZodIssueCode.not_finite:n="Number must be finite";break;default:n=i.defaultError,t.util.assertNever(a)}return{message:n}};exports.default=a;
|