Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
da9c15c
Project import generated by Copybara.
Sep 20, 2026
9bfb7ad
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 20, 2026
2e3ada5
Project import generated by Copybara.
Sep 20, 2026
c791e1b
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 20, 2026
1977eb7
chore: project endpoint from Mono a2e8b231b208
Sep 20, 2026
b8a08a0
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 21, 2026
ff85ac7
chore: project endpoint from Mono 9b559bc70e7d
Sep 21, 2026
6214513
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 21, 2026
6188d83
chore: project endpoint from Mono 9a003786d767
Sep 21, 2026
692ee44
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 21, 2026
a8e83c3
chore: project endpoint from Mono 511bd2305f5a
Sep 21, 2026
ba59fec
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 21, 2026
b0061c7
chore: project endpoint from Mono ad7b9df0b712
Sep 21, 2026
2656701
chore: project endpoint from Mono 4ab4845398fd
Sep 21, 2026
13786d3
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 22, 2026
f6b9091
chore: project endpoint from Mono 2df44a8283c0
Sep 22, 2026
8bd7af4
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 23, 2026
1bddf52
chore: project endpoint from Mono 19eb7fff08ad
Sep 23, 2026
79aef39
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 23, 2026
8b9551a
chore: project endpoint from Mono be57256872b9
Sep 23, 2026
8635f11
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 23, 2026
0f1b3ef
chore: project endpoint from Mono fc21676e9136
Sep 23, 2026
a7ad5e7
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 23, 2026
f2529d1
chore: project endpoint from Mono 0d25f444e779
Sep 23, 2026
7e39251
Merge remote-tracking branch 'origin/main' into sync/mono-projection
github-actions[bot] Sep 24, 2026
8bfc1c7
chore: project endpoint from Mono 68580466ba81
Sep 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .repository-projection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"projection": "endpoint",
"projectionSchemaVersion": 1,
"sourceRepository": "dx-corp/mono",
"sourceSha": "0d25f444e7799874298801a23f5a5c3a5e5003a2",
"sourceSha": "68580466ba8135da1cfa25c6259800c32659d6d1",
"destinationRepository": "dx-corp/endpoint",
"priorProjectedBase": "5b09a4650684da900ad94b518e4360f64d7fdd5a",
"priorProjectedBase": "7287d525f43da516baa3f76c63d4e13603f30785",
"definitionDigest": "8068fb5528eff3a9256419584bb34a9722ea322c288ee4cfda088ff93fb60ec6",
"toolDigest": "898e8657d9153a2a51d7c283bf83bb3350b5d1e6",
"contentDigest": "f104a7a0f4ffd84a4a0f643452fee149c06a0a15320c3a0aec207f71d53ce472",
"contentDigest": "a0d68f21dc50f154471ba8bbb8ef0d5ad91a560020bd9e09c6c3b91817235b81",
"publicationEligible": true
}
42 changes: 30 additions & 12 deletions macos/Sources/MerlinMacOS/Inventory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ struct DeviceInventory: Encodable, Sendable {

struct DeviceAgentCLI: Encodable, Sendable { let name: String }
struct DeviceAgentApp: Encodable, Sendable { let name: String }
struct DeviceMCPServer: Encodable, Sendable { let client: String; let name: String }
struct DeviceAgentAsset: Encodable, Sendable { let client: String; let kind: String; let name: String }
struct DeviceMCPServer: Encodable, Sendable { let client: String; let name: String; let source: String }
struct DeviceAgentAsset: Encodable, Sendable { let client: String; let kind: String; let name: String; let source: String }

struct DevicePackage: Encodable, Sendable {
let name: String
Expand Down Expand Up @@ -214,9 +214,12 @@ func collectMacAgentDiscovery(homes: [String], systemBins: [String], appRoots: [
("amp", ".config/amp/settings.json", false),
("qwen", ".qwen/settings.json", false),
("pi", ".pi/agent/settings.json", false),
("maestro", ".maestro/config.toml", true),
("maestro", ".composer/config.toml", true),
]
var found = Set<String>()
var assetNames = Set<String>()
var pluginConfigReads = 0
for home in homes.prefix(65) {
let assetDirs: [(String, String, String, String)] = [
("agents", "skill", ".agents/skills", "skill"),
Expand All @@ -232,6 +235,9 @@ func collectMacAgentDiscovery(homes: [String], systemBins: [String], appRoots: [
("qwen", "skill", ".qwen/skills", "skill"),
("pi", "skill", ".pi/agent/skills", "skill"),
("pi", "extension", ".pi/agent/extensions", "js-ts"),
("maestro", "skill", ".composer/skills", "skill"),
("maestro", "plugin", ".maestro/plugins", "plugin-directory"),
("maestro", "plugin", ".composer/plugins", "plugin-directory"),
]
for (client, kind, relative, format) in assetDirs {
let directory = "\(home)/\(relative)"
Expand All @@ -248,17 +254,29 @@ func collectMacAgentDiscovery(homes: [String], systemBins: [String], appRoots: [
} else if format == "directory" && type == mode_t(S_IFDIR) {
var manifest = stat()
name = lstat("\(path)/gemini-extension.json", &manifest) == 0 && (manifest.st_mode & mode_t(S_IFMT)) == mode_t(S_IFREG) ? entry : nil
} else if format == "plugin-directory" && type == mode_t(S_IFDIR) {
name = entry
} else if type == mode_t(S_IFREG) && format == "md" && entry.hasSuffix(".md") {
name = String(entry.dropLast(3))
} else if type == mode_t(S_IFREG) && format == "js-ts" && (entry.hasSuffix(".js") || entry.hasSuffix(".ts")) {
name = String(entry.dropLast(3))
} else { name = nil }
if let name, safeAgentAssetName(name) {
assetNames.insert("\(client)\u{0}\(kind)\u{0}\(name)")
assetNames.insert("\(client)\u{0}\(kind)\u{0}\(name)\u{0}\(relative)")
if client == "gemini" && kind == "extension", let data = readAgentConfigNoFollow("\(path)/gemini-extension.json") {
let object = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any]
for server in ((object?["mcpServers"] as? [String: Any]).map { Array($0.keys) } ?? []) where safeAgentAssetName(server) {
found.insert("gemini\u{0}\(server)")
found.insert("gemini\u{0}\(server)\u{0}.gemini/extensions/*/gemini-extension.json")
}
}
if client == "maestro" && kind == "plugin" {
for config in ["mcp.json", ".mcp.json"] where pluginConfigReads < 32 {
guard let data = readAgentConfigNoFollow("\(path)/\(config)") else { continue }
pluginConfigReads += 1
let object = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any]
for server in ((object?["mcpServers"] as? [String: Any]).map { Array($0.keys) } ?? []) where safeAgentAssetName(server) {
found.insert("maestro\u{0}\(server)\u{0}\(relative)/*/\(config)")
}
}
}
if assetNames.count >= 128 { break }
Expand All @@ -268,12 +286,12 @@ func collectMacAgentDiscovery(homes: [String], systemBins: [String], appRoots: [
}
for (client, relative, isTOML) in configs {
guard let data = readAgentConfigNoFollow("\(home)/\(relative)") else { continue }
assetNames.insert("\(client)\u{0}config\u{0}user")
assetNames.insert("\(client)\u{0}config\u{0}user\u{0}\(relative)")
if client == "claude" && relative == ".claude/settings.json" {
let object = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any]
let plugins = object?["enabledPlugins"] as? [String: Bool] ?? [:]
for (name, enabled) in plugins where enabled && safeAgentAssetName(name) {
assetNames.insert("claude\u{0}plugin\u{0}\(name)")
assetNames.insert("claude\u{0}plugin\u{0}\(name)\u{0}.claude/settings.json")
}
continue
}
Expand All @@ -300,22 +318,22 @@ func collectMacAgentDiscovery(homes: [String], systemBins: [String], appRoots: [
names = entries.map { Array($0.keys) } ?? []
}
for name in names where name.utf8.count <= 128 && !name.unicodeScalars.contains(where: CharacterSet.controlCharacters.contains) {
found.insert("\(client)\u{0}\(name)")
found.insert("\(client)\u{0}\(name)\u{0}\(relative)")
if found.count >= 128 { break }
}
if found.count >= 128 { break }
}
if found.count >= 128 { break }
}
let servers = found.sorted().prefix(128).compactMap { entry -> DeviceMCPServer? in
let parts = entry.split(separator: "\u{0}", maxSplits: 1)
guard parts.count == 2 else { return nil }
return DeviceMCPServer(client: String(parts[0]), name: String(parts[1]))
let parts = entry.split(separator: "\u{0}")
guard parts.count == 3 else { return nil }
return DeviceMCPServer(client: String(parts[0]), name: String(parts[1]), source: String(parts[2]))
}
let assets = assetNames.sorted().prefix(128).compactMap { entry -> DeviceAgentAsset? in
let parts = entry.split(separator: "\u{0}")
guard parts.count == 3 else { return nil }
return DeviceAgentAsset(client: String(parts[0]), kind: String(parts[1]), name: String(parts[2]))
guard parts.count == 4 else { return nil }
return DeviceAgentAsset(client: String(parts[0]), kind: String(parts[1]), name: String(parts[2]), source: String(parts[3]))
}
return (clis, apps, servers, assets)
}
Expand Down
18 changes: 16 additions & 2 deletions macos/Tests/MerlinMacOSTests/SyncTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ struct SyncTests {
try FileManager.default.createDirectory(atPath: home + "/.claude/agents", withIntermediateDirectories: true)
try FileManager.default.createDirectory(atPath: home + "/.config/amp", withIntermediateDirectories: true)
try FileManager.default.createDirectory(atPath: home + "/.config/opencode/plugins", withIntermediateDirectories: true)
try FileManager.default.createDirectory(atPath: home + "/.maestro/plugins/audit/.plugin", withIntermediateDirectories: true)
try FileManager.default.createDirectory(atPath: home + "/.maestro/plugins/convention", withIntermediateDirectories: true)
try FileManager.default.createDirectory(atPath: home + "/.composer/skills/review", withIntermediateDirectories: true)
try FileManager.default.createDirectory(atPath: home + "/Applications/Cursor.app", withIntermediateDirectories: true)
try FileManager.default.createSymbolicLink(atPath: home + "/Applications/Codex.app", withDestinationPath: home + "/Applications/Cursor.app")
try "[mcp_servers.github]\nurl = 'https://secret.example'\n".write(toFile: home + "/.codex/config.toml", atomically: true, encoding: .utf8)
Expand All @@ -161,18 +164,29 @@ struct SyncTests {
try #"{"enabledPlugins":{"audit@marketplace":true,"off@marketplace":false}}"#.write(toFile: home + "/.claude/settings.json", atomically: true, encoding: .utf8)
try #"{"amp.mcpServers":{"db":{"command":"secret"}}}"#.write(toFile: home + "/.config/amp/settings.json", atomically: true, encoding: .utf8)
try "secret plugin".write(toFile: home + "/.config/opencode/plugins/trace.ts", atomically: true, encoding: .utf8)
try "secret plugin".write(toFile: home + "/.maestro/plugins/audit/.plugin/plugin.json", atomically: true, encoding: .utf8)
try #"{"mcpServers":{"pluginsearch":{"command":"secret"}}}"#.write(toFile: home + "/.maestro/plugins/audit/mcp.json", atomically: true, encoding: .utf8)
try "secret skill".write(toFile: home + "/.composer/skills/review/SKILL.md", atomically: true, encoding: .utf8)
try "[mcp_servers.managed]\nurl = 'https://secret.example'\n".write(toFile: home + "/.maestro/config.toml", atomically: true, encoding: .utf8)
let cli = home + "/.local/bin/codex"
try "#!/bin/sh\n".write(toFile: cli, atomically: true, encoding: .utf8)
try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: cli)

let discovered = collectMacAgentDiscovery(homes: [home], systemBins: [], appRoots: [home + "/Applications"])
#expect(discovered.clis.map(\.name) == ["codex"])
#expect(discovered.apps.map(\.name) == ["cursor"])
#expect(discovered.servers.map { "\($0.client):\($0.name)" } == ["amp:db", "codex:github", "cursor:docs", "gemini:search"])
#expect(discovered.servers.map { "\($0.client):\($0.name)" } == ["amp:db", "codex:github", "cursor:docs", "gemini:search", "maestro:managed", "maestro:pluginsearch"])
#expect(discovered.servers.contains { $0.client == "codex" && $0.source == ".codex/config.toml" })
#expect(discovered.servers.contains { $0.client == "gemini" && $0.source == ".gemini/extensions/*/gemini-extension.json" })
#expect(discovered.servers.contains { $0.client == "maestro" && $0.name == "managed" && $0.source == ".maestro/config.toml" })
#expect(discovered.servers.contains { $0.client == "maestro" && $0.name == "pluginsearch" && $0.source == ".maestro/plugins/*/mcp.json" })
#expect(discovered.assets.contains { $0.client == "agents" && $0.kind == "skill" && $0.name == "review" })
#expect(discovered.assets.contains { $0.client == "claude" && $0.kind == "agent" && $0.name == "reviewer" })
#expect(discovered.assets.contains { $0.client == "claude" && $0.kind == "plugin" && $0.name == "audit@marketplace" })
#expect(discovered.assets.contains { $0.client == "opencode" && $0.kind == "plugin" && $0.name == "trace" })
#expect(discovered.assets.contains { $0.client == "maestro" && $0.kind == "plugin" && $0.name == "audit" })
#expect(discovered.assets.contains { $0.client == "maestro" && $0.kind == "skill" && $0.name == "review" })
#expect(discovered.assets.contains { $0.client == "maestro" && $0.kind == "plugin" && $0.name == "convention" })
#expect(!discovered.assets.contains { $0.name == "off@marketplace" })
#expect(!discovered.assets.contains { $0.name == "not-extension" })
#expect(!discovered.assets.contains { $0.client == "pi" && $0.name == "review" })
Expand All @@ -182,7 +196,7 @@ struct SyncTests {

try FileManager.default.removeItem(atPath: home + "/.cursor/mcp.json")
try FileManager.default.createSymbolicLink(atPath: home + "/.cursor/mcp.json", withDestinationPath: home + "/.codex/config.toml")
#expect(collectMacAgentDiscovery(homes: [home], systemBins: []).servers.count == 3)
#expect(collectMacAgentDiscovery(homes: [home], systemBins: []).servers.count == 5)
}

@Test("host id is a 16-char hash, not the raw UUID")
Expand Down
Loading