agent-space-manager 1.0.2 → 1.0.3
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 +9 -0
- package/index.mjs +1 -0
- package/manager.mjs +196 -20
- package/package.json +1 -1
- package/page/app.js +80 -76
- package/page/index.html +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [1.0.3] - 2026-11-14
|
|
10
|
+
|
|
11
|
+
### Added / Changed
|
|
12
|
+
- **Copy Prompt V1.6 (`page/app.js`, `page/index.html`)**: Added **No Duplicate Standalone Copies** rule and updated `Rule Invariant 1` to prevent leaving duplicate standalone copies in root `skills/`, `rules/`, `agents/`, or IDE native directories when a component belongs to a plugin.
|
|
13
|
+
- **Duplicate-Standalone Detection (`manager.mjs`)**: Added `detectDuplicateStandalones` and `upstream`/suffix matching in `scanPlugins`, `buildCategoriesRegistry`, and `syncIde` (bundle and convert modes) to exclude hub-level standalone duplicates and report pre-existing unowned IDE-level duplicates in `conflicts`.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
9
17
|
## [1.0.2] - 2026-11-14
|
|
10
18
|
|
|
11
19
|
### Added
|
|
@@ -47,6 +55,7 @@ This section tracks all revisions to the standardized instructions copied via th
|
|
|
47
55
|
## [V1.5] - 2026-11-14
|
|
48
56
|
|
|
49
57
|
### Features & Invariants
|
|
58
|
+
- **Skill Name Collision Avoidance Across Plugins (`page/app.js`, `Rule Invariant 1`)**: Updated the Copy Prompt specification and Rule Invariant 1 to avoid skill name collisions across plugins by prefixing the skill with its parent plugin name (e.g. naming a skill called `plan` in plugin `A` and `B` as `A-plan` and `B-plan`), while continuing to sequentially disambiguate other duplicate component names with `-1`, `-2`.
|
|
50
59
|
- **Dynamic Smart Middleware Intent Lifecycle (`shared/middleware-intents.json`)**: Added Rule Invariant 8 directing AI agents to register or update intent keywords and tool patterns whenever installing or modifying MCP tools in Components Storage.
|
|
51
60
|
- **Initial Run Seeding**: Mandated that the copy prompt and Smart Middleware automatically scan existing installed plugins/tools in `<Components Storage Path>/plugins/` on initial run and seed the initial `shared/middleware-intents.json` personal layer.
|
|
52
61
|
- **Uninstallation Intent Trimming**: Mandated that when a user requests uninstalling or removing a plugin via the copy prompt, the agent concurrently trims and deletes its corresponding intent entries from `shared/middleware-intents.json` so no stale tool mappings remain.
|
package/index.mjs
CHANGED
package/manager.mjs
CHANGED
|
@@ -693,6 +693,144 @@ export function listFilesRecursiveRel(dir, baseDir = dir, maxDepth = 4, depth =
|
|
|
693
693
|
return results;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
+
/**
|
|
697
|
+
* Normalizes an upstream repository URL for reliable duplicate matching.
|
|
698
|
+
*/
|
|
699
|
+
function normalizeUpstreamUrl(url = "") {
|
|
700
|
+
return String(url || "")
|
|
701
|
+
.trim()
|
|
702
|
+
.replace(/\.git$/i, "")
|
|
703
|
+
.replace(/\/+$/, "")
|
|
704
|
+
.toLowerCase();
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Extracts and normalizes the `upstream` frontmatter URL from a markdown file.
|
|
709
|
+
*/
|
|
710
|
+
function extractMarkdownUpstream(filePath) {
|
|
711
|
+
try {
|
|
712
|
+
if (!filePath || !fs.existsSync(filePath)) return "";
|
|
713
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
714
|
+
const { frontmatter } = parseMarkdownFrontmatter(raw);
|
|
715
|
+
return normalizeUpstreamUrl(frontmatter?.upstream || "");
|
|
716
|
+
} catch {
|
|
717
|
+
return "";
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Checks whether a standalone component name/upstream duplicates a plugin-bundled component.
|
|
723
|
+
*/
|
|
724
|
+
function matchesPluginComponent(standaloneName, standaloneUpstream, pluginEntries = []) {
|
|
725
|
+
const cleanBase = String(standaloneName || "").replace(/\.(md|mdc)$/i, "").toLowerCase();
|
|
726
|
+
const normUp = normalizeUpstreamUrl(standaloneUpstream);
|
|
727
|
+
for (const entry of pluginEntries) {
|
|
728
|
+
if (normUp && entry.upstream && normUp === entry.upstream) {
|
|
729
|
+
return entry;
|
|
730
|
+
}
|
|
731
|
+
const compBase = String(entry.name || "").replace(/\.(md|mdc)$/i, "").toLowerCase();
|
|
732
|
+
if (!compBase || !cleanBase) continue;
|
|
733
|
+
if (compBase === cleanBase) return entry;
|
|
734
|
+
if (cleanBase.length >= 6 && compBase.endsWith(`-${cleanBase}`)) return entry;
|
|
735
|
+
}
|
|
736
|
+
return null;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Builds normalized plugin component metadata for duplicate-standalone detection.
|
|
741
|
+
*/
|
|
742
|
+
function collectPluginComponentIndex(plugins = [], enabledMap = null) {
|
|
743
|
+
const skillEntries = [];
|
|
744
|
+
const ruleEntries = [];
|
|
745
|
+
const agentEntries = [];
|
|
746
|
+
for (const p of plugins) {
|
|
747
|
+
if (!p || p.isRootSkills || !p.path) continue;
|
|
748
|
+
if (enabledMap && enabledMap[p.id] !== true) continue;
|
|
749
|
+
const pluginUp = normalizeUpstreamUrl(p.upstream || "");
|
|
750
|
+
for (const s of p.skills || []) {
|
|
751
|
+
const skillUp = extractMarkdownUpstream(path.join(p.path, "skills", s, "SKILL.md")) || pluginUp;
|
|
752
|
+
skillEntries.push({ name: s, upstream: skillUp, pluginId: p.id });
|
|
753
|
+
}
|
|
754
|
+
for (const r of p.rules || []) {
|
|
755
|
+
const ruleUp = extractMarkdownUpstream(path.join(p.path, "rules", r)) || pluginUp;
|
|
756
|
+
ruleEntries.push({ name: r, upstream: ruleUp, pluginId: p.id });
|
|
757
|
+
}
|
|
758
|
+
for (const a of p.agents || []) {
|
|
759
|
+
const agentUp = extractMarkdownUpstream(path.join(p.path, "agents", a)) || pluginUp;
|
|
760
|
+
agentEntries.push({ name: a, upstream: agentUp, pluginId: p.id });
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return { skillEntries, ruleEntries, agentEntries };
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Detects pre-existing non-ASM-owned standalone skills, rules, or agents in target IDE
|
|
768
|
+
* directories that duplicate components already provided by enabled plugins.
|
|
769
|
+
*/
|
|
770
|
+
export function detectDuplicateStandalones(
|
|
771
|
+
allPlugins = [],
|
|
772
|
+
enabledMap = {},
|
|
773
|
+
targetDirs = {},
|
|
774
|
+
ownedFiles = [],
|
|
775
|
+
ownedLinks = []
|
|
776
|
+
) {
|
|
777
|
+
const conflicts = [];
|
|
778
|
+
const { skillEntries, ruleEntries, agentEntries } = collectPluginComponentIndex(allPlugins, enabledMap);
|
|
779
|
+
const ownedFileSet = new Set((ownedFiles || []).map((f) => path.resolve(f)));
|
|
780
|
+
const ownedLinkSet = new Set((ownedLinks || []).map((l) => path.resolve(l)));
|
|
781
|
+
|
|
782
|
+
const scanDirForDuplicates = (dir, category, pluginEntries) => {
|
|
783
|
+
if (!dir || !fs.existsSync(dir) || pluginEntries.length === 0) return;
|
|
784
|
+
try {
|
|
785
|
+
for (const ent of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
786
|
+
const fullPath = path.join(dir, ent.name);
|
|
787
|
+
const resolved = path.resolve(fullPath);
|
|
788
|
+
if (category === "skill") {
|
|
789
|
+
if (ownedLinkSet.has(resolved) || isAsmOwnedDirectory(fullPath)) continue;
|
|
790
|
+
const isDir = ent.isDirectory() || (ent.isSymbolicLink() && (() => {
|
|
791
|
+
try { return fs.statSync(fullPath).isDirectory(); } catch { return false; }
|
|
792
|
+
})());
|
|
793
|
+
if (!isDir) continue;
|
|
794
|
+
const up = extractMarkdownUpstream(path.join(fullPath, "SKILL.md"));
|
|
795
|
+
const match = matchesPluginComponent(ent.name, up, pluginEntries);
|
|
796
|
+
if (match) {
|
|
797
|
+
conflicts.push({
|
|
798
|
+
type: "duplicate-standalone",
|
|
799
|
+
category,
|
|
800
|
+
name: ent.name,
|
|
801
|
+
existingPath: fullPath,
|
|
802
|
+
pluginId: match.pluginId,
|
|
803
|
+
pluginComponent: match.name,
|
|
804
|
+
reason: `standalone skill duplicates plugin "${match.pluginId}" (${match.name})`,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
} else {
|
|
808
|
+
if (!ent.name.endsWith(".md") && !ent.name.endsWith(".mdc")) continue;
|
|
809
|
+
if (ownedFileSet.has(resolved)) continue;
|
|
810
|
+
const up = extractMarkdownUpstream(fullPath);
|
|
811
|
+
const match = matchesPluginComponent(ent.name, up, pluginEntries);
|
|
812
|
+
if (match) {
|
|
813
|
+
conflicts.push({
|
|
814
|
+
type: "duplicate-standalone",
|
|
815
|
+
category,
|
|
816
|
+
name: ent.name,
|
|
817
|
+
existingPath: fullPath,
|
|
818
|
+
pluginId: match.pluginId,
|
|
819
|
+
pluginComponent: match.name,
|
|
820
|
+
reason: `standalone ${category} duplicates plugin "${match.pluginId}" (${match.name})`,
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
} catch {}
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
scanDirForDuplicates(targetDirs.skillsDir, "skill", skillEntries);
|
|
829
|
+
scanDirForDuplicates(targetDirs.rulesDir, "rule", ruleEntries);
|
|
830
|
+
scanDirForDuplicates(targetDirs.agentsDir, "agent", agentEntries);
|
|
831
|
+
return conflicts;
|
|
832
|
+
}
|
|
833
|
+
|
|
696
834
|
/**
|
|
697
835
|
* Builds a comprehensive categorized registry of Plugins, MCPs, Hooks, Skills, Agents, and Rules.
|
|
698
836
|
*/
|
|
@@ -788,19 +926,21 @@ export function buildCategoriesRegistry(plugins = [], hubRoot = "") {
|
|
|
788
926
|
}
|
|
789
927
|
|
|
790
928
|
if (hubRoot && fs.existsSync(hubRoot)) {
|
|
929
|
+
const { ruleEntries, agentEntries } = collectPluginComponentIndex(plugins);
|
|
791
930
|
const rootAgentsDir = path.join(hubRoot, "agents");
|
|
792
931
|
if (fs.existsSync(rootAgentsDir)) {
|
|
793
932
|
try {
|
|
794
933
|
for (const a of fs.readdirSync(rootAgentsDir)) {
|
|
795
|
-
if (a.endsWith(".md")
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
934
|
+
if (!a.endsWith(".md") || seenAgents.has(a)) continue;
|
|
935
|
+
const aPath = path.join(rootAgentsDir, a);
|
|
936
|
+
if (matchesPluginComponent(a, extractMarkdownUpstream(aPath), agentEntries)) continue;
|
|
937
|
+
seenAgents.add(a);
|
|
938
|
+
categories.agents.push({
|
|
939
|
+
name: a,
|
|
940
|
+
pluginId: "root",
|
|
941
|
+
pluginName: "Root Agents",
|
|
942
|
+
sourcePath: aPath,
|
|
943
|
+
});
|
|
804
944
|
}
|
|
805
945
|
} catch {}
|
|
806
946
|
}
|
|
@@ -809,15 +949,16 @@ export function buildCategoriesRegistry(plugins = [], hubRoot = "") {
|
|
|
809
949
|
if (fs.existsSync(rootRulesDir)) {
|
|
810
950
|
try {
|
|
811
951
|
for (const r of fs.readdirSync(rootRulesDir)) {
|
|
812
|
-
if (r.endsWith(".md")
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
952
|
+
if (!r.endsWith(".md") || seenRules.has(r)) continue;
|
|
953
|
+
const rPath = path.join(rootRulesDir, r);
|
|
954
|
+
if (matchesPluginComponent(r, extractMarkdownUpstream(rPath), ruleEntries)) continue;
|
|
955
|
+
seenRules.add(r);
|
|
956
|
+
categories.rules.push({
|
|
957
|
+
name: r,
|
|
958
|
+
pluginId: "root",
|
|
959
|
+
pluginName: "Root Rules",
|
|
960
|
+
sourcePath: rPath,
|
|
961
|
+
});
|
|
821
962
|
}
|
|
822
963
|
} catch {}
|
|
823
964
|
}
|
|
@@ -1122,14 +1263,19 @@ export function scanPlugins(hubRoot = resolveHubRoot()) {
|
|
|
1122
1263
|
if (fs.existsSync(rootSkillsDir)) {
|
|
1123
1264
|
try {
|
|
1124
1265
|
const pluginSkillSet = new Set(plugins.flatMap((p) => p.skills || []));
|
|
1266
|
+
const { skillEntries } = collectPluginComponentIndex(plugins);
|
|
1125
1267
|
const rootSkills = [];
|
|
1126
1268
|
for (const se of fs.readdirSync(rootSkillsDir, { withFileTypes: true })) {
|
|
1127
1269
|
if (pluginSkillSet.has(se.name)) continue;
|
|
1270
|
+
const skillDirPath = path.join(rootSkillsDir, se.name);
|
|
1128
1271
|
let isDir = false;
|
|
1129
1272
|
try {
|
|
1130
|
-
isDir = se.isDirectory() || (se.isSymbolicLink() && fs.statSync(
|
|
1273
|
+
isDir = se.isDirectory() || (se.isSymbolicLink() && fs.statSync(skillDirPath).isDirectory());
|
|
1131
1274
|
} catch {}
|
|
1132
|
-
if (isDir)
|
|
1275
|
+
if (!isDir) continue;
|
|
1276
|
+
const up = extractMarkdownUpstream(path.join(skillDirPath, "SKILL.md"));
|
|
1277
|
+
if (matchesPluginComponent(se.name, up, skillEntries)) continue;
|
|
1278
|
+
rootSkills.push(se.name);
|
|
1133
1279
|
}
|
|
1134
1280
|
if (rootSkills.length > 0) {
|
|
1135
1281
|
const rootSkillFiles = listFilesRecursiveRel(rootSkillsDir, rootSkillsDir);
|
|
@@ -1499,6 +1645,21 @@ export function syncIdePlugins(ide, allPlugins = []) {
|
|
|
1499
1645
|
}
|
|
1500
1646
|
|
|
1501
1647
|
const allOwnedLinks = [...bundleLinks, ...skillLinks];
|
|
1648
|
+
if (isGeminiIde) {
|
|
1649
|
+
const geminiConfigDir = path.dirname(bundleDir);
|
|
1650
|
+
const dupes = detectDuplicateStandalones(
|
|
1651
|
+
allPlugins,
|
|
1652
|
+
normalized.plugins,
|
|
1653
|
+
{
|
|
1654
|
+
skillsDir: paths.skills || path.join(geminiConfigDir, "skills"),
|
|
1655
|
+
rulesDir: (paths.rules?.dir || paths.rulesDir?.dir || path.join(geminiConfigDir, "rules")),
|
|
1656
|
+
agentsDir: (paths.agents?.dir || paths.agentsDir?.dir || path.join(geminiConfigDir, "agents")),
|
|
1657
|
+
},
|
|
1658
|
+
nextFiles,
|
|
1659
|
+
allOwnedLinks
|
|
1660
|
+
);
|
|
1661
|
+
components.conflicts.push(...dupes);
|
|
1662
|
+
}
|
|
1502
1663
|
saveOwnershipState(ownerKey, { links: allOwnedLinks, files: nextFiles, jsonKeys: nextJsonKeys, blocks: nextBlocks });
|
|
1503
1664
|
return {
|
|
1504
1665
|
success: true,
|
|
@@ -1509,7 +1670,9 @@ export function syncIdePlugins(ide, allPlugins = []) {
|
|
|
1509
1670
|
skills: skillLinks.length,
|
|
1510
1671
|
rules: components.rules.length,
|
|
1511
1672
|
agents: components.agents.length,
|
|
1673
|
+
conflicts: components.conflicts.length,
|
|
1512
1674
|
},
|
|
1675
|
+
conflicts: components.conflicts,
|
|
1513
1676
|
results,
|
|
1514
1677
|
};
|
|
1515
1678
|
}
|
|
@@ -1599,6 +1762,19 @@ export function syncIdePlugins(ide, allPlugins = []) {
|
|
|
1599
1762
|
}
|
|
1600
1763
|
}
|
|
1601
1764
|
|
|
1765
|
+
const dupes = detectDuplicateStandalones(
|
|
1766
|
+
allPlugins,
|
|
1767
|
+
normalized.plugins,
|
|
1768
|
+
{
|
|
1769
|
+
skillsDir: skillsTargetDir,
|
|
1770
|
+
rulesDir: typeof paths.rules === "object" ? paths.rules?.dir : undefined,
|
|
1771
|
+
agentsDir: typeof paths.agents === "object" ? paths.agents?.dir : undefined,
|
|
1772
|
+
},
|
|
1773
|
+
nextFiles,
|
|
1774
|
+
skillSync.nextLinks
|
|
1775
|
+
);
|
|
1776
|
+
components.conflicts.push(...dupes);
|
|
1777
|
+
|
|
1602
1778
|
saveOwnershipState(ownerKey, {
|
|
1603
1779
|
links: skillSync.nextLinks,
|
|
1604
1780
|
files: nextFiles,
|
package/package.json
CHANGED
package/page/app.js
CHANGED
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
const match = files.find((f) => {
|
|
69
69
|
const r = (f.relPath || f.name || "").toLowerCase();
|
|
70
70
|
return r === `skills/${skillName.toLowerCase()}/skill.md` ||
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
r.includes(`skills/${skillName.toLowerCase()}/`) ||
|
|
72
|
+
r.endsWith(`/${skillName.toLowerCase()}/skill.md`);
|
|
73
73
|
});
|
|
74
74
|
if (match) seenFiles.add(match.relPath || match.name);
|
|
75
75
|
items.push({
|
|
@@ -195,10 +195,10 @@
|
|
|
195
195
|
|
|
196
196
|
function getMagpieApi() {
|
|
197
197
|
return globalThis.magpie?.api?.agentSpaceManager ||
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
198
|
+
globalThis.magpie?.api?.["agent-space-manager"] ||
|
|
199
|
+
globalThis.magpie?.api?.smartMiddleware ||
|
|
200
|
+
globalThis.magpie?.api?.["smart-middleware"] ||
|
|
201
|
+
globalThis.magpie?.api;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
// Non-blocking toast notifications (Desktop WebView2 Dialog Safety Invariant)
|
|
@@ -309,11 +309,11 @@
|
|
|
309
309
|
mPlugins.forEach(ensurePluginFiles);
|
|
310
310
|
try {
|
|
311
311
|
localStorage.setItem("magpie_plugins_" + norm, JSON.stringify(mPlugins));
|
|
312
|
-
} catch {}
|
|
312
|
+
} catch { }
|
|
313
313
|
return mPlugins;
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
|
-
} catch {}
|
|
316
|
+
} catch { }
|
|
317
317
|
|
|
318
318
|
// 2. Local API server dynamically with cache-busting timestamp (when running outside CSP connect-src 'none')
|
|
319
319
|
try {
|
|
@@ -324,14 +324,14 @@
|
|
|
324
324
|
data.plugins.forEach(ensurePluginFiles);
|
|
325
325
|
try {
|
|
326
326
|
localStorage.setItem("magpie_plugins_" + norm, JSON.stringify(data.plugins));
|
|
327
|
-
} catch {}
|
|
327
|
+
} catch { }
|
|
328
328
|
if (data.categories) {
|
|
329
329
|
discoveredCategories = data.categories;
|
|
330
330
|
}
|
|
331
331
|
return data.plugins;
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
} catch {}
|
|
334
|
+
} catch { }
|
|
335
335
|
|
|
336
336
|
// 3. Dynamically reload plugins-cache.js via <script> tag (allowed by Magpie iframe CSP script-src 'self'!)
|
|
337
337
|
const currentCacheNorm = normalizePathForCompare(globalThis.__PLUGINS_CACHE__?.path);
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
cached.forEach(ensurePluginFiles);
|
|
346
346
|
try {
|
|
347
347
|
localStorage.setItem("magpie_plugins_" + norm, JSON.stringify(cached));
|
|
348
|
-
} catch {}
|
|
348
|
+
} catch { }
|
|
349
349
|
if (globalThis.__PLUGINS_CACHE__.categories) {
|
|
350
350
|
discoveredCategories = globalThis.__PLUGINS_CACHE__.categories;
|
|
351
351
|
}
|
|
@@ -365,7 +365,7 @@
|
|
|
365
365
|
return cData.plugins;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
} catch {}
|
|
368
|
+
} catch { }
|
|
369
369
|
|
|
370
370
|
// 6. LocalStorage cached plugins strictly for this exact path
|
|
371
371
|
try {
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
return parsed;
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
} catch {}
|
|
380
|
+
} catch { }
|
|
381
381
|
|
|
382
382
|
return [];
|
|
383
383
|
},
|
|
@@ -389,7 +389,7 @@
|
|
|
389
389
|
const res = await magpieApi.saveConfig(config, options);
|
|
390
390
|
if (res) return res;
|
|
391
391
|
}
|
|
392
|
-
} catch {}
|
|
392
|
+
} catch { }
|
|
393
393
|
try {
|
|
394
394
|
const payload = { config, ...options };
|
|
395
395
|
const res = await fetch(`${API_BASE}/api/save`, {
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
signal: AbortSignal.timeout(5000),
|
|
419
419
|
});
|
|
420
420
|
if (res.ok) return await res.json();
|
|
421
|
-
} catch {}
|
|
421
|
+
} catch { }
|
|
422
422
|
return null;
|
|
423
423
|
},
|
|
424
424
|
|
|
@@ -435,7 +435,7 @@
|
|
|
435
435
|
signal: AbortSignal.timeout(5000),
|
|
436
436
|
});
|
|
437
437
|
if (res.ok) return await res.json();
|
|
438
|
-
} catch {}
|
|
438
|
+
} catch { }
|
|
439
439
|
return null;
|
|
440
440
|
},
|
|
441
441
|
|
|
@@ -446,7 +446,7 @@
|
|
|
446
446
|
const res = await magpieApi.resolveDroppedTarget(raw, mode);
|
|
447
447
|
if (res) return res;
|
|
448
448
|
}
|
|
449
|
-
} catch {}
|
|
449
|
+
} catch { }
|
|
450
450
|
try {
|
|
451
451
|
const res = await fetch(`${API_BASE}/api/resolve?path=${encodeURIComponent(raw || "")}&mode=${encodeURIComponent(mode || "ide")}`, { signal: AbortSignal.timeout(10000) });
|
|
452
452
|
if (res.ok) return await res.json();
|
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
const res = await magpieApi.browseFileSystem(type);
|
|
464
464
|
if (res) return res;
|
|
465
465
|
}
|
|
466
|
-
} catch {}
|
|
466
|
+
} catch { }
|
|
467
467
|
try {
|
|
468
468
|
const res = await fetch(`${API_BASE}/api/browse?type=${encodeURIComponent(type || "file")}`, { signal: AbortSignal.timeout(90000) });
|
|
469
469
|
if (res.ok) return await res.json();
|
|
@@ -480,14 +480,14 @@
|
|
|
480
480
|
const detected = await magpieApi.detectConfigPath(name, exePath);
|
|
481
481
|
if (detected) return detected;
|
|
482
482
|
}
|
|
483
|
-
} catch {}
|
|
483
|
+
} catch { }
|
|
484
484
|
try {
|
|
485
485
|
const res = await fetch(`${API_BASE}/api/detect-config?name=${encodeURIComponent(name || "")}&exePath=${encodeURIComponent(exePath || "")}`, { signal: AbortSignal.timeout(2000) });
|
|
486
486
|
if (res.ok) {
|
|
487
487
|
const data = await res.json();
|
|
488
488
|
return data.configPath;
|
|
489
489
|
}
|
|
490
|
-
} catch {}
|
|
490
|
+
} catch { }
|
|
491
491
|
return null;
|
|
492
492
|
},
|
|
493
493
|
|
|
@@ -498,11 +498,11 @@
|
|
|
498
498
|
const cfg = await magpieApi.getConfig();
|
|
499
499
|
if (cfg && Array.isArray(cfg.ides)) return cfg;
|
|
500
500
|
}
|
|
501
|
-
} catch {}
|
|
501
|
+
} catch { }
|
|
502
502
|
try {
|
|
503
503
|
const res = await fetch(`${API_BASE}/api/config`, { signal: AbortSignal.timeout(2000) });
|
|
504
504
|
if (res.ok) return await res.json();
|
|
505
|
-
} catch {}
|
|
505
|
+
} catch { }
|
|
506
506
|
return null;
|
|
507
507
|
},
|
|
508
508
|
|
|
@@ -513,14 +513,14 @@
|
|
|
513
513
|
const list = await magpieApi.getAgentProfiles();
|
|
514
514
|
if (Array.isArray(list) && list.length > 0) return list;
|
|
515
515
|
}
|
|
516
|
-
} catch {}
|
|
516
|
+
} catch { }
|
|
517
517
|
try {
|
|
518
518
|
const res = await fetch(`${API_BASE}/api/agents`, { signal: AbortSignal.timeout(2000) });
|
|
519
519
|
if (res.ok) {
|
|
520
520
|
const data = await res.json();
|
|
521
521
|
if (Array.isArray(data?.agents)) return data.agents;
|
|
522
522
|
}
|
|
523
|
-
} catch {}
|
|
523
|
+
} catch { }
|
|
524
524
|
return null;
|
|
525
525
|
},
|
|
526
526
|
|
|
@@ -531,11 +531,11 @@
|
|
|
531
531
|
const res = await magpieApi.checkModifications(customHubRoot);
|
|
532
532
|
if (res) return res;
|
|
533
533
|
}
|
|
534
|
-
} catch {}
|
|
534
|
+
} catch { }
|
|
535
535
|
try {
|
|
536
536
|
const res = await fetch(`${API_BASE}/api/check-modifications?path=${encodeURIComponent(customHubRoot || "")}&t=${Date.now()}`, { signal: AbortSignal.timeout(5000) });
|
|
537
537
|
if (res.ok) return await res.json();
|
|
538
|
-
} catch {}
|
|
538
|
+
} catch { }
|
|
539
539
|
return null;
|
|
540
540
|
},
|
|
541
541
|
|
|
@@ -546,7 +546,7 @@
|
|
|
546
546
|
const res = await magpieApi.startupSync(customConfig);
|
|
547
547
|
if (res) return res;
|
|
548
548
|
}
|
|
549
|
-
} catch {}
|
|
549
|
+
} catch { }
|
|
550
550
|
try {
|
|
551
551
|
const res = await fetch(`${API_BASE}/api/startup-sync`, {
|
|
552
552
|
method: "POST",
|
|
@@ -555,7 +555,7 @@
|
|
|
555
555
|
signal: AbortSignal.timeout(10000),
|
|
556
556
|
});
|
|
557
557
|
if (res.ok) return await res.json();
|
|
558
|
-
} catch {}
|
|
558
|
+
} catch { }
|
|
559
559
|
return null;
|
|
560
560
|
},
|
|
561
561
|
|
|
@@ -566,7 +566,7 @@
|
|
|
566
566
|
const res = await magpieApi.recheckStatus(customConfig);
|
|
567
567
|
if (res) return res;
|
|
568
568
|
}
|
|
569
|
-
} catch {}
|
|
569
|
+
} catch { }
|
|
570
570
|
try {
|
|
571
571
|
const res = await fetch(`${API_BASE}/api/recheck-status`, {
|
|
572
572
|
method: "POST",
|
|
@@ -575,7 +575,7 @@
|
|
|
575
575
|
signal: AbortSignal.timeout(8000),
|
|
576
576
|
});
|
|
577
577
|
if (res.ok) return await res.json();
|
|
578
|
-
} catch {}
|
|
578
|
+
} catch { }
|
|
579
579
|
return null;
|
|
580
580
|
},
|
|
581
581
|
|
|
@@ -587,7 +587,7 @@
|
|
|
587
587
|
const res = await magpieApi.connectAgent(target, options);
|
|
588
588
|
if (res) return res;
|
|
589
589
|
}
|
|
590
|
-
} catch {}
|
|
590
|
+
} catch { }
|
|
591
591
|
|
|
592
592
|
// Tier 2: Direct HTTP POST to local API server (if outside CSP connect-src 'none')
|
|
593
593
|
try {
|
|
@@ -629,7 +629,7 @@
|
|
|
629
629
|
if (scriptRes && scriptRes.success !== false) {
|
|
630
630
|
return scriptRes;
|
|
631
631
|
}
|
|
632
|
-
} catch {}
|
|
632
|
+
} catch { }
|
|
633
633
|
|
|
634
634
|
// Tier 4: Magpie options bridge with connect-status.js (allowed under script-src 'self')
|
|
635
635
|
try {
|
|
@@ -723,11 +723,11 @@
|
|
|
723
723
|
const res = await magpieApi.checkCentralizedUpdates(customHubRoot, { force });
|
|
724
724
|
if (res) return res;
|
|
725
725
|
}
|
|
726
|
-
} catch {}
|
|
726
|
+
} catch { }
|
|
727
727
|
try {
|
|
728
728
|
const res = await fetch(`${API_BASE}/api/central-update-check?path=${encodeURIComponent(customHubRoot || "")}&force=${force ? "true" : "false"}&t=${Date.now()}`, { signal: AbortSignal.timeout(5000) });
|
|
729
729
|
if (res.ok) return await res.json();
|
|
730
|
-
} catch {}
|
|
730
|
+
} catch { }
|
|
731
731
|
return null;
|
|
732
732
|
},
|
|
733
733
|
|
|
@@ -738,11 +738,11 @@
|
|
|
738
738
|
const res = await magpieApi.getCentralizedUpdateStatus(customHubRoot);
|
|
739
739
|
if (res) return res;
|
|
740
740
|
}
|
|
741
|
-
} catch {}
|
|
741
|
+
} catch { }
|
|
742
742
|
try {
|
|
743
743
|
const res = await fetch(`${API_BASE}/api/central-update-status?path=${encodeURIComponent(customHubRoot || "")}&t=${Date.now()}`, { signal: AbortSignal.timeout(3000) });
|
|
744
744
|
if (res.ok) return await res.json();
|
|
745
|
-
} catch {}
|
|
745
|
+
} catch { }
|
|
746
746
|
return null;
|
|
747
747
|
},
|
|
748
748
|
|
|
@@ -862,7 +862,7 @@
|
|
|
862
862
|
if (scriptStatus?.checkedAt && (Date.now() - scriptStatus.checkedAt < 12000)) {
|
|
863
863
|
return scriptStatus;
|
|
864
864
|
}
|
|
865
|
-
} catch {}
|
|
865
|
+
} catch { }
|
|
866
866
|
|
|
867
867
|
// 3. Magpie host IPC bridge
|
|
868
868
|
try {
|
|
@@ -871,14 +871,14 @@
|
|
|
871
871
|
const res = await magpieApi.getOmnirouteStatus(customPort);
|
|
872
872
|
if (res) return res;
|
|
873
873
|
}
|
|
874
|
-
} catch {}
|
|
874
|
+
} catch { }
|
|
875
875
|
|
|
876
876
|
// 4. Local API server endpoint
|
|
877
877
|
try {
|
|
878
878
|
const query = customPort ? `?port=${customPort}&t=${Date.now()}` : `?t=${Date.now()}`;
|
|
879
879
|
const res = await fetch(`${API_BASE}/api/omniroute/status${query}`, { signal: AbortSignal.timeout(2000) });
|
|
880
880
|
if (res.ok) return await res.json();
|
|
881
|
-
} catch {}
|
|
881
|
+
} catch { }
|
|
882
882
|
|
|
883
883
|
// 5. Sandboxed Magpie options watcher bridge
|
|
884
884
|
const viaOptions = await this.omnirouteViaOptions("status", customPort, 8000);
|
|
@@ -904,7 +904,7 @@
|
|
|
904
904
|
port: targetPort,
|
|
905
905
|
url: `http://localhost:${targetPort}`,
|
|
906
906
|
};
|
|
907
|
-
} catch {}
|
|
907
|
+
} catch { }
|
|
908
908
|
}
|
|
909
909
|
}
|
|
910
910
|
|
|
@@ -931,7 +931,7 @@
|
|
|
931
931
|
if (imgOk) {
|
|
932
932
|
return { installed: true, running: true, port: targetPort, url: `http://localhost:${targetPort}` };
|
|
933
933
|
}
|
|
934
|
-
} catch {}
|
|
934
|
+
} catch { }
|
|
935
935
|
|
|
936
936
|
// If omniroute-status.js has a recently verified state (< 15s), use it
|
|
937
937
|
if (globalThis.__OMNIROUTE_STATUS__?.checkedAt && (Date.now() - globalThis.__OMNIROUTE_STATUS__.checkedAt < 15000)) {
|
|
@@ -950,7 +950,7 @@
|
|
|
950
950
|
const res = await magpieApi.startOmniroute(targetPort);
|
|
951
951
|
if (res && typeof res === "object") return res;
|
|
952
952
|
}
|
|
953
|
-
} catch {}
|
|
953
|
+
} catch { }
|
|
954
954
|
|
|
955
955
|
// 2. Direct simple GET to API server (avoids CORS preflight)
|
|
956
956
|
try {
|
|
@@ -962,7 +962,7 @@
|
|
|
962
962
|
const json = await res.json();
|
|
963
963
|
if (json && (json.running || json.error)) return json;
|
|
964
964
|
}
|
|
965
|
-
} catch {}
|
|
965
|
+
} catch { }
|
|
966
966
|
|
|
967
967
|
// 3. Direct POST to API server
|
|
968
968
|
try {
|
|
@@ -976,7 +976,7 @@
|
|
|
976
976
|
const json = await res.json();
|
|
977
977
|
if (json && (json.running || json.error)) return json;
|
|
978
978
|
}
|
|
979
|
-
} catch {}
|
|
979
|
+
} catch { }
|
|
980
980
|
|
|
981
981
|
// 4. Dynamic script trigger (allowed under CSP script-src)
|
|
982
982
|
try {
|
|
@@ -1001,7 +1001,7 @@
|
|
|
1001
1001
|
document.head.appendChild(s);
|
|
1002
1002
|
});
|
|
1003
1003
|
if (scriptRes?.running) return scriptRes;
|
|
1004
|
-
} catch {}
|
|
1004
|
+
} catch { }
|
|
1005
1005
|
|
|
1006
1006
|
// 5. Sandboxed Magpie options watcher bridge
|
|
1007
1007
|
return await this.omnirouteViaOptions("start", targetPort, 28000);
|
|
@@ -1015,14 +1015,14 @@
|
|
|
1015
1015
|
const res = await magpieApi.stopOmniroute(targetPort);
|
|
1016
1016
|
if (res) return res;
|
|
1017
1017
|
}
|
|
1018
|
-
} catch {}
|
|
1018
|
+
} catch { }
|
|
1019
1019
|
try {
|
|
1020
1020
|
const res = await fetch(`${API_BASE}/api/omniroute/stop?port=${targetPort}&t=${Date.now()}`, {
|
|
1021
1021
|
method: "GET",
|
|
1022
1022
|
signal: AbortSignal.timeout(10000),
|
|
1023
1023
|
});
|
|
1024
1024
|
if (res.ok) return await res.json();
|
|
1025
|
-
} catch {}
|
|
1025
|
+
} catch { }
|
|
1026
1026
|
try {
|
|
1027
1027
|
const res = await fetch(`${API_BASE}/api/omniroute/stop`, {
|
|
1028
1028
|
method: "POST",
|
|
@@ -1032,7 +1032,7 @@
|
|
|
1032
1032
|
keepalive: true,
|
|
1033
1033
|
});
|
|
1034
1034
|
if (res.ok) return await res.json();
|
|
1035
|
-
} catch {}
|
|
1035
|
+
} catch { }
|
|
1036
1036
|
return await this.omnirouteViaOptions("stop", targetPort, 10000);
|
|
1037
1037
|
},
|
|
1038
1038
|
|
|
@@ -1046,7 +1046,7 @@
|
|
|
1046
1046
|
if (win) {
|
|
1047
1047
|
// Opened successfully in browser window
|
|
1048
1048
|
}
|
|
1049
|
-
} catch {}
|
|
1049
|
+
} catch { }
|
|
1050
1050
|
|
|
1051
1051
|
// 2. Direct fast call to local API server endpoint (GET query format avoids preflight)
|
|
1052
1052
|
try {
|
|
@@ -1055,7 +1055,7 @@
|
|
|
1055
1055
|
signal: AbortSignal.timeout(2000),
|
|
1056
1056
|
});
|
|
1057
1057
|
if (getRes.ok) return await getRes.json();
|
|
1058
|
-
} catch {}
|
|
1058
|
+
} catch { }
|
|
1059
1059
|
|
|
1060
1060
|
// 3. Wails v2 runtime Go shell open (standard in Magpie desktop host)
|
|
1061
1061
|
try {
|
|
@@ -1067,7 +1067,7 @@
|
|
|
1067
1067
|
window.wails.runtime.BrowserOpenURL(url);
|
|
1068
1068
|
return { success: true, url, method: "wails-runtime" };
|
|
1069
1069
|
}
|
|
1070
|
-
} catch {}
|
|
1070
|
+
} catch { }
|
|
1071
1071
|
|
|
1072
1072
|
// 4. Magpie host IPC bridge shell open
|
|
1073
1073
|
try {
|
|
@@ -1089,7 +1089,7 @@
|
|
|
1089
1089
|
magpie.openUrl(url);
|
|
1090
1090
|
return { success: true, url, method: "magpie-openUrl" };
|
|
1091
1091
|
}
|
|
1092
|
-
} catch {}
|
|
1092
|
+
} catch { }
|
|
1093
1093
|
|
|
1094
1094
|
// 5. Local API server POST
|
|
1095
1095
|
try {
|
|
@@ -1100,7 +1100,7 @@
|
|
|
1100
1100
|
signal: AbortSignal.timeout(3000),
|
|
1101
1101
|
});
|
|
1102
1102
|
if (res.ok) return await res.json();
|
|
1103
|
-
} catch {}
|
|
1103
|
+
} catch { }
|
|
1104
1104
|
|
|
1105
1105
|
// 6. Sandboxed Magpie frame: the plugin backend opens the OS default browser
|
|
1106
1106
|
try {
|
|
@@ -1108,7 +1108,7 @@
|
|
|
1108
1108
|
if (viaOptions && (viaOptions.opened || viaOptions.action === "open")) {
|
|
1109
1109
|
return { ...viaOptions, success: true, url };
|
|
1110
1110
|
}
|
|
1111
|
-
} catch {}
|
|
1111
|
+
} catch { }
|
|
1112
1112
|
|
|
1113
1113
|
return { success: true, url, method: "fallback" };
|
|
1114
1114
|
},
|
|
@@ -1120,7 +1120,7 @@
|
|
|
1120
1120
|
const res = await magpieApi.scanForeignComponents(agent);
|
|
1121
1121
|
if (res) return res;
|
|
1122
1122
|
}
|
|
1123
|
-
} catch {}
|
|
1123
|
+
} catch { }
|
|
1124
1124
|
try {
|
|
1125
1125
|
const res = await fetch(`${API_BASE}/api/agent/scan-foreign`, {
|
|
1126
1126
|
method: "POST",
|
|
@@ -1129,7 +1129,7 @@
|
|
|
1129
1129
|
signal: AbortSignal.timeout(6000),
|
|
1130
1130
|
});
|
|
1131
1131
|
if (res.ok) return await res.json();
|
|
1132
|
-
} catch {}
|
|
1132
|
+
} catch { }
|
|
1133
1133
|
return null;
|
|
1134
1134
|
},
|
|
1135
1135
|
|
|
@@ -1140,7 +1140,7 @@
|
|
|
1140
1140
|
const res = await magpieApi.cleanForeignComponents(components);
|
|
1141
1141
|
if (res) return res;
|
|
1142
1142
|
}
|
|
1143
|
-
} catch {}
|
|
1143
|
+
} catch { }
|
|
1144
1144
|
try {
|
|
1145
1145
|
const res = await fetch(`${API_BASE}/api/agent/clean-foreign`, {
|
|
1146
1146
|
method: "POST",
|
|
@@ -1149,7 +1149,7 @@
|
|
|
1149
1149
|
signal: AbortSignal.timeout(6000),
|
|
1150
1150
|
});
|
|
1151
1151
|
if (res.ok) return await res.json();
|
|
1152
|
-
} catch {}
|
|
1152
|
+
} catch { }
|
|
1153
1153
|
return null;
|
|
1154
1154
|
},
|
|
1155
1155
|
};
|
|
@@ -1328,7 +1328,7 @@
|
|
|
1328
1328
|
const parsed = JSON.parse(local);
|
|
1329
1329
|
if (parsed?.ides) hubConfig = parsed;
|
|
1330
1330
|
}
|
|
1331
|
-
} catch {}
|
|
1331
|
+
} catch { }
|
|
1332
1332
|
|
|
1333
1333
|
// Ensure default Antigravity IDE is present ONLY on first run if ides was never configured
|
|
1334
1334
|
if (!Array.isArray(hubConfig.ides)) {
|
|
@@ -1351,7 +1351,7 @@
|
|
|
1351
1351
|
if (Array.isArray(liveProfiles) && liveProfiles.length > 0) {
|
|
1352
1352
|
agentProfiles = liveProfiles;
|
|
1353
1353
|
}
|
|
1354
|
-
} catch {}
|
|
1354
|
+
} catch { }
|
|
1355
1355
|
await reloadPluginsFromHub();
|
|
1356
1356
|
|
|
1357
1357
|
// 4b. On startup: check for modification difference in Components Storage Path and recheck status dots for each enabled plugin in each connected agent!
|
|
@@ -1952,8 +1952,8 @@
|
|
|
1952
1952
|
item.dataset.type = "ide";
|
|
1953
1953
|
|
|
1954
1954
|
const prof = agentProfiles.find((p) => p.id === ide.agentType) ||
|
|
1955
|
-
|
|
1956
|
-
|
|
1955
|
+
agentProfiles.find((p) => ide.id?.includes(p.id) || ide.name?.toLowerCase().includes(p.id)) ||
|
|
1956
|
+
agentProfiles[0];
|
|
1957
1957
|
const modeBadge = prof?.mode === "bundle"
|
|
1958
1958
|
? `<span style="font-size:9.5px; padding:1px 5px; border-radius:4px; background:rgba(16,185,129,0.15); color:#10b981; margin-left:6px;">Bundle</span>`
|
|
1959
1959
|
: `<span style="font-size:9.5px; padding:1px 5px; border-radius:4px; background:rgba(59,130,246,0.15); color:#3b82f6; margin-left:6px;">Native Adapter</span>`;
|
|
@@ -1963,7 +1963,8 @@
|
|
|
1963
1963
|
if (syncInfo?.summary) {
|
|
1964
1964
|
const s = syncInfo.summary;
|
|
1965
1965
|
if (syncInfo.mode === "bundle") {
|
|
1966
|
-
|
|
1966
|
+
const conflictSuffix = s.conflicts ? ` · <span style="color:#f59e0b;">${s.conflicts} conflicts</span>` : "";
|
|
1967
|
+
syncSubtitle = `<div style="font-size:10px; color:#10b981; margin-top:2px;">Synced: ${s.plugins || 0} plugin bundles${conflictSuffix}</div>`;
|
|
1967
1968
|
} else {
|
|
1968
1969
|
const parts = [];
|
|
1969
1970
|
if (s.skills !== undefined) parts.push(`${s.skills} skills`);
|
|
@@ -2838,7 +2839,7 @@
|
|
|
2838
2839
|
try {
|
|
2839
2840
|
const detected = await apiClient.detectConfigPath(nameOrAgentType, exePath);
|
|
2840
2841
|
if (detected) return detected;
|
|
2841
|
-
} catch {}
|
|
2842
|
+
} catch { }
|
|
2842
2843
|
|
|
2843
2844
|
const prof = agentProfiles.find((p) => p.id === nameOrAgentType || p.label.toLowerCase() === String(nameOrAgentType || "").toLowerCase());
|
|
2844
2845
|
if (prof && prof.defaultConfigPath) {
|
|
@@ -2926,7 +2927,7 @@
|
|
|
2926
2927
|
try {
|
|
2927
2928
|
await navigator.clipboard.writeText(text);
|
|
2928
2929
|
return true;
|
|
2929
|
-
} catch {}
|
|
2930
|
+
} catch { }
|
|
2930
2931
|
}
|
|
2931
2932
|
try {
|
|
2932
2933
|
const ta = document.createElement("textarea");
|
|
@@ -3121,7 +3122,7 @@
|
|
|
3121
3122
|
if ($("btnPickHubFolder")) {
|
|
3122
3123
|
$("btnPickHubFolder").addEventListener("click", async () => {
|
|
3123
3124
|
if (hubFolderPicker) {
|
|
3124
|
-
try { hubFolderPicker.click(); } catch (err) {}
|
|
3125
|
+
try { hubFolderPicker.click(); } catch (err) { }
|
|
3125
3126
|
}
|
|
3126
3127
|
try {
|
|
3127
3128
|
$("btnPickHubFolder").textContent = "Opening...";
|
|
@@ -3248,7 +3249,7 @@
|
|
|
3248
3249
|
}
|
|
3249
3250
|
|
|
3250
3251
|
// Standardize Storage Structure Prompt Copy Button (with version display)
|
|
3251
|
-
const STORAGE_PROMPT_VERSION = "V1.
|
|
3252
|
+
const STORAGE_PROMPT_VERSION = "V1.6";
|
|
3252
3253
|
const btnCopyPrompt = $("btnCopyStoragePrompt");
|
|
3253
3254
|
if (btnCopyPrompt) {
|
|
3254
3255
|
const originalText = `Copy Prompt (${STORAGE_PROMPT_VERSION})`;
|
|
@@ -3290,7 +3291,10 @@ Components Storage root (e.g. \`<Components Storage Path>\`) contains plugins, o
|
|
|
3290
3291
|
├── plugins.json # Discovered/registered plugins index
|
|
3291
3292
|
└── skills.json # Discovered/registered skills index
|
|
3292
3293
|
|
|
3293
|
-
Duplicate Naming
|
|
3294
|
+
Duplicate Naming, Skill Collision Avoidance & No Duplicate Standalone Rule:
|
|
3295
|
+
- Skill Name Collisions Across Plugins: To avoid skill name collision across plugins, if a skill with the same name exists in two or more different plugins (e.g. a skill called "plan" in 2 different plugins called A and B), name the skill in each plugin by prefixing it with its plugin name (e.g. name the skill "plan" in A as "A-plan", and in B as "B-plan") so each skill has a distinct identifier without namespace collisions.
|
|
3296
|
+
- Other Component Duplicate Collisions: If two or more other components (plugins, agents, rules, MCPs, or standalone skills) coincidentally have the same name, append \`-1\`, \`-2\`, etc. sequentially (e.g. \`<name>-1\`, \`<name>-2\`) so every component has a unique name without colliding or overwriting.
|
|
3297
|
+
- No Duplicate Standalone Copies: NEVER leave or create a standalone copy in \`<Components Storage Path>/skills/\`, \`rules/\`, \`agents/\`, or directly inside IDE native directories (e.g. \`~/.gemini/config/skills/\`, \`~/.gemini/config/rules/\`, \`~/.cursor/rules/\`, \`~/.claude/\`) when that component belongs to a plugin in \`plugins/<plugin-name>/\`. Whenever installing or migrating a plugin, check for existing standalone or unprefixed copies matching the same \`upstream\` URL or base name (e.g. \`trail-code-auto.md\` vs \`trailhq-trail-code-auto.md\`) and move or remove the standalone copy so only the plugin-scoped copy remains.
|
|
3294
3298
|
|
|
3295
3299
|
2. Shared Folder Specification (<Components Storage Path>/shared):
|
|
3296
3300
|
The shared directory serves as the centralized cross-agent IPC, discovery, and shared coordination layer across all supported AI coding agents (Antigravity, Cursor, Windsurf, Claude Code, OpenCode, VS Code Copilot, etc.):
|
|
@@ -3344,7 +3348,7 @@ When the user asks to remove, delete, or uninstall a plugin:
|
|
|
3344
3348
|
9. Mandatory Persistent Agent Rule:
|
|
3345
3349
|
Install and persist a dedicated rule in your agent's rule system (e.g. .agents/rules/components-storage-upstream-rule.md or .cursor/rules/components-storage-upstream-rule.mdc) that is ALWAYS TRIGGERED whenever an addendum, creation, modification, edit, or removal of any component in the Components Storage Path (${storagePath || "Components Storage Path"}):
|
|
3346
3350
|
- Rule Trigger: Addendum, creation, edit, or removal of any component in Components Storage Path.
|
|
3347
|
-
- Rule Invariant 1: Ensure strict compliance with the plugin directory and shared/ directory structures above
|
|
3351
|
+
- Rule Invariant 1: Ensure strict compliance with the plugin directory and shared/ directory structures above; avoid skill name collisions across plugins by prefixing the skill with its plugin name (e.g. a skill called 'plan' in plugins A and B is named 'A-plan' and 'B-plan'), disambiguate any other coincidental duplicate component names by appending -1, -2, etc. sequentially, and never leave duplicate standalone copies in root skills/rules/agents or IDE native config directories when the component belongs to a plugin (remove or migrate any pre-existing standalone/unprefixed copy matching the same upstream URL or base name).
|
|
3348
3352
|
- Rule Invariant 2: Always add and preserve the upstream link in the component's manifest or frontmatter.
|
|
3349
3353
|
- Rule Invariant 3: Complete removal cleanup — when removing a plugin, all components related to that plugin (skills, agents, rules, MCP servers, hooks) AND its entries in shared/middleware-intents.json must be cleanly removed and trimmed with no orphaned leftovers.
|
|
3350
3354
|
- Rule Invariant 4: Never introduce decentralized or component-level update scripts; all update checking is handled centrally by the Agent Space Manager plugin on Monday startup.
|
|
@@ -3353,14 +3357,14 @@ Install and persist a dedicated rule in your agent's rule system (e.g. .agents/r
|
|
|
3353
3357
|
- Rule Invariant 7: Universal Shared Directory Preservation & Naming — preserve <Components Storage Path>/shared (agent-connectors.json, handoff/, _upstream_backups/, middleware-intents.json) as the designated cross-agent communication and data hub; never treat it as an orphaned or removable plugin; any subfolders in shared/ must be named after their joining skills (e.g. stagehand-fastcrw joining stagehand and fastcrw).
|
|
3354
3358
|
- Rule Invariant 8: Dynamic Smart Middleware Intent Lifecycle & Seeding — (a) on initial run, seed shared/middleware-intents.json based on all currently existing plugins and tools in Components Storage; (b) when adding new components with tools, register their intent keywords and tool patterns in shared/middleware-intents.json; (c) when removing components, trim and prune their intent entries from shared/middleware-intents.json so the personal layer remains trimmed and accurate.
|
|
3355
3359
|
|
|
3356
|
-
Please inspect ${storagePath || "Components Storage Path"}, clean up non-conforming or loose files, ensure all component manifests and frontmatters contain their upstream links, ensure all JSON files are valid UTF-8 without BOM, purge any decentralized update checking scripts, ensure removal rules cover all related components and trim middleware intents, preserve the shared/ cross-agent folder, seed or update tool intent keywords in shared/middleware-intents.json based on existing installed components, respect one-time rearrangement stability if already arranged, and persist the rule into your agent's rules.`;
|
|
3360
|
+
Please inspect ${storagePath || "Components Storage Path"}, clean up non-conforming or loose files, ensure all component manifests and frontmatters contain their upstream links, ensure all JSON files are valid UTF-8 without BOM, purge any decentralized update checking scripts, ensure removal rules cover all related components and trim middleware intents, resolve skill name collisions across plugins by prefixing plugin names (e.g. A-plan, B-plan), preserve the shared/ cross-agent folder, seed or update tool intent keywords in shared/middleware-intents.json based on existing installed components, respect one-time rearrangement stability if already arranged, and persist the rule into your agent's rules.`;
|
|
3357
3361
|
|
|
3358
3362
|
let copied = false;
|
|
3359
3363
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
3360
3364
|
try {
|
|
3361
3365
|
await navigator.clipboard.writeText(promptText);
|
|
3362
3366
|
copied = true;
|
|
3363
|
-
} catch {}
|
|
3367
|
+
} catch { }
|
|
3364
3368
|
}
|
|
3365
3369
|
if (!copied) {
|
|
3366
3370
|
try {
|
|
@@ -3373,7 +3377,7 @@ Please inspect ${storagePath || "Components Storage Path"}, clean up non-conform
|
|
|
3373
3377
|
document.execCommand("copy");
|
|
3374
3378
|
document.body.removeChild(ta);
|
|
3375
3379
|
copied = true;
|
|
3376
|
-
} catch {}
|
|
3380
|
+
} catch { }
|
|
3377
3381
|
}
|
|
3378
3382
|
|
|
3379
3383
|
btnCopyPrompt.textContent = copied ? "Copied!" : "Copy Failed";
|
|
@@ -3526,7 +3530,7 @@ Please inspect ${storagePath || "Components Storage Path"}, clean up non-conform
|
|
|
3526
3530
|
if ($("btnBrowseIdeExe")) {
|
|
3527
3531
|
$("btnBrowseIdeExe").addEventListener("click", async () => {
|
|
3528
3532
|
if (ideExePicker) {
|
|
3529
|
-
try { ideExePicker.click(); } catch (err) {}
|
|
3533
|
+
try { ideExePicker.click(); } catch (err) { }
|
|
3530
3534
|
}
|
|
3531
3535
|
try {
|
|
3532
3536
|
$("btnBrowseIdeExe").textContent = "Opening...";
|
|
@@ -3593,7 +3597,7 @@ Please inspect ${storagePath || "Components Storage Path"}, clean up non-conform
|
|
|
3593
3597
|
if ($("btnBrowseProjectPath")) {
|
|
3594
3598
|
$("btnBrowseProjectPath").addEventListener("click", async () => {
|
|
3595
3599
|
if (projectFolderPicker) {
|
|
3596
|
-
try { projectFolderPicker.click(); } catch (err) {}
|
|
3600
|
+
try { projectFolderPicker.click(); } catch (err) { }
|
|
3597
3601
|
}
|
|
3598
3602
|
try {
|
|
3599
3603
|
$("btnBrowseProjectPath").textContent = "Opening...";
|
|
@@ -3933,7 +3937,7 @@ Please inspect ${storagePath || "Components Storage Path"}, clean up non-conform
|
|
|
3933
3937
|
const norm = normalizePathForCompare(effectivePath);
|
|
3934
3938
|
try {
|
|
3935
3939
|
localStorage.removeItem("magpie_plugins_" + norm);
|
|
3936
|
-
} catch {}
|
|
3940
|
+
} catch { }
|
|
3937
3941
|
|
|
3938
3942
|
await new Promise((r) => setTimeout(r, 200));
|
|
3939
3943
|
if (bar) bar.style.width = "40%";
|
|
@@ -4169,7 +4173,7 @@ Please inspect ${storagePath || "Components Storage Path"}, clean up non-conform
|
|
|
4169
4173
|
async function persistConfig(forceRescan = false, options = { connect: false, sync: false }) {
|
|
4170
4174
|
try {
|
|
4171
4175
|
localStorage.setItem("magpie_agent_space_config", JSON.stringify(hubConfig));
|
|
4172
|
-
} catch {}
|
|
4176
|
+
} catch { }
|
|
4173
4177
|
|
|
4174
4178
|
// 1. Try direct API server first (works in browser / unrestricted WebView)
|
|
4175
4179
|
const saveRes = await apiClient.saveConfig(hubConfig, options);
|
package/page/index.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<div>
|
|
18
18
|
<div class="title-row">
|
|
19
19
|
<h1>Agent Space Manager</h1>
|
|
20
|
-
<span class="plugin-version-badge" id="pluginVersionBadge">V1.0.
|
|
20
|
+
<span class="plugin-version-badge" id="pluginVersionBadge">V1.0.3</span>
|
|
21
21
|
</div>
|
|
22
22
|
<p class="subtitle" id="main-subtitle">Universal Multi-IDE & Project Skill Orchestrator</p>
|
|
23
23
|
</div>
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
<div class="prompt-desc">
|
|
133
133
|
Ask your AI agent to enforce standard layouts, record upstream links, and install rules for component addendum/edits.
|
|
134
134
|
</div>
|
|
135
|
-
<button type="button" class="btn-copy-prompt" id="btnCopyStoragePrompt" title="Copy prompt for your AI agent to standardize Components Storage file structure, enforce upstream links, clean up plugins, enforce UTF-8 No BOM encoding, respect one-time rearrangement stability, preserve shared cross-agent communication folders, maintain dynamic Smart Middleware intent rules, and install rules">Copy Prompt (V1.
|
|
135
|
+
<button type="button" class="btn-copy-prompt" id="btnCopyStoragePrompt" title="Copy prompt for your AI agent to standardize Components Storage file structure, enforce upstream links, clean up plugins, enforce UTF-8 No BOM encoding, respect one-time rearrangement stability, preserve shared cross-agent communication folders, maintain dynamic Smart Middleware intent rules, and install rules">Copy Prompt (V1.6)</button>
|
|
136
136
|
</div>
|
|
137
137
|
|
|
138
138
|
<!-- Tile 4: Gateway Tool Optimization (Adjustable Cap with "Default" button) -->
|