@ycodium-ai/plugin-pentest 0.2.5192 → 0.2.5244
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 +2 -6
- package/dist/index.js +2 -1
- package/locales/en.json +1 -0
- package/locales/zh-CN.json +1 -0
- package/package.json +4 -4
package/assets/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var y=`
|
|
2
2
|
.pt-root, .pt-root * { box-sizing: border-box; }
|
|
3
3
|
.pt-root {
|
|
4
4
|
--pt-fg: var(--foreground, #14221c);
|
|
@@ -48,10 +48,6 @@ var f=`
|
|
|
48
48
|
border-color: var(--pt-accent);
|
|
49
49
|
box-shadow: inset 0 0 0 1px var(--pt-accent);
|
|
50
50
|
}
|
|
51
|
-
.pt-root .pt-tabs button[aria-pressed="true"] {
|
|
52
|
-
background: var(--primary);
|
|
53
|
-
color: var(--primary-foreground);
|
|
54
|
-
}
|
|
55
51
|
.pt-root button:focus-visible, .pt-root input:focus-visible, .pt-root select:focus-visible,
|
|
56
52
|
.pt-settings button:focus-visible, .pt-settings input:focus-visible, .pt-hero button:focus-visible {
|
|
57
53
|
outline: 2px solid var(--pt-accent, var(--primary, #0f766e));
|
|
@@ -174,4 +170,4 @@ html[data-fit-content] .pt-seat-body { max-height: 240px; }
|
|
|
174
170
|
.pt-root .pt-side { border-left: 0; border-top: 1px solid var(--pt-border); }
|
|
175
171
|
.pt-root { max-height: none; }
|
|
176
172
|
}
|
|
177
|
-
`;var{jsx:n,jsxs:i,Fragment:w}=window.__ycodiumPluginHost.jsxRuntime;function B(t){let e=st(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: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 o=L(e.counts);return o===null?null:{id:typeof e.id=="string"?e.id:"",target:typeof e.target=="string"?e.target:"",counts:{intents:N(o.intents),facts:N(o.facts),findings:N(o.findings),assets:N(o.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:Bt,PureComponent:At,StrictMode:zt,Suspense:Dt,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:Ut,__COMPILER_RUNTIME:Mt,act:Ht,cache:Gt,cacheSignal:Wt,captureOwnerStack:Vt,cloneElement:jt,createContext:A,createElement:T,createRef:Ft,forwardRef:$t,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 U="pentest",gt=["add_goal","add_intent","add_fact","add_finding","add_asset","state","graph","report","submit"],M="submit",H=t=>`${pt}_${t}`,ye=new Set(gt.filter(t=>t!==M).map(t=>H(t))),be=H(M);var G=A(null);function S(t){return T(G,{value:t.bridge},t.children)}var mt=new Set(["Collapsible","CollapsiblePanel","CollapsibleTrigger"]);function c(t){let e=o=>{let d=z(G)?.ui?.[t];return d===void 0?mt.has(t)?T("div",{className:o.className},o.children):null:T(d,o)};return e.displayName=t,e}var v=c("Button"),W=c("Input"),k=c("Label"),V=c("Select"),P=c("SelectItem"),j=c("SelectPopup"),F=c("SelectTrigger"),$=c("SelectValue"),J=c("SearchInput"),Y=c("Switch"),K=c("Collapsible"),q=c("CollapsibleTrigger"),Q=c("CollapsiblePanel"),x=c("EmptyInline"),X=c("ChevronDown");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 ft=/[.!?。!?]$/u;function Z(t){let e=t.trimEnd();return ft.test(e)?e:`${e}.`}function C(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:E(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 E(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 u of t.edges){if(u.kind==="parent")continue;let p=e.get(u.sourceId);if(p===void 0)continue;let m=p+1,g=e.get(u.targetId);(g===void 0||m>g)&&e.set(u.targetId,m)}let o=new Map,r=(d,u)=>{let p=o.get(u)??[];p.push(d),o.set(u,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(yt(d),e.get(d.id)??1);return[...o.keys()].sort((d,u)=>d-u).map(d=>o.get(d)??[])}function et(t,e){return t.edges.filter(o=>o.sourceId===e||o.targetId===e)}function R(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 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,o]=y("explore"),[r,a]=y(null),[d,u]=y("all"),[p,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:[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(s=>n(v,{size:"xs",type:"button",role:"tab","aria-selected":e===s,"aria-pressed":e===s,variant:e===s?"default":"outline",onClick:()=>o(s),children:t.t(`board.tabs.${s}`)},s))}),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(x,{title:t.t("board.empty")}):null,l!==null&&e==="explore"?n(bt,{t:t.t,graph:l,selected:r,onSelect:a}):null,l!==null&&e==="findings"?n(ht,{t:t.t,graph:l,severity:d,onSeverity:u,onSelect:a}):null,l!==null&&e==="assets"?n(vt,{t:t.t,graph:l,mode:p,query:g,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: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(s=>n(v,{size:"xs",variant:"outline",type:"button",onClick:()=>t.onOpenThread(s.threadId),children:s.title||t.t("board.open")},s.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((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: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))},o[0]?.id??String(r)))})}function ht(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(P,{value:"all",children:t.t("findings.all")}),["critical","high","medium","low","info"].map(r=>n(P,{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 vt(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)):R(t.graph,null).map(r=>n(ot,{t:t.t,graph:t.graph,id:r.id,depth:0,onSelect:t.onSelect},r.id))]})}function ot(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})]}),R(t.graph,e.id).map(o=>n(ot,{t:t.t,graph:t.graph,id:o.id,depth:t.depth+1,onSelect:t.onSelect},o.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,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 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})})]})}function at(t){let[e,o]=y(""),r=t.data?.prefs;return i("section",{className:"pt-settings",children:[n("style",{children:f}),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 _(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 it(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),u=_(t),p=t.bridge.sessionProjections.useProjection("graph",r,a),m=d,g=C(u.data),b=g?.graph??E(p.value);if(t.presetId!==U||r===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 n(S,{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:d.isUnavailable||p.isUnavailable?n(x,{title:e("projection.unavailable")}):d.error!==null||p.error!==null?n(x,{title:e("projection.readFailed")}):l&&h!==null&&(h.graph!==null||g?.report!==void 0)?n(nt,{t:e,data:{...h,graph:h.graph??b},embedded:kt(),onOpenThread:s=>{o!==null&&t.bridge.openThread({environmentId:o,threadId:s})},onCopy:s=>{let O=navigator.clipboard;if(O===void 0){t.bridge.notify(e("report.copyFailed"),"warning");return}O.writeText(s).then(()=>t.bridge.notify(e("report.copied"),"success"),()=>t.bridge.notify(e("report.copyFailed"),"warning"))},onDownload:s=>St(s,e("report.download"))}):n(x,{title:e(g===null?"board.loading":"board.empty")})})})]})})}function lt(t){let e=t.bridge.i18n.usePluginTranslation(),o=_(t),r=C(o.data);return n(S,{bridge:t.bridge,children:n(rt,{t:e,target:r?.graph?.goal?.target??null})})}function dt(t){let e=t.bridge.i18n.usePluginTranslation(),o=t.environmentId??null,r=t.threadId??null,a=o===null?{}:{environmentId:o},d=_(t),[u,p]=y(null),m=u??C(d.data);return n(S,{bridge:t.bridge,children:n(at,{t:e,data:m,onSave:g=>{t.bridge.commands.invoke("preferences",{...g,...r?{threadId:r}:{}},a).then(b=>{let l=C(b);if(m!==null&&l===null&&typeof b=="object"&&b!==null){let h=b.prefs;h!==void 0&&p({...m,prefs:h})}})}})})}function St(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 kt(){return typeof window<"u"&&"ReactNativeWebView"in window}function Ct(t){return{views:{card(e){return n(B,{...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{Ct as default};
|
|
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};
|
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 =
|
|
8
|
+
var PLUGIN_API_VERSION = 155;
|
|
9
9
|
|
|
10
10
|
// locales/en.json
|
|
11
11
|
var en_default = {
|
|
@@ -27,6 +27,7 @@ var en_default = {
|
|
|
27
27
|
open: "Open session",
|
|
28
28
|
related: "Delegated sessions",
|
|
29
29
|
relatedEmpty: "No delegated session has written to this record",
|
|
30
|
+
tabsLabel: "Board views",
|
|
30
31
|
tabs: {
|
|
31
32
|
explore: "Explore",
|
|
32
33
|
findings: "Findings",
|
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.5244",
|
|
4
4
|
"description": "Records an assessment graph on a session: goal, intents, evidence, assets, and findings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sessions",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"react": "19.2.6",
|
|
25
25
|
"typescript": "~6.0.3",
|
|
26
26
|
"vite-plus": "0.2.2",
|
|
27
|
-
"ycodium-
|
|
28
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
29
|
-
"ycodium-
|
|
27
|
+
"ycodium-plugin-testing": "0.0.0",
|
|
28
|
+
"@ycodium-ai/plugin-api": "0.2.5244",
|
|
29
|
+
"ycodium-ui-hooks": "0.0.0"
|
|
30
30
|
},
|
|
31
31
|
"ycodium": {
|
|
32
32
|
"plugin": "./dist/index.js",
|