@ycodium-ai/plugin-pentest 0.2.3168 → 0.2.3192
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 +1 -1
- package/dist/index.js +5 -1
- package/locales/en.json +4 -0
- package/locales/zh-CN.json +4 -0
- package/package.json +2 -2
package/assets/ui.js
CHANGED
|
@@ -175,4 +175,4 @@ html[data-fit-content] .pt-seat-body { max-height: 240px; }
|
|
|
175
175
|
.pt-root .pt-side { border-left: 0; border-top: 1px solid var(--pt-border); }
|
|
176
176
|
.pt-root { max-height: none; }
|
|
177
177
|
}
|
|
178
|
-
`;var{jsx:n,jsxs:i,Fragment:x}=window.__ycodiumPluginHost.jsxRuntime;function A(t){let e=st(t.presentation),r=t.colors;return i("article",{className:"pt-card-view",style:r===void 0?void 0:{color:r.foreground,background:r.surface,borderColor:r.border},children:[n("style",{children:f}),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 st(t){let e=L(t);if(e===null||e.kind!=="pentest")return null;let r=L(e.counts);return r===null?null:{id:typeof e.id=="string"?e.id:"",target:typeof e.target=="string"?e.target:"",counts:{intents:N(r.intents),facts:N(r.facts),findings:N(r.findings),assets:N(r.assets)}}}function L(t){return ct(t)?t:null}function ct(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function N(t){return typeof t=="number"?t:0}var ut=window.__ycodiumPluginHost.react;var{Activity:Rt,Children:_t,Component:Ot,Fragment:Lt,Profiler:At,PureComponent:Bt,StrictMode:zt,Suspense:Dt,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:Mt,__COMPILER_RUNTIME:Ht,act:Ut,cache:Gt,cacheSignal:Wt,captureOwnerStack:Vt,cloneElement:Ft,createContext:B,createElement:T,createRef:$t,forwardRef:jt,isValidElement:Jt,lazy:Yt,memo:Kt,startTransition:qt,unstable_useCacheRefresh:Qt,use:z,useActionState:Xt,useCallback:Zt,useContext:te,useDebugValue:ee,useDeferredValue:ne,useEffect:oe,useEffectEvent:re,useId:ae,useImperativeHandle:ie,useInsertionEffect:le,useLayoutEffect:de,useMemo:D,useOptimistic:se,useReducer:ce,useRef:ue,useState:y,useSyncExternalStore:pe,useTransition:ge,version:me}=ut;var pt="pentest";var M="pentest",gt=["add_goal","add_intent","add_fact","add_finding","add_asset","state","graph","report","submit"],H="submit",U=t=>`${pt}_${t}`,ye=new Set(gt.filter(t=>t!==H).map(t=>U(t))),be=U(H);var G=B(null);function C(t){return n(G,{value:t.bridge,children:t.children})}var mt=new Set(["Collapsible","CollapsiblePanel","CollapsibleTrigger"]);function u(t){let e=r=>{let d=z(G)?.ui?.[t];return d===void 0?mt.has(t)?T("div",{className:r.className},r.children):null:T(d,r)};return e.displayName=t,e}var v=u("Button"),W=u("Input"),S=u("Label"),V=u("Select"),P=u("SelectItem"),F=u("SelectPopup"),$=u("SelectTrigger"),j=u("SelectValue"),J=u("SearchInput"),Y=u("Switch"),K=u("Collapsible"),q=u("CollapsibleTrigger"),Q=u("CollapsiblePanel"),w=u("EmptyInline"),X=u("ChevronDown");function I(t){let e=()=>t.onClick(),r=o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),e())};return n("div",{role:"button",tabIndex:0,className:t.className,"data-tone":t.tone,"aria-pressed":t.selected,onClick:e,onKeyDown:r,children:t.children})}var ft=/[.!?。!?]$/u;function Z(t){let e=t.trimEnd();return ft.test(e)?e:`${e}.`}function E(t){if(typeof t!="object"||t===null)return{present:!1,value:null};let e=t;return{present:e.present===!0,value:e.value??null}}function k(t){if(typeof t!="object"||t===null)return null;let e=t,r=e.prefs;return typeof e.mounted!="boolean"||typeof e.report!="string"||typeof r!="object"||r===null?null:{mounted:e.mounted,graph:R(e.graph),related:Array.isArray(e.related)?e.related.flatMap(o=>{if(typeof o!="object"||o===null)return[];let a=o;return typeof a.threadId!="string"||typeof a.title!="string"?[]:[{threadId:a.threadId,title:a.title}]}):[],prefs:{windowLimit:typeof r.windowLimit=="number"?r.windowLimit:200,includeAuthorization:r.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 tt(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 s of t.edges){if(s.kind==="parent")continue;let g=e.get(s.sourceId);if(g===void 0)continue;let m=g+1,p=e.get(s.targetId);(p===void 0||m>p)&&e.set(s.targetId,m)}let r=new Map,o=(d,s)=>{let g=r.get(s)??[];g.push(d),r.set(s,g)};t.goal!==null&&o({id:t.goal.id,kind:"goal",title:t.goal.target,subtitle:t.goal.objective,tone:"goal"},0);for(let d of t.nodes)o(yt(d),e.get(d.id)??1);return[...r.keys()].sort((d,s)=>d-s).map(d=>r.get(d)??[])}function et(t,e){return t.edges.filter(r=>r.sourceId===e||r.targetId===e)}function _(t,e){let r=new Set(t.edges.filter(o=>o.kind==="parent"&&(e===null||o.sourceId===e)).map(o=>o.targetId));if(e===null){let o=new Set(t.edges.filter(a=>a.kind==="parent").map(a=>a.targetId));return t.assets.filter(a=>!o.has(a.id))}return t.assets.filter(o=>r.has(o.id))}function yt(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 nt(t){let[e,r]=y("explore"),[o,a]=y(null),[d,s]=y("all"),[g,m]=y("tree"),[p,b]=y(""),l=t.data.graph,h=["explore","findings","assets","report"];return i("section",{className:"pt-root","data-embedded":t.embedded?"":void 0,children:[n("style",{children:f}),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]}),n("div",{className:"pt-tabs",role:"tablist",children:h.map(c=>n(v,{size:"xs",type:"button",role:"tab","aria-selected":e===c,"aria-pressed":e===c,variant:e===c?"default":"outline",onClick:()=>r(c),children:t.t(`board.tabs.${c}`)},c))}),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("div",{className:"pt-main",role:"tabpanel",children:[l===null?n(w,{title:t.t("board.empty")}):null,l!==null&&e==="explore"?n(bt,{t:t.t,graph:l,selected:o,onSelect:a}):null,l!==null&&e==="findings"?n(ht,{t:t.t,graph:l,severity:d,onSeverity:s,onSelect:a}):null,l!==null&&e==="assets"?n(vt,{t:t.t,graph:l,mode:g,query:p,onMode:m,onQuery:b,onSelect:a}):null,e==="report"?n(xt,{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(wt,{t:t.t,graph:l,selected:o,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(c=>n(v,{size:"xs",variant:"outline",type:"button",onClick:()=>t.onOpenThread(c.threadId),children:c.title||t.t("board.open")},c.threadId))]}),l?.goal&&l.goal.authorization.length>0?i("p",{className:"pt-muted",children:[t.t("board.authorization"),": ",Z(l.goal.authorization)," ",t.t("board.authorizationHint")]}):null]})]})]})}function bt(t){let e=D(()=>tt(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((r,o)=>n("div",{className:"pt-column",children:r.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:et(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))},r[0]?.id??String(o)))})}function ht(t){let e=t.graph.nodes.filter(o=>o.kind==="finding"),r=t.severity==="all"?e:e.filter(o=>o.severity===t.severity);return i("div",{className:"pt-list",children:[i(S,{className:"pt-row",children:[t.t("findings.filter"),i(V,{value:t.severity,onValueChange:o=>t.onSeverity(o),children:[n($,{size:"xs","aria-label":t.t("findings.filter"),children:n(j,{})}),i(F,{children:[n(P,{value:"all",children:t.t("findings.all")}),["critical","high","medium","low","info"].map(o=>n(P,{value:o,children:t.t(`severity.${o}`)},o))]})]})]}),r.length===0?n(w,{title:t.t("findings.empty")}):null,r.map(o=>i("article",{className:"pt-finding",children:[i("div",{className:"pt-row",children:[n("span",{className:"pt-pill",children:t.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:t.t("node.steps")}),n("ol",{children:o.steps.map(a=>n("li",{children:a},a))}),o.affectedAssetId?n(v,{size:"xs",variant:"outline",type:"button",onClick:()=>t.onSelect(o.affectedAssetId??o.id),children:t.t("findings.affected")}):null]},o.id))]})}function vt(t){let e=t.query.trim().toLowerCase(),r=t.graph.assets.filter(o=>e.length===0||o.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})]}),r.length===0?n(w,{title:t.t("assets.empty")}):null,t.mode==="list"?r.map(o=>i(I,{className:"pt-asset",onClick:()=>t.onSelect(o.id),children:[n("span",{className:"pt-kicker",children:t.t(`assetType.${o.type}`)}),n("strong",{children:o.value}),o.meta.length>0?n("small",{className:"pt-muted",children:o.meta}):null]},o.id)):_(t.graph,null).map(o=>n(ot,{t:t.t,graph:t.graph,id:o.id,depth:0,onSelect:t.onSelect},o.id))]})}function ot(t){let e=t.graph.assets.find(r=>r.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(r=>n(ot,{t:t.t,graph:t.graph,id:r.id,depth:t.depth+1,onSelect:t.onSelect},r.id))]})}function xt(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 wt(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,r=t.graph.nodes.find(a=>a.id===t.selected),o=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(x,{children:[n("h3",{children:e.target}),n("p",{children:e.objective})]}):null,r?.kind==="intent"?i(x,{children:[n("h3",{children:r.title}),n("p",{children:r.detail})]}):null,r?.kind==="fact"?i(x,{children:[n("h3",{children:t.t(`factKind.${r.factKind}`)}),n("p",{children:r.detail}),n("p",{className:"pt-muted",children:t.t("node.confidence",{value:r.confidence})})]}):null,r?.kind==="finding"?i(x,{children:[n("h3",{children:r.title}),n("p",{children:r.description}),n("ol",{children:r.steps.map(a=>n("li",{children:a},a))})]}):null,o?i(x,{children:[n("h3",{children:o.value}),n("p",{className:"pt-muted",children:t.t(`assetType.${o.type}`)}),o.meta.length>0?n("p",{children:o.meta}):null]}):null]})}function rt(t){return i("section",{className:"pt-hero",children:[n("style",{children:f}),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})}),i("div",{className:"pt-chips",children:[n("span",{className:"pt-pill",children:t.t("hero.goal")}),n("span",{className:"pt-pill",children:t.t("hero.evidence")}),n("span",{className:"pt-pill",children:t.t("hero.assets")}),n("span",{className:"pt-pill",children:t.t("hero.findings")})]})]})}function at(t){let[e,r]=y(""),o=t.data?.prefs;return i("section",{className:"pt-settings",children:[n("style",{children:f}),n("strong",{className:"pt-title",children:t.t("settings.title")}),n("p",{className:"pt-muted",children:t.t("settings.lead")}),i(S,{className:"pt-row",children:[t.t("settings.window"),n(W,{type:"number",min:20,max:200,"aria-label":t.t("settings.window"),value:o?.windowLimit??200,onChange:a=>{let d=Number(a.target.value);Number.isFinite(d)&&(t.onSave({windowLimit:d}),r(t.t("settings.saved")))}})]}),n("p",{className:"pt-muted",children:t.t("settings.windowHint")}),i(S,{className:"pt-row",children:[n(Y,{checked:o?.includeAuthorization!==!1,"aria-label":t.t("settings.authorization"),onCheckedChange:a=>{t.onSave({includeAuthorization:a}),r(t.t("settings.saved"))}}),t.t("settings.authorization")]}),e.length>0?n("p",{className:"pt-muted",children:e}):null]})}function it(t){let e=t.bridge.i18n.usePluginTranslation(),r=t.environmentId??null,o=t.threadId??null,a=r===null?{}:{environmentId:r},d=t.bridge.commands.useSubscription("ycodium.sessionProjection",{name:"mounted",threadId:o&&o.length>0?o:"_"},a),s=t.bridge.commands.useSubscription("live",{threadId:o&&o.length>0?o:"_"},a),g=t.bridge.commands.useSubscription("ycodium.sessionProjection",{name:"graph",threadId:o&&o.length>0?o:"_"},a),m=E(d.data),p=k(s.data),b=p?.graph??R(E(g.data).value);if(t.presetId!==M||o===null||o.length===0)return null;let l=m.present&&m.value===!0||p?.mounted===!0,h=p??(l?{mounted:!0,graph:b,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:f}),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:l&&h!==null&&(h.graph!==null||p?.report!==void 0)?n(nt,{t:e,data:{...h,graph:h.graph??b},embedded:kt(),onOpenThread:c=>{r!==null&&t.bridge.openThread({environmentId:r,threadId:c})},onCopy:c=>{let O=navigator.clipboard;if(O===void 0){t.bridge.notify(e("report.copyFailed"),"warning");return}O.writeText(c).then(()=>t.bridge.notify(e("report.copied"),"success"),()=>t.bridge.notify(e("report.copyFailed"),"warning"))},onDownload:c=>St(c,e("report.download"))}):n(w,{title:e(p===null?"board.loading":"board.empty")})})})]})})}function lt(t){let e=t.bridge.i18n.usePluginTranslation(),r=t.environmentId??null,o=t.threadId??null,a=r===null?{}:{environmentId:r},d=t.bridge.commands.useSubscription("live",{threadId:o&&o.length>0?o:"_"},a),s=k(d.data);return n(C,{bridge:t.bridge,children:n(rt,{t:e,target:s?.graph?.goal?.target??null})})}function dt(t){let e=t.bridge.i18n.usePluginTranslation(),r=t.environmentId??null,o=t.threadId??null,a=r===null?{}:{environmentId:r},d=t.bridge.commands.useSubscription("live",{threadId:o&&o.length>0?o:"_"},a),[s,g]=y(null),m=s??k(d.data);return n(C,{bridge:t.bridge,children:n(at,{t:e,data:m,onSave:p=>{t.bridge.commands.invoke("preferences",{...p,...o?{threadId:o}:{}},a).then(b=>{let l=k(b);if(m!==null&&l===null&&typeof b=="object"&&b!==null){let h=b.prefs;h!==void 0&&g({...m,prefs:h})}})}})})}function St(t,e){let r=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(r),a=document.createElement("a");a.href=o,a.download=e.endsWith(".md")?e:"assessment-record.md",a.click(),URL.revokeObjectURL(o)}function kt(){return typeof window<"u"&&"ReactNativeWebView"in window}function Nt(t){return{views:{card(e){return n(A,{...e,t:t.i18n.usePluginTranslation()})}},slots:[{name:"conversation.view",order:20,component(e){return n(it,{bridge:t,...e})}},{name:"conversation.hero.agentPreset",order:20,component(e){return n(lt,{bridge:t,...e})}},{name:"settings.section",order:20,component(e){return n(dt,{bridge:t,...e})}}]}}export{Nt as default};
|
|
178
|
+
`;var{jsx:e,jsxs:i,Fragment:w}=window.__ycodiumPluginHost.jsxRuntime;function L(t){let n=dt(t.presentation),r=t.colors;return i("article",{className:"pt-card-view",style:r===void 0?void 0:{color:r.foreground,background:r.surface,borderColor:r.border},children:[e("style",{children:f}),e("div",{className:"pt-kicker",children:t.t("board.title")}),e("h3",{children:n===null?t.t("card.summary"):t.t("card.recorded",{id:n.id})}),n!==null&&n.target.length>0?e("p",{children:n.target}):null,n!==null?e("p",{className:"pt-muted",children:t.t("board.counts",{intents:n.counts.intents,facts:n.counts.facts,findings:n.counts.findings,assets:n.counts.assets})}):null]})}function dt(t){let n=O(t);if(n===null||n.kind!=="pentest")return null;let r=O(n.counts);return r===null?null:{id:typeof n.id=="string"?n.id:"",target:typeof n.target=="string"?n.target:"",counts:{intents:k(r.intents),facts:k(r.facts),findings:k(r.findings),assets:k(r.assets)}}}function O(t){return st(t)?t:null}function st(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function k(t){return typeof t=="number"?t:0}var ct=window.__ycodiumPluginHost.react;var{Activity:Et,Children:Rt,Component:_t,Fragment:Ot,Profiler:Lt,PureComponent:At,StrictMode:Bt,Suspense:zt,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:Dt,__COMPILER_RUNTIME:Mt,act:Ut,cache:Ht,cacheSignal:Gt,captureOwnerStack:Wt,cloneElement:Vt,createContext:A,createElement:T,createRef:jt,forwardRef:Ft,isValidElement:$t,lazy:Jt,memo:Yt,startTransition:Kt,unstable_useCacheRefresh:qt,use:B,useActionState:Qt,useCallback:Xt,useContext:Zt,useDebugValue:te,useDeferredValue:ee,useEffect:ne,useEffectEvent:oe,useId:re,useImperativeHandle:ae,useInsertionEffect:ie,useLayoutEffect:le,useMemo:z,useOptimistic:de,useReducer:se,useRef:ce,useState:y,useSyncExternalStore:pe,useTransition:ue,version:ge}=ct;var pt="pentest";var D="pentest",ut=["add_goal","add_intent","add_fact","add_finding","add_asset","state","graph","report","submit"],M="submit",U=t=>`${pt}_${t}`,fe=new Set(ut.filter(t=>t!==M).map(t=>U(t))),ye=U(M);var H=A(null);function C(t){return e(H,{value:t.bridge,children:t.children})}var gt=new Set(["Collapsible","CollapsiblePanel","CollapsibleTrigger"]);function p(t){let n=r=>{let d=B(H)?.ui?.[t];return d===void 0?gt.has(t)?T("div",{className:r.className},r.children):null:T(d,r)};return n.displayName=t,n}var v=p("Button"),G=p("Input"),S=p("Label"),W=p("Select"),P=p("SelectItem"),V=p("SelectPopup"),j=p("SelectTrigger"),F=p("SelectValue"),$=p("SearchInput"),J=p("Switch"),Y=p("Collapsible"),K=p("CollapsibleTrigger"),q=p("CollapsiblePanel"),x=p("EmptyInline"),Q=p("ChevronDown");function I(t){let n=()=>t.onClick(),r=o=>{o.key!=="Enter"&&o.key!==" "||(o.preventDefault(),n())};return e("div",{role:"button",tabIndex:0,className:t.className,"data-tone":t.tone,"aria-pressed":t.selected,onClick:n,onKeyDown:r,children:t.children})}var mt=/[.!?。!?]$/u;function X(t){let n=t.trimEnd();return mt.test(n)?n:`${n}.`}function N(t){if(typeof t!="object"||t===null)return null;let n=t,r=n.prefs;return typeof n.mounted!="boolean"||typeof n.report!="string"||typeof r!="object"||r===null?null:{mounted:n.mounted,graph:E(n.graph),related:Array.isArray(n.related)?n.related.flatMap(o=>{if(typeof o!="object"||o===null)return[];let a=o;return typeof a.threadId!="string"||typeof a.title!="string"?[]:[{threadId:a.threadId,title:a.title}]}):[],prefs:{windowLimit:typeof r.windowLimit=="number"?r.windowLimit:200,includeAuthorization:r.includeAuthorization!==!1},report:n.report}}function E(t){if(typeof t!="object"||t===null)return null;let n=t;return typeof n.goal!="object"||n.goal===null||!Array.isArray(n.nodes)||!Array.isArray(n.assets)||!Array.isArray(n.edges)?null:n}function Z(t){let n=new Map;t.goal!==null&&n.set(t.goal.id,0);for(let d=0;d<t.edges.length+1;d+=1)for(let s of t.edges){if(s.kind==="parent")continue;let u=n.get(s.sourceId);if(u===void 0)continue;let m=u+1,g=n.get(s.targetId);(g===void 0||m>g)&&n.set(s.targetId,m)}let r=new Map,o=(d,s)=>{let u=r.get(s)??[];u.push(d),r.set(s,u)};t.goal!==null&&o({id:t.goal.id,kind:"goal",title:t.goal.target,subtitle:t.goal.objective,tone:"goal"},0);for(let d of t.nodes)o(ft(d),n.get(d.id)??1);return[...r.keys()].sort((d,s)=>d-s).map(d=>r.get(d)??[])}function tt(t,n){return t.edges.filter(r=>r.sourceId===n||r.targetId===n)}function R(t,n){let r=new Set(t.edges.filter(o=>o.kind==="parent"&&(n===null||o.sourceId===n)).map(o=>o.targetId));if(n===null){let o=new Set(t.edges.filter(a=>a.kind==="parent").map(a=>a.targetId));return t.assets.filter(a=>!o.has(a.id))}return t.assets.filter(o=>r.has(o.id))}function ft(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 et(t){let[n,r]=y("explore"),[o,a]=y(null),[d,s]=y("all"),[u,m]=y("tree"),[g,b]=y(""),l=t.data.graph,h=["explore","findings","assets","report"];return i("section",{className:"pt-root","data-embedded":t.embedded?"":void 0,children:[e("style",{children:f}),i("header",{className:"pt-bar",children:[i("div",{className:"pt-goal",children:[e("strong",{children:l?.goal?.target??t.t("board.empty")}),l?.goal?e("span",{className:"pt-muted",children:l.goal.objective}):null]}),l?e("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]}),e("div",{className:"pt-tabs",role:"tablist",children:h.map(c=>e(v,{size:"xs",type:"button",role:"tab","aria-selected":n===c,"aria-pressed":n===c,variant:n===c?"default":"outline",onClick:()=>r(c),children:t.t(`board.tabs.${c}`)},c))}),l?.truncated?e("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("div",{className:"pt-main",role:"tabpanel",children:[l===null?e(x,{title:t.t("board.empty")}):null,l!==null&&n==="explore"?e(yt,{t:t.t,graph:l,selected:o,onSelect:a}):null,l!==null&&n==="findings"?e(bt,{t:t.t,graph:l,severity:d,onSeverity:s,onSelect:a}):null,l!==null&&n==="assets"?e(ht,{t:t.t,graph:l,mode:u,query:g,onMode:m,onQuery:b,onSelect:a}):null,n==="report"?e(vt,{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:[e(xt,{t:t.t,graph:l,selected:o,onClose:()=>a(null)}),i("div",{children:[e("div",{className:"pt-kicker",children:t.t("board.related")}),t.data.related.length===0?e("p",{className:"pt-muted",children:t.t("board.relatedEmpty")}):null,t.data.related.map(c=>e(v,{size:"xs",variant:"outline",type:"button",onClick:()=>t.onOpenThread(c.threadId),children:c.title||t.t("board.open")},c.threadId))]}),l?.goal&&l.goal.authorization.length>0?i("p",{className:"pt-muted",children:[t.t("board.authorization"),": ",X(l.goal.authorization)," ",t.t("board.authorizationHint")]}):null]})]})]})}function yt(t){let n=z(()=>Z(t.graph),[t.graph]);return n.length===0?e("p",{className:"pt-list pt-muted",children:t.t("explore.empty")}):e("div",{className:"pt-columns",children:n.map((r,o)=>e("div",{className:"pt-column",children:r.map(a=>i(I,{className:"pt-card",tone:a.tone,selected:t.selected===a.id,onClick:()=>t.onSelect(a.id),children:[e("span",{className:"pt-kicker",children:t.t(`node.${a.kind}`)}),e("strong",{children:a.title}),a.subtitle.length>0?e("small",{children:a.subtitle}):null,e("span",{className:"pt-row",children:tt(t.graph,a.id).slice(0,3).map(d=>e("span",{className:"pt-pill",children:t.t(`explore.edge.${d.kind}`)},d.id))})]},a.id))},r[0]?.id??String(o)))})}function bt(t){let n=t.graph.nodes.filter(o=>o.kind==="finding"),r=t.severity==="all"?n:n.filter(o=>o.severity===t.severity);return i("div",{className:"pt-list",children:[i(S,{className:"pt-row",children:[t.t("findings.filter"),i(W,{value:t.severity,onValueChange:o=>t.onSeverity(o),children:[e(j,{size:"xs","aria-label":t.t("findings.filter"),children:e(F,{})}),i(V,{children:[e(P,{value:"all",children:t.t("findings.all")}),["critical","high","medium","low","info"].map(o=>e(P,{value:o,children:t.t(`severity.${o}`)},o))]})]})]}),r.length===0?e(x,{title:t.t("findings.empty")}):null,r.map(o=>i("article",{className:"pt-finding",children:[i("div",{className:"pt-row",children:[e("span",{className:"pt-pill",children:t.t(`severity.${o.severity}`)}),e("h3",{children:o.title})]}),e("p",{className:"pt-muted",children:o.intentId}),o.description.length>0?e("p",{children:o.description}):null,e("div",{className:"pt-kicker",children:t.t("node.steps")}),e("ol",{children:o.steps.map(a=>e("li",{children:a},a))}),o.affectedAssetId?e(v,{size:"xs",variant:"outline",type:"button",onClick:()=>t.onSelect(o.affectedAssetId??o.id),children:t.t("findings.affected")}):null]},o.id))]})}function ht(t){let n=t.query.trim().toLowerCase(),r=t.graph.assets.filter(o=>n.length===0||o.value.toLowerCase().includes(n));return i("div",{className:"pt-list",children:[i("div",{className:"pt-row",children:[e(v,{size:"xs",variant:"outline",type:"button","aria-pressed":t.mode==="list",onClick:()=>t.onMode("list"),children:t.t("assets.list")}),e(v,{size:"xs",variant:"outline",type:"button","aria-pressed":t.mode==="tree",onClick:()=>t.onMode("tree"),children:t.t("assets.tree")}),e($,{value:t.query,size:"sm",variant:"ghost","aria-label":t.t("assets.filter"),placeholder:t.t("assets.filter"),onValueChange:t.onQuery})]}),r.length===0?e(x,{title:t.t("assets.empty")}):null,t.mode==="list"?r.map(o=>i(I,{className:"pt-asset",onClick:()=>t.onSelect(o.id),children:[e("span",{className:"pt-kicker",children:t.t(`assetType.${o.type}`)}),e("strong",{children:o.value}),o.meta.length>0?e("small",{className:"pt-muted",children:o.meta}):null]},o.id)):R(t.graph,null).map(o=>e(nt,{t:t.t,graph:t.graph,id:o.id,depth:0,onSelect:t.onSelect},o.id))]})}function nt(t){let n=t.graph.assets.find(r=>r.id===t.id);return n===void 0?null:i("div",{className:"pt-tree-item",style:{marginLeft:t.depth*14},children:[i(I,{className:"pt-asset",onClick:()=>t.onSelect(n.id),children:[e("span",{className:"pt-kicker",children:t.t(`assetType.${n.type}`)}),e("strong",{children:n.value})]}),R(t.graph,n.id).map(r=>e(nt,{t:t.t,graph:t.graph,id:r.id,depth:t.depth+1,onSelect:t.onSelect},r.id))]})}function vt(t){return i("div",{className:"pt-list",children:[i("div",{className:"pt-row",children:[e(v,{size:"xs",type:"button",onClick:t.onCopy,children:t.t("report.copy")}),e(v,{size:"xs",variant:"outline",type:"button",onClick:t.onDownload,children:t.t("report.download")})]}),e("div",{className:"pt-report",children:e("pre",{children:t.markdown.length>0?t.markdown:t.t("report.empty")})})]})}function xt(t){if(t.graph===null||t.selected===null)return e("p",{className:"pt-muted",children:t.t("explore.empty")});let n=t.graph.goal?.id===t.selected?t.graph.goal:null,r=t.graph.nodes.find(a=>a.id===t.selected),o=t.graph.assets.find(a=>a.id===t.selected);return i("div",{className:"pt-detail",children:[i("div",{className:"pt-row",children:[e("span",{className:"pt-kicker",children:t.selected}),e(v,{size:"xs",variant:"outline",type:"button",onClick:t.onClose,children:t.t("node.close")})]}),n?i(w,{children:[e("h3",{children:n.target}),e("p",{children:n.objective})]}):null,r?.kind==="intent"?i(w,{children:[e("h3",{children:r.title}),e("p",{children:r.detail})]}):null,r?.kind==="fact"?i(w,{children:[e("h3",{children:t.t(`factKind.${r.factKind}`)}),e("p",{children:r.detail}),e("p",{className:"pt-muted",children:t.t("node.confidence",{value:r.confidence})})]}):null,r?.kind==="finding"?i(w,{children:[e("h3",{children:r.title}),e("p",{children:r.description}),e("ol",{children:r.steps.map(a=>e("li",{children:a},a))})]}):null,o?i(w,{children:[e("h3",{children:o.value}),e("p",{className:"pt-muted",children:t.t(`assetType.${o.type}`)}),o.meta.length>0?e("p",{children:o.meta}):null]}):null]})}function ot(t){return i("section",{className:"pt-hero",children:[e("style",{children:f}),e("strong",{className:"pt-title",children:t.t("hero.title")}),e("p",{className:"pt-muted",children:t.target===null?t.t("hero.body"):t.t("hero.current",{target:t.target})}),i("div",{className:"pt-chips",children:[e("span",{className:"pt-pill",children:t.t("hero.goal")}),e("span",{className:"pt-pill",children:t.t("hero.evidence")}),e("span",{className:"pt-pill",children:t.t("hero.assets")}),e("span",{className:"pt-pill",children:t.t("hero.findings")})]})]})}function rt(t){let[n,r]=y(""),o=t.data?.prefs;return i("section",{className:"pt-settings",children:[e("style",{children:f}),e("strong",{className:"pt-title",children:t.t("settings.title")}),e("p",{className:"pt-muted",children:t.t("settings.lead")}),i(S,{className:"pt-row",children:[t.t("settings.window"),e(G,{type:"number",min:20,max:200,"aria-label":t.t("settings.window"),value:o?.windowLimit??200,onChange:a=>{let d=Number(a.target.value);Number.isFinite(d)&&(t.onSave({windowLimit:d}),r(t.t("settings.saved")))}})]}),e("p",{className:"pt-muted",children:t.t("settings.windowHint")}),i(S,{className:"pt-row",children:[e(J,{checked:o?.includeAuthorization!==!1,"aria-label":t.t("settings.authorization"),onCheckedChange:a=>{t.onSave({includeAuthorization:a}),r(t.t("settings.saved"))}}),t.t("settings.authorization")]}),n.length>0?e("p",{className:"pt-muted",children:n}):null]})}function at(t){let n=t.bridge.i18n.usePluginTranslation(),r=t.environmentId??null,o=t.threadId||null,a=r===null?{}:{environmentId:r},d=t.bridge.sessionProjections.useProjection("mounted",o,a),s=t.bridge.commands.useSubscription("live",{threadId:o&&o.length>0?o:"_"},a),u=t.bridge.sessionProjections.useProjection("graph",o,a),m=d,g=N(s.data),b=g?.graph??E(u.value);if(t.presetId!==D||o===null)return null;let l=m.present&&m.value===!0||g?.mounted===!0,h=g??(l?{mounted:!0,graph:b,related:[],prefs:{windowLimit:200,includeAuthorization:!0},report:""}:null);return e(C,{bridge:t.bridge,children:i(Y,{className:"pt-seat",defaultOpen:!0,children:[e("style",{children:f}),i(K,{className:"pt-seat-summary",children:[e(Q,{className:"pt-seat-chevron"}),n("board.title")]}),e(q,{children:e("div",{className:"pt-seat-body",children:d.isUnavailable||u.isUnavailable?e(x,{title:n("projection.unavailable")}):d.error!==null||u.error!==null?e(x,{title:n("projection.readFailed")}):l&&h!==null&&(h.graph!==null||g?.report!==void 0)?e(et,{t:n,data:{...h,graph:h.graph??b},embedded:St(),onOpenThread:c=>{r!==null&&t.bridge.openThread({environmentId:r,threadId:c})},onCopy:c=>{let _=navigator.clipboard;if(_===void 0){t.bridge.notify(n("report.copyFailed"),"warning");return}_.writeText(c).then(()=>t.bridge.notify(n("report.copied"),"success"),()=>t.bridge.notify(n("report.copyFailed"),"warning"))},onDownload:c=>wt(c,n("report.download"))}):e(x,{title:n(g===null?"board.loading":"board.empty")})})})]})})}function it(t){let n=t.bridge.i18n.usePluginTranslation(),r=t.environmentId??null,o=t.threadId??null,a=r===null?{}:{environmentId:r},d=t.bridge.commands.useSubscription("live",{threadId:o&&o.length>0?o:"_"},a),s=N(d.data);return e(C,{bridge:t.bridge,children:e(ot,{t:n,target:s?.graph?.goal?.target??null})})}function lt(t){let n=t.bridge.i18n.usePluginTranslation(),r=t.environmentId??null,o=t.threadId??null,a=r===null?{}:{environmentId:r},d=t.bridge.commands.useSubscription("live",{threadId:o&&o.length>0?o:"_"},a),[s,u]=y(null),m=s??N(d.data);return e(C,{bridge:t.bridge,children:e(rt,{t:n,data:m,onSave:g=>{t.bridge.commands.invoke("preferences",{...g,...o?{threadId:o}:{}},a).then(b=>{let l=N(b);if(m!==null&&l===null&&typeof b=="object"&&b!==null){let h=b.prefs;h!==void 0&&u({...m,prefs:h})}})}})})}function wt(t,n){let r=new Blob([t],{type:"text/markdown;charset=utf-8"}),o=URL.createObjectURL(r),a=document.createElement("a");a.href=o,a.download=n.endsWith(".md")?n:"assessment-record.md",a.click(),URL.revokeObjectURL(o)}function St(){return typeof window<"u"&&"ReactNativeWebView"in window}function Nt(t){return{views:{card(n){return e(L,{...n,t:t.i18n.usePluginTranslation()})}},slots:[{name:"conversation.view",order:20,component(n){return e(at,{bridge:t,...n})}},{name:"conversation.hero.agentPreset",order:20,component(n){return e(it,{bridge:t,...n})}},{name:"settings.section",order:20,component(n){return e(lt,{bridge:t,...n})}}]}}export{Nt as default};
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
|
|
7
7
|
// locales/en.json
|
|
8
8
|
var en_default = {
|
|
9
|
+
projection: {
|
|
10
|
+
unavailable: "Update this machine to the latest Ycodium to show this.",
|
|
11
|
+
readFailed: "Couldn't read this from the machine. Try again later."
|
|
12
|
+
},
|
|
9
13
|
board: {
|
|
10
14
|
title: "Assessment record",
|
|
11
15
|
goal: "Goal",
|
|
@@ -977,7 +981,7 @@ function submitFrom(args) {
|
|
|
977
981
|
// src/index.ts
|
|
978
982
|
var pentestPlugin = definePlugin({
|
|
979
983
|
id: "pentest",
|
|
980
|
-
apiVersion:
|
|
984
|
+
apiVersion: 17,
|
|
981
985
|
activate(ctx) {
|
|
982
986
|
const store = createStore(ctx.paths.dataDir);
|
|
983
987
|
ctx.sessionProjections.register({ name: GRAPH_PROJECTION });
|
package/locales/en.json
CHANGED
package/locales/zh-CN.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/plugin-pentest",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3192",
|
|
4
4
|
"description": "Records an assessment graph on a session: goal, intents, evidence, assets, and findings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sessions",
|
|
@@ -24,7 +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.
|
|
27
|
+
"@ycodium-ai/plugin-api": "0.2.3192"
|
|
28
28
|
},
|
|
29
29
|
"ycodium": {
|
|
30
30
|
"plugin": "./dist/index.js",
|