@runfusion/fusion 0.2.5 → 0.2.6

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.
Files changed (31) hide show
  1. package/dist/bin.js +269 -47
  2. package/dist/client/assets/{AgentDetailView-CkuuGA1O.js → AgentDetailView-CBdzWtd-.js} +1 -1
  3. package/dist/client/assets/{AgentsView-CWFLMIDP.js → AgentsView-DPlnCa_B.js} +3 -3
  4. package/dist/client/assets/{ChatView-C_T91ebd.js → ChatView-BXzYysNG.js} +1 -1
  5. package/dist/client/assets/{DevServerView-ChWTzTvy.js → DevServerView-BY5cGz23.js} +1 -1
  6. package/dist/client/assets/{DirectoryPicker-BMJIT7HD.js → DirectoryPicker-DZ90eSBn.js} +1 -1
  7. package/dist/client/assets/{DocumentsView-Co9to4Zp.css → DocumentsView-DV2DrCZb.css} +1 -1
  8. package/dist/client/assets/{DocumentsView-CjfVl8mZ.js → DocumentsView-lQwJmc4G.js} +1 -1
  9. package/dist/client/assets/{InsightsView-Rb735C9_.js → InsightsView-DUiZZ0z8.js} +1 -1
  10. package/dist/client/assets/{MemoryView-LLc_uNtG.js → MemoryView-DvSmMN6G.js} +1 -1
  11. package/dist/client/assets/{NodesView-BviqBWRA.js → NodesView-DgyM-ktg.js} +1 -1
  12. package/dist/client/assets/PiExtensionsManager-K7HQ08L4.css +1 -0
  13. package/dist/client/assets/PiExtensionsManager-wxB-q06A.js +11 -0
  14. package/dist/client/assets/{PluginManager-BywTPbLB.js → PluginManager-LH02ybSH.js} +1 -1
  15. package/dist/client/assets/PluginManager-tCFMZMLL.css +1 -0
  16. package/dist/client/assets/{RoadmapsView-Dhl--4vY.js → RoadmapsView-ANn2jmsU.js} +1 -1
  17. package/dist/client/assets/{SetupWizardModal-CVtmwoJC.js → SetupWizardModal-UxlAtKWA.js} +1 -1
  18. package/dist/client/assets/{SkillsView-CG9y4fsE.js → SkillsView-DEjGh7wW.js} +1 -1
  19. package/dist/client/assets/{folder-open-BVDq27HP.js → folder-open-J7yPbaCt.js} +1 -1
  20. package/dist/client/assets/index-BdJsO65L.css +1 -0
  21. package/dist/client/assets/index-CHoVMPAA.js +649 -0
  22. package/dist/client/assets/{upload-BDvpReDO.js → upload-B_grq4hM.js} +1 -1
  23. package/dist/client/index.html +2 -2
  24. package/dist/extension.js +70 -8
  25. package/dist/pi-claude-cli/package.json +1 -1
  26. package/package.json +5 -5
  27. package/dist/client/assets/PiExtensionsManager-CPgmJgDk.css +0 -1
  28. package/dist/client/assets/PiExtensionsManager-CriZBkQe.js +0 -11
  29. package/dist/client/assets/PluginManager-D64RIzmL.css +0 -1
  30. package/dist/client/assets/index-CikysL-d.js +0 -644
  31. package/dist/client/assets/index-Da1qmtc7.css +0 -1
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-CikysL-d.js";/**
1
+ import{c as a}from"./index-CHoVMPAA.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -78,11 +78,11 @@
78
78
  }
79
79
  })();
80
80
  </script>
81
- <script type="module" crossorigin src="/assets/index-CikysL-d.js"></script>
81
+ <script type="module" crossorigin src="/assets/index-CHoVMPAA.js"></script>
82
82
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-K0fH_qHe.js">
83
83
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-DzcZoU0P.js">
84
84
  <link rel="stylesheet" crossorigin href="/assets/vendor-xterm-LZoznX6r.css">
85
- <link rel="stylesheet" crossorigin href="/assets/index-Da1qmtc7.css">
85
+ <link rel="stylesheet" crossorigin href="/assets/index-BdJsO65L.css">
86
86
  </head>
87
87
  <body>
88
88
  <div id="root"></div>
package/dist/extension.js CHANGED
@@ -90,7 +90,10 @@ var init_settings_schema = __esm({
90
90
  settingsSyncConflictResolution: "last-write-wins",
91
91
  // Dashboard session state (persisted to global settings for PWA/offline restore)
92
92
  dashboardCurrentNodeId: void 0,
93
- dashboardCurrentProjectIdByNode: void 0
93
+ dashboardCurrentProjectIdByNode: void 0,
94
+ // Dashboard TUI memory guard
95
+ vitestAutoKillEnabled: true,
96
+ vitestKillThresholdPct: 90
94
97
  };
95
98
  DEFAULT_PROJECT_SETTINGS = {
96
99
  globalPause: false,
@@ -53739,6 +53742,63 @@ async function validateDiffScope(store, taskId, diffStat, strict = false) {
53739
53742
  }
53740
53743
  return result;
53741
53744
  }
53745
+ async function resolveTaskDiffBaseRef({
53746
+ cwd,
53747
+ headRef,
53748
+ baseBranch,
53749
+ baseCommitSha
53750
+ }) {
53751
+ const resolvedBaseBranch = baseBranch?.trim() || "main";
53752
+ const quotedHeadRef = quoteArg(headRef);
53753
+ let mergeBase;
53754
+ try {
53755
+ try {
53756
+ const { stdout } = await execAsync2(`git merge-base ${quotedHeadRef} ${quoteArg(resolvedBaseBranch)}`, {
53757
+ cwd,
53758
+ encoding: "utf-8"
53759
+ });
53760
+ mergeBase = stdout.trim() || void 0;
53761
+ } catch {
53762
+ const { stdout } = await execAsync2(`git merge-base ${quotedHeadRef} ${quoteArg(`origin/${resolvedBaseBranch}`)}`, {
53763
+ cwd,
53764
+ encoding: "utf-8"
53765
+ });
53766
+ mergeBase = stdout.trim() || void 0;
53767
+ }
53768
+ } catch {
53769
+ }
53770
+ if (mergeBase) {
53771
+ try {
53772
+ const { stdout } = await execAsync2(`git rev-parse ${quotedHeadRef}`, {
53773
+ cwd,
53774
+ encoding: "utf-8"
53775
+ });
53776
+ const headSha = stdout.trim();
53777
+ if (headSha && headSha !== mergeBase) return mergeBase;
53778
+ } catch {
53779
+ return mergeBase;
53780
+ }
53781
+ }
53782
+ if (baseCommitSha) {
53783
+ try {
53784
+ await execAsync2(`git merge-base --is-ancestor ${quoteArg(baseCommitSha)} ${quotedHeadRef}`, {
53785
+ cwd,
53786
+ encoding: "utf-8"
53787
+ });
53788
+ return baseCommitSha;
53789
+ } catch {
53790
+ }
53791
+ }
53792
+ try {
53793
+ const { stdout } = await execAsync2(`git rev-parse ${quoteArg(`${headRef}~1`)}`, {
53794
+ cwd,
53795
+ encoding: "utf-8"
53796
+ });
53797
+ return stdout.trim() || void 0;
53798
+ } catch {
53799
+ return void 0;
53800
+ }
53801
+ }
53742
53802
  async function getConflictedFiles(cwd) {
53743
53803
  try {
53744
53804
  const { stdout } = await execAsync2("git diff --name-only --diff-filter=U", {
@@ -54355,10 +54415,17 @@ async function aiMergeTask(store, rootDir, taskId, options = {}) {
54355
54415
  mergerLog.warn(`${taskId}: pre-merge rebase pipeline failed (${msg}) \u2014 proceeding without rebase`);
54356
54416
  }
54357
54417
  }
54418
+ const diffBaseRef = await resolveTaskDiffBaseRef({
54419
+ cwd: rootDir,
54420
+ headRef: branch,
54421
+ baseBranch: task.baseBranch,
54422
+ baseCommitSha: task.baseCommitSha
54423
+ });
54424
+ const contextDiffRange = diffBaseRef ? `${diffBaseRef}..${branch}` : `HEAD..${branch}`;
54358
54425
  let commitLog = "";
54359
54426
  let diffStat = "";
54360
54427
  try {
54361
- const { stdout: logOutput } = await execAsync2(`git log HEAD..${branch} --format="- %s"`, {
54428
+ const { stdout: logOutput } = await execAsync2(`git log ${contextDiffRange} --format="- %s"`, {
54362
54429
  cwd: rootDir,
54363
54430
  encoding: "utf-8"
54364
54431
  });
@@ -54367,12 +54434,7 @@ async function aiMergeTask(store, rootDir, taskId, options = {}) {
54367
54434
  commitLog = "(unable to read commit log)";
54368
54435
  }
54369
54436
  try {
54370
- const { stdout: mergeBaseOutput } = await execAsync2(`git merge-base HEAD ${branch}`, {
54371
- cwd: rootDir,
54372
- encoding: "utf-8"
54373
- });
54374
- const mergeBase = mergeBaseOutput.trim();
54375
- const { stdout: diffOutput } = await execAsync2(`git diff ${mergeBase}..${branch} --stat`, {
54437
+ const { stdout: diffOutput } = await execAsync2(`git diff ${contextDiffRange} --stat`, {
54376
54438
  cwd: rootDir,
54377
54439
  encoding: "utf-8"
54378
54440
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fusion/pi-claude-cli",
3
- "version": "0.3.1",
3
+ "version": "0.2.6",
4
4
  "description": "Fusion vendored fork: pi coding-agent extension that routes LLM calls through the Claude Code CLI. Forked from rchern/pi-claude-cli (MIT). See UPSTREAM.md.",
5
5
  "license": "MIT",
6
6
  "private": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runfusion/fusion",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "license": "MIT",
5
5
  "description": "Fusion CLI: HTTP API server, daemon, dashboard launcher, and task tooling for the Fusion AI coding agent.",
6
6
  "homepage": "https://github.com/Runfusion/Fusion#readme",
@@ -75,10 +75,10 @@
75
75
  "typescript": "^5.7.0",
76
76
  "vitest": "^3.1.0",
77
77
  "yaml": "^2.8.3",
78
- "@fusion/core": "0.1.0",
79
- "@fusion/dashboard": "0.1.0",
80
- "@fusion/engine": "0.1.0",
81
- "@fusion/pi-claude-cli": "0.3.1"
78
+ "@fusion/core": "0.2.6",
79
+ "@fusion/dashboard": "0.2.6",
80
+ "@fusion/engine": "0.2.6",
81
+ "@fusion/pi-claude-cli": "0.2.6"
82
82
  },
83
83
  "repository": {
84
84
  "type": "git",
@@ -1 +0,0 @@
1
- .pi-ext-manager{display:flex;flex-direction:column;gap:var(--space-lg)}.pi-ext-manager-header{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--space-sm);border-bottom:1px solid var(--border)}.pi-ext-manager-header .settings-section-heading{margin:0}.pi-ext-manager-actions{display:flex;gap:var(--space-sm);align-items:center}.pi-ext-description{font-size:.82rem;color:var(--text-muted);line-height:1.45;margin:0}.pi-ext-item{display:flex;align-items:flex-start;justify-content:space-between;padding:var(--space-sm) var(--space-md);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);transition:border-color var(--transition-fast);flex-wrap:wrap;gap:var(--space-sm)}.pi-ext-item:hover{border-color:var(--text-dim)}.pi-ext-item-content{display:flex;flex-direction:column;gap:var(--space-xs);min-width:0;flex:1}.pi-ext-info{display:flex;align-items:center;gap:var(--space-sm);flex-wrap:wrap}.pi-ext-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pi-ext-source-badge{display:inline-flex;align-items:center;padding:var(--space-xs) var(--space-sm);border-radius:var(--radius-pill);font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;background:color-mix(in srgb,currentColor 12%,transparent)}.pi-ext-source-badge--global{color:var(--color-info)}.pi-ext-source-badge--project{color:var(--color-success)}.pi-ext-path{font-size:.75rem;font-family:var(--font-mono);color:var(--text-dim);word-break:break-all;line-height:1.4}.pi-ext-actions{display:flex;align-items:center;gap:var(--space-xs);flex-shrink:0}.pi-ext-manager .empty-state,.pi-ext-manager .loading-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-sm);padding:var(--space-2xl);text-align:center;color:var(--text-muted)}.pi-ext-list{display:flex;flex-direction:column;gap:var(--space-sm)}.pi-ext-item{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-md);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md)}.pi-ext-add-form{display:flex;flex-direction:column;gap:var(--space-sm);margin-bottom:var(--space-md)}.pi-ext-add-form-row{display:flex;gap:var(--space-sm);align-items:center}.pi-ext-add-form-row .input{flex:1;min-width:0}.pi-ext-package-list{display:flex;flex-direction:column;gap:var(--space-sm)}.pi-ext-package-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);overflow:hidden}.pi-ext-package-header{display:flex;align-items:center;gap:var(--space-sm);padding:calc(var(--space-sm) + 2px) var(--space-md);flex-wrap:wrap}.pi-ext-expand-btn{background:none;border:none;padding:var(--space-xs);cursor:pointer;color:var(--text-muted);display:flex;align-items:center;border-radius:var(--radius-sm);transition:color var(--transition-fast)}.pi-ext-expand-btn:hover{color:var(--text)}.pi-ext-expand-btn:focus-visible{box-shadow:var(--focus-ring-strong);outline:none}.pi-ext-expand-placeholder{width:18px;height:18px;flex-shrink:0}.pi-ext-source-badge--npm{color:var(--color-info);background:color-mix(in srgb,var(--color-info) 12%,transparent)}.pi-ext-source-badge--git{color:var(--color-success);background:color-mix(in srgb,var(--color-success) 12%,transparent)}.pi-ext-source-badge--local{color:var(--text-muted);background:color-mix(in srgb,var(--text-muted) 12%,transparent)}.pi-ext-package-source{font-family:var(--font-mono);font-size:.82rem;flex:1;min-width:0;word-break:break-all}.pi-ext-filter-hint{font-size:.72rem;color:var(--text-muted);flex-shrink:0}.pi-ext-package-actions{display:flex;align-items:center;gap:var(--space-xs);flex-shrink:0}.pi-ext-remove-btn{background:none;border:none;padding:var(--space-xs);cursor:pointer;color:var(--text-muted);display:flex;align-items:center;border-radius:var(--radius-sm);transition:color var(--transition-fast)}.pi-ext-remove-btn:hover{color:var(--color-error)}.pi-ext-remove-btn:focus-visible{box-shadow:var(--focus-ring-strong);outline:none}.pi-ext-filter-list{padding:var(--space-sm) var(--space-md);border-top:1px solid var(--border);background:var(--bg);display:flex;flex-direction:column;gap:var(--space-sm)}.pi-ext-filter-section{display:flex;align-items:center;gap:var(--space-xs);flex-wrap:wrap;color:var(--text-muted)}.pi-ext-filter-label{font-size:.72rem;font-weight:500}.pi-ext-filter-tag{display:inline-flex;align-items:center;gap:var(--space-xs);padding:var(--space-xs) var(--space-sm);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);font-size:.72rem;font-family:var(--font-mono);color:var(--text-muted)}.pi-ext-top-level{display:flex;flex-direction:column;gap:var(--space-md);margin-top:var(--space-md);padding-top:var(--space-md);border-top:1px solid var(--border)}.pi-ext-section{display:flex;flex-direction:column;gap:var(--space-sm)}.pi-ext-section-header{display:flex;align-items:center;gap:var(--space-xs);color:var(--text-muted);font-size:.82rem}.pi-ext-section-header span:first-of-type{font-weight:500}.pi-ext-count{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 var(--space-xs);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-pill);font-size:.68rem;color:var(--text-dim)}.pi-ext-resource-list{display:flex;flex-wrap:wrap;gap:var(--space-xs)}.pi-ext-resource-tag{display:inline-flex;align-items:center;gap:var(--space-xs);padding:var(--space-xs) var(--space-sm);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm)}.pi-ext-resource-path{font-size:.75rem;font-family:var(--font-mono);color:var(--text-muted);max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pi-ext-resource-remove{background:none;border:none;padding:0;cursor:pointer;color:var(--text-dim);display:flex;align-items:center;border-radius:var(--radius-sm);transition:color var(--transition-fast)}.pi-ext-resource-remove:hover{color:var(--color-error)}.pi-ext-resource-remove:focus-visible{box-shadow:var(--focus-ring-strong);outline:none}@media(max-width:768px){.plugin-manager-detail-header{gap:var(--space-sm);flex-wrap:wrap}.plugin-detail-title{flex-wrap:wrap;gap:var(--space-xs)}.plugin-detail-card{padding:var(--space-md);gap:var(--space-sm)}.plugin-list{gap:var(--space-xs)}.plugin-item{padding:var(--space-md)}.plugin-actions{gap:var(--space-xs)}.plugin-detail-actions{flex-wrap:wrap;justify-content:stretch}.plugin-detail-actions button{flex:1 1 auto;min-height:36px}.pi-ext-list{gap:var(--space-xs)}.pi-ext-item{padding:var(--space-sm)}.pi-ext-add-form-row{flex-direction:column;align-items:stretch}.pi-ext-add-form-row .btn,.pi-ext-add-form-row .btn-primary{width:100%}.pi-ext-package-header{padding:var(--space-sm) var(--space-md)}.pi-ext-resource-path{max-width:120px}}.pi-ext-discovered-section{margin-top:var(--space-lg);padding-top:var(--space-lg);border-top:1px solid var(--border)}.pi-ext-discovered-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:var(--space-sm)}.pi-ext-discovered-header h4{margin:0;font-size:.9rem;font-weight:600}.pi-ext-source-badge--fusion-global{color:var(--color-info);background:color-mix(in srgb,var(--color-info) 12%,transparent)}.pi-ext-source-badge--pi-global{color:var(--color-warning);background:color-mix(in srgb,var(--color-warning) 12%,transparent)}.pi-ext-source-badge--fusion-project{color:var(--color-success);background:color-mix(in srgb,var(--color-success) 12%,transparent)}.pi-ext-source-badge--pi-project{color:var(--color-muted);background:color-mix(in srgb,var(--color-muted) 12%,transparent)}.pi-ext-source-badge--package{color:var(--in-progress);background:color-mix(in srgb,var(--in-progress) 12%,transparent)}
@@ -1,11 +0,0 @@
1
- import{r as n,j as e}from"./vendor-react-K0fH_qHe.js";import{c as A,bX as H,bY as J,bZ as Q,R as $,bN as y,w as V,K as T,D as ee,I as se,b_ as L,F as D,b$ as ae,c0 as te,c1 as _,X as ie}from"./index-CikysL-d.js";import"./vendor-xterm-DzcZoU0P.js";/**
2
- * @license lucide-react v1.7.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ne=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],I=A("palette",ne);/**
7
- * @license lucide-react v1.7.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const le=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],M=A("puzzle",le);function ce(t){return t.replace(/-/g,"-")}function re(t){return{"fusion-global":"Fusion Global","pi-global":"Pi Global","fusion-project":"Fusion Project","pi-project":"Pi Project",package:"Package"}[t]??t}function oe(t){return t.startsWith("npm:")?"npm":t.startsWith("git:")?"git":"local"}function de(t){return t.replace(/^(npm:|git:)/,"")}function he({addToast:t,projectId:x}){const[c,G]=n.useState(null),[j,P]=n.useState(!0),[f,S]=n.useState(!1),[E,w]=n.useState(!1),[h,F]=n.useState(""),[K,O]=n.useState(new Set),[m,W]=n.useState([]),[N,z]=n.useState(!0),[X,C]=n.useState(!1),r=n.useCallback(async()=>{try{P(!0);const s=await H();G(s)}catch(s){t(`Failed to load Pi settings: ${s instanceof Error?s.message:String(s)}`,"error")}finally{P(!1)}},[t]),p=n.useCallback(async()=>{try{z(!0);const s=await J(x);W(s.extensions)}catch(s){t(`Failed to load extensions: ${s instanceof Error?s.message:String(s)}`,"error")}finally{z(!1)}},[t,x]),q=n.useCallback(async s=>{try{C(!0);const i=s.enabled?[...m.filter(a=>a.enabled&&a.id!==s.id).map(a=>a.id),s.id]:m.filter(a=>a.enabled&&a.id!==s.id).map(a=>a.id);await Q(i,x),await p(),t(s.enabled?"Extension disabled":"Extension enabled","success")}catch(i){t(`Failed to update extension: ${i instanceof Error?i.message:String(i)}`,"error")}finally{C(!1)}},[m,x,p,t]);n.useEffect(()=>{r()},[r]),n.useEffect(()=>{p()},[p]);const B=s=>{O(i=>{const a=new Set(i);return a.has(s)?a.delete(s):a.add(s),a})},R=async()=>{if(!h.trim()){t("Please enter a package source","error");return}try{S(!0),await ae(h.trim()),t("Package installed successfully","success"),F(""),await r()}catch(s){t(`Failed to install package: ${s instanceof Error?s.message:String(s)}`,"error")}finally{S(!1)}},U=async()=>{try{w(!0),await te(x),await Promise.all([r(),p()]),t("Fusion skill reinstalled successfully","success")}catch(s){t(`Failed to reinstall Fusion skill: ${s instanceof Error?s.message:String(s)}`,"error")}finally{w(!1)}},Y=async s=>{if(!c)return;const i=c.packages.filter(a=>(typeof a=="string"?a:a.source)!==s);try{await _({packages:i}),t("Package removed","success"),await r()}catch(a){t(`Failed to remove package: ${a instanceof Error?a.message:String(a)}`,"error")}},Z=async(s,i)=>{if(!c)return;const a=c[s].filter(l=>l!==i);try{await _({[s]:a}),t(`${s.slice(0,-1)} removed`,"success"),await r()}catch(l){t(`Failed to update settings: ${l instanceof Error?l.message:String(l)}`,"error")}},u=(s,i,a)=>!c||c[a].length===0?null:e.jsxs("div",{className:"pi-ext-section",children:[e.jsxs("div",{className:"pi-ext-section-header",children:[e.jsx(i,{size:14}),e.jsx("span",{children:s}),e.jsx("span",{className:"pi-ext-count",children:c[a].length})]}),e.jsx("div",{className:"pi-ext-resource-list",children:c[a].map((l,b)=>e.jsxs("span",{className:"pi-ext-resource-tag",children:[e.jsx("span",{className:"pi-ext-resource-path",children:l}),e.jsx("button",{className:"pi-ext-resource-remove",onClick:()=>Z(a,l),title:`Remove ${l}`,children:e.jsx(ie,{size:12})})]},b))})]});return e.jsxs("div",{className:"pi-ext-manager",children:[e.jsxs("div",{className:"pi-ext-manager-header",children:[e.jsx("h4",{className:"settings-section-heading",children:"Pi Extensions"}),e.jsx("div",{className:"pi-ext-manager-actions",children:e.jsx("button",{className:"btn-icon",onClick:r,title:"Refresh",disabled:j,children:e.jsx($,{size:16,className:j?"spin":""})})})]}),j?e.jsx("div",{className:"loading-state",children:"Loading Pi settings…"}):c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"pi-ext-add-form",children:[e.jsxs("div",{className:"pi-ext-add-form-row",children:[e.jsx("input",{type:"text",className:"input",placeholder:"npm:pi-extension-name or git:https://github.com/...",value:h,onChange:s=>F(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),R())},disabled:f}),e.jsxs("button",{className:"btn btn-primary",onClick:R,disabled:f||!h.trim(),children:[e.jsx(V,{size:14}),f?"Installing…":"Add"]})]}),e.jsx("div",{className:"pi-ext-add-form-row",children:e.jsx("button",{className:"btn",onClick:U,disabled:E,children:E?"Reinstalling Fusion…":"Reinstall Fusion skill"})})]}),c.packages.length>0?e.jsx("div",{className:"pi-ext-package-list",children:c.packages.map((s,i)=>{const a=typeof s=="string"?s:s.source,l=oe(a),b=de(a),g=typeof s=="object"&&s!==null,v=g&&(s.extensions?.length??0)>0||(s.skills?.length??0)>0||(s.prompts?.length??0)>0||(s.themes?.length??0)>0,k=K.has(i);return e.jsxs("div",{className:"pi-ext-package-card",children:[e.jsxs("div",{className:"pi-ext-package-header",children:[g&&v?e.jsx("button",{className:"pi-ext-expand-btn",onClick:()=>B(i),"aria-expanded":k,children:k?e.jsx(T,{size:14}):e.jsx(ee,{size:14})}):e.jsx("span",{className:"pi-ext-expand-placeholder"}),e.jsx("span",{className:`pi-ext-source-badge pi-ext-source-badge--${l}`,children:l}),e.jsx("span",{className:"pi-ext-package-source",children:b}),e.jsxs("div",{className:"pi-ext-package-actions",children:[g&&v&&e.jsxs("span",{className:"pi-ext-filter-hint",children:[s.extensions?.length??0," ext,"," ",s.skills?.length??0," skill,"," ",s.prompts?.length??0," prompt,"," ",s.themes?.length??0," theme"]}),e.jsx("button",{className:"pi-ext-remove-btn",onClick:()=>Y(a),title:"Remove package",children:e.jsx(se,{size:14})})]})]}),g&&v&&k&&e.jsxs("div",{className:"pi-ext-filter-list",children:[s.extensions?.length?e.jsxs("div",{className:"pi-ext-filter-section",children:[e.jsx(M,{size:12}),e.jsx("span",{className:"pi-ext-filter-label",children:"Extensions:"}),s.extensions.map((o,d)=>e.jsx("span",{className:"pi-ext-filter-tag",children:o},d))]}):null,s.skills?.length?e.jsxs("div",{className:"pi-ext-filter-section",children:[e.jsx(L,{size:12}),e.jsx("span",{className:"pi-ext-filter-label",children:"Skills:"}),s.skills.map((o,d)=>e.jsx("span",{className:"pi-ext-filter-tag",children:o},d))]}):null,s.prompts?.length?e.jsxs("div",{className:"pi-ext-filter-section",children:[e.jsx(D,{size:12}),e.jsx("span",{className:"pi-ext-filter-label",children:"Prompts:"}),s.prompts.map((o,d)=>e.jsx("span",{className:"pi-ext-filter-tag",children:o},d))]}):null,s.themes?.length?e.jsxs("div",{className:"pi-ext-filter-section",children:[e.jsx(I,{size:12}),e.jsx("span",{className:"pi-ext-filter-label",children:"Themes:"}),s.themes.map((o,d)=>e.jsx("span",{className:"pi-ext-filter-tag",children:o},d))]}):null]})]},i)})}):e.jsxs("div",{className:"empty-state",children:[e.jsx(y,{size:32,className:"text-muted"}),e.jsx("p",{children:"No packages configured."}),e.jsx("p",{className:"text-muted",children:"Add a package source above to get started."})]}),e.jsxs("div",{className:"pi-ext-top-level",children:[u("Extensions",M,"extensions"),u("Skills",L,"skills"),u("Prompts",D,"prompts"),u("Themes",I,"themes")]})]}):e.jsxs("div",{className:"empty-state",children:[e.jsx(y,{size:32,className:"text-muted"}),e.jsx("p",{children:"Failed to load Pi settings."})]}),e.jsxs("div",{className:"pi-ext-discovered-section",children:[e.jsxs("div",{className:"pi-ext-discovered-header",children:[e.jsx("h4",{children:"Discovered Extensions"}),e.jsx("button",{className:"btn-icon",onClick:p,disabled:N,title:"Refresh extensions",children:e.jsx($,{size:14,className:N?"spin":""})})]}),e.jsx("p",{className:"pi-ext-description",children:"Installed extensions resolved from packages and configured paths."}),N?e.jsx("div",{className:"loading-state",children:"Loading extensions…"}):m.length===0?e.jsxs("div",{className:"empty-state",children:[e.jsx(y,{size:32,className:"text-muted"}),e.jsx("p",{children:"No extensions discovered."})]}):e.jsx("div",{className:"pi-ext-list",children:m.map(s=>e.jsxs("div",{className:"pi-ext-item",children:[e.jsxs("div",{className:"pi-ext-item-content",children:[e.jsxs("div",{className:"pi-ext-info",children:[e.jsx("span",{className:"pi-ext-name",children:s.name}),e.jsx("span",{className:`pi-ext-source-badge pi-ext-source-badge--${ce(s.source)}`,children:re(s.source)})]}),e.jsx("span",{className:"pi-ext-path",children:s.path})]}),e.jsx("div",{className:"pi-ext-actions",children:e.jsxs("label",{className:"toggle-switch",children:[e.jsx("input",{type:"checkbox",checked:s.enabled,onChange:()=>void q(s),disabled:X,"aria-label":`Toggle ${s.name}`}),e.jsx("span",{className:"toggle-slider"})]})})]},s.id))})]})]})}export{he as PiExtensionsManager};
@@ -1 +0,0 @@
1
- .plugin-manager,.plugin-manager-detail{display:flex;flex-direction:column;gap:var(--space-lg)}.plugin-manager-header{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--space-sm);border-bottom:1px solid var(--border)}.plugin-manager-actions{display:flex;gap:var(--space-sm);align-items:center}.plugin-install-form{display:flex;flex-direction:column;gap:var(--space-sm);padding:var(--space-lg);border:1px solid var(--border);border-radius:var(--radius-md);background:var(--surface)}.plugin-install-hint{margin:0;font-size:.85rem;color:var(--text-secondary, var(--text-muted));line-height:1.45}.plugin-install-hint code{padding:1px var(--space-xs);border-radius:var(--radius-sm);background:var(--bg-tertiary, rgba(127, 127, 127, .12));font-size:.85em}.plugin-install-actions{display:flex;gap:var(--space-sm);justify-content:flex-end}.plugin-list{display:flex;flex-direction:column;gap:var(--space-sm)}.plugin-item{display:flex;align-items:center;justify-content:space-between;padding:var(--space-md) var(--space-lg);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);transition:border-color var(--transition-fast)}.plugin-item:hover{border-color:var(--text-dim)}.plugin-info{display:flex;align-items:center;gap:var(--space-sm);min-width:0}.plugin-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.plugin-version{font-size:.85rem}.plugin-state-badge{display:inline-flex;align-items:center;padding:var(--space-xs) var(--space-sm);border-radius:var(--radius-pill);font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;background:color-mix(in srgb,currentColor 12%,transparent)}.plugin-actions{display:flex;align-items:center;gap:var(--space-xs);flex-shrink:0}.plugin-manager-detail-header,.plugin-detail-title{display:flex;align-items:center;gap:var(--space-md);flex-wrap:wrap}.plugin-detail-title h3{margin:0}.plugin-detail-content{display:flex;flex-direction:column;gap:var(--space-lg)}.plugin-detail-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);padding:var(--space-lg);display:flex;flex-direction:column;gap:var(--space-md)}.plugin-description{font-size:.95rem;color:var(--text-secondary, var(--text-muted));line-height:1.5}.plugin-detail-meta-row{display:flex;align-items:center;gap:var(--space-xs);font-size:.9rem;color:var(--text-muted)}.plugin-homepage a{display:inline-flex;align-items:center;gap:var(--space-xs);color:var(--color-info);font-size:.85rem}.plugin-settings-form .settings-section-heading{margin:0}.plugin-settings-form{display:flex;flex-direction:column;gap:var(--space-lg);margin-top:var(--space-xs)}.plugin-settings-form .form-group{padding:0;margin-bottom:0}.plugin-settings-array{display:flex;flex-direction:column;gap:var(--space-sm)}.plugin-settings-array-item{display:flex;align-items:center;gap:var(--space-sm)}.plugin-settings-array-item input{flex:1}.plugin-detail-actions{display:flex;gap:var(--space-sm);padding-top:var(--space-md);border-top:1px solid var(--border);justify-content:flex-end}.plugin-manager .empty-state,.plugin-manager .loading-state,.plugin-manager .settings-empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--space-sm);padding:var(--space-2xl);text-align:center;color:var(--text-muted)}