@ycodium-ai/plugin-pentest 0.2.5634 → 0.2.5763

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- var y=`
1
+ var b=`
2
2
  .pt-root, .pt-root * { box-sizing: border-box; }
3
3
  .pt-root {
4
4
  --pt-fg: var(--foreground, #14221c);
@@ -170,4 +170,4 @@ html[data-fit-content] .pt-seat-body { max-height: 240px; }
170
170
  .pt-root .pt-side { border-left: 0; border-top: 1px solid var(--pt-border); }
171
171
  .pt-root { max-height: none; }
172
172
  }
173
- `;var{jsx:n,jsxs:i,Fragment:w}=window.__ycodiumPluginHost.jsxRuntime;function B(t){let e=mt(t.presentation),o=t.colors;return i("article",{className:"pt-card-view",style:o===void 0?void 0:{color:o.foreground,background:o.surface,borderColor:o.border},children:[n("style",{children:y}),n("div",{className:"pt-kicker",children:t.t("board.title")}),n("h3",{children:e===null?t.t("card.summary"):t.t("card.recorded",{id:e.id})}),e!==null&&e.target.length>0?n("p",{children:e.target}):null,e!==null?n("p",{className:"pt-muted",children:t.t("board.counts",{intents:e.counts.intents,facts:e.counts.facts,findings:e.counts.findings,assets:e.counts.assets})}):null]})}function mt(t){let e=O(t);if(e===null||e.kind!=="pentest")return null;let o=O(e.counts);return o===null?null:{id:typeof e.id=="string"?e.id:"",target:typeof e.target=="string"?e.target:"",counts:{intents:T(o.intents),facts:T(o.facts),findings:T(o.findings),assets:T(o.assets)}}}function O(t){return ft(t)?t:null}function ft(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function T(t){return typeof t=="number"?t:0}var yt=window.__ycodiumPluginHost.react;var{Activity:At,Children:zt,Component:Dt,Fragment:Ut,Profiler:Mt,PureComponent:Ht,StrictMode:Gt,Suspense:Wt,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:Vt,__COMPILER_RUNTIME:jt,act:Ft,cache:$t,cacheSignal:Jt,captureOwnerStack:Yt,cloneElement:Kt,createContext:A,createElement:P,createRef:qt,forwardRef:Qt,isValidElement:Xt,lazy:Zt,memo:te,startTransition:ee,unstable_useCacheRefresh:ne,use:z,useActionState:oe,useCallback:re,useContext:ae,useDebugValue:ie,useDeferredValue:le,useEffect:de,useEffectEvent:se,useId:ce,useImperativeHandle:ue,useInsertionEffect:pe,useLayoutEffect:ge,useMemo:D,useOptimistic:me,useReducer:fe,useRef:ye,useState:b,useSyncExternalStore:be,useTransition:he,version:ve}=yt;var bt="pentest";var U="pentest",ht=["add_goal","add_intent","add_fact","add_finding","add_asset","state","graph","report","submit"],M="submit",H=t=>`${bt}_${t}`,we=new Set(ht.filter(t=>t!==M).map(t=>H(t))),Se=H(M);var G=A(null);function C(t){return P(G,{value:t.bridge},t.children)}var vt=new Set(["Collapsible","CollapsiblePanel","CollapsibleTrigger"]);function s(t){let e=o=>{let d=z(G)?.ui?.[t];return d===void 0?vt.has(t)?P("div",{className:o.className},o.children):null:P(d,o)};return e.displayName=t,e}var v=s("Button"),W=s("Input"),k=s("Label"),V=s("Select"),E=s("SelectItem"),j=s("SelectPopup"),F=s("SelectTrigger"),$=s("SelectValue"),J=s("SearchInput"),Y=s("Switch"),K=s("Collapsible"),q=s("CollapsibleTrigger"),Q=s("CollapsiblePanel"),x=s("EmptyInline"),X=s("ChevronDown"),Z=s("Tabs"),tt=s("TabsList"),et=s("TabsTab"),nt=s("TabsPanel");function I(t){let e=()=>t.onClick(),o=r=>{r.key!=="Enter"&&r.key!==" "||(r.preventDefault(),e())};return n("div",{role:"button",tabIndex:0,className:t.className,"data-tone":t.tone,"aria-pressed":t.selected,onClick:e,onKeyDown:o,children:t.children})}var xt=/[.!?。!?]$/u;function ot(t){let e=t.trimEnd();return xt.test(e)?e:`${e}.`}function N(t){if(typeof t!="object"||t===null)return null;let e=t,o=e.prefs;return typeof e.mounted!="boolean"||typeof e.report!="string"||typeof o!="object"||o===null?null:{mounted:e.mounted,graph:R(e.graph),related:Array.isArray(e.related)?e.related.flatMap(r=>{if(typeof r!="object"||r===null)return[];let a=r;return typeof a.threadId!="string"||typeof a.title!="string"?[]:[{threadId:a.threadId,title:a.title}]}):[],prefs:{windowLimit:typeof o.windowLimit=="number"?o.windowLimit:200,includeAuthorization:o.includeAuthorization!==!1},report:e.report}}function R(t){if(typeof t!="object"||t===null)return null;let e=t;return typeof e.goal!="object"||e.goal===null||!Array.isArray(e.nodes)||!Array.isArray(e.assets)||!Array.isArray(e.edges)?null:e}function rt(t){let e=new Map;t.goal!==null&&e.set(t.goal.id,0);for(let d=0;d<t.edges.length+1;d+=1)for(let c of t.edges){if(c.kind==="parent")continue;let p=e.get(c.sourceId);if(p===void 0)continue;let m=p+1,g=e.get(c.targetId);(g===void 0||m>g)&&e.set(c.targetId,m)}let o=new Map,r=(d,c)=>{let p=o.get(c)??[];p.push(d),o.set(c,p)};t.goal!==null&&r({id:t.goal.id,kind:"goal",title:t.goal.target,subtitle:t.goal.objective,tone:"goal"},0);for(let d of t.nodes)r(wt(d),e.get(d.id)??1);return[...o.keys()].sort((d,c)=>d-c).map(d=>o.get(d)??[])}function at(t,e){return t.edges.filter(o=>o.sourceId===e||o.targetId===e)}function _(t,e){let o=new Set(t.edges.filter(r=>r.kind==="parent"&&(e===null||r.sourceId===e)).map(r=>r.targetId));if(e===null){let r=new Set(t.edges.filter(a=>a.kind==="parent").map(a=>a.targetId));return t.assets.filter(a=>!r.has(a.id))}return t.assets.filter(r=>o.has(r.id))}function wt(t){return t.kind==="intent"?{id:t.id,kind:"intent",title:t.title,subtitle:t.detail,tone:"intent"}:t.kind==="fact"?{id:t.id,kind:"fact",title:t.detail,subtitle:t.factKind,tone:"fact"}:{id:t.id,kind:"finding",title:t.title,subtitle:t.severity,tone:t.severity}}function it(t){let[e,o]=b("explore"),[r,a]=b(null),[d,c]=b("all"),[p,m]=b("tree"),[g,h]=b(""),l=t.data.graph,f=["explore","findings","assets","report"];return i("section",{className:"pt-root","data-embedded":t.embedded?"":void 0,children:[n("style",{children:y}),i("header",{className:"pt-bar",children:[i("div",{className:"pt-goal",children:[n("strong",{children:l?.goal?.target??t.t("board.empty")}),l?.goal?n("span",{className:"pt-muted",children:l.goal.objective}):null]}),l?n("span",{className:"pt-muted",children:t.t("board.counts",{intents:l.totals.intents,facts:l.totals.facts,findings:l.totals.findings,assets:l.totals.assets})}):null]}),i(Z,{variant:"segmented",value:e,onValueChange:u=>{let S=f.find(gt=>gt===u);S&&o(S)},className:"contents",children:[n(tt,{className:"pt-tabs","aria-label":t.t("board.tabsLabel"),children:f.map(u=>n(et,{value:u,children:t.t(`board.tabs.${u}`)},u))}),l?.truncated?n("p",{className:"pt-banner",children:t.t("board.window",{shown:l.nodes.length+l.assets.length,total:l.totals.intents+l.totals.facts+l.totals.findings+l.totals.assets})}):null,i("div",{className:"pt-body",children:[i(nt,{value:e,className:"pt-main",children:[l===null?n(x,{title:t.t("board.empty")}):null,l!==null&&e==="explore"?n(St,{t:t.t,graph:l,selected:r,onSelect:a}):null,l!==null&&e==="findings"?n(Ct,{t:t.t,graph:l,severity:d,onSeverity:c,onSelect:a}):null,l!==null&&e==="assets"?n(kt,{t:t.t,graph:l,mode:p,query:g,onMode:m,onQuery:h,onSelect:a}):null,e==="report"?n(Nt,{t:t.t,markdown:t.data.report,onCopy:()=>t.onCopy(t.data.report),onDownload:()=>t.onDownload(t.data.report)}):null]}),i("aside",{className:"pt-side",children:[n(Tt,{t:t.t,graph:l,selected:r,onClose:()=>a(null)}),i("div",{children:[n("div",{className:"pt-kicker",children:t.t("board.related")}),t.data.related.length===0?n("p",{className:"pt-muted",children:t.t("board.relatedEmpty")}):null,t.data.related.map(u=>n(v,{size:"xs",variant:"outline",type:"button",onClick:()=>t.onOpenThread(u.threadId),children:u.title||t.t("board.open")},u.threadId))]}),l?.goal&&l.goal.authorization.length>0?i("p",{className:"pt-muted",children:[t.t("board.authorization"),": ",ot(l.goal.authorization)," ",t.t("board.authorizationHint")]}):null]})]})]})]})}function St(t){let e=D(()=>rt(t.graph),[t.graph]);return e.length===0?n("p",{className:"pt-list pt-muted",children:t.t("explore.empty")}):n("div",{className:"pt-columns",children:e.map((o,r)=>n("div",{className:"pt-column",children:o.map(a=>i(I,{className:"pt-card",tone:a.tone,selected:t.selected===a.id,onClick:()=>t.onSelect(a.id),children:[n("span",{className:"pt-kicker",children:t.t(`node.${a.kind}`)}),n("strong",{children:a.title}),a.subtitle.length>0?n("small",{children:a.subtitle}):null,n("span",{className:"pt-row",children:at(t.graph,a.id).slice(0,3).map(d=>n("span",{className:"pt-pill",children:t.t(`explore.edge.${d.kind}`)},d.id))})]},a.id))},o[0]?.id??String(r)))})}function Ct(t){let e=t.graph.nodes.filter(r=>r.kind==="finding"),o=t.severity==="all"?e:e.filter(r=>r.severity===t.severity);return i("div",{className:"pt-list",children:[i(k,{className:"pt-row",children:[t.t("findings.filter"),i(V,{value:t.severity,onValueChange:r=>t.onSeverity(r),children:[n(F,{size:"xs","aria-label":t.t("findings.filter"),children:n($,{})}),i(j,{children:[n(E,{value:"all",children:t.t("findings.all")}),["critical","high","medium","low","info"].map(r=>n(E,{value:r,children:t.t(`severity.${r}`)},r))]})]})]}),o.length===0?n(x,{title:t.t("findings.empty")}):null,o.map(r=>i("article",{className:"pt-finding",children:[i("div",{className:"pt-row",children:[n("span",{className:"pt-pill",children:t.t(`severity.${r.severity}`)}),n("h3",{children:r.title})]}),n("p",{className:"pt-muted",children:r.intentId}),r.description.length>0?n("p",{children:r.description}):null,n("div",{className:"pt-kicker",children:t.t("node.steps")}),n("ol",{children:r.steps.map(a=>n("li",{children:a},a))}),r.affectedAssetId?n(v,{size:"xs",variant:"outline",type:"button",onClick:()=>t.onSelect(r.affectedAssetId??r.id),children:t.t("findings.affected")}):null]},r.id))]})}function kt(t){let e=t.query.trim().toLowerCase(),o=t.graph.assets.filter(r=>e.length===0||r.value.toLowerCase().includes(e));return i("div",{className:"pt-list",children:[i("div",{className:"pt-row",children:[n(v,{size:"xs",variant:"outline",type:"button","aria-pressed":t.mode==="list",onClick:()=>t.onMode("list"),children:t.t("assets.list")}),n(v,{size:"xs",variant:"outline",type:"button","aria-pressed":t.mode==="tree",onClick:()=>t.onMode("tree"),children:t.t("assets.tree")}),n(J,{value:t.query,size:"sm",variant:"ghost","aria-label":t.t("assets.filter"),placeholder:t.t("assets.filter"),onValueChange:t.onQuery})]}),o.length===0?n(x,{title:t.t("assets.empty")}):null,t.mode==="list"?o.map(r=>i(I,{className:"pt-asset",onClick:()=>t.onSelect(r.id),children:[n("span",{className:"pt-kicker",children:t.t(`assetType.${r.type}`)}),n("strong",{children:r.value}),r.meta.length>0?n("small",{className:"pt-muted",children:r.meta}):null]},r.id)):_(t.graph,null).map(r=>n(lt,{t:t.t,graph:t.graph,id:r.id,depth:0,onSelect:t.onSelect},r.id))]})}function lt(t){let e=t.graph.assets.find(o=>o.id===t.id);return e===void 0?null:i("div",{className:"pt-tree-item",style:{marginLeft:t.depth*14},children:[i(I,{className:"pt-asset",onClick:()=>t.onSelect(e.id),children:[n("span",{className:"pt-kicker",children:t.t(`assetType.${e.type}`)}),n("strong",{children:e.value})]}),_(t.graph,e.id).map(o=>n(lt,{t:t.t,graph:t.graph,id:o.id,depth:t.depth+1,onSelect:t.onSelect},o.id))]})}function Nt(t){return i("div",{className:"pt-list",children:[i("div",{className:"pt-row",children:[n(v,{size:"xs",type:"button",onClick:t.onCopy,children:t.t("report.copy")}),n(v,{size:"xs",variant:"outline",type:"button",onClick:t.onDownload,children:t.t("report.download")})]}),n("div",{className:"pt-report",children:n("pre",{children:t.markdown.length>0?t.markdown:t.t("report.empty")})})]})}function Tt(t){if(t.graph===null||t.selected===null)return n("p",{className:"pt-muted",children:t.t("explore.empty")});let e=t.graph.goal?.id===t.selected?t.graph.goal:null,o=t.graph.nodes.find(a=>a.id===t.selected),r=t.graph.assets.find(a=>a.id===t.selected);return i("div",{className:"pt-detail",children:[i("div",{className:"pt-row",children:[n("span",{className:"pt-kicker",children:t.selected}),n(v,{size:"xs",variant:"outline",type:"button",onClick:t.onClose,children:t.t("node.close")})]}),e?i(w,{children:[n("h3",{children:e.target}),n("p",{children:e.objective})]}):null,o?.kind==="intent"?i(w,{children:[n("h3",{children:o.title}),n("p",{children:o.detail})]}):null,o?.kind==="fact"?i(w,{children:[n("h3",{children:t.t(`factKind.${o.factKind}`)}),n("p",{children:o.detail}),n("p",{className:"pt-muted",children:t.t("node.confidence",{value:o.confidence})})]}):null,o?.kind==="finding"?i(w,{children:[n("h3",{children:o.title}),n("p",{children:o.description}),n("ol",{children:o.steps.map(a=>n("li",{children:a},a))})]}):null,r?i(w,{children:[n("h3",{children:r.value}),n("p",{className:"pt-muted",children:t.t(`assetType.${r.type}`)}),r.meta.length>0?n("p",{children:r.meta}):null]}):null]})}function dt(t){return i("section",{className:"pt-hero",children:[n("style",{children:y}),n("strong",{className:"pt-title",children:t.t("hero.title")}),n("p",{className:"pt-muted",children:t.target===null?t.t("hero.body"):t.t("hero.current",{target:t.target})})]})}function st(t){let[e,o]=b(""),r=t.data?.prefs;return i("section",{className:"pt-settings",children:[n("style",{children:y}),n("strong",{className:"pt-title",children:t.t("settings.title")}),i(k,{className:"pt-row",children:[t.t("settings.window"),n(W,{type:"number",min:20,max:200,"aria-label":t.t("settings.window"),value:r?.windowLimit??200,onChange:a=>{let d=Number(a.target.value);Number.isFinite(d)&&(t.onSave({windowLimit:d}),o(t.t("settings.saved")))}})]}),n("p",{className:"pt-muted",children:t.t("settings.windowHint")}),i(k,{className:"pt-row",children:[n(Y,{checked:r?.includeAuthorization!==!1,"aria-label":t.t("settings.authorization"),onCheckedChange:a=>{t.onSave({includeAuthorization:a}),o(t.t("settings.saved"))}}),t.t("settings.authorization")]}),e.length>0?n("p",{className:"pt-muted",children:e}):null]})}function L(t){let e=t.environmentId??null,o=t.threadId;return t.bridge.commands.useSubscription("live",{threadId:o&&o.length>0?o:"_"},e===null?{}:{environmentId:e})}function ct(t){let e=t.bridge.i18n.usePluginTranslation(),o=t.environmentId??null,r=t.threadId||null,a=o===null?{}:{environmentId:o},d=t.bridge.sessionProjections.useProjection("mounted",r,a),c=L(t),p=t.bridge.sessionProjections.useProjection("graph",r,a),m=d,g=N(c.data),h=g?.graph??R(p.value);if(t.presetId!==U||r===null)return null;let l=m.present&&m.value===!0||g?.mounted===!0,f=g??(l?{mounted:!0,graph:h,related:[],prefs:{windowLimit:200,includeAuthorization:!0},report:""}:null);return n(C,{bridge:t.bridge,children:i(K,{className:"pt-seat",defaultOpen:!0,children:[n("style",{children:y}),i(q,{className:"pt-seat-summary",children:[n(X,{className:"pt-seat-chevron"}),e("board.title")]}),n(Q,{children:n("div",{className:"pt-seat-body",children:d.isUnavailable||p.isUnavailable?n(x,{title:e("projection.unavailable")}):d.error!==null||p.error!==null?n(x,{title:e("projection.readFailed")}):l&&f!==null&&(f.graph!==null||g?.report!==void 0)?n(it,{t:e,data:{...f,graph:f.graph??h},embedded:It(),onOpenThread:u=>{o!==null&&t.bridge.openThread({environmentId:o,threadId:u})},onCopy:u=>{let S=navigator.clipboard;if(S===void 0){t.bridge.notify(e("report.copyFailed"),"warning");return}S.writeText(u).then(()=>t.bridge.notify(e("report.copied"),"success"),()=>t.bridge.notify(e("report.copyFailed"),"warning"))},onDownload:u=>Pt(u,e("report.download"))}):n(x,{title:e(g===null?"board.loading":"board.empty")})})})]})})}function ut(t){let e=t.bridge.i18n.usePluginTranslation(),o=L(t),r=N(o.data);return n(C,{bridge:t.bridge,children:n(dt,{t:e,target:r?.graph?.goal?.target??null})})}function pt(t){let e=t.bridge.i18n.usePluginTranslation(),o=t.environmentId??null,r=t.threadId??null,a=o===null?{}:{environmentId:o},d=L(t),[c,p]=b(null),m=c??N(d.data);return n(C,{bridge:t.bridge,children:n(st,{t:e,data:m,onSave:g=>{t.bridge.commands.invoke("preferences",{...g,...r?{threadId:r}:{}},a).then(h=>{let l=N(h);if(m!==null&&l===null&&typeof h=="object"&&h!==null){let f=h.prefs;f!==void 0&&p({...m,prefs:f})}})}})})}function Pt(t,e){let o=new Blob([t],{type:"text/markdown;charset=utf-8"}),r=URL.createObjectURL(o),a=document.createElement("a");a.href=r,a.download=e.endsWith(".md")?e:"assessment-record.md",a.click(),URL.revokeObjectURL(r)}function It(){return typeof window<"u"&&"ReactNativeWebView"in window}function Et(t){return{views:{card(e){return n(B,{...e,t:t.i18n.usePluginTranslation()})}},slots:[{name:"conversation.view",order:20,component(e){return n(ct,{bridge:t,...e})}},{name:"conversation.hero.agentPreset",order:20,component(e){return n(ut,{bridge:t,...e})}},{name:"settings.section",order:20,component(e){return n(pt,{bridge:t,...e})}}]}}export{Et as default};
173
+ `;var{jsx:n,jsxs:a,Fragment:x}=window.__ycodiumPluginHost.jsxRuntime;function z(e){let t=ye(e.presentation),r=e.colors;return a("article",{className:"pt-card-view",style:r===void 0?void 0:{color:r.foreground,background:r.surface,borderColor:r.border},children:[n("style",{children:b}),n("div",{className:"pt-kicker",children:e.t("board.title")}),n("h3",{children:t===null?e.t("card.summary"):e.t("card.recorded",{id:t.id})}),t!==null&&t.target.length>0?n("p",{children:t.target}):null,t!==null?n("p",{className:"pt-muted",children:e.t("board.counts",{intents:t.counts.intents,facts:t.counts.facts,findings:t.counts.findings,assets:t.counts.assets})}):null]})}function ye(e){let t=M(e);if(t===null||t.kind!=="pentest")return null;let r=M(t.counts);return r===null?null:{id:typeof t.id=="string"?t.id:"",target:typeof t.target=="string"?t.target:"",counts:{intents:N(r.intents),facts:N(r.facts),findings:N(r.findings),assets:N(r.assets)}}}function M(e){return be(e)?e:null}function be(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function N(e){return typeof e=="number"?e:0}var he=window.__ycodiumPluginHost.react;var{Activity:Ue,Children:Ke,Component:xe,Fragment:ve,Profiler:je,PureComponent:Je,StrictMode:Ye,Suspense:qe,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:Xe,__COMPILER_RUNTIME:Qe,act:Ze,cache:et,cacheSignal:tt,captureOwnerStack:nt,cloneElement:rt,createContext:O,createElement:E,createRef:ot,forwardRef:it,isValidElement:at,lazy:lt,memo:Se,startTransition:st,unstable_useCacheRefresh:dt,use:$,useActionState:ct,useCallback:B,useContext:ut,useDebugValue:pt,useDeferredValue:ft,useEffect:ke,useEffectEvent:gt,useId:mt,useImperativeHandle:yt,useInsertionEffect:we,useLayoutEffect:bt,useMemo:R,useOptimistic:ht,useReducer:xt,useRef:Ce,useState:m,useSyncExternalStore:Te,useTransition:vt,version:St}=he;var Ne="pentest";var F="pentest",Ee=["add_goal","add_intent","add_fact","add_finding","add_asset","state","graph","report","submit"],G="submit",H=e=>`${Ne}_${e}`,wt=new Set(Ee.filter(e=>e!==G).map(e=>H(e))),Ct=H(G);var W=O(null);function k(e){return E(W,{value:e.bridge},e.children)}var Ie=new Set(["Collapsible","CollapsiblePanel","CollapsibleTrigger"]);function d(e){let t=r=>{let s=$(W)?.ui?.[e];return s===void 0?Ie.has(e)?E("div",{className:r.className},r.children):null:E(s,r)};return t.displayName=e,t}var P="[a-zA-Z][a-zA-Z0-9:_-]*";var Re="ycodium",jt=`${Re}:`,Jt=new RegExp(String.raw`(^|\s)([$/])(${P})(?=\s|$)`,"g");var Yt=new RegExp(String.raw`([$/])(${P})(?=\s|$)`,"y");var qt=new RegExp(String.raw`^/(${P})$`);var v=d("Button"),V=d("Input"),C=d("Label"),U=d("Select"),A=d("SelectItem"),K=d("SelectPopup"),j=d("SelectTrigger"),J=d("SelectValue"),Y=d("SearchInput"),q=d("Switch"),X=d("Collapsible"),Q=d("CollapsibleTrigger"),Z=d("CollapsiblePanel"),S=d("EmptyInline"),ee=d("ChevronDown"),te=d("Tabs"),ne=d("TabsList"),re=d("TabsTab"),oe=d("TabsPanel");function I(e){let t=()=>e.onClick(),r=o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),t())};return n("div",{role:"button",tabIndex:0,className:e.className,"data-tone":e.tone,"aria-pressed":e.selected,onClick:t,onKeyDown:r,children:e.children})}var Pe=/[.!?。!?]$/u;function ie(e){let t=e.trimEnd();return Pe.test(t)?t:`${t}.`}function T(e){if(typeof e!="object"||e===null)return null;let t=e,r=t.prefs;return typeof t.mounted!="boolean"||typeof t.report!="string"||typeof r!="object"||r===null?null:{mounted:t.mounted,graph:_(t.graph),related:Array.isArray(t.related)?t.related.flatMap(o=>{if(typeof o!="object"||o===null)return[];let i=o;return typeof i.threadId!="string"||typeof i.title!="string"?[]:[{threadId:i.threadId,title:i.title}]}):[],prefs:{windowLimit:typeof r.windowLimit=="number"?r.windowLimit:200,includeAuthorization:r.includeAuthorization!==!1},report:t.report}}function _(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.goal!="object"||t.goal===null||!Array.isArray(t.nodes)||!Array.isArray(t.assets)||!Array.isArray(t.edges)?null:t}function ae(e){let t=new Map;e.goal!==null&&t.set(e.goal.id,0);for(let s=0;s<e.edges.length+1;s+=1)for(let c of e.edges){if(c.kind==="parent")continue;let p=t.get(c.sourceId);if(p===void 0)continue;let g=p+1,f=t.get(c.targetId);(f===void 0||g>f)&&t.set(c.targetId,g)}let r=new Map,o=(s,c)=>{let p=r.get(c)??[];p.push(s),r.set(c,p)};e.goal!==null&&o({id:e.goal.id,kind:"goal",title:e.goal.target,subtitle:e.goal.objective,tone:"goal"},0);for(let s of e.nodes)o(Ae(s),t.get(s.id)??1);return[...r.keys()].sort((s,c)=>s-c).map(s=>r.get(s)??[])}function le(e,t){return e.edges.filter(r=>r.sourceId===t||r.targetId===t)}function L(e,t){let r=new Set(e.edges.filter(o=>o.kind==="parent"&&(t===null||o.sourceId===t)).map(o=>o.targetId));if(t===null){let o=new Set(e.edges.filter(i=>i.kind==="parent").map(i=>i.targetId));return e.assets.filter(i=>!o.has(i.id))}return e.assets.filter(o=>r.has(o.id))}function Ae(e){return e.kind==="intent"?{id:e.id,kind:"intent",title:e.title,subtitle:e.detail,tone:"intent"}:e.kind==="fact"?{id:e.id,kind:"fact",title:e.detail,subtitle:e.factKind,tone:"fact"}:{id:e.id,kind:"finding",title:e.title,subtitle:e.severity,tone:e.severity}}function se(e){let[t,r]=m("explore"),[o,i]=m(null),[s,c]=m("all"),[p,g]=m("tree"),[f,h]=m(""),l=e.data.graph,y=["explore","findings","assets","report"];return a("section",{className:"pt-root","data-embedded":e.embedded?"":void 0,children:[n("style",{children:b}),a("header",{className:"pt-bar",children:[a("div",{className:"pt-goal",children:[n("strong",{children:l?.goal?.target??e.t("board.empty")}),l?.goal?n("span",{className:"pt-muted",children:l.goal.objective}):null]}),l?n("span",{className:"pt-muted",children:e.t("board.counts",{intents:l.totals.intents,facts:l.totals.facts,findings:l.totals.findings,assets:l.totals.assets})}):null]}),a(te,{variant:"segmented",value:t,onValueChange:u=>{let w=y.find(me=>me===u);w&&r(w)},className:"contents",children:[n(ne,{className:"pt-tabs","aria-label":e.t("board.tabsLabel"),children:y.map(u=>n(re,{value:u,children:e.t(`board.tabs.${u}`)},u))}),l?.truncated?n("p",{className:"pt-banner",children:e.t("board.window",{shown:l.nodes.length+l.assets.length,total:l.totals.intents+l.totals.facts+l.totals.findings+l.totals.assets})}):null,a("div",{className:"pt-body",children:[a(oe,{value:t,className:"pt-main",children:[l===null?n(S,{title:e.t("board.empty")}):null,l!==null&&t==="explore"?n(_e,{t:e.t,graph:l,selected:o,onSelect:i}):null,l!==null&&t==="findings"?n(Le,{t:e.t,graph:l,severity:s,onSeverity:c,onSelect:i}):null,l!==null&&t==="assets"?n(De,{t:e.t,graph:l,mode:p,query:f,onMode:g,onQuery:h,onSelect:i}):null,t==="report"?n(Me,{t:e.t,markdown:e.data.report,onCopy:()=>e.onCopy(e.data.report),onDownload:()=>e.onDownload(e.data.report)}):null]}),a("aside",{className:"pt-side",children:[n(ze,{t:e.t,graph:l,selected:o,onClose:()=>i(null)}),a("div",{children:[n("div",{className:"pt-kicker",children:e.t("board.related")}),e.data.related.length===0?n("p",{className:"pt-muted",children:e.t("board.relatedEmpty")}):null,e.data.related.map(u=>n(v,{size:"xs",variant:"outline",type:"button",onClick:()=>e.onOpenThread(u.threadId),children:u.title||e.t("board.open")},u.threadId))]}),l?.goal&&l.goal.authorization.length>0?a("p",{className:"pt-muted",children:[e.t("board.authorization"),": ",ie(l.goal.authorization)," ",e.t("board.authorizationHint")]}):null]})]})]})]})}function _e(e){let t=R(()=>ae(e.graph),[e.graph]);return t.length===0?n("p",{className:"pt-list pt-muted",children:e.t("explore.empty")}):n("div",{className:"pt-columns",children:t.map((r,o)=>n("div",{className:"pt-column",children:r.map(i=>a(I,{className:"pt-card",tone:i.tone,selected:e.selected===i.id,onClick:()=>e.onSelect(i.id),children:[n("span",{className:"pt-kicker",children:e.t(`node.${i.kind}`)}),n("strong",{children:i.title}),i.subtitle.length>0?n("small",{children:i.subtitle}):null,n("span",{className:"pt-row",children:le(e.graph,i.id).slice(0,3).map(s=>n("span",{className:"pt-pill",children:e.t(`explore.edge.${s.kind}`)},s.id))})]},i.id))},r[0]?.id??String(o)))})}function Le(e){let t=e.graph.nodes.filter(o=>o.kind==="finding"),r=e.severity==="all"?t:t.filter(o=>o.severity===e.severity);return a("div",{className:"pt-list",children:[a(C,{className:"pt-row",children:[e.t("findings.filter"),a(U,{value:e.severity,onValueChange:o=>e.onSeverity(o),children:[n(j,{size:"xs","aria-label":e.t("findings.filter"),children:n(J,{})}),a(K,{children:[n(A,{value:"all",children:e.t("findings.all")}),["critical","high","medium","low","info"].map(o=>n(A,{value:o,children:e.t(`severity.${o}`)},o))]})]})]}),r.length===0?n(S,{title:e.t("findings.empty")}):null,r.map(o=>a("article",{className:"pt-finding",children:[a("div",{className:"pt-row",children:[n("span",{className:"pt-pill",children:e.t(`severity.${o.severity}`)}),n("h3",{children:o.title})]}),n("p",{className:"pt-muted",children:o.intentId}),o.description.length>0?n("p",{children:o.description}):null,n("div",{className:"pt-kicker",children:e.t("node.steps")}),n("ol",{children:o.steps.map(i=>n("li",{children:i},i))}),o.affectedAssetId?n(v,{size:"xs",variant:"outline",type:"button",onClick:()=>e.onSelect(o.affectedAssetId??o.id),children:e.t("findings.affected")}):null]},o.id))]})}function De(e){let t=e.query.trim().toLowerCase(),r=e.graph.assets.filter(o=>t.length===0||o.value.toLowerCase().includes(t));return a("div",{className:"pt-list",children:[a("div",{className:"pt-row",children:[n(v,{size:"xs",variant:"outline",type:"button","aria-pressed":e.mode==="list",onClick:()=>e.onMode("list"),children:e.t("assets.list")}),n(v,{size:"xs",variant:"outline",type:"button","aria-pressed":e.mode==="tree",onClick:()=>e.onMode("tree"),children:e.t("assets.tree")}),n(Y,{value:e.query,size:"sm",variant:"ghost","aria-label":e.t("assets.filter"),placeholder:e.t("assets.filter"),onValueChange:e.onQuery})]}),r.length===0?n(S,{title:e.t("assets.empty")}):null,e.mode==="list"?r.map(o=>a(I,{className:"pt-asset",onClick:()=>e.onSelect(o.id),children:[n("span",{className:"pt-kicker",children:e.t(`assetType.${o.type}`)}),n("strong",{children:o.value}),o.meta.length>0?n("small",{className:"pt-muted",children:o.meta}):null]},o.id)):L(e.graph,null).map(o=>n(de,{t:e.t,graph:e.graph,id:o.id,depth:0,onSelect:e.onSelect},o.id))]})}function de(e){let t=e.graph.assets.find(r=>r.id===e.id);return t===void 0?null:a("div",{className:"pt-tree-item",style:{marginLeft:e.depth*14},children:[a(I,{className:"pt-asset",onClick:()=>e.onSelect(t.id),children:[n("span",{className:"pt-kicker",children:e.t(`assetType.${t.type}`)}),n("strong",{children:t.value})]}),L(e.graph,t.id).map(r=>n(de,{t:e.t,graph:e.graph,id:r.id,depth:e.depth+1,onSelect:e.onSelect},r.id))]})}function Me(e){return a("div",{className:"pt-list",children:[a("div",{className:"pt-row",children:[n(v,{size:"xs",type:"button",onClick:e.onCopy,children:e.t("report.copy")}),n(v,{size:"xs",variant:"outline",type:"button",onClick:e.onDownload,children:e.t("report.download")})]}),n("div",{className:"pt-report",children:n("pre",{children:e.markdown.length>0?e.markdown:e.t("report.empty")})})]})}function ze(e){if(e.graph===null||e.selected===null)return n("p",{className:"pt-muted",children:e.t("explore.empty")});let t=e.graph.goal?.id===e.selected?e.graph.goal:null,r=e.graph.nodes.find(i=>i.id===e.selected),o=e.graph.assets.find(i=>i.id===e.selected);return a("div",{className:"pt-detail",children:[a("div",{className:"pt-row",children:[n("span",{className:"pt-kicker",children:e.selected}),n(v,{size:"xs",variant:"outline",type:"button",onClick:e.onClose,children:e.t("node.close")})]}),t?a(x,{children:[n("h3",{children:t.target}),n("p",{children:t.objective})]}):null,r?.kind==="intent"?a(x,{children:[n("h3",{children:r.title}),n("p",{children:r.detail})]}):null,r?.kind==="fact"?a(x,{children:[n("h3",{children:e.t(`factKind.${r.factKind}`)}),n("p",{children:r.detail}),n("p",{className:"pt-muted",children:e.t("node.confidence",{value:r.confidence})})]}):null,r?.kind==="finding"?a(x,{children:[n("h3",{children:r.title}),n("p",{children:r.description}),n("ol",{children:r.steps.map(i=>n("li",{children:i},i))})]}):null,o?a(x,{children:[n("h3",{children:o.value}),n("p",{className:"pt-muted",children:e.t(`assetType.${o.type}`)}),o.meta.length>0?n("p",{children:o.meta}):null]}):null]})}function ce(e){return a("section",{className:"pt-hero",children:[n("style",{children:b}),n("strong",{className:"pt-title",children:e.t("hero.title")}),n("p",{className:"pt-muted",children:e.target===null?e.t("hero.body"):e.t("hero.current",{target:e.target})})]})}function ue(e){let[t,r]=m(""),o=e.data?.prefs;return a("section",{className:"pt-settings",children:[n("style",{children:b}),n("strong",{className:"pt-title",children:e.t("settings.title")}),a(C,{className:"pt-row",children:[e.t("settings.window"),n(V,{type:"number",min:20,max:200,"aria-label":e.t("settings.window"),value:o?.windowLimit??200,onChange:i=>{let s=Number(i.target.value);Number.isFinite(s)&&(e.onSave({windowLimit:s}),r(e.t("settings.saved")))}})]}),n("p",{className:"pt-muted",children:e.t("settings.windowHint")}),a(C,{className:"pt-row",children:[n(q,{checked:o?.includeAuthorization!==!1,"aria-label":e.t("settings.authorization"),onCheckedChange:i=>{e.onSave({includeAuthorization:i}),r(e.t("settings.saved"))}}),e.t("settings.authorization")]}),t.length>0?n("p",{className:"pt-muted",children:t}):null]})}function D(e){let t=e.environmentId??null,r=e.threadId;return e.bridge.commands.useSubscription("live",{threadId:r&&r.length>0?r:"_"},t===null?{}:{environmentId:t})}function pe(e){let t=e.bridge.i18n.usePluginTranslation(),r=e.environmentId??null,o=e.threadId||null,i=r===null?{}:{environmentId:r},s=e.bridge.sessionProjections.useProjection("mounted",o,i),c=D(e),p=e.bridge.sessionProjections.useProjection("graph",o,i),g=s,f=T(c.data),h=f?.graph??_(p.value);if(e.presetId!==F||o===null)return null;let l=g.present&&g.value===!0||f?.mounted===!0,y=f??(l?{mounted:!0,graph:h,related:[],prefs:{windowLimit:200,includeAuthorization:!0},report:""}:null);return n(k,{bridge:e.bridge,children:a(X,{className:"pt-seat",defaultOpen:!0,children:[n("style",{children:b}),a(Q,{className:"pt-seat-summary",children:[n(ee,{className:"pt-seat-chevron"}),t("board.title")]}),n(Z,{children:n("div",{className:"pt-seat-body",children:s.isUnavailable||p.isUnavailable?n(S,{title:t("projection.unavailable")}):s.error!==null||p.error!==null?n(S,{title:t("projection.readFailed")}):l&&y!==null&&(y.graph!==null||f?.report!==void 0)?n(se,{t,data:{...y,graph:y.graph??h},embedded:$e(),onOpenThread:u=>{r!==null&&e.bridge.openThread({environmentId:r,threadId:u})},onCopy:u=>{let w=navigator.clipboard;if(w===void 0){e.bridge.notify(t("report.copyFailed"),"warning");return}w.writeText(u).then(()=>e.bridge.notify(t("report.copied"),"success"),()=>e.bridge.notify(t("report.copyFailed"),"warning"))},onDownload:u=>Oe(u,t("report.download"))}):n(S,{title:t(f===null?"board.loading":"board.empty")})})})]})})}function fe(e){let t=e.bridge.i18n.usePluginTranslation(),r=D(e),o=T(r.data);return n(k,{bridge:e.bridge,children:n(ce,{t,target:o?.graph?.goal?.target??null})})}function ge(e){let t=e.bridge.i18n.usePluginTranslation(),r=e.environmentId??null,o=e.threadId??null,i=r===null?{}:{environmentId:r},s=D(e),[c,p]=m(null),g=c??T(s.data);return n(k,{bridge:e.bridge,children:n(ue,{t,data:g,onSave:f=>{e.bridge.commands.invoke("preferences",{...f,...o?{threadId:o}:{}},i).then(h=>{let l=T(h);if(g!==null&&l===null&&typeof h=="object"&&h!==null){let y=h.prefs;y!==void 0&&p({...g,prefs:y})}})}})})}function Oe(e,t){let r=new Blob([e],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=t.endsWith(".md")?t:"assessment-record.md",i.click(),URL.revokeObjectURL(o)}function $e(){return typeof window<"u"&&"ReactNativeWebView"in window}function Be(e){return{views:{card(t){return n(z,{...t,t:e.i18n.usePluginTranslation()})}},slots:[{name:"conversation.view",order:20,component(t){return n(pe,{bridge:e,...t})}},{name:"conversation.hero.agentPreset",order:20,component(t){return n(fe,{bridge:e,...t})}},{name:"settings.section",order:20,component(t){return n(ge,{bridge:e,...t})}}]}}export{Be as default};
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "@ycodium-ai/plugin-api";
6
6
 
7
7
  // ../../packages/plugin-api/src/version.ts
8
- var PLUGIN_API_VERSION = 178;
8
+ var PLUGIN_API_VERSION = 181;
9
9
 
10
10
  // locales/en.json
11
11
  var en_default = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-pentest",
3
- "version": "0.2.5634",
3
+ "version": "0.2.5763",
4
4
  "description": "Records an assessment graph on a session: goal, intents, evidence, assets, and findings.",
5
5
  "keywords": [
6
6
  "sessions",
@@ -24,8 +24,7 @@
24
24
  "react": "19.2.6",
25
25
  "typescript": "~6.0.3",
26
26
  "vite-plus": "0.2.2",
27
- "@ycodium-ai/plugin-api": "0.2.0",
28
- "ycodium-ui-hooks": "0.0.0",
27
+ "@ycodium-ai/plugin-api": "0.2.5763",
29
28
  "ycodium-plugin-testing": "0.0.0"
30
29
  },
31
30
  "ycodium": {