@weppy/roblox-mcp 2.17.3 → 2.17.5
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/CHANGELOG.md +15 -0
- package/README.md +2 -2
- package/dashboard/dist/assets/{AiPromptExamples-DniGyTTn.js → AiPromptExamples-B3LZ06_M.js} +1 -1
- package/dashboard/dist/assets/AssetsPage-DBMNmn9Z.js +61 -0
- package/dashboard/dist/assets/ChangelogPage-D_G_HjiK.js +1 -0
- package/dashboard/dist/assets/{ConfirmModal-Dp7bIaIr.js → ConfirmModal-CL0Z5xwJ.js} +1 -1
- package/dashboard/dist/assets/{ConnectionPage-C9BrvjSI.js → ConnectionPage-DaYME7QT.js} +1 -1
- package/dashboard/dist/assets/{ControlsPage-Cz7l6oLO.js → ControlsPage-gnKyi48F.js} +1 -1
- package/dashboard/dist/assets/CurrentPlaceScope-CHRh7s-z.js +1 -0
- package/dashboard/dist/assets/{GameChangeDetail-COMtVAQK.js → GameChangeDetail-CbYXbvWl.js} +1 -1
- package/dashboard/dist/assets/{InfoLabel-Duu_xBC8.js → InfoLabel-BaayM8hW.js} +1 -1
- package/dashboard/dist/assets/{OverviewPage-Bw6nCN_K.js → OverviewPage-DuPB7VBe.js} +1 -1
- package/dashboard/dist/assets/{PageHeader-DCh0GrcW.js → PageHeader-C1A4pFFD.js} +2 -2
- package/dashboard/dist/assets/PlaceSelectOptions-DU7Ka-gE.js +1 -0
- package/dashboard/dist/assets/PlaytestAiPromptExamples-Bf494cNk.js +1 -0
- package/dashboard/dist/assets/PlaytestPage-BkuJr8Va.css +1 -0
- package/dashboard/dist/assets/PlaytestPage-JPS-_xPE.js +127 -0
- package/dashboard/dist/assets/{SettingsPage-DOx4zPQB.js → SettingsPage-Om-hGqIQ.js} +1 -1
- package/dashboard/dist/assets/{StatusBadge-DB7SzHxU.js → StatusBadge-CiHSf_o_.js} +1 -1
- package/dashboard/dist/assets/SyncPage-BTADHgCn.js +1 -0
- package/dashboard/dist/assets/{Tabs-8coaSlFl.js → Tabs-C0QQfjUl.js} +1 -1
- package/dashboard/dist/assets/{TierPromoPanel-C6AtGEJN.js → TierPromoPanel-DI3EP06A.js} +1 -1
- package/dashboard/dist/assets/ToolsPage-CCsd60Kh.js +1 -0
- package/dashboard/dist/assets/{TooltipText-B2gmJunf.js → TooltipText-INE_h7BS.js} +1 -1
- package/dashboard/dist/assets/{UiStudioPage-CNWTVJ4w.js → UiStudioPage-TfbhZvt5.js} +2 -2
- package/dashboard/dist/assets/{WhatsNewPage-CX_N1RVO.js → WhatsNewPage-BPKMcfVs.js} +1 -1
- package/dashboard/dist/assets/{bot-DRBnM_Dv.js → bot-TMxhORyF.js} +1 -1
- package/dashboard/dist/assets/{check-DFGDcGQp.js → check-C5Uo2cs_.js} +1 -1
- package/dashboard/dist/assets/{copy-DGkh5PJA.js → copy-BENnfclm.js} +1 -1
- package/dashboard/dist/assets/{index-UFZ5peom.js → index-ZP3F-qh6.js} +66 -258
- package/dashboard/dist/assets/{sample-requests-CcJyTFj5.js → sample-requests-DVllzgEu.js} +1 -1
- package/dashboard/dist/assets/{trash-2-OtWthCQY.js → trash-2-C7bZq3Km.js} +1 -1
- package/dashboard/dist/assets/{useLiveUptime-hS0F15wX.js → useLiveUptime-CBpmama-.js} +1 -1
- package/dashboard/dist/assets/{useSettings-B6gBfQjz.js → useSettings-Ug_fLuUn.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/index.js +147 -147
- package/package.json +2 -2
- package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
- package/dashboard/dist/assets/AssetsPage--90xGzmZ.js +0 -61
- package/dashboard/dist/assets/ChangelogPage-Bg9Kg_qZ.js +0 -1
- package/dashboard/dist/assets/CurrentPlaceScope-BjpoPQlM.js +0 -1
- package/dashboard/dist/assets/PlaytestAiPromptExamples-Cv4yOTd0.js +0 -1
- package/dashboard/dist/assets/PlaytestPage-C3Vjgtlg.css +0 -1
- package/dashboard/dist/assets/PlaytestPage-DM7NkrhI.js +0 -127
- package/dashboard/dist/assets/SyncPage-Bgb0V6Yy.js +0 -1
- package/dashboard/dist/assets/ToolsPage-DkCD8pPL.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,b,k as C,D as F,u as O,j as e,a as U,d as V,e as W,i as q,T as G}from"./index-UFZ5peom.js";import{B as R,a as P,P as z}from"./PageHeader-DCh0GrcW.js";import{I}from"./InfoLabel-Duu_xBC8.js";import{T as j}from"./TooltipText-B2gmJunf.js";import{C as H}from"./ConfirmModal-Dp7bIaIr.js";import{C as E}from"./CurrentPlaceScope-BjpoPQlM.js";import{S as Y}from"./StatusBadge-DB7SzHxU.js";import{T as K}from"./TierPromoPanel-C6AtGEJN.js";import"./ConfirmModal.module-DJksQHBd.js";const J=5e3;function Q(){const[t,s]=c.useState(null),[l,a]=c.useState([]),[v,g]=c.useState(!0),[y,f]=c.useState(null),[_,w]=c.useState(null),[r,u]=c.useState({report:null,loading:!1,applying:!1,error:null}),D=c.useRef(null),N=c.useRef(null),x=c.useCallback(async()=>{var p;try{const[n,m]=await Promise.all([b.get("/sync/status"),b.get("/api/dashboard/place-summary")]);s(n);const T=(p=m.places)==null?void 0:p.find(M=>M.isActive);return f((T==null?void 0:T.placeDirName)??null),w(m.activePlaceId),m.activePlaceId}catch{return null}},[]),L=c.useCallback(async()=>{try{const p=await b.get("/sync/history",{limit:"30"});a(p.entries??[])}catch{a([])}},[]),o=c.useCallback(async p=>{if(p===null){u({report:null,loading:!1,applying:!1,error:null});return}u(n=>({...n,loading:!0,error:null}));try{const n=await b.get("/api/sync/migration",{placeId:String(p)});u(m=>({...m,report:n,loading:!1,error:n.status==="blocked"?"migration_blocked":null}))}catch(n){if(n instanceof C&&(n.status===404||n.status===503)){u(m=>({...m,report:null,loading:!1,error:null}));return}u(m=>({...m,loading:!1,error:"unknown"}))}},[]),h=c.useCallback(async()=>{const[p]=await Promise.all([x(),L()]);await o(p),g(!1)},[x,L,o]),k=c.useCallback(()=>{h()},[h]),A=c.useCallback(async()=>{await o(_)},[_,o]),d=c.useCallback(async()=>{const p=r.report;if(!(!p||p.status!=="ready"||r.applying)){u(n=>({...n,applying:!0,error:null}));try{const n=await b.post("/api/sync/migration",{placeId:p.placeId,fromVersion:2,previewFingerprint:p.previewFingerprint,apply:!0});u({report:n,loading:!1,applying:!1,error:null}),await x()}catch(n){if(n instanceof C&&n.status===409&&(n.error==="preview_stale"||n.error==="migration_blocked")){const m=n.error;await o(p.placeId),u(T=>({...T,applying:!1,error:m}));return}u(m=>({...m,applying:!1,error:"unknown"}))}}},[o,x,r.applying,r.report]),S=c.useCallback(async()=>{await b.post("/api/dashboard/sync/history/clear"),a([]),x()},[x]);return c.useEffect(()=>(h(),N.current=setInterval(h,J),()=>{N.current&&clearInterval(N.current)}),[h]),c.useEffect(()=>{const p=new F;D.current=p,p.connect();const n=p.on("sync",()=>{h()});return()=>{n(),p.disconnect(),D.current=null}},[h]),{status:t,history:l,loading:v,activePlaceDirName:y,migration:r,refresh:k,refreshMigration:A,applyMigration:d,clearHistory:S}}const X="_page_1rrgy_2",Z="_card_1rrgy_10",ee="_cardHeader_1rrgy_17",te="_clearButton_1rrgy_29",ie="_statusRow_1rrgy_53",oe="_metaItem_1rrgy_60",ae="_statusGrid_1rrgy_66",se="_migrationPanel_1rrgy_85",re="_migrationHeader_1rrgy_92",ne="_migrationTitle_1rrgy_99",ce="_migrationDescription_1rrgy_108",le="_migrationLedger_1rrgy_116",pe="_migrationLedgerItem_1rrgy_123",ye="_migrationLedgerBlocked_1rrgy_148",de="_migrationSection_1rrgy_152",ue="_migrationList_1rrgy_166",ge="_migrationRow_1rrgy_176",me="_migrationOperation_1rrgy_189",he="_migrationRowBody_1rrgy_194",fe="_migrationNotice_1rrgy_215",_e="_migrationActions_1rrgy_222",xe="_migrationButton_1rrgy_228",je="_policySummary_1rrgy_265",ve="_policySummaryItem_1rrgy_276",Se="_policyPrimaryValue_1rrgy_301",we="_policyReviewNotice_1rrgy_307",Ne="_policyApplySection_1rrgy_318",be="_policyApplyHeader_1rrgy_322",Ie="_policyApplyTitle_1rrgy_326",Le="_policyApplyDescription_1rrgy_334",Te="_policyInfoLabel_1rrgy_342",Re="_policySafetyRow_1rrgy_353",De="_policySafetyLabel_1rrgy_365",ke="_policySafetyBadge_1rrgy_371",Ae="_policyDisclosure_1rrgy_375",Ce="_policyDisclosureIcon_1rrgy_407",Pe="_policyDisclosureIconOpen_1rrgy_414",Ee="_policyScopeList_1rrgy_418",Be="_policyScopeRow_1rrgy_425",$e="_policyScopeName_1rrgy_439",Oe="_policyDirectionRail_1rrgy_451",He="_policyDirectionEndpoint_1rrgy_467",Me="_policyDirectionEndpointStudio_1rrgy_474",Fe="_policyDirectionArrow_1rrgy_478",Ue="_forwardBadge_1rrgy_521",Ve="_logContainer_1rrgy_536",We="_logEntry_1rrgy_543",qe="_logTime_1rrgy_555",Ge="_logType_1rrgy_561",ze="_logTypeWrite_1rrgy_570",Ye="_logTypeUpdate_1rrgy_574",Ke="_logTypeDelete_1rrgy_578",Je="_logTypeIdle_1rrgy_582",Qe="_logPath_1rrgy_586",Xe="_logEmpty_1rrgy_593",Ze="_overlay_1rrgy_600",et="_overlayTitle_1rrgy_610",tt="_overlayMessage_1rrgy_617",it="_checklist_1rrgy_623",ot="_checkItem_1rrgy_633",i={page:X,card:Z,cardHeader:ee,clearButton:te,statusRow:ie,metaItem:oe,statusGrid:ae,migrationPanel:se,migrationHeader:re,migrationTitle:ne,migrationDescription:ce,migrationLedger:le,migrationLedgerItem:pe,migrationLedgerBlocked:ye,migrationSection:de,migrationList:ue,migrationRow:ge,migrationOperation:me,migrationRowBody:he,migrationNotice:fe,migrationActions:_e,migrationButton:xe,policySummary:je,policySummaryItem:ve,policyPrimaryValue:Se,policyReviewNotice:we,policyApplySection:Ne,policyApplyHeader:be,policyApplyTitle:Ie,policyApplyDescription:Le,policyInfoLabel:Te,policySafetyRow:Re,policySafetyLabel:De,policySafetyBadge:ke,policyDisclosure:Ae,policyDisclosureIcon:Ce,policyDisclosureIconOpen:Pe,policyScopeList:Ee,policyScopeRow:Be,policyScopeName:$e,policyDirectionRail:Oe,policyDirectionEndpoint:He,policyDirectionEndpointStudio:Me,policyDirectionArrow:Fe,forwardBadge:Ue,logContainer:Ve,logEntry:We,logTime:qe,logType:Ge,logTypeWrite:ze,logTypeUpdate:Ye,logTypeDelete:Ke,logTypeIdle:Je,logPath:Qe,logEmpty:Xe,overlay:Ze,overlayTitle:et,overlayMessage:tt,checklist:it,checkItem:ot};function at(t){return t==="add"?"success":t==="delete"?"danger":"accent"}function st(t){return`sync.migration.reason.${t}`}function rt(t){return`sync.migration.reason.${t}`}function nt({migration:t,onRefresh:s,onApply:l}){const{t:a}=O(),[v,g]=c.useState(!1),y=t==null?void 0:t.report;if(!t||!y||y.status==="not_required")return null;const f=y.status==="blocked",_=y.status==="ready"&&!t.loading&&!t.applying,w=async()=>{await l(),g(!1)};return e.jsxs("section",{className:`${i.card} ${i.migrationPanel}`,"aria-labelledby":"sync-migration-title",children:[e.jsxs("div",{className:i.migrationHeader,children:[e.jsxs("div",{children:[e.jsx("h2",{id:"sync-migration-title",className:i.migrationTitle,children:a("sync.migration.title","Sync format update available")}),e.jsx("p",{className:i.migrationDescription,children:a("sync.migration.description","Review the metadata changes before updating this place from sync format v2 to v3.")})]}),e.jsx(R,{variant:f?"warning":"accent",children:f?a("sync.migration.status.blocked","Blocked"):a("sync.migration.status.ready","Ready to review")})]}),e.jsxs("div",{className:i.migrationLedger,"aria-label":a("sync.migration.preview","Review changes"),children:[e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.add","Add")}),e.jsx("strong",{children:y.summary.add})]}),e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.modify","Modify")}),e.jsx("strong",{children:y.summary.modify})]}),e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.delete","Delete")}),e.jsx("strong",{children:y.summary.delete})]}),e.jsxs("div",{className:`${i.migrationLedgerItem} ${f?i.migrationLedgerBlocked:""}`,children:[e.jsx("span",{children:a("sync.migration.summary.blocked","Blocked")}),e.jsx("strong",{children:y.summary.blocked})]})]}),y.changes.length>0&&e.jsxs("div",{className:i.migrationSection,children:[e.jsx("h3",{children:a("sync.migration.changes","Metadata changes")}),e.jsx("ul",{className:i.migrationList,children:y.changes.map(r=>e.jsxs("li",{className:i.migrationRow,children:[e.jsx(R,{variant:at(r.operation),className:i.migrationOperation,children:a(`sync.migration.operation.${r.operation}`,r.operation)}),e.jsxs("div",{className:i.migrationRowBody,children:[e.jsx("code",{children:r.path}),e.jsx("span",{children:a(st(r.reason),r.reason.replace(/_/g," "))})]})]},`${r.operation}:${r.path}`))})]}),y.blockers.length>0&&e.jsxs("div",{className:i.migrationSection,children:[e.jsx("h3",{children:a("sync.migration.blockers","Items to resolve")}),e.jsx("ul",{className:i.migrationList,children:y.blockers.map((r,u)=>e.jsxs("li",{className:i.migrationRow,children:[e.jsx(R,{variant:"warning",className:i.migrationOperation,children:a("sync.migration.summary.blocked","Blocked")}),e.jsxs("div",{className:i.migrationRowBody,children:[r.path&&e.jsx("code",{children:r.path}),e.jsx("span",{children:a(rt(r.reason),r.reason.replace(/_/g," "))})]})]},`${r.reason}:${r.path??u}`))})]}),e.jsxs("div",{className:i.migrationNotice,"aria-live":"polite",children:[(f||t.error==="migration_blocked")&&e.jsx("span",{children:a("sync.migration.blocked","Resolve sync conflicts before updating")}),t.error==="preview_stale"&&e.jsx("span",{children:a("sync.migration.stale","Preview changed. Review the latest diff.")}),t.error==="unknown"&&e.jsx("span",{children:a("sync.migration.error","Could not update the sync format. Try again.")})]}),e.jsxs("div",{className:i.migrationActions,children:[e.jsx(P,{variant:"secondary",className:i.migrationButton,disabled:t.loading||t.applying,onClick:()=>void s(),children:t.loading?a("sync.migration.refreshing","Refreshing…"):a("sync.migration.refresh","Refresh preview")}),e.jsx(P,{variant:"primary",className:i.migrationButton,disabled:!_,onClick:()=>g(!0),children:t.applying?a("sync.migration.applying","Applying…"):a("sync.migration.apply","Apply update")})]}),e.jsx(H,{open:v,title:a("sync.migration.confirm.title","Apply sync format update?"),message:a("sync.migration.confirm.message","Back up and update the listed sync metadata. Your Luau source files will not change."),cancelLabel:a("common.cancel","Cancel"),confirmLabel:a("sync.migration.apply","Apply update"),loading:t.applying,onCancel:()=>!t.applying&&g(!1),onConfirm:()=>void w()})]})}const ct=["scriptSource","properties","structure","serviceProperties"];function lt(t){const s=new Date(t);return`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`}function pt(t){switch(t){case"write":return i.logTypeWrite;case"update":return i.logTypeUpdate;case"delete":return i.logTypeDelete;default:return i.logTypeIdle}}function yt(t){switch(t){case"syncing":return"syncing";case"initializing":return"initializing";case"idle":return"idle";default:return"offline"}}function dt(t,s){const l={studio_first:"Studio First",bidirectional_review:"Bidirectional",local_code_studio_world:"Local Code, Studio World",custom:"Custom"};return t(`sync.policy.preset.${s}`,l[s])}function B(t,s){return s==="auto"?t("sync.policy.apply.auto","Auto apply"):t("sync.policy.apply.manual","Review first")}function ut(t,s){const l={forward:"Studio → Local",reverse:"Local → Studio",bidirectional:"Both ways"};return t(`sync.policy.direction.${s}`,l[s])}function gt(t){return{forward:"←",reverse:"→",bidirectional:"⇄"}[t]}function mt(t,s){const l={forward:"Studio changes are written to local files.",reverse:"Local file changes are applied to Studio.",bidirectional:"Changes can move from Studio to local files and from local files to Studio."};return t(`sync.policy.direction.${s}.tooltip`,l[s])}function $(...t){const s=t[0]??"",l=s.includes("\\")&&!s.includes("/")?"\\":"/";return t.filter(a=>a.length>0).map((a,v)=>v===0?a.replace(/[\\/]+$/g,""):a.replace(/^[\\/]+|[\\/]+$/g,"")).join(l)}function ht(t){const s=t.replace(/[\\/]+$/g,""),l=s.split(/[\\/]+/);return l[l.length-1]??s}function ft(t,s){const l=ht(t);return l==="explorer"?t:l===s?$(t,"explorer"):$(t,s,"explorer")}function _t(t,s){return s?t("sync.policy.safety.auto","Auto delete to Studio"):t("sync.policy.safety.review","Review before delete")}function xt(t,s){return s?t("sync.policy.safety.auto.tooltip","Deleting local files may automatically remove matching Studio instances. This is separate from UI Studio automatic cleanup."):t("sync.policy.safety.review.tooltip","Local file deletions wait for review before matching Studio instances are removed. This is separate from UI Studio automatic cleanup.")}function jt(t,s){switch(s){case"write":return t("sync.log.type.write","WRITE");case"update":return t("sync.log.type.update","UPDATE");case"delete":return t("sync.log.type.delete","DELETE");default:return t("sync.log.type.idle","IDLE")}}function vt(t,s){switch(s){case"write":return t("sync.log.type.write.tooltip","A new sync output was written to disk.");case"update":return t("sync.log.type.update.tooltip","An existing synced file or instance was updated.");case"delete":return t("sync.log.type.delete.tooltip","A synced file or instance was removed.");default:return t("sync.log.type.idle.tooltip","A sync event was recorded without a file mutation.")}}function kt(){const{t}=O(),{trackEvent:s}=U(),{level:l}=V(),{tier:a,loading:v}=W(),g=Q(),{show:y}=q(),[f,_]=c.useState(!1),[w,r]=c.useState(!1),[u,D]=c.useState(!1),N=!v&&a==="basic",x=l==="disconnected"||l==="serverOnly",L=e.jsx(z,{title:t("page.sync.title","Sync"),description:t("page.sync.description","Monitor Studio to local sync status, direction, apply mode, and recent sync logs."),helpTopicId:"sync",helpState:{connectionLevel:l,tier:a}});if(x)return e.jsxs("div",{className:i.page,children:[L,e.jsx(E,{surface:"sync"}),e.jsx("div",{className:i.card,children:e.jsxs("div",{className:i.overlay,children:[e.jsx("div",{className:i.overlayTitle,children:t("sync.overlay.title","Roblox Studio plugin required")}),e.jsx("div",{className:i.overlayMessage,children:t("sync.overlay.message","Sync status will be available once the Roblox Studio plugin connects.")}),e.jsxs("ul",{className:i.checklist,children:[e.jsx("li",{className:i.checkItem,children:t("sync.overlay.check1","Is Roblox Studio running?")}),e.jsx("li",{className:i.checkItem,children:t("sync.overlay.check2","Is the WEPPY Plugin installed?")})]})]})})]});const o=g.status,h=g.history,k=yt(o==null?void 0:o.state),A=async()=>{r(!0);try{await g.clearHistory(),y(t("toast.clearSuccess","Cleared successfully"),"success"),_(!1)}catch{y(t("toast.clearFailed","Failed to clear data"),"error")}finally{r(!1)}};return e.jsxs("div",{className:i.page,children:[L,e.jsx(E,{surface:"sync"}),e.jsxs("div",{className:i.card,children:[e.jsxs("div",{className:i.cardHeader,children:[e.jsx(j,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),N&&e.jsx(j,{text:t("sync.status.forwardOnly.tooltip","Basic tier allows Studio to local forward sync only."),children:e.jsx("span",{className:i.forwardBadge,children:t("sync.status.forwardOnly","Forward Only")})})]}),e.jsxs("div",{className:i.statusRow,children:[e.jsx(Y,{status:k}),(o==null?void 0:o.placeName)&&e.jsxs("span",{className:i.metaItem,children:[e.jsx(I,{label:t("sync.status.place","Place"),tooltip:t("sync.status.place.tooltip","Connected Roblox place name and place ID.")}),": ",o.placeName,o.placeId?` (${o.placeId})`:""]})]}),e.jsxs("dl",{className:i.statusGrid,children:[(o==null?void 0:o.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.path","Place Root"),tooltip:t("sync.status.path.tooltip","Local filesystem root currently used for this place sync output.")})}),e.jsx("dd",{children:o.syncRoot})]}),g.activePlaceDirName&&(o==null?void 0:o.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.placePath","Explorer Path"),tooltip:t("sync.status.placePath.tooltip","Explorer files path for the active place.")})}),e.jsx("dd",{children:ft(o.syncRoot,g.activePlaceDirName)})]}),(o==null?void 0:o.instanceCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.instances","Instances"),tooltip:t("sync.status.instances.tooltip","Total synced Roblox instances tracked in the local mirror.")})}),e.jsx("dd",{children:o.instanceCount})]}),(o==null?void 0:o.scriptCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.scripts","Scripts"),tooltip:t("sync.status.scripts.tooltip","Total synced script files currently indexed for this place.")})}),e.jsx("dd",{children:o.scriptCount})]}),(o==null?void 0:o.state)==="syncing"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.state","State"),tooltip:t("sync.status.state.tooltip","Current runtime sync state reported by the server.")})}),e.jsx("dd",{children:t("status.syncing","Syncing")})]})]})]}),e.jsx(nt,{migration:g.migration,onRefresh:g.refreshMigration,onApply:g.applyMigration}),(o==null?void 0:o.policy)&&e.jsxs("div",{className:i.card,children:[e.jsx("div",{className:i.cardHeader,children:e.jsx(j,{text:t("sync.policy.title.tooltip","Effective Sync policy reported by the connected Studio plugin."),children:t("sync.policy.title","Sync Policy")})}),e.jsxs("dl",{className:i.policySummary,children:[e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.activation","Activation")}),e.jsx("dd",{children:e.jsx(R,{variant:o.syncEnabled?"success":"neutral",children:o.syncEnabled?t("sync.policy.activation.on","Sync ON"):t("sync.policy.activation.off","Sync OFF")})})]}),e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.preset","Workflow")}),e.jsx("dd",{className:i.policyPrimaryValue,children:dt(t,o.policy.preset)})]})]}),o.policyReviewRequired&&e.jsx("div",{className:i.policyReviewNotice,role:"status",children:t("sync.policy.reviewRequired","Review this policy in the Studio plugin before starting Sync.")}),e.jsxs("section",{className:i.policyApplySection,"aria-labelledby":"sync-policy-apply-title",children:[e.jsxs("div",{className:i.policyApplyHeader,children:[e.jsx("h3",{id:"sync-policy-apply-title",className:i.policyApplyTitle,children:t("sync.policy.apply.title","How local changes apply to Studio")}),e.jsx("p",{className:i.policyApplyDescription,children:t("sync.policy.apply.description","Shows whether changes made locally are reviewed first or applied to Studio automatically.")})]}),e.jsxs("dl",{className:i.policySummary,children:[e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(j,{text:t("sync.policy.apply.content.tooltip","Script Source, property, and Service property changes made locally. Instance creation, deletion, renaming, and moves are Structure changes."),children:e.jsx("span",{className:i.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.content","Content changes")})})}),e.jsx("dd",{children:B(t,o.policy.apply.contentChanges)})]}),e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(j,{text:t("sync.policy.apply.structure.tooltip","Instance creation, deletion, renaming, and moves made locally. Automatic local deletion additionally requires the separate delete option below."),children:e.jsx("span",{className:i.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.structure","Structure changes")})})}),e.jsx("dd",{children:B(t,o.policy.apply.structureChanges)})]})]}),e.jsxs("div",{className:i.policySafetyRow,children:[e.jsx("span",{className:i.policySafetyLabel,children:t("sync.policy.safety.localDeletes","Local delete → Studio instance removal")}),e.jsx(j,{text:xt(t,o.policy.autoApplyLocalDeletesToStudio),children:e.jsx(R,{variant:o.policy.autoApplyLocalDeletesToStudio?"warning":"neutral",className:i.policySafetyBadge,tabIndex:0,children:_t(t,o.policy.autoApplyLocalDeletesToStudio)})})]})]}),e.jsxs("button",{type:"button",className:i.policyDisclosure,"aria-expanded":u,"aria-controls":"sync-policy-scope-panel",onClick:()=>D(d=>!d),children:[e.jsx("span",{children:t("sync.policy.scope.disclosure","Scope directions")}),e.jsx("span",{"aria-hidden":"true",className:`${i.policyDisclosureIcon} ${u?i.policyDisclosureIconOpen:""}`,children:"⌄"})]}),u&&e.jsx("div",{id:"sync-policy-scope-panel",className:i.policyScopeList,children:ct.map(d=>{const S=o.policy.directions[d];return e.jsxs("div",{className:i.policyScopeRow,"data-testid":"sync-policy-scope-row",children:[e.jsx("span",{className:i.policyScopeName,children:t(`sync.policy.scope.${d}`,d)}),e.jsx(j,{text:mt(t,S),children:e.jsxs("span",{className:i.policyDirectionRail,"data-testid":"sync-policy-direction-rail",role:"img","aria-label":ut(t,S),tabIndex:0,children:[e.jsx("span",{className:i.policyDirectionEndpoint,children:t("sync.policy.endpoint.local","Local")}),e.jsx("span",{className:i.policyDirectionArrow,"aria-hidden":"true",children:gt(S)}),e.jsx("span",{className:`${i.policyDirectionEndpoint} ${i.policyDirectionEndpointStudio}`,children:t("sync.policy.endpoint.studio","Studio")})]})})]},d)})})]}),e.jsxs("div",{className:i.card,children:[e.jsxs("div",{className:i.cardHeader,children:[e.jsx("span",{children:t("sync.log.title","Sync Log")}),e.jsx("button",{className:i.clearButton,onClick:()=>{s("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),_(!0)},children:t("common.clear","Clear")})]}),e.jsx("div",{className:i.logContainer,children:h.length===0?e.jsx("div",{className:i.logEmpty,children:t("sync.log.empty","No sync events yet")}):h.map((d,S)=>e.jsxs("div",{className:i.logEntry,children:[e.jsx("span",{className:i.logTime,children:lt(d.timestamp)}),e.jsx(j,{text:vt(t,d.type),children:e.jsx("span",{className:`${i.logType} ${pt(d.type)}`,children:jt(t,d.type)})}),e.jsxs("span",{className:i.logPath,children:[d.path,d.details?` — ${d.details}`:""]})]},S))})]}),N&&e.jsx(K,{title:t("sync.upgrade.title","Explore Full Sync with Pro"),description:t("tier.banner.save","Save AI tokens with Pro!"),benefits:[t("sync.upgrade.benefit1","Bidirectional sync — edit files, auto-apply to Studio"),t("sync.upgrade.benefit2","Reverse sync — push file changes back to Studio"),t("sync.upgrade.benefit3","Full sync history and detailed change log")],upgradeLabel:t("sync.upgrade.buy","View Pro"),upgradeHref:G.sync}),e.jsx(H,{open:f,title:t("sync.clear.title","Clear sync log?"),message:t("sync.clear.message","This permanently removes the stored sync log for the current place."),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:w,onCancel:()=>!w&&_(!1),onConfirm:A})]})}export{kt as Component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as i,b as I,D as ht,u as at,X as mt,a as bt,i as xt}from"./index-UFZ5peom.js";import{P as ft}from"./PageHeader-DCh0GrcW.js";import{T as M}from"./TooltipText-B2gmJunf.js";import{C as _t}from"./ConfirmModal-Dp7bIaIr.js";import{T as gt,C as jt}from"./Tabs-8coaSlFl.js";import{C as yt}from"./CurrentPlaceScope-BjpoPQlM.js";import"./ConfirmModal.module-DJksQHBd.js";const Ct="_wrapper_1s3lp_2",Tt="_table_1s3lp_7",kt="_sortable_1s3lp_32",Nt="_sortArrow_1s3lp_41",St="_clickable_1s3lp_52",wt="_empty_1s3lp_57",A={wrapper:Ct,table:Tt,sortable:kt,sortArrow:Nt,clickable:St,empty:wt};function vt({columns:t,data:o,sortBy:c,sortDir:T="asc",onSort:b,onRowClick:l,rowKey:N,emptyMessage:S}){return e.jsx("div",{className:A.wrapper,children:e.jsxs("table",{className:A.table,children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map(h=>e.jsxs("th",{style:h.width?{width:h.width}:void 0,className:h.sortable?A.sortable:void 0,onClick:h.sortable&&b?()=>b(h.key):void 0,children:[e.jsx("span",{children:h.label}),h.sortable&&c===h.key&&e.jsx("span",{className:A.sortArrow,children:T==="asc"?"▴":"▾"})]},h.key))})}),e.jsx("tbody",{children:o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:A.empty,children:S||"No data"})}):o.map((h,w)=>{const C=N?N(h):String(w);return e.jsx("tr",{className:l?A.clickable:void 0,tabIndex:l?-1:void 0,onClick:l?_=>l(h,_.currentTarget):void 0,children:t.map(_=>e.jsx("td",{children:_.render?_.render(h):String(h[_.key]??"")},_.key))},C)})})]})})}function Mt(t){return{...t,sequenceNumber:typeof t.sequenceNumber=="number"?t.sequenceNumber:void 0,executionTimeMs:typeof t.executionTimeMs=="number"?t.executionTimeMs:void 0}}const Bt=50;function Pt(t){if(typeof t=="number")return{placeId:String(t)}}function Y(t,o){return typeof o!="number"?t:`${t}?placeId=${encodeURIComponent(String(o))}`}function Lt(t){const o=(t==null?void 0:t.placeId)??null,[c,T]=i.useState(null),[b,l]=i.useState(!0),[N,S]=i.useState([]),[h,w]=i.useState(0),[C,_]=i.useState(!1),[U,O]=i.useState(!0),[m,E]=i.useState(0),[g,F]=i.useState(""),B=i.useRef(null),k=i.useCallback(async()=>{l(!0);try{const j=Pt(o),u=j?await I.get("/api/dashboard/tool-stats",j):await I.get("/api/dashboard/tool-stats");T(u)}catch{}finally{l(!1)}},[o]),x=i.useCallback(async(j,u)=>{O(!0);try{const P={limit:String(Bt),offset:String(j)};u&&(P.tool=u),typeof o=="number"&&(P.placeId=String(o));const H=await I.get("/api/dashboard/history",P);S(H.entries.map(Mt)),w(H.total),_(H.hasMore)}catch{S([]),w(0),_(!1)}finally{O(!1)}},[o]),D=i.useCallback(()=>{k(),x(m,g)},[x,k,m,g]),V=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/history/clear",o)),x(m,g)},[x,m,g,o]),K=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/statistics/clear",o)),k()},[k,o]);return i.useEffect(()=>{k()},[k]),i.useEffect(()=>{x(m,g)},[x,m,g]),i.useEffect(()=>{const j=new ht;B.current=j,j.connect();const u=j.on("command",()=>{k(),x(m,g)});return()=>{u(),j.disconnect(),B.current=null}},[x,k,m,g]),{statistics:c,statsLoading:b,history:N,historyTotal:h,historyHasMore:C,historyLoading:U,historyOffset:m,historyToolFilter:g,setHistoryOffset:E,setHistoryToolFilter:F,refresh:D,clearHistory:V,clearStatistics:K}}const Et="_page_1rtjt_2",Ht="_card_1rtjt_14",At="_cardToolbar_1rtjt_21",Rt="_sectionTitle_1rtjt_29",It="_dangerButton_1rtjt_36",Ot="_proBadge_1rtjt_55",Ft="_statusOk_1rtjt_70",Dt="_statusFallback_1rtjt_83",$t="_statusUnsupported_1rtjt_96",qt="_statusWarning_1rtjt_109",Wt="_statusError_1rtjt_122",Ut="_tierBasic_1rtjt_136",Vt="_tierPro_1rtjt_140",Kt="_tierMixed_1rtjt_145",Gt="_filterRow_1rtjt_156",zt="_filterLabel_1rtjt_163",Jt="_filterSelect_1rtjt_172",Qt="_detailsButton_1rtjt_187",Zt="_detailShell_1rtjt_210",Xt="_detailHeader_1rtjt_218",Yt="_detailHeading_1rtjt_229",te="_detailTitle_1rtjt_236",ee="_detailRecordName_1rtjt_243",se="_detailHeaderActions_1rtjt_252",ae="_detailCloseButton_1rtjt_259",oe="_detailBody_1rtjt_282",le="_detailSection_1rtjt_294",re="_detailList_1rtjt_313",ie="_detailItem_1rtjt_319",ne="_detailLabel_1rtjt_326",ce="_detailValue_1rtjt_331",de="_pre_1rtjt_337",ue="_pagination_1rtjt_355",pe="_pageInfo_1rtjt_363",he="_btn_1rtjt_369",me="_tierDistribution_1rtjt_397",be="_tierBarWrap_1rtjt_401",xe="_tierBarBasic_1rtjt_409",fe="_tierBarPro_1rtjt_414",_e="_tierLabels_1rtjt_419",ge="_statsTableWrap_1rtjt_428",je="_statsTable_1rtjt_428",ye="_sortableHeader_1rtjt_460",Ce="_sortArrow_1rtjt_465",Te="_statsToolRow_1rtjt_469",ke="_statsActionRow_1rtjt_477",Ne="_expandButton_1rtjt_481",Se="_expandIcon_1rtjt_493",we="_actionLabel_1rtjt_498",ve="_emptyStats_1rtjt_505",Me="_summaryLine_1rtjt_511",a={page:Et,card:Ht,cardToolbar:At,sectionTitle:Rt,dangerButton:It,proBadge:Ot,statusOk:Ft,statusFallback:Dt,statusUnsupported:$t,statusWarning:qt,statusError:Wt,tierBasic:Ut,tierPro:Vt,tierMixed:Kt,filterRow:Gt,filterLabel:zt,filterSelect:Jt,detailsButton:Qt,detailShell:Zt,detailHeader:Xt,detailHeading:Yt,detailTitle:te,detailRecordName:ee,detailHeaderActions:se,detailCloseButton:ae,detailBody:oe,detailSection:le,detailList:re,detailItem:ie,detailLabel:ne,detailValue:ce,pre:de,pagination:ue,pageInfo:pe,btn:he,tierDistribution:me,tierBarWrap:be,tierBarBasic:xe,tierBarPro:fe,tierLabels:_e,statsTableWrap:ge,statsTable:je,sortableHeader:ye,sortArrow:Ce,statsToolRow:Te,statsActionRow:ke,expandButton:Ne,expandIcon:Se,actionLabel:we,emptyStats:ve,summaryLine:Me},Be=new Set(["clientId","placeId","pinnedTarget","recentPriority","globalQueue"]);function tt(t){return typeof t=="string"&&t.length>0?t:void 0}function Pe(t){if(!Array.isArray(t))return;const o=t.filter(c=>typeof c=="string"&&c.length>0);return o.length>0?o:void 0}function Le(t){const o=t.result??{};return{requestedCommand:t.requestedCommand??tt(o.requestedCommand),executedCommand:t.executedCommand??tt(o.executedCommand),alternatives:t.alternatives??Pe(o.alternatives)}}function ot(t,o){switch(t.status){case"fallback":return{label:o("tools.badge.fallback","FALLBACK"),tooltip:o("tools.badge.fallback.tooltip","The requested Pro action succeeded via a Basic fallback."),className:a.statusFallback};case"unsupported":return{label:o("tools.badge.unsupported","UNSUPPORTED"),tooltip:o("tools.badge.unsupported.tooltip","The requested Pro action was blocked and no fallback ran."),className:a.statusUnsupported};case"warning":return{label:o("tools.badge.warn","WARN"),tooltip:o("tools.badge.warn.tooltip","The tool call failed as an expected caller, project, policy, or user-code issue."),className:a.statusWarning};case"error":return{label:o("tools.badge.err","FAILED"),tooltip:o("tools.badge.err.tooltip","The tool run failed."),className:a.statusError};default:return{label:o("tools.status.ok","OK"),tooltip:o("tools.status.ok.tooltip","The tool run completed successfully."),className:a.statusOk}}}function y(t,o){return e.jsxs("div",{className:a.detailItem,children:[e.jsx("span",{className:a.detailLabel,children:t}),e.jsx("span",{className:a.detailValue,children:o})]})}function Ee(t){if(!t||typeof t!="object")return;const o=t;if(typeof o.selectionMode=="string"&&Be.has(o.selectionMode))return o}function et(t){if(!(!t||typeof t!="object"||!("routing"in t)))return Ee(t.routing)}function He(t){return t.routing??et(t.result)??et(t.data)}function Ae(t,o){return t.requestedClientId?t.requestedClientId:t.requestedPlaceId!==void 0?t.requestedPlaceId:o("tools.history.routing.none","No Studio target named")}function Re(t){return t.actualPlaceName?`${t.actualPlaceName} · ${t.actualPlaceId??"-"}`:t.actualClientId??"-"}function Ie({entry:t,onClose:o}){const{t:c}=at(),T=ot(t,c),b=Le(t),l=He(t);return e.jsxs("div",{className:a.detailShell,children:[e.jsxs("header",{className:a.detailHeader,children:[e.jsxs("div",{className:a.detailHeading,children:[e.jsx("span",{className:a.detailTitle,children:c("tools.detail.title","Tool execution")}),e.jsx("span",{className:a.detailRecordName,children:t.command})]}),e.jsxs("div",{className:a.detailHeaderActions,children:[e.jsx(M,{text:T.tooltip,children:e.jsx("span",{className:T.className,children:T.label})}),e.jsx("button",{type:"button",className:a.detailCloseButton,onClick:o,"aria-label":c("common.close","Close"),children:e.jsx(mt,{size:18,"aria-hidden":"true"})})]})]}),e.jsxs("div",{className:a.detailBody,children:[e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:e.jsx(M,{text:c("tools.detail.params.tooltip","Input parameters passed to this tool run."),children:c("tools.detail.params","Parameters")})}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.parameters,null,2)})]}),t.result&&e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:e.jsx(M,{text:c("tools.detail.result.tooltip","Returned result payload for this tool run."),children:c("tools.detail.result","Result")})}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.result,null,2)})]}),l&&e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:c("tools.history.routing","Routing")}),e.jsxs("div",{className:a.detailList,children:[y(c("tools.history.routing.mode","Mode"),l.selectionMode),y(c("tools.history.routing.requested","Requested"),Ae(l,c)),y(c("tools.history.routing.actual","Actual"),Re(l))]})]}),(t.status==="fallback"||t.status==="unsupported"||t.status==="warning"||t.status==="error")&&e.jsx("section",{className:a.detailSection,children:e.jsxs("div",{className:a.detailList,children:[t.status==="fallback"&&b.requestedCommand?y(c("tools.detail.requestedCommand","Requested Command"),b.requestedCommand):null,t.status==="fallback"&&b.executedCommand?y(c("tools.detail.executedCommand","Executed Command"),b.executedCommand):null,t.status==="fallback"&&b.alternatives?y(c("tools.detail.alternatives","Alternatives"),b.alternatives.join(", ")):null,t.status==="unsupported"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="unsupported"?y(c("tools.detail.noFallback","No Fallback"),c("tools.detail.noFallback.value","No fallback ran.")):null,t.status==="warning"&&t.warningMessage?y(c("tools.detail.warningMessage","Warning Message"),t.warningMessage):null,t.status==="error"&&t.errorMessage?y(c("tools.detail.errorMessage","Error Message"),t.errorMessage):null,t.status==="error"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="error"&&t.fallbackCommand?y(c("tools.detail.executedCommand","Executed Command"),t.fallbackCommand):null]})})]})]})}const G=50;function Oe(t){const o=new Date(t);return`${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}:${String(o.getSeconds()).padStart(2,"0")}`}function W(t){return typeof t!="number"||!Number.isFinite(t)?"-":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function R(t,o){return o==="pro"?t("tier.pro","Pro"):o==="mixed"?t("tier.mixed","Mixed"):t("tier.basic","Basic")}function lt(t,o){return o!==t&&o.startsWith(`${t}_`)?o.slice(t.length+1):""}function st(t,o){const c=lt(t,o);return c?`${t}.${c}`:t}function Ge(){const{t}=at(),{trackEvent:o,trackPageView:c}=bt(),[T,b]=i.useState(null),l=Lt({placeId:T}),{show:N}=xt(),[S,h]=i.useState("history"),[w,C]=i.useState(null),_=i.useRef(null),[U,O]=i.useState(null),[m,E]=i.useState(null),[g,F]=i.useState(!1),[B,k]=i.useState("totalCalls"),[x,D]=i.useState("desc"),V=i.useCallback(s=>{k(n=>n===s?(D(r=>r==="asc"?"desc":"asc"),s):(D("desc"),s))},[]),K=i.useMemo(()=>{var n;const s=new Set;return Object.keys(((n=l.statistics)==null?void 0:n.tools)??{}).forEach(r=>s.add(r)),l.history.forEach(r=>{r.tool&&s.add(r.tool)}),l.historyToolFilter&&s.add(l.historyToolFilter),Array.from(s).sort()},[l.history,l.historyToolFilter,l.statistics]),j=i.useMemo(()=>{var s;return(s=l.statistics)!=null&&s.tools?Object.values(l.statistics.tools).map(n=>{var X;const r=Object.entries(n.commands??{}).map(([p,d])=>({toolName:n.tool,commandName:d.command??p,label:lt(n.tool,d.command??p)||(d.command??p),tier:d.tier,totalCalls:d.totalCalls,successCount:d.successCount,fallbackCount:d.fallbackCount,unsupportedCount:d.unsupportedCount,warningCount:d.warningCount??0,failureCount:d.failureCount,totalExecutionTimeMs:d.totalExecutionTimeMs,avgExecutionTimeMs:d.avgExecutionTimeMs})),f=r.reduce((p,d)=>p+d.totalCalls,0),v=r.reduce((p,d)=>p+d.successCount,0),$=r.reduce((p,d)=>p+d.fallbackCount,0),q=r.reduce((p,d)=>p+d.unsupportedCount,0),dt=r.reduce((p,d)=>p+d.warningCount,0),ut=r.reduce((p,d)=>p+d.failureCount,0),Z=r.reduce((p,d)=>p+d.totalExecutionTimeMs,0),pt=new Set(r.map(p=>p.tier)).size>1?"mixed":((X=r[0])==null?void 0:X.tier)??n.tier;return{toolName:n.tool,tier:pt,commands:r,totalCalls:f,successCount:v,fallbackCount:$,unsupportedCount:q,warningCount:dt,failureCount:ut,totalExecutionTimeMs:Z,avgExecutionTimeMs:f>0?Math.round(Z/f):0}}):[]},[l.statistics]),u=i.useCallback((s,n,r,f)=>e.jsx(M,{text:t(r,f),children:t(s,n)}),[t]),P=i.useCallback((s,n)=>{_.current=n,C(s)},[]),H=i.useCallback(()=>{C(null)},[]),z=i.useMemo(()=>[...j].sort((n,r)=>{const f=n[B],v=r[B];if(typeof f=="number"&&typeof v=="number")return x==="asc"?f-v:v-f;const $=String(f??""),q=String(v??"");return x==="asc"?$.localeCompare(q):q.localeCompare($)}),[j,B,x]),rt=i.useMemo(()=>[{key:"timestamp",label:u("tools.col.time","Time","tools.col.time.tooltip","When the tool run was recorded."),width:"80px",render:s=>Oe(s.timestamp)},{key:"toolName",label:u("tools.col.toolAction","Tool.Action","tools.col.toolAction.tooltip","Tool name and action that were executed."),render:s=>e.jsxs("span",{children:[st(s.tool,s.command),s.tier==="pro"&&e.jsx(M,{text:t("tools.badge.pro.tooltip","This entry used a Pro-only tool or action."),children:e.jsx("span",{className:a.proBadge,children:t("tools.badge.pro","PRO")})})]})},{key:"executionTimeMs",label:u("tools.col.duration","Duration","tools.col.duration.tooltip","How long the tool took to finish."),width:"80px",render:s=>W(s.executionTimeMs)},{key:"status",label:u("tools.col.status","Status","tools.col.status.tooltip","Outcome of the recorded tool run."),width:"120px",render:s=>{const n=ot(s,t);return e.jsx(M,{text:n.tooltip,children:e.jsx("span",{className:n.className,children:n.label})})}},{key:"tier",label:u("tools.col.tier","Tier","tools.col.tier.tooltip","License tier required for the tool or action."),width:"60px",render:s=>e.jsx("span",{className:s.tier==="pro"?a.tierPro:a.tierBasic,children:R(t,s.tier)})},{key:"details",label:t("tools.detail.open","Details"),width:"84px",render:s=>{const n=st(s.tool,s.command);return e.jsx("button",{type:"button",className:a.detailsButton,"aria-haspopup":"dialog","aria-label":t("tools.detail.openLabel","View details for {command}").replace("{command}",n),onClick:r=>{r.stopPropagation(),P(s,r.currentTarget)},children:t("tools.detail.open","Details")})}}],[P,t,u]),J=i.useMemo(()=>[{key:"toolName",label:u("tools.col.tool","Tool","tools.col.tool.tooltip","Consolidated tool name in the statistics table."),sortable:!0},{key:"totalCalls",label:u("tools.col.calls","Calls","tools.col.calls.tooltip","Total number of recorded calls for this tool."),sortable:!0,width:"70px"},{key:"successCount",label:u("tools.col.ok","OK","tools.col.ok.tooltip","Number of direct successful runs."),sortable:!0,width:"70px"},{key:"fallbackCount",label:u("tools.col.fallback","FALLBACK","tools.col.fallback.tooltip","Number of runs that succeeded through fallback execution."),sortable:!0,width:"110px"},{key:"unsupportedCount",label:u("tools.col.unsupported","UNSUPPORTED","tools.col.unsupported.tooltip","Number of blocked runs without fallback execution."),sortable:!0,width:"130px"},{key:"warningCount",label:u("tools.col.warn","WARN","tools.col.warn.tooltip","Number of expected failures caused by caller input, project state, Roblox policy, or user code."),sortable:!0,width:"80px"},{key:"failureCount",label:u("tools.col.err","FAILED","tools.col.err.tooltip","Number of runs that failed."),sortable:!0,width:"70px"},{key:"avgExecutionTimeMs",label:u("tools.col.avgTime","Avg Time","tools.col.avgTime.tooltip","Average execution time across recorded calls."),sortable:!0,width:"90px",render:s=>W(s.avgExecutionTimeMs)},{key:"tier",label:u("tools.col.tier","Tier","tools.col.tierStats.tooltip","Basic, Pro, or Mixed summary for the tool statistics row."),sortable:!0,width:"70px",render:s=>e.jsx(M,{text:s.tier==="mixed"?t("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:s.tier==="pro"?a.tierPro:s.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(t,s.tier)})})}],[t,u]),L=i.useMemo(()=>{if(!l.statistics)return null;const s=l.statistics.tierSummary.basic.totalCalls,n=l.statistics.tierSummary.pro.totalCalls,r=s+n;if(r===0)return null;const f=Math.round(s/r*100),v=100-f;return{basic:s,pro:n,basicPct:f,proPct:v}},[l.statistics]),Q=i.useCallback(s=>{O(n=>n===s?null:s)},[]),it=i.useCallback(async()=>{if(m){F(!0);try{m==="history"?await l.clearHistory():await l.clearStatistics(),N(t("toast.clearSuccess","Cleared successfully"),"success"),E(null)}catch{N(t("toast.clearFailed","Failed to clear data"),"error")}finally{F(!1)}}},[m,N,t,l]),nt=i.useCallback(s=>{const n=s==="history"?"tools_history":"tools_statistics";o("dashboard_click_event",{click_target:s==="history"?"tools_tab_history":"tools_tab_statistics",page:"tools",tab:n}),c({page:"tools",tab:n}),C(null),h(s)},[o,c]),ct=["history","statistics"].map(s=>({key:s,label:t(`tools.tab.${s}`,s.charAt(0).toUpperCase()+s.slice(1))}));return e.jsxs("div",{className:a.page,children:[e.jsx(ft,{title:t("page.tools.title","Tools"),description:t("page.tools.description","Inspect tool history, outcomes, fallback details, and usage statistics."),helpTopicId:"tools"}),e.jsx(yt,{surface:"tools",selectable:!0,selectedPlaceId:T,onSelectedPlaceIdChange:s=>{C(null),b(s),l.setHistoryOffset(0)}}),e.jsx(gt,{items:ct,value:S,onChange:nt}),S==="history"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:t("tools.tab.history","History")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{o("dashboard_click_event",{click_target:"tools_clear_history",page:"tools",tab:"tools_history"}),E("history")},children:t("common.clear","Clear")})]}),e.jsx("div",{className:a.filterRow,children:e.jsxs("label",{className:a.filterLabel,children:[t("tools.filter.tool","Tool"),":",e.jsxs("select",{className:a.filterSelect,value:l.historyToolFilter,onChange:s=>{C(null),l.setHistoryToolFilter(s.target.value),l.setHistoryOffset(0)},children:[e.jsx("option",{value:"",children:t("tools.filter.all","All")}),K.map(s=>e.jsx("option",{value:s,children:s},s))]})]})}),e.jsx(vt,{columns:rt,data:l.history,rowKey:s=>s.id,onRowClick:(s,n)=>P(s,n),emptyMessage:t("tools.empty.history","No tool history entries for this place")}),e.jsxs("div",{className:a.pagination,children:[e.jsx("button",{className:a.btn,disabled:l.historyOffset===0,title:t("tools.page.prev.tooltip","Go to the previous page of tool history results."),onClick:()=>{C(null),l.setHistoryOffset(Math.max(0,l.historyOffset-G))},children:t("tools.page.prev","Prev")}),e.jsxs("span",{className:a.pageInfo,children:[l.historyOffset+1,"–",Math.min(l.historyOffset+G,l.historyTotal)," / ",l.historyTotal]}),e.jsx("button",{className:a.btn,disabled:!l.historyHasMore,title:t("tools.page.next.tooltip","Go to the next page of tool history results."),onClick:()=>{C(null),l.setHistoryOffset(l.historyOffset+G)},children:t("tools.page.next","Next")})]})]}),S==="statistics"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:t("tools.tab.statistics","Statistics")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{o("dashboard_click_event",{click_target:"tools_clear_statistics",page:"tools",tab:"tools_statistics"}),E("statistics")},children:t("common.clear","Clear")})]}),L&&e.jsxs("div",{className:a.tierDistribution,children:[e.jsxs("div",{className:a.tierBarWrap,children:[e.jsx("div",{className:a.tierBarBasic,style:{width:`${L.basicPct}%`}}),e.jsx("div",{className:a.tierBarPro,style:{width:`${L.proPct}%`}})]}),e.jsxs("div",{className:a.tierLabels,children:[e.jsxs("span",{children:[R(t,"basic")," ",L.basicPct,"% (",L.basic,")"]}),e.jsxs("span",{children:[R(t,"pro")," ",L.proPct,"% (",L.pro,")"]})]})]}),e.jsx("div",{className:a.statsTableWrap,children:e.jsxs("table",{className:a.statsTable,children:[e.jsx("thead",{children:e.jsx("tr",{children:J.map(s=>e.jsxs("th",{style:s.width?{width:s.width}:void 0,className:s.sortable?a.sortableHeader:void 0,onClick:s.sortable?()=>V(s.key):void 0,children:[e.jsx("span",{children:s.label}),s.sortable&&B===s.key&&e.jsx("span",{className:a.sortArrow,children:x==="asc"?"▴":"▾"})]},s.key))})}),e.jsx("tbody",{children:z.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:J.length,className:a.emptyStats,children:t("tools.empty.stats","No tool statistics for this place")})}):z.map(s=>{const n=U===s.toolName;return e.jsxs(i.Fragment,{children:[e.jsxs("tr",{className:a.statsToolRow,onClick:()=>Q(s.toolName),children:[e.jsx("td",{children:e.jsxs("button",{type:"button",className:a.expandButton,"aria-expanded":n,"aria-label":`${s.toolName} ${n?t("common.collapse","Collapse"):t("common.expand","Expand")}`,onClick:r=>{r.stopPropagation(),Q(s.toolName)},children:[e.jsx("span",{className:a.expandIcon,"aria-hidden":"true",children:n?"▾":"▸"}),e.jsx("span",{children:s.toolName})]})}),e.jsx("td",{children:s.totalCalls}),e.jsx("td",{children:s.successCount}),e.jsx("td",{children:s.fallbackCount}),e.jsx("td",{children:s.unsupportedCount}),e.jsx("td",{children:s.warningCount}),e.jsx("td",{children:s.failureCount}),e.jsx("td",{children:W(s.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx(M,{text:s.tier==="mixed"?t("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:s.tier==="pro"?a.tierPro:s.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(t,s.tier)})})})]}),n&&s.commands.map(r=>e.jsxs("tr",{className:a.statsActionRow,children:[e.jsx("td",{children:e.jsx("span",{className:a.actionLabel,children:r.label})}),e.jsx("td",{children:r.totalCalls}),e.jsx("td",{children:r.successCount}),e.jsx("td",{children:r.fallbackCount}),e.jsx("td",{children:r.unsupportedCount}),e.jsx("td",{children:r.warningCount}),e.jsx("td",{children:r.failureCount}),e.jsx("td",{children:W(r.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx("span",{className:r.tier==="pro"?a.tierPro:a.tierBasic,children:R(t,r.tier)})})]},`${s.toolName}:${r.commandName}`))]},s.toolName)})})]})}),l.statistics&&e.jsxs("div",{className:a.summaryLine,children:[t("tools.summary.total","Total"),": ",l.statistics.totalCalls," ",t("tools.summary.calls","calls")," | ",t("tools.summary.sessions","Sessions"),": ",l.statistics.totalSessions]})]}),e.jsx(jt,{open:w!==null,ariaLabel:t("tools.detail.dialogLabel","Tool execution detail"),onClose:H,returnFocusTo:_.current,testId:"tools-history-detail-popup-layer",children:w&&e.jsx(Ie,{entry:w,onClose:H})}),e.jsx(_t,{open:m!==null,title:m==="history"?t("tools.clear.history.title","Clear history?"):t("tools.clear.statistics.title","Clear statistics?"),message:m==="history"?t("tools.clear.history.message","This permanently removes the current place tools history."):t("tools.clear.statistics.message","This permanently resets the current place tool statistics."),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:g,onCancel:()=>!g&&E(null),onConfirm:it})]})}export{Ge as Component};
|