@ycodium-ai/plugin-pentest 0.2.3608 → 0.2.3635

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/README.md CHANGED
@@ -51,6 +51,7 @@ Installing a newer version replaces the running one. Records in the data directo
51
51
 
52
52
  - The panel shows at most 200 nodes, assets, and edges. You can lower that to 20 in settings. The stored record is not trimmed.
53
53
  - Delegated sessions only have `pentest_submit`. The decision and read tools are refused there. This plugin does not refuse host tools by name.
54
+ - Exports read the full store. A delegated session can only submit onto its parent.
54
55
  - The session panel stays hidden until this session has a goal. The preset card is on the new-session hero.
55
56
  - The host does not tell the panel which preset the session selected, so the panel uses the per-session `mounted` projection.
56
57
  - Shell, files, and delegation stay on the host's own tools. This plugin does not open a terminal.
package/assets/ui.js CHANGED
@@ -135,7 +135,6 @@ var f=`
135
135
  background: var(--card, #fff);
136
136
  color: var(--foreground, #14221c);
137
137
  }
138
- .pt-hero .pt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
139
138
  .pt-root .pt-tree-item { display: flex; flex-direction: column; gap: 6px; }
140
139
  .pt-root .pt-filter, .pt-settings .pt-filter { min-height: 32px; border-radius: 10px; border: 1px solid var(--pt-border, var(--border, #d5e0da)); background: var(--pt-card, var(--card, #fff)); padding: 0 8px; }
141
140
  .pt-seat {
@@ -175,4 +174,4 @@ html[data-fit-content] .pt-seat-body { max-height: 240px; }
175
174
  .pt-root .pt-side { border-left: 0; border-top: 1px solid var(--pt-border); }
176
175
  .pt-root { max-height: none; }
177
176
  }
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:ue,useTransition:pe,version:ge}=ct;var ut="pentest";var D="pentest",pt=["add_goal","add_intent","add_fact","add_finding","add_asset","state","graph","report","submit"],M="submit",U=t=>`${ut}_${t}`,fe=new Set(pt.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 u(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=u("Button"),G=u("Input"),S=u("Label"),W=u("Select"),P=u("SelectItem"),V=u("SelectPopup"),j=u("SelectTrigger"),F=u("SelectValue"),$=u("SearchInput"),J=u("Switch"),Y=u("Collapsible"),K=u("CollapsibleTrigger"),q=u("CollapsiblePanel"),x=u("EmptyInline"),Q=u("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 p=n.get(s.sourceId);if(p===void 0)continue;let m=p+1,g=n.get(s.targetId);(g===void 0||m>g)&&n.set(s.targetId,m)}let r=new Map,o=(d,s)=>{let p=r.get(s)??[];p.push(d),r.set(s,p)};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"),[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:[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:p,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),p=t.bridge.sessionProjections.useProjection("graph",o,a),m=d,g=N(s.data),b=g?.graph??E(p.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||p.isUnavailable?e(x,{title:n("projection.unavailable")}):d.error!==null||p.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,p]=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&&p({...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};
177
+ `;var{jsx:n,jsxs:i,Fragment:w}=window.__ycodiumPluginHost.jsxRuntime;function L(t){let e=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:[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 dt(t){let e=O(t);if(e===null||e.kind!=="pentest")return null;let r=O(e.counts);return r===null?null:{id:typeof e.id=="string"?e.id:"",target:typeof e.target=="string"?e.target:"",counts:{intents:C(r.intents),facts:C(r.facts),findings:C(r.findings),assets:C(r.assets)}}}function O(t){return st(t)?t:null}function st(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function C(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:ue,useTransition:pe,version:ge}=ct;var ut="pentest";var D="pentest",pt=["add_goal","add_intent","add_fact","add_finding","add_asset","state","graph","report","submit"],M="submit",U=t=>`${ut}_${t}`,fe=new Set(pt.filter(t=>t!==M).map(t=>U(t))),ye=U(M);var H=A(null);function N(t){return n(H,{value:t.bridge,children:t.children})}var gt=new Set(["Collapsible","CollapsiblePanel","CollapsibleTrigger"]);function u(t){let e=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 e.displayName=t,e}var v=u("Button"),G=u("Input"),S=u("Label"),W=u("Select"),P=u("SelectItem"),V=u("SelectPopup"),j=u("SelectTrigger"),F=u("SelectValue"),$=u("SearchInput"),J=u("Switch"),Y=u("Collapsible"),K=u("CollapsibleTrigger"),q=u("CollapsiblePanel"),x=u("EmptyInline"),Q=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 mt=/[.!?。!?]$/u;function X(t){let e=t.trimEnd();return mt.test(e)?e:`${e}.`}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:E(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 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 Z(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 p=e.get(s.sourceId);if(p===void 0)continue;let m=p+1,g=e.get(s.targetId);(g===void 0||m>g)&&e.set(s.targetId,m)}let r=new Map,o=(d,s)=>{let p=r.get(s)??[];p.push(d),r.set(s,p)};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),e.get(d.id)??1);return[...r.keys()].sort((d,s)=>d-s).map(d=>r.get(d)??[])}function tt(t,e){return t.edges.filter(r=>r.sourceId===e||r.targetId===e)}function R(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 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[e,r]=y("explore"),[o,a]=y(null),[d,s]=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(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(x,{title:t.t("board.empty")}):null,l!==null&&e==="explore"?n(yt,{t:t.t,graph:l,selected:o,onSelect:a}):null,l!==null&&e==="findings"?n(bt,{t:t.t,graph:l,severity:d,onSeverity:s,onSelect:a}):null,l!==null&&e==="assets"?n(ht,{t:t.t,graph:l,mode:p,query:g,onMode:m,onQuery:b,onSelect:a}):null,e==="report"?n(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:[n(xt,{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"),": ",X(l.goal.authorization)," ",t.t("board.authorizationHint")]}):null]})]})]})}function yt(t){let e=z(()=>Z(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:tt(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 bt(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(W,{value:t.severity,onValueChange:o=>t.onSeverity(o),children:[n(j,{size:"xs","aria-label":t.t("findings.filter"),children:n(F,{})}),i(V,{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(x,{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 ht(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($,{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(x,{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)):R(t.graph,null).map(o=>n(nt,{t:t.t,graph:t.graph,id:o.id,depth:0,onSelect:t.onSelect},o.id))]})}function nt(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})]}),R(t.graph,e.id).map(r=>n(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:[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 xt(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(w,{children:[n("h3",{children:e.target}),n("p",{children:e.objective})]}):null,r?.kind==="intent"?i(w,{children:[n("h3",{children:r.title}),n("p",{children:r.detail})]}):null,r?.kind==="fact"?i(w,{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(w,{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(w,{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 ot(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 rt(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")}),i(S,{className:"pt-row",children:[t.t("settings.window"),n(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")))}})]}),n("p",{className:"pt-muted",children:t.t("settings.windowHint")}),i(S,{className:"pt-row",children:[n(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")]}),e.length>0?n("p",{className:"pt-muted",children:e}):null]})}function at(t){let e=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),p=t.bridge.sessionProjections.useProjection("graph",o,a),m=d,g=k(s.data),b=g?.graph??E(p.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 n(N,{bridge:t.bridge,children:i(Y,{className:"pt-seat",defaultOpen:!0,children:[n("style",{children:f}),i(K,{className:"pt-seat-summary",children:[n(Q,{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(et,{t:e,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(e("report.copyFailed"),"warning");return}_.writeText(c).then(()=>t.bridge.notify(e("report.copied"),"success"),()=>t.bridge.notify(e("report.copyFailed"),"warning"))},onDownload:c=>wt(c,e("report.download"))}):n(x,{title:e(g===null?"board.loading":"board.empty")})})})]})})}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("live",{threadId:o&&o.length>0?o:"_"},a),s=k(d.data);return n(N,{bridge:t.bridge,children:n(ot,{t:e,target:s?.graph?.goal?.target??null})})}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,p]=y(null),m=s??k(d.data);return n(N,{bridge:t.bridge,children:n(rt,{t:e,data:m,onSave:g=>{t.bridge.commands.invoke("preferences",{...g,...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&&p({...m,prefs:h})}})}})})}function wt(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 St(){return typeof window<"u"&&"ReactNativeWebView"in window}function kt(t){return{views:{card(e){return n(L,{...e,t:t.i18n.usePluginTranslation()})}},slots:[{name:"conversation.view",order:20,component(e){return n(at,{bridge:t,...e})}},{name:"conversation.hero.agentPreset",order:20,component(e){return n(it,{bridge:t,...e})}},{name:"settings.section",order:20,component(e){return n(lt,{bridge:t,...e})}}]}}export{kt as default};
package/dist/index.js CHANGED
@@ -101,24 +101,15 @@ var en_default = {
101
101
  },
102
102
  hero: {
103
103
  title: "Assessment record",
104
- body: "Choose this preset before the first turn. The protocol is added to every later turn, and the session panel appears after the first goal.",
105
- goal: "Goal",
106
- evidence: "Evidence",
107
- assets: "Assets",
108
- findings: "Findings",
104
+ body: "The session panel appears after the first goal.",
109
105
  current: "This session records {{target}}"
110
106
  },
111
107
  settings: {
112
108
  title: "Assessment record",
113
- lead: "The panel shows a window of the latest records. Exports read the full store. A delegated session can only submit onto its parent.",
114
109
  window: "Records kept in the session panel",
115
110
  windowHint: "From 20 to 200. The stored record is not trimmed.",
116
111
  authorization: "Include the authorization note in exported reports",
117
- saved: "Saved",
118
- card: {
119
- title: "Assessment record",
120
- description: "Window size and report options are in the Assessment record section."
121
- }
112
+ saved: "Saved"
122
113
  },
123
114
  card: {
124
115
  recorded: "Recorded {{id}}",
@@ -981,7 +972,7 @@ function submitFrom(args) {
981
972
  // src/index.ts
982
973
  var pentestPlugin = definePlugin({
983
974
  id: "pentest",
984
- apiVersion: 49,
975
+ apiVersion: 50,
985
976
  activate(ctx) {
986
977
  const store = createStore(ctx.paths.dataDir);
987
978
  ctx.sessionProjections.register({ name: GRAPH_PROJECTION });
@@ -1090,11 +1081,6 @@ var pentestPlugin = definePlugin({
1090
1081
  }
1091
1082
  }
1092
1083
  });
1093
- ctx.settingsCard({
1094
- titleKey: "settings.card.title",
1095
- descriptionKey: "settings.card.description",
1096
- fields: []
1097
- });
1098
1084
  }
1099
1085
  });
1100
1086
  function createService(ctx, store) {
package/locales/en.json CHANGED
@@ -94,24 +94,15 @@
94
94
  },
95
95
  "hero": {
96
96
  "title": "Assessment record",
97
- "body": "Choose this preset before the first turn. The protocol is added to every later turn, and the session panel appears after the first goal.",
98
- "goal": "Goal",
99
- "evidence": "Evidence",
100
- "assets": "Assets",
101
- "findings": "Findings",
97
+ "body": "The session panel appears after the first goal.",
102
98
  "current": "This session records {{target}}"
103
99
  },
104
100
  "settings": {
105
101
  "title": "Assessment record",
106
- "lead": "The panel shows a window of the latest records. Exports read the full store. A delegated session can only submit onto its parent.",
107
102
  "window": "Records kept in the session panel",
108
103
  "windowHint": "From 20 to 200. The stored record is not trimmed.",
109
104
  "authorization": "Include the authorization note in exported reports",
110
- "saved": "Saved",
111
- "card": {
112
- "title": "Assessment record",
113
- "description": "Window size and report options are in the Assessment record section."
114
- }
105
+ "saved": "Saved"
115
106
  },
116
107
  "card": {
117
108
  "recorded": "Recorded {{id}}",
@@ -94,24 +94,15 @@
94
94
  },
95
95
  "hero": {
96
96
  "title": "评估记录",
97
- "body": "首轮之前可以选择这个预设。之后每一轮都会带上记录协议,记下第一个目标后会话里会出现面板。",
98
- "goal": "目标",
99
- "evidence": "事实",
100
- "assets": "资产",
101
- "findings": "发现",
97
+ "body": "记下第一个目标后,会话里会出现面板。",
102
98
  "current": "这条会话正在记录 {{target}}"
103
99
  },
104
100
  "settings": {
105
101
  "title": "评估记录",
106
- "lead": "面板只显示最近的一窗记录。导出读的是完整存储。委派会话只能向父会话提交。",
107
102
  "window": "会话面板保留的记录数",
108
103
  "windowHint": "20 到 200。存储里的记录不会被裁掉。",
109
104
  "authorization": "导出的报告包含授权说明",
110
- "saved": "已保存",
111
- "card": {
112
- "title": "评估记录",
113
- "description": "窗口大小和报告选项在「评估记录」分区里。"
114
- }
105
+ "saved": "已保存"
115
106
  },
116
107
  "card": {
117
108
  "recorded": "已记录 {{id}}",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/plugin-pentest",
3
- "version": "0.2.3608",
3
+ "version": "0.2.3635",
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.3608"
27
+ "@ycodium-ai/plugin-api": "0.2.3635"
28
28
  },
29
29
  "ycodium": {
30
30
  "plugin": "./dist/index.js",